| 155 | } // namespace |
| 156 | |
| 157 | MyPositionController::MyPositionController(Params && params, ref_ptr<DrapeNotifier> notifier) |
| 158 | : m_notifier(notifier) |
| 159 | , m_modeChangeCallback(std::move(params.m_myPositionModeCallback)) |
| 160 | , m_hints(params.m_hints) |
| 161 | , m_isInRouting(params.m_isRoutingActive) |
| 162 | , m_needBlockAnimation(false) |
| 163 | , m_wasRotationInScaling(false) |
| 164 | , m_errorRadius(0.0) |
| 165 | , m_horizontalAccuracy(0.0) |
| 166 | , m_position(m2::PointD::Zero()) |
| 167 | , m_drawDirection(0.0) |
| 168 | , m_oldPosition(m2::PointD::Zero()) |
| 169 | , m_oldDrawDirection(0.0) |
| 170 | , m_enablePerspectiveInRouting(false) |
| 171 | , m_enableAutoZoomInRouting(params.m_isAutozoomEnabled) |
| 172 | , m_autoScale2d(GetScreenScale(kDefaultAutoZoom)) |
| 173 | , m_autoScale3d(m_autoScale2d) |
| 174 | , m_lastGPSBearingTimer(false) |
| 175 | , m_lastLocationTimestamp(0.0) |
| 176 | , m_positionRoutingOffsetY(kPositionRoutingOffsetY * GetVisualScale()) |
| 177 | , m_isDirtyViewport(false) |
| 178 | , m_isDirtyAutoZoom(false) |
| 179 | , m_isPendingAnimation(false) |
| 180 | , m_isPositionAssigned(false) |
| 181 | , m_isDirectionAssigned(false) |
| 182 | , m_isCompassAvailable(false) |
| 183 | , m_positionIsObsolete(false) |
| 184 | , m_needBlockAutoZoom(false) |
| 185 | , m_routingNotFollowNotifyId(DrapeNotifier::kInvalidId) |
| 186 | , m_blockAutoZoomNotifyId(DrapeNotifier::kInvalidId) |
| 187 | , m_updateLocationNotifyId(DrapeNotifier::kInvalidId) |
| 188 | { |
| 189 | using namespace location; |
| 190 | |
| 191 | m_mode = PendingPosition; |
| 192 | if (m_hints.m_isLaunchByDeepLink) |
| 193 | { |
| 194 | m_desiredInitMode = NotFollow; |
| 195 | } |
| 196 | else if (m_hints.m_isFirstLaunch) |
| 197 | { |
| 198 | m_desiredInitMode = Follow; |
| 199 | } |
| 200 | else if (params.m_timeInBackground >= kMaxTimeInBackgroundSec) |
| 201 | { |
| 202 | m_desiredInitMode = Follow; |
| 203 | } |
| 204 | else |
| 205 | { |
| 206 | m_desiredInitMode = params.m_initMode; |
| 207 | |
| 208 | // Do not start position if we ended previous session without it. |
| 209 | if (!m_isInRouting && m_desiredInitMode == NotFollowNoPosition) |
| 210 | m_mode = NotFollowNoPosition; |
| 211 | } |
| 212 | |
| 213 | m_preferredRoutingMode = params.m_preferredRoutingMode; |
| 214 |
nothing calls this directly
no test coverage detected