bprocessor-commit Mailing List for B-processor (Page 136)
Status: Pre-Alpha
Brought to you by:
henryml
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(117) |
Aug
(151) |
Sep
(157) |
Oct
(81) |
Nov
(117) |
Dec
(119) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(183) |
Feb
(130) |
Mar
(117) |
Apr
(61) |
May
(82) |
Jun
(45) |
Jul
(149) |
Aug
(173) |
Sep
(199) |
Oct
(165) |
Nov
(107) |
Dec
(137) |
2007 |
Jan
(124) |
Feb
(58) |
Mar
(123) |
Apr
(80) |
May
(130) |
Jun
(64) |
Jul
(31) |
Aug
(42) |
Sep
(114) |
Oct
(167) |
Nov
(239) |
Dec
(200) |
2008 |
Jan
(43) |
Feb
(43) |
Mar
(4) |
Apr
(9) |
May
(5) |
Jun
(1) |
Jul
(3) |
Aug
(3) |
Sep
(13) |
Oct
(9) |
Nov
(12) |
Dec
|
2009 |
Jan
|
Feb
(20) |
Mar
(7) |
Apr
(12) |
May
(34) |
Jun
(72) |
Jul
|
Aug
(3) |
Sep
(31) |
Oct
(2) |
Nov
(8) |
Dec
(4) |
2010 |
Jan
(5) |
Feb
(32) |
Mar
(8) |
Apr
(7) |
May
(36) |
Jun
|
Jul
(11) |
Aug
(15) |
Sep
(7) |
Oct
(2) |
Nov
(13) |
Dec
(80) |
2011 |
Jan
|
Feb
|
Mar
(8) |
Apr
(12) |
May
(32) |
Jun
(9) |
Jul
(5) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
(8) |
2012 |
Jan
|
Feb
|
Mar
(3) |
Apr
(5) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(22) |
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: rimestad <rim...@us...> - 2006-02-03 20:11:53
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18258/src/net/sourceforge/bprocessor/gui/attrview Modified Files: StringAttribute.java GenericPanel.java Log Message: added stringattribute so that i also handle Doubles and added support for the attributes with value = null Index: StringAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/StringAttribute.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** StringAttribute.java 3 Feb 2006 15:23:00 -0000 1.1 --- StringAttribute.java 3 Feb 2006 20:11:45 -0000 1.2 *************** *** 67,71 **** this.add(Box.createHorizontalStrut(7)); component = Box.createHorizontalBox(); ! component.add(createValueLabel((String)attribute.getValue())); this.add(component); this.add(Box.createHorizontalGlue()); --- 67,71 ---- this.add(Box.createHorizontalStrut(7)); component = Box.createHorizontalBox(); ! component.add(createValueLabel(attribute.getValue())); this.add(component); this.add(Box.createHorizontalGlue()); *************** *** 135,140 **** * @return The label */ ! private JComponent createValueLabel(String value) { ! JLabel valueLabel = new JLabel(value); valueLabel.setFont(AttributePanel.FONT_PLAIN); return valueLabel; --- 135,146 ---- * @return The label */ ! private JComponent createValueLabel(Object value) { ! String s = ""; ! if (value instanceof String) { ! s = (String)value; ! } else if (value instanceof Double) { ! s = ((Double) value).toString(); ! } ! JLabel valueLabel = new JLabel(s); valueLabel.setFont(AttributePanel.FONT_PLAIN); return valueLabel; *************** *** 146,151 **** * @return The editor */ ! private JComponent createValueEditor(String value) { ! JTextField valueEditor = new JTextField(value); valueEditor.setFont(AttributePanel.FONT_PLAIN); return valueEditor; --- 152,163 ---- * @return The editor */ ! private JComponent createValueEditor(Object value) { ! String s = ""; ! if (value instanceof String) { ! s = (String)value; ! } else if (value instanceof Double) { ! s = ((Double) value).toString(); ! } ! JTextField valueEditor = new JTextField(s); valueEditor.setFont(AttributePanel.FONT_PLAIN); return valueEditor; *************** *** 166,170 **** if (editor == null) { component.remove(0); ! editor = (JTextField) createValueEditor((String)attribute.getValue()); editor.addKeyListener(this); component.add(editor); --- 178,182 ---- if (editor == null) { component.remove(0); ! editor = (JTextField) createValueEditor(attribute.getValue()); editor.addKeyListener(this); component.add(editor); *************** *** 181,189 **** public void stopEditing() { if (editor != null) { component.remove(editor); - attribute.setValue(editor.getText()); editor.removeKeyListener(this); editor = null; ! component.add(createValueLabel((String)attribute.getValue())); component.revalidate(); valueChanged(); --- 193,206 ---- public void stopEditing() { if (editor != null) { + Object val = attribute.getValue(); + if (val instanceof String) { + attribute.setValue(editor.getText()); + } else if (val instanceof Double) { + attribute.setValue(Double.valueOf(editor.getText())); + } component.remove(editor); editor.removeKeyListener(this); editor = null; ! component.add(createValueLabel(attribute.getValue())); component.revalidate(); valueChanged(); Index: GenericPanel.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/GenericPanel.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GenericPanel.java 3 Feb 2006 15:23:00 -0000 1.1 --- GenericPanel.java 3 Feb 2006 20:11:45 -0000 1.2 *************** *** 14,17 **** --- 14,18 ---- import javax.swing.Box; import javax.swing.BoxLayout; + import javax.swing.JLabel; import javax.swing.JPanel; *************** *** 57,61 **** while (iter.hasNext()) { Attribute a = (Attribute)iter.next(); ! if (a.getValue() instanceof String) { StringAttribute sa = new StringAttribute(a); sa.addStringAttributeListener(new AttributeListener() { --- 58,62 ---- while (iter.hasNext()) { Attribute a = (Attribute)iter.next(); ! if (a.getValue() instanceof String || a.getValue() instanceof Double) { StringAttribute sa = new StringAttribute(a); sa.addStringAttributeListener(new AttributeListener() { *************** *** 67,70 **** --- 68,74 ---- sa.addMouseListener(this); content.add(new AttributeRow(sa)); + } else if (a.getValue() == null) { + // Just a label + content.add(new JLabel(a.getName())); } } |
From: rimestad <rim...@us...> - 2006-02-03 15:24:15
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13607/src/net/sourceforge/bprocessor/model Removed Files: Attributes.java Log Message: removed --- Attributes.java DELETED --- |
From: rimestad <rim...@us...> - 2006-02-03 15:23:58
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13407/src/net/sourceforge/bprocessor/model Modified Files: Camera.java Log Message: fixed small illigal typecast Index: Camera.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Camera.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Camera.java 2 Feb 2006 10:55:14 -0000 1.10 --- Camera.java 3 Feb 2006 15:23:47 -0000 1.11 *************** *** 408,424 **** setType(((String)a.getValue()).equals("Orthographic") ? ORTHOGRAPHIC : PERSPECTIVE); } else if (a.getName().equals("Camera")) { ! Double x = (Double)iter.next(); ! Double y = (Double)iter.next(); ! Double z = (Double)iter.next(); setCamera(new double[]{x.doubleValue(), y.doubleValue(), z.doubleValue()}); } else if (a.getName().equals("Center")) { ! Double x = (Double)iter.next(); ! Double y = (Double)iter.next(); ! Double z = (Double)iter.next(); setCenter(new double[]{x.doubleValue(), y.doubleValue(), z.doubleValue()}); } else if (a.getName().equals("Roll")) { ! Double x = (Double)iter.next(); ! Double y = (Double)iter.next(); ! Double z = (Double)iter.next(); setRoll(new double[]{x.doubleValue(), y.doubleValue(), z.doubleValue()}); } else if (a.getName().equals("Focalwidth")) { --- 408,424 ---- setType(((String)a.getValue()).equals("Orthographic") ? ORTHOGRAPHIC : PERSPECTIVE); } else if (a.getName().equals("Camera")) { ! Double x = (Double)((Attribute)iter.next()).getValue(); ! Double y = (Double)((Attribute)iter.next()).getValue(); ! Double z = (Double)((Attribute)iter.next()).getValue(); setCamera(new double[]{x.doubleValue(), y.doubleValue(), z.doubleValue()}); } else if (a.getName().equals("Center")) { ! Double x = (Double)((Attribute)iter.next()).getValue(); ! Double y = (Double)((Attribute)iter.next()).getValue(); ! Double z = (Double)((Attribute)iter.next()).getValue(); setCenter(new double[]{x.doubleValue(), y.doubleValue(), z.doubleValue()}); } else if (a.getName().equals("Roll")) { ! Double x = (Double)((Attribute)iter.next()).getValue(); ! Double y = (Double)((Attribute)iter.next()).getValue(); ! Double z = (Double)((Attribute)iter.next()).getValue(); setRoll(new double[]{x.doubleValue(), y.doubleValue(), z.doubleValue()}); } else if (a.getName().equals("Focalwidth")) { |
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13111/src/net/sourceforge/bprocessor/gui/attrview Modified Files: AttributeView.java Added Files: AttributePanel.java GenericAttribute.java StringAttribute.java GenericPanel.java AttributeListener.java Log Message: Split AttributeView into AttributePanel and GenericPanel and made GenericPanel more usefull --- NEW FILE: StringAttribute.java --- //--------------------------------------------------------------------------------- // $Id: StringAttribute.java,v 1.1 2006/02/03 15:23:00 rimestad Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui.attrview; import java.awt.Dimension; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; 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; /** * The StringAttributeView */ public class StringAttribute extends GenericAttribute implements KeyListener, 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 EditableAttribute is being edited */ private JTextField editor; /** * Constructor for StringAttribute * @param attribute The attribute */ public StringAttribute(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(header); 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((String)attribute.getValue())); this.add(component); this.add(Box.createHorizontalGlue()); label.addMouseListener(this); component.addMouseListener(this); } /** * Create a label for the * @param key The key * @return A JLabel */ private JLabel createLabel(String key) { JLabel keyLabel = new JLabel(key + " :"); keyLabel.setFont(AttributePanel.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 addStringAttributeListener(AttributeListener listener) { listeners.add(listener); } /** * Remove a listener * @param listener The listener */ public void removeStringAttributeListener(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(String value) { JLabel valueLabel = new JLabel(value); valueLabel.setFont(AttributePanel.FONT_PLAIN); return valueLabel; } /** * Create a value editor * @param value The value * @return The editor */ private JComponent createValueEditor(String value) { JTextField valueEditor = new JTextField(value); valueEditor.setFont(AttributePanel.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 (editor == null) { component.remove(0); editor = (JTextField) createValueEditor((String)attribute.getValue()); editor.addKeyListener(this); 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) { component.remove(editor); attribute.setValue(editor.getText()); editor.removeKeyListener(this); editor = null; component.add(createValueLabel((String)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.removeKeyListener(this); editor = null; component.add(createValueLabel((String)attribute.getValue())); component.revalidate(); } } /** * Respond to the enter key by stopping editing. * @param event The KeyEvent */ public void keyPressed(KeyEvent event) { if (event.getKeyCode() == KeyEvent.VK_ENTER) { stopEditing(); } else if (event.getKeyCode() == KeyEvent.VK_ESCAPE) { cancelEditing(); } } /** * Not in use * @param event The KeyEvent */ public void keyTyped(KeyEvent event) { } /** * Not in use * @param event The KeyEvent */ public void keyReleased(KeyEvent event) { } /** * 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) { } } --- NEW FILE: AttributeListener.java --- //--------------------------------------------------------------------------------- // $Id: AttributeListener.java,v 1.1 2006/02/03 15:23:00 rimestad Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui.attrview; import java.util.EventListener; import net.sourceforge.bprocessor.model.Attribute; /** * The StringAttributeListener */ public interface AttributeListener extends EventListener { /** * Called when the value has changed * @param attribute The attribute that have changed */ public void valueChanged(Attribute attribute); } --- NEW FILE: AttributePanel.java --- //--------------------------------------------------------------------------------- // $Id: AttributePanel.java,v 1.1 2006/02/03 15:23:00 rimestad Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui.attrview; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.BorderFactory; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.border.Border; import net.sourceforge.bprocessor.gui.Defaults; import net.sourceforge.bprocessor.model.Camera; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Material; import net.sourceforge.bprocessor.model.Space; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; import org.apache.log4j.Logger; /** * Attributes panel */ class AttributePanel extends JPanel { /** The logger */ private static Logger log = Logger.getLogger(AttributePanel.class); /** Current object */ private Object current; /** The font used in plain */ public static final Font FONT_PLAIN = new Font("Sans-serif", Font.PLAIN, 12); /** The font used in bold */ public static final Font FONT_BOLD = new Font("Sans-serif", Font.BOLD, 12); /** If its a textfield */ public static final int TFIELD = 1; /** If its a textfield */ public static final int TAREA = 2; /** The length field */ public static final int LENGTH = 3; /** The X coordinate */ public static final int XCOOR = 4; /** The Y coordinate */ public static final int YCOOR = 5; /** The Z coordinate */ public static final int ZCOOR = 6; /** * Constructor */ AttributePanel() { current = null; } /** * Get current * @return Current */ public Object getCurrent() { return current; } /** * Display the construction space * @param o The object */ void displaySpace(Space o) { GridBagLayout layout = new GridBagLayout(); GridBagConstraints con = new GridBagConstraints(); setLayout(layout); JLabel name = new JLabel("Name:"); con.anchor = GridBagConstraints.NORTHEAST; con.weightx = 0; layout.setConstraints(name, con); name.setFont(FONT_BOLD); add(name); JTextField nameEdit = new JTextField(o.getName()); con.gridwidth = GridBagConstraints.REMAINDER; con.weightx = 1.0; con.fill = GridBagConstraints.HORIZONTAL; layout.setConstraints(nameEdit, con); nameEdit.setFont(FONT_PLAIN); add(nameEdit); nameEdit.addKeyListener(new MyKeyListener(o, TFIELD)); JTextArea descriptionEditor = new JTextArea(o.getDescription()); descriptionEditor.setLineWrap(true); descriptionEditor.setWrapStyleWord(true); con.weighty = 1.0; con.fill = GridBagConstraints.BOTH; layout.setConstraints(descriptionEditor, con); descriptionEditor.addFocusListener(new MyFocusListener(o)); add(descriptionEditor); } /** * Make AWT color from the components * @param rgb Array of floats * @return AWT Color */ private Color makeAWTColor(float[] rgb) { return new Color(rgb[0], rgb[1], rgb[2]); } /** * Get AWT color for material * @param material The material * @return The AWT color */ private Color getMaterialColor(Material material) { float[] rgb = material.getColor(); return new Color(rgb[0], rgb[1], rgb[2]); } /** * Return front color for surface * @param surface The surface * @return The color */ private float[] getFrontColor(Surface surface) { if (surface.getFrontDomain() == null) { return Defaults.getNoneColor(); } else { if (surface.getFrontMaterial() == null) { Space space = surface.getFrontDomain(); if (space.isConstructionSpace()) { return Defaults.getFrontColor(); } if (space.isFunctionalSpace()) { return Defaults.getBackColor(); } return Defaults.getNoneColor(); } else { return surface.getFrontMaterial().getColor(); } } } /** * Return back color for surface * @param surface The surface * @return The color */ private float[] getBackColor(Surface surface) { if (surface.getBackDomain() == null) { return Defaults.getNoneColor(); } else { if (surface.getBackMaterial() == null) { Space space = surface.getBackDomain(); if (space.isConstructionSpace()) { return Defaults.getFrontColor(); } if (space.isFunctionalSpace()) { return Defaults.getBackColor(); } return Defaults.getNoneColor(); } else { return surface.getBackMaterial().getColor(); } } } /** * Display the edge * @param o The object */ void displayVertex(Vertex o) { GridBagLayout layout = new GridBagLayout(); GridBagConstraints con = new GridBagConstraints(); setLayout(layout); JLabel name = new JLabel("Name: "); con.anchor = GridBagConstraints.NORTH; con.weightx = 0; layout.setConstraints(name, con); name.setFont(FONT_BOLD); add(name); JLabel vertexName = new JLabel(o.getName()); layout.setConstraints(vertexName, con); vertexName.setFont(FONT_PLAIN); add(vertexName); JPanel hfiller = new JPanel(); hfiller.setOpaque(true); con.weightx = 1.0; con.gridwidth = GridBagConstraints.REMAINDER; layout.setConstraints(hfiller, con); add(hfiller); JLabel x = new JLabel("X: "); con.anchor = GridBagConstraints.NORTH; con.gridwidth = 1; con.weightx = 0; layout.setConstraints(x, con); x.setFont(FONT_BOLD); add(x); int xval = (int) (o.getX() * 10000); JTextField xEdit = new JTextField((Double.toString(((double) xval) / 10000))); con.gridwidth = GridBagConstraints.REMAINDER; con.weightx = 1.0; con.fill = GridBagConstraints.HORIZONTAL; layout.setConstraints(xEdit, con); xEdit.setFont(FONT_PLAIN); add(xEdit); xEdit.addKeyListener(new MyKeyListener(o, XCOOR)); JLabel y = new JLabel("Y: "); con.gridwidth = 1; con.weightx = 0; con.fill = GridBagConstraints.NONE; layout.setConstraints(y, con); y.setFont(FONT_BOLD); add(y); int yval = (int) (o.getY() * 10000); JTextField yEdit = new JTextField((Double.toString(((double) yval) / 10000))); con.gridwidth = GridBagConstraints.REMAINDER; con.weightx = 1.0; con.fill = GridBagConstraints.HORIZONTAL; layout.setConstraints(yEdit, con); yEdit.setFont(FONT_PLAIN); add(yEdit); yEdit.addKeyListener(new MyKeyListener(o, YCOOR)); JLabel z = new JLabel("Z: "); con.gridwidth = 1; con.weightx = 0; con.fill = GridBagConstraints.NONE; layout.setConstraints(z, con); z.setFont(FONT_BOLD); add(z); int zval = (int) (o.getZ() * 10000); JTextField zEdit = new JTextField((Double.toString(((double) zval) / 10000))); con.gridwidth = GridBagConstraints.REMAINDER; con.weightx = 1.0; con.fill = GridBagConstraints.HORIZONTAL; layout.setConstraints(zEdit, con); zEdit.setFont(FONT_PLAIN); add(zEdit); zEdit.addKeyListener(new MyKeyListener(o, ZCOOR)); JPanel vfiller = new JPanel(); vfiller.setOpaque(true); con.weighty = 1.0; con.fill = GridBagConstraints.BOTH; layout.setConstraints(vfiller, con); add(vfiller); } /** * Display the edge * @param o The object */ void displayEdge(Edge o) { GridBagLayout layout = new GridBagLayout(); GridBagConstraints con = new GridBagConstraints(); setLayout(layout); JLabel name = new JLabel("Name: "); con.anchor = GridBagConstraints.NORTH; con.weightx = 0; layout.setConstraints(name, con); name.setFont(FONT_BOLD); add(name); JLabel edgeName = new JLabel(o.getName()); layout.setConstraints(edgeName, con); edgeName.setFont(FONT_PLAIN); add(edgeName); JPanel hfiller = new JPanel(); hfiller.setOpaque(true); con.weightx = 1.0; con.gridwidth = GridBagConstraints.REMAINDER; layout.setConstraints(hfiller, con); add(hfiller); JLabel length = new JLabel("Length: "); con.anchor = GridBagConstraints.NORTH; con.weightx = 0; con.gridwidth = 1; layout.setConstraints(length, con); length.setFont(FONT_BOLD); add(length); int l = (int) (o.getLength() * 10000); JTextField lengthEdit = new JTextField((Double.toString(((double) l) / 10000))); con.gridwidth = GridBagConstraints.REMAINDER; con.weightx = 1.0; con.fill = GridBagConstraints.HORIZONTAL; layout.setConstraints(lengthEdit, con); lengthEdit.setFont(FONT_PLAIN); add(lengthEdit); lengthEdit.addKeyListener(new MyKeyListener(o, LENGTH)); JPanel vfiller = new JPanel(); vfiller.setOpaque(true); con.weighty = 1.0; con.fill = GridBagConstraints.BOTH; layout.setConstraints(vfiller, con); add(vfiller); } /** * Display the surface * @param o The object */ void displaySurface(Surface o) { GridBagLayout layout = new GridBagLayout(); GridBagConstraints con = new GridBagConstraints(); setLayout(layout); JLabel name = new JLabel("Name: "); con.anchor = GridBagConstraints.NORTH; con.weightx = 0; layout.setConstraints(name, con); name.setFont(FONT_BOLD); add(name); JLabel surfaceName = new JLabel(o.getName()); layout.setConstraints(surfaceName, con); surfaceName.setFont(FONT_PLAIN); add(surfaceName); JPanel hfiller = new JPanel(); hfiller.setOpaque(true); con.weightx = 1.0; con.gridwidth = GridBagConstraints.REMAINDER; layout.setConstraints(hfiller, con); add(hfiller); JLabel fspace = new JLabel("Space: "); con.weightx = 0; con.gridwidth = 1; layout.setConstraints(fspace, con); fspace.setFont(FONT_BOLD); add(fspace); String fsn; if (o.getFrontDomain() == null) { fsn = "None"; } else { fsn = o.getFrontDomain().getName(); } JLabel frontSpaceName = new JLabel(fsn); layout.setConstraints(frontSpaceName, con); con.weightx = 1; con.fill = GridBagConstraints.HORIZONTAL; con.gridwidth = GridBagConstraints.REMAINDER; layout.setConstraints(frontSpaceName, con); frontSpaceName.setFont(FONT_PLAIN); add(frontSpaceName); { float[] frontColor = getFrontColor(o); JPanel front = new JPanel(); front.setOpaque(true); Border blackline = BorderFactory.createLineBorder(Color.black); front.setBorder(blackline); front.setBackground(makeAWTColor(frontColor)); con.weightx = 1.0; con.fill = GridBagConstraints.HORIZONTAL; con.gridwidth = GridBagConstraints.REMAINDER; layout.setConstraints(front, con); add(front); front.addMouseListener(new MyMouseListener(o, true)); //true = front color to be changed } JLabel bspace = new JLabel("Space: "); con.weightx = 0; con.gridwidth = 1; layout.setConstraints(bspace, con); bspace.setFont(FONT_BOLD); add(bspace); String bsn; if (o.getBackDomain() == null) { bsn = "None"; } else { bsn = o.getBackDomain().getName(); } JLabel backSpaceName = new JLabel(bsn); layout.setConstraints(backSpaceName, con); con.weightx = 1; con.gridwidth = GridBagConstraints.REMAINDER; layout.setConstraints(backSpaceName, con); backSpaceName.setFont(FONT_PLAIN); add(backSpaceName); { float[] backColor = getBackColor(o); JPanel back = new JPanel(); back.setOpaque(true); Border blackline = BorderFactory.createLineBorder(Color.black); back.setBorder(blackline); back.setBackground(makeAWTColor(backColor)); con.weightx = 1.0; con.fill = GridBagConstraints.HORIZONTAL; con.gridwidth = GridBagConstraints.REMAINDER; layout.setConstraints(back, con); add(back); back.addMouseListener(new MyMouseListener(o, false)); //false = back color to be changed } JPanel vfiller = new JPanel(); vfiller.setOpaque(true); con.weighty = 1.0; con.fill = GridBagConstraints.BOTH; layout.setConstraints(vfiller, con); add(vfiller); } /** * Display the camera * @param c The camera */ void displayCamera(Camera c) { GridBagLayout layout = new GridBagLayout(); GridBagConstraints con = new GridBagConstraints(); setLayout(layout); JLabel name = new JLabel("Name: "); con.anchor = GridBagConstraints.NORTH; con.weightx = 0; layout.setConstraints(name, con); name.setFont(FONT_BOLD); add(name); JLabel cameraName = new JLabel(c.getName()); layout.setConstraints(cameraName, con); cameraName.setFont(FONT_PLAIN); add(cameraName); // make a empty line JPanel hfiller = new JPanel(); hfiller.setOpaque(true); con.weightx = 1.0; con.gridwidth = GridBagConstraints.REMAINDER; layout.setConstraints(hfiller, con); add(hfiller); // make tab indentation JLabel emptyLine = new JLabel(" "); con.weightx = 1; con.gridwidth = GridBagConstraints.REMAINDER; layout.setConstraints(emptyLine, con); add(emptyLine); con.gridwidth = 2; JPanel type = new JPanel(); type.setMinimumSize(new Dimension(120, 120)); type.setBorder(BorderFactory.createTitledBorder("Type")); type.setLayout(new GridBagLayout()); GridBagConstraints typeCon = new GridBagConstraints(); typeCon.fill = GridBagConstraints.HORIZONTAL; typeCon.gridwidth = 2; // Let top label cover 2 collums typeCon.weightx = 0.5; typeCon.gridx = 0; typeCon.gridy = 0; JLabel cam = new JLabel("Camera:"); cam.setFont(FONT_BOLD); type.add(cam, typeCon); // ADD the camera coordinates double[] camera = c.getCamera(); typeCon.gridwidth = 1; typeCon.gridx = 0; typeCon.gridy = 1; JLabel camxl = new JLabel("x:"); type.add(camxl, typeCon); JTextField camx = new JTextField("" + camera[0]); typeCon.gridx = 1; typeCon.gridy = 1; type.add(camx, typeCon); JLabel camyl = new JLabel("y:"); typeCon.gridx = 0; typeCon.gridy = 2; type.add(camyl, typeCon); JTextField camy = new JTextField("" + camera[1]); typeCon.gridx = 1; typeCon.gridy = 2; type.add(camy, typeCon); JLabel camzl = new JLabel("z:"); typeCon.gridx = 0; typeCon.gridy = 3; type.add(camzl, typeCon); JTextField camz = new JTextField("" + camera[2]); typeCon.gridx = 1; typeCon.gridy = 3; type.add(camz, typeCon); // ADD the eye pointcoordinates typeCon.gridwidth = 2; // Let top label cover 2 collums double[] eye = c.getCenter(); typeCon.gridx = 0; typeCon.gridy = 4; JLabel eyel = new JLabel("Eye-point:"); cam.setFont(FONT_BOLD); type.add(eyel, typeCon); typeCon.gridwidth = 1; JLabel eyexl = new JLabel("x:"); typeCon.gridx = 0; typeCon.gridy = 5; type.add(eyexl, typeCon); JTextField eyex = new JTextField("" + eye[0]); typeCon.gridx = 1; typeCon.gridy = 5; type.add(eyex, typeCon); JLabel eyeyl = new JLabel("y:"); typeCon.gridx = 0; typeCon.gridy = 6; type.add(eyeyl, typeCon); JTextField eyey = new JTextField("" + eye[1]); typeCon.gridx = 1; typeCon.gridy = 6; type.add(eyey, typeCon); JLabel eyezl = new JLabel("z:"); typeCon.gridx = 0; typeCon.gridy = 7; type.add(eyezl, typeCon); JTextField eyez = new JTextField("" + eye[2]); typeCon.gridx = 1; typeCon.gridy = 7; type.add(eyez, typeCon); // ADD the roll coordinates typeCon.gridwidth = 2; // Let top label cover 2 collums double[] roll = c.getRoll(); typeCon.gridx = 0; typeCon.gridy = 8; JLabel rolll = new JLabel("Roll:"); cam.setFont(FONT_BOLD); type.add(rolll, typeCon); typeCon.gridwidth = 1; JLabel rollxl = new JLabel("x:"); typeCon.gridx = 0; typeCon.gridy = 9; type.add(rollxl, typeCon); JTextField rollx = new JTextField("" + roll[0]); typeCon.gridx = 1; typeCon.gridy = 9; type.add(rollx, typeCon); JLabel rollyl = new JLabel("y:"); typeCon.gridx = 0; typeCon.gridy = 10; type.add(rollyl, typeCon); JTextField rolly = new JTextField("" + roll[1]); typeCon.gridx = 1; typeCon.gridy = 10; type.add(rolly, typeCon); JLabel rollzl = new JLabel("z:"); typeCon.gridx = 0; typeCon.gridy = 11; type.add(rollzl, typeCon); JTextField rollz = new JTextField("" + roll[2]); typeCon.gridx = 1; typeCon.gridy = 11; type.add(rollz, typeCon); add(type, con); } /** * Display the object * @param o The object */ void display(Object o) { current = o; removeAll(); if (current instanceof Space) { Space space = (Space) current; displaySpace(space); } else if (current instanceof Surface) { displaySurface((Surface) current); } else if (current instanceof Camera) { displayCamera((Camera) current); } else if (current instanceof Edge) { displayEdge((Edge) current); } else if (current instanceof Vertex) { displayVertex((Vertex) current); } else { if (current != null) { log.info("display " + current); } } revalidate(); } } --- NEW FILE: GenericAttribute.java --- //--------------------------------------------------------------------------------- // $Id: GenericAttribute.java,v 1.1 2006/02/03 15:23:00 rimestad Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui.attrview; import javax.swing.Box; import net.sourceforge.bprocessor.model.Attribute; /** * The AbstractAttribute interface for objects representing *one* attribute */ public abstract class GenericAttribute extends Box { /** * Constructor * @param arg0 The same argument as for Box (BoxLayout) */ public GenericAttribute(int arg0) { super(arg0); } /** * Return the attribute for this gui attribute * @return The name */ public abstract Attribute attribute(); /** * Called when editing is started on this attribute * Should change the component to an editing state */ public abstract void startEditing(); /** * Called when editing is stopped on this attribute * Should send a valueChanged to any listeners in concrete attribute, * and change the component to the default non-editing state */ public abstract void stopEditing(); /** * Called when editing should be cancelled on this attribute. * Should change the state back to before editing was started. * Should not send events the listeners. */ public abstract void cancelEditing(); } --- NEW FILE: GenericPanel.java --- //--------------------------------------------------------------------------------- // $Id: GenericPanel.java,v 1.1 2006/02/03 15:23:00 rimestad Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui.attrview; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.util.Iterator; import java.util.List; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JPanel; import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Parametric; /** * A generic panel for classes that implement the parametric interface */ class GenericPanel extends JPanel implements MouseListener { /** The current object shown */ private Parametric obj; /** The list of attributes */ private List attributes; /** The box of content */ private Box content; /** The current edited attribute */ private GenericAttribute current; /** * The constructor * @param param The content */ public GenericPanel(Parametric param) { super(); this.content = Box.createVerticalBox(); obj = param; attributes = param.getAttributes(); generateContent(attributes); add(this.content); addMouseListener(this); } /** * local method for generating the content * @param what The list of attrinutes */ private void generateContent(List what) { Iterator iter = what.iterator(); while (iter.hasNext()) { Attribute a = (Attribute)iter.next(); if (a.getValue() instanceof String) { StringAttribute sa = new StringAttribute(a); sa.addStringAttributeListener(new AttributeListener() { public void valueChanged(Attribute a) { System.out.println("WOW"); obj.setAttributes(attributes); } }); sa.addMouseListener(this); content.add(new AttributeRow(sa)); } } } /** * Start editing the specified AttributeView * @param ga The genericAttribute to edit */ public void startEditing(GenericAttribute ga) { if (current != null) { current.stopEditing(); } current = ga; if (current != null) { ga.startEditing(); } } /** * Stop editing the current AttributeView */ public void stopEditing() { if (current != null) { current.stopEditing(); current = null; } } /** * Stop editing the current attribute * @param event The mouse event */ public void mouseClicked(MouseEvent event) { stopEditing(); } /** * 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) { } /** * The AttributeRow */ protected class AttributeRow extends Box implements MouseListener { /** The AttributeView displayed in this AttributeRow */ private GenericAttribute ga; /** * Constructor for AttributeRow * @param ga The generic attribute to put in the */ public AttributeRow(GenericAttribute ga) { super(BoxLayout.X_AXIS); this.ga = ga; this.add(ga); ga.addMouseListener(this); } /** * Start editing on the view * @param event The event */ public void mouseClicked(MouseEvent event) { startEditing(ga); } /** * 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) { } } } Index: AttributeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/AttributeView.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** AttributeView.java 2 Feb 2006 10:55:19 -0000 1.31 --- AttributeView.java 3 Feb 2006 15:23:00 -0000 1.32 *************** *** 7,38 **** package net.sourceforge.bprocessor.gui.attrview; - import net.sourceforge.bprocessor.gui.Defaults; - import net.sourceforge.bprocessor.model.Attribute; - import net.sourceforge.bprocessor.model.Camera; - import net.sourceforge.bprocessor.model.Material; import net.sourceforge.bprocessor.model.Observer; import net.sourceforge.bprocessor.model.Parametric; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Selection; - import net.sourceforge.bprocessor.model.Space; - import net.sourceforge.bprocessor.model.Surface; - import net.sourceforge.bprocessor.model.Edge; - import net.sourceforge.bprocessor.model.Vertex; - import java.awt.Color; import java.awt.Dimension; - import java.awt.Font; - import java.awt.GridBagLayout; - import java.awt.GridBagConstraints; - import java.util.Iterator; - import java.util.List; - import javax.swing.BorderFactory; - import javax.swing.JLabel; import javax.swing.JPanel; - import javax.swing.JTabbedPane; - import javax.swing.JTextArea; - import javax.swing.JTextField; - import javax.swing.border.Border; import org.apache.log4j.Logger; --- 7,18 ---- *************** *** 41,51 **** * The attribute view */ ! public class AttributeView extends JTabbedPane implements Observer { /** The logger */ private static Logger log = Logger.getLogger(AttributeView.class); - /** The attributes panel */ - private JPanel container; - /** * Constructor --- 21,28 ---- * The attribute view */ ! public class AttributeView extends JPanel implements Observer { /** The logger */ private static Logger log = Logger.getLogger(AttributeView.class); /** * Constructor *************** *** 53,60 **** public AttributeView() { super(); - - container = new JPanel(); - - addTab("Attributes", container); setMinimumSize(new Dimension(120, 240)); setPreferredSize(new Dimension(120, 240)); --- 30,33 ---- *************** *** 71,82 **** if (selection.size() > 0) { Object o = selection.iterator().next(); ! container.removeAll(); if (o instanceof Parametric) { ! log.info("Were Parametric" + o); ! container.add(new GenericPanel((Parametric)o)); } else { ! AttributesPanel ap = new AttributesPanel(); ap.display(o); ! container.add(ap); } } --- 44,54 ---- if (selection.size() > 0) { Object o = selection.iterator().next(); ! this.removeAll(); if (o instanceof Parametric) { ! this.add(new GenericPanel((Parametric)o)); } else { ! AttributePanel ap = new AttributePanel(); ap.display(o); ! this.add(ap); } } *************** *** 86,712 **** ap.display(current); }*/ repaint(); } - - /** - * A generic panel for classes that implement the parametric interface - */ - class GenericPanel extends JPanel { - /** The current object shown */ - private Parametric obj; - - /** - * The constructor - * @param content The content - */ - public GenericPanel(Parametric content) { - super(); - obj = content; - generateContent(content.getAttributes()); - } - - /** - * local method for generating the content - * @param what The list of attrinutes - */ - private void generateContent(List what) { - Iterator iter = what.iterator(); - while (iter.hasNext()) { - Attribute a = (Attribute)iter.next(); - if (a.getValue() instanceof String) { - this.add(new JLabel((String)(a.getValue()))); - } - } - } - } - - /** - * Attributes panel - */ - class AttributesPanel extends JPanel { - /** Current object */ - private Object current; - - /** The font used in plain */ - private Font fontPlain = new Font("Sans-serif", Font.PLAIN, 12); - - /** The font used in bold */ - private Font fontBold = new Font("Sans-serif", Font.BOLD, 12); - - /** If its a textfield */ - public static final int TFIELD = 1; - - /** If its a textfield */ - public static final int TAREA = 2; - - /** The length field */ - public static final int LENGTH = 3; - - /** The X coordinate */ - public static final int XCOOR = 4; - - /** The Y coordinate */ - public static final int YCOOR = 5; - - /** The Z coordinate */ - public static final int ZCOOR = 6; - - /** - * Constructor - */ - AttributesPanel() { - current = null; - } - - /** - * Get current - * @return Current - */ - public Object getCurrent() { - return current; - } - /** - * Display the construction space - * @param o The object - */ - void displaySpace(Space o) { - GridBagLayout layout = new GridBagLayout(); - GridBagConstraints con = new GridBagConstraints(); - setLayout(layout); - - JLabel name = new JLabel("Name:"); - con.anchor = GridBagConstraints.NORTHEAST; - con.weightx = 0; - layout.setConstraints(name, con); - name.setFont(fontBold); - add(name); - - - JTextField nameEdit = new JTextField(o.getName()); - con.gridwidth = GridBagConstraints.REMAINDER; - con.weightx = 1.0; - con.fill = GridBagConstraints.HORIZONTAL; - layout.setConstraints(nameEdit, con); - nameEdit.setFont(fontPlain); - add(nameEdit); - nameEdit.addKeyListener(new MyKeyListener(o, TFIELD)); - - JTextArea descriptionEditor = new JTextArea(o.getDescription()); - descriptionEditor.setLineWrap(true); - descriptionEditor.setWrapStyleWord(true); - con.weighty = 1.0; - con.fill = GridBagConstraints.BOTH; - layout.setConstraints(descriptionEditor, con); - descriptionEditor.addFocusListener(new MyFocusListener(o)); - add(descriptionEditor); - } - - /** - * Make AWT color from the components - * @param rgb Array of floats - * @return AWT Color - */ - private Color makeAWTColor(float[] rgb) { - return new Color(rgb[0], rgb[1], rgb[2]); - } - - /** - * Get AWT color for material - * @param material The material - * @return The AWT color - */ - private Color getMaterialColor(Material material) { - float[] rgb = material.getColor(); - return new Color(rgb[0], rgb[1], rgb[2]); - } - - /** - * Return front color for surface - * @param surface The surface - * @return The color - */ - private float[] getFrontColor(Surface surface) { - if (surface.getFrontDomain() == null) { - return Defaults.getNoneColor(); - } else { - if (surface.getFrontMaterial() == null) { - Space space = surface.getFrontDomain(); - if (space.isConstructionSpace()) { - return Defaults.getFrontColor(); - } - if (space.isFunctionalSpace()) { - return Defaults.getBackColor(); - } - return Defaults.getNoneColor(); - } else { - return surface.getFrontMaterial().getColor(); - } - } - } - - /** - * Return back color for surface - * @param surface The surface - * @return The color - */ - private float[] getBackColor(Surface surface) { - if (surface.getBackDomain() == null) { - return Defaults.getNoneColor(); - } else { - if (surface.getBackMaterial() == null) { - Space space = surface.getBackDomain(); - if (space.isConstructionSpace()) { - return Defaults.getFrontColor(); - } - if (space.isFunctionalSpace()) { - return Defaults.getBackColor(); - } - return Defaults.getNoneColor(); - } else { - return surface.getBackMaterial().getColor(); - } - } - } - - /** - * Display the edge - * @param o The object - */ - void displayVertex(Vertex o) { - GridBagLayout layout = new GridBagLayout(); - GridBagConstraints con = new GridBagConstraints(); - setLayout(layout); - - JLabel name = new JLabel("Name: "); - con.anchor = GridBagConstraints.NORTH; - con.weightx = 0; - layout.setConstraints(name, con); - name.setFont(fontBold); - add(name); - - JLabel vertexName = new JLabel(o.getName()); - layout.setConstraints(vertexName, con); - vertexName.setFont(fontPlain); - add(vertexName); - - JPanel hfiller = new JPanel(); - hfiller.setOpaque(true); - con.weightx = 1.0; - con.gridwidth = GridBagConstraints.REMAINDER; - layout.setConstraints(hfiller, con); - add(hfiller); - - JLabel x = new JLabel("X: "); - con.anchor = GridBagConstraints.NORTH; - con.gridwidth = 1; - con.weightx = 0; - layout.setConstraints(x, con); - x.setFont(fontBold); - add(x); - - int xval = (int) (o.getX() * 10000); - JTextField xEdit = new JTextField((Double.toString(((double) xval) / 10000))); - con.gridwidth = GridBagConstraints.REMAINDER; - con.weightx = 1.0; - con.fill = GridBagConstraints.HORIZONTAL; - layout.setConstraints(xEdit, con); - xEdit.setFont(fontPlain); - add(xEdit); - xEdit.addKeyListener(new MyKeyListener(o, XCOOR)); - - JLabel y = new JLabel("Y: "); - con.gridwidth = 1; - con.weightx = 0; - con.fill = GridBagConstraints.NONE; - layout.setConstraints(y, con); - y.setFont(fontBold); - add(y); - - int yval = (int) (o.getY() * 10000); - JTextField yEdit = new JTextField((Double.toString(((double) yval) / 10000))); - con.gridwidth = GridBagConstraints.REMAINDER; - con.weightx = 1.0; - con.fill = GridBagConstraints.HORIZONTAL; - layout.setConstraints(yEdit, con); - yEdit.setFont(fontPlain); - add(yEdit); - yEdit.addKeyListener(new MyKeyListener(o, YCOOR)); - - JLabel z = new JLabel("Z: "); - con.gridwidth = 1; - con.weightx = 0; - con.fill = GridBagConstraints.NONE; - layout.setConstraints(z, con); - z.setFont(fontBold); - add(z); - - int zval = (int) (o.getZ() * 10000); - JTextField zEdit = new JTextField((Double.toString(((double) zval) / 10000))); - con.gridwidth = GridBagConstraints.REMAINDER; - con.weightx = 1.0; - con.fill = GridBagConstraints.HORIZONTAL; - layout.setConstraints(zEdit, con); - zEdit.setFont(fontPlain); - add(zEdit); - zEdit.addKeyListener(new MyKeyListener(o, ZCOOR)); - - JPanel vfiller = new JPanel(); - vfiller.setOpaque(true); - con.weighty = 1.0; - con.fill = GridBagConstraints.BOTH; - layout.setConstraints(vfiller, con); - add(vfiller); - - - - } - - /** - * Display the edge - * @param o The object - */ - void displayEdge(Edge o) { - GridBagLayout layout = new GridBagLayout(); - GridBagConstraints con = new GridBagConstraints(); - setLayout(layout); - - JLabel name = new JLabel("Name: "); - con.anchor = GridBagConstraints.NORTH; - con.weightx = 0; - layout.setConstraints(name, con); - name.setFont(fontBold); - add(name); - - JLabel edgeName = new JLabel(o.getName()); - layout.setConstraints(edgeName, con); - edgeName.setFont(fontPlain); - add(edgeName); - - JPanel hfiller = new JPanel(); - hfiller.setOpaque(true); - con.weightx = 1.0; - con.gridwidth = GridBagConstraints.REMAINDER; - layout.setConstraints(hfiller, con); - add(hfiller); - - JLabel length = new JLabel("Length: "); - con.anchor = GridBagConstraints.NORTH; - con.weightx = 0; - con.gridwidth = 1; - layout.setConstraints(length, con); - length.setFont(fontBold); - add(length); - - int l = (int) (o.getLength() * 10000); - JTextField lengthEdit = new JTextField((Double.toString(((double) l) / 10000))); - con.gridwidth = GridBagConstraints.REMAINDER; - con.weightx = 1.0; - con.fill = GridBagConstraints.HORIZONTAL; - layout.setConstraints(lengthEdit, con); - lengthEdit.setFont(fontPlain); - add(lengthEdit); - lengthEdit.addKeyListener(new MyKeyListener(o, LENGTH)); - - - JPanel vfiller = new JPanel(); - vfiller.setOpaque(true); - con.weighty = 1.0; - con.fill = GridBagConstraints.BOTH; - layout.setConstraints(vfiller, con); - add(vfiller); - - - } - - - /** - * Display the surface - * @param o The object - */ - void displaySurface(Surface o) { - GridBagLayout layout = new GridBagLayout(); - GridBagConstraints con = new GridBagConstraints(); - setLayout(layout); - - JLabel name = new JLabel("Name: "); - con.anchor = GridBagConstraints.NORTH; - con.weightx = 0; - layout.setConstraints(name, con); - name.setFont(fontBold); - add(name); - - JLabel surfaceName = new JLabel(o.getName()); - layout.setConstraints(surfaceName, con); - surfaceName.setFont(fontPlain); - add(surfaceName); - - JPanel hfiller = new JPanel(); - hfiller.setOpaque(true); - con.weightx = 1.0; - con.gridwidth = GridBagConstraints.REMAINDER; - layout.setConstraints(hfiller, con); - add(hfiller); - - JLabel fspace = new JLabel("Space: "); - con.weightx = 0; - con.gridwidth = 1; - layout.setConstraints(fspace, con); - fspace.setFont(fontBold); - add(fspace); - - String fsn; - if (o.getFrontDomain() == null) { - fsn = "None"; - } else { - fsn = o.getFrontDomain().getName(); - } - - JLabel frontSpaceName = new JLabel(fsn); - layout.setConstraints(frontSpaceName, con); - con.weightx = 1; - con.fill = GridBagConstraints.HORIZONTAL; - con.gridwidth = GridBagConstraints.REMAINDER; - layout.setConstraints(frontSpaceName, con); - frontSpaceName.setFont(fontPlain); - add(frontSpaceName); - - { - float[] frontColor = getFrontColor(o); - JPanel front = new JPanel(); - front.setOpaque(true); - Border blackline = BorderFactory.createLineBorder(Color.black); - front.setBorder(blackline); - front.setBackground(makeAWTColor(frontColor)); - con.weightx = 1.0; - con.fill = GridBagConstraints.HORIZONTAL; - con.gridwidth = GridBagConstraints.REMAINDER; - layout.setConstraints(front, con); - add(front); - front.addMouseListener(new MyMouseListener(o, true)); //true = front color to be changed - } - - JLabel bspace = new JLabel("Space: "); - con.weightx = 0; - con.gridwidth = 1; - layout.setConstraints(bspace, con); - bspace.setFont(fontBold); - add(bspace); - - String bsn; - if (o.getBackDomain() == null) { - bsn = "None"; - } else { - bsn = o.getBackDomain().getName(); - } - - JLabel backSpaceName = new JLabel(bsn); - layout.setConstraints(backSpaceName, con); - con.weightx = 1; - con.gridwidth = GridBagConstraints.REMAINDER; - layout.setConstraints(backSpaceName, con); - backSpaceName.setFont(fontPlain); - add(backSpaceName); - - { - float[] backColor = getBackColor(o); - JPanel back = new JPanel(); - back.setOpaque(true); - Border blackline = BorderFactory.createLineBorder(Color.black); - back.setBorder(blackline); - back.setBackground(makeAWTColor(backColor)); - con.weightx = 1.0; - con.fill = GridBagConstraints.HORIZONTAL; - con.gridwidth = GridBagConstraints.REMAINDER; - layout.setConstraints(back, con); - add(back); - back.addMouseListener(new MyMouseListener(o, false)); //false = back color to be changed - } - - JPanel vfiller = new JPanel(); - vfiller.setOpaque(true); - con.weighty = 1.0; - con.fill = GridBagConstraints.BOTH; - layout.setConstraints(vfiller, con); - add(vfiller); - } - - /** - * Display the camera - * @param c The camera - */ - void displayCamera(Camera c) { - GridBagLayout layout = new GridBagLayout(); - GridBagConstraints con = new GridBagConstraints(); - setLayout(layout); - - JLabel name = new JLabel("Name: "); - con.anchor = GridBagConstraints.NORTH; - con.weightx = 0; - layout.setConstraints(name, con); - name.setFont(fontBold); - add(name); - - JLabel cameraName = new JLabel(c.getName()); - layout.setConstraints(cameraName, con); - cameraName.setFont(fontPlain); - add(cameraName); - - // make a empty line - JPanel hfiller = new JPanel(); - hfiller.setOpaque(true); - con.weightx = 1.0; - con.gridwidth = GridBagConstraints.REMAINDER; - layout.setConstraints(hfiller, con); - add(hfiller); - - // make tab indentation - JLabel emptyLine = new JLabel(" "); - con.weightx = 1; - con.gridwidth = GridBagConstraints.REMAINDER; - layout.setConstraints(emptyLine, con); - add(emptyLine); - - con.gridwidth = 2; - JPanel type = new JPanel(); - type.setMinimumSize(new Dimension(120, 120)); - type.setBorder(BorderFactory.createTitledBorder("Type")); - type.setLayout(new GridBagLayout()); - GridBagConstraints typeCon = new GridBagConstraints(); - typeCon.fill = GridBagConstraints.HORIZONTAL; - typeCon.gridwidth = 2; // Let top label cover 2 collums - typeCon.weightx = 0.5; - typeCon.gridx = 0; - typeCon.gridy = 0; - JLabel cam = new JLabel("Camera:"); - cam.setFont(fontBold); - type.add(cam, typeCon); - - // ADD the camera coordinates - double[] camera = c.getCamera(); - typeCon.gridwidth = 1; - typeCon.gridx = 0; - typeCon.gridy = 1; - JLabel camxl = new JLabel("x:"); - type.add(camxl, typeCon); - JTextField camx = new JTextField("" + camera[0]); - typeCon.gridx = 1; - typeCon.gridy = 1; - type.add(camx, typeCon); - JLabel camyl = new JLabel("y:"); - typeCon.gridx = 0; - typeCon.gridy = 2; - type.add(camyl, typeCon); - JTextField camy = new JTextField("" + camera[1]); - typeCon.gridx = 1; - typeCon.gridy = 2; - type.add(camy, typeCon); - JLabel camzl = new JLabel("z:"); - typeCon.gridx = 0; - typeCon.gridy = 3; - type.add(camzl, typeCon); - JTextField camz = new JTextField("" + camera[2]); - typeCon.gridx = 1; - typeCon.gridy = 3; - type.add(camz, typeCon); - - // ADD the eye pointcoordinates - typeCon.gridwidth = 2; // Let top label cover 2 collums - - double[] eye = c.getCenter(); - typeCon.gridx = 0; - typeCon.gridy = 4; - JLabel eyel = new JLabel("Eye-point:"); - cam.setFont(fontBold); - type.add(eyel, typeCon); - typeCon.gridwidth = 1; - JLabel eyexl = new JLabel("x:"); - typeCon.gridx = 0; - typeCon.gridy = 5; - type.add(eyexl, typeCon); - JTextField eyex = new JTextField("" + eye[0]); - typeCon.gridx = 1; - typeCon.gridy = 5; - type.add(eyex, typeCon); - JLabel eyeyl = new JLabel("y:"); - typeCon.gridx = 0; - typeCon.gridy = 6; - type.add(eyeyl, typeCon); - JTextField eyey = new JTextField("" + eye[1]); - typeCon.gridx = 1; - typeCon.gridy = 6; - type.add(eyey, typeCon); - JLabel eyezl = new JLabel("z:"); - typeCon.gridx = 0; - typeCon.gridy = 7; - type.add(eyezl, typeCon); - JTextField eyez = new JTextField("" + eye[2]); - typeCon.gridx = 1; - typeCon.gridy = 7; - type.add(eyez, typeCon); - - - // ADD the roll coordinates - typeCon.gridwidth = 2; // Let top label cover 2 collums - double[] roll = c.getRoll(); - typeCon.gridx = 0; - typeCon.gridy = 8; - JLabel rolll = new JLabel("Roll:"); - cam.setFont(fontBold); - type.add(rolll, typeCon); - typeCon.gridwidth = 1; - JLabel rollxl = new JLabel("x:"); - typeCon.gridx = 0; - typeCon.gridy = 9; - type.add(rollxl, typeCon); - JTextField rollx = new JTextField("" + roll[0]); - typeCon.gridx = 1; - typeCon.gridy = 9; - type.add(rollx, typeCon); - JLabel rollyl = new JLabel("y:"); - typeCon.gridx = 0; - typeCon.gridy = 10; - type.add(rollyl, typeCon); - JTextField rolly = new JTextField("" + roll[1]); - typeCon.gridx = 1; - typeCon.gridy = 10; - type.add(rolly, typeCon); - JLabel rollzl = new JLabel("z:"); - typeCon.gridx = 0; - typeCon.gridy = 11; - type.add(rollzl, typeCon); - JTextField rollz = new JTextField("" + roll[2]); - typeCon.gridx = 1; - typeCon.gridy = 11; - type.add(rollz, typeCon); - - add(type, con); - } - - /** - * Display the object - * @param o The object - */ - void display(Object o) { - current = o; - removeAll(); - if (current instanceof Space) { - Space space = (Space) current; - displaySpace(space); - } else if (current instanceof Surface) { - displaySurface((Surface) current); - } else if (current instanceof Camera) { - displayCamera((Camera) current); - } else if (current instanceof Edge) { - displayEdge((Edge) current); - } else if (current instanceof Vertex) { - displayVertex((Vertex) current); - } else { - if (current != null) { - log.info("display " + current); - } - } - revalidate(); - } - } } - --- 58,63 ---- ap.display(current); }*/ + revalidate(); repaint(); } } |
From: Michael L. <he...@us...> - 2006-02-03 14:53:30
|
Update of /cvsroot/bprocessor/gl/src/gfx In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1867/src/gfx Added Files: Biconeraser.gif Log Message: Eraser Tool implemented (erases lines) --- NEW FILE: Biconeraser.gif --- (This appears to be a binary file; contents omitted.) |
From: Michael L. <he...@us...> - 2006-02-03 14:53:30
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1867/src/net/sourceforge/bprocessor/gl/tool Modified Files: Tool.java ToolFactory.java Added Files: EraserTool.java Log Message: Eraser Tool implemented (erases lines) Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** ToolFactory.java 1 Feb 2006 10:04:28 -0000 1.28 --- ToolFactory.java 3 Feb 2006 14:53:19 -0000 1.29 *************** *** 48,51 **** --- 48,54 ---- /** pencil tool */ private PencilTool pencil; + + /** eraser tool */ + private EraserTool eraser; /** pencil tool */ *************** *** 75,78 **** --- 78,84 ---- /** The pencil button */ private JToggleButton pencilBut; + + /** The eraser button */ + private JToggleButton eraserBut; /** The move button */ *************** *** 133,136 **** --- 139,148 ---- bg.add(pencilBut); pencilBut.setToolTipText("Pencil"); + + eraserBut = tb.registerAction(new EraserAction(glv)); + bg.add(eraserBut); + eraserBut.setToolTipText("Eraser"); + + moveBut = tb.registerAction(new MoveAction(glv)); bg.add(moveBut); *************** *** 162,165 **** --- 174,178 ---- select = new SpaceTool(glv, null); pencil = new PencilTool(glv, pencilcursor); + eraser = new EraserTool(glv, pencilcursor); move = new MoveTool(glv, pencilcursor); rotation = new RotationTool(glv, pencilcursor); *************** *** 240,243 **** --- 253,259 ---- tmBut.setSelected(true); currentTool = tapeMeasure; + } else if (i == Tool.ERASER_TOOL) { + eraserBut.setSelected(true); + currentTool = eraser; } else { log.error("[get] No such tool " + i); *************** *** 482,485 **** --- 498,533 ---- /** + * EraserAction + */ + class EraserAction extends AbstractAction { + /** The GLView */ + private GLView glv = null; + + /** The mouse cursor */ + private Cursor cursor; + + /** + * Constructor + * @param glv TheGLView + */ + EraserAction(GLView glv) { + this.glv = glv; + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + URL url = cl.getResource("Biconeraser.gif"); + ImageIcon im = new ImageIcon(url); + putValue(Action.SMALL_ICON, im); + } + + /** + * Called when the button is pressed + * @param e The ActionEvent + */ + public void actionPerformed(ActionEvent e) { + glv.changeTool(Tool.ERASER_TOOL); + } + } + + + /** * The clipping action inner class */ --- NEW FILE: EraserTool.java --- //--------------------------------------------------------------------------------- // $Id: EraserTool.java,v 1.1 2006/02/03 14:53:19 henryml Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gl.tool; import java.awt.Cursor; import java.awt.event.MouseEvent; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Project; /** * EraserTool */ public class EraserTool extends SelectTool { /** * Constructor fo EraserTool * @param glv The GLView * @param cursor The Cursor */ public EraserTool(GLView glv, Cursor cursor) { super(glv, cursor); } /** * Invoked when the mouse cursor has been moved * @param e The MouseEvent object */ protected void moved(MouseEvent e) { findTarget(e); if (target instanceof Edge) { glv.getView().makeTarget(target); } else { glv.getView().makeTarget(null); } } /** * Invoked when a mouse button has been pressed on a component. * @param e The MouseEvent object */ protected void pressed(MouseEvent e) { findTarget(e); if (target instanceof Edge) { Project.getInstance().delete((Edge) target); } else { glv.getView().makeTarget(null); } } /** * Invoked when a mouse button has dragged with button down. * @param e The MouseEvent object */ protected void dragged(MouseEvent e) { } } Index: Tool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Tool.java 27 Jan 2006 11:43:37 -0000 1.17 --- Tool.java 3 Feb 2006 14:53:17 -0000 1.18 *************** *** 40,43 **** --- 40,45 ---- /** The Rotation tool */ public static final int ROTATION_TOOL = 9; + /** The Eraser tool */ + public static final int ERASER_TOOL = 10; /** |
From: Michael L. <he...@us...> - 2006-02-03 13:01:58
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10169/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Vertex.java Surface.java Mesh.java Plane.java Log Message: Deleting an edge will combine adjacent coplanar surfaces Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** Surface.java 2 Feb 2006 14:18:35 -0000 1.71 --- Surface.java 3 Feb 2006 13:01:49 -0000 1.72 *************** *** 164,184 **** public Vertex getFirstVertex() { List edges = getEdges(); ! if (edges.size() == 0) { ! return null; ! } else if (edges.size() == 1) { ! Edge e0 = (Edge) edges.get(0); ! return e0.getFrom(); ! } else { ! Edge e0 = (Edge) edges.get(0); ! Edge e1 = (Edge) edges.get(1); ! Vertex current = null; ! if (!e1.contains(e0.getFrom())) { ! return e0.getFrom(); ! } ! if (!e1.contains(e0.getTo())) { ! return e0.getTo(); ! } ! } ! return null; } --- 164,168 ---- public Vertex getFirstVertex() { List edges = getEdges(); ! return Edge.first(edges); } Index: Mesh.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Mesh.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Mesh.java 2 Feb 2006 10:53:44 -0000 1.8 --- Mesh.java 3 Feb 2006 13:01:49 -0000 1.9 *************** *** 9,12 **** --- 9,13 ---- import java.util.Collection; + import java.util.Collections; import java.util.HashMap; import java.util.Iterator; *************** *** 168,171 **** --- 169,179 ---- { + // Find adjacent surfaces that must be combined to one surface. + // + // First the adjacent surfaces are partioned into groups of + // coplanar surfaces. + // If there is only one group consisting of two coplanar surfaces + // these two surfaces are combined. + List partions = new LinkedList(); List work = new LinkedList(surfaces); *************** *** 173,179 **** Iterator iter = work.iterator(); Surface first = (Surface) iter.next(); ! CoordinateSystem system = first.coordinateSystem(); List partion = new LinkedList(); ! } } --- 181,260 ---- Iterator iter = work.iterator(); Surface first = (Surface) iter.next(); ! iter.remove(); ! Plane plane = first.plane(); List partion = new LinkedList(); ! partion.add(first); ! while (iter.hasNext()) { ! Surface current = (Surface) iter.next(); ! if (plane.contains(current)) { ! partion.add(current); ! iter.remove(); ! } ! } ! partions.add(partion); ! } ! int count = 0; ! List partion = null; ! { ! Iterator iter = partions.iterator(); ! while (iter.hasNext()) { ! List current = (List) iter.next(); ! if (current.size() == 2) { ! count++; ! partion = current; ! } ! } ! } ! if (count == 1) { ! Surface s1 = (Surface) partion.get(0); ! Surface s2 = (Surface) partion.get(1); ! List edges1 = new LinkedList(); ! List edges2 = new LinkedList(); ! { ! boolean gab = false; ! List prefix = new LinkedList(); ! Iterator iter = s1.getEdges().iterator(); ! while (iter.hasNext()) { ! Edge current = (Edge) iter.next(); ! if (!s2.contains(current)) { ! if (!gab) { ! prefix.add(current); ! } else { ! edges1.add(current); ! } ! } else { ! gab = true; ! } ! } ! edges1.addAll(prefix); ! } ! { ! boolean gab = false; ! List prefix = new LinkedList(); ! Iterator iter = s2.getEdges().iterator(); ! while (iter.hasNext()) { ! Edge current = (Edge) iter.next(); ! if (!s1.contains(current)) { ! if (!gab) { ! prefix.add(current); ! } else { ! edges2.add(current); ! } ! } else { ! gab = true; ! } ! } ! edges2.addAll(prefix); ! } ! if (Edge.first(edges1) == Edge.first(edges2)) { ! Collections.reverse(edges2); ! } ! edges1.addAll(edges2); ! Surface surface = new Surface(edges1); ! add(surface); ! if (s1.getExterior() != null) { ! s1.getExterior().addHole(surface); ! // FIXME: Assign spaces ! } } } Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Vertex.java 1 Feb 2006 11:45:25 -0000 1.22 --- Vertex.java 3 Feb 2006 13:01:49 -0000 1.23 *************** *** 218,222 **** */ public double dot(Vertex v) { ! return this.getX() * v.getX() + this.getY() * v.getY() + this.getZ() * v.getZ(); } --- 218,222 ---- */ public double dot(Vertex v) { ! return x * v.x + y * v.y + z * v.z; } Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Edge.java 1 Feb 2006 11:45:25 -0000 1.30 --- Edge.java 3 Feb 2006 13:01:49 -0000 1.31 *************** *** 12,15 **** --- 12,16 ---- import java.util.HashSet; import java.util.Iterator; + import java.util.List; import java.util.Set; *************** *** 34,37 **** --- 35,65 ---- /** Constructor */ private boolean constructor; + + /** + * Return the first vertex in a list of edges. + * The first vertex is defined as the a vertex + * in the first edge that are not shared with the + * second edge + * @param edges The list edges + * @return The first vertex + */ + public static Vertex first(List edges) { + if (edges.size() == 0) { + return null; + } else if (edges.size() == 1) { + Edge e0 = (Edge) edges.get(0); + return e0.getFrom(); + } else { + Edge e0 = (Edge) edges.get(0); + Edge e1 = (Edge) edges.get(1); + if (!e1.contains(e0.getFrom())) { + return e0.getFrom(); + } + if (!e1.contains(e0.getTo())) { + return e0.getTo(); + } + } + return null; + } /** Index: Plane.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Plane.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Plane.java 13 Jan 2006 15:59:31 -0000 1.13 --- Plane.java 3 Feb 2006 13:01:49 -0000 1.14 *************** *** 7,10 **** --- 7,13 ---- package net.sourceforge.bprocessor.model; + import java.util.Collection; + import java.util.Iterator; + import org.apache.log4j.Logger; *************** *** 66,69 **** --- 69,116 ---- /** + * Distance from vertex to this plane + * @param vertex The vertex + * @return The distance + */ + public double distance(Vertex vertex) { + return (a * vertex.getX() + b * vertex.getY() + c * vertex.getZ() + d); + } + + /** + * Test if the vertex lies in this plane + * @param vertex The vertex + * @return True if the vertex lies in this plane + */ + public boolean contains(Vertex vertex) { + return Math.abs(distance(vertex)) < 0.0000001; + } + + /** + * Test if edge lies in this plane + * @param edge The edge + * @return True if edge lies in this plane + */ + public boolean contains(Edge edge) { + return contains(edge.getFrom()) && contains(edge.getTo()); + } + + /** + * Test if surface lies in this plane + * @param surface The surface + * @return True if surface lies in this plane + */ + public boolean contains(Surface surface) { + Collection vertices = surface.getVertices(); + Iterator iter = vertices.iterator(); + while (iter.hasNext()) { + Vertex current = (Vertex) iter.next(); + if (!contains(current)) { + return false; + } + } + return true; + } + + /** * Find the orthogonal plane to this plane * @param rayIn the ray into the view |
From: Michael L. <he...@us...> - 2006-02-02 14:18:44
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29701/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Geometry.java Log Message: Surface.normal() is normalized Ð length() = 1 Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** Surface.java 2 Feb 2006 12:15:09 -0000 1.70 --- Surface.java 2 Feb 2006 14:18:35 -0000 1.71 *************** *** 357,362 **** public Surface extrude(double delta, Set sides) { Vertex normal = normal(); - normal.scale(delta / normal.length()); List vertices = getVertices(); --- 357,362 ---- public Surface extrude(double delta, Set sides) { Vertex normal = normal(); + normal.scale(delta); List vertices = getVertices(); *************** *** 425,431 **** if (exterior != null) { Vertex n0 = normal(); - n0.scale(1 / n0.length()); Vertex n1 = exterior.normal(); - n1.scale(1 / n1.length()); Vertex o = n0.add(n1); if (o.isZero()) { --- 425,429 ---- *************** *** 726,731 **** double d = 0; Vertex n = normal(); - double l = n.length(); - n.scale(1 / l); double a = n.getX(); double b = n.getY(); --- 724,727 ---- Index: Geometry.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometry.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Geometry.java 2 Feb 2006 12:15:09 -0000 1.13 --- Geometry.java 2 Feb 2006 14:18:35 -0000 1.14 *************** *** 41,44 **** --- 41,45 ---- normal.scale(-1); } + normal.scale(1 / normal.length()); return normal; } *************** *** 280,288 **** Iterator iter = surfaces.iterator(); Vertex normal = exterior.normal(); - normal.scale(1 / normal.length()); while (iter.hasNext()) { Surface current = (Surface) iter.next(); Vertex n = current.normal(); - n.scale(1 / n.length()); Vertex o = n.add(normal); if (o.isZero()) { --- 281,287 ---- |
From: Michael L. <he...@us...> - 2006-02-02 14:18:40
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29670/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Surface.normal() is normalized Ð length() = 1 Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** View.java 2 Feb 2006 12:15:04 -0000 1.56 --- View.java 2 Feb 2006 14:18:31 -0000 1.57 *************** *** 1210,1214 **** Vertex norm = s.normal(); if (norm != null) { - norm.scale(1 / norm.length()); gl.glNormal3d(norm.getX(), norm.getY(), norm.getZ()); } --- 1210,1213 ---- |
From: Michael L. <he...@us...> - 2006-02-02 14:18:40
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29670/src/net/sourceforge/bprocessor/gl/tool Modified Files: ExtrudeTool.java Log Message: Surface.normal() is normalized Ð length() = 1 Index: ExtrudeTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtrudeTool.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ExtrudeTool.java 25 Jan 2006 10:02:09 -0000 1.8 --- ExtrudeTool.java 2 Feb 2006 14:18:31 -0000 1.9 *************** *** 113,118 **** if (top != null) { Vertex normal = top.normal(); ! normal.scale(1 / normal.length()); ! normal.scale(delta / (normal.length() * normal.length())); top.move(normal.getX(), normal.getY(), normal.getZ()); } --- 113,117 ---- if (top != null) { Vertex normal = top.normal(); ! normal.scale(delta); top.move(normal.getX(), normal.getY(), normal.getZ()); } *************** *** 179,183 **** Vertex normal = top.normal(); Vertex origin = extrudeSurface.getFirstVertex(); - normal.scale(1 / normal.length()); while (iter.hasNext()) { Surface current = (Surface) iter.next(); --- 178,181 ---- *************** *** 221,225 **** normal = top.normal(); } - normal.scale(1 / normal.length()); View view = glv.getView(); Vertex from = view.toPlaneCoords(new double[] {prevX, prevY}, dragplane); --- 219,222 ---- |
From: Michael L. <he...@us...> - 2006-02-02 12:15:21
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12310/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Geometry.java Log Message: Surface.getVertices() no longer returns the first vertex twice Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** Surface.java 2 Feb 2006 10:53:44 -0000 1.69 --- Surface.java 2 Feb 2006 12:15:09 -0000 1.70 *************** *** 137,145 **** vertices.add(e0.getTo()); } else if (edges.size() > 1) { ! Vertex current = getFirstVertex(); ! if (current != null) { ! vertices.add(current); Iterator iter = edges.iterator(); while (iter.hasNext()) { Edge edge = (Edge) iter.next(); current = edge.otherVertex(current); --- 137,146 ---- vertices.add(e0.getTo()); } else if (edges.size() > 1) { ! Vertex first = getFirstVertex(); ! if (first != null) { ! Vertex current = first; Iterator iter = edges.iterator(); while (iter.hasNext()) { + vertices.add(current); Edge edge = (Edge) iter.next(); current = edge.otherVertex(current); *************** *** 147,152 **** throw new Error("other vertex null"); } - vertices.add(current); } } } --- 148,154 ---- throw new Error("other vertex null"); } } + } else { + throw new Error("first vertex null"); } } *************** *** 182,196 **** /** - * Return true if this surface is connected. - * @return True if this surface is connected. - */ - public boolean connected() { - List vertices = getVertices(); - if (vertices.size() > 1) { - return (vertices.get(0) == vertices.get(vertices.size() - 1)); - } - return false; - } - /** * Calculate center of gravity * @return The center of gravity --- 184,187 ---- *************** *** 199,223 **** List vertices = this.getVertices(); if (vertices.size() > 0) { ! if (vertices.get(0) == vertices.get(vertices.size() - 1)) { ! vertices.remove(vertices.size() - 1); ! } ! if (vertices.size() > 0) { ! double x = 0; ! double y = 0; ! double z = 0; ! Iterator iter = vertices.iterator(); ! while (iter.hasNext()) { ! Vertex current = (Vertex) iter.next(); ! x += current.getX(); ! y += current.getY(); ! z += current.getZ(); ! } ! x = x / (double) vertices.size(); ! y = y / (double) vertices.size(); ! z = z / (double) vertices.size(); ! return new Vertex(x, y, z); ! } else { ! return null; } } else { return null; --- 190,207 ---- List vertices = this.getVertices(); if (vertices.size() > 0) { ! double x = 0; ! double y = 0; ! double z = 0; ! Iterator iter = vertices.iterator(); ! while (iter.hasNext()) { ! Vertex current = (Vertex) iter.next(); ! x += current.getX(); ! y += current.getY(); ! z += current.getZ(); } + x = x / (double) vertices.size(); + y = y / (double) vertices.size(); + z = z / (double) vertices.size(); + return new Vertex(x, y, z); } else { return null; *************** *** 376,389 **** List vertices = getVertices(); - Vertex first = (Vertex) vertices.get(0); - Vertex last = (Vertex) vertices.get(vertices.size() - 1); - if (first != last) { - throw new Error("extruding open surface"); - } - - // FIXME getVertices() should not return duplicates - // why is a surface not allways closed? It should be! - vertices.remove(vertices.size() - 1); List edges = getEdges(); --- 360,364 ---- *************** *** 543,554 **** { List vertices = getVertices(); - Vertex v0 = (Vertex) vertices.get(0); - v0.move(dx, dy, dz); Iterator iter = vertices.iterator(); while (iter.hasNext()) { Vertex vertex = (Vertex) iter.next(); ! if (vertex != v0) { ! vertex.move(dx, dy, dz); ! } } } --- 518,525 ---- { List vertices = getVertices(); Iterator iter = vertices.iterator(); while (iter.hasNext()) { Vertex vertex = (Vertex) iter.next(); ! vertex.move(dx, dy, dz); } } *************** *** 563,567 **** } - // FIXME: Reimplement this without looking at all surfaces in the mesh if (exterior != null) { if (!exterior.surrounds(this)) { --- 534,537 ---- *************** *** 570,581 **** { List vertices = getVertices(); - Vertex v0 = (Vertex) vertices.get(0); - v0.move(-dx, -dy, -dz); Iterator iter = vertices.iterator(); while (iter.hasNext()) { Vertex vertex = (Vertex) iter.next(); ! if (vertex != v0) { ! vertex.move(-dx, -dy, -dz); ! } } } --- 540,547 ---- { List vertices = getVertices(); Iterator iter = vertices.iterator(); while (iter.hasNext()) { Vertex vertex = (Vertex) iter.next(); ! vertex.move(-dx, -dy, -dz); } } Index: Geometry.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometry.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Geometry.java 1 Feb 2006 11:45:25 -0000 1.12 --- Geometry.java 2 Feb 2006 12:15:09 -0000 1.13 *************** *** 151,155 **** */ public static double angle(List vertices) { - vertices.remove(vertices.size() - 1); Vertex first = (Vertex) vertices.get(0); Vertex last = (Vertex) vertices.get(vertices.size() - 1); --- 151,154 ---- |
From: Michael L. <he...@us...> - 2006-02-02 12:15:18
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12198/src/net/sourceforge/bprocessor/gl/tool Modified Files: CatmullClark.java Log Message: Surface.getVertices() no longer returns the first vertex twice Index: CatmullClark.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CatmullClark.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CatmullClark.java 1 Feb 2006 09:00:11 -0000 1.7 --- CatmullClark.java 2 Feb 2006 12:15:05 -0000 1.8 *************** *** 359,363 **** edges.addAll(current.getEdges()); Iterator vit = current.getVertices().iterator(); - vit.next(); while (vit.hasNext()) { Vertex v = (Vertex) vit.next(); --- 359,362 ---- |
From: Michael L. <he...@us...> - 2006-02-02 12:15:18
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12198/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Surface.getVertices() no longer returns the first vertex twice Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** View.java 1 Feb 2006 10:04:27 -0000 1.55 --- View.java 2 Feb 2006 12:15:04 -0000 1.56 *************** *** 1240,1276 **** if (vertices.size() > 0) { Vertex first = (Vertex) vertices.get(0); ! Vertex last = (Vertex) vertices.get(vertices.size() - 1); ! if (first == last) { ! Iterator iter = vertices.iterator(); ! glu.gluTessBeginContour(tess); ! while (iter.hasNext()) { ! Vertex current = (Vertex) iter.next(); ! double[] coords = new double[] {current.getX(), current.getY(), current.getZ()}; ! glu.gluTessVertex(tess, coords, new Point(coords[0], coords[1], coords[2])); ! } ! glu.gluTessEndContour(tess); ! } ! } ! } ! ! /** ! * Draw contour of a Surface in reverse ! * @param surface The surface ! * @param tess The Tesselator ! */ ! private void drawContourReverse(Surface surface, GLUtesselator tess) { ! List vertices = surface.getVertices(); ! if (vertices.size() > 0) { ! Vertex first = (Vertex) vertices.get(0); ! Vertex last = (Vertex) vertices.get(vertices.size() - 1); ! if (first == last) { ! glu.gluTessBeginContour(tess); ! for (int i = vertices.size(); i > 0; i--) { ! Vertex current = (Vertex) vertices.get(i - 1); ! double[] coords = new double[] {current.getX(), current.getY(), current.getZ()}; ! glu.gluTessVertex(tess, coords, new Point(coords[0], coords[1], coords[2])); ! } ! glu.gluTessEndContour(tess); } } } --- 1240,1253 ---- if (vertices.size() > 0) { Vertex first = (Vertex) vertices.get(0); ! Iterator iter = vertices.iterator(); ! glu.gluTessBeginContour(tess); ! while (iter.hasNext()) { ! Vertex current = (Vertex) iter.next(); ! double[] coords = new double[] {current.getX(), current.getY(), current.getZ()}; ! glu.gluTessVertex(tess, coords, new Point(coords[0], coords[1], coords[2])); } + double[] coords = new double[] {first.getX(), first.getY(), first.getZ()}; + glu.gluTessVertex(tess, coords, new Point(coords[0], coords[1], coords[2])); + glu.gluTessEndContour(tess); } } |
From: rimestad <rim...@us...> - 2006-02-02 10:55:31
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14891/src/net/sourceforge/bprocessor/gui/attrview Modified Files: AttributeView.java Log Message: Changed Attributes to Attribute and made the AttributeView show Parametric objects by the GenericPanel Index: AttributeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/AttributeView.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** AttributeView.java 25 Jan 2006 14:50:10 -0000 1.30 --- AttributeView.java 2 Feb 2006 10:55:19 -0000 1.31 *************** *** 8,14 **** --- 8,16 ---- import net.sourceforge.bprocessor.gui.Defaults; + import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Camera; import net.sourceforge.bprocessor.model.Material; import net.sourceforge.bprocessor.model.Observer; + import net.sourceforge.bprocessor.model.Parametric; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Selection; *************** *** 23,26 **** --- 25,30 ---- import java.awt.GridBagLayout; import java.awt.GridBagConstraints; + import java.util.Iterator; + import java.util.List; import javax.swing.BorderFactory; *************** *** 42,46 **** /** The attributes panel */ ! private AttributesPanel ap; /** --- 46,50 ---- /** The attributes panel */ ! private JPanel container; /** *************** *** 50,56 **** super(); ! ap = new AttributesPanel(); ! ! addTab("Attributes", ap); setMinimumSize(new Dimension(120, 240)); setPreferredSize(new Dimension(120, 240)); --- 54,60 ---- super(); ! container = new JPanel(); ! ! addTab("Attributes", container); setMinimumSize(new Dimension(120, 240)); setPreferredSize(new Dimension(120, 240)); *************** *** 65,81 **** Selection selection = Selection.primary(); if (object == selection) { ! if (selection.size() == 1) { ! ap.display(selection.iterator().next()); ! } else { ! ap.display(null); } } ! Object current = ap.getCurrent(); if (object == current) { ap.display(current); ! } repaint(); } ! /** * Attributes panel --- 69,124 ---- Selection selection = Selection.primary(); if (object == selection) { ! if (selection.size() > 0) { ! Object o = selection.iterator().next(); ! container.removeAll(); ! if (o instanceof Parametric) { ! log.info("Were Parametric" + o); ! container.add(new GenericPanel((Parametric)o)); ! } else { ! AttributesPanel ap = new AttributesPanel(); ! ap.display(o); ! container.add(ap); ! } } } ! /*Object current = ap.getCurrent(); if (object == current) { ap.display(current); ! }*/ repaint(); } ! ! /** ! * A generic panel for classes that implement the parametric interface ! */ ! class GenericPanel extends JPanel { ! /** The current object shown */ ! private Parametric obj; ! ! /** ! * The constructor ! * @param content The content ! */ ! public GenericPanel(Parametric content) { ! super(); ! obj = content; ! generateContent(content.getAttributes()); ! } ! ! /** ! * local method for generating the content ! * @param what The list of attrinutes ! */ ! private void generateContent(List what) { ! Iterator iter = what.iterator(); ! while (iter.hasNext()) { ! Attribute a = (Attribute)iter.next(); ! if (a.getValue() instanceof String) { ! this.add(new JLabel((String)(a.getValue()))); ! } ! } ! } ! } ! /** * Attributes panel |
From: rimestad <rim...@us...> - 2006-02-02 10:55:26
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14866/src/net/sourceforge/bprocessor/model Modified Files: Camera.java Added Files: Attribute.java Log Message: Changed Attributes to Attribute and made the AttributeView show Parametric objects by the GenericPanel --- NEW FILE: Attribute.java --- //--------------------------------------------------------------------------------- // $Id: Attribute.java,v 1.5 2006/02/02 10:55:14 rimestad Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.model; import org.apache.log4j.Logger; /** * A class for holding the info for objects in the model so that it can be * shown in the attributeview in the gui */ public class Attribute { /** The logger */ private static Logger log = Logger.getLogger(Attribute.class); /** The value object */ private Object value; /** The name */ private String name; /** The precision of the object */ private int precision; /** * Constructor * @param name The name * @param value The value * @param precision The precision */ public Attribute(String name, Object value, int precision) { setName(name); setValue(value); setPrecision(precision); } /** * Constructor * @param name The name * @param value The value */ public Attribute(String name, Object value) { this(name, value, 0); } /** * @return Returns the name. */ public String getName() { return name; } /** * @param name The name to set. */ public void setName(String name) { this.name = name; } /** * @return Returns the precision. */ public int getPrecision() { return precision; } /** * @param precision The precision to set. */ public void setPrecision(int precision) { this.precision = precision; } /** * @return Returns the value. */ public Object getValue() { return value; } /** * @param value The value to set. */ public void setValue(Object value) { this.value = value; } } Index: Camera.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Camera.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Camera.java 30 Jan 2006 14:45:36 -0000 1.9 --- Camera.java 2 Feb 2006 10:55:14 -0000 1.10 *************** *** 402,406 **** Iterator iter = attributes.iterator(); while (iter.hasNext()) { ! Attributes a = (Attributes)iter.next(); if (a.getName().equals("Name")) { setName((String)a.getValue()); --- 402,406 ---- Iterator iter = attributes.iterator(); while (iter.hasNext()) { ! Attribute a = (Attribute)iter.next(); if (a.getName().equals("Name")) { setName((String)a.getValue()); *************** *** 436,454 **** public List getAttributes() { ArrayList res = new ArrayList(); ! res.add(new Attributes("Name", getName())); ! res.add(new Attributes("Type", type == ORTHOGRAPHIC ? "Orthographic" : "Perspective")); ! res.add(new Attributes("Camera", null)); ! res.add(new Attributes("X", new Double(getCamera()[0]))); ! res.add(new Attributes("Y", new Double(getCamera()[1]))); ! res.add(new Attributes("Z", new Double(getCamera()[2]))); ! res.add(new Attributes("Center", null)); ! res.add(new Attributes("X", new Double(getCenter()[0]))); ! res.add(new Attributes("Y", new Double(getCenter()[1]))); ! res.add(new Attributes("Z", new Double(getCenter()[2]))); ! res.add(new Attributes("Roll", null)); ! res.add(new Attributes("X", new Double(getRoll()[0]))); ! res.add(new Attributes("Y", new Double(getRoll()[1]))); ! res.add(new Attributes("Z", new Double(getRoll()[2]))); ! res.add(new Attributes("Focalwidth", new Double(getFocalwidth()))); return res; } --- 436,454 ---- public List getAttributes() { ArrayList res = new ArrayList(); ! res.add(new Attribute("Name", getName())); ! res.add(new Attribute("Type", type == ORTHOGRAPHIC ? "Orthographic" : "Perspective")); ! res.add(new Attribute("Camera", null)); ! res.add(new Attribute("X", new Double(getCamera()[0]))); ! res.add(new Attribute("Y", new Double(getCamera()[1]))); ! res.add(new Attribute("Z", new Double(getCamera()[2]))); ! res.add(new Attribute("Center", null)); ! res.add(new Attribute("X", new Double(getCenter()[0]))); ! res.add(new Attribute("Y", new Double(getCenter()[1]))); ! res.add(new Attribute("Z", new Double(getCenter()[2]))); ! res.add(new Attribute("Roll", null)); ! res.add(new Attribute("X", new Double(getRoll()[0]))); ! res.add(new Attribute("Y", new Double(getRoll()[1]))); ! res.add(new Attribute("Z", new Double(getRoll()[2]))); ! res.add(new Attribute("Focalwidth", new Double(getFocalwidth()))); return res; } |
From: Michael L. <he...@us...> - 2006-02-02 10:53:54
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14232/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Mesh.java Log Message: Clean up in Surface Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** Surface.java 1 Feb 2006 11:45:25 -0000 1.68 --- Surface.java 2 Feb 2006 10:53:44 -0000 1.69 *************** *** 8,12 **** import java.util.ArrayList; - import java.util.Collection; import java.util.HashMap; import java.util.Iterator; --- 8,11 ---- *************** *** 54,65 **** private Surface exterior; - /** Surface is clockwise */ - - public static final int CLOCKWISE = 1; - - /** Surface is counter clock wise **/ - - public static final int COUNTER_CLOCKWISE = 2; - /** * Constructor for surface --- 53,56 ---- *************** *** 238,242 **** * front and back of this Surface. */ ! void flip() { List lst = new ArrayList(edges.size()); Edge[] edges = new Edge[getEdges().size()]; --- 229,233 ---- * front and back of this Surface. */ ! public void flip() { List lst = new ArrayList(edges.size()); Edge[] edges = new Edge[getEdges().size()]; *************** *** 296,309 **** } - /** - * Calculate the turn direction of the vertices of this - * surface. Return values are CLOCKWISE or COUNTER_CLOCKWISE. - * @return The turn direction. - */ - public int direction() { - - return 0; - } - /** * Compute the traversed angle of this Surface --- 287,290 ---- *************** *** 560,564 **** */ public void move(double dx, double dy, double dz) { ! { List vertices = getVertices(); Vertex v0 = (Vertex) vertices.get(0); --- 541,545 ---- */ public void move(double dx, double dy, double dz) { ! { List vertices = getVertices(); Vertex v0 = (Vertex) vertices.get(0); *************** *** 583,622 **** // FIXME: Reimplement this without looking at all surfaces in the mesh ! if (this.isInner()) { ! Collection surfaces = getMesh().getSurfaces(); ! Iterator surfIt = surfaces.iterator(); ! while (surfIt.hasNext()) { ! Surface surf = (Surface)surfIt.next(); ! Set inners = surf.getHoles(); ! if (inners != null) { ! Iterator innerIt = inners.iterator(); ! while (innerIt.hasNext()) { ! Surface innerSurf = (Surface)innerIt.next(); ! if (innerSurf == this) { ! if (!containedCheck(this, surf)) { ! //The inner surface has been moved out of its outer surface ! //this can not happen so here we move the inner surface back ! { ! List vertices = getVertices(); ! Vertex v0 = (Vertex) vertices.get(0); ! v0.move(-dx, -dy, -dz); ! Iterator iter = vertices.iterator(); ! while (iter.hasNext()) { ! Vertex vertex = (Vertex) iter.next(); ! if (vertex != v0) { ! vertex.move(-dx, -dy, -dz); ! } ! } ! } ! { ! if (getHoles() != null) { ! Iterator iter = getHoles().iterator(); ! while (iter.hasNext()) { ! Surface surface = (Surface) iter.next(); ! surface.move(-dx, -dy, -dz); ! } ! } ! } ! } } } --- 564,589 ---- // FIXME: Reimplement this without looking at all surfaces in the mesh ! if (exterior != null) { ! if (!exterior.surrounds(this)) { ! //The inner surface has been moved out of its outer surface ! //this can not happen so here we move the inner surface back ! { ! List vertices = getVertices(); ! Vertex v0 = (Vertex) vertices.get(0); ! v0.move(-dx, -dy, -dz); ! Iterator iter = vertices.iterator(); ! while (iter.hasNext()) { ! Vertex vertex = (Vertex) iter.next(); ! if (vertex != v0) { ! vertex.move(-dx, -dy, -dz); ! } ! } ! } ! { ! if (getHoles() != null) { ! Iterator iter = getHoles().iterator(); ! while (iter.hasNext()) { ! Surface surface = (Surface) iter.next(); ! surface.move(-dx, -dy, -dz); } } *************** *** 627,647 **** } - - /** - * Checks if a hole is contained in a surface, given that the hole and the - * surface is in the same plane. - * @param hole the hole - * @param surf the surface - * @return boolean indicating werther or not the hole is contained in the plane. - */ - private boolean containedCheck(Surface hole, Surface surf) { - Iterator vertIt = hole.getVertices().iterator(); - boolean contained = true; - while (vertIt.hasNext() && contained) { - contained = surf.surrounds((Vertex)vertIt.next(), 1); - } - return contained; - } - /** * Tests if a surface is a hole in this surface --- 594,597 ---- *************** *** 794,827 **** /** - * Returns the normal to this - * @return A vector normal for this surface, null if the surface consists of only one edge - */ - public Vertex normal1() { - if (edges.size() > 1) { - Edge e1 = (Edge)edges.get(0); - Edge e2 = (Edge)edges.get(1); - Vertex v1 = e1.getFrom(); - Vertex v2 = e1.getTo(); - Vertex v3 = null; - - if (e2.otherVertex(v1) == null) { - v3 = e2.otherVertex(v2); - // v2 is the center - Vertex v2v1 = v2.minus(v1); - Vertex v2v3 = v2.minus(v3); - return v2v3.cross(v2v1); - } else if (e2.otherVertex(v2) == null) { - // v1 is the center - v3 = e2.otherVertex(v1); - Vertex v1v2 = v1.minus(v2); - Vertex v1v3 = v1.minus(v3); - return v1v3.cross(v1v2); - } - return null; - } - return null; - } - - /** * Returns the outward pointing normal to this Surface * @return A vector normal for this surface, null if the surface consists of only one edge --- 744,747 ---- *************** *** 871,899 **** } } - /** - * Returns the projection on the surface normal - * @param p The point to project on the normal - * @return the projection - */ - public Vertex projection(double[] p) { - if (edges.size() > 0) { - Iterator it = edges.iterator(); - Vertex from = ((Edge)it.next()).getTo(); - Vertex point = new Vertex(); - point.setX(p[0] - from.getX()); - point.setY(p[1] - from.getY()); - point.setZ(p[2] - from.getZ()); - Vertex normal = normal(); - double dot = normal.dot(point); - double length = normal.length(); - double scale = dot / (length * length); - normal.scale(scale); - return normal; - } - return null; - } - - /** * Checks if e is in the surface --- 791,795 ---- Index: Mesh.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Mesh.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Mesh.java 1 Feb 2006 11:45:25 -0000 1.7 --- Mesh.java 2 Feb 2006 10:53:44 -0000 1.8 *************** *** 11,14 **** --- 11,15 ---- import java.util.HashMap; import java.util.Iterator; + import java.util.LinkedList; import java.util.List; import java.util.Set; *************** *** 160,167 **** --- 161,183 ---- if (edge.getId() != null) { Set surfaces = edge.getSurfaces(); + Vertex to = edge.getTo(); Vertex from = edge.getFrom(); remove(edge); + + { + List partions = new LinkedList(); + List work = new LinkedList(surfaces); + while (!work.isEmpty()) { + Iterator iter = work.iterator(); + Surface first = (Surface) iter.next(); + CoordinateSystem system = first.coordinateSystem(); + List partion = new LinkedList(); + + } + } + + Iterator it = surfaces.iterator(); while (it.hasNext()) { |
From: Nordholt <nor...@us...> - 2006-02-01 17:26:59
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29715 Modified Files: MoveTool.java Log Message: three-click type of move added, implementation a little messy so still needs some clean up. Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** MoveTool.java 30 Jan 2006 14:48:44 -0000 1.30 --- MoveTool.java 1 Feb 2006 17:26:50 -0000 1.31 *************** *** 47,50 **** --- 47,53 ---- private static final int FREE_SNAP = 1; + /** The 3 clicks movement mode */ + private static final int THREE_CLICK = 2; + /** The initial movepoint */ private Vertex initial; *************** *** 74,77 **** --- 77,88 ---- private int moveMode; + /** Number of clicks when in 3 click mode */ + private int numberOfClicks; + + /** The Three click constructors edge */ + private Edge threeClickConst; + + /** + /** * The Constructor *************** *** 83,86 **** --- 94,98 ---- moveConstructors = null; restrictionVector = null; + numberOfClicks = 1; moveMode = AXIS_RESTRICTED; } *************** *** 109,124 **** */ protected void pressed(MouseEvent e) { ! super.pressed(e); ! clearConstructors(moveConstructors); ! if (target != null) { ! initial = findInitial(target, e); ! from = initial.copy(); ! ! setupConstructors(); ! displayConstructors(moveConstructors); ! vertices = new HashSet(); ! collect(selection, vertices); } } --- 121,162 ---- */ protected void pressed(MouseEvent e) { ! findTarget(e); clearConstructors(moveConstructors); ! if (target != null) { ! if (moveMode != THREE_CLICK) { ! super.pressed(e); ! initial = findInitial(target, e); ! from = initial.copy(); ! setupConstructors(); ! displayConstructors(moveConstructors); ! ! vertices = new HashSet(); ! collect(selection, vertices); ! } else { ! threeClickMove(e); ! } ! } ! } ! ! /** Talking care of the three-click mode ! * @param e the MouseEvent object ! */ ! private void threeClickMove(MouseEvent e) { ! vertices = new HashSet(); ! collect(selection, vertices); ! if (numberOfClicks == 1) { ! from = findInitial(target, e); ! threeClickConst = new Edge(from, from); ! threeClickConst.setConstructor(true); ! glv.getView().addTempEdge(threeClickConst); ! numberOfClicks = 2; ! } else if (numberOfClicks == 2) { ! Vertex movement = findInitial(target, e).minus(from); ! move(vertices, movement); ! glv.getView().removeTempEdge(threeClickConst); ! threeClickConst = null; ! update(); ! numberOfClicks = 1; } } *************** *** 137,140 **** --- 175,180 ---- } else if (moveMode == FREE_SNAP) { moveConstructors = makeXYZConerConstructors(initial); + } else if (moveMode == THREE_CLICK) { + moveConstructors = new HashSet(); } } *************** *** 184,187 **** --- 224,243 ---- number = ""; } + + /** + * Invoked when the mouse cursor has been moved + * @param e The MouseEvent object + */ + protected void moved(MouseEvent e) { + super.moved(e); + if (moveMode == THREE_CLICK && threeClickConst != null) { + if (target != null) { + Vertex to = findInitial(target, e); + if (to != null) { + threeClickConst.setTo(to); + } + } + } + } /** *************** *** 313,317 **** /** * Creates the surface spanned by two edges connected ! * at one point. * @param edge1 the first edge. * @param edge2 the second edge. --- 369,373 ---- /** * Creates the surface spanned by two edges connected ! * at one point.Used in finding restrictions for the FREE_SNAP mode. * @param edge1 the first edge. * @param edge2 the second edge. *************** *** 457,466 **** } else if (e.getKeyCode() == KeyEvent.VK_M) { if (dragPlane == null) { ! if (moveMode == AXIS_RESTRICTED) { ! moveMode = FREE_SNAP; ! } else { ! moveMode = AXIS_RESTRICTED; ! } } } else if (lastRestriction != null && initial != null && --- 513,519 ---- } else if (e.getKeyCode() == KeyEvent.VK_M) { if (dragPlane == null) { ! moveMode = (moveMode + 1) % 3; } + numberOfClicks = 1; } else if (lastRestriction != null && initial != null && |
From: Michael L. <he...@us...> - 2006-02-01 11:45:37
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1282/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Vertex.java Surface.java Geometry.java Geometric.java Mesh.java Log Message: Surface, Edge and Vertex now belongs to a Mesh Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** Surface.java 1 Feb 2006 09:08:39 -0000 1.67 --- Surface.java 1 Feb 2006 11:45:25 -0000 1.68 *************** *** 365,369 **** newFrom = from.copy(); map.put(from.getId(), newFrom); ! Project.getInstance().add(newFrom); } newEdge.setFrom(newFrom); --- 365,369 ---- newFrom = from.copy(); map.put(from.getId(), newFrom); ! getMesh().add(newFrom); } newEdge.setFrom(newFrom); *************** *** 373,384 **** newTo = to.copy(); map.put(to.getId(), newTo); ! Project.getInstance().add(newTo); } newEdge.setTo(newTo); ! Project.getInstance().add(newEdge); edges.add(newEdge); } surface.setEdges(edges); ! Project.getInstance().add(surface); return surface; } --- 373,384 ---- newTo = to.copy(); map.put(to.getId(), newTo); ! getMesh().add(newTo); } newEdge.setTo(newTo); ! getMesh().add(newEdge); edges.add(newEdge); } surface.setEdges(edges); ! getMesh().add(surface); return surface; } *************** *** 425,439 **** for (int i = 0; i < n; i++) { vmap[i] = v[i].add(normal); ! Project.getInstance().add(vmap[i]); } for (int i = 0; i < n; i++) { topmap[i] = new Edge(vmap[i], vmap[(i + 1) % n]); ! Project.getInstance().add(topmap[i]); } for (int i = 0; i < n; i++) { sidemap[i] = new Edge(v[i], vmap[i]); ! Project.getInstance().add(sidemap[i]); } --- 425,439 ---- 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]); } *************** *** 449,453 **** newEdges.add(b); facemap[i] = new Surface(newEdges); ! Project.getInstance().add(facemap[i]); sides.add(facemap[i]); } --- 449,453 ---- newEdges.add(b); facemap[i] = new Surface(newEdges); ! getMesh().add(facemap[i]); sides.add(facemap[i]); } *************** *** 459,463 **** } top = new Surface(newEdges); ! Project.getInstance().add(top); } --- 459,463 ---- } top = new Surface(newEdges); ! getMesh().add(top); } *************** *** 582,587 **** } if (this.isInner()) { ! Collection surfaces = Project.getInstance().getSurfaces(); Iterator surfIt = surfaces.iterator(); while (surfIt.hasNext()) { --- 582,588 ---- } + // FIXME: Reimplement this without looking at all surfaces in the mesh if (this.isInner()) { ! Collection surfaces = getMesh().getSurfaces(); Iterator surfIt = surfaces.iterator(); while (surfIt.hasNext()) { Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Edge.java 1 Feb 2006 09:08:39 -0000 1.29 --- Edge.java 1 Feb 2006 11:45:25 -0000 1.30 *************** *** 267,277 **** */ public void split(Vertex vertex) { if (!constructor) { Vertex from = getFrom(); Vertex to = getTo(); Edge e1 = new Edge(from, vertex); ! Project.getInstance().add(e1); Edge e2 = new Edge(vertex, to); ! Project.getInstance().add(e2); --- 267,278 ---- */ public void split(Vertex vertex) { + // FIXME Why not split a constructor? if (!constructor) { Vertex from = getFrom(); Vertex to = getTo(); Edge e1 = new Edge(from, vertex); ! getMesh().add(e1); Edge e2 = new Edge(vertex, to); ! getMesh().add(e2); *************** *** 282,286 **** current.replace(this, e1, e2); } ! Project.getInstance().remove(this); } } --- 283,287 ---- current.replace(this, e1, e2); } ! getMesh().remove(this); } } *************** *** 300,304 **** public Set getSurfaces() { Set result = new HashSet(); ! Collection surfaces = Project.getInstance().getSurfaces(); Iterator iter = surfaces.iterator(); while (iter.hasNext()) { --- 301,305 ---- public Set getSurfaces() { Set result = new HashSet(); ! Collection surfaces = getMesh().getSurfaces(); Iterator iter = surfaces.iterator(); while (iter.hasNext()) { Index: Geometry.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometry.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Geometry.java 30 Jan 2006 14:11:51 -0000 1.11 --- Geometry.java 1 Feb 2006 11:45:25 -0000 1.12 *************** *** 256,265 **** int count = 0; List surfaces = new LinkedList(); ! { Surface clockwise = clockwiseSurface(vertex, last, edges); if (clockwise != null) { if (clockwise.angle(vertex.system()) < 0) { ! Project.getInstance().add(clockwise); surfaces.add(clockwise); count++; --- 256,265 ---- int count = 0; List surfaces = new LinkedList(); ! Mesh mesh = ((Edge) edges.iterator().next()).getMesh(); { Surface clockwise = clockwiseSurface(vertex, last, edges); if (clockwise != null) { if (clockwise.angle(vertex.system()) < 0) { ! mesh.add(clockwise); surfaces.add(clockwise); count++; *************** *** 271,275 **** if (counterclockwise != null) { if (counterclockwise.angle(vertex.system()) > 0) { ! Project.getInstance().add(counterclockwise); surfaces.add(counterclockwise); count++; --- 271,275 ---- if (counterclockwise != null) { if (counterclockwise.angle(vertex.system()) > 0) { ! mesh.add(counterclockwise); surfaces.add(counterclockwise); count++; *************** *** 293,297 **** current.setFrontDomain(exterior.getFrontDomain()); } ! Project.getInstance().remove(exterior); } } --- 293,297 ---- current.setFrontDomain(exterior.getFrontDomain()); } ! mesh.remove(exterior); } } Index: Geometric.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometric.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Geometric.java 1 Feb 2006 09:08:39 -0000 1.1 --- Geometric.java 1 Feb 2006 11:45:25 -0000 1.2 *************** *** 13,16 **** */ public abstract class Geometric extends Entity { ! } --- 13,33 ---- */ public abstract class Geometric extends Entity { ! /** The mesh containing this geometric entity */ ! private Mesh mesh; ! ! /** ! * Get the mesh ! * @return The mesh ! */ ! public Mesh getMesh() { ! return mesh; ! } ! ! /** ! * Set the mesh ! * @param mesh The mesh ! */ ! public void setMesh(Mesh mesh) { ! this.mesh = mesh; ! } } Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Vertex.java 1 Feb 2006 09:08:39 -0000 1.21 --- Vertex.java 1 Feb 2006 11:45:25 -0000 1.22 *************** *** 126,130 **** public Set getEdges() { Set result = new HashSet(); ! Collection edges = Project.getInstance().getEdges(); Iterator iter = edges.iterator(); while (iter.hasNext()) { --- 126,130 ---- public Set getEdges() { Set result = new HashSet(); ! Collection edges = getMesh().getEdges(); Iterator iter = edges.iterator(); while (iter.hasNext()) { Index: Mesh.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Mesh.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Mesh.java 27 Jan 2006 13:17:52 -0000 1.6 --- Mesh.java 1 Feb 2006 11:45:25 -0000 1.7 *************** *** 66,69 **** --- 66,70 ---- vertex.setId(id); vertices.put(id, vertex); + vertex.setMesh(this); } *************** *** 75,78 **** --- 76,80 ---- vertices.remove(vertex.getId()); vertex.setId(null); + vertex.setMesh(null); } *************** *** 93,98 **** public void delete(Vertex vertex) { if (vertex.getId() != null) { - remove(vertex); Set edges = vertex.getEdges(); Iterator iter = edges.iterator(); while (iter.hasNext()) { --- 95,100 ---- public void delete(Vertex vertex) { if (vertex.getId() != null) { Set edges = vertex.getEdges(); + remove(vertex); Iterator iter = edges.iterator(); while (iter.hasNext()) { *************** *** 128,131 **** --- 130,134 ---- edge.setId(id); edges.put(id, edge); + edge.setMesh(this); } *************** *** 137,140 **** --- 140,144 ---- edges.remove(edge.getId()); edge.setId(null); + edge.setMesh(null); } *************** *** 155,160 **** public void delete(Edge edge) { if (edge.getId() != null) { - remove(edge); Set surfaces = edge.getSurfaces(); Iterator it = surfaces.iterator(); while (it.hasNext()) { --- 159,167 ---- public void delete(Edge edge) { if (edge.getId() != null) { Set surfaces = edge.getSurfaces(); + Vertex to = edge.getTo(); + Vertex from = edge.getFrom(); + + remove(edge); Iterator it = surfaces.iterator(); while (it.hasNext()) { *************** *** 162,173 **** remove(surface); } ! if (edge.getTo().getEdges().size() == 0) { ! remove(edge.getTo()); } ! if (edge.getFrom().getEdges().size() == 0) { ! remove(edge.getFrom()); } } - } --- 169,183 ---- remove(surface); } ! if (to.getMesh() != null) { ! if (to.getEdges().size() == 0) { ! remove(to); ! } } ! if (from.getMesh() != null) { ! if (from.getEdges().size() == 0) { ! remove(from); ! } } } } *************** *** 197,200 **** --- 207,211 ---- surface.setId(id); surfaces.put(id, surface); + surface.setMesh(this); } *************** *** 220,223 **** --- 231,235 ---- surfaces.remove(surface.getId()); surface.setId(null); + surface.setMesh(null); } |
From: rimestad <rim...@us...> - 2006-02-01 11:37:07
|
Update of /cvsroot/bprocessor/model/src/etc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30832/src/etc Modified Files: bprocessor.xsd Log Message: removed all references to attribute Index: bprocessor.xsd =================================================================== RCS file: /cvsroot/bprocessor/model/src/etc/bprocessor.xsd,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** bprocessor.xsd 13 Jan 2006 11:29:26 -0000 1.8 --- bprocessor.xsd 1 Feb 2006 11:36:56 -0000 1.9 *************** *** 8,20 **** <!-- Type definitions --> - <xsd:complexType name="AttributeType"> - <xsd:sequence> - <xsd:element name="id" type="xsd:long"/> - <xsd:element name="name" type="xsd:string"/> - <xsd:element name="type" type="xsd:string"/> - <xsd:element name="value" type="xsd:string"/> - </xsd:sequence> - </xsd:complexType> - <xsd:complexType name="DomainType"> <xsd:sequence> --- 8,11 ---- *************** *** 22,26 **** <xsd:element name="name" type="xsd:string"/> <xsd:element name="description" type="xsd:string"/> - <xsd:element name="attributeref" type="xsd:long" maxOccurs="unbounded" minOccurs="0"/> <xsd:element name="surfaceref" type="xsd:long" maxOccurs="unbounded" minOccurs="0"/> </xsd:sequence> --- 13,16 ---- *************** *** 102,106 **** <!-- Element definitions --> - <xsd:element name="attribute" type="AttributeType"/> <xsd:element name="constructionspace" type="ConstructionSpaceType"/> <xsd:element name="functionalspace" type="FunctionalSpaceType"/> --- 92,95 ---- *************** *** 115,119 **** <xsd:complexType> <xsd:sequence> - <xsd:element ref="attribute" maxOccurs="unbounded" minOccurs="0"/> <xsd:element ref="constructionspace" maxOccurs="unbounded" minOccurs="0"/> <xsd:element ref="functionalspace" maxOccurs="unbounded" minOccurs="0"/> --- 104,107 ---- |
From: rimestad <rim...@us...> - 2006-02-01 11:37:07
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30832/src/net/sourceforge/bprocessor/model/xml Modified Files: PersistenceManager.java Log Message: removed all references to attribute Index: PersistenceManager.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/xml/PersistenceManager.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** PersistenceManager.java 1 Feb 2006 09:00:22 -0000 1.23 --- PersistenceManager.java 1 Feb 2006 11:36:56 -0000 1.24 *************** *** 12,16 **** import net.sourceforge.bprocessor.model.Space; - import net.sourceforge.bprocessor.model.xml.impl.AttributeImpl; import net.sourceforge.bprocessor.model.xml.impl.BprocessorImpl; import net.sourceforge.bprocessor.model.xml.impl.ConstructionspaceImpl; --- 12,15 ---- *************** *** 89,96 **** mapper = new HashMap(); - Map attribs = new HashMap(); - // Create all objects - loadAttribute(bp.getAttribute(), attribs); loadConstructionSpace(bp.getConstructionspace()); loadFunctionalSpace(bp.getFunctionalspace()); --- 88,92 ---- *************** *** 100,108 **** // Create all references ! loadRefConstructionSpace(bp.getConstructionspace(), attribs); ! loadRefFunctionalSpace(bp.getFunctionalspace(), attribs); ! loadRefSurface(bp.getSurface(), attribs); ! loadRefEdge(bp.getEdge(), attribs); ! loadRefVertex(bp.getVertex(), attribs); fis.close(); --- 96,104 ---- // Create all references ! loadRefConstructionSpace(bp.getConstructionspace()); ! loadRefFunctionalSpace(bp.getFunctionalspace()); ! loadRefSurface(bp.getSurface()); ! loadRefEdge(bp.getEdge()); ! loadRefVertex(bp.getVertex()); fis.close(); *************** *** 110,133 **** /** - * Load attributes - * @param al The attribute list - * @param attribs The attribute map - */ - private static void loadAttribute(List al, Map attribs) { - Iterator it = al.iterator(); - while (it.hasNext()) { - net.sourceforge.bprocessor.model.xml.Attribute a = - (net.sourceforge.bprocessor.model.xml.Attribute)it.next(); - - net.sourceforge.bprocessor.model.Attribute am = - new net.sourceforge.bprocessor.model.Attribute(a.getName(), a.getType(), a.getValue()); - - mapper.put(new Long(a.getId()), am.getId()); - - attribs.put(am.getId(), am); - } - } - - /** * Load construction spaces * @param l The list --- 106,109 ---- *************** *** 235,241 **** * Create the references * @param l The list - * @param attribs The attributes */ ! private static void loadRefConstructionSpace(List l, Map attribs) { Iterator it = l.iterator(); while (it.hasNext()) { --- 211,216 ---- * Create the references * @param l The list */ ! private static void loadRefConstructionSpace(List l) { Iterator it = l.iterator(); while (it.hasNext()) { *************** *** 243,259 **** Space csm = (Space) mapper.get(new Long(cs.getId())); ! ! List as = cs.getAttributeref(); ! if (as != null && as.size() > 0) { ! Set ar = new HashSet(); ! Iterator ias = as.iterator(); ! while (ias.hasNext()) { ! Long aid = (Long)mapper.get((Long)ias.next()); ! net.sourceforge.bprocessor.model.Attribute a = ! (net.sourceforge.bprocessor.model.Attribute)attribs.get(aid); ! ar.add(a); ! } ! csm.setAttributes(ar); ! } List ss = cs.getSurfaceref(); if (ss != null && ss.size() > 0) { --- 218,222 ---- Space csm = (Space) mapper.get(new Long(cs.getId())); ! List ss = cs.getSurfaceref(); if (ss != null && ss.size() > 0) { *************** *** 273,279 **** * Create the references * @param l The list - * @param attribs The attributes */ ! private static void loadRefFunctionalSpace(List l, Map attribs) { Iterator it = l.iterator(); while (it.hasNext()) { --- 236,241 ---- * Create the references * @param l The list */ ! private static void loadRefFunctionalSpace(List l) { Iterator it = l.iterator(); while (it.hasNext()) { *************** *** 282,297 **** Space fsm = (Space) mapper.get(new Long(fs.getId())); - List as = fs.getAttributeref(); - if (as != null && as.size() > 0) { - Set ar = new HashSet(); - Iterator ias = as.iterator(); - while (ias.hasNext()) { - Long aid = (Long)mapper.get((Long)ias.next()); - net.sourceforge.bprocessor.model.Attribute a = - (net.sourceforge.bprocessor.model.Attribute)attribs.get(aid); - ar.add(a); - } - fsm.setAttributes(ar); - } List ss = fs.getSurfaceref(); if (ss != null && ss.size() > 0) { --- 244,247 ---- *************** *** 311,317 **** * Create the references * @param l The list - * @param attribs The attributes */ ! private static void loadRefSurface(List l, Map attribs) { Iterator it = l.iterator(); while (it.hasNext()) { --- 261,266 ---- * Create the references * @param l The list */ ! private static void loadRefSurface(List l) { Iterator it = l.iterator(); while (it.hasNext()) { *************** *** 364,370 **** * Create the references * @param l The list - * @param attribs The attributes */ ! private static void loadRefEdge(List l, Map attribs) { Iterator it = l.iterator(); while (it.hasNext()) { --- 313,318 ---- * Create the references * @param l The list */ ! private static void loadRefEdge(List l) { Iterator it = l.iterator(); while (it.hasNext()) { *************** *** 388,394 **** * Create the references * @param l The list - * @param attribs The attributes */ ! private static void loadRefVertex(List l, Map attribs) { Iterator it = l.iterator(); while (it.hasNext()) { --- 336,341 ---- * Create the references * @param l The list */ ! private static void loadRefVertex(List l) { Iterator it = l.iterator(); while (it.hasNext()) { *************** *** 455,476 **** /** - * Save the attribute - * @param bp The BProcessor document - * @param a The attribute - * @return The attribute id - */ - private static Long saveAttribute(Bprocessor bp, net.sourceforge.bprocessor.model.Attribute a) { - net.sourceforge.bprocessor.model.xml.Attribute ax = new AttributeImpl(); - ax.setId(counter++); - ax.setName(a.getName()); - ax.setType(a.getType()); - ax.setValue(a.getValue()); - - bp.getAttribute().add(ax); - - return new Long(ax.getId()); - } - - /** * Save the construction space * @param bp The BProcessor document --- 402,405 ---- *************** *** 487,502 **** csx.setDescription(cs.getDescription()); - Set data = cs.getAttributes(); - if (data != null) { - Iterator it = data.iterator(); - while (it.hasNext()) { - net.sourceforge.bprocessor.model.Attribute a = - (net.sourceforge.bprocessor.model.Attribute)it.next(); - - Long aid = saveAttribute(bp, a); - - csx.getAttributeref().add(aid); - } - } Map csm = (Map)mapper.get(KEY_DOMAIN); csm.put(cs.getId(), new Long(csx.getId())); --- 416,419 ---- *************** *** 521,536 **** fsx.setDescription(fs.getDescription()); - Set data = fs.getAttributes(); - if (data != null) { - Iterator it = data.iterator(); - while (it.hasNext()) { - net.sourceforge.bprocessor.model.Attribute a = - (net.sourceforge.bprocessor.model.Attribute)it.next(); - - Long aid = saveAttribute(bp, a); - - fsx.getAttributeref().add(aid); - } - } Map fsm = (Map)mapper.get(KEY_DOMAIN); fsm.put(fs.getId(), new Long(fsx.getId())); --- 438,441 ---- |
From: rimestad <rim...@us...> - 2006-02-01 10:23:58
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3491/src/net/sourceforge/bprocessor/model Removed Files: Attribute.java Log Message: Old Attribute removed --- Attribute.java DELETED --- |
From: rimestad <rim...@us...> - 2006-02-01 10:04:37
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28414/src/net/sourceforge/bprocessor/gl/tool Modified Files: ToolFactory.java RotationTool.java Log Message: added selection of buttons so that the start tool are selected at start and so that selection by key shortcuts reflects to the buttons Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** ToolFactory.java 30 Jan 2006 14:11:55 -0000 1.27 --- ToolFactory.java 1 Feb 2006 10:04:28 -0000 1.28 *************** *** 69,72 **** --- 69,102 ---- /** The curretn tool */ private Tool currentTool; + + /** The selection button */ + private JToggleButton selBut; + + /** The pencil button */ + private JToggleButton pencilBut; + + /** The move button */ + private JToggleButton moveBut; + + /** The rotation button */ + private JToggleButton rotBut; + + /** The extrude button */ + private JToggleButton extrudBut; + + /** The clipplane button */ + private JToggleButton clipBut; + + /** The tapemeasure button */ + private JToggleButton tmBut; + + /** The camera rotation button */ + private JToggleButton cRotBut; + + /** The camera flymode button */ + private JToggleButton flyBut; + + /** The camera walkmode button */ + private JToggleButton walkBut; /** *************** *** 97,131 **** Toolbar tb = Toolbar.getInstance(); tb.addSeparator(); ! JToggleButton but = tb.registerAction(new SelectAction(glv)); ! bg.add(but); ! but.setToolTipText("Select"); ! but = tb.registerAction(new PencilAction(glv)); ! bg.add(but); ! but.setToolTipText("Pencil"); ! but = tb.registerAction(new MoveAction(glv)); ! bg.add(but); ! but.setToolTipText("Move"); ! but = tb.registerAction(new RotationAction(glv)); ! bg.add(but); ! but.setToolTipText("Rotate"); ! but = tb.registerAction(new ExtrudeAction(glv)); ! bg.add(but); ! but.setToolTipText("Extrude"); ! but = tb.registerAction(new ClipAction(glv)); ! bg.add(but); ! but.setToolTipText("Clipping"); ! but = tb.registerAction(new TapeMeasureAction(glv)); ! bg.add(but); ! but.setToolTipText("Tape Measure"); tb.addSeparator(); ! but = tb.registerAction(new CameraAction(glv)); ! bg.add(but); ! but.setToolTipText("Camera rotation"); ! but = tb.registerAction(new CameraFlyAction(glv)); ! bg.add(but); ! but.setToolTipText("Fly mode"); ! but = tb.registerAction(new CameraWalkAction(glv)); ! bg.add(but); ! but.setToolTipText("Walk mode"); --- 127,161 ---- Toolbar tb = Toolbar.getInstance(); tb.addSeparator(); ! selBut = tb.registerAction(new SelectAction(glv)); ! bg.add(selBut); ! selBut.setToolTipText("Select"); ! pencilBut = tb.registerAction(new PencilAction(glv)); ! bg.add(pencilBut); ! pencilBut.setToolTipText("Pencil"); ! moveBut = tb.registerAction(new MoveAction(glv)); ! bg.add(moveBut); ! moveBut.setToolTipText("Move"); ! rotBut = tb.registerAction(new RotationAction(glv)); ! bg.add(rotBut); ! rotBut.setToolTipText("Rotate"); ! extrudBut = tb.registerAction(new ExtrudeAction(glv)); ! bg.add(extrudBut); ! extrudBut.setToolTipText("Extrude"); ! clipBut = tb.registerAction(new ClipAction(glv)); ! bg.add(clipBut); ! clipBut.setToolTipText("Clipping"); ! tmBut = tb.registerAction(new TapeMeasureAction(glv)); ! bg.add(tmBut); ! tmBut.setToolTipText("Tape Measure"); tb.addSeparator(); ! cRotBut = tb.registerAction(new CameraAction(glv)); ! bg.add(cRotBut); ! cRotBut.setToolTipText("Camera rotation"); ! flyBut = tb.registerAction(new CameraFlyAction(glv)); ! bg.add(flyBut); ! flyBut.setToolTipText("Fly mode"); ! walkBut = tb.registerAction(new CameraWalkAction(glv)); ! bg.add(walkBut); ! walkBut.setToolTipText("Walk mode"); *************** *** 181,204 **** Tool temp = currentTool; if (i == Tool.SELECT_TOOL) { currentTool = select; } else if (i == Tool.MOVE_TOOL) { currentTool = move; } else if (i == Tool.ROTATION_TOOL) { currentTool = rotation; } else if (i == Tool.EXTRUSION_TOOL) { currentTool = extrusion; } else if (i == Tool.PENCIL_TOOL) { currentTool = pencil; } else if (i == Tool.CLIP_TOOL) { currentTool = clipplane; } else if (i == Tool.CAMERA_TOOL) { currentTool = camera; } else if (i == Tool.FLY_TOOL) { currentTool = fly; } else if (i == Tool.WALK_TOOL) { currentTool = walk; } else if (i == Tool.TAPE_MEASURE_TOOL) { currentTool = tapeMeasure; - return tapeMeasure; } else { log.error("[get] No such tool " + i); --- 211,243 ---- Tool temp = currentTool; if (i == Tool.SELECT_TOOL) { + selBut.setSelected(true); currentTool = select; } else if (i == Tool.MOVE_TOOL) { + moveBut.setSelected(true); currentTool = move; } else if (i == Tool.ROTATION_TOOL) { + rotBut.setSelected(true); currentTool = rotation; } else if (i == Tool.EXTRUSION_TOOL) { + extrudBut.setSelected(true); currentTool = extrusion; } else if (i == Tool.PENCIL_TOOL) { + pencilBut.setSelected(true); currentTool = pencil; } else if (i == Tool.CLIP_TOOL) { + clipBut.setSelected(true); currentTool = clipplane; } else if (i == Tool.CAMERA_TOOL) { + cRotBut.setSelected(true); currentTool = camera; } else if (i == Tool.FLY_TOOL) { + flyBut.setSelected(true); currentTool = fly; } else if (i == Tool.WALK_TOOL) { + walkBut.setSelected(true); currentTool = walk; } else if (i == Tool.TAPE_MEASURE_TOOL) { + tmBut.setSelected(true); currentTool = tapeMeasure; } else { log.error("[get] No such tool " + i); *************** *** 415,423 **** /** The GLView */ private GLView glv = null; - - /** The Cursor */ - - private Cursor cursor = null; /** * Constructor --- 454,461 ---- /** The GLView */ private GLView glv = null; + /** The mouse cursor */ + private Cursor cursor; + /** * Constructor Index: RotationTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/RotationTool.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** RotationTool.java 30 Jan 2006 14:48:44 -0000 1.7 --- RotationTool.java 1 Feb 2006 10:04:28 -0000 1.8 *************** *** 217,220 **** --- 217,221 ---- */ private void rotate(Vertex v1, Vertex v2, Vertex center) { + //TODO need to take constratints into account Vertex first = from.minus(center); Vertex second = initial.minus(center); |
From: rimestad <rim...@us...> - 2006-02-01 10:04:36
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28414/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: added selection of buttons so that the start tool are selected at start and so that selection by key shortcuts reflects to the buttons Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** View.java 31 Jan 2006 14:44:53 -0000 1.54 --- View.java 1 Feb 2006 10:04:27 -0000 1.55 *************** *** 378,381 **** --- 378,382 ---- bg.add(but); but.setToolTipText("Shading"); + but.setSelected(true); } |
From: Michael L. <he...@us...> - 2006-02-01 09:38:06
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18392/src/net/sourceforge/bprocessor/model Modified Files: Project.java Log Message: Fix for camera not working after File->Open Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** Project.java 1 Feb 2006 09:00:23 -0000 1.33 --- Project.java 1 Feb 2006 09:37:57 -0000 1.34 *************** *** 124,127 **** --- 124,129 ---- addCams(); changed(this); + // FIXME: The current camera object has not really changed.. + changed(currentCamera); } |
From: Michael L. <he...@us...> - 2006-02-01 09:08:48
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6844/src/net/sourceforge/bprocessor/model Modified Files: Edge.java Vertex.java Surface.java Added Files: Geometric.java Log Message: Added a common superclass Geometric for Surface, Edge and Vertex Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** Surface.java 24 Jan 2006 14:10:42 -0000 1.66 --- Surface.java 1 Feb 2006 09:08:39 -0000 1.67 *************** *** 26,30 **** * usage="read-write" */ ! public class Surface extends Entity { /** The logger */ private static Logger log = Logger.getLogger(Surface.class); --- 26,30 ---- * usage="read-write" */ ! public class Surface extends Geometric { /** The logger */ private static Logger log = Logger.getLogger(Surface.class); Index: Edge.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Edge.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Edge.java 27 Jan 2006 11:41:07 -0000 1.28 --- Edge.java 1 Feb 2006 09:08:39 -0000 1.29 *************** *** 22,26 **** * usage="read-write" */ ! public class Edge extends Entity { /** The logger */ private static Logger log = Logger.getLogger(Edge.class); --- 22,26 ---- * usage="read-write" */ ! public class Edge extends Geometric { /** The logger */ private static Logger log = Logger.getLogger(Edge.class); Index: Vertex.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Vertex.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Vertex.java 27 Jan 2006 11:41:08 -0000 1.20 --- Vertex.java 1 Feb 2006 09:08:39 -0000 1.21 *************** *** 22,26 **** * usage="read-write" */ ! public class Vertex extends Entity { /** The logger */ private static Logger log = Logger.getLogger(Vertex.class); --- 22,26 ---- * usage="read-write" */ ! public class Vertex extends Geometric { /** The logger */ private static Logger log = Logger.getLogger(Vertex.class); --- NEW FILE: Geometric.java --- //--------------------------------------------------------------------------------- // $Id: Geometric.java,v 1.1 2006/02/01 09:08:39 henryml Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.model; /** * The Geometric as a super class for geometric entities * surface, edge and vertex */ public abstract class Geometric extends Entity { } |