bprocessor-commit Mailing List for B-processor (Page 138)
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: Michael L. <he...@us...> - 2006-01-30 10:05:03
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18161/src/net/sourceforge/bprocessor/model Modified Files: Space.java Modellor.java Log Message: Cylinder Example Index: Modellor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Modellor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Modellor.java 28 Nov 2005 22:23:49 -0000 1.1 --- Modellor.java 30 Jan 2006 10:04:50 -0000 1.2 *************** *** 8,12 **** package net.sourceforge.bprocessor.model; - import java.util.List; /** --- 8,11 ---- *************** *** 17,22 **** /** * Generate a list of surfaces. - * @return A list of surfaces */ ! public List generate(); } --- 16,20 ---- /** * Generate a list of surfaces. */ ! public void generate(); } Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Space.java 27 Jan 2006 11:41:08 -0000 1.14 --- Space.java 30 Jan 2006 10:04:50 -0000 1.15 *************** *** 28,34 **** /** The surfaces */ private Set surfaces; ! /** The modellor */ ! private Modellor modellor; ! /** * Constructor for persistence layer --- 28,33 ---- /** The surfaces */ private Set surfaces; ! ! /** * Constructor for persistence layer *************** *** 202,221 **** /** - * Get the modellor - * @return The modellor - */ - public Modellor getModellor() { - return modellor; - } - - /** - * Set the modellor - * @param modellor The modellor - */ - public void setModellor(Modellor modellor) { - this.modellor = modellor; - } - - /** * Return the center of gravity * @return The center vertex --- 201,204 ---- |
From: Michael L. <he...@us...> - 2006-01-30 10:04:59
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18105/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Cylinder Example Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** View.java 25 Jan 2006 14:46:40 -0000 1.51 --- View.java 30 Jan 2006 10:04:45 -0000 1.52 *************** *** 1471,1493 **** while (spaceIter.hasNext()) { Space space = (Space) spaceIter.next(); - if (space.getModellor() != null) { - List surfaces = space.getModellor().generate(); - if (surfaces != null) { - LinkedList edges = new LinkedList(); - HashSet mark = new HashSet(); - collectEdges(surfaces, edges); - gl.glDisable(GL.GL_DEPTH); - gl.glLineWidth(1.0f); - gl.glColor3fv(X_AXIS_COLOR); - Iterator eit = edges.iterator(); - while (eit.hasNext()) { - Edge e = (Edge)eit.next(); - if (!mark.contains(e)) { - drawEdge(e); - mark.add(e); - } - }; - } - } } } --- 1471,1474 ---- |
From: Michael L. <he...@us...> - 2006-01-30 10:04:59
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18105/src/net/sourceforge/bprocessor/gl/tool Modified Files: CatmullClarkActionListener.java SpaceTool.java CatmullClark.java Log Message: Cylinder Example Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SpaceTool.java 23 Jan 2006 10:16:22 -0000 1.8 --- SpaceTool.java 30 Jan 2006 10:04:45 -0000 1.9 *************** *** 12,18 **** --- 12,21 ---- import java.awt.event.ActionListener; import java.awt.event.MouseEvent; + import java.util.Arrays; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; + import java.util.LinkedList; + import java.util.List; import java.util.Set; *************** *** 27,30 **** --- 30,35 ---- import net.sourceforge.bprocessor.model.Constraints; import net.sourceforge.bprocessor.model.CoordinateSystem; + import net.sourceforge.bprocessor.model.Edge; + import net.sourceforge.bprocessor.model.Modellor; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Space; *************** *** 94,97 **** --- 99,114 ---- ); menu.add(offsetItem); + + menu.addSeparator(); + + JMenuItem cylinderItem = new JMenuItem("Cylinder"); + cylinderItem.addActionListener(new MenuAction() { + public void actionPerformed(ActionEvent event) { + createCylinder(selection); + } + } + ); + menu.add(cylinderItem); + return menu; } *************** *** 196,199 **** --- 213,316 ---- } + /** + * The cylinder class parametrically generates a cylinder. + */ + public class Cylinder implements Modellor { + + /** radius */ + private double radius = 1.0; + + /** height */ + private double height = 1.0; + + /** axis divisions */ + private int axisDivisions = 12; + + /** height divisions */ + private int heightDivisions = 1; + + /** cap divisions */ + private int capDivisions = 1; + + /*** + * Generate a Cylinder + */ + public void generate() { + /** Origin */ + Vertex o = new Vertex(0, 0, 0); + /** Bottom vertices */ + Vertex[] bv = new Vertex[axisDivisions]; + /** Top vertices */ + Vertex[] tv = new Vertex[axisDivisions]; + /** Bottom edges */ + Edge[] be = new Edge[axisDivisions]; + /** Top edges */ + Edge te[] = new Edge[axisDivisions]; + /** Side edges */ + Edge se[] = new Edge[axisDivisions]; + /** Side faces */ + Surface sf[] = new Surface[axisDivisions]; + + Surface top; + Surface bottom; + + for (int i = 0; i < axisDivisions; i++) { + double angle = ((2 * Math.PI) * i) / (double) axisDivisions; + double x = radius * Math.cos(angle) + o.getX(); + double y = radius * Math.sin(angle) + o.getY(); + double z = o.getZ(); + bv[i] = new Vertex(x, y, z); + tv[i] = new Vertex(x, y, z + height); + Project.getInstance().add(bv[i]); + Project.getInstance().add(tv[i]); + } + + for (int i = 0; i < axisDivisions; i++) { + be[i] = new Edge(bv[i], bv[(i + 1) % axisDivisions]); + Project.getInstance().add(be[i]); + } + + for (int i = 0; i < axisDivisions; i++) { + te[i] = new Edge(tv[i], tv[(i + 1) % axisDivisions]); + Project.getInstance().add(te[i]); + } + + for (int i = 0; i < axisDivisions; i++) { + se[i] = new Edge(bv[i], tv[i]); + Project.getInstance().add(se[i]); + } + + for (int i = 0; i < axisDivisions; i++) { + List edges = new LinkedList(); + edges.add(be[i]); + edges.add(se[(i + 1) % axisDivisions]); + edges.add(te[i]); + edges.add(se[i]); + sf[i] = new Surface(edges); + Project.getInstance().add(sf[i]); + } + { + List edges = new LinkedList(Arrays.asList(be)); + bottom = new Surface(edges); + Project.getInstance().add(bottom); + } + { + List edges = new LinkedList(Arrays.asList(te)); + top = new Surface(edges); + Project.getInstance().add(top); + } + } + + } + + /** + * Create a cylinder + * @param objects The selection + */ + protected void createCylinder(Collection objects) { + Modellor modellor = new Cylinder(); + modellor.generate(); + } + /** * Creates the correct type popup menu. Index: CatmullClark.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CatmullClark.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CatmullClark.java 27 Jan 2006 11:42:47 -0000 1.5 --- CatmullClark.java 30 Jan 2006 10:04:45 -0000 1.6 *************** *** 20,24 **** import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Space; - import net.sourceforge.bprocessor.model.Modellor; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; --- 20,23 ---- *************** *** 27,31 **** * CatmullClark subdivision */ ! public class CatmullClark implements Modellor { /** The space */ --- 26,30 ---- * CatmullClark subdivision */ ! public class CatmullClark { /** The space */ Index: CatmullClarkActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CatmullClarkActionListener.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CatmullClarkActionListener.java 28 Nov 2005 22:24:50 -0000 1.1 --- CatmullClarkActionListener.java 30 Jan 2006 10:04:45 -0000 1.2 *************** *** 35,39 **** */ public void actionPerformed(ActionEvent event) { ! space.setModellor(new CatmullClark(space)); } --- 35,39 ---- */ public void actionPerformed(ActionEvent event) { ! } |
From: Michael L. <he...@us...> - 2006-01-27 13:18:06
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24919/src/net/sourceforge/bprocessor/model Modified Files: Project.java Mesh.java Log Message: Fixed some delete related bugs Index: Mesh.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Mesh.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Mesh.java 27 Jan 2006 11:39:44 -0000 1.5 --- Mesh.java 27 Jan 2006 13:17:52 -0000 1.6 *************** *** 93,102 **** public void delete(Vertex vertex) { if (vertex.getId() != null) { Set edges = vertex.getEdges(); ! if (edges.size() < 1) { ! remove(vertex); } } - remove(vertex); } --- 93,104 ---- public void delete(Vertex vertex) { if (vertex.getId() != null) { + remove(vertex); Set edges = vertex.getEdges(); ! Iterator iter = edges.iterator(); ! while (iter.hasNext()) { ! Edge current = (Edge) iter.next(); ! delete(current); } } } *************** *** 153,166 **** public void delete(Edge edge) { if (edge.getId() != null) { Set surfaces = edge.getSurfaces(); Iterator it = surfaces.iterator(); while (it.hasNext()) { Surface surface = (Surface)it.next(); ! delete(surface); } - delete(edge.getTo()); - delete(edge.getFrom()); } ! remove(edge); } --- 155,173 ---- public void delete(Edge edge) { if (edge.getId() != null) { + remove(edge); Set surfaces = edge.getSurfaces(); Iterator it = surfaces.iterator(); while (it.hasNext()) { Surface surface = (Surface)it.next(); ! remove(surface); ! } ! if (edge.getTo().getEdges().size() == 0) { ! remove(edge.getTo()); ! } ! if (edge.getFrom().getEdges().size() == 0) { ! remove(edge.getFrom()); } } ! } *************** *** 197,200 **** --- 204,211 ---- */ public void remove(Surface surface) { + if (surface.getExterior() != null) { + Surface exterior = surface.getExterior(); + exterior.removeHole(surface); + } Space back = surface.getBackDomain(); if (back != null) { *************** *** 226,233 **** */ public void delete(Surface surface) { ! if (surface.getExterior() != null) { ! Surface exterior = surface.getExterior(); ! exterior.removeHole(surface); ! } List edges = surface.getEdges(); Iterator it = edges.iterator(); --- 237,241 ---- */ public void delete(Surface surface) { ! remove(surface); List edges = surface.getEdges(); Iterator it = edges.iterator(); *************** *** 238,242 **** } } ! remove(surface); } --- 246,250 ---- } } ! } Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Project.java 27 Jan 2006 11:30:56 -0000 1.28 --- Project.java 27 Jan 2006 13:17:52 -0000 1.29 *************** *** 178,181 **** --- 178,182 ---- public void delete(Edge edge) { mesh.delete(edge); + changed(this); } *************** *** 221,225 **** spaces.remove(space.getId()); space.setId(null); - changed(this); } --- 222,225 ---- *************** *** 230,233 **** --- 230,234 ---- public void delete(Space space) { remove(space); + changed(this); } *************** *** 264,267 **** --- 265,269 ---- public void delete(Surface surface) { mesh.delete(surface); + changed(this); } *************** *** 298,301 **** --- 300,304 ---- public void delete(Vertex vertex) { mesh.delete(vertex); + changed(this); } |
From: rimestad <rim...@us...> - 2006-01-27 12:22:54
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4519/src/net/sourceforge/bprocessor/gl/tool Modified Files: RotationTool.java Log Message: small add so guideline follow Index: RotationTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/RotationTool.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RotationTool.java 27 Jan 2006 11:43:37 -0000 1.4 --- RotationTool.java 27 Jan 2006 12:22:45 -0000 1.5 *************** *** 192,198 **** */ protected void dragged(MouseEvent e) { if (target != null && (xCircle.contains(target) || yCircle.contains(target) || zCircle.contains(target))) { ! initial = findInitial(target, e); // TODO rotate the object from prev to initial --- 192,202 ---- */ protected void dragged(MouseEvent e) { + super.dragged(e); if (target != null && (xCircle.contains(target) || yCircle.contains(target) || zCircle.contains(target))) { ! Vertex ny = findInitial(target, e); ! initial.setX(ny.getX()); ! initial.setY(ny.getY()); ! initial.setZ(ny.getZ()); // TODO rotate the object from prev to initial |
From: rimestad <rim...@us...> - 2006-01-27 11:43:46
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23906/src/net/sourceforge/bprocessor/gl/tool Modified Files: Tool.java ToolFactory.java Added Files: RotationTool.java Log Message: Added first version of Rotation tool for objects, can't rotate yet but do almost all initial stuff for it Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** ToolFactory.java 19 Jan 2006 10:58:12 -0000 1.24 --- ToolFactory.java 27 Jan 2006 11:43:37 -0000 1.25 *************** *** 38,42 **** /** move tool */ private MoveTool move; ! /** extrusion tool */ private SelectTool extrusion; --- 38,45 ---- /** move tool */ private MoveTool move; ! ! /** rotation tool */ ! private RotationTool rotation; ! /** extrusion tool */ private SelectTool extrusion; *************** *** 49,53 **** /** rotation tool */ ! private CameraTool rotation; /** Camera fly tool */ --- 52,56 ---- /** rotation tool */ ! private CameraTool camera; /** Camera fly tool */ *************** *** 98,101 **** --- 101,106 ---- but = tb.registerAction(new MoveAction(glv)); but.setToolTipText("Move"); + but = tb.registerAction(new RotationAction(glv)); + but.setToolTipText("Rotate"); but = tb.registerAction(new ExtrudeAction(glv)); but.setToolTipText("Extrude"); *************** *** 105,110 **** but.setToolTipText("Tape Measure"); tb.addSeparator(); ! but = tb.registerAction(new RotationAction(glv)); ! but.setToolTipText("Rotation"); but = tb.registerAction(new CameraFlyAction(glv)); but.setToolTipText("Fly mode"); --- 110,115 ---- but.setToolTipText("Tape Measure"); tb.addSeparator(); ! but = tb.registerAction(new CameraAction(glv)); ! but.setToolTipText("Camera rotation"); but = tb.registerAction(new CameraFlyAction(glv)); but.setToolTipText("Fly mode"); *************** *** 116,123 **** pencil = new PencilTool(glv, pencilcursor); move = new MoveTool(glv, pencilcursor); extrusion = new ExtrudeTool(glv, pencilcursor); clipplane = new ClipplaneTool(glv, pencilcursor); tapeMeasure = new TapeMeasureTool(glv, pencilcursor); ! rotation = new CameraTool(glv, rotationCursor); fly = new CameraFlyTool(glv, flyCursor); walk = new CameraWalkTool(glv, walkCursor); --- 121,129 ---- pencil = new PencilTool(glv, pencilcursor); move = new MoveTool(glv, pencilcursor); + rotation = new RotationTool(glv, pencilcursor); extrusion = new ExtrudeTool(glv, pencilcursor); clipplane = new ClipplaneTool(glv, pencilcursor); tapeMeasure = new TapeMeasureTool(glv, pencilcursor); ! camera = new CameraTool(glv, rotationCursor); fly = new CameraFlyTool(glv, flyCursor); walk = new CameraWalkTool(glv, walkCursor); *************** *** 166,169 **** --- 172,177 ---- } else if (i == Tool.MOVE_TOOL) { currentTool = move; + } else if (i == Tool.ROTATION_TOOL) { + currentTool = rotation; } else if (i == Tool.EXTRUSION_TOOL) { currentTool = extrusion; *************** *** 172,177 **** } else if (i == Tool.CLIP_TOOL) { currentTool = clipplane; ! } else if (i == Tool.ROTATION_TOOL) { ! currentTool = rotation; } else if (i == Tool.FLY_TOOL) { currentTool = fly; --- 180,185 ---- } else if (i == Tool.CLIP_TOOL) { currentTool = clipplane; ! } else if (i == Tool.CAMERA_TOOL) { ! currentTool = camera; } else if (i == Tool.FLY_TOOL) { currentTool = fly; *************** *** 223,227 **** * The rotation action inner class */ ! class RotationAction extends AbstractAction { /** The GLView */ private GLView glv = null; --- 231,235 ---- * The rotation action inner class */ ! class CameraAction extends AbstractAction { /** The GLView */ private GLView glv = null; *************** *** 231,235 **** * @param glv TheGLView */ ! RotationAction(GLView glv) { this.glv = glv; ClassLoader cl = Thread.currentThread().getContextClassLoader(); --- 239,243 ---- * @param glv TheGLView */ ! CameraAction(GLView glv) { this.glv = glv; ClassLoader cl = Thread.currentThread().getContextClassLoader(); *************** *** 244,248 **** */ public void actionPerformed(ActionEvent e) { ! glv.changeTool(Tool.ROTATION_TOOL); } } --- 252,256 ---- */ public void actionPerformed(ActionEvent e) { ! glv.changeTool(Tool.CAMERA_TOOL); } } *************** *** 333,336 **** --- 341,372 ---- /** + * The rotaion action inner class + */ + class RotationAction extends AbstractAction { + /** The GLView */ + private GLView glv = null; + + /** + * Constructor + * @param glv TheGLView + */ + RotationAction(GLView glv) { + this.glv = glv; + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + URL url = cl.getResource("Biconrotobj.gif"); + ImageIcon im = new ImageIcon(url); + putValue(Action.SMALL_ICON, im); + } + + /** + * Called when the button is pressed + * @param e The ActionEvent + */ + public void actionPerformed(ActionEvent e) { + glv.changeTool(Tool.ROTATION_TOOL); + } + } + + /** * The extrude action inner class */ Index: Tool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Tool.java 15 Dec 2005 12:37:00 -0000 1.16 --- Tool.java 27 Jan 2006 11:43:37 -0000 1.17 *************** *** 30,35 **** /** The Clipping tool */ public static final int CLIP_TOOL = 4; ! /** The Rotation tool */ ! public static final int ROTATION_TOOL = 5; /** The Tape Measure tool */ public static final int TAPE_MEASURE_TOOL = 6; --- 30,35 ---- /** The Clipping tool */ public static final int CLIP_TOOL = 4; ! /** The Camera tool */ ! public static final int CAMERA_TOOL = 5; /** The Tape Measure tool */ public static final int TAPE_MEASURE_TOOL = 6; *************** *** 38,41 **** --- 38,43 ---- /** The walk tool */ public static final int WALK_TOOL = 8; + /** The Rotation tool */ + public static final int ROTATION_TOOL = 9; /** --- NEW FILE: RotationTool.java --- //--------------------------------------------------------------------------------- // $Id: RotationTool.java,v 1.4 2006/01/27 11:43:37 rimestad Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gl.tool; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.model.ClippingPlane; import net.sourceforge.bprocessor.model.Constraints; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Entity; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Selection; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.gl.view.Transformation; import net.sourceforge.bprocessor.gl.view.View; import java.awt.Cursor; import java.awt.event.MouseEvent; import java.awt.event.KeyEvent; import java.util.HashSet; import java.util.Iterator; import org.apache.log4j.Logger; /** * The rotation tool */ public class RotationTool extends SelectTool { /** */ private static final int X_AXIS = 1; /** */ private static final int Y_AXIS = 2; /** */ private static final int Z_AXIS = 3; /** The chosen axis */ private int axis; /** The logger */ private static Logger log = Logger.getLogger(RotationTool.class); /** The initial vertex */ private Vertex initial; /** The vertex at drag start */ private Vertex from; /** The previous vertex when dragging */ private Vertex prev; /** The vertex at drag start */ private Vertex center; /** The maximum distance in x y and z */ private double dist = 0; /** The circle in the xy plane */ private HashSet zCircle = new HashSet(); /** The circle in the zy plane */ private HashSet xCircle = new HashSet(); /** The circle in the xz plane */ private HashSet yCircle = new HashSet(); /** The set containing the guide line */ private HashSet guide = new HashSet(); /** * The Constructor * @param glv The 3D canvas * @param cursor The cursor */ public RotationTool(GLView glv, Cursor cursor) { super(glv, cursor); } /** * Update selection * */ protected void update() { Iterator iter = selection.iterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof Entity) { Constraints.getInstance().update((Entity) o); } } } /** * Invoked when a mouse button has been pressed on a component. * @param e The MouseEvent object */ protected void pressed(MouseEvent e) { super.pressed(e); if (target != null && target instanceof Entity) { // If one edge in a rotate circle are selected all should be if (xCircle.contains(target)) { axis = X_AXIS; Selection.primary().addAll(xCircle); clearConstructors(zCircle); clearConstructors(yCircle); } else if (yCircle.contains(target)) { axis = Y_AXIS; Selection.primary().addAll(yCircle); clearConstructors(xCircle); clearConstructors(zCircle); } else if (zCircle.contains(target)) { axis = Z_AXIS; Selection.primary().addAll(zCircle); clearConstructors(xCircle); clearConstructors(yCircle); } else { // ther were no rotation selection axis = 0; } if (axis != 0) { // do the rotation preparation and wait for drag events initial = findInitial(target, e); from = initial.copy(); prev = initial; Edge edge = new Edge(center, initial); edge.setConstructor(true); guide.clear(); guide.add(edge); displayConstructors(guide); } } else { clearConstructors(xCircle); xCircle.clear(); clearConstructors(yCircle); yCircle.clear(); clearConstructors(zCircle); zCircle.clear(); } } /** * Invoked when a mouse button has been released on a component. * @param e The MouseEvent */ protected void released(MouseEvent e) { super.released(e); if (axis != 0) { // We were rotation so show all constructor line again displayConstructors(xCircle); displayConstructors(yCircle); displayConstructors(zCircle); Selection.primary().clear(); // remove guideline clearConstructors(guide); guide.clear(); } // make selection if (target != null && target instanceof Entity) { if (target instanceof Edge && ((Edge)target).getConstructor()) { // If it is a constructor it should not be rotatable return; } clearConstructors(xCircle); clearConstructors(yCircle); clearConstructors(zCircle); xCircle.clear(); yCircle.clear(); zCircle.clear(); HashSet vertices = new HashSet(); collect(selection, vertices); // find the size of the handles center = ((Entity)target).center(); dist = 0; gatherInformation(center, vertices); drawCircles(((Entity)target).center(), dist); } else { if (axis == 0) { dist = 0; initial = null; from = null; } } } /** * Invoked when the mouse is held pressed and moved * @param e The MouseEvent object */ protected void dragged(MouseEvent e) { if (target != null && (xCircle.contains(target) || yCircle.contains(target) || zCircle.contains(target))) { initial = findInitial(target, e); // TODO rotate the object from prev to initial prev = initial; } } /** * Invoked when a key has been pressed. Lets user control the mode of movement. * After movement in one direction a length can be typed in to adjust the movement * to a specific length. * ESCAPE - cancel movement. * 0-9 - type length in length field. * ENTER - perform move of the specified length. * @param e The KeyEvent */ public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { //TODO rotate object from initial back to from } } /** * Remove tool specific things at tool change * */ public void cleanUp() { clearConstructors(xCircle); clearConstructors(yCircle); clearConstructors(zCircle); xCircle.clear(); yCircle.clear(); zCircle.clear(); } /** * Draw the three circles * @param center The center of the circles * @param radius The radius of the circles */ private void drawCircles(Vertex center, double radius) { zCircle.clear(); double xr = radius; double yr = 0; int segments = 20; double cos = Math.cos(Math.PI * 2.0 / segments); double sin = Math.sin(Math.PI * 2.0 / segments); // DRAW THE XY CIRCLE Vertex first = new Vertex(xr + center.getX(), yr + center.getY(), center.getZ()); Vertex parent = first.copy(); for (int i = 0; i < segments; ++i) { double temp = xr * cos + yr * sin; yr = yr * cos - xr * sin; xr = temp; Vertex prev = parent; parent = new Vertex(xr + center.getX(), yr + center.getY(), center.getZ()); Edge e = new Edge(prev, parent); e.setConstructor(true); zCircle.add(e); } Edge e = new Edge(parent, first); e.setConstructor(true); zCircle.add(e); displayConstructors(zCircle); // DRAW THE YZ CIRCLE xCircle.clear(); yr = radius; double zr = 0; first = new Vertex(center.getX(), yr + center.getY(), zr + center.getZ()); parent = first.copy(); for (int i = 0; i < segments; ++i) { double temp = yr * cos + zr * sin; zr = zr * cos - yr * sin; yr = temp; Vertex prev = parent; parent = new Vertex(center.getX(), yr + center.getY(), zr + center.getZ()); e = new Edge(prev, parent); e.setConstructor(true); xCircle.add(e); } e = new Edge(parent, first); e.setConstructor(true); xCircle.add(e); displayConstructors(xCircle); // DRAW THE XZ CIRCLE yCircle.clear(); xr = radius; zr = 0; first = new Vertex(xr + center.getX(), center.getY(), zr + center.getZ()); parent = first.copy(); for (int i = 0; i < segments; ++i) { double temp = xr * cos + zr * sin; zr = zr * cos - xr * sin; xr = temp; Vertex prev = parent; parent = new Vertex(xr + center.getX(), center.getY(), zr + center.getZ()); e = new Edge(prev, parent); e.setConstructor(true); yCircle.add(e); } e = new Edge(parent, first); e.setConstructor(true); yCircle.add(e); displayConstructors(yCircle); } /** * Gather information about size of bound * @param vertices The vertices to rotate * @param center The center of the element */ private void gatherInformation(Vertex center, HashSet vertices) { Iterator iter = vertices.iterator(); while (iter.hasNext()) { Vertex cur = (Vertex)iter.next(); Vertex temp = cur.minus(center); if (temp.length() > dist) { dist = temp.length(); } } dist *= 1.1; } /** * Finds the initial point clicked for movement. * @param entity the entity initialy clicked * @param e the mouse event associated with the click. * @return the initial point of movement. */ protected Vertex findInitial(Object entity, MouseEvent e) { double x = e.getX(); double y = View.getHeight() - e.getY(); View v = glv.getView(); Transformation transformation = v.transformation(); Vertex near = new Vertex(x, y, 0.0); Vertex far = new Vertex(x, y, 1.0); Edge ray = new Edge(near, far); ray = transformation.unProject(ray); if (entity instanceof Vertex) { return ((Vertex)entity).copy(); } else if (entity instanceof Surface) { Plane plane = ((Surface)entity).plane(); return plane.intersection(ray); } else if (entity instanceof Edge) { Edge edge = (Edge) entity; Edge intersection = edge.intersection(ray); return intersection.getFrom(); } else if (entity instanceof ClippingPlane) { Plane plane = ((ClippingPlane) entity).getPlane(); return plane.intersection(ray); } log.warn("The clicked object is not an Entity"); return null; } } |
From: rimestad <rim...@us...> - 2006-01-27 11:42:56
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23724/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java CatmullClark.java Log Message: Changed the use of center method to Entity Index: CatmullClark.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CatmullClark.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CatmullClark.java 19 Dec 2005 07:51:30 -0000 1.4 --- CatmullClark.java 27 Jan 2006 11:42:47 -0000 1.5 *************** *** 372,377 **** while (iter.hasNext()) { Edge current = (Edge) iter.next(); ! double[] values = current.center(); ! Vertex center = new Vertex(values[0], values[1], values[2]); edgepoints.add(center); edgemap.put(current, center); --- 372,376 ---- while (iter.hasNext()) { Edge current = (Edge) iter.next(); ! Vertex center = current.center(); edgepoints.add(center); edgemap.put(current, center); Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** AbstractTool.java 25 Jan 2006 14:45:25 -0000 1.55 --- AbstractTool.java 27 Jan 2006 11:42:47 -0000 1.56 *************** *** 9,12 **** --- 9,13 ---- import net.sourceforge.bprocessor.model.Camera; import net.sourceforge.bprocessor.model.Edge; + import net.sourceforge.bprocessor.model.Entity; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Project; *************** *** 137,147 **** if (it.hasNext()) { Object o = it.next(); ! if (o instanceof Surface) { ! Vertex v = ((Surface)o).center(); ! center = new double[] {v.getX(), v.getY(), v.getZ()}; ! } else if (o instanceof Edge) { ! center = ((Edge)o).center(); ! } else if (o instanceof Vertex) { ! Vertex v = (Vertex)o; center = new double[] {v.getX(), v.getY(), v.getZ()}; } --- 138,143 ---- if (it.hasNext()) { Object o = it.next(); ! if (o instanceof Entity) { ! Vertex v = ((Entity)o).center(); center = new double[] {v.getX(), v.getY(), v.getZ()}; } *************** *** 212,216 **** glv.changeTool(Tool.MOVE_TOOL); } else if (e.getKeyCode() == KeyEvent.VK_R) { ! glv.changeTool(Tool.ROTATION_TOOL); } else if (e.getKeyCode() == KeyEvent.VK_E) { glv.changeTool(Tool.EXTRUSION_TOOL); --- 208,212 ---- glv.changeTool(Tool.MOVE_TOOL); } else if (e.getKeyCode() == KeyEvent.VK_R) { ! glv.changeTool(Tool.CAMERA_TOOL); } else if (e.getKeyCode() == KeyEvent.VK_E) { glv.changeTool(Tool.EXTRUSION_TOOL); |
From: rimestad <rim...@us...> - 2006-01-27 11:42:07
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23491/src/net/sourceforge/bprocessor/model Modified Files: Entity.java Log Message: Made Entity abstract so that center could be common for Edge, Space, Surface and Vertex. Index: Entity.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Entity.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Entity.java 27 Jan 2006 11:30:56 -0000 1.4 --- Entity.java 27 Jan 2006 11:41:55 -0000 1.5 *************** *** 12,16 **** * The entity class */ ! public class Entity implements Serializable { /** The id */ --- 12,16 ---- * The entity class */ ! public abstract class Entity implements Serializable { /** The id */ *************** *** 51,53 **** --- 51,58 ---- } + /** + * Return the center for the entity + * @return The center as a vertex + */ + public abstract Vertex center(); } |
From: rimestad <rim...@us...> - 2006-01-27 11:41:19
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23360/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Vertex.java Space.java Log Message: Made Entity abstract so that center could be common for Edge, Space, Surface and Vertex. Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Space.java 13 Jan 2006 09:30:01 -0000 1.13 --- Space.java 27 Jan 2006 11:41:08 -0000 1.14 *************** *** 216,218 **** --- 216,226 ---- this.modellor = modellor; } + + /** + * Return the center of gravity + * @return The center vertex + */ + public Vertex center() { + return null; + } } Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Vertex.java 23 Jan 2006 10:16:32 -0000 1.19 --- Vertex.java 27 Jan 2006 11:41:08 -0000 1.20 *************** *** 325,327 **** --- 325,335 ---- ", " + z + "]"; } + + /** + * Return the center (which is the vertex itself) + * @return The center vertex + */ + public Vertex center() { + return this; + } } Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Edge.java 24 Jan 2006 14:10:42 -0000 1.27 --- Edge.java 27 Jan 2006 11:41:07 -0000 1.28 *************** *** 343,351 **** * @return The center point as a double array with x y z */ ! public double[] center() { double x = (to.getX() - from.getX()) / 2.0; double y = (to.getY() - from.getY()) / 2.0; double z = (to.getZ() - from.getZ()) / 2.0; ! return new double[]{from.getX() + x, from.getY() + y, from.getZ() + z}; } --- 343,351 ---- * @return The center point as a double array with x y z */ ! public Vertex center() { double x = (to.getX() - from.getX()) / 2.0; double y = (to.getY() - from.getY()) / 2.0; double z = (to.getZ() - from.getZ()) / 2.0; ! return new Vertex(from.getX() + x, from.getY() + y, from.getZ() + z); } |
From: Michael L. <he...@us...> - 2006-01-27 11:39:52
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22867/src/net/sourceforge/bprocessor/model Modified Files: Mesh.java Log Message: Index: Mesh.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Mesh.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Mesh.java 27 Jan 2006 11:20:59 -0000 1.4 --- Mesh.java 27 Jan 2006 11:39:44 -0000 1.5 *************** *** 157,161 **** while (it.hasNext()) { Surface surface = (Surface)it.next(); ! remove(surface); } delete(edge.getTo()); --- 157,161 ---- while (it.hasNext()) { Surface surface = (Surface)it.next(); ! delete(surface); } delete(edge.getTo()); |
From: Michael L. <he...@us...> - 2006-01-27 11:31:10
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20520/src/net/sourceforge/bprocessor/model Modified Files: Project.java Entity.java Log Message: Clean up Index: Entity.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Entity.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Entity.java 25 Jan 2006 11:05:11 -0000 1.3 --- Entity.java 27 Jan 2006 11:30:56 -0000 1.4 *************** *** 48,52 **** */ public void changed() { - Project.getInstance().makeDirty(); Project.getInstance().changed(this); } --- 48,51 ---- Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Project.java 27 Jan 2006 11:20:59 -0000 1.27 --- Project.java 27 Jan 2006 11:30:56 -0000 1.28 *************** *** 102,105 **** --- 102,106 ---- current.update(entity); } + makeDirty(); } *************** *** 144,148 **** spaces.put(space.getId(), space); changed(this); - makeDirty(); } --- 145,148 ---- *************** *** 170,174 **** mesh.add(edge); changed(this); - makeDirty(); } --- 170,173 ---- *************** *** 178,193 **** */ public void delete(Edge edge) { ! if (edge.getId() != null) { ! Set surfaces = edge.getSurfaces(); ! remove(edge); ! Iterator it = surfaces.iterator(); ! while (it.hasNext()) { ! Surface surface = (Surface)it.next(); ! remove(surface); ! } ! delete(edge.getTo()); ! delete(edge.getFrom()); ! } ! makeDirty(); } --- 177,181 ---- */ public void delete(Edge edge) { ! mesh.delete(edge); } *************** *** 200,204 **** mesh.delete(edge); changed(this); - makeDirty(); } --- 188,191 ---- *************** *** 234,238 **** spaces.remove(space.getId()); space.setId(null); ! makeDirty(); } --- 221,225 ---- spaces.remove(space.getId()); space.setId(null); ! changed(this); } *************** *** 260,264 **** mesh.add(surface); changed(this); - makeDirty(); } --- 247,250 ---- *************** *** 270,274 **** mesh.remove(surface); changed(this); - makeDirty(); } --- 256,259 ---- *************** *** 278,295 **** */ public void delete(Surface surface) { ! if (surface.getExterior() != null) { ! Surface exterior = surface.getExterior(); ! exterior.removeHole(surface); ! } ! remove(surface); ! List edges = surface.getEdges(); ! Iterator it = edges.iterator(); ! while (it.hasNext()) { ! Edge edge = (Edge)it.next(); ! if (edge.getSurfaces().size() < 1) { ! delete(edge); ! } ! } ! makeDirty(); } --- 263,267 ---- */ public void delete(Surface surface) { ! mesh.delete(surface); } *************** *** 309,313 **** mesh.add(vertex); changed(this); - makeDirty(); } --- 281,284 ---- *************** *** 319,323 **** mesh.remove(vertex); changed(this); - makeDirty(); } --- 290,293 ---- *************** *** 328,332 **** public void delete(Vertex vertex) { mesh.delete(vertex); - makeDirty(); } --- 298,301 ---- *************** *** 347,351 **** cameras.put(c.getId(), c); changed(this); - makeDirty(); } --- 316,319 ---- |
From: Michael L. <he...@us...> - 2006-01-27 11:21:12
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17756/src/net/sourceforge/bprocessor/model Modified Files: Project.java Mesh.java Log Message: Vertices, Edges and Surfaces moved to Mesh Index: Mesh.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Mesh.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Mesh.java 27 Jan 2006 10:54:36 -0000 1.3 --- Mesh.java 27 Jan 2006 11:20:59 -0000 1.4 *************** *** 46,49 **** --- 46,60 ---- } + /** + * Clear this mesh + */ + public void clear() { + vertices.clear(); + nextVertexId = 0; + edges.clear(); + nextEdgeId = 0; + surfaces.clear(); + nextSurfaceId = 0; + } /** *************** *** 186,189 **** --- 197,210 ---- */ public void remove(Surface surface) { + Space back = surface.getBackDomain(); + if (back != null) { + back.removeSurface(surface); + surface.setBackDomain(null); + } + Space front = surface.getFrontDomain(); + if (front != null) { + front.removeSurface(surface); + surface.setFrontDomain(null); + } surfaces.remove(surface.getId()); surface.setId(null); Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Project.java 27 Jan 2006 10:54:36 -0000 1.26 --- Project.java 27 Jan 2006 11:20:59 -0000 1.27 *************** *** 37,58 **** private Mesh mesh; ! /** The vertices */ ! private HashMap vertices = new HashMap(); ! /** The vertex id */ ! private long vertexId; ! ! /** The edges */ ! private HashMap edges = new HashMap(); ! /** The edge id */ ! private long edgeId; ! ! /** The surfaces */ ! private HashMap surfaces = new HashMap(); ! /** The surface id */ ! private long surfaceId; ! ! /** The domains */ private HashMap spaces = new HashMap(); ! /** The domain id */ private long spaceId; --- 37,43 ---- private Mesh mesh; ! /** The spaces */ private HashMap spaces = new HashMap(); ! /** The space id */ private long spaceId; *************** *** 124,131 **** public void clear() { spaces.clear(); - edges.clear(); - surfaces.clear(); - vertices.clear(); cameras.clear(); addCams(); changed(this); --- 109,114 ---- public void clear() { spaces.clear(); cameras.clear(); + mesh.clear(); addCams(); changed(this); *************** *** 181,199 **** /** - * Find a domain by id - * @param id The id - * @return The domain - */ - public Space findSpaceById(Long id) { - return (Space) spaces.get(id); - } - - /** * Intern an edge ! * @param e The edge */ ! public void add(Edge e) { ! e.setId(new Long(edgeId++)); ! edges.put(e.getId(), e); changed(this); makeDirty(); --- 164,172 ---- /** * Intern an edge ! * @param edge The edge */ ! public void add(Edge edge) { ! mesh.add(edge); changed(this); makeDirty(); *************** *** 222,230 **** /** * Remove an edge ! * @param e The edge */ ! public void remove(Edge e) { ! edges.remove(e.getId()); ! e.setId(null); changed(this); makeDirty(); --- 195,202 ---- /** * Remove an edge ! * @param edge The edge */ ! public void remove(Edge edge) { ! mesh.delete(edge); changed(this); makeDirty(); *************** *** 236,249 **** */ public Collection getEdges() { ! return edges.values(); ! } ! ! /** ! * Find an edge by id ! * @param id The id ! * @return The edge ! */ ! public Edge findEdgeById(Long id) { ! return (Edge) edges.get(id); } --- 208,212 ---- */ public Collection getEdges() { ! return mesh.getEdges(); } *************** *** 291,300 **** /** ! * Intern a surface ! * @param s The surface */ ! public void add(Surface s) { ! s.setId(new Long(surfaceId++)); ! surfaces.put(s.getId(), s); changed(this); makeDirty(); --- 254,262 ---- /** ! * Add a surface ! * @param surface The surface */ ! public void add(Surface surface) { ! mesh.add(surface); changed(this); makeDirty(); *************** *** 303,321 **** /** * Remove a surface ! * @param s The surface */ ! public void remove(Surface s) { ! Space back = s.getBackDomain(); ! if (back != null) { ! back.removeSurface(s); ! s.setBackDomain(null); ! } ! Space front = s.getFrontDomain(); ! if (front != null) { ! front.removeSurface(s); ! s.setFrontDomain(null); ! } ! surfaces.remove(s.getId()); ! s.setId(null); changed(this); makeDirty(); --- 265,272 ---- /** * Remove a surface ! * @param surface The surface */ ! public void remove(Surface surface) { ! mesh.remove(surface); changed(this); makeDirty(); *************** *** 348,370 **** */ public Collection getSurfaces() { ! return surfaces.values(); ! } ! ! /** ! * Find a surface by id ! * @param id The id ! * @return The surface ! */ ! public Surface findSurfaceById(Long id) { ! return (Surface) surfaces.get(id); } /** * Intern a vertex ! * @param v The vertex */ ! public void add(Vertex v) { ! v.setId(new Long(vertexId++)); ! vertices.put(v.getId(), v); changed(this); makeDirty(); --- 299,311 ---- */ public Collection getSurfaces() { ! return mesh.getSurfaces(); } /** * Intern a vertex ! * @param vertex The vertex */ ! public void add(Vertex vertex) { ! mesh.add(vertex); changed(this); makeDirty(); *************** *** 373,381 **** /** * Remove a vertex ! * @param v The vertex */ ! public void remove(Vertex v) { ! vertices.remove(v.getId()); ! v.setId(null); changed(this); makeDirty(); --- 314,321 ---- /** * Remove a vertex ! * @param vertex The vertex */ ! public void remove(Vertex vertex) { ! mesh.remove(vertex); changed(this); makeDirty(); *************** *** 387,396 **** */ public void delete(Vertex vertex) { ! if (vertex.getId() != null) { ! Set edges = vertex.getEdges(); ! if (edges.size() < 1) { ! remove(vertex); ! } ! } makeDirty(); } --- 327,331 ---- */ public void delete(Vertex vertex) { ! mesh.delete(vertex); makeDirty(); } *************** *** 401,418 **** */ public Collection getVertices() { ! return vertices.values(); ! } ! ! /** ! * Find a vertex by id ! * @param id The id ! * @return The vertex ! */ ! public Vertex findVertexById(Long id) { ! return (Vertex) vertices.get(id); } /** ! * Intern a camera * @param c The camera */ --- 336,344 ---- */ public Collection getVertices() { ! return mesh.getVertices(); } /** ! * Add a camera * @param c The camera */ |
From: Michael L. <he...@us...> - 2006-01-27 10:54:46
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9950/src/net/sourceforge/bprocessor/model Modified Files: Project.java Mesh.java Log Message: Clean up Index: Mesh.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Mesh.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Mesh.java 24 Jan 2006 09:41:54 -0000 1.2 --- Mesh.java 27 Jan 2006 10:54:36 -0000 1.3 *************** *** 10,13 **** --- 10,16 ---- import java.util.Collection; import java.util.HashMap; + import java.util.Iterator; + import java.util.List; + import java.util.Set; /** *************** *** 78,81 **** --- 81,90 ---- */ public void delete(Vertex vertex) { + if (vertex.getId() != null) { + Set edges = vertex.getEdges(); + if (edges.size() < 1) { + remove(vertex); + } + } remove(vertex); } *************** *** 132,135 **** --- 141,154 ---- */ public void delete(Edge edge) { + if (edge.getId() != null) { + Set surfaces = edge.getSurfaces(); + Iterator it = surfaces.iterator(); + while (it.hasNext()) { + Surface surface = (Surface)it.next(); + remove(surface); + } + delete(edge.getTo()); + delete(edge.getFrom()); + } remove(edge); } *************** *** 186,189 **** --- 205,220 ---- */ public void delete(Surface surface) { + if (surface.getExterior() != null) { + Surface exterior = surface.getExterior(); + exterior.removeHole(surface); + } + List edges = surface.getEdges(); + Iterator it = edges.iterator(); + while (it.hasNext()) { + Edge edge = (Edge)it.next(); + if (edge.getSurfaces().size() < 1) { + delete(edge); + } + } remove(surface); } Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Project.java 25 Jan 2006 14:46:01 -0000 1.25 --- Project.java 27 Jan 2006 10:54:36 -0000 1.26 *************** *** 34,37 **** --- 34,40 ---- private List observers; + /** The Mesh */ + private Mesh mesh; + /** The vertices */ private HashMap vertices = new HashMap(); *************** *** 85,88 **** --- 88,92 ---- addCams(); // To do camera initializasation (MAYBE IT SHOULD NOT BE HERE) observers = new LinkedList(); + mesh = new Mesh(); } *************** *** 275,279 **** */ public void delete(Space space) { ! } --- 279,283 ---- */ public void delete(Space space) { ! remove(space); } *************** *** 386,390 **** Set edges = vertex.getEdges(); if (edges.size() < 1) { ! Project.getInstance().remove(vertex); } } --- 390,394 ---- Set edges = vertex.getEdges(); if (edges.size() < 1) { ! remove(vertex); } } |
From: Michael L. <he...@us...> - 2006-01-27 10:54:40
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9933/src/net/sourceforge/bprocessor/gui Modified Files: GUI.java Log Message: Clean up Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** GUI.java 25 Jan 2006 14:44:41 -0000 1.25 --- GUI.java 27 Jan 2006 10:54:32 -0000 1.26 *************** *** 113,117 **** file.add(fileNew); ! JMenuItem fileLoad = new JMenuItem("Load"); fileLoad.addActionListener(new FileLoadActionListener()); fileLoad.setMnemonic(KeyEvent.VK_L); --- 113,117 ---- file.add(fileNew); ! JMenuItem fileLoad = new JMenuItem("Open"); fileLoad.addActionListener(new FileLoadActionListener()); fileLoad.setMnemonic(KeyEvent.VK_L); |
From: rimestad <rim...@us...> - 2006-01-25 14:54:14
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26867/src/net/sourceforge/bprocessor/gui Modified Files: CameraView.java Log Message: changed call to intern to add Index: CameraView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/CameraView.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CameraView.java 25 Jan 2006 14:44:41 -0000 1.1 --- CameraView.java 25 Jan 2006 14:54:04 -0000 1.2 *************** *** 71,75 **** Project p = Project.getInstance(); if (which == add) { ! p.intern(p.getCurrentCamera()); p.setCurrentCamera(new Camera(p.getCurrentCamera(), "default")); } else if (which == remove) { --- 71,75 ---- Project p = Project.getInstance(); if (which == add) { ! p.add(p.getCurrentCamera()); p.setCurrentCamera(new Camera(p.getCurrentCamera(), "default")); } else if (which == remove) { |
From: rimestad <rim...@us...> - 2006-01-25 14:52:35
|
Update of /cvsroot/bprocessor/build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26298 Modified Files: .project Log Message: Added external builder so that it is possible to compile from Eclipse Index: .project =================================================================== RCS file: /cvsroot/bprocessor/build/.project,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .project 10 Aug 2005 12:44:01 -0000 1.1 --- .project 25 Jan 2006 14:52:13 -0000 1.2 *************** *** 6,9 **** --- 6,19 ---- </projects> <buildSpec> + <buildCommand> + <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name> + <triggers>auto,full,incremental,</triggers> + <arguments> + <dictionary> + <key>LaunchConfigHandle</key> + <value><project>/.externalToolBuilders/build build.xml [Builder].launch</value> + </dictionary> + </arguments> + </buildCommand> </buildSpec> <natures> |
From: rimestad <rim...@us...> - 2006-01-25 14:52:35
|
Update of /cvsroot/bprocessor/build/.externalToolBuilders In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26298/.externalToolBuilders Added Files: build build.xml [Builder].launch Log Message: Added external builder so that it is possible to compile from Eclipse --- NEW FILE: build build.xml [Builder].launch --- <?xml version="1.0" encoding="UTF-8"?> <launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType"> <stringAttribute key="process_factory_id" value="org.eclipse.ant.ui.remoteAntProcessFactory"/> <booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/> <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/> <booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="true"/> <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.ant.internal.ui.antsupport.InternalAntRunner"/> <stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AFTER_CLEAN_TARGETS" value="clean,dist,"/> <stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,auto,"/> <booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/> <booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/> <booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/> <stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/> <stringAttribute key="org.eclipse.ui.externaltools.ATTR_ANT_TARGETS" value="dist,clean,"/> <booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/> <stringAttribute key="org.eclipse.jdt.launching.VM_INSTALL_TYPE_ID" value="org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType"/> <stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_MANUAL_TARGETS" value="clean,dist,"/> <stringAttribute key="org.eclipse.jdt.launching.VM_INSTALL_NAME" value="java-1.4.2-sun-1.4.2.10"/> <listAttribute key="org.eclipse.jdt.launching.CLASSPATH"> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry type="4" path="1" containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-1.4.2-sun-1.4.2.10"/> "/> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.ant.ui.classpathentry.antHome"> <memento antHome="/usr/share/ant"/> </runtimeClasspathEntry> "/> <listEntry value="<?xml version="1.0" encoding="UTF-8"?> <runtimeClasspathEntry id="org.eclipse.ant.ui.classpathentry.extraClasspathEntries"> <memento/> </runtimeClasspathEntry> "/> </listAttribute> <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="build"/> <stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${working_set:<?xml version="1.0" encoding="UTF-8"?> <launchConfigurationWorkingSet factoryID="org.eclipse.ui.internal.WorkingSetFactory" name="working set" editPageId="org.eclipse.ui.resourceWorkingSetPage"> <item factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/build" type="4"/> <item factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/tools" type="4"/> <item factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/gl" type="4"/> <item factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/gui" type="4"/> <item factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/kernel" type="4"/> <item factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/model" type="4"/> </launchConfigurationWorkingSet>}"/> <stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/build/build.xml}"/> </launchConfiguration> |
From: rimestad <rim...@us...> - 2006-01-25 14:52:33
|
Update of /cvsroot/bprocessor/build/.externalToolBuilders In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26256/.externalToolBuilders Log Message: Directory /cvsroot/bprocessor/build/.externalToolBuilders added to the repository |
From: rimestad <rim...@us...> - 2006-01-25 14:50:23
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25715/src/net/sourceforge/bprocessor/gui/attrview Modified Files: AttributeView.java Log Message: small layout change Index: AttributeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/AttributeView.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** AttributeView.java 25 Jan 2006 09:32:29 -0000 1.29 --- AttributeView.java 25 Jan 2006 14:50:10 -0000 1.30 *************** *** 524,527 **** --- 524,528 ---- add(emptyLine); + con.gridwidth = 2; JPanel type = new JPanel(); type.setMinimumSize(new Dimension(120, 120)); *************** *** 636,640 **** type.add(rollz, typeCon); ! add(type); } --- 637,641 ---- type.add(rollz, typeCon); ! add(type, con); } |
From: rimestad <rim...@us...> - 2006-01-25 14:47:00
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24546/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Added listening for cameras in update Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** View.java 23 Jan 2006 10:16:22 -0000 1.50 --- View.java 25 Jan 2006 14:46:40 -0000 1.51 *************** *** 367,379 **** Toolbar tb = Toolbar.getInstance(); ! JButton but = tb.registerAction(new View3DAction(glv)); ! but.setToolTipText("3D view"); ! but = tb.registerAction(new ViewxzAction(glv)); ! but.setToolTipText("xz-plane"); ! but = tb.registerAction(new ViewxyAction(glv)); ! but.setToolTipText("xy-plane"); ! but = tb.registerAction(new ViewyzAction(glv)); ! but.setToolTipText("yz-plane"); ! but = tb.registerAction(new ViewWireframe(glv)); but.setToolTipText("Wireframe"); but = tb.registerAction(new ViewSolid(glv)); --- 367,371 ---- Toolbar tb = Toolbar.getInstance(); ! JButton but = tb.registerAction(new ViewWireframe(glv)); but.setToolTipText("Wireframe"); but = tb.registerAction(new ViewSolid(glv)); *************** *** 2171,2182 **** } } - - /** - * Change active camera - * @param c The camera - */ - public void changeCamera(Camera c) { - this.camera = c; - } /** --- 2163,2166 ---- *************** *** 2272,2394 **** return new Transformation(glu, modelMatrix, projMatrix, screenport); } - - /** - * Return the camera - * @return The current camera - */ - public Camera getCamera() { - return camera; - } - - /** - * The viewxy inner class - */ - class ViewxyAction extends AbstractAction { - /** The GLView */ - private GLView glv = null; - - /** - * Constructor - * @param glv TheGLView - */ - ViewxyAction(GLView glv) { - this.glv = glv; - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - URL url = cl.getResource("xyicon.png"); - ImageIcon im = new ImageIcon(url); - putValue(Action.SMALL_ICON, im); - } - - /** - * Called when the button is pressed - * @param e The ActionEvent - */ - public void actionPerformed(ActionEvent e) { - glv.changeCamera(Camera.create(Camera.VIEW_XY)); - } - } - - /** - * The viewxz inner class - */ - class ViewxzAction extends AbstractAction { - /** The GLView */ - private GLView glv = null; - - /** - * Constructor - * @param glv TheGLView - */ - ViewxzAction(GLView glv) { - this.glv = glv; - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - URL url = cl.getResource("xzicon.png"); - ImageIcon im = new ImageIcon(url); - putValue(Action.SMALL_ICON, im); - } - - /** - * Called when the button is pressed - * @param e The ActionEvent - */ - public void actionPerformed(ActionEvent e) { - glv.changeCamera(Camera.create(Camera.VIEW_XZ)); - } - } - /** - * The viewyz inner class - */ - class ViewyzAction extends AbstractAction { - /** The GLView */ - private GLView glv = null; - - /** - * Constructor - * @param glv TheGLView - */ - ViewyzAction(GLView glv) { - this.glv = glv; - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - URL url = cl.getResource("yzicon.png"); - ImageIcon im = new ImageIcon(url); - putValue(Action.SMALL_ICON, im); - } - - /** - * Called when the button is pressed - * @param e The ActionEvent - */ - public void actionPerformed(ActionEvent e) { - glv.changeCamera(Camera.create(Camera.VIEW_YZ)); - } - } - - /** - * The view3D inner class - */ - class View3DAction extends AbstractAction { - /** The GLView */ - private GLView glv = null; - - /** - * Constructor - * @param glv TheGLView - */ - View3DAction(GLView glv) { - this.glv = glv; - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - URL url = cl.getResource("3dicon.png"); - ImageIcon im = new ImageIcon(url); - putValue(Action.SMALL_ICON, im); - } - - /** - * Called when the button is pressed - * @param e The ActionEvent - */ - public void actionPerformed(ActionEvent e) { - glv.changeCamera(Camera.create(Camera.VIEW_3D)); - } - } /** --- 2256,2259 ---- *************** *** 2478,2480 **** --- 2343,2361 ---- } } + + /** + * Getter for camera + * @return the Camera + */ + public Camera getCamera() { + return camera; + } + + /** + * Setter for camera + * @param camera the Camera + */ + public void setCamera(Camera camera) { + this.camera = camera; + } } |
From: rimestad <rim...@us...> - 2006-01-25 14:46:33
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24326/src/net/sourceforge/bprocessor/model Modified Files: Camera.java Project.java Log Message: Added currentCamera to project and made small fixes in Camera Index: Camera.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Camera.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Camera.java 19 Jan 2006 10:57:18 -0000 1.7 --- Camera.java 25 Jan 2006 14:46:01 -0000 1.8 *************** *** 57,60 **** --- 57,94 ---- /** + * Constructor with arguments + * @param center The center position + * @param camera The camera positon + * @param roll The roll of the camera (up vector) + * @param name The name of the cam setting + * @param type Which type ortho or perspective + */ + public Camera(String name, double[] center, double[] camera, double[] roll, int type) { + this.name = name; + this.center = center; + this.camera = camera; + this.roll = roll; + this.focalwidth = 65; + if (type == ORTHOGRAPHIC || type == PERSPECTIVE) { + this.type = type; + } else { + log.error("Wrong type " + type); + this.type = PERSPECTIVE; + } + } + + /** + * Constructor that take a camera to make a copy of + * @param c The Camera + * @param name The name for the cam + */ + public Camera(Camera c, String name) { + this(name, new double[]{c.center[0], c.center[1], c.center[2]}, + new double[]{c.camera[0], c.camera[1], c.camera[2]}, + new double[]{c.roll[0], c.roll[1], c.roll[2]}, c.getType()); + } + + /** + /** * Create a default camera of your choice * @param type the camera type *************** *** 66,86 **** res = new Camera("3D", new double[]{0, 0, 0}, new double[]{22, 19, 22}, ! new double[] {0, 0, 1}); ! res.setType(PERSPECTIVE); } else if (type == VIEW_XZ) { res = new Camera("xz (ortho)", new double[]{0, 0, 0}, new double[]{0, -20, 0}, ! new double[] {0, 0, 1}); ! res.setType(ORTHOGRAPHIC); } else if (type == VIEW_XY) { res = new Camera("xy (ortho)", new double[]{0, 0, 0}, new double[]{0, 0, 20}, ! new double[] {0, 1, 0}); ! res.setType(ORTHOGRAPHIC); } else if (type == VIEW_YZ) { res = new Camera("yz (ortho)", new double[]{0, 0, 0}, new double[]{20, 0, 0}, ! new double[] {0, 0, 1}); ! res.setType(ORTHOGRAPHIC); } return res; --- 100,116 ---- res = new Camera("3D", new double[]{0, 0, 0}, new double[]{22, 19, 22}, ! new double[] {0, 0, 1}, PERSPECTIVE); } else if (type == VIEW_XZ) { res = new Camera("xz (ortho)", new double[]{0, 0, 0}, new double[]{0, -20, 0}, ! new double[] {0, 0, 1}, ORTHOGRAPHIC); } else if (type == VIEW_XY) { res = new Camera("xy (ortho)", new double[]{0, 0, 0}, new double[]{0, 0, 20}, ! new double[] {0, 1, 0}, ORTHOGRAPHIC); } else if (type == VIEW_YZ) { res = new Camera("yz (ortho)", new double[]{0, 0, 0}, new double[]{20, 0, 0}, ! new double[] {0, 0, 1}, ORTHOGRAPHIC); } return res; *************** *** 106,124 **** return type; } - - /** - * Constructor with arguments - * @param center The center position - * @param camera The camera positon - * @param roll The roll of the camera (up vector) - * @param name The name of the cam setting - */ - public Camera(String name, double[] center, double[] camera, double[] roll) { - this.name = name; - this.center = center; - this.camera = camera; - this.roll = roll; - this.focalwidth = 65; - } /** --- 136,139 ---- Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Project.java 25 Jan 2006 11:19:40 -0000 1.24 --- Project.java 25 Jan 2006 14:46:01 -0000 1.25 *************** *** 63,66 **** --- 63,69 ---- private boolean dirty; + /** The current project camera */ + private Camera currentCamera; + /** * Get the instance *************** *** 131,147 **** Camera cam0 = Camera.create(Camera.VIEW_3D); // The starting cam cam0.setId(new Long(cameraId++)); - cameras.put(cam0.getId(), cam0); Camera cam1 = Camera.create(Camera.VIEW_3D); // Reset to 3D position cam1.setId(new Long(cameraId++)); cameras.put(cam1.getId(), cam1); Camera cam2 = Camera.create(Camera.VIEW_XY); // Reset to 2D position XY with ortho ! cam1.setId(new Long(cameraId++)); cameras.put(cam2.getId(), cam2); Camera cam3 = Camera.create(Camera.VIEW_XZ); // Reset to 2D position XZ with ortho ! cam1.setId(new Long(cameraId++)); cameras.put(cam3.getId(), cam3); Camera cam4 = Camera.create(Camera.VIEW_YZ); // Reset to 2D position YZ with ortho ! cam1.setId(new Long(cameraId++)); cameras.put(cam4.getId(), cam4); } --- 134,150 ---- Camera cam0 = Camera.create(Camera.VIEW_3D); // The starting cam cam0.setId(new Long(cameraId++)); Camera cam1 = Camera.create(Camera.VIEW_3D); // Reset to 3D position cam1.setId(new Long(cameraId++)); cameras.put(cam1.getId(), cam1); Camera cam2 = Camera.create(Camera.VIEW_XY); // Reset to 2D position XY with ortho ! cam2.setId(new Long(cameraId++)); cameras.put(cam2.getId(), cam2); Camera cam3 = Camera.create(Camera.VIEW_XZ); // Reset to 2D position XZ with ortho ! cam3.setId(new Long(cameraId++)); cameras.put(cam3.getId(), cam3); Camera cam4 = Camera.create(Camera.VIEW_YZ); // Reset to 2D position YZ with ortho ! cam4.setId(new Long(cameraId++)); cameras.put(cam4.getId(), cam4); + currentCamera = cam0; } *************** *** 416,419 **** --- 419,432 ---- makeDirty(); } + + /** + * Remove an camera + * @param c The camera + */ + public void remove(Camera c) { + cameras.remove(c.getId()); + c.setId(null); + changed(this); + } /** *************** *** 512,514 **** --- 525,542 ---- } + /** + * Sets the current camera + * @param camera the Camera + */ + public void setCurrentCamera(Camera camera) { + currentCamera = camera; + } + + /** + * getter for currentCamera + * @return the currentcamera + */ + public Camera getCurrentCamera() { + return currentCamera; + } } |
From: rimestad <rim...@us...> - 2006-01-25 14:45:36
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24213/src/net/sourceforge/bprocessor/gl/tool Modified Files: CameraFlyTool.java AbstractTool.java MoveTool.java CameraWalkTool.java CameraTool.java Log Message: Now all tools take the camera from Project Index: CameraTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CameraTool.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CameraTool.java 15 Dec 2005 12:37:00 -0000 1.6 --- CameraTool.java 25 Jan 2006 14:45:25 -0000 1.7 *************** *** 10,13 **** --- 10,14 ---- import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.model.Camera; + import net.sourceforge.bprocessor.model.Project; //import java.awt.event.KeyEvent; *************** *** 65,69 **** protected void dragged(MouseEvent e) { View view = glv.getView(); ! Camera c = view.getCamera(); double[] roll = c.getRoll(); if ((e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == --- 66,70 ---- protected void dragged(MouseEvent e) { View view = glv.getView(); ! Camera c = Project.getInstance().getCurrentCamera(); double[] roll = c.getRoll(); if ((e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == Index: CameraWalkTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CameraWalkTool.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CameraWalkTool.java 19 Dec 2005 07:51:30 -0000 1.2 --- CameraWalkTool.java 25 Jan 2006 14:45:25 -0000 1.3 *************** *** 9,12 **** --- 9,13 ---- import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.model.Camera; + import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Vertex; *************** *** 47,51 **** if (e.getButton() == MouseEvent.BUTTON1 || (e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == MouseEvent.BUTTON1_DOWN_MASK) { ! Camera c = glv.getView().getCamera(); double angleX = ((double)(e.getX() - previousPos[0]) / 360) * Math.PI; double angleY = ((double)(e.getY() - previousPos[1]) / 360) * Math.PI; --- 48,52 ---- if (e.getButton() == MouseEvent.BUTTON1 || (e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == MouseEvent.BUTTON1_DOWN_MASK) { ! Camera c = Project.getInstance().getCurrentCamera(); double angleX = ((double)(e.getX() - previousPos[0]) / 360) * Math.PI; double angleY = ((double)(e.getY() - previousPos[1]) / 360) * Math.PI; *************** *** 74,78 **** */ public void keyPressed(KeyEvent e) { ! Camera c = glv.getView().getCamera(); Vertex up = new Vertex(c.getRoll()[0], c.getRoll()[1], c.getRoll()[2]); double x = c.getCenter()[0] - c.getCamera()[0]; --- 75,79 ---- */ public void keyPressed(KeyEvent e) { ! Camera c = Project.getInstance().getCurrentCamera(); Vertex up = new Vertex(c.getRoll()[0], c.getRoll()[1], c.getRoll()[2]); double x = c.getCenter()[0] - c.getCamera()[0]; Index: CameraFlyTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CameraFlyTool.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CameraFlyTool.java 19 Dec 2005 07:51:30 -0000 1.4 --- CameraFlyTool.java 25 Jan 2006 14:45:25 -0000 1.5 *************** *** 9,12 **** --- 9,13 ---- import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.model.Camera; + import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Vertex; *************** *** 47,51 **** if (e.getButton() == MouseEvent.BUTTON1 || (e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == MouseEvent.BUTTON1_DOWN_MASK) { ! Camera c = glv.getView().getCamera(); double angleX = ((double)(e.getX() - previousPos[0]) / 360) * Math.PI; double angleY = ((double)(e.getY() - previousPos[1]) / 360) * Math.PI; --- 48,52 ---- if (e.getButton() == MouseEvent.BUTTON1 || (e.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) == MouseEvent.BUTTON1_DOWN_MASK) { ! Camera c = Project.getInstance().getCurrentCamera(); double angleX = ((double)(e.getX() - previousPos[0]) / 360) * Math.PI; double angleY = ((double)(e.getY() - previousPos[1]) / 360) * Math.PI; *************** *** 74,78 **** */ public void keyPressed(KeyEvent e) { ! Camera c = glv.getView().getCamera(); Vertex up = new Vertex(c.getRoll()[0], c.getRoll()[1], c.getRoll()[2]); double x = c.getCenter()[0] - c.getCamera()[0]; --- 75,79 ---- */ public void keyPressed(KeyEvent e) { ! Camera c = Project.getInstance().getCurrentCamera(); Vertex up = new Vertex(c.getRoll()[0], c.getRoll()[1], c.getRoll()[2]); double x = c.getCenter()[0] - c.getCamera()[0]; Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** MoveTool.java 24 Jan 2006 12:14:39 -0000 1.27 --- MoveTool.java 25 Jan 2006 14:45:25 -0000 1.28 *************** *** 14,17 **** --- 14,18 ---- import net.sourceforge.bprocessor.model.Entity; import net.sourceforge.bprocessor.model.Plane; + import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Surface; *************** *** 376,380 **** */ protected void findRestrictionPlane() { ! Camera camera = glv.getView().getCamera(); double[] centerPoint = camera.getCenter(); double[] cameraPoint = camera.getCamera(); --- 377,381 ---- */ protected void findRestrictionPlane() { ! Camera camera = Project.getInstance().getCurrentCamera(); double[] centerPoint = camera.getCenter(); double[] cameraPoint = camera.getCamera(); Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** AbstractTool.java 25 Jan 2006 10:02:09 -0000 1.54 --- AbstractTool.java 25 Jan 2006 14:45:25 -0000 1.55 *************** *** 118,122 **** public void mouseWheelMoved(MouseWheelEvent e) { int rotation = e.getWheelRotation(); ! Camera cam = (glv.getView()).getCamera(); if (rotation > 0) { cam.zoomout(); --- 118,122 ---- public void mouseWheelMoved(MouseWheelEvent e) { int rotation = e.getWheelRotation(); ! Camera cam = Project.getInstance().getCurrentCamera(); if (rotation > 0) { cam.zoomout(); *************** *** 133,137 **** */ public double[] selectionCenter() { ! double[] center = (glv.getView()).getCamera().getCenter(); Iterator it = selection.iterator(); if (it.hasNext()) { --- 133,137 ---- */ public double[] selectionCenter() { ! double[] center = Project.getInstance().getCurrentCamera().getCenter(); Iterator it = selection.iterator(); if (it.hasNext()) { *************** *** 175,179 **** */ public void keyPressed(KeyEvent e) { ! Camera c = glv.getView().getCamera(); Vertex up = new Vertex(c.getRoll()[0], c.getRoll()[1], c.getRoll()[2]); double x = c.getCenter()[0] - c.getCamera()[0]; --- 175,179 ---- */ public void keyPressed(KeyEvent e) { ! Camera c = Project.getInstance().getCurrentCamera(); Vertex up = new Vertex(c.getRoll()[0], c.getRoll()[1], c.getRoll()[2]); double x = c.getCenter()[0] - c.getCamera()[0]; *************** *** 215,226 **** } else if (e.getKeyCode() == KeyEvent.VK_E) { glv.changeTool(Tool.EXTRUSION_TOOL); - } else if (e.getKeyCode() == KeyEvent.VK_F1) { - glv.changeCamera(Camera.create(Camera.VIEW_3D)); - } else if (e.getKeyCode() == KeyEvent.VK_F2) { - glv.changeCamera(Camera.create(Camera.VIEW_XZ)); - } else if (e.getKeyCode() == KeyEvent.VK_F3) { - glv.changeCamera(Camera.create(Camera.VIEW_XY)); - } else if (e.getKeyCode() == KeyEvent.VK_F4) { - glv.changeCamera(Camera.create(Camera.VIEW_YZ)); } else if (e.getKeyCode() == KeyEvent.VK_F5) { glv.getView().changeDrawMode(View.WIREFRAME_MODE); --- 215,218 ---- *************** *** 262,266 **** e.getButton() == MouseEvent.BUTTON2) { View view = glv.getView(); ! Camera c = view.getCamera(); double[] center = c.getCenter(); double[] camera = c.getCamera(); --- 254,258 ---- e.getButton() == MouseEvent.BUTTON2) { View view = glv.getView(); ! Camera c = Project.getInstance().getCurrentCamera(); double[] center = c.getCenter(); double[] camera = c.getCamera(); |
From: rimestad <rim...@us...> - 2006-01-25 14:45:35
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24213/src/net/sourceforge/bprocessor/gl Modified Files: GLView.java Log Message: Now all tools take the camera from Project Index: GLView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/GLView.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** GLView.java 6 Jan 2006 15:36:14 -0000 1.33 --- GLView.java 25 Jan 2006 14:45:25 -0000 1.34 *************** *** 10,15 **** import net.sourceforge.bprocessor.gl.tool.ToolFactory; import net.sourceforge.bprocessor.gl.view.View; - import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Camera; import net.sourceforge.bprocessor.model.Observer; import net.sourceforge.bprocessor.model.Project; --- 10,15 ---- import net.sourceforge.bprocessor.gl.tool.ToolFactory; import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.model.Camera; + import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Observer; import net.sourceforge.bprocessor.model.Project; *************** *** 87,91 **** jp.add(lengthPanel, BorderLayout.SOUTH); ! view = new View(this, Camera.create(Camera.VIEW_3D)); glc.addGLEventListener(view); --- 87,91 ---- jp.add(lengthPanel, BorderLayout.SOUTH); ! view = new View(this, Project.getInstance().getCurrentCamera()); glc.addGLEventListener(view); *************** *** 140,143 **** --- 140,144 ---- glc.setCursor(cursor); } + /** * Change the tool *************** *** 167,179 **** /** - * Change the camera - * @param c The camera - */ - public void changeCamera(Camera c) { - view.changeCamera(c); - this.repaint(true); - } - - /** * Repaint the canvas */ --- 168,171 ---- *************** *** 347,350 **** --- 339,345 ---- if (entity == Selection.primary()) { repaint(); + } else if (entity instanceof Camera) { + getView().setCamera((Camera)entity); + repaint(); } else { repaint(); |
From: rimestad <rim...@us...> - 2006-01-25 14:45:25
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23902/src/net/sourceforge/bprocessor/gui Modified Files: GUI.java Added Files: CameraView.java Log Message: Added add remove and set for the cameratreeview as a separate class CameraView --- NEW FILE: CameraView.java --- //--------------------------------------------------------------------------------- // $Id: CameraView.java,v 1.1 2006/01/25 14:44:41 rimestad Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui; import java.awt.BorderLayout; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JPanel; import javax.swing.JScrollPane; import net.sourceforge.bprocessor.gui.treeview.CameraTreeView; import net.sourceforge.bprocessor.model.Camera; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Selection; /** * A component for displaying views * @author rimestad * */ public class CameraView extends JPanel implements ActionListener { /** Add button */ private JButton add; /** Remove button */ private JButton remove; /** set button */ private JButton set; /** The tree of cams */ private CameraTreeView ctv; /** * The constructor * */ public CameraView() { super(); setSize(100, 500); this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); ctv = new CameraTreeView(); add(new JScrollPane(ctv), BorderLayout.CENTER); // create buttons JPanel but = new JPanel(); but.setLayout(new BoxLayout(but, BoxLayout.LINE_AXIS)); add = new JButton("+"); remove = new JButton("-"); set = new JButton("Set"); add.addActionListener(this); remove.addActionListener(this); set.addActionListener(this); but.add(add); but.add(set); but.add(remove); this.setBackground(new Color(255, 255, 255)); this.add(but, BorderLayout.SOUTH); } /** * Handle the actions on plus and minus * @param a The actionevent */ public void actionPerformed(ActionEvent a) { Object which = a.getSource(); Project p = Project.getInstance(); if (which == add) { p.intern(p.getCurrentCamera()); p.setCurrentCamera(new Camera(p.getCurrentCamera(), "default")); } else if (which == remove) { Object[] tar = Selection.primary().toArray(); if (tar[0] instanceof Camera) { p.remove((Camera)tar[0]); } } else if (which == set) { Object[] tar = Selection.primary().toArray(); if (tar[0] instanceof Camera) { Camera c = new Camera((Camera)tar[0], "default"); p.setCurrentCamera(c); p.changed(c); } } } } Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** GUI.java 25 Jan 2006 11:01:14 -0000 1.24 --- GUI.java 25 Jan 2006 14:44:41 -0000 1.25 *************** *** 25,29 **** import net.sourceforge.bprocessor.gui.attrview.AttributeView; import net.sourceforge.bprocessor.gui.splash.SplashWindow; - import net.sourceforge.bprocessor.gui.treeview.CameraTreeView; import net.sourceforge.bprocessor.gui.treeview.SpaceTreeView; import net.sourceforge.bprocessor.gui.treeview.SurfaceTreeView; --- 25,28 ---- *************** *** 329,333 **** tp.addTab("Spaces", new JScrollPane (new SpaceTreeView())); tp.addTab("Surfaces", new JScrollPane (new SurfaceTreeView())); ! tp.addTab("Views", new JScrollPane (new CameraTreeView())); registerPanel(tp, SPLIT_LEFT); --- 328,332 ---- tp.addTab("Spaces", new JScrollPane (new SpaceTreeView())); tp.addTab("Surfaces", new JScrollPane (new SurfaceTreeView())); ! tp.addTab("Views", new CameraView()); registerPanel(tp, SPLIT_LEFT); *************** *** 356,360 **** */ public void start() { ! plash = new SplashWindow("splash3_24bit.png", null); setSize(800, 600); } --- 355,359 ---- */ public void start() { ! plash = new SplashWindow("splash3_24bit.png", this); setSize(800, 600); } |
From: Nikolaj B. <nbr...@us...> - 2006-01-25 11:19:52
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17915/src/net/sourceforge/bprocessor/model Modified Files: Project.java Log Message: Now tracks if changes are made to a projekt Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Project.java 25 Jan 2006 10:02:13 -0000 1.23 --- Project.java 25 Jan 2006 11:19:40 -0000 1.24 *************** *** 56,61 **** --- 56,65 ---- /** The domains */ private HashMap cameras = new HashMap(); + /** The domain id */ private long cameraId; + + /** Has changes been made */ + private boolean dirty; /** *************** *** 75,78 **** --- 79,83 ---- public Project() { super(); + makeClean(); addCams(); // To do camera initializasation (MAYBE IT SHOULD NOT BE HERE) observers = new LinkedList(); *************** *** 149,152 **** --- 154,158 ---- spaces.put(space.getId(), space); changed(this); + makeDirty(); } *************** *** 184,187 **** --- 190,194 ---- edges.put(e.getId(), e); changed(this); + makeDirty(); } *************** *** 202,205 **** --- 209,213 ---- delete(edge.getFrom()); } + makeDirty(); } *************** *** 213,216 **** --- 221,225 ---- e.setId(null); changed(this); + makeDirty(); } *************** *** 255,258 **** --- 264,268 ---- spaces.remove(space.getId()); space.setId(null); + makeDirty(); } *************** *** 281,284 **** --- 291,295 ---- surfaces.put(s.getId(), s); changed(this); + makeDirty(); } *************** *** 301,304 **** --- 312,316 ---- s.setId(null); changed(this); + makeDirty(); } *************** *** 321,324 **** --- 333,337 ---- } } + makeDirty(); } *************** *** 348,351 **** --- 361,365 ---- vertices.put(v.getId(), v); changed(this); + makeDirty(); } *************** *** 358,361 **** --- 372,376 ---- v.setId(null); changed(this); + makeDirty(); } *************** *** 371,374 **** --- 386,390 ---- } } + makeDirty(); } *************** *** 398,401 **** --- 414,418 ---- cameras.put(c.getId(), c); changed(this); + makeDirty(); } *************** *** 476,479 **** --- 493,514 ---- return result; } + + /** + * Tells you if the projekt has been changed + * @return true if its dirty, false if clean. + */ + public boolean isDirty() { + return dirty; + } + + /** Makes the projekt dirty to show a change has been made */ + public void makeDirty() { + dirty = true; + } + + /** Makes the projekt clean, to show no changes has been made */ + public void makeClean() { + dirty = false; + } } |