Custom xaml controls on Deep Earth layers

Jan 9, 2009 at 3:46 PM
Hi there,

We are trying to find out whether Deep Earth is an option for the serious game we are going to build.
In the game there will a map on which silverlight controls should be drawn (think of little cars, small people).
Deep Earth provides us with an excellent tool for the mapping part, but does it also allow for custom Silverlight controls to be drawn on the map.

For instance, it is perfectly possible to draw polygons on the map:

 

private void AddPolygon()
{
    ConfigShapeLayer();
    
var points = new List<Point> { new Point(4.4242, 51.8889), new Point(4.4244, 51.8889), new Point(4.4242, 51.8892), new Point(4.4243, 51.8888) };
    
var polygon = new DeepEarth.Geometry.Polygon { Points = points };
    
this.shapeLayer.Add(polygon);
}

But I would like to Add my own xaml controls to the layer. Now the controls we can add seem restricted to GeometryBase shapes.

Thanks, and keep up the good work!

 

Coordinator
Jan 9, 2009 at 7:06 PM
Sounds like quite a fun project.  DeepEarth is designed especially for you to customize our basic shapes.  The area you want to study is the idea of templating or "Skinning".  This will allow you to integrate your own XAML elements to our basic geometry.  For an example, take a look at the DevPins in the Prototype project.  It subclasses off DeepPoint which by default, is nothing but a red ellipse.  Not very visually interesting at all.  However, when you can apply a template that contains whatever XAML visualization you want things start to get interesting.  The applications are endless, but a game would be really cool. 
Jan 9, 2009 at 8:57 PM
oh yeah, this is the answer I was hoping for :-)
Indeed, I found out about the DevPin as well, but now I know for sure this is going to work out.
In a few weeks time we should have a prototype of the game up and running.
I'll keep you posted.
Jan 14, 2009 at 12:07 AM
Does the draw polygon function work with more than 4 points. Meaning, is the polygon limited to 4 sides or can it have as many points as u need it to have.
Developer
Jan 14, 2009 at 2:52 AM
A polygon can have as many points as you need, 
A polygon is not predefinded to have 4 points
Jan 19, 2009 at 1:41 PM
I used these points: 4.4112, 51.8959, 4.4149, 51.8916, 4.4142, 51.8965, 4.4182, 51.8932 to create a polygon but all i got was about 3 lines and the fills gave them a triangular shape, yet those are coords of  rectangle. Why does it do that?? Is it the order I put them in? Am trying to draw a simple rectangle.
Jan 19, 2009 at 2:19 PM
Your points do not describe a rectangle and they are in the wrong order. Try (x1,y1),(x1,y2),(x2,y2),(x2,y1). Not sure if you need a 5th point (x1,y1) to close the polygon or not, but if the resulting shape is missing a side, then you probably do.
Jan 19, 2009 at 6:25 PM
Its ok, my problem was the order they were placed in. thx