private void Initialize()
        {
            _viewHeight = HeightSlider.Value;

            // Create the scene with the imagery basemap.
            Scene myScene = new Scene(Basemap.CreateImagery());

            MySceneView.Scene = myScene;

            // Add the surface elevation.
            Surface mySurface = new Surface();

            mySurface.ElevationSources.Add(new ArcGISTiledElevationSource(_localElevationImageService));
            myScene.BaseSurface = mySurface;

            // Add the scene layer.
            ArcGISSceneLayer sceneLayer = new ArcGISSceneLayer(_buildingsUrl);

            myScene.OperationalLayers.Add(sceneLayer);

            // Create the MapPoint representing the initial location.
            MapPoint initialLocation = new MapPoint(-4.5, 48.4, 46 + _viewHeight);

            // Create the location viewshed analysis.
            _viewshed = new LocationViewshed(
                initialLocation,
                HeadingSlider.Value,
                PitchSlider.Value,
                HorizontalAngleSlider.Value,
                VerticalAngleSlider.Value,
                MinimumDistanceSlider.Value,
                MaximumDistanceSlider.Value);

            // Create a camera based on the initial location.
            Camera camera = new Camera(initialLocation, 200.0, 20.0, 70.0, 0.0);

            // Create a symbol for the viewpoint.
            _viewpointSymbol = SimpleMarkerSceneSymbol.CreateSphere(Color.Blue, 10, SceneSymbolAnchorPosition.Center);

            // Add the symbol to the viewpoint overlay.
            _viewpointOverlay = new GraphicsOverlay
            {
                SceneProperties = new LayerSceneProperties(SurfacePlacement.Absolute)
            };
            _viewpointOverlay.Graphics.Add(new Graphic(initialLocation, _viewpointSymbol));

            // Apply the camera to the scene view.
            MySceneView.SetViewpointCamera(camera);

            // Create an analysis overlay for showing the viewshed analysis.
            _analysisOverlay = new AnalysisOverlay();

            // Add the viewshed analysis to the overlay.
            _analysisOverlay.Analyses.Add(_viewshed);

            // Add the analysis overlay to the SceneView.
            MySceneView.AnalysisOverlays.Add(_analysisOverlay);

            // Add the graphics overlay
            MySceneView.GraphicsOverlays.Add(_viewpointOverlay);

            // Update the frustum outline Color.
            // The frustum outline shows the volume in which the viewshed analysis is performed.
            Viewshed.FrustumOutlineColor = Color.Blue;

            // Subscribe to tap events. This enables the 'pick up' and 'drop' workflow for moving the viewpoint.
            MySceneView.GeoViewTapped += MySceneViewOnGeoViewTapped;
        }
Example #2
0
        private void Initialize()
        {
            // Create the scene with the imagery basemap.
            Scene myScene = new Scene(BasemapStyle.ArcGISImageryStandard);

            _mySceneView.Scene = myScene;

            // Add the surface elevation.
            Surface mySurface = new Surface();

            mySurface.ElevationSources.Add(new ArcGISTiledElevationSource(_localElevationImageService));
            myScene.BaseSurface = mySurface;

            // Add the scene layer.
            ArcGISSceneLayer sceneLayer = new ArcGISSceneLayer(_buildingsUrl);

            myScene.OperationalLayers.Add(sceneLayer);

            // Create the MapPoint representing the initial location.
            MapPoint initialLocation = new MapPoint(-4.5, 48.4, 56.0);

            // Create the location viewshed analysis.
            _viewshed = new LocationViewshed(
                initialLocation,
                _headingSlider.Progress,
                _pitchSlider.Progress,
                _horizontalAngleSlider.Progress,
                _verticalAngleSlider.Progress,
                _minimumDistanceSlider.Progress,
                _maximumDistanceSlider.Progress);

            // Create a camera based on the initial location.
            Camera camera = new Camera(initialLocation, 200.0, 20.0, 70.0, 0.0);

            // Apply the camera to the scene view.
            _mySceneView.SetViewpointCamera(camera);

            // Create an analysis overlay for showing the viewshed analysis.
            _analysisOverlay = new AnalysisOverlay();

            // Add the viewshed analysis to the overlay.
            _analysisOverlay.Analyses.Add(_viewshed);

            // Create a symbol for the viewpoint.
            _viewpointSymbol = SimpleMarkerSceneSymbol.CreateSphere(System.Drawing.Color.Blue, 10, SceneSymbolAnchorPosition.Center);

            // Add the symbol to the viewpoint overlay.
            _viewpointOverlay = new GraphicsOverlay
            {
                SceneProperties = new LayerSceneProperties(SurfacePlacement.Absolute)
            };
            _viewpointOverlay.Graphics.Add(new Graphic(initialLocation, _viewpointSymbol));

            // Add the analysis overlay to the SceneView.
            _mySceneView.AnalysisOverlays.Add(_analysisOverlay);

            // Add the graphics overlay
            _mySceneView.GraphicsOverlays.Add(_viewpointOverlay);

            // Update the frustum outline color.
            // The frustum outline shows the volume in which the viewshed analysis is performed.
            Viewshed.FrustumOutlineColor = System.Drawing.Color.Blue;

            // Subscribe to tap events to enable moving the observer.
            _mySceneView.GeoViewTapped += MySceneViewOnGeoViewTapped;
        }
        private async void Initialize()
        {
            // Create scene
            Scene myScene = new Scene(Basemap.CreateImageryWithLabels())
            {
                // Set initial viewpoint
                InitialViewpoint = new Viewpoint(_observerPoint, 1000000)
            };
            // Create the elevation source
            ElevationSource myElevationSource = new ArcGISTiledElevationSource(_elevationUri);

            // Add the elevation source to the scene
            myScene.BaseSurface.ElevationSources.Add(myElevationSource);
            // Create the building scene layer
            ArcGISSceneLayer mySceneLayer = new ArcGISSceneLayer(_buildingsUri);

            // Add the building layer to the scene
            myScene.OperationalLayers.Add(mySceneLayer);

            // Add the observer to the scene
            // Create a graphics overlay with relative surface placement; relative surface placement allows the Z position of the observation point to be adjusted
            GraphicsOverlay overlay = new GraphicsOverlay()
            {
                SceneProperties = new LayerSceneProperties(SurfacePlacement.Relative)
            };
            // Create the symbol that will symbolize the observation point
            SimpleMarkerSceneSymbol symbol = new SimpleMarkerSceneSymbol(SimpleMarkerSceneSymbolStyle.Sphere, Colors.Red, 10, 10, 10, SceneSymbolAnchorPosition.Bottom);

            // Create the observation point graphic from the point and symbol
            _observerGraphic = new Graphic(_observerPoint, symbol);
            // Add the observer to the overlay
            overlay.Graphics.Add(_observerGraphic);
            // Add the overlay to the scene
            MySceneView.GraphicsOverlays.Add(overlay);

            // Add the taxi to the scene
            // Create the model symbol for the taxi
            ModelSceneSymbol taxiSymbol = await ModelSceneSymbol.CreateAsync(new Uri(GetModelUri()));

            // Set the anchor position for the mode; ensures that the model appears above the ground
            taxiSymbol.AnchorPosition = SceneSymbolAnchorPosition.Bottom;
            // Create the graphic from the taxi starting point and the symbol
            _taxiGraphic = new Graphic(_points[0], taxiSymbol);
            // Add the taxi graphic to the overlay
            overlay.Graphics.Add(_taxiGraphic);

            // Create GeoElement Line of sight analysis (taxi to building)
            // Create the analysis
            _geoLine = new GeoElementLineOfSight(_observerGraphic, _taxiGraphic)
            {
                // Apply an offset to the target. This helps avoid some false negatives
                TargetOffsetZ = 2
            };
            // Create the analysis overlay
            AnalysisOverlay myAnalysisOverlay = new AnalysisOverlay();

            // Add the analysis to the overlay
            myAnalysisOverlay.Analyses.Add(_geoLine);
            // Add the analysis overlay to the scene
            MySceneView.AnalysisOverlays.Add(myAnalysisOverlay);

            // Create a timer; this will enable animating the taxi
            Device.StartTimer(new TimeSpan(0, 0, 0, 0, 60), () =>
            {
                // Move the taxi every time the timer elapses
                AnimationTimer_Elapsed(this, null);
                // Keep the timer running
                return(true);
            });

            // Subscribe to TargetVisible events; allows for updating the UI and selecting the taxi when it is visible
            _geoLine.TargetVisibilityChanged += Geoline_TargetVisibilityChanged;

            // Add the scene to the view
            MySceneView.Scene = myScene;
        }
        private async void Initialize()
        {
            // Create scene.
            Scene myScene = new Scene(Basemap.CreateImageryWithLabels())
            {
                // Set initial viewpoint.
                InitialViewpoint = new Viewpoint(_observerPoint, 1000000)
            };

            // Create the elevation source.
            ElevationSource myElevationSource = new ArcGISTiledElevationSource(_elevationUri);

            // Add the elevation source to the scene.
            myScene.BaseSurface.ElevationSources.Add(myElevationSource);
            // Create the building scene layer.
            ArcGISSceneLayer mySceneLayer = new ArcGISSceneLayer(_buildingsUri);

            // Add the building layer to the scene.
            myScene.OperationalLayers.Add(mySceneLayer);

            // Add the observer to the scene.
            // Create a graphics overlay with relative surface placement; relative surface placement allows the Z position of the observation point to be adjusted.
            GraphicsOverlay overlay = new GraphicsOverlay {
                SceneProperties = new LayerSceneProperties(SurfacePlacement.Relative)
            };
            // Create the symbol that will symbolize the observation point.
            SimpleMarkerSceneSymbol symbol = new SimpleMarkerSceneSymbol(SimpleMarkerSceneSymbolStyle.Sphere, System.Drawing.Color.Red, 10, 10, 10, SceneSymbolAnchorPosition.Bottom);

            // Create the observation point graphic from the point and symbol.
            _observerGraphic = new Graphic(_observerPoint, symbol);
            // Add the observer to the overlay.
            overlay.Graphics.Add(_observerGraphic);
            // Add the overlay to the scene.
            _mySceneView.GraphicsOverlays.Add(overlay);

            try
            {
                // Add the taxi to the scene.
                // Get the path to the model.
                string taxiModelPath = DataManager.GetDataFolder("3af5cfec0fd24dac8d88aea679027cb9", "dolmus.3ds");
                // Create the model symbol for the taxi.
                ModelSceneSymbol taxiSymbol = await ModelSceneSymbol.CreateAsync(new Uri(taxiModelPath));

                // Set the anchor position for the mode; ensures that the model appears above the ground.
                taxiSymbol.AnchorPosition = SceneSymbolAnchorPosition.Bottom;
                // Create the graphic from the taxi starting point and the symbol.
                _taxiGraphic = new Graphic(_points[0], taxiSymbol);
                // Add the taxi graphic to the overlay.
                overlay.Graphics.Add(_taxiGraphic);

                // Create GeoElement Line of sight analysis (taxi to building).
                // Create the analysis.
                _geoLine = new GeoElementLineOfSight(_observerGraphic, _taxiGraphic)
                {
                    // Apply an offset to the target. This helps avoid some false negatives.
                    TargetOffsetZ = 2
                };
                // Create the analysis overlay.
                AnalysisOverlay myAnalysisOverlay = new AnalysisOverlay();
                // Add the analysis to the overlay.
                myAnalysisOverlay.Analyses.Add(_geoLine);
                // Add the analysis overlay to the scene.
                _mySceneView.AnalysisOverlays.Add(myAnalysisOverlay);

                // Create a timer; this will enable animating the taxi.
                Timer timer = new Timer(120);
                // Move the taxi every time the timer expires.
                timer.Elapsed += AnimationTimer_Elapsed;
                // Keep the timer running continuously.
                timer.AutoReset = true;
                // Start the timer.
                timer.Start();

                // Subscribe to TargetVisible events; allows for updating the UI and selecting the taxi when it is visible.
                _geoLine.TargetVisibilityChanged += Geoline_TargetVisibilityChanged;

                // Add the scene to the view.
                _mySceneView.Scene = myScene;
            }
            catch (Exception e)
            {
                new UIAlertView("Error", e.ToString(), (IUIAlertViewDelegate)null, "OK", null).Show();
            }
        }
        private void Initialize()
        {
            // Create the scene with the imagery basemap.
            _mySceneView.Scene = new Scene(Basemap.CreateImagery());

            // Add the surface elevation.
            Surface mySurface = new Surface();

            mySurface.ElevationSources.Add(new ArcGISTiledElevationSource(_localElevationImageService));
            _mySceneView.Scene.BaseSurface = mySurface;

            // Add the scene layer.
            ArcGISSceneLayer sceneLayer = new ArcGISSceneLayer(_buildingsUrl);

            _mySceneView.Scene.OperationalLayers.Add(sceneLayer);

            // Create the MapPoint representing the initial location.
            MapPoint initialLocation = new MapPoint(-4.5, 48.4, 56.0);

            // Create the location viewshed analysis.
            _viewshed = new LocationViewshed(
                initialLocation,
                0,
                60,
                75,
                90,
                11,
                1500);

            _settingsVC             = new ViewshedLocationSettingsController(_viewshed);
            _settingsButton.Enabled = true;

            // Create a camera based on the initial location.
            Camera camera = new Camera(initialLocation, 200.0, 20.0, 70.0, 0.0);

            // Apply the camera to the scene view.
            _mySceneView.SetViewpointCamera(camera);

            // Create an analysis overlay for showing the viewshed analysis.
            _analysisOverlay = new AnalysisOverlay();

            // Add the viewshed analysis to the overlay.
            _analysisOverlay.Analyses.Add(_viewshed);

            // Create a symbol for the viewpoint.
            _viewpointSymbol = SimpleMarkerSceneSymbol.CreateSphere(Color.Blue, 10, SceneSymbolAnchorPosition.Center);

            // Add the symbol to the viewpoint overlay.
            _viewpointOverlay = new GraphicsOverlay
            {
                SceneProperties = new LayerSceneProperties(SurfacePlacement.Absolute)
            };
            _viewpointOverlay.Graphics.Add(new Graphic(initialLocation, _viewpointSymbol));

            // Add the analysis overlay to the SceneView.
            _mySceneView.AnalysisOverlays.Add(_analysisOverlay);

            // Add the graphics overlay
            _mySceneView.GraphicsOverlays.Add(_viewpointOverlay);

            // Update the frustum outline color.
            // The frustum outline shows the volume in which the viewshed analysis is performed.
            Viewshed.FrustumOutlineColor = Color.Blue;
        }
        /// <summary>
        /// Checks the distance.
        /// </summary>
        private void CheckDistance()
        {
            SimpleMarkerSceneSymbol sphereSymbol = new SimpleMarkerSceneSymbol
            {
                Style          = SimpleMarkerSceneSymbolStyle.Sphere,
                Color          = Color.Red,
                Height         = 1000,
                Width          = 100,
                Depth          = 100,
                AnchorPosition = SceneSymbolAnchorPosition.Center
            };

            MapPoint p1 = new MapPoint(9.386941, 47.666557, SpatialReferences.Wgs84);
            MapPoint p2 = new MapPoint(9.172648, 47.666100, SpatialReferences.Wgs84);

            GraphicsOverlay symbolsOverlay = new GraphicsOverlay
            {
                Opacity = 0.5
            };

            symbolsOverlay.SceneProperties.SurfacePlacement = SurfacePlacement.Draped;
            symbolsOverlay.Graphics.Add(new Graphic(p1, sphereSymbol));
            symbolsOverlay.Graphics.Add(new Graphic(p2, sphereSymbol));

            Polyline p = new Polyline(new[] { p1, p2 });

            symbolsOverlay.Graphics.Add(new Graphic(p, new SimpleLineSymbol
            {
                AntiAlias = true,
                Style     = SimpleLineSymbolStyle.DashDot,
                Width     = 4,
                Color     = Color.Red
            }));


            //double dDistance = GeometryEngine.Distance( p1, p2 );

            var result = GeometryEngine.DistanceGeodetic(p1, p2, LinearUnits.Meters, AngularUnits.Degrees, GeodeticCurveType.Geodesic);

            uint iPositionDistanceMeter = 500;

            Geometry g = GeometryEngine.DensifyGeodetic(p, iPositionDistanceMeter, LinearUnits.Meters);

            SimpleMarkerSymbol marker = new SimpleMarkerSymbol
            {
                Style = SimpleMarkerSymbolStyle.Circle,
                Color = Color.Yellow,
                Size  = 20
            };

            foreach (LineSegment x in (g as Polyline).Parts[0])
            {
                symbolsOverlay.Graphics.Add(new Graphic(x.StartPoint, marker));
            }

            this.SceneView.GraphicsOverlays.Add(symbolsOverlay);

            //-----------------------------------------------------------------

            //this.SceneView.SetViewpointAsync( new Viewpoint( p1, 100000 ) );
        }
Example #7
0
        private async void Initialize()
        {
            // Create scene.
            Scene myScene = new Scene(Basemap.CreateImageryWithLabels())
            {
                InitialViewpoint = new Viewpoint(_observerPoint, 1000000)
            };
            // Create the elevation source.
            ElevationSource myElevationSource = new ArcGISTiledElevationSource(_elevationUri);

            // Add the elevation source to the scene.
            myScene.BaseSurface.ElevationSources.Add(myElevationSource);
            // Create the building scene layer.
            ArcGISSceneLayer mySceneLayer = new ArcGISSceneLayer(_buildingsUri);

            // Add the building layer to the scene.
            myScene.OperationalLayers.Add(mySceneLayer);

            // Add the observer to the scene.
            // Create a graphics overlay with relative surface placement; relative surface placement allows the Z position of the observation point to be adjusted.
            GraphicsOverlay overlay = new GraphicsOverlay()
            {
                SceneProperties = new LayerSceneProperties(SurfacePlacement.Relative)
            };
            // Create the symbol that will symbolize the observation point.
            SimpleMarkerSceneSymbol symbol = new SimpleMarkerSceneSymbol(SimpleMarkerSceneSymbolStyle.Sphere, Color.Red, 10, 10, 10, SceneSymbolAnchorPosition.Bottom);

            // Create the observation point graphic from the point and symbol.
            _observerGraphic = new Graphic(_observerPoint, symbol);
            // Add the observer to the overlay.
            overlay.Graphics.Add(_observerGraphic);
            // Add the overlay to the scene.
            MySceneView.GraphicsOverlays.Add(overlay);

            // Add the taxi to the scene.
            // Create the model symbol for the taxi.
            ModelSceneSymbol taxiSymbol = await ModelSceneSymbol.CreateAsync(new Uri(DataManager.GetDataFolder("3af5cfec0fd24dac8d88aea679027cb9", "dolmus.3ds")));

            // Set the anchor position for the mode; ensures that the model appears above the ground.
            taxiSymbol.AnchorPosition = SceneSymbolAnchorPosition.Bottom;
            // Create the graphic from the taxi starting point and the symbol.
            _taxiGraphic = new Graphic(_points[0], taxiSymbol);
            // Add the taxi graphic to the overlay.
            overlay.Graphics.Add(_taxiGraphic);

            // Create GeoElement Line of sight analysis (taxi to building).
            // Create the analysis.
            _geoLine = new GeoElementLineOfSight(_observerGraphic, _taxiGraphic)
            {
                // Apply an offset to the target. This helps avoid some false negatives.
                TargetOffsetZ = 2
            };
            // Create the analysis overlay.
            AnalysisOverlay myAnalysisOverlay = new AnalysisOverlay();

            // Add the analysis to the overlay.
            myAnalysisOverlay.Analyses.Add(_geoLine);
            // Add the analysis overlay to the scene.
            MySceneView.AnalysisOverlays.Add(myAnalysisOverlay);

            // Create a timer; this will enable animating the taxi.
            Windows.UI.Xaml.DispatcherTimer animationTimer = new Windows.UI.Xaml.DispatcherTimer()
            {
                Interval = new TimeSpan(0, 0, 0, 0, 60)
            };
            // Move the taxi every time the timer expires.
            animationTimer.Tick += AnimationTimer_Tick;
            // Start the timer.
            animationTimer.Start();

            // Subscribe to TargetVisible events; allows for updating the UI and selecting the taxi when it is visible.
            _geoLine.TargetVisibilityChanged += Geoline_TargetVisibilityChanged;

            // Add the scene to the view.
            MySceneView.Scene = myScene;
        }
        private void addGraphics()
        {
            var x = 4.975;
            var y = 49.0;
            var z = 500.0;

            //create symbols for all the available 3D symbols
            SimpleMarkerSceneSymbol[] symbols = new SimpleMarkerSceneSymbol[6];

            var coneSymbol = new SimpleMarkerSceneSymbol
            {
                Style          = SimpleMarkerSceneSymbolStyle.Cone,
                Color          = Colors.Red,
                Width          = 200,
                Height         = 200,
                Depth          = 200,
                AnchorPosition = SceneSymbolAnchorPosition.Center
            };

            var cubeSymbol = new SimpleMarkerSceneSymbol
            {
                Style          = SimpleMarkerSceneSymbolStyle.Cube,
                Color          = Colors.Aqua,
                Width          = 200,
                Height         = 200,
                Depth          = 200,
                AnchorPosition = SceneSymbolAnchorPosition.Center
            };

            var cylinderSymbol = new SimpleMarkerSceneSymbol
            {
                Style          = SimpleMarkerSceneSymbolStyle.Cylinder,
                Color          = Colors.Yellow,
                Width          = 200,
                Height         = 200,
                Depth          = 200,
                AnchorPosition = SceneSymbolAnchorPosition.Center
            };

            var diamondSymbol = new SimpleMarkerSceneSymbol
            {
                Style          = SimpleMarkerSceneSymbolStyle.Diamond,
                Color          = Colors.Blue,
                Width          = 200,
                Height         = 200,
                Depth          = 200,
                AnchorPosition = SceneSymbolAnchorPosition.Center
            };

            var sphereSymbol = new SimpleMarkerSceneSymbol
            {
                Style          = SimpleMarkerSceneSymbolStyle.Sphere,
                Color          = Colors.Green,
                Width          = 200,
                Height         = 200,
                Depth          = 200,
                AnchorPosition = SceneSymbolAnchorPosition.Center
            };

            var tetrahedronSymbol = new SimpleMarkerSceneSymbol
            {
                Style          = SimpleMarkerSceneSymbolStyle.Tetrahedron,
                Color          = Colors.Lime,
                Width          = 200,
                Height         = 200,
                Depth          = 200,
                AnchorPosition = SceneSymbolAnchorPosition.Center
            };

            symbols[0] = coneSymbol;
            symbols[1] = cubeSymbol;
            symbols[2] = cylinderSymbol;
            symbols[3] = diamondSymbol;
            symbols[4] = sphereSymbol;
            symbols[5] = tetrahedronSymbol;

            //create graphics for each symbol
            var i = 0;

            foreach (SimpleMarkerSceneSymbol symbol in symbols)
            {
                var point   = new MapPoint(x + 0.01 * i, y, z, SpatialReferences.Wgs84);
                var graphic = new Graphic(point, symbol);
                graphicsOverlay.Graphics.Insert(i, graphic);
                i = i + 1;
            }
        }