Tracing a RealObject with GPS

Every RO has a GPSunit

To supply a location each RealObject has a hidden virtual roaf.gps.GPSunit to keep track of GPS coordinates. The GPSunit is a private member and cannot be accessed externally - by design. The RO is responsible for its own (auto) motion: The decision to replay a recorded trace, to simulate motion or to hook up a real GPS device (or a mixture) is private to the RO, and the location can not be accessed and modified externally.

A Use Case

The following use case can point out the relationship (aggregation) of the RealObject to its GPSunit:
  1. Imagine you (a body with location, mass, and size) represent the RealObject (RealPerson extends RealObject) carrying a cell phone (a reference for other people to reach you and inquire information) and a GPSunit (hidden in your jacket).
  2. You are standing on or near a bank of a river (location) and you turn on the GPS device, which is attached to you and retrieves your geographical Position and the universal time (GPSinfo).
  3. A friend calls you and ask, "Where are you?"
    You answer, "I'm at Regen street parallel to the Regen river" (local knowledge).
    To be more precise, you look at the GPS and say, "I'm at N49.031, E12.103."
    He asks, "What time is it?"
    You read it on the GPS, the most precise clock available
    and reply, "Let's meet downtown at the cathedral."
  4. You begin to walk downtown to meet your friend. The GPSunit refreshes your position approximately every second and logs every GPSinfo(lat, lon, elev, time) to its internal memory.
  5. You're late and jump into a cab. The GPS is now logging the cab's trace along the streets.

The Implementation

Note that the is a simple (pre)version of the roaf.ros.RealObject, which adds connectivity and other details. Nevertheless the books version offers a lower entry level to the RO tracing functionality.
Please open the class file in your IDE or editor to follow this description:

Please be patient!

Due to time constraints the ROAF Online Tutorials are still under construction.

continue on page 70 ...

The RealObject constructor

The constructor
RealObject( GPSinfo gpsInfo ) { gpsUnit = new GPSunit( gpsInfo ); }
sets place and creation time.

The private GPSunit

note! .. book .. protected ..
The Position of the RealObject can not be set externally|
We will demonstrate ... motorcycle traces ... movingObjects