Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JUTM::JUTMPosition Class Reference

Data structure for UTM position. More...

#include <JUTMPosition.hh>

Inheritance diagram for JUTM::JUTMPosition:
JMATH::JMath< JFirst_t, JSecond_t > JDETECTOR::JDetectorHeader JDETECTOR::JTripod JDETECTOR::JDetector JDETECTOR::JMonteCarloDetector JDYNAMICS::JDynamics

Public Member Functions

 JUTMPosition ()
 Default constructor.
 
 JUTMPosition (const JVector3D &pos)
 Constructor.
 
 JUTMPosition (const double east, const double north, const double z)
 Constructor.
 
const JUTMPositiongetUTMPosition () const
 Get UTM position.
 
void setUTMPosition (const JUTMPosition &position)
 Set UTM position.
 
JPosition3D getPosition () const
 Get position.
 
 operator JPosition3D () const
 Type conversion operator.
 
double getUTMEast () const
 Get UTM east.
 
double getUTMNorth () const
 Get UTM north.
 
double getUTMZ () const
 Get UTM Z.
 
double getX () const
 Get x.
 
double getY () const
 Get y.
 
double getZ () const
 Get z.
 
JUTMPositionnegate ()
 Negate UTM position.
 
JUTMPositionadd (const JUTMPosition &pos)
 Add UTM position.
 
JUTMPositionsub (const JUTMPosition &pos)
 Subtract UTM position.
 
JUTMPositionmul (const double factor)
 Scale UTM position.
 
JUTMPositiondiv (const double factor)
 Scale UTM position.
 
double getDisplacement (const JUTMPosition &position) const
 Get displacement to position.
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object.
 

Protected Attributes

double east
 
double north
 
double z
 

Friends

std::istream & operator>> (std::istream &in, JUTMPosition &pos)
 Read UTM position from input.
 
std::ostream & operator<< (std::ostream &out, const JUTMPosition &pos)
 Write UTM position to output.
 
JReaderoperator>> (JReader &in, JUTMPosition &pos)
 Read UTM position from input.
 
JWriteroperator<< (JWriter &out, const JUTMPosition &pos)
 Write UTM position to output.
 

Detailed Description

Data structure for UTM position.

The z-coordinate corresponds to the depth where z = 0 is at sea level.

Definition at line 36 of file JUTMPosition.hh.

Constructor & Destructor Documentation

◆ JUTMPosition() [1/3]

JUTM::JUTMPosition::JUTMPosition ( )
inline

Default constructor.

Definition at line 43 of file JUTMPosition.hh.

43 :
44 east (0.0),
45 north(0.0),
46 z (0.0)
47 {}

◆ JUTMPosition() [2/3]

JUTM::JUTMPosition::JUTMPosition ( const JVector3D & pos)
inline

Constructor.

Parameters
posUTM position

Definition at line 55 of file JUTMPosition.hh.

55 :
56 east (pos.getX()),
57 north(pos.getY()),
58 z (pos.getZ())
59 {}

◆ JUTMPosition() [3/3]

JUTM::JUTMPosition::JUTMPosition ( const double east,
const double north,
const double z )
inline

Constructor.

Parameters
eastUTM East
northUTM North
zUTM Z

Definition at line 69 of file JUTMPosition.hh.

72 {
73 this->east = east;
74 this->north = north;
75 this->z = z;
76 }

Member Function Documentation

◆ getUTMPosition()

const JUTMPosition & JUTM::JUTMPosition::getUTMPosition ( ) const
inline

Get UTM position.

Returns
position

Definition at line 84 of file JUTMPosition.hh.

85 {
86 return static_cast<const JUTMPosition&>(*this);
87 }
JUTMPosition()
Default constructor.

◆ setUTMPosition()

void JUTM::JUTMPosition::setUTMPosition ( const JUTMPosition & position)
inline

Set UTM position.

Parameters
positionposition

Definition at line 95 of file JUTMPosition.hh.

96 {
97 static_cast<JUTMPosition&>(*this) = position;
98 }

◆ getPosition()

JPosition3D JUTM::JUTMPosition::getPosition ( ) const
inline

Get position.

Returns
position

Definition at line 106 of file JUTMPosition.hh.

107 {
108 return JPosition3D(this->getX(), this->getY(), this->getZ());
109 }
double getZ() const
Get z.
double getY() const
Get y.
double getX() const
Get x.

◆ operator JPosition3D()

JUTM::JUTMPosition::operator JPosition3D ( ) const
inline

Type conversion operator.

Returns
position

Definition at line 117 of file JUTMPosition.hh.

118 {
119 return getPosition();
120 }
JPosition3D getPosition() const
Get position.

◆ getUTMEast()

double JUTM::JUTMPosition::getUTMEast ( ) const
inline

Get UTM east.

Returns
UTM East

Definition at line 128 of file JUTMPosition.hh.

129 {
130 return this->east;
131 }

◆ getUTMNorth()

double JUTM::JUTMPosition::getUTMNorth ( ) const
inline

Get UTM north.

Returns
UTM North

Definition at line 139 of file JUTMPosition.hh.

140 {
141 return this->north;
142 }

◆ getUTMZ()

double JUTM::JUTMPosition::getUTMZ ( ) const
inline

Get UTM Z.

Returns
UTM Z

Definition at line 150 of file JUTMPosition.hh.

151 {
152 return this->z;
153 }

◆ getX()

double JUTM::JUTMPosition::getX ( ) const
inline

Get x.

Returns
UTM East

Definition at line 161 of file JUTMPosition.hh.

162 {
163 return this->east;
164 }

◆ getY()

double JUTM::JUTMPosition::getY ( ) const
inline

Get y.

Returns
UTM North

Definition at line 172 of file JUTMPosition.hh.

173 {
174 return this->north;
175 }

◆ getZ()

double JUTM::JUTMPosition::getZ ( ) const
inline

Get z.

Returns
UTM Z

Definition at line 183 of file JUTMPosition.hh.

184 {
185 return this->z;
186 }

◆ negate()

JUTMPosition & JUTM::JUTMPosition::negate ( )
inline

Negate UTM position.

Returns
this UTM position

Definition at line 194 of file JUTMPosition.hh.

195 {
196 east = -east;
197 north = -north;
198 z = -z;
199
200 return *this;
201 }

◆ add()

JUTMPosition & JUTM::JUTMPosition::add ( const JUTMPosition & pos)
inline

Add UTM position.

Parameters
posUTM position
Returns
this UTM position

Definition at line 210 of file JUTMPosition.hh.

211 {
212 east += pos.getUTMEast();
213 north += pos.getUTMNorth();
214 z += pos.getUTMZ();
215
216 return *this;
217 }

◆ sub()

JUTMPosition & JUTM::JUTMPosition::sub ( const JUTMPosition & pos)
inline

Subtract UTM position.

Parameters
posUTM position
Returns
this UTM position

Definition at line 226 of file JUTMPosition.hh.

227 {
228 east -= pos.getUTMEast();
229 north -= pos.getUTMNorth();
230 z -= pos.getUTMZ();
231
232 return *this;
233 }

◆ mul() [1/2]

JUTMPosition & JUTM::JUTMPosition::mul ( const double factor)
inline

Scale UTM position.

Parameters
factormultiplication factor
Returns
this UTM position

Definition at line 242 of file JUTMPosition.hh.

243 {
244 east *= factor;
245 north *= factor;
246 z *= factor;
247
248 return *this;
249 }

◆ div()

JUTMPosition & JUTM::JUTMPosition::div ( const double factor)
inline

Scale UTM position.

Parameters
factordivision factor
Returns
this UTM position

Definition at line 258 of file JUTMPosition.hh.

259 {
260 east /= factor;
261 north /= factor;
262 z /= factor;
263
264 return *this;
265 }

◆ getDisplacement()

double JUTM::JUTMPosition::getDisplacement ( const JUTMPosition & position) const
inline

Get displacement to position.

The displacement corresponds to the 2D distance in the (East,North) plane.

Parameters
positionposition
Returns
displacement

Definition at line 276 of file JUTMPosition.hh.

277 {
278 const double x = this->getUTMEast() - position.getUTMEast();
279 const double y = this->getUTMNorth() - position.getUTMNorth();
280
281 return sqrt(x*x + y*y);
282 }
double getUTMNorth() const
Get UTM north.
double getUTMEast() const
Get UTM east.

◆ mul() [2/2]

template<class JFirst_t , class JSecond_t >
JFirst_t & JMATH::JMath< JFirst_t, JSecond_t >::mul ( const JSecond_t & object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 354 of file JMath.hh.

355 {
356 return static_cast<JFirst_t&>(*this) = JFirst_t().mul(static_cast<const JFirst_t&>(*this), object);
357 }

Friends And Related Symbol Documentation

◆ operator>> [1/2]

std::istream & operator>> ( std::istream & in,
JUTMPosition & pos )
friend

Read UTM position from input.

Parameters
ininput stream
posUTM position
Returns
input stream

Definition at line 292 of file JUTMPosition.hh.

293 {
294 return in >> pos.east >> pos.north >> pos.z;
295 }

◆ operator<< [1/2]

std::ostream & operator<< ( std::ostream & out,
const JUTMPosition & pos )
friend

Write UTM position to output.

Parameters
outoutput stream
posUTM position
Returns
output stream

Definition at line 305 of file JUTMPosition.hh.

306 {
307 const JFormat format[] = { JFormat(out, getFormat<JUTMPosition>(JFormat_t(12, 3, std::ios::fixed | std::ios::showpos))),
308 JFormat(out, getFormat<JPosition3D> (JFormat_t( 9, 3, std::ios::fixed | std::ios::showpos))) };
309
310 return out << format[0] << pos.east << ' '
311 << format[0] << pos.north << ' '
312 << format[1] << pos.z;
313 }
JFormat_t & getFormat()
Get format for given type.
Definition JManip.hh:682
Data structure for format specifications.
Definition JManip.hh:524
Auxiliary class to temporarily define format specifications.
Definition JManip.hh:636

◆ operator>> [2/2]

JReader & operator>> ( JReader & in,
JUTMPosition & pos )
friend

Read UTM position from input.

Parameters
ininput stream
posUTM position
Returns
input stream

Definition at line 324 of file JUTMPosition.hh.

325 {
326 return in >> pos.east >> pos.north >> pos.z;
327 }

◆ operator<< [2/2]

JWriter & operator<< ( JWriter & out,
const JUTMPosition & pos )
friend

Write UTM position to output.

Parameters
outoutput stream
posUTM position
Returns
output stream

Definition at line 337 of file JUTMPosition.hh.

338 {
339 return out << pos.east << pos.north << pos.z;
340 }

Member Data Documentation

◆ east

double JUTM::JUTMPosition::east
protected

Definition at line 344 of file JUTMPosition.hh.

◆ north

double JUTM::JUTMPosition::north
protected

Definition at line 345 of file JUTMPosition.hh.

◆ z

double JUTM::JUTMPosition::z
protected

Definition at line 346 of file JUTMPosition.hh.


The documentation for this class was generated from the following file: