Working with shapes in virtual Earth
One of the main reasons of building your own VE application is to successfully display specific data on the map. Virtual Earth has 3 primary shapes that you can use to present information. They are polygons, pushpins and polylines. All 3 types of shape are an inseparable part of same VEShape class. You can access all the shape's properties through set and get methods.
Constructing Shapes: All shapes in Virtual earth are constructed with the help of Veshape constructor method. This method accepts parameter that indicates shape type and Velatlong points. However creating the shape is not enough. You also have to set shape properties and then add that shape to map. Each shape object has set and get methods that enable users to interact with shapes. For instance you can add description and title to each pushpin. For polylines and polygons, you can easily adjust the thickness and color.
Adding a polygon: The process to add a polygon is similar to adding pushpin. However you need to create array of points to represent vertices of polygon. A polygon by default has thin blue border, transparent green fill, a pushpin that sits somewhere in the area. With few property settings, all that can be changed.
Customizing the polygon: It is possible to customize the polygon. You can make the polygon thick, red with no fill. You will have to write a particular code for it. Note that every method to set the color needs a VEColor object. The constructor for color object takes a green, red and blue value and a transparency or alpha value. Width parameter is always in pixels.
Adding a polyline: Polyline is the last shape choice. There is not much difference between a polygon and polyline except the shape is not closed. As with polygon, here also you can set the color and thickness of line.
Advanced Shape properties: Once you know the basics of how to add shapes, you can use special shape properties to change behavior and appearance of your objects.
Custom pins: The first thing that you should consider is to modify the default icon. The icon can be replaced by setting custom icon property. The property does point to:
1] URL of any image.
2] A VECustomIconSpecification object 3] A string of HTML.
Each approach has some advantages and disadvantages. An easy approach to change the icon is to create icon and then set custom Icon property that should point to URL of that image. But a lot can be done with custom HTML. To change the icon you will have to write some specific code.
The VECustomIconSpecification: The last option to change icon is VECustomIconSpecification object. Unfortunately 3D map control does not display custom HTML. That is why if you plan to use 3D map control and wish to make use of HTML icons, you should use VECustomIconSpecification wrapper
Creating custom 3D pushpin: When you set image property, ensure that target URL is externally accessible and is qualified fully. As 3D control is nothing but an ActiveX control, it operates under security restrictions that don't allow access to local web namespace. In 3D and 2D the icon appears differently.
Technorati Tags: Microsoft, virtual earth, virtual earth features,
Tags: Microsoft Virtual Earth
























