PageRenderTime 24ms CodeModel.GetById 20ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/src/com/google/maps/extras/planetary/Sky.as

http://gmaps-utility-library-flash.googlecode.com/
ActionScript | 64 lines | 46 code | 6 blank | 12 comment | 1 complexity | 5f95ef81b47a59e0377e4f7df6bb8f83 MD5 | raw file
 1/*
 2* Copyright 2008 Google Inc. 
 3* Licensed under the Apache License, Version 2.0:
 4*  http://www.apache.org/licenses/LICENSE-2.0
 5*/
 6package com.google.maps.extras.planetary {
 7	import com.google.maps.Copyright;
 8	import com.google.maps.CopyrightCollection;
 9	import com.google.maps.LatLng;
10	import com.google.maps.LatLngBounds;
11	import com.google.maps.MapType;
12	import com.google.maps.MapTypeOptions;
13	import com.google.maps.TileLayerBase;
14	
15    /**
16     * Contains all the static Mars map types. To use, import this class and then call on your Map object:
17     * addMapType(Sky.VISIBLE_MAP_TYPE);
18     */
19	public class Sky  {
20		
21        private static var PLANETARY_MAPS_SERVER:String =  "http://mw1.google.com/mw-planetary/";
22        
23        private static var SKY_PARAMETERS:Object = {
24        "visible" : {
25            url: PLANETARY_MAPS_SERVER + "sky/skytiles_v1/",
26            zoom_levels: 19
27        }
28        };
29        
30        private static var SKY_MAP_TYPES:Object = {};
31        
32        /**
33        * This map type shows a mosaic of the sky, covering the full celestial sphere.
34        */
35        public static function get VISIBLE_MAP_TYPE():MapType {
36            return getMapType("visible");
37        }  
38        
39        private static function getMapType(name:String):MapType {
40        	if (!SKY_MAP_TYPES[name]) {
41	            var params:Object = SKY_PARAMETERS[name];
42	            var copyright:CopyrightCollection = new CopyrightCollection();
43	            copyright.addCopyright(
44	                new Copyright(
45	                  "sky_" + name,
46	                   new LatLngBounds(new LatLng(-180, -90), new LatLng(180,90)), 
47	                   0, 
48	                   "SDSS, DSS Consortium, NASA/ESA/STScI"));
49	            var layer:SkyTileLayer = new SkyTileLayer(params.url, copyright, params.zoom_levels);
50	            var maptype:MapType = new MapType(
51	                [layer],  
52	                MapType.NORMAL_MAP_TYPE.getProjection(), 
53	                name, 
54	                new MapTypeOptions({
55	                                  radius: 57.2957763671875,
56	                                  shortName: name,
57	                                  alt: "Show " + name + " map"
58	                }));
59	            SKY_MAP_TYPES[name] = maptype;
60            }
61            return SKY_MAP_TYPES[name];
62        }
63    } 
64}