classes.puml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. @startuml classes
  2. skinparam defaultFontSize 13
  3. skinparam classAttributeIconSize 0
  4. skinparam linetype ortho
  5. title Diagramme de classes — WatchOsm v1
  6. package "domain" as domain #ffffff {
  7. enum Maneuver {
  8. +DEPART
  9. +CONTINUE
  10. +SLIGHT_LEFT
  11. +LEFT
  12. +SHARP_LEFT
  13. +UTURN
  14. +SHARP_RIGHT
  15. +RIGHT
  16. +SLIGHT_RIGHT
  17. +ROUNDABOUT
  18. +ARRIVE
  19. }
  20. class TurnInstruction {
  21. +maneuver : Maneuver
  22. +distanceMeters : Integer?
  23. +streetName : String?
  24. +rawText : String
  25. }
  26. class NavigationState {
  27. +isActive : Boolean
  28. +isPaused : Boolean
  29. +instruction : TurnInstruction?
  30. +remainingDistanceMeters : Integer?
  31. +remainingTimeMinutes : Integer?
  32. +arrivalTimeLabel : String?
  33. +speedKmh : Integer?
  34. +speedLimitKmh : Integer?
  35. +destination : String?
  36. +updatedAtMillis : Long
  37. +{static} IDLE : NavigationState
  38. }
  39. class Formatters {
  40. +{static} distance(meters) : String
  41. +{static} duration(minutes) : String
  42. }
  43. }
  44. package "data" as data #ffffff {
  45. class OsmAndNotificationPayload {
  46. +title : CharSequence?
  47. +text : CharSequence?
  48. +bigText : CharSequence?
  49. +subText : CharSequence?
  50. +infoText : CharSequence?
  51. +category : String?
  52. }
  53. class OsmAndNotificationParser {
  54. +parse(payload) : NavigationState?
  55. -findManeuver(corpus) : ManeuverMatch?
  56. -maneuverDistance(...) : Integer?
  57. -extractStreet(...) : String?
  58. -normalize(text) : String
  59. +{static} OSMAND_PACKAGES : Set<String>
  60. +{static} CATEGORY_NAVIGATION : String
  61. }
  62. class NavigationStateRepository {
  63. -state : MutableStateFlow<NavigationState>
  64. +state : StateFlow<NavigationState>
  65. +onOsmAndNotification(key, payload) : Boolean
  66. +onOsmAndNotificationRemoved(key)
  67. +onListenerDisconnected()
  68. }
  69. class OsmAndNotificationListener {
  70. +onNotificationPosted(sbn)
  71. +onNotificationRemoved(sbn, rankingMap, reason)
  72. +onListenerDisconnected()
  73. }
  74. }
  75. package "application" as app #ffffff {
  76. class AppContainer {
  77. +navigationStateRepository : NavigationStateRepository
  78. }
  79. class WatchOsmApplication {
  80. +container : AppContainer
  81. }
  82. }
  83. package "ui" as ui #ffffff {
  84. class NavigationViewModel {
  85. +state : StateFlow<NavigationState>
  86. +{static} Factory : ViewModelProvider.Factory
  87. }
  88. class AppNavHost {
  89. +AppNavHost(viewModel)
  90. }
  91. class HomeScreen
  92. class NavigationScreen
  93. class MainActivity
  94. }
  95. TurnInstruction "1" *-- "1" Maneuver
  96. NavigationState "1" *-- "0..1" TurnInstruction
  97. OsmAndNotificationParser ..> OsmAndNotificationPayload : <<use>>
  98. NavigationStateRepository "1" --> "1" OsmAndNotificationParser
  99. OsmAndNotificationListener --> NavigationStateRepository : alimente
  100. NavigationStateRepository ..> NavigationState : <<create>>
  101. WatchOsmApplication "1" *-- "1" AppContainer
  102. AppContainer "1" *-- "1" NavigationStateRepository
  103. NavigationViewModel "1" --> "1" NavigationStateRepository : observe
  104. AppNavHost --> NavigationViewModel
  105. AppNavHost --> HomeScreen
  106. AppNavHost --> NavigationScreen
  107. MainActivity --> AppNavHost
  108. @enduml