@@ -34,12 +34,8 @@ class MissionFragment : Fragment(), MissionHandler {
34
34
35
35
private lateinit var tMap: MissionTMap
36
36
37
- private var beforeLocation = INIT_LOCATION
38
-
39
37
private var points = arrayListOf<TMapPoint >()
40
38
41
- private var backgroundPoints = arrayListOf<TMapPoint >()
42
-
43
39
private var state = State .FOREGROUND
44
40
45
41
override fun onCreateView (
@@ -59,7 +55,7 @@ class MissionFragment : Fragment(), MissionHandler {
59
55
initTMap()
60
56
initView()
61
57
setObserve()
62
- setNotification ()
58
+ drawPersonLine ()
63
59
64
60
}
65
61
@@ -163,89 +159,15 @@ class MissionFragment : Fragment(), MissionHandler {
163
159
}
164
160
}
165
161
166
- // private fun drawBusLocationLine() {
167
- // viewModel.busNowLocationInfo.observe(viewLifecycleOwner) { nowLocations ->
168
- // val nowLocation = nowLocations.first()
169
- //
170
- // if (beforeLocation != INIT_LOCATION) {
171
- // tMap.drawMoveLine(
172
- // TMapPoint(nowLocation.latitude.toDouble(), nowLocation.longitude.toDouble()),
173
- // TMapPoint(beforeLocation.latitude, beforeLocation.longitude),
174
- // Marker.BUS_LINE + BUS_LINE_NUM.toString(),
175
- // Marker.BUS_LINE_COLOR
176
- // )
177
- // BUS_LINE_NUM += 1
178
- // }
179
- // beforeLocation = Location(nowLocation.latitude.toDouble(), nowLocation.longitude.toDouble())
180
- //
181
- // viewModel.busCurrentLocation = beforeLocation
182
- //
183
- // tMap.addMarker(
184
- // Marker.BUS_MARKER,
185
- // Marker.BUS_MARKER_IMG,
186
- // TMapPoint(nowLocation.latitude.toDouble(), nowLocation.longitude.toDouble())
187
- // )
188
- // tMap.trackingTransport(beforeLocation)
189
- // }
190
- // }
191
- //
192
- // private fun drawSubwayLocationLine() {
193
- // viewModel.subwayRoute.observe(viewLifecycleOwner) { subwayRoute ->
194
- // viewLifecycleOwner.lifecycleScope.launch {
195
- // val timeUnit = (subwayRoute.sectionTime * SECOND_UNIT / subwayRoute.line.size).toLong()
196
- // subwayRoute.line.forEachIndexed { index, nowLocation ->
197
- // if (index == 0) {
198
- // return@forEachIndexed
199
- // }
200
- //
201
- // val beforeLocation = subwayRoute.line[index - 1]
202
- // tMap.drawMoveLine(
203
- // TMapPoint(nowLocation.latitude, nowLocation.longitude),
204
- // TMapPoint(beforeLocation.latitude, beforeLocation.longitude),
205
- // Marker.SUBWAY_LINE + (index - 1).toString(),
206
- // Marker.SUBWAY_LINE_COLOR
207
- // )
208
- //
209
- // viewModel.busCurrentLocation = Location(nowLocation.latitude, nowLocation.longitude)
210
- //
211
- // tMap.addMarker(
212
- // Marker.SUBWAY_MARKER,
213
- // Marker.SUBWAY_MARKER_IMG,
214
- // TMapPoint(nowLocation.latitude, nowLocation.longitude)
215
- // )
216
- //
217
- // delay(timeUnit)
218
- // }
219
- // }
220
- //
221
- // }
222
- // }
223
-
224
162
override fun alertTMapReady () {
225
163
requestPermissionsLauncher.launch(PERMISSIONS )
226
164
tMap.setTrackingMode()
227
- // drawBusLocationLine()
228
- // drawSubwayLocationLine()
229
- }
230
-
231
- override fun setOnLocationChangeListener (nowLocation : TMapPoint , beforeLocation : TMapPoint , canMakeLine : Boolean ) {
232
- // if (canMakeLine) {
233
- // tMap.drawMoveLine(
234
- // nowLocation,
235
- // beforeLocation,
236
- // Marker.PERSON_LINE + PERSON_LINE_NUM.toString(),
237
- // Marker.PERSON_LINE_COLOR
238
- // )
239
- // PERSON_LINE_NUM += 1
240
- // }
241
-
242
165
}
243
166
244
167
override fun setOnEnableScrollWithZoomLevelListener () {
245
168
tMap.apply {
246
169
tMapView.setOnEnableScrollWithZoomLevelListener { _, _ ->
247
170
isTracking = false
248
- // isTransportTracking = false
249
171
}
250
172
}
251
173
}
@@ -258,11 +180,7 @@ class MissionFragment : Fragment(), MissionHandler {
258
180
}
259
181
}
260
182
261
- private fun setNotification () {
262
- test()
263
- }
264
-
265
- private fun test () {
183
+ private fun drawPersonLine () {
266
184
var first = 0
267
185
lifecycleScope.launch {
268
186
viewModel.userLocation.collect { userLocation ->
@@ -280,7 +198,6 @@ class MissionFragment : Fragment(), MissionHandler {
280
198
Marker .PERSON_LINE + PERSON_LINE_NUM .toString(),
281
199
Marker .PERSON_LINE_COLOR
282
200
)
283
- // PERSON_LINE_NUM += 1
284
201
285
202
}
286
203
@@ -289,51 +206,6 @@ class MissionFragment : Fragment(), MissionHandler {
289
206
}
290
207
}
291
208
292
- private fun drawPersonLine () {
293
- lateinit var nowLocation: TMapPoint
294
- lateinit var beforeLocation: TMapPoint
295
- // if (viewModel.userState.value is UserState.Foreground) {
296
- // nowLocation = viewModel.getLocation()
297
- // if (PERSON_LINE_NUM == 0) {
298
- // viewModel.initLocation.observe(viewLifecycleOwner){
299
- // beforeLocation = it
300
- // }
301
- // }
302
- // tMap.drawMoveLine(
303
- // nowLocation,
304
- // beforeLocation,
305
- // Marker.PERSON_LINE + PERSON_LINE_NUM.toString(),
306
- // Marker.PERSON_LINE_COLOR
307
- // )
308
- // PERSON_LINE_NUM += 1
309
- // beforeLocation = nowLocation
310
- // viewModel.personCurrentLocation = Location(nowLocation.latitude, nowLocation.longitude)
311
- //
312
- // Log.d("MissionWorker", "location value ${viewModel.userState.value}")
313
- // }
314
- // else {
315
- // val allLocation = viewModel.getAllLocation()
316
- // allLocation.forEachIndexed { index, nowLocationInAll ->
317
- // if (index == 0) {
318
- // tMap.drawMoveLine(
319
- // nowLocationInAll,
320
- // beforeLocation,
321
- // Marker.PERSON_LINE + PERSON_LINE_NUM.toString(),
322
- // Marker.PERSON_LINE_COLOR
323
- // )
324
- // } else {
325
- // tMap.drawMoveLine(
326
- // nowLocationInAll,
327
- // beforeLocation,
328
- // Marker.PERSON_LINE + PERSON_LINE_NUM.toString(),
329
- // Marker.PERSON_LINE_COLOR
330
- // )
331
- // }
332
- // beforeLocation = nowLocationInAll
333
- // }
334
- // }
335
- }
336
-
337
209
companion object {
338
210
339
211
private const val DESTINATION = " 구로3동현대아파트"
@@ -343,12 +215,6 @@ class MissionFragment : Fragment(), MissionHandler {
343
215
344
216
private var PERSON_LINE_NUM = 0
345
217
346
- private var BUS_LINE_NUM = 0
347
-
348
- private val INIT_LOCATION = Location (0.0 , 0.0 )
349
-
350
- private const val SECOND_UNIT = 1_000
351
-
352
218
private val PERMISSIONS =
353
219
arrayOf(Manifest .permission.ACCESS_FINE_LOCATION , Manifest .permission.ACCESS_COARSE_LOCATION )
354
220
0 commit comments