void AddPolygonDialog::addPoint(const osgEarth::GeoPoint& point)
{
  if (_editing)
    _polygon->push_back(point.vec3d());
  else
    _polygon->insert(_polygon->end() - 1, point.vec3d());

  if (!_polyFeature.valid() && _polygon->size() > 2)
  {
    osgEarth::Symbology::Style polyStyle;
    polyStyle.getOrCreate<LineSymbol>()->stroke()->color() = _pathColor;
    polyStyle.getOrCreate<LineSymbol>()->stroke()->width() = ANNOTATION_PATH_WIDTH;
    polyStyle.getOrCreate<LineSymbol>()->tessellation() = 20;
    polyStyle.getOrCreate<PolygonSymbol>()->fill()->color() = _fillColor;
    polyStyle.getOrCreate<AltitudeSymbol>()->clamping() = AltitudeSymbol::CLAMP_TO_TERRAIN;

    _polyFeature = new osgEarth::Features::Feature(_polygon, _mapNode->getMapSRS(), polyStyle);

    if (!_polyNode.valid())
    {
      _polyNode = new osgEarth::Annotation::FeatureNode(_mapNode, _polyFeature, _drapeCheckbox->checkState() == Qt::Checked);
      _root->addChild(_polyNode);
    }

    _okButton->setEnabled(true);
  }

  refreshFeatureNode();
  createPointDragger(_polygon->size() - 1, point);
}
void AddPathDialog::addPoint(const osgEarth::GeoPoint& point)
{
  if (!_pathLine.valid())
    _pathLine = new osgEarth::Symbology::LineString();

  _pathLine->push_back(point.vec3d());

  if (!_pathFeature.valid() && _pathLine->size() > 1)
  {
    osgEarth::Symbology::Style pathStyle;
    pathStyle.getOrCreate<LineSymbol>()->stroke()->color() = Color::White;
    pathStyle.getOrCreate<LineSymbol>()->stroke()->width() = 2.0f;
    pathStyle.getOrCreate<LineSymbol>()->tessellation() = 20;
    pathStyle.getOrCreate<AltitudeSymbol>()->clamping() = AltitudeSymbol::CLAMP_TO_TERRAIN;
    pathStyle.getOrCreate<AltitudeSymbol>()->technique() = AltitudeSymbol::TECHNIQUE_GPU;

    _pathFeature = new osgEarth::Features::Feature(_pathLine, _mapNode->getMapSRS(), pathStyle);
    //_pathFeature->geoInterp() = GEOINTERP_GREAT_CIRCLE;

    if (!_pathNode.valid())
    {
      _pathNode = new osgEarth::Annotation::FeatureNode(_mapNode, _pathFeature);
      _root->addChild(_pathNode);
    }

    _okButton->setEnabled(true);
  }

  refreshFeatureNode();
  createPointDragger(_pathLine->size() - 1, point);
}
void AddPolygonDialog::movePoint(int index, const osgEarth::GeoPoint& position)
{
  (*_polygon.get())[index] = position.vec3d();
  refreshFeatureNode();
}
void AddPolygonDialog::mapMouseMove(const osgEarth::GeoPoint& point)
{
  _polygon->back().set(point.vec3d());
  refreshFeatureNode(true);
}