Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
qgis.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgis.h - QGIS namespace
3  -------------------
4  begin : Sat Jun 30 2002
5  copyright : (C) 2002 by Gary E.Sherman
6  email : sherman at mrcc.com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGIS_H
19 #define QGIS_H
20 
21 #include <QEvent>
22 #include <QString>
23 #include <cfloat>
24 #include <cmath>
25 #include <qnumeric.h>
26 
30 class CORE_EXPORT QGis
31 {
32  public:
33  // Version constants
34  //
35  // Version string
36  static const char* QGIS_VERSION;
37  // Version number used for comparing versions using the "Check QGIS Version" function
38  static const int QGIS_VERSION_INT;
39  // Release name
40  static const char* QGIS_RELEASE_NAME;
41  // The development version
42  static const char* QGIS_DEV_VERSION;
43 
44  // Enumerations
45  //
46 
48  // Feature types
49  enum WkbType
50  {
51  WKBUnknown = 0,
52  WKBPoint = 1,
58  WKBNoGeometry = 100, //attributes only
59  WKBPoint25D = 0x80000001,
65  };
67  {
72  NoGeometry
73  };
74 
75  // String representation of geometry types (set in qgis.cpp)
76  static const char *qgisVectorGeometryType[];
77 
79  static const char *qgisFeatureTypes[];
80 
84  enum UnitType
85  {
86  Meters = 0,
87  Feet = 1,
88  Degrees = 2, //for 1.0 api backwards compatibility
89  DecimalDegrees = 2,
90  DegreesMinutesSeconds = 4,
91  DegreesDecimalMinutes = 5,
92  UnknownUnit = 3
93  } ;
94 
96  enum UserEvent
97  {
98  // These first two are useful for threads to alert their parent data providers
99 
101  ProviderExtentCalcEvent = ( QEvent::User + 1 ),
102 
104  ProviderCountCalcEvent
105  };
106 
107  static const double DEFAULT_IDENTIFY_RADIUS;
108 };
109 
110 // hack to workaround warnings when casting void pointers
111 // retrieved from QLibrary::resolve to function pointers.
112 // It's assumed that this works on all systems supporting
113 // QLibrary
114 inline void ( *cast_to_fptr( void *p ) )()
115 {
116  union
117  {
118  void *p;
119  void ( *f )();
120  } u;
121 
122  u.p = p;
123  return u.f;
124 }
125 
126 //
127 // compare two doubles (but allow some difference)
128 //
129 inline bool doubleNear( double a, double b, double epsilon = 4 * DBL_EPSILON )
130 {
131  const double diff = a - b;
132  return diff > -epsilon && diff <= epsilon;
133 }
134 
136 const QString GEOWkt =
137  "GEOGCS[\"WGS 84\", "
138  " DATUM[\"WGS_1984\", "
139  " SPHEROID[\"WGS 84\",6378137,298.257223563, "
140  " AUTHORITY[\"EPSG\",7030]], "
141  " TOWGS84[0,0,0,0,0,0,0], "
142  " AUTHORITY[\"EPSG\",6326]], "
143  " PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",8901]], "
144  " UNIT[\"DMSH\",0.0174532925199433,AUTHORITY[\"EPSG\",9108]], "
145  " AXIS[\"Lat\",NORTH], "
146  " AXIS[\"Long\",EAST], "
147  " AUTHORITY[\"EPSG\",4326]]";
149 const QString GEOPROJ4 = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";
151 const long GEOSRID = 4326;
153 const long GEOCRS_ID = 3452;
155 const long GEO_EPSG_CRS_ID = 4326;
157 const QString GEO_EPSG_CRS_AUTHID = "EPSG:4326";
159 const int PROJ_PREFIX_LEN = 6;
161 const int ELLPS_PREFIX_LEN = 7;
163 const int LAT_PREFIX_LEN = 7;
166 const int USER_CRS_START_ID = 100000;
167 
168 //
169 // Constants for point symbols
170 //
171 
173 const double MINIMUM_POINT_SIZE = 0.1;
175 const double DEFAULT_POINT_SIZE = 2.0;
176 const double DEFAULT_LINE_WIDTH = 0.26;
177 
178 // FIXME: also in qgisinterface.h
179 #ifndef QGISEXTERN
180 #ifdef WIN32
181 # define QGISEXTERN extern "C" __declspec( dllexport )
182 # ifdef _MSC_VER
183 // do not warn about C bindings returing QString
184 # pragma warning(disable:4190)
185 # endif
186 #else
187 # define QGISEXTERN extern "C"
188 #endif
189 #endif
190 
191 #endif