0

我将 MapControl 嵌入到 C++ 应用程序中。该应用程序与专有的非关系数据库相关联。因此,将地图控件直接链接到 GIS 数据是不可行的。相反,我想简单地将我自己的点要素加载到要素图层中。我了解创建要素图层的机制,但它们似乎与某种类型的数据源相关联。如何在不指向文件或数据库的情况下将要素数据直接加载到图层中?换句话说,我只希望这些功能常驻内存。

4

2 回答 2

1

If you only want to display points, don't use a feature layer, but draw directly to the map. Example: here

If your points have associated data, you'll need to load them as features into a feature class (via IFeatureClass.Insert) and attach the feature class to your feature layer. To do this, you'll need to create your own feature class first. Example code here.

Not that this example uses a ShapeFileWorkspaceFactory to create a shapefile on disk to store the features, but in your case you can use a ScratchWorkspaceFactory to create a temp in-memory workspace, flushed when ArcMap closes.

Apologies for the various programming dialects within the links, but I hope they'll give you some starting points to work from.

于 2010-07-28T08:19:01.627 回答
1

我会使用InMemoryWorkspaceFactory而不是 ScratchWorkspaceFactory 。

您仍然需要一个要素图层,该要素图层将引用驻留在内存工作空间中的要素类,以及定义信息符号化方式的符号系统 (IGeoFeatureLayer.Renderer)。

于 2010-07-28T19:59:42.800 回答