-void BLSURFPlugin_Hypothesis::ClearEnforcedVertex(const TEnfEntry& entry, double x, double y, double z)
- throw (std::invalid_argument)
-{
- std::ostringstream msg ;
-
- TEnfVertex enfVertex;
- enfVertex.push_back(x);
- enfVertex.push_back(y);
- enfVertex.push_back(z);
-
- // check that enf vertex with given coords exists
- if (_enfVertexList.count(enfVertex) == 0) {
- msg << "No enforced vertex for " << entry;
- throw std::invalid_argument(msg.str());
+bool BLSURFPlugin_Hypothesis::ClearEnforcedVertex(const TEntry& theFaceEntry, double x, double y, double z,
+ const TEntry& theVertexEntry) throw (std::invalid_argument) {
+
+ bool toNotify = false;
+ std::ostringstream msg;
+ TEnfVertex *oldEnfVertex;
+ TEnfVertexCoords coords;
+ coords.clear();
+ coords.push_back(x);
+ coords.push_back(y);
+ coords.push_back(z);
+
+ // check that enf vertex with given enf vertex entry exists
+ TEnfVertexEntryEnfVertexMap::iterator it_enfVertexEntry = _enfVertexEntryEnfVertexMap.find(theVertexEntry);
+ if (it_enfVertexEntry != _enfVertexEntryEnfVertexMap.end()) {
+ // Success
+ MESSAGE("Found enforced vertex with geom entry " << theVertexEntry);
+ oldEnfVertex = it_enfVertexEntry->second;
+
+ _enfVertexEntryEnfVertexMap.erase(it_enfVertexEntry);
+
+ TEntryList& enfVertexEntryList = _faceEntryEnfVertexEntryListMap[theFaceEntry];
+ enfVertexEntryList.erase(theVertexEntry);
+ if (enfVertexEntryList.size() == 0)
+ _faceEntryEnfVertexEntryListMap.erase(theFaceEntry);
+ // TFaceEntryEnfVertexEntryListMap::iterator it_entry_entry = _faceEntryEnfVertexEntryListMap.find(theFaceEntry);
+ // TEntryList::iterator it_entryList = it_entry_entry->second.find(theVertexEntry);
+ // it_entry_entry->second.erase(it_entryList);
+ // if (it_entry_entry->second.size() == 0)
+ // _faceEntryEnfVertexEntryListMap.erase(it_entry_entry);
+ } else {
+ // Fail
+ MESSAGE("Enforced vertex with geom entry " << theVertexEntry << " not found");
+ msg << "No enforced vertex with geom entry " << theVertexEntry;
+ // check that enf vertex with given coords exists
+ TCoordsEnfVertexMap::iterator it_coords_enf = _coordsEnfVertexMap.find(coords);
+ if (it_coords_enf != _coordsEnfVertexMap.end()) {
+ // Success
+ MESSAGE("Found enforced vertex with coords " << x << ", " << y << ", " << z);
+ oldEnfVertex = it_coords_enf->second;
+
+ _coordsEnfVertexMap.erase(it_coords_enf);
+
+ TEnfVertexCoordsList& enfVertexCoordsList = _faceEntryCoordsListMap[theFaceEntry];
+ enfVertexCoordsList.erase(coords);
+ if (enfVertexCoordsList.size() == 0)
+ _faceEntryCoordsListMap.erase(theFaceEntry);
+ // TFaceEntryCoordsListMap::iterator it_entry_coords = _faceEntryCoordsListMap.find(theFaceEntry);
+ // TEnfVertexCoordsList::iterator it_coordsList = it_entry_coords->second.find(coords);
+ // it_entry_coords->second.erase(it_coordsList);
+ // if (it_entry_coords->second.size() == 0)
+ // _faceEntryCoordsListMap.erase(it_entry_coords);
+ } else {
+ // Fail
+ MESSAGE("Enforced vertex with coords " << x << ", " << y << ", " << z << " not found");
+ msg << std::endl;
+ msg << "No enforced vertex at " << x << ", " << y << ", " << z;
+ throw std::invalid_argument(msg.str());
+ }