31 #ifndef DRAIN_PROJ6_H_
32 #define DRAIN_PROJ6_H_
43 #include "Projector.h"
77 const std::string & getProjVersion(){
78 return Projector::proj4version;
90 void setProjectionSrc(
const std::string & projDef, Projector::CRS_mode crs=Projector::FORCE_CRS){
103 mout.
unimplemented<LOG_ERR>(
"Not setting ", projDef.getProjDef());
110 void setProjectionDst(
const std::string & projDef, Projector::CRS_mode crs=Projector::FORCE_CRS){
120 mout.
unimplemented<LOG_ERR>(
"Not setting ", projDef.getProjDef());
127 void setProjections(
const std::string & projDefSrc,
const std::string & projDefDst){
145 return src.getProjDef();
150 const std::string & getProjectionDst()
const {
151 return dst.getProjDef();
156 const Projector & getSrc()
const {
161 const Projector & getDst()
const {
173 project<PJ_FWD>(x,y);
178 void projectFwd(
double x,
double y,
double & x2,
double & y2)
const {
181 project<PJ_FWD>(x2,y2);
187 project<PJ_FWD>(point);
192 void projectInv(
double & x,
double & y)
const {
193 project<PJ_INV>(x,y);
198 void projectInv(
double x,
double y,
double & x2,
double & y2)
const {
201 project<PJ_INV>(x2,y2);
207 project<PJ_INV>(point);
213 void debug(std::ostream & ostr = std::cout,
int wkt = -1){
229 return dst.isLongLat();
238 std::string getErrorString()
const {
240 return proj_errno_string(err);
267 void setMapping(
bool lenient);
275 <PJ_DIRECTION D,
class POINT_XY>
280 proj_trans_generic(proj, D, &point.x,
sizeof(POINT_XY), 1, &point.y,
sizeof(POINT_XY), 1, 0, 0, 0, 0, 0, 0);
286 void project(
double & x,
double & y)
const {
288 proj_trans_generic(proj, D, &x,
sizeof(
double), 1, &y,
sizeof(
double), 1, 0, 0, 0, 0, 0, 0);
296 DRAIN_TYPENAME(Proj6);
298 std::ostream & operator<<(std::ostream & ostr,
const Proj6 &p);
LogSourc e is the means for a function or any program segment to "connect" to a Log.
Definition: Log.h:310
Logger & unimplemented(const TT &... args)
Feature to be done. Special type of Logger::note().
Definition: Log.h:509
void setProjectionDst(const std::string &projDef, Projector::CRS_mode crs=Projector::FORCE_CRS)
Sets destination projection.
Definition: Proj6.h:110
void setProjectionDst(const Projector &projDef)
Sets destination projection, primarily using EPSG code.
Definition: Proj6.h:118
void setProjectionSrc(const std::string &projDef, Projector::CRS_mode crs=Projector::FORCE_CRS)
Sets source projection.
Definition: Proj6.h:90
PJ_CONTEXT * pjContext
Detect EPSG code from "+init=epsg:EPSG" argument.
Definition: Proj6.h:263
bool isLongLat() const
Check if destination projection is longitude-latitude degrees.
Definition: Proj6.h:228
void setProjectionSrc(const Projector &projDef)
Sets source projection, primarily using EPSG code.
Definition: Proj6.h:101
void setProjections(const std::string &projDefSrc, const std::string &projDefDst)
Sets source and destination projection. TOOD: EPSG code handling.
Definition: Proj6.h:127
void projectFwd(double x, double y, double &x2, double &y2) const
Forward projection.
Definition: Proj6.h:178
void project(POINT_XY &point) const
Definition: Proj6.h:277
void projectFwd(double &x, double &y) const
Forward projection (in-place)
Definition: Proj6.h:172
void projectFwd(drain::Point2D< double > &point) const
Forward projection. Example implementation of project<>() .
Definition: Proj6.h:186
const std::string & getProjectionSrc() const
Returns the projection std::string applied by the last setProjection call.
Definition: Proj6.h:144
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
void setProjection(const std::string &str, CRS_mode crs=FORCE_CRS)
Sets projection defined as Proj string.
Definition: Projector.cpp:97
Definition: DataSelector.cpp:1277