Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JUTM::JUTMGrid Class Reference

Data structure for UTM grid. More...

#include <JUTMGrid.hh>

Inheritance diagram for JUTM::JUTMGrid:
JLANG::JEquals< JFirst_t, JSecond_t > JDETECTOR::JDetectorHeader JDETECTOR::JDetector JDETECTOR::JMonteCarloDetector JDYNAMICS::JDynamics

Public Member Functions

 JUTMGrid ()
 Default constructor.
 
 JUTMGrid (const std::string &key, const std::string &wgs, const std::string &zone)
 Constructor.
 
const JUTMGridgetUTMGrid () const
 Get UTM grid.
 
void setUTMGrid (const JUTMGrid &grid)
 Set UTM grid.
 
const std::string & getKey () const
 Get key.
 
const std::string & getWGS () const
 Get WGS.
 
const std::string & getUTMZone () const
 Get UTM zone.
 
int getUTMValue () const
 Get UTM zone by numerical value.
 
bool equals (const JUTMGrid &grid) const
 Check equality.
 
std::string toString () const
 Convert UTM grid.
 

Static Public Member Functions

static JUTMGrid valueOf (const std::string &buffer)
 Extract UTM grid.
 

Protected Attributes

std::string key
 
std::string wgs
 
std::string zone
 

Friends

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

Detailed Description

Data structure for UTM grid.

This data structure is composed of:

  • World Geodetic System;
  • UTM zone;

Definition at line 37 of file JUTMGrid.hh.

Constructor & Destructor Documentation

◆ JUTMGrid() [1/2]

JUTM::JUTMGrid::JUTMGrid ( )
inline

Default constructor.

Definition at line 44 of file JUTMGrid.hh.

44 :
45 key ("?"),
46 wgs ("?"),
47 zone("?")
48 {}
std::string key
Definition JUTMGrid.hh:246
std::string wgs
Definition JUTMGrid.hh:247
std::string zone
Definition JUTMGrid.hh:248

◆ JUTMGrid() [2/2]

JUTM::JUTMGrid::JUTMGrid ( const std::string & key,
const std::string & wgs,
const std::string & zone )
inline

Constructor.

Parameters
keykey
wgsWGS
zoneUTM zone

Definition at line 58 of file JUTMGrid.hh.

61 {
62 this->key = key;
63 this->wgs = wgs;
64 this->zone = zone;
65 }

Member Function Documentation

◆ getUTMGrid()

const JUTMGrid & JUTM::JUTMGrid::getUTMGrid ( ) const
inline

Get UTM grid.

Returns
UTM grid

Definition at line 73 of file JUTMGrid.hh.

74 {
75 return static_cast<const JUTMGrid&>(*this);
76 }
JUTMGrid()
Default constructor.
Definition JUTMGrid.hh:44

◆ setUTMGrid()

void JUTM::JUTMGrid::setUTMGrid ( const JUTMGrid & grid)
inline

Set UTM grid.

Parameters
gridUTM grid

Definition at line 84 of file JUTMGrid.hh.

85 {
86 static_cast<JUTMGrid&>(*this) = grid;
87 }

◆ getKey()

const std::string & JUTM::JUTMGrid::getKey ( ) const
inline

Get key.

Returns
key

Definition at line 95 of file JUTMGrid.hh.

96 {
97 return key;
98 }

◆ getWGS()

const std::string & JUTM::JUTMGrid::getWGS ( ) const
inline

Get WGS.

Returns
WGS

Definition at line 106 of file JUTMGrid.hh.

107 {
108 return wgs;
109 }

◆ getUTMZone()

const std::string & JUTM::JUTMGrid::getUTMZone ( ) const
inline

Get UTM zone.

Returns
UTM zone

Definition at line 117 of file JUTMGrid.hh.

118 {
119 return zone;
120 }

◆ getUTMValue()

int JUTM::JUTMGrid::getUTMValue ( ) const
inline

Get UTM zone by numerical value.

Returns
UTM zone

Definition at line 128 of file JUTMGrid.hh.

129 {
130 using namespace std;
131
132 int value = 0;
133
134 for (string::const_iterator i = zone.begin(); i != zone.end(); ++i) {
135 if (isdigit(*i))
136 value = 10 * value + (*i - '0');
137 else
138 break;
139 }
140
141 return value;
142 }

◆ equals()

bool JUTM::JUTMGrid::equals ( const JUTMGrid & grid) const
inline

Check equality.

Parameters
gridUTM grid
Returns
true if grids are equal; else false

Definition at line 151 of file JUTMGrid.hh.

152 {
153 return (this->getKey() == grid.getKey() &&
154 this->getWGS() == grid.getWGS() &&
155 this->getUTMValue() == grid.getUTMValue());
156 }
const std::string & getKey() const
Get key.
Definition JUTMGrid.hh:95

◆ toString()

std::string JUTM::JUTMGrid::toString ( ) const
inline

Convert UTM grid.

Returns
UTM grid

Definition at line 164 of file JUTMGrid.hh.

165 {
166 return (key + " " + wgs + " " + zone);
167 }

◆ valueOf()

static JUTMGrid JUTM::JUTMGrid::valueOf ( const std::string & buffer)
inlinestatic

Extract UTM grid.

Parameters
bufferWGS and UTM zone
Returns
UTM grid

Definition at line 176 of file JUTMGrid.hh.

177 {
178 JUTMGrid grid;
179
180 std::istringstream is(buffer);
181
182 if (is >> grid)
183 return grid;
184 else
185 throw JParseError("JUTMGrid::valueOf()");
186 }

Friends And Related Symbol Documentation

◆ operator>> [1/2]

std::istream & operator>> ( std::istream & in,
JUTMGrid & grid )
friend

Read UTM grid from input.

Parameters
ininput stream
gridUTM grid
Returns
input stream

Definition at line 196 of file JUTMGrid.hh.

197 {
198 return in >> grid.key >> grid.wgs >> grid.zone;
199 }

◆ operator<< [1/2]

std::ostream & operator<< ( std::ostream & out,
const JUTMGrid & grid )
friend

Write UTM grid to output.

Parameters
outoutput stream
gridUTM grid
Returns
output stream

Definition at line 209 of file JUTMGrid.hh.

210 {
211 return out << grid.key << ' ' << grid.wgs << ' ' << grid.zone;
212 }

◆ operator>> [2/2]

JReader & operator>> ( JReader & in,
JUTMGrid & grid )
friend

Read UTM grid from input.

Parameters
ininput stream
gridUTM grid
Returns
input stream

Definition at line 222 of file JUTMGrid.hh.

223 {
224 using namespace JIO;
225
226 return in >> grid.key >> grid.wgs >> grid.zone;
227 }
Auxiliary classes and methods for binary I/O.

◆ operator<< [2/2]

JWriter & operator<< ( JWriter & out,
const JUTMGrid & grid )
friend

Write UTM grid to output.

Parameters
outoutput stream
gridUTM grid
Returns
output stream

Definition at line 237 of file JUTMGrid.hh.

238 {
239 using namespace JIO;
240
241 return out << grid.key << grid.wgs << grid.zone;
242 }

Member Data Documentation

◆ key

std::string JUTM::JUTMGrid::key
protected

Definition at line 246 of file JUTMGrid.hh.

◆ wgs

std::string JUTM::JUTMGrid::wgs
protected

Definition at line 247 of file JUTMGrid.hh.

◆ zone

std::string JUTM::JUTMGrid::zone
protected

Definition at line 248 of file JUTMGrid.hh.


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