List of usage examples for java.awt Color equals
public boolean equals(Object obj)
From source file:net.sf.jasperreports.engine.export.HtmlExporter.java
protected void exportStyledTextRun(Map<Attribute, Object> attributes, String text, String tooltip, Locale locale, LineSpacingEnum lineSpacing, Float lineSpacingSize, float lineSpacingFactor, Color backcolor, boolean hyperlinkStarted) throws IOException { boolean localHyperlink = false; JRPrintHyperlink hyperlink = (JRPrintHyperlink) attributes.get(JRTextAttribute.HYPERLINK); if (!hyperlinkStarted && hyperlink != null) { localHyperlink = startHyperlink(hyperlink); }//from ww w .ja v a 2 s.c o m boolean isBold = TextAttribute.WEIGHT_BOLD.equals(attributes.get(TextAttribute.WEIGHT)); boolean isItalic = TextAttribute.POSTURE_OBLIQUE.equals(attributes.get(TextAttribute.POSTURE)); String fontFamily = resolveFontFamily(attributes, locale); // do not put single quotes around family name here because the value might already contain quotes, // especially if it is coming from font extension export configuration writer.write("<span style=\"font-family: "); // don't encode single quotes as the output would be too verbose and too much of a chance compared to previous releases writer.write(JRStringUtil.encodeXmlAttribute(fontFamily, true)); writer.write("; "); Color forecolor = (Color) attributes.get(TextAttribute.FOREGROUND); if (!hyperlinkStarted || !Color.black.equals(forecolor)) { writer.write("color: "); writer.write(JRColorUtil.getCssColor(forecolor)); writer.write("; "); } Color runBackcolor = (Color) attributes.get(TextAttribute.BACKGROUND); if (runBackcolor != null && !runBackcolor.equals(backcolor)) { writer.write("background-color: "); writer.write(JRColorUtil.getCssColor(runBackcolor)); writer.write("; "); } writer.write("font-size: "); writer.write(toSizeUnit((Float) attributes.get(TextAttribute.SIZE))); writer.write(";"); switch (lineSpacing) { case SINGLE: default: { if (lineSpacingFactor == 0) { writer.write(" line-height: 1; *line-height: normal;"); } else { writer.write(" line-height: " + lineSpacingFactor + ";"); } break; } case ONE_AND_HALF: { if (lineSpacingFactor == 0) { writer.write(" line-height: 1.5;"); } else { writer.write(" line-height: " + lineSpacingFactor + ";"); } break; } case DOUBLE: { if (lineSpacingFactor == 0) { writer.write(" line-height: 2.0;"); } else { writer.write(" line-height: " + lineSpacingFactor + ";"); } break; } case PROPORTIONAL: { if (lineSpacingSize != null) { writer.write(" line-height: " + lineSpacingSize + ";"); } break; } case AT_LEAST: case FIXED: { if (lineSpacingSize != null) { writer.write(" line-height: " + lineSpacingSize + "px;"); } break; } } /* if (!horizontalAlignment.equals(CSS_TEXT_ALIGN_LEFT)) { writer.write(" text-align: "); writer.write(horizontalAlignment); writer.write(";"); } */ if (isBold) { writer.write(" font-weight: bold;"); } if (isItalic) { writer.write(" font-style: italic;"); } if (TextAttribute.UNDERLINE_ON.equals(attributes.get(TextAttribute.UNDERLINE))) { writer.write(" text-decoration: underline;"); } if (TextAttribute.STRIKETHROUGH_ON.equals(attributes.get(TextAttribute.STRIKETHROUGH))) { writer.write(" text-decoration: line-through;"); } if (TextAttribute.SUPERSCRIPT_SUPER.equals(attributes.get(TextAttribute.SUPERSCRIPT))) { writer.write(" vertical-align: super;"); } else if (TextAttribute.SUPERSCRIPT_SUB.equals(attributes.get(TextAttribute.SUPERSCRIPT))) { writer.write(" vertical-align: sub;"); } writer.write("\""); if (tooltip != null) { writer.write(" title=\""); writer.write(JRStringUtil.encodeXmlAttribute(tooltip)); writer.write("\""); } writer.write(">"); writer.write(JRStringUtil.htmlEncode(text)); writer.write("</span>"); if (localHyperlink) { endHyperlink(); } }
From source file:net.sf.jasperreports.engine.export.HtmlExporter.java
protected boolean appendBorderStyle(JRLineBox box, StringBuilder styleBuffer) { boolean addedToStyle = false; if (box != null) { LineStyleEnum tps = box.getTopPen().getLineStyleValue(); LineStyleEnum lps = box.getLeftPen().getLineStyleValue(); LineStyleEnum bps = box.getBottomPen().getLineStyleValue(); LineStyleEnum rps = box.getRightPen().getLineStyleValue(); float tpw = box.getTopPen().getLineWidth(); float lpw = box.getLeftPen().getLineWidth(); float bpw = box.getBottomPen().getLineWidth(); float rpw = box.getRightPen().getLineWidth(); if (0f < tpw && tpw < 1f) { tpw = 1f;//www . j av a2 s . co m } if (0f < lpw && lpw < 1f) { lpw = 1f; } if (0f < bpw && bpw < 1f) { bpw = 1f; } if (0f < rpw && rpw < 1f) { rpw = 1f; } Color tpc = box.getTopPen().getLineColor(); // try to compact all borders into one css property if (tps == lps && // same line style tps == bps && tps == rps && tpw == lpw && // same line width tpw == bpw && tpw == rpw && tpc.equals(box.getLeftPen().getLineColor()) && // same line color tpc.equals(box.getBottomPen().getLineColor()) && tpc.equals(box.getRightPen().getLineColor())) { addedToStyle |= appendPen(styleBuffer, box.getTopPen(), null); } else { addedToStyle |= appendPen(styleBuffer, box.getTopPen(), "top"); addedToStyle |= appendPen(styleBuffer, box.getLeftPen(), "left"); addedToStyle |= appendPen(styleBuffer, box.getBottomPen(), "bottom"); addedToStyle |= appendPen(styleBuffer, box.getRightPen(), "right"); } } return addedToStyle; }
From source file:net.sf.jasperreports.engine.export.JRRtfExporter.java
/** * Draw a text box//w ww . j a v a2s . c o m * @param text JasperReports text object (JRPrintText) * @throws JRException */ public void exportText(JRPrintText text) throws IOException, JRException { // use styled text JRStyledText styledText = getStyledText(text); if (styledText == null) { return; } int width = text.getWidth(); int height = text.getHeight(); int textHeight = (int) text.getTextHeight(); if (textHeight <= 0) { if (height <= 0) { throw new JRException(EXCEPTION_MESSAGE_KEY_INVALID_TEXT_HEIGHT, (Object[]) null); } textHeight = height; } /* */ startElement(text); // padding for the text int topPadding = text.getLineBox().getTopPadding(); int leftPadding = text.getLineBox().getLeftPadding(); int bottomPadding = text.getLineBox().getBottomPadding(); int rightPadding = text.getLineBox().getRightPadding(); String rotation = null; switch (text.getRotationValue()) { case LEFT: { switch (text.getVerticalTextAlign()) { case BOTTOM: { leftPadding = Math.max(leftPadding, width - rightPadding - textHeight); break; } case MIDDLE: { leftPadding = Math.max(leftPadding, (width - rightPadding - textHeight) / 2); break; } case TOP: case JUSTIFIED: default: { } } rotation = "{\\sp{\\sn txflTextFlow}{\\sv 2}}"; break; } case RIGHT: { switch (text.getVerticalTextAlign()) { case BOTTOM: { rightPadding = Math.max(rightPadding, width - leftPadding - textHeight); break; } case MIDDLE: { rightPadding = Math.max(rightPadding, (width - leftPadding - textHeight) / 2); break; } case TOP: case JUSTIFIED: default: { } } rotation = "{\\sp{\\sn txflTextFlow}{\\sv 3}}"; break; } case UPSIDE_DOWN: { switch (text.getVerticalTextAlign()) { case TOP: { topPadding = Math.max(topPadding, height - bottomPadding - textHeight); break; } case MIDDLE: { topPadding = Math.max(topPadding, (height - bottomPadding - textHeight) / 2); break; } case BOTTOM: case JUSTIFIED: default: { } } rotation = ""; break; } case NONE: default: { switch (text.getVerticalTextAlign()) { case BOTTOM: { topPadding = Math.max(topPadding, height - bottomPadding - textHeight); break; } case MIDDLE: { topPadding = Math.max(topPadding, (height - bottomPadding - textHeight) / 2); break; } case TOP: case JUSTIFIED: default: { } } rotation = ""; } } contentWriter.write(rotation); contentWriter.write("{\\sp{\\sn dyTextTop}{\\sv "); contentWriter.write(String.valueOf(LengthUtil.emu(topPadding))); contentWriter.write("}}"); contentWriter.write("{\\sp{\\sn dxTextLeft}{\\sv "); contentWriter.write(String.valueOf(LengthUtil.emu(leftPadding))); contentWriter.write("}}"); contentWriter.write("{\\sp{\\sn dyTextBottom}{\\sv "); contentWriter.write(String.valueOf(LengthUtil.emu(bottomPadding))); contentWriter.write("}}"); contentWriter.write("{\\sp{\\sn dxTextRight}{\\sv "); contentWriter.write(String.valueOf(LengthUtil.emu(rightPadding))); contentWriter.write("}}"); contentWriter.write("{\\sp{\\sn fLine}{\\sv 0}}"); contentWriter.write("{\\shptxt{\\pard "); contentWriter.write("\\fi" + LengthUtil.twip(text.getParagraph().getFirstLineIndent()) + " "); contentWriter.write("\\li" + LengthUtil.twip(text.getParagraph().getLeftIndent()) + " "); contentWriter.write("\\ri" + LengthUtil.twip(text.getParagraph().getRightIndent()) + " "); contentWriter.write("\\sb" + LengthUtil.twip(text.getParagraph().getSpacingBefore()) + " "); contentWriter.write("\\sa" + LengthUtil.twip(text.getParagraph().getSpacingAfter()) + " "); TabStop[] tabStops = text.getParagraph().getTabStops(); if (tabStops != null && tabStops.length > 0) { for (int i = 0; i < tabStops.length; i++) { TabStop tabStop = tabStops[i]; String tabStopAlign = ""; switch (tabStop.getAlignment()) { case CENTER: tabStopAlign = "\\tqc"; break; case RIGHT: tabStopAlign = "\\tqr"; break; case LEFT: default: tabStopAlign = ""; break; } contentWriter.write(tabStopAlign + "\\tx" + LengthUtil.twip(tabStop.getPosition()) + " "); } } // JRFont font = text; if (text.getRunDirectionValue() == RunDirectionEnum.RTL) { contentWriter.write("\\rtlch"); } // writer.write("\\f"); // writer.write(String.valueOf(getFontIndex(font))); // writer.write("\\cf"); // writer.write(String.valueOf(getColorIndex(text.getForecolor()))); contentWriter.write("\\cb"); contentWriter.write(String.valueOf(getColorIndex(text.getBackcolor()))); contentWriter.write(" "); // if (font.isBold()) // writer.write("\\b"); // if (font.isItalic()) // writer.write("\\i"); // if (font.isStrikeThrough()) // writer.write("\\strike"); // if (font.isUnderline()) // writer.write("\\ul"); // writer.write("\\fs"); // writer.write(String.valueOf(font.getFontSize() * 2)); switch (text.getHorizontalTextAlign()) { case LEFT: contentWriter.write("\\ql"); break; case CENTER: contentWriter.write("\\qc"); break; case RIGHT: contentWriter.write("\\qr"); break; case JUSTIFIED: contentWriter.write("\\qj"); break; default: contentWriter.write("\\ql"); break; } switch (text.getParagraph().getLineSpacing()) { case AT_LEAST: { contentWriter.write("\\sl" + LengthUtil.twip(text.getParagraph().getLineSpacingSize())); contentWriter.write(" \\slmult0 "); break; } case FIXED: { contentWriter.write("\\sl-" + LengthUtil.twip(text.getParagraph().getLineSpacingSize())); contentWriter.write(" \\slmult0 "); break; } case PROPORTIONAL: { contentWriter.write("\\sl" + (int) (text.getParagraph().getLineSpacingSize() * LINE_SPACING_FACTOR)); contentWriter.write(" \\slmult1 "); break; } case DOUBLE: { contentWriter.write("\\sl" + (int) (2f * LINE_SPACING_FACTOR)); contentWriter.write(" \\slmult1 "); break; } case ONE_AND_HALF: { contentWriter.write("\\sl" + (int) (1.5f * LINE_SPACING_FACTOR)); contentWriter.write(" \\slmult1 "); break; } case SINGLE: default: { contentWriter.write("\\sl" + (int) (1f * LINE_SPACING_FACTOR)); contentWriter.write(" \\slmult1 "); break; } } if (text.getAnchorName() != null) { writeAnchor(text.getAnchorName()); } boolean startedHyperlink = exportHyperlink(text); // add parameters in case of styled text element String plainText = styledText.getText(); int runLimit = 0; AttributedCharacterIterator iterator = styledText.getAttributedString().getIterator(); while (runLimit < styledText.length() && (runLimit = iterator.getRunLimit()) <= styledText.length()) { Map<Attribute, Object> styledTextAttributes = iterator.getAttributes(); JRFont styleFont = new JRBaseFont(styledTextAttributes); Color styleForeground = (Color) styledTextAttributes.get(TextAttribute.FOREGROUND); Color styleBackground = (Color) styledTextAttributes.get(TextAttribute.BACKGROUND); contentWriter.write("\\f"); contentWriter.write(String.valueOf(getFontIndex(styleFont, getTextLocale(text)))); contentWriter.write("\\fs"); contentWriter.write(String.valueOf((int) (2 * styleFont.getFontsize()))); if (styleFont.isBold()) { contentWriter.write("\\b"); } if (styleFont.isItalic()) { contentWriter.write("\\i"); } if (styleFont.isUnderline()) { contentWriter.write("\\ul"); } if (styleFont.isStrikeThrough()) { contentWriter.write("\\strike"); } if (TextAttribute.SUPERSCRIPT_SUPER.equals(styledTextAttributes.get(TextAttribute.SUPERSCRIPT))) { contentWriter.write("\\super"); } else if (TextAttribute.SUPERSCRIPT_SUB.equals(styledTextAttributes.get(TextAttribute.SUPERSCRIPT))) { contentWriter.write("\\sub"); } if (!(null == styleBackground || styleBackground.equals(text.getBackcolor()))) { contentWriter.write("\\highlight"); contentWriter.write(String.valueOf(getColorIndex(styleBackground))); } contentWriter.write("\\cf"); contentWriter.write(String.valueOf(getColorIndex(styleForeground))); contentWriter.write(" "); contentWriter.write(handleUnicodeText(plainText.substring(iterator.getIndex(), runLimit))); // reset all styles in the paragraph contentWriter.write("\\plain"); iterator.setIndex(runLimit); } endHyperlink(startedHyperlink); contentWriter.write("\\par}}"); /* */ finishElement(); exportBox(text.getLineBox(), text.getX() + getOffsetX(), text.getY() + getOffsetY(), width, height); }
From source file:org.openmicroscopy.shoola.agents.imviewer.view.ImViewerUI.java
/** * Helper method to create the unit bar color sub-menu. * //from w w w . ja v a2 s . c om * @param pref The user preferences. * @return See above. */ private JMenuItem createScaleBarColorSubMenu(ViewerPreferences pref) { JMenu menu = new JMenu("Scale bar/Text color"); ButtonGroup group = new ButtonGroup(); Iterator<Entry<Color, String>> i = EditorUtil.COLORS_BAR.entrySet().iterator(); ColorCheckBoxMenuItem item; Color c; Color refColor = ImagePaintingFactory.UNIT_BAR_COLOR; if (pref != null) refColor = pref.getScaleBarColor(); if (refColor == null) refColor = ImagePaintingFactory.UNIT_BAR_COLOR; Entry<Color, String> entry; while (i.hasNext()) { entry = i.next(); c = entry.getKey(); item = new ColorCheckBoxMenuItem(c); item.setText(entry.getValue()); item.setSelected(c.equals(refColor)); group.add(item); menu.add(item); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ColorCheckBoxMenuItem source = (ColorCheckBoxMenuItem) e.getSource(); if (source.isSelected()) model.getBrowser().setUnitBarColor(source.getColor()); } }); } return menu; }
From source file:org.openmicroscopy.shoola.agents.imviewer.view.ImViewerUI.java
/** * Helper method to create the background color sub-menu. * /* w ww. j av a2 s . c om*/ * @param pref The user preferences. * @return See above. */ private JMenuItem createBackgroundColorSubMenu(ViewerPreferences pref) { JMenu menu = new JMenu("Background color"); bgColorGroup = new ButtonGroup(); Iterator<Entry<Color, String>> i = backgrounds.entrySet().iterator(); ColorCheckBoxMenuItem item; Color c; Color refColor = ImagePaintingFactory.DEFAULT_BACKGROUND; if (pref != null) refColor = pref.getBackgroundColor(); if (refColor == null) refColor = ImagePaintingFactory.DEFAULT_BACKGROUND; Entry<Color, String> entry; while (i.hasNext()) { entry = i.next(); c = entry.getKey(); item = new ColorCheckBoxMenuItem(c); item.setText(entry.getValue()); item.setSelected(c.equals(refColor)); bgColorGroup.add(item); menu.add(item); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ColorCheckBoxMenuItem src = (ColorCheckBoxMenuItem) e.getSource(); if (src.isSelected()) { controller.setPreferences(); if (lens != null) lens.setBackgroundColor(src.getColor()); model.getBrowser().setBackgroundColor(src.getColor()); } } }); } return menu; }
From source file:com.actelion.research.table.view.JVisualization.java
/** * Defines the background color//from ww w . j av a2s .co m * @param c (null for WHITE) * @return whether there was a change */ public boolean setViewBackground(Color c) { if (Color.WHITE.equals(c)) c = null; if ((c != null && !c.equals(mViewBackground)) || (c == null && mViewBackground != null)) { mViewBackground = c; invalidateOffImage(false); return true; } return false; }
From source file:org.ramadda.util.HtmlUtils.java
/** * _more_/* w w w . ja v a2 s . c om*/ * * @param name _more_ * @param selected _more_ * * @return _more_ */ public static String colorSelect(String name, String selected) { StringBuilder sb = new StringBuilder(); sb.append(open(TAG_SELECT, attrs(ATTR_NAME, name, ATTR_CLASS, CLASS_SELECT))); String value; value = "none"; sb.append(tag(TAG_OPTION, attrs(ATTR_TITLE, value, ATTR_VALUE, ""), value)); for (int i = 0; i < COLORS.length; i++) { Color c = COLORS[i]; String label = COLORNAMES[i]; value = StringUtil.toHexString(c); value = value.replace("#", ""); String selectedAttr = ""; if (Misc.equals(value, selected)) { selectedAttr = attrs(ATTR_SELECTED, VALUE_SELECTED); } String textColor = ""; if (c.equals(Color.black)) { textColor = "color:#FFFFFF;"; } sb.append(tag(TAG_OPTION, selectedAttr + attrs(ATTR_TITLE, value, ATTR_VALUE, value, ATTR_STYLE, "background-color:" + value + ";" + textColor), label)); } sb.append(close(TAG_SELECT)); return sb.toString(); }
From source file:tufts.vue.LWComponent.java
public static Color getContrastColor(Color c) { if (c != null) { if (c.equals(Color.black)) return Color.darkGray; else/*from www. j av a 2 s . co m*/ return c.darker(); } else { return DEBUG.BOXES ? Color.red : Color.gray; } }
From source file:tufts.vue.LWComponent.java
public final void drawZero(DrawContext dc) { final AffineTransform zeroTransform = DEBUG.PDF ? dc.g.getTransform() : null; dc.checkComposite(this); if (DEBUG.Enabled) dc.recordDebug(this); try {/*from w ww.j a va 2s .c om*/ if (!isTopLevel()) { // e.g., isn't a Layer, which is never selected // TODO: this should be a flag set up in the DrawContext if (VUE.getInteractionToolsPanel() != null) { final double alpha = VUE.getInteractionToolsPanel().getAlpha(); if (alpha != 1 && !selectedOrParent()) dc.setAlpha(alpha); // fade nodes not in selection } } drawImpl(dc); } catch (RuntimeException e) { Log.error("drawImpl failed: " + e); try { dc.setAlpha(0.5); dc.g.setColor(Color.red); dc.g.fill(getZeroShape()); } catch (Throwable t) { Util.printStackTrace(t); } finally { throw e; } } if (isDeleted()) { // debug dc.setAlpha(0.5); dc.g.setColor(Color.yellow); dc.g.fill(getZeroShape()); } if (DEBUG.PDF && DEBUG.META && this instanceof LWLink == false) { dc = dc.create(); dc.g.setTransform(zeroTransform); dc.g.setColor(Color.blue); dc.g.setFont(VueConstants.FixedSmallFont); dc.setAbsoluteScale(1); final Color c1 = getFillColor(); final Color c2 = getRenderFillColor(dc); dc.g.drawString(fmt(c1), 0, 10); if (c1 == null || !c1.equals(c2)) dc.g.drawString(fmt(c2), 0, 20); } }
From source file:fr.amap.lidar.amapvox.gui.MainFrameController.java
/** * Initializes the controller class./* w ww . ja va2s.co m*/ */ @Override public void initialize(URL url, ResourceBundle rb) { this.resourceBundle = rb; viewer3DPanelController.setResourceBundle(rb); initStrings(rb); colorPickerSeries.valueProperty().addListener(new ChangeListener<javafx.scene.paint.Color>() { @Override public void changed(ObservableValue<? extends javafx.scene.paint.Color> observable, javafx.scene.paint.Color oldValue, javafx.scene.paint.Color newValue) { if (listViewVoxelsFilesChart.getSelectionModel().getSelectedItems().size() == 1) { listViewVoxelsFilesChart.getSelectionModel().getSelectedItem().getSeriesParameters() .setColor(new Color((float) newValue.getRed(), (float) newValue.getGreen(), (float) newValue.getBlue(), 1.0f)); } } }); comboboxScript.getItems().setAll("Daniel script"); vboxWeighting.disableProperty().bind(checkboxEnableWeighting.selectedProperty().not()); checkboxEnableWeighting.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue && textAreaWeighting.getText().isEmpty()) { int selectedVoxTab = tabPaneVoxelisation.getSelectionModel().getSelectedIndex(); if (selectedVoxTab == 0) { //ALS fillWeightingData(EchoesWeightParams.DEFAULT_ALS_WEIGHTING); } else if (selectedVoxTab == 1) { //TLS fillWeightingData(EchoesWeightParams.DEFAULT_TLS_WEIGHTING); } } } }); /*comboboxTransMode.getItems().setAll(1, 2, 3); comboboxTransMode.getSelectionModel().selectFirst(); comboboxPathLengthMode.getItems().setAll("A", "B"); comboboxPathLengthMode.getSelectionModel().selectFirst();*/ helpButtonNaNsCorrection.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { helpButtonNaNsCorrectionController.showHelpDialog(resourceBundle.getString("help_NaNs_correction")); } }); helpButtonAutoBBox.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { helpButtonAutoBBoxController.showHelpDialog(resourceBundle.getString("help_bbox")); } }); helpButtonHemiPhoto.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { helpButtonHemiPhotoController.showHelpDialog(resourceBundle.getString("help_hemiphoto")); } }); buttonHelpEmptyShotsFilter.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { buttonHelpEmptyShotsFilterController .showHelpDialog(resourceBundle.getString("help_empty_shots_filter")); } }); /*work around, the divider positions values are defined in the fxml, but when the window is initialized the values are lost*/ Platform.runLater(new Runnable() { @Override public void run() { splitPaneMain.setDividerPositions(0.75f); splitPaneVoxelization.setDividerPositions(0.45f); } }); initValidationSupport(); initPostProcessTab(); listViewTransmittanceMapSensorPositions.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); listViewTaskList.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); MenuItem menuItemPadValue1m = new MenuItem("1m voxel size"); addMenuItemPadValue(menuItemPadValue1m, 3.536958f); MenuItem menuItemPadValue2m = new MenuItem("2m voxel size"); addMenuItemPadValue(menuItemPadValue2m, 2.262798f); MenuItem menuItemPadValue3m = new MenuItem("3m voxel size"); addMenuItemPadValue(menuItemPadValue3m, 1.749859f); MenuItem menuItemPadValue4m = new MenuItem("4m voxel size"); addMenuItemPadValue(menuItemPadValue4m, 1.3882959f); MenuItem menuItemPadValue5m = new MenuItem("5m voxel size"); addMenuItemPadValue(menuItemPadValue5m, 1.0848f); menuButtonAdvisablePADMaxValues.getItems().addAll(menuItemPadValue1m, menuItemPadValue2m, menuItemPadValue3m, menuItemPadValue4m, menuItemPadValue5m); fileChooserSaveCanopyAnalyserOutputFile = new FileChooserContext(); fileChooserSaveCanopyAnalyserCfgFile = new FileChooserContext(); fileChooserSaveTransmittanceSimCfgFile = new FileChooserContext(); fileChooserOpenCanopyAnalyserInputFile = new FileChooserContext(); listViewCanopyAnalyzerSensorPositions.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); ContextMenu contextMenuProductsList = new ContextMenu(); MenuItem openImageItem = new MenuItem(RS_STR_OPEN_IMAGE); openImageItem.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { File selectedFile = listViewProductsFiles.getSelectionModel().getSelectedItem(); showImage(selectedFile); } }); Menu menuEdit = new Menu(RS_STR_EDIT); MenuItem menuItemEditVoxels = new MenuItem("Remove voxels (delete key)"); MenuItem menuItemFitToContent = new MenuItem("Fit to content"); MenuItem menuItemCrop = new MenuItem("Crop"); menuEdit.getItems().setAll(menuItemEditVoxels, menuItemFitToContent, menuItemCrop); menuItemFitToContent.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem(); if (selectedItem != null) { fitVoxelSpaceToContent(selectedItem); } } }); menuItemEditVoxels.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem(); if (selectedItem != null) { editVoxelSpace(selectedItem); } } }); menuItemCrop.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem(); if (selectedItem != null) { try { voxelSpaceCroppingFrameController.setVoxelFile(selectedItem); voxelSpaceCroppingFrame.show(); } catch (Exception ex) { showErrorDialog(ex); } } } }); Menu menuExport = new Menu(RS_STR_EXPORT); MenuItem menuItemExportDartMaket = new MenuItem("Dart (maket.txt)"); MenuItem menuItemExportDartPlots = new MenuItem("Dart (plots.xml)"); MenuItem menuItemExportMeshObj = new MenuItem("Mesh (*.obj)"); menuItemExportDartMaket.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem(); if (selectedItem != null) { exportDartMaket(selectedItem); } } }); menuItemExportDartPlots.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem(); if (selectedItem != null) { exportDartPlots(selectedItem); } } }); menuItemExportMeshObj.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem(); if (selectedItem != null) { exportMeshObj(selectedItem); } } }); menuExport.getItems().setAll(menuItemExportDartMaket, menuItemExportDartPlots, menuItemExportMeshObj); MenuItem menuItemInfo = new MenuItem(RS_STR_INFO); menuItemInfo.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { Alert alert = new Alert(AlertType.INFORMATION); File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem(); if (selectedItem != null) { VoxelFileReader reader; try { reader = new VoxelFileReader(selectedItem); VoxelSpaceInfos voxelSpaceInfos = reader.getVoxelSpaceInfos(); alert.setTitle("Information"); alert.setHeaderText("Voxel space informations"); alert.setContentText(voxelSpaceInfos.toString()); alert.show(); } catch (Exception ex) { showErrorDialog(ex); } } } }); final MenuItem menuItemOpenContainingFolder = new MenuItem(RS_STR_OPEN_CONTAINING_FOLDER); menuItemOpenContainingFolder.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { final File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem(); if (selectedItem != null) { if (Desktop.isDesktopSupported()) { new Thread(() -> { try { Desktop.getDesktop().open(selectedItem.getParentFile()); } catch (IOException ex) { logger.error("Cannot open directory " + selectedItem); } }).start(); } } } }); listViewProductsFiles.setOnContextMenuRequested(new EventHandler<ContextMenuEvent>() { @Override public void handle(ContextMenuEvent event) { if (listViewProductsFiles.getSelectionModel().getSelectedIndices().size() == 1) { File selectedFile = listViewProductsFiles.getSelectionModel().getSelectedItem(); String extension = FileManager.getExtension(selectedFile); switch (extension) { case ".png": case ".bmp": case ".jpg": contextMenuProductsList.getItems().setAll(openImageItem, menuItemOpenContainingFolder); contextMenuProductsList.show(listViewProductsFiles, event.getScreenX(), event.getScreenY()); break; case ".vox": default: if (VoxelFileReader.isFileAVoxelFile(selectedFile)) { contextMenuProductsList.getItems().setAll(menuItemInfo, menuItemOpenContainingFolder, menuEdit, menuExport); contextMenuProductsList.show(listViewProductsFiles, event.getScreenX(), event.getScreenY()); } } } } }); ContextMenu contextMenuLidarScanEdit = new ContextMenu(); MenuItem editItem = new MenuItem("Edit"); editItem.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { filterFrameController.setFilters("Reflectance", "Deviation", "Amplitude"); filterFrame.show(); filterFrame.setOnHidden(new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent event) { if (filterFrameController.getFilter() != null) { ObservableList<LidarScan> items = listViewHemiPhotoScans.getSelectionModel() .getSelectedItems(); for (LidarScan scan : items) { scan.filters.add(filterFrameController.getFilter()); } } } }); } }); contextMenuLidarScanEdit.getItems().add(editItem); listViewHemiPhotoScans.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); listViewHemiPhotoScans.setOnContextMenuRequested(new EventHandler<ContextMenuEvent>() { @Override public void handle(ContextMenuEvent event) { contextMenuLidarScanEdit.show(listViewHemiPhotoScans, event.getScreenX(), event.getScreenY()); } }); /**LAD tab initialization**/ comboboxLADChoice.getItems().addAll(LeafAngleDistribution.Type.UNIFORM, LeafAngleDistribution.Type.SPHERIC, LeafAngleDistribution.Type.ERECTOPHILE, LeafAngleDistribution.Type.PLANOPHILE, LeafAngleDistribution.Type.EXTREMOPHILE, LeafAngleDistribution.Type.PLAGIOPHILE, LeafAngleDistribution.Type.HORIZONTAL, LeafAngleDistribution.Type.VERTICAL, LeafAngleDistribution.Type.ELLIPSOIDAL, LeafAngleDistribution.Type.ELLIPTICAL, LeafAngleDistribution.Type.TWO_PARAMETER_BETA); comboboxLADChoice.getSelectionModel().select(LeafAngleDistribution.Type.SPHERIC); comboboxLADChoice.getSelectionModel().selectedItemProperty() .addListener(new ChangeListener<LeafAngleDistribution.Type>() { @Override public void changed(ObservableValue<? extends LeafAngleDistribution.Type> observable, LeafAngleDistribution.Type oldValue, LeafAngleDistribution.Type newValue) { if (newValue == LeafAngleDistribution.Type.TWO_PARAMETER_BETA || newValue == LeafAngleDistribution.Type.ELLIPSOIDAL) { hboxTwoBetaParameters.setVisible(true); if (newValue == LeafAngleDistribution.Type.ELLIPSOIDAL) { labelLADBeta.setVisible(false); } else { labelLADBeta.setVisible(true); } } else { hboxTwoBetaParameters.setVisible(false); } } }); ToggleGroup ladTypeGroup = new ToggleGroup(); radiobuttonLADHomogeneous.setToggleGroup(ladTypeGroup); radiobuttonLADLocalEstimation.setToggleGroup(ladTypeGroup); /**CHART panel initialization**/ ToggleGroup profileChartType = new ToggleGroup(); radiobuttonPreDefinedProfile.setToggleGroup(profileChartType); radiobuttonFromVariableProfile.setToggleGroup(profileChartType); ToggleGroup profileChartRelativeHeightType = new ToggleGroup(); radiobuttonHeightFromAboveGround.setToggleGroup(profileChartRelativeHeightType); radiobuttonHeightFromBelowCanopy.setToggleGroup(profileChartRelativeHeightType); comboboxFromVariableProfile.disableProperty().bind(radiobuttonPreDefinedProfile.selectedProperty()); comboboxPreDefinedProfile.disableProperty().bind(radiobuttonFromVariableProfile.selectedProperty()); hboxMaxPADVegetationProfile.visibleProperty().bind(radiobuttonPreDefinedProfile.selectedProperty()); listViewVoxelsFilesChart.getSelectionModel().selectedIndexProperty() .addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { if (listViewVoxelsFilesChart.getSelectionModel().getSelectedItems().size() > 1) { colorPickerSeries.setDisable(true); } else if (listViewVoxelsFilesChart.getSelectionModel().getSelectedItems().size() == 1) { VoxelFileChart selectedItem = listViewVoxelsFilesChart.getSelectionModel() .getSelectedItem(); Color selectedItemColor = selectedItem.getSeriesParameters().getColor(); colorPickerSeries.setDisable(false); colorPickerSeries.setValue(new javafx.scene.paint.Color( selectedItemColor.getRed() / 255.0, selectedItemColor.getGreen() / 255.0, selectedItemColor.getBlue() / 255.0, 1.0)); if (newValue.intValue() >= 0) { textfieldLabelVoxelFileChart.setText( listViewVoxelsFilesChart.getItems().get(newValue.intValue()).label); } } } }); textfieldLabelVoxelFileChart.textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { if (listViewVoxelsFilesChart.getSelectionModel().getSelectedIndex() >= 0) { listViewVoxelsFilesChart.getSelectionModel().getSelectedItem().label = newValue; } } }); listViewVoxelsFilesChart.getItems().addListener(new ListChangeListener<VoxelFileChart>() { @Override public void onChanged(ListChangeListener.Change<? extends VoxelFileChart> c) { while (c.next()) { } if (c.wasAdded() && c.getAddedSize() == c.getList().size()) { try { VoxelFileReader reader = new VoxelFileReader(c.getList().get(0).file); String[] columnNames = reader.getVoxelSpaceInfos().getColumnNames(); comboboxFromVariableProfile.getItems().clear(); comboboxFromVariableProfile.getItems().addAll(columnNames); comboboxFromVariableProfile.getSelectionModel().selectFirst(); } catch (Exception ex) { logger.error("Cannot read voxel file", ex); } } } }); anchorpaneQuadrats.disableProperty().bind(checkboxMakeQuadrats.selectedProperty().not()); comboboxSelectAxisForQuadrats.getItems().addAll("X", "Y", "Z"); comboboxSelectAxisForQuadrats.getSelectionModel().select(1); comboboxPreDefinedProfile.getItems().addAll("Vegetation (PAD)"); comboboxPreDefinedProfile.getSelectionModel().selectFirst(); radiobuttonSplitCountForQuadrats.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { textFieldSplitCountForQuadrats.setDisable(!newValue); textFieldLengthForQuadrats.setDisable(newValue); } }); ToggleGroup chartMakeQuadratsSplitType = new ToggleGroup(); radiobuttonLengthForQuadrats.setToggleGroup(chartMakeQuadratsSplitType); radiobuttonSplitCountForQuadrats.setToggleGroup(chartMakeQuadratsSplitType); /**Virtual measures panel initialization**/ comboboxHemiPhotoBitmapOutputMode.getItems().addAll("Pixel", "Color"); comboboxHemiPhotoBitmapOutputMode.getSelectionModel().selectFirst(); ToggleGroup virtualMeasuresChoiceGroup = new ToggleGroup(); toggleButtonLAI2000Choice.setToggleGroup(virtualMeasuresChoiceGroup); toggleButtonLAI2200Choice.setToggleGroup(virtualMeasuresChoiceGroup); comboboxChooseCanopyAnalyzerSampling.getItems().setAll(500, 4000, 10000); comboboxChooseCanopyAnalyzerSampling.getSelectionModel().selectFirst(); initEchoFiltering(); data = FXCollections.observableArrayList(); tableViewSimulationPeriods.setItems(data); tableViewSimulationPeriods.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); comboboxChooseDirectionsNumber.getItems().addAll(1, 6, 16, 46, 136, 406); comboboxChooseDirectionsNumber.getSelectionModel().select(4); ToggleGroup scannerPositionsMode = new ToggleGroup(); /*radiobuttonScannerPosSquaredArea.setToggleGroup(scannerPositionsMode); radiobuttonScannerPosFile.setToggleGroup(scannerPositionsMode);*/ tableColumnPeriod.setCellValueFactory( new Callback<TableColumn.CellDataFeatures<SimulationPeriod, String>, ObservableValue<String>>() { @Override public ObservableValue<String> call( TableColumn.CellDataFeatures<SimulationPeriod, String> param) { return new SimpleStringProperty(param.getValue().getPeriod().toString()); } }); tableColumnClearness.setCellValueFactory( new Callback<TableColumn.CellDataFeatures<SimulationPeriod, String>, ObservableValue<String>>() { @Override public ObservableValue<String> call( TableColumn.CellDataFeatures<SimulationPeriod, String> param) { return new SimpleStringProperty(String.valueOf(param.getValue().getClearnessCoefficient())); } }); checkboxMultiFiles.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { anchorpaneBoundingBoxParameters.setDisable(newValue); } }); hboxGenerateBitmapFiles.disableProperty().bind(checkboxGenerateBitmapFile.selectedProperty().not()); hboxGenerateTextFile.disableProperty().bind(checkboxGenerateTextFile.selectedProperty().not()); fileChooserOpenConfiguration = new FileChooser(); fileChooserOpenConfiguration.setTitle("Choose configuration file"); fileChooserSaveConfiguration = new FileChooserContext("cfg.xml"); fileChooserSaveConfiguration.fc.setTitle("Choose output file"); fileChooserOpenInputFileALS = new FileChooser(); fileChooserOpenInputFileALS.setTitle("Open input file"); fileChooserOpenInputFileALS.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Shot files", "*.sht"), new ExtensionFilter("Text Files", "*.txt"), new ExtensionFilter("Las Files", "*.las", "*.laz")); fileChooserOpenTrajectoryFileALS = new FileChooser(); fileChooserOpenTrajectoryFileALS.setTitle("Open trajectory file"); fileChooserOpenTrajectoryFileALS.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Text Files", "*.txt")); fileChooserOpenOutputFileALS = new FileChooser(); fileChooserOpenOutputFileALS.setTitle("Choose output file"); fileChooserOpenInputFileTLS = new FileChooserContext(); fileChooserOpenInputFileTLS.fc.setTitle("Open input file"); fileChooserOpenInputFileTLS.fc.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Text Files", "*.txt"), new ExtensionFilter("Rxp Files", "*.rxp"), new ExtensionFilter("Project Rsp Files", "*.rsp")); directoryChooserOpenOutputPathTLS = new DirectoryChooser(); directoryChooserOpenOutputPathTLS.setTitle("Choose output path"); directoryChooserOpenOutputPathALS = new DirectoryChooser(); directoryChooserOpenOutputPathALS.setTitle("Choose output path"); fileChooserSaveOutputFileTLS = new FileChooser(); fileChooserSaveOutputFileTLS.setTitle("Save voxel file"); fileChooserSaveTransmittanceTextFile = new FileChooser(); fileChooserSaveTransmittanceTextFile.setTitle("Save text file"); directoryChooserSaveTransmittanceBitmapFile = new DirectoryChooser(); directoryChooserSaveTransmittanceBitmapFile.setTitle("Choose output directory"); fileChooserSaveHemiPhotoOutputBitmapFile = new FileChooserContext("*.png"); fileChooserSaveHemiPhotoOutputBitmapFile.fc.setTitle("Save bitmap file"); directoryChooserSaveHemiPhotoOutputBitmapFile = new DirectoryChooser(); directoryChooserSaveHemiPhotoOutputBitmapFile.setTitle("Choose bitmap files output directory"); directoryChooserSaveHemiPhotoOutputTextFile = new DirectoryChooser(); directoryChooserSaveHemiPhotoOutputTextFile.setTitle("Choose text files output directory"); fileChooserSaveHemiPhotoOutputTextFile = new FileChooser(); fileChooserSaveHemiPhotoOutputTextFile.setTitle("Save text file"); fileChooserOpenVoxelFile = new FileChooser(); fileChooserOpenVoxelFile.setTitle("Open voxel file"); fileChooserOpenVoxelFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Voxel Files", "*.vox")); fileChooserOpenPopMatrixFile = new FileChooser(); fileChooserOpenPopMatrixFile.setTitle("Choose matrix file"); fileChooserOpenPopMatrixFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Text Files", "*.txt")); fileChooserOpenSopMatrixFile = new FileChooser(); fileChooserOpenSopMatrixFile.setTitle("Choose matrix file"); fileChooserOpenSopMatrixFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Text Files", "*.txt")); fileChooserOpenVopMatrixFile = new FileChooser(); fileChooserOpenVopMatrixFile.setTitle("Choose matrix file"); fileChooserOpenVopMatrixFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Text Files", "*.txt")); fileChooserOpenPonderationFile = new FileChooser(); fileChooserOpenPonderationFile.setTitle("Choose ponderation file"); fileChooserOpenPonderationFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Text Files", "*.txt")); fileChooserOpenDTMFile = new FileChooser(); fileChooserOpenDTMFile.setTitle("Choose DTM file"); fileChooserOpenDTMFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("DTM Files", "*.asc")); fileChooserOpenPointCloudFile = new FileChooser(); fileChooserOpenPointCloudFile.setTitle("Choose point cloud file"); fileChooserOpenPointCloudFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("TXT Files", "*.txt")); fileChooserOpenMultiResVoxelFile = new FileChooser(); fileChooserOpenMultiResVoxelFile.setTitle("Choose voxel file"); fileChooserOpenMultiResVoxelFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Voxel Files", "*.vox")); fileChooserOpenOutputFileMultiRes = new FileChooser(); fileChooserOpenOutputFileMultiRes.setTitle("Save voxel file"); fileChooserAddTask = new FileChooser(); fileChooserAddTask.setTitle("Choose parameter file"); fileChooserAddTask.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("XML Files", "*.xml")); fileChooserSaveDartFile = new FileChooser(); fileChooserSaveDartFile.setTitle("Save dart file (.maket)"); fileChooserSaveDartFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Maket File", "*.maket")); fileChooserOpenOutputFileMerging = new FileChooser(); fileChooserOpenOutputFileMerging.setTitle("Choose voxel file"); fileChooserOpenOutputFileMerging.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("Voxel Files", "*.vox")); fileChooserOpenScriptFile = new FileChooser(); fileChooserOpenScriptFile.setTitle("Choose script file"); fileChooserSaveGroundEnergyOutputFile = new FileChooser(); fileChooserSaveGroundEnergyOutputFile.setTitle("Save ground energy file"); fileChooserOpenPointsPositionFile = new FileChooser(); fileChooserOpenPointsPositionFile.setTitle("Choose points file"); fileChooserOpenPointsPositionFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"), new ExtensionFilter("TXT Files", "*.txt")); try { viewCapsSetupFrame = new Stage(); FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/ViewCapsSetupFrame.fxml")); Parent root = loader.load(); viewCapsSetupFrameController = loader.getController(); viewCapsSetupFrame.setScene(new Scene(root)); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } try { FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/FilteringPaneComponent.fxml")); anchorPaneEchoFilteringRxp = loader.load(); filteringPaneController = loader.getController(); filteringPaneController.setFiltersNames("Reflectance", "Amplitude", "Deviation"); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } try { positionImporterFrame = new Stage(); FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/PositionImporterFrame.fxml")); Parent root = loader.load(); positionImporterFrameController = loader.getController(); positionImporterFrame.setScene(new Scene(root)); positionImporterFrameController.setStage(positionImporterFrame); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } try { voxelSpaceCroppingFrame = new Stage(); FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/VoxelSpaceCroppingFrame.fxml")); Parent root = loader.load(); voxelSpaceCroppingFrameController = loader.getController(); voxelSpaceCroppingFrame.setScene(new Scene(root)); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } try { attributsImporterFrame = new Stage(); FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/AttributsImporterFrame.fxml")); Parent root = loader.load(); attributsImporterFrameController = loader.getController(); attributsImporterFrame.setScene(new Scene(root)); attributsImporterFrameController.setStage(attributsImporterFrame); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } try { textFileParserFrameController = TextFileParserFrameController.getInstance(); } catch (Exception ex) { logger.error("Cannot load fxml file", ex); } try { transformationFrameController = TransformationFrameController.getInstance(); transformationFrame = transformationFrameController.getStage(); } catch (Exception ex) { logger.error("Cannot load fxml file", ex); } updaterFrame = new Stage(); try { FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/update/UpdaterFrame.fxml")); Parent root = loader.load(); updaterFrameController = loader.getController(); updaterFrame.setScene(new Scene(root)); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } riscanProjectExtractor = new RiscanProjectExtractor(); ptxProjectExtractor = new PTXProjectExtractor(); ptgProjectExtractor = new PTGProjectExtractor(); dateChooserFrame = new Stage(); try { FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/DateChooserFrame.fxml")); Parent root = loader.load(); dateChooserFrameController = loader.getController(); dateChooserFrame.setScene(new Scene(root)); dateChooserFrameController.setStage(dateChooserFrame); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } comboboxModeALS.getItems().addAll(RS_STR_INPUT_TYPE_LAS, RS_STR_INPUT_TYPE_LAZ, /*RS_STR_INPUT_TYPE_XYZ, */RS_STR_INPUT_TYPE_SHOTS); comboboxModeALS.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { if (newValue.equals(RS_STR_INPUT_TYPE_SHOTS)) { alsVoxValidationSupport.registerValidator(textFieldTrajectoryFileALS, false, Validators.unregisterValidator); } else { alsVoxValidationSupport.registerValidator(textFieldTrajectoryFileALS, false, Validators.fileExistValidator); } } }); comboboxModeTLS.getItems().setAll("Rxp scan", "Rsp project", "PTX", "PTG"/*, RS_STR_INPUT_TYPE_XYZ, RS_STR_INPUT_TYPE_SHOTS*/); comboboxGroundEnergyOutputFormat.getItems().setAll("txt", "png"); comboboxLaserSpecification.getItems().addAll(LaserSpecification.getPresets()); comboboxLaserSpecification.getSelectionModel().selectedItemProperty() .addListener(new ChangeListener<LaserSpecification>() { @Override public void changed(ObservableValue<? extends LaserSpecification> observable, LaserSpecification oldValue, LaserSpecification newValue) { DecimalFormatSymbols symb = new DecimalFormatSymbols(); symb.setDecimalSeparator('.'); DecimalFormat formatter = new DecimalFormat("#####.######", symb); textFieldBeamDiameterAtExit.setText(formatter.format(newValue.getBeamDiameterAtExit())); textFieldBeamDivergence.setText(formatter.format(newValue.getBeamDivergence())); } }); comboboxLaserSpecification.getSelectionModel().select(LaserSpecification.LMS_Q560); comboboxLaserSpecification.disableProperty().bind(checkboxCustomLaserSpecification.selectedProperty()); textFieldBeamDiameterAtExit.disableProperty() .bind(checkboxCustomLaserSpecification.selectedProperty().not()); textFieldBeamDivergence.disableProperty().bind(checkboxCustomLaserSpecification.selectedProperty().not()); listViewProductsFiles.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); listViewProductsFiles.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { int size = listViewProductsFiles.getSelectionModel().getSelectedIndices().size(); if (size == 1) { viewer3DPanelController .updateCurrentVoxelFile(listViewProductsFiles.getSelectionModel().getSelectedItem()); } } }); listViewTaskList.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { int size = listViewTaskList.getSelectionModel().getSelectedIndices().size(); if (size == 1) { buttonLoadSelectedTask.setDisable(false); } else { buttonLoadSelectedTask.setDisable(true); } buttonExecute.setDisable(size == 0); } }); resetMatrices(); calculateMatrixFrame = new Stage(); try { FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/CalculateMatrixFrame.fxml")); Parent root = loader.load(); calculateMatrixFrameController = loader.getController(); calculateMatrixFrameController.setStage(calculateMatrixFrame); Scene scene = new Scene(root); calculateMatrixFrame.setScene(scene); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } filterFrame = new Stage(); try { FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/FilterFrame.fxml")); Parent root = loader.load(); filterFrameController = loader.getController(); filterFrameController.setStage(filterFrame); filterFrameController.setFilters("Angle"); filterFrame.setScene(new Scene(root)); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } try { FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/export/ObjExporterDialog.fxml")); Parent root = loader.load(); objExporterController = loader.getController(); Stage s = new Stage(); objExporterController.setStage(s); s.setScene(new Scene(root)); } catch (IOException ex) { logger.error("Cannot load fxml file", ex); } textFieldResolution.textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { voxelSpacePanelVoxelizationController.setResolution(Float.valueOf(newValue)); } }); textFieldResolution.textProperty().addListener(voxelSpacePanelVoxelizationController.getChangeListener()); checkboxUseDTMFilter.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (checkboxUseDTMFilter.isSelected()) { buttonOpenDTMFile.setDisable(false); textfieldDTMPath.setDisable(false); textfieldDTMValue.setDisable(false); checkboxApplyVOPMatrix.setDisable(false); labelDTMValue.setDisable(false); labelDTMPath.setDisable(false); } else { buttonOpenDTMFile.setDisable(true); textfieldDTMPath.setDisable(true); textfieldDTMValue.setDisable(true); checkboxApplyVOPMatrix.setDisable(true); labelDTMValue.setDisable(true); labelDTMPath.setDisable(true); } } }); checkboxUseVopMatrix.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { buttonSetVOPMatrix.setDisable(!newValue); } }); checkboxUsePopMatrix.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue) { checkBoxUseDefaultPopMatrix.setDisable(false); buttonOpenPopMatrixFile.setDisable(false); } else { checkBoxUseDefaultPopMatrix.setDisable(true); buttonOpenPopMatrixFile.setDisable(true); } } }); checkboxUseSopMatrix.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue) { checkBoxUseDefaultSopMatrix.setDisable(false); buttonOpenSopMatrixFile.setDisable(false); } else { checkBoxUseDefaultSopMatrix.setDisable(true); buttonOpenSopMatrixFile.setDisable(true); } } }); checkboxCalculateGroundEnergy.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue) { anchorPaneGroundEnergyParameters.setDisable(false); } else { anchorPaneGroundEnergyParameters.setDisable(true); } } }); listviewRxpScans.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<LidarScan>() { @Override public void changed(ObservableValue<? extends LidarScan> observable, LidarScan oldValue, LidarScan newValue) { if (newValue != null) { sopMatrix = newValue.matrix; updateResultMatrix(); } } }); comboboxModeTLS.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { switch (newValue.intValue()) { case 1: case 2: case 3: listviewRxpScans.setDisable(false); checkboxMergeAfter.setDisable(false); textFieldMergedFileName.setDisable(false); disableSopMatrixChoice(false); labelTLSOutputPath.setText("Output path"); break; default: listviewRxpScans.setDisable(true); checkboxMergeAfter.setDisable(true); textFieldMergedFileName.setDisable(true); //disableSopMatrixChoice(true); labelTLSOutputPath.setText("Output file"); } if (newValue.intValue() == 0 || newValue.intValue() == 1) { checkboxEmptyShotsFilter.setDisable(false); } else { checkboxEmptyShotsFilter.setDisable(true); } } }); tabPaneVoxelisation.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { switch (newValue.intValue()) { case 1: disableSopMatrixChoice(false); disablePopMatrixChoice(false); checkboxEmptyShotsFilter.setDisable(false); break; default: disableSopMatrixChoice(true); disablePopMatrixChoice(true); checkboxEmptyShotsFilter.setDisable(true); } switch (newValue.intValue()) { case 0: checkboxCalculateGroundEnergy.setDisable(false); if (checkboxCalculateGroundEnergy.isSelected()) { anchorPaneGroundEnergyParameters.setDisable(true); checkboxCalculateGroundEnergy.setDisable(false); } anchorPaneEchoFiltering.getChildren().set(0, anchorPaneEchoFilteringClassifications); //anchorPaneEchoFilteringClassifications.setVisible(true); anchorpaneBoundingBoxParameters.setDisable(checkboxMultiFiles.isSelected()); hboxAutomaticBBox.setDisable(false); break; default: anchorPaneGroundEnergyParameters.setDisable(true); checkboxCalculateGroundEnergy.setDisable(true); anchorPaneEchoFiltering.getChildren().set(0, anchorPaneEchoFilteringRxp); //anchorPaneEchoFilteringClassifications.setVisible(false); anchorpaneBoundingBoxParameters.setDisable(false); hboxAutomaticBBox.setDisable(true); } } }); int availableCores = Runtime.getRuntime().availableProcessors(); sliderRSPCoresToUse.setMin(1); sliderRSPCoresToUse.setMax(availableCores); sliderRSPCoresToUse.setValue(availableCores); textFieldInputFileALS.setOnDragOver(DragAndDropHelper.dragOverEvent); textFieldTrajectoryFileALS.setOnDragOver(DragAndDropHelper.dragOverEvent); textFieldOutputFileALS.setOnDragOver(DragAndDropHelper.dragOverEvent); textFieldInputFileTLS.setOnDragOver(DragAndDropHelper.dragOverEvent); textFieldOutputFileMerging.setOnDragOver(DragAndDropHelper.dragOverEvent); textfieldDTMPath.setOnDragOver(DragAndDropHelper.dragOverEvent); textFieldOutputFileGroundEnergy.setOnDragOver(DragAndDropHelper.dragOverEvent); listViewTaskList.setOnDragOver(DragAndDropHelper.dragOverEvent); listViewProductsFiles.setOnDragOver(DragAndDropHelper.dragOverEvent); textfieldVoxelFilePathTransmittance.setOnDragOver(DragAndDropHelper.dragOverEvent); textfieldOutputTextFilePath.setOnDragOver(DragAndDropHelper.dragOverEvent); textfieldOutputBitmapFilePath.setOnDragOver(DragAndDropHelper.dragOverEvent); textFieldInputFileALS.setOnDragDropped(new EventHandler<DragEvent>() { @Override public void handle(DragEvent event) { Dragboard db = event.getDragboard(); boolean success = false; if (db.hasFiles() && db.getFiles().size() == 1) { success = true; for (File file : db.getFiles()) { if (file != null) { textFieldInputFileALS.setText(file.getAbsolutePath()); selectALSInputMode(file); } } } event.setDropCompleted(success); event.consume(); } }); textFieldTrajectoryFileALS.setOnDragDropped(new EventHandler<DragEvent>() { @Override public void handle(DragEvent event) { Dragboard db = event.getDragboard(); boolean success = false; if (db.hasFiles() && db.getFiles().size() == 1) { success = true; for (File file : db.getFiles()) { if (file != null) { onTrajectoryFileChoosed(file); } } } event.setDropCompleted(success); event.consume(); } }); textFieldInputFileTLS.setOnDragDropped(new EventHandler<DragEvent>() { @Override public void handle(DragEvent event) { Dragboard db = event.getDragboard(); boolean success = false; if (db.hasFiles() && db.getFiles().size() == 1) { success = true; for (File file : db.getFiles()) { if (file != null) { onInputFileTLSChoosed(file); } } } event.setDropCompleted(success); event.consume(); } }); setDragDroppedSingleFileEvent(textFieldOutputFileALS); setDragDroppedSingleFileEvent(textFieldOutputFileMerging); setDragDroppedSingleFileEvent(textfieldDTMPath); setDragDroppedSingleFileEvent(textFieldOutputFileGroundEnergy); setDragDroppedSingleFileEvent(textfieldVoxelFilePathTransmittance); setDragDroppedSingleFileEvent(textfieldOutputTextFilePath); setDragDroppedSingleFileEvent(textfieldOutputBitmapFilePath); listViewTaskList.setOnDragDropped(new EventHandler<DragEvent>() { @Override public void handle(DragEvent event) { Dragboard db = event.getDragboard(); boolean success = false; if (db.hasFiles()) { success = true; for (File file : db.getFiles()) { addFileToTaskList(file); } } event.setDropCompleted(success); event.consume(); } }); listViewProductsFiles.setOnDragDropped(new EventHandler<DragEvent>() { @Override public void handle(DragEvent event) { Dragboard db = event.getDragboard(); boolean success = false; if (db.hasFiles()) { success = true; for (File file : db.getFiles()) { addFileToProductsList(file); } } event.setDropCompleted(success); event.consume(); } }); listViewProductsFiles.setOnDragDetected(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { Dragboard db = listViewProductsFiles.startDragAndDrop(TransferMode.COPY); ClipboardContent content = new ClipboardContent(); content.putFiles(listViewProductsFiles.getSelectionModel().getSelectedItems()); db.setContent(content); event.consume(); } }); addPointcloudFilterComponent(); checkboxUsePointcloudFilter.selectedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { hBoxPointCloudFiltering.setDisable(!newValue); ObservableList<Node> list = vBoxPointCloudFiltering.getChildren(); for (Node n : list) { if (n instanceof PointCloudFilterPaneComponent) { PointCloudFilterPaneComponent panel = (PointCloudFilterPaneComponent) n; panel.disableContent(!newValue); } } buttonAddPointcloudFilter.setDisable(!newValue); } }); //displayGThetaAllDistributions(); }