Skip to content

Commit 51d6a28

Browse files
authored
Merge pull request #199 from Esri/dev
Release 100.2.0
2 parents 562427a + 88cbcdc commit 51d6a28

File tree

75 files changed

+2395
-693
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+2395
-693
lines changed

.gitignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22
bin/
33
tmp/
44
build/
5+
out/
56

67
# Local configuration file (sdk path, etc)
78
local.properties
89
.gradle/
10+
/samples-data/
11+
/jniLibs/
12+
/resources/
913

1014
# Intellij project files
1115
*.ipr
@@ -33,6 +37,3 @@ local.properties
3337
.Trashes
3438
ehthumbs.db
3539
Thumbs.db
36-
/samples-data/
37-
/jniLibs/
38-
/resources/

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ArcGIS Runtime Java SDK Samples
2-
### 100.1.0
2+
### 100.2.0
33
This project includes a set of samples demonstrating how to accomplish various mapping and GIS tasks with the ArcGIS Runtime SDK for Java.
44

55
These samples are built with Gradle. If you want to learn more about Gradle, learn more from [Gradle's guide](https://docs.gradle.org/current/userguide/userguide.html).
@@ -71,7 +71,7 @@ Esri welcomes contributions from anyone and everyone. Please see our [guidelines
7171
Find a bug or want a new feature? Please let us know by submitting an issue.
7272

7373
## Licensing
74-
Copyright 2016 Esri
74+
Copyright 2017 Esri
7575

7676
Licensed under the Apache License, Version 2.0 (the "License"); you may not
7777
use this file except in compliance with the License. You may obtain a copy

build.gradle

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ buildscript {
1414
}
1515
}
1616

17-
arcgis.version = '100.1.0'
17+
arcgis.version = '100.2.0'
1818

1919
idea.module.downloadJavadoc = true
2020
eclipse.classpath.downloadJavadoc = true
@@ -23,7 +23,6 @@ compileJava.options.encoding = 'UTF-8'
2323

2424
dependencies {
2525
compile 'commons-io:commons-io:2.4'
26-
compile 'org.controlsfx:controlsfx:8.40.13'
2726
compile 'org.jooq:joox:1.4.0'
2827
}
2928

@@ -50,7 +49,5 @@ run {
5049
}
5150

5251
task wrapper(type: Wrapper) {
53-
gradleVersion = '3.0'
54-
}
55-
56-
run.dependsOn downloadData
52+
gradleVersion = '4.3.1'
53+
}

gradle/wrapper/gradle-wrapper.jar

1.87 KB
Binary file not shown.
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Thu Sep 29 13:58:52 PDT 2016
1+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-bin.zip
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4-
zipStoreBase=GRADLE_USER_HOME
54
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip
5+
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env sh
22

33
##############################################################################
44
##
@@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS=""
3333
# Use the maximum available, or set MAX_FD != -1 to use that value.
3434
MAX_FD="maximum"
3535

36-
warn ( ) {
36+
warn () {
3737
echo "$*"
3838
}
3939

40-
die ( ) {
40+
die () {
4141
echo
4242
echo "$*"
4343
echo
@@ -154,16 +154,19 @@ if $cygwin ; then
154154
esac
155155
fi
156156

157-
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158-
function splitJvmOpts() {
159-
JVM_OPTS=("$@")
157+
# Escape application args
158+
save () {
159+
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160+
echo " "
160161
}
161-
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162-
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
162+
APP_ARGS=$(save "$@")
163+
164+
# Collect all arguments for the java command, following the shell quoting and substitution rules
165+
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
163166

164167
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
165-
if [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]]; then
168+
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
166169
cd "$(dirname "$0")"
167170
fi
168171

169-
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
172+
exec "$JAVACMD" "$@"
1.07 MB
Loading
2.52 MB
Loading
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
/*
2+
* Copyright 2017 Esri.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
17+
package com.esri.samples.analysis.line_of_sight_location;
18+
19+
import java.util.concurrent.ExecutionException;
20+
21+
import javafx.application.Application;
22+
import javafx.event.EventHandler;
23+
import javafx.geometry.Point2D;
24+
import javafx.scene.Scene;
25+
import javafx.scene.input.MouseButton;
26+
import javafx.scene.input.MouseEvent;
27+
import javafx.scene.layout.StackPane;
28+
import javafx.stage.Stage;
29+
30+
import com.esri.arcgisruntime.concurrent.ListenableFuture;
31+
import com.esri.arcgisruntime.geoanalysis.LocationLineOfSight;
32+
import com.esri.arcgisruntime.geometry.Point;
33+
import com.esri.arcgisruntime.geometry.SpatialReferences;
34+
import com.esri.arcgisruntime.mapping.ArcGISScene;
35+
import com.esri.arcgisruntime.mapping.ArcGISTiledElevationSource;
36+
import com.esri.arcgisruntime.mapping.Basemap;
37+
import com.esri.arcgisruntime.mapping.Surface;
38+
import com.esri.arcgisruntime.mapping.view.AnalysisOverlay;
39+
import com.esri.arcgisruntime.mapping.view.Camera;
40+
import com.esri.arcgisruntime.mapping.view.SceneView;
41+
42+
public class LineOfSightLocationSample extends Application {
43+
44+
private SceneView sceneView;
45+
46+
@Override
47+
public void start(Stage stage) throws Exception {
48+
49+
try {
50+
51+
// create stack pane and JavaFX app scene
52+
StackPane stackPane = new StackPane();
53+
Scene fxScene = new Scene(stackPane);
54+
55+
// set title, size, and add JavaFX scene to stage
56+
stage.setTitle("Line of Sight Location Sample");
57+
stage.setWidth(800);
58+
stage.setHeight(700);
59+
stage.setScene(fxScene);
60+
stage.show();
61+
62+
// create a scene and add a basemap to it
63+
ArcGISScene scene = new ArcGISScene();
64+
scene.setBasemap(Basemap.createTopographic());
65+
66+
// add the SceneView to the stack pane
67+
sceneView = new SceneView();
68+
sceneView.setArcGISScene(scene);
69+
stackPane.getChildren().add(sceneView);
70+
71+
// add base surface for elevation data
72+
Surface surface = new Surface();
73+
surface.getElevationSources().add(new ArcGISTiledElevationSource( "http://elevation3d.arcgis" +
74+
".com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"));
75+
scene.setBaseSurface(surface);
76+
77+
// create an analysis overlay for the line of sight
78+
AnalysisOverlay analysisOverlay = new AnalysisOverlay();
79+
sceneView.getAnalysisOverlays().add(analysisOverlay);
80+
81+
// initialize a line of sight analysis and add it to the analysis overlay
82+
Point observerLocation = new Point(-73.06958032962375,-49.253112971555446,2000, SpatialReferences.getWgs84());
83+
Point targetLocation = new Point(-73.079266999709162, -49.300457676730559, 1312, SpatialReferences.getWgs84());
84+
LocationLineOfSight lineOfSight = new LocationLineOfSight(observerLocation, targetLocation);
85+
analysisOverlay.getAnalyses().add(lineOfSight);
86+
87+
// initialize the viewpoint
88+
Camera camera = new Camera(new Point(-73.0815, -49.3272, 4059, SpatialReferences.getWgs84()), 11, 62, 0);
89+
sceneView.setViewpointCamera(camera);
90+
91+
// remove default mouse move handler
92+
sceneView.setOnMouseMoved(null);
93+
94+
// update the target location when the mouse moves
95+
EventHandler<MouseEvent> mouseMoveEventHandler = event -> {
96+
Point2D point2D = new Point2D(event.getX(), event.getY());
97+
// get the scene location from the screen position
98+
ListenableFuture<Point> pointFuture = sceneView.screenToLocationAsync(point2D);
99+
pointFuture.addDoneListener(() -> {
100+
try {
101+
Point point = pointFuture.get();
102+
// update the target location
103+
lineOfSight.setTargetLocation(point);
104+
} catch (InterruptedException | ExecutionException e) {
105+
e.printStackTrace();
106+
}
107+
});
108+
};
109+
110+
// mouse click to start/stop moving target location
111+
sceneView.setOnMouseClicked(event -> {
112+
if (event.isStillSincePress() && event.getButton() == MouseButton.PRIMARY) {
113+
if (sceneView.getOnMouseMoved() == null) {
114+
sceneView.setOnMouseMoved(mouseMoveEventHandler);
115+
} else {
116+
sceneView.setOnMouseMoved(null);
117+
}
118+
}
119+
});
120+
121+
} catch (Exception e) {
122+
// on any error, display the stack trace.
123+
e.printStackTrace();
124+
}
125+
}
126+
127+
/**
128+
* Stops and releases all resources used in application.
129+
*/
130+
@Override
131+
public void stop() {
132+
133+
if (sceneView != null) {
134+
sceneView.dispose();
135+
}
136+
}
137+
138+
/**
139+
* Opens and runs application.
140+
*
141+
* @param args arguments passed to this application
142+
*/
143+
public static void main(String[] args) {
144+
145+
Application.launch(args);
146+
}
147+
148+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<h1>Line of Sight Location</h1>
2+
3+
<p>Demonstrates how to update a line of sight on-the-fly with the mouse.</p>
4+
5+
<h2>How to use the sample</h2>
6+
7+
<p>Click to turn on the mouse move event listener. Then move the mouse where you want the target location to be.
8+
Click again to lock the target location.</p>
9+
10+
<p><img src="LineOfSightLocation.gif"/></p>
11+
12+
<h2>How it works</h2>
13+
14+
<p>To create a line of sight and update it with the mouse:</p>
15+
16+
<ol>
17+
<li>Create an <code>AnalysisOverlay</code> and add it to the scene view.</li>
18+
<li>Create a <code>LocationLineOfSight</code> with initial observer and target locations and add it to the analysis
19+
overlay.</li>
20+
<li>Make an <code>EventHandler&lt;MouseEvent&gt;</code> to capture mouse movement. Turn the screen point into a scene
21+
point with <code>sceneView.screenToLocationAsync(screenPoint)</code>.</li>
22+
<li>Update the target location with <code>lineOfSight.setTargetLocation(scenePoint)</code>.</li>
23+
</ol>
24+
25+
<h2>Features</h2>
26+
27+
<ul>
28+
<li>3D</li>
29+
<li>AnalysisOverlay</li>
30+
<li>ArcGISTiledElevationSource</li>
31+
<li>ArcGISScene</li>
32+
<li>Camera</li>
33+
<li>LocationLineOfSight</li>
34+
<li>SceneView</li>
35+
</ul>

0 commit comments

Comments
 (0)