void ImageOverlayEditor::addDragger( ImageOverlay::ControlPoint controlPoint ) { osg::Vec2d location = _overlay->getControlPoint( controlPoint ); SphereDragger* dragger = new SphereDragger(_overlay->getMapNode()); dragger->setPosition( GeoPoint( SpatialReference::create( "epsg:4326"), location.x(), location.y())); dragger->addPositionChangedCallback( new ImageOverlayDraggerCallback(_overlay.get(), controlPoint)); addChild(dragger); _draggers[ controlPoint ] = dragger; }
void FeatureEditor::init() { removeChildren( 0, getNumChildren() ); Feature* feature = _featureNode->getFeature(); //Create a dragger for each point for (unsigned int i = 0; i < _featureNode->getFeature()->getGeometry()->size(); i++) { SphereDragger* dragger = new SphereDragger( _featureNode->getMapNode() ); dragger->setColor( _color ); dragger->setPickColor( _pickColor ); dragger->setSize( _size ); dragger->setPosition(GeoPoint(feature->getSRS(), (*feature->getGeometry())[i].x(), (*feature->getGeometry())[i].y())); dragger->addPositionChangedCallback(new MoveFeatureDraggerCallback( _featureNode.get(), i) ); addChild(dragger); } }