Ejemplo n.º 1
0
        void ESRI.ArcGIS.esriSystem.IPersistVariant.Load(IVariantStream Stream)
        {
            int num = 0;

            num = Convert.ToInt32(Stream.Read());
            if (num > 1 | num <= 0)
            {
                throw new Exception("Failed to read from stream");
            }
            this.InitializeMembers();
            if (num == 1)
            {
                this.m_lROP2 = (esriRasterOpCode)Stream.Read();
                this.m_Size  = Convert.ToDouble(Stream.Read());
                this.m_Angle = Convert.ToDouble(Stream.Read());
                this.m_HorizontalAlignment = (esriTextHorizontalAlignment)Stream.Read();
                this.m_VerticalAlignment   = (esriTextVerticalAlignment)Stream.Read();
                this.m_RightToLeft         = Convert.ToBoolean(Stream.Read());
                this.m_Text                  = Convert.ToString(Stream.Read());
                this.m_bRotWithTrans         = Convert.ToBoolean(Stream.Read());
                this.m_lMapLevel             = Convert.ToInt32(Stream.Read());
                this.m_NumeratorText         = Convert.ToString(Stream.Read());
                this.m_DenominatorText       = Convert.ToString(Stream.Read());
                this.m_LineSymbol            = Stream.Read() as ILineSymbol;
                this.m_NumeratorTextSymbol   = Stream.Read() as ITextSymbol;
                this.m_DenominatorTextSymbol = Stream.Read() as ITextSymbol;
            }
        }
Ejemplo n.º 2
0
 private void InitializeMembers()
 {
     this.m_lhDC                     = 0;
     this.m_lOldPen                  = 0;
     this.m_lPen                     = 0;
     this.m_lOldBrush                = 0;
     this.m_lBrushTop                = 0;
     this.m_lBrushLeft               = 0;
     this.m_lBrushRight              = 0;
     this.m_dDeviceRadius            = 0;
     this.m_trans                    = null;
     this.m_NumeratorTextSymbol      = new TextSymbol();
     this.m_LineSymbol               = new SimpleLineSymbol();
     this.m_DenominatorTextSymbol    = new TextSymbol();
     this.m_NumeratorText            = "AaBbYyZz";
     this.m_DenominatorText          = "AaBbYyZz";
     this.m_NumeratorTextSymbol.Text = this.m_NumeratorText;
     this.m_NumeratorTextSymbol.HorizontalAlignment = esriTextHorizontalAlignment.esriTHACenter;
     this.m_NumeratorTextSymbol.VerticalAlignment   = esriTextVerticalAlignment.esriTVABottom;
     this.m_DenominatorTextSymbol.Text = this.m_DenominatorText;
     this.m_DenominatorTextSymbol.HorizontalAlignment = esriTextHorizontalAlignment.esriTHACenter;
     this.m_DenominatorTextSymbol.VerticalAlignment   = esriTextVerticalAlignment.esriTVATop;
     this.m_lROP2  = esriRasterOpCode.esriROPCopyPen;
     this.m_Angle  = 0;
     this.m_pColor = new RgbColor();
     this.m_pFont  = new StdFont() as IFontDisp;
     this.m_HorizontalAlignment = esriTextHorizontalAlignment.esriTHALeft;
     this.m_RightToLeft         = false;
     this.m_Size = 0;
     this.m_Text = "";
     this.m_VerticalAlignment = esriTextVerticalAlignment.esriTVACenter;
     this.m_bRotWithTrans     = true;
 }
Ejemplo n.º 3
0
        private void InitializeMembers()
        {
            this.m_lhDC          = 0;
            this.m_lOldPen       = 0;
            this.m_lPen          = 0;
            this.m_lOldBrush     = 0;
            this.m_lBrushTop     = 0;
            this.m_lBrushLeft    = 0;
            this.m_lBrushRight   = 0;
            this.m_dDeviceRadius = 0;
            this.m_trans         = null;
            IColor rGBColor = null;

            rGBColor             = Converter.ToRGBColor(System.Drawing.Color.Red);
            this.m_colorTop      = ((IClone)rGBColor).Clone() as IColor;
            rGBColor             = Converter.ToRGBColor(System.Drawing.Color.OrangeRed);
            this.m_colorLeft     = ((IClone)rGBColor).Clone() as IColor;
            rGBColor             = Converter.ToRGBColor(System.Drawing.Color.Pink);
            this.m_colorRight    = ((IClone)rGBColor).Clone() as IColor;
            rGBColor             = Converter.ToRGBColor(System.Drawing.Color.Black);
            this.m_colorBorder   = ((IClone)rGBColor).Clone() as IColor;
            this.m_lROP2         = esriRasterOpCode.esriROPCopyPen;
            this.m_dSize         = 10;
            this.m_dAngle        = 0;
            this.m_dXOffset      = 0;
            this.m_dYOffset      = 0;
            this.m_bRotWithTrans = true;
        }
Ejemplo n.º 4
0
        void ESRI.ArcGIS.esriSystem.IPersistVariant.Load(IVariantStream Stream)
        {
            int num = 0;

            num = Convert.ToInt32(Stream.Read());
            if (num > 1 | num <= 0)
            {
                throw new Exception("Failed to read from stream");
            }
            this.InitializeMembers();
            if (num == 1)
            {
                this.m_lROP2         = (esriRasterOpCode)Stream.Read();
                this.m_dSize         = Convert.ToDouble(Stream.Read());
                this.m_dXOffset      = Convert.ToDouble(Stream.Read());
                this.m_dYOffset      = Convert.ToDouble(Stream.Read());
                this.m_dAngle        = Convert.ToDouble(Stream.Read());
                this.m_bRotWithTrans = Convert.ToBoolean(Stream.Read());
                this.m_lMapLevel     = Convert.ToInt32(Stream.Read());
                this.m_colorTop      = Stream.Read() as IColor;
                this.m_colorLeft     = Stream.Read() as IColor;
                this.m_colorRight    = Stream.Read() as IColor;
                this.m_colorBorder   = Stream.Read() as IColor;
            }
        }
Ejemplo n.º 5
0
 void ESRI.ArcGIS.Display.ISymbol.ResetDC()
 {
     this.m_lROP2 = (esriRasterOpCode)Utility.SetROP2(this.m_lhDC, Convert.ToInt32(this.m_lROP2Old));
     Utility.SelectObject(this.m_lhDC, this.m_lOldPen);
     Utility.DeleteObject(this.m_lPen);
     Utility.SelectObject(this.m_lhDC, this.m_lOldBrush);
     Utility.DeleteObject(this.m_lBrushTop);
     Utility.DeleteObject(this.m_lBrushLeft);
     Utility.DeleteObject(this.m_lBrushRight);
     this.m_trans = null;
     this.m_lhDC  = 0;
 }
Ejemplo n.º 6
0
 private void InitializeMembers()
 {
     this.m_lhDC          = 0;
     this.m_lOldPen       = 0;
     this.m_lPen          = 0;
     this.m_lOldBrush     = 0;
     this.m_lBrushTop     = 0;
     this.m_lBrushLeft    = 0;
     this.m_lBrushRight   = 0;
     this.m_dDeviceRadius = 0;
     this.m_trans         = null;
     this.m_lROP2         = esriRasterOpCode.esriROPCopyPen;
     this.m_widht         = 1;
     this.m_bRotWithTrans = true;
 }
Ejemplo n.º 7
0
 void ESRI.ArcGIS.Display.ISymbol.SetupDC(int hDC, ITransformation Transformation)
 {
     this.m_trans = Transformation as IDisplayTransformation;
     this.m_lhDC  = hDC;
     this.SetupDeviceRatio(this.m_lhDC, this.m_trans);
     this.m_dDeviceRadius  = this.m_dSize / 2 * this.m_dDeviceRatio;
     this.m_dDeviceXOffset = this.m_dXOffset * this.m_dDeviceRatio;
     this.m_dDeviceYOffset = this.m_dYOffset * this.m_dDeviceRatio;
     if (!this.m_bRotWithTrans)
     {
         this.m_dMapRotation = 0;
     }
     else
     {
         this.m_dMapRotation = this.m_trans.Rotation;
     }
     this.m_lPen = Utility.CreatePen(0, Convert.ToInt32(1 * this.m_dDeviceRatio),
                                     Convert.ToInt32(this.m_colorBorder.RGB));
     this.m_lROP2Old    = (esriRasterOpCode)Utility.SetROP2(hDC, Convert.ToInt32(this.m_lROP2));
     this.m_lBrushTop   = Utility.CreateSolidBrush(Convert.ToInt32(this.m_colorTop.RGB));
     this.m_lBrushLeft  = Utility.CreateSolidBrush(Convert.ToInt32(this.m_colorLeft.RGB));
     this.m_lBrushRight = Utility.CreateSolidBrush(Convert.ToInt32(this.m_colorRight.RGB));
     this.m_lOldPen     = Utility.SelectObject(hDC, this.m_lPen);
 }
        /// <summary>
        /// Adds a graphic element to the map graphics container
        /// </summary>
        /// <param name="geom">IGeometry</param>
        internal void AddGraphicToMap(IGeometry geom, IColor color, bool IsTempGraphic = false, esriSimpleMarkerStyle markerStyle = esriSimpleMarkerStyle.esriSMSCircle, esriRasterOpCode rasterOpCode = esriRasterOpCode.esriROPNOP)
        {
            if (geom == null || ArcMap.Document == null || ArcMap.Document.FocusMap == null)
                return;
            IElement element = null;
            double width = 2.0;

            geom.Project(ArcMap.Document.FocusMap.SpatialReference);

            if(geom.GeometryType == esriGeometryType.esriGeometryPoint)
            {
                // Marker symbols
                var simpleMarkerSymbol = new SimpleMarkerSymbol() as ISimpleMarkerSymbol;
                simpleMarkerSymbol.Color = color;
                simpleMarkerSymbol.Outline = true;
                simpleMarkerSymbol.OutlineColor = color;
                simpleMarkerSymbol.Size = 5;
                simpleMarkerSymbol.Style = markerStyle;

                var markerElement = new MarkerElement() as IMarkerElement;
                markerElement.Symbol = simpleMarkerSymbol;
                element = markerElement as IElement;
            }
            else if(geom.GeometryType == esriGeometryType.esriGeometryPolyline)
            {
                // create graphic then add to map
                var lineSymbol = new SimpleLineSymbolClass();
                lineSymbol.Color = color;
                lineSymbol.Width = width;
                if (IsTempGraphic && rasterOpCode != esriRasterOpCode.esriROPNOP)
                {
                    lineSymbol.Width = 1;
                    lineSymbol.ROP2 = rasterOpCode;
                }

                var le = new LineElementClass() as ILineElement;  
                element = le as IElement;
                le.Symbol = lineSymbol;
            }

            if (element == null)
                return;

            IClone clone = geom as IClone;
            element.Geometry = clone as IGeometry;       

            var mxdoc = ArcMap.Application.Document as IMxDocument;
            var av = mxdoc.FocusMap as IActiveView;
            var gc = av as IGraphicsContainer;

            // store guid
            var eprop = element as IElementProperties;
            eprop.Name = Guid.NewGuid().ToString();
 
            if (this is LinesViewModel)
                GraphicsList.Add(new Graphic(GraphicTypes.Line, eprop.Name, geom, IsTempGraphic));
            else if (this is CircleViewModel)
                GraphicsList.Add(new Graphic(GraphicTypes.Circle, eprop.Name, geom, IsTempGraphic));
            else if (this is EllipseViewModel)
                GraphicsList.Add(new Graphic(GraphicTypes.Ellipse, eprop.Name, geom, IsTempGraphic));
            else if (this is RangeViewModel)
                GraphicsList.Add(new Graphic(GraphicTypes.RangeRing, eprop.Name, geom, IsTempGraphic));

            gc.AddElement(element, 0);

            //refresh map
            av.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);

            if (!IsTempGraphic)
                RaisePropertyChanged(() => HasMapGraphics);
        }
Ejemplo n.º 9
0
 void ESRI.ArcGIS.Display.ISymbol.ResetDC()
 {
     this.m_lROP2 = this.m_lROP2Old;
     this.m_trans = null;
     this.m_lhDC  = 0;
 }
        /// <summary>
        /// Adds a graphic element to the map graphics container
        /// </summary>
        /// <param name="geom">IGeometry</param>
        internal void AddGraphicToMap(IGeometry geom, IColor color, bool IsTempGraphic = false, esriSimpleMarkerStyle markerStyle = esriSimpleMarkerStyle.esriSMSCircle, esriRasterOpCode rasterOpCode = esriRasterOpCode.esriROPNOP)
        {
            if (geom == null || ArcMap.Document == null || ArcMap.Document.FocusMap == null)
            {
                return;
            }
            IElement element = null;
            double   width   = 2.0;

            geom.Project(ArcMap.Document.FocusMap.SpatialReference);

            if (geom.GeometryType == esriGeometryType.esriGeometryPoint)
            {
                // Marker symbols
                var simpleMarkerSymbol = new SimpleMarkerSymbol() as ISimpleMarkerSymbol;
                simpleMarkerSymbol.Color        = color;
                simpleMarkerSymbol.Outline      = true;
                simpleMarkerSymbol.OutlineColor = color;
                simpleMarkerSymbol.Size         = 5;
                simpleMarkerSymbol.Style        = markerStyle;

                var markerElement = new MarkerElement() as IMarkerElement;
                markerElement.Symbol = simpleMarkerSymbol;
                element = markerElement as IElement;
            }
            else if (geom.GeometryType == esriGeometryType.esriGeometryPolyline)
            {
                // create graphic then add to map
                var lineSymbol = new SimpleLineSymbolClass();
                lineSymbol.Color = color;
                lineSymbol.Width = width;
                if (IsTempGraphic && rasterOpCode != esriRasterOpCode.esriROPNOP)
                {
                    lineSymbol.Width = 1;
                    lineSymbol.ROP2  = rasterOpCode;
                }

                var le = new LineElementClass() as ILineElement;
                element   = le as IElement;
                le.Symbol = lineSymbol;
            }

            if (element == null)
            {
                return;
            }

            IClone clone = geom as IClone;

            element.Geometry = clone as IGeometry;

            var mxdoc = ArcMap.Application.Document as IMxDocument;
            var av    = mxdoc.FocusMap as IActiveView;
            var gc    = av as IGraphicsContainer;

            // store guid
            var eprop = element as IElementProperties;

            eprop.Name = Guid.NewGuid().ToString();

            if (this is LinesViewModel)
            {
                GraphicsList.Add(new Graphic(GraphicTypes.Line, eprop.Name, geom, IsTempGraphic));
            }
            else if (this is CircleViewModel)
            {
                GraphicsList.Add(new Graphic(GraphicTypes.Circle, eprop.Name, geom, IsTempGraphic));
            }
            else if (this is EllipseViewModel)
            {
                GraphicsList.Add(new Graphic(GraphicTypes.Ellipse, eprop.Name, geom, IsTempGraphic));
            }
            else if (this is RangeViewModel)
            {
                GraphicsList.Add(new Graphic(GraphicTypes.RangeRing, eprop.Name, geom, IsTempGraphic));
            }

            gc.AddElement(element, 0);

            //refresh map
            av.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);

            if (!IsTempGraphic)
            {
                RaisePropertyChanged(() => HasMapGraphics);
            }
        }