hi,
when I use the TrackMode.Polygon mode to draw a area, I want to show out the x,y coordination near the point, and add a description to the area.
how could I do?
thanks!
Wpfmap.TrackOverlay.TrackMode -- help
add a question.
could I change the style of the points which constitude the area?
such as that I would like to put a image in the location of the point.
greatful thanks!
yours liu.
Hi Liu,
Attached code could show you a basic idea of achieving it, would you please try it?
if you have any more question , please feel free to let us know.
Best Regards
Summer
Post11443.zip (10.4 KB)
Hi,Summer
thanks very much for your post code.
the code is perfect when I draw a area.
But the problem is when I edit the area drawed before,(such as rotate the area, the area’s points will move to the other location) the description of area points is NOT changed When I finished the editing.
I changed a litter in your code, added a edit state with wpfMap1.EditOverlay.EditShapesLayer.
And post it here.
Hope your back.
Best Regards
Thanks,
yours liu
myAddedCode.zip (1.61 MB)
Hi Liu,
This code should works for you:
Xaml
<Button Content="Save" x:Name="btnSave" Click="btnTrack_Click" />
<Button Content="Edit" x:Name="btnEdit" Click="btnTrack_Click" />
Background
case "btnEdit"://add a edit state
drawMovePoint = false;
wpfMap1.TrackOverlay.TrackMode = TrackMode.None;
//add the TrackOverlay fetures to EditOverlay, and then clear the fetures in TrackOverlay
foreach (Feature feature in wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures)
{
if (feature.GetShape() is PointShape) // Ignore all vertext label feature
{
continue;
}
wpfMap1.EditOverlay.EditShapesLayer.InternalFeatures.Add(feature);
}
wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures.Clear();
wpfMap1.EditOverlay.CalculateAllControlPoints();//make it to edit
wpfMap1.Refresh(new Overlay[] { wpfMap1.EditOverlay, wpfMap1.TrackOverlay });
break;
case "btnSave":// Save edit state
drawMovePoint = false;
InMemoryFeatureLayer trackShapeLayer = wpfMap1.TrackOverlay.TrackShapeLayer;
trackShapeLayer.Clear();
foreach (Feature feature in wpfMap1.EditOverlay.EditShapesLayer.InternalFeatures)
{
if (feature.GetShape() is PolygonShape) // In this sample, we only handle polygon
{
System.Collections.ObjectModel.Collection<Vertex> vertexes = (feature.GetShape() as PolygonShape).OuterRing.Vertices;
for (int i = 0; i < vertexes.Count - 1; i++)
{
Feature point = new Feature(vertexes[i].X, vertexes[i].Y);
point.ColumnValues.Add(trackOverlay.ColumnKey, "X:" + vertexes[i].X + " Y:" + vertexes[i].Y);
trackShapeLayer.InternalFeatures.Add(point);
}
trackShapeLayer.InternalFeatures.Add(feature);
}
}
wpfMap1.EditOverlay.EditShapesLayer.InternalFeatures.Clear();
wpfMap1.Refresh(new Overlay[] { wpfMap1.EditOverlay, wpfMap1.TrackOverlay });
if (wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures.Count > 0)
{
wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures.Remove("movePoint");
}
wpfMap1.TrackOverlay.TrackMode = TrackMode.None;
break;
Regards,
Don
Hi,
Tried downloading and running the application… It shows :
An unhandled exception of type ‘System.IO.IOException’ occurred in WpfDesktopEdition.dll
Additional information: The device is not ready.
What could be the possible reason?
Thanks,
Jacob
Hi Jacob,
We need more detail information about your scenario.
We want to know which application you are running and have you installed our WpfDesktopEdition(full/eval)?
What’s your environment now?
Because we haven’t met your exception information before.
Regards,
Don