private async void mapElement3DAddButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { // Compensate for 3D Model's local coordinate system and scale const float AltitudeOffset = 45.0f; const float HeadingOffset = -90.0f; const float ScaleOffset = 0.1f; MapModel3D model = await MapModel3D.CreateFrom3MFAsync(mapModelStreamReference, MapModel3DShadingOption.Smooth); if (model != null) { var center = new BasicGeoposition() { Latitude = myMap.Center.Position.Latitude, Longitude = myMap.Center.Position.Longitude, Altitude = AltitudeOffset, }; // MapElement3D scales with respect to the perspective projection of the 3D camera MapElement3D mapElement3D = new MapElement3D(); mapElement3D.Location = new Geopoint(center, AltitudeReferenceSystem.Terrain); mapElement3D.Model = model; mapElement3D.Heading = HeadingOffset + 180; mapElement3D.Scale = new Vector3(ScaleOffset, ScaleOffset, ScaleOffset); myMap.MapElements.Add(mapElement3D); } }
public Car(float speed, string uri = Uri, float scale = 0.75f) { this.mapElement = new MapElement3D() { Model = CarResources.Instance.Get(uri), Scale = new Vector3(scale, scale, scale), }; this.speed = speed; }
public async void add3D() { var map3dSphereStreamReference = RandomAccessStreamReference.CreateFromUri (new Uri("ms-appx:///Assets/mug.3mf")); var myModel = await MapModel3D.CreateFrom3MFAsync(map3dSphereStreamReference, MapModel3DShadingOption.Smooth); var my3DElement = new MapElement3D(); double centerLatitude = MapControl1.Center.Position.Latitude; double centerLongitude = MapControl1.Center.Position.Longitude; BasicGeoposition cityPosition = new BasicGeoposition() { Latitude = 55.6509863734914, Longitude = 37.6680877307923, Altitude = 10 }; Geopoint cityCenter = new Geopoint(cityPosition); my3DElement.Location = cityCenter; my3DElement.Model = myModel; MapControl1.MapElements.Add(my3DElement); }