31 #ifndef DRAIN_PROJECTOR_H_
32 #define DRAIN_PROJECTOR_H_
43 #include "EnumFlags.h"
63 static const std::string proj4version;
87 Projector(
const std::string & projDef =
"", CRS_mode crs=ACCEPT_CRS) :
pjContext(proj_context_create()),
pj(nullptr), epsg(0){
89 projDefs = {{ORIG,
""}, {MODIFIED,
""}, {PROJ4,
""}, {PROJ5,
""}, {SIMPLE,
""}};
101 projDefs = {{ORIG,
""}, {MODIFIED,
""}, {PROJ4,
""}, {PROJ5,
""}, {SIMPLE,
""}};
110 Projector(
const Projector & pr);
121 int extractEPSG(
const std::string & projDef);
132 projDefs = {{ORIG,
""}, {MODIFIED,
""}, {PROJ4,
""}, {PROJ5,
""}, {SIMPLE,
""}};
144 void setProjection(
const std::string &str, CRS_mode crs=FORCE_CRS);
153 void createProjection(CRS_mode crs);
158 return (
pj !=
nullptr);
163 bool isLongLat()
const {
165 return isLongLat(
pj);
169 int getEPSG()
const {
181 void info(std::ostream & ostr = std::cout,
int wkt = -1){
183 for (
const auto & entry: projDefs){
184 ostr << entry.first <<
": '" << entry.second <<
"'\n";
190 std::string getErrorString()
const {
192 return proj_errno_string(err);
199 void info(PJ *
pj, std::ostream & ostr = std::cout,
int wkt = -1);
216 std::map<PROJDEF_variant,std::string> projDefs;
218 void storeProjDef(
const std::string & str);
221 void getProjDefStr(
const ProjDef & dict, std::stringstream & sstr,
const std::set<std::string> & excludeKeys = {
"+type"});
234 bool isLongLat(
const PJ *prj);
Definition: Projector.h:54
void info(std::ostream &ostr=std::cout, int wkt=-1)
Prunes "+init=epsg:<...>" and optionally "+type=crs" codes.
Definition: Projector.h:181
bool isSet() const
Returns true, if PJ object has been set.
Definition: Projector.h:157
PJ_CONTEXT * pjContext
Metadata for PROJ (introduced in latest versions, currently not used by Drain & Rack )
Definition: Projector.h:204
PROJDEF_variant
Each projector has three (3) versions of project definition.
Definition: Projector.h:76
ProjDef projDefDict
Secondary description of state.
Definition: Projector.h:210
PJ * pj
Essential member: the pointer to a PJ object. This is the primary description of state.
Definition: Projector.h:207
void setProjection(const std::string &str, CRS_mode crs=FORCE_CRS)
Sets projection defined as Proj string.
Definition: Projector.cpp:97
void clear()
Deletes projection object and clears all the metadata.
Definition: Projector.h:131
Definition: DataSelector.cpp:1277
Wrapper for unique (static) dictionary of enum values.
Definition: EnumFlags.h:66
Definition: Sprinter.h:137