import java.util.Collections;
import java.util.Map;
+import javax.vecmath.AxisAngle4d;
+import javax.vecmath.Vector3d;
+
import org.jcae.opencascade.jni.TopoDS_Shape;
import org.simantics.db.Resource;
+import org.simantics.g3d.math.MathTools;
import org.simantics.opencascade.OccTriangulator;
+import org.simantics.plant3d.scenegraph.Nozzle;
-public class PumpGeometryProvider extends BuiltinGeometryProvider {
+public class PumpGeometryProvider extends BuiltinGeometryProvider implements FixedNozzleProvider{
public PumpGeometryProvider(Resource resource) {
super(resource);
@Override
public Collection<TopoDS_Shape> getModel() throws Exception {
+ if (width < MathTools.NEAR_ZERO || length < MathTools.NEAR_ZERO)
+ return Collections.emptyList();
double h = width * 0.5;
double h2 = width * 0.1;
double ld2 = length * 0.5;
}
}
+
+ @Override
+ public int numberOfNozzles() {
+ return 2;
+ }
+
+ @Override
+ public void updateNozzlePosition(int index, Nozzle nozzle) {
+ Double fl = (Double)nozzle.getParameterMap().get("length");
+ if (fl == null)
+ fl = 0.0;
+ if (index == 0) {
+ nozzle.setPosition(new Vector3d(-length*0.5- fl,width*0.6,0.0));
+ nozzle.setOrientation(MathTools.getQuat(new AxisAngle4d(0,1,0,Math.PI)));
+ } else if (index == 1) {
+ nozzle.setPosition(new Vector3d(-length*0.4,width*1.1+ fl,0.0));
+ nozzle.setOrientation(MathTools.getQuat(new AxisAngle4d(0,0,1,Math.PI*0.5)));
+ }
+
+ }
+
+ @Override
+ public String getNozzleName(int index) {
+ switch (index) {
+ case 0 : return "Input";
+ case 1: return "Output";
+ default: return null;
+ }
+ }
}