I have a function that constantly adds a new placemark graphic object with a PictureMarkerSymbol symbol, while deleting the previous one. When I create the first graphics object, the heading is correct. All the following placemarks have the angle of the first placemark ever created.I know the value of platformHeading changes, but the heading of my placemark stays constant.
var graphicsOverlay = MySceneView.GraphicsOverlays["MyPlacemarkLayer"] as Esri.ArcGISRuntime.Controls.GraphicsOverlay; Graphic graphic = new Graphic(new MapPoint(lon, lat, alt,MySceneView.SpatialReference)); Esri.ArcGISRuntime.Symbology.PictureMarkerSymbol imgSym = new Esri.ArcGISRuntime.Symbology.PictureMarkerSymbol(); imgSym.SetSourceAsync(new Uri(iconHref)); imgSym.AngleAlignment = Esri.ArcGISRuntime.Symbology.MarkerAngleAlignment.Map; //Does this even do anything imgSym.Angle = platformHeading + _mapRotation; //I get _mapRotation when I move the map ret = graphic.GetHashCode().ToString(); graphic.Symbol = imgSym; //graphic.Attributes["Heading"] = _mapRotation + _mapRotation; //This doesn't do anything MySceneView.GraphicsOverlays["MyPlacemarkLayer"].Graphics.Add(graphic); for (int i = 0; i < MySceneView.GraphicsOverlays["MyPlacemarkLayer"].Graphics.Count; i++) { if (MySceneView.GraphicsOverlays["MyPlacemarkLayer"].Graphics.GetHashCode().ToString() == oldId) { MySceneView.GraphicsOverlays["MyPlacemarkLayer"].Graphics.RemoveAt(i); break; } }
I try to rotate the placemark when I move the screen, but this does'nt do anything at all.
private void MySceneView_CameraChanged(object sender, EventArgs e) { _mapRotation = MySceneView.GetCurrentViewpoint(ViewpointType.CenterAndScale).Rotation; canvasBox.RenderTransform = new RotateTransform(360 - _mapRotation, canvasBox.Width / 2, canvasBox.Height / 2); foreach (GraphicsOverlay gOverlay in MySceneView.GraphicsOverlays) { foreach (Graphic g in gOverlay.Graphics) { g.Attributes["Heading"] = (double)g.Attributes["Heading"] + _mapRotation; } } }
In this example, I set my heading to be 45 and to increment by 5 every iteration. The placemark seems to get stuck at 45 forever.
This is my WPF
<Grid> <Grid.Resources> <esri:SimpleRenderer x:Key="MyRenderer"> <esri:SimpleRenderer.SceneProperties > <esri:RendererSceneProperties HeadingExpression="[Heading]" PitchExpression="[Pitch]" RollExpression="[Roll]" /> </esri:SimpleRenderer.SceneProperties> <esri:SimpleRenderer.Symbol> <esri:PictureMarkerSymbol AngleAlignment="Map" /> </esri:SimpleRenderer.Symbol> </esri:SimpleRenderer> </Grid.Resources> <esri:SceneView x:Name="MySceneView" Visibility="Visible" LayerLoaded="MySceneView_LayerLoaded" CameraChanged="MySceneView_CameraChanged" > <esri:Scene> <esri:Scene.Surface> <esri:ServiceElevationSource ServiceUri="http://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer" IsEnabled="True" /> </esri:Scene.Surface> <esri:ArcGISTiledMapServiceLayer ID="BaseScene" ServiceUri="http://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer" /> </esri:Scene> <esri:SceneView.GraphicsOverlays> <esri:GraphicsOverlay ID="MyPlacemarkLayer" Renderer="{StaticResource MyRenderer}" RenderingMode="Dynamic"> <esri:GraphicsOverlay.SceneProperties> <esri:LayerSceneProperties SurfacePlacement="Relative"/> </esri:GraphicsOverlay.SceneProperties> </esri:GraphicsOverlay> </esri:SceneView.GraphicsOverlays> </esri:SceneView> </Grid>