示例#1
0
        public void SetUp()
        {
            MapSerializer ms = new MapSerializer();
            ms.AddDatabaseFeatureSourceType<DummyDBProvider>();
            ms.AddFileFeatureSourceType<DummyFileProvider>();

            m1 = new Map();
            m1.Extents = new Rectangle(0,0,10,10);
            m1.Height = 123;
            m1.Width = 321;
            m1.Projection = "+init=epsg:4326";
            m1.BackgroundColor = Color.FromArgb(4,3,2,1);

            Layer l1 = new Layer();
            l1.Id = "l1";
            DummyDBProvider db = new DummyDBProvider();
            l1.Data = db;
            l1.Projection = "+init=epsg:2236";
            l1.Theme = ThemeType.NumericRange;
            l1.ThemeField = "MyField";
            l1.LabelField = "MyLabelField";
            l1.Visible = false;
            l1.MinScale = 99;
            l1.MaxScale = 88;
            l1.AllowDuplicateLabels = false;

            db.ConnectionString = "MyConnString";
            db.ForcedFeatureType = FeatureType.Polyline;
            db.ForcedSpatialType = SpatialType.Geographic;
            db.ForcedSrid = 1234;
            db.TableName = "MyTable";
            db.ForcedGeometryColumn = "MyGeoColumn";

            Style s1 = new Style();
            s1.Id = "MyStyle";
            s1.LineColor = Color.FromArgb(255, 180, 34, 34);
            s1.LineStyle = LineStyle.Dashed;
            s1.LineWidth = 23;
            s1.PointSize = 4;
            s1.PointSymbol = PointSymbolType.Image;
            s1.PointSymbolShape = PointSymbolShapeType.Square;
            s1.UniqueThemeValue = "MyValue";
            s1.MaxRangeThemeValue = 30000;
            s1.MinRangeThemeValue = 4;
            s1.FillStyle = FillStyle.None;
            s1.ShowLabels = true;
            s1.LabelColor = Color.FromArgb(0,1,2,3);
            s1.LabelFont = LabelFont.SansSerif;
            s1.LabelFontEmSize = 1234;
            s1.LabelPosition = LabelPosition.BottomLeft;
            s1.LabelPixelOffset = 42;
            s1.LabelDecoration = LabelDecoration.Outline;
            s1.LabelOutlineColor = Color.FromArgb(9,9,9,9);
            s1.LabelOutlineWidth = 99f;
            s1.LabelAngle = 45f;
            s1.LabelCustomFont = "font";

            s1.MinScale = 0;
            s1.MaxScale = 1;
            s1.LabelMinScale = 10;
            s1.LabelMaxScale = 100;
            s1.DrawPointSymbolOnPolyLine = true;
            s1.CalculateLabelAngleForPolyLine = false;
            s1.FillTexturePath = "../../../Cumberland.Tests/maps/images/swamps.png";

            s1.Simplify = true;
            s1.SimplifyTolerance = 99;

            s1.UniqueElseFlag = true;

            l1.Styles.Add(s1);

            m1.Layers.Add(l1);

            Layer l2 = new Layer();
            l2.Id = "l2";
            l2.Data = new DummyFileProvider();
            m1.Layers.Add(l2);

            string s = MapSerializer.Serialize(m1);

            m2 = ms.Deserialize(new MemoryStream(UTF8Encoding.UTF8.GetBytes((s))));
        }