osgEarth 2.1.1
|
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 |
Node you can add to your scene graph to edit the verts of a Feature's Geometry
Definition at line 80 of file FeatureEditing.
FeatureEditor::FeatureEditor | ( | osgEarth::Features::Feature * | feature, |
osgEarth::Features::FeatureSource * | source, | ||
osgEarth::MapNode * | mapNode | ||
) |
Constructs a new FeatureEditor
feature | The Feature to edit |
source | The FeatureSource that the Feature belongs to |
mapNode | The 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(); }
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 |
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); } }
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(); } }
void FeatureEditor::setSize | ( | float | size | ) |
Sets the dragger size
Definition at line 242 of file FeatureEditing.cpp.
osg::Vec4f osgEarth::Util::FeatureEditor::_color [protected] |
Definition at line 130 of file FeatureEditing.
osg::ref_ptr< osgEarth::Features::Feature > osgEarth::Util::FeatureEditor::_feature [protected] |
Definition at line 133 of file FeatureEditing.
osg::ref_ptr< osgEarth::MapNode > osgEarth::Util::FeatureEditor::_mapNode [protected] |
Definition at line 135 of file FeatureEditing.
osg::Vec4f osgEarth::Util::FeatureEditor::_pickColor [protected] |
Definition at line 129 of file FeatureEditing.
float osgEarth::Util::FeatureEditor::_size [protected] |
Definition at line 131 of file FeatureEditing.
osg::ref_ptr< osgEarth::Features::FeatureSource > osgEarth::Util::FeatureEditor::_source [protected] |
Definition at line 134 of file FeatureEditing.