コード例 #1
0
void TerrainProfileWidget::setActiveViews(const ViewVector& views)
{
  removeViews();

  for (ViewVector::const_iterator it = views.begin(); it != views.end(); ++it)
    addView(*it);
}
コード例 #2
0
void AnnotationToolbar::setActiveViews(const ViewVector& views)
{
  removeViews();

  for (ViewVector::const_iterator it = views.begin(); it != views.end(); ++it)
    addView(*it);
}
コード例 #3
0
void LOSControlWidget::setActiveViews(const ViewVector& views)
{
  removeViews();

  for (ViewVector::const_iterator it = views.begin(); it != views.end(); ++it)
    addView(*it);
}
コード例 #4
0
ファイル: AnnotationDialogs.cpp プロジェクト: JohnDr/osgearth
BaseAnnotationDialog::BaseAnnotationDialog(osgEarth::MapNode* mapNode, const ViewVector& views, QWidget* parent, Qt::WindowFlags f)
: QDialog(parent, f), _mapNode(mapNode), _views(views.size())
{
  initDefaultUi();

  std::copy(views.begin(), views.end(), _views.begin());
}
コード例 #5
0
ファイル: AnnotationDialogs.cpp プロジェクト: JohnDr/osgearth
AddMarkerDialog::AddMarkerDialog(osg::Group* root, osgEarth::MapNode* mapNode, const ViewVector& views, osgEarth::Annotation::PlaceNode* marker, QWidget* parent, Qt::WindowFlags f)
: BaseAnnotationDialog(mapNode, views, parent, f), _root(root), _altName(""), _editing(marker ? true : false), _inPosition(marker ? marker->getPosition() : osgEarth::GeoPoint()), _inNameSet(false)
{
  initialize();

  if (marker)
  {
    osgEarth::Annotation::AnnotationData* data = marker->getAnnotationData();
    
    //Get marker text/name
    _inName = marker->getText().length() > 0 ? marker->getText() : (data ? data->getName() : "");
    _nameEdit->setText(tr(_inName.c_str()));
    if (marker->getText().length() > 0 && data && data->getName().length() > 0 && marker->getText() != data->getName())
      _altName = data->getName();

    //Get marker description
    _inDescription = data ? data->getDescription() : "";
    _descriptionEdit->setText(tr(_inDescription.c_str()));

    //Set marker checkbox
    _inNameSet = marker->getText().length() > 0;
    _nameCheckbox->setChecked(_inNameSet);

    _placeNode = marker;
  }

  if (_mapNode.valid() && _views.size() > 0)
  {
    _guiHandler = new AddPointsMouseHandler(this, _mapNode.get(), 0L, false);
    for (ViewVector::const_iterator it = views.begin(); it != views.end(); ++it)
      (*it)->addEventHandler(_guiHandler.get());
  }
}
コード例 #6
0
ファイル: AnnotationDialogs.cpp プロジェクト: JohnDr/osgearth
AddPathDialog::AddPathDialog(osg::Group* root, osgEarth::MapNode* mapNode, const ViewVector& views, osgEarth::Annotation::FeatureNode* path, QWidget* parent, Qt::WindowFlags f)
: BaseAnnotationDialog(mapNode, views, parent, f), _root(root), _draggers(0L), _pathColor(Color::White), _editing(path ? true : false)
{
  initialize();

  //If editing an existing path
  if (path)
  {
    osgEarth::Annotation::AnnotationData* data = path->getAnnotationData();
    
    //Get path name
    _inName = data ? data->getName() : "";
    _nameEdit->setText(tr(_inName.c_str()));

    //Get path description
    _inDescription = data ? data->getDescription() : "";
    _descriptionEdit->setText(tr(_inDescription.c_str()));

    _pathNode = path;

    const osgEarth::Features::Feature* feat = path->getFeature();
    if (feat)
    {
      _inFeature = const_cast<osgEarth::Features::Feature*>(feat);

      //Get path color
      const osgEarth::Symbology::LineSymbol* lineSymbol = feat->style()->get<LineSymbol>();
      if (lineSymbol)
      {
        _pathColor = lineSymbol->stroke()->color();
        updateButtonColorStyle(_lineColorButton, QColor::fromRgbF(_pathColor.r(), _pathColor.g(), _pathColor.b(), _pathColor.a()));
      }

      //Get path clamping
      const osgEarth::Symbology::AltitudeSymbol* altSymbol = feat->style()->get<AltitudeSymbol>();
      if (altSymbol)
        _drapeCheckbox->setChecked(altSymbol->clamping() == AltitudeSymbol::CLAMP_TO_TERRAIN);

      //Get path points
      const osgEarth::Symbology::LineString* pathLine = dynamic_cast<const osgEarth::Symbology::LineString*>(feat->getGeometry());
      if (pathLine)
      {
        for (osgEarth::Symbology::LineString::const_iterator it = pathLine->begin(); it != pathLine->end(); ++it)
          addPoint(osgEarth::GeoPoint(_mapNode->getMapSRS(), (*it).x(), (*it).y(), (*it).z(), ALTMODE_RELATIVE));
      }
    }
  }

  if (_mapNode.valid() && _views.size() > 0)
  {
    _guiHandler = new AddPointsMouseHandler(this, _mapNode.get(), _root);
    for (ViewVector::const_iterator it = views.begin(); it != views.end(); ++it)
      (*it)->addEventHandler(_guiHandler.get());
  }
}
コード例 #7
0
/* static */ bool
InnerViewTable::sweepEntry(JSObject** pkey, ViewVector& views)
{
    if (IsAboutToBeFinalizedUnbarriered(pkey))
        return true;

    MOZ_ASSERT(!views.empty());
    for (size_t i = 0; i < views.length(); i++) {
        if (IsAboutToBeFinalizedUnbarriered(&views[i])) {
            views[i--] = views.back();
            views.popBack();
        }
    }

    return views.empty();
}
コード例 #8
0
void MapCatalogWidget::setActiveViews(const ViewVector& views)
{
  _views.clear();
  _views.insert(_views.end(), views.begin(), views.end());
}
コード例 #9
0
ファイル: AnnotationDialogs.cpp プロジェクト: JohnDr/osgearth
AddEllipseDialog::AddEllipseDialog(osg::Group* root, osgEarth::MapNode* mapNode, const ViewVector& views, osgEarth::Annotation::EllipseNode* ellipse, QWidget* parent, Qt::WindowFlags f)
: BaseAnnotationDialog(mapNode, views, parent, f), _root(root), _pathColor(Color(Color::White, 0.0)), _fillColor(Color(Color::Black, 0.5)),
_editing(ellipse ? true : false), _inStyle(ellipse ? ellipse->getStyle() : osgEarth::Symbology::Style())
{
  initialize();

  if (ellipse)
  {
    osgEarth::Annotation::AnnotationData* data = ellipse->getAnnotationData();

    //Get path name
    _inName = data ? data->getName() : "";
    _nameEdit->setText(tr(_inName.c_str()));

    //Get path description
    _inDescription = data ? data->getDescription() : "";
    _descriptionEdit->setText(tr(_inDescription.c_str()));

    _inPosition = ellipse->getPosition();
    _inRadiusMajor = ellipse->getRadiusMajor();
    _inRadiusMinor = ellipse->getRadiusMinor();
    _inRotationAngle = ellipse->getRotationAngle();

    _ellipseNode = ellipse;

    //Get path color
    const osgEarth::Symbology::LineSymbol* lineSymbol = ellipse->getStyle().get<LineSymbol>();
    if (lineSymbol)
    {
      if (lineSymbol->stroke()->width() != 0.0)
      {
        _pathColor = lineSymbol->stroke()->color();
        updateButtonColorStyle(_lineColorButton, QColor::fromRgbF(_pathColor.r(), _pathColor.g(), _pathColor.b(), _pathColor.a()));
      }
    }

    //Get fill color
    const osgEarth::Symbology::PolygonSymbol* polySymbol = ellipse->getStyle().get<PolygonSymbol>();
    if (polySymbol)
    {
      _fillColor = polySymbol->fill()->color();
      updateButtonColorStyle(_fillColorButton, QColor::fromRgbF(_fillColor.r(), _fillColor.g(), _fillColor.b(), _fillColor.a()));
    }

    //Get draping
    _drapeCheckbox->setChecked(ellipse->isDraped());

    //Call refreshFeatureNode to update _ellipseStyle
    refreshFeatureNode();

    //Add the ellipse
    addEllipse(ellipse->getPosition(), ellipse->getRadiusMajor(), ellipse->getRadiusMinor(), ellipse->getRotationAngle());
  }
  else
  {
    if (_mapNode.valid() && _views.size() > 0)
    {
      _guiHandler = new AddEllipseMouseHandler(this, _mapNode.get(), _root);
      for (ViewVector::const_iterator it = views.begin(); it != views.end(); ++it)
        (*it)->addEventHandler(_guiHandler.get());
    }
  }
}
コード例 #10
0
ファイル: AnnotationDialogs.cpp プロジェクト: JohnDr/osgearth
AddPolygonDialog::AddPolygonDialog(osg::Group* root, osgEarth::MapNode* mapNode, const ViewVector& views, osgEarth::Annotation::FeatureNode* polygon, QWidget* parent, Qt::WindowFlags f)
: BaseAnnotationDialog(mapNode, views, parent, f), _root(root), _draggers(0L), _pathColor(Color(Color::White, 0.0)), _fillColor(Color(Color::Black, 0.5)), _editing(polygon ? true : false)
{
  _polygon = new osgEarth::Symbology::Polygon();
  
  initialize();

  //If editing an existing polygon
  if (polygon)
  {
    osgEarth::Annotation::AnnotationData* data = polygon->getAnnotationData();

    //Get path name
    _inName = data ? data->getName() : "";
    _nameEdit->setText(tr(_inName.c_str()));

    //Get path description
    _inDescription = data ? data->getDescription() : "";
    _descriptionEdit->setText(tr(_inDescription.c_str()));

    _polyNode = polygon;

    const osgEarth::Features::Feature* feat = polygon->getFeature();
    if (feat)
    {
      _inFeature = const_cast<osgEarth::Features::Feature*>(feat);

      //Get path color
      const osgEarth::Symbology::LineSymbol* lineSymbol = feat->style()->get<LineSymbol>();
      if (lineSymbol)
      {
        if (lineSymbol->stroke()->width() != 0.0)
        {
          _pathColor = lineSymbol->stroke()->color();
          updateButtonColorStyle(_lineColorButton, QColor::fromRgbF(_pathColor.r(), _pathColor.g(), _pathColor.b(), _pathColor.a()));
        }
      }

      //Get fill color
      const osgEarth::Symbology::PolygonSymbol* polySymbol = feat->style()->get<PolygonSymbol>();
      if (polySymbol)
      {
        _fillColor = polySymbol->fill()->color();
        updateButtonColorStyle(_fillColorButton, QColor::fromRgbF(_fillColor.r(), _fillColor.g(), _fillColor.b(), _fillColor.a()));
      }

      //Get draping
      _drapeCheckbox->setChecked(polygon->isDraped());

      //Get path points
      const osgEarth::Symbology::Polygon* polyGeom = dynamic_cast<const osgEarth::Symbology::Polygon*>(feat->getGeometry());
      if (polyGeom)
      {
        for (osgEarth::Symbology::LineString::const_iterator it = polyGeom->begin(); it != polyGeom->end(); ++it)
          addPoint(osgEarth::GeoPoint(_mapNode->getMapSRS(), (*it).x(), (*it).y(), (*it).z(), ALTMODE_RELATIVE));
      }
    }
  }
  else
  {
    //Not editing an existing polygon
    
    //Add an end point to follow the mouse cursor
    _polygon->push_back(osg::Vec3d(0.0, 0.0, 0.0));

    //Add mouse handlers
    if (_mapNode.valid() && _views.size() > 0)
    {
      _guiHandler = new AddPointsMouseHandler(this, _mapNode.get(), _root);
      for (ViewVector::const_iterator it = views.begin(); it != views.end(); ++it)
        (*it)->addEventHandler(_guiHandler.get());
    }
  }
}