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); } }
void FeatureEditor::init() { removeChildren( 0, 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); SphereDragger* dragger = new SphereDragger( _mapNode ); dragger->setColor( _color ); dragger->setPickColor( _pickColor ); dragger->setSize( _size ); dragger->addPositionChangedCallback(new MoveFeatureDraggerCallback(_feature.get(), _source.get(), i) ); addChild(dragger); } }