bprocessor-commit Mailing List for B-processor (Page 132)
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-02-28 20:53:55
|
Update of /cvsroot/bprocessor/build/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3764/doc Modified Files: README Changelog Log Message: Minor tweaks before release. Some tools have temporarily been simplified: - Move/Extrusion: Objects are selected automatically when applying the tool - Tape-measure: The angle step have been turned off Index: README =================================================================== RCS file: /cvsroot/bprocessor/build/doc/README,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** README 29 Dec 2005 14:16:30 -0000 1.10 --- README 28 Feb 2006 20:53:46 -0000 1.11 *************** *** 18,30 **** ----- - F1 : Rotate the 3D view to default location - F2 : Rotate the view to XZ view - F3 : Rotate the view to XY view - F4 : Rotate the view to YZ view - - F5 : Wireframe - F6 : Solid - F7 : Lighting - Q : Select W : Pencil --- 18,21 ---- *************** *** 47,55 **** DELETE OR BACKSPACE : Delete the selected object. ! ESCAPE : undo most of the operations (Move and Draw) ! ! <-- MOVE TOOL --> ! A : movement in the plane of the surface (or XY plane if it is a vertex or edge) ! S : movement perpendicular on the A plane and viewingangle. <-- PENCIL TOOL --> --- 38,42 ---- DELETE OR BACKSPACE : Delete the selected object. ! ESCAPE : cancel most of the operations (Move and Draw) <-- PENCIL TOOL --> Index: Changelog =================================================================== RCS file: /cvsroot/bprocessor/build/doc/Changelog,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Changelog 22 Dec 2005 11:34:31 -0000 1.7 --- Changelog 28 Feb 2006 20:53:46 -0000 1.8 *************** *** 2,6 **** --- 2,23 ---- ========== + 2006/2/28: Release M4 + Model: + - Space contains elements that contains parts + - Constraint mechanism implemented + - Modellor mechanism implemented + - Parametric interface for displaying objects + in attribute-view + + Tools: + - Many minor improvements of geometric tools + - Move tool reworked completely + - Rotation tool implemented + - Eraser tool implemented + + Attribute View + - Layout of Attribute View reworked + 2005/12/22: Release M3 |
From: Michael L. <he...@us...> - 2006-02-28 20:53:52
|
Update of /cvsroot/bprocessor/build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3764 Modified Files: build.xml Log Message: Minor tweaks before release. Some tools have temporarily been simplified: - Move/Extrusion: Objects are selected automatically when applying the tool - Tape-measure: The angle step have been turned off Index: build.xml =================================================================== RCS file: /cvsroot/bprocessor/build/build.xml,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** build.xml 6 Feb 2006 10:58:07 -0000 1.12 --- build.xml 28 Feb 2006 20:53:46 -0000 1.13 *************** *** 3,7 **** <target name="init"> <property name="project" value="bprocessor"/> ! <property name="version" value="M3a-development"/> <property name="script.dir" value="${basedir}/bin"/> --- 3,7 ---- <target name="init"> <property name="project" value="bprocessor"/> ! <property name="version" value="M4"/> <property name="script.dir" value="${basedir}/bin"/> |
From: Nikolaj B. <nbr...@us...> - 2006-02-28 13:25:13
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3136/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Log Message: Added space names to surfaces in attribute view Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** Surface.java 28 Feb 2006 02:26:25 -0000 1.75 --- Surface.java 28 Feb 2006 13:25:04 -0000 1.76 *************** *** 938,941 **** --- 938,943 ---- } else if (a.getName().equals("Holes")) { continue; + } else if (a.getName().equals("Space")) { + continue; } else { log.error("Wrong attribute for the object " + a); *************** *** 951,954 **** --- 953,966 ---- ArrayList res = new ArrayList(); res.add(new Attribute("Name", getName(), false)); + if (getFrontDomain() != null) { + res.add(new Attribute("Space", getFrontDomain().getName(), false)); + } else { + res.add(new Attribute("Space", "None", false)); + } + if (getBackDomain() != null) { + res.add(new Attribute("Space", getBackDomain().getName(), false)); + } else { + res.add(new Attribute("Space", "None", false)); + } if (isInner()) { res.add(new Attribute("Exterior", getExterior(), false)); |
From: Nikolaj B. <nbr...@us...> - 2006-02-28 02:32:45
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16886/src/net/sourceforge/bprocessor/gui/attrview Modified Files: AttributePanel.java StringAttribute.java GenericPanel.java Added Files: DescriptionAttribute.java LinkAttribute.java Log Message: All that is displayed in the attribute view should now be parametric Index: StringAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/StringAttribute.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** StringAttribute.java 15 Feb 2006 11:12:51 -0000 1.6 --- StringAttribute.java 28 Feb 2006 02:25:48 -0000 1.7 *************** *** 45,48 **** --- 45,51 ---- private JTextField editor; + + + /** * Constructor for StringAttribute *************** *** 72,79 **** this.add(component); this.add(Box.createHorizontalGlue()); - if (attribute.isEditable()) { - label.addMouseListener(this); - component.addMouseListener(this); - } } --- 75,78 ---- *************** *** 156,160 **** double rounded = round(((Double) value).doubleValue()); s = Double.toString(rounded); ! } JLabel valueLabel = new JLabel(s); if (attribute.isEditable()) { --- 155,160 ---- double rounded = round(((Double) value).doubleValue()); s = Double.toString(rounded); ! } ! JLabel valueLabel = new JLabel(s); if (attribute.isEditable()) { *************** *** 163,167 **** valueLabel.setFont(AttributeView.FONT_ITALIC); } ! return valueLabel; } --- 163,167 ---- valueLabel.setFont(AttributeView.FONT_ITALIC); } ! return valueLabel; } *************** *** 178,182 **** double rounded = round(((Double) value).doubleValue()); s = Double.toString(rounded); ! } JTextField valueEditor = new JTextField(s); valueEditor.setFont(AttributeView.FONT_PLAIN); --- 178,182 ---- double rounded = round(((Double) value).doubleValue()); s = Double.toString(rounded); ! } JTextField valueEditor = new JTextField(s); valueEditor.setFont(AttributeView.FONT_PLAIN); Index: GenericPanel.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/GenericPanel.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GenericPanel.java 15 Feb 2006 11:12:51 -0000 1.7 --- GenericPanel.java 28 Feb 2006 02:25:49 -0000 1.8 *************** *** 26,32 **** --- 26,35 ---- import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Camera; + import net.sourceforge.bprocessor.model.Description; import net.sourceforge.bprocessor.model.Entity; import net.sourceforge.bprocessor.model.Parametric; import net.sourceforge.bprocessor.model.Project; + import net.sourceforge.bprocessor.model.Selection; + import net.sourceforge.bprocessor.model.Surface; /** *************** *** 49,52 **** --- 52,59 ---- private GenericAttribute current; + + /** The kludge */ + protected boolean simpleUpdate = false; + /** * The constructor *************** *** 90,93 **** --- 97,101 ---- obj.setAttributes(attributes); if (obj instanceof Entity) { + simpleUpdate = true; ((Entity)obj).changed(); } else if (obj instanceof Camera) { *************** *** 96,102 **** log.info("Were not a Entity object " + obj); } ! } }); ! sa.addMouseListener(this); where.add(new AttributeRow(sa)); } else if (a.getValue() instanceof List) { --- 104,110 ---- log.info("Were not a Entity object " + obj); } ! } }); ! //sa.addMouseListener(this); where.add(new AttributeRow(sa)); } else if (a.getValue() instanceof List) { *************** *** 114,118 **** } where.add(more); ! } else { log.info("[GenericPanel] Something were not implemented"); } --- 122,162 ---- } where.add(more); ! } else if (a.getValue() instanceof Description) { ! // Handles the description field ! DescriptionAttribute da = new DescriptionAttribute(a); ! da.addDescriptionAttributeListener(new AttributeListener() { ! public void valueChanged(Attribute a) { ! obj.setAttributes(attributes); ! if (obj instanceof Entity) { ! simpleUpdate = true; ! ((Entity)obj).changed(); ! } else if (obj instanceof Camera) { ! Project.getInstance().changed((Camera)obj); ! } else { ! log.info("Were not a Entity object " + obj); ! } ! } ! }); ! //da.addMouseListener(this); ! where.add(new AttributeRow(da)); ! } else if (a.getValue() instanceof Surface) { ! // Handles the description field ! LinkAttribute la = new LinkAttribute(a); ! la.addLinkAttributeListener(new AttributeListener() { ! public void valueChanged(Attribute a) { ! obj.setAttributes(attributes); ! if (obj instanceof Entity) { ! simpleUpdate = true; ! ((Entity)obj).changed(); ! } else if (obj instanceof Camera) { ! Project.getInstance().changed((Camera)obj); ! } else { ! log.info("Were not a Entity object " + obj); ! } ! } ! }); ! //da.addMouseListener(this); ! where.add(new AttributeRow(la)); ! } else { log.info("[GenericPanel] Something were not implemented"); } *************** *** 126,135 **** */ public void startEditing(GenericAttribute ga) { ! if (current != null) { ! current.stopEditing(); ! } current = ga; ! if (current != null) { ! ga.startEditing(); } } --- 170,182 ---- */ public void startEditing(GenericAttribute ga) { ! stopEditing(); current = ga; ! if (ga instanceof LinkAttribute) { ! Selection.primary().set(ga.attribute().getValue()); ! //Selection.primary().changed(); ! } else { ! if (current != null) { ! current.startEditing(); ! } } } *************** *** 189,193 **** this.ga = ga; this.add(ga); ! ga.addMouseListener(this); } --- 236,242 ---- this.ga = ga; this.add(ga); ! if (ga.attribute().isEditable() || ga instanceof LinkAttribute) { ! ga.addMouseListener(this); ! } } *************** *** 234,241 **** */ public void update() { //FIXME need to delay call to a reasonable time content.removeAll(); ! generateContent(obj.getAttributes(), content); revalidate(); } } --- 283,309 ---- */ public void update() { + if (simpleUpdate) { + simpleUpdate(); + simpleUpdate = false; + } else { + complexUpdate(); + } + } + /** + * + * + */ + public void complexUpdate() { //FIXME need to delay call to a reasonable time content.removeAll(); ! attributes = obj.getAttributes(); ! generateContent(attributes, content); revalidate(); } + + /** + * + * + */ + public void simpleUpdate() { } } Index: AttributePanel.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/AttributePanel.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AttributePanel.java 9 Feb 2006 13:55:12 -0000 1.5 --- AttributePanel.java 28 Feb 2006 02:25:48 -0000 1.6 *************** *** 97,101 **** nameEdit.addKeyListener(new MyKeyListener(o, TFIELD)); ! JTextArea descriptionEditor = new JTextArea(o.getDescription()); descriptionEditor.setLineWrap(true); descriptionEditor.setWrapStyleWord(true); --- 97,101 ---- nameEdit.addKeyListener(new MyKeyListener(o, TFIELD)); ! JTextArea descriptionEditor = new JTextArea(o.getDescription().toString()); descriptionEditor.setLineWrap(true); descriptionEditor.setWrapStyleWord(true); --- NEW FILE: LinkAttribute.java --- //--------------------------------------------------------------------------------- // $Id: LinkAttribute.java,v 1.1 2006/02/28 02:25:49 nbramsen Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui.attrview; import java.awt.Dimension; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JTextField; import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Surface; /** * The StringAttributeView */ 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 StringAttribute * @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.createHorizontalGlue()); header.add(label); //column.add(Box.createHorizontalStrut(60)); column.add(Box.createRigidArea(new Dimension(70, 3))); column.add(header); column.add(Box.createRigidArea(new Dimension(70, 3))); //column.add(Box.createHorizontalStrut(60)); column.setMaximumSize(new Dimension(60, Short.MAX_VALUE)); this.add(column); this.add(Box.createHorizontalStrut(7)); component = Box.createHorizontalBox(); component.add(createValueLabel(attribute.getValue())); this.add(component); this.add(Box.createHorizontalGlue()); } /** * Create a label for the * @param key The key * @return A JLabel */ private JLabel createLabel(String key) { JLabel keyLabel = new JLabel(key + " :"); keyLabel.setFont(AttributeView.FONT_BOLD); return keyLabel; } /** * Add a mouselisterner to the active elements in the StringAttribute * @param mouseListener the mouselistener */ public void addMouseListener(MouseListener mouseListener) { label.addMouseListener(mouseListener); component.addMouseListener(mouseListener); } /** * Remove a mouselisterner to the active elements in the StringAttribute * @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 = ((Surface)value).getName(); JLabel valueLabel = new JLabel(s); if (attribute.isEditable()) { valueLabel.setFont(AttributeView.FONT_PLAIN); } else { valueLabel.setFont(AttributeView.FONT_ITALIC); } return valueLabel; } /** * Create a value editor * @param value The value * @return The editor */ private JComponent createValueEditor(Object value) { String s = ""; if (value instanceof String) { s = (String)value; } JTextField valueEditor = new JTextField(s); valueEditor.setFont(AttributeView.FONT_PLAIN); return valueEditor; } /** * Return the attribute * @return The attribute */ public Attribute attribute() { return attribute; } /** * Start editing the value by replacing the label with an editor */ public void startEditing() { if (attribute.isEditable()) { if (editor == null) { component.remove(0); editor = (JTextField) createValueEditor(attribute.getValue()); component.add(editor); component.revalidate(); } editor.requestFocus(); editor.selectAll(); } } /** * Stop editing the value by replacing the editor with an label, * and sending valueChanged to all listeners. */ public void stopEditing() { if (editor != null && attribute.isEditable()) { Object val = attribute.getValue(); if (val instanceof String) { attribute.setValue(editor.getText()); } component.remove(editor); editor = null; component.add(createValueLabel(attribute.getValue())); component.revalidate(); valueChanged(); } } /** * Cancels editing the value by replacing the editor with an label, * without sending any events to listeners. */ public void cancelEditing() { if (editor != null) { component.remove(editor); editor = null; component.add(createValueLabel(attribute.getValue())); component.revalidate(); } } /** * Start editing on the view * @param event The event */ public void mouseClicked(MouseEvent event) { } /** * Not in use * @param event The MouseEvent */ public void mousePressed(MouseEvent event) { } /** * Not in use * @param event The MouseEvent */ public void mouseReleased(MouseEvent event) { } /** * Not in use * @param event The MouseEvent */ public void mouseEntered(MouseEvent event) { } /** * Not in use * @param event The MouseEvent */ public void mouseExited(MouseEvent event) { } } --- NEW FILE: DescriptionAttribute.java --- //--------------------------------------------------------------------------------- // $Id: DescriptionAttribute.java,v 1.1 2006/02/28 02:25:48 nbramsen Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui.attrview; import java.awt.Color; 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.JTextArea; import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Description; /** * The StringAttributeView */ public class DescriptionAttribute extends GenericAttribute implements MouseListener { /** 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 Description Attribute is being edited */ private JTextArea descriptionEditor; /** * Constructor for StringAttribute * @param attribute The attribute */ public DescriptionAttribute(Attribute attribute) { super(BoxLayout.X_AXIS); this.attribute = attribute; this.listeners = new LinkedList(); label = createLabel(attribute.getName()); Box header = Box.createHorizontalBox(); Box column = Box.createVerticalBox(); header.add(Box.createHorizontalGlue()); header.add(label); header.add(Box.createHorizontalGlue()); //column.add(Box.createHorizontalStrut(60)); column.add(Box.createRigidArea(new Dimension(70, 3))); column.add(header); column.add(Box.createRigidArea(new Dimension(70, 3))); //column.add(Box.createHorizontalStrut(60)); //column.setMaximumSize(new Dimension(60, Short.MAX_VALUE)); //this.add(Box.createHorizontalStrut(7)); component = Box.createVerticalBox(); component.add(createValueLabel(attribute.getValue())); column.add(component); this.add(column); } /** * 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 StringAttribute * @param mouseListener the mouselistener */ public void addMouseListener(MouseListener mouseListener) { label.addMouseListener(mouseListener); component.addMouseListener(mouseListener); } /** * Remove a mouselisterner to the active elements in the StringAttribute * @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 addDescriptionAttributeListener(AttributeListener listener) { listeners.add(listener); } /** * Remove a listener * @param listener The listener */ public void removeDescriptionAttributeListener(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 = value.toString(); JTextArea valueLabel = new JTextArea(s); valueLabel.setBackground(new Color(204, 204, 204)); valueLabel.setLineWrap(true); valueLabel.setWrapStyleWord(true); valueLabel.setEditable(false); 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 = ""; s = value.toString(); JTextArea valueEditor = new JTextArea(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 (descriptionEditor == null) { component.remove(0); descriptionEditor = (JTextArea) createValueEditor(attribute.getValue()); descriptionEditor.setLineWrap(true); descriptionEditor.setWrapStyleWord(true); component.add(descriptionEditor); component.revalidate(); } descriptionEditor.requestFocus(); descriptionEditor.selectAll(); } } /** * Stop editing the value by replacing the editor with an label, * and sending valueChanged to all listeners. */ public void stopEditing() { if (descriptionEditor != null && attribute.isEditable()) { Object val = attribute.getValue(); attribute.setValue(new Description(descriptionEditor.getText())); component.remove(descriptionEditor); descriptionEditor = 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 (descriptionEditor != null) { component.remove(descriptionEditor); descriptionEditor = null; component.add(createValueLabel(attribute.getValue())); component.revalidate(); } } /** * Start editing on the view * @param event The event */ public void mouseClicked(MouseEvent event) { startEditing(); } /** * Not in use * @param event The MouseEvent */ public void mousePressed(MouseEvent event) { } /** * Not in use * @param event The MouseEvent */ public void mouseReleased(MouseEvent event) { } /** * Not in use * @param event The MouseEvent */ public void mouseEntered(MouseEvent event) { } /** * Not in use * @param event The MouseEvent */ public void mouseExited(MouseEvent event) { } } |
From: Nikolaj B. <nbr...@us...> - 2006-02-28 02:26:31
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17289/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Vertex.java Surface.java ConstructionSpace.java Space.java FunctionalSpace.java Attribute.java Added Files: Description.java Log Message: All that is displayed in the attribute view should now be parametric Index: FunctionalSpace.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/FunctionalSpace.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FunctionalSpace.java 13 Jan 2006 11:29:26 -0000 1.4 --- FunctionalSpace.java 28 Feb 2006 02:26:25 -0000 1.5 *************** *** 7,10 **** --- 7,14 ---- package net.sourceforge.bprocessor.model; + import java.util.ArrayList; + import java.util.Iterator; + import java.util.List; + import org.apache.log4j.Logger; *************** *** 17,21 **** * column="SPACE_ID" */ ! public class FunctionalSpace extends Space { /** The logger */ private static Logger log = Logger.getLogger(FunctionalSpace.class); --- 21,25 ---- * column="SPACE_ID" */ ! public class FunctionalSpace extends Space implements Parametric { /** The logger */ private static Logger log = Logger.getLogger(FunctionalSpace.class); *************** *** 97,99 **** --- 101,139 ---- return "FunctionalSpace[" + super.toString() + "]"; } + + /** + * 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() { + return "Functional Space"; + } } Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** Surface.java 23 Feb 2006 14:05:13 -0000 1.74 --- Surface.java 28 Feb 2006 02:26:25 -0000 1.75 *************** *** 27,31 **** * usage="read-write" */ ! public class Surface extends Geometric { /** The logger */ private static Logger log = Logger.getLogger(Surface.class); --- 27,31 ---- * usage="read-write" */ ! public class Surface extends Geometric implements Parametric { /** The logger */ private static Logger log = Logger.getLogger(Surface.class); *************** *** 922,924 **** --- 922,972 ---- return getName() + "[" + edges.size() + "]"; } + + + /** + * 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")) { + continue; + } else if (a.getName().equals("Exterior")) { + continue; + } else if (a.getName().equals("Holes")) { + continue; + } 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(), false)); + if (isInner()) { + res.add(new Attribute("Exterior", getExterior(), false)); + } else { + if (holes != null) { + Iterator iterElems = holes.iterator(); + while (iterElems.hasNext()) { + res.add(new Attribute("Hole", iterElems.next(), false)); + } + } + } + return res; + } + + /** + * @see net.sourceforge.bprocessor.model.Parametric#getGeneralName() + */ + public String getGeneralName() { + return "Surface"; + } } Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Edge.java 23 Feb 2006 14:05:13 -0000 1.37 --- Edge.java 28 Feb 2006 02:26:25 -0000 1.38 *************** *** 469,473 **** public List getAttributes() { ArrayList res = new ArrayList(); ! res.add(new Attribute("Name", getName())); res.add(new Attribute("Length", new Double(getLength()))); return res; --- 469,473 ---- public List getAttributes() { ArrayList res = new ArrayList(); ! res.add(new Attribute("Name", getName(), false)); res.add(new Attribute("Length", new Double(getLength()))); return res; Index: Attribute.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Attribute.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Attribute.java 9 Feb 2006 11:52:04 -0000 1.7 --- Attribute.java 28 Feb 2006 02:26:25 -0000 1.8 *************** *** 68,71 **** --- 68,82 ---- /** + * Constructor + * @param name The name + * @param value The value + * @param b Is editable + */ + public Attribute(String name, Object value, boolean b) { + this(name, value); + setEditable(b); + } + + /** * @return Returns the name. */ Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Space.java 8 Feb 2006 10:10:14 -0000 1.18 --- Space.java 28 Feb 2006 02:26:25 -0000 1.19 *************** *** 25,31 **** private String name; /** The Discription */ ! private String description; ! /** The attributes */ ! private Set attributes; /** The envelope (a set of surfaces) */ private Set envelope; --- 25,31 ---- private String name; /** The Discription */ ! private Description description; ! /** The attributes ! private Set attributes; */ /** The envelope (a set of surfaces) */ private Set envelope; *************** *** 51,55 **** super(); setName(name); ! setDescription(""); } --- 51,55 ---- super(); setName(name); ! description = new Description(""); } *************** *** 95,99 **** */ public void setDescription(String des) { ! this.description = des; } --- 95,99 ---- */ public void setDescription(String des) { ! this.description = new Description(des); } *************** *** 103,107 **** * @hibernate.property */ ! public String getDescription() { return description; } --- 103,107 ---- * @hibernate.property */ ! public Description getDescription() { return description; } *************** *** 118,133 **** * @hibernate.one-to-many * class="net.sourceforge.bprocessor.model.Attribute" ! */ public Set getAttributes() { return attributes; ! } /** * Set the attributes * @param attributes The attributes ! */ public void setAttributes(Set attributes) { this.attributes = attributes; ! } /** --- 118,133 ---- * @hibernate.one-to-many * class="net.sourceforge.bprocessor.model.Attribute" ! public Set getAttributes() { return attributes; ! } */ /** * Set the attributes * @param attributes The attributes ! public void setAttributes(Set attributes) { this.attributes = attributes; ! } */ /** Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Vertex.java 23 Feb 2006 14:05:13 -0000 1.27 --- Vertex.java 28 Feb 2006 02:26:25 -0000 1.28 *************** *** 367,371 **** public List getAttributes() { ArrayList res = new ArrayList(); ! res.add(new Attribute("Name", getName())); res.add(new Attribute("X", new Double(getX()))); res.add(new Attribute("Y", new Double(getY()))); --- 367,372 ---- public List getAttributes() { ArrayList res = new ArrayList(); ! ! res.add(new Attribute("Name", getName(), false)); res.add(new Attribute("X", new Double(getX()))); res.add(new Attribute("Y", new Double(getY()))); --- NEW FILE: Description.java --- //--------------------------------------------------------------------------------- // $Id: Description.java,v 1.1 2006/02/28 02:26:25 nbramsen Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.model; /** * The Description class */ public class Description { /** The current description */ private String description; /** * Constructor * @param des is the Description */ public Description(String des) { description = des; } /** * Return the descriptoin * @return The description in string format */ public String toString() { return description.toString(); } } Index: ConstructionSpace.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ConstructionSpace.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ConstructionSpace.java 13 Jan 2006 11:29:26 -0000 1.4 --- ConstructionSpace.java 28 Feb 2006 02:26:25 -0000 1.5 *************** *** 7,10 **** --- 7,14 ---- package net.sourceforge.bprocessor.model; + import java.util.ArrayList; + import java.util.Iterator; + import java.util.List; + import org.apache.log4j.Logger; *************** *** 17,21 **** * column="SPACE_ID" */ ! public class ConstructionSpace extends Space { /** The logger */ private static Logger log = Logger.getLogger(ConstructionSpace.class); --- 21,25 ---- * column="SPACE_ID" */ ! public class ConstructionSpace extends Space implements Parametric { /** The logger */ private static Logger log = Logger.getLogger(ConstructionSpace.class); *************** *** 97,99 **** --- 101,139 ---- return "ConstructionSpace[" + super.toString() + "]"; } + + /** + * 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() { + return "Construction Space"; + } } |
From: Nikolaj B. <nbr...@us...> - 2006-02-28 02:26:30
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17289/src/net/sourceforge/bprocessor/model/xml Modified Files: PersistenceManager.java Log Message: All that is displayed in the attribute view should now be parametric Index: PersistenceManager.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml/PersistenceManager.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** PersistenceManager.java 1 Feb 2006 11:36:56 -0000 1.24 --- PersistenceManager.java 28 Feb 2006 02:26:25 -0000 1.25 *************** *** 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()); 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()); Map fsm = (Map)mapper.get(KEY_DOMAIN); |
From: Michael L. <he...@us...> - 2006-02-26 23:56:48
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6182/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Hiding geometry when editing interior of space Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** View.java 26 Feb 2006 10:52:25 -0000 1.66 --- View.java 26 Feb 2006 23:56:45 -0000 1.67 *************** *** 754,785 **** //Draw edges if (doDrawEdges) { ! gl.glLineWidth(1.0f); ! gl.glColor3fv(lineColor); ! // draw all the edges in the model ! Iterator eit = edges.iterator(); ! while (eit.hasNext()) { ! Edge e = (Edge)eit.next(); ! if (e.getConstructor()) { ! gl.glColor3fv(constructorColor); ! drawConstructor(e); ! gl.glColor3fv(lineColor); ! } else { ! drawEdge(e); ! } ! } ! //draw all temporary edges. ! Iterator tempEdgeIt = tempEdges.iterator(); ! while (tempEdgeIt.hasNext()) { ! Edge e = (Edge)tempEdgeIt.next(); ! if (e.getConstructor()) { ! gl.glColor3fv(constructorColor); ! drawConstructor(e); ! gl.glColor3fv(lineColor); ! } else { ! drawEdge(e); ! } ! } } - //drawSpaces(gld); gl.glColor3fv(SELECTED_COLOR); --- 754,759 ---- //Draw edges if (doDrawEdges) { ! drawEdges(gld); } gl.glColor3fv(SELECTED_COLOR); *************** *** 892,900 **** */ private void drawSurfaces(GLDrawable gld, int side) { - Collection surfaces = Project.getInstance().getSurfaces(); - Collection spaces = Project.getInstance().getSpaces(); - drawSurfaces(gld, surfaces, side); drawSurfaces(gld, tempSurfaces, side); ! drawInteriorSurfaces(gld, side, spaces); } --- 866,958 ---- */ private void drawSurfaces(GLDrawable gld, int side) { drawSurfaces(gld, tempSurfaces, side); ! ! Space active = Project.getInstance().getActiveSpace(); ! ! if (active != null) { ! drawSpaceSurfaces(gld, active, side); ! } else { ! Collection surfaces = Project.getInstance().getSurfaces(); ! Collection spaces = Project.getInstance().getSpaces(); ! drawSurfaces(gld, surfaces, side); ! drawInteriorSurfaces(gld, side, spaces); ! } ! } ! ! /** ! * Draww all edges ! * @param gld The GLDrawable ! */ ! private void drawEdges(GLDrawable gld) { ! drawGeneralEdges(gld, tempEdges); ! ! Space active = Project.getInstance().getActiveSpace(); ! if (active != null) { ! Set edges = new HashSet(); ! Collection envelope = active.getEnvelope(); ! Iterator iter = envelope.iterator(); ! while (iter.hasNext()) { ! Surface current = (Surface) iter.next(); ! edges.addAll(current.getEdges()); ! } ! drawConstructionEdges(gld, edges); ! Mesh interior = active.getInterior(); ! if (interior != null) { ! drawGeneralEdges(gld, interior.getEdges()); ! ! } ! } else { ! Collection edges = Project.getInstance().getEdges(); ! drawGeneralEdges(gld, edges); ! } ! } ! ! /** ! * ! * @param gld The GLDrawable ! * @param edges The edges ! */ ! public void drawGeneralEdges(GLDrawable gld, Collection edges) { ! gl.glLineWidth(1.0f); ! gl.glColor3fv(lineColor); ! Iterator iter = edges.iterator(); ! while (iter.hasNext()) { ! Edge current = (Edge)iter.next(); ! if (current.getConstructor()) { ! gl.glColor3fv(constructorColor); ! drawConstructor(current); ! gl.glColor3fv(lineColor); ! } else { ! drawEdge(current); ! } ! } ! } ! ! /** ! * ! * @param gld The GLDrawable ! * @param edges The edges ! */ ! public void drawConstructionEdges(GLDrawable gld, Collection edges) { ! gl.glLineWidth(1.0f); ! gl.glColor3fv(constructorColor); ! Iterator iter = edges.iterator(); ! while (iter.hasNext()) { ! Edge current = (Edge)iter.next(); ! drawConstructor(current); ! } ! } ! ! ! /** ! * @param gld The GLDrawable ! * @param space The space ! * @param side The side ! */ ! public void drawSpaceSurfaces(GLDrawable gld, Space space, int side) { ! Mesh interior = space.getInterior(); ! if (interior != null) { ! drawSurfaces(gld, interior.getSurfaces(), side); ! } } |
From: Michael L. <he...@us...> - 2006-02-26 10:52:34
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23531/src/net/sourceforge/bprocessor/gl/tool Modified Files: SpaceTool.java Log Message: Drawing elements Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** SpaceTool.java 8 Feb 2006 10:10:07 -0000 1.14 --- SpaceTool.java 26 Feb 2006 10:52:26 -0000 1.15 *************** *** 67,71 **** } ! if (e.getButton() == MouseEvent.BUTTON3) { glv.popup(makeSelectionMenu(), e.getX(), e.getY()); done = true; --- 67,71 ---- } ! if (e.getButton() == MouseEvent.BUTTON3 || e.isControlDown()) { glv.popup(makeSelectionMenu(), e.getX(), e.getY()); done = true; |
From: Michael L. <he...@us...> - 2006-02-26 10:52:34
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23531/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Drawing elements Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** View.java 23 Feb 2006 14:59:41 -0000 1.65 --- View.java 26 Feb 2006 10:52:25 -0000 1.66 *************** *** 781,785 **** } } ! drawSpaces(gld); gl.glColor3fv(SELECTED_COLOR); --- 781,785 ---- } } ! //drawSpaces(gld); gl.glColor3fv(SELECTED_COLOR); *************** *** 893,898 **** --- 893,917 ---- private void drawSurfaces(GLDrawable gld, int side) { Collection surfaces = Project.getInstance().getSurfaces(); + Collection spaces = Project.getInstance().getSpaces(); drawSurfaces(gld, surfaces, side); drawSurfaces(gld, tempSurfaces, side); + drawInteriorSurfaces(gld, side, spaces); + } + + /** + * Draw interior surfaces + * @param gld The GLDrawable + * @param side The side of surfaces to draw + * @param spaces The spaces + */ + private void drawInteriorSurfaces(GLDrawable gld, int side, Collection spaces) { + Iterator iter = spaces.iterator(); + while (iter.hasNext()) { + Space current = (Space) iter.next(); + Mesh interior = current.getInterior(); + if (interior != null) { + drawSurfaces(gld, interior.getSurfaces(), side); + } + } } *************** *** 1489,1492 **** --- 1508,1514 ---- return false; } + if (front.getInterior() != null || back.getInterior() != null) { + return false; + } return true; } |
From: Michael L. <he...@us...> - 2006-02-25 09:04:57
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32684/src/net/sourceforge/bprocessor/model Modified Files: Project.java Log Message: Menu in D-View Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** Project.java 22 Feb 2006 11:03:23 -0000 1.39 --- Project.java 25 Feb 2006 09:04:53 -0000 1.40 *************** *** 63,66 **** --- 63,69 ---- private Camera currentCamera; + /** The active space */ + private Space activeSpace; + /** * Get the instance *************** *** 560,563 **** --- 563,585 ---- /** + * Sets the active space being edited. + * @param space The space + */ + public void setActiveSpace(Space space) { + System.out.println("active " + space); + activeSpace = space; + changed(this); + } + + /** + * Returns the active space being edited + * @return The active space + */ + public Space getActiveSpace() { + return activeSpace; + } + + + /** * Sets the current camera * @param camera the Camera |
From: Michael L. <he...@us...> - 2006-02-25 09:04:54
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32658/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java Log Message: Menu in D-View Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** GenericTreeView.java 15 Feb 2006 11:35:50 -0000 1.15 --- GenericTreeView.java 25 Feb 2006 09:04:49 -0000 1.16 *************** *** 8,11 **** --- 8,15 ---- import java.awt.Component; + import java.awt.event.ActionEvent; + import java.awt.event.ActionListener; + import java.awt.event.MouseAdapter; + import java.awt.event.MouseEvent; import java.net.URL; import java.util.Collection; *************** *** 15,18 **** --- 19,24 ---- import javax.swing.ImageIcon; + import javax.swing.JMenuItem; + import javax.swing.JPopupMenu; import javax.swing.JTree; import javax.swing.SwingUtilities; *************** *** 162,165 **** --- 168,172 ---- Project.getInstance().addObserver(this); this.addTreeSelectionListener(new SelectionListener()); + this.addMouseListener(new GenericMouseAdapter()); model = (DefaultTreeModel) getModel(); root = (DefaultMutableTreeNode) model.getRoot(); *************** *** 233,237 **** --- 240,261 ---- return null; } + + /** + * JPopupMenu + * @return menu + */ + public JPopupMenu menu() { + return null; + } + } + + /** + * MenuAction for making anonymous actionlisteners + */ + protected abstract class MenuAction implements ActionListener { } + + + /** * ContainerNode *************** *** 311,316 **** super(space); Set surfaces = space.getEnvelope(); ! add(new SurfaceContainer("Envelope", surfaces)); ! add(new ContainerNode("Interior")); if (space.getModellor() != null) { add(new ModellorNode(space.getModellor())); --- 335,340 ---- super(space); Set surfaces = space.getEnvelope(); ! add(new SurfaceContainer("Surfaces", surfaces)); ! add(new ElementContainer("Elements", space)); if (space.getModellor() != null) { add(new ModellorNode(space.getModellor())); *************** *** 465,469 **** } } ! /** * Return icon --- 489,493 ---- } } ! /** * Return icon *************** *** 477,480 **** --- 501,546 ---- /** + * ElementContainer + */ + public class ElementContainer extends ContainerNode { + /** Space */ + private Space space; + + /** + * Construftor + * @param name The name + * @param space The space + */ + public ElementContainer(String name, Space space) { + super(name); + this.space = space; + } + + /** + * Return icon + * @return Icon + */ + public ImageIcon icon() { + return spacegroupicon; + } + + /** + * @return Menu + */ + 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; + } + } + + /** * EdgeContainer */ *************** *** 553,556 **** --- 619,648 ---- } } + + /** + * GenericMouseAdapter + */ + private class GenericMouseAdapter extends MouseAdapter { + /** + * Mouse pressed + * @param e MouseEvent + */ + public void mousePressed(MouseEvent e) { + System.out.println("e = " + e); + TreePath path = getPathForLocation(e.getX(), e.getY()); + if (path != null) { + if (e.isControlDown()) { + Object object = path.getLastPathComponent(); + if (object instanceof GenericNode) { + GenericNode node = (GenericNode) object; + JPopupMenu menu = node.menu(); + if (menu != null) { + menu.show(GenericTreeView.this, e.getX(), e.getY()); + } + } + } + } + } + } /** |
From: Nordholt <nor...@us...> - 2006-02-23 21:31:42
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21803 Modified Files: Plane.java Log Message: added method for getting a normal for the plane Index: Plane.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Plane.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Plane.java 3 Feb 2006 13:01:49 -0000 1.14 --- Plane.java 23 Feb 2006 21:31:37 -0000 1.15 *************** *** 69,72 **** --- 69,82 ---- /** + * Gets a unit normal to the plane. + * @return a normal to the plane + */ + public Vertex normal() { + Vertex normal = new Vertex(a, b, c); + normal.scale(1 / normal.length()); + return normal; + } + + /** * Distance from vertex to this plane * @param vertex The vertex |
From: Nordholt <nor...@us...> - 2006-02-23 21:30:27
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20714/tool Modified Files: TapeMeasureTool.java Log Message: added angeling to tapemeasure Index: TapeMeasureTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/TapeMeasureTool.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TapeMeasureTool.java 25 Jan 2006 10:02:09 -0000 1.7 --- TapeMeasureTool.java 23 Feb 2006 21:30:14 -0000 1.8 *************** *** 65,68 **** --- 65,72 ---- /** Tells if the tool is currently measuring or not */ private boolean measuring; + + /** Tells if the tool is taking its angel or not */ + private boolean angling; + /** * Constructor *************** *** 73,78 **** super(glv, cursor); measuring = false; } ! /** * Invoked when the mouse cursor has been moved --- 77,83 ---- super(glv, cursor); measuring = false; + angling = false; } ! /** * Invoked when the mouse cursor has been moved *************** *** 102,113 **** glv.getView().makeTarget(target); movePlane = targetSurface.plane(); ! Vertex edgeDirection = currentEdge.getTo().minus(currentEdge.getFrom()); Vertex surfaceNormal = targetSurface.normal(); edgeNormal = edgeDirection.cross(surfaceNormal); - move(e); } } } ! } else { move(e); } --- 107,119 ---- glv.getView().makeTarget(target); movePlane = targetSurface.plane(); ! Vertex edgeDirection = currentEdge.getDirection(); Vertex surfaceNormal = targetSurface.normal(); edgeNormal = edgeDirection.cross(surfaceNormal); } } } ! } else if (angling) { ! moveAngel(e); ! } else if (measuring) { move(e); } *************** *** 119,122 **** --- 125,147 ---- /** + * Moves the angelsetting constructors. + * @param e the mouseevent + */ + private void moveAngel(MouseEvent e) { + Vertex moveTo = glv.getView().toPlaneCoords(new double[]{e.getX(), + e.getY()}, + movePlane); + Vertex delta = moveTo.minus(constructionPoint); + constructionPoint.move(delta.getX(), delta.getY(), delta.getZ()); + double degrees; + Vertex angelDir = edgeToConstruction.getDirection(); + Vertex edgeDir = currentEdge.getDirection(); + degrees = Math.acos((angelDir.dot(edgeDir) / (angelDir.length() * edgeDir.length()))); + degrees *= (180 / Math.PI); + glv.setLength(degrees / 1000); + } + + + /** * moves the construction line. * @param e the mouseevent. *************** *** 160,168 **** v.addTempEdge(zAxis); findTarget(e); ! if (!measuring) { if (target instanceof Edge) { currentEdge = (Edge)target; ! measuring = true; ! Vertex minus = currentEdge.getTo().minus(currentEdge.getFrom()); minus.scale(1 / minus.length()); Vertex constructionFrom = createVertex(new double[] {(currentEdge.getFrom().getX() + --- 185,193 ---- v.addTempEdge(zAxis); findTarget(e); ! if (!measuring && !angling) { if (target instanceof Edge) { currentEdge = (Edge)target; ! angling = true; ! Vertex minus = currentEdge.getDirection(); minus.scale(1 / minus.length()); Vertex constructionFrom = createVertex(new double[] {(currentEdge.getFrom().getX() + *************** *** 197,200 **** --- 222,227 ---- v.addTempVertex(constructionPoint); } + } else if (angling) { + endAngeling(); } else { endTapeMeasure(); *************** *** 244,265 **** } else if (e.getKeyCode() == KeyEvent.VK_ENTER) { if (!number.equals("")) { ! double length = glv.getLength(); ! double currentLength = edgeToConstruction.getLength(); ! Vertex minus = edgeToConstruction.getTo().minus(edgeToConstruction.getFrom()); ! edgeNormal.scale(1 / edgeNormal.length()); ! minus.scale(1 / minus.length()); ! double delta; ! if (minus.dot(edgeNormal) > 0) { ! delta = length - currentLength; ! } else { ! delta = -(length - currentLength); ! } ! constructionPoint.move(edgeNormal.getX() * delta, ! edgeNormal.getY() * delta, ! edgeNormal.getZ() * delta); ! currentConstruction.move(edgeNormal.getX() * delta, edgeNormal.getY() * delta, edgeNormal.getZ() * delta); ! endTapeMeasure(); glv.repaint(); } --- 271,294 ---- } else if (e.getKeyCode() == KeyEvent.VK_ENTER) { if (!number.equals("")) { ! if (measuring) { ! double length = glv.getLength(); ! double currentLength = edgeToConstruction.getLength(); ! Vertex minus = edgeToConstruction.getTo().minus(edgeToConstruction.getFrom()); ! edgeNormal.scale(1 / edgeNormal.length()); ! minus.scale(1 / minus.length()); ! double delta; ! if (minus.dot(edgeNormal) > 0) { ! delta = length - currentLength; ! } else { ! delta = -(length - currentLength); ! } ! constructionPoint.move(edgeNormal.getX() * delta, edgeNormal.getY() * delta, edgeNormal.getZ() * delta); ! currentConstruction.move(edgeNormal.getX() * delta, ! edgeNormal.getY() * delta, ! edgeNormal.getZ() * delta); ! endTapeMeasure(); ! } glv.repaint(); } *************** *** 301,304 **** measuring = false; } ! } } --- 330,358 ---- measuring = false; } ! } ! /** ! * Ends the angeling ! */ ! private void endAngeling() { ! if (movePlane != null) { ! Vertex angelDir = edgeToConstruction.getDirection(); ! Vertex to = angelDir.copy(); ! Vertex from = angelDir.copy(); ! to.scale(50); ! to = to.add(edgePoint); ! from.scale(-50); ! from = from.add(edgePoint); ! currentConstruction.setTo(to); ! currentConstruction.setFrom(from); ! Vertex planeNormal = movePlane.normal(); ! Vertex constructionDir = currentConstruction.getDirection(); ! edgeNormal = constructionDir.cross(planeNormal); ! ! constructionPoint = edgePoint.copy(); ! edgeToConstruction.setTo(constructionPoint); ! glv.getView().makeTarget(constructionPoint); ! } ! angling = false; ! measuring = true; ! } } |
From: Nordholt <nor...@us...> - 2006-02-23 16:04:28
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7278/tool Modified Files: MoveTool.java Log Message: controlled move of surfaces and vertices aswell Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** MoveTool.java 17 Feb 2006 09:57:24 -0000 1.39 --- MoveTool.java 23 Feb 2006 16:04:13 -0000 1.40 *************** *** 106,111 **** private HashMap slideMap; ! /** The edge being moved in a controlled way */ ! private Edge controlled; /** --- 106,111 ---- private HashMap slideMap; ! /** The entity being moved in a controlled way */ ! private Entity controlled; /** *************** *** 158,164 **** if (target != null) { if (moveMode != THREE_CLICK) { - //super.pressed(e); initial = findInitial(target, e); from = initial.copy(); setupConstructors(); --- 158,164 ---- if (target != null) { if (moveMode != THREE_CLICK) { initial = findInitial(target, e); from = initial.copy(); + slideMap = new HashMap(); setupConstructors(); *************** *** 167,178 **** vertices = new HashSet(); moveEntities = selection; - collect(selection, vertices); if (moveMode == CONTROLLED) { ! if (target instanceof Edge) { ! controlled = (Edge)target; ! } else { ! log.warn("Controlled move only works with edges"); } } } else { threeClickMove(e); --- 167,179 ---- vertices = new HashSet(); moveEntities = selection; if (moveMode == CONTROLLED) { ! if (!selection.isEmpty()) { ! Iterator it = selection.iterator(); ! controlled = (Entity)it.next(); } + selection = new HashSet(); + selection.add(controlled); } + collect(selection, vertices); } else { threeClickMove(e); *************** *** 433,487 **** if (toSlideEdge == null && fromSlideEdge == null) { findTarget(e); ! if (target instanceof Surface) { ! Surface targetSurface = (Surface)target; ! if (controlled.getSurfaces().contains(targetSurface)) { ! glv.getView().makeTarget(target); ! dragPlane = targetSurface.plane(); ! Vertex controlledDir = controlled.getDirection(); ! Vertex surfaceNormal = targetSurface.normal(); ! restrictionVector = controlledDir.cross(surfaceNormal); ! restrictionVector.scale(1 / restrictionVector.length()); ! ! List edges = targetSurface.getEdges(); ! int index = edges.indexOf(controlled); ! Edge leftEdge; ! Edge rightEdge; ! if (index == 0) { ! leftEdge = (Edge)edges.get(edges.size() - 1); ! rightEdge = (Edge)edges.get(index + 1); ! } else if (index == (edges.size() - 1)) { ! leftEdge = (Edge)edges.get(index - 1); ! rightEdge = (Edge)edges.get(0); ! } else { ! leftEdge = (Edge)edges.get(index - 1); ! rightEdge = (Edge)edges.get(index + 1); } ! if (controlledDir.cross(leftEdge.getDirection()).length() > 0.00001 && ! controlledDir.cross(rightEdge.getDirection()).length() > 0.00001) { ! Vertex to = controlled.getTo(); ! Vertex from = controlled.getFrom(); ! if (to.getEdges().contains(leftEdge) && ! from.getEdges().contains(rightEdge)) { ! toSlideEdge = leftEdge; ! fromSlideEdge = rightEdge; ! } else if (from.getEdges().contains(leftEdge) && ! to.getEdges().contains(rightEdge)) { ! fromSlideEdge = leftEdge; ! toSlideEdge = rightEdge; } ! slideMap = new HashMap(); ! slideMap.put(controlled.getTo(), toSlideEdge.getDirection()); ! slideMap.put(controlled.getFrom(), fromSlideEdge.getDirection()); ! } else { ! dragPlane = null; ! restrictionVector = null; ! log.warn("This edge is bound"); } } } } } } ! /** * Creates the surface spanned by two edges connected --- 434,532 ---- if (toSlideEdge == null && fromSlideEdge == null) { findTarget(e); ! if (controlled instanceof Edge) { ! Edge controlledEdge = (Edge)controlled; ! if (target instanceof Surface) { ! Surface targetSurface = (Surface)target; ! if (controlledEdge.getSurfaces().contains(targetSurface)) { ! glv.getView().makeTarget(target); ! dragPlane = targetSurface.plane(); ! Vertex controlledDir = controlledEdge.getDirection(); ! Vertex surfaceNormal = targetSurface.normal(); ! restrictionVector = controlledDir.cross(surfaceNormal); ! restrictionVector.scale(1 / restrictionVector.length()); ! ! List edges = targetSurface.getEdges(); ! int index = edges.indexOf(controlledEdge); ! Edge leftEdge; ! Edge rightEdge; ! if (index == 0) { ! leftEdge = (Edge)edges.get(edges.size() - 1); ! rightEdge = (Edge)edges.get(index + 1); ! } else if (index == (edges.size() - 1)) { ! leftEdge = (Edge)edges.get(index - 1); ! rightEdge = (Edge)edges.get(0); ! } else { ! leftEdge = (Edge)edges.get(index - 1); ! rightEdge = (Edge)edges.get(index + 1); ! } ! if (controlledDir.cross(leftEdge.getDirection()).length() > 0.00001 && ! controlledDir.cross(rightEdge.getDirection()).length() > 0.00001) { ! Vertex to = controlledEdge.getTo(); ! Vertex from = controlledEdge.getFrom(); ! if (to.getEdges().contains(leftEdge) && ! from.getEdges().contains(rightEdge)) { ! toSlideEdge = leftEdge; ! fromSlideEdge = rightEdge; ! } else if (from.getEdges().contains(leftEdge) && ! to.getEdges().contains(rightEdge)) { ! fromSlideEdge = leftEdge; ! toSlideEdge = rightEdge; ! } ! slideMap = new HashMap(); ! slideMap.put(controlledEdge.getTo(), toSlideEdge.getDirection()); ! slideMap.put(controlledEdge.getFrom(), fromSlideEdge.getDirection()); ! } else { ! dragPlane = null; ! restrictionVector = null; ! log.warn("This edge is bound"); ! } } ! } ! } else if (controlled instanceof Vertex) { ! Vertex controlledVertex = (Vertex)controlled; ! if (target instanceof Edge && ! controlledVertex.getEdges().contains((Edge)target)) { ! Edge targetEdge = (Edge)target; ! slideMap = new HashMap(); ! slideMap.put(controlledVertex, targetEdge.getDirection()); ! restrictionVector = targetEdge.getDirection(); ! findRestrictionPlane(); ! fromSlideEdge = targetEdge; ! toSlideEdge = targetEdge; ! } ! } else if (controlled instanceof Surface) { ! Surface controlledSurface = (Surface)controlled; ! restrictionVector = controlledSurface.normal(); ! findRestrictionPlane(); ! slideMap = new HashMap(); ! Collection vertices = controlledSurface.getVertices(); ! Iterator it = vertices.iterator(); ! boolean bound = false; ! while (it.hasNext() && !bound) { ! Vertex vertex = (Vertex)it.next(); ! slideMap.put(vertex, restrictionVector); ! Collection edges = vertex.getEdges(); ! Iterator edgeIt = edges.iterator(); ! int otherEdges = 0; ! while (edgeIt.hasNext() && !bound) { ! Edge edge = (Edge)edgeIt.next(); ! if (!controlledSurface.getEdges().contains(edge)) { ! otherEdges++; ! slideMap.put(vertex, edge.getDirection()); } ! bound = otherEdges > 1; } } + if (bound) { + slideMap = new HashMap(); + restrictionVector = null; + dragPlane = null; + log.warn("this surface is bound!"); + } } } } } ! /** * Creates the surface spanned by two edges connected *************** *** 627,630 **** --- 672,684 ---- Vertex slideDir = (Vertex)slideMap.get(vertex); double slideScale; + if (delta == null) { + log.info("delta null"); + } + if (slideDir == null) { + log.info("slideDir null"); + } + if (deltaUnit == null) { + log.info("deltaUnit null"); + } if (delta.getX() != 0) { slideScale = delta.getX() / (slideDir.dot(deltaUnit) * deltaUnit.getX()); |
From: Michael L. <he...@us...> - 2006-02-23 14:59:46
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1183/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Small changes Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** View.java 22 Feb 2006 15:05:31 -0000 1.64 --- View.java 23 Feb 2006 14:59:41 -0000 1.65 *************** *** 762,766 **** if (e.getConstructor()) { gl.glColor3fv(constructorColor); ! drawEdge(e); gl.glColor3fv(lineColor); } else { --- 762,766 ---- if (e.getConstructor()) { gl.glColor3fv(constructorColor); ! drawConstructor(e); gl.glColor3fv(lineColor); } else { *************** *** 774,778 **** if (e.getConstructor()) { gl.glColor3fv(constructorColor); ! drawEdge(e); gl.glColor3fv(lineColor); } else { --- 774,778 ---- if (e.getConstructor()) { gl.glColor3fv(constructorColor); ! drawConstructor(e); gl.glColor3fv(lineColor); } else { *************** *** 813,822 **** gl.glColor3fv(lineColor); } - gl.glBegin(GL.GL_LINES); gl.glLineWidth(1.0f); ! gl.glVertex3d(from.getX(), from.getY(), from.getZ()); ! gl.glVertex3d(to.getX(), to.getY(), to.getZ()); ! gl.glEnd(); ! } --- 813,818 ---- gl.glColor3fv(lineColor); } gl.glLineWidth(1.0f); ! drawEdge(activeEdge); } *************** *** 837,842 **** if (doDraw) { gl.glEnable(GL.GL_LINE_STIPPLE); - gl.glBegin(GL.GL_LINES); gl.glLineWidth(1.0f); gl.glVertex3d(snapVertex.getX(), snapVertex.getY(), snapVertex.getZ()); gl.glVertex3d(to.getX(), to.getY(), to.getZ()); --- 833,838 ---- if (doDraw) { gl.glEnable(GL.GL_LINE_STIPPLE); gl.glLineWidth(1.0f); + gl.glBegin(GL.GL_LINES); gl.glVertex3d(snapVertex.getX(), snapVertex.getY(), snapVertex.getZ()); gl.glVertex3d(to.getX(), to.getY(), to.getZ()); *************** *** 879,888 **** gl.glDisable(GL.GL_DEPTH_TEST); Edge e = (Edge) o; ! Vertex to = e.getTo(); ! Vertex from = e.getFrom(); ! gl.glBegin(GL.GL_LINES); ! gl.glVertex3d(to.getX(), to.getY(), to.getZ()); ! gl.glVertex3d(from.getX(), from.getY(), from.getZ()); ! gl.glEnd(); gl.glEnable(GL.GL_DEPTH_TEST); } else if (o instanceof Surface) { --- 875,879 ---- gl.glDisable(GL.GL_DEPTH_TEST); Edge e = (Edge) o; ! drawEdge(e); gl.glEnable(GL.GL_DEPTH_TEST); } else if (o instanceof Surface) { *************** *** 1416,1419 **** --- 1407,1419 ---- + /** + * Draw a constructor edge + * @param e Edge + */ + private void drawConstructor(Edge e) { + gl.glEnable(GL.GL_LINE_STIPPLE); + drawEdge(e); + gl.glDisable(GL.GL_LINE_STIPPLE); + } /** *************** *** 1422,1446 **** */ private void drawEdge(Edge e) { - Vertex to = e.getTo(); Vertex from = e.getFrom(); if (to != null && from != null) { ! if (e.getConstructor()) { ! gl.glEnable(GL.GL_LINE_STIPPLE); ! gl.glBegin(GL.GL_LINE_STRIP); ! gl.glVertex3d(to.getX(), ! to.getY(), ! to.getZ()); ! gl.glVertex3d(from.getX(), ! from.getY(), ! from.getZ()); ! gl.glEnd(); ! gl.glDisable(GL.GL_LINE_STIPPLE); ! } else { ! gl.glBegin(GL.GL_LINE_STRIP); ! gl.glVertex3d(to.getX(), to.getY(), to.getZ()); ! gl.glVertex3d(from.getX(), from.getY(), from.getZ()); ! gl.glEnd(); ! } } } --- 1422,1432 ---- */ private void drawEdge(Edge e) { Vertex to = e.getTo(); Vertex from = e.getFrom(); if (to != null && from != null) { ! gl.glBegin(GL.GL_LINE_STRIP); ! gl.glVertex3d(to.getX(), to.getY(), to.getZ()); ! gl.glVertex3d(from.getX(), from.getY(), from.getZ()); ! gl.glEnd(); } } *************** *** 1475,1482 **** private void drawEdges(GLDrawable gld, Collection edges) { GL gl = gld.getGL(); - GLU glu = gld.getGLU(); - - Iterator it = edges.iterator(); gl.glColor3fv(lineColor); while (it.hasNext()) { Edge e = (Edge)it.next(); --- 1461,1466 ---- private void drawEdges(GLDrawable gld, Collection edges) { GL gl = gld.getGL(); gl.glColor3fv(lineColor); + Iterator it = edges.iterator(); while (it.hasNext()) { Edge e = (Edge)it.next(); |
From: rimestad <rim...@us...> - 2006-02-23 14:05:25
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv434/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Vertex.java Direction.java Surface.java Log Message: Multiextrude work partially but is not activated yet... Edge and Vertex getAtt changed to not printing and Surface extrude changed a bit Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** Surface.java 6 Feb 2006 12:29:57 -0000 1.73 --- Surface.java 23 Feb 2006 14:05:13 -0000 1.74 *************** *** 8,15 **** --- 8,17 ---- import java.util.ArrayList; + import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; + import java.util.Map; import java.util.Set; import java.util.HashSet; *************** *** 341,347 **** */ public Surface extrude(double delta, Set sides) { Vertex normal = normal(); - normal.scale(delta); List vertices = getVertices(); --- 343,378 ---- */ public Surface extrude(double delta, Set sides) { + Map v2dir = new HashMap(); + Surface top = extrude(delta, sides, new HashMap(), new HashMap(), + new HashMap(), v2dir); + Collection c = v2dir.values(); + Iterator iter = c.iterator(); + while (iter.hasNext()) { + Object o = iter.next(); + if (o instanceof Direction) { + Direction d = (Direction)o; + Vertex dir = d.getDirection(); + log.info("The " + d.getVertex() + "were moved " + dir); + Vertex v = dir.copy(); + v.scale(delta); + d.getVertex().move(v.getX(), v.getY(), v.getZ()); + } + } + return top; + } + + /** + * Make the new vertices, edges and surfaces for extrusion + * @param delta the direction of extrusion + * @param sides Will contain the sides that are created + * @param e2e a edge to new extruded parallel edge map + * @param v2e a vertex to orthogonal edge map + * @param e2s a edge to extruded surface map + * @param v2dir a vertex to direction map + * @return The top in the extruded surface + */ + public Surface extrude(double delta, Set sides, Map e2e, Map v2e, Map e2s, Map v2dir) { Vertex normal = normal(); List vertices = getVertices(); *************** *** 365,393 **** for (int i = 0; i < n; i++) { ! vmap[i] = v[i].add(normal); getMesh().add(vmap[i]); } for (int i = 0; i < n; i++) { ! topmap[i] = new Edge(vmap[i], vmap[(i + 1) % n]); getMesh().add(topmap[i]); } for (int i = 0; i < n; i++) { ! sidemap[i] = new Edge(v[i], vmap[i]); getMesh().add(sidemap[i]); } for (int i = 0; i < n; i++) { ! Edge b = e[i]; ! Edge r = sidemap[i]; ! Edge l = sidemap[(i + 1) % n]; ! Edge t = topmap[i]; ! List newEdges = new LinkedList(); ! newEdges.add(r); ! newEdges.add(t); ! newEdges.add(l); ! newEdges.add(b); ! facemap[i] = new Surface(newEdges); getMesh().add(facemap[i]); sides.add(facemap[i]); --- 396,449 ---- for (int i = 0; i < n; i++) { ! if (v2dir.containsKey(v[i])) { ! Direction d = (Direction)v2dir.get(v[i]); ! vmap[i] = d.getVertex(); ! d.alterDirection(normal); ! log.info(v[i] + " direction altered to " + d); ! } else { ! log.info(v[i] + " direction of " + normal); ! vmap[i] = v[i].copy(); ! v2dir.put(v[i], new Direction(vmap[i], normal)); ! } getMesh().add(vmap[i]); } for (int i = 0; i < n; i++) { ! if (e2e.containsKey(e[i])) { ! log.info("The edge " + e[i] + " were allready there"); ! topmap[i] = (Edge)e2e.get(e[i]); ! } else { ! topmap[i] = new Edge(vmap[i], vmap[(i + 1) % n]); ! e2e.put(e[i], topmap[i]); ! } getMesh().add(topmap[i]); } for (int i = 0; i < n; i++) { ! if (v2e.containsKey(v[i])) { ! sidemap[i] = (Edge)v2e.get(v[i]); ! } else { ! sidemap[i] = new Edge(v[i], vmap[i]); ! v2e.put(v[i], sidemap[i]); ! } getMesh().add(sidemap[i]); } for (int i = 0; i < n; i++) { ! if (e2s.containsKey(e[i])) { ! facemap[i] = (Surface)e2s.get(e[i]); ! } else { ! Edge b = e[i]; ! Edge r = sidemap[i]; ! Edge l = sidemap[(i + 1) % n]; ! Edge t = topmap[i]; ! List newEdges = new LinkedList(); ! newEdges.add(r); ! newEdges.add(t); ! newEdges.add(l); ! newEdges.add(b); ! facemap[i] = new Surface(newEdges); ! e2s.put(b, facemap[i]); ! } getMesh().add(facemap[i]); sides.add(facemap[i]); Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** Edge.java 17 Feb 2006 14:45:24 -0000 1.36 --- Edge.java 23 Feb 2006 14:05:13 -0000 1.37 *************** *** 454,458 **** Attribute a = (Attribute)iter.next(); if (a.getName().equals("Name")) { ! System.out.println(""); } else if (a.getName().equals("Length")) { setLength(((Double)a.getValue()).doubleValue()); --- 454,458 ---- Attribute a = (Attribute)iter.next(); if (a.getName().equals("Name")) { ! continue; } else if (a.getName().equals("Length")) { setLength(((Double)a.getValue()).doubleValue()); Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Vertex.java 11 Feb 2006 18:16:54 -0000 1.26 --- Vertex.java 23 Feb 2006 14:05:13 -0000 1.27 *************** *** 348,352 **** Attribute a = (Attribute)iter.next(); if (a.getName().equals("Name")) { ! System.out.println(""); } else if (a.getName().equals("X")) { setX(((Double)a.getValue()).doubleValue()); --- 348,352 ---- Attribute a = (Attribute)iter.next(); if (a.getName().equals("Name")) { ! continue; } else if (a.getName().equals("X")) { setX(((Double)a.getValue()).doubleValue()); Index: Direction.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Direction.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Direction.java 16 Feb 2006 21:02:20 -0000 1.12 --- Direction.java 23 Feb 2006 14:05:13 -0000 1.13 *************** *** 32,38 **** */ public void alterDirection(Vertex v) { ! Vertex sum = v.add(direction); ! double value = sum.dot(direction) / (direction.length() * direction.length()); ! direction.scale(value); } --- 32,48 ---- */ public void alterDirection(Vertex v) { ! Vertex slideDir = v.add(direction); ! double slideScale; ! Vertex vunit = v.copy(); ! vunit.scale(1 / v.length()); ! if (v.getX() != 0) { ! slideScale = v.getX() / (slideDir.dot(vunit) * vunit.getX()); ! } else if (v.getY() != 0) { ! slideScale = v.getY() / (slideDir.dot(vunit) * vunit.getY()); ! } else { ! slideScale = v.getZ() / (slideDir.dot(vunit) * vunit.getZ()); ! } ! direction = slideDir; ! direction.scale(slideScale); } *************** *** 64,66 **** --- 74,84 ---- this.vertex = vertex; } + + /** + * The string representation of the Direstion + * @return The string representation of the Direstion + */ + public String toString() { + return "[Direction] " + vertex + ", dir: " + direction; + } } |
From: rimestad <rim...@us...> - 2006-02-23 14:05:25
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv660/src/net/sourceforge/bprocessor/gl/tool Modified Files: MultiExtrudeTool.java Log Message: Multiextrude work partially but is not activated yet... Edge and Vertex getAtt changed to not printing and Surface extrude changed a bit Index: MultiExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MultiExtrudeTool.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MultiExtrudeTool.java 16 Feb 2006 20:55:14 -0000 1.4 --- MultiExtrudeTool.java 23 Feb 2006 14:05:22 -0000 1.5 *************** *** 13,21 **** import java.util.HashMap; import java.util.HashSet; - import java.util.List; import java.util.Map; import java.util.Set; import java.util.Iterator; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.view.Transformation; --- 13,22 ---- import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.Iterator; + import org.apache.log4j.Logger; + import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.view.Transformation; *************** *** 32,36 **** */ public class MultiExtrudeTool extends SelectTool { ! /** The dragSurface and extrudesurface */ private Surface top, extrudeSurface; --- 33,39 ---- */ public class MultiExtrudeTool extends SelectTool { ! /** The logger */ ! private static Logger log = Logger.getLogger(MultiExtrudeTool.class); ! /** The dragSurface and extrudesurface */ private Surface top, extrudeSurface; *************** *** 42,50 **** private Plane dragPlane; - /** The vertices to extrude */ - private List vertices; - /** The previous coordinate */ ! private int prevX, prevY; /** --- 45,53 ---- private Plane dragPlane; /** The previous coordinate */ ! private int pressX, pressY; ! ! /** The previous position of the drag */ ! private double t; /** *************** *** 64,67 **** --- 67,71 ---- extrudeSurface = null; top = null; + t = 0; v2dir = new HashMap(); super.pressed(e); *************** *** 70,76 **** extrudeSurface = (Surface)target; View view = glv.getView(); ! Transformation trans = view.transformation(); ! double x = prevX; ! double y = View.getHeight() - prevY; Vertex near = new Vertex(x, y, 0.0); Vertex far = new Vertex(x, y, 1.0); --- 74,82 ---- 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); *************** *** 99,107 **** } View view = glv.getView(); ! Vertex from = view.toPlaneCoords(new double[] {prevX, prevY}, dragPlane); Vertex to = view.toPlaneCoords(new double[] {e.getX(), e.getY()}, dragPlane); Vertex delta = to.minus(from); double normDotDelta = normal.dot(delta); ! move(v2dir.values(), normDotDelta); } } --- 105,115 ---- } 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); ! moveTo(v2dir.values(), normDotDelta); ! } else { ! // TODO Tell somehow that the extrusion were illigal } } *************** *** 110,123 **** * Move a collection of vertex, direction pairs * @param which The colelction of pairs ! * @param delta The amount of the direction each vertex should move */ ! private void move(Collection which, double delta) { Iterator iter = which.iterator(); while (iter.hasNext()) { Direction d = (Direction)iter.next(); Vertex movement = d.getDirection(); ! movement.scale(delta); ! d.getVertex().move(movement.getX(), movement.getY(), movement.getZ()); } } --- 118,135 ---- * Move a collection of vertex, direction pairs * @param which The colelction of pairs ! * @param to The amount of the direction each vertex should move */ ! private void moveTo(Collection which, double to) { ! double delta = t - to; Iterator iter = which.iterator(); while (iter.hasNext()) { Direction d = (Direction)iter.next(); Vertex movement = d.getDirection(); ! log.info(d.getVertex() + " blev flyttet " + movement); ! Vertex v = movement.copy(); ! v.scale(delta); ! d.getVertex().move(v.getX(), v.getY(), v.getZ()); } + t = to; } *************** *** 128,131 **** --- 140,144 ---- protected void released(MouseEvent e) { super.released(e); + } *************** *** 139,143 **** Map e2e = new HashMap(); // edge to edge map Map e2s = new HashMap(); // edge to surface map - Map v2v = new HashMap(); // vertex to extruded edge map v2dir = new HashMap(); // vertex to direction map Map v2e = new HashMap(); // vertex to edge map --- 152,155 ---- *************** *** 148,152 **** while (iter.hasNext()) { if (!(iter.next() instanceof Surface)) { - extrudeSurface = null; return null; } --- 160,163 ---- *************** *** 154,163 **** iter = c.iterator(); while (iter.hasNext()) { ! // FIXME: following lines cannot compile ! // Surface s = ((Surface)iter.next()).extrude(1, elements, e2e, v2e, e2s, v2dir, v2v); ! // if (extrudeSurface == null) { ! // extrudeSurface = s; ! // } ! // elements.add(s); } return elements; --- 165,175 ---- iter = c.iterator(); while (iter.hasNext()) { ! Surface cur = (Surface)iter.next(); ! Surface s = cur.extrude(1, elements, e2e, v2e, e2s, v2dir); ! if (cur == extrudeSurface) { ! // Set the top to the extruded surface of target ! top = s; ! } ! elements.add(s); } return elements; |
From: Michael L. <he...@us...> - 2006-02-22 15:05:39
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21448/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Clean up Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** View.java 22 Feb 2006 10:57:26 -0000 1.63 --- View.java 22 Feb 2006 15:05:31 -0000 1.64 *************** *** 1087,1123 **** boolean deviceChanged) { } - - - /** - * Decorate Surface - * @param surface The Surface to decorate - */ - void decorateSurface(Surface surface) { - Vertex from = surface.center(); - CoordinateSystem system = surface.coordinateSystem(); - Vertex n = system.getN(); - - Edge edge = new Edge(from, from.add(n)); - gl.glColor3d(0.0, 0.0, 1.0); - drawEdge(edge); - } /** - * Draw special decoration on selection - * - */ - void decorateSelection() { - Collection selection = glv.getTool().getSelection(); - if (selection.size() == 1) { - Iterator iter = selection.iterator(); - while (iter.hasNext()) { - Object current = iter.next(); - if (current instanceof Surface) { - decorateSurface((Surface) current); - } - } - } - } - /** * Called when a space-label corresponding to the front of a Surface is selected. */ --- 1087,1092 ---- |
From: rimestad <rim...@us...> - 2006-02-22 11:33:26
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20670/src/net/sourceforge/bprocessor/model Modified Files: Project.java Selection.java Log Message: Selection of a camera changes the camera used in GL. It is selection that detects that the selected object is a camera and tells project to use that cam as currentCam. Index: Selection.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Selection.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Selection.java 13 Jan 2006 13:22:53 -0000 1.6 --- Selection.java 22 Feb 2006 11:03:23 -0000 1.7 *************** *** 142,145 **** --- 142,148 ---- current.update(this); } + if (!selection.isEmpty() && this.selection.get(0) instanceof Camera) { + Project.getInstance().setCurrentCamera((Camera)this.selection.get(0)); + } } Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** Project.java 14 Feb 2006 11:56:25 -0000 1.38 --- Project.java 22 Feb 2006 11:03:23 -0000 1.39 *************** *** 132,139 **** Camera cam0 = Camera.create(Camera.VIEW_3D); // The starting cam (copy of 3d cam) cam0.setId(new Long(cameraId++)); cameras.put(cam0.getId(), cam0); - Camera cam1 = Camera.create(Camera.VIEW_3D); // Reset to 3D position - cam1.setId(new Long(cameraId++)); - cameras.put(cam1.getId(), cam1); Camera cam2 = Camera.create(Camera.VIEW_XY); // Reset to 2D position XY with ortho cam2.setId(new Long(cameraId++)); --- 132,137 ---- Camera cam0 = Camera.create(Camera.VIEW_3D); // The starting cam (copy of 3d cam) cam0.setId(new Long(cameraId++)); + cam0.setName("default"); cameras.put(cam0.getId(), cam0); Camera cam2 = Camera.create(Camera.VIEW_XY); // Reset to 2D position XY with ortho cam2.setId(new Long(cameraId++)); |
From: Michael L. <he...@us...> - 2006-02-22 10:57:30
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17669/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Rearranging code Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** View.java 17 Feb 2006 14:45:19 -0000 1.62 --- View.java 22 Feb 2006 10:57:26 -0000 1.63 *************** *** 537,540 **** --- 537,1026 ---- /** + * The camera setup function + * @param gld The GLDrawable object + */ + public void initCamera(GLDrawable gld) { + if (log.isDebugEnabled()) { + log.debug("[display]"); + } [...979 lines suppressed...] - } - gl.glBegin(GL.GL_LINES); - gl.glDisable(GL.GL_DEPTH_TEST); - gl.glColor3fv(X_AXIS_COLOR); - gl.glVertex3d(0.0, 0.0, 0.0); - gl.glVertex3d(size, 0.0, 0.0); - gl.glColor3fv(Y_AXIS_COLOR); - gl.glVertex3d(0.0, 0.0, 0.0); - gl.glVertex3d(0.0, size, 0.0); - gl.glEnd(); - gl.glEnable(GL.GL_DEPTH_TEST); - gl.glBegin(GL.GL_LINES); - gl.glColor3fv(Z_AXIS_COLOR); - gl.glVertex3d(0.0, 0.0, 0.0); - gl.glVertex3d(0.0, 0.0, size); - gl.glEnd(); - } /** --- 2226,2229 ---- |
From: Michael L. <he...@us...> - 2006-02-22 09:02:51
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23938/src/net/sourceforge/bprocessor/gl/tool Modified Files: ExtrudeTool.java ClipplaneTool.java EraserTool.java Log Message: Changed selection behaviour in ExtrudeTool Index: ExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrudeTool.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ExtrudeTool.java 17 Feb 2006 09:56:06 -0000 1.11 --- ExtrudeTool.java 22 Feb 2006 09:02:45 -0000 1.12 *************** *** 93,100 **** if (e.isShiftDown()) { super.pressed(e); ! } else if (selection != null && !selection.isEmpty()) { ! if (target instanceof Surface) { sides = new HashSet(); ! extrudeSurface = (Surface) target; View view = glv.getView(); Transformation trans = view.transformation(); --- 93,101 ---- if (e.isShiftDown()) { super.pressed(e); ! } else if (!selection.isEmpty()) { ! Object object = selection.iterator().next(); ! if (object instanceof Surface) { sides = new HashSet(); ! extrudeSurface = (Surface) object; View view = glv.getView(); Transformation trans = view.transformation(); *************** *** 211,214 **** --- 212,224 ---- + /** + * @param e Event + */ + protected void moved(MouseEvent e) { + if (e.isShiftDown()) { + super.moved(e); + } + } + /** * Invoked when the mouse is held pressed and moved *************** *** 216,219 **** --- 226,233 ---- */ protected void dragged(MouseEvent e) { + if (e.isShiftDown()) { + super.dragged(e); + return; + } if (extrudeSurface != null) { Vertex normal; *************** *** 252,256 **** */ protected void released(MouseEvent e) { ! super.released(e); if (Math.abs(t) < 0.0000001) { if (top != null) { --- 266,272 ---- */ protected void released(MouseEvent e) { ! if (e.isShiftDown()) { ! super.released(e); ! } if (Math.abs(t) < 0.0000001) { if (top != null) { Index: EraserTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/EraserTool.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EraserTool.java 3 Feb 2006 14:53:19 -0000 1.1 --- EraserTool.java 22 Feb 2006 09:02:45 -0000 1.2 *************** *** 19,23 **** * EraserTool */ ! public class EraserTool extends SelectTool { /** --- 19,23 ---- * EraserTool */ ! public class EraserTool extends AbstractTool { /** *************** *** 61,64 **** --- 61,70 ---- */ protected void dragged(MouseEvent e) { } + + /** + * @param e Event + */ + protected void released(MouseEvent e) { + } Index: ClipplaneTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ClipplaneTool.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ClipplaneTool.java 7 Nov 2005 07:21:21 -0000 1.5 --- ClipplaneTool.java 22 Feb 2006 09:02:45 -0000 1.6 *************** *** 21,25 **** * The Clipplane tool */ ! public class ClipplaneTool extends SelectTool { /** The logger */ --- 21,25 ---- * The Clipplane tool */ ! public class ClipplaneTool extends AbstractTool { /** The logger */ *************** *** 40,44 **** */ protected void pressed(MouseEvent e) { ! super.pressed(e); if (e.getButton() == MouseEvent.BUTTON1) { if (target instanceof Surface) { --- 40,44 ---- */ protected void pressed(MouseEvent e) { ! findTarget(e); if (e.getButton() == MouseEvent.BUTTON1) { if (target instanceof Surface) { *************** *** 63,65 **** --- 63,91 ---- } } + + /** + * @param e Event + */ + protected void moved(MouseEvent e) { + findTarget(e); + if (target instanceof Surface) { + glv.getView().makeTarget(target); + } else { + glv.getView().makeTarget(null); + } + } + + /** + * @param e Event + */ + protected void dragged(MouseEvent e) { + + } + + /** + * @param e Event + */ + protected void released(MouseEvent e) { + + } } |
From: Michael L. <he...@us...> - 2006-02-17 14:45:44
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21403/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Log Message: New hit-detection algorithm Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** Edge.java 16 Feb 2006 21:04:53 -0000 1.35 --- Edge.java 17 Feb 2006 14:45:24 -0000 1.36 *************** *** 399,403 **** t = (q.getZ() - p0.getZ()) / r.getZ(); } ! if (t > 0 && t < 1) { r.scale(t); Vertex p = p0.add(r).minus(q); --- 399,403 ---- t = (q.getZ() - p0.getZ()) / r.getZ(); } ! if ((t > 0 && t < 1)) { r.scale(t); Vertex p = p0.add(r).minus(q); *************** *** 410,413 **** --- 410,440 ---- /** + * Tests if the vertex intersects with this Edge + * @param vertex The vertex + * @return The answer + */ + public boolean intersects(Vertex vertex) { + Vertex p0 = getFrom(); + Vertex p1 = getTo(); + Vertex r = p1.minus(p0); + Vertex q = vertex; + double t = 0.0; + + if (Math.abs(r.getX()) > 0.0000001) { + t = (q.getX() - p0.getX()) / r.getX(); + } else if (Math.abs(r.getY()) > 0.0000001) { + t = (q.getY() - p0.getY()) / r.getY(); + } else if (Math.abs(r.getZ()) > 0.0000001) { + t = (q.getZ() - p0.getZ()) / r.getZ(); + } + r.scale(t); + Vertex p = p0.add(r).minus(q); + if (p.length() < 0.0000001) { + return true; + } + return false; + } + + /** * Gets a vector representing the direction of the edge. * From the "from" point and to the "to" point |
From: Michael L. <he...@us...> - 2006-02-17 14:45:29
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21382/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: New hit-detection algorithm Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** View.java 14 Feb 2006 11:56:21 -0000 1.61 --- View.java 17 Feb 2006 14:45:19 -0000 1.62 *************** *** 1576,1602 **** } /** ! * Processes the select buffer. A set of entities that should ! * not be considered is specified. ! * @param unWantedEntities the collection og unwanted entities ! * @return the closest hit and null if no hit. */ private List processSelect(Collection unWantedEntities) { - List selection = new LinkedList(); int bufferOffset = 0; int names = 0; long zMax = 0xFFFFFFFFL; double nearest = 1.0; ! double nearestConstructor = 1.0; ! int id = -1; ! Edge closestConstructor = null; ! Object closest = null; ! Object current = null; ! Object candidate = null; ! Set vertices = new HashSet(); ! Set edges = new HashSet(); ! Set constructors = new HashSet(); for (int i = 0; i < hits; i++) { --- 1576,1604 ---- } + /** ! * Process Selection ! * @param unWantedEntities Entities to be ignored ! * @return Selection */ private List processSelect(Collection unWantedEntities) { int bufferOffset = 0; int names = 0; long zMax = 0xFFFFFFFFL; + double nearestSurface = 1.0; + Surface surface = null; + + double nearestVertex = 1.0; + Vertex vertex = null; + + double nearestEdge = 1.0; + Edge edge = null; + double nearest = 1.0; ! Object object = null; ! Collection edges = new HashSet(); ! List result = new LinkedList(); for (int i = 0; i < hits; i++) { *************** *** 1610,1777 **** bufferOffset += 2; ! id = selectBuffer.get(bufferOffset); ! current = getName(id); if (!unWantedEntities.contains(current)) { ! boolean isConstructor = false; ! if (current instanceof Vertex) { ! vertices.add(current); ! } else if (current instanceof Edge) { ! Edge e = (Edge) current; ! if (e.getConstructor()) { ! isConstructor = true; ! constructors.add(e); ! } else { ! edges.add(current); } ! } ! if (isConstructor) { ! if (near < nearestConstructor) { ! nearestConstructor = near; ! closestConstructor = (Edge) current; } } else { if (near < nearest) { ! nearest = near; ! closest = current; } } ! bufferOffset += names; ! } else { ! bufferOffset += 3; ! } } else { bufferOffset += 3; } } - - - if (closest instanceof ClippingPlane) { - selection.add(closest); - return selection; - } ! if (closest instanceof Surface) { ! Surface surface = (Surface) closest; ! CoordinateSystem system = surface.coordinateSystem(); ! ! ! { ! Iterator iter = vertices.iterator(); ! while (iter.hasNext() && (candidate == null)) { ! Vertex v = (Vertex) iter.next(); ! ! Vertex vLocal = system.translate(v); ! ! if (Math.abs(vLocal.getZ()) < 0.0000000001) { ! candidate = v; } } } ! ! { ! Iterator iter = edges.iterator(); ! while (iter.hasNext() && (candidate == null)) { ! Edge e = (Edge) iter.next(); ! Vertex from = e.getFrom(); ! Vertex to = e.getTo(); ! Vertex fromLocal = system.translate(from); ! Vertex toLocal = system.translate(to); ! boolean fromIn = (Math.abs(fromLocal.getZ()) < 0.0000000001); ! boolean toIn = (Math.abs(toLocal.getZ()) < 0.0000000001); ! ! if (fromIn && vertices.contains(from)) { ! candidate = from; ! break; ! } ! ! if (toIn && vertices.contains(to)) { ! candidate = to; ! break; ! } ! if (fromIn && toIn) { ! candidate = e; ! break; } } } } - if (closest instanceof Edge) { - Edge edge = (Edge) closest; - if (vertices.contains(edge.getFrom())) { - candidate = edge.getFrom(); - } - if (vertices.contains(edge.getTo())) { - candidate = edge.getTo(); - } - } - if (candidate != null) { - closest = candidate; - } ! if (closest == null) { ! selection.add(closestConstructor); ! Iterator iter = constructors.iterator(); ! while (iter.hasNext()) { ! Edge c = (Edge) iter.next(); ! if (c != closestConstructor) { ! selection.add(c); } } ! return selection; } else { ! if (closest instanceof Edge) { ! selection.add(closest); ! if (closestConstructor != null) { ! selection.add(closestConstructor); ! Iterator iter = constructors.iterator(); ! while (iter.hasNext()) { ! Edge c = (Edge) iter.next(); ! if (c != closestConstructor) { ! selection.add(c); ! } ! } ! } ! return selection; ! } ! if (closest instanceof Surface) { ! if (nearestConstructor < nearest) { ! if (closestConstructor != null) { ! selection.add(closestConstructor); ! Iterator iter = constructors.iterator(); ! while (iter.hasNext()) { ! Edge c = (Edge) iter.next(); ! if (c != closestConstructor) { ! selection.add(c); ! } ! } ! return selection; ! } } else { ! Surface surface = (Surface) closest; ! CoordinateSystem system = surface.coordinateSystem(); ! Iterator iter = constructors.iterator(); ! while (iter.hasNext()) { ! Edge e = (Edge) iter.next(); ! Vertex from = e.getFrom(); ! Vertex to = e.getTo(); ! Vertex fromLocal = system.translate(from); ! Vertex toLocal = system.translate(to); ! boolean fromIn = (Math.abs(fromLocal.getZ()) < 0.0000000001); ! boolean toIn = (Math.abs(toLocal.getZ()) < 0.0000000001); ! ! if (fromIn && toIn) { ! selection.add(e); ! } ! } ! if (!selection.isEmpty()) { ! return selection; } } } - selection.add(closest); - return selection; } } /** * Gets Entity under a point. For use in selection. --- 1612,1716 ---- bufferOffset += 2; ! int id = selectBuffer.get(bufferOffset); ! bufferOffset += names; ! Object current = getName(id); if (!unWantedEntities.contains(current)) { ! if (current instanceof Surface) { ! if (near < nearestSurface) { ! nearestSurface = near; ! surface = (Surface) current; ! if (near < nearest) { ! object = null; ! } } ! } else if (current instanceof Vertex) { ! if (near < nearestVertex) { ! nearestVertex = near; ! vertex = (Vertex) current; ! if (near < nearest) { ! object = null; ! } ! } ! } else if (current instanceof Edge) { ! edges.add(current); ! if (near < nearestEdge) { ! nearestEdge = near; ! edge = (Edge) current; ! if (near < nearest) { ! object = null; ! } } } else { if (near < nearest) { ! object = current; } } ! if (near < nearest) { ! nearest = near; ! } ! } } else { bufferOffset += 3; } } ! ! ! ! if (surface != null) { ! // Test vertex and edge against surface ! Plane plane = surface.plane(); ! if (vertex != null) { ! if (nearestSurface < nearestVertex) { ! if (!plane.contains(vertex)) { ! vertex = null; } } } ! if (edge != null) { ! if (nearestSurface < nearestEdge) { ! if (!plane.contains(edge)) { ! edge = null; } } } } ! ! ! if (edge != null && vertex != null) { ! // Test edge and vertex against each other ! if (nearestEdge < nearestVertex) { ! if (!edge.intersects(vertex)) { ! vertex = null; ! } else { ! edge = null; } } ! } ! ! ! if (object != null) { ! result.add(object); } else { ! if (vertex != null) { ! result.add(vertex); ! } else { ! if (edge != null) { ! result.add(edge); ! edges.remove(edge); ! result.addAll(edges); } else { ! if (surface != null) { ! result.add(surface); } } } } + return result; } + + /** * Gets Entity under a point. For use in selection. |
From: Nordholt <nor...@us...> - 2006-02-17 09:57:29
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5755/tool Modified Files: MoveTool.java Log Message: made changes in implementation of controlled move Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** MoveTool.java 16 Feb 2006 20:58:14 -0000 1.38 --- MoveTool.java 17 Feb 2006 09:57:24 -0000 1.39 *************** *** 26,29 **** --- 26,30 ---- import java.util.Collection; + import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; *************** *** 98,101 **** --- 99,109 ---- private Edge fromSlideEdge; + /** + * Mapping from each vertex being moved, + * to a vertex defining the direction of the + * edge the moving vertex slides on + */ + private HashMap slideMap; + /** The edge being moved in a controlled way */ private Edge controlled; *************** *** 113,116 **** --- 121,125 ---- toSlideEdge = null; fromSlideEdge = null; + slideMap = null; numberOfClicks = 1; moveMode = AXIS_RESTRICTED; *************** *** 297,346 **** //Restricting movement to fit movement mode. delta = restrict(delta, e); ! ! if (moveMode == CONTROLLED) { ! Vertex toDelta; ! Vertex fromDelta; ! ! Vertex deltaUnit = delta.copy(); ! deltaUnit.scale(1 / deltaUnit.length()); ! ! Vertex toDir = toSlideEdge.getTo().minus(toSlideEdge.getFrom()); ! double toScale; ! if (delta.getX() != 0) { ! toScale = delta.getX() / (toDir.dot(deltaUnit) * deltaUnit.getX()); ! } else if (delta.getY() != 0) { ! toScale = delta.getY() / (toDir.dot(deltaUnit) * deltaUnit.getY()); ! } else { ! toScale = delta.getZ() / (toDir.dot(deltaUnit) * deltaUnit.getZ()); ! } ! ! Vertex fromDir = fromSlideEdge.getTo().minus(fromSlideEdge.getFrom()); ! double fromScale; ! if (delta.getX() != 0) { ! fromScale = delta.getX() / (fromDir.dot(deltaUnit) * deltaUnit.getX()); ! } else if (delta.getY() != 0) { ! fromScale = delta.getY() / (fromDir.dot(deltaUnit) * deltaUnit.getY()); ! } else { ! fromScale = delta.getZ() / (fromDir.dot(deltaUnit) * deltaUnit.getZ()); ! } ! ! toDir.scale(toScale); ! toDelta = toDir; ! fromDir.scale(fromScale); ! fromDelta = fromDir; ! ! ! controlled.getTo().move(toDelta.getX(), toDelta.getY(), toDelta.getZ()); ! controlled.getFrom().move(fromDelta.getX(), fromDelta.getY(), fromDelta.getZ()); ! } ! if (log.isDebugEnabled()) { log.debug("from " + from.getX() + ", " + from.getY() + ", " + from.getZ()); log.debug("delta " + delta.getX() + ", " + delta.getY() + ", " + delta.getZ()); } ! //delta = snapToInitial(delta); if (moveMode != CONTROLLED) { move(vertices, delta); } from.move(delta.getX(), delta.getY(), delta.getZ()); --- 306,321 ---- //Restricting movement to fit movement mode. delta = restrict(delta, e); ! if (log.isDebugEnabled()) { log.debug("from " + from.getX() + ", " + from.getY() + ", " + from.getZ()); log.debug("delta " + delta.getX() + ", " + delta.getY() + ", " + delta.getZ()); } ! //delta = snapToInitial(delta); + if (moveMode != CONTROLLED) { move(vertices, delta); + } else { + slideMove(vertices, delta); } from.move(delta.getX(), delta.getY(), delta.getZ()); *************** *** 495,498 **** --- 470,476 ---- toSlideEdge = rightEdge; } + slideMap = new HashMap(); + slideMap.put(controlled.getTo(), toSlideEdge.getDirection()); + slideMap.put(controlled.getFrom(), fromSlideEdge.getDirection()); } else { dragPlane = null; *************** *** 634,637 **** --- 612,641 ---- } } + + /** + * Moves a set of vertices in a controlled way, so that they slide along + * vectors specified in the slideMap. + * @param vertices The vertices that should be moved. + * @param delta the movement. + */ + private void slideMove(Collection vertices, Vertex delta) { + Vertex deltaUnit = delta.copy(); + deltaUnit.scale(1 / delta.length()); + Iterator it = vertices.iterator(); + while (it.hasNext()) { + Vertex vertex = (Vertex)it.next(); + Vertex slideDir = (Vertex)slideMap.get(vertex); + double slideScale; + if (delta.getX() != 0) { + slideScale = delta.getX() / (slideDir.dot(deltaUnit) * deltaUnit.getX()); + } else if (delta.getY() != 0) { + slideScale = delta.getY() / (slideDir.dot(deltaUnit) * deltaUnit.getY()); + } else { + slideScale = delta.getZ() / (slideDir.dot(deltaUnit) * deltaUnit.getZ()); + } + slideDir.scale(slideScale); + vertex.move(slideDir.getX(), slideDir.getY(), slideDir.getZ()); + } + } /** |
From: Nordholt <nor...@us...> - 2006-02-17 09:56:16
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5100/tool Modified Files: ExtrudeTool.java RotationTool.java Log Message: holding down shift is now also required to make selection in rotationtool and extrudetool Index: ExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrudeTool.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ExtrudeTool.java 16 Feb 2006 21:11:35 -0000 1.10 --- ExtrudeTool.java 17 Feb 2006 09:56:06 -0000 1.11 *************** *** 91,107 **** prevY = e.getY(); number = new String(); ! super.pressed(e); ! if (target instanceof Surface) { ! sides = new HashSet(); ! extrudeSurface = (Surface) target; ! View view = glv.getView(); ! Transformation trans = view.transformation(); ! double x = prevX; ! double y = View.getHeight() - prevY; ! 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); } } --- 91,110 ---- prevY = e.getY(); number = new String(); ! if (e.isShiftDown()) { ! super.pressed(e); ! } else if (selection != null && !selection.isEmpty()) { ! if (target instanceof Surface) { ! sides = new HashSet(); ! extrudeSurface = (Surface) target; ! View view = glv.getView(); ! Transformation trans = view.transformation(); ! double x = prevX; ! double y = View.getHeight() - prevY; ! 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); ! } } } Index: RotationTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/RotationTool.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** RotationTool.java 11 Feb 2006 18:00:39 -0000 1.11 --- RotationTool.java 17 Feb 2006 09:56:06 -0000 1.12 *************** *** 86,123 **** */ protected void pressed(MouseEvent e) { ! super.pressed(e); ! if (target != null && target instanceof Entity) { ! // If one edge in a rotate circle are selected all should be ! if (xCircle.contains(target)) { ! axis = X_AXIS; ! clearConstructors(zCircle); ! clearConstructors(yCircle); ! } else if (yCircle.contains(target)) { ! axis = Y_AXIS; ! clearConstructors(xCircle); ! clearConstructors(zCircle); ! } else if (zCircle.contains(target)) { ! axis = Z_AXIS; ! clearConstructors(xCircle); ! clearConstructors(yCircle); ! } else { ! // ther were no rotation selection ! axis = 0; ! ! } ! if (axis != 0) { ! // do the rotation preparation and wait for drag events ! initial = findInitial(target, e); ! from = initial.copy(); ! prev = initial; ! Edge edge = new Edge(center, initial); ! edge.setConstructor(true); ! guide.clear(); ! guide.add(edge); ! displayConstructors(guide); } - } else { - clear(); } } --- 86,126 ---- */ 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 ! if (xCircle.contains(target)) { ! axis = X_AXIS; ! clearConstructors(zCircle); ! clearConstructors(yCircle); ! } else if (yCircle.contains(target)) { ! axis = Y_AXIS; ! clearConstructors(xCircle); ! clearConstructors(zCircle); ! } else if (zCircle.contains(target)) { ! axis = Z_AXIS; ! clearConstructors(xCircle); ! clearConstructors(yCircle); ! } else { ! // ther were no rotation selection ! axis = 0; ! ! } ! if (axis != 0) { ! // do the rotation preparation and wait for drag events ! initial = findInitial(target, e); ! from = initial.copy(); ! prev = initial; ! Edge edge = new Edge(center, initial); ! edge.setConstructor(true); ! guide.clear(); ! guide.add(edge); ! displayConstructors(guide); ! } ! } else { ! clear(); } } } *************** *** 170,182 **** */ protected void dragged(MouseEvent e) { ! super.dragged(e); ! if (target != null && ! (xCircle.contains(target) || yCircle.contains(target) || zCircle.contains(target))) { ! Vertex ny = findInitial(target, e); ! initial.setX(ny.getX()); ! initial.setY(ny.getY()); ! initial.setZ(ny.getZ()); ! ! prev = initial; } } --- 173,188 ---- */ protected void dragged(MouseEvent e) { ! if (e.isShiftDown()) { ! super.dragged(e); ! } else { ! if (target != null && ! (xCircle.contains(target) || yCircle.contains(target) || zCircle.contains(target))) { ! Vertex ny = findInitial(target, e); ! initial.setX(ny.getX()); ! initial.setY(ny.getY()); ! initial.setZ(ny.getZ()); ! ! prev = initial; ! } } } |