예제 #1
0
 public override void DrawTitle()
 {
     try
     {
         IPoint point = new PointClass();
         point.PutCoords((base.LeftUp.X + base.RightUp.X) / 2.0,
                         ((base.RightUp.Y + base.InOutDist) + this.double_2) + base.TitleDist);
         IElement item = new TextElementClass
         {
             Geometry = point
         };
         ITextElement element2 = item as ITextElement;
         element2.Text = base.MapTM;
         IElementProperties2 properties = element2 as IElementProperties2;
         ITextSymbol         symbol     = base.FontStyle(25.0, esriTextHorizontalAlignment.esriTHACenter,
                                                         esriTextVerticalAlignment.esriTVABottom);
         element2.Symbol = symbol;
         properties.Type = "图名";
         this.ilist_0.Add(item);
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
     }
 }
예제 #2
0
        public override void DrawInsideFrame()
        {
            IElement            item       = new LineElementClass();
            IElementProperties2 properties = null;
            ILineElement        element2   = null;
            ILineSymbol         symbol     = null;
            IPolyline           polyline   = new PolylineClass();
            IPointCollection    points     = polyline as IPointCollection;
            object missing = System.Type.Missing;

            try
            {
                if (!((base.LeftUp == null) || base.LeftUp.IsEmpty))
                {
                    points.AddPoint(base.LeftUp, ref missing, ref missing);
                }
                if (!((base.LeftLow == null) || base.LeftLow.IsEmpty))
                {
                    points.AddPoint(base.LeftLow, ref missing, ref missing);
                }
                if (!((base.RightLow == null) || base.RightLow.IsEmpty))
                {
                    points.AddPoint(base.RightLow, ref missing, ref missing);
                }
                if (!((base.RightUp == null) || base.RightUp.IsEmpty))
                {
                    points.AddPoint(base.RightUp, ref missing, ref missing);
                }
                if (!((base.LeftUp == null) || base.LeftUp.IsEmpty))
                {
                    points.AddPoint(base.LeftUp, ref missing, ref missing);
                }
                item.Geometry   = polyline;
                properties      = item as IElementProperties2;
                properties.Type = "内框";
                symbol          = this.method_5(1);
                element2        = item as ILineElement;
                element2.Symbol = symbol;
                this.ilist_0.Add(item);
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
        private void RefreshGraphicObject(IElement elem, IAGAnimationContainer pContainer)
        {
            IActiveView view    = pContainer.CurrentView as IActiveView;
            IEnvelope   elemEnv = GetElementBound(elem, pContainer);

            IEnvelope           oldEnv     = new EnvelopeClass();
            IElementProperties2 elemProps2 = (IElementProperties2)elem;

            oldEnv = (IEnvelope)elemProps2.CustomProperty;

            IViewRefresh animRefresh = (IViewRefresh)view;

            if (oldEnv != null)
            {
                elemEnv.Union(oldEnv);
            }

            animRefresh.AnimationRefresh(esriViewDrawPhase.esriViewGraphics, elem, elemEnv);
        }
예제 #4
0
        public void DrawGrid()
        {
            string              str        = "";
            string              str2       = "";
            ITextElement        element    = null;
            ITextElement        element2   = null;
            ITextElement        element3   = null;
            ITextElement        element4   = null;
            double              num        = 40.0;
            double              num2       = 20.0;
            double              num3       = 10.0;
            int                 num4       = 13;
            int                 num5       = 10;
            IPoint              point      = null;
            IElement            item       = null;
            ITextSymbol         symbol     = new TextSymbolClass();
            ITextSymbol         symbol2    = new TextSymbolClass();
            ITextSymbol         symbol3    = new TextSymbolClass();
            ITextSymbol         symbol4    = new TextSymbolClass();
            ITextSymbol         symbol5    = new TextSymbolClass();
            ITextSymbol         symbol6    = new TextSymbolClass();
            int                 num6       = 0;
            int                 num7       = 0;
            int                 num8       = 1000;
            double              x          = 0.0;
            double              y          = 0.0;
            IPoint              point2     = new PointClass();
            object              missing    = System.Type.Missing;
            IElementProperties2 properties = null;
            IMarkerElement      element6   = null;
            ISymbol             symbol7    = new SimpleMarkerSymbolClass();
            ISimpleMarkerSymbol symbol8    = symbol7 as ISimpleMarkerSymbol;
            IRgbColor           color      = new RgbColorClass
            {
                Red   = 0,
                Blue  = 0,
                Green = 0
            };

            symbol8.Size  = 10.0;
            symbol8.Style = esriSimpleMarkerStyle.esriSMSCross;
            symbol8.Color = color;
            double num11 = 0.0;
            double num12 = 0.0;
            double num13 = 0.0;
            double num14 = 0.0;
            int    num15 = 0;
            int    num16 = 0;
            int    num17 = 0;
            int    num18 = 0;
            int    num19 = 0;
            double num20 = 0.0;
            double num21 = 0.0;
            double num22 = 0.0;
            double num23 = 0.0;

            try
            {
                symbol = base.FontStyle((double)num4, esriTextHorizontalAlignment.esriTHARight,
                                        esriTextVerticalAlignment.esriTVABottom);
                symbol2 = base.FontStyle((double)num5, esriTextHorizontalAlignment.esriTHALeft,
                                         esriTextVerticalAlignment.esriTVABottom);
                symbol3 = base.FontStyle((double)num5, esriTextHorizontalAlignment.esriTHARight,
                                         esriTextVerticalAlignment.esriTVATop);
                symbol4 = base.FontStyle((double)num4, esriTextHorizontalAlignment.esriTHALeft,
                                         esriTextVerticalAlignment.esriTVATop);
                symbol5 = base.FontStyle((double)num5, esriTextHorizontalAlignment.esriTHARight,
                                         esriTextVerticalAlignment.esriTVABottom);
                symbol6 = base.FontStyle((double)num4, esriTextHorizontalAlignment.esriTHALeft,
                                         esriTextVerticalAlignment.esriTVABottom);
                if (base.LeftUp.Y < base.RightUp.Y)
                {
                    y     = Math.Truncate(base.LeftUp.Y);
                    num23 = (base.RightUp.Y + base.InOutDist) + 1.0;
                }
                else
                {
                    y     = Math.Truncate(base.RightUp.Y);
                    num23 = (base.LeftUp.Y + base.InOutDist) + 1.0;
                }
                num15 = (int)(y % ((double)num8));
                if (num15 != 0)
                {
                    num12 = y - num15;
                }
                else
                {
                    num12 = y;
                }
                if (base.LeftUp.X > base.LeftLow.X)
                {
                    x     = Math.Truncate((double)(base.LeftUp.X + 1.0));
                    num20 = (base.LeftLow.X - base.InOutDist) - 1.0;
                }
                else
                {
                    x     = Math.Truncate((double)(base.LeftLow.X + 1.0));
                    num20 = (base.LeftUp.X - base.InOutDist) - 1.0;
                }
                num15 = (int)(x % ((double)num8));
                if (num15 != 0)
                {
                    num11 = x + (num8 - num15);
                }
                else
                {
                    num11 = x;
                }
                if (base.LeftLow.Y < base.RightLow.Y)
                {
                    y     = Math.Truncate(base.LeftLow.Y);
                    num21 = (base.LeftLow.Y - base.InOutDist) - 1.0;
                }
                else
                {
                    y     = Math.Truncate(base.RightLow.Y);
                    num21 = (base.RightLow.Y - base.InOutDist) - 1.0;
                }
                num15 = (int)(y % ((double)num8));
                if (num15 != 0)
                {
                    num14 = y + (num8 - num15);
                }
                else
                {
                    num14 = y;
                }
                if (base.RightUp.X > base.RightLow.X)
                {
                    x     = Math.Truncate(base.RightLow.X);
                    num22 = (base.RightUp.X + base.InOutDist) + 1.0;
                }
                else
                {
                    x     = Math.Truncate(base.RightUp.X);
                    num22 = (base.RightLow.X + base.InOutDist) + 1.0;
                }
                num15 = (int)(x % ((double)num8));
                if (num15 != 0)
                {
                    num13 = x - num15;
                }
                else
                {
                    num13 = x;
                }
                num16 = ((int)(num12 - num14)) / num8;
                num17 = ((int)(num13 - num11)) / num8;
                for (num18 = 0; num18 <= num16; num18++)
                {
                    y = num12 - (num18 * num8);
                    for (num19 = 0; num19 <= num17; num19++)
                    {
                        x = num11 + (num19 * num8);
                        point2.PutCoords(x, y);
                        item = new MarkerElementClass
                        {
                            Geometry = point2
                        };
                        element6        = item as IMarkerElement;
                        element6.Symbol = symbol8;
                        properties      = item as IElementProperties2;
                        properties.Type = "公里网";
                        this.ilist_0.Add(item);
                    }
                }
                IPolygon polygon = new PolygonClass();
                new PolygonElementClass();
                polygon = this.method_3();
                double           num1      = base.LeftUp.X - base.InOutDist;
                double           num24     = base.LeftUp.X;
                double           num25     = base.RightUp.X;
                double           num26     = base.RightUp.X + base.InOutDist;
                IPoint           inPoint   = null;
                IPoint           point4    = null;
                IPoint           point5    = null;
                IPoint           point6    = null;
                IPolyline        polyline  = new PolylineClass();
                IPolyline        polyline2 = new PolylineClass();
                IPolyline        polyline3 = new PolylineClass();
                IPoint           point7    = null;
                IPoint           point8    = null;
                IPointCollection points    = null;
                IPointCollection points2   = null;
                IElement         element7  = null;
                IElement         element8  = null;
                ILineElement     element9  = null;
                ILineSymbol      symbol9   = this.method_5(1);
                for (num18 = 0; num18 <= num16; num18++)
                {
                    y      = num12 - (num18 * num8);
                    point7 = new PointClass();
                    point8 = new PointClass();
                    point7.PutCoords(num20, y);
                    point8.PutCoords(num22, y);
                    points = polyline3 as IPointCollection;
                    if (points.PointCount >= 1)
                    {
                        points.RemovePoints(0, points.PointCount);
                    }
                    points.AddPoint(point7, ref missing, ref missing);
                    points.AddPoint(point8, ref missing, ref missing);
                    points          = this.method_4(polyline3, polygon);
                    inPoint         = points.get_Point(0);
                    point4          = points.get_Point(1);
                    point5          = points.get_Point(2);
                    point6          = points.get_Point(3);
                    element7        = new LineElementClass();
                    element9        = element7 as ILineElement;
                    element9.Symbol = symbol9;
                    points2         = polyline as IPointCollection;
                    if (points2.PointCount >= 1)
                    {
                        points2.RemovePoints(0, points2.PointCount);
                    }
                    points2.AddPoint(inPoint, ref missing, ref missing);
                    points2.AddPoint(point4, ref missing, ref missing);
                    element7.Geometry = polyline;
                    element8          = new LineElementClass();
                    element9          = element8 as ILineElement;
                    element9.Symbol   = symbol9;
                    points2           = polyline2 as IPointCollection;
                    if (points2.PointCount >= 1)
                    {
                        points2.RemovePoints(0, points2.PointCount);
                    }
                    points2.AddPoint(point5, ref missing, ref missing);
                    points2.AddPoint(point6, ref missing, ref missing);
                    element8.Geometry = polyline2;
                    this.ilist_0.Add(element7);
                    this.ilist_0.Add(element8);
                    element  = new TextElementClass();
                    element2 = new TextElementClass();
                    element3 = new TextElementClass();
                    element4 = new TextElementClass();
                    num6     = (int)Math.Truncate((double)(y / 100000.0));
                    str      = num6.ToString();
                    num7     = (int)Math.Truncate((double)((y - (num6 * 100000)) / 1000.0));
                    str2     = num7.ToString();
                    if (str2.Length < 2)
                    {
                        str2 = "0" + str2;
                    }
                    element.Text  = str2;
                    element2.Text = str;
                    element3.Text = str2;
                    element4.Text = str;
                    point         = new PointClass();
                    point.PutCoords(inPoint.X, inPoint.Y + num2);
                    item           = element as IElement;
                    item.Geometry  = point;
                    element.Symbol = symbol;
                    this.ilist_0.Add(item);
                    if ((num18 == 0) || (num18 == num16))
                    {
                        point = new PointClass();
                        point.PutCoords(point4.X, point4.Y + num);
                        item            = element2 as IElement;
                        item.Geometry   = point;
                        element2.Symbol = symbol2;
                        this.ilist_0.Add(item);
                    }
                    point = new PointClass();
                    point.PutCoords(point5.X, point5.Y + num2);
                    item            = element3 as IElement;
                    item.Geometry   = point;
                    element3.Symbol = symbol;
                    this.ilist_0.Add(item);
                    if ((num18 == 0) || (num18 == num16))
                    {
                        point = new PointClass();
                        point.PutCoords(point6.X, point6.Y + num);
                        item            = element4 as IElement;
                        item.Geometry   = point;
                        element4.Symbol = symbol2;
                        this.ilist_0.Add(item);
                    }
                }
                for (num18 = 0; num18 <= num17; num18++)
                {
                    x      = num11 + (num18 * num8);
                    point7 = new PointClass();
                    point8 = new PointClass();
                    point7.PutCoords(x, num23);
                    point8.PutCoords(x, num21);
                    points = polyline3 as IPointCollection;
                    if (points.PointCount >= 1)
                    {
                        points.RemovePoints(0, points.PointCount);
                    }
                    points.AddPoint(point7, ref missing, ref missing);
                    points.AddPoint(point8, ref missing, ref missing);
                    points          = this.method_4(polyline3, polygon);
                    inPoint         = points.get_Point(0);
                    point4          = points.get_Point(1);
                    point5          = points.get_Point(2);
                    point6          = points.get_Point(3);
                    element7        = new LineElementClass();
                    element9        = element7 as ILineElement;
                    element9.Symbol = symbol9;
                    points2         = polyline as IPointCollection;
                    if (points2.PointCount >= 1)
                    {
                        points2.RemovePoints(0, points2.PointCount);
                    }
                    points2.AddPoint(inPoint, ref missing, ref missing);
                    points2.AddPoint(point4, ref missing, ref missing);
                    element7.Geometry = polyline;
                    element8          = new LineElementClass();
                    element9          = element8 as ILineElement;
                    element9.Symbol   = symbol9;
                    points2           = polyline2 as IPointCollection;
                    if (points2.PointCount >= 1)
                    {
                        points2.RemovePoints(0, points2.PointCount);
                    }
                    points2.AddPoint(point5, ref missing, ref missing);
                    points2.AddPoint(point6, ref missing, ref missing);
                    element8.Geometry = polyline2;
                    this.ilist_0.Add(element7);
                    this.ilist_0.Add(element8);
                    element  = new TextElementClass();
                    element2 = new TextElementClass();
                    element3 = new TextElementClass();
                    element4 = new TextElementClass();
                    num6     = (int)Math.Truncate((double)(x / 100000.0));
                    str      = num6.ToString();
                    str2     = ((int)Math.Truncate((double)((x - (num6 * 100000)) / 1000.0))).ToString();
                    if (str2.Length < 2)
                    {
                        str2 = "0" + str2;
                    }
                    element.Text  = str2;
                    element2.Text = str;
                    element3.Text = str2;
                    element4.Text = str;
                    point         = new PointClass();
                    point.PutCoords(inPoint.X, inPoint.Y - num3);
                    item           = element as IElement;
                    item.Geometry  = point;
                    element.Symbol = symbol4;
                    this.ilist_0.Add(item);
                    if ((num18 == 0) || (num18 == num17))
                    {
                        point = new PointClass();
                        point.PutCoords(inPoint.X, inPoint.Y - num3);
                        item            = element2 as IElement;
                        item.Geometry   = point;
                        element2.Symbol = symbol3;
                        this.ilist_0.Add(item);
                    }
                    point = new PointClass();
                    point.PutCoords(point6.X, point6.Y + num3);
                    item            = element3 as IElement;
                    item.Geometry   = point;
                    element3.Symbol = symbol6;
                    this.ilist_0.Add(item);
                    if ((num18 == 0) || (num18 == num17))
                    {
                        point = new PointClass();
                        point.PutCoords(point6.X, point6.Y + num3);
                        item            = element4 as IElement;
                        item.Geometry   = point;
                        element4.Symbol = symbol5;
                        this.ilist_0.Add(item);
                    }
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
예제 #5
0
        public override void DrawOutFrame()
        {
            IPoint              inPoint    = new PointClass();
            IPoint              point2     = new PointClass();
            IPoint              point3     = new PointClass();
            IPoint              point4     = new PointClass();
            IElement            item       = new PolygonElementClass();
            IFillShapeElement   element2   = item as IFillShapeElement;
            IGeometryCollection geometrys  = new PolygonClass();
            IElementProperties2 properties = null;
            object              missing    = System.Type.Missing;
            IGeometry           inGeometry = new RingClass();
            IGeometry           geometry2  = new RingClass();
            IPointCollection    points     = inGeometry as IPointCollection;

            try
            {
                if (!((base.LeftUp == null) || base.LeftUp.IsEmpty))
                {
                    inPoint.PutCoords(base.LeftUp.X - base.InOutDist, base.LeftUp.Y + base.InOutDist);
                    points.AddPoint(inPoint, ref missing, ref missing);
                }
                if (!((base.LeftLow == null) || base.LeftLow.IsEmpty))
                {
                    point2.PutCoords(base.LeftLow.X - base.InOutDist, base.LeftLow.Y - base.InOutDist);
                    points.AddPoint(point2, ref missing, ref missing);
                }
                if (!((base.RightLow == null) || base.RightLow.IsEmpty))
                {
                    point4.PutCoords(base.RightLow.X + base.InOutDist, base.RightLow.Y - base.InOutDist);
                    points.AddPoint(point4, ref missing, ref missing);
                }
                if (!((base.RightUp == null) || base.RightUp.IsEmpty))
                {
                    point3.PutCoords(base.RightUp.X + base.InOutDist, base.RightUp.Y + base.InOutDist);
                    points.AddPoint(point3, ref missing, ref missing);
                }
                if (!((base.LeftUp == null) || base.LeftUp.IsEmpty))
                {
                    inPoint.PutCoords(base.LeftUp.X - base.InOutDist, base.LeftUp.Y + base.InOutDist);
                    points.AddPoint(inPoint, ref missing, ref missing);
                }
                geometrys.AddGeometry(inGeometry, ref missing, ref missing);
                points = geometry2 as IPointCollection;
                if (!((base.LeftUp == null) || base.LeftUp.IsEmpty))
                {
                    inPoint.PutCoords((base.LeftUp.X - base.InOutDist) - this.double_2,
                                      (base.LeftUp.Y + base.InOutDist) + this.double_2);
                    points.AddPoint(inPoint, ref missing, ref missing);
                }
                if (!((base.LeftLow == null) || base.LeftLow.IsEmpty))
                {
                    point2.PutCoords((base.LeftLow.X - base.InOutDist) - this.double_2,
                                     (base.LeftLow.Y - base.InOutDist) - this.double_2);
                    points.AddPoint(point2, ref missing, ref missing);
                }
                if (!((base.RightLow == null) || base.RightLow.IsEmpty))
                {
                    point4.PutCoords((base.RightLow.X + base.InOutDist) + this.double_2,
                                     (base.RightLow.Y - base.InOutDist) - this.double_2);
                    points.AddPoint(point4, ref missing, ref missing);
                }
                if (!((base.RightUp == null) || base.RightUp.IsEmpty))
                {
                    point3.PutCoords((base.RightUp.X + base.InOutDist) + this.double_2,
                                     (base.RightUp.Y + base.InOutDist) + this.double_2);
                    points.AddPoint(point3, ref missing, ref missing);
                }
                if (!((base.LeftUp == null) || base.LeftUp.IsEmpty))
                {
                    inPoint.PutCoords((base.LeftUp.X - base.InOutDist) - this.double_2,
                                      (base.LeftUp.Y + base.InOutDist) + this.double_2);
                    points.AddPoint(inPoint, ref missing, ref missing);
                }
                geometrys.AddGeometry(geometry2, ref missing, ref missing);
                item.Geometry   = geometrys as IGeometry;
                element2.Symbol = this.method_6();
                properties      = item as IElementProperties2;
                properties.Type = "外框";
                this.ilist_0.Add(item);
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }