Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17327/src/net/sourceforge/bprocessor/gl/tool
Modified Files:
PencilTool.java MoveTool.java
Log Message:
getObjectAtPoint can now find edge-intersections and also checks to see if the intersections is close to the mouse
Index: MoveTool.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** MoveTool.java 28 Feb 2006 20:53:53 -0000 1.41
--- MoveTool.java 6 Mar 2006 06:51:52 -0000 1.42
***************
*** 373,377 ****
delta = restrictCopy;
} else if (moveMode == FREE_SNAP) {
! List objects = glv.getView().getObjectAtPoint(e.getX(), e.getY(), moveEntities);
Iterator it = objects.iterator();
if (it.hasNext()) {
--- 373,377 ----
delta = restrictCopy;
} else if (moveMode == FREE_SNAP) {
! List objects = glv.getView().getObjectAtPoint(e.getX(), e.getY(), moveEntities, false);
Iterator it = objects.iterator();
if (it.hasNext()) {
Index: PencilTool.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v
retrieving revision 1.60
retrieving revision 1.61
diff -C2 -d -r1.60 -r1.61
*** PencilTool.java 16 Feb 2006 20:54:21 -0000 1.60
--- PencilTool.java 6 Mar 2006 06:51:52 -0000 1.61
***************
*** 80,92 ****
/** The wanted length of the previous edge */
! private String number = "";
!
! /** Edge one */
! private Edge splitE1;
!
! /** Edge two */
! private Edge splitE2;
-
/**
* Constructor
--- 80,85 ----
/** The wanted length of the previous edge */
! private String number = "";
/**
* Constructor
***************
*** 104,143 ****
*/
protected void findPencilTarget(MouseEvent event) {
- splitE1 = null;
- splitE2 = null;
int x = event.getX();
int y = event.getY();
View view = glv.getView();
! List selection = view.getObjectAtPoint(x, y);
! Vertex intersection = null;
if (selection.isEmpty()) {
target = null;
} else {
! if (selection.size() > 1) {
! Edge e1 = (Edge) selection.get(0);
! Vertex v1 = e1.getTo().minus(e1.getFrom());
! for (int i = 1; (i < selection.size()) && intersection == null; i++) {
! Edge e2 = (Edge) selection.get(i);
! Vertex v2 = e2.getTo().minus(e2.getFrom());
! Vertex cross = v1.cross(v2);
! if (!cross.isZero()) {
! Edge intersect = e1.intersection(e2);
! if (intersect != null) {
! if (intersect.getLength() < 0.0000001) {
! intersection = intersect.getFrom();
! splitE1 = e1;
! splitE2 = e2;
! }
! }
! }
! }
! if (intersection != null) {
! target = intersection;
! } else {
! target = e1;
! }
! } else {
! target = selection.get(0);
! }
}
}
--- 97,108 ----
*/
protected void findPencilTarget(MouseEvent event) {
int x = event.getX();
int y = event.getY();
View view = glv.getView();
! List selection = view.getObjectAtPoint(x, y, new HashSet(), true);
if (selection.isEmpty()) {
target = null;
} else {
! target = selection.get(0);
}
}
***************
*** 526,530 ****
Vertex vertex = intersection.getFrom();
current = vertex;
- splitE1 = edge;
}
} else {
--- 491,494 ----
|