Permalink
Browse files

Fix for feature editing issue when modifying geometry, the FeaturePro…

…file must be dirtied when you modify the geometry so a correct bounds is computed. The feature editing example was broken if you moved verts outside of the bounds of the original geometry.
  • Loading branch information...
Jason Beverage
Jason Beverage committed May 25, 2012
1 parent 6ce2289 commit 29fbe9863d86459a428f0b987f7d24c59e6626af
Showing with 7 additions and 4 deletions.
  1. +3 −0 src/osgEarthAnnotation/FeatureEditing.cpp
  2. +4 −4 src/osgEarthFeatures/FeatureSource
@@ -70,6 +70,8 @@ AddPointHandler::addPoint( float x, float y, osgViewer::View* view )
{
_feature->getGeometry()->push_back( osg::Vec3d(lon_deg, lat_deg, 0) );
_source->dirty();
+ //Also must dirty the feature profile since the geometry has changed
+ _source->dirtyFeatureProfile();
}
return true;
}
@@ -127,6 +129,7 @@ class MoveFeatureDraggerCallback : public Dragger::PositionChangedCallback
{
(*_feature->getGeometry())[_point] = osg::Vec3d(position.x(), position.y(), 0);
_source->dirty();
+ _source->dirtyFeatureProfile();
}
osg::ref_ptr< Feature > _feature;
@@ -222,6 +222,9 @@ namespace osgEarth { namespace Features
*/
virtual void initialize( const osgDB::Options* dbOptions =0L ) { }
+ /** Dirties the feature profile */
+ void dirtyFeatureProfile() { _featureProfile = 0;}
+
protected:
/**
@@ -243,10 +246,7 @@ namespace osgEarth { namespace Features
const URIContext& uriContext() const { return _uriContext; }
/** The Cache passed in via the dbOptions */
- Cache* getCache() const { return _cache.get(); }
-
- /** Dirties the feature profile */
- void dirtyFeatureProfile() { _featureProfile = 0;}
+ Cache* getCache() const { return _cache.get(); }
private:
const FeatureSourceOptions _options;

0 comments on commit 29fbe98

Please sign in to comment.