You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2018/06/18 21:02:26 UTC

[sis] 04/33: Remove the "Longitude first" checkbox from CRSChooser - this is not the right widget were to provide this choice.

This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 3e98214cd197f2d39575189e0468d7e9ead2707e
Author: Martin Desruisseaux <de...@apache.org>
AuthorDate: Sat May 26 14:25:31 2018 +0000

    Remove the "Longitude first" checkbox from CRSChooser - this is not the right widget were to provide this choice.
    
    
    git-svn-id: https://svn.apache.org/repos/asf/sis/branches/JDK8@1832312 13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/sis/gui/referencing/CRSChooser.java | 45 ++------------------
 .../org/apache/sis/internal/gui/Resources.java     |  6 ---
 .../apache/sis/internal/gui/Resources.properties   |  2 -
 .../sis/internal/gui/Resources_fr.properties       |  2 -
 .../org/apache/sis/gui/referencing/CRSChooser.fxml | 48 ++++++++++------------
 5 files changed, 25 insertions(+), 78 deletions(-)

diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/CRSChooser.java b/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/CRSChooser.java
index 3aeede0..a4b8901 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/CRSChooser.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/CRSChooser.java
@@ -22,30 +22,22 @@ import java.io.UncheckedIOException;
 import javafx.beans.property.ObjectProperty;
 import javafx.beans.property.SimpleObjectProperty;
 import javafx.beans.value.ObservableValue;
-import javafx.collections.FXCollections;
 import javafx.fxml.FXML;
 import javafx.scene.control.Alert;
 import javafx.scene.control.ButtonType;
-import javafx.scene.control.CheckBox;
-import javafx.scene.control.ChoiceBox;
 import javafx.scene.control.DialogPane;
 import javafx.scene.control.TextField;
 import javafx.scene.input.KeyEvent;
 import javafx.scene.layout.BorderPane;
-import org.opengis.util.FactoryException;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.apache.sis.internal.gui.FXUtilities;
-import org.apache.sis.referencing.crs.DefaultGeographicCRS;
-import org.apache.sis.referencing.cs.AxesConvention;
-import org.apache.sis.referencing.CRS;
-import org.apache.sis.referencing.IdentifiedObjects;
-import org.apache.sis.referencing.crs.AbstractCRS;
 
 
 /**
- * Widget configuration panel used to select a {@link CoordinateReferenceSystem}.
+ * A list of Coordinate Reference Systems (CRS) from which the user can select.
  *
  * @author  Johann Sorel (Geomatys)
+ * @author  Martin Desruisseaux (Geomatys)
  * @version 1.0
  * @since   1.0
  * @module
@@ -53,15 +45,10 @@ import org.apache.sis.referencing.crs.AbstractCRS;
 public class CRSChooser extends BorderPane {
 
     @FXML
-    private CheckBox uiLongFirst;
-    @FXML
-    private CheckBox uiAxisConv;
-    @FXML
     private BorderPane uiPane;
+
     @FXML
     private TextField uiSearch;
-    @FXML
-    private ChoiceBox<AxesConvention> uiChoice;
 
     private CRSTable uiTable;
 
@@ -96,30 +83,6 @@ public class CRSChooser extends BorderPane {
                 updateText = false;
             }
         });
-
-        uiChoice.setItems(FXCollections.observableArrayList(AxesConvention.values()));
-
-    }
-
-    private CoordinateReferenceSystem getCorrectedCRS(){
-        CoordinateReferenceSystem crs = crsProperty.get();
-        if (crs == null) return null;
-
-        try {
-            Integer epsg = IdentifiedObjects.lookupEPSG(crs);
-            if (epsg != null) {
-                crs = CRS.forCode("EPSG:" + epsg);
-                if (uiLongFirst.isSelected()) {
-                    crs = AbstractCRS.castOrCopy(crs).forConvention(AxesConvention.RIGHT_HANDED);
-                }
-            }
-        } catch (FactoryException ex) {
-            // TODO
-        }
-        if (uiAxisConv.isSelected() && crs instanceof DefaultGeographicCRS && uiChoice.getValue() != null) {
-            crs = ((DefaultGeographicCRS) crs).forConvention(uiChoice.getValue());
-        }
-        return crs;
     }
 
     /**
@@ -149,6 +112,6 @@ public class CRSChooser extends BorderPane {
         alert.getButtonTypes().setAll(ButtonType.OK,ButtonType.CANCEL);
         alert.setResizable(true);
         final ButtonType res = alert.showAndWait().orElse(ButtonType.CANCEL);
-        return res == ButtonType.CANCEL ? null : chooser.getCorrectedCRS();
+        return res == ButtonType.CANCEL ? null : chooser.crsProperty.get();
     }
 }
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Resources.java b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Resources.java
index 8eda591..9cf419b 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Resources.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Resources.java
@@ -56,9 +56,6 @@ public final class Resources extends IndexedResourceBundle {
         private Keys() {
         }
 
-        /**
-         * Axis convention
-         */
         public static final short AxisConvention = 3;
 
         /**
@@ -76,9 +73,6 @@ public final class Resources extends IndexedResourceBundle {
          */
         public static final short Description = 2;
 
-        /**
-         * Longitude first
-         */
         public static final short LongitudeFirst = 5;
     }
 
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Resources.properties b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Resources.properties
index 6ce5fb7..61b64ed 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Resources.properties
+++ b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Resources.properties
@@ -23,5 +23,3 @@
 Code            = Code
 Description     = Description
 CRS             = CRS
-LongitudeFirst  = Longitude first
-AxisConvention  = Axis convention
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Resources_fr.properties b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Resources_fr.properties
index 878ee29..b7a20f2 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Resources_fr.properties
+++ b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Resources_fr.properties
@@ -28,5 +28,3 @@
 Code            = Code
 Description     = Description
 CRS             = CRS
-LongitudeFirst  = Longitude en premier
-AxisConvention  = Convention
diff --git a/application/sis-javafx/src/main/resources/org/apache/sis/gui/referencing/CRSChooser.fxml b/application/sis-javafx/src/main/resources/org/apache/sis/gui/referencing/CRSChooser.fxml
index cb22507..0e6587f 100644
--- a/application/sis-javafx/src/main/resources/org/apache/sis/gui/referencing/CRSChooser.fxml
+++ b/application/sis-javafx/src/main/resources/org/apache/sis/gui/referencing/CRSChooser.fxml
@@ -6,31 +6,25 @@
 <?import javafx.scene.layout.*?>
 
 <fx:root maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" type="BorderPane" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
-   <top>
-      <GridPane hgap="10.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" vgap="10.0" BorderPane.alignment="CENTER">
-        <columnConstraints>
-          <ColumnConstraints hgrow="NEVER" />
-          <ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" />
-            <ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="10.0" prefWidth="100.0" />
-        </columnConstraints>
-        <rowConstraints>
-            <RowConstraints vgrow="NEVER" />
-            <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="NEVER" />
-            <RowConstraints vgrow="NEVER" />
-        </rowConstraints>
-         <children>
-            <Label styleClass="property-key" text="%CRS" GridPane.rowSpan="2" />
-            <CheckBox fx:id="uiLongFirst" maxWidth="1.7976931348623157E308" mnemonicParsing="false" styleClass="property-key" text="%LongitudeFirst" GridPane.columnIndex="1" GridPane.columnSpan="2" GridPane.halignment="LEFT" />
-            <TextField fx:id="uiSearch" GridPane.columnSpan="3" GridPane.rowIndex="2" />
-            <CheckBox fx:id="uiAxisConv" mnemonicParsing="false" text="%AxisConvention" GridPane.columnIndex="1" GridPane.rowIndex="1" />
-            <ChoiceBox fx:id="uiChoice" prefWidth="150.0" GridPane.columnIndex="2" GridPane.rowIndex="1" />
-         </children>
-         <BorderPane.margin>
-            <Insets bottom="10.0" left="10.0" right="10.0" />
-         </BorderPane.margin>
-      </GridPane>
-   </top>
-   <center>
-      <BorderPane fx:id="uiPane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" BorderPane.alignment="CENTER" />
-   </center>
+  <top>
+    <GridPane hgap="10.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" vgap="10.0" BorderPane.alignment="CENTER">
+      <columnConstraints>
+        <ColumnConstraints hgrow="NEVER" />
+        <ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" />
+        <ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="10.0" prefWidth="100.0" />
+      </columnConstraints>
+      <rowConstraints>
+        <RowConstraints vgrow="NEVER" />
+        <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="NEVER" />
+        <RowConstraints vgrow="NEVER" />
+      </rowConstraints>
+      <children>
+        <Label styleClass="property-key" text="%CRS" GridPane.rowSpan="2" />
+        <TextField fx:id="uiSearch" GridPane.columnSpan="3" GridPane.rowIndex="2" />
+       </children>
+    </GridPane>
+  </top>
+  <center>
+    <BorderPane fx:id="uiPane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" BorderPane.alignment="CENTER" />
+  </center>
 </fx:root>