Jpp 19.3.0
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 getZone () 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 72 of file JUTMGrid.hh.

Constructor & Destructor Documentation

◆ JUTMGrid() [1/2]

JUTM::JUTMGrid::JUTMGrid ( )
inline

Default constructor.

Definition at line 79 of file JUTMGrid.hh.

79 :
80 key ("?"),
81 wgs ("?"),
82 zone("?")
83 {}
std::string key
Definition JUTMGrid.hh:281
std::string wgs
Definition JUTMGrid.hh:282
std::string zone
Definition JUTMGrid.hh:283

◆ 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 93 of file JUTMGrid.hh.

96 {
97 this->key = key;
98 this->wgs = wgs;
99 this->zone = zone;
100 }

Member Function Documentation

◆ getUTMGrid()

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

Get UTM grid.

Returns
UTM grid

Definition at line 108 of file JUTMGrid.hh.

109 {
110 return static_cast<const JUTMGrid&>(*this);
111 }
JUTMGrid()
Default constructor.
Definition JUTMGrid.hh:79

◆ setUTMGrid()

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

Set UTM grid.

Parameters
gridUTM grid

Definition at line 119 of file JUTMGrid.hh.

120 {
121 static_cast<JUTMGrid&>(*this) = grid;
122 }

◆ getKey()

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

Get key.

Returns
key

Definition at line 130 of file JUTMGrid.hh.

131 {
132 return key;
133 }

◆ getWGS()

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

Get WGS.

Returns
WGS

Definition at line 141 of file JUTMGrid.hh.

142 {
143 return wgs;
144 }

◆ getUTMZone()

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

Get UTM zone.

Returns
UTM zone

Definition at line 152 of file JUTMGrid.hh.

153 {
154 return zone;
155 }

◆ getZone()

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

Get UTM zone by numerical value.

Returns
UTM zone

Definition at line 163 of file JUTMGrid.hh.

164 {
165 using namespace std;
166
167 int value = 0;
168
169 for (string::const_iterator i = zone.begin(); i != zone.end(); ++i) {
170 if (isdigit(*i))
171 value = 10 * value + (*i - '0');
172 else
173 break;
174 }
175
176 return value;
177 }

◆ 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 186 of file JUTMGrid.hh.

187 {
188 return (this->getKey() == grid.getKey() &&
189 this->getWGS() == grid.getWGS() &&
190 this->getUTMZone() == grid.getUTMZone());
191 }
const std::string & getKey() const
Get key.
Definition JUTMGrid.hh:130

◆ toString()

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

Convert UTM grid.

Returns
UTM grid

Definition at line 199 of file JUTMGrid.hh.

200 {
201 return (key + " " + wgs + " " + zone);
202 }

◆ 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 211 of file JUTMGrid.hh.

212 {
213 JUTMGrid grid;
214
215 std::istringstream is(buffer);
216
217 if (is >> grid)
218 return grid;
219 else
220 throw JParseError("JUTMGrid::valueOf()");
221 }

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 231 of file JUTMGrid.hh.

232 {
233 return in >> grid.key >> grid.wgs >> grid.zone;
234 }

◆ 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 244 of file JUTMGrid.hh.

245 {
246 return out << grid.key << ' ' << grid.wgs << ' ' << grid.zone;
247 }

◆ 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 257 of file JUTMGrid.hh.

258 {
259 using namespace JIO;
260
261 return in >> grid.key >> grid.wgs >> grid.zone;
262 }
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 272 of file JUTMGrid.hh.

273 {
274 using namespace JIO;
275
276 return out << grid.key << grid.wgs << grid.zone;
277 }

Member Data Documentation

◆ key

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

Definition at line 281 of file JUTMGrid.hh.

◆ wgs

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

Definition at line 282 of file JUTMGrid.hh.

◆ zone

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

Definition at line 283 of file JUTMGrid.hh.


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