--- /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 StraightGeometryProvider extends BuiltinGeometryProvider {
+
+ public StraightGeometryProvider(Resource resource) {
+ super(resource);
+ }
+
+ private double length = 1.0;
+ private double radius = 0.01;
+
+ @Override
+ public Collection<TopoDS_Shape> getModel() throws Exception {
+ TopoDS_Shape shape = OccTriangulator.makeCylinder(new double[] {-length*0.5, 0.0, 0.0}, new double[] { 1.0, 0.0, 0.0 }, radius, length);
+// System.out.println("Create straight l:" + length + " r:" + radius);
+ return Collections.singletonList(shape);
+ }
+
+ @Override
+ public void setProperties(Map<String, Object> props) {
+ if (props.containsKey("length"))
+ length = (Double)props.get("length");
+ if (props.containsKey("radius")) {
+ radius = (Double)props.get("radius");
+ }
+ if (length < 0.0)
+ length = 0.0;
+ if (radius < MathTools.NEAR_ZERO)
+ radius = MathTools.NEAR_ZERO;
+
+ }
+
+
+
+}