X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.plant3d%2Fsrc%2Forg%2Fsimantics%2Fplant3d%2Futils%2FP3DUtil.java;h=e5d1768a2c85da2cf2cdcb9bdcfbea36e6216c1e;hb=53d55c24c779745f188bdb18d32f71d20acb61b2;hp=0d656b054de0e724e72d4592597fa46aa52b4a17;hpb=f36217aeeb09c0c46f99886ee99772156ce9cfe6;p=simantics%2F3d.git diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/utils/P3DUtil.java b/org.simantics.plant3d/src/org/simantics/plant3d/utils/P3DUtil.java index 0d656b05..e5d1768a 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/utils/P3DUtil.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/utils/P3DUtil.java @@ -23,10 +23,10 @@ import org.simantics.plant3d.scenegraph.controlpoint.PipingRules; import org.simantics.plant3d.utils.Item.Type; public class P3DUtil { - - public static List getEquipments() throws DatabaseException { - return getEquipments(Plant3D.URIs.Builtin); - } + + public static List getEquipments() throws DatabaseException { + return getEquipments(Plant3D.URIs.Builtin); + } public static List getEquipments(final String libUri) throws DatabaseException { return Simantics.getSession().syncRequest(new Read>() { @@ -74,17 +74,17 @@ public class P3DUtil { @Override public boolean equals(Object obj) { - if (obj.getClass() != this.getClass()) - return false; - ItemQuery other = (ItemQuery)obj; - if (!type.equals(other.type)) - return false; - return libUri.equals(other.libUri); + if (obj.getClass() != this.getClass()) + return false; + ItemQuery other = (ItemQuery)obj; + if (!type.equals(other.type)) + return false; + return libUri.equals(other.libUri); } @Override public int hashCode() { - return type.hashCode() + libUri.hashCode(); + return type.hashCode() + libUri.hashCode(); } } @@ -122,12 +122,12 @@ public class P3DUtil { } public static List filterUserComponents(List items) { - List result = new ArrayList(items.size()); - for (Item i : items) { - if (!i.isCode()) - result.add(i); - } - return result; + List result = new ArrayList(items.size()); + for (Item i : items) { + if (!i.isCode()) + result.add(i); + } + return result; } private static List getItems(ReadGraph graph, Resource lib, Resource type) throws DatabaseException{ @@ -156,11 +156,11 @@ public class P3DUtil { } } Collections.sort(result, new Comparator() { - @Override - public int compare(Item o1, Item o2) { - return o1.getName().compareTo(o2.getName()); - } - }); + @Override + public int compare(Item o1, Item o2) { + return o1.getName().compareTo(o2.getName()); + } + }); return result; } @@ -186,7 +186,7 @@ public class P3DUtil { if (graph.hasStatement(r, p3d.CodeComponent)) item.setCode(true); if (graph.hasStatement(r, p3d.VariableAngleTurnComponent) || - graph.hasStatement(r, p3d.VariableLengthInlineComponent)) + graph.hasStatement(r, p3d.VariableLengthInlineComponent)) item.setVariable(true); if (graph.hasStatement(r, p3d.SizeChangeComponent)) item.setSizeChange(true); @@ -204,38 +204,38 @@ public class P3DUtil { } public static void finalizeDBLoad(P3DRootNode rootNode) throws Exception{ - for (INode node : rootNode.getChild()) { - if (node instanceof PipeRun) { - for (PipelineComponent pc : ((PipeRun) node).getChild()) - pc.sync(); - } else if (node instanceof Equipment) { - for (PipelineComponent pc : ((Equipment) node).getChild()) - pc.sync(); - } - } - - for (INode node : rootNode.getChild()) { - if (node instanceof PipeRun) { - for (PipelineComponent pc : ((PipeRun) node).getChild()) - pc.sync2(); - } else if (node instanceof Equipment) { - for (PipelineComponent pc : ((Equipment) node).getChild()) - pc.sync2(); - } - } - for (INode node : rootNode.getChild()) { - if (node instanceof PipeRun) { - PipingRules.validate((PipeRun)node); - } - } - PipingRules.setEnabled(true); - for (INode node : rootNode.getChild()) { - if (node instanceof PipeRun) { - PipeRun run = (PipeRun)node; - for (PipeControlPoint pcp : run.getControlPoints()) - PipingRules.positionUpdate(pcp); - } - } + for (INode node : rootNode.getChild()) { + if (node instanceof PipeRun) { + for (PipelineComponent pc : ((PipeRun) node).getChild()) + pc.sync(); + } else if (node instanceof Equipment) { + for (PipelineComponent pc : ((Equipment) node).getChild()) + pc.sync(); + } + } + + for (INode node : rootNode.getChild()) { + if (node instanceof PipeRun) { + for (PipelineComponent pc : ((PipeRun) node).getChild()) + pc.sync2(); + } else if (node instanceof Equipment) { + for (PipelineComponent pc : ((Equipment) node).getChild()) + pc.sync2(); + } + } + for (INode node : rootNode.getChild()) { + if (node instanceof PipeRun) { + PipingRules.validate((PipeRun)node); + } + } + PipingRules.setEnabled(true); + for (INode node : rootNode.getChild()) { + if (node instanceof PipeRun) { + PipeRun run = (PipeRun)node; + for (PipeControlPoint pcp : run.getControlPoints()) + PipingRules.positionUpdate(pcp); + } + } } }