Example #1
0
        /// <summary>
        /// 简单渲染
        /// </summary>
        /// <param name="layerName">图层名字</param>
        /// <param name="FillStyle">FillStyle</param>
        /// <param name="pColor">FillColor</param>
        /// <param name="OutLineColor">OutLineColor</param>
        /// <param name="RenderLabel">样式名称注释</param>
        /// <param name="Descripition">描述</param>
        public void createSimpleFillSymbol(string layerName, esriSimpleFillStyle FillStyle, IColor pColor, IColor OutLineColor, string RenderLabel, string Descripition)
        {
            //简单填充符号
            ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbolClass();
            //可以用符号选择器进行
            simpleFillSymbol.Style = FillStyle;
            simpleFillSymbol.Color = pColor;
            //创建边线符号
            ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbolClass();
            simpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
            simpleLineSymbol.Color = OutLineColor;
            ISymbol symbol = simpleLineSymbol as ISymbol;
            symbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen;
            simpleFillSymbol.Outline = simpleLineSymbol;

            ISimpleRenderer simpleRender = new SimpleRendererClass();
            simpleRender.Symbol = simpleFillSymbol as ISymbol;
            simpleRender.Label = RenderLabel;
            simpleRender.Description = Descripition;

            IGeoFeatureLayer geoFeatureLayer;
            geoFeatureLayer = getGeoLayer(layerName);
            if (geoFeatureLayer != null)
            {
                geoFeatureLayer.Renderer = simpleRender as IFeatureRenderer;
            }
        }
Example #2
0
 public static ISimpleFillSymbol get_SimplePolygonSymbol(IColor color, esriSimpleFillStyle style, ILineSymbol outline)
 {
     ISimpleFillSymbol theReturn = new SimpleFillSymbolClass();
     theReturn.Color = color;
     theReturn.Style = style;
     theReturn.Outline = outline;
     return theReturn;
 }
 public static IFillSymbol CreateFillSymbol(Color fillColor, esriSimpleFillStyle eFillStyle, ISimpleLineSymbol aOutline)
 {
     SimpleFillSymbolClass class2 = new SimpleFillSymbolClass();
     class2.Style = eFillStyle;
     class2.Color = ColorHelper.CreateColor(fillColor);
     class2.Outline = aOutline;
     return class2;
 }
Example #4
0
        public static IFillSymbol CreateFillSymbol(Color fillColor, esriSimpleFillStyle eFillStyle, ISimpleLineSymbol aOutline)
        {
            SimpleFillSymbolClass class2 = new SimpleFillSymbolClass();

            class2.Style   = eFillStyle;
            class2.Color   = ColorHelper.CreateColor(fillColor);
            class2.Outline = aOutline;
            return(class2);
        }
Example #5
0
        public static IFillSymbol CreateFillSymbol(IRgbColor color, esriSimpleFillStyle estyle)
        {
            ISimpleFillSymbol pSymbol = new SimpleFillSymbolClass();

            pSymbol.Color = color as IColor;
            pSymbol.Style = estyle;
            //outline的样式可以从线样式获取
            return(pSymbol);
        }
Example #6
0
        /// <summary>
        /// 生成面符号
        /// </summary>
        /// <param name="fillColor"></param>
        /// <param name="oLineWidth"></param>
        /// <param name="fillStyle"></param>
        /// <returns></returns>
        public ISymbol CreateSimpleFillSymbol(Color fillColor, int oLineWidth, esriSimpleFillStyle fillStyle)
        {
            ISimpleFillSymbol pSimpleFillSymbol;

            pSimpleFillSymbol         = new SimpleFillSymbol();
            pSimpleFillSymbol.Style   = fillStyle;
            pSimpleFillSymbol.Color   = GetColor(fillColor.R, fillColor.G, fillColor.B);
            pSimpleFillSymbol.Outline = (ILineSymbol)CreateSimpleLineSymbol(fillColor, oLineWidth, esriSimpleLineStyle.esriSLSSolid);
            return((ISymbol)pSimpleFillSymbol);
        }
Example #7
0
        /// <summary>
        /// 获取简单的填充符号ISimpleFillSymbol
        /// </summary>
        /// <param name="fillColor">填充色</param>
        /// <param name="lineColor">边线色</param>
        /// <param name="lineWidth">边线的宽度</param>
        /// <param name="style">填充样式,默认为实心填充</param>
        /// <returns></returns>
        public static ISimpleFillSymbol GetSimpleFillSymbol(IColor fillColor, IColor lineColor = null,
                                                            double lineWidth = 1, esriSimpleFillStyle style = esriSimpleFillStyle.esriSFSSolid)
        {
            ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbol();

            simpleFillSymbol.Outline = GetSimpleLineSymbol(lineColor, lineWidth); //外边线
            simpleFillSymbol.Color   = fillColor;                                 //设置填充色
            simpleFillSymbol.Style   = style;                                     //设置填充方式
            return(simpleFillSymbol);
        }
Example #8
0
 /// <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,
                     esriSimpleFillStyle pesriSimpleFillStyle = esriSimpleFillStyle.esriSFSSolid,
                     string strSymbolLayerPath = null, bool blnVisible = true)
 {
     this.pFeatureLayer = CreateFeatureLayer(pesriGeometryType, pstrLayerName, pstrFieldNameLt, pesriFieldTypeLt,
                                             intRed, intGreen, intBlue, dblWidth,
                                             intOutlineRed, intOutlineGreen, intOutlineBlue, pesriSimpleFillStyle, strSymbolLayerPath, blnVisible);
 }
Example #9
0
        /// <summary>
        /// 简单面
        /// </summary>
        /// <param name="color"></param>
        /// <param name="style"></param>
        /// <param name="outLineSymbol"></param>
        /// <returns></returns>
        private IFillSymbol DefineFillSymbol(IColor color, esriSimpleFillStyle style, ILineSymbol outLineSymbol)
        {
            ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbolClass();

            simpleFillSymbol.Color   = color;                                      //定义面符号颜色
            simpleFillSymbol.Style   = style;                                      //定义面符号样式
            simpleFillSymbol.Outline = outLineSymbol;                              //定义面符号边线
            IFillSymbol fillSymbol = (IFillSymbol)simpleFillSymbol;

            return(fillSymbol);
        }
Example #10
0
 public static IFeatureLayer SaveCpgEb(IEnumerable <CPolygon> CpgEb, 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,
                                       esriSimpleFillStyle pesriSimpleFillStyle = esriSimpleFillStyle.esriSFSSolid, string strSymbolLayerPath = null, bool blnVisible = true)
 {
     return(SaveCGeoEb(CpgEb, esriGeometryType.esriGeometryPolygon, strFileName,
                       pstrFieldNameLt, pesriFieldTypeLt, pobjectValueLtLt,
                       intRed, intGreen, intBlue, dblWidth, intOutlineRed, intOutlineGreen, intOutlineBlue,
                       pesriSimpleFillStyle, strSymbolLayerPath, blnVisible));
 }
Example #11
0
        public static ISymbol CreateLineFillSymbol(Color fillColor, int oLineWidth, esriSimpleFillStyle fillStyle)
        {
            ILineFillSymbol pLineFillSymbol;

            pLineFillSymbol            = new LineFillSymbol();
            pLineFillSymbol.LineSymbol = (ILineSymbol)CreateSimpleLineSymbol(Color.Yellow, 1, esriSimpleLineStyle.esriSLSSolid);
            pLineFillSymbol.Separation = 5;
            pLineFillSymbol.Color      = GetColor(fillColor.R, fillColor.G, fillColor.B);
            pLineFillSymbol.Outline    = (ILineSymbol)CreateSimpleLineSymbol(fillColor, 2, esriSimpleLineStyle.esriSLSSolid);

            return((ISymbol)pLineFillSymbol);
        }
 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;
 }
Example #13
0
        /// <summary>
        /// 创建面要素样式
        /// </summary>
        /// <param name="fillColor">填充颜色</param>
        /// <param name="fillStyle">填充样式</param>
        /// <param name="lineSymbol">线样式</param>
        /// <returns>ISymbol</returns>
        public static ISymbol CreateSimpleFillSymbol(Color fillColor, esriSimpleFillStyle fillStyle = esriSimpleFillStyle.esriSFSBackwardDiagonal)
        {
            ISimpleFillSymbol pSimpleFillSymbol;

            pSimpleFillSymbol       = new SimpleFillSymbol();
            pSimpleFillSymbol.Style = fillStyle;
            pSimpleFillSymbol.Color = new RgbColor()
            {
                Red = fillColor.R, Green = fillColor.G, Blue = fillColor.B, Transparency = fillColor.A
            };
            pSimpleFillSymbol.Outline = (ILineSymbol)CreateSimpleLineSymbol(Color.Red, 1.5, esriSimpleLineStyle.esriSLSSolid);
            return((ISymbol)pSimpleFillSymbol);
        }
Example #14
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);
        }
Example #15
0
        // 符号化可见范围
        private void Symbology(IFeatureLayer featureLayer, esriSimpleFillStyle style, int i)
        {
            featureLayer.Name = i + "号观测预设点可见范围";
            ISymbol pSymbol = new SimpleFillSymbolClass()
            {
                Style = style,
                Color = GetRgbColor(0, 0, 0)
            };

            (featureLayer as IGeoFeatureLayer).Renderer = new SimpleRendererClass()
            {
                Symbol = pSymbol
            };
            axTOCControl_main.Update();
        }
Example #16
0
        private void InitControl()
        {
            this.m_CanDo                  = false;
            this.btnOutline.Style         = this.m_SimpleFillSymbol.Outline;
            this.numericUpDownWidth.Value = (decimal)(this.m_SimpleFillSymbol.Outline.Width * this.m_unit);
            this.SetColorEdit(this.colorEdit1, this.m_SimpleFillSymbol.Color);
            this.SetColorEdit(this.colorEditOutline, this.m_SimpleFillSymbol.Outline.Color);
            this.cboStyle.SelectedIndex = (int)this.m_SimpleFillSymbol.Style;
            esriSimpleFillStyle style = this.m_SimpleFillSymbol.Style;

            if ((style == esriSimpleFillStyle.esriSFSNull ? true : style == esriSimpleFillStyle.esriSFSNull))
            {
                this.colorEdit1.Enabled = false;
            }
            this.m_CanDo = true;
            this.m_CanDo = true;
        }
Example #17
0
        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,
                                                        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,
                                              pesriSimpleFillStyle, strSymbolLayerPath, blnVisible);

            return(pFLayer);
        }
Example #18
0
        public static IFeatureLayer SavePathEbAsCpgEb(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,
                                                      int intOutlineRed = _intColor, int intOutlineGreen = _intColor, int intOutlineBlue = _intColor,
                                                      esriSimpleFillStyle pesriSimpleFillStyle = esriSimpleFillStyle.esriSFSSolid, string strSymbolLayerPath = null, bool blnVisible = true)
        {
            if (PathEb.GetEnumerator().MoveNext() == false)
            {
                return(null);
            }

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

            return(pFLayer);
        }
Example #19
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;
        }
Example #20
0
        public static IFeatureLayer SaveIGeoEb <T>(IEnumerable <T> IGeoEb, 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,
                                                   esriSimpleFillStyle pesriSimpleFillStyle = esriSimpleFillStyle.esriSFSSolid, string strSymbolLayerPath = null, bool blnVisible = true)
            where T : IGeometry
        {
            if (IGeoEb.GetEnumerator().MoveNext() == false)
            {
                return(null);
            }

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

            return(pFLayer);
        }
Example #21
0
        /// <summary>
        /// CreateSimpleFillSymbol
        /// </summary>
        /// <param name="color">color</param>
        /// <param name="outline">outline</param>
        /// <param name="style">style</param>
        /// <returns>IFillSymbol</returns>
        public IFillSymbol CreateSimpleFillSymbol(IRgbColor color           = null,
                                                  ILineSymbol outline       = null,
                                                  esriSimpleFillStyle style = esriSimpleFillStyle.esriSFSCross)
        {
            ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbol();

            if (color == null)
            {
                color = getRGB(63, 99, 150) as IRgbColor;
            }
            if (outline == null)
            {
                outline = CreateSimpleLineSymbol(getRGB(99, 99, 240) as IRgbColor, 2);
            }
            simpleFillSymbol.Style   = style;
            simpleFillSymbol.Color   = color;
            simpleFillSymbol.Outline = outline;
            return(simpleFillSymbol);
        }
        private IElement GetElement(IGeometry geometry, esriSimpleFillStyle simpleFillStyle)
        {
            IElement element;

            IPolygonElement polygonElement = new PolygonElementClass();
            element = polygonElement as IElement;

            IFillShapeElement fillShapeElement = polygonElement as IFillShapeElement;

            ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbolClass();
            simpleFillSymbol.Style = simpleFillStyle;
            simpleFillSymbol.Color = ColorSelection.GetColor();

            element.Geometry = geometry;

            fillShapeElement.Symbol = simpleFillSymbol;

            return element;
        }
        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);
        }
        /// <summary>
        ///  单一值渲染(多字段)
        /// </summary>
        /// <param name="layerName">图层名</param>
        /// <param name="RenderField">多字段名</param>
        /// <param name="FillStyle">样式</param>
        /// <param name="valueCount">每个字段中唯一值的个数</param>
        public void CreateUniqueValueRander(ILayer pLayer, string[] RenderField, esriSimpleFillStyle FillStyle,
                                            int[] valueCount)
        {
            IGeoFeatureLayer geoFeatureLayer;

            geoFeatureLayer = pLayer as IGeoFeatureLayer;
            IUniqueValueRenderer uniqueValueRenderer = new UniqueValueRenderer();

            //可以设置多个字段
            uniqueValueRenderer.FieldCount = RenderField.Length; //0-3个
            for (int i = 0; i < RenderField.Length; i++)
            {
                uniqueValueRenderer.set_Field(i, RenderField[i]);
            }

            //简单填充符号
            ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbol();

            simpleFillSymbol.Style = FillStyle;

            IFeatureCursor featureCursor = geoFeatureLayer.FeatureClass.Search(null, false);
            IFeature       feature;

            if (featureCursor != null)
            {
                for (int i = 0; i < RenderField.Length; i++)
                {
                    IEnumColors enumColors = CreateAlgorithmicColorRamp();
                    int         fieldIndex = geoFeatureLayer.FeatureClass.Fields.FindField(RenderField[i]);
                    for (int j = 0; j < valueCount[i]; j++)
                    {
                        feature = featureCursor.NextFeature();
                        string nameValue = feature.get_Value(fieldIndex).ToString();
                        simpleFillSymbol       = new SimpleFillSymbol();
                        simpleFillSymbol.Color = enumColors.Next();
                        uniqueValueRenderer.AddValue(nameValue, RenderField[i], simpleFillSymbol as ISymbol);
                    }
                }
            }
            geoFeatureLayer.Renderer = uniqueValueRenderer as IFeatureRenderer;
        }
        private IElement GetElement(IGeometry geometry, esriSimpleFillStyle simpleFillStyle)
        {
            IElement element;

            IPolygonElement polygonElement = new PolygonElementClass();

            element = polygonElement as IElement;

            IFillShapeElement fillShapeElement = polygonElement as IFillShapeElement;

            ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbolClass();

            simpleFillSymbol.Style = simpleFillStyle;
            simpleFillSymbol.Color = ColorSelection.GetColor();

            element.Geometry = geometry;

            fillShapeElement.Symbol = simpleFillSymbol;

            return(element);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="pLayer"></param>
        /// <param name="fillStyle"></param>
        /// <param name="lineColor"></param>
        public void SetStyleHasNoOutLine(ILayer pLayer, esriSimpleFillStyle fillStyle, IRgbColor lineColor)
        {
            IGeoFeatureLayer pGeoFeatureLayer = pLayer as IGeoFeatureLayer;
            ISimpleRenderer  pSimpleRender    = new SimpleRenderer();
            IRgbColor        fillCr           = new RgbColor();

            fillCr.Red       = 189;
            fillCr.Green     = 189;
            fillCr.Blue      = 197;
            fillCr.NullColor = true;
            ISimpleLineSymbol pSimpleLineSymbol = new SimpleLineSymbol();

            pSimpleLineSymbol.Width = 1;
            pSimpleLineSymbol.Color = fillCr;
            ISimpleFillSymbol pSimpleFillSysmbol = new SimpleFillSymbol();

            pSimpleFillSysmbol.Style   = fillStyle;
            pSimpleFillSysmbol.Outline = pSimpleLineSymbol;
            pSimpleFillSysmbol.Color   = lineColor;
            pSimpleRender.Symbol       = pSimpleFillSysmbol as ISymbol;
            pGeoFeatureLayer.Renderer  = pSimpleRender as IFeatureRenderer;
            _mxDocument.ActiveView.Refresh();
            _mxDocument.CurrentContentsView.Refresh(null);
        }
Example #27
0
 public SimpleFillSymbol(esriSimpleFillStyle style, Color color)
 {
     Style = style;
     Color = color;
 }
Example #28
0
 public SimpleFillSymbol(esriSimpleFillStyle style, System.Drawing.Color color)
     : this(style, new RgbColor(color))
 {
 }
Example #29
0
 public SimpleFillSymbol(esriSimpleFillStyle style, Color color, LineSymbol outline)
 {
     Style   = style;
     Color   = color;
     Outline = outline;
 }
Example #30
0
 public SimpleFillSymbol(esriSimpleFillStyle style, System.Drawing.Color color, LineSymbol outline)
     : this(style, new RgbColor(color), outline)
 {
 }
Example #31
0
 /// <summary>
 /// 获取简单的填充符号ISimpleFillSymbol
 /// </summary>
 /// <param name="fillColorRrggbbtt">填充色,6位颜色值RRGGBB,如"ff0000"为红色;
 /// 或8位颜色值RRGGBBTT,如"ff0000ff"为红色不透明(最后两位00表示透明,ff表示不透明)</param>
 /// <param name="lineColorRrggbbtt">边线色,6位颜色值RRGGBB,如"ff0000"为红色;
 /// 或8位颜色值RRGGBBTT,如"ff0000ff"为红色不透明(最后两位00表示透明,ff表示不透明)</param>
 /// <param name="lineWidth">边线的宽度</param>
 /// <returns></returns>
 public static ISimpleFillSymbol GetSimpleFillSymbol(string fillColorRrggbbtt, string lineColorRrggbbtt, double lineWidth = 1, esriSimpleFillStyle style = esriSimpleFillStyle.esriSFSSolid)
 {
     return(GetSimpleFillSymbol(ColorCreate.GetIColor(fillColorRrggbbtt), ColorCreate.GetIColor(lineColorRrggbbtt), lineWidth, style));
 }
        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;
            }
        }
Example #33
0
 /// <summary>
 /// Generates a simple fill symbol of specific color and specific fill style.
 /// </summary>
 /// <param name="colorName">The fill color.</param>
 /// <param name="style">The fill style.</param>
 /// <returns>Returns the simple fill symbol.</returns>
 public static ISimpleFillSymbol GenerateGenericFillSymbol(string colorName, esriSimpleFillStyle style)
 {
     ISimpleFillSymbol sFs = new SimpleFillSymbolClass();
     try
     {
         if (string.IsNullOrEmpty(colorName))
             sFs.Color = GenerateColor();
         else
             sFs.Color = GenerateColor(colorName) as IColor;
         sFs.Style = style;
         ((ISymbol)sFs).ROP2 = esriRasterOpCode.esriROPNotXOrPen;
     }
     catch (Exception e)
     {
         //_logger.LogException(e, "An error occurred creating fill symbol in: " + methodName);
     }
     // _logger.Exit(methodName);
     return sFs;
 }
 public PolygonElement(IGeometry geometry, esriSimpleFillStyle simpleFillStyle)
 {
     _element = GetElement(geometry, simpleFillStyle);
     _elementProperties = GetElementProperties();
 }
Example #35
0
        /// <summary>
        /// 简单面
        /// </summary>
        /// <param name="color"></param>
        /// <param name="style"></param>
        /// <param name="outLineSymbol"></param>
        /// <returns></returns>
        private IFillSymbol DefineFillSymbol(IColor color, esriSimpleFillStyle style, ILineSymbol outLineSymbol)
        {
            ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbolClass();
            simpleFillSymbol.Color = color;                                        //定义面符号颜色
            simpleFillSymbol.Style = style;                                        //定义面符号样式
            simpleFillSymbol.Outline = outLineSymbol;                              //定义面符号边线
            IFillSymbol fillSymbol = (IFillSymbol)simpleFillSymbol;

            return fillSymbol;
        }
 public PolygonElement(IGeometry geometry, esriSimpleFillStyle simpleFillStyle)
 {
     _element           = GetElement(geometry, simpleFillStyle);
     _elementProperties = GetElementProperties();
 }