FiltersPlugin_OnGeometry.h
FiltersPlugin_OnPlaneSide.h
FiltersPlugin_OppositeToEdge.h
+ FiltersPlugin_RelativeToSolid.h
)
SET(PROJECT_SOURCES
FiltersPlugin_OnGeometry.cpp
FiltersPlugin_OnPlaneSide.cpp
FiltersPlugin_OppositeToEdge.cpp
+ FiltersPlugin_RelativeToSolid.cpp
)
SET(PROJECT_LIBRARIES
TestFilter_OnPlaneSide_Face.py
TestFilter_OnPlaneSide_Plane.py
TestFilter_OppositeToEdge.py
+# TestFilter_RelativeToSolid_In.py
+# TestFilter_RelativeToSolid_Out.py
+# TestFilter_RelativeToSolid_On.py
+# TestFilter_RelativeToSolid_NotOn.py
+# TestFilter_RelativeToSolid_InAndOn.py
+# TestFilter_RelativeToSolid_OutAndOn.py
TestFilter_HorizontalFaces.py
TestFilter_VerticalFaces.py
)
#include "FiltersPlugin_OnGeometry.h"
#include "FiltersPlugin_OnPlaneSide.h"
#include "FiltersPlugin_OppositeToEdge.h"
+#include "FiltersPlugin_RelativeToSolid.h"
#include <ModelAPI_Session.h>
#include <ModelAPI_FiltersFactory.h>
aFactory->registerFilter("OnGeometry", new FiltersPlugin_OnGeometry);
aFactory->registerFilter("OnPlaneSide", new FiltersPlugin_OnPlaneSide);
aFactory->registerFilter("OppositeToEdge", new FiltersPlugin_OppositeToEdge);
+ aFactory->registerFilter("RelativeToSolid", new FiltersPlugin_RelativeToSolid);
ModelAPI_Session::get()->registerPlugin(this);
}
--- /dev/null
+// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// 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 "FiltersPlugin_RelativeToSolid.h"
+
+#include <ModelAPI_AttributeSelection.h>
+#include <ModelAPI_AttributeString.h>
+
+
+bool FiltersPlugin_RelativeToSolid::isSupported(GeomAPI_Shape::ShapeType theType) const
+{
+ return true;
+}
+
+bool FiltersPlugin_RelativeToSolid::isOk(const GeomShapePtr& theShape,
+ const ModelAPI_FiltersArgs& theArgs) const
+{
+ return false;
+}
+
+static std::string XMLRepresentation =
+"<filter id = \"RelativeToSolid\">"
+" <shape_selector id=\"RelativeToSolid__Solid\""
+" label=\"Solid:\""
+" tooltip=\"Select a solid.\""
+" shape_types=\"solids\">"
+" <validator id=\"GeomValidators_ShapeType\" parameters=\"solid\"/>"
+" </shape_selector>"
+" <switch id=\"RelativeToSolid__Location\" label=\"Algorithm:\">"
+" <case id=\"in\" title=\"In\"/>"
+" <case id=\"out\" title=\"Out\"/>"
+" <case id=\"on\" title=\"On\"/>"
+" <case id=\"noton\" title=\"Not On\"/>"
+" <case id=\"inon\" title=\"In & On\"/>"
+" <case id=\"outon\" title=\"On & Out\"/>"
+" </switch>"
+"</filter>";
+
+
+std::string FiltersPlugin_RelativeToSolid::xmlRepresentation() const
+{
+ return XMLRepresentation;
+}
+
+void FiltersPlugin_RelativeToSolid::initAttributes(ModelAPI_FiltersArgs& theArguments)
+{
+ theArguments.initAttribute("Solid", ModelAPI_AttributeSelection::typeId());
+ theArguments.initAttribute("Location", ModelAPI_AttributeString::typeId());
+}
--- /dev/null
+// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// 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 FILTERSPLUGIN_RELATIVETOSOLID_H_
+#define FILTERSPLUGIN_RELATIVETOSOLID_H_
+
+#include "FiltersPlugin.h"
+
+#include <ModelAPI_Filter.h>
+
+/**\class FiltersPlugin_RelativeToSolid
+* \ingroup DataModel
+* \brief Filter for objects inside/outside/on the selected solid
+*/
+class FiltersPlugin_RelativeToSolid : public ModelAPI_Filter
+{
+public:
+ FiltersPlugin_RelativeToSolid() : ModelAPI_Filter() {}
+
+ virtual const std::string& name() const {
+ static const std::string kName("On/In/Out a solid");
+ return kName;
+ }
+
+ /// Returns true for any type because it supports all selection types
+ virtual bool isSupported(GeomAPI_Shape::ShapeType theType) const override;
+
+ /// This method should contain the filter logic. It returns true if the given shape
+ /// is accepted by the filter.
+ /// \param theShape the given shape
+ virtual bool isOk(const GeomShapePtr& theShape,
+ const ModelAPI_FiltersArgs& theArgs) const override;
+
+ /// Returns XML string which represents GUI of the filter
+ virtual std::string xmlRepresentation() const override;
+
+ /// Initializes arguments of a filter.
+ virtual void initAttributes(ModelAPI_FiltersArgs& theArguments) override;
+};
+
+#endif
\ No newline at end of file