private String libUri;
+ private double lengthFactor = 1.0;
+
public AddComponentAction(InteractiveVtkComposite panel, P3DRootNode root, String libUri) {
super(panel);
this.root = root;
this.libUri = libUri;
}
+ public void setLengthFactor(double lengthFactor) {
+ this.lengthFactor = lengthFactor;
+ }
+
public void setComponent(PipelineComponent component) {
this.component = component;
// Set list of already reserved component names
dialog.addUsedNames(ComponentUtils.getPipelineComponentNames(root));
+ dialog.setLengthFactor(lengthFactor);
if (dialog.open() == ComponentSelectionDialog.CANCEL)
return;
private static final String DIALOG = "ComponentSelectionDialog"; //$NON-NLS-1$
private IDialogSettings dialogSettings;
+
+ private double lengthFactor = 1.0;
private ResourceManager resourceManager;
if (dialogSettings == null)
dialogSettings = settings.addNewSection(DIALOG);
}
+
+ public void setLengthFactor(double lengthFactor) {
+ this.lengthFactor = lengthFactor;
+ }
@Override
protected IDialogSettings getDialogBoundsSettings() {
@Override
public void keyReleased(KeyEvent e) {
try {
- length = Double.parseDouble(lengthText.getText());
+ length = Double.parseDouble(lengthText.getText()) / lengthFactor;
} catch (NumberFormatException err) {
length = null;
}
@Override
public void keyReleased(KeyEvent e) {
try {
- diameter = Double.parseDouble(diameterText.getText());
+ diameter = Double.parseDouble(diameterText.getText()) / lengthFactor;
} catch (NumberFormatException err) {
diameter = null;
}
@Override
public void keyReleased(KeyEvent e) {
try {
- turnRadius = Double.parseDouble(turnRadiusText.getText());
+ turnRadius = Double.parseDouble(turnRadiusText.getText()) / lengthFactor;
} catch (NumberFormatException err) {
turnRadius = null;
}