Electronic Signs (Mahmut): Difference between revisions
Created page with "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. Vi..." (change visibility) |
No edit summary (change visibility) |
||
| (11 intermediate revisions by the same user not shown) | |||
| Line 4: | Line 4: | ||
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. |
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== |
==Websites== |
||
The main page of the VirtualBU project is |
The main page of the VirtualBU project is |
||
The URL for the website for VBUSigns subproject is http://cs.binghamton.edu/~steflik/wiki/index.php?title=Electronic_Signs_(Mahmut)&action=edit&redlink=1 |
|||
http://cs.binghamton.edu/~steflik/wiki/index.php/VirtualBU |
|||
The URL for the website for VBUSigns subproject is |
|||
http://cs.binghamton.edu/~steflik/wiki/index.php?title=Electronic_Signs_(Mahmut)&action=edit&redlink=1 |
|||
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 |
The websites is used to test and run VirtualBU project are |
||
http://vbu.cs.binghamton.edu:8080 |
http://vbu.cs.binghamton.edu:8080 |
||
http://vbu1.cs.binghamton.edu:8080 |
http://vbu1.cs.binghamton.edu:8080 |
||
http://vbu2.cs.binghamton.edu:8080 |
http://vbu2.cs.binghamton.edu:8080 |
||
===Prerequisites=== |
===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 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 |
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/ |
http:// http://netbeans.org/downloads/ |
||
To run VBUSigns project you need to download source code of Openwonderland project in following order |
To run VBUSigns project you need to download source code of Openwonderland project in following order |
||
../wonderland/trunk/wonderland |
../wonderland/trunk/wonderland |
||
../wonderland/trunk/wonderland-modules/VBUsigns |
../wonderland/trunk/wonderland-modules/unstable/VBUsigns |
||
After building openwonderland project you will be able to run VBUSigns subproject. |
After building openwonderland project you will be able to run VBUSigns subproject. |
||
You can download Openwonderland project source code with following link |
You can download Openwonderland project source code with following link |
||
http://code.google.com/p/openwonderland/wiki/DownloadBuildSource05 |
http://code.google.com/p/openwonderland/wiki/DownloadBuildSource05 |
||
| Line 26: | Line 42: | ||
====Applications Used==== |
====Applications Used==== |
||
*Google SketchUp |
*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. |
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=== |
===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==== |
|||
*NetBeans IDE 6.9.1 and NetBeans IDE 7.0 |
|||
===Code=== |
===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. |
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. |
|||
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 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. |
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. |
|||
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. |
|||
====Environments Used==== |
|||
*NetBeans IDE 6.9.1 and NetBeans IDE 7.0 |
|||
====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=== |
===How to run VBUSigns Module=== |
||
After competing prerequisites, open module in NetBeans. Then right click on the module and |
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 |
To run module in different servers you can change the following value in the ''build.xml'' file; |
||
‘’<arg value="target server address:8080"/>’’ |
|||
''<arg value="target server address:8080"/>'' |
|||
===Basic module definition in Openwonderland=== |
|||
A Wonderland world consists of: |
|||
*Cells, that represent visible objects |
|||
*Components, attached to cells, that add specific features to cells |
|||
*Cell renderers, that use the graphics engine API to make cells visible on-screen |
|||
*Art and other resources |
|||
Once these have all been created, they need to be packaged in some way for easy upload to the server. This is done using a Wonderland MODULE. A module is basically a wrapper file that contains all the Wonderland building blocks according to a specific structure. This structure lets the server know where all the different building blocks are. A module is actually a Java jar file. |
|||
'''Server and Client Programs''' |
|||
If lots of people are visiting the same virtual world, we have to make sure that everything in the world is the same for everyone. |
|||
For example, if you're playing a game inside Open Wonderland and your friend tells you to pick up a health pack, you both have to be able to see the same health pack, at the same time, in the same location. And if someone else comes along and takes the pack, everyone else in the game has to know that the pack is no longer available. So, Wonderland has to keep track of all the objects in the world. This is very difficult – but Open Wonderland has been designed to make it easy. |
|||
Wonderland is an example of a client-server application. To see what this means, we'll look at some of the main requirements for a virtual word. |
|||
*Every user in the virtual world must see the same things as everyone else. |
|||
If Nicole and Jon are in a room together, and Nicole sees a book in the room, then Jon must see the same book in the same location. |
|||
• If anything changes, everyone should be kept up to date. If Nicole picks up the book, Jon should see that it is now no longer on the shelf, but is being |
|||
held by Nicole. |
|||
• Users should be able to connect at any time and see the current state of the world. If Jon has to leave the world for some reason, and while he is gone |
|||
Nicole puts the book on a table, when Jon visits the room again, he should see the book on the table (assuming it hasn't moved since then). |
|||
• Users do not need to know anything about the physical location of any other user in the real world. Nicole does not need to know that Jon is really in |
|||
San Francisco or that another user is in Singapore, nor do they need to know that Nicole is in Massachusetts. They do not need to communicate directly with |
|||
each other in the real world. Their computers also do not need to communicate with each other directly. |
|||
Wonderland is split into two parts, a server program, and a client program (we say that Wonderland has a client-server architecture): |
|||
Server |
|||
• The virtual world is stored on a computer at a particular IP address. The actual address is defined as a URL. |
|||
• The server knows everything about the virtual world: it stores all the objects that will be displayed, controls how different parts of the Wonderland |
|||
system communicate with each other, and knows which users are inside the virtual world. |
|||
Client |
|||
• The client is on another computer, at a different IP address. |
|||
• The client must log into the server to join a virtual world. |
|||
• After the client logs on, the server sends a copy of the virtual world to the client. (Actually, the client can cache data locally, but on entering a new |
|||
virtual world, the data is sent to the client by the server.) |
|||
• Note that there can be lots of different clients, each running on a different computer. There can also be more than one server, though this is rather complex. |
|||
Your computer is the client, asking the Wonderland server to send you all the data you need to display and interact with the virtual world. |
|||
• The client is the program that you run on your computer – a Wonderland client. |
|||
• The server is the program that runs on the other computer – a Wonderland server. |
|||
If another person (say, Jon) wants to join you in the virtual world, they must log on to the same server as you, and request their own copy of all the virtual world data. Now, you both have the same virtual world displayed on your computer. If you change something about the world, e.g. move a book, Jon needs to know what happened (or he'll get confused). So, when you pick up the book, four things are done: |
|||
• your client sends the new position of the book object to the Wonderland server |
|||
• the server updates its own copy of the book object |
|||
• the server then sends the new position of the book to Jon's client program |
|||
• Jon's client updates its own copy of the book object, and displays it in its new location |
|||
Now everyone is up-to-date. All this communication is handled by Wonderland. But we must still write code to plug our own cells into the Wonderland communication system. This is also packaged inside a module, along with everything else. |
|||
Prepared by Mahmut SUBASI |
Prepared by Mahmut SUBASI |
||
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