bprocessor-commit Mailing List for B-processor (Page 21)
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...> - 2009-03-30 09:16:51
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23329/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java PopupMenu.java Added Files: Tesselator.java Log Message: Tesselation implemented --- NEW FILE: Tesselator.java --- //--------------------------------------------------------------------------------- // $Id: Tesselator.java,v 1.1 2009/03/30 09:16:42 henryml Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.gl.view; import java.util.LinkedList; import java.util.List; import javax.media.opengl.GL; import javax.media.opengl.glu.GLU; import javax.media.opengl.glu.GLUtessellator; import javax.media.opengl.glu.GLUtessellatorCallback; import javax.media.opengl.glu.GLUtessellatorCallbackAdapter; import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; /** * Tesselator divides arbitrary surfaces into triangular patches */ public class Tesselator { private static GLUtessellator tesselator; private static GLU glu; private static Vertex v0; private static Vertex vi; private static List<Surface> triangles; private static int mode; /** * * @param g GLU */ public Tesselator(GLU g) { tesselator = g.gluNewTess(); glu = g; GLUtessellatorCallback callback = new TesselatorCallback(); glu.gluTessCallback(tesselator, GLU.GLU_TESS_BEGIN, callback); glu.gluTessCallback(tesselator, GLU.GLU_TESS_END, callback); glu.gluTessCallback(tesselator, GLU.GLU_TESS_VERTEX, callback); glu.gluTessProperty(tesselator, GLU.GLU_TESS_WINDING_RULE, GLU.GLU_TESS_WINDING_ODD); } private static class TesselatorCallback extends GLUtessellatorCallbackAdapter { /** {@inheritDoc} */ public void begin(int type) { System.out.print("begin "); mode = type; if (type == GL.GL_TRIANGLES) { System.out.println("triangles"); } else if (type == GL.GL_TRIANGLE_STRIP) { System.out.println("triangle-strip"); } else if (type == GL.GL_TRIANGLE_FAN) { System.out.println("triangle-fan"); } else { System.out.println(type); } } /** {@inheritDoc} */ public void end() { System.out.println("end "); v0 = null; vi = null; } /** {@inheritDoc} */ @Override public void vertex(Object object) { double[] vertex = (double[]) object; System.out.println(" " + vertex[0] + ", " + vertex[1] + ", " + vertex[2]); Vertex current = new Vertex(vertex); if (v0 == null) { v0 = current; } else if (vi == null) { vi = current; } else { if (mode == GL.GL_TRIANGLE_FAN || mode == GL.GL_TRIANGLE_STRIP || mode == GL.GL_TRIANGLES) { Edge e0 = new Edge(v0, vi); Edge e1 = new Edge(vi, current); Edge e2 = new Edge(current, v0); List<Edge> edges = new LinkedList(); edges.add(e0); edges.add(e1); edges.add(e2); Surface s = new Surface(edges); triangles.add(s); if (mode == GL.GL_TRIANGLE_FAN) { vi = current; } else if (mode == GL.GL_TRIANGLE_STRIP) { v0 = vi; vi = current; } else if (mode == GL.GL_TRIANGLES) { v0 = null; vi = null; } } } } /** {@inheritDoc} */ @Override public void error(int arg0) { System.out.println(glu.gluErrorString(arg0)); } } /** * Tesselates a surface * @param surface Surface to tesselate * @return List of triangular surfaces */ public List<Surface> tesselate(Surface surface) { System.out.println("Tesselate " + surface); triangles = new LinkedList(); glu.gluTessBeginPolygon(tesselator, null); drawContour(surface); for (Surface current : surface.getHoles()) { if (surface.getOwner() == current.getOwner()) { drawContour(current); } } glu.gluTessEndPolygon(tesselator); return triangles; } private static void drawContour(Surface surface) { List<Vertex> vertices = surface.getVertices(); if (vertices.size() > 2) { vertices.add(vertices.get(0)); glu.gluTessBeginContour(tesselator); for (Vertex current : vertices) { double[] content = current.values(); glu.gluTessVertex(tesselator, content, 0, content); } glu.gluTessEndContour(tesselator); } } } Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.285 retrieving revision 1.286 diff -C2 -d -r1.285 -r1.286 *** View.java 17 Feb 2009 11:08:27 -0000 1.285 --- View.java 30 Mar 2009 09:16:42 -0000 1.286 *************** *** 66,69 **** --- 66,71 ---- private boolean enabled; + + private Tesselator tesselator; /** OBJECTS flag */ *************** *** 475,478 **** --- 477,483 ---- glu = new GLU(); + tesselator = new Tesselator(glu); + + int[] maxplanes = new int[1]; gl.glGetIntegerv(GL.GL_MAX_CLIP_PLANES, maxplanes, 0); *************** *** 553,556 **** --- 558,581 ---- /** + * + * @param surface Surface + */ + public void tesselate(Surface surface) { + List<Surface> surfaces = tesselator.tesselate(surface); + Container owner = surface.getOwner(); + Collection<Surface> holes = new LinkedList(surface.getHoles()); + for (Surface hole : holes) { + hole.erase(); + } + surface.erase(); + + for (Surface current : surfaces) { + owner.insert(current); + } + Selection.primary().clear(); + Project.getInstance().changed(Project.getInstance()); + } + + /** * Apply edge attributes * @param attributes the new attributes Index: PopupMenu.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/PopupMenu.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** PopupMenu.java 3 Nov 2008 14:26:15 -0000 1.25 --- PopupMenu.java 30 Mar 2009 09:16:42 -0000 1.26 *************** *** 183,186 **** --- 183,195 ---- menu.add(action); } + { + AbstractAction action = new GeometricMenuAction(surfaces, "Tesselate") { + public void actionPerformed(ActionEvent event) { + Surface surface = (Surface) entities.iterator().next(); + editor.getView().tesselate(surface); + } + }; + menu.add(action); + } } return menu; *************** *** 388,392 **** menu.add(action); } ! if (CHECKS) { AbstractAction check = new SpaceMenuAction(sp, "Consistency Check") { --- 397,411 ---- menu.add(action); } ! { ! AbstractAction action = new SpaceMenuAction(sp, "Tesselate") { ! public void actionPerformed(ActionEvent event) { ! Collection<Surface> surfaces = new LinkedList(space.getEnvelope()); ! for (Surface current : surfaces) { ! editor.getView().tesselate(current); ! } ! } ! }; ! menu.add(action); ! } if (CHECKS) { AbstractAction check = new SpaceMenuAction(sp, "Consistency Check") { |
From: Michael L. <he...@us...> - 2009-03-30 09:16:46
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23313/src/net/sourceforge/bprocessor/gui Modified Files: GUI.java Log Message: Tesselation implemented Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -d -r1.105 -r1.106 *** GUI.java 13 Feb 2009 11:34:56 -0000 1.105 --- GUI.java 30 Mar 2009 09:16:39 -0000 1.106 *************** *** 591,594 **** --- 591,602 ---- file.add(ppExport); + JMenuItem objExport = new JMenuItem("Export OBJ"); + objExport.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + Project.getInstance().exportOBJ(); + } + }); + file.add(objExport); + file.addSeparator(); |
From: Michael L. <he...@us...> - 2009-02-17 11:08:39
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv6352/src/net/sourceforge/bprocessor/model Modified Files: Project.java Log Message: Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.160 retrieving revision 1.161 diff -C2 -d -r1.160 -r1.161 *** Project.java 17 Feb 2009 10:50:22 -0000 1.160 --- Project.java 17 Feb 2009 11:08:33 -0000 1.161 *************** *** 49,52 **** --- 49,53 ---- import dk.au.perpos.spatialsupport.routefinding.Opening; import dk.au.perpos.spatialsupport.routefinding.Segment; + import dk.au.perpos.spatialsupport.routefinding.io.PPLMPrinter; /** *************** *** 1400,1501 **** } - - private class PPLMPrinter { - private PrintStream out; - private int indent; - - public PPLMPrinter(PrintStream out) { - this.out = out; - this.indent = 0; - } - - public void println(Object object) { - for (int i = 0; i < indent; i++) { - out.print(" "); - } - out.println(object); - } - - public void printPoint(dk.au.perpos.spatialsupport.routefinding.Point point) { - println("<Point X=\"" + point.getX() + "\" Y=\"" + point.getY() + "\" />"); - } - - public void printLocationAttributes(Location location) { - StringBuffer buffer = new StringBuffer(); - buffer.append("<Location "); - buffer.append("LocationID=\"" + location.getId() + "\" "); - buffer.append("Floor=\"" + location.getFloor() + "\" "); - buffer.append("Height=\"" + location.getHeight() + "\" "); - buffer.append("Description=\"" + location.getDescription() + "\""); - buffer.append(">"); - println(buffer); - } - - public void printOpening(Opening opening) { - StringBuffer buffer = new StringBuffer(); - buffer.append("<Opening "); - buffer.append("OpeningID=\"" + opening.getId() + "\" "); - buffer.append("ConnectionID=\"" + opening.getConnection().getId() + "\" "); - buffer.append("Distance=\"" + opening.getDistance() + "\" "); - buffer.append("OpeningDiameter=\"" + opening.getWidth() + "\""); - buffer.append("/>"); - println(buffer); - } - - public void printConnection(dk.au.perpos.spatialsupport.routefinding.Connection connection) { - StringBuffer buffer = new StringBuffer(); - buffer.append("<Connection "); - buffer.append("ConnectionID=\"" + connection.getId() + "\" "); - buffer.append("OpeningID1=\"" + connection.getFrom().getId() + "\" "); - buffer.append("OpeningID2=\"" + connection.getTo().getId() + "\" "); - buffer.append("/>"); - println(buffer); - } - - public void printLocationModel(Location root) { - HashSet<dk.au.perpos.spatialsupport.routefinding.Connection> connections - = new HashSet(); - println("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"); - println("<LocationModel>"); - indent++; - println("<Location LocationID=\"bygning\">"); - indent++; - for (Location node : root.getChildren()) { - printLocationAttributes(node); - indent++; - println("<Boundary>"); - indent++; - for (Segment current : node.getExternalBoundary().getSegments()) { - println("<Segment>"); - indent++; - printPoint(current.getFrom()); - printPoint(current.getTo()); - for (Opening opening : node.getOpenings()) { - if (opening.getSegment() == current) { - printOpening(opening); - } - } - indent--; - println("</Segment>"); - } - indent--; - println("</Boundary>"); - indent--; - for (Opening current : node.getOpenings()) { - connections.add(current.getConnection()); - } - println("</Location>"); - - } - indent--; - println("</Location>"); - for (dk.au.perpos.spatialsupport.routefinding.Connection current : connections) { - printConnection(current); - } - indent--; - println("</LocationModel>"); - } - } - /** * --- 1401,1404 ---- |
From: Michael L. <he...@us...> - 2009-02-17 11:08:38
|
Update of /cvsroot/bprocessor/tools/perpos In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv6334/perpos Modified Files: routefinding.jar Log Message: Index: routefinding.jar =================================================================== RCS file: /cvsroot/bprocessor/tools/perpos/routefinding.jar,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsSBtvHe and /tmp/cvsIz9EWi differ |
From: Michael L. <he...@us...> - 2009-02-17 11:08:34
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv6308/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.284 retrieving revision 1.285 diff -C2 -d -r1.284 -r1.285 *** View.java 17 Feb 2009 10:49:23 -0000 1.284 --- View.java 17 Feb 2009 11:08:27 -0000 1.285 *************** *** 2158,2165 **** } }*/ - } else { - if (entity != null) { - - } } } --- 2158,2161 ---- |
From: Michael L. <he...@us...> - 2009-02-17 10:50:30
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/bridge In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2910/src/net/sourceforge/bprocessor/model/bridge Modified Files: Sensor.java Mote.java Log Message: Index: Sensor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/bridge/Sensor.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Sensor.java 4 Feb 2009 15:09:52 -0000 1.2 --- Sensor.java 17 Feb 2009 10:50:22 -0000 1.3 *************** *** 67,70 **** --- 67,71 ---- */ public void update() { + System.out.println("update sensors"); for (Mote current : motes) { long id = current.id(); *************** *** 72,75 **** --- 73,77 ---- DataItem item = Project.latest((int)id); if (item != null) { + System.out.println(" addinng " + item); current.add(item); } Index: Mote.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/bridge/Mote.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Mote.java 4 Feb 2009 15:09:52 -0000 1.2 --- Mote.java 17 Feb 2009 10:50:22 -0000 1.3 *************** *** 60,64 **** --- 60,66 ---- */ public void add(DataItem item) { + System.out.println(" " + item.timestamp() + " | " + lasttime); if (item.timestamp() > lasttime) { + System.out.println(" appending"); items.add(item); lasttime = item.timestamp(); |
From: Michael L. <he...@us...> - 2009-02-17 10:50:28
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2910/src/net/sourceforge/bprocessor/model Modified Files: Project.java Log Message: Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.159 retrieving revision 1.160 diff -C2 -d -r1.159 -r1.160 *** Project.java 13 Feb 2009 11:34:53 -0000 1.159 --- Project.java 17 Feb 2009 10:50:22 -0000 1.160 *************** *** 66,70 **** /** */ public static final boolean SENSE = false; ! private static final String HOST = "dhcp-11-71-167"; private static final int PORT = 8800; --- 66,70 ---- /** */ public static final boolean SENSE = false; ! private static final String HOST = "localhost"; private static final int PORT = 8800; *************** *** 251,255 **** if (result.equals("data")) { ! long timestamp = deserializer.readInt(); long data = deserializer.readInt(); DataItem item = new DataItem(id, timestamp, (short) 1, data); --- 251,256 ---- if (result.equals("data")) { ! String stamp = deserializer.readString(); ! long timestamp = Long.valueOf(stamp); long data = deserializer.readInt(); DataItem item = new DataItem(id, timestamp, (short) 1, data); *************** *** 1438,1442 **** buffer.append("Distance=\"" + opening.getDistance() + "\" "); buffer.append("OpeningDiameter=\"" + opening.getWidth() + "\""); ! buffer.append(">"); println(buffer); } --- 1439,1443 ---- buffer.append("Distance=\"" + opening.getDistance() + "\" "); buffer.append("OpeningDiameter=\"" + opening.getWidth() + "\""); ! buffer.append("/>"); println(buffer); } *************** *** 1448,1452 **** buffer.append("OpeningID1=\"" + connection.getFrom().getId() + "\" "); buffer.append("OpeningID2=\"" + connection.getTo().getId() + "\" "); ! buffer.append(">"); println(buffer); } --- 1449,1453 ---- buffer.append("OpeningID1=\"" + connection.getFrom().getId() + "\" "); buffer.append("OpeningID2=\"" + connection.getTo().getId() + "\" "); ! buffer.append("/>"); println(buffer); } |
From: Michael L. <he...@us...> - 2009-02-17 10:49:29
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2739/src/net/sourceforge/bprocessor/gl/view Modified Files: View.java Log Message: removed warning Index: View.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/View.java,v retrieving revision 1.283 retrieving revision 1.284 diff -C2 -d -r1.283 -r1.284 *** View.java 10 Sep 2008 22:53:50 -0000 1.283 --- View.java 17 Feb 2009 10:49:23 -0000 1.284 *************** *** 2160,2164 **** } else { if (entity != null) { ! log.warn("There were a update event on a undecided entity " + entity.getClass()); } } --- 2160,2164 ---- } else { if (entity != null) { ! } } |
From: Michael L. <he...@us...> - 2009-02-13 13:17:22
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv28328/src/net/sourceforge/bprocessor/gui Modified Files: GUI.java Log Message: PPLM generation Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -d -r1.104 -r1.105 *** GUI.java 12 Feb 2009 12:35:23 -0000 1.104 --- GUI.java 13 Feb 2009 11:34:56 -0000 1.105 *************** *** 579,586 **** jlmaExport.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ! Project.getInstance().export(); } }); file.add(jlmaExport); file.addSeparator(); --- 579,594 ---- jlmaExport.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ! Project.getInstance().exportJLMA(); } }); file.add(jlmaExport); + JMenuItem ppExport = new JMenuItem("Export PPLM"); + ppExport.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + Project.getInstance().exportPPLM(); + } + }); + file.add(ppExport); + file.addSeparator(); |
From: Michael L. <he...@us...> - 2009-02-13 13:17:16
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv28297/src/net/sourceforge/bprocessor/model Modified Files: Project.java Log Message: PPLM generation Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.158 retrieving revision 1.159 diff -C2 -d -r1.158 -r1.159 *** Project.java 12 Feb 2009 12:35:20 -0000 1.158 --- Project.java 13 Feb 2009 11:34:53 -0000 1.159 *************** *** 1265,1272 **** } ! /** ! * ! */ ! public void export() { Location root = new Location(); root.setId("building"); --- 1265,1314 ---- } ! ! private boolean eq(dk.au.perpos.spatialsupport.routefinding.Point p1, ! dk.au.perpos.spatialsupport.routefinding.Point p2) { ! if (p1.getX() != p2.getX()) { ! return false; ! } ! if (p1.getY() != p2.getY()) { ! return false; ! } ! return true; ! } ! private boolean eq(Segment s1, Segment s2) { ! if (eq(s1.getFrom(), s2.getFrom()) && eq(s1.getTo(), s2.getTo())) { ! return true; ! } ! if (eq(s1.getFrom(), s2.getTo()) && eq(s1.getTo(), s2.getFrom())) { ! return true; ! } ! return false; ! } ! private Segment find(Location location, Segment segment) { ! Boundary boundary = location.getExternalBoundary(); ! for (Segment current : boundary.getSegments()) { ! if (eq(current, segment)) { ! return current; ! } ! } ! return null; ! } ! ! private dk.au.perpos.spatialsupport.routefinding.Point convert(Vertex vertex) { ! dk.au.perpos.spatialsupport.routefinding.Point point ! = new dk.au.perpos.spatialsupport.routefinding.Point(); ! point.setX(vertex.getX()); ! point.setY(vertex.getY()); ! return point; ! } ! ! private Segment convert(Edge edge) { ! Segment segment = new Segment(); ! segment.setFrom(convert(edge.getFrom())); ! segment.setTo(convert(edge.getTo())); ! return segment; ! } ! ! private Location createLocationModel() { Location root = new Location(); root.setId("building"); *************** *** 1274,1277 **** --- 1316,1321 ---- Map<Surface, Location> map = new HashMap(); Map<Edge, List<Surface>> e2s = new HashMap(); + int openingId = 0; + int connectionId = 0; for (Edge edge : world().getEdges()) { e2s.put(edge, new LinkedList()); *************** *** 1285,1289 **** Location node = new Location(); map.put(surface, node); ! List<dk.au.perpos.spatialsupport.routefinding.Point> points = new LinkedList(); for (Vertex vertex : surface.getVertices()) { --- 1329,1333 ---- Location node = new Location(); map.put(surface, node); ! node.setHeight(3); List<dk.au.perpos.spatialsupport.routefinding.Point> points = new LinkedList(); for (Vertex vertex : surface.getVertices()) { *************** *** 1317,1321 **** } node.setId(name); ! node.setDescription("cell"); root.addChild(node); } --- 1361,1365 ---- } node.setId(name); ! node.setDescription("room"); root.addChild(node); } *************** *** 1328,1340 **** --- 1372,1515 ---- Location n2 = map.get(s2); Opening o1 = new Opening(); + openingId++; + o1.setId("opening-" + String.valueOf(openingId)); + Segment segment = convert(edge); + Segment seg1 = find(n1, segment); + o1.setSegment(seg1); + o1.setWidth(edge.getLength()); n1.addOpening(o1); + Opening o2 = new Opening(); + openingId++; + o2.setId("opening-" + String.valueOf(openingId)); + Segment seg2 = find(n2, segment); + o2.setSegment(seg2); + o2.setWidth(edge.getLength()); n2.addOpening(o2); + dk.au.perpos.spatialsupport.routefinding.Connection connection = new dk.au.perpos.spatialsupport.routefinding.Connection(); + connectionId++; + connection.setId("connection-" + String.valueOf(connectionId)); connection.setFrom(o1); connection.setTo(o2); } } + return root; + } + + + private class PPLMPrinter { + private PrintStream out; + private int indent; + + public PPLMPrinter(PrintStream out) { + this.out = out; + this.indent = 0; + } + + public void println(Object object) { + for (int i = 0; i < indent; i++) { + out.print(" "); + } + out.println(object); + } + + public void printPoint(dk.au.perpos.spatialsupport.routefinding.Point point) { + println("<Point X=\"" + point.getX() + "\" Y=\"" + point.getY() + "\" />"); + } + + public void printLocationAttributes(Location location) { + StringBuffer buffer = new StringBuffer(); + buffer.append("<Location "); + buffer.append("LocationID=\"" + location.getId() + "\" "); + buffer.append("Floor=\"" + location.getFloor() + "\" "); + buffer.append("Height=\"" + location.getHeight() + "\" "); + buffer.append("Description=\"" + location.getDescription() + "\""); + buffer.append(">"); + println(buffer); + } + + public void printOpening(Opening opening) { + StringBuffer buffer = new StringBuffer(); + buffer.append("<Opening "); + buffer.append("OpeningID=\"" + opening.getId() + "\" "); + buffer.append("ConnectionID=\"" + opening.getConnection().getId() + "\" "); + buffer.append("Distance=\"" + opening.getDistance() + "\" "); + buffer.append("OpeningDiameter=\"" + opening.getWidth() + "\""); + buffer.append(">"); + println(buffer); + } + + public void printConnection(dk.au.perpos.spatialsupport.routefinding.Connection connection) { + StringBuffer buffer = new StringBuffer(); + buffer.append("<Connection "); + buffer.append("ConnectionID=\"" + connection.getId() + "\" "); + buffer.append("OpeningID1=\"" + connection.getFrom().getId() + "\" "); + buffer.append("OpeningID2=\"" + connection.getTo().getId() + "\" "); + buffer.append(">"); + println(buffer); + } + + public void printLocationModel(Location root) { + HashSet<dk.au.perpos.spatialsupport.routefinding.Connection> connections + = new HashSet(); + println("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"); + println("<LocationModel>"); + indent++; + println("<Location LocationID=\"bygning\">"); + indent++; + for (Location node : root.getChildren()) { + printLocationAttributes(node); + indent++; + println("<Boundary>"); + indent++; + for (Segment current : node.getExternalBoundary().getSegments()) { + println("<Segment>"); + indent++; + printPoint(current.getFrom()); + printPoint(current.getTo()); + for (Opening opening : node.getOpenings()) { + if (opening.getSegment() == current) { + printOpening(opening); + } + } + indent--; + println("</Segment>"); + } + indent--; + println("</Boundary>"); + indent--; + for (Opening current : node.getOpenings()) { + connections.add(current.getConnection()); + } + println("</Location>"); + + } + indent--; + println("</Location>"); + for (dk.au.perpos.spatialsupport.routefinding.Connection current : connections) { + printConnection(current); + } + indent--; + println("</LocationModel>"); + } + } + + /** + * + */ + public void exportPPLM() { + Location root = createLocationModel(); + PrintStream out = System.out; + PPLMPrinter printer = new PPLMPrinter(out); + printer.printLocationModel(root); + } + + /** + * + */ + public void exportJLMA() { + Location root = createLocationModel(); PrintStream out = System.out; out.println("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"); |
From: Michael L. <he...@us...> - 2009-02-13 13:16:49
|
Update of /cvsroot/bprocessor/tools/perpos In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv28350/perpos Modified Files: routefinding.jar Log Message: PPLM generation Index: routefinding.jar =================================================================== RCS file: /cvsroot/bprocessor/tools/perpos/routefinding.jar,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvscvVUmd and /tmp/cvsGc3w2c differ |
From: Michael L. <he...@us...> - 2009-02-12 12:35:32
|
Update of /cvsroot/bprocessor/tools/perpos In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv3254/perpos Added Files: routefinding.jar Log Message: Save as jlma --- NEW FILE: routefinding.jar --- (This appears to be a binary file; contents omitted.) |
From: Michael L. <he...@us...> - 2009-02-12 12:35:29
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv3226/src/net/sourceforge/bprocessor/gui Modified Files: GUI.java Log Message: Save as jlma Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -d -r1.103 -r1.104 *** GUI.java 4 Feb 2009 15:09:44 -0000 1.103 --- GUI.java 12 Feb 2009 12:35:23 -0000 1.104 *************** *** 575,579 **** fileExport.setEnabled(false); file.add(fileExport); ! file.addSeparator(); --- 575,586 ---- fileExport.setEnabled(false); file.add(fileExport); ! ! JMenuItem jlmaExport = new JMenuItem("Export JLMA"); ! jlmaExport.addActionListener(new ActionListener() { ! public void actionPerformed(ActionEvent e) { ! Project.getInstance().export(); ! } ! }); ! file.add(jlmaExport); file.addSeparator(); |
From: Michael L. <he...@us...> - 2009-02-12 12:35:28
|
Update of /cvsroot/bprocessor/model In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv3177 Modified Files: .classpath build.xml Log Message: Save as jlma Index: .classpath =================================================================== RCS file: /cvsroot/bprocessor/model/.classpath,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** .classpath 21 Nov 2006 17:47:53 -0000 1.12 --- .classpath 12 Feb 2009 12:35:19 -0000 1.13 *************** *** 8,11 **** --- 8,12 ---- <classpathentry kind="lib" path="/tools/junit/junit.jar"/> <classpathentry exported="true" kind="lib" path="xml"/> + <classpathentry kind="lib" path="/tools/perpos/routefinding.jar"/> <classpathentry kind="output" path="build"/> </classpath> Index: build.xml =================================================================== RCS file: /cvsroot/bprocessor/model/build.xml,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** build.xml 25 Jun 2007 09:02:46 -0000 1.19 --- build.xml 12 Feb 2009 12:35:19 -0000 1.20 *************** *** 56,59 **** --- 56,64 ---- </fileset> </copy> + <copy todir="${lib.dir}"> + <fileset dir="${tools.dir}/perpos"> + <include name="**/*"/> + </fileset> + </copy> <copy todir="${lib.dir}"> <fileset dir="${tools.dir}/junit"> |
From: Michael L. <he...@us...> - 2009-02-12 12:35:28
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv3177/src/net/sourceforge/bprocessor/model Modified Files: Project.java Log Message: Save as jlma Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.157 retrieving revision 1.158 diff -C2 -d -r1.157 -r1.158 *** Project.java 4 Feb 2009 15:09:52 -0000 1.157 --- Project.java 12 Feb 2009 12:35:20 -0000 1.158 *************** *** 14,17 **** --- 14,19 ---- import java.io.InputStream; import java.io.OutputStream; + import java.io.PrintStream; + import java.net.InetAddress; import java.net.InetSocketAddress; *************** *** 43,46 **** --- 45,53 ---- import org.apache.log4j.Logger; + import dk.au.perpos.spatialsupport.routefinding.Boundary; + import dk.au.perpos.spatialsupport.routefinding.Location; + import dk.au.perpos.spatialsupport.routefinding.Opening; + import dk.au.perpos.spatialsupport.routefinding.Segment; + /** * The Project *************** *** 1257,1260 **** --- 1264,1362 ---- return library; } + + /** + * + */ + public void export() { + Location root = new Location(); + root.setId("building"); + root.setDescription("none"); + Map<Surface, Location> map = new HashMap(); + Map<Edge, List<Surface>> e2s = new HashMap(); + for (Edge edge : world().getEdges()) { + e2s.put(edge, new LinkedList()); + } + for (Surface surface : world().getSurfaces()) { + + for (Edge edge : surface.getEdges()) { + List<Surface> surfaces = e2s.get(edge); + surfaces.add(surface); + } + Location node = new Location(); + map.put(surface, node); + + List<dk.au.perpos.spatialsupport.routefinding.Point> points = new LinkedList(); + for (Vertex vertex : surface.getVertices()) { + dk.au.perpos.spatialsupport.routefinding.Point point + = new dk.au.perpos.spatialsupport.routefinding.Point(); + point.setX(vertex.getX()); + point.setY(vertex.getY()); + points.add(point); + } + Boundary area = new Boundary(); + { + dk.au.perpos.spatialsupport.routefinding.Point previous = points.get(points.size() - 1); + for (dk.au.perpos.spatialsupport.routefinding.Point current : points) { + Segment segment = new Segment(); + segment.setFrom(previous); + segment.setTo(current); + area.add(segment); + previous = current; + } + } + + node.setExternalBoundary(area); + Space front = surface.getFrontDomain(); + Space back = surface.getBackDomain(); + String name = "room"; + if (!front.isVoid()) { + name = front.getName(); + } + if (!back.isVoid()) { + name = back.getName(); + } + node.setId(name); + node.setDescription("cell"); + root.addChild(node); + } + for (Edge edge : world.getEdges()) { + if (edge.isSmooth()) { + List<Surface> surfaces = e2s.get(edge); + Surface s1 = surfaces.get(0); + Surface s2 = surfaces.get(1); + Location n1 = map.get(s1); + Location n2 = map.get(s2); + Opening o1 = new Opening(); + n1.addOpening(o1); + Opening o2 = new Opening(); + n2.addOpening(o2); + dk.au.perpos.spatialsupport.routefinding.Connection connection + = new dk.au.perpos.spatialsupport.routefinding.Connection(); + connection.setFrom(o1); + connection.setTo(o2); + } + } + PrintStream out = System.out; + out.println("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"); + out.println("<GST>"); + out.println("<GSTNode name=\"bygning\">"); + for (Location node : root.getChildren()) { + out.println("<GSTNode name =\"" + node.getId() + "\">"); + out.println("<Area>"); + for (dk.au.perpos.spatialsupport.routefinding.Point point + : node.getExternalBoundary().getPoints()) { + out.println("<Point2D x=\"" + point.getX() + "\" y=\"" + point.getY() + "\" />"); + } + out.println("</Area>"); + out.println("<Type type=\"" + node.getDescription() + "\" />"); + for (Location other : node.getConnected()) { + out.println("<Connected to=\"ali://bygning/" + other.getId() + "\" />"); + } + out.println("</GSTNode>"); + + } + out.println("</GSTNode>"); + out.println("</GST>"); + } /** |
From: Michael L. <he...@us...> - 2009-02-12 11:02:49
|
Update of /cvsroot/bprocessor/tools/perpos In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1558/perpos Log Message: Directory /cvsroot/bprocessor/tools/perpos added to the repository |
From: Michael L. <he...@us...> - 2009-02-04 15:09:59
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31700/src/net/sourceforge/bprocessor/gui Modified Files: GUI.java Log Message: Sensors Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** GUI.java 3 Nov 2008 14:26:21 -0000 1.102 --- GUI.java 4 Feb 2009 15:09:44 -0000 1.103 *************** *** 796,799 **** --- 796,807 ---- Project.getInstance().checkpoint(); Project.getInstance().changed(Project.getInstance()); + if (Project.SENSE) { + Timer timer = new Timer (300, new ActionListener() { + public void actionPerformed(ActionEvent e) { + Project.getInstance().updateSensors(); + } + }); + timer.start(); + } } /** |
From: Michael L. <he...@us...> - 2009-02-04 15:09:59
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31741/src/net/sourceforge/bprocessor/model Modified Files: Surface.java Project.java Log Message: Sensors Index: Surface.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Surface.java,v retrieving revision 1.221 retrieving revision 1.222 diff -C2 -d -r1.221 -r1.222 *** Surface.java 23 Oct 2008 05:35:36 -0000 1.221 --- Surface.java 4 Feb 2009 15:09:52 -0000 1.222 *************** *** 927,931 **** /** ! * A method for controlled extrusion (like a push/pull tool) * @param delta The distance to extrude * @param sides Pass a list for the created surfaces --- 927,931 ---- /** ! * A method for controlled extrusion. * @param delta The distance to extrude * @param sides Pass a list for the created surfaces Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.156 retrieving revision 1.157 diff -C2 -d -r1.156 -r1.157 *** Project.java 3 Nov 2008 14:26:18 -0000 1.156 --- Project.java 4 Feb 2009 15:09:52 -0000 1.157 *************** *** 12,15 **** --- 12,17 ---- import java.io.File; import java.io.IOException; + import java.io.InputStream; + import java.io.OutputStream; import java.net.InetAddress; import java.net.InetSocketAddress; *************** *** 32,35 **** --- 34,38 ---- import net.sourceforge.bprocessor.model.bridge.Sensor; import net.sourceforge.bprocessor.model.bridge.Serializer; + import net.sourceforge.bprocessor.model.bridge.UnSerializer; import net.sourceforge.bprocessor.model.modellor.InnerWallModellor; import net.sourceforge.bprocessor.model.modellor.ModelBathModellor2; *************** *** 39,42 **** --- 42,46 ---- import org.apache.log4j.Logger; + /** * The Project *************** *** 54,58 **** /** */ ! private static final boolean SENSE = false; /** The observers */ --- 58,64 ---- /** */ ! public static final boolean SENSE = false; ! private static final String HOST = "dhcp-11-71-167"; ! private static final int PORT = 8800; /** The observers */ *************** *** 147,153 **** */ public static List<Integer> motes() throws IOException { ! InetAddress address = InetAddress.getByName("dhcp-11-71-167"); ! int port = 15342; ! SocketAddress endpoint = new InetSocketAddress(address, port); Socket socket = new Socket(); socket.connect(endpoint, 2000); --- 153,158 ---- */ public static List<Integer> motes() throws IOException { ! InetAddress address = InetAddress.getByName(HOST); ! SocketAddress endpoint = new InetSocketAddress(address, PORT); Socket socket = new Socket(); socket.connect(endpoint, 2000); *************** *** 171,174 **** --- 176,195 ---- /** * + * @return List of sensor-ids + * @throws IOException IOException + */ + public static List<Integer> sensors() throws IOException { + List<Integer> result = new LinkedList(); + result.add(15198069); + result.add(15198041); + result.add(15198042); + result.add(15198043); + result.add(15198044); + result.add(15198028); + return result; + } + + /** + * * @param id moteid * @return data *************** *** 176,182 **** */ public static List<DataItem> data(int id) throws IOException { ! InetAddress address = InetAddress.getByName("dhcp-11-71-167"); ! int port = 15342; ! SocketAddress endpoint = new InetSocketAddress(address, port); Socket socket = new Socket(); socket.connect(endpoint, 2000); --- 197,202 ---- */ public static List<DataItem> data(int id) throws IOException { ! InetAddress address = InetAddress.getByName(HOST); ! SocketAddress endpoint = new InetSocketAddress(address, PORT); Socket socket = new Socket(); socket.connect(endpoint, 2000); *************** *** 184,188 **** ByteArrayOutputStream output = new ByteArrayOutputStream(); Serializer serializer = new Serializer(output); ! serializer.writeString("data"); serializer.writeInt(id); connection.write(output.toByteArray()); --- 204,208 ---- ByteArrayOutputStream output = new ByteArrayOutputStream(); Serializer serializer = new Serializer(output); ! serializer.writeString("latest"); serializer.writeInt(id); connection.write(output.toByteArray()); *************** *** 205,208 **** --- 225,259 ---- /** * + * @param id moteid + * @return data + * @throws IOException error + */ + public static DataItem latest(int id) throws IOException { + InetAddress address = InetAddress.getByName(HOST); + SocketAddress endpoint = new InetSocketAddress(address, PORT); + Socket socket = new Socket(); + socket.connect(endpoint, 2000); + OutputStream output = socket.getOutputStream(); + Serializer serializer = new Serializer(output); + serializer.writeString("latest"); + serializer.writeInt(id); + + InputStream input = socket.getInputStream(); + UnSerializer deserializer = new UnSerializer(input); + String result = deserializer.readString(); + + if (result.equals("data")) { + long timestamp = deserializer.readInt(); + long data = deserializer.readInt(); + DataItem item = new DataItem(id, timestamp, (short) 1, data); + return item; + } else { + return null; + } + } + + + /** + * * @return boolean */ *************** *** 285,289 **** if (SENSE) { try { ! sensor.init(motes()); } catch (IOException e) { // empty --- 336,340 ---- if (SENSE) { try { ! sensor.init(sensors()); } catch (IOException e) { // empty *************** *** 1206,1208 **** --- 1257,1266 ---- return library; } + + /** + * + */ + public void updateSensors() { + sensor.update(); + } } |
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/bridge In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31741/src/net/sourceforge/bprocessor/model/bridge Modified Files: Sensor.java DeSerializer.java Serializer.java DataItem.java Mote.java Added Files: UnSerializer.java Log Message: Sensors --- NEW FILE: UnSerializer.java --- //--------------------------------------------------------------------------------- // $Id: UnSerializer.java,v 1.1 2009/02/04 15:09:52 henryml Exp $ // // Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net) // Released under the Lesser GNU Public License v2.1 //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.model.bridge; import java.io.IOException; import java.io.InputStream; import java.math.BigInteger; /** * */ public class UnSerializer { private InputStream input; /** * * @param input InputStream */ public UnSerializer(InputStream input) { this.input = input; } /** * * @return byte * @throws IOException IOException */ public byte readByte() throws IOException { byte value = (byte) input.read(); return value; } /** * * @return int * @throws IOException IOException */ public int readInt() throws IOException { int value = 0; int b1 = readByte(); int b2 = readByte(); int b3 = readByte(); int b4 = readByte(); value |= 0xFF & (b1 << 0); value |= 0xFF00 & (b2 << 8); value |= 0xFF0000 & (b3 << 16); value |= 0xFF000000 & (b4 << 24); return value; } /** * * @return byte[] * @throws IOException IOException */ public byte[] readBytes() throws IOException { int length = readInt(); byte[] bytes = new byte[length]; for (int i = 0; i < length; i++) { bytes[i] = readByte(); } return bytes; } /** * * @return String * @throws IOException IOException */ public String readString() throws IOException { return new String(readBytes()); } /** * * @return BigInteger * @throws IOException IOException */ public BigInteger readBigInteger() throws IOException { return new BigInteger(readBytes()); } } Index: Mote.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/bridge/Mote.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Mote.java 22 Sep 2008 15:58:09 -0000 1.1 --- Mote.java 4 Feb 2009 15:09:52 -0000 1.2 *************** *** 23,27 **** private List<DataItem> items; private long lasttime; ! /** * --- 23,27 ---- private List<DataItem> items; private long lasttime; ! /** * *************** *** 33,37 **** lasttime = 0; } ! /** * --- 33,45 ---- lasttime = 0; } ! ! /** ! * ! * @return id ! */ ! public long id() { ! return id; ! } ! /** * *************** *** 47,54 **** } /** {@inheritDoc} */ @Override public void delete() { ! } --- 55,81 ---- } + /** + * + * @param item DataItem + */ + public void add(DataItem item) { + if (item.timestamp() > lasttime) { + items.add(item); + lasttime = item.timestamp(); + } + } + + /** + * + * @return data items + */ + public List<DataItem> items() { + return items; + } + /** {@inheritDoc} */ @Override public void delete() { ! } *************** *** 70,74 **** public void setAttributes(List<Attribute> attributes) { // TODO Auto-generated method stub ! } --- 97,101 ---- public void setAttributes(List<Attribute> attributes) { // TODO Auto-generated method stub ! } Index: DeSerializer.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/bridge/DeSerializer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DeSerializer.java 22 Sep 2008 15:58:09 -0000 1.1 --- DeSerializer.java 4 Feb 2009 15:09:52 -0000 1.2 *************** *** 54,58 **** */ public String readString() { - readByte(); int length = readInt(); StringBuffer buffer = new StringBuffer(length); --- 54,57 ---- Index: Sensor.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/bridge/Sensor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Sensor.java 22 Sep 2008 15:58:09 -0000 1.1 --- Sensor.java 4 Feb 2009 15:09:52 -0000 1.2 *************** *** 8,15 **** --- 8,17 ---- package net.sourceforge.bprocessor.model.bridge; + import java.io.IOException; import java.util.LinkedList; import java.util.List; import net.sourceforge.bprocessor.model.Entity; + import net.sourceforge.bprocessor.model.Project; /** *************** *** 60,62 **** --- 62,83 ---- return "Motes"; } + + /** + * + */ + public void update() { + for (Mote current : motes) { + long id = current.id(); + try { + DataItem item = Project.latest((int)id); + if (item != null) { + current.add(item); + } + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + Project.getInstance().changed(this); + } } Index: DataItem.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/bridge/DataItem.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DataItem.java 22 Sep 2008 15:58:09 -0000 1.1 --- DataItem.java 4 Feb 2009 15:09:52 -0000 1.2 *************** *** 8,15 **** package net.sourceforge.bprocessor.model.bridge; /** * */ ! public class DataItem { private int id; private long timestamp; --- 8,23 ---- package net.sourceforge.bprocessor.model.bridge; + import java.util.Date; + import java.util.LinkedList; + import java.util.List; + + import net.sourceforge.bprocessor.model.Attribute; + import net.sourceforge.bprocessor.model.Entity; + import net.sourceforge.bprocessor.model.Parametric; + /** * */ ! public class DataItem extends Entity implements Parametric { private int id; private long timestamp; *************** *** 38,40 **** --- 46,80 ---- return timestamp; } + + /** {@inheritDoc} */ + @Override + public void delete() { + // TODO Auto-generated method stub + + } + + /** {@inheritDoc} */ + public List<Attribute> getAttributes() { + return new LinkedList(); + } + + /** {@inheritDoc} */ + public void setAttributes(List<Attribute> attributes) { + // TODO Auto-generated method stub + + } + + /** {@inheritDoc} */ + public String title() { + // TODO Auto-generated method stub + return "Data"; + } + + /** + * {@inheritDoc} + */ + public String getName() { + Date date = new Date(timestamp); + return date + " | " + data; + } } Index: Serializer.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/bridge/Serializer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Serializer.java 22 Sep 2008 15:58:09 -0000 1.1 --- Serializer.java 4 Feb 2009 15:09:52 -0000 1.2 *************** *** 6,15 **** //--------------------------------------------------------------------------------- - package net.sourceforge.bprocessor.model.bridge; import java.io.IOException; import java.io.OutputStream; ! /** --- 6,14 ---- //--------------------------------------------------------------------------------- package net.sourceforge.bprocessor.model.bridge; import java.io.IOException; import java.io.OutputStream; ! import java.math.BigInteger; /** *************** *** 18,23 **** public class Serializer { private OutputStream output; /** - * * @param output OutputStream */ --- 17,22 ---- public class Serializer { private OutputStream output; + /** * @param output OutputStream */ *************** *** 25,73 **** this.output = output; } - /** - * * @param value byte */ ! public void writeByte(byte value) { ! try { ! output.write(value); ! } catch (IOException e) { ! // empty ! } } /** - * * @param value int */ ! public void writeInt(int value) { ! writeByte((byte) (value >> 0)); ! writeByte((byte) (value >> 8)); ! writeByte((byte) (value >> 16)); ! writeByte((byte) (value >> 24)); } /** ! * ! * @param value String */ ! public void writeString(String value) { ! int length = value.length(); ! writeByte((byte) 0); ! writeInt(length); ! for (int index = 0; index < length; index++) { ! writeByte((byte) value.charAt(index)); } - writeByte((byte) 0); } /** ! * ! * @param buffer bytes */ ! public void writeBuffer(byte[] buffer) { ! int length = buffer.length; ! writeInt(length); ! for (int index = 0; index < length; index++) { ! writeByte(buffer[index]); ! } } } --- 24,71 ---- this.output = output; } /** * @param value byte + * @throws IOException IOException */ ! public void writeByte(byte value) throws IOException { ! output.write((int) value); } /** * @param value int + * @throws IOException IOException */ ! public void writeInt(int value) throws IOException { ! byte b1 = (byte) ((value >> 0) & 0xFF); ! byte b2 = (byte) ((value >> 8) & 0xFF); ! byte b3 = (byte) ((value >> 16) & 0xFF); ! byte b4 = (byte) ((value >> 24) & 0xFF); ! writeByte(b1); ! writeByte(b2); ! writeByte(b3); ! writeByte(b4); } /** ! * @param value byte[] ! * @throws IOException IOException */ ! public void writeBytes(byte[] value) throws IOException { ! writeInt(value.length); ! for (int i = 0; i < value.length; i++) { ! writeByte((byte) value[i]); } } /** ! * @param value String ! * @throws IOException IOException */ ! public void writeString(String value) throws IOException { ! writeBytes(value.getBytes()); ! } ! /** ! * @param value BigInteger ! * @throws IOException IOException ! */ ! public void writeBigInteger(BigInteger value) throws IOException { ! writeBytes(value.toByteArray()); } } |
From: Michael L. <he...@us...> - 2009-02-04 15:09:51
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31680/src/net/sourceforge/bprocessor/gl/view Modified Files: Display.java Log Message: Sensors Index: Display.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/view/Display.java,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** Display.java 8 Oct 2008 10:26:36 -0000 1.85 --- Display.java 4 Feb 2009 15:09:41 -0000 1.86 *************** *** 158,162 **** public Grid() { origin = new Vertex(0, 0, 0); ! size = 100.0; delta = 2.0; } --- 158,162 ---- public Grid() { origin = new Vertex(0, 0, 0); ! size = 200.0; delta = 2.0; } |
From: Michael L. <he...@us...> - 2009-02-04 15:09:51
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31700/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java SpaceTreeView.java Log Message: Sensors Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.143 retrieving revision 1.144 diff -C2 -d -r1.143 -r1.144 *** GenericTreeView.java 13 Oct 2008 10:54:11 -0000 1.143 --- GenericTreeView.java 4 Feb 2009 15:09:44 -0000 1.144 *************** *** 58,61 **** --- 58,63 ---- import net.sourceforge.bprocessor.model.Surface; import net.sourceforge.bprocessor.model.Vertex; + import net.sourceforge.bprocessor.model.bridge.DataItem; + import net.sourceforge.bprocessor.model.bridge.Mote; import net.sourceforge.bprocessor.model.bridge.Sensor; import net.sourceforge.bprocessor.model.modellor.Modellor; *************** *** 1264,1267 **** --- 1266,1320 ---- } + + /** {@inheritDoc} */ + public EntityNode nodeFor(Object entity) { + return new MoteNode((Mote) entity); + } + + /** + * Update the node with the given object + * @param o The object + */ + public void update(Object o) { + userObject = o; + super.update(((Sensor)o).motes()); + } + + } + + /** + * + */ + public class MoteNode extends EntityNode { + /** + * @param label Mote + */ + public MoteNode(Mote label) { + super(label); + add(new DataContainer("Data", label.items())); + } + + /** + * {@inheritDoc} + */ + public void update(Object o) { + super.update(o); + Mote mote = (Mote) o; + updateChild(0, mote.items()); + } + } + + /** + * + */ + public class DataContainer extends CompositeNode { + /** + * + * @param name String + * @param content data items + */ + public DataContainer(String name, Collection<DataItem> content) { + super(name, content, false); + } } Index: SpaceTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/SpaceTreeView.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** SpaceTreeView.java 22 Sep 2008 15:58:17 -0000 1.33 --- SpaceTreeView.java 4 Feb 2009 15:09:44 -0000 1.34 *************** *** 53,56 **** --- 53,57 ---- ((GenericNode)root.getChildAt(1)).update(p.getConstructors()); ((GenericNode)root.getChildAt(2)).update(p.getCatalogObjects()); + ((GenericNode)root.getChildAt(3)).update(p.sensor()); } catch (ArrayIndexOutOfBoundsException e) { log.error("There were a inconsistent number of nodes attached to " + |
From: Michael L. <he...@us...> - 2009-02-04 15:09:48
|
Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31680/src/net/sourceforge/bprocessor/gl/tool Modified Files: ExtendTool.java Log Message: Sensors Index: ExtendTool.java =================================================================== RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ExtendTool.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ExtendTool.java 13 Dec 2007 12:00:49 -0000 1.3 --- ExtendTool.java 4 Feb 2009 15:09:41 -0000 1.4 *************** *** 32,43 **** /** ! * A tool for push/pulling geometry ! * Should work as follows: ! * When a surface is pressed all its bound and unbound vertexes are found. ! * A bound vertex have edges that is not in the plane of the surface ! * A unbound is the opposite ! * All unbound vertexes are copied and connected to the copy by a edge, the ! * bound are moved in the direction of the edge that bounds it, ! * which should give a push/pull effect */ public class ExtendTool extends AbstractPencil { --- 32,36 ---- /** ! * A tool for extending geometry */ public class ExtendTool extends AbstractPencil { *************** *** 303,307 **** @Override public String initialTip() { ! return "Pick a surface to push/pull."; } } --- 296,300 ---- @Override public String initialTip() { ! return "Pick a surface to extend."; } } |
From: Michael L. <he...@us...> - 2008-11-03 14:26:29
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8055/src/net/sourceforge/bprocessor/gui Modified Files: GUI.java Log Message: Refactor Index: GUI.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v retrieving revision 1.101 retrieving revision 1.102 diff -C2 -d -r1.101 -r1.102 *** GUI.java 3 Nov 2008 13:14:12 -0000 1.101 --- GUI.java 3 Nov 2008 14:26:21 -0000 1.102 *************** *** 315,320 **** AbstractAction action = new AbstractAction("Union") { public void actionPerformed(ActionEvent e) { ! Container union = Space.createConstructionSpace("Union"); ! union.setUnion(true); Container active = Project.getInstance().getActiveSpace(); active.add(union); --- 315,319 ---- AbstractAction action = new AbstractAction("Union") { public void actionPerformed(ActionEvent e) { ! Container union = Space.createUnion("Union"); Container active = Project.getInstance().getActiveSpace(); active.add(union); |
From: Michael L. <he...@us...> - 2008-11-03 14:26:26
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8055/src/net/sourceforge/bprocessor/gui/actions Modified Files: FileImportActionListener.java Log Message: Refactor Index: FileImportActionListener.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/actions/FileImportActionListener.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** FileImportActionListener.java 3 Nov 2008 13:14:12 -0000 1.22 --- FileImportActionListener.java 3 Nov 2008 14:26:21 -0000 1.23 *************** *** 122,127 **** } else if (lfile.getName().endsWith(".obj")) { try { ! Container s = Space.createConstructionSpace(lfile.getName()); ! s.setUnion(true); Component lo = new Component(Byte.MAX_VALUE, lfile, s); ImportFileReader.importObjFile(lfile, s, info.objPanel.getScale(), --- 122,126 ---- } else if (lfile.getName().endsWith(".obj")) { try { ! Container s = Space.createUnion(lfile.getName()); Component lo = new Component(Byte.MAX_VALUE, lfile, s); ImportFileReader.importObjFile(lfile, s, info.objPanel.getScale(), |
From: Michael L. <he...@us...> - 2008-11-03 14:26:24
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8031/src/net/sourceforge/bprocessor/model/modellor Modified Files: ModelBathModellor2.java Log Message: Refactor Index: ModelBathModellor2.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/modellor/ModelBathModellor2.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ModelBathModellor2.java 3 Nov 2008 13:14:09 -0000 1.17 --- ModelBathModellor2.java 3 Nov 2008 14:26:18 -0000 1.18 *************** *** 674,679 **** public Modellor newInstance(Container s) { if (s.getLevel() == Container.PROJECT_LEVEL) { ! Container bath = Space.createConstructionSpace("Bath-union"); ! bath.setUnion(true); s.add(bath); return new ModelBathModellor2(bath); --- 674,678 ---- public Modellor newInstance(Container s) { if (s.getLevel() == Container.PROJECT_LEVEL) { ! Container bath = Space.createUnion("Bath-union"); s.add(bath); return new ModelBathModellor2(bath); |