ThinkGeo.com    |     Documentation    |     Premium Support

Rotate pointshape

I have created an app that has vehicles drawn on the map and periodically I move the vehicles around according to updated lat/lon.


All works fine except I cannot figure out how to rotate the vehicle (pointShape in an InMemeoryFeature Layer) according to it's direction of travel.


Any sample code would help.


 


Alan



Alan,


There is a property RotationAngle in PointStyle, you can rotate the point using that. Here is a demo for that, please have a look.


Thanks,


Ben


 



637-Demo.zip (10.9 KB)

That does work except that is rotates all features within the layer and I need to rotate each feature (PointShape) within the layer differently. 
  
 Using that method I will need to create a new layer for every vehicle plotted. I need to plot 200+ vehicles. 
  
 Alan

Does this mean the Rotate(PointShape,Single) Method does not work or is not implemented?

Alan, 
  
 You can create your own RotatePointStyle by inheriting the existing PointStyle, in the protected DrawCore method, you can rotate and render each feature differently with your own logic. In this way you only need one layer and still you can rotate every point with different angle. 
  
 Thanks, 
  
 Ben

At the risk of sounding lazy! Do you have sample code?


Thanks Alan



Please have a look at a corresponding post here where you may be able to get some insights how to implement it. 
  
 gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/21/aft/5698/afv/topic/afpgj/1/Default.aspx 
  
 Thanks, 
  
 Ben