[Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view View.java,1.58,1.59
Status: Pre-Alpha
Brought to you by:
henryml
From: Nordholt <nor...@us...> - 2006-02-09 14:16:43
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29446 Modified Files: View.java Log Message: changed the getobjectatpoint method to be able to disregard a set of entities when analysing the selection buffer Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** View.java 6 Feb 2006 14:26:56 -0000 1.58 --- View.java 9 Feb 2006 14:16:28 -0000 1.59 *************** *** 1569,1576 **** /** ! * Processes the select buffer * @return the closest hit and null if no hit. */ ! private List processSelect() { List selection = new LinkedList(); int bufferOffset = 0; --- 1569,1578 ---- /** ! * Processes the select buffer. A set of entities that should ! * not be considered is specified. ! * @param unWantedEntities the collection og unwanted entities * @return the closest hit and null if no hit. */ ! private List processSelect(Collection unWantedEntities) { List selection = new LinkedList(); int bufferOffset = 0; *************** *** 1602,1634 **** id = selectBuffer.get(bufferOffset); current = getName(id); ! boolean isConstructor = false; ! if (current instanceof Vertex) { ! vertices.add(current); ! } else if (current instanceof Edge) { ! Edge e = (Edge) current; ! if (e.getConstructor()) { ! isConstructor = true; ! constructors.add(e); ! } else { ! edges.add(current); } ! } ! if (isConstructor) { ! if (near < nearestConstructor) { ! nearestConstructor = near; ! closestConstructor = (Edge) current; } } else { ! if (near < nearest) { ! nearest = near; ! closest = current; ! } ! } ! bufferOffset += names; } else { bufferOffset += 3; ! } } if (closest instanceof ClippingPlane) { selection.add(closest); --- 1604,1641 ---- id = selectBuffer.get(bufferOffset); current = getName(id); ! if (!unWantedEntities.contains(current)) { ! boolean isConstructor = false; ! if (current instanceof Vertex) { ! vertices.add(current); ! } else if (current instanceof Edge) { ! Edge e = (Edge) current; ! if (e.getConstructor()) { ! isConstructor = true; ! constructors.add(e); ! } else { ! edges.add(current); ! } } ! if (isConstructor) { ! if (near < nearestConstructor) { ! nearestConstructor = near; ! closestConstructor = (Edge) current; ! } ! } else { ! if (near < nearest) { ! nearest = near; ! closest = current; ! } } + bufferOffset += names; } else { ! bufferOffset += 3; ! } } else { bufferOffset += 3; ! } } + if (closest instanceof ClippingPlane) { selection.add(closest); *************** *** 1759,1769 **** } ! /** ! * Gets id of the object under a point. For use in selection. ! * @param x the x coordinate of the point in mouse coordinates ! * @param y the y coordinate of the point in mouse coordinates ! * @return The object under the point, null if no object is there */ ! public List getObjectAtPoint(double x, double y) { this.x = x; this.y = y; --- 1766,1779 ---- } ! /** ! * Gets Entity under a point. For use in selection. ! * A set of unwanted entities can be specified, so that ! * these entities are not considered. ! * @param x x-coordinate of the point ! * @param y y-coordinate of the point ! * @param unWantedEntities the collection of unwanted entities ! * @return entity under the point. */ ! public List getObjectAtPoint(double x, double y, Collection unWantedEntities) { this.x = x; this.y = y; *************** *** 1773,1779 **** glv.repaint(true); ! List selection = processSelect(); clearNames(); ! return selection; } --- 1783,1799 ---- glv.repaint(true); ! List selection = processSelect(unWantedEntities); clearNames(); ! return selection; ! } ! ! /** ! * Gets id of the object under a point. For use in selection. ! * @param x the x coordinate of the point in mouse coordinates ! * @param y the y coordinate of the point in mouse coordinates ! * @return The object under the point, null if no object is there ! */ ! public List getObjectAtPoint(double x, double y) { ! return getObjectAtPoint(x, y, new HashSet()); } *************** *** 1792,1796 **** glv.repaint(true); ! List selection = processSelect(); clearNames(); return selection; --- 1812,1816 ---- glv.repaint(true); ! List selection = processSelect(new HashSet()); clearNames(); return selection; *************** *** 1811,1815 **** glv.repaint(true); ! List selection = processSelect(); clearNames(); return selection; --- 1831,1835 ---- glv.repaint(true); ! List selection = processSelect(new HashSet()); clearNames(); return selection; |