]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/PipelineComponent.java
Flat nozzles
[simantics/3d.git] / org.simantics.plant3d / src / org / simantics / plant3d / scenegraph / PipelineComponent.java
index 3f393364e3ccf456cc9ab63b53b8c01927ee6278..fd085db11bb530f4007fbd1fabda812166a9c24b 100644 (file)
@@ -1,15 +1,21 @@
 package org.simantics.plant3d.scenegraph;
 
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.Map;
+import java.util.Map.Entry;
 
 import javax.vecmath.Quat4d;
 import javax.vecmath.Tuple3d;
 import javax.vecmath.Vector3d;
 
 import org.simantics.g3d.math.MathTools;
+import org.simantics.g3d.property.annotations.CompoundGetPropertyValue;
+import org.simantics.g3d.property.annotations.CompoundSetPropertyValue;
 import org.simantics.g3d.property.annotations.GetPropertyValue;
 import org.simantics.g3d.property.annotations.PropertyContributor;
+import org.simantics.objmap.graph.annotations.CompoundRelatedGetValue;
+import org.simantics.objmap.graph.annotations.CompoundRelatedSetValue;
 import org.simantics.objmap.graph.annotations.RelatedGetObj;
 import org.simantics.objmap.graph.annotations.RelatedSetObj;
 import org.simantics.plant3d.ontology.Plant3D;
@@ -83,6 +89,37 @@ public abstract class PipelineComponent extends GeometryNode {
                super.updateParameters();
        }
        
+       @Override
+    @CompoundRelatedGetValue(objRelation=Plant3D.URIs.hasParameter,objType=Plant3D.URIs.Parameter,valRelation=Plant3D.URIs.hasParameterValue)
+    @CompoundGetPropertyValue(name="Parameters",tabId="Parameters",value="parameters")
+    public Map<String, Object> getParameterMap() {
+        return super.getParameterMap();
+    }
+       
+    @Override
+    @CompoundRelatedSetValue(Plant3D.URIs.hasParameter)
+    public void setParameterMap(Map<String, Object> parameters) {
+        super.setParameterMap(parameters);
+    }
+    
+    @CompoundGetPropertyValue(name="Parameters",tabId="Parameters",value="parameters")
+    public Map<String,Object> getParameterMapUI() {
+        // TODO : how to filter parameters that are calculated by geometry provider?
+        Map<String,Object> map = new HashMap<String, Object>(getParameterMap());
+        map.remove("radius");
+        return map;
+    }
+    
+    @CompoundSetPropertyValue(value="parameters")
+    public void setParameterMapUI(Map<String, Object> parameters) { 
+        Map<String, Object> curr = getParameterMap();
+        for (Entry<String, Object> entry : curr.entrySet()) {
+            if (!parameters.containsKey(entry.getKey()))
+                parameters.put(entry.getKey(), entry.getValue());
+        }
+        setParameterMap(parameters);
+    }
+       
        public abstract void setType(String typeURI) throws Exception;
        
        @RelatedGetObj(Plant3D.URIs.HasNext)