Global Positioning System Reference
In-Depth Information
tonic object to be placed in the framework. The fundamental object auto-
matically takes care of the communication and the programmer implements
behavior inside this development environment.
It is also important to understand that the framework and the basic com-
ponent can be developed highly independently of one other. The Swing
Framework provides a large number of components specializing the base
component in a hierarchical manner. The idea of the
RealObject
is to pro-
vide a base class for any real-world object with pre-implemented physical
attributes and automated positioning mechanisms.
If you are not familiar with the Swing Framework, you should study
the
roaf.book.map.gui.SwingApplication.main
method. This applica-
tion demonstrates how to create
JComponent
s and how to fit a variable
grid into a component.
The development of a map panel will be based on the
JPanel
extending
the
JComponent
. In the long term, a ROAF developer choosing to create a
trac application might prefer to use a predefined
RealCar
extending the
RealObject
to focus on implementing a navigation system to steer the car.
By connecting the
RealObject
to a trac application, it can listen to the
trac to adjust the speed.
5.5
Creating a
MapPanel
The remainder of this chapter will walk you through the development
of the
roafx.gui.map
package. In Section 5.8, a GPXviewer is rolled
out to demonstrate the usage of the mapping components with the
GPSunit. The GPXviewer resides in
roaf.book.map.gui
, and it is also
deployed as an executable jar file in the
../resources/deployed
folder
together with instructions in the
GPXviewer.txt
file.
It is suggested to go through these instructional steps now.
The first step in creating a
roafx.gui.map.MapPanel
is to extend a Swing
component and add the vital information to the constructor:
public class MapPanel extends JPanel {
public MapPanel( Rectangle2D.Double gridArea )
{ this.gridArea = gridArea; }
:
The rectangle indicates the task to draw a Cartesian coordinate system
on the provided screen space. The parameter
Rectangle2D
in the construc-
tor defines the horizontal and vertical
(from,to)
pairs for the grid. The
Search WWH ::
Custom Search