X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.plant3d%2Fsrc%2Forg%2Fsimantics%2Fplant3d%2Fscenegraph%2FEquipment.java;h=214b632fdde54657d89e16b3c4321e451615a6c6;hb=refs%2Fchanges%2F28%2F3328%2F1;hp=a27e9c50c5bbd01ce359ab108450566541c0d7ac;hpb=f36217aeeb09c0c46f99886ee99772156ce9cfe6;p=simantics%2F3d.git diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/Equipment.java b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/Equipment.java index a27e9c50..214b632f 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/Equipment.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/Equipment.java @@ -45,10 +45,10 @@ public class Equipment extends P3DParentGeometryNode { @RelatedElementsAdd(Plant3D.URIs.HasNozzle) public void addChild(Nozzle node) { - Collection children = getChild(); - if (numberOfFixedNozzles() > 0 && children.size() >= numberOfFixedNozzles()) - throw new RuntimeException("Equipment has already all fixed nozzles"); - + Collection children = getChild(); + if (numberOfFixedNozzles() > 0 && children.size() >= numberOfFixedNozzles()) + throw new RuntimeException("Equipment has already all fixed nozzles"); + Set ids = new HashSet(); for (Nozzle n : children) { ids.add(n.getNozzleId()); @@ -59,7 +59,7 @@ public class Equipment extends P3DParentGeometryNode { addNode(Plant3D.URIs.HasNozzle,node); node.setNozzleId(newId); if (fnp != null) - syncNozzles(); + syncNozzles(); } @RelatedElementsGet(Plant3D.URIs.HasNozzle) @@ -89,17 +89,17 @@ public class Equipment extends P3DParentGeometryNode { @Override public void setGeometry(GeometryProvider provider) { - super.setGeometry(provider); - if (provider instanceof FixedNozzleProvider) { - fnp = (FixedNozzleProvider)provider; - syncNozzles(); - } + super.setGeometry(provider); + if (provider instanceof FixedNozzleProvider) { + fnp = (FixedNozzleProvider)provider; + syncNozzles(); + } } public int numberOfFixedNozzles() { - if (fnp == null) - return 0; - return fnp.numberOfNozzles(); + if (fnp == null) + return 0; + return fnp.numberOfNozzles(); } /** @@ -108,19 +108,19 @@ public class Equipment extends P3DParentGeometryNode { * Note: this method does not create nozzles, just sets their positions and names. */ public void syncNozzles() { - if (fnp == null) - return; - updateParameters(); - int count = fnp.numberOfNozzles(); - List currentNozzles = getNodes(); - for (int i = 0; i < count; i++) { - if (i < currentNozzles.size()) { - Nozzle nozzle = currentNozzles.get(i); - nozzle.setName(fnp.getNozzleName(i)); - fnp.updateNozzlePosition(i, nozzle); - nozzle.setFixed(true); - } - } + if (fnp == null) + return; + updateParameters(); + int count = fnp.numberOfNozzles(); + List currentNozzles = getNodes(); + for (int i = 0; i < count; i++) { + if (i < currentNozzles.size()) { + Nozzle nozzle = currentNozzles.get(i); + nozzle.setName(fnp.getNozzleName(i)); + fnp.updateNozzlePosition(i, nozzle); + nozzle.setFixed(true); + } + } } @Override