Thursday, January 7, 2010

More Overview Map stuff Figured out

So one of the big things i was struggling with was how to make it so the overview map would change it's zoom level to show everybody's individual view boxes....

There is a function you can use on a map, in which you give it a set of LatLngBounds and do this:

map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds));


Where map is the map in question, and bounds are the latlng bounds variable. Then in order to add points or polygons to it you can run these functions...

bounds.union(latLngBounds) for other bounds (these can be extracted from polygons using the .getLatLngBounds() function) and bounds.extend(latLng) for individual points

Wednesday, January 6, 2010

Moving a polygon

So, one of the big things that I am hoping to have in my system is some way of displaying view rectangles on a custom overview map. Since people will change their views often it would be troublesome if I had to reset the entire map in order to move one of the view rectangles. I will be posting more about the custom overview map when it is finalized since from what i can tell nobody else in the google maps flex community has done it...

Here is an example of how this moving can be done...
public function setCenter(latLng : LatLngBounds) : void
{
// this funciton is only for testing, it will be replaced,
// polygons stored in the team member vo will store a polygon
// that can be changed when they change their view!
map.setCenter(latLng.getCenter());

if (polygon == null)
{
polygon = new Polygon([
latLng.getNorthWest(),
latLng.getSouthWest(),
latLng.getSouthEast(),
latLng.getNorthEast(),
latLng.getNorthWest()],
new PolygonOptions({
strokeStyle: new StrokeStyle({
color: 0x0000ff,
thickness: 4,
alpha: 0.7}),
fillStyle: new FillStyle({
color: 0x0000ff,
alpha: 0.5})
}));

map.addOverlay(polygon);
}
else
{
polygon.setPolyline(0,
[
latLng.getNorthWest(),
latLng.getSouthWest(),
latLng.getSouthEast(),
latLng.getNorthEast(),
latLng.getNorthWest()]);
}

}


You need to remember to store the polygon somewhere (it doesn't have to be in the class with the map)...

Welcome to my benchmarking blog...

This blog will be used as a place for me to store information about my project designing a Geographic-Information System to help support distributed collaborative teams.

While for the most part I will be using this blog as a way to keep track of information to be later accessed when I have to do a write up of my project I hope that it will also provide a valuable to the coding community.

I will be using the Google Maps Flex plugin to develop this system and alot of the stuff that I am doing to support the functionality that I wish has yet to be done so I hope that I can also help other developers. I am hoping to start updating this ASAP