本文整理汇总了C++中GeoPoint::alt方法的典型用法代码示例。如果您正苦于以下问题:C++ GeoPoint::alt方法的具体用法?C++ GeoPoint::alt怎么用?C++ GeoPoint::alt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeoPoint
的用法示例。
在下文中一共展示了GeoPoint::alt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onCopyToClipboard
void TerrainProfileGraph::onCopyToClipboard()
{
const osgEarth::Util::TerrainProfile profile = _calculator->getProfile();
if (profile.getNumElevations() > 0)
{
const QLatin1String fieldSeparator(",");
GeoPoint startPt = _calculator->getStart(ALTMODE_ABSOLUTE);
GeoPoint endPt = _calculator->getEnd(ALTMODE_ABSOLUTE);
QString profileInfo = QString("Start:,%1,%2\nEnd:,%3,%4\n")
.arg(_coordinateFormatter->format(startPt).c_str()).arg(startPt.alt())
.arg(_coordinateFormatter->format(endPt).c_str()).arg(endPt.alt());
QString distanceInfo("Distance:");
QString elevationInfo("Elevation:");
for (unsigned int i = 0; i < profile.getNumElevations(); i++)
{
distanceInfo += fieldSeparator + QString::number(profile.getDistance(i));
elevationInfo += fieldSeparator + QString::number(profile.getElevation(i));
}
profileInfo += distanceInfo + QString("\n") + elevationInfo;
QImage graphImage(_graphWidth, _graphHeight, QImage::Format_RGB32);
QPainter p;
p.begin(&graphImage);
_scene->render(&p);
p.end();
QMimeData* clipData = new QMimeData();
clipData->setText(profileInfo);
clipData->setImageData(graphImage);
QApplication::clipboard()->setMimeData(clipData);
}
}
示例2: 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;
}
示例3: if
void
MapNode::traverse( osg::NodeVisitor& nv )
{
if ( nv.getVisitorType() == nv.EVENT_VISITOR )
{
unsigned int numBlacklist = Registry::instance()->getNumBlacklistedFilenames();
if (numBlacklist != _lastNumBlacklistedFilenames)
{
//Only remove the blacklisted filenames if new filenames have been added since last time.
_lastNumBlacklistedFilenames = numBlacklist;
RemoveBlacklistedFilenamesVisitor v;
_terrainEngine->accept( v );
}
// traverse:
std::for_each( _children.begin(), _children.end(), osg::NodeAcceptOp(nv) );
}
else if ( nv.getVisitorType() == nv.CULL_VISITOR )
{
osgUtil::CullVisitor* cv = Culling::asCullVisitor(nv);
if ( cv )
{
// insert traversal data for this camera:
osg::ref_ptr<osg::Referenced> oldUserData = cv->getUserData();
MapNodeCullData* cullData = getCullData( cv->getCurrentCamera() );
cv->setUserData( cullData );
cullData->_mapNode = this;
// calculate altitude:
osg::Vec3d eye = cv->getViewPoint();
const SpatialReference* srs = getMapSRS();
if ( srs && !srs->isProjected() )
{
GeoPoint ecef;
ecef.fromWorld( srs, eye );
cullData->_cameraAltitude = ecef.alt();
}
else
{
cullData->_cameraAltitude = eye.z();
}
// window scale matrix:
osg::Matrix m4 = cv->getWindowMatrix();
osg::Matrix3 m3( m4(0,0), m4(1,0), m4(2,0),
m4(0,1), m4(1,1), m4(2,1),
m4(0,2), m4(1,2), m4(2,2) );
cullData->_windowScaleMatrix->set( m3 );
// traverse:
cv->pushStateSet( cullData->_stateSet.get() );
std::for_each( _children.begin(), _children.end(), osg::NodeAcceptOp(nv) );
cv->popStateSet();
// restore:
cv->setUserData( oldUserData.get() );
}
}
else
{
osg::Group::traverse( nv );
}
}
示例4: update
void update( float x, float y, osgViewer::View* view )
{
bool yes = false;
// look under the mouse:
osg::Vec3d world;
osgUtil::LineSegmentIntersector::Intersections hits;
if ( view->computeIntersections(x, y, hits) )
{
world = hits.begin()->getWorldIntersectPoint();
// convert to map coords:
GeoPoint mapPoint;
mapPoint.fromWorld( _terrain->getSRS(), world );
// do an elevation query:
double query_resolution = 0; // 1/10th of a degree
double out_hamsl = 0.0;
double out_resolution = 0.0;
bool ok = _query.getElevation(
mapPoint,
out_hamsl,
query_resolution,
&out_resolution );
if ( ok )
{
// convert to geodetic to get the HAE:
mapPoint.z() = out_hamsl;
GeoPoint mapPointGeodetic( s_mapNode->getMapSRS()->getGeodeticSRS(), mapPoint );
static LatLongFormatter s_f;
s_posLabel->setText( Stringify()
<< std::fixed << std::setprecision(2)
<< s_f.format(mapPointGeodetic.y())
<< ", "
<< s_f.format(mapPointGeodetic.x()) );
s_mslLabel->setText( Stringify() << out_hamsl );
s_haeLabel->setText( Stringify() << mapPointGeodetic.z() );
s_resLabel->setText( Stringify() << out_resolution );
yes = true;
}
// finally, get a normal ISECT HAE point.
GeoPoint isectPoint;
isectPoint.fromWorld( _terrain->getSRS()->getGeodeticSRS(), world );
s_mapLabel->setText( Stringify() << isectPoint.alt() );
}
if (!yes)
{
s_posLabel->setText( "-" );
s_mslLabel->setText( "-" );
s_haeLabel->setText( "-" );
s_resLabel->setText( "-" );
}
}
示例5: if
void
MapNode::traverse( osg::NodeVisitor& nv )
{
if ( nv.getVisitorType() == nv.EVENT_VISITOR )
{
unsigned int numBlacklist = Registry::instance()->getNumBlacklistedFilenames();
if (numBlacklist != _lastNumBlacklistedFilenames)
{
//Only remove the blacklisted filenames if new filenames have been added since last time.
_lastNumBlacklistedFilenames = numBlacklist;
RemoveBlacklistedFilenamesVisitor v;
_terrainEngine->accept( v );
}
// traverse:
std::for_each( _children.begin(), _children.end(), osg::NodeAcceptOp(nv) );
}
else if ( nv.getVisitorType() == nv.UPDATE_VISITOR )
{
osg::ref_ptr<osg::Referenced> oldUserData = nv.getUserData();
nv.setUserData( this );
std::for_each( _children.begin(), _children.end(), osg::NodeAcceptOp(nv) );
nv.setUserData( oldUserData.get() );
}
else if ( nv.getVisitorType() == nv.CULL_VISITOR )
{
osgUtil::CullVisitor* cv = static_cast<osgUtil::CullVisitor*>(&nv);
if ( cv )
{
#if 1
osg::ref_ptr<osg::Referenced> oldUserData = cv->getUserData();
TraversalData* data = new TraversalData();
cv->setUserData( data );
std::for_each( _children.begin(), _children.end(), osg::NodeAcceptOp(nv) );
cv->setUserData( oldUserData.get() );
#else
// insert traversal data for this camera:
osg::ref_ptr<osg::Referenced> oldUserData = cv->getUserData();
MapNodeCullData* cullData = getCullData( cv->getCurrentCamera() );
cv->setUserData( cullData );
cullData->_mapNode = this;
osg::Vec3d eye = cv->getViewPoint();
// horizon:
if ( !cullData->_horizonInitialized )
{
cullData->_horizonInitialized = true;
cullData->_horizon.setEllipsoid( *getMapSRS()->getEllipsoid() );
}
cullData->_horizon.setEye( eye );
// calculate altitude:
const SpatialReference* srs = getMapSRS();
if ( srs && !srs->isProjected() )
{
GeoPoint lla;
lla.fromWorld( srs, eye );
cullData->_cameraAltitude = lla.alt();
cullData->_cameraAltitudeUniform->set( (float)lla.alt() );
}
else
{
cullData->_cameraAltitude = eye.z();
cullData->_cameraAltitudeUniform->set( (float)eye.z() );
}
// window matrix:
cullData->_windowMatrixUniform->set( cv->getWindowMatrix() );
// traverse:
cv->pushStateSet( cullData->_stateSet.get() );
std::for_each( _children.begin(), _children.end(), osg::NodeAcceptOp(nv) );
cv->popStateSet();
// restore:
cv->setUserData( oldUserData.get() );
#endif
}
}
else
{
osg::Group::traverse( nv );
}
}