20 #include "qgsversion.h" 22 #include <QCoreApplication> 28 #include "qgsconfig.h" 51 #if GDAL_VERSION_NUM >= 1800 54 const QString GEOPROJ4 =
"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";
59 " DATUM[\"WGS_1984\", " 60 " SPHEROID[\"WGS 84\",6378137,298.257223563, " 61 " AUTHORITY[\"EPSG\",7030]], " 62 " TOWGS84[0,0,0,0,0,0,0], " 63 " AUTHORITY[\"EPSG\",6326]], " 64 " PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",8901]], " 65 " UNIT[\"DMSH\",0.0174532925199433,AUTHORITY[\"EPSG\",9108]], " 66 " AXIS[\"Lat\",NORTH], " 67 " AXIS[\"Long\",EAST], " 68 " AUTHORITY[\"EPSG\",4326]]";
71 "1:1000000,1:500000,1:250000,1:100000,1:50000,1:25000," 72 "1:10000,1:5000,1:2500,1:1000,1:500";
92 const char* QGis::qgisUnitTypes[] =
94 QT_TRANSLATE_NOOP(
"QGis::UnitType",
"meters" ),
95 QT_TRANSLATE_NOOP(
"QGis::UnitType",
"feet" ),
96 QT_TRANSLATE_NOOP(
"QGis::UnitType",
"degrees" ),
97 QT_TRANSLATE_NOOP(
"QGis::UnitType",
"<unknown>" ),
98 QT_TRANSLATE_NOOP(
"QGis::UnitType",
"degrees" ),
99 QT_TRANSLATE_NOOP(
"QGis::UnitType",
"degrees" ),
100 QT_TRANSLATE_NOOP(
"QGis::UnitType",
"degrees" ),
101 QT_TRANSLATE_NOOP(
"QGis::UnitType",
"nautical miles" )
187 return ok ? unit : defaultType;
204 return ok ? unit : defaultType;
228 if ( size == 0 ||
long( size ) < 0 )
233 void *p = malloc( size );
243 if ( nmemb == 0 ||
long( nmemb ) < 0 || size == 0 ||
long( size ) < 0 )
245 QgsDebugMsg(
QString(
"Negative or zero nmemb %1 or size %2." ).arg( nmemb ).arg( size ) );
251 memset( p, 0, nmemb * size );
263 switch ( lhs.
type() )
269 case QVariant::LongLong:
271 case QVariant::ULongLong:
273 case QVariant::Double:
281 case QVariant::DateTime:
295 if ( path.
startsWith(
"/vsizip/", Qt::CaseInsensitive ) ||
296 path.
endsWith(
".zip", Qt::CaseInsensitive ) )
298 else if ( path.
startsWith(
"/vsitar/", Qt::CaseInsensitive ) ||
299 path.
endsWith(
".tar", Qt::CaseInsensitive ) ||
300 path.
endsWith(
".tar.gz", Qt::CaseInsensitive ) ||
301 path.
endsWith(
".tgz", Qt::CaseInsensitive ) )
303 else if ( path.
startsWith(
"/vsigzip/", Qt::CaseInsensitive ) ||
304 path.
endsWith(
".gz", Qt::CaseInsensitive ) )
403 return "Unknown geometry";
405 return "No geometry";
407 return "Invalid type";
421 return "WKBLineString";
425 return "WKBMultiPoint";
427 return "WKBMultiLineString";
429 return "WKBMultiPolygon";
431 return "WKBNoGeometry";
433 return "WKBPoint25D";
435 return "WKBLineString25D";
437 return "WKBPolygon25D";
439 return "WKBMultiPoint25D";
441 return "WKBMultiLineString25D";
443 return "WKBMultiPolygon25D";
445 return "invalid wkbtype";
static const char * QGIS_VERSION
static WkbType flatType(WkbType type)
Map 2d+ to 2d type.
qlonglong toLongLong(bool *ok) const
static double DEFAULT_HIGHLIGHT_BUFFER_MM
Default highlight buffer in mm.
static const QColor DEFAULT_HIGHLIGHT_COLOR
Default highlight color.
static int permissiveToInt(QString string, bool &ok)
Converts a string to an integer in a permissive way, eg allowing for incorrect numbers of digits betw...
static bool isSingleType(Type type)
Returns true if the WKB type is a single type.
void * qgsMalloc(size_t size)
Allocates size bytes and returns a pointer to the allocated memory.
int localeAwareCompare(const QString &other) const
static int wkbDimensions(WkbType type)
static bool hasM(Type type)
Tests whether a WKB type contains m values.
QDateTime toDateTime() const
static Type multiType(Type type)
Returns the multi type for a WKB type.
static QGis::UnitType decodeDistanceUnit(const QString &string, bool *ok=0)
Decodes a distance unit from a string.
static double permissiveToDouble(QString string, bool &ok)
Converts a string to a double in a permissive way, eg allowing for incorrect numbers of digits betwee...
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...
static QGis::WkbType fromNewWkbType(QgsWKBTypes::Type type)
Converts from new (post 2.10) WKB type (OGC) to old WKB type.
static bool isMultiType(Type type)
Returns true if the WKB type is a multi type.
static const char * vectorGeometryType(GeometryType type)
description strings for geometry types
WkbType
Used for symbology operations.
static Q_DECL_DEPRECATED const double DEFAULT_IDENTIFY_RADIUS
Old search radius in % of canvas width.
static bool hasZ(Type type)
Tests whether a WKB type contains the z-dimension.
bool qgsVariantGreaterThan(const QVariant &lhs, const QVariant &rhs)
qulonglong toULongLong(bool *ok) const
double toDouble(const QString &s, bool *ok) const
bool qgsVariantLessThan(const QVariant &lhs, const QVariant &rhs)
const QString GEO_NONE
Constant that holds the string representation for "No ellips/No CRS".
static QString encodeUnit(QGis::UnitType unit)
Encodes a distance unit to a string.
static QString toString(QGis::UnitType unit)
Returns a translated string representing a distance unit.
static QgsWKBTypes::Type fromOldWkbType(QGis::WkbType type)
Converts from old (pre 2.10) WKB type (OGR) to new WKB type.
static QGis::UnitType stringToDistanceUnit(const QString &string, bool *ok=0)
Converts a translated string to a distance unit.
uint toUInt(bool *ok) const
int toInt(bool *ok) const
const QString GEOPROJ4
PROJ4 string that represents a geographic coord sys.
static const char * QGIS_DEV_VERSION
static bool isSingleType(WkbType type)
Return if type is a single type.
static const float DEFAULT_MAPTOPIXEL_THRESHOLD
Default threshold between map coordinates and device coordinates for map2pixel simplification.
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
const QString GEO_EPSG_CRS_AUTHID
Geographic coord sys from EPSG authority.
static WkbType singleType(WkbType type)
Map multi to single type.
const QString GEOWKT
Wkt string that represents a geographic coord sys.
static double fromUnitToUnitFactor(QGis::UnitType fromUnit, QGis::UnitType toUnit)
Returns the conversion factor between the specified distance units.
static const double DEFAULT_SEARCH_RADIUS_MM
Identify search radius in mm.
static const char * QGIS_RELEASE_NAME
static const char * featureType(WkbType type)
description strings for feature types
static Q_DECL_DEPRECATED QString tr(QGis::UnitType unit)
Provides translated version of the type value.
static WkbType multiType(WkbType type)
Map single to multitype type.
const QString PROJECT_SCALES
static Q_DECL_DEPRECATED UnitType fromTr(const QString &literal, QGis::UnitType defaultType=UnknownUnit)
Provides type value from translated version.
QString qgsVsiPrefix(const QString &path)
static Q_DECL_DEPRECATED double fromUnitToUnitFactor(QGis::UnitType fromUnit, QGis::UnitType toUnit)
Returns the conversion factor between the specified units.
int toInt(const QString &s, bool *ok, int base) const
UnitType
Map units that qgis supports.
static Type flatType(Type type)
Returns the flat type for a WKB type.
double toDouble(bool *ok) const
static Q_DECL_DEPRECATED QString toLiteral(QGis::UnitType unit)
Provides the canonical name of the type value.
static bool isMultiType(WkbType type)
Return if type is a multi type.
static Q_DECL_DEPRECATED UnitType fromLiteral(const QString &literal, QGis::UnitType defaultType=UnknownUnit)
Converts from the canonical name to the type value.
void qgsFree(void *ptr)
Frees the memory space pointed to by ptr.
static const int QGIS_VERSION_INT
static double DEFAULT_HIGHLIGHT_MIN_WIDTH_MM
Default highlight line/outline minimum width in mm.
static Type singleType(Type type)
Returns the single type for a WKB type.