import org.simantics.plant3d.utils.Item.Type;
public class P3DUtil {
-
- public static List<Item> getEquipments() throws DatabaseException {
- return getEquipments(Plant3D.URIs.Builtin);
- }
+
+ public static List<Item> getEquipments() throws DatabaseException {
+ return getEquipments(Plant3D.URIs.Builtin);
+ }
public static List<Item> getEquipments(final String libUri) throws DatabaseException {
return Simantics.getSession().syncRequest(new Read<List<Item>>() {
@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();
}
}
}
public static List<Item> filterUserComponents(List<Item> items) {
- List<Item> result = new ArrayList<Item>(items.size());
- for (Item i : items) {
- if (!i.isCode())
- result.add(i);
- }
- return result;
+ List<Item> result = new ArrayList<Item>(items.size());
+ for (Item i : items) {
+ if (!i.isCode())
+ result.add(i);
+ }
+ return result;
}
private static List<Item> getItems(ReadGraph graph, Resource lib, Resource type) throws DatabaseException{
}
}
Collections.sort(result, new Comparator<Item>() {
- @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;
}
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);
}
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);
+ }
+ }
}
}