Replaced CartesianLocator and EllipsoidLocator by a single general purpose

Locator class
This commit is contained in:
Robert Osfield 2007-08-27 16:59:51 +00:00
parent b74083ad15
commit 5b1b648ef5
5 changed files with 449 additions and 345 deletions

View File

@ -635,10 +635,13 @@ int main(int argc, char** argv)
osg::ref_ptr<osgTerrain::Terrain> terrain = new osgTerrain::Terrain;
osg::ref_ptr<osgTerrain::Locator> locator = new osgTerrain::EllipsoidLocator(-osg::PI, -osg::PI*0.5, 2.0*osg::PI, osg::PI, 0.0);
osg::ref_ptr<osgTerrain::Locator> locator = new osgTerrain::Locator;
osg::ref_ptr<osgTerrain::ValidDataOperator> validDataOperator = new osgTerrain::NoDataValue(0.0);
osg::ref_ptr<osgTerrain::Layer> lastAppliedLayer;
locator->setCoordinateSystemType(osgTerrain::Locator::GEOCENTRIC);
locator->setExtents(-osg::PI, -osg::PI*0.5, osg::PI, osg::PI*0.5);
unsigned int layerNum = 0;
std::string filterName;
@ -668,7 +671,8 @@ int main(int argc, char** argv)
else if (arguments.read(pos, "-e",x,y,w,h))
{
// define the extents.
locator = new osgTerrain::EllipsoidLocator(x,y,w,h,0);
locator->setCoordinateSystemType(osgTerrain::Locator::GEOCENTRIC);
locator->setExtents(x,y,x+w,y+h);
readParameter = true;
}
@ -681,8 +685,8 @@ int main(int argc, char** argv)
else if (arguments.read(pos, "--cartesian",x,y,w,h))
{
// define the extents.
locator = new osgTerrain::CartesianLocator(x,y,w,h,0);
readParameter = true;
locator->setCoordinateSystemType(osgTerrain::Locator::PROJECTED);
locator->setExtents(x,y,x+w,y+h);
}
else if (arguments.read(pos, "--hf",filename))

View File

@ -32,11 +32,75 @@ class OSGTERRAIN_EXPORT Locator : public osg::Object
Locator(const Locator&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgTerrain, Locator);
virtual bool orientationOpenGL() const { return true; }
virtual bool convertLocalToModel(const osg::Vec3d& /*local*/, osg::Vec3d& /*world*/) const { return false; }
virtual bool convertModelToLocal(const osg::Vec3d& /*world*/, osg::Vec3d& /*local*/) const { return false; }
/** CoordinateSystemType provides the classification of the type coordinate system represented.*/
enum CoordinateSystemType
{
/** GEOCENTRIC coordinate systems are ones mapped to the around the ellipsoid, i.e. whole earth.*/
GEOCENTRIC,
/** GEOGRAPHIC coordinate systems are ones mapped to latitude and longitude.*/
GEOGRAPHIC,
/** PROJECTED coordinate systems are ones projected to a local projected coordindate system i.e. UTMs.*/
PROJECTED
};
/** Set the CoordinatesSyetemType.
* Note, the user must keep the CoordinateSystemString consistent with the type of the CoordindateSystem.*/
void setCoordinateSystemType(CoordinateSystemType type) { _coordinateSystemType = type; }
/** Get the CoordinatesSyetemType.*/
CoordinateSystemType getCoordinateSystemType() const { return _coordinateSystemType; }
/** Set the coordinate system format string. Typical values would be WKT, PROJ4, USGS etc.*/
void setFormat(const std::string& format) { _format = format; }
/** Get the coordinate system format string.*/
const std::string& getFormat() const { return _format; }
/** Set the CoordinateSystem reference string, should be stored in a form consistent with the Format.*/
void setCoordinateSystem(const std::string& cs) { _cs = cs; }
/** Get the CoordinateSystem reference string.*/
const std::string& getCoordinateSystem() const { return _cs; }
/** Set EllipsoidModel to describe the model used to map lat, long and height into geocentric XYZ and back. */
void setEllipsoidModel(osg::EllipsoidModel* ellipsode) { _ellipsoidModel = ellipsode; }
/** Get the EllipsoidModel.*/
osg::EllipsoidModel* getEllipsoidModel() { return _ellipsoidModel.get(); }
/** Get the const EllipsoidModel.*/
const osg::EllipsoidModel* getEllipsoidModel() const { return _ellipsoidModel.get(); }
/** Set the extents of the local coords.*/
void setExtents(double minX, double minY, double maxX, double maxY);
/** Get the extents of the local coords.*/
void getExtents(double& minX, double& minY, double& maxX, double& maxY) const;
void setMinX(double minX) { _minX = minX; }
double getMinX() const { return _minX; }
void setMinY(double minY) { _minY = minY; }
double getMinY() const { return _minY; }
void setMaxX(double maxX) { _maxX = maxX; }
double getMaxX() const { return _maxX; }
void setMaxY(double maxY) { _maxY = maxY; }
double getMaxY() const { return _maxY; }
virtual bool orientationOpenGL() const;
virtual bool convertLocalToModel(const osg::Vec3d& /*local*/, osg::Vec3d& /*world*/) const;
virtual bool convertModelToLocal(const osg::Vec3d& /*world*/, osg::Vec3d& /*local*/) const;
static bool convertLocalCoordBetween(const Locator& source, const osg::Vec3d& sourceNDC,
const Locator& destination, osg::Vec3d& destinationNDC)
@ -53,78 +117,17 @@ class OSGTERRAIN_EXPORT Locator : public osg::Object
virtual ~Locator();
};
CoordinateSystemType _coordinateSystemType;
class OSGTERRAIN_EXPORT EllipsoidLocator : public osgTerrain::Locator
{
public:
std::string _format;
std::string _cs;
osg::ref_ptr<osg::EllipsoidModel> _ellipsoidModel;
double _minX;
double _minY;
double _maxX;
double _maxY;
EllipsoidLocator(double longitude, double latitude, double deltaLongitude, double deltaLatitude, double height=0.0, double heightScale = 1.0f, double radiusEquator = osg::WGS_84_RADIUS_EQUATOR, double radiusPolar = osg::WGS_84_RADIUS_POLAR);
void setExtents(double longitude, double latitude, double deltaLongitude, double deltaLatitude, double height=0.0, double heightScale = 1.0f);
double getLongitude() const { return _longitude; }
double getDeltaLongitude() const { return _deltaLongitude; }
double getLatitude() const { return _latitude; }
double getDeltaLatitude() const { return _deltaLatitude; }
double getHeight() const { return _height; }
void setEllipsoidModel(osg::EllipsoidModel* em) { _em=em; }
osg::EllipsoidModel* getEllipsoidModel() { return _em.get(); }
const osg::EllipsoidModel* getEllipsoidModel() const { return _em.get(); }
virtual bool orientationOpenGL() const;
virtual bool convertLocalToModel(const osg::Vec3d& local, osg::Vec3d& world) const;
virtual bool convertModelToLocal(const osg::Vec3d& world, osg::Vec3d& local) const;
protected:
osg::ref_ptr<osg::EllipsoidModel> _em;
double _longitude;
double _latitude;
double _deltaLongitude;
double _deltaLatitude;
double _height;
double _heightScale;
};
class OSGTERRAIN_EXPORT CartesianLocator : public osgTerrain::Locator
{
public:
CartesianLocator(double originX, double originY, double lengthX, double lengthY, double height = 0.0f, double heightScale = 1.0f);
void setExtents(double originX, double originY, double lengthX, double lengthY, double height = 0.0f, double heightScale = 1.0f);
void setOriginX(double x) { _originX = x; }
double getOriginX() const { return _originX; }
void setOriginY(double y) { _originY = y; }
double getOriginY() const { return _originY; }
void setLengthX(double x) { _lengthX = x; }
double getLengthX() const { return _lengthX; }
void setLengthY(double y) { _lengthY = y; }
double getLengthY() const { return _lengthY; }
virtual bool orientationOpenGL() const;
virtual bool convertLocalToModel(const osg::Vec3d& local, osg::Vec3d& world) const;
virtual bool convertModelToLocal(const osg::Vec3d& world, osg::Vec3d& local) const;
protected:
double _originX;
double _originY;
double _lengthX;
double _lengthY;
double _height;
double _heightScale;
};
}

View File

@ -114,6 +114,86 @@ osgTerrain::Layer* readLayer(osgDB::Input& fr)
itrAdvanced = true;
}
if (fr.matchSequence("Locator %w %f %f %f"))
{
double x,y,w,h;
fr[2].getFloat(x);
fr[3].getFloat(y);
fr[4].getFloat(w);
fr[5].getFloat(h);
locator = new osgTerrain::Locator;
if (fr[1].matchWord("GEOCENTRIC")) locator->setCoordinateSystemType(osgTerrain::Locator::GEOCENTRIC);
else if (fr[1].matchWord("GEOGRAPHIC")) locator->setCoordinateSystemType(osgTerrain::Locator::GEOGRAPHIC);
else locator->setCoordinateSystemType(osgTerrain::Locator::PROJECTED);
locator->setExtents(x,y,x+w,y+h);
fr += 6;
itrAdvanced = true;
}
if (fr.matchSequence("Locator {"))
{
locator = new osgTerrain::Locator;
int local_entry = fr[0].getNoNestedBrackets();
fr += 2;
while (!fr.eof() && fr[0].getNoNestedBrackets()>local_entry)
{
bool localAdvanced = false;
if (fr.matchSequence("Format %w") || fr.matchSequence("Format %s") )
{
locator->setFormat(fr[1].getStr());
fr += 2;
localAdvanced = true;
}
if (fr.matchSequence("CoordinateSystemType %w"))
{
if (fr[1].matchWord("GEOCENTRIC")) locator->setCoordinateSystemType(osgTerrain::Locator::GEOCENTRIC);
else if (fr[1].matchWord("GEOGRAPHIC")) locator->setCoordinateSystemType(osgTerrain::Locator::GEOGRAPHIC);
else locator->setCoordinateSystemType(osgTerrain::Locator::PROJECTED);
fr += 2;
localAdvanced = true;
}
if (fr.matchSequence("CoordinateSystem %w") || fr.matchSequence("CoordinateSystem %s") )
{
locator->setCoordinateSystem(fr[1].getStr());
fr += 2;
localAdvanced = true;
}
if (fr.matchSequence("Extents %f %f %f %f"))
{
double minX,minY,maxX,maxY;
fr[1].getFloat(minX);
fr[2].getFloat(minY);
fr[3].getFloat(maxX);
fr[4].getFloat(maxY);
locator->setExtents(minX, minY, maxX, maxY);
fr += 5;
localAdvanced = true;
}
if (!localAdvanced) ++fr;
}
itrAdvanced = true;
++fr;
}
if (fr.matchSequence("EllipsoidLocator %f %f %f %f"))
{
double x,y,w,h;
@ -122,7 +202,9 @@ osgTerrain::Layer* readLayer(osgDB::Input& fr)
fr[3].getFloat(w);
fr[4].getFloat(h);
locator = new osgTerrain::EllipsoidLocator(x,y,w,h,0);
locator = new osgTerrain::Locator;
locator->setCoordinateSystemType(osgTerrain::Locator::GEOCENTRIC);
locator->setExtents(x,y,x+w,y+h);
fr += 5;
itrAdvanced = true;
@ -136,8 +218,10 @@ osgTerrain::Layer* readLayer(osgDB::Input& fr)
fr[3].getFloat(w);
fr[4].getFloat(h);
locator = new osgTerrain::CartesianLocator(x,y,w,h,0);
locator = new osgTerrain::Locator;
locator->setCoordinateSystemType(osgTerrain::Locator::PROJECTED);
locator->setExtents(x,y,x+w,y+h);
fr += 5;
itrAdvanced = true;
}
@ -313,30 +397,76 @@ bool Terrain_readLocalData(osg::Object& obj, osgDB::Input &fr)
itrAdvanced = true;
}
#if 1
if (!(terrain.getTerrainTechnique()))
{
terrain.setTerrainTechnique(new osgTerrain::GeometryTechnique);
}
#endif
return itrAdvanced;
}
bool writeLocator(const osgTerrain::Locator& locator, osgDB::Output& fw)
{
const osgTerrain::CartesianLocator* cartesian = dynamic_cast<const osgTerrain::CartesianLocator*>(&locator);
if (cartesian)
{
fw.indent()<<"CartesianLocator "<<cartesian->getOriginX()<<" "<<cartesian->getOriginY()<<" "<<cartesian->getLengthX()<<" "<<cartesian->getLengthY()<<std::endl;
return true;
}
if (locator.getCoordinateSystem().empty())
{
fw.indent()<<"Locator ";
switch(locator.getCoordinateSystemType())
{
case(osgTerrain::Locator::GEOCENTRIC):
{
fw<<"GEOCENTRIC";
break;
}
case(osgTerrain::Locator::GEOGRAPHIC):
{
fw<<"GEOGRPAHIC";
break;
}
case(osgTerrain::Locator::PROJECTED):
{
fw<<"PROJECTED";
break;
}
}
const osgTerrain::EllipsoidLocator* ellipsoid = dynamic_cast<const osgTerrain::EllipsoidLocator*>(&locator);
if (ellipsoid)
{
fw.indent()<<"CartesianLocator "<<ellipsoid->getLongitude()<<" "<<ellipsoid->getLatitude()<<" "<<ellipsoid->getDeltaLongitude()<<" "<<ellipsoid->getDeltaLatitude()<<std::endl;
return true;
fw<<" "<<locator.getMinX()<<" "<<locator.getMinY()<<" "<<locator.getMaxX()<<" "<<locator.getMaxY()<<std::endl;
}
else
{
fw.indent()<<"Locator {"<<std::endl;
fw.moveIn();
if (!locator.getFormat().empty()) fw.indent()<<"Format \""<<locator.getFormat()<<"\""<<std::endl;
if (!locator.getCoordinateSystem().empty()) fw.indent()<<"CoordinateSystem \""<<locator.getCoordinateSystem()<<"\""<<std::endl;
fw.indent()<<"CoordinateSystemType ";
switch(locator.getCoordinateSystemType())
{
case(osgTerrain::Locator::GEOCENTRIC):
{
fw<<"GEOCENTRIC"<<std::endl;
break;
}
case(osgTerrain::Locator::GEOGRAPHIC):
{
fw<<"GEOGRAPHIC"<<std::endl;
break;
}
case(osgTerrain::Locator::PROJECTED):
{
fw<<"PROJECTED"<<std::endl;;
break;
}
}
fw.indent()<<"Extents "<<locator.getMinX()<<" "<<locator.getMinY()<<" "<<locator.getMaxX()<<" "<<locator.getMaxY()<<std::endl;
fw.moveOut();
fw.indent()<<"}"<<std::endl;
}
return false;
}
@ -392,6 +522,9 @@ bool Terrain_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
{
const osgTerrain::Terrain& terrain = static_cast<const osgTerrain::Terrain&>(obj);
int prec = fw.precision();
fw.precision(15);
if (terrain.getLocator())
{
writeLocator(*terrain.getLocator(),fw);
@ -434,5 +567,7 @@ bool Terrain_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
}
}
fw.precision(prec);
return true;
}

View File

@ -12,6 +12,7 @@
*/
#include <osgTerrain/Locator>
#include <osg/Notify>
#include <list>
@ -21,12 +22,26 @@ using namespace osgTerrain;
//
// Locator
//
Locator::Locator()
Locator::Locator():
_coordinateSystemType(PROJECTED),
_ellipsoidModel(new osg::EllipsoidModel()),
_minX(0.0),
_minY(0.0),
_maxX(0.0),
_maxY(0.0)
{
}
Locator::Locator(const Locator& Locator,const osg::CopyOp& copyop):
osg::Object(Locator,copyop)
Locator::Locator(const Locator& locator,const osg::CopyOp& copyop):
osg::Object(locator,copyop),
_coordinateSystemType(locator._coordinateSystemType),
_ellipsoidModel(locator._ellipsoidModel),
_format(locator._format),
_cs(locator._cs),
_minX(locator._minX),
_minY(locator._minY),
_maxX(locator._maxX),
_maxY(locator._maxY)
{
}
@ -34,6 +49,14 @@ Locator::~Locator()
{
}
void Locator::setExtents(double minX, double minY, double maxX, double maxY)
{
_minX = minX;
_minY = minY;
_maxX = maxX;
_maxY = maxY;
}
bool Locator::computeLocalBounds(Locator& source, osg::Vec3d& bottomLeft, osg::Vec3d& topRight)
{
typedef std::list<osg::Vec3d> Corners;
@ -76,96 +99,77 @@ bool Locator::computeLocalBounds(Locator& source, osg::Vec3d& bottomLeft, osg::V
return true;
}
//////////////////////////////////////////////////////////////////////////////
//
// EllipsoidLocator
//
EllipsoidLocator::EllipsoidLocator(double longitude, double latitude, double deltaLongitude, double deltaLatitude, double height, double heightScale, double radiusEquator, double radiusPolar)
bool Locator::orientationOpenGL() const
{
setExtents(longitude, latitude, deltaLongitude, deltaLatitude, height, heightScale);
_em = new osg::EllipsoidModel(radiusEquator, radiusPolar);
return ((_maxX-_minX) * (_maxY-_minY)) >= 0.0;
}
void EllipsoidLocator::setExtents(double longitude, double latitude, double deltaLongitude, double deltaLatitude, double height, double heightScale)
bool Locator::convertLocalToModel(const osg::Vec3d& local, osg::Vec3d& world) const
{
_longitude = longitude;
_latitude = latitude;
_deltaLongitude = deltaLongitude;
_deltaLatitude = deltaLatitude;
_height = height;
_heightScale = heightScale;
switch(_coordinateSystemType)
{
case(GEOCENTRIC):
{
double longitude = _minX * (1.0-local.x()) + _maxX * local.x();
double latitude = _minY * (1.0-local.y()) + _maxY * local.y();
double height = local.z();
_ellipsoidModel->convertLatLongHeightToXYZ(latitude, longitude, height,
world.x(), world.y(), world.z());
return true;
}
case(GEOGRAPHIC):
{
world.x() = _minX * (1.0-local.x()) + _maxX * local.x();
world.y() = _minY * (1.0-local.y()) + _maxY * local.y();
world.z() = local.z();
return true;
}
case(PROJECTED):
{
world.x() = _minX * (1.0-local.x()) + _maxX * local.x();
world.y() = _minY * (1.0-local.y()) + _maxY * local.y();
world.z() = local.z();
return true;
}
}
return false;
}
bool EllipsoidLocator::orientationOpenGL() const
bool Locator::convertModelToLocal(const osg::Vec3d& world, osg::Vec3d& local) const
{
return (_deltaLongitude * _deltaLatitude) >= 0.0;
}
bool EllipsoidLocator::convertLocalToModel(const osg::Vec3d& local, osg::Vec3d& world) const
{
double longitude = _longitude + local.x() * _deltaLongitude;
double latitude = _latitude + local.y() * _deltaLatitude;
double height = _height + local.z() * _heightScale;
_em->convertLatLongHeightToXYZ(latitude, longitude, height,
world.x(), world.y(), world.z());
return true;
}
bool EllipsoidLocator::convertModelToLocal(const osg::Vec3d& world, osg::Vec3d& local) const
{
double longitude, latitude, height;
_em->convertXYZToLatLongHeight(world.x(), world.y(), world.z(),
latitude, longitude, height );
local.x() = (longitude-_longitude)/_deltaLongitude;
local.y() = (latitude-_latitude)/_deltaLatitude;
local.z() = (height-_height)/_heightScale;
return true;
}
//////////////////////////////////////////////////////////////////////////////
//
// CartesianLocator
//
CartesianLocator::CartesianLocator(double originX, double originY, double lengthX, double lengthY, double height, double heightScale)
{
setExtents(originX, originY, lengthX, lengthY, height, heightScale);
}
void CartesianLocator::setExtents(double originX, double originY, double lengthX, double lengthY, double height, double heightScale)
{
_originX = originX;
_originY = originY;
_lengthX = lengthX;
_lengthY = lengthY;
_height = height;
_heightScale = heightScale;
}
bool CartesianLocator::orientationOpenGL() const
{
return (_lengthX * _lengthY) >= 0.0;
}
bool CartesianLocator::convertLocalToModel(const osg::Vec3d& local, osg::Vec3d& world) const
{
world.x() = _originX + local.x() * _lengthX;
world.y() = _originY + local.y() * _lengthY;
world.z() = _height + local.z() * _heightScale;
return true;
}
bool CartesianLocator::convertModelToLocal(const osg::Vec3d& world, osg::Vec3d& local) const
{
local.x() = (world.x() - _originX)/_lengthX;
local.y() = (world.y() - _originY)/_lengthY;
local.z() = (world.z() - _height)/_heightScale;
return true;
switch(_coordinateSystemType)
{
case(GEOCENTRIC):
{
double longitude, latitude, height;
_ellipsoidModel->convertXYZToLatLongHeight(world.x(), world.y(), world.z(),
latitude, longitude, height );
local.x() = (longitude - _minX) / (_maxX - _minX);
local.y() = (latitude - _minY) / (_maxY - _minY);
local.z() = height;
return true;
}
case(GEOGRAPHIC):
{
local.x() = (world.x() - _minX) / (_maxX - _minX);
local.y() = (world.y() - _minY) / (_maxY - _minY);
local.z() = world.z();
return true;
}
case(PROJECTED):
{
local.x() = (world.x() - _minX) / (_maxX - _minX);
local.y() = (world.y() - _minY) / (_maxY - _minY);
local.z() = world.z();
return true;
}
}
return false;
}

View File

@ -24,172 +24,11 @@
#undef OUT
#endif
BEGIN_OBJECT_REFLECTOR(osgTerrain::CartesianLocator)
BEGIN_ENUM_REFLECTOR(osgTerrain::Locator::CoordinateSystemType)
I_DeclaringFile("osgTerrain/Locator");
I_BaseType(osgTerrain::Locator);
I_ConstructorWithDefaults6(IN, double, originX, , IN, double, originY, , IN, double, lengthX, , IN, double, lengthY, , IN, double, height, 0.0f, IN, double, heightScale, 1.0f,
____CartesianLocator__double__double__double__double__double__double,
"",
"");
I_MethodWithDefaults6(void, setExtents, IN, double, originX, , IN, double, originY, , IN, double, lengthX, , IN, double, lengthY, , IN, double, height, 0.0f, IN, double, heightScale, 1.0f,
Properties::NON_VIRTUAL,
__void__setExtents__double__double__double__double__double__double,
"",
"");
I_Method1(void, setOriginX, IN, double, x,
Properties::NON_VIRTUAL,
__void__setOriginX__double,
"",
"");
I_Method0(double, getOriginX,
Properties::NON_VIRTUAL,
__double__getOriginX,
"",
"");
I_Method1(void, setOriginY, IN, double, y,
Properties::NON_VIRTUAL,
__void__setOriginY__double,
"",
"");
I_Method0(double, getOriginY,
Properties::NON_VIRTUAL,
__double__getOriginY,
"",
"");
I_Method1(void, setLengthX, IN, double, x,
Properties::NON_VIRTUAL,
__void__setLengthX__double,
"",
"");
I_Method0(double, getLengthX,
Properties::NON_VIRTUAL,
__double__getLengthX,
"",
"");
I_Method1(void, setLengthY, IN, double, y,
Properties::NON_VIRTUAL,
__void__setLengthY__double,
"",
"");
I_Method0(double, getLengthY,
Properties::NON_VIRTUAL,
__double__getLengthY,
"",
"");
I_Method0(bool, orientationOpenGL,
Properties::VIRTUAL,
__bool__orientationOpenGL,
"",
"");
I_Method2(bool, convertLocalToModel, IN, const osg::Vec3d &, local, IN, osg::Vec3d &, world,
Properties::VIRTUAL,
__bool__convertLocalToModel__C5_osg_Vec3d_R1__osg_Vec3d_R1,
"",
"");
I_Method2(bool, convertModelToLocal, IN, const osg::Vec3d &, world, IN, osg::Vec3d &, local,
Properties::VIRTUAL,
__bool__convertModelToLocal__C5_osg_Vec3d_R1__osg_Vec3d_R1,
"",
"");
I_SimpleProperty(double, LengthX,
__double__getLengthX,
__void__setLengthX__double);
I_SimpleProperty(double, LengthY,
__double__getLengthY,
__void__setLengthY__double);
I_SimpleProperty(double, OriginX,
__double__getOriginX,
__void__setOriginX__double);
I_SimpleProperty(double, OriginY,
__double__getOriginY,
__void__setOriginY__double);
END_REFLECTOR
BEGIN_OBJECT_REFLECTOR(osgTerrain::EllipsoidLocator)
I_DeclaringFile("osgTerrain/Locator");
I_BaseType(osgTerrain::Locator);
I_ConstructorWithDefaults8(IN, double, longitude, , IN, double, latitude, , IN, double, deltaLongitude, , IN, double, deltaLatitude, , IN, double, height, 0.0, IN, double, heightScale, 1.0f, IN, double, radiusEquator, osg::WGS_84_RADIUS_EQUATOR, IN, double, radiusPolar, osg::WGS_84_RADIUS_POLAR,
____EllipsoidLocator__double__double__double__double__double__double__double__double,
"",
"");
I_MethodWithDefaults6(void, setExtents, IN, double, longitude, , IN, double, latitude, , IN, double, deltaLongitude, , IN, double, deltaLatitude, , IN, double, height, 0.0, IN, double, heightScale, 1.0f,
Properties::NON_VIRTUAL,
__void__setExtents__double__double__double__double__double__double,
"",
"");
I_Method0(double, getLongitude,
Properties::NON_VIRTUAL,
__double__getLongitude,
"",
"");
I_Method0(double, getDeltaLongitude,
Properties::NON_VIRTUAL,
__double__getDeltaLongitude,
"",
"");
I_Method0(double, getLatitude,
Properties::NON_VIRTUAL,
__double__getLatitude,
"",
"");
I_Method0(double, getDeltaLatitude,
Properties::NON_VIRTUAL,
__double__getDeltaLatitude,
"",
"");
I_Method0(double, getHeight,
Properties::NON_VIRTUAL,
__double__getHeight,
"",
"");
I_Method1(void, setEllipsoidModel, IN, osg::EllipsoidModel *, em,
Properties::NON_VIRTUAL,
__void__setEllipsoidModel__osg_EllipsoidModel_P1,
"",
"");
I_Method0(osg::EllipsoidModel *, getEllipsoidModel,
Properties::NON_VIRTUAL,
__osg_EllipsoidModel_P1__getEllipsoidModel,
"",
"");
I_Method0(const osg::EllipsoidModel *, getEllipsoidModel,
Properties::NON_VIRTUAL,
__C5_osg_EllipsoidModel_P1__getEllipsoidModel,
"",
"");
I_Method0(bool, orientationOpenGL,
Properties::VIRTUAL,
__bool__orientationOpenGL,
"",
"");
I_Method2(bool, convertLocalToModel, IN, const osg::Vec3d &, local, IN, osg::Vec3d &, world,
Properties::VIRTUAL,
__bool__convertLocalToModel__C5_osg_Vec3d_R1__osg_Vec3d_R1,
"",
"");
I_Method2(bool, convertModelToLocal, IN, const osg::Vec3d &, world, IN, osg::Vec3d &, local,
Properties::VIRTUAL,
__bool__convertModelToLocal__C5_osg_Vec3d_R1__osg_Vec3d_R1,
"",
"");
I_SimpleProperty(double, DeltaLatitude,
__double__getDeltaLatitude,
0);
I_SimpleProperty(double, DeltaLongitude,
__double__getDeltaLongitude,
0);
I_SimpleProperty(osg::EllipsoidModel *, EllipsoidModel,
__osg_EllipsoidModel_P1__getEllipsoidModel,
__void__setEllipsoidModel__osg_EllipsoidModel_P1);
I_SimpleProperty(double, Height,
__double__getHeight,
0);
I_SimpleProperty(double, Latitude,
__double__getLatitude,
0);
I_SimpleProperty(double, Longitude,
__double__getLongitude,
0);
I_EnumLabel(osgTerrain::Locator::GEOCENTRIC);
I_EnumLabel(osgTerrain::Locator::GEOGRAPHIC);
I_EnumLabel(osgTerrain::Locator::PROJECTED);
END_REFLECTOR
BEGIN_OBJECT_REFLECTOR(osgTerrain::Locator)
@ -227,6 +66,101 @@ BEGIN_OBJECT_REFLECTOR(osgTerrain::Locator)
__C5_char_P1__className,
"return the name of the object's class type. ",
"Must be defined by derived classes. ");
I_Method1(void, setCoordinateSystemType, IN, osgTerrain::Locator::CoordinateSystemType, type,
Properties::NON_VIRTUAL,
__void__setCoordinateSystemType__CoordinateSystemType,
"Set the CoordinatesSyetemType. ",
"Note, the user must keep the CoordinateSystemString consistent with the type of the CoordindateSystem. ");
I_Method0(osgTerrain::Locator::CoordinateSystemType, getCoordinateSystemType,
Properties::NON_VIRTUAL,
__CoordinateSystemType__getCoordinateSystemType,
"Get the CoordinatesSyetemType. ",
"");
I_Method1(void, setFormat, IN, const std::string &, format,
Properties::NON_VIRTUAL,
__void__setFormat__C5_std_string_R1,
"Set the coordinate system format string. ",
"Typical values would be WKT, PROJ4, USGS etc. ");
I_Method0(const std::string &, getFormat,
Properties::NON_VIRTUAL,
__C5_std_string_R1__getFormat,
"Get the coordinate system format string. ",
"");
I_Method1(void, setCoordinateSystem, IN, const std::string &, cs,
Properties::NON_VIRTUAL,
__void__setCoordinateSystem__C5_std_string_R1,
"Set the CoordinateSystem reference string, should be stored in a form consistent with the Format. ",
"");
I_Method0(const std::string &, getCoordinateSystem,
Properties::NON_VIRTUAL,
__C5_std_string_R1__getCoordinateSystem,
"Get the CoordinateSystem reference string. ",
"");
I_Method1(void, setEllipsoidModel, IN, osg::EllipsoidModel *, ellipsode,
Properties::NON_VIRTUAL,
__void__setEllipsoidModel__osg_EllipsoidModel_P1,
"Set EllipsoidModel to describe the model used to map lat, long and height into geocentric XYZ and back. ",
"");
I_Method0(osg::EllipsoidModel *, getEllipsoidModel,
Properties::NON_VIRTUAL,
__osg_EllipsoidModel_P1__getEllipsoidModel,
"Get the EllipsoidModel. ",
"");
I_Method0(const osg::EllipsoidModel *, getEllipsoidModel,
Properties::NON_VIRTUAL,
__C5_osg_EllipsoidModel_P1__getEllipsoidModel,
"Get the const EllipsoidModel. ",
"");
I_Method4(void, setExtents, IN, double, minX, IN, double, minY, IN, double, maxX, IN, double, maxY,
Properties::NON_VIRTUAL,
__void__setExtents__double__double__double__double,
"Set the extents of the local coords. ",
"");
I_Method4(void, getExtents, IN, double &, minX, IN, double &, minY, IN, double &, maxX, IN, double &, maxY,
Properties::NON_VIRTUAL,
__void__getExtents__double_R1__double_R1__double_R1__double_R1,
"Get the extents of the local coords. ",
"");
I_Method1(void, setMinX, IN, double, minX,
Properties::NON_VIRTUAL,
__void__setMinX__double,
"",
"");
I_Method0(double, getMinX,
Properties::NON_VIRTUAL,
__double__getMinX,
"",
"");
I_Method1(void, setMinY, IN, double, minY,
Properties::NON_VIRTUAL,
__void__setMinY__double,
"",
"");
I_Method0(double, getMinY,
Properties::NON_VIRTUAL,
__double__getMinY,
"",
"");
I_Method1(void, setMaxX, IN, double, maxX,
Properties::NON_VIRTUAL,
__void__setMaxX__double,
"",
"");
I_Method0(double, getMaxX,
Properties::NON_VIRTUAL,
__double__getMaxX,
"",
"");
I_Method1(void, setMaxY, IN, double, maxY,
Properties::NON_VIRTUAL,
__void__setMaxY__double,
"",
"");
I_Method0(double, getMaxY,
Properties::NON_VIRTUAL,
__double__getMaxY,
"",
"");
I_Method0(bool, orientationOpenGL,
Properties::VIRTUAL,
__bool__orientationOpenGL,
@ -251,5 +185,29 @@ BEGIN_OBJECT_REFLECTOR(osgTerrain::Locator)
__bool__convertLocalCoordBetween__C5_Locator_R1__C5_osg_Vec3d_R1__C5_Locator_R1__osg_Vec3d_R1_S,
"",
"");
I_SimpleProperty(const std::string &, CoordinateSystem,
__C5_std_string_R1__getCoordinateSystem,
__void__setCoordinateSystem__C5_std_string_R1);
I_SimpleProperty(osgTerrain::Locator::CoordinateSystemType, CoordinateSystemType,
__CoordinateSystemType__getCoordinateSystemType,
__void__setCoordinateSystemType__CoordinateSystemType);
I_SimpleProperty(osg::EllipsoidModel *, EllipsoidModel,
__osg_EllipsoidModel_P1__getEllipsoidModel,
__void__setEllipsoidModel__osg_EllipsoidModel_P1);
I_SimpleProperty(const std::string &, Format,
__C5_std_string_R1__getFormat,
__void__setFormat__C5_std_string_R1);
I_SimpleProperty(double, MaxX,
__double__getMaxX,
__void__setMaxX__double);
I_SimpleProperty(double, MaxY,
__double__getMaxY,
__void__setMaxY__double);
I_SimpleProperty(double, MinX,
__double__getMinX,
__void__setMinX__double);
I_SimpleProperty(double, MinY,
__double__getMinY,
__void__setMinY__double);
END_REFLECTOR