Skip to content

Data parent directory #413

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Oct 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public void start(Stage stage) {
);

// create a graphic of a taxi to be the target
String modelURI = new File("./samples-data/dolmus_3ds/dolmus.3ds").getAbsolutePath();
String modelURI = new File(System.getProperty("data.dir"), "./samples-data/dolmus_3ds/dolmus.3ds").getAbsolutePath();
ModelSceneSymbol taxiSymbol = new ModelSceneSymbol(modelURI, 1.0);
taxiSymbol.setAnchorPosition(SceneSymbol.AnchorPosition.BOTTOM);
taxiSymbol.loadAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ public void start(Stage stage) {
graphicsOverlay.setRenderer(renderer3D);

// create a graphic of a tank
String modelURI = new File("./samples-data/bradley_low_3ds/bradle.3ds").getAbsolutePath();
ModelSceneSymbol tankSymbol = new ModelSceneSymbol(modelURI, 10.0);
String modelURI = new File(System.getProperty("data.dir"), "./samples-data/bradley_low_3ds/bradle.3ds").getAbsolutePath();
ModelSceneSymbol tankSymbol = new ModelSceneSymbol(modelURI.replace("\\", "/"), 10.0);
tankSymbol.setHeading(90);
tankSymbol.setAnchorPosition(SceneSymbol.AnchorPosition.BOTTOM);
tankSymbol.loadAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ public void start(Stage stage) throws Exception {
mapView.getGraphicsOverlays().add(graphicsOverlay);

// create symbol dictionary from style file
DictionarySymbolStyle symbolDictionary = DictionarySymbolStyle.createFromFile("./samples-data/stylx/mil2525d.stylx");
File stylxFile = new File(System.getProperty("data.dir"), "./samples-data/stylx/mil2525d.stylx");
DictionarySymbolStyle symbolDictionary = DictionarySymbolStyle.createFromFile(stylxFile.getAbsolutePath());

// tells graphics overlay how to render graphics with symbol dictionary attributes set
DictionaryRenderer renderer = new DictionaryRenderer(symbolDictionary);
Expand All @@ -102,7 +103,7 @@ public void start(Stage stage) throws Exception {
*/
private List<Map<String, Object>> parseMessages() throws Exception {

File mil2525dFile = new File("./samples-data/xml/Mil2525DMessages.xml");
File mil2525dFile = new File(System.getProperty("data.dir"), "./samples-data/xml/Mil2525DMessages.xml");
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document document = documentBuilder.parse(mil2525dFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ private void initialize() {

try {
// create a basemap from a local tile cache
TileCache sanFranciscoTileCache = new TileCache("samples-data/sanfrancisco/SanFrancisco.tpk");
File tpkFile = new File(System.getProperty("data.dir"), "./samples-data/sanfrancisco/SanFrancisco.tpk");
TileCache sanFranciscoTileCache = new TileCache(tpkFile.getAbsolutePath());
ArcGISTiledLayer tiledLayer = new ArcGISTiledLayer(sanFranciscoTileCache);
Basemap basemap = new Basemap(tiledLayer);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import com.esri.arcgisruntime.symbology.DictionaryRenderer;
import com.esri.arcgisruntime.symbology.DictionarySymbolStyle;

import java.io.File;

public class FeatureLayerDictionaryRendererSample extends Application {

private MapView mapView;
Expand All @@ -57,7 +59,8 @@ public void start(Stage stage) {
geodatabase.loadAsync();

// render tells layer what symbols to apply to what features
DictionarySymbolStyle symbolDictionary = DictionarySymbolStyle.createFromFile("./samples-data/stylx/mil2525d.stylx");
File stylxFile = new File(System.getProperty("data.dir"), "./samples-data/stylx/mil2525d.stylx");
DictionarySymbolStyle symbolDictionary = DictionarySymbolStyle.createFromFile(stylxFile.getAbsolutePath());
symbolDictionary.loadAsync();

geodatabase.addDoneLoadingListener(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ public void start(Stage stage) {
mapView.setMap(map);

// create geodatabase from local resource
String geodatabaseUrl = new File("samples-data/los_angeles/LA_Trails.geodatabase").getAbsolutePath();
Geodatabase geodatabase = new Geodatabase(geodatabaseUrl);
File geodatabaseFile = new File(System.getProperty("data.dir"), "./samples-data/los_angeles/LA_Trails" +
".geodatabase");
Geodatabase geodatabase = new Geodatabase(geodatabaseFile.getAbsolutePath());
geodatabase.addDoneLoadingListener(() -> {
if (geodatabase.getLoadStatus() == LoadStatus.LOADED) {
// access the geodatabase's feature table Trailheads
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void start(Stage stage) {
ArcGISMap map = new ArcGISMap(Basemap.createStreetsVector());

// create a GeoPackage from a local gpkg file
File geoPackageFile = new File("./samples-data/auroraCO/AuroraCO.gpkg");
File geoPackageFile = new File(System.getProperty("data.dir"), "./samples-data/auroraCO/AuroraCO.gpkg");
GeoPackage geoPackage = new GeoPackage(geoPackageFile.getAbsolutePath());
geoPackage.loadAsync();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void start(Stage stage) {
mapView.setMap(map);

// create a shapefile feature table from the local file
File shapefile = new File("./samples-data/auroraCO/Public_Art.shp");
File shapefile = new File(System.getProperty("data.dir"), "./samples-data/auroraCO/Public_Art.shp");
ShapefileFeatureTable shapefileFeatureTable = new ShapefileFeatureTable(shapefile.getAbsolutePath());

// use the shapefile feature table to create a feature layer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public void start(Stage stage) {
stage.show();

// use a local tile package for the basemap
TileCache tileCache = new TileCache("samples-data/sanfrancisco/SanFrancisco.tpk");
File tpkFile = new File(System.getProperty("data.dir"), "./samples-data/sanfrancisco/SanFrancisco.tpk");
TileCache tileCache = new TileCache(tpkFile.getAbsolutePath());
ArcGISTiledLayer tiledLayer = new ArcGISTiledLayer(tileCache);

// create a map view and add a map
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void start(Stage stage) {
mapView.setMap(map);

// load the ENC exchange set from local data
File encPath = new File("./samples-data/enc/ExchangeSetwithoutUpdates/ENC_ROOT/CATALOG.031");
File encPath = new File(System.getProperty("data.dir"), "./samples-data/enc/ExchangeSetwithoutUpdates/ENC_ROOT/CATALOG.031");
EncExchangeSet encExchangeSet = new EncExchangeSet(Collections.singletonList(encPath.getAbsolutePath()));
encExchangeSet.loadAsync();
encExchangeSet.addDoneLoadingListener(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void start(Stage stage) {
kmlLayer = new KmlLayer(portalItem);
break;
case LOCAL_FILE:
File kmlFile = new File("./samples-data/kml/US_State_Capitals.kml");
File kmlFile = new File(System.getProperty("data.dir"), "./samples-data/kml/US_State_Capitals.kml");
KmlDataset fileKmlDataset = new KmlDataset(kmlFile.getAbsolutePath());
kmlLayer = new KmlLayer(fileKmlDataset);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void start(Stage stage) {
sceneView.setArcGISScene(scene);

// load a KML dataset from a local KMZ file and show it as an operational layer
File kmzFile = new File("./samples-data/kml/esri_test_data.kmz");
File kmzFile = new File(System.getProperty("data.dir"), "./samples-data/kml/esri_test_data.kmz");
KmlDataset kmlDataset = new KmlDataset(kmzFile.getAbsolutePath());
KmlLayer kmlLayer = new KmlLayer(kmlDataset);
scene.getOperationalLayers().add(kmlLayer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void start(Stage stage) throws IOException {
controlsVBox.getChildren().addAll(playPauseButton, replayButton);

// add a KML layer from a KML dataset with a KML tour
KmlDataset kmlDataset = new KmlDataset(new File("./samples-data/kml/Esri_tour.kmz").getAbsolutePath());
KmlDataset kmlDataset = new KmlDataset(new File(System.getProperty("data.dir"), "./samples-data/kml/Esri_tour.kmz").getAbsolutePath());
KmlLayer kmlLayer = new KmlLayer(kmlDataset);
scene.getOperationalLayers().add(kmlLayer);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public void start(Stage stage) {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Open Resource File");
fileChooser.getExtensionFilters().addAll(new ExtensionFilter("Image Files", "*.tif"));
fileChooser.setInitialDirectory(new File("./samples-data/raster/"));
fileChooser.setInitialDirectory(new File(System.getProperty("data.dir"), "./samples-data/raster/"));
File selectedFile = fileChooser.showOpenDialog(stage);

if (selectedFile != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public void start(Stage stage) {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Open Resource File");
fileChooser.getExtensionFilters().addAll(new ExtensionFilter("Shapefiles", "*.shp"));
fileChooser.setInitialDirectory(new File("./samples-data/shapefiles/"));
fileChooser.setInitialDirectory(new File(System.getProperty("data.dir"), "./samples-data/shapefiles/"));
// choose the file, then start the local map service
addButton.setOnAction(e -> {
// browse to the shapefile file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ public void start(Stage stage) {
server.addStatusChangedListener(status -> {
if (server.getStatus() == LocalServerStatus.STARTED) {
// start feature service
String featureServiceURL = new File("samples-data/local_server/PointsofInterest.mpk").getAbsolutePath();
featureService = new LocalFeatureService(featureServiceURL);
File mpkFile = new File(System.getProperty("data.dir"), "./samples-data/local_server/PointsofInterest.mpk");
featureService = new LocalFeatureService(mpkFile.getAbsolutePath());
featureService.addStatusChangedListener(this::addLocalFeatureLayer);
featureService.startAsync();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void initialize() {
mapView.setMap(map);

//load tiled layer and zoom to location
String rasterURL = new File("./samples-data/local_server/RasterHillshade.tpk").getAbsolutePath();
String rasterURL = new File(System.getProperty("data.dir"), "./samples-data/local_server/RasterHillshade.tpk").getAbsolutePath();
TileCache tileCache = new TileCache(rasterURL);
ArcGISTiledLayer tiledLayer = new ArcGISTiledLayer(tileCache);
tiledLayer.loadAsync();
Expand All @@ -91,7 +91,7 @@ public void initialize() {
server.addStatusChangedListener(status -> {
if (server.getStatus() == LocalServerStatus.STARTED) {
try {
String gpServiceURL = new File("./samples-data/local_server/Contour.gpk").getAbsolutePath();
String gpServiceURL = new File(System.getProperty("data.dir"), "./samples-data/local_server/Contour.gpk").getAbsolutePath();
// need map server result to add contour lines to map
localGPService =
new LocalGeoprocessingService(gpServiceURL, ServiceType.ASYNCHRONOUS_SUBMIT_WITH_MAP_SERVER_RESULT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void start(Stage stage) {
server.addStatusChangedListener(status -> {
if (status.getNewStatus() == LocalServerStatus.STARTED) {
// start map image service
String mapServiceURL = new File("./samples-data/local_server/RelationshipID.mpk").getAbsolutePath();
String mapServiceURL = new File(System.getProperty("data.dir"), "./samples-data/local_server/RelationshipID.mpk").getAbsolutePath();
mapImageService = new LocalMapService(mapServiceURL);
mapImageService.addStatusChangedListener(this::addLocalMapImageLayer);
mapImageService.startAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private void initialize() {
// create a file chooser to select package files
packageChooser = new FileChooser();
packagePath.textProperty().bind(packageChooser.initialFileNameProperty());
packageChooser.setInitialDirectory(new File("./samples-data/local_server"));
packageChooser.setInitialDirectory(new File(System.getProperty("data.dir"), "./samples-data/local_server"));
packageChooser.setInitialFileName(packageChooser.getInitialDirectory().getAbsolutePath() + "/PointsOfInterest.mpk");

// create filters to choose files for specific services
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void start(Stage stage) {
// create a temporary copy of the local offline map files, so that updating does not overwrite them permanently
tempMobileMapPackageDirectory = Files.createTempDirectory("canyonlands_offline_map").toFile();
tempMobileMapPackageDirectory.deleteOnExit();
File sourceDirectory = new File("./samples-data/canyonlands/");
File sourceDirectory = new File(System.getProperty("data.dir"), "./samples-data/canyonlands/");
FileUtils.copyDirectory(sourceDirectory, tempMobileMapPackageDirectory);

// load the offline map as a mobile map package
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public void drawStatusChanged(DrawStatusChangedEvent drawStatusChangedEvent) {
// open a directory chooser to select the directory containing the referenced basemap
DirectoryChooser directoryChooser = new DirectoryChooser();
// for this sample, the directory chosen should be "naperville"
directoryChooser.setInitialDirectory(new File("./samples-data"));
directoryChooser.setInitialDirectory(new File(System.getProperty("data.dir"), "./samples-data"));
directoryChooser.setTitle("Choose directory containing local basemap");
File localBasemapDirectory = directoryChooser.showDialog(stage.getOwner());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void start(Stage stage) {
FileChooser fileChooser = new FileChooser();
FileChooser.ExtensionFilter mpkFilter = new FileChooser.ExtensionFilter("Map Packages (*.mmpk)", "*.mmpk");
fileChooser.getExtensionFilters().add(mpkFilter);
fileChooser.setInitialDirectory(new File("./samples-data/mmpk"));
fileChooser.setInitialDirectory(new File(System.getProperty("data.dir"), "./samples-data/mmpk"));

// click a button to open the file chooser
Button findMmpkButton = new Button("Open mobile map package");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void start(Stage stage) {
mapView = new MapView();

//load a mobile map package
final String mmpkPath = new File("./samples-data/mmpk/Yellowstone.mmpk").getAbsolutePath();
final String mmpkPath = new File(System.getProperty("data.dir"), "./samples-data/mmpk/Yellowstone.mmpk").getAbsolutePath();
mobileMapPackage = new MobileMapPackage(mmpkPath);

mobileMapPackage.loadAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void start(Stage stage) {
mapView.setMap(map);

// load the local GeoPackage
File geoPackageFile = new File("./samples-data/auroraCO/AuroraCO.gpkg");
File geoPackageFile = new File(System.getProperty("data.dir"), "./samples-data/auroraCO/AuroraCO.gpkg");
GeoPackage geoPackage = new GeoPackage(geoPackageFile.getAbsolutePath());
geoPackage.loadAsync();
geoPackage.addDoneLoadingListener(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public class BlendRendererController {
public void initialize() {

// create rasters
imageryRasterPath = new File("./samples-data/raster/Shasta.tif").getAbsolutePath();
elevationRasterPath = new File("./samples-data/raster/Shasta_Elevation.tif").getAbsolutePath();
imageryRasterPath = new File(System.getProperty("data.dir"), "./samples-data/raster/Shasta.tif").getAbsolutePath();
elevationRasterPath = new File(System.getProperty("data.dir"), "./samples-data/raster/Shasta_Elevation.tif").getAbsolutePath();

// create a raster layer
RasterLayer rasterLayer = new RasterLayer(new Raster(imageryRasterPath));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void start(Stage stage) {
stage.show();

// create a raster from a local raster file
Raster raster = new Raster(new File("./samples-data/raster/ShastaBW.tif").getAbsolutePath());
Raster raster = new Raster(new File(System.getProperty("data.dir"), "./samples-data/raster/ShastaBW.tif").getAbsolutePath());

// create a raster layer
RasterLayer rasterLayer = new RasterLayer(raster);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class HillshadeRendererController {
public void initialize() {

// create raster
Raster raster = new Raster(new File("./samples-data/raster/srtm.tiff").getAbsolutePath());
Raster raster = new Raster(new File(System.getProperty("data.dir"), "./samples-data/raster/srtm.tiff").getAbsolutePath());

// create a raster layer
rasterLayer = new RasterLayer(raster);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void start(Stage stage) {

if (imageServiceRaster.getLoadStatus() == LoadStatus.LOADED) {
// create raster function from local json file
File jsonFile = new File("./samples-data/raster/hillshade_simplified.json");
File jsonFile = new File(System.getProperty("data.dir"), "./samples-data/raster/hillshade_simplified.json");
try (Scanner scanner = new Scanner(jsonFile)) {
// read in the complete file as a string
String json = scanner.useDelimiter("\\A").next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void start(Stage stage) {
stage.show();

// create a raster from a local raster file
Raster raster = new Raster(new File("./samples-data/raster/Shasta.tif").getAbsolutePath());
Raster raster = new Raster(new File(System.getProperty("data.dir"), "./samples-data/raster/Shasta.tif").getAbsolutePath());

// create a raster layer
RasterLayer rasterLayer = new RasterLayer(raster);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void start(Stage stage) {
mapView.setMap(map);

// create a geopackage from a local gpkg file
GeoPackage geoPackage = new GeoPackage(new File("./samples-data/auroraCO/AuroraCO.gpkg").getAbsolutePath());
GeoPackage geoPackage = new GeoPackage(new File(System.getProperty("data.dir"), "./samples-data/auroraCO/AuroraCO.gpkg").getAbsolutePath());

// load the geopackage
geoPackage.loadAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class RgbRendererController {
public void initialize() {

// create raster
Raster raster = new Raster(new File("./samples-data/raster/Shasta.tif").getAbsolutePath());
Raster raster = new Raster(new File(System.getProperty("data.dir"), "./samples-data/raster/Shasta.tif").getAbsolutePath());

// create a raster layer
rasterLayer = new RasterLayer(raster);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class StretchRendererController {
public void initialize() {

// create raster
Raster raster = new Raster(new File("./samples-data/raster/ShastaBW.tif").getAbsolutePath());
Raster raster = new Raster(new File(System.getProperty("data.dir"), "./samples-data/raster/ShastaBW.tif").getAbsolutePath());

// create a raster layer
rasterLayer = new RasterLayer(raster);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public void initialize() {
mapOverlay.getGraphics().add(plane2D);

// create a graphic with a ModelSceneSymbol of a plane to add to the scene
String modelURI = new File("./samples-data/bristol/Collada/Bristol.dae").getAbsolutePath();
String modelURI = new File(System.getProperty("data.dir"), "./samples-data/bristol/Collada/Bristol.dae").getAbsolutePath();
ModelSceneSymbol plane3DSymbol = new ModelSceneSymbol(modelURI, 1.0);
plane3DSymbol.loadAsync();
plane3D = new Graphic(new Point(0, 0, 0, WGS84), plane3DSymbol);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void start(Stage stage){
sceneView.getGraphicsOverlays().add(sceneGraphicsOverlay);

// create a graphic with a ModelSceneSymbol of a plane to add to the scene
String modelURI = new File("./samples-data/bristol/Collada/Bristol.dae").getAbsolutePath();
String modelURI = new File(System.getProperty("data.dir"), "./samples-data/bristol/Collada/Bristol.dae").getAbsolutePath();
ModelSceneSymbol plane3DSymbol = new ModelSceneSymbol(modelURI, 1.0);
plane3DSymbol.loadAsync();
plane3DSymbol.setHeading(45);
Expand Down
Loading