コード例 #1
0
ファイル: LineSymbol.cs プロジェクト: configare/hispeed
        public static IFillLineSymbol FromXElement(XElement ele)
        {
            if (ele == null)
            {
                return(null);
            }
            Color           outlinecolor = ColorHelper.StringToColor(ele.Attribute("outlinecolor").Value);
            Color           fillcolor    = ColorHelper.StringToColor(ele.Attribute("fillcolor").Value);
            int             outlinewidth = int.Parse(ele.Attribute("outlinewidth").Value);
            float           width        = float.Parse(ele.Attribute("width").Value);
            IFillLineSymbol sym          = new FillLineSymbol();

            sym.OutlineColor = outlinecolor;
            sym.FillColor    = fillcolor;
            sym.OutlineWidth = outlinewidth;
            sym.Width        = width;
            //
            if (ele.Attribute("smoothingmode") != null)
            {
                string s = ele.Attribute("smoothingmode").Value;
                foreach (SmoothingMode sm in Enum.GetValues(typeof(SmoothingMode)))
                {
                    if (sm.ToString() == s)
                    {
                        sym.SmoothingMode = sm;
                        break;
                    }
                }
            }
            //
            return(sym);
        }
コード例 #2
0
        protected override void SetLayerAfter()
        {
            if (_layer == null)
            {
                return;
            }
            ISymbol _symbol = null;

            if (_layer.Renderer is SimpleTwoStepFeatureRenderer)
            {
                _symbol = (_layer.Renderer as SimpleTwoStepFeatureRenderer).Symbol;
            }
            if (_symbol == null || _symbol is ICompositeSymbol)
            {
                IFeatureClass fetclass = _layer.Class as IFeatureClass;
                switch (fetclass.ShapeType)
                {
                case enumShapeType.Point:
                    _symbol = new SimpleMarkerSymbol();
                    break;

                case enumShapeType.Polyline:
                    _symbol = new FillLineSymbol();
                    break;

                case enumShapeType.Polygon:
                    _symbol = new SimpleFillSymbol();
                    break;

                default:
                    _symbol = null;
                    break;
                }
            }
            if (_layer.Renderer != null)
            {
                _layer.Renderer.Dispose();
            }
            _layer.Renderer = new SimpleTwoStepFeatureRenderer(_symbol);
            if (_layer.Renderer != null)
            {
                propertyGrid1.SelectedObject = _layer.Renderer;
            }
        }