You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/geos_types.jl
+28-29Lines changed: 28 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -5,13 +5,13 @@ mutable struct Point <: AbstractGeometry
5
5
# create a point from a pointer - only makese sense if it is a pointer to a point, otherwise error
6
6
functionPoint(ptr::GEOSGeom)
7
7
id = LibGEOS.geomTypeId(ptr)
8
-
if id == GEOS_POINT
8
+
point =if id == GEOS_POINT
9
9
point =new(cloneGeom(ptr))
10
-
finalizer(destroyGeom, point)
11
-
point
12
10
else
13
11
error("LibGEOS: Can't convert a pointer to an element with a GeomType ID of $id to a point (yet). Please open an issue if you think this conversion makes sense.")
# create a multipoint from a pointer - only makes sense if it is a pointer to a multipoint or to a point, otherwise error
25
25
functionMultiPoint(ptr::GEOSGeom)
26
26
id = LibGEOS.geomTypeId(ptr)
27
-
if id == GEOS_MULTIPOINT
28
-
multipoint =new(cloneGeom(ptr))
27
+
multipoint =if id == GEOS_MULTIPOINT
28
+
new(cloneGeom(ptr))
29
29
elseif id == GEOS_POINT
30
-
multipoint =new(createCollection(GEOS_MULTIPOINT,
30
+
new(createCollection(GEOS_MULTIPOINT,
31
31
GEOSGeom[cloneGeom(ptr)]))
32
32
else
33
33
error("LibGEOS: Can't convert a pointer to an element with a GeomType ID of $id to a multipoint (yet). Please open an issue if you think this conversion makes sense.")
# create a linestring from a linestring pointer, otherwise error
57
57
functionLineString(ptr::GEOSGeom)
58
58
id = LibGEOS.geomTypeId(ptr)
59
-
if id == GEOS_LINESTRING
60
-
line =new(cloneGeom(ptr))
61
-
finalizer(destroyGeom, line)
62
-
line
59
+
line =if id == GEOS_LINESTRING
60
+
new(cloneGeom(ptr))
63
61
else
64
62
error("LibGEOS: Can't convert a pointer to an element with a GeomType ID of $id to a linestring (yet). Please open an issue if you think this conversion makes sense.")
error("LibGEOS: Can't convert a pointer to an element with a GeomType ID of $id to a multi-linestring (yet). Please open an issue if you think this conversion makes sense.")
# create a linear ring from a linear ring pointer, otherwise error
104
104
functionLinearRing(ptr::GEOSGeom)
105
105
id = LibGEOS.geomTypeId(ptr)
106
-
if id == GEOS_LINEARRING
107
-
ring =new(cloneGeom(ptr))
108
-
finalizer(destroyGeom, ring)
109
-
ring
106
+
ring =if id == GEOS_LINEARRING
107
+
new(cloneGeom(ptr))
110
108
else
111
109
error("LibGEOS: Can't convert a pointer to an element with a GeomType ID of $id to a linear ring (yet). Please open an issue if you think this conversion makes sense.")
# create polygon using GEOSGeom pointer - only makes sense if pointer points to a polygon or a linear ring to start with.
127
127
functionPolygon(ptr::GEOSGeom)
128
128
id = LibGEOS.geomTypeId(ptr)
129
-
if id == GEOS_POLYGON
130
-
polygon =new(cloneGeom(ptr))
129
+
polygon =if id == GEOS_POLYGON
130
+
new(cloneGeom(ptr))
131
131
elseif id == GEOS_LINEARRING
132
-
polygon =new(cloneGeom(createPolygon(ptr)))
132
+
new(cloneGeom(createPolygon(ptr)))
133
133
else
134
134
error("LibGEOS: Can't convert a pointer to an element with a GeomType ID of $id to a polygon (yet). Please open an issue if you think this conversion makes sense.")
# create multipolygon using a multipolygon or polygon pointer, else error
159
159
functionMultiPolygon(ptr::GEOSGeom)
160
160
id = LibGEOS.geomTypeId(ptr)
161
-
if id == GEOS_MULTIPOLYGON
162
-
multipolygon =new(cloneGeom(ptr))
161
+
multipolygon =if id == GEOS_MULTIPOLYGON
162
+
new(cloneGeom(ptr))
163
163
elseif id == GEOS_POLYGON
164
-
multipolygon =new(createCollection(
165
-
GEOS_MULTIPOLYGON,
164
+
new(createCollection(GEOS_MULTIPOLYGON,
166
165
GEOSGeom[cloneGeom(ptr)]))
167
166
else
168
167
error("LibGEOS: Can't convert a pointer to an element with a GeomType ID of $id to a multi-polygon (yet). Please open an issue if you think this conversion makes sense.")
# create a geometric collection from a pointer to a geometric collection, else error
197
196
functionGeometryCollection(ptr::GEOSGeom)
198
197
id = LibGEOS.geomTypeId(ptr)
199
-
if id == GEOS_GEOMETRYCOLLECTION
200
-
geometrycollection =new(cloneGeom(ptr))
201
-
finalizer(destroyGeom, geometrycollection)
202
-
geometrycollection
198
+
geometrycollection =if id == GEOS_GEOMETRYCOLLECTION
199
+
new(cloneGeom(ptr))
203
200
else
204
201
error("LibGEOS: Can't convert a pointer to an element with a GeomType ID of $id to a geometry collection (yet). Please open an issue if you think this conversion makes sense.")
205
202
end
203
+
finalizer(destroyGeom, geometrycollection)
204
+
geometrycollection
206
205
end
207
206
# create a geometric collection from a list of pointers to geometric objects
0 commit comments