AE中根據屬性提取要素的功能

2021-05-27 22:52:31 字數 1380 閱讀 1317

昨天幫一位朋友實現乙個根據屬性提取要素的功能,現記錄如下,以備後用:

先看看效果圖吧!

要素提取前

要素提取後

以下實現這個功能的關鍵**:

//主程式的路徑(這個是全域性變數)

//設定環境

geoprocessor gp = new geoprocessor();

gp.overwriteoutput = true;

//獲取要素圖層

ifeaturelayer player = this.axmapcontrol1.map.get_layer(0) as ifeaturelayer;

ifeatureclass inputfeatures = player.featureclass;

//使用select工具

esri.arcgis.analysistools.select selectfeature = new select();

selectfeature.in_features = inputfeatures;

selectfeature.out_feature_class = @"output\fgselect.shp";

selectfeature.where_clause = "gridcode>=50";

//執行

gp.execute(selectfeature,null);

// 將結果載入到當前地圖

iworkspacefactory pworkspacefactory = new shapefileworkspacefactoryclass();

iworkspace shpworksapce = pworkspacefactory.openfromfile(pfolder, 0);

ifeatureworkspace pfeatureworkspace=shpworksapce as ifeatureworkspace;

ifeatureclass pfeatureclass = pfeatureworkspace.openfeatureclass(pfilename);

ifeaturelayer outputlayer = new featurelayerclass();

outputlayer.featureclass = pfeatureclass;

outputlayer.name = pfeatureclass.aliasname;

this.axmapcontrol1.map.addlayer((ilayer)outputlayer);

this.axmapcontrol1.activeview.refresh();

arcgis裡面的gp真的是功能強大呀,借助它可以省不少事,看來以後還得多研究一下gp這東東。

AE中閃爍要素的方兩種方法

1.利用imapcontrol3 flashshape 方法 呼叫如下 isymbol symbol create symbol featuer.shape.geometrytype this.m mapcontrol.flashshape featuer.shape,3,150,symbol 2....

List中根據class實體的某個屬性去重或排序

去重 根據alarmentity.class的乙個屬性sourceproblem去重,並保留最新 alarms是按照時間順序儲存的 private static listremoveduplicatealarms listalarms 為了保留最新,所以list需要使用reverse從後往前讀取 c...

stream流根據集合中的元素的屬性進行去重的方法

public class streamlisttest 輸出結果 student stuno 1,name zhangsan student stuno 1,name 趙六 student stuno 2,name wangwu student stuno 3,name 超仔 以下是根據物件中的某個...