25 #include <QNetworkRequest>
26 #include <QNetworkReply>
27 #include <QProgressDialog>
39 const QString& geometryAttribute,
42 , mTypeName( typeName )
43 , mGeometryAttribute( geometryAttribute )
46 , mCurrentFeature( 0 )
49 , mCurrentWKBSize( 0 )
51 , mCoorMode(
QgsGml::coordinate )
54 mThematicAttributes.
clear();
55 for (
int i = 0; i < fields.
size(); i++ )
57 mThematicAttributes.
insert( fields[i].
name(), qMakePair( i, fields[i] ) );
63 if ( index != -1 && index < mTypeName.
length() )
65 mTypeName = mTypeName.
mid( index + 1 );
79 XML_SetUserData( p,
this );
80 XML_SetElementHandler( p, QgsGml::start, QgsGml::end );
81 XML_SetCharacterDataHandler( p, QgsGml::chars );
92 tr(
"GML Getfeature network request update failed for authcfg %1" ).arg( authcfg ),
101 request.
setRawHeader(
"Authorization",
"Basic " +
QString(
"%1:%2" ).arg( userName, password ).toAscii().toBase64() );
105 connect( reply, SIGNAL( finished() ),
this, SLOT( setFinished() ) );
106 connect( reply, SIGNAL( downloadProgress( qint64, qint64 ) ),
this, SLOT( handleProgressEvent( qint64, qint64 ) ) );
111 QWidgetList topLevelWidgets = qApp->topLevelWidgets();
112 for ( QWidgetList::iterator it = topLevelWidgets.begin(); it != topLevelWidgets.end(); ++it )
114 if (( *it )->objectName() ==
"QgisApp" )
122 progressDialog =
new QProgressDialog(
tr(
"Loading GML data\n%1" ).arg( mTypeName ),
tr(
"Abort" ), 0, 0, mainWindow );
126 connect( progressDialog, SIGNAL( canceled() ),
this, SLOT( setFinished() ) );
127 progressDialog->
show();
138 if ( readData.
size() > 0 )
140 if ( XML_Parse( p, readData.
constData(), readData.
size(), atEnd ) == 0 )
142 XML_Error errorCode = XML_GetErrorCode( p );
143 QString errorString =
tr(
"Error: %1 on line %2, column %3" )
144 .
arg( XML_ErrorString( errorCode ) )
145 .
arg( XML_GetCurrentLineNumber( p ) )
146 .
arg( XML_GetCurrentColumnNumber( p ) );
153 QNetworkReply::NetworkError replyError = reply->
error();
157 delete progressDialog;
162 tr(
"GML Getfeature network request failed with error: %1" ).arg( replyErrorString ),
174 calculateExtentFromFeatures();
191 XML_Parser p = XML_ParserCreateNS( NULL,
NS_SEPARATOR );
192 XML_SetUserData( p,
this );
193 XML_SetElementHandler( p, QgsGml::start, QgsGml::end );
194 XML_SetCharacterDataHandler( p, QgsGml::chars );
204 void QgsGml::setFinished()
209 void QgsGml::handleProgressEvent( qint64 progress, qint64 totalSteps )
211 if ( totalSteps < 0 )
221 void QgsGml::startElement(
const XML_Char* el,
const XML_Char** attr )
224 ParseMode theParseMode( mParseModeStack.isEmpty() ? none : mParseModeStack.
top() );
226 QString localName = splitName.last();
227 QString ns = splitName.
size() > 1 ? splitName.first() :
"";
229 if ( elementName == GML_NAMESPACE +
NS_SEPARATOR +
"coordinates" )
231 mParseModeStack.
push( QgsGml::coordinate );
232 mCoorMode = QgsGml::coordinate;
234 mCoordinateSeparator = readAttribute(
"cs", attr );
235 if ( mCoordinateSeparator.
isEmpty() )
237 mCoordinateSeparator =
",";
239 mTupleSeparator = readAttribute(
"ts", attr );
240 if ( mTupleSeparator.
isEmpty() )
242 mTupleSeparator =
" ";
245 if ( elementName == GML_NAMESPACE +
NS_SEPARATOR +
"pos"
246 || elementName == GML_NAMESPACE +
NS_SEPARATOR +
"posList" )
248 mParseModeStack.
push( QgsGml::posList );
249 mCoorMode = QgsGml::posList;
251 QString dimension = readAttribute(
"srsDimension", attr );
253 mDimension = dimension.
toInt( &ok );
254 if ( dimension.
isEmpty() || !ok )
259 else if ( localName == mGeometryAttribute )
261 mParseModeStack.
push( QgsGml::geometry );
264 else if ( elementName == GML_NAMESPACE +
NS_SEPARATOR +
"boundedBy" )
266 mParseModeStack.
push( QgsGml::boundingBox );
268 else if ( theParseMode == none && localName == mTypeName )
270 Q_ASSERT( !mCurrentFeature );
271 mCurrentFeature =
new QgsFeature( mFeatureCount );
274 mParseModeStack.
push( QgsGml::feature );
275 mCurrentFeatureId = readAttribute(
"fid", attr );
278 else if ( theParseMode == boundingBox && elementName == GML_NAMESPACE +
NS_SEPARATOR +
"Box" )
282 if ( readEpsgFromAttribute( epsgNr, attr ) != 0 )
287 else if ( elementName == GML_NAMESPACE +
NS_SEPARATOR +
"Polygon" )
292 else if ( elementName == GML_NAMESPACE +
NS_SEPARATOR +
"MultiPoint" )
294 mParseModeStack.
push( QgsGml::multiPoint );
299 else if ( elementName == GML_NAMESPACE +
NS_SEPARATOR +
"MultiLineString" )
301 mParseModeStack.
push( QgsGml::multiLine );
306 else if ( elementName == GML_NAMESPACE +
NS_SEPARATOR +
"MultiPolygon" )
308 mParseModeStack.
push( QgsGml::multiPolygon );
310 else if ( theParseMode == feature && mThematicAttributes.
contains( localName ) )
312 mParseModeStack.
push( QgsGml::attribute );
313 mAttributeName = localName;
318 else if ( theParseMode == feature
319 && localName.
compare(
"attribute", Qt::CaseInsensitive ) == 0 )
322 if ( mThematicAttributes.
contains( name ) )
324 QString value = readAttribute(
"value", attr );
325 setAttribute( name, value );
329 if ( mEpsg == 0 && ( localName ==
"Point" || localName ==
"MultiPoint" ||
330 localName ==
"LineString" || localName ==
"MultiLineString" ||
331 localName ==
"Polygon" || localName ==
"MultiPolygon" ) )
333 if ( readEpsgFromAttribute( mEpsg, attr ) != 0 )
344 void QgsGml::endElement(
const XML_Char* el )
347 ParseMode theParseMode( mParseModeStack.isEmpty() ? none : mParseModeStack.
top() );
349 QString localName = splitName.last();
350 QString ns = splitName.
size() > 1 ? splitName.first() :
"";
352 if (( theParseMode == coordinate && elementName == GML_NAMESPACE +
NS_SEPARATOR +
"coordinates" )
353 || ( theParseMode == posList && (
355 || elementName == GML_NAMESPACE +
NS_SEPARATOR +
"posList" ) ) )
357 mParseModeStack.
pop();
359 else if ( theParseMode == attribute && localName == mAttributeName )
361 mParseModeStack.
pop();
363 setAttribute( mAttributeName, mStringCash );
365 else if ( theParseMode == geometry && localName == mGeometryAttribute )
367 mParseModeStack.
pop();
369 else if ( theParseMode == boundingBox && elementName == GML_NAMESPACE +
NS_SEPARATOR +
"boundedBy" )
372 if ( createBBoxFromCoordinateString( mCurrentExtent, mStringCash ) != 0 )
377 mParseModeStack.
pop();
379 else if ( theParseMode == feature && localName == mTypeName )
381 Q_ASSERT( mCurrentFeature );
382 if ( mCurrentWKBSize > 0 )
387 else if ( !mCurrentExtent.
isEmpty() )
397 mFeatures.
insert( mCurrentFeature->
id(), mCurrentFeature );
398 if ( !mCurrentFeatureId.
isEmpty() )
400 mIdMap.
insert( mCurrentFeature->
id(), mCurrentFeatureId );
404 mParseModeStack.
pop();
406 else if ( elementName == GML_NAMESPACE +
NS_SEPARATOR +
"Point" )
409 if ( pointsFromString( pointList, mStringCash ) != 0 )
414 if ( pointList.
count() == 0 )
417 if ( theParseMode == QgsGml::geometry )
420 if ( getPointWKB( &mCurrentWKB, &mCurrentWKBSize, *( pointList.
begin() ) ) != 0 )
432 unsigned char* wkb = 0;
436 if ( getPointWKB( &wkb, &wkbSize, *( pointList.
begin() ) ) != 0 )
440 if ( !mCurrentWKBFragments.
isEmpty() )
442 mCurrentWKBFragments.
last().push_back( wkb );
443 mCurrentWKBFragmentSizes.
last().push_back( wkbSize );
452 else if ( elementName == GML_NAMESPACE +
NS_SEPARATOR +
"LineString" )
457 if ( pointsFromString( pointList, mStringCash ) != 0 )
461 if ( theParseMode == QgsGml::geometry )
463 if ( getLineWKB( &mCurrentWKB, &mCurrentWKBSize, pointList ) != 0 )
475 unsigned char* wkb = 0;
479 if ( getLineWKB( &wkb, &wkbSize, pointList ) != 0 )
483 if ( !mCurrentWKBFragments.
isEmpty() )
485 mCurrentWKBFragments.
last().push_back( wkb );
486 mCurrentWKBFragmentSizes.
last().push_back( wkbSize );
495 else if (( theParseMode == geometry || theParseMode == multiPolygon ) && elementName == GML_NAMESPACE +
NS_SEPARATOR +
"LinearRing" )
498 if ( pointsFromString( pointList, mStringCash ) != 0 )
502 unsigned char* wkb = 0;
504 if ( getRingWKB( &wkb, &wkbSize, pointList ) != 0 )
508 if ( !mCurrentWKBFragments.
isEmpty() )
510 mCurrentWKBFragments.
last().push_back( wkb );
511 mCurrentWKBFragmentSizes.
last().push_back( wkbSize );
519 else if (( theParseMode == geometry || theParseMode == multiPolygon ) && elementName == GML_NAMESPACE +
NS_SEPARATOR +
"Polygon" )
526 if ( theParseMode == geometry )
528 createPolygonFromFragments();
531 else if ( theParseMode == multiPoint && elementName == GML_NAMESPACE +
NS_SEPARATOR +
"MultiPoint" )
534 mParseModeStack.
pop();
535 createMultiPointFromFragments();
537 else if ( theParseMode == multiLine && elementName == GML_NAMESPACE +
NS_SEPARATOR +
"MultiLineString" )
540 mParseModeStack.
pop();
541 createMultiLineFromFragments();
543 else if ( theParseMode == multiPolygon && elementName == GML_NAMESPACE +
NS_SEPARATOR +
"MultiPolygon" )
546 mParseModeStack.
pop();
547 createMultiPolygonFromFragments();
551 void QgsGml::characters(
const XML_Char* chars,
int len )
554 if ( mParseModeStack.size() == 0 )
559 QgsGml::ParseMode theParseMode = mParseModeStack.
top();
560 if ( theParseMode == QgsGml::attribute || theParseMode == QgsGml::coordinate || theParseMode == QgsGml::posList )
566 void QgsGml::setAttribute(
const QString& name,
const QString& value )
570 if ( att_it != mThematicAttributes.
constEnd() )
573 switch ( att_it.
value().second.type() )
575 case QVariant::Double:
581 case QVariant::LongLong:
588 Q_ASSERT( mCurrentFeature );
593 int QgsGml::readEpsgFromAttribute(
int& epsgNr,
const XML_Char** attr )
const
596 while ( attr[i] != NULL )
598 if ( strcmp( attr[i],
"srsName" ) == 0 )
600 QString epsgString( attr[i+1] );
602 if ( epsgString.startsWith(
"http" ) )
604 epsgNrString = epsgString.
section(
"#", 1, 1 );
608 epsgNrString = epsgString.
section(
":", 1, 1 );
611 int eNr = epsgNrString.
toInt( &conversionOk );
624 QString QgsGml::readAttribute(
const QString& attributeName,
const XML_Char** attr )
const
627 while ( attr[i] != NULL )
629 if ( attributeName.
compare( attr[i] ) == 0 )
638 int QgsGml::createBBoxFromCoordinateString(
QgsRectangle &r,
const QString& coordString )
const
641 if ( pointsFromCoordinateString( points, coordString ) != 0 )
646 if ( points.
size() < 2 )
651 r.
set( points[0], points[1] );
659 QStringList tuples = coordString.
split( mTupleSeparator, QString::SkipEmptyParts );
662 bool conversionSuccess;
665 for ( tupleIterator = tuples.
constBegin(); tupleIterator != tuples.
constEnd(); ++tupleIterator )
667 tuples_coordinates = tupleIterator->split( mCoordinateSeparator, QString::SkipEmptyParts );
668 if ( tuples_coordinates.
size() < 2 )
672 x = tuples_coordinates.
at( 0 ).toDouble( &conversionSuccess );
673 if ( !conversionSuccess )
677 y = tuples_coordinates.
at( 1 ).toDouble( &conversionSuccess );
678 if ( !conversionSuccess )
687 int QgsGml::pointsFromPosListString(
QList<QgsPoint>& points,
const QString& coordString,
int dimension )
const
690 QStringList coordinates = coordString.
split(
" ", QString::SkipEmptyParts );
692 if ( coordinates.
size() % dimension != 0 )
697 int ncoor = coordinates.
size() / dimension;
698 for (
int i = 0; i < ncoor; i++ )
700 bool conversionSuccess;
701 double x = coordinates.
value( i * dimension ).toDouble( &conversionSuccess );
702 if ( !conversionSuccess )
706 double y = coordinates.
value( i * dimension + 1 ).toDouble( &conversionSuccess );
707 if ( !conversionSuccess )
718 if ( mCoorMode == QgsGml::coordinate )
720 return pointsFromCoordinateString( points, coordString );
722 else if ( mCoorMode == QgsGml::posList )
724 return pointsFromPosListString( points, coordString, mDimension );
729 int QgsGml::getPointWKB(
unsigned char** wkb,
int* size,
const QgsPoint& point )
const
731 int wkbSize = 1 +
sizeof( int ) + 2 *
sizeof(
double );
733 *wkb =
new unsigned char[wkbSize];
735 double x = point.
x();
736 double y = point.
y();
739 memcpy( &( *wkb )[wkbPosition], &mEndian, 1 );
741 memcpy( &( *wkb )[wkbPosition], &type,
sizeof(
int ) );
742 wkbPosition +=
sizeof( int );
743 memcpy( &( *wkb )[wkbPosition], &x,
sizeof(
double ) );
744 wkbPosition +=
sizeof( double );
745 memcpy( &( *wkb )[wkbPosition], &y,
sizeof(
double ) );
749 int QgsGml::getLineWKB(
unsigned char** wkb,
int* size,
const QList<QgsPoint>& lineCoordinates )
const
751 int wkbSize = 1 + 2 *
sizeof( int ) + lineCoordinates.
size() * 2 *
sizeof( double );
753 *wkb =
new unsigned char[wkbSize];
757 int nPoints = lineCoordinates.
size();
760 memcpy( &( *wkb )[wkbPosition], &mEndian, 1 );
762 memcpy( &( *wkb )[wkbPosition], &type,
sizeof(
int ) );
763 wkbPosition +=
sizeof( int );
764 memcpy( &( *wkb )[wkbPosition], &nPoints,
sizeof(
int ) );
765 wkbPosition +=
sizeof( int );
768 for ( iter = lineCoordinates.
begin(); iter != lineCoordinates.
end(); ++iter )
772 memcpy( &( *wkb )[wkbPosition], &x,
sizeof(
double ) );
773 wkbPosition +=
sizeof( double );
774 memcpy( &( *wkb )[wkbPosition], &y,
sizeof(
double ) );
775 wkbPosition +=
sizeof( double );
780 int QgsGml::getRingWKB(
unsigned char** wkb,
int* size,
const QList<QgsPoint>& ringCoordinates )
const
782 int wkbSize =
sizeof( int ) + ringCoordinates.
size() * 2 *
sizeof( double );
784 *wkb =
new unsigned char[wkbSize];
787 int nPoints = ringCoordinates.
size();
788 memcpy( &( *wkb )[wkbPosition], &nPoints,
sizeof(
int ) );
789 wkbPosition +=
sizeof( int );
792 for ( iter = ringCoordinates.
begin(); iter != ringCoordinates.
end(); ++iter )
796 memcpy( &( *wkb )[wkbPosition], &x,
sizeof(
double ) );
797 wkbPosition +=
sizeof( double );
798 memcpy( &( *wkb )[wkbPosition], &y,
sizeof(
double ) );
799 wkbPosition +=
sizeof( double );
804 int QgsGml::createMultiLineFromFragments()
807 mCurrentWKBSize += 1 + 2 *
sizeof( int );
808 mCurrentWKBSize += totalWKBFragmentSize();
810 mCurrentWKB =
new unsigned char[mCurrentWKBSize];
813 int numLines = mCurrentWKBFragments.
begin()->size();
815 memcpy( &( mCurrentWKB[pos] ), &mEndian, 1 );
817 memcpy( &( mCurrentWKB[pos] ), &type,
sizeof(
int ) );
818 pos +=
sizeof( int );
819 memcpy( &( mCurrentWKB[pos] ), &numLines,
sizeof(
int ) );
820 pos +=
sizeof( int );
825 for ( ; wkbIt != mCurrentWKBFragments.
begin()->end(); ++wkbIt, ++sizeIt )
827 memcpy( &( mCurrentWKB[pos] ), *wkbIt, *sizeIt );
832 mCurrentWKBFragments.
clear();
833 mCurrentWKBFragmentSizes.
clear();
838 int QgsGml::createMultiPointFromFragments()
841 mCurrentWKBSize += 1 + 2 *
sizeof( int );
842 mCurrentWKBSize += totalWKBFragmentSize();
843 mCurrentWKB =
new unsigned char[mCurrentWKBSize];
847 int numPoints = mCurrentWKBFragments.
begin()->size();
849 memcpy( &( mCurrentWKB[pos] ), &mEndian, 1 );
851 memcpy( &( mCurrentWKB[pos] ), &type,
sizeof(
int ) );
852 pos +=
sizeof( int );
853 memcpy( &( mCurrentWKB[pos] ), &numPoints,
sizeof(
int ) );
854 pos +=
sizeof( int );
859 for ( ; wkbIt != mCurrentWKBFragments.
begin()->end(); ++wkbIt, ++sizeIt )
861 memcpy( &( mCurrentWKB[pos] ), *wkbIt, *sizeIt );
866 mCurrentWKBFragments.
clear();
867 mCurrentWKBFragmentSizes.
clear();
873 int QgsGml::createPolygonFromFragments()
876 mCurrentWKBSize += 1 + 2 *
sizeof( int );
877 mCurrentWKBSize += totalWKBFragmentSize();
879 mCurrentWKB =
new unsigned char[mCurrentWKBSize];
882 int numRings = mCurrentWKBFragments.
begin()->size();
883 memcpy( &( mCurrentWKB[pos] ), &mEndian, 1 );
885 memcpy( &( mCurrentWKB[pos] ), &type,
sizeof(
int ) );
886 pos +=
sizeof( int );
887 memcpy( &( mCurrentWKB[pos] ), &numRings,
sizeof(
int ) );
888 pos +=
sizeof( int );
892 for ( ; wkbIt != mCurrentWKBFragments.
begin()->end(); ++wkbIt, ++sizeIt )
894 memcpy( &( mCurrentWKB[pos] ), *wkbIt, *sizeIt );
899 mCurrentWKBFragments.
clear();
900 mCurrentWKBFragmentSizes.
clear();
905 int QgsGml::createMultiPolygonFromFragments()
908 mCurrentWKBSize += 1 + 2 *
sizeof( int );
909 mCurrentWKBSize += totalWKBFragmentSize();
910 mCurrentWKBSize += mCurrentWKBFragments.
size() * ( 1 + 2 *
sizeof( int ) );
912 mCurrentWKB =
new unsigned char[mCurrentWKBSize];
916 int numPolys = mCurrentWKBFragments.
size();
918 memcpy( &( mCurrentWKB[pos] ), &mEndian, 1 );
920 memcpy( &( mCurrentWKB[pos] ), &type,
sizeof(
int ) );
921 pos +=
sizeof( int );
922 memcpy( &( mCurrentWKB[pos] ), &numPolys,
sizeof(
int ) );
923 pos +=
sizeof( int );
931 outerWkbIt = mCurrentWKBFragments.
begin();
932 outerSizeIt = mCurrentWKBFragmentSizes.
begin();
934 for ( ; outerWkbIt != mCurrentWKBFragments.
end(); ++outerWkbIt, ++outerSizeIt )
937 memcpy( &( mCurrentWKB[pos] ), &mEndian, 1 );
939 memcpy( &( mCurrentWKB[pos] ), &polygonType,
sizeof(
int ) );
940 pos +=
sizeof( int );
941 numRings = outerWkbIt->
size();
942 memcpy( &( mCurrentWKB[pos] ), &numRings,
sizeof(
int ) );
943 pos +=
sizeof( int );
945 innerWkbIt = outerWkbIt->
begin();
946 innerSizeIt = outerSizeIt->
begin();
947 for ( ; innerWkbIt != outerWkbIt->
end(); ++innerWkbIt, ++innerSizeIt )
949 memcpy( &( mCurrentWKB[pos] ), *innerWkbIt, *innerSizeIt );
951 delete[] *innerWkbIt;
955 mCurrentWKBFragments.
clear();
956 mCurrentWKBFragmentSizes.
clear();
961 int QgsGml::totalWKBFragmentSize()
const
964 Q_FOREACH (
const QList<int> &list, mCurrentWKBFragmentSizes )
966 Q_FOREACH (
int i, list )
974 void QgsGml::calculateExtentFromFeatures()
976 if ( mFeatures.
size() < 1 )
983 bool bboxInitialised =
false;
985 for (
int i = 0; i < mFeatures.
size(); ++i )
987 currentFeature = mFeatures[i];
988 if ( !currentFeature )
993 if ( currentGeometry )
995 if ( !bboxInitialised )
998 bboxInitialised =
true;
QgsFeatureId id() const
Get the feature ID for this feature.
void unionRect(const QgsRectangle &rect)
Updates rectangle to include passed argument.
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
A rectangle specified with double values.
QString & append(QChar ch)
bool isEmpty() const
test if rectangle is empty.
void setMinimal()
Set a rectangle so that min corner is at max and max corner is at min.
bool contains(const Key &key) const
static QgsAuthManager * instance()
Enforce singleton pattern.
void push_back(const T &value)
int getFeatures(const QString &uri, QGis::WkbType *wkbType, QgsRectangle *extent=0, const QString &userName=QString(), const QString &password=QString(), const QString &authcfg=QString())
Does the Http GET request to the wfs server Supports only UTF-8, UTF-16, ISO-8859-1, ISO-8859-1 XML encodings.
QString errorString() const
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
const T & at(int i) const
QgsRectangle boundingBox() const
Returns the bounding box of this feature.
Container of fields for a vector layer.
A geometry is the spatial representation of a feature.
void setAttributes(const QgsAttributes &attrs)
Sets the feature's attributes.
bool setAttribute(int field, const QVariant &attr)
Set an attribute's value by field index.
void dataReadProgress(int progress)
WkbType
Used for symbology operations.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
double toDouble(bool *ok) const
static endian_t endian()
Returns whether this machine uses big or little endian.
QString tr(const char *sourceText, const char *disambiguation, int n)
double x() const
Get the x value of the point.
void totalStepsUpdate(int totalSteps)
void set(const QgsPoint &p1, const QgsPoint &p2)
Set the rectangle from two QgsPoints.
bool createFromOgcWmsCrs(QString theCrs)
Set up this CRS from the given OGC CRS.
const char * name() const
void setGeometry(const QgsGeometry &geom)
Set this feature's geometry from another QgsGeometry object.
int count(const T &value) const
void processEvents(QFlags< QEventLoop::ProcessEventsFlag > flags)
void append(const T &value)
QString fromUtf8(const char *str, int size)
void dataProgressAndSteps(int progress, int totalSteps)
This class reads data from a WFS server or alternatively from a GML file.
QgsGml(const QString &typeName, const QString &geometryAttribute, const QgsFields &fields)
int toInt(bool *ok, int base) const
const_iterator constEnd() const
const char * constData() const
static void logMessage(const QString &message, const QString &tag=QString::null, MessageLevel level=WARNING)
add a message to the instance (and create it if necessary)
A class to represent a point.
const QString GML_NAMESPACE
void setValid(bool validity)
Sets the validity of the feature.
QString mid(int position, int n) const
bool updateNetworkRequest(QNetworkRequest &request, const QString &authcfg, const QString &dataprovider=QString())
Provider call to update a QNetworkRequest with an authentication config.
static QgsNetworkAccessManager * instance()
returns a pointer to the single instance
Class for storing a coordinate reference system (CRS)
int size() const
Return number of items.
const QgsGeometry * constGeometry() const
Gets a const pointer to the geometry object associated with this feature.
QStringList split(const QString &sep, const QString &str, bool allowEmptyEntries)
static QgsGeometry * fromRect(const QgsRectangle &rect)
Creates a new geometry from a QgsRectangle.
QString section(QChar sep, int start, int end, QFlags< QString::SectionFlag > flags) const
NetworkError error() const
double y() const
Get the y value of the point.
iterator insert(const Key &key, const T &value)
QNetworkReply * get(const QNetworkRequest &request)
const_iterator constEnd() const
const_iterator constBegin() const
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
int compare(const QString &other) const
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
qlonglong toLongLong(bool *ok, int base) const
iterator find(const Key &key)
QgsCoordinateReferenceSystem crs() const
Returns features spatial reference system.
void setGeometryAndOwnership(unsigned char *geom, size_t length)
Set this feature's geometry from WKB.
const T value(const Key &key) const