First commit, added all projects
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
# Design
|
||||
|
||||
The design of the system is summarized in the following UML class diagrams.
|
||||
|
||||
## UML Class Diagram
|
||||
|
||||
@startuml
|
||||
skinparam class {
|
||||
BackgroundColor<<JavaAPI>> #98FF98
|
||||
BackgroundColor<<Legacy>> #FFCC88
|
||||
}
|
||||
|
||||
package "gps" {
|
||||
class NMEASentence {
|
||||
+addToChecksum(s: String, originalChecksum: int): int
|
||||
+convertLatitude(latitudeString: String): double
|
||||
+convertLongitude(longitudeString: String): double
|
||||
}
|
||||
|
||||
class GPGGASentence {
|
||||
-time: String
|
||||
-latitude: double
|
||||
-longitude: double
|
||||
-fixType: int
|
||||
-satellites: int
|
||||
-dilution: double
|
||||
-altitude: double
|
||||
-altitudeUnits: String
|
||||
-sealevel: double
|
||||
-geoidunits: String
|
||||
+GPGGASentence(All Necessary Parameters)
|
||||
+All Necessary Accessors()
|
||||
+{static} parseGPGGA(s: String): GPGGASentence
|
||||
}
|
||||
|
||||
interface GPSObserver {
|
||||
+handleGPSData(sentence: String)
|
||||
}
|
||||
|
||||
interface GPSSubject {
|
||||
+addGPSObserver(observer: GPSObserver)
|
||||
+notifyGPSObservers(sentence: String)
|
||||
+removeGPSObserver(observer: GPSObserver)
|
||||
}
|
||||
|
||||
class GPSReaderTask {
|
||||
-in: BufferedReader
|
||||
-sentences: String[]
|
||||
+GPSReaderTask(is: InputStream, sentences: String...)
|
||||
+doInBackground(): Void
|
||||
+process(lines: List<String>)
|
||||
}
|
||||
}
|
||||
|
||||
package "gui" {
|
||||
class CartographyPanel <<Legacy>> {
|
||||
}
|
||||
|
||||
class DynamicCartographyPanel {
|
||||
-gpgga: GPGGASentence
|
||||
-proj: MapProjection
|
||||
+DynamicCartographyPanel(model: CartographyDocument<T>, cartographer: Cartographer<T>, proj: MapProjection)
|
||||
+handleGPSData(data: String)
|
||||
+paint(g: Graphics)
|
||||
}
|
||||
}
|
||||
|
||||
class SwingWorker<T, V> <<JavaAPI>> {
|
||||
}
|
||||
|
||||
' Relationships
|
||||
NMEASentence <|-- GPGGASentence
|
||||
GPSSubject <|.. GPSReaderTask
|
||||
SwingWorker <|-- GPSReaderTask : "T bound to Void, V bound to String"
|
||||
GPSObserver <|.. DynamicCartographyPanel
|
||||
CartographyPanel <|-- DynamicCartographyPanel
|
||||
|
||||
@enduml
|
||||
|
||||
## Specifications
|
||||
|
||||
This section contains design specifications for specific components. For others, refer to the UML diagrams above.
|
||||
The DynamicCartographyPanel Class
|
||||
|
||||
### A DynamicCartographyPanel object is a CartographyPanel object that handles dynamic position/location updates
|
||||
|
||||
- handleGPSData(): Must parse the NMEA sentence it is passed and store it as an attribute.
|
||||
- paint(): This method must perform the following steps:
|
||||
1. Add a Rectangle2D.Double object to the first element of the zoomStack centered on the current location, sized 2km wide and 2km high.
|
||||
2. Call the parent paint() method to invoke the street network.
|
||||
3. Project and transform the current position/location.
|
||||
4. Render a filled red circle centered on the current location, 8 pixels wide and 8 pixels high.
|
||||
|
||||
### The GPSReaderTask Class
|
||||
|
||||
- Constructor: Passed the InputStream (typically from the GPS device) and a variable number of NMEA sentences to be processed.
|
||||
- doInBackground(): Must continuously read lines from the BufferedReader (which decorates the InputStream) and invoke publish() for each line until the task is cancelled.
|
||||
- process(): Must notify all GPSObserver objects of each line it is supposed to process, as defined by the sentences[] array.
|
||||
- Note: For performance, multiple lines may be coalesced into a "chunk," which is why process() receives a List<String>
|
||||
Reference in New Issue
Block a user