Skip to content

Commit

Permalink
Performance tweaks for rings and holes (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaqz committed Jan 2, 2024
1 parent feb0055 commit d0b0aa8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/geo_interface.jl
Expand Up @@ -31,6 +31,9 @@ GeoInterface.ngeom(t::AbstractGeometryTrait, geom::PreparedGeometry) =
GeoInterface.ngeom(::AbstractPointTrait, geom::Point) = 0
GeoInterface.ngeom(::AbstractPointTrait, geom::PreparedGeometry) = 0

GI.getexterior(::AbstractPolygonTrait, geom::Polygon) = exteriorRing(geom)
GI.gethole(::AbstractPolygonTrait, geom::Polygon, n) = interiorRing(geom, n)

function GeoInterface.getgeom(
::AbstractGeometryCollectionTrait,
geom::AbstractMultiGeometry,
Expand All @@ -51,9 +54,9 @@ GeoInterface.getgeom(
GeoInterface.getgeom(t::AbstractPointTrait, geom::PreparedGeometry) = nothing
function GeoInterface.getgeom(::PolygonTrait, geom::Polygon, i::Int)
if i == 1
LinearRing(exteriorRing(geom))
exteriorRing(geom)
else
LinearRing(interiorRing(geom, i - 1))
interiorRing(geom, i - 1)
end
end
GeoInterface.getgeom(t::AbstractGeometryTrait, geom::PreparedGeometry, i) =
Expand Down

0 comments on commit d0b0aa8

Please sign in to comment.