[Qgis-developer] QgsGeometry
Marco Hugentobler
marco.hugentobler at karto.baug.ethz.ch
Sat Sep 8 12:10:20 EDT 2007
Hi Martin,
Thanks for the feedback.
> In my opinion, we should
> only support WKB import and export, but represent the geometries as a
> GEOS geometry
I think that with data sources that provide only wkb geometries (e.g. ogr or
postgis), there will be some overhead for drawing if we store geometries only
in geos format internally.
Currently, it is:
postgis -> wkb -> drawing in vectorlayer
and with internal storage as geos:
postgis -> wkb -> geos -> drawing in vectorlayer
>My big
> wish about it is to stop completely doing the operations on geometries
> with WKB and start fully using GEOS for geometry manipulations
You are right that they shouldn't be done in WKB. But my experience with geos
is that manipulation code can have similar length as with WKB, in some cases
even more. In my opinion, the classes QgsPoint, QgsLinestring & co. are very
well suited for manipulations. It is possible to just change one coordinate
value, e.g. for a vertex move, without the need to do the whole geometry
construction again (as in geos).
It may not be very performant to convert QgsPolyline to geos and than geos to
wkb, as it is currently done with asPolyline(). But, unlike the drawing code,
the manipulation methods are not performance critical at all since only few
features are manipulated at once.
So my preferred solution would be to move manipulations into separate classes
which get and set geometry from QgsGeometry with
QgsPoint/QgsLinestring/QgsPolygon & co.
Would that make sense?
> If the class would be still too huge, I'm for splitting
> it into some smaller ones.
I think it would still be too huge only with geos representation. Splitting
sounds good.
Regards,
Marco
--
Dr. Marco Hugentobler
Institute of Cartography
ETH Zurich
Technical Advisor QGIS Project Steering Committee
marco.hugentobler at karto.baug.ethz.ch
More information about the Qgis-developer
mailing list