void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     //System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() =>
     //{
     MapParameter defaultMapParameter = e.Result as MapParameter;
     this.Bounds = new Rectangle2D(defaultMapParameter.Bounds);
     this.MapName = defaultMapParameter.Name;
     this.ViewBounds = new Rectangle2D(defaultMapParameter.ViewBounds);
     this.Origin = new Point2D(Bounds.LeftBottom.X, Bounds.RightTop.Y);
     this.Scale = defaultMapParameter.Scale;
     this.TileSize = 256;
     this._referScale = defaultMapParameter.Scale;
     this._referViewBounds = new Rectangle2D(defaultMapParameter.ViewBounds);
     this._referViewer = new Utility.Rectangle(defaultMapParameter.Viewer);
     this._referResolution = (defaultMapParameter.ViewBounds.RightTop.X - defaultMapParameter.ViewBounds.LeftBottom.X) / defaultMapParameter.Viewer.Width;
     this.IsInitialized = true;
     this.IsInitializing = false;
     this.OnInitialized();
     //});
 }
Esempio n. 2
0
        public void GetMapImage()
        {
            Map map = new Map("http://" + ip + ":8090/iserver/services/map-world/rest");
            MapParameter mapParameter = map.GetDefaultMapParameter("世界地图");
            List<Layer> tempLayer = new List<Layer>();
            tempLayer.Add(mapParameter.Layers[12]);
            tempLayer.Add(mapParameter.Layers[13]);
            mapParameter.Layers = tempLayer;

            SuperMap.Connector.Utility.Rectangle rect = new SuperMap.Connector.Utility.Rectangle();
            rect.LeftTop = new SuperMap.Connector.Utility.Point();
            rect.RightBottom = new SuperMap.Connector.Utility.Point();
            rect.LeftTop.X = 0;
            rect.LeftTop.Y = 0;
            rect.RightBottom.X = 600;
            rect.RightBottom.Y = 480;
            mapParameter.Viewer = rect;

            mapParameter.Center = new Point2D();
            mapParameter.Center.X = 0;
            mapParameter.Center.Y = 0;

            MapImage mapImage = map.GetMapImage("世界地图", mapParameter, null);
            using (MemoryStream memoryStream = new MemoryStream(mapImage.ImageData))
            {
                Bitmap bmp = new Bitmap(memoryStream);
                Assert.IsTrue(bmp.Width == 600);
                Assert.IsTrue(bmp.Height == 480);
            }
        }