+
+ static const int THE_TYPES_SIZE = 3;
+ bool aTypes[THE_TYPES_SIZE] = {
+ boolean(TOPOLOGICAL_NAMING_DUMP_ID())->value(),
+ boolean(GEOMETRIC_DUMP_ID())->value(),
+ boolean(WEAK_NAMING_DUMP_ID())->value()
+ };
+ int aNbSelectedTypes = 0;
+ for (int i = 0; i < THE_TYPES_SIZE; ++i)
+ if (aTypes[i])
+ ++aNbSelectedTypes;
+
+ if (boolean(TOPOLOGICAL_NAMING_DUMP_ID())->value()) {
+ ModelHighAPI_Dumper::DumpStoragePtr aTopoNameStorage(new ModelHighAPI_Dumper::DumpStorage);
+ aDumper->addCustomStorage(aTopoNameStorage);
+ }
+ if (boolean(GEOMETRIC_DUMP_ID())->value()) {
+ ModelHighAPI_Dumper::DumpStoragePtr aGeomSelectionStorage(
+ new ModelHighAPI_Dumper::DumpStorageGeom);
+ if (aNbSelectedTypes > 1)
+ aGeomSelectionStorage->setFilenameSuffix("_geo");
+ aDumper->addCustomStorage(aGeomSelectionStorage);
+ }
+ if (boolean(WEAK_NAMING_DUMP_ID())->value()) {
+ ModelHighAPI_Dumper::DumpStoragePtr aWeakNamingStorage(
+ new ModelHighAPI_Dumper::DumpStorageWeak);
+ if (aNbSelectedTypes > 1)
+ aWeakNamingStorage->setFilenameSuffix("_weak");
+ aDumper->addCustomStorage(aWeakNamingStorage);
+ }
+
+ // pass dump directory to the dumper
+ AttributeStringPtr aDumpDirAttr =
+ this->string(ExchangePlugin_Dump::DUMP_DIR_ID());
+ std::string aDumpDir;
+ if (aDumpDirAttr.get() && aDumpDirAttr->isInitialized())
+ aDumpDir = aDumpDirAttr->value();
+ else
+ aDumpDir = GeomAlgoAPI_Tools::File_Tools::path(theFileName);
+ aDumper->setDumpDir(aDumpDir);
+
+ if (!aDumper->process(aDoc, theFileName)) {
+ setError("An error occurred while dumping to " + theFileName);
+ } else {
+ if (boolean(EXPORT_VARIABLES_ID())->value()) {
+ aDumper->exportVariables();
+ }
+ }
+ // clear cashed data after export variables was performed
+ aDumper->clearCustomStorage();
+