Worldwind public release 0.2
[worldwind-tracker.git] / gov / nasa / worldwind / layers / Earth / EarthNASAPlaceNameLayer.java
blobf5acb803fed4fad65270475e23f846e23c3d2b3a
1 /*
2 Copyright (C) 2001, 2006 United States Government as represented by
3 the Administrator of the National Aeronautics and Space Administration.
4 All Rights Reserved.
5 */
6 package gov.nasa.worldwind.layers.Earth;
8 import gov.nasa.worldwind.*;
9 import gov.nasa.worldwind.geom.*;
11 /**
12 * @author Paul Collins
13 * @version $Id: EarthNASAPlaceNameLayer.java 1759 2007-05-07 19:27:49Z dcollins $
15 public class EarthNASAPlaceNameLayer extends gov.nasa.worldwind.layers.PlaceNameLayer
17 private static final double LEVEL_A = 0x1 << 25;
18 private static final double LEVEL_B = 0x1 << 24;
19 private static final double LEVEL_C = 0x1 << 23;
20 private static final double LEVEL_D = 0x1 << 22;
21 // private static final double LEVEL_E = 0x1 << 21;
22 private static final double LEVEL_F = 0x1 << 20;
23 private static final double LEVEL_G = 0x1 << 19;
24 // private static final double LEVEL_H = 0x1 << 18;
25 private static final double LEVEL_I = 0x1 << 17;
26 private static final double LEVEL_J = 0x1 << 16;
27 private static final double LEVEL_K = 0x1 << 15;
28 private static final double LEVEL_L = 0x1 << 14;
29 private static final double LEVEL_M = 0x1 << 13;
30 // private static final double LEVEL_N = 0x1 << 12;
32 private static final LatLon GRID_1x1 = new LatLon(Angle.fromDegrees(180d), Angle.fromDegrees(360d));
33 // private static final LatLon GRID_2x4 = new LatLon(Angle.fromDegrees(90d), Angle.fromDegrees(90d));
34 private static final LatLon GRID_5x10 = new LatLon(Angle.fromDegrees(36d), Angle.fromDegrees(36d));
35 private static final LatLon GRID_10x20 = new LatLon(Angle.fromDegrees(18d), Angle.fromDegrees(18d));
36 private static final LatLon GRID_20x40 = new LatLon(Angle.fromDegrees(9d), Angle.fromDegrees(9d));
38 public EarthNASAPlaceNameLayer()
40 super(makePlaceNameServiceSet());
43 private static gov.nasa.worldwind.PlaceNameServiceSet makePlaceNameServiceSet()
45 final String service = "http://worldwind25.arc.nasa.gov/geoservercache/geoservercache.aspx";
46 final String fileCachePath = "Earth/NASA Geoserver Place Names";
47 PlaceNameServiceSet placeNameServiceSet = new PlaceNameServiceSet();
48 PlaceNameService placeNameService;
50 // Oceans
51 placeNameService = new PlaceNameService(service, "topp:wpl_oceans", fileCachePath, Sector.FULL_SPHERE, GRID_1x1,
52 java.awt.Font.decode("Arial-BOLDITALIC-12"));
53 placeNameService.setColor(new java.awt.Color(200, 200, 200));
54 placeNameService.setMinDisplayDistance(0d);
55 placeNameService.setMaxDisplayDistance(LEVEL_A);
56 placeNameServiceSet.addService(placeNameService, false);
57 // Continents
58 placeNameService = new PlaceNameService(service, "topp:wpl_continents", fileCachePath, Sector.FULL_SPHERE,
59 GRID_1x1,
60 java.awt.Font.decode("Arial-BOLD-12"));
61 placeNameService.setColor(new java.awt.Color(255, 255, 240));
62 placeNameService.setMinDisplayDistance(LEVEL_G);
63 placeNameService.setMaxDisplayDistance(LEVEL_A);
64 placeNameServiceSet.addService(placeNameService, false);
66 // Water Bodies
67 placeNameService = new PlaceNameService(service, "topp:wpl_waterbodies", fileCachePath, Sector.FULL_SPHERE,
68 GRID_5x10,
69 java.awt.Font.decode("Arial-ITALIC-10"));
70 placeNameService.setColor(java.awt.Color.cyan);
71 placeNameService.setMinDisplayDistance(0d);
72 placeNameService.setMaxDisplayDistance(LEVEL_B);
73 placeNameServiceSet.addService(placeNameService, false);
74 // Trenches & Ridges
75 placeNameService = new PlaceNameService(service, "topp:wpl_trenchesridges", fileCachePath, Sector.FULL_SPHERE,
76 GRID_5x10,
77 java.awt.Font.decode("Arial-BOLDITALIC-10"));
78 placeNameService.setColor(java.awt.Color.cyan);
79 placeNameService.setMinDisplayDistance(0d);
80 placeNameService.setMaxDisplayDistance(LEVEL_B);
81 placeNameServiceSet.addService(placeNameService, false);
82 // Deserts & Plains
83 placeNameService = new PlaceNameService(service, "topp:wpl_desertsplains", fileCachePath, Sector.FULL_SPHERE,
84 GRID_5x10,
85 java.awt.Font.decode("Arial-BOLDITALIC-10"));
86 placeNameService.setColor(java.awt.Color.orange);
87 placeNameService.setMinDisplayDistance(0d);
88 placeNameService.setMaxDisplayDistance(LEVEL_B);
89 placeNameServiceSet.addService(placeNameService, false);
91 // Lakes & Rivers
92 placeNameService = new PlaceNameService(service, "topp:wpl_lakesrivers", fileCachePath, Sector.FULL_SPHERE,
93 GRID_10x20,
94 java.awt.Font.decode("Arial-ITALIC-10"));
95 placeNameService.setColor(java.awt.Color.cyan);
96 placeNameService.setMinDisplayDistance(0d);
97 placeNameService.setMaxDisplayDistance(LEVEL_C);
98 placeNameServiceSet.addService(placeNameService, false);
99 // Mountains & Valleys
100 placeNameService = new PlaceNameService(service, "topp:wpl_mountainsvalleys", fileCachePath, Sector.FULL_SPHERE,
101 GRID_10x20,
102 java.awt.Font.decode("Arial-BOLDITALIC-10"));
103 placeNameService.setColor(java.awt.Color.orange);
104 placeNameService.setMinDisplayDistance(0d);
105 placeNameService.setMaxDisplayDistance(LEVEL_C);
106 placeNameServiceSet.addService(placeNameService, false);
108 // Countries
109 placeNameService = new PlaceNameService(service, "topp:countries", fileCachePath, Sector.FULL_SPHERE, GRID_5x10,
110 java.awt.Font.decode("Arial-BOLD-10"));
111 placeNameService.setColor(java.awt.Color.white);
112 placeNameService.setMinDisplayDistance(LEVEL_G);
113 placeNameService.setMaxDisplayDistance(LEVEL_D);
114 placeNameServiceSet.addService(placeNameService, false);
115 // GeoNet World Capitals
116 placeNameService = new PlaceNameService(service, "topp:wpl_geonet_p_pplc", fileCachePath, Sector.FULL_SPHERE,
117 GRID_10x20,
118 java.awt.Font.decode("Arial-BOLD-10"));
119 placeNameService.setColor(java.awt.Color.yellow);
120 placeNameService.setMinDisplayDistance(0d);
121 placeNameService.setMaxDisplayDistance(LEVEL_D);
122 placeNameServiceSet.addService(placeNameService, false);
123 // US Cities (Population Over 500k)
124 placeNameService = new PlaceNameService(service, "topp:wpl_uscitiesover500k", fileCachePath, Sector.FULL_SPHERE,
125 GRID_10x20,
126 java.awt.Font.decode("Arial-BOLD-10"));
127 placeNameService.setColor(java.awt.Color.yellow);
128 placeNameService.setMinDisplayDistance(0d);
129 placeNameService.setMaxDisplayDistance(LEVEL_D);
130 placeNameServiceSet.addService(placeNameService, false);
132 // US Cities (Population Over 100k)
133 placeNameService = new PlaceNameService(service, "topp:wpl_uscitiesover100k", fileCachePath, Sector.FULL_SPHERE,
134 GRID_10x20,
135 java.awt.Font.decode("Arial-PLAIN-10"));
136 placeNameService.setColor(java.awt.Color.yellow);
137 placeNameService.setMinDisplayDistance(0d);
138 placeNameService.setMaxDisplayDistance(LEVEL_F);
139 placeNameServiceSet.addService(placeNameService, false);
141 // US Cities (Population Over 50k)
142 placeNameService = new PlaceNameService(service, "topp:wpl_uscitiesover50k", fileCachePath, Sector.FULL_SPHERE,
143 GRID_10x20,
144 java.awt.Font.decode("Arial-PLAIN-10"));
145 placeNameService.setColor(java.awt.Color.yellow);
146 placeNameService.setMinDisplayDistance(0d);
147 placeNameService.setMaxDisplayDistance(LEVEL_I);
148 placeNameServiceSet.addService(placeNameService, false);
150 // US Cities (Population Over 10k)
151 placeNameService = new PlaceNameService(service, "topp:wpl_uscitiesover10k", fileCachePath, Sector.FULL_SPHERE,
152 GRID_10x20,
153 java.awt.Font.decode("Arial-PLAIN-10"));
154 placeNameService.setColor(java.awt.Color.yellow);
155 placeNameService.setMinDisplayDistance(0d);
156 placeNameService.setMaxDisplayDistance(LEVEL_J);
157 placeNameServiceSet.addService(placeNameService, false);
159 // US Cities (Population Over 1k)
160 placeNameService = new PlaceNameService(service, "topp:wpl_uscitiesover1k", fileCachePath, Sector.FULL_SPHERE,
161 GRID_20x40,
162 java.awt.Font.decode("Arial-PLAIN-10"));
163 placeNameService.setColor(java.awt.Color.yellow);
164 placeNameService.setMinDisplayDistance(0d);
165 placeNameService.setMaxDisplayDistance(LEVEL_K);
166 placeNameServiceSet.addService(placeNameService, false);
168 // US Cities (Population Over 0)
169 placeNameService = new PlaceNameService(service, "topp:wpl_uscitiesover0", fileCachePath, Sector.FULL_SPHERE,
170 GRID_20x40,
171 java.awt.Font.decode("Arial-PLAIN-10"));
172 placeNameService.setColor(java.awt.Color.yellow);
173 placeNameService.setMinDisplayDistance(0d);
174 placeNameService.setMaxDisplayDistance(LEVEL_L);
175 placeNameServiceSet.addService(placeNameService, false);
177 // US Cities (No Population)
178 placeNameService = new PlaceNameService(service, "topp:wpl_uscities0", fileCachePath, Sector.FULL_SPHERE,
179 GRID_20x40,
180 java.awt.Font.decode("Arial-PLAIN-10"));
181 placeNameService.setColor(java.awt.Color.yellow);
182 placeNameService.setMinDisplayDistance(0d);
183 placeNameService.setMaxDisplayDistance(LEVEL_M);
184 placeNameServiceSet.addService(placeNameService, false);
186 // // US Anthropogenic Features
187 // placeNameService = new PlaceNameService(service, "topp:wpl_us_anthropogenic", fileCachePath, Sector.FULL_SPHERE, GRID_20x40,
188 // java.awt.Font.decode("Arial-PLAIN-10"));
189 // placeNameService.setColor(java.awt.Color.yellow);
190 // placeNameService.setMinDisplayDistance(0d);
191 // placeNameService.setMaxDisplayDistance(LEVEL_N);
192 // placeNameServiceSet.addService(placeNameService, false);
193 // // US Water Features
194 // placeNameService = new PlaceNameService(service, "topp:wpl_us_water", fileCachePath, Sector.FULL_SPHERE, GRID_20x40,
195 // java.awt.Font.decode("Arial-PLAIN-10"));
196 // placeNameService.setColor(java.awt.Color.cyan);
197 // placeNameService.setMinDisplayDistance(0d);
198 // placeNameService.setMaxDisplayDistance(LEVEL_N);
199 // placeNameServiceSet.addService(placeNameService, false);
200 // // US Terrain Features
201 // placeNameService = new PlaceNameService(service, "topp:wpl_us_terrain", fileCachePath, Sector.FULL_SPHERE, GRID_20x40,
202 // java.awt.Font.decode("Arial-PLAIN-10"));
203 // placeNameService.setColor(java.awt.Color.orange);
204 // placeNameService.setMinDisplayDistance(0d);
205 // placeNameService.setMaxDisplayDistance(LEVEL_N);
206 // placeNameServiceSet.addService(placeNameService, false);
208 // // GeoNET Administrative 1st Order
209 // placeNameService = new PlaceNameService(service, "topp:wpl_geonet_a_adm1", fileCachePath, Sector.FULL_SPHERE, GRID_20x40,
210 // java.awt.Font.decode("Arial-BOLD-10"));
211 // placeNameService.setColor(java.awt.Color.yellow);
212 // placeNameService.setMinDisplayDistance(0d);
213 // placeNameService.setMaxDisplayDistance(LEVEL_N);
214 // placeNameServiceSet.addService(placeNameService, false);
215 // // GeoNET Administrative 2nd Order
216 // placeNameService = new PlaceNameService(service, "topp:wpl_geonet_a_adm2", fileCachePath, Sector.FULL_SPHERE, GRID_20x40,
217 // java.awt.Font.decode("Arial-BOLD-10"));
218 // placeNameService.setColor(java.awt.Color.yellow);
219 // placeNameService.setMinDisplayDistance(0d);
220 // placeNameService.setMaxDisplayDistance(LEVEL_N);
221 // placeNameServiceSet.addService(placeNameService, false);
222 // // GeoNET Populated Place Administrative
223 // placeNameService = new PlaceNameService(service, "topp:wpl_geonet_p_ppla", fileCachePath, Sector.FULL_SPHERE, GRID_20x40,
224 // java.awt.Font.decode("Arial-BOLD-10"));
225 // placeNameService.setColor(java.awt.Color.pink);
226 // placeNameService.setMinDisplayDistance(0d);
227 // placeNameService.setMaxDisplayDistance(LEVEL_N);
228 // placeNameServiceSet.addService(placeNameService, false);
229 // // GeoNET Populated Place
230 // placeNameService = new PlaceNameService(service, "topp:wpl_geonet_p_ppl", fileCachePath, Sector.FULL_SPHERE, GRID_20x40,
231 // java.awt.Font.decode("Arial-PLAIN-10"));
232 // placeNameService.setColor(java.awt.Color.pink);
233 // placeNameService.setMinDisplayDistance(0d);
234 // placeNameService.setMaxDisplayDistance(LEVEL_N);
235 // placeNameServiceSet.addService(placeNameService, false);
237 return placeNameServiceSet;
240 @Override
241 public String toString()
243 return gov.nasa.worldwind.WorldWind.retrieveErrMsg("layers.Earth.PlaceName.Name");