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";
89 const char* QGis::qgisUnitTypes[] =
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" )
103 for (
unsigned int i = 0; i < (
sizeof( qgisUnitTypes ) /
sizeof( qgisUnitTypes[0] ) ); i++ )
105 if ( literal == qgisUnitTypes[ i ] )
115 return QString( qgisUnitTypes[ static_cast<int>( unit )] );
120 return QCoreApplication::translate(
"QGis::UnitType", qPrintable(
toLiteral( unit ) ) );
125 for (
unsigned int i = 0; i < (
sizeof( qgisUnitTypes ) /
sizeof( qgisUnitTypes[0] ) ); i++ )
127 if ( literal ==
QGis::tr( static_cast<UnitType>( i ) ) )
137 #define DEGREE_TO_METER 111319.49079327358
138 #define FEET_TO_METER 0.3048
139 #define NMILE_TO_METER 1852.0
189 if ( size == 0 ||
long( size ) < 0 )
191 QgsDebugMsg( QString(
"Negative or zero size %1." ).arg( size ) );
194 void *p = malloc( size );
197 QgsDebugMsg( QString(
"Allocation of %1 bytes failed." ).arg( size ) );
204 if ( nmemb == 0 ||
long( nmemb ) < 0 || size == 0 ||
long( size ) < 0 )
206 QgsDebugMsg( QString(
"Negative or zero nmemb %1 or size %2." ).arg( nmemb ).arg( size ) );
212 memset( p, 0, nmemb * size );
224 switch ( lhs.type() )
227 return lhs.toInt() < rhs.toInt();
229 return lhs.toUInt() < rhs.toUInt();
230 case QVariant::LongLong:
231 return lhs.toLongLong() < rhs.toLongLong();
232 case QVariant::ULongLong:
233 return lhs.toULongLong() < rhs.toULongLong();
234 case QVariant::Double:
235 return lhs.toDouble() < rhs.toDouble();
237 return lhs.toChar() < rhs.toChar();
239 return lhs.toDate() < rhs.toDate();
241 return lhs.toTime() < rhs.toTime();
242 case QVariant::DateTime:
243 return lhs.toDateTime() < rhs.toDateTime();
245 return QString::localeAwareCompare( lhs.toString(), rhs.toString() ) < 0;
256 if ( path.startsWith(
"/vsizip/", Qt::CaseInsensitive ) ||
257 path.endsWith(
".zip", Qt::CaseInsensitive ) )
259 else if ( path.startsWith(
"/vsitar/", Qt::CaseInsensitive ) ||
260 path.endsWith(
".tar", Qt::CaseInsensitive ) ||
261 path.endsWith(
".tar.gz", Qt::CaseInsensitive ) ||
262 path.endsWith(
".tgz", Qt::CaseInsensitive ) )
264 else if ( path.startsWith(
"/vsigzip/", Qt::CaseInsensitive ) ||
265 path.endsWith(
".gz", Qt::CaseInsensitive ) )