FeaturesAPI_Fillet.h
FeaturesAPI_Intersection.h
FeaturesAPI_Measurement.h
+ FeaturesAPI_DuplicatedFaces.h
FeaturesAPI_MultiRotation.h
FeaturesAPI_MultiTranslation.h
FeaturesAPI_Partition.h
FeaturesAPI_Fillet.cpp
FeaturesAPI_Intersection.cpp
FeaturesAPI_Measurement.cpp
+ FeaturesAPI_DuplicatedFaces.cpp
FeaturesAPI_MultiRotation.cpp
FeaturesAPI_MultiTranslation.cpp
FeaturesAPI_Partition.cpp
%shared_ptr(FeaturesAPI_BooleanSmash)
%shared_ptr(FeaturesAPI_BooleanFill)
%shared_ptr(FeaturesAPI_Chamfer)
+%shared_ptr(FeaturesAPI_DuplicatedFaces)
%shared_ptr(FeaturesAPI_Extrusion)
%shared_ptr(FeaturesAPI_ExtrusionBoolean)
%shared_ptr(FeaturesAPI_ExtrusionCut)
%include "FeaturesAPI_Fillet.h"
%include "FeaturesAPI_Intersection.h"
%include "FeaturesAPI_Measurement.h"
+%include "FeaturesAPI_DuplicatedFaces.h"
%include "FeaturesAPI_MultiRotation.h"
%include "FeaturesAPI_MultiTranslation.h"
%include "FeaturesAPI_Partition.h"
--- /dev/null
+// Copyright (C) 2018-2020 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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "FeaturesAPI_DuplicatedFaces.h"
+
+#include <FeaturesPlugin_DuplicatedFaces.h>
+#include <ModelAPI_AttributeDoubleArray.h>
+#include <ModelHighAPI_Services.h>
+#include <ModelHighAPI_Tools.h>
+
+#include <ModelHighAPI_Dumper.h>
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+
+
+FeaturesAPI_DuplicatedFaces::
+ FeaturesAPI_DuplicatedFaces(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+ : ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+FeaturesAPI_DuplicatedFaces::~FeaturesAPI_DuplicatedFaces()
+{
+}
+
+FeaturesAPI_DuplicatedFaces::FeaturesAPI_DuplicatedFaces(
+ const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Selection& theObject,
+ const double theTransparency,
+ const std::string & theNameGroup)
+:ModelHighAPI_Interface(theFeature)
+{
+ if (initialize()) {
+ fillAttribute(theObject, myobjectselected);
+ fillAttribute(theTransparency, mytransparency);
+ if( theNameGroup != "" )
+ {
+ fillAttribute(true,
+ feature()->boolean(FeaturesPlugin_DuplicatedFaces::CREATE_GROUP_ID()));
+ fillAttribute(theNameGroup, mygroupname);
+ }
+ execute();
+ }
+}
+
+void FeaturesAPI_DuplicatedFaces::dump(ModelHighAPI_Dumper& theDumper) const
+{
+ FeaturePtr aBase = feature();
+ const std::string& aDocName = theDumper.name(aBase->document());
+
+ AttributeSelectionPtr anAttrObject;
+ anAttrObject = aBase->selection(FeaturesPlugin_DuplicatedFaces::OBJECT_ID());
+
+ theDumper << aBase << " = model.getDuplicatedFaces(" << aDocName << ", " << anAttrObject;
+ theDumper << ", " << aBase->integer(FeaturesPlugin_DuplicatedFaces::TRANSPARENCY_ID());
+
+ if(aBase->boolean(FeaturesPlugin_DuplicatedFaces::CREATE_GROUP_ID())->value() )
+ theDumper << ", " << aBase->string(FeaturesPlugin_DuplicatedFaces::GROUP_NAME_ID());
+
+ theDumper << ")" << std::endl;
+}
+
+DuplicatedFacesPtr getDuplicatedFaces(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const ModelHighAPI_Selection& theObject,
+ const double theTransparency,
+ const std::string & theNameGroup)
+{
+
+ FeaturePtr aFeature = thePart->addFeature(FeaturesPlugin_DuplicatedFaces::ID());
+
+ DuplicatedFacesPtr aDuplicatedFaces;
+
+ aDuplicatedFaces.reset(new FeaturesAPI_DuplicatedFaces(aFeature,
+ theObject,
+ theTransparency,
+ theNameGroup));
+
+ return aDuplicatedFaces;
+}
+
--- /dev/null
+// Copyright (C) 2018-2020 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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef FeaturesAPI_DuplicatedFaces_H_
+#define FeaturesAPI_DuplicatedFaces_H_
+
+#include "FeaturesAPI.h"
+
+#include "FeaturesPlugin_DuplicatedFaces.h"
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+#include <memory>
+
+class ModelAPI_Document;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_DuplicatedFaces
+/// \ingroup CPPHighAPI
+/// \brief Interface to find duplicated faces
+class FeaturesAPI_DuplicatedFaces: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_DuplicatedFaces(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_DuplicatedFaces(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Selection& theobject,
+ const double theTransparency,
+ const std::string & theNameGroup);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_DuplicatedFaces();
+
+ INTERFACE_3(FeaturesPlugin_DuplicatedFaces::ID(),
+ objectselected, FeaturesPlugin_DuplicatedFaces::OBJECT_ID(),
+ ModelAPI_AttributeSelection,
+ /** object selected*/,
+ transparency, FeaturesPlugin_DuplicatedFaces::TRANSPARENCY_ID(),
+ ModelAPI_AttributeInteger,
+ /** transparency*/,
+ groupname, FeaturesPlugin_DuplicatedFaces::GROUP_NAME_ID(),
+ ModelAPI_AttributeString,
+ /** group name*/)
+
+ /// Dump wrapped feature
+ FEATURESAPI_EXPORT
+ virtual void dump(ModelHighAPI_Dumper& theDumper) const;
+
+};
+
+/// Pointer on the SharedFaces object.
+typedef std::shared_ptr<FeaturesAPI_DuplicatedFaces> DuplicatedFacesPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief get the duplicated Faces
+/// \param thePart the part
+/// \param theobject the object selected
+FEATURESAPI_EXPORT
+DuplicatedFacesPtr getDuplicatedFaces(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const ModelHighAPI_Selection& theObject,
+ const double theTransparency = 0.0,
+ const std::string & theNameGroup = "");
+
+#endif // FeaturesAPI_DuplicatedFaces_H_
#include "FeaturesAPI_Fillet.h"
#include "FeaturesAPI_Intersection.h"
#include "FeaturesAPI_Measurement.h"
+ #include "FeaturesAPI_DuplicatedFaces.h"
#include "FeaturesAPI_MultiRotation.h"
#include "FeaturesAPI_MultiTranslation.h"
#include "FeaturesAPI_Partition.h"
INCLUDE(Common)
INCLUDE(UnitTest)
+INCLUDE(UseQtExt)
+
+# additional include directories
+INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/src/GeomDataAPI
+ ${PROJECT_SOURCE_DIR}/src/Locale
+ ${PROJECT_SOURCE_DIR}/src/PrimitivesPlugin
+ ${QT_INCLUDES})
+
+# additional preprocessor / compiler flags
+ADD_DEFINITIONS(${QT_DEFINITIONS})
+
SET(PROJECT_HEADERS
FeaturesPlugin.h
FeaturesPlugin_Fillet.h
FeaturesPlugin_Fillet1D.h
FeaturesPlugin_Measurement.h
+ FeaturesPlugin_DuplicatedFaces.h
FeaturesPlugin_FusionFaces.h
FeaturesPlugin_RemoveResults.h
FeaturesPlugin_Chamfer.h
FeaturesPlugin_Fillet.cpp
FeaturesPlugin_Fillet1D.cpp
FeaturesPlugin_Measurement.cpp
+ FeaturesPlugin_DuplicatedFaces.cpp
FeaturesPlugin_FusionFaces.cpp
FeaturesPlugin_RemoveResults.cpp
FeaturesPlugin_Chamfer.cpp
fillet_widget.xml
fillet1d_widget.xml
measurement_widget.xml
+ duplicatedFaces_widget.xml
fusion_faces_widget.xml
chamfer_widget.xml
copy_widget.xml
FeaturesPlugin_msg_ru.ts
)
+# sources / moc wrappings
+QT_WRAP_MOC(PROJECT_AUTOMOC ${PROJECT_MOC_HEADERS})
+
+#QT5_ADD_TRANSLATION(QM_RESOURCES ${TEXT_RESOURCES})
+
+SOURCE_GROUP ("Generated Files" FILES ${PROJECT_AUTOMOC} ${PROJECT_COMPILED_RESOURCES} ${QM_RESOURCES})
SOURCE_GROUP ("XML Files" FILES ${XML_RESOURCES})
SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES})
../GeomAPI
../GeomAlgoAPI
../GeomValidators
+ ../ModuleBase
../Events
../Config
${OpenCASCADE_INCLUDE_DIR}
)
ADD_DEFINITIONS(-DFEATURESPLUGIN_EXPORTS)
-ADD_LIBRARY(FeaturesPlugin MODULE ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${XML_RESOURCES} ${TEXT_RESOURCES})
+ADD_LIBRARY(FeaturesPlugin MODULE
+ ${PROJECT_SOURCES}
+ ${PROJECT_HEADERS}
+ ${XML_RESOURCES}
+ ${TEXT_RESOURCES}
+ ${PROJECT_AUTOMOC})
TARGET_LINK_LIBRARIES(FeaturesPlugin ${PROJECT_LIBRARIES})
INSTALL(TARGETS FeaturesPlugin DESTINATION ${SHAPER_INSTALL_PLUGIN_FILES})
TestFillet1D_Wire_3.py
TestFillet1D_Wire_4.py
TestFillet1D_Wire_5.py
- Test19931.py
- Test20027.py
)
--- /dev/null
+// Copyright (C) 2018-2020 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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "FeaturesPlugin_DuplicatedFaces.h"
+
+#include <ModelAPI_AttributeSelection.h>
+#include <ModelAPI_AttributeRefList.h>
+#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_AttributeBoolean.h>
+#include <ModelAPI_AttributeString.h>
+#include <ModelAPI_AttributeInteger.h>
+#include <ModelAPI_Attribute.h>
+
+#include <ModelAPI_Data.h>
+#include <ModelAPI_Session.h>
+#include <ModelAPI_Validator.h>
+#include <Locale_Convert.h>
+
+#include <GeomAlgoAPI_CompoundBuilder.h>
+
+#include <Config_PropManager.h>
+#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_ResultGroup.h>
+#include <GeomAlgoAPI_ShapeTools.h>
+#include <GeomAlgoAPI_DuplicatedFaces.h>
+#include <GeomAPI_ShapeIterator.h>
+#include <ModelAPI_Tools.h>
+#include <iomanip>
+#include <sstream>
+#include <iostream>
+
+
+FeaturesPlugin_DuplicatedFaces::FeaturesPlugin_DuplicatedFaces()
+{
+}
+
+void FeaturesPlugin_DuplicatedFaces::initAttributes()
+{
+ // attribute for object selected
+ data()->addAttribute(OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
+ AttributeSelectionListPtr aList = std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(
+ data()->addAttribute(LIST_FACES_ID(), ModelAPI_AttributeSelectionList::typeId()));
+
+ data()->addAttribute(NUMBER_FACES_ID(), ModelAPI_AttributeString::typeId());
+ data()->addAttribute(TRANSPARENCY_ID(), ModelAPI_AttributeInteger::typeId());
+ data()->addAttribute(CREATE_GROUP_ID(), ModelAPI_AttributeBoolean::typeId());
+ data()->addAttribute(GROUP_NAME_ID(), ModelAPI_AttributeString::typeId());
+
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), GROUP_NAME_ID());
+ boolean(CREATE_GROUP_ID())->setValue(false);
+}
+
+void explode(const GeomShapePtr& theCompound, ListOfShape& theSubs)
+{
+ if (theCompound->isCompound() || theCompound->isCompSolid() ) {
+ GeomAPI_ShapeIterator anIt(theCompound);
+ for (; anIt.more(); anIt.next())
+ explode(anIt.current(), theSubs);
+ }
+ else
+ theSubs.push_back(theCompound);
+}
+
+void FeaturesPlugin_DuplicatedFaces::execute()
+{
+ if(boolean(CREATE_GROUP_ID())->value()
+ && selectionList(LIST_FACES_ID())->isInitialized()
+ && string(GROUP_NAME_ID())->value() != "" )
+ {
+ AttributeStringPtr aNameAtt = string( GROUP_NAME_ID() ) ;
+ std::wstring aNameFace = aNameAtt->isUValue() ?
+ Locale::Convert::toWString(aNameAtt->valueU()) :
+ Locale::Convert::toWString(aNameAtt->value());
+
+
+ setFacesGroup(aNameFace);
+ }
+ if( selection(OBJECT_ID())->isInitialized() )
+ {
+
+ AttributeSelectionPtr ancompSolidAttr = selection(OBJECT_ID());
+ ResultPtr aResult = ancompSolidAttr->context();
+
+ double aTranparency = integer(TRANSPARENCY_ID())->value()/100.0;
+ ModelAPI_Tools::setTransparency(aResult, aTranparency);
+
+ ResultBodyPtr aResultBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aResult);
+ std::list<ResultPtr> allRes;
+ ModelAPI_Tools::allSubs(aResultBody, allRes);
+ std::list<ResultPtr>::iterator aRes;
+ for(aRes = allRes.begin(); aRes != allRes.end(); aRes++) {
+ ModelAPI_Tools::setTransparency(*aRes, aTranparency);
+ }
+ }
+}
+
+void FeaturesPlugin_DuplicatedFaces::attributeChanged(const std::string& theID)
+{
+ if (theID == OBJECT_ID()) {
+ AttributeSelectionPtr ancompSolidAttr = selection(OBJECT_ID());
+
+ GeomShapePtr aShape = ancompSolidAttr->value();
+ if (aShape.get() && ancompSolidAttr->context().get()) {
+
+ aShape = ancompSolidAttr->context()->shape();
+ if(aShape){
+ std::string anError;
+ ListOfShape aFaces;
+ ListOfShape theSubs;
+ explode(aShape, theSubs);
+
+ if( !GetDuplicatedFaces( theSubs,
+ 0.001,
+ aFaces,
+ anError))
+ setError("Error in duplicated faces calculation :" + anError);
+
+
+ AttributeSelectionListPtr aFacesListAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>
+ (attribute(LIST_FACES_ID()));
+
+ if ( aFacesListAttr->isInitialized())
+ aFacesListAttr->clear();
+
+ aFacesListAttr->setSelectionType("face");
+
+ ListOfShape::const_iterator anIt = aFaces.cbegin();
+ for(; anIt != aFaces.cend(); ++anIt) {
+
+ GeomShapePtr aFacePtr = *anIt;
+
+ if (!aFacePtr.get()) {
+ setError("GetDuplicatedFaces : An invalid face found " + anError);
+ }
+ aFacesListAttr->append( ancompSolidAttr->context(), aFacePtr);
+ }
+ std::stringstream alabel;
+ alabel << "Number of duplicated faces : " << aFacesListAttr->size();
+ string(NUMBER_FACES_ID() )->setValue( alabel.str() );
+
+ }
+ }
+ }
+}
+
+void FeaturesPlugin_DuplicatedFaces::setFacesGroup(const std::wstring& theName )
+{
+ std::vector<int> aColor;
+ ResultGroupPtr aGroup = document()->createGroup(data());
+ // clean the result of the operation
+ aGroup->data()->setName(theName);
+ aGroup->store(GeomShapePtr());
+
+ // shapes containing in each group
+ ListOfShape aFaces;
+ AttributeSelectionListPtr aFacesListAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>
+ (attribute(LIST_FACES_ID()));
+
+ for(int anI =0; anI< aFacesListAttr->size(); anI++ )
+ {
+ AttributeSelectionPtr aAtt = aFacesListAttr->value(anI);
+ aFaces.push_back( aAtt->value() );
+ }
+ GeomShapePtr aCompound = GeomAlgoAPI_CompoundBuilder::compound(aFaces);
+ aGroup->store(aCompound);
+ aColor = {255,0,0};
+ setResult(aGroup);
+ ModelAPI_Tools::setColor( lastResult(),aColor);
+
+}
+
--- /dev/null
+// Copyright (C) 2018-2020 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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef FeaturesPlugin_DuplicatedFaces_H_
+#define FeaturesPlugin_DuplicatedFaces_H_
+
+#include "FeaturesPlugin.h"
+#include <ModelAPI_Feature.h>
+
+#include <GeomAPI_IPresentable.h>
+#include <GeomAPI_IScreenParams.h>
+#include <GeomAlgoAPI_Box.h>
+
+/// \class FeaturesPlugin_DuplicatedFaces
+/// \ingroup Plugins
+/// \brief Feature to check the duplicated faces of solid
+
+class FeaturesPlugin_DuplicatedFaces : public ModelAPI_Feature
+{
+public:
+ inline static const std::string& ID()
+ {
+ static const std::string MY_ID("Duplicated_faces");
+ return MY_ID;
+ }
+
+ /// \return the kind of a feature.
+ virtual const std::string& getKind()
+ {
+ return ID();
+ }
+
+ /// Attribute name for object selected.
+ inline static const std::string& OBJECT_ID()
+ {
+ static const std::string MY_OBJECT_ID("main_object");
+ return MY_OBJECT_ID;
+ }
+
+ /// Attribute name for number of faces.
+ inline static const std::string& NUMBER_FACES_ID()
+ {
+ static const std::string MY_NUMBER_FACES_ID("number_duplicated_faces");
+ return MY_NUMBER_FACES_ID;
+ }
+
+ /// Attribute name for z coodinate.
+ inline static const std::string& LIST_FACES_ID()
+ {
+ static const std::string MY_LIST_FACES_ID("faces");
+ return MY_LIST_FACES_ID;
+ }
+
+ /// Attribute name for transparency.
+ inline static const std::string& TRANSPARENCY_ID()
+ {
+ static const std::string MY_TRANSPARENCY_ID("transparency");
+ return MY_TRANSPARENCY_ID;
+ }
+
+ /// Attribute name for checkbox create group.
+ inline static const std::string& CREATE_GROUP_ID()
+ {
+ static const std::string MY_CREATE_GROUP_ID("create_group");
+ return MY_CREATE_GROUP_ID;
+ }
+
+ /// Attribute name for group name.
+ inline static const std::string& GROUP_NAME_ID()
+ {
+ static const std::string MY_GROUP_NAME_ID("group_name");
+ return MY_GROUP_NAME_ID;
+ }
+
+ /// Performs the algorithm and stores results it in the data structure.
+ FEATURESPLUGIN_EXPORT virtual void execute();
+
+ /// Request for initialization of data model of the feature: adding all attributes
+ FEATURESPLUGIN_EXPORT virtual void initAttributes();
+
+ /// Called on change of any argument-attribute of this object
+ /// \param theID identifier of changed attribute
+ FEATURESPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
+
+ /// Use plugin manager for features creation
+ FeaturesPlugin_DuplicatedFaces();
+
+ private:
+
+ //Set group of faces
+ void setFacesGroup(const std::wstring& theName );
+
+};
+
+#endif
#include <FeaturesPlugin_Fillet1D.h>
#include <FeaturesPlugin_Intersection.h>
#include <FeaturesPlugin_Measurement.h>
+#include <FeaturesPlugin_DuplicatedFaces.h>
#include <FeaturesPlugin_MultiRotation.h>
#include <FeaturesPlugin_MultiTranslation.h>
#include <FeaturesPlugin_Partition.h>
return FeaturePtr(new FeaturesPlugin_Fillet1D);
} else if (theFeatureID == FeaturesPlugin_Measurement::ID()) {
return FeaturePtr(new FeaturesPlugin_Measurement);
+ } else if (theFeatureID == FeaturesPlugin_DuplicatedFaces::ID()) {
+ return FeaturePtr(new FeaturesPlugin_DuplicatedFaces);
} else if (theFeatureID == FeaturesPlugin_RemoveResults::ID()) {
return FeaturePtr(new FeaturesPlugin_RemoveResults);
} else if (theFeatureID == FeaturesPlugin_Chamfer::ID()) {
--- /dev/null
+<source>
+ <shape_selector id="main_object"
+ label="Object"
+ tooltip="Select a object"
+ shape_types="compsolid compsolid object"
+ default=""
+ geometrical_selection="true">
+ <validator id="PartSet_DifferentObjects"/>
+ <validator id="GeomValidators_ShapeType" parameters="compsolid,compound"/>
+ </shape_selector>
+ <groupbox title="Duplicated faces">
+ <label id="number_duplicated_faces"/>
+ <multi_selector id="faces"
+ label="Liste of faces :"
+ icon=""
+ shape_types="faces"
+ Block_selection = "true"
+ use_choice="false">
+ <validator id="PartSet_DifferentObjects"/>
+ <validator id="GeomValidators_ShapeType" parameters="faces"/>
+ </multi_selector>
+ </groupbox>
+ <integervalue id="transparency"
+ label="Transparency"
+ min="0"
+ max="100"
+ step="10"
+ default="50">
+ </integervalue>
+ <optionalbox id="create_group" title="Create group" show_title="true">
+ <stringvalue id="group_name" label="Group Name"/>
+ <label/>
+ </optionalbox>
+</source>
<source path="fillet1d_widget.xml"/>
</feature>
<feature id="Fillet" title="Fillet" tooltip="Perform fillet on face or edge"
- icon="icons/Features/fillet.png" auto_preview="true" helpfile="filletFeature.html">
+ icon="icons/Features/fillet.png" auto_preview="false" helpfile="filletFeature.html">
<source path="fillet_widget.xml"/>
</feature>
<feature id="Chamfer" title="Chamfer" tooltip="Perform chamfer on face or edge"
<source path="chamfer_widget.xml"/>
</feature>
<feature id="FusionFaces" title="Fuse Faces" tooltip="Performs fusion of connected faces"
- icon="icons/Features/fusion_faces.png" auto_preview="true" helpfile="fuseFeatureFaces.html">
+ icon="icons/Features/fusion_faces.png" auto_preview="true" helpfile="FeaturesPlugin/fusionFacesFeature.html">
<source path="fusion_faces_widget.xml"/>
</feature>
<feature id="Defeaturing" title="Defeaturing" tooltip="Perform removing faces from solid"
<source path="measurement_widget.xml"/>
</feature>
</group>
+ <group id="Face">
+ <feature id="Duplicated_faces" title="Check duplicated faces" tooltip="Check the duplicated faces" auto_preview="true"
+ icon="icons/Features/duplicatedFaces.png" helpfile="measurementFeature.html">
+ <source path="duplicatedFaces_widget.xml"/>
+ </feature>
+ </group>
</workbench>
</plugin>
GeomAlgoAPI_Prism.h
GeomAlgoAPI_Revolution.h
GeomAlgoAPI_Boolean.h
+ GeomAlgoAPI_DuplicatedFaces.h
GeomAlgoAPI_ThroughAll.h
GeomAlgoAPI_Rotation.h
GeomAlgoAPI_Translation.h
GeomAlgoAPI_Fillet1D.h
GeomAlgoAPI_SortListOfShapes.h
GeomAlgoAPI_Filling.h
+ GeomAlgoAPI_GlueDetector.h
+ GeomAlgoAPI_GluerAlgo.h
+ GeomAlgoAPI_Algo.h
+ GEOMAlgo_BndSphereTree.hxx
+ GEOMAlgo_BndSphere.hxx
+ GEOMAlgo_BndSphere.lxx
+ GEOMAlgo_IndexedDataMapOfShapeBndSphere.hxx
+ GEOMAlgo_IndexedDataMapOfIntegerShape.hxx
+ GEOMAlgo_PassKeyShape.hxx
+ GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx
+ GEOMAlgo_PassKeyShapeMapHasher.hxx
+ GEOMAlgo_CoupleOfShapes.hxx
+ GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx
+ GEOMAlgo_ListOfCoupleOfShapes.hxx
+ GEOMAlgo_AlgoTools.hxx
GeomAlgoAPI_CurveBuilder.h
GeomAlgoAPI_NExplode.h
GeomAlgoAPI_Offset.h
GeomAlgoAPI_Prism.cpp
GeomAlgoAPI_Revolution.cpp
GeomAlgoAPI_Boolean.cpp
+ GeomAlgoAPI_DuplicatedFaces.cpp
GeomAlgoAPI_ThroughAll.cpp
GeomAlgoAPI_Rotation.cpp
GeomAlgoAPI_Translation.cpp
GeomAlgoAPI_Fillet1D.cpp
GeomAlgoAPI_SortListOfShapes.cpp
GeomAlgoAPI_Filling.cpp
+ GeomAlgoAPI_GlueDetector.cpp
+ GeomAlgoAPI_GluerAlgo.cpp
+ GeomAlgoAPI_Algo.cpp
+ GEOMAlgo_BndSphereTree.cxx
+ GEOMAlgo_BndSphere.cxx
+ GEOMAlgo_PassKeyShapeMapHasher.cxx
+ GEOMAlgo_CoupleOfShapes.cxx
+ GEOMAlgo_PassKeyShape.cxx
+ GEOMAlgo_AlgoTools.cxx
GeomAlgoAPI_CurveBuilder.cpp
GeomAlgoAPI_NExplode.cpp
GeomAlgoAPI_Offset.cpp
../GeomAlgoImpl
../ModelAPI
../XAO
+ ${PROJECT_SOURCE_DIR}/src/Locale
${OpenCASCADE_INCLUDE_DIR}
)
--- /dev/null
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : GEOMAlgo_AlgoTools.cxx
+// Created :
+// Author : Peter KURNEV
+
+#include <GEOMAlgo_AlgoTools.hxx>
+
+#include <gp_Pnt.hxx>
+#include <gp_Pnt2d.hxx>
+#include <gp_Dir2d.hxx>
+#include <Bnd_Box.hxx>
+
+#include <Geom2d_Curve.hxx>
+#include <Geom2d_TrimmedCurve.hxx>
+#include <Geom2d_Line.hxx>
+#include <Geom2d_TrimmedCurve.hxx>
+
+#include <Geom2dHatch_Intersector.hxx>
+#include <Geom2dHatch_Hatcher.hxx>
+
+#include <Geom2dAdaptor_Curve.hxx>
+#include <HatchGen_Domain.hxx>
+
+#include <Geom_Curve.hxx>
+#include <Geom_Surface.hxx>
+
+#include <GeomAdaptor_Surface.hxx>
+
+#include <GeomAPI_ProjectPointOnSurf.hxx>
+#include <GeomAPI_ProjectPointOnCurve.hxx>
+
+#include <Poly_Triangulation.hxx>
+
+#include <TopAbs_Orientation.hxx>
+
+#include <TopLoc_Location.hxx>
+
+#include <TopoDS.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Edge.hxx>
+
+#include <TopExp_Explorer.hxx>
+
+#include <BRep_Tool.hxx>
+#include <BRep_Builder.hxx>
+
+#include <BRepTools.hxx>
+#include <BRepBndLib.hxx>
+#include <BRepMesh_IncrementalMesh.hxx>
+
+#include <IntTools_Tools.hxx>
+
+#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopAbs_ShapeEnum.hxx>
+
+#include <IntTools_Tools.hxx>
+
+#include <BOPTools_AlgoTools3D.hxx>
+#include <BOPTools_AlgoTools2D.hxx>
+
+#include <GEOMAlgo_PassKeyShape.hxx>
+
+
+static
+ void GetCount(const TopoDS_Shape& aS,
+ Standard_Integer& iCnt);
+static
+ void CopySource(const TopoDS_Shape& aS,
+ TopTools_IndexedDataMapOfShapeShape& aMapSS,
+ TopoDS_Shape& aSC);
+
+//=======================================================================
+//function : CopyShape
+//purpose :
+//=======================================================================
+void GEOMAlgo_AlgoTools::CopyShape(const TopoDS_Shape& aS,
+ TopoDS_Shape& aSC)
+{
+ TopTools_IndexedDataMapOfShapeShape aMapSS;
+ //
+ CopySource(aS, aMapSS, aSC);
+}
+//=======================================================================
+//function : CopyShape
+//purpose :
+//=======================================================================
+void GEOMAlgo_AlgoTools::CopyShape(const TopoDS_Shape& aS,
+ TopoDS_Shape& aSC,
+ TopTools_IndexedDataMapOfShapeShape& aMapSS)
+{
+ CopySource(aS, aMapSS, aSC);
+}
+//=======================================================================
+//function : CopySource
+//purpose :
+//=======================================================================
+void CopySource(const TopoDS_Shape& aS,
+ TopTools_IndexedDataMapOfShapeShape& aMapSS,
+ TopoDS_Shape& aSC)
+{
+ Standard_Boolean bFree;
+ TopAbs_ShapeEnum aT;
+ TopoDS_Iterator aIt;
+ TopoDS_Shape aSF;
+ BRep_Builder BB;
+ //
+ aT=aS.ShapeType();
+ //
+ if (aMapSS.Contains(aS)) {
+ aSC=aMapSS.ChangeFromKey(aS);
+ aSC.Orientation(aS.Orientation());
+ return;
+ }
+ else {
+ aSC=aS.EmptyCopied();
+ aMapSS.Add(aS, aSC);
+ }
+ //
+ bFree=aSC.Free();
+ aSC.Free(Standard_True);
+ aSF=aS;
+ if (aT==TopAbs_EDGE){
+ TopAbs_Orientation aOr;
+ //
+ aOr=aS.Orientation();
+ if(aOr==TopAbs_INTERNAL) {
+ aSF.Orientation(TopAbs_FORWARD);
+ }
+ }
+ aIt.Initialize(aSF);
+ for (; aIt.More(); aIt.Next()) {
+ TopoDS_Shape aSCx;
+ //
+ const TopoDS_Shape& aSx=aIt.Value();
+ //
+ CopySource (aSx, aMapSS, aSCx);
+ //
+ aSCx.Orientation(aSx.Orientation());
+ BB.Add(aSC, aSCx);
+ }
+ aSC.Free(bFree);
+}
+//=======================================================================
+//function : FaceNormal
+//purpose :
+//=======================================================================
+void GEOMAlgo_AlgoTools::FaceNormal (const TopoDS_Face& aF,
+ const Standard_Real U,
+ const Standard_Real V,
+ gp_Vec& aN)
+{
+ gp_Pnt aPnt ;
+ gp_Vec aD1U, aD1V;
+ Handle(Geom_Surface) aSurface;
+
+ aSurface=BRep_Tool::Surface(aF);
+ aSurface->D1 (U, V, aPnt, aD1U, aD1V);
+ aN=aD1U.Crossed(aD1V);
+ aN.Normalize();
+ if (aF.Orientation() == TopAbs_REVERSED){
+ aN.Reverse();
+ }
+ return;
+}
+//=======================================================================
+//function : BuildPCurveForEdgeOnFace
+//purpose :
+//=======================================================================
+Standard_Integer GEOMAlgo_AlgoTools::BuildPCurveForEdgeOnFace
+ (const TopoDS_Edge& aEold,
+ const TopoDS_Edge& aEnew,
+ const TopoDS_Face& aF,
+ const Handle(IntTools_Context)& aCtx)
+{
+ Standard_Boolean bIsClosed, bUClosed, bHasOld;
+ Standard_Integer iRet, aNbPoints;
+ Standard_Real aTS, aTS1, aTS2, aT, aT1, aT2, aScPr, aTol;
+ Standard_Real aU, aV, aUS1, aVS1, aUS2, aVS2;
+ gp_Pnt aP;
+ gp_Pnt2d aP2DS1, aP2DS2, aP2D;
+ gp_Vec2d aV2DS1, aV2DS2;
+ Handle(Geom2d_Curve) aC2D, aC2DS1, aC2DS2;
+ Handle(Geom_Surface) aS;
+ TopoDS_Edge aES;
+ //
+ iRet=0;
+ //
+ bHasOld=BOPTools_AlgoTools2D::HasCurveOnSurface(aEnew, aF, aC2D, aT1, aT2, aTol);
+ if (bHasOld) {
+ return iRet;
+ }
+ //
+ // Try to copy PCurve from old edge to the new one.
+ iRet = BOPTools_AlgoTools2D::AttachExistingPCurve(aEold, aEnew, aF, aCtx);
+
+ if (iRet) {
+ // Do PCurve using projection algorithm.
+ iRet = 0;
+ } else {
+ // The PCurve is attached successfully.
+ return iRet;
+ }
+ //
+ BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aEnew, aF);
+ aC2D=BRep_Tool::CurveOnSurface(aEnew, aF, aT1, aT2);
+ if (aC2D.IsNull()){
+ iRet=1;
+ return iRet;
+ }
+ //
+ bIsClosed=BRep_Tool::IsClosed(aEold, aF);
+ if (!bIsClosed) {
+ return iRet;
+ }
+ //
+ aTol=1.e-7;
+ //
+ // 1. bUClosed - direction of closeness
+ //
+ aES=aEold;
+ aES.Orientation(TopAbs_FORWARD);
+ aC2DS1=BRep_Tool::CurveOnSurface(aES, aF, aTS1, aTS2);
+ //
+ aES.Orientation(TopAbs_REVERSED);
+ aC2DS2=BRep_Tool::CurveOnSurface(aES, aF, aTS1, aTS2);
+ //
+ aTS=IntTools_Tools::IntermediatePoint(aTS1, aTS2);
+ //
+ aC2DS1->D1(aTS, aP2DS1, aV2DS1);
+ aC2DS2->D1(aTS, aP2DS2, aV2DS2);
+ //
+ gp_Vec2d aV2DS12(aP2DS1, aP2DS2);
+ gp_Dir2d aD2DS12(aV2DS12);
+ const gp_Dir2d& aD2DX=gp::DX2d();
+ //
+ aScPr=aD2DS12*aD2DX;
+ bUClosed=Standard_True;
+ if (fabs(aScPr) < aTol) {
+ bUClosed=!bUClosed;
+ }
+ //
+ // 2. aP2D - point on curve aC2D, that corresponds to aP2DS1
+ aP2DS1.Coord(aUS1, aVS1);
+ aP2DS2.Coord(aUS2, aVS2);
+ //
+ aS=BRep_Tool::Surface(aF);
+ aS->D0(aUS1, aVS1, aP);
+ //
+ GeomAPI_ProjectPointOnCurve& aProjPC=aCtx->ProjPC(aEnew);
+ //
+ aProjPC.Perform(aP);
+ aNbPoints=aProjPC.NbPoints();
+ if (!aNbPoints) {
+ iRet=2;
+ return iRet;
+ }
+ //
+ aT=aProjPC.LowerDistanceParameter();
+
+ //
+ // 3. Build the second 2D curve
+ Standard_Boolean bRevOrder;
+ gp_Vec2d aV2DT, aV2D;
+ Handle(Geom2d_Curve) aC2Dnew;
+ Handle(Geom2d_TrimmedCurve) aC2DTnew;
+ BRep_Builder aBB;
+ //
+ aC2D->D1(aT, aP2D, aV2D);
+ aP2D.Coord(aU, aV);
+ //
+ aC2Dnew=Handle(Geom2d_Curve)::DownCast(aC2D->Copy());
+ aC2DTnew = new Geom2d_TrimmedCurve(aC2Dnew, aT1, aT2);
+ //
+ aV2DT=aV2DS12;
+ if (!bUClosed) { // V Closed
+ if (fabs(aV-aVS2)<aTol) {
+ aV2DT.Reverse();
+ }
+ }
+ else { // U Closed
+ if (fabs(aU-aUS2)<aTol) {
+ aV2DT.Reverse();
+ }
+ }
+ //
+ aC2DTnew->Translate(aV2DT);
+ //
+ // 4 Order the 2D curves
+ bRevOrder=Standard_False;
+ aScPr=aV2D*aV2DS1;
+ if(aScPr<0.) {
+ bRevOrder=!bRevOrder;
+ }
+ //
+ // 5. Update the edge
+ aTol=BRep_Tool::Tolerance(aEnew);
+ if (!bRevOrder) {
+ aBB.UpdateEdge(aEnew, aC2D, aC2DTnew, aF, aTol);
+ }
+ else {
+ aBB.UpdateEdge(aEnew, aC2DTnew, aC2D , aF, aTol);
+ }
+ //
+ return iRet;
+}
+//////////////////////////////////////////////////////////////////////////
+//=======================================================================
+// function: MakeContainer
+// purpose:
+//=======================================================================
+void GEOMAlgo_AlgoTools::MakeContainer(const TopAbs_ShapeEnum theType,
+ TopoDS_Shape& theC)
+{
+ BRep_Builder aBB;
+ //
+ switch(theType) {
+ case TopAbs_COMPOUND:{
+ TopoDS_Compound aC;
+ aBB.MakeCompound(aC);
+ theC=aC;
+ }
+ break;
+ //
+ case TopAbs_COMPSOLID:{
+ TopoDS_CompSolid aCS;
+ aBB.MakeCompSolid(aCS);
+ theC=aCS;
+ }
+ break;
+ //
+ case TopAbs_SOLID:{
+ TopoDS_Solid aSolid;
+ aBB.MakeSolid(aSolid);
+ theC=aSolid;
+ }
+ break;
+ //
+ //
+ case TopAbs_SHELL:{
+ TopoDS_Shell aShell;
+ aBB.MakeShell(aShell);
+ theC=aShell;
+ }
+ break;
+ //
+ case TopAbs_WIRE: {
+ TopoDS_Wire aWire;
+ aBB.MakeWire(aWire);
+ theC=aWire;
+ }
+ break;
+ //
+ default:
+ break;
+ }
+}
+//=======================================================================
+//function : IsUPeriodic
+//purpose :
+//=======================================================================
+Standard_Boolean GEOMAlgo_AlgoTools::IsUPeriodic(const Handle(Geom_Surface) &aS)
+{
+ Standard_Boolean bRet;
+ GeomAbs_SurfaceType aType;
+ GeomAdaptor_Surface aGAS;
+ //
+ aGAS.Load(aS);
+ aType=aGAS.GetType();
+ bRet=(aType==GeomAbs_Cylinder||
+ aType==GeomAbs_Cone ||
+ aType==GeomAbs_Sphere);
+ //
+ return bRet;
+}
+
+//=======================================================================
+//function : RefinePCurveForEdgeOnFace
+//purpose :
+//=======================================================================
+void GEOMAlgo_AlgoTools::RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE,
+ const TopoDS_Face& aF,
+ const Standard_Real aUMin,
+ const Standard_Real aUMax)
+{
+ Standard_Real aT1, aT2, aTx, aUx, aTol;
+ gp_Pnt2d aP2D;
+ Handle(Geom_Surface) aS;
+ Handle(Geom2d_Curve) aC2D;
+ BRep_Builder aBB;
+ //
+ aC2D=BRep_Tool::CurveOnSurface(aE, aF, aT1, aT2);
+ if (!aC2D.IsNull()) {
+ if (BRep_Tool::IsClosed(aE, aF)) {
+ return;
+ }
+ aTx=IntTools_Tools::IntermediatePoint(aT1, aT2);
+ aC2D->D0(aTx, aP2D);
+ aUx=aP2D.X();
+ if (aUx < aUMin || aUx > aUMax) {
+ // need to rebuild
+ Handle(Geom2d_Curve) aC2Dx;
+ //
+ aTol=BRep_Tool::Tolerance(aE);
+ aBB.UpdateEdge(aE, aC2Dx, aF, aTol);
+ }
+ }
+}
+//=======================================================================
+//function :IsSplitToReverse
+//purpose :
+//=======================================================================
+Standard_Boolean GEOMAlgo_AlgoTools::IsSplitToReverse
+ (const TopoDS_Edge& aEF1,
+ const TopoDS_Edge& aEF2,
+ const Handle(IntTools_Context)& aContext)
+{
+ Standard_Boolean aFlag;
+ Standard_Real aT1, aT2, aScPr, a, b;
+ gp_Vec aV1, aV2;
+ gp_Pnt aP;
+
+
+ Handle(Geom_Curve)aC1=BRep_Tool::Curve(aEF1, a, b);
+ aT1=IntTools_Tools::IntermediatePoint(a, b);
+ aC1->D0(aT1, aP);
+ aFlag=BOPTools_AlgoTools2D::EdgeTangent(aEF1, aT1, aV1);
+
+ if(!aFlag) {
+ return Standard_False;
+ }
+
+ gp_Dir aDT1(aV1);
+ //
+ aFlag=aContext->ProjectPointOnEdge(aP, aEF2, aT2);
+ if(!aFlag) {
+ return Standard_False;
+ }
+ //
+ aFlag=BOPTools_AlgoTools2D::EdgeTangent(aEF2, aT2, aV2);
+ if(!aFlag) {
+ return Standard_False;
+ }
+
+ gp_Dir aDT2(aV2);
+
+ aScPr=aDT1*aDT2;
+
+ return (aScPr<0.);
+}
+
+
+//=======================================================================
+//function : ProjectPointOnShape
+//purpose :
+//=======================================================================
+Standard_Boolean GEOMAlgo_AlgoTools::ProjectPointOnShape
+ (const gp_Pnt& aP1,
+ const TopoDS_Shape& aS,
+ gp_Pnt& aP2,
+ const Handle(IntTools_Context)& aCtx)
+{
+ Standard_Boolean bIsDone = Standard_False;
+ Standard_Real aT2;
+ TopAbs_ShapeEnum aType;
+ //
+ aType = aS.ShapeType();
+ switch (aType)
+ {
+ case TopAbs_EDGE:
+ {
+ const TopoDS_Edge& aE2 = TopoDS::Edge(aS);
+ //
+ if (BRep_Tool::Degenerated(aE2)) { // jfa
+ return Standard_True;
+ }
+ else {
+ Standard_Real f, l;
+ Handle(Geom_Curve) aC3D = BRep_Tool::Curve (aE2, f, l);
+ if (aC3D.IsNull()) {
+ return Standard_True;
+ }
+ bIsDone = aCtx->ProjectPointOnEdge(aP1, aE2, aT2);
+ }
+ if (!bIsDone) {
+ return bIsDone;
+ }
+ //
+ GEOMAlgo_AlgoTools::PointOnEdge(aE2, aT2, aP2);
+ }
+ break;
+ //
+ case TopAbs_FACE:
+ {
+ const TopoDS_Face& aF2 = TopoDS::Face(aS);
+ GeomAPI_ProjectPointOnSurf& aProj = aCtx->ProjPS(aF2);
+ //
+ aProj.Perform(aP1);
+ bIsDone = aProj.IsDone();
+ if (!bIsDone) {
+ return bIsDone;
+ }
+ //
+ aP2 = aProj.NearestPoint();
+ }
+ break;
+ //
+ default:
+ break; // Err
+ }
+ return bIsDone;
+}
+
+//=======================================================================
+//function : PointOnEdge
+//purpose :
+//=======================================================================
+void GEOMAlgo_AlgoTools::PointOnEdge(const TopoDS_Edge& aE,
+ gp_Pnt& aP3D)
+{
+ Standard_Real aTx, aT1, aT2;
+ //
+ BRep_Tool::Curve(aE, aT1, aT2);
+ aTx=IntTools_Tools::IntermediatePoint(aT1, aT2);
+ GEOMAlgo_AlgoTools::PointOnEdge(aE, aTx, aP3D);
+}
+//=======================================================================
+//function : PointOnEdge
+//purpose :
+//=======================================================================
+void GEOMAlgo_AlgoTools::PointOnEdge(const TopoDS_Edge& aE,
+ const Standard_Real aT,
+ gp_Pnt& aP3D)
+{
+ Standard_Real aT1, aT2;
+ Handle(Geom_Curve) aC3D;
+ //
+ aC3D=BRep_Tool::Curve(aE, aT1, aT2);
+ aC3D->D0(aT, aP3D);
+}
+//=======================================================================
+//function : PointOnFace
+//purpose :
+//=======================================================================
+void GEOMAlgo_AlgoTools::PointOnFace(const TopoDS_Face& aF,
+ const Standard_Real aU,
+ const Standard_Real aV,
+ gp_Pnt& aP3D)
+{
+ Handle(Geom_Surface) aS;
+ //
+ aS=BRep_Tool::Surface(aF);
+ aS->D0(aU, aV, aP3D);
+}
+//=======================================================================
+//function : PointOnFace
+//purpose :
+//=======================================================================
+void GEOMAlgo_AlgoTools::PointOnFace(const TopoDS_Face& aF,
+ gp_Pnt& aP3D)
+{
+ Standard_Real aU, aV, aUMin, aUMax, aVMin, aVMax;
+ //
+ BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
+ //
+ aU=IntTools_Tools::IntermediatePoint(aUMin, aUMax);
+ aV=IntTools_Tools::IntermediatePoint(aVMin, aVMax);
+ //
+ GEOMAlgo_AlgoTools::PointOnFace(aF, aU, aV, aP3D);
+}
+//=======================================================================
+//function : PointOnShape
+//purpose :
+//=======================================================================
+void GEOMAlgo_AlgoTools::PointOnShape(const TopoDS_Shape& aS,
+ gp_Pnt& aP3D)
+{
+ TopAbs_ShapeEnum aType;
+ //
+ aP3D.SetCoord(99.,99.,99.);
+ aType=aS.ShapeType();
+ switch(aType) {
+ case TopAbs_EDGE: {
+ const TopoDS_Edge& aE=TopoDS::Edge(aS);
+ GEOMAlgo_AlgoTools::PointOnEdge(aE, aP3D);
+ }
+ break;
+ //
+ case TopAbs_FACE: {
+ const TopoDS_Face& aF=TopoDS::Face(aS);
+ GEOMAlgo_AlgoTools::PointOnFace(aF, aP3D);
+ }
+ break;
+ //
+ default:
+ break; // Err
+ }
+}
+//=======================================================================
+//function : FindSDShapes
+//purpose :
+//=======================================================================
+Standard_Integer GEOMAlgo_AlgoTools::FindSDShapes
+ (const TopoDS_Shape& aE1,
+ const TopTools_ListOfShape& aLE,
+ const Standard_Real aTol,
+ TopTools_ListOfShape& aLESD,
+ const Handle(IntTools_Context)& aCtx)
+{
+ Standard_Boolean bIsDone;
+ Standard_Real aTol2, aD2;
+ gp_Pnt aP1, aP2;
+ TopTools_ListIteratorOfListOfShape aIt;
+ //
+ aTol2=aTol*aTol;
+ GEOMAlgo_AlgoTools::PointOnShape(aE1, aP1);
+ //
+ aIt.Initialize(aLE);
+ for (; aIt.More(); aIt.Next()) {
+ const TopoDS_Shape& aE2=aIt.Value();
+ if (aE2.IsSame(aE1)) {
+ aLESD.Append(aE2);
+ }
+ else {
+ bIsDone=GEOMAlgo_AlgoTools::ProjectPointOnShape(aP1, aE2, aP2, aCtx);
+ if (!bIsDone) {
+ //return 1;
+ continue; // jfa BUG 20361
+ }
+ aD2=aP1.SquareDistance(aP2);
+ if(aD2<aTol2) {
+ aLESD.Append(aE2);
+ }
+ }
+ }
+ return 0;
+}
+
+//=======================================================================
+//function : FindSDShapes
+//purpose :
+//=======================================================================
+Standard_Integer GEOMAlgo_AlgoTools::FindSDShapes
+ (const TopTools_ListOfShape& aLE,
+ const Standard_Real aTol,
+ TopTools_IndexedDataMapOfShapeListOfShape& aMEE,
+ const Handle(IntTools_Context)& aCtx)
+{
+ Standard_Integer aNbE, aNbEProcessed, aNbESD, iErr;
+ TopTools_ListOfShape aLESD;
+ TopTools_ListIteratorOfListOfShape aIt, aIt1;
+ TopTools_IndexedMapOfShape aMProcessed;
+ TopAbs_ShapeEnum aType;
+ //
+ aNbE=aLE.Extent();
+ if (!aNbE) {
+ return 3; // Err
+ }
+ if (aNbE==1) {
+ return 0; // Nothing to do
+ }
+ //
+ for(;;) {
+ aNbEProcessed=aMProcessed.Extent();
+ if (aNbEProcessed==aNbE) {
+ break;
+ }
+ //
+ aIt.Initialize(aLE);
+ for (; aIt.More(); aIt.Next()) {
+ const TopoDS_Shape& aS=aIt.Value();
+ //
+ if (aMProcessed.Contains(aS)) {
+ continue;
+ }
+ //
+ aType=aS.ShapeType();
+ if (aType==TopAbs_EDGE) {
+ const TopoDS_Edge& aE=TopoDS::Edge(aS);
+ if (BRep_Tool::Degenerated(aE)) {
+ aMProcessed.Add(aE);
+ continue;
+ }
+ }
+ //
+ aLESD.Clear();
+ iErr=GEOMAlgo_AlgoTools::FindSDShapes(aS, aLE, aTol, aLESD, aCtx);
+ if (iErr) {
+ return 2; // Err
+ }
+ //
+ aNbESD=aLESD.Extent();
+ if (!aNbESD) {
+ return 1; // Err
+ }
+ //
+ aMEE.Add(aS, aLESD);
+ //
+ aIt1.Initialize(aLESD);
+ for (; aIt1.More(); aIt1.Next()) {
+ const TopoDS_Shape& aE1=aIt1.Value();
+ aMProcessed.Add(aE1);
+ }
+ }
+ }
+ return 0;
+}
+//=======================================================================
+//function : RefineSDShapes
+//purpose :
+//=======================================================================
+Standard_Integer GEOMAlgo_AlgoTools::RefineSDShapes
+ (GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMPKLE,
+ const Standard_Real aTol,
+ const Handle(IntTools_Context)& aCtx)
+{
+ Standard_Integer i, aNbE, iErr, j, aNbEE, aNbToAdd;
+ TopTools_IndexedDataMapOfShapeListOfShape aMEE, aMSDE, aMEToAdd;
+ //
+ iErr=1;
+ //
+ aNbE=aMPKLE.Extent();
+ for (i=1; i<=aNbE; ++i) {
+ TopTools_ListOfShape& aLSDE=aMPKLE.ChangeFromIndex(i);
+ //
+ aMEE.Clear();
+ iErr=GEOMAlgo_AlgoTools::FindSDShapes(aLSDE, aTol, aMEE, aCtx);
+ if (iErr) {
+ return iErr;
+ }
+ //
+ aNbEE=aMEE.Extent();
+ if (aNbEE==1) {
+ continue; // nothing to do
+ }
+ //
+ for (j=1; j<=aNbEE; ++j) {
+ TopTools_ListOfShape& aLEE=aMEE.ChangeFromIndex(j);
+ //
+ if (j==1) {
+ aLSDE.Clear();
+ aLSDE.Append(aLEE);
+ }
+ else {
+ const TopoDS_Shape& aE1=aLEE.First();
+ aMEToAdd.Add(aE1, aLEE);
+ }
+ }
+ }
+ //
+ aNbToAdd=aMEToAdd.Extent();
+ if (!aNbToAdd) {
+ return aNbToAdd;
+ }
+ //
+ for (i=1; i<=aNbToAdd; ++i) {
+ GEOMAlgo_PassKeyShape aPKE1;
+ //
+ const TopoDS_Shape& aE1=aMEToAdd.FindKey(i);
+ const TopTools_ListOfShape& aLE=aMEToAdd(i);
+ //
+ aPKE1.SetShapes(aE1);
+ aMPKLE.Add(aPKE1, aLE);
+ }
+ //
+ return 0;
+}
+//=======================================================================
+//function : BuildTriangulation
+//purpose :
+//=======================================================================
+Standard_Boolean
+ GEOMAlgo_AlgoTools::BuildTriangulation (const TopoDS_Shape& theShape)
+{
+ // calculate deflection
+ Standard_Real aDeviationCoefficient = 0.001;
+
+ Bnd_Box B;
+ BRepBndLib::Add(theShape, B);
+ Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
+ B.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
+
+ Standard_Real dx = aXmax - aXmin, dy = aYmax - aYmin, dz = aZmax - aZmin;
+ Standard_Real aDeflection = Max(Max(dx, dy), dz) * aDeviationCoefficient * 4;
+ Standard_Real aHLRAngle = 0.349066;
+
+ // build triangulation
+ BRepMesh_IncrementalMesh Inc (theShape, aDeflection, Standard_False, aHLRAngle);
+
+ // check triangulation
+ bool isTriangulation = true;
+
+ TopExp_Explorer exp (theShape, TopAbs_FACE);
+ if (exp.More())
+ {
+ TopLoc_Location aTopLoc;
+ Handle(Poly_Triangulation) aTRF;
+ aTRF = BRep_Tool::Triangulation(TopoDS::Face(exp.Current()), aTopLoc);
+ if (aTRF.IsNull()) {
+ isTriangulation = false;
+ }
+ }
+ else // no faces, try edges
+ {
+ TopExp_Explorer expe (theShape, TopAbs_EDGE);
+ if (!expe.More()) {
+ isTriangulation = false;
+ }
+ else {
+ TopLoc_Location aLoc;
+ Handle(Poly_Polygon3D) aPE = BRep_Tool::Polygon3D(TopoDS::Edge(expe.Current()), aLoc);
+ if (aPE.IsNull()) {
+ isTriangulation = false;
+ }
+ }
+ }
+ return isTriangulation;
+}
+
+//=======================================================================
+//function : IsCompositeShape
+//purpose :
+//=======================================================================
+Standard_Boolean GEOMAlgo_AlgoTools::IsCompositeShape(const TopoDS_Shape& aS)
+{
+ Standard_Boolean bRet;
+ Standard_Integer iCnt;
+ TopoDS_Iterator aIt;
+ //
+ iCnt=0;
+ GetCount(aS, iCnt);
+ bRet=(iCnt>1);
+ //
+ return bRet;
+}
+//=======================================================================
+//function : GetCount
+//purpose :
+//=======================================================================
+void GetCount(const TopoDS_Shape& aS,
+ Standard_Integer& iCnt)
+{
+ TopoDS_Iterator aIt;
+ TopAbs_ShapeEnum aTS;
+ //
+ aTS=aS.ShapeType();
+ //
+ if (aTS==TopAbs_SHAPE) {
+ return;
+ }
+ if (aTS!=TopAbs_COMPOUND) {
+ ++iCnt;
+ return;
+ }
+ //
+ aIt.Initialize(aS);
+ for (; aIt.More(); aIt.Next()) {
+ const TopoDS_Shape& aSx=aIt.Value();
+ GetCount(aSx, iCnt);
+ }
+}
+//=======================================================================
+//function : PntInFace
+//purpose :
+//=======================================================================
+Standard_Integer GEOMAlgo_AlgoTools::PntInFace(const TopoDS_Face& aF,
+ gp_Pnt& theP,
+ gp_Pnt2d& theP2D)
+{
+ Standard_Boolean bIsDone, bHasFirstPoint, bHasSecondPoint;
+ Standard_Integer iErr, aIx, aNbDomains, i;
+ Standard_Real aUMin, aUMax, aVMin, aVMax;
+ Standard_Real aVx, aUx, aV1, aV2, aU1, aU2, aEpsT;
+ Standard_Real aTotArcIntr, aTolTangfIntr, aTolHatch2D, aTolHatch3D;
+ gp_Dir2d aD2D (0., 1.);
+ gp_Pnt2d aP2D;
+ gp_Pnt aPx;
+ Handle(Geom2d_Curve) aC2D;
+ Handle(Geom2d_TrimmedCurve) aCT2D;
+ Handle(Geom2d_Line) aL2D;
+ Handle(Geom_Surface) aS;
+ TopAbs_Orientation aOrE;
+ TopoDS_Face aFF;
+ TopExp_Explorer aExp;
+ //
+ aTolHatch2D=1.e-8;
+ aTolHatch3D=1.e-8;
+ aTotArcIntr=1.e-10;
+ aTolTangfIntr=1.e-10;
+ //
+ Geom2dHatch_Intersector aIntr(aTotArcIntr, aTolTangfIntr);
+ Geom2dHatch_Hatcher aHatcher(aIntr,
+ aTolHatch2D, aTolHatch3D,
+ Standard_True, Standard_False);
+ //
+ iErr=0;
+ aEpsT=1.e-12;
+ //
+ aFF=aF;
+ aFF.Orientation (TopAbs_FORWARD);
+ //
+ aS=BRep_Tool::Surface(aFF);
+ BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax);
+ //
+ // 1
+ aExp.Init (aFF, TopAbs_EDGE);
+ for (; aExp.More() ; aExp.Next()) {
+ const TopoDS_Edge& aE=*((TopoDS_Edge*)&aExp.Current());
+ aOrE=aE.Orientation();
+ //
+ aC2D=BRep_Tool::CurveOnSurface (aE, aFF, aU1, aU2);
+ if (aC2D.IsNull() ) {
+ iErr=1;
+ return iErr;
+ }
+ if (fabs(aU1-aU2) < aEpsT) {
+ iErr=2;
+ return iErr;
+ }
+ //
+ aCT2D=new Geom2d_TrimmedCurve(aC2D, aU1, aU2);
+ aHatcher.AddElement(aCT2D, aOrE);
+ }// for (; aExp.More() ; aExp.Next()) {
+ //
+ // 2
+ aUx=IntTools_Tools::IntermediatePoint(aUMin, aUMax);
+ aP2D.SetCoord(aUx, 0.);
+ aL2D=new Geom2d_Line (aP2D, aD2D);
+ Geom2dAdaptor_Curve aHCur(aL2D);
+ //
+ aIx=aHatcher.AddHatching(aHCur) ;
+ //
+ // 3.
+ aHatcher.Trim();
+ bIsDone=aHatcher.TrimDone(aIx);
+ if (!bIsDone) {
+ iErr=3;
+ return iErr;
+ }
+ //
+ aHatcher.ComputeDomains(aIx);
+ bIsDone=aHatcher.IsDone(aIx);
+ if (!bIsDone) {
+ iErr=4;
+ return iErr;
+ }
+ //
+ // 4.
+ aVx=aVMin;
+ aNbDomains=aHatcher.NbDomains(aIx);
+ if (!aNbDomains) {
+ iErr=5;
+ return iErr;
+ }
+ //
+ i=1;
+ const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ;
+ bHasFirstPoint=aDomain.HasFirstPoint();
+ if (!bHasFirstPoint) {
+ iErr=5;
+ return iErr;
+ }
+ //
+ aV1=aDomain.FirstPoint().Parameter();
+ //
+ bHasSecondPoint=aDomain.HasSecondPoint();
+ if (!bHasSecondPoint) {
+ iErr=6;
+ return iErr;
+ }
+ //
+ aV2=aDomain.SecondPoint().Parameter();
+ //
+ aVx=IntTools_Tools::IntermediatePoint(aV1, aV2);
+ //
+ aS->D0(aUx, aVx, aPx);
+ //
+ theP2D.SetCoord(aUx, aVx);
+ theP=aPx;
+ //
+ return iErr;
+}
--- /dev/null
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : GEOMAlgo_AlgoTools.hxx
+// Created :
+// Author : Peter KURNEV
+
+#ifndef _GEOMAlgo_AlgoTools_HeaderFile
+#define _GEOMAlgo_AlgoTools_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Macro.hxx>
+#include <Standard_Boolean.hxx>
+#include <IntTools_Context.hxx>
+#include <Standard_Integer.hxx>
+
+#include <gp_Pnt.hxx>
+#include <gp_Pnt2d.hxx>
+
+#include <Geom_Surface.hxx>
+
+#include <TopAbs_ShapeEnum.hxx>
+
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_IndexedDataMapOfShapeShape.hxx>
+
+#include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>
+#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
+#include <GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx>
+
+//! Auxiliary tools for Algorithms <br>
+//=======================================================================
+//class : GEOMAlgo_AlgoTools
+//purpose :
+//=======================================================================
+class GEOMAlgo_AlgoTools {
+ public:
+
+ Standard_EXPORT
+ static void FaceNormal (const TopoDS_Face& aF,
+ const Standard_Real U,
+ const Standard_Real V,
+ gp_Vec& aN);
+
+ //! Computes a point <theP> inside the face <theF>. <br>
+ //! <theP2D> - 2D representation of <theP> <br>
+ //! on the surface of <theF> <br>
+ //! Returns 0 in case of success. <br>
+ Standard_EXPORT
+ static Standard_Integer PntInFace(const TopoDS_Face& theF,
+ gp_Pnt& theP,
+ gp_Pnt2d& theP2D) ;
+
+ Standard_EXPORT
+ static Standard_Boolean IsCompositeShape(const TopoDS_Shape& aS) ;
+
+
+ Standard_EXPORT
+ static Standard_Boolean BuildTriangulation(const TopoDS_Shape& aS) ;
+
+ Standard_EXPORT
+ static Standard_Integer RefineSDShapes
+ (GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMSD,
+ const Standard_Real aTol,
+ const Handle(IntTools_Context)& aCtx) ;
+
+ Standard_EXPORT
+ static Standard_Integer FindSDShapes(const TopTools_ListOfShape& aLE,
+ const Standard_Real aTol,
+ TopTools_IndexedDataMapOfShapeListOfShape& aMEE,
+ const Handle(IntTools_Context)& aCtx) ;
+ Standard_EXPORT
+ static Standard_Integer FindSDShapes(const TopoDS_Shape& aE1,
+ const TopTools_ListOfShape& aLE,
+ const Standard_Real aTol,
+ TopTools_ListOfShape& aLESD,
+ const Handle(IntTools_Context)& aCtx) ;
+
+ Standard_EXPORT
+ static void PointOnShape(const TopoDS_Shape& aS,
+ gp_Pnt& aP3D) ;
+
+ Standard_EXPORT
+ static void PointOnEdge(const TopoDS_Edge& aE,
+ gp_Pnt& aP3D) ;
+
+ Standard_EXPORT
+ static void PointOnEdge(const TopoDS_Edge& aE,
+ const Standard_Real aT,gp_Pnt& aP3D) ;
+
+ Standard_EXPORT
+ static void PointOnFace(const TopoDS_Face& aF,
+ gp_Pnt& aP3D) ;
+
+ Standard_EXPORT
+ static void PointOnFace(const TopoDS_Face& aF,
+ const Standard_Real aU,
+ const Standard_Real aV,
+ gp_Pnt& aP3D) ;
+ Standard_EXPORT
+ static Standard_Boolean ProjectPointOnShape(const gp_Pnt& aP1,
+ const TopoDS_Shape& aS,
+ gp_Pnt& aP2,
+ const Handle(IntTools_Context)& aCtx) ;
+
+ Standard_EXPORT
+ static void CorrectTolerances(const TopoDS_Shape& aShape,
+ const Standard_Real aMaxTol=0.0001);
+
+ Standard_EXPORT
+ static void CorrectPointOnCurve(const TopoDS_Shape& S,
+ const Standard_Real aMaxTol=0.0001);
+
+ Standard_EXPORT
+ static void CorrectCurveOnSurface(const TopoDS_Shape& S,
+ const Standard_Real aMaxTol=0.0001);
+
+
+ Standard_EXPORT
+ static Standard_Boolean IsSplitToReverse1 (const TopoDS_Edge& aEF1,
+ const TopoDS_Edge& aEF2,
+ const Handle(IntTools_Context)& aCtx) ;
+ Standard_EXPORT
+ static void RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE,
+ const TopoDS_Face& aF,
+ const Standard_Real aUMin,
+ const Standard_Real aUMax);
+
+ Standard_EXPORT
+ static Standard_Boolean IsUPeriodic(const Handle(Geom_Surface) &aS);
+
+ Standard_EXPORT
+ static void MakeContainer(const TopAbs_ShapeEnum theType,
+ TopoDS_Shape& theC);
+
+ Standard_EXPORT
+ static Standard_Boolean IsSplitToReverse(const TopoDS_Edge& theSplit,
+ const TopoDS_Edge& theEdge,
+ const Handle(IntTools_Context)& theCtx) ;
+
+ Standard_EXPORT
+ static Standard_Boolean IsSplitToReverse (const TopoDS_Face& theFSp,
+ const TopoDS_Face& theFSr,
+ const Handle(IntTools_Context)& theCtx) ;
+
+ Standard_EXPORT
+ static Standard_Boolean IsSplitToReverse (const TopoDS_Shape& theSp,
+ const TopoDS_Shape& theSr,
+ const Handle(IntTools_Context)& theCtx) ;
+ Standard_EXPORT
+ static Standard_Integer BuildPCurveForEdgeOnFace (const TopoDS_Edge& aEold,
+ const TopoDS_Edge& aEnew,
+ const TopoDS_Face& aF,
+ const Handle(IntTools_Context)& aCtx) ;
+
+//
+ Standard_EXPORT
+ static void FindChains(const GEOMAlgo_ListOfCoupleOfShapes& aLCS,
+ GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains);
+
+ Standard_EXPORT
+ static void FindChains(const GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMCV,
+ GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape& aMapChains);
+
+ Standard_EXPORT
+ static void CopyShape(const TopoDS_Shape& aS,
+ TopoDS_Shape& aSC) ;
+
+ Standard_EXPORT
+ static void CopyShape(const TopoDS_Shape& aS,
+ TopoDS_Shape& aSC,
+ TopTools_IndexedDataMapOfShapeShape& aMSS) ;
+};
+#endif
--- /dev/null
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: GEOMAlgo_BndSphere.cxx
+// Created:
+// Author: Peter KURNEV
+// <pkv@irinox>
+//
+#include <GEOMAlgo_BndSphere.hxx>
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+ GEOMAlgo_BndSphere::GEOMAlgo_BndSphere()
+{
+ myCenter.SetCoord(0., 0., 0.);
+ myRadius=0.;
+ myGap=0.;
+}
+//=======================================================================
+//function : ~
+//purpose :
+//=======================================================================
+ GEOMAlgo_BndSphere::~GEOMAlgo_BndSphere()
+{
+}
+//=======================================================================
+//function : IsOut
+//purpose :
+//=======================================================================
+ Standard_Boolean GEOMAlgo_BndSphere::IsOut(const GEOMAlgo_BndSphere& theOther)const
+{
+ Standard_Real aD2, aT2;
+ //
+ aD2=myCenter.SquareDistance(theOther.myCenter);
+ aT2=myRadius+myGap+theOther.myRadius+theOther.myGap;
+ aT2=aT2*aT2;
+ //
+ return aD2>aT2;
+}
--- /dev/null
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: GEOMAlgo_BndSphere.hxx
+// Created:
+// Author: Peter KURNEV
+// <pkv@irinox>
+
+#ifndef _GEOMAlgo_BndSphere_HeaderFile
+#define _GEOMAlgo_BndSphere_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Macro.hxx>
+#include <gp_Pnt.hxx>
+#include <Standard_Real.hxx>
+#include <Standard_Boolean.hxx>
+
+//=======================================================================
+//class : GEOMAlgo_BndSphere
+//purpose :
+//=======================================================================
+class GEOMAlgo_BndSphere {
+ public:
+ Standard_EXPORT
+ GEOMAlgo_BndSphere();
+
+ Standard_EXPORT
+ virtual ~GEOMAlgo_BndSphere();
+
+ void SetCenter(const gp_Pnt& theP) ;
+
+ const gp_Pnt& Center() const;
+
+ void SetRadius(const Standard_Real theR) ;
+
+ Standard_Real Radius() const;
+
+ void SetGap(const Standard_Real theGap) ;
+
+ Standard_Real Gap() const;
+
+ void Add(const GEOMAlgo_BndSphere& theOther) ;
+
+ Standard_EXPORT
+ Standard_Boolean IsOut(const GEOMAlgo_BndSphere& theOther) const;
+
+ Standard_Real SquareExtent() const;
+
+ protected:
+ gp_Pnt myCenter;
+ Standard_Real myRadius;
+ Standard_Real myGap;
+};
+
+#include <GEOMAlgo_BndSphere.lxx>
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: GEOMAlgo_BndSphere.lxx
+// Created:
+// Author: Peter KURNEV
+// <pkv@irinox>
+//=======================================================================
+//function : SetCenter
+//purpose :
+//=======================================================================
+ inline void GEOMAlgo_BndSphere::SetCenter(const gp_Pnt& theP)
+//
+{
+ myCenter=theP;
+}
+//=======================================================================
+//function : Center
+//purpose :
+//=======================================================================
+ inline const gp_Pnt& GEOMAlgo_BndSphere::Center()const
+{
+ return myCenter;
+}
+//=======================================================================
+//function : SetRadius
+//purpose :
+//=======================================================================
+ inline void GEOMAlgo_BndSphere::SetRadius(const Standard_Real theR)
+{
+ myRadius=theR;
+}
+//=======================================================================
+//function : Radius
+//purpose :
+//=======================================================================
+ inline Standard_Real GEOMAlgo_BndSphere::Radius()const
+{
+ return myRadius;
+}
+//=======================================================================
+//function : SetGap
+//purpose :
+//=======================================================================
+ inline void GEOMAlgo_BndSphere::SetGap(const Standard_Real theGap)
+{
+ myGap=theGap;
+}
+//=======================================================================
+//function : Gap
+//purpose :
+//=======================================================================
+ inline Standard_Real GEOMAlgo_BndSphere::Gap()const
+{
+ return myGap;
+}
+//=======================================================================
+//function : Add
+//purpose :
+//=======================================================================
+ inline void GEOMAlgo_BndSphere::Add(const GEOMAlgo_BndSphere& theOther)
+{
+ Standard_Real aTmax, aR, aT, aTOther;
+ gp_Pnt aPc;
+ //
+ aPc.SetXYZ(0.5*(myCenter.XYZ()+theOther.myCenter.XYZ()));
+ //
+ aR=aPc.Distance(myCenter);
+ //
+ aT=myRadius+myGap;
+ aTOther=theOther.myRadius+theOther.myGap;
+ aTmax=(aT>aTOther) ? aT: aTOther;
+ //
+ aR=aR+aTmax;
+ //
+ myCenter=aPc;
+ myRadius=aR;
+}
+//=======================================================================
+//function : SquareExtent
+//purpose :
+//=======================================================================
+ inline Standard_Real GEOMAlgo_BndSphere::SquareExtent()const
+{
+ Standard_Real aD;
+ //
+ aD=myRadius+myGap;
+ aD=aD+aD;
+ aD=aD*aD;
+ //
+ return aD;
+}
--- /dev/null
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: GEOMAlgo_BndSphereTree.cxx
+// Created:
+// Author: Peter KURNEV
+// <pkv@irinox>
+//
+#include <GEOMAlgo_BndSphereTree.hxx>
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+ GEOMAlgo_BndSphereTreeSelector::GEOMAlgo_BndSphereTreeSelector()
+{
+}
+//=======================================================================
+//function : ~
+//purpose :
+//=======================================================================
+ GEOMAlgo_BndSphereTreeSelector::~GEOMAlgo_BndSphereTreeSelector()
+{
+}
+//=======================================================================
+//function : Reject
+//purpose :
+//=======================================================================
+ Standard_Boolean GEOMAlgo_BndSphereTreeSelector::Reject (const GEOMAlgo_BndSphere& aBox) const
+{
+ Standard_Boolean bRet;
+ //
+ bRet=myBox.IsOut(aBox);
+ return bRet;
+}
+//=======================================================================
+//function : Accept
+//purpose :
+//=======================================================================
+ Standard_Boolean GEOMAlgo_BndSphereTreeSelector::Accept (const Standard_Integer& aIndex)
+{
+ Standard_Boolean bRet=Standard_False;
+ //
+ if (myFence.Add(aIndex)) {
+ myIndices.Append(aIndex);
+ bRet=!bRet;
+ }
+ return bRet;
+}
+//=======================================================================
+//function : SetBox
+//purpose :
+//=======================================================================
+ void GEOMAlgo_BndSphereTreeSelector::SetBox(const GEOMAlgo_BndSphere& aBox)
+{
+ myBox=aBox;
+}
+//=======================================================================
+//function : Clear
+//purpose :
+//=======================================================================
+ void GEOMAlgo_BndSphereTreeSelector::Clear()
+{
+ myFence.Clear();
+ myIndices.Clear();
+}
+//=======================================================================
+//function : Indices
+//purpose :
+//=======================================================================
+ const TColStd_ListOfInteger& GEOMAlgo_BndSphereTreeSelector::Indices() const
+{
+ return myIndices;
+}
--- /dev/null
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: GEOMAlgo_BndSphereTree.hxx
+// Created:
+// Author: Peter KURNEV
+// <pkv@irinox>
+//
+#ifndef GEOMAlgo_BndSphereTree_HeaderFile
+#define GEOMAlgo_BndSphereTree_HeaderFile
+
+#include <NCollection_UBTree.hxx>
+#include <GEOMAlgo_BndSphere.hxx>
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_ListOfInteger.hxx>
+
+typedef NCollection_UBTree <Standard_Integer , GEOMAlgo_BndSphere> GEOMAlgo_BndSphereTree;
+
+ class GEOMAlgo_BndSphereTreeSelector : public GEOMAlgo_BndSphereTree::Selector {
+ public:
+ Standard_EXPORT GEOMAlgo_BndSphereTreeSelector();
+ Standard_EXPORT virtual Standard_Boolean Reject(const GEOMAlgo_BndSphere&) const;
+ Standard_EXPORT virtual Standard_Boolean Accept(const Standard_Integer &);
+ Standard_EXPORT virtual ~GEOMAlgo_BndSphereTreeSelector();
+
+ Standard_EXPORT void Clear();
+ Standard_EXPORT void SetBox(const GEOMAlgo_BndSphere&);
+ Standard_EXPORT const TColStd_ListOfInteger& Indices() const;
+
+ protected:
+ GEOMAlgo_BndSphere myBox;
+ TColStd_MapOfInteger myFence;
+ TColStd_ListOfInteger myIndices;
+
+ };
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File: GEOMAlgo_CoupleOfShapes.cxx
+// Created: Wed Dec 15 13:03:52 2004
+// Author: Peter KURNEV
+// <pkv@irinox>
+//
+#include <GEOMAlgo_CoupleOfShapes.hxx>
+//=======================================================================
+//function : GEOMAlgo_CoupleOfShapes
+//purpose :
+//=======================================================================
+GEOMAlgo_CoupleOfShapes::GEOMAlgo_CoupleOfShapes()
+{}
+//=======================================================================
+//function : SetShapes
+//purpose :
+//=======================================================================
+void GEOMAlgo_CoupleOfShapes::SetShapes(const TopoDS_Shape& aS1,
+ const TopoDS_Shape& aS2)
+{
+ myShape1=aS1;
+ myShape2=aS2;
+}
+//=======================================================================
+//function : Shapes
+//purpose :
+//=======================================================================
+void GEOMAlgo_CoupleOfShapes::Shapes(TopoDS_Shape& aS1,
+ TopoDS_Shape& aS2)const
+{
+ aS1=myShape1;
+ aS2=myShape2;
+}
+//=======================================================================
+//function : SetShape1
+//purpose :
+//=======================================================================
+void GEOMAlgo_CoupleOfShapes::SetShape1(const TopoDS_Shape& aS1)
+{
+ myShape1=aS1;
+}
+//=======================================================================
+//function : SetShape2
+//purpose :
+//=======================================================================
+void GEOMAlgo_CoupleOfShapes::SetShape2(const TopoDS_Shape& aS2)
+{
+ myShape2=aS2;
+}
+//=======================================================================
+//function : Shape1
+//purpose :
+//=======================================================================
+const TopoDS_Shape& GEOMAlgo_CoupleOfShapes::Shape1()const
+{
+ return myShape1;
+}
+//=======================================================================
+//function : Shape2
+//purpose :
+//=======================================================================
+const TopoDS_Shape& GEOMAlgo_CoupleOfShapes::Shape2()const
+{
+ return myShape2;
+}
--- /dev/null
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File: GEOMAlgo_CoupleOfShapes.hxx
+// Created: Wed Dec 15 13:03:52 2004
+// Author: Peter KURNEV
+// <pkv@irinox>
+//
+
+#ifndef _GEOMAlgo_CoupleOfShapes_HeaderFile
+#define _GEOMAlgo_CoupleOfShapes_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Macro.hxx>
+#include <TopoDS_Shape.hxx>
+
+//=======================================================================
+//class : GEOMAlgo_CoupleOfShapes
+//purpose :
+//=======================================================================
+class GEOMAlgo_CoupleOfShapes
+{
+ public:
+ Standard_EXPORT
+ GEOMAlgo_CoupleOfShapes();
+
+ Standard_EXPORT
+ void SetShapes(const TopoDS_Shape& aS1,const TopoDS_Shape& aS2) ;
+
+ Standard_EXPORT
+ void SetShape1(const TopoDS_Shape& aS1) ;
+
+ Standard_EXPORT
+ void SetShape2(const TopoDS_Shape& aS2) ;
+
+ Standard_EXPORT
+ void Shapes(TopoDS_Shape& aS1,TopoDS_Shape& aS2) const;
+
+ Standard_EXPORT
+ const TopoDS_Shape& Shape1() const;
+
+ Standard_EXPORT
+ const TopoDS_Shape& Shape2() const;
+
+protected:
+ TopoDS_Shape myShape1;
+ TopoDS_Shape myShape2;
+};
+#endif
--- /dev/null
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File: GEOMAlgo_IndexedDataMapOfIntegerShape.hxx
+// Created: Wed Feb 22 11:22:18 2012
+// Author:
+// <pkv@BDEURI37616>
+
+
+#ifndef GEOMAlgo_IndexedDataMapOfIntegerShape_HeaderFile
+#define GEOMAlgo_IndexedDataMapOfIntegerShape_HeaderFile
+
+
+
+#include <TopoDS_Shape.hxx>
+#include <Standard_Integer.hxx>
+#include <TColStd_MapIntegerHasher.hxx>
+
+#define _NCollection_MapHasher
+#include <NCollection_IndexedDataMap.hxx>
+
+
+typedef NCollection_IndexedDataMap<Standard_Integer,TopoDS_Shape, TColStd_MapIntegerHasher>
+ GEOMAlgo_IndexedDataMapOfIntegerShape;
+
+#undef _NCollection_MapHasher
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File: GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx
+// Created: Wed Feb 22 11:24:27 2012
+// Author:
+// <pkv@BDEURI37616>
+
+
+#ifndef GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape_HeaderFile
+#define GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape_HeaderFile
+
+#include <GEOMAlgo_PassKeyShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <GEOMAlgo_PassKeyShapeMapHasher.hxx>
+
+
+#define _NCollection_MapHasher
+#include <NCollection_IndexedDataMap.hxx>
+
+
+typedef NCollection_IndexedDataMap<GEOMAlgo_PassKeyShape,
+ TopTools_ListOfShape,
+ GEOMAlgo_PassKeyShapeMapHasher>
+ GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape;
+
+#undef _NCollection_MapHasher
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: GEOMAlgo_IndexedDataMapOfShapeBndSphere.hxx
+// Created: Mon Feb 20 09:17:01 2012
+// Author:
+// <pkv@BDEURI37616>
+
+
+#ifndef GEOMAlgo_IndexedDataMapOfShapeBndSphere_HeaderFile
+#define GEOMAlgo_IndexedDataMapOfShapeBndSphere_HeaderFile
+
+#include <TopoDS_Shape.hxx>
+#include <TopTools_ShapeMapHasher.hxx>
+#include <GEOMAlgo_BndSphere.hxx>
+
+#define _NCollection_MapHasher
+#include <NCollection_IndexedDataMap.hxx>
+
+
+
+typedef NCollection_IndexedDataMap<TopoDS_Shape, GEOMAlgo_BndSphere, TopTools_ShapeMapHasher>
+ GEOMAlgo_IndexedDataMapOfShapeBndSphere;
+
+#undef _NCollection_MapHasher
+
+
+
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File: GEOMAlgo_IndexedDataMapOfIndexedMapOfInteger.hxx
+// Created: Mon Feb 20 09:20:07 2012
+// Author:
+// <pkv@BDEURI37616>
+// File: GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape.hxx
+// Created: Mon Feb 20 11:59:23 2012
+// Author:
+// <pkv@BDEURI37616>
+
+
+#ifndef GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile
+#define GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape_HeaderFile
+
+
+#include <TopoDS_Shape.hxx>
+#include <TopTools_ShapeMapHasher.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
+#define _NCollection_MapHasher
+#include <NCollection_IndexedDataMap.hxx>
+
+
+typedef NCollection_IndexedDataMap <TopoDS_Shape,
+ TopTools_IndexedMapOfShape,
+ TopTools_ShapeMapHasher>
+ GEOMAlgo_IndexedDataMapOfShapeIndexedMapOfShape;
+
+#undef _NCollection_MapHasher
+
+
+#endif
+
--- /dev/null
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: GEOMAlgo_ListOfCoupleOfShapes.hxx
+// Created: Wed Feb 22 08:23:27 2012
+// Author:
+// <pkv@BDEURI37616>
+
+#ifndef GEOMAlgo_ListOfCoupleOfShapes_HeaderFile
+#define GEOMAlgo_ListOfCoupleOfShapes_HeaderFile
+
+#include <NCollection_List.hxx>
+#include <GEOMAlgo_CoupleOfShapes.hxx>
+
+typedef NCollection_List<GEOMAlgo_CoupleOfShapes> GEOMAlgo_ListOfCoupleOfShapes;
+typedef GEOMAlgo_ListOfCoupleOfShapes::Iterator GEOMAlgo_ListIteratorOfListOfCoupleOfShapes;
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: GEOMAlgo_PassKey.cxx
+// Created:
+// Author: Peter KURNEV
+// <peter@PREFEX>
+//
+#include <GEOMAlgo_PassKey.hxx>
+
+#include <stdio.h>
+#include <string.h>
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
+#include <TColStd_ListOfInteger.hxx>
+
+#ifdef WIN32
+#pragma warning( disable : 4101)
+#endif
+
+static
+ Standard_Integer NormalizedId(const Standard_Integer aId,
+ const Standard_Integer aDiv);
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+ GEOMAlgo_PassKey::GEOMAlgo_PassKey()
+{
+ Clear();
+}
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+ GEOMAlgo_PassKey::GEOMAlgo_PassKey(const GEOMAlgo_PassKey& aOther)
+{
+ myNbIds=aOther.myNbIds;
+ mySum=aOther.mySum;
+ myMap=aOther.myMap;
+}
+//=======================================================================
+//function :Assign
+//purpose :
+//=======================================================================
+ GEOMAlgo_PassKey& GEOMAlgo_PassKey::Assign(const GEOMAlgo_PassKey& aOther)
+{
+ myNbIds=aOther.myNbIds;
+ mySum=aOther.mySum;
+ myMap=aOther.myMap;
+ return *this;
+}
+//=======================================================================
+//function :~
+//purpose :
+//=======================================================================
+ GEOMAlgo_PassKey::~GEOMAlgo_PassKey()
+{
+}
+//=======================================================================
+//function :Clear
+//purpose :
+//=======================================================================
+ void GEOMAlgo_PassKey::Clear()
+{
+ myNbIds=0;
+ mySum=0;
+ myMap.Clear();
+}
+//=======================================================================
+//function :SetIds
+//purpose :
+//=======================================================================
+ void GEOMAlgo_PassKey::SetIds(const Standard_Integer aId1)
+
+{
+ Clear();
+ myNbIds=1;
+ myMap.Add(aId1);
+ mySum=NormalizedId(aId1, myNbIds);
+}
+//=======================================================================
+//function :SetIds
+//purpose :
+//=======================================================================
+ void GEOMAlgo_PassKey::SetIds(const Standard_Integer aId1,
+ const Standard_Integer aId2)
+{
+ TColStd_ListOfInteger aLI;
+ //
+ aLI.Append(aId1);
+ aLI.Append(aId2);
+ SetIds(aLI);
+}
+//=======================================================================
+//function :SetIds
+//purpose :
+//=======================================================================
+ void GEOMAlgo_PassKey::SetIds(const Standard_Integer aId1,
+ const Standard_Integer aId2,
+ const Standard_Integer aId3)
+{
+ TColStd_ListOfInteger aLI;
+ //
+ aLI.Append(aId1);
+ aLI.Append(aId2);
+ aLI.Append(aId3);
+ SetIds(aLI);
+}
+//=======================================================================
+//function :SetIds
+//purpose :
+//=======================================================================
+ void GEOMAlgo_PassKey::SetIds(const Standard_Integer aId1,
+ const Standard_Integer aId2,
+ const Standard_Integer aId3,
+ const Standard_Integer aId4)
+{
+ TColStd_ListOfInteger aLI;
+ //
+ aLI.Append(aId1);
+ aLI.Append(aId2);
+ aLI.Append(aId3);
+ aLI.Append(aId4);
+ SetIds(aLI);
+}
+//=======================================================================
+//function :SetIds
+//purpose :
+//=======================================================================
+ void GEOMAlgo_PassKey::SetIds(const TColStd_ListOfInteger& aLI)
+{
+ Standard_Integer i, aId, aIdN;
+ TColStd_ListIteratorOfListOfInteger aIt;
+ //
+ Clear();
+ aIt.Initialize(aLI);
+ for (; aIt.More(); aIt.Next()) {
+ aId=aIt.Value();
+ myMap.Add(aId);
+ }
+ myNbIds=myMap.Extent();
+ for(i=1; i<=myNbIds; ++i) {
+ aId=myMap(i);
+ aIdN=NormalizedId(aId, myNbIds);
+ mySum+=aIdN;
+ }
+}
+//=======================================================================
+//function :NbIds
+//purpose :
+//=======================================================================
+ Standard_Integer GEOMAlgo_PassKey::NbIds()const
+{
+ return myNbIds;
+}
+//=======================================================================
+//function :Id
+//purpose :
+//=======================================================================
+ Standard_Integer GEOMAlgo_PassKey::Id(const Standard_Integer aIndex) const
+{
+ if (aIndex<1 || aIndex>myNbIds) {
+ return -1;
+ }
+ return myMap(aIndex);
+}
+//=======================================================================
+//function :IsEqual
+//purpose :
+//=======================================================================
+ Standard_Boolean GEOMAlgo_PassKey::IsEqual(const GEOMAlgo_PassKey& aOther) const
+{
+ Standard_Boolean bRet;
+ Standard_Integer i, aId;
+ //
+ bRet=Standard_False;
+ //
+ if (myNbIds!=aOther.myNbIds) {
+ return bRet;
+ }
+ for (i=1; i<=myNbIds; ++i) {
+ aId=myMap(i);
+ if (!aOther.myMap.Contains(aId)) {
+ return bRet;
+ }
+ }
+ return !bRet;
+}
+//=======================================================================
+//function : HashCode
+//purpose :
+//=======================================================================
+ Standard_Integer GEOMAlgo_PassKey::HashCode(const Standard_Integer aUpper) const
+{
+ return ::HashCode(mySum, aUpper);
+}
+//=======================================================================
+//function : Dump
+//purpose :
+//=======================================================================
+ void GEOMAlgo_PassKey::Dump(const Standard_Integer )const
+{
+}
+//=======================================================================
+// function: NormalizedId
+// purpose :
+//=======================================================================
+Standard_Integer NormalizedId(const Standard_Integer aId,
+ const Standard_Integer aDiv)
+{
+ Standard_Integer aMax, aTresh, aIdRet;
+ //
+ aIdRet=aId;
+ aMax=::IntegerLast();
+ aTresh=aMax/aDiv;
+ if (aId>aTresh) {
+ aIdRet=aId%aTresh;
+ }
+ return aIdRet;
+}
--- /dev/null
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: GEOMAlgo_PassKey.hxx
+// Created:
+// Author: Peter KURNEV
+// <peter@PREFEX>
+//
+#ifndef _GEOMAlgo_PassKey_HeaderFile
+#define _GEOMAlgo_PassKey_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Macro.hxx>
+#include <Standard_Integer.hxx>
+#include <Standard_Boolean.hxx>
+
+#include <TColStd_ListOfInteger.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+
+//=======================================================================
+//class : GEOMAlgo_PassKey
+//purpose :
+//=======================================================================
+class GEOMAlgo_PassKey {
+ public:
+ Standard_EXPORT
+ GEOMAlgo_PassKey();
+
+ Standard_EXPORT
+ virtual ~GEOMAlgo_PassKey();
+
+ Standard_EXPORT
+ GEOMAlgo_PassKey(const GEOMAlgo_PassKey& Other);
+
+ Standard_EXPORT
+ GEOMAlgo_PassKey& Assign(const GEOMAlgo_PassKey& Other) ;
+
+ GEOMAlgo_PassKey& operator =(const GEOMAlgo_PassKey& Other) {
+ return Assign(Other);
+ }
+
+ Standard_EXPORT
+ void Clear() ;
+
+ Standard_EXPORT
+ void SetIds(const Standard_Integer aI1) ;
+
+ Standard_EXPORT
+ void SetIds(const Standard_Integer aI1,
+ const Standard_Integer aI2) ;
+
+ Standard_EXPORT
+ void SetIds(const Standard_Integer aI1,
+ const Standard_Integer aI2,
+ const Standard_Integer aI3) ;
+
+ Standard_EXPORT
+ void SetIds(const Standard_Integer aI1,
+ const Standard_Integer aI2,
+ const Standard_Integer aI3,
+ const Standard_Integer aI4) ;
+
+ Standard_EXPORT
+ void SetIds(const TColStd_ListOfInteger& aLS) ;
+
+ Standard_EXPORT
+ Standard_Integer NbIds() const;
+
+ Standard_EXPORT
+ Standard_Boolean IsEqual(const GEOMAlgo_PassKey& aOther) const;
+
+ Standard_EXPORT
+ Standard_Integer HashCode(const Standard_Integer Upper) const;
+
+ Standard_EXPORT
+ Standard_Integer Id(const Standard_Integer aIndex) const;
+
+ Standard_EXPORT
+ void Dump(const Standard_Integer aHex = 0) const;
+
+ protected:
+ Standard_Integer myNbIds;
+ Standard_Integer mySum;
+ TColStd_IndexedMapOfInteger myMap;
+};
+#endif
--- /dev/null
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: GEOMAlgo_PassKeyMapHasher.cxx
+// Created:
+// Author: Peter KURNEV
+// <pkv@irinox>
+//
+#include <GEOMAlgo_PassKeyMapHasher.hxx>
+
+//=======================================================================
+//function : HashCode
+//purpose :
+//=======================================================================
+ Standard_Integer GEOMAlgo_PassKeyMapHasher::HashCode(const GEOMAlgo_PassKey& aPK,
+ const Standard_Integer Upper)
+{
+ return aPK.HashCode(Upper);
+}
+//=======================================================================
+//function :IsEqual
+//purpose :
+//=======================================================================
+ Standard_Boolean GEOMAlgo_PassKeyMapHasher::IsEqual(const GEOMAlgo_PassKey& aPK1,
+ const GEOMAlgo_PassKey& aPK2)
+{
+ return aPK1.IsEqual(aPK2);
+}
--- /dev/null
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: GEOMAlgo_PassKeyMapHasher.hxx
+// Created:
+// Author: Peter KURNEV
+// <pkv@irinox>
+//
+#ifndef _GEOMAlgo_PassKeyMapHasher_HeaderFile
+#define _GEOMAlgo_PassKeyMapHasher_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Macro.hxx>
+#include <Standard_Integer.hxx>
+#include <Standard_Boolean.hxx>
+#include <GEOMAlgo_PassKey.hxx>
+
+//=======================================================================
+//class : GEOMAlgo_PassKeyMapHasher
+//purpose :
+//=======================================================================
+class GEOMAlgo_PassKeyMapHasher {
+ public:
+ Standard_EXPORT
+ static Standard_Integer HashCode(const GEOMAlgo_PassKey& aPKey,
+ const Standard_Integer Upper) ;
+
+ Standard_EXPORT
+ static Standard_Boolean IsEqual(const GEOMAlgo_PassKey& aPKey1,
+ const GEOMAlgo_PassKey& aPKey2) ;
+};
+#endif
--- /dev/null
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: GEOMAlgo_PassKeyShape.cxx
+// Created:
+// Author: Peter KURNEV
+// <pkv@irinox>
+//
+#include <GEOMAlgo_PassKeyShape.hxx>
+
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+
+
+static
+ Standard_Integer NormalizedId(const Standard_Integer aId,
+ const Standard_Integer aDiv);
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+ GEOMAlgo_PassKeyShape::GEOMAlgo_PassKeyShape()
+{
+ myUpper=432123;
+}
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+ GEOMAlgo_PassKeyShape::GEOMAlgo_PassKeyShape(const GEOMAlgo_PassKeyShape& aOther)
+{
+ myUpper=432123;
+ myNbIds=aOther.myNbIds;
+ mySum=aOther.mySum;
+ myMap=aOther.myMap;
+}
+//=======================================================================
+//function :~
+//purpose :
+//=======================================================================
+ GEOMAlgo_PassKeyShape::~GEOMAlgo_PassKeyShape()
+{
+}
+//=======================================================================
+//function :Assign
+//purpose :
+//=======================================================================
+ GEOMAlgo_PassKeyShape& GEOMAlgo_PassKeyShape::Assign(const GEOMAlgo_PassKeyShape& aOther)
+{
+ myUpper=432123;
+ myNbIds=aOther.myNbIds;
+ mySum=aOther.mySum;
+ myMap=aOther.myMap;
+ return *this;
+}
+//=======================================================================
+//function :Clear
+//purpose :
+//=======================================================================
+ void GEOMAlgo_PassKeyShape::Clear()
+{
+ myNbIds=0;
+ mySum=0;
+ myMap.Clear();
+}
+//=======================================================================
+//function :SetShapes
+//purpose :
+//=======================================================================
+ void GEOMAlgo_PassKeyShape::SetShapes(const TopoDS_Shape& aS1)
+
+{
+ Standard_Integer aHC;
+ //
+ Clear();
+ myNbIds=1;
+ myMap.Add(aS1);
+ aHC=aS1.HashCode(myUpper);
+ mySum=NormalizedId(aHC, myNbIds);
+}
+//=======================================================================
+//function :SetShapes
+//purpose :
+//=======================================================================
+ void GEOMAlgo_PassKeyShape::SetShapes(const TopoDS_Shape& aS1,
+ const TopoDS_Shape& aS2)
+{
+ TopTools_ListOfShape aLS;
+ //
+ aLS.Append(aS1);
+ aLS.Append(aS2);
+ SetShapes(aLS);
+}
+//=======================================================================
+//function :SetShapes
+//purpose :
+//=======================================================================
+ void GEOMAlgo_PassKeyShape::SetShapes(const TopoDS_Shape& aS1,
+ const TopoDS_Shape& aS2,
+ const TopoDS_Shape& aS3)
+{
+ TopTools_ListOfShape aLS;
+ //
+ aLS.Append(aS1);
+ aLS.Append(aS2);
+ aLS.Append(aS3);
+ SetShapes(aLS);
+}
+//=======================================================================
+//function :SetShapes
+//purpose :
+//=======================================================================
+ void GEOMAlgo_PassKeyShape::SetShapes(const TopoDS_Shape& aS1,
+ const TopoDS_Shape& aS2,
+ const TopoDS_Shape& aS3,
+ const TopoDS_Shape& aS4)
+{
+ TopTools_ListOfShape aLS;
+ //
+ aLS.Append(aS1);
+ aLS.Append(aS2);
+ aLS.Append(aS3);
+ aLS.Append(aS4);
+ SetShapes(aLS);
+}
+//=======================================================================
+//function :SetShapes
+//purpose :
+//=======================================================================
+ void GEOMAlgo_PassKeyShape::SetShapes(const TopTools_ListOfShape& aLS)
+{
+ Standard_Integer i, aId, aIdN;
+ TopTools_ListIteratorOfListOfShape aIt;
+ //
+ Clear();
+ aIt.Initialize(aLS);
+ for (; aIt.More(); aIt.Next()) {
+ const TopoDS_Shape& aS=aIt.Value();
+ myMap.Add(aS);
+ }
+ myNbIds=myMap.Extent();
+ for(i=1; i<=myNbIds; ++i) {
+ const TopoDS_Shape& aS=myMap(i);
+ aId=aS.HashCode(myUpper);
+ aIdN=NormalizedId(aId, myNbIds);
+ mySum+=aIdN;
+ }
+}
+//=======================================================================
+//function :NbIds
+//purpose :
+//=======================================================================
+ Standard_Integer GEOMAlgo_PassKeyShape::NbIds()const
+{
+ return myNbIds;
+}
+//=======================================================================
+//function :IsEqual
+//purpose :
+//=======================================================================
+ Standard_Boolean GEOMAlgo_PassKeyShape::IsEqual(const GEOMAlgo_PassKeyShape& aOther) const
+{
+ Standard_Boolean bRet;
+ Standard_Integer i;
+ //
+ bRet=Standard_False;
+ //
+ if (myNbIds!=aOther.myNbIds) {
+ return bRet;
+ }
+ for (i=1; i<=myNbIds; ++i) {
+ const TopoDS_Shape& aS=myMap(i);
+ if (!aOther.myMap.Contains(aS)) {
+ return bRet;
+ }
+ }
+ return !bRet;
+}
+//=======================================================================
+//function : HashCode
+//purpose :
+//=======================================================================
+ Standard_Integer GEOMAlgo_PassKeyShape::HashCode(const Standard_Integer aUpper) const
+{
+ return ::HashCode(mySum, aUpper);
+}
+//=======================================================================
+//function : Dump
+//purpose :
+//=======================================================================
+ void GEOMAlgo_PassKeyShape::Dump(const Standard_Integer)const
+{
+}
+//=======================================================================
+// function: NormalizedId
+// purpose :
+//=======================================================================
+Standard_Integer NormalizedId(const Standard_Integer aId,
+ const Standard_Integer aDiv)
+{
+ Standard_Integer aMax, aTresh, aIdRet;
+ //
+ aIdRet=aId;
+ aMax=::IntegerLast();
+ aTresh=aMax/aDiv;
+ if (aId>aTresh) {
+ aIdRet=aId%aTresh;
+ }
+ return aIdRet;
+}
--- /dev/null
+
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: GEOMAlgo_PassKeyShape.hxx
+// Created:
+// Author: Peter KURNEV
+// <pkv@irinox>
+//
+#ifndef _GEOMAlgo_PassKeyShape_HeaderFile
+#define _GEOMAlgo_PassKeyShape_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Macro.hxx>
+#include <Standard_Integer.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <Standard_Boolean.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopTools_ListOfShape.hxx>
+
+
+//=======================================================================
+//class : GEOMAlgo_PassKeyShape
+//purpose :
+//=======================================================================
+class GEOMAlgo_PassKeyShape {
+ public:
+ Standard_EXPORT
+ GEOMAlgo_PassKeyShape();
+
+ Standard_EXPORT
+ virtual ~GEOMAlgo_PassKeyShape();
+
+ Standard_EXPORT
+ GEOMAlgo_PassKeyShape(const GEOMAlgo_PassKeyShape& Other);
+
+ Standard_EXPORT
+ GEOMAlgo_PassKeyShape& Assign(const GEOMAlgo_PassKeyShape& Other) ;
+
+ GEOMAlgo_PassKeyShape& operator =(const GEOMAlgo_PassKeyShape& Other) {
+ return Assign(Other);
+ }
+
+ Standard_EXPORT
+ void SetShapes(const TopoDS_Shape& aS) ;
+
+ Standard_EXPORT
+ void SetShapes(const TopoDS_Shape& aS1,
+ const TopoDS_Shape& aS2) ;
+
+ Standard_EXPORT
+ void SetShapes(const TopoDS_Shape& aS1,
+ const TopoDS_Shape& aS2,
+ const TopoDS_Shape& aS3) ;
+
+ Standard_EXPORT
+ void SetShapes(const TopoDS_Shape& aS1,
+ const TopoDS_Shape& aS2,
+ const TopoDS_Shape& aS3,
+ const TopoDS_Shape& aS4) ;
+
+ Standard_EXPORT
+ void SetShapes(const TopTools_ListOfShape& aLS) ;
+
+ Standard_EXPORT
+ void Clear() ;
+
+ Standard_EXPORT
+ Standard_Integer NbIds() const;
+
+ Standard_EXPORT
+ Standard_Boolean IsEqual(const GEOMAlgo_PassKeyShape& aOther) const;
+
+ Standard_EXPORT
+ Standard_Integer HashCode(const Standard_Integer Upper) const;
+
+ Standard_EXPORT
+ void Dump(const Standard_Integer aHex = 0) const;
+
+protected:
+ Standard_Integer myNbIds;
+ Standard_Integer mySum;
+ Standard_Integer myUpper;
+ TopTools_IndexedMapOfShape myMap;
+};
+#endif
--- /dev/null
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: GEOMAlgo_PassKeyMapHasher.cxx
+// Created:
+// Author: Peter KURNEV
+// <pkv@irinox>
+//
+#include <GEOMAlgo_PassKeyShapeMapHasher.hxx>
+
+//=======================================================================
+//function : HashCode
+//purpose :
+//=======================================================================
+ Standard_Integer GEOMAlgo_PassKeyShapeMapHasher::HashCode(const GEOMAlgo_PassKeyShape& aPK,
+ const Standard_Integer Upper)
+{
+ return aPK.HashCode(Upper);
+}
+//=======================================================================
+//function :IsEqual
+//purpose :
+//=======================================================================
+ Standard_Boolean GEOMAlgo_PassKeyShapeMapHasher::IsEqual(const GEOMAlgo_PassKeyShape& aPK1,
+ const GEOMAlgo_PassKeyShape& aPK2)
+{
+ return aPK1.IsEqual(aPK2);
+}
--- /dev/null
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File: GEOMAlgo_PassKeyMapHasher.hxx
+// Created:
+// Author: Peter KURNEV
+// <pkv@irinox>
+//
+#ifndef _GEOMAlgo_PassKeyShapeMapHasher_HeaderFile
+#define _GEOMAlgo_PassKeyShapeMapHasher_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_Macro.hxx>
+#include <Standard_Integer.hxx>
+#include <Standard_Boolean.hxx>
+#include <GEOMAlgo_PassKeyShape.hxx>
+
+//=======================================================================
+//class : GEOMAlgo_PassKeyShapeMapHasher
+//purpose :
+//=======================================================================
+class GEOMAlgo_PassKeyShapeMapHasher
+{
+ public:
+ Standard_EXPORT
+ static Standard_Integer HashCode(const GEOMAlgo_PassKeyShape& aPKey,
+ const Standard_Integer Upper) ;
+
+ Standard_EXPORT
+ static Standard_Boolean IsEqual(const GEOMAlgo_PassKeyShape& aPKey1,
+ const GEOMAlgo_PassKeyShape& aPKey2) ;
+};
+#endif
--- /dev/null
+// Copyright (C) 2014-2020 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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <GeomAlgoAPI_Algo.h>
+
+//=======================================================================
+// function:
+// purpose:
+//=======================================================================
+GeomAlgoAPI_Algo::GeomAlgoAPI_Algo()
+:
+ myErrorStatus(1),
+ myWarningStatus(0),
+ myComputeInternalShapes(Standard_True)
+{}
+//=======================================================================
+// function: ~
+// purpose:
+//=======================================================================
+GeomAlgoAPI_Algo::~GeomAlgoAPI_Algo()
+{
+}
+//=======================================================================
+// function: CheckData
+// purpose:
+//=======================================================================
+void GeomAlgoAPI_Algo::CheckData()
+{
+ myErrorStatus=0;
+}
+//=======================================================================
+// function: CheckResult
+// purpose:
+//=======================================================================
+void GeomAlgoAPI_Algo::CheckResult()
+{
+ myErrorStatus=0;
+}
+//=======================================================================
+// function: ErrorStatus
+// purpose:
+//=======================================================================
+Standard_Integer GeomAlgoAPI_Algo::ErrorStatus()const
+{
+ return myErrorStatus;
+}
+//=======================================================================
+// function: WarningStatus
+// purpose:
+//=======================================================================
+Standard_Integer GeomAlgoAPI_Algo::WarningStatus()const
+{
+ return myWarningStatus;
+}
+// myErrorStatus
+//
+// 1 - object is just initialized
+
+//=======================================================================
+//function : ComputeInternalShapes
+//purpose :
+//=======================================================================
+void GeomAlgoAPI_Algo::ComputeInternalShapes(const Standard_Boolean theFlag)
+{
+ myComputeInternalShapes = theFlag;
+}
--- /dev/null
+// Copyright (C) 2014-2020 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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef GEOMALGOAPI_ALGO_H_
+#define GEOMALGOAPI_ALGO_H_
+
+#include <GeomAlgoAPI.h>
+#include <Standard.hxx>
+#include <Standard_Macro.hxx>
+#include <Standard_Integer.hxx>
+#include <Standard_Boolean.hxx>
+
+//=======================================================================
+//class : GeomAlgoAPI_Algo
+//purpose :
+//=======================================================================
+class GeomAlgoAPI_Algo
+{
+ public:
+ Standard_EXPORT
+ virtual void Perform() = 0;
+
+ Standard_EXPORT
+ Standard_Integer ErrorStatus() const;
+
+ Standard_EXPORT
+ Standard_Integer WarningStatus() const;
+
+ //! Allows to omit of creation of internal shapes (manifold topology). <br>
+ //! Needed for the SALOME/TRIPOLI module. <br>
+ Standard_EXPORT
+ void ComputeInternalShapes(const Standard_Boolean theFlag) ;
+
+protected:
+ Standard_EXPORT
+ GeomAlgoAPI_Algo();
+
+ Standard_EXPORT
+ virtual ~GeomAlgoAPI_Algo();
+
+ Standard_EXPORT
+ virtual void CheckData() ;
+
+ Standard_EXPORT
+ virtual void CheckResult() ;
+
+
+ Standard_Integer myErrorStatus;
+ Standard_Integer myWarningStatus;
+ Standard_Boolean myComputeInternalShapes;
+};
+#endif
--- /dev/null
+// Copyright (C) 2014-2020 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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "GeomAlgoAPI_DuplicatedFaces.h"
+
+#include <TopTools_SequenceOfShape.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Compound.hxx>
+#include <BRep_Builder.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
+#include <GeomAlgoAPI_GlueDetector.h>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <GeomAlgoAPI_ShapeBuilder.h>
+#include <vector>
+#include <GeomAlgoAPI_SortListOfShapes.h>
+#include <TopExp.hxx>
+
+
+//=================================================================================================
+bool GetDuplicatedFaces( const ListOfShape& theShapes,
+ const Standard_Real& theTolerance,
+ ListOfShape & theFaces,
+ std::string& theError)
+{
+
+ #ifdef _DEBUG
+ std::cout << "GetDuplicatedFaces " << std::endl;
+ #endif
+
+ TopoDS_Shape aShape;
+ TopTools_SequenceOfShape aShapesSeq;
+
+ ListOfShape::const_iterator anIt = theShapes.cbegin();
+
+ for(; anIt != theShapes.cend(); ++anIt) {
+
+ GeomShapePtr aShapePtr = *anIt;
+
+ if (!aShapePtr.get()) {
+ theError = "GetDuplicatedFaces : An invalid argument";
+ return false;
+ }
+ aShape = aShapePtr->impl<TopoDS_Shape>();
+ aShapesSeq.Append( aShape );
+ }
+
+ if ( aShapesSeq.Length() > 1 )
+ {
+ TopoDS_Compound aCompound;
+ BRep_Builder aBuilder;
+ aBuilder.MakeCompound( aCompound );
+ for ( int i = 1; i <= aShapesSeq.Length(); ++i )
+ aBuilder.Add( aCompound, aShapesSeq( i ) );
+
+ aShape = aCompound;
+ }
+
+ GeomAlgoAPI_GlueDetector aGluer;
+ aGluer.SetArgument(aShape);
+ aGluer.SetTolerance(theTolerance);
+ aGluer.Perform();
+ Standard_Integer iErr = aGluer.ErrorStatus();
+ if (iErr) return NULL;
+
+ std::vector< TopTools_IndexedMapOfShape* > anIndices( aShapesSeq.Length(), NULL );
+ Handle(TColStd_HArray1OfInteger) anArray;
+ GeomShapePtr anObj;//Handle(GEOM_Object) anObj;
+
+ ListOfShape listOnePerSet;
+
+ const TopTools_DataMapOfShapeListOfShape& aImages = aGluer.Images();
+ TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItDMSLS (aImages);
+ for (int index = 1; aItDMSLS.More(); aItDMSLS.Next(), ++index) {
+ // some key shape
+ //const TopoDS_Shape& aSkey = aItDMSLS.Key();
+
+ // list of shapes of the argument that can be glued
+ const TopTools_ListOfShape& aLSD = aItDMSLS.Value();
+
+ //listShape.Append(aLSD.First());
+ TopoDS_Shape aValue = aLSD.First();
+
+ if (aValue.ShapeType() == TopAbs_FACE) {
+ GeomShapePtr aS(new GeomAPI_Shape);
+ aS->setImpl<TopoDS_Shape>(new TopoDS_Shape(aValue));
+ listOnePerSet.push_back(aS);
+ }
+ }
+
+ // for stable order of returned entities
+ GeomAlgoAPI_SortListOfShapes::sort(listOnePerSet);
+
+ //TopTools_ListIteratorOfListOfShape aListIt (listOnePerSet);
+ ListOfShape::const_iterator aListIt = listOnePerSet.cbegin();
+ for (; aListIt != listOnePerSet.cend(); ++aListIt)
+ {
+ TopoDS_Shape aValue = (*aListIt)->impl<TopoDS_Shape>();
+ // find a shape to add aValue as a sub-shape
+ anObj.reset();
+
+ anIt = theShapes.cbegin();
+ GeomShapePtr aShapePtr;
+ for ( int i = 0; i < theShapes.size(); ++i, ++anIt )
+ {
+ aShapePtr = *anIt;
+ if ( !anIndices[i] ) {
+ anIndices[i] = new TopTools_IndexedMapOfShape;
+ aShape = aShapePtr->impl<TopoDS_Shape>();
+ TopExp::MapShapes( aShape, *anIndices[i]);
+ }
+ if (int index = anIndices[i]->FindIndex( aValue )) {
+
+ const TopoDS_Shape& aSelShape = anIndices[i]->FindKey(index);
+ GeomShapePtr aS(new GeomAPI_Shape);
+ aS->setImpl<TopoDS_Shape>(new TopoDS_Shape(aSelShape));
+ // GeomAlgoAPI_ShapeBuilder::add(aShapePtr,aS);
+ if ( aS.get())
+ theFaces.push_back(aS);
+ break;
+ }
+ }
+ }
+ for ( size_t i = 0 ; i < anIndices.size(); ++i )
+ delete anIndices[i];
+
+ return true;
+}
+
--- /dev/null
+// Copyright (C) 2014-2020 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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef GEOMALGOAPI_DUPLICATEDFACES_H_
+#define GEOMALGOAPI_DUPLICATEDFACES_H_
+
+#include <GeomAlgoAPI.h>
+#include <GeomAPI_Shape.h>
+#include <Standard_TypeDef.hxx>
+
+/// get the boundin box of theshape.
+ /// \param theShape the shape
+ /// \param theTolerance precise TRUE for precise computation; FALSE for fast one.
+ /// \param theFaces the duplicated faces
+ /// \param theError error
+GEOMALGOAPI_EXPORT
+bool GetDuplicatedFaces( const ListOfShape& theShapes,
+ const Standard_Real& theTolerance,
+ ListOfShape & theFaces,
+ std::string& theError);
+
+#endif //GEOMALGOAPI_DUPLICATEDFACES_H_
--- /dev/null
+// Copyright (C) 2014-2020 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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <GeomAlgoAPI_GlueDetector.h>
+
+#include <Bnd_Box.hxx>
+#include <NCollection_UBTreeFiller.hxx>
+
+#include <TColStd_ListOfInteger.hxx>
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
+#include <TColStd_MapIteratorOfMapOfInteger.hxx>
+
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Compound.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Compound.hxx>
+
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TopTools_MapIteratorOfMapOfShape.hxx>
+
+#include <TopExp.hxx>
+#include <BRep_Tool.hxx>
+#include <BRep_Builder.hxx>
+#include <BRepBndLib.hxx>
+
+#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopTools_MapOfShape.hxx>
+
+#include <GEOMAlgo_BndSphereTree.hxx>
+#include <GEOMAlgo_BndSphere.hxx>
+#include <GEOMAlgo_IndexedDataMapOfShapeBndSphere.hxx>
+
+#include <GEOMAlgo_IndexedDataMapOfIntegerShape.hxx>
+#include <GEOMAlgo_PassKeyShape.hxx>
+#include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx>
+#include <GEOMAlgo_AlgoTools.hxx>
+
+//
+static
+ Standard_Integer CheckAncesstors
+ (const TopoDS_Shape& aVSD,
+ const TopTools_MapOfShape& aMVSD,
+ const TopTools_IndexedDataMapOfShapeListOfShape& aMVE,
+ const TopTools_IndexedDataMapOfShapeListOfShape& aMEV,
+ TopTools_IndexedDataMapOfShapeListOfShape& aMEVZ);
+
+//=======================================================================
+//function :
+//purpose :
+//=======================================================================
+GeomAlgoAPI_GlueDetector::GeomAlgoAPI_GlueDetector()
+:
+ GeomAlgoAPI_GluerAlgo(),
+ GeomAlgoAPI_Algo()
+{}
+//=======================================================================
+//function : ~
+//purpose :
+//=======================================================================
+GeomAlgoAPI_GlueDetector::~GeomAlgoAPI_GlueDetector()
+{}
+//=======================================================================
+//function : StickedShapes
+//purpose :
+//=======================================================================
+const TopTools_IndexedDataMapOfShapeListOfShape&
+ GeomAlgoAPI_GlueDetector::StickedShapes()
+{
+ return myStickedShapes;
+}
+//=======================================================================
+//function : Perform
+//purpose :
+//=======================================================================
+void GeomAlgoAPI_GlueDetector::Perform()
+{
+ myErrorStatus=0;
+ myWarningStatus=0;
+ myStickedShapes.Clear();
+ //
+ CheckData();
+ if (myErrorStatus) {
+ return;
+ }
+ //
+ // Initialize the context
+ GeomAlgoAPI_GluerAlgo::Perform();
+ //
+ DetectVertices();
+ if (myErrorStatus) {
+ return;
+ }
+ //
+ CheckDetected();
+ if (myErrorStatus) {
+ return;
+ }
+ //
+ DetectEdges();
+ if (myErrorStatus) {
+ return;
+ }
+ //
+ DetectFaces();
+ if (myErrorStatus) {
+ return;
+ }
+}
+//=======================================================================
+//function : DetectVertices
+//purpose :
+//=======================================================================
+void GeomAlgoAPI_GlueDetector::DetectVertices()
+{
+ Standard_Integer j, i, aNbV, aNbVSD;
+ Standard_Real aTolV;
+ gp_Pnt aPV;
+ TColStd_ListIteratorOfListOfInteger aIt;
+ TopoDS_Shape aVF;
+ TopTools_IndexedMapOfShape aMV;
+ TopTools_MapOfShape aMVProcessed;
+ TopTools_ListIteratorOfListOfShape aItS;
+ TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
+ TopTools_DataMapOfShapeListOfShape aMVV;
+ GEOMAlgo_IndexedDataMapOfIntegerShape aMIS;
+ GEOMAlgo_IndexedDataMapOfShapeBndSphere aMSB;
+ GEOMAlgo_BndSphereTreeSelector aSelector;
+ GEOMAlgo_BndSphereTree aBBTree;
+ NCollection_UBTreeFiller <Standard_Integer, GEOMAlgo_BndSphere> aTreeFiller(aBBTree);
+ //
+ myErrorStatus=0;
+ //
+ TopExp::MapShapes(myArgument, TopAbs_VERTEX, aMV);
+ aNbV=aMV.Extent();
+ if (!aNbV) {
+ myErrorStatus=2; // no vertices in source shape
+ return;
+ }
+ //
+ for (i=1; i<=aNbV; ++i) {
+ GEOMAlgo_BndSphere aBox;
+ //
+ const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aMV(i));
+ aPV=BRep_Tool::Pnt(aV);
+ aTolV=BRep_Tool::Tolerance(aV);
+ //
+ aBox.SetGap(myTolerance);
+ aBox.SetCenter(aPV);
+ aBox.SetRadius(aTolV);
+ //
+ aTreeFiller.Add(i, aBox);
+ //
+ aMIS.Add(i, aV);
+ aMSB.Add(aV, aBox);
+ }
+ //
+ aTreeFiller.Fill();
+ //
+ //---------------------------------------------------
+ // Chains
+ for (i=1; i<=aNbV; ++i) {
+ const TopoDS_Shape& aV=aMV(i);
+ //
+ if (aMVProcessed.Contains(aV)) {
+ continue;
+ }
+ //
+ Standard_Integer aNbIP, aIP, aNbIP1, aIP1;
+ TopTools_ListOfShape aLVSD;
+ TColStd_MapOfInteger aMIP, aMIP1, aMIPC;
+ TColStd_MapIteratorOfMapOfInteger aIt1;
+ //
+ aMIP.Add(i);
+ for(;;) {
+ aNbIP=aMIP.Extent();
+ aIt1.Initialize(aMIP);
+ for(; aIt1.More(); aIt1.Next()) {
+ aIP=aIt1.Key();
+ if (aMIPC.Contains(aIP)) {
+ continue;
+ }
+ //
+ const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
+ const GEOMAlgo_BndSphere& aBoxVP=aMSB.FindFromKey(aVP);
+ //
+ aSelector.Clear();
+ aSelector.SetBox(aBoxVP);
+ //
+ aNbVSD=aBBTree.Select(aSelector);
+ if (!aNbVSD) {
+ continue; // it should not be so [at least IP itself]
+ }
+ //
+ const TColStd_ListOfInteger& aLI=aSelector.Indices();
+ aIt.Initialize(aLI);
+ for (; aIt.More(); aIt.Next()) {
+ aIP1=aIt.Value();
+ if (aMIP.Contains(aIP1)) {
+ continue;
+ }
+ aMIP1.Add(aIP1);
+ } //for (; aIt.More(); aIt.Next()) {
+ }//for(; aIt1.More(); aIt1.Next()) {
+ //
+ aNbIP1=aMIP1.Extent();
+ if (!aNbIP1) {
+ break;
+ }
+ //
+ aIt1.Initialize(aMIP);
+ for(; aIt1.More(); aIt1.Next()) {
+ aIP=aIt1.Key();
+ aMIPC.Add(aIP);
+ }
+ //
+ aMIP.Clear();
+ aIt1.Initialize(aMIP1);
+ for(; aIt1.More(); aIt1.Next()) {
+ aIP=aIt1.Key();
+ aMIP.Add(aIP);
+ }
+ aMIP1.Clear();
+ }// while(1)
+ //
+ // Fill myImages
+ aNbIP=aMIPC.Extent();
+ //
+ if (!aNbIP) {// no SD vertices is found
+ aMVProcessed.Add(aV);
+ continue;
+ }
+ //else { // SD vertices founded [ aMIPC ]
+ aIt1.Initialize(aMIPC);
+ for(j=0; aIt1.More(); aIt1.Next(), ++j) {
+ aIP=aIt1.Key();
+ const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
+ if (!j) {
+ aVF=aVP;
+ }
+ aLVSD.Append(aVP);
+ aMVProcessed.Add(aVP);
+ }
+ //}
+ myImages.Bind(aVF, aLVSD);
+ }// for (i=1; i<=aNbV; ++i) {
+ //------------------------------
+ // Origins
+ aItIm.Initialize(myImages);
+ for (; aItIm.More(); aItIm.Next()) {
+ const TopoDS_Shape& aV=aItIm.Key();
+ const TopTools_ListOfShape& aLVSD=aItIm.Value();
+ aItS.Initialize(aLVSD);
+ for (; aItS.More(); aItS.Next()) {
+ const TopoDS_Shape& aVSD=aItS.Value();
+ if (!myOrigins.IsBound(aVSD)) {
+ myOrigins.Bind(aVSD, aV);
+ }
+ }
+ }
+}
+//=======================================================================
+//function : DetectFaces
+//purpose :
+//=======================================================================
+void GeomAlgoAPI_GlueDetector::DetectFaces()
+{
+ DetectShapes(TopAbs_FACE);
+}
+//=======================================================================
+//function : DetectEdges
+//purpose :
+//=======================================================================
+void GeomAlgoAPI_GlueDetector::DetectEdges()
+{
+ DetectShapes(TopAbs_EDGE);
+}
+//=======================================================================
+//function : DetectShapes
+//purpose :
+//=======================================================================
+void GeomAlgoAPI_GlueDetector::DetectShapes(const TopAbs_ShapeEnum aType)
+{
+ Standard_Boolean bDegenerated;
+ Standard_Integer i, aNbF, aNbSDF, iErr;
+ TopTools_IndexedMapOfShape aMF;
+ TopTools_ListIteratorOfListOfShape aItLS;
+ GEOMAlgo_PassKeyShape aPKF;
+ GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape aMPKLF;
+ //
+ myErrorStatus=0;
+ //
+ TopExp::MapShapes(myArgument, aType, aMF);
+ //
+ aNbF=aMF.Extent();
+ for (i=1; i<=aNbF; ++i) {
+ const TopoDS_Shape& aS=aMF(i);
+ //
+ if (aType==TopAbs_FACE) {
+ const TopoDS_Face& aF=*((TopoDS_Face*)&aS);
+ FacePassKey(aF, aPKF);
+ }
+ else if (aType==TopAbs_EDGE) {
+ const TopoDS_Edge& aE=*((TopoDS_Edge*)&aS);
+ EdgePassKey(aE, aPKF);
+ }
+ //
+ if (myErrorStatus) {
+ return;
+ }
+ //
+ if (aMPKLF.Contains(aPKF)) {
+ TopTools_ListOfShape& aLSDF=aMPKLF.ChangeFromKey(aPKF);
+ aLSDF.Append(aS);
+ }
+ else {
+ TopTools_ListOfShape aLSDF;
+ //
+ aLSDF.Append(aS);
+ aMPKLF.Add(aPKF, aLSDF);
+ }
+ }
+ // check geometric coincidence
+ if (myCheckGeometry) {
+ iErr=GEOMAlgo_AlgoTools::RefineSDShapes(aMPKLF, myTolerance, myContext);
+ if (iErr) {
+ myErrorStatus=200;
+ return;
+ }
+ }
+ //
+ // Images/Origins
+ aNbF=aMPKLF.Extent();
+ for (i=1; i<=aNbF; ++i) {
+ const TopTools_ListOfShape& aLSDF=aMPKLF(i);
+ aNbSDF=aLSDF.Extent();
+ if (!aNbSDF) {
+ myErrorStatus=4; // it must not be
+ }
+ //
+ if (aNbSDF==1) {
+ continue;
+ }
+ //
+ const TopoDS_Shape& aS1=aLSDF.First();
+ //
+ if (aType==TopAbs_EDGE) {
+ const TopoDS_Edge& aE1=*((TopoDS_Edge*)&aS1);
+ bDegenerated=BRep_Tool::Degenerated(aE1);
+ if (bDegenerated) {
+ continue;
+ }
+ }
+ //
+ myImages.Bind(aS1, aLSDF);
+ //
+ // origins
+ aItLS.Initialize(aLSDF);
+ for (; aItLS.More(); aItLS.Next()) {
+ const TopoDS_Shape& aFSD=aItLS.Value();
+ if (!myOrigins.IsBound(aFSD)) {
+ myOrigins.Bind(aFSD, aS1);
+ }
+ }
+ }// for (i=1; i<=aNbF; ++i)
+}
+//=======================================================================
+//function : FacePassKey
+//purpose :
+//=======================================================================
+void GeomAlgoAPI_GlueDetector::FacePassKey(const TopoDS_Face& aF,
+ GEOMAlgo_PassKeyShape& aPK)
+{
+ Standard_Integer i, aNbE;
+ TopoDS_Shape aER;
+ TopTools_ListOfShape aLE;
+ TopTools_IndexedMapOfShape aME;
+ //
+ TopExp::MapShapes(aF, TopAbs_EDGE, aME);
+ //
+ aNbE=aME.Extent();
+ for (i=1; i<=aNbE; ++i) {
+ const TopoDS_Shape& aE=aME(i);
+ //
+ const TopoDS_Edge& aEE=*((TopoDS_Edge*)&aE);
+ if (BRep_Tool::Degenerated(aEE)) {
+ continue;
+ }
+ //
+ if (myOrigins.IsBound(aE)) {
+ aER=myOrigins.Find(aE);
+ }
+ else {
+ aER=aE;
+ }
+ aLE.Append(aER);
+ }
+ aPK.SetShapes(aLE);
+}
+//=======================================================================
+//function : EdgePassKey
+//purpose :
+//=======================================================================
+void GeomAlgoAPI_GlueDetector::EdgePassKey(const TopoDS_Edge& aE,
+ GEOMAlgo_PassKeyShape& aPK)
+{
+ TopAbs_Orientation aOr;
+ TopoDS_Shape aVR;
+ TopoDS_Iterator aIt;
+ TopTools_ListOfShape aLV;
+ //
+ aIt.Initialize(aE);
+ for (; aIt.More(); aIt.Next()) {
+ const TopoDS_Shape& aV=aIt.Value();
+ aOr=aV.Orientation();
+ if (aOr==TopAbs_FORWARD || aOr==TopAbs_REVERSED) {
+ if (myOrigins.IsBound(aV)) {
+ aVR=myOrigins.Find(aV);
+ }
+ else {
+ aVR=aV;
+ }
+ aLV.Append(aVR);
+ }
+ }
+ //
+ aPK.SetShapes(aLV);
+}
+//=======================================================================
+//function : CheckDetected
+//purpose :
+//=======================================================================
+void GeomAlgoAPI_GlueDetector::CheckDetected()
+{
+ TopoDS_Iterator aItA;
+ TopExp_Explorer aExp;
+ TopTools_ListOfShape aLV;
+ TopTools_MapOfShape aMFence;
+ TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
+ TopTools_IndexedDataMapOfShapeListOfShape aMVE, aMEV;
+ //
+ // 1. aMVE, aMEV
+ TopExp::MapShapesAndAncestors(myArgument, TopAbs_VERTEX, TopAbs_EDGE, aMVE);
+ //
+ aExp.Init(myArgument, TopAbs_EDGE);
+ for (; aExp.More(); aExp.Next()) {
+ const TopoDS_Shape& aE=aExp.Current();
+ //
+ aLV.Clear();
+ aMFence.Clear();
+ aItA.Initialize(aE);
+ for (; aItA.More(); aItA.Next()) {
+ const TopoDS_Shape& aV=aItA.Value();
+ if (aMFence.Add(aV)) {
+ aLV.Append(aV);
+ }
+ }
+ //
+ aMEV.Add(aE, aLV);
+ }
+ // 2. Checking
+ aItIm.Initialize(myImages);
+ for (; aItIm.More(); aItIm.Next()) {
+ //const TopoDS_Shape& aV=aItIm.Key();
+ const TopTools_ListOfShape& aLVSD=aItIm.Value();
+ CheckDetected(aLVSD, aMVE, aMEV);
+ }
+}
+//=======================================================================
+//function : CheckDetected
+//purpose :
+//=======================================================================
+void GeomAlgoAPI_GlueDetector::CheckDetected
+ (const TopTools_ListOfShape& aLVSD,
+ const TopTools_IndexedDataMapOfShapeListOfShape& aMVE,
+ const TopTools_IndexedDataMapOfShapeListOfShape& aMEV)
+{
+ Standard_Integer aNbVSD, iRet;
+ TopExp_Explorer aExp, aExpA;
+ TopTools_MapOfShape aMFence, aMVSD;
+ TopTools_ListOfShape aLV;
+ TopTools_ListIteratorOfListOfShape aItLS;
+ //
+ myErrorStatus=0;
+ //
+ aNbVSD=aLVSD.Extent();
+ if (aNbVSD < 2) {
+ return ;
+ }
+ //
+ aItLS.Initialize(aLVSD);
+ for (; aItLS.More(); aItLS.Next()) {
+ const TopoDS_Shape& aVSD=aItLS.Value();
+ aMVSD.Add(aVSD);
+ }
+ //
+ aItLS.Initialize(aLVSD);
+ for (; aItLS.More(); aItLS.Next()) {
+ const TopoDS_Shape& aVSD=aItLS.Value();
+ //
+ iRet=CheckAncesstors(aVSD, aMVSD, aMVE, aMEV, myStickedShapes);
+ if (iRet) {
+ // Sticked shapes detected
+ myWarningStatus=2;
+ }
+ }
+}
+//=======================================================================
+//function : CheckAncesstors
+//purpose :
+//=======================================================================
+Standard_Integer CheckAncesstors
+ (const TopoDS_Shape& aVSD,
+ const TopTools_MapOfShape& aMVSD,
+ const TopTools_IndexedDataMapOfShapeListOfShape& aMVE,
+ const TopTools_IndexedDataMapOfShapeListOfShape& aMEV,
+ TopTools_IndexedDataMapOfShapeListOfShape& aMEVZ)
+{
+ TopTools_ListOfShape *pLE, *pLV, *pLVZ;
+ Standard_Integer iRet, aNbVX;
+ TopTools_ListIteratorOfListOfShape aItLE, aItLV;
+ TopTools_MapOfShape aMFence;
+ TopTools_ListOfShape aLVX;
+ //
+ iRet=0;
+ //
+ pLE=const_cast<TopTools_IndexedDataMapOfShapeListOfShape&>(aMVE).ChangeSeek(aVSD);
+ if (!pLE) {
+ return iRet;
+ }
+ aItLE.Initialize(*pLE);
+ for (; aItLE.More(); aItLE.Next()) {
+ const TopoDS_Shape& aE=aItLE.Value();
+ //
+ pLV=const_cast<TopTools_IndexedDataMapOfShapeListOfShape&>(aMEV).ChangeSeek(aE);
+ if (!pLV) {
+ continue; // it should be not so
+ }
+ aLVX.Clear();
+ aItLV.Initialize(*pLV);
+ for (; aItLV.More(); aItLV.Next()) {
+ const TopoDS_Shape& aV=aItLV.Value();
+ if (!aV.IsSame(aVSD)) {
+ if (aMVSD.Contains(aV)) {
+ if (aMFence.Add(aV)) {
+ aLVX.Append(aV);
+ }
+ }
+ }
+ }
+ //
+ aNbVX=aLVX.Extent();
+ if (!aNbVX) {
+ continue;
+ }
+ //
+ iRet=1;
+ //
+ pLVZ=aMEVZ.ChangeSeek(aE);
+ if (!pLVZ) {
+ aMEVZ.Add(aE, aLVX);
+ }
+ else {
+ TopTools_ListOfShape& aLVZ=*pLVZ;
+ aLVZ.Append(aLVX);
+ }
+ }
+ //
+ return iRet;
+}
\ No newline at end of file
--- /dev/null
+// Copyright (C) 2014-2020 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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef GEOMALGOAPI_GLUEDETECTOR_H_
+#define GEOMALGOAPI_GLUEDETECTOR_H_
+
+#include <GeomAlgoAPI.h>
+#include <Standard.hxx>
+#include <Standard_Macro.hxx>
+
+#include <TopAbs_ShapeEnum.hxx>
+
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
+
+#include <GeomAlgoAPI_GluerAlgo.h>
+#include <GeomAlgoAPI_Algo.h>
+#include <GEOMAlgo_PassKeyShape.hxx>
+
+//=======================================================================
+//function : GEOMAlgoAPI_GlueDetector
+//purpose :
+//=======================================================================
+class GeomAlgoAPI_GlueDetector : public GeomAlgoAPI_GluerAlgo,
+ public GeomAlgoAPI_Algo
+{
+public:
+ GEOMALGOAPI_EXPORT
+ GeomAlgoAPI_GlueDetector();
+
+ GEOMALGOAPI_EXPORT virtual
+ ~GeomAlgoAPI_GlueDetector();
+
+ GEOMALGOAPI_EXPORT virtual
+ void Perform() ;
+
+ GEOMALGOAPI_EXPORT
+ const TopTools_IndexedDataMapOfShapeListOfShape& StickedShapes();
+
+protected:
+ GEOMALGOAPI_EXPORT
+ void DetectVertices() ;
+
+ GEOMALGOAPI_EXPORT
+ void DetectEdges() ;
+
+ GEOMALGOAPI_EXPORT
+ void DetectFaces() ;
+
+ GEOMALGOAPI_EXPORT
+ void DetectShapes(const TopAbs_ShapeEnum aType) ;
+
+ GEOMALGOAPI_EXPORT
+ void EdgePassKey(const TopoDS_Edge& aE,
+ GEOMAlgo_PassKeyShape& aPK) ;
+
+ GEOMALGOAPI_EXPORT
+ void FacePassKey(const TopoDS_Face& aF,
+ GEOMAlgo_PassKeyShape& aPK) ;
+
+ GEOMALGOAPI_EXPORT
+ void CheckDetected();
+ //
+ GEOMALGOAPI_EXPORT
+ void CheckDetected
+ (const TopTools_ListOfShape& aLVSD,
+ const TopTools_IndexedDataMapOfShapeListOfShape& aMVE,
+ const TopTools_IndexedDataMapOfShapeListOfShape& aMEV);
+
+
+ protected:
+ TopTools_IndexedDataMapOfShapeListOfShape myStickedShapes;
+
+};
+#endif
--- /dev/null
+// Copyright (C) 2014-2020 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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <GeomAlgoAPI_GluerAlgo.h>
+#include <IntTools_Context.hxx>
+
+//=======================================================================
+//function : GeomAlgoAPI_GluerAlgo
+//purpose :
+//=======================================================================
+GeomAlgoAPI_GluerAlgo::GeomAlgoAPI_GluerAlgo()
+{
+ myTolerance=0.0001;
+ myCheckGeometry=Standard_True;
+}
+//=======================================================================
+//function : ~GeomAlgoAPI_GluerAlgo
+//purpose :
+//=======================================================================
+GeomAlgoAPI_GluerAlgo::~GeomAlgoAPI_GluerAlgo()
+{
+}
+//=======================================================================
+//function : SetArgument
+//purpose :
+//=======================================================================
+void GeomAlgoAPI_GluerAlgo::SetArgument(const TopoDS_Shape& theShape)
+{
+ myArgument=theShape;
+}
+//=======================================================================
+//function : Argument
+//purpose :
+//=======================================================================
+const TopoDS_Shape& GeomAlgoAPI_GluerAlgo::Argument()const
+{
+ return myArgument;
+}
+//=======================================================================
+//function : SetTolerance
+//purpose :
+//=======================================================================
+void GeomAlgoAPI_GluerAlgo::SetTolerance(const Standard_Real aT)
+{
+ myTolerance=aT;
+}
+//=======================================================================
+//function : Tolerance
+//purpose :
+//=======================================================================
+Standard_Real GeomAlgoAPI_GluerAlgo::Tolerance()const
+{
+ return myTolerance;
+}
+
+//=======================================================================
+//function : SetCheckGeometry
+//purpose :
+//=======================================================================
+void GeomAlgoAPI_GluerAlgo::SetCheckGeometry(const Standard_Boolean aFlag)
+{
+ myCheckGeometry=aFlag;
+}
+//=======================================================================
+//function : CheckGeometry
+//purpose :
+//=======================================================================
+Standard_Boolean GeomAlgoAPI_GluerAlgo::CheckGeometry() const
+{
+ return myCheckGeometry;
+}
+//=======================================================================
+//function : SetContext
+//purpose :
+//=======================================================================
+void GeomAlgoAPI_GluerAlgo::SetContext(const Handle(IntTools_Context)& theContext)
+{
+ myContext=theContext;
+}
+//=======================================================================
+//function : Context
+//purpose :
+//=======================================================================
+const Handle(IntTools_Context)& GeomAlgoAPI_GluerAlgo::Context()
+{
+ return myContext;
+}
+//=======================================================================
+//function : Images
+//purpose :
+//=======================================================================
+const TopTools_DataMapOfShapeListOfShape& GeomAlgoAPI_GluerAlgo::Images()const
+{
+ return myImages;
+}
+//=======================================================================
+//function : Origins
+//purpose :
+//=======================================================================
+const TopTools_DataMapOfShapeShape& GeomAlgoAPI_GluerAlgo::Origins()const
+{
+ return myOrigins;
+}
+//=======================================================================
+//function : Clear
+//purpose :
+//=======================================================================
+void GeomAlgoAPI_GluerAlgo::Clear()
+{
+ myImages.Clear();
+ myOrigins.Clear();
+}
+//=======================================================================
+//function : Perform
+//purpose :
+//=======================================================================
+void GeomAlgoAPI_GluerAlgo::Perform()
+{
+ if (myContext.IsNull()) {
+ myContext=new IntTools_Context;
+ }
+}
--- /dev/null
+// Copyright (C) 2014-2020 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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// 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
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef GEOMALGOAPI_GLUERALGO_H_
+#define GEOMALGOAPI_GLUERALGO_H_
+
+#include <GeomAlgoAPI.h>
+#include <Standard_Macro.hxx>
+#include <TopoDS_Shape.hxx>
+#include <Standard_Real.hxx>
+#include <Standard_Boolean.hxx>
+#include <IntTools_Context.hxx>
+#include <TopTools_DataMapOfShapeListOfShape.hxx>
+#include <TopTools_DataMapOfShapeShape.hxx>
+
+//=======================================================================
+//class : GEOMAlgo_GluerAlgo
+//purpose :
+//=======================================================================
+class GeomAlgoAPI_GluerAlgo {
+public:
+
+ GEOMALGOAPI_EXPORT
+ GeomAlgoAPI_GluerAlgo();
+
+ GEOMALGOAPI_EXPORT
+ virtual ~GeomAlgoAPI_GluerAlgo();
+
+ GEOMALGOAPI_EXPORT
+ virtual void SetArgument(const TopoDS_Shape& theShape) ;
+
+ GEOMALGOAPI_EXPORT
+ const TopoDS_Shape& Argument() const;
+
+ GEOMALGOAPI_EXPORT
+ void SetTolerance(const Standard_Real aT) ;
+
+ GEOMALGOAPI_EXPORT
+ Standard_Real Tolerance() const;
+
+ GEOMALGOAPI_EXPORT
+ void SetCheckGeometry(const Standard_Boolean aFlag) ;
+
+ GEOMALGOAPI_EXPORT
+ Standard_Boolean CheckGeometry() const;
+
+ GEOMALGOAPI_EXPORT
+ virtual void Perform() ;
+
+ GEOMALGOAPI_EXPORT
+ virtual void Clear() ;
+
+ GEOMALGOAPI_EXPORT
+ void SetContext(const Handle(IntTools_Context)&) ;
+
+ GEOMALGOAPI_EXPORT
+ const Handle(IntTools_Context)& Context() ;
+
+ GEOMALGOAPI_EXPORT
+ const TopTools_DataMapOfShapeListOfShape& Images() const;
+
+ GEOMALGOAPI_EXPORT
+ const TopTools_DataMapOfShapeShape& Origins() const;
+
+protected:
+ TopoDS_Shape myArgument;
+ Standard_Real myTolerance;
+ Standard_Boolean myCheckGeometry;
+ Handle(IntTools_Context) myContext;
+ TopTools_DataMapOfShapeListOfShape myImages;
+ TopTools_DataMapOfShapeShape myOrigins;
+
+private:
+};
+#endif
Test2488.py
Test18451.py
Test19031.py
- Test19990_1.py
- Test19990_2.py
- Test20167.py
)
//********************************************************************
ModuleBase_ListView::ModuleBase_ListView(QWidget* theParent, const QString& theObjectName,
- const QString& theToolTip)
+ const QString& theToolTip, bool theAllowCopyDelete)
+: myAllowCopyDelete(theAllowCopyDelete)
{
myListControl = new CustomListWidget(theParent);
myListControl->setObjectName(theObjectName);
myListControl->setToolTip(theToolTip);
myListControl->setSelectionMode(QAbstractItemView::ExtendedSelection);
-
- myCopyAction = ModuleBase_Tools::createAction(QIcon(":pictures/copy.png"), tr("Copy"),
+ if(myAllowCopyDelete)
+ {
+
+ myCopyAction = ModuleBase_Tools::createAction(QIcon(":pictures/copy.png"), tr("Copy"),
theParent, this, SLOT(onCopyItem()));
- myCopyAction->setShortcut(QKeySequence::Copy);
- myCopyAction->setEnabled(false);
- myListControl->addAction(myCopyAction);
-
- myDeleteAction = ModuleBase_Tools::createAction(QIcon(":pictures/delete.png"), tr("Delete"),
+ myCopyAction->setShortcut(QKeySequence::Copy);
+ myCopyAction->setEnabled(false);
+ myListControl->addAction(myCopyAction);
+ myDeleteAction = ModuleBase_Tools::createAction(QIcon(":pictures/delete.png"), tr("Delete"),
theParent, this, SIGNAL(deleteActionClicked()));
- myDeleteAction->setEnabled(false);
- myListControl->addAction(myDeleteAction);
-
+ myDeleteAction->setEnabled(false);
+ myListControl->addAction(myDeleteAction);
+ }
myListControl->setContextMenuPolicy(Qt::ActionsContextMenu);
connect(myListControl, SIGNAL(itemSelectionChanged()), SLOT(onListSelection()));
connect(myListControl, SIGNAL(activated()), this, SIGNAL(listActivated()));
void ModuleBase_ListView::onListSelection()
{
QList<QListWidgetItem*> aItems = myListControl->selectedItems();
- myCopyAction->setEnabled(!aItems.isEmpty());
- myDeleteAction->setEnabled(!aItems.isEmpty());
+
+ if( myAllowCopyDelete )
+ {
+ myCopyAction->setEnabled(!aItems.isEmpty());
+ myDeleteAction->setEnabled(!aItems.isEmpty());
+ }
}
//********************************************************************
public:
/// Constructor
ModuleBase_ListView(QWidget* theParent = 0, const QString& theObjectName = QString(),
- const QString& theToolTip = QString());
+ const QString& theToolTip = QString(), bool theAllowCopyDelete = true);
/// Destructor
virtual ~ModuleBase_ListView() {}
QAction* myCopyAction; ///< A copy action for pop-up menu in a list control
QAction* myDeleteAction; ///< A delete action for pop-up menu in a list control
+ bool myAllowCopyDelete; // Allow copy or delet items
};
#endif
from FeaturesAPI import addFillet, addChamfer
from FeaturesAPI import addFusionFaces
from FeaturesAPI import measureLength, measureDistance, measureRadius, measureAngle
+from FeaturesAPI import getDuplicatedFaces
from FeaturesAPI import addRemoveResults
from FeaturesAPI import addCopy, addImportResult
from FeaturesAPI import addDefeaturing