コード例 #1
0
ファイル: Form1.cs プロジェクト: XYT1033/csdn_download
        //MultiLayerLineSymbol
        private void button8_Click(object sender, EventArgs e)
        {
            IMultiLayerLineSymbol multiLayerLineSymbol = new MultiLayerLineSymbolClass();
            ISimpleLineSymbol     simpleLineSymbol     = new SimpleLineSymbolClass();

            simpleLineSymbol.Style = esriSimpleLineStyle.esriSLSDashDotDot;
            simpleLineSymbol.Width = 10;
            IRgbColor rgbColor = getRGB(255, 0, 0);

            simpleLineSymbol.Color = rgbColor;
            ISymbol symbol = simpleLineSymbol as ISymbol;

            symbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen;

            ICartographicLineSymbol cartographicLineSymbol = new CartographicLineSymbolClass();

            cartographicLineSymbol.Cap        = esriLineCapStyle.esriLCSButt;
            cartographicLineSymbol.Join       = esriLineJoinStyle.esriLJSBevel;
            cartographicLineSymbol.Width      = 10;
            cartographicLineSymbol.MiterLimit = 4;
            ILineProperties lineProperties;

            lineProperties        = cartographicLineSymbol as ILineProperties;
            lineProperties.Offset = 0;
            double[] dob = new double[6];
            dob[0] = 0;
            dob[1] = 1;
            dob[2] = 2;
            dob[3] = 3;
            dob[4] = 4;
            dob[5] = 5;
            ITemplate template = new TemplateClass();

            template.Interval = 1;
            for (int i = 0; i < dob.Length; i += 2)
            {
                template.AddPatternElement(dob[i], dob[i + 1]);
            }
            lineProperties.Template = template;

            IPolyline polyline = new PolylineClass();
            IPoint    point    = new PointClass();

            point.PutCoords(1, 1);
            polyline.FromPoint = point;
            point.PutCoords(10, 10);
            polyline.ToPoint             = point;
            rgbColor                     = getRGB(0, 255, 0);
            cartographicLineSymbol.Color = rgbColor;
            multiLayerLineSymbol.AddLayer(simpleLineSymbol);
            multiLayerLineSymbol.AddLayer(cartographicLineSymbol);

            IActiveView activeView = this.axMapControl1.ActiveView;

            activeView.ScreenDisplay.StartDrawing(activeView.ScreenDisplay.hDC, (short)esriScreenCache.esriNoScreenCache);
            activeView.ScreenDisplay.SetSymbol(multiLayerLineSymbol as ISymbol);
            activeView.ScreenDisplay.DrawPolyline(polyline as IGeometry);
            activeView.ScreenDisplay.FinishDrawing();
            activeView.ScreenDisplay.FinishDrawing();
        }
コード例 #2
0
        private ISymbol CreateBikeRouteSymbol()
        {
            IColor color = (IColor)ESRI.ArcGIS.ADF.Connection.Local.Converter.ToRGBColor(Color.FromArgb(0, 90, 250));
            ICharacterMarkerSymbol charMarkerSymbol = new CharacterMarkerSymbolClass();

            charMarkerSymbol.Color          = color;
            charMarkerSymbol.Font           = ESRI.ArcGIS.ADF.Connection.Local.Converter.ToStdFont(new Font("ESRI Default Marker", 17.0f, FontStyle.Bold));
            charMarkerSymbol.CharacterIndex = 189;
            charMarkerSymbol.Size           = 17;

            IMarkerLineSymbol markerLineSymbol = new MarkerLineSymbolClass();

            markerLineSymbol.Color        = color;
            markerLineSymbol.Width        = 17.0;
            markerLineSymbol.MarkerSymbol = (IMarkerSymbol)charMarkerSymbol;

            // Makes a new Cartographic Line symbol and sets its properties
            ICartographicLineSymbol cartographicLineSymbol = markerLineSymbol as ICartographicLineSymbol;

            // In order to set additional properties like offsets and dash patterns we must create an ILineProperties object
            ILineProperties lineProperties = cartographicLineSymbol as ILineProperties;

            lineProperties.Offset = 0;

            // Here's how to do a template for the pattern of marks and gaps
            double[] hpe = new double[4];
            hpe[0] = 0;
            hpe[1] = 39;
            hpe[2] = 1;
            hpe[3] = 0;

            ITemplate template = new TemplateClass();

            template.Interval = 1;
            for (int i = 0; i < hpe.Length; i = i + 2)
            {
                template.AddPatternElement(hpe[i], hpe[i + 1]);
            }
            lineProperties.Template = template;

            // Set the basic and cartographic line properties
            cartographicLineSymbol.Color = color;

            color = (IColor)ESRI.ArcGIS.ADF.Connection.Local.Converter.ToRGBColor(Color.FromArgb(0, 220, 100));

            // create a simple line
            ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbolClass();

            simpleLineSymbol.Color = color;
            simpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
            simpleLineSymbol.Width = 1.2;

            IMultiLayerLineSymbol multiLayerLineSymbol = new MultiLayerLineSymbolClass();

            multiLayerLineSymbol.AddLayer((ILineSymbol)cartographicLineSymbol);
            multiLayerLineSymbol.AddLayer((ILineSymbol)simpleLineSymbol);

            return(multiLayerLineSymbol as ISymbol);
        }
コード例 #3
0
ファイル: FlashObjectsClass.cs プロジェクト: AgentWord/SiPing
        private ILineSymbol DefineLineOutLineSymbol()
        {
            ISimpleLineSymbol backBlackLine = new SimpleLineSymbolClass();

            backBlackLine.Width = 5.5;
            backBlackLine.Color = DefineRgbColor(0, 0, 0);
            backBlackLine.Style = esriSimpleLineStyle.esriSLSSolid;

            ISimpleLineSymbol foreGreenLine = new SimpleLineSymbolClass();

            foreGreenLine.Width = 4;
            foreGreenLine.Color = DefineRgbColor(0, 128, 0);
            foreGreenLine.Style = esriSimpleLineStyle.esriSLSSolid;

            IMultiLayerLineSymbol multiLayerLineSymbol = new MultiLayerLineSymbolClass();

            multiLayerLineSymbol.AddLayer(backBlackLine);
            multiLayerLineSymbol.AddLayer(foreGreenLine);
            ILineSymbol lineSymbol = (ILineSymbol)multiLayerLineSymbol;

            return(lineSymbol);
        }
コード例 #4
0
ファイル: FlashObjectsClass.cs プロジェクト: AgentWord/SiPing
        private ILineSymbol DefineLineOutLineSymbol()
        {
            ISimpleLineSymbol backBlackLine = new SimpleLineSymbolClass();
            backBlackLine.Width = 5.5;
            backBlackLine.Color = DefineRgbColor(0, 0, 0);
            backBlackLine.Style = esriSimpleLineStyle.esriSLSSolid;

            ISimpleLineSymbol foreGreenLine = new SimpleLineSymbolClass();
            foreGreenLine.Width = 4;
            foreGreenLine.Color = DefineRgbColor(0, 128, 0);
            foreGreenLine.Style = esriSimpleLineStyle.esriSLSSolid;

            IMultiLayerLineSymbol multiLayerLineSymbol = new MultiLayerLineSymbolClass();
            multiLayerLineSymbol.AddLayer(backBlackLine);
            multiLayerLineSymbol.AddLayer(foreGreenLine);
            ILineSymbol lineSymbol = (ILineSymbol)multiLayerLineSymbol;

            return lineSymbol;
        }
コード例 #5
0
        /// <summary>
        /// Draws the input geometry using the specified colors.
        /// </summary>
        /// <param name="geometry">The input IGeometry to draw. Supported geometry types are GeometryBag, Polygon, Polyline, Point and Multipoint.</param>
        /// <param name="fillColor">An IRgbColor reference for the fill color</param>
        /// <param name="lineColor">An IRgbColor reference for the line or outline color</param>
        /// <param name="display">An IDisplay reference</param>
        /// <param name="cancelTracker">An ITrackCancel reference</param>
        private static void DrawGeometry(IGeometry geometry, IRgbColor fillColor, IRgbColor lineColor, IDisplay display, ITrackCancel cancelTracker)
        {
            bool continueDrawing = true;
            switch (geometry.GeometryType)
            {
                case esriGeometryType.esriGeometryBag:
                    {
                        IEnumGeometry enumGeometry = (IEnumGeometry)geometry;
                        IGeometry innerGeometry = enumGeometry.Next();
                        while (innerGeometry != null && continueDrawing == true)
                        {
                            DrawGeometry(innerGeometry, fillColor, lineColor, display, cancelTracker); // Recursive method call
                            innerGeometry = enumGeometry.Next();
                            if (cancelTracker != null)
                            {
                                continueDrawing = cancelTracker.Continue();
                            }
                        }
                        break;
                    }
                case esriGeometryType.esriGeometryPolygon:
                    {
                        // Set the input polygon geometry's symbol.
                        ISimpleFillSymbol fillSymbol = new SimpleFillSymbolClass();
                        fillSymbol.Color = (IColor)fillColor;
                        ILineSymbol lineSymbol = new SimpleLineSymbolClass();
                        lineSymbol.Color = lineColor;
                        fillSymbol.Outline = lineSymbol;

                        // Draw the input polygon geometry.
                        display.SetSymbol((ISymbol)fillSymbol);
                        display.DrawPolygon(geometry);
                        break;
                    }
                case esriGeometryType.esriGeometryPolyline:
                    {
                        // Set the input polyline geometry's symbol.
                        IMultiLayerLineSymbol multiLineSymbol = new MultiLayerLineSymbolClass();
                        ISimpleLineSymbol simpleLineSymbol1 = new SimpleLineSymbolClass();
                        ISimpleLineSymbol simpleLineSymbol2 = new SimpleLineSymbolClass();
                        simpleLineSymbol1.Width = 3;
                        simpleLineSymbol1.Color = fillColor;
                        simpleLineSymbol2.Width = 5;
                        simpleLineSymbol2.Color = lineColor;
                        multiLineSymbol.AddLayer((ILineSymbol)simpleLineSymbol2);
                        multiLineSymbol.AddLayer((ILineSymbol)simpleLineSymbol1);

                        // Draw the input polyline geometry.
                        display.SetSymbol((ISymbol)multiLineSymbol);
                        display.DrawPolyline(geometry);
                        break;
                    }
                case esriGeometryType.esriGeometryPoint:
                    {
                        // Set the input point geometry's symbol.
                        ISimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbolClass();
                        simpleMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle;
                        simpleMarkerSymbol.Size = 12;
                        simpleMarkerSymbol.Color = fillColor;
                        simpleMarkerSymbol.Outline = true;
                        simpleMarkerSymbol.OutlineColor = lineColor;

                        // Draw the input point geometry.
                        display.SetSymbol((ISymbol)simpleMarkerSymbol);
                        display.DrawPoint(geometry);
                        break;
                    }
                case esriGeometryType.esriGeometryMultipoint:
                    {
                        // Set the input multipoint geometry's symbol.
                        ISimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbolClass();
                        simpleMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle;
                        simpleMarkerSymbol.Size = 8;
                        simpleMarkerSymbol.Color = fillColor;
                        simpleMarkerSymbol.Outline = true;
                        simpleMarkerSymbol.OutlineColor = lineColor;

                        // Draw the input multipoint geometry.
                        display.SetSymbol((ISymbol)simpleMarkerSymbol);
                        display.DrawMultipoint(geometry);
                        break;
                    }
            }
        }
コード例 #6
0
    private ISymbol CreateBikeRouteSymbol()
    {
        IColor color = (IColor)ESRI.ArcGIS.ADF.Connection.Local.Converter.ToRGBColor(Color.FromArgb(0, 90, 250));
      ICharacterMarkerSymbol charMarkerSymbol = new CharacterMarkerSymbolClass();
      charMarkerSymbol.Color = color;
      charMarkerSymbol.Font = ESRI.ArcGIS.ADF.Connection.Local.Converter.ToStdFont(new Font("ESRI Default Marker", 17.0f, FontStyle.Bold));
      charMarkerSymbol.CharacterIndex = 189;
      charMarkerSymbol.Size = 17;

      IMarkerLineSymbol markerLineSymbol = new MarkerLineSymbolClass();
      markerLineSymbol.Color = color;
      markerLineSymbol.Width = 17.0;
      markerLineSymbol.MarkerSymbol = (IMarkerSymbol)charMarkerSymbol;

      // Makes a new Cartographic Line symbol and sets its properties
      ICartographicLineSymbol cartographicLineSymbol = markerLineSymbol as ICartographicLineSymbol;

      // In order to set additional properties like offsets and dash patterns we must create an ILineProperties object
      ILineProperties lineProperties = cartographicLineSymbol as ILineProperties;
      lineProperties.Offset = 0;

      // Here's how to do a template for the pattern of marks and gaps
      double[] hpe = new double[4];
      hpe[0] = 0;
      hpe[1] = 39;
      hpe[2] = 1;
      hpe[3] = 0;

      ITemplate template = new TemplateClass();
      template.Interval = 1;
      for (int i = 0; i < hpe.Length; i = i + 2)
      {
        template.AddPatternElement(hpe[i], hpe[i + 1]);
      }
      lineProperties.Template = template;

      // Set the basic and cartographic line properties
      cartographicLineSymbol.Color = color;

      color = (IColor)ESRI.ArcGIS.ADF.Connection.Local.Converter.ToRGBColor(Color.FromArgb(0, 220, 100));

      // create a simple line
      ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbolClass();
      simpleLineSymbol.Color = color;
      simpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
      simpleLineSymbol.Width = 1.2;

      IMultiLayerLineSymbol multiLayerLineSymbol = new MultiLayerLineSymbolClass();
      multiLayerLineSymbol.AddLayer((ILineSymbol)cartographicLineSymbol);
      multiLayerLineSymbol.AddLayer((ILineSymbol)simpleLineSymbol);

      return multiLayerLineSymbol as ISymbol;
    }