Programming GPS and
OpenStreetMap Applications
with Java
The RealObject Application Framework
Kristof Beigibck
| Q \ CRC Press
I C * * " J Taylor &. Francis Group
\-_--'
Boca Raton London New York
CRC Press is an imprint of the
Taylor & Francis Croup, an Informa business
A N PETERS
BOOK
Contents
Preface
ix
From Vision to Mission
Software Objects and Real-World Representations
1.1
1.2
1.3
1.4
2
Introduction
Controlling Remote Objects via References
Object-Oriented Programming
Models in Physics
3
4
9
11
The Vision of a Real-World Simulator
15
2.1
2.2
2.3
2.4
2.5
2.6
2.7
15
15
16
17
19
20
20
Introduction
Physical Objects
Projecting Reality into Virtual Worlds
Real-World Objects (ROs)
Real-Object Applications (ROApps)
Real-Object Application Framework (ROAF)
Science Fiction
OOAAnalysis and Mission
23
3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8
23
23
25
27
27
29
30
31
Introduction
Language Analysis
Semantic Network
Gathering Information
Data Dictionary
Problem Statement
Candidate Objects
The Mission
Contents
II
4
III
6
Global Positioning
33
Space & Time
35
4.1
4.2
4.3
4.4
4.5
4.6
4.7
4.8
4.9
4.10
4.11
4.12
4.13
4.14
35
35
37
38
39
40
43
44
45
47
48
49
51
51
Introduction
A GeoPoint for Spatial Coordinate Systems
A P o s i t i o n Interface for Various Coordinate Systems . .
A Route to Manage an Array of P o s i t i o n s
NAVSTARGPS
GPSpoint implements GPSinfo
GPStrace extends Route
JavaGPS
Requirements for a GPSunit
Real vs. Simulated Motion
Recording a liveTrace
Loading a GPX File to a GPStrace
Play Back a GPStrace
The GPS Package: roaf .gps
From Geography to Cartography
55
5.1
5.2
5.3
5.4
5.5
5.6
5.7
5.8
5.9
55
55
56
57
58
61
62
64
65
Introduction
Map Projection Systems
Requirements for a Map GUI
The Framework Pattern
Creating a MapPanel
Creating a Swing Mapping Application
Interacting via MapEvents
Deploying the GPXviewer. j a r
The GUI Mapping Package
ROs-RealObjects
67
Objects in Motion
69
6.1
6.2
6.3
6.4
6.5
69
69
71
75
76
Introduction
Every RealObject has a GPSunit
a b s t r a c t Motion of a RealObject
Creating a Motorcycle
Observing Motorcycles
Processing Digital Maps
79
7.1
7.2
7.3
79
79
81
Introduction
Overview
A Map Compiler for OSM Data
Contents
7.4
7.5
7.6
7.7
7.8
7.9
7.10
8
IV
vii
Collecting Geometry in the Field
Map Attribution with JOSM
Map Formats
Processing Maps with Osmosis
Parsing OSM Files with the OSMparser
Toolchain Configuration
Rendering OpenStreetMaps with Kosmos
81
84
86
88
91
95
97
Making Maps Navigable
103
8.1
8.2
8.3
8.4
8.5
103
103
109
114
119
Introduction
Map Compiler Branches
Networking
Creating a NavigableMap
Conclusion
Navigating Objects
123
9.1
9.2
9.3
9.4
9.5
123
123
125
126
129
Introduction
Navigation Systems
Route Calculation
Exploring the Graph with a GameMap
The Navigator
ROApps: RealObject Applications
10 Separating the RO Client and the ROApp Server
10.1
10.2
10.3
10.4
Introduction
Observing Remote Objects
ROAF Client Software
The roaf .[Link] Class
11 Client Server Architecture
11.1
11.2
11.3
11.4
11.5
11.6
11.7
11.8
11.9
Introduction
Status Report
Four-layer Architecture
The ServerEngine
The RealObjectsServer
SOs: ServerObjects
Server Tuning
The RealObjectsBox
ROAdio Broadcasting
131
133
133
133
138
139
143
143
143
144
145
146
149
151
160
161
viii
Contents
12 Rolling out a ROApp
12.1
12.2
12.3
12.4
12.5
12.6
12.7
12.8
Introduction
LC: The Game Scenario
Server Architecture
Application Layer: RealObjectApplication Extends
RemoteObjectsServer
ROF: The RealObject Framework
ROApp clients: LCPlayer Extends RealObject
More ServerObjects
The ROApp Scenario
13 Mission Accomplished: Time to Play
13.1
13.2
13.3
13.4
13.5
Introduction
Using the Application
Interactive GUIPlayers
Intelligent Players
Robocode
ROAF: Real Object Application Framework
14 Evolution
14.1
14.2
14.3
14.4
14.5
14.6
Introduction
Game Scenario versus Real World
ROApp Classification
RO Classification
Decouple Mature ROs
The RealObject Hierarchy
Appendix: Downloads
A.l
A.2
A.3
A.4
Index
Source Code for the Exploration Phase
Resources
Release Candidate roaf v l . 0
Third-party Sources
167
167
167
169
172
175
175
182
185
191
191
191
196
200
205
207
209
209
210
215
219
220
221
227
228
229
230
230
233