/// <summary>Reset the MapView by removing any map rotation and centering on the existing Location. </summary> private async void resetDisplay_Click(object sender, RoutedEventArgs e) { try { // If the LocationDisplay is enabled and a Location currently exists, reset the map // to zero rotation and center on the Location. Otherwise, set the MapView to center on 0,0. if (MyMapView.LocationDisplay != null && MyMapView.LocationDisplay.IsEnabled && MyMapView.LocationDisplay.CurrentLocation != null && MyMapView.LocationDisplay.CurrentLocation.Location.Extent != null) { // Get the current AutoPanMode setting as it is automatically disabled when calling MyMapView.SetView(). var PanMode = MyMapView.LocationDisplay.AutoPanMode; MyMapView.SetRotation(0); await MyMapView.SetViewAsync(MyMapView.LocationDisplay.CurrentLocation.Location); // Reset the AutoPanMode MyMapView.LocationDisplay.AutoPanMode = PanMode; } else { var viewpoint = new Viewpoint(MyMapView.Map.Layers[0].FullExtent) { Rotation = 0.0 }; await MyMapView.SetViewAsync(viewpoint); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Sample Error"); } }
private void DetermineOverlapsInternal(IPhysicsEntity entity, Viewpoint viewpoint) { QueryOptions options = QueryOptions.None; if (entity.Background) options |= QueryOptions.Background; Vector3 center = entity.Center; if (entity.CornerCollision.Length == 1) { entity.CornerCollision[0] = new PointCollision(center, this.LevelManager.NearestTrile(center, options, new Viewpoint?(viewpoint))); } else { Vector3 vector3_1 = FezMath.RightVector(viewpoint); Vector3 vector3_2 = entity.Size / 2f - new Vector3(1.0 / 1000.0); if ((double) this.CollisionManager.GravityFactor < 0.0) vector3_2 *= new Vector3(1f, -1f, 1f); Vector3 vector3_3 = center + (vector3_1 + Vector3.Up) * vector3_2; entity.CornerCollision[0] = new PointCollision(vector3_3, this.LevelManager.NearestTrile(vector3_3, options, new Viewpoint?(viewpoint))); if (entity.CornerCollision[0].Instances.Deep == null && this.PlayerManager.CarriedInstance != null) { this.PlayerManager.CarriedInstance.PhysicsState.UpdatingPhysics = true; entity.CornerCollision[0] = new PointCollision(center, this.LevelManager.NearestTrile(center, options, new Viewpoint?(viewpoint))); this.PlayerManager.CarriedInstance.PhysicsState.UpdatingPhysics = false; } Vector3 vector3_4 = center + (vector3_1 + Vector3.Down) * vector3_2; entity.CornerCollision[1] = new PointCollision(vector3_4, this.LevelManager.NearestTrile(vector3_4, options, new Viewpoint?(viewpoint))); Vector3 vector3_5 = center + (-vector3_1 + Vector3.Up) * vector3_2; entity.CornerCollision[2] = new PointCollision(vector3_5, this.LevelManager.NearestTrile(vector3_5, options, new Viewpoint?(viewpoint))); Vector3 vector3_6 = center + (-vector3_1 + Vector3.Down) * vector3_2; entity.CornerCollision[3] = new PointCollision(vector3_6, this.LevelManager.NearestTrile(vector3_6, options, new Viewpoint?(viewpoint))); } }
private void Initialize() { // Create new Map with basemap Map myMap = new Map(Basemap.CreateImagery()); // Create initial map location and reuse the location for graphic MapPoint centralLocation = new MapPoint(-226773, 6550477, SpatialReferences.WebMercator); Viewpoint initialViewpoint = new Viewpoint(centralLocation, 7500); // Set initial viewpoint myMap.InitialViewpoint = initialViewpoint; // Provide used Map to the MapView _myMapView.Map = myMap; // Create overlay to where graphics are shown GraphicsOverlay overlay = new GraphicsOverlay(); // Add created overlay to the MapView _myMapView.GraphicsOverlays.Add(overlay); // Create a simple marker symbol SimpleMarkerSymbol simpleSymbol = new SimpleMarkerSymbol() { Color = Color.Red, Size = 10, Style = SimpleMarkerSymbolStyle.Circle }; // Add a new graphic with a central point that was created earlier Graphic graphicWithSymbol = new Graphic(centralLocation, simpleSymbol); overlay.Graphics.Add(graphicWithSymbol); }
private void Initialize() { // Create new map with a base map Map myMap = new Map(Basemap.CreateImageryWithLabels()); // Set the map view, map property to the base map MyMapView.Map = myMap; // Create a set of predefined bookmarks; each one follows the pattern of: // ~ Initialize a viewpoint pointing to a latitude longitude // ~ Create a new bookmark // ~ Give the bookmark a name // ~ Assign the viewpoint // ~ Add the bookmark to bookmark collection of the map // ~ Add the bookmark to the UI combo box for the user to choose from // Bookmark-1 Viewpoint myViewpoint1 = new Viewpoint(27.3805833, 33.6321389, 6000); Bookmark myBookmark1 = new Bookmark(); myBookmark1.Name = "Mysterious Desert Pattern"; myBookmark1.Viewpoint = myViewpoint1; MyMapView.Map.Bookmarks.Add(myBookmark1); bookmarkChooser.Items.Add(myBookmark1); // Bookmark-2 Viewpoint myViewpoint2 = new Viewpoint(37.401573, -116.867808, 6000); Bookmark myBookmark2 = new Bookmark(); myBookmark2.Name = "Strange Symbol"; myBookmark2.Viewpoint = myViewpoint2; MyMapView.Map.Bookmarks.Add(myBookmark2); bookmarkChooser.Items.Add(myBookmark2); // Bookmark-3 Viewpoint myViewpoint3 = new Viewpoint(-33.867886, -63.985, 40000); Bookmark myBookmark3 = new Bookmark(); myBookmark3.Name = "Guitar-Shaped Forest"; myBookmark3.Viewpoint = myViewpoint3; MyMapView.Map.Bookmarks.Add(myBookmark3); bookmarkChooser.Items.Add(myBookmark3); // Bookmark-4 Viewpoint myViewpoint4 = new Viewpoint(44.525049, -110.83819, 6000); Bookmark myBookmark4 = new Bookmark(); myBookmark4.Name = "Grand Prismatic Spring"; myBookmark4.Viewpoint = myViewpoint4; MyMapView.Map.Bookmarks.Add(myBookmark4); bookmarkChooser.Items.Add(myBookmark4); // Set the initial combo box selection to the lat bookmark added bookmarkChooser.SelectedItem = MyMapView.Map.Bookmarks.Last(); // Zoom to the last bookmark myMap.InitialViewpoint = myMap.Bookmarks.Last().Viewpoint; // Hide the controls for adding an additional bookmark BorderAddBookmark.Visibility = Visibility.Collapsed; }
private async void Initialize() { // This sample is only supported in x64 on UWP. if (!Environment.Is64BitProcess) { await new MessageDialog2("This sample is only supported for UWP in x64. Run the sample viewer in x64 to use this sample.", "Error").ShowAsync(); return; } // Create the scene. MySceneView.Scene = new Scene(new Basemap(new Uri("https://www.arcgis.com/home/item.html?id=1970c1995b8f44749f4b9b6e81b5ba45"))); // Create an envelope for the imagery. var pointForFrame = new MapPoint(-120.0724273439448, 35.131016955536694, SpatialReferences.Wgs84); var pacificEnvelope = new Envelope(pointForFrame, 15.09589635986124, -14.3770441522488); // Create a camera, looking at the pacific southwest sector. var observationPoint = new MapPoint(-116.621, 24.7773, 856977, SpatialReferences.Wgs84); var camera = new Camera(observationPoint, 353.994, 48.5495, 0); // Set the viewpoint of the scene to this camera. var pacificViewpoint = new Viewpoint(observationPoint, camera); MySceneView.Scene.InitialViewpoint = pacificViewpoint; // Create an image overlay and add it ot the scene.. _imageOverlay = new ImageOverlay(); MySceneView.ImageOverlays.Add(_imageOverlay); // Create an array of the image filepaths. var imageFolder = Path.Combine(DataManager.GetDataFolder("9465e8c02b294c69bdb42de056a23ab1"), "PacificSouthWest"); string[] imagePaths = Directory.GetFiles(imageFolder); // The paths need to be sorted alphabetically on some file systems. Array.Sort(imagePaths); // Create all of the image frames using the filepaths and the envelope. _images = imagePaths.Select(path => new ImageFrame(new Uri(path), pacificEnvelope)).ToArray(); // Create new Timer and set the timeout interval to approximately 15 image frames per second. _timer = new Timer(AnimateOverlay); _timer.Change(0, 1000 / 15); // Populate the combobox for selecting speed. SpeedComboBox.ItemsSource = new string[] { "Slow", "Medium", "Fast" }; SpeedComboBox.SelectedIndex = 0; // Set an event to stop the animation when the sample is unloaded. Unloaded += (s, e) => { _animationStopped = true; _timer.Dispose(); }; }
/// <summary> /// Function used to keep the overlaid preview area marker in position. /// This is called by MyMapView_ViewpointChanged every time the user pans/zooms /// and updates the red box graphic to outline 80% of the current view. /// </summary> private void UpdateMapExtentGraphic() { // Return if mapview is null. if (_myMapView == null) { return; } // Get the new viewpoint. Viewpoint myViewPoint = _myMapView.GetCurrentViewpoint(ViewpointType.BoundingGeometry); // Return if viewpoint is null. if (myViewPoint == null) { return; } // Get the updated extent for the new viewpoint. Envelope extent = myViewPoint.TargetGeometry as Envelope; // Return if extent is null. if (extent == null) { return; } // Create an envelope that is a bit smaller than the extent. EnvelopeBuilder envelopeBldr = new EnvelopeBuilder(extent); envelopeBldr.Expand(0.80); // Get the (only) graphics overlay in the map view. GraphicsOverlay extentOverlay = _myMapView.GraphicsOverlays.FirstOrDefault(); // Return if the extent overlay is null. if (extentOverlay == null) { return; } // Get the extent graphic. Graphic extentGraphic = extentOverlay.Graphics.FirstOrDefault(); // Create the extent graphic and add it to the overlay if it doesn't exist and the sample is not in preview. if (extentGraphic == null) { extentGraphic = new Graphic(envelopeBldr.ToGeometry()); extentOverlay.Graphics.Add(extentGraphic); } else { // Otherwise, update the graphic's geometry. extentGraphic.Geometry = envelopeBldr.ToGeometry(); } }
private void Initialize() { // Create a new map with a World Imagery base map Map myMap = new Map(Basemap.CreateImageryWithLabels()); // Add the map to the MapView _myMapView.Map = myMap; // Create a set of predefined bookmarks; each one follows the pattern of: // ~ Initialize a viewpoint pointing to a latitude longitude // ~ Create a new bookmark // ~ Give the bookmark a name // ~ Assign the viewpoint // ~ Add the bookmark to bookmark collection of the map // Bookmark-1 Viewpoint myViewpoint1 = new Viewpoint(27.3805833, 33.6321389, 6000); Bookmark myBookmark1 = new Bookmark { Name = "Mysterious Desert Pattern", Viewpoint = myViewpoint1 }; _myMapView.Map.Bookmarks.Add(myBookmark1); // Bookmark-2 Viewpoint myViewpoint2 = new Viewpoint(-39.299987, 174.060858, 600000); Bookmark myBookmark2 = new Bookmark { Name = "Dormant Volcano", Viewpoint = myViewpoint2 }; _myMapView.Map.Bookmarks.Add(myBookmark2); // Bookmark-3 Viewpoint myViewpoint3 = new Viewpoint(-33.867886, -63.985, 40000); Bookmark myBookmark3 = new Bookmark { Name = "Guitar-Shaped Forest", Viewpoint = myViewpoint3 }; _myMapView.Map.Bookmarks.Add(myBookmark3); // Bookmark-4 Viewpoint myViewpoint4 = new Viewpoint(44.525049, -110.83819, 6000); Bookmark myBookmark4 = new Bookmark { Name = "Grand Prismatic Spring", Viewpoint = myViewpoint4 }; _myMapView.Map.Bookmarks.Add(myBookmark4); }
private async void MyMapView_GeoViewTapped(object sender, Esri.ArcGISRuntime.UI.Controls.GeoViewInputEventArgs e) { DataContext = this; // search var tapPoint = e.Location; var buffer = GeometryEngine.Buffer(tapPoint, 10); QueryParameters query = new QueryParameters(); query.Geometry = buffer; var results = await fLayer.FeatureTable.QueryFeaturesAsync(query); if (results.Count() > 0) { chartValues = new ChartValues <ObservableChartMapPoint>(); var firstResult = results.First(); var randoGeom = firstResult.Geometry as Esri.ArcGISRuntime.Geometry.Polyline; randoTitle = firstResult.Attributes["NOM"].ToString(); Camera cam = new Camera(firstResult.Geometry.Extent.GetCenter(), 4200, myMapView.MapRotation, 55, 0); var viewPoint = new Viewpoint(firstResult.Geometry, cam); //scen myMapView.SetViewpointAsync(viewPoint, System.TimeSpan.FromMilliseconds(4000)); mySceneView.SetViewpointAsync(viewPoint, System.TimeSpan.FromMilliseconds(4000)); var i = 0; double distance = 0; MapPoint lastPoint = null; foreach (var part in randoGeom.Parts) { foreach (var point in part.Points) { // si on est pas sur le premier point if (i > 0) { distance += GeometryEngine.DistanceGeodetic(lastPoint, point, LinearUnits.Kilometers, AngularUnits.Degrees, GeodeticCurveType.Geodesic).Distance; } // sauvegrde du point pour distance. lastPoint = point; // on ne prend pas tous les points. if (i % 2 == 0) { double elevation = await sceneSurface.GetElevationAsync(point); chartValues.Add(new ObservableChartMapPoint(Math.Round(distance, 4), elevation, point)); } i++; } } // charts } // zoom on both scene+mapview }
private GraphicsOverlay CreateGraphicsOverlayfromGraphicsList(IList <Graphic> graphics) { var graphicslayer = new GraphicsOverlay(); graphicslayer.IsPopupEnabled = true; graphics.ToList().ForEach(x => graphicslayer.Graphics.Add(x)); graphicslayer.Renderer = defaultRenderer; graphicsExtent = setGraphicsOverlayExtent(graphics.Where(x => x.Geometry != null) .Select(x => (MapPoint)(x.Geometry)).ToList()); return(graphicslayer); }
// Save the current map to ArcGIS Online. The initial extent, title, description, and tags are passed in. public async Task SaveNewMapAsync(Viewpoint initialViewpoint, string title, string description, string[] tags, RuntimeImage img) { // Get the ArcGIS Online portal ArcGISPortal agsOnline = await ArcGISPortal.CreateAsync(new Uri("https://www.arcgis.com/sharing/rest")); // Set the map's initial viewpoint using the extent (viewpoint) passed in _map.InitialViewpoint = initialViewpoint; // Save the current state of the map as a portal item in the user's default folder await _map.SaveAsAsync(agsOnline, null, title, description, tags, img, false); }
private void Initialize() { // Define the route stop locations (points) MapPoint fromPoint = new MapPoint(-117.15494348793044, 32.706506537686927, SpatialReferences.Wgs84); MapPoint toPoint = new MapPoint(-117.14905088669816, 32.735308180609138, SpatialReferences.Wgs84); // Create Stop objects with the points and add them to a list of stops Stop stop1 = new Stop(fromPoint); Stop stop2 = new Stop(toPoint); _routeStops = new List <Stop> { stop1, stop2 }; // Picture marker symbols: from = car, to = checkered flag PictureMarkerSymbol carSymbol = new PictureMarkerSymbol(_carIconUri); PictureMarkerSymbol flagSymbol = new PictureMarkerSymbol(_checkedFlagIconUri); // Add a slight offset (pixels) to the picture symbols. carSymbol.OffsetX = -carSymbol.Width / 2; carSymbol.OffsetY = -carSymbol.Height / 2; flagSymbol.OffsetX = -flagSymbol.Width / 2; flagSymbol.OffsetY = -flagSymbol.Height / 2; // Create graphics for the stops Graphic fromGraphic = new Graphic(fromPoint, carSymbol) { ZIndex = 1 }; Graphic toGraphic = new Graphic(toPoint, flagSymbol) { ZIndex = 1 }; // Create the graphics overlay and add the stop graphics _routeGraphicsOverlay = new GraphicsOverlay(); _routeGraphicsOverlay.Graphics.Add(fromGraphic); _routeGraphicsOverlay.Graphics.Add(toGraphic); // Get an Envelope that covers the area of the stops (and a little more) Envelope routeStopsExtent = new Envelope(fromPoint, toPoint); EnvelopeBuilder envBuilder = new EnvelopeBuilder(routeStopsExtent); envBuilder.Expand(1.5); // Create a new viewpoint apply it to the map view when the spatial reference changes Viewpoint sanDiegoViewpoint = new Viewpoint(envBuilder.ToGeometry()); MyMapView.SpatialReferenceChanged += (s, e) => MyMapView.SetViewpoint(sanDiegoViewpoint); // Add a new Map and the graphics overlay to the map view MyMapView.Map = new Map(Basemap.CreateStreetsVector()); MyMapView.GraphicsOverlays.Add(_routeGraphicsOverlay); }
public Task <bool> SetViewAsync(Viewpoint viewPoint) { var mapView = MapView; if (mapView != null && viewPoint != null) { return(mapView.SetViewAsync(viewPoint)); } return(Task.FromResult(false)); }
private async void Initialize() { try { // Starting viewpoint for the map view. Viewpoint _startingViewpoint = new Viewpoint(new Envelope(-9812691.11079696, 5128687.20710657, -9812377.9447607, 5128865.36767282, SpatialReferences.WebMercator)); // Create the map. MyMapView.Map = new Map(Basemap.CreateStreetsNightVector()) { InitialViewpoint = _startingViewpoint }; // NOTE: This layer supports any ArcGIS Feature Table that define subtypes. SubtypeFeatureLayer subtypeFeatureLayer = new SubtypeFeatureLayer(new ServiceFeatureTable(new Uri("https://sampleserver7.arcgisonline.com/arcgis/rest/services/UtilityNetwork/NapervilleElectric/FeatureServer/100"))); MyMapView.Map.OperationalLayers.Add(subtypeFeatureLayer); // Select sublayer to control. await subtypeFeatureLayer.LoadAsync(); // Select the sublayer of street lights by name. _sublayer = subtypeFeatureLayer.GetSublayerBySubtypeName("Street Light"); // Set the label definitions using the JSON. _sublayer.LabelDefinitions.Add(LabelDefinition.FromJson(_labelJSON)); // Enable labels for the sub layer. _sublayer.LabelsEnabled = true; // Set the data context for data-binding in XAML. SublayerInfo.DataContext = _sublayer; // Get the default renderer for the sublayer. _defaultRenderer = _sublayer.Renderer.Clone(); // Create a custom renderer for the sublayer. _customRenderer = new SimpleRenderer() { Symbol = new SimpleMarkerSymbol() { Color = Color.Salmon, Style = SimpleMarkerSymbolStyle.Diamond, Size = 20, } }; // Set a default minimum scale. _sublayer.MinScale = 3000; } catch (Exception ex) { MessageBox.Show(ex.Message, ex.GetType().Name, MessageBoxButton.OK, MessageBoxImage.Error); } }
private void MapViewModel_RequestViewpoint(object sender, Viewpoint viewpoint) { var envelope = viewpoint.TargetGeometry.Extent; if (envelope.Height > 0) { envelope = new Esri.ArcGISRuntime.Geometry.Envelope(envelope.XMin, envelope.YMin - envelope.Height * (64 / _mapView.Bounds.Height), envelope.XMax, envelope.YMax, envelope.SpatialReference); } _mapView.SetViewpointGeometryAsync(envelope, 100); }
private async void LoadFeatureLayer() { MapPoint centralPoint = new MapPoint(-117.452684, 33.903562, SpatialReferences.Wgs84); Viewpoint startingViewpoint = new Viewpoint(centralPoint, 10000); Map.InitialViewpoint = startingViewpoint; featureLayer = new FeatureLayer(new Uri(uri)); await featureLayer.LoadAsync(); Map.OperationalLayers.Add(featureLayer); }
private async void ViewButton_Click(object sender, RoutedEventArgs e) { //Change button to 2D or 3D when button is clicked ViewButton.Content = FindResource(ViewButton.Content == FindResource("3D") ? "2D" : "3D"); if (ViewButton.Content == FindResource("2D")) { threeD = true; if (myScene == null) { //Create a new scene myScene = new Scene(Basemap.CreateNationalGeographic()); sceneView.Scene = myScene; // create an elevation source var elevationSource = new ArcGISTiledElevationSource(new System.Uri(ELEVATION_IMAGE_SERVICE)); // create a surface and add the elevation surface var sceneSurface = new Surface(); sceneSurface.ElevationSources.Add(elevationSource); // apply the surface to the scene sceneView.Scene.BaseSurface = sceneSurface; //Exercise 3: Open mobie map package (.mmpk) and add its operational layers to the scene var mmpk = await MobileMapPackage.OpenAsync(MMPK_PATH); if (mmpk.Maps.Count >= 0) { myMap = mmpk.Maps[0]; LayerCollection layerCollection = myMap.OperationalLayers; for (int i = 0; i < layerCollection.Count(); i++) { var thelayer = layerCollection[i]; myMap.OperationalLayers.Clear(); myScene.OperationalLayers.Add(thelayer); sceneView.SetViewpoint(myMap.InitialViewpoint); //Rotate the camera Viewpoint viewpoint = sceneView.GetCurrentViewpoint(ViewpointType.CenterAndScale); Esri.ArcGISRuntime.Geometry.MapPoint targetPoint = (MapPoint)viewpoint.TargetGeometry; Camera camera = sceneView.Camera.RotateAround(targetPoint, 45.0, 65.0, 0.0); await sceneView.SetViewpointCameraAsync(camera); } sceneView.Scene = myScene; } } //Exercise 1 Once the scene has been created hide the mapView and show the sceneView mapView.Visibility = Visibility.Hidden; sceneView.Visibility = Visibility.Visible; } else { threeD = false; sceneView.Visibility = Visibility.Hidden; mapView.Visibility = Visibility.Visible; } }
public void bit条件_単一エージェント狼狂_2() { Viewpoint viewpoint = new Viewpoint(gameSetting15, gameInfo15); BitCondition con = new BitCondition(); con.AddWerewolf(Agent.GetAgent(1)); con.AddPossessed(Agent.GetAgent(1)); viewpoint.RemoveMatchPattern(con); Assert.AreEqual(viewpoint.MonsterSidePattern.Count, 5460); }
private static Vector3D GetViewUp(Viewpoint v) { Rotation3D oRot = v.Rotation; // calculate view direction Rotation3D oNegtiveZ = new Rotation3D(0, 1, 0, 0); Rotation3D otempRot = MultiplyRotation3D(oNegtiveZ, oRot.Invert()); Rotation3D oViewDirRot = MultiplyRotation3D(oRot, otempRot); // get view direction Vector3D oViewDir = new Vector3D(oViewDirRot.A, oViewDirRot.B, oViewDirRot.C); return(oViewDir.Normalize()); }
public void CollideRectangle(Vector3 position, Vector3 impulse, Vector3 size, QueryOptions options, float elasticity, Viewpoint viewpoint, out MultipleHits<CollisionResult> horizontalResults, out MultipleHits<CollisionResult> verticalResults) { Vector3 impulse1 = viewpoint == Viewpoint.Front || viewpoint == Viewpoint.Back ? new Vector3(impulse.X, 0.0f, 0.0f) : new Vector3(0.0f, 0.0f, impulse.Z); Vector3 impulse2 = new Vector3(0.0f, impulse.Y, 0.0f); Vector3 halfSize = size / 2f; horizontalResults = this.CollideEdge(position, impulse1, halfSize, Direction2D.Horizontal, options, elasticity, viewpoint); verticalResults = this.CollideEdge(position, impulse2, halfSize, Direction2D.Vertical, options, elasticity, viewpoint); if ((options & QueryOptions.Simple) == QueryOptions.Simple || BoxCollisionResultExtensions.AnyCollided(horizontalResults) || BoxCollisionResultExtensions.AnyCollided(verticalResults)) return; horizontalResults = this.CollideEdge(position + impulse2, impulse1, halfSize, Direction2D.Horizontal, options, elasticity, viewpoint); verticalResults = this.CollideEdge(position + impulse1, impulse2, halfSize, Direction2D.Vertical, options, elasticity, viewpoint); }
private async void Initialize() { try { // Starting viewpoint for the map view. Viewpoint _startingViewpoint = new Viewpoint(new Envelope(-9812691.11079696, 5128687.20710657, -9812377.9447607, 5128865.36767282, SpatialReferences.WebMercator)); // Create the map. MyMapView.Map = new Map(Basemap.CreateStreetsNightVector()) { InitialViewpoint = _startingViewpoint }; // NOTE: This layer supports any ArcGIS Feature Table that define subtypes. SubtypeFeatureLayer subtypeFeatureLayer = new SubtypeFeatureLayer(new ServiceFeatureTable(new Uri("https://sampleserver7.arcgisonline.com/arcgis/rest/services/UtilityNetwork/NapervilleElectric/FeatureServer/100"))); MyMapView.Map.OperationalLayers.Add(subtypeFeatureLayer); // Select sublayer to control. await subtypeFeatureLayer.LoadAsync(); // Select the sublayer of street lights by name. _sublayer = subtypeFeatureLayer.GetSublayerBySubtypeName("Street Light"); // Set the label definitions using the JSON. _sublayer.LabelDefinitions.Add(LabelDefinition.FromJson(_labelJSON)); // Enable labels for the sub layer. _sublayer.LabelsEnabled = true; // Get the default renderer for the sublayer. _defaultRenderer = _sublayer.Renderer.Clone(); // Create a custom renderer for the sublayer. _customRenderer = new SimpleRenderer() { Symbol = new SimpleMarkerSymbol() { Color = System.Drawing.Color.Salmon, Style = SimpleMarkerSymbolStyle.Diamond, Size = 20, } }; // Update the UI for displaying the current map scale. MyMapView.PropertyChanged += MapViewPropertyChanged; MapScaleLabel.Text = $"Current map scale: 1:{(int)MyMapView.MapScale}"; } catch (Exception ex) { await Application.Current.MainPage.DisplayAlert(ex.GetType().Name, ex.Message, "OK"); } }
private bool AnimatePlane() { // Skip doing anything if animation is paused, or if inset map view is closed if (!_animationTimer || double.IsNaN(InsetMapView.MapScale)) { return true; } // Get the next position; % prevents going out of bounds even if the keyframe value is // changed unexpectedly (e.g. due to user interaction with the progress slider). MissionFrame currentFrame = _missionData[_keyframe % _frameCount]; // Update the UI double missionProgress = _keyframe / (double)_frameCount; // This is needed because the event could be running on a non-UI thread Device.BeginInvokeOnMainThread(() => { // Update the progress slider; temporarily remove event subscription to avoid feedback loop MissionProgressBar.ValueChanged -= MissionProgressOnSeek; MissionProgressBar.Value = missionProgress * 100; MissionProgressBar.ValueChanged += MissionProgressOnSeek; // Update stats display AltitudeLabel.Text = $"{currentFrame.Elevation:F}m"; HeadingLabel.Text = $"{currentFrame.Heading:F}°"; PitchLabel.Text = $"{currentFrame.Pitch:F}°"; RollLabel.Text = $"{currentFrame.Pitch:F}°"; }); // Update plane's position _plane3D.Geometry = currentFrame.ToMapPoint(); _plane3D.Attributes["HEADING"] = currentFrame.Heading; _plane3D.Attributes["PITCH"] = currentFrame.Pitch; _plane3D.Attributes["ROLL"] = currentFrame.Roll; // Update the inset map; plane symbol position _plane2D.Geometry = currentFrame.ToMapPoint(); // Update inset's viewpoint and heading Viewpoint vp = new Viewpoint(currentFrame.ToMapPoint(), InsetMapView.MapScale, 360 + (float)currentFrame.Heading); InsetMapView.SetViewpoint(vp); // Update the keyframe. This advances the animation _keyframe++; // Restart the animation if it has finished if (_keyframe >= _frameCount) { _keyframe = 0; } // Keep the animation event going return true; }
public override void Initialize() { this.InterpolationSpeed = 10f; this.ResetViewpoints(); this.viewpoint = Viewpoint.Right; this.current = this.predefinedViews[Viewpoint.Right]; this.SnapInterpolation(); this.GraphicsService.DeviceReset += (EventHandler <EventArgs>) delegate { this.PixelsPerTrixel = this.pixelsPerTrixel; this.RebuildProjection(); }; }
public async Task <Viewpoint> GetViewpoint(string project_id, string topic_guid, string viewpoint_guid) { Viewpoint viewpoint = null; string path = String.Format("projects/{0}/topics/{1}/viewpoints/{2}", project_id, topic_guid, viewpoint_guid); HttpResponseMessage response = await _client.GetAsync(path); if (response.IsSuccessStatusCode) { viewpoint = await response.Content.ReadAsAsync <Viewpoint>(); } return(viewpoint); }
public void AlterTransition(Viewpoint newTo) { Viewpoint rotatedView = FezMath.GetRotatedView(FezMath.AsViewpoint(FezMath.OrientationFromDirection(this.directionTransition.Points[0])), FezMath.GetDistance(FezMath.AsViewpoint(FezMath.OrientationFromDirection(this.directionTransition.Points[2])), newTo)); Vector3 from = this.predefinedViews[rotatedView].Direction; Vector3 to = this.predefinedViews[newTo].Direction; this.directionTransition.Points[0] = from; this.directionTransition.Points[1] = DefaultCameraManager.GetIntemediateVector(from, to); this.directionTransition.Points[2] = to; this.current = this.predefinedViews[newTo]; this.lastViewpoint = rotatedView; this.viewpoint = newTo; }
public GuessResult Exec(GuessStrategyArgs args, Viewpoint vp) { // 推理戦略の更新処理 GuessStrategy.Update(args); // 戦略から部分内訳に対する推理リストを取得 List <PartGuess> guessList = GuessStrategy.IsSuccess() ? GuessStrategy.GetGuess() : new List <PartGuess>(); // 推理結果の集計を取得 GuessResult result = GetResult(args, guessList, vp); return(result); }
private async void Initialize() { // Create the map. Map myMap = new Map(Basemap.CreateImageryWithLabels()); // Create a point in the Greenwich observatory courtyard in London, UK, the location of the prime meridian. _originalPoint = new MapPoint(538985.355, 177329.516, SpatialReference.Create(27700)); // Set the initial extent to an extent centered on the point. Viewpoint initialViewpoint = new Viewpoint(_originalPoint, 5000); myMap.InitialViewpoint = initialViewpoint; // Load the map and add the map to the map view. await myMap.LoadAsync(); MyMapView.Map = myMap; // Create a graphics overlay to hold the original and projected points. _pointsOverlay = new GraphicsOverlay(); MyMapView.GraphicsOverlays.Add(_pointsOverlay); // Add the point as a graphic with a blue square. SimpleMarkerSymbol markerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Square, Colors.Blue, 15); Graphic originalGraphic = new Graphic(_originalPoint, markerSymbol); _pointsOverlay.Graphics.Add(originalGraphic); // Get the path to the projection engine data (if it exists). string peFolderPath = GetProjectionDataPath(); if (!String.IsNullOrEmpty(peFolderPath)) { TransformationCatalog.ProjectionEngineDirectory = peFolderPath; MessagesTextBox.Text = "Using projection data found at '" + peFolderPath + "'"; } else { MessagesTextBox.Text = "Projection engine data not found."; } // Show the input and output spatial reference. InSpatialRefTextBox.Text = "In WKID = " + _originalPoint.SpatialReference.Wkid; OutSpatialRefTextBox.Text = "Out WKID = " + myMap.SpatialReference.Wkid; // Set up the UI. TransformationsListBox.ItemsSource = SuitableTransformationsList; // Create a list of transformations to fill the UI list box. GetSuitableTransformations(_originalPoint.SpatialReference, myMap.SpatialReference, UseExtentSwitch.IsToggled); }
private async void OnButtonClick(object sender, RoutedEventArgs e) { try { // Get .Content from the selected item Button myButton = (Button)sender; string selectedMapTitle = myButton.Content.ToString(); switch (selectedMapTitle) { case "Geometry": // Set Viewpoint using Redlands envelope defined above and a padding of 20 await MyMapView.SetViewpointGeometryAsync(_redlandsEnvelope, 20); break; case "Center and Scale": // Set Viewpoint so that it is centered on the London coordinates defined above await MyMapView.SetViewpointCenterAsync(_londonCoords); // Set the Viewpoint scale to match the specified scale await MyMapView.SetViewpointScaleAsync(_londonScale); break; case "Animate": // Navigate to full extent of the first baselayer before animating to specified geometry await MyMapView.SetViewpointAsync( new Viewpoint(MyMapView.Map.Basemap.BaseLayers.First().FullExtent)); // Create a new Viewpoint using the specified geometry Viewpoint viewpoint = new Viewpoint(_edinburghEnvelope); // Set Viewpoint of MapView to the Viewpoint created above and animate to it using a timespan of 5 seconds await MyMapView.SetViewpointAsync(viewpoint, TimeSpan.FromSeconds(5)); break; default: break; } } catch (Exception ex) { await new MessageDialog2(ex.ToString(), "Error").ShowAsync(); } }
/// <summary> /// Get View Normal /// </summary> /// <param name="oVP"></param> /// <returns></returns> private Vector3D getViewUp(Viewpoint oVP) { double units = GetGunits(); Rotation3D oRot = oVP.Rotation; // calculate view direction Rotation3D oNegtiveZ = new Rotation3D(0, 1, 0, 0); Rotation3D otempRot = MultiplyRotation3D(oNegtiveZ, oRot.Invert()); Rotation3D oViewDirRot = MultiplyRotation3D(oRot, otempRot); // get view direction Vector3D oViewDir = new Vector3D(oViewDirRot.A, oViewDirRot.B, oViewDirRot.C); return(oViewDir.Normalize()); }
private async void Initialize() { // Assign a new map to the MapView _myMapView.Map = new Map { // Set the basemap to Streets Basemap = Basemap.CreateStreets() }; // Create a new image service raster from the Uri ImageServiceRaster myImageServiceRaster = new ImageServiceRaster(_myUri); try { // Load the image service raster await myImageServiceRaster.LoadAsync(); // Get the ArcGIS image service info (metadata) from the image service raster ArcGISImageServiceInfo myArcGISImageServiceInfo = myImageServiceRaster.ServiceInfo; // Get the full extent envelope of the image service raster (the Charlotte, NC area) Envelope myEnvelope = myArcGISImageServiceInfo.FullExtent; // Define a new view point from the full extent envelope Viewpoint myViewPoint = new Viewpoint(myEnvelope); // Zoom to the area of the full extent envelope of the image service raster await _myMapView.SetViewpointAsync(myViewPoint); // Get the rendering rule info (i.e. definitions of how the image should be drawn) info from the image service raster _myReadOnlyListRenderRuleInfos = myArcGISImageServiceInfo.RenderingRuleInfos; // Loop through each rendering rule info foreach (RenderingRuleInfo myRenderingRuleInfo in _myReadOnlyListRenderRuleInfos) { // Get the name of the rendering rule info string myRenderingRuleName = myRenderingRuleInfo.Name; // Add the name of the rendering rule info to the list of names _names.Add(myRenderingRuleName); } // Invoke the button for the user to change the rendering rule of the image service raster OnChangeRenderingRuleClicked(_renderingRulesButton, null); } catch (Exception e) { new AlertDialog.Builder(this).SetMessage(e.ToString()).SetTitle("Error").Show(); } }
private async void Initialize() { // Assign a new map to the MapView MyMapView.Map = new Map { // Set the basemap to Streets Basemap = new Basemap(BasemapStyle.ArcGISStreets) }; // Create a new image service raster from the Uri ImageServiceRaster myImageServiceRaster = new ImageServiceRaster(_myUri); try { // Load the image service raster await myImageServiceRaster.LoadAsync(); // Get the ArcGIS image service info (metadata) from the image service raster ArcGISImageServiceInfo myArcGISImageServiceInfo = myImageServiceRaster.ServiceInfo; // Get the full extent envelope of the image service raster (the Charlotte, NC area) Envelope myEnvelope = myArcGISImageServiceInfo.FullExtent; // Define a new view point from the full extent envelope Viewpoint myViewPoint = new Viewpoint(myEnvelope); // Zoom to the area of the full extent envelope of the image service raster await MyMapView.SetViewpointAsync(myViewPoint); // Get the rendering rule info (i.e. definitions of how the image should be drawn) info from the image service raster _myReadOnlyListRenderRuleInfos = myArcGISImageServiceInfo.RenderingRuleInfos; // Loop through each rendering rule info foreach (RenderingRuleInfo myRenderingRuleInfo in _myReadOnlyListRenderRuleInfos) { // Get the name of the rendering rule info string myRenderingRuleName = myRenderingRuleInfo.Name; // Add the name of the rendering rule info to the combo box RenderingRuleChooser.Items.Add(myRenderingRuleName); } // Set the combo box index to the first rendering rule info name RenderingRuleChooser.SelectedIndex = 0; } catch (Exception e) { MessageBox.Show(e.ToString(), "Error"); } }
public void and条件_複数エージェント狼() { for (int i = 0; i < loop; i++) { Viewpoint viewpoint = new Viewpoint(gameSetting15, gameInfo15); AndCondition con = new AndCondition(); con.AddCondition(RoleCondition.GetCondition(Agent.GetAgent(1), Role.WEREWOLF)); con.AddCondition(RoleCondition.GetCondition(Agent.GetAgent(2), Role.WEREWOLF)); viewpoint.RemoveMatchPattern(con); Assert.AreEqual(viewpoint.MonsterSidePattern.Count, 5304); } }
/// <summary> /// Sets the initial view point based on user settings. /// </summary> /// <returns>Async task</returns> internal async Task SetInitialViewPointAsync() { // Get initial viewpoint from settings // If error occurs, do not set an initial viewpoint double x = 0, y = 0, wkid = 0, zoomLevel = 0; try { for (int i = 0; i < AppSettings.CurrentSettings.InitialViewpointCoordinates.Length; i++) { switch (AppSettings.CurrentSettings.InitialViewpointCoordinates[i].Key) { case "X": x = AppSettings.CurrentSettings.InitialViewpointCoordinates[i].Value; break; case "Y": y = AppSettings.CurrentSettings.InitialViewpointCoordinates[i].Value; break; case "WKID": wkid = AppSettings.CurrentSettings.InitialViewpointCoordinates[i].Value; break; case "ZoomLevel": zoomLevel = AppSettings.CurrentSettings.InitialViewpointCoordinates[i].Value; break; } } // Location based, location services are on // Home settings, location services are off but user has a home set // Default setting, Location services are off and user has no home set if (!AppSettings.CurrentSettings.IsLocationServicesEnabled) { Viewpoint = new Viewpoint(new MapPoint(x, y, new SpatialReference(Convert.ToInt32(wkid))), zoomLevel); } } catch { // Supress all errors since. // If initial viewpoint cannot be set, the map will just load to the default extent of the mmpk } finally { // Set minimum and maximum scale for the map Map.MaxScale = AppSettings.CurrentSettings.MapViewMinScale; Map.MinScale = AppSettings.CurrentSettings.MapViewMaxScale; } }
private async void Initialize() { // Assign a new map to the MapView MyMapView.Map = new Map { // Set the basemap to Streets Basemap = new Basemap(BasemapStyle.ArcGISStreets) }; // Create a new image service raster from the Uri ImageServiceRaster myImageServiceRaster = new ImageServiceRaster(_myUri); try { // Load the image service raster await myImageServiceRaster.LoadAsync(); // Get the ArcGIS image service info (metadata) from the image service raster ArcGISImageServiceInfo myArcGISImageServiceInfo = myImageServiceRaster.ServiceInfo; // Get the full extent envelope of the image service raster (the Charlotte, NC area) Envelope myEnvelope = myArcGISImageServiceInfo.FullExtent; // Define a new view point from the full extent envelope Viewpoint myViewPoint = new Viewpoint(myEnvelope); // Zoom to the area of the full extent envelope of the image service raster await MyMapView.SetViewpointAsync(myViewPoint); // Get the rendering rule info (i.e. definitions of how the image should be drawn) info from the image service raster _myReadOnlyListRenderRuleInfos = myArcGISImageServiceInfo.RenderingRuleInfos; // Loop through each rendering rule info foreach (RenderingRuleInfo myRenderingRuleInfo in _myReadOnlyListRenderRuleInfos) { // Get the name of the rendering rule info string myRenderingRuleName = myRenderingRuleInfo.Name; // Add the name of the rendering rule info into the list of names _names.Add(myRenderingRuleName); } // Call the function to display the image service raster based up on user choice of rendering rules await ChangeRenderingRuleAsync(); } catch (Exception e) { await Application.Current.MainPage.DisplayAlert("Error", e.ToString(), "OK"); } }
public void bit条件_複数エージェント狼() { for (int i = 0; i < loop; i++) { Viewpoint viewpoint = new Viewpoint(gameSetting15, gameInfo15); BitCondition con = new BitCondition(); con.AddWerewolf(Agent.GetAgent(1)); con.AddWerewolf(Agent.GetAgent(2)); viewpoint.RemoveMatchPattern(con); Assert.AreEqual(viewpoint.MonsterSidePattern.Count, 5304); } }
public static bool IsOrthographic(this Viewpoint view) { switch (view) { case Viewpoint.Front: case Viewpoint.Right: case Viewpoint.Back: case Viewpoint.Left: return(true); default: return(false); } }
//Add some default bookmarks private void AddDefaultBookmarks() { Viewpoint vp; Bookmark myBookmark; // Bookmark-1 // Initialize a viewpoint pointing to a latitude longitude vp = new Viewpoint(27.3805833, 33.6321389, 6000); // Create a new bookmark myBookmark = new Bookmark(); myBookmark.Name = "Mysterious Desert Pattern"; // Assign the viewpoint myBookmark.Viewpoint = vp; // Add the bookmark to bookmark collection of the map _myMapView.Map.Bookmarks.Add(myBookmark); // Bookmark-2 vp = new Viewpoint(37.401573, -116.867808, 6000); myBookmark = new Bookmark(); myBookmark.Name = "Strange Symbol"; myBookmark.Viewpoint = vp; _myMapView.Map.Bookmarks.Add(myBookmark); // Bookmark-3 vp = new Viewpoint(-33.867886, -63.985, 40000); myBookmark = new Bookmark(); myBookmark.Name = "Guitar-Shaped Forest"; myBookmark.Viewpoint = vp; _myMapView.Map.Bookmarks.Add(myBookmark); // Bookmark-4 vp = new Viewpoint(44.525049, -110.83819, 6000); myBookmark = new Bookmark(); myBookmark.Name = "Grand Prismatic Spring"; myBookmark.Viewpoint = vp; _myMapView.Map.Bookmarks.Add(myBookmark); }
private void Initialize() { // Create new Map with Streets basemap Map myMap = new Map(Basemap.CreateStreets()); // Set the scale at which this layer can be viewed // MinScale defines how far 'out' you can zoom where // MaxScale defines how far 'in' you can zoom. myMap.MinScale = 8000; myMap.MaxScale = 2000; // Create central point where map is centered MapPoint centralPoint = new MapPoint(-355453, 7548720, SpatialReferences.WebMercator); // Create starting viewpoint Viewpoint startingViewpoint = new Viewpoint( centralPoint, 3000); // Set starting viewpoint myMap.InitialViewpoint = startingViewpoint; // Assign the map to the MapView MyMapView.Map = myMap; }
public MultipleHits<CollisionResult> CollideEdge(Vector3 position, Vector3 impulse, Vector3 halfSize, Direction2D direction, QueryOptions options, float elasticity, Viewpoint viewpoint) { MultipleHits<CollisionResult> multipleHits = new MultipleHits<CollisionResult>(); if (impulse == Vector3.Zero) return multipleHits; bool flag = (options & QueryOptions.Simple) == QueryOptions.Simple; Vector3 vector3_1 = new Vector3((float) Math.Sign(impulse.X), (float) Math.Sign(impulse.Y), (float) Math.Sign(impulse.Z)); if (!flag) { Vector3 position1 = position; Vector3 position2 = position; switch (direction) { case Direction2D.Horizontal: position1 += (vector3_1 + Vector3.Down) * halfSize; position2 += (vector3_1 + Vector3.Up) * halfSize; break; case Direction2D.Vertical: Vector3 vector3_2 = FezMath.RightVector(viewpoint) * (float) FezMath.Sign(this.PlayerManager.LookingDirection); position1 += (vector3_1 - vector3_2) * halfSize; position2 += (vector3_1 + vector3_2) * halfSize; break; } multipleHits.NearLow = this.CollidePoint(position1, impulse, options, elasticity, viewpoint); multipleHits.FarHigh = this.CollidePoint(position2, impulse, options, elasticity, viewpoint); } if (flag || !multipleHits.NearLow.Collided) { Vector3 position1 = position + vector3_1 * halfSize; multipleHits.NearLow = this.CollidePoint(position1, impulse, options, elasticity, viewpoint); } return multipleHits; }
private async void OnViewpointsClicked(object sender, EventArgs e) { // Show sheet and get title from the selection var selectedMapTitle = await DisplayActionSheet("Select viewpoint", "Cancel", null, titles); // If selected cancel do nothing if (selectedMapTitle == "Cancel") return; switch (selectedMapTitle) { case "Geometry": // Set Viewpoint using Redlands envelope defined above and a padding of 20 await MyMapView.SetViewpointGeometryAsync(RedlandsEnvelope, 20); break; case "Center & Scale": // Set Viewpoint so that it is centered on the London coordinates defined above await MyMapView.SetViewpointCenterAsync(LondonCoords); // Set the Viewpoint scale to match the specified scale await MyMapView.SetViewpointScaleAsync(LondonScale); break; case "Animate": // Navigate to full extent of the first baselayer before animating to specified geometry await MyMapView.SetViewpointAsync( new Viewpoint(MyMapView.Map.Basemap.BaseLayers.First().FullExtent)); // Create a new Viewpoint using the specified geometry var viewpoint = new Viewpoint(EdinburghEnvelope); // Set Viewpoint of MapView to the Viewpoint created above and animate to it using a timespan of 5 seconds await MyMapView.SetViewpointAsync(viewpoint, TimeSpan.FromSeconds(5)); break; default: break; } }
public override bool ChangeViewpoint(Viewpoint newView, float speedFactor) { if ((double) speedFactor != 0.0 && (newView == this.viewpoint || this.concurrentChanges >= 1) || this.PlayerManager.Action == ActionType.GrabTombstone && !this.PlayerManager.Animation.Timing.Ended) return false; if (!this.ViewTransitionReached && (double) speedFactor != 0.0) ++this.concurrentChanges; this.shouldRotateInstance = FezMath.IsOrthographic(newView) && FezMath.IsOrthographic(this.viewpoint); if (newView == Viewpoint.Perspective) this.predefinedViews[newView].Direction = this.current.Direction; base.ChangeViewpoint(newView, speedFactor); if (this.PlayerManager.CarriedInstance != null && this.concurrentChanges == 0) this.originalCarriedPhi = this.PlayerManager.CarriedInstance.Phi; this.CameraService.OnRotate(); return true; }
/// <summary> /// The event that is triggered when the MapView has a new layer that is loaded. /// </summary> /// <param name="sender">MapView object</param> /// <param name="e">Layer Loaded event args</param> private void BaseMapView_LayerLoaded(object sender, LayerLoadedEventArgs e) { if (e.LoadError != null) { Debug.WriteLine(string.Format("(MainWindows{BaseMapView_LayerLoaded}) Error while loading layer : {0} - {1}", e.Layer.ID, e.LoadError.Message)); return; } if (mainViewModel.IdToZoomOn != "" && e.Layer.ID == mainViewModel.IdToZoomOn) { mainViewModel.IdToZoomOn = ""; centerPoint = ((KmlLayer)e.Layer).RootFeature.Viewpoint; ((MapView)sender).SetViewAsync(centerPoint, TimeSpan.FromSeconds(kmzZoomDelaySec)); } AddLayerToTree(e.Layer); }
private Vector3D getViewUp(Viewpoint oVP) { double units = GetGunits(); Rotation3D oRot = oVP.Rotation; // calculate view direction Rotation3D oNegtiveZ = new Rotation3D(0, 1, 0, 0); Rotation3D otempRot = MultiplyRotation3D(oNegtiveZ, oRot.Invert()); Rotation3D oViewDirRot = MultiplyRotation3D(oRot, otempRot); // get view direction Vector3D oViewDir = new Vector3D(oViewDirRot.A, oViewDirRot.B, oViewDirRot.C); return oViewDir.Normalize(); }
private void Open3DView(VisualizationInfo v) { try { // { // Tuple<Point3D, Vector3D, Vector3D, ViewpointProjection, double> tuple = GetViewCoordinates(v); if (tuple == null) { MessageBox.Show("Viewpoint not formatted correctly.", "Viewpoint Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } Document oDoc = Autodesk.Navisworks.Api.Application.ActiveDocument; // get current viewpoint // Viewpoint oCurVP = oDoc.vi.CurrentViewpoint.ToViewpoint; // get copy viewpoint Viewpoint oCopyVP = new Viewpoint(); oCopyVP.AlignDirection(tuple.Item3); oCopyVP.AlignUp(tuple.Item2); oCopyVP.Projection = tuple.Item4; // **** CUSTOM VALUE FOR TEKLA **** // // otherwise = 1 // **** CUSTOM VALUE FOR TEKLA **** // const double TEKLA = 1.25; double x = tuple.Item5 / TEKLA; if (oCopyVP.Projection == ViewpointProjection.Orthographic) { oCopyVP.Position = tuple.Item1; oCopyVP.FocalDistance = 1; //top center point of view Point3D xyzTL = oCopyVP.Position.Add(tuple.Item2.Multiply(x)); oCopyVP.SetExtentsAtFocalDistance(1, xyzTL.DistanceTo(oCopyVP.Position)); } else { //double angle = tuple.Item5 * Math.PI / 180; // MessageBox.Show(tuple.Item5.ToString() + " " +(Math.Tan(angle / 2)*2).ToString()); oCopyVP.FocalDistance = tuple.Item5; //oCopyVP.SetExtentsAtFocalDistance(Math.Tan(angle / 2) * 2, Math.Tan(angle / 2) * 2 / oCopyVP.AspectRatio); oCopyVP.Position = tuple.Item1; } oDoc.CurrentViewpoint.CopyFrom(oCopyVP); if (v.Components != null && v.Components.Any()) { // ModelItemCollection selected = new ModelItemCollection(); List<ModelItem> attachedElems = new List<ModelItem>(); List<ModelItem> elems = oDoc.Models.First.RootItem.DescendantsAndSelf.ToList<ModelItem>(); foreach (var item in elems.Where(o => o.InstanceGuid != Guid.Empty)) { string ifcguid = IfcGuid.ToIfcGuid(item.InstanceGuid).ToString(); if (v.Components.Any(o => o.IfcGuid == ifcguid)) attachedElems.Add(item); } if (attachedElems.Any())//avoid to hide everything if no elements matches { if (MySettings.Get("selattachedelems") == "0") { List<ModelItem> elemsVisible = new List<ModelItem>(); foreach (var item in attachedElems) { elemsVisible.AddRange(item.AncestorsAndSelf); } foreach (var item in elemsVisible) elems.Remove(item); oDoc.Models.ResetAllHidden(); oDoc.Models.SetHidden(elems, true); } else { oDoc.CurrentSelection.Clear(); oDoc.CurrentSelection.AddRange(attachedElems); } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } //setVisibility(v); }
public TombstoneState(TombstonesHost host, ArtObjectInstance ao) { ServiceHelper.InjectServices((object) this); this.Host = host; this.ArtObject = ao; int num1; if (this.GameState.SaveData.ThisLevel.PivotRotations.TryGetValue(this.ArtObject.Id, out num1) && num1 != 0) { int num2 = Math.Abs(num1); for (int index = 0; index < num2; ++index) { this.OriginalAoRotation = this.ArtObject.Rotation; this.ArtObject.Rotation *= Quaternion.CreateFromAxisAngle(Vector3.UnitY, 1.570796f * (float) Math.Sign(num1)); } } this.LastViewpoint = FezMath.AsViewpoint(FezMath.OrientationFromDirection(FezMath.MaxClampXZ(Vector3.Transform(Vector3.Forward, this.ArtObject.Rotation)))); }
public bool Update(TimeSpan elapsed) { this.SinceChanged += elapsed; switch (this.State) { case SpinAction.Idle: Vector3 vector = (this.PlayerManager.Position - this.ArtObject.Position - new Vector3(0.0f, 1f, 0.0f)) * FezMath.ScreenSpaceMask(this.CameraManager.Viewpoint); vector.X += vector.Z; Vector3 vector3 = FezMath.Abs(vector); if (FezMath.AlmostEqual(FezMath.Abs(Vector3.Transform(Vector3.UnitZ, this.ArtObject.Rotation)), FezMath.DepthMask(this.CameraManager.Viewpoint)) && ((double) vector3.X < 0.899999976158142 && (double) vector3.Y < 1.0) && (this.PlayerManager.CarriedInstance == null && this.PlayerManager.Grounded) && (this.PlayerManager.Action != ActionType.GrabTombstone && this.InputManager.GrabThrow == FezButtonState.Pressed && this.PlayerManager.Action != ActionType.ReadingSign)) { this.SinceChanged = TimeSpan.Zero; return true; } else break; case SpinAction.Spinning: double num = FezMath.Saturate(this.SinceChanged.TotalSeconds / 0.75); Quaternion fromAxisAngle = Quaternion.CreateFromAxisAngle(Vector3.UnitY, Easing.EaseIn(num < 0.949999999254942 ? num / 0.949999999254942 : 1.0 + Math.Sin((num - 0.949999999254942) / 0.0500000007450581 * 6.28318548202515 * 2.0) * 0.00999999977648258 * (1.0 - num) / 0.0500000007450581, EasingType.Linear) * 1.570796f * (float) this.SpinSign); this.ArtObject.Rotation = this.OriginalAoRotation * fromAxisAngle; this.PlayerManager.Position = Vector3.Transform(this.OriginalPlayerPosition - this.ArtObject.Position, fromAxisAngle) + this.ArtObject.Position; if (this.SinceChanged.TotalSeconds >= 0.75) { this.LastViewpoint = FezMath.AsViewpoint(FezMath.OrientationFromDirection(FezMath.MaxClampXZ(Vector3.Transform(Vector3.Forward, this.ArtObject.Rotation)))); int count = Enumerable.Count<TombstonesHost.TombstoneState>((IEnumerable<TombstonesHost.TombstoneState>) this.Host.TrackedStones, (Func<TombstonesHost.TombstoneState, bool>) (x => x.LastViewpoint == this.LastViewpoint)); this.TombstoneService.UpdateAlignCount(count); if (count > 1) this.TombstoneService.OnMoreThanOneAligned(); this.Host.StopSkullRotations = count == 4; this.PlayerManager.Action = ActionType.GrabTombstone; this.PlayerManager.Position += 0.5f * Vector3.UnitY; this.PlayerManager.Velocity = Vector3.Down; this.PhysicsManager.Update((IComplexPhysicsEntity) this.PlayerManager); this.SinceChanged -= TimeSpan.FromSeconds(0.75); this.State = SpinAction.Grabbed; break; } else break; case SpinAction.Grabbed: if (this.PlayerManager.Action != ActionType.GrabTombstone) { this.State = SpinAction.Idle; break; } else break; } return false; }
public override void Initialize() { base.Initialize(); this.GameState.MenuCubeIsZoomed = false; this.PlayerManager.CanControl = false; ArtObject artObject = this.CMProvider.Global.Load<ArtObject>("Art Objects/MENU_CUBEAO"); bool flag = true; if (this.LevelManager.WaterType == LiquidType.Sewer) { this.oldTextureCache = artObject.Cubemap; artObject.Cubemap = this.CMProvider.Global.Load<Texture2D>("Art Objects/MENU_CUBE_GB"); } else if (this.LevelManager.WaterType == LiquidType.Lava) { this.oldTextureCache = artObject.Cubemap; artObject.Cubemap = this.CMProvider.Global.Load<Texture2D>("Art Objects/MENU_CUBE_VIRTUAL"); } else if (this.LevelManager.BlinkingAlpha) { this.oldTextureCache = artObject.Cubemap; artObject.Cubemap = this.CMProvider.Global.Load<Texture2D>("Art Objects/MENU_CUBE_CMY"); } else flag = false; if (flag) new ArtObjectMaterializer(artObject).RecomputeTexCoords(false); int key = IdentifierPool.FirstAvailable<ArtObjectInstance>(this.LevelManager.ArtObjects); this.AoInstance = new ArtObjectInstance(artObject) { Id = key, Position = this.PlayerManager.Center }; this.AoInstance.Initialize(); this.AoInstance.Material = new Material(); this.LevelManager.ArtObjects.Add(key, this.AoInstance); this.AoInstance.Scale = new Vector3(0.0f); this.OriginalViewpoint = this.CameraManager.Viewpoint; this.OriginalCenter = this.CameraManager.Center; this.OriginalPixPerTrix = this.CameraManager.PixelsPerTrixel; this.OriginalRotation = FezMath.QuaternionFromPhi(FezMath.ToPhi(this.CameraManager.Viewpoint)); RenderTarget2D renderTarget = this.GraphicsDevice.GetRenderTargets().Length == 0 ? (RenderTarget2D) null : this.GraphicsDevice.GetRenderTargets()[0].RenderTarget as RenderTarget2D; this.FillInPlanes(); this.CreateGoldenCubeFace(); this.CreateMapsFace(); this.CreateArtifactsFace(); this.CreateAntiCubeFace(); this.CreateHighlights(); this.CreateTomePages(); this.GraphicsDevice.SetRenderTarget(renderTarget); this.AntiCubes.Position = this.Maps.Position = this.HidingPlanes.Position = this.GoldenCubes.Position = this.AoInstance.Position; this.AntiCubes.Scale = this.Maps.Scale = this.HidingPlanes.Scale = this.GoldenCubes.Scale = this.AoInstance.Scale = new Vector3(0.0f); this.TransformArtifacts(); this.BlurEffect = new FastBlurEffect(); this.enterSound = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/EnterMenucubeOrMap"); this.exitSound = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/ExitMenucubeOrMap"); this.zoomInSound = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/ZoomIn"); this.zoomOutSound = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/ZoomOut"); this.rotateLeftSound = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/RotateLeft"); this.rotateRightSound = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/RotateRight"); this.cursorSound = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/MoveCursorMenucube"); this.sBackground = this.CMProvider.Global.Load<SoundEffect>("Sounds/Ui/MenuCubeBackground"); this.eBackground = SoundEffectExtensions.Emit(this.sBackground, true); SoundEffectExtensions.Emit(this.enterSound); this.AoVisibility = new List<bool>(); this.AoInstance.Hidden = true; this.AoInstance.Visible = false; this.GameService.CloseScroll((string) null); this.GameState.ShowScroll(MenuCubeFaceExtensions.GetTitle(this.Face), 0.0f, true); this.wasLowPass = this.SoundManager.IsLowPass; if (!this.wasLowPass) this.SoundManager.FadeFrequencies(true); this.InRtHandle = this.TargetRenderingManager.TakeTarget(); this.OutRtHandle = this.TargetRenderingManager.TakeTarget(); this.TargetRenderingManager.ScheduleHook(this.DrawOrder, this.InRtHandle.Target); }
private void RotateTo(Viewpoint view) { if (Math.Abs(FezMath.GetDistance(this.CameraManager.Viewpoint, view)) > 1) this.EmitRight(); this.CameraManager.ChangeViewpoint(view); }
private void addVPAsia() { if (vpAsia == null) { vpAsia = new Viewpoint(); vpAsia.x = 107.85; vpAsia.y = 32.35; vpAsia.z = 0.0; vpAsia.heading = -3.57; vpAsia.pitch = -90; vpAsia.range = 19134411; m_earthRoot.addChild(vpAsia); } }
private void ScheduleHit() { this.wutex2 = (IWaiter) null; this.wutex1 = Waiters.Wait(0.25, (Action) (() => { Waiters.Wait(0.25, (Action) (() => this.wutex1 = (IWaiter) null)); this.PlayerManager.Action = ActionType.HitBell; this.PlayerManager.Animation.Timing.Restart(); this.SinceHit = TimeSpan.Zero; SoundEffectExtensions.EmitAt(this.sBellHit[(int) (this.CameraManager.Viewpoint - 1)], this.BellAo.Position); this.SoundManager.FadeVolume(0.25f, 1f, 2f); this.AngularVelocity += new Vector2(-FezMath.Dot(FezMath.ForwardVector(this.CameraManager.Viewpoint), Vector3.UnitZ), FezMath.Dot(FezMath.ForwardVector(this.CameraManager.Viewpoint), Vector3.UnitX)) * 0.075f; if (this.Solved) return; if (this.LastHit != Viewpoint.None && this.LastHit != this.CameraManager.Viewpoint) this.Hits[this.CameraManager.Viewpoint] = 0; this.LastHit = this.CameraManager.Viewpoint; Dictionary<Viewpoint, int> local_1; Viewpoint local_2; (local_1 = this.Hits)[local_2 = this.CameraManager.Viewpoint] = local_1[local_2] + 1; if (!Enumerable.All<KeyValuePair<Viewpoint, int>>((IEnumerable<KeyValuePair<Viewpoint, int>>) this.Hits, (Func<KeyValuePair<Viewpoint, int>, bool>) (kvp => kvp.Value == this.ExpectedHits[kvp.Key]))) return; this.Solved = true; this.GameState.SaveData.ThisLevel.InactiveArtObjects.Add(this.BellAo.Id); this.LevelService.ResolvePuzzle(); ServiceHelper.AddComponent((IGameComponent) new GlitchyDespawner(this.Game, this.BellAo, this.OriginalPosition)); })); this.wutex1.AutoPause = true; }
public CollisionResult CollidePoint(Vector3 position, Vector3 impulse, QueryOptions options, float elasticity, Viewpoint viewpoint) { CollisionResult collisionResult = new CollisionResult(); Vector3 vector3 = position + impulse; TrileInstance instance = (TrileInstance) null; if ((options & QueryOptions.Background) != QueryOptions.None) instance = this.LevelManager.ActualInstanceAt(vector3); if (instance == null) { NearestTriles nearestTriles = this.LevelManager.NearestTrile(vector3, options, new Viewpoint?(viewpoint)); instance = nearestTriles.Deep ?? nearestTriles.Surface; } bool invertedGravity = (double) this.GravityFactor < 0.0; if (instance != null) collisionResult = CollisionManager.CollideWithInstance(position, vector3, impulse, instance, options, elasticity, viewpoint, invertedGravity); if (collisionResult.Collided && (invertedGravity ? ((double) impulse.Y > 0.0 ? 1 : 0) : ((double) impulse.Y < 0.0 ? 1 : 0)) != 0) { if ((double) vector3.X % 0.25 == 0.0) vector3.X += 1.0 / 1000.0; if ((double) vector3.Z % 0.25 == 0.0) vector3.Z += 1.0 / 1000.0; TrileInstance trileInstance = this.LevelManager.ActualInstanceAt(vector3); CollisionType rotatedFace; collisionResult.ShouldBeClamped = trileInstance == null || !trileInstance.Enabled || (rotatedFace = trileInstance.GetRotatedFace(this.CameraManager.VisibleOrientation)) == CollisionType.None || rotatedFace == CollisionType.Immaterial; } return collisionResult; }
private VisualizationInfo generateViewpoint(Viewpoint oVP, int elemCheck) { double units = GetGunits(); VisualizationInfo v = new VisualizationInfo(); try { Vector3D vi = getViewDir(oVP); Vector3D up = getViewUp(oVP); Point3D center = new Point3D(oVP.Position.X / units, oVP.Position.Y / units, oVP.Position.Z / units); double zoomValue = 1; oVP = oVP.CreateCopy(); if (!oVP.HasFocalDistance) oVP.FocalDistance = 1; if (oVP.Projection == ViewpointProjection.Orthographic) //IS ORTHO { // **** CUSTOM VALUE FOR TEKLA **** // // otherwise = 1 // **** CUSTOM VALUE FOR TEKLA **** // double dist = oVP.VerticalExtentAtFocalDistance / 2 / units; zoomValue = 3.125 * dist / (up.Length * 1.25); //zoomValue = Math.Tan(oVP.HeightField / 2) * oVP.FarPlaneDistance / _feet *1.25; // MessageBox.Show(oVP.HeightField.ToString() + " " + oVP.FarPlaneDistance.ToString() + " " + zoomValue + " " + oVP.HasFocalDistance.ToString() + " " + oVP.VerticalExtentAtFocalDistance.ToString()); v.OrthogonalCamera = new OrthogonalCamera(); v.OrthogonalCamera.CameraViewPoint.X = center.X; v.OrthogonalCamera.CameraViewPoint.Y = center.Y; v.OrthogonalCamera.CameraViewPoint.Z = center.Z; v.OrthogonalCamera.CameraUpVector.X = up.X; v.OrthogonalCamera.CameraUpVector.Y = up.Y; v.OrthogonalCamera.CameraUpVector.Z = up.Z; v.OrthogonalCamera.CameraDirection.X = vi.X; v.OrthogonalCamera.CameraDirection.Y = vi.Y; v.OrthogonalCamera.CameraDirection.Z = vi.Z; v.OrthogonalCamera.ViewToWorldScale = zoomValue; } else // it is a perspective view { double f = oVP.FocalDistance; //there is an issue when using vewpoint generated from clashes //their VerticalExtentAtFocalDistance is correct but the HorizontalExtentAtFocalDistance is too small! //so results that the aspect ratio in that case is <1. In which I try to get an approximate valut of the HorizontalExtentAtFocalDistance // by multiplying the vercial by 1.35 //double hfov = (oVP.AspectRatio < 1) ? oVP.VerticalExtentAtFocalDistance * 1.23245 / 2 : oVP.HorizontalExtentAtFocalDistance / 2; //double angle = Math.Atan(hfov * (1 / f)) * 2; //double angled = (180 * angle / Math.PI); //NAVIS USES HFOV //double vfov = oVP.VerticalExtentAtFocalDistance / 2; //double fov = Math.Sqrt(hfov * hfov + vfov * vfov); //double angle = Math.Atan(fov*(1/f)) *2; //double angled = (180 * angle / Math.PI); //MessageBox.Show(angled.ToString() + " " + oVP.FarDistance + " " +f + " " + oVP.NearDistance );// + "\n zoom" + zoom); zoomValue = f; v.PerspectiveCamera = new PerspectiveCamera(); v.PerspectiveCamera.CameraViewPoint.X = center.X; v.PerspectiveCamera.CameraViewPoint.Y = center.Y; v.PerspectiveCamera.CameraViewPoint.Z = center.Z; v.PerspectiveCamera.CameraUpVector.X = up.X; v.PerspectiveCamera.CameraUpVector.Y = up.Y; v.PerspectiveCamera.CameraUpVector.Z = up.Z; v.PerspectiveCamera.CameraDirection.X = vi.X; v.PerspectiveCamera.CameraDirection.Y = vi.Y; v.PerspectiveCamera.CameraDirection.Z = vi.Z; v.PerspectiveCamera.FieldOfView = zoomValue; } if (elemCheck == 0)//visible (0) _elementList = _oDoc.Models.First.RootItem.DescendantsAndSelf.Where(o => o.InstanceGuid != Guid.Empty && ChechHidden(o.AncestorsAndSelf) && o.FindFirstGeometry() != null && !o.FindFirstGeometry().Item.IsHidden).ToList<ModelItem>(); if (null != _elementList && _elementList.Any() && elemCheck != 2)//not if none (2) { v.Components = new Classes.Component[_elementList.Count]; string appname = Autodesk.Navisworks.Api.Application.Title; for (var i = 0; i < _elementList.Count; i++) { string ifcguid = IfcGuid.ToIfcGuid(_elementList.ElementAt(i).InstanceGuid).ToString(); v.Components[i] = new ARUP.IssueTracker.Classes.Component(appname, "", ifcguid); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } return v; }
private static CollisionResult CollideWithInstance(Vector3 origin, Vector3 destination, Vector3 impulse, TrileInstance instance, QueryOptions options, float elasticity, Viewpoint viewpoint, bool invertedGravity) { CollisionResult collisionResult = new CollisionResult(); Vector3 normal = -FezMath.Sign(impulse); FaceOrientation faceOrientation = FezMath.VisibleOrientation(viewpoint); if ((options & QueryOptions.Background) == QueryOptions.Background) faceOrientation = FezMath.GetOpposite(faceOrientation); CollisionType rotatedFace = instance.GetRotatedFace(faceOrientation); if (rotatedFace != CollisionType.None) { collisionResult.Destination = instance; collisionResult.NearestDistance = instance.Center; collisionResult.Response = CollisionManager.SolidCollision(normal, instance, origin, destination, impulse, elasticity); if (collisionResult.Response != Vector3.Zero) collisionResult.Collided = rotatedFace == CollisionType.AllSides || (rotatedFace == CollisionType.TopNoStraightLedge || rotatedFace == CollisionType.TopOnly) && (invertedGravity ? (double) normal.Y < 0.0 : (double) normal.Y > 0.0); } return collisionResult; }
public virtual bool ChangeViewpoint(Viewpoint newViewpoint, float speedFactor) { bool flag = FezMath.IsOrthographic(newViewpoint) != FezMath.IsOrthographic(this.viewpoint); if (flag && this.ProjectionTransition) return false; this.ProjectionTransition = flag && (double) speedFactor > 0.0; this.radiusBeforeTransition = FezMath.IsOrthographic(this.viewpoint) ? this.current.Radius : this.predefinedViews[this.lastViewpoint].Radius; if ((double) speedFactor > 0.0) { float num = (float) ((double) (Math.Abs(FezMath.GetDistance(newViewpoint, this.Viewpoint)) - 1) / 2.0 + 1.0); if (newViewpoint == Viewpoint.Perspective || this.Viewpoint == Viewpoint.Perspective) num = 1f; Vector3 from = this.current.Direction; Vector3 to = this.predefinedViews[newViewpoint].Direction; this.directionTransition = new Vector3SplineInterpolation(TimeSpan.FromSeconds((double) DefaultCameraManager.TransitionSpeed * (double) num * (double) speedFactor), new Vector3[3] { from, DefaultCameraManager.GetIntemediateVector(from, to), to }); this.directionTransition.Start(); } if (FezMath.IsOrthographic(this.viewpoint)) { this.current.Direction = -FezMath.ForwardVector(this.viewpoint); this.current.Radius = this.DefaultViewableWidth; } this.olderViewpoint = this.lastViewpoint; this.lastViewpoint = this.viewpoint; this.viewpoint = newViewpoint; Vector3 center = this.Center; this.current = this.predefinedViews[newViewpoint]; this.current.Center = center; if (this.lastViewpoint != Viewpoint.None) { this.PreViewpointChanged(); if (!this.ViewTransitionCancelled) this.ViewpointChanged(); } if ((double) speedFactor == 0.0 && !this.ViewTransitionCancelled) this.RebuildView(); bool transitionCancelled = this.ViewTransitionCancelled; this.ViewTransitionCancelled = false; return !transitionCancelled; }
private async void OnButtonClick(object sender, RoutedEventArgs e) { // Get .Content from the selected item Button myButton = sender as Button; var selectedMapTitle = myButton.Content.ToString(); switch (selectedMapTitle) { case "Geometry": // Set Viewpoint using Redlands envelope defined above and a padding of 20 await MyMapView.SetViewpointGeometryAsync(_redlandsEnvelope, 20); break; case "Center and Scale": // Set Viewpoint so that it is centered on the London coordinates defined above await MyMapView.SetViewpointCenterAsync(_londonCoords); // Set the Viewpoint scale to match the specified scale await MyMapView.SetViewpointScaleAsync(_londonScale); break; case "Animate": // Navigate to full extent of the first baselayer before animating to specified geometry await MyMapView.SetViewpointAsync( new Viewpoint(MyMapView.Map.Basemap.BaseLayers.First().FullExtent)); // Create a new Viewpoint using the specified geometry var viewpoint = new Viewpoint(_edinburghEnvelope); // Set Viewpoint of MapView to the Viewpoint created above and animate to it using a timespan of 5 seconds await MyMapView.SetViewpointAsync(viewpoint, TimeSpan.FromSeconds(5)); break; default: break; } }
private async void OnViewpointMenuItemClicked(object sender, PopupMenu.MenuItemClickEventArgs e) { // Get title from the selected item var selectedMapTitle = e.Item.TitleCondensedFormatted.ToString(); switch (selectedMapTitle) { case "Geometry": // Set Viewpoint using Redlands envelope defined above and a padding of 20 await _myMapView.SetViewpointGeometryAsync(RedlandsEnvelope, 20); break; case "Center & Scale": // Set Viewpoint so that it is centered on the London coordinates defined above await _myMapView.SetViewpointCenterAsync(LondonCoords); // Set the Viewpoint scale to match the specified scale await _myMapView.SetViewpointScaleAsync(LondonScale); break; case "Animate": // Navigate to full extent of the first baselayer before animating to specified geometry await _myMapView.SetViewpointAsync( new Viewpoint(_myMapView.Map.Basemap.BaseLayers.First().FullExtent)); // Create a new Viewpoint using the specified geometry var viewpoint = new Viewpoint(EdinburghEnvelope); // Set Viewpoint of MapView to the Viewpoint created above and animate to it using a timespan of 5 seconds await _myMapView.SetViewpointAsync(viewpoint, TimeSpan.FromSeconds(5)); break; default: break; } }
private void OnViewpointsButtonTouch(object sender, EventArgs e) { // Initialize an UIAlertController UIAlertController viewpointAlert = UIAlertController.Create( "Select viewpoint", "", UIAlertControllerStyle.Alert); // Add actions to alert. Selecting an option set the new viewpoint viewpointAlert.AddAction(UIAlertAction.Create(titles[0], UIAlertActionStyle.Default, async (action) => { // Set Viewpoint using Redlands envelope defined above and a padding of 20 await _myMapView.SetViewpointGeometryAsync(RedlandsEnvelope, 20); })); viewpointAlert.AddAction(UIAlertAction.Create(titles[1], UIAlertActionStyle.Default, async (action) => { // Set Viewpoint so that it is centered on the London coordinates defined above await _myMapView.SetViewpointCenterAsync(LondonCoords); // Set the Viewpoint scale to match the specified scale await _myMapView.SetViewpointScaleAsync(LondonScale); })); viewpointAlert.AddAction(UIAlertAction.Create(titles[2], UIAlertActionStyle.Default, async (action) => { // Navigate to full extent of the first baselayer before animating to specified geometry await _myMapView.SetViewpointAsync( new Viewpoint(_myMapView.Map.Basemap.BaseLayers.First().FullExtent)); // Create a new Viewpoint using the specified geometry var viewpoint = new Viewpoint(EdinburghEnvelope); // Set Viewpoint of MapView to the Viewpoint created above and animate to it using a timespan of 5 seconds await _myMapView.SetViewpointAsync(viewpoint, TimeSpan.FromSeconds(5)); })); PresentViewController(viewpointAlert, true, null); }
public override void Initialize() { this.InterpolationSpeed = 10f; this.ResetViewpoints(); this.viewpoint = Viewpoint.Right; this.current = this.predefinedViews[Viewpoint.Right]; this.SnapInterpolation(); this.GraphicsService.DeviceReset += (EventHandler<EventArgs>) delegate { this.PixelsPerTrixel = this.pixelsPerTrixel; this.RebuildProjection(); }; }
public bool ChangeViewpoint(Viewpoint newView) { return this.ChangeViewpoint(newView, 1f); }
private void ribbonButton19_Click(object sender, EventArgs e) { if ( vpAmerica == null ) { vpAmerica = new Viewpoint(); vpAmerica.x = -90; vpAmerica.y = 0; vpAmerica.z = 0; vpAmerica.heading = -3.57; vpAmerica.pitch = -89; vpAmerica.range = 19134411; m_earthRoot.addChild(vpAmerica); } vpAmerica.flyTo(); }