JuliaGeometry / GeometryBasics.jl

Basic Geometry Types
MIT License
165 stars 54 forks source link

Why are `Multi{Polygon,Linestring,...} <: AbstractVector` and not `<: AbstractGeometry` #95

Open greimel opened 4 years ago

greimel commented 4 years ago

What is the benefit of them being AbstractVectors?

In AlgebraOfGraphics we would like to support all shapes that are plottable. We would like to just implement methods for AbstractGeometry. Instead we have to define methods for Multi* types separately.

https://github.com/JuliaPlots/AlgebraOfGraphics.jl/pull/80

related to #70

juliohm commented 4 years ago

@greimel I don't know the rationale behind this decision, but it is very strange for sure. I am working on a major refactoring of the code in the cleanup branch, and will keep note of this issue there.

SimonDanisch commented 3 years ago

The idea behind this is, that indexing into them behaves like an AbstractVector of its elements.. Anyways, that type hierarchy is not really used anywhere, so would be easy to change if needed