From b92ebca928319830fbdfa1f9d50d2bb27372d683 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 1 Jun 2007 21:33:29 +0000 Subject: [PATCH] From Maria Ten, "The constructor method of the EllipsoidLocator of osgTerrain assumes that the terrain is always the Earth planet. I changed the constructor method to accept the Equator radius and the Polar radius like parameters. By default, it assumes the Earth radius for the EllipsoidLocator. I added a setEllipsoidModel method, too. Now, we are developing some libraries for a GIS applicacion, and our libraries can visualize terrains of planets like Mars. I think that is a interesting change." --- include/osgTerrain/Locator | 3 ++- src/osgTerrain/Locator.cpp | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/osgTerrain/Locator b/include/osgTerrain/Locator index 13a95eb2f..afccc208b 100644 --- a/include/osgTerrain/Locator +++ b/include/osgTerrain/Locator @@ -60,7 +60,7 @@ class OSGTERRAIN_EXPORT EllipsoidLocator : public osgTerrain::Locator public: - EllipsoidLocator(double longitude, double latitude, double deltaLongitude, double deltaLatitude, double height=0.0, double heightScale = 1.0f); + 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); @@ -72,6 +72,7 @@ class OSGTERRAIN_EXPORT EllipsoidLocator : public osgTerrain::Locator 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(); } diff --git a/src/osgTerrain/Locator.cpp b/src/osgTerrain/Locator.cpp index 15cc4c4f5..ed1d81524 100644 --- a/src/osgTerrain/Locator.cpp +++ b/src/osgTerrain/Locator.cpp @@ -80,13 +80,12 @@ bool Locator::computeLocalBounds(Locator& source, osg::Vec3d& bottomLeft, osg::V // // EllipsoidLocator // -EllipsoidLocator::EllipsoidLocator(double longitude, double latitude, double deltaLongitude, double deltaLatitude, double height, double heightScale) +EllipsoidLocator::EllipsoidLocator(double longitude, double latitude, double deltaLongitude, double deltaLatitude, double height, double heightScale, double radiusEquator, double radiusPolar) { setExtents(longitude, latitude, deltaLongitude, deltaLatitude, height, heightScale); - _em = new osg::EllipsoidModel; + _em = new osg::EllipsoidModel(radiusEquator, radiusPolar); } - void EllipsoidLocator::setExtents(double longitude, double latitude, double deltaLongitude, double deltaLatitude, double height, double heightScale) { _longitude = longitude;