2006-07-18 23:21:48 +08:00
|
|
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
|
2003-11-25 19:40:10 +08:00
|
|
|
*
|
|
|
|
* This library is open source and may be redistributed and/or modified under
|
|
|
|
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
|
|
|
* (at your option) any later version. The full license is in LICENSE file
|
|
|
|
* included with this distribution, and on the openscenegraph.org website.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* OpenSceneGraph Public License for more details.
|
|
|
|
*/
|
|
|
|
|
2004-08-06 13:25:21 +08:00
|
|
|
#ifdef WIN32
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Disable unavoidable warning messages:
|
|
|
|
//
|
|
|
|
// C4503 - decorated name length exceeded, name was truncated
|
|
|
|
//
|
|
|
|
#pragma warning(disable : 4503)
|
|
|
|
|
|
|
|
#endif // WIN32
|
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
#ifndef DATASET_H
|
|
|
|
#define DATASET_H 1
|
|
|
|
|
2006-05-15 21:12:55 +08:00
|
|
|
#include <osg/BoundingSphere>
|
2003-11-25 19:40:10 +08:00
|
|
|
#include <osg/Node>
|
|
|
|
#include <osg/Matrixd>
|
|
|
|
#include <osg/Image>
|
|
|
|
#include <osg/Shape>
|
2004-04-30 06:22:22 +08:00
|
|
|
#include <osg/CoordinateSystemNode>
|
2005-11-10 04:24:47 +08:00
|
|
|
#include <osg/State>
|
2003-11-25 19:40:10 +08:00
|
|
|
|
2004-11-09 22:18:29 +08:00
|
|
|
#include <osgDB/Archive>
|
|
|
|
|
2003-12-18 01:02:23 +08:00
|
|
|
#include <set>
|
|
|
|
|
2004-04-07 00:01:05 +08:00
|
|
|
#include <osgTerrain/Export>
|
|
|
|
|
2004-10-28 15:00:55 +08:00
|
|
|
// forward declare so we can avoid tieing osgTerrain to GDAL.
|
|
|
|
class GDALDataset;
|
2006-08-01 04:56:22 +08:00
|
|
|
class GDALRasterBand;
|
2004-10-28 15:00:55 +08:00
|
|
|
|
2004-03-12 00:14:25 +08:00
|
|
|
namespace osgTerrain
|
|
|
|
{
|
|
|
|
|
2004-06-30 15:26:02 +08:00
|
|
|
#define MAXIMUM_NUMBER_OF_LEVELS 30
|
|
|
|
|
2006-05-15 21:12:55 +08:00
|
|
|
class GeospatialExtents
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2006-09-05 04:43:07 +08:00
|
|
|
osg::Vec2d _min;
|
|
|
|
osg::Vec2d _max;
|
|
|
|
bool _isGeographic;
|
|
|
|
|
2006-05-15 21:12:55 +08:00
|
|
|
inline GeospatialExtents() :
|
|
|
|
_min(DBL_MAX,DBL_MAX),
|
2006-09-05 04:43:07 +08:00
|
|
|
_max(-DBL_MAX,-DBL_MAX),
|
|
|
|
_isGeographic(false) {}
|
2006-05-15 21:12:55 +08:00
|
|
|
|
2006-09-05 04:43:07 +08:00
|
|
|
inline GeospatialExtents(double xmin, double ymin, double xmax, double ymax, bool isGeographic) :
|
2006-05-15 21:12:55 +08:00
|
|
|
_min(xmin, ymin),
|
2006-09-05 04:43:07 +08:00
|
|
|
_max(xmax, ymax),
|
|
|
|
_isGeographic(isGeographic) {}
|
2006-05-15 21:12:55 +08:00
|
|
|
|
|
|
|
inline double& xMin() { return _min.x(); }
|
|
|
|
inline double xMin() const { return _min.x(); }
|
|
|
|
|
|
|
|
inline double& yMin() { return _min.y(); }
|
|
|
|
inline double yMin() const { return _min.y(); }
|
|
|
|
|
|
|
|
inline double& xMax() { return _max.x(); }
|
|
|
|
inline double xMax() const { return _max.x(); }
|
|
|
|
|
|
|
|
inline double& yMax() { return _max.y(); }
|
|
|
|
inline double yMax() const { return _max.y(); }
|
|
|
|
|
|
|
|
inline void init()
|
|
|
|
{
|
|
|
|
_min.set(DBL_MAX,DBL_MAX);
|
|
|
|
_max.set(-DBL_MAX,-DBL_MAX);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool valid() const
|
|
|
|
{
|
|
|
|
return _max.x()>=_min.x() && _max.y()>=_min.y();
|
|
|
|
}
|
|
|
|
|
|
|
|
inline double radius() const
|
|
|
|
{
|
|
|
|
return sqrt((radius2()));
|
|
|
|
}
|
|
|
|
|
|
|
|
inline double radius2() const
|
|
|
|
{
|
|
|
|
return 0.25f*((_max-_min).length2());
|
|
|
|
}
|
|
|
|
|
2006-09-05 04:43:07 +08:00
|
|
|
GeospatialExtents intersection(const GeospatialExtents& e, double xoffset) const
|
2006-05-15 21:12:55 +08:00
|
|
|
{
|
2006-09-05 04:43:07 +08:00
|
|
|
return GeospatialExtents(osg::maximum(xMin(),e.xMin()+xoffset),osg::maximum(yMin(),e.yMin()),
|
|
|
|
osg::minimum(xMax(),e.xMax()+xoffset),osg::minimum(yMax(),e.yMax()),_isGeographic);
|
2006-05-15 21:12:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Return true if this bounding box intersects the specified bounding box. */
|
|
|
|
bool intersects(const GeospatialExtents& bb) const
|
|
|
|
{
|
2006-09-05 04:43:07 +08:00
|
|
|
if (_isGeographic)
|
|
|
|
{
|
|
|
|
// first check vertical axis overlap
|
|
|
|
if (osg::maximum(yMin(),bb.yMin()) > osg::minimum(yMax(),bb.yMax())) return false;
|
|
|
|
|
|
|
|
// next check if overlaps directly without any 360 degree horizontal shifts.
|
|
|
|
if (osg::maximum(xMin(),bb.xMin()) <= osg::minimum(xMax(),bb.xMax())) return true;
|
|
|
|
|
|
|
|
// next check if a 360 rotation will produce an overlap
|
|
|
|
float rotationAngle = (xMin() > bb.xMin()) ? 360.0 : -360;
|
|
|
|
return (osg::maximum(xMin(),bb.xMin()+rotationAngle) <= osg::minimum(xMax(),bb.xMax()+rotationAngle));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return (osg::maximum(xMin(),bb.xMin()) <= osg::minimum(xMax(),bb.xMax()) &&
|
|
|
|
osg::maximum(yMin(),bb.yMin()) <= osg::minimum(yMax(),bb.yMax()));
|
|
|
|
}
|
2006-05-15 21:12:55 +08:00
|
|
|
}
|
|
|
|
|
2006-09-05 04:43:07 +08:00
|
|
|
|
2006-05-15 21:12:55 +08:00
|
|
|
void expandBy(const osg::BoundingSphere& sh)
|
|
|
|
{
|
|
|
|
if (!sh.valid()) return;
|
|
|
|
|
|
|
|
if(sh._center.x()-sh._radius<_min.x()) _min.x() = sh._center.x()-sh._radius;
|
|
|
|
if(sh._center.x()+sh._radius>_max.x()) _max.x() = sh._center.x()+sh._radius;
|
|
|
|
|
|
|
|
if(sh._center.y()-sh._radius<_min.y()) _min.y() = sh._center.y()-sh._radius;
|
|
|
|
if(sh._center.y()+sh._radius>_max.y()) _max.y() = sh._center.y()+sh._radius;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void expandBy(const osg::Vec3& v)
|
|
|
|
{
|
|
|
|
if(v.x()<_min.x()) _min.x() = v.x();
|
|
|
|
if(v.x()>_max.x()) _max.x() = v.x();
|
|
|
|
|
|
|
|
if(v.y()<_min.y()) _min.y() = v.y();
|
|
|
|
if(v.y()>_max.y()) _max.y() = v.y();
|
|
|
|
}
|
|
|
|
|
|
|
|
void expandBy(const GeospatialExtents& e)
|
|
|
|
{
|
|
|
|
if (!e.valid()) return;
|
|
|
|
|
|
|
|
if(e._min.x()<_min.x()) _min.x() = e._min.x();
|
|
|
|
if(e._max.x()>_max.x()) _max.x() = e._max.x();
|
|
|
|
|
|
|
|
if(e._min.y()<_min.y()) _min.y() = e._min.y();
|
|
|
|
if(e._max.y()>_max.y()) _max.y() = e._max.y();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-04-07 00:01:05 +08:00
|
|
|
class OSGTERRAIN_EXPORT DataSet : public osg::Referenced
|
2003-11-25 19:40:10 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2004-09-10 21:31:37 +08:00
|
|
|
static std::string coordinateSystemStringToWTK(const std::string& coordinateSystem);
|
2004-06-17 22:39:16 +08:00
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
class Source;
|
|
|
|
|
2006-09-07 18:41:38 +08:00
|
|
|
struct OSGTERRAIN_EXPORT SpatialProperties
|
2003-11-25 19:40:10 +08:00
|
|
|
{
|
|
|
|
SpatialProperties():
|
|
|
|
_numValuesX(0),
|
|
|
|
_numValuesY(0),
|
|
|
|
_numValuesZ(0) {}
|
|
|
|
|
|
|
|
SpatialProperties(const SpatialProperties& sp):
|
|
|
|
_cs(sp._cs),
|
|
|
|
_geoTransform(sp._geoTransform),
|
|
|
|
_extents(sp._extents),
|
|
|
|
_numValuesX(sp._numValuesX),
|
|
|
|
_numValuesY(sp._numValuesY),
|
|
|
|
_numValuesZ(sp._numValuesZ) {}
|
|
|
|
|
2006-05-15 21:12:55 +08:00
|
|
|
SpatialProperties(osg::CoordinateSystemNode* cs, const GeospatialExtents& extents):
|
2004-01-16 05:07:34 +08:00
|
|
|
_cs(cs),
|
|
|
|
_extents(extents),
|
|
|
|
_numValuesX(0),
|
|
|
|
_numValuesY(0),
|
|
|
|
_numValuesZ(0) {}
|
2003-11-25 19:40:10 +08:00
|
|
|
|
2004-03-21 02:32:49 +08:00
|
|
|
inline SpatialProperties& assignSpatialProperties(const SpatialProperties& sp)
|
2003-11-25 19:40:10 +08:00
|
|
|
{
|
|
|
|
if (&sp==this) return *this;
|
|
|
|
|
|
|
|
_cs = sp._cs;
|
|
|
|
_geoTransform = sp._geoTransform;
|
|
|
|
_extents = sp._extents;
|
|
|
|
_numValuesX = sp._numValuesX;
|
|
|
|
_numValuesY = sp._numValuesY;
|
|
|
|
_numValuesZ = sp._numValuesZ;
|
|
|
|
|
|
|
|
return *this;
|
|
|
|
}
|
2004-03-21 02:32:49 +08:00
|
|
|
|
2006-09-05 04:43:07 +08:00
|
|
|
void computeExtents();
|
2003-11-25 19:40:10 +08:00
|
|
|
|
2006-09-05 04:43:07 +08:00
|
|
|
osg::ref_ptr<osg::CoordinateSystemNode> _cs;
|
2003-11-25 19:40:10 +08:00
|
|
|
osg::Matrixd _geoTransform;
|
2006-05-15 21:12:55 +08:00
|
|
|
GeospatialExtents _extents;
|
2003-11-25 19:40:10 +08:00
|
|
|
unsigned int _numValuesX;
|
|
|
|
unsigned int _numValuesY;
|
|
|
|
unsigned int _numValuesZ;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DestinationData : public osg::Referenced, SpatialProperties
|
|
|
|
{
|
|
|
|
|
2004-05-03 05:50:15 +08:00
|
|
|
DestinationData(DataSet* dataSet):
|
|
|
|
_dataSet(dataSet),
|
2003-11-25 19:40:10 +08:00
|
|
|
_minDistance(0.0),
|
|
|
|
_maxDistance(FLT_MAX) {}
|
|
|
|
|
|
|
|
|
2005-03-09 00:51:48 +08:00
|
|
|
typedef std::vector< osg::ref_ptr<osg::Image> > ImageList;
|
2003-11-25 19:40:10 +08:00
|
|
|
typedef std::vector< osg::ref_ptr<osg::Node> > ModelList;
|
|
|
|
|
2004-05-03 05:50:15 +08:00
|
|
|
DataSet* _dataSet;
|
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
float _minDistance;
|
|
|
|
float _maxDistance;
|
|
|
|
|
2005-03-09 00:51:48 +08:00
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
osg::ref_ptr<osg::Image> _image;
|
|
|
|
osg::ref_ptr<osg::HeightField> _heightField;
|
|
|
|
ModelList _models;
|
|
|
|
};
|
|
|
|
|
2005-05-15 02:57:47 +08:00
|
|
|
struct OSGTERRAIN_EXPORT SourceData : public osg::Referenced, public SpatialProperties
|
2003-11-25 19:40:10 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
SourceData(Source* source=0):
|
|
|
|
_source(source),
|
|
|
|
_hasGCPs(false),
|
2005-12-08 18:03:39 +08:00
|
|
|
_gdalDataset(0) {}
|
2003-11-25 19:40:10 +08:00
|
|
|
|
2004-10-28 15:00:55 +08:00
|
|
|
virtual ~SourceData();
|
2003-11-25 19:40:10 +08:00
|
|
|
|
|
|
|
static SourceData* readData(Source* source);
|
|
|
|
|
2006-05-15 21:12:55 +08:00
|
|
|
GeospatialExtents getExtents(const osg::CoordinateSystemNode* cs) const;
|
2003-11-25 19:40:10 +08:00
|
|
|
|
2004-04-30 06:22:22 +08:00
|
|
|
const SpatialProperties& computeSpatialProperties(const osg::CoordinateSystemNode* cs) const;
|
2003-11-25 19:40:10 +08:00
|
|
|
|
2003-12-01 22:31:56 +08:00
|
|
|
bool intersects(const SpatialProperties& sp) const;
|
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
void read(DestinationData& destination);
|
|
|
|
|
2006-05-15 21:12:55 +08:00
|
|
|
virtual void readImage(DestinationData& destination);
|
|
|
|
virtual void readHeightField(DestinationData& destination);
|
|
|
|
virtual void readModels(DestinationData& destination);
|
2003-11-25 19:40:10 +08:00
|
|
|
|
2006-08-01 04:56:22 +08:00
|
|
|
float getInterpolatedValue(GDALRasterBand *band, double x, double y);
|
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
Source* _source;
|
|
|
|
|
|
|
|
bool _hasGCPs;
|
|
|
|
|
|
|
|
osg::ref_ptr<osg::Node> _model;
|
2005-12-08 18:03:39 +08:00
|
|
|
GDALDataset* _gdalDataset;
|
2003-12-01 22:31:56 +08:00
|
|
|
|
2004-04-30 06:22:22 +08:00
|
|
|
typedef std::map<const osg::CoordinateSystemNode*,SpatialProperties> SpatialPropertiesMap;
|
2004-01-16 05:07:34 +08:00
|
|
|
mutable SpatialPropertiesMap _spatialPropertiesMap;
|
|
|
|
|
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-05-15 02:57:47 +08:00
|
|
|
class OSGTERRAIN_EXPORT Source : public osg::Referenced, public SpatialProperties
|
2003-11-25 19:40:10 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
enum Type
|
|
|
|
{
|
|
|
|
IMAGE,
|
|
|
|
HEIGHT_FIELD,
|
|
|
|
MODEL
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ParameterPolicy
|
|
|
|
{
|
|
|
|
PREFER_CONFIG_SETTINGS,
|
2004-04-23 22:47:54 +08:00
|
|
|
PREFER_CONFIG_SETTINGS_BUT_SCALE_BY_FILE_RESOLUTION,
|
2003-11-25 19:40:10 +08:00
|
|
|
PREFER_FILE_SETTINGS
|
|
|
|
};
|
|
|
|
|
|
|
|
Source():
|
|
|
|
_type(IMAGE),
|
|
|
|
_sortValue(0.0),
|
|
|
|
_temporaryFile(false),
|
|
|
|
_coordinateSystemPolicy(PREFER_FILE_SETTINGS),
|
2004-06-17 22:39:16 +08:00
|
|
|
_geoTransformPolicy(PREFER_FILE_SETTINGS),
|
|
|
|
_minLevel(0),
|
2005-03-08 06:02:44 +08:00
|
|
|
_maxLevel(MAXIMUM_NUMBER_OF_LEVELS),
|
2005-12-07 23:26:45 +08:00
|
|
|
_layer(0),
|
2005-12-08 18:03:39 +08:00
|
|
|
_gdalDataset(0)
|
2003-11-25 19:40:10 +08:00
|
|
|
{}
|
|
|
|
|
|
|
|
Source(Type type, const std::string& filename):
|
|
|
|
_type(type),
|
|
|
|
_sortValue(0.0),
|
|
|
|
_filename(filename),
|
|
|
|
_temporaryFile(false),
|
|
|
|
_coordinateSystemPolicy(PREFER_FILE_SETTINGS),
|
2004-06-17 22:39:16 +08:00
|
|
|
_geoTransformPolicy(PREFER_FILE_SETTINGS),
|
|
|
|
_minLevel(0),
|
2005-03-08 06:02:44 +08:00
|
|
|
_maxLevel(MAXIMUM_NUMBER_OF_LEVELS),
|
2005-12-07 23:26:45 +08:00
|
|
|
_layer(0),
|
2005-12-08 18:03:39 +08:00
|
|
|
_gdalDataset(0)
|
2003-11-25 19:40:10 +08:00
|
|
|
{}
|
|
|
|
|
|
|
|
void setSortValue(double s) { _sortValue = s; }
|
|
|
|
double getSortValue() const { return _sortValue; }
|
|
|
|
|
|
|
|
void setSortValueFromSourceDataResolution();
|
|
|
|
|
|
|
|
void setType(Type type) { _type = type; }
|
|
|
|
Type getType() const { return _type; }
|
|
|
|
|
|
|
|
void setFileName(const std::string& filename) { _filename = filename; }
|
|
|
|
const std::string& getFileName() const { return _filename; }
|
|
|
|
|
|
|
|
void setTemporaryFile(bool temporaryFile) { _temporaryFile = temporaryFile; }
|
|
|
|
bool getTemporaryFile() const { return _temporaryFile; }
|
|
|
|
|
2005-12-08 18:03:39 +08:00
|
|
|
void setGdalDataset(void* gdalDataset);
|
|
|
|
void* getGdalDataset();
|
|
|
|
const void* getGdalDataset() const;
|
2005-12-07 23:26:45 +08:00
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
void setCoordinateSystemPolicy(ParameterPolicy policy) { _coordinateSystemPolicy = policy; }
|
2004-03-21 02:32:49 +08:00
|
|
|
ParameterPolicy getCoordinateSystemPolicy() const { return _coordinateSystemPolicy; }
|
|
|
|
|
2004-06-10 04:18:58 +08:00
|
|
|
void setCoordinateSystem(const std::string& wellKnownText) { _cs = new osg::CoordinateSystemNode("WKT",wellKnownText); }
|
2004-04-30 06:22:22 +08:00
|
|
|
void setCoordinateSystem(osg::CoordinateSystemNode* cs) { _cs = cs; }
|
|
|
|
osg::CoordinateSystemNode* getCoordinateSystem() { return _cs.get(); }
|
2003-11-25 19:40:10 +08:00
|
|
|
|
|
|
|
|
|
|
|
void setGeoTransformPolicy(ParameterPolicy policy) { _geoTransformPolicy = policy; }
|
2004-03-21 02:32:49 +08:00
|
|
|
ParameterPolicy getGeoTransformPolicy() const { return _geoTransformPolicy; }
|
2003-11-25 19:40:10 +08:00
|
|
|
|
|
|
|
void setGeoTransform(osg::Matrixd& transform) { _geoTransform = transform; }
|
|
|
|
osg::Matrixd& getGeoTransform() { return _geoTransform; }
|
|
|
|
|
2004-09-10 21:31:37 +08:00
|
|
|
void setGeoTransformFromRange(double xMin, double xMax, double yMin, double yMax)
|
|
|
|
{
|
|
|
|
_geoTransform.makeIdentity();
|
|
|
|
_geoTransform(0,0) = xMax-xMin;
|
|
|
|
_geoTransform(3,0) = xMin;
|
|
|
|
|
|
|
|
_geoTransform(1,1) = yMax-yMin;
|
|
|
|
_geoTransform(3,1) = yMin;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-21 02:32:49 +08:00
|
|
|
void assignCoordinateSystemAndGeoTransformAccordingToParameterPolicy();
|
2003-11-25 19:40:10 +08:00
|
|
|
|
2004-06-17 22:39:16 +08:00
|
|
|
|
|
|
|
|
|
|
|
void setMinLevel(unsigned int minLevel) { _minLevel = minLevel; }
|
|
|
|
void setMaxLevel(unsigned int maxLevel) { _maxLevel = maxLevel; }
|
|
|
|
void setMinMaxLevel(unsigned int minLevel, unsigned int maxLevel) { _minLevel = minLevel; _maxLevel = maxLevel; }
|
|
|
|
|
|
|
|
unsigned int getMinLevel() const { return _minLevel; }
|
|
|
|
unsigned int getMaxLevel() const { return _maxLevel; }
|
|
|
|
|
2005-03-08 06:02:44 +08:00
|
|
|
void setLayer(unsigned int layer) { _layer = layer; }
|
|
|
|
unsigned int getLayer() const { return _layer; }
|
|
|
|
|
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
void setSourceData(SourceData* data) { _sourceData = data; if (_sourceData.valid()) _sourceData->_source = this; }
|
|
|
|
SourceData* getSourceData() { return _sourceData.get(); }
|
|
|
|
|
2003-12-20 06:55:35 +08:00
|
|
|
bool intersects(const SpatialProperties& sp) const
|
|
|
|
{
|
|
|
|
return _sourceData.valid()?_sourceData->intersects(sp):false;
|
|
|
|
}
|
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
void loadSourceData();
|
2003-12-18 01:02:23 +08:00
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
|
2004-04-30 06:22:22 +08:00
|
|
|
bool needReproject(const osg::CoordinateSystemNode* cs) const;
|
2003-11-28 22:26:51 +08:00
|
|
|
|
2004-04-30 06:22:22 +08:00
|
|
|
bool needReproject(const osg::CoordinateSystemNode* cs, double minResolution, double maxResolution) const;
|
2003-11-25 19:40:10 +08:00
|
|
|
|
2004-04-30 06:22:22 +08:00
|
|
|
Source* doReproject(const std::string& filename, osg::CoordinateSystemNode* cs, double targetResolution=0.0) const;
|
2003-11-28 22:26:51 +08:00
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
void buildOverviews();
|
2003-12-18 01:02:23 +08:00
|
|
|
|
|
|
|
|
2003-12-20 06:55:35 +08:00
|
|
|
struct ResolutionPair
|
|
|
|
{
|
|
|
|
ResolutionPair():
|
|
|
|
_resX(0.0),_resY(0.0) {}
|
|
|
|
|
|
|
|
ResolutionPair(double x,double y):
|
|
|
|
_resX(x),_resY(y) {}
|
|
|
|
|
|
|
|
bool operator < (const ResolutionPair& rhs) const
|
|
|
|
{
|
|
|
|
double minLHS = osg::minimum(_resX,_resY);
|
|
|
|
double minRHS = osg::minimum(rhs._resX,rhs._resY);
|
|
|
|
return minLHS<minRHS;
|
|
|
|
}
|
|
|
|
|
|
|
|
double _resX;
|
|
|
|
double _resY;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::vector<ResolutionPair> ResolutionList;
|
2003-12-18 01:02:23 +08:00
|
|
|
|
2003-12-20 06:55:35 +08:00
|
|
|
void addRequiredResolution(double resX, double resY) { _requiredResolutions.push_back(ResolutionPair(resX,resY)); }
|
2003-12-18 01:02:23 +08:00
|
|
|
|
|
|
|
void setRequiredResolutions(ResolutionList& resolutions) { _requiredResolutions = resolutions; }
|
|
|
|
|
|
|
|
ResolutionList& getRequiredResolutions() { return _requiredResolutions; }
|
|
|
|
|
|
|
|
const ResolutionList& getRequiredResolutions() const { return _requiredResolutions; }
|
2003-12-20 06:55:35 +08:00
|
|
|
|
|
|
|
void consolodateRequiredResolutions();
|
2003-11-25 19:40:10 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
|
|
Type _type;
|
|
|
|
|
|
|
|
double _sortValue;
|
|
|
|
|
|
|
|
std::string _filename;
|
|
|
|
bool _temporaryFile;
|
|
|
|
|
|
|
|
ParameterPolicy _coordinateSystemPolicy;
|
|
|
|
ParameterPolicy _geoTransformPolicy;
|
2004-06-17 22:39:16 +08:00
|
|
|
|
|
|
|
unsigned int _minLevel;
|
|
|
|
unsigned int _maxLevel;
|
2005-03-08 06:02:44 +08:00
|
|
|
unsigned int _layer;
|
2003-11-25 19:40:10 +08:00
|
|
|
|
|
|
|
osg::ref_ptr<SourceData> _sourceData;
|
2003-12-18 01:02:23 +08:00
|
|
|
|
|
|
|
ResolutionList _requiredResolutions;
|
2005-12-07 23:26:45 +08:00
|
|
|
|
2005-12-08 18:03:39 +08:00
|
|
|
GDALDataset* _gdalDataset;
|
|
|
|
};
|
2003-11-25 19:40:10 +08:00
|
|
|
|
|
|
|
enum CompositeType
|
|
|
|
{
|
|
|
|
GROUP,
|
2004-01-16 05:07:34 +08:00
|
|
|
LOD,
|
|
|
|
PAGED_LOD
|
2003-11-25 19:40:10 +08:00
|
|
|
};
|
|
|
|
|
2005-05-15 02:57:47 +08:00
|
|
|
class OSGTERRAIN_EXPORT CompositeSource : public osg::Referenced, public SpatialProperties
|
2003-11-25 19:40:10 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2003-11-27 23:13:55 +08:00
|
|
|
CompositeSource(CompositeType type=GROUP):_type(type) {};
|
2003-11-25 19:40:10 +08:00
|
|
|
|
|
|
|
typedef std::vector< osg::ref_ptr<Source> > SourceList;
|
|
|
|
typedef std::vector< osg::ref_ptr< CompositeSource> > ChildList;
|
|
|
|
|
2003-11-27 23:13:55 +08:00
|
|
|
void setType(CompositeType type) { _type = type; }
|
|
|
|
CompositeType getType() const { return _type; }
|
2003-11-25 19:40:10 +08:00
|
|
|
|
|
|
|
void setSortValueFromSourceDataResolution();
|
|
|
|
|
2003-11-27 23:13:55 +08:00
|
|
|
void sort();
|
2003-11-25 19:40:10 +08:00
|
|
|
|
|
|
|
class iterator
|
|
|
|
{
|
|
|
|
public:
|
2003-11-27 23:13:55 +08:00
|
|
|
|
|
|
|
enum IteratorMode
|
|
|
|
{
|
|
|
|
ACTIVE,
|
|
|
|
ALL
|
|
|
|
};
|
2003-11-25 19:40:10 +08:00
|
|
|
|
|
|
|
|
2003-11-27 23:13:55 +08:00
|
|
|
iterator(CompositeSource* composite=0,IteratorMode mode=ALL):
|
|
|
|
_iteratorMode(mode)
|
2003-11-25 19:40:10 +08:00
|
|
|
{
|
|
|
|
if (composite)
|
|
|
|
{
|
|
|
|
_positionStack.push_back(IteratorPosition(composite));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
iterator(const iterator& rhs):
|
|
|
|
_positionStack(rhs._positionStack) {}
|
|
|
|
|
|
|
|
iterator& operator = (const iterator& rhs)
|
|
|
|
{
|
|
|
|
if (&rhs==this) return *this;
|
|
|
|
_positionStack = rhs._positionStack;
|
2004-10-26 03:16:57 +08:00
|
|
|
return *this;
|
2003-11-25 19:40:10 +08:00
|
|
|
}
|
|
|
|
|
2003-11-27 23:13:55 +08:00
|
|
|
bool operator == (const iterator& rhs) const
|
|
|
|
{
|
|
|
|
return _positionStack == rhs._positionStack;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator != (const iterator& rhs) const
|
|
|
|
{
|
|
|
|
return _positionStack != rhs._positionStack;
|
|
|
|
}
|
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
bool valid() const
|
|
|
|
{
|
|
|
|
return !_positionStack.empty() && _positionStack.back().valid();
|
|
|
|
}
|
|
|
|
|
2003-11-27 23:13:55 +08:00
|
|
|
CompositeSource& operator *()
|
2003-11-25 19:40:10 +08:00
|
|
|
{
|
2003-11-27 23:13:55 +08:00
|
|
|
return *(valid()?_positionStack.back().current():0);
|
2003-11-25 19:40:10 +08:00
|
|
|
}
|
|
|
|
|
2003-11-27 23:13:55 +08:00
|
|
|
CompositeSource* operator ->()
|
2003-11-25 19:40:10 +08:00
|
|
|
{
|
2003-11-27 23:13:55 +08:00
|
|
|
return valid()?_positionStack.back().current():0;
|
2003-11-25 19:40:10 +08:00
|
|
|
}
|
|
|
|
|
2003-11-27 23:13:55 +08:00
|
|
|
const CompositeSource& operator *() const
|
|
|
|
{
|
|
|
|
return *(valid()?_positionStack.back().current():0);
|
|
|
|
}
|
|
|
|
|
|
|
|
const CompositeSource* operator ->() const
|
|
|
|
{
|
|
|
|
return valid()?_positionStack.back().current():0;
|
|
|
|
}
|
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
iterator& operator++()
|
|
|
|
{
|
|
|
|
advance();
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
iterator operator++(int)
|
|
|
|
{
|
|
|
|
iterator tmp=*this;
|
|
|
|
advance();
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool advance()
|
|
|
|
{
|
|
|
|
if (_positionStack.empty()) return false;
|
|
|
|
|
|
|
|
// simple advance to the next source
|
|
|
|
if (_positionStack.back().advance())
|
|
|
|
{
|
2003-11-27 23:13:55 +08:00
|
|
|
if (_positionStack.back().current())
|
2003-11-25 19:40:10 +08:00
|
|
|
{
|
2003-11-27 23:13:55 +08:00
|
|
|
_positionStack.push_back(IteratorPosition(_positionStack.back().current()));
|
2003-11-25 19:40:10 +08:00
|
|
|
return advance();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_positionStack.pop_back();
|
|
|
|
return advance();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
struct IteratorPosition
|
|
|
|
{
|
|
|
|
|
|
|
|
IteratorPosition(CompositeSource* composite):
|
|
|
|
_composite(composite),
|
|
|
|
_index(-1) {}
|
|
|
|
|
|
|
|
IteratorPosition(const IteratorPosition& rhs):
|
|
|
|
_composite(rhs._composite),
|
|
|
|
_index(rhs._index) {}
|
|
|
|
|
|
|
|
IteratorPosition& operator = (const IteratorPosition& rhs)
|
|
|
|
{
|
|
|
|
_composite = rhs._composite;
|
|
|
|
_index = rhs._index;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2003-11-27 23:13:55 +08:00
|
|
|
bool operator == (const IteratorPosition& rhs) const
|
|
|
|
{
|
|
|
|
return _composite == rhs._composite && _index == rhs._index;
|
|
|
|
}
|
2003-11-25 19:40:10 +08:00
|
|
|
|
2003-11-27 23:13:55 +08:00
|
|
|
bool operator != (const IteratorPosition& rhs) const
|
|
|
|
{
|
|
|
|
return _composite != rhs._composite || _index != rhs._index;
|
|
|
|
}
|
|
|
|
|
|
|
|
CompositeSource* current()
|
2003-11-25 19:40:10 +08:00
|
|
|
{
|
2003-11-27 23:13:55 +08:00
|
|
|
if (_index==-1) return _composite;
|
|
|
|
else return (_index>=0 && _index < (int)_composite->_children.size())?_composite->_children[_index].get():0;
|
2003-11-25 19:40:10 +08:00
|
|
|
}
|
|
|
|
|
2003-11-27 23:13:55 +08:00
|
|
|
const CompositeSource* current() const
|
2003-11-25 19:40:10 +08:00
|
|
|
{
|
2003-11-27 23:13:55 +08:00
|
|
|
if (_index==-1) return _composite;
|
|
|
|
else return (_index>=0 && _index < (int)_composite->_children.size())?_composite->_children[_index].get():0;
|
2003-11-25 19:40:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool valid() const
|
|
|
|
{
|
|
|
|
return _composite &&
|
2003-11-27 23:13:55 +08:00
|
|
|
_index < (int)_composite->_children.size();
|
2003-11-25 19:40:10 +08:00
|
|
|
}
|
|
|
|
|
2003-11-27 23:13:55 +08:00
|
|
|
inline bool advance()
|
2003-11-25 19:40:10 +08:00
|
|
|
{
|
2003-11-27 23:13:55 +08:00
|
|
|
return advanceToNextChild(*_composite,_index);
|
|
|
|
}
|
|
|
|
|
2004-08-03 19:01:39 +08:00
|
|
|
inline bool isActive(const CompositeSource& /*composite*/,int /*index*/)
|
2003-11-27 23:13:55 +08:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool advanceToNextChild(CompositeSource& composite, int& index)
|
|
|
|
{
|
|
|
|
++index;
|
|
|
|
while (index<(int)composite._children.size())
|
2003-11-25 19:40:10 +08:00
|
|
|
{
|
2003-11-27 23:13:55 +08:00
|
|
|
if (isActive(composite,index)) return true;
|
|
|
|
++index;
|
2003-11-25 19:40:10 +08:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
CompositeSource* _composite;
|
|
|
|
int _index;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef std::vector<IteratorPosition> PositionStack;
|
2003-11-27 23:13:55 +08:00
|
|
|
IteratorMode _iteratorMode;
|
|
|
|
PositionStack _positionStack;
|
2003-11-25 19:40:10 +08:00
|
|
|
};
|
2003-11-27 23:13:55 +08:00
|
|
|
|
|
|
|
|
|
|
|
template<class T>
|
|
|
|
class base_source_iterator
|
|
|
|
{
|
|
|
|
public:
|
2003-11-25 19:40:10 +08:00
|
|
|
|
2003-11-27 23:13:55 +08:00
|
|
|
|
|
|
|
base_source_iterator(CompositeSource* composite=0, T advancer=T()):
|
|
|
|
_advancer(advancer),
|
|
|
|
_compositeIterator(composite),
|
|
|
|
_sourceIndex(-1)
|
|
|
|
{
|
|
|
|
advance();
|
|
|
|
}
|
|
|
|
|
|
|
|
base_source_iterator(const base_source_iterator& rhs):
|
|
|
|
_advancer(rhs._advancer),
|
|
|
|
_compositeIterator(rhs._compositeIterator),
|
|
|
|
_sourceIndex(rhs._sourceIndex) {}
|
|
|
|
|
|
|
|
base_source_iterator& operator = (const base_source_iterator& rhs)
|
|
|
|
{
|
|
|
|
if (&rhs==this) return *this;
|
|
|
|
_advancer = rhs._advancer;
|
|
|
|
_compositeIterator = rhs._compositeIterator;
|
|
|
|
_sourceIndex = rhs._sourceIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator == (const base_source_iterator& rhs) const
|
|
|
|
{
|
|
|
|
return _compositeIterator == rhs._compositeIterator &&
|
|
|
|
_sourceIndex == rhs._sourceIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator != (const base_source_iterator& rhs) const
|
|
|
|
{
|
|
|
|
return _compositeIterator != rhs._compositeIterator ||
|
|
|
|
_sourceIndex != rhs._sourceIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool valid() const
|
|
|
|
{
|
|
|
|
return _compositeIterator.valid() && _sourceIndex < (int)_compositeIterator->_sourceList.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
osg::ref_ptr<Source>& operator *()
|
|
|
|
{
|
|
|
|
return valid()?_compositeIterator->_sourceList[_sourceIndex]:_nullSource;
|
|
|
|
}
|
|
|
|
|
|
|
|
osg::ref_ptr<Source>* operator ->()
|
|
|
|
{
|
|
|
|
return &(valid()?_compositeIterator->_sourceList[_sourceIndex]:_nullSource);
|
|
|
|
}
|
|
|
|
|
|
|
|
base_source_iterator& operator++()
|
|
|
|
{
|
|
|
|
advance();
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
base_source_iterator operator++(int)
|
|
|
|
{
|
|
|
|
base_source_iterator tmp=*this;
|
|
|
|
advance();
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool advance()
|
|
|
|
{
|
|
|
|
if (!_compositeIterator.valid()) return false;
|
|
|
|
|
|
|
|
if (_advancer.advanceToNextSource(*_compositeIterator,_sourceIndex)) return true;
|
|
|
|
|
|
|
|
// at end of current CompositeSource, so need to advance to new one.
|
|
|
|
_sourceIndex = -1;
|
|
|
|
++_compositeIterator;
|
|
|
|
return advance();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2003-11-25 19:40:10 +08:00
|
|
|
|
2003-11-27 23:13:55 +08:00
|
|
|
T _advancer;
|
|
|
|
iterator _compositeIterator;
|
|
|
|
int _sourceIndex;
|
|
|
|
osg::ref_ptr<Source> _nullSource;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DefaultSourceAdvancer
|
|
|
|
{
|
|
|
|
DefaultSourceAdvancer() {}
|
|
|
|
|
2005-05-24 23:34:23 +08:00
|
|
|
bool isActive(const CompositeSource& /*composite*/,int /*index*/)
|
2003-11-27 23:13:55 +08:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool advanceToNextSource(const CompositeSource& composite, int& index)
|
|
|
|
{
|
|
|
|
return ++index<(int)composite._sourceList.size();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct LODSourceAdvancer
|
|
|
|
{
|
|
|
|
LODSourceAdvancer(float targetResolution=0.0f):
|
|
|
|
_targetResolution(targetResolution) {}
|
|
|
|
|
|
|
|
inline bool advanceToNextSource(const CompositeSource& composite, int& index)
|
|
|
|
{
|
|
|
|
if (composite.getType()==GROUP)
|
|
|
|
{
|
|
|
|
return (++index<(int)composite._sourceList.size());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (composite._sourceList.empty()) return false;
|
|
|
|
if (index!=-1) return false; // we've already traversed this composite, only ever one valid LOD.
|
|
|
|
|
|
|
|
// find source with resolution closest to target
|
|
|
|
int foundIndex = 0;
|
|
|
|
float closestResolution = fabsf(composite._sourceList[0]->getSortValue()-_targetResolution);
|
|
|
|
for(int i=1;i<(int)composite._sourceList.size();++i)
|
|
|
|
{
|
|
|
|
float delta = fabsf(composite._sourceList[i]->getSortValue()-_targetResolution);
|
|
|
|
if (delta<closestResolution)
|
|
|
|
{
|
|
|
|
foundIndex = i;
|
|
|
|
closestResolution = delta;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (foundIndex==index) return false;
|
|
|
|
index = foundIndex;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
float _targetResolution;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef base_source_iterator<DefaultSourceAdvancer> source_iterator;
|
|
|
|
typedef base_source_iterator<LODSourceAdvancer> source_lod_iterator;
|
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
CompositeType _type;
|
|
|
|
SourceList _sourceList;
|
|
|
|
ChildList _children;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-05-15 02:57:47 +08:00
|
|
|
class OSGTERRAIN_EXPORT DestinationTile : public osg::Referenced, public SpatialProperties
|
2003-11-25 19:40:10 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
|
|
enum Position
|
|
|
|
{
|
|
|
|
LEFT = 0,
|
|
|
|
LEFT_BELOW = 1,
|
|
|
|
BELOW = 2,
|
|
|
|
BELOW_RIGHT = 3,
|
|
|
|
RIGHT = 4,
|
|
|
|
RIGHT_ABOVE = 5,
|
|
|
|
ABOVE = 6,
|
|
|
|
ABOVE_LEFT = 7,
|
|
|
|
NUMBER_OF_POSITIONS = 8
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
DestinationTile();
|
2004-01-19 05:59:20 +08:00
|
|
|
|
|
|
|
void computeNeighboursFromQuadMap();
|
2003-11-25 19:40:10 +08:00
|
|
|
|
|
|
|
void setNeighbours(DestinationTile* left, DestinationTile* left_below,
|
|
|
|
DestinationTile* below, DestinationTile* below_right,
|
|
|
|
DestinationTile* right, DestinationTile* right_above,
|
|
|
|
DestinationTile* above, DestinationTile* above_left);
|
|
|
|
|
|
|
|
void checkNeighbouringTiles();
|
|
|
|
|
|
|
|
void setMaximumImagerySize(unsigned int maxNumColumns,unsigned int maxNumRows)
|
|
|
|
{
|
|
|
|
_imagery_maxNumColumns = maxNumColumns;
|
|
|
|
_imagery_maxNumRows = maxNumRows;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setMaximumTerrainSize(unsigned int maxNumColumns,unsigned int maxNumRows)
|
|
|
|
{
|
|
|
|
_terrain_maxNumColumns = maxNumColumns;
|
|
|
|
_terrain_maxNumRows = maxNumRows;
|
|
|
|
}
|
|
|
|
|
|
|
|
void computeMaximumSourceResolution(CompositeSource* sourceGraph);
|
|
|
|
|
2005-03-09 00:51:48 +08:00
|
|
|
bool computeImageResolution(unsigned int layer, unsigned int& numColumns, unsigned int& numRows, double& resX, double& resY);
|
2004-01-13 06:03:29 +08:00
|
|
|
bool computeTerrainResolution(unsigned int& numColumns, unsigned int& numRows, double& resX, double& resY);
|
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
void allocate();
|
|
|
|
|
2003-12-18 01:02:23 +08:00
|
|
|
void addRequiredResolutions(CompositeSource* sourceGraph);
|
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
void readFrom(CompositeSource* sourceGraph);
|
2005-07-02 16:11:55 +08:00
|
|
|
|
|
|
|
void allocateEdgeNormals();
|
2003-11-25 19:40:10 +08:00
|
|
|
|
|
|
|
void equalizeCorner(Position position);
|
|
|
|
void equalizeEdge(Position position);
|
|
|
|
|
|
|
|
void equalizeBoundaries();
|
2004-03-17 00:54:08 +08:00
|
|
|
|
2004-03-31 05:13:08 +08:00
|
|
|
void setTileComplete(bool complete);
|
2004-03-17 00:54:08 +08:00
|
|
|
bool getTileComplete() const { return _complete; }
|
2003-11-25 19:40:10 +08:00
|
|
|
|
2004-02-04 00:51:44 +08:00
|
|
|
void optimizeResolution();
|
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
osg::Node* createScene();
|
2004-03-17 00:54:08 +08:00
|
|
|
|
2004-04-04 23:33:26 +08:00
|
|
|
osg::StateSet* createStateSet();
|
|
|
|
osg::Node* createHeightField();
|
|
|
|
osg::Node* createPolygonal();
|
2004-03-29 18:45:58 +08:00
|
|
|
|
2004-03-31 17:20:46 +08:00
|
|
|
void unrefData();
|
2003-11-25 19:40:10 +08:00
|
|
|
|
|
|
|
|
2004-01-19 05:59:20 +08:00
|
|
|
DataSet* _dataSet;
|
2004-03-17 00:54:08 +08:00
|
|
|
std::string _name;
|
|
|
|
unsigned int _level;
|
|
|
|
unsigned int _tileX;
|
|
|
|
unsigned int _tileY;
|
2005-05-02 21:00:17 +08:00
|
|
|
GLenum _pixelFormat;
|
2004-01-19 05:59:20 +08:00
|
|
|
|
2005-03-09 00:51:48 +08:00
|
|
|
struct ImageData
|
|
|
|
{
|
|
|
|
ImageData():
|
|
|
|
_imagery_maxSourceResolutionX(0.0f),
|
|
|
|
_imagery_maxSourceResolutionY(0.0f) {}
|
|
|
|
|
|
|
|
|
|
|
|
float _imagery_maxSourceResolutionX;
|
|
|
|
float _imagery_maxSourceResolutionY;
|
|
|
|
|
|
|
|
osg::ref_ptr<DestinationData> _imagery;
|
|
|
|
};
|
|
|
|
|
|
|
|
std::vector<ImageData> _imagery;
|
|
|
|
|
|
|
|
inline ImageData& getImageData(unsigned int layer)
|
|
|
|
{
|
|
|
|
if (layer>=_imagery.size()) _imagery.resize(layer+1);
|
|
|
|
return _imagery[layer];
|
|
|
|
}
|
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
osg::ref_ptr<DestinationData> _terrain;
|
|
|
|
osg::ref_ptr<DestinationData> _models;
|
|
|
|
|
2004-03-31 05:13:08 +08:00
|
|
|
DestinationTile* _neighbour[NUMBER_OF_POSITIONS];
|
|
|
|
bool _equalized[NUMBER_OF_POSITIONS];
|
2003-11-25 19:40:10 +08:00
|
|
|
|
|
|
|
|
2004-06-30 22:37:06 +08:00
|
|
|
unsigned int _maxSourceLevel;
|
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
unsigned int _imagery_maxNumColumns;
|
|
|
|
unsigned int _imagery_maxNumRows;
|
2005-03-09 00:51:48 +08:00
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
unsigned int _terrain_maxNumColumns;
|
|
|
|
unsigned int _terrain_maxNumRows;
|
|
|
|
float _terrain_maxSourceResolutionX;
|
|
|
|
float _terrain_maxSourceResolutionY;
|
2004-01-16 05:07:34 +08:00
|
|
|
|
2004-03-17 00:54:08 +08:00
|
|
|
bool _complete;
|
2005-07-02 16:11:55 +08:00
|
|
|
|
|
|
|
typedef std::vector<osg::Vec2> HeightDeltaList;
|
|
|
|
HeightDeltaList _heightDeltas[NUMBER_OF_POSITIONS];
|
2003-11-25 19:40:10 +08:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2005-05-15 02:57:47 +08:00
|
|
|
class OSGTERRAIN_EXPORT CompositeDestination : public osg::Referenced, public SpatialProperties
|
2003-11-25 19:40:10 +08:00
|
|
|
{
|
2004-01-16 05:07:34 +08:00
|
|
|
public:
|
|
|
|
|
|
|
|
CompositeDestination():
|
2004-03-17 00:54:08 +08:00
|
|
|
_dataSet(0),
|
|
|
|
_parent(0),
|
|
|
|
_level(0),
|
|
|
|
_tileX(0),
|
|
|
|
_tileY(0),
|
2004-01-16 05:07:34 +08:00
|
|
|
_type(GROUP),
|
2004-03-17 00:54:08 +08:00
|
|
|
_maxVisibleDistance(FLT_MAX),
|
|
|
|
_subTileGenerated(false) {}
|
2004-01-16 05:07:34 +08:00
|
|
|
|
2006-05-15 21:12:55 +08:00
|
|
|
CompositeDestination(osg::CoordinateSystemNode* cs, const GeospatialExtents& extents):
|
2004-01-16 05:07:34 +08:00
|
|
|
SpatialProperties(cs,extents),
|
2004-03-17 00:54:08 +08:00
|
|
|
_dataSet(0),
|
|
|
|
_parent(0),
|
|
|
|
_level(0),
|
|
|
|
_tileX(0),
|
|
|
|
_tileY(0),
|
2004-01-16 05:07:34 +08:00
|
|
|
_type(GROUP),
|
2004-03-17 00:54:08 +08:00
|
|
|
_maxVisibleDistance(FLT_MAX),
|
|
|
|
_subTileGenerated(false) {}
|
2004-01-16 05:07:34 +08:00
|
|
|
|
2004-01-19 05:59:20 +08:00
|
|
|
void computeNeighboursFromQuadMap();
|
|
|
|
|
2003-12-18 01:02:23 +08:00
|
|
|
void addRequiredResolutions(CompositeSource* sourceGraph);
|
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
void readFrom(CompositeSource* sourceGraph);
|
|
|
|
|
|
|
|
void equalizeBoundaries();
|
|
|
|
|
|
|
|
osg::Node* createScene();
|
2004-03-17 00:54:08 +08:00
|
|
|
|
|
|
|
bool areSubTilesComplete();
|
|
|
|
std::string getSubTileName();
|
|
|
|
osg::Node* createPagedLODScene();
|
|
|
|
osg::Node* createSubTileScene();
|
|
|
|
|
2004-03-31 17:20:46 +08:00
|
|
|
void unrefSubTileData();
|
|
|
|
void unrefLocalData();
|
|
|
|
|
2004-03-17 00:54:08 +08:00
|
|
|
void setSubTilesGenerated(bool generated) { _subTileGenerated=generated; }
|
|
|
|
bool getSubTilesGenerated() const { return _subTileGenerated; }
|
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
|
|
|
|
typedef std::vector< osg::ref_ptr<DestinationTile> > TileList;
|
|
|
|
typedef std::vector< osg::ref_ptr<CompositeDestination> > ChildList;
|
|
|
|
|
2004-03-17 00:54:08 +08:00
|
|
|
DataSet* _dataSet;
|
|
|
|
CompositeDestination* _parent;
|
|
|
|
std::string _name;
|
|
|
|
unsigned int _level;
|
|
|
|
unsigned int _tileX;
|
|
|
|
unsigned int _tileY;
|
|
|
|
CompositeType _type;
|
|
|
|
TileList _tiles;
|
|
|
|
ChildList _children;
|
|
|
|
float _maxVisibleDistance;
|
|
|
|
bool _subTileGenerated;
|
2004-01-16 05:07:34 +08:00
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
};
|
|
|
|
|
2004-01-19 05:59:20 +08:00
|
|
|
|
2004-03-17 00:54:08 +08:00
|
|
|
typedef std::map<unsigned int,CompositeDestination*> Row;
|
2004-03-15 23:47:22 +08:00
|
|
|
typedef std::map<unsigned int,Row> Level;
|
2004-01-19 05:59:20 +08:00
|
|
|
typedef std::map<unsigned int,Level> QuadMap;
|
|
|
|
|
2004-03-17 00:54:08 +08:00
|
|
|
void insertTileToQuadMap(CompositeDestination* tile)
|
2004-01-19 05:59:20 +08:00
|
|
|
{
|
2004-03-15 23:47:22 +08:00
|
|
|
_quadMap[tile->_level][tile->_tileY][tile->_tileX] = tile;
|
2004-01-19 05:59:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
DestinationTile* getTile(unsigned int level,unsigned int X, unsigned int Y)
|
2004-03-17 00:54:08 +08:00
|
|
|
{
|
|
|
|
CompositeDestination* cd = getComposite(level,X,Y);
|
|
|
|
if (!cd) return 0;
|
|
|
|
if (cd->_tiles.empty()) return 0;
|
|
|
|
return (cd->_tiles).front().get();
|
|
|
|
}
|
|
|
|
|
|
|
|
CompositeDestination* getComposite(unsigned int level,unsigned int X, unsigned int Y)
|
2004-01-19 05:59:20 +08:00
|
|
|
{
|
|
|
|
QuadMap::iterator levelItr = _quadMap.find(level);
|
|
|
|
if (levelItr==_quadMap.end()) return 0;
|
|
|
|
|
2004-03-15 23:47:22 +08:00
|
|
|
Level::iterator rowItr = levelItr->second.find(Y);
|
|
|
|
if (rowItr==levelItr->second.end()) return 0;
|
2004-01-19 05:59:20 +08:00
|
|
|
|
2004-03-15 23:47:22 +08:00
|
|
|
Row::iterator columnItr = rowItr->second.find(X);
|
|
|
|
if (columnItr==rowItr->second.end()) return 0;
|
|
|
|
else return columnItr->second;
|
|
|
|
}
|
|
|
|
|
|
|
|
Row& getRow(unsigned int level,unsigned int Y)
|
|
|
|
{
|
|
|
|
return _quadMap[level][Y];
|
2004-01-19 05:59:20 +08:00
|
|
|
}
|
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
|
|
DataSet();
|
2004-03-15 23:47:22 +08:00
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
|
|
|
|
void addSource(Source* source);
|
|
|
|
void addSource(CompositeSource* composite);
|
|
|
|
|
|
|
|
void loadSources();
|
|
|
|
|
2004-07-19 17:03:50 +08:00
|
|
|
void setMaximumTileImageSize(unsigned int size) { _maximumTileImageSize = size; }
|
|
|
|
unsigned int getMaximumTileImageSize() const { return _maximumTileImageSize; }
|
|
|
|
|
|
|
|
void setMaximumTileTerrainSize(unsigned int size) { _maximumTileTerrainSize = size; }
|
|
|
|
unsigned int getMaximumTileTerrainSize() const { return _maximumTileTerrainSize; }
|
|
|
|
|
2004-05-06 18:59:08 +08:00
|
|
|
void setMaximumVisibleDistanceOfTopLevel(float d) { _maximumVisiableDistanceOfTopLevel = d; }
|
|
|
|
float getMaximumVisibleDistanceOfTopLevel() const { return _maximumVisiableDistanceOfTopLevel; }
|
|
|
|
|
2004-04-01 21:09:05 +08:00
|
|
|
void setRadiusToMaxVisibleDistanceRatio(float ratio) { _radiusToMaxVisibleDistanceRatio = ratio; }
|
|
|
|
float getRadiusToMaxVisibleDistanceRatio() const { return _radiusToMaxVisibleDistanceRatio; }
|
2005-11-18 01:44:48 +08:00
|
|
|
|
2004-03-15 23:47:22 +08:00
|
|
|
void setVerticalScale(float verticalScale) { _verticalScale = verticalScale; }
|
|
|
|
float getVerticalScale() const { return _verticalScale; }
|
|
|
|
|
2004-06-02 22:15:08 +08:00
|
|
|
void setSkirtRatio(float skirtRatio) { _skirtRatio = skirtRatio; }
|
|
|
|
float getSkirtRatio() const { return _skirtRatio; }
|
|
|
|
|
2004-03-15 23:47:22 +08:00
|
|
|
void setDefaultColor(const osg::Vec4& defaultColor) { _defaultColor = defaultColor; }
|
|
|
|
const osg::Vec4& getDefaultColor() const { return _defaultColor; }
|
|
|
|
|
2004-06-10 04:18:58 +08:00
|
|
|
void setDestinationCoordinateSystem(const std::string& wellKnownText) { setDestinationCoordinateSystem(new osg::CoordinateSystemNode("WKT",wellKnownText)); }
|
2004-04-30 06:22:22 +08:00
|
|
|
void setDestinationCoordinateSystem(osg::CoordinateSystemNode* cs) { _destinationCoordinateSystem = cs; }
|
|
|
|
osg::CoordinateSystemNode* getDestinationCoordinateSystem() { return _destinationCoordinateSystem .get(); }
|
2004-01-29 23:47:06 +08:00
|
|
|
|
2004-06-10 04:18:58 +08:00
|
|
|
void setIntermediateCoordinateSystem(const std::string& wellKnownText) { setIntermediateCoordinateSystem(new osg::CoordinateSystemNode("WKT",wellKnownText)); }
|
2004-04-30 06:22:22 +08:00
|
|
|
void setIntermediateCoordinateSystem(osg::CoordinateSystemNode* cs) { _intermediateCoordinateSystem = cs; }
|
|
|
|
osg::CoordinateSystemNode* getIntermediateCoordinateSystem() { return _intermediateCoordinateSystem.get(); }
|
2004-04-01 06:31:46 +08:00
|
|
|
|
|
|
|
void setConvertFromGeographicToGeocentric(bool flag) { _convertFromGeographicToGeocentric = flag; }
|
|
|
|
bool getConvertFromGeographicToGeocentric() const { return _convertFromGeographicToGeocentric; }
|
|
|
|
|
2004-04-30 06:22:22 +08:00
|
|
|
void setEllipsoidModel(osg::EllipsoidModel* et) { _ellipsoidModel = et; }
|
|
|
|
osg::EllipsoidModel* getEllipsoidModel() { return _ellipsoidModel.get(); }
|
2004-09-13 21:53:45 +08:00
|
|
|
const osg::EllipsoidModel* getEllipsoidModel() const { return _ellipsoidModel.get(); }
|
|
|
|
|
|
|
|
bool mapLatLongsToXYZ() const { return getConvertFromGeographicToGeocentric() && getEllipsoidModel(); }
|
2004-04-01 06:31:46 +08:00
|
|
|
|
2006-05-15 21:12:55 +08:00
|
|
|
void setDestinationExtents(const GeospatialExtents& extents) { _extents = extents; }
|
2004-01-29 23:47:06 +08:00
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
void setDestinationGeoTransform(const osg::Matrixd& geoTransform) { _geoTransform = geoTransform; }
|
2004-09-10 21:31:37 +08:00
|
|
|
|
2004-11-09 22:18:29 +08:00
|
|
|
/** Set the Archive name if one is to be used.*/
|
|
|
|
void setArchiveName(const std::string& filename) { _archiveName = filename; }
|
|
|
|
|
|
|
|
/** Get the Archive name.*/
|
|
|
|
const std::string& getArchiveName() const { return _archiveName; }
|
|
|
|
|
|
|
|
/** Set the Archive.*/
|
|
|
|
void setArchive(osgDB::Archive* archive) { _archive = archive; }
|
|
|
|
|
|
|
|
/** Get the Archive if one is to being used.*/
|
|
|
|
osgDB::Archive* getArchive() { return _archive.get(); }
|
|
|
|
|
2005-10-27 18:48:44 +08:00
|
|
|
/** Set the Directory, DestinationTileBaseName and DestinationTileExtension from the passed in filename.*/
|
2004-09-10 21:31:37 +08:00
|
|
|
void setDestinationName(const std::string& filename);
|
|
|
|
|
2005-10-27 18:48:44 +08:00
|
|
|
void setDirectory(const std::string& directory);
|
|
|
|
const std::string& getDirectory() const { return _directory; }
|
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
void setDestinationTileBaseName(const std::string& basename) { _tileBasename = basename; }
|
2004-03-17 00:54:08 +08:00
|
|
|
const std::string& getDestinationTileBaseName() const { return _tileBasename; }
|
|
|
|
|
2004-03-15 23:47:22 +08:00
|
|
|
void setDestinationTileExtension(const std::string& extension) { _tileExtension = extension; }
|
2004-03-17 00:54:08 +08:00
|
|
|
const std::string& getDestinationTileExtension() const { return _tileExtension; }
|
2005-09-04 14:36:52 +08:00
|
|
|
|
|
|
|
void setDestinationImageExtension(const std::string& extension) { _imageExtension = extension; }
|
|
|
|
const std::string& getDestinationImageExtension() const { return _imageExtension; }
|
2003-11-25 19:40:10 +08:00
|
|
|
|
2004-03-15 23:47:22 +08:00
|
|
|
enum DatabaseType
|
|
|
|
{
|
|
|
|
LOD_DATABASE,
|
|
|
|
PagedLOD_DATABASE,
|
|
|
|
};
|
|
|
|
|
|
|
|
void setDatabaseType(DatabaseType type) { _databaseType = type; }
|
|
|
|
DatabaseType getDatabaseType() const { return _databaseType; }
|
|
|
|
|
2004-03-21 20:17:44 +08:00
|
|
|
enum GeometryType
|
|
|
|
{
|
|
|
|
HEIGHT_FIELD,
|
|
|
|
POLYGONAL,
|
|
|
|
};
|
|
|
|
void setGeometryType(GeometryType type) { _geometryType = type; }
|
|
|
|
GeometryType getGeometryType() const { return _geometryType; }
|
|
|
|
|
|
|
|
enum TextureType
|
|
|
|
{
|
2005-05-02 22:16:25 +08:00
|
|
|
RGB_24,
|
|
|
|
RGBA,
|
|
|
|
RGB_16,
|
|
|
|
RGBA_16,
|
|
|
|
COMPRESSED_TEXTURE,
|
|
|
|
COMPRESSED_RGBA_TEXTURE
|
2004-03-21 20:17:44 +08:00
|
|
|
};
|
|
|
|
void setTextureType(TextureType type) { _textureType = type; }
|
|
|
|
TextureType getTextureType() const { return _textureType; }
|
|
|
|
|
2004-06-08 21:58:36 +08:00
|
|
|
void setMaxAnisotropy(float d) { _maxAnisotropy = d; }
|
|
|
|
float getMaxAnisotropy() const { return _maxAnisotropy; }
|
|
|
|
|
|
|
|
|
|
|
|
enum MipMappingMode
|
|
|
|
{
|
|
|
|
NO_MIP_MAPPING, /// disable mip mapping - use LINEAR, LINEAR filters.
|
|
|
|
MIP_MAPPING_HARDWARE, /// use mip mapping, dynamically compute them in hardware if supported
|
|
|
|
MIP_MAPPING_IMAGERY /// use mip mapping, and store imagery along with associated mip maps.
|
|
|
|
};
|
|
|
|
|
|
|
|
void setMipMappingMode(MipMappingMode mipMappingMode) { _mipMappingMode = mipMappingMode; }
|
|
|
|
MipMappingMode getMipMappingMode() const { return _mipMappingMode; }
|
|
|
|
|
|
|
|
|
2004-04-04 23:33:26 +08:00
|
|
|
void setUseLocalTileTransform(bool flag) { _useLocalTileTransform = flag; }
|
|
|
|
bool getUseLocalTileTransform() const { return _useLocalTileTransform; }
|
|
|
|
|
2005-12-16 00:30:31 +08:00
|
|
|
void setSimplifyTerrain(bool flag) { _simplifyTerrain = flag; }
|
|
|
|
bool getSimplifyTerrain() const { return _simplifyTerrain; }
|
|
|
|
|
2004-06-08 21:58:36 +08:00
|
|
|
|
2004-05-03 05:50:15 +08:00
|
|
|
void setDecorateGeneratedSceneGraphWithCoordinateSystemNode(bool flag) { _decorateWithCoordinateSystemNode = flag; }
|
|
|
|
bool getDecorateGeneratedSceneGraphWithCoordinateSystemNode() const { return _decorateWithCoordinateSystemNode; }
|
2004-07-19 17:03:50 +08:00
|
|
|
|
|
|
|
|
2005-03-10 00:54:10 +08:00
|
|
|
void setDecorateGeneratedSceneGraphWithMultiTextureControl(bool flag) { _decorateWithMultiTextureControl = flag; }
|
|
|
|
bool getDecorateGeneratedSceneGraphWithMultiTextureControl() const { return _decorateWithMultiTextureControl; }
|
|
|
|
|
|
|
|
unsigned int getNumOfTextureLevels() const { return _numTextureLevels; }
|
|
|
|
|
2004-07-19 17:03:50 +08:00
|
|
|
void setCommentString(const std::string& comment) { _comment = comment; }
|
|
|
|
const std::string& getCommentString() const { return _comment; }
|
2004-04-04 23:33:26 +08:00
|
|
|
|
2004-03-21 20:17:44 +08:00
|
|
|
|
2004-10-05 23:08:54 +08:00
|
|
|
void setWriteNodeBeforeSimplification(bool flag) { _writeNodeBeforeSimplification = flag; }
|
|
|
|
bool getWriteNodeBeforeSimplification() const { return _writeNodeBeforeSimplification; }
|
|
|
|
|
|
|
|
|
|
|
|
static void setNotifyOffset(int level);
|
2006-07-11 18:34:41 +08:00
|
|
|
static int getNotifyOffset();
|
2004-10-05 23:08:54 +08:00
|
|
|
|
|
|
|
|
2004-04-04 23:33:26 +08:00
|
|
|
CompositeDestination* createDestinationGraph(CompositeDestination* parent,
|
2004-04-30 06:22:22 +08:00
|
|
|
osg::CoordinateSystemNode* cs,
|
2006-05-15 21:12:55 +08:00
|
|
|
const GeospatialExtents& extents,
|
2004-04-04 23:33:26 +08:00
|
|
|
unsigned int maxImageSize,
|
|
|
|
unsigned int maxTerrainSize,
|
|
|
|
unsigned int currentLevel,
|
|
|
|
unsigned int currentX,
|
|
|
|
unsigned int currentY,
|
|
|
|
unsigned int maxNumLevels);
|
|
|
|
|
|
|
|
|
|
|
|
void computeDestinationGraphFromSources(unsigned int numLevels);
|
|
|
|
void updateSourcesForDestinationGraphNeeds();
|
|
|
|
void populateDestinationGraphFromSources();
|
|
|
|
|
|
|
|
void createDestination(unsigned int numLevels);
|
2003-11-25 19:40:10 +08:00
|
|
|
|
2004-09-10 21:31:37 +08:00
|
|
|
void buildDestination() { _buildDestination(false); }
|
|
|
|
|
|
|
|
void writeDestination() { _buildDestination(true); }
|
2004-04-04 23:33:26 +08:00
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
osg::Node* getDestinationRootNode() { return _rootNode.get(); }
|
|
|
|
|
2004-11-09 22:18:29 +08:00
|
|
|
// helper functions for handling optional archive
|
|
|
|
void _writeNodeFile(const osg::Node& node,const std::string& filename);
|
|
|
|
void _writeImageFile(const osg::Image& image,const std::string& filename);
|
2005-03-10 00:54:10 +08:00
|
|
|
|
2005-11-10 04:24:47 +08:00
|
|
|
void setState(osg::State* state) { _state = state; }
|
|
|
|
osg::State* getState() { return _state.get(); }
|
2003-11-25 19:40:10 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual ~DataSet() {}
|
2004-09-13 21:53:45 +08:00
|
|
|
|
|
|
|
|
2004-11-09 22:18:29 +08:00
|
|
|
|
2004-03-17 00:54:08 +08:00
|
|
|
void _readRow(Row& row);
|
|
|
|
void _equalizeRow(Row& row);
|
|
|
|
void _writeRow(Row& row);
|
2004-09-10 21:31:37 +08:00
|
|
|
void _buildDestination(bool writeToDisk);
|
2004-05-03 05:50:15 +08:00
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
void init();
|
|
|
|
|
2004-09-10 21:31:37 +08:00
|
|
|
osg::Node* decorateWithCoordinateSystemNode(osg::Node* subgraph);
|
2005-03-10 00:54:10 +08:00
|
|
|
osg::Node* decorateWithMultiTextureControl(osg::Node* subgraph);
|
2004-09-10 21:31:37 +08:00
|
|
|
|
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
osg::ref_ptr<CompositeSource> _sourceGraph;
|
|
|
|
|
|
|
|
osg::ref_ptr<CompositeDestination> _destinationGraph;
|
2004-01-19 05:59:20 +08:00
|
|
|
|
|
|
|
QuadMap _quadMap;
|
2003-11-25 19:40:10 +08:00
|
|
|
|
2004-04-01 21:09:05 +08:00
|
|
|
|
2004-07-19 17:03:50 +08:00
|
|
|
|
|
|
|
unsigned int _maximumTileImageSize;
|
|
|
|
unsigned int _maximumTileTerrainSize;
|
2004-05-06 18:59:08 +08:00
|
|
|
float _maximumVisiableDistanceOfTopLevel;
|
2005-11-18 01:44:48 +08:00
|
|
|
float _radiusToMaxVisibleDistanceRatio;
|
2004-03-12 00:14:25 +08:00
|
|
|
float _verticalScale;
|
2004-06-02 22:15:08 +08:00
|
|
|
float _skirtRatio;
|
2004-03-12 00:14:25 +08:00
|
|
|
|
2004-05-03 05:50:15 +08:00
|
|
|
osg::ref_ptr<osg::CoordinateSystemNode> _destinationCoordinateSystem;
|
|
|
|
osg::ref_ptr<osg::CoordinateSystemNode> _intermediateCoordinateSystem;
|
2004-04-01 06:31:46 +08:00
|
|
|
|
|
|
|
bool _convertFromGeographicToGeocentric;
|
2004-04-30 06:22:22 +08:00
|
|
|
osg::ref_ptr<osg::EllipsoidModel> _ellipsoidModel;
|
2004-04-01 06:31:46 +08:00
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
osg::Matrixd _geoTransform;
|
2006-05-15 21:12:55 +08:00
|
|
|
GeospatialExtents _extents;
|
2004-11-09 22:18:29 +08:00
|
|
|
std::string _archiveName;
|
|
|
|
osg::ref_ptr<osgDB::Archive> _archive;
|
2005-10-27 18:48:44 +08:00
|
|
|
std::string _directory;
|
2003-11-25 19:40:10 +08:00
|
|
|
std::string _tileBasename;
|
|
|
|
std::string _tileExtension;
|
2005-09-04 14:36:52 +08:00
|
|
|
std::string _imageExtension;
|
2004-03-15 23:47:22 +08:00
|
|
|
osg::Vec4 _defaultColor;
|
|
|
|
DatabaseType _databaseType;
|
2004-03-21 20:17:44 +08:00
|
|
|
GeometryType _geometryType;
|
|
|
|
TextureType _textureType;
|
2004-06-08 21:58:36 +08:00
|
|
|
float _maxAnisotropy;
|
|
|
|
MipMappingMode _mipMappingMode;
|
2005-03-10 00:54:10 +08:00
|
|
|
|
|
|
|
unsigned int _numTextureLevels;
|
2004-06-08 21:58:36 +08:00
|
|
|
|
2004-04-04 23:33:26 +08:00
|
|
|
bool _useLocalTileTransform;
|
2004-05-03 05:50:15 +08:00
|
|
|
|
|
|
|
bool _decorateWithCoordinateSystemNode;
|
2005-03-10 00:54:10 +08:00
|
|
|
bool _decorateWithMultiTextureControl;
|
2003-11-25 19:40:10 +08:00
|
|
|
|
2004-07-19 17:03:50 +08:00
|
|
|
std::string _comment;
|
2004-10-05 23:08:54 +08:00
|
|
|
|
|
|
|
bool _writeNodeBeforeSimplification;
|
2005-12-16 00:30:31 +08:00
|
|
|
|
|
|
|
bool _simplifyTerrain;
|
2004-10-05 23:08:54 +08:00
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
osg::ref_ptr<osg::Node> _rootNode;
|
2005-11-10 04:24:47 +08:00
|
|
|
osg::ref_ptr<osg::State> _state;
|
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2004-03-12 00:14:25 +08:00
|
|
|
}
|
|
|
|
|
2003-11-25 19:40:10 +08:00
|
|
|
#endif
|