private void AsignarColorAClase(int iClase, string sEtiqueta, int red, int green, int blue, IRasterUniqueValueRenderer pRUVRenderer)
        {
            IColorSymbol pColorSymbol = new ColorSymbolClass();

            pRUVRenderer.AddValue(0, iClase, iClase);
            pRUVRenderer.set_Label(0, iClase, sEtiqueta);
            IRgbColor pColor = new RgbColorClass();

            pColor.Red         = red;
            pColor.Green       = green;
            pColor.Blue        = blue;
            pColorSymbol.Color = pColor as IColor;
            pRUVRenderer.set_Symbol(0, iClase, pColorSymbol as ISymbol);
        }
Esempio 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();
     }
 }