GeoConvHelper.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // static methods for processing the coordinates conversion for the current net
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright 2001-2010 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This program is free software; you can redistribute it and/or modify
00014 //   it under the terms of the GNU General Public License as published by
00015 //   the Free Software Foundation; either version 2 of the License, or
00016 //   (at your option) any later version.
00017 //
00018 /****************************************************************************/
00019 #ifndef GeoConvHelper_h
00020 #define GeoConvHelper_h
00021 
00022 
00023 // ===========================================================================
00024 // included modules
00025 // ===========================================================================
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031 
00032 #include <map>
00033 #include <string>
00034 #include <utils/geom/Position2D.h>
00035 #include <utils/geom/Boundary.h>
00036 
00037 #ifdef HAVE_PROJ
00038 #include <proj_api.h>
00039 #endif
00040 
00041 
00042 // ===========================================================================
00043 // class declarations
00044 // ===========================================================================
00045 class OptionsCont;
00046 
00047 
00048 // ===========================================================================
00049 // class definitions
00050 // ===========================================================================
00055 class GeoConvHelper {
00056 public:
00062     static void addProjectionOptions(OptionsCont &oc);
00063 
00065     static bool init(OptionsCont &oc);
00066 
00068     static bool init(const std::string &proj,
00069                      const int shift=0,
00070                      bool inverse=false);
00071 
00073     static bool init(const std::string &proj,
00074                      const Position2D &offset,
00075                      const Boundary &orig,
00076                      const Boundary &conv);
00077 
00079     static void close();
00080 
00082     static void cartesian2geo(Position2D &cartesian);
00083 
00085     static bool x2cartesian(Position2D &from, bool includeInBoundary=true, double x=-1, double y=-1);
00086 
00088     static bool usingGeoProjection();
00089 
00091     static bool usingInverseGeoProjection();
00092 
00094     static void moveConvertedBy(SUMOReal x, SUMOReal y);
00095 
00097     static const Boundary &getOrigBoundary();
00098 
00100     static const Boundary &getConvBoundary();
00101 
00103     static const Position2D getOffsetBase();
00104 
00106     static const std::string &getProjString();
00107 
00108 private:
00109     enum ProjectionMethod {
00110         NONE,
00111         SIMPLE,
00112         UTM,
00113         DHDN,
00114         PROJ
00115     };
00116 
00118     static std::string myProjString;
00119 
00120 #ifdef HAVE_PROJ
00122     static projPJ myProjection;
00123 #endif
00124 
00126     static Position2D myOffset;
00127 
00129     static double myGeoScale;
00130 
00132     static ProjectionMethod myProjectionMethod;
00133 
00135     static bool myUseInverseProjection;
00136 
00138     static bool myBaseFound;
00139 
00141     static double myBaseX, myBaseY;
00142 
00144     static Boundary myOrigBoundary;
00145 
00147     static Boundary myConvBoundary;
00148 
00149 };
00150 
00151 
00152 #endif
00153 
00154 /****************************************************************************/
00155 

Generated on Wed May 5 00:06:29 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6