本文整理汇总了C++中GeoPoint::altitudeMode方法的典型用法代码示例。如果您正苦于以下问题:C++ GeoPoint::altitudeMode方法的具体用法?C++ GeoPoint::altitudeMode怎么用?C++ GeoPoint::altitudeMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeoPoint
的用法示例。
在下文中一共展示了GeoPoint::altitudeMode方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool
AnnotationNode::makeAbsolute( GeoPoint& mapPoint, osg::Node* patch ) const
{
// in terrain-clamping mode, force it to HAT=0:
if ( _altitude.valid() && (
_altitude->clamping() == AltitudeSymbol::CLAMP_TO_TERRAIN ||
_altitude->clamping() == AltitudeSymbol::CLAMP_RELATIVE_TO_TERRAIN) )
{
mapPoint.altitudeMode() = ALTMODE_RELATIVE;
//If we're clamping to the terrain
if (_altitude->clamping() == AltitudeSymbol::CLAMP_TO_TERRAIN)
{
mapPoint.z() = 0.0;
}
}
// if the point's already absolute and we're not clamping it, nop.
if ( mapPoint.altitudeMode() == ALTMODE_ABSOLUTE )
{
return true;
}
// calculate the absolute Z of the map point.
if ( getMapNode() )
{
// find the terrain height at the map point:
double hamsl;
if (getMapNode()->getTerrain()->getHeight(patch, mapPoint.getSRS(), mapPoint.x(), mapPoint.y(), &hamsl, 0L))
{
// apply any scale/offset in the symbology:
if ( _altitude.valid() )
{
if ( _altitude->verticalScale().isSet() )
hamsl *= _altitude->verticalScale()->eval();
if ( _altitude->verticalOffset().isSet() )
hamsl += _altitude->verticalOffset()->eval();
}
mapPoint.z() += hamsl;
}
mapPoint.altitudeMode() = ALTMODE_ABSOLUTE;
return true;
}
return false;
}
示例2: getElevationImpl
bool
ElevationQuery::getElevation(const GeoPoint& point,
double& out_elevation,
double desiredResolution,
double* out_actualResolution)
{
sync();
if ( point.altitudeMode() == ALTMODE_ABSOLUTE )
{
return getElevationImpl( point, out_elevation, desiredResolution, out_actualResolution );
}
else
{
GeoPoint point_abs( point.getSRS(), point.x(), point.y(), 0.0, ALTMODE_ABSOLUTE );
return getElevationImpl( point_abs, out_elevation, desiredResolution, out_actualResolution );
}
}
示例3: updateTransform
void Dragger::updateTransform(osg::Node* patch)
{
osg::Matrixd matrix;
GeoPoint mapPoint;
_mapNode->getMap()->toMapPoint( _position, mapPoint );
//Get the height
if (_position.altitudeMode() == ALTMODE_RELATIVE)
{
double hamsl;
if (_mapNode->getTerrain()->getHeight(mapPoint.x(), mapPoint.y(), &hamsl, 0L, patch))
{
mapPoint.z() += hamsl;
}
mapPoint.altitudeMode() = ALTMODE_ABSOLUTE;
}
mapPoint.createLocalToWorld( matrix );
setMatrix( matrix );
}
示例4: point_abs
float
ElevationQuery::getElevation(const GeoPoint& point,
double desiredResolution,
double* out_actualResolution)
{
float result = NO_DATA_VALUE;
sync();
if ( point.altitudeMode() == ALTMODE_ABSOLUTE )
{
getElevationImpl( point, result, desiredResolution, out_actualResolution );
}
else
{
GeoPoint point_abs( point.getSRS(), point.x(), point.y(), 0.0, ALTMODE_ABSOLUTE );
getElevationImpl( point_abs, result, desiredResolution, out_actualResolution );
}
return result;
}
示例5: updateLOSNodes
void LOSCreationDialog::updateLOSNodes(bool updateAll)
{
if (_p2p.valid() && (updateAll || _ui.typeTabs->tabText(_ui.typeTabs->currentIndex()) == "Point-to-Point"))
{
if (_ui.depthTestCheckBox->checkState() == Qt::Checked)
_p2p->getOrCreateStateSet()->setMode(GL_DEPTH_TEST, osg::StateAttribute::ON);
else
_p2p->getOrCreateStateSet()->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
bool p1Set = false;
bool p2Set = false;
osg::Node* p1Node = 0L;
osg::Node* p2Node = 0L;
// get start point or node
if (_ui.p1TypeCombo->currentText() == "Point")
{
_p2p->setStart(GeoPoint(
_mapNode->getMapSRS(),
_ui.p1LonBox->value(),
_ui.p1LatBox->value(),
_ui.p1AltBox->value(),
_ui.p2pRelativeCheckBox->checkState() == Qt::Checked ? ALTMODE_RELATIVE : ALTMODE_ABSOLUTE) );
//if (_ui.p2pRelativeCheckBox->checkState() == Qt::Checked)
// _p2p->setStartAltitudeMode(ALTMODE_RELATIVE);
//else
// _p2p->setStartAltitudeMode(ALTMODE_ABSOLUTE);
p1Set = true;
}
else if (_ui.p1TypeCombo->currentText() == "Annotation")
{
GeoPoint p = _p2p->getStart();
p.altitudeMode() = ALTMODE_ABSOLUTE;
_p2p->setStart( p );
//_p2p->setStartAltitudeMode(ALTMODE_ABSOLUTE);
p1Node = _annotations[_ui.p1NodeCombo->currentIndex()];
p1Set = true;
}
// get end point or node
if (_ui.p2TypeCombo->currentText() == "Point")
{
_p2p->setEnd(GeoPoint(
_mapNode->getMapSRS(),
_ui.p2LonBox->value(),
_ui.p2LatBox->value(),
_ui.p2AltBox->value(),
_ui.p2pRelativeCheckBox->checkState() == Qt::Checked ? ALTMODE_RELATIVE : ALTMODE_ABSOLUTE) );
//if (_ui.p2pRelativeCheckBox->checkState() == Qt::Checked)
// _p2p->setEndAltitudeMode(ALTMODE_RELATIVE);
//else
// _p2p->setEndAltitudeMode(ALTMODE_ABSOLUTE);
p2Set = true;
}
else if (_ui.p2TypeCombo->currentText() == "Annotation")
{
GeoPoint p = _p2p->getEnd();
p.altitudeMode() = ALTMODE_ABSOLUTE;
_p2p->setEnd( p );
//_p2p->setEndAltitudeMode(ALTMODE_ABSOLUTE);
p2Node = _annotations[_ui.p2NodeCombo->currentIndex()];
p2Set = true;
}
// set update callback if tethered, else clear it
if (p1Node || p2Node)
_p2p->setUpdateCallback(new osgEarth::Util::LineOfSightTether(p1Node, p2Node));
else
_p2p->setUpdateCallback(0L);
}
if (_radial.valid() && (updateAll || _ui.typeTabs->tabText(_ui.typeTabs->currentIndex()) == "Radial"))
{
_radial->setRadius(_ui.radiusSpinBox->value());
_radial->setNumSpokes(_ui.spokesSpinBox->value());
if (_ui.depthTestCheckBox->checkState() == Qt::Checked)
_radial->getOrCreateStateSet()->setMode(GL_DEPTH_TEST, osg::StateAttribute::ON);
else
_radial->getOrCreateStateSet()->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF);
// get center point or node to attach to
if (_ui.radTypeCombo->currentText() == "Point")
{
_radial->setCenter( GeoPoint(
_mapNode->getMapSRS(),
_ui.radLonBox->value(),
_ui.radLatBox->value(),
_ui.radAltBox->value(),
_ui.radRelativeCheckBox->checkState() == Qt::Checked ? ALTMODE_RELATIVE : ALTMODE_ABSOLUTE) );
//_radial->setCenter(osg::Vec3d(_ui.radLonBox->value(), _ui.radLatBox->value(), _ui.radAltBox->value()));
//if (_ui.radRelativeCheckBox->checkState() == Qt::Checked)
// _radial->setAltitudeMode(ALTMODE_RELATIVE);
//else
//.........这里部分代码省略.........
示例6: handle
//.........这里部分代码省略.........
break;
}
}
if (draggerFound)
break;
}
}
}
aa.requestRedraw();
return true;
}
}
else if (ea.getEventType() == osgGA::GUIEventAdapter::RELEASE)
{
_elevationDragging = false;
if ( _dragging )
{
_dragging = false;
firePositionChanged();
}
aa.requestRedraw();
}
else if (ea.getEventType() == osgGA::GUIEventAdapter::DRAG)
{
if (_elevationDragging)
{
_pointer._hitIter = _pointer._hitList.begin();
_pointer.setMousePosition(ea.getX(), ea.getY());
if (_projector->project(_pointer, _startProjectedPoint))
{
//Get the absolute mapPoint that they've drug it to.
GeoPoint projectedPos;
projectedPos.fromWorld(_position.getSRS(), _startProjectedPoint);
// make sure point is not dragged down below
// TODO: think of a better solution / HeightAboveTerrain performance issues?
if (projectedPos.z() >= _verticalMinimum)
{
//If the current position is relative, we need to convert the absolute world point to relative.
//If the point is absolute then just emit the absolute point.
if (_position.altitudeMode() == ALTMODE_RELATIVE)
{
projectedPos.transformZ(ALTMODE_RELATIVE, getMapNode()->getTerrain());
}
setPosition( projectedPos );
aa.requestRedraw();
}
}
return true;
}
if (_dragging)
{
osg::Vec3d world;
if ( getMapNode() && getMapNode()->getTerrain()->getWorldCoordsUnderMouse(view, ea.getX(), ea.getY(), world) )
{
//Get the absolute mapPoint that they've drug it to.
GeoPoint mapPoint;
mapPoint.fromWorld( getMapNode()->getMapSRS(), world );
//_mapNode->getMap()->worldPointToMapPoint(world, mapPoint);
//If the current position is relative, we need to convert the absolute world point to relative.
//If the point is absolute then just emit the absolute point.
if (_position.altitudeMode() == ALTMODE_RELATIVE)
{
mapPoint.alt() = _position.alt();
mapPoint.altitudeMode() = ALTMODE_RELATIVE;
}
setPosition( mapPoint );
aa.requestRedraw();
return true;
}
}
}
else if (ea.getEventType() == osgGA::GUIEventAdapter::MOVE)
{
Picker picker( view, this );
Picker::Hits hits;
if ( picker.pick( ea.getX(), ea.getY(), hits ) )
{
setHover( true );
}
else
{
setHover( false );
}
aa.requestRedraw();
}
return false;
}
示例7:
bool
GeoTransform::setPosition(const GeoPoint& position)
{
if ( !position.isValid() )
return false;
_position = position;
// relative Z or reprojection require a terrain:
osg::ref_ptr<Terrain> terrain;
_terrain.lock(terrain);
// relative Z requires a terrain:
if (position.altitudeMode() == ALTMODE_RELATIVE && !terrain.valid())
{
OE_TEST << LC << "setPosition failed condition 1\n";
return false;
}
GeoPoint p;
// transform into terrain SRS if neccesary:
if (terrain.valid() && !terrain->getSRS()->isEquivalentTo(position.getSRS()))
p = position.transform(terrain->getSRS());
else
p = position;
// bail if the transformation failed:
if ( !p.isValid() )
{
OE_TEST << LC << "setPosition failed condition 2\n";
return false;
}
// convert to absolute height:
if ( !p.makeAbsolute(_terrain.get()) )
{
OE_TEST << LC << "setPosition failed condition 3\n";
return false;
}
// assemble the matrix:
osg::Matrixd local2world;
p.createLocalToWorld( local2world );
this->setMatrix( local2world );
// install auto-recompute?
if (_autoRecompute &&
_position.altitudeMode() == ALTMODE_RELATIVE &&
!_autoRecomputeReady)
{
// by using the adapter, there's no need to remove
// the callback then this object destructs.
terrain->addTerrainCallback(
new TerrainCallbackAdapter<GeoTransform>(this) );
_autoRecomputeReady = true;
}
return true;
}