Skip to content

Commit

Permalink
[RFR-525] Update markers (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
hb0 committed Jun 19, 2023
1 parent 901034f commit da582ad
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class MapFragment : Fragment() {
* The `Runnable` triggered when the `Map` is loaded and ready.
*/
private val onMapReadyRunnable = Runnable {
map!!.renderMarkers(MarkerFragment.markers)
map!!.renderMarkers(MarkerFragment.markers())
observeTracks()

// Only load track if there is an ongoing measurement
Expand All @@ -152,10 +152,10 @@ class MapFragment : Fragment() {
val observer = Observer<ArrayList<Track>?> {
if (it != null) {
//val events: List<Event> = loadCurrentMeasurementsEvents()
map!!.render(it, ArrayList()/* events */, false, MarkerFragment.markers)
map!!.render(it, ArrayList()/* events */, false, MarkerFragment.markers())
} else {
map!!.clearMap()
map!!.renderMarkers(MarkerFragment.markers)
map!!.renderMarkers(MarkerFragment.markers())
}
}
capturingViewModel.tracks.observe(viewLifecycleOwner, observer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts
import androidx.fragment.app.Fragment
import com.google.android.gms.maps.MapsInitializer
import com.google.android.gms.maps.model.BitmapDescriptorFactory
import com.google.android.gms.maps.model.LatLng
import com.google.android.gms.maps.model.MarkerOptions
import de.cyface.app.r4r.databinding.FragmentMarkerBinding
Expand Down Expand Up @@ -93,7 +94,7 @@ class MarkerFragment : Fragment() {
* The `Runnable` triggered when the `Map` is loaded and ready.
*/
private val onMapReadyRunnable = Runnable {
map!!.renderMarkers(markers)
map!!.renderMarkers(markers())
}

override fun onCreateView(
Expand Down Expand Up @@ -136,35 +137,50 @@ class MarkerFragment : Fragment() {
return now.after(endDate)
}

val markers = if (eventPassed()) emptyList() else arrayListOf(
// Schkeuditz
// FIXME: Start/Ziel: Stand am Stadtfest: 51.39554154202172, 12.223122188347885
MarkerOptions()
.position(LatLng(51.39877, 12.20104)).title("Station: Nähe Globana"), // FIXME: ändere Globana auf 51.39874, 12.20011
MarkerOptions()
.position(LatLng(51.38995, 12.22101)).title("Station: Stadtmuseum"),
MarkerOptions()
.position(LatLng(51.38848, 12.23337)).title("Station: Elsterbrücke"),
MarkerOptions()
.position(LatLng(51.40696, 12.22106)).title("Station: Fußballfeld"),
// Köthen
// FIXME: Start/Ziel Köthen: 51.751117, 11.973984 "Marktplatz Köthen"
MarkerOptions()
.position(LatLng(51.751117, 11.973984)).title("Start und Ziel: Marktplatz Köthen"),
MarkerOptions()
.position(LatLng(51.75243880654433, 11.948543178133846)).title("Station: Piratenspielplatz"),
MarkerOptions()
.position(LatLng(51.766749, 11.931790)).title("Station: Forellenhof"),
MarkerOptions()
.position(LatLng(51.766687, 11.983936)).title("Station: Kinder- und Bowlingwelt Köthen"),
MarkerOptions()
.position(LatLng(51.754960, 12.001494)).title("Station: Kaufland Köthen (Merziener Straße)"),
MarkerOptions()
.position(LatLng(51.747082, 12.005348)).title("Station: Gnetscher Straße, Nähe Stadtbäckerei Rödel"),
MarkerOptions()
.position(LatLng(51.743019, 11.971916)).title("Station: Jürgenweg (Höhe NP)"),
MarkerOptions()
.position(LatLng(51.755023, 11.976503)).title("Station: Schloss Köthen, Haus des Dürerbundes")
)
fun markers(): List<MarkerOptions> {
val defaultIcon = BitmapDescriptorFactory.defaultMarker(152.0F) // #299463
val startIcon = BitmapDescriptorFactory.defaultMarker()
return if (eventPassed()) emptyList() else arrayListOf(
// Schkeuditz
MarkerOptions()
.position(LatLng(51.39554154202172, 12.223122188347885)).title("Start und Ziel: Stand am Stadtfest")
.icon(startIcon),
MarkerOptions()
.position(LatLng(51.39874, 12.20011)).title("Station: Nähe Globana")
.icon(defaultIcon),
MarkerOptions()
.position(LatLng(51.38995, 12.22101)).title("Station: Stadtmuseum")
.icon(defaultIcon),
MarkerOptions()
.position(LatLng(51.38848, 12.23337)).title("Station: Elsterbrücke")
.icon(defaultIcon),
MarkerOptions()
.position(LatLng(51.40696, 12.22106)).title("Station: Fußballfeld")
.icon(defaultIcon),

// Köthen
MarkerOptions()
.position(LatLng(51.751117, 11.973984)).title("Start und Ziel: Marktplatz Köthen")
.icon(startIcon),
MarkerOptions()
.position(LatLng(51.75243880654433, 11.948543178133846)).title("Station: Piratenspielplatz")
.icon(defaultIcon),
MarkerOptions()
.position(LatLng(51.766749, 11.931790)).title("Station: Forellenhof")
.icon(defaultIcon),
MarkerOptions()
.position(LatLng(51.766687, 11.983936)).title("Station: Kinder- und Bowlingwelt Köthen")
.icon(defaultIcon),
MarkerOptions()
.position(LatLng(51.754960, 12.001494)).title("Station: Kaufland Köthen (Merziener Straße)")
.icon(defaultIcon),
MarkerOptions()
.position(LatLng(51.743019, 11.971916)).title("Station: Jürgenweg (Höhe NP)")
.icon(defaultIcon),
MarkerOptions()
.position(LatLng(51.755023, 11.976503)).title("Station: Schloss Köthen, Haus des Dürerbundes")
.icon(defaultIcon)
)
}
}
}

0 comments on commit da582ad

Please sign in to comment.