Skip to content

Commit

Permalink
Simplifying QgsOgcUtils
Browse files Browse the repository at this point in the history
After commit 7d66529 Add GML3 to
QgsOgcUtils, I have to simplify this class to only have :
* geometryFromGML : read GML2 or GML3
* geometryToGML : create GML2 (as default) or GML3
  • Loading branch information
rldhont committed Mar 13, 2013
1 parent a915c41 commit 93e0259
Show file tree
Hide file tree
Showing 9 changed files with 717 additions and 1,361 deletions.
34 changes: 12 additions & 22 deletions python/core/qgsogcutils.sip
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,32 @@ class QgsOgcUtils

public:

/** static method that creates geometry from GML2
/** static method that creates geometry from GML
@param XML representation of the geometry. GML elements are expected to be
in default namespace (<Point>...</Point>) or in "gml" namespace (<gml:Point>...</gml:Point>)
@note added in 1.9
*/
static QgsGeometry* geometryFromGML2( const QString& xmlString ) /Factory/;
static QgsGeometry* geometryFromGML( const QString& xmlString ) /Factory/;

/** static method that creates geometry from GML2
/** static method that creates geometry from GML
@note added in 1.9
*/
static QgsGeometry* geometryFromGML2( const QDomNode& geometryNode ) /Factory/;

/** Exports the geometry to mGML2
@return true in case of success and false else
*/
static QDomElement geometryToGML2( QgsGeometry* geometry, QDomDocument& doc );
static QgsGeometry* geometryFromGML( const QDomNode& geometryNode ) /Factory/;

/** read rectangle from GML2 Box */
static QgsRectangle rectangleFromGMLBox( const QDomNode& boxNode );

/** read rectangle from GML3 Envelope */
static QgsRectangle rectangleFromGMLEnvelope( const QDomNode& envelopeNode );

/** static method that creates geometry from GML3
@param XML representation of the geometry. GML elements are expected to be
in default namespace (<Point>...</Point>) or in "gml" namespace (<gml:Point>...</gml:Point>)
/** Exports the geometry to GML2
@return QDomElement
*/
static QgsGeometry* geometryFromGML3( const QString& xmlString );
static QDomElement geometryToGML( QgsGeometry* geometry, QDomDocument& doc );

/** static method that creates geometry from GML2
*/
static QgsGeometry* geometryFromGML3( const QDomNode& geometryNode );
/** Exports the geometry to mGML3
@return true in case of success and false else
/** Exports the geometry to GML2 or GML3
@return QDomElement
*/
static QDomElement geometryToGML3( QgsGeometry* geometry, QDomDocument& doc );

/** read rectangle from GML3 Envelope */
static QgsRectangle rectangleFromGMLEnvelope( const QDomNode& envelopeNode );
static QDomElement geometryToGML( QgsGeometry* geometry, QDomDocument& doc, QString Format );
};

4 changes: 2 additions & 2 deletions src/core/qgsexpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ static QVariant fcnGeomFromWKT( const QVariantList& values, QgsFeature*, QgsExpr
static QVariant fcnGeomFromGML2( const QVariantList& values, QgsFeature*, QgsExpression* parent )
{
QString gml = getStringValue( values.at( 0 ), parent );
QgsGeometry* geom = QgsOgcUtils::geometryFromGML2( gml );
QgsGeometry* geom = QgsOgcUtils::geometryFromGML( gml );

if ( geom )
return QVariant::fromValue( *geom );
Expand Down Expand Up @@ -2271,7 +2271,7 @@ void QgsExpression::NodeFunction::toOgcFilter( QDomDocument &doc, QDomElement &e
{
QgsGeometry* geom = QgsGeometry::fromWkt( childElem.firstChildElement().text() );
if ( geom )
funcElem.appendChild( QgsOgcUtils::geometryToGML2( geom, doc ) );
funcElem.appendChild( QgsOgcUtils::geometryToGML( geom, doc ) );
delete geom;
}
else if ( childElem.attribute( "name" ) == "geomFromGML2" )
Expand Down
Loading

0 comments on commit 93e0259

Please sign in to comment.