本文整理汇总了C++中GeoPoint::vec3d方法的典型用法代码示例。如果您正苦于以下问题:C++ GeoPoint::vec3d方法的具体用法?C++ GeoPoint::vec3d怎么用?C++ GeoPoint::vec3d使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeoPoint
的用法示例。
在下文中一共展示了GeoPoint::vec3d方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getNodeCenter
void
LineOfSightTether::operator()(osg::Node* node, osg::NodeVisitor* nv)
{
if (nv->getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR)
{
LineOfSightNode* los = static_cast<LineOfSightNode*>(node);
if (_startNode.valid())
{
osg::Vec3d worldStart = getNodeCenter(_startNode);
//Convert to mappoint since that is what LOS expects
GeoPoint mapStart;
los->getMapNode()->getMap()->worldPointToMapPoint( worldStart, mapStart );
los->setStart( mapStart.vec3d() );
}
if (_endNode.valid())
{
osg::Vec3d worldEnd = getNodeCenter( _endNode );
//Convert to mappoint since that is what LOS expects
GeoPoint mapEnd;
los->getMapNode()->getMap()->worldPointToMapPoint( worldEnd, mapEnd );
los->setEnd( mapEnd.vec3d() );
}
}
traverse(node, nv);
}
示例2: handle
bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )
{
if (ea.getEventType() == ea.PUSH && ea.getButton() == osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON)
{
osg::Vec3d world;
if ( _mapNode->getTerrain()->getWorldCoordsUnderMouse( aa.asView(), ea.getX(), ea.getY(), world ))
{
GeoPoint mapPoint;
_mapNode->getMap()->worldPointToMapPoint( world, mapPoint );
if (!_startValid)
{
_startValid = true;
_start = mapPoint.vec3d();
if (_featureNode.valid())
{
_root->removeChild( _featureNode.get() );
_featureNode = 0;
}
}
else
{
_end = mapPoint.vec3d();
compute();
_startValid = false;
}
}
}
return false;
}
示例3: GeoPoint
bool
LineOfSightNode::computeLOS( osgEarth::MapNode* mapNode, const osg::Vec3d& start, const osg::Vec3d& end, AltitudeModeEnum altitudeMode, osg::Vec3d& hit )
{
const SpatialReference* mapSRS = mapNode->getMapSRS();
osg::Vec3d startWorld, endWorld;
if (altitudeMode == AltitudeMode::ABSOLUTE)
{
mapNode->getMap()->toWorldPoint( GeoPoint(mapSRS, start), startWorld );
mapNode->getMap()->toWorldPoint( GeoPoint(mapSRS, end), endWorld );
}
else
{
getRelativeWorld(start.x(), start.y(), start.z(), mapNode, startWorld);
getRelativeWorld(end.x(), end.y(), end.z(), mapNode, endWorld);
}
osgSim::LineOfSight los;
los.setDatabaseCacheReadCallback(0);
unsigned int index = los.addLOS(startWorld, endWorld);
los.computeIntersections(mapNode);
osgSim::LineOfSight::Intersections hits = los.getIntersections(0);
if (hits.size() > 0)
{
osg::Vec3d hitWorld = *hits.begin();
GeoPoint mapHit;
mapNode->getMap()->worldPointToMapPoint(hitWorld, mapHit);
hit = mapHit.vec3d();
return false;
}
return true;
}
示例4:
bool
AddPointHandler::addPoint( float x, float y, osgViewer::View* view )
{
osg::Vec3d world;
MapNode* mapNode = _featureNode->getMapNode();
if ( mapNode->getTerrain()->getWorldCoordsUnderMouse( view, x, y, world ) )
{
// Get the map point from the world
GeoPoint mapPoint;
mapPoint.fromWorld( mapNode->getMapSRS(), world );
Feature* feature = _featureNode->getFeature();
if ( feature )
{
// Convert the map point to the feature's SRS
GeoPoint featurePoint = mapPoint.transform( feature->getSRS() );
feature->getGeometry()->push_back( featurePoint.vec3d() );
_featureNode->init();
return true;
}
}
return false;
}
示例5:
bool
MapInfo::toWorldPoint( const GeoPoint& input, osg::Vec3d& output ) const
{
return input.isValid() ?
input.getSRS()->transformToWorld(input.vec3d(), output) :
false;
}
示例6: onItemDoubleClicked
void LOSControlWidget::onItemDoubleClicked(QListWidgetItem* item)
{
if (!_manager.valid() || !_map.valid() || _views.size() == 0)
return;
LOSListWidgetItem* losItem = dynamic_cast<LOSListWidgetItem*>(item);
if (losItem && losItem->los())
{
osg::Vec3d center = losItem->los()->getBound().center();
GeoPoint output;
_map->worldPointToMapPoint(center, output);
double range = losItem->los()->getBound().radius() / 0.267949849;
_manager->doAction(this, new SetViewpointAction(osgEarth::Viewpoint(output.vec3d(), 0.0, -90.0, range), _views));
}
}
示例7: absPos
bool
OrthoNode::updateTransforms( const GeoPoint& p, osg::Node* patch )
{
if ( getMapNode() )
{
//OE_NOTICE << "updateTransforms" << std::endl;
// make sure the point is absolute to terrain
GeoPoint absPos(p);
if ( !makeAbsolute(absPos, patch) )
return false;
osg::Matrixd local2world;
if ( !absPos.createLocalToWorld(local2world) )
return false;
// apply the local tangent plane offset:
local2world.preMult( osg::Matrix::translate(_localOffset) );
// update the xforms:
_autoxform->setPosition( local2world.getTrans() );
_matxform->setMatrix( local2world );
osg::Vec3d world = local2world.getTrans();
if (_horizonCuller.valid())
{
_horizonCuller->_world = world;
}
if (_occlusionCuller.valid())
{
_occlusionCuller->setWorld( adjustOcclusionCullingPoint( world ));
}
}
else
{
osg::Vec3d absPos = p.vec3d() + _localOffset;
_autoxform->setPosition( absPos );
_matxform->setMatrix( osg::Matrix::translate(absPos) );
}
dirtyBound();
return true;
}
示例8: centerMapOnNode
void LOSCreationDialog::centerMapOnNode(osg::Node* node)
{
if (node && _map.valid() && _manager.valid() && _views)
{
AnnotationNode* annoNode = dynamic_cast<AnnotationNode*>(node);
if (annoNode && annoNode->getAnnotationData() && annoNode->getAnnotationData()->getViewpoint())
{
_manager->doAction(this, new SetViewpointAction(osgEarth::Viewpoint(*annoNode->getAnnotationData()->getViewpoint()), *_views));
}
else
{
osg::Vec3d center = node->getBound().center();
GeoPoint output;
_map->worldPointToMapPoint(center, output);
_manager->doAction(this, new SetViewpointAction(osgEarth::Viewpoint(output.vec3d(), 0.0, -90.0, 1e5), *_views));
}
}
}
示例9: absPos
bool
LocalizedNode::updateTransform( const GeoPoint& p, osg::Node* patch )
{
if ( p.isValid() )
{
GeoPoint absPos(p);
if ( !makeAbsolute(absPos, patch) )
return false;
OE_DEBUG << LC << "Update transforms for position: " << absPos.x() << ", " << absPos.y() << ", " << absPos.z()
<< std::endl;
osg::Matrixd local2world;
absPos.createLocalToWorld( local2world );
// apply the local offsets
local2world.preMult( osg::Matrix::translate(_localOffset) );
getTransform()->setMatrix(
osg::Matrix::scale (_scale) *
osg::Matrix::rotate(_localRotation) *
local2world );
}
else
{
osg::Vec3d absPos = p.vec3d() + _localOffset;
getTransform()->setMatrix(
osg::Matrix::scale (_scale) *
osg::Matrix::rotate (_localRotation) *
osg::Matrix::translate(absPos) );
}
dirtyBound();
return true;
}
示例10: 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 );
mapPoint.z() = 0;
// do an elevation query:
double query_resolution = 0; // max.
double out_hamsl = 0.0;
double out_resolution = 0.0;
bool ok = _query.getElevation(
mapPoint,
out_hamsl,
query_resolution,
&out_resolution );
mapPoint.z() = out_hamsl;
_mapPoint = mapPoint;
GeometryFactory factory(SpatialReference::create("wgs84"));
Geometry* geom = 0;
if (_tool == TOOL_RECTANGLE)
{
geom = factory.createRectangle(mapPoint.vec3d(), _radius,_radius);
}
else if (_tool == TOOL_CIRCLE || _tool == TOOL_BLAST)
{
geom = factory.createCircle(mapPoint.vec3d(), _radius);
}
Feature* feature = new Feature(geom, SpatialReference::create("wgs84"));
if (_featureNode.valid())
{
_root->removeChild( _featureNode );
_featureNode = 0;
}
Style style;
style.getOrCreateSymbol<AltitudeSymbol>()->clamping() = AltitudeSymbol::CLAMP_TO_TERRAIN;
style.getOrCreateSymbol<AltitudeSymbol>()->technique() = AltitudeSymbol::TECHNIQUE_DRAPE;
if (_tool != TOOL_BLAST)
{
style.getOrCreateSymbol<PolygonSymbol>()->fill()->color() = Color(Color::Cyan, 0.5);
}
else
{
style.getOrCreateSymbol<PolygonSymbol>()->fill()->color() = Color(Color::Red, 0.5);
}
_featureNode = new FeatureNode( s_mapNode,
feature,
style);
_root->addChild( _featureNode );
}
}
示例11: absPos
bool
LocalizedNode::updateTransforms( const GeoPoint& p, osg::Node* patch )
{
if ( p.isValid() )
{
GeoPoint absPos(p);
if ( !makeAbsolute(absPos, patch) )
return false;
OE_DEBUG << LC << "Update transforms for position: " << absPos.x() << ", " << absPos.y() << ", " << absPos.z()
<< std::endl;
osg::Matrixd local2world;
absPos.createLocalToWorld( local2world );
// apply the local offsets
local2world.preMult( osg::Matrix::translate(_localOffset) );
if ( _autoTransform )
{
static_cast<osg::AutoTransform*>(_xform.get())->setPosition( local2world.getTrans() );
static_cast<osg::AutoTransform*>(_xform.get())->setScale( _scale );
static_cast<osg::AutoTransform*>(_xform.get())->setRotation( _localRotation );
}
else
{
static_cast<osg::MatrixTransform*>(_xform.get())->setMatrix(
osg::Matrix::scale(_scale) *
osg::Matrix::rotate(_localRotation) *
local2world );
}
CullNodeByHorizon* culler = dynamic_cast<CullNodeByHorizon*>(_xform->getCullCallback());
if ( culler )
culler->_world = local2world.getTrans();
}
else
{
osg::Vec3d absPos = p.vec3d() + _localOffset;
if ( _autoTransform )
{
static_cast<osg::AutoTransform*>(_xform.get())->setPosition( absPos );
static_cast<osg::AutoTransform*>(_xform.get())->setScale( _scale );
static_cast<osg::AutoTransform*>(_xform.get())->setRotation( _localRotation );
}
else
{
static_cast<osg::MatrixTransform*>(_xform.get())->setMatrix(
osg::Matrix::scale(_scale) *
osg::Matrix::rotate(_localRotation) *
osg::Matrix::translate(absPos) );
}
}
dirtyBound();
return true;
}