コード例 #1
0
        private async void MySceneView_SpatialReferenceChanged(object sender, EventArgs e)
        {
            MySceneView.SpatialReferenceChanged -= MySceneView_SpatialReferenceChanged;

            List <string> fileNames = new List <string>();

            fileNames.Add(@"..\..\..\samples-data\elevation\SRTM-Void-Filled-3-arc-second\n18_w156_3arc_v2.dt1");
            fileNames.Add(@"..\..\..\samples-data\elevation\SRTM-Void-Filled-3-arc-second\n19_w155_3arc_v2.dt1");
            fileNames.Add(@"..\..\..\samples-data\elevation\SRTM-Void-Filled-3-arc-second\n19_w156_3arc_v2.dt1");
            fileNames.Add(@"..\..\..\samples-data\elevation\SRTM-Void-Filled-3-arc-second\n19_w157_3arc_v2.dt1");
            fileNames.Add(@"..\..\..\samples-data\elevation\SRTM-Void-Filled-3-arc-second\n20_w156_3arc_v2.dt1");

            foreach (var item in fileNames)
            {
                if (!File.Exists(item))
                {
                    MessageBox.Show("Sample data not found");
                    return;
                }
            }

            _fileElevationSource = new FileElevationSource(fileNames);
            MySceneView.Scene.Surface.Add(_fileElevationSource);

            MySceneView.SetViewAsync(new Camera(new MapPoint(-156.277, 18.356, 58877.626), 20.091, 70.160), new TimeSpan(0, 0, 5));
            await MySceneView.LayersLoadedAsync();

            _isSceneReady = true;

            MySceneView.MouseMove += MySceneView_MouseMove;
        }
コード例 #2
0
        private async void MySceneView_SpatialReferenceChanged(object sender, System.EventArgs e)
        {
            MySceneView.SpatialReferenceChanged -= MySceneView_SpatialReferenceChanged;

            try
            {
                // Wait until all layers are initialized
                await MySceneView.LayersLoadedAsync();

                // Set viewpoint and navigate to it
                var viewpoint = new Camera(
                    new MapPoint(
                        -122.406025330049,
                        37.7890934457207,
                        209.54040953517,
                        SpatialReferences.Wgs84),
                    338.125939203603,
                    72.7452621261101);

                await MySceneView.SetViewAsync(viewpoint, new TimeSpan(0, 0, 3), false);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error occured while navigating to the target viewpoint",
                                "An error occured");
                Debug.WriteLine(ex.ToString());
            }
        }
コード例 #3
0
        private async void MySceneView_SpatialReferenceChanged(object sender, System.EventArgs e)
        {
            MySceneView.SpatialReferenceChanged -= MySceneView_SpatialReferenceChanged;

            try
            {
                // Set first one to starting point
                MySceneView.SetView(_animationViewpoints[0]);

                await MySceneView.LayersLoadedAsync();

                // Set navigation in the order we want to animate the camera
                await MySceneView.SetViewAsync(_animationViewpoints[1], 0.2, true);

                await MySceneView.SetViewAsync(_animationViewpoints[2], 0.2, false);

                await MySceneView.SetViewAsync(_animationViewpoints[3], 0.2, false);

                await MySceneView.SetViewAsync(_animationViewpoints[4], 0.4, false);

                await MySceneView.SetViewAsync(_animationViewpoints[5], 0.2, false);

                await MySceneView.SetViewAsync(_animationViewpoints[6], 0.3, false);

                await MySceneView.SetViewAsync(_animationViewpoints[7], 0.2, false);

                await MySceneView.SetViewAsync(_animationViewpoints[8], 0.2, false);

                await MySceneView.SetViewAsync(_animationViewpoints[9], 0.2, false);

                await MySceneView.SetViewAsync(_animationViewpoints[10], 0.3, false);

                await MySceneView.SetViewAsync(_animationViewpoints[11], 0.3, false);

                await MySceneView.SetViewAsync(_animationViewpoints[12], 0.2, false);

                await MySceneView.SetViewAsync(_animationViewpoints[13], 0.2, false);

                await MySceneView.SetViewAsync(_animationViewpoints[14], 0.2, false);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error occured while navigating to the target viewpoint",
                                "An error occured");
                Debug.WriteLine(ex.ToString());
            }
        }
コード例 #4
0
        private async void Initialize()
        {
            try
            {
                CreateExtrusionInfos();

                // Set initial viewpoint
                var viewpoint = new ViewpointCenter(new MapPoint(-96, 39), 15000000);
                await MySceneView.SetViewAsync(viewpoint);

                // Query states with statistical attributes
                var queryTask = new QueryTask(
                    new Uri("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5"));
                Query query = new Query("1=1");
                query.OutFields.Add("STATE_NAME");
                query.OutFields.Add("AGE_5_17");
                query.OutFields.Add("AGE_18_21");
                query.OutFields.Add("AGE_22_29");
                query.OutFields.Add("AGE_30_39");
                query.OutFields.Add("AGE_40_49");
                query.OutFields.Add("AGE_50_64");
                query.OutFields.Add("AGE_65_UP");

                var result = await queryTask.ExecuteAsync(query);

                var states = new GraphicCollection();
                foreach (var state in result.FeatureSet.Features)
                {
                    states.Add(new Graphic(state.Geometry, state.Attributes));
                }

                // Make sure that all layers are loaded
                await MySceneView.LayersLoadedAsync();

                // Set graphics to the overlay
                var statesOverlay = MySceneView.GraphicsOverlays["statesOverlay"];
                statesOverlay.GraphicsSource = states;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Graphics Extrusion Sample");
            }
        }