| 974 | } |
| 975 | |
| 976 | void SketchObject::onGeometryChanged() |
| 977 | { |
| 978 | if (isRestoring() && checkMigration(Geometry)) { |
| 979 | // Construction migration to extension |
| 980 | for (auto geometryValue : Geometry.getValues()) { |
| 981 | if (!geometryValue->hasExtension( |
| 982 | Part::GeometryMigrationExtension::getClassTypeId())) { |
| 983 | continue; |
| 984 | } |
| 985 | |
| 986 | auto ext = std::static_pointer_cast<Part::GeometryMigrationExtension>( |
| 987 | geometryValue |
| 988 | ->getExtension(Part::GeometryMigrationExtension::getClassTypeId()) |
| 989 | .lock()); |
| 990 | |
| 991 | // at this point IA geometry is already migrated |
| 992 | auto gf = GeometryFacade::getFacade(geometryValue); |
| 993 | |
| 994 | if (ext->testMigrationType(Part::GeometryMigrationExtension::Construction)) { |
| 995 | bool oldconstr = ext->getConstruction() |
| 996 | || (geometryValue->is<Part::GeomPoint>() && !gf->isInternalAligned()); |
| 997 | gf->setConstruction(oldconstr); |
| 998 | } |
| 999 | if (ext->testMigrationType(Part::GeometryMigrationExtension::GeometryId)) { |
| 1000 | gf->setId(ext->getId()); |
| 1001 | } |
| 1002 | } |
| 1003 | } |
| 1004 | geoMap.clear(); |
| 1005 | const auto &vals = getInternalGeometry(); |
| 1006 | for (long i = 0; i < (long)vals.size(); ++i) { |
| 1007 | auto geo = vals[i]; |
| 1008 | auto gf = GeometryFacade::getFacade(geo); |
| 1009 | if (gf->getId() == 0) { |
| 1010 | gf->setId(++geoLastId); |
| 1011 | } |
| 1012 | else if (gf->getId() > geoLastId) { |
| 1013 | geoLastId = gf->getId(); |
| 1014 | } |
| 1015 | while (!geoMap.insert(std::make_pair(gf->getId(), i)).second) { |
| 1016 | FC_WARN("duplicate geometry id " << gf->getId() << " -> " |
| 1017 | << geoLastId + 1); // NOLINT |
| 1018 | gf->setId(++geoLastId); |
| 1019 | } |
| 1020 | } |
| 1021 | updateGeoHistory(); |
| 1022 | |
| 1023 | auto doc = getDocument(); |
| 1024 | |
| 1025 | if (doc && doc->isPerformingTransaction()) { |
| 1026 | // undo/redo |
| 1027 | setStatus(App::PendingTransactionUpdate, true); |
| 1028 | return; |
| 1029 | } |
| 1030 | |
| 1031 | if (internaltransaction) { |
| 1032 | return; |
| 1033 | } |
nothing calls this directly
no test coverage detected