Field.h
Go to the documentation of this file.
1 //=============================================================================
2 // Copyright (C) 2021-2024 Wageningen University - All Rights Reserved
3 // Author: Gonzalo Mier
4 // BSD-3 License
5 //=============================================================================
6 
7 #pragma once
8 #ifndef FIELDS2COVER_TYPES_FIELD_H_
9 #define FIELDS2COVER_TYPES_FIELD_H_
10 
11 #include <string>
12 #include <memory>
15 
16 namespace f2c::types {
17 
18 struct Field {
19  public:
20  Field();
21  explicit Field(const Cells& cells, const std::string& id = "");
22  ~Field();
23  Field(const Field&);
24  Field(Field&&);
25  Field& operator=(Field&&);
26  Field& operator=(const Field&);
27 
28  std::string getId() const;
29  void setId(const std::string& _id);
30  std::string getCRS() const;
31  void setCRS(const std::string& crs);
32  std::string getPrevCRS() const;
33  void setPrevCRS(const std::string& prev_crs);
34  Point& getRefPoint();
35  const Point& getRefPoint() const;
36  void setRefPoint(const Point& _ref_point);
37  Cells& getField();
38  const Cells& getField() const;
39  void setField(const Cells& _field);
40 
41  Field clone() const;
42  double area() const;
43  bool isEmpty() const;
44 
45  static bool isCoordSystemUTM(const std::string& coord_sys);
46  bool isCoordSystemUTM() const;
47  static std::string getUTMCoordSystem(const std::string& coord_sys,
48  const std::string& if_not_found = "");
49  static std::string getUTMDatum(const std::string& coord_sys,
50  const std::string& if_not_found = "etrs89");
51  static std::string getUTMZone(const std::string& coord_sys);
52  static std::string getUTMHemisphere(const std::string& coord_sys);
53 
54  std::string getUTMCoordSystem() const;
55  std::string getUTMDatum() const;
56  std::string getUTMZone() const;
57  std::string getUTMHemisphere() const;
58  static bool isCoordSystemEPSG(const std::string& coord_sys);
59  bool isCoordSystemEPSG() const;
60  static int getEPSGCoordSystem(const std::string& coord_sys);
61  int getEPSGCoordSystem() const;
62  void setEPSGCoordSystem(int epsg);
63  void setUTMCoordSystem(const std::string& utm);
64  void setUTMCoordSystem(const std::string& utm, const std::string& datum);
65  Cells getCellsAbsPosition() const;
66 
67  private:
68  std::string id_ {""};
69  std::string coord_sys_ {""};
70  std::string prev_coord_sys_ {""};
73 };
74 
75 } // namespace f2c::types
76 
77 #endif // FIELDS2COVER_TYPES_FIELD_H_
1_basic_types.cells
cells
Definition: 1_basic_types.py:93
Point.h
f2c::types
Types used by fields2cover library.
Definition: Cell.h:20
f2c::types::Field::operator=
Field & operator=(Field &&)
f2c::types::Field
Definition: Field.h:18
f2c::types::Field::getRefPoint
Point & getRefPoint()
Definition: Field.cpp:52
f2c::types::Field::prev_coord_sys_
std::string prev_coord_sys_
Definition: Field.h:70
f2c::types::Field::field_
Cells field_
Definition: Field.h:72
f2c::types::Field::getEPSGCoordSystem
int getEPSGCoordSystem() const
Definition: Field.cpp:139
f2c::types::Field::getField
Cells & getField()
Definition: Field.cpp:64
f2c::types::Field::setEPSGCoordSystem
void setEPSGCoordSystem(int epsg)
Definition: Field.cpp:143
f2c::types::Field::ref_point_
Point ref_point_
Definition: Field.h:71
f2c::types::Field::setRefPoint
void setRefPoint(const Point &_ref_point)
Definition: Field.cpp:60
f2c::types::Field::isCoordSystemEPSG
bool isCoordSystemEPSG() const
Definition: Field.cpp:130
f2c::types::Field::setCRS
void setCRS(const std::string &crs)
Definition: Field.cpp:40
f2c::types::Field::setUTMCoordSystem
void setUTMCoordSystem(const std::string &utm)
Definition: Field.cpp:147
f2c::types::Field::getUTMCoordSystem
std::string getUTMCoordSystem() const
Definition: Field.cpp:118
f2c::types::Field::getUTMHemisphere
std::string getUTMHemisphere() const
Definition: Field.cpp:183
f2c::types::Field::isEmpty
bool isEmpty() const
Definition: Field.cpp:86
f2c::types::Field::~Field
~Field()
f2c::types::Field::area
double area() const
Definition: Field.cpp:82
f2c::types::Field::isCoordSystemUTM
bool isCoordSystemUTM() const
Definition: Field.cpp:94
f2c::types::Field::coord_sys_
std::string coord_sys_
Definition: Field.h:69
f2c::types::Cells
Definition: Cells.h:21
f2c::types::Field::Field
Field()
f2c::types::Field::getUTMDatum
std::string getUTMDatum() const
Definition: Field.cpp:122
f2c::types::Point
Definition: Point.h:21
f2c::types::Field::clone
Field clone() const
Definition: Field.cpp:76
f2c::types::Field::id_
std::string id_
Definition: Field.h:68
Cells.h
f2c::types::Field::getCellsAbsPosition
Cells getCellsAbsPosition() const
Definition: Field.cpp:160
f2c::types::Field::getUTMZone
std::string getUTMZone() const
Definition: Field.cpp:168
f2c::types::Field::setField
void setField(const Cells &_field)
Definition: Field.cpp:72
f2c::types::Field::setId
void setId(const std::string &_id)
Definition: Field.cpp:32
f2c::types::Field::setPrevCRS
void setPrevCRS(const std::string &prev_crs)
Definition: Field.cpp:48
f2c::types::Field::getId
std::string getId() const
Definition: Field.cpp:28
f2c::types::Field::getPrevCRS
std::string getPrevCRS() const
Definition: Field.cpp:44
f2c::types::Field::getCRS
std::string getCRS() const
Definition: Field.cpp:36


fields2cover
Author(s):
autogenerated on Fri Apr 25 2025 02:18:31