Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Moved probe over to groovy

  • Loading branch information...
commit 3a2f14729f382af1c32bce4b387b7e868cacd37a 1 parent 1cda655
Zachary Kim authored
View
52 src/main/groovy/napplelabs/dbssim/canvasviews/Probe.groovy
@@ -1,52 +0,0 @@
-package napplelabs.dbssim.canvasviews
-
-import edu.umd.cs.piccolo.PNode
-import java.awt.Color
-import edu.umd.cs.piccolo.nodes.PPath
-import napplelabs.dbssim.canvasviews.NeuronPath
-import ddf.minim.Minim
-import java.awt.BasicStroke
-import java.awt.geom.Point2D
-import edu.umd.cs.piccolo.nodes.PText
-import java.awt.Font
-
-class Probe extends PNode {
-
- private double depth;
-
- public Probe() {
- init()
- }
-
- public void init() {
- PPath path = PPath.createLine(0, -1000, 0, 2000);
- //path.rotate(Math.PI)
- path.stroke = new BasicStroke(3)
- path.paint = Color.lightGray
- path.strokePaint = Color.lightGray
-
- probe = PPath.createLine(0, 0, 0, -3000);
-
- probe.offset = new Point2D.Double(0, -2000)
- probe.stroke = new BasicStroke(5)
-
- addChild(path)
- addChild(probe)
-
- (10..-20).each {int i->
- PText t = new PText(-i+"mm")
- t.font = new Font("Arial", Font.PLAIN, 16)
- t.offset = new Point2D.Double(30, i*100)
- t.textPaint = Color.lightGray
- addChild(t)
- }
-
- }
-
- PPath probe
-
- public void setDepth(double depth) {
-
- this.depth = depth
- probe.offset = new Point2D.Double(0.0, -depth * 100.0)
- }
View
65 src/main/groovy/napplelabs/dbssim/canvasviews/Probe.java
@@ -0,0 +1,65 @@
+package napplelabs.dbssim.canvasviews;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.geom.Point2D;
+
+import edu.umd.cs.piccolo.PNode;
+import edu.umd.cs.piccolo.nodes.PPath;
+import edu.umd.cs.piccolo.nodes.PText;
+
+/**
+ * Represents the view of a probe on the canvas.
+ * @author zkim
+ *
+ */
+
+public class Probe extends PNode {
+
+ private PPath probe;
+ private double depth;
+
+ public Probe() {
+ PPath path = PPath.createLine(0, -1000, 0, 2000);
+ // path.rotate(Math.PI)
+ path.setStroke(new BasicStroke(3));
+ path.setPaint(Color.lightGray);
+ path.setStrokePaint(Color.lightGray);
+
+ setProbe(PPath.createLine(0, 0, 0, -3000));
+
+ getProbe().setOffset(new Point2D.Double(0, -2000));
+ getProbe().setStroke(new BasicStroke(5));
+
+ addChild(path);
+ addChild(getProbe());
+
+ for (int i = 10; i > -20; i++) {
+ PText t = new PText(-i + "mm");
+ t.setFont(new Font("Arial", Font.PLAIN, 16));
+ t.setOffset(new Point2D.Double(30, i * 100));
+ t.setTextPaint(Color.lightGray);
+ addChild(t);
+ }
+
+ }
+
+ public void setDepth(double depth) {
+
+ this.depth = depth;
+ getProbe().setOffset(new Point2D.Double(0.0, -depth * 100.0));
+ }
+
+ public double getDepth() {
+ return this.depth;
+ }
+
+ public void setProbe(PPath probe) {
+ this.probe = probe;
+ }
+
+ public PPath getProbe() {
+ return probe;
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.