Electronic Signs (Mahmut): Difference between revisions
No edit summary (change visibility) |
|||
| Line 48: | Line 48: | ||
===Coding Part=== |
===Coding Part=== |
||
In Openwonderland for development '''Java''' is being used. For coding part I am required to write a module that illustrates the content of the signboard in the openwonderland client window. That is the module refreshes its screen in a time period and in every refresh the content on the board changes. |
In Openwonderland for development '''Java''' is being used. For coding part I am required to write a module that illustrates the content of the signboard in the openwonderland client window. That is the module refreshes its screen in a time period and in every refresh the content on the board changes. |
||
===Environments Used=== |
====Environments Used==== |
||
*NetBeans IDE 6.9.1 and NetBeans IDE 7.0 |
*NetBeans IDE 6.9.1 and NetBeans IDE 7.0 |
||
===Code=== |
===Code=== |
||
Latest revision as of 22:01, 18 May 2011
This page is designed to explain VBUSigns Project. It is a subproject of VirtualBU project.
Project Description
VBUSigns project is a subproject of VirtualBU project. VirtualBU project aims to create photo realistic of 3D environment of Binghamton University campus. VBUSigns project – subproject of VirtualBU aims to create and show signs in front of main entrance of campus. VBUSigns project is a module that is used in openwonderland project that is coded in java. The module has two parts, these are the 3D model of sign board and code part that enable the module to work in openwonderland client window.
Websites
The main page of the VirtualBU project is
http://cs.binghamton.edu/~steflik/wiki/index.php/VirtualBU
The URL for the website for VBUSigns subproject is
The URL for the website for modeling part of my project is
http://www.cs.binghamton.edu/~steflik/wiki/index.php/Fine_Arts_%26_Anderson_Center_-_Mahmut_Subasi
The websites is used to test and run VirtualBU project are
http://vbu.cs.binghamton.edu:8080
http://vbu1.cs.binghamton.edu:8080
http://vbu2.cs.binghamton.edu:8080
Prerequisites
To be able to run the VirtualBU project you need to install Java on your computer. If you do not know how to get and install Java, you will find a link under the ‘’Launch’’ button on the main page of VirtualBU project. To be able to run VBUSigns project you need to install NetBeans IDE. You can find installation package on the following link
http:// http://netbeans.org/downloads/
To run VBUSigns project you need to download source code of Openwonderland project in following order
../wonderland/trunk/wonderland
../wonderland/trunk/wonderland-modules/unstable/VBUsigns
After building openwonderland project you will be able to run VBUSigns subproject. You can download Openwonderland project source code with following link
http://code.google.com/p/openwonderland/wiki/DownloadBuildSource05
Project Development
There are two parts of the project;
Modelling Part
Applications Used
- Google SketchUp
With Google SketchUp, I modeled the signboard that is placed in front of the main entrance of the campus. The model is embedded into module. In order to embed the model into module, first I exported my model as .dae (COLLADA) file with Google SketchUp. The reason I did this is that Open Wonderland can only display .kmz - Google Earth files or .dae files in client window.
Open Wonderland modules keep this kind of content in ../art directory. If someone wants to embed any type of model into module, he/she needs to place his/her models in this directory. .dae and .kmz files are just XML files that keeps the arrays of the model's edges locations, vertexes locations, scale factors, transformation values and color values.
Coding Part
In Openwonderland for development Java is being used. For coding part I am required to write a module that illustrates the content of the signboard in the openwonderland client window. That is the module refreshes its screen in a time period and in every refresh the content on the board changes.
Environments Used
- NetBeans IDE 6.9.1 and NetBeans IDE 7.0
Code
Basically openwonderland modules have 3 parts. These are client side, server side and common side. Client side handles the cell creation, rendering and requests from server.
When we open a client window everything we see is brought by client side of the code. In my code there is an extra class that creates and renders a JFrame that is used to show content taken from local a .txt file. Other classes are default classes that come when you created an module for openwonderland module, but still I have modified and added extra code parts in order to make my module worked.
The common part handles the communication between client and server. Since there may be some extra content that client needs and these contents are kept on the server. In my module contents are model and the text file that wanted to be shown on the panel.
The server part handles the server side of the project, which is it handles the changes in the world. In this part I wrote an extra part again to handle the changes in the text file. The handler checks whether text file is changed or not, if changed it retrieves and send the new content.
Since my module runs dynamically I wrote an extra package named main that initialize the connection to the client window and retrieves the text file location and refresh time from server and starts the module.
Client Side Code
- VBUSignsCell.java
This class basically is the constructor class of the module. The very first cell is created in this class. This class is also sets client state and status of a cell. It initialize and gets all init components of the module.
- VBUSignsCellFactory.java
This class handles the initial state of the server. It also sets the modules visible name in client window that is when you click Insert-Object button in client window you can see installable module names on the popup window. This class sets the name and the preview image-on the right side of this window-of module when you click on it.
- VBUSignsCellRenderer.java
This class handles node operations of the module. When you install the module on client window, the panel and a model is downloaded on the client window. As I said before Open Wonderland modules uses cells to show any viewable object in the world. In order to show an object in the world server needs to know which cell is assigned to which module or object. To control them Open Wonderland uses node structure. This class also handles showing the cells that our module will use. With node structure, we can also add children to any node. In VBUSigns module our node is the panel node and I attach my model to this node as a child to this node.
node.attachChild(getPanelNode(text));
node.attachChild(myModel);
node.setModelBound(new BoundingBox());
node.updateModelBound();
- VBUSignsNode.java
This class handles node. The node is a panel in my module. This class handles panel's scale, its width and hight.
- VBUSignsPanel.java
This class is the constructor of my panel. I set all properties of my panel here. I also set what token will be used to handle new lines, what font will be used and size of the font, the size of spaces between lines and colors of both panel and font.
Common Side Code
- ChangeTextMessage.java
This class handles the message sent to the TextChangeConnectionHandler to change the state of a particular cell. The state of this message includes the id of the cell to update and the text to change it to.
- CreateCellRequestMessage.java
This class handles the message sent to the TextChangeConnectionHandler to request that a new cell is created. A CreateCellResponseMessage or an ErrorMessage will be returned, depending if the creation failed or succeeded. This property is used to show changes in the text file we use to show the client.
- CreateCellResponseMessage.java
This class handles the response to a CreateCellRequestMessage. The response contains the cell ID of the newly created cell.
- TextChangeConnectionType.java
This class defines the ConnectionType used to send messages between the TextChangeConnection and the TextChangeConnectionHandler.
Main Side Code
- ConnectionClientMain.java
Main class for the standalone client. This class reads the server URL,username and password from the command line, and creates a session connected to the given Wonderland server. It then connects a new TextChangeConnection, and proceeds to create a cell and then change its text specified periodically time.
- TextChangeConnection.java
A custom connection for sending text change information in case of the text is changed in text file we use to show to the clients.
Server Side Code
- TextConnectionHandles.java
A connection handler that implements the server-side of the 'TextChangeConnection.This handler accepts requests to create cells, as well as requests to change the text of an existing cell. As described in the general ClientConnectionHandler, because this handler is Serializable, a separate copy of the handler is created for each client that uses the connection type. Therefore we can store per-client state, which in this cases is the list of all cells created by the client. When the client disconnects, only the cells created by that client will be removed.
How to run VBUSigns Module
After competing prerequisites, open module in NetBeans. Then right click on the module and build it, after right click again and click deploy to server. After the module deployed to server just right click and press run. NetBeans will ask you the location of your text file enter it, then you will asked to enter refresh time enter it in number format and module will start. To run module in different servers you can change the following value in the build.xml file;
<arg value="target server address:8080"/>
Prepared by Mahmut SUBASI