MI - Fimex
CoordinateAxis.h
Go to the documentation of this file.
1 /*
2  * Fimex, CoordinateAxis.h
3  *
4  * (C) Copyright 2009, met.no
5  *
6  * Project Info: https://wiki.met.no/fimex/start
7  *
8  * This library is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation; either version 2.1 of the License, or
11  * (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16  * License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21  * USA.
22  *
23  * Created on: Mar 16, 2010
24  * Author: Heiko Klein
25  */
26 
27 #ifndef COORDINATEAXIS_H_
28 #define COORDINATEAXIS_H_
29 
30 #include "fimex/CDMVariable.h"
31 
32 namespace MetNoFimex
33 {
39 {
40 public:
41  enum AxisType {
42  Undefined = 0,
47  Lon,
48  Lat,
53  };
55  switch (type) {
56  case GeoX: return "GeoX";
57  case GeoY: return "GeoY";
58  case GeoZ: return "GeoZ";
59  case Time: return "Time";
60  case Lon: return "Lon";
61  case Lat: return "Lat";
62  case Pressure: return "Pressure";
63  case Height: return "Height";
64  case ReferenceTime: return "ReferenceTime";
65  case Realization: return "Realization";
66  default: return "Undefined";
67  }
68  }
69  static AxisType int2type(int type) {
70  return static_cast<AxisType>(type);
71  }
72  static int type2int(AxisType type) {
73  return static_cast<int>(type);
74  }
75  explicit CoordinateAxis(const CDMVariable& var) : CDMVariable(var), type_(Undefined) {}
76  virtual ~CoordinateAxis() {}
77 
78  bool operator<(const CoordinateAxis& ca) {return this->getName() < ca.getName();}
79 
80  AxisType getAxisType() const {return type_;}
81  std::string getAxisTypeStr() const {return type2string(type_);}
82  void setAxisType(AxisType t) {type_ = t;}
83  bool isAxisType(AxisType t) const {return t == type_;}
88  bool isExplicit() const {return explicit_;}
89  void setExplicit(bool isExplicit) {explicit_ = isExplicit;}
90 
91 private:
92  bool explicit_;
93  AxisType type_;
94 
95 };
96 
99 
100 }
101 
102 
103 #endif /* COORDINATEAXIS_H_ */
void setExplicit(bool isExplicit)
Definition: CoordinateAxis.h:89
AxisType getAxisType() const
Definition: CoordinateAxis.h:80
basic_string< char > string
bool operator<(const CoordinateAxis &ca)
Definition: CoordinateAxis.h:78
AxisType
Definition: CoordinateAxis.h:41
Definition: Height.h:39
Definition: CoordinateAxis.h:44
virtual ~CoordinateAxis()
Definition: CoordinateAxis.h:76
basic_ostream< char > ostream
Pressure class for vertical transformation.
Definition: Pressure.h:44
Definition: CoordinateAxis.h:38
Definition: CoordinateAxis.h:52
Definition: CoordinateAxis.h:42
static int type2int(AxisType type)
Definition: CoordinateAxis.h:72
Definition: CoordinateAxis.h:47
Definition: C_CDMReader.h:35
Definition: CoordinateAxis.h:43
Definition: CoordinateAxis.h:45
const std::string & getName() const
Definition: CDMVariable.h:46
Definition: CoordinateAxis.h:49
static AxisType int2type(int type)
Definition: CoordinateAxis.h:69
bool isAxisType(AxisType t) const
Definition: CoordinateAxis.h:83
Definition: CoordinateAxis.h:48
std::string getAxisTypeStr() const
Definition: CoordinateAxis.h:81
std::ostream & operator<<(std::ostream &out, CoordinateAxis ca)
Definition: CoordinateAxis.h:50
Definition: CoordinateAxis.h:51
CoordinateAxis(const CDMVariable &var)
Definition: CoordinateAxis.h:75
bool isExplicit() const
Definition: CoordinateAxis.h:88
void setAxisType(AxisType t)
Definition: CoordinateAxis.h:82
Definition: CDMVariable.h:41
Definition: CoordinateAxis.h:46
static std::string type2string(AxisType type)
Definition: CoordinateAxis.h:54