20 #include "qgsversion.h"
22 #include <QCoreApplication>
27 #include "qgsconfig.h"
48 #if GDAL_VERSION_NUM >= 1800
49 const CORE_EXPORT QString
GEOPROJ4 =
"+proj=longlat +datum=WGS84 +no_defs";
51 const CORE_EXPORT QString
GEOPROJ4 =
"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";
56 " DATUM[\"WGS_1984\", "
57 " SPHEROID[\"WGS 84\",6378137,298.257223563, "
58 " AUTHORITY[\"EPSG\",7030]], "
59 " TOWGS84[0,0,0,0,0,0,0], "
60 " AUTHORITY[\"EPSG\",6326]], "
61 " PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",8901]], "
62 " UNIT[\"DMSH\",0.0174532925199433,AUTHORITY[\"EPSG\",9108]], "
63 " AXIS[\"Lat\",NORTH], "
64 " AXIS[\"Long\",EAST], "
65 " AUTHORITY[\"EPSG\",4326]]";
68 "1:1000000,1:500000,1:250000,1:100000,1:50000,1:25000,"
69 "1:10000,1:5000,1:2500,1:1000,1:500";
91 QT_TRANSLATE_NOOP(
"QGis::UnitType",
"meters" ),
92 QT_TRANSLATE_NOOP(
"QGis::UnitType",
"feet" ),
93 QT_TRANSLATE_NOOP(
"QGis::UnitType",
"degrees" ),
94 QT_TRANSLATE_NOOP(
"QGis::UnitType",
"<unknown>" ),
95 QT_TRANSLATE_NOOP(
"QGis::UnitType",
"degrees" ),
96 QT_TRANSLATE_NOOP(
"QGis::UnitType",
"degrees" ),
97 QT_TRANSLATE_NOOP(
"QGis::UnitType",
"degrees" ),
98 QT_TRANSLATE_NOOP(
"QGis::UnitType",
"nautical miles" )
120 return QCoreApplication::translate(
"QGis::UnitType", qPrintable(
toLiteral( unit ) ) );
125 #define DEGREE_TO_METER 111319.49079327358
126 #define FEET_TO_METER 0.3048
127 #define NMILE_TO_METER 1852.0
177 if ( size == 0 ||
long( size ) < 0 )
179 QgsDebugMsg( QString(
"Negative or zero size %1." ).arg( size ) );
182 void *p = malloc( size );
185 QgsDebugMsg( QString(
"Allocation of %1 bytes failed." ).arg( size ) );
192 if ( nmemb == 0 ||
long( nmemb ) < 0 || size == 0 ||
long( size ) < 0 )
194 QgsDebugMsg( QString(
"Negative or zero nmemb %1 or size %2." ).arg( nmemb ).arg( size ) );
200 memset( p, 0, nmemb * size );
212 switch ( lhs.type() )
215 return lhs.toInt() < rhs.toInt();
217 return lhs.toUInt() < rhs.toUInt();
218 case QVariant::LongLong:
219 return lhs.toLongLong() < rhs.toLongLong();
220 case QVariant::ULongLong:
221 return lhs.toULongLong() < rhs.toULongLong();
222 case QVariant::Double:
223 return lhs.toDouble() < rhs.toDouble();
225 return lhs.toChar() < rhs.toChar();
227 return lhs.toDate() < rhs.toDate();
229 return lhs.toTime() < rhs.toTime();
230 case QVariant::DateTime:
231 return lhs.toDateTime() < rhs.toDateTime();
233 return QString::localeAwareCompare( lhs.toString(), rhs.toString() ) < 0;
244 if ( path.startsWith(
"/vsizip/", Qt::CaseInsensitive ) ||
245 path.endsWith(
".zip", Qt::CaseInsensitive ) )
247 else if ( path.startsWith(
"/vsitar/", Qt::CaseInsensitive ) ||
248 path.endsWith(
".tar", Qt::CaseInsensitive ) ||
249 path.endsWith(
".tar.gz", Qt::CaseInsensitive ) ||
250 path.endsWith(
".tgz", Qt::CaseInsensitive ) )
252 else if ( path.startsWith(
"/vsigzip/", Qt::CaseInsensitive ) ||
253 path.endsWith(
".gz", Qt::CaseInsensitive ) )
static const char * QGIS_VERSION
static double DEFAULT_HIGHLIGHT_BUFFER_MM
Default highlight buffer in mm.
static UnitType fromLiteral(QString literal, QGis::UnitType defaultType=UnknownUnit)
Converts from the canonical name to the type value.
static const QColor DEFAULT_HIGHLIGHT_COLOR
Default highlight color.
void * qgsMalloc(size_t size)
Allocates size bytes and returns a pointer to the allocated memory.
const CORE_EXPORT QString GEOWKT
Wkt string that represents a geographic coord sys.
void * qgsCalloc(size_t nmemb, size_t size)
Allocates memory for an array of nmemb elements of size bytes each and returns a pointer to the alloc...
QString qgsVsiPrefix(QString path)
static const double DEFAULT_IDENTIFY_RADIUS
Old search radius in % of canvas width.
bool qgsVariantGreaterThan(const QVariant &lhs, const QVariant &rhs)
bool qgsVariantLessThan(const QVariant &lhs, const QVariant &rhs)
static const char * QGIS_DEV_VERSION
static const float DEFAULT_MAPTOPIXEL_THRESHOLD
Default threshold between map coordinates and device coordinates for map2pixel simplification.
const CORE_EXPORT QString PROJECT_SCALES
static const double DEFAULT_SEARCH_RADIUS_MM
Identify search radius in mm.
static const char * QGIS_RELEASE_NAME
static QString tr(QGis::UnitType unit)
Provides translated version of the type value.
const CORE_EXPORT QString GEO_NONE
Constant that holds the string representation for "No ellips/No CRS".
static double fromUnitToUnitFactor(QGis::UnitType fromUnit, QGis::UnitType toUnit)
Returns the conversion factor between the specified units.
UnitType
Map units that qgis supports.
const CORE_EXPORT QString GEOPROJ4
PROJ4 string that represents a geographic coord sys.
static QString toLiteral(QGis::UnitType unit)
Provides the canonical name of the type value.
void qgsFree(void *ptr)
Frees the memory space pointed to by ptr.
static const int QGIS_VERSION_INT
static const char * qgisUnitTypes[]
static double DEFAULT_HIGHLIGHT_MIN_WIDTH_MM
Default highlight line/outline minimum width in mm.
const CORE_EXPORT QString GEO_EPSG_CRS_AUTHID
Geographic coord sys from EPSG authority.