[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Project.java,1.26,1.27 Mesh.java,1.3,
Status: Pre-Alpha
Brought to you by:
henryml
|
From: Michael L. <he...@us...> - 2006-01-27 11:21:12
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17756/src/net/sourceforge/bprocessor/model Modified Files: Project.java Mesh.java Log Message: Vertices, Edges and Surfaces moved to Mesh Index: Mesh.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Mesh.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Mesh.java 27 Jan 2006 10:54:36 -0000 1.3 --- Mesh.java 27 Jan 2006 11:20:59 -0000 1.4 *************** *** 46,49 **** --- 46,60 ---- } + /** + * Clear this mesh + */ + public void clear() { + vertices.clear(); + nextVertexId = 0; + edges.clear(); + nextEdgeId = 0; + surfaces.clear(); + nextSurfaceId = 0; + } /** *************** *** 186,189 **** --- 197,210 ---- */ public void remove(Surface surface) { + Space back = surface.getBackDomain(); + if (back != null) { + back.removeSurface(surface); + surface.setBackDomain(null); + } + Space front = surface.getFrontDomain(); + if (front != null) { + front.removeSurface(surface); + surface.setFrontDomain(null); + } surfaces.remove(surface.getId()); surface.setId(null); Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Project.java 27 Jan 2006 10:54:36 -0000 1.26 --- Project.java 27 Jan 2006 11:20:59 -0000 1.27 *************** *** 37,58 **** private Mesh mesh; ! /** The vertices */ ! private HashMap vertices = new HashMap(); ! /** The vertex id */ ! private long vertexId; ! ! /** The edges */ ! private HashMap edges = new HashMap(); ! /** The edge id */ ! private long edgeId; ! ! /** The surfaces */ ! private HashMap surfaces = new HashMap(); ! /** The surface id */ ! private long surfaceId; ! ! /** The domains */ private HashMap spaces = new HashMap(); ! /** The domain id */ private long spaceId; --- 37,43 ---- private Mesh mesh; ! /** The spaces */ private HashMap spaces = new HashMap(); ! /** The space id */ private long spaceId; *************** *** 124,131 **** public void clear() { spaces.clear(); - edges.clear(); - surfaces.clear(); - vertices.clear(); cameras.clear(); addCams(); changed(this); --- 109,114 ---- public void clear() { spaces.clear(); cameras.clear(); + mesh.clear(); addCams(); changed(this); *************** *** 181,199 **** /** - * Find a domain by id - * @param id The id - * @return The domain - */ - public Space findSpaceById(Long id) { - return (Space) spaces.get(id); - } - - /** * Intern an edge ! * @param e The edge */ ! public void add(Edge e) { ! e.setId(new Long(edgeId++)); ! edges.put(e.getId(), e); changed(this); makeDirty(); --- 164,172 ---- /** * Intern an edge ! * @param edge The edge */ ! public void add(Edge edge) { ! mesh.add(edge); changed(this); makeDirty(); *************** *** 222,230 **** /** * Remove an edge ! * @param e The edge */ ! public void remove(Edge e) { ! edges.remove(e.getId()); ! e.setId(null); changed(this); makeDirty(); --- 195,202 ---- /** * Remove an edge ! * @param edge The edge */ ! public void remove(Edge edge) { ! mesh.delete(edge); changed(this); makeDirty(); *************** *** 236,249 **** */ public Collection getEdges() { ! return edges.values(); ! } ! ! /** ! * Find an edge by id ! * @param id The id ! * @return The edge ! */ ! public Edge findEdgeById(Long id) { ! return (Edge) edges.get(id); } --- 208,212 ---- */ public Collection getEdges() { ! return mesh.getEdges(); } *************** *** 291,300 **** /** ! * Intern a surface ! * @param s The surface */ ! public void add(Surface s) { ! s.setId(new Long(surfaceId++)); ! surfaces.put(s.getId(), s); changed(this); makeDirty(); --- 254,262 ---- /** ! * Add a surface ! * @param surface The surface */ ! public void add(Surface surface) { ! mesh.add(surface); changed(this); makeDirty(); *************** *** 303,321 **** /** * Remove a surface ! * @param s The surface */ ! public void remove(Surface s) { ! Space back = s.getBackDomain(); ! if (back != null) { ! back.removeSurface(s); ! s.setBackDomain(null); ! } ! Space front = s.getFrontDomain(); ! if (front != null) { ! front.removeSurface(s); ! s.setFrontDomain(null); ! } ! surfaces.remove(s.getId()); ! s.setId(null); changed(this); makeDirty(); --- 265,272 ---- /** * Remove a surface ! * @param surface The surface */ ! public void remove(Surface surface) { ! mesh.remove(surface); changed(this); makeDirty(); *************** *** 348,370 **** */ public Collection getSurfaces() { ! return surfaces.values(); ! } ! ! /** ! * Find a surface by id ! * @param id The id ! * @return The surface ! */ ! public Surface findSurfaceById(Long id) { ! return (Surface) surfaces.get(id); } /** * Intern a vertex ! * @param v The vertex */ ! public void add(Vertex v) { ! v.setId(new Long(vertexId++)); ! vertices.put(v.getId(), v); changed(this); makeDirty(); --- 299,311 ---- */ public Collection getSurfaces() { ! return mesh.getSurfaces(); } /** * Intern a vertex ! * @param vertex The vertex */ ! public void add(Vertex vertex) { ! mesh.add(vertex); changed(this); makeDirty(); *************** *** 373,381 **** /** * Remove a vertex ! * @param v The vertex */ ! public void remove(Vertex v) { ! vertices.remove(v.getId()); ! v.setId(null); changed(this); makeDirty(); --- 314,321 ---- /** * Remove a vertex ! * @param vertex The vertex */ ! public void remove(Vertex vertex) { ! mesh.remove(vertex); changed(this); makeDirty(); *************** *** 387,396 **** */ public void delete(Vertex vertex) { ! if (vertex.getId() != null) { ! Set edges = vertex.getEdges(); ! if (edges.size() < 1) { ! remove(vertex); ! } ! } makeDirty(); } --- 327,331 ---- */ public void delete(Vertex vertex) { ! mesh.delete(vertex); makeDirty(); } *************** *** 401,418 **** */ public Collection getVertices() { ! return vertices.values(); ! } ! ! /** ! * Find a vertex by id ! * @param id The id ! * @return The vertex ! */ ! public Vertex findVertexById(Long id) { ! return (Vertex) vertices.get(id); } /** ! * Intern a camera * @param c The camera */ --- 336,344 ---- */ public Collection getVertices() { ! return mesh.getVertices(); } /** ! * Add a camera * @param c The camera */ |