下面列出了javafx.scene.control.SplitPane#setOrientation ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Create a new lyrics panel.
* <p/>
* @param containerPanel the container panel this panel is contained within.
*/
public SelectLyricsPanel(LivePreviewPanel containerPanel) {
lyricDrawer = new LyricDrawer();
stageDrawer = new StageDrawer();
splitPane = new SplitPane();
splitPane.setOrientation(Orientation.VERTICAL);
lyricsList = new SelectLyricsList();
previewCanvas = new DisplayCanvas(false, false, false, this::updateCanvas, Priority.LOW);
DisplayPreview preview = new DisplayPreview(previewCanvas);
splitPane.getItems().add(lyricsList);
splitPane.getItems().add(preview);
setCenter(splitPane);
registerDisplayCanvas(previewCanvas);
lyricsList.getSelectionModel().selectedItemProperty().addListener((ov, t1, t2) -> {
updateCanvas();
});
lyricsList.itemsProperty().addListener((ov, t1, t2) -> {
updateCanvas();
});
//
}
public ScanEditor()
{
// toolbar | palette
// --------- |
// scan_tree | ----------
// |
// | properties
toolbar = createToolbar();
VBox.setVgrow(scan_tree, Priority.ALWAYS);
final VBox left_stack = new VBox(toolbar, scan_tree);
right_stack = new SplitPane(new Palette(model, undo), new Properties(this, scan_tree, undo));
right_stack.setOrientation(Orientation.VERTICAL);
getItems().setAll(left_stack, right_stack);
setDividerPositions(0.6);
updateScanInfo(null);
createContextMenu();
}
private SplitPane addTicPlot(PeakListRow row) {
SplitPane pane = new SplitPane();
pane.setOrientation(Orientation.HORIZONTAL);
// labels for TIC visualizer
Map<Feature, String> labelsMap = new HashMap<Feature, String>(0);
// scan selection
ScanSelection scanSelection = new ScanSelection(rawFiles[0].getDataRTRange(1), 1);
// mz range
Range<Double> mzRange = null;
mzRange = feature.getRawDataPointsMZRange();
// optimize output by extending the range
double upper = mzRange.upperEndpoint();
double lower = mzRange.lowerEndpoint();
double fiveppm = (upper * 5E-6);
mzRange = Range.closed(lower - fiveppm, upper + fiveppm);
// labels
labelsMap.put(feature, feature.toString());
List<Feature> featureSelection = Arrays.asList(row.getPeaks());
TICVisualizerWindow window = new TICVisualizerWindow(rawFiles, // raw
TICPlotType.BASEPEAK, // plot type
scanSelection, // scan selection
mzRange, // mz range
featureSelection, // selected features
labelsMap); // labels
pane.getItems().add(window.getScene().getRoot());
return pane;
}
private SplitPane addSpectraMS1() {
SplitPane pane = new SplitPane();
pane.setOrientation(Orientation.HORIZONTAL);
SpectraVisualizerWindow spectraWindowMS1 = new SpectraVisualizerWindow(rawFiles[0]);
spectraWindowMS1.loadRawData(rawFiles[0].getScan(feature.getRepresentativeScanNumber()));
pane.getItems().add(spectraWindowMS1.getScene().getRoot());
return pane;
}
private SplitPane addSpectraMS2() {
SplitPane pane = new SplitPane();
pane.setOrientation(Orientation.HORIZONTAL);
SpectraVisualizerWindow spectraWindowMS2 = new SpectraVisualizerWindow(rawFiles[0]);
spectraWindowMS2.loadRawData(rawFiles[0].getScan(feature.getMostIntenseFragmentScanNumber()));
pane.getItems().add(spectraWindowMS2.getScene().getRoot());
return pane;
}
/**
* Create the new main panel.
*/
public MainPanel() {
LOGGER.log(Level.INFO, "Creating schedule panel");
schedulePanel = new SchedulePanel();
LOGGER.log(Level.INFO, "Creating library panel");
libraryPanel = new LibraryPanel();
LOGGER.log(Level.INFO, "Creating preview panel");
previewPanel = new PreviewPanel();
LOGGER.log(Level.INFO, "Creating live panel");
livePanel = new LivePanel();
LOGGER.log(Level.INFO, "Creating split panels");
scheduleAndLibrary = new SplitPane();
scheduleAndLibrary.setMinWidth(160);
scheduleAndLibrary.setOrientation(Orientation.VERTICAL);
scheduleAndLibrary.getItems().add(schedulePanel);
scheduleAndLibrary.getItems().add(libraryPanel);
previewPanel.getLyricsPanel().getSplitPane().getDividers().get(0).positionProperty().
bindBidirectional(livePanel.getLyricsPanel().getSplitPane().getDividers().get(0).positionProperty());
previewPanel.getLyricsPanel().getSplitPane().setDividerPositions(0.58);
livePanel.getLyricsPanel().getSplitPane().setDividerPositions(0.58);
mainSplit = new SplitPane();
mainSplit.setOrientation(Orientation.HORIZONTAL);
mainSplit.getItems().add(scheduleAndLibrary);
mainSplit.getItems().add(previewPanel);
mainSplit.getItems().add(livePanel);
setCenter(mainSplit);
statusPanelGroup = new StatusPanelGroup();
setBottom(statusPanelGroup);
LOGGER.log(Level.INFO, "Created main panel");
}
private Node getPane() {
SplitPane splitPane = new SplitPane();
splitPane.setOrientation(Orientation.VERTICAL);
initTopPane();
failureStackView = new FailureDetailView();
splitPane.getItems().addAll(topPane, failureStackView);
return splitPane;
}
public AlarmTableUI(final AlarmClient client)
{
this.client = client;
toolbar = createToolbar();
// When user resizes columns, update them in the 'other' table
active.setColumnResizePolicy(new LinkedColumnResize(active, acknowledged));
acknowledged.setColumnResizePolicy(new LinkedColumnResize(acknowledged, active));
// When user sorts column, apply the same to the 'other' table
active.getSortOrder().addListener(new LinkedColumnSorter(active, acknowledged));
acknowledged.getSortOrder().addListener(new LinkedColumnSorter(acknowledged, active));
// Insets make ack. count appear similar to the active count,
// which is laid out based on the ack/unack/search buttons in the toolbar
acknowledged_count.setPadding(new Insets(10, 0, 10, 5));
VBox.setVgrow(acknowledged, Priority.ALWAYS);
final VBox bottom = new VBox(acknowledged_count, acknowledged);
// Overall layout:
// Toolbar
// Top section of split: Active alarms
// Bottom section o. s.: Ack'ed alarms
split = new SplitPane(active, bottom);
split.setOrientation(Orientation.VERTICAL);
setTop(toolbar);
setCenter(split);
}
TracesTab(final Model model, final UndoableActionManager undo)
{
super(Messages.TracesTab);
this.model = model;
this.undo = undo;
// Top: Traces
createTraceTable();
// Bottom: Archives for selected trace
createArchivesTable();
createDetailSection();
archives_table.setVisible(false);
formula_pane.setVisible(false);
final StackPane details = new StackPane(lower_placeholder, archives_table, formula_pane);
trace_table.setPlaceholder(new Label(Messages.TraceTableEmpty));
final SplitPane top_bottom = new SplitPane(trace_table, details);
top_bottom.setOrientation(Orientation.VERTICAL);
Platform.runLater(() -> top_bottom.setDividerPositions(0.7));
setContent(top_bottom);
createContextMenu();
model.addListener(model_listener);
updateFromModel();
trace_table.getSelectionModel().getSelectedItems().addListener(selection_changed);
}
private void setup() {
stage.getIcons().add(new Image(resource("icons/logo.png")));
stage.setTitle("Recaf");
menubar = new MainMenu(controller);
root = new BorderPane();
root.setTop(menubar);
navRoot = new BorderPane();
viewRoot = new BorderPane();
tabs = new ViewportTabs(controller);
SplitPane split = new SplitPane();
split.setOrientation(Orientation.HORIZONTAL);
split.getItems().addAll(navRoot, viewRoot);
split.setDividerPositions(0.333);
SplitPane.setResizableWithParent(navRoot, Boolean.FALSE);
root.setCenter(split);
viewRoot.setCenter(tabs);
// Navigation
updateWorkspaceNavigator();
Recaf.getWorkspaceSetListeners().add(w -> updateWorkspaceNavigator());
// Create scene & display the window
Scene scene = new Scene(root, 800, 600);
controller.windows().reapplyStyle(scene);
controller.config().keys().registerMainWindowKeys(controller, stage, scene);
stage.setScene(scene);
// Show update prompt
if (SelfUpdater.hasUpdate())
UpdateWindow.create(this).show(root);
}
/**
* Set split pane.
*
* @param initialFill
* The FXML file defining the initial content of the new pane.
*/
public final void setSplitPane(final String initialFill) {
if (mIsSplitPane) {
return;
}
mIsSplitPane = true;
StackPane body1 = new StackPane();
StackPane body2 = new StackPane();
SplitPane splitPane = new SplitPane();
splitPane.setOrientation(Orientation.HORIZONTAL);
splitPane.getItems().add(body1);
splitPane.getItems().add(body2);
mBodies = new StackPane[] {body1, body2, mBody};
if (initialFill != null) {
FxmlUtil.displaySubpage(initialFill, 1, false);
}
// put lowest two elements to left pane.
ObservableList<Node> children = mBody.getChildren();
if (children.size() > 0) {
body1.getChildren().addAll(children.subList(0, Math.min(2, children.size())));
}
// put other elements to right pane.
if (children.size() > 0) {
body2.getChildren().addAll(children);
}
children.clear();
children.add(splitPane);
refreshSubPagesOnResize();
}
@Override
protected Node createEditorControls() {
final GridPane controls = new GridPane();
controls.setAlignment(Pos.CENTER);
controls.setVgap(CONTROLS_DEFAULT_VERTICAL_SPACING);
final ColumnConstraints cc = new ColumnConstraints();
cc.setHgrow(Priority.ALWAYS);
controls.getColumnConstraints().add(cc);
final RowConstraints rc = new RowConstraints();
rc.setVgrow(Priority.ALWAYS);
controls.getRowConstraints().add(rc);
// build tree structure of icon
final IconNode builtInNode = new IconNode("(Built-in)", IconManager.getIconNames(false));
//convert structure to jfx treeview
builtInItem = new TreeItem<>(builtInNode);
addNode(builtInItem, builtInNode);
// set listview factory to display icon
listView = new ListView<>();
listView.setCellFactory(param -> new IconNodeCell());
listView.getStyleClass().add("rounded");
listView.getSelectionModel().selectedItemProperty().addListener((v, o, n) -> {
update();
});
treeRoot = new TreeItem<>(new IconNode("Icons", new HashSet<>()));
treeRoot.setExpanded(true);
treeView = new TreeView<>();
treeView.setShowRoot(true);
treeView.setRoot(treeRoot);
treeView.getStyleClass().add("rounded");
treeView.setOnMouseClicked((MouseEvent event) -> {
refreshIconList();
});
final SplitPane splitPane = new SplitPane();
splitPane.setId("hiddenSplitter");
splitPane.setOrientation(Orientation.HORIZONTAL);
splitPane.getItems().add(treeView);
splitPane.getItems().add(listView);
controls.addRow(0, splitPane);
final HBox addRemoveBox = createAddRemoveBox();
controls.addRow(1, addRemoveBox);
return controls;
}
public IsotopePatternPreviewDialog(boolean valueCheckRequired, ParameterSet parameters) {
super(valueCheckRequired, parameters);
aboveMin = new Color(30, 180, 30);
belowMin = new Color(200, 30, 30);
lastCalc = 0;
newParameters = false;
// task = new IsotopePatternPreviewTask(formula, minIntensity,
// mergeWidth, charge, pol, this);
// thread = new Thread(task);
pFormula = parameterSet.getParameter(IsotopePatternPreviewParameters.formula);
pMinIntensity = parameterSet.getParameter(IsotopePatternPreviewParameters.minIntensity);
pMergeWidth = parameterSet.getParameter(IsotopePatternPreviewParameters.mergeWidth);
pCharge = parameterSet.getParameter(IsotopePatternPreviewParameters.charge);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
cmpMinIntensity = getComponentForParameter(IsotopePatternPreviewParameters.minIntensity);
cmpMergeWidth = getComponentForParameter(IsotopePatternPreviewParameters.mergeWidth);
cmpCharge = getComponentForParameter(IsotopePatternPreviewParameters.charge);
cmpFormula = getComponentForParameter(IsotopePatternPreviewParameters.formula);
// panels
newMainPanel = new BorderPane();
// pnText = new ScrollPane();
pnlChart = new EChartViewer(chart);
table = new TableView<>();
pnSplit = new SplitPane(pnlChart, table);
pnSplit.setOrientation(Orientation.HORIZONTAL);
pnlParameters = new FlowPane();
pnlControl = new BorderPane();
// pnText.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
// pnText.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
// pnText.setMinimumSize(new Dimension(350, 300));
// pnlChart.setMinimumSize(new Dimension(350, 200));
// pnlChart.setPreferredSize( // TODO: can you do this cleaner?
// new Dimension((int) (screenSize.getWidth() / 3), (int) (screenSize.getHeight() / 3)));
// table.setMinimumSize(new Dimension(350, 300));
// table.setDefaultEditor(Object.class, null);
// controls
ttGen = new SpectraToolTipGenerator();
theme = new EIsotopePatternChartTheme();
theme.initialize();
// reorganize
mainPane.getChildren().remove(paramsPane);
organizeParameterPanel();
pnlControl.setCenter(pnlParameters);
pnlControl.setBottom(pnlButtons);
newMainPanel.setCenter(pnSplit);
newMainPanel.setBottom(pnlControl);
mainPane.setCenter(newMainPanel);
pnlButtons.getButtons().remove(super.btnCancel);
chart = ChartFactory.createXYBarChart("Isotope pattern preview", "m/z", false, "Abundance",
new XYSeriesCollection(new XYSeries("")));
pnlChart.setChart(chart);
// pnText.setViewportView(table);
formatChart();
parametersChanged();
}
public FeatureOverviewWindow(PeakListRow row) {
mainPane = new BorderPane();
mainScene = new Scene(mainPane);
// Use main CSS
mainScene.getStylesheets()
.addAll(MZmineCore.getDesktop().getMainWindow().getScene().getStylesheets());
setScene(mainScene);
this.feature = row.getBestPeak();
rawFiles = row.getRawDataFiles();
// setBackground(Color.white);
// setDefaultCloseOperation(DISPOSE_ON_CLOSE);
SplitPane splitPaneCenter = new SplitPane();
splitPaneCenter.setOrientation(Orientation.HORIZONTAL);
mainPane.setCenter(splitPaneCenter);
// split pane left for plots
SplitPane splitPaneLeftPlot = new SplitPane();
splitPaneLeftPlot.setOrientation(Orientation.VERTICAL);
splitPaneCenter.getItems().add(splitPaneLeftPlot);
// add Tic plots
splitPaneLeftPlot.getItems().add(addTicPlot(row));
// add feature data summary
splitPaneLeftPlot.getItems().add(addFeatureDataSummary(row));
// split pane right
SplitPane splitPaneRight = new SplitPane();
splitPaneRight.setOrientation(Orientation.VERTICAL);
splitPaneCenter.getItems().add(splitPaneRight);
// add spectra MS1
splitPaneRight.getItems().add(addSpectraMS1());
// add Spectra MS2
if (feature.getMostIntenseFragmentScanNumber() > 0) {
splitPaneRight.getItems().add(addSpectraMS2());
} else {
FlowPane noMSMSPanel = new FlowPane();
Label noMSMSScansFound = new Label("Sorry, no MS/MS scans found!");
// noMSMSScansFound.setFont(new Font("Dialog", Font.BOLD, 16));
// noMSMSScansFound.setForeground(Color.RED);
noMSMSPanel.getChildren().add(noMSMSScansFound);
splitPaneRight.getItems().add(noMSMSPanel);
}
// Add the Windows menu
WindowsMenu.addWindowsMenu(mainScene);
this.show();
}
private void createLayout() {
vBox.getChildren().add(crearteMainMenuBar());
// 左右切分布局------------------------
SplitPane horizontalSplitPane = new SplitPane();
horizontalSplitPane.setDividerPositions(0.5);
vBox.getChildren().add(horizontalSplitPane);
VBox.setVgrow(horizontalSplitPane, Priority.ALWAYS);
// 左右切分布局----左侧上下切分布局---------
SplitPane leftVerticalSplitPane = new SplitPane();
leftVerticalSplitPane.setDividerPositions(0.4);
horizontalSplitPane.getItems().add(leftVerticalSplitPane);
leftVerticalSplitPane.setOrientation(Orientation.VERTICAL);
// 左右切分布局----左侧上下切分布局----上布局-----
SplitPane leftTopHorizontalSplitPane = new SplitPane();
leftVerticalSplitPane.getItems().add(leftTopHorizontalSplitPane);
HBox leftTopRithtPane = new HBox();
Node orderPanelLayoutNode = orderPanelLayout.getNode();
HBox.setHgrow(orderPanelLayoutNode, Priority.ALWAYS);
ScrollPane marketDetailsScrollPane = new ScrollPane();
Node marketDetailsNode = marketDetailsLayout.getNode();
marketDetailsScrollPane.setContent(marketDetailsNode);
marketDetailsScrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
marketDetailsScrollPane.setPrefWidth(253);
marketDetailsScrollPane.setMinWidth(253);
marketDetailsScrollPane.setMaxWidth(253);
leftTopRithtPane.getChildren().addAll(marketDetailsScrollPane, orderPanelLayoutNode);
leftTopRithtPane.setMaxWidth(680);
leftTopRithtPane.setPrefWidth(680);
leftTopHorizontalSplitPane.getItems().addAll(tickLayout.getNode(), leftTopRithtPane);
SplitPane.setResizableWithParent(leftTopRithtPane, false);
// 左右切分布局----左侧上下切分布局----下布局-----
TabPane leftBootomTabPane = new TabPane();
leftVerticalSplitPane.getItems().add(leftBootomTabPane);
Tab orderTab = new Tab("定单");
leftBootomTabPane.getTabs().add(orderTab);
orderTab.setClosable(false);
orderTab.setContent(orderLayout.getNode());
Tab tradeTab = new Tab("成交");
leftBootomTabPane.getTabs().add(tradeTab);
tradeTab.setClosable(false);
tradeTab.setContent(tradeLayout.getNode());
// 左右切分布局----右侧TAB布局-------------
TabPane rightTabPane = new TabPane();
horizontalSplitPane.getItems().add(rightTabPane);
Tab portfolioInvestmentTab = new Tab("投资组合");
rightTabPane.getTabs().add(portfolioInvestmentTab);
portfolioInvestmentTab.setClosable(false);
SplitPane portfolioVerticalSplitPane = new SplitPane();
portfolioInvestmentTab.setContent(portfolioVerticalSplitPane);
portfolioVerticalSplitPane.setOrientation(Orientation.VERTICAL);
VBox.setVgrow(portfolioVerticalSplitPane, Priority.ALWAYS);
VBox portfolioVBox = new VBox();
portfolioVBox.getChildren().add(combinationLayout.getNode());
portfolioVBox.getChildren().add(accountLayout.getNode());
VBox.setVgrow(accountLayout.getNode(), Priority.ALWAYS);
portfolioVerticalSplitPane.getItems().add(portfolioVBox);
portfolioVerticalSplitPane.getItems().add(positionLayout.getNode());
Tab allContractTab = new Tab("全部合约");
allContractTab.setContent(contractLayout.getNode());
rightTabPane.getTabs().add(allContractTab);
allContractTab.setClosable(false);
// 状态栏------------------------------
vBox.getChildren().add(createStatusBar());
}
@Override
public void start(Stage stage) {
try {
// create splitPane pane and JavaFX app scene
SplitPane splitPane = new SplitPane();
splitPane.setOrientation(Orientation.VERTICAL);
Scene fxScene = new Scene(splitPane);
// set title, size, and add JavaFX scene to stage
stage.setTitle("Feature Layer Rendering Mode Scene Sample");
stage.setWidth(800);
stage.setHeight(700);
stage.setScene(fxScene);
stage.show();
// create a scene (top) and set it to render all features in static rendering mode
ArcGISScene sceneTop = new ArcGISScene();
sceneTop.getLoadSettings().setPreferredPointFeatureRenderingMode(FeatureLayer.RenderingMode.STATIC);
sceneTop.getLoadSettings().setPreferredPolylineFeatureRenderingMode(FeatureLayer.RenderingMode.STATIC);
sceneTop.getLoadSettings().setPreferredPolygonFeatureRenderingMode(FeatureLayer.RenderingMode.STATIC);
// create a scene (bottom) and set it to render all features in dynamic rendering mode
ArcGISScene sceneBottom = new ArcGISScene();
sceneBottom.getLoadSettings().setPreferredPointFeatureRenderingMode(FeatureLayer.RenderingMode.DYNAMIC);
sceneBottom.getLoadSettings().setPreferredPolylineFeatureRenderingMode(FeatureLayer.RenderingMode.DYNAMIC);
sceneBottom.getLoadSettings().setPreferredPolygonFeatureRenderingMode(FeatureLayer.RenderingMode.DYNAMIC);
// creating top scene view
sceneViewTop = new SceneView();
sceneViewTop.setArcGISScene(sceneTop);
splitPane.getItems().add(sceneViewTop);
// creating bottom scene view
sceneViewBottom = new SceneView();
sceneViewBottom.setArcGISScene(sceneBottom);
splitPane.getItems().add(sceneViewBottom);
// create service feature table using a point, polyline, and polygon service
ServiceFeatureTable pointServiceFeatureTable = new ServiceFeatureTable("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Energy/Geology/FeatureServer/0");
ServiceFeatureTable polylineServiceFeatureTable = new ServiceFeatureTable("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Energy/Geology/FeatureServer/8");
ServiceFeatureTable polygonServiceFeatureTable = new ServiceFeatureTable("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Energy/Geology/FeatureServer/9");
// create feature layer from service feature tables
FeatureLayer pointFeatureLayer = new FeatureLayer(pointServiceFeatureTable);
FeatureLayer polylineFeatureLayer = new FeatureLayer(polylineServiceFeatureTable);
FeatureLayer polygonFeatureLayer = new FeatureLayer(polygonServiceFeatureTable);
// add each layer to top and bottom scene
sceneTop.getOperationalLayers().addAll(Arrays.asList(pointFeatureLayer, polylineFeatureLayer, polygonFeatureLayer));
sceneBottom.getOperationalLayers().addAll(Arrays.asList(pointFeatureLayer.copy(), polylineFeatureLayer.copy(), polygonFeatureLayer.copy()));
// camera locations for camera to zoom in and out to
Camera zoomOutCamera = new Camera(new Point(-118.37, 34.46, SpatialReferences.getWgs84()), 42000, 0, 0, 0);
Camera zoomInCamera = new Camera(new Point(-118.45, 34.395, SpatialReferences.getWgs84()), 2500, 90, 75, 0);
sceneViewTop.setViewpointCamera(zoomOutCamera);
sceneViewBottom.setViewpointCamera(zoomOutCamera);
//loop an animation into and out from the zoom in point (5 seconds each) with a 2 second gap between zooming
timeline = new Timeline();
timeline.setCycleCount(Animation.INDEFINITE);
timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(7), event -> zoomTo(zoomOutCamera)));
timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(14), event -> zoomTo(zoomInCamera)));
timeline.play();
} catch (Exception e) {
// on any error, display the stack trace.
e.printStackTrace();
}
}
@Override
public void start(Stage stage) {
try {
// create split pane and JavaFX app scene
SplitPane splitPane = new SplitPane();
splitPane.setOrientation(Orientation.HORIZONTAL);
Scene fxScene = new Scene(splitPane);
// set title, size, and add JavaFX scene to stage
stage.setTitle("Sync Map and Scene Viewpoints");
stage.setWidth(1000);
stage.setHeight(700);
stage.setScene(fxScene);
stage.show();
// create a map and add a basemap to it
ArcGISMap map = new ArcGISMap();
map.setBasemap(Basemap.createImagery());
// create a scene and add a basemap to it
ArcGISScene scene = new ArcGISScene();
scene.setBasemap(Basemap.createImagery());
// set the map to a map view
mapView = new MapView();
mapView.setMap(map);
// set the scene to a scene view
sceneView = new SceneView();
sceneView.setArcGISScene(scene);
// add the map view and scene view to the split plane
splitPane.getItems().addAll(mapView, sceneView);
// add a viewpoint changed listener to the map view. Access the GeoView class using the event's getSource method
mapView.addViewpointChangedListener(viewpointChangedEvent -> synchronizeViewpoints(viewpointChangedEvent.getSource()));
// add a viewpoint changed listener to the scene view. Access the GeoView class using the event's getSource method
sceneView.addViewpointChangedListener(viewpointChangedEvent -> synchronizeViewpoints(viewpointChangedEvent.getSource()));
// create a list of GeoViews being navigated
geoViewList = new ArrayList<>();
geoViewList.add(mapView);
geoViewList.add(sceneView);
} catch (Exception e) {
// on any error, display the stack trace
e.printStackTrace();
}
}
@Override
public void start(Stage stage) {
try {
// create splitPane pane and JavaFX app scene
SplitPane splitPane = new SplitPane();
splitPane.setOrientation(Orientation.VERTICAL);
Scene fxScene = new Scene(splitPane);
// set title, size, and add JavaFX scene to stage
stage.setTitle("Feature Layer Rendering Mode Map Sample");
stage.setWidth(800);
stage.setHeight(700);
stage.setScene(fxScene);
stage.show();
// create a map (top) and set it to render all features in static rendering mode
ArcGISMap mapTop = new ArcGISMap();
mapTop.getLoadSettings().setPreferredPointFeatureRenderingMode(FeatureLayer.RenderingMode.STATIC);
mapTop.getLoadSettings().setPreferredPolylineFeatureRenderingMode(FeatureLayer.RenderingMode.STATIC);
mapTop.getLoadSettings().setPreferredPolygonFeatureRenderingMode(FeatureLayer.RenderingMode.STATIC);
// create a map (bottom) and set it to render all features in dynamic rendering mode
ArcGISMap mapBottom = new ArcGISMap();
mapBottom.getLoadSettings().setPreferredPointFeatureRenderingMode(FeatureLayer.RenderingMode.DYNAMIC);
mapBottom.getLoadSettings().setPreferredPolylineFeatureRenderingMode(FeatureLayer.RenderingMode.DYNAMIC);
mapBottom.getLoadSettings().setPreferredPolygonFeatureRenderingMode(FeatureLayer.RenderingMode.DYNAMIC);
// creating top map view
mapViewTop = new MapView();
mapViewTop.setMap(mapTop);
splitPane.getItems().add(mapViewTop);
// creating bottom map view
mapViewBottom = new MapView();
mapViewBottom.setMap(mapBottom);
splitPane.getItems().add(mapViewBottom);
// create service feature table using a point, polyline, and polygon service
ServiceFeatureTable pointServiceFeatureTable = new ServiceFeatureTable("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Energy/Geology/FeatureServer/0");
ServiceFeatureTable polylineServiceFeatureTable = new ServiceFeatureTable("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Energy/Geology/FeatureServer/8");
ServiceFeatureTable polygonServiceFeatureTable = new ServiceFeatureTable("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Energy/Geology/FeatureServer/9");
// create feature layer from service feature tables
FeatureLayer pointFeatureLayer = new FeatureLayer(pointServiceFeatureTable);
FeatureLayer polylineFeatureLayer = new FeatureLayer(polylineServiceFeatureTable);
FeatureLayer polygonFeatureLayer = new FeatureLayer(polygonServiceFeatureTable);
// add each layer to top and bottom map
mapTop.getOperationalLayers().addAll(Arrays.asList(pointFeatureLayer, polylineFeatureLayer, polygonFeatureLayer));
mapBottom.getOperationalLayers().addAll(Arrays.asList(pointFeatureLayer.copy(), polylineFeatureLayer.copy(), polygonFeatureLayer.copy()));
// viewpoint locations for map view to zoom in and out to
Viewpoint zoomOutPoint = new Viewpoint(new Point(-118.37, 34.46, SpatialReferences.getWgs84()), 650000, 0);
Viewpoint zoomInPoint = new Viewpoint(new Point(-118.45, 34.395, SpatialReferences.getWgs84()), 50000, 90);
mapViewTop.setViewpoint(zoomOutPoint);
mapViewBottom.setViewpoint(zoomOutPoint);
//loop an animation into and out from the zoom in point (5 seconds each) with a 2 second gap between zooming
timeline = new Timeline();
timeline.setCycleCount(Animation.INDEFINITE);
timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(7), event -> zoomTo(zoomInPoint)));
timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(14), event -> zoomTo(zoomOutPoint)));
timeline.play();
} catch (Exception e) {
// on any error, display the stack trace.
e.printStackTrace();
}
}