bprocessor-commit Mailing List for B-processor (Page 142)
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: Nikolaj B. <nbr...@us...> - 2006-01-13 09:30:13
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6991/src/net/sourceforge/bprocessor/model Modified Files: Space.java Log Message: Added a description to spaces Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Space.java 4 Jan 2006 14:30:07 -0000 1.12 --- Space.java 13 Jan 2006 09:30:01 -0000 1.13 *************** *** 22,25 **** --- 22,27 ---- /** The name */ private String name; + /** The Discription */ + private String description; /** The attributes */ private Set attributes; *************** *** 42,45 **** --- 44,48 ---- super(); setName(name); + setDescription(""); } *************** *** 79,82 **** --- 82,104 ---- } + + /** + * Set the discription + * @param des The description of the space + */ + public void setDescription(String des) { + this.description = des; + } + + /** + * Set the description + * @return description The description of the space + * @hibernate.property + */ + public String getDescription() { + return description; + } + + /** * Get the attributes |
From: Nikolaj B. <nbr...@us...> - 2006-01-13 09:29:38
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6919/src/net/sourceforge/bprocessor/gui/attrview Modified Files: AttributeView.java MyKeyListener.java Added Files: MyFocusListener.java Log Message: Added textarea to the attribute view of spaces, so its no possible to make a description. --- NEW FILE: MyFocusListener.java --- //--------------------------------------------------------------------------------- // $Id: MyFocusListener.java,v 1.1 2006/01/13 09:29:29 nbramsen Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui.attrview; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import javax.swing.text.JTextComponent; import net.sourceforge.bprocessor.model.Space; /** * The focus handler */ public class MyFocusListener implements FocusListener { /** The current space */ private Space current; /** * The constructor * @param o the event */ public MyFocusListener (Space o) { current = o; } /** * Handles the focus gained event * @param arg0 the event */ public void focusGained(FocusEvent arg0) { // TODO Auto-generated method stub } /** * Handles the focus lost event * @param arg0 the event */ public void focusLost(FocusEvent arg0) { JTextComponent tf = (JTextComponent)arg0.getSource(); String newDes = tf.getText(); current.setDescription(newDes); current.changed(); } } Index: MyKeyListener.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/MyKeyListener.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MyKeyListener.java 4 Jan 2006 14:29:55 -0000 1.3 --- MyKeyListener.java 13 Jan 2006 09:29:29 -0000 1.4 *************** *** 17,21 **** */ public class MyKeyListener implements KeyListener { ! /** The current ConstructionSpace */ private Space cons; --- 17,27 ---- */ public class MyKeyListener implements KeyListener { ! ! /** If its a textfield */ ! public static final String TFIELD = "Textfield"; ! ! /** If its a textfield */ ! public static final String TAREA = "Textarea"; ! /** The current ConstructionSpace */ private Space cons; *************** *** 26,36 **** /** The current Object */ private Object current; /** * The constructor * @param o the event */ ! public MyKeyListener (Object o) { current = o; } --- 32,47 ---- /** The current Object */ private Object current; + + /** The type of component */ + private String type; /** * The constructor * @param o the event + * @param type shows the type of the component the listeners listens too. */ ! public MyKeyListener (Object o, String type) { current = o; + this.type = type; } *************** *** 40,43 **** --- 51,55 ---- */ public void keyTyped(KeyEvent e) { + } *************** *** 50,54 **** /** ! * Handles focus event * @param e the event */ --- 62,66 ---- /** ! * Handles the keypressed event * @param e the event */ *************** *** 56,75 **** int keyPressed = e.getKeyCode(); if (keyPressed == KeyEvent.VK_ENTER) { ! JTextComponent tf = (JTextComponent)e.getSource(); ! String newName = tf.getText(); ! if (current instanceof Space) { ! Space space = (Space) current; ! if (space.isFunctionalSpace()) { ! funs = space; ! funs.setName(newName); ! funs.changed(); ! } ! if (space.isConstructionSpace()) { ! cons = space; ! cons.setName(newName); ! cons.changed(); ! } } - } } --- 68,88 ---- int keyPressed = e.getKeyCode(); if (keyPressed == KeyEvent.VK_ENTER) { ! if (type == TFIELD) { ! JTextComponent tf = (JTextComponent)e.getSource(); ! String newName = tf.getText(); ! if (current instanceof Space) { ! Space space = (Space) current; ! if (space.isFunctionalSpace()) { ! funs = space; ! funs.setName(newName); ! funs.changed(); ! } ! if (space.isConstructionSpace()) { ! cons = space; ! cons.setName(newName); ! cons.changed(); ! } ! } } } } Index: AttributeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/AttributeView.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** AttributeView.java 10 Jan 2006 14:02:21 -0000 1.17 --- AttributeView.java 13 Jan 2006 09:29:29 -0000 1.18 *************** *** 25,28 **** --- 25,29 ---- import javax.swing.JPanel; import javax.swing.JTabbedPane; + import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.JComboBox; *************** *** 91,94 **** --- 92,101 ---- private Object current; + /** If its a textfield */ + public static final String TFIELD = "Textfield"; + + /** If its a textfield */ + public static final String TAREA = "Textarea"; + /** * Constructor *************** *** 120,124 **** layout.setConstraints(nameEdit, con); add(nameEdit); ! nameEdit.addKeyListener(new MyKeyListener(o)); Object[] options = {"Arbejdsværelse", "Badeværelse", "Gang", "Køkken", "Stue", "Værelse"}; --- 127,131 ---- layout.setConstraints(nameEdit, con); add(nameEdit); ! nameEdit.addKeyListener(new MyKeyListener(o, TFIELD)); Object[] options = {"Arbejdsværelse", "Badeværelse", "Gang", "Køkken", "Stue", "Værelse"}; *************** *** 127,138 **** add(klassifikation); ! JPanel filler = new JPanel(); ! filler.setOpaque(true); ! Color background = new Color(0.1f, 0.2f, 0.5f); ! filler.setBackground(background); con.weighty = 1.0; con.fill = GridBagConstraints.BOTH; ! layout.setConstraints(filler, con); ! add(filler); revalidate(); } --- 134,145 ---- add(klassifikation); ! JTextArea funcSpaceDescripton = new JTextArea(o.getDescription()); ! funcSpaceDescripton.setWrapStyleWord(true); ! funcSpaceDescripton.setLineWrap(true); con.weighty = 1.0; con.fill = GridBagConstraints.BOTH; ! layout.setConstraints(funcSpaceDescripton, con); ! funcSpaceDescripton.addFocusListener(new MyFocusListener(o)); ! add(funcSpaceDescripton); revalidate(); } *************** *** 150,162 **** JLabel name = new JLabel("Name:"); ! con.anchor = GridBagConstraints.NORTH; ! con.weightx = 1.0; layout.setConstraints(name, con); ! add(name); ! JTextField nameEdit = new JTextField(o.getName(), 10); ! nameEdit.addKeyListener(new MyKeyListener(o)); con.gridwidth = GridBagConstraints.REMAINDER; layout.setConstraints(nameEdit, con); ! add(nameEdit); revalidate(); } --- 157,190 ---- JLabel name = new JLabel("Name:"); ! con.anchor = GridBagConstraints.NORTHEAST; ! con.weightx = 0; layout.setConstraints(name, con); ! add(name); ! ! ! ! JTextField nameEdit = new JTextField(o.getName()); con.gridwidth = GridBagConstraints.REMAINDER; + con.weightx = 1.0; + con.fill = GridBagConstraints.HORIZONTAL; layout.setConstraints(nameEdit, con); ! add(nameEdit); ! nameEdit.addKeyListener(new MyKeyListener(o, TFIELD)); ! ! Object[] options = {"Arbejdsværelse", "Badeværelse", "Gang", "Køkken", "Stue", "Værelse"}; ! JComboBox klassifikation = new JComboBox(options); ! layout.setConstraints(klassifikation, con); ! add(klassifikation); ! ! JTextArea consSpaceDescripton = new JTextArea(o.getDescription()); ! consSpaceDescripton.setLineWrap(true); ! consSpaceDescripton.setWrapStyleWord(true); ! con.weighty = 1.0; ! con.fill = GridBagConstraints.BOTH; ! layout.setConstraints(consSpaceDescripton, con); ! consSpaceDescripton.addFocusListener(new MyFocusListener(o)); ! add(consSpaceDescripton); ! revalidate(); ! revalidate(); } |
From: Michael L. <he...@us...> - 2006-01-11 14:42:49
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16256/src/net/sourceforge/bprocessor/gl/tool Modified Files: SpaceTool.java Log Message: OffsetConstraint implemented Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SpaceTool.java 11 Jan 2006 13:50:10 -0000 1.4 --- SpaceTool.java 11 Jan 2006 14:42:38 -0000 1.5 *************** *** 15,18 **** --- 15,19 ---- import java.util.HashSet; import java.util.Iterator; + import java.util.List; import java.util.Set; *************** *** 26,32 **** --- 27,35 ---- import net.sourceforge.bprocessor.model.Constraint; import net.sourceforge.bprocessor.model.Constraints; + import net.sourceforge.bprocessor.model.CoordinateSystem; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Space; import net.sourceforge.bprocessor.model.Surface; + import net.sourceforge.bprocessor.model.Vertex; /** *************** *** 101,104 **** --- 104,110 ---- */ public class OffsetConstraint extends Constraint { + /** The offset */ + private double offset; + /** * Constructor for OffsetConstraint *************** *** 108,112 **** public OffsetConstraint(Surface master, Surface slave) { super(master, slave); ! log.info("initialize offset " + master + " -> " + slave); } --- 114,158 ---- public OffsetConstraint(Surface master, Surface slave) { super(master, slave); ! updateOffset(); ! } ! ! /** ! * Update offset ! */ ! protected void updateOffset() { ! Surface master = (Surface) getMaster(); ! Surface slave = (Surface) getSlave(); ! CoordinateSystem system = master.coordinateSystem(); ! Vertex origin = system.origin(); ! Vertex n = system.getN(); ! n.scale(1 / n.length()); ! Vertex v = slave.getFirstVertex(); ! Vertex u = v.minus(origin); ! double distance = n.dot(u); ! this.offset = distance; ! } ! ! /** ! * Maintain offset ! */ ! protected void maintainOffset() { ! Surface master = (Surface) getMaster(); ! Surface slave = (Surface) getSlave(); ! CoordinateSystem system = master.coordinateSystem(); ! Vertex origin = system.origin(); ! Vertex n = system.getN(); ! n.scale(1 / n.length()); ! List vertices = slave.getVertices(); ! vertices.remove(0); ! Iterator iter = vertices.iterator(); ! while (iter.hasNext()) { ! Vertex current = (Vertex) iter.next(); ! Vertex p = system.translate(current); ! p.setZ(offset); ! p = system.unTranslate(p); ! current.setX(p.getX()); ! current.setY(p.getY()); ! current.setZ(p.getZ()); ! } } *************** *** 116,120 **** */ public void update(Object entity) { ! log.info("maintain offset " + entity); } } --- 162,170 ---- */ public void update(Object entity) { ! if (entity == getSlave()) { ! updateOffset(); ! } else { ! maintainOffset(); ! } } } |
From: Michael L. <he...@us...> - 2006-01-11 13:55:43
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31937/src/net/sourceforge/bprocessor/gl/tool Modified Files: MoveTool.java Log Message: MoveTool asks Constraints to update Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** MoveTool.java 10 Jan 2006 14:04:42 -0000 1.22 --- MoveTool.java 11 Jan 2006 13:55:28 -0000 1.23 *************** *** 11,15 **** --- 11,17 ---- + import net.sourceforge.bprocessor.model.Constraints; import net.sourceforge.bprocessor.model.Edge; + import net.sourceforge.bprocessor.model.Entity; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Vertex; *************** *** 128,131 **** --- 130,137 ---- ClippingPlane plane = (ClippingPlane) o; plane.update(); + } else { + if (o instanceof Entity) { + Constraints.getInstance().update((Entity) o); + } } } |
From: Michael L. <he...@us...> - 2006-01-11 13:50:22
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29131/src/net/sourceforge/bprocessor/gl/tool Modified Files: SpaceTool.java Log Message: Added OffsetConstraint (no implementation yet) Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SpaceTool.java 11 Jan 2006 13:24:17 -0000 1.3 --- SpaceTool.java 11 Jan 2006 13:50:10 -0000 1.4 *************** *** 12,15 **** --- 12,16 ---- import java.awt.event.ActionListener; import java.awt.event.MouseEvent; + import java.util.Collection; import java.util.HashSet; import java.util.Iterator; *************** *** 23,26 **** --- 24,29 ---- import net.sourceforge.bprocessor.gl.GLView; + import net.sourceforge.bprocessor.model.Constraint; + import net.sourceforge.bprocessor.model.Constraints; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Space; *************** *** 84,88 **** offsetItem.addActionListener(new MenuAction() { public void actionPerformed(ActionEvent event) { ! log.info("OffsetConstraint should be added to selection here"); } } --- 87,91 ---- offsetItem.addActionListener(new MenuAction() { public void actionPerformed(ActionEvent event) { ! addOffsetConstraint(selection); } } *************** *** 92,95 **** --- 95,147 ---- } + + /** + * The OffsetConstraint maintains a distance between surfaces + * TODO move to model + */ + public class OffsetConstraint extends Constraint { + /** + * Constructor for OffsetConstraint + * @param master The master + * @param slave The slave + */ + public OffsetConstraint(Surface master, Surface slave) { + super(master, slave); + log.info("initialize offset " + master + " -> " + slave); + } + + /** + * Update + * @param entity The changed entity + */ + public void update(Object entity) { + log.info("maintain offset " + entity); + } + } + + /** + * Add offset constraint to objects + * @param objects The objects + */ + protected void addOffsetConstraint(Collection objects) { + if (objects.size() == 2) { + Iterator iter = objects.iterator(); + Object arg1 = iter.next(); + Object arg2 = iter.next(); + Surface master = null; + Surface slave = null; + if (arg1 instanceof Surface) { + master = (Surface) arg1; + } + if (arg2 instanceof Surface) { + slave = (Surface) arg2; + } + if (master != null && slave != null) { + OffsetConstraint constraint = new OffsetConstraint(master, slave); + Constraints.getInstance().add(constraint); + } + } + } + /** * Creates the correct type popup menu. |
From: Michael L. <he...@us...> - 2006-01-11 13:35:05
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22935/src/net/sourceforge/bprocessor/model Added Files: Constraints.java Log Message: Constraints contains all constraints and take care of updating --- NEW FILE: Constraints.java --- //--------------------------------------------------------------------------------- // $Id: Constraints.java,v 1.1 2006/01/11 13:34:47 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; import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; /** * Constraints contains all constraints on the geometry */ public class Constraints { /** The constraints */ private Collection constraints; /** The singular Constraints instance */ private static Constraints instance = new Constraints(); /** * Return the singular instance * @return The singular instance */ public static Constraints getInstance() { return instance; } /** * Constructor for constraints */ public Constraints() { constraints = new LinkedList(); } /** * Add a constraint * @param constraint The constraint to add */ public void add(Constraint constraint) { constraints.add(constraint); } /** * Remove a constraint * @param constraint The constraint to remove */ public void remove(Constraint constraint) { constraints.remove(constraint); } /** * Update all constraints related to entity * @param entity The changed entity */ public void update(Entity entity) { // TODO implement general constraint updating mechanism // that ensures that constraints are updated in correct // order Iterator iter = constraints.iterator(); while (iter.hasNext()) { Constraint current = (Constraint) iter.next(); if (current.depends(entity)) { current.update(entity); } } entity.changed(); } } |
From: Michael L. <he...@us...> - 2006-01-11 13:24:31
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19165/src/net/sourceforge/bprocessor/gl/tool Modified Files: SpaceTool.java Log Message: Added a selection menu that should be applied to selection when "SpaceTool" is active Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SpaceTool.java 11 Jan 2006 12:05:32 -0000 1.2 --- SpaceTool.java 11 Jan 2006 13:24:17 -0000 1.3 *************** *** 9,12 **** --- 9,13 ---- import java.awt.Cursor; + import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; *************** *** 58,61 **** --- 59,67 ---- } + if (e.getButton() == MouseEvent.BUTTON3) { + glv.popup(makeSelectionMenu(), e.getX(), e.getY()); + done = true; + } + if (!done) { super.pressed(e); *************** *** 63,66 **** --- 69,95 ---- } + /** + * MenuAction for making anonymous actionlisteners + */ + protected abstract class MenuAction implements ActionListener { + } + + /** + * Create a popup for performing operations on selection + * @return The popup menu + */ + protected JPopupMenu makeSelectionMenu() { + JPopupMenu menu = new JPopupMenu(); + JMenuItem offsetItem = new JMenuItem("Offset Constraint"); + offsetItem.addActionListener(new MenuAction() { + public void actionPerformed(ActionEvent event) { + log.info("OffsetConstraint should be added to selection here"); + } + } + ); + menu.add(offsetItem); + return menu; + } + /** * Creates the correct type popup menu. |
From: Michael L. <he...@us...> - 2006-01-11 12:05:41
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26449/src/net/sourceforge/bprocessor/gl/tool Modified Files: SpaceTool.java SelectTool.java Log Message: Cleanup Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SpaceTool.java 15 Nov 2005 19:04:10 -0000 1.1 --- SpaceTool.java 11 Jan 2006 12:05:32 -0000 1.2 *************** *** 9,14 **** --- 9,28 ---- import java.awt.Cursor; + import java.awt.event.ActionListener; + import java.awt.event.MouseEvent; + import java.util.HashSet; + import java.util.Iterator; + import java.util.Set; + + import javax.swing.JMenu; + import javax.swing.JMenuItem; + import javax.swing.JPopupMenu; + + import org.apache.log4j.Logger; import net.sourceforge.bprocessor.gl.GLView; + import net.sourceforge.bprocessor.model.Project; + import net.sourceforge.bprocessor.model.Space; + import net.sourceforge.bprocessor.model.Surface; /** *************** *** 16,20 **** */ public class SpaceTool extends SelectTool { ! /** * Construct the SpaceTool --- 30,35 ---- */ public class SpaceTool extends SelectTool { ! /** The logger */ ! private static Logger log = Logger.getLogger(SpaceTool.class); /** * Construct the SpaceTool *************** *** 26,29 **** --- 41,185 ---- } + /** + * Invoked when a mouse button has been pressed on a component. + * @param e The MouseEvent object + */ + protected void pressed(MouseEvent e) { + findTarget(e); + boolean done = false; + if (e.getButton() == MouseEvent.BUTTON1) { + if (target != null) { + if (target instanceof String) { + String side = (String)target; + glv.popup(makeSpaceMenu(side), e.getX(), e.getY()); + done = true; + } + } + } + + if (!done) { + super.pressed(e); + } + } + + /** + * Creates the correct type popup menu. + * @param type the type of popup should be created + * @return the popup menu. + */ + protected JPopupMenu makeSpaceMenu(String type) { + if (type.equals("bar")) { + return seperatorPopup(); + } else if (type.equals("front") || type.equals("back")) { + return spacePopup(type); + } else { + log.warn("\"" + type + "\" is not a recognized type of popup"); + return null; + } + } + + /** + * Creates the popup that appears when pressing a space seperator + * @return the seperatorpopup menu. + */ + private JPopupMenu seperatorPopup() { + JPopupMenu sepPop = new JPopupMenu(); + Iterator selIt = new HashSet(selection).iterator(); + if (selIt.hasNext()) { + Object o = selIt.next(); + if (o instanceof Surface) { + Surface surface = (Surface)o; + JMenuItem shift = new JMenuItem("Shift spaces"); + ActionListener shiftListener = new ShiftActionListener(surface); + shift.addActionListener(shiftListener); + JMenuItem copy = new JMenuItem("Copy space assignment"); + ActionListener copyListener = new CopyActionListener(surface, glv.getView()); + copy.addActionListener(copyListener); + JMenuItem paste = new JMenuItem("Paste space assignment"); + ActionListener pasteListener = new PasteActionListener(surface, glv.getView()); + paste.addActionListener(pasteListener); + + sepPop.add(shift); + sepPop.add(copy); + sepPop.add(paste); + sepPop.pack(); + return sepPop; + } + } + log.warn("Seperator popup menu has no surface"); + return sepPop; + } + + /** + * Creates the popup that appears when pressing a space label + * @param side string indicating the wich space is choosen (front or back). + * @return the spacepopup menu. + */ + private JPopupMenu spacePopup(String side) { + JPopupMenu pp = new JPopupMenu(side); + SpacePopupListener spl = new SpacePopupListener(side.equals("front"), glv.getView()); + Set domains = Project.getInstance().getDomains(); + Iterator domIt = domains.iterator(); + Iterator selIt = new HashSet(selection).iterator(); + Surface surface = null; + if (selIt.hasNext()) { + Object o = selIt.next(); + if (o instanceof Surface) { + surface = (Surface)o; + } + JMenuItem noneItem = new JMenuItem("NONE"); + ActionListener noneListener = new DomainPopupListener(null, + surface, + side.equals("front")); + noneItem.addActionListener(noneListener); + + JMenuItem createFuncItem = new JMenuItem("New Functional Space"); + ActionListener funcListener = new CreateSpaceActionListener(surface, + side.equals("front"), + true); + createFuncItem.addActionListener(funcListener); + + JMenuItem createConstItem = new JMenuItem("New Construction Space"); + ActionListener constListener = new CreateSpaceActionListener(surface, + side.equals("front"), + false); + createConstItem.addActionListener(constListener); + + JMenu funcMenu = new JMenu("Functional Spaces"); + JMenu constMenu = new JMenu("Construction Spaces"); + boolean funcEnabled = false; + boolean constEnabled = false; + while (domIt.hasNext()) { + Space domain = (Space)domIt.next(); + if (domain instanceof Space) { + JMenuItem domainItem = new JMenuItem(domain.getName()); + ActionListener ml = new DomainPopupListener(domain, + surface, + side.equals("front")); + domainItem.addActionListener(ml); + if (domain.isFunctionalSpace()) { + funcMenu.add(domainItem); + } else { + constMenu.add(domainItem); + } + } + } + + funcMenu.addSeparator(); + funcMenu.add(createFuncItem); + constMenu.addSeparator(); + constMenu.add(createConstItem); + pp.add(funcMenu); + pp.add(constMenu); + pp.addSeparator(); + pp.add(noneItem); + pp.addPopupMenuListener(spl); + pp.pack(); + return pp; + } else { + log.warn("Space popup menu has no surface"); + return null; + } + } Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** SelectTool.java 11 Jan 2006 11:38:41 -0000 1.50 --- SelectTool.java 11 Jan 2006 12:05:33 -0000 1.51 *************** *** 11,15 **** import net.sourceforge.bprocessor.model.Edge; - import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Surface; --- 11,14 ---- *************** *** 23,31 **** import javax.swing.JPopupMenu; import javax.swing.JMenuItem; - import javax.swing.JMenu; import java.util.Iterator; - import java.util.Set; - import java.util.HashSet; import org.apache.log4j.Logger; --- 22,27 ---- *************** *** 89,96 **** } } else { ! if (target instanceof String) { ! String side = (String)target; ! glv.popup(makePopup(side), e.getX(), e.getY()); ! } else if (target == null) { selection.clear(); } else if (e.isShiftDown()) { --- 85,89 ---- } } else { ! if (target == null) { selection.clear(); } else if (e.isShiftDown()) { *************** *** 111,233 **** - /** - * Creates the correct type popup menu. - * @param type the type of popup should be created - * @return the popup menu. - */ - private JPopupMenu makePopup(String type) { - if (type.equals("bar")) { - return seperatorPopup(); - } else if (type.equals("front") || type.equals("back")) { - return spacePopup(type); - } else { - log.warn("\"" + type + "\" is not a recognized type of popup"); - return null; - } - } - - /** - * Creates the popup that appears when pressing a space seperator - * @return the seperatorpopup menu. - */ - private JPopupMenu seperatorPopup() { - JPopupMenu sepPop = new JPopupMenu(); - Iterator selIt = new HashSet(selection).iterator(); - if (selIt.hasNext()) { - Object o = selIt.next(); - if (o instanceof Surface) { - Surface surface = (Surface)o; - JMenuItem shift = new JMenuItem("Shift spaces"); - ActionListener shiftListener = new ShiftActionListener(surface); - shift.addActionListener(shiftListener); - JMenuItem copy = new JMenuItem("Copy space assignment"); - ActionListener copyListener = new CopyActionListener(surface, glv.getView()); - copy.addActionListener(copyListener); - JMenuItem paste = new JMenuItem("Paste space assignment"); - ActionListener pasteListener = new PasteActionListener(surface, glv.getView()); - paste.addActionListener(pasteListener); - - sepPop.add(shift); - sepPop.add(copy); - sepPop.add(paste); - sepPop.pack(); - return sepPop; - } - } - log.warn("Seperator popup menu has no surface"); - return sepPop; - } - - /** - * Creates the popup that appears when pressing a space label - * @param side string indicating the wich space is choosen (front or back). - * @return the spacepopup menu. - */ - private JPopupMenu spacePopup(String side) { - JPopupMenu pp = new JPopupMenu(side); - SpacePopupListener spl = new SpacePopupListener(side.equals("front"), glv.getView()); - Set domains = Project.getInstance().getDomains(); - Iterator domIt = domains.iterator(); - Iterator selIt = new HashSet(selection).iterator(); - Surface surface = null; - if (selIt.hasNext()) { - Object o = selIt.next(); - if (o instanceof Surface) { - surface = (Surface)o; - } - JMenuItem noneItem = new JMenuItem("NONE"); - ActionListener noneListener = new DomainPopupListener(null, - surface, - side.equals("front")); - noneItem.addActionListener(noneListener); - - JMenuItem createFuncItem = new JMenuItem("New Functional Space"); - ActionListener funcListener = new CreateSpaceActionListener(surface, - side.equals("front"), - true); - createFuncItem.addActionListener(funcListener); - - JMenuItem createConstItem = new JMenuItem("New Construction Space"); - ActionListener constListener = new CreateSpaceActionListener(surface, - side.equals("front"), - false); - createConstItem.addActionListener(constListener); - - JMenu funcMenu = new JMenu("Functional Spaces"); - JMenu constMenu = new JMenu("Construction Spaces"); - boolean funcEnabled = false; - boolean constEnabled = false; - while (domIt.hasNext()) { - Space domain = (Space)domIt.next(); - if (domain instanceof Space) { - JMenuItem domainItem = new JMenuItem(domain.getName()); - ActionListener ml = new DomainPopupListener(domain, - surface, - side.equals("front")); - domainItem.addActionListener(ml); - if (domain.isFunctionalSpace()) { - funcMenu.add(domainItem); - } else { - constMenu.add(domainItem); - } - } - } - - funcMenu.addSeparator(); - funcMenu.add(createFuncItem); - constMenu.addSeparator(); - constMenu.add(createConstItem); - pp.add(funcMenu); - pp.add(constMenu); - pp.addSeparator(); - pp.add(noneItem); - pp.addPopupMenuListener(spl); - pp.pack(); - return pp; - } else { - log.warn("Space popup menu has no surface"); - return null; - } - } /** --- 104,107 ---- |
From: Michael L. <he...@us...> - 2006-01-11 11:38:51
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20872/src/net/sourceforge/bprocessor/gl/tool Modified Files: SelectTool.java Log Message: Cleanup in SelectTool Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** SelectTool.java 6 Jan 2006 15:36:14 -0000 1.49 --- SelectTool.java 11 Jan 2006 11:38:41 -0000 1.50 *************** *** 20,24 **** import java.awt.event.MouseEvent; import java.awt.event.KeyEvent; - import java.awt.event.InputEvent; import javax.swing.JPopupMenu; --- 20,23 ---- *************** *** 38,44 **** /** The logger */ private static Logger log = Logger.getLogger(SelectTool.class); - - /** the Viewtype */ - protected int viewType; /** --- 37,40 ---- *************** *** 74,80 **** */ protected void pressed(MouseEvent e) { ! if (e.getButton() == MouseEvent.BUTTON3) { - findTarget(e); if (target != null) { if (target instanceof String) { --- 70,75 ---- */ protected void pressed(MouseEvent e) { ! findTarget(e); if (e.getButton() == MouseEvent.BUTTON3) { if (target != null) { if (target instanceof String) { *************** *** 86,138 **** if (e.getButton() == MouseEvent.BUTTON1) { if (e.getClickCount() >= 2 && target instanceof Surface) { ! Project df = Project.getInstance(); ! Set ds = new HashSet(); ! Surface surf = (Surface) target; ! if (surf.getBackDomain() != null) { ! ds.add(surf.getBackDomain()); ! } ! if (surf.getFrontDomain() != null) { ! ds.add(surf.getFrontDomain()); } ! if (!ds.isEmpty()) { ! Iterator dit = ds.iterator(); ! while (dit.hasNext()) { ! Space d = (Space)dit.next(); ! Set s = d.getSurfaces(); ! Iterator it = s.iterator(); ! while (it.hasNext()) { ! Surface surface = (Surface)it.next(); ! if (!selection.contains(surface)) { ! selection.add(surface); ! } ! } ! } } } else { - findTarget(e); if (target instanceof String) { String side = (String)target; glv.popup(makePopup(side), e.getX(), e.getY()); } else if (target == null) { - Iterator it = new HashSet(selection).iterator(); - while (it.hasNext()) { - deselect(it.next()); - } selection.clear(); ! } else if ((e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) ! == InputEvent.SHIFT_DOWN_MASK) { if (!selection.contains(target)) { ! select(target); } else { ! deselect(target); } } else { if (!selection.contains(target)) { - Iterator it = new HashSet(selection).iterator(); - while (it.hasNext()) { - deselect(it.next()); - } selection.clear(); ! select(target); } } --- 81,107 ---- if (e.getButton() == MouseEvent.BUTTON1) { if (e.getClickCount() >= 2 && target instanceof Surface) { ! Surface surface = (Surface) target; ! if (surface.getBackDomain() != null) { ! selection.addAll(surface.getBackDomain().getSurfaces()); } ! if (surface.getFrontDomain() != null) { ! selection.addAll(surface.getFrontDomain().getSurfaces()); } } else { if (target instanceof String) { String side = (String)target; glv.popup(makePopup(side), e.getX(), e.getY()); } else if (target == null) { selection.clear(); ! } else if (e.isShiftDown()) { if (!selection.contains(target)) { ! selection.add(target); } else { ! selection.remove(target); } } else { if (!selection.contains(target)) { selection.clear(); ! selection.add(target); } } *************** *** 297,322 **** /** - * Sends the notification for select - * @param obj The selected object - */ - private void select(Object obj) { - selection.add(obj); - } - - /** - * Sends the notification for deselect - * @param obj The selected object - */ - private void deselect(Object obj) { - selection.remove(obj); - } - - /** * Invoked when a mouse button has been released on a component. * @param e The MouseEvent */ ! protected void released(MouseEvent e) { ! //findTarget(e); ! } /** --- 266,273 ---- /** * Invoked when a mouse button has been released on a component. * @param e The MouseEvent */ ! protected void released(MouseEvent e) { } /** |
From: Michael L. <he...@us...> - 2006-01-11 10:20:11
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7150/src/net/sourceforge/bprocessor/model Added Files: History.java Log Message: History of commands for handling undo/redo --- NEW FILE: History.java --- //--------------------------------------------------------------------------------- // $Id: History.java,v 1.1 2006/01/11 10:19:58 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; import java.util.Stack; /** * The History for containing commands for undo and redo support */ public class History { /** The undo stack */ private Stack undoStack; /** The redo stack */ private Stack redoStack; /** A singular history instance */ private static History instance = new History(); /** * Return the singular history instance * @return The history */ public static History getInstance() { return instance; } /** * Constructor for History */ public History() { undoStack = new Stack(); redoStack = new Stack(); } /** * Apply a command, clear the redo stack and * push the new command on the undo stack. * @param command The command to apply */ public void apply(Command command) { command.apply(); redoStack.clear(); undoStack.push(command); } /** * Undo the command on top of undo stack and push * it on the redo stack */ public void undo() { if (!undoStack.isEmpty()) { Command top = (Command) undoStack.pop(); top.undo(); redoStack.push(top); } } /** * Redo the command on top of redo stack and push * it on the undo stack */ public void redo() { if (!redoStack.isEmpty()) { Command top = (Command) redoStack.pop(); top.redo(); undoStack.push(top); } } /** * Return the top of the undo stack or null if empty. * @return The top of the undo stack */ public Command undoTop() { if (!undoStack.isEmpty()) { return (Command) undoStack.peek(); } else { return null; } } /** * Return the top of the redo stack or null if empty. * @return The top of the redo stack */ public Command redoTop() { if (!redoStack.isEmpty()) { return (Command) redoStack.peek(); } else { return null; } } /** * Clear this History */ public void clear() { undoStack.clear(); redoStack.clear(); } } |
From: Michael L. <he...@us...> - 2006-01-11 10:04:44
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4080/src/net/sourceforge/bprocessor/model Added Files: Command.java Log Message: Command interface for undo/redo --- NEW FILE: Command.java --- //--------------------------------------------------------------------------------- // $Id: Command.java,v 1.1 2006/01/11 10:04:36 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; /** * Command interface for representing undoable commands. */ public interface Command { /** * Apply this Command */ public void apply(); /** * Undo this Command */ public void undo(); /** * Redo this Command */ public void redo(); /** * Return the name for display in menues etc. * @return The display name */ public String name(); } |
From: Michael L. <he...@us...> - 2006-01-11 09:08:09
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20349/src/net/sourceforge/bprocessor/gui/actions Modified Files: FileNewActionListener.java Log Message: Clear selection in new Index: FileNewActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions/FileNewActionListener.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FileNewActionListener.java 15 Nov 2005 19:01:02 -0000 1.1 --- FileNewActionListener.java 11 Jan 2006 09:07:58 -0000 1.2 *************** *** 12,15 **** --- 12,16 ---- import net.sourceforge.bprocessor.model.Project; + import net.sourceforge.bprocessor.model.Selection; /** *************** *** 31,34 **** --- 32,36 ---- */ public void actionPerformed(ActionEvent event) { + Selection.primary().clear(); Project.getInstance().clear(); } |
From: Michael L. <he...@us...> - 2006-01-10 14:57:17
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28053/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Removed some TODO comments Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** View.java 10 Jan 2006 14:49:45 -0000 1.43 --- View.java 10 Jan 2006 14:57:06 -0000 1.44 *************** *** 1401,1405 **** } else { if (side == FRONT) { - // TODO Check the color of the front material of the Surface if (s.getFrontMaterial() == null) { Space back = s.getFrontDomain(); --- 1401,1404 ---- *************** *** 1410,1414 **** } if (side == BACK) { - // TODO Check the color of the back material of the Surface if (s.getBackMaterial() == null) { Space front = s.getBackDomain(); --- 1409,1412 ---- |
From: Michael L. <he...@us...> - 2006-01-10 14:49:53
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26411/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Small fix Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** View.java 10 Jan 2006 14:35:37 -0000 1.42 --- View.java 10 Jan 2006 14:49:45 -0000 1.43 *************** *** 1406,1410 **** gl.glColor3fv(getSpaceColor(back)); } else { ! gl.glColor3fv(s.getFrontMaterial().getColor().getRGBComponents(null)); } } --- 1406,1410 ---- gl.glColor3fv(getSpaceColor(back)); } else { ! gl.glColor3fv(s.getFrontMaterial().getColor3fv()); } } *************** *** 1415,1419 **** gl.glColor3fv(getSpaceColor(front)); } else { ! gl.glColor3fv(s.getBackMaterial().getColor().getRGBComponents(null)); } } --- 1415,1419 ---- gl.glColor3fv(getSpaceColor(front)); } else { ! gl.glColor3fv(s.getBackMaterial().getColor3fv()); } } |
From: Michael L. <he...@us...> - 2006-01-10 14:42:37
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25487/src/net/sourceforge/bprocessor/model Modified Files: Material.java Log Message: Material.getColor3fv() Index: Material.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Material.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Material.java 10 Jan 2006 13:41:38 -0000 1.2 --- Material.java 10 Jan 2006 14:42:24 -0000 1.3 *************** *** 63,67 **** return color; } ! /** * Set the color --- 63,67 ---- return color; } ! /** * Set the color *************** *** 70,73 **** public void setColor(Color color) { this.color = color; ! } } --- 70,82 ---- public void setColor(Color color) { this.color = color; ! } ! ! /** ! * Return The color components as array of 3 floating ! * point values ! * @return The color components ! */ ! public float[] getColor3fv() { ! return color.getRGBColorComponents(null); ! } } |
From: Michael L. <he...@us...> - 2006-01-10 14:35:45
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24324/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Cleanup in Pencil. Pre-initialize of tesselator by drawing a surface during init. Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** View.java 10 Jan 2006 14:06:49 -0000 1.41 --- View.java 10 Jan 2006 14:35:37 -0000 1.42 *************** *** 417,420 **** --- 417,434 ---- gl.glEnable(GL.GL_COLOR_MATERIAL); gl.glColorMaterial(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE); + { + Vertex v1 = new Vertex(0, 0, 0); + Vertex v2 = new Vertex(0, 1, 0); + Vertex v3 = new Vertex(1, 1, 0); + Edge e1 = new Edge(v1, v2); + Edge e2 = new Edge(v2, v3); + Edge e3 = new Edge(v3, v1); + List edges = new LinkedList(); + edges.add(e1); + edges.add(e2); + edges.add(e3); + Surface s = new Surface(edges); + drawSurface(s); + } } *************** *** 1182,1186 **** //Contours contained in an even number of contours are filled glu.gluTessProperty(tess, GLU.GLU_TESS_WINDING_RULE, GLU.GLU_TESS_WINDING_ODD); ! //begining the polygon, we are not using userdata for now (hence the null) glu.gluTessBeginPolygon(tess, null); --- 1196,1200 ---- //Contours contained in an even number of contours are filled glu.gluTessProperty(tess, GLU.GLU_TESS_WINDING_RULE, GLU.GLU_TESS_WINDING_ODD); ! //begining the polygon, we are not using userdata for now (hence the null) glu.gluTessBeginPolygon(tess, null); *************** *** 1193,1198 **** --- 1207,1214 ---- } } + //drawing the outer contour drawContour(s, tess); + //drawing the inner conturs Set innerSurfaces = s.getHoles(); *************** *** 1204,1208 **** } } - glu.gluTessEndPolygon(tess); glu.gluDeleteTess(tess); --- 1220,1223 ---- |
From: Michael L. <he...@us...> - 2006-01-10 14:35:45
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24324/src/net/sourceforge/bprocessor/gl/tool Modified Files: PencilTool.java Log Message: Cleanup in Pencil. Pre-initialize of tesselator by drawing a surface during init. Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** PencilTool.java 10 Jan 2006 14:01:48 -0000 1.55 --- PencilTool.java 10 Jan 2006 14:35:37 -0000 1.56 *************** *** 477,576 **** /** - * Round to mm - * @param value The value - * @return The rounded value - */ - protected double roundMM(double value) { - return value; - //return ((double) Math.round(value * 1000)) / 1000.0; - } - - - /** - * Snaps the vertex - * @param vertex The vertex to snap - */ - protected void snap(Vertex vertex) { - if (alignVertex != null) { - if (Math.abs(alignVertex.getX() - vertex.getX()) < 0.3) { - vertex.setX(alignVertex.getX()); - } else { - vertex.setX(round(current.getX())); - } - if (Math.abs(alignVertex.getY() - vertex.getY()) < 0.3) { - vertex.setY(alignVertex.getY()); - } else { - vertex.setY(round(current.getY())); - } - if (Math.abs(alignVertex.getZ() - vertex.getZ()) < 0.3) { - vertex.setZ(alignVertex.getZ()); - } else { - vertex.setZ(round(current.getZ())); - } - } else { - vertex.setX(round(current.getX())); - vertex.setY(round(current.getY())); - vertex.setZ(round(current.getZ())); - } - } - - /** - * Snaps within a coordinate system - * @param system The coordinate system - * @param vertex The vertex to snap - */ - protected void snapInSystem(CoordinateSystem system, Vertex vertex) { - Vertex v = system.translate(vertex); - double x = v.getX(); - double y = v.getY(); - - Vertex a = null; - Vertex b = null; - - if (alignVertex != null) { - a = system.translate(alignVertex); - } - if (snapVertex != null) { - b = system.translate(snapVertex); - } - - double xl = 0.3; - double yl = 0.3; - double xd = 0.0; - double yd = 0.0; - if (a != null) { - xd = Math.abs(a.getX() - v.getX()); - if (xd < xl) { - x = a.getX(); - xl = xd; - } - yd = Math.abs(a.getY() - v.getY()); - if (yd < yl) { - y = a.getY(); - yl = yd; - } - } - if (b != null) { - xd = Math.abs(b.getX() - v.getX()); - if (xd < xl) { - x = b.getX(); - xl = xd; - } - yd = Math.abs(b.getY() - v.getY()); - if (yd < yl) { - y = b.getY(); - yl = yd; - } - } - - v.setX(x); - v.setY(y); - v = system.unTranslate(v); - vertex.setX(roundMM(v.getX())); - vertex.setY(roundMM(v.getY())); - vertex.setZ(roundMM(v.getZ())); - } - - /** * Set current vertex to an appropriate vertex * @param event The MouseEvent --- 477,480 ---- *************** *** 828,834 **** v.scale((d / 1000) / v.length()); current = before.add(v); ! current.setX(roundMM(current.getX())); ! current.setY(roundMM(current.getY())); ! current.setZ(roundMM(current.getZ())); Set edges = Project.getInstance().findEdge(current); Iterator iter = edges.iterator(); --- 732,738 ---- v.scale((d / 1000) / v.length()); current = before.add(v); ! current.setX(current.getX()); ! current.setY(current.getY()); ! current.setZ(current.getZ()); Set edges = Project.getInstance().findEdge(current); Iterator iter = edges.iterator(); |
From: Nordholt <nor...@us...> - 2006-01-10 14:07:17
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18744 Modified Files: View.java Log Message: made method for getting only a vertex or edge at a point Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** View.java 10 Jan 2006 13:38:54 -0000 1.40 --- View.java 10 Jan 2006 14:06:49 -0000 1.41 *************** *** 1784,1787 **** --- 1784,1826 ---- return selection; } + + /** + * Gets id of any Edges under a point. For use in selection. + * @param x the x coordinate of the point in mouse coordinates + * @param y the y coordinate of the point in mouse coordinates + * @return The object under the point, null if no object is there + */ + public List getEdgeAtPoint(double x, double y) { + this.x = x; + this.y = y; + + picking = 10; + selectMode = EDGES; + glv.repaint(true); + + List selection = processSelect(); + clearNames(); + return selection; + } + + /** + * Gets id of any Vertices under a point. For use in selection. + * @param x the x coordinate of the point in mouse coordinates + * @param y the y coordinate of the point in mouse coordinates + * @return The object under the point, null if no object is there + */ + public List getVertexAtPoint(double x, double y) { + this.x = x; + this.y = y; + + picking = 10; + selectMode = VERTICES; + glv.repaint(true); + + List selection = processSelect(); + clearNames(); + return selection; + } + /** |
From: Nordholt <nor...@us...> - 2006-01-10 14:04:55
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18260 Modified Files: MoveTool.java Log Message: changed the way movetool works to restrict movement to a single constructor. Move can be done by length field now Index: MoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/MoveTool.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** MoveTool.java 20 Dec 2005 13:55:51 -0000 1.21 --- MoveTool.java 10 Jan 2006 14:04:42 -0000 1.22 *************** *** 9,14 **** import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.model.ClippingPlane; ! import net.sourceforge.bprocessor.gl.view.View; ! import net.sourceforge.bprocessor.gl.view.Transformation; import net.sourceforge.bprocessor.model.Edge; --- 9,13 ---- import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.model.ClippingPlane; ! import net.sourceforge.bprocessor.model.Edge; *************** *** 16,19 **** --- 15,19 ---- import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Surface; + import net.sourceforge.bprocessor.model.Camera; import java.awt.Cursor; *************** *** 25,28 **** --- 25,29 ---- import java.util.Iterator; import java.util.Set; + import java.util.List; import org.apache.log4j.Logger; *************** *** 62,68 **** private Plane dragPlane; ! /** The set of vertices to move **/ private Set vertices; ! /** * The Constructor --- 63,81 ---- private Plane dragPlane; ! /** The set of vertices to move */ private Set vertices; ! ! /** constructors for aligning the movement */ ! private Set moveConstructors; ! ! /** Vector to restrict movement in one direction */ ! private Vertex restrictionVector; ! ! /** The last restriction vector used */ ! private Vertex lastRestriction; ! ! /** Number typed when using the length field */ ! private String number; ! /** * The Constructor *************** *** 72,75 **** --- 85,90 ---- public MoveTool(GLView glv, Cursor cursor) { super(glv, cursor); + moveConstructors = null; + restrictionVector = null; } *************** *** 124,128 **** previousX = e.getX(); previousY = e.getY(); ! if (target != null) { dragPlane = findMovePlane(target); --- 139,144 ---- previousX = e.getX(); previousY = e.getY(); ! ! clearConstructors(moveConstructors); if (target != null) { dragPlane = findMovePlane(target); *************** *** 130,133 **** --- 146,157 ---- parentPos = new Vertex(initial.getX(), initial.getY(), initial.getZ()); from = new Vertex(initial.getX(), initial.getY(), initial.getZ()); + + moveConstructors = new HashSet(); + if (target instanceof Vertex) { + moveConstructors.addAll(makeEdgeConstructors((Vertex)target)); + } else { + moveConstructors.addAll(makeXYZConstructors(initial)); + } + displayConstructors(moveConstructors); vertices = new HashSet(); *************** *** 151,156 **** protected Plane findMovePlane(Object o) { Plane temp = null; - //indicating wherther or not we are moving an inner surface - boolean inner = false; if (o instanceof Vertex) { temp = new Plane(0, 0, 1, -((Vertex)o).getZ()); --- 175,178 ---- *************** *** 159,181 **** } else if (o instanceof Surface) { Surface sel = (Surface)o; - inner = sel.isInner(); temp = sel.plane(); } else if (o instanceof ClippingPlane) { ClippingPlane clippingplane = (ClippingPlane) o; temp = clippingplane.getPlane(); ! } ! // make a orthogonal plane to the current one ! if (moveMode == XZ && !inner) { ! Transformation trans = glv.getView().transformation(); ! double x = previousX; ! double y = View.getHeight() - previousY; ! Vertex near = new Vertex(x, y, 0.0); ! Vertex far = new Vertex(x, y, 1.0); ! Edge ray = new Edge(near, far); ! ray = trans.unProject(ray); ! return temp.orthogonalPlane(ray); ! } return temp; } /** --- 181,207 ---- } else if (o instanceof Surface) { Surface sel = (Surface)o; temp = sel.plane(); } else if (o instanceof ClippingPlane) { ClippingPlane clippingplane = (ClippingPlane) o; temp = clippingplane.getPlane(); ! } return temp; } + + /** + * Finds an appropriate dragPlane that contains the + * restrictionvector. + */ + protected void findRestrictionPlane() { + Camera camera = glv.getView().getCamera(); + double[] centerPoint = camera.getCenter(); + double[] cameraPoint = camera.getCamera(); + Vertex eyeVector = new Vertex(cameraPoint[0] - centerPoint[0], + cameraPoint[1] - centerPoint[1], + cameraPoint[2] - centerPoint[2]); + Vertex planeNormal = (restrictionVector.cross(eyeVector)).cross(restrictionVector); + dragPlane = new Plane(planeNormal.getX(), planeNormal.getY(), planeNormal.getZ(), + -planeNormal.dot(initial)); + } /** *************** *** 185,194 **** protected void released(MouseEvent e) { super.released(e); ! ! from = null; ! initial = null; dragPlane = null; ! parentPos = null; ! vertices = null; } --- 211,219 ---- protected void released(MouseEvent e) { super.released(e); ! clearConstructors(moveConstructors); ! moveConstructors = null; ! restrictionVector = null; dragPlane = null; ! number = ""; } *************** *** 204,208 **** return; } ! if (dragPlane != null) { int x = e.getX(); int y = e.getY(); --- 229,240 ---- return; } ! ! if (restrictionVector == null) { ! boolean found = findRestriction(e); ! if (found) { ! findRestrictionPlane(); ! } ! } ! if (dragPlane != null && restrictionVector != null) { int x = e.getX(); int y = e.getY(); *************** *** 210,213 **** --- 242,253 ---- parentPos = glv.getView().toPlaneCoords(new double[] {x, y}, dragPlane); Vertex delta = parentPos.minus(from); + + //Restricting movement align with restriction vector + Vertex restrictCopy = restrictionVector.copy(); + restrictCopy.scale(1 / restrictCopy.length()); + restrictCopy.scale(delta.dot(restrictCopy)); + delta = restrictCopy; + parentPos = from.add(delta); + if (log.isDebugEnabled()) { log.debug("from " + from.getX() + ", " + from.getY() + ", " + from.getZ()); *************** *** 215,218 **** --- 255,259 ---- } + //snapping to initial position Vertex v = initial.minus(parentPos); Vertex appr = initial.minus(from); *************** *** 225,230 **** if (Math.abs(v.getZ()) < .25) { delta.setZ(appr.getZ()); ! } ! move(vertices, delta); from.move(delta.getX(), delta.getY(), delta.getZ()); --- 266,271 ---- if (Math.abs(v.getZ()) < .25) { delta.setZ(appr.getZ()); ! } ! move(vertices, delta); from.move(delta.getX(), delta.getY(), delta.getZ()); *************** *** 236,240 **** --- 277,320 ---- previousY = e.getY(); } + + + /** + * Finds the current restriction vector. + * There must be some number of moveconstructors find a + * restriction vector. + * @param e the mouse event + * @return wherther or not a vector was found. + */ + private boolean findRestriction(MouseEvent e) { + if (moveConstructors != null) { + List hitEdges = glv.getView().getEdgeAtPoint(e.getX(), e.getY()); + Iterator it = moveConstructors.iterator(); + int numberOfAxis = 0; + Edge axis = null; + while (it.hasNext()) { + Edge tempAxis = (Edge)it.next(); + if (hitEdges.contains(tempAxis)) { + numberOfAxis++; + axis = tempAxis; + } + } + //Only assign a restriction vector when exactly one + //moveconstructor is selected. + if (numberOfAxis == 1) { + restrictionVector = axis.getFrom().minus(axis.getTo()); + lastRestriction = restrictionVector.copy(); + //when a moveconstructor is selected it is the + //only one shown. + clearConstructors(moveConstructors); + moveConstructors = new HashSet(); + moveConstructors.add(axis); + displayConstructors(moveConstructors); + return true; + } + } + return false; + } + /** * Move the entire selection *************** *** 257,279 **** /** ! * Invoked when a key has been pressed. Lets user control the speed ! * and mode of movement. * @param e The KeyEvent */ public void keyPressed(KeyEvent e) { ! if (e.getKeyCode() == KeyEvent.VK_A) { ! moveMode = XY; ! if (target != null) { ! dragPlane = findMovePlane(target); ! } ! } else if (e.getKeyCode() == KeyEvent.VK_S) { ! moveMode = XZ; ! if (target != null) { ! dragPlane = findMovePlane(target); ! } ! } else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { if (dragPlane != null) { dragPlane = null; ! move(selection, initial.minus(parentPos)); } } else { --- 337,402 ---- /** ! * Invoked when a key has been pressed. Lets user control the mode of movement. ! * ESCAPE - cancel movement * @param e The KeyEvent */ public void keyPressed(KeyEvent e) { ! if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { if (dragPlane != null) { dragPlane = null; ! move(vertices, initial.minus(from)); ! } ! } else if (lastRestriction != null && ! initial != null && ! from != null && ! vertices != null) { ! if (e.getKeyCode() == KeyEvent.VK_1) { ! number += "1"; ! } else if (e.getKeyCode() == KeyEvent.VK_2) { ! number += "2"; ! } else if (e.getKeyCode() == KeyEvent.VK_3) { ! number += "3"; ! } else if (e.getKeyCode() == KeyEvent.VK_4) { ! number += "4"; ! } else if (e.getKeyCode() == KeyEvent.VK_5) { ! number += "5"; ! } else if (e.getKeyCode() == KeyEvent.VK_6) { ! number += "6"; ! } else if (e.getKeyCode() == KeyEvent.VK_7) { ! number += "7"; ! } else if (e.getKeyCode() == KeyEvent.VK_8) { ! number += "8"; ! } else if (e.getKeyCode() == KeyEvent.VK_9) { ! number += "9"; ! } else if (e.getKeyCode() == KeyEvent.VK_0) { ! number += "0"; ! } else if (e.getKeyCode() == KeyEvent.VK_ENTER) { ! if (!number.equals("")) { ! double length = glv.getLength(); ! Vertex delta = initial.minus(from); ! if (delta.length() > 0) { ! delta.scale((delta.length() - length) / delta.length()); ! } else { ! delta = lastRestriction.copy(); ! delta.scale(length / delta.length()); ! } ! move(vertices, delta); ! glv.repaint(); ! } ! } else if (e.getKeyCode() == KeyEvent.VK_BACK_SPACE) { ! int length = number.length(); ! if (length > 0) { ! number = number.substring(0, length - 1); ! } ! } ! if (number.equals("") || number.equals("-")) { ! glv.setLength(0); ! } else { ! try { ! double d = Double.parseDouble(number); ! glv.setLength(d / 1000); ! } catch (NumberFormatException exp) { ! System.out.println(exp); ! } } } else { |
From: Nikolaj B. <nbr...@us...> - 2006-01-10 14:02:31
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17554/src/net/sourceforge/bprocessor/gui/attrview Modified Files: AttributeView.java Log Message: Updated color selection layout Index: AttributeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/AttributeView.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** AttributeView.java 10 Jan 2006 13:39:49 -0000 1.16 --- AttributeView.java 10 Jan 2006 14:02:21 -0000 1.17 *************** *** 28,32 **** import javax.swing.JComboBox; import javax.swing.border.Border; - import javax.swing.border.TitledBorder; import org.apache.log4j.Logger; --- 28,31 ---- *************** *** 191,199 **** add(hfiller); ! /*JLabel fcolor = new JLabel("Front: "); con.weightx = 0; con.gridwidth = 1; layout.setConstraints(fcolor, con); ! add(fcolor); */ --- 190,198 ---- add(hfiller); ! JLabel fcolor = new JLabel("Front: "); con.weightx = 0; con.gridwidth = 1; layout.setConstraints(fcolor, con); ! add(fcolor); *************** *** 201,207 **** JPanel front = new JPanel(); front.setOpaque(true); ! TitledBorder frontBorder; ! frontBorder = BorderFactory.createTitledBorder("Front"); ! front.setBorder(frontBorder); front.setBackground(Color.white); con.weightx = 1.0; --- 200,205 ---- JPanel front = new JPanel(); front.setOpaque(true); ! Border blackline = BorderFactory.createLineBorder(Color.black); ! front.setBorder(blackline); front.setBackground(Color.white); con.weightx = 1.0; *************** *** 214,220 **** JPanel front = new JPanel(); front.setOpaque(true); ! TitledBorder frontBorder; ! frontBorder = BorderFactory.createTitledBorder("Front"); ! front.setBorder(frontBorder); Color frontColor = o.getFrontMaterial().getColor(); front.setBackground(frontColor); --- 212,217 ---- JPanel front = new JPanel(); front.setOpaque(true); ! Border blackline = BorderFactory.createLineBorder(Color.black); ! front.setBorder(blackline); Color frontColor = o.getFrontMaterial().getColor(); front.setBackground(frontColor); |
From: Nordholt <nor...@us...> - 2006-01-10 14:02:04
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17461 Modified Files: AbstractTool.java PencilTool.java Log Message: refactored the way temporary constructors work to make them work in movetool as well Index: PencilTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/PencilTool.java,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** PencilTool.java 29 Dec 2005 14:20:41 -0000 1.54 --- PencilTool.java 10 Jan 2006 14:01:48 -0000 1.55 *************** *** 36,48 **** /** The logger */ private static Logger log = Logger.getLogger(PencilTool.class); - - /** The x axis */ - private Edge xAxis = new Edge(new Vertex(-50, 0, 0), new Vertex(50, 0, 0)); - - /** The y axis */ - private Edge yAxis = new Edge(new Vertex(0, -50, 0), new Vertex(0, 50, 0)); - - /**The z axis */ - private Edge zAxis = new Edge(new Vertex(0, 0, -50), new Vertex(0, 0, 50)); /** The constructors from the current vertex */ --- 36,39 ---- *************** *** 50,57 **** /** The constructors from the snap vertex */ ! private Set snapConstructors; ! ! /** Whether to show the constructors */ ! private boolean showConstructors; /** The plane currently drawn in */ --- 41,45 ---- /** The constructors from the snap vertex */ ! private Set snapConstructors; /** The plane currently drawn in */ *************** *** 226,258 **** } - /** - * Makes constructors parralel to the x y and z-axis, originating - * from a vertex. - * @param v the vertex - * @return a set of XYZ constructors. - */ - private Set makeXYZConstructors(Vertex v) { - if (v != null) { - Edge x = new Edge(xAxis.getFrom().add(v), - xAxis.getTo().add(v)); - x.setConstructor(true); - Edge y = new Edge(yAxis.getFrom().add(v), - yAxis.getTo().add(v)); - y.setConstructor(true); - Edge z = new Edge(zAxis.getFrom().add(v), - zAxis.getTo().add(v)); - z.setConstructor(true); - Set constructors = new HashSet(); - constructors.add(x); - constructors.add(y); - constructors.add(z); - if (showConstructors) { - displayConstructors(constructors); - } - return constructors; - } - return null; - } - /** * Makes a set of three constructors where one is aligned with the given edge --- 214,217 ---- *************** *** 377,408 **** /** - * Removes a set of constructors. - * @param constructors a set of constructors. - */ - private void clearConstructors(Set constructors) { - if (constructors != null) { - Iterator it = constructors.iterator(); - while (it.hasNext()) { - Edge constructor = (Edge)it.next(); - glv.getView().removeTempEdge(constructor); - } - } - } - - /** - * Makes a set of constructors be displayed. - * @param constructors a set of constructors. - */ - private void displayConstructors(Set constructors) { - if (constructors != null) { - Iterator it = constructors.iterator(); - while (it.hasNext()) { - Edge constructor = (Edge)it.next(); - glv.getView().addTempEdge(constructor); - } - } - } - - /** * Called with the vertex that are clicked on - either: * - A vertex on the xy-plane --- 336,339 ---- Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** AbstractTool.java 6 Jan 2006 15:36:14 -0000 1.47 --- AbstractTool.java 10 Jan 2006 14:01:48 -0000 1.48 *************** *** 29,32 **** --- 29,33 ---- import java.util.Iterator; import java.util.Set; + import java.util.HashSet; import java.util.Collection; *************** *** 38,41 **** --- 39,51 ---- /** The logger */ private static Logger log = Logger.getLogger(AbstractTool.class); + + /** The x axis */ + protected Edge xAxis = new Edge(new Vertex(-50, 0, 0), new Vertex(50, 0, 0)); + + /** The y axis */ + protected Edge yAxis = new Edge(new Vertex(0, -50, 0), new Vertex(0, 50, 0)); + + /**The z axis */ + protected Edge zAxis = new Edge(new Vertex(0, 0, -50), new Vertex(0, 0, 50)); /** The mouse position last time the mouse was pressed initializes to (0,0) */ *************** *** 75,80 **** protected Cursor cursor; /** The cursor for drag */ ! private Cursor dragCursor; static { --- 85,94 ---- protected Cursor cursor; + /** Whether to show the temporary constructors */ + protected boolean showConstructors; + /** The cursor for drag */ ! private Cursor dragCursor; ! static { *************** *** 556,560 **** } } ! } /** --- 570,660 ---- } } ! } ! ! /** ! * Makes constructors parralel to the x y and z-axis, originating ! * from a vertex. ! * @param v the vertex ! * @return a set of XYZ constructors. ! */ ! protected Set makeXYZConstructors(Vertex v) { ! if (v != null) { ! Edge x = new Edge(xAxis.getFrom().add(v), ! xAxis.getTo().add(v)); ! x.setConstructor(true); ! Edge y = new Edge(yAxis.getFrom().add(v), ! yAxis.getTo().add(v)); ! y.setConstructor(true); ! Edge z = new Edge(zAxis.getFrom().add(v), ! zAxis.getTo().add(v)); ! z.setConstructor(true); ! Set constructors = new HashSet(); ! constructors.add(x); ! constructors.add(y); ! constructors.add(z); ! if (showConstructors) { ! displayConstructors(constructors); ! } ! return constructors; ! } ! return null; ! } ! ! /** ! * Makes constructors parrallel to the edges connected to a vertex. ! * @param v the vertex ! * @return a set of constructors. ! */ ! protected Set makeEdgeConstructors(Vertex v) { ! Set constructors = new HashSet(); ! Set edges = v.getEdges(); ! Iterator it = edges.iterator(); ! while (it.hasNext()) { ! Edge e = (Edge)it.next(); ! Vertex direction = e.getFrom().minus(e.getTo()); ! direction.scale(50 / direction.length()); ! Vertex to = direction.copy(); ! direction.scale(-1); ! Vertex from = direction.copy(); ! to = to.add(v); ! from = from.add(v); ! Edge constructor = new Edge(from, to); ! ! constructor.setConstructor(true); ! constructors.add(constructor); ! } ! if (showConstructors) { ! displayConstructors(constructors); ! } ! return constructors; ! } ! ! /** ! * Makes a set of constructors be displayed. ! * @param constructors a set of constructors. ! */ ! protected void displayConstructors(Set constructors) { ! if (constructors != null) { ! Iterator it = constructors.iterator(); ! while (it.hasNext()) { ! Edge constructor = (Edge)it.next(); ! glv.getView().addTempEdge(constructor); ! } ! } ! } ! ! /** ! * Removes a set of constructors. ! * @param constructors a set of constructors. ! */ ! protected void clearConstructors(Set constructors) { ! if (constructors != null) { ! Iterator it = constructors.iterator(); ! while (it.hasNext()) { ! Edge constructor = (Edge)it.next(); ! glv.getView().removeTempEdge(constructor); ! } ! } ! } /** |
From: Nikolaj B. <nbr...@us...> - 2006-01-10 13:41:47
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13976/src/net/sourceforge/bprocessor/model Modified Files: Material.java Log Message: Small change so we now use the java built in Color class Index: Material.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Material.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Material.java 5 Jan 2006 10:40:39 -0000 1.1 --- Material.java 10 Jan 2006 13:41:38 -0000 1.2 *************** *** 7,10 **** --- 7,12 ---- package net.sourceforge.bprocessor.model; + import java.awt.Color; + /** *************** *** 17,21 **** /** The color of the material */ ! private float[] color; --- 19,23 ---- /** The color of the material */ ! private Color color; *************** *** 31,35 **** * @param color The color of the material */ ! public Material(String name, float[] color) { setName(name); setColor(color); --- 33,37 ---- * @param color The color of the material */ ! public Material(String name, Color color) { setName(name); setColor(color); *************** *** 58,62 **** * @hibernate.property */ ! public float[] getColor() { return color; } --- 60,64 ---- * @hibernate.property */ ! public Color getColor() { return color; } *************** *** 66,70 **** * @param color The color */ ! public void setColor(float[] color) { this.color = color; } --- 68,72 ---- * @param color The color */ ! public void setColor(Color color) { this.color = color; } |
From: Nikolaj B. <nbr...@us...> - 2006-01-10 13:39:57
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13366/src/net/sourceforge/bprocessor/gui/attrview Modified Files: AttributeView.java Added Files: MyMouseListener.java Log Message: Updated Surface attribute view, so it can now handle colors of the two sides of the surface Index: AttributeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/AttributeView.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** AttributeView.java 6 Jan 2006 15:36:19 -0000 1.15 --- AttributeView.java 10 Jan 2006 13:39:49 -0000 1.16 *************** *** 21,24 **** --- 21,25 ---- import java.awt.GridBagConstraints; + import javax.swing.BorderFactory; import javax.swing.JLabel; import javax.swing.JPanel; *************** *** 26,29 **** --- 27,32 ---- import javax.swing.JTextField; import javax.swing.JComboBox; + import javax.swing.border.Border; + import javax.swing.border.TitledBorder; import org.apache.log4j.Logger; *************** *** 120,124 **** nameEdit.addKeyListener(new MyKeyListener(o)); ! Object[] options = {"Arbejdsv¾relse", "Badev¾relse", "Gang", "K¿kken", "Stue", "V¾relse"}; JComboBox klassifikation = new JComboBox(options); layout.setConstraints(klassifikation, con); --- 123,127 ---- nameEdit.addKeyListener(new MyKeyListener(o)); ! Object[] options = {"Arbejdsværelse", "Badeværelse", "Gang", "Køkken", "Stue", "Værelse"}; JComboBox klassifikation = new JComboBox(options); layout.setConstraints(klassifikation, con); *************** *** 171,184 **** setLayout(layout); ! JLabel name = new JLabel("Name:"); con.anchor = GridBagConstraints.NORTH; ! con.weightx = 1.0; layout.setConstraints(name, con); add(name); JLabel surfaceName = new JLabel(o.getName()); - con.gridwidth = GridBagConstraints.REMAINDER; layout.setConstraints(surfaceName, con); add(surfaceName); revalidate(); } --- 174,272 ---- setLayout(layout); ! JLabel name = new JLabel("Name: "); con.anchor = GridBagConstraints.NORTH; ! con.weightx = 0; layout.setConstraints(name, con); add(name); JLabel surfaceName = new JLabel(o.getName()); layout.setConstraints(surfaceName, con); add(surfaceName); + + JPanel hfiller = new JPanel(); + hfiller.setOpaque(true); + con.weightx = 1.0; + con.gridwidth = GridBagConstraints.REMAINDER; + layout.setConstraints(hfiller, con); + add(hfiller); + + /*JLabel fcolor = new JLabel("Front: "); + con.weightx = 0; + con.gridwidth = 1; + layout.setConstraints(fcolor, con); + add(fcolor); */ + + + if (o.getFrontMaterial() == null) { + JPanel front = new JPanel(); + front.setOpaque(true); + TitledBorder frontBorder; + frontBorder = BorderFactory.createTitledBorder("Front"); + front.setBorder(frontBorder); + front.setBackground(Color.white); + 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 + } else { + JPanel front = new JPanel(); + front.setOpaque(true); + TitledBorder frontBorder; + frontBorder = BorderFactory.createTitledBorder("Front"); + front.setBorder(frontBorder); + Color frontColor = o.getFrontMaterial().getColor(); + front.setBackground(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 bcolor = new JLabel("Back: "); + con.weightx = 0; + con.fill = GridBagConstraints.NONE; + con.gridwidth = 1; + layout.setConstraints(bcolor, con); + add(bcolor); + + if (o.getBackMaterial() == null) { + JPanel back = new JPanel(); + back.setOpaque(true); + Border blackline = BorderFactory.createLineBorder(Color.black); + back.setBorder(blackline); + back.setBackground(Color.white); + 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 + } else { + JPanel back = new JPanel(); + back.setOpaque(true); + Border blackline = BorderFactory.createLineBorder(Color.black); + back.setBorder(blackline); + Color backColor = o.getBackMaterial().getColor(); + back.setBackground(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); revalidate(); } --- NEW FILE: MyMouseListener.java --- //--------------------------------------------------------------------------------- // $Id: MyMouseListener.java,v 1.1 2006/01/10 13:39:49 nbramsen Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui.attrview; import java.awt.Color; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.JColorChooser; import net.sourceforge.bprocessor.gui.GUI; import net.sourceforge.bprocessor.model.Material; import net.sourceforge.bprocessor.model.Surface; /** * The focus handler */ public class MyMouseListener implements MouseListener { /** The current Surface */ private Surface currentSurface; /** The current Side */ private boolean currentSide; /** * The constructor * @param o the event * @param side shows if its the front or back of the surface. True = front, False = Back. */ public MyMouseListener (Surface o, boolean side) { currentSurface = o; currentSide = side; } /** * Handles mouse event * @param arg0 the event */ public void mouseClicked(MouseEvent arg0) { Color defaultColor = Color.white; Material newMaterial; if (currentSide) { if (currentSurface.getFrontMaterial() != null) { defaultColor = currentSurface.getFrontMaterial().getColor(); } Color frontColor = JColorChooser.showDialog(GUI.getInstance(), "Constructor Line Color", defaultColor); if (frontColor != null) { newMaterial = new Material("temp", frontColor); } else { newMaterial = new Material("temp", defaultColor); } currentSurface.setFrontMaterial(newMaterial); currentSurface.changed(); } else { if (currentSurface.getBackMaterial() != null) { defaultColor = currentSurface.getBackMaterial().getColor(); } Color backColor = JColorChooser.showDialog(GUI.getInstance(), "Constructor Line Color", defaultColor); if (backColor != null) { newMaterial = new Material("temp", backColor); } else { newMaterial = new Material("temp", defaultColor); } currentSurface.setBackMaterial(newMaterial); currentSurface.changed(); } } /** * Handles mouse event * @param arg0 the event */ public void mouseEntered(MouseEvent arg0) { } /** * Handles mouse event * @param arg0 the event */ public void mouseExited(MouseEvent arg0) { } /** * Handles mouse event * @param arg0 the event */ public void mousePressed(MouseEvent arg0) { } /** * Handles mouse event * @param arg0 the event */ public void mouseReleased(MouseEvent arg0) { } } |
From: Nikolaj B. <nbr...@us...> - 2006-01-10 13:39:05
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13201/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Updated so materials color now will be shown if a surface has a materil Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** View.java 10 Jan 2006 08:23:59 -0000 1.39 --- View.java 10 Jan 2006 13:38:54 -0000 1.40 *************** *** 1387,1397 **** if (side == FRONT) { // TODO Check the color of the front material of the Surface ! Space back = s.getFrontDomain(); ! gl.glColor3fv(getSpaceColor(back)); } if (side == BACK) { // TODO Check the color of the back material of the Surface ! Space front = s.getBackDomain(); ! gl.glColor3fv(getSpaceColor(front)); } } --- 1387,1405 ---- if (side == FRONT) { // TODO Check the color of the front material of the Surface ! if (s.getFrontMaterial() == null) { ! Space back = s.getFrontDomain(); ! gl.glColor3fv(getSpaceColor(back)); ! } else { ! gl.glColor3fv(s.getFrontMaterial().getColor().getRGBComponents(null)); ! } } if (side == BACK) { // TODO Check the color of the back material of the Surface ! if (s.getBackMaterial() == null) { ! Space front = s.getBackDomain(); ! gl.glColor3fv(getSpaceColor(front)); ! } else { ! gl.glColor3fv(s.getBackMaterial().getColor().getRGBComponents(null)); ! } } } |
From: Michael L. <he...@us...> - 2006-01-10 10:45:31
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11616/src/net/sourceforge/bprocessor/model Added Files: Constraint.java Log Message: Added a constraint class --- NEW FILE: Constraint.java --- //--------------------------------------------------------------------------------- // $Id: Constraint.java,v 1.1 2006/01/10 10:45:21 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; import java.util.Collection; import java.util.LinkedList; /** * The Constraint has a master and a slave, which are * geometric entities. * The constraint depends on the both the master and the slave, * but only the slave depends on the constraint. * The constraint are not supposed to change the master. A change * to the master will make the constraint change the slave. A * change to a slave will make the constraint update it's own internal * state. */ public abstract class Constraint implements Observer { /** The master */ private Entity master; /** The slave */ private Entity slave; /** * Constructor for Constraint. */ public Constraint() { super(); } /** * Constructor for Constraint * @param master The master * @param slave The slave */ public Constraint(Entity master, Entity slave) { this(); this.master = master; this.slave = slave; } /** * Set the master * @param master The master */ public void setMaster(Entity master) { this.master = master; } /** * Return the master * @return The master */ public Entity getMaster() { return master; } /** * Set the slave * @param slave The slave */ public void setSlave(Entity slave) { this.slave = slave; } /** * Return the slave * @return The slave */ public Entity getSlave() { return slave; } /** * Return true if this Constraint depends on the entity * @param entity The entity * @return True of this Constraints depends on the entity */ public boolean depends(Entity entity) { return (entity == master) || (entity == slave); } /** * Return collection of entities depending on this Constraint * @return Collecton of depending entities */ public Collection depending() { Collection entities = new LinkedList(); entities.add(slave); return entities; } } |