bprocessor-commit Mailing List for B-processor (Page 160)
Status: Pre-Alpha
Brought to you by:
henryml
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(117) |
Aug
(151) |
Sep
(157) |
Oct
(81) |
Nov
(117) |
Dec
(119) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(183) |
Feb
(130) |
Mar
(117) |
Apr
(61) |
May
(82) |
Jun
(45) |
Jul
(149) |
Aug
(173) |
Sep
(199) |
Oct
(165) |
Nov
(107) |
Dec
(137) |
2007 |
Jan
(124) |
Feb
(58) |
Mar
(123) |
Apr
(80) |
May
(130) |
Jun
(64) |
Jul
(31) |
Aug
(42) |
Sep
(114) |
Oct
(167) |
Nov
(239) |
Dec
(200) |
2008 |
Jan
(43) |
Feb
(43) |
Mar
(4) |
Apr
(9) |
May
(5) |
Jun
(1) |
Jul
(3) |
Aug
(3) |
Sep
(13) |
Oct
(9) |
Nov
(12) |
Dec
|
2009 |
Jan
|
Feb
(20) |
Mar
(7) |
Apr
(12) |
May
(34) |
Jun
(72) |
Jul
|
Aug
(3) |
Sep
(31) |
Oct
(2) |
Nov
(8) |
Dec
(4) |
2010 |
Jan
(5) |
Feb
(32) |
Mar
(8) |
Apr
(7) |
May
(36) |
Jun
|
Jul
(11) |
Aug
(15) |
Sep
(7) |
Oct
(2) |
Nov
(13) |
Dec
(80) |
2011 |
Jan
|
Feb
|
Mar
(8) |
Apr
(12) |
May
(32) |
Jun
(9) |
Jul
(5) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
(8) |
2012 |
Jan
|
Feb
|
Mar
(3) |
Apr
(5) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(22) |
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: rimestad <rim...@us...> - 2005-09-20 17:25:36
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9655 Modified Files: MoveTool.java Log Message: added cancel on ESC and corrected calculation of a ray Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** MoveTool.java 20 Sep 2005 12:43:33 -0000 1.12 --- MoveTool.java 20 Sep 2005 17:25:26 -0000 1.13 *************** *** 8,12 **** import net.sourceforge.bprocessor.gl.GLView; ! import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.gl.view.Transformation; --- 8,12 ---- import net.sourceforge.bprocessor.gl.GLView; ! import net.sourceforge.bprocessor.gl.view.AbstractView; import net.sourceforge.bprocessor.gl.view.Transformation; *************** *** 43,51 **** private Vertex initial; /** The previous X coordinate */ ! private int previousX = 0; /** The previous Y cordinate */ ! private int previousY = 0; /** The plane to drag according to */ --- 43,57 ---- private Vertex initial; + /** The parent location (total drag) */ + private Vertex parentPos; + + /** The location to move from */ + private Vertex from; + /** The previous X coordinate */ ! private double previousX = 0; /** The previous Y cordinate */ ! private double previousY = 0; /** The plane to drag according to */ *************** *** 70,93 **** if (target != null) { ! dragPlane = findMovePlane(); initial = glv.getView().toPlaneCoords(new double[] {previousX, previousY}, dragPlane); } - log.info("plane: " + dragPlane); } /** * Finds the plan to move the element on * @return The movement plane */ ! protected Plane findMovePlane() { Plane temp = null; //indicating wherther or not we are moving an inner surface boolean inner = false; ! if (target instanceof Vertex) { ! temp = new Plane(0, 0, 1, 0); ! } else if (target instanceof Edge) { ! temp = new Plane(0, 0, 1, 0); ! } else if (target instanceof Surface) { ! Surface sel = (Surface)target; inner = sel.getIsInner(); temp = sel.plane(); --- 76,101 ---- if (target != null) { ! dragPlane = findMovePlane(target); initial = glv.getView().toPlaneCoords(new double[] {previousX, previousY}, dragPlane); + parentPos = new Vertex("parent", initial.getX(), initial.getY(), initial.getZ()); + from = new Vertex("from", initial.getX(), initial.getY(), initial.getZ()); } } /** * Finds the plan to move the element on + * @param o The object to find a plane for * @return The movement plane */ ! protected Plane findMovePlane(Object o) { Plane temp = null; //indicating wherther or not we are moving an inner surface boolean inner = false; ! if (o instanceof Vertex) { ! temp = new Plane(0, 0, 1, -((Vertex)o).getZ()); ! } else if (o instanceof Edge) { ! temp = new Plane(0, 0, 1, -((Edge)o).getTo().getZ()); ! } else if (o instanceof Surface) { ! Surface sel = (Surface)o; inner = sel.getIsInner(); temp = sel.plane(); *************** *** 96,101 **** if (moveMode == XZ && !inner) { Transformation trans = glv.getView().transformation(); ! int x = previousX; ! int y = previousY; Vertex near = new Vertex("near", x, y, 0.0); Vertex far = new Vertex("far", x, y, 1.0); --- 104,109 ---- if (moveMode == XZ && !inner) { Transformation trans = glv.getView().transformation(); ! double x = previousX; ! double y = AbstractView.getHeight() - previousY; Vertex near = new Vertex("near", x, y, 0.0); Vertex far = new Vertex("far", x, y, 1.0); *************** *** 114,119 **** --- 122,129 ---- super.released(e); + from = null; initial = null; dragPlane = null; + parentPos = null; } *************** *** 126,141 **** int x = e.getX(); int y = e.getY(); ! ! View view = glv.getView(); ! Vertex from = view.toPlaneCoords(new double[] {previousX, previousY}, dragPlane); ! Vertex to = view.toPlaneCoords(new double[] {x, y}, dragPlane); ! Vertex delta = to.minus(from); if (log.isDebugEnabled()) { log.debug("from " + from.getX() + ", " + from.getY() + ", " + from.getZ()); - log.debug("to " + to.getX() + ", " + to.getY() + ", " + to.getZ()); log.debug("delta " + delta.getX() + ", " + delta.getY() + ", " + delta.getZ()); } move(selection, delta); ! glv.setLength(to.minus(initial).length()); } --- 136,162 ---- int x = e.getX(); int y = e.getY(); ! ! parentPos = glv.getView().toPlaneCoords(new double[] {x, y}, dragPlane); ! Vertex delta = parentPos.minus(from); if (log.isDebugEnabled()) { log.debug("from " + from.getX() + ", " + from.getY() + ", " + from.getZ()); log.debug("delta " + delta.getX() + ", " + delta.getY() + ", " + delta.getZ()); } + + Vertex v = initial.minus(parentPos); + Vertex appr = initial.minus(from); + if (Math.abs(v.getX()) < .25) { + delta.setX(appr.getX()); + } + if (Math.abs(v.getY()) < .25) { + delta.setY(appr.getY()); + } + if (Math.abs(v.getZ()) < .25) { + delta.setZ(appr.getZ()); + } + move(selection, delta); ! from.move(delta.getX(), delta.getY(), delta.getZ()); ! glv.setLength(from.minus(initial).length()); } *************** *** 172,181 **** moveMode = XY; if (target != null) { ! dragPlane = findMovePlane(); } } else if (e.getKeyCode() == KeyEvent.VK_S) { moveMode = XZ; if (target != null) { ! dragPlane = findMovePlane(); } } else { --- 193,207 ---- moveMode = XY; if (target != null) { ! dragPlane = findMovePlane(target); } } else if (e.getKeyCode() == KeyEvent.VK_S) { moveMode = XZ; if (target != null) { ! dragPlane = findMovePlane(target); ! } ! } else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { ! if (dragPlane != null) { ! dragPlane = null; ! move(selection, initial.minus(parentPos)); } } else { |
From: rimestad <rim...@us...> - 2005-09-20 17:21:53
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9025/src/net/sourceforge/bprocessor/gui Modified Files: GUI.java Log Message: added methods so that menu and tooltip should only use heavy components and therefore not conflict with JOGL Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GUI.java 23 Aug 2005 10:47:27 -0000 1.7 --- GUI.java 20 Sep 2005 17:21:45 -0000 1.8 *************** *** 34,37 **** --- 34,39 ---- import javax.swing.JSplitPane; import javax.swing.JTabbedPane; + import javax.swing.ToolTipManager; + import javax.swing.JPopupMenu; import org.apache.log4j.Logger; *************** *** 89,92 **** --- 91,96 ---- Menu menu = Menu.getInstance(); menu.setMainWindow(this); + ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false); + JPopupMenu.setDefaultLightWeightPopupEnabled(false); // File menu |
From: rimestad <rim...@us...> - 2005-09-20 17:19:53
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8475/src/net/sourceforge/bprocessor/model Modified Files: Plane.java Log Message: corrected bug in plane.orthoPlane() now d is right Index: Plane.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Plane.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Plane.java 2 Sep 2005 13:38:13 -0000 1.5 --- Plane.java 20 Sep 2005 17:19:42 -0000 1.6 *************** *** 5,11 **** // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- - package net.sourceforge.bprocessor.model; /** * The Plane --- 5,12 ---- // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.model; + import org.apache.log4j.Logger; + /** * The Plane *************** *** 14,17 **** --- 15,20 ---- */ public class Plane { + /** The logger */ + private static Logger log = Logger.getLogger(Plane.class); /** The coefficient a */ *************** *** 57,61 **** Vertex temp = alfa.cross(beta); Vertex norm = temp.cross(beta); ! return new Plane(norm.getX(), norm.getY(), norm.getZ(), d); } --- 60,70 ---- Vertex temp = alfa.cross(beta); Vertex norm = temp.cross(beta); ! norm.scale(1 / norm.length()); ! Vertex intersec = intersection(rayIn); ! double a = norm.getX(); ! double b = norm.getY(); ! double c = norm.getZ(); ! double d = -a * intersec.getX() - b * intersec.getY() - c * intersec.getZ(); ! return new Plane(a, b, c, d); } |
From: Jesper P. <je...@us...> - 2005-09-20 13:15:14
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16407 Modified Files: PencilTool.java Log Message: Use debug channel for logging Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** PencilTool.java 14 Sep 2005 14:02:13 -0000 1.19 --- PencilTool.java 20 Sep 2005 13:15:05 -0000 1.20 *************** *** 130,134 **** */ void onVertex(Vertex vertex) { ! System.out.println(vertex); setAlignVertex(vertex); number = ""; --- 130,136 ---- */ void onVertex(Vertex vertex) { ! if (log.isDebugEnabled()) { ! log.debug(vertex); ! } setAlignVertex(vertex); number = ""; |
From: Jesper P. <je...@us...> - 2005-09-20 13:14:39
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16159 Modified Files: Transformation.java Log Message: Use a logger Index: Transformation.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/Transformation.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Transformation.java 31 Aug 2005 07:02:51 -0000 1.4 --- Transformation.java 20 Sep 2005 13:14:24 -0000 1.5 *************** *** 18,21 **** --- 18,23 ---- import net.sourceforge.bprocessor.model.Vertex; + import org.apache.log4j.Logger; + /** * The Transformation is represented by the two matrices *************** *** 25,28 **** --- 27,32 ---- */ public class Transformation { + /** The logger */ + private static Logger log = Logger.getLogger(Transformation.class); /** The glu */ *************** *** 108,112 **** boolean success = glu.gluProject(x, y, z, modelview, projection, viewport, view); if (!success) { ! System.out.println("error projecting"); } Vertex projection = new Vertex("projection of " + vertex.getName()); --- 112,116 ---- boolean success = glu.gluProject(x, y, z, modelview, projection, viewport, view); if (!success) { ! log.error("error projecting"); } Vertex projection = new Vertex("projection of " + vertex.getName()); *************** *** 161,165 **** boolean success = glu.gluUnProject(x, y, z, modelview, projection, viewport, view); if (!success) { ! System.out.println("error un-projecting"); } Vertex projection = new Vertex("un-projection of " + vertex.getName()); --- 165,169 ---- boolean success = glu.gluUnProject(x, y, z, modelview, projection, viewport, view); if (!success) { ! log.error("error un-projecting"); } Vertex projection = new Vertex("un-projection of " + vertex.getName()); |
From: Jesper P. <je...@us...> - 2005-09-20 13:14:20
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16104 Modified Files: AbstractView.java Log Message: Removed unused System.currentTimeMillis() Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** AbstractView.java 16 Sep 2005 12:09:07 -0000 1.29 --- AbstractView.java 20 Sep 2005 13:14:09 -0000 1.30 *************** *** 202,206 **** */ public void display(GLDrawable gld) { - long before = System.currentTimeMillis(); gl = gld.getGL(); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); --- 202,205 ---- *************** *** 275,281 **** gld.swapBuffers(); } - - long after = System.currentTimeMillis(); - long ellapsed = after - before; } --- 274,277 ---- |
From: Jesper P. <je...@us...> - 2005-09-20 12:56:59
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12323/src/net/sourceforge/bprocessor/model Modified Files: AttributeFacade.java ConstructionSpaceFacade.java DomainFacade.java EdgeFacade.java ElementFacade.java FunctionalSpaceFacade.java PartFacade.java SurfaceFacade.java VertexFacade.java Log Message: tx.rollback() when an exception is thrown Index: ConstructionSpaceFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ConstructionSpaceFacade.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ConstructionSpaceFacade.java 20 Sep 2005 12:26:39 -0000 1.7 --- ConstructionSpaceFacade.java 20 Sep 2005 12:56:45 -0000 1.8 *************** *** 54,60 **** public synchronized ConstructionSpace create(ConstructionSpace c) { HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); session.save(c); --- 54,61 ---- public synchronized ConstructionSpace create(ConstructionSpace c) { HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); session.save(c); *************** *** 65,68 **** --- 66,72 ---- Notifier.getInstance().sendNotification(n); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 79,85 **** public synchronized void update(ConstructionSpace c) { HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); session.update(c); --- 83,90 ---- public synchronized void update(ConstructionSpace c) { HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); session.update(c); *************** *** 90,93 **** --- 95,101 ---- Notifier.getInstance().sendNotification(n); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 102,105 **** --- 110,115 ---- public synchronized void remove(ConstructionSpace c) { HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; + //setting references to this space to null Set surfaces = c.getSurfaces(); *************** *** 121,127 **** } } try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); session.delete(c); --- 131,138 ---- } } + try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); session.delete(c); *************** *** 132,135 **** --- 143,149 ---- Notifier.getInstance().sendNotification(n); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 146,152 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); Query q = session.createQuery("SELECT c FROM ConstructionSpace AS c"); --- 160,167 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); Query q = session.createQuery("SELECT c FROM ConstructionSpace AS c"); *************** *** 159,162 **** --- 174,180 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 176,182 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); result = (ConstructionSpace)session.load(ConstructionSpace.class, id); --- 194,201 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); result = (ConstructionSpace)session.load(ConstructionSpace.class, id); *************** *** 184,187 **** --- 203,209 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 201,207 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); Query q = session.createQuery("SELECT c FROM ConstructionSpace AS c WHERE c.name = :name"); --- 223,230 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); Query q = session.createQuery("SELECT c FROM ConstructionSpace AS c WHERE c.name = :name"); *************** *** 215,218 **** --- 238,244 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 232,243 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); ! Query q = session.createQuery("SELECT f FROM ConstructionSpace AS f," + "Domain AS d " + "JOIN d.surfaces AS surfaces " + ! "WHERE surfaces.id = :id AND d.id = f.id"); q.setLong("id", surface.getId().longValue()); --- 258,270 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); ! Query q = session.createQuery("SELECT cs FROM ConstructionSpace AS cs," + "Domain AS d " + "JOIN d.surfaces AS surfaces " + ! "WHERE surfaces.id = :id AND d.id = cs.id"); q.setLong("id", surface.getId().longValue()); *************** *** 248,251 **** --- 275,281 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { Index: ElementFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ElementFacade.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ElementFacade.java 17 Aug 2005 11:22:54 -0000 1.4 --- ElementFacade.java 20 Sep 2005 12:56:45 -0000 1.5 *************** *** 54,60 **** public synchronized Element create(Element e) { HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); session.save(e); --- 54,61 ---- public synchronized Element create(Element e) { HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); session.save(e); *************** *** 65,68 **** --- 66,72 ---- Notifier.getInstance().sendNotification(n); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 79,85 **** public synchronized void update(Element e) { HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); session.update(e); --- 83,90 ---- public synchronized void update(Element e) { HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); session.update(e); *************** *** 90,93 **** --- 95,101 ---- Notifier.getInstance().sendNotification(n); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 102,108 **** public synchronized void remove(Element e) { HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); session.delete(e); --- 110,117 ---- public synchronized void remove(Element e) { HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); session.delete(e); *************** *** 113,116 **** --- 122,128 ---- Notifier.getInstance().sendNotification(n); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 127,133 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); Query q = session.createQuery("SELECT e FROM Element AS e"); --- 139,146 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); Query q = session.createQuery("SELECT e FROM Element AS e"); *************** *** 140,143 **** --- 153,159 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 157,163 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); result = (Element)session.load(Element.class, id); --- 173,180 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); result = (Element)session.load(Element.class, id); *************** *** 165,168 **** --- 182,188 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 182,188 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); Query q = session.createQuery("SELECT e FROM Element AS e WHERE e.name = :name"); --- 202,209 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); Query q = session.createQuery("SELECT e FROM Element AS e WHERE e.name = :name"); *************** *** 196,199 **** --- 217,223 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { Index: AttributeFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/AttributeFacade.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AttributeFacade.java 24 Aug 2005 06:58:06 -0000 1.1 --- AttributeFacade.java 20 Sep 2005 12:56:45 -0000 1.2 *************** *** 47,53 **** public synchronized Attribute create(Attribute a) { HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); session.save(a); --- 47,54 ---- public synchronized Attribute create(Attribute a) { HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); session.save(a); *************** *** 55,58 **** --- 56,62 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 69,75 **** public synchronized void update(Attribute a) { HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); session.update(a); --- 73,80 ---- public synchronized void update(Attribute a) { HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); session.update(a); *************** *** 77,80 **** --- 82,88 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 89,95 **** public synchronized void remove(Attribute a) { HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); session.delete(a); --- 97,104 ---- public synchronized void remove(Attribute a) { HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); session.delete(a); *************** *** 97,100 **** --- 106,112 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 112,118 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); result = (Attribute)session.load(Attribute.class, id); --- 124,131 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); result = (Attribute)session.load(Attribute.class, id); *************** *** 120,123 **** --- 133,139 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { Index: DomainFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/DomainFacade.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DomainFacade.java 20 Sep 2005 12:39:40 -0000 1.1 --- DomainFacade.java 20 Sep 2005 12:56:45 -0000 1.2 *************** *** 52,58 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); Query q = session.createQuery("SELECT d FROM Domain AS d"); --- 52,59 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); Query q = session.createQuery("SELECT d FROM Domain AS d"); *************** *** 65,68 **** --- 66,72 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 82,88 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); result = (Domain)session.load(Domain.class, id); --- 86,93 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); result = (Domain)session.load(Domain.class, id); *************** *** 90,93 **** --- 95,101 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 97,100 **** --- 105,109 ---- return result; } + /** * Find all the domains associated with a surface *************** *** 106,112 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); //this query is wrong --- 115,122 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); //this query is wrong *************** *** 122,125 **** --- 132,138 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { Index: SurfaceFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/SurfaceFacade.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SurfaceFacade.java 20 Sep 2005 12:38:11 -0000 1.8 --- SurfaceFacade.java 20 Sep 2005 12:56:45 -0000 1.9 *************** *** 53,67 **** public synchronized Surface create(Surface s) { HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); session.save(s); tx.commit(); ! Notification n = new Notification(Notification.SURFACE_CREATED, s.getId()); Notifier.getInstance().sendNotification(n); } catch (Exception ex) { log.error(ex.getMessage(), ex); } finally { --- 53,71 ---- public synchronized Surface create(Surface s) { HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); session.save(s); tx.commit(); ! Notification n = new Notification(Notification.SURFACE_CREATED, s.getId()); Notifier.getInstance().sendNotification(n); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 78,84 **** public synchronized void update(Surface s) { HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); session.update(s); --- 82,89 ---- public synchronized void update(Surface s) { HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); session.update(s); *************** *** 89,92 **** --- 94,100 ---- Notifier.getInstance().sendNotification(n); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 113,119 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); session.delete(s); --- 121,128 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); session.delete(s); *************** *** 124,127 **** --- 133,139 ---- Notifier.getInstance().sendNotification(n); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 138,144 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); Query q = session.createQuery("SELECT s FROM Surface AS s"); --- 150,157 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); Query q = session.createQuery("SELECT s FROM Surface AS s"); *************** *** 151,154 **** --- 164,170 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 168,174 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); result = (Surface)session.load(Surface.class, id); --- 184,191 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); result = (Surface)session.load(Surface.class, id); *************** *** 176,179 **** --- 193,199 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 193,199 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); Query q = session.createQuery("SELECT s FROM Surface AS s WHERE s.name = :name"); --- 213,220 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); Query q = session.createQuery("SELECT s FROM Surface AS s WHERE s.name = :name"); *************** *** 207,210 **** --- 228,234 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 224,230 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); Query q = session.createQuery("SELECT s FROM Surface AS s " + --- 248,255 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); Query q = session.createQuery("SELECT s FROM Surface AS s " + *************** *** 240,243 **** --- 265,271 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { Index: VertexFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/VertexFacade.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** VertexFacade.java 17 Aug 2005 11:22:54 -0000 1.5 --- VertexFacade.java 20 Sep 2005 12:56:45 -0000 1.6 *************** *** 54,60 **** public synchronized Vertex create(Vertex v) { HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); session.save(v); --- 54,61 ---- public synchronized Vertex create(Vertex v) { HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); session.save(v); *************** *** 65,68 **** --- 66,72 ---- Notifier.getInstance().sendNotification(n); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 79,85 **** public synchronized void update(Vertex v) { HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); session.update(v); --- 83,90 ---- public synchronized void update(Vertex v) { HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); session.update(v); *************** *** 90,93 **** --- 95,101 ---- Notifier.getInstance().sendNotification(n); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 102,108 **** public synchronized void remove(Vertex v) { HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); session.delete(v); --- 110,117 ---- public synchronized void remove(Vertex v) { HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); session.delete(v); *************** *** 113,116 **** --- 122,128 ---- Notifier.getInstance().sendNotification(n); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 127,133 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); Query q = session.createQuery("SELECT v FROM Vertex AS v"); --- 139,146 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); Query q = session.createQuery("SELECT v FROM Vertex AS v"); *************** *** 140,143 **** --- 153,159 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 157,163 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); result = (Vertex)session.load(Vertex.class, id); --- 173,180 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); result = (Vertex)session.load(Vertex.class, id); *************** *** 165,168 **** --- 182,188 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 182,188 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); Query q = session.createQuery("SELECT v FROM Vertex AS v WHERE v.name = :name"); --- 202,209 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); Query q = session.createQuery("SELECT v FROM Vertex AS v WHERE v.name = :name"); *************** *** 196,199 **** --- 217,223 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 216,222 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); double minX = x - delta; --- 240,247 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); double minX = x - delta; *************** *** 245,248 **** --- 270,276 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { Index: EdgeFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/EdgeFacade.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** EdgeFacade.java 17 Aug 2005 11:22:54 -0000 1.5 --- EdgeFacade.java 20 Sep 2005 12:56:45 -0000 1.6 *************** *** 54,60 **** public synchronized Edge create(Edge e) { HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); session.save(e); --- 54,61 ---- public synchronized Edge create(Edge e) { HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); session.save(e); *************** *** 65,68 **** --- 66,72 ---- Notifier.getInstance().sendNotification(n); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 79,85 **** public synchronized void update(Edge e) { HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); session.update(e); --- 83,90 ---- public synchronized void update(Edge e) { HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); session.update(e); *************** *** 90,93 **** --- 95,101 ---- Notifier.getInstance().sendNotification(n); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 102,108 **** public synchronized void remove(Edge e) { HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); session.delete(e); --- 110,117 ---- public synchronized void remove(Edge e) { HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); session.delete(e); *************** *** 113,116 **** --- 122,128 ---- Notifier.getInstance().sendNotification(n); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 127,133 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); Query q = session.createQuery("SELECT e FROM Edge AS e"); --- 139,146 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); Query q = session.createQuery("SELECT e FROM Edge AS e"); *************** *** 140,143 **** --- 153,159 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 157,163 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); result = (Edge)session.load(Edge.class, id); --- 173,180 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); result = (Edge)session.load(Edge.class, id); *************** *** 165,168 **** --- 182,188 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 182,188 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); Query q = session.createQuery("SELECT e FROM Edge AS e WHERE e.name = :name"); --- 202,209 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); Query q = session.createQuery("SELECT e FROM Edge AS e WHERE e.name = :name"); *************** *** 196,199 **** --- 217,223 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 213,219 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); Query q = session.createQuery("SELECT e FROM Edge AS e " + --- 237,244 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); Query q = session.createQuery("SELECT e FROM Edge AS e " + *************** *** 228,231 **** --- 253,259 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { Index: PartFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/PartFacade.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PartFacade.java 17 Aug 2005 11:22:54 -0000 1.4 --- PartFacade.java 20 Sep 2005 12:56:45 -0000 1.5 *************** *** 54,60 **** public synchronized Part create(Part p) { HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); session.save(p); --- 54,61 ---- public synchronized Part create(Part p) { HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); session.save(p); *************** *** 65,68 **** --- 66,72 ---- Notifier.getInstance().sendNotification(n); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 79,85 **** public synchronized void update(Part p) { HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); session.update(p); --- 83,90 ---- public synchronized void update(Part p) { HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); session.update(p); *************** *** 90,93 **** --- 95,101 ---- Notifier.getInstance().sendNotification(n); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 102,108 **** public synchronized void remove(Part p) { HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); session.delete(p); --- 110,117 ---- public synchronized void remove(Part p) { HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); session.delete(p); *************** *** 113,116 **** --- 122,128 ---- Notifier.getInstance().sendNotification(n); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 127,133 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); Query q = session.createQuery("SELECT p FROM Part AS p"); --- 139,146 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); Query q = session.createQuery("SELECT p FROM Part AS p"); *************** *** 140,143 **** --- 153,159 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 157,163 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); result = (Part)session.load(Part.class, id); --- 173,180 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); result = (Part)session.load(Part.class, id); *************** *** 165,168 **** --- 182,188 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 182,188 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); Query q = session.createQuery("SELECT p FROM Part AS p WHERE p.name = :name"); --- 202,209 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); Query q = session.createQuery("SELECT p FROM Part AS p WHERE p.name = :name"); *************** *** 196,199 **** --- 217,223 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { Index: FunctionalSpaceFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/FunctionalSpaceFacade.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** FunctionalSpaceFacade.java 20 Sep 2005 12:30:26 -0000 1.7 --- FunctionalSpaceFacade.java 20 Sep 2005 12:56:45 -0000 1.8 *************** *** 54,60 **** public synchronized FunctionalSpace create(FunctionalSpace f) { HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); session.save(f); --- 54,61 ---- public synchronized FunctionalSpace create(FunctionalSpace f) { HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); session.save(f); *************** *** 65,68 **** --- 66,72 ---- Notifier.getInstance().sendNotification(n); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 79,85 **** public synchronized void update(FunctionalSpace f) { HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); session.update(f); --- 83,90 ---- public synchronized void update(FunctionalSpace f) { HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); session.update(f); *************** *** 90,93 **** --- 95,101 ---- Notifier.getInstance().sendNotification(n); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 102,105 **** --- 110,115 ---- public synchronized void remove(FunctionalSpace f) { HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; + //setting references to this space to null Set surfaces = f.getSurfaces(); *************** *** 121,127 **** } } try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); session.delete(f); --- 131,138 ---- } } + try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); session.delete(f); *************** *** 132,135 **** --- 143,149 ---- Notifier.getInstance().sendNotification(n); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 146,152 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); Query q = session.createQuery("SELECT f FROM FunctionalSpace AS f"); --- 160,167 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); Query q = session.createQuery("SELECT f FROM FunctionalSpace AS f"); *************** *** 159,162 **** --- 174,180 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 176,182 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); result = (FunctionalSpace)session.load(FunctionalSpace.class, id); --- 194,201 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); result = (FunctionalSpace)session.load(FunctionalSpace.class, id); *************** *** 184,187 **** --- 203,209 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 201,207 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); Query q = session.createQuery("SELECT f FROM FunctionalSpace AS f WHERE f.name = :name"); --- 223,230 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); Query q = session.createQuery("SELECT f FROM FunctionalSpace AS f WHERE f.name = :name"); *************** *** 215,218 **** --- 238,244 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { *************** *** 232,238 **** HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); ! Transaction tx = session.beginTransaction(); Query q = session.createQuery("SELECT f FROM FunctionalSpace AS f," + --- 258,265 ---- HibernateUtil hu = HibernateUtil.getInstance(); + Transaction tx = null; try { Session session = hu.currentSession(); ! tx = session.beginTransaction(); Query q = session.createQuery("SELECT f FROM FunctionalSpace AS f," + *************** *** 248,251 **** --- 275,281 ---- tx.commit(); } catch (Exception ex) { + if (tx != null) { + tx.rollback(); + } log.error(ex.getMessage(), ex); } finally { |
From: Nordholt <nor...@us...> - 2005-09-20 12:54:16
|
Update of /cvsroot/bprocessor/model/src/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11701 Modified Files: bprocessor.xsd Log Message: back and front domain for surfaces Index: bprocessor.xsd =================================================================== RCS file: /cvsroot/bprocessor/model/src/etc/bprocessor.xsd,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** bprocessor.xsd 30 Aug 2005 13:12:33 -0000 1.4 --- bprocessor.xsd 20 Sep 2005 12:54:01 -0000 1.5 *************** *** 74,77 **** --- 74,79 ---- <xsd:element name="edgeref" type="xsd:long" maxOccurs="unbounded" minOccurs="0"/> <xsd:element name="innersurfacesref" type="xsd:long" maxOccurs="unbounded" minOccurs="0"/> + <xsd:element name="backdomainref" type="xsd:long" maxOccurs="1" minOccurs="0"/> + <xsd:element name="frontdomainref" type="xsd:long" maxOccurs="1" minOccurs="0"/> <xsd:element name="isinner" type="xsd:boolean"/> </xsd:sequence> |
From: Nordholt <nor...@us...> - 2005-09-20 12:48:17
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10174 Removed Files: ViewYZ.java Log Message: removed file --- ViewYZ.java DELETED --- |
From: Nordholt <nor...@us...> - 2005-09-20 12:43:49
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9559 Modified Files: MoveTool.java Log Message: inner surfaces now only move in its own plane Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** MoveTool.java 16 Sep 2005 13:01:04 -0000 1.11 --- MoveTool.java 20 Sep 2005 12:43:33 -0000 1.12 *************** *** 82,85 **** --- 82,87 ---- protected Plane findMovePlane() { Plane temp = null; + //indicating wherther or not we are moving an inner surface + boolean inner = false; if (target instanceof Vertex) { temp = new Plane(0, 0, 1, 0); *************** *** 88,95 **** } else if (target instanceof Surface) { Surface sel = (Surface)target; temp = sel.plane(); } // make a orthogonal plane to the current one ! if (moveMode == XZ) { Transformation trans = glv.getView().transformation(); int x = previousX; --- 90,98 ---- } else if (target instanceof Surface) { Surface sel = (Surface)target; + inner = sel.getIsInner(); temp = sel.plane(); } // make a orthogonal plane to the current one ! if (moveMode == XZ && !inner) { Transformation trans = glv.getView().transformation(); int x = previousX; |
From: Nordholt <nor...@us...> - 2005-09-20 12:41:35
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9198 Modified Files: PersistenceManager.java Log Message: added support for the surfaces back and front domains Index: PersistenceManager.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml/PersistenceManager.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PersistenceManager.java 30 Aug 2005 13:19:14 -0000 1.6 --- PersistenceManager.java 20 Sep 2005 12:41:23 -0000 1.7 *************** *** 17,20 **** --- 17,21 ---- import net.sourceforge.bprocessor.model.SurfaceFacade; import net.sourceforge.bprocessor.model.VertexFacade; + import net.sourceforge.bprocessor.model.DomainFacade; import net.sourceforge.bprocessor.model.xml.impl.AttributeImpl; *************** *** 529,532 **** --- 530,538 ---- sm.setInnerSurfaces(isr); } + + Long bid = (Long)(mapper.get(new Long(s.getBackdomainref()))); + sm.setBackDomain(DomainFacade.getInstance().findById(bid)); + Long fid = (Long)(mapper.get(new Long(s.getFrontdomainref()))); + sm.setFrontDomain(DomainFacade.getInstance().findById(fid)); SurfaceFacade.getInstance().update(sm); } |
From: Nordholt <nor...@us...> - 2005-09-20 12:39:48
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8888 Added Files: DomainFacade.java Log Message: first commit --- NEW FILE: DomainFacade.java --- //--------------------------------------------------------------------------------- // $Id: DomainFacade.java,v 1.1 2005/09/20 12:39:40 nordholt Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.model; import net.sourceforge.bprocessor.model.db.HibernateUtil; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import org.apache.log4j.Logger; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.Transaction; /** * Facade for Domains */ public class DomainFacade { /** The logger */ private Logger log = Logger.getLogger(DomainFacade.class); /** The instance */ private static DomainFacade instance; /** * Constructor */ private DomainFacade() { } /** * Get the instance * @return the instance */ public static synchronized DomainFacade getInstance() { if (instance == null) { instance = new DomainFacade(); } return instance; } /** * Find all domains * @return the set of all domains */ public synchronized Set findAll() { Set result = new HashSet(); HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); Transaction tx = session.beginTransaction(); Query q = session.createQuery("SELECT d FROM Domain AS d"); Iterator it = q.iterate(); while (it.hasNext()) { result.add((Domain)it.next()); } tx.commit(); } catch (Exception ex) { log.error(ex.getMessage(), ex); } finally { hu.closeSession(); } return result; } /** * Find a domain by id * @param id The id * @return The domain */ public synchronized Domain findById(Long id) { Domain result = null; HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); Transaction tx = session.beginTransaction(); result = (Domain)session.load(Domain.class, id); tx.commit(); } catch (Exception ex) { log.error(ex.getMessage(), ex); } finally { hu.closeSession(); } return result; } /** * Find all the domains associated with a surface * @param surface the surface * @return the set of domains */ public Set findBySurface(Surface surface) { Set result = new HashSet(); HibernateUtil hu = HibernateUtil.getInstance(); try { Session session = hu.currentSession(); Transaction tx = session.beginTransaction(); //this query is wrong Query q = session.createQuery("SELECT d FROM Domain AS d " + "JOIN d.surfaces AS surfaces " + "WHERE surfaces.id = :id AND d.id = f.id"); q.setLong("id", surface.getId().longValue()); Iterator it = q.iterate(); while (it.hasNext()) { result.add((Domain)it.next()); } tx.commit(); } catch (Exception ex) { log.error(ex.getMessage(), ex); } finally { hu.closeSession(); } return result; } } |
From: Nordholt <nor...@us...> - 2005-09-20 12:38:22
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8675 Modified Files: SurfaceFacade.java Log Message: removed 50millis sleep and now makes sure to remove surface from its front and back domain when removed Index: SurfaceFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/SurfaceFacade.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SurfaceFacade.java 13 Sep 2005 17:28:48 -0000 1.7 --- SurfaceFacade.java 20 Sep 2005 12:38:11 -0000 1.8 *************** *** 57,69 **** Transaction tx = session.beginTransaction(); - session.save(s); tx.commit(); ! ! //a sleep here seems to help making everything not crash(as badly) ! //not sure why though, someone should find out! ! Thread.sleep(50); ! Notification n = new Notification(Notification.SURFACE_CREATED, s.getId()); Notifier.getInstance().sendNotification(n); --- 57,64 ---- Transaction tx = session.beginTransaction(); session.save(s); tx.commit(); ! Notification n = new Notification(Notification.SURFACE_CREATED, s.getId()); Notifier.getInstance().sendNotification(n); *************** *** 108,126 **** //from any domain to which it belongs. ! //This breaks the decoupling and should be changed! ! Set fsSet = FunctionalSpaceFacade.getInstance().findBySurface(s); ! Iterator fsIt = fsSet.iterator(); ! while (fsIt.hasNext()) { ! FunctionalSpace fs = (FunctionalSpace)fsIt.next(); ! fs.removeSurface(s); ! FunctionalSpaceFacade.getInstance().update(fs); } ! ! Set csSet = ConstructionSpaceFacade.getInstance().findBySurface(s); ! Iterator csIt = csSet.iterator(); ! while (csIt.hasNext()) { ! ConstructionSpace cs = (ConstructionSpace)csIt.next(); ! cs.removeSurface(s); ! ConstructionSpaceFacade.getInstance().update(cs); } --- 103,113 ---- //from any domain to which it belongs. ! Domain back = s.getBackDomain(); ! if (back != null) { ! back.removeSurface(s); } ! Domain front = s.getFrontDomain(); ! if (front != null) { ! front.removeSurface(s); } |
From: Nordholt <nor...@us...> - 2005-09-20 12:35:05
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8111 Modified Files: Surface.java Log Message: Added front and back domain, and constraints for moveing innersurfaces(still buggy) Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Surface.java 14 Sep 2005 06:47:47 -0000 1.22 --- Surface.java 20 Sep 2005 12:34:52 -0000 1.23 *************** *** 45,48 **** --- 45,54 ---- private boolean isInner; + /** The domain in front of the surface */ + private Domain frontDomain; + + /** The domain behind the surface */ + private Domain backDomain; + /** * Constructor for persistence layer *************** *** 62,65 **** --- 68,73 ---- setEdges(null); setInnerSurfaces(null); + setBackDomain(null); + setFrontDomain(null); } *************** *** 126,130 **** constructor = c; } ! /** * Get the edges --- 134,138 ---- constructor = c; } ! /** * Get the edges *************** *** 262,267 **** --- 270,406 ---- } } + + if (this.isInner) { + Set surfaces = SurfaceFacade.getInstance().findAll(); + Iterator surfIt = surfaces.iterator(); + while (surfIt.hasNext()) { + Surface surf = (Surface)surfIt.next(); + Set inners = surf.getInnerSurfaces(); + if (inners != null) { + Iterator innerIt = inners.iterator(); + while (innerIt.hasNext()) { + Surface innerSurf = (Surface)innerIt.next(); + if (innerSurf.equals(this)) { + if (!containedCheck(this, surf)) { + this.move(-dx, -dy, -dz); + } + } + } + } + } + } + SurfaceFacade.getInstance().update(this); } + + /** + * Checks if a hole is contained in a surface, given that the hole and the + * surface is in the same plane. + * @param hole the hole + * @param surf the surface + * @return boolean indicating werther or not the hole is contained in the plane. + */ + private boolean containedCheck(Surface hole, Surface surf) { + /*this is done by aplying the crossing numbers algorithm on every vertex + *of the hole. Using the edges of the hole as rays we cover two vertecies + *at a time. + */ + List holeEdges = hole.getEdges(); + Iterator holeIt = holeEdges.iterator(); + Edge holeEdge = null; + boolean contained = true; + if (holeIt.hasNext()) { + holeEdge = (Edge)holeIt.next(); + contained = crossingNumbers(holeEdge, surf); + } + while (holeIt.hasNext() && contained) { + holeEdge = (Edge)holeIt.next(); + if (holeIt.hasNext()) { + holeEdge = (Edge)holeIt.next(); + if (!crossingNumbers(holeEdge, surf)) { + contained = false; + } + } + } + return contained; + } + + /** + * The crossing numbers algorithm to check if an edge is contained in an other surface. + * @param edge the edge. + * @param surf the surface. + * @return a boolean werther or not the edge is contained + */ + private boolean crossingNumbers(Edge edge, Surface surf) { + List surfEdges = surf.getEdges(); + Iterator surfIt = surfEdges.iterator(); + Edge holeEdge = edge; + Vertex holeOr = holeEdge.getTo(); + Vertex holeDir = holeEdge.getFrom().minus(holeOr); + holeDir.scale(1 / holeDir.length()); + boolean contained = true; + int crossings = 0; + while (surfIt.hasNext() && contained) { + Edge surfEdge = (Edge)surfIt.next(); + //in order to find intersections we get a parametrizied version of the edges + //the origin point and direction vector for the surface edge + Vertex surfOr = surfEdge.getTo(); + Vertex surfDir = surfEdge.getFrom().minus(surfOr); + surfDir.scale(1 / surfDir.length()); + //formulars for finding intersections taken from http://www.realtimerendering.com/int/#I304 + Vertex dirCross = surfDir.cross(holeDir); + double denominator = dirCross.length() * dirCross.length(); + if (denominator != 0) { + Vertex orSubs = holeOr.minus(surfOr); + double surfDet = orSubs.determinant(holeDir, dirCross); + double holeDet = orSubs.determinant(surfDir, dirCross); + double tSurf = surfDet / denominator; + double tHole = holeDet / denominator; + double epsilon = 0.00001; + //checking if there is an intersection and if it is within the line segments + if ((tSurf > 0) && (tHole > 0) && + (Math.abs((surfOr.getX() + surfDir.getX() * tSurf) - + (holeOr.getX() + holeDir.getX() * tHole)) + < epsilon) && + (Math.abs((surfOr.getY() + surfDir.getY() * tSurf) - + (holeOr.getY() + holeDir.getY() * tHole)) + < epsilon) && + (Math.abs((surfOr.getZ() + surfDir.getZ() * tSurf) - + (holeOr.getZ() + holeDir.getZ() * tHole)) + < epsilon)) { + //the parameters for the "from" point on the edges + double tSurfFrom = 0; + double tHoleFrom = 0; + if (surfDir.getX() != 0) { + tSurfFrom = ((surfEdge.getFrom().getX() - surfOr.getX()) / surfDir.getX()); + } else if (surfDir.getY() != 0) { + tSurfFrom = ((surfEdge.getFrom().getY() - surfOr.getY()) / surfDir.getY()); + } else if (surfDir.getZ() != 0 && holeDir.getZ() != 0) { + tSurfFrom = ((surfEdge.getFrom().getZ() - surfOr.getZ()) / surfDir.getZ()); + } else { + log.warn("outer surface edge has a zero vector direction vector"); + } + if (holeDir.getX() != 0) { + tHoleFrom = ((holeEdge.getFrom().getX() - holeOr.getX()) / holeDir.getX()); + } else if (holeDir.getY() != 0) { + tHoleFrom = ((holeEdge.getFrom().getY() - holeOr.getY()) / holeDir.getY()); + } else if (holeDir.getZ() != 0) { + tHoleFrom = ((holeEdge.getFrom().getZ() - holeOr.getZ()) / holeDir.getZ()); + } else { + log.warn("inner surface edge has a zero vector direction vector"); + } + if (tHoleFrom > tHole) { + contained = false; + } else if (tSurfFrom >= tSurf) { + crossings++; + } + } + } + } + if (crossings % 2 == 0) { + contained = false; + } + return contained; + } /** *************** *** 306,310 **** this.isInner = isInner; } ! /** --- 445,485 ---- this.isInner = isInner; } ! ! /** ! * Get the domain behind the surface ! * @return the backdomain ! * @hibernate.many-to-one ! * column="BACK_DOMAIN_ID" ! * class="net.sourceforge.bprocessor.model.Domain" ! */ ! public Domain getBackDomain() { ! return backDomain; ! } ! ! /** ! * Set the domain behind the surface ! * @param back the domain ! */ ! public void setBackDomain(Domain back) { ! backDomain = back; ! } ! ! /** ! * Get the domain in front of the surface ! * @return the frontdomain ! * @hibernate.many-to-one ! * column="FRONT_DOMAIN_ID" ! * class="net.sourceforge.bprocessor.model.Domain" ! */ ! public Domain getFrontDomain() { ! return frontDomain; ! } ! /** ! * Set the domain in front of the surface ! * @param front the frontdomain ! */ ! public void setFrontDomain(Domain front) { ! frontDomain = front; ! } /** |
From: Nordholt <nor...@us...> - 2005-09-20 12:30:34
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7340 Modified Files: FunctionalSpaceFacade.java Log Message: Making sure the surfaces domians are set to null when spaces are removed Index: FunctionalSpaceFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/FunctionalSpaceFacade.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FunctionalSpaceFacade.java 12 Sep 2005 18:19:53 -0000 1.6 --- FunctionalSpaceFacade.java 20 Sep 2005 12:30:26 -0000 1.7 *************** *** 102,105 **** --- 102,124 ---- public synchronized void remove(FunctionalSpace f) { HibernateUtil hu = HibernateUtil.getInstance(); + //setting references to this space to null + Set surfaces = f.getSurfaces(); + if (surfaces != null) { + Iterator surfIt = surfaces.iterator(); + while (surfIt.hasNext()) { + Surface surface = (Surface)surfIt.next(); + Domain back = surface.getBackDomain(); + if (back.equals(f)) { + surface.setBackDomain(null); + SurfaceFacade.getInstance().update(surface); + } else { + Domain front = surface.getFrontDomain(); + if (front.equals(f)) { + surface.setFrontDomain(null); + SurfaceFacade.getInstance().update(surface); + } + } + } + } try { Session session = hu.currentSession(); |
From: Nordholt <nor...@us...> - 2005-09-20 12:26:55
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6695 Modified Files: ConstructionSpaceFacade.java Log Message: Making sure the surfaces domians are set to null when spaces are removed Index: ConstructionSpaceFacade.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ConstructionSpaceFacade.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ConstructionSpaceFacade.java 14 Sep 2005 14:06:19 -0000 1.6 --- ConstructionSpaceFacade.java 20 Sep 2005 12:26:39 -0000 1.7 *************** *** 102,105 **** --- 102,124 ---- public synchronized void remove(ConstructionSpace c) { HibernateUtil hu = HibernateUtil.getInstance(); + //setting references to this space to null + Set surfaces = c.getSurfaces(); + if (surfaces != null) { + Iterator surfIt = surfaces.iterator(); + while (surfIt.hasNext()) { + Surface surface = (Surface)surfIt.next(); + Domain back = surface.getBackDomain(); + if (back.equals(c)) { + surface.setBackDomain(null); + SurfaceFacade.getInstance().update(surface); + } else { + Domain front = surface.getFrontDomain(); + if (front.equals(c)) { + surface.setFrontDomain(null); + SurfaceFacade.getInstance().update(surface); + } + } + } + } try { Session session = hu.currentSession(); |
From: Nordholt <nor...@us...> - 2005-09-20 12:24:17
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6222 Modified Files: ExtrusionTool.java Log Message: Now sets the back domain of the extruded surfaces Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ExtrusionTool.java 16 Sep 2005 13:01:04 -0000 1.11 --- ExtrusionTool.java 20 Sep 2005 12:23:59 -0000 1.12 *************** *** 20,24 **** import net.sourceforge.bprocessor.model.ConstructionSpaceFacade; import net.sourceforge.bprocessor.model.FunctionalSpace; ! import net.sourceforge.bprocessor.model.Space; import net.sourceforge.bprocessor.model.Plane; --- 20,24 ---- import net.sourceforge.bprocessor.model.ConstructionSpaceFacade; import net.sourceforge.bprocessor.model.FunctionalSpace; ! import net.sourceforge.bprocessor.model.Domain; import net.sourceforge.bprocessor.model.Plane; *************** *** 72,76 **** dragSurface = selectedSurface; } else { - log.info("IS NOT EXTRUDABLE!!!"); dragSurface = createExtension(selectedSurface); } --- 72,75 ---- *************** *** 192,196 **** private Surface extendSurface(Surface extendSurf) { ConstructionSpace newCSpace = new ConstructionSpace("innerSpace"); ! Space outer = extendSurf.getFrontSpace(); Edge previousEdge = null; Vertex previousVertex = null; --- 191,196 ---- private Surface extendSurface(Surface extendSurf) { ConstructionSpace newCSpace = new ConstructionSpace("innerSpace"); ! newCSpace = ConstructionSpaceFacade.getInstance().create(newCSpace); ! Domain outer = extendSurf.getFrontDomain(); Edge previousEdge = null; Vertex previousVertex = null; *************** *** 200,203 **** --- 200,204 ---- List top = new ArrayList(edges.size()); newCSpace.addSurface(extendSurf); + extendSurf.setBackDomain(newCSpace); Iterator i = edges.iterator(); Edge current = null; *************** *** 255,260 **** --- 256,263 ---- Surface sur = createSurface(newEdges); newCSpace.addSurface(sur); + sur.setBackDomain(newCSpace); if (outer != null) { outer.addSurface(sur); + sur.setBackDomain(outer); } newEdges = new ArrayList(); *************** *** 273,282 **** } } ! ConstructionSpaceFacade.getInstance().create(newCSpace); Surface topSurf = createSurface(top); if (outer != null) { outer.addSurface(topSurf); } newCSpace.addSurface(topSurf); Notification n = new Notification(Notification.SURFACE_SELECTED, topSurf.getId()); Notifier.getInstance().sendNotification(n); --- 276,289 ---- } } ! //moving this line to the top ! //ConstructionSpaceFacade.getInstance().create(newCSpace); ! ConstructionSpaceFacade.getInstance().update(newCSpace); Surface topSurf = createSurface(top); if (outer != null) { outer.addSurface(topSurf); + topSurf.setBackDomain(outer); } newCSpace.addSurface(topSurf); + topSurf.setBackDomain(newCSpace); Notification n = new Notification(Notification.SURFACE_SELECTED, topSurf.getId()); Notifier.getInstance().sendNotification(n); |
From: Jesper P. <je...@us...> - 2005-09-20 12:19:12
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/db In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5463 Modified Files: HibernateUtil.java Log Message: Use outer join for HSQLDB and implement finalize() Index: HibernateUtil.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/db/HibernateUtil.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** HibernateUtil.java 16 Aug 2005 11:43:41 -0000 1.5 --- HibernateUtil.java 20 Sep 2005 12:18:54 -0000 1.6 *************** *** 70,74 **** if (type == Database.HSQLDB) { cfg.setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"); ! cfg.setProperty("hibernate.use_outer_join", "false"); cfg.setProperty("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver"); } else if (type == Database.POSTGRESQL) { --- 70,74 ---- if (type == Database.HSQLDB) { cfg.setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"); ! cfg.setProperty("hibernate.use_outer_join", "true"); cfg.setProperty("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver"); } else if (type == Database.POSTGRESQL) { *************** *** 80,84 **** log.warn("Defaulting to HSQLDB"); cfg.setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"); ! cfg.setProperty("hibernate.use_outer_join", "false"); cfg.setProperty("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver"); } --- 80,84 ---- log.warn("Defaulting to HSQLDB"); cfg.setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"); ! cfg.setProperty("hibernate.use_outer_join", "true"); cfg.setProperty("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver"); } *************** *** 130,132 **** --- 130,142 ---- public void closeSession() { } + + /** + * Dirty hack + */ + protected void finalize() { + if (sf != null && !sf.isClosed()) { + session.close(); + sf.close(); + } + } } |
From: rimestad <rim...@us...> - 2005-09-16 13:01:20
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3731/tool Modified Files: MoveTool.java ExtrusionTool.java Log Message: Length measurements added Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** MoveTool.java 8 Sep 2005 10:50:09 -0000 1.10 --- MoveTool.java 16 Sep 2005 13:01:04 -0000 1.11 *************** *** 40,43 **** --- 40,46 ---- private int moveMode = XY; + /** The initial movepoint */ + private Vertex initial; + /** The previous X coordinate */ private int previousX = 0; *************** *** 68,71 **** --- 71,75 ---- if (target != null) { dragPlane = findMovePlane(); + initial = glv.getView().toPlaneCoords(new double[] {previousX, previousY}, dragPlane); } log.info("plane: " + dragPlane); *************** *** 88,92 **** // make a orthogonal plane to the current one if (moveMode == XZ) { - log.info("ortho"); Transformation trans = glv.getView().transformation(); int x = previousX; --- 92,95 ---- *************** *** 108,111 **** --- 111,115 ---- super.released(e); + initial = null; dragPlane = null; } *************** *** 121,135 **** View view = glv.getView(); ! double[] from = view.toPlaneCoords(new double[] {previousX, previousY}, dragPlane); ! double[] to = view.toPlaneCoords(new double[] {x, y}, dragPlane); ! double[] delta = new double[] {to[0] - from[0], to[1] - from[1], to[2] - from[2]}; if (log.isDebugEnabled()) { ! log.debug("from " + from[0] + ", " + from[1] + ", " + from[2]); ! log.debug("to " + to[0] + ", " + to[1] + ", " + to[2]); ! log.debug("delta " + delta[0] + ", " + delta[1] + ", " + delta[2]); } move(selection, delta); ! } else { ! log.warn("There were no plane to drag according to"); } --- 125,138 ---- View view = glv.getView(); ! Vertex from = view.toPlaneCoords(new double[] {previousX, previousY}, dragPlane); ! Vertex to = view.toPlaneCoords(new double[] {x, y}, dragPlane); ! Vertex delta = to.minus(from); if (log.isDebugEnabled()) { ! log.debug("from " + from.getX() + ", " + from.getY() + ", " + from.getZ()); ! log.debug("to " + to.getX() + ", " + to.getY() + ", " + to.getZ()); ! log.debug("delta " + delta.getX() + ", " + delta.getY() + ", " + delta.getZ()); } move(selection, delta); ! glv.setLength(to.minus(initial).length()); } *************** *** 143,156 **** * @param delta The movement */ ! private void move(List sel, double[] delta) { Iterator it = sel.iterator(); while (it.hasNext()) { Object elm = it.next(); if (elm instanceof Vertex) { ! ((Vertex)elm).move(delta[0], delta[1], delta[2]); } else if (elm instanceof Edge) { ! ((Edge)elm).move(delta[0], delta[1], delta[2]); } else if (elm instanceof Surface) { ! ((Surface) elm).move(delta[0], delta[1], delta[2]); } } --- 146,159 ---- * @param delta The movement */ ! private void move(List sel, Vertex delta) { Iterator it = sel.iterator(); while (it.hasNext()) { Object elm = it.next(); if (elm instanceof Vertex) { ! ((Vertex)elm).move(delta.getX(), delta.getY(), delta.getZ()); } else if (elm instanceof Edge) { ! ((Edge)elm).move(delta.getX(), delta.getY(), delta.getZ()); } else if (elm instanceof Surface) { ! ((Surface) elm).move(delta.getX(), delta.getY(), delta.getZ()); } } Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ExtrusionTool.java 14 Sep 2005 14:11:36 -0000 1.10 --- ExtrusionTool.java 16 Sep 2005 13:01:04 -0000 1.11 *************** *** 50,53 **** --- 50,56 ---- private int prevY; + /** The extrusion edge */ + private Edge extrusion; + /** * The Constructor *************** *** 76,85 **** normal.scale(1 / normal.length()); View view = glv.getView(); ! double[] from = view.toPlaneCoords(new double[] {prevX, prevY}, dragplane); ! double[] to = view.toPlaneCoords(new double[] {e.getX(), e.getY()}, dragplane); ! double[] delta = new double[] {to[0] - from[0], to[1] - from[1], to[2] - from[2]}; ! double normDotDelta = ((normal.getX() * delta[0]) + ! (normal.getY() * delta[1]) + ! (normal.getZ() * delta[2])); normal.scale(normDotDelta / (normal.length() * normal.length())); //normal.scale(delta); --- 79,86 ---- normal.scale(1 / normal.length()); View view = glv.getView(); ! Vertex from = view.toPlaneCoords(new double[] {prevX, prevY}, dragplane); ! Vertex to = view.toPlaneCoords(new double[] {e.getX(), e.getY()}, dragplane); ! Vertex delta = to.minus(from); ! double normDotDelta = normal.dot(delta); normal.scale(normDotDelta / (normal.length() * normal.length())); //normal.scale(delta); *************** *** 107,110 **** --- 108,114 ---- } } + if (extrusion != null) { + glv.setLength(extrusion.getLength()); + } } } *************** *** 132,135 **** --- 136,140 ---- Edge e = (Edge)it.next(); if (!s.contains(e)) { + extrusion = e; Vertex v1 = e.otherVertex(v); Vertex v2 = v1.minus(v); *************** *** 155,158 **** --- 160,164 ---- prevX = e.getX(); prevY = e.getY(); + if (target instanceof Surface) { Surface selectedSurface = (Surface)target; *************** *** 176,179 **** --- 182,186 ---- super.released(e); dragSurface = null; + extrusion = null; } *************** *** 217,220 **** --- 224,230 ---- previousEdge = tonfrom; previousVertex = newFrom; + + // used for measuring the length of the extrusion + extrusion = ntofrom; } else { if (times == edges.size() - 1 && |
From: rimestad <rim...@us...> - 2005-09-16 12:12:57
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26914 Removed Files: HoleTool.java DrawTool.java Log Message: removed draw and hole tool (pencil have taken their place and --- HoleTool.java DELETED --- --- DrawTool.java DELETED --- |
From: rimestad <rim...@us...> - 2005-09-16 12:09:16
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26033 Modified Files: AbstractView.java View.java View3D.java ViewFactory.java Removed Files: ViewXY.java ViewXZ.java Log Message: the three plan views have bee removed and and Factory changed accordingly and toCanvasCoords is changed to toModelCoords and it now returns a Vertex not a double array Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** AbstractView.java 15 Sep 2005 11:11:47 -0000 1.28 --- AbstractView.java 16 Sep 2005 12:09:07 -0000 1.29 *************** *** 757,769 **** /** - * Return the distance on the canvas matching the given double - * @param dist The window coordinates - * @return The relative distance - */ - public double toCanvasDistance(double dist) { - return 2 * size * aspect * zoomFactor * (dist / height); - } - - /** * Initialize the objectTable and the name-stack * @param gl The GL --- 757,760 ---- *************** *** 906,924 **** /** ! * Return the 3D coordinates for the canvas matching the given 2D coords ! * @return The relative 3D coordinates ! * @param coords The window coordinates */ ! public abstract double[] toCanvasCoords(double[] coords); ! /** ! * Return the 3D coordinates for the canvas matching the given 2D coords ! * @param coords The coordinate to convert ! * @param plane The plane to find intersection with ! * @return The point in 3D */ ! public double[] toPlaneCoords(double[] coords, Plane plane) { ! return toCanvasCoords(coords); ! } /** --- 897,908 ---- /** ! * @see View#toModelCoords */ ! public abstract Vertex toModelCoords(double[] coords); ! /** ! * @see View#toPlaneCoords */ ! public abstract Vertex toPlaneCoords(double[] coords, Plane plane); /** --- ViewXZ.java DELETED --- Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** View.java 7 Sep 2005 11:30:34 -0000 1.11 --- View.java 16 Sep 2005 12:09:07 -0000 1.12 *************** *** 68,91 **** /** ! * Return the 3D coordinates for the canvas matching the given 2D coords ! * @param coords The window coordinates ! * @return The relative 3D coordinates */ ! public double[] toCanvasCoords(double[] coords); ! /** ! * Return the 3D coordinates for the canvas matching the given 2D coords ! * @param coords The window coordinates * @param plane The plane to find intersection with ! * @return The relative 3D coordinates ! */ ! public double[] toPlaneCoords(double[] coords, Plane plane); ! ! /** ! * Return the distance on the canvas matching the given double ! * @param dist The window coordinates ! * @return The relative distance */ ! public double toCanvasDistance(double dist); /** --- 68,84 ---- /** ! * Return the 3D coordinates in the model for the given canvas coords ! * @return The model 3D coordinate ! * @param coords The window coordinate */ ! public Vertex toModelCoords(double[] coords); ! /** ! * Return the 3D coordinates in the model for the intersection with the give plane ! * @param coords The coordinate to convert * @param plane The plane to find intersection with ! * @return The vertex in 3D */ ! public Vertex toPlaneCoords(double[] coords, Plane plane); /** --- ViewXY.java DELETED --- Index: View3D.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View3D.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** View3D.java 6 Sep 2005 08:36:22 -0000 1.15 --- View3D.java 16 Sep 2005 12:09:07 -0000 1.16 *************** *** 189,207 **** /** ! * Return the 3D coordinates for the canvas matching the given 2D coords ! * @return The relative 3D coordinates ! * @param coords The window coordinates */ ! public double[] toCanvasCoords(double[] coords) { return toPlaneCoords(coords, new Plane(0, 0, 1, 0)); } /** ! * Return the point in the space that intersects with the given plane ! * @return The intersection between the ray through the space and the given plane ! * @param coords The screen coordinate ! * @param plane The plane in the space to intersect with */ ! public double[] toPlaneCoords(double[] coords, Plane plane) { if (coords.length == 2 && plane != null) { double x = coords[0]; --- 189,202 ---- /** ! * @see AbstractView#toModelCoords */ ! public Vertex toModelCoords(double[] coords) { return toPlaneCoords(coords, new Plane(0, 0, 1, 0)); } /** ! * @see AbstractView#toPlaneCoords */ ! public Vertex toPlaneCoords(double[] coords, Plane plane) { if (coords.length == 2 && plane != null) { double x = coords[0]; *************** *** 217,225 **** if (vertex != null) { ! return new double[] {vertex.getX(), vertex.getY(), vertex.getZ()}; } } log.warn("Too many arguments"); ! return new double[] {0.0, 0.0, 0.0}; } --- 212,220 ---- if (vertex != null) { ! return vertex; } } log.warn("Too many arguments"); ! return new Vertex(""); } Index: ViewFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/ViewFactory.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ViewFactory.java 7 Sep 2005 11:30:34 -0000 1.6 --- ViewFactory.java 16 Sep 2005 12:09:07 -0000 1.7 *************** *** 28,40 **** private static View view3D; - /** The XY view */ - private static View viewXY; - - /** The XZ view */ - private static View viewXZ; - - /** The YZ view*/ - private static View viewYZ; - /** */ private static ViewFactory factory; --- 28,31 ---- *************** *** 46,52 **** private ViewFactory(GLView glv) { view3D = new View3D(glv); - viewXY = new ViewXY(glv); - viewXZ = new ViewXZ(glv); - viewYZ = new ViewYZ(glv); Toolbar tb = Toolbar.getInstance(); --- 37,40 ---- *************** *** 95,104 **** if (i == View.VIEW_3D) { return view3D; - } else if (i == View.VIEW_XZ) { - return viewXZ; - } else if (i == View.VIEW_XY) { - return viewXY; - } else if (i == View.VIEW_YZ) { - return viewYZ; } else { log.warn("[get] no such view " + i); --- 83,86 ---- |
From: Michael L. <he...@us...> - 2005-09-15 11:11:57
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3695/src/net/sourceforge/bprocessor/gl/view Modified Files: AbstractView.java Log Message: Text Drawing Index: AbstractView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/AbstractView.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** AbstractView.java 14 Sep 2005 14:07:37 -0000 1.27 --- AbstractView.java 15 Sep 2005 11:11:47 -0000 1.28 *************** *** 29,32 **** --- 29,33 ---- import net.java.games.jogl.GLUquadric; import net.java.games.jogl.util.BufferUtils; + import net.java.games.jogl.util.GLUT; import net.java.games.jogl.GLUtesselatorCallbackAdapter; import net.java.games.jogl.GLUtesselatorCallback; *************** *** 90,93 **** --- 91,98 ---- protected GLU glu = null; + /** The GLUT */ + + protected GLUT glut = new GLUT(); + /** The zoomFactor in the parent view */ protected double zoomFactor = 1.0; *************** *** 252,256 **** --- 257,272 ---- gl.glLineWidth(2.0f); drawAll(gld); + + //gl.glMatrixMode(GL.GL_PROJECTION); + //gl.glLoadIdentity(); + //glu.gluOrtho2D(0, width, 0, height); + //gl.glMatrixMode(GL.GL_MODELVIEW); + //gl.glLoadIdentity(); + + //drawTextBox(200, 200, "Space 1"); + + gl.glGetIntegerv(GL.GL_RENDER_MODE, mode); + if (mode[0] == GL.GL_SELECT) { gl.glFlush(); *************** *** 265,268 **** --- 281,311 ---- /** + * Draw string at specified position + * @param x The x position + * @param y The y position + * @param string The string to draw + */ + void drawString(double x, double y, String string) { + gl.glPushMatrix(); + gl.glTranslated(x, y, 0.1); + gl.glRasterPos2i(0, 0); + glut.glutBitmapString(gl, GLUT.BITMAP_HELVETICA_18, string); + gl.glPopMatrix(); + } + + /** + * Draw a box with a string + * @param x The x position + * @param y The y position + * @param string The String + */ + void drawTextBox(double x, double y, String string) { + int width = glut.glutBitmapLength(GLUT.BITMAP_HELVETICA_18, string); + gl.glColor3d(0.85, 0.85, 0.85); + gl.glRectd(x - 4, y - 8, x + width + 4, y + 18); + gl.glColor3d(0, 0, 0); + drawString(x, y, string); + } + /** * Resets the working attributes of the view */ |
From: Jesper P. <je...@us...> - 2005-09-15 08:47:54
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3102/src/net/sourceforge/bprocessor/gui/attrview Modified Files: AttributeView.java Log Message: Added support for DESELECTED notifications Index: AttributeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/AttributeView.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AttributeView.java 11 Jul 2005 08:39:32 -0000 1.4 --- AttributeView.java 15 Sep 2005 08:47:45 -0000 1.5 *************** *** 37,43 **** private AttributesPanel ap; - /** Current object */ - private Object current; - /** * Constructor --- 37,40 ---- *************** *** 50,55 **** addTab("Attributes", ap); - current = null; - Notifier.getInstance().addListener(this); } --- 47,50 ---- *************** *** 68,109 **** FunctionalSpaceFacade fsf = FunctionalSpaceFacade.getInstance(); ! current = fsf.findById(n.getObject()); ap.display(current); - - repaint(); } else if (type.equals(Notification.CONSTRUCTION_SPACE_SELECTED)) { ConstructionSpaceFacade csf = ConstructionSpaceFacade.getInstance(); ! current = csf.findById(n.getObject()); ap.display(current); - - repaint(); } else if (type.equals(Notification.ELEMENT_SELECTED)) { ElementFacade ef = ElementFacade.getInstance(); ! current = ef.findById(n.getObject()); ap.display(current); - - repaint(); } else if (type.equals(Notification.PART_SELECTED)) { PartFacade pf = PartFacade.getInstance(); ! current = pf.findById(n.getObject()); ap.display(current); - - repaint(); } else if (type.equals(Notification.SURFACE_SELECTED)) { SurfaceFacade sf = SurfaceFacade.getInstance(); ! current = sf.findById(n.getObject()); ap.display(current); ! ! repaint(); } } --- 63,103 ---- FunctionalSpaceFacade fsf = FunctionalSpaceFacade.getInstance(); ! Object current = fsf.findById(n.getObject()); ap.display(current); } else if (type.equals(Notification.CONSTRUCTION_SPACE_SELECTED)) { ConstructionSpaceFacade csf = ConstructionSpaceFacade.getInstance(); ! Object current = csf.findById(n.getObject()); ap.display(current); } else if (type.equals(Notification.ELEMENT_SELECTED)) { ElementFacade ef = ElementFacade.getInstance(); ! Object current = ef.findById(n.getObject()); ap.display(current); } else if (type.equals(Notification.PART_SELECTED)) { PartFacade pf = PartFacade.getInstance(); ! Object current = pf.findById(n.getObject()); ap.display(current); } else if (type.equals(Notification.SURFACE_SELECTED)) { SurfaceFacade sf = SurfaceFacade.getInstance(); ! Object current = sf.findById(n.getObject()); ap.display(current); ! } else if (type.equals(Notification.FUNCTIONAL_SPACE_DESELECTED) || ! type.equals(Notification.CONSTRUCTION_SPACE_DESELECTED) || ! type.equals(Notification.ELEMENT_DESELECTED) || ! type.equals(Notification.PART_DESELECTED) || ! type.equals(Notification.SURFACE_DESELECTED)) { ! ! ap.display(null); } + + repaint(); } *************** *** 115,122 **** public boolean isNotificationEnabled(String type) { if (type.equals(Notification.FUNCTIONAL_SPACE_SELECTED) || type.equals(Notification.CONSTRUCTION_SPACE_SELECTED) || type.equals(Notification.ELEMENT_SELECTED) || type.equals(Notification.PART_SELECTED) || ! type.equals(Notification.SURFACE_SELECTED)) { return true; } --- 109,121 ---- public boolean isNotificationEnabled(String type) { if (type.equals(Notification.FUNCTIONAL_SPACE_SELECTED) || + type.equals(Notification.FUNCTIONAL_SPACE_DESELECTED) || type.equals(Notification.CONSTRUCTION_SPACE_SELECTED) || + type.equals(Notification.CONSTRUCTION_SPACE_DESELECTED) || type.equals(Notification.ELEMENT_SELECTED) || + type.equals(Notification.ELEMENT_DESELECTED) || type.equals(Notification.PART_SELECTED) || ! type.equals(Notification.PART_DESELECTED) || ! type.equals(Notification.SURFACE_SELECTED) || ! type.equals(Notification.SURFACE_DESELECTED)) { return true; } *************** *** 148,167 **** List components = new ArrayList(); ! Method[] methods = current.getClass().getMethods(); ! for (int i = 0; i < methods.length; i++) { ! Method m = methods[i]; ! String name = m.getName(); ! if (name.startsWith("get")) { ! if (!name.endsWith("Id") && !name.endsWith("Class")) { ! if (returnTypeSupported(m.getReturnType())) { ! try { ! components.add(new JLabel(m.invoke(current, (Object[])null).toString())); ! if (name.length() > 4) { ! names.add(new JLabel(name.substring(3, 4).toUpperCase() + name.substring(4))); ! } else { ! names.add(new JLabel(name.substring(3, 4).toUpperCase())); } - } catch (Exception e) { - // Cant be accessed } } --- 147,168 ---- List components = new ArrayList(); ! if (current != null) { ! Method[] methods = current.getClass().getMethods(); ! for (int i = 0; i < methods.length; i++) { ! Method m = methods[i]; ! String name = m.getName(); ! if (name.startsWith("get")) { ! if (!name.endsWith("Id") && !name.endsWith("Class")) { ! if (returnTypeSupported(m.getReturnType())) { ! try { ! components.add(new JLabel(m.invoke(current, (Object[])null).toString())); ! if (name.length() > 4) { ! names.add(new JLabel(name.substring(3, 4).toUpperCase() + name.substring(4))); ! } else { ! names.add(new JLabel(name.substring(3, 4).toUpperCase())); ! } ! } catch (Exception e) { ! // Cant be accessed } } } |
From: rimestad <rim...@us...> - 2005-09-14 14:11:45
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27594/tool Modified Files: ExtrusionTool.java Log Message: some comments Index: ExtrusionTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrusionTool.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ExtrusionTool.java 14 Sep 2005 07:02:56 -0000 1.9 --- ExtrusionTool.java 14 Sep 2005 14:11:36 -0000 1.10 *************** *** 44,51 **** private Plane dragplane; ! /** */ private int prevX; ! /** */ private int prevY; --- 44,51 ---- private Plane dragplane; ! /*** the previous x-coordinate */ private int prevX; ! /** the previous y-coordinate */ private int prevY; *************** *** 113,118 **** } - - /** * Checks if a surface is extrudeable --- 113,116 ---- |
From: rimestad <rim...@us...> - 2005-09-14 14:10:55
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27329/tool Modified Files: Tool.java Log Message: just for the beauty of it Index: Tool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Tool.java 9 Sep 2005 12:32:26 -0000 1.6 --- Tool.java 14 Sep 2005 14:10:43 -0000 1.7 *************** *** 19,27 **** public static final int SELECT_TOOL = 0; /** The move tool */ ! public static final int MOVE_TOOL = 2; /** The extrude tool */ ! public static final int EXTRUSION_TOOL = 3; ! /** The pencil tool */ ! public static final int PENCIL_TOOL = 4; /** --- 19,27 ---- public static final int SELECT_TOOL = 0; /** The move tool */ ! public static final int MOVE_TOOL = 1; /** The extrude tool */ ! public static final int EXTRUSION_TOOL = 2; ! /** The debug tool */ ! public static final int PENCIL_TOOL = 3; /** |