예제 #1
0
 private void vTreeResult_DoubleClick(object sender, EventArgs e)
 {
     try
     {
         if (this.WriteLog)
         {
             Plugin.LogTable.Writelog("最大林斑号查询");
         }
         if (vTreeResult.SelectedNode.Level == 3)
         {
             IFeature pFeature = CommnClass.Query(vTreeResult.SelectedNode.Text);
             if (pFeature == null)
             {
                 MessageBox.Show("未找到该行政区林斑号信息!", "提示!");
                 return;
             }
             ///ZQ 20111020 定位范围扩大1.5倍
             IEnvelope pExtent = pFeature.Extent;
             SysCommon.ModPublicFun.ResizeEnvelope(pExtent, 1.5);
             //先刷新,后闪烁问题
             m_MapControl.Extent = pExtent;
             m_MapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, null, null);
             m_MapControl.ActiveView.ScreenDisplay.UpdateWindow();
             m_MapControl.FlashShape(pFeature.ShapeCopy, 3, 200, null);
         }
     }
     catch { }
 }
예제 #2
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            IEnvelope pEnvelope = new EnvelopeClass();
            IPoint    pPoint    = new PointClass();

            pPoint.PutCoords(Convert.ToDouble(txtlong.Text), Convert.ToDouble(txtlat.Text));

            pEnvelope = pAxMapControl.Extent;
            pEnvelope.CenterAt(pPoint);
            pAxMapControl.Extent = pEnvelope.Envelope;
            pAxMapControl.FlashShape(pPoint as IGeometry);
            //ccc(pPoint);
            //ddd(pPoint);
        }
예제 #3
0
        private void setDistrictColor(string districtName)
        {
            if (m_map.Map.LayerCount < 5)
            {
                return;
            }
            IFeatureLayer pFeatureLayer = m_map.Map.get_Layer(4) as IFeatureLayer;

            if (pFeatureLayer == null)
            {
                return;
            }
            IQueryFilter pFilter;

            pFilter             = new QueryFilterClass();
            pFilter.WhereClause = "Name = '" + districtName + "'";//"Name" = '嘉定区' OR "Name" = '杨浦区'
            IFeatureSelection pFeatureSelection;

            pFeatureSelection = pFeatureLayer as IFeatureSelection;
            pFeatureSelection.SelectFeatures(pFilter, esriSelectionResultEnum.esriSelectionResultNew, true);
            //将选择集添上颜色
            IRgbColor pColor;

            pColor       = new RgbColorClass();
            pColor.Red   = 220;
            pColor.Green = 112;
            pColor.Blue  = 60;
            ISelectionSet selectSet = pFeatureSelection.SelectionSet;

            // pFeatureSelection.SelectionColor = getRGB(220, 60, 60);//pColor
            //m_map.ClearLayers();
            m_map.Refresh();

            /* 删除闪烁效果*/
            ISelectionSet pFeatSet;

            pFeatSet = pFeatureSelection.SelectionSet;
            IFeatureCursor pFeatCursor;
            ICursor        pCursor;

            pFeatSet.Search(pFilter, true, out pCursor);
            pFeatCursor = pCursor as IFeatureCursor;
            IFeature pFeat;

            pFeat = pFeatCursor.NextFeature();
            while (pFeat != null)
            {
                if (pFeat != null)
                {
                    Console.Out.WriteLine(pFeat.Fields);
                    ISimpleFillSymbol pFillsyl2;
                    pFillsyl2       = new SimpleFillSymbolClass();
                    pFillsyl2.Color = getRGB(220, 60, 60);
                    m_map.FlashShape(pFeat.Shape, 0, 0, pFillsyl2);
                }
                pFeat = pFeatCursor.NextFeature();
            }
            setPointColor(listCode[this.districtList.SelectedIndex].ToString());
            // */
        }
예제 #4
0
        //闪烁线
        static void FlashLine(AxMapControl mapControl, IScreenDisplay iScreenDisplay, IGeometry iGeometry)
        {
            ISimpleLineSymbol iLineSymbol = new SimpleLineSymbol();

            iLineSymbol.Width = 4;
            IRgbColor iRgbColor = new RgbColor();

            iRgbColor.Red     = 255;
            iLineSymbol.Color = iRgbColor;
            ISymbol iSymbol = (ISymbol)iLineSymbol;

            iSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen;
            mapControl.FlashShape(iGeometry, 3, 200, iSymbol);
        }
예제 #5
0
        //闪烁点
        public static void FlashPoint(AxMapControl mapControl, IScreenDisplay iScreenDisplay, IGeometry iGeometry)
        {
            ISimpleMarkerSymbol iMarkerSymbol;
            ISymbol iSymbol;
            IRgbColor iRgbColor;

            iMarkerSymbol = new SimpleMarkerSymbol();
            iMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle;
            iRgbColor = new RgbColor();
            iRgbColor.RGB = System.Drawing.Color.FromArgb(0, 0, 0).ToArgb();
            iMarkerSymbol.Color = iRgbColor;
            iSymbol = (ISymbol)iMarkerSymbol;
            iSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen;
            mapControl.FlashShape(iGeometry, 5, 300, iSymbol);
        }
예제 #6
0
        //闪烁线
        public static void FlashLine(AxMapControl mapControl, IScreenDisplay iScreenDisplay, IGeometry iGeometry)
        {
            ISimpleLineSymbol iLineSymbol;
            ISymbol iSymbol;
            IRgbColor iRgbColor;

            iLineSymbol = new SimpleLineSymbol();
            iLineSymbol.Width = 4;
            iRgbColor = new RgbColor();
            iRgbColor.Red = 255;
            iLineSymbol.Color = iRgbColor;
            iSymbol = (ISymbol)iLineSymbol;
            iSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen;
            mapControl.FlashShape(iGeometry, 5, 300, iSymbol);
        }
예제 #7
0
        //闪烁面
        static void FlashPolygon(AxMapControl mapControl, IScreenDisplay iScreenDisplay, IGeometry iGeometry)
        {
            ISimpleFillSymbol iFillSymbol;
            ISymbol           iSymbol;
            IRgbColor         iRgbColor;

            iFillSymbol               = new SimpleFillSymbol();
            iFillSymbol.Style         = esriSimpleFillStyle.esriSFSSolid;
            iFillSymbol.Outline.Width = 12;
            iRgbColor         = new RgbColor();
            iRgbColor.RGB     = System.Drawing.Color.FromArgb(100, 180, 180).ToArgb();
            iFillSymbol.Color = iRgbColor;
            iSymbol           = (ISymbol)iFillSymbol;
            iSymbol.ROP2      = esriRasterOpCode.esriROPNotXOrPen;
            iScreenDisplay.SetSymbol(iSymbol);
            mapControl.FlashShape(iGeometry, 3, 200, iSymbol);
        }
예제 #8
0
 //闪烁面
 static void FlashPolygon(AxMapControl mapControl, IScreenDisplay iScreenDisplay, IGeometry iGeometry)
 {
     ISimpleFillSymbol iFillSymbol;
     ISymbol iSymbol;
     IRgbColor iRgbColor;
     iFillSymbol = new SimpleFillSymbol();
     iFillSymbol.Style = esriSimpleFillStyle.esriSFSSolid;
     iFillSymbol.Outline.Width = 12;
     iRgbColor = new RgbColor();
     iRgbColor.RGB = System.Drawing.Color.FromArgb(100, 180, 180).ToArgb();
     iFillSymbol.Color = iRgbColor;
     iSymbol = (ISymbol)iFillSymbol;
     iSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen;
     iScreenDisplay.SetSymbol(iSymbol);
     mapControl.FlashShape(iGeometry, 3, 200, iSymbol);
 }
예제 #9
0
        public static int query(AxMapControl axMapControl1, string searchName,int index,bool flash)
        {
            ILayer layer = axMapControl1.get_Layer(index);
            IFeatureLayer featureLayer = layer as IFeatureLayer;
            int i=0;
            if(featureLayer==null)
            {

                MessageBox.Show("选择图层不是Feature图层!");

                return i;

            }
            //获取featureLayer的featureClass

            IFeatureClass featureClass = featureLayer.FeatureClass;
            IFeature feature = null;

            IQueryFilter queryFilter = new QueryFilterClass();

             //queryFilter.WhereClause = "SELECT * FROM " + featureClass.AliasName + " WHERE: 'CC' = '" + searchName + "'";

            try
            {
                queryFilter.WhereClause = "用地类型 = '" + searchName + "'";
                IFeatureCursor featureCusor = featureLayer.Search(queryFilter, false); ;
                //featureCusor

                //search的参数第一个为过滤条件,第二个为是否重复执行。
                while ((feature = featureCusor.NextFeature()) != null)
                {
                    //axMapControl1.Extent =(IEnvelope) feature.Shape;
                    axMapControl1.Map.SelectFeature(axMapControl1.get_Layer(index), feature);
                if(flash)
                    axMapControl1.FlashShape(feature.Shape);
                    //axMapControl1.Refresh(esriViewDrawPhase.esriViewGraphicSelection, null, null);
                   i++;
                }
                axMapControl1.ActiveView.Refresh();
                return i;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return i;
            }
        }