-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "ModelHighAPI_Tools.h"
aShapeType = shapeTypeByStr(aType);
break;
}
+ case ModelHighAPI_Selection::VT_WeakNamingPair: {
+ TypeWeakNamingPair aPair = theSelection.typeWeakNamingPair();
+ std::string aType = aPair.first;
+ aShapeType = shapeTypeByStr(aType);
+ break;
+ }
}
return aShapeType;
return ""; // bad case
}
-/// stores the features information, recoursively stores sub-documetns features
+/// stores the features information, recursively stores sub-documents features
std::string storeFeatures(const std::string& theDocName, DocumentPtr theDoc,
std::map<std::string, std::map<std::string, ModelHighAPI_FeatureStore> >& theStore,
const bool theCompare) // if false => store
}
}
// store the model features information: iterate all features
- int anObjectsCount = 0; // stores the number of compared features for this document to compate
+ int anObjectsCount = 0; // stores the number of compared features for this document to compare
std::set<std::string> aProcessed; // processed features names (that are in the current document)
// process all objects (features and folders)
ModelAPI_Tools::allResults(aFeature, allResults);
std::list<ResultPtr>::iterator aRes = allResults.begin();
for(; aRes != allResults.end(); aRes++) {
- // recoursively store features of sub-documents
+ // recursively store features of sub-documents
if ((*aRes)->groupName() == ModelAPI_ResultPart::group()) {
DocumentPtr aDoc = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aRes)->partDoc();
if (aDoc.get()) {
static bool dumpToPython(SessionPtr theSession,
const char* theFilename,
- const char* theSelectionType,
+ const checkDumpType theSelectionType,
const std::string& theErrorMsgContext)
{
// 2431: set PartSet as a current document
if (aDump.get()) {
aDump->string("file_path")->setValue(theFilename);
aDump->string("file_format")->setValue("py");
- aDump->string("selection_type")->setValue(theSelectionType);
- aDump->execute();
+ aDump->boolean("topological_naming")->setValue(theSelectionType & CHECK_NAMING);
+ aDump->boolean("geometric_selection")->setValue(theSelectionType & CHECK_GEOMETRICAL);
+ aDump->boolean("weak_naming")->setValue(theSelectionType & CHECK_WEAK);
}
bool isProblem = !aDump.get() || !aDump->error().empty(); // after "finish" dump will be removed
if (isProblem && aDump.get()) {
return true;
}
-bool checkPythonDump()
+bool checkPythonDump(const checkDumpType theCheckType)
{
- return true;
-
static const std::string anErrorByNaming("checkPythonDump by naming");
static const std::string anErrorByGeometry("checkPythonDump by geometry");
+ static const std::string anErrorByWeak("checkPythonDump by weak naming");
- static char aFileForNamingDump[] = "./check_dump_byname.py";
- static char aFileForGeometryDump[] = "./check_dump_bygeom.py";
+ static char aFileForNamingDump[] = "./check_dump.py";
+ static char aFileForGeometryDump[] = "./check_dump_geo.py";
+ static char aFileForWeakDump[] = "./check_dump_weak.py";
SessionPtr aSession = ModelAPI_Session::get();
- // dump with the selection by names
- if (!dumpToPython(aSession, aFileForNamingDump, "topological_naming", anErrorByNaming))
- return false;
- // dump with the selection by geometry
- if (!dumpToPython(aSession, aFileForGeometryDump, "geometric_selection", anErrorByGeometry))
+ // dump with the specified types
+ char* aFileName = theCheckType == CHECK_GEOMETRICAL ? aFileForGeometryDump :
+ (theCheckType == CHECK_WEAK ? aFileForWeakDump : aFileForNamingDump);
+ if (!dumpToPython(aSession, aFileName, theCheckType, anErrorByNaming))
return false;
// map from document name to feature name to feature data
return false;
}
- // check dump with the selection by names
- bool isOk = checkDump(aSession, aFileForNamingDump, aStore, anErrorByNaming);
- // check dump with the selection by geometry
- isOk = isOk && checkDump(aSession, aFileForGeometryDump, aStore, anErrorByGeometry);
+ bool isOk = true;
+ if (theCheckType & CHECK_NAMING) {
+ // check dump with the selection by names
+ isOk = checkDump(aSession, aFileForNamingDump, aStore, anErrorByNaming);
+ }
+ if (theCheckType & CHECK_GEOMETRICAL) {
+ // check dump with the selection by geometry
+ isOk = isOk && checkDump(aSession, aFileForGeometryDump, aStore, anErrorByGeometry);
+ }
+ if (theCheckType & CHECK_WEAK) {
+ isOk = isOk && checkDump(aSession, aFileForWeakDump, aStore, anErrorByWeak);
+ }
return isOk;
}