Esempio n. 1
0
        public static IRgbColor GetFeatureColor(IGeoFeatureLayer igeoFeatureLayer_0, IFeature ifeature_0)
        {
            IRgbColor        rgbColor = new RgbColor();
            IFeatureRenderer renderer = igeoFeatureLayer_0.Renderer;
            ISymbol          symbol   = renderer.get_SymbolByFeature(ifeature_0);

            if (symbol is IMarkerSymbol)
            {
                IMarkerSymbol markerSymbol = symbol as IMarkerSymbol;
                rgbColor.RGB = Convert.ToInt32(markerSymbol.Color.RGB);
            }
            else if (symbol is ILineSymbol)
            {
                ILineSymbol lineSymbol = symbol as ILineSymbol;
                rgbColor.RGB = Convert.ToInt32(lineSymbol.Color.RGB);
            }
            else if (symbol is IFillSymbol)
            {
                IFillSymbol fillSymbol = symbol as IFillSymbol;
                rgbColor.RGB = Convert.ToInt32(fillSymbol.Color.RGB);
            }
            else
            {
                rgbColor.RGB = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Blue);
            }
            return(rgbColor);
        }
Esempio n. 2
0
        /*管理symbol的类型,设置和预览
         *
         */
        private void previewSymbol(object Item)
        {
            switch (axSymbologyControl.StyleClass)
            {
            case esriSymbologyStyleClass.esriStyleClassFillSymbols:
                outColorBtn.Enabled = true; angleSpin.Enabled = false; whichSymbolType = SymbolType.FillSymbol;
                tmpFillSymbol       = Item as IFillSymbol;
                break;

            case esriSymbologyStyleClass.esriStyleClassLineSymbols:
                outColorBtn.Enabled = false; angleSpin.Enabled = false; whichSymbolType = SymbolType.LineSymbol;
                tmpLineSymbol       = Item as ILineSymbol;
                break;

            case esriSymbologyStyleClass.esriStyleClassMarkerSymbols:
                outColorBtn.Enabled = false; angleSpin.Enabled = true; whichSymbolType = SymbolType.MarkerSymbol;
                tmpMarkerSymbol     = Item as IMarkerSymbol;
                break;

            case esriSymbologyStyleClass.esriStyleClassLegendItems:
            default:
                tmpNoneSymbol = Item as ISymbol;
                break;
            }
        }
Esempio n. 3
0
        private void FrmFrameBackground_Load(object sender, EventArgs e)
        {
            //加载背景样式
            string EsriStylePathFram = ClsGDBDataCommon.GetParentPathofExe() + @"Resource\Style\ESRI.ServerStyle";

            axSymbologyCtlFrame.LoadStyleFile(EsriStylePathFram);
            axSymbologyCtlFrame.StyleClass = esriSymbologyStyleClass.esriStyleClassBackgrounds;
            if (SymbolBackground != null)
            {
                pStyleGalleryItem.Item = SymbolBackground;

                IFillSymbol pFS = SymbolBackground.FillSymbol;
                this.SizeBackgroundOutline.Text = pFS.Outline.Width.ToString();

                IColor pFillColor = pFS.Color;
                Color  pColorFill = ColorTranslator.FromOle(pFillColor.RGB);
                colorFill.SelectedColor = pColorFill;

                IColor pOutlineColor = pFS.Outline.Color;
                Color  pColorOutline = ColorTranslator.FromOle(pOutlineColor.RGB);
                colorOutline.SelectedColor = pColorOutline;
            }
            else
            {
                SetFeatureClassStyle(esriSymbologyStyleClass.esriStyleClassBackgrounds);
            }
        }
Esempio n. 4
0
        // Methods
        public DataGraphicsElement()
        {
            this.m_pSelectionTracker             = new EnvelopeTracker();
            this.m_pSelectionTracker.Locked      = false;
            this.m_pSelectionTracker.ShowHandles = true;
            this.m_pGeometry = new Envelope() as IEnvelope;
            this.m_pGeometry.PutCoords(4.0, 4.0, 18.5, 16.4);
            this.m_pFillSymbol1 = new SimpleFillSymbol();
            (this.m_pFillSymbol1 as ISimpleFillSymbol).Style = esriSimpleFillStyle.esriSFSNull;
            this.m_chart.Header.Text = "实例";
            Series s = new Bar
            {
                Title = "实例1"
            };

            s.Add(new List <double> {
                30.0, 50.0, 60.0, 80.0
            });
            this.m_chart.Series.Add(s);
            s = new Bar
            {
                Title = "实例1"
            };
            s.Add(new List <double> {
                20.0, 50.0, 20.0, 60.0
            });
            this.m_chart.Series.Add(s);
        }
Esempio n. 5
0
        //设置选择集的符号
        private void setLyrSelSym(ILayer inLyr)
        {
            IFeatureLayer pFL = inLyr as IFeatureLayer;

            if (pFL == null)
            {
                return;
            }
            IFeatureSelection pFS = pFL as IFeatureSelection;

            pFS.SetSelectionSymbol = false;
            ISymbol     pSymbol  = pFS.SelectionSymbol;
            IFillSymbol pFillSym = pSymbol as IFillSymbol;

            if (pFillSym == null)
            {
                return;
            }
            IRgbColor pColor = new RgbColorClass();

            pColor.Red     = 255;
            pColor.Blue    = 0;
            pColor.Green   = 0;
            pFillSym.Color = pColor as IColor;
        }
Esempio n. 6
0
        public static IContainerSymbol FromXElement(XElement ele)
        {
            if (ele == null)
            {
                return(null);
            }
            string[]    sizeString = ele.Attribute("size").Value.Split(',');
            SizeF       size       = new SizeF(float.Parse(sizeString[0]), float.Parse(sizeString[1]));
            bool        isFixed    = bool.Parse(ele.Attribute("fixedsize").Value);
            ILineSymbol symline    = null;
            IFillSymbol symfill    = null;

            if (ele.Element("OutlineSymbol") != null)
            {
                symline = PersistObject.ReflectObjFromXElement(ele.Element("OutlineSymbol").Element("Symbol")) as ILineSymbol;
            }
            if (ele.Element("FillSymbol") != null)
            {
                symfill = PersistObject.ReflectObjFromXElement(ele.Element("FillSymbol").Element("Symbol")) as IFillSymbol;
            }
            RoundRectContainerSym sym = new RoundRectContainerSym(size, symline, symfill);

            sym.IsFixedSize = isFixed;
            return(sym);
        }
Esempio n. 7
0
        private void btnStyle_Click(object sender, EventArgs e)
        {
            frmSymbolSelector selector = new frmSymbolSelector();

            if ((this.rdoPointSymbol.Checked || this.rdoLineSymbol.Checked) || !this.rdoFillSymbol.Checked)
            {
            }
            selector.SetStyleGallery(this.istyleGallery_0);
            selector.SetSymbol(this.btnStyle.Style);
            if (selector.ShowDialog() == DialogResult.OK)
            {
                this.btnStyle.Style = selector.GetSymbol();
                if (this.rdoPointSymbol.Checked)
                {
                    this.imarkerSymbol_0 = this.btnStyle.Style as IMarkerSymbol;
                }
                else if (this.rdoLineSymbol.Checked)
                {
                    this.ilineSymbol_0 = this.btnStyle.Style as ILineSymbol;
                }
                else
                {
                    this.ifillSymbol_0 = this.btnStyle.Style as IFillSymbol;
                }
            }
        }
Esempio n. 8
0
        private IElement CreatePolygonElement(IPoint pt, IFillSymbol pFillSymbol)
        {
            IPolygon polygonClass = new Polygon() as IPolygon;
            object   missing      = Type.Missing;
            IPoint   pointClass   = new ESRI.ArcGIS.Geometry.Point();

            pointClass.PutCoords(pt.X, pt.Y);
            (polygonClass as IPointCollection).AddPoint(pointClass, ref missing, ref missing);
            pointClass = new ESRI.ArcGIS.Geometry.Point();
            pointClass.PutCoords(pt.X, pt.Y - this.m_itemheight);
            (polygonClass as IPointCollection).AddPoint(pointClass, ref missing, ref missing);
            pointClass = new ESRI.ArcGIS.Geometry.Point();
            pointClass.PutCoords(pt.X + this.m_itemwidth, pt.Y - this.m_itemheight);
            (polygonClass as IPointCollection).AddPoint(pointClass, ref missing, ref missing);
            pointClass = new ESRI.ArcGIS.Geometry.Point();
            pointClass.PutCoords(pt.X + this.m_itemwidth, pt.Y);
            (polygonClass as IPointCollection).AddPoint(pointClass, ref missing, ref missing);
            pointClass = new ESRI.ArcGIS.Geometry.Point();
            pointClass.PutCoords(pt.X, pt.Y);
            (polygonClass as IPointCollection).AddPoint(pointClass, ref missing, ref missing);
            IElement rectangleElementClass = new RectangleElement();

            rectangleElementClass.Geometry = polygonClass.Envelope;
            (rectangleElementClass as IFillShapeElement).Symbol = pFillSymbol;
            return(rectangleElementClass);
        }
Esempio n. 9
0
        //背景样式选择,调用FrmSy窗口
        private void btBackgroundStyle_Click(object sender, EventArgs e)
        {
            if (pStyleGalleryItem != null)
            {
                ISymbolBackground pSBackground = pStyleGalleryItem.Item as ISymbolBackground;
                IFillSymbol       pFS          = pSBackground.FillSymbol;
                FrmSymbol         Frm          = new FrmSymbol(SymbolStyle, (ISymbol)pFS, esriSymbologyStyleClass.esriStyleClassFillSymbols);
                Frm.ShowDialog();
                if (Frm.DialogResult == DialogResult.OK)
                {
                    pFillSymbol = Frm.GetStyleGalleryItem().Item as IFillSymbol;
                    this.SizeBackgroundOutline.Text = pFillSymbol.Outline.Width.ToString();

                    IColor pFillColor = pFillSymbol.Color;
                    Color  pColorFill = ColorTranslator.FromOle(pFillColor.RGB);
                    colorFill.SelectedColor = pColorFill;

                    IColor pOutlineColor = pFillSymbol.Outline.Color;
                    Color  pColorOutline = ColorTranslator.FromOle(pOutlineColor.RGB);
                    colorOutline.SelectedColor = pColorOutline;

                    SymbolBackground            = pStyleGalleryItem.Item as ISymbolBackground;
                    SymbolBackground.FillSymbol = pFillSymbol;

                    PreviewImage();
                }
            }
            else
            {
                MessageBox.Show("请选择一种样式!");
            }
        }
Esempio n. 10
0
        private void UpdateLayerColor()
        {
            IVectorHostLayer hostLayer = _activeViewer.Canvas.LayerContainer.VectorHost as IVectorHostLayer;

            if (hostLayer == null)
            {
                return;
            }
            IMap map = hostLayer.Map as IMap;

            CodeCell.AgileMap.Core.ILayer lyr = map.LayerContainer.GetLayerByName(_layerName);
            if (lyr != null)
            {
                CodeCell.AgileMap.Core.IFeatureLayer fetLayer = lyr as CodeCell.AgileMap.Core.IFeatureLayer;
                ISymbol symbol = fetLayer.Renderer.CurrentSymbol;
                if (symbol != null)
                {
                    IFillSymbol fillSymbol = symbol as IFillSymbol;
                    if (fillSymbol == null)
                    {
                        return;
                    }
                    fillSymbol.OutlineSymbol.Color = btnColor.BackColor;
                }
            }
        }
Esempio n. 11
0
        private IElement CreateLineElement(IPoint pt, ILineSymbol pSymbol, IFillSymbol pBackSymbol, string des)
        {
            IGroupElement groupElementClass = new GroupElement() as IGroupElement;
            IPolyline     polylineClass     = new Polyline() as IPolyline;
            object        missing           = Type.Missing;
            IPoint        pointClass        = new ESRI.ArcGIS.Geometry.Point();

            pointClass.PutCoords(pt.X + this.m_itemwidth / 10, pt.Y - this.m_itemheight / 2);
            (polylineClass as IPointCollection).AddPoint(pointClass, ref missing, ref missing);
            pointClass = new ESRI.ArcGIS.Geometry.Point();
            pointClass.PutCoords(pt.X + this.m_itemwidth * 0.9, pt.Y - this.m_itemheight / 2);
            (polylineClass as IPointCollection).AddPoint(pointClass, ref missing, ref missing);
            IElement lineElementClass = new LineElement()
            {
                Geometry = polylineClass
            };

            (lineElementClass as ILineElement).Symbol = pSymbol;
            if (pBackSymbol != null)
            {
                groupElementClass.AddElement(this.CreatePolygonElement(pt, pBackSymbol));
            }
            else if (this.m_ItemHasBorder)
            {
                groupElementClass.AddElement(this.CreatePolygonElement(pt));
            }
            groupElementClass.AddElement(lineElementClass);
            if (des.Length > 0)
            {
                groupElementClass.AddElement(this.CreateTextElement(pt, des, 10));
            }
            return(groupElementClass as IElement);
        }
Esempio n. 12
0
 private void method_1(IFillSymbol ifillSymbol_0)
 {
     if (ifillSymbol_0 != null)
     {
         this.colorEdit1.Enabled = true;
         this.txtWidth.Enabled   = true;
         this.method_2(this.colorEdit1, ifillSymbol_0.Color);
         ILineSymbol outline = ifillSymbol_0.Outline;
         if (outline != null)
         {
             this.colorEdit2.Enabled = true;
             this.txtWidth.Enabled   = true;
             this.method_2(this.colorEdit2, outline.Color);
             this.txtWidth.Value = (decimal)outline.Width;
         }
         else
         {
             this.colorEdit2.Enabled = false;
             this.txtWidth.Enabled   = false;
         }
     }
     else
     {
         this.colorEdit1.Enabled = false;
         this.colorEdit2.Enabled = false;
         this.txtWidth.Enabled   = false;
     }
 }
Esempio n. 13
0
 private void btnChangeSymbol_Click(object sender, EventArgs e)
 {
     try
     {
         IFillSymbol       pSym     = this.symbolItem1.Symbol as IFillSymbol;
         frmSymbolSelector selector = new frmSymbolSelector();
         if (selector != null)
         {
             selector.SetStyleGallery(ApplicationBase.StyleGallery);
             selector.SetSymbol(pSym);
             if (selector.ShowDialog() == DialogResult.OK)
             {
                 pSym = selector.GetSymbol() as IFillSymbol;
                 this.symbolItem1.Symbol = pSym;
                 this.bool_0             = false;
                 this.method_1(pSym);
                 this.bool_0 = true;
                 this.bool_1 = true;
                 this.method_6(e);
             }
         }
     }
     catch
     {
     }
 }
Esempio n. 14
0
        /// <summary>
        /// Save a feature layer of IPolygon to Ipe
        /// </summary>
        public static string TranCpgToIpe(CPolygon cpg, IFillSymbol pFillSymbol,
                                          IEnvelope pFLayerEnv, CEnvelope pIpeEnv, string strBoundWidth = "normal")
        {
            //get the color of the filled part
            //we are not allowed to directly use "var pFillRgbColor = pFillSymbol.Color as IRgbColor;"
            //Nor can we use "var pFillRgbColor = pFillSymbol.Color.RGB as IRgbColor;"
            //pFillSymbol.Color.RGB has type 'int'
            IColor pFillSymbolColor = new RgbColorClass();

            pFillSymbolColor.RGB = pFillSymbol.Color.RGB;
            CColor cColor            = new CUtility.CColor(pFillSymbolColor as IRgbColor);
            var    pSimpleFillSymbol = pFillSymbol as ISimpleFillSymbol;

            if (pSimpleFillSymbol != null)
            {
                if (pSimpleFillSymbol.Style == esriSimpleFillStyle.esriSFSHollow ||
                    pSimpleFillSymbol.Style == esriSimpleFillStyle.esriSFSNull)
                {
                    cColor = null;
                }
            }


            //get the color of the out line
            var pOutlineRgbColor = pFillSymbol.Outline.Color as IRgbColor;

            if (strBoundWidth == "")
            {
                strBoundWidth = pFillSymbol.Outline.Width.ToString();
            }

            //append the string
            return(CIpeDraw.DrawCpg(cpg, pFLayerEnv, pIpeEnv, new CColor(pOutlineRgbColor), cColor, strBoundWidth));
        }
Esempio n. 15
0
 private void method_0()
 {
     if (this.ifillShapeElement_0 != null)
     {
         IFillSymbol symbol = this.ifillShapeElement_0.Symbol;
         this.symbolItem1.Symbol = symbol;
         if (symbol != null)
         {
             this.colorEdit1.Enabled = true;
             this.txtWidth.Enabled   = true;
             this.method_2(this.colorEdit1, symbol.Color);
             ILineSymbol outline = symbol.Outline;
             if (outline != null)
             {
                 this.colorEdit2.Enabled = true;
                 this.txtWidth.Enabled   = true;
                 this.method_2(this.colorEdit2, outline.Color);
                 this.txtWidth.Value = (decimal)outline.Width;
             }
             else
             {
                 this.colorEdit2.Enabled = false;
                 this.txtWidth.Enabled   = false;
             }
         }
         else
         {
             this.colorEdit1.Enabled = false;
             this.colorEdit2.Enabled = false;
             this.txtWidth.Enabled   = false;
         }
     }
 }
Esempio n. 16
0
        private void styleButton1_Click(object sender, EventArgs e)
        {
            frmSymbolSelector selector = new frmSymbolSelector();

            if (selector != null)
            {
                selector.SetSymbol(this.styleButton1.Style);
                if (selector.ShowDialog() == DialogResult.OK)
                {
                    this.styleButton1.Style = selector.GetSymbol();
                    if (this.rdoLine.Checked)
                    {
                        this.ilineSymbol_0 = this.styleButton1.Style as ILineSymbol;
                    }
                    else
                    {
                        this.ifillSymbol_0 = this.styleButton1.Style as IFillSymbol;
                    }
                    this.bool_1 = true;
                    if (this.OnValueChange != null)
                    {
                        this.OnValueChange();
                    }
                }
            }
        }
Esempio n. 17
0
 private void MapTemplateGeneralPage_Load(object sender, EventArgs e)
 {
     this.styleButton1.Style = this.ilineSymbol_0;
     if (this.mapTemplate_0 != null)
     {
         this.txtWidth.Text          = this.mapTemplate_0.Width.ToString();
         this.txtHeight.Text         = this.mapTemplate_0.Height.ToString();
         this.txtScale.Text          = this.mapTemplate_0.Scale.ToString();
         this.txtStartX.Text         = this.mapTemplate_0.StartX.ToString();
         this.txtStartY.Text         = this.mapTemplate_0.StartY.ToString();
         this.txtXInterval.Text      = this.mapTemplate_0.XInterval.ToString();
         this.txtYInterval.Text      = this.mapTemplate_0.YInterval.ToString();
         this.txtName.Text           = this.mapTemplate_0.Name;
         this.textBox2.Text          = this.mapTemplate_0.InOutSpace.ToString();
         this.txtOutBorderWidth.Text = this.mapTemplate_0.OutBorderWidth.ToString();
         this.styleButton1.Style     = this.mapTemplate_0.BorderSymbol;
         if (this.mapTemplate_0.BorderSymbol is ILineSymbol)
         {
             this.rdoLine.Checked = true;
             this.ilineSymbol_0   = this.mapTemplate_0.BorderSymbol as ILineSymbol;
         }
         if (this.mapTemplate_0.BorderSymbol is IFillSymbol)
         {
             this.ifillSymbol_0   = this.mapTemplate_0.BorderSymbol as IFillSymbol;
             this.rdoFill.Checked = true;
         }
     }
     this.bool_0 = true;
 }
 private void StarndFenFuMapTemplatePage_Load(object sender, EventArgs e)
 {
     this.styleButton1.Style = this.ilineSymbol_0;
     if (this.mapTemplate_0 != null)
     {
         this.txtStartX.Text          = this.mapTemplate_0.StartX.ToString();
         this.txtStartY.Text          = this.mapTemplate_0.StartY.ToString();
         this.txtXInterval.Text       = this.mapTemplate_0.XInterval.ToString();
         this.txtYInterval.Text       = this.mapTemplate_0.YInterval.ToString();
         this.txtName.Text            = this.mapTemplate_0.Name;
         this.textBox2.Text           = this.mapTemplate_0.InOutSpace.ToString();
         this.txtOutBorderWidth.Text  = this.mapTemplate_0.OutBorderWidth.ToString();
         this.styleButton1.Style      = this.mapTemplate_0.BorderSymbol;
         this.cboDataum.SelectedIndex = (this.mapTemplate_0.SpheroidType == SpheroidType.Beijing54) ? 0 : 1;
         if (this.mapTemplate_0.StripType == StripType.STThreeDeg)
         {
             this.rdo3.Checked = true;
         }
         else
         {
             this.rdo6.Checked = true;
         }
         if (this.mapTemplate_0.BorderSymbol is ILineSymbol)
         {
             this.rdoLine.Checked = true;
             this.ilineSymbol_0   = this.mapTemplate_0.BorderSymbol as ILineSymbol;
         }
         if (this.mapTemplate_0.BorderSymbol is IFillSymbol)
         {
             this.rdoFill.Checked = true;
             this.ifillSymbol_0   = this.mapTemplate_0.BorderSymbol as IFillSymbol;
         }
     }
     this.bool_0 = true;
 }
		private IColor GetSymbolColor(ISymbol pSym)
		{
			IMarkerSymbol pMarkerSym = null;
			ILineSymbol pLineSym = null;
			IFillSymbol pFillSym = null;
			IColor pColor = null;

			if (pSym is IMarkerSymbol)
			{
				pMarkerSym = pSym as IMarkerSymbol;
				pColor = pMarkerSym.Color;
			}
			else if (pSym is ILineSymbol)
			{
				pLineSym = pSym as ILineSymbol;
				pColor = pLineSym.Color;
			}
			else
			{
				pFillSym = pSym as IFillSymbol;
				pColor = pFillSym.Color;
			}

			return pColor;

		}
Esempio n. 20
0
        protected void simpleRender(IFeatureLayer layer, IColor borderColor, double borderWidth)
        {
            ISimpleRenderer  simpleRender = null;
            IFillSymbol      fillSymbol   = null;
            ILineSymbol      lineSymbol   = null;
            IColor           fillColor    = null;
            IGeoFeatureLayer geoLayer     = null;

            if (layer != null && borderColor != null)
            {
                fillColor           = new RgbColorClass();
                fillColor.NullColor = true;

                fillSymbol       = new SimpleFillSymbolClass();
                lineSymbol       = new SimpleLineSymbolClass();
                fillSymbol.Color = fillColor;

                lineSymbol.Color   = borderColor;
                lineSymbol.Width   = borderWidth;
                fillSymbol.Outline = lineSymbol;

                geoLayer = layer as IGeoFeatureLayer;
                if (geoLayer != null)
                {
                    simpleRender        = new SimpleRendererClass();
                    simpleRender.Symbol = fillSymbol as ISymbol;
                    geoLayer.Renderer   = simpleRender as IFeatureRenderer;
                }
            }
        }
Esempio n. 21
0
 /// <summary>
 /// Handles the Click event of the btnChangeOutlineStyle control.
 /// </summary>
 /// <param name="obj">The source of the event.</param>
 /// <param name="eventArgs">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void btnChangeOutlineStyle_Click(object obj, EventArgs eventArgs)
 {
     if (this._styleGalleryItem != null)
     {
         this._fillSymble = (this._styleGalleryItem.Item as IFillSymbol);
         if (this._fillSymble != null)
         {
             ILineSymbol       lineSymbol      = this._fillSymble.Outline;
             frmSymbolSelector frmSymbolSelect = new frmSymbolSelector();
             IStyleGalleryItem item            = frmSymbolSelect.GetItem(esriSymbologyStyleClass.esriStyleClassLineSymbols, lineSymbol as ISymbol);
             if (item != null)
             {
                 lineSymbol = (item.Item as ILineSymbol);
                 if (lineSymbol.Color != null)
                 {
                     this.cmbFillLineColor.Color = ColorTranslator.FromOle(lineSymbol.Color.RGB);
                 }
                 else
                 {
                     this.cmbFillLineColor.Color = Color.Empty;
                 }
                 this.cmbFillWidth.Value  = Convert.ToDecimal(lineSymbol.Width);
                 this._fillSymble.Outline = lineSymbol;
                 this.ViewSymble();
             }
         }
     }
 }
 private void Init()
 {
     if (this.m_pSymbolBackground != null)
     {
         IFillSymbol fillSymbol = this.m_pSymbolBackground.FillSymbol;
         if (fillSymbol != null)
         {
             this.colorEdit1.Enabled = true;
             this.txtWidth.Enabled   = true;
             this.SetColorEdit(this.colorEdit1, fillSymbol.Color);
             ILineSymbol outline = fillSymbol.Outline;
             if (outline != null)
             {
                 this.colorEdit2.Enabled = true;
                 this.txtWidth.Enabled   = true;
                 this.SetColorEdit(this.colorEdit2, outline.Color);
                 this.txtWidth.Value = (decimal)outline.Width;
             }
             else
             {
                 this.colorEdit2.Enabled = false;
                 this.txtWidth.Enabled   = false;
             }
         }
         else
         {
             this.colorEdit1.Enabled = false;
             this.colorEdit2.Enabled = false;
             this.txtWidth.Enabled   = false;
         }
     }
 }
Esempio n. 23
0
        /// <summary>
        /// 初始化信息,创建IElement实体存放人机交互产生的图形,并设定其显示符号,关闭定时器
        /// </summary>
        public void MyInit()
        {
            //显示图形类型
            ISimpleFillSymbol ipSimpleFillSymbol = new SimpleFillSymbolClass();

            ipSimpleFillSymbol.Style = esriSimpleFillStyle.esriSFSNull;
            IRgbColor ipColor = new RgbColor();

            ipColor.Red              = 0;
            ipColor.Green            = 255;
            ipColor.Blue             = 0;
            ipSimpleFillSymbol.Color = ipColor;
            ILineSymbol ipLineSymple = new SimpleLineSymbolClass();

            ipLineSymple.Width         = 2;
            ipLineSymple.Color         = ipColor;
            ipSimpleFillSymbol.Outline = ipLineSymple;
            this.m_FillSymbol          = ipSimpleFillSymbol as IFillSymbol;

            //创建实体
            IFillShapeElement ipFillShapeElement = new PolygonElementClass();

            ipFillShapeElement.Symbol = this.m_FillSymbol;
            this.m_Element            = ipFillShapeElement as IElement;
            IGraphicsContainer ipGraphicContainer = this.m_hookHelper.ActiveView.GraphicsContainer;

            ipGraphicContainer.AddElement(this.m_Element, 0);
        }
Esempio n. 24
0
        //样式选择
        private void axSymbologyControl_OnItemSelected(object sender, ISymbologyControlEvents_OnItemSelectedEvent e)
        {
            //选择样式
            pStyleGalleryItem = (IStyleGalleryItem)e.styleGalleryItem;
            //将选择的样式与设计的样式大小、颜色等属性结合
            if (axSymbologyControl.StyleClass == esriSymbologyStyleClass.esriStyleClassMarkerSymbols)
            {
                IMarkerSymbol pMarkerSymbol = pStyleGalleryItem.Item as IMarkerSymbol;
                double        pMarkerSize   = pMarkerSymbol.Size;
                PointSize.Text = pMarkerSize.ToString();
                double pMarkerAngle = pMarkerSymbol.Angle;
                PointAngle.Text          = pMarkerAngle.ToString();
                colorPoint.SelectedColor = ClsGDBDataCommon.IColorToColor(pMarkerSymbol.Color);
            }
            else if (axSymbologyControl.StyleClass == esriSymbologyStyleClass.esriStyleClassLineSymbols)
            {
                ILineSymbol pLineSymbol = pStyleGalleryItem.Item as ILineSymbol;
                double      pLineWidth  = pLineSymbol.Width;
                LineSize.Text = pLineWidth.ToString();

                colorLine.SelectedColor = ClsGDBDataCommon.IColorToColor(pLineSymbol.Color);
            }
            else if (axSymbologyControl.StyleClass == esriSymbologyStyleClass.esriStyleClassFillSymbols)
            {
                IFillSymbol pFillSymbol = pStyleGalleryItem.Item as IFillSymbol;

                PolygonSize.Text           = pFillSymbol.Outline.Width.ToString();
                colorPolygon.SelectedColor = ClsGDBDataCommon.IColorToColor(pFillSymbol.Color);
                colorOutLine.SelectedColor = ClsGDBDataCommon.IColorToColor(pFillSymbol.Outline.Color);
            }
            PreviewImage();
        }
Esempio n. 25
0
        private IElement CreatePointElement(IPoint pt, IMarkerSymbol pSymbol, IFillSymbol pBackSymbol, string des)
        {
            IGroupElement groupElementClass = new GroupElement() as IGroupElement;
            IPoint        pointClass        = new ESRI.ArcGIS.Geometry.Point();

            pointClass.PutCoords(pt.X + this.m_itemwidth / 2, pt.Y - this.m_itemheight / 2);
            IElement markerElementClass = new MarkerElement()
            {
                Geometry = pointClass
            };

            (markerElementClass as IMarkerElement).Symbol = pSymbol;
            if (pBackSymbol != null)
            {
                groupElementClass.AddElement(this.CreatePolygonElement(pt, pBackSymbol));
            }
            else if (this.m_ItemHasBorder)
            {
                groupElementClass.AddElement(this.CreatePolygonElement(pt));
            }
            groupElementClass.AddElement(markerElementClass);
            if (des.Length > 0)
            {
                groupElementClass.AddElement(this.CreateTextElement(pt, des, 10));
            }
            return(groupElementClass as IElement);
        }
Esempio n. 26
0
        /// <summary>
        /// 符号大小改变时,符号预览随之变化
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void symbolSize_ValueChanged(object sender, EventArgs e)
        {
            ISymbol pSymbol = m_styleGalleryItem.Item as ISymbol;

            if (symbolSize.Value < 0 || symbolSize.Value > 100)
            {
                MessageBox.Show("请输入一个0和100之间的数字。");
            }
            double tempSize = Convert.ToDouble(symbolSize.Value);

            if (pSymbol is IMarkerSymbol)
            {
                IMarkerSymbol markerSymbol = pSymbol as IMarkerSymbol;
                markerSymbol.Size = tempSize;
            }
            else if (pSymbol is ILineSymbol)
            {
                ILineSymbol lineSymbol = pSymbol as ILineSymbol;
                lineSymbol.Width = tempSize;
            }
            else if (pSymbol is IFillSymbol)
            {
                IFillSymbol fillSymbol  = pSymbol as IFillSymbol;
                ILineSymbol pLineSymbol = fillSymbol.Outline;
                pLineSymbol.Width  = tempSize;
                fillSymbol.Outline = pLineSymbol;
            }
            else
            {
                return;
            }

            PreviewImage();
        }
Esempio n. 27
0
 public frmEdit(bool postil)
 {
     InitializeComponent();
     m_pTextSymbol = new TextSymbolClass();
     m_pFillSymbol = new SimpleFillSymbolClass();
     m_pLineSymbol = new SimpleLineSymbolClass();
     canFill       = postil;
 }
Esempio n. 28
0
        private void SetRenderer(CodeCell.AgileMap.Core.IFeatureLayer fetLayer)
        {
            IFeatureRenderer      render = fetLayer.Renderer;
            SimpleFeatureRenderer sr     = render as SimpleFeatureRenderer;
            IFillSymbol           sym    = sr.Symbol as IFillSymbol;

            sym.OutlineSymbol.Color = Color.Blue;
        }
Esempio n. 29
0
        /// <summary>
        /// 根据输入的要素在SceneControl中绘制元素     张琪   20110621
        /// </summary>
        /// <param name="pSceneControl"></param>
        /// <param name="pGeom">几何要素</param>
        /// <param name="pSym"></param>
        public void AddGraphic(ISceneControl pSceneControl, IGeometry pGeom, ISymbol pSym)
        {
            if (pGeom == null)
            {
                return;
            }
            IElement pElement = null;

            switch (pGeom.GeometryType.ToString())
            {
            case "esriGeometryPoint":    //点要素
                pElement = new MarkerElementClass();
                IMarkerElement pPointElement = pElement as IMarkerElement;
                if (pSym != null)
                {
                    IMarkerSymbol pMarker3DSymbol = pSym as IMarkerSymbol;
                    pPointElement.Symbol = pMarker3DSymbol as IMarkerSymbol;
                }
                break;

            case "esriGeometryPolyline":    //线要素
                pElement = new LineElementClass();
                ILineElement pLineElement = pElement as ILineElement;
                if (pSym != null)
                {
                    ILineSymbol pLineSymbol = pSym as ILineSymbol;
                    pLineElement.Symbol = pLineSymbol;
                }
                break;

            case "esriGeometryPolygon":    //面要素
                pElement = new PolygonElementClass();
                IFillShapeElement pFillElement = pElement as IFillShapeElement;
                if (pSym != null)
                {
                    IFillSymbol pFillSymbol = pSym as IFillSymbol;
                    pFillElement.Symbol = pFillSymbol;
                }
                break;

            case "esriGeometryMultiPatch":    //多面体要素
                pElement = new MultiPatchElementClass();
                IFillShapeElement pMultiPatchElement = pElement as IFillShapeElement;
                if (pSym != null)
                {
                    IFillSymbol pFillSymbol = pSym as IFillSymbol;
                    pMultiPatchElement.Symbol = pFillSymbol as IFillSymbol;
                }
                break;
            }
            pElement.Geometry = pGeom;
            IGraphicsContainer3D pGCon3D = pSceneControl.Scene.BasicGraphicsLayer as IGraphicsContainer3D;

            pGCon3D.AddElement(pElement);//在SceneControl中绘制要素
            IGraphicsSelection pGS = pGCon3D as IGraphicsSelection;

            pSceneControl.Scene.SceneGraph.RefreshViewers();
        }
Esempio n. 30
0
        private void btnSelectBackColor_Click(object sender, EventArgs e)
        {
            ISymbol symbol = GetSymbolByControl(esriGeometryType.esriGeometryPolygon);

            if (symbol != null)
            {
                fillSymbol = symbol as IFillSymbol;
            }
        }
Esempio n. 31
0
        /// <summary>
        /// ��ʼ����Ϣ������IElementʵ�����˻�����������ͼ�Σ����趨����ʾ���ţ��رն�ʱ��
        /// </summary>
        public void MyInit()
        {
            //��ʾͼ������
            ISimpleFillSymbol ipSimpleFillSymbol = new SimpleFillSymbolClass();
            ipSimpleFillSymbol.Style = esriSimpleFillStyle.esriSFSNull;
            IRgbColor ipColor = new RgbColor();
            ipColor.Red = 0;
            ipColor.Green = 255;
            ipColor.Blue = 0;
            ipSimpleFillSymbol.Color = ipColor;
            ILineSymbol ipLineSymple = new SimpleLineSymbolClass();
            ipLineSymple.Width = 2;
            ipLineSymple.Color = ipColor;
            ipSimpleFillSymbol.Outline = ipLineSymple;
            this.m_FillSymbol = ipSimpleFillSymbol as IFillSymbol;

            //����ʵ��
            IFillShapeElement ipFillShapeElement = new PolygonElementClass();
            ipFillShapeElement.Symbol = this.m_FillSymbol;
            this.m_Element = ipFillShapeElement as IElement;
            IGraphicsContainer ipGraphicContainer = this.m_hookHelper.ActiveView.GraphicsContainer;
            ipGraphicContainer.AddElement(this.m_Element, 0);
        }
        public void Activate(ESRI.ArcGIS.CatalogUI.IGxApplication Application, ESRI.ArcGIS.Catalog.IGxCatalog Catalog)
        {
            try
            {
                //Get selection
                m_pSelection = (GxSelection) Application.Selection;
                m_pSelection.OnSelectionChanged += new IGxSelectionEvents_OnSelectionChangedEventHandler(OnSelectionChanged);
                // get data from the MyProject's settings.
                // please change accordingly
                m_path = Properties.Settings.Default.DataLocation;
                //Add data to map control
                frmExtentView.AxMapControl1.AddShapeFile(m_path, "world30");
                frmExtentView.AxMapControl1.Extent = frmExtentView.AxMapControl1.FullExtent;

                //Create and setup the fill symbol that will be used to draw the dataset's extent
                // rectangle if it is not cached
                if (m_pFillSymbol == null)
                {
                    m_pFillSymbol = new SimpleFillSymbol();

                    IColor pColor = null;
                    ILineSymbol pLineSymbol = null;
                    pColor = new RgbColor();
                    pColor.NullColor = true;
                    m_pFillSymbol.Color = pColor;

                    pLineSymbol = new SimpleLineSymbol();
                    pColor.NullColor = false;
                    pColor.RGB = 200; //Red
                    pLineSymbol.Color = pColor;
                    pLineSymbol.Width = 2;
                    m_pFillSymbol.Outline = pLineSymbol;
                }

                //Draw extent
                Refresh();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.ToString());
            }
        }
Esempio n. 33
0
        private void ResetFillSymbol()
        {
            #region FillSymbol

            m_pFillSymbol = new SimpleFillSymbol();

            IRgbColor rgb = new RgbColorClass();
            rgb.NullColor = true;
            rgb.Transparency = 0;

            IRgbColor lineColor = new RgbColorClass();
            lineColor.Red = 192;
            lineColor.Green = 50;
            lineColor.Blue = 50;
            lineColor.Transparency = 100;

            ISimpleLineSymbol line = new SimpleLineSymbolClass();
            line.Style = esriSimpleLineStyle.esriSLSSolid;
            line.Width = 1.5F;
            line.Color = lineColor;

            m_pFillSymbol.Color = rgb;
            m_pFillSymbol.Outline = line;

            IFillShapeElement fillSymbol = m_AOI as IFillShapeElement;
            fillSymbol.Symbol = m_pFillSymbol;

            #endregion

            #region SelectedSymbol

            m_pSelectedSymbol = new SimpleFillSymbol();

            IRgbColor rgb2 = new RgbColorClass();
            rgb2.Red = 215;
            rgb2.Green = 215;
            rgb2.Blue = 100;
            rgb2.Transparency = 10;
            rgb2.UseWindowsDithering = true;

            IRgbColor lineColor2 = new RgbColorClass();
            lineColor2.Red = 192;
            lineColor2.Green = 50;
            lineColor2.Blue = 50;
            lineColor2.Transparency = 100;

            ISimpleLineSymbol line2 = new SimpleLineSymbolClass();
            line2.Style = esriSimpleLineStyle.esriSLSSolid;
            line2.Width = 1.5F;
            line2.Color = lineColor2;

            m_pSelectedSymbol.Color = rgb2;
            m_pSelectedSymbol.Outline = line2;

            #endregion
        }
Esempio n. 34
0
 private void btnSelectBackColor_Click(object sender, EventArgs e)
 {
     ISymbol symbol = GetSymbolByControl(esriGeometryType.esriGeometryPolygon);
     if (symbol != null)
         fillSymbol = symbol as IFillSymbol;
 }