P3D.Builtin : L0.Library
P3D.Builtin.NozzleGeometryProvider : P3D.GeometryProvider
+P3D.Builtin.FlatNozzleGeometryProvider : P3D.GeometryProvider
P3D.Builtin.HorizontalTankGeometryProvider : P3D.GeometryProvider
P3D.Builtin.VerticalTankGeometryProvider : P3D.GeometryProvider
P3D.Builtin.StraightGeometryProvider : P3D.GeometryProvider
P3D.Builtin.Nozzle <T P3D.Nozzle : P3D.Nozzle
@L0.assert P3D.hasGeometry P3D.Builtin.NozzleGeometryProvider
+ @L0.assert P3D.hasParameter
+ _ :P3D.Parameter
+ L0.HasName "length" : L0.String
+ P3D.hasParameterValue 0.1 : L0.Double
+P3D.Builtin.FlatNozzle <T P3D.Nozzle : P3D.Nozzle
+ @L0.assert P3D.hasGeometry P3D.Builtin.FlatNozzleGeometryProvider
+
P3D.Builtin.HorizontalTank <T P3D.Equipment : P3D.Equipment
@L0.assert P3D.hasGeometry P3D.Builtin.HorizontalTankGeometryProvider
@L0.assert P3D.hasParameter
--- /dev/null
+package org.simantics.plant3d.geometry;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+
+import org.jcae.opencascade.jni.TopoDS_Shape;
+import org.simantics.db.Resource;
+import org.simantics.g3d.math.MathTools;
+import org.simantics.opencascade.OccTriangulator;
+
+public class FlatNozzleGeometryProvider extends BuiltinGeometryProvider {
+
+ public FlatNozzleGeometryProvider(Resource resource) {
+ super(resource);
+ }
+
+ private double radius = 0.01;
+
+ @Override
+ public Collection<TopoDS_Shape> getModel() throws Exception {
+ if (radius < MathTools.NEAR_ZERO)
+ return Collections.emptyList();
+ double length = 0.01;
+ TopoDS_Shape shape = OccTriangulator.makeCylinder(new double[] {0.0, 0.0, 0.0}, new double[] { 1.0, 0.0, 0.0 }, radius, length);
+ return Collections.singletonList(shape);
+ }
+
+ @Override
+ public void setProperties(Map<String, Object> props) {
+ if (props.containsKey("radius")) {
+ radius = (Double)props.get("radius");
+ }
+
+ }
+
+}
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;
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)