Skip to content

Commit 6bac89f

Browse files
committed
style : drawPersonLine 함수 수정
1 parent 3306f3e commit 6bac89f

File tree

1 file changed

+28
-20
lines changed

1 file changed

+28
-20
lines changed

presentation/src/main/java/com/stop/ui/mission/MissionFragment.kt

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -170,41 +170,49 @@ class MissionFragment : Fragment(), MissionHandler {
170170
first += 1
171171
}
172172
1 -> {
173+
initMarker(userLocation)
173174
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()
183175
first += 1
184176
}
185177
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))
195179
missionViewModel.personCurrentLocation = userLocation
196180
if (tMap.isTracking) {
197181
tMap.tMapView.setCenterPoint(userLocation.latitude, userLocation.longitude)
198182
}
199183
beforeLocation = userLocation
200-
PERSON_LINE_NUM += 1
201184
}
202185
}
203-
204186
}
205187
}
206188
}
207189

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+
208216
private fun getAlarmInfo() {
209217
alarmSettingViewModel.getAlarm()
210218
val linePoints = arrayListOf<TMapPoint>()

0 commit comments

Comments
 (0)