osgEarth 2.1.1
Public Member Functions | Protected Member Functions | Protected Attributes

osgEarth::Util::FeatureEditor Class Reference

List of all members.

Public Member Functions

 FeatureEditor (osgEarth::Features::Feature *feature, osgEarth::Features::FeatureSource *source, osgEarth::MapNode *mapNode)
const osg::Vec4f & getPickColor () const
void setPickColor (const osg::Vec4f &pickColor)
const osg::Vec4f & getColor () const
void setColor (const osg::Vec4f &color)
float getSize () const
void setSize (float size)

Protected Member Functions

void init ()

Protected Attributes

osg::Vec4f _pickColor
osg::Vec4f _color
float _size
osg::ref_ptr
< osgEarth::Features::Feature
_feature
osg::ref_ptr
< osgEarth::Features::FeatureSource
_source
osg::ref_ptr< osgEarth::MapNode_mapNode

Detailed Description

Node you can add to your scene graph to edit the verts of a Feature's Geometry

Definition at line 80 of file FeatureEditing.


Constructor & Destructor Documentation

FeatureEditor::FeatureEditor ( osgEarth::Features::Feature feature,
osgEarth::Features::FeatureSource source,
osgEarth::MapNode mapNode 
)

Constructs a new FeatureEditor

Parameters:
featureThe Feature to edit
sourceThe FeatureSource that the Feature belongs to
mapNodeThe MapNode that is being displayed

Definition at line 191 of file FeatureEditing.cpp.

                                                                                       :
_feature( feature ),
_source( source ),
_mapNode( mapNode ),
_color(osg::Vec4(0.0f, 1.0f, 0.0f, 1.0f)),
_pickColor(osg::Vec4(1.0f, 1.0f, 0.0f, 1.0f)),
_size( 5.0f )
{
    init();
}

Here is the call graph for this function:


Member Function Documentation

const osg::Vec4f & FeatureEditor::getColor ( ) const

Gets the color of the draggers

Definition at line 220 of file FeatureEditing.cpp.

{
    return _color;
}
const osg::Vec4f & FeatureEditor::getPickColor ( ) const

Gets the color of the draggers when they are selected

Definition at line 204 of file FeatureEditing.cpp.

{
    return _pickColor;
}
float FeatureEditor::getSize ( ) const

Gets the dragger size

Definition at line 236 of file FeatureEditing.cpp.

{
    return _size;
}
void FeatureEditor::init ( ) [protected]

Definition at line 252 of file FeatureEditing.cpp.

{
    removeChildren( 0, this->getNumChildren() );
    //Create a dragger for each point
    for (unsigned int i = 0; i < _feature->getGeometry()->size(); i++)
    {
        osg::Matrixd matrix;
        double lat = (*_feature->getGeometry())[i].y();
        double lon = (*_feature->getGeometry())[i].x();
        _mapNode->getMap()->getProfile()->getSRS()->getEllipsoid()->computeLocalToWorldTransformFromLatLongHeight(osg::DegreesToRadians(lat), osg::DegreesToRadians(lon), 0, matrix);    

        IntersectingDragger* dragger = new IntersectingDragger;
        dragger->setColor( _color );
        dragger->setPickColor( _pickColor );
        dragger->setSize( _size );
        dragger->setNode( _mapNode->getTerrainEngine() );
        dragger->setupDefaultGeometry();
        dragger->setMatrix(matrix);
        dragger->setHandleEvents( true );        
        dragger->addDraggerCallback(new MoveFeatureDraggerCallback(_feature.get(), _source.get(), _mapNode->getMap(), i) );

        addChild(dragger);        
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FeatureEditor::setColor ( const osg::Vec4f &  color)

Sets the color of the draggers

Definition at line 77 of file StencilUtils.cpp.

{
    (*_maskColorArray)[0] = color;
    // dirty?
}
void FeatureEditor::setPickColor ( const osg::Vec4f &  pickColor)

Sets the color of the draggers when they are selected

Definition at line 210 of file FeatureEditing.cpp.

{
    if (_pickColor != pickColor)
    {
        _pickColor = pickColor;
        init();
    }
}

Here is the call graph for this function:

void FeatureEditor::setSize ( float  size)

Sets the dragger size

Definition at line 242 of file FeatureEditing.cpp.

{
    if (_size != size)
    {
        _size = size;
        init();
    }
}

Here is the call graph for this function:


Member Data Documentation

osg::Vec4f osgEarth::Util::FeatureEditor::_color [protected]

Definition at line 130 of file FeatureEditing.

Definition at line 133 of file FeatureEditing.

Definition at line 135 of file FeatureEditing.

Definition at line 129 of file FeatureEditing.

Definition at line 131 of file FeatureEditing.

Definition at line 134 of file FeatureEditing.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines