⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 idtoselection.java

📁 JAVA+MO(for JAVA)开发的基于遗传算法的最短路径源代码
💻 JAVA
字号:
package SelectionSet;
import com.esri.mo2.data.feat.BaseDataID;
import com.esri.mo2.map.dpy.FeatureLayer;
import com.esri.mo2.data.feat.BaseSelectionSet;
import com.esri.mo2.data.feat.SelectionSet;
import Bean.HashArray;
import BestRoadGA.LineBean;

public class IDtoSelection {
    public IDtoSelection() {
        try {
            jbInit();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    private void endowArray(int arrayNum,int array[],int value[])
    {
        for(int i=0;i<arrayNum;i++)
        {
            array[i]=value[i];
        }
    }

    public SelectionSet convertSelectionSet(FeatureLayer flayer1,LineBean[] line,HashArray lineIndexs)
    //根据整型线集的索引自定义哈希数组转换为选集
    {
        int n=lineIndexs.getLength();
        BaseSelectionSet selectionSet = new BaseSelectionSet(flayer1.getFeatureClass());
        selectionSet.clear();
        int array[]=new int[n];
        endowArray(n,array,lineIndexs.getValue());
        for(int i=0;i<n;i++)
        {
            int id=array[i];
            id=line[id].getId();
            BaseDataID lineid = new BaseDataID(flayer1.getName(),id);
            selectionSet.add(lineid);
        }
        return selectionSet;
    }

    public SelectionSet convertSelectionSet(FeatureLayer flayer1,LineBean[] line,int lineIndex[])
    //根据整型线集的索引数组转换为选集
    {
        int n=lineIndex.length-1;
        BaseSelectionSet selectionSet = new BaseSelectionSet(flayer1.getFeatureClass());
        selectionSet.clear();
        for(int i=0;i<n;i++)
        {
            int id=lineIndex[i];
            id=line[id].getId();
            BaseDataID lineid = new BaseDataID(flayer1.getName(),id);
            selectionSet.add(lineid);
        }
        return selectionSet;
    }

    private void jbInit() throws Exception {
    }

    /*    public static void main(String ags[])
    {
        ArrayList lineid=new ArrayList();
        for(int i=0;i<5;i++)
        {
            lineid.add(new Integer(i));
        }
        Layer layer=new Layer();
        layer.setDataset("com.esri.mo2.src.file.FileSystemConnection!E:/上海道路/roadc_cur.shp!");
        FeatureLayer flayer1=(FeatureLayer)layer;
        System.out.println(flayer1.getName());
        //IDtoSelection selection=new IDtoSelection();
        //selection.convertSelectionSet(flayer1,lineid);
    }*/

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -