Skip to content

Commit

Permalink
TIN: Add a workaround in reading WKT/WKB
Browse files Browse the repository at this point in the history
There is currently no class for managing TIN in QGIS.
A TIN is essentially a kind of multipolygon (multi-triangle, as in the OGC sense,
a triangle is a specific type of polygon).
This commit enables reading a TIN WKB/WKT and "converts" it into a multipolygon.
A dedicated TIN class will be proposed later, after the feature freeze ends and
for new QGIS versions.
  • Loading branch information
lbartoletti committed Jan 31, 2024
1 parent 908dc2a commit 3f4a7c7
Show file tree
Hide file tree
Showing 12 changed files with 246 additions and 24 deletions.
14 changes: 13 additions & 1 deletion python/PyQt6/core/auto_additions/qgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@
QgsWkbTypes.MultiSurface = Qgis.WkbType.MultiSurface
QgsWkbTypes.MultiSurface.is_monkey_patched = True
QgsWkbTypes.MultiSurface.__doc__ = "MultiSurface"
QgsWkbTypes.TIN = Qgis.WkbType.TIN
QgsWkbTypes.TIN.is_monkey_patched = True
QgsWkbTypes.TIN.__doc__ = "TIN"
QgsWkbTypes.NoGeometry = Qgis.WkbType.NoGeometry
QgsWkbTypes.NoGeometry.is_monkey_patched = True
QgsWkbTypes.NoGeometry.__doc__ = "No geometry"
Expand Down Expand Up @@ -186,6 +189,9 @@
QgsWkbTypes.MultiSurfaceZ = Qgis.WkbType.MultiSurfaceZ
QgsWkbTypes.MultiSurfaceZ.is_monkey_patched = True
QgsWkbTypes.MultiSurfaceZ.__doc__ = "MultiSurfaceZ"
QgsWkbTypes.TINZ = Qgis.WkbType.TINZ
QgsWkbTypes.TINZ.is_monkey_patched = True
QgsWkbTypes.TINZ.__doc__ = "TINZ"
QgsWkbTypes.PointM = Qgis.WkbType.PointM
QgsWkbTypes.PointM.is_monkey_patched = True
QgsWkbTypes.PointM.__doc__ = "PointM"
Expand Down Expand Up @@ -225,6 +231,9 @@
QgsWkbTypes.MultiSurfaceM = Qgis.WkbType.MultiSurfaceM
QgsWkbTypes.MultiSurfaceM.is_monkey_patched = True
QgsWkbTypes.MultiSurfaceM.__doc__ = "MultiSurfaceM"
QgsWkbTypes.TINM = Qgis.WkbType.TINM
QgsWkbTypes.TINM.is_monkey_patched = True
QgsWkbTypes.TINM.__doc__ = "TINM"
QgsWkbTypes.PointZM = Qgis.WkbType.PointZM
QgsWkbTypes.PointZM.is_monkey_patched = True
QgsWkbTypes.PointZM.__doc__ = "PointZM"
Expand Down Expand Up @@ -261,6 +270,9 @@
QgsWkbTypes.MultiSurfaceZM = Qgis.WkbType.MultiSurfaceZM
QgsWkbTypes.MultiSurfaceZM.is_monkey_patched = True
QgsWkbTypes.MultiSurfaceZM.__doc__ = "MultiSurfaceZM"
QgsWkbTypes.TINZM = Qgis.WkbType.TINZM
QgsWkbTypes.TINZM.is_monkey_patched = True
QgsWkbTypes.TINZM.__doc__ = "TINZM"
QgsWkbTypes.TriangleZM = Qgis.WkbType.TriangleZM
QgsWkbTypes.TriangleZM.is_monkey_patched = True
QgsWkbTypes.TriangleZM.__doc__ = "TriangleZM"
Expand All @@ -282,7 +294,7 @@
QgsWkbTypes.MultiPolygon25D = Qgis.WkbType.MultiPolygon25D
QgsWkbTypes.MultiPolygon25D.is_monkey_patched = True
QgsWkbTypes.MultiPolygon25D.__doc__ = "MultiPolygon25D"
Qgis.WkbType.__doc__ = "The WKB type describes the number of dimensions a geometry has\n\n- Point\n- LineString\n- Polygon\n\nas well as the number of dimensions for each individual vertex\n\n- X (always)\n- Y (always)\n- Z (optional)\n- M (measurement value, optional)\n\nit also has values for multi types, collections, unknown geometry,\nnull geometry, no geometry and curve support.\n\nThese classes of geometry are often used for data sources to\ncommunicate what kind of geometry should be expected for a given\ngeometry field. It is also used for tools or algorithms to decide\nif they should be available for a given geometry type or act in\na different mode.\n\n.. note::\n\n Prior to 3.30 this was available as :py:class:`QgsWkbTypes`.Type.\n\n.. versionadded:: 3.30\n\n" + '* ``Unknown``: ' + Qgis.WkbType.Unknown.__doc__ + '\n' + '* ``Point``: ' + Qgis.WkbType.Point.__doc__ + '\n' + '* ``LineString``: ' + Qgis.WkbType.LineString.__doc__ + '\n' + '* ``Polygon``: ' + Qgis.WkbType.Polygon.__doc__ + '\n' + '* ``Triangle``: ' + Qgis.WkbType.Triangle.__doc__ + '\n' + '* ``MultiPoint``: ' + Qgis.WkbType.MultiPoint.__doc__ + '\n' + '* ``MultiLineString``: ' + Qgis.WkbType.MultiLineString.__doc__ + '\n' + '* ``MultiPolygon``: ' + Qgis.WkbType.MultiPolygon.__doc__ + '\n' + '* ``GeometryCollection``: ' + Qgis.WkbType.GeometryCollection.__doc__ + '\n' + '* ``CircularString``: ' + Qgis.WkbType.CircularString.__doc__ + '\n' + '* ``CompoundCurve``: ' + Qgis.WkbType.CompoundCurve.__doc__ + '\n' + '* ``CurvePolygon``: ' + Qgis.WkbType.CurvePolygon.__doc__ + '\n' + '* ``MultiCurve``: ' + Qgis.WkbType.MultiCurve.__doc__ + '\n' + '* ``MultiSurface``: ' + Qgis.WkbType.MultiSurface.__doc__ + '\n' + '* ``NoGeometry``: ' + Qgis.WkbType.NoGeometry.__doc__ + '\n' + '* ``PointZ``: ' + Qgis.WkbType.PointZ.__doc__ + '\n' + '* ``LineStringZ``: ' + Qgis.WkbType.LineStringZ.__doc__ + '\n' + '* ``PolygonZ``: ' + Qgis.WkbType.PolygonZ.__doc__ + '\n' + '* ``TriangleZ``: ' + Qgis.WkbType.TriangleZ.__doc__ + '\n' + '* ``MultiPointZ``: ' + Qgis.WkbType.MultiPointZ.__doc__ + '\n' + '* ``MultiLineStringZ``: ' + Qgis.WkbType.MultiLineStringZ.__doc__ + '\n' + '* ``MultiPolygonZ``: ' + Qgis.WkbType.MultiPolygonZ.__doc__ + '\n' + '* ``GeometryCollectionZ``: ' + Qgis.WkbType.GeometryCollectionZ.__doc__ + '\n' + '* ``CircularStringZ``: ' + Qgis.WkbType.CircularStringZ.__doc__ + '\n' + '* ``CompoundCurveZ``: ' + Qgis.WkbType.CompoundCurveZ.__doc__ + '\n' + '* ``CurvePolygonZ``: ' + Qgis.WkbType.CurvePolygonZ.__doc__ + '\n' + '* ``MultiCurveZ``: ' + Qgis.WkbType.MultiCurveZ.__doc__ + '\n' + '* ``MultiSurfaceZ``: ' + Qgis.WkbType.MultiSurfaceZ.__doc__ + '\n' + '* ``PointM``: ' + Qgis.WkbType.PointM.__doc__ + '\n' + '* ``LineStringM``: ' + Qgis.WkbType.LineStringM.__doc__ + '\n' + '* ``PolygonM``: ' + Qgis.WkbType.PolygonM.__doc__ + '\n' + '* ``TriangleM``: ' + Qgis.WkbType.TriangleM.__doc__ + '\n' + '* ``MultiPointM``: ' + Qgis.WkbType.MultiPointM.__doc__ + '\n' + '* ``MultiLineStringM``: ' + Qgis.WkbType.MultiLineStringM.__doc__ + '\n' + '* ``MultiPolygonM``: ' + Qgis.WkbType.MultiPolygonM.__doc__ + '\n' + '* ``GeometryCollectionM``: ' + Qgis.WkbType.GeometryCollectionM.__doc__ + '\n' + '* ``CircularStringM``: ' + Qgis.WkbType.CircularStringM.__doc__ + '\n' + '* ``CompoundCurveM``: ' + Qgis.WkbType.CompoundCurveM.__doc__ + '\n' + '* ``CurvePolygonM``: ' + Qgis.WkbType.CurvePolygonM.__doc__ + '\n' + '* ``MultiCurveM``: ' + Qgis.WkbType.MultiCurveM.__doc__ + '\n' + '* ``MultiSurfaceM``: ' + Qgis.WkbType.MultiSurfaceM.__doc__ + '\n' + '* ``PointZM``: ' + Qgis.WkbType.PointZM.__doc__ + '\n' + '* ``LineStringZM``: ' + Qgis.WkbType.LineStringZM.__doc__ + '\n' + '* ``PolygonZM``: ' + Qgis.WkbType.PolygonZM.__doc__ + '\n' + '* ``MultiPointZM``: ' + Qgis.WkbType.MultiPointZM.__doc__ + '\n' + '* ``MultiLineStringZM``: ' + Qgis.WkbType.MultiLineStringZM.__doc__ + '\n' + '* ``MultiPolygonZM``: ' + Qgis.WkbType.MultiPolygonZM.__doc__ + '\n' + '* ``GeometryCollectionZM``: ' + Qgis.WkbType.GeometryCollectionZM.__doc__ + '\n' + '* ``CircularStringZM``: ' + Qgis.WkbType.CircularStringZM.__doc__ + '\n' + '* ``CompoundCurveZM``: ' + Qgis.WkbType.CompoundCurveZM.__doc__ + '\n' + '* ``CurvePolygonZM``: ' + Qgis.WkbType.CurvePolygonZM.__doc__ + '\n' + '* ``MultiCurveZM``: ' + Qgis.WkbType.MultiCurveZM.__doc__ + '\n' + '* ``MultiSurfaceZM``: ' + Qgis.WkbType.MultiSurfaceZM.__doc__ + '\n' + '* ``TriangleZM``: ' + Qgis.WkbType.TriangleZM.__doc__ + '\n' + '* ``Point25D``: ' + Qgis.WkbType.Point25D.__doc__ + '\n' + '* ``LineString25D``: ' + Qgis.WkbType.LineString25D.__doc__ + '\n' + '* ``Polygon25D``: ' + Qgis.WkbType.Polygon25D.__doc__ + '\n' + '* ``MultiPoint25D``: ' + Qgis.WkbType.MultiPoint25D.__doc__ + '\n' + '* ``MultiLineString25D``: ' + Qgis.WkbType.MultiLineString25D.__doc__ + '\n' + '* ``MultiPolygon25D``: ' + Qgis.WkbType.MultiPolygon25D.__doc__
Qgis.WkbType.__doc__ = "The WKB type describes the number of dimensions a geometry has\n\n- Point\n- LineString\n- Polygon\n\nas well as the number of dimensions for each individual vertex\n\n- X (always)\n- Y (always)\n- Z (optional)\n- M (measurement value, optional)\n\nit also has values for multi types, collections, unknown geometry,\nnull geometry, no geometry and curve support.\n\nThese classes of geometry are often used for data sources to\ncommunicate what kind of geometry should be expected for a given\ngeometry field. It is also used for tools or algorithms to decide\nif they should be available for a given geometry type or act in\na different mode.\n\n.. note::\n\n Prior to 3.30 this was available as :py:class:`QgsWkbTypes`.Type.\n\n.. versionadded:: 3.30\n\n" + '* ``Unknown``: ' + Qgis.WkbType.Unknown.__doc__ + '\n' + '* ``Point``: ' + Qgis.WkbType.Point.__doc__ + '\n' + '* ``LineString``: ' + Qgis.WkbType.LineString.__doc__ + '\n' + '* ``Polygon``: ' + Qgis.WkbType.Polygon.__doc__ + '\n' + '* ``Triangle``: ' + Qgis.WkbType.Triangle.__doc__ + '\n' + '* ``MultiPoint``: ' + Qgis.WkbType.MultiPoint.__doc__ + '\n' + '* ``MultiLineString``: ' + Qgis.WkbType.MultiLineString.__doc__ + '\n' + '* ``MultiPolygon``: ' + Qgis.WkbType.MultiPolygon.__doc__ + '\n' + '* ``GeometryCollection``: ' + Qgis.WkbType.GeometryCollection.__doc__ + '\n' + '* ``CircularString``: ' + Qgis.WkbType.CircularString.__doc__ + '\n' + '* ``CompoundCurve``: ' + Qgis.WkbType.CompoundCurve.__doc__ + '\n' + '* ``CurvePolygon``: ' + Qgis.WkbType.CurvePolygon.__doc__ + '\n' + '* ``MultiCurve``: ' + Qgis.WkbType.MultiCurve.__doc__ + '\n' + '* ``MultiSurface``: ' + Qgis.WkbType.MultiSurface.__doc__ + '\n' + '* ``TIN``: ' + Qgis.WkbType.TIN.__doc__ + '\n' + '* ``NoGeometry``: ' + Qgis.WkbType.NoGeometry.__doc__ + '\n' + '* ``PointZ``: ' + Qgis.WkbType.PointZ.__doc__ + '\n' + '* ``LineStringZ``: ' + Qgis.WkbType.LineStringZ.__doc__ + '\n' + '* ``PolygonZ``: ' + Qgis.WkbType.PolygonZ.__doc__ + '\n' + '* ``TriangleZ``: ' + Qgis.WkbType.TriangleZ.__doc__ + '\n' + '* ``MultiPointZ``: ' + Qgis.WkbType.MultiPointZ.__doc__ + '\n' + '* ``MultiLineStringZ``: ' + Qgis.WkbType.MultiLineStringZ.__doc__ + '\n' + '* ``MultiPolygonZ``: ' + Qgis.WkbType.MultiPolygonZ.__doc__ + '\n' + '* ``GeometryCollectionZ``: ' + Qgis.WkbType.GeometryCollectionZ.__doc__ + '\n' + '* ``CircularStringZ``: ' + Qgis.WkbType.CircularStringZ.__doc__ + '\n' + '* ``CompoundCurveZ``: ' + Qgis.WkbType.CompoundCurveZ.__doc__ + '\n' + '* ``CurvePolygonZ``: ' + Qgis.WkbType.CurvePolygonZ.__doc__ + '\n' + '* ``MultiCurveZ``: ' + Qgis.WkbType.MultiCurveZ.__doc__ + '\n' + '* ``MultiSurfaceZ``: ' + Qgis.WkbType.MultiSurfaceZ.__doc__ + '\n' + '* ``TINZ``: ' + Qgis.WkbType.TINZ.__doc__ + '\n' + '* ``PointM``: ' + Qgis.WkbType.PointM.__doc__ + '\n' + '* ``LineStringM``: ' + Qgis.WkbType.LineStringM.__doc__ + '\n' + '* ``PolygonM``: ' + Qgis.WkbType.PolygonM.__doc__ + '\n' + '* ``TriangleM``: ' + Qgis.WkbType.TriangleM.__doc__ + '\n' + '* ``MultiPointM``: ' + Qgis.WkbType.MultiPointM.__doc__ + '\n' + '* ``MultiLineStringM``: ' + Qgis.WkbType.MultiLineStringM.__doc__ + '\n' + '* ``MultiPolygonM``: ' + Qgis.WkbType.MultiPolygonM.__doc__ + '\n' + '* ``GeometryCollectionM``: ' + Qgis.WkbType.GeometryCollectionM.__doc__ + '\n' + '* ``CircularStringM``: ' + Qgis.WkbType.CircularStringM.__doc__ + '\n' + '* ``CompoundCurveM``: ' + Qgis.WkbType.CompoundCurveM.__doc__ + '\n' + '* ``CurvePolygonM``: ' + Qgis.WkbType.CurvePolygonM.__doc__ + '\n' + '* ``MultiCurveM``: ' + Qgis.WkbType.MultiCurveM.__doc__ + '\n' + '* ``MultiSurfaceM``: ' + Qgis.WkbType.MultiSurfaceM.__doc__ + '\n' + '* ``TINM``: ' + Qgis.WkbType.TINM.__doc__ + '\n' + '* ``PointZM``: ' + Qgis.WkbType.PointZM.__doc__ + '\n' + '* ``LineStringZM``: ' + Qgis.WkbType.LineStringZM.__doc__ + '\n' + '* ``PolygonZM``: ' + Qgis.WkbType.PolygonZM.__doc__ + '\n' + '* ``MultiPointZM``: ' + Qgis.WkbType.MultiPointZM.__doc__ + '\n' + '* ``MultiLineStringZM``: ' + Qgis.WkbType.MultiLineStringZM.__doc__ + '\n' + '* ``MultiPolygonZM``: ' + Qgis.WkbType.MultiPolygonZM.__doc__ + '\n' + '* ``GeometryCollectionZM``: ' + Qgis.WkbType.GeometryCollectionZM.__doc__ + '\n' + '* ``CircularStringZM``: ' + Qgis.WkbType.CircularStringZM.__doc__ + '\n' + '* ``CompoundCurveZM``: ' + Qgis.WkbType.CompoundCurveZM.__doc__ + '\n' + '* ``CurvePolygonZM``: ' + Qgis.WkbType.CurvePolygonZM.__doc__ + '\n' + '* ``MultiCurveZM``: ' + Qgis.WkbType.MultiCurveZM.__doc__ + '\n' + '* ``MultiSurfaceZM``: ' + Qgis.WkbType.MultiSurfaceZM.__doc__ + '\n' + '* ``TINZM``: ' + Qgis.WkbType.TINZM.__doc__ + '\n' + '* ``TriangleZM``: ' + Qgis.WkbType.TriangleZM.__doc__ + '\n' + '* ``Point25D``: ' + Qgis.WkbType.Point25D.__doc__ + '\n' + '* ``LineString25D``: ' + Qgis.WkbType.LineString25D.__doc__ + '\n' + '* ``Polygon25D``: ' + Qgis.WkbType.Polygon25D.__doc__ + '\n' + '* ``MultiPoint25D``: ' + Qgis.WkbType.MultiPoint25D.__doc__ + '\n' + '* ``MultiLineString25D``: ' + Qgis.WkbType.MultiLineString25D.__doc__ + '\n' + '* ``MultiPolygon25D``: ' + Qgis.WkbType.MultiPolygon25D.__doc__
# --
Qgis.WkbType.baseClass = Qgis
QgsWkbTypes.GeometryType = Qgis.GeometryType
Expand Down
4 changes: 4 additions & 0 deletions python/PyQt6/core/auto_generated/qgis.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ The development version
CurvePolygon,
MultiCurve,
MultiSurface,
TIN,
NoGeometry,
PointZ,
LineStringZ,
Expand All @@ -139,6 +140,7 @@ The development version
CurvePolygonZ,
MultiCurveZ,
MultiSurfaceZ,
TINZ,
PointM,
LineStringM,
PolygonM,
Expand All @@ -152,6 +154,7 @@ The development version
CurvePolygonM,
MultiCurveM,
MultiSurfaceM,
TINM,
PointZM,
LineStringZM,
PolygonZM,
Expand All @@ -164,6 +167,7 @@ The development version
CurvePolygonZM,
MultiCurveZM,
MultiSurfaceZM,
TINZM,
TriangleZM,
Point25D,
LineString25D,
Expand Down
Loading

0 comments on commit 3f4a7c7

Please sign in to comment.