Exemplo n.º 1
0
 protected void DrawSymbol(int int_3, System.Drawing.Rectangle rectangle_0, object object_0)
 {
     if (object_0 != null)
     {
         IDisplayTransformation displayTransformation = new DisplayTransformationClass();
         IEnvelope envelope = new EnvelopeClass();
         envelope.PutCoords((double)rectangle_0.Left, (double)rectangle_0.Top, (double)rectangle_0.Right,
                            (double)rectangle_0.Bottom);
         tagRECT tagRECT;
         tagRECT.left   = rectangle_0.Left;
         tagRECT.right  = rectangle_0.Right;
         tagRECT.bottom = rectangle_0.Bottom;
         tagRECT.top    = rectangle_0.Top;
         displayTransformation.set_DeviceFrame(ref tagRECT);
         displayTransformation.Bounds         = envelope;
         displayTransformation.Resolution     = 96.0;
         displayTransformation.ReferenceScale = 1.0;
         displayTransformation.ScaleRatio     = 1.0;
         ISymbol symbol;
         if (object_0 is ISymbol)
         {
             symbol = (ISymbol)object_0;
         }
         else if (object_0 is IColorRamp)
         {
             IGradientFillSymbol gradientFillSymbol = new GradientFillSymbolClass();
             ILineSymbol         outline            = gradientFillSymbol.Outline;
             outline.Width = 0.0;
             gradientFillSymbol.Outline            = outline;
             gradientFillSymbol.ColorRamp          = (IColorRamp)object_0;
             gradientFillSymbol.GradientAngle      = 180.0;
             gradientFillSymbol.GradientPercentage = 1.0;
             gradientFillSymbol.IntervalCount      = 100;
             gradientFillSymbol.Style = esriGradientFillStyle.esriGFSLinear;
             symbol = (ISymbol)gradientFillSymbol;
         }
         else if (object_0 is IColor)
         {
             symbol = (ISymbol) new ColorSymbolClass
             {
                 Color = (IColor)object_0
             };
         }
         else if (object_0 is IAreaPatch)
         {
             symbol = new SimpleFillSymbolClass();
             IRgbColor rgbColor = new RgbColorClass();
             rgbColor.Red   = 227;
             rgbColor.Green = 236;
             rgbColor.Blue  = 19;
             ((IFillSymbol)symbol).Color = rgbColor;
         }
         else if (object_0 is ILinePatch)
         {
             symbol = new SimpleLineSymbolClass();
         }
         else
         {
             if (object_0 is INorthArrow)
             {
                 IDisplay display = new ScreenDisplayClass();
                 display.StartDrawing(int_3, 0);
                 display.DisplayTransformation = displayTransformation;
                 ((IMapSurround)object_0).Draw(display, null, envelope);
                 display.FinishDrawing();
                 ((IMapSurround)object_0).Refresh();
                 return;
             }
             if (object_0 is IMapSurround)
             {
                 IDisplay display = new ScreenDisplayClass();
                 display.StartDrawing(int_3, 0);
                 display.DisplayTransformation = displayTransformation;
                 IEnvelope envelope2 = new EnvelopeClass();
                 envelope2.PutCoords((double)(rectangle_0.Left + 5), (double)(rectangle_0.Top + 5),
                                     (double)(rectangle_0.Right - 5), (double)(rectangle_0.Bottom - 5));
                 ((IMapSurround)object_0).QueryBounds(display, envelope, envelope2);
                 bool flag;
                 ((IMapSurround)object_0).FitToBounds(display, envelope2, out flag);
                 ((IMapSurround)object_0).Draw(display, null, envelope2);
                 display.FinishDrawing();
                 ((IMapSurround)object_0).Refresh();
                 return;
             }
             if (object_0 is IBackground)
             {
                 IDisplay display = new ScreenDisplayClass();
                 display.StartDrawing(int_3, 0);
                 display.DisplayTransformation = displayTransformation;
                 IGeometry geometry = ((IBackground)object_0).GetGeometry(display, envelope);
                 ((IBackground)object_0).Draw(display, geometry);
                 display.FinishDrawing();
                 return;
             }
             if (object_0 is IShadow)
             {
                 IDisplay display = new ScreenDisplayClass();
                 display.StartDrawing(int_3, 0);
                 display.DisplayTransformation = displayTransformation;
                 double horizontalSpacing = ((IShadow)object_0).HorizontalSpacing;
                 double verticalSpacing   = ((IShadow)object_0).VerticalSpacing;
                 ((IShadow)object_0).HorizontalSpacing = 0.0;
                 ((IShadow)object_0).VerticalSpacing   = 0.0;
                 IGeometry geometry = ((IShadow)object_0).GetGeometry(display, envelope);
                 ((IShadow)object_0).Draw(display, geometry);
                 ((IShadow)object_0).HorizontalSpacing = horizontalSpacing;
                 ((IShadow)object_0).VerticalSpacing   = verticalSpacing;
                 display.FinishDrawing();
                 return;
             }
             if (object_0 is IBorder)
             {
                 IDisplay display = new ScreenDisplayClass();
                 display.StartDrawing(int_3, 0);
                 display.DisplayTransformation = displayTransformation;
                 IPointCollection pointCollection = new PolylineClass();
                 object           value           = System.Reflection.Missing.Value;
                 IPoint           point           = new PointClass();
                 point.PutCoords((double)(rectangle_0.X + 4), (double)rectangle_0.Top);
                 pointCollection.AddPoint(point, ref value, ref value);
                 point.PutCoords((double)(rectangle_0.X + 4), (double)rectangle_0.Bottom);
                 pointCollection.AddPoint(point, ref value, ref value);
                 point.PutCoords((double)(rectangle_0.Right - 4), (double)rectangle_0.Bottom);
                 pointCollection.AddPoint(point, ref value, ref value);
                 IGeometry geometry = ((IBorder)object_0).GetGeometry(display, (IGeometry)pointCollection);
                 ((IBorder)object_0).Draw(display, geometry);
                 display.FinishDrawing();
                 return;
             }
             return;
         }
         if (symbol is IPictureFillSymbol || symbol is IPictureLineSymbol)
         {
             symbol.SetupDC(int_3, null);
         }
         else
         {
             symbol.SetupDC(int_3, displayTransformation);
         }
         if (object_0 is IPatch)
         {
             this.method_3(symbol, (IPatch)object_0, rectangle_0);
         }
         else if (symbol is IMarkerSymbol)
         {
             this.method_2((IMarkerSymbol)symbol, rectangle_0);
         }
         else if (symbol is ILineSymbol)
         {
             this.method_4((ILineSymbol)symbol, rectangle_0);
         }
         else if (symbol is IFillSymbol)
         {
             this.method_5((IFillSymbol)symbol, rectangle_0);
         }
         else if (symbol is ITextSymbol)
         {
             this.method_7((ITextSymbol)symbol, rectangle_0);
         }
         symbol.ResetDC();
     }
 }
Exemplo n.º 2
0
 protected void DrawSymbol(int int_3, Rectangle rectangle_0, object object_0)
 {
     if (object_0 != null)
     {
         tagRECT grect;
         ISymbol symbol;
         IDisplayTransformation transformation = new DisplayTransformationClass();
         IEnvelope bounds = new EnvelopeClass();
         bounds.PutCoords((double)rectangle_0.Left, (double)rectangle_0.Top, (double)rectangle_0.Right,
                          (double)rectangle_0.Bottom);
         grect.left   = rectangle_0.Left;
         grect.right  = rectangle_0.Right;
         grect.bottom = rectangle_0.Bottom;
         grect.top    = rectangle_0.Top;
         transformation.set_DeviceFrame(ref grect);
         transformation.Bounds         = bounds;
         transformation.Resolution     = 96.0;
         transformation.ReferenceScale = 1.0;
         transformation.ScaleRatio     = 1.0;
         if (object_0 is ISymbol)
         {
             symbol = object_0 as ISymbol;
         }
         else if (object_0 is IColorRamp)
         {
             IGradientFillSymbol symbol2 = new GradientFillSymbolClass();
             ILineSymbol         outline = symbol2.Outline;
             outline.Width              = 0.0;
             symbol2.Outline            = outline;
             symbol2.ColorRamp          = object_0 as IColorRamp;
             symbol2.GradientAngle      = 180.0;
             symbol2.GradientPercentage = 1.0;
             symbol2.IntervalCount      = 100;
             symbol2.Style              = esriGradientFillStyle.esriGFSLinear;
             symbol = (ISymbol)symbol2;
         }
         else if (object_0 is IColor)
         {
             IColorSymbol symbol4 = new ColorSymbolClass
             {
                 Color = object_0 as IColor
             };
             symbol = (ISymbol)symbol4;
         }
         else if (object_0 is IAreaPatch)
         {
             symbol = new SimpleFillSymbolClass();
             IRgbColor color = new RgbColorClass
             {
                 Red   = 227,
                 Green = 236,
                 Blue  = 19
             };
             ((IFillSymbol)symbol).Color = color;
         }
         else
         {
             if (!(object_0 is ILinePatch))
             {
                 IDisplay display;
                 if (object_0 is INorthArrow)
                 {
                     display = new ScreenDisplayClass();
                     display.StartDrawing(int_3, 0);
                     display.DisplayTransformation = transformation;
                     ((IMapSurround)object_0).Draw(display, null, bounds);
                     display.FinishDrawing();
                     ((IMapSurround)object_0).Refresh();
                 }
                 else if (object_0 is IMapSurround)
                 {
                     bool flag;
                     display = new ScreenDisplayClass();
                     display.StartDrawing(int_3, 0);
                     display.DisplayTransformation = transformation;
                     IEnvelope newBounds = new EnvelopeClass();
                     newBounds.PutCoords((double)(rectangle_0.Left + 5), (double)(rectangle_0.Top + 5),
                                         (double)(rectangle_0.Right - 5), (double)(rectangle_0.Bottom - 5));
                     ((IMapSurround)object_0).QueryBounds(display, bounds, newBounds);
                     ((IMapSurround)object_0).FitToBounds(display, newBounds, out flag);
                     ((IMapSurround)object_0).Draw(display, null, newBounds);
                     display.FinishDrawing();
                     ((IMapSurround)object_0).Refresh();
                 }
                 else
                 {
                     IGeometry geometry;
                     if (object_0 is IBackground)
                     {
                         display = new ScreenDisplayClass();
                         display.StartDrawing(int_3, 0);
                         display.DisplayTransformation = transformation;
                         geometry = ((IBackground)object_0).GetGeometry(display, bounds);
                         ((IBackground)object_0).Draw(display, geometry);
                         display.FinishDrawing();
                     }
                     else if (object_0 is IShadow)
                     {
                         display = new ScreenDisplayClass();
                         display.StartDrawing(int_3, 0);
                         display.DisplayTransformation = transformation;
                         double horizontalSpacing = ((IShadow)object_0).HorizontalSpacing;
                         double verticalSpacing   = ((IShadow)object_0).VerticalSpacing;
                         ((IShadow)object_0).HorizontalSpacing = 0.0;
                         ((IShadow)object_0).VerticalSpacing   = 0.0;
                         geometry = ((IShadow)object_0).GetGeometry(display, bounds);
                         ((IShadow)object_0).Draw(display, geometry);
                         ((IShadow)object_0).HorizontalSpacing = horizontalSpacing;
                         ((IShadow)object_0).VerticalSpacing   = verticalSpacing;
                         display.FinishDrawing();
                     }
                     else if (object_0 is IBorder)
                     {
                         display = new ScreenDisplayClass();
                         display.StartDrawing(int_3, 0);
                         display.DisplayTransformation = transformation;
                         IPointCollection points  = new PolylineClass();
                         object           before  = Missing.Value;
                         IPoint           inPoint = new PointClass();
                         inPoint.PutCoords((double)(rectangle_0.X + 4), (double)rectangle_0.Top);
                         points.AddPoint(inPoint, ref before, ref before);
                         inPoint.PutCoords((double)(rectangle_0.X + 4), (double)rectangle_0.Bottom);
                         points.AddPoint(inPoint, ref before, ref before);
                         inPoint.PutCoords((double)(rectangle_0.Right - 4), (double)rectangle_0.Bottom);
                         points.AddPoint(inPoint, ref before, ref before);
                         geometry = ((IBorder)object_0).GetGeometry(display, (IGeometry)points);
                         ((IBorder)object_0).Draw(display, geometry);
                         display.FinishDrawing();
                     }
                 }
                 return;
             }
             symbol = new SimpleLineSymbolClass();
         }
         if ((symbol is IPictureFillSymbol) || (symbol is IPictureLineSymbol))
         {
             symbol.SetupDC(int_3, null);
         }
         else
         {
             symbol.SetupDC(int_3, transformation);
         }
         if (object_0 is IPatch)
         {
             this.method_3(symbol, (IPatch)object_0, rectangle_0);
         }
         else if (symbol is IMarkerSymbol)
         {
             this.method_2((IMarkerSymbol)symbol, rectangle_0);
         }
         else if (symbol is ILineSymbol)
         {
             this.method_4((ILineSymbol)symbol, rectangle_0);
         }
         else if (symbol is IFillSymbol)
         {
             this.method_5((IFillSymbol)symbol, rectangle_0);
         }
         else if (symbol is ITextSymbol)
         {
             this.method_7((ITextSymbol)symbol, rectangle_0);
         }
         symbol.ResetDC();
     }
 }