public class LayerChart extends Layer
Layer
类,提供对海图图层的显示、选择等控制的方法。/** * 获取海图图层并查询选中的海图物标的信息。 */ private void layerChartExample() { //获取海图图层 LayerChart layerChart = (LayerChart)m_mapControl.getMap().getLayers().get(0); //获取海图图层上被选中的物标信息数组 ChartObjectInfo[] chartObjectInfos = layerChart.getSelectionInfos(); //遍历选中的物标信息数组,获取物标的基本信息 if (chartObjectInfos.length > 0) { ChartObjectInfo chartObjectInfo; for (int i = 0; i < chartObjectInfos.length; i++) { chartObjectInfo = chartObjectInfos[i]; //获取物标的本地化名称 String name = chartObjectInfo.getLocalName(); //获取物标的 RCID 标识 long featureID = chartObjectInfo.getFeatureID(); //获取物标的物标编码 int code = chartObjectInfo.getCode(); //获取物标的几何对象类型 GeometryType type = chartObjectInfo.getGeometryType(); //还可以通过 ChartObjectInfo 类的其他属性获取物标简称、机构简称、水深 //值等信息 String Infos = "第" + (i + 1) + "个物标\n名称:" + name + "\n物标编码:" + code + "\nRCID:" + featureID + "\n几何对象类型:" + type + "\n"; //获取 S-57 标准中定义的物标属性信息,包括属性的简称和字段值 ChartAttributeInfo[] chartAttributeInfos = chartObjectInfo.getS57Attributes(); ChartAttributeInfo chartAttributeInfo; String attributeInfo; for (int j = 0; j < chartAttributeInfos.length; j++) { chartAttributeInfo = chartAttributeInfos[j]; attributeInfo = "属性简称:" + chartAttributeInfo.getAcronym() + " 值:" + chartAttributeInfo.getValue() + "\n"; Infos += attributeInfo; } //输出物标信息 System.out.print(Infos); } } }
限定符和类型 | 方法和说明 |
---|---|
void |
clearSelections()
清空选择集数组。
|
void |
computeBounds() |
boolean |
deleteSubLayer(Dataset dataset) |
Layer |
findLayer(String layerName)
根据给定的图层名称获取图层。
|
LayerChartSub |
getActiveAddSubLayer() |
int |
getCount() |
DatasetGroup |
getDatasetGroup()
返回当前海图图层对应的数据集分组。
|
Layer |
getItemAt(Dataset dataset) |
Layer |
getItemAt(int index) |
Layer |
getItemAt(String name) |
ChartObjectInfo[] |
getSelectionInfos()
返回当前选择的对象信息数组。
|
Selection[] |
getSelections()
返回当前海图图层的选择集的集合。
|
GeoRegion |
getTextClipRegion()
返回文本显示裁剪区,该裁剪区裁剪对应海图图层上所有点线对象。
|
void |
highlightObject(long featureID,
int recordsetID,
boolean isMoveToCenter)
高亮显示选择集中指定的某个物标对象。
|
boolean |
hitTestExtend(Point2D point,
double tolerance)
海图图层扩展的点击测试,返回是否点击成功。
|
void |
refreshS57EditDatasetGroup() |
void |
setAttributeModifiedFlag()
通过记录集编辑属性,在编辑完成时进行设置,用于刷新地图时重新读取部分数据集。
|
void |
setSnapable(boolean value)
设置图层是否可捕捉。
|
void |
setTextClipRegion(GeoRegion geoRegion)
设置文本显示裁剪区,该裁剪区裁剪对应海图图层上所有点线对象。
|
void |
setVisible(boolean value)
设置此图层是否可见。
|
void |
updateData() |
addCaptionChangedListener, addEditableChangedListener, addElementDrawingListener, addGridFunction, addSelectableChangedListener, addSnapableChangedListener, addVisibleChangedListener, checkLayerSubType, clearThemeElementPositions, fromXML, getAdditionalSetting, getBlendMode, getBounds, getCaption, getClipRegion, getDataset, getDeduplicateThreshold, getDeduplicateTolerance, getDescription, getDisplayControledLayer, getDisplayFilter, getDisplayFilterStr, getExtensionPlugin, getExtensionUserInfo, getExternalInfo, getFieldValuesDisplayFilter, getFillMarkerOrder, getGridFunctionArgs, getGridFunctionType, getGridFunctonCount, getLayerWeight, getMap, getMaxVisibleScale, getMinVisibleGeometrySize, getMinVisibleScale, getName, getOpaqueRate, getOverlapGeometryPixel, getOverlapGeometryThreshold, getParentGroup, getParentSnapshot, getRepresentationField, getSelection, getSource, getSubLayerType, getSubType, getSymbolScale, getTheme, getThemeElementPosition, getTimeEndField, getTimeFilterEnding, getTimeFilterStarting, getTimeStartField, getTimeStepInterval, getValueExpressions, hitTest, hitTest, hitTest, hitTestGeoCompound, isAntialias, isClipRegionEnabled, isCompleteLineSymbolDisplayed, isCrossroadOptimized, isDeduplicateEnabled, isDiposed, isDisposed, isEditable, isFullLabelEnabled, isInteroperable, isLayerCacheEnabled, isModified, isOverlapDisplayed, isOverlapGeometryEnabled, isRepresentationEnabled, isSelectable, isSnapable, isSuperAndSubScript, isSwipeEnabled, isSymbolScalable, IsTimeFilterEnable, isVisible, isVisibleScale, removeCaptionChangedListener, removeEditableChangedListener, removeElementDrawingListener, removeGridFunction, removeSelectableChangedListener, removeSnapableChangedListener, removeThemeElementPosition, removeVisibleChangedListener, setAdditionalSetting, setAntialias, setBlendMode, setCaption, setClipRegion, setClipRegionEnabled, setCompleteLineSymbolDisplayed, setCrossroadOptimized, setDataset, setDeduplicateEnabled, setDeduplicateThreshold, setDeduplicateTolerance, setDescription, setDisplayControledLayer, setDisplayFilter, setDisplayFilterStr, setEditable, setExtensionUserInfo, setExternalInfo, setFillMarkerOrder, setFullLabelEnabled, setInteroperable, SetLayerCacheEnabled, SetLayerCacheRefresh, setLayerWeight, setMaxVisibleScale, setMinVisibleGeometrySize, setMinVisibleScale, setModified, setOpaqueRate, setOverlapDisplayed, setOverlapGeometryEnabled, setOverlapGeometryPixel, setOverlapGeometryThreshold, setRepresentationEnabled, setRepresentationField, setSelectable, setSelection, setSource, setSource, setSuperAndSubScript, setSwipeEnabled, setSymbolScalable, setSymbolScale, setThemeElementPosition, setTimeEndField, setTimeFilterEnable, setTimeFilterEnding, setTimeFilterStarting, setTimeStartField, setTimeStepInterval, setValueExpressions, themeSymbolsToGeometries, themeSymbolsToGeometrys, themeToDatasetVector, toXML
public DatasetGroup getDatasetGroup()
public Selection[] getSelections()
public ChartObjectInfo[] getSelectionInfos()
LayerChart
类的示例。public void clearSelections()
public boolean hitTestExtend(Point2D point, double tolerance)
若指定的点与对象上最近点的距离是在指定的容限范围内,则该对象被选中。 如果多个重叠的对象都满足条件,则都被选中。
point
- 要测试的点。tolerance
- 指定的容限。public void highlightObject(long featureID, int recordsetID, boolean isMoveToCenter)
注意:
1. 高亮显示选择集中的指定物标对象后,选择集中的其他物标对象不再高亮显示;重新选择要素后,该物表对象的高亮显示失效;
2. 该方法会自动刷新跟踪层或地图,不需要再手动调用刷新。
featureID
- 指定的物标对象的 ID。recordsetID
- 指定的物标对象所在记录集的 ID。isMoveToCenter
- 指定是否要将此物标在地图窗口中居中显示,为 true 时会刷新地图。/** * 高亮显示指定的海图物标。 * @param layerChart 指定的选中物标的海图图层。 */ private void highlightChartObjectExample(LayerChart layerChart) { //获取海图图层上被选中的物标信息数组 ChartObjectInfo[] chartObjectInfos = layerChart.getSelectionInfos(); //将物标对象信息数组中的第 1 个物标高亮显示 if (chartObjectInfos.length > 0) { long featureID = chartObjectInfos[0].getFeatureID(); int recordsetID = chartObjectInfos[0].getRecordsetID(); GeometryType type = chartObjectInfos[0].getGeometryType(); //高亮该海图物标 layerChart.highlightObject(featureID, recordsetID, true); } }
public boolean deleteSubLayer(Dataset dataset)
public void setAttributeModifiedFlag()
public GeoRegion getTextClipRegion()
public void setTextClipRegion(GeoRegion geoRegion)
value
- 文本显示裁剪区。public void refreshS57EditDatasetGroup()
public void computeBounds()
public void updateData()
public LayerChartSub getActiveAddSubLayer()
public int getCount()
public Layer getItemAt(int index)
public void setVisible(boolean value)
Layer
setVisible
在类中 Layer
value
- 指定图层是否可见。public void setSnapable(boolean value)
Layer
setSnapable
在类中 Layer
value
- 指定图层是否可捕捉。Copyright © 2021–2024 SuperMap. All rights reserved.