Skip to content

Commit 0bd4463

Browse files
zglueckpdavidc
authored andcommitted
Rename OmnidirectionalSensor to OmnidirectionalSightline (#155)
- This is a continuation of 157eceb - Update the comments and classes of Examples and Tutorials
1 parent 89ee7a0 commit 0bd4463

File tree

10 files changed

+82
-82
lines changed

10 files changed

+82
-82
lines changed

worldwind-examples/src/main/AndroidManifest.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,17 @@
4949
android:theme="@style/AppTheme.NoActionBar">
5050
</activity>
5151
<activity
52-
android:name=".MultiGlobeActivity"
52+
android:name=".OmnidirectionalSightlineActivity"
5353
android:configChanges="orientation|screenSize"
54-
android:label="@string/title_multi_globe"
54+
android:label="@string/title_movable_omni_sightline"
5555
android:launchMode="singleInstance"
5656
android:noHistory="true"
5757
android:theme="@style/AppTheme.NoActionBar">
5858
</activity>
5959
<activity
60-
android:name=".OmnidirectionalSensorActivity"
60+
android:name=".MultiGlobeActivity"
6161
android:configChanges="orientation|screenSize"
62-
android:label="@string/title_omni_sensor"
62+
android:label="@string/title_multi_globe"
6363
android:launchMode="singleInstance"
6464
android:noHistory="true"
6565
android:theme="@style/AppTheme.NoActionBar">

worldwind-examples/src/main/java/gov/nasa/worldwindx/AbstractMainActivity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ public boolean onNavigationItemSelected(MenuItem item) {
318318
case R.id.nav_multi_globe_activity:
319319
startActivity(new Intent(getApplicationContext(), MultiGlobeActivity.class));
320320
break;
321-
case R.id.nav_omnidirectional_sensor_activity:
322-
startActivity(new Intent(getApplicationContext(), OmnidirectionalSensorActivity.class));
321+
case R.id.nav_omnidirectional_sightline_activity:
322+
startActivity(new Intent(getApplicationContext(), OmnidirectionalSightlineActivity.class));
323323
break;
324324
case R.id.nav_paths_example:
325325
startActivity(new Intent(getApplicationContext(), PathsExampleActivity.class));

worldwind-examples/src/main/java/gov/nasa/worldwindx/OmnidirectionalSensorActivity.java renamed to worldwind-examples/src/main/java/gov/nasa/worldwindx/OmnidirectionalSightlineActivity.java

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,20 @@
2727
import gov.nasa.worldwind.shape.ShapeAttributes;
2828

2929
/**
30-
* This Activity demonstrates the OmnidirectionalSightline object and allows the sensor to be dragged.
30+
* This Activity demonstrates the OmnidirectionalSightline object and allows the position of the sightline to be moved
31+
* via a drag action.
3132
*/
32-
public class OmnidirectionalSensorActivity extends BasicGlobeActivity {
33+
public class OmnidirectionalSightlineActivity extends BasicGlobeActivity {
3334

3435
/**
35-
* The sensor which evaluates line of sight
36+
* The OmnidirectionalSightline displaying visibility on the terrain
3637
*/
37-
protected OmnidirectionalSightline sensor;
38+
protected OmnidirectionalSightline sightline;
3839

3940
/**
40-
* A Placemark representing the position of the sensor
41+
* A Placemark representing the position of the sightline
4142
*/
42-
protected Placemark sensorPlacemark;
43+
protected Placemark sightlinePlacemark;
4344

4445
/**
4546
* A custom WorldWindowController object that handles the select, drag and navigation gestures.
@@ -49,9 +50,9 @@ public class OmnidirectionalSensorActivity extends BasicGlobeActivity {
4950
@Override
5051
protected void onCreate(Bundle savedInstanceState) {
5152
super.onCreate(savedInstanceState);
52-
setAboutBoxTitle("About the " + this.getResources().getText(R.string.title_omni_sensor));
53-
setAboutBoxText("Demonstrates a draggable WorldWind Omnidirectional sensor. Drag the placemark icon around the " +
54-
"screen to move the omnidirectional sensor.");
53+
setAboutBoxTitle("About the " + this.getResources().getText(R.string.title_movable_omni_sightline));
54+
setAboutBoxText("Demonstrates a draggable WorldWind Omnidirectional sightline. Drag the placemark icon around the " +
55+
"screen to move the sightline position.");
5556

5657
// Initialize attributes for the OmnidirectionalSightline
5758
ShapeAttributes viewableRegions = new ShapeAttributes();
@@ -62,27 +63,27 @@ protected void onCreate(Bundle savedInstanceState) {
6263

6364
// Initialize the OmnidirectionalSightline and Corresponding Placemark
6465
Position pos = new Position(46.202, -122.190, 500.0);
65-
this.sensor = new OmnidirectionalSightline(pos, 10000.0);
66-
this.sensor.setAttributes(viewableRegions);
67-
this.sensor.setOccludeAttributes(blockedRegions);
68-
this.sensor.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
69-
this.sensorPlacemark = new Placemark(pos);
70-
this.sensorPlacemark.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
71-
this.sensorPlacemark.getAttributes().setImageSource(ImageSource.fromResource(R.drawable.aircraft_fixwing));
72-
this.sensorPlacemark.getAttributes().setImageScale(2);
73-
this.sensorPlacemark.getAttributes().setDrawLeader(true);
74-
75-
// Establish a layer to hold the sensor and placemark
76-
RenderableLayer sensorLayer = new RenderableLayer();
77-
sensorLayer.addRenderable(this.sensor);
78-
sensorLayer.addRenderable(this.sensorPlacemark);
79-
this.wwd.getLayers().addLayer(sensorLayer);
66+
this.sightline = new OmnidirectionalSightline(pos, 10000.0);
67+
this.sightline.setAttributes(viewableRegions);
68+
this.sightline.setOccludeAttributes(blockedRegions);
69+
this.sightline.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
70+
this.sightlinePlacemark = new Placemark(pos);
71+
this.sightlinePlacemark.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
72+
this.sightlinePlacemark.getAttributes().setImageSource(ImageSource.fromResource(R.drawable.aircraft_fixwing));
73+
this.sightlinePlacemark.getAttributes().setImageScale(2);
74+
this.sightlinePlacemark.getAttributes().setDrawLeader(true);
75+
76+
// Establish a layer to hold the sightline and placemark
77+
RenderableLayer sightlineLayer = new RenderableLayer();
78+
sightlineLayer.addRenderable(this.sightline);
79+
sightlineLayer.addRenderable(this.sightlinePlacemark);
80+
this.wwd.getLayers().addLayer(sightlineLayer);
8081

8182
// Override the WorldWindow's built-in navigation behavior with conditional dragging support.
8283
this.controller = new SimpleSelectDragNavigateController();
8384
this.wwd.setWorldWindowController(this.controller);
8485

85-
// And finally, for this demo, position the viewer to look at the sensor position
86+
// And finally, for this demo, position the viewer to look at the sightline position
8687
LookAt lookAt = new LookAt().set(pos.latitude, pos.longitude, pos.altitude, WorldWind.ABSOLUTE, 2e4 /*range*/, 0 /*heading*/, 45 /*tilt*/, 0 /*roll*/);
8788
this.getWorldWindow().getNavigator().setAsLookAt(this.getWorldWindow().getGlobe(), lookAt);
8889
}
@@ -166,15 +167,15 @@ public boolean drag(MotionEvent downEvent, MotionEvent moveEvent, float distance
166167
// First we compute the screen coordinates of the position's "ground" point. We'll apply the
167168
// screen X and Y drag distances to this point, from which we'll compute a new position,
168169
// wherein we restore the original position's altitude.
169-
Position position = sensorPlacemark.getReferencePosition();
170+
Position position = sightlinePlacemark.getReferencePosition();
170171
double altitude = position.altitude;
171172
if (getWorldWindow().geographicToScreenPoint(position.latitude, position.longitude, 0, this.dragRefPt)) {
172173
// Update the placemark's ground position
173174
if (screenPointToGroundPosition(this.dragRefPt.x - distanceX, this.dragRefPt.y - distanceY, position)) {
174175
// Restore the placemark's original altitude
175176
position.altitude = altitude;
176-
// Move the sensor
177-
sensor.setPosition(position);
177+
// Move the sightline
178+
sightline.setPosition(position);
178179
// Reflect the change in position on the globe.
179180
getWorldWindow().requestRedraw();
180181
return true;

worldwind-examples/src/main/res/menu/activity_drawer.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
android:icon="@android:drawable/ic_menu_myplaces"
3333
android:title="@string/title_placemarks_milstd2525_demo"/>
3434
<item
35-
android:id="@+id/nav_omnidirectional_sensor_activity"
35+
android:id="@+id/nav_omnidirectional_sightline_activity"
3636
android:icon="@android:drawable/ic_menu_myplaces"
37-
android:title="@string/title_omni_sensor"/>
37+
android:title="@string/title_movable_omni_sightline"/>
3838
<item
3939
android:id="@+id/nav_paths_example"
4040
android:icon="@android:drawable/ic_menu_directions"

worldwind-examples/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<string name="title_day_night_cycle">Day and Night Cycle</string>
1414
<string name="title_general_globe">General Purpose Globe</string>
1515
<string name="title_multi_globe">Multi-Globe Demonstration</string>
16-
<string name="title_omni_sensor">Omnidirectional Sensor</string>
16+
<string name="title_movable_omni_sightline">Movable OmnidirectionalSightline</string>
1717
<string name="title_paths_example">Paths Example</string>
1818
<string name="title_paths_and_polygons">Paths, Polygons &amp; Labels Demonstration</string>
1919
<string name="title_placemarks_demo">Placemarks Demonstration</string>

worldwind-tutorials/src/main/assets/omnidirectional_sensor_tutorial.html renamed to worldwind-tutorials/src/main/assets/omnidirectional_sightline_tutorial.html

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,26 @@
1414
<link rel="stylesheet" type="text/css" href="file:///android_asset/override.css"/>
1515
</head>
1616
<body>
17-
<h1>OmnidirectionalSensor Tutorial</h1>
17+
<h1>OmnidirectionalSightline Tutorial</h1>
1818
<p>
19-
Demonstrates how to create a OmnidirectionalSensor and add it to the globe
19+
Demonstrates how to create an OmnidirectionalSightline and add it to the globe. An OmnidirectionalSightline provides
20+
a visual area representation of line of sight from a provided position. Areas occluded by terrain will appear in a
21+
different color than areas visible to the provided point.
2022
</p>
2123
<p>
22-
This tutorial demonstrates the creation of an OmnidirectionSensor to the globe. In addition to the sensor, a
23-
placemark indicating the position of the sensor is added to provide visual context.
24+
This tutorial demonstrates the creation of an OmnidirectionSightline. In addition to the OmnidirectionalSightline, a
25+
Placemark indicating the position of the sightline origin is added to provide visual context.
2426
</p>
2527
<p>
26-
The regions colored green indicate they are visible from the position provided to the OmnidirectionSensor. Regions
27-
colored gray are occluded by terrain from the provided position. This tutorial uses a sensor range of 10,000 meters.
28+
The regions colored green indicate they are visible from the position provided to the OmnidirectionSightline.
29+
Regions colored gray are occluded by terrain from the provided position. This tutorial uses a sightline range of
30+
10,000 meters.
2831
</p>
2932
<h2>Example</h2>
30-
<h3>OmnidirectionalSensorFragment.java</h3>
33+
<h3>OmnidirectionalSightlineFragment.java</h3>
3134
<p>
32-
The OmnidirectionSensorFragment class extends the BasicGlobeFragment and overrides the createWorldWindow method. An
33-
OmnidirectionalSensor object with specified position and range is then created and added to the globe.
35+
The OmnidirectionSightlineFragment class extends the BasicGlobeFragment and overrides the createWorldWindow method.
36+
An OmnidirectionalSightline object with specified position and range is then created and added to the globe.
3437
</p>
3538
<div style="border-top: 1px solid black; border-bottom: 1px solid black;">
3639
<textarea id="java-code">
@@ -41,9 +44,9 @@ <h3>OmnidirectionalSensorFragment.java</h3>
4144
// Let the super class (BasicGlobeFragment) do the creation
4245
WorldWindow wwd = super.createWorldWindow();
4346

44-
// Specify the sensors position
47+
// Specify the sightline origin position
4548
Position position = new Position(46.230, -122.190, 2500.0);
46-
// Specify the range of the sensor (meters)
49+
// Specify the range of the sightline (meters)
4750
double range = 10000.0;
4851
// Create attributes for the visible terrain
4952
ShapeAttributes visibleAttributes = new ShapeAttributes();
@@ -52,21 +55,21 @@ <h3>OmnidirectionalSensorFragment.java</h3>
5255
ShapeAttributes occludedAttributes = new ShapeAttributes();
5356
occludedAttributes.setInteriorColor(new Color(0.1f, 0.1f, 0.1f, 0.5f));
5457

55-
// Create the sensor
56-
OmnidirectionalSensor sensor = new OmnidirectionalSensor(position, range);
58+
// Create the sightline
59+
OmnidirectionalSightline sightline = new OmnidirectionalSightline(position, range);
5760
// Add the attributes
58-
sensor.setAttributes(visibleAttributes);
59-
sensor.setOccludeAttributes(occludedAttributes);
61+
sightline.setAttributes(visibleAttributes);
62+
sightline.setOccludeAttributes(occludedAttributes);
6063

61-
// Create a layer for the sensor
62-
RenderableLayer sensorLayer = new RenderableLayer();
63-
sensorLayer.addRenderable(sensor);
64-
wwd.getLayers().addLayer(sensorLayer);
64+
// Create a layer for the sightline
65+
RenderableLayer sightlineLayer = new RenderableLayer();
66+
sightlineLayer.addRenderable(sightline);
67+
wwd.getLayers().addLayer(sightlineLayer);
6568

66-
// Create a Placemark to visualize the position of the sensor
67-
this.createPlacemark(position, sensorLayer);
69+
// Create a Placemark to help visualize the position of the sightline
70+
this.createPlacemark(position, sightlineLayer);
6871

69-
// Position the camera to look at the sensor coverage
72+
// Position the camera to look at the line of site terrain coverage
7073
this.positionView(wwd);
7174

7275
return wwd;
@@ -82,10 +85,6 @@ <h3>OmnidirectionalSensorFragment.java</h3>
8285
mode: "text/x-java",
8386
readOnly: true
8487
});
85-
86-
87-
88-
8988
</script>
9089
</body>
9190
</html>

worldwind-tutorials/src/main/java/gov/nasa/worldwindx/MainActivity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,8 @@ public boolean onNavigationItemSelected(MenuItem item) {
281281
case R.id.nav_navigator_event_activity:
282282
loadTutorial(NavigatorEventFragment.class, "file:///android_asset/navigator_events_tutorial.html", R.string.title_navigator_event);
283283
break;
284-
case R.id.nav_omnidirectional_sensor_activity:
285-
loadTutorial(OmnidirectionalSensorFragment.class, "file:///android_asset/omnidirectional_sensor_tutorial.html", R.string.title_omni_sensor);
284+
case R.id.nav_omnidirectional_sightline_activity:
285+
loadTutorial(OmnidirectionalSightlineFragment.class, "file:///android_asset/omnidirectional_sightline_tutorial.html", R.string.title_omni_sightline);
286286
break;
287287
case R.id.nav_paths_activity:
288288
loadTutorial(PathsFragment.class, "file:///android_asset/paths_tutorial.html", R.string.title_paths);

worldwind-tutorials/src/main/java/gov/nasa/worldwindx/OmnidirectionalSensorFragment.java renamed to worldwind-tutorials/src/main/java/gov/nasa/worldwindx/OmnidirectionalSightlineFragment.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import gov.nasa.worldwind.shape.Placemark;
1717
import gov.nasa.worldwind.shape.ShapeAttributes;
1818

19-
public class OmnidirectionalSensorFragment extends BasicGlobeFragment {
19+
public class OmnidirectionalSightlineFragment extends BasicGlobeFragment {
2020

2121
/**
2222
* Creates a new WorldWindow (GLSurfaceView) object with an OmnidirectionalSightline
@@ -28,9 +28,9 @@ public WorldWindow createWorldWindow() {
2828
// Let the super class (BasicGlobeFragment) do the creation
2929
WorldWindow wwd = super.createWorldWindow();
3030

31-
// Specify the sensors position
31+
// Specify the sightline position
3232
Position position = new Position(46.230, -122.190, 2500.0);
33-
// Specify the range of the sensor (meters)
33+
// Specify the range of the sightline (meters)
3434
double range = 10000.0;
3535
// Create attributes for the visible terrain
3636
ShapeAttributes visibleAttributes = new ShapeAttributes();
@@ -39,21 +39,21 @@ public WorldWindow createWorldWindow() {
3939
ShapeAttributes occludedAttributes = new ShapeAttributes();
4040
occludedAttributes.setInteriorColor(new Color(0.1f, 0.1f, 0.1f, 0.5f));
4141

42-
// Create the sensor
43-
OmnidirectionalSightline sensor = new OmnidirectionalSightline(position, range);
42+
// Create the sightline
43+
OmnidirectionalSightline sightline = new OmnidirectionalSightline(position, range);
4444
// Add the attributes
45-
sensor.setAttributes(visibleAttributes);
46-
sensor.setOccludeAttributes(occludedAttributes);
45+
sightline.setAttributes(visibleAttributes);
46+
sightline.setOccludeAttributes(occludedAttributes);
4747

48-
// Create a layer for the sensor
49-
RenderableLayer sensorLayer = new RenderableLayer();
50-
sensorLayer.addRenderable(sensor);
51-
wwd.getLayers().addLayer(sensorLayer);
48+
// Create a layer for the sightline
49+
RenderableLayer sightlineLayer = new RenderableLayer();
50+
sightlineLayer.addRenderable(sightline);
51+
wwd.getLayers().addLayer(sightlineLayer);
5252

53-
// Create a Placemark to visualize the position of the sensor
54-
this.createPlacemark(position, sensorLayer);
53+
// Create a Placemark to visualize the position of the sightline
54+
this.createPlacemark(position, sightlineLayer);
5555

56-
// Position the camera to look at the sensor coverage
56+
// Position the camera to look at the line of site terrain coverage
5757
this.positionView(wwd);
5858

5959
return wwd;

worldwind-tutorials/src/main/res/menu/activity_drawer.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
android:icon="@android:drawable/ic_menu_compass"
4545
android:title="@string/title_navigator_event"/>
4646
<item
47-
android:id="@+id/nav_omnidirectional_sensor_activity"
47+
android:id="@+id/nav_omnidirectional_sightline_activity"
4848
android:icon="@android:drawable/ic_menu_compass"
49-
android:title="@string/title_omni_sensor"/>
49+
android:title="@string/title_omni_sightline"/>
5050
<item
5151
android:id="@+id/nav_placemarks_activity"
5252
android:icon="@android:drawable/ic_menu_myplaces"

worldwind-tutorials/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<string name="title_labels">Labels</string>
2020
<string name="title_look_at_view">Look At View</string>
2121
<string name="title_navigator_event">Navigator Events</string>
22-
<string name="title_omni_sensor">Omnidirectional Sensor</string>
22+
<string name="title_omni_sightline">Omnidirectional Sightline</string>
2323
<string name="title_paths">Paths</string>
2424
<string name="title_placemarks">Placemarks</string>
2525
<string name="title_placemarks_picking">Placemark Picking</string>

0 commit comments

Comments
 (0)