Skip to content
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

Plan map #81

Merged
merged 46 commits into from
Sep 20, 2021
Merged

Plan map #81

merged 46 commits into from
Sep 20, 2021

Conversation

junwha
Copy link
Owner

@junwha junwha commented Sep 18, 2021

Description

PlanDetailView와 PlanCalendarView에 들어가는 Plan Map 구현을 완료하였습니다.

  • 각 타입 (SPOT, CAFE, RESTAURANT, HOTEL) 별 1~9, 9+ 마커 이미지를 로드하는 PlanMarker를 구현하였습니다.
  • Polyline을 그릴 수 있도록 기존 TBMapModel을 상속 받는 PlanMapModel과 BackgroundMap을 wrapping하는 PlanMap 위젯을
    구현하였습니다.

Refactoring

General

  • PlanMakeViewBase가 Appbar 생성 역할만을 수행하므로, PlanMakeAppBarBase로 변경하였습니다
  • BackgroundMap에 zoom property를 추가했습니다
  • CAFE typo를 수정하였습니다

MemoDialog

  • 기존 TBSimpleDialog의 경우 submit, cancel에 대해 pop을 자동으로 수행하므로, duplicated pop call을 제거하였습니다 (메모에서 확인을 누르면 두 단계 pop을 하는 버그가 존재했습니다)

GoogleGeodesyLatLngAdapter

  • GoogleGeodesyLatLngAdapter는 Adapter 디자인 패턴을 활용하여 Google의 LatLng을 Geodesy LatLng으로 변환하는 Adapter입니다
  • 기존 ItemProps에 사용되던 Geodesy LatLng을 모두 Google LatLng으로 대체하였습니다
  • Geodesy 연산에는 이제 GoogleGeodesyLatLngAdapter가 사용됩니다

Implementations

PlanMakeHomeHeaderMixin

  • 추상메소드 onMapButtonTap()을 정의하였습니다
  • PlanMakeHomeView에서 onMapButtonTap 메소드를 오버라이딩하여 맵 버튼이 클릭되었을 때 isMapOpened state를 변경하였습니다

PlanMap

  • BackgroundMap을 wrapping 합니다
  • PlanMapModel으로부터 polyline을 가져와 BackgroundMap으로 전달합니다.

PlanMakeCalendarModel

  • flattenPlanListItems getter를 구현하여 기존 이중리스트의 PlaceDataProps를 평탄화하여 사용할 수 있도록 하였습니다
  • PlanMapModel을 PlanMakeCalendarModel의 notifier에 추가하여 PlanMakeCalendarModel에서 아이템에 변화가 일어날 때 Plan Map에 상태 변화가 함께 반영될 수 있도록 구현하였습니다.

PlanMapModel

  • 기존 TBMapModel를 PlanMarkerList와 함께 생성합니다
  • polyline getter는 기존 TBMapModel의 locations를 Polyline 객체로 변환하여 리턴합니다
  • updatePolylines는 PlaceDataProps를 인자로 받아 IndexLocation으로 패킹하여 부모의 updateLocations를 호출하고, 평균점을 찾아 Center를 이동시킵니다.

PlanMarkerList

  • 기존 MarkerList를 상속하여 loadImage와 addMarkers를 override합니다
  • loadImage에서 각 타입의 1~9, 9+ 이미지와 부모 클래스의 이미지를 로드합니다
  • addMarkers에서 Location 타입이 IndexLocation일 경우 마커 이미지와 함께 부모의 addMarker를 호출합니다

PlanMapModelTest

  • SPOT, CAFE, RESTAURANT, HOTEL 타입 데이터 생성
  • polyline 생성 로직 테스트

IndexLocation

  • maxIndex 이하일 경우 index를, 이상일 경우 maxIndex+1을 Location과 함께 저장합니다

Issue Tracking

simulator_screenshot_8C6A3B6D-3246-4FA7-8A14-0A469918860D

- extends TBMapModel
- polyline feature added
- wrapper of BackgroundMap
- with polyline
This reverts commit ca77dd1, reversing
changes made to 98ba676.
@junwha junwha added enhancement New feature or request implement implement new features labels Sep 18, 2021
@junwha junwha added this to the Milestone 2 milestone Sep 18, 2021
},
child: PlanMakeHome(),
return ChangeNotifierProvider.value(
value: calendarHandler,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

엄청 trivial 한거긴 한데 someFunc.call() 처럼 calendarHandler.inherit() 으로 표시해서 다음 View로 이 model을 넘길거다 라는걸 표시해주는걸 제안해봅니다!

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

반영하겠습니다!

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

다른 View로 모델을 넘길 때는 inherit으로 표시하자는 말씀이시죠?

import 'package:prototype2021/theme/calendar/plan_list_item.dart';
import 'package:prototype2021/theme/calendar/plan_list_item/middle_divider.dart';
import 'package:prototype2021/theme/calendar/schedule_card.dart';

mixin PlanListItemDataHandlerMixin on State<PlanListItem> {
final Geodesy _geodesy = new Geodesy();
final Geodesy.Geodesy _geodesy = new Geodesy.Geodesy();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이런식으로 네임스페이스를 만들어서 처리하신 이유가 궁금합니다 :)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

현재 저희 어플리케이션에서는 Google Map의 LatLng과 Geodesy의 LatLng을 함께 사용하고 있습니다.
두 클래스가 혼용되면 같은 곳에서 두가지를 사용할 수 없거나, 실수로 인한 버그가 발생하기 쉬우므로 둘 중 하나를 표준으로 정하는 것이 좋다고 생각했습니다. LatLng이 쓰이는 경우는 대부분이 map과 관련된 general한 case이고, Geodesy LatLng이 사용되는 경우는 특수한 case이기 때문에 GoogleMap 패키지를 표준으로 택하는 것이 용이하다고 판단했습니다.
현재는 Adapter를 활용해 Geodesy와 GoogleMap이 완전히 분리되어 있어 Geodesy namespace가 불필요하게 느껴질 수 있지만, 만약 다른 사람이 Geodesy가 namespace 없이 import 되어 있는 환경에 Google LatLng을 import 하여 사용한다면 LatLng이 서로 혼동되는 상황이 발생할 것입니다. 이러한 이유로 표준이 아닌 클래스를 포함하고 있는 패키지를 namespace를 활용하여 import 하였습니다.

@@ -21,7 +23,11 @@ class BackgroundMap extends StatefulWidget {
this.onCameraMove,
this.onTap,
this.initialCameraPosition,
});
this.zoom = 18.0,
polylines,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

polylines를 굳이 late로 지정해둔 이유가 있나요?? this.polylines = {}; 이런 식으로도 가능하지 않을까 싶습니다!

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

어... 이쪽은 제가 코드를 졸면서 짠 것 같네요ㅋㅋㅋㅋㅋ 수정하겠습니다

@junwha
Copy link
Owner Author

junwha commented Sep 19, 2021

수정 완료했습니다!

@junwha junwha merged commit 2b2c1aa into dev Sep 20, 2021
@junwha junwha deleted the plan-map branch September 20, 2021 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request implement implement new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants