bprocessor-commit Mailing List for B-processor (Page 120)
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-06-26 11:37:55
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31918/src/net/sourceforge/bprocessor/gui/attrview Modified Files: GenericPanel.java Added Files: ClassificationAttribute.java Log Message: Spaces now have simple classification, and based on this classification an energy transmission loss can be calculated Index: GenericPanel.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/GenericPanel.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** GenericPanel.java 24 Apr 2006 08:45:10 -0000 1.17 --- GenericPanel.java 26 Jun 2006 11:37:52 -0000 1.18 *************** *** 175,178 **** --- 175,195 ---- }); where.add(new AttributeRow(ma)); + } else if (a.getValue() instanceof String[]) { + // Handles the classification + ClassificationAttribute ca = new ClassificationAttribute(a); + ca.addClassificationAttributeListener(new AttributeListener() { + public void valueChanged(Attribute a) { + obj.setAttributes(attributes); + if (obj instanceof Entity) { + simpleUpdate = true; + ((Entity)obj).changed(); + } else if (obj instanceof Camera) { + Project.getInstance().changed((Camera)obj); + } else { + log.info("Were not a Entity object " + obj); + } + } + }); + where.add(new AttributeRow(ca)); } else { log.info("[GenericPanel] Something were not implemented"); --- NEW FILE: ClassificationAttribute.java --- //--------------------------------------------------------------------------------- // $Id: ClassificationAttribute.java,v 1.1 2006/06/26 11:37:52 nbramsen Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gui.attrview; import java.awt.Dimension; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JLabel; import net.sourceforge.bprocessor.model.Attribute; /** * The ClassificationAttributeView */ public class ClassificationAttribute extends GenericAttribute implements FocusListener { /** The listeners */ private List listeners; /** The attribute this gui represents */ private Attribute attribute; /** The component */ private JComponent component; /** The Label */ private JLabel label; /** * Constructor for ClassificationAttribute * @param attribute The attribute */ public ClassificationAttribute(Attribute attribute) { super(BoxLayout.X_AXIS); this.attribute = attribute; this.listeners = new LinkedList(); label = createLabel(attribute.getName()); Box header = Box.createHorizontalBox(); Box column = Box.createVerticalBox(); header.add(Box.createHorizontalStrut(7)); header.add(label); header.add(Box.createHorizontalGlue()); column.add(Box.createRigidArea(new Dimension(70, 3))); column.add(header); column.add(Box.createRigidArea(new Dimension(70, 3))); column.setMaximumSize(new Dimension(60, Short.MAX_VALUE)); this.add(column); component = Box.createHorizontalBox(); component.add(createValueLabel(attribute.getValue())); this.add(component); this.add(Box.createHorizontalGlue()); } /** * Create a label for the * @param key The key * @return A JLabel */ private JLabel createLabel(String key) { JLabel keyLabel = new JLabel(key + " :"); keyLabel.setFont(AttributeView.FONT_BOLD); return keyLabel; } /** * Add a listener that are notified when the value is changed * @param listener The listener */ public void addClassificationAttributeListener(AttributeListener listener) { listeners.add(listener); } /** * Remove a listener * @param listener The listener */ public void removeClassificationAttributeListener(AttributeListener listener) { listeners.remove(listener); } /** * Send valueChanged to all listeners */ protected void valueChanged() { Iterator iter = listeners.iterator(); while (iter.hasNext()) { AttributeListener current = (AttributeListener) iter.next(); current.valueChanged(attribute); } } /** * Create a value label * @param value The value * @return The label */ private JComponent createValueLabel(Object value) { JComboBox valueLabel; valueLabel = new JComboBox((String[]) value); if (attribute.getClassification() != null) { valueLabel.setSelectedItem(attribute.getClassification()); } valueLabel.addFocusListener(this); return valueLabel; } /** * Return the attribute * @return The attribute */ public Attribute attribute() { return attribute; } /** * Not in use * @param event The FocusEvent */ public void focusGained(FocusEvent event) { // TODO Auto-generated method stub } /** * Stop editing on the combobox * @param event The event */ public void focusLost(FocusEvent event) { attribute.setValue(((JComboBox) event.getSource()).getSelectedItem()); valueChanged(); } /** * Not in use */ public void startEditing() { // TODO Auto-generated method stub } /** * Not in use */ public void stopEditing() { // TODO Auto-generated method stub } /** * Not in use */ public void cancelEditing() { // TODO Auto-generated method stub } } |
From: Nikolaj B. <nbr...@us...> - 2006-06-26 11:36:30
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31444/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Space.java Attribute.java Log Message: Spaces now have simple classification Index: Attribute.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Attribute.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Attribute.java 30 May 2006 09:28:57 -0000 1.10 --- Attribute.java 26 Jun 2006 11:36:26 -0000 1.11 *************** *** 27,30 **** --- 27,33 ---- private String name; + /** The classification */ + private String classification; + /** The precision of the object */ private int precision; *************** *** 82,85 **** --- 85,101 ---- setEditable(b); } + + /** + * Constructor + * @param name The name + * @param value The value + * @param classification The classification + */ + public Attribute(String name, Object value, String classification) { + setName(name); + setValue(value); + setClassification(classification); + editable = false; + } /** *************** *** 110,113 **** --- 126,143 ---- this.precision = precision; } + + /** + * @return Returns the classification. + */ + public String getClassification() { + return classification; + } + + /** + * @param classification The classification to set. + */ + public void setClassification(String classification) { + this.classification = classification; + } /** Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.100 retrieving revision 1.101 diff -C2 -d -r1.100 -r1.101 *** Surface.java 20 Jun 2006 08:14:55 -0000 1.100 --- Surface.java 26 Jun 2006 11:36:26 -0000 1.101 *************** *** 1408,1414 **** } - res.add(new Attribute("Total area", new Double(getArea()), false)); res.add(new Attribute("Area", new Double(getArea() - holeArea), false)); } return res; } --- 1408,1415 ---- } res.add(new Attribute("Area", new Double(getArea() - holeArea), false)); } + + res.add(new Attribute("Total area", new Double(getArea()), false)); return res; } Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Space.java 7 Jun 2006 08:22:37 -0000 1.37 --- Space.java 26 Jun 2006 11:36:26 -0000 1.38 *************** *** 87,90 **** --- 87,104 ---- private long nextMaterialId; + /** The classification */ + private String classification; + + /** The construcstionspace classification options */ + private String[] constructionOptions = + {"None", "Terrandæk", "Tagkonstruktion", "Ydervæg", "Ældre termovindue", + "2-lags lavenergivindue", "3-lags lavenergivindue", "Dør"}; + + /** The functionalspace classification options */ + private String[] functionalOptions = + {"None", "Exterior", "Livingroom", "Bathroom", "Bedroom"}; + + + /** The modellor */ private Modellor modellor; *************** *** 109,112 **** --- 123,127 ---- setName(name); setType(type); + setClassification("None"); this.container = container; description = new Description(""); *************** *** 683,686 **** --- 698,719 ---- } + + /** + * Return the classification + * @return The classification + */ + public String getClassification() { + return classification; + } + /** + * Set the classification + * @param classification The classification + */ + public void setClassification(String classification) { + this.classification = classification; + } + + + /** * Find vertex based upon location and delta *************** *** 937,940 **** --- 970,975 ---- if (a.getName().equals("Name")) { setName((String)a.getValue()); + } else if (a.getName().equals("Classification")) { + setClassification(((String)a.getValue().toString())); } else if (a.getName().equals("Description")) { setDescription(((String)a.getValue().toString())); *************** *** 953,956 **** --- 988,996 ---- res.add(new Attribute("Name", getName())); res.add(new Attribute("ID", getId().toString(), false)); + if (isConstructionSpace()) { + res.add(new Attribute("Classification", constructionOptions, getClassification())); + } else { + res.add(new Attribute("Classification", functionalOptions, getClassification())); + } res.add(new Attribute("Description", getDescription())); return res; *************** *** 1250,1252 **** --- 1290,1293 ---- return surfaceCopy; } + } |
From: Michael L. <he...@us...> - 2006-06-23 13:00:21
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15599/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java Log Message: Shows select-cursor when pressing <meta> og <control> Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** AbstractTool.java 22 Jun 2006 13:34:32 -0000 1.78 --- AbstractTool.java 23 Jun 2006 13:00:17 -0000 1.79 *************** *** 207,214 **** --- 207,216 ---- if (e.getKeyCode() == KeyEvent.VK_META) { log.info("meta-pressed"); + glv.setCursor(null); } if (e.getKeyCode() == KeyEvent.VK_CONTROL) { log.info("control-pressed"); + glv.setCursor(null); } *************** *** 277,283 **** --- 279,287 ---- if (e.getKeyCode() == KeyEvent.VK_META) { log.info("meta-released"); + glv.setCursor(cursor); } if (e.getKeyCode() == KeyEvent.VK_CONTROL) { log.info("control-released"); + glv.setCursor(cursor); } if (e.getKeyCode() == KeyEvent.VK_SPACE) { |
From: Michael L. <he...@us...> - 2006-06-22 13:34:39
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2341/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java Log Message: Test of key-events Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** AbstractTool.java 21 Jun 2006 13:26:18 -0000 1.77 --- AbstractTool.java 22 Jun 2006 13:34:32 -0000 1.78 *************** *** 202,205 **** --- 202,221 ---- up.scale(2 / up.length()); + + log.info(e); + + if (e.getKeyCode() == KeyEvent.VK_META) { + log.info("meta-pressed"); + } + + if (e.getKeyCode() == KeyEvent.VK_CONTROL) { + log.info("control-pressed"); + } + + if (e.getKeyCode() == KeyEvent.VK_SPACE) { + log.info("space-pressed"); + } + + if (e.getKeyCode() == KeyEvent.VK_BACK_SPACE || e.getKeyCode() == KeyEvent.VK_DELETE) { delete(); *************** *** 259,262 **** --- 275,287 ---- */ public void keyReleased(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_META) { + log.info("meta-released"); + } + if (e.getKeyCode() == KeyEvent.VK_CONTROL) { + log.info("control-released"); + } + if (e.getKeyCode() == KeyEvent.VK_SPACE) { + log.info("space-released"); + } } |
From: Michael L. <he...@us...> - 2006-06-21 13:26:21
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv28315/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java RectTool.java SelectTool.java Added Files: SelectStrategy.java Log Message: Select tool refactoring --- NEW FILE: SelectStrategy.java --- //--------------------------------------------------------------------------------- // $Id: SelectStrategy.java,v 1.1 2006/06/21 13:26:18 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.event.MouseEvent; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.List; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.view.Transformation; import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Selection; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; /** * SelectStrategy */ public class SelectStrategy implements Strategy { /** The GLView **/ private GLView glv; /** Tempoary edges for multiple selection */ protected Edge e1; /** Tempoary edges for multiple selection */ protected Edge e2; /** Tempoary edges for multiple selection */ protected Edge e3; /** Tempoary edges for multiple selection */ protected Edge e4; /** The drag box */ protected HashSet box; /** The target */ protected Object target; /** Telling if it were a multiple selection */ private boolean multipleSelection = false; /** The x */ private int x; /** The y */ private int y; /** * Constructor * @param glv GLView */ public SelectStrategy(GLView glv) { super(); this.glv = glv; e1 = new Edge(); e1.setConstructor(true); e2 = new Edge(); e2.setConstructor(true); e3 = new Edge(); e3.setConstructor(true); e4 = new Edge(); e4.setConstructor(true); box = new HashSet(); box.add(e1); box.add(e2); box.add(e3); box.add(e4); } /** * Invoked when the mouse cursor has been moved * @param e The MouseEvent object */ public void moved(MouseEvent e) { } /** * Invoked when the mouse cursor has been pressed * @param e The MouseEvent object */ public void pressed(MouseEvent e) { Transformation t = glv.getView().transformation(); Vertex first = t.unProject(new Vertex(e.getX(), View.getHeight() - e.getY(), 0.001)); e1.setFrom(first); e4.setTo(first); Collection selection = Selection.primary(); x = e.getX(); y = e.getY(); View view = glv.getView(); target = view.getObjectAtPoint(x, y); if (e.getClickCount() >= 2 && target instanceof Surface) { Surface surface = (Surface) target; if (surface.getBackDomain() != null) { selection.addAll(surface.getBackDomain().getEnvelope()); } if (surface.getFrontDomain() != null) { selection.addAll(surface.getFrontDomain().getEnvelope()); } } else { if (target == null) { selection.clear(); multipleSelection = true; } else if (e.isShiftDown()) { if (!selection.contains(target)) { selection.add(target); } else { selection.remove(target); } } else { if (!selection.contains(target)) { selection.clear(); selection.add(target); } } } } /** * Invoked when the mouse cursor has been dragged * @param e The MouseEvent object */ public void dragged(MouseEvent e) { if (multipleSelection) { Transformation t = glv.getView().transformation(); Vertex last = t.unProject(new Vertex(e.getX(), View.getHeight() - e.getY(), 0.001)); Vertex temp1 = t.unProject(new Vertex(e.getX(), View.getHeight() - y, 0.001)); Vertex temp2 = t.unProject(new Vertex(x, View.getHeight() - e.getY(), 0.001)); e1.setTo(temp1); e2.setFrom(temp1); e2.setTo(last); e3.setFrom(last); e3.setTo(temp2); e4.setFrom(temp2); Iterator it = box.iterator(); while (it.hasNext()) { Edge constructor = (Edge)it.next(); glv.getView().addTempEdge(constructor); } } } /** * Invoked when the mouse cursor has been released * @param e The MouseEvent object */ public void released(MouseEvent e) { if (multipleSelection) { Collection selection = Selection.primary(); selection.clear(); Iterator it = box.iterator(); while (it.hasNext()) { Edge constructor = (Edge)it.next(); glv.getView().removeTempEdge(constructor); } List l = glv.getView().getObjectInArea(x, y, e.getX(), e.getY()); glv.getView().makeTarget(null); selection.addAll(l); multipleSelection = false; } } } Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** SelectTool.java 20 Jun 2006 13:30:58 -0000 1.60 --- SelectTool.java 21 Jun 2006 13:26:18 -0000 1.61 *************** *** 9,19 **** import net.sourceforge.bprocessor.gl.GLView; - import net.sourceforge.bprocessor.model.Edge; - import java.awt.Cursor; import java.awt.event.MouseEvent; - - import java.util.HashSet; - import org.apache.log4j.Logger; --- 9,14 ---- *************** *** 32,49 **** public SelectTool(GLView glv, Cursor cursor) { super(glv, cursor); - e1 = new Edge(); - e1.setConstructor(true); - e2 = new Edge(); - e2.setConstructor(true); - e3 = new Edge(); - e3.setConstructor(true); - e4 = new Edge(); - e4.setConstructor(true); - - box = new HashSet(); - box.add(e1); - box.add(e2); - box.add(e3); - box.add(e4); } --- 27,30 ---- *************** *** 64,68 **** protected void pressed(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { ! selectionPressed(e); } } --- 45,49 ---- protected void pressed(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { ! select.pressed(e); } } *************** *** 73,77 **** */ protected void dragged(MouseEvent e) { ! selectionDragged(e); } --- 54,58 ---- */ protected void dragged(MouseEvent e) { ! select.dragged(e); } *************** *** 81,86 **** */ protected void released(MouseEvent e) { ! selectionReleased(e); } - } --- 62,66 ---- */ protected void released(MouseEvent e) { ! select.released(e); } } Index: RectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/RectTool.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** RectTool.java 20 Jun 2006 13:30:58 -0000 1.9 --- RectTool.java 21 Jun 2006 13:26:18 -0000 1.10 *************** *** 10,13 **** --- 10,14 ---- import java.awt.Cursor; import java.awt.event.MouseEvent; + import java.util.HashSet; import java.util.LinkedList; import java.util.List; *************** *** 27,30 **** --- 28,48 ---- private static Logger log = Logger.getLogger(RectTool.class); + + /** Tempoary edges for multiple selection */ + protected Edge e1; + + /** Tempoary edges for multiple selection */ + protected Edge e2; + + /** Tempoary edges for multiple selection */ + protected Edge e3; + + /** Tempoary edges for multiple selection */ + protected Edge e4; + + /** The drag box */ + protected HashSet box; + + /** * Constructor Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** AbstractTool.java 21 Jun 2006 11:57:54 -0000 1.76 --- AbstractTool.java 21 Jun 2006 13:26:18 -0000 1.77 *************** *** 19,23 **** import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; - import net.sourceforge.bprocessor.gl.view.Transformation; import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.gl.GLView; --- 19,22 ---- *************** *** 34,38 **** import java.net.URL; import java.util.Iterator; - import java.util.List; import java.util.Set; import java.util.HashSet; --- 33,36 ---- *************** *** 53,56 **** --- 51,57 ---- protected static Strategy pan; + /** Select strategy */ + protected static Strategy select; + /** The x axis */ protected Edge xAxis = new Edge(new Vertex(-50, 0, 0), new Vertex(50, 0, 0)); *************** *** 94,128 **** /** The cursor for drag */ private Cursor dragCursor; - - /** Tempoary vertexes for multiple selection */ - private Vertex first; - - /** Tempoary vertexes for multiple selection */ - private Vertex last; - - /** Tempoary vertexes for multiple selection */ - private Vertex temp1; - - /** Tempoary vertexes for multiple selection */ - private Vertex temp2; - - /** Tempoary edges for multiple selection */ - protected Edge e1; - - /** Tempoary edges for multiple selection */ - protected Edge e2; - - /** Tempoary edges for multiple selection */ - protected Edge e3; - - /** Tempoary edges for multiple selection */ - protected Edge e4; - - /** The drag box */ - protected HashSet box; - - /** Telling if it were a multiple selection */ - private boolean multipleSelection = false; - static { --- 95,98 ---- *************** *** 148,151 **** --- 118,124 ---- pan = new PanStrategy(glv); } + if (select == null) { + select = new SelectStrategy(glv); + } } *************** *** 389,393 **** if (e.getButton() == 1) { if (e.isMetaDown() || e.isControlDown()) { ! log.info("select-tool"); } } --- 362,367 ---- if (e.getButton() == 1) { if (e.isMetaDown() || e.isControlDown()) { ! select.pressed(e); ! return; } } *************** *** 745,819 **** } } - - /** - * Handle a pressed event as selection tool - * @param e MouseEvent - */ - protected void selectionPressed(MouseEvent e) { - Transformation t = glv.getView().transformation(); - first = t.unProject(new Vertex(e.getX(), View.getHeight() - e.getY(), 0.001)); - e1.setFrom(first); - e4.setTo(first); - if (e.getClickCount() >= 2 && target instanceof Surface) { - Surface surface = (Surface) target; - if (surface.getBackDomain() != null) { - selection.addAll(surface.getBackDomain().getEnvelope()); - } - if (surface.getFrontDomain() != null) { - selection.addAll(surface.getFrontDomain().getEnvelope()); - } - } else { - if (target == null) { - selection.clear(); - multipleSelection = true; - } else if (e.isShiftDown()) { - if (!selection.contains(target)) { - selection.add(target); - } else { - selection.remove(target); - } - } else { - if (!selection.contains(target)) { - selection.clear(); - selection.add(target); - } - } - } - } - - /** - * Handle a dragged event as selection tool - * @param e MouseEvent - */ - protected void selectionDragged(MouseEvent e) { - if (multipleSelection) { - Transformation t = glv.getView().transformation(); - last = t.unProject(new Vertex(e.getX(), View.getHeight() - e.getY(), 0.001)); - temp1 = t.unProject(new Vertex(e.getX(), View.getHeight() - pressPos[1], 0.001)); - temp2 = t.unProject(new Vertex(pressPos[0], View.getHeight() - e.getY(), 0.001)); - e1.setTo(temp1); - e2.setFrom(temp1); - e2.setTo(last); - e3.setFrom(last); - e3.setTo(temp2); - e4.setFrom(temp2); - displayConstructors(box); - } - } - - /** - * Handle a released event as selection tool - * @param e MouseEvent - */ - protected void selectionReleased(MouseEvent e) { - if (multipleSelection) { - selection.clear(); - clearConstructors(box); - List l = glv.getView().getObjectInArea(pressPos[0], pressPos[1], - e.getX(), e.getY()); - glv.getView().makeTarget(null); - selection.addAll(l); - multipleSelection = false; - } - } } --- 719,721 ---- |
From: Michael L. <he...@us...> - 2006-06-21 11:57:57
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26367/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java Log Message: More refactoring Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** AbstractTool.java 21 Jun 2006 10:26:32 -0000 1.75 --- AbstractTool.java 21 Jun 2006 11:57:54 -0000 1.76 *************** *** 306,314 **** AbstractTool.dy = y - pressPos[1]; ! if ((e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) == MouseEvent.BUTTON2_DOWN_MASK || ! e.getButton() == MouseEvent.BUTTON2) { ! pan.dragged(e); - //panDragged(e); } else { dragged(e); --- 306,313 ---- AbstractTool.dy = y - pressPos[1]; ! log.info("dragged button " + e.getButton()); ! ! if (e.getButton() == MouseEvent.BUTTON2) { pan.dragged(e); } else { dragged(e); *************** *** 366,370 **** ! log.info("button = " + e.getButton()); if (e.isAltDown()) { --- 365,369 ---- ! log.info("pressed button " + e.getButton()); if (e.isAltDown()) { *************** *** 401,406 **** previousPos[0] = pressPos[0]; previousPos[1] = pressPos[1]; ! if ((e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) == MouseEvent.BUTTON2_DOWN_MASK || ! e.getButton() == MouseEvent.BUTTON2) { glv.setCursor(dragCursor); pan.pressed(e); --- 400,404 ---- previousPos[0] = pressPos[0]; previousPos[1] = pressPos[1]; ! if (e.getButton() == MouseEvent.BUTTON2) { glv.setCursor(dragCursor); pan.pressed(e); *************** *** 416,425 **** */ public void mouseReleased(MouseEvent e) { if (e.isPopupTrigger()) { log.info("up popup-trigger"); } ! if ((e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) == MouseEvent.BUTTON2_DOWN_MASK || ! e.getButton() == MouseEvent.BUTTON2) { glv.setCursor(cursor); pan.released(e); --- 414,423 ---- */ public void mouseReleased(MouseEvent e) { + log.info("released button " + e.getButton()); if (e.isPopupTrigger()) { log.info("up popup-trigger"); } ! if (e.getButton() == MouseEvent.BUTTON2) { glv.setCursor(cursor); pan.released(e); |
From: Michael L. <he...@us...> - 2006-06-21 10:26:43
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv18835/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java Added Files: Strategy.java PanStrategy.java Log Message: Refactored pan-code out into a strategy pattern --- NEW FILE: PanStrategy.java --- //--------------------------------------------------------------------------------- // $Id: PanStrategy.java,v 1.1 2006/06/21 10:26:33 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.event.MouseEvent; import net.sourceforge.bprocessor.gl.GLView; import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.model.Camera; import net.sourceforge.bprocessor.model.Plane; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Vertex; /** * PanStrategy */ public class PanStrategy implements Strategy { /** The GLView */ private GLView glv; /** The x */ private int x; /** The y */ private int y; /** * Constructor * @param glv GLView */ public PanStrategy(GLView glv) { this.glv = glv; } /** * Invoked when the mouse cursor has been moved * @param e The MouseEvent object */ public void moved(MouseEvent e) { } /** * Invoked when the mouse cursor has been pressed * @param e The MouseEvent object */ public void pressed(MouseEvent e) { x = e.getX(); y = e.getY(); } /** * Invoked when the mouse cursor has been dragged * @param e The MouseEvent object */ public void dragged(MouseEvent e) { View view = glv.getView(); Camera c = Project.getInstance().getCurrentCamera(); double[] center = c.getCenter(); double[] camera = c.getCamera(); double dx = camera[0] - center[0]; double dy = camera[1] - center[1]; double dz = camera[2] - center[2]; double sqr = Math.sqrt(dx * dx + dy * dy + dz * dz); if (sqr < 1) { dx *= 1 / sqr; dy *= 1 / sqr; dz *= 1 / sqr; } double d = -dx * center[0] - dy * center[1] - dz * center[2]; Vertex first = view.toPlaneCoords(new double[] {x, y}, new Plane(dx, dy, dz, d)); Vertex second = view.toPlaneCoords(new double[] {e.getX(), e.getY()}, new Plane(dx, dy, dz, d)); c.translate(new double[] {first.getX() - second.getX(), first.getY() - second.getY(), first.getZ() - second.getZ()}); Project.getInstance().changed(c); x = e.getX(); y = e.getY(); } /** * Invoked when the mouse cursor has been released * @param e The MouseEvent object */ public void released(MouseEvent e) { } } --- NEW FILE: Strategy.java --- //--------------------------------------------------------------------------------- // $Id: Strategy.java,v 1.1 2006/06/21 10:26:33 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.event.MouseEvent; /** * Strategy */ public interface Strategy { /** * Invoked when the mouse cursor has been moved * @param e The MouseEvent object */ abstract void moved(MouseEvent e); /** * Invoked when a mouse button has been pressed on a component. * @param e The MouseEvent object */ abstract void pressed(MouseEvent e); /** * Invoked when the mouse is held pressed and moved * @param e The MouseEvent object */ abstract void dragged(MouseEvent e); /** * Invoked when a mouse button has been released on a component. * @param e The MouseEvent */ abstract void released(MouseEvent e); } Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** AbstractTool.java 20 Jun 2006 13:30:58 -0000 1.74 --- AbstractTool.java 21 Jun 2006 10:26:32 -0000 1.75 *************** *** 50,53 **** --- 50,56 ---- protected boolean directMode = false; + /** Pan strategy */ + protected static Strategy pan; + /** The x axis */ protected Edge xAxis = new Edge(new Vertex(-50, 0, 0), new Vertex(50, 0, 0)); *************** *** 141,144 **** --- 144,151 ---- dragCursor = Toolkit.getDefaultToolkit().createCustomCursor(dragImage, new Point(7, 8), "Drag"); + + if (pan == null) { + pan = new PanStrategy(glv); + } } *************** *** 301,305 **** if ((e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) == MouseEvent.BUTTON2_DOWN_MASK || e.getButton() == MouseEvent.BUTTON2) { ! panDragged(e); } else { dragged(e); --- 308,314 ---- if ((e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) == MouseEvent.BUTTON2_DOWN_MASK || e.getButton() == MouseEvent.BUTTON2) { ! ! pan.dragged(e); ! //panDragged(e); } else { dragged(e); *************** *** 394,398 **** if ((e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) == MouseEvent.BUTTON2_DOWN_MASK || e.getButton() == MouseEvent.BUTTON2) { ! panPressed(e); } else { pressed(e); --- 403,408 ---- if ((e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) == MouseEvent.BUTTON2_DOWN_MASK || e.getButton() == MouseEvent.BUTTON2) { ! glv.setCursor(dragCursor); ! pan.pressed(e); } else { pressed(e); *************** *** 412,416 **** if ((e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) == MouseEvent.BUTTON2_DOWN_MASK || e.getButton() == MouseEvent.BUTTON2) { ! panReleased(e); } else { released(e); --- 422,427 ---- if ((e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) == MouseEvent.BUTTON2_DOWN_MASK || e.getButton() == MouseEvent.BUTTON2) { ! glv.setCursor(cursor); ! pan.released(e); } else { released(e); *************** *** 418,469 **** glv.repaint(true); } - - - /** - * Handle pressed event as pan tool - * @param e MouseEvent - */ - protected void panPressed(MouseEvent e) { - glv.setCursor(dragCursor); - } - - /** - * Handle dragged event as pan tool - * @param e MouseEvent - */ - protected void panDragged(MouseEvent e) { - View view = glv.getView(); - Camera c = Project.getInstance().getCurrentCamera(); - double[] center = c.getCenter(); - double[] camera = c.getCamera(); - double dx = camera[0] - center[0]; - double dy = camera[1] - center[1]; - double dz = camera[2] - center[2]; - double sqr = Math.sqrt(dx * dx + dy * dy + dz * dz); - if (sqr < 1) { - dx *= 1 / sqr; - dy *= 1 / sqr; - dz *= 1 / sqr; - } - double d = -dx * center[0] - dy * center[1] - dz * center[2]; - Vertex first = view.toPlaneCoords(new double[] {previousPos[0], - previousPos[1]}, - new Plane(dx, dy, dz, d)); - Vertex second = view.toPlaneCoords(new double[] {e.getX(), - e.getY()}, - new Plane(dx, dy, dz, d)); - c.translate(new double[] {first.getX() - second.getX(), - first.getY() - second.getY(), - first.getZ() - second.getZ()}); - Project.getInstance().changed(c); - } - - /** - * Handle released event as pan tool - * @param e MouseEvent - */ - protected void panReleased(MouseEvent e) { - glv.setCursor(cursor); - } /** --- 429,432 ---- |
From: Michael L. <he...@us...> - 2006-06-21 08:26:41
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31655/src/net/sourceforge/bprocessor/gui/treeview Modified Files: CameraTreeView.java Log Message: Small change that solves a ClassNotFound exception using java 1.5 Index: CameraTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/CameraTreeView.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CameraTreeView.java 16 Jun 2006 09:51:06 -0000 1.3 --- CameraTreeView.java 21 Jun 2006 08:26:39 -0000 1.4 *************** *** 27,30 **** --- 27,32 ---- */ public class CameraTreeView extends GenericTreeView { + /** */ + private static final long serialVersionUID = 1L; /** The selected camera */ private Camera selected; |
From: Michael L. <he...@us...> - 2006-06-20 13:31:06
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25296/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java RectTool.java SelectTool.java Log Message: Moved some functionallity from selectool to abstractool Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** SelectTool.java 19 Jun 2006 13:15:12 -0000 1.59 --- SelectTool.java 20 Jun 2006 13:30:58 -0000 1.60 *************** *** 8,17 **** import net.sourceforge.bprocessor.gl.GLView; - import net.sourceforge.bprocessor.gl.view.Transformation; - import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.model.Edge; - import net.sourceforge.bprocessor.model.Vertex; - import net.sourceforge.bprocessor.model.Surface; import java.awt.Cursor; --- 8,13 ---- *************** *** 19,23 **** import java.util.HashSet; - import java.util.List; import org.apache.log4j.Logger; --- 15,18 ---- *************** *** 30,46 **** private static Logger log = Logger.getLogger(SelectTool.class); - /** Tempoary vertexes for multiple selection */ - private Vertex first, last, temp1, temp2; - - /** Tempoary edges for multiple selection */ - private Edge e1, e2, e3, e4; - - /** The drag box */ - private HashSet box; - - /** Telling if it were a multiple selection */ - private boolean multipleSelection = false; - - /** * The constructor --- 25,28 ---- *************** *** 77,153 **** /** - * Handle a pressed event as selection tool - * @param e MouseEvent - */ - protected void selectionPressed(MouseEvent e) { - Transformation t = glv.getView().transformation(); - first = t.unProject(new Vertex(e.getX(), View.getHeight() - e.getY(), 0.001)); - e1.setFrom(first); - e4.setTo(first); - if (e.getClickCount() >= 2 && target instanceof Surface) { - Surface surface = (Surface) target; - if (surface.getBackDomain() != null) { - selection.addAll(surface.getBackDomain().getEnvelope()); - } - if (surface.getFrontDomain() != null) { - selection.addAll(surface.getFrontDomain().getEnvelope()); - } - } else { - if (target == null) { - selection.clear(); - multipleSelection = true; - } else if (e.isShiftDown()) { - if (!selection.contains(target)) { - selection.add(target); - } else { - selection.remove(target); - } - } else { - if (!selection.contains(target)) { - selection.clear(); - selection.add(target); - } - } - } - } - - /** - * Handle a dragged event as selection tool - * @param e MouseEvent - */ - protected void selectionDragged(MouseEvent e) { - if (multipleSelection) { - Transformation t = glv.getView().transformation(); - last = t.unProject(new Vertex(e.getX(), View.getHeight() - e.getY(), 0.001)); - temp1 = t.unProject(new Vertex(e.getX(), View.getHeight() - pressPos[1], 0.001)); - temp2 = t.unProject(new Vertex(pressPos[0], View.getHeight() - e.getY(), 0.001)); - e1.setTo(temp1); - e2.setFrom(temp1); - e2.setTo(last); - e3.setFrom(last); - e3.setTo(temp2); - e4.setFrom(temp2); - displayConstructors(box); - } - } - - /** - * Handle a released event as selection tool - * @param e MouseEvent - */ - protected void selectionReleased(MouseEvent e) { - if (multipleSelection) { - selection.clear(); - clearConstructors(box); - List l = glv.getView().getObjectInArea(pressPos[0], pressPos[1], - e.getX(), e.getY()); - glv.getView().makeTarget(null); - selection.addAll(l); - multipleSelection = false; - } - } - - - /** * Invoked when a mouse button has been pressed on a component. * @param e The MouseEvent object --- 59,62 ---- Index: RectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/RectTool.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RectTool.java 21 Apr 2006 15:06:38 -0000 1.8 --- RectTool.java 20 Jun 2006 13:30:58 -0000 1.9 *************** *** 24,30 **** */ public class RectTool extends AbstractPencil { - /** The edges in the rectangle */ - private Edge e1, e2, e3, e4; - /** The logger */ private static Logger log = Logger.getLogger(RectTool.class); --- 24,27 ---- Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** AbstractTool.java 20 Jun 2006 12:33:27 -0000 1.73 --- AbstractTool.java 20 Jun 2006 13:30:58 -0000 1.74 *************** *** 19,22 **** --- 19,23 ---- import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; + import net.sourceforge.bprocessor.gl.view.Transformation; import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.gl.GLView; *************** *** 33,36 **** --- 34,38 ---- import java.net.URL; import java.util.Iterator; + import java.util.List; import java.util.Set; import java.util.HashSet; *************** *** 88,92 **** /** The cursor for drag */ ! private Cursor dragCursor; --- 90,124 ---- /** The cursor for drag */ ! private Cursor dragCursor; ! ! /** Tempoary vertexes for multiple selection */ ! private Vertex first; ! ! /** Tempoary vertexes for multiple selection */ ! private Vertex last; ! ! /** Tempoary vertexes for multiple selection */ ! private Vertex temp1; ! ! /** Tempoary vertexes for multiple selection */ ! private Vertex temp2; ! ! /** Tempoary edges for multiple selection */ ! protected Edge e1; ! ! /** Tempoary edges for multiple selection */ ! protected Edge e2; ! ! /** Tempoary edges for multiple selection */ ! protected Edge e3; ! ! /** Tempoary edges for multiple selection */ ! protected Edge e4; ! ! /** The drag box */ ! protected HashSet box; ! ! /** Telling if it were a multiple selection */ ! private boolean multipleSelection = false; *************** *** 346,349 **** --- 378,389 ---- } + if (!e.isPopupTrigger()) { + if (e.getButton() == 1) { + if (e.isMetaDown() || e.isControlDown()) { + log.info("select-tool"); + } + } + } + pressPos[0] = e.getX(); pressPos[1] = e.getY(); *************** *** 744,746 **** --- 784,858 ---- } } + + /** + * Handle a pressed event as selection tool + * @param e MouseEvent + */ + protected void selectionPressed(MouseEvent e) { + Transformation t = glv.getView().transformation(); + first = t.unProject(new Vertex(e.getX(), View.getHeight() - e.getY(), 0.001)); + e1.setFrom(first); + e4.setTo(first); + if (e.getClickCount() >= 2 && target instanceof Surface) { + Surface surface = (Surface) target; + if (surface.getBackDomain() != null) { + selection.addAll(surface.getBackDomain().getEnvelope()); + } + if (surface.getFrontDomain() != null) { + selection.addAll(surface.getFrontDomain().getEnvelope()); + } + } else { + if (target == null) { + selection.clear(); + multipleSelection = true; + } else if (e.isShiftDown()) { + if (!selection.contains(target)) { + selection.add(target); + } else { + selection.remove(target); + } + } else { + if (!selection.contains(target)) { + selection.clear(); + selection.add(target); + } + } + } + } + + /** + * Handle a dragged event as selection tool + * @param e MouseEvent + */ + protected void selectionDragged(MouseEvent e) { + if (multipleSelection) { + Transformation t = glv.getView().transformation(); + last = t.unProject(new Vertex(e.getX(), View.getHeight() - e.getY(), 0.001)); + temp1 = t.unProject(new Vertex(e.getX(), View.getHeight() - pressPos[1], 0.001)); + temp2 = t.unProject(new Vertex(pressPos[0], View.getHeight() - e.getY(), 0.001)); + e1.setTo(temp1); + e2.setFrom(temp1); + e2.setTo(last); + e3.setFrom(last); + e3.setTo(temp2); + e4.setFrom(temp2); + displayConstructors(box); + } + } + + /** + * Handle a released event as selection tool + * @param e MouseEvent + */ + protected void selectionReleased(MouseEvent e) { + if (multipleSelection) { + selection.clear(); + clearConstructors(box); + List l = glv.getView().getObjectInArea(pressPos[0], pressPos[1], + e.getX(), e.getY()); + glv.getView().makeTarget(null); + selection.addAll(l); + multipleSelection = false; + } + } } |
From: Michael L. <he...@us...> - 2006-06-20 12:33:31
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv641/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java Log Message: Some test-prints in AbstractTool added Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** AbstractTool.java 19 Jun 2006 13:15:12 -0000 1.72 --- AbstractTool.java 20 Jun 2006 12:33:27 -0000 1.73 *************** *** 323,326 **** --- 323,349 ---- */ public void mousePressed(MouseEvent e) { + + + log.info("button = " + e.getButton()); + + if (e.isAltDown()) { + log.info("alt-down"); + } + if (e.isAltGraphDown()) { + log.info("alt-graph-down"); + } + if (e.isControlDown()) { + log.info("control-down"); + } + if (e.isMetaDown()) { + log.info("meta-down"); + } + if (e.isShiftDown()) { + log.info("shift-down"); + } + if (e.isPopupTrigger()) { + log.info("down popup-trigger"); + } + pressPos[0] = e.getX(); pressPos[1] = e.getY(); *************** *** 343,346 **** --- 366,373 ---- */ public void mouseReleased(MouseEvent e) { + if (e.isPopupTrigger()) { + log.info("up popup-trigger"); + } + if ((e.getModifiersEx() & MouseEvent.BUTTON2_DOWN_MASK) == MouseEvent.BUTTON2_DOWN_MASK || e.getButton() == MouseEvent.BUTTON2) { |
From: Nikolaj B. <nbr...@us...> - 2006-06-20 08:14:59
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17516/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Log Message: Area calculations now with and with out holes Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.99 retrieving revision 1.100 diff -C2 -d -r1.99 -r1.100 *** Surface.java 9 Jun 2006 09:49:56 -0000 1.99 --- Surface.java 20 Jun 2006 08:14:55 -0000 1.100 *************** *** 1396,1408 **** } } - res.add(new Attribute("Area", new Double(getArea()), false)); if (isInner()) { res.add(new Attribute("Exterior", getExterior(), false)); } if (holes != null) { Iterator iterElems = holes.iterator(); while (iterElems.hasNext()) { ! res.add(new Attribute("Hole", iterElems.next(), false)); } } return res; --- 1396,1413 ---- } } if (isInner()) { res.add(new Attribute("Exterior", getExterior(), false)); } if (holes != null) { + double holeArea = 0; Iterator iterElems = holes.iterator(); while (iterElems.hasNext()) { ! Surface s = (Surface) iterElems.next(); ! res.add(new Attribute("Hole", s, false)); ! holeArea = holeArea + s.getArea(); } + + res.add(new Attribute("Total area", new Double(getArea()), false)); + res.add(new Attribute("Area", new Double(getArea() - holeArea), false)); } return res; |
From: Michael L. <he...@us...> - 2006-06-19 13:15:21
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23707/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Some cleanup of keypressed code Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** View.java 16 Jun 2006 09:53:46 -0000 1.94 --- View.java 19 Jun 2006 13:15:13 -0000 1.95 *************** *** 614,618 **** } else if (camera.getType() == Camera.PERSPECTIVE) { // fovy, aspect, near, far (relative to camera position) ! glu.gluPerspective(aspect * focalwidth, 1.0, near, far); } } else { --- 614,618 ---- } else if (camera.getType() == Camera.PERSPECTIVE) { // fovy, aspect, near, far (relative to camera position) ! glu.gluPerspective(focalwidth, aspect, near, far); } } else { |
From: Michael L. <he...@us...> - 2006-06-19 13:15:17
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23707/src/net/sourceforge/bprocessor/gl/tool Modified Files: AbstractTool.java SpaceTool.java AbstractPencil.java SelectTool.java Log Message: Some cleanup of keypressed code Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** SpaceTool.java 24 May 2006 13:43:39 -0000 1.21 --- SpaceTool.java 19 Jun 2006 13:15:12 -0000 1.22 *************** *** 11,16 **** import java.awt.event.ActionEvent; import java.awt.event.ActionListener; - import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.util.Arrays; import java.util.Collection; --- 11,16 ---- import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; *************** *** 27,30 **** --- 27,31 ---- import net.sourceforge.bprocessor.gl.GLView; + import net.sourceforge.bprocessor.model.ClippingPlane; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.LayerModellor; *************** *** 505,520 **** } /** ! * Invoked when a key has been pressed. Lets user delete what is selected. ! * @param e The KeyEvent */ ! public void keyPressed(KeyEvent e) { ! if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { ! selection.clear(); ! glv.getView().makeTarget(null); ! Project.getInstance().setActiveSpace(null); ! } else { ! super.keyPressed(e); } } } --- 506,545 ---- } + /** ! * Delete */ ! public void delete() { ! Iterator it = selection.iterator(); ! List edges = new ArrayList(); ! List vertices = new ArrayList(); ! List surfaces = new ArrayList(); ! while (it.hasNext()) { ! Object selected = it.next(); ! if (selected instanceof Surface) { ! surfaces.add((Surface)selected); ! } else if (selected instanceof Edge) { ! edges.add((Edge)selected); ! } else if (selected instanceof Vertex) { ! vertices.add((Vertex) selected); ! } else if (selected instanceof ClippingPlane) { ! Project.getInstance().getCurrentCamera().removeClipplane((ClippingPlane)selected); ! } } + selection.clear(); + glv.getView().makeTarget(null); + Project.getInstance().delete(surfaces); + Project.getInstance().delete(edges); + Project.getInstance().delete(vertices); + Project.getInstance().checkpoint(); + } + + /** + * Escape + */ + public void escape() { + selection.clear(); + glv.getView().makeTarget(null); + Project.getInstance().setActiveSpace(null); } } Index: SelectTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SelectTool.java,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** SelectTool.java 6 Jun 2006 09:22:25 -0000 1.58 --- SelectTool.java 19 Jun 2006 13:15:12 -0000 1.59 *************** *** 11,17 **** import net.sourceforge.bprocessor.gl.view.View; - import net.sourceforge.bprocessor.model.ClippingPlane; 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,15 ---- *************** *** 19,27 **** import java.awt.Cursor; import java.awt.event.MouseEvent; - import java.awt.event.KeyEvent; - import java.util.ArrayList; import java.util.HashSet; - import java.util.Iterator; import java.util.List; --- 17,22 ---- *************** *** 180,215 **** } - /** - * Invoked when a key has been pressed. Lets user delete what is selected. - * @param e The KeyEvent - */ - public void keyPressed(KeyEvent e) { - if (e.getKeyCode() == KeyEvent.VK_DELETE || - e.getKeyCode() == KeyEvent.VK_BACK_SPACE) { - Iterator it = selection.iterator(); - List edges = new ArrayList(); - List vertices = new ArrayList(); - List surfaces = new ArrayList(); - while (it.hasNext()) { - Object selected = it.next(); - if (selected instanceof Surface) { - surfaces.add((Surface)selected); - } else if (selected instanceof Edge) { - edges.add((Edge)selected); - } else if (selected instanceof Vertex) { - vertices.add((Vertex) selected); - } else if (selected instanceof ClippingPlane) { - Project.getInstance().getCurrentCamera().removeClipplane((ClippingPlane)selected); - } - } - selection.clear(); - glv.getView().makeTarget(null); - Project.getInstance().delete(surfaces); - Project.getInstance().delete(edges); - Project.getInstance().delete(vertices); - Project.getInstance().checkpoint(); - } else { - super.keyPressed(e); - } - } } --- 175,177 ---- Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** AbstractPencil.java 14 Jun 2006 14:36:56 -0000 1.32 --- AbstractPencil.java 19 Jun 2006 13:15:12 -0000 1.33 *************** *** 695,719 **** number = ""; } ! if (e.getKeyCode() == KeyEvent.VK_SPACE) { ! Collection deletion = new LinkedList(); ! { ! Collection edges = Project.getInstance().getEdges(); ! Iterator iter = edges.iterator(); ! while (iter.hasNext()) { ! Edge current = (Edge) iter.next(); ! if (current.getConstructor()) { ! deletion.add(current); ! } ! } ! } ! { ! Iterator iter = deletion.iterator(); ! while (iter.hasNext()) { ! Edge current = (Edge) iter.next(); ! Project.getInstance().remove(current); ! } ! } ! glv.repaint(); ! } else if (e.getKeyCode() == KeyEvent.VK_SHIFT) { if (start != null && current != null) { locked = start.vertex().minus(current.vertex()); --- 695,699 ---- number = ""; } ! if (e.getKeyCode() == KeyEvent.VK_SHIFT) { if (start != null && current != null) { locked = start.vertex().minus(current.vertex()); Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** AbstractTool.java 16 Jun 2006 09:56:51 -0000 1.71 --- AbstractTool.java 19 Jun 2006 13:15:12 -0000 1.72 *************** *** 189,192 **** --- 189,202 ---- sidewards.scale(2 / sidewards.length()); up.scale(2 / up.length()); + + if (e.getKeyCode() == KeyEvent.VK_BACK_SPACE || e.getKeyCode() == KeyEvent.VK_DELETE) { + delete(); + return; + } + if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { + escape(); + return; + } + if ((e.getModifiersEx() & KeyEvent.SHIFT_DOWN_MASK) == KeyEvent.SHIFT_DOWN_MASK) { // IF SHIFT IS PRESSED AS MODIFIER *************** *** 595,598 **** --- 605,632 ---- */ protected abstract void released(MouseEvent e); + + /** + * Invoked when a key has been pressed + * @param e KeyEvent + */ + protected void key(KeyEvent e) { + + } + + /** + * A delete key has been pressed + * + */ + protected void delete() { + + } + + /** + * The escape key has been pressed + * + */ + protected void escape() { + + } /** |
From: Nordholt <nor...@us...> - 2006-06-16 11:12:28
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5115/tool Modified Files: ToolFactory.java Log Message: using aspect in viewing entire model Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** ToolFactory.java 13 Jun 2006 09:42:40 -0000 1.48 --- ToolFactory.java 16 Jun 2006 09:53:46 -0000 1.49 *************** *** 221,234 **** Action zoomAction = new ToolAction(glv, 0, "Biconzomeall.gif") { ! public void actionPerformed(ActionEvent agr0) { ! Project.getInstance().getCurrentCamera().viewEntireModel(); ! this.glv.repaint(); ! } ! }; ! ! Toolbar.getInstance().registerPushButtonAction(zoomAction); tb.addSeparator(10); Action orthoAction = new ToolAction(glv, 0, "Borto.gif") { --- 221,235 ---- Action zoomAction = new ToolAction(glv, 0, "Biconzomeall.gif") { ! public void actionPerformed(ActionEvent agr0) { ! double apsect = glv.getView().getAspect(); ! Project.getInstance().getCurrentCamera().viewEntireModel(apsect); ! this.glv.repaint(); ! } ! }; ! Toolbar.getInstance().registerPushButtonAction(zoomAction); tb.addSeparator(10); + Action orthoAction = new ToolAction(glv, 0, "Borto.gif") { |
From: Nordholt <nor...@us...> - 2006-06-16 10:18:55
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30660 Modified Files: Selection.java Log Message: removed camera responsability Index: Selection.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Selection.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Selection.java 15 May 2006 12:15:23 -0000 1.8 --- Selection.java 16 Jun 2006 09:41:37 -0000 1.9 *************** *** 146,152 **** current.update(this); } - if (!selection.isEmpty() && this.selection.get(0) instanceof Camera) { - Project.getInstance().setCurrentCamera((Camera)this.selection.get(0)); - } } --- 146,149 ---- |
From: Nordholt <nor...@us...> - 2006-06-16 10:00:56
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31125 Modified Files: Project.java Log Message: added default cameras Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** Project.java 24 May 2006 13:43:36 -0000 1.58 --- Project.java 16 Jun 2006 09:42:08 -0000 1.59 *************** *** 43,46 **** --- 43,49 ---- /** The cameras */ private HashMap cameras = new HashMap(); + + /** The default un-changeable cameras */ + private HashMap defaultCams = new HashMap(); /** The domain id */ *************** *** 182,197 **** Camera cam0 = Camera.create(Camera.VIEW_3D); // The starting cam (copy of 3d cam) cam0.setId(new Long(cameraId++)); ! cam0.setName("default"); cameras.put(cam0.getId(), cam0); Camera cam2 = Camera.create(Camera.VIEW_XY); // Reset to 2D position XY with ortho cam2.setId(new Long(cameraId++)); cameras.put(cam2.getId(), cam2); Camera cam3 = Camera.create(Camera.VIEW_XZ); // Reset to 2D position XZ with ortho cam3.setId(new Long(cameraId++)); cameras.put(cam3.getId(), cam3); Camera cam4 = Camera.create(Camera.VIEW_YZ); // Reset to 2D position YZ with ortho cam4.setId(new Long(cameraId++)); cameras.put(cam4.getId(), cam4); ! currentCamera = cam0; } --- 185,204 ---- Camera cam0 = Camera.create(Camera.VIEW_3D); // The starting cam (copy of 3d cam) cam0.setId(new Long(cameraId++)); ! cam0.setName("Main view"); cameras.put(cam0.getId(), cam0); + defaultCams.put(cam0.getId(), cam0); Camera cam2 = Camera.create(Camera.VIEW_XY); // Reset to 2D position XY with ortho cam2.setId(new Long(cameraId++)); cameras.put(cam2.getId(), cam2); + defaultCams.put(cam2.getId(), cam2); Camera cam3 = Camera.create(Camera.VIEW_XZ); // Reset to 2D position XZ with ortho cam3.setId(new Long(cameraId++)); cameras.put(cam3.getId(), cam3); + defaultCams.put(cam3.getId(), cam3); Camera cam4 = Camera.create(Camera.VIEW_YZ); // Reset to 2D position YZ with ortho cam4.setId(new Long(cameraId++)); cameras.put(cam4.getId(), cam4); ! defaultCams.put(cam4.getId(), cam4); ! currentCamera = new Camera(cam0, "Current"); } *************** *** 407,410 **** --- 414,418 ---- } + /** * Find all functional spaces *************** *** 574,577 **** --- 582,593 ---- return new HashSet(cameras.values()); } + + /** + * Get all default cameras + * @return The cameras + */ + public Collection getDefaultCameras() { + return new HashSet(defaultCams.values()); + } /** |
From: Nordholt <nor...@us...> - 2006-06-16 10:00:56
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv599 Modified Files: Camera.java Log Message: changed viewentiremodel implementation to take the aspect into account and to find a better center point. Still does not work quite as I would like it though Index: Camera.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Camera.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Camera.java 6 Jun 2006 09:22:31 -0000 1.16 --- Camera.java 16 Jun 2006 09:45:17 -0000 1.17 *************** *** 10,13 **** --- 10,14 ---- import java.util.Collection; import java.util.Iterator; + import java.util.HashSet; import java.util.List; import java.util.Set; *************** *** 395,425 **** /** * Moves the camera to a position where the entire model is visible. */ ! public void viewEntireModel() { Set allVertices = Project.getInstance().world().collect(); if (!allVertices.isEmpty()) { ! Vertex modelCenter = Project.getInstance().world().center(); Iterator it = allVertices.iterator(); - double maxDistance = 0; while (it.hasNext()) { Vertex v = (Vertex) it.next(); ! double distance = v.minus(modelCenter).length(); ! if (distance > maxDistance) { ! maxDistance = distance; } } ! double cameraDistance = ! maxDistance / Math.tan(Math.toRadians((this.getFocalwidth() / 2))); ! Vertex cameraPos = new Vertex(camera[0] - center[0], ! camera[1] - center[1], ! camera[2] - center[2]); ! cameraPos.scale(cameraDistance / cameraPos.length()); ! cameraPos = cameraPos.add(modelCenter); ! setCenter(new double[] {modelCenter.getX(), ! modelCenter.getY(), ! modelCenter.getZ()}); ! setCamera(new double[] {cameraPos.getX(), ! cameraPos.getY(), ! cameraPos.getZ()}); } } --- 396,454 ---- /** * Moves the camera to a position where the entire model is visible. + * @param aspect the acspect ratio of the view. */ ! public void viewEntireModel(double aspect) { Set allVertices = Project.getInstance().world().collect(); if (!allVertices.isEmpty()) { ! //Computing center and radius of the minimal covering sphere ! Set notTested = new HashSet(allVertices); ! double radius = 0; ! Vertex p1 = null; ! Vertex p2 = null; Iterator it = allVertices.iterator(); while (it.hasNext()) { Vertex v = (Vertex) it.next(); ! notTested.remove(v); ! Iterator testIt = notTested.iterator(); ! while (testIt.hasNext()) { ! Vertex u = (Vertex)testIt.next(); ! if ((v.minus(u).length() / 2.0) > radius) { ! p1 = v; ! p2 = u; ! radius = v.minus(u).length() / 2.0; ! } } } ! if (p1 != null && p2 != null) { ! Vertex modelCenter = p1.minus(p2); ! modelCenter.scale(1.0 / 2.0); ! modelCenter = modelCenter.add(p2); ! ! //Setting up camera ! double halfFocal; ! if (aspect < 1.0) { ! halfFocal = (this.getFocalwidth() * aspect) / 2.0; ! log.info("doing"); ! } else { ! halfFocal = (this.getFocalwidth() / 2.0); ! } ! ! double halfFocalVerTan = Math.tan(Math.toRadians(halfFocal)); ! double halfFocalHorTan = halfFocalVerTan / aspect; ! ! double width = Math.min(halfFocalHorTan, halfFocalVerTan); ! double cameraDistance = radius / width; ! Vertex cameraPos = new Vertex(camera[0] - center[0], ! camera[1] - center[1], ! camera[2] - center[2]); ! cameraPos.scale(cameraDistance / cameraPos.length()); ! cameraPos = cameraPos.add(modelCenter); ! setCenter(new double[] {modelCenter.getX(), ! modelCenter.getY(), ! modelCenter.getZ()}); ! setCamera(new double[] {cameraPos.getX(), ! cameraPos.getY(), ! cameraPos.getZ()}); ! } } } |
From: Nordholt <nor...@us...> - 2006-06-16 10:00:54
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31386 Modified Files: Geometric.java Log Message: corrected documentation Index: Geometric.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Geometric.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Geometric.java 5 Apr 2006 10:23:22 -0000 1.5 --- Geometric.java 16 Jun 2006 09:42:57 -0000 1.6 *************** *** 12,16 **** /** * The Geometric as a super class for geometric entities ! * surface, edge and vertex */ public abstract class Geometric extends Entity { --- 12,16 ---- /** * The Geometric as a super class for geometric entities ! * surface, edge, vertex and space */ public abstract class Geometric extends Entity { |
From: Nordholt <nor...@us...> - 2006-06-16 10:00:54
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31904 Modified Files: ClippingPlane.java Log Message: implemented the delete method Index: ClippingPlane.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ClippingPlane.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ClippingPlane.java 6 Jun 2006 09:22:31 -0000 1.1 --- ClippingPlane.java 16 Jun 2006 09:43:37 -0000 1.2 *************** *** 229,232 **** --- 229,245 ---- */ public void delete() { + Iterator it = Project.getInstance().getCameras().iterator(); + while (it.hasNext()) { + Camera cam = (Camera)it.next(); + Iterator clipIt = cam.getClipplanes().iterator(); + while (clipIt.hasNext()) { + ClippingPlane clip = (ClippingPlane)clipIt.next(); + if (clip == this) { + cam.removeClipplane(this); + Project.getInstance().changed(cam); + break; + } + } + } return; } |
From: Nordholt <nor...@us...> - 2006-06-16 10:00:21
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2182 Modified Files: CameraView.java Log Message: removed out-commented code Index: CameraView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/CameraView.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CameraView.java 11 Feb 2006 18:09:15 -0000 1.3 --- CameraView.java 16 Jun 2006 09:48:05 -0000 1.4 *************** *** 32,37 **** /** Remove button */ private JButton remove; - /** set button */ - private JButton set; /** The tree of cams */ private CameraTreeView ctv; --- 32,35 ---- *************** *** 52,61 **** add = new JButton("+"); remove = new JButton("-"); - //set = new JButton("Set"); add.addActionListener(this); remove.addActionListener(this); - //set.addActionListener(this); but.add(add); - //but.add(set); but.add(remove); this.setBackground(new Color(255, 255, 255)); --- 50,56 ---- *************** *** 79,90 **** p.remove((Camera)tar[0]); } ! } /*else if (which == set) { ! Object[] tar = Selection.primary().toArray(); ! if (tar[0] instanceof Camera) { ! Camera c = new Camera((Camera)tar[0], "default"); ! p.setCurrentCamera(c); ! p.changed(c); ! } ! }*/ } } --- 74,78 ---- p.remove((Camera)tar[0]); } ! } } } |
From: Nordholt <nor...@us...> - 2006-06-16 10:00:16
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3869/treeview Modified Files: CameraTreeView.java Log Message: added clipplanes as camera children. Made selection stay across updates. Added responsablity of changing camera, and implemented imuteable default cameras Index: CameraTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/CameraTreeView.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CameraTreeView.java 23 Jan 2006 10:16:26 -0000 1.2 --- CameraTreeView.java 16 Jun 2006 09:51:06 -0000 1.3 *************** *** 10,16 **** --- 10,25 ---- import java.util.Collection; import java.util.Iterator; + import java.util.Enumeration; + import java.util.ArrayList; + + import javax.swing.event.TreeSelectionEvent; + import javax.swing.event.TreeSelectionListener; + import javax.swing.tree.TreePath; + import javax.swing.tree.DefaultMutableTreeNode; import net.sourceforge.bprocessor.model.Camera; import net.sourceforge.bprocessor.model.Project; + import net.sourceforge.bprocessor.model.Entity; + /** *************** *** 18,21 **** --- 27,32 ---- */ public class CameraTreeView extends GenericTreeView { + /** The selected camera */ + private Camera selected; /** *************** *** 24,27 **** --- 35,40 ---- public CameraTreeView() { super(); + this.addTreeSelectionListener(new SelectionListener()); + selected = null; } *************** *** 30,33 **** --- 43,49 ---- */ public void update() { + selected = findSelectedCamera(); + Enumeration e = getExpandedDescendants(new TreePath(root)); + Object[] paths = findPaths(e); root.removeAllChildren(); Collection cameras = Project.getInstance().getCameras(); *************** *** 35,41 **** while (iter.hasNext()) { Camera current = (Camera) iter.next(); ! root.add(new CameraNode(current)); } model.nodeStructureChanged(root); } } --- 51,188 ---- while (iter.hasNext()) { Camera current = (Camera) iter.next(); ! CameraNode cn = new CameraNode(current); ! Iterator clipIt = current.getClipplanes().iterator(); ! while (clipIt.hasNext()) { ! cn.add(new EntityNode((Entity)clipIt.next())); ! } ! root.add(cn); } model.nodeStructureChanged(root); + openPaths(paths); + selectCamera(selected); + } + + /** + * Selects a given camera in the tree + * @param cam the camera to select + */ + private void selectCamera(Camera cam) { + Enumeration en = root.children(); + while (en.hasMoreElements()) { + Object o = en.nextElement(); + if (o instanceof CameraNode) { + CameraNode cn = (CameraNode)o; + if (cn.getUserObject() == cam) { + selectionModel.clearSelection(); + selectionModel.addSelectionPath(new TreePath(new Object[] {root, cn})); + break; + } + } + } + } + + /** + * Finds the currently selected Camera + * @return the selected camera if any else null + */ + private Camera findSelectedCamera() { + Camera selected = null; + if (selectionModel.getSelectionPath() != null) { + Object o = selectionModel.getSelectionPath().getLastPathComponent(); + if (o instanceof DefaultMutableTreeNode) { + DefaultMutableTreeNode node = (DefaultMutableTreeNode)o; + if (node.getUserObject() instanceof Camera) { + selected = (Camera)node.getUserObject(); + } + } + } + return selected; + } + + /** + * Find the paths + * @param e and enumerator of open nodes + * @return And array of arrays of objects + */ + private Object[] findPaths(Enumeration e) { + if (e != null) { + ArrayList res = new ArrayList(); + while (e.hasMoreElements()) { + Object o = e.nextElement(); + if (o instanceof TreePath) { + TreePath tp = (TreePath)o; + Object[] os = tp.getPath(); + Object[] temp = new Object[os.length]; + for (int i = 0; i < os.length; i++) { + temp[i] = ((DefaultMutableTreeNode)os[i]).getUserObject(); + } + res.add(temp); + } + } + return res.toArray(); + } + return null; + } + + /** + * Open the paths of the given objects + * @param paths The open paths + */ + public void openPaths(Object[] paths) { + if (paths != null) { + for (int i = 0; i < paths.length; i++) { + Object[] route = (Object[])paths[i]; + if (route.length > 1) { + openPath(root, 1, route); + } + } + } + } + + /** + * Open one path in the tree + * @param depth The depth reached in this call (< route.length) + * @param node The node to check in + * @param route The path to open + */ + private void openPath(DefaultMutableTreeNode node, int depth, Object[] route) { + Enumeration e = node.children(); + while (e.hasMoreElements()) { + DefaultMutableTreeNode current = (DefaultMutableTreeNode)e.nextElement(); + if (current.getUserObject() == route[depth]) { + expandPath(new TreePath(current.getPath())); + if (depth + 1 < route.length) { + openPath(current, depth + 1, route); + } + } + } + } + + /** + * Selection Listener + */ + private class SelectionListener implements TreeSelectionListener { + /** + * ValueChanged + * @param event The Event + */ + public void valueChanged(TreeSelectionEvent event) { + if (event.isAddedPath()) { + Object object = event.getPath().getLastPathComponent(); + if (object instanceof DefaultMutableTreeNode) { + DefaultMutableTreeNode node = (DefaultMutableTreeNode) object; + Object target = node.getUserObject(); + if (target instanceof Camera && target != selected) { + selected = (Camera)target; + if (Project.getInstance().getDefaultCameras().contains(target)) { + Project.getInstance().setCurrentCamera(new Camera(selected, + "default copy")); + } else { + Project.getInstance().setCurrentCamera(selected); + } + } + } + } + } } } |
From: Nordholt <nor...@us...> - 2006-06-16 09:57:01
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5115/view Modified Files: View.java Log Message: using aspect in viewing entire model Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** View.java 13 Jun 2006 09:42:40 -0000 1.93 --- View.java 16 Jun 2006 09:53:46 -0000 1.94 *************** *** 2355,2358 **** --- 2355,2366 ---- /** + * Returns the aspect ratio + * @return the aspect ratio + */ + public double getAspect() { + return aspect; + } + + /** * @see View#toPlaneCoords */ |
From: Nordholt <nor...@us...> - 2006-06-16 09:56:53
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6834/tool Modified Files: ClipplaneTool.java CameraTool.java AbstractTool.java Log Message: made sure to called changed on the camera Index: CameraTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CameraTool.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** CameraTool.java 2 May 2006 07:09:38 -0000 1.9 --- CameraTool.java 16 Jun 2006 09:56:51 -0000 1.10 *************** *** 90,94 **** Camera.rotateVertically(c, angleY, pivot); } ! //Project.getInstance().changed(c); } } --- 90,94 ---- Camera.rotateVertically(c, angleY, pivot); } ! Project.getInstance().changed(c); } } Index: ClipplaneTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ClipplaneTool.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ClipplaneTool.java 6 Jun 2006 09:22:25 -0000 1.7 --- ClipplaneTool.java 16 Jun 2006 09:56:51 -0000 1.8 *************** *** 63,66 **** --- 63,67 ---- glv.getView().getMaxClipPlanes()) { Project.getInstance().getCurrentCamera().addClipplane(cp); + Project.getInstance().changed(Project.getInstance().getCurrentCamera()); } } Index: AbstractTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractTool.java,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** AbstractTool.java 6 Jun 2006 09:22:25 -0000 1.70 --- AbstractTool.java 16 Jun 2006 09:56:51 -0000 1.71 *************** *** 143,146 **** --- 143,147 ---- cam.zoomin(); } + Project.getInstance().changed(cam); glv.repaint(false); } |
From: Michael L. <he...@us...> - 2006-06-14 14:37:04
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26728/src/net/sourceforge/bprocessor/gl/tool Modified Files: VectorMoveStrategy.java TapeMeasureTool.java ControlledMoveStrategy.java AbstractPencil.java Log Message: Fixed bug in tape-measure handling of length-field. Steps towards general handling of length-field Index: TapeMeasureTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/TapeMeasureTool.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** TapeMeasureTool.java 15 May 2006 08:37:44 -0000 1.15 --- TapeMeasureTool.java 14 Jun 2006 14:36:56 -0000 1.16 *************** *** 12,16 **** import java.awt.Cursor; import java.awt.event.MouseEvent; - import java.awt.event.KeyEvent; import net.sourceforge.bprocessor.model.Edge; --- 12,15 ---- *************** *** 135,138 **** --- 134,138 ---- constructors(consts); excluded(consts); + glv.repaint(); } else { super.updateConstructors(); *************** *** 148,160 **** /** - * Invoked when a key has been pressed. - * @param e The KeyEvent - */ - public void keyPressed(KeyEvent e) { - super.keyPressed(e); - //move(); - } - - /** * Ends one tape measure */ --- 148,151 ---- *************** *** 162,172 **** if (currentConstruction != null) { insertEdge(currentConstruction, false); - createEdge(currentConstruction.getFrom(), currentConstruction.getFrom()); currentEdge = null; constructors(new LinkedList()); excluded(new LinkedList()); Project.getInstance().checkpoint(); } } /** * Finish tape measure --- 153,200 ---- if (currentConstruction != null) { insertEdge(currentConstruction, false); currentEdge = null; constructors(new LinkedList()); excluded(new LinkedList()); Project.getInstance().checkpoint(); + start = null; + glv.repaint(); } } + + /** + * @param length The length from the length-field + */ + public void apply(double length) { + log.info("tape-measeure-apply(" + length + ")"); + number = ""; + + if (constructionPoint != null) { + if (start != null) { + Vertex direction = constructionPoint.minus(start.vertex()); + direction.scale(length / direction.length()); + constructionPoint = start.vertex().add(direction); + Vertex minus = currentEdge.getDirection(); + minus.scale(1 / minus.length()); + Vertex constructionFrom = new Vertex ((currentEdge.getFrom().getX() + + minus.getX() * -50), + (currentEdge.getFrom().getY() + + minus.getY() * -50), + (currentEdge.getFrom().getZ() + + minus.getZ() * -50)); + Vertex constructionTo = new Vertex((currentEdge.getTo().getX() + + minus.getX() * 50), + (currentEdge.getTo().getY() + + minus.getY() * 50), + (currentEdge.getTo().getZ() + + minus.getZ() * 50)); + currentConstruction = new Edge(constructionFrom, constructionTo); + currentConstruction.setConstructor(true); + currentConstruction.move(direction.getX(), direction.getY(), direction.getZ()); + endTapeMeasure(); + } + } + + } + /** * Finish tape measure *************** *** 174,179 **** public void onVertex() { move(); ! endTapeMeasure(); ! start = null; } } --- 202,208 ---- public void onVertex() { move(); ! updateConstructors(); ! //endTapeMeasure(); ! //start = null; } } Index: AbstractPencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/AbstractPencil.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** AbstractPencil.java 15 May 2006 14:55:41 -0000 1.31 --- AbstractPencil.java 14 Jun 2006 14:36:56 -0000 1.32 *************** *** 631,634 **** --- 631,660 ---- } + + /** + * Apply current tool with specified length value + * @param length The lengthfield value + */ + public void apply(double length) { + log.info("general-apply(" + length + ")"); + if (current != null) { + Vertex before = null; + if (start != null) { + before = start.vertex(); + } else if (incident != null) { + before = incident.vertex(); + } + if (before != null) { + Vertex v = current.vertex().minus(before); + if (v.length() > 0.000000001) { + v.scale(length / v.length()); + Vertex to = before.add(v); + current = new Intersection(to, Intersection.VERTEX, to); + onVertex(); + number = ""; + } + } + } + } /** *************** *** 744,765 **** try { double d = Double.parseDouble(number); ! if (current != null) { ! Vertex before = null; ! if (start != null) { ! before = start.vertex(); ! } else if (incident != null) { ! before = incident.vertex(); ! } ! if (before != null) { ! Vertex v = current.vertex().minus(before); ! if (v.length() > 0.000000001) { ! v.scale((d / 1000) / v.length()); ! Vertex to = before.add(v); ! current = new Intersection(to, Intersection.VERTEX, to); ! onVertex(); ! number = ""; ! } ! } ! } } catch (NumberFormatException exp) { Project.info(exp); --- 770,774 ---- try { double d = Double.parseDouble(number); ! apply(d / 1000); } catch (NumberFormatException exp) { Project.info(exp); Index: VectorMoveStrategy.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/VectorMoveStrategy.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** VectorMoveStrategy.java 5 Apr 2006 10:24:56 -0000 1.3 --- VectorMoveStrategy.java 14 Jun 2006 14:36:56 -0000 1.4 *************** *** 15,19 **** import java.awt.event.MouseEvent; import java.awt.Cursor; - import java.awt.event.KeyEvent; --- 15,18 ---- *************** *** 52,67 **** super.moved(e); } - - /** - * Invoked when a key has been pressed. Lets user control the mode of movement. - * After movement in one direction a length can be typed in to adjust the movement - * to a specific length. - * ESCAPE - cancel movement. - * 0-9 - type length in length field. - * ENTER - perform move of the specified length. - * @param e The KeyEvent - */ - public void keyPressed(KeyEvent e) { - super.keyPressed(e); - } } --- 51,53 ---- Index: ControlledMoveStrategy.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ControlledMoveStrategy.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ControlledMoveStrategy.java 13 Apr 2006 13:36:10 -0000 1.4 --- ControlledMoveStrategy.java 14 Jun 2006 14:36:56 -0000 1.5 *************** *** 25,29 **** import java.awt.event.MouseEvent; import java.awt.Cursor; - import java.awt.event.KeyEvent; import org.apache.log4j.Logger; --- 25,28 ---- *************** *** 323,338 **** } } - - /** - * Invoked when a key has been pressed. Lets user control the mode of movement. - * After movement in one direction a length can be typed in to adjust the movement - * to a specific length. - * ESCAPE - cancel movement. - * 0-9 - type length in length field. - * ENTER - perform move of the specified length. - * @param e The KeyEvent - */ - public void keyPressed(KeyEvent e) { - super.keyPressed(e); - } } --- 322,324 ---- |
From: Michael L. <he...@us...> - 2006-06-13 09:42:46
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10381/src/net/sourceforge/bprocessor/gl Modified Files: GLView.java Log Message: Rearranged buttons in the toolbar Index: GLView.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/GLView.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** GLView.java 10 Apr 2006 07:12:40 -0000 1.37 --- GLView.java 13 Jun 2006 09:42:40 -0000 1.38 *************** *** 84,91 **** jp.add(lengthPanel, BorderLayout.SOUTH); view = new View(this); glc.addGLEventListener(view); ! tool = ToolFactory.getFactory(this).getDefault(); glc.addMouseListener(tool); glc.addMouseMotionListener(tool); --- 84,93 ---- jp.add(lengthPanel, BorderLayout.SOUTH); + tool = ToolFactory.getFactory(this).getDefault(); + view = new View(this); glc.addGLEventListener(view); ! glc.addMouseListener(tool); glc.addMouseMotionListener(tool); |