51   wkbPtr -= 1 + 
sizeof( int );
 
   59       geom->fromWkb( wkbPtr );  
 
   74   QString trimmed = text.trimmed();
 
   75   std::unique_ptr< QgsAbstractGeometry> geom;
 
   76   if ( trimmed.startsWith( QLatin1String( 
"Point" ), Qt::CaseInsensitive ) )
 
   78     geom = std::make_unique< QgsPoint >();
 
   80   else if ( trimmed.startsWith( QLatin1String( 
"LineString" ), Qt::CaseInsensitive ) )
 
   82     geom = std::make_unique< QgsLineString >();
 
   84   else if ( trimmed.startsWith( QLatin1String( 
"CircularString" ), Qt::CaseInsensitive ) )
 
   86     geom = std::make_unique< QgsCircularString >();
 
   88   else if ( trimmed.startsWith( QLatin1String( 
"CompoundCurve" ), Qt::CaseInsensitive ) )
 
   90     geom = std::make_unique< QgsCompoundCurve>();
 
   92   else if ( trimmed.startsWith( QLatin1String( 
"Polygon" ), Qt::CaseInsensitive ) )
 
   94     geom = std::make_unique< QgsPolygon >();
 
   96   else if ( trimmed.startsWith( QLatin1String( 
"Triangle" ), Qt::CaseInsensitive ) )
 
   98     geom = std::make_unique< QgsTriangle >();
 
  100   else if ( trimmed.startsWith( QLatin1String( 
"CurvePolygon" ), Qt::CaseInsensitive ) )
 
  102     geom = std::make_unique< QgsCurvePolygon >();
 
  104   else if ( trimmed.startsWith( QLatin1String( 
"MultiPoint" ), Qt::CaseInsensitive ) )
 
  106     geom = std::make_unique< QgsMultiPoint >();
 
  108   else if ( trimmed.startsWith( QLatin1String( 
"MultiCurve" ), Qt::CaseInsensitive ) )
 
  110     geom = std::make_unique< QgsMultiCurve >();
 
  112   else if ( trimmed.startsWith( QLatin1String( 
"MultiLineString" ), Qt::CaseInsensitive ) )
 
  114     geom = std::make_unique< QgsMultiLineString >();
 
  116   else if ( trimmed.startsWith( QLatin1String( 
"MultiSurface" ), Qt::CaseInsensitive ) )
 
  118     geom = std::make_unique< QgsMultiSurface >();
 
  120   else if ( trimmed.startsWith( QLatin1String( 
"MultiPolygon" ), Qt::CaseInsensitive ) )
 
  122     geom = std::make_unique< QgsMultiPolygon >();
 
  124   else if ( trimmed.startsWith( QLatin1String( 
"GeometryCollection" ), Qt::CaseInsensitive ) )
 
  126     geom = std::make_unique< QgsGeometryCollection >();
 
  131     if ( !geom->fromWkt( text ) )
 
  141   return std::make_unique< QgsPoint >( point.
x(), point.
y() );
 
  146   std::unique_ptr< QgsMultiPoint > mp = std::make_unique< QgsMultiPoint >();
 
  147   QgsMultiPointXY::const_iterator ptIt = multipoint.constBegin();
 
  148   mp->reserve( multipoint.size() );
 
  149   for ( ; ptIt != multipoint.constEnd(); ++ptIt )
 
  152     mp->addGeometry( pt );
 
  159   return linestringFromPolyline( polyline );
 
  164   std::unique_ptr< QgsMultiLineString > mLine = std::make_unique< QgsMultiLineString >();
 
  165   mLine->reserve( multiline.size() );
 
  166   for ( 
int i = 0; i < multiline.size(); ++i )
 
  168     mLine->addGeometry( 
fromPolylineXY( multiline.at( i ) ).release() );
 
  175   std::unique_ptr< QgsPolygon > poly = std::make_unique< QgsPolygon >();
 
  177   QVector<QgsCurve *> holes;
 
  178   holes.reserve( polygon.size() );
 
  179   for ( 
int i = 0; i < polygon.size(); ++i )
 
  181     std::unique_ptr< QgsLineString > l = linestringFromPolyline( polygon.at( i ) );
 
  186       poly->setExteriorRing( l.release() );
 
  190       holes.push_back( l.release() );
 
  193   poly->setInteriorRings( holes );
 
  199   std::unique_ptr< QgsMultiPolygon > mp = std::make_unique< QgsMultiPolygon >();
 
  200   mp->reserve( multipoly.size() );
 
  201   for ( 
int i = 0; i < multipoly.size(); ++i )
 
  203     mp->addGeometry( 
fromPolygonXY( multipoly.at( i ) ).release() );
 
  208 std::unique_ptr<QgsLineString> QgsGeometryFactory::linestringFromPolyline( 
const QgsPolylineXY &polyline )
 
  210   const int size = polyline.size();
 
  215   double *destX = x.data();
 
  216   double *destY = y.data();
 
  218   for ( 
int i = 0; i < size; ++i )
 
  224   std::unique_ptr< QgsLineString > line = std::make_unique< QgsLineString >( x, y );
 
  234       return std::make_unique< QgsPoint >();
 
  236       return std::make_unique< QgsLineString >();
 
  238       return std::make_unique< QgsCircularString >();
 
  240       return std::make_unique< QgsCompoundCurve >();
 
  242       return std::make_unique< QgsPolygon >();
 
  244       return std::make_unique< QgsCurvePolygon >();
 
  246       return std::make_unique< QgsMultiLineString >();
 
  248       return std::make_unique< QgsMultiPolygon >();
 
  250       return std::make_unique< QgsMultiPoint >();
 
  252       return std::make_unique< QgsMultiCurve >();
 
  254       return std::make_unique< QgsMultiSurface >();
 
  256       return std::make_unique< QgsGeometryCollection >();
 
  258       return std::make_unique< QgsTriangle >();
 
  267   std::unique_ptr< QgsGeometryCollection > collect;
 
  271       collect = std::make_unique< QgsMultiPoint >();
 
  274       collect = std::make_unique< QgsMultiLineString >();
 
  277       collect = std::make_unique< QgsMultiCurve >();
 
  280       collect = std::make_unique< QgsMultiPolygon >();
 
  283       collect = std::make_unique< QgsMultiSurface >();
 
  286       collect = std::make_unique< QgsGeometryCollection >();
 
  293     collect->addMValue();
 
  295     collect->addZValue();
 
QgsWkbTypes::Type readHeader() const
readHeader
static std::unique_ptr< QgsMultiPolygon > fromMultiPolygonXY(const QgsMultiPolygonXY &multipoly)
Construct geometry from a multipolygon.
static std::unique_ptr< QgsAbstractGeometry > geomFromWkb(QgsConstWkbPtr &wkb)
Construct geometry from a WKB string.
static std::unique_ptr< QgsAbstractGeometry > fromPolylineXY(const QgsPolylineXY &polyline)
Construct geometry from a polyline.
static std::unique_ptr< QgsMultiPoint > fromMultiPointXY(const QgsMultiPointXY &multipoint)
Construct geometry from a multipoint.
static std::unique_ptr< QgsAbstractGeometry > geomFromWkt(const QString &text)
Construct geometry from a WKT string.
static std::unique_ptr< QgsAbstractGeometry > geomFromWkbType(QgsWkbTypes::Type t)
Returns empty geometry from wkb type.
static std::unique_ptr< QgsMultiLineString > fromMultiPolylineXY(const QgsMultiPolylineXY &multiline)
Construct geometry from a multipolyline.
static std::unique_ptr< QgsGeometryCollection > createCollectionOfType(QgsWkbTypes::Type type)
Returns a new geometry collection matching a specified WKB type.
static std::unique_ptr< QgsAbstractGeometry > fromPointXY(const QgsPointXY &point)
Construct geometry from a point.
static std::unique_ptr< QgsPolygon > fromPolygonXY(const QgsPolygonXY &polygon)
Construct geometry from a polygon.
A class to represent a 2D point.
Point geometry type, with support for z-dimension and m-values.
Custom exception class for Wkb related exceptions.
static bool hasM(Type type) SIP_HOLDGIL
Tests whether a WKB type contains m values.
Type
The WKB type describes the number of dimensions a geometry has.
static Type flatType(Type type) SIP_HOLDGIL
Returns the flat type for a WKB type.
static Type multiType(Type type) SIP_HOLDGIL
Returns the multi type for a WKB type.
static bool hasZ(Type type) SIP_HOLDGIL
Tests whether a WKB type contains the z-dimension.
QVector< QgsPolylineXY > QgsPolygonXY
Polygon: first item of the list is outer ring, inner rings (if any) start from second item.
QVector< QgsPolylineXY > QgsMultiPolylineXY
A collection of QgsPolylines that share a common collection of attributes.
QVector< QgsPointXY > QgsMultiPointXY
A collection of QgsPoints that share a common collection of attributes.
QVector< QgsPointXY > QgsPolylineXY
Polyline as represented as a vector of two-dimensional points.
QVector< QgsPolygonXY > QgsMultiPolygonXY
A collection of QgsPolygons that share a common collection of attributes.