#ifndef MAPSOURCE_H #define MAPSOURCE_H #include #include #include using namespace std; #include #include #include #include #include #include #include #include #include #include #include "MapSource.h" #include "GoogleProjection.h" using namespace mapnik; class MapSource { private: std::string source; // osm. postgis or api std::string osmfile; std::string xmlfile; std::string url; std::string outfile; int width, height; double w,s,e,n; bool useBbox, tiled, multirqst; int zoom_start,zoom_end; bool srtm; static void setOSMLayers(Map& m, const parameters &p); static void addSRTMLayers(Map& m,double w,double s,double e,double n); public: MapSource() { osmfile=""; source=""; xmlfile=""; outfile=""; width=height=-1; w=-181; e=181; n=91; s=-91; zoom_start=zoom_end=-1; tiled=false; multirqst=false; url="http://xapi.openstreetmap.org/api/0.5/map"; //url="http://osmxapi.hypercube.telascience.org/api/0.5/map"; srtm=false; } bool isValid() { return xmlfile!="" && ((tiled==false&&outfile!="" && width>0 && height>0) || (tiled==true&&zoom_start>=0)) && ((source=="osm" && osmfile!="" && width>0 && height>0) || (source=="api" && hasBbox() && zoom_start>=0 && tiled==true)); } void setSource(std::string const& src) { if(src=="api" || src=="osm") { source=src; } } std::string getSource() { return source; } bool hasBbox() { return w>=-180 && w<=180 && s>=-90 && s<=90 && e>=-180 && e<=180 && n>=-90 && n<=90 && w