本文整理汇总了Java中com.esri.arcgisruntime.mapping.Surface类的典型用法代码示例。如果您正苦于以下问题:Java Surface类的具体用法?Java Surface怎么用?Java Surface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Surface类属于com.esri.arcgisruntime.mapping包,在下文中一共展示了Surface类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import com.esri.arcgisruntime.mapping.Surface; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
try {
// create stack pane and JavaFX app scene
StackPane stackPane = new StackPane();
Scene fxScene = new Scene(stackPane);
// set title, size, and add JavaFX scene to stage
stage.setTitle("Display Scene Sample");
stage.setWidth(800);
stage.setHeight(700);
stage.setScene(fxScene);
stage.show();
// create a scene and add a basemap to it
ArcGISScene scene = new ArcGISScene();
scene.setBasemap(Basemap.createImagery());
// add the SceneView to the stack pane
sceneView = new SceneView();
sceneView.setArcGISScene(scene);
stackPane.getChildren().addAll(sceneView);
// add base surface for elevation data
Surface surface = new Surface();
surface.getElevationSources().add(new ArcGISTiledElevationSource(ELEVATION_IMAGE_SERVICE));
scene.setBaseSurface(surface);
// add a camera and initial camera position
Camera camera = new Camera(28.4, 83.9, 10010.0, 10.0, 80.0, 0.0);
sceneView.setViewpointCamera(camera);
} catch (Exception e) {
// on any error, display the stack trace.
e.printStackTrace();
}
}
示例2: initialize
import com.esri.arcgisruntime.mapping.Surface; //导入依赖的package包/类
public void initialize() {
try {
// create a scene and add a basemap to it
ArcGISScene scene = new ArcGISScene();
scene.setBasemap(Basemap.createNationalGeographic());
// add the SceneView to the stack pane
sceneView.setArcGISScene(scene);
// add base surface for elevation data
Surface surface = new Surface();
final String elevationImageService =
"http://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer";
surface.getElevationSources().add(new ArcGISTiledElevationSource(elevationImageService));
scene.setBaseSurface(surface);
// set exaggeration of surface to the value the user selected
exaggerationSlider.valueChangingProperty().addListener(o -> {
if (!exaggerationSlider.isValueChanging()) {
surface.setElevationExaggeration((float) exaggerationSlider.getValue());
}
});
// add a camera and initial camera position
Point initialLocation = new Point(-119.94891542688772, 46.75792111605992, 0, sceneView.getSpatialReference());
Camera camera = new Camera(initialLocation, 15000.0, 40.0, 60.0, 0.0);
sceneView.setViewpointCamera(camera);
} catch (Exception e) {
// on any exception, print the stack trace
e.printStackTrace();
}
}
示例3: initialize
import com.esri.arcgisruntime.mapping.Surface; //导入依赖的package包/类
/**
* Called after FXML loads. Sets up scene and map and configures property bindings.
*/
public void initialize() {
try {
// create a scene and add to view
ArcGISScene scene = new ArcGISScene();
scene.setBasemap(Basemap.createImagery());
sceneView.setArcGISScene(scene);
// adds elevation to surface
Surface surface = new Surface();
surface.getElevationSources().add(new ArcGISTiledElevationSource(ELEVATION_IMAGE_SERVICE));
scene.setBaseSurface(surface);
createGraphics();
// set viewpoint of camera above graphics
Camera camera = new Camera(39, -101, 10000000, 10.0, 0.0, 0.0);
sceneView.setViewpointCamera(camera);
setupAnimation();
// automatically updates distance between graphics to view
distance = new SimpleLongProperty();
txtDistance.textProperty().bind(distance.asString());
// set beginning distance of two graphics
distance.set(Math.round(calculateDirectLinearDistance(redPoint, greenPoint)));
} catch (Exception e) {
// on any error, display the stack trace.
e.printStackTrace();
}
}
示例4: onCreate
import com.esri.arcgisruntime.mapping.Surface; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// create a scene and add a basemap to it
ArcGISScene scene = new ArcGISScene();
scene.setBasemap(Basemap.createImagery());
// add the scene to a scene view
mSceneView = findViewById(R.id.sceneView);
mSceneView.setScene(scene);
// set the camera to the scene view
Camera camera = new Camera(48.3808, -4.49492, 48.2511, 344.488, 74.1212, 0.0);
mSceneView.setViewpointCamera(camera);
// add base surface for elevation data to the scene view
Surface surface = new Surface();
ArcGISTiledElevationSource brestElevationSource = new ArcGISTiledElevationSource(getString(R.string.brest_dtm));
surface.getElevationSources().add(brestElevationSource);
scene.setBaseSurface(surface);
// add a scene layer to the scene
ArcGISSceneLayer brestBuildingLayer = new ArcGISSceneLayer(getString(R.string.brest_building_layer));
scene.getOperationalLayers().add(brestBuildingLayer);
// create a viewshed from the camera
LocationViewshed viewshed = new LocationViewshed(camera, 1.0, 500.0);
// create an analysis overlay to add the viewshed to the scene view
AnalysisOverlay analysisOverlay = new AnalysisOverlay();
analysisOverlay.getAnalyses().add(viewshed);
mSceneView.getAnalysisOverlays().add(analysisOverlay);
// create a button to update the viewshed with the current camera
Button cameraButton = findViewById(R.id.updateViewshedButton);
cameraButton.setOnClickListener(view -> viewshed.updateFromCamera(mSceneView.getCurrentViewpointCamera()));
}
示例5: start
import com.esri.arcgisruntime.mapping.Surface; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
try {
// create stack pane and JavaFX app scene
StackPane stackPane = new StackPane();
Scene fxScene = new Scene(stackPane);
// set title, size, and add JavaFX scene to stage
stage.setTitle("Symbols Sample");
stage.setWidth(800);
stage.setHeight(700);
stage.setScene(fxScene);
stage.show();
// create a scene and add a basemap to it
ArcGISScene scene = new ArcGISScene();
scene.setBasemap(Basemap.createImagery());
// add the SceneView to the stack pane
sceneView = new SceneView();
sceneView.setArcGISScene(scene);
stackPane.getChildren().add(sceneView);
// add a camera and initial camera position
Camera camera = new Camera(29, 45, 6000, 0, 0, 0);
sceneView.setViewpointCamera(camera);
Point cameraLocation = camera.getLocation();
// add base surface for elevation data
ArcGISTiledElevationSource elevationSource = new ArcGISTiledElevationSource(ELEVATION_IMAGE_SERVICE);
Surface surface = new Surface();
surface.getElevationSources().add(elevationSource);
scene.setBaseSurface(surface);
// add graphics overlay(s)
GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
graphicsOverlay.getSceneProperties().setSurfacePlacement(LayerSceneProperties.SurfacePlacement.ABSOLUTE);
sceneView.getGraphicsOverlays().add(graphicsOverlay);
// create graphics for each type of symbol
AtomicInteger counter = new AtomicInteger(0);
double x = 44.975;
double y = 29;
double z = 500;
Stream.of(SimpleMarkerSceneSymbol.Style.values()).map(style -> {
int color;
switch (style) {
case CONE:
color = 0xFFFF0000; // red
break;
case TETRAHEDRON:
color = 0xFF00FF00; // green
break;
case SPHERE:
color = 0xFF0000FF; // blue
break;
case CYLINDER:
color = 0xFFFF00FF; // purple
break;
case DIAMOND:
color = 0xFF00FFFF; // turquoise
break;
case CUBE:
default:
color = 0xFFFFFFFF; // white
}
SimpleMarkerSceneSymbol symbol = new SimpleMarkerSceneSymbol(style, color, 200, 200, 200,
SceneSymbol.AnchorPosition.CENTER);
int position = counter.getAndIncrement();
return new Graphic(new Point(x + 0.01 * position, y, z, cameraLocation.getSpatialReference()), symbol);
}).collect(Collectors.toCollection(graphicsOverlay::getGraphics));
} catch (Exception e) {
// on any error, display the stack trace
e.printStackTrace();
}
}
示例6: start
import com.esri.arcgisruntime.mapping.Surface; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
try {
// create stack pane and JavaFX app scene
StackPane stackPane = new StackPane();
Scene fxScene = new Scene(stackPane);
// set title, size, and add JavaFX scene to stage
stage.setTitle("Scene Layer Sample");
stage.setWidth(800);
stage.setHeight(700);
stage.setScene(fxScene);
stage.show();
// create a scene and add a basemap to it
ArcGISScene scene = new ArcGISScene();
scene.setBasemap(Basemap.createImagery());
// add the SceneView to the stack pane
sceneView = new SceneView();
sceneView.setArcGISScene(scene);
stackPane.getChildren().addAll(sceneView);
// add base surface for elevation data
Surface surface = new Surface();
final String localEvelationImageService = "http://scene.arcgis.com/arcgis/rest/services/BREST_DTM_1M/ImageServer";
surface.getElevationSources().add(new ArcGISTiledElevationSource(localEvelationImageService));
scene.setBaseSurface(surface);
// add a scene layer
final String buildings = "http://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/Buildings_Brest/SceneServer/layers/0";
ArcGISSceneLayer sceneLayer = new ArcGISSceneLayer(buildings);
scene.getOperationalLayers().add(sceneLayer);
// add a camera and initial camera position (Brest, France)
Camera camera = new Camera(48.37, -4.50, 1000.0, 10.0, 70, 0.0);
sceneView.setViewpointCamera(camera);
} catch (Exception e) {
// on any error, display the stack trace.
e.printStackTrace();
}
}
示例7: start
import com.esri.arcgisruntime.mapping.Surface; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
try {
// create stack pane and JavaFX app scene
StackPane stackPane = new StackPane();
Scene fxScene = new Scene(stackPane);
// set title, squareSize, and add JavaFX scene to stage
stage.setTitle("Extrude Graphics Sample");
stage.setWidth(800);
stage.setHeight(700);
stage.setScene(fxScene);
stage.show();
// create a scene and add a basemap to it
ArcGISScene scene = new ArcGISScene();
scene.setBasemap(Basemap.createImagery());
// add the SceneView to the stack pane
sceneView = new SceneView();
sceneView.setArcGISScene(scene);
stackPane.getChildren().add(sceneView);
Camera camera = new Camera(28.4, 83, 10000, 10.0, 80.0, 0);
sceneView.setViewpointCamera(camera);
// add base surface for elevation data
Surface surface = new Surface();
surface.getElevationSources().add(new ArcGISTiledElevationSource(ELEVATION_IMAGE_SERVICE));
scene.setBaseSurface(surface);
// add a graphics overlay
GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
graphicsOverlay.getSceneProperties().setSurfacePlacement(LayerSceneProperties.SurfacePlacement.DRAPED);
// set renderer with extrusion property
SimpleRenderer renderer = new SimpleRenderer();
SceneProperties renderProperties = renderer.getSceneProperties();
renderProperties.setExtrusionMode(SceneProperties.ExtrusionMode.BASE_HEIGHT);
renderProperties.setExtrusionExpression("[HEIGHT]");
graphicsOverlay.setRenderer(renderer);
// setup graphic positions
double squareSize = 0.01;
double maxHeight = 10000.0;
double x = camera.getLocation().getX();
double y = camera.getLocation().getY() + 0.2;
List<Point> points = IntStream.range(0, 100).mapToObj(i -> new Point(i / 10 * squareSize + x, i % 10 *
squareSize + y)).collect(Collectors.toList());
// create and style graphics
points.forEach(p -> {
double z = (int) (maxHeight * Math.random());
int color = ColorUtil.colorToArgb(Color.color(1.0 / maxHeight * z, 0, 0.5, 1));
Polygon polygon = new Polygon(new PointCollection(Arrays.asList(new Point(p.getX(), p.getY(), z), new Point(p
.getX() + squareSize, p.getY(), z), new Point(p.getX() + squareSize, p.getY() + squareSize, z), new Point(p
.getX(), p.getY() + squareSize, z))));
Graphic graphic = new Graphic(polygon);
graphic.getAttributes().put("HEIGHT", z);
graphic.setSymbol(new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, color, null));
graphicsOverlay.getGraphics().add(graphic);
});
sceneView.getGraphicsOverlays().add(graphicsOverlay);
} catch (Exception e) {
// on any error, display the stack trace
e.printStackTrace();
}
}
示例8: start
import com.esri.arcgisruntime.mapping.Surface; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
try {
// create stack pane and JavaFX app scene
StackPane stackPane = new StackPane();
Scene fxScene = new Scene(stackPane);
// set title, size, and add JavaFX scene to stage
stage.setTitle("Distance Composite Symbol Sample");
stage.setWidth(800);
stage.setHeight(700);
stage.setScene(fxScene);
stage.show();
// create a scene and add a basemap to it
ArcGISScene scene = new ArcGISScene();
scene.setBasemap(Basemap.createImagery());
// add the SceneView to the stack pane
sceneView = new SceneView();
sceneView.setArcGISScene(scene);
stackPane.getChildren().addAll(sceneView);
// add base surface for elevation data
Surface surface = new Surface();
surface.getElevationSources().add(new ArcGISTiledElevationSource(ELEVATION_IMAGE_SERVICE));
scene.setBaseSurface(surface);
// add a graphics overlay
GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
graphicsOverlay.getSceneProperties().setSurfacePlacement(LayerSceneProperties.SurfacePlacement.RELATIVE);
sceneView.getGraphicsOverlays().add(graphicsOverlay);
// set up the different symbols
int red = 0xFFFF0000;
SimpleMarkerSymbol circleSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, red, 10);
SimpleMarkerSceneSymbol coneSymbol = SimpleMarkerSceneSymbol.createCone(red, 3, 10);
coneSymbol.setPitch(-90);
coneSymbol.setAnchorPosition(AnchorPosition.CENTER);
String modelURI = new File("./samples-data/bristol/Collada/Bristol.dae").getAbsolutePath();
ModelSceneSymbol modelSymbol = new ModelSceneSymbol(modelURI, 1.0);
modelSymbol.loadAsync();
// set up the distance composite symbol
DistanceCompositeSceneSymbol compositeSymbol = new DistanceCompositeSceneSymbol();
compositeSymbol.getRangeCollection().add(new DistanceCompositeSceneSymbol.Range(modelSymbol, 0, 100));
compositeSymbol.getRangeCollection().add(new DistanceCompositeSceneSymbol.Range(coneSymbol, 100, 500));
compositeSymbol.getRangeCollection().add(new DistanceCompositeSceneSymbol.Range(circleSymbol, 500, 0));
// create graphic
Point aircraftPosition = new Point(-2.708471, 56.096575, 5000, SpatialReferences.getWgs84());
Graphic aircraftGraphic = new Graphic(aircraftPosition, compositeSymbol);
// add graphic to graphics overlay
graphicsOverlay.getGraphics().add(aircraftGraphic);
// add a camera and initial camera position
Camera camera = new Camera(aircraftPosition, 20, 0, 70.0, 0.0);
sceneView.setViewpointCamera(camera);
} catch (Exception e) {
// on any error, display the stack trace.
e.printStackTrace();
}
}
示例9: start
import com.esri.arcgisruntime.mapping.Surface; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
try {
// create stack pane and JavaFX app scene
StackPane stackPane = new StackPane();
Scene fxScene = new Scene(stackPane);
// set title, size, and add JavaFX scene to stage
stage.setTitle("Elevation Mode Sample");
stage.setWidth(800);
stage.setHeight(700);
stage.setScene(fxScene);
stage.show();
// create a scene and add a basemap to it
ArcGISScene scene = new ArcGISScene();
scene.setBasemap(Basemap.createImagery());
// add the SceneView to the stack pane
sceneView = new SceneView();
sceneView.setArcGISScene(scene);
stackPane.getChildren().add(sceneView);
// add a camera and initial camera position
Camera camera = new Camera(53.04, -4.04, 1300, 0, 90.0, 0);
sceneView.setViewpointCamera(camera);
// add base surface for elevation data
Surface surface = new Surface();
surface.getElevationSources().add(new ArcGISTiledElevationSource(ELEVATION_IMAGE_SERVICE));
scene.setBaseSurface(surface);
// create overlays with elevation modes
GraphicsOverlay drapedOverlay = new GraphicsOverlay();
drapedOverlay.getSceneProperties().setSurfacePlacement(SurfacePlacement.DRAPED);
sceneView.getGraphicsOverlays().add(drapedOverlay);
GraphicsOverlay relativeOverlay = new GraphicsOverlay();
relativeOverlay.getSceneProperties().setSurfacePlacement(SurfacePlacement.RELATIVE);
sceneView.getGraphicsOverlays().add(relativeOverlay);
GraphicsOverlay absoluteOverlay = new GraphicsOverlay();
absoluteOverlay.getSceneProperties().setSurfacePlacement(SurfacePlacement.ABSOLUTE);
sceneView.getGraphicsOverlays().add(absoluteOverlay);
// create point for graphic location
Point point = new Point(-4.04, 53.06, 1000, camera.getLocation().getSpatialReference());
// create a red (0xFFFF0000) circle symbol
SimpleMarkerSymbol circleSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, 0xFFFF0000, 10);
// create a text symbol for each elevation mode
TextSymbol drapedText = new TextSymbol(10, "DRAPED", 0xFFFFFFFF, HorizontalAlignment.LEFT,
VerticalAlignment.MIDDLE);
TextSymbol relativeText = new TextSymbol(10, "RELATIVE", 0xFFFFFFFF, HorizontalAlignment.LEFT,
VerticalAlignment.MIDDLE);
TextSymbol absoluteText = new TextSymbol(10, "ABSOLUTE", 0xFFFFFFFF, HorizontalAlignment.LEFT,
VerticalAlignment.MIDDLE);
// add the point graphic and text graphic to the corresponding graphics
// overlay
drapedOverlay.getGraphics().add(new Graphic(point, circleSymbol));
drapedOverlay.getGraphics().add(new Graphic(point, drapedText));
relativeOverlay.getGraphics().add(new Graphic(point, circleSymbol));
relativeOverlay.getGraphics().add(new Graphic(point, relativeText));
absoluteOverlay.getGraphics().add(new Graphic(point, circleSymbol));
absoluteOverlay.getGraphics().add(new Graphic(point, absoluteText));
} catch (Exception e) {
// on any error, display the stack trace
e.printStackTrace();
}
}
示例10: onCreate
import com.esri.arcgisruntime.mapping.Surface; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// set initial values
mMinDistance = mInitMinDistance;
mMaxDistance = mInitMaxDistance;
// create a scene and add an imagery basemap to it
mSceneView = findViewById(R.id.sceneView);
ArcGISScene scene = new ArcGISScene();
scene.setBasemap(Basemap.createImagery());
mSceneView.setScene(scene);
// add base surface for elevation data
Surface surface = new Surface();
final String localElevationImageService = getString(
com.esri.arcgisruntime.sample.viewshedlocation.R.string.elevation_service);
surface.getElevationSources().add(new ArcGISTiledElevationSource(localElevationImageService));
scene.setBaseSurface(surface);
// add a scene layer
final String buildings = getString(com.esri.arcgisruntime.sample.viewshedlocation.R.string.buildings_layer);
ArcGISSceneLayer sceneLayer = new ArcGISSceneLayer(buildings);
scene.getOperationalLayers().add(sceneLayer);
// create viewshed from location
Point location = new Point(-4.50, 48.4, 100.0);
Viewshed.setFrustumOutlineColor(Color.BLUE);
mViewshed = new LocationViewshed(location, mInitHeading, mInitPitch, mInitHorizontalAngle, mInitVerticalAngle,
mInitMinDistance, mInitMaxDistance);
mViewshed.setFrustumOutlineVisible(true);
// add a camera and set it to orbit the location point
Camera camera = new Camera(location, 20000000, 0, 55, 0);
OrbitLocationCameraController orbitCamera = new OrbitLocationCameraController(location, 5000);
mSceneView.setCameraController(orbitCamera);
mSceneView.setViewpointCamera(camera);
// create an analysis overlay to add the mViewshed to the scene view
AnalysisOverlay analysisOverlay = new AnalysisOverlay();
analysisOverlay.getAnalyses().add(mViewshed);
mSceneView.getAnalysisOverlays().add(analysisOverlay);
handleUiElements();
}
示例11: initialize
import com.esri.arcgisruntime.mapping.Surface; //导入依赖的package包/类
public void initialize() {
// create a scene
ArcGISScene scene = new ArcGISScene();
scene.setBasemap(Basemap.createImagery());
sceneView.setArcGISScene(scene);
// add base surface for elevation data
String surfaceURL = "http://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer";
Surface surface = new Surface();
surface.getElevationSources().add(new ArcGISTiledElevationSource(surfaceURL));
scene.setBaseSurface(surface);
// add a camera
Camera camera = new Camera(33.98, -117.177526, 5000, 0, 70, 0.0);
sceneView.setViewpointCamera(camera);
// get features from an online feature layer
String pointsURL = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Sync/WildfireSync/FeatureServer/0";
pointsFeatureTable = new ServiceFeatureTable(pointsURL);
FeatureLayer pointsFeatureLayer = new FeatureLayer(pointsFeatureTable);
scene.getOperationalLayers().add(pointsFeatureLayer);
String polysURL = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/Sync/WildfireSync/FeatureServer/2";
polysFeatureTable = new ServiceFeatureTable(polysURL);
FeatureLayer polysFeatureLayer = new FeatureLayer(polysFeatureTable);
scene.getOperationalLayers().add(polysFeatureLayer);
// add graphics overlays
groundGraphicsOverlay = new GraphicsOverlay();
groundGraphicsOverlay.getSceneProperties().setSurfacePlacement(LayerSceneProperties.SurfacePlacement.DRAPED);
sceneView.getGraphicsOverlays().add(groundGraphicsOverlay);
buildingGraphicsOverlay = new GraphicsOverlay();
SimpleRenderer renderer = new SimpleRenderer();
Renderer.SceneProperties renderProperties = renderer.getSceneProperties();
renderProperties.setExtrusionMode(Renderer.SceneProperties.ExtrusionMode.BASE_HEIGHT);
renderProperties.setExtrusionExpression("height");
buildingGraphicsOverlay.setRenderer(renderer);
buildingGraphicsOverlay.getSceneProperties().setSurfacePlacement(LayerSceneProperties.SurfacePlacement.RELATIVE);
sceneView.getGraphicsOverlays().add(buildingGraphicsOverlay);
airGraphicsOverlay = new GraphicsOverlay();
airGraphicsOverlay.getSceneProperties().setSurfacePlacement(LayerSceneProperties.SurfacePlacement.ABSOLUTE);
sceneView.getGraphicsOverlays().add(airGraphicsOverlay);
// create an online geolocator task
String locatorURL = "http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer";
locatorTask = new LocatorTask(locatorURL);
}