@@ -170,41 +170,49 @@ class MissionFragment : Fragment(), MissionHandler {
170
170
first + = 1
171
171
}
172
172
1 -> {
173
+ initMarker(userLocation)
173
174
beforeLocation = userLocation
174
- tMap.addMarker(
175
- Marker .PERSON_MARKER ,
176
- Marker .PERSON_MARKER_IMG ,
177
- TMapPoint (userLocation.latitude, userLocation.longitude)
178
- )
179
- missionViewModel.personCurrentLocation = userLocation
180
- tMap.latitudes.add(userLocation.latitude)
181
- tMap.longitudes.add(userLocation.longitude)
182
- tMap.setRouteDetailFocus()
183
175
first + = 1
184
176
}
185
177
else -> {
186
- Log .d(" MissionWorker" , " 그리는 중 $userLocation $beforeLocation " )
187
- val nowLocation = TMapPoint (userLocation.latitude, userLocation.longitude)
188
- tMap.drawMoveLine(
189
- nowLocation,
190
- TMapPoint (beforeLocation.latitude, beforeLocation.longitude),
191
- Marker .PERSON_LINE + PERSON_LINE_NUM .toString(),
192
- Marker .PERSON_LINE_COLOR
193
- )
194
- tMap.addMarker(Marker .PERSON_MARKER , Marker .PERSON_MARKER_IMG , nowLocation)
178
+ drawNowLocationLine(TMapPoint (userLocation.latitude, userLocation.longitude), TMapPoint (beforeLocation.latitude, beforeLocation.longitude))
195
179
missionViewModel.personCurrentLocation = userLocation
196
180
if (tMap.isTracking) {
197
181
tMap.tMapView.setCenterPoint(userLocation.latitude, userLocation.longitude)
198
182
}
199
183
beforeLocation = userLocation
200
- PERSON_LINE_NUM + = 1
201
184
}
202
185
}
203
-
204
186
}
205
187
}
206
188
}
207
189
190
+ private fun initMarker (nowLocation : Location ) {
191
+ with (tMap) {
192
+ addMarker(
193
+ Marker .PERSON_MARKER ,
194
+ Marker .PERSON_MARKER_IMG ,
195
+ TMapPoint (nowLocation.latitude, nowLocation.longitude)
196
+ )
197
+ missionViewModel.personCurrentLocation = nowLocation
198
+ latitudes.add(nowLocation.latitude)
199
+ longitudes.add(nowLocation.longitude)
200
+ setRouteDetailFocus()
201
+ }
202
+ }
203
+
204
+ private fun drawNowLocationLine (nowLocation : TMapPoint , beforeLocation : TMapPoint ) {
205
+ tMap.drawMoveLine(
206
+ nowLocation,
207
+ beforeLocation,
208
+ Marker .PERSON_LINE + PERSON_LINE_NUM .toString(),
209
+ Marker .PERSON_LINE_COLOR
210
+ )
211
+ PERSON_LINE_NUM + = 1
212
+
213
+ tMap.addMarker(Marker .PERSON_MARKER , Marker .PERSON_MARKER_IMG , nowLocation)
214
+ }
215
+
208
216
private fun getAlarmInfo () {
209
217
alarmSettingViewModel.getAlarm()
210
218
val linePoints = arrayListOf<TMapPoint >()
0 commit comments