Ejemplo n.º 1
0
        private void Initialize()
        {
            // Create new Scene
            Scene myScene = new Scene();

            // Set Scene's base map property
            myScene.Basemap = Basemap.CreateImagery();

            // Create and add an elevation source for the Scene
            ArcGISTiledElevationSource elevationSrc = new ArcGISTiledElevationSource(_elevationSourceUrl);

            myScene.BaseSurface.ElevationSources.Add(elevationSrc);

            // Create new scene layer from the url
            ArcGISSceneLayer sceneLayer = new ArcGISSceneLayer(_serviceUri);

            // Add created layer to the operational layers collection
            myScene.OperationalLayers.Add(sceneLayer);

            // Create a camera with coordinates showing layer data
            Camera camera = new Camera(48.378, -4.494, 200, 345, 65, 0);

            // Assign the Scene to the SceneView
            MySceneView.Scene = myScene;

            // Set view point of scene view using camera
            MySceneView.SetViewpointCameraAsync(camera);
        }
Ejemplo n.º 2
0
        private void Initialize()
        {
            // Create a new Scene with an imagery basemap
            Scene myScene = new Scene(Basemap.CreateImagery());

            // Create an elevation source for the Scene
            ArcGISTiledElevationSource elevationSrc = new ArcGISTiledElevationSource(new Uri(_elevationSourceUrl));

            myScene.BaseSurface.ElevationSources.Add(elevationSrc);

            // Add the Scene to the SceneView
            MySceneView.Scene = myScene;

            // Create a new GraphicsOverlay and add it to the SceneView
            GraphicsOverlay graphicsOverlay = new GraphicsOverlay();

            graphicsOverlay.SceneProperties.SurfacePlacement = SurfacePlacement.Relative;
            MySceneView.GraphicsOverlays.Add(graphicsOverlay);

            // Call a function to create a new distance composite symbol with three ranges
            DistanceCompositeSceneSymbol compositeSymbol = CreateCompositeSymbol();

            // Create a new point graphic with the composite symbol, add it to the graphics overlay
            MapPoint locationPoint = new MapPoint(-2.708471, 56.096575, 5000, SpatialReferences.Wgs84);
            Graphic  pointGraphic  = new Graphic(locationPoint, compositeSymbol);

            graphicsOverlay.Graphics.Add(pointGraphic);

            // Set the viewpoint with a new camera focused on the graphic
            Camera newCamera = new Camera(new MapPoint(-2.708471, 56.096575, 5000, SpatialReferences.Wgs84), 1500, 0, 80, 0);

            MySceneView.SetViewpointCameraAsync(newCamera);
        }
Ejemplo n.º 3
0
        private void Initialize()
        {
            // Create a new Scene with an imagery basemap
            Scene myScene = new Scene(Basemap.CreateImagery());

            // Create a scene layer to show buildings in the Scene
            ArcGISSceneLayer buildingsLayer = new ArcGISSceneLayer(new Uri(_buildingsServiceUrl));

            myScene.OperationalLayers.Add(buildingsLayer);

            // Create an elevation source for the Scene
            ArcGISTiledElevationSource elevationSrc = new ArcGISTiledElevationSource(new Uri(_elevationSourceUrl));

            myScene.BaseSurface.ElevationSources.Add(elevationSrc);

            // Add the Scene to the SceneView
            MySceneView.Scene = myScene;

            // Set the viewpoint with a new camera focused on the castle in Brest
            Camera observerCamera = new Camera(new MapPoint(-4.49492, 48.3808, 48.2511, SpatialReferences.Wgs84), 344.488, 74.1212, 0.0);

            MySceneView.SetViewpointCameraAsync(observerCamera);

            // Create a LocationViewshed analysis using the camera as the observer
            _viewshedForCamera = new LocationViewshed(observerCamera, 1, 1000);

            // Create an analysis overlay to contain the viewshed analysis results
            AnalysisOverlay viewshedOverlay = new AnalysisOverlay();

            // Add the location viewshed analysis to the analysis overlay, then add the overlay to the scene view
            viewshedOverlay.Analyses.Add(_viewshedForCamera);
            MySceneView.AnalysisOverlays.Add(viewshedOverlay);
        }
Ejemplo n.º 4
0
        private void Initialize()
        {
            // Create a new Scene with an imagery basemap
            Scene myScene = new Scene(BasemapStyle.ArcGISImageryStandard);

            // Create a scene layer to show buildings in the Scene
            IntegratedMeshLayer meshLayer = new IntegratedMeshLayer(new Uri(_gironaMeshUrl));

            myScene.OperationalLayers.Add(meshLayer);

            // Create an elevation source for the Scene
            ArcGISTiledElevationSource elevationSrc = new ArcGISTiledElevationSource(new Uri(_elevationSourceUrl));

            myScene.BaseSurface.ElevationSources.Add(elevationSrc);

            // Add the Scene to the SceneView
            MySceneView.Scene = myScene;

            // Set the viewpoint with a new camera focused on the cathedral in Girona.
            Camera observerCamera = new Camera(new MapPoint(2.82691, 41.985, 124.987, SpatialReferences.Wgs84), 332.131, 82.4732, 0.0);

            MySceneView.SetViewpointCameraAsync(observerCamera);

            // Create a LocationViewshed analysis using the camera as the observer
            _viewshedForCamera = new LocationViewshed(observerCamera, 1, 1000);

            // Create an analysis overlay to contain the viewshed analysis results
            AnalysisOverlay viewshedOverlay = new AnalysisOverlay();

            // Add the location viewshed analysis to the analysis overlay, then add the overlay to the scene view
            viewshedOverlay.Analyses.Add(_viewshedForCamera);
            MySceneView.AnalysisOverlays.Add(viewshedOverlay);
        }
Ejemplo n.º 5
0
        private void Initialize()
        {
            // Create new Scene
            Scene myScene = new Scene();

            // Set Scene's base map property
            myScene.Basemap = Basemap.CreateImagery();

            // Create uri to the scene layer
            var serviceUri = new Uri(
                "https://scene.arcgis.com/arcgis/rest/services/Hosted/Buildings_Brest/SceneServer/0");

            // Create new scene layer from the url
            ArcGISSceneLayer sceneLayer = new ArcGISSceneLayer(serviceUri);

            // Add created layer to the operational layers collection
            myScene.OperationalLayers.Add(sceneLayer);

            // Create a camera with coordinates showing layer data
            Camera camera = new Camera(48.378, -4.494, 200, 345, 65, 0);

            // Assign the Scene to the SceneView
            MySceneView.Scene = myScene;

            // Set view point of scene view using camera
            MySceneView.SetViewpointCameraAsync(camera);
        }
Ejemplo n.º 6
0
        //===================更新MyScene视点位置============
        private async void Map_Tapped(object sender, GeoViewInputEventArgs e)
        {
            // Dismiss any existing callouts.
            MyMapView.DismissCallout();

            // Get the normalized geometry for the tapped location and use it as the feature's geometry.
            MapPoint tappedPoint = (MapPoint)GeometryEngine.NormalizeCentralMeridian(e.Location);

            // Set the viewpoint with a new camera focused on the castle in Brest
            observerCamera = new Camera(new MapPoint(Mlon(tappedPoint.X), Mlat(tappedPoint.Y), 100, SpatialReferences.Wgs84), heading, 74.1212, 0.0);

            // MapPoint p = observerCamera.Location;
            await MySceneView.SetViewpointCameraAsync(observerCamera);
        }
        private void Initialize()
        {
            // Create a new scene
            Scene myScene = new Scene();

            // Crate a new base map using the static/shared create imagery method
            Basemap myBaseMap = Basemap.CreateImagery();

            // Add the imagery basemap to the scene's base map property
            myScene.Basemap = myBaseMap;

            // Add scene (with an imagery basemap) to the scene view's scene property
            MySceneView.Scene = myScene;

            // Create a new surface
            Surface mySurface = new Surface();

            // Define the string that points to the elevation image service
            string myElevationImageService = "http://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer";

            // Create a Uri from the elevation image service string
            Uri myUri = new Uri(myElevationImageService);

            // Create an ArcGIS tiled elevation
            ArcGISTiledElevationSource myArcGISTiledElevationSource = new ArcGISTiledElevationSource
            {
                // Set the ArcGIS tiled elevation sources property to the Uri of the elevation image service
                Source = myUri
            };

            // Add the ArcGIS tiled elevation source to the surface's elevated sources collection
            mySurface.ElevationSources.Add(myArcGISTiledElevationSource);

            // Set the scene's base surface to the surface with the ArcGIS tiled elevation source
            myScene.BaseSurface = mySurface;

            // Create camera with an initial camera position (Mount Everest in the Alps mountains)
            Camera myCamera = new Camera(28.4, 83.9, 10010.0, 10.0, 80.0, 300.0);

            // Set the scene view's camera position
            MySceneView.SetViewpointCameraAsync(myCamera);
        }
Ejemplo n.º 8
0
        //=========================键盘控制三维场景视点=====================
        private void MainWindows_Keydown(object sender, KeyEventArgs e)
        {
            if (e.KeyStates == Keyboard.GetKeyStates(Key.A))
            {
                e.Handled = true;
                MapPoint p = observerCamera.Location;
                observerCamera = new Camera(new MapPoint(p.X - 0.1, p.Y, p.Z, SpatialReferences.Wgs84), heading, 74.1212, 0.0);
                MySceneView.SetViewpointCameraAsync(observerCamera);
                //MessageBox.Show("当前位置"+p.X+", "+ p.Y+", "+p.Z);
            }
            else if (e.KeyStates == Keyboard.GetKeyStates(Key.D))
            {
                e.Handled = true;
                MapPoint p = observerCamera.Location;
                observerCamera = new Camera(new MapPoint(p.X + 0.1, p.Y, p.Z, SpatialReferences.Wgs84), heading, 74.1212, 0.0);
                MySceneView.SetViewpointCameraAsync(observerCamera);
                // MessageBox.Show("当前位置" + p.X + ", " + p.Y + ", " + p.Z);
            }
            else if (e.KeyStates == Keyboard.GetKeyStates(Key.W))
            {
                e.Handled = true;
                MapPoint p = observerCamera.Location;
                observerCamera = new Camera(new MapPoint(p.X, p.Y + 0.1, p.Z, SpatialReferences.Wgs84), heading, 74.1212, 0.0);
                MySceneView.SetViewpointCameraAsync(observerCamera);
                // MessageBox.Show("当前位置" + p.X + ", " + p.Y + ", " + p.Z);
            }
            else if (e.KeyStates == Keyboard.GetKeyStates(Key.S))
            {
                e.Handled = true;
                MapPoint p = observerCamera.Location;
                observerCamera = new Camera(new MapPoint(p.X, p.Y - 0.1, p.Z, SpatialReferences.Wgs84), heading, 74.1212, 0.0);
                MySceneView.SetViewpointCameraAsync(observerCamera);
                // MessageBox.Show("当前位置" + p.X + ", " + p.Y + ", " + p.Z);
            }
            else if (e.KeyStates == Keyboard.GetKeyStates(Key.Down))
            {
                e.Handled = true;
                MapPoint p = observerCamera.Location;
                observerCamera = new Camera(new MapPoint(p.X, p.Y, p.Z + 100, SpatialReferences.Wgs84), heading, 74.1212, 0.0);
                MySceneView.SetViewpointCameraAsync(observerCamera);
                // MessageBox.Show("当前位置" + p.X + ", " + p.Y + ", " + p.Z);
            }
            else if (e.KeyStates == Keyboard.GetKeyStates(Key.Up))
            {
                e.Handled = true;
                MapPoint p = observerCamera.Location;
                observerCamera = new Camera(new MapPoint(p.X, p.Y, p.Z - 100, SpatialReferences.Wgs84), heading, 74.1212, 0.0);
                MySceneView.SetViewpointCameraAsync(observerCamera);
                // MessageBox.Show("当前位置" + p.X + ", " + p.Y + ", " + p.Z);
            }
            else if (e.KeyStates == Keyboard.GetKeyStates(Key.Left))
            {
                e.Handled = true;
                MapPoint p = observerCamera.Location;

                if (heading > 360)
                {
                    heading = heading - 360;
                }

                observerCamera = new Camera(new MapPoint(p.X, p.Y, p.Z, SpatialReferences.Wgs84), heading - 10, 74.1212, 0.0);
                MySceneView.SetViewpointCameraAsync(observerCamera);
                // MessageBox.Show("当前位置" + p.X + ", " + p.Y + ", " + p.Z);
            }
            else if (e.KeyStates == Keyboard.GetKeyStates(Key.Right))
            {
                e.Handled = true;
                MapPoint p = observerCamera.Location;

                if (heading > 360)
                {
                    heading = heading - 360;
                }
                observerCamera = new Camera(new MapPoint(p.X, p.Y, p.Z, SpatialReferences.Wgs84), heading + 10, 74.1212, 0.0);
                MySceneView.SetViewpointCameraAsync(observerCamera);
                // MessageBox.Show("当前位置" + p.X + ", " + p.Y + ", " + p.Z);
            }
        }
Ejemplo n.º 9
0
        //============地图展示
        private async void Initialize()
        {
            LoadData();
            //=====================放球站=============
            // Create overlay to where graphics are shown
            GraphicsOverlay overlay = new GraphicsOverlay();

            MyMapView.GraphicsOverlays.Add(overlay);
            try
            {
                await CreatePictureMarkerSymbolFromResources(overlay);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "Error");
            }

            //================== 二维场景探空仪展示 ==============
            //加载图片


            int count = Global.DectorNamelist.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    Assembly currentAssembly = Assembly.GetExecutingAssembly();
                    // Get image as a stream from the resources
                    // Picture is defined as EmbeddedResource and DoNotCopy
                    Stream resourceStream = currentAssembly.GetManifestResourceStream(
                        this.GetType(), "qiqiu.png");
                    // Create new symbol using asynchronous factory method from stream
                    PictureMarkerSymbol pinSymbol = await PictureMarkerSymbol.CreateAsync(resourceStream);

                    pinSymbol.Width  = 35;
                    pinSymbol.Height = 35;
                    //位置
                    int      index          = 0;
                    double   positionOffset = 0.01 * index;
                    MapPoint point          = new MapPoint(111, 30, 0, SpatialReferences.Wgs84);
                    // Create the graphic from the geometry and the symbol.
                    Graphic _plane2D;
                    _plane2D = new Graphic(point, pinSymbol);
                    // Add the graphic to the overlay.
                    overlay.Graphics.Add(_plane2D);
                    Dector2D.Add(_plane2D);
                }
            }

            //==========================场景基础地图===========
            // Create a new Scene with an imagery basemap
            Scene myScene = new Scene(Basemap.CreateImagery());

            // Create a scene layer to show buildings in the Scene
            ArcGISSceneLayer buildingsLayer = new ArcGISSceneLayer(new Uri(_buildingsServiceUrl));

            myScene.OperationalLayers.Add(buildingsLayer);

            // Create an elevation(海拔) source for the Scene
            ArcGISTiledElevationSource elevationSrc = new ArcGISTiledElevationSource(new Uri(_elevationSourceUrl));

            myScene.BaseSurface.ElevationSources.Add(elevationSrc);

            ElevationSource elevationSource = new ArcGISTiledElevationSource(_elevationServiceUrl);

            myScene.BaseSurface.ElevationSources.Add(elevationSource);
            // Add the Scene to the SceneView
            MySceneView.Scene = myScene;


            //======================三维探空仪====================
            // Create the graphics overlay.
            GraphicsOverlay overlay1 = new GraphicsOverlay();

            //=====放球站======
            try
            {
                await CreatePictureMarkerSymbolFromResources(overlay1);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "Error");
            }

            MySceneView.GraphicsOverlays.Add(overlay1);
            if (Global.DectorNamelist.Count > 0)
            {
                for (int i = 0; i < Global.DectorNamelist.Count; i++)
                {
                    GraphicsOverlay dectoroverlay = new GraphicsOverlay();

                    // Set the surface placement mode for the overlay.
                    dectoroverlay.SceneProperties.SurfacePlacement = SurfacePlacement.Absolute;
                    MapPoint           point        = new MapPoint(111, 30, 0, SpatialReferences.Wgs84);
                    SimpleMarkerSymbol circleSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, Color.Blue, 20);

                    Graphic _plane3D;
                    // Create the graphic from the geometry and the symbol.
                    _plane3D = new Graphic(point, circleSymbol);

                    // Add the graphic to the overlay.
                    dectoroverlay.Graphics.Add(_plane3D);

                    // Show the graphics overlay in the scene.
                    MySceneView.GraphicsOverlays.Add(dectoroverlay);
                    Dector3D.Add(_plane3D);

                    /*
                     *
                     * _orbitCameraController = new OrbitGeoElementCameraController(_plane3D, 30.0)
                     * {
                     *   CameraPitchOffset = 75.0
                     * };
                     * MySceneView.CameraController = _orbitCameraController;
                     */
                }
            }



            //===========跟随相机控制========



            //================加载探空仪位置信息===========



            //==================动态更新===============
            _animationTimer = new Timer(2000)
            {
                Enabled   = true,
                AutoReset = true
            };

            //动态更新探空仪位置
            _animationTimer.Elapsed += AnimatePlane;

            //====二维预测轨迹=====

            //SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Dash, Color.FromArgb(0xFF, 0x80, 0x00, 0x80), 4);
            // _overlay.Renderer = new SimpleRenderer(lineSymbol);

            // MyMapView.GraphicsOverlays.Add(_overlay);
            //==========三维预测轨迹=========

            // SimpleLineSymbol lineSymbol1 = new SimpleLineSymbol(SimpleLineSymbolStyle.Dash, Color.FromArgb(0xFF, 0x80, 0x00, 0x80), 4);
            //  _overlay1.Renderer = new SimpleRenderer(lineSymbol1);
            // // Set the surface placement mode for the overlay.
            for (int i = 0; i < Global.DectorNamelist.Count; i++)
            {
                GraphicsOverlay _overlay1 = new GraphicsOverlay();

                GraphicsOverlay _overlay = new GraphicsOverlay();

                _overlay1.SceneProperties.SurfacePlacement = SurfacePlacement.Absolute;

                //MySceneView.GraphicsOverlays.Add(_overlay1);

                MySceneView.GraphicsOverlays.Add(_overlay1);
                MyMapView.GraphicsOverlays.Add(_overlay);
                Dector3Doverlay.Add(_overlay1);
                Dector2Doverlay.Add(_overlay);
            }



            //===================三维地图初始视点================
            heading = 344.488;
            // Set the viewpoint with a new camera focused on the castle in Brest
            observerCamera = new Camera(new MapPoint(112, 29, 2495, SpatialReferences.Wgs84), heading, 74.1212, 0.0);
            await MySceneView.SetViewpointCameraAsync(observerCamera);

            //====================通过鼠标点击改变三维地图视点==================
            MyMapView.GeoViewTapped += Map_Tapped;



            if (Global.namelist.Count > 0)
            {
                string[] strArr     = new string[3];
                string   sArguments = @"station.py"; //调用的python的文件名字
                strArr[0] = Global.lonlist[0].ToString();
                strArr[1] = Global.latlist[0].ToString();
                strArr[2] = Global.radiuslist[0].ToString();
                RunPythonScript(sArguments, "-u", strArr);
            }
        }