-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
재검색 최대 좌표 설정 #84
재검색 최대 좌표 설정 #84
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
정말 좋은 트러블 슈팅이었던 것 같습니다.
수식을 작성하고 figma로 직접 그림까지 그려주셔서 로직을 이해하는데 정말 많은 도움이 되었습니다.
수고하셨습니다👍
static let storeURL = "http://13.124.127.77:8080/api/v1/storecertification/byLocation" | ||
static let storeURL = "http://35.216.42.117:8080/api/v1/storecertification/byLocation" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prod URL과 dev URL을 열거형으로 저장해두는건 어떨까요?
서버와 연결되는 URL을 항상 확인해서 무슨 URL을 사용하는지 확인해야하는 번거로움을 줄일 수 있을것 같습니다.
let newNorthWest = Location( | ||
longitude: (loc1.latitude + (loc1.longitude / slope) - constant1) / (slope + 1 / slope), | ||
latitude: (slope * loc1.latitude + loc1.longitude + constant1 / slope) / (slope + 1 / slope) | ||
) | ||
|
||
let newNorthEast = Location( | ||
longitude: (loc2.latitude + (loc2.longitude / slope) - constant1) / (slope + 1 / slope), | ||
latitude: (slope * loc2.latitude + loc2.longitude + constant1 / slope) / (slope + 1 / slope) | ||
) | ||
|
||
let newSouthEast = Location( | ||
longitude: (loc2.latitude + (loc2.longitude / slope) - constant2) / (slope + 1 / slope), | ||
latitude: (slope * loc2.latitude + loc2.longitude + constant2 / slope) / (slope + 1 / slope) | ||
) | ||
|
||
let newSouthWest = Location( | ||
longitude: (loc1.latitude + (loc1.longitude / slope) - constant2) / (slope + 1 / slope), | ||
latitude: (slope * loc1.latitude + loc1.longitude + constant2 / slope) / (slope + 1 / slope) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
중복되는 로직인 것 같은데 함수화를 하면 좋을 것 같습니다.
if loc1.latitude == loc2.latitude { | ||
return RequestLocation( | ||
northWest: Location(longitude: loc1.longitude, latitude: center.latitude + 0.035), | ||
southWest: Location(longitude: loc1.longitude, latitude: center.latitude - 0.035), | ||
southEast: Location(longitude: loc2.longitude, latitude: center.latitude - 0.035), | ||
northEast: Location(longitude: loc2.longitude, latitude: center.latitude + 0.035) | ||
) | ||
} else if loc1.longitude == loc2.longitude { | ||
return RequestLocation( | ||
northWest: Location(longitude: center.longitude + 0.035, latitude: loc1.latitude), | ||
southWest: Location(longitude: center.longitude - 0.035, latitude: loc1.latitude), | ||
southEast: Location(longitude: center.longitude - 0.035, latitude: loc2.latitude), | ||
northEast: Location(longitude: center.longitude + 0.035, latitude: loc2.latitude) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
로직이 기울기가 무한이나 0이 나오는 경우를 예외처리하는 로직인 것 같은데 어떻게 처리되는건지 설명해주시면 감사하겠습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
가운데를 기준으로 0.035의 크기로 가로 세로 길이를 수정하는 로직입니다.
…Certified-Store/iOS into feature/max-refresh-location(#74)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
do { | ||
return try getURL(type: .develop) | ||
} catch { | ||
return "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 메소드에서 error를 날렸을 때 NetworkError.wrongURL를 던졌는데 해당 에러를 log에 표시해주는 코드를 짜주면 좋을 것 같습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨습니다 ~
⭐️ Issue Number
🚩 Summary
🛠️ Technical Concerns
너무 많은 데이터 전달로 인한 앱 멈춤
사용자가 지도를 조작하여 줌아웃을 해서 대한민국 전체로 재검색을 한다면 5만개 이상의 객체를 받아오게 된다.
그렇기 때문에 멈춤 현상과 과도한 데이터 전송이 일어난다.
이를 방지하기 위해서 재검색 최대 크기를 설정했다.
사용자가 특정 수치 이상 줌 아웃한 상태에서 재검색을 하면 요청 좌표 4개가 작은 크기로 재설정되도록 하여 해결했다.
회전에 대응하는 로직
좌표 4개를 수정하는 과정에서 위도 경도와 관련하여 로직 이슈가 있었다.
파란 점을 노란 점으로 옮겨야 했다.
이제 수학적으로 점을 옮겨야 했다.
점과 직선 사이의 거리 공식, 직선의 방정식이, 직선의 평행이동 등의 수학적 지식이 필요했다.
이렇게 4가지가 나오면 보라색 점을 구할 수 있다.
이 보라색 점 4개중 다른 방향으로 로직을 한번 더 실행하면 노랑색 점을 구할 수 있다.
기울기를 구하는 과정에서 기울기가 0이 되거나 무한대가 되는 상황은 예외처리로 해결했다.
📋 To Do