private Double length;
private Double angle;
private Double length;
private Double angle;
+ private Double rotationAngle;
private Double diameter;
private Double turnRadius;
private Double diameter;
private Double turnRadius;
this.lengthAdjustable = dialog.isLenghtAdjustable();
this.length = dialog.getLength();
this.angle = dialog.getAngle();
this.lengthAdjustable = dialog.isLenghtAdjustable();
this.length = dialog.getLength();
this.angle = dialog.getAngle();
+ this.rotationAngle = dialog.getRotationAngle();
this.diameter = dialog.getDiameter();
this.turnRadius = dialog.getTurnRadius();
allowed = dialog.filterAllowed();
this.diameter = dialog.getDiameter();
this.turnRadius = dialog.getTurnRadius();
allowed = dialog.filterAllowed();
inst.length = length;
inst.turnRadius = turnRadius;
inst.insertPosition = insertPosition;
inst.length = length;
inst.turnRadius = turnRadius;
inst.insertPosition = insertPosition;
+ inst.rotationAngle = rotationAngle;
inst.position = position;
ComponentUtils.addComponent(root, component, inst);
} catch (Exception e) {
inst.position = position;
ComponentUtils.addComponent(root, component, inst);
} catch (Exception e) {
private Double angle;
private Double length;
private Double angle;
private Double length;
+ private Double rotationAngle;
+ // 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;
private Double diameter;
private Double turnRadius;
private Text diameterText;
private Text turnRadiusText;
private Button startButton;
private Button middleButton;
private Button endButton;
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.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);
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("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");
label = new Label(composite, SWT.NONE);
label.setText("Diameter");
lengthText.setEnabled(false);
angleText.setEnabled(false);
lengthText.setEnabled(false);
angleText.setEnabled(false);
+ rotationAngleText.setEnabled(false);
turnRadiusText.setEnabled(false);
diameterText.setEnabled(false);
turnRadiusText.setEnabled(false);
diameterText.setEnabled(false);
lengthText.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
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) {
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(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);
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);
if (inlineSplit) {
lengthText.setEnabled(false);
angleText.setEnabled(false);
+ rotationAngleText.setEnabled(selected.isRotated());
ok = false;
} else {
lengthText.setEnabled(true);
angleText.setEnabled(false);
ok = false;
} else {
lengthText.setEnabled(true);
angleText.setEnabled(false);
+ rotationAngleText.setEnabled(selected.isRotated());
if (length == null)
ok = false;
}
if (length == null)
ok = false;
}
filterAllowed.add(PositionType.PREVIOUS);
lengthText.setEnabled(false);
angleText.setEnabled(true);
filterAllowed.add(PositionType.PREVIOUS);
lengthText.setEnabled(false);
angleText.setEnabled(true);
+ rotationAngleText.setEnabled(true);
if (angle == null)
ok = false;
} else {
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);
lengthText.setEnabled(false);
angleText.setEnabled(false);
+ rotationAngleText.setEnabled(false);
+
}
} else {
lengthText.setEnabled(false);
}
} else {
lengthText.setEnabled(false);
- angleText.setEnabled(false);
+ angleText.setEnabled(false);
+ rotationAngleText.setEnabled(selected.getType() == Type.TURN || selected.isRotated());
}
if (selected.isSizeChange()) {
}
if (selected.isSizeChange()) {
+ public Double getRotationAngle() {
+ return rotationAngle;
+ }
+
public Double getDiameter() {
return diameter;
}
public Double getDiameter() {
return diameter;
}
if (controlPoint.getRotationAngle() != null && Math.abs(controlPoint.getRotationAngle()-angle) < MathTools.NEAR_ZERO)
return;
controlPoint.setRotationAngle(angle);
if (controlPoint.getRotationAngle() != null && Math.abs(controlPoint.getRotationAngle()-angle) < MathTools.NEAR_ZERO)
return;
controlPoint.setRotationAngle(angle);
- try {
- PipingRules.requestUpdate(getControlPoint());
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ PipingRules.requestUpdate(getControlPoint());
+
}
@RelatedGetValue(Plant3D.URIs.IsReversed)
}
@RelatedGetValue(Plant3D.URIs.IsReversed)
return;
}
controlPoint.setReversed(reverse);
return;
}
controlPoint.setReversed(reverse);
- try {
- PipingRules.requestUpdate(getControlPoint());
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ PipingRules.requestUpdate(getControlPoint());
@GetPropertyValue(name="Rotation Angle",tabId="Debug",value="rotationAngle")
public Double getRotationAngle() {
@GetPropertyValue(name="Rotation Angle",tabId="Debug",value="rotationAngle")
public Double getRotationAngle() {
+ if (isRotate || asFixedAngle())
return rotationAngle;
return null;
}
return rotationAngle;
return null;
}
// Variable angle
public Double angle;
// Variable angle
public Double angle;
+
+ // Rotation angle used with turns and rotated inline.
+ public Double rotationAngle;
public String getTypeUri() {
return typeUri;
public String getTypeUri() {
return typeUri;
public void setAngle(Double angle) {
this.angle = angle;
}
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);
}
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);
}
} 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);
newComponent.updateParameters();
Vector3d v = new Vector3d(dir);
PipingRules.addSizeChange(true, pipeRun, other, (InlineComponent)newComponent, toPcp, null);
}
newPcp.setWorldPosition(pos);
PipingRules.addSizeChange(true, pipeRun, other, (InlineComponent)newComponent, toPcp, null);
}
newPcp.setWorldPosition(pos);
// TODO : chicken-egg problem
newComponent.updateParameters();
Vector3d v = new Vector3d(dir);
// TODO : chicken-egg problem
newComponent.updateParameters();
Vector3d v = new Vector3d(dir);
break;
}
newPcp.setWorldPosition(pos);
break;
}
newPcp.setWorldPosition(pos);
+ if (inst.rotationAngle != null)
+ ((InlineComponent) newComponent).setRotationAngle(inst.rotationAngle);
private boolean variable = false;
private boolean modifiable = false;
private boolean sizeChange = false;
private boolean variable = false;
private boolean modifiable = false;
private boolean sizeChange = false;
+ private boolean rotated = false;
public Item(String type, String name) {
public Item(String type, String name) {
public void setSizeChange(boolean sizeChange) {
this.sizeChange = sizeChange;
}
public void setSizeChange(boolean sizeChange) {
this.sizeChange = sizeChange;
}
+
+ public boolean isRotated() {
+ return rotated;
+ }
+
+ public void setRotated(boolean rotated) {
+ this.rotated = rotated;
+ }
item.setModifiable(true);
if (graph.hasStatement(r, p3d.SizeChangeComponent))
item.setSizeChange(true);
item.setModifiable(true);
if (graph.hasStatement(r, p3d.SizeChangeComponent))
item.setSizeChange(true);
+ if (graph.hasStatement(r, p3d.RotateComponent))
+ item.setRotated(true);