Пример #1
0
QDomElement QgsCurvePolygon::asGml2( QDomDocument &doc, int precision, const QString &ns, const AxisOrder axisOrder ) const
{
  // GML2 does not support curves
  QDomElement elemPolygon = doc.createElementNS( ns, QStringLiteral( "Polygon" ) );

  if ( isEmpty() )
    return elemPolygon;

  QDomElement elemOuterBoundaryIs = doc.createElementNS( ns, QStringLiteral( "outerBoundaryIs" ) );
  std::unique_ptr< QgsLineString > exteriorLineString( exteriorRing()->curveToLine() );
  QDomElement outerRing = exteriorLineString->asGml2( doc, precision, ns, axisOrder );
  outerRing.toElement().setTagName( QStringLiteral( "LinearRing" ) );
  elemOuterBoundaryIs.appendChild( outerRing );
  elemPolygon.appendChild( elemOuterBoundaryIs );
  std::unique_ptr< QgsLineString > interiorLineString;
  for ( int i = 0, n = numInteriorRings(); i < n; ++i )
  {
    QDomElement elemInnerBoundaryIs = doc.createElementNS( ns, QStringLiteral( "innerBoundaryIs" ) );
    interiorLineString.reset( interiorRing( i )->curveToLine() );
    QDomElement innerRing = interiorLineString->asGml2( doc, precision, ns, axisOrder );
    innerRing.toElement().setTagName( QStringLiteral( "LinearRing" ) );
    elemInnerBoundaryIs.appendChild( innerRing );
    elemPolygon.appendChild( elemInnerBoundaryIs );
  }
  return elemPolygon;
}
Пример #2
0
QDomElement QgsCurvePolygon::asGml3( QDomDocument &doc, int precision, const QString &ns, const QgsAbstractGeometry::AxisOrder axisOrder ) const
{
  QDomElement elemCurvePolygon = doc.createElementNS( ns, QStringLiteral( "Polygon" ) );

  if ( isEmpty() )
    return elemCurvePolygon;

  QDomElement elemExterior = doc.createElementNS( ns, QStringLiteral( "exterior" ) );
  QDomElement curveElem = exteriorRing()->asGml3( doc, precision, ns, axisOrder );
  if ( curveElem.tagName() == QLatin1String( "LineString" ) )
  {
    curveElem.setTagName( QStringLiteral( "LinearRing" ) );
  }
  elemExterior.appendChild( curveElem );
  elemCurvePolygon.appendChild( elemExterior );

  for ( int i = 0, n = numInteriorRings(); i < n; ++i )
  {
    QDomElement elemInterior = doc.createElementNS( ns, QStringLiteral( "interior" ) );
    QDomElement innerRing = interiorRing( i )->asGml3( doc, precision, ns, axisOrder );
    if ( innerRing.tagName() == QLatin1String( "LineString" ) )
    {
      innerRing.setTagName( QStringLiteral( "LinearRing" ) );
    }
    elemInterior.appendChild( innerRing );
    elemCurvePolygon.appendChild( elemInterior );
  }
  return elemCurvePolygon;
}
Пример #3
0
bool QgsWFSProvider::deleteFeatures( const QgsFeatureIds &id )
{
  if ( id.size() < 1 )
  {
    return true;
  }

  //find out typename from uri and strip namespace prefix
  QString tname = mShared->mURI.typeName();
  if ( tname.isNull() )
  {
    return false;
  }

  //create <Transaction> xml
  QDomDocument transactionDoc;
  QDomElement transactionElem = createTransactionElement( transactionDoc );
  transactionDoc.appendChild( transactionElem );
  //delete element
  QDomElement deleteElem = transactionDoc.createElementNS( QgsWFSConstants::WFS_NAMESPACE, "Delete" );
  deleteElem.setAttribute( "typeName", tname );
  QDomElement filterElem = transactionDoc.createElementNS( QgsWFSConstants::OGC_NAMESPACE, "Filter" );


  QgsFeatureIds::const_iterator idIt = id.constBegin();
  for ( ; idIt != id.constEnd(); ++idIt )
  {
    //find out feature id
    QString gmlid = mShared->findGmlId( *idIt );
    if ( gmlid.isEmpty() )
    {
      QgsDebugMsg( QString( "Cannot identify feature of id %1" ).arg( *idIt ) );
      continue;
    }
    QDomElement featureIdElem = transactionDoc.createElementNS( QgsWFSConstants::OGC_NAMESPACE, "FeatureId" );
    featureIdElem.setAttribute( "fid", gmlid );
    filterElem.appendChild( featureIdElem );
  }

  deleteElem.appendChild( filterElem );
  transactionElem.appendChild( deleteElem );

  QDomDocument serverResponse;
  bool success = sendTransactionDocument( transactionDoc, serverResponse );
  if ( !success )
  {
    return false;
  }

  if ( transactionSuccess( serverResponse ) )
  {
    mShared->deleteFeatures( id );
    return true;
  }
  else
  {
    handleException( serverResponse );
    return false;
  }
}
Пример #4
0
/**
	\brief Writes the error to XML

	This function creates an error element representing the error object.

	You need to provide the base namespace of the stream to which this stanza belongs to
	(probably by using stream.baseNS() function).
*/
QDomElement Stanza::Error::toXml(QDomDocument &doc, const QString &baseNS) const
{
	QDomElement errElem = doc.createElementNS(baseNS, "error");
	QDomElement t;

	// XMPP error
	QString stype = Private::errorTypeToString(type);
	if(stype.isEmpty())
		return errElem;
	QString scond = Private::errorCondToString(condition);
	if(scond.isEmpty())
		return errElem;

	errElem.setAttribute("type", stype);
	errElem.appendChild(t = doc.createElementNS(NS_STANZAS, scond));
	t.setAttribute("xmlns", NS_STANZAS);	// FIX-ME: this shouldn't be needed

	// old code
	int scode = code();
	if(scode)
		errElem.setAttribute("code", scode);

	// text
	if(!text.isEmpty()) {
		t = doc.createElementNS(NS_STANZAS, "text");
		t.setAttribute("xmlns", NS_STANZAS);	// FIX-ME: this shouldn't be needed
		t.appendChild(doc.createTextNode(text));
		errElem.appendChild(t);
	}

	// application specific
	errElem.appendChild(appSpec);

	return errElem;
}
Пример #5
0
int QgsSOAPRequestHandler::setSOAPWithAttachments( QImage* img )
{
  QgsDebugMsg( "Entering." );
  //create response xml document
  QDomDocument xmlResponse; //response xml, save this into mimeString
  QDomElement envelopeElement = xmlResponse.createElementNS( "http://schemas.xmlsoap.org/soap/envelope/", "Envelope" );
  xmlResponse.appendChild( envelopeElement );
  QDomElement bodyElement = xmlResponse.createElementNS( "http://schemas.xmlsoap.org/soap/envelope/", "Body" );
  envelopeElement.appendChild( bodyElement );
  QDomElement getMapResponseElement = xmlResponse.createElementNS( "http://www.eu-orchestra.org/services/ms", "getMapResponse" );
  bodyElement.appendChild( getMapResponseElement );
  QDomElement returnElement = xmlResponse.createElementNS( "http://www.eu-orchestra.org/services/ms", "return" );
  returnElement.setAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" );
  returnElement.setAttribute( "xsi:type", "OA_ImageDocument" );
  returnElement.setAttribute( "href", "image@mapservice" );
  getMapResponseElement.appendChild( returnElement );

  //create image buffer
  QByteArray ba;
  QBuffer buffer( &ba );
  buffer.open( QIODevice::WriteOnly );
  img->save( &buffer, mFormat.toLocal8Bit().data(), -1 ); // writes image into ba

  QByteArray xmlByteArray = xmlResponse.toString().toLocal8Bit();

  // Set headers
  setHeader( "MIME-Version", "1.0" );
  setHeader( "Content-Type", "Multipart/Related; boundary=\"MIME_boundary\"; type=\"text/xml\"; start=\"<xml@mapservice>\"" );
  // Start body
  appendBody( "--MIME_boundary\r\n" );
  appendBody( "Content-Type: text/xml\n" );
  appendBody( "Content-ID: <xml@mapservice>\n" );
  appendBody( "\n" );
  appendBody( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" );
  appendBody( xmlByteArray );
  appendBody( "\n" );
  appendBody( "\r\n" );
  appendBody( "--MIME_boundary\r\n" );
  if ( mFormat == "JPG" )
  {
    appendBody( "Content-Type: image/jpg\n" );
  }
  else if ( mFormat == "PNG" )
  {
    appendBody( "Content-Type: image/png\n" );
  }
  appendBody( "Content-Transfer-Encoding: binary\n" );
  appendBody( "Content-ID: <image@mapservice>\n" );
  appendBody( "\n" );
  appendBody( ba );
  appendBody( "\r\n" );
  appendBody( "--MIME_boundary\r\n" );

  return 0;
}
Пример #6
0
QDomElement PhotoItem::toSvg(QDomDocument & document) const
{
    QDomElement result = AbstractPhoto::toSvg(document);
    result.setAttribute("class", "PhotoItem");

    // 'defs' tag
    QDomElement defs = document.createElement("defs");
    defs.setAttribute("class", "data");
    result.appendChild(defs);

    // 'defs'-> pfe:'data'
    QDomElement appNS = document.createElementNS(KIPIPhotoLayoutsEditor::uri(), "data");
    appNS.setPrefix(KIPIPhotoLayoutsEditor::name());
    defs.appendChild(appNS);

    if (!m_image_path.isEmpty())
    {
        // 'defs'-> pfe:'data' ->'path'
        QDomElement path = KIPIPhotoLayoutsEditor::pathToSvg(m_image_path, document);
        path.setAttribute("class", "m_image_path");
        path.setPrefix(KIPIPhotoLayoutsEditor::name());
        appNS.appendChild(path);
    }

    QDomElement image = document.createElementNS(KIPIPhotoLayoutsEditor::uri(), "image");
    appNS.appendChild(image);
    // Saving image data
    if (!PLEConfigSkeleton::embedImagesData())
    {
        int result = KMessageBox::questionYesNo(0,
                                                i18n("Do you want to embed images data?\n"
                                                        "Remember that when you move or rename image files on your disk or the storage device become unavailable, those images become unavailable for %1 "
                                                        "and this layout might become broken.", KApplication::applicationName()),
                                                i18n("Saving: %1", this->name()),
                                                KStandardGuiItem::yes(),
                                                KStandardGuiItem::no(),
                                                PLEConfigSkeleton::self()->config()->name());
        if (result == KMessageBox::Yes)
            PLEConfigSkeleton::setEmbedImagesData(true);
    }

    if ( (PLEConfigSkeleton::embedImagesData() && !d->pixmap().isNull()) || !d->fileUrl().isValid())
    {
        QByteArray byteArray;
        QBuffer buffer(&byteArray);
        d->pixmap().save(&buffer, "PNG");
        image.appendChild( document.createTextNode( QString(byteArray.toBase64()) ) );
    }

    // Saving image path
    if (d->fileUrl().isValid())
        image.setAttribute("src", d->fileUrl().url());

    return result;
}
QDomElement QgsGeometryCollection::asGml3( QDomDocument &doc, int precision, const QString &ns, const QgsAbstractGeometry::AxisOrder axisOrder ) const
{
  QDomElement elemMultiGeometry = doc.createElementNS( ns, QStringLiteral( "MultiGeometry" ) );
  for ( const QgsAbstractGeometry *geom : mGeometries )
  {
    QDomElement elemGeometryMember = doc.createElementNS( ns, QStringLiteral( "geometryMember" ) );
    elemGeometryMember.appendChild( geom->asGml3( doc, precision, ns, axisOrder ) );
    elemMultiGeometry.appendChild( elemGeometryMember );
  }
  return elemMultiGeometry;
}
Пример #8
0
QDomElement QgsCircularString::asGML3( QDomDocument &doc, int precision, const QString &ns ) const
{
  QgsPointSequence pts;
  points( pts );

  QDomElement elemCurve = doc.createElementNS( ns, QStringLiteral( "Curve" ) );
  QDomElement elemSegments = doc.createElementNS( ns, QStringLiteral( "segments" ) );
  QDomElement elemArcString = doc.createElementNS( ns, QStringLiteral( "ArcString" ) );
  elemArcString.appendChild( QgsGeometryUtils::pointsToGML3( pts, doc, precision, ns, is3D() ) );
  elemSegments.appendChild( elemArcString );
  elemCurve.appendChild( elemSegments );
  return elemCurve;
}
Пример #9
0
QDomElement QgsLineStringV2::asGML3( QDomDocument& doc, int precision, const QString& ns ) const
{
  QList<QgsPointV2> pts;
  points( pts );

  QDomElement elemCurve = doc.createElementNS( ns, "Curve" );
  QDomElement elemSegments = doc.createElementNS( ns, "segments" );
  QDomElement elemArcString = doc.createElementNS( ns, "LineStringSegment" );
  elemArcString.appendChild( QgsGeometryUtils::pointsToGML3( pts, doc, precision, ns, is3D() ) );
  elemSegments.appendChild( elemArcString );
  elemCurve.appendChild( elemSegments );

  return elemCurve;
}
Пример #10
0
QDomElement QgsMultiSurface::asGML3( QDomDocument &doc, int precision, const QString &ns ) const
{
  QDomElement elemMultiSurface = doc.createElementNS( ns, QStringLiteral( "MultiSurface" ) );
  for ( const QgsAbstractGeometry *geom : mGeometries )
  {
    if ( qgsgeometry_cast<const QgsSurface *>( geom ) )
    {
      QDomElement elemSurfaceMember = doc.createElementNS( ns, QStringLiteral( "surfaceMember" ) );
      elemSurfaceMember.appendChild( geom->asGML3( doc, precision, ns ) );
      elemMultiSurface.appendChild( elemSurfaceMember );
    }
  }

  return elemMultiSurface;
}
Пример #11
0
QDomElement QgsMultiPointV2::asGML3( QDomDocument &doc, int precision, const QString &ns ) const
{
  QDomElement elemMultiPoint = doc.createElementNS( ns, QStringLiteral( "MultiPoint" ) );
  Q_FOREACH ( const QgsAbstractGeometry *geom, mGeometries )
  {
    if ( dynamic_cast<const QgsPointV2 *>( geom ) )
    {
      QDomElement elemPointMember = doc.createElementNS( ns, QStringLiteral( "pointMember" ) );
      elemPointMember.appendChild( geom->asGML3( doc, precision, ns ) );
      elemMultiPoint.appendChild( elemPointMember );
    }
  }

  return elemMultiPoint;
}
Пример #12
0
QDomElement QgsMultiPolygonV2::asGML3( QDomDocument& doc, int precision, const QString& ns ) const
{
    QDomElement elemMultiSurface = doc.createElementNS( ns, "MultiPolygon" );
    Q_FOREACH ( const QgsAbstractGeometryV2 *geom, mGeometries )
    {
        if ( dynamic_cast<const QgsPolygonV2*>( geom ) )
        {
            QDomElement elemSurfaceMember = doc.createElementNS( ns, "polygonMember" );
            elemSurfaceMember.appendChild( geom->asGML3( doc, precision, ns ) );
            elemMultiSurface.appendChild( elemSurfaceMember );
        }
    }

    return elemMultiSurface;
}
Пример #13
0
bool XmlNotation::write(const std::vector<Moves> &mv)
{
    QDomDocument doc;

    auto proc = doc.createProcessingInstruction(
            u8"xml", u8"version=\"1.0\" encoding=\"utf-8\"");
    doc.appendChild(proc);

    auto cAuthors = doc.createComment(fromU8Str(impl::comment));
    doc.appendChild(cAuthors), doc.appendChild(doc.createTextNode("\n"));

    auto eRoot = doc.createElementNS(fromU8Str(impl::xmlns),
                                     fromU8Str(impl::eRoot));
    doc.appendChild(eRoot);

    for (auto &i : mv) {
        auto eTurn = doc.createElement(fromU8Str(impl::eTurn));
        eRoot.appendChild(eTurn);

        eTurn.setAttribute(fromU8Str(impl::aWhite),
            QString::fromStdString(i.white_move.to_string()));

        eTurn.setAttribute(fromU8Str(impl::aBlack),
            QString::fromStdString(i.black_move.to_string()));
    }

    QByteArray raw = doc.toByteArray(4);

    std::ofstream f(_pImpl->fileName,
                    std::ios_base::binary |
                    std::ios_base::trunc);
    f.write(raw.data(), raw.count());

    return true;
}
Пример #14
0
QDomElement QgsMultiPolygonV2::asGML2( QDomDocument& doc, int precision, const QString& ns ) const
{
    // GML2 does not support curves
    QDomElement elemMultiPolygon = doc.createElementNS( ns, "MultiPolygon" );
    Q_FOREACH ( const QgsAbstractGeometryV2 *geom, mGeometries )
    {
        if ( dynamic_cast<const QgsPolygonV2*>( geom ) )
        {
            QDomElement elemPolygonMember = doc.createElementNS( ns, "polygonMember" );
            elemPolygonMember.appendChild( geom->asGML2( doc, precision, ns ) );
            elemMultiPolygon.appendChild( elemPolygonMember );
        }
    }

    return elemMultiPolygon;
}
Пример #15
0
QDomElement QgsWFSServer::createPolygonElem( QgsGeometry* geom, QDomDocument& doc ) const
{
  if ( !geom )
  {
    return QDomElement();
  }

  QDomElement polygonElem = doc.createElement( "gml:Polygon" );
  QgsPolygon poly = geom->asPolygon();
  for ( int i = 0; i < poly.size(); ++i )
  {
    QString boundaryName;
    if ( i == 0 )
    {
      boundaryName = "outerBoundaryIs";
    }
    else
    {
      boundaryName = "innerBoundaryIs";
    }
    QDomElement boundaryElem = doc.createElementNS( "http://www.opengis.net/gml", boundaryName );
    QDomElement ringElem = doc.createElement( "gml:LinearRing" );
    QDomElement coordElem = createCoordinateElem( poly.at( i ), doc );
    ringElem.appendChild( coordElem );
    boundaryElem.appendChild( ringElem );
    polygonElem.appendChild( boundaryElem );
  }
  return polygonElem;
}
Пример #16
0
void SoapBinding::Header::saveXML(ParserContext *context, QDomDocument &document, QDomElement &parent) const
{
    QDomElement element = document.createElementNS(soapStandardNamespace, soapPrefix(context) + QLatin1String("header"));
    parent.appendChild(element);

    if (!mMessage.isEmpty()) {
        element.setAttribute(QLatin1String("message"), mMessage.qname());
    } else {
        context->messageHandler()->warning(QLatin1String("SoapBinding::Header: 'message' required"));
    }

    if (!mPart.isEmpty()) {
        element.setAttribute(QLatin1String("part"), mPart);
    } else {
        context->messageHandler()->warning(QLatin1String("SoapBinding::Header: 'part' required"));
    }

#if 0
    if (!mEncodingStyle.isEmpty()) {
        element.setAttribute("encodingStyle", mEncodingStyle);
    }
#endif
    if (!mNameSpace.isEmpty()) {
        element.setAttribute(QLatin1String("namespace"), mNameSpace);
    }

    if (mUse == LiteralUse) {
        element.setAttribute(QLatin1String("use"), QLatin1String("literal"));
    } else {
        element.setAttribute(QLatin1String("use"), QLatin1String("encoded"));
    }

    mHeaderFault.saveXML(context, document, element);
}
Пример #17
0
void WbManager::removeSession(const QString &session) {
	WbDlg* d;
	for(int i = 0; i < dialogs_.size(); i++) {
		// does the session match?
		if(dialogs_.at(i)->session() == session) {
			d = dialogs_.takeAt(i);

			QDomDocument doc;
			QDomElement wb = doc.createElementNS("http://jabber.org/protocol/svgwb", "wb");
			wb.setAttribute("session", session);
			QDomElement protocol = doc.createElement("protocol");
			protocol.appendChild(doc.createElement("left-session"));
			wb.appendChild(protocol);
			sendMessage(wb, d->target(), d->groupChat());
			break;
		}
	}
	if(d) {
		if(negotiations_.contains(session)) {
			sendAbortNegotiation(session, negotiations_[session]->peer, d->groupChat());
			negotiations_.remove(session);
		}
		// FIXME: Delete the dialog
		d->setAttribute(Qt::WA_DeleteOnClose);
		d->close();
//		d->deleteLater();

	}
}
Пример #18
0
void SoapBinding::HeaderFault::saveXML( ParserContext *context, QDomDocument &document, QDomElement &parent ) const
{
  QDomElement element = document.createElementNS( soapStandardNamespace, soapPrefix( context ) + "headerfault" );
  parent.appendChild( element );

  if ( !mMessage.isEmpty() )
    element.setAttribute( "message", mMessage.qname() );
  else
    context->messageHandler()->warning( "SoapBinding::HeaderFault: 'message' required" );

  if ( !mPart.isEmpty() )
    element.setAttribute( "part", mPart );
  else
    context->messageHandler()->warning( "SoapBinding::HeaderFault: 'part' required" );

  if ( !mEncodingStyle.isEmpty() )
    element.setAttribute( "encodingStyle", mEncodingStyle );
  if ( !mNameSpace.isEmpty() )
    element.setAttribute( "namespace", mNameSpace );

  if ( mUse == LiteralUse )
    element.setAttribute( "use", "literal" );
  else
    element.setAttribute( "use", "encoded" );
}
Пример #19
0
QDomElement QDomDocumentProto::createElementNS(const QString& nsURI, const QString& qName)
{
    QDomDocument *item = qscriptvalue_cast<QDomDocument*>(thisObject());
    if (item)
        return item->createElementNS(nsURI, qName);
    return QDomElement();
}
Пример #20
0
QDomElement QgsWFSProvider::createTransactionElement( QDomDocument& doc ) const
{
  QDomElement transactionElem = doc.createElementNS( QgsWFSConstants::WFS_NAMESPACE, "Transaction" );
  transactionElem.setAttribute( "version", "1.0.0" );
  transactionElem.setAttribute( "service", "WFS" );
  transactionElem.setAttribute( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" );

  QUrl describeFeatureTypeURL( mShared->mURI.baseURL() );
  // For tests (since the URL contains part of random data, we need to replace it with a fixed content)
  if ( mShared->mURI.baseURL().toString().contains( "fake_qgis_http_endpoint" ) )
    describeFeatureTypeURL = QUrl( "http://fake_qgis_http_endpoint" );
  describeFeatureTypeURL.addQueryItem( "REQUEST", "DescribeFeatureType" );
  describeFeatureTypeURL.addQueryItem( "VERSION", "1.0.0" );
  describeFeatureTypeURL.addQueryItem( "TYPENAME", mShared->mURI.typeName() );

  transactionElem.setAttribute( "xsi:schemaLocation", mApplicationNamespace + ' '
                                + describeFeatureTypeURL.toEncoded() );

  QString namespacePrefix = nameSpacePrefix( mShared->mURI.typeName() );
  if ( !namespacePrefix.isEmpty() )
  {
    transactionElem.setAttribute( "xmlns:" + namespacePrefix, mApplicationNamespace );
  }
  transactionElem.setAttribute( "xmlns:gml", QgsWFSConstants::GML_NAMESPACE );

  return transactionElem;
}
Пример #21
0
/**
 In a document doc with node node, add an element with namespace ns and tagname tag. Add a textnode in
 the element with text contents text. Return the new element.
 */
QDomElement addElement( QDomDocument& doc, QDomNode& node, const QString& ns, const QString& tag, const QString& text )
{
  QDomElement el = doc.createElementNS( ns, tag );
  QDomText textnode = doc.createTextNode( text );
  el.appendChild( textnode );
  node.appendChild( el );
  return el;
}
Пример #22
0
QDomElement QgsCompoundCurve::asGml3( QDomDocument &doc, int precision, const QString &ns, const QgsAbstractGeometry::AxisOrder axisOrder ) const
{
  QDomElement compoundCurveElem = doc.createElementNS( ns, QStringLiteral( "CompositeCurve" ) );

  if ( isEmpty() )
    return compoundCurveElem;

  for ( const QgsCurve *curve : mCurves )
  {
    QDomElement curveMemberElem = doc.createElementNS( ns, QStringLiteral( "curveMember" ) );
    QDomElement curveElem = curve->asGml3( doc, precision, ns, axisOrder );
    curveMemberElem.appendChild( curveElem );
    compoundCurveElem.appendChild( curveMemberElem );
  }

  return compoundCurveElem;
}
Пример #23
0
QDomElement QgsMultiCurveV2::asGML3( QDomDocument& doc, int precision, const QString& ns ) const
{
  QDomElement elemMultiCurve = doc.createElementNS( ns, "MultiCurve" );
  Q_FOREACH ( const QgsAbstractGeometryV2 *geom, mGeometries )
  {
    if ( dynamic_cast<const QgsCurveV2*>( geom ) )
    {
      const QgsCurveV2* curve = static_cast<const QgsCurveV2*>( geom );

      QDomElement elemCurveMember = doc.createElementNS( ns, "curveMember" );
      elemCurveMember.appendChild( curve->asGML3( doc, precision, ns ) );
      elemMultiCurve.appendChild( elemCurveMember );
    }
  }

  return elemMultiCurve;
}
Пример #24
0
QDomElement QgsMultiLineString::asGML3( QDomDocument &doc, int precision, const QString &ns ) const
{
  QDomElement elemMultiCurve = doc.createElementNS( ns, QStringLiteral( "MultiCurve" ) );
  Q_FOREACH ( const QgsAbstractGeometry *geom, mGeometries )
  {
    if ( qgsgeometry_cast<const QgsLineString *>( geom ) )
    {
      const QgsLineString *lineString = static_cast<const QgsLineString *>( geom );

      QDomElement elemCurveMember = doc.createElementNS( ns, QStringLiteral( "curveMember" ) );
      elemCurveMember.appendChild( lineString->asGML3( doc, precision, ns ) );
      elemMultiCurve.appendChild( elemCurveMember );
    }
  }

  return elemMultiCurve;
}
Пример #25
0
QDomElement QgsLineString::asGML3( QDomDocument& doc, int precision, const QString& ns ) const
{
  QgsPointSequence pts;
  points( pts );

  QDomElement elemLineString = doc.createElementNS( ns, QStringLiteral( "LineString" ) );
  elemLineString.appendChild( QgsGeometryUtils::pointsToGML3( pts, doc, precision, ns, is3D() ) );
  return elemLineString;
}
Пример #26
0
QDomElement QgsMultiSurface::asGML2( QDomDocument &doc, int precision, const QString &ns ) const
{
  // GML2 does not support curves
  QDomElement elemMultiPolygon = doc.createElementNS( ns, QStringLiteral( "MultiPolygon" ) );
  for ( const QgsAbstractGeometry *geom : mGeometries )
  {
    if ( qgsgeometry_cast<const QgsSurface *>( geom ) )
    {
      std::unique_ptr< QgsPolygonV2 > polygon( static_cast<const QgsSurface *>( geom )->surfaceToPolygon() );

      QDomElement elemPolygonMember = doc.createElementNS( ns, QStringLiteral( "polygonMember" ) );
      elemPolygonMember.appendChild( polygon->asGML2( doc, precision, ns ) );
      elemMultiPolygon.appendChild( elemPolygonMember );
    }
  }

  return elemMultiPolygon;
}
Пример #27
0
QDomElement QgsMultiLineStringV2::asGML2( QDomDocument& doc, int precision, const QString& ns ) const
{
  QDomElement elemMultiLineString = doc.createElementNS( ns, "MultiLineString" );
  Q_FOREACH ( const QgsAbstractGeometryV2 *geom, mGeometries )
  {
    if ( dynamic_cast<const QgsLineStringV2*>( geom ) )
    {
      const QgsLineStringV2* lineString = static_cast<const QgsLineStringV2*>( geom );

      QDomElement elemLineStringMember = doc.createElementNS( ns, "lineStringMember" );
      elemLineStringMember.appendChild( lineString->asGML2( doc, precision, ns ) );
      elemMultiLineString.appendChild( elemLineStringMember );

      delete lineString;
    }
  }

  return elemMultiLineString;
}
Пример #28
0
QDomElement SxeRecordEdit::xml(QDomDocument &doc) const {
	QDomElement edit = doc.createElementNS(SXENS, "set");

	edit.setAttribute("rid", rid_);
	edit.setAttribute("version", version_);
	foreach(Key key, changes_.keys())
		edit.setAttribute(keyToString(key), changes_[key]);

	return edit;
}
Пример #29
0
QDomElement QgsLineStringV2::asGML2( QDomDocument& doc, int precision, const QString& ns ) const
{
  QList<QgsPointV2> pts;
  points( pts );

  QDomElement elemLineString = doc.createElementNS( ns, "LineString" );
  elemLineString.appendChild( QgsGeometryUtils::pointsToGML2( pts, doc, precision, ns ) );

  return elemLineString;
}
Пример #30
0
QDomElement QgsMultiLineString::asGml3( QDomDocument &doc, int precision, const QString &ns, const QgsAbstractGeometry::AxisOrder axisOrder ) const
{
  QDomElement elemMultiCurve = doc.createElementNS( ns, QStringLiteral( "MultiCurve" ) );

  if ( isEmpty() )
    return elemMultiCurve;

  for ( const QgsAbstractGeometry *geom : mGeometries )
  {
    if ( const QgsLineString *lineString = qgsgeometry_cast<const QgsLineString *>( geom ) )
    {
      QDomElement elemCurveMember = doc.createElementNS( ns, QStringLiteral( "curveMember" ) );
      elemCurveMember.appendChild( lineString->asGml3( doc, precision, ns, axisOrder ) );
      elemMultiCurve.appendChild( elemCurveMember );
    }
  }

  return elemMultiCurve;
}