OpenSceneGraph 3.6.5
Locator
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSGTERRAIN_LOCATOR
15#define OSGTERRAIN_LOCATOR 1
16
17#include <osg/Object>
18#include <osg/Vec3d>
20
21#include <osgTerrain/Export>
22
23namespace osgTerrain {
24
26{
27 public:
28
30
33
35
48
52
55
57 void setFormat(const std::string& format) { _format = format; }
58
60 const std::string& getFormat() const { return _format; }
61
63 void setCoordinateSystem(const std::string& cs) { _cs = cs; }
64
66 const std::string& getCoordinateSystem() const { return _cs; }
67
68
70 void setEllipsoidModel(osg::EllipsoidModel* ellipsode) { _ellipsoidModel = ellipsode; }
71
74
76 const osg::EllipsoidModel* getEllipsoidModel() const { return _ellipsoidModel.get(); }
77
78
80 void setTransform(const osg::Matrixd& transform) { _transform = transform; _inverse.invert(_transform); }
81
83 const osg::Matrixd& getTransform() const { return _transform; }
84
86 void setTransformAsExtents(double minX, double minY, double maxX, double maxY);
87
88
89 virtual bool orientationOpenGL() const;
90
91 virtual bool convertLocalToModel(const osg::Vec3d& local, osg::Vec3d& world) const;
92
93 virtual bool convertModelToLocal(const osg::Vec3d& world, osg::Vec3d& local) const;
94
95 static bool convertLocalCoordBetween(const Locator& source, const osg::Vec3d& sourceNDC,
96 const Locator& destination, osg::Vec3d& destinationNDC)
97 {
98 osg::Vec3d model;
99 if (!source.convertLocalToModel(sourceNDC, model)) return false;
100 if (!destination.convertModelToLocal(model, destinationNDC)) return false;
101 return true;
102 }
103
104 bool computeLocalBounds(Locator& source, osg::Vec3d& bottomLeft, osg::Vec3d& topRight) const;
105
106 void setDefinedInFile(bool flag) { _definedInFile = flag; }
107 bool getDefinedInFile() const { return _definedInFile; }
108
109 void setTransformScaledByResolution(bool scaledByResolution) { _transformScaledByResolution = scaledByResolution; }
111
112 protected:
113
114 virtual ~Locator();
115
117
118 std::string _format;
119 std::string _cs;
121
124
127
128};
129
130}
131
132#endif
The osgTerrain library is a NodeKit that provides geospecifc terrain rendering support.
Definition Node:29
EllipsoidModel encapsulates the ellipsoid used to model astronomical bodies, such as sun,...
Definition CoordinateSystemNode:31
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Definition Matrixd:27
Base class/standard interface for objects which require IO support, cloning and reference counting.
Definition Object:61
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
General purpose double triple for use as vertices, vectors and normals.
Definition Vec3d:30
osg::Matrixd _transform
Definition Locator:122
std::string _format
Definition Locator:118
osg::EllipsoidModel * getEllipsoidModel()
Get the EllipsoidModel.
Definition Locator:73
META_Object(osgTerrain, Locator)
const osg::EllipsoidModel * getEllipsoidModel() const
Get the const EllipsoidModel.
Definition Locator:76
bool getDefinedInFile() const
Definition Locator:107
CoordinateSystemType getCoordinateSystemType() const
Get the CoordinatesSyetemType.
Definition Locator:54
virtual bool orientationOpenGL() const
void setDefinedInFile(bool flag)
Definition Locator:106
virtual bool convertLocalToModel(const osg::Vec3d &local, osg::Vec3d &world) const
CoordinateSystemType
CoordinateSystemType provides the classification of the type coordinate system represented.
Definition Locator:38
@ GEOGRAPHIC
GEOGRAPHIC coordinate systems are ones mapped to latitude and longitude.
Definition Locator:43
@ GEOCENTRIC
GEOCENTRIC coordinate systems are ones mapped to the around the ellipsoid, i.e.
Definition Locator:40
@ PROJECTED
PROJECTED coordinate systems are ones projected to a local projected coordinate system i....
Definition Locator:46
void setTransform(const osg::Matrixd &transform)
Set the transformation from local coordinates to model coordinates.
Definition Locator:80
bool _definedInFile
Definition Locator:125
const std::string & getFormat() const
Get the coordinate system format string.
Definition Locator:60
Locator(const Locator &, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
void setFormat(const std::string &format)
Set the coordinate system format string.
Definition Locator:57
void setTransformScaledByResolution(bool scaledByResolution)
Definition Locator:109
void setCoordinateSystemType(CoordinateSystemType type)
Set the CoordinatesSyetemType.
Definition Locator:51
const std::string & getCoordinateSystem() const
Get the CoordinateSystem reference string.
Definition Locator:66
CoordinateSystemType _coordinateSystemType
Definition Locator:116
void setTransformAsExtents(double minX, double minY, double maxX, double maxY)
Set the extents of the local coords.
osg::ref_ptr< osg::EllipsoidModel > _ellipsoidModel
Definition Locator:120
void setEllipsoidModel(osg::EllipsoidModel *ellipsode)
Set EllipsoidModel to describe the model used to map lat, long and height into geocentric XYZ and bac...
Definition Locator:70
static bool convertLocalCoordBetween(const Locator &source, const osg::Vec3d &sourceNDC, const Locator &destination, osg::Vec3d &destinationNDC)
Definition Locator:95
bool _transformScaledByResolution
Definition Locator:126
const osg::Matrixd & getTransform() const
Set the transformation from local coordinates to model coordinates.
Definition Locator:83
bool computeLocalBounds(Locator &source, osg::Vec3d &bottomLeft, osg::Vec3d &topRight) const
virtual bool convertModelToLocal(const osg::Vec3d &world, osg::Vec3d &local) const
osg::Matrixd _inverse
Definition Locator:123
void setCoordinateSystem(const std::string &cs)
Set the CoordinateSystem reference string, should be stored in a form consistent with the Format.
Definition Locator:63
std::string _cs
Definition Locator:119
bool getTransformScaledByResolution() const
Definition Locator:110
#define OSGTERRAIN_EXPORT
Definition Export:39

osg logo
Generated at Wed Jul 23 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.