Пример #1
0
        private void ShowWind_Click(object sender, EventArgs e)
        {
            ILayer        pLayer        = MainMap.get_Layer(0);
            IFeatureLayer pFeatureLayer = pLayer as IFeatureLayer;
            IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;

            int indexDir   = pFeatureClass.Fields.FindField("Dir");
            int indexSpeed = pFeatureClass.Fields.FindField("Speed");

            ISymbol          pSymbol          = AOUtil.FetchSymbol("dir");
            IGeoFeatureLayer pGeoFeatureLayer = pFeatureLayer as IGeoFeatureLayer;
            ISimpleRenderer  pSimpleRenderer  = pGeoFeatureLayer.Renderer as ISimpleRenderer;

            pSimpleRenderer.Symbol = pSymbol;

            IRotationRenderer pRotationRender = pSimpleRenderer as IRotationRenderer;

            pRotationRender.RotationField = "dir";

            ISizeRenderer pSizeRender = pSimpleRenderer as ISizeRenderer;

            pSizeRender.SizeRendererExpression = "[Speed]";
            pSizeRender.SizeRendererFlags      = 1;

            MainMap.Refresh();
        }
Пример #2
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            ISpatialFilter pSpatialFilter = new SpatialFilterClass();

            pSpatialFilter.SearchOrder = esriSearchOrder.esriSearchOrderSpatial;

            if (radioIntersect.Checked == true)
            {
                pSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
            }

            if (radioContain.Checked == true)
            {
                pSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelContains;
            }

            if (radioTouch.Checked == true)
            {
                pSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelTouches;
            }

            pSpatialFilter.Geometry = AOUtil.GetSelectGeometry(m_axMapControl);

            ILayer            pLayer            = GetLayerByName(comboLayers.SelectedItem.ToString());
            IFeatureLayer     pFeatureLayer     = pLayer as IFeatureLayer;
            IFeatureSelection pFeatureSelection = pLayer as IFeatureSelection;

            pSpatialFilter.GeometryField = pFeatureLayer.FeatureClass.ShapeFieldName;
            pFeatureSelection.Clear();
            pFeatureSelection.SelectFeatures(pSpatialFilter, esriSelectionResultEnum.esriSelectionResultNew, false);
            m_axMapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);

            Close();
        }
Пример #3
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            IGeometry pGeometry = AOUtil.GetSelectGeometry(m_axMapControl);

            if (pGeometry == null)
            {
                return;
            }

            double bufferDis = Convert.ToDouble(txtBuffer.Text);

            ITopologicalOperator pTopologicalOperator = pGeometry as ITopologicalOperator;
            IGeometry            pBufferGeometry      = pTopologicalOperator.Buffer(bufferDis);

            m_axMapControl.DrawShape(pBufferGeometry);
        }
Пример #4
0
        private void MainMap_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e)
        {
            IEnvelope pEnvelope = null;

            switch (m_curTool)
            {
            case GISTool.Default:

                break;

            case GISTool.ZoomIn:
                pEnvelope = MainMap.TrackRectangle();
                MainMap.ActiveView.Extent = pEnvelope;
                MainMap.ActiveView.Refresh();
                break;

            case GISTool.ZoomOut:
                pEnvelope = MainMap.TrackRectangle();
                IMap        pMap        = MainMap.Map;
                IActiveView pActiveView = pMap as IActiveView;
                double      newWidth    = pActiveView.Extent.Width * (pActiveView.Extent.Width / pEnvelope.Width);
                double      newHeight   = pActiveView.Extent.Height * (pActiveView.Extent.Height / pEnvelope.Height);

                IEnvelope pEnvelope1 = new EnvelopeClass();
                pEnvelope1.PutCoords(pActiveView.Extent.XMin - ((pEnvelope.XMin - pActiveView.Extent.XMin) * (pActiveView.Extent.Width / pEnvelope.Width)),
                                     pActiveView.Extent.YMin - ((pEnvelope.YMin - pActiveView.Extent.YMin) * (pActiveView.Extent.Height / pEnvelope.Height)),
                                     (pActiveView.Extent.XMin - ((pEnvelope.XMin - pActiveView.Extent.XMin) * (pActiveView.Extent.Width / pEnvelope.Width))) + newWidth,
                                     (pActiveView.Extent.YMin - ((pEnvelope.YMin - pActiveView.Extent.YMin) * (pActiveView.Extent.Height / pEnvelope.Height))) + newHeight);

                pActiveView.Extent = pEnvelope1;
                pActiveView.Refresh();
                break;

            case GISTool.Pan:
                MainMap.Pan();
                break;

            case GISTool.Select:
                m_selectTool.OnMouseDown(e.button, e.shift, e.x, e.y);
                break;

            case GISTool.Identify:
                AOUtil.Identify(MainMap, e.x, e.y);
                break;
            }
        }