Pro自定义数据源原理

1.  概念

Connector:定义连接到一个数据源的连接信息,用于创建datastore。

Datastore:代表一个数据源的实例,用于打开一个或多个tables或feature class。

Cursor:可以通过查询一个table或feature class获得返回的记录。

Row:可以通过遍历cursor获得每一条要素记录。

 

 

 

对于Plugin Datasource,这个流程也是遵循上述概念的,具体实现如下:

 

 

 

PluginDatasourceConnectorPath:相对于Connector。PluginDatasourceConnectorPath通过指定数据源的ID和访问Uri路径,可以创建对应的PluginDatastore实例。

PluginDatastore:相对于Datastore。

 

2.  基础类

要实现自定义数据的接入,开发人员需要实现自定义数据源的PluginDatastore、Table和RowCursor,Pro SDK提供了对应的基础类,分别是PluginDatatoreTemplate、PluginTableTemplate、PluginCursorTemplate。这些基础类定义了需要实现的方法,开发人员只需要实现相应的方法则可。

 

继承PluginDatastoreTemplate的实例类需要实现的方法:

方法

说明

void Open(Uri connectionPath)

建立和数据源的连接。

bool CanOpen(Uri connectionPath)

用于判断该数据源是否能访问。

void Close()

关闭数据源的连接。

IReadonlyList<string> GetTableNames()

获得数据源中的数据集列表。

PluginTableTemplate OpenTable(string name)

打开数据集。

bool IsQueryLanguageSupported()

用于判断是否支持查询语法

string GetDatasourceDescription(bool inPluralForm)

获得数据源文字描述信息

string GetDatasetDescription(DatasetType datasetType)

获得数据集的文字描述信息

 

继承PluginTableTemplate的实例类需要实现的方法:

方法

说明

string GetName()

返回要素集的名字,必须是数据源GetTableNames()方法返回的列表中。

IReadOnlyList<PluginField> GetFields()

返回要素集的字段列表。

PluginCursorTemplate Search(QueryFilter queryFilter)

用于进行属性查询。

PluginCursorTemplate Search(SpatialQueryFilter queryFilter)

用于进行空间查询。

bool IsNativeRowCountSupported()

用于判断数据集是否支持返回总记录数。

int GetNativeRowCount()

返回数据集的总记录数。

GeometryType GetShapeType()

返回数据集的图形类型。

 

继承PluginCursorTemplate的实例类需要实现的方法:

方法

说明

PluginRow GetCurrentRow()

获得当前记录。

bool MoveNext()

指针向前读取成功,则返回True,否则返回False。

posted @ 2019-10-08 14:39  卢伟亮  阅读(339)  评论(0编辑  收藏  举报