FIND_PACKAGE(SalomeOpenCASCADE REQUIRED)
+SET(CommonGeomLib_ROOT_DIR $ENV{CommonGeomLib_ROOT_DIR} CACHE PATH "Path to the CommonGeomLib tool")
+IF(EXISTS ${CommonGeomLib_ROOT_DIR})
+ FIND_PACKAGE(SalomeCommonGeomLib REQUIRED)
+ELSE(EXISTS ${CommonGeomLib_ROOT_DIR})
+ MESSAGE(FATAL_ERROR "We absolutely need the CommonGeomLib tool, please define CommonGeomLib_ROOT_DIR !")
+ENDIF(EXISTS ${CommonGeomLib_ROOT_DIR})
+
IF(SALOME_GEOM_USE_VTK)
FIND_PACKAGE(SalomeVTK REQUIRED)
ADD_DEFINITIONS(-DWITH_VTK)
SET(KERNEL_ROOT_DIR "${KERNEL_ROOT_DIR}")
SET(GUI_ROOT_DIR "${GUI_ROOT_DIR}")
SET(OPENCASCADE_ROOT_DIR "${OPENCASCADE_ROOT_DIR}")
+SET(CommonGeomLib_ROOT_DIR "${CommonGeomLib_ROOT_DIR}")
SET(VTK_ROOT_DIR "${VTK_ROOT_DIR}")
SET(OPENCV_ROOT_DIR "${OPENCV_ROOT_DIR}")
SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
# Build variables that will be expanded when configuring Salome<MODULE>Config.cmake:
-SALOME_CONFIGURE_PREPARE(OpenCV OpenCASCADE VTK)
+SALOME_CONFIGURE_PREPARE(OpenCV OpenCASCADE CommonGeomLib VTK)
CONFIGURE_PACKAGE_CONFIG_FILE(${PROJECT_NAME}Config.cmake.in
${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
INSTALL_DESTINATION "${SALOME_INSTALL_CMAKE_LOCAL}"
PATH_VARS CONF_INCLUDE_DIRS SALOME_INSTALL_CMAKE_LOCAL CMAKE_INSTALL_PREFIX
- KERNEL_ROOT_DIR GUI_ROOT_DIR OPENCASCADE_ROOT_DIR VTK_ROOT_DIR OPENCV_ROOT_DIR)
+ KERNEL_ROOT_DIR GUI_ROOT_DIR OPENCASCADE_ROOT_DIR CommonGeomLib_ROOT_DIR
+ VTK_ROOT_DIR OPENCV_ROOT_DIR)
# - in the install tree (VSR 16/08/2013: TEMPORARILY COMMENT THIS - TO REMOVE?):
# Get the relative path of the include directory so
${PTHREAD_INCLUDE_DIR}
${OpenCASCADE_INCLUDE_DIR}
${KERNEL_INCLUDE_DIRS}
+ ${CommonGeomLib_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/src/GEOMImpl
${PROJECT_SOURCE_DIR}/src/GEOM
${PROJECT_SOURCE_DIR}/src/GEOMAlgo
# additional include directories
INCLUDE_DIRECTORIES(
${OpenCASCADE_INCLUDE_DIR}
+ ${CommonGeomLib_INCLUDE_DIRS}
${KERNEL_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}/idl
${PROJECT_SOURCE_DIR}/src/GEOMAlgo
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-## FIXME
-SET(COMMONGEOMLIB_ROOT_DIR "/hdd2/S2/SALOME-MBS-DB11/INSTALL/CommonGeomLib")
-##
-message(STATUS "COMMONGEOMLIB_ROOT_DIR: ${COMMONGEOMLIB_ROOT_DIR}")
-SET(COMMONGEOMLIB_INCLUDE_DIR "${COMMONGEOMLIB_ROOT_DIR}/${SALOME_INSTALL_HEADERS}")
-SET(COMMONGEOMLIB_LIBRARY_DIR "${COMMONGEOMLIB_ROOT_DIR}/${SALOME_INSTALL_LIBS}")
-SET(COMMOMGEOMLIB_LIBRARIES GeomAnaTool)
-message(STATUS "COMMONGEOMLIB_INCLUDE_DIR: ${COMMONGEOMLIB_INCLUDE_DIR}")
-message(STATUS "COMMONGEOMLIB_LIBRARY_DIR: ${COMMONGEOMLIB_LIBRARY_DIR}")
-message(STATUS "COMMOMGEOMLIB_LIBRARIES: ${COMMOMGEOMLIB_LIBRARIES}")
-
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
${OpenCASCADE_INCLUDE_DIR}
+ ${CommonGeomLib_INCLUDE_DIRS}
${PTHREAD_INCLUDE_DIR}
${KERNEL_INCLUDE_DIRS}
${PYTHON_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
- ${COMMONGEOMLIB_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/src/ShHealOper
${PROJECT_SOURCE_DIR}/src/GEOM
${PROJECT_SOURCE_DIR}/src/BlockFix
)
# libraries to link to
-message(STATUS "----------------------------------------")
-message(STATUS "COMMONGEOMLIB_LIBRARIES: ${COMMOMGEOMLIB_LIBRARIES}")
-message(STATUS "OpenCASCADE_ModelingAlgorithms_LIBRARIES: ${OpenCASCADE_ModelingAlgorithms_LIBRARIES}")
-message(STATUS "PYTHON_LIBRARIES: ${PYTHON_LIBRARIES}")
-message(STATUS "KERNEL_SALOMELocalTrace: ${KERNEL_SALOMELocalTrace}")
-message(STATUS "----------------------------------------")
SET(_link_LIBRARIES
- ##FIXME:
- ## The following line works only for Linux, not for Windows
- ${COMMONGEOMLIB_LIBRARY_DIR}/libGeomAnaTool.so
+ ${CommonGeomLib_GeomAnaTool}
${OpenCASCADE_ModelingAlgorithms_LIBRARIES}
${PYTHON_LIBRARIES}
ShHealOper GEOMbasic BlockFix GEOMAlgo GEOMUtils GEOMSketcher GEOMArchimede XAO
//=============================================================================
bool GEOMImpl_IMeasureOperations::CheckShape (Handle(GEOM_Object) theShape,
const Standard_Boolean theIsCheckGeom,
- std::list<ShapeError> &theErrors)
+ std::list<GeomAnaTool::ShapeError> &theErrors)
{
SetErrorCode(KO);
theErrors.clear();
if (ana.IsValid()) {
isValid = true;
} else {
- FillErrors(ana, aShape, theErrors);
+ GeomAnaTool::FillErrors(ana, aShape, theErrors);
}
}
catch (Standard_Failure& aFail) {
//=============================================================================
TCollection_AsciiString GEOMImpl_IMeasureOperations::PrintShapeErrors
(Handle(GEOM_Object) theShape,
- const std::list<ShapeError> &theErrors)
+ const std::list<GeomAnaTool::ShapeError> &theErrors)
{
TCollection_AsciiString aDump;
if (!theErrors.empty()) {
// The shape is not valid. Prepare errors for dump.
TopTools_IndexedMapOfShape anIndices;
- std::list<ShapeError>::const_iterator anIter = theErrors.begin();
+ std::list<GeomAnaTool::ShapeError>::const_iterator anIter = theErrors.begin();
Standard_Integer nbv, nbe, nbw, nbf, nbs, nbo;
nbv = nbe = nbw = nbf = nbs = nbo = 0;
const bool theRunParallel,
const bool theDoExact,
Handle(GEOM_Object)& theResultShape,
- std::list<ShapeError>& theErrors)
+ std::list<GeomAnaTool::ShapeError>& theErrors)
{
SetErrorCode(KO);
theErrors.clear();
std::cout << "--- The operation has failures ---" << std::endl;
//aResult = aTool.Failures();
//std::cout << "#Failures = " << aResult.Extent() << std::endl;
- const std::list<GAT_ShapeError>& errors = aTool.ShapeErrors();
+ const std::list<GeomAnaTool::ShapeError>& errors = aTool.ShapeErrors();
std::cout << "#Failures = " << errors.size() << std::endl;
- for (std::list<GAT_ShapeError>::const_iterator it = errors.begin(); it != errors.end(); ++it)
+ for (std::list<GeomAnaTool::ShapeError>::const_iterator it = errors.begin(); it != errors.end(); ++it)
{
- ShapeError aError;
+ GeomAnaTool::ShapeError aError;
aError.error = it->error;
aError.incriminated = it->incriminated;
theErrors.push_back(aError);
return aMaxDist;
}
-//=======================================================================
-//function : FillErrorsSub
-//purpose : Fill the errors list of subshapes on shape.
-//=======================================================================
-void GEOMImpl_IMeasureOperations::FillErrorsSub
- (const BRepCheck_Analyzer &theAna,
- const TopoDS_Shape &theShape,
- const TopAbs_ShapeEnum theSubType,
- TopTools_DataMapOfIntegerListOfShape &theMapErrors) const
-{
- TopExp_Explorer anExp(theShape, theSubType);
- TopTools_MapOfShape aMapSubShapes;
-
- for (; anExp.More(); anExp.Next()) {
- const TopoDS_Shape &aSubShape = anExp.Current();
-
- if (aMapSubShapes.Add(aSubShape)) {
- const Handle(BRepCheck_Result) &aRes = theAna.Result(aSubShape);
-
- for (aRes->InitContextIterator();
- aRes->MoreShapeInContext();
- aRes->NextShapeInContext()) {
- if (aRes->ContextualShape().IsSame(theShape)) {
- BRepCheck_ListIteratorOfListOfStatus itl(aRes->StatusOnShape());
-
- if (itl.Value() != BRepCheck_NoError) {
- // Add all errors for theShape and its sub-shape.
- for (;itl.More(); itl.Next()) {
- const Standard_Integer aStat = (Standard_Integer)itl.Value();
-
- if (!theMapErrors.IsBound(aStat)) {
- TopTools_ListOfShape anEmpty;
-
- theMapErrors.Bind(aStat, anEmpty);
- }
-
- TopTools_ListOfShape &theShapes = theMapErrors.ChangeFind(aStat);
-
- theShapes.Append(aSubShape);
- theShapes.Append(theShape);
- }
- }
- }
-
- break;
- }
- }
- }
-}
-
-//=======================================================================
-//function : FillErrors
-//purpose : Fill the errors list.
-//=======================================================================
-void GEOMImpl_IMeasureOperations::FillErrors
- (const BRepCheck_Analyzer &theAna,
- const TopoDS_Shape &theShape,
- TopTools_DataMapOfIntegerListOfShape &theMapErrors,
- TopTools_MapOfShape &theMapShapes) const
-{
- if (theMapShapes.Add(theShape)) {
- // Fill errors of child shapes.
- for (TopoDS_Iterator iter(theShape); iter.More(); iter.Next()) {
- FillErrors(theAna, iter.Value(), theMapErrors, theMapShapes);
- }
-
- // Fill errors of theShape.
- const Handle(BRepCheck_Result) &aRes = theAna.Result(theShape);
-
- if (!aRes.IsNull()) {
- BRepCheck_ListIteratorOfListOfStatus itl(aRes->Status());
-
- if (itl.Value() != BRepCheck_NoError) {
- // Add all errors for theShape.
- for (;itl.More(); itl.Next()) {
- const Standard_Integer aStat = (Standard_Integer)itl.Value();
-
- if (!theMapErrors.IsBound(aStat)) {
- TopTools_ListOfShape anEmpty;
-
- theMapErrors.Bind(aStat, anEmpty);
- }
-
- theMapErrors.ChangeFind(aStat).Append(theShape);
- }
- }
- }
-
- // Add errors of subshapes on theShape.
- const TopAbs_ShapeEnum aType = theShape.ShapeType();
-
- switch (aType) {
- case TopAbs_EDGE:
- FillErrorsSub(theAna, theShape, TopAbs_VERTEX, theMapErrors);
- break;
- case TopAbs_FACE:
- FillErrorsSub(theAna, theShape, TopAbs_WIRE, theMapErrors);
- FillErrorsSub(theAna, theShape, TopAbs_EDGE, theMapErrors);
- FillErrorsSub(theAna, theShape, TopAbs_VERTEX, theMapErrors);
- break;
- case TopAbs_SOLID:
- FillErrorsSub(theAna, theShape, TopAbs_SHELL, theMapErrors);
- break;
- default:
- break;
- }
- }
-}
-
-//=======================================================================
-//function : FillErrors
-//purpose : Fill the errors list.
-//=======================================================================
-void GEOMImpl_IMeasureOperations::FillErrors
- (const BRepCheck_Analyzer &theAna,
- const TopoDS_Shape &theShape,
- std::list<ShapeError> &theErrors) const
-{
- // Fill the errors map.
- TopTools_DataMapOfIntegerListOfShape aMapErrors;
- TopTools_MapOfShape aMapShapes;
-
- FillErrors(theAna, theShape, aMapErrors, aMapShapes);
-
- // Map sub-shapes and their indices
- TopTools_IndexedMapOfShape anIndices;
-
- TopExp::MapShapes(theShape, anIndices);
-
- TopTools_DataMapIteratorOfDataMapOfIntegerListOfShape aMapIter(aMapErrors);
-
- for (; aMapIter.More(); aMapIter.Next()) {
- ShapeError anError;
-
- anError.error = (BRepCheck_Status)aMapIter.Key();
-
- TopTools_ListIteratorOfListOfShape aListIter(aMapIter.Value());
- TopTools_MapOfShape aMapUnique;
-
- for (; aListIter.More(); aListIter.Next()) {
- const TopoDS_Shape &aShape = aListIter.Value();
-
- if (aMapUnique.Add(aShape)) {
- const Standard_Integer anIndex = anIndices.FindIndex(aShape);
-
- anError.incriminated.push_back(anIndex);
- }
- }
-
- if (!anError.incriminated.empty()) {
- theErrors.push_back(anError);
- }
- }
-}
-
//=======================================================================
//function : ShapeProximityCalculator
//purpose : returns an object to compute the proximity value
#include "GEOM_IOperations.hxx"
+#include <GeomAnaTool_Tools.hxx>
+
#include <BRepCheck_Analyzer.hxx>
#include <BRepCheck_Status.hxx>
#include <TopoDS_Shape.hxx>
Standard_Real& EdgeMin, Standard_Real& EdgeMax,
Standard_Real& VertMin, Standard_Real& VertMax);
- struct ShapeError {
- BRepCheck_Status error;
- std::list<int> incriminated;
- };
-
Standard_EXPORT bool CheckShape (Handle(GEOM_Object) theShape,
const Standard_Boolean theIsCheckGeom,
- std::list<ShapeError> &theErrors);
+ std::list<GeomAnaTool::ShapeError> &theErrors);
Standard_EXPORT TCollection_AsciiString PrintShapeErrors
(Handle(GEOM_Object) theShape,
- const std::list<ShapeError> &theErrors);
+ const std::list<GeomAnaTool::ShapeError> &theErrors);
Standard_EXPORT bool ExtractBOPFailure
(const Handle(TColStd_HSequenceOfTransient)& theShapes,
const bool theRunParallel,
const bool theDoExact,
Handle(GEOM_Object)& theResultShape,
- std::list<ShapeError>& theErrors);
+ std::list<GeomAnaTool::ShapeError>& theErrors);
Standard_EXPORT bool CheckSelfIntersections (Handle(GEOM_Object) theShape,
const SICheckLevel theCheckLevel,
private:
- void FillErrorsSub
- (const BRepCheck_Analyzer &theAna,
- const TopoDS_Shape &theShape,
- const TopAbs_ShapeEnum theSubType,
- TopTools_DataMapOfIntegerListOfShape &theMapErrors) const;
- void FillErrors
- (const BRepCheck_Analyzer &theAna,
- const TopoDS_Shape &theShape,
- TopTools_DataMapOfIntegerListOfShape &theMapErrors,
- TopTools_MapOfShape &theMapShapes) const;
-
- void FillErrors (const BRepCheck_Analyzer &theAna,
- const TopoDS_Shape &theShape,
- std::list<ShapeError> &theErrors) const;
-
Standard_Real getSurfaceCurvatures (const Handle(Geom_Surface)& aSurf,
Standard_Real theUParam,
Standard_Real theVParam,
${PTHREAD_INCLUDE_DIR}
${OpenCASCADE_INCLUDE_DIR}
${KERNEL_INCLUDE_DIRS}
+ ${CommonGeomLib_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/src/GEOMImpl
${PROJECT_SOURCE_DIR}/src/GEOM
${PROJECT_SOURCE_DIR}/src/GEOMAlgo
# libraries to link to
SET(_link_LIBRARIES
+ ${CommonGeomLib_GeomAnaTool}
GEOMImpl
GEOMUtils
SalomeIDLGEOM
*/
static void ConvertShapeError
(const GEOM::GEOM_IMeasureOperations::ShapeErrors &theErrorsFrom,
- std::list<GEOMImpl_IMeasureOperations::ShapeError> &theErrorsTo)
+ std::list<GeomAnaTool::ShapeError> &theErrorsTo)
{
int aNbErr = theErrorsFrom.length();
int i = 0;
const GEOM::GEOM_IMeasureOperations::ShapeError anErr = theErrorsFrom[i];
const GEOM::GEOM_IMeasureOperations::ShapeErrorType aType = anErr.error;
const GEOM::ListOfLong anIncrims = anErr.incriminated;
- GEOMImpl_IMeasureOperations::ShapeError anErrStruct;
+ GeomAnaTool::ShapeError anErrStruct;
switch (aType) {
case GEOM::GEOM_IMeasureOperations::InvalidPointOnCurve:
* \param theErrorsTo result errors.
*/
static void ConvertShapeError
- (const std::list<GEOMImpl_IMeasureOperations::ShapeError> &theErrorsFrom,
+ (const std::list<GeomAnaTool::ShapeError> &theErrorsFrom,
GEOM::GEOM_IMeasureOperations::ShapeErrors_out &theErrorsTo)
{
const int aNbErr = theErrorsFrom.size();
anErrArray->length(aNbErr);
// fill the local CORBA array with values from lists
- std::list<GEOMImpl_IMeasureOperations::ShapeError>::const_iterator
+ std::list<GeomAnaTool::ShapeError>::const_iterator
anIt = theErrorsFrom.begin();
int i = 0;
return 0;
}
- std::list<GEOMImpl_IMeasureOperations::ShapeError> anErrList;
+ std::list<GeomAnaTool::ShapeError> anErrList;
bool isOk = GetOperations()->CheckShape(aShape, false, anErrList);
ConvertShapeError(anErrList, theErrors);
return 0;
}
- std::list<GEOMImpl_IMeasureOperations::ShapeError> anErrList;
+ std::list<GeomAnaTool::ShapeError> anErrList;
bool isOk = GetOperations()->CheckShape(aShape, true, anErrList);
ConvertShapeError(anErrList, theErrors);
}
// Convert the errors sequence
- std::list<GEOMImpl_IMeasureOperations::ShapeError> anErrList;
+ std::list<GeomAnaTool::ShapeError> anErrList;
ConvertShapeError(theErrors, anErrList);
// Perform partition operation and check for failures
Handle(::GEOM_Object) aResultShape;
- std::list<GEOMImpl_IMeasureOperations::ShapeError> anErrList;
+ std::list<GeomAnaTool::ShapeError> anErrList;
bool isOk = GetOperations()->ExtractBOPFailure
(aSeqShapes, theUseTimer, theTopoOnly,
theShortReport, theRunParallel, theDoExact,
# additional include directories
INCLUDE_DIRECTORIES(
${OpenCASCADE_INCLUDE_DIR}
+ ${CommonGeomLib_INCLUDE_DIRS}
${KERNEL_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}/idl
${PROJECT_SOURCE_DIR}/src/GEOMAlgo
# additional include directories
INCLUDE_DIRECTORIES(
${OpenCASCADE_INCLUDE_DIR}
+ ${CommonGeomLib_INCLUDE_DIRS}
${KERNEL_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}/idl
${PROJECT_SOURCE_DIR}/src/GEOMAlgo
# additional include directories
INCLUDE_DIRECTORIES(
${OpenCASCADE_INCLUDE_DIR}
+ ${CommonGeomLib_INCLUDE_DIRS}
${KERNEL_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}/idl
${PROJECT_SOURCE_DIR}/src/GEOMAlgo
# additional include directories
INCLUDE_DIRECTORIES(
${OpenCASCADE_INCLUDE_DIR}
+ ${CommonGeomLib_INCLUDE_DIRS}
${KERNEL_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}/idl
${PROJECT_SOURCE_DIR}/src/GEOMAlgo
# additional include directories
INCLUDE_DIRECTORIES(
${OpenCASCADE_INCLUDE_DIR}
+ ${CommonGeomLib_INCLUDE_DIRS}
${KERNEL_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}/idl
${PROJECT_SOURCE_DIR}/src/GEOMAlgo