1

我可能有小问题。我正在尝试使用 GEOS 库。我在自己的库中有使用 GEOS 库的函数。我想在我用 C++ 编写的 QGIS 插件中使用这个库。问题是,我的库中的函数使用 . geos::geom::Geometry,但在 QGIS 插件中,有GEOSGeometry. 我认为这是同一件事,但可能不是。

谁能解释我这两者之间的区别并给我一个建议,如何将它们相互转换或告诉我我做错了什么?谢谢。

4

2 回答 2

0

GEOSGeometry is a typedef for the structure used in the C (not C++) API. It is stated on the official documentation that the use of the C API is preferred to the C++ API as it may be more stable (in terms of future changes).

I'm not sure if you can simply cast the structures (I'd advise against it). I suggest you use the C API instead of the C++ API.

于 2013-02-10T13:45:01.263 回答
0

不,您不能简单地GEOSGeometry从基于类的层次结构中转换 GEOS C API 类型和 C++ API 类型geos::geom::Geometry

但是,您可以使用 WKB 作为C API 和 C++ API 对象之间的交换格式来转换几何图形。

于 2017-02-15T22:40:28.423 回答