Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28239/src/net/sourceforge/bprocessor/gl/view
Modified Files:
AbstractView.java
Log Message:
Vertex selection in getObjectAt()
Index: AbstractView.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** AbstractView.java 17 Aug 2005 17:39:19 -0000 1.8
--- AbstractView.java 22 Aug 2005 14:30:57 -0000 1.9
***************
*** 72,75 ****
--- 72,79 ----
private static final int SURFACES = 1;
+ /** Select for for selecting vertices */
+
+ private static final int VERTICES = 2;
+
/** The width of the window */
protected static double width;
***************
*** 251,256 ****
--- 255,263 ----
*/
protected void drawAll(GLDrawable gld) {
+
Set surfaces = SurfaceFacade.getInstance().findAll();
Set edges = EdgeFacade.getInstance().findAll();
+ Set vertices = VertexFacade.getInstance().findAll();
+
int[] mode = new int[1];
gl.glGetIntegerv(GL.GL_RENDER_MODE, mode);
***************
*** 379,382 ****
--- 386,401 ----
}
}
+
+ if (selectMode == VERTICES) {
+ Iterator it = vertices.iterator();
+ gl.glColor3dv(STD_LINE_COLOR);
+ while (it.hasNext()) {
+ Vertex v = (Vertex)it.next();
+ int name = v.getId().intValue();
+ gl.glPushName(name);
+ drawVertex(v);
+ gl.glPopName();
+ }
+ }
}
}
***************
*** 435,438 ****
--- 454,467 ----
}
}
+
+ /**
+ * Draw a Vertex
+ * @param v The Vertex to draw
+ */
+ private void drawVertex(Vertex v) {
+ gl.glBegin(GL.GL_POINTS);
+ gl.glVertex3d(v.getX(), v.getY(), v.getZ());
+ gl.glEnd();
+ }
/**
***************
*** 670,673 ****
--- 699,713 ----
this.x = x;
this.y = y;
+
+ // indicating that I am trying to pick(used in camera)
+ picking = 10;
+ selectMode = VERTICES;
+ //repainting to get selection buffer
+ glv.repaint(true);
+ id = processSelect();
+ if (id != null) {
+ Vertex v = VertexFacade.getInstance().findById(id);
+ return v;
+ }
//indicating that I am trying to pick(used in camera)
picking = 10;
|