24 #include <QNetworkRequest> 25 #include <QNetworkReply> 26 #include <QProgressDialog> 37 const QString& typeName,
38 const QString& geometryAttribute,
41 , mTypeName( typeName )
42 , mGeometryAttribute( geometryAttribute )
45 , mCurrentFeature( 0 )
48 , mCurrentWKBSize( 0 )
50 , mCoorMode(
QgsGml::coordinate )
53 mThematicAttributes.clear();
54 for (
int i = 0; i < fields.
size(); i++ )
56 mThematicAttributes.insert( fields[i].name(), qMakePair( i, fields[i] ) );
61 int index = mTypeName.indexOf(
":" );
62 if ( index != -1 && index < mTypeName.length() )
64 mTypeName = mTypeName.mid( index + 1 );
78 XML_SetUserData( p,
this );
79 XML_SetElementHandler( p, QgsGml::start, QgsGml::end );
80 XML_SetCharacterDataHandler( p, QgsGml::chars );
85 QNetworkRequest request( mUri );
86 if ( !userName.isNull() || !password.isNull() )
88 request.setRawHeader(
"Authorization",
"Basic " + QString(
"%1:%2" ).arg( userName ).arg( password ).toAscii().toBase64() );
92 connect( reply, SIGNAL( finished() ),
this, SLOT( setFinished() ) );
93 connect( reply, SIGNAL( downloadProgress( qint64, qint64 ) ),
this, SLOT( handleProgressEvent( qint64, qint64 ) ) );
96 QProgressDialog* progressDialog = 0;
97 QWidget* mainWindow = 0;
98 QWidgetList topLevelWidgets = qApp->topLevelWidgets();
99 for ( QWidgetList::iterator it = topLevelWidgets.begin(); it != topLevelWidgets.end(); ++it )
101 if (( *it )->objectName() ==
"QgisApp" )
109 progressDialog =
new QProgressDialog(
tr(
"Loading GML data\n%1" ).arg( mTypeName ),
tr(
"Abort" ), 0, 0, mainWindow );
110 progressDialog->setWindowModality( Qt::ApplicationModal );
111 connect(
this, SIGNAL(
dataReadProgress(
int ) ), progressDialog, SLOT( setValue(
int ) ) );
112 connect(
this, SIGNAL(
totalStepsUpdate(
int ) ), progressDialog, SLOT( setMaximum(
int ) ) );
113 connect( progressDialog, SIGNAL( canceled() ),
this, SLOT( setFinished() ) );
114 progressDialog->show();
124 QByteArray readData = reply->readAll();
125 if ( readData.size() > 0 )
127 if ( XML_Parse( p, readData.constData(), readData.size(), atEnd ) == 0 )
129 XML_Error errorCode = XML_GetErrorCode( p );
130 QString errorString =
tr(
"Error: %1 on line %2, column %3" )
131 .arg( XML_ErrorString( errorCode ) )
132 .arg( XML_GetCurrentLineNumber( p ) )
133 .arg( XML_GetCurrentColumnNumber( p ) );
137 QCoreApplication::processEvents();
140 QNetworkReply::NetworkError replyError = reply->error();
141 QString replyErrorString = reply->errorString();
144 delete progressDialog;
149 tr(
"GML Getfeature network request failed with error: %1" ).arg( replyErrorString ),
161 calculateExtentFromFeatures();
178 XML_Parser p = XML_ParserCreateNS( NULL,
NS_SEPARATOR );
179 XML_SetUserData( p,
this );
180 XML_SetElementHandler( p, QgsGml::start, QgsGml::end );
181 XML_SetCharacterDataHandler( p, QgsGml::chars );
183 XML_Parse( p, data.constData(), data.size(), atEnd );
191 void QgsGml::setFinished()
196 void QgsGml::handleProgressEvent( qint64 progress, qint64 totalSteps )
198 if ( totalSteps < 0 )
208 void QgsGml::startElement(
const XML_Char* el,
const XML_Char** attr )
210 QString elementName( QString::fromUtf8( el ) );
211 ParseMode theParseMode( mParseModeStack.isEmpty() ? none : mParseModeStack.top() );
212 QStringList splitName = elementName.split(
NS_SEPARATOR );
213 QString localName = splitName.last();
214 QString ns = splitName.size() > 1 ? splitName.first() :
"";
218 mParseModeStack.push( QgsGml::coordinate );
219 mCoorMode = QgsGml::coordinate;
221 mCoordinateSeparator = readAttribute(
"cs", attr );
222 if ( mCoordinateSeparator.isEmpty() )
224 mCoordinateSeparator =
",";
226 mTupleSeparator = readAttribute(
"ts", attr );
227 if ( mTupleSeparator.isEmpty() )
229 mTupleSeparator =
" ";
235 mParseModeStack.push( QgsGml::posList );
236 mCoorMode = QgsGml::posList;
238 QString dimension = readAttribute(
"srsDimension", attr );
240 mDimension = dimension.toInt( &ok );
241 if ( dimension.isEmpty() || !ok )
246 else if ( localName == mGeometryAttribute )
248 mParseModeStack.push( QgsGml::geometry );
253 mParseModeStack.push( QgsGml::boundingBox );
255 else if ( theParseMode == none && localName == mTypeName )
257 Q_ASSERT( !mCurrentFeature );
258 mCurrentFeature =
new QgsFeature( mFeatureCount );
261 mParseModeStack.push( QgsGml::feature );
262 mCurrentFeatureId = readAttribute(
"fid", attr );
269 if ( readEpsgFromAttribute( epsgNr, attr ) != 0 )
276 mCurrentWKBFragments.push_back( QList<unsigned char*>() );
277 mCurrentWKBFragmentSizes.push_back( QList<int>() );
281 mParseModeStack.push( QgsGml::multiPoint );
283 mCurrentWKBFragments.push_back( QList<unsigned char*>() );
284 mCurrentWKBFragmentSizes.push_back( QList<int>() );
288 mParseModeStack.push( QgsGml::multiLine );
290 mCurrentWKBFragments.push_back( QList<unsigned char*>() );
291 mCurrentWKBFragmentSizes.push_back( QList<int>() );
295 mParseModeStack.push( QgsGml::multiPolygon );
297 else if ( theParseMode == feature && mThematicAttributes.contains( localName ) )
299 mParseModeStack.push( QgsGml::attribute );
300 mAttributeName = localName;
305 else if ( theParseMode == feature
306 && localName.compare(
"attribute", Qt::CaseInsensitive ) == 0 )
308 QString name = readAttribute(
"name", attr );
309 if ( mThematicAttributes.contains( name ) )
311 QString value = readAttribute(
"value", attr );
312 setAttribute( name, value );
316 if ( mEpsg == 0 && ( localName ==
"Point" || localName ==
"MultiPoint" ||
317 localName ==
"LineString" || localName ==
"MultiLineString" ||
318 localName ==
"Polygon" || localName ==
"MultiPolygon" ) )
320 if ( readEpsgFromAttribute( mEpsg, attr ) != 0 )
326 QgsDebugMsg( QString(
"mEpsg = %1" ).arg( mEpsg ) );
331 void QgsGml::endElement(
const XML_Char* el )
333 QString elementName( QString::fromUtf8( el ) );
334 ParseMode theParseMode( mParseModeStack.isEmpty() ? none : mParseModeStack.top() );
335 QStringList splitName = elementName.split(
NS_SEPARATOR );
336 QString localName = splitName.last();
337 QString ns = splitName.size() > 1 ? splitName.first() :
"";
340 || ( theParseMode == posList && (
344 mParseModeStack.pop();
346 else if ( theParseMode == attribute && localName == mAttributeName )
348 mParseModeStack.pop();
350 setAttribute( mAttributeName, mStringCash );
352 else if ( theParseMode == geometry && localName == mGeometryAttribute )
354 mParseModeStack.pop();
359 if ( createBBoxFromCoordinateString( mCurrentExtent, mStringCash ) != 0 )
364 mParseModeStack.pop();
366 else if ( theParseMode == feature && localName == mTypeName )
368 Q_ASSERT( mCurrentFeature );
369 if ( mCurrentWKBSize > 0 )
374 else if ( !mCurrentExtent.
isEmpty() )
384 mFeatures.insert( mCurrentFeature->
id(), mCurrentFeature );
385 if ( !mCurrentFeatureId.isEmpty() )
387 mIdMap.insert( mCurrentFeature->
id(), mCurrentFeatureId );
391 mParseModeStack.pop();
395 QList<QgsPoint> pointList;
396 if ( pointsFromString( pointList, mStringCash ) != 0 )
401 if ( pointList.count() == 0 )
404 if ( theParseMode == QgsGml::geometry )
407 if ( getPointWKB( &mCurrentWKB, &mCurrentWKBSize, *( pointList.begin() ) ) != 0 )
419 unsigned char* wkb = 0;
421 QList<unsigned char*> wkbList;
422 QList<int> wkbSizeList;
423 if ( getPointWKB( &wkb, &wkbSize, *( pointList.begin() ) ) != 0 )
427 if ( !mCurrentWKBFragments.isEmpty() )
429 mCurrentWKBFragments.last().push_back( wkb );
430 mCurrentWKBFragmentSizes.last().push_back( wkbSize );
443 QList<QgsPoint> pointList;
444 if ( pointsFromString( pointList, mStringCash ) != 0 )
448 if ( theParseMode == QgsGml::geometry )
450 if ( getLineWKB( &mCurrentWKB, &mCurrentWKBSize, pointList ) != 0 )
462 unsigned char* wkb = 0;
464 QList<unsigned char*> wkbList;
465 QList<int> wkbSizeList;
466 if ( getLineWKB( &wkb, &wkbSize, pointList ) != 0 )
470 if ( !mCurrentWKBFragments.isEmpty() )
472 mCurrentWKBFragments.last().push_back( wkb );
473 mCurrentWKBFragmentSizes.last().push_back( wkbSize );
482 else if (( theParseMode == geometry || theParseMode == multiPolygon ) && elementName ==
GML_NAMESPACE +
NS_SEPARATOR +
"LinearRing" )
484 QList<QgsPoint> pointList;
485 if ( pointsFromString( pointList, mStringCash ) != 0 )
489 unsigned char* wkb = 0;
491 if ( getRingWKB( &wkb, &wkbSize, pointList ) != 0 )
495 if ( !mCurrentWKBFragments.isEmpty() )
497 mCurrentWKBFragments.last().push_back( wkb );
498 mCurrentWKBFragmentSizes.last().push_back( wkbSize );
506 else if (( theParseMode == geometry || theParseMode == multiPolygon ) && elementName ==
GML_NAMESPACE +
NS_SEPARATOR +
"Polygon" )
513 if ( theParseMode == geometry )
515 createPolygonFromFragments();
521 mParseModeStack.pop();
522 createMultiPointFromFragments();
527 mParseModeStack.pop();
528 createMultiLineFromFragments();
533 mParseModeStack.pop();
534 createMultiPolygonFromFragments();
538 void QgsGml::characters(
const XML_Char* chars,
int len )
541 if ( mParseModeStack.size() == 0 )
546 QgsGml::ParseMode theParseMode = mParseModeStack.top();
547 if ( theParseMode == QgsGml::attribute || theParseMode == QgsGml::coordinate || theParseMode == QgsGml::posList )
549 mStringCash.append( QString::fromUtf8( chars, len ) );
553 void QgsGml::setAttribute(
const QString& name,
const QString& value )
556 QMap<QString, QPair<int, QgsField> >::const_iterator att_it = mThematicAttributes.find( name );
557 if ( att_it != mThematicAttributes.constEnd() )
560 switch ( att_it.value().second.type() )
562 case QVariant::Double:
563 var = QVariant( value.toDouble() );
566 var = QVariant( value.toInt() );
568 case QVariant::LongLong:
569 var = QVariant( value.toLongLong() );
572 var = QVariant( value );
575 Q_ASSERT( mCurrentFeature );
576 mCurrentFeature->
setAttribute( att_it.value().first, var );
580 int QgsGml::readEpsgFromAttribute(
int& epsgNr,
const XML_Char** attr )
const 583 while ( attr[i] != NULL )
585 if ( strcmp( attr[i],
"srsName" ) == 0 )
587 QString epsgString( attr[i+1] );
588 QString epsgNrString;
589 if ( epsgString.startsWith(
"http" ) )
591 epsgNrString = epsgString.section(
"#", 1, 1 );
595 epsgNrString = epsgString.section(
":", 1, 1 );
598 int eNr = epsgNrString.toInt( &conversionOk );
611 QString QgsGml::readAttribute(
const QString& attributeName,
const XML_Char** attr )
const 614 while ( attr[i] != NULL )
616 if ( attributeName.compare( attr[i] ) == 0 )
618 return QString::fromUtf8( attr[i+1] );
625 int QgsGml::createBBoxFromCoordinateString(
QgsRectangle &r,
const QString& coordString )
const 627 QList<QgsPoint> points;
628 if ( pointsFromCoordinateString( points, coordString ) != 0 )
633 if ( points.size() < 2 )
638 r.
set( points[0], points[1] );
643 int QgsGml::pointsFromCoordinateString( QList<QgsPoint>& points,
const QString& coordString )
const 646 QStringList tuples = coordString.split( mTupleSeparator, QString::SkipEmptyParts );
647 QStringList tuples_coordinates;
649 bool conversionSuccess;
651 QStringList::const_iterator tupleIterator;
652 for ( tupleIterator = tuples.constBegin(); tupleIterator != tuples.constEnd(); ++tupleIterator )
654 tuples_coordinates = tupleIterator->split( mCoordinateSeparator, QString::SkipEmptyParts );
655 if ( tuples_coordinates.size() < 2 )
659 x = tuples_coordinates.at( 0 ).toDouble( &conversionSuccess );
660 if ( !conversionSuccess )
664 y = tuples_coordinates.at( 1 ).toDouble( &conversionSuccess );
665 if ( !conversionSuccess )
669 points.push_back(
QgsPoint( x, y ) );
674 int QgsGml::pointsFromPosListString( QList<QgsPoint>& points,
const QString& coordString,
int dimension )
const 677 QStringList coordinates = coordString.split(
" ", QString::SkipEmptyParts );
679 if ( coordinates.size() % dimension != 0 )
684 int ncoor = coordinates.size() / dimension;
685 for (
int i = 0; i < ncoor; i++ )
687 bool conversionSuccess;
688 double x = coordinates.value( i * dimension ).toDouble( &conversionSuccess );
689 if ( !conversionSuccess )
693 double y = coordinates.value( i * dimension + 1 ).toDouble( &conversionSuccess );
694 if ( !conversionSuccess )
703 int QgsGml::pointsFromString( QList<QgsPoint>& points,
const QString& coordString )
const 705 if ( mCoorMode == QgsGml::coordinate )
707 return pointsFromCoordinateString( points, coordString );
709 else if ( mCoorMode == QgsGml::posList )
711 return pointsFromPosListString( points, coordString, mDimension );
716 int QgsGml::getPointWKB(
unsigned char** wkb,
int* size,
const QgsPoint& point )
const 718 int wkbSize = 1 +
sizeof( int ) + 2 *
sizeof(
double );
720 *wkb =
new unsigned char[wkbSize];
722 double x = point.
x();
723 double y = point.
y();
726 memcpy( &( *wkb )[wkbPosition], &mEndian, 1 );
728 memcpy( &( *wkb )[wkbPosition], &type,
sizeof(
int ) );
729 wkbPosition +=
sizeof( int );
730 memcpy( &( *wkb )[wkbPosition], &x,
sizeof(
double ) );
731 wkbPosition +=
sizeof( double );
732 memcpy( &( *wkb )[wkbPosition], &y,
sizeof(
double ) );
736 int QgsGml::getLineWKB(
unsigned char** wkb,
int* size,
const QList<QgsPoint>& lineCoordinates )
const 738 int wkbSize = 1 + 2 *
sizeof( int ) + lineCoordinates.size() * 2 *
sizeof( double );
740 *wkb =
new unsigned char[wkbSize];
744 int nPoints = lineCoordinates.size();
747 memcpy( &( *wkb )[wkbPosition], &mEndian, 1 );
749 memcpy( &( *wkb )[wkbPosition], &type,
sizeof(
int ) );
750 wkbPosition +=
sizeof( int );
751 memcpy( &( *wkb )[wkbPosition], &nPoints,
sizeof(
int ) );
752 wkbPosition +=
sizeof( int );
754 QList<QgsPoint>::const_iterator iter;
755 for ( iter = lineCoordinates.begin(); iter != lineCoordinates.end(); ++iter )
759 memcpy( &( *wkb )[wkbPosition], &x,
sizeof(
double ) );
760 wkbPosition +=
sizeof( double );
761 memcpy( &( *wkb )[wkbPosition], &y,
sizeof(
double ) );
762 wkbPosition +=
sizeof( double );
767 int QgsGml::getRingWKB(
unsigned char** wkb,
int* size,
const QList<QgsPoint>& ringCoordinates )
const 769 int wkbSize =
sizeof( int ) + ringCoordinates.size() * 2 *
sizeof( double );
771 *wkb =
new unsigned char[wkbSize];
774 int nPoints = ringCoordinates.size();
775 memcpy( &( *wkb )[wkbPosition], &nPoints,
sizeof(
int ) );
776 wkbPosition +=
sizeof( int );
778 QList<QgsPoint>::const_iterator iter;
779 for ( iter = ringCoordinates.begin(); iter != ringCoordinates.end(); ++iter )
783 memcpy( &( *wkb )[wkbPosition], &x,
sizeof(
double ) );
784 wkbPosition +=
sizeof( double );
785 memcpy( &( *wkb )[wkbPosition], &y,
sizeof(
double ) );
786 wkbPosition +=
sizeof( double );
791 int QgsGml::createMultiLineFromFragments()
794 mCurrentWKBSize += 1 + 2 *
sizeof( int );
795 mCurrentWKBSize += totalWKBFragmentSize();
797 mCurrentWKB =
new unsigned char[mCurrentWKBSize];
800 int numLines = mCurrentWKBFragments.begin()->size();
802 memcpy( &( mCurrentWKB[pos] ), &mEndian, 1 );
804 memcpy( &( mCurrentWKB[pos] ), &type,
sizeof(
int ) );
805 pos +=
sizeof( int );
806 memcpy( &( mCurrentWKB[pos] ), &numLines,
sizeof(
int ) );
807 pos +=
sizeof( int );
808 QList<unsigned char*>::iterator wkbIt = mCurrentWKBFragments.begin()->begin();
809 QList<int>::iterator sizeIt = mCurrentWKBFragmentSizes.begin()->begin();
812 for ( ; wkbIt != mCurrentWKBFragments.begin()->end(); ++wkbIt, ++sizeIt )
814 memcpy( &( mCurrentWKB[pos] ), *wkbIt, *sizeIt );
819 mCurrentWKBFragments.clear();
820 mCurrentWKBFragmentSizes.clear();
825 int QgsGml::createMultiPointFromFragments()
828 mCurrentWKBSize += 1 + 2 *
sizeof( int );
829 mCurrentWKBSize += totalWKBFragmentSize();
830 mCurrentWKB =
new unsigned char[mCurrentWKBSize];
834 int numPoints = mCurrentWKBFragments.begin()->size();
836 memcpy( &( mCurrentWKB[pos] ), &mEndian, 1 );
838 memcpy( &( mCurrentWKB[pos] ), &type,
sizeof(
int ) );
839 pos +=
sizeof( int );
840 memcpy( &( mCurrentWKB[pos] ), &numPoints,
sizeof(
int ) );
841 pos +=
sizeof( int );
843 QList<unsigned char*>::iterator wkbIt = mCurrentWKBFragments.begin()->begin();
844 QList<int>::iterator sizeIt = mCurrentWKBFragmentSizes.begin()->begin();
846 for ( ; wkbIt != mCurrentWKBFragments.begin()->end(); ++wkbIt, ++sizeIt )
848 memcpy( &( mCurrentWKB[pos] ), *wkbIt, *sizeIt );
853 mCurrentWKBFragments.clear();
854 mCurrentWKBFragmentSizes.clear();
860 int QgsGml::createPolygonFromFragments()
863 mCurrentWKBSize += 1 + 2 *
sizeof( int );
864 mCurrentWKBSize += totalWKBFragmentSize();
866 mCurrentWKB =
new unsigned char[mCurrentWKBSize];
869 int numRings = mCurrentWKBFragments.begin()->size();
870 memcpy( &( mCurrentWKB[pos] ), &mEndian, 1 );
872 memcpy( &( mCurrentWKB[pos] ), &type,
sizeof(
int ) );
873 pos +=
sizeof( int );
874 memcpy( &( mCurrentWKB[pos] ), &numRings,
sizeof(
int ) );
875 pos +=
sizeof( int );
877 QList<unsigned char*>::iterator wkbIt = mCurrentWKBFragments.begin()->begin();
878 QList<int>::iterator sizeIt = mCurrentWKBFragmentSizes.begin()->begin();
879 for ( ; wkbIt != mCurrentWKBFragments.begin()->end(); ++wkbIt, ++sizeIt )
881 memcpy( &( mCurrentWKB[pos] ), *wkbIt, *sizeIt );
886 mCurrentWKBFragments.clear();
887 mCurrentWKBFragmentSizes.clear();
892 int QgsGml::createMultiPolygonFromFragments()
895 mCurrentWKBSize += 1 + 2 *
sizeof( int );
896 mCurrentWKBSize += totalWKBFragmentSize();
897 mCurrentWKBSize += mCurrentWKBFragments.size() * ( 1 + 2 *
sizeof( int ) );
899 mCurrentWKB =
new unsigned char[mCurrentWKBSize];
903 int numPolys = mCurrentWKBFragments.size();
905 memcpy( &( mCurrentWKB[pos] ), &mEndian, 1 );
907 memcpy( &( mCurrentWKB[pos] ), &type,
sizeof(
int ) );
908 pos +=
sizeof( int );
909 memcpy( &( mCurrentWKB[pos] ), &numPolys,
sizeof(
int ) );
910 pos +=
sizeof( int );
913 QList< QList<unsigned char*> >::iterator outerWkbIt;
914 QList< QList<int> >::iterator outerSizeIt;
915 QList< unsigned char* >::iterator innerWkbIt;
916 QList< int >::iterator innerSizeIt;
918 outerWkbIt = mCurrentWKBFragments.begin();
919 outerSizeIt = mCurrentWKBFragmentSizes.begin();
921 for ( ; outerWkbIt != mCurrentWKBFragments.end(); ++outerWkbIt, ++outerSizeIt )
924 memcpy( &( mCurrentWKB[pos] ), &mEndian, 1 );
926 memcpy( &( mCurrentWKB[pos] ), &polygonType,
sizeof(
int ) );
927 pos +=
sizeof( int );
928 numRings = outerWkbIt->size();
929 memcpy( &( mCurrentWKB[pos] ), &numRings,
sizeof(
int ) );
930 pos +=
sizeof( int );
932 innerWkbIt = outerWkbIt->begin();
933 innerSizeIt = outerSizeIt->begin();
934 for ( ; innerWkbIt != outerWkbIt->end(); ++innerWkbIt, ++innerSizeIt )
936 memcpy( &( mCurrentWKB[pos] ), *innerWkbIt, *innerSizeIt );
938 delete[] *innerWkbIt;
942 mCurrentWKBFragments.clear();
943 mCurrentWKBFragmentSizes.clear();
948 int QgsGml::totalWKBFragmentSize()
const 951 foreach (
const QList<int> &list, mCurrentWKBFragmentSizes )
953 foreach (
int i, list )
961 void QgsGml::calculateExtentFromFeatures()
963 if ( mFeatures.size() < 1 )
970 bool bboxInitialised =
false;
972 for (
int i = 0; i < mFeatures.size(); ++i )
974 currentFeature = mFeatures[i];
975 if ( !currentFeature )
979 currentGeometry = currentFeature->
geometry();
980 if ( currentGeometry )
982 if ( !bboxInitialised )
985 bboxInitialised =
true;
QgsFeatureId id() const
Get the feature id for this feature.
void unionRect(const QgsRectangle &rect)
updates rectangle to include passed argument
A rectangle specified with double values.
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.
QgsGeometry * geometry() const
Get the geometry object associated with this feature.
static QgsNetworkAccessManager * instance()
Container of fields for a vector layer.
void setAttributes(const QgsAttributes &attrs)
bool setAttribute(int field, const QVariant &attr)
Set an attribute by id.
WkbType
Used for symbology operations.
void dataReadProgress(int progress)
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
static endian_t endian()
Returns whether this machine uses big or little endian.
static void logMessage(QString message, QString tag=QString::null, MessageLevel level=WARNING)
add a message to the instance (and create it if necessary)
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.
void setGeometry(const QgsGeometry &geom)
Set this feature's geometry from another QgsGeometry object (deep copy)
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)
A class to represent a point.
const QString GML_NAMESPACE
void setValid(bool validity)
Set the validity of the feature.
QgsRectangle boundingBox()
Returns the bounding box of this feature.
int getFeatures(const QString &uri, QGis::WkbType *wkbType, QgsRectangle *extent=0, const QString &userName=QString(), const QString &password=QString())
Does the Http GET request to the wfs server Supports only UTF-8, UTF-16, ISO-8859-1, ISO-8859-1 XML encodings.
Class for storing a coordinate reference system (CRS)
int size() const
Return number of items.
static QgsGeometry * fromRect(const QgsRectangle &rect)
construct geometry from a rectangle
QgsCoordinateReferenceSystem crs() const
Returns features spatial reference system.
void setGeometryAndOwnership(unsigned char *geom, size_t length)
Set this feature's geometry from WKB.