Thursday, 23 June 2011

Road Atlas


package utils
{
import com.google.maps.Map3D;
import com.google.maps.StyledMapType;
import com.google.maps.StyledMapTypeOptions;
import com.google.maps.controls.MapTypeControl;
import com.google.maps.styles.MapTypeStyle;
import com.google.maps.styles.MapTypeStyleElementType;
import com.google.maps.styles.MapTypeStyleFeatureType;
import com.google.maps.styles.MapTypeStyleRule;


public class RoadAtlasUtil
{
public function RoadAtlasUtil()
{

}

/**
* This method creates a new map type i.e. Road Atlas Map
* It is included with the main Map in the application
*/
public function roadAtlas(mapRef:Map3D):void 
{
var roadAtlasStyles:Array = 
[
new MapTypeStyle(MapTypeStyleFeatureType.ROAD_HIGHWAY,MapTypeStyleElementType.GEOMETRY,
[MapTypeStyleRule.hue(0xff0022),MapTypeStyleRule.saturation(60),MapTypeStyleRule.lightness(-20)]),
new MapTypeStyle(MapTypeStyleFeatureType.ROAD_ARTERIAL,MapTypeStyleElementType.GEOMETRY,
[MapTypeStyleRule.hue(0x2200ff),MapTypeStyleRule.lightness(-40),
MapTypeStyleRule.visibility("simplified"),MapTypeStyleRule.saturation(30)]),
new MapTypeStyle(MapTypeStyleFeatureType.ROAD_LOCAL,MapTypeStyleElementType.ALL,
[MapTypeStyleRule.hue(0xf6ff00),MapTypeStyleRule.saturation(50),
MapTypeStyleRule.gamma(0.7),MapTypeStyleRule.visibility("simplified")]),
new MapTypeStyle(MapTypeStyleFeatureType.WATER,MapTypeStyleElementType.GEOMETRY,
[MapTypeStyleRule.saturation(40),MapTypeStyleRule.lightness(40)]),
new MapTypeStyle(MapTypeStyleFeatureType.ROAD_HIGHWAY,MapTypeStyleElementType.LABELS,
[MapTypeStyleRule.visibility("on"),MapTypeStyleRule.saturation(98)]),
new MapTypeStyle(MapTypeStyleFeatureType.ADMINISTRATIVE_LOCALITY,MapTypeStyleElementType.LABELS,
[MapTypeStyleRule.hue(0x0022ff),MapTypeStyleRule.saturation(50),
MapTypeStyleRule.lightness(-10),MapTypeStyleRule.gamma(0.9)]),
new MapTypeStyle(MapTypeStyleFeatureType.TRANSIT_LINE,MapTypeStyleElementType.GEOMETRY,
[MapTypeStyleRule.hue(0xff0000),MapTypeStyleRule.visibility("on"),MapTypeStyleRule.lightness(-70)])            
];

var styledMapOptions:StyledMapTypeOptions = new StyledMapTypeOptions({
name: 'Road Atlas',
alt: 'USRoadAtlas'
});

var styledMapType:StyledMapType = new StyledMapType(roadAtlasStyles, styledMapOptions);
mapRef.addMapType(styledMapType);
mapRef.addControl(new MapTypeControl());
}
}
}

No comments:

Post a Comment