public IGraphic newText(string text, IMapPoint p, Color color,
                                string fontName, double fontSize)
        {
            IS3TextSymbol textSymbol = new IS3TextSymbol();

            textSymbol.Text  = text;
            textSymbol.Color = color;

            IS3SymbolFont font = new IS3SymbolFont(fontName, fontSize);

            textSymbol.Font = font;

            IS3Graphic g = new IS3Graphic();

            g.Symbol   = textSymbol;
            g.Geometry = p;

            return(g);
        }
        public ISymbol newSymbol(SymbolDef symbolDef)
        {
            if (symbolDef == null)
            {
                return(null);
            }

            Type symbolType = symbolDef.GetType();

            if (symbolType == typeof(SimpleLineSymbolDef))
            {
                SimpleLineSymbolDef sDef   = (SimpleLineSymbolDef)symbolDef;
                IS3SimpleLineSymbol symbol = new IS3SimpleLineSymbol();
                symbol.Color = sDef.Color;
                symbol.Style = sDef.Style;
                symbol.Width = sDef.Width;
                return(symbol);
            }
            else if (symbolType == typeof(SimpleFillSymbolDef))
            {
                SimpleFillSymbolDef sDef   = (SimpleFillSymbolDef)symbolDef;
                IS3SimpleFillSymbol symbol = new IS3SimpleFillSymbol();
                symbol.Color   = sDef.Color;
                symbol.Style   = sDef.Style;
                symbol.Outline = (ISimpleLineSymbol)newSymbol(sDef.OutlineDef);
                return(symbol);
            }
            else if (symbolType == typeof(SimpleMarkerSymbolDef))
            {
                SimpleMarkerSymbolDef sDef   = (SimpleMarkerSymbolDef)symbolDef;
                IS3SimpleMarkerSymbol symbol = new IS3SimpleMarkerSymbol();
                symbol.Angle          = sDef.Angle;
                symbol.AngleAlignment = sDef.AngleAlignment;
                symbol.Color          = sDef.Color;
                symbol.Outline        = (ISimpleLineSymbol)newSymbol(sDef.OutlineDef);
                symbol.Size           = sDef.Size;
                symbol.Style          = sDef.Style;
                symbol.XOffset        = sDef.XOffset;
                symbol.YOffset        = sDef.YOffset;
                return(symbol);
            }
            else if (symbolType == typeof(TextSymbolDef))
            {
                TextSymbolDef sDef   = (TextSymbolDef)symbolDef;
                IS3TextSymbol symbol = new IS3TextSymbol();
                symbol.Angle                   = sDef.Angle;
                symbol.AngleAlignment          = sDef.AngleAlignment;
                symbol.BackgroundColor         = sDef.BackgroundColor;
                symbol.BorderLineColor         = sDef.BorderLineColor;
                symbol.BorderLineSize          = sDef.BorderLineSize;
                symbol.Color                   = sDef.Color;
                symbol.Text                    = sDef.Text;
                symbol.HorizontalTextAlignment = sDef.HorizontalTextAlignment;
                symbol.VerticalTextAlignment   = sDef.VerticalTextAlignment;
                symbol.Font                    = newSymbolFont(sDef.FontDef);
                symbol.XOffset                 = sDef.XOffset;
                symbol.YOffset                 = sDef.YOffset;
                return(symbol);
            }

            return(null);
        }
예제 #3
0
        public ISymbol newSymbol(SymbolDef symbolDef)
        {
            if (symbolDef == null)
                return null;

            Type symbolType = symbolDef.GetType();
            if (symbolType == typeof(SimpleLineSymbolDef))
            {
                SimpleLineSymbolDef sDef = (SimpleLineSymbolDef)symbolDef;
                IS3SimpleLineSymbol symbol = new IS3SimpleLineSymbol();
                symbol.Color = sDef.Color;
                symbol.Style = sDef.Style;
                symbol.Width = sDef.Width;
                return symbol;
            }
            else if (symbolType == typeof(SimpleFillSymbolDef))
            {
                SimpleFillSymbolDef sDef = (SimpleFillSymbolDef)symbolDef;
                IS3SimpleFillSymbol symbol = new IS3SimpleFillSymbol();
                symbol.Color = sDef.Color;
                symbol.Style = sDef.Style;
                symbol.Outline = (ISimpleLineSymbol) newSymbol(sDef.OutlineDef);
                return symbol;
            }
            else if (symbolType == typeof(SimpleMarkerSymbolDef))
            {
                SimpleMarkerSymbolDef sDef = (SimpleMarkerSymbolDef)symbolDef;
                IS3SimpleMarkerSymbol symbol = new IS3SimpleMarkerSymbol();
                symbol.Angle = sDef.Angle;
                symbol.AngleAlignment = sDef.AngleAlignment;
                symbol.Color = sDef.Color;
                symbol.Outline = (ISimpleLineSymbol)newSymbol(sDef.OutlineDef);
                symbol.Size = sDef.Size;
                symbol.Style = sDef.Style;
                symbol.XOffset = sDef.XOffset;
                symbol.YOffset = sDef.YOffset;
                return symbol;
            }
            else if (symbolType == typeof(TextSymbolDef))
            {
                TextSymbolDef sDef = (TextSymbolDef)symbolDef;
                IS3TextSymbol symbol = new IS3TextSymbol();
                symbol.Angle = sDef.Angle;
                symbol.AngleAlignment = sDef.AngleAlignment;
                symbol.BackgroundColor = sDef.BackgroundColor;
                symbol.BorderLineColor = sDef.BorderLineColor;
                symbol.BorderLineSize = sDef.BorderLineSize;
                symbol.Color = sDef.Color;
                symbol.Text = sDef.Text;
                symbol.HorizontalTextAlignment = sDef.HorizontalTextAlignment;
                symbol.VerticalTextAlignment = sDef.VerticalTextAlignment;
                symbol.Font = newSymbolFont(sDef.FontDef);
                symbol.XOffset = sDef.XOffset;
                symbol.YOffset = sDef.YOffset;
                return symbol;
            }

            return null;
        }
예제 #4
0
        public IGraphic newText(string text, IMapPoint p, Color color,
            string fontName, double fontSize)
        {
            IS3TextSymbol textSymbol = new IS3TextSymbol();
            textSymbol.Text = text;
            textSymbol.Color = color;

            IS3SymbolFont font = new IS3SymbolFont(fontName, fontSize);
            textSymbol.Font = font;

            IS3Graphic g = new IS3Graphic();
            
            g.Symbol = textSymbol;
            g.Geometry = p;

            return g;
        }
예제 #5
0
파일: IS3View.cs 프로젝트: iS3-Project/iS3
        // Summary:
        //     Generate a label attributes according to the definition
        //     which is specified in the LayerDef
        //
        AttributeLabelClass generateLayerAttributeLable(LayerDef layerDef,
            Core.Geometry.GeometryType geometryType)
        {
            if (layerDef == null)
                return generateDefaultLayerAttributeLable(geometryType);

            IS3SymbolFont font = new IS3SymbolFont(
                layerDef.LabelFontFamily, layerDef.LabelFontSize);
            font.FontStyle = layerDef.LabelFontStyle;
            font.FontWeight = layerDef.LabelFontWeight;
            font.TextDecoration = layerDef.LabelTextDecoration;

            IS3TextSymbol textSymbol = new IS3TextSymbol();
            textSymbol.Color = layerDef.LabelColor;
            textSymbol.Font = font;
            textSymbol.BorderLineColor = layerDef.LabelBorderLineColor;
            textSymbol.BorderLineSize = layerDef.LabelBorderLineWidth;
            textSymbol.BackgroundColor = layerDef.LabelBackgroundColor;

            AttributeLabelClass labelClass = new AttributeLabelClass();
            labelClass.IsVisible = true;
            labelClass.TextExpression = layerDef.LabelTextExpression;
            labelClass.WhereClause = layerDef.LabelWhereClause;
            labelClass.Symbol = textSymbol;

            if (geometryType == Core.Geometry.GeometryType.Polygon)
                labelClass.LabelPlacement = LabelPlacement.PolygonAlwaysHorizontal;

            return labelClass;
        }
예제 #6
0
파일: IS3View.cs 프로젝트: iS3-Project/iS3
        // Summary:
        //     Generate a default label attributes according to the GeometryType
        //     The default labelling property of a feature is [Name]
        //
        AttributeLabelClass generateDefaultLayerAttributeLable(Core.Geometry.GeometryType geometryType)
        {
            IS3TextSymbol textSymbol = new IS3TextSymbol();
            textSymbol.Color = System.Windows.Media.Colors.Black;

            AttributeLabelClass labelClass = new AttributeLabelClass();
            labelClass.IsVisible = true;
            labelClass.TextExpression = "[Name]";
            labelClass.Symbol = textSymbol;

            if (geometryType == Core.Geometry.GeometryType.Polygon)
                labelClass.LabelPlacement = LabelPlacement.PolygonAlwaysHorizontal;

            return labelClass;
        }