コード例 #1
0
        public override void OnClick()
        {
            IMapControlDefault pMapControl = m_hookHelper.Hook as IMapControlDefault;
            IGeoFeatureLayer   pGeoFeatLyr = pMapControl.CustomProperty as IGeoFeatureLayer;

            if (pGeoFeatLyr == null)
            {
                return;
            }

            SymbolForm symbolForm = new SymbolForm();

            IStyleGalleryItem styleGalleryItem = null;

            switch (pGeoFeatLyr.FeatureClass.ShapeType)
            {
            case esriGeometryType.esriGeometryPoint:
                styleGalleryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassMarkerSymbols);
                break;

            case esriGeometryType.esriGeometryPolyline:
                styleGalleryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassLineSymbols);
                break;

            case esriGeometryType.esriGeometryPolygon:
                styleGalleryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassFillSymbols);
                break;
            }

            symbolForm.Dispose();

            m_App.MainPlatfrom.Activate();

            if (styleGalleryItem == null)
            {
                return;
            }

            ISimpleRenderer simpleRenderer = new SimpleRendererClass();

            simpleRenderer.Symbol = (ISymbol)styleGalleryItem.Item;
            pGeoFeatLyr.Renderer  = simpleRenderer as IFeatureRenderer;

            pMapControl.Refresh(esriViewDrawPhase.esriViewGeography, null, null);
        }
コード例 #2
0
ファイル: LayerMenu.cs プロジェクト: TinleyPei/YNDQHP
        /// <summary>
        /// 显示符号选择器
        /// </summary>
        private void ShowSymbolSelectForm()
        {
            ISimpleRenderer currentSimpleRender;

            IMapControlDefault pMapControl      = m_hookHelper.Hook as IMapControlDefault;
            IGeoFeatureLayer   pGeoFeatureLayer = pMapControl.CustomProperty as IGeoFeatureLayer;

            if (pGeoFeatureLayer == null)
            {
                return;
            }

            currentSimpleRender = pGeoFeatureLayer.Renderer as ISimpleRenderer;
            SymbolForm        symbolForm      = new SymbolForm(currentSimpleRender);
            IStyleGalleryItem styleGallryItem = null;

            switch (pGeoFeatureLayer.FeatureClass.ShapeType)
            {
            case esriGeometryType.esriGeometryPoint:
                styleGallryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassMarkerSymbols);
                break;

            case esriGeometryType.esriGeometryPolyline:
                styleGallryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassLineSymbols);
                break;

            case esriGeometryType.esriGeometryPolygon:
                styleGallryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassFillSymbols);
                break;
            }

            symbolForm.Dispose();
            if (styleGallryItem == null)
            {
                return;
            }

            ISimpleRenderer simpleRender = new SimpleRendererClass();

            simpleRender.Symbol       = styleGallryItem.Item as ISymbol;
            pGeoFeatureLayer.Renderer = simpleRender as IFeatureRenderer;

            pMapControl.Refresh(esriViewDrawPhase.esriViewGeography, null, null);
            SymbolChanged();
        }
コード例 #3
0
ファイル: LayerMenu.cs プロジェクト: lovelll/YNDQHP
        /// <summary>
        /// 显示符号选择器
        /// </summary>
        private void ShowSymbolSelectForm()
        {
            ISimpleRenderer currentSimpleRender;

            IMapControlDefault pMapControl = m_hookHelper.Hook as IMapControlDefault;
            IGeoFeatureLayer pGeoFeatureLayer = pMapControl.CustomProperty as IGeoFeatureLayer;
            if (pGeoFeatureLayer == null)
            {
                return;
            }

            currentSimpleRender = pGeoFeatureLayer.Renderer as ISimpleRenderer;
            SymbolForm symbolForm = new SymbolForm(currentSimpleRender);
            IStyleGalleryItem styleGallryItem = null;
            switch (pGeoFeatureLayer.FeatureClass.ShapeType)
            {
                case esriGeometryType.esriGeometryPoint:
                    styleGallryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassMarkerSymbols);
                    break;
                case esriGeometryType.esriGeometryPolyline:
                    styleGallryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassLineSymbols);
                    break;
                case esriGeometryType.esriGeometryPolygon:
                    styleGallryItem = symbolForm.GetItem(esriSymbologyStyleClass.esriStyleClassFillSymbols);
                    break;
            }

            symbolForm.Dispose();
            if (styleGallryItem == null)
            {
                return;
            }

            ISimpleRenderer simpleRender = new SimpleRendererClass();
            simpleRender.Symbol = styleGallryItem.Item as ISymbol;
            pGeoFeatureLayer.Renderer = simpleRender as IFeatureRenderer;

            pMapControl.Refresh(esriViewDrawPhase.esriViewGeography, null, null);
            SymbolChanged();
        }