Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25032/src/net/sourceforge/bprocessor/gl/model
Modified Files:
Intersection.java
Log Message:
Improvements of AbstractPencil
Index: Intersection.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model/Intersection.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Intersection.java 7 Mar 2006 22:31:06 -0000 1.1
--- Intersection.java 30 Mar 2006 07:41:27 -0000 1.2
***************
*** 8,11 ****
--- 8,12 ----
package net.sourceforge.bprocessor.gl.model;
+ import net.sourceforge.bprocessor.model.Edge;
import net.sourceforge.bprocessor.model.Geometric;
import net.sourceforge.bprocessor.model.Vertex;
***************
*** 83,85 ****
--- 84,143 ----
return object;
}
+
+ /**
+ * Return true if the object in this intersection
+ * is an edge (that is not a constructor)
+ * @return True if object is edge
+ */
+ public boolean hasEdge() {
+ if (type == EDGE_MIDPOINT) {
+ return true;
+ }
+ if (type == EDGE) {
+ Edge edge = (Edge) object;
+ return !edge.getConstructor();
+ }
+ return false;
+ }
+
+ /**
+ * @return String representation
+ */
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ String name = "";
+ buffer.append("[");
+ switch (type) {
+ case Intersection.VERTEX:
+ name = "vertex";
+ break;
+ case Intersection.EDGE:
+ name = "edge";
+ break;
+ case Intersection.SURFACE:
+ name = "surface";
+ break;
+ case Intersection.EDGE_MIDPOINT:
+ name = "edge midpoint";
+ break;
+ case Intersection.EDGE_INTERSECTION:
+ name = "edge intersection";
+ break;
+ case Intersection.SURFACE_INTERSECTION:
+ name = "surface intersection";
+ break;
+ case Intersection.PLANE_INTERSECTION:
+ name = "plane intersection";
+ break;
+ }
+ buffer.append(name);
+ if (object != null) {
+ buffer.append(" ");
+ buffer.append(object);
+ }
+ buffer.append(" ");
+ buffer.append(vertex);
+ buffer.append("]");
+ return buffer.toString();
+ }
}
|