From cb668a73b1f747be04e09968f1789ab779b2ca45 Mon Sep 17 00:00:00 2001 From: sbh Date: Wed, 24 Dec 2014 18:33:00 +0300 Subject: [PATCH] BREP/STEP Import moved into GeomAlgoAPI. ExchangePlugin is not linked with OCC anymore. --- src/ExchangePlugin/CMakeLists.txt | 17 +------ .../ExchangePlugin_ImportFeature.cpp | 4 +- src/GeomAlgoAPI/CMakeLists.txt | 18 ++++++-- .../GeomAlgoAPI_BREPImport.cpp} | 2 +- .../GeomAlgoAPI_BREPImport.h} | 12 ++--- .../GeomAlgoAPI_STEPImport.cpp} | 44 +------------------ .../GeomAlgoAPI_STEPImport.h} | 8 ++-- src/ModelAPI/Test/TestDocument.py | 2 +- 8 files changed, 33 insertions(+), 74 deletions(-) rename src/{ExchangePlugin/ExchangePlugin_BREPImport.cpp => GeomAlgoAPI/GeomAlgoAPI_BREPImport.cpp} (95%) rename src/{ExchangePlugin/ExchangePlugin_BREPImport.h => GeomAlgoAPI/GeomAlgoAPI_BREPImport.h} (68%) rename src/{ExchangePlugin/ExchangePlugin_STEPImport.cpp => GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp} (92%) rename src/{ExchangePlugin/ExchangePlugin_STEPImport.h => GeomAlgoAPI/GeomAlgoAPI_STEPImport.h} (87%) diff --git a/src/ExchangePlugin/CMakeLists.txt b/src/ExchangePlugin/CMakeLists.txt index be417a408..6ed972b2b 100644 --- a/src/ExchangePlugin/CMakeLists.txt +++ b/src/ExchangePlugin/CMakeLists.txt @@ -15,16 +15,12 @@ SET(PROJECT_HEADERS ExchangePlugin_Plugin.h ExchangePlugin_ImportFeature.h ExchangePlugin_Validators.h - ExchangePlugin_BREPImport.h - ExchangePlugin_STEPImport.h ) SET(PROJECT_SOURCES ExchangePlugin_Plugin.cpp ExchangePlugin_ImportFeature.cpp ExchangePlugin_Validators.cpp - ExchangePlugin_BREPImport.cpp - ExchangePlugin_STEPImport.cpp ) SET(XML_RESOURCES @@ -33,19 +29,10 @@ SET(XML_RESOURCES SET(PROJECT_LIBRARIES Events - ModelAPI Config + ModelAPI GeomAPI - ${CAS_TKBRep} - ${CAS_TKSTEP} - ${CAS_TKSTEPBase} - ${CAS_TKXSBase} - ${CAS_TKCAF} - ${CAS_TKLCAF} - ${CAS_OCAF} - ${CAS_TKCAF} - ${CAS_SHAPE} - ${CAS_TKBO} + GeomAlgoAPI ) ADD_DEFINITIONS(-DEXCHANGEPLUGIN_EXPORTS ${CAS_DEFINITIONS}) diff --git a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp index 85cdffe56..9ffa3bd3d 100644 --- a/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ImportFeature.cpp @@ -8,8 +8,8 @@ */ #include -#include -#include +#include +#include #include #include diff --git a/src/GeomAlgoAPI/CMakeLists.txt b/src/GeomAlgoAPI/CMakeLists.txt index 5ae5c8e50..de7f2da3e 100644 --- a/src/GeomAlgoAPI/CMakeLists.txt +++ b/src/GeomAlgoAPI/CMakeLists.txt @@ -17,6 +17,8 @@ SET(PROJECT_HEADERS GeomAlgoAPI_MakeShape.h GeomAlgoAPI_DFLoader.h GeomAlgoAPI_Placement.h + GeomAlgoAPI_BREPImport.h + GeomAlgoAPI_STEPImport.h ) SET(PROJECT_SOURCES @@ -30,16 +32,26 @@ SET(PROJECT_SOURCES GeomAlgoAPI_MakeShape.cpp GeomAlgoAPI_DFLoader.cpp GeomAlgoAPI_Placement.cpp + GeomAlgoAPI_BREPImport.cpp + GeomAlgoAPI_STEPImport.cpp ) SET(PROJECT_LIBRARIES GeomAPI - ModelAPI - ${CAS_TKBool} + ModelAPI + ${CAS_OCAF} + ${CAS_SHAPE} ${CAS_TKBO} + ${CAS_TKBool} + ${CAS_TKBRep} + ${CAS_TKCAF} + ${CAS_TKCAF} + ${CAS_TKLCAF} ${CAS_TKPrim} - ${CAS_SHAPE} + ${CAS_TKSTEP} + ${CAS_TKSTEPBase} ${CAS_TKTopAlgo} + ${CAS_TKXSBase} ) ADD_DEFINITIONS(-DGEOMALGOAPI_EXPORTS ${CAS_DEFINITIONS}) diff --git a/src/ExchangePlugin/ExchangePlugin_BREPImport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_BREPImport.cpp similarity index 95% rename from src/ExchangePlugin/ExchangePlugin_BREPImport.cpp rename to src/GeomAlgoAPI/GeomAlgoAPI_BREPImport.cpp index 8c4c593f2..6d676af7c 100644 --- a/src/ExchangePlugin/ExchangePlugin_BREPImport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_BREPImport.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -#include +#include #include #include diff --git a/src/ExchangePlugin/ExchangePlugin_BREPImport.h b/src/GeomAlgoAPI/GeomAlgoAPI_BREPImport.h similarity index 68% rename from src/ExchangePlugin/ExchangePlugin_BREPImport.h rename to src/GeomAlgoAPI/GeomAlgoAPI_BREPImport.h index 875add9c9..e8db4b556 100644 --- a/src/ExchangePlugin/ExchangePlugin_BREPImport.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_BREPImport.h @@ -1,16 +1,16 @@ // Copyright (C) 2014-20xx CEA/DEN, EDF R&D /* - * ExchangePlugin_BREPImport.h + * GEOMALGOAPI_BREPImport.h * * Created on: Dec 24, 2014 * Author: sbh */ -#ifndef EXCHANGEPLUGIN_BREPIMPORT_H_ -#define EXCHANGEPLUGIN_BREPIMPORT_H_ +#ifndef GEOMALGOAPI_BREPIMPORT_H_ +#define GEOMALGOAPI_BREPIMPORT_H_ -#include +#include #include #include @@ -18,11 +18,11 @@ namespace BREPImport { -EXCHANGEPLUGIN_EXPORT +GEOMALGOAPI_EXPORT TopoDS_Shape Import(const TCollection_AsciiString& theFileName, const TCollection_AsciiString& theFormatName, TCollection_AsciiString& theError, const TDF_Label&); } -#endif /* EXCHANGEPLUGIN_BREPIMPORT_H_ */ +#endif /* GEOMALGOAPI_BREPIMPORT_H_ */ diff --git a/src/ExchangePlugin/ExchangePlugin_STEPImport.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp similarity index 92% rename from src/ExchangePlugin/ExchangePlugin_STEPImport.cpp rename to src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp index b2b1c6c98..2510db413 100644 --- a/src/ExchangePlugin/ExchangePlugin_STEPImport.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -#include +#include #include #include @@ -482,47 +482,7 @@ TopoDS_Shape Import (const TCollection_AsciiString& theFileName, theError = "No geometrical data in the imported file."; return TopoDS_Shape(); } - - // BEGIN: Store names and materials of sub-shapes from file - TopTools_IndexedMapOfShape anIndices; - TopExp::MapShapes(aResShape, anIndices); - - Handle(Interface_InterfaceModel) Model = aReader.WS()->Model(); - Handle(XSControl_TransferReader) TR = aReader.WS()->TransferReader(); - if (!TR.IsNull()) { - Handle(Transfer_TransientProcess) TP = TR->TransientProcess(); - - Standard_Integer nb = Model->NbEntities(); - - for (Standard_Integer ie = 1; ie <= nb; ie++) { - Handle(Standard_Transient) enti = Model->Value(ie); - - // Store names. - StoreName(enti, anIndices, TP, theShapeLabel); - - // Store materials. - StoreMaterial(enti, anIndices, TP, theShapeLabel); - } - } - // END: Store names and materials - } - else { -// switch (status) { -// case IFSelect_RetVoid: -// theError = "Nothing created or No data to process"; -// break; -// case IFSelect_RetError: -// theError = "Error in command or input data"; -// break; -// case IFSelect_RetFail: -// theError = "Execution was run, but has failed"; -// break; -// case IFSelect_RetStop: -// theError = "Execution has been stopped. Quite possible, an exception was raised"; -// break; -// default: -// break; -// } + } else { theError = "Wrong format of the imported file. Can't import file."; aResShape.Nullify(); } diff --git a/src/ExchangePlugin/ExchangePlugin_STEPImport.h b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.h similarity index 87% rename from src/ExchangePlugin/ExchangePlugin_STEPImport.h rename to src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.h index 784e66538..6cb5df61c 100644 --- a/src/ExchangePlugin/ExchangePlugin_STEPImport.h +++ b/src/GeomAlgoAPI/GeomAlgoAPI_STEPImport.h @@ -1,13 +1,13 @@ // Copyright (C) 2014-20xx CEA/DEN, EDF R&D /* - * ExchangePlugin_STEPImport.h + * GEOMALGOAPI_STEPImport.h * * Created on: Dec 24, 2014 * Author: sbh */ -#include +#include #include #include @@ -16,11 +16,11 @@ namespace STEPImport { -EXCHANGEPLUGIN_EXPORT +GEOMALGOAPI_EXPORT Handle(TCollection_HAsciiString) GetValue(const TCollection_AsciiString& theFileName, const TCollection_AsciiString& theParameterName, TCollection_AsciiString& theError); -EXCHANGEPLUGIN_EXPORT +GEOMALGOAPI_EXPORT TopoDS_Shape Import(const TCollection_AsciiString& theFileName, const TCollection_AsciiString& theFormatName, TCollection_AsciiString& theError, const TDF_Label& theShapeLabel); diff --git a/src/ModelAPI/Test/TestDocument.py b/src/ModelAPI/Test/TestDocument.py index fd9415488..86b380ddd 100644 --- a/src/ModelAPI/Test/TestDocument.py +++ b/src/ModelAPI/Test/TestDocument.py @@ -10,7 +10,7 @@ from ModelAPI import * # from GeomDataAPI import * # from GeomAlgoAPI import * -__updated__ = "2014-12-16" +__updated__ = "2014-12-24" #========================================================================= # Creation and activation of documents -- 2.39.2