osgEarth 2.1.1
Functions | Variables

anonymous_namespace{SpatialData.cpp} Namespace Reference

Functions

unsigned getIndex (const GeoExtent &cellExtent, const osg::Vec3d &point, unsigned xdim, unsigned ydim)
osg::Geode * makeClusterGeode (const GeoExtent &cellExtent, unsigned num)
GeoObjectCollection::iterator findObject (GeoObjectCollection &objects, GeoObject *object)

Variables

static osgText::Font * s_font = 0L

Function Documentation

GeoObjectCollection::iterator anonymous_namespace{SpatialData.cpp}::findObject ( GeoObjectCollection objects,
GeoObject object 
)

Definition at line 88 of file SpatialData.cpp.

    {
        float key = object->getPriority();
        GeoObjectCollection::iterator first = objects.find(key);
        if ( first == objects.end() )
            return objects.end();

        GeoObjectCollection::iterator last = objects.upper_bound(key);
        for( ; first != last; ++first )
            if ( first->second.get() == object )
                return first;

        return objects.end();
    }

Here is the caller graph for this function:

unsigned anonymous_namespace{SpatialData.cpp}::getIndex ( const GeoExtent cellExtent,
const osg::Vec3d &  point,
unsigned  xdim,
unsigned  ydim 
)

Definition at line 37 of file SpatialData.cpp.

    {
        double cw = cellExtent.width() / (double)xdim;
        double ch = cellExtent.height() / (double)ydim;

        unsigned col = osg::clampBelow( (unsigned)((point.x()-cellExtent.xMin())/cw), xdim-1 );
        unsigned row = osg::clampBelow( (unsigned)((point.y()-cellExtent.yMin())/ch), ydim-1 );

        return row*xdim + col;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

osg::Geode* anonymous_namespace{SpatialData.cpp}::makeClusterGeode ( const GeoExtent cellExtent,
unsigned  num 
)

Definition at line 50 of file SpatialData.cpp.

    {
        osgText::Text* t = new osgText::Text();

        double clat, clon;
        cellExtent.getCentroid( clon, clat );
        osg::Vec3d xyz;        
        cellExtent.getSRS()->getEllipsoid()->convertLatLongHeightToXYZ(
            osg::DegreesToRadians( clat ), osg::DegreesToRadians( clon ), 0, xyz.x(), xyz.y(), xyz.z() );
        t->setPosition( xyz );
        
        std::stringstream buf;
        buf << num;
        t->setText( buf.str() );
        t->setCharacterSizeMode( osgText::TextBase::SCREEN_COORDS );
        t->setCharacterSize( 22.0f );
        t->setAutoRotateToScreen( true );

        if ( !s_font )
            s_font = osgText::readFontFile( "arialbd.ttf" );
        t->setFont( s_font );

        t->setBackdropType( osgText::Text::OUTLINE );
        t->setColor( osg::Vec4(1,1,1,1) );
        t->setBackdropColor( osg::Vec4(0,0,0,1) );

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

        osg::StateSet* s = geode->getOrCreateStateSet();
        s->setAttributeAndModes( new osg::Depth(osg::Depth::ALWAYS) );

        t->setDataVariance( osg::Object::DYNAMIC );

        return geode;
    }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

osgText::Font* anonymous_namespace{SpatialData.cpp}::s_font = 0L [static]

Definition at line 48 of file SpatialData.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines