Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv1240/src/net/sourceforge/bprocessor/gl/tool
Modified Files:
SelectStrategy.java
Log Message:
Extending selection
Index: SelectStrategy.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectStrategy.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** SelectStrategy.java 15 Apr 2007 11:04:57 -0000 1.10
--- SelectStrategy.java 9 May 2007 09:33:42 -0000 1.11
***************
*** 11,14 ****
--- 11,15 ----
import java.util.HashSet;
import java.util.Iterator;
+ import java.util.LinkedList;
import java.util.List;
***************
*** 23,26 ****
--- 24,28 ----
import net.sourceforge.bprocessor.model.Edge;
import net.sourceforge.bprocessor.model.Geometric;
+ import net.sourceforge.bprocessor.model.Geometry;
import net.sourceforge.bprocessor.model.Project;
import net.sourceforge.bprocessor.model.Selection;
***************
*** 110,134 ****
View view = glv.getView();
target = view.getObjectAtPoint(x, y, View.OBJECTS);
if (e.getClickCount() >= 2) {
! if (target instanceof Space) {
! Space space = (Space) target;
! space.edit();
! } else if (target instanceof Surface) {
! Surface surface = (Surface) target;
! if (surface.getBackDomain() != null) {
! selection.addAll(surface.getBackDomain().getEnvelope());
}
! if (surface.getFrontDomain() != null) {
! selection.addAll(surface.getFrontDomain().getEnvelope());
}
- } else if (target instanceof Constructor) {
- Constructor c = (Constructor)target;
- c.setActive(!c.isActive());
- } else if (target instanceof ClippingPlane) {
- ClippingPlane cp = (ClippingPlane)target;
- cp.setActive(!cp.isActive());
- } else if (target instanceof GlCamera) {
- GlCamera glcam = (GlCamera)target;
- Project.getInstance().setCurrentCamera(glcam.getCamera());
}
} else {
--- 112,173 ----
View view = glv.getView();
target = view.getObjectAtPoint(x, y, View.OBJECTS);
+
+
+
if (e.getClickCount() >= 2) {
! if (e.getClickCount() == 2) {
! Collection<Geometric> extended = new HashSet();
! extended.addAll(Selection.primary());
! for (Geometric current : Selection.primary()) {
! if (current instanceof Edge) {
! Edge edge = (Edge) current;
! extended.addAll(edge.getSurfaces());
! }
! if (current instanceof Surface) {
! Surface surface = (Surface) current;
! extended.addAll(surface.getEdges());
! }
}
! Selection.primary().clear();
! Selection.primary().addAll(extended);
! } else {
! int size = 0;
! Collection<Vertex> vertices = Geometry.collect(Selection.primary());
! Collection<Edge> edges = new LinkedList<Edge>();
! while (vertices.size() > size) {
! size = vertices.size();
! edges = Vertex.edges(vertices);
! vertices = Geometry.collect(edges);
! }
! Collection<Surface> surfaces = Edge.surfaces(edges);
! Collection<Geometric> geometrics = new HashSet<Geometric>();
! geometrics.addAll(surfaces);
! geometrics.addAll(edges);
! geometrics.addAll(vertices);
! Selection.primary().set(geometrics);
! }
!
! if (1 < 0) {
! if (target instanceof Space) {
! Space space = (Space) target;
! space.edit();
! } else if (target instanceof Surface) {
! Surface surface = (Surface) target;
! if (surface.getBackDomain() != null) {
! selection.addAll(surface.getBackDomain().getEnvelope());
! }
! if (surface.getFrontDomain() != null) {
! selection.addAll(surface.getFrontDomain().getEnvelope());
! }
! } else if (target instanceof Constructor) {
! Constructor c = (Constructor)target;
! c.setActive(!c.isActive());
! } else if (target instanceof ClippingPlane) {
! ClippingPlane cp = (ClippingPlane)target;
! cp.setActive(!cp.isActive());
! } else if (target instanceof GlCamera) {
! GlCamera glcam = (GlCamera)target;
! Project.getInstance().setCurrentCamera(glcam.getCamera());
}
}
} else {
|