Exemplo n.º 1
0
 public static ISimpleLineSymbol get_SimpleLineSymbol(IColor color, double width, esriSimpleLineStyle style)
 {
     ISimpleLineSymbol theReturn = new SimpleLineSymbolClass();
     theReturn.Color = color;
     theReturn.Style = style;
     theReturn.Width = width;
     return theReturn;
 }
Exemplo n.º 2
0
        public ISymbol GetSymbol(IFeature pFeature)
        {
            ISymbol pSymbol   = null;
            IColor  pColor    = new RgbColorClass();
            string  str_color = pFeature.get_Value(pFeature.Fields.FindField("颜色")) as string;

            if (" " == str_color)
            {
                str_color = "000000";
            }
            pColor.RGB = Convert.ToInt32(RGBconvert(str_color), 16);

            switch (pFeature.Shape.GeometryType)
            {
            case esriGeometryType.esriGeometryPoint:
                pSymbol = GetPointSymbol(pColor);
                break;

            case esriGeometryType.esriGeometryPolyline:
                string str_width  = pFeature.get_Value(pFeature.Fields.FindField("线宽")) as string;
                double width      = 0;
                char[] char_width = str_width.ToCharArray();
                if (1 < char_width.Count())
                {
                    char[] widthValue = new char[char_width.Count() - 1];
                    Array.ConstrainedCopy(char_width, 0, widthValue, 0, char_width.Count() - 1);

                    width = Convert.ToDouble(new string(widthValue));
                }
                else
                {
                    width = 0.25;
                }
                string str_LineStyle = pFeature.get_Value(pFeature.Fields.FindField("线型")) as string;
                if (" " == str_LineStyle)
                {
                    pSymbol = GetLineSymbol(pColor, esriSimpleLineStyle.esriSLSSolid, width);
                }
                else
                {
                    esriSimpleLineStyle LineStyle = esriSimpleLineStyle.esriSLSSolid;
                    try{
                        LineStyle = GetLineStyle(str_LineStyle);
                    }
                    catch {}
                    pSymbol = GetLineSymbol(pColor, LineStyle, width);
                }

                break;

            default:
                pSymbol = GetFillSymbol(pColor);
                break;
            }
            return(pSymbol);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取简单的线符号SimpleLineSymbol
        /// </summary>
        /// <param name="color">线条的颜色</param>
        /// <param name="lineWidth">线条的宽度</param>
        /// <param name="style">线条样式,默认为实线</param>
        /// <returns></returns>
        public static ISimpleLineSymbol GetSimpleLineSymbol(IColor color, double lineWidth = 1,
                                                            esriSimpleLineStyle style      = esriSimpleLineStyle.esriSLSSolid)
        {
            ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbol();

            simpleLineSymbol.Color = color ?? ColorCreate.GetIColor(128, 138, 135);
            simpleLineSymbol.Width = lineWidth;                        //设置线宽
            simpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid; //设置线型
            return(simpleLineSymbol);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 生成线符号
        /// </summary>
        /// <param name="color"></param>
        /// <param name="width"></param>
        /// <param name="style"></param>
        /// <returns></returns>
        public ISymbol CreateSimpleLineSymbol(Color color, int width, esriSimpleLineStyle style)
        {
            ISimpleLineSymbol pSimpleLineSymbol;

            pSimpleLineSymbol       = new SimpleLineSymbol();
            pSimpleLineSymbol.Width = width;
            pSimpleLineSymbol.Color = GetColor(color.R, color.G, color.B);
            pSimpleLineSymbol.Style = style;
            return((ISymbol)pSimpleLineSymbol);
        }
Exemplo n.º 5
0
        public static ILineSymbol CreateLineSymbol(IRgbColor color, double width, esriSimpleLineStyle estyle)
        {
            ISimpleLineSymbol pSymbol = new SimpleLineSymbolClass();

            pSymbol.Color = color as IColor;
            pSymbol.Width = width;
            pSymbol.Style = estyle;

            return(pSymbol);
        }
        private ISimpleLineSymbol GetSimpleLineSymbol(IRgbColor pRgbColor, double fdblWidth,
                                                      esriSimpleLineStyle pesriSimpleLineStyle)
        {
            ISimpleLineSymbol pSimpleLineSymbol = new SimpleLineSymbolClass();

            pSimpleLineSymbol.Color = pRgbColor as IColor;
            pSimpleLineSymbol.Width = fdblWidth;
            pSimpleLineSymbol.Style = pesriSimpleLineStyle;
            return(pSimpleLineSymbol);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 简单线
        /// </summary>
        /// <param name="width"></param>
        /// <param name="color"></param>
        /// <param name="style"></param>
        /// <returns></returns>
        private ILineSymbol DefineLineSymbol(double width, IColor color, esriSimpleLineStyle style)
        {
            ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbolClass();

            simpleLineSymbol.Width = width;
            simpleLineSymbol.Color = color;
            simpleLineSymbol.Style = style;
            ILineSymbol lineSymbol = (ILineSymbol)simpleLineSymbol;

            return(lineSymbol);
        }
Exemplo n.º 8
0
 public static IFillSymbol CreateFillSymbol(Color fillColor, esriSimpleFillStyle eFillStyle, Color outlineColor, double outlineWidth, esriSimpleLineStyle outlineStyle)
 {
     SimpleFillSymbolClass class2 = new SimpleFillSymbolClass();
     class2.Style = eFillStyle;
     class2.Color = ColorHelper.CreateColor(fillColor);
     ISimpleLineSymbol symbol = new SimpleLineSymbolClass();
     symbol.Style = outlineStyle;
     symbol.Color = ColorHelper.CreateColor(outlineColor);
     symbol.Width = outlineWidth;
     class2.Outline = symbol;
     return class2;
 }
Exemplo n.º 9
0
        public ISymbol GetLineSymbol(IColor pColor, esriSimpleLineStyle LineStyle, double width)
        {
            ISymbol           pSymbol;
            ISimpleLineSymbol pSymbolLineSymbol = new SimpleLineSymbolClass();

            pSymbolLineSymbol.Color = pColor;
            pSymbolLineSymbol.Width = width * 1;
            pSymbolLineSymbol.Style = LineStyle;

            pSymbol = pSymbolLineSymbol as ISymbol;
            return(pSymbol);
        }
 /// <summary>
 /// 初始化函数
 /// </summary>
 /// <param name="pstrLayerName">图层名称</param>
 /// <param name="pstrPath">保存路径</param>
 /// <param name="pesriGeometryType">图层类型</param>
 /// <remarks>If I have time, I will put the parameters of colors and width in one parameter!</remarks>
 public CSaveFeature(esriGeometryType pesriGeometryType, string pstrLayerName,
                     List <string> pstrFieldNameLt = null, List <esriFieldType> pesriFieldTypeLt = null,
                     int intRed        = 0, int intGreen = 0, int intBlue = 0, double dblWidth = 1,
                     int intOutlineRed = _intColor, int intOutlineGreen = _intColor, int intOutlineBlue = _intColor,
                     esriSimpleLineStyle pesriSimpleLineStyle = esriSimpleLineStyle.esriSLSSolid,
                     esriSimpleFillStyle pesriSimpleFillStyle = esriSimpleFillStyle.esriSFSSolid,
                     string strSymbolLayerPath = null, bool blnVisible = true)
 {
     this.pFeatureLayer = CreateFeatureLayer(pesriGeometryType, pstrLayerName, pstrFieldNameLt, pesriFieldTypeLt,
                                             intRed, intGreen, intBlue, dblWidth, intOutlineRed, intOutlineGreen, intOutlineBlue,
                                             pesriSimpleLineStyle, pesriSimpleFillStyle, strSymbolLayerPath, blnVisible);
 }
 public static IFeatureLayer SaveCEdgeEb(IEnumerable <CEdge> CGeoEb, string strFileName,
                                         List <string> pstrFieldNameLt = null, List <esriFieldType> pesriFieldTypeLt = null, List <List <object> > pobjectValueLtLt = null,
                                         int intRed = _intColor, int intGreen = _intColor, int intBlue = _intColor, double dblWidth = 1,
                                         esriSimpleLineStyle pesriSimpleLineStyle = esriSimpleLineStyle.esriSLSSolid,
                                         string strSymbolLayerPath = null, bool blnVisible = true)
 {
     return(SaveCGeoEb(CGeoEb, esriGeometryType.esriGeometryPolyline, strFileName,
                       pstrFieldNameLt, pesriFieldTypeLt, pobjectValueLtLt,
                       intRed, intGreen, intBlue, dblWidth, _intColor, _intColor, _intColor,
                       pesriSimpleLineStyle, esriSimpleFillStyle.esriSFSNull,
                       strSymbolLayerPath, blnVisible));
 }
Exemplo n.º 12
0
        /// <summary>
        /// 创建线要素样式
        /// </summary>
        /// <param name="color">颜色</param>
        /// <param name="width">宽度</param>
        /// <param name="style">样式</param>
        /// <returns>ISymbol</returns>
        public static ISymbol CreateSimpleLineSymbol(Color color, double width = 2, esriSimpleLineStyle style = esriSimpleLineStyle.esriSLSNull)
        {
            ISimpleLineSymbol pSimpleLineSymbol;

            pSimpleLineSymbol       = new SimpleLineSymbol();
            pSimpleLineSymbol.Width = width;
            pSimpleLineSymbol.Color = new RgbColor()
            {
                Red = color.R, Green = color.G, Blue = color.B, Transparency = color.A
            };
            pSimpleLineSymbol.Style = style;
            return((ISymbol)pSimpleLineSymbol);
        }
 public static IFeatureLayer SaveCpl(CPolyline Cpl, string strFileName,
                                     List <string> pstrFieldNameLt = null, List <esriFieldType> pesriFieldTypeLt = null, List <List <object> > pobjectValueLtLt = null,
                                     int intRed        = _intColor, int intGreen = _intColor, int intBlue = _intColor, double dblWidth = 1,
                                     int intOutlineRed = _intColor, int intOutlineGreen = _intColor, int intOutlineBlue = _intColor,
                                     esriSimpleLineStyle pesriSimpleLineStyle = esriSimpleLineStyle.esriSLSSolid,
                                     string strSymbolLayerPath = null, bool blnVisible = true)
 {
     return(SaveCGeoEb(CHelpFunc.MakeLt(Cpl), esriGeometryType.esriGeometryPolyline, strFileName,
                       pstrFieldNameLt, pesriFieldTypeLt, pobjectValueLtLt,
                       intRed, intGreen, intBlue, dblWidth, intOutlineRed, intOutlineGreen, intOutlineBlue,
                       pesriSimpleLineStyle, esriSimpleFillStyle.esriSFSSolid,
                       strSymbolLayerPath, blnVisible));
 }
Exemplo n.º 14
0
        public static ISimpleLineSymbol CreateSimpleLineSymbol(IRgbColor rgbColor, System.Double inWidth, esriSimpleLineStyle inStyle)
        {
            if (rgbColor == null)
            {
                return null;
            }

            ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbolClass();
            simpleLineSymbol.Style = inStyle;
            simpleLineSymbol.Color = rgbColor;
            simpleLineSymbol.Width = inWidth;

            return simpleLineSymbol;
        }
Exemplo n.º 15
0
        /// <summary>
        /// CreateSimpleLineSymbol
        /// </summary>
        /// <param name="color"></param>
        /// <param name="width"></param>
        /// <param name="style"></param>
        /// <returns>ISimpleLineSymbol</returns>
        public ISimpleLineSymbol CreateSimpleLineSymbol(IRgbColor color           = null,
                                                        double width              = 3,
                                                        esriSimpleLineStyle style = esriSimpleLineStyle.esriSLSDashDot)
        {
            ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbol();

            if (color == null)
            {
                color = getRGB(55, 66, 77) as IRgbColor;
            }
            simpleLineSymbol.Color = color;
            simpleLineSymbol.Width = width;
            simpleLineSymbol.Style = style;
            return(simpleLineSymbol);
        }
Exemplo n.º 16
0
        public static IFillSymbol CreateFillSymbol(Color fillColor, esriSimpleFillStyle eFillStyle, Color outlineColor,
                                                   double outlineWidth, esriSimpleLineStyle outlineStyle)
        {
            SimpleFillSymbol class2 = new SimpleFillSymbol();

            class2.Style = eFillStyle;
            class2.Color = ColorHelper.CreateColor(fillColor);
            ISimpleLineSymbol symbol = new SimpleLineSymbol();

            symbol.Style   = outlineStyle;
            symbol.Color   = ColorHelper.CreateColor(outlineColor);
            symbol.Width   = outlineWidth;
            class2.Outline = symbol;
            return(class2);
        }
        public static IFeatureLayer SavePathEbAsCplEb(IEnumerable <Path> PathEb, string strFileName,
                                                      List <string> pstrFieldNameLt = null, List <esriFieldType> pesriFieldTypeLt = null, List <List <object> > pobjectValueLtLt = null,
                                                      int intRed = _intColor, int intGreen = _intColor, int intBlue = _intColor, double dblWidth = 1,
                                                      esriSimpleLineStyle pesriSimpleLineStyle = esriSimpleLineStyle.esriSLSSolid,
                                                      string strSymbolLayerPath = null, bool blnVisible = true)
        {
            if (PathEb.GetEnumerator().MoveNext() == false)
            {
                return(null);
            }

            var           cpleb   = clipperMethods.ScaleCplEb(clipperMethods.ConvertPathsToCplEb(PathEb, false, true), 1 / CConstants.dblFclipper);
            IFeatureLayer pFLayer = SaveCplEb(cpleb, strFileName, pstrFieldNameLt, pesriFieldTypeLt, pobjectValueLtLt,
                                              intRed, intGreen, intBlue, dblWidth, _intColor, _intColor, _intColor, pesriSimpleLineStyle, strSymbolLayerPath, blnVisible);

            return(pFLayer);
        }
Exemplo n.º 18
0
        public static ISimpleFillSymbol CreateSimpleFillSymbol(IRgbColor fillColor, esriSimpleFillStyle fillStyle, IRgbColor borderColor, esriSimpleLineStyle borderStyle, System.Double borderWidth)
        {
            if (fillColor == null || fillStyle == null || borderColor == null || borderStyle == null)
            {
                return null;
            }
            ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbolClass();
            simpleLineSymbol.Width = borderWidth;
            simpleLineSymbol.Color = borderColor;
            simpleLineSymbol.Style = borderStyle;

            ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbolClass();
            simpleFillSymbol.Outline = simpleLineSymbol;
            simpleFillSymbol.Style = fillStyle;
            simpleFillSymbol.Color = fillColor;

            return simpleFillSymbol;
        }
        private IFeatureLayer CreateFeatureLayer(esriGeometryType pesriGeometryType, string pstrLayerName,
                                                 List <string> pstrFieldNameLt = null, List <esriFieldType> pesriFieldTypeLt = null,
                                                 int intRed        = _intColor, int intGreen = _intColor, int intBlue = _intColor, double dblWidth = 1,
                                                 int intOutlineRed = _intColor, int intOutlineGreen = _intColor, int intOutlineBlue = _intColor,
                                                 esriSimpleLineStyle pesriSimpleLineStyle = esriSimpleLineStyle.esriSLSSolid,
                                                 esriSimpleFillStyle pesriSimpleFillStyle = esriSimpleFillStyle.esriSFSSolid,
                                                 string strSymbolLayerPath = null, bool blnVisible = true)
        {
            var pWorkspace    = CConstants.ParameterInitialize.pWorkspace;
            var pm_mapControl = CConstants.ParameterInitialize.m_mapControl;

            pstrLayerName += CHelpFunc.GetTimeStampWithPrefix();
            IFeatureClass pFeatureClass = CreateFeatureClass(pesriGeometryType, pstrLayerName, pWorkspace, pm_mapControl,
                                                             pstrFieldNameLt, pesriFieldTypeLt);
            IFeatureLayer pFLayer = new FeatureLayerClass();

            pFLayer.FeatureClass     = pFeatureClass;
            pFLayer.Name             = pFeatureClass.AliasName;
            pFLayer.SpatialReference = pm_mapControl.SpatialReference;

            RenderLayer(ref pFLayer, pesriGeometryType, intRed, intGreen, intBlue, dblWidth,
                        intOutlineRed, intOutlineGreen, intOutlineBlue, pesriSimpleLineStyle, pesriSimpleFillStyle, strSymbolLayerPath);

            //save Layer as layer file ".lyr"
            //create a new LayerFile instance
            ILayerFile layerFile = new LayerFileClass();

            //create a new layer file
            layerFile.New(pWorkspace.PathName + "\\" + pstrLayerName + ".lyr");
            //attach the layer file with the actual layer
            layerFile.ReplaceContents((ILayer)pFLayer);
            //save the layer file
            layerFile.Save();


            //***********************************************是否添加到当前文档中来***********************************************//
            //m_mapControl.AddLayer(pFLayer,m_mapControl .LayerCount);
            pm_mapControl.AddLayer(pFLayer);
            pFLayer.Visible = blnVisible;
            pm_mapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
            return(pFLayer);
        }
        private IElement GetElement(IGeometry geometry, double width, esriSimpleLineStyle simpleLineStyle)
        {
            IElement element;

            ILineElement lineElement = new LineElementClass();
            element = lineElement as IElement;

            ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbolClass();
            simpleLineSymbol.Style = simpleLineStyle;
            simpleLineSymbol.Color = ColorSelection.GetColor();
            simpleLineSymbol.Width = width;

            element.Geometry = geometry;

            ILineSymbol lineSymbol = simpleLineSymbol as ILineSymbol;

            lineElement.Symbol = lineSymbol;

            return element;
        }
        public static IFeatureLayer SavePolyTreeAsCpgEb(PolyTree polytree, string strFileName,
                                                        List <string> pstrFieldNameLt = null, List <esriFieldType> pesriFieldTypeLt = null, List <List <object> > pobjectValueLtLt = null,
                                                        int intRed        = _intColor, int intGreen = _intColor, int intBlue = _intColor, double dblWidth = 1,
                                                        int intOutlineRed = _intColor, int intOutlineGreen = _intColor, int intOutlineBlue = _intColor,
                                                        esriSimpleLineStyle pesriSimpleLineStyle = esriSimpleLineStyle.esriSLSSolid,
                                                        esriSimpleFillStyle pesriSimpleFillStyle = esriSimpleFillStyle.esriSFSSolid,
                                                        string strSymbolLayerPath = null, bool blnVisible = true)
        {
            if (polytree.ChildCount == 0)
            {
                return(null);
            }

            var           cpgeb   = clipperMethods.ScaleCpgEb(clipperMethods.GenerateCpgEbByPolyTree(polytree), 1 / CConstants.dblFclipper);
            IFeatureLayer pFLayer = SaveCpgEb(cpgeb, strFileName, pstrFieldNameLt, pesriFieldTypeLt, pobjectValueLtLt,
                                              intRed, intGreen, intBlue, dblWidth, intOutlineRed, intOutlineGreen, intOutlineBlue,
                                              pesriSimpleLineStyle, pesriSimpleFillStyle, strSymbolLayerPath, blnVisible);

            return(pFLayer);
        }
        /// <summary>
        /// pstrFieldNameLt should not contain "FID" and "Shape", these two attributes will be generated automatically
        /// </summary>
        public static IFeatureLayer SaveCGeoEb <T>(IEnumerable <T> CGeoEb, esriGeometryType pesriGeometryType, string strFileName,
                                                   List <string> pstrFieldNameLt = null, List <esriFieldType> pesriFieldTypeLt = null, List <List <object> > pobjectValueLtLt = null,
                                                   int intRed        = _intColor, int intGreen = _intColor, int intBlue = _intColor, double dblWidth = 1,
                                                   int intOutlineRed = _intColor, int intOutlineGreen = _intColor, int intOutlineBlue = _intColor,
                                                   esriSimpleLineStyle pesriSimpleLineStyle = esriSimpleLineStyle.esriSLSSolid,
                                                   esriSimpleFillStyle pesriSimpleFillStyle = esriSimpleFillStyle.esriSFSSolid, string strSymbolLayerPath = null, bool blnVisible = true)
            where T : CGeoBase
        {
            if (CGeoEb.GetEnumerator().MoveNext() == false)
            {
                return(null);
            }

            CSaveFeature pSaveFeature = new CSaveFeature(pesriGeometryType, strFileName, pstrFieldNameLt, pesriFieldTypeLt,
                                                         intRed, intGreen, intBlue, dblWidth, intOutlineRed, intOutlineGreen, intOutlineBlue,
                                                         pesriSimpleLineStyle, pesriSimpleFillStyle, strSymbolLayerPath, blnVisible);
            IFeatureLayer pFLayer = pSaveFeature.SaveCGeosToLayer(CGeoEb, pstrFieldNameLt, pobjectValueLtLt);

            return(pFLayer);
        }
Exemplo n.º 23
0
        private IElement GetElement(IGeometry geometry, double width, esriSimpleLineStyle simpleLineStyle)
        {
            IElement element;

            ILineElement lineElement = new LineElementClass();

            element = lineElement as IElement;

            ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbolClass();

            simpleLineSymbol.Style = simpleLineStyle;
            simpleLineSymbol.Color = ColorSelection.GetColor();
            simpleLineSymbol.Width = width;

            element.Geometry = geometry;

            ILineSymbol lineSymbol = simpleLineSymbol as ILineSymbol;

            lineElement.Symbol = lineSymbol;

            return(element);
        }
Exemplo n.º 24
0
 /// <summary>
 /// 简单线
 /// </summary>
 /// <param name="width"></param>
 /// <param name="color"></param>
 /// <param name="style"></param>
 /// <returns></returns>
 private ILineSymbol DefineLineSymbol(double width, IColor color, esriSimpleLineStyle style)
 {
     ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbolClass();
     simpleLineSymbol.Width = width;
     simpleLineSymbol.Color = color;
     simpleLineSymbol.Style = style;
     ILineSymbol lineSymbol = (ILineSymbol)simpleLineSymbol;
     return lineSymbol;
 }
Exemplo n.º 25
0
 public static ILineSymbol CreateSimpleLineSymbol(Color lineColor, double width, esriSimpleLineStyle eStyle)
 {
     SimpleLineSymbolClass class2 = new SimpleLineSymbolClass();
     class2.Color = ColorHelper.CreateColor(lineColor);
     class2.Style = eStyle;
     class2.Width = Math.Abs(width);
     return class2;
 }
 public PolylineElement(IGeometry geometry, double width, esriSimpleLineStyle simpleLineStyle)
 {
     _element = GetElement(geometry, width, simpleLineStyle);
     _elementProperties = GetElementProperties();
 }
Exemplo n.º 27
0
 public SimpleLineSymbol(esriSimpleLineStyle style, System.Drawing.Color color, double width)
     : this(style, new RgbColor(color), width)
 {
 }
Exemplo n.º 28
0
 public SimpleLineSymbol(esriSimpleLineStyle style, Color color, double width)
 {
     Style = style;
     Color = color;
     Width = width;
 }
Exemplo n.º 29
0
 public PolylineElement(IGeometry geometry, double width, esriSimpleLineStyle simpleLineStyle)
 {
     _element           = GetElement(geometry, width, simpleLineStyle);
     _elementProperties = GetElementProperties();
 }
Exemplo n.º 30
0
 /// <summary>
 /// 获取简单的线符号SimpleLineSymbol
 /// </summary>
 /// <param name="rrggbbtt">线条的颜色字符串RRGGBB,如"ff0000"为红色</param>
 /// <param name="lineWidth">线条的宽度</param>
 /// <param name="style">线条样式,默认为实线</param>
 /// <returns></returns>
 public static ISimpleLineSymbol GetSimpleLineSymbol(string rrggbbtt, double lineWidth = 1,
                                                     esriSimpleLineStyle style         = esriSimpleLineStyle.esriSLSSolid)
 {
     return(GetSimpleLineSymbol(ColorCreate.GetIColor(rrggbbtt), lineWidth, style));
 }
Exemplo n.º 31
0
        public static ISimpleLineSymbol CreateSimpleLineSymbol(IColor color, float width, esriSimpleLineStyle linestyle)
        {
            ISimpleLineSymbol lineSymbol = new SimpleLineSymbol();

            lineSymbol.Color = color;
            lineSymbol.Style = linestyle;
            lineSymbol.Width = width;
            return(lineSymbol);
        }
Exemplo n.º 32
0
        public static ISimpleFillSymbol CreateSimpleBoundaryFillSymbol(IColor BouderyColor, float width, esriSimpleLineStyle linestyle)
        {
            ISimpleFillSymbol fillSymbol = new SimpleFillSymbol();

            fillSymbol.Style   = esriSimpleFillStyle.esriSFSNull;
            fillSymbol.Outline = CreateSimpleLineSymbol(BouderyColor, width, linestyle);
            return(fillSymbol);
        }
Exemplo n.º 33
0
        public static ILineSymbol CreateSimpleLineSymbol(Color lineColor, double width, esriSimpleLineStyle eStyle)
        {
            SimpleLineSymbolClass class2 = new SimpleLineSymbolClass();

            class2.Color = ColorHelper.CreateColor(lineColor);
            class2.Style = eStyle;
            class2.Width = Math.Abs(width);
            return(class2);
        }
        public void RenderLayer(ref IFeatureLayer fLayer, esriGeometryType fesriGeometryType,
                                int intRed, int intGreen, int intBlue, double fdblWidth, int intOutlineRed, int intOutlineGreen, int intOutlineBlue,
                                esriSimpleLineStyle pesriSimpleLineStyle, esriSimpleFillStyle pesriSimpleFillStyle, string strSymbolLayerPath)
        {
            if (strSymbolLayerPath == null)
            {
                IRgbColor       pRgbColor       = CHelpFunc.GenerateIRgbColor(intRed, intGreen, intBlue);
                ISimpleRenderer pSimpleRenderer = new SimpleRendererClass();

                switch (fesriGeometryType)
                {
                case esriGeometryType.esriGeometryPoint:
                    ISimpleMarkerSymbol pSimpleMarkerSymbol = new SimpleMarkerSymbolClass();
                    pSimpleMarkerSymbol.Color = pRgbColor as IColor;
                    pSimpleMarkerSymbol.Size  = fdblWidth;
                    pSimpleRenderer.Symbol    = pSimpleMarkerSymbol as ISymbol;
                    break;

                case esriGeometryType.esriGeometryPolyline:
                    pSimpleRenderer.Symbol = GetSimpleLineSymbol(pRgbColor, fdblWidth, pesriSimpleLineStyle) as ISymbol;
                    break;

                case esriGeometryType.esriGeometryPolygon:
                    IRgbColor pRgbColorOutline = new RgbColorClass();
                    pRgbColorOutline.Red   = intOutlineRed;
                    pRgbColorOutline.Green = intOutlineGreen;
                    pRgbColorOutline.Blue  = intOutlineBlue;

                    ISimpleFillSymbol pSimpleFillSymbol = new SimpleFillSymbolClass();
                    pSimpleFillSymbol.Outline = GetSimpleLineSymbol(pRgbColorOutline, fdblWidth, pesriSimpleLineStyle);
                    pSimpleFillSymbol.Color   = pRgbColor as IColor;
                    pSimpleFillSymbol.Style   = pesriSimpleFillStyle;
                    pSimpleRenderer.Symbol    = pSimpleFillSymbol as ISymbol;
                    break;

                default:
                    return;
                }
                //fLayer.
                IGeoFeatureLayer pGeoFeaturelayer = fLayer as IGeoFeatureLayer;
                pGeoFeaturelayer.Renderer = pSimpleRenderer as IFeatureRenderer;
            }
            else
            {
                //In the shapefile properties, under the Symbology tab,
                //you have the Import button which allow you to import the symbology definition from another shapefile or layer file.
                //The code below is doing exactly the same.
                //You need to create a layer file with the desired symbology definition and then call this sub.

                IGxLayer         pGxLayer;
                IGxFile          pGxFile;
                ILayer           pSymLayer;
                IGeoFeatureLayer pLyr;
                IGeoFeatureLayer pGeoSymLyr;

                pGxLayer = new GxLayer();
                pGxFile  = pGxLayer as IGxFile;

                pGxFile.Path = strSymbolLayerPath;

                pSymLayer     = pGxLayer.Layer;
                pLyr          = fLayer as IGeoFeatureLayer;
                pGeoSymLyr    = pSymLayer as IGeoFeatureLayer;
                pLyr.Renderer = pGeoSymLyr.Renderer;
            }
        }