bprocessor-commit Mailing List for B-processor (Page 130)
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-16 15:24:52
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16718/src/net/sourceforge/bprocessor/gl/tool Added Files: Pencil.java Log Message: New Penciel tool started --- NEW FILE: Pencil.java --- //--------------------------------------------------------------------------------- // $Id: Pencil.java,v 1.1 2006/03/16 15:24:46 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.tool; import java.awt.Cursor; import java.awt.event.MouseEvent; import java.util.List; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.model.Intersection; /** * Pencil * */ public class Pencil extends AbstractPencil { /** Start point */ private Intersection start; /** Current point */ private Intersection current; /** Edges */ private List edges; /** * Constructor for Pencil * @param glv GLView * @param cursor Cursor */ public Pencil(GLView glv, Cursor cursor) { super(glv, cursor); } /** * @param e MouseEvent */ protected void moved(MouseEvent e) { } /** * @param e MouseEvent */ protected void pressed(MouseEvent e) { } /** * @param e MouseEvent */ protected void dragged(MouseEvent e) { } /** * @param e MouseEvent */ protected void released(MouseEvent e) { } } |
From: Michael L. <he...@us...> - 2006-03-16 14:35:06
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26234/src/net/sourceforge/bprocessor/gl/tool Modified Files: RectTool.java AbstractPencil.java Log Message: RectTool implemented Index: RectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/RectTool.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RectTool.java 15 Mar 2006 10:36:29 -0000 1.1 --- RectTool.java 16 Mar 2006 14:34:50 -0000 1.2 *************** *** 41,44 **** --- 41,88 ---- /** + * Create a rectangle + * @param start Start point + * @param end End point + * @return List of edges forming a rectangle + */ + List createRect(Vertex start, Vertex end) { + List edges = new LinkedList(); + + Vertex d = start.minus(end); + Vertex v1 = null; + Vertex v3 = null; + Vertex v2 = null; + Vertex v4 = null; + + if (Math.abs(d.getZ()) < 0.00001) { + v1 = start; + v3 = end; + v2 = new Vertex(v3.getX(), v1.getY(), v1.getZ()); + v4 = new Vertex(v1.getX(), v3.getY(), v3.getZ()); + } else if (Math.abs(d.getX()) < 0.00001) { + v1 = start; + v3 = end; + v2 = new Vertex(v3.getX(), v1.getY(), v3.getZ()); + v4 = new Vertex(v1.getX(), v3.getY(), v1.getZ()); + } else if (Math.abs(d.getY()) < 0.00001) { + v1 = start; + v3 = end; + v2 = new Vertex(v1.getX(), v1.getY(), v3.getZ()); + v4 = new Vertex(v3.getX(), v3.getY(), v1.getZ()); + } + if (v1 != null) { + Edge e1 = new Edge(v1, v2); + Edge e2 = new Edge(v2, v3); + Edge e3 = new Edge(v3, v4); + Edge e4 = new Edge(v4, v1); + edges.add(e1); + edges.add(e2); + edges.add(e3); + edges.add(e4); + } + return edges; + } + + /** * Update feedback * *************** *** 50,86 **** edge.setConstructor(true); edges.add(edge); ! ! Vertex d = start.vertex().minus(current.vertex()); ! Vertex v1 = null; ! Vertex v3 = null; ! Vertex v2 = null; ! Vertex v4 = null; ! ! if (Math.abs(d.getZ()) < 0.00001) { ! v1 = start.vertex(); ! v3 = current.vertex(); ! v2 = new Vertex(v3.getX(), v1.getY(), v1.getZ()); ! v4 = new Vertex(v1.getX(), v3.getY(), v3.getZ()); ! } else if (Math.abs(d.getX()) < 0.00001) { ! v1 = start.vertex(); ! v3 = current.vertex(); ! v2 = new Vertex(v3.getX(), v1.getY(), v3.getZ()); ! v4 = new Vertex(v1.getX(), v3.getY(), v1.getZ()); ! } else if (Math.abs(d.getY()) < 0.00001) { ! v1 = start.vertex(); ! v3 = current.vertex(); ! v2 = new Vertex(v1.getX(), v1.getY(), v3.getZ()); ! v4 = new Vertex(v3.getX(), v3.getY(), v1.getZ()); ! } ! if (v1 != null) { ! Edge e1 = new Edge(v1, v2); ! Edge e2 = new Edge(v2, v3); ! Edge e3 = new Edge(v3, v4); ! Edge e4 = new Edge(v4, v1); ! edges.add(e1); ! edges.add(e2); ! edges.add(e3); ! edges.add(e4); ! } feedback(edges); } else { --- 94,98 ---- edge.setConstructor(true); edges.add(edge); ! edges.addAll(createRect(start.vertex(), current.vertex())); feedback(edges); } else { *************** *** 107,110 **** --- 119,123 ---- start = current; } else { + insertEdges(createRect(start.vertex(), current.vertex())); start = null; } Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AbstractPencil.java 16 Mar 2006 12:58:42 -0000 1.4 --- AbstractPencil.java 16 Mar 2006 14:34:50 -0000 1.5 *************** *** 20,23 **** --- 20,24 ---- import net.sourceforge.bprocessor.model.Geometry; import net.sourceforge.bprocessor.model.Project; + import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; *************** *** 111,115 **** actual.add(insertEdge(current)); } ! Geometry.insert(actual); } --- 112,127 ---- actual.add(insertEdge(current)); } ! ! if (!actual.isEmpty()) { ! Vertex from = ((Edge) actual.get(0)).getFrom(); ! Vertex to = ((Edge) actual.get(edges.size() - 1)).getTo(); ! if (from == to) { ! Surface surface = new Surface(actual); ! Project.getInstance().add(surface); ! holeAnalysis(surface); ! } else { ! Geometry.insert(actual); ! } ! } } |
From: Michael L. <he...@us...> - 2006-03-16 12:58:45
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10202/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractPencil.java Log Message: ArcTool now inserts edges into model (but they do not form an arc just yet) Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AbstractPencil.java 16 Mar 2006 09:43:50 -0000 1.3 --- AbstractPencil.java 16 Mar 2006 12:58:42 -0000 1.4 *************** *** 11,19 **** --- 11,23 ---- import java.util.HashSet; import java.util.Iterator; + import java.util.LinkedList; import java.util.List; + import java.util.Set; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.model.Intersection; import net.sourceforge.bprocessor.model.Edge; + import net.sourceforge.bprocessor.model.Geometry; + import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Vertex; *************** *** 37,45 **** /** * Insert a number edges into the model * @param edges List of edges */ public void insertEdges(List edges) { ! } --- 41,115 ---- /** + * Insert a vertex into model + * @param vertex Vertex + * @return Vertex from model + */ + public Vertex insertVertex(Vertex vertex) { + Vertex actual = vertex; + { + Set vertices = Project.getInstance().findByLocation + (vertex.getX(), vertex.getY(), vertex.getZ(), 0.0000001); + if (!vertices.isEmpty()) { + actual = (Vertex) vertices.iterator().next(); + } + } + if (actual == vertex) { + Project.getInstance().add(actual); + Set es = Project.getInstance().findEdge(actual); + if (es.size() > 0) { + Iterator iter = es.iterator(); + while (iter.hasNext()) { + Edge e = (Edge) iter.next(); + if (!e.getConstructor()) { + e.split(actual); + } + } + } + } + return actual; + } + + /** + * Insert an edge into model + * @param edge Edge + * @return Edge from model + */ + public Edge insertEdge(Edge edge) { + Edge actual = edge; + edge.setFrom(insertVertex(edge.getFrom())); + edge.setTo(insertVertex(edge.getTo())); + { + Collection edges = Project.getInstance().getEdges(); + Iterator iter = edges.iterator(); + while (iter.hasNext()) { + Edge current = (Edge) iter.next(); + if (current.getFrom() == edge.getFrom() && current.getTo() == edge.getTo()) { + actual = current; + break; + } + if (current.getFrom() == edge.getTo() && current.getTo() == edge.getFrom()) { + actual = current; + break; + } + } + } + if (actual == edge) { + Project.getInstance().add(edge); + } + return actual; + } + + /** * Insert a number edges into the model * @param edges List of edges */ public void insertEdges(List edges) { ! Iterator iter = edges.iterator(); ! List actual = new LinkedList(); ! while (iter.hasNext()) { ! Edge current = (Edge) iter.next(); ! actual.add(insertEdge(current)); ! } ! Geometry.insert(actual); } |
From: Nikolaj B. <nbr...@us...> - 2006-03-16 10:17:57
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8542/src/net/sourceforge/bprocessor/model Modified Files: ConstructionSpace.java Space.java FunctionalSpace.java Log Message: Made some code optimization Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Space.java 28 Feb 2006 02:26:25 -0000 1.19 --- Space.java 16 Mar 2006 10:17:49 -0000 1.20 *************** *** 7,15 **** --- 7,19 ---- package net.sourceforge.bprocessor.model; + import java.util.ArrayList; import java.util.HashSet; + import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Set; + import org.apache.log4j.Logger; + /** *************** *** 21,25 **** * column="DOMAIN_ID" */ ! public class Space extends Entity { /** The name */ private String name; --- 25,31 ---- * column="DOMAIN_ID" */ ! public class Space extends Entity implements Parametric { ! /** The logger */ ! private static Logger log = Logger.getLogger(FunctionalSpace.class); /** The name */ private String name; *************** *** 284,286 **** --- 290,329 ---- } } + + /** + * Set the attributes of the object to the values in the list + * @param attributes The attributes to set + */ + public void setAttributes(List attributes) { + Iterator iter = attributes.iterator(); + while (iter.hasNext()) { + Attribute a = (Attribute)iter.next(); + if (a.getName().equals("Name")) { + setName((String)a.getValue()); + } else if (a.getName().equals("Description")) { + setDescription(((String)a.getValue().toString())); + } else { + log.error("Wrong attribute for the object " + a); + } + } + } + + /** + * Return a list of the attributes in the object + * @return the list of attributes for the object + */ + public List getAttributes() { + ArrayList res = new ArrayList(); + res.add(new Attribute("Name", getName())); + res.add(new Attribute("Description", getDescription())); + return res; + } + + /** + * @see net.sourceforge.bprocessor.model.Parametric#getGeneralName() + */ + public String getGeneralName() { + // TODO Auto-generated method stub + return null; + } } Index: ConstructionSpace.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ConstructionSpace.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ConstructionSpace.java 28 Feb 2006 02:26:25 -0000 1.5 --- ConstructionSpace.java 16 Mar 2006 10:17:49 -0000 1.6 *************** *** 7,13 **** package net.sourceforge.bprocessor.model; ! import java.util.ArrayList; ! import java.util.Iterator; ! import java.util.List; import org.apache.log4j.Logger; --- 7,11 ---- package net.sourceforge.bprocessor.model; ! import org.apache.log4j.Logger; *************** *** 102,133 **** } - /** - * Set the attributes of the object to the values in the list - * @param attributes The attributes to set - */ - public void setAttributes(List attributes) { - Iterator iter = attributes.iterator(); - while (iter.hasNext()) { - Attribute a = (Attribute)iter.next(); - if (a.getName().equals("Name")) { - setName((String)a.getValue()); - } else if (a.getName().equals("Description")) { - setDescription(((String)a.getValue().toString())); - } else { - log.error("Wrong attribute for the object " + a); - } - } - } - - /** - * Return a list of the attributes in the object - * @return the list of attributes for the object - */ - public List getAttributes() { - ArrayList res = new ArrayList(); - res.add(new Attribute("Name", getName())); - res.add(new Attribute("Description", getDescription())); - return res; - } /** --- 100,103 ---- Index: FunctionalSpace.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/FunctionalSpace.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** FunctionalSpace.java 28 Feb 2006 02:26:25 -0000 1.5 --- FunctionalSpace.java 16 Mar 2006 10:17:50 -0000 1.6 *************** *** 7,13 **** package net.sourceforge.bprocessor.model; ! import java.util.ArrayList; ! import java.util.Iterator; ! import java.util.List; import org.apache.log4j.Logger; --- 7,11 ---- package net.sourceforge.bprocessor.model; ! import org.apache.log4j.Logger; *************** *** 102,133 **** } - /** - * Set the attributes of the object to the values in the list - * @param attributes The attributes to set - */ - public void setAttributes(List attributes) { - Iterator iter = attributes.iterator(); - while (iter.hasNext()) { - Attribute a = (Attribute)iter.next(); - if (a.getName().equals("Name")) { - setName((String)a.getValue()); - } else if (a.getName().equals("Description")) { - setDescription(((String)a.getValue().toString())); - } else { - log.error("Wrong attribute for the object " + a); - } - } - } - - /** - * Return a list of the attributes in the object - * @return the list of attributes for the object - */ - public List getAttributes() { - ArrayList res = new ArrayList(); - res.add(new Attribute("Name", getName())); - res.add(new Attribute("Description", getDescription())); - return res; - } /** --- 100,103 ---- |
From: Nikolaj B. <nbr...@us...> - 2006-03-16 10:17:00
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8179/src/net/sourceforge/bprocessor/gui/attrview Modified Files: DescriptionAttribute.java StringAttribute.java LinkAttribute.java GenericPanel.java Log Message: Made the description scrollable and made some different code optimization Index: StringAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/StringAttribute.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** StringAttribute.java 13 Mar 2006 11:31:45 -0000 1.9 --- StringAttribute.java 16 Mar 2006 10:16:55 -0000 1.10 *************** *** 24,27 **** --- 24,28 ---- import net.sourceforge.bprocessor.model.Attribute; + import net.sourceforge.bprocessor.model.Entity; /** *************** *** 149,164 **** private JComponent createValueLabel(Object value) { String s = ""; ! if (value instanceof String) { ! s = (String)value; ! } else if (value instanceof Double) { ! double rounded = round(((Double) value).doubleValue()); ! s = Double.toString(rounded); ! } ! ! JLabel valueLabel = new JLabel(s); ! if (attribute.isEditable()) { ! valueLabel.setFont(AttributeView.FONT_PLAIN); ! } else { valueLabel.setFont(AttributeView.FONT_ITALIC); } return valueLabel; --- 150,171 ---- private JComponent createValueLabel(Object value) { String s = ""; ! JLabel valueLabel; ! if (value instanceof Entity) { ! s = ((Entity)value).getName(); ! valueLabel = new JLabel(s); valueLabel.setFont(AttributeView.FONT_ITALIC); + } else { + if (value instanceof String) { + s = (String)value; + } else if (value instanceof Double) { + double rounded = round(((Double) value).doubleValue()); + s = Double.toString(rounded); + } + valueLabel = new JLabel(s); + if (attribute.isEditable()) { + valueLabel.setFont(AttributeView.FONT_PLAIN); + } else { + valueLabel.setFont(AttributeView.FONT_ITALIC); + } } return valueLabel; *************** *** 180,186 **** JTextField valueEditor = new JTextField(s); valueEditor.setFont(AttributeView.FONT_PLAIN); return valueEditor; } ! /** * Return the attribute --- 187,195 ---- JTextField valueEditor = new JTextField(s); valueEditor.setFont(AttributeView.FONT_PLAIN); + return valueEditor; } ! ! /** * Return the attribute Index: GenericPanel.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/GenericPanel.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** GenericPanel.java 13 Mar 2006 11:31:45 -0000 1.14 --- GenericPanel.java 16 Mar 2006 10:16:55 -0000 1.15 *************** *** 144,148 **** // Handles the links LinkAttribute la = new LinkAttribute(a); ! la.addLinkAttributeListener(new AttributeListener() { public void valueChanged(Attribute a) { obj.setAttributes(attributes); --- 144,148 ---- // Handles the links LinkAttribute la = new LinkAttribute(a); ! la.addStringAttributeListener(new AttributeListener() { public void valueChanged(Attribute a) { obj.setAttributes(attributes); Index: LinkAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/LinkAttribute.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** LinkAttribute.java 10 Mar 2006 14:10:30 -0000 1.4 --- LinkAttribute.java 16 Mar 2006 10:16:55 -0000 1.5 *************** *** 8,246 **** 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.Entity; /** * The LinkAttributeView */ ! public class LinkAttribute 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 LinkAttribute * @param attribute The attribute */ public LinkAttribute(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.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())); ! 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 LinkAttribute ! * @param mouseListener the mouselistener ! */ ! public void addMouseListener(MouseListener mouseListener) { ! label.addMouseListener(mouseListener); ! component.addMouseListener(mouseListener); ! } ! ! /** ! * Remove a mouselisterner to the active elements in the LinkAttribute ! * @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 addLinkAttributeListener(AttributeListener listener) { ! listeners.add(listener); ! } ! ! /** ! * Remove a listener ! * @param listener The listener ! */ ! public void removeLinkAttributeListener(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 = ((Entity)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) { } } --- 8,27 ---- package net.sourceforge.bprocessor.gui.attrview; import net.sourceforge.bprocessor.model.Attribute; ! /** * The LinkAttributeView */ ! public class LinkAttribute extends StringAttribute { /** ! * Constructor * @param attribute The attribute */ public LinkAttribute(Attribute attribute) { ! super(attribute); } } Index: DescriptionAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/DescriptionAttribute.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DescriptionAttribute.java 13 Mar 2006 11:31:45 -0000 1.4 --- DescriptionAttribute.java 16 Mar 2006 10:16:55 -0000 1.5 *************** *** 212,216 **** public void stopEditing() { if (descriptionEditor != null && attribute.isEditable()) { - Object val = attribute.getValue(); attribute.setValue(new Description(descriptionEditor.getText())); component.remove(descriptionArea); --- 212,215 ---- |
From: Michael L. <he...@us...> - 2006-03-16 09:43:54
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27368/src/net/sourceforge/bprocessor/gl/tool Modified Files: ArcTool.java AbstractPencil.java Log Message: More work on arc and abstractpencil Index: ArcTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ArcTool.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ArcTool.java 15 Mar 2006 10:36:29 -0000 1.4 --- ArcTool.java 16 Mar 2006 09:43:50 -0000 1.5 *************** *** 50,54 **** edges.add(e2); ! feedback(createArc(start.vertex(), current.vertex(), end.vertex())); } else { Edge edge = new Edge(start.vertex(), current.vertex()); --- 50,54 ---- edges.add(e2); ! feedback(createArc(start.vertex(), current.vertex(), end.vertex(), true)); } else { Edge edge = new Edge(start.vertex(), current.vertex()); *************** *** 68,74 **** * @param mid Mid point * @param end End point * @return Edges */ ! protected List createArc(Vertex start, Vertex mid, Vertex end) { List edges = new LinkedList(); Edge e1 = new Edge(start, mid); --- 68,75 ---- * @param mid Mid point * @param end End point + * @param debug Show construction lines * @return Edges */ ! protected List createArc(Vertex start, Vertex mid, Vertex end, boolean debug) { List edges = new LinkedList(); Edge e1 = new Edge(start, mid); *************** *** 116,122 **** side2.setConstructor(true); side3.setConstructor(true); ! edges.add(side1); ! edges.add(side2); ! edges.add(side3); } --- 117,125 ---- side2.setConstructor(true); side3.setConstructor(true); ! if (debug) { ! edges.add(side1); ! edges.add(side2); ! edges.add(side3); ! } } *************** *** 124,129 **** edges.add(e1); edges.add(e2); ! edges.add(l1); ! edges.add(l2); } return edges; --- 127,134 ---- edges.add(e1); edges.add(e2); ! if (debug) { ! edges.add(l1); ! edges.add(l2); ! } } return edges; *************** *** 161,164 **** --- 166,170 ---- end = current; } else { + insertEdges(createArc(start.vertex(), current.vertex(), end.vertex(), false)); start = null; end = null; Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AbstractPencil.java 15 Mar 2006 10:36:29 -0000 1.2 --- AbstractPencil.java 16 Mar 2006 09:43:50 -0000 1.3 *************** *** 11,14 **** --- 11,15 ---- import java.util.HashSet; import java.util.Iterator; + import java.util.List; import net.sourceforge.bprocessor.gl.GLView; *************** *** 34,37 **** --- 35,47 ---- } + + /** + * Insert a number edges into the model + * @param edges List of edges + */ + public void insertEdges(List edges) { + + } + /** * Show feedback |
From: Michael L. <he...@us...> - 2006-03-15 11:01:29
|
Update of /cvsroot/bprocessor/build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4449 Modified Files: build.xml Log Message: Change version Index: build.xml =================================================================== RCS file: /cvsroot/bprocessor/build/build.xml,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** build.xml 28 Feb 2006 20:53:46 -0000 1.13 --- build.xml 15 Mar 2006 11:00:54 -0000 1.14 *************** *** 3,7 **** <target name="init"> <property name="project" value="bprocessor"/> ! <property name="version" value="M4"/> <property name="script.dir" value="${basedir}/bin"/> --- 3,7 ---- <target name="init"> <property name="project" value="bprocessor"/> ! <property name="version" value="M4-developmen"/> <property name="script.dir" value="${basedir}/bin"/> |
From: Michael L. <he...@us...> - 2006-03-15 10:36:36
|
Update of /cvsroot/bprocessor/gl/src/gfx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24910/src/gfx Added Files: Biconrect.gif Log Message: First version of RectTool (does not actually add the rect to the model yet) RectTool and ArcTool inherits AbstractPencil that contains common functionality --- NEW FILE: Biconrect.gif --- (This appears to be a binary file; contents omitted.) |
From: Michael L. <he...@us...> - 2006-03-15 10:36:34
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24910/src/net/sourceforge/bprocessor/gl/tool Modified Files: Tool.java ToolFactory.java ArcTool.java AbstractPencil.java Added Files: RectTool.java Log Message: First version of RectTool (does not actually add the rect to the model yet) RectTool and ArcTool inherits AbstractPencil that contains common functionality Index: ArcTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ArcTool.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ArcTool.java 15 Mar 2006 09:24:21 -0000 1.3 --- ArcTool.java 15 Mar 2006 10:36:29 -0000 1.4 *************** *** 11,16 **** import java.awt.event.MouseEvent; import java.util.Collection; - import java.util.HashSet; - import java.util.Iterator; import java.util.LinkedList; import java.util.List; --- 11,14 ---- *************** *** 27,34 **** * */ ! public class ArcTool extends AbstractTool { ! ! /** Feedback elements */ ! private Collection elements = new HashSet(); /** Current intersection */ --- 25,29 ---- * */ ! public class ArcTool extends AbstractPencil { /** Current intersection */ *************** *** 42,78 **** /** - * Show feedback - */ - protected void showFeedback() { - Iterator iter = elements.iterator(); - while (iter.hasNext()) { - Edge current = (Edge) iter.next(); - glv.getView().addTempEdge(current); - } - } - - /** - * Hide feedback - */ - protected void hideFeedback() { - Iterator iter = elements.iterator(); - while (iter.hasNext()) { - Edge current = (Edge) iter.next(); - glv.getView().removeTempEdge(current); - } - } - - /** - * Give feedback - * @param feed Collection of edges - */ - protected void feedback(Collection feed) { - hideFeedback(); - elements.clear(); - elements.addAll(feed); - showFeedback(); - } - - /** * Update feedback * --- 37,40 ---- *************** *** 102,140 **** /** - * Make target - * @param intersection Intersection - */ - protected void makeTarget(Intersection intersection) { - if (intersection != null) { - Object target = null; - Vertex current = intersection.vertex(); - switch (intersection.type()) { - case Intersection.VERTEX: - target = current; - break; - case Intersection.EDGE: - target = intersection.object(); - break; - case Intersection.SURFACE: - target = intersection.object(); - break; - case Intersection.EDGE_MIDPOINT: - target = current; - break; - case Intersection.EDGE_INTERSECTION: - target = current; - break; - case Intersection.SURFACE_INTERSECTION: - target = current; - break; - case Intersection.PLANE_INTERSECTION: - target = null; - break; - } - glv.getView().makeTarget(target); - } - } - - /** * Create an arc * @param start Start point --- 64,67 ---- Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** ToolFactory.java 14 Mar 2006 23:36:28 -0000 1.36 --- ToolFactory.java 15 Mar 2006 10:36:29 -0000 1.37 *************** *** 75,78 **** --- 75,81 ---- /** arc tool */ private ArcTool arc; + + /** rect tool */ + private RectTool rect; /** pencil tool */ *************** *** 163,166 **** --- 166,170 ---- eraser = new EraserTool(glv, pencilcursor); arc = new ArcTool(glv, pencilcursor); + rect = new RectTool(glv, pencilcursor); move = new MoveTool(glv, pencilcursor); rotation = new RotationTool(glv, pencilcursor); *************** *** 179,182 **** --- 183,187 ---- eraserBut = this.registerTool(Tool.ERASER_TOOL, eraser, "Biconeraser.gif", "Eraser"); this.registerTool(Tool.ARC_TOOL, arc, "Biconarc.gif", "Arc"); + this.registerTool(Tool.RECT_TOOL, rect, "Biconrect.gif", "Rectangle"); moveBut = this.registerTool(Tool.MOVE_TOOL, move, "Biconmovetool.gif", "Move"); moveBut.addMouseListener(new MoveButtonMouseListener(moveBut)); --- NEW FILE: RectTool.java --- //--------------------------------------------------------------------------------- // $Id: RectTool.java,v 1.1 2006/03/15 10:36:29 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.tool; import java.awt.Cursor; import java.awt.event.MouseEvent; import java.util.LinkedList; import java.util.List; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.model.Intersection; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Vertex; /** * RectTool */ public class RectTool extends AbstractPencil { /** Current intersection */ private Intersection current; /** Start */ private Intersection start; /** * Constructor * @param glv GLView * @param cursor Cursor */ public RectTool(GLView glv, Cursor cursor) { super(glv, cursor); } /** * Update feedback * */ protected void updateFeedback() { if (start != null) { List edges = new LinkedList(); Edge edge = new Edge(start.vertex(), current.vertex()); edge.setConstructor(true); edges.add(edge); Vertex d = start.vertex().minus(current.vertex()); Vertex v1 = null; Vertex v3 = null; Vertex v2 = null; Vertex v4 = null; if (Math.abs(d.getZ()) < 0.00001) { v1 = start.vertex(); v3 = current.vertex(); v2 = new Vertex(v3.getX(), v1.getY(), v1.getZ()); v4 = new Vertex(v1.getX(), v3.getY(), v3.getZ()); } else if (Math.abs(d.getX()) < 0.00001) { v1 = start.vertex(); v3 = current.vertex(); v2 = new Vertex(v3.getX(), v1.getY(), v3.getZ()); v4 = new Vertex(v1.getX(), v3.getY(), v1.getZ()); } else if (Math.abs(d.getY()) < 0.00001) { v1 = start.vertex(); v3 = current.vertex(); v2 = new Vertex(v1.getX(), v1.getY(), v3.getZ()); v4 = new Vertex(v3.getX(), v3.getY(), v1.getZ()); } if (v1 != null) { Edge e1 = new Edge(v1, v2); Edge e2 = new Edge(v2, v3); Edge e3 = new Edge(v3, v4); Edge e4 = new Edge(v4, v1); edges.add(e1); edges.add(e2); edges.add(e3); edges.add(e4); } feedback(edges); } else { feedback(new LinkedList()); } makeTarget(current); } /** * @param e MouseEvent */ protected void moved(MouseEvent e) { current = (Intersection) glv.getView().getObjectAtPoint(e.getX(), e.getY(), elements, true, new Plane(0, 0, 1, 0)); if (current != null) { updateFeedback(); } } /** * @param e MouseEvent */ protected void pressed(MouseEvent e) { if (start == null) { start = current; } else { start = null; } updateFeedback(); } /** * @param e MouseEvent */ protected void dragged(MouseEvent e) { } /** * @param e MouseEvent */ protected void released(MouseEvent e) { } } Index: Tool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Tool.java 14 Mar 2006 23:36:28 -0000 1.19 --- Tool.java 15 Mar 2006 10:36:28 -0000 1.20 *************** *** 42,47 **** /** The Eraser tool */ public static final int ERASER_TOOL = 10; ! /** The Eraser tool */ public static final int ARC_TOOL = 11; /** --- 42,49 ---- /** The Eraser tool */ public static final int ERASER_TOOL = 10; ! /** The Arc tool */ public static final int ARC_TOOL = 11; + /** The Rect tool */ + public static final int RECT_TOOL = 12; /** Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AbstractPencil.java 15 Mar 2006 09:37:42 -0000 1.1 --- AbstractPencil.java 15 Mar 2006 10:36:29 -0000 1.2 *************** *** 8,13 **** --- 8,19 ---- import java.awt.Cursor; + import java.util.Collection; + import java.util.HashSet; + import java.util.Iterator; import net.sourceforge.bprocessor.gl.GLView; + import net.sourceforge.bprocessor.gl.model.Intersection; + import net.sourceforge.bprocessor.model.Edge; + import net.sourceforge.bprocessor.model.Vertex; /** *************** *** 16,19 **** --- 22,28 ---- */ public abstract class AbstractPencil extends AbstractTool { + /** Feedback elements */ + protected Collection elements = new HashSet(); + /** * Constructor *************** *** 25,27 **** --- 34,104 ---- } + /** + * Show feedback + */ + protected void showFeedback() { + Iterator iter = elements.iterator(); + while (iter.hasNext()) { + Edge current = (Edge) iter.next(); + glv.getView().addTempEdge(current); + } + } + + /** + * Hide feedback + */ + protected void hideFeedback() { + Iterator iter = elements.iterator(); + while (iter.hasNext()) { + Edge current = (Edge) iter.next(); + glv.getView().removeTempEdge(current); + } + } + + /** + * Give feedback + * @param feed Collection of edges + */ + protected void feedback(Collection feed) { + hideFeedback(); + elements.clear(); + elements.addAll(feed); + showFeedback(); + } + + /** + * Make target + * @param intersection Intersection + */ + protected void makeTarget(Intersection intersection) { + if (intersection != null) { + Object target = null; + Vertex current = intersection.vertex(); + switch (intersection.type()) { + case Intersection.VERTEX: + target = current; + break; + case Intersection.EDGE: + target = intersection.object(); + break; + case Intersection.SURFACE: + target = intersection.object(); + break; + case Intersection.EDGE_MIDPOINT: + target = current; + break; + case Intersection.EDGE_INTERSECTION: + target = current; + break; + case Intersection.SURFACE_INTERSECTION: + target = current; + break; + case Intersection.PLANE_INTERSECTION: + target = null; + break; + } + glv.getView().makeTarget(target); + } + } + } |
From: Michael L. <he...@us...> - 2006-03-15 09:37:49
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30101/src/net/sourceforge/bprocessor/gl/tool Added Files: AbstractPencil.java Log Message: General pencil class that should be superclass for Pencil, Arc, Rect etc. --- NEW FILE: AbstractPencil.java --- //--------------------------------------------------------------------------------- // $Id: AbstractPencil.java,v 1.1 2006/03/15 09:37:42 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.tool; import java.awt.Cursor; import net.sourceforge.bprocessor.gl.GLView; /** * AbstractPencil * */ public abstract class AbstractPencil extends AbstractTool { /** * Constructor * @param glv GLView * @param cursor Cursor */ public AbstractPencil(GLView glv, Cursor cursor) { super(glv, cursor); } } |
From: Michael L. <he...@us...> - 2006-03-15 09:24:29
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23431/src/net/sourceforge/bprocessor/gl/tool Modified Files: ArcTool.java Log Message: A bit more feedback in ArcTool Index: ArcTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ArcTool.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ArcTool.java 15 Mar 2006 09:12:09 -0000 1.2 --- ArcTool.java 15 Mar 2006 09:24:21 -0000 1.3 *************** *** 179,182 **** --- 179,197 ---- l1.setConstructor(true); l2.setConstructor(true); + + Edge inter = l1.intersection(l2); + if (inter != null) { + Vertex center = inter.getFrom(); + Edge side1 = new Edge(center, start); + Edge side2 = new Edge(center, end); + Edge side3 = new Edge(center, mid); + side1.setConstructor(true); + side2.setConstructor(true); + side3.setConstructor(true); + edges.add(side1); + edges.add(side2); + edges.add(side3); + } + edges.add(e1); |
From: Michael L. <he...@us...> - 2006-03-15 09:12:17
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17382/src/net/sourceforge/bprocessor/gl/tool Modified Files: ArcTool.java Log Message: Center found in ArcTool (but the actual arc are not created yet) Index: ArcTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ArcTool.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ArcTool.java 14 Mar 2006 23:36:28 -0000 1.1 --- ArcTool.java 15 Mar 2006 09:12:09 -0000 1.2 *************** *** 14,22 **** --- 14,25 ---- import java.util.Iterator; import java.util.LinkedList; + import java.util.List; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.model.Intersection; + import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Plane; + import net.sourceforge.bprocessor.model.Vertex; /** *************** *** 38,42 **** private Intersection end; - /** * Show feedback --- 41,44 ---- *************** *** 73,76 **** --- 75,192 ---- /** + * Update feedback + * + */ + protected void updateFeedback() { + if (start != null) { + if (end != null) { + + Edge e1 = new Edge(start.vertex(), current.vertex()); + Edge e2 = new Edge(current.vertex(), end.vertex()); + Collection edges = new LinkedList(); + edges.add(e1); + edges.add(e2); + + feedback(createArc(start.vertex(), current.vertex(), end.vertex())); + } else { + Edge edge = new Edge(start.vertex(), current.vertex()); + Collection edges = new LinkedList(); + edges.add(edge); + feedback(edges); + } + } else { + feedback(new LinkedList()); + } + makeTarget(current); + } + + /** + * Make target + * @param intersection Intersection + */ + protected void makeTarget(Intersection intersection) { + if (intersection != null) { + Object target = null; + Vertex current = intersection.vertex(); + switch (intersection.type()) { + case Intersection.VERTEX: + target = current; + break; + case Intersection.EDGE: + target = intersection.object(); + break; + case Intersection.SURFACE: + target = intersection.object(); + break; + case Intersection.EDGE_MIDPOINT: + target = current; + break; + case Intersection.EDGE_INTERSECTION: + target = current; + break; + case Intersection.SURFACE_INTERSECTION: + target = current; + break; + case Intersection.PLANE_INTERSECTION: + target = null; + break; + } + glv.getView().makeTarget(target); + } + } + + /** + * Create an arc + * @param start Start point + * @param mid Mid point + * @param end End point + * @return Edges + */ + protected List createArc(Vertex start, Vertex mid, Vertex end) { + List edges = new LinkedList(); + Edge e1 = new Edge(start, mid); + Edge e2 = new Edge(mid, end); + CoordinateSystem system = CoordinateSystem.create(e1, e2); + if (system != null) { + Vertex p = system.translate(start); + Vertex m = system.translate(mid); + Vertex q = system.translate(end); + + double x; + double y; + + Vertex v1 = m.minus(p); + v1.scale(0.5); + Vertex m1 = p.add(v1); + + x = v1.getX(); + y = v1.getY(); + v1.setX(-y); + v1.setY(x); + v1.scale(10 / v1.length()); + Edge l1 = new Edge(system.unTranslate(m1.minus(v1)), system.unTranslate(m1.add(v1))); + + Vertex v2 = m.minus(q); + v2.scale(0.5); + Vertex m2 = q.add(v2); + + x = v2.getX(); + y = v2.getY(); + v2.setX(-y); + v2.setY(x); + v2.scale(10 / v2.length()); + Edge l2 = new Edge(system.unTranslate(m2.minus(v2)), system.unTranslate(m2.add(v2))); + l1.setConstructor(true); + l2.setConstructor(true); + + edges.add(e1); + edges.add(e2); + edges.add(l1); + edges.add(l2); + } + return edges; + } + + /** * Constructor * @param glv GLView *************** *** 86,106 **** protected void moved(MouseEvent e) { current = (Intersection) glv.getView().getObjectAtPoint(e.getX(), e.getY(), ! new HashSet(), true, new Plane(0, 0, 1, 0)); if (current != null) { ! if (start != null) { ! if (end != null) { ! Edge e1 = new Edge(start.vertex(), current.vertex()); ! Edge e2 = new Edge(current.vertex(), end.vertex()); ! Collection edges = new LinkedList(); ! edges.add(e1); ! edges.add(e2); ! feedback(edges); ! } else { ! Edge edge = new Edge(start.vertex(), current.vertex()); ! Collection edges = new LinkedList(); ! edges.add(edge); ! feedback(edges); ! } ! } } } --- 202,208 ---- protected void moved(MouseEvent e) { current = (Intersection) glv.getView().getObjectAtPoint(e.getX(), e.getY(), ! elements, true, new Plane(0, 0, 1, 0)); if (current != null) { ! updateFeedback(); } } *************** *** 110,123 **** */ protected void pressed(MouseEvent e) { ! if (start == null) { ! start = current; ! } else { ! if (end == null) { ! end = current; } else { ! feedback(new LinkedList()); ! start = null; ! end = null; } } } --- 212,227 ---- */ protected void pressed(MouseEvent e) { ! if (current != null) { ! if (start == null) { ! start = current; } else { ! if (end == null) { ! end = current; ! } else { ! start = null; ! end = null; ! } } + updateFeedback(); } } |
From: Michael L. <he...@us...> - 2006-03-14 23:36:35
|
Update of /cvsroot/bprocessor/gl/src/gfx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3024/src/gfx Added Files: Biconarc.gif Log Message: Started the arc tool --- NEW FILE: Biconarc.gif --- (This appears to be a binary file; contents omitted.) |
From: Michael L. <he...@us...> - 2006-03-14 23:36:33
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3024/src/net/sourceforge/bprocessor/gl/tool Modified Files: Tool.java ToolFactory.java Added Files: ArcTool.java Log Message: Started the arc tool --- NEW FILE: ArcTool.java --- //--------------------------------------------------------------------------------- // $Id: ArcTool.java,v 1.1 2006/03/14 23:36:28 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.tool; import java.awt.Cursor; import java.awt.event.MouseEvent; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.model.Intersection; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Plane; /** * ArcTool * */ public class ArcTool extends AbstractTool { /** Feedback elements */ private Collection elements = new HashSet(); /** Current intersection */ private Intersection current; /** Start */ private Intersection start; /** End */ private Intersection end; /** * Show feedback */ protected void showFeedback() { Iterator iter = elements.iterator(); while (iter.hasNext()) { Edge current = (Edge) iter.next(); glv.getView().addTempEdge(current); } } /** * Hide feedback */ protected void hideFeedback() { Iterator iter = elements.iterator(); while (iter.hasNext()) { Edge current = (Edge) iter.next(); glv.getView().removeTempEdge(current); } } /** * Give feedback * @param feed Collection of edges */ protected void feedback(Collection feed) { hideFeedback(); elements.clear(); elements.addAll(feed); showFeedback(); } /** * Constructor * @param glv GLView * @param cursor Cursor */ public ArcTool(GLView glv, Cursor cursor) { super(glv, cursor); } /** * @param e MouseEvent */ protected void moved(MouseEvent e) { current = (Intersection) glv.getView().getObjectAtPoint(e.getX(), e.getY(), new HashSet(), true, new Plane(0, 0, 1, 0)); if (current != null) { if (start != null) { if (end != null) { Edge e1 = new Edge(start.vertex(), current.vertex()); Edge e2 = new Edge(current.vertex(), end.vertex()); Collection edges = new LinkedList(); edges.add(e1); edges.add(e2); feedback(edges); } else { Edge edge = new Edge(start.vertex(), current.vertex()); Collection edges = new LinkedList(); edges.add(edge); feedback(edges); } } } } /** * @param e MouseEvent */ protected void pressed(MouseEvent e) { if (start == null) { start = current; } else { if (end == null) { end = current; } else { feedback(new LinkedList()); start = null; end = null; } } } /** * @param e MouseEvent */ protected void dragged(MouseEvent e) { } /** * @param e MouseEvent */ protected void released(MouseEvent e) { } } Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** ToolFactory.java 13 Mar 2006 22:04:11 -0000 1.35 --- ToolFactory.java 14 Mar 2006 23:36:28 -0000 1.36 *************** *** 72,75 **** --- 72,78 ---- /** eraser tool */ private EraserTool eraser; + + /** arc tool */ + private ArcTool arc; /** pencil tool */ *************** *** 159,162 **** --- 162,166 ---- pencil = new PencilTool(glv, pencilcursor); eraser = new EraserTool(glv, pencilcursor); + arc = new ArcTool(glv, pencilcursor); move = new MoveTool(glv, pencilcursor); rotation = new RotationTool(glv, pencilcursor); *************** *** 174,177 **** --- 178,182 ---- pencilBut = this.registerTool(Tool.PENCIL_TOOL, pencil, "Biconpentool.gif", "Pencil"); eraserBut = this.registerTool(Tool.ERASER_TOOL, eraser, "Biconeraser.gif", "Eraser"); + this.registerTool(Tool.ARC_TOOL, arc, "Biconarc.gif", "Arc"); moveBut = this.registerTool(Tool.MOVE_TOOL, move, "Biconmovetool.gif", "Move"); moveBut.addMouseListener(new MoveButtonMouseListener(moveBut)); Index: Tool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Tool.java 3 Feb 2006 14:53:17 -0000 1.18 --- Tool.java 14 Mar 2006 23:36:28 -0000 1.19 *************** *** 42,45 **** --- 42,47 ---- /** The Eraser tool */ public static final int ERASER_TOOL = 10; + /** The Eraser tool */ + public static final int ARC_TOOL = 11; /** |
From: Michael L. <he...@us...> - 2006-03-13 22:04:18
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18030/src/net/sourceforge/bprocessor/gl/tool Modified Files: ToolFactory.java Log Message: Refactored ToolFactory Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** ToolFactory.java 13 Mar 2006 12:06:51 -0000 1.34 --- ToolFactory.java 13 Mar 2006 22:04:11 -0000 1.35 *************** *** 11,14 **** --- 11,16 ---- import java.net.URL; + import java.util.HashMap; + import java.util.Map; import java.awt.Cursor; import java.awt.Image; *************** *** 37,40 **** --- 39,55 ---- private static Logger log = Logger.getLogger(ToolFactory.class); + /** glv */ + private GLView glv; + + /** tools */ + private Map tools; + + /** buttons */ + private Map buttons; + + /** button group */ + private ButtonGroup group; + + /** The factory */ private static ToolFactory factory; *************** *** 117,120 **** --- 132,140 ---- */ private ToolFactory(GLView glv) { + tools = new HashMap(); + buttons = new HashMap(); + group = new ButtonGroup(); + this.glv = glv; + ClassLoader cl = Thread.currentThread().getContextClassLoader(); URL url = cl.getResource("Bcursorpen1.gif"); *************** *** 136,182 **** Toolkit.getDefaultToolkit().createCustomCursor(walkImage, new Point(7, 8), "Walk"); - ButtonGroup bg = new ButtonGroup(); - Toolbar tb = Toolbar.getInstance(); - tb.addSeparator(); - selBut = tb.registerAction(new SelectAction(glv)); - bg.add(selBut); - selBut.setToolTipText("Select"); - pencilBut = tb.registerAction(new PencilAction(glv)); - bg.add(pencilBut); - pencilBut.setToolTipText("Pencil"); - - eraserBut = tb.registerAction(new EraserAction(glv)); - bg.add(eraserBut); - eraserBut.setToolTipText("Eraser"); - - - moveBut = tb.registerAction(new MoveAction(glv)); - bg.add(moveBut); - moveBut.setToolTipText("Move"); - moveBut.addMouseListener(new MoveButtonMouseListener(moveBut)); - rotBut = tb.registerAction(new RotationAction(glv)); - bg.add(rotBut); - rotBut.setToolTipText("Rotate"); - extrudBut = tb.registerAction(new ExtrudeAction(glv)); - bg.add(extrudBut); - extrudBut.setToolTipText("Extrude"); - clipBut = tb.registerAction(new ClipAction(glv)); - bg.add(clipBut); - clipBut.setToolTipText("Clipping"); - tmBut = tb.registerAction(new TapeMeasureAction(glv)); - bg.add(tmBut); - tmBut.setToolTipText("Tape Measure"); - tb.addSeparator(); - cRotBut = tb.registerAction(new CameraAction(glv)); - bg.add(cRotBut); - cRotBut.setToolTipText("Camera rotation"); - flyBut = tb.registerAction(new CameraFlyAction(glv)); - bg.add(flyBut); - flyBut.setToolTipText("Fly mode"); - walkBut = tb.registerAction(new CameraWalkAction(glv)); - bg.add(walkBut); - walkBut.setToolTipText("Walk mode"); - - select = new SpaceTool(glv, null); pencil = new PencilTool(glv, pencilcursor); --- 156,159 ---- *************** *** 190,193 **** --- 167,192 ---- fly = new CameraFlyTool(glv, flyCursor); walk = new CameraWalkTool(glv, walkCursor); + + Toolbar tb = Toolbar.getInstance(); + tb.addSeparator(); + + selBut = this.registerTool(Tool.SELECT_TOOL, select, "Biconselecttool.gif", "Select"); + pencilBut = this.registerTool(Tool.PENCIL_TOOL, pencil, "Biconpentool.gif", "Pencil"); + eraserBut = this.registerTool(Tool.ERASER_TOOL, eraser, "Biconeraser.gif", "Eraser"); + moveBut = this.registerTool(Tool.MOVE_TOOL, move, "Biconmovetool.gif", "Move"); + moveBut.addMouseListener(new MoveButtonMouseListener(moveBut)); + rotBut = this.registerTool(Tool.ROTATION_TOOL, rotation, "Biconrotobj.gif", "Rotation"); + extrudBut = this.registerTool(Tool.EXTRUSION_TOOL, extrusion, + "Biconextrudetool.gif", "Extrude"); + clipBut = this.registerTool(Tool.CLIP_TOOL, clipplane, + "Biconclipplane.gif", "Clipping"); + tmBut = this.registerTool(Tool.TAPE_MEASURE_TOOL, tapeMeasure, + "Bicontapemes.gif", "Tape Measure"); + + tb.addSeparator(); + + cRotBut = this.registerTool(Tool.CAMERA_TOOL, camera, "Biconrotcam.gif", "Orbit"); + flyBut = this.registerTool(Tool.FLY_TOOL, fly, "Biconfly.gif", "Fly"); + walkBut = this.registerTool(Tool.WALK_TOOL, walk, "Biconwalk.gif", "Walk"); } *************** *** 222,225 **** --- 221,243 ---- return temp; } + + /** + * Register Tool + * @param key Key + * @param tool Tool + * @param iconname Icon name + * @param tooltip Tool tip + * @return Button + */ + public JToggleButton registerTool(int key, Tool tool, String iconname, String tooltip) { + tools.put(new Integer(key), tool); + ToolAction action = new ToolAction(glv, key, iconname); + JToggleButton button = Toolbar.getInstance().registerAction(action); + button.setToolTipText(tooltip); + group.add(button); + buttons.put(tool, button); + return button; + } + /** *************** *** 230,594 **** public Tool get(int i) { Tool temp = currentTool; ! if (i == Tool.SELECT_TOOL) { ! selBut.setSelected(true); ! currentTool = select; ! } else if (i == Tool.MOVE_TOOL) { ! moveBut.setSelected(true); ! currentTool = move; ! } else if (i == Tool.ROTATION_TOOL) { ! rotBut.setSelected(true); ! currentTool = rotation; ! } else if (i == Tool.EXTRUSION_TOOL) { ! extrudBut.setSelected(true); ! currentTool = extrusion; ! } else if (i == Tool.PENCIL_TOOL) { ! pencilBut.setSelected(true); ! currentTool = pencil; ! } else if (i == Tool.CLIP_TOOL) { ! clipBut.setSelected(true); ! currentTool = clipplane; ! } else if (i == Tool.CAMERA_TOOL) { ! cRotBut.setSelected(true); ! currentTool = camera; ! } else if (i == Tool.FLY_TOOL) { ! flyBut.setSelected(true); ! currentTool = fly; ! } else if (i == Tool.WALK_TOOL) { ! walkBut.setSelected(true); ! currentTool = walk; ! } else if (i == Tool.TAPE_MEASURE_TOOL) { ! tmBut.setSelected(true); ! currentTool = tapeMeasure; ! } else if (i == Tool.ERASER_TOOL) { ! eraserBut.setSelected(true); ! currentTool = eraser; } else { log.error("[get] No such tool " + i); return null; } - if (currentTool != temp) { - previousTool = temp; - } - return currentTool; - } - - /** - * The select action inner class - */ - class SelectAction extends AbstractAction { - /** The GLView */ - private GLView glv = null; - - /** - * Constructor - * @param glv TheGLView - */ - SelectAction(GLView glv) { - this.glv = glv; - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - URL url = cl.getResource("Biconselecttool.gif"); - ImageIcon im = new ImageIcon(url); - putValue(Action.SMALL_ICON, im); - } - - /** - * Called when the button is pressed - * @param e The ActionEvent - */ - public void actionPerformed(ActionEvent e) { - glv.changeTool(Tool.SELECT_TOOL); - } - } - - - - /** - * The rotation action inner class - */ - class CameraAction extends AbstractAction { - /** The GLView */ - private GLView glv = null; - - /** - * Constructor - * @param glv TheGLView - */ - CameraAction(GLView glv) { - this.glv = glv; - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - URL url = cl.getResource("Biconrotcam.gif"); - ImageIcon im = new ImageIcon(url); - putValue(Action.SMALL_ICON, im); - } - - /** - * Called when the button is pressed - * @param e The ActionEvent - */ - public void actionPerformed(ActionEvent e) { - glv.changeTool(Tool.CAMERA_TOOL); - } - } - - /** - * The fly action inner class - */ - class CameraFlyAction extends AbstractAction { - /** The GLView */ - private GLView glv = null; - - /** - * Constructor - * @param glv TheGLView - */ - CameraFlyAction(GLView glv) { - this.glv = glv; - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - URL url = cl.getResource("Biconfly.gif"); - ImageIcon im = new ImageIcon(url); - putValue(Action.SMALL_ICON, im); - } - - /** - * Called when the button is pressed - * @param e The ActionEvent - */ - public void actionPerformed(ActionEvent e) { - glv.changeTool(Tool.FLY_TOOL); - } - } - - /** - * The walk action inner class - */ - class CameraWalkAction extends AbstractAction { - /** The GLView */ - private GLView glv = null; - - /** - * Constructor - * @param glv TheGLView - */ - CameraWalkAction(GLView glv) { - this.glv = glv; - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - URL url = cl.getResource("Biconwalk.gif"); - ImageIcon im = new ImageIcon(url); - putValue(Action.SMALL_ICON, im); - } - - /** - * Called when the button is pressed - * @param e The ActionEvent - */ - public void actionPerformed(ActionEvent e) { - glv.changeTool(Tool.WALK_TOOL); - } - } - - /** - * The move action inner class - */ - class MoveAction extends AbstractAction { - /** The GLView */ - private GLView glv = null; - - /** - * Constructor - * @param glv TheGLView - */ - MoveAction(GLView glv) { - this.glv = glv; - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - URL url = cl.getResource("Biconmovetool.gif"); - ImageIcon im = new ImageIcon(url); - putValue(Action.SMALL_ICON, im); - } - - /** - * Called when the button is pressed - * @param e The ActionEvent - */ - public void actionPerformed(ActionEvent e) { - glv.changeTool(Tool.MOVE_TOOL); - } - } - - /** - * The rotaion action inner class - */ - class RotationAction extends AbstractAction { - /** The GLView */ - private GLView glv = null; - - /** - * Constructor - * @param glv TheGLView - */ - RotationAction(GLView glv) { - this.glv = glv; - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - URL url = cl.getResource("Biconrotobj.gif"); - ImageIcon im = new ImageIcon(url); - putValue(Action.SMALL_ICON, im); - } - - /** - * Called when the button is pressed - * @param e The ActionEvent - */ - public void actionPerformed(ActionEvent e) { - glv.changeTool(Tool.ROTATION_TOOL); - } } /** ! * The extrude action inner class ! */ ! class ExtrudeAction extends AbstractAction { ! /** The GLView */ ! private GLView glv = null; ! ! /** ! * Constructor ! * @param glv TheGLView ! */ ! ExtrudeAction(GLView glv) { ! this.glv = glv; ! ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource("Biconextrudetool.gif"); ! ImageIcon im = new ImageIcon(url); ! putValue(Action.SMALL_ICON, im); ! } ! ! /** ! * Called when the button is pressed ! * @param e The ActionEvent ! */ ! public void actionPerformed(ActionEvent e) { ! glv.changeTool(Tool.EXTRUSION_TOOL); ! } ! } ! ! /** ! * The pencil action inner class */ ! class PencilAction extends AbstractAction { ! /** The GLView */ ! private GLView glv = null; ! ! /** The mouse cursor */ ! private Cursor cursor; ! /** ! * Constructor ! * @param glv TheGLView ! */ ! PencilAction(GLView glv) { ! this.glv = glv; ! ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource("Biconpentool.gif"); ! ImageIcon im = new ImageIcon(url); ! putValue(Action.SMALL_ICON, im); ! Image image = Toolkit.getDefaultToolkit().getImage(url); ! cursor = Toolkit.getDefaultToolkit().createCustomCursor(image, new Point(0, 0), "Pencil"); ! } ! ! /** ! * Called when the button is pressed ! * @param e The ActionEvent ! */ ! public void actionPerformed(ActionEvent e) { ! glv.changeTool(Tool.PENCIL_TOOL); ! } ! } ! ! /** ! * EraserAction ! */ ! class EraserAction extends AbstractAction { ! /** The GLView */ ! private GLView glv = null; ! ! /** The mouse cursor */ ! private Cursor cursor; - /** - * Constructor - * @param glv TheGLView - */ - EraserAction(GLView glv) { - this.glv = glv; - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - URL url = cl.getResource("Biconeraser.gif"); - ImageIcon im = new ImageIcon(url); - putValue(Action.SMALL_ICON, im); - } - /** ! * Called when the button is pressed ! * @param e The ActionEvent ! */ ! public void actionPerformed(ActionEvent e) { ! glv.changeTool(Tool.ERASER_TOOL); ! } ! } ! ! ! /** ! * The clipping action inner class ! */ ! class ClipAction extends AbstractAction { ! /** The GLView */ ! private GLView glv = null; ! ! /** ! * Constructor ! * @param glv TheGLView */ ! ClipAction(GLView glv) { this.glv = glv; ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource("Biconclipplane.gif"); ImageIcon im = new ImageIcon(url); putValue(Action.SMALL_ICON, im); } - - /** - * Called when the button is pressed - * @param e The ActionEvent - */ - public void actionPerformed(ActionEvent e) { - glv.changeTool(Tool.CLIP_TOOL); - } - } - - - /** - * The tape measure action inner class - */ - class TapeMeasureAction extends AbstractAction { - /** The GLView */ - private GLView glv = null; - - /** - * Constructor - * @param glv TheGLView - */ - TapeMeasureAction(GLView glv) { - this.glv = glv; - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - URL url = cl.getResource("Bicontapemes.gif"); - ImageIcon im = new ImageIcon(url); - putValue(Action.SMALL_ICON, im); - } - /** ! * Called when the button is pressed ! * @param e The ActionEvent */ ! public void actionPerformed(ActionEvent e) { ! glv.changeTool(Tool.TAPE_MEASURE_TOOL); } } --- 248,296 ---- public Tool get(int i) { Tool temp = currentTool; ! Tool next = (Tool) tools.get(new Integer(i)); ! if (next != null) { ! JToggleButton button = (JToggleButton) buttons.get(next); ! button.setSelected(true); ! currentTool = next; ! if (currentTool != temp) { ! previousTool = temp; ! } ! return currentTool; } else { log.error("[get] No such tool " + i); return null; } } /** ! * ToolAction */ ! class ToolAction extends AbstractAction { ! /** glv */ ! private GLView glv; ! /** key */ ! private int key; /** ! * Constructor ! * @param glv GLView ! * @param key Key ! * @param iconname Iconname */ ! public ToolAction(GLView glv, int key, String iconname) { this.glv = glv; + this.key = key; ClassLoader cl = Thread.currentThread().getContextClassLoader(); ! URL url = cl.getResource(iconname); ImageIcon im = new ImageIcon(url); putValue(Action.SMALL_ICON, im); } /** ! * @param event ActionEvent */ ! public void actionPerformed(ActionEvent event) { ! glv.changeTool(key); } } |
From: Michael L. <he...@us...> - 2006-03-13 12:07:01
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9050/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Removed a few warnings Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** View.java 10 Mar 2006 16:41:26 -0000 1.71 --- View.java 13 Mar 2006 12:06:51 -0000 1.72 *************** *** 662,666 **** drawNormalMode(gld); } else { - drawSelectionMode(gld); } --- 662,665 ---- |
From: Michael L. <he...@us...> - 2006-03-13 12:07:01
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9050/src/net/sourceforge/bprocessor/gl/tool Modified Files: ToolFactory.java Log Message: Removed a few warnings Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** ToolFactory.java 12 Mar 2006 12:33:01 -0000 1.33 --- ToolFactory.java 13 Mar 2006 12:06:51 -0000 1.34 *************** *** 616,620 **** */ public void mousePressed(MouseEvent e) { ! if (e.getButton() == e.BUTTON3) { JPopupMenu pm = new JPopupMenu(); MovePopupActionListener mpal = new MovePopupActionListener(); --- 616,620 ---- */ public void mousePressed(MouseEvent e) { ! if (e.getButton() == MouseEvent.BUTTON3) { JPopupMenu pm = new JPopupMenu(); MovePopupActionListener mpal = new MovePopupActionListener(); *************** *** 645,655 **** public void actionPerformed(ActionEvent actionEvent) { if (actionEvent.getActionCommand().equals("Vector")) { ! move.setMoveMode(move.THREE_CLICK); } else if (actionEvent.getActionCommand().equals("Axis restricted")) { ! move.setMoveMode(move.AXIS_RESTRICTED); } else if (actionEvent.getActionCommand().equals("Free plane")) { ! move.setMoveMode(move.FREE_SNAP); } else if (actionEvent.getActionCommand().equals("Controlled")) { ! move.setMoveMode(move.CONTROLLED); } } --- 645,655 ---- public void actionPerformed(ActionEvent actionEvent) { if (actionEvent.getActionCommand().equals("Vector")) { ! move.setMoveMode(MoveTool.THREE_CLICK); } else if (actionEvent.getActionCommand().equals("Axis restricted")) { ! move.setMoveMode(MoveTool.AXIS_RESTRICTED); } else if (actionEvent.getActionCommand().equals("Free plane")) { ! move.setMoveMode(MoveTool.FREE_SNAP); } else if (actionEvent.getActionCommand().equals("Controlled")) { ! move.setMoveMode(MoveTool.CONTROLLED); } } |
From: Michael L. <he...@us...> - 2006-03-13 12:06:12
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8694/src/net/sourceforge/bprocessor/gui/actions Modified Files: ToolsDetachActionListener.java ToolsJoinActionListener.java Log Message: Removed a few warnings Index: ToolsDetachActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions/ToolsDetachActionListener.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ToolsDetachActionListener.java 12 Dec 2005 10:06:21 -0000 1.6 --- ToolsDetachActionListener.java 13 Mar 2006 12:06:00 -0000 1.7 *************** *** 144,148 **** frame.setSize(600, 400); ! frame.show(); } --- 144,148 ---- frame.setSize(600, 400); ! frame.setVisible(true); } Index: ToolsJoinActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions/ToolsJoinActionListener.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ToolsJoinActionListener.java 12 Dec 2005 10:06:21 -0000 1.6 --- ToolsJoinActionListener.java 13 Mar 2006 12:06:00 -0000 1.7 *************** *** 146,150 **** frame.setSize(600, 400); ! frame.show(); } --- 146,150 ---- frame.setSize(600, 400); ! frame.setVisible(true); } |
From: Nikolaj B. <nbr...@us...> - 2006-03-13 11:31:49
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25718/src/net/sourceforge/bprocessor/gui/attrview Modified Files: DescriptionAttribute.java StringAttribute.java GenericPanel.java Log Message: Made the description field scrollable, and a few minor fixes Index: StringAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/StringAttribute.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** StringAttribute.java 10 Mar 2006 14:10:30 -0000 1.8 --- StringAttribute.java 13 Mar 2006 11:31:45 -0000 1.9 *************** *** 59,62 **** --- 59,63 ---- label = createLabel(attribute.getName()); + Box header = Box.createHorizontalBox(); Box column = Box.createVerticalBox(); Index: GenericPanel.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/GenericPanel.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** GenericPanel.java 10 Mar 2006 14:10:30 -0000 1.13 --- GenericPanel.java 13 Mar 2006 11:31:45 -0000 1.14 *************** *** 27,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.Parametric; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Selection; - import net.sourceforge.bprocessor.model.Surface; /** --- 27,35 ---- *************** *** 112,116 **** } }); - //sa.addMouseListener(this); where.add(new AttributeRow(sa)); } else if (a.getValue() instanceof List) { --- 109,112 ---- *************** *** 144,151 **** } }); - //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,145 ---- } }); where.add(new AttributeRow(da)); ! } else if (a.getValue() instanceof Entity) { // Handles the links LinkAttribute la = new LinkAttribute(a); *************** *** 163,167 **** } }); - //da.addMouseListener(this); where.add(new AttributeRow(la)); } else if (a.getName().equals("Front Material") || a.getName().equals("Back Material")) { --- 157,160 ---- Index: DescriptionAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/DescriptionAttribute.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DescriptionAttribute.java 10 Mar 2006 14:10:30 -0000 1.3 --- DescriptionAttribute.java 13 Mar 2006 11:31:45 -0000 1.4 *************** *** 22,25 **** --- 22,26 ---- import javax.swing.JComponent; import javax.swing.JLabel; + import javax.swing.JScrollPane; import javax.swing.JTextArea; *************** *** 47,50 **** --- 48,54 ---- private JTextArea descriptionEditor; + /** The scrollpane for the description editor */ + private JScrollPane descriptionArea; + /** The defualt background color */ private Color bgcolor; *************** *** 73,77 **** 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())); --- 77,81 ---- column.add(header); column.add(Box.createRigidArea(new Dimension(70, 3))); ! column.setMaximumSize(new Dimension(2000, Short.MAX_VALUE)); component = Box.createVerticalBox(); component.add(createValueLabel(attribute.getValue())); *************** *** 149,152 **** --- 153,157 ---- valueLabel.setWrapStyleWord(true); valueLabel.setEditable(false); + valueLabel.setRows(10); if (attribute.isEditable()) { valueLabel.setFont(AttributeView.FONT_PLAIN); *************** *** 154,158 **** valueLabel.setFont(AttributeView.FONT_ITALIC); } ! return valueLabel; } --- 159,165 ---- valueLabel.setFont(AttributeView.FONT_ITALIC); } ! ! JScrollPane scrollArea = new JScrollPane (valueLabel); ! return scrollArea; } *************** *** 187,193 **** descriptionEditor = (JTextArea) createValueEditor(attribute.getValue()); descriptionEditor.setLineWrap(true); descriptionEditor.setWrapStyleWord(true); descriptionEditor.addFocusListener(this); ! component.add(descriptionEditor); component.revalidate(); } --- 194,202 ---- descriptionEditor = (JTextArea) createValueEditor(attribute.getValue()); descriptionEditor.setLineWrap(true); + descriptionEditor.setRows(10); descriptionEditor.setWrapStyleWord(true); descriptionEditor.addFocusListener(this); ! descriptionArea = new JScrollPane (descriptionEditor); ! component.add(descriptionArea); component.revalidate(); } *************** *** 205,209 **** Object val = attribute.getValue(); attribute.setValue(new Description(descriptionEditor.getText())); ! component.remove(descriptionEditor); descriptionEditor = null; component.add(createValueLabel(attribute.getValue())); --- 214,218 ---- Object val = attribute.getValue(); attribute.setValue(new Description(descriptionEditor.getText())); ! component.remove(descriptionArea); descriptionEditor = null; component.add(createValueLabel(attribute.getValue())); |
From: Michael L. <he...@us...> - 2006-03-12 21:10:40
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10095/src/net/sourceforge/bprocessor/gl/tool Modified Files: MoveTool.java MultiExtrudeTool.java Log Message: Some changes MoveTool and MultiExtrudeTool to move target without selection Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** MoveTool.java 12 Mar 2006 12:33:00 -0000 1.45 --- MoveTool.java 12 Mar 2006 21:10:29 -0000 1.46 *************** *** 131,135 **** */ protected void update() { ! Iterator iter = selection.iterator(); while (iter.hasNext()) { Object o = iter.next(); --- 131,135 ---- */ protected void update() { ! Iterator iter = moveEntities.iterator(); while (iter.hasNext()) { Object o = iter.next(); *************** *** 154,158 **** { clearConstructors(moveConstructors); ! if (target != null) { if (moveMode != THREE_CLICK) { initial = findInitial(target, e); --- 154,159 ---- { clearConstructors(moveConstructors); ! if (target != null) { ! moveEntities = new HashSet(); if (moveMode != THREE_CLICK) { initial = findInitial(target, e); *************** *** 164,177 **** vertices = new HashSet(); ! moveEntities = selection; if (moveMode == CONTROLLED) { ! if (!selection.isEmpty()) { ! Iterator it = selection.iterator(); controlled = (Entity)it.next(); } ! selection.clear(); ! selection.add(controlled); } ! collect(selection, vertices); } else { threeClickMove(e); --- 165,184 ---- vertices = new HashSet(); ! ! if (selection.isEmpty()) { ! moveEntities.add(target); ! } else { ! moveEntities.addAll(selection); ! } ! if (moveMode == CONTROLLED) { ! if (!moveEntities.isEmpty()) { ! Iterator it = moveEntities.iterator(); controlled = (Entity)it.next(); } ! moveEntities.clear(); ! moveEntities.add(controlled); } ! collect(moveEntities, vertices); } else { threeClickMove(e); *************** *** 186,190 **** private void threeClickMove(MouseEvent e) { vertices = new HashSet(); ! collect(selection, vertices); if (numberOfClicks == 1) { from = findInitial(target, e); --- 193,198 ---- private void threeClickMove(MouseEvent e) { vertices = new HashSet(); ! moveEntities.addAll(selection); ! collect(moveEntities, vertices); if (numberOfClicks == 1) { from = findInitial(target, e); *************** *** 195,199 **** } else if (numberOfClicks == 2) { Vertex movement = findInitial(target, e).minus(from); ! move(vertices, movement); glv.getView().removeTempEdge(threeClickConst); threeClickConst = null; --- 203,207 ---- } else if (numberOfClicks == 2) { Vertex movement = findInitial(target, e).minus(from); ! move(moveEntities, movement); glv.getView().removeTempEdge(threeClickConst); threeClickConst = null; *************** *** 274,277 **** --- 282,286 ---- protected void moved(MouseEvent e) { findTarget(e); + glv.getView().makeTarget(target); if (moveMode == THREE_CLICK && threeClickConst != null) { if (target != null) { Index: MultiExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MultiExtrudeTool.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** MultiExtrudeTool.java 12 Mar 2006 12:33:01 -0000 1.8 --- MultiExtrudeTool.java 12 Mar 2006 21:10:29 -0000 1.9 *************** *** 44,47 **** --- 44,50 ---- private Surface top, extrudeSurface; + /** The surfaces to extrude */ + private Set surfaces; + /** A vertex-direction map */ private Map v2dir; *************** *** 82,98 **** v2dir = null; elements = new HashSet(); if (target instanceof Surface) { ! extrudeSurface = (Surface)target; ! View view = glv.getView(); ! Transformation trans = view.transformation(); ! pressX = e.getX(); ! pressY = e.getY(); ! double x = pressX; ! double y = View.getHeight() - pressY; ! Vertex near = new Vertex(x, y, 0.0); ! Vertex far = new Vertex(x, y, 1.0); ! Edge ray = new Edge(near, far); ! ray = trans.unProject(ray); ! dragPlane = extrudeSurface.plane().orthogonalPlane(ray); } } --- 85,107 ---- v2dir = null; elements = new HashSet(); + surfaces = new HashSet(); + if (target instanceof Surface) { ! if (Selection.primary().isEmpty() || Selection.primary().contains(target)) { ! extrudeSurface = (Surface)target; ! surfaces.addAll(Selection.primary()); ! surfaces.add(extrudeSurface); ! View view = glv.getView(); ! Transformation trans = view.transformation(); ! pressX = e.getX(); ! pressY = e.getY(); ! double x = pressX; ! double y = View.getHeight() - pressY; ! Vertex near = new Vertex(x, y, 0.0); ! Vertex far = new Vertex(x, y, 1.0); ! Edge ray = new Edge(near, far); ! ray = trans.unProject(ray); ! dragPlane = extrudeSurface.plane().orthogonalPlane(ray); ! } } } *************** *** 145,149 **** if ((e.getX() - pressX) * (e.getX() - pressX) + (e.getY() - pressY) * (e.getY() - pressY) > 16) { ! elements = makeExtrusion(Selection.primary()); } } --- 154,158 ---- if ((e.getX() - pressX) * (e.getX() - pressX) + (e.getY() - pressY) * (e.getY() - pressY) > 16) { ! elements = makeExtrusion(surfaces); } } *************** *** 177,181 **** // we have to remove the extrusion and make a new one remove(elements); ! elements = makeExtrusion(Selection.primary()); direction = normDotDelta; if (v2dir != null) { --- 186,190 ---- // we have to remove the extrusion and make a new one remove(elements); ! elements = makeExtrusion(surfaces); direction = normDotDelta; if (v2dir != null) { *************** *** 237,241 **** holeAnalysis(current); } ! Selection.primary().addAll(tops); } } --- 246,250 ---- holeAnalysis(current); } ! // Selection.primary().addAll(tops); } } *************** *** 281,285 **** protected void moved(MouseEvent e) { findTarget(e); ! } } --- 290,298 ---- protected void moved(MouseEvent e) { findTarget(e); ! if (target instanceof Surface) { ! glv.getView().makeTarget(target); ! } else { ! glv.getView().makeTarget(null); ! } } } |
From: Michael L. <he...@us...> - 2006-03-12 12:33:17
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3275/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java MoveTool.java ExtrudeTool.java ToolFactory.java RotationTool.java MultiExtrudeTool.java SelectTool.java Log Message: All tools now inherit from AbstractTool instead of SelectTool Index: ExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrudeTool.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ExtrudeTool.java 28 Feb 2006 20:53:53 -0000 1.13 --- ExtrudeTool.java 12 Mar 2006 12:33:01 -0000 1.14 *************** *** 29,33 **** * The ExtrudeTool */ ! public class ExtrudeTool extends SelectTool { /** The dragSurface */ --- 29,33 ---- * The ExtrudeTool */ ! public class ExtrudeTool extends AbstractTool { /** The dragSurface */ *************** *** 92,101 **** prevY = e.getY(); number = new String(); ! if (directMode) { ! super.pressed(e); ! } ! if (e.isShiftDown() && !directMode) { ! super.pressed(e); ! } else if (!selection.isEmpty()) { Object object = selection.iterator().next(); if (object instanceof Surface) { --- 92,96 ---- prevY = e.getY(); number = new String(); ! if (!selection.isEmpty()) { Object object = selection.iterator().next(); if (object instanceof Surface) { *************** *** 221,227 **** */ protected void moved(MouseEvent e) { - if (e.isShiftDown() || directMode) { - super.moved(e); - } } --- 216,219 ---- *************** *** 231,238 **** */ protected void dragged(MouseEvent e) { - if (e.isShiftDown()) { - super.dragged(e); - return; - } if (extrudeSurface != null) { Vertex normal; --- 223,226 ---- *************** *** 271,277 **** */ protected void released(MouseEvent e) { - if (e.isShiftDown() && !directMode) { - super.released(e); - } if (Math.abs(t) < 0.0000001) { if (top != null) { --- 259,262 ---- Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** MoveTool.java 10 Mar 2006 16:41:25 -0000 1.44 --- MoveTool.java 12 Mar 2006 12:33:00 -0000 1.45 *************** *** 37,41 **** * The move tool */ ! public class MoveTool extends SelectTool { /** The logger */ --- 37,41 ---- * The move tool */ ! public class MoveTool extends AbstractTool { /** The logger */ *************** *** 152,161 **** protected void pressed(MouseEvent e) { findTarget(e); ! if (directMode) { ! super.pressed(e); ! } ! if (e.isShiftDown() && !directMode) { ! super.pressed(e); ! } else { clearConstructors(moveConstructors); if (target != null) { --- 152,156 ---- protected void pressed(MouseEvent e) { findTarget(e); ! { clearConstructors(moveConstructors); if (target != null) { *************** *** 263,267 **** */ protected void released(MouseEvent e) { ! super.released(e); clearConstructors(moveConstructors); moveConstructors = null; --- 258,262 ---- */ protected void released(MouseEvent e) { ! findTarget(e); clearConstructors(moveConstructors); moveConstructors = null; *************** *** 278,282 **** */ protected void moved(MouseEvent e) { ! super.moved(e); if (moveMode == THREE_CLICK && threeClickConst != null) { if (target != null) { --- 273,277 ---- */ protected void moved(MouseEvent e) { ! findTarget(e); if (moveMode == THREE_CLICK && threeClickConst != null) { if (target != null) { *************** *** 294,307 **** */ protected void dragged(MouseEvent e) { - //have to use getModifiersEx() getButton() gives wrong results - if ((e.getModifiersEx() & - MouseEvent.BUTTON3_DOWN_MASK) - == MouseEvent.BUTTON3_DOWN_MASK) { - return; - } - if (e.isShiftDown()) { - super.dragged(e); - return; - } findRestrictions(e); if (dragPlane != null && restrictionVector != null) { --- 289,292 ---- Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** ToolFactory.java 10 Mar 2006 16:41:25 -0000 1.32 --- ToolFactory.java 12 Mar 2006 12:33:01 -0000 1.33 *************** *** 50,54 **** /** extrusion tool */ ! private SelectTool extrusion; /** pencil tool */ --- 50,54 ---- /** extrusion tool */ ! private AbstractTool extrusion; /** pencil tool */ Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** SelectTool.java 28 Feb 2006 20:53:53 -0000 1.55 --- SelectTool.java 12 Mar 2006 12:33:01 -0000 1.56 *************** *** 16,29 **** import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Surface; - import net.sourceforge.bprocessor.model.Space; import java.awt.Cursor; - import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.KeyEvent; - import javax.swing.JPopupMenu; - import javax.swing.JMenuItem; - import java.util.ArrayList; import java.util.HashSet; --- 16,24 ---- *************** *** 52,55 **** --- 47,51 ---- private boolean multipleSelection = false; + /** * The constructor *************** *** 84,92 **** } ! /** ! * Invoked when the mouse is held pressed and moved ! * @param e The MouseEvent object */ ! protected void dragged(MouseEvent e) { if (multipleSelection) { Transformation t = glv.getView().transformation(); --- 80,125 ---- } ! ! /** ! * Handle a pressed event as selection tool ! * @param e MouseEvent */ ! protected void selectionPressed(MouseEvent e) { ! Transformation t = glv.getView().transformation(); ! first = t.unProject(new Vertex(e.getX(), View.getHeight() - e.getY(), 0.001)); ! e1.setFrom(first); ! e4.setTo(first); ! if (e.getClickCount() >= 2 && target instanceof Surface) { ! Surface surface = (Surface) target; ! if (surface.getBackDomain() != null) { ! selection.addAll(surface.getBackDomain().getEnvelope()); ! } ! if (surface.getFrontDomain() != null) { ! selection.addAll(surface.getFrontDomain().getEnvelope()); ! } ! } else { ! if (target == null) { ! selection.clear(); ! multipleSelection = true; ! } else if (e.isShiftDown()) { ! if (!selection.contains(target)) { ! selection.add(target); ! } else { ! selection.remove(target); ! } ! } else { ! if (!selection.contains(target)) { ! selection.clear(); ! selection.add(target); ! } ! } ! } ! } ! ! /** ! * Handle a dragged event as selection tool ! * @param e MouseEvent ! */ ! protected void selectionDragged(MouseEvent e) { if (multipleSelection) { Transformation t = glv.getView().transformation(); *************** *** 103,188 **** } } ! /** ! * Invoked when a mouse button has been pressed on a component. ! * @param e The MouseEvent object */ ! protected void pressed(MouseEvent e) { ! // for multiple selection ! Transformation t = glv.getView().transformation(); ! first = t.unProject(new Vertex(e.getX(), View.getHeight() - e.getY(), 0.001)); ! e1.setFrom(first); ! e4.setTo(first); ! if (e.getButton() == MouseEvent.BUTTON3) { ! if (target != null) { ! if (target instanceof String) { ! JPopupMenu toolsmenu = toolsmenu((String) target); ! glv.popup(toolsmenu, e.getX(), e.getY()); ! } ! } } - if (e.getButton() == MouseEvent.BUTTON1) { - if (e.getClickCount() >= 2 && target instanceof Surface) { - Surface surface = (Surface) target; - if (surface.getBackDomain() != null) { - selection.addAll(surface.getBackDomain().getEnvelope()); - } - if (surface.getFrontDomain() != null) { - selection.addAll(surface.getFrontDomain().getEnvelope()); - } - } else { - if (target == null) { - selection.clear(); - multipleSelection = true; - } else if (e.isShiftDown()) { - if (!selection.contains(target)) { - selection.add(target); - } else { - selection.remove(target); - } - } else { - if (!selection.contains(target)) { - selection.clear(); - selection.add(target); - } - } - } - } } - /** ! * Create the toolsmenu ! * @param name Space name ! * @return The toolsmenu */ ! private JPopupMenu toolsmenu(String name) { ! JPopupMenu menu = new JPopupMenu("Tools"); ! Space space = null; ! Surface surface = null; ! Iterator iter = selection.iterator(); ! while (iter.hasNext()) { ! Object current = iter.next(); ! if (current instanceof Surface) { ! surface = (Surface) current; ! break; ! } ! } ! if (surface != null) { ! if (name.equals("back")) { ! space = (Space) surface.getBackDomain(); ! } ! if (name.equals("front")) { ! space = (Space) surface.getFrontDomain(); ! } ! } ! if (space != null) { ! ActionListener listener = new CatmullClarkActionListener(space); ! JMenuItem catmullClarkItem = new JMenuItem("Catmull-Clark"); ! catmullClarkItem.addActionListener(listener); ! menu.add(catmullClarkItem); } ! return menu; } --- 136,173 ---- } } ! /** ! * Handle a released event as selection tool ! * @param e MouseEvent */ ! protected void selectionReleased(MouseEvent e) { ! if (multipleSelection) { ! selection.clear(); ! clearConstructors(box); ! List l = glv.getView().getObjectInArea(pressPos[0], pressPos[1], ! e.getX(), e.getY()); ! glv.getView().makeTarget(null); ! selection.addAll(l); ! multipleSelection = false; } } /** ! * Invoked when a mouse button has been pressed on a component. ! * @param e The MouseEvent object */ ! protected void pressed(MouseEvent e) { ! if (e.getButton() == MouseEvent.BUTTON1) { ! selectionPressed(e); } ! } ! ! /** ! * Invoked when the mouse is held pressed and moved ! * @param e The MouseEvent object ! */ ! protected void dragged(MouseEvent e) { ! selectionDragged(e); } *************** *** 192,205 **** */ protected void released(MouseEvent e) { ! if (multipleSelection) { ! selection.clear(); ! clearConstructors(box); ! List l = glv.getView().getObjectInArea(pressPos[0], pressPos[1], ! e.getX(), e.getY()); ! glv.getView().makeTarget(null); ! selection.addAll(l); ! multipleSelection = false; ! } ! } /** --- 177,182 ---- */ protected void released(MouseEvent e) { ! selectionReleased(e); ! } /** Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** AbstractTool.java 7 Mar 2006 22:31:03 -0000 1.61 --- AbstractTool.java 12 Mar 2006 12:33:00 -0000 1.62 *************** *** 252,279 **** if ((e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) == MouseEvent.BUTTON2_DOWN_MASK || e.getButton() == MouseEvent.BUTTON2) { ! View view = glv.getView(); ! Camera c = Project.getInstance().getCurrentCamera(); ! double[] center = c.getCenter(); ! double[] camera = c.getCamera(); ! double dx = camera[0] - center[0]; ! double dy = camera[1] - center[1]; ! double dz = camera[2] - center[2]; ! double sqr = Math.sqrt(dx * dx + dy * dy + dz * dz); ! if (sqr < 1) { ! dx *= 1 / sqr; ! dy *= 1 / sqr; ! dz *= 1 / sqr; ! } ! double d = -dx * center[0] - dy * center[1] - dz * center[2]; ! Vertex first = view.toPlaneCoords(new double[] {previousPos[0], ! previousPos[1]}, ! new Plane(dx, dy, dz, d)); ! Vertex second = view.toPlaneCoords(new double[] {e.getX(), ! e.getY()}, ! new Plane(dx, dy, dz, d)); ! c.translate(new double[] {first.getX() - second.getX(), ! first.getY() - second.getY(), ! first.getZ() - second.getZ()}); ! Project.getInstance().changed(c); } else { dragged(e); --- 252,256 ---- if ((e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) == MouseEvent.BUTTON2_DOWN_MASK || e.getButton() == MouseEvent.BUTTON2) { ! panDragged(e); } else { dragged(e); *************** *** 337,341 **** if ((e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) == MouseEvent.BUTTON2_DOWN_MASK || e.getButton() == MouseEvent.BUTTON2) { ! glv.setCursor(dragCursor); } else { pressed(e); --- 314,318 ---- if ((e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) == MouseEvent.BUTTON2_DOWN_MASK || e.getButton() == MouseEvent.BUTTON2) { ! panPressed(e); } else { pressed(e); *************** *** 351,355 **** if ((e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) == MouseEvent.BUTTON2_DOWN_MASK || e.getButton() == MouseEvent.BUTTON2) { ! glv.setCursor(cursor); } else { released(e); --- 328,332 ---- if ((e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) == MouseEvent.BUTTON2_DOWN_MASK || e.getButton() == MouseEvent.BUTTON2) { ! panReleased(e); } else { released(e); *************** *** 358,361 **** --- 335,386 ---- } + + /** + * Handle pressed event as pan tool + * @param e MouseEvent + */ + protected void panPressed(MouseEvent e) { + glv.setCursor(dragCursor); + } + + /** + * Handle dragged event as pan tool + * @param e MouseEvent + */ + protected void panDragged(MouseEvent e) { + View view = glv.getView(); + Camera c = Project.getInstance().getCurrentCamera(); + double[] center = c.getCenter(); + double[] camera = c.getCamera(); + double dx = camera[0] - center[0]; + double dy = camera[1] - center[1]; + double dz = camera[2] - center[2]; + double sqr = Math.sqrt(dx * dx + dy * dy + dz * dz); + if (sqr < 1) { + dx *= 1 / sqr; + dy *= 1 / sqr; + dz *= 1 / sqr; + } + double d = -dx * center[0] - dy * center[1] - dz * center[2]; + Vertex first = view.toPlaneCoords(new double[] {previousPos[0], + previousPos[1]}, + new Plane(dx, dy, dz, d)); + Vertex second = view.toPlaneCoords(new double[] {e.getX(), + e.getY()}, + new Plane(dx, dy, dz, d)); + c.translate(new double[] {first.getX() - second.getX(), + first.getY() - second.getY(), + first.getZ() - second.getZ()}); + Project.getInstance().changed(c); + } + + /** + * Handle released event as pan tool + * @param e MouseEvent + */ + protected void panReleased(MouseEvent e) { + glv.setCursor(cursor); + } + /** * Make and register a new vertex *************** *** 557,566 **** protected abstract void moved(MouseEvent e); - /** - * Invoked when the mouse is held pressed and moved - * @param e The MouseEvent object - */ - protected abstract void dragged(MouseEvent e); - /** * Invoked when a mouse button has been pressed on a component. --- 582,585 ---- *************** *** 569,572 **** --- 588,597 ---- protected abstract void pressed(MouseEvent e); + /** + * Invoked when the mouse is held pressed and moved + * @param e The MouseEvent object + */ + protected abstract void dragged(MouseEvent e); + /** * Invoked when a mouse button has been released on a component. Index: RotationTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/RotationTool.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** RotationTool.java 17 Feb 2006 09:56:06 -0000 1.12 --- RotationTool.java 12 Mar 2006 12:33:01 -0000 1.13 *************** *** 34,38 **** * The rotation tool */ ! public class RotationTool extends SelectTool { /** */ private static final int X_AXIS = 1; --- 34,38 ---- * The rotation tool */ ! public class RotationTool extends AbstractTool { /** */ private static final int X_AXIS = 1; *************** *** 86,92 **** */ protected void pressed(MouseEvent e) { ! if (e.isShiftDown()) { ! super.pressed(e); ! } else { if (target != null && target instanceof Entity) { // If one edge in a rotate circle are selected all should be --- 86,90 ---- */ protected void pressed(MouseEvent e) { ! { if (target != null && target instanceof Entity) { // If one edge in a rotate circle are selected all should be *************** *** 131,135 **** */ protected void released(MouseEvent e) { ! super.released(e); if (axis != 0) { rotate(from, initial, this.center); --- 129,133 ---- */ protected void released(MouseEvent e) { ! findTarget(e); if (axis != 0) { rotate(from, initial, this.center); *************** *** 173,179 **** */ protected void dragged(MouseEvent e) { ! if (e.isShiftDown()) { ! super.dragged(e); ! } else { if (target != null && (xCircle.contains(target) || yCircle.contains(target) || zCircle.contains(target))) { --- 171,175 ---- */ protected void dragged(MouseEvent e) { ! { if (target != null && (xCircle.contains(target) || yCircle.contains(target) || zCircle.contains(target))) { *************** *** 375,377 **** --- 371,379 ---- return null; } + + /** + * @param e MouseEvent + */ + protected void moved(MouseEvent e) { + } } Index: MultiExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MultiExtrudeTool.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** MultiExtrudeTool.java 10 Mar 2006 16:41:25 -0000 1.7 --- MultiExtrudeTool.java 12 Mar 2006 12:33:01 -0000 1.8 *************** *** 34,38 **** * The ExtrudeTool */ ! public class MultiExtrudeTool extends SelectTool { /** The logger */ private static Logger log = Logger.getLogger(MultiExtrudeTool.class); --- 34,38 ---- * The ExtrudeTool */ ! public class MultiExtrudeTool extends AbstractTool { /** The logger */ private static Logger log = Logger.getLogger(MultiExtrudeTool.class); *************** *** 76,79 **** --- 76,80 ---- */ protected void pressed(MouseEvent e) { + findTarget(e); extrudeSurface = null; top = null; *************** *** 81,91 **** 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; --- 82,85 ---- *************** *** 233,237 **** */ protected void released(MouseEvent e) { ! super.released(e); if (top != null && Math.abs(t) < 0.1) { remove(elements); --- 227,231 ---- */ protected void released(MouseEvent e) { ! findTarget(e); if (top != null && Math.abs(t) < 0.1) { remove(elements); *************** *** 281,283 **** --- 275,285 ---- return elements; } + + /** + * @param e MouseEvent + */ + protected void moved(MouseEvent e) { + findTarget(e); + + } } |
From: Michael L. <he...@us...> - 2006-03-10 16:41:40
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10371/src/net/sourceforge/bprocessor/model Modified Files: Surface.java LayerModellor.java Log Message: MultiExtrusionTool now used Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** Surface.java 8 Mar 2006 14:22:51 -0000 1.80 --- Surface.java 10 Mar 2006 16:41:37 -0000 1.81 *************** *** 761,771 **** double d = 0; Vertex n = normal(); ! double a = n.getX(); ! double b = n.getY(); ! double c = n.getZ(); ! Edge e1 = (Edge) edges.get(0); ! Vertex v1 = e1.getFrom(); ! d = -(a * v1.getX() + b * v1.getY() + c * v1.getZ()); ! return new Plane(a, b, c, d); } --- 761,775 ---- double d = 0; Vertex n = normal(); ! if (n != null) { ! double a = n.getX(); ! double b = n.getY(); ! double c = n.getZ(); ! Edge e1 = (Edge) edges.get(0); ! Vertex v1 = e1.getFrom(); ! d = -(a * v1.getX() + b * v1.getY() + c * v1.getZ()); ! return new Plane(a, b, c, d); ! } else { ! return null; ! } } Index: LayerModellor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/LayerModellor.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** LayerModellor.java 13 Feb 2006 21:16:47 -0000 1.4 --- LayerModellor.java 10 Mar 2006 16:41:37 -0000 1.5 *************** *** 45,54 **** public void update(Object entity) { Mesh interior = new Mesh(); ! Set sides = new HashSet(); Surface bottom = surface.copy(interior); if (surface.getBackDomain() == space) { bottom.flip(); } ! Surface top = bottom.extrude(distance, sides); space.setInterior(interior); } --- 45,60 ---- public void update(Object entity) { Mesh interior = new Mesh(); ! Surface bottom = surface.copy(interior); if (surface.getBackDomain() == space) { bottom.flip(); } ! ! for (int i = 0; i < 3; i++) { ! Set sides = new HashSet(); ! bottom = bottom.extrude(distance, sides); ! bottom.flip(); ! } ! space.setInterior(interior); } |
From: Michael L. <he...@us...> - 2006-03-10 16:41:40
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10371/src/net/sourceforge/bprocessor/model/xml Modified Files: PersistenceManager.java Log Message: MultiExtrusionTool now used Index: PersistenceManager.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml/PersistenceManager.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** PersistenceManager.java 28 Feb 2006 02:26:25 -0000 1.25 --- PersistenceManager.java 10 Mar 2006 16:41:37 -0000 1.26 *************** *** 414,418 **** csx.setId(counter++); csx.setName(cs.getName()); ! //csx.setDescription(cs.getDescription()); Map csm = (Map)mapper.get(KEY_DOMAIN); --- 414,418 ---- csx.setId(counter++); csx.setName(cs.getName()); ! csx.setDescription(cs.getDescription().toString()); Map csm = (Map)mapper.get(KEY_DOMAIN); *************** *** 436,440 **** fsx.setId(counter++); fsx.setName(fs.getName()); ! //fsx.setDescription(fs.getDescription()); Map fsm = (Map)mapper.get(KEY_DOMAIN); --- 436,440 ---- fsx.setId(counter++); fsx.setName(fs.getName()); ! fsx.setDescription(fs.getDescription().toString()); Map fsm = (Map)mapper.get(KEY_DOMAIN); |
From: Michael L. <he...@us...> - 2006-03-10 16:41:39
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10207/src/net/sourceforge/bprocessor/gl/tool Modified Files: PencilTool.java MoveTool.java ToolFactory.java TapeMeasureTool.java MultiExtrudeTool.java Log Message: MultiExtrusionTool now used Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** MoveTool.java 7 Mar 2006 22:31:04 -0000 1.43 --- MoveTool.java 10 Mar 2006 16:41:25 -0000 1.44 *************** *** 175,179 **** controlled = (Entity)it.next(); } ! selection = new HashSet(); selection.add(controlled); } --- 175,179 ---- controlled = (Entity)it.next(); } ! selection.clear(); selection.add(controlled); } *************** *** 373,377 **** delta = restrictCopy; } else if (moveMode == FREE_SNAP) { ! Object o = glv.getView().getObjectAtPoint(e.getX(), e.getY(), moveEntities, false); if (o != null) { snapEntity = (Entity)o; --- 373,378 ---- delta = restrictCopy; } else if (moveMode == FREE_SNAP) { ! Object o = glv.getView().getObjectAtPoint(e.getX(), e.getY(), moveEntities, ! false, new Plane(0, 0, 1, 0)); if (o != null) { snapEntity = (Entity)o; Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** ToolFactory.java 15 Feb 2006 11:27:48 -0000 1.31 --- ToolFactory.java 10 Mar 2006 16:41:25 -0000 1.32 *************** *** 184,188 **** move = new MoveTool(glv, pencilcursor); rotation = new RotationTool(glv, pencilcursor); ! extrusion = new ExtrudeTool(glv, pencilcursor); clipplane = new ClipplaneTool(glv, pencilcursor); tapeMeasure = new TapeMeasureTool(glv, pencilcursor); --- 184,188 ---- move = new MoveTool(glv, pencilcursor); rotation = new RotationTool(glv, pencilcursor); ! extrusion = new MultiExtrudeTool(glv, pencilcursor); clipplane = new ClipplaneTool(glv, pencilcursor); tapeMeasure = new TapeMeasureTool(glv, pencilcursor); Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** PencilTool.java 7 Mar 2006 22:31:04 -0000 1.62 --- PencilTool.java 10 Mar 2006 16:41:25 -0000 1.63 *************** *** 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); } --- 94,128 ---- int y = event.getY(); View view = glv.getView(); ! Intersection intersection ! = (Intersection) view.getObjectAtPoint(x, y, new HashSet(), true, new Plane(0, 0, 1, 0)); ! if (intersection != null) { ! 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); } } Index: TapeMeasureTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/TapeMeasureTool.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** TapeMeasureTool.java 1 Mar 2006 11:16:17 -0000 1.10 --- TapeMeasureTool.java 10 Mar 2006 16:41:25 -0000 1.11 *************** *** 191,196 **** if (target instanceof Edge) { currentEdge = (Edge)target; ! angling = true; ! measuring = false; 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: MultiExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MultiExtrudeTool.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** MultiExtrudeTool.java 7 Mar 2006 16:45:20 -0000 1.6 --- MultiExtrudeTool.java 10 Mar 2006 16:41:25 -0000 1.7 *************** *** 20,23 **** --- 20,24 ---- import net.sourceforge.bprocessor.gl.GLView; + import net.sourceforge.bprocessor.gl.model.Intersection; import net.sourceforge.bprocessor.gl.view.Transformation; import net.sourceforge.bprocessor.gl.view.View; *************** *** 37,40 **** --- 38,44 ---- private static Logger log = Logger.getLogger(MultiExtrudeTool.class); + /** Point based snapping? */ + private static final boolean SNAPPING = false; + /** The dragSurface and extrudesurface */ private Surface top, extrudeSurface; *************** *** 115,121 **** View view = glv.getView(); Vertex from = view.toPlaneCoords(new double[] {pressX, pressY}, dragPlane); ! Vertex to = view.toPlaneCoords(new double[] {e.getX(), e.getY()}, dragPlane); Vertex delta = to.minus(from); double normDotDelta = normal.dot(delta); if (direction == 0) { //we have never set the direction; --- 119,146 ---- View view = glv.getView(); Vertex from = view.toPlaneCoords(new double[] {pressX, pressY}, dragPlane); ! Vertex to; ! if (SNAPPING) { ! Set ignore = new HashSet(); ! if (elements != null) { ! ignore.addAll(elements); ! } ! ignore.add(extrudeSurface); ! ignore.addAll(extrudeSurface.getEdges()); ! Intersection intersection = ! (Intersection) view.getObjectAtPoint(e.getX(), e.getY(), ignore, true, dragPlane); ! if (intersection == null || intersection.type() == Intersection.SURFACE) { ! to = view.toPlaneCoords(new double[] {e.getX(), e.getY()}, dragPlane); ! } else { ! to = intersection.vertex(); ! } ! } else { ! to = view.toPlaneCoords(new double[] {e.getX(), e.getY()}, dragPlane); ! } Vertex delta = to.minus(from); double normDotDelta = normal.dot(delta); + if (Math.abs(normDotDelta) < 0.000001) { + normDotDelta = 0; + } + if (direction == 0) { //we have never set the direction; *************** *** 129,133 **** } } ! if (v2dir != null) { // The extrusion were succesfull move it // Find the move direction --- 154,158 ---- } } ! if (!SNAPPING && v2dir != null) { // The extrusion were succesfull move it // Find the move direction *************** *** 253,256 **** --- 278,282 ---- elements.add(s); } + t = 0; return elements; } |
From: Michael L. <he...@us...> - 2006-03-10 16:41:36
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10320/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java Log Message: MultiExtrusionTool now used Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** GenericTreeView.java 1 Mar 2006 11:58:02 -0000 1.17 --- GenericTreeView.java 10 Mar 2006 16:41:31 -0000 1.18 *************** *** 530,541 **** public JPopupMenu menu() { JPopupMenu menu = new JPopupMenu(); ! JMenuItem offsetItem = new JMenuItem("Details"); ! offsetItem.addActionListener(new MenuAction() { ! public void actionPerformed(ActionEvent event) { ! Project.getInstance().setActiveSpace(space); } ! } ! ); ! menu.add(offsetItem); return menu; } --- 530,553 ---- public JPopupMenu menu() { JPopupMenu menu = new JPopupMenu(); ! if (Project.getInstance().getActiveSpace() == space) { ! JMenuItem offsetItem = new JMenuItem("Finish Edit"); ! offsetItem.addActionListener(new MenuAction() { ! public void actionPerformed(ActionEvent event) { ! Project.getInstance().setActiveSpace(null); ! } } ! ); ! menu.add(offsetItem); ! } else { ! JMenuItem offsetItem = new JMenuItem("Edit"); ! offsetItem.addActionListener(new MenuAction() { ! public void actionPerformed(ActionEvent event) { ! Project.getInstance().setActiveSpace(space); ! } ! } ! ); ! menu.add(offsetItem); ! } ! return menu; } |