bprocessor-commit Mailing List for B-processor (Page 131)
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-03-10 16:41:36
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10207/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: MultiExtrusionTool now used Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** View.java 7 Mar 2006 22:31:05 -0000 1.70 --- View.java 10 Mar 2006 16:41:26 -0000 1.71 *************** *** 1341,1344 **** --- 1341,1345 ---- Collection vertices = Project.getInstance().getVertices(); + Space space = Project.getInstance().getActiveSpace(); gl = gld.getGL(); initNames(gl); *************** *** 1362,1373 **** } if (selectMode == EDGES || selectMode == ALL) { ! Iterator it = edges.iterator(); ! gl.glColor3fv(lineColor); ! while (it.hasNext()) { ! Edge e = (Edge)it.next(); ! pushName(gl, e); ! drawEdge(e); ! popName(gl); } Iterator tempEdgeIt = tempEdges.iterator(); while (tempEdgeIt.hasNext()) { --- 1363,1405 ---- } if (selectMode == EDGES || selectMode == ALL) { ! ! if (space != null) { ! Set es = new HashSet(); ! { ! Set surfs = space.getEnvelope(); ! Iterator surfsIt = surfs.iterator(); ! while (surfsIt.hasNext()) { ! Surface current = (Surface) surfsIt.next(); ! es.addAll(current.getEdges()); ! } ! } ! if (space.getInterior() != null) { ! Collection surfs = space.getInterior().getSurfaces(); ! Iterator surfsIt = surfs.iterator(); ! while (surfsIt.hasNext()) { ! Surface current = (Surface) surfsIt.next(); ! es.addAll(current.getEdges()); ! } ! } ! Iterator it = es.iterator(); ! gl.glColor3fv(lineColor); ! while (it.hasNext()) { ! Edge e = (Edge)it.next(); ! pushName(gl, e); ! drawEdge(e); ! popName(gl); ! } ! } else { ! Iterator it = edges.iterator(); ! gl.glColor3fv(lineColor); ! while (it.hasNext()) { ! Edge e = (Edge)it.next(); ! pushName(gl, e); ! drawEdge(e); ! popName(gl); ! } } + + Iterator tempEdgeIt = tempEdges.iterator(); while (tempEdgeIt.hasNext()) { *************** *** 1379,1390 **** } if (selectMode == SURFACES || selectMode == ALL) { ! Iterator it = surfaces.iterator(); gl.glColor3fv(SURFACE_COLOR); ! while (it.hasNext()) { ! Surface s = (Surface)it.next(); ! pushName(gl, s); ! drawSurface(s); ! popName(gl); } Iterator tempSurfaceIt = tempSurfaces.iterator(); while (tempSurfaceIt.hasNext()) { --- 1411,1441 ---- } if (selectMode == SURFACES || selectMode == ALL) { ! gl.glColor3fv(SURFACE_COLOR); ! ! if (space != null) { ! Set ss = new HashSet(); ! if (space.getInterior() != null) { ! Collection surfs = space.getInterior().getSurfaces(); ! ss.addAll(surfs); ! } ! Iterator it = ss.iterator(); ! while (it.hasNext()) { ! Surface s = (Surface)it.next(); ! pushName(gl, s); ! drawSurface(s); ! popName(gl); ! } ! } else { ! Iterator it = surfaces.iterator(); ! while (it.hasNext()) { ! Surface s = (Surface)it.next(); ! pushName(gl, s); ! drawSurface(s); ! popName(gl); ! } } + + Iterator tempSurfaceIt = tempSurfaces.iterator(); while (tempSurfaceIt.hasNext()) { *************** *** 1743,1749 **** * @param unWantedEntities Entities to be ignored * @param intersections Are intersections wanted * @return Selection */ ! private Object processSelect(Collection unWantedEntities, boolean intersections) { int bufferOffset = 0; int names = 0; --- 1794,1803 ---- * @param unWantedEntities Entities to be ignored * @param intersections Are intersections wanted + * @param xy The default interseection plane + * @param all Return all edges * @return Selection */ ! private Object processSelect(Collection unWantedEntities, ! boolean intersections, Plane xy, boolean all) { int bufferOffset = 0; int names = 0; *************** *** 1824,1828 **** if (vertex != null) { if (nearestSurface < nearestVertex) { ! if (!plane.contains(vertex)) { vertex = null; } --- 1878,1882 ---- if (vertex != null) { if (nearestSurface < nearestVertex) { ! if (plane != null && !plane.contains(vertex)) { vertex = null; } *************** *** 1831,1835 **** if (edge != null) { if (nearestSurface < nearestEdge) { ! if (!plane.contains(edge)) { edge = null; } --- 1885,1889 ---- if (edge != null) { if (nearestSurface < nearestEdge) { ! if (plane != null && !plane.contains(edge)) { edge = null; } *************** *** 1912,1921 **** return new Intersection(intersection, Intersection.SURFACE, surface); } else { - Plane xy = new Plane(0, 0, 1, 0); Vertex intersection = xy.intersection(ray); if (intersection != null) { // FIXME The plane intersection should take care // of the following round off ! intersection.setZ(0.0); return new Intersection(intersection, Intersection.PLANE_INTERSECTION, null); } --- 1966,1977 ---- return new Intersection(intersection, Intersection.SURFACE, surface); } else { Vertex intersection = xy.intersection(ray); if (intersection != null) { // FIXME The plane intersection should take care // of the following round off ! double values[] = xy.getDoublev(); ! if (values[3] == 0) { ! intersection.setZ(0.0); ! } return new Intersection(intersection, Intersection.PLANE_INTERSECTION, null); } *************** *** 1929,1932 **** --- 1985,1996 ---- return vertex; } else if (edge != null) { + if (all) { + // FIXME this is a temporary hack to make move work + List result = new LinkedList(); + result.add(edge); + edges.remove(edge); + result.addAll(edges); + return result; + } return edge; } else if (surface != null) { *************** *** 1948,1955 **** * @param unWantedEntities the collection of unwanted entities * @param intersections Are intersections wanted * @return entity under the point. */ public Object getObjectAtPoint(double x, double y, ! Collection unWantedEntities, boolean intersections) { this.x = x; this.y = y; --- 2012,2020 ---- * @param unWantedEntities the collection of unwanted entities * @param intersections Are intersections wanted + * @param xy The default plane to intersect with * @return entity under the point. */ public Object getObjectAtPoint(double x, double y, ! Collection unWantedEntities, boolean intersections, Plane xy) { this.x = x; this.y = y; *************** *** 1959,1963 **** glv.repaint(true); ! Object object = processSelect(unWantedEntities, intersections); clearNames(); return object; --- 2024,2028 ---- glv.repaint(true); ! Object object = processSelect(unWantedEntities, intersections, xy, false); clearNames(); return object; *************** *** 1971,1975 **** */ public Object getObjectAtPoint(double x, double y) { ! return getObjectAtPoint(x, y, new HashSet(), false); } --- 2036,2040 ---- */ public Object getObjectAtPoint(double x, double y) { ! return getObjectAtPoint(x, y, new HashSet(), false, new Plane(0, 0, 1, 0)); } *************** *** 2043,2049 **** List selection = new LinkedList(); ! Object object = processSelect(new HashSet(), false); if (object != null) { ! selection.add(object); } clearNames(); --- 2108,2118 ---- List selection = new LinkedList(); ! Object object = processSelect(new HashSet(), false, new Plane(0, 0, 1, 0), true); if (object != null) { ! if (object instanceof List) { ! selection = (List) object; ! } else { ! selection.add(object); ! } } clearNames(); *************** *** 2066,2070 **** List selection = new LinkedList(); ! Object object = processSelect(new HashSet(), false); if (object != null) { selection.add(object); --- 2135,2139 ---- List selection = new LinkedList(); ! Object object = processSelect(new HashSet(), false, new Plane(0, 0, 1, 0), false); if (object != null) { selection.add(object); |
|
From: Nikolaj B. <nbr...@us...> - 2006-03-10 14:10:36
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11218/src/net/sourceforge/bprocessor/gui/attrview Modified Files: DescriptionAttribute.java StringAttribute.java LinkAttribute.java GenericPanel.java Log Message: Clicking anywhere will now stop editing, and labels are now left alligned. Index: StringAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/StringAttribute.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** StringAttribute.java 28 Feb 2006 02:25:48 -0000 1.7 --- StringAttribute.java 10 Mar 2006 14:10:30 -0000 1.8 *************** *** 61,74 **** Box header = Box.createHorizontalBox(); Box column = Box.createVerticalBox(); ! header.add(Box.createHorizontalGlue()); header.add(label); ! //column.add(Box.createHorizontalStrut(60)); column.add(Box.createRigidArea(new Dimension(70, 3))); column.add(header); column.add(Box.createRigidArea(new Dimension(70, 3))); - //column.add(Box.createHorizontalStrut(60)); column.setMaximumSize(new Dimension(60, Short.MAX_VALUE)); this.add(column); - this.add(Box.createHorizontalStrut(7)); component = Box.createHorizontalBox(); component.add(createValueLabel(attribute.getValue())); --- 61,72 ---- Box header = Box.createHorizontalBox(); Box column = Box.createVerticalBox(); ! header.add(Box.createHorizontalStrut(7)); header.add(label); ! header.add(Box.createHorizontalGlue()); column.add(Box.createRigidArea(new Dimension(70, 3))); column.add(header); column.add(Box.createRigidArea(new Dimension(70, 3))); column.setMaximumSize(new Dimension(60, Short.MAX_VALUE)); this.add(column); component = Box.createHorizontalBox(); component.add(createValueLabel(attribute.getValue())); Index: GenericPanel.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/GenericPanel.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** GenericPanel.java 8 Mar 2006 14:22:05 -0000 1.12 --- GenericPanel.java 10 Mar 2006 14:10:30 -0000 1.13 *************** *** 8,11 **** --- 8,12 ---- import java.awt.BorderLayout; + import java.awt.Dimension; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; *************** *** 80,83 **** --- 81,87 ---- add(BorderLayout.NORTH, title); add(BorderLayout.CENTER, this.content); + JPanel vfiller = new JPanel(); + vfiller.setPreferredSize(new Dimension(2000, 2000)); + add(BorderLayout.SOUTH, vfiller); addMouseListener(this); } Index: LinkAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/LinkAttribute.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** LinkAttribute.java 7 Mar 2006 23:09:44 -0000 1.3 --- LinkAttribute.java 10 Mar 2006 14:10:30 -0000 1.4 *************** *** 60,73 **** Box header = Box.createHorizontalBox(); Box column = Box.createVerticalBox(); ! header.add(Box.createHorizontalGlue()); header.add(label); ! //column.add(Box.createHorizontalStrut(60)); column.add(Box.createRigidArea(new Dimension(70, 3))); column.add(header); column.add(Box.createRigidArea(new Dimension(70, 3))); - //column.add(Box.createHorizontalStrut(60)); column.setMaximumSize(new Dimension(60, Short.MAX_VALUE)); this.add(column); - this.add(Box.createHorizontalStrut(7)); component = Box.createHorizontalBox(); component.add(createValueLabel(attribute.getValue())); --- 60,71 ---- Box header = Box.createHorizontalBox(); Box column = Box.createVerticalBox(); ! header.add(Box.createHorizontalStrut(7)); header.add(label); ! header.add(Box.createHorizontalGlue()); column.add(Box.createRigidArea(new Dimension(70, 3))); column.add(header); column.add(Box.createRigidArea(new Dimension(70, 3))); column.setMaximumSize(new Dimension(60, Short.MAX_VALUE)); this.add(column); component = Box.createHorizontalBox(); component.add(createValueLabel(attribute.getValue())); Index: DescriptionAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/DescriptionAttribute.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DescriptionAttribute.java 7 Mar 2006 23:03:18 -0000 1.2 --- DescriptionAttribute.java 10 Mar 2006 14:10:30 -0000 1.3 *************** *** 67,80 **** Box header = Box.createHorizontalBox(); Box column = Box.createVerticalBox(); ! header.add(Box.createHorizontalGlue()); header.add(label); header.add(Box.createHorizontalGlue()); - //column.add(Box.createHorizontalStrut(60)); column.add(Box.createRigidArea(new Dimension(70, 3))); column.add(header); column.add(Box.createRigidArea(new Dimension(70, 3))); ! //column.add(Box.createHorizontalStrut(60)); ! //column.setMaximumSize(new Dimension(60, Short.MAX_VALUE)); ! //this.add(Box.createHorizontalStrut(7)); component = Box.createVerticalBox(); component.add(createValueLabel(attribute.getValue())); --- 67,77 ---- Box header = Box.createHorizontalBox(); Box column = Box.createVerticalBox(); ! header.add(Box.createHorizontalStrut(7)); header.add(label); header.add(Box.createHorizontalGlue()); column.add(Box.createRigidArea(new Dimension(70, 3))); column.add(header); column.add(Box.createRigidArea(new Dimension(70, 3))); ! column.setMaximumSize(new Dimension(60, Short.MAX_VALUE)); component = Box.createVerticalBox(); component.add(createValueLabel(attribute.getValue())); |
|
From: Nikolaj B. <nbr...@us...> - 2006-03-08 14:22:54
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13314/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Project.java Log Message: Materials are now working Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** Surface.java 7 Mar 2006 23:01:54 -0000 1.79 --- Surface.java 8 Mar 2006 14:22:51 -0000 1.80 *************** *** 951,964 **** if (getFrontDomain() != null) { res.add(new Attribute("Space", getFrontDomain(), false)); - //res.add(new Attribute("Material", getFrontMaterial())); } else { res.add(new Attribute("Space", "None", false)); } if (getBackDomain() != null) { res.add(new Attribute("Space", getBackDomain(), false)); - //res.add(new Attribute("Space", getBackMaterial())); } else { res.add(new Attribute("Space", "None", false)); } if (isInner()) { res.add(new Attribute("Exterior", getExterior(), false)); --- 951,964 ---- if (getFrontDomain() != null) { res.add(new Attribute("Space", getFrontDomain(), false)); } else { res.add(new Attribute("Space", "None", false)); } + res.add(new Attribute("Front Material", getId())); if (getBackDomain() != null) { res.add(new Attribute("Space", getBackDomain(), false)); } else { res.add(new Attribute("Space", "None", false)); } + res.add(new Attribute("Back Material", getId())); if (isInner()) { res.add(new Attribute("Exterior", getExterior(), false)); Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** Project.java 25 Feb 2006 09:04:53 -0000 1.40 --- Project.java 8 Mar 2006 14:22:51 -0000 1.41 *************** *** 413,416 **** --- 413,426 ---- /** + * Find Surface by id + * @param id The id + * @return The Surface + */ + public Surface findSurfaceById(long id) { + return (Surface)mesh.getSurface(id); + } + + + /** * Intern a vertex * @param vertex The vertex |
|
From: Nikolaj B. <nbr...@us...> - 2006-03-08 14:22:16
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12822/src/net/sourceforge/bprocessor/gui/attrview Modified Files: MaterialAttribute.java GenericPanel.java Log Message: Materials are now working Index: GenericPanel.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/GenericPanel.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** GenericPanel.java 8 Mar 2006 11:57:05 -0000 1.11 --- GenericPanel.java 8 Mar 2006 14:22:05 -0000 1.12 *************** *** 26,35 **** import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Camera; import net.sourceforge.bprocessor.model.Description; import net.sourceforge.bprocessor.model.Entity; ! import net.sourceforge.bprocessor.model.Material; import net.sourceforge.bprocessor.model.Parametric; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Selection; /** --- 26,37 ---- import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Camera; + import net.sourceforge.bprocessor.model.ConstructionSpace; import net.sourceforge.bprocessor.model.Description; import net.sourceforge.bprocessor.model.Entity; ! import net.sourceforge.bprocessor.model.FunctionalSpace; import net.sourceforge.bprocessor.model.Parametric; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Selection; + import net.sourceforge.bprocessor.model.Surface; /** *************** *** 140,144 **** //da.addMouseListener(this); where.add(new AttributeRow(da)); ! } else if (a.getValue() instanceof Entity) { // Handles the links LinkAttribute la = new LinkAttribute(a); --- 142,147 ---- //da.addMouseListener(this); where.add(new AttributeRow(da)); ! } else if (a.getValue() instanceof Surface || a.getValue() instanceof FunctionalSpace ! || a.getValue() instanceof ConstructionSpace) { // Handles the links LinkAttribute la = new LinkAttribute(a); *************** *** 158,162 **** //da.addMouseListener(this); where.add(new AttributeRow(la)); ! } else if (a.getValue() instanceof Material) { // Handles the materials MaterialAttribute ma = new MaterialAttribute(a); --- 161,165 ---- //da.addMouseListener(this); where.add(new AttributeRow(la)); ! } else if (a.getName().equals("Front Material") || a.getName().equals("Back Material")) { // Handles the materials MaterialAttribute ma = new MaterialAttribute(a); Index: MaterialAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/MaterialAttribute.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MaterialAttribute.java 7 Mar 2006 23:03:58 -0000 1.1 --- MaterialAttribute.java 8 Mar 2006 14:22:05 -0000 1.2 *************** *** 8,12 **** package net.sourceforge.bprocessor.gui.attrview; ! import java.awt.Dimension; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; --- 8,12 ---- package net.sourceforge.bprocessor.gui.attrview; ! import java.awt.Color; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; *************** *** 15,25 **** import java.util.List; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JComponent; ! import javax.swing.JLabel; import javax.swing.JTextField; import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Surface; --- 15,33 ---- import java.util.List; + import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; + import javax.swing.JColorChooser; import javax.swing.JComponent; ! import javax.swing.JPanel; import javax.swing.JTextField; + import javax.swing.border.Border; + import net.sourceforge.bprocessor.gui.Defaults; + import net.sourceforge.bprocessor.gui.GUI; import net.sourceforge.bprocessor.model.Attribute; + import net.sourceforge.bprocessor.model.Material; + import net.sourceforge.bprocessor.model.Project; + import net.sourceforge.bprocessor.model.Space; import net.sourceforge.bprocessor.model.Surface; *************** *** 38,43 **** private JComponent component; ! /** The Label */ ! private JLabel label; /** The editor, when this EditableAttribute is being edited */ --- 46,54 ---- private JComponent component; ! /** The current surface */ ! private Surface surface; ! ! /** The current side */ ! private boolean side; /** The editor, when this EditableAttribute is being edited */ *************** *** 56,96 **** this.attribute = attribute; this.listeners = new LinkedList(); ! ! label = createLabel(attribute.getName()); ! Box header = Box.createHorizontalBox(); ! Box column = Box.createVerticalBox(); ! header.add(Box.createHorizontalGlue()); ! header.add(label); ! //column.add(Box.createHorizontalStrut(60)); ! column.add(Box.createRigidArea(new Dimension(70, 3))); ! column.add(header); ! column.add(Box.createRigidArea(new Dimension(70, 3))); ! //column.add(Box.createHorizontalStrut(60)); ! column.setMaximumSize(new Dimension(60, Short.MAX_VALUE)); ! this.add(column); ! this.add(Box.createHorizontalStrut(7)); component = Box.createHorizontalBox(); ! component.add(createValueLabel(attribute.getValue())); this.add(component); - this.add(Box.createHorizontalGlue()); } /** - * Create a label for the - * @param key The key - * @return A JLabel - */ - private JLabel createLabel(String key) { - JLabel keyLabel = new JLabel(key + " :"); - keyLabel.setFont(AttributeView.FONT_BOLD); - return keyLabel; - } - - /** * Add a mouselisterner to the active elements in the MaterialAttribute * @param mouseListener the mouselistener */ public void addMouseListener(MouseListener mouseListener) { - label.addMouseListener(mouseListener); component.addMouseListener(mouseListener); } --- 67,82 ---- this.attribute = attribute; this.listeners = new LinkedList(); ! ! //this.add(Box.createHorizontalStrut(7)); component = Box.createHorizontalBox(); ! component.add(createValueLabel(attribute)); this.add(component); } /** * Add a mouselisterner to the active elements in the MaterialAttribute * @param mouseListener the mouselistener */ public void addMouseListener(MouseListener mouseListener) { component.addMouseListener(mouseListener); } *************** *** 101,105 **** */ public void removeMouseListener(MouseListener mouseListener) { - label.removeMouseListener(mouseListener); component.removeMouseListener(mouseListener); } --- 87,90 ---- *************** *** 134,166 **** /** * Create a value label ! * @param value The value * @return The label */ ! private JComponent createValueLabel(Object value) { ! String s = ""; ! s = ((Surface)value).getName(); ! JLabel valueLabel = new JLabel(s); ! if (attribute.isEditable()) { ! valueLabel.setFont(AttributeView.FONT_PLAIN); } else { ! valueLabel.setFont(AttributeView.FONT_ITALIC); } return valueLabel; } - /** - * Create a value editor - * @param value The value - * @return The editor - */ - private JComponent createValueEditor(Object value) { - String s = ""; - if (value instanceof String) { - s = (String)value; - } - JTextField valueEditor = new JTextField(s); - valueEditor.setFont(AttributeView.FONT_PLAIN); - return valueEditor; - } /** --- 119,146 ---- /** * Create a value label ! * @param a The attribute * @return The label */ ! private JComponent createValueLabel(Attribute a) { ! JPanel valueLabel = new JPanel(); ! surface = Project.getInstance().findSurfaceById(Long.parseLong(a.getValue().toString())); ! if (a.getName().equals("Front Material")) { ! side = true; ! float[] frontColor = getFrontColor(surface); ! valueLabel.setOpaque(true); ! Border blackline = BorderFactory.createLineBorder(Color.black); ! valueLabel.setBorder(blackline); ! valueLabel.setBackground(makeAWTColor(frontColor)); } else { ! side = false; ! float[] backColor = getBackColor(surface); ! valueLabel.setOpaque(true); ! Border blackline = BorderFactory.createLineBorder(Color.black); ! valueLabel.setBorder(blackline); ! valueLabel.setBackground(makeAWTColor(backColor)); } return valueLabel; } /** *************** *** 176,188 **** */ public void startEditing() { ! if (attribute.isEditable()) { ! if (editor == null) { ! component.remove(0); ! editor = (JTextField) createValueEditor(attribute.getValue()); ! component.add(editor); ! component.revalidate(); } - editor.requestFocus(); - editor.selectAll(); } } --- 156,190 ---- */ public void startEditing() { ! Color defaultColor = Color.white; ! Material newMaterial; ! ! if (side) { ! if (surface.getFrontDomain() != null) { ! if (surface.getFrontMaterial() != null) { ! defaultColor = getMaterialColor(surface.getFrontMaterial()); ! } ! Color frontColor = JColorChooser.showDialog(GUI.getInstance(), ! "Surface Color", ! defaultColor); ! if (frontColor != null) { ! newMaterial = new Material("temp", frontColor.getRGBColorComponents(null)); ! surface.setFrontMaterial(newMaterial); ! surface.changed(); ! } ! } ! } else { ! if (surface.getBackDomain() != null) { ! if (surface.getBackMaterial() != null) { ! defaultColor = getMaterialColor(surface.getBackMaterial()); ! } ! Color backColor = JColorChooser.showDialog(GUI.getInstance(), ! "Surface Color", ! defaultColor); ! if (backColor != null) { ! newMaterial = new Material("temp", backColor.getRGBColorComponents(null)); ! surface.setBackMaterial(newMaterial); ! surface.changed(); ! } } } } *************** *** 200,204 **** component.remove(editor); editor = null; ! component.add(createValueLabel(attribute.getValue())); component.revalidate(); valueChanged(); --- 202,206 ---- component.remove(editor); editor = null; ! component.add(createValueLabel(attribute)); component.revalidate(); valueChanged(); *************** *** 214,221 **** component.remove(editor); editor = null; ! component.add(createValueLabel(attribute.getValue())); component.revalidate(); } } /** --- 216,293 ---- component.remove(editor); editor = null; ! component.add(createValueLabel(attribute)); component.revalidate(); } } + + /** + * Get AWT color for material + * @param material The material + * @return The AWT color + */ + private Color getMaterialColor(Material material) { + float[] rgb = material.getColor(); + return new Color(rgb[0], rgb[1], rgb[2]); + } + + /** + * Make AWT color from the components + * @param rgb Array of floats + * @return AWT Color + */ + private Color makeAWTColor(float[] rgb) { + return new Color(rgb[0], rgb[1], rgb[2]); + } + + + /** + * Return front color for surface + * @param surface The surface + * @return The color + */ + private float[] getFrontColor(Surface surface) { + if (surface.getFrontDomain() == null) { + return Defaults.getNoneColor(); + } else { + if (surface.getFrontMaterial() == null) { + Space space = surface.getFrontDomain(); + if (space.isConstructionSpace()) { + return Defaults.getFrontColor(); + } + if (space.isFunctionalSpace()) { + return Defaults.getBackColor(); + } + return Defaults.getNoneColor(); + } else { + return surface.getFrontMaterial().getColor(); + } + } + } + + + /** + * Return back color for surface + * @param surface The surface + * @return The color + */ + private float[] getBackColor(Surface surface) { + if (surface.getBackDomain() == null) { + return Defaults.getNoneColor(); + } else { + if (surface.getBackMaterial() == null) { + Space space = surface.getBackDomain(); + if (space.isConstructionSpace()) { + return Defaults.getFrontColor(); + } + if (space.isFunctionalSpace()) { + return Defaults.getBackColor(); + } + return Defaults.getNoneColor(); + } else { + return surface.getBackMaterial().getColor(); + } + } + } + /** |
|
From: Michael L. <he...@us...> - 2006-03-08 11:57:10
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30009/src/net/sourceforge/bprocessor/gui/attrview Modified Files: GenericPanel.java Log Message: Changed usage of Surface, ConstructionSpace and FunctionalSpace to just Entity in GenericPanel Index: GenericPanel.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/GenericPanel.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** GenericPanel.java 7 Mar 2006 23:06:35 -0000 1.10 --- GenericPanel.java 8 Mar 2006 11:57:05 -0000 1.11 *************** *** 26,38 **** import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Camera; - import net.sourceforge.bprocessor.model.ConstructionSpace; import net.sourceforge.bprocessor.model.Description; import net.sourceforge.bprocessor.model.Entity; - import net.sourceforge.bprocessor.model.FunctionalSpace; import net.sourceforge.bprocessor.model.Material; import net.sourceforge.bprocessor.model.Parametric; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Selection; - import net.sourceforge.bprocessor.model.Surface; /** --- 26,35 ---- *************** *** 143,148 **** //da.addMouseListener(this); where.add(new AttributeRow(da)); ! } else if (a.getValue() instanceof Surface || a.getValue() instanceof FunctionalSpace ! || a.getValue() instanceof ConstructionSpace) { // Handles the links LinkAttribute la = new LinkAttribute(a); --- 140,144 ---- //da.addMouseListener(this); where.add(new AttributeRow(da)); ! } else if (a.getValue() instanceof Entity) { // Handles the links LinkAttribute la = new LinkAttribute(a); |
|
From: Nikolaj B. <nbr...@us...> - 2006-03-07 23:09:51
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8174/src/net/sourceforge/bprocessor/gui/attrview Modified Files: LinkAttribute.java Log Message: Small fixes Index: LinkAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/LinkAttribute.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LinkAttribute.java 7 Mar 2006 22:54:44 -0000 1.2 --- LinkAttribute.java 7 Mar 2006 23:09:44 -0000 1.3 *************** *** 25,29 **** /** ! * The StringAttributeView */ public class LinkAttribute extends GenericAttribute { --- 25,29 ---- /** ! * The LinkAttributeView */ public class LinkAttribute extends GenericAttribute { *************** *** 48,52 **** /** ! * Constructor for StringAttribute * @param attribute The attribute */ --- 48,52 ---- /** ! * Constructor for LinkAttribute * @param attribute The attribute */ *************** *** 88,92 **** /** ! * Add a mouselisterner to the active elements in the StringAttribute * @param mouseListener the mouselistener */ --- 88,92 ---- /** ! * Add a mouselisterner to the active elements in the LinkAttribute * @param mouseListener the mouselistener */ *************** *** 97,101 **** /** ! * Remove a mouselisterner to the active elements in the StringAttribute * @param mouseListener the mouselistener */ --- 97,101 ---- /** ! * Remove a mouselisterner to the active elements in the LinkAttribute * @param mouseListener the mouselistener */ |
|
From: Nikolaj B. <nbr...@us...> - 2006-03-07 23:06:40
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6559/src/net/sourceforge/bprocessor/gui/attrview Modified Files: GenericPanel.java Log Message: Fixed minor bugs, and made spaces on surfaces to links Index: GenericPanel.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/GenericPanel.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** GenericPanel.java 7 Mar 2006 22:54:44 -0000 1.9 --- GenericPanel.java 7 Mar 2006 23:06:35 -0000 1.10 *************** *** 26,34 **** --- 26,38 ---- import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Camera; + import net.sourceforge.bprocessor.model.ConstructionSpace; import net.sourceforge.bprocessor.model.Description; import net.sourceforge.bprocessor.model.Entity; + import net.sourceforge.bprocessor.model.FunctionalSpace; + import net.sourceforge.bprocessor.model.Material; import net.sourceforge.bprocessor.model.Parametric; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Selection; + import net.sourceforge.bprocessor.model.Surface; /** *************** *** 139,144 **** //da.addMouseListener(this); where.add(new AttributeRow(da)); ! } else if (a.getValue() instanceof Entity) { ! // Handles the description field LinkAttribute la = new LinkAttribute(a); la.addLinkAttributeListener(new AttributeListener() { --- 143,149 ---- //da.addMouseListener(this); where.add(new AttributeRow(da)); ! } else if (a.getValue() instanceof Surface || a.getValue() instanceof FunctionalSpace ! || a.getValue() instanceof ConstructionSpace) { ! // Handles the links LinkAttribute la = new LinkAttribute(a); la.addLinkAttributeListener(new AttributeListener() { *************** *** 157,161 **** //da.addMouseListener(this); where.add(new AttributeRow(la)); ! } else { log.info("[GenericPanel] Something were not implemented"); } --- 162,183 ---- //da.addMouseListener(this); where.add(new AttributeRow(la)); ! } else if (a.getValue() instanceof Material) { ! // Handles the materials ! MaterialAttribute ma = new MaterialAttribute(a); ! ma.addMaterialAttributeListener(new AttributeListener() { ! public void valueChanged(Attribute a) { ! obj.setAttributes(attributes); ! if (obj instanceof Entity) { ! simpleUpdate = true; ! ((Entity)obj).changed(); ! } else if (obj instanceof Camera) { ! Project.getInstance().changed((Camera)obj); ! } else { ! log.info("Were not a Entity object " + obj); ! } ! } ! }); ! where.add(new AttributeRow(ma)); ! } else { log.info("[GenericPanel] Something were not implemented"); } *************** *** 173,177 **** if (ga instanceof LinkAttribute) { Selection.primary().set(ga.attribute().getValue()); - //Selection.primary().changed(); } else { if (current != null) { --- 195,198 ---- |
|
From: Nikolaj B. <nbr...@us...> - 2006-03-07 23:04:04
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5220/src/net/sourceforge/bprocessor/gui/attrview Added Files: MaterialAttribute.java Log Message: The Material attribute (not working yet) --- NEW FILE: MaterialAttribute.java --- //--------------------------------------------------------------------------------- // $Id: MaterialAttribute.java,v 1.1 2006/03/07 23:03:58 nbramsen 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.attrview; import java.awt.Dimension; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JTextField; import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Surface; /** * The MaterialAttributeView */ public class MaterialAttribute extends GenericAttribute { /** The listeners */ private List listeners; /** The attribute this gui represents */ private Attribute attribute; /** The component */ private JComponent component; /** The Label */ private JLabel label; /** The editor, when this EditableAttribute is being edited */ private JTextField editor; /** * Constructor for MaterialAttribute * @param attribute The attribute */ public MaterialAttribute(Attribute attribute) { super(BoxLayout.X_AXIS); this.attribute = attribute; this.listeners = new LinkedList(); label = createLabel(attribute.getName()); Box header = Box.createHorizontalBox(); Box column = Box.createVerticalBox(); header.add(Box.createHorizontalGlue()); header.add(label); //column.add(Box.createHorizontalStrut(60)); column.add(Box.createRigidArea(new Dimension(70, 3))); column.add(header); column.add(Box.createRigidArea(new Dimension(70, 3))); //column.add(Box.createHorizontalStrut(60)); column.setMaximumSize(new Dimension(60, Short.MAX_VALUE)); this.add(column); this.add(Box.createHorizontalStrut(7)); component = Box.createHorizontalBox(); component.add(createValueLabel(attribute.getValue())); this.add(component); this.add(Box.createHorizontalGlue()); } /** * Create a label for the * @param key The key * @return A JLabel */ private JLabel createLabel(String key) { JLabel keyLabel = new JLabel(key + " :"); keyLabel.setFont(AttributeView.FONT_BOLD); return keyLabel; } /** * Add a mouselisterner to the active elements in the MaterialAttribute * @param mouseListener the mouselistener */ public void addMouseListener(MouseListener mouseListener) { label.addMouseListener(mouseListener); component.addMouseListener(mouseListener); } /** * Remove a mouselisterner to the active elements in the MaterialAttribute * @param mouseListener the mouselistener */ public void removeMouseListener(MouseListener mouseListener) { label.removeMouseListener(mouseListener); component.removeMouseListener(mouseListener); } /** * Add a listener that are notified when the value is changed * @param listener The listener */ public void addMaterialAttributeListener(AttributeListener listener) { listeners.add(listener); } /** * Remove a listener * @param listener The listener */ public void removeMaterialAttributeListener(AttributeListener listener) { listeners.remove(listener); } /** * Send valueChanged to all listeners */ protected void valueChanged() { Iterator iter = listeners.iterator(); while (iter.hasNext()) { AttributeListener current = (AttributeListener) iter.next(); current.valueChanged(attribute); } } /** * Create a value label * @param value The value * @return The label */ private JComponent createValueLabel(Object value) { String s = ""; s = ((Surface)value).getName(); JLabel valueLabel = new JLabel(s); if (attribute.isEditable()) { valueLabel.setFont(AttributeView.FONT_PLAIN); } else { valueLabel.setFont(AttributeView.FONT_ITALIC); } return valueLabel; } /** * Create a value editor * @param value The value * @return The editor */ private JComponent createValueEditor(Object value) { String s = ""; if (value instanceof String) { s = (String)value; } JTextField valueEditor = new JTextField(s); valueEditor.setFont(AttributeView.FONT_PLAIN); return valueEditor; } /** * Return the attribute * @return The attribute */ public Attribute attribute() { return attribute; } /** * Start editing the value by replacing the label with an editor */ public void startEditing() { if (attribute.isEditable()) { if (editor == null) { component.remove(0); editor = (JTextField) createValueEditor(attribute.getValue()); component.add(editor); component.revalidate(); } editor.requestFocus(); editor.selectAll(); } } /** * Stop editing the value by replacing the editor with an label, * and sending valueChanged to all listeners. */ public void stopEditing() { if (editor != null && attribute.isEditable()) { Object val = attribute.getValue(); if (val instanceof String) { attribute.setValue(editor.getText()); } component.remove(editor); editor = null; component.add(createValueLabel(attribute.getValue())); component.revalidate(); valueChanged(); } } /** * Cancels editing the value by replacing the editor with an label, * without sending any events to listeners. */ public void cancelEditing() { if (editor != null) { component.remove(editor); editor = null; component.add(createValueLabel(attribute.getValue())); component.revalidate(); } } /** * Start editing on the view * @param event The event */ public void mouseClicked(MouseEvent event) { } /** * Not in use * @param event The MouseEvent */ public void mousePressed(MouseEvent event) { } /** * Not in use * @param event The MouseEvent */ public void mouseReleased(MouseEvent event) { } /** * Not in use * @param event The MouseEvent */ public void mouseEntered(MouseEvent event) { } /** * Not in use * @param event The MouseEvent */ public void mouseExited(MouseEvent event) { } } |
|
From: Nikolaj B. <nbr...@us...> - 2006-03-07 23:03:28
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4812/src/net/sourceforge/bprocessor/gui/attrview Modified Files: DescriptionAttribute.java Log Message: Fixed some minor bugs in the description area Index: DescriptionAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/DescriptionAttribute.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DescriptionAttribute.java 28 Feb 2006 02:25:48 -0000 1.1 --- DescriptionAttribute.java 7 Mar 2006 23:03:18 -0000 1.2 *************** *** 10,13 **** --- 10,15 ---- import java.awt.Color; import java.awt.Dimension; + import java.awt.event.FocusEvent; + import java.awt.event.FocusListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; *************** *** 28,32 **** * The StringAttributeView */ ! public class DescriptionAttribute extends GenericAttribute implements MouseListener { /** The listeners */ --- 30,34 ---- * The StringAttributeView */ ! public class DescriptionAttribute extends GenericAttribute implements MouseListener, FocusListener { /** The listeners */ *************** *** 45,48 **** --- 47,53 ---- private JTextArea descriptionEditor; + /** The defualt background color */ + private Color bgcolor; + *************** *** 59,62 **** --- 64,68 ---- label = createLabel(attribute.getName()); + bgcolor = label.getBackground(); Box header = Box.createHorizontalBox(); Box column = Box.createVerticalBox(); *************** *** 142,146 **** s = value.toString(); JTextArea valueLabel = new JTextArea(s); ! valueLabel.setBackground(new Color(204, 204, 204)); valueLabel.setLineWrap(true); valueLabel.setWrapStyleWord(true); --- 148,152 ---- s = value.toString(); JTextArea valueLabel = new JTextArea(s); ! valueLabel.setBackground(bgcolor); valueLabel.setLineWrap(true); valueLabel.setWrapStyleWord(true); *************** *** 185,188 **** --- 191,195 ---- descriptionEditor.setLineWrap(true); descriptionEditor.setWrapStyleWord(true); + descriptionEditor.addFocusListener(this); component.add(descriptionEditor); component.revalidate(); *************** *** 251,253 **** --- 258,278 ---- */ public void mouseExited(MouseEvent event) { } + + /** + * Not in use + * @param event The FocusEvent + */ + public void focusGained(FocusEvent event) { + // TODO Auto-generated method stub + + } + + /** + * StopEditing the description + * @param event The FocusEvent + */ + public void focusLost(FocusEvent event) { + stopEditing(); + + } } |
|
From: Nikolaj B. <nbr...@us...> - 2006-03-07 23:02:00
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4004/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Log Message: Spaces are now links too Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** Surface.java 7 Mar 2006 22:54:50 -0000 1.78 --- Surface.java 7 Mar 2006 23:01:54 -0000 1.79 *************** *** 951,954 **** --- 951,955 ---- if (getFrontDomain() != null) { res.add(new Attribute("Space", getFrontDomain(), false)); + //res.add(new Attribute("Material", getFrontMaterial())); } else { res.add(new Attribute("Space", "None", false)); *************** *** 956,959 **** --- 957,961 ---- if (getBackDomain() != null) { res.add(new Attribute("Space", getBackDomain(), false)); + //res.add(new Attribute("Space", getBackMaterial())); } else { res.add(new Attribute("Space", "None", false)); |
|
From: Michael L. <he...@us...> - 2006-03-07 22:54:53
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32626/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Log Message: Implemented space as link attribute in surface panel Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** Surface.java 7 Mar 2006 16:47:46 -0000 1.77 --- Surface.java 7 Mar 2006 22:54:50 -0000 1.78 *************** *** 950,959 **** res.add(new Attribute("Name", getName(), false)); if (getFrontDomain() != null) { ! res.add(new Attribute("Space", getFrontDomain().getName(), false)); } else { res.add(new Attribute("Space", "None", false)); } if (getBackDomain() != null) { ! res.add(new Attribute("Space", getBackDomain().getName(), false)); } else { res.add(new Attribute("Space", "None", false)); --- 950,959 ---- res.add(new Attribute("Name", getName(), false)); if (getFrontDomain() != null) { ! res.add(new Attribute("Space", getFrontDomain(), false)); } else { res.add(new Attribute("Space", "None", false)); } if (getBackDomain() != null) { ! res.add(new Attribute("Space", getBackDomain(), false)); } else { res.add(new Attribute("Space", "None", false)); |
|
From: Michael L. <he...@us...> - 2006-03-07 22:54:50
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32590/src/net/sourceforge/bprocessor/gui/attrview Modified Files: LinkAttribute.java GenericPanel.java Log Message: Implemented space as link attribute in surface panel Index: GenericPanel.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/GenericPanel.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** GenericPanel.java 28 Feb 2006 02:25:49 -0000 1.8 --- GenericPanel.java 7 Mar 2006 22:54:44 -0000 1.9 *************** *** 31,35 **** import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Selection; - import net.sourceforge.bprocessor.model.Surface; /** --- 31,34 ---- *************** *** 140,144 **** //da.addMouseListener(this); where.add(new AttributeRow(da)); ! } else if (a.getValue() instanceof Surface) { // Handles the description field LinkAttribute la = new LinkAttribute(a); --- 139,143 ---- //da.addMouseListener(this); where.add(new AttributeRow(da)); ! } else if (a.getValue() instanceof Entity) { // Handles the description field LinkAttribute la = new LinkAttribute(a); Index: LinkAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/LinkAttribute.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LinkAttribute.java 28 Feb 2006 02:25:49 -0000 1.1 --- LinkAttribute.java 7 Mar 2006 22:54:44 -0000 1.2 *************** *** 22,26 **** import net.sourceforge.bprocessor.model.Attribute; ! import net.sourceforge.bprocessor.model.Surface; /** --- 22,26 ---- import net.sourceforge.bprocessor.model.Attribute; ! import net.sourceforge.bprocessor.model.Entity; /** *************** *** 139,143 **** private JComponent createValueLabel(Object value) { String s = ""; ! s = ((Surface)value).getName(); JLabel valueLabel = new JLabel(s); if (attribute.isEditable()) { --- 139,143 ---- private JComponent createValueLabel(Object value) { String s = ""; ! s = ((Entity)value).getName(); JLabel valueLabel = new JLabel(s); if (attribute.isEditable()) { |
|
From: Michael L. <he...@us...> - 2006-03-07 22:31:14
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18504/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Implemented general mechanism for finding point in model (vertex, point on edge, point on surface, edge intersection, surface/edge intersection, edge midpoint) Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** View.java 6 Mar 2006 06:51:52 -0000 1.69 --- View.java 7 Mar 2006 22:31:05 -0000 1.70 *************** *** 10,13 **** --- 10,14 ---- import net.sourceforge.bprocessor.gl.tool.SpaceTool; import net.sourceforge.bprocessor.gl.model.ClippingPlane; + import net.sourceforge.bprocessor.gl.model.Intersection; import net.sourceforge.bprocessor.gui.Defaults; import net.sourceforge.bprocessor.gui.Toolbar; *************** *** 1744,1748 **** * @return Selection */ ! private List processSelect(Collection unWantedEntities, boolean intersections) { int bufferOffset = 0; int names = 0; --- 1745,1749 ---- * @return Selection */ ! private Object processSelect(Collection unWantedEntities, boolean intersections) { int bufferOffset = 0; int names = 0; *************** *** 1762,1767 **** Collection edges = new HashSet(); - List result = new LinkedList(); - for (int i = 0; i < hits; i++) { names = selectBuffer.get(bufferOffset); --- 1763,1766 ---- *************** *** 1852,1911 **** } ! ! if (object != null) { ! result.add(object); ! } else { if (vertex != null) { ! result.add(vertex); } else { if (edge != null) { - if (intersections) { - Vertex intersection = null; - Transformation transformation = this.transformation(); - - Edge e1 = edge; - Vertex v1 = e1.getTo().minus(e1.getFrom()); - edges.remove(edge); - Iterator iter = edges.iterator(); ! while (iter.hasNext()) { ! Edge e2 = (Edge) iter.next(); ! Vertex v2 = e2.getTo().minus(e2.getFrom()); ! Vertex cross = v1.cross(v2); ! if (!cross.isZero()) { ! Edge intersect = e1.intersection(e2); ! if (intersect != null) { ! if (intersect.getLength() < 0.0000001) { ! intersection = intersect.getFrom(); } } } } ! if (intersection != null) { ! Vertex projected = transformation.project(intersection); ! double dx = x - projected.getX(); ! double dy = (height - y) - projected.getY(); ! double distance = Math.sqrt(dx * dx + dy * dy); ! if (distance < 6) { ! result.add(intersection); ! } else { ! result.add(edge); ! } ! } else { ! result.add(edge); } - } else { - result.add(edge); - edges.remove(edge); - result.addAll(edges); } } else { if (surface != null) { ! result.add(surface); } } } } ! return result; } --- 1851,1939 ---- } ! if (intersections) { ! Transformation transformation = this.transformation(); ! Vertex near = new Vertex(x, height - y, 0.0); ! Vertex far = new Vertex(x, height - y, 1.0); ! Edge ray = new Edge(near, far); ! ray = transformation.unProject(ray); if (vertex != null) { ! return new Intersection(vertex, Intersection.VERTEX, null); } else { if (edge != null) { ! Edge e1 = edge; ! Vertex v1 = e1.getTo().minus(e1.getFrom()); ! edges.remove(edge); ! Iterator iter = edges.iterator(); ! ! while (iter.hasNext()) { ! Edge e2 = (Edge) iter.next(); ! Vertex v2 = e2.getTo().minus(e2.getFrom()); ! Vertex cross = v1.cross(v2); ! if (!cross.isZero()) { ! Edge intersect = e1.intersection(e2); ! if (intersect != null) { ! if (intersect.getLength() < 0.0000001) { ! Vertex i = intersect.getFrom(); ! Vertex projected = transformation.project(i); ! double dx = x - projected.getX(); ! double dy = (height - y) - projected.getY(); ! double distance = Math.sqrt(dx * dx + dy * dy); ! if (distance < 6) { ! return new Intersection(i, Intersection.EDGE_INTERSECTION, edge); } } } } ! } ! ! { ! Vertex m = edge.getFrom().add(edge.getTo()); ! m.scale(0.5); ! Vertex projected = transformation.project(m); ! double dx = x - projected.getX(); ! double dy = (height - y) - projected.getY(); ! double distance = Math.sqrt(dx * dx + dy * dy); ! if (distance < 6) { ! return new Intersection(m, Intersection.EDGE_MIDPOINT, edge); } } + + { + Edge intersect = edge.intersection(ray); + Vertex intersection = intersect.getFrom(); + return new Intersection(intersection, Intersection.EDGE, edge); + } + } else { if (surface != null) { ! Plane plane = surface.plane(); ! Vertex intersection = plane.intersection(ray); ! return new Intersection(intersection, Intersection.SURFACE, surface); ! } else { ! Plane xy = new Plane(0, 0, 1, 0); ! Vertex intersection = xy.intersection(ray); ! if (intersection != null) { ! // FIXME The plane intersection should take care ! // of the following round off ! intersection.setZ(0.0); ! return new Intersection(intersection, Intersection.PLANE_INTERSECTION, null); ! } } } } + } else { + if (object != null) { + return object; + } else if (vertex != null) { + return vertex; + } else if (edge != null) { + return edge; + } else if (surface != null) { + return surface; + } } ! ! return null; } *************** *** 1922,1926 **** * @return entity under the point. */ ! public List getObjectAtPoint(double x, double y, Collection unWantedEntities, boolean intersections) { this.x = x; --- 1950,1954 ---- * @return entity under the point. */ ! public Object getObjectAtPoint(double x, double y, Collection unWantedEntities, boolean intersections) { this.x = x; *************** *** 1931,1937 **** glv.repaint(true); ! List selection = processSelect(unWantedEntities, intersections); clearNames(); ! return selection; } --- 1959,1965 ---- glv.repaint(true); ! Object object = processSelect(unWantedEntities, intersections); clearNames(); ! return object; } *************** *** 1942,1946 **** * @return The object under the point, null if no object is there */ ! public List getObjectAtPoint(double x, double y) { return getObjectAtPoint(x, y, new HashSet(), false); } --- 1970,1974 ---- * @return The object under the point, null if no object is there */ ! public Object getObjectAtPoint(double x, double y) { return getObjectAtPoint(x, y, new HashSet(), false); } *************** *** 2014,2018 **** glv.repaint(true); ! List selection = processSelect(new HashSet(), false); clearNames(); return selection; --- 2042,2050 ---- glv.repaint(true); ! List selection = new LinkedList(); ! Object object = processSelect(new HashSet(), false); ! if (object != null) { ! selection.add(object); ! } clearNames(); return selection; *************** *** 2033,2037 **** glv.repaint(true); ! List selection = processSelect(new HashSet(), false); clearNames(); return selection; --- 2065,2073 ---- glv.repaint(true); ! List selection = new LinkedList(); ! Object object = processSelect(new HashSet(), false); ! if (object != null) { ! selection.add(object); ! } clearNames(); return selection; |
|
From: Michael L. <he...@us...> - 2006-03-07 22:31:12
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18504/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java PencilTool.java MoveTool.java Log Message: Implemented general mechanism for finding point in model (vertex, point on edge, point on surface, edge intersection, surface/edge intersection, edge midpoint) Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** MoveTool.java 6 Mar 2006 06:51:52 -0000 1.42 --- MoveTool.java 7 Mar 2006 22:31:04 -0000 1.43 *************** *** 373,384 **** delta = restrictCopy; } else if (moveMode == FREE_SNAP) { ! List objects = glv.getView().getObjectAtPoint(e.getX(), e.getY(), moveEntities, false); ! Iterator it = objects.iterator(); ! if (it.hasNext()) { ! Object o = it.next(); ! if (o != null) { ! snapEntity = (Entity)o; ! delta = findInitial(snapEntity, e).minus(from); ! } } } else if (moveMode == CONTROLLED) { --- 373,380 ---- delta = restrictCopy; } else if (moveMode == FREE_SNAP) { ! Object o = glv.getView().getObjectAtPoint(e.getX(), e.getY(), moveEntities, false); ! if (o != null) { ! snapEntity = (Entity)o; ! delta = findInitial(snapEntity, e).minus(from); } } else if (moveMode == CONTROLLED) { *************** *** 419,434 **** glv.getView().addTempSurface(hitSurface2); glv.getView().addTempSurface(hitSurface3); ! List objects = glv.getView().getObjectAtPoint(e.getX(), e.getY()); ! Iterator it = objects.iterator(); ! while (it.hasNext()) { ! Object ob = it.next(); ! if (ob instanceof Surface) { ! Surface surface = (Surface)ob; ! if (surface.equals(hitSurface1) || ! surface.equals(hitSurface2) || ! surface.equals(hitSurface3)) { ! dragPlane = surface.plane(); ! restrictionVector = new Vertex(0, 0, 0); ! } } } --- 415,426 ---- glv.getView().addTempSurface(hitSurface2); glv.getView().addTempSurface(hitSurface3); ! Object ob = glv.getView().getObjectAtPoint(e.getX(), e.getY()); ! if (ob instanceof Surface) { ! Surface surface = (Surface)ob; ! if (surface.equals(hitSurface1) || ! surface.equals(hitSurface2) || ! surface.equals(hitSurface3)) { ! dragPlane = surface.plane(); ! restrictionVector = new Vertex(0, 0, 0); } } Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** PencilTool.java 6 Mar 2006 06:51:52 -0000 1.61 --- PencilTool.java 7 Mar 2006 22:31:04 -0000 1.62 *************** *** 11,15 **** import java.awt.event.KeyEvent; import java.util.ArrayList; - import java.util.Collection; import java.util.List; import java.util.Set; --- 11,14 ---- *************** *** 17,23 **** import net.sourceforge.bprocessor.gl.GLView; ! import net.sourceforge.bprocessor.gl.view.Transformation; import net.sourceforge.bprocessor.gl.view.View; - import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Plane; --- 16,21 ---- import net.sourceforge.bprocessor.gl.GLView; ! import net.sourceforge.bprocessor.gl.model.Intersection; import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Plane; *************** *** 25,29 **** import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; - import net.sourceforge.bprocessor.model.Space; import net.sourceforge.bprocessor.model.Geometry; --- 23,26 ---- *************** *** 68,74 **** protected Vertex snapVertex = null; - /** The exterior Surface is a Surface, where a hole is being defined */ - protected Surface exterior = null; - /** The candidates are the Set of surfaces that could be the exterior * for a hole being defined. --- 65,68 ---- *************** *** 100,109 **** int y = event.getY(); View view = glv.getView(); ! List selection = view.getObjectAtPoint(x, y, new HashSet(), true); ! if (selection.isEmpty()) { target = null; ! } else { ! target = selection.get(0); } } --- 94,125 ---- int y = event.getY(); View view = glv.getView(); ! Intersection intersection = (Intersection) view.getObjectAtPoint(x, y, new HashSet(), true); ! current = intersection.vertex(); ! switch (intersection.type()) { ! case Intersection.VERTEX: ! target = current; ! setSnapVertex(current); ! break; ! case Intersection.EDGE: ! target = intersection.object(); ! break; ! case Intersection.SURFACE: ! target = intersection.object(); ! break; ! case Intersection.EDGE_MIDPOINT: ! target = current; ! setSnapVertex(current); ! break; ! case Intersection.EDGE_INTERSECTION: ! target = current; ! break; ! case Intersection.SURFACE_INTERSECTION: ! target = current; ! break; ! case Intersection.PLANE_INTERSECTION: target = null; ! break; } + view.makeTarget(target); } *************** *** 390,394 **** setAlignVertex(null); setSnapVertex(null); - exterior = null; currentPlane = null; } --- 406,409 ---- *************** *** 434,450 **** /** - * Round to grid - * @param value The value - * @return The rounded value - */ - protected double round(double value) { - if (Math.abs(value - Math.round(value)) < 0.3) { - return Math.round(value); - } else { - return ((double) Math.round(value * 1000)) / 1000.0; - } - } - - /** * Set current vertex to an appropriate vertex * @param event The MouseEvent --- 449,452 ---- *************** *** 453,548 **** protected boolean findVertex(MouseEvent event) { boolean legal = true; ! boolean snap = false; ! double x = event.getX(); ! double y = View.getHeight() - event.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); ! CoordinateSystem system = null; ! ! if (target != null) { ! if (target instanceof Vertex) { ! current = (Vertex) target; ! } ! if (target instanceof Surface) { ! Surface surface = (Surface) target; ! Plane plane = surface.plane(); ! Vertex vertex = plane.intersection(ray); ! system = surface.coordinateSystem(); ! current = vertex; ! if (active != null) { ! if (exterior != null) { ! legal = (target == exterior); ! } else { ! exterior = (Surface) target; ! legal = true; ! } ! } ! if (exterior != null) { ! system = exterior.coordinateSystem(); ! } ! } ! if (target instanceof Edge) { ! Edge edge = (Edge) target; ! Edge intersection = edge.intersection(ray); ! Vertex vertex = intersection.getFrom(); ! current = vertex; ! } ! } else { ! Plane xy = new Plane(0, 0, 1, 0); ! Vertex vertex = xy.intersection(ray); ! snap = true; ! if (vertex != null) { ! // FIXME The plane intersection should take care ! // of the following round off ! vertex.setZ(0.0); ! current = vertex; ! } else { ! // just to take an initial bug ! current = new Vertex(0, 0, 0); ! } ! } ! if (current.getId() == null) { ! if (snap) { ! Vertex origin = new Vertex(0, 0, 0); ! Vertex i = new Vertex(1, 0, 0); ! Vertex j = new Vertex(0, 1, 0); ! Vertex n = new Vertex(0, 0, 1); ! system = new CoordinateSystem(i, j, n, origin); ! //snapInSystem(system, current); ! } else { ! if (legal) { ! if (system != null) { ! //snapInSystem(system, current); ! } ! } ! } ! Set vertices = Project.getInstance().findByLocation ! (current.getX(), current.getY(), current.getZ(), 0.0); ! if (!vertices.isEmpty()) { ! //current = (Vertex) vertices.iterator().next(); ! } ! } ! ! /* ! * Should disallow you to draw out of the current plane if ! * you allready have two or more edges. Thus disallowing you ! * to draw non-plane surfaces. ! */ ! if (legal && ! currentPlane != null && ! edges != null && ! edges.size() > 1) { ! double[] planeRep = currentPlane.getDoublev(); ! if (Math.abs(current.getX() * planeRep[0] + ! current.getY() * planeRep[1] + ! current.getZ() * planeRep[2] + ! planeRep[3]) > 0.00001) { ! legal = false; ! } ! } return legal; } --- 455,459 ---- protected boolean findVertex(MouseEvent event) { boolean legal = true; ! current = (Vertex) target; return legal; } *************** *** 554,562 **** protected void pressed(MouseEvent e) { findPencilTarget(e); ! glv.getView().makeTarget(target); ! boolean legal = findVertex(e); ! if (legal) { ! onVertex(current); ! } } /** --- 465,469 ---- protected void pressed(MouseEvent e) { findPencilTarget(e); ! onVertex(current); } /** *************** *** 566,588 **** protected void moved(MouseEvent e) { findPencilTarget(e); ! glv.getView().makeTarget(target); ! if (target != null) { ! if (target instanceof Vertex) { ! Vertex vertex = (Vertex) target; ! if (vertex.getId() != null) { ! setSnapVertex(vertex); ! } ! } ! } ! boolean clear = (exterior == null); ! boolean legal = findVertex(e); ! if (clear) { ! exterior = null; ! } ! if (legal) { ! glv.getView().setCurrentVertex(current); ! } else { ! glv.getView().setCurrentVertex(current); ! } /** Show the length of the active edge */ if (active != null) { --- 473,477 ---- protected void moved(MouseEvent e) { findPencilTarget(e); ! glv.getView().setCurrentVertex(current); /** Show the length of the active edge */ if (active != null) { *************** *** 619,623 **** protected void released(MouseEvent e) { findPencilTarget(e); - glv.getView().makeTarget(target); } --- 508,511 ---- *************** *** 658,662 **** setAlignVertex(null); setSnapVertex(null); - exterior = null; glv.repaint(); } else if (e.getKeyCode() == KeyEvent.VK_1) { --- 546,549 ---- *************** *** 752,772 **** } } - } - - /** - * Find the space we did draw in - * @param s The surface to check for the location of - * @return The Space - */ - private Space findSpace(Surface s) { - Collection set = Project.getInstance().getFunctionalSpaces(); - Iterator it = set.iterator(); - while (it.hasNext()) { - Space fs = (Space)it.next(); - if (fs.getName().equals("Ext")) { - return fs; - } - } - return null; } --- 639,642 ---- Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** AbstractTool.java 1 Mar 2006 11:16:17 -0000 1.60 --- AbstractTool.java 7 Mar 2006 22:31:03 -0000 1.61 *************** *** 583,592 **** int y = event.getY(); View view = glv.getView(); ! List selection = view.getObjectAtPoint(x, y); ! if (selection.isEmpty()) { ! target = null; ! } else { ! target = selection.get(0); ! } } --- 583,587 ---- int y = event.getY(); View view = glv.getView(); ! target = view.getObjectAtPoint(x, y); } |
|
From: Michael L. <he...@us...> - 2006-03-07 22:31:10
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18504/src/net/sourceforge/bprocessor/gl/model Added Files: Intersection.java Log Message: Implemented general mechanism for finding point in model (vertex, point on edge, point on surface, edge intersection, surface/edge intersection, edge midpoint) --- NEW FILE: Intersection.java --- //--------------------------------------------------------------------------------- // $Id: Intersection.java,v 1.1 2006/03/07 22:31:06 henryml 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.model; import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Vertex; /** * Intersection */ public class Intersection { /** Vertex point */ public static final int VERTEX = 1; /** Edge point */ public static final int EDGE = 2; /** Surface point */ public static final int SURFACE = 3; /** Edge midpoint */ public static final int EDGE_MIDPOINT = 4; /** Edge intersection */ public static final int EDGE_INTERSECTION = 5; /** Surface intersection */ public static final int SURFACE_INTERSECTION = 6; /** Plane intersection */ public static final int PLANE_INTERSECTION = 7; /** The vertex */ private Vertex vertex; /** The type */ private int type; /** The primary object */ private Geometric object; /** * Constructor * @param vertex The vertex * @param type The type * @param object The object */ public Intersection(Vertex vertex, int type, Geometric object) { super(); this.vertex = vertex; this.type = type; this.object = object; } /** * * @return vertex */ public Vertex vertex() { return vertex; } /** * * @return type */ public int type() { return type; } /** * * @return object */ public Geometric object() { return object; } } |
|
From: rimestad <rim...@us...> - 2006-03-07 16:47:51
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8145/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Log Message: The extrusion is fixed and seems to work Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** Surface.java 28 Feb 2006 13:25:04 -0000 1.76 --- Surface.java 7 Mar 2006 16:47:46 -0000 1.77 *************** *** 353,357 **** Direction d = (Direction)o; Vertex dir = d.getDirection(); - log.info("The " + d.getVertex() + "were moved " + dir); Vertex v = dir.copy(); v.scale(delta); --- 353,356 ---- *************** *** 400,421 **** vmap[i] = d.getVertex(); d.alterDirection(normal); - log.info(v[i] + " direction altered to " + d); } else { - log.info(v[i] + " direction of " + normal); vmap[i] = v[i].copy(); v2dir.put(v[i], new Direction(vmap[i], normal)); } - getMesh().add(vmap[i]); } for (int i = 0; i < n; i++) { if (e2e.containsKey(e[i])) { - log.info("The edge " + e[i] + " were allready there"); topmap[i] = (Edge)e2e.get(e[i]); } else { topmap[i] = new Edge(vmap[i], vmap[(i + 1) % n]); e2e.put(e[i], topmap[i]); } - getMesh().add(topmap[i]); } --- 399,417 ---- vmap[i] = d.getVertex(); d.alterDirection(normal); } else { vmap[i] = v[i].copy(); v2dir.put(v[i], new Direction(vmap[i], normal)); + getMesh().add(vmap[i]); } } for (int i = 0; i < n; i++) { if (e2e.containsKey(e[i])) { topmap[i] = (Edge)e2e.get(e[i]); } else { topmap[i] = new Edge(vmap[i], vmap[(i + 1) % n]); e2e.put(e[i], topmap[i]); + getMesh().add(topmap[i]); } } *************** *** 426,431 **** sidemap[i] = new Edge(v[i], vmap[i]); v2e.put(v[i], sidemap[i]); } - getMesh().add(sidemap[i]); } --- 422,427 ---- sidemap[i] = new Edge(v[i], vmap[i]); v2e.put(v[i], sidemap[i]); + getMesh().add(sidemap[i]); } } *************** *** 445,450 **** facemap[i] = new Surface(newEdges); e2s.put(b, facemap[i]); } - getMesh().add(facemap[i]); sides.add(facemap[i]); } --- 441,446 ---- facemap[i] = new Surface(newEdges); e2s.put(b, facemap[i]); + getMesh().add(facemap[i]); } sides.add(facemap[i]); } |
|
From: rimestad <rim...@us...> - 2006-03-07 16:45:25
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7026/src/net/sourceforge/bprocessor/gl/tool Modified Files: MultiExtrudeTool.java Log Message: Added extrude to other surface (there is a small distance bug), and hole analysis also made. There is a small bug with the algorithm so that some speed vectors are getting too big, a problem when marking top and side walls simultanusly Index: MultiExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MultiExtrudeTool.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MultiExtrudeTool.java 23 Feb 2006 14:05:22 -0000 1.5 --- MultiExtrudeTool.java 7 Mar 2006 16:45:20 -0000 1.6 *************** *** 25,28 **** --- 25,29 ---- import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Plane; + import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Selection; import net.sourceforge.bprocessor.model.Surface; *************** *** 51,54 **** --- 52,61 ---- private double t; + /** The set of extruded elements and the top surfaces of the extrusion*/ + private Set elements, tops; + + /** The extrusion direction */ + private double direction = 0.0; + /** * Constructor *************** *** 68,75 **** top = null; t = 0; ! v2dir = new HashMap(); ! super.pressed(e); if (target instanceof Surface) { - // lav extrudsionen af selectionen extrudeSurface = (Surface)target; View view = glv.getView(); --- 75,88 ---- top = null; t = 0; ! v2dir = null; ! elements = new HashSet(); ! if (directMode) { ! super.pressed(e); ! } ! if (e.isShiftDown() && !directMode) { ! super.pressed(e); ! return; ! } if (target instanceof Surface) { extrudeSurface = (Surface)target; View view = glv.getView(); *************** *** 92,101 **** */ protected void dragged(MouseEvent e) { ! if (v2dir != null) { ! if (top == null) { ! //make the extrusion ! Set elements = makeExtrusion(Selection.primary()); ! } ! // Find the move direction Vertex normal; if (top == null) { --- 105,110 ---- */ protected void dragged(MouseEvent e) { ! if (extrudeSurface != null) { ! // it is possible to make an extrusion find the direction Vertex normal; if (top == null) { *************** *** 109,119 **** Vertex delta = to.minus(from); double normDotDelta = normal.dot(delta); ! moveTo(v2dir.values(), normDotDelta); ! } else { ! // TODO Tell somehow that the extrusion were illigal } } /** * Move a collection of vertex, direction pairs * @param which The colelction of pairs --- 118,188 ---- Vertex delta = to.minus(from); double normDotDelta = normal.dot(delta); ! if (direction == 0) { ! //we have never set the direction; ! direction = normDotDelta; ! } ! if (top == null) { ! // there are no extrusion make one if we move the mouse ! if ((e.getX() - pressX) * (e.getX() - pressX) + ! (e.getY() - pressY) * (e.getY() - pressY) > 16) { ! elements = makeExtrusion(Selection.primary()); ! } ! } ! if (v2dir != null) { ! // The extrusion were succesfull move it ! // Find the move direction ! findTarget(e); ! if (target != null && target instanceof Surface) { ! //If there are a target that is a surface drag to that surface ! Vertex origin = extrudeSurface.getFirstVertex(); ! Surface current = (Surface) target; ! if (current != extrudeSurface && current != top && !elements.contains(current)) { ! Vertex n = current.normal(); ! Vertex cross = normal.cross(n); ! if (cross.isZero()) { ! Vertex o = current.getFirstVertex(); ! Vertex vector = o.minus(origin); ! double d = vector.dot(normal); ! if (Math.abs(d) > 0.0000001) { ! moveTo(v2dir.values(), d); ! return; ! } ! } ! } ! } ! // otherwise do a normal extrude ! if (direction * normDotDelta > 0) { ! // the extrusion is still in the same direction ! moveTo(v2dir.values(), normDotDelta); ! } else { ! // we have to remove the extrusion and make a new one ! remove(elements); ! elements = makeExtrusion(Selection.primary()); ! direction = normDotDelta; ! if (v2dir != null) { ! moveTo(v2dir.values(), normDotDelta); ! } ! } ! } } } /** + * Remove all the created extrusion elements + * @param elem The elements to remove + */ + private void remove(Set elem) { + if (elem != null) { + Iterator iter = elem.iterator(); + while (iter.hasNext()) { + Object o = iter.next(); + if (o instanceof Surface) { + Project.getInstance().delete((Surface)o); + } + } + } + } + + /** * Move a collection of vertex, direction pairs * @param which The colelction of pairs *************** *** 126,130 **** Direction d = (Direction)iter.next(); Vertex movement = d.getDirection(); - log.info(d.getVertex() + " blev flyttet " + movement); Vertex v = movement.copy(); v.scale(delta); --- 195,198 ---- *************** *** 132,135 **** --- 200,204 ---- } t = to; + glv.setLength(Math.abs(t)); } *************** *** 140,144 **** protected void released(MouseEvent e) { super.released(e); ! } --- 209,223 ---- protected void released(MouseEvent e) { super.released(e); ! if (top != null && Math.abs(t) < 0.1) { ! remove(elements); ! return; ! } else if (v2dir != null) { ! Iterator iter = elements.iterator(); ! while (iter.hasNext()) { ! Surface current = (Surface) iter.next(); ! holeAnalysis(current); ! } ! Selection.primary().addAll(tops); ! } } *************** *** 154,158 **** v2dir = new HashMap(); // vertex to direction map Map v2e = new HashMap(); // vertex to edge map ! // Check for selection of only surfaces --- 233,237 ---- v2dir = new HashMap(); // vertex to direction map Map v2e = new HashMap(); // vertex to edge map ! tops = new HashSet(); // Check for selection of only surfaces *************** *** 166,174 **** while (iter.hasNext()) { Surface cur = (Surface)iter.next(); ! Surface s = cur.extrude(1, elements, e2e, v2e, e2s, v2dir); if (cur == extrudeSurface) { // Set the top to the extruded surface of target top = s; } elements.add(s); } --- 245,254 ---- while (iter.hasNext()) { Surface cur = (Surface)iter.next(); ! Surface s = cur.extrude(direction, elements, e2e, v2e, e2s, v2dir); if (cur == extrudeSurface) { // Set the top to the extruded surface of target top = s; } + tops.add(s); elements.add(s); } |
|
From: Michael L. <he...@us...> - 2006-03-06 06:51:56
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17327/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: getObjectAtPoint can now find edge-intersections and also checks to see if the intersections is close to the mouse Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** View.java 3 Mar 2006 12:13:34 -0000 1.68 --- View.java 6 Mar 2006 06:51:52 -0000 1.69 *************** *** 451,456 **** glu = gld.getGLU(); gl.glViewport(0, 0, (int)width, (int)height); - View.height = height; - View.width = width; if (picking > 0) { selectBuffer = BufferUtils.newIntBuffer(selectionLength); --- 451,454 ---- *************** *** 1743,1749 **** * Process Selection * @param unWantedEntities Entities to be ignored * @return Selection */ ! private List processSelect(Collection unWantedEntities) { int bufferOffset = 0; int names = 0; --- 1741,1748 ---- * Process Selection * @param unWantedEntities Entities to be ignored + * @param intersections Are intersections wanted * @return Selection */ ! private List processSelect(Collection unWantedEntities, boolean intersections) { int bufferOffset = 0; int names = 0; *************** *** 1861,1867 **** } else { if (edge != null) { ! result.add(edge); ! edges.remove(edge); ! result.addAll(edges); } else { if (surface != null) { --- 1860,1903 ---- } else { if (edge != null) { ! if (intersections) { ! Vertex intersection = null; ! Transformation transformation = this.transformation(); ! ! Edge e1 = edge; ! Vertex v1 = e1.getTo().minus(e1.getFrom()); ! edges.remove(edge); ! Iterator iter = edges.iterator(); ! ! while (iter.hasNext()) { ! Edge e2 = (Edge) iter.next(); ! Vertex v2 = e2.getTo().minus(e2.getFrom()); ! Vertex cross = v1.cross(v2); ! if (!cross.isZero()) { ! Edge intersect = e1.intersection(e2); ! if (intersect != null) { ! if (intersect.getLength() < 0.0000001) { ! intersection = intersect.getFrom(); ! } ! } ! } ! } ! if (intersection != null) { ! Vertex projected = transformation.project(intersection); ! double dx = x - projected.getX(); ! double dy = (height - y) - projected.getY(); ! double distance = Math.sqrt(dx * dx + dy * dy); ! if (distance < 6) { ! result.add(intersection); ! } else { ! result.add(edge); ! } ! } else { ! result.add(edge); ! } ! } else { ! result.add(edge); ! edges.remove(edge); ! result.addAll(edges); ! } } else { if (surface != null) { *************** *** 1883,1889 **** * @param y y-coordinate of the point * @param unWantedEntities the collection of unwanted entities * @return entity under the point. */ ! public List getObjectAtPoint(double x, double y, Collection unWantedEntities) { this.x = x; this.y = y; --- 1919,1927 ---- * @param y y-coordinate of the point * @param unWantedEntities the collection of unwanted entities + * @param intersections Are intersections wanted * @return entity under the point. */ ! public List getObjectAtPoint(double x, double y, ! Collection unWantedEntities, boolean intersections) { this.x = x; this.y = y; *************** *** 1893,1897 **** glv.repaint(true); ! List selection = processSelect(unWantedEntities); clearNames(); return selection; --- 1931,1935 ---- glv.repaint(true); ! List selection = processSelect(unWantedEntities, intersections); clearNames(); return selection; *************** *** 1905,1909 **** */ public List getObjectAtPoint(double x, double y) { ! return getObjectAtPoint(x, y, new HashSet()); } --- 1943,1947 ---- */ public List getObjectAtPoint(double x, double y) { ! return getObjectAtPoint(x, y, new HashSet(), false); } *************** *** 1976,1980 **** glv.repaint(true); ! List selection = processSelect(new HashSet()); clearNames(); return selection; --- 2014,2018 ---- glv.repaint(true); ! List selection = processSelect(new HashSet(), false); clearNames(); return selection; *************** *** 1995,1999 **** glv.repaint(true); ! List selection = processSelect(new HashSet()); clearNames(); return selection; --- 2033,2037 ---- glv.repaint(true); ! List selection = processSelect(new HashSet(), false); clearNames(); return selection; |
|
From: Michael L. <he...@us...> - 2006-03-06 06:51:55
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17327/src/net/sourceforge/bprocessor/gl/tool Modified Files: PencilTool.java MoveTool.java Log Message: getObjectAtPoint can now find edge-intersections and also checks to see if the intersections is close to the mouse Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** MoveTool.java 28 Feb 2006 20:53:53 -0000 1.41 --- MoveTool.java 6 Mar 2006 06:51:52 -0000 1.42 *************** *** 373,377 **** delta = restrictCopy; } else if (moveMode == FREE_SNAP) { ! List objects = glv.getView().getObjectAtPoint(e.getX(), e.getY(), moveEntities); Iterator it = objects.iterator(); if (it.hasNext()) { --- 373,377 ---- delta = restrictCopy; } else if (moveMode == FREE_SNAP) { ! List objects = glv.getView().getObjectAtPoint(e.getX(), e.getY(), moveEntities, false); Iterator it = objects.iterator(); if (it.hasNext()) { Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** PencilTool.java 16 Feb 2006 20:54:21 -0000 1.60 --- PencilTool.java 6 Mar 2006 06:51:52 -0000 1.61 *************** *** 80,92 **** /** The wanted length of the previous edge */ ! private String number = ""; ! ! /** Edge one */ ! private Edge splitE1; ! ! /** Edge two */ ! private Edge splitE2; - /** * Constructor --- 80,85 ---- /** The wanted length of the previous edge */ ! private String number = ""; /** * Constructor *************** *** 104,143 **** */ protected void findPencilTarget(MouseEvent event) { - splitE1 = null; - splitE2 = null; int x = event.getX(); int y = event.getY(); View view = glv.getView(); ! List selection = view.getObjectAtPoint(x, y); ! Vertex intersection = null; if (selection.isEmpty()) { target = null; } else { ! if (selection.size() > 1) { ! Edge e1 = (Edge) selection.get(0); ! Vertex v1 = e1.getTo().minus(e1.getFrom()); ! for (int i = 1; (i < selection.size()) && intersection == null; i++) { ! Edge e2 = (Edge) selection.get(i); ! Vertex v2 = e2.getTo().minus(e2.getFrom()); ! Vertex cross = v1.cross(v2); ! if (!cross.isZero()) { ! Edge intersect = e1.intersection(e2); ! if (intersect != null) { ! if (intersect.getLength() < 0.0000001) { ! intersection = intersect.getFrom(); ! splitE1 = e1; ! splitE2 = e2; ! } ! } ! } ! } ! if (intersection != null) { ! target = intersection; ! } else { ! target = e1; ! } ! } else { ! target = selection.get(0); ! } } } --- 97,108 ---- */ protected void findPencilTarget(MouseEvent event) { int x = event.getX(); int y = event.getY(); View view = glv.getView(); ! List selection = view.getObjectAtPoint(x, y, new HashSet(), true); if (selection.isEmpty()) { target = null; } else { ! target = selection.get(0); } } *************** *** 526,530 **** Vertex vertex = intersection.getFrom(); current = vertex; - splitE1 = edge; } } else { --- 491,494 ---- |
|
From: Michael L. <he...@us...> - 2006-03-03 12:13:39
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16857/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Refactoring of drawAll Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** View.java 26 Feb 2006 23:56:45 -0000 1.67 --- View.java 3 Mar 2006 12:13:34 -0000 1.68 *************** *** 450,454 **** glu = gld.getGLU(); - int[] mode = new int[1]; gl.glViewport(0, 0, (int)width, (int)height); View.height = height; --- 450,453 ---- *************** *** 480,484 **** gl.glLineWidth(1.0f); ! drawAll(gld); gl.glEnable(GL.GL_DEPTH_TEST); --- 479,483 ---- gl.glLineWidth(1.0f); ! drawAll(gld, hitdetection); gl.glEnable(GL.GL_DEPTH_TEST); *************** *** 497,501 **** } - gl.glGetIntegerv(GL.GL_RENDER_MODE, mode); if (glv.getTool() instanceof SpaceTool) { --- 496,499 ---- *************** *** 503,507 **** gl.glPushMatrix(); gl.glLoadIdentity(); ! if (mode[0] == GL.GL_SELECT) { int[] viewport = new int[] {0, 0, (int)width, (int)height}; glu.gluPickMatrix(x, viewport[3] - y, 5, 5, viewport); --- 501,505 ---- gl.glPushMatrix(); gl.glLoadIdentity(); ! if (hitdetection) { int[] viewport = new int[] {0, 0, (int)width, (int)height}; glu.gluPickMatrix(x, viewport[3] - y, 5, 5, viewport); *************** *** 511,515 **** gl.glPushMatrix(); gl.glLoadIdentity(); ! labelSelection(mode[0] == GL.GL_SELECT); gl.glMatrixMode(GL.GL_PROJECTION); gl.glPopMatrix(); --- 509,513 ---- gl.glPushMatrix(); gl.glLoadIdentity(); ! labelSelection(hitdetection); gl.glMatrixMode(GL.GL_PROJECTION); gl.glPopMatrix(); *************** *** 519,523 **** } gl.glPopMatrix(); ! if (mode[0] == GL.GL_SELECT) { gl.glFlush(); hits = gl.glRenderMode(GL.GL_RENDER); --- 517,521 ---- } gl.glPopMatrix(); ! if (hitdetection) { gl.glFlush(); hits = gl.glRenderMode(GL.GL_RENDER); *************** *** 659,835 **** * Draw all the existing elements * @param gld The GLDrawable */ ! protected void drawAll(GLDrawable gld) { ! Collection surfaces = Project.getInstance().getSurfaces(); ! Collection edges = Project.getInstance().getEdges(); ! Collection vertices = Project.getInstance().getVertices(); Collection selection = glv.getTool().getSelection(); ! ! int[] mode = new int[1]; ! gl.glGetIntegerv(GL.GL_RENDER_MODE, mode); ! ! gl = gld.getGL(); ! glu = gld.getGLU(); ! ! initNames(gl); ! if (mode[0] != GL.GL_SELECT) { ! gl.glEnable(GL.GL_DEPTH_TEST); ! // draw selection ! gl.glColor3fv(SELECTED_COLOR); ! Iterator selit = selection.iterator(); ! while (selit.hasNext()) { ! Object o = selit.next(); ! if (o instanceof Surface) { ! drawObject(o); ! } } ! ! { ! if (DRAW_LONE_VERTICES) { ! // Draw any Vertex that are not part of an edge ! gl.glColor3fv(lineColor); ! Iterator it = vertices.iterator(); ! while (it.hasNext()) { ! Vertex v = (Vertex)it.next(); ! if (v.getEdges().isEmpty()) { ! gl.glColor3fv(lineColor); ! gl.glPointSize(5.0f); ! gl.glBegin(GL.GL_POINTS); ! gl.glVertex3d(v.getX(), v.getY(), v.getZ()); ! gl.glEnd(); ! gl.glPointSize(1.0f); ! } } ! // Draw any temporary vertex not part of an edge ! gl.glColor3fv(lineColor); ! it = tempVertices.iterator(); ! while (it.hasNext()) { ! Vertex v = (Vertex)it.next(); ! if (v.getEdges().isEmpty()) { ! gl.glColor3fv(lineColor); ! gl.glPointSize(5.0f); ! gl.glBegin(GL.GL_POINTS); ! gl.glVertex3d(v.getX(), v.getY(), v.getZ()); ! gl.glEnd(); ! gl.glPointSize(1.0f); ! } } } } ! ! // Fill surfaces ! switch (drawMode) { ! case LIGHTING_MODE: { ! gl.glEnable(GL.GL_LIGHTING); ! gl.glEnable(GL.GL_POLYGON_OFFSET_FILL); ! gl.glPolygonOffset(0.5f, 0.5f); ! gl.glEnable(GL.GL_CULL_FACE); ! ! gl.glCullFace(GL.GL_BACK); ! gl.glColor3fv(Defaults.getFrontColor()); ! drawSurfaces(gld, FRONT); ! ! gl.glCullFace(GL.GL_FRONT); ! gl.glColor3fv(Defaults.getBackColor()); ! drawSurfaces(gld, BACK); ! gl.glDisable(GL.GL_CULL_FACE); ! gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); ! gl.glDisable(GL.GL_LIGHTING); ! break; ! } ! case WIREFRAME_MODE: { ! // NOTHING TO DO ! break; ! } ! case SOLID_MODE: { ! gl.glEnable(GL.GL_POLYGON_OFFSET_FILL); ! gl.glPolygonOffset(1.0f, 1.0f); ! gl.glColor3fv(SURFACE_COLOR); ! drawSurfaces(gld, BOTH); ! gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); ! break; ! } ! } ! //Draw edges ! if (doDrawEdges) { ! drawEdges(gld); ! } ! ! gl.glColor3fv(SELECTED_COLOR); ! selit = selection.iterator(); ! while (selit.hasNext()) { ! Object o = selit.next(); ! if (!(o instanceof Surface)) { ! drawObject(o); ! } ! } ! ! // draw target ! gl.glColor3fv(TARGET_COLOR); ! if (target != null) { ! drawObject(target); ! } ! gl.glDisable(GL.GL_DEPTH_TEST); ! Vertex to = null; ! if (activeEdge != null) { ! to = activeEdge.getTo(); ! Vertex from = activeEdge.getFrom(); ! if (cmp(from.getY(), to.getY()) && cmp(from.getZ(), to.getZ())) { ! gl.glColor3fv(X_AXIS_COLOR); ! } else if (cmp(from.getX(), to.getX()) && cmp(from.getZ(), to.getZ())) { ! gl.glColor3fv(Y_AXIS_COLOR); ! } else if (cmp(from.getX(), to.getX()) && cmp(from.getY(), to.getY())) { ! gl.glColor3fv(Z_AXIS_COLOR); ! } else { ! gl.glColor3fv(lineColor); ! } ! gl.glLineWidth(1.0f); ! drawEdge(activeEdge); } ! ! if (to == null) { ! to = currentVertex; } ! if (snapVertex != null && to != null) { ! boolean doDraw = true; ! if (cmp(snapVertex.getY(), to.getY()) && cmp(snapVertex.getZ(), to.getZ())) { ! gl.glColor3fv(X_AXIS_COLOR); ! } else if (cmp(snapVertex.getX(), to.getX()) && cmp(snapVertex.getZ(), to.getZ())) { ! gl.glColor3fv(Y_AXIS_COLOR); ! } else if (cmp(snapVertex.getX(), to.getX()) && cmp(snapVertex.getY(), to.getY())) { ! gl.glColor3fv(Z_AXIS_COLOR); ! } else { ! doDraw = false; ! } ! if (doDraw) { ! gl.glEnable(GL.GL_LINE_STIPPLE); ! gl.glLineWidth(1.0f); ! gl.glBegin(GL.GL_LINES); ! gl.glVertex3d(snapVertex.getX(), snapVertex.getY(), snapVertex.getZ()); ! gl.glVertex3d(to.getX(), to.getY(), to.getZ()); ! gl.glEnd(); ! gl.glDisable(GL.GL_LINE_STIPPLE); ! } } ! ! ! // draw snap point if any ! if (snapVertex != null) { ! gl.glDisable(GL.GL_DEPTH_TEST); ! gl.glColor3fv(TARGET_COLOR); ! gl.glPointSize(5.0f); ! gl.glBegin(GL.GL_POINTS); gl.glVertex3d(snapVertex.getX(), snapVertex.getY(), snapVertex.getZ()); gl.glEnd(); ! gl.glPointSize(1.0f); ! } ! } else { ! drawSelectionMode(vertices, edges, surfaces); } } /** * Draw an object --- 657,834 ---- * Draw all the existing elements * @param gld The GLDrawable + * @param hitdetection For hitdetection */ ! protected void drawAll(GLDrawable gld, boolean hitdetection) { ! if (!hitdetection) { ! drawNormalMode(gld); ! } else { ! ! drawSelectionMode(gld); ! } ! } ! ! /** ! * Draw the model normally ! * @param gld The GLDrawable ! */ ! private void drawNormalMode(GLDrawable gld) { Collection selection = glv.getTool().getSelection(); ! gl.glEnable(GL.GL_DEPTH_TEST); ! // draw selection ! gl.glColor3fv(SELECTED_COLOR); ! Iterator selit = selection.iterator(); ! while (selit.hasNext()) { ! Object o = selit.next(); ! if (o instanceof Surface) { ! drawObject(o); } ! } ! ! { ! if (DRAW_LONE_VERTICES) { ! // Draw any Vertex that are not part of an edge ! Collection vertices = Project.getInstance().getVertices(); ! gl.glColor3fv(lineColor); ! Iterator it = vertices.iterator(); ! while (it.hasNext()) { ! Vertex v = (Vertex)it.next(); ! if (v.getEdges().isEmpty()) { ! gl.glColor3fv(lineColor); ! gl.glPointSize(5.0f); ! gl.glBegin(GL.GL_POINTS); ! gl.glVertex3d(v.getX(), v.getY(), v.getZ()); ! gl.glEnd(); ! gl.glPointSize(1.0f); } ! } ! // Draw any temporary vertex not part of an edge ! gl.glColor3fv(lineColor); ! it = tempVertices.iterator(); ! while (it.hasNext()) { ! Vertex v = (Vertex)it.next(); ! if (v.getEdges().isEmpty()) { ! gl.glColor3fv(lineColor); ! gl.glPointSize(5.0f); ! gl.glBegin(GL.GL_POINTS); ! gl.glVertex3d(v.getX(), v.getY(), v.getZ()); ! gl.glEnd(); ! gl.glPointSize(1.0f); } } } ! } ! ! // Fill surfaces ! switch (drawMode) { ! case LIGHTING_MODE: { ! gl.glEnable(GL.GL_LIGHTING); ! gl.glEnable(GL.GL_POLYGON_OFFSET_FILL); ! gl.glPolygonOffset(0.5f, 0.5f); ! gl.glEnable(GL.GL_CULL_FACE); ! gl.glCullFace(GL.GL_BACK); ! gl.glColor3fv(Defaults.getFrontColor()); ! drawSurfaces(gld, FRONT); ! gl.glCullFace(GL.GL_FRONT); ! gl.glColor3fv(Defaults.getBackColor()); ! drawSurfaces(gld, BACK); ! gl.glDisable(GL.GL_CULL_FACE); ! gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); ! gl.glDisable(GL.GL_LIGHTING); ! break; ! } ! case WIREFRAME_MODE: { ! // NOTHING TO DO ! break; ! } ! case SOLID_MODE: { ! gl.glEnable(GL.GL_POLYGON_OFFSET_FILL); ! gl.glPolygonOffset(1.0f, 1.0f); ! gl.glColor3fv(SURFACE_COLOR); ! drawSurfaces(gld, BOTH); ! gl.glDisable(GL.GL_POLYGON_OFFSET_FILL); ! break; ! } ! } ! //Draw edges ! if (doDrawEdges) { ! drawEdges(gld); ! } ! ! gl.glColor3fv(SELECTED_COLOR); ! selit = selection.iterator(); ! while (selit.hasNext()) { ! Object o = selit.next(); ! if (!(o instanceof Surface)) { ! drawObject(o); } ! } ! ! // draw target ! gl.glColor3fv(TARGET_COLOR); ! if (target != null) { ! drawObject(target); ! } ! ! gl.glDisable(GL.GL_DEPTH_TEST); ! Vertex to = null; ! ! if (activeEdge != null) { ! to = activeEdge.getTo(); ! Vertex from = activeEdge.getFrom(); ! if (cmp(from.getY(), to.getY()) && cmp(from.getZ(), to.getZ())) { ! gl.glColor3fv(X_AXIS_COLOR); ! } else if (cmp(from.getX(), to.getX()) && cmp(from.getZ(), to.getZ())) { ! gl.glColor3fv(Y_AXIS_COLOR); ! } else if (cmp(from.getX(), to.getX()) && cmp(from.getY(), to.getY())) { ! gl.glColor3fv(Z_AXIS_COLOR); ! } else { ! gl.glColor3fv(lineColor); } ! gl.glLineWidth(1.0f); ! drawEdge(activeEdge); ! } ! ! if (to == null) { ! to = currentVertex; ! } ! if (snapVertex != null && to != null) { ! boolean doDraw = true; ! if (cmp(snapVertex.getY(), to.getY()) && cmp(snapVertex.getZ(), to.getZ())) { ! gl.glColor3fv(X_AXIS_COLOR); ! } else if (cmp(snapVertex.getX(), to.getX()) && cmp(snapVertex.getZ(), to.getZ())) { ! gl.glColor3fv(Y_AXIS_COLOR); ! } else if (cmp(snapVertex.getX(), to.getX()) && cmp(snapVertex.getY(), to.getY())) { ! gl.glColor3fv(Z_AXIS_COLOR); ! } else { ! doDraw = false; } ! if (doDraw) { ! gl.glEnable(GL.GL_LINE_STIPPLE); ! gl.glLineWidth(1.0f); ! gl.glBegin(GL.GL_LINES); gl.glVertex3d(snapVertex.getX(), snapVertex.getY(), snapVertex.getZ()); + gl.glVertex3d(to.getX(), to.getY(), to.getZ()); gl.glEnd(); ! gl.glDisable(GL.GL_LINE_STIPPLE); ! } } + + + // draw snap point if any + if (snapVertex != null) { + gl.glDisable(GL.GL_DEPTH_TEST); + gl.glColor3fv(TARGET_COLOR); + gl.glPointSize(5.0f); + gl.glBegin(GL.GL_POINTS); + gl.glVertex3d(snapVertex.getX(), snapVertex.getY(), snapVertex.getZ()); + gl.glEnd(); + gl.glPointSize(1.0f); + } } + /** * Draw an object *************** *** 1336,1345 **** /** * Draws the objects for selection ! * @param vertices the set of vertices that should be selectable ! * @param edges the set of edges that should be selectable ! * @param surfaces the set of surfaces that should be selectable */ ! private void drawSelectionMode(Collection vertices, Collection edges, Collection surfaces) { ! // HERE STARTS SELECTION MODE DRAWING if (selectMode == VERTICES || selectMode == ALL) { Iterator it = vertices.iterator(); --- 1335,1348 ---- /** * Draws the objects for selection ! * @param gld The GLDrawable */ ! private void drawSelectionMode(GLDrawable gld) { ! Collection surfaces = Project.getInstance().getSurfaces(); ! Collection edges = Project.getInstance().getEdges(); ! Collection vertices = Project.getInstance().getVertices(); ! ! gl = gld.getGL(); ! initNames(gl); ! if (selectMode == VERTICES || selectMode == ALL) { Iterator it = vertices.iterator(); |
|
From: Nordholt <nor...@us...> - 2006-03-02 13:08:21
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19561 Modified Files: FileExitActionListener.java Log Message: fixed null-pointer exception when pressing cancel in the exit shield Index: FileExitActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions/FileExitActionListener.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FileExitActionListener.java 8 Feb 2006 10:13:20 -0000 1.4 --- FileExitActionListener.java 2 Mar 2006 13:08:12 -0000 1.5 *************** *** 41,45 **** null, "Do you want to save the changes?", ! "Projekt has been changed", JOptionPane.YES_NO_CANCEL_OPTION); if (n == 0) { --- 41,45 ---- null, "Do you want to save the changes?", ! "Project has been changed", JOptionPane.YES_NO_CANCEL_OPTION); if (n == 0) { *************** *** 60,77 **** } } ! } ! ! if (n == 1) { System.exit(0); - } else { - try { - PersistenceManager.save(new File(Project.getInstance().getSavePath())); - System.exit(0); - } catch (Exception ex) { - log.error("Could not export to file: " + - new File(Project.getInstance().getSavePath()), ex); - } } - } else { System.exit(0); --- 60,66 ---- } } ! } else if (n == 1) { System.exit(0); } } else { System.exit(0); |
|
From: Nikolaj B. <nbr...@us...> - 2006-03-01 11:58:40
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8438/src/net/sourceforge/bprocessor/gui/attrview Modified Files: AttributePanel.java Log Message: removed log output Index: AttributePanel.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/AttributePanel.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AttributePanel.java 28 Feb 2006 02:25:48 -0000 1.6 --- AttributePanel.java 1 Mar 2006 11:58:36 -0000 1.7 *************** *** 606,614 **** } else if (current instanceof Vertex) { displayVertex((Vertex) current); ! } else { if (current != null) { log.info("display " + current); } ! } revalidate(); } --- 606,614 ---- } else if (current instanceof Vertex) { displayVertex((Vertex) current); ! } /* else { if (current != null) { log.info("display " + current); } ! } */ revalidate(); } |
|
From: Nikolaj B. <nbr...@us...> - 2006-03-01 11:58:08
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7995/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java Log Message: Removed system.out Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** GenericTreeView.java 25 Feb 2006 09:04:49 -0000 1.16 --- GenericTreeView.java 1 Mar 2006 11:58:02 -0000 1.17 *************** *** 629,633 **** */ public void mousePressed(MouseEvent e) { - System.out.println("e = " + e); TreePath path = getPathForLocation(e.getX(), e.getY()); if (path != null) { --- 629,632 ---- |
|
From: Michael L. <he...@us...> - 2006-03-01 11:16:22
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14884/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java TapeMeasureTool.java Log Message: Angling back on in tape measure Selection back to normal in move and extrusion Index: TapeMeasureTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/TapeMeasureTool.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** TapeMeasureTool.java 28 Feb 2006 20:53:53 -0000 1.9 --- TapeMeasureTool.java 1 Mar 2006 11:16:17 -0000 1.10 *************** *** 191,196 **** if (target instanceof Edge) { currentEdge = (Edge)target; ! angling = false; ! measuring = true; Vertex minus = currentEdge.getDirection(); minus.scale(1 / minus.length()); --- 191,196 ---- if (target instanceof Edge) { currentEdge = (Edge)target; ! angling = true; ! measuring = false; Vertex minus = currentEdge.getDirection(); minus.scale(1 / minus.length()); Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** AbstractTool.java 28 Feb 2006 20:53:53 -0000 1.59 --- AbstractTool.java 1 Mar 2006 11:16:17 -0000 1.60 *************** *** 43,47 **** /** Simple selection mechanism **/ ! protected boolean directMode = true; /** The x axis */ --- 43,47 ---- /** Simple selection mechanism **/ ! protected boolean directMode = false; /** The x axis */ |
|
From: Michael L. <he...@us...> - 2006-02-28 20:53:57
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3806/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java MoveTool.java ExtrudeTool.java TapeMeasureTool.java SelectTool.java Log Message: Minor tweaks before release. Some tools have temporarily been simplified: - Move/Extrusion: Objects are selected automatically when applying the tool - Tape-measure: The angle step have been turned off Index: TapeMeasureTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/TapeMeasureTool.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** TapeMeasureTool.java 23 Feb 2006 21:30:14 -0000 1.8 --- TapeMeasureTool.java 28 Feb 2006 20:53:53 -0000 1.9 *************** *** 30,33 **** --- 30,36 ---- private static Logger log = Logger.getLogger(TapeMeasureTool.class); + /** Angle mode on/off */ + private static boolean angleMode = false; + /** The x axis */ private Edge xAxis = new Edge(new Vertex(-50, 0, 0), new Vertex(50, 0, 0)); *************** *** 188,192 **** if (target instanceof Edge) { currentEdge = (Edge)target; ! angling = true; Vertex minus = currentEdge.getDirection(); minus.scale(1 / minus.length()); --- 191,196 ---- if (target instanceof Edge) { currentEdge = (Edge)target; ! angling = false; ! measuring = true; Vertex minus = currentEdge.getDirection(); minus.scale(1 / minus.length()); Index: ExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrudeTool.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ExtrudeTool.java 22 Feb 2006 09:02:45 -0000 1.12 --- ExtrudeTool.java 28 Feb 2006 20:53:53 -0000 1.13 *************** *** 22,25 **** --- 22,26 ---- import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Project; + import net.sourceforge.bprocessor.model.Selection; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; *************** *** 91,95 **** prevY = e.getY(); number = new String(); ! if (e.isShiftDown()) { super.pressed(e); } else if (!selection.isEmpty()) { --- 92,99 ---- prevY = e.getY(); number = new String(); ! if (directMode) { ! super.pressed(e); ! } ! if (e.isShiftDown() && !directMode) { super.pressed(e); } else if (!selection.isEmpty()) { *************** *** 161,164 **** --- 165,169 ---- top = extrudeSurface.extrude(length, sides); holeAnalysis(top); + Selection.primary().set(top); } } *************** *** 216,220 **** */ protected void moved(MouseEvent e) { ! if (e.isShiftDown()) { super.moved(e); } --- 221,225 ---- */ protected void moved(MouseEvent e) { ! if (e.isShiftDown() || directMode) { super.moved(e); } *************** *** 266,270 **** */ protected void released(MouseEvent e) { ! if (e.isShiftDown()) { super.released(e); } --- 271,275 ---- */ protected void released(MouseEvent e) { ! if (e.isShiftDown() && !directMode) { super.released(e); } *************** *** 287,290 **** --- 292,296 ---- holeAnalysis(current); } + Selection.primary().set(top); } } Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** SelectTool.java 14 Feb 2006 11:56:21 -0000 1.54 --- SelectTool.java 28 Feb 2006 20:53:53 -0000 1.55 *************** *** 89,109 **** */ protected void dragged(MouseEvent e) { ! if (!multipleSelection) { ! multipleSelection = true; ! } - Transformation t = glv.getView().transformation(); - last = t.unProject(new Vertex(e.getX(), View.getHeight() - e.getY(), 0.001)); - temp1 = t.unProject(new Vertex(e.getX(), View.getHeight() - pressPos[1], 0.001)); - temp2 = t.unProject(new Vertex(pressPos[0], View.getHeight() - e.getY(), 0.001)); - e1.setTo(temp1); - e2.setFrom(temp1); - e2.setTo(last); - e3.setFrom(last); - e3.setTo(temp2); - e4.setFrom(temp2); - displayConstructors(box); - findTarget(e); - glv.getView().makeTarget(target); } --- 89,105 ---- */ protected void dragged(MouseEvent e) { ! if (multipleSelection) { ! Transformation t = glv.getView().transformation(); ! last = t.unProject(new Vertex(e.getX(), View.getHeight() - e.getY(), 0.001)); ! temp1 = t.unProject(new Vertex(e.getX(), View.getHeight() - pressPos[1], 0.001)); ! temp2 = t.unProject(new Vertex(pressPos[0], View.getHeight() - e.getY(), 0.001)); ! e1.setTo(temp1); ! e2.setFrom(temp1); ! e2.setTo(last); ! e3.setFrom(last); ! e3.setTo(temp2); ! e4.setFrom(temp2); ! displayConstructors(box); } } *************** *** 138,141 **** --- 134,138 ---- if (target == null) { selection.clear(); + multipleSelection = true; } else if (e.isShiftDown()) { if (!selection.contains(target)) { Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** MoveTool.java 23 Feb 2006 16:04:13 -0000 1.40 --- MoveTool.java 28 Feb 2006 20:53:53 -0000 1.41 *************** *** 152,156 **** protected void pressed(MouseEvent e) { findTarget(e); ! if (e.isShiftDown()) { super.pressed(e); } else { --- 152,159 ---- protected void pressed(MouseEvent e) { findTarget(e); ! if (directMode) { ! super.pressed(e); ! } ! if (e.isShiftDown() && !directMode) { super.pressed(e); } else { *************** *** 297,300 **** --- 300,307 ---- return; } + if (e.isShiftDown()) { + super.dragged(e); + return; + } findRestrictions(e); if (dragPlane != null && restrictionVector != null) { Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** AbstractTool.java 11 Feb 2006 17:22:17 -0000 1.58 --- AbstractTool.java 28 Feb 2006 20:53:53 -0000 1.59 *************** *** 42,45 **** --- 42,48 ---- private static Logger log = Logger.getLogger(AbstractTool.class); + /** Simple selection mechanism **/ + protected boolean directMode = true; + /** The x axis */ protected Edge xAxis = new Edge(new Vertex(-50, 0, 0), new Vertex(50, 0, 0)); |