TeDatum Class Reference

#include <TeDatum.h>


Detailed Description

Specifies planimetric TeDatum parameters to be used for defining geodetic coordinates, which are necessary to establish a map projection system. It encapsulates the following important information regarding a planimetric Datum such as:
Author:
Ubirajara Freitas, Julio d'Alge.
See also:
TeDatumFactory
Examples:

convertCoordinates.cpp, copyLayer.cpp, createLayer.cpp, createSTElementSetFromLayer.cpp, importShape.cpp, and spatialQuery.cpp.

Definition at line 54 of file TeDatum.h.


Public Member Functions

void flattening (const double flt)
 Sets the Earth equatorial radius (m) (m).
double flattening () const
 Returns the Earth equatorial radius (m) (m).
string getProj4Description ()
 Returns the Datum description in PROJ4 format.
string getWKTDescription ()
 Returns the Datum description in WKT format.
void name (const std::string &name)
 Sets the datum name.
std::string name () const
 Returns the datum name.
TeDatumoperator= (const TeDatum &rhs)
 Operator =.
bool operator== (const TeDatum &dat) const
 Verifies if current TeDatum is equal to TeDatum& dat.
void radius (const double rd)
 Sets Earth equatorial radius (m).
double radius () const
 Returns Earth equatorial radius (m).
 TeDatum (const TeDatum &other)
 Copy constructor.
 TeDatum (std::string name="Spherical", double rd=6.371000e+06, double flt=0., double dx=0., double dy=0., double dz=0.)
 Constructor.
double xShift () const
 Returns the shift along x axis (m).
double yShift () const
 Returns the shift along y axis (m).
double zShift () const
 Returns the shift along z axis (m).
 ~TeDatum ()
 Destructor.

Data Fields

double dx_
 TeDatum shift along x axis (m).
double dy_
 TeDatum shift along y axis (m).
double dz_
 TeDatum shift along z axis (m).

Private Attributes

double flt_
 Earth flattening.
std::string name_
 Planimetric TeDatum name.
double rd_
 Earth equatorial radius (m).

Constructor & Destructor Documentation

TeDatum::TeDatum ( std::string  name = "Spherical",
double  rd = 6.371000e+06,
double  flt = 0.,
double  dx = 0.,
double  dy = 0.,
double  dz = 0. 
) [inline]

Definition at line 66 of file TeDatum.h.

00067                                                                         :
00068         name_ ( name ),
00069         rd_   (  rd  ),
00070         flt_  ( flt  ),
00071         dx_   (  dx  ),
00072         dy_   (  dy  ),
00073         dz_   (  dz  )
00074         { }

TeDatum::TeDatum ( const TeDatum other  ) 

Definition at line 103 of file TeDatum.cpp.

References dx_, dy_, dz_, flt_, name_, and rd_.

00104 {
00105         name_ = other.name_;
00106         rd_ = other.rd_ ;
00107         flt_= other.flt_;
00108         dx_ = other.dx_;
00109         dy_= other.dy_;
00110         dz_ = other.dz_;
00111 }

TeDatum::~TeDatum (  )  [inline]

Definition at line 83 of file TeDatum.h.

00083 {}


Member Function Documentation

void TeDatum::flattening ( const double  flt  )  [inline]

Definition at line 106 of file TeDatum.h.

00107         { flt_ = flt; }

double TeDatum::flattening (  )  const [inline]

Definition at line 102 of file TeDatum.h.

Referenced by TeProjection::ChangeLL(), TeGTM::exportGTM(), findDatum(), TeDatabase::insertDatum(), TeSatelliteProjection::LL2PC(), TePolarStereographic::LL2PC(), TeAlbers::LL2PC(), TePolyconic::LL2PC(), TeLambertConformal::LL2PC(), TeMercator::LL2PC(), TeUtm::LL2PC(), TeDatumFactory::makeFromWKT(), TeSatelliteProjection::PC2LL(), TePolarStereographic::PC2LL(), TeAlbers::PC2LL(), TePolyconic::PC2LL(), TeLambertConformal::PC2LL(), TeMercator::PC2LL(), TeUtm::PC2LL(), TeDecoderTIFF::setGeoKeys(), TeGetDatumFromProj4(), and TeDatabase::updateDatum().

00103         { return flt_; }

string TeDatum::getProj4Description (  ) 

Definition at line 127 of file TeDatum.cpp.

References dx_, dy_, dz_, flt_, name_, rd_, and Te2String().

Referenced by TeGetSProjFromTeProjection().

00128 {
00129         //double shiftX, shiftY,shiftZ;
00130         //shiftX = shiftY = shiftZ = 0.0;
00131         
00132         double shiftX = dx_;
00133         double shiftY = dy_;
00134         double shiftZ = dz_;
00135 
00136         string datumProj4 = "";
00137         if (name_ == "WGS84")
00138         {
00139                 datumProj4 += " +ellps=WGS84";
00140                 return datumProj4;
00141         }
00142         else if (name_ == "Spherical")
00143         {
00144                 datumProj4 += " +R="  + Te2String(rd_,6);
00145         }
00146         else if (name_ == "SAD69")
00147         {
00148                 /*shiftX = -66.87;
00149                 shiftY = 4.37;
00150                 shiftZ = -38.52;*/
00151 
00152                 datumProj4 += " +ellps=GRS67";
00153         }
00154         else if (name_ == "CorregoAlegre")
00155         {
00156                 /*shiftX = -205.57;
00157                 shiftY = 168.77;
00158                 shiftZ = -4.12;*/
00159                 
00160                 datumProj4 += " +ellps=intl";
00161         }
00162         else
00163         {
00164                 datumProj4 += " +a="  + Te2String(rd_,6);
00165                 datumProj4 += " +f="  + Te2String(flt_,6);
00166         }
00167 
00168         if (shiftX != 0.0 && shiftY != 0.0 && shiftZ != 0.0)
00169                 datumProj4 += " +towgs84=" + Te2String(shiftX,4) + "," +  Te2String(shiftY,4)+ "," +  Te2String(shiftZ,4);
00170 
00171         return datumProj4;
00172 }

string TeDatum::getWKTDescription (  ) 

Definition at line 174 of file TeDatum.cpp.

References dx_, dy_, dz_, flt_, name(), name_, rd_, and Te2String().

Referenced by TeGetWKTFromTeProjection().

00175 {
00176         std::map<std::string, std::string> wktToTeDatum;
00177         wktToTeDatum["Astro-Chua"] = "Chua";
00178         wktToTeDatum["CorregoAlegre"] = "Corrego_Alegre";
00179         wktToTeDatum["Indian"] = "Indian_1975";
00180         wktToTeDatum["NAD27"] = "North_American_Datum_1927";
00181         wktToTeDatum["NAD83"] = "North_American_Datum_1983";
00182         wktToTeDatum["SAD69"] = "South_American_Datum_1969";
00183         wktToTeDatum["Spherical"] = "Unknown";
00184         wktToTeDatum["WGS84"] = "WGS_1984";
00185         wktToTeDatum["Aratu"] = "Aratu";
00186 
00187         std::string name = wktToTeDatum[name_];
00188         if(name.empty())
00189         {
00190                 name = name_;
00191         }
00192 
00193         string sph_epsgcode = "";
00194         string dtm_epsgcode = "";
00195         string spheroid = "";
00196         string crs_epsgcode = "";
00197         string datumWKT = "GEOGCS[\"" + name + "\"," + "DATUM[\"" + name + "\",SPHEROID[\"";
00198         if (name_ == "Astro-Chua")
00199         {
00200                 spheroid = "Hayford";
00201                 sph_epsgcode = "7022";
00202                 dtm_epsgcode = "6224";
00203                 crs_epsgcode = "4224";
00204         }
00205         else if (name_ == "CorregoAlegre")
00206         {
00207                 spheroid = "Hayford";
00208                 sph_epsgcode = "7022";
00209                 dtm_epsgcode = "6225";
00210                 crs_epsgcode = "4225";
00211         }
00212         else if (name_ == "Indian")
00213         {
00214                 spheroid = "Everest";
00215                 sph_epsgcode = "7015";
00216                 dtm_epsgcode = "6239";
00217                 crs_epsgcode = "4240";
00218         }
00219         else if (name_ == "NAD27")
00220         {
00221                 spheroid = "Clarke 1866";
00222                 sph_epsgcode = "7008";
00223                 dtm_epsgcode = "6609";
00224                 crs_epsgcode = "4267";
00225         }
00226         else if (name_ == "NAD83")
00227         {
00228                 spheroid = "GRS80";
00229                 sph_epsgcode = "7019";
00230                 dtm_epsgcode = "6326";
00231                 crs_epsgcode = "4269";
00232         }
00233         else if (name_ == "WGS84")
00234         {
00235                 spheroid = "GRS80";
00236                 sph_epsgcode = "7019";
00237                 dtm_epsgcode = "6326";
00238                 crs_epsgcode = "4326";
00239         }
00240         else if (name_ == "SAD69")
00241         {
00242                 spheroid = "UGGI67";
00243                 sph_epsgcode = "7036";
00244                 dtm_epsgcode = "6291";
00245                 crs_epsgcode = "4618";
00246         }
00247         else if (name_ == "Spherical")
00248         {
00249                 spheroid = "EarthRadius";
00250                 sph_epsgcode = "7035";
00251         }
00252         else
00253                 spheroid = "UserDefined";
00254         datumWKT += spheroid + "\"," + Te2String(rd_,6) + "," + Te2String(1.0/flt_,6);
00255         if (!sph_epsgcode.empty())
00256                 datumWKT +=",AUTHORITY[\"EPSG\"," + sph_epsgcode + "]";
00257         datumWKT += "]";
00258         
00259         /*double shiftX, shiftY, shiftZ;
00260         shiftX = shiftY = shiftZ = 0.0;
00261         if (name_ == "SAD69")
00262         {
00263                 shiftX = -66.87;
00264                 shiftY = 4.37;
00265                 shiftZ = -38.52;
00266         }
00267         else if (name_ == "CorregoAlegre")
00268         {
00269                 shiftX = -205.57;
00270                 shiftY = 168.77;
00271                 shiftZ = -4.12;
00272         }*/
00273         
00274         double shiftX = dx_;
00275         double shiftY = dy_;
00276         double shiftZ = dz_;
00277 
00278         if (shiftX != 0.0 && shiftY != 0.0 && shiftZ != 0.0)
00279                 datumWKT += ",TOWGS84[" + Te2String(shiftX,4) + "," + Te2String(shiftY,4) + "," + Te2String(shiftZ,4) + ",0.0,0.0,0.0,0.0]";
00280 
00281         if (!dtm_epsgcode.empty())
00282                 datumWKT += ",AUTHORITY[\"EPSG\"," + dtm_epsgcode + "]";
00283         datumWKT += "]";
00284         if (!crs_epsgcode.empty())
00285                 datumWKT += ",AUTHORITY[\"EPSG\"," + crs_epsgcode + "]";
00286         datumWKT += "]";
00287         return datumWKT;
00288 }

void TeDatum::name ( const std::string name  )  [inline]

Definition at line 90 of file TeDatum.h.

00091         {       name_ = name;   } 

std::string TeDatum::name (  )  const [inline]

Examples:
copyLayer.cpp, importGeoTab.cpp, importMIDMIF.cpp, and importShape.cpp.

Definition at line 86 of file TeDatum.h.

Referenced by TeRasterRemap::apply(), getWKTDescription(), TeDatabase::insertDatum(), TeSQLite::insertProjection(), TePostgreSQL::insertProjection(), TeOCIOracle::insertProjection(), TeMySQL::insertProjection(), TeFirebird::insertProjection(), TeOracle::insertProjection(), TeAdo::insertProjection(), TeDatabase::loadDatum(), TeDatabase::loadDatumSet(), main(), TeDatumFactory::makeFromWKT(), TeProjection::print(), TeGTM::setDatum(), TeDecoderTIFF::setGeoKeys(), TeCylindricalEquidistant::TeCylindricalEquidistant(), TeExportMIFProjection(), TeExportQuerierToSPRING(), TeGetDatumFromProj4(), TeLatLong::TeLatLong(), TeUtm::TeUtm(), TeDatabase::updateDatum(), TeFirebird::updateProjection(), TeDatabase::updateProjection(), TeRasterParams::writeParametersFile(), and TeSPRFile::writeProjection().

00087         { return name_;} 

TeDatum & TeDatum::operator= ( const TeDatum rhs  ) 

Definition at line 113 of file TeDatum.cpp.

References dx_, dy_, dz_, flt_, name_, and rd_.

00114 {
00115         if ( this != &rhs )
00116         {
00117                 name_ = rhs.name_;
00118                 rd_ = rhs.rd_;
00119                 flt_= rhs.flt_;
00120                 dx_ = rhs.dx_;
00121                 dy_= rhs.dy_;
00122                 dz_ = rhs.dz_;
00123         }
00124         return *this;
00125 }

bool TeDatum::operator== ( const TeDatum dat  )  const [inline]

Definition at line 123 of file TeDatum.h.

References dx_, dy_, dz_, flt_, rd_, and TeFPEquals().

00124         {
00125                 return (TeFPEquals(rd_,dat.rd_,0.0000000001) 
00126                            && TeFPEquals(flt_,dat.flt_,0.0000000001)
00127                            && TeFPEquals(dx_,dat.dx_,0.0000000001) 
00128                            && TeFPEquals(dy_,dat.dy_,0.0000000001) 
00129                            && TeFPEquals(dz_,dat.dz_,0.0000000001)); 
00130         }

void TeDatum::radius ( const double  rd  )  [inline]

Definition at line 98 of file TeDatum.h.

00099         { rd_ = rd; }

double TeDatum::radius (  )  const [inline]

Definition at line 94 of file TeDatum.h.

Referenced by TeProjection::ChangeLL(), TeGTM::exportGTM(), findDatum(), TeDatabase::insertDatum(), TeVirtualEarthMercator::LL2PC(), TeSatelliteProjection::LL2PC(), TePolarStereographic::LL2PC(), TeCylindricalEquidistant::LL2PC(), TeSinusoidal::LL2PC(), TeMiller::LL2PC(), TeAlbers::LL2PC(), TePolyconic::LL2PC(), TeLambertConformal::LL2PC(), TeMercator::LL2PC(), TeUtm::LL2PC(), TeDatumFactory::makeFromWKT(), TeVirtualEarthMercator::PC2LL(), TeSatelliteProjection::PC2LL(), TePolarStereographic::PC2LL(), TeCylindricalEquidistant::PC2LL(), TeSinusoidal::PC2LL(), TeMiller::PC2LL(), TeAlbers::PC2LL(), TePolyconic::PC2LL(), TeLambertConformal::PC2LL(), TeMercator::PC2LL(), TeUtm::PC2LL(), TeDecoderTIFF::setGeoKeys(), TeGetDatumFromProj4(), and TeDatabase::updateDatum().

00095         { return rd_; }

double TeDatum::xShift (  )  const [inline]

Definition at line 110 of file TeDatum.h.

Referenced by TeProjection::ChangeLL(), TeDatabase::insertDatum(), and TeDatabase::updateDatum().

00111         { return dx_; }

double TeDatum::yShift (  )  const [inline]

Definition at line 114 of file TeDatum.h.

Referenced by TeProjection::ChangeLL(), TeDatabase::insertDatum(), and TeDatabase::updateDatum().

00115         { return dy_; }

double TeDatum::zShift (  )  const [inline]

Definition at line 118 of file TeDatum.h.

Referenced by TeProjection::ChangeLL(), TeDatabase::insertDatum(), and TeDatabase::updateDatum().

00119         { return dz_; }


Field Documentation

double TeDatum::dx_

Definition at line 61 of file TeDatum.h.

Referenced by getProj4Description(), getWKTDescription(), TeDatumFactory::makeFromWKT(), operator=(), operator==(), TeDatum(), and TeGetDatumFromProj4().

double TeDatum::dy_

Definition at line 61 of file TeDatum.h.

Referenced by getProj4Description(), getWKTDescription(), TeDatumFactory::makeFromWKT(), operator=(), operator==(), TeDatum(), and TeGetDatumFromProj4().

double TeDatum::dz_

Definition at line 61 of file TeDatum.h.

Referenced by getProj4Description(), getWKTDescription(), TeDatumFactory::makeFromWKT(), operator=(), operator==(), TeDatum(), and TeGetDatumFromProj4().

double TeDatum::flt_ [private]

Definition at line 58 of file TeDatum.h.

Referenced by getProj4Description(), getWKTDescription(), operator=(), operator==(), and TeDatum().

std::string TeDatum::name_ [private]

Definition at line 57 of file TeDatum.h.

Referenced by getProj4Description(), getWKTDescription(), operator=(), and TeDatum().

double TeDatum::rd_ [private]

Definition at line 58 of file TeDatum.h.

Referenced by getProj4Description(), getWKTDescription(), operator=(), operator==(), and TeDatum().


The documentation for this class was generated from the following files:
Generated on Sun Jul 29 04:05:46 2012 for TerraLib - Development Source by  doxygen 1.5.3