Thread: [Bprocessor-commit] gl/src/net/sourceforge/bprocessor/gl/view View.java, 1.125, 1.126
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2006-08-03 15:41:19
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14642/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Added tempoary constructors to the view and implemented selection drawing of coordinatesystems. Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.125 retrieving revision 1.126 diff -C2 -d -r1.125 -r1.126 *** View.java 2 Aug 2006 12:25:34 -0000 1.125 --- View.java 3 Aug 2006 14:36:57 -0000 1.126 *************** *** 295,298 **** --- 295,301 ---- private boolean backLabelSelect = false; + /** Temporary constructors. Will be drawn but not put in database */ + private Set tempConstructors; + /** Temporary edges. Will be drawn but not put in database */ private Set tempEdges; *************** *** 427,430 **** --- 430,434 ---- backColor = BACK_COLOR; noneColor = NONE_COLOR; + tempConstructors = new HashSet(); tempEdges = new HashSet(); tempSurfaces = new HashSet(); *************** *** 729,733 **** gl.glVertex3d(v1.getX(), v1.getY(), v1.getZ()); gl.glVertex3d(v2.getX(), v2.getY(), v2.getZ()); - } gl.glEnd(); --- 733,736 ---- *************** *** 1027,1031 **** while (iter.hasNext()) { Edge current = (Edge) iter.next(); ! if (current.getConstructor()) { edges.add(current); } --- 1030,1034 ---- while (iter.hasNext()) { Edge current = (Edge) iter.next(); ! if (current.getStrippled()) { edges.add(current); } *************** *** 1049,1062 **** private void drawConstructors() { Space active = Project.getInstance().getActiveSpace(); while (true) { if (active != null) { Collection cons = active.getConstructors(); Iterator iter = cons.iterator(); - - - Camera camera = Project.getInstance().getCurrentCamera(); - Vertex v = new Vertex(camera.getCamera()); - double scale = (camera.getFocalwidth() / 65) * (500 / height); - double dist = v.minus(new Vertex(camera.getCenter())).length() * scale; CoordinateSystem cs = Project.getInstance().getActiveCoordinateSystem(); while (iter.hasNext()) { --- 1052,1063 ---- private void drawConstructors() { Space active = Project.getInstance().getActiveSpace(); + Camera camera = Project.getInstance().getCurrentCamera(); + Vertex v = new Vertex(camera.getCamera()); + double scale = (camera.getFocalwidth() / 65) * (500 / height); + double dist = v.minus(new Vertex(camera.getCenter())).length() * scale; while (true) { if (active != null) { Collection cons = active.getConstructors(); Iterator iter = cons.iterator(); CoordinateSystem cs = Project.getInstance().getActiveCoordinateSystem(); while (iter.hasNext()) { *************** *** 1064,1068 **** Constructor c = (Constructor)o; if (camera.getType() == Camera.PERSPECTIVE) { ! dist = (c.getOrigin().minus(v)).length() * scale; } if (target != c && !highligts.contains(c)) { --- 1065,1069 ---- Constructor c = (Constructor)o; if (camera.getType() == Camera.PERSPECTIVE) { ! dist = (c.getOrigin().distance(v)) * scale; } if (target != c && !highligts.contains(c)) { *************** *** 1076,1079 **** --- 1077,1088 ---- active = active.getOwner(); } + Iterator iter = tempConstructors.iterator(); + while (iter.hasNext()) { + Constructor c = (Constructor)iter.next(); + if (camera.getType() == Camera.PERSPECTIVE) { + dist = (c.getOrigin().distance(v)) * scale; + } + drawGeneralConstructor(c, dist, true); + } } *************** *** 1259,1263 **** if (color != null) { gl.glColor3fv(color); ! if (current.getConstructor()) { drawConstructor(current); } else { --- 1268,1272 ---- if (color != null) { gl.glColor3fv(color); ! if (current.getStrippled()) { drawConstructor(current); } else { *************** *** 1265,1269 **** } gl.glColor3fv(lineColor); ! } else if (current.getConstructor()) { gl.glColor3fv(constructorColor); drawConstructor(current); --- 1274,1278 ---- } gl.glColor3fv(lineColor); ! } else if (current.getStrippled()) { gl.glColor3fv(constructorColor); drawConstructor(current); *************** *** 1797,1802 **** double dist = v.minus(new Vertex(camera.getCenter())).length() * scale; ! ! Iterator iter = space.getConstructors().iterator(); while (iter.hasNext()) { Constructor current = (Constructor) iter.next(); --- 1806,1813 ---- double dist = v.minus(new Vertex(camera.getCenter())).length() * scale; ! Collection all = new LinkedList(); ! all.addAll(space.getConstructors()); ! all.addAll(tempConstructors); ! Iterator iter = all.iterator(); while (iter.hasNext()) { Constructor current = (Constructor) iter.next(); *************** *** 1815,1819 **** Edge guide = line.edge(View.gridSize() * 2); if (current.isEditable()) { ! Vertex tip = line.tip(dist / 16 + dist / 20); pushName(gl, tip); drawVertexHit(tip); --- 1826,1830 ---- Edge guide = line.edge(View.gridSize() * 2); if (current.isEditable()) { ! Vertex tip = line.tip(dist / 10); pushName(gl, tip); drawVertexHit(tip); *************** *** 1827,1835 **** } else if (current instanceof CoordinateSystem) { CoordinateSystem system = (CoordinateSystem) current; ! Surface surface = system.surface(5); ! if (system.isActive() && system.onlyPlane()) { ! pushName(gl, surface); ! drawSurface(surface); ! popName(gl); } } --- 1838,1857 ---- } else if (current instanceof CoordinateSystem) { CoordinateSystem system = (CoordinateSystem) current; ! if (system.isActive()) { ! if (system.onlyPlane()) { ! Surface surface = system.surface(5); ! pushName(gl, surface); ! drawSurface(surface); ! popName(gl); ! } else { ! List tmp = system.edges(View.gridSize() * 2); ! Iterator tmpiter = tmp.iterator(); ! while (tmpiter.hasNext()) { ! Edge e = (Edge)tmpiter.next(); ! pushName(gl, e); ! drawEdge(e); ! popName(gl); ! } ! } } } *************** *** 2216,2225 **** if (edge != null) { edges.remove(edge); ! if (edge.getConstructor()) { Iterator iter = edges.iterator(); while (iter.hasNext()) { Edge current = (Edge) iter.next(); ! if (!current.getConstructor()) { if (edge.intersects(current.getFrom()) && edge.intersects(current.getTo())) { edge = current; --- 2238,2247 ---- if (edge != null) { edges.remove(edge); ! if (edge.getStrippled()) { Iterator iter = edges.iterator(); while (iter.hasNext()) { Edge current = (Edge) iter.next(); ! if (!current.getStrippled()) { if (edge.intersects(current.getFrom()) && edge.intersects(current.getTo())) { edge = current; *************** *** 2241,2245 **** } else { if (edge != null) { - { Vertex m = edge.getFrom().add(edge.getTo()); --- 2263,2266 ---- *************** *** 2304,2308 **** return new Intersection(intersection, Intersection.EDGE, edge); } - } else { if (surface != null) { --- 2325,2328 ---- *************** *** 2952,2954 **** --- 2972,2990 ---- return constructorColor; } + + /** + * Add a constructor to the tempoary constructors + * @param constructor the constructor + */ + public void addTempConstructor(Constructor constructor) { + tempConstructors.add(constructor); + } + + /** + * Remove a constructor from the set of tempoary constructors + * @param c the constructor to remove + */ + public void removeTempConstructor(Constructor c) { + tempConstructors.remove(c); + } } |