]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
Plant3D customization 41/3141/1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Wed, 21 Aug 2019 15:02:27 +0000 (18:02 +0300)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Wed, 21 Aug 2019 15:02:27 +0000 (18:02 +0300)
* Expose packages
* Allow equipment to be loaded from non-default location
* Fixed ontology errors

gitlab #29

Change-Id: Id82c78edf353aec643a65c6304eb12a664b36778

org.simantics.plant3d.ontology/graph/plant3d.pgraph
org.simantics.plant3d.ontology/graph/plant3d_builtins.pgraph
org.simantics.plant3d.ontology/graph/plant3d_viewpoint.pgraph
org.simantics.plant3d/META-INF/MANIFEST.MF
org.simantics.plant3d/src/org/simantics/plant3d/editor/Plant3DEditor.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/P3DRootNode.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/PipeRun.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/SchemaBuilder.java
org.simantics.plant3d/src/org/simantics/plant3d/utils/P3DUtil.java

index f589bf3728f427d9bd3558a69e0464bcda47a476..591a34cabb401fa9ea5a2900860cb991cab47275 100644 (file)
@@ -19,9 +19,10 @@ P3D.Node <T G3D.Node
 P3D.Plant <T G3D.RootNode <T P3D.Node
 
 
-P3D.childen <R G3D.children
+P3D.children <R G3D.children
 
 P3D.hasGeometry <R L0.IsWeaklyRelatedTo
+P3D.GeometryProvider <T L0.Entity
    
 P3D.LibraryComponent <T P3D.Node
 
index 6eb90594ecda4a1d6c29f7932d4e824f0e650a5a..a26abde450c5e2e0309051da91d0c6470f5bafef 100644 (file)
@@ -4,18 +4,17 @@ P3D = <http://www.simantics.org/Plant3D-0.1>
 
 P3D.Builtin : L0.Library
 
-P3D.Builtin.GeometryProvider <T L0.Entity
-P3D.Builtin.NozzleGeometryProvider : P3D.Builtin.GeometryProvider
-P3D.Builtin.HorizontalTankGeometryProvider : P3D.Builtin.GeometryProvider
-P3D.Builtin.VerticalTankGeometryProvider : P3D.Builtin.GeometryProvider
-P3D.Builtin.StraightGeometryProvider : P3D.Builtin.GeometryProvider
-P3D.Builtin.ElbowGeometryProvider : P3D.Builtin.GeometryProvider
-P3D.Builtin.ReducerGeometryProvider : P3D.Builtin.GeometryProvider
-P3D.Builtin.PumpGeometryProvider : P3D.Builtin.GeometryProvider
-P3D.Builtin.BallValveGeometryProvider : P3D.Builtin.GeometryProvider
-P3D.Builtin.CheckValveGeometryProvider : P3D.Builtin.GeometryProvider
-P3D.Builtin.GateValveGeometryProvider : P3D.Builtin.GeometryProvider
-P3D.Builtin.CapGeometryProvider : P3D.Builtin.GeometryProvider
+P3D.Builtin.NozzleGeometryProvider : P3D.GeometryProvider
+P3D.Builtin.HorizontalTankGeometryProvider : P3D.GeometryProvider
+P3D.Builtin.VerticalTankGeometryProvider : P3D.GeometryProvider
+P3D.Builtin.StraightGeometryProvider : P3D.GeometryProvider
+P3D.Builtin.ElbowGeometryProvider : P3D.GeometryProvider
+P3D.Builtin.ReducerGeometryProvider : P3D.GeometryProvider
+P3D.Builtin.PumpGeometryProvider : P3D.GeometryProvider
+P3D.Builtin.BallValveGeometryProvider : P3D.GeometryProvider
+P3D.Builtin.CheckValveGeometryProvider : P3D.GeometryProvider
+P3D.Builtin.GateValveGeometryProvider : P3D.GeometryProvider
+P3D.Builtin.CapGeometryProvider : P3D.GeometryProvider
 
  
 P3D.Builtin.ConcentricReducer <T P3D.InlineComponent : P3D.InlineComponent
index bb06785b1fe4ff4751966b6d19f390e3da1340a2..0c42f7ff38de3230b37fe3e824ef2b757729388b 100644 (file)
@@ -21,7 +21,7 @@ PBC = P3D.P3DBrowseContext : VP.BrowseContext
     @VP.constantImageRule P3D.PipeRun IMAGES.Straight
     @VP.relationChildRule PROJ.Project L0.ConsistsOf P3D.Plant
     @VP.relationChildRule PROJ.Project L0.ConsistsOf CSG.Model
-    @VP.relationChildRule P3D.Node P3D.childen P3D.Node
+    @VP.relationChildRule P3D.Node P3D.children P3D.Node
     @VP.relationChildRule P3D.Node P3D.HasNozzle P3D.Node
 
 
index d8f33c72d979bd46b85cb54c354b34f295058fbe..8a67558d9016d1c467c84a7104d1dda57388c15f 100644 (file)
@@ -6,7 +6,6 @@ Bundle-Version: 1.0.0.qualifier
 Bundle-Activator: org.simantics.plant3d.Activator
 Bundle-Vendor: VTT
 Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.ui,
  org.eclipse.ui,
  org.simantics.db;bundle-version="1.1.0",
  org.simantics.db.common;bundle-version="1.1.0",
@@ -37,6 +36,16 @@ Require-Bundle: org.eclipse.core.runtime,
  org.simantics.utils.thread.swt;bundle-version="1.1.0"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ActivationPolicy: lazy
-Export-Package: org.simantics.plant3d.editor,
+Export-Package: org.simantics.plant3d.actions,
+ org.simantics.plant3d.browser,
+ org.simantics.plant3d.dialog,
+ org.simantics.plant3d.editor,
+ org.simantics.plant3d.geometry,
+ org.simantics.plant3d.gizmo,
+ org.simantics.plant3d.handlers,
+ org.simantics.plant3d.project,
  org.simantics.plant3d.property,
- org.simantics.plant3d.scenegraph
+ org.simantics.plant3d.scenegraph,
+ org.simantics.plant3d.scenegraph.controlpoint,
+ org.simantics.plant3d.scl,
+ org.simantics.plant3d.utils
index 21b99bfb74f109b5b910e5d86c19bdf8deda9531..5015e6ea4b8dd9d2e4dfb8798c92f06b6834c757 100644 (file)
@@ -204,21 +204,25 @@ public class Plant3DEditor extends ResourceEditorPart {
                        return;
                }
                
-               translateAction = new TranslateAction(panel,nodeMap);
-               translateInlineAction = new TranslateInlineAction(panel, nodeMap);
-               rotateAction = new RotateAction(panel,nodeMap);
-               removeAction = new RemoveAction(nodeMap) {
-                       public void setNode(IG3DNode node) {
-                               super.setNode(node);
-                               
-                               
-                       }
-               };
-               routePipeAction = new RoutePipeAction(panel,rootNode);
-               addComponentAction = new AddComponentAction(panel, rootNode);
+               createActions();
                
        }
        
+       protected void createActions() {
+           translateAction = new TranslateAction(panel,nodeMap);
+        translateInlineAction = new TranslateInlineAction(panel, nodeMap);
+        rotateAction = new RotateAction(panel,nodeMap);
+        removeAction = new RemoveAction(nodeMap) {
+            public void setNode(IG3DNode node) {
+                super.setNode(node);
+                
+                
+            }
+        };
+        routePipeAction = new RoutePipeAction(panel,rootNode);
+        addComponentAction = new AddComponentAction(panel, rootNode);
+       }
+       
        public void populate() {
                ThreadUtils.asyncExec(panel.getThreadQueue(), new Runnable() {
                        
index 1e9492a45297252e5cf63bdcb23e15f86989b7be..4f00530e7203f2e0ca010bf8423d9e57366d3188 100644 (file)
@@ -27,21 +27,21 @@ import vtk.vtkProp;
 public class P3DRootNode extends ParentNode<INode> implements IG3DNode, NodeMapProvider<vtkProp , INode> {
        
        
-       @RelatedElementsAdd(Plant3D.URIs.childen)
+       @RelatedElementsAdd(Plant3D.URIs.children)
        public void addChild(INode node) {
        //public void addChild(IP3DVisualNode node) {
-               addNode(Plant3D.URIs.childen,node);
+               addNode(Plant3D.URIs.children,node);
        }
        
-       @RelatedElementsGet(Plant3D.URIs.childen)
+       @RelatedElementsGet(Plant3D.URIs.children)
        public Collection<INode> getChild() {
-               return getNodes(Plant3D.URIs.childen);
+               return getNodes(Plant3D.URIs.children);
        }
        
-       @RelatedElementsRem(Plant3D.URIs.childen)
+       @RelatedElementsRem(Plant3D.URIs.children)
        public void remChild(INode node) {
        //public void remChild(IP3DNode node) {
-               removeNode(Plant3D.URIs.childen, node);
+               removeNode(Plant3D.URIs.children, node);
        }
        
        private P3DNodeMap nodeMap;
index 0bd028307343513f88d7eb32f7717bfc929419ee..9e163c2e79ba70669ca10e16a75b08c4a7596905 100644 (file)
@@ -77,29 +77,29 @@ public class PipeRun extends P3DParentNode<IP3DNode> {
                firePropertyChanged(Plant3D.URIs.HasPipeDiameter);
        }
        
-       @RelatedElementsAdd(Plant3D.URIs.childen)
+       @RelatedElementsAdd(Plant3D.URIs.children)
        public void addChild(PipelineComponent node) {
-               addNode(Plant3D.URIs.childen,node);
+               addNode(Plant3D.URIs.children,node);
        }
        
-       @RelatedElementsGet(Plant3D.URIs.childen)
+       @RelatedElementsGet(Plant3D.URIs.children)
        public Collection<PipelineComponent> getChild() {
                Collection<PipelineComponent> coll = new ArrayList<PipelineComponent>();
-               for (IG3DNode n : getNodes(Plant3D.URIs.childen)) {
+               for (IG3DNode n : getNodes(Plant3D.URIs.children)) {
                        coll.add((PipelineComponent)n);
                }
                return coll;
        }
        
-       @RelatedElementsRem(Plant3D.URIs.childen)
+       @RelatedElementsRem(Plant3D.URIs.children)
        public void remChild(PipelineComponent node) {
-               removeNode(Plant3D.URIs.childen, node);
+               removeNode(Plant3D.URIs.children, node);
        }
 
        
        public List<PipelineComponent> getSortedChild() {
                List<PipelineComponent> coll = new ArrayList<PipelineComponent>();
-               for (IG3DNode n : getNodes(Plant3D.URIs.childen)) {
+               for (IG3DNode n : getNodes(Plant3D.URIs.children)) {
                        coll.add((PipelineComponent)n);
                }
                Collections.sort(coll, new ComponentComparator());
index dd28e585def9ae2ea079e59dc87db51446d85956..5b761a11a0ee0d3f7001ecd3dfe781bc0b1ff7cd 100644 (file)
@@ -33,7 +33,7 @@ public class SchemaBuilder {
                        schema.addLinkType(MappingSchemas.fromAnnotations(g, P3DRootNode.class));
                        schema.addLinkType(MappingSchemas.fromAnnotations(g, PipeRun.class));
                        
-                       schema.addLinkType(MappingSchemas.fromAdaptable(g, Plant3D.URIs.Builtin_GeometryProvider, GeometryProvider.class));
+                       schema.addLinkType(MappingSchemas.fromAdaptable(g, Plant3D.URIs.GeometryProvider, GeometryProvider.class));
                        return schema;
                } catch (IllegalAccessException e) {
                        throw new DatabaseException(e);
index 7ba42b8f9d128d511973507595fee90d9a6d59fa..0d656b054de0e724e72d4592597fa46aa52b4a17 100644 (file)
@@ -23,14 +23,18 @@ import org.simantics.plant3d.scenegraph.controlpoint.PipingRules;
 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 {
+       public static List<Item> getEquipments(final String libUri) throws DatabaseException {
                return Simantics.getSession().syncRequest(new Read<List<Item>>() {
                        @Override
                        public List<Item> perform(ReadGraph graph) throws DatabaseException {
                                Plant3D p3d = Plant3D.getInstance(graph);
                                Resource project = Simantics.getProject().get();
-                               Resource builtins = graph.getResource(Plant3D.URIs.Builtin);
+                               Resource builtins = graph.getResource(libUri);
                                List<Item> actions = getItems(graph, project,p3d.Equipment);
                                actions.addAll(getItems(graph, builtins,p3d.Equipment));
                                return actions;
@@ -45,26 +49,43 @@ public class P3DUtil {
                        @Override
                        public List<Item> perform(ReadGraph graph) throws DatabaseException {
                                Plant3D p3d = Plant3D.getInstance(graph);
-                               ItemQuery query = new ItemQuery(p3d.Nozzle);
+                               ItemQuery query = new ItemQuery(p3d.Nozzle, Plant3D.URIs.Builtin);
                                return graph.syncRequest(query);
                        }
                });
        }
        
-       private static class ItemQuery implements Read<List<Item>> {
+       public static class ItemQuery implements Read<List<Item>> {
                private Resource type;
-               public ItemQuery(Resource type) {
+               private String libUri;
+               public ItemQuery(Resource type, String libUri) {
                        this.type = type;
+                       this.libUri = libUri;
                }
                
                @Override
                public List<Item> perform(ReadGraph graph) throws DatabaseException {
                        Resource project = Simantics.getProject().get();
-                       Resource builtins = graph.getResource(Plant3D.URIs.Builtin);
+                       Resource builtins = graph.getResource(libUri);
                        List<Item> actions = getItems(graph, project,type);
                        actions.addAll(getItems(graph, builtins,type));
                        return actions;
                }
+               
+               @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);
+               }
+               
+               @Override
+               public int hashCode() {
+                   return type.hashCode() + libUri.hashCode();
+               }
        }
        
        public static List<Item> getEnds() throws DatabaseException {
@@ -72,7 +93,7 @@ public class P3DUtil {
                        @Override
                        public List<Item> perform(ReadGraph graph) throws DatabaseException {
                                Plant3D p3d = Plant3D.getInstance(graph);
-                               ItemQuery query = new ItemQuery(p3d.EndComponent);
+                               ItemQuery query = new ItemQuery(p3d.EndComponent, Plant3D.URIs.Builtin);
                                return graph.syncRequest(query);
                        }
                });
@@ -83,7 +104,7 @@ public class P3DUtil {
                        @Override
                        public List<Item> perform(ReadGraph graph) throws DatabaseException {
                                Plant3D p3d = Plant3D.getInstance(graph);
-                               ItemQuery query = new ItemQuery(p3d.TurnComponent);
+                               ItemQuery query = new ItemQuery(p3d.TurnComponent, Plant3D.URIs.Builtin);
                                return graph.syncRequest(query);
                        }
                });
@@ -94,7 +115,7 @@ public class P3DUtil {
                        @Override
                        public List<Item> perform(ReadGraph graph) throws DatabaseException {
                                Plant3D p3d = Plant3D.getInstance(graph);
-                               ItemQuery query = new ItemQuery(p3d.InlineComponent);
+                               ItemQuery query = new ItemQuery(p3d.InlineComponent, Plant3D.URIs.Builtin);
                                return graph.syncRequest(query);
                        }
                });