Пример #1
0
QString QgsCurvePolygon::asWkt( int precision ) const
{
  QString wkt = wktTypeStr() + " (";
  if ( mExteriorRing )
  {
    QString childWkt = mExteriorRing->asWkt( precision );
    if ( qgsgeometry_cast<QgsLineString *>( mExteriorRing.get() ) )
    {
      // Type names of linear geometries are omitted
      childWkt = childWkt.mid( childWkt.indexOf( '(' ) );
    }
    wkt += childWkt + ',';
  }
  for ( const QgsCurve *curve : mInteriorRings )
  {
    QString childWkt = curve->asWkt( precision );
    if ( qgsgeometry_cast<const QgsLineString *>( curve ) )
    {
      // Type names of linear geometries are omitted
      childWkt = childWkt.mid( childWkt.indexOf( '(' ) );
    }
    wkt += childWkt + ',';
  }
  if ( wkt.endsWith( ',' ) )
  {
    wkt.chop( 1 ); // Remove last ','
  }
  wkt += ')';
  return wkt;
}
Пример #2
0
QString QgsLineStringV2::asWkt( int precision ) const
{
  QString wkt = wktTypeStr() + ' ';
  QList<QgsPointV2> pts;
  points( pts );
  wkt += QgsGeometryUtils::pointsToWKT( pts, precision, is3D(), isMeasure() );
  return wkt;
}
Пример #3
0
QString QgsCircularString::asWkt( int precision ) const
{
  QString wkt = wktTypeStr() + ' ';
  QgsPointSequence pts;
  points( pts );
  wkt += QgsGeometryUtils::pointsToWKT( pts, precision, is3D(), isMeasure() );
  return wkt;
}
QString QgsGeometryCollection::asWkt( int precision ) const
{
  QString wkt = wktTypeStr() + " (";
  for ( const QgsAbstractGeometry *geom : mGeometries )
  {
    QString childWkt = geom->asWkt( precision );
    if ( wktOmitChildType() )
    {
      childWkt = childWkt.mid( childWkt.indexOf( '(' ) );
    }
    wkt += childWkt + ',';
  }
  if ( wkt.endsWith( ',' ) )
  {
    wkt.chop( 1 ); // Remove last ','
  }
  wkt += ')';
  return wkt;
}
Пример #5
0
QString QgsCompoundCurve::asWkt( int precision ) const
{
  QString wkt = wktTypeStr() + QLatin1String( " (" );
  for ( const QgsCurve *curve : mCurves )
  {
    QString childWkt = curve->asWkt( precision );
    if ( qgsgeometry_cast<const QgsLineString *>( curve ) )
    {
      // Type names of linear geometries are omitted
      childWkt = childWkt.mid( childWkt.indexOf( '(' ) );
    }
    wkt += childWkt + ',';
  }
  if ( wkt.endsWith( ',' ) )
  {
    wkt.chop( 1 );
  }
  wkt += ')';
  return wkt;
}