POST
|
You can take the following code and paste it in the RenderSimpleMarkers.xaml.cs, sample provided in from ArcgisRuntime.WPF.Samples. This draws a red line across the Panama Canal, if it's style isn't SOLID of cource! public partial class RenderSimpleMarkers { public RenderSimpleMarkers() { InitializeComponent(); // Create the UI, setup the control references and execute initialization Initialize(); } 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 point1 = new MapPoint(-79.497238, 8.849289, SpatialReferences.Wgs84); var centralLocation = (MapPoint)GeometryEngine.Project(point1, SpatialReferences.WebMercator); Viewpoint initialViewpoint = new Viewpoint(centralLocation, 1000000); // 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 = Colors.Red, Size = 10, Style = SimpleMarkerSymbolStyle.Circle }; // Add a new graphic with a central point that was created earlier Graphic graphicWithSymbol = CreateSimpleLine(); //new Graphic(centralLocation, simpleSymbol); overlay.Graphics.Add(graphicWithSymbol); } public static Graphic CreateSimpleLine() { MapPoint point1 = new MapPoint(-79.497238, 8.849289, SpatialReferences.Wgs84); var newPoint1 = (MapPoint)GeometryEngine.Project(point1, SpatialReferences.WebMercator); var cartoLineSym = new SimpleLineSymbol(SimpleLineSymbolStyle.DashDot, Colors.Red, 5); MapPoint point2 = new MapPoint(-80.035568, 9.432302, SpatialReferences.Wgs84); var newPoint2 = (MapPoint)GeometryEngine.Project(point2, SpatialReferences.WebMercator); var aBuilder = new PolylineBuilder(new MapPoint[] { newPoint1, newPoint2 }); var aGraphic = new Graphic(aBuilder.ToGeometry(), cartoLineSym); return aGraphic; } }
... View more
03-20-2017
07:47 AM
|
0
|
0
|
736
|
POST
|
Can't be an issue with the geometry because it works as expected for other line styles...
... View more
03-17-2017
07:04 AM
|
0
|
1
|
736
|
POST
|
I modified one of the standard WPF samples (RenderSimpleMarkers) to create a line graphic instead of a point graphic e.g: replaced: Graphic graphicWithSymbol = new Graphic(centralLocation, simpleSymbol); with: Graphic graphicWithSymbol = CreateSimpleLine(), where CreateSimpleLine is the following procedure: public static Graphic CreateSimpleLine() { MapPoint point1 = new MapPoint(-79.497238, 8.849289, SpatialReferences.Wgs84); var newPoint1 = (MapPoint)GeometryEngine.Project(point1, SpatialReferences.WebMercator); var cartoLineSym = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, Colors.Black, 1); MapPoint point2 = new MapPoint(-80.035568, 9.432302, SpatialReferences.Wgs84); var newPoint2 = (MapPoint)GeometryEngine.Project(point2, SpatialReferences.WebMercator); var aBuilder = new PolylineBuilder(new MapPoint[] { newPoint1, newPoint2 }); var aGraphic = new Graphic(aBuilder.ToGeometry(), cartoLineSym); return aGraphic; } If I change the SimpleLineSymbolStyle to other than solid everything works OK but with the solid pattern the program throws!
... View more
03-17-2017
03:49 AM
|
0
|
5
|
1592
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|