| 212 | {} |
| 213 | |
| 214 | void RoutePointsLayout::AddRoutePoint(RouteMarkData && data) |
| 215 | { |
| 216 | auto const count = m_manager.GetUserMarkIds(UserMark::Type::ROUTING).size(); |
| 217 | if (count == kMaxIntermediatePointsCount + 2) |
| 218 | return; |
| 219 | |
| 220 | RouteMarkPoint * sameTypePoint = GetRoutePointForEdit(data.m_pointType, data.m_intermediateIndex); |
| 221 | if (sameTypePoint != nullptr) |
| 222 | { |
| 223 | if (data.m_pointType == RouteMarkType::Finish) |
| 224 | { |
| 225 | if (count > 1) |
| 226 | { |
| 227 | size_t const intermediatePointsCount = count - 2; |
| 228 | sameTypePoint->SetRoutePointFullType(RouteMarkType::Intermediate, intermediatePointsCount); |
| 229 | } |
| 230 | else |
| 231 | { |
| 232 | sameTypePoint->SetRoutePointFullType(RouteMarkType::Start, 0); |
| 233 | } |
| 234 | } |
| 235 | else |
| 236 | { |
| 237 | size_t const offsetIndex = data.m_pointType == RouteMarkType::Start ? 0 : data.m_intermediateIndex; |
| 238 | |
| 239 | ForEachIntermediatePoint([offsetIndex](RouteMarkPoint * mark) |
| 240 | { |
| 241 | if (mark->GetIntermediateIndex() >= offsetIndex) |
| 242 | mark->SetIntermediateIndex(mark->GetIntermediateIndex() + 1); |
| 243 | }); |
| 244 | |
| 245 | if (data.m_pointType == RouteMarkType::Start) |
| 246 | { |
| 247 | if (count > 1) |
| 248 | sameTypePoint->SetRoutePointFullType(RouteMarkType::Intermediate, 0); |
| 249 | else |
| 250 | sameTypePoint->SetRoutePointFullType(RouteMarkType::Finish, 0); |
| 251 | } |
| 252 | } |
| 253 | } |
| 254 | auto * newPoint = m_editSession.CreateUserMark<RouteMarkPoint>(data.m_position); |
| 255 | newPoint->SetMarkData(std::move(data)); |
| 256 | } |
| 257 | |
| 258 | bool RoutePointsLayout::RemoveRoutePoint(RouteMarkType type, size_t intermediateIndex) |
| 259 | { |
no test coverage detected