Hello,
I need a function implement: point moving need have Animation effects .
like: private static void AnimateFeature (Feature startPoint, Feature endPoint, InMemoryFeatureLayer layer)
point A【new Feature(x,y)】in InMemoryFeatureLayer. if A want to move to B 【new Feature(a,b)】,and it took 0.5 seconds.
How to implement? Can it implement?
How to move a point(Feature) in InMemoryFeatureLayer?
Hi Wang,
Sorry we don’t support some API like Animation effects for now.
But if you want to implement the effect like this, you can add a timer and move the point 0.5 seconds later then refresh.
Or if you want to make it looks is “moving”, you can add a special inMemoryFeatureLayer(so you only only need refresh this layer), calculate some points in the moving path and render them one by one for simulate the effect.
Regards,
Don
Hi Don,
Can you help me?
I have a problem, I already init a osm map,and add a button in the map ,order to realize that :
if cilck button can draw a rectangle( only draw one rectangle) to set currentextent in the map, Like “Shift” + draw a rectangle function.
how to reallize,I know:
this.wpfMap1.TrackOverlay.TrackMode = TrackMode.Rectangle; // it can draw a rectangle,but it can draw a lot of rectangle.Don’t i need.
1. how to get the rectangle?
2. how to set currentextent? like “this.wpfMap1.CurrentExtent = rectangle.GetBoundingBox();”? this’s true?
Hi Burning,
I think please keep use TrackOverlay, if you don’t want to get a lot of rectangle.
You can try to do like this:
winformsMap1.TrackOverlay.TrackEnded += new EventHandler<TrackEndedTrackInteractiveOverlayEventArgs>(TrackOverlay_TrackEnded);
void TrackOverlay_TrackEnded(object sender, TrackEndedTrackInteractiveOverlayEventArgs e)
{
RectangleShape rect = e.TrackShape.GetBoundingBox();
// Do everything you want to this rectangle
winformsMap1.TrackOverlay.TrackMode = TrackMode.None; // Disable track after draw one rectangle
}
1. You can get the rectangle by GetBoundingBox
2. You’re right, you can set the extent like that.
Regards,
Don
Hi Don,
Thanks,I found the answer as you said.
link: thinkgeo.com/forums/MapSuite/tabid/143/aft/9204/Default.aspx#30596, it is Silverlight, not WPF;I using WPF :)
my code:
wpfMap1.TrackOverlay.TrackEnded += new EventHandler<TrackEndedTrackInteractiveOverlayEventArgs>(TrackOverlay_TrackEnded);
private void TrackOverlay_TrackEnded(object sender, TrackEndedTrackInteractiveOverlayEventArgs e)
{
var extent = wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures[0].GetBoundingBox();
this.wpfMap1.CurrentExtent = extent;
this.wpfMap1.Refresh();
wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures.Clear();
}
I think that you "RectangleShape rect = e.TrackShape.GetBoundingBox(); " code is good. I don’t know it and will use it :)
wpfMap1.TrackOverlay.TrackShapeLayer.InternalFeatures.Clear(); Do you have better code?
Because i need continue drawing rectangle to set currentExtent.
Regards,
Burning
Hi Burning,
I think call .clear() is OK for your scenario, you just need move it before wpfMap1.Refresh();
Regards,
Don