private void 查看地图中第一个图层的属性记录ToolStripMenuItem_Click(object sender, EventArgs e) { //判断地图视图中是否有处于显示状态中的地图 if (this.mapCtrl.ActiveMap == null) { MessageBox.Show("请先在地图视图中显示一幅地图!!!"); return; } //获取激活地图 Map map = this.mapCtrl.ActiveMap; //判断地图中是否有图层 if (map.LayerCount < 1) { MessageBox.Show("操作失败,地图中没有图层!!!"); return; } //获取地图中第一个图层的属性表 VectorLayer vecLayer = map.get_Layer(0) as VectorLayer; RecordSet rcdSet = null; QueryDef qryDef = new QueryDef(); IVectorCls vecCls = vecLayer.GetData() as IVectorCls; rcdSet = vecCls.Select(qryDef); this.attCtrl.SetXCls(vecCls, rcdSet); return; }
private void 择ToolStripMenuItem_Click(object sender, EventArgs e) { Map acMap = this.mapCtrl.ActiveMap; MapLayer mapLayer = null; if (acMap.LayerCount > 0) { mapLayer = acMap.get_Layer(0); } SFeatureCls Sfcls = mapLayer.GetData() as SFeatureCls; FileLayer6x file6x = mapLayer as FileLayer6x; VectorLayer veclayer = file6x.get_Item(0) as VectorLayer; Sfcls = veclayer.GetData() as SFeatureCls; SFeatureCls tesfcl = new SFeatureCls(); if (!tesfcl.Open("file:///c:\\users\\tangchao\\desktop\\ppp.wp")) { int i = 0; } QueryDef def = new QueryDef(); def.Filter = "NAME=吉林省"; RecordSet rst = Sfcls.Select(def); this.mapCtrl.FlashSelectSet(); //设置为拉框查询 SelectType seltype = SelectType.Rectangle; //创建拉框选择类对象 mapCtrl.SetBasTool(null); CirSelectToolClass basTool = new CirSelectToolClass(mapCtrl, SelectDataType.Anyone, attCtrl, seltype); mapCtrl.SetBasTool(basTool); }
private void 闪烁ToolStripMenuItem_Click(object sender, EventArgs e) { this.mapCtrl.EndFlash(); IVectorCls VectorCls = new SFeatureCls(); if (!VectorCls.Open("file:///c:\\users\\tangchao\\desktop\\ppp.wp")) { int i = 0; } // DataConvert dc = new DataConvert(); // if (dc.OpenSource(VectorCls) > 0 && dc.OpenDestination("c:\\users\\tangchao\\desktop\\ppptrr.wp") > 0) // { // dc.Convert(); // } QueryDef def1 = new QueryDef(); def1.Filter = "NAME='黑龙江省 'or ID > 3"; SelectOption option = null; option = new SelectOption(); //类型是点、线、区、注记的图层均属于查询范围 option.DataType = SelectDataType.AnyVector; //当前地图中所有图层 option.LayerCtrl = SelectLayerControl.Visible; //多选 option.SelMode = SelectMode.Multiply; //结果数据累加 option.UnMode = UnionMode.Add; //查询 SelectSet set = this.mapCtrl.ActiveMap.Select(def1, true, null, option); this.mapCtrl.FlashSelectSet(); return; RecordSet rst1 = VectorCls.Select(def1); Map acMap = this.mapCtrl.ActiveMap; MapLayer mapLayer = null; if (acMap.LayerCount > 0) { mapLayer = acMap.get_Layer(0); } SFeatureCls Sfcls = mapLayer.GetData() as SFeatureCls; FileLayer6x file6x = mapLayer as FileLayer6x; VectorLayer veclayer = file6x.get_Item(0) as VectorLayer; Sfcls = veclayer.GetData() as SFeatureCls; QueryDef def = new QueryDef(); def.Filter = "ID>6"; RecordSet rst = Sfcls.Select(def); if (rst == null || rst.Count == 0) { MessageBox.Show("未查询到数据"); return; } this.attCtrl.SetXCls(Sfcls, rst); SelectSet sleset = this.mapCtrl.ActiveMap.GetSelectSet(); sleset.Append(mapLayer, rst); this.mapCtrl.FlashSelectSet(); }