Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv19188/src/net/sourceforge/bprocessor/gl/view
Modified Files:
View.java
Log Message:
Refactoring selection mechanism
Index: View.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v
retrieving revision 1.133
retrieving revision 1.134
diff -C2 -d -r1.133 -r1.134
*** View.java 10 Aug 2006 10:10:49 -0000 1.133
--- View.java 10 Aug 2006 13:08:01 -0000 1.134
***************
*** 68,71 ****
--- 68,80 ----
private static Logger log = Logger.getLogger(View.class);
+ /** OBJECTS flag */
+ public static final int OBJECTS = 1;
+
+ /** INTERSECTIONS flag */
+ public static final int INTERSECTIONS = 2;
+
+ /** HANDLES flag */
+ public static final int HANDLES = 3;
+
/** IGNORE */
public static final boolean IGNORE = true;
***************
*** 271,276 ****
private int selectMode;
! /** Are intersections wanted in hit-detection? */
! private boolean selectIntersections;
/** Excluded for hit-detection */
--- 280,285 ----
private int selectMode;
! /** What type of entities should be selected */
! private int selectionMode;
/** Excluded for hit-detection */
***************
*** 1861,1868 ****
dist = (current.getOrigin().minus(v)).length() * scale;
}
! if (selectIntersections) {
if (current.isEditable()) {
! pushName(gl, current.getOrigin());
! drawVertexHit(current.getOrigin());
popName(gl);
}
--- 1870,1878 ----
dist = (current.getOrigin().minus(v)).length() * scale;
}
! if (selectionMode == INTERSECTIONS) {
if (current.isEditable()) {
! Vertex origin = current.getOriginHandle();
! pushName(gl, origin);
! drawVertexHit(origin);
popName(gl);
}
***************
*** 1870,1879 ****
Line line = (Line) current;
Edge guide = line.edge(View.gridSize() * 2);
- if (current.isEditable()) {
- Vertex tip = line.tip(dist / 10);
- pushName(gl, tip);
- drawVertexHit(tip);
- popName(gl);
- }
if (current.isActive()) {
pushName(gl, guide);
--- 1880,1883 ----
***************
*** 2411,2420 ****
* @param y y-coordinate of the point
* @param unWantedEntities the collection of unwanted entities
! * @param intersections Are intersections wanted
* @param xy The default plane to intersect with
* @return entity under the point.
*/
public Object getObjectAtPoint(double x, double y,
! Collection unWantedEntities, boolean intersections, Plane xy) {
this.x = x;
this.y = y;
--- 2415,2424 ----
* @param y y-coordinate of the point
* @param unWantedEntities the collection of unwanted entities
! * @param mode Are intersections wanted
* @param xy The default plane to intersect with
* @return entity under the point.
*/
public Object getObjectAtPoint(double x, double y,
! Collection unWantedEntities, int mode, Plane xy) {
this.x = x;
this.y = y;
***************
*** 2422,2431 ****
picking = 10;
selectMode = ALL;
! selectIntersections = intersections;
excluded = unWantedEntities;
glv.repaint(true);
! Object object = processSelect(unWantedEntities, intersections, xy);
clearNames();
return object;
--- 2426,2436 ----
picking = 10;
selectMode = ALL;
! selectionMode = mode;
!
excluded = unWantedEntities;
glv.repaint(true);
! Object object = processSelect(unWantedEntities, mode == INTERSECTIONS, xy);
clearNames();
return object;
***************
*** 2436,2443 ****
* @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 Object getObjectAtPoint(double x, double y) {
! return getObjectAtPoint(x, y, new HashSet(), false, new Plane(0, 0, 1, 0));
}
--- 2441,2449 ----
* @param x the x coordinate of the point in mouse coordinates
* @param y the y coordinate of the point in mouse coordinates
+ * @param mode mode
* @return The object under the point, null if no object is there
*/
! public Object getObjectAtPoint(double x, double y, int mode) {
! return getObjectAtPoint(x, y, new HashSet(), mode, new Plane(0, 0, 1, 0));
}
|