| 1426 | } |
| 1427 | |
| 1428 | std::vector<PathObject*> PathObject::removeFromLine( |
| 1429 | PathPartVector::size_type part_index, |
| 1430 | PathCoord::length_type removal_begin, |
| 1431 | PathCoord::length_type removal_end) const |
| 1432 | { |
| 1433 | Q_ASSERT(path_parts.size() == 1); // TODO |
| 1434 | Q_ASSERT((symbol->getContainedTypes() & ~Symbol::Combined) == Symbol::Line); |
| 1435 | |
| 1436 | const PathPart& part = path_parts[part_index]; |
| 1437 | Q_ASSERT(part.path_coords.front().clen <= removal_begin); |
| 1438 | Q_ASSERT(part.path_coords.front().clen <= removal_end); |
| 1439 | Q_ASSERT(part.path_coords.back().clen >= removal_begin); |
| 1440 | Q_ASSERT(part.path_coords.back().clen >= removal_end); |
| 1441 | |
| 1442 | std::vector<PathObject*> objects; |
| 1443 | |
| 1444 | if (part.path_coords.front().clen >= removal_begin |
| 1445 | && part.path_coords.back().clen <= removal_end) |
| 1446 | { |
| 1447 | // nothing left, or invalid |
| 1448 | } |
| 1449 | else if (removal_end < removal_begin || part.isClosed()) |
| 1450 | { |
| 1451 | PathObject* obj = duplicate()->asPath(); |
| 1452 | obj->changePathBounds(part_index, removal_end, removal_begin); |
| 1453 | objects.push_back(obj); |
| 1454 | } |
| 1455 | else |
| 1456 | { |
| 1457 | if (removal_begin > part.path_coords.front().clen) |
| 1458 | { |
| 1459 | PathObject* obj = duplicate()->asPath(); |
| 1460 | obj->changePathBounds(part_index, part.path_coords.front().clen, removal_begin); |
| 1461 | objects.push_back(obj); |
| 1462 | } |
| 1463 | if (removal_end < part.path_coords.back().clen) |
| 1464 | { |
| 1465 | PathObject* obj = duplicate()->asPath(); |
| 1466 | obj->changePathBounds(part_index, removal_end, part.path_coords.back().clen); |
| 1467 | objects.push_back(obj); |
| 1468 | } |
| 1469 | } |
| 1470 | |
| 1471 | return objects; |
| 1472 | } |
| 1473 | |
| 1474 | std::vector<PathObject*> PathObject::splitLineAt(const PathCoord& split_pos) const |
| 1475 | { |
no test coverage detected