DataWriterUtil.cc
Go to the documentation of this file.
1 /*
2  * DataWriterUtil.cc
3  *
4  * Created on: Sep 3, 2015
5  * Author: leven
6  */
7 #include "DataWriterUtil.h"
8 
9 using namespace RdAirplane::DataWriterUtil;
10 using namespace utl;
11 using namespace std;
12 using namespace boost;
13 
14 
15 
16 void RdAirplane::DataWriterUtil::writeCoordinatesToStream_cartesian(const Point* pPoint, CoordinateSystemPtr pCoordinateSystem, ofstream* pStream) {
17  (*pStream) << pPoint->GetX(pCoordinateSystem) << " "
18  << pPoint->GetY(pCoordinateSystem) << " "
19  << pPoint->GetZ(pCoordinateSystem) << " ";
20 }
21 
22 void RdAirplane::DataWriterUtil::writeVectorToStream_cartesian(const Vector* pVector, CoordinateSystemPtr pCoordinateSystem, ofstream* pStream) {
23  (*pStream) << pVector->GetX(pCoordinateSystem) << " "
24  << pVector->GetY(pCoordinateSystem) << " "
25  << pVector->GetZ(pCoordinateSystem) << " ";
26 }
27 
28 void RdAirplane::DataWriterUtil::writeCoordinatesToStream_spheric(const Point* pPoint, CoordinateSystemPtr pCoordinateSystem, ofstream* pStream) {
29  (*pStream) << pPoint->GetR(pCoordinateSystem) << " "
30  << pPoint->GetPhi(pCoordinateSystem) << " "
31  << pPoint->GetTheta(pCoordinateSystem) << " ";
32 }
33 
34 void RdAirplane::DataWriterUtil::writeCoordinatesToStream_geodetic(const Point* pPoint, ofstream* pStream) {
35  boost::tuple<double, double, double> utmPoint = UTMPoint(*pPoint, ReferenceEllipsoid::eWGS84).GetGeodeticCoordinates();
36  (*pStream) << utmPoint.get<0>()/degree << " "
37  << utmPoint.get<1>()/degree << " "
38  << utmPoint.get<2>()/meter << " ";
39 }
40 
41 void RdAirplane::DataWriterUtil::writeCoordinateSystemToStream(CoordinateSystemPtr pCoordinateSystem, CoordinateSystemPtr pGlobalCoordinateSystem, ofstream* pStream) {
42  Point origin(0,0,0,pCoordinateSystem);
43  Vector eX(1,0,0,pCoordinateSystem);
44  Vector eY(0,1,0,pCoordinateSystem);
45  Vector eZ(0,0,1,pCoordinateSystem);
46  writeCoordinatesToStream_cartesian(&origin, pGlobalCoordinateSystem, pStream);
47  writeVectorToStream_cartesian(&eX, pGlobalCoordinateSystem, pStream);
48  writeVectorToStream_cartesian(&eY, pGlobalCoordinateSystem, pStream);
49  writeVectorToStream_cartesian(&eZ, pGlobalCoordinateSystem, pStream);
50 }
const double degree
Point object.
Definition: Point.h:32
double GetPhi(const CoordinateSystemPtr &coordinateSystem) const
azimuth (phi) angle in spherical and cylindrical coordinates
Definition: BasicVector.h:254
void writeCoordinateSystemToStream(utl::CoordinateSystemPtr pCoordinateSystem, utl::CoordinateSystemPtr pGlobalCoordinateSystem, std::ofstream *pStream)
double GetR(const CoordinateSystemPtr &coordinateSystem) const
radius r in spherical coordinates coordinates (distance to origin)
Definition: BasicVector.h:257
double GetTheta(const CoordinateSystemPtr &coordinateSystem) const
zenith (theta) angle in spherical coordinates
Definition: BasicVector.h:248
Class to hold and convert a point in geodetic coordinates.
Definition: UTMPoint.h:40
const double meter
Definition: GalacticUnits.h:29
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
void writeCoordinatesToStream_spheric(const utl::Point *pPoint, utl::CoordinateSystemPtr pCoordinateSystem, std::ofstream *pStream)
double GetX(const CoordinateSystemPtr &coordinateSystem) const
Definition: BasicVector.h:206
double GetY(const CoordinateSystemPtr &coordinateSystem) const
Definition: BasicVector.h:209
void writeVectorToStream_cartesian(const utl::Vector *pVector, utl::CoordinateSystemPtr pCoordinateSystem, std::ofstream *pStream)
Vector object.
Definition: Vector.h:30
void writeCoordinatesToStream_geodetic(const utl::Point *pPoint, std::ofstream *pStream)
void writeCoordinatesToStream_cartesian(const utl::Point *pPoint, utl::CoordinateSystemPtr pCoordinateSystem, std::ofstream *pStream)
double GetZ(const CoordinateSystemPtr &coordinateSystem) const
Definition: BasicVector.h:212
boost::tuple< double, double, double > GetGeodeticCoordinates() const
Get geodetic latitude, longitude, height.
Definition: UTMPoint.cc:67

, generated on Tue Sep 26 2023.