private boolean isSelectedProfileModified() { final ProfileItem profileItem = getSelectedProfileItem(); final String[] profileRgbaExpressions = profileItem.getProfile().getRgbaExpressions(); final String[] userRgbaExpressions = getRgbaExpressions(); for (int i = 0; i < profileRgbaExpressions.length; i++) { final String userRgbaExpression = userRgbaExpressions[i]; final String profileRgbaExpression = profileRgbaExpressions[i]; if (!profileRgbaExpression.equals(userRgbaExpression)) { return true; } } return false; }
return; String[] rgbaExpressions = getRgbaExpressions(); Set<Integer> productRefs = new HashSet<>(); for (String expression : rgbaExpressions) {
private void onRgbaExpressionChanged() { if (settingRgbaExpressions) { return; } final ProfileItem profileItem = getSelectedProfileItem(); if (profileItem != null) { if (isSelectedProfileModified()) { profileBox.revalidate(); profileBox.repaint(); } } final String[] rgbaExpressions = getRgbaExpressions(); final int defaultProductIndex = ArrayUtils.getElementIndex(product, openedProducts); try { if (!BandArithmetic.areRastersEqualInSize(openedProducts, defaultProductIndex, rgbaExpressions)) { referencedRastersAreCompatibleLabel.setText("Referenced rasters are not of the same size"); referencedRastersAreCompatibleLabel.setForeground(warnMsgColor); } else { referencedRastersAreCompatibleLabel.setText("Expressions are valid"); referencedRastersAreCompatibleLabel.setForeground(okMsgColor); } } catch (ParseException e) { referencedRastersAreCompatibleLabel.setText("Expressions are invalid"); referencedRastersAreCompatibleLabel.setForeground(warnMsgColor); } updateUIState(); }
public void openProductSceneViewRGB(Product rgbProduct, final String helpId) { final Product[] openedProducts = SnapApp.getDefault().getProductManager().getProducts(); final int[] defaultBandIndices = getDefaultBandIndices(rgbProduct); final RGBImageProfilePane profilePane = new RGBImageProfilePane(SnapApp.getDefault().getPreferencesPropertyMap(), rgbProduct, openedProducts, defaultBandIndices); final String title = "Select RGB-Image Channels"; final boolean ok = profilePane.showDialog(SnapApp.getDefault().getMainFrame(), title, helpId); if (!ok) { return; } final String[] rgbaExpressions = profilePane.getRgbaExpressions(); if (profilePane.getStoreProfileInProduct()) { RGBImageProfile.storeRgbaExpressions(rgbProduct, rgbaExpressions); } final String sceneName = createSceneName(rgbProduct, profilePane.getSelectedProfile(), "RGB"); openProductSceneViewRGB(sceneName, rgbProduct, rgbaExpressions); }