]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.plant3d/src/org/simantics/plant3d/dialog/ComponentSelectionDialog.java
Added a length scaling factor for adding components
[simantics/3d.git] / org.simantics.plant3d / src / org / simantics / plant3d / dialog / ComponentSelectionDialog.java
index 720d88cec826729ba748870ace5a4acb7472b02a..35e761ccfa6eb436071352e6721b192e67255f76 100644 (file)
@@ -53,6 +53,8 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange
        private static final String DIALOG = "ComponentSelectionDialog"; //$NON-NLS-1$
 
        private IDialogSettings dialogSettings;
+       
+       private double lengthFactor = 1.0;
 
        private ResourceManager resourceManager;
 
@@ -126,6 +128,10 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange
                if (dialogSettings == null)
                        dialogSettings = settings.addNewSection(DIALOG);
        }
+       
+       public void setLengthFactor(double lengthFactor) {
+               this.lengthFactor = lengthFactor;
+       }
 
        @Override
        protected IDialogSettings getDialogBoundsSettings() {
@@ -317,7 +323,7 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange
                        @Override
                        public void keyReleased(KeyEvent e) {
                                try {
-                                       length = Double.parseDouble(lengthText.getText());
+                                       length = Double.parseDouble(lengthText.getText()) / lengthFactor;
                                } catch (NumberFormatException err) {
                                        length = null;
                                }
@@ -353,7 +359,7 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange
                        @Override
                        public void keyReleased(KeyEvent e) {
                                try {
-                                       diameter = Double.parseDouble(diameterText.getText());
+                                       diameter = Double.parseDouble(diameterText.getText()) / lengthFactor;
                                } catch (NumberFormatException err) {
                                        diameter = null;
                                }
@@ -365,7 +371,7 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange
                        @Override
                        public void keyReleased(KeyEvent e) {
                                try {
-                                       turnRadius = Double.parseDouble(turnRadiusText.getText());
+                                       turnRadius = Double.parseDouble(turnRadiusText.getText()) / lengthFactor;
                                } catch (NumberFormatException err) {
                                        turnRadius = null;
                                }