|
QGIS API Documentation
master-59fd5e0
|
#include <qgsgmlschema.h>
Collaboration diagram for QgsGmlSchema:Public Member Functions | |
| QgsGmlSchema () | |
| ~QgsGmlSchema () | |
| QList< QgsField > | fields (const QString &typeName) |
| Get map of fields parsed from XSD by parseXSD. | |
| QStringList | geometryAttributes (const QString &typeName) |
| Get list of geometry attributes for type/class name. | |
| bool | guessSchema (const QByteArray &data) |
| Guess GML schema from data if XSD does not exist. | |
| bool | parseXSD (const QByteArray &xml) |
| Get fields info from XSD. | |
| QStringList | typeNames () const |
| Get list of dot separated paths to feature classes parsed from GML or XSD. | |
Private Types | |
| enum | ParseMode { none, boundingBox, featureMember, feature, attribute, geometry } |
Private Member Functions | |
| void | characters (const XML_Char *chars, int len) |
| QDomElement | domElement (const QDomElement &element, const QString &path) |
| Get dom element by path. | |
| QDomElement | domElement (const QDomElement &element, const QString &path, const QString &attr, const QString &attrVal) |
| Get dom element by path and attribute value. | |
| QList< QDomElement > | domElements (const QDomElement &element, const QString &path) |
| Get dom elements by path. | |
| QList< QDomElement > | domElements (QList< QDomElement > &elements, const QString &attr, const QString &attrVal) |
| Filter list of elements by attribute value. | |
| void | endElement (const XML_Char *el) |
| QWidget * | findMainWindow () const |
| Returns pointer to main window or 0 if it does not exist. | |
| ParseMode | modeStackPop () |
| Safely (if empty) pop from mode stack. | |
| ParseMode | modeStackTop () |
| Get safely (if empty) top from mode stack. | |
| QString | readAttribute (const QString &attributeName, const XML_Char **attr) const |
| Reads attribute as string. | |
| void | startElement (const XML_Char *el, const XML_Char **attr) |
| XML handler methods. | |
| QString | stripNS (const QString &name) |
| Strip namespace from element name. | |
| QString | xsdComplexTypeGmlBaseType (const QDomElement &element, const QString &name) |
| Find GML base type for complex type of given name. | |
| bool | xsdFeatureClass (const QDomElement &element, const QString &typeName, QgsGmlFeatureClass &featureClass) |
| Get feature class information from complex type recursively. | |
Static Private Member Functions | |
| static void | chars (void *data, const XML_Char *chars, int len) |
| static void | end (void *data, const XML_Char *el) |
| static void | start (void *data, const XML_Char *el, const XML_Char **attr) |
Private Attributes | |
| QString | mAttributeName |
| QString | mCoordinateSeparator |
| Coordinate separator for coordinate strings. | |
| QgsFeature * | mCurrentFeature |
| QString | mCurrentFeatureId |
| QString | mCurrentFeatureName |
| QMap< QString, QgsGmlFeatureClass > | mFeatureClassMap |
| int | mFeatureCount |
| QStringList | mGeometryTypes |
| int | mLevel |
| Depth level, root element is 0. | |
| QStack< ParseMode > | mParseModeStack |
| Keep track about the most important nested elements. | |
| QStringList | mParsePathStack |
| Path to current level. | |
| int | mSkipLevel |
| Skip all levels under this. | |
| QString | mStringCash |
| This contains the character data if an important element has been encountered. | |
| QString | mTupleSeparator |
| Tuple separator for coordinate strings. | |
Definition at line 74 of file qgsgmlschema.h.
enum QgsGmlSchema::ParseMode [private] |
Definition at line 105 of file qgsgmlschema.h.
Definition at line 59 of file qgsgmlschema.cpp.
References mGeometryTypes.
Definition at line 67 of file qgsgmlschema.cpp.
| void QgsGmlSchema::characters | ( | const XML_Char * | chars, |
| int | len | ||
| ) | [private] |
Definition at line 500 of file qgsgmlschema.cpp.
References attribute, mLevel, modeStackTop(), mSkipLevel, and mStringCash.
| static void QgsGmlSchema::chars | ( | void * | data, |
| const XML_Char * | chars, | ||
| int | len | ||
| ) | [inline, static, private] |
Definition at line 127 of file qgsgmlschema.h.
Referenced by guessSchema().
| QDomElement QgsGmlSchema::domElement | ( | const QDomElement & | element, |
| const QString & | path | ||
| ) | [private] |
Get dom element by path.
Definition at line 306 of file qgsgmlschema.cpp.
References domElements().
Referenced by xsdComplexTypeGmlBaseType(), and xsdFeatureClass().
| QDomElement QgsGmlSchema::domElement | ( | const QDomElement & | element, |
| const QString & | path, | ||
| const QString & | attr, | ||
| const QString & | attrVal | ||
| ) | [private] |
Get dom element by path and attribute value.
Definition at line 324 of file qgsgmlschema.cpp.
References domElements().
| QList< QDomElement > QgsGmlSchema::domElements | ( | const QDomElement & | element, |
| const QString & | path | ||
| ) | [private] |
Get dom elements by path.
Definition at line 272 of file qgsgmlschema.cpp.
References stripNS().
Referenced by domElement(), parseXSD(), and xsdFeatureClass().
| QList< QDomElement > QgsGmlSchema::domElements | ( | QList< QDomElement > & | elements, |
| const QString & | attr, | ||
| const QString & | attrVal | ||
| ) | [private] |
Filter list of elements by attribute value.
Definition at line 311 of file qgsgmlschema.cpp.
| static void QgsGmlSchema::end | ( | void * | data, |
| const XML_Char * | el | ||
| ) | [inline, static, private] |
Definition at line 123 of file qgsgmlschema.h.
Referenced by guessSchema().
| void QgsGmlSchema::endElement | ( | const XML_Char * | el | ) | [private] |
Definition at line 419 of file qgsgmlschema.cpp.
References attribute, featureMember, fields(), geometryAttributes(), GML_NAMESPACE, mAttributeName, MathUtils::max(), mCurrentFeatureName, mFeatureClassMap, mLevel, modeStackPop(), modeStackTop(), mParseModeStack, mParsePathStack, mSkipLevel, mStringCash, NS_SEPARATOR, QgsDebugMsgLevel, QgsField::setType(), and QgsField::type().
| QList< QgsField > QgsGmlSchema::fields | ( | const QString & | typeName | ) |
Get map of fields parsed from XSD by parseXSD.
Get fields for type/class name parsed from GML or XSD
Definition at line 521 of file qgsgmlschema.cpp.
References mFeatureClassMap.
Referenced by endElement().
| QWidget* QgsGmlSchema::findMainWindow | ( | ) | const [private] |
Returns pointer to main window or 0 if it does not exist.
| QStringList QgsGmlSchema::geometryAttributes | ( | const QString & | typeName | ) |
Get list of geometry attributes for type/class name.
Definition at line 527 of file qgsgmlschema.cpp.
References mFeatureClassMap.
Referenced by endElement(), and startElement().
| bool QgsGmlSchema::guessSchema | ( | const QByteArray & | data | ) |
Guess GML schema from data if XSD does not exist.
Currently only recognizes UMN Mapserver GetFeatureInfo GML response.
| data | GML data |
Definition at line 330 of file qgsgmlschema.cpp.
References chars(), end(), MathUtils::max(), mLevel, mSkipLevel, NS_SEPARATOR, QgsDebugMsg, and start().
| ParseMode QgsGmlSchema::modeStackPop | ( | ) | [inline, private] |
Safely (if empty) pop from mode stack.
Definition at line 171 of file qgsgmlschema.h.
Referenced by endElement().
| ParseMode QgsGmlSchema::modeStackTop | ( | ) | [inline, private] |
Get safely (if empty) top from mode stack.
Definition at line 168 of file qgsgmlschema.h.
Referenced by characters(), endElement(), and startElement().
| bool QgsGmlSchema::parseXSD | ( | const QByteArray & | xml | ) |
Get fields info from XSD.
Definition at line 86 of file qgsgmlschema.cpp.
References domElements(), mFeatureClassMap, stripNS(), xsdComplexTypeGmlBaseType(), and xsdFeatureClass().
| QString QgsGmlSchema::readAttribute | ( | const QString & | attributeName, |
| const XML_Char ** | attr | ||
| ) | const [private] |
Reads attribute as string.
Definition at line 72 of file qgsgmlschema.cpp.
| static void QgsGmlSchema::start | ( | void * | data, |
| const XML_Char * | el, | ||
| const XML_Char ** | attr | ||
| ) | [inline, static, private] |
Definition at line 119 of file qgsgmlschema.h.
Referenced by guessSchema().
| void QgsGmlSchema::startElement | ( | const XML_Char * | el, |
| const XML_Char ** | attr | ||
| ) | [private] |
XML handler methods.
Definition at line 344 of file qgsgmlschema.cpp.
References attribute, feature, featureMember, geometryAttributes(), GML_NAMESPACE, mAttributeName, mCurrentFeatureName, mFeatureClassMap, mGeometryTypes, mLevel, modeStackTop(), mParseModeStack, mParsePathStack, mSkipLevel, mStringCash, NS_SEPARATOR, and QgsDebugMsgLevel.
| QString QgsGmlSchema::stripNS | ( | const QString & | name | ) | [private] |
Strip namespace from element name.
Definition at line 267 of file qgsgmlschema.cpp.
Referenced by domElements(), parseXSD(), xsdComplexTypeGmlBaseType(), and xsdFeatureClass().
| QStringList QgsGmlSchema::typeNames | ( | ) | const |
Get list of dot separated paths to feature classes parsed from GML or XSD.
Definition at line 516 of file qgsgmlschema.cpp.
References mFeatureClassMap.
| QString QgsGmlSchema::xsdComplexTypeGmlBaseType | ( | const QDomElement & | element, |
| const QString & | name | ||
| ) | [private] |
Find GML base type for complex type of given name.
| element | input element |
| name | complex type name |
Definition at line 244 of file qgsgmlschema.cpp.
References domElement(), and stripNS().
Referenced by parseXSD().
| bool QgsGmlSchema::xsdFeatureClass | ( | const QDomElement & | element, |
| const QString & | typeName, | ||
| QgsGmlFeatureClass & | featureClass | ||
| ) | [private] |
Get feature class information from complex type recursively.
Definition at line 129 of file qgsgmlschema.cpp.
References domElement(), domElements(), QgsGmlFeatureClass::fields(), QgsGmlFeatureClass::geometryAttributes(), mGeometryTypes, QgsDebugMsg, and stripNS().
Referenced by parseXSD().
QString QgsGmlSchema::mAttributeName [private] |
Definition at line 181 of file qgsgmlschema.h.
Referenced by endElement(), and startElement().
QString QgsGmlSchema::mCoordinateSeparator [private] |
Coordinate separator for coordinate strings.
Usually ","
Definition at line 183 of file qgsgmlschema.h.
QgsFeature* QgsGmlSchema::mCurrentFeature [private] |
Definition at line 178 of file qgsgmlschema.h.
QString QgsGmlSchema::mCurrentFeatureId [private] |
Definition at line 179 of file qgsgmlschema.h.
QString QgsGmlSchema::mCurrentFeatureName [private] |
Definition at line 198 of file qgsgmlschema.h.
Referenced by endElement(), and startElement().
QMap<QString, QgsGmlFeatureClass> QgsGmlSchema::mFeatureClassMap [private] |
Definition at line 204 of file qgsgmlschema.h.
Referenced by endElement(), fields(), geometryAttributes(), parseXSD(), startElement(), and typeNames().
int QgsGmlSchema::mFeatureCount [private] |
Definition at line 180 of file qgsgmlschema.h.
QStringList QgsGmlSchema::mGeometryTypes [private] |
Definition at line 201 of file qgsgmlschema.h.
Referenced by QgsGmlSchema(), startElement(), and xsdFeatureClass().
int QgsGmlSchema::mLevel [private] |
Depth level, root element is 0.
Definition at line 190 of file qgsgmlschema.h.
Referenced by characters(), endElement(), guessSchema(), and startElement().
QStack<ParseMode> QgsGmlSchema::mParseModeStack [private] |
Keep track about the most important nested elements.
Definition at line 175 of file qgsgmlschema.h.
Referenced by endElement(), and startElement().
QStringList QgsGmlSchema::mParsePathStack [private] |
Path to current level.
Definition at line 196 of file qgsgmlschema.h.
Referenced by endElement(), and startElement().
int QgsGmlSchema::mSkipLevel [private] |
Skip all levels under this.
Definition at line 193 of file qgsgmlschema.h.
Referenced by characters(), endElement(), guessSchema(), and startElement().
QString QgsGmlSchema::mStringCash [private] |
This contains the character data if an important element has been encountered.
Definition at line 177 of file qgsgmlschema.h.
Referenced by characters(), endElement(), and startElement().
QString QgsGmlSchema::mTupleSeparator [private] |