Fixed Locator::setTransform method so it takes a const Matrixd&, and improved

the setting of Locator in the gdal plugin.
This commit is contained in:
Robert Osfield 2007-09-16 17:48:07 +00:00
parent 41dc911166
commit ae5883dd23
3 changed files with 18 additions and 8 deletions

View File

@ -77,7 +77,7 @@ class OSGTERRAIN_EXPORT Locator : public osg::Object
/** Set the transformation from local coordinates to model coordinates.*/ /** Set the transformation from local coordinates to model coordinates.*/
void setTransform(osg::Matrixd& transform) { _transform = transform; _inverse.invert(_transform); } void setTransform(const osg::Matrixd& transform) { _transform = transform; _inverse.invert(_transform); }
/** Set the transformation from local coordinates to model coordinates.*/ /** Set the transformation from local coordinates to model coordinates.*/
const osg::Matrixd& getTransform() const { return _transform; } const osg::Matrixd& getTransform() const { return _transform; }

View File

@ -119,7 +119,14 @@ void DataSetLayer::setUpLocator()
0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0,
geoTransform[0], geoTransform[3], 0.0, 1.0); geoTransform[0], geoTransform[3], 0.0, 1.0);
locator->setTransform(matrix);
int nPixels = _dataset->GetRasterXSize();
int nLines = _dataset->GetRasterYSize();
locator->setTransform(
osg::Matrixd::scale(static_cast<double>(nPixels-1), static_cast<double>(nLines-1), 1.0) *
matrix);
locator->setDefinedInFile(true); locator->setDefinedInFile(true);
setLocator(locator.get()); setLocator(locator.get());
@ -167,7 +174,10 @@ void DataSetLayer::setUpLocator()
0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0,
adfDstGeoTransform[0], adfDstGeoTransform[3], 0.0, 1.0); adfDstGeoTransform[0], adfDstGeoTransform[3], 0.0, 1.0);
locator->setTransform(matrix); locator->setTransform(
osg::Matrixd::scale(static_cast<double>(nPixels-1), static_cast<double>(nLines-1), 1.0) *
matrix);
locator->setDefinedInFile(true); locator->setDefinedInFile(true);
setLocator(locator.get()); setLocator(locator.get());

View File

@ -112,9 +112,9 @@ BEGIN_OBJECT_REFLECTOR(osgTerrain::Locator)
__C5_osg_EllipsoidModel_P1__getEllipsoidModel, __C5_osg_EllipsoidModel_P1__getEllipsoidModel,
"Get the const EllipsoidModel. ", "Get the const EllipsoidModel. ",
""); "");
I_Method1(void, setTransform, IN, osg::Matrixd &, transform, I_Method1(void, setTransform, IN, const osg::Matrixd &, transform,
Properties::NON_VIRTUAL, Properties::NON_VIRTUAL,
__void__setTransform__osg_Matrixd_R1, __void__setTransform__C5_osg_Matrixd_R1,
"Set the transformation from local coordinates to model coordinates. ", "Set the transformation from local coordinates to model coordinates. ",
""); "");
I_Method0(const osg::Matrixd &, getTransform, I_Method0(const osg::Matrixd &, getTransform,
@ -176,8 +176,8 @@ BEGIN_OBJECT_REFLECTOR(osgTerrain::Locator)
I_SimpleProperty(const std::string &, Format, I_SimpleProperty(const std::string &, Format,
__C5_std_string_R1__getFormat, __C5_std_string_R1__getFormat,
__void__setFormat__C5_std_string_R1); __void__setFormat__C5_std_string_R1);
I_SimpleProperty(osg::Matrixd &, Transform, I_SimpleProperty(const osg::Matrixd &, Transform,
0, __C5_osg_Matrixd_R1__getTransform,
__void__setTransform__osg_Matrixd_R1); __void__setTransform__C5_osg_Matrixd_R1);
END_REFLECTOR END_REFLECTOR