Installing and Running GeoServer



Firstly, to be able to see the map in the browser, you should have GeoServer installed in your computer and running. You can get latest version from here : http://geoserver.org/display/GEOS/Download
After the installation, you may need to change the port GeoServer runs in(the default port used in the project is 8085). You can do it by changing the file $GEOSERVER_HOME/etc/jetty.xml and you can change the port 8080 to your desired value(8085). After this, you should restart(or start) GeoServer by executing Start GeoServer. Then, (with a couple of minutes delay) you can access the administration panel from the browser by typing http://localhost:8085/geoserver/
the default values for username and password is "admin" and "geoserver".

Adding Layers to GeoServer



Next step is adding our map layers to GeoServer. You can follow the instructions at the User Manual of GeoServer to get detailed information. It is available from:
http://docs.geoserver.org/stable/en/user/

First copy the directory "trenler" which has our shapefiles, to $GEO_SERVER_HOME/data_dir/data

After logging in to GeoServer, you should create a new Workspace. Click Workspaces->Add new workspace.
Name: trenler
Namespace URI: http://localhost:8085/geoserver/wms

Then you should create a Store by clickling Stores->Add new store->Shapefile
You must select the Workspace as "trenler" and give URL as "file:data/trenler".

Click on Layers->Add a new resource, then choose the workspace. After that, you should be able to see the list of available resources, you should publish them. After you click publish, in the Publishing tab, you should click Compute from native bounds link to get the boundaries and select SRS as WGS84. The sytles for the layers are
tu : polygon
railways : line
metropolitan_coordinates : point
province_coordinates : point
After this step you can create a Layer Group to group these layers and see them together in the browser. You should also generate the bounds there.

Finally, from Layer Preview link, you can see the layers or layergroups in the browser.

Google Web ToolKit


You should download the GWT NetBeans Plugin from
https://gwt4nb.dev.java.net/
and then add the plugin to NetBeans manually, from Tools->Plugins. You should give the path of the plugin to project correctly. You can from the Libraries of Project if it is added.

You should also add the file "openlayers_gwt-0.4.jar" to Libraries. You can also get the file from
http://sourceforge.net/projects/gwt-openlayers/

If it is not added, you should add the line
<inherits name="org.gwtopenmaps.openlayers.OpenLayers"/>
to the file Main.gwt.xml under org.machinist

Running The Project


This project runs under localhost, if you want to access the web page from other computers, you can change the variable IPAddress in the file org.machinist.client.MainEntryPoint.java to your IP. Project can be accessed through IPAddress:8080/Machinist

Also, now the project runs for 3 trains and 1 accelerometer data.
You should start 3 SimulationInterface and 1 AccelerometerInterface windows and get them all running to be able to see the data and trains on the map. Be careful to give "stations on the route" stations which are connected by a railway*. You should give ports as
Train1: PORT
Accelerometer for Train1: PORT+1
Train2: PORT+2
Train3: PORT+4

PORT+3 and PORT+5 are reserved for Accelerometer2 and Accelerometer3, but NetBeans do not let us to open more than 4 simulation windows simultaneously. So, we decided to choose these windows as 3 trains and 1 accelerometer. PORT value is 5000 as default. If you want the change the port value, you should also change the port variable in org.machinist.server.hardware.GPSserviceImpl.java

And also be careful not to give ports which are already in use, otherwise you will only be able to see the map without trains.

After you started GeoServer and 4 simulation windows correctly, when you run the project in NetBeans you should be able to see the trains moving happily ever after.


* You can see the list of connected railways by installing uDig and importing railways.shp. The list of railways can be seen from Table tab.