本文整理汇总了Java中com.esri.arcgisruntime.geometry.Polyline类的典型用法代码示例。如果您正苦于以下问题:Java Polyline类的具体用法?Java Polyline怎么用?Java Polyline使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Polyline类属于com.esri.arcgisruntime.geometry包,在下文中一共展示了Polyline类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: changeMission
import com.esri.arcgisruntime.geometry.Polyline; //导入依赖的package包/类
/**
* Change the mission data and reset the animation.
*/
@FXML
private void changeMission() {
// clear previous mission data
missionData = new ArrayList<>();
// get mission data
String mission = missionSelector.getSelectionModel().getSelectedItem();
missionData = getMissionData(mission);
animationModel.setFrames(missionData.size());
animationModel.setKeyframe(0);
// draw mission route on mini map
PointCollection points = new PointCollection(WGS84);
points.addAll(missionData.stream().map(m -> (Point) m.get("POSITION")).collect(Collectors.toList()));
Polyline route = new Polyline(points);
routeGraphic.setGeometry(route);
// refresh mini map zoom and show initial keyframe
mapView.setViewpointScaleAsync(100000).addDoneListener(() -> Platform.runLater(() -> animate(0)));
}
示例2: createPolyline
import com.esri.arcgisruntime.geometry.Polyline; //导入依赖的package包/类
/**
* Creates a Polyline and adds it to a GraphicsOverlay.
*/
private void createPolyline() {
// create a purple (0xFF800080) simple line symbol
SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.DASH, 0xFF800080, 4);
// create a new point collection for polyline
PointCollection points = new PointCollection(SPATIAL_REFERENCE);
// create and add points to the point collection
points.add(new Point(-2.715, 56.061));
points.add(new Point(-2.6438, 56.079));
points.add(new Point(-2.638, 56.079));
points.add(new Point(-2.636, 56.078));
points.add(new Point(-2.636, 56.077));
points.add(new Point(-2.637, 56.076));
points.add(new Point(-2.715, 56.061));
// create the polyline from the point collection
Polyline polyline = new Polyline(points);
// create the graphic with polyline and symbol
Graphic graphic = new Graphic(polyline, lineSymbol);
// add graphic to the graphics overlay
graphicsOverlay.getGraphics().add(graphic);
}
示例3: createPolyline
import com.esri.arcgisruntime.geometry.Polyline; //导入依赖的package包/类
private Polyline createPolyline() {
//[DocRef: Name=Create Polyline, Category=Fundamentals, Topic=Geometries]
// create a Polyline from a PointCollection
PointCollection borderCAtoNV = new PointCollection(SpatialReferences.getWgs84());
borderCAtoNV.add(-119.992, 41.989);
borderCAtoNV.add(-119.994, 38.994);
borderCAtoNV.add(-114.620, 35.0);
Polyline polyline = new Polyline(borderCAtoNV);
//[DocRef: END]
return polyline;
}
示例4: showServiceAreas
import com.esri.arcgisruntime.geometry.Polyline; //导入依赖的package包/类
/**
* Solves Service Areas Task using the facilities and barriers that were added to the mapview.
* <p>
* All service areas that are return will be displayed to the mapview.
*/
@FXML
private void showServiceAreas() {
// need at least one facility for the task to work
if (serviceAreaFacilities.size() > 0) {
progressIndicator.setVisible(true);
//turn barrier button off and add any barriers to service area parameters
btnAddBarrier.setSelected(false);
List<PolylineBarrier> polylineBarriers = new ArrayList<>();
barrierOverlay.getGraphics()
.forEach(barrier -> polylineBarriers.add(new PolylineBarrier((Polyline) barrier.getGeometry())));
serviceAreaParameters.setPolylineBarriers(polylineBarriers);
serviceAreasOverlay.getGraphics().clear();
serviceAreaParameters.setFacilities(serviceAreaFacilities);
// find service areas around facility using parameters that were set
ListenableFuture<ServiceAreaResult> result = serviceAreaTask.solveServiceAreaAsync(serviceAreaParameters);
result.addDoneListener(() -> {
try {
// display all service areas that were found to mapview
List<Graphic> graphics = serviceAreasOverlay.getGraphics();
ServiceAreaResult serviceAreaResult = result.get();
for (int i = 0; i < serviceAreaFacilities.size(); i++) {
List<ServiceAreaPolygon> polygons = serviceAreaResult.getResultPolygons(i);
// could be more than one service area
for (int j = 0; j < polygons.size(); j++) {
graphics.add(new Graphic(polygons.get(j).getGeometry(), fillSymbols.get(j % 2)));
}
}
} catch (ExecutionException | InterruptedException e) {
if (e.getMessage().contains("Unable to complete operation")) {
showErrorMessage("Facility not within San Diego area!");
} else {
e.printStackTrace();
}
}
progressIndicator.setVisible(false);
});
} else {
showErrorMessage("Must have at least 1 Facility!");
}
}
示例5: start
import com.esri.arcgisruntime.geometry.Polyline; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
try {
// create stack pane and application scene
StackPane stackPane = new StackPane();
Scene scene = new Scene(stackPane);
scene.getStylesheets().add(getClass().getResource("/css/style.css").toExternalForm());
// set title, size, and add scene to stage
stage.setTitle("Simple Line Symbol Sample");
stage.setWidth(800);
stage.setHeight(700);
stage.setScene(scene);
stage.show();
// create a control panel
VBox vBoxControl = new VBox(6);
vBoxControl.setMaxSize(180, 200);
vBoxControl.getStyleClass().add("panel-region");
createSymbolFuntionality(vBoxControl);
final ArcGISMap map = new ArcGISMap(Basemap.createImagery());
// set initial map view point
Point point = new Point(-226773, 6550477, SpatialReferences.getWebMercator());
Viewpoint viewpoint = new Viewpoint(point, 7200); // point, scale
map.setInitialViewpoint(viewpoint);
// create a view for this ArcGISMap and set ArcGISMap to it
mapView = new MapView();
mapView.setMap(map);
// creates a line from two points
PointCollection points = new PointCollection(SpatialReferences.getWebMercator());
points.add(-226913, 6550477);
points.add(-226643, 6550477);
Polyline line = new Polyline(points);
// creates a solid red (0xFFFF0000) simple line symbol
lineSymbol = new SimpleLineSymbol(Style.SOLID, 0xFFFF0000, 3);
// add line with symbol to graphics overlay and add overlay to map view
GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
mapView.getGraphicsOverlays().add(graphicsOverlay);
graphicsOverlay.getGraphics().add(new Graphic(line, lineSymbol));
// add the map view and control panel to stack pane
stackPane.getChildren().addAll(mapView, vBoxControl);
StackPane.setAlignment(vBoxControl, Pos.TOP_LEFT);
StackPane.setMargin(vBoxControl, new Insets(10, 0, 0, 10));
} catch (Exception e) {
// on any error, display the stack trace
e.printStackTrace();
}
}
示例6: addBoatTrip
import com.esri.arcgisruntime.geometry.Polyline; //导入依赖的package包/类
private void addBoatTrip(GraphicsOverlay graphicOverlay) {
//define a polyline for the boat trip
Polyline boatRoute = getBoatTripGeometry();
//define a line symbol
SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.DASH, Color.rgb(128, 0, 128), 4);
//create the graphic
Graphic boatTripGraphic = new Graphic(boatRoute, lineSymbol);
//add to the graphic overlay
graphicOverlay.getGraphics().add(boatTripGraphic);
}
示例7: getBoatTripGeometry
import com.esri.arcgisruntime.geometry.Polyline; //导入依赖的package包/类
private Polyline getBoatTripGeometry() {
//a new point collection to make up the polyline
PointCollection boatPositions = new PointCollection(wgs84);
//add positions to the point collection
boatPositions.add(new Point(-2.7184791227926772,56.06147084563517));
boatPositions.add(new Point(-2.7196807500463924,56.06147084563517));
boatPositions.add(new Point(-2.722084004553823,56.062141712059706));
boatPositions.add(new Point(-2.726375530459948,56.06386674355254));
boatPositions.add(new Point(-2.726890513568683,56.0660708381432));
boatPositions.add(new Point(-2.7270621746049275,56.06779569383808));
boatPositions.add(new Point(-2.7255172252787228,56.068753913653914));
boatPositions.add(new Point(-2.723113970771293,56.069424653352335));
boatPositions.add(new Point(-2.719165766937657,56.07028701581465));
boatPositions.add(new Point(-2.713672613777817,56.070574465681325));
boatPositions.add(new Point(-2.7093810878716917,56.07095772883556));
boatPositions.add(new Point(-2.7044029178205866,56.07153261642126));
boatPositions.add(new Point(-2.698223120515766,56.072394931722265));
boatPositions.add(new Point(-2.6923866452834355,56.07325722773041));
boatPositions.add(new Point(-2.68672183108735,56.07335303720707));
boatPositions.add(new Point(-2.6812286779275096,56.07354465544585));
boatPositions.add(new Point(-2.6764221689126497,56.074215311778964));
boatPositions.add(new Point(-2.6698990495353394,56.07488595644139));
boatPositions.add(new Point(-2.6647492184479886,56.075748196715914));
boatPositions.add(new Point(-2.659427726324393,56.076131408423215));
boatPositions.add(new Point(-2.654792878345778,56.07622721075461));
boatPositions.add(new Point(-2.651359657620878,56.076514616319784));
boatPositions.add(new Point(-2.6477547758597324,56.07708942101955));
boatPositions.add(new Point(-2.6450081992798125,56.07814320736718));
boatPositions.add(new Point(-2.6432915889173625,56.08025069360931));
boatPositions.add(new Point(-2.638656740938747,56.08044227755186));
boatPositions.add(new Point(-2.636940130576297,56.078813783674946));
boatPositions.add(new Point(-2.636425147467562,56.07728102068079));
boatPositions.add(new Point(-2.637798435757522,56.076610417698504));
boatPositions.add(new Point(-2.638656740938747,56.07507756705851));
boatPositions.add(new Point(-2.641231656482422,56.07479015077557));
boatPositions.add(new Point(-2.6427766058086277,56.075748196715914));
boatPositions.add(new Point(-2.6456948434247924,56.07546078543464));
boatPositions.add(new Point(-2.647239792750997,56.074598538729404));
boatPositions.add(new Point(-2.6492997251859376,56.072682365868616));
boatPositions.add(new Point(-2.6530762679833284,56.0718200569986));
boatPositions.add(new Point(-2.655479522490758,56.070861913404286));
boatPositions.add(new Point(-2.6587410821794135,56.07047864929729));
boatPositions.add(new Point(-2.6633759301580286,56.07028701581465));
boatPositions.add(new Point(-2.666637489846684,56.07009538137926));
boatPositions.add(new Point(-2.670070710571584,56.06990374599109));
boatPositions.add(new Point(-2.6741905754414645,56.069137194910745));
boatPositions.add(new Point(-2.678310440311345,56.06808316228391));
boatPositions.add(new Point(-2.682086983108735,56.06789151689155));
boatPositions.add(new Point(-2.6868934921235956,56.06760404701653));
boatPositions.add(new Point(-2.6911850180297208,56.06722075051504));
boatPositions.add(new Point(-2.695133221863356,56.06702910083509));
boatPositions.add(new Point(-2.698223120515766,56.066837450202335));
boatPositions.add(new Point(-2.7016563412406667,56.06645414607839));
boatPositions.add(new Point(-2.7061195281830366,56.0660708381432));
boatPositions.add(new Point(-2.7100677320166717,56.065591697864576));
boatPositions.add(new Point(-2.713329291705327,56.06520838135397));
boatPositions.add(new Point(-2.7167625124302273,56.06453756828941));
boatPositions.add(new Point(-2.718307461756433,56.06348340989081));
boatPositions.add(new Point(-2.719165766937657,56.062812566811544));
boatPositions.add(new Point(-2.7198524110826376,56.06204587471371));
boatPositions.add(new Point(-2.719165766937657,56.06166252294756));
boatPositions.add(new Point(-2.718307461756433,56.06147084563517));
//create the polyline from the point collection
return new Polyline(boatPositions);
}