|
7 | 7 | package gov.nasa.worldwindx.examples;
|
8 | 8 |
|
9 | 9 | import gov.nasa.worldwind.Configuration;
|
10 |
| -import gov.nasa.worldwind.WorldWind; |
11 | 10 | import gov.nasa.worldwind.avlist.AVKey;
|
12 |
| -import gov.nasa.worldwind.geom.Angle; |
13 | 11 | import gov.nasa.worldwind.geom.Position;
|
14 | 12 | import gov.nasa.worldwind.layers.RenderableLayer;
|
15 |
| -import gov.nasa.worldwind.render.Offset; |
16 |
| -import gov.nasa.worldwind.render.PointPlacemark; |
17 |
| -import gov.nasa.worldwind.render.PointPlacemarkAttributes; |
18 | 13 | import gov.nasa.worldwind.render.SurfaceText;
|
19 | 14 |
|
20 | 15 | /**
|
|
25 | 20 | */
|
26 | 21 | public class SurfaceTextUsage extends ApplicationTemplate
|
27 | 22 | {
|
28 |
| - private static Position center = Position.fromDegrees(38.9345, -120.1670, 50000); |
29 |
| - |
30 | 23 | public static class AppFrame extends ApplicationTemplate.AppFrame
|
31 | 24 | {
|
32 | 25 | public AppFrame()
|
33 | 26 | {
|
34 | 27 | super(true, true, false);
|
35 | 28 |
|
36 | 29 | RenderableLayer layer = new RenderableLayer();
|
37 |
| - |
38 |
| - int j = 0; |
39 |
| - for (double x = -1.0; x <= 0.0; x += 0.5, j++) |
40 |
| - { |
41 |
| - for (double y = -1.0; y <= 0.0; y += 0.5, j++) |
42 |
| - { |
43 |
| - for (int i = 0; i <= 12; i++) |
44 |
| - { |
45 |
| - double latitude = center.latitude.degrees + ((j - 4) / 5.0); |
46 |
| - double longitude = center.longitude.degrees + ((i - 6) / 5.0); |
47 |
| - Position position = Position.fromDegrees(latitude, longitude, 0); |
48 |
| - |
49 |
| - SurfaceText surfaceText = new SurfaceText("Test Label Description", position); |
50 |
| - surfaceText.setDrawBoundingSectors(true); |
51 |
| - surfaceText.setHeading(Angle.fromDegrees(i * 30)); |
52 |
| - surfaceText.setOffset(Offset.fromFraction(x, y)); |
53 |
| - layer.addRenderable(surfaceText); |
54 | 30 |
|
55 |
| - PointPlacemark placemark = new PointPlacemark(position); |
56 |
| - placemark.setAltitudeMode(WorldWind.CLAMP_TO_GROUND); |
57 |
| - PointPlacemarkAttributes attrs = new PointPlacemarkAttributes(); |
58 |
| - attrs.setLabelColor("ffffffff"); |
59 |
| - attrs.setLineColor("ff0000ff"); |
60 |
| - attrs.setUsePointAsDefaultImage(true); |
61 |
| - attrs.setScale(5d); |
62 |
| - placemark.setAttributes(attrs); |
63 |
| - layer.addRenderable(placemark); |
64 |
| - } |
65 |
| - } |
66 |
| - } |
| 31 | + SurfaceText surfaceText = new SurfaceText("Desolation Wilderness", Position.fromDegrees(38.9345, -120.1670, 0)); |
| 32 | + layer.addRenderable(surfaceText); |
67 | 33 |
|
68 | 34 | this.getWwd().getModel().getLayers().add(layer);
|
69 | 35 | }
|
70 | 36 | }
|
71 | 37 |
|
72 | 38 | public static void main(String[] args)
|
73 | 39 | {
|
74 |
| - Configuration.setValue(AVKey.INITIAL_LATITUDE, center.latitude.degrees); |
75 |
| - Configuration.setValue(AVKey.INITIAL_LONGITUDE, center.longitude.degrees); |
76 |
| - Configuration.setValue(AVKey.INITIAL_ALTITUDE, center.elevation); |
| 40 | + Configuration.setValue(AVKey.INITIAL_LATITUDE, 38.9345); |
| 41 | + Configuration.setValue(AVKey.INITIAL_LONGITUDE, -120.1670); |
| 42 | + Configuration.setValue(AVKey.INITIAL_ALTITUDE, 50000); |
77 | 43 |
|
78 | 44 | ApplicationTemplate.start("WorldWind Surface Text", AppFrame.class);
|
79 | 45 | }
|
|
0 commit comments