bprocessor-commit Mailing List for B-processor (Page 47)
Status: Pre-Alpha
Brought to you by:
henryml
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(117) |
Aug
(151) |
Sep
(157) |
Oct
(81) |
Nov
(117) |
Dec
(119) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(183) |
Feb
(130) |
Mar
(117) |
Apr
(61) |
May
(82) |
Jun
(45) |
Jul
(149) |
Aug
(173) |
Sep
(199) |
Oct
(165) |
Nov
(107) |
Dec
(137) |
2007 |
Jan
(124) |
Feb
(58) |
Mar
(123) |
Apr
(80) |
May
(130) |
Jun
(64) |
Jul
(31) |
Aug
(42) |
Sep
(114) |
Oct
(167) |
Nov
(239) |
Dec
(200) |
2008 |
Jan
(43) |
Feb
(43) |
Mar
(4) |
Apr
(9) |
May
(5) |
Jun
(1) |
Jul
(3) |
Aug
(3) |
Sep
(13) |
Oct
(9) |
Nov
(12) |
Dec
|
2009 |
Jan
|
Feb
(20) |
Mar
(7) |
Apr
(12) |
May
(34) |
Jun
(72) |
Jul
|
Aug
(3) |
Sep
(31) |
Oct
(2) |
Nov
(8) |
Dec
(4) |
2010 |
Jan
(5) |
Feb
(32) |
Mar
(8) |
Apr
(7) |
May
(36) |
Jun
|
Jul
(11) |
Aug
(15) |
Sep
(7) |
Oct
(2) |
Nov
(13) |
Dec
(80) |
2011 |
Jan
|
Feb
|
Mar
(8) |
Apr
(12) |
May
(32) |
Jun
(9) |
Jul
(5) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
(8) |
2012 |
Jan
|
Feb
|
Mar
(3) |
Apr
(5) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(22) |
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: rimestad <rim...@us...> - 2007-10-22 10:00:22
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25359/src/net/sourceforge/bprocessor/gui/actions Modified Files: FileImportActionListener.java ImportFileReader.java Log Message: Added scale and basis for obj import Index: FileImportActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions/FileImportActionListener.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** FileImportActionListener.java 12 Oct 2007 10:20:35 -0000 1.8 --- FileImportActionListener.java 22 Oct 2007 10:00:17 -0000 1.9 *************** *** 16,25 **** --- 16,28 ---- import java.io.InputStreamReader; + import javax.swing.BoxLayout; import javax.swing.JComboBox; import javax.swing.JFileChooser; import javax.swing.JLabel; import javax.swing.JPanel; + import javax.swing.JTextField; import javax.swing.filechooser.FileFilter; + import net.sourceforge.bprocessor.gui.GUI; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Space; *************** *** 37,40 **** --- 40,54 ---- private CVSinfo info = null; + + private FileFilter objFilter; + + private FileFilter csvFilter; + + /** The xy axis is the basis plane */ + public static final int XY = 0; + /** The zx axis is the basis plane */ + public static final int ZX = 1; + /** The yz axis is the basis plane */ + public static final int YZ = 2; /** *************** *** 45,63 **** info = new CVSinfo(loadChooser); loadChooser.setAccessory(info); ! loadChooser.setFileFilter(new FileFilter() { @Override public boolean accept(File f) { ! String name = f.getName(); ! if (f.isDirectory() || name.endsWith(".csv") || name.endsWith(".obj")) { ! return true; ! } ! return false; } @Override public String getDescription() { ! return "Legal import formats"; } ! }); } --- 59,87 ---- info = new CVSinfo(loadChooser); loadChooser.setAccessory(info); ! objFilter = new FileFilter() { @Override public boolean accept(File f) { ! return f.isDirectory() || f.getName().endsWith(".obj"); } @Override public String getDescription() { ! return "Obj - wavefront format"; } ! }; ! csvFilter = new FileFilter() { ! @Override ! public boolean accept(File f) { ! return f.isDirectory() || f.getName().endsWith(".csv"); ! } ! ! @Override ! public String getDescription() { ! return "Csv - Landmålergården file"; ! } ! }; ! loadChooser.addChoosableFileFilter(csvFilter); ! loadChooser.addChoosableFileFilter(objFilter); ! loadChooser.setFileFilter(csvFilter); } *************** *** 82,86 **** try { Space s = Project.getInstance().world().createUnion(lfile.getName()); ! ImportFileReader.importObjFile(lfile, s); Project.getInstance().world().add(s); } catch (Exception ex) { --- 106,111 ---- try { Space s = Project.getInstance().world().createUnion(lfile.getName()); ! ImportFileReader.importObjFile(lfile, s, info.objPanel.getScale(), ! info.objPanel.getDirection()); Project.getInstance().world().add(s); } catch (Exception ex) { *************** *** 88,91 **** --- 113,244 ---- } } + loadChooser.revalidate(); + loadChooser.repaint(); + } + } + + private class OBJJPanel extends JPanel implements ActionListener { + private JComboBox basis; + private JTextField scale; + + public OBJJPanel() { + this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); + this.add(new JLabel("Baseplane")); + basis = new JComboBox(new String[]{"X-Y", "Z-X", "Y-Z"}); + this.add(basis); + this.add(new JLabel("Scale")); + scale = new JTextField("1:1", 5); + scale.addActionListener(this); + this.add(scale); + } + + public void actionPerformed(ActionEvent e) { + if (e.getSource() instanceof JTextField) { + JTextField tf = (JTextField)e.getSource(); + log.info(e); + String txt = tf.getText(); + if (!txt.matches("1:\\d+")) { + GUI.getInstance().alert("String did not match format [1:digit]", tf.getLocation()); + } + } + } + + /** + * Return the scale for the model + * @return The scale + */ + public double getScale() { + return 1.0 / Integer.parseInt(scale.getText().substring(2)); + } + + /** + * Return a int beeing one of the static finals XY, ZX, YZ which + * is the coords that should be treated as XY plane when importing + * @return either XY, ZX or YZ + */ + public int getDirection() { + return basis.getSelectedIndex(); + } + } + + private class CSVJPanel extends JPanel implements ActionListener { + private int selectedFloor; + private JComboBox floor; + private JLabel linesLabel; + + public CSVJPanel() { + this.setMinimumSize(new Dimension(100, 50)); + this.setMaximumSize(new Dimension(100, 200)); + this.setPreferredSize(new Dimension(100, 150)); + this.add(new JLabel("Floor:")); + floor = new JComboBox(); + floor.addItem("All"); + floor.setSelectedIndex(0); + floor.addActionListener(this); + this.add(floor); + linesLabel = new JLabel("Lines:"); + this.add(linesLabel); + } + + /** + * {@inheritDoc} + */ + public void actionPerformed(ActionEvent e) { + if (isShowing()) { + if (floor.getSelectedIndex() > 0) { + selectedFloor = Integer.parseInt((String)floor.getSelectedItem()); + } else { + selectedFloor = -1; + } + } + } + + /** + * Reset all info in view + */ + private void resetView() { + linesLabel.setText("Lines:"); + floor.removeAllItems(); + floor.addItem("All"); + } + + public void fileSelected(File file) { + if (file.canRead()) { + try { + BufferedReader bf; + FileInputStream fis = new FileInputStream(file); + InputStreamReader isr = new InputStreamReader(fis); + bf = new BufferedReader(isr); + int lines = 0; + long floors = 0; + while (bf.ready()) { + String line = bf.readLine(); + if (line.charAt(0) == '#') { + //skip comments + continue; + } else { + lines++; + //read info from file + String[] tokens = line.split(";"); + if (tokens.length < 15) { + throw new Exception("Wrong file format"); + } + long f = Long.parseLong(tokens[2]); //read out the floor + floors = floors | (long)Math.pow(2, f); + } + } + resetView(); + + for (int i = 0; i < 64; i++) { + long val = (floors >> i) & 1; + if (val == 1) { + this.floor.addItem("" + i); + } + } + this.linesLabel.setText("Lines: " + lines); + } catch (Exception exc) { + log.error(exc); + } + } } } *************** *** 95,108 **** * for the users pleasure */ ! private class CVSinfo extends JPanel ! implements PropertyChangeListener, ActionListener { private File file = null; - private JComboBox floor; - - private JLabel linesLabel; - - private int selectedFloor; - /** * The constructor --- 248,256 ---- * for the users pleasure */ ! private class CVSinfo extends JPanel implements PropertyChangeListener { private File file = null; + private CSVJPanel csvPanel; + private OBJJPanel objPanel; /** * The constructor *************** *** 111,121 **** private CVSinfo(JFileChooser fc) { setPreferredSize(new Dimension(100, 50)); ! floor = new JComboBox(); ! floor.addItem("All"); ! floor.setSelectedIndex(0); ! floor.addActionListener(this); ! this.add(floor); ! linesLabel = new JLabel("Lines:"); ! this.add(linesLabel); fc.addPropertyChangeListener(this); } --- 259,264 ---- private CVSinfo(JFileChooser fc) { setPreferredSize(new Dimension(100, 50)); ! csvPanel = new CSVJPanel(); ! objPanel = new OBJJPanel(); fc.addPropertyChangeListener(this); } *************** *** 125,129 **** */ private int getSelectedFloor() { ! return selectedFloor; } --- 268,272 ---- */ private int getSelectedFloor() { ! return csvPanel.selectedFloor; } *************** *** 135,219 **** String prop = e.getPropertyName(); - //If the directory changed, don't show an image. if (JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(prop)) { file = null; update = true; - - //If a file became selected, find out which one. } else if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(prop)) { file = (File) e.getNewValue(); update = true; } if (update && file != null) { if (file.getName().endsWith(".csv")) { ! linesLabel.setEnabled(true); ! if (file.canRead()) { ! try { ! BufferedReader bf; ! FileInputStream fis = new FileInputStream(file); ! InputStreamReader isr = new InputStreamReader(fis); ! bf = new BufferedReader(isr); ! int lines = 0; ! long floors = 0; ! while (bf.ready()) { ! String line = bf.readLine(); ! if (line.charAt(0) == '#') { ! //skip comments ! continue; ! } else { ! lines++; ! //read info from file ! String[] tokens = line.split(";"); ! if (tokens.length < 15) { ! throw new Exception("Wrong file format"); ! } ! long f = Long.parseLong(tokens[2]); //read out the floor ! floors = floors | (long)Math.pow(2, f); ! } ! } ! ! resetView(); ! ! for (int i = 0; i < 64; i++) { ! long val = (floors >> i) & 1; ! if (val == 1) { ! floor.addItem("" + i); ! } ! } ! linesLabel.setText("Lines: " + lines); ! } catch (Exception exc) { ! log.error(exc); ! } ! } ! } else { ! linesLabel.setEnabled(false); } } if (isShowing()) { repaint(); - } else { - resetView(); - } - } - - /** - * Reset all info in view - */ - private void resetView() { - linesLabel.setText("Lines:"); - floor.removeAllItems(); - floor.addItem("All"); - } - - /** - * {@inheritDoc} - */ - public void actionPerformed(ActionEvent e) { - if (isShowing()) { - if (floor.getSelectedIndex() > 0) { - selectedFloor = Integer.parseInt((String)floor.getSelectedItem()); - } else { - selectedFloor = -1; - } } } --- 278,306 ---- String prop = e.getPropertyName(); if (JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(prop)) { file = null; update = true; } else if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(prop)) { file = (File) e.getNewValue(); update = true; } + + if (JFileChooser.FILE_FILTER_CHANGED_PROPERTY.equals(prop)) { + this.removeAll(); + if (e.getNewValue() == objFilter) { + this.add(objPanel); + } else if (e.getNewValue() == csvFilter) { + this.add(csvPanel); + } + this.revalidate(); + } + if (update && file != null) { if (file.getName().endsWith(".csv")) { ! csvPanel.fileSelected(file); } } if (isShowing()) { repaint(); } } Index: ImportFileReader.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions/ImportFileReader.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ImportFileReader.java 18 Oct 2007 07:58:12 -0000 1.4 --- ImportFileReader.java 22 Oct 2007 10:00:17 -0000 1.5 *************** *** 40,71 **** /** ! * Importer for the obj format that is as follows ! * # some text ! * Line is a comment until the end of the line ! * v float float float ! * A single vertex's geometric position in space. The first vertex listed in ! * the file has index 1, and subsequent vertices are numbered sequentially. ! * vn float float float ! * A normal. The first normal in the file is index 1, and subsequent normals ! * are numbered sequentially. ! * vt float float ! * A texture coordinate. The first texture coordinate in the file is index 1, ! * and subsequent textures are numbered sequentially. ! * f int int int ... ! * or ! * f int/int int/int int/int . . . ! * or ! * f int/int/int int/int/int int/int/int ... ! * A polygonal face. The numbers are indexes into the arrays of vertex positions, ! * texture coordinates, and normals respectively. A number may be omitted if, for ! * example, texture coordinates are not being defined in the model. ! * There is no maximum number of vertices that a single polygon may contain. ! * The .obj file specification says that each face must be flat and convex. ! * In JavaView polygonal face may be triangulated. * @param f The file to load * @param into the space to paste it into * @throws IOException a possible file read error */ ! public static void importObjFile(File f, Space into) throws IOException { if (f.exists()) { FileInputStream stream = new FileInputStream(f); --- 40,75 ---- /** ! * Importer for the obj format that is as follows<br> ! * # some text<br> ! * Line is a comment until the end of the line<br> ! * v float float float<br> ! * A single vertex's geometric position in space. The first vertex listed in <br> ! * the file has index 1, and subsequent vertices are numbered sequentially.<br> ! * vn float float float<br> ! * A normal. The first normal in the file is index 1, and subsequent normals <br> ! * are numbered sequentially.<br> ! * vt float float<br> ! * A texture coordinate. The first texture coordinate in the file is index 1, <br> ! * and subsequent textures are numbered sequentially.<br> ! * f int int int ...<br> ! * or<br> ! * f int/int int/int int/int . . .<br> ! * or<br> ! * f int/int/int int/int/int int/int/int ...<br> ! * A polygonal face. The numbers are indexes into the arrays of vertex positions, <br> ! * texture coordinates, and normals respectively. A number may be omitted if, for <br> ! * example, texture coordinates are not being defined in the model.<br> ! * There is no maximum number of vertices that a single polygon may contain. <br> ! * The .obj file specification says that each face must be flat and convex. <br> ! * In JavaView polygonal face may be triangulated. <br> * @param f The file to load * @param into the space to paste it into + * @param scale The scale to import in + * @param basisPlane the plane to use as xy plane. Use one of the static final ints in + * net.sourceforge.bprocessor.gui.actions.FileImportActionListener * @throws IOException a possible file read error */ ! public static void importObjFile(File f, Space into, double scale, int basisPlane) ! throws IOException { if (f.exists()) { FileInputStream stream = new FileInputStream(f); *************** *** 73,84 **** BufferedReader br = new BufferedReader(reader); LinkedList<Vertex> verts = new LinkedList<Vertex>(); Set<Edge> edges = new HashSet<Edge>(); Set<Surface> surfaces = new HashSet<Surface>(); Map<Vertex, Set<Edge>> v2es = new HashMap<Vertex, Set<Edge>>(); List<Space> groups = new LinkedList<Space>(); Map<String, Material> materialMap = new HashMap<String, Material>(); Space currentGroup = into.createConstructionSpace("Object"); ! Material currentMaterial = new Material("Object", new float[]{0f, 0.9f, 0f}); ! materialMap.put("default", currentMaterial); groups.add(currentGroup); int lineNum = 0; --- 77,90 ---- BufferedReader br = new BufferedReader(reader); LinkedList<Vertex> verts = new LinkedList<Vertex>(); + LinkedList<Vertex> vertexNormals = new LinkedList<Vertex>(); + LinkedList<Vertex> vertexTexture = new LinkedList<Vertex>(); Set<Edge> edges = new HashSet<Edge>(); Set<Surface> surfaces = new HashSet<Surface>(); Map<Vertex, Set<Edge>> v2es = new HashMap<Vertex, Set<Edge>>(); + Map<Vertex, Vertex> v2normal = new HashMap<Vertex, Vertex>(); List<Space> groups = new LinkedList<Space>(); Map<String, Material> materialMap = new HashMap<String, Material>(); Space currentGroup = into.createConstructionSpace("Object"); ! Material currentMaterial = null; groups.add(currentGroup); int lineNum = 0; *************** *** 91,105 **** double y = Double.parseDouble(lineContent[2]); double z = Double.parseDouble(lineContent[3]); ! double factor = 0.1; ! Vertex v = new Vertex(z * factor, x * factor, y * factor); verts.add(v); v2es.put(v, new HashSet<Edge>()); } else if (lineContent[0].equals("f")) { LinkedList<Edge> edge = new LinkedList<Edge>(); ! Vertex cur = null; ! Vertex first = verts.get(Integer.parseInt(lineContent[1].split("/")[0]) - 1); Vertex prev = first; for (int i = 2; i < lineContent.length; i++) { ! cur = verts.get(Integer.parseInt(lineContent[i].split("/")[0]) - 1); Edge e = findEdge(prev, cur, v2es); edge.add(e); --- 97,159 ---- double y = Double.parseDouble(lineContent[2]); double z = Double.parseDouble(lineContent[3]); ! switch (basisPlane) { ! case FileImportActionListener.YZ: ! double tmpy = y; ! y = x; ! x = z; ! z = tmpy; ! break; ! case FileImportActionListener.ZX: ! double tmpx = x; ! x = z; ! z = y; ! y = tmpx; ! break; ! } ! Vertex v = new Vertex(x * scale, y * scale, z * scale); verts.add(v); v2es.put(v, new HashSet<Edge>()); + } else if (lineContent[0].equals("vn")) { + double x = Double.parseDouble(lineContent[1]); + double y = Double.parseDouble(lineContent[2]); + double z = Double.parseDouble(lineContent[3]); + Vertex v = new Vertex(z, x, y); + vertexNormals.add(v); + v2es.put(v, new HashSet<Edge>()); + } else if (lineContent[0].equals("vt")) { + double x = Double.parseDouble(lineContent[1]); + double y = Double.parseDouble(lineContent[2]); + Vertex v = new Vertex(x, y, 0); + vertexTexture.add(v); + v2es.put(v, new HashSet<Edge>()); } else if (lineContent[0].equals("f")) { LinkedList<Edge> edge = new LinkedList<Edge>(); ! int index = 0; ! String[] vert = lineContent[1].split("/"); ! Vertex first = verts.get(Integer.parseInt(vert[index]) - 1); ! Vertex cur = first; ! if (!vertexTexture.isEmpty()) { ! index++; ! } ! if (!vertexNormals.isEmpty()) { ! index++; ! Vertex normal = ! vertexNormals.get(Integer.parseInt(vert[index]) - 1); ! v2normal.put(cur, normal); ! } Vertex prev = first; for (int i = 2; i < lineContent.length; i++) { ! index = 0; ! vert = lineContent[i].split("/"); ! cur = verts.get(Integer.parseInt(vert[index]) - 1); ! if (!vertexTexture.isEmpty()) { ! index++; ! } ! if (!vertexNormals.isEmpty()) { ! index++; ! Vertex normal = ! vertexNormals.get(Integer.parseInt(vert[index]) - 1); ! v2normal.put(cur, normal); ! } Edge e = findEdge(prev, cur, v2es); edge.add(e); *************** *** 110,113 **** --- 164,171 ---- surfaces.add(s); s.setBackDomain(currentGroup); + if (currentMaterial == null) { + currentMaterial = new Material("Object", new float[]{0f, 0.9f, 0f}); + materialMap.put("default", currentMaterial); + } s.setFrontMaterial(currentMaterial); edges.addAll(edge); *************** *** 148,178 **** /** ! * Read a obj material file as ! * Comments begin with a '#' character in column 1. Blank lines may be inserted for clarity. ! * Otherwise, the file consists of a sequence of newmtl statements, followed by a definition ! * of various properties for that material. ! * The quantities that may be defined for a material include: ! * Ka r g b ! * defines the ambient color of the material to be (r,g,b). The default is (0.2,0.2,0.2); ! * Kd r g b ! * defines the diffuse color of the material to be (r,g,b). The default is (0.8,0.8,0.8); ! * Ks r g b ! * defines the specular color of the material to be (r,g,b). This color shows up in ! * highlights. The default is (1.0,1.0,1.0); ! * d alpha ! * defines the transparency of the material to be alpha. ! * The default is 1.0 (not transparent at all) Some formats use Tr instead of d; ! * Tr alpha ! * defines the transparency of the material to be alpha. ! * The default is 1.0 (not transparent at all). Some formats use d instead of Tr; ! * Ns s ! * defines the shininess of the material to be s. The default is 0.0; ! * illum n ! * denotes the illumination model used by the material. ! * illum = 1 indicates a flat material with no specular highlights, so the value of Ks ! * is not used. illum = 2 denotes the presence of specular highlights, and so a specification ! * for Ks is required. ! * map_Ka filename ! * names a file containing a texture map, which should just be an ASCII dump of RGB values; * @param file the material file * @param materialMap A map from name to material --- 206,236 ---- /** ! * Read a obj material file as<br> ! * Comments begin with a '#' character in column 1. Blank lines may be inserted for clarity. <br> ! * Otherwise, the file consists of a sequence of newmtl statements, followed by a definition <br> ! * of various properties for that material.<br> ! * The quantities that may be defined for a material include:<br> ! * Ka r g b<br> ! * defines the ambient color of the material to be (r,g,b). The default is (0.2,0.2,0.2); <br> ! * Kd r g b<br> ! * defines the diffuse color of the material to be (r,g,b). The default is (0.8,0.8,0.8);<br> ! * Ks r g b<br> ! * defines the specular color of the material to be (r,g,b). This color shows up in ! * highlights. The default is (1.0,1.0,1.0); <br> ! * d alpha<br> ! * defines the transparency of the material to be alpha. ! * The default is 1.0 (not transparent at all) Some formats use Tr instead of d; <br> ! * Tr alpha<br> ! * defines the transparency of the material to be alpha. ! * The default is 1.0 (not transparent at all). Some formats use d instead of Tr; <br> ! * Ns s<br> ! * defines the shininess of the material to be s. The default is 0.0; <br> ! * illum n<br> ! * denotes the illumination model used by the material. ! * illum = 1 indicates a flat material with no specular highlights, so the value of Ks ! * is not used. illum = 2 denotes the presence of specular highlights, and so a ! * specification for Ks is required. <br> ! * map_Ka filename<br> ! * names a file containing a texture map, which should just be an ASCII dump of RGB values; * @param file the material file * @param materialMap A map from name to material |
From: rimestad <rim...@us...> - 2007-10-22 10:00:21
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25359/src/net/sourceforge/bprocessor/gui Modified Files: GUI.java Log Message: Added scale and basis for obj import Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** GUI.java 17 Oct 2007 09:08:11 -0000 1.77 --- GUI.java 22 Oct 2007 10:00:17 -0000 1.78 *************** *** 556,559 **** --- 556,586 ---- */ public void alert(String string) { + java.awt.Point where = null; + try { + where = getFocusOwner().getLocationOnScreen(); + } catch (Exception e) { + log.warn(e.getMessage()); + } + if (where == null) { + where = getMousePosition(); + if (where == null) { + where = getInstance().getLocation(); + } else { + where.x += 5; + where.y += 5; + } + } else { + where.y += getFocusOwner().getSize().height; + } + alert(string, where); + } + + /** + * Print a alert message in the gui + * at the moment it just prints it on the command line + * @param string The alert string + * @param where The place to show alert window + */ + public void alert(String string, java.awt.Point where) { if (alertWindow == null) { alertWindow = new JWindow(this); *************** *** 596,617 **** // to Make sure the window size is correct pack have to be called twice alertWindow.pack(); - - java.awt.Point where = null; - try { - where = getFocusOwner().getLocationOnScreen(); - } catch (Exception e) { - log.warn(e.getMessage()); - } - if (where == null) { - where = getMousePosition(); - if (where == null) { - where = getInstance().getLocation(); - } else { - where.x += 5; - where.y += 5; - } - } else { - where.y += getFocusOwner().getSize().height; - } Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); --- 623,626 ---- |
From: Michael L. <he...@us...> - 2007-10-22 09:53:02
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22261/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java Log Message: Replaced ellipsis with ... Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** PopupMenu.java 22 Oct 2007 06:55:05 -0000 1.51 --- PopupMenu.java 22 Oct 2007 09:53:01 -0000 1.52 *************** *** 98,102 **** menu.add(flip); ! AbstractAction action = new GeometricMenuAction(surfaces, "SmoothÉ") { public void actionPerformed(ActionEvent event) { Command command = new Command.Smooth((Surface) entities.iterator().next()); --- 98,102 ---- menu.add(flip); ! AbstractAction action = new GeometricMenuAction(surfaces, "Smooth...") { public void actionPerformed(ActionEvent event) { Command command = new Command.Smooth((Surface) entities.iterator().next()); *************** *** 116,120 **** public static JPopupMenu getEdgeMenu(Collection edges) { JPopupMenu menu = getGeometricMenu(edges); ! AbstractAction action = new GeometricMenuAction(edges, "SplitÉ") { public void actionPerformed(ActionEvent event) { Command command = new Command.Split((Edge) entities.iterator().next()); --- 116,120 ---- public static JPopupMenu getEdgeMenu(Collection edges) { JPopupMenu menu = getGeometricMenu(edges); ! AbstractAction action = new GeometricMenuAction(edges, "Split...") { public void actionPerformed(ActionEvent event) { Command command = new Command.Split((Edge) entities.iterator().next()); *************** *** 521,525 **** menu.add(makeUnion); { ! AbstractAction action = new GeometricMenuAction(arguments, "ScaleÉ") { public void actionPerformed(ActionEvent event) { Set<Vertex> vertices = Geometry.collect(entities); --- 521,525 ---- menu.add(makeUnion); { ! AbstractAction action = new GeometricMenuAction(arguments, "Scale...") { public void actionPerformed(ActionEvent event) { Set<Vertex> vertices = Geometry.collect(entities); *************** *** 539,543 **** public static JPopupMenu getBackgroundMenu() { JPopupMenu menu = new JPopupMenu(); ! AbstractAction action = new AbstractAction("CubeÉ") { public void actionPerformed(ActionEvent event) { Command command = new Command.Cube(); --- 539,543 ---- public static JPopupMenu getBackgroundMenu() { JPopupMenu menu = new JPopupMenu(); ! AbstractAction action = new AbstractAction("Cube...") { public void actionPerformed(ActionEvent event) { Command command = new Command.Cube(); |
From: Michael L. <he...@us...> - 2007-10-22 06:55:19
|
Update of /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17691/src/net/sourceforge/bprocessor/facade/modellor Modified Files: NetFacadeModellor.java Log Message: started scale command Index: NetFacadeModellor.java =================================================================== RCS file: /cvsroot/bprocessor/facade/src/net/sourceforge/bprocessor/facade/modellor/NetFacadeModellor.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** NetFacadeModellor.java 18 Oct 2007 08:46:30 -0000 1.36 --- NetFacadeModellor.java 22 Oct 2007 06:55:15 -0000 1.37 *************** *** 356,360 **** Map env = parameters.environment(); if (env.get("width") == null) { ! parameters.put("width", frameWidth); } } --- 356,360 ---- Map env = parameters.environment(); if (env.get("width") == null) { ! parameters.putDouble("width", frameWidth); } } |
From: Michael L. <he...@us...> - 2007-10-22 06:55:14
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17663/src/net/sourceforge/bprocessor/model Modified Files: Command.java ParameterBlock.java Project.java Log Message: started scale command Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Command.java 20 Oct 2007 17:22:53 -0000 1.7 --- Command.java 22 Oct 2007 06:55:09 -0000 1.8 *************** *** 8,11 **** --- 8,12 ---- package net.sourceforge.bprocessor.model; + import java.util.ArrayList; import java.util.Collection; import java.util.LinkedList; *************** *** 16,20 **** * Command */ ! public class Command extends Entity implements Parametric { /** --- 17,21 ---- * Command */ ! public abstract class Command extends Entity implements Parametric { /** *************** *** 57,62 **** * */ ! public void evaluate() { ! } /** {@inheritDoc} */ --- 58,62 ---- * */ ! public abstract void evaluate(); /** {@inheritDoc} */ *************** *** 71,74 **** --- 71,137 ---- * */ + public static class Smooth extends Command { + + /** + * + * @param surface Surface + */ + public Smooth(Surface surface) { + parameters.put(new Attribute("surface", surface)); + } + + /** + * {@inheritDoc} + */ + public String getGeneralName() { + return "Smooth Surface"; + } + + /** {@inheritDoc} */ + @Override + public void evaluate() { + Surface surface = (Surface) parameters.get("surface"); + Space owner = surface.getOwner(); + List<Edge> edges = surface.getEdges(); + List<Vertex> vertices = surface.getVertices(); + int n = vertices.size(); + Vertex facepoint = surface.center(); + owner.insert(facepoint); + List<Vertex> edgepoints = new ArrayList(n); + List<Edge> sides = new ArrayList(n); + for (Edge current : edges) { + edgepoints.add(current.center()); + } + + for (Vertex current : edgepoints) { + Edge side = new Edge(current, facepoint); + sides.add(side); + owner.insert(current); + } + + for (Edge current : sides) { + owner.insert(current); + } + for (int i = 0; i < n; i++) { + int j = (i + 1) % n; + Vertex v0 = facepoint; + Vertex v1 = edgepoints.get(i); + Vertex v2 = vertices.get(j); + Vertex v3 = edgepoints.get(j); + List<Edge> contour = new LinkedList(); + contour.add(new Edge(v0, v1)); + contour.add(new Edge(v1, v2)); + contour.add(new Edge(v2, v3)); + contour.add(new Edge(v3, v0)); + Surface face = new Surface(contour); + owner.insert(face); + } + } + } + + /** + * + * + */ public static class Split extends Command { /** *************** *** 78,82 **** public Split(Edge edge) { parameters.put(new Attribute("edge", edge)); ! parameters.put("n", 2); } /** --- 141,145 ---- public Split(Edge edge) { parameters.put(new Attribute("edge", edge)); ! parameters.putDouble("n", 2); } /** *************** *** 159,161 **** --- 222,257 ---- } } + + /** + * + * + */ + public static class Scale extends Command { + private Collection<Vertex> vertices; + private Vertex origin; + private Vertex normal; + + /** + * + * @param vertices collecting + * @param origin vertex + * @param normal vertex + */ + public Scale(Collection<Vertex> vertices, Vertex origin, Vertex normal) { + this.vertices = vertices; + this.origin = origin; + this.normal = normal; + parameters.put("vertices", vertices); + parameters.put("origin", origin); + parameters.put("normal", normal); + parameters.put("scale", 1.0); + } + + /** {@inheritDoc} */ + @Override + public void evaluate() { + // TODO Auto-generated method stub + + } + } } Index: ParameterBlock.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ParameterBlock.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ParameterBlock.java 20 Oct 2007 17:22:53 -0000 1.11 --- ParameterBlock.java 22 Oct 2007 06:55:09 -0000 1.12 *************** *** 54,58 **** * @param value double */ ! public void put(String key, double value) { add(new Attribute(key, new Double(value))); } --- 54,58 ---- * @param value double */ ! public void putDouble(String key, double value) { add(new Attribute(key, new Double(value))); } *************** *** 63,67 **** * @param value boolean */ ! public void put(String key, boolean value) { parameters.add(new Attribute(key, value)); } --- 63,67 ---- * @param value boolean */ ! public void putBoolean(String key, boolean value) { parameters.add(new Attribute(key, value)); } *************** *** 92,95 **** --- 92,104 ---- * * @param key String + * @param value Object + */ + public void put(String key, Object value) { + add(new Attribute(key, value)); + } + + /** + * + * @param key String * @return value */ Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.135 retrieving revision 1.136 diff -C2 -d -r1.135 -r1.136 *** Project.java 15 Oct 2007 12:41:24 -0000 1.135 --- Project.java 22 Oct 2007 06:55:09 -0000 1.136 *************** *** 169,177 **** constraints = new LinkedList(); globals = new ParameterBlock(); ! globals.put("pi", Math.PI); ! globals.put("wall", 0.15); ! globals.put("isolation", 0.1); ! globals.put("brick", 0.12); ! globals.put("roof", 0.07); Modellor.registerModellor(new LayerModellor()); Modellor.registerModellor(new TileModellor(null)); --- 169,177 ---- constraints = new LinkedList(); globals = new ParameterBlock(); ! globals.putDouble("pi", Math.PI); ! globals.putDouble("wall", 0.15); ! globals.putDouble("isolation", 0.1); ! globals.putDouble("brick", 0.12); ! globals.putDouble("roof", 0.07); Modellor.registerModellor(new LayerModellor()); Modellor.registerModellor(new TileModellor(null)); |
From: Michael L. <he...@us...> - 2007-10-22 06:55:09
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17287/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java Log Message: started scale command Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** PopupMenu.java 20 Oct 2007 15:20:45 -0000 1.50 --- PopupMenu.java 22 Oct 2007 06:55:05 -0000 1.51 *************** *** 14,17 **** --- 14,19 ---- import java.util.LinkedList; import java.util.Map; + import java.util.Set; + import javax.swing.AbstractAction; import javax.swing.JMenu; *************** *** 67,77 **** /** * Make a popupmenu for a list of surfaces ! * @param c the list of surfaces * @return the popupmenu */ ! public static JPopupMenu getSurfaceMenu(Collection c) { ! JPopupMenu jm = getGeometricMenu(c); ! if (c.size() == 1) { ! Surface s = (Surface)c.iterator().next(); AbstractAction focus = new EntityMenuAction(s, "Focus on") { public void actionPerformed(ActionEvent arg0) { --- 69,79 ---- /** * Make a popupmenu for a list of surfaces ! * @param surfaces the list of surfaces * @return the popupmenu */ ! public static JPopupMenu getSurfaceMenu(Collection surfaces) { ! JPopupMenu menu = getGeometricMenu(surfaces); ! if (surfaces.size() == 1) { ! Surface s = (Surface)surfaces.iterator().next(); AbstractAction focus = new EntityMenuAction(s, "Focus on") { public void actionPerformed(ActionEvent arg0) { *************** *** 80,84 **** } }; ! jm.add(focus); AbstractAction holeanalysis = new EntityMenuAction(s, "Hole analysis") { public void actionPerformed(ActionEvent arg0) { --- 82,86 ---- } }; ! menu.add(focus); AbstractAction holeanalysis = new EntityMenuAction(s, "Hole analysis") { public void actionPerformed(ActionEvent arg0) { *************** *** 87,91 **** } }; ! jm.add(holeanalysis); AbstractAction flip = new EntityMenuAction(s, "Flip") { public void actionPerformed(ActionEvent arg0) { --- 89,93 ---- } }; ! menu.add(holeanalysis); AbstractAction flip = new EntityMenuAction(s, "Flip") { public void actionPerformed(ActionEvent arg0) { *************** *** 94,100 **** } }; ! jm.add(flip); } ! return jm; } --- 96,110 ---- } }; ! menu.add(flip); ! ! AbstractAction action = new GeometricMenuAction(surfaces, "SmoothÉ") { ! public void actionPerformed(ActionEvent event) { ! Command command = new Command.Smooth((Surface) entities.iterator().next()); ! AttributeView.instance().display(command); ! } ! }; ! menu.add(action); } ! return menu; } *************** *** 510,513 **** --- 520,533 ---- }; menu.add(makeUnion); + { + AbstractAction action = new GeometricMenuAction(arguments, "ScaleÉ") { + public void actionPerformed(ActionEvent event) { + Set<Vertex> vertices = Geometry.collect(entities); + Command command = new Command.Scale(vertices, new Vertex(0, 0, 0), new Vertex(0, 0, 1)); + AttributeView.instance().display(command); + } + }; + menu.add(action); + } return menu; } |
From: Michael L. <he...@us...> - 2007-10-22 06:55:08
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17287/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java Log Message: started scale command Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.115 retrieving revision 1.116 diff -C2 -d -r1.115 -r1.116 *** GenericTreeView.java 2 Oct 2007 06:42:14 -0000 1.115 --- GenericTreeView.java 22 Oct 2007 06:55:01 -0000 1.116 *************** *** 1194,1198 **** public void actionPerformed(ActionEvent arg0) { ParameterBlock pb = Project.getInstance().getGlobals(); ! pb.put("new global", 0); AttributeView.instance().display(pb.getAttributes().get(pb.getAttributes().size() - 1)); Project.getInstance().changed(pb); --- 1194,1198 ---- public void actionPerformed(ActionEvent arg0) { ParameterBlock pb = Project.getInstance().getGlobals(); ! pb.putDouble("new global", 0); AttributeView.instance().display(pb.getAttributes().get(pb.getAttributes().size() - 1)); Project.getInstance().changed(pb); |
From: Michael L. <he...@us...> - 2007-10-20 17:22:50
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6024/src/net/sourceforge/bprocessor/model Modified Files: Command.java ParameterBlock.java Log Message: Edge Split implemented AttributeView displays double values as their actual value Ð some kind of length value should be implemented to contain unit like mm. Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Command.java 20 Oct 2007 15:20:49 -0000 1.6 --- Command.java 20 Oct 2007 17:22:53 -0000 1.7 *************** *** 86,89 **** --- 86,110 ---- return "Split Edge"; } + + /** + * {@inheritDoc} + */ + public void evaluate() { + Edge edge = (Edge) parameters.get("edge"); + int n = (int) (parameters.getDouble("n")); + Vertex from = edge.from; + Vertex to = edge.to; + Vertex v = to.minus(from); + double length = v.length(); + double delta = length / n; + v.scale(delta / length); + Vertex current = from; + Space space = edge.getOwner(); + for (int i = 1; i < n; i++) { + current = current.add(v); + space.insert(current); + } + Project.getInstance().changed(Project.getInstance()); + } } Index: ParameterBlock.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ParameterBlock.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ParameterBlock.java 19 Oct 2007 12:11:34 -0000 1.10 --- ParameterBlock.java 20 Oct 2007 17:22:53 -0000 1.11 *************** *** 91,94 **** --- 91,108 ---- /** * + * @param key String + * @return value + */ + public Object get(String key) { + for (Attribute current : parameters) { + if (current.getName().equals(key)) { + return current.getValue(); + } + } + return null; + } + + /** + * * @param attribute Attribute */ |
From: Michael L. <he...@us...> - 2007-10-20 17:22:47
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv6011/src/net/sourceforge/bprocessor/gui/attrview Modified Files: StringAttribute.java Log Message: Edge Split implemented AttributeView displays double values as their actual value Ð some kind of length value should be implemented to contain unit like mm. Index: StringAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/StringAttribute.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** StringAttribute.java 12 Oct 2007 08:05:06 -0000 1.17 --- StringAttribute.java 20 Oct 2007 17:22:49 -0000 1.18 *************** *** 111,115 **** protected double round(double value) { long i = (long) (value * 1000000); ! return ((double) i) / 1000.0; } --- 111,115 ---- protected double round(double value) { long i = (long) (value * 1000000); ! return i / 1000000.0; } *************** *** 280,284 **** Object o = stack.pop(); if (o instanceof Double) { ! attribute.setValue((Double)o / 1000); } else { attribute.setValue(0); --- 280,284 ---- Object o = stack.pop(); if (o instanceof Double) { ! attribute.setValue(o); } else { attribute.setValue(0); |
From: Michael L. <he...@us...> - 2007-10-20 15:20:53
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23336/src/net/sourceforge/bprocessor/model Modified Files: Command.java Log Message: edge menu added Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Command.java 19 Oct 2007 12:11:34 -0000 1.5 --- Command.java 20 Oct 2007 15:20:49 -0000 1.6 *************** *** 23,29 **** public Command() { parameters = new ParameterBlock(); - parameters.add(new Attribute("width", 1.0)); - parameters.add(new Attribute("height", 1.0)); - parameters.add(new Attribute("depth", 1.0)); } --- 23,26 ---- *************** *** 42,46 **** /** {@inheritDoc} */ public String getGeneralName() { ! return "Create Cube"; } --- 39,43 ---- /** {@inheritDoc} */ public String getGeneralName() { ! return "Command"; } *************** *** 49,53 **** } ! private List list(Object ...objects) { List result = new LinkedList(); for (Object object : objects) { --- 46,50 ---- } ! protected List list(Object ...objects) { List result = new LinkedList(); for (Object object : objects) { *************** *** 61,90 **** */ public void evaluate() { - double w = parameters.getDouble("width"); - double h = parameters.getDouble("height"); - double d = parameters.getDouble("depth"); - double x = -w / 2; - double y = -h / 2; - double z = -d / 2; - Vertex v0 = new Vertex(x, y, z); - Vertex v1 = new Vertex(x + w, y, z); - Vertex v2 = new Vertex(x + w, y + h, z); - Vertex v3 = new Vertex(x, y + h, z); - - Edge e0 = new Edge(v0, v1); - Edge e1 = new Edge(v1, v2); - Edge e2 = new Edge(v2, v3); - Edge e3 = new Edge(v3, v0); - - Surface s0 = new Surface(list(e0, e1, e2, e3)); - Collection<Surface> sides = new LinkedList(); - Surface top = s0.extrusion(d, sides); - Space world = Project.getInstance().world(); - world.insert(s0); - for (Surface current : sides) { - world.insert(current); - } - world.insert(top); - Project.getInstance().changed(world); } --- 58,61 ---- *************** *** 95,97 **** --- 66,140 ---- } + + /** + * + * + */ + public static class Split extends Command { + /** + * Edge to split + * @param edge Edge to split + */ + public Split(Edge edge) { + parameters.put(new Attribute("edge", edge)); + parameters.put("n", 2); + } + /** + * {@inheritDoc} + */ + public String getGeneralName() { + return "Split Edge"; + } + } + + /** + * + * + */ + public static class Cube extends Command { + /** + * + */ + public Cube() { + parameters.add(new Attribute("width", 1.0)); + parameters.add(new Attribute("height", 1.0)); + parameters.add(new Attribute("depth", 1.0)); + } + /** {@inheritDoc} */ + public String getGeneralName() { + return "Create Cube"; + } + /** + * {@inheritDoc} + */ + @Override + public void evaluate() { + double w = parameters.getDouble("width"); + double h = parameters.getDouble("height"); + double d = parameters.getDouble("depth"); + double x = -w / 2; + double y = -h / 2; + double z = -d / 2; + Vertex v0 = new Vertex(x, y, z); + Vertex v1 = new Vertex(x + w, y, z); + Vertex v2 = new Vertex(x + w, y + h, z); + Vertex v3 = new Vertex(x, y + h, z); + + Edge e0 = new Edge(v0, v1); + Edge e1 = new Edge(v1, v2); + Edge e2 = new Edge(v2, v3); + Edge e3 = new Edge(v3, v0); + + Surface s0 = new Surface(list(e0, e1, e2, e3)); + Collection<Surface> sides = new LinkedList(); + Surface top = s0.extrusion(d, sides); + Space world = Project.getInstance().world(); + world.insert(s0); + for (Surface current : sides) { + world.insert(current); + } + world.insert(top); + Project.getInstance().changed(world); + } + } } |
From: Michael L. <he...@us...> - 2007-10-20 15:20:51
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23328/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java Log Message: edge menu added Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** PopupMenu.java 19 Oct 2007 13:06:25 -0000 1.49 --- PopupMenu.java 20 Oct 2007 15:20:45 -0000 1.50 *************** *** 29,32 **** --- 29,33 ---- import net.sourceforge.bprocessor.model.Command; import net.sourceforge.bprocessor.model.CoordinateSystem; + import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Entity; import net.sourceforge.bprocessor.model.Geometric; *************** *** 98,101 **** --- 99,118 ---- } + /** + * + * @param edges Collection of edges + * @return Menu for edges + */ + public static JPopupMenu getEdgeMenu(Collection edges) { + JPopupMenu menu = getGeometricMenu(edges); + AbstractAction action = new GeometricMenuAction(edges, "SplitÉ") { + public void actionPerformed(ActionEvent event) { + Command command = new Command.Split((Edge) entities.iterator().next()); + AttributeView.instance().display(command); + } + }; + menu.add(action); + return menu; + } /** *************** *** 502,508 **** public static JPopupMenu getBackgroundMenu() { JPopupMenu menu = new JPopupMenu(); ! AbstractAction action = new AbstractAction("Cube") { public void actionPerformed(ActionEvent event) { ! Command command = new Command(); AttributeView.instance().display(command); } --- 519,525 ---- public static JPopupMenu getBackgroundMenu() { JPopupMenu menu = new JPopupMenu(); ! AbstractAction action = new AbstractAction("CubeÉ") { public void actionPerformed(ActionEvent event) { ! Command command = new Command.Cube(); AttributeView.instance().display(command); } *************** *** 534,537 **** --- 551,556 ---- } else if (type instanceof Surface) { return PopupMenu.getSurfaceMenu(new LinkedList<Geometric>(Selection.primary())); + } else if (type instanceof Edge) { + return getEdgeMenu(new LinkedList<Geometric>(Selection.primary())); } else { return PopupMenu.getGeometricMenu(new LinkedList<Geometric>(Selection.primary())); |
From: Michael L. <he...@us...> - 2007-10-19 13:06:24
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22591/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java Log Message: removed some code Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** PopupMenu.java 19 Oct 2007 11:24:42 -0000 1.48 --- PopupMenu.java 19 Oct 2007 13:06:25 -0000 1.49 *************** *** 14,22 **** import java.util.LinkedList; import java.util.Map; - import java.util.Set; - import javax.swing.AbstractAction; import javax.swing.JMenu; - import javax.swing.JMenuItem; import javax.swing.JPopupMenu; --- 14,19 ---- *************** *** 45,49 **** import net.sourceforge.bprocessor.model.Translate; import net.sourceforge.bprocessor.model.Vertex; - import net.sourceforge.bprocessor.model.constraints.OffsetConstraint; import net.sourceforge.bprocessor.model.modellor.Modellor; --- 42,45 ---- *************** *** 98,139 **** }; jm.add(flip); - } - if (c.size() == 2) { - JMenuItem offsetItem = new JMenuItem("Offset Constraint"); - offsetItem.addActionListener(new CollectionMenuAction(c, "Offset") { - public void actionPerformed(ActionEvent event) { - OffsetConstraint.addOffsetConstraint(col); - Project p = Project.getInstance(); - p.changed(p); - p.checkpoint(); - } - } - ); - jm.add(offsetItem); - AbstractAction relate = new CollectionMenuAction(c, "Relate") { - public void actionPerformed(ActionEvent e) { - CoordinateSystem.relate(col); - } - }; - jm.add(relate); - } - - JMenuItem mergeItem = new JMenuItem("Merge Surfaces"); - mergeItem.addActionListener(new CollectionMenuAction(c, "Merge Surfaces") { - public void actionPerformed(ActionEvent event) { - Set<Surface> surfaces = new HashSet<Surface>(); - Iterator it = col.iterator(); - while (it.hasNext()) { - Object o = it.next(); - if (o instanceof Surface) { - surfaces.add((Surface)o); - } - } - Geometry.mergeAllPossibleSurfaces(surfaces); - } } - ); - jm.add(mergeItem); - return jm; } --- 94,98 ---- |
From: Michael L. <he...@us...> - 2007-10-19 12:17:20
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2512/src/net/sourceforge/bprocessor/gl/view Modified Files: Display.java Log Message: Colors of x-axis and y-axis back to normal Index: Display.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/Display.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Display.java 17 Oct 2007 11:08:56 -0000 1.37 --- Display.java 19 Oct 2007 12:17:22 -0000 1.38 *************** *** 554,559 **** Line zaxis = new Line(origin, n); zaxis.setEditable(system.isEditable()); ! paint(xaxis, red); ! paint(yaxis, green); paint(zaxis, blue); } --- 554,559 ---- Line zaxis = new Line(origin, n); zaxis.setEditable(system.isEditable()); ! paint(xaxis, green); ! paint(yaxis, red); paint(zaxis, blue); } |
From: Michael L. <he...@us...> - 2007-10-19 12:11:32
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv32514/src/net/sourceforge/bprocessor/model Modified Files: Command.java ParameterBlock.java Entity.java Log Message: cube command with parameters Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Command.java 19 Oct 2007 08:28:36 -0000 1.4 --- Command.java 19 Oct 2007 12:11:34 -0000 1.5 *************** *** 16,21 **** * Command */ ! public class Command implements Parametric { /** {@inheritDoc} */ public List<Attribute> getAttributes() { --- 16,31 ---- * Command */ ! public class Command extends Entity implements Parametric { + /** + * + */ + public Command() { + parameters = new ParameterBlock(); + parameters.add(new Attribute("width", 1.0)); + parameters.add(new Attribute("height", 1.0)); + parameters.add(new Attribute("depth", 1.0)); + } + /** {@inheritDoc} */ public List<Attribute> getAttributes() { *************** *** 51,57 **** */ public void evaluate() { ! double w = 1; ! double h = 1; ! double d = 1; double x = -w / 2; double y = -h / 2; --- 61,67 ---- */ public void evaluate() { ! double w = parameters.getDouble("width"); ! double h = parameters.getDouble("height"); ! double d = parameters.getDouble("depth"); double x = -w / 2; double y = -h / 2; *************** *** 78,80 **** --- 88,97 ---- Project.getInstance().changed(world); } + + /** {@inheritDoc} */ + @Override + public void delete() { + // TODO Auto-generated method stub + + } } Index: ParameterBlock.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/ParameterBlock.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ParameterBlock.java 24 May 2007 10:49:34 -0000 1.9 --- ParameterBlock.java 19 Oct 2007 12:11:34 -0000 1.10 *************** *** 76,79 **** --- 76,93 ---- /** + * Returns the double value associated with key + * @param key String + * @return double value + */ + public double getDouble(String key) { + for (Attribute current : parameters) { + if (current.getName().equals(key)) { + return ((Double)(current.getValue())).doubleValue(); + } + } + return 0.0; + } + + /** * * @param attribute Attribute Index: Entity.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Entity.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Entity.java 18 Oct 2007 08:46:37 -0000 1.21 --- Entity.java 19 Oct 2007 12:11:34 -0000 1.22 *************** *** 26,30 **** /** Parameterblock for extra parameters */ ! private ParameterBlock parameters; /** --- 26,30 ---- /** Parameterblock for extra parameters */ ! protected ParameterBlock parameters; /** |
From: Michael L. <he...@us...> - 2007-10-19 12:11:28
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv32500/src/net/sourceforge/bprocessor/gui/attrview Modified Files: GenericPanel.java Log Message: cube command with parameters Index: GenericPanel.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/GenericPanel.java,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** GenericPanel.java 19 Oct 2007 08:28:33 -0000 1.45 --- GenericPanel.java 19 Oct 2007 12:11:30 -0000 1.46 *************** *** 88,92 **** private void generateContentFor(Parametric parametric) { attributes = parametric.getAttributes(); - generateContent(attributes, content); if (parametric instanceof Entity) { Entity entity = (Entity) parametric; --- 88,91 ---- *************** *** 95,98 **** --- 94,98 ---- } } + generateContent(attributes, content); } |
From: Michael L. <he...@us...> - 2007-10-19 11:24:47
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12786/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java Log Message: Delete Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** PopupMenu.java 19 Oct 2007 10:55:24 -0000 1.47 --- PopupMenu.java 19 Oct 2007 11:24:42 -0000 1.48 *************** *** 23,27 **** import net.sourceforge.bprocessor.gui.actions.AttributeMenuAction; import net.sourceforge.bprocessor.gui.actions.CollectionMenuAction; ! import net.sourceforge.bprocessor.gui.actions.EntitiesMenuAction; import net.sourceforge.bprocessor.gui.actions.EntityMenuAction; import net.sourceforge.bprocessor.gui.actions.ModellorMenuAction; --- 23,27 ---- import net.sourceforge.bprocessor.gui.actions.AttributeMenuAction; import net.sourceforge.bprocessor.gui.actions.CollectionMenuAction; ! import net.sourceforge.bprocessor.gui.actions.GeometricMenuAction; import net.sourceforge.bprocessor.gui.actions.EntityMenuAction; import net.sourceforge.bprocessor.gui.actions.ModellorMenuAction; *************** *** 74,78 **** */ public static JPopupMenu getSurfaceMenu(Collection c) { ! JPopupMenu jm = getEntiesMenu(c); if (c.size() == 1) { Surface s = (Surface)c.iterator().next(); --- 74,78 ---- */ public static JPopupMenu getSurfaceMenu(Collection c) { ! JPopupMenu jm = getGeometricMenu(c); if (c.size() == 1) { Surface s = (Surface)c.iterator().next(); *************** *** 238,242 **** */ public static JPopupMenu getSpaceMenu(Collection s) { ! JPopupMenu pm = PopupMenu.getEntiesMenu(s); pm.addSeparator(); --- 238,242 ---- */ public static JPopupMenu getSpaceMenu(Collection s) { ! JPopupMenu pm = PopupMenu.getGeometricMenu(s); pm.addSeparator(); *************** *** 367,371 **** Collection c = new LinkedList(); c.add(e); ! return getEntiesMenu(c); } --- 367,371 ---- Collection c = new LinkedList(); c.add(e); ! return getGeometricMenu(c); } *************** *** 391,418 **** /** * A popupmenu generator for entities ! * @param entities the entity list to make popup for * @return the popupmenu */ ! public static JPopupMenu getEntiesMenu(Collection<Geometric> entities) { JPopupMenu menu = new JPopupMenu(); ! AbstractAction delete = new EntitiesMenuAction(entities, "Delete Entities") { public void actionPerformed(ActionEvent arg0) { ! if (entities != null) { ! Selection.primary().clear(); ! for (Entity current : entities) { ! if (current instanceof Geometric) { ! ((Geometric)current).erase(); ! } else { ! current.delete(); ! } ! Project.getInstance().changed(current); ! } ! Project.getInstance().changed(Geometry.collect(entities)); ! Project.getInstance().checkpoint(); } } }; menu.add(delete); ! AbstractAction allConnected = new EntitiesMenuAction(entities, "All Connected") { public void actionPerformed(ActionEvent arg0) { Collection<Geometric> geometrics = --- 391,413 ---- /** * A popupmenu generator for entities ! * @param arguments the entity list to make popup for * @return the popupmenu */ ! public static JPopupMenu getGeometricMenu(Collection<Geometric> arguments) { JPopupMenu menu = new JPopupMenu(); ! AbstractAction delete = new GeometricMenuAction(arguments, "Delete") { public void actionPerformed(ActionEvent arg0) { ! Selection.primary().clear(); ! for (Geometric current : entities) { ! current.erase(); ! Project.getInstance().changed(current); } + Project.getInstance().changed(Geometry.collect(entities)); + Project.getInstance().checkpoint(); + } }; menu.add(delete); ! AbstractAction allConnected = new GeometricMenuAction(arguments, "All Connected") { public void actionPerformed(ActionEvent arg0) { Collection<Geometric> geometrics = *************** *** 423,427 **** menu.add(allConnected); ! AbstractAction simplify = new EntitiesMenuAction(entities, "Simplify Geometry") { public void actionPerformed(ActionEvent arg0) { Geometry.simplifyGeometry(entities); --- 418,422 ---- menu.add(allConnected); ! AbstractAction simplify = new GeometricMenuAction(arguments, "Simplify Geometry") { public void actionPerformed(ActionEvent arg0) { Geometry.simplifyGeometry(entities); *************** *** 430,434 **** menu.add(simplify); ! AbstractAction makeUnion = new EntitiesMenuAction(entities, "Make Union") { public void actionPerformed(ActionEvent e) { Collection<Surface> surfaces = new HashSet<Surface>(); --- 425,429 ---- menu.add(simplify); ! AbstractAction makeUnion = new GeometricMenuAction(arguments, "Make Union") { public void actionPerformed(ActionEvent e) { Collection<Surface> surfaces = new HashSet<Surface>(); *************** *** 573,577 **** type = next; } else if (!next.getClass().isInstance(type)) { ! return PopupMenu.getEntiesMenu(new LinkedList<Geometric>(Selection.primary())); } } --- 568,572 ---- type = next; } else if (!next.getClass().isInstance(type)) { ! return PopupMenu.getGeometricMenu(new LinkedList<Geometric>(Selection.primary())); } } *************** *** 581,585 **** return PopupMenu.getSurfaceMenu(new LinkedList<Geometric>(Selection.primary())); } else { ! return PopupMenu.getEntiesMenu(new LinkedList<Geometric>(Selection.primary())); } } --- 576,580 ---- return PopupMenu.getSurfaceMenu(new LinkedList<Geometric>(Selection.primary())); } else { ! return PopupMenu.getGeometricMenu(new LinkedList<Geometric>(Selection.primary())); } } |
From: Michael L. <he...@us...> - 2007-10-19 11:24:47
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv12786/src/net/sourceforge/bprocessor/gui/actions Added Files: GeometricMenuAction.java Removed Files: EntitiesMenuAction.java Log Message: Delete --- NEW FILE: GeometricMenuAction.java --- //--------------------------------------------------------------------------------- // $Id: GeometricMenuAction.java,v 1.1 2007/10/19 11:24:43 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.gui.actions; import java.util.Collection; import javax.swing.AbstractAction; import net.sourceforge.bprocessor.model.Geometric; /** * Actions for a entity */ public abstract class GeometricMenuAction extends AbstractAction { /** Collection of geometrics */ protected Collection<? extends Geometric> entities; /** * The constructor * @param geometrics the entity * @param name the name of the action */ public GeometricMenuAction(Collection<? extends Geometric> geometrics, String name) { super(name); this.entities = geometrics; } } --- EntitiesMenuAction.java DELETED --- |
From: Michael L. <he...@us...> - 2007-10-19 11:01:23
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3485/src/net/sourceforge/bprocessor/gl/tool Modified Files: Pencil.java Log Message: Pencil can set one vertex (and also split an edge) Index: Pencil.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Pencil.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Pencil.java 31 Aug 2007 12:47:48 -0000 1.18 --- Pencil.java 19 Oct 2007 11:01:15 -0000 1.19 *************** *** 81,84 **** --- 81,87 ---- } else { if (start.vertex().equalEps(current.vertex())) { + Project.getInstance().getActiveSpace().insert(current.vertex()); + Project.getInstance().changed(Project.getInstance().getActiveSpace()); + Project.getInstance().checkpoint(); cleanUp(); return; |
From: Michael L. <he...@us...> - 2007-10-19 10:55:27
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv907/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java Log Message: removed unused penciltool Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** PopupMenu.java 19 Oct 2007 08:28:33 -0000 1.46 --- PopupMenu.java 19 Oct 2007 10:55:24 -0000 1.47 *************** *** 41,44 **** --- 41,45 ---- import net.sourceforge.bprocessor.model.Space; import net.sourceforge.bprocessor.model.Surface; + import net.sourceforge.bprocessor.model.SurfaceAnalysis; import net.sourceforge.bprocessor.model.Transform; import net.sourceforge.bprocessor.model.Translate; *************** *** 584,586 **** --- 585,643 ---- } } + + /** + * + * @return JPopupMenu + */ + public JPopupMenu getAnalysisMenu() { + JPopupMenu menu = new JPopupMenu(); + AbstractAction planeanalysis = new AbstractAction("Plane Analysis") { + public void actionPerformed(ActionEvent arg0) { + Space space = Project.getInstance().getActiveSpace(); + SurfaceAnalysis analysis = new SurfaceAnalysis(); + analysis.clearPlanes(space); + Collection planes = analysis.planeAnalysis(space); + Iterator iter = planes.iterator(); + while (iter.hasNext()) { + CoordinateSystem current = (CoordinateSystem) iter.next(); + space.insert(current); + } + Project.getInstance().changed(space); + Project.getInstance().checkpoint(); + } + }; + menu.add(planeanalysis); + AbstractAction clearplanes = new AbstractAction("Delete Planes") { + public void actionPerformed(ActionEvent arg0) { + Space space = Project.getInstance().getActiveSpace(); + SurfaceAnalysis analysis = new SurfaceAnalysis(); + analysis.clearPlanes(space); + Project.getInstance().changed(space); + Project.getInstance().checkpoint(); + } + }; + menu.add(clearplanes); + AbstractAction surfaceanalysis = new AbstractAction("Surface Analysis") { + public void actionPerformed(ActionEvent arg0) { + Space space = Project.getInstance().getActiveSpace(); + SurfaceAnalysis analysis = new SurfaceAnalysis(); + analysis.surfaceAnalysis(space); + Project.getInstance().changed(space); + Project.getInstance().checkpoint(); + } + }; + menu.add(surfaceanalysis); + AbstractAction clearsurfaces = new AbstractAction("Delete Surfaces") { + public void actionPerformed(ActionEvent arg0) { + Space space = Project.getInstance().getActiveSpace(); + SurfaceAnalysis analysis = new SurfaceAnalysis(); + analysis.clearSurfaces(space); + Project.getInstance().changed(space); + Project.getInstance().checkpoint(); + } + }; + menu.add(clearsurfaces); + return menu; + } + } |
From: Michael L. <he...@us...> - 2007-10-19 10:55:18
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv891/src/net/sourceforge/bprocessor/gl/tool Modified Files: ToolFactory.java Removed Files: PencilTool.java Log Message: removed unused penciltool Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** ToolFactory.java 12 Oct 2007 11:06:53 -0000 1.87 --- ToolFactory.java 19 Oct 2007 10:55:19 -0000 1.88 *************** *** 71,77 **** private Pencil pencil; - /** extra pencil tool */ - private PencilTool penciltool; - /** eraser tool */ private EraserTool eraser; --- 71,74 ---- *************** *** 182,190 **** select = new SpaceTool(glv, null); pencil = new Pencil(glv, pencilcursor); - penciltool = new PencilTool(glv, pencilcursor); eraser = new EraserTool(glv, pencilcursor); arc = new ArcTool(glv, pencilcursor); - // alternate = new VectorMoveTool(glv, pencilcursor); - // controlled = new ControlledMoveTool(glv, pencilcursor); rotation = new RotationTool(glv, null); extrude = new ExtrusionTool(glv, pencilcursor); --- 179,184 ---- *************** *** 194,206 **** relation = new RelationTool(glv, arrowAddCursor); camera = new CameraTool(glv, rotationCursor); - /*fly = new CameraFlyTool(glv, flyCursor); - walk = new CameraWalkTool(glv, walkCursor);*/ constructor = new ConstructorTool(glv, pencilcursor); offset = new OffsetTool(glv, pencilcursor); altRect = new RectTool(glv, pencilcursor); focusTool = new FocusTool(glv, null); - // altMoveTool = new AltMoveTool(glv, pencilcursor); finalMoveTool = new FinalMoveTool(glv, pencilcursor); - // edgeMoveTool = new EdgeMoveTool(glv, pencilcursor); panTool = new PanTool(glv, panCursor); zoomTool = new ZoomTool(glv, zoomCursor); --- 188,196 ---- *************** *** 213,217 **** this.registerTool(Tool.PENCIL_TOOL, pencil, "Biconpentool.gif", "Pencil"); pencilBut.setMnemonic(KeyEvent.VK_W); - //this.registerTool(Tool.ALT_PENCIL_TOOL, penciltool, "Biconpentool2.gif", "Pencil"); JToggleButton rect = this.registerTool(Tool.ALT_RECT_TOOL, altRect, "Biconaltrect.gif", "Rectangle"); --- 203,206 ---- --- PencilTool.java DELETED --- |
From: Michael L. <he...@us...> - 2007-10-19 10:48:58
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30461/src/net/sourceforge/bprocessor/gl/tool Modified Files: SpaceTool.java Log Message: Fixet popup menu logic Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** SpaceTool.java 17 Oct 2007 09:08:19 -0000 1.87 --- SpaceTool.java 19 Oct 2007 10:48:58 -0000 1.88 *************** *** 28,32 **** import net.sourceforge.bprocessor.gui.actions.SpaceMenuAction; import net.sourceforge.bprocessor.model.Edge; - import net.sourceforge.bprocessor.model.Entity; import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Mesh; --- 28,31 ---- *************** *** 64,75 **** glv.setLengthValue(""); typing = false; - findTarget(e); boolean done = false; ! if (e.getButton() == MouseEvent.BUTTON3 || ! e.isPopupTrigger()) { ! glv.popup(makeSelectionMenu(), e.getX(), e.getY()); done = true; ! } if (e.getButton() == MouseEvent.BUTTON1) { --- 63,88 ---- glv.setLengthValue(""); typing = false; boolean done = false; ! if (e.getButton() == MouseEvent.BUTTON3 || e.isPopupTrigger()) { ! Selection selection = Selection.primary(); ! JPopupMenu menu = null; ! ! if (target == null) { ! selection.clear(); ! menu = PopupMenu.getBackgroundMenu(); ! } else { ! if (target instanceof Geometric) { ! if (!selection.contains(target)) { ! selection.set((Geometric) target); ! } ! menu = PopupMenu.makeSelectionMenu(); ! } ! } ! if (menu != null) { ! glv.popup(menu, e.getX(), e.getY()); ! } done = true; ! } if (e.getButton() == MouseEvent.BUTTON1) { *************** *** 93,120 **** } - /** - * Create a popup for performing operations on selection - * @return The popup menu - */ - protected JPopupMenu makeSelectionMenu() { - if (Selection.primary().isEmpty()) { - if (target instanceof Space) { - return PopupMenu.getSpaceMenu((Space)target); - } else if (target instanceof Surface) { - return PopupMenu.getSurfaceMenu((Surface) target); - } else if (target instanceof Entity) { - return PopupMenu.getEntityMenu((Entity) target); - } else { - return PopupMenu.getBackgroundMenu(); - } - } else { - if (Selection.primary().contains(target)) { - return PopupMenu.makeSelectionMenu(); - } else { - return PopupMenu.getBackgroundMenu(); - } - } - } - /** * Creates the correct type popup menu. --- 106,109 ---- |
From: Michael L. <he...@us...> - 2007-10-19 08:28:40
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5482/src/net/sourceforge/bprocessor/model Modified Files: Operation.java Command.java Log Message: cube command Index: Operation.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Operation.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Operation.java 18 Oct 2007 11:54:40 -0000 1.1 --- Operation.java 19 Oct 2007 08:28:36 -0000 1.2 *************** *** 11,21 **** * */ ! public class Operation { /** ! * Retruns the name of this Operation ! * @return the name of this Operation */ ! public String name() { ! return "!"; ! } } --- 11,18 ---- * */ ! public abstract class Operation { /** ! * */ ! public abstract void perform(); } Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Command.java 18 Oct 2007 11:54:40 -0000 1.3 --- Command.java 19 Oct 2007 08:28:36 -0000 1.4 *************** *** 8,11 **** --- 8,12 ---- package net.sourceforge.bprocessor.model; + import java.util.Collection; import java.util.LinkedList; import java.util.List; *************** *** 20,23 **** --- 21,30 ---- public List<Attribute> getAttributes() { List<Attribute> attributes = new LinkedList(); + attributes.add(new Attribute("!", new Operation() { + @Override + public void perform() { + evaluate(); + } + })); return attributes; } *************** *** 25,29 **** /** {@inheritDoc} */ public String getGeneralName() { ! return "Command"; } --- 32,36 ---- /** {@inheritDoc} */ public String getGeneralName() { ! return "Create Cube"; } *************** *** 31,33 **** --- 38,80 ---- public void setAttributes(List<Attribute> attributes) { } + + private List list(Object ...objects) { + List result = new LinkedList(); + for (Object object : objects) { + result.add(object); + } + return result; + } + + /** + * + */ + public void evaluate() { + double w = 1; + double h = 1; + double d = 1; + double x = -w / 2; + double y = -h / 2; + double z = -d / 2; + Vertex v0 = new Vertex(x, y, z); + Vertex v1 = new Vertex(x + w, y, z); + Vertex v2 = new Vertex(x + w, y + h, z); + Vertex v3 = new Vertex(x, y + h, z); + + Edge e0 = new Edge(v0, v1); + Edge e1 = new Edge(v1, v2); + Edge e2 = new Edge(v2, v3); + Edge e3 = new Edge(v3, v0); + + Surface s0 = new Surface(list(e0, e1, e2, e3)); + Collection<Surface> sides = new LinkedList(); + Surface top = s0.extrusion(d, sides); + Space world = Project.getInstance().world(); + world.insert(s0); + for (Surface current : sides) { + world.insert(current); + } + world.insert(top); + Project.getInstance().changed(world); + } } |
From: Michael L. <he...@us...> - 2007-10-19 08:28:38
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5465/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java Log Message: cube command Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** PopupMenu.java 18 Oct 2007 11:54:36 -0000 1.45 --- PopupMenu.java 19 Oct 2007 08:28:33 -0000 1.46 *************** *** 547,553 **** public static JPopupMenu getBackgroundMenu() { JPopupMenu menu = new JPopupMenu(); ! AbstractAction action = new AbstractAction("Command") { public void actionPerformed(ActionEvent event) { - System.out.println("-- action --"); Command command = new Command(); AttributeView.instance().display(command); --- 547,552 ---- public static JPopupMenu getBackgroundMenu() { JPopupMenu menu = new JPopupMenu(); ! AbstractAction action = new AbstractAction("Cube") { public void actionPerformed(ActionEvent event) { Command command = new Command(); AttributeView.instance().display(command); |
From: Michael L. <he...@us...> - 2007-10-19 08:28:38
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5465/src/net/sourceforge/bprocessor/gui/attrview Modified Files: GenericPanel.java Added Files: OperationAttribute.java Log Message: cube command --- NEW FILE: OperationAttribute.java --- //--------------------------------------------------------------------------------- // $Id: OperationAttribute.java,v 1.1 2007/10/19 08:28: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.gui.attrview; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JComponent; import net.sourceforge.bprocessor.model.Attribute; import net.sourceforge.bprocessor.model.Operation; /** * The BooleanAttributeView */ public class OperationAttribute extends GenericAttribute implements ActionListener { /** * Default serial version UID */ private static final long serialVersionUID = 1L; /** The listeners */ private List listeners; /** The attribute this gui represents */ private Attribute attribute; /** The component */ private JComponent component; /** The valueLabel */ private JButton button; /** * Constructor for BooleanAttribute * @param attribute The attribute */ public OperationAttribute(Attribute attribute) { super(BoxLayout.X_AXIS); this.attribute = attribute; this.listeners = new LinkedList(); Box header = Box.createHorizontalBox(); Box column = Box.createVerticalBox(); header.add(Box.createHorizontalStrut(7)); 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(createButton(attribute.getName())); this.add(component); } /** * Add a listener that are notified when the value is changed * @param listener The listener */ public void addBooleanAttributeListener(AttributeListener listener) { listeners.add(listener); } /** * Remove a listener * @param listener The listener */ public void removeBooleanAttributeListener(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 createButton(String name) { button = new JButton(); button.setText(name); button.addActionListener(this); return button; } /** * Return the attribute * @return The attribute */ public Attribute attribute() { return attribute; } /** * {@inheritDoc} */ public void startEditing() { } /** * {@inheritDoc} */ public void stopEditing() { } /** * {@inheritDoc} */ public void cancelEditing() { } /** {@inheritDoc} */ public void actionPerformed(ActionEvent event) { Operation operation = (Operation) attribute.getValue(); operation.perform(); } } Index: GenericPanel.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/GenericPanel.java,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** GenericPanel.java 18 Oct 2007 13:47:43 -0000 1.44 --- GenericPanel.java 19 Oct 2007 08:28:33 -0000 1.45 *************** *** 30,33 **** --- 30,34 ---- import net.sourceforge.bprocessor.model.Entity; import net.sourceforge.bprocessor.model.Material; + import net.sourceforge.bprocessor.model.Operation; import net.sourceforge.bprocessor.model.Parametric; import net.sourceforge.bprocessor.model.Project; *************** *** 235,238 **** --- 236,245 ---- } + private void handleOperation(Attribute attribute, JComponent where) { + GenericAttribute generic = new OperationAttribute(attribute); + genAttributes.add(generic); + where.add(new AttributeRow(generic)); + } + private void generateContent(List what, JComponent where) { Iterator iter = what.iterator(); *************** *** 255,258 **** --- 262,269 ---- } else if (a.getValue() instanceof Parametric) { handleLink(a, where); + } else if (a.getValue() instanceof Operation) { + handleOperation(a, where); + } else { + System.out.println("-- " + a.getValue() + " --"); } } |
From: Michael L. <he...@us...> - 2007-10-18 13:47:49
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17063/src/net/sourceforge/bprocessor/model Modified Files: Space.java Attribute.java Log Message: got rid of some code Index: Attribute.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Attribute.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Attribute.java 18 Oct 2007 11:59:20 -0000 1.24 --- Attribute.java 18 Oct 2007 13:47:47 -0000 1.25 *************** *** 32,38 **** private String name; - /** The space the classification is for */ - private Space level; - /** If the attribute can be modified or not */ private boolean editable; --- 32,35 ---- *************** *** 76,108 **** } - - /** - * Constructor - * @param name The name - * @param value The value - * @param classification The classification - * @param level the level of the space ie 1: space, 2: element or 3: part - */ - public Attribute(String name, Object value, Classification classification, Space level) { - setName(name); - setThe2ndValue(value); - setValue(classification); - setLevel(level); - editable = true; - } - /** * Constructor for Classification Attribute * @param name The name ! * @param rootClassification The outermost possible type (null for a link) ! * @param selectedClassification The chosen type (can be null) */ public Attribute(String name, ! ClassificationType rootClassification, ! ClassificationType selectedClassification) { setName(name); ! setValue(selectedClassification); ! setThe2ndValue(rootClassification); ! editable = true; } --- 73,91 ---- } /** * Constructor for Classification Attribute * @param name The name ! * @param the2nd The outermost possible type (null for a link) ! * @param value The chosen type (can be null) ! * @param b editable */ public Attribute(String name, ! Object the2nd, ! Object value, ! boolean b) { setName(name); ! setValue(value); ! setThe2ndValue(the2nd); ! editable = b; } *************** *** 192,209 **** } - /** - * @return Returns the level. - */ - public Space getLevel() { - return level; - } - - /** - * @param level The level of the space. - */ - public void setLevel(Space level) { - this.level = level; - } - /** {@inheritDoc} */ @Override --- 175,178 ---- Index: Space.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Space.java,v retrieving revision 1.185 retrieving revision 1.186 diff -C2 -d -r1.185 -r1.186 *** Space.java 17 Oct 2007 09:08:15 -0000 1.185 --- Space.java 18 Oct 2007 13:47:47 -0000 1.186 *************** *** 1340,1347 **** if (isConstructionSpace()) { res.add(new Attribute("Classification", ! Project.getInstance().getConstructionClas(), getClassification(), this)); } else { res.add(new Attribute("Classification", ! Project.getInstance().getFunctionalClas(), getClassification(), this)); } } else { --- 1340,1347 ---- if (isConstructionSpace()) { res.add(new Attribute("Classification", ! Project.getConstructionClas(), getClassification(), true)); } else { res.add(new Attribute("Classification", ! Project.getFunctionalClas(), getClassification(), true)); } } else { *************** *** 1349,1364 **** if (getOwner().getClassification() != null) { res.add(new Attribute("Classification", ! getOwner().getClassification(), getClassification(), this)); } else { res.add(new Attribute("Classification", ! Project.getInstance().getConstructionClas(), getClassification(), this)); } } else { if (getOwner() != null && getOwner().getClassification() != null) { res.add(new Attribute("Classification", ! getOwner().getClassification(), getClassification(), this)); } else { res.add(new Attribute("Classification", ! Project.getInstance().getFunctionalClas(), getClassification(), this)); } } --- 1349,1364 ---- if (getOwner().getClassification() != null) { res.add(new Attribute("Classification", ! getOwner().getClassification(), getClassification(), true)); } else { res.add(new Attribute("Classification", ! Project.getConstructionClas(), getClassification(), true)); } } else { if (getOwner() != null && getOwner().getClassification() != null) { res.add(new Attribute("Classification", ! getOwner().getClassification(), getClassification(), true)); } else { res.add(new Attribute("Classification", ! Project.getFunctionalClas(), getClassification(), true)); } } *************** *** 1366,1370 **** if (getClassification() != null && getClassificationType() != null) { res.add(new Attribute("Type", getClassification().getPossibleTypes(), ! getClassificationType())); HashMap<String, Object> param = getOwnParameters(); for (String s : param.keySet()) { --- 1366,1370 ---- if (getClassification() != null && getClassificationType() != null) { res.add(new Attribute("Type", getClassification().getPossibleTypes(), ! getClassificationType(), true)); HashMap<String, Object> param = getOwnParameters(); for (String s : param.keySet()) { |