Subject: [ggl] Base geometry type ?
From: Simonson, Lucanus J (lucanus.j.simonson)
Date: 2011-08-19 23:37:15
>Hi, I was browsing through the documentation and the source and there doesn't seem to be a base polymorphic geometry type "Ex: Geometry". Let's say I want an array of
>geometries, but it could contain polygons or lines, I just don't know.
>Is there such a type or am I missing something?
There is not supposed to be one. It is considered bad design to have a catch all base class. Also, the library is designed to work with user defined geometry types in addition to its own. The user defined types can't be expected to derive from the same common base class. If you need to work with geometries of different types in the same container use boost::any. Personally I think a struct with array of each type is probably eaiser than unpacking the geometry type from boost::any every time you use it. Nothing stops you from defining your own geometry types that derive from a common base class if you want to and using them with the library, however, the base type won't be compatible with any of the library interfaces and you'll need to cast to the derived types. That will be just as awkward as using boost::any.
Geometry list run by mateusz at loskot.net