]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.plant3d/src/org/simantics/plant3d/utils/P3DUtil.java
Add a wall thickness property to pipe runs.
[simantics/3d.git] / org.simantics.plant3d / src / org / simantics / plant3d / utils / P3DUtil.java
index c125f105c84d0dfa5eb3686303609456bf283ab5..42a3b9a0f5277c3ee5aff8d8e09d4790c840cd0f 100644 (file)
@@ -11,6 +11,7 @@ import java.util.Set;
 
 import org.simantics.Simantics;
 import org.simantics.db.ReadGraph;
+import org.simantics.db.RequestProcessor;
 import org.simantics.db.Resource;
 import org.simantics.db.WriteGraph;
 import org.simantics.db.exception.DatabaseException;
@@ -24,16 +25,24 @@ import org.simantics.plant3d.scenegraph.PipeRun;
 import org.simantics.plant3d.scenegraph.PipelineComponent;
 import org.simantics.plant3d.scenegraph.controlpoint.PipeControlPoint;
 import org.simantics.plant3d.scenegraph.controlpoint.PipingRules;
+import org.simantics.plant3d.scl.SCLUtil;
 import org.simantics.plant3d.utils.Item.Type;
 
 public class P3DUtil {
-       
        public static List<Item> getEquipments() throws DatabaseException {
-               return getEquipments(Plant3D.URIs.Builtin);
+               return getEquipments(SCLUtil.getRequestProcessor());
        }
        
+       public static List<Item> getEquipments(RequestProcessor session) throws DatabaseException {
+               return getEquipments(session, Plant3D.URIs.Builtin);
+       }
+
        public static List<Item> getEquipments(final String libUri) throws DatabaseException {
-               return Simantics.getSession().syncRequest(new Read<List<Item>>() {
+               return getEquipments(SCLUtil.getRequestProcessor(), libUri);
+       }
+       
+       public static List<Item> getEquipments(RequestProcessor session, final String libUri) throws DatabaseException {
+               return session.syncRequest(new Read<List<Item>>() {
                        @Override
                        public List<Item> perform(ReadGraph graph) throws DatabaseException {
                                Plant3D p3d = Plant3D.getInstance(graph);
@@ -49,7 +58,11 @@ public class P3DUtil {
        }
        
        public static List<Item> getNozzles(String libUri) throws DatabaseException {
-               return Simantics.getSession().syncRequest(new Read<List<Item>>() {
+               return getNozzles(SCLUtil.getRequestProcessor(), libUri);
+       }
+       
+       public static List<Item> getNozzles(RequestProcessor session, String libUri) throws DatabaseException {
+               return session.syncRequest(new Read<List<Item>>() {
                        @Override
                        public List<Item> perform(ReadGraph graph) throws DatabaseException {
                                Plant3D p3d = Plant3D.getInstance(graph);
@@ -92,9 +105,13 @@ public class P3DUtil {
                        return type.hashCode() + libUri.hashCode();
                }
        }
-       
+
        public static List<Item> getEnds(String libUri) throws DatabaseException {
-               return Simantics.getSession().syncRequest(new Read<List<Item>>() {
+               return getEnds(SCLUtil.getRequestProcessor(), libUri);
+       }
+       
+       public static List<Item> getEnds(RequestProcessor session, String libUri) throws DatabaseException {
+               return session.syncRequest(new Read<List<Item>>() {
                        @Override
                        public List<Item> perform(ReadGraph graph) throws DatabaseException {
                                Plant3D p3d = Plant3D.getInstance(graph);
@@ -103,9 +120,13 @@ public class P3DUtil {
                        }
                });
        }
-       
+
        public static List<Item> getTurns(String libUri) throws DatabaseException {
-               return Simantics.getSession().syncRequest(new Read<List<Item>>() {
+               return getTurns(SCLUtil.getRequestProcessor(), libUri);
+       }
+       
+       public static List<Item> getTurns(RequestProcessor session, String libUri) throws DatabaseException {
+               return session.syncRequest(new Read<List<Item>>() {
                        @Override
                        public List<Item> perform(ReadGraph graph) throws DatabaseException {
                                Plant3D p3d = Plant3D.getInstance(graph);
@@ -114,9 +135,13 @@ public class P3DUtil {
                        }
                });
        }
-       
+
        public static List<Item> getInlines(String libUri) throws DatabaseException {
-               return Simantics.getSession().syncRequest(new Read<List<Item>>() {
+               return getInlines(SCLUtil.getRequestProcessor(), libUri);
+       }
+       
+       public static List<Item> getInlines(RequestProcessor session, String libUri) throws DatabaseException {
+               return session.syncRequest(new Read<List<Item>>() {
                        @Override
                        public List<Item> perform(ReadGraph graph) throws DatabaseException {
                                Plant3D p3d = Plant3D.getInstance(graph);