Esempio n. 1
0
 public static ISimpleFillSymbol get_SimplePolygonSymbol(IColor color, esriSimpleFillStyle style, ILineSymbol outline)
 {
     ISimpleFillSymbol theReturn = new SimpleFillSymbolClass();
     theReturn.Color = color;
     theReturn.Style = style;
     theReturn.Outline = outline;
     return theReturn;
 }
Esempio n. 2
0
        private void btnAddLayer_Click(object sender, EventArgs e)
        {
            ILineSymbol lineSymbol = this.CreateNewSymbol(this.cboLineType.SelectedIndex);

            this.m_pMultiLineSymbol.AddLayer(lineSymbol);
            this.m_OldSelItem = 0;
            this.m_pMultiLineSymbol.MoveLayer(lineSymbol, 0);
            ((ILayerColorLock)this.m_pMultiLineSymbol).LayerColorLock[0] = false;
            this.InitControl((ISymbol)this.m_pMultiLineSymbol);
            this.symbolListBox1.Invalidate();
            this.symbolItem1.Invalidate();
        }
 private void colorEdit1_EditValueChanged(object sender, EventArgs e)
 {
     if (this.bool_0)
     {
         ILineSymbol symbol = this.symbolItem1.Symbol as ILineSymbol;
         IColor      color  = symbol.Color;
         this.method_4(this.colorEdit1, color);
         symbol.Color = color;
         this.bool_1  = true;
         this.method_5(e);
     }
 }
Esempio n. 4
0
        //边框颜色
        private void colorBorder_SelectedColorChanged(object sender, EventArgs e)
        {
            if (pStyleGalleryItem != null)
            {
                SymbolBorder = (ISymbolBorder)pStyleGalleryItem.Item;
                ILineSymbol pLS = SymbolBorder.LineSymbol;

                pLS.Color = ClsGDBDataCommon.ColorToIColor(colorBorder.SelectedColor);
                SymbolBorder.LineSymbol = pLS;
                PreviewImage();
            }
        }
        private void EditProperties_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            //Update precision property
            if (txtPrecision.Text != "")
            {
                m_engineEditProperties.ReportPrecision = Convert.ToInt32(txtPrecision.Text);
            }

            //Update stream grouping count
            if (txtStreamCount.Text != "")
            {
                m_engineEditProperties.StreamGroupingCount = Convert.ToInt32(txtStreamCount.Text);
            }

            //Update stream tolerance
            if (txtTolerance.Text != "")
            {
                m_engineEditProperties.StreamTolerance = Convert.ToInt32(txtTolerance.Text);
            }

            //Update stretch geometry property
            if (chkStretch.Checked)
            {
                m_engineEditProperties.StretchGeometry = true;
            }
            else
            {
                m_engineEditProperties.StretchGeometry = false;
            }

            //Update sketch symbol property
            if (bSketchColor || txtSketchWidth.Text != "")
            {
                ILineSymbol lineSymbol = m_engineEditProperties.SketchSymbol;

                if (bSketchColor)
                {
                    IRgbColor color = new RgbColorClass();
                    color.Red        = R;
                    color.Blue       = B;
                    color.Green      = G;
                    lineSymbol.Color = color;
                }

                if (txtSketchWidth.Text != "")
                {
                    lineSymbol.Width = Convert.ToInt32(txtSketchWidth.Text);
                }

                m_engineEditProperties.SketchSymbol = lineSymbol;
            }
        }
Esempio n. 6
0
 private void colorEdit1_EditValueChanged(object sender, EventArgs e)
 {
     if (this.m_CanDo)
     {
         ILineSymbol lineSymbol = this.m_pSymbolBorder.LineSymbol;
         IColor      pColor     = lineSymbol.Color;
         this.UpdateColorFromColorEdit(this.colorEdit1, pColor);
         lineSymbol.Color = pColor;
         this.m_pSymbolBorder.LineSymbol = lineSymbol;
         this.m_IsPageDirty = true;
         this.refresh(e);
     }
 }
Esempio n. 7
0
 public static void ChangeSymbolSize(ISymbol pSymbol, double size)
 {
     if (pSymbol is IMarkerSymbol)
     {
         IMarkerSymbol pMarkerSymbol = pSymbol as IMarkerSymbol;
         pMarkerSymbol.Size = size;
     }
     else if (pSymbol is ILineSymbol)
     {
         ILineSymbol pLineSymbol = pSymbol as ILineSymbol;
         pLineSymbol.Width = size;
     }
 }
Esempio n. 8
0
 private void btnPaste_Click(object sender, EventArgs e)
 {
     if (this.m_CopySymbol != null)
     {
         ILineSymbol lineSymbol = (ILineSymbol)((IClone)this.m_CopySymbol).Clone();
         this.m_pMultiLineSymbol.AddLayer(lineSymbol);
         this.m_OldSelItem = 0;
         this.m_pMultiLineSymbol.MoveLayer(lineSymbol, 0);
         this.InitControl((ISymbol)this.m_pMultiLineSymbol);
         this.symbolListBox1.Invalidate();
         this.symbolItem1.Invalidate();
     }
 }
Esempio n. 9
0
        private void LineSize_ValueChanged(object sender, EventArgs e)
        {
            if (pStyleGalleryItem == null)
            {
                MessageBox.Show("请选择线样式", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            ILineSymbol pLineSymbol = pStyleGalleryItem.Item as ILineSymbol;

            LineSize.Text     = Math.Truncate(double.Parse(LineSize.Text)).ToString();
            pLineSymbol.Width = Math.Truncate(double.Parse(LineSize.Text));
            PreviewImage();
        }
Esempio n. 10
0
        private void LineSize_ValueChanged(object sender, EventArgs e)
        {
            if (pStyleGalleryItem == null)
            {
                MessageBox.Show("请选择线样式", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            ILineSymbol pLineSymbol = pStyleGalleryItem.Item as ILineSymbol;

            LineSize.Value    = LineSize.Value;
            pLineSymbol.Width = LineSize.Value;
            PreviewImage();
        }
Esempio n. 11
0
        /// <summary>
        /// 创建面要素样式
        /// </summary>
        /// <param name="fillColor">填充颜色</param>
        /// <param name="fillStyle">填充样式</param>
        /// <param name="lineSymbol">线样式</param>
        /// <returns>ISymbol</returns>
        public static ISymbol CreateSimpleFillSymbol(Color fillColor, ILineSymbol lineSymbol, esriSimpleFillStyle fillStyle = esriSimpleFillStyle.esriSFSBackwardDiagonal)
        {
            ISimpleFillSymbol pSimpleFillSymbol;

            pSimpleFillSymbol       = new SimpleFillSymbol();
            pSimpleFillSymbol.Style = fillStyle;
            pSimpleFillSymbol.Color = new RgbColor()
            {
                Red = fillColor.R, Green = fillColor.G, Blue = fillColor.B, Transparency = fillColor.A
            };
            pSimpleFillSymbol.Outline = lineSymbol;
            return((ISymbol)pSimpleFillSymbol);
        }
Esempio n. 12
0
 private void colorEditOutline_EditValueChanged(object sender, EventArgs e)
 {
     if (this.m_CanDo)
     {
         ILineSymbol outline = this.m_SimpleFillSymbol.Outline;
         IColor      pColor  = outline.Color;
         this.UpdateColorFromColorEdit(this.colorEditOutline, pColor);
         outline.Color = pColor;
         this.m_SimpleFillSymbol.Outline = outline;
         this.btnOutline.Style           = outline;
         this.btnOutline.Invalidate();
         this.refresh(e);
     }
 }
Esempio n. 13
0
        //边线颜色设置
        private void colorOutline_SelectedColorChanged(object sender, EventArgs e)
        {
            if (pStyleGalleryItem != null)
            {
                SymbolBackground = pStyleGalleryItem.Item as ISymbolBackground;
                IFillSymbol pFS = SymbolBackground.FillSymbol as IFillSymbol;
                ILineSymbol pLS = pFS.Outline as ILineSymbol;

                pLS.Color   = ClsGDBDataCommon.ColorToIColor(colorOutline.SelectedColor);
                pFS.Outline = pLS;
                SymbolBackground.FillSymbol = pFS;
                PreviewImage();
            }
        }
Esempio n. 14
0
        private ILineSymbol CreateNewSymbol(int type)
        {
            ILineSymbol simpleLineSymbolClass = null;

            switch (type)
            {
            case 0:
            {
                simpleLineSymbolClass = new SimpleLineSymbolClass();
                break;
            }

            case 1:
            {
                simpleLineSymbolClass = new CartographicLineSymbolClass();
                break;
            }

            case 2:
            {
                simpleLineSymbolClass = new MarkerLineSymbolClass();
                break;
            }

            case 3:
            {
                simpleLineSymbolClass = new HashLineSymbolClass();
                break;
            }

            case 4:
            {
                simpleLineSymbolClass = new PictureLineSymbolClass();
                break;
            }

            case 5:
            {
                simpleLineSymbolClass = new SimpleLine3DSymbolClass();
                break;
            }

            case 6:
            {
                simpleLineSymbolClass = new TextureLineSymbolClass();
                break;
            }
            }
            return(simpleLineSymbolClass);
        }
Esempio n. 15
0
 private void tnMoveDown_Click(object sender, EventArgs e)
 {
     if (this.symbolListBox1.SelectedIndex != this.symbolListBox1.Items.Count - 1)
     {
         this.m_OldSelItem = this.symbolListBox1.SelectedIndex + 1;
         ILineSymbol layer = this.m_pMultiLineSymbol.Layer[this.symbolListBox1.SelectedIndex];
         this.m_pMultiLineSymbol.MoveLayer(layer, this.m_OldSelItem);
         this.m_CanDo = false;
         this.InitControl((ISymbol)this.m_pMultiLineSymbol);
         this.m_CanDo = true;
         this.symbolListBox1.Invalidate();
         this.symbolItem1.Invalidate();
     }
 }
Esempio n. 16
0
        private void PolygonSize_ValueChanged(object sender, EventArgs e)
        {
            if (pStyleGalleryItem == null)
            {
                MessageBox.Show("请选择面样式", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            IFillSymbol pFillSymbol = pStyleGalleryItem.Item as IFillSymbol;
            ILineSymbol pLineSymbol = pFillSymbol.Outline;

            pLineSymbol.Width   = PolygonSize.Value;
            pFillSymbol.Outline = pLineSymbol;
            PreviewImage();
        }
Esempio n. 17
0
        public void Release()
        {
            if (_lineSymbol != null)
            {
                _lineSymbol.Release();
            }
            if (_textSymbol != null)
            {
                _textSymbol.Release();
            }

            _lineSymbol = null;
            _textSymbol = null;
        }
Esempio n. 18
0
        private void method_4(ILineSymbol ilineSymbol_0, Rectangle rectangle_0)
        {
            if (ilineSymbol_0 is IPictureLineSymbol)
            {
                if (((IPictureLineSymbol)ilineSymbol_0).Picture == null)
                {
                    return;
                }
            }
            else if (ilineSymbol_0 is IMarkerLineSymbol || ilineSymbol_0 is IHashLineSymbol)
            {
                ITemplate template = ((ILineProperties)ilineSymbol_0).Template;
                if (template != null)
                {
                    bool flag = false;
                    int  i    = 0;
                    while (i < template.PatternElementCount)
                    {
                        double num;
                        double num2;
                        template.GetPatternElement(i, out num, out num2);
                        if (num + num2 <= 0.0)
                        {
                            i++;
                        }
                        else
                        {
                            flag = true;

                            if (flag)
                            {
                                break;
                            }
                            return;
                        }
                    }
                }
            }

            object           value           = System.Reflection.Missing.Value;
            IPointCollection pointCollection = new Polyline();
            IPoint           point           = new ESRI.ArcGIS.Geometry.Point();

            point.PutCoords((double)(rectangle_0.Left + 3), (double)((rectangle_0.Bottom + rectangle_0.Top) / 2));
            pointCollection.AddPoint(point, ref value, ref value);
            point.PutCoords((double)(rectangle_0.Right - 3), (double)((rectangle_0.Bottom + rectangle_0.Top) / 2));
            pointCollection.AddPoint(point, ref value, ref value);
            ((ISymbol)ilineSymbol_0).Draw((IGeometry)pointCollection);
        }
Esempio n. 19
0
        public override void OnCreate(object hook)
        {
            _context = hook as IAppContext;
            IRgbColor rgbColorClass = new RgbColor()
            {
                Red   = 255,
                Green = 0,
                Blue  = 0
            };
            IRgbColor rgbColor = rgbColorClass;

            this.imarkerSymbol_0 = new SimpleMarkerSymbol();
            ((ISimpleMarkerSymbol)this.imarkerSymbol_0).Style = esriSimpleMarkerStyle.esriSMSCircle;
            this.imarkerSymbol_0.Color = rgbColor;
            this.imarkerSymbol_0.Size  = 3;
            IRgbColor rgbColorClass1 = new RgbColor()
            {
                Red   = 255,
                Green = 0,
                Blue  = 0
            };
            IRgbColor rgbColor1 = rgbColorClass1;

            this.ilineSymbol_0 = new SimpleLineSymbol()
            {
                Color = rgbColor1,
                Width = 1.5
            };
            this.bool_1     = false;
            this.m_message  = "编辑拓扑元素";
            this.m_caption  = "拓扑编辑工具";
            this.m_toolTip  = "拓扑编辑工具";
            this.m_name     = "Editor_Topology_EditTopologyElement";
            this._key       = "Editor_Topology_EditTopologyElement";
            _itemType       = RibbonItemType.Tool;
            this.m_category = "拓扑";
            this.m_bitmap   = Properties.Resources.TopologyEdit;
            this.m_cursor   = new System.Windows.Forms.Cursor(GetType().Assembly.GetManifestResourceStream("Yutai.Plugins.Editor.Resources.Cursor.TopologyEdit.cur"));

            if (this._context.FocusMap != null)
            {
                if (this._context.Hook is IApplicationEvents)
                {
                    (this._context.Hook as IApplicationEvents).OnActiveHookChanged += new OnActiveHookChangedHandler(this.method_0);
                }
                this.map_0            = (Map)this._context.FocusMap;
                this.map_0.AfterDraw += new IActiveViewEvents_AfterDrawEventHandler(this.method_3);
            }
        }
Esempio n. 20
0
        public object PropertyPanel(ISymbol symbol)
        {
            if (symbol is SymbolDotedLineSymbol)
            {
                _symbol = (ILineSymbol)symbol;
            }

            if (_symbol == null)
            {
                return(null);
            }
            propertyGrid.SelectedObject = new CustomClass(_symbol);

            return(panelFillSymbol);
        }
Esempio n. 21
0
        private void colorOutLine_SelectedColorChanged(object sender, EventArgs e)
        {
            if (pStyleGalleryItem == null)
            {
                MessageBox.Show("请选择面样式", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            IFillSymbol pFillSymbol = pStyleGalleryItem.Item as IFillSymbol;
            ILineSymbol pLineSymbol = pFillSymbol.Outline;

            pLineSymbol.Color   = ClsGDBDataCommon.ColorToIColor(colorOutLine.SelectedColor);
            pFillSymbol.Outline = pLineSymbol;
            PreviewImage();
        }
Esempio n. 22
0
        private void CreateFeed()
        {
            this._lineFeedback         = new NewLineFeedbackClass();
            this._lineFeedback.Display = this._hookHelper.ActiveView.ScreenDisplay;
            IRgbColor color = new RgbColorClass {
                Blue  = 0xff,
                Green = 0,
                Red   = 0xc5
            };
            IColor      color2 = color;
            ILineSymbol symbol = this._lineFeedback.Symbol as ILineSymbol;

            symbol.Color = color2;
            symbol.Width = 2.0;
        }
Esempio n. 23
0
 public static void DrawPolygonXOR(IDisplay idisplay_0, IPolygon ipolygon_0, bool bool_0)
 {
     try
     {
         IFillSymbol simpleFillSymbolClass = new SimpleFillSymbol();
         ISymbol     symbol = simpleFillSymbolClass as ISymbol;
         symbol.ROP2 = esriRasterOpCode.esriROPXOrPen;
         IRgbColor rgbColorClass = new RgbColor()
         {
             UseWindowsDithering = false,
             Red   = 45,
             Green = 45,
             Blue  = 45
         };
         simpleFillSymbolClass.Color = rgbColorClass;
         ILineSymbol outline = simpleFillSymbolClass.Outline;
         (outline as ISymbol).ROP2         = esriRasterOpCode.esriROPXOrPen;
         rgbColorClass.UseWindowsDithering = false;
         rgbColorClass.Red             = 145;
         rgbColorClass.Green           = 145;
         rgbColorClass.Blue            = 145;
         outline.Color                 = rgbColorClass;
         outline.Width                 = 0.1;
         simpleFillSymbolClass.Outline = outline;
         idisplay_0.StartDrawing(0, -1);
         idisplay_0.SetSymbol(symbol);
         if (ipolygon_0 == null)
         {
             if (SymbolDraw.m_pGeometry != null)
             {
                 idisplay_0.DrawPolygon(SymbolDraw.m_pGeometry as IPolygon);
             }
             if (!bool_0)
             {
                 SymbolDraw.m_pGeometry = null;
             }
         }
         else
         {
             idisplay_0.DrawPolygon(ipolygon_0);
             SymbolDraw.m_pGeometry = ipolygon_0;
         }
         idisplay_0.FinishDrawing();
     }
     catch
     {
     }
 }
        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 = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                m_path = System.IO.Path.Combine(m_path, @"ArcGIS\data\world");
                if (!Directory.Exists(m_path))
                {
                    throw new Exception(string.Format("Fix code to point to your sample data: {0} was not found", m_path));
                }

                //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. 25
0
        public void Load(IO.IPersistStream stream)
        {
            _type               = (chartType)stream.Load("Type", (int)chartType.Pie);
            _sizeType           = (sizeType)stream.Load("SizeType", (int)sizeType.ConstantSize);
            _labelPriority      = (SimpleLabelRenderer.labelPriority)stream.Load("labelPriority", (int)SimpleLabelRenderer.labelPriority.normal);
            _size               = (double)stream.Load("Size", 50D);
            _valueEquatesToSize = (double)stream.Load("ValueEquatesToSize", 100D);

            ValueMapRendererSymbol sym;

            while ((sym = (ValueMapRendererSymbol)stream.Load("ChartSymbol", null, new ValueMapRendererSymbol())) != null)
            {
                this.SetSymbol(sym._key, sym._symbol);
            }
            _outlineSymbol = stream.Load("Outline", null) as ILineSymbol;
        }
Esempio n. 26
0
 public void Apply()
 {
     if (this.bool_1)
     {
         this.bool_1        = false;
         this.itextSymbol_0 = this.btnNumeratorTextSymbol.Style as ITextSymbol;
         this.ilineSymbol_0 = this.btnLineSymbol.Style as ILineSymbol;
         this.itextSymbol_1 = this.btnDenominatorTextSymbol.Style as ITextSymbol;
         this.m_FractionTextSymbol.NumeratorTextSymbol   = (this.itextSymbol_0 as IClone).Clone() as ITextSymbol;
         this.m_FractionTextSymbol.DenominatorTextSymbol = (this.itextSymbol_1 as IClone).Clone() as ITextSymbol;
         this.m_FractionTextSymbol.LineSymbol            = (this.ilineSymbol_0 as IClone).Clone() as ILineSymbol;
         this.m_FractionTextSymbol.NumeratorText         = this.txtNumeratorText.Text;
         this.m_FractionTextSymbol.DenominatorText       = this.txtDenominatorText.Text;
         this.method_1(this.iactiveView_0);
     }
 }
Esempio n. 27
0
        private void nudWidth_ValueChanged(object sender, EventArgs e)
        {
            switch (this.axSymbologyControl.StyleClass)
            {
            case esriSymbologyStyleClass.esriStyleClassLineSymbols:
                ((ILineSymbol)this.pStyleGalleryItem.Item).Width = Convert.ToDouble(this.nudWidth.Value);
                break;

            case esriSymbologyStyleClass.esriStyleClassFillSymbols:
                ILineSymbol pLineSymbol = ((IFillSymbol)this.pStyleGalleryItem.Item).Outline;
                pLineSymbol.Width = Convert.ToDouble(this.nudWidth.Value);
                ((IFillSymbol)this.pStyleGalleryItem.Item).Outline = pLineSymbol;
                break;
            }
            this.PreviewImage();
        }
Esempio n. 28
0
 private void rdoFill_CheckedChanged(object sender, EventArgs e)
 {
     if (this.bool_0 && this.rdoFill.Checked)
     {
         if (this.styleButton1.Style is ILineSymbol)
         {
             this.ilineSymbol_0 = this.styleButton1.Style as ILineSymbol;
         }
         this.styleButton1.Style = this.ifillSymbol_0;
         this.bool_1             = true;
         if (this.OnValueChange != null)
         {
             this.OnValueChange();
         }
     }
 }
Esempio n. 29
0
        private IMarkerFillSymbol CreatMarkerFillSymbol(IMarkerSymbol pMarkerSymbol, ILineSymbol pLineSymbol, IColor pColor, double xoffset, double yoffset, double xsept, double ysept)
        {
            IMarkerFillSymbol pMFillSymbol = new MarkerFillSymbolClass();
            IFillProperties   pFillProp    = new MarkerFillSymbolClass();

            pFillProp.XOffset         = xoffset;
            pFillProp.YOffset         = yoffset;
            pFillProp.XSeparation     = xsept;
            pFillProp.YSeparation     = ysept;
            pMFillSymbol              = pFillProp as IMarkerFillSymbol;
            pMFillSymbol.MarkerSymbol = pMarkerSymbol;
            pMFillSymbol.Outline      = pLineSymbol;
            pMFillSymbol.Color        = pColor;
            pMFillSymbol.Style        = esriMarkerFillStyle.esriMFSGrid;
            return(pMFillSymbol);
        }
 private void btnOutlineColor_Click(object sender, EventArgs e)
 {
     if (this.colorDialog.ShowDialog() == DialogResult.OK)
     {
         //取得面符号中的外框线符号
         ILineSymbol pLineSymbol = ((IFillSymbol)this.pStyleGalleryItem.Item).Outline;
         //设置外框线颜色
         pLineSymbol.Color = this.ConvertColorToIColor(this.colorDialog.Color);
         //重新设置面符号中的外框线符号
         ((IFillSymbol)this.pStyleGalleryItem.Item).Outline = pLineSymbol;
         //设置按钮背景颜色
         this.btnOutlineColor.BackColor = this.colorDialog.Color;
         //更新符号预览
         this.PreviewImage();
     }
 }
Esempio n. 31
0
        //边线大小设置
        private void SizeBackgroundOutline_ValueChanged(object sender, EventArgs e)
        {
            if (pStyleGalleryItem != null)
            {
                SymbolBackground = pStyleGalleryItem.Item as ISymbolBackground;
                IFillSymbol pFS = SymbolBackground.FillSymbol;
                ILineSymbol pLS = pFS.Outline;

                pLS.Width = double.Parse(this.SizeBackgroundOutline.Text);

                pFS.Outline = pLS;
                SymbolBackground.FillSymbol = pFS;

                PreviewImage();
            }
        }
Esempio n. 32
0
 /// <summary>
 /// ��ʼ����Ϣ������IElementʵ�����˻�����������ͼ�Σ����趨����ʾ����
 /// </summary>
 public void MyInit()
 {
     //����ʾ����
     this.m_LineSymbol = new SimpleLineSymbolClass();
     IRgbColor ipColor = new RgbColor();
     ipColor.Red = 0;
     ipColor.Green = 255;
     ipColor.Blue = 0;
     this.m_LineSymbol.Color = ipColor;
     this.m_LineSymbol.Width = 2;
     //����ʵ��
     IActiveView ipAV = this.m_hookHelper.ActiveView;
     IGraphicsContainer ipGraphicContainer = ipAV.FocusMap as IGraphicsContainer;
     ILineElement ipLineElement = new LineElementClass();
     ipLineElement.Symbol = this.m_LineSymbol;
     IElement ipElement = ipLineElement as IElement;
     ipElement.Geometry = new PolylineClass();
     this.m_Element = ipElement;
     ipGraphicContainer.AddElement(ipElement, 0);
 }
Esempio n. 33
0
 /// <summary>
 /// 简单点
 /// </summary>
 /// <param name="size"></param>
 /// <param name="color"></param>
 /// <param name="style"></param>
 /// <param name="outLineSymbol"></param>
 /// <returns></returns>
 private IMarkerSymbol DefinePointSymbol(double size, IColor color, esriSimpleMarkerStyle style, ILineSymbol outLineSymbol)
 {
     ISimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbolClass();
     IMarkerSymbol markerSymbol = (IMarkerSymbol)simpleMarkerSymbol;
     simpleMarkerSymbol.Size = size;                                      //定义点符号大小
     simpleMarkerSymbol.Color = color;                                    //定义点符号颜色
     simpleMarkerSymbol.Style = style;                                    //定义点符号样式
     if (outLineSymbol == null)
     {
         simpleMarkerSymbol.Outline = false;
     }
     else
     {
         simpleMarkerSymbol.Outline = true;                                  //定义点符号边线
         simpleMarkerSymbol.OutlineColor = outLineSymbol.Color;
         simpleMarkerSymbol.OutlineSize = outLineSymbol.Width;
     }
     return markerSymbol;
 }
Esempio n. 34
0
        /// <summary>
        /// 简单面
        /// </summary>
        /// <param name="color"></param>
        /// <param name="style"></param>
        /// <param name="outLineSymbol"></param>
        /// <returns></returns>
        private IFillSymbol DefineFillSymbol(IColor color, esriSimpleFillStyle style, ILineSymbol outLineSymbol)
        {
            ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbolClass();
            simpleFillSymbol.Color = color;                                        //定义面符号颜色
            simpleFillSymbol.Style = style;                                        //定义面符号样式
            simpleFillSymbol.Outline = outLineSymbol;                              //定义面符号边线
            IFillSymbol fillSymbol = (IFillSymbol)simpleFillSymbol;

            return fillSymbol;
        }
Esempio n. 35
0
        public MainForm()
        {
            InitializeComponent();
            MapControl = RendererHelper.GetMapControl();
            MXDPath = ConfigurationManager.AppSettings["MXD"];
            RoadName = ConfigurationManager.AppSettings["ROAD"];
            RoadHistoryName = ConfigurationManager.AppSettings["ROADHISTORY"];
            RoadNodeName = ConfigurationManager.AppSettings["ROADNODE"];
            BusLineName = ConfigurationManager.AppSettings["BUSLINE"];
            BusStopName = ConfigurationManager.AppSettings["BUSSTOP"];
            ParkingName = ConfigurationManager.AppSettings["PARKING"];
            BikeName = ConfigurationManager.AppSettings["BIKE"];
            FlowName = ConfigurationManager.AppSettings["FLOW"];
            StartEndName = ConfigurationManager.AppSettings["BUSSTOPNAME"];
            XZQName = ConfigurationManager.AppSettings["XZQ"];
            MapType = ConfigurationManager.AppSettings["MAPTYPE"];

            simpleLineSymbol = new SimpleLineSymbolClass();
            simpleLineSymbol.Width = 4;
            simpleLineSymbol.Color = DisplayHelper.GetRGBColor(255, 0, 99);
            simpleMarkerSymbol = new SimpleMarkerSymbolClass();
            simpleMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle;
            simpleMarkerSymbol.Size = 8;
            simpleMarkerSymbol.Color = DisplayHelper.GetRGBColor(255, 0, 0);

            m_CrossroadSymbol = new SimpleMarkerSymbolClass()
            {
                Style = esriSimpleMarkerStyle.esriSMSCircle,
                Size = 8,
                Color = DisplayHelper.GetRGBColor(255, 0, 0, 0),
                OutlineColor = DisplayHelper.GetRGBColor(255, 0, 0),
                OutlineSize = 3,
                Outline = true
            };

            m_ImportRoadSymbol = new SimpleLineSymbolClass()
            {
                Style = esriSimpleLineStyle.esriSLSSolid,
                Width = 3,
                Color = DisplayHelper.GetRGBColor(0, 0, 0, 200)
            };
            axMapControl1.OnAfterDraw += this.axMapControl1_OnAfterDraw;
        }
        public static void SpecialLineRenderer(ILayer layer, int id, ILineSymbol lineSymbol)
        {
            var geoFeaLayer = layer as IGeoFeatureLayer;
            IUniqueValueRenderer uniValueRender = new UniqueValueRenderer();

            uniValueRender.FieldCount = 1;
            uniValueRender.Field[0] = "OBJECTID";
            var customSymbol = (ISymbol)lineSymbol;

            //选择某个字段作为渲染符号值
            if (geoFeaLayer != null)
            {
                var featureCursor = geoFeaLayer.FeatureClass.Search(null, true);
                var feature = featureCursor.NextFeature();
                while (feature != null)
                {
                    var nowId = feature.OID;

                    if (nowId == id)
                    {
                        uniValueRender.AddValue(feature.OID.ToString(), "", customSymbol);
                    }
                    else
                    {
                        var defaultSymbol = geoFeaLayer.Renderer.SymbolByFeature[feature];
                        uniValueRender.AddValue(feature.OID.ToString(), "", defaultSymbol);
                    }

                    feature = featureCursor.NextFeature();
                }
            }

            if (geoFeaLayer != null) geoFeaLayer.Renderer = uniValueRender as IFeatureRenderer;
        }
Esempio n. 37
0
 private void axMapControl1_OnMouseUp(object sender, IMapControlEvents2_OnMouseUpEvent e)
 {
     if (m_BasicOperationTool == "isMeasure")
     {
         m_bInUse = false;
         if (m_pLineSymbol != null)
         {
             IActiveView pActiveView = axMapControl1.ActiveView.FocusMap as IActiveView;
             pActiveView.ScreenDisplay.StartDrawing(pActiveView.ScreenDisplay.hDC, -1);
             pActiveView.ScreenDisplay.SetSymbol(m_pTextSymbol as ISymbol);
             pActiveView.ScreenDisplay.DrawText(m_pTextPoint, m_pTextSymbol.Text);
             pActiveView.ScreenDisplay.SetSymbol(m_pLineSymbol as ISymbol);
             if (m_pLinePolyline.Length > 0)
                 pActiveView.ScreenDisplay.DrawPolyline(m_pLinePolyline);
             pActiveView.ScreenDisplay.FinishDrawing();
             m_pTextSymbol = null;
             m_pTextPoint = null;
             m_pLinePolyline = null;
             m_pLineSymbol = null;
         }
     }
 }
Esempio n. 38
0
 private void axMapControl1_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e)
 {
     IActiveView pActiveView = axMapControl1.ActiveView.FocusMap as IActiveView;
     IPoint pPoint = pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(e.x, e.y);
     object Missing = Type.Missing;
     switch (m_BasicOperationTool)
     {
         case "isMeasure":
             if (!m_bInUse)
                 break;
             bool bFirstTime = false;
             if (m_pLineSymbol == null)
                 bFirstTime = true;
             pActiveView.ScreenDisplay.StartDrawing(pActiveView.ScreenDisplay.hDC, -1);
             if (bFirstTime == true)
             {
                 IRgbColor pRgbColor = new RgbColorClass();
                 m_pLineSymbol = new SimpleLineSymbolClass();
                 m_pLineSymbol.Width = 2;
                 pRgbColor.Red = 223;
                 pRgbColor.Green = 223;
                 pRgbColor.Blue = 223;
                 m_pLineSymbol.Color = pRgbColor;
                 ISymbol pSymbol = m_pLineSymbol as ISymbol;
                 pSymbol.ROP2 = esriRasterOpCode.esriROPXOrPen;
                 //�����ı�����
                 m_pTextSymbol = new TextSymbolClass();
                 m_pTextSymbol.HorizontalAlignment = esriTextHorizontalAlignment.esriTHACenter;
                 m_pTextSymbol.VerticalAlignment = esriTextVerticalAlignment.esriTVACenter;
                 m_pTextSymbol.Size = 16;
                 pSymbol = m_pTextSymbol as ISymbol;
                 stdole.IFontDisp fnt = (stdole.IFontDisp)new stdole.StdFontClass();
                 fnt.Name = "Arial";
                 fnt.Size = Convert.ToDecimal(20);
                 m_pTextSymbol.Font = fnt;
                 pSymbol.ROP2 = esriRasterOpCode.esriROPXOrPen;
                 //�������Ի��ı�
                 m_pTextPoint = new PointClass();
             }
             else
             {
                 pActiveView.ScreenDisplay.SetSymbol(m_pTextSymbol as ISymbol);
                 pActiveView.ScreenDisplay.DrawText(m_pTextPoint, m_pTextSymbol.Text);
                 pActiveView.ScreenDisplay.SetSymbol(m_pLineSymbol as ISymbol);
                 if (m_pLinePolyline.Length > 0)
                     pActiveView.ScreenDisplay.DrawPolyline(m_pLinePolyline);
             }
             //����㵽�յ�֮������߲������ı��ĽǶ�
             ILine pLine = new LineClass();
             pLine.PutCoords(m_pStartPoint, pPoint);
             double angle = pLine.Angle;
             angle = angle * (180 / 3.1415926);
             if ((angle > 90) || (angle < 180))
                 angle = angle + 180;
             if ((angle < 0) || (angle > -90))
                 angle = angle - 180;
             if ((angle < -90) || (angle > -180))
                 angle = angle - 180;
             if (angle > 180)
                 angle = angle - 180;
             //Ϊ�˻����ı�������ı��ľ��룬�ǶȺ͵�
             double deltaX = pPoint.X - m_pStartPoint.X;
             double deltaY = pPoint.Y - m_pStartPoint.Y;
             m_pTextPoint.X = m_pStartPoint.X + deltaX / 2;
             m_pTextPoint.Y = m_pStartPoint.Y + deltaY / 2;
             m_pTextSymbol.Angle = angle;
             int distance = Convert.ToInt32(Math.Sqrt((deltaX * deltaX) + (deltaY * deltaY)));
             m_pTextSymbol.Text = "[" + distance.ToString() + "]";
             //�����ı�
             pActiveView.ScreenDisplay.SetSymbol(m_pTextSymbol as ISymbol);
             pActiveView.ScreenDisplay.DrawText(m_pTextPoint, m_pTextSymbol.Text);
             //��ö����
             IPolyline pPolyline = new PolylineClass();
             ISegmentCollection pSegColl = pPolyline as ISegmentCollection;
             pSegColl.AddSegment(pLine as ISegment, ref Missing, ref Missing);
             m_pLinePolyline = GetSmashedLine(pActiveView.ScreenDisplay, m_pTextSymbol as ISymbol, m_pTextPoint, pPolyline);
             //���ƶ����
             pActiveView.ScreenDisplay.SetSymbol(m_pLineSymbol as ISymbol);
             if (m_pLinePolyline.Length > 0)
             {
                 pActiveView.ScreenDisplay.DrawPolyline(m_pLinePolyline);
             }
             pActiveView.ScreenDisplay.FinishDrawing();
             break;
     }
 }
        public static void SpecialLineRenderer2(ILayer layer, string field, string value, ILineSymbol lineSymbol)
        {
            var geoFeaLayer = layer as IGeoFeatureLayer;
            IUniqueValueRenderer uniValueRender = new UniqueValueRenderer();

            IQueryFilter2 queryFilter = new QueryFilterClass();
            uniValueRender.FieldCount = 1;
            uniValueRender.Field[0] = field;
            queryFilter.AddField(field);
            if (geoFeaLayer != null)
            {
                var fieldIndex = geoFeaLayer.FeatureClass.Fields.FindField(field);

                var customSymbol = (ISymbol)lineSymbol;

                var featureCursor = geoFeaLayer.FeatureClass.Search(queryFilter, true);
                var feature = featureCursor.NextFeature();
                while (feature != null)
                {
                    var sValue = Convert.ToString(feature.Value[fieldIndex]);
                    if (sValue == value)
                    {
                        uniValueRender.AddValue(sValue, "", customSymbol);
                    }
                    else
                    {
                        var defaultSymbol = geoFeaLayer.Renderer.SymbolByFeature[feature];
                        uniValueRender.AddValue(sValue, "", defaultSymbol);
                    }

                    feature = featureCursor.NextFeature();
                }
            }

            ComReleaser.ReleaseCOMObject(null);
            //System.Runtime.InteropServices.Marshal.ReleaseComObject(featureCursor);  //释放指针
            if (geoFeaLayer != null) geoFeaLayer.Renderer = uniValueRender as IFeatureRenderer;
        }