osgEarth 2.1.1
Classes | Functions | Variables

anonymous_namespace{Graticule.cpp} Namespace Reference

Classes

struct  HardCodeCellBoundCB

Functions

GeometrycreateCellGeometry (const GeoExtent &tex, double lw, const GeoExtent &profEx, bool isGeocentric)
osg::Node * createTextTransform (double x, double y, double value, const osg::EllipsoidModel *ell, float size, const osg::Vec4f &color, float rotation=0.0f)

Variables

char s_vertexShader [] = "} \n"
char s_fragmentShader [] = "} \n"

Function Documentation

Geometry* anonymous_namespace{Graticule.cpp}::createCellGeometry ( const GeoExtent tex,
double  lw,
const GeoExtent profEx,
bool  isGeocentric 
)

Definition at line 198 of file Graticule.cpp.

    {            
        LineString* geom = 0L;

        if ( tex.yMin() == profEx.yMin() )
        {
            geom = new LineString(2);
            geom->push_back( osg::Vec3d( tex.xMin(), tex.yMax(), 0 ) );
            geom->push_back( osg::Vec3d( tex.xMin(), tex.yMin(), 0 ) );
        }
        else
        {
            geom = new LineString(3);
            geom->push_back( osg::Vec3d( tex.xMin(), tex.yMax(), 0 ) );
            geom->push_back( osg::Vec3d( tex.xMin(), tex.yMin(), 0 ) );
            geom->push_back( osg::Vec3d( tex.xMax(), tex.yMin(), 0 ) );
        }

        return geom;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

osg::Node* anonymous_namespace{Graticule.cpp}::createTextTransform ( double  x,
double  y,
double  value,
const osg::EllipsoidModel *  ell,
float  size,
const osg::Vec4f &  color,
float  rotation = 0.0f 
)

Definition at line 227 of file Graticule.cpp.

    {    
        osg::Vec3d pos;
        if ( ell ) // is geocentric
        {
            ell->convertLatLongHeightToXYZ(
                osg::DegreesToRadians( y ),
                osg::DegreesToRadians( x ),
                0,
                pos.x(), pos.y(), pos.z() );
        }
        else
        {
            pos.set( x, y, 0 );
        }

        osgText::Text* t = new osgText::Text();
        t->setFont( "fonts/arial.ttf" );
        t->setAlignment( osgText::Text::CENTER_BOTTOM );
        t->setCharacterSizeMode( osgText::Text::SCREEN_COORDS );
        t->setCharacterSize( size );
        t->setBackdropType( osgText::Text::OUTLINE );
        t->setBackdropColor( osg::Vec4f(0,0,0,1) );
        t->setColor( color );

        std::stringstream buf;
        buf << std::fixed << std::setprecision(3) << value;
        std::string bufStr = buf.str();
        t->setText( bufStr );

        if ( rotation != 0.0f ) 
        {
            osg::Quat rot;
            rot.makeRotate( osg::DegreesToRadians(rotation), 0, 0, 1 );
            t->setRotation( rot );
        }

        osg::Geode* geode = new osg::Geode();
        geode->addDrawable( t );

        osg::Matrixd L2W;
        ell->computeLocalToWorldTransformFromXYZ(
            pos.x(), pos.y(), pos.z(), L2W );

        osg::MatrixTransform* xform = new osg::MatrixTransform();
        xform->setMatrix( L2W );
        xform->addChild( geode );     

        // in geocentric mode, install a plane culler
        if ( ell )
            xform->setCullCallback( new CullNodeByNormal(pos) );

        return xform;
    }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

char anonymous_namespace{Graticule.cpp}::s_fragmentShader[] = "} \n"

Definition at line 70 of file Graticule.cpp.

char anonymous_namespace{Graticule.cpp}::s_vertexShader[] = "} \n"

Definition at line 61 of file Graticule.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines