Пример #1
0
        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);
        }
Пример #2
0
        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();
        }