private Double angle;
private Double length;
+ private Double rotationAngle;
+ // In-line component
private Text lengthText;
+ // Turn component
private Text angleText;
+ // Rotated In-line, or turn conponent.
+ private Text rotationAngleText;
+ // Input for new PipeRun
private Double diameter;
private Double turnRadius;
private Text diameterText;
private Text turnRadiusText;
+ // Position selection
private Button startButton;
private Button middleButton;
private Button endButton;
startButton.setImage(resourceManager.createImage(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/insert_start.png")));
middleButton.setImage(resourceManager.createImage(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/insert_middle.png")));
endButton.setImage(resourceManager.createImage(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/insert_end.png")));
+ startButton.setToolTipText("Overlapping insert");
+ middleButton.setToolTipText("Cutting insert");
+ endButton.setToolTipText("Adding insert");
GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.TOP).applyTo(buttonComposite);
GridLayoutFactory.fillDefaults().numColumns(3).applyTo(buttonComposite);
label = new Label(composite, SWT.NONE);
label.setText("Angle");
angleText = new Text(composite, SWT.SINGLE|SWT.BORDER);
+ label = new Label(composite, SWT.NONE);
+ label.setText("Rotation angle");
+ rotationAngleText = new Text(composite, SWT.SINGLE|SWT.BORDER);
label = new Label(composite, SWT.NONE);
label.setText("Diameter");
lengthText.setEnabled(false);
angleText.setEnabled(false);
+ rotationAngleText.setEnabled(false);
turnRadiusText.setEnabled(false);
diameterText.setEnabled(false);
+
lengthText.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
}
});
+ rotationAngleText.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyReleased(KeyEvent e) {
+ try {
+ rotationAngle = Double.parseDouble(rotationAngleText.getText());
+ } catch (NumberFormatException err) {
+ rotationAngle = null;
+ }
+ validate();
+ }
+ });
+
diameterText.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.TOP).applyTo(lengthText);
GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.TOP).applyTo(angleText);
+ GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.TOP).applyTo(rotationAngleText);
GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.TOP).applyTo(diameterText);
GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.TOP).applyTo(turnRadiusText);
if (inlineSplit) {
lengthText.setEnabled(false);
angleText.setEnabled(false);
+ rotationAngleText.setEnabled(selected.isRotated());
ok = false;
} else {
lengthText.setEnabled(true);
angleText.setEnabled(false);
+ rotationAngleText.setEnabled(selected.isRotated());
if (length == null)
ok = false;
}
filterAllowed.add(PositionType.PREVIOUS);
lengthText.setEnabled(false);
angleText.setEnabled(true);
+ rotationAngleText.setEnabled(true);
if (angle == null)
ok = false;
} else {
- // this should not happen
+ // this should not happen, since end components should not have variable, or modifiable flag.
lengthText.setEnabled(false);
angleText.setEnabled(false);
+ rotationAngleText.setEnabled(false);
+
}
} else {
lengthText.setEnabled(false);
- angleText.setEnabled(false);
+ angleText.setEnabled(false);
+ rotationAngleText.setEnabled(selected.getType() == Type.TURN || selected.isRotated());
}
if (selected.isSizeChange()) {
return length;
}
+ public Double getRotationAngle() {
+ return rotationAngle;
+ }
+
public Double getDiameter() {
return diameter;
}
// Variable angle
public Double angle;
+
+ // Rotation angle used with turns and rotated inline.
+ public Double rotationAngle;
public String getTypeUri() {
return typeUri;
public void setAngle(Double angle) {
this.angle = angle;
}
+
+ public Double getRotationAngle() {
+ return rotationAngle;
+ }
+
+ public void setRotationAngle(Double rotationAngle) {
+ this.rotationAngle = rotationAngle;
+ }
}
newPcp.setLength(inst.length);
newComponent.setParameter("length", inst.length);
}
+ if (inst.rotationAngle != null)
+ ((InlineComponent) newComponent).setRotationAngle(inst.rotationAngle);
} else if (newComponent instanceof TurnComponent) {
TurnComponent turnComponent = (TurnComponent)newComponent;
if (turnComponent.isVariableAngle()) {
newPcp.setTurnAngle(inst.angle);
newComponent.setParameter("turnAngle", inst.angle);
}
+ if (inst.rotationAngle != null)
+ ((TurnComponent) newComponent).setRotationAngle(inst.rotationAngle);
}
+
newComponent.updateParameters();
Vector3d v = new Vector3d(dir);
PipingRules.addSizeChange(true, pipeRun, other, (InlineComponent)newComponent, toPcp, null);
}
newPcp.setWorldPosition(pos);
+
// TODO : chicken-egg problem
newComponent.updateParameters();
Vector3d v = new Vector3d(dir);
break;
}
newPcp.setWorldPosition(pos);
+ if (inst.rotationAngle != null)
+ ((InlineComponent) newComponent).setRotationAngle(inst.rotationAngle);
}