bprocessor-commit Mailing List for B-processor (Page 36)
Status: Pre-Alpha
Brought to you by:
henryml
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(117) |
Aug
(151) |
Sep
(157) |
Oct
(81) |
Nov
(117) |
Dec
(119) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(183) |
Feb
(130) |
Mar
(117) |
Apr
(61) |
May
(82) |
Jun
(45) |
Jul
(149) |
Aug
(173) |
Sep
(199) |
Oct
(165) |
Nov
(107) |
Dec
(137) |
2007 |
Jan
(124) |
Feb
(58) |
Mar
(123) |
Apr
(80) |
May
(130) |
Jun
(64) |
Jul
(31) |
Aug
(42) |
Sep
(114) |
Oct
(167) |
Nov
(239) |
Dec
(200) |
2008 |
Jan
(43) |
Feb
(43) |
Mar
(4) |
Apr
(9) |
May
(5) |
Jun
(1) |
Jul
(3) |
Aug
(3) |
Sep
(13) |
Oct
(9) |
Nov
(12) |
Dec
|
2009 |
Jan
|
Feb
(20) |
Mar
(7) |
Apr
(12) |
May
(34) |
Jun
(72) |
Jul
|
Aug
(3) |
Sep
(31) |
Oct
(2) |
Nov
(8) |
Dec
(4) |
2010 |
Jan
(5) |
Feb
(32) |
Mar
(8) |
Apr
(7) |
May
(36) |
Jun
|
Jul
(11) |
Aug
(15) |
Sep
(7) |
Oct
(2) |
Nov
(13) |
Dec
(80) |
2011 |
Jan
|
Feb
|
Mar
(8) |
Apr
(12) |
May
(32) |
Jun
(9) |
Jul
(5) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
(8) |
2012 |
Jan
|
Feb
|
Mar
(3) |
Apr
(5) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(22) |
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Michael L. <he...@us...> - 2007-11-28 13:07:25
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30743/src/net/sourceforge/bprocessor/gl/tool Modified Files: SpaceTool.java Log Message: fixed spacetool back to normal.. Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** SpaceTool.java 28 Nov 2007 10:39:21 -0000 1.96 --- SpaceTool.java 28 Nov 2007 13:07:21 -0000 1.97 *************** *** 62,81 **** } - - /** - * {@inheritDoc} - */ - protected void moved(MouseEvent e) { - findTarget(e); - if (target != null) { - if (target instanceof Surface) { - editor.getView().makeTarget(target); - } - } else { - editor.getView().makeTarget(null); - } - - } - /** * Invoked when a mouse button has been pressed on a component. --- 62,65 ---- *************** *** 155,161 **** Selection selection = Selection.primary(); Object candidate = null; ! if (selection.size() == 0) { ! candidate = View.getLastSurface(); ! } else { candidate = selection.iterator().next(); } --- 139,143 ---- Selection selection = Selection.primary(); Object candidate = null; ! if (selection.size() == 1) { candidate = selection.iterator().next(); } *************** *** 202,208 **** Selection selection = Selection.primary(); Object candidate = null; ! if (selection.size() == 0) { ! candidate = View.getLastSurface(); ! } else { candidate = selection.iterator().next(); } --- 184,188 ---- Selection selection = Selection.primary(); Object candidate = null; ! if (selection.size() == 1) { candidate = selection.iterator().next(); } |
From: Michael L. <he...@us...> - 2007-11-28 12:46:46
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22510/src/net/sourceforge/bprocessor/gl/tool Modified Files: ToolFactory.java Log Message: forgot to commit icon Ð uses select instead Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -d -r1.94 -r1.95 *** ToolFactory.java 28 Nov 2007 10:39:21 -0000 1.94 --- ToolFactory.java 28 Nov 2007 12:46:47 -0000 1.95 *************** *** 209,213 **** this.registerTool(Tool.SELECT_TOOL, select, "Biconselecttool.gif", "Select"); selBut.setMnemonic(KeyEvent.VK_Q); ! registerTool(Tool.ASSIGN_TOOL, assign, "Biconassigntool.gif", "Assign"); JToggleButton pencilBut = this.registerTool(Tool.PENCIL_TOOL, pencil, "Biconpentool.gif", "Pencil"); --- 209,213 ---- this.registerTool(Tool.SELECT_TOOL, select, "Biconselecttool.gif", "Select"); selBut.setMnemonic(KeyEvent.VK_Q); ! registerTool(Tool.ASSIGN_TOOL, assign, "Biconselecttool.gif", "Assign"); JToggleButton pencilBut = this.registerTool(Tool.PENCIL_TOOL, pencil, "Biconpentool.gif", "Pencil"); |
From: Michael L. <he...@us...> - 2007-11-28 10:39:28
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5554/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: split of select and assign Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.263 retrieving revision 1.264 diff -C2 -d -r1.263 -r1.264 *** View.java 21 Nov 2007 21:10:41 -0000 1.263 --- View.java 28 Nov 2007 10:39:21 -0000 1.264 *************** *** 1100,1129 **** */ private void labelSelection(boolean clickable) { Collection<Geometric> selection = Selection.primary(); ! if (selection.size() == 1) { ! Geometric candidate = selection.iterator().next(); ! if (candidate instanceof Surface) { ! if (TICKLE) { ! long time = System.currentTimeMillis(); ! long elapsed = time - AbstractTool.getPressedTime(); ! long delay = 0; ! if (labelSurface == null) { ! delay = 120; ! } ! if (elapsed >= delay) { ! labelSurface = (Surface) candidate; ! labelSurface(labelSurface, clickable); ! } else { ! int when = (int) (delay - elapsed); ! tickler.stop(); ! tickler.setDelay(when); ! tickler.start(); ! } ! } else { labelSurface = (Surface) candidate; labelSurface(labelSurface, clickable); } } else { ! labelSurface = null; } } else { --- 1100,1133 ---- */ private void labelSelection(boolean clickable) { + Geometric candidate = null; + Collection<Geometric> selection = Selection.primary(); ! if (selection.size() == 0) { ! if (target instanceof Geometric) { ! candidate = (Geometric) target; ! } ! } else { ! candidate = selection.iterator().next(); ! } ! if (candidate instanceof Surface) { ! if (TICKLE) { ! long time = System.currentTimeMillis(); ! long elapsed = time - AbstractTool.getPressedTime(); ! long delay = 0; ! if (labelSurface == null) { ! delay = 120; ! } ! if (elapsed >= delay) { labelSurface = (Surface) candidate; labelSurface(labelSurface, clickable); + } else { + int when = (int) (delay - elapsed); + tickler.stop(); + tickler.setDelay(when); + tickler.start(); } } else { ! labelSurface = (Surface) candidate; ! labelSurface(labelSurface, clickable); } } else { |
From: Michael L. <he...@us...> - 2007-11-28 10:39:28
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv5554/src/net/sourceforge/bprocessor/gl/tool Modified Files: Tool.java ToolFactory.java SpaceTool.java CreateSpaceActionListener.java Log Message: split of select and assign Index: SpaceTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/SpaceTool.java,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -d -r1.95 -r1.96 *** SpaceTool.java 21 Nov 2007 21:10:41 -0000 1.95 --- SpaceTool.java 28 Nov 2007 10:39:21 -0000 1.96 *************** *** 15,19 **** import java.net.URL; import java.util.Collection; - import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; --- 15,18 ---- *************** *** 33,36 **** --- 32,36 ---- import net.sourceforge.bprocessor.gl.Editor; + import net.sourceforge.bprocessor.gl.view.View; import net.sourceforge.bprocessor.gui.PopupMenu; import net.sourceforge.bprocessor.gui.actions.SpaceMenuAction; *************** *** 62,65 **** --- 62,81 ---- } + + /** + * {@inheritDoc} + */ + protected void moved(MouseEvent e) { + findTarget(e); + if (target != null) { + if (target instanceof Surface) { + editor.getView().makeTarget(target); + } + } else { + editor.getView().makeTarget(null); + } + + } + /** * Invoked when a mouse button has been pressed on a component. *************** *** 135,162 **** private JPopupMenu seperatorPopup() { JPopupMenu sepPop = new JPopupMenu(); ! Iterator<Geometric> selIt = new HashSet<Geometric>(Selection.primary()).iterator(); ! if (selIt.hasNext()) { ! Object o = selIt.next(); ! if (o instanceof Surface) { ! Surface surface = (Surface)o; ! JMenuItem shift = new JMenuItem("Shift spaces"); ! ActionListener shiftListener = new ShiftActionListener(surface); ! shift.addActionListener(shiftListener); ! JMenuItem copy = new JMenuItem("Copy space assignment"); ! ActionListener copyListener = new CopyActionListener(surface, editor.getView()); ! copy.addActionListener(copyListener); ! JMenuItem paste = new JMenuItem("Paste space assignment"); ! ActionListener pasteListener = new PasteActionListener(surface, editor.getView()); ! paste.addActionListener(pasteListener); ! ! sepPop.add(shift); ! sepPop.add(copy); ! sepPop.add(paste); ! sepPop.pack(); ! return sepPop; } } ! log.warn("Seperator popup menu has no surface"); ! return sepPop; } --- 151,186 ---- private JPopupMenu seperatorPopup() { JPopupMenu sepPop = new JPopupMenu(); ! Surface surface = null; ! { ! Selection selection = Selection.primary(); ! Object candidate = null; ! if (selection.size() == 0) { ! candidate = View.getLastSurface(); ! } else { ! candidate = selection.iterator().next(); ! } ! if (candidate instanceof Surface) { ! surface = (Surface) candidate; } } ! if (surface != null) { ! JMenuItem shift = new JMenuItem("Shift spaces"); ! ActionListener shiftListener = new ShiftActionListener(surface); ! shift.addActionListener(shiftListener); ! JMenuItem copy = new JMenuItem("Copy space assignment"); ! ActionListener copyListener = new CopyActionListener(surface, editor.getView()); ! copy.addActionListener(copyListener); ! JMenuItem paste = new JMenuItem("Paste space assignment"); ! ActionListener pasteListener = new PasteActionListener(surface, editor.getView()); ! paste.addActionListener(pasteListener); ! ! sepPop.add(shift); ! sepPop.add(copy); ! sepPop.add(paste); ! sepPop.pack(); ! return sepPop; ! } else { ! return null; ! } } *************** *** 171,183 **** ! Iterator<Geometric> selIt = new HashSet<Geometric>(Selection.primary()).iterator(); Surface surface = null; Space space = null; ! if (selIt.hasNext()) { ! Object o = selIt.next(); ! if (o instanceof Surface) { ! surface = (Surface)o; } if (surface != null) { --- 195,217 ---- ! Surface surface = null; Space space = null; ! { ! Selection selection = Selection.primary(); ! Object candidate = null; ! if (selection.size() == 0) { ! candidate = View.getLastSurface(); ! } else { ! candidate = selection.iterator().next(); } + if (candidate instanceof Surface) { + surface = (Surface) candidate; + } + } + + + if (surface != null) { if (surface != null) { Index: CreateSpaceActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/CreateSpaceActionListener.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** CreateSpaceActionListener.java 21 Nov 2007 09:21:17 -0000 1.22 --- CreateSpaceActionListener.java 28 Nov 2007 10:39:21 -0000 1.23 *************** *** 61,64 **** --- 61,65 ---- surface.changed(); AttributeView.instance().display(space); + Project.getInstance().changed(Project.getInstance()); Project.getInstance().checkpoint(); } Index: ToolFactory.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** ToolFactory.java 19 Nov 2007 19:56:05 -0000 1.93 --- ToolFactory.java 28 Nov 2007 10:39:21 -0000 1.94 *************** *** 60,64 **** /** select tool */ ! private SpaceTool select; /** Alternate Move Tool */ --- 60,66 ---- /** select tool */ ! private AbstractTool select; ! ! private AbstractTool assign; /** Alternate Move Tool */ *************** *** 182,186 **** Cursor zoomCursor = Toolkit.getDefaultToolkit().createCustomCursor(zoomImage, new Point(7, 8), "Zoom"); ! select = new SpaceTool(editor, null); pencil = new Pencil(editor, pencilcursor); eraser = new EraserTool(editor, pencilcursor); --- 184,189 ---- Cursor zoomCursor = Toolkit.getDefaultToolkit().createCustomCursor(zoomImage, new Point(7, 8), "Zoom"); ! select = new SelectTool(editor, null); ! assign = new SpaceTool(editor, null); pencil = new Pencil(editor, pencilcursor); eraser = new EraserTool(editor, pencilcursor); *************** *** 206,209 **** --- 209,213 ---- this.registerTool(Tool.SELECT_TOOL, select, "Biconselecttool.gif", "Select"); selBut.setMnemonic(KeyEvent.VK_Q); + registerTool(Tool.ASSIGN_TOOL, assign, "Biconassigntool.gif", "Assign"); JToggleButton pencilBut = this.registerTool(Tool.PENCIL_TOOL, pencil, "Biconpentool.gif", "Pencil"); Index: Tool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** Tool.java 21 Nov 2007 09:21:17 -0000 1.39 --- Tool.java 28 Nov 2007 10:39:21 -0000 1.40 *************** *** 77,80 **** --- 77,82 ---- /** the zoom tool */ public static final int ZOOM_TOOL = 26; + /** the zoom tool */ + public static final int ASSIGN_TOOL = 27; /** |
From: rimestad <rim...@us...> - 2007-11-26 18:22:44
|
Update of /cvsroot/bprocessor/model/src/etc In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30157/src/etc Modified Files: bprocessor.xsd Log Message: Fixed a problem with instances and coordinatesystems in persistence Index: bprocessor.xsd =================================================================== RCS file: /cvsroot/bprocessor/model/src/etc/bprocessor.xsd,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** bprocessor.xsd 12 Nov 2007 19:17:32 -0000 1.38 --- bprocessor.xsd 26 Nov 2007 18:22:36 -0000 1.39 *************** *** 21,26 **** </xsd:appinfo> </xsd:annotation> - - <!-- Type definitions --> --- 21,24 ---- *************** *** 42,47 **** </xsd:complexType> - - <xsd:complexType name="TripletType"> <xsd:attribute name="x" type="xsd:double" use="required"/> --- 40,43 ---- *************** *** 354,365 **** <xsd:complexType name="LibObjType"> ! <xsd:sequence> ! <xsd:element ref="space" maxOccurs="1" minOccurs="1"/> ! </xsd:sequence> ! <xsd:attribute name="name" type="xsd:string" use="required"/> ! <xsd:attribute name="version" type="xsd:string" use="required"/> ! <xsd:attribute name="author" type="xsd:string" use="required"/> ! <xsd:attribute name="useableLevels" type="xsd:byte" use="required"/> ! <xsd:attribute name="locked" type="xsd:boolean" use="required"/> </xsd:complexType> --- 350,365 ---- <xsd:complexType name="LibObjType"> ! <xsd:complexContent> ! <xsd:extension base="EntityType"> ! <xsd:sequence> ! <xsd:element ref="space" maxOccurs="1" minOccurs="1"/> ! </xsd:sequence> ! <xsd:attribute name="name" type="xsd:string" use="required"/> ! <xsd:attribute name="version" type="xsd:string" use="required"/> ! <xsd:attribute name="author" type="xsd:string" use="required"/> ! <xsd:attribute name="useableLevels" type="xsd:byte" use="required"/> ! <xsd:attribute name="locked" type="xsd:boolean" use="required"/> ! </xsd:extension> ! </xsd:complexContent> </xsd:complexType> |
From: rimestad <rim...@us...> - 2007-11-26 18:22:40
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30157/src/net/sourceforge/bprocessor/model Modified Files: Persistence.java Log Message: Fixed a problem with instances and coordinatesystems in persistence Index: Persistence.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Persistence.java,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** Persistence.java 23 Nov 2007 10:27:26 -0000 1.61 --- Persistence.java 26 Nov 2007 18:22:36 -0000 1.62 *************** *** 95,98 **** --- 95,99 ---- import javax.xml.bind.JAXBContext; + import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; *************** *** 231,235 **** private static Space internalizeSpace(Space owner, SpaceType xml, Map mapper, Collection xmls) { ! Space s = new Space(); return internalizeSpace(owner, s, xml, mapper, xmls); } --- 232,236 ---- private static Space internalizeSpace(Space owner, SpaceType xml, Map mapper, Collection xmls) { ! Space s = new Space(xml.getName(), xml.getType(), xml.getVoidref() != 0); return internalizeSpace(owner, s, xml, mapper, xmls); } *************** *** 277,288 **** private static Space internalizeSpace(Space owner, Space space, SpaceType xml, Map mapper, Collection xmls) { ! String name = xml.getName(); int type = xml.getType(); long empty = xml.getVoidref(); ! boolean container = (empty != 0); ! space.setName(name); ! space.setType(type); ! space.setContainer(container); space.setTransparent(xml.isTransparent()); space.setId(new Long(xml.getProgid())); --- 278,292 ---- private static Space internalizeSpace(Space owner, Space space, SpaceType xml, Map mapper, Collection xmls) { ! //String name = xml.getName(); int type = xml.getType(); long empty = xml.getVoidref(); ! //boolean container = (empty != 0); ! long proto = xml.getProtoref(); ! boolean instance = (proto != 0); ! ! //space.setName(name); ! //space.setType(type); ! //space.setContainer(container); space.setTransparent(xml.isTransparent()); space.setId(new Long(xml.getProgid())); *************** *** 295,384 **** } mapper.put(new Long(xml.getId()), space); ! xmls.add(xml); ! { ! HashMap elements = new HashMap(); ! Iterator iter = xml.getSpace().iterator(); ! while (iter.hasNext()) { ! net.sourceforge.bprocessor.model.xml.Space current = ! (net.sourceforge.bprocessor.model.xml.Space) iter.next(); ! Space element = internalizeElement(space, current, mapper, xmls); ! elements.put(element.getId(), element); ! } ! space.setElements(elements); ! } ! if (empty != 0) { ! space.setEmpty((Space) mapper.get(new Long(empty))); ! } ! { ! HashMap surfaces = new HashMap(); ! Iterator iter = xml.getSurface().iterator(); ! while (iter.hasNext()) { ! SurfaceType current = (SurfaceType) iter.next(); ! Surface surface = internalizeSurface(space, current, mapper, xmls); ! surfaces.put(surface.getId(), surface); } ! space.setSurfaces(surfaces); ! } ! { ! HashMap edges = new HashMap(); ! Iterator iter = xml.getEdge().iterator(); ! while (iter.hasNext()) { ! EdgeType current = (EdgeType) iter.next(); ! Edge edge = internalizeEdge(space, current, mapper, xmls); ! edges.put(edge.getId(), edge); } ! space.setEdges(edges); ! } ! { ! HashMap vertices = new HashMap(); ! Iterator iter = xml.getVertex().iterator(); ! while (iter.hasNext()) { ! VertexType current = (VertexType) iter.next(); ! Vertex vertex = internalizeVertex(space, current, mapper, xmls); ! vertices.put(vertex.getId(), vertex); } ! space.setVertices(vertices); ! } ! /*{ ! Iterator iter = xml.getMaterial().iterator(); ! while (iter.hasNext()) { ! MaterialType current = (MaterialType) iter.next(); ! space.add(internalizeMaterial(current, mapper, xmls)); } ! }*/ ! { ! if (xml.getAnchor() != null) { ! space.setInstanceAnchor(internalizeCoordinateSystem(xml.getAnchor(), mapper, xmls)); } ! } ! { ! Iterator iter = xml.getConstructor().iterator(); ! while (iter.hasNext()) { ! Object current = iter.next(); ! Constructor c = null; ! if (current instanceof CoordinateSystemType) { ! c = internalizeCoordinateSystem((CoordinateSystemType)current, mapper, xmls); ! } else if (current instanceof PointType) { ! c = internalizePoint((PointType)current, mapper, xmls); ! } else if (current instanceof LineType) { ! c = internalizeLine((LineType)current, mapper, xmls); ! } else { ! log.info("Const were " + current.getClass()); } ! if (c != null) { ! Set connected = new HashSet(); ! Iterator cs = ((ConstructorType)current).getConnected().iterator(); ! while (cs.hasNext()) { ! Long l = (Long)cs.next(); ! Object g = get(l.longValue(), mapper); ! if (g instanceof Geometric) { ! connected.add(g); } } - c.connect(connected); - space.add(c); } } } space.setOwner(owner); --- 299,390 ---- } mapper.put(new Long(xml.getId()), space); ! xmls.add(xml); ! if (!instance) { ! { ! HashMap elements = new HashMap(); ! Iterator iter = xml.getSpace().iterator(); ! while (iter.hasNext()) { ! net.sourceforge.bprocessor.model.xml.Space current = ! (net.sourceforge.bprocessor.model.xml.Space) iter.next(); ! Space element = internalizeElement(space, current, mapper, xmls); ! elements.put(element.getId(), element); ! } ! space.setElements(elements); } ! if (empty != 0) { ! space.setEmpty((Space) mapper.get(new Long(empty))); } ! { ! HashMap surfaces = new HashMap(); ! Iterator iter = xml.getSurface().iterator(); ! while (iter.hasNext()) { ! SurfaceType current = (SurfaceType) iter.next(); ! Surface surface = internalizeSurface(space, current, mapper, xmls); ! surfaces.put(surface.getId(), surface); ! } ! space.setSurfaces(surfaces); } ! { ! HashMap edges = new HashMap(); ! Iterator iter = xml.getEdge().iterator(); ! while (iter.hasNext()) { ! EdgeType current = (EdgeType) iter.next(); ! Edge edge = internalizeEdge(space, current, mapper, xmls); ! edges.put(edge.getId(), edge); ! } ! space.setEdges(edges); } ! { ! HashMap vertices = new HashMap(); ! Iterator iter = xml.getVertex().iterator(); ! while (iter.hasNext()) { ! VertexType current = (VertexType) iter.next(); ! Vertex vertex = internalizeVertex(space, current, mapper, xmls); ! vertices.put(vertex.getId(), vertex); ! } ! space.setVertices(vertices); } ! /*{ ! Iterator iter = xml.getMaterial().iterator(); ! while (iter.hasNext()) { ! MaterialType current = (MaterialType) iter.next(); ! space.add(internalizeMaterial(current, mapper, xmls)); } ! }*/ ! ! { ! Iterator iter = xml.getConstructor().iterator(); ! while (iter.hasNext()) { ! Object current = iter.next(); ! Constructor c = null; ! if (current instanceof CoordinateSystemType) { ! c = internalizeCoordinateSystem((CoordinateSystemType)current, mapper, xmls); ! } else if (current instanceof PointType) { ! c = internalizePoint((PointType)current, mapper, xmls); ! } else if (current instanceof LineType) { ! c = internalizeLine((LineType)current, mapper, xmls); ! } else { ! log.info("Const were " + current.getClass()); ! } ! if (c != null) { ! Set connected = new HashSet(); ! Iterator cs = ((ConstructorType)current).getConnected().iterator(); ! while (cs.hasNext()) { ! Long l = (Long)cs.next(); ! Object g = get(l.longValue(), mapper); ! if (g instanceof Geometric) { ! connected.add(g); ! } } + c.connect(connected); + space.add(c); } } } + } else { + if (xml.getAnchor() != null) { + space.setInstanceAnchor(internalizeCoordinateSystem(xml.getAnchor(), mapper, xmls)); + } } space.setOwner(owner); *************** *** 888,892 **** * @exception Exception Thrown if an error occurs */ ! private static void saveFile(Object document, OutputStream stream) throws Exception { JAXBContext jc = JAXBContext.newInstance("net.sourceforge.bprocessor.model.xml"); Marshaller m = jc.createMarshaller(); --- 894,898 ---- * @exception Exception Thrown if an error occurs */ ! private static void saveFile(Object document, OutputStream stream) throws JAXBException { JAXBContext jc = JAXBContext.newInstance("net.sourceforge.bprocessor.model.xml"); Marshaller m = jc.createMarshaller(); *************** *** 1670,1673 **** --- 1676,1680 ---- lo.setName(lot.getName()); lo.setLocked(lot.isLocked()); + lo.setId(lot.getProgid()); lo.setSpace(internalizeSpace(null, lot.getSpace(), map, xmls)); return lo; *************** *** 1681,1689 **** File fout = new File("components/lib.bpl"); FileOutputStream fos = new FileOutputStream(fout); ! Library lib = externalizeLibrary(Project.getLibraryObjects()); ! saveFile(lib, fos); ! ! fos.flush(); fos.close(); } --- 1688,1699 ---- File fout = new File("components/lib.bpl"); FileOutputStream fos = new FileOutputStream(fout); ! counter = 1; Library lib = externalizeLibrary(Project.getLibraryObjects()); ! try { ! saveFile(lib, fos); ! fos.flush(); ! } catch (JAXBException e) { ! log.error("There were a marshalling error " + e); ! } fos.close(); } *************** *** 1711,1714 **** --- 1721,1726 ---- private static LibObjType externalizeLibObj(Component libo, HashMap<Long, Object> map) { LibObjType libobj = new LibObjTypeImpl(); + libobj.setProgid(libo.getId()); + libobj.setId(counter++); libobj.setLocked(libo.isLocked()); libobj.setAuthor(libo.getAuthor()); |
From: rimestad <rim...@us...> - 2007-11-26 18:15:23
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26981/src/net/sourceforge/bprocessor/gl/tool Modified Files: FinalMoveTool.java Log Message: added use of first coordinatesystem in union of instance as handle when moving instances... tried some matrix stuff to rotate into the coordinatesystem of the handle but without luck Index: FinalMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/FinalMoveTool.java,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** FinalMoveTool.java 26 Nov 2007 10:30:53 -0000 1.36 --- FinalMoveTool.java 26 Nov 2007 18:15:07 -0000 1.37 *************** *** 195,199 **** private CoordinateSystem handle; private CoordinateSystem initialCoordinate; ! private Matrix translation; /** --- 195,199 ---- private CoordinateSystem handle; private CoordinateSystem initialCoordinate; ! private Matrix handleTranslation; /** *************** *** 206,211 **** this.handle = handle; this.initialCoordinate = instance.getInstanceAnchor().copy(); } ! /** * {@inheritDoc} --- 206,217 ---- this.handle = handle; this.initialCoordinate = instance.getInstanceAnchor().copy(); + handleTranslation = new Matrix(new double[]{ + handle.getI().getX(), handle.getI().getY(), handle.getI().getZ(), 0, + handle.getJ().getX(), handle.getJ().getY(), handle.getJ().getZ(), 0, + handle.getN().getX(), handle.getN().getY(), handle.getN().getZ(), 0, + handle.getOrigin().getX(), handle.getOrigin().getY(), handle.getOrigin().getZ(), 1, + }).invert(); } ! /** * {@inheritDoc} *************** *** 218,229 **** Surface surface = (Surface)current.object(); Vertex n = surface.normal(); - Vertex origin = surface.getFirstVertex(); if (!editor.getView().facingFront(surface)) { n = n.scale(-1); } ! CoordinateSystem cs = CoordinateSystem.systemFor(origin, n); CoordinateSystem anchor = instance.getInstanceAnchor(); ! anchor.setAttributes(cs.getAttributes()); anchor.setOrigin(current.vertex()); } else { // change i, j, n of the anchor back to its originals and then just move the delta --- 224,250 ---- Surface surface = (Surface)current.object(); Vertex n = surface.normal(); if (!editor.getView().facingFront(surface)) { n = n.scale(-1); } ! CoordinateSystem cs = CoordinateSystem.systemFor(current.vertex(), n); CoordinateSystem anchor = instance.getInstanceAnchor(); ! Vertex handleOffset = handle.center().scale(-1); ! ! Vertex i = handleTranslation.multiply(cs.getI(), false); ! Vertex j = handleTranslation.multiply(cs.getJ(), false); ! Vertex k = handleTranslation.multiply(cs.getN(), false); ! anchor.setIJN(i, j, k); anchor.setOrigin(current.vertex()); + anchor.setOrigin(anchor.unTranslate(handleOffset)); + /* + Matrix movement = handleTranslation.copy(); + movement.translate(x, y, z); + Vertex i = handleTranslation.multiply(cs.getI(), false); + Vertex j = handleTranslation.multiply(cs.getJ(), false); + Vertex k = handleTranslation.multiply(cs.getN(), false); + anchor.setIJN(i, j, k); + Vertex center = handleTranslation.multiply(cs.center(), false); + anchor.setOrigin(center); + */ } else { // change i, j, n of the anchor back to its originals and then just move the delta *************** *** 499,503 **** Space space = (Space)work; if (space.isInstance()) { ! mover = new InstanceMove(space, space.getInstanceAnchor()); } } --- 520,532 ---- Space space = (Space)work; if (space.isInstance()) { ! CoordinateSystem anchor = null; ! for (CoordinateSystem currentSystem : space.getProto().getCoordinateSystems()) { ! anchor = currentSystem; ! break; ! } ! if (anchor == null) { ! anchor = space.getInstanceAnchor(); ! } ! mover = new InstanceMove(space, anchor); } } |
From: rimestad <rim...@us...> - 2007-11-26 18:13:29
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv26195/src/net/sourceforge/bprocessor/gui/actions Modified Files: FileImportActionListener.java Log Message: changed instanciate to use the addlibrarycomponent Index: FileImportActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions/FileImportActionListener.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** FileImportActionListener.java 19 Nov 2007 09:14:22 -0000 1.16 --- FileImportActionListener.java 26 Nov 2007 18:13:30 -0000 1.17 *************** *** 27,31 **** import net.sourceforge.bprocessor.gui.GUI; import net.sourceforge.bprocessor.model.Component; - import net.sourceforge.bprocessor.model.Persistence; import net.sourceforge.bprocessor.model.Project; import net.sourceforge.bprocessor.model.Space; --- 27,30 ---- *************** *** 112,123 **** s.setUnion(true); Component lo = new Component(Byte.MAX_VALUE, lfile, s); - Project.getLibraryObjects().add(lo); ImportFileReader.importObjFile(lfile, s, info.objPanel.getScale(), info.objPanel.getDirection(), info.objPanel.getCalcNormals()); //s.computeEnvelope(); Project.getInstance().changed(s); Project.getInstance().checkpoint(); - //FIXME dont do this here - Persistence.saveLibrary(); } catch (Exception ex) { log.error("Could not open file: " + lfile, ex); --- 111,120 ---- s.setUnion(true); Component lo = new Component(Byte.MAX_VALUE, lfile, s); ImportFileReader.importObjFile(lfile, s, info.objPanel.getScale(), info.objPanel.getDirection(), info.objPanel.getCalcNormals()); //s.computeEnvelope(); + Project.getInstance().addLibraryObject(lo); Project.getInstance().changed(s); Project.getInstance().checkpoint(); } catch (Exception ex) { log.error("Could not open file: " + lfile, ex); |
From: rimestad <rim...@us...> - 2007-11-26 18:11:36
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv25358/src/net/sourceforge/bprocessor/model Modified Files: Project.java Log Message: moved try catch on library save and added a addlibrarycomponent to project Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.143 retrieving revision 1.144 diff -C2 -d -r1.143 -r1.144 *** Project.java 19 Nov 2007 09:20:41 -0000 1.143 --- Project.java 26 Nov 2007 18:11:36 -0000 1.144 *************** *** 135,147 **** functionalClas = (Classification)loaded[1]; classificationTypes = (Collection<ClassificationType>)loaded[2]; - try { - library = Persistence.loadLibrary(); - } catch (Exception e) { - library = new LinkedList(); - } } catch (Exception e) { log.error("Error loading classification " + e); e.printStackTrace(); } } return instance; --- 135,148 ---- functionalClas = (Classification)loaded[1]; classificationTypes = (Collection<ClassificationType>)loaded[2]; } catch (Exception e) { log.error("Error loading classification " + e); e.printStackTrace(); } + try { + library = Persistence.loadLibrary(); + } catch (Exception e) { + log.error("Error loading library " + e); + library = new LinkedList(); + } } return instance; *************** *** 1051,1060 **** /** ! * Add a lib obj to til list of lib objects ! * @param lo the library object to add */ public void addCalalogObject(Component lo) { if (!catalog.contains(lo)) { catalog.add(lo); lo.getSpace().setOwner(this.world); } --- 1052,1062 ---- /** ! * Add a component to til list of catalog objects ! * @param lo the component object to add */ public void addCalalogObject(Component lo) { if (!catalog.contains(lo)) { catalog.add(lo); + lo.setId(new Long(catalog.size())); lo.getSpace().setOwner(this.world); } *************** *** 1062,1067 **** /** ! * Return the program library objects ! * @return the lib objs */ public static Collection<Component> getLibraryObjects() { --- 1064,1086 ---- /** ! * Add a component to til list of library objects ! * @param lo the component to add ! */ ! public void addLibraryObject(Component lo) { ! if (!library.contains(lo)) { ! library.add(lo); ! lo.setId(new Long(library.size())); ! lo.getSpace().setOwner(null); ! try { ! Persistence.saveLibrary(); ! } catch (Exception e) { ! log.error("Could not save library due to:" + e); ! } ! } ! } ! ! /** ! * Return the program library components ! * @return the program library components */ public static Collection<Component> getLibraryObjects() { |
From: rimestad <rim...@us...> - 2007-11-26 18:09:06
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24444/src/net/sourceforge/bprocessor/model Modified Files: Matrix.java Log Message: added invert on matrix and made a small but for now useless test of it Index: Matrix.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Matrix.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Matrix.java 24 Nov 2005 10:30:45 -0000 1.1 --- Matrix.java 26 Nov 2007 18:09:08 -0000 1.2 *************** *** 66,69 **** --- 66,81 ---- /** + * Add a translation to the matrix + * @param x dx + * @param y dy + * @param z dz + */ + public void translate(double x, double y, double z) { + set(3, 0, get(3, 0) + x); + set(3, 1, get(3, 1) + y); + set(3, 2, get(3, 2) + z); + } + + /** * Construct a matrix with specified values * @param values The values in column-major order *************** *** 106,108 **** --- 118,272 ---- return result; } + + /** + * Multiply a vertex with a matrix either as a vertex or vector + * @param v the vertex to multiply with this matrix + * @param asVertex Add the translation as well + * @return the result + */ + public Vertex multiply(Vertex v, boolean asVertex) { + double fourth = asVertex ? 1 : 0; + double res[] = multiply(new double[]{v.getX(), v.getY(), v.getZ(), fourth}); + return new Vertex(res[0], res[1], res[2]); + } + + /** + * Invert a 4x4 matrix by for each indice finding the determinant of the other rows and collums + * @see http://mathworld.wolfram.com/MatrixInverse.html + * @return the inverse of the matrix + */ + public Matrix invert() { + Matrix inverted = new Matrix(); + inverted.set(0, 0, get(1, 2) * get(2, 3) * get(3, 1) - get(1, 3) * get(2, 2) * get(3, 1) + + get(1, 3) * get(2, 1) * get(3, 2) - get(1, 1) * get(2, 3) * get(3, 2) - + get(1, 2) * get(2, 1) * get(3, 3) + get(1, 1) * get(2, 2) * get(3, 3)); + inverted.set(0, 1, get(0, 3) * get(2, 2) * get(3, 1) - get(0, 2) * get(2, 3) * get(3, 1) - + get(0, 3) * get(2, 1) * get(3, 2) + get(0, 1) * get(2, 3) * get(3, 2) + + get(0, 2) * get(2, 1) * get(3, 3) - get(0, 1) * get(2, 2) * get(3, 3)); + inverted.set(0, 2, get(0, 2) * get(1, 3) * get(3, 1) - get(0, 3) * get(1, 2) * get(3, 1) + + get(0, 3) * get(1, 1) * get(3, 2) - get(0, 1) * get(1, 3) * get(3, 2) - + get(0, 2) * get(1, 1) * get(3, 3) + get(0, 1) * get(1, 2) * get(3, 3)); + inverted.set(0, 3, get(0, 3) * get(1, 2) * get(2, 1) - get(0, 2) * get(1, 3) * get(2, 1) - + get(0, 3) * get(1, 1) * get(2, 2) + get(0, 1) * get(1, 3) * get(2, 2) + + get(0, 2) * get(1, 1) * get(2, 3) - get(0, 1) * get(1, 2) * get(2, 3)); + inverted.set(1, 0, get(1, 3) * get(2, 2) * get(3, 0) - get(1, 2) * get(2, 3) * get(3, 0) - + get(1, 3) * get(2, 0) * get(3, 2) + get(1, 0) * get(2, 3) * get(3, 2) + + get(1, 2) * get(2, 0) * get(3, 3) - get(1, 0) * get(2, 2) * get(3, 3)); + inverted.set(1, 1, get(0, 2) * get(2, 3) * get(3, 0) - get(0, 3) * get(2, 2) * get(3, 0) + + get(0, 3) * get(2, 0) * get(3, 2) - get(0, 0) * get(2, 3) * get(3, 2) - + get(0, 2) * get(2, 0) * get(3, 3) + get(0, 0) * get(2, 2) * get(3, 3)); + inverted.set(1, 2, get(0, 3) * get(1, 2) * get(3, 0) - get(0, 2) * get(1, 3) * get(3, 0) - + get(0, 3) * get(1, 0) * get(3, 2) + get(0, 0) * get(1, 3) * get(3, 2) + + get(0, 2) * get(1, 0) * get(3, 3) - get(0, 0) * get(1, 2) * get(3, 3)); + inverted.set(1, 3, get(0, 2) * get(1, 3) * get(2, 0) - get(0, 3) * get(1, 2) * get(2, 0) + + get(0, 3) * get(1, 0) * get(2, 2) - get(0, 0) * get(1, 3) * get(2, 2) - + get(0, 2) * get(1, 0) * get(2, 3) + get(0, 0) * get(1, 2) * get(2, 3)); + inverted.set(2, 0, get(1, 1) * get(2, 3) * get(3, 0) - get(1, 3) * get(2, 1) * get(3, 0) + + get(1, 3) * get(2, 0) * get(3, 1) - get(1, 0) * get(2, 3) * get(3, 1) - + get(1, 1) * get(2, 0) * get(3, 3) + get(1, 0) * get(2, 1) * get(3, 3)); + inverted.set(2, 1, get(0, 3) * get(2, 1) * get(3, 0) - get(0, 1) * get(2, 3) * get(3, 0) - + get(0, 3) * get(2, 0) * get(3, 1) + get(0, 0) * get(2, 3) * get(3, 1) + + get(0, 1) * get(2, 0) * get(3, 3) - get(0, 0) * get(2, 1) * get(3, 3)); + inverted.set(2, 2, get(0, 1) * get(1, 3) * get(3, 0) - get(0, 3) * get(1, 1) * get(3, 0) + + get(0, 3) * get(1, 0) * get(3, 1) - get(0, 0) * get(1, 3) * get(3, 1) - + get(0, 1) * get(1, 0) * get(3, 3) + get(0, 0) * get(1, 1) * get(3, 3)); + inverted.set(2, 3, get(0, 3) * get(1, 1) * get(2, 0) - get(0, 1) * get(1, 3) * get(2, 0) - + get(0, 3) * get(1, 0) * get(2, 1) + get(0, 0) * get(1, 3) * get(2, 1) + + get(0, 1) * get(1, 0) * get(2, 3) - get(0, 0) * get(1, 1) * get(2, 3)); + inverted.set(3, 0, get(1, 2) * get(2, 1) * get(3, 0) - get(1, 1) * get(2, 2) * get(3, 0) - + get(1, 2) * get(2, 0) * get(3, 1) + get(1, 0) * get(2, 2) * get(3, 1) + + get(1, 1) * get(2, 0) * get(3, 2) - get(1, 0) * get(2, 1) * get(3, 2)); + inverted.set(3, 1, get(0, 1) * get(2, 2) * get(3, 0) - get(0, 2) * get(2, 1) * get(3, 0) + + get(0, 2) * get(2, 0) * get(3, 1) - get(0, 0) * get(2, 2) * get(3, 1) - + get(0, 1) * get(2, 0) * get(3, 2) + get(0, 0) * get(2, 1) * get(3, 2)); + inverted.set(3, 2, get(0, 2) * get(1, 1) * get(3, 0) - get(0, 1) * get(1, 2) * get(3, 0) - + get(0, 2) * get(1, 0) * get(3, 1) + get(0, 0) * get(1, 2) * get(3, 1) + + get(0, 1) * get(1, 0) * get(3, 2) - get(0, 0) * get(1, 1) * get(3, 2)); + inverted.set(3, 3, get(0, 1) * get(1, 2) * get(2, 0) - get(0, 2) * get(1, 1) * get(2, 0) + + get(0, 2) * get(1, 0) * get(2, 1) - get(0, 0) * get(1, 2) * get(2, 1) - + get(0, 1) * get(1, 0) * get(2, 2) + get(0, 0) * get(1, 1) * get(2, 2)); + inverted.scale(1 / this.determinant()); + return inverted; + } + + /** + * Calculate the determinant + * @return the determinant + */ + public double determinant() { + double value; + value = + get(0, 3) * get(1, 2) * get(2, 1) * get(3, 0) - + get(0, 2) * get(1, 3) * get(2, 1) * get(3, 0) - + get(0, 3) * get(1, 1) * get(2, 2) * get(3, 0) + + get(0, 1) * get(1, 3) * get(2, 2) * get(3, 0) + + get(0, 2) * get(1, 1) * get(2, 3) * get(3, 0) - + get(0, 1) * get(1, 2) * get(2, 3) * get(3, 0) - + get(0, 3) * get(1, 2) * get(2, 0) * get(3, 1) + + get(0, 2) * get(1, 3) * get(2, 0) * get(3, 1) + + get(0, 3) * get(1, 0) * get(2, 2) * get(3, 1) - + get(0, 0) * get(1, 3) * get(2, 2) * get(3, 1) - + get(0, 2) * get(1, 0) * get(2, 3) * get(3, 1) + + get(0, 0) * get(1, 2) * get(2, 3) * get(3, 1) + + get(0, 3) * get(1, 1) * get(2, 0) * get(3, 2) - + get(0, 1) * get(1, 3) * get(2, 0) * get(3, 2) - + get(0, 3) * get(1, 0) * get(2, 1) * get(3, 2) + + get(0, 0) * get(1, 3) * get(2, 1) * get(3, 2) + + get(0, 1) * get(1, 0) * get(2, 3) * get(3, 2) - + get(0, 0) * get(1, 1) * get(2, 3) * get(3, 2) - + get(0, 2) * get(1, 1) * get(2, 0) * get(3, 3) + + get(0, 1) * get(1, 2) * get(2, 0) * get(3, 3) + + get(0, 2) * get(1, 0) * get(2, 1) * get(3, 3) - + get(0, 0) * get(1, 2) * get(2, 1) * get(3, 3) - + get(0, 1) * get(1, 0) * get(2, 2) * get(3, 3) + + get(0, 0) * get(1, 1) * get(2, 2) * get(3, 3); + return value; + } + + /** + * Scale all indices in the matrix by the given value + * @param value the value to scale with + */ + public void scale(double value) { + for (int i = 0; i < this.storage.length; i++) { + if (this.storage[i] != 0) { + this.storage[i] *= value; + } + } + } + + private final double get(int i, int j) { + return this.storage[4 * i + j]; + } + + private final void set(int i, int j, double val) { + this.storage[4 * i + j] = val; + } + + /** + * Equal if all values in the matrix are the same + * @return true if this and obj are the equal + * @param obj The object to compare with + */ + @Override + public boolean equals(Object obj) { + if (obj instanceof Matrix) { + boolean equal = true; + Matrix other = (Matrix)obj; + for (int i = 0; i < this.storage.length; i++) { + equal &= this.storage[i] == other.storage[i]; + } + return equal; + } + + return super.equals(obj); + } + + /** + * {@inheritDoc} + */ + @Override + public int hashCode() { + return this.toString().hashCode(); + } } |
From: rimestad <rim...@us...> - 2007-11-26 18:09:05
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/test In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24444/src/net/sourceforge/bprocessor/model/test Added Files: MatrixTest.java Log Message: added invert on matrix and made a small but for now useless test of it --- NEW FILE: MatrixTest.java --- //--------------------------------------------------------------------------------- // $Id: MatrixTest.java,v 1.1 2007/11/26 18:09:08 rimestad Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.model.test; import net.sourceforge.bprocessor.model.Matrix; import junit.framework.TestCase; /** * The vertex test class */ public class MatrixTest extends TestCase { /** * Test method for 'net.sourceforge.bprocessor.model.Matrix.inverse()' */ public void testInverse() { Matrix m = new Matrix(new double[]{ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}); Matrix inv = m.invert(); assertTrue(inv.equals(m)); assertEquals(m.determinant(), 1, 0.00000001); m = new Matrix(new double[]{ 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 6, 5, 2, 1}); inv = m.invert(); Matrix result = new Matrix(new double[]{ 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, -5, -6, -2, 1}); assertTrue(inv.equals(result)); } } |
From: rimestad <rim...@us...> - 2007-11-26 18:08:07
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv24017/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java Log Message: Made make component remove the union from the model and made make union make the space a acctual union Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** PopupMenu.java 26 Nov 2007 07:29:05 -0000 1.78 --- PopupMenu.java 26 Nov 2007 18:08:07 -0000 1.79 *************** *** 353,356 **** --- 353,357 ---- public void actionPerformed(ActionEvent event) { Component component = new Component(space); + space.getOwner().remove(space); Project.getInstance().addCalalogObject(component); Project.getInstance().changed(Project.getInstance()); *************** *** 486,489 **** --- 487,491 ---- Mesh copy = mesh.copy(map); Space union = new Space("Union", Space.CONSTRUCTION, true); + union.setUnion(true); for (Vertex current : copy.vertices()) { union.add(current); |
From: Michael L. <he...@us...> - 2007-11-26 13:29:58
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9778/src/net/sourceforge/bprocessor/model Modified Files: Command.java Log Message: refactored extrude Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** Command.java 26 Nov 2007 10:51:00 -0000 1.40 --- Command.java 26 Nov 2007 13:29:59 -0000 1.41 *************** *** 1378,1416 **** } ! private Prism extrude(Surface bottom, double distance) { List<Surface> sides = new LinkedList(); ! Vertex normal = bottom.normal(); ! normal.scaleInPlace(distance); ! List vertices = bottom.getVertices(); ! List edges = bottom.getEdges(); ! int n = vertices.size(); ! Vertex[] v = new Vertex[n]; ! Edge[] e = new Edge[n]; ! Vertex[] vmap = new Vertex[n]; ! Edge[] topmap = new Edge[n]; ! Edge[] sidemap = new Edge[n]; ! Surface[] facemap = new Surface[n]; ! Surface top = null; ! vertices.toArray(v); ! edges.toArray(e); ! ! for (int i = 0; i < n; i++) { ! vmap[i] = v[i].add(normal); ! } ! for (int i = 0; i < n; i++) { ! topmap[i] = new Edge(vmap[i], vmap[(i + 1) % n]); ! } for (int i = 0; i < n; i++) { ! sidemap[i] = new Edge(v[i], vmap[i]); } for (int i = 0; i < n; i++) { ! Edge b = e[i]; Edge r = sidemap[i]; Edge l = sidemap[(i + 1) % n]; ! Edge t = topmap[i]; List newEdges = new LinkedList(); newEdges.add(r); --- 1378,1419 ---- } ! private Prism connect(Surface bottom, Surface top) { ! List<Surface> sides = connect(bottom.getEdges(), top.getEdges()); ! return new Prism(top, bottom, sides); ! } ! ! private List<Surface> connect(List bedges, List tedges) { List<Surface> sides = new LinkedList(); ! List bvertices = Offset.vertices(bedges); ! int n = bedges.size(); ! ! Edge[] be = new Edge[n]; ! Vertex[] bv = new Vertex[n]; ! ! bvertices.toArray(bv); ! bedges.toArray(be); ! ! ! List tvertices = Offset.vertices(tedges); ! ! Edge[] te = new Edge[n]; ! Vertex[] tv = new Vertex[n]; ! ! tvertices.toArray(tv); ! tedges.toArray(te); ! ! Edge[] sidemap = new Edge[n]; for (int i = 0; i < n; i++) { ! sidemap[i] = new Edge(bv[i], tv[i]); } for (int i = 0; i < n; i++) { ! Edge b = be[i]; Edge r = sidemap[i]; Edge l = sidemap[(i + 1) % n]; ! Edge t = te[i]; List newEdges = new LinkedList(); newEdges.add(r); *************** *** 1418,1437 **** newEdges.add(l); newEdges.add(b); ! facemap[i] = new Surface(newEdges); ! sides.add(facemap[i]); } ! { ! List newEdges = new LinkedList(); ! for (int i = 0; i < n; i++) { ! newEdges.add(topmap[n - i - 1]); ! } ! top = new Surface(newEdges); } ! Prism prism = new Prism(top, bottom, sides); return prism; } /** {@inheritDoc} */ @Override --- 1421,1446 ---- newEdges.add(l); newEdges.add(b); ! sides.add(new Surface(newEdges)); } ! return sides; ! } ! ! private Prism extrude(Surface bottom, double distance) { ! Vertex normal = bottom.normal(); ! normal.scaleInPlace(distance); ! HashMap map = new HashMap(); ! Surface top = (Surface) bottom.copy(map); ! ! for (Vertex current : top.getVertices()) { ! current.set(current.add(normal)); } ! Prism prism = connect(bottom, top); return prism; } + + /** {@inheritDoc} */ @Override |
From: Michael L. <he...@us...> - 2007-11-26 10:51:10
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11060/src/net/sourceforge/bprocessor/gui/attrview Modified Files: StringAttribute.java Log Message: extrude uses prism class Index: StringAttribute.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/attrview/StringAttribute.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** StringAttribute.java 20 Oct 2007 17:22:49 -0000 1.18 --- StringAttribute.java 26 Nov 2007 10:51:04 -0000 1.19 *************** *** 271,275 **** Environment global = new Environment(globals, null); Environment env = new Environment(global, new HashMap(), new LinkedList()); ! input = new StringReader("echo (" + editor.getText() + ")"); lexer = new ScriptLexer(input); parser = new ScriptParser(lexer); --- 271,275 ---- Environment global = new Environment(globals, null); Environment env = new Environment(global, new HashMap(), new LinkedList()); ! input = new StringReader("echo " + editor.getText()); lexer = new ScriptLexer(input); parser = new ScriptParser(lexer); *************** *** 278,286 **** Stack stack = new Stack(); function.evaluate(env, stack); Object o = stack.pop(); if (o instanceof Double) { attribute.setValue(o); } else { ! attribute.setValue(0); } } catch (Exception error) { --- 278,287 ---- Stack stack = new Stack(); function.evaluate(env, stack); + System.out.println("stack contains " + stack.size() + " elements"); Object o = stack.pop(); if (o instanceof Double) { attribute.setValue(o); } else { ! attribute.setValue(o); } } catch (Exception error) { |
From: Michael L. <he...@us...> - 2007-11-26 10:51:04
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv10808/src/net/sourceforge/bprocessor/model Modified Files: Command.java Log Message: extrude uses prism class Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** Command.java 26 Nov 2007 07:28:59 -0000 1.39 --- Command.java 26 Nov 2007 10:51:00 -0000 1.40 *************** *** 77,80 **** --- 77,133 ---- /** + * Prism + */ + public static class Prism { + protected Surface top; + protected Surface bottom; + protected List<Surface> sides; + + + /** + * Constructs a Prism + * @param top top surface + * @param bottom bottom surface + * @param sides sides + */ + public Prism (Surface top, Surface bottom, List<Surface> sides) { + this.top = top; + this.bottom = bottom; + this.sides = sides; + } + + /** + * Returns a new prism, which is offset from this prism + * @param distance distance to offset + * @return a new offset prism + */ + public Prism offset(double distance) { + HashMap map = new HashMap(); + Surface t = (Surface) top.copy(map); + Surface b = (Surface) bottom.copy(map); + List<Surface> s = new LinkedList(); + for (Surface current : sides) { + s.add((Surface) current.copy(map)); + } + Offset.offsetIt(t.getEdges(), distance); + Offset.offsetIt(b.getEdges(), distance); + return new Prism(t, b, s); + } + + /** + * Returns the surfaces of this prism + * @return surfaces + */ + public Collection<Surface> surfaces() { + Collection<Surface> surfaces = new LinkedList(); + surfaces.add(top); + surfaces.add(bottom); + surfaces.addAll(sides); + return surfaces; + } + } + + + /** * * *************** *** 1229,1265 **** private Space net; ! private static class Prism { ! protected Surface top; ! protected Surface bottom; ! protected List<Surface> sides; ! ! ! public Prism (Surface top, Surface bottom, List<Surface> sides) { ! this.top = top; ! this.bottom = bottom; ! this.sides = sides; ! } ! ! public Prism offset(double distance) { ! HashMap map = new HashMap(); ! Surface t = (Surface) top.copy(map); ! Surface b = (Surface) bottom.copy(map); ! List<Surface> s = new LinkedList(); ! for (Surface current : sides) { ! s.add((Surface) current.copy(map)); ! } ! Offset.offsetIt(t.getEdges(), distance); ! Offset.offsetIt(b.getEdges(), distance); ! return new Prism(t, b, s); ! } ! ! public Collection<Surface> surfaces() { ! Collection<Surface> surfaces = new LinkedList(); ! surfaces.add(top); ! surfaces.add(bottom); ! surfaces.addAll(sides); ! return surfaces; ! } ! } /** --- 1282,1286 ---- private Space net; ! /** *************** *** 1357,1367 **** } ! ! /** {@inheritDoc} */ ! @Override ! public void evaluate() { ! double distance = parameters.getDouble("distance"); List<Surface> sides = new LinkedList(); ! Surface bottom = (Surface) surface.copy(new HashMap()); Vertex normal = bottom.normal(); normal.scaleInPlace(distance); --- 1378,1384 ---- } ! private Prism extrude(Surface bottom, double distance) { List<Surface> sides = new LinkedList(); ! Vertex normal = bottom.normal(); normal.scaleInPlace(distance); *************** *** 1413,1424 **** } ! List<Surface> surfaces = new LinkedList(); ! surfaces.add(bottom); ! surfaces.addAll(sides); ! surfaces.add(top); ! Space union = new Space("Extrusion", Space.CONSTRUCTION, true); ! Shape.addTo(union, surfaces); ! surface.getOwner().add(union); } --- 1430,1445 ---- } ! Prism prism = new Prism(top, bottom, sides); ! return prism; ! } ! ! /** {@inheritDoc} */ ! @Override ! public void evaluate() { ! double distance = parameters.getDouble("distance"); ! Surface bottom = (Surface) surface.copy(new HashMap()); ! Prism prism = extrude(bottom, distance); Space union = new Space("Extrusion", Space.CONSTRUCTION, true); ! Shape.addTo(union, prism.surfaces()); surface.getOwner().add(union); } |
From: rimestad <rim...@us...> - 2007-11-26 10:30:57
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv2889/src/net/sourceforge/bprocessor/gl/tool Modified Files: FinalMoveTool.java Log Message: Changed InstanceMover to use the systemFor static method for creating a coordinatesystem Index: FinalMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/FinalMoveTool.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** FinalMoveTool.java 23 Nov 2007 10:27:56 -0000 1.35 --- FinalMoveTool.java 26 Nov 2007 10:30:53 -0000 1.36 *************** *** 216,221 **** // convert the handle into the coordinatesystems of the surface and translate //the instance anchor according to that ! Surface onto = (Surface)current.object(); ! CoordinateSystem cs = onto.coordinateSystem().plane().coordinateSystem(); CoordinateSystem anchor = instance.getInstanceAnchor(); anchor.setAttributes(cs.getAttributes()); --- 216,226 ---- // convert the handle into the coordinatesystems of the surface and translate //the instance anchor according to that ! Surface surface = (Surface)current.object(); ! Vertex n = surface.normal(); ! Vertex origin = surface.getFirstVertex(); ! if (!editor.getView().facingFront(surface)) { ! n = n.scale(-1); ! } ! CoordinateSystem cs = CoordinateSystem.systemFor(origin, n); CoordinateSystem anchor = instance.getInstanceAnchor(); anchor.setAttributes(cs.getAttributes()); |
From: Michael L. <he...@us...> - 2007-11-26 07:29:20
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31040/src/net/sourceforge/bprocessor/gui Modified Files: PopupMenu.java Log Message: extrude command Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/PopupMenu.java,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** PopupMenu.java 23 Nov 2007 08:34:10 -0000 1.77 --- PopupMenu.java 26 Nov 2007 07:29:05 -0000 1.78 *************** *** 117,120 **** --- 117,130 ---- menu.add(action); } + { + AbstractAction action = new GeometricMenuAction(surfaces, "Extrude...") { + public void actionPerformed(ActionEvent event) { + Surface surface = (Surface) entities.iterator().next(); + Command command = new Command.Extrude(surface); + AttributeView.instance().display(command); + } + }; + menu.add(action); + } } return menu; |
From: Michael L. <he...@us...> - 2007-11-26 07:29:05
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30870/src/net/sourceforge/bprocessor/model Modified Files: Command.java Log Message: extrude command Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** Command.java 24 Nov 2007 09:01:37 -0000 1.38 --- Command.java 26 Nov 2007 07:28:59 -0000 1.39 *************** *** 1341,1343 **** --- 1341,1426 ---- } + + /** + * Extrude + */ + public static class Extrude extends Command { + private Surface surface; + + /** + * Constructs Extrude command + * @param surface Surface to extrude + */ + public Extrude(Surface surface) { + this.surface = surface; + parameters.put("distance", 1.0); + } + + + /** {@inheritDoc} */ + @Override + public void evaluate() { + double distance = parameters.getDouble("distance"); + List<Surface> sides = new LinkedList(); + Surface bottom = (Surface) surface.copy(new HashMap()); + Vertex normal = bottom.normal(); + normal.scaleInPlace(distance); + List vertices = bottom.getVertices(); + List edges = bottom.getEdges(); + int n = vertices.size(); + Vertex[] v = new Vertex[n]; + Edge[] e = new Edge[n]; + Vertex[] vmap = new Vertex[n]; + Edge[] topmap = new Edge[n]; + Edge[] sidemap = new Edge[n]; + Surface[] facemap = new Surface[n]; + Surface top = null; + vertices.toArray(v); + edges.toArray(e); + + for (int i = 0; i < n; i++) { + vmap[i] = v[i].add(normal); + } + + for (int i = 0; i < n; i++) { + topmap[i] = new Edge(vmap[i], vmap[(i + 1) % n]); + } + + for (int i = 0; i < n; i++) { + sidemap[i] = new Edge(v[i], vmap[i]); + } + + for (int i = 0; i < n; i++) { + Edge b = e[i]; + Edge r = sidemap[i]; + Edge l = sidemap[(i + 1) % n]; + Edge t = topmap[i]; + List newEdges = new LinkedList(); + newEdges.add(r); + newEdges.add(t); + newEdges.add(l); + newEdges.add(b); + facemap[i] = new Surface(newEdges); + sides.add(facemap[i]); + } + + { + List newEdges = new LinkedList(); + for (int i = 0; i < n; i++) { + newEdges.add(topmap[n - i - 1]); + } + top = new Surface(newEdges); + } + + List<Surface> surfaces = new LinkedList(); + surfaces.add(bottom); + surfaces.addAll(sides); + surfaces.add(top); + + Space union = new Space("Extrusion", Space.CONSTRUCTION, true); + Shape.addTo(union, surfaces); + + surface.getOwner().add(union); + } + } } |
From: Michael L. <he...@us...> - 2007-11-24 09:01:41
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv11062/src/net/sourceforge/bprocessor/model Modified Files: Command.java Log Message: Layer command in progress Index: Command.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Command.java,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Command.java 23 Nov 2007 08:34:05 -0000 1.37 --- Command.java 24 Nov 2007 09:01:37 -0000 1.38 *************** *** 1108,1111 **** --- 1108,1128 ---- } + + /** + * Offset the boundary curve + * @param boundary connected list of edges to offset + * @param distance distance of offset + */ + public static void offsetIt(List<Edge> boundary, double distance) { + List<Vertex> vertices = vertices(boundary); + Vertex normal = Surface.normalOf(boundary); + List<Vertex> offset = Offset.offset(vertices, normal, distance); + for (int i = 0; i < vertices.size(); i++) { + Vertex original = vertices.get(i); + Vertex other = offset.get(i); + original.set(other); + } + } + /** {@inheritDoc} */ @Override *************** *** 1169,1182 **** } ! { ! List<Vertex> vertices = Offset.vertices(boundary); ! Vertex normal = Surface.normalOf(boundary); ! List<Vertex> offset = Offset.offset(vertices, normal, -inside + (delta / 2)); ! for (int i = 0; i < vertices.size(); i++) { ! Vertex original = vertices.get(i); ! Vertex other = offset.get(i); ! original.set(other); ! } ! } Space union = new Space("Frame", Space.CONSTRUCTION, true); --- 1186,1190 ---- } ! Offset.offsetIt(boundary, -inside + (delta / 2)); Space union = new Space("Frame", Space.CONSTRUCTION, true); *************** *** 1221,1224 **** --- 1229,1266 ---- private Space net; + private static class Prism { + protected Surface top; + protected Surface bottom; + protected List<Surface> sides; + + + public Prism (Surface top, Surface bottom, List<Surface> sides) { + this.top = top; + this.bottom = bottom; + this.sides = sides; + } + + public Prism offset(double distance) { + HashMap map = new HashMap(); + Surface t = (Surface) top.copy(map); + Surface b = (Surface) bottom.copy(map); + List<Surface> s = new LinkedList(); + for (Surface current : sides) { + s.add((Surface) current.copy(map)); + } + Offset.offsetIt(t.getEdges(), distance); + Offset.offsetIt(b.getEdges(), distance); + return new Prism(t, b, s); + } + + public Collection<Surface> surfaces() { + Collection<Surface> surfaces = new LinkedList(); + surfaces.add(top); + surfaces.add(bottom); + surfaces.addAll(sides); + return surfaces; + } + } + /** * Constructs a frame command *************** *** 1250,1253 **** --- 1292,1296 ---- Space floor = find((String) parameters.get("bottom")); Space exterior = find((String) parameters.get("side")); + double distance = parameters.getDouble("offset"); Surface top = null; *************** *** 1270,1274 **** } } ! Selection.primary().set((List) sides); } --- 1313,1341 ---- } } ! ! Prism p0 = new Prism(top, bottom, sides); ! ! List<Prism> prisms = new LinkedList(); ! { ! Prism current = p0.offset(0); ! prisms.add(current); ! for (int i = 0; i < 3; i++) { ! Prism next = current.offset(distance); ! prisms.add(next); ! if (distance > 0) { ! next.top.addHole(current.top); ! next.bottom.addHole(current.bottom); ! } else { ! current.top.addHole(next.top); ! current.bottom.addHole(next.bottom); ! } ! current = next; ! } ! } ! Space union = new Space("Layer", Space.CONSTRUCTION, true); ! for (Prism current : prisms) { ! Shape.addTo(union, current.surfaces()); ! } ! net.getOwner().add(union); } |
From: Michael L. <he...@us...> - 2007-11-23 12:58:43
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30812/src/net/sourceforge/bprocessor/gl/tool Modified Files: TapeMeasure.java Log Message: fixed a problem in tape-measure Index: TapeMeasure.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/TapeMeasure.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TapeMeasure.java 18 Nov 2007 21:30:17 -0000 1.7 --- TapeMeasure.java 23 Nov 2007 12:58:46 -0000 1.8 *************** *** 158,165 **** direction.scaleInPlace(value); Vertex origin = start.vertex().add(direction); ! Line line = new Line(origin, originalEdge.getDirection(), true, false); insert(line); } else { ! Line line = new Line(start.vertex(), lengthEdge.getDirection(), true, false); insert(line); } --- 158,169 ---- direction.scaleInPlace(value); Vertex origin = start.vertex().add(direction); ! Vertex v = originalEdge.getDirection(); ! v.normalize(); ! Line line = new Line(origin, v, true, false); insert(line); } else { ! Vertex v = lengthEdge.getDirection(); ! v.normalize(); ! Line line = new Line(start.vertex(), v, true, false); insert(line); } |
From: rimestad <rim...@us...> - 2007-11-23 10:35:36
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7101/src/net/sourceforge/bprocessor/gui/actions Modified Files: ImportFileReader.java Log Message: changed alpha on material to opacity Index: ImportFileReader.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions/ImportFileReader.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ImportFileReader.java 12 Nov 2007 19:18:07 -0000 1.14 --- ImportFileReader.java 23 Nov 2007 10:35:39 -0000 1.15 *************** *** 298,302 **** } else if (content[0].equals("d") || content[0].equals("Tr")) { if (content.length >= 2) { ! currentMaterial.setAlpha(Float.parseFloat(content[1])); } } else if (content[0].equals("Ns")) { --- 298,302 ---- } else if (content[0].equals("d") || content[0].equals("Tr")) { if (content.length >= 2) { ! currentMaterial.setOpacity(Float.parseFloat(content[1])); } } else if (content[0].equals("Ns")) { |
From: rimestad <rim...@us...> - 2007-11-23 10:35:33
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7092/src/net/sourceforge/bprocessor/model Modified Files: Material.java Log Message: changed alpha on material to opacity Index: Material.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Material.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Material.java 15 Oct 2007 12:41:24 -0000 1.10 --- Material.java 23 Nov 2007 10:35:35 -0000 1.11 *************** *** 35,39 **** private float[] specularColor; ! private double alpha; private double shininess; --- 35,39 ---- private float[] specularColor; ! private double opacity; private double shininess; *************** *** 49,53 **** setDiffuseColor(new float[]{0.8f, 0.8f, 0.8f}); setSpecularColor(new float[]{1.0f, 1.0f, 1.0f}); ! setAlpha(1.0); setShininess(0.0); setIllumination(0.0); --- 49,53 ---- setDiffuseColor(new float[]{0.8f, 0.8f, 0.8f}); setSpecularColor(new float[]{1.0f, 1.0f, 1.0f}); ! setOpacity(1.0); setShininess(0.0); setIllumination(0.0); *************** *** 104,109 **** * @param alpha The Color */ ! public void setAlpha(double alpha) { ! this.alpha = alpha; } --- 104,109 ---- * @param alpha The Color */ ! public void setOpacity(double alpha) { ! this.opacity = alpha; } *************** *** 188,193 **** * @return the alpha */ ! public double getAlpha() { ! return alpha; } --- 188,193 ---- * @return the alpha */ ! public double getOpacity() { ! return opacity; } *************** *** 249,253 **** res.add(new Attribute("specularColor", new Color(ColorSpace.getInstance(ColorSpace.CS_sRGB), getSpecularColor(), 1.0f))); ! res.add(new Attribute("Aplha", alpha)); res.add(new Attribute("Shininess", shininess)); res.add(new Attribute("Illumination", illumination)); --- 249,253 ---- res.add(new Attribute("specularColor", new Color(ColorSpace.getInstance(ColorSpace.CS_sRGB), getSpecularColor(), 1.0f))); ! res.add(new Attribute("Opacity", opacity)); res.add(new Attribute("Shininess", shininess)); res.add(new Attribute("Illumination", illumination)); *************** *** 278,283 **** Color c = (Color)a.getValue(); setSpecularColor(c.getColorComponents(null)); ! } else if (a.getName().equalsIgnoreCase("alpha")) { ! setAlpha((Double)a.getValue()); } else if (a.getName().equalsIgnoreCase("illumination")) { setIllumination((Double)a.getValue()); --- 278,283 ---- Color c = (Color)a.getValue(); setSpecularColor(c.getColorComponents(null)); ! } else if (a.getName().equalsIgnoreCase("opacity")) { ! setOpacity((Double)a.getValue()); } else if (a.getName().equalsIgnoreCase("illumination")) { setIllumination((Double)a.getValue()); |
From: rimestad <rim...@us...> - 2007-11-23 10:27:53
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3842/src/net/sourceforge/bprocessor/gl/tool Modified Files: FinalMoveTool.java Log Message: Started on instanceMover Index: FinalMoveTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/FinalMoveTool.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** FinalMoveTool.java 18 Nov 2007 21:30:17 -0000 1.34 --- FinalMoveTool.java 23 Nov 2007 10:27:56 -0000 1.35 *************** *** 26,29 **** --- 26,30 ---- import net.sourceforge.bprocessor.model.Geometric; import net.sourceforge.bprocessor.model.Geometry; + import net.sourceforge.bprocessor.model.Matrix; import net.sourceforge.bprocessor.model.Mesh; import net.sourceforge.bprocessor.model.Project; *************** *** 188,191 **** --- 189,241 ---- /** + * A moover for Instances + */ + public class InstanceMove implements Mover { + private Space instance; + private CoordinateSystem handle; + private CoordinateSystem initialCoordinate; + private Matrix translation; + + /** + * Costructor + * @param instance the instance to move + * @param handle the handle to moove acording to + */ + public InstanceMove(Space instance, CoordinateSystem handle) { + this.instance = instance; + this.handle = handle; + this.initialCoordinate = instance.getInstanceAnchor().copy(); + } + + /** + * {@inheritDoc} + */ + public void move(Vertex delta) { + revert(); + if (current.object() instanceof Surface) { + // convert the handle into the coordinatesystems of the surface and translate + //the instance anchor according to that + Surface onto = (Surface)current.object(); + CoordinateSystem cs = onto.coordinateSystem().plane().coordinateSystem(); + CoordinateSystem anchor = instance.getInstanceAnchor(); + anchor.setAttributes(cs.getAttributes()); + anchor.setOrigin(current.vertex()); + } else { + // change i, j, n of the anchor back to its originals and then just move the delta + instance.getInstanceAnchor().setIJN(initialCoordinate.getI(), + initialCoordinate.getJ(), initialCoordinate.getN()); + instance.getInstanceAnchor().move(delta.getX(), delta.getY(), delta.getZ()); + } + } + + /** + * {@inheritDoc} + */ + public void revert() { + instance.getInstanceAnchor().setAttributes(initialCoordinate.getAttributes()); + } + } + + /** * Move Handle * *************** *** 435,441 **** } vertices = Geometry.collect(geometrics); mover = new VectorMove(vertices); ! affected = getAffected(geometrics); current = findIntersection(e); --- 485,501 ---- } + vertices = Geometry.collect(geometrics); mover = new VectorMove(vertices); ! ! if (geometrics.size() == 1) { ! Geometric work = geometrics.iterator().next(); ! if (work instanceof Space) { ! Space space = (Space)work; ! if (space.isInstance()) { ! mover = new InstanceMove(space, space.getInstanceAnchor()); ! } ! } ! } affected = getAffected(geometrics); current = findIntersection(e); |
From: rimestad <rim...@us...> - 2007-11-23 10:27:26
|
Update of /cvsroot/bprocessor/build In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3818 Modified Files: build.xml Log Message: Changed library directory to components and made build script copy it into dist. Index: build.xml =================================================================== RCS file: /cvsroot/bprocessor/build/build.xml,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** build.xml 6 Aug 2007 12:07:43 -0000 1.31 --- build.xml 23 Nov 2007 10:27:29 -0000 1.32 *************** *** 54,57 **** --- 54,58 ---- <fileset dir="${bproc.dir}"> <include name="*.xml"/> + <include name="components/*.bpl"/> </fileset> </copy> |
From: rimestad <rim...@us...> - 2007-11-23 10:27:23
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv3809/src/net/sourceforge/bprocessor/model Modified Files: Persistence.java Log Message: Changed library directory to components and made build script copy it into dist. Index: Persistence.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Persistence.java,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** Persistence.java 19 Nov 2007 09:20:41 -0000 1.60 --- Persistence.java 23 Nov 2007 10:27:26 -0000 1.61 *************** *** 1623,1627 **** Collection<Object> xmls = new LinkedList<Object>(); Collection<Component> library = new LinkedList<Component>(); ! File libdir = new File("Library/"); if (!libdir.exists()) { libdir.createNewFile(); --- 1623,1627 ---- Collection<Object> xmls = new LinkedList<Object>(); Collection<Component> library = new LinkedList<Component>(); ! File libdir = new File("components/"); if (!libdir.exists()) { libdir.createNewFile(); *************** *** 1679,1683 **** */ public static void saveLibrary() throws Exception { ! File fout = new File("library/lib.bpl"); FileOutputStream fos = new FileOutputStream(fout); --- 1679,1683 ---- */ public static void saveLibrary() throws Exception { ! File fout = new File("components/lib.bpl"); FileOutputStream fos = new FileOutputStream(fout); |