ThinkGeo.com    |     Documentation    |     Premium Support

GeoCanvas.DrawArea

According to the documentation, one of the overloads for DrawArea takes, as its first parameter, IEnumerable<ScreenPointF>.  However, when I actually try to use this function, it appears to want IEnumerable<ScreenPointF[]> (A collection of ScreenPointF arrays).  


Which is correct, and, if it's the latter, what data is expected in the first parameter?



Chris,


Thanks for your post.
 
The first parameter of this API is an Innumerable of an item which is an array of ScreenPointF. In this way, it will stands for an area in the screen.
 
Following sample code snippet is a way to recreate it:

ScreenPointF screen1 = new ScreenPointF(1.0f, 1.0f);
ScreenPointF screen2 = new ScreenPointF(1.0f, 2.0f);
ScreenPointF screen3 = new ScreenPointF(2.0f, 2.0f);
ScreenPointF screen4 = new ScreenPointF(2.0f, 1.0f);
ScreenPointF[] screenPointFs1 = new ScreenPointF[] { screen1,screen2,screen3,screen4};

ScreenPointF screen6 = new ScreenPointF(3.0f, 3.0f);
ScreenPointF screen7 = new ScreenPointF(3.0f, 4.0f);
ScreenPointF screen8 = new ScreenPointF(4.0f, 4.0f);
ScreenPointF screen9 = new ScreenPointF(4.0f, 3.0f);
ScreenPointF[] screenPointFs2 = new ScreenPointF[] { screen6, screen7, screen8, screen9 };

Collection<ScreenPointF[]> colScreenPointF = new Collection<ScreenPointF[]>();
colScreenPointF.Add(screenPointFs1);
colScreenPointF.Add(screenPointFs2);

 

Any more questions just feel free to let me know.
 
Thanks.
 
Yale


Thanks, that's what I needed to know.


 


Chris



Chris, 
  
   No problem…  From some of your question sounds like you are well on your way.  Just curious as to how you are using the GeoCanvas. :-) 
  
 David

I'm using the canvas it to draw points with a custom rotation and color showing vehicle direction and status for a tracking application.


I actually ended up not using that verion of DrawArea.  I want the point shape to stay a consistent size at all zoom levels so I'm calculating the basic shape using screen points (10 pixels wide, 15 pixels high, for example).  Then I convert those points to world coordinates using ExtentHelper, put the points in a polygon shape and rotate that.  Works fine.


 


Chris


 



Chris, 
  
   Glad to see you it working the way you want.  There are a bunch of ways to get things done.  Let me know if you have any additional questions. 
  
 David