ADD_SUBDIRECTORY (src/XGUI)
ADD_SUBDIRECTORY (src/ExchangePlugin)
ADD_SUBDIRECTORY (src/GeomValidators)
+ADD_SUBDIRECTORY (src/ViewFilters)
ADD_SUBDIRECTORY (src/InitializationPlugin)
ADD_SUBDIRECTORY (src/ParametersPlugin)
ADD_SUBDIRECTORY (src/PythonAddons)
@ALL_SOLVERS@
-->
<plugin library="GeomValidators"/>
+ <plugin library="ViewFilters"/>
<plugin library="DFBrowser" internal="true"/>
<!--
<plugin library="SamplePanelPlugin" configuration="plugin-SamplePanel.xml"/>
Model_FeatureValidator.h
Model_AttributeValidator.h
Model_SelectionNaming.h
+ Model_ViewFilter.h
)
SET(PROJECT_SOURCES
Model_FeatureValidator.cpp
Model_AttributeValidator.cpp
Model_SelectionNaming.cpp
+ Model_ViewFilter.cpp
)
SET(PROJECT_LIBRARIES
#include <Model_Application.h>
#include <Model_Events.h>
#include <Model_Validator.h>
+#include <Model_ViewFilter.h>
#include <ModelAPI_Events.h>
#include <Events_Loop.h>
#include <Events_InfoMessage.h>
return aFactory;
}
+ModelAPI_FiltersFactory* Model_Session::filters()
+{
+ static Model_FiltersFactory* aFactory = new Model_FiltersFactory;
+ return aFactory;
+}
+
int Model_Session::transactionID()
{
return ROOT_DOC->transactionID();
/// Returns the validators factory: the only one instance per application
MODEL_EXPORT virtual ModelAPI_ValidatorsFactory* validators();
+ /// Returns the filters factory: the only one instance per application
+ MODEL_EXPORT virtual ModelAPI_FiltersFactory* filters();
+
/// Sets the flag to check modifications outside the transaction or not
void setCheckTransactions(const bool theCheck)
{
--- /dev/null
+// Copyright (C) 2014-2017 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<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "Model_ViewFilter.h"
+
+#include <Events_InfoMessage.h>
+
+
+void Model_FiltersFactory::registerFilter(const std::string& theID, ModelAPI_ViewFilter* theFilter)
+{
+ if (myFilters.find(theID) != myFilters.end()) {
+ Events_InfoMessage("Model_ViewFilter", "Filter %1 is already registered").arg(theID).send();
+ }
+ else {
+ myFilters[theID] = FilterPtr(theFilter);
+ }
+}
+
+/// Returns list of filters for the given shape type
+/// \param theType a shape type
+std::list<FilterPtr> Model_FiltersFactory::filtersForShapeType(GeomAPI_Shape::ShapeType theType)
+{
+ std::list<FilterPtr> aResult;
+ std::map<std::string, FilterPtr>::const_iterator aIt;
+ std::list<int> aTypes;
+ std::list<int>::const_iterator aTIt;
+ for (aIt = myFilters.cbegin(); aIt != myFilters.cend(); aIt++) {
+ aTypes = aIt->second->shapeTypes();
+ for (aTIt = aTypes.cbegin(); aTIt != aTypes.cend(); aTIt++) {
+ if ((*aTIt) == theType) {
+ aResult.push_back(aIt->second);
+ break;
+ }
+ }
+ }
+ return aResult;
+}
--- /dev/null
+#pragma once
+// Copyright (C) 2014-2017 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<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef Model_ViewFilter_H_
+#define Model_ViewFilter_H_
+
+#include "Model.h"
+
+#include <ModelAPI_ViewFilter.h>
+
+#include <map>
+
+
+/**\class Model_ValidatorsFactory
+* \ingroup DataModel
+* \brief Manages registering of filters
+*/
+class Model_FiltersFactory : public ModelAPI_FiltersFactory
+{
+public:
+ /// Register an instance of a filter
+ /// \param theID
+ virtual void registerFilter(const std::string& theID, ModelAPI_ViewFilter* theFilter);
+
+ /// Returns list of filters for the given shape type
+ /// \param theType a shape type
+ virtual std::list<FilterPtr> filtersForShapeType(GeomAPI_Shape::ShapeType theType);
+
+protected:
+ /// Get instance from Session
+ Model_FiltersFactory() {}
+
+private:
+ std::map<std::string, FilterPtr> myFilters; ///< map from ID to registered filters
+
+ friend class Model_Session;
+};
+
+
+#endif
\ No newline at end of file
ModelAPI_Tools.h
ModelAPI_Validator.h
ModelAPI_Entity.h
+ ModelAPI_ViewFilter.h
)
SET(PROJECT_SOURCES
class ModelAPI_Plugin;
class ModelAPI_Document;
class ModelAPI_ValidatorsFactory;
+class ModelAPI_FiltersFactory;
/**\class ModelAPI_Session
* \ingroup DataModel
/// Returns the validators factory: the only one instance per application
virtual ModelAPI_ValidatorsFactory* validators() = 0;
+ /// Returns the filters factory: the only one instance per application
+ virtual ModelAPI_FiltersFactory* filters() = 0;
+
/// To virtually destroy the fields of successors
virtual ~ModelAPI_Session()
{
--- /dev/null
+// Copyright (C) 2014-2017 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<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef ModelAPI_ViewFilter_H_
+#define ModelAPI_ViewFilter_H_
+
+#include "ModelAPI.h"
+
+#include <GeomAPI_Shape.h>
+
+#include <list>
+
+
+/**\class ModelAPI_ViewFilter
+* \ingroup DataModel
+* \brief An interface class for parameters of filters definition
+*/
+class ModelAPI_FilterParameter
+{
+public:
+ virtual ~ModelAPI_FilterParameter() {}
+};
+
+typedef std::shared_ptr<ModelAPI_FilterParameter> FilterParamPtr;
+
+/**\class ModelAPI_ViewFilter
+* \ingroup DataModel
+* \brief An interface class for filter objects
+*/
+class ModelAPI_ViewFilter
+{
+public:
+
+ /// Returns true if the given shape is accepted by filter
+ /// \param theShape the given shape
+ virtual bool isOk(const GeomShapePtr& theShape) const = 0;
+
+ /// Returns list of supported types of shapes (see GeomAPI_Shape::ShapeType)
+ virtual std::list<int> shapeTypes() const = 0;
+
+ /// Set parameter for the filter
+ virtual void setParameter(const FilterParamPtr& theParam) {}
+
+ /// Returns name of the filter to represent it in GUI
+ virtual std::string name() const = 0;
+};
+
+typedef std::shared_ptr<ModelAPI_ViewFilter> FilterPtr;
+
+
+/**\class ModelAPI_ValidatorsFactory
+* \ingroup DataModel
+* \brief Manages registering of filters
+*/
+class ModelAPI_FiltersFactory
+{
+public:
+ /// Register an instance of a filter
+ /// \param theID
+ virtual void registerFilter(const std::string& theID, ModelAPI_ViewFilter* theFilter) = 0;
+
+ /// Returns list of filters for the given shape type
+ /// \param theType a shape type
+ virtual std::list<FilterPtr> filtersForShapeType(GeomAPI_Shape::ShapeType theType) = 0;
+
+protected:
+ /// Get instance from Session
+ ModelAPI_FiltersFactory() {}
+};
+
+typedef std::shared_ptr<ModelAPI_FiltersFactory> FilterFactoryPtr;
+
+#endif
\ No newline at end of file
const Config_WidgetAPI* theData)
: ModuleBase_WidgetSelector(theParent, theWorkshop, theData),
myIsSetSelectionBlocked(false), myCurrentHistoryIndex(-1),
- myIsFirst(true)
+ myIsFirst(true), myFiltersWgt(0)
{
std::string aPropertyTypes = theData->getProperty("type_choice");
QString aTypesStr = aPropertyTypes.c_str();
myTypeCtrl->setValue(myDefMode.c_str());
}
}
+ if (myFiltersWgt)
+ myFiltersWgt->setSelectionType(myTypeCtrl->textValue());
}
ModuleBase_WidgetMultiSelector::~ModuleBase_WidgetMultiSelector()
{
// Clear current selection in order to avoid updating of object browser with obsolete indexes
// which can appear because of results deletetion after changing a type of selection
+ QString aSelectionType = myTypeCtrl->textValue();
+ if (myFiltersWgt)
+ myFiltersWgt->setSelectionType(aSelectionType);
+
QList<ModuleBase_ViewerPrsPtr> aEmptyList;
myWorkshop->setSelected(aEmptyList);
std::string aType = anAttribute->attributeType();
if (aType == ModelAPI_AttributeSelectionList::typeId()) {
AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID());
- aSelectionListAttr->setSelectionType(myTypeCtrl->textValue().toStdString());
+ aSelectionListAttr->setSelectionType(aSelectionType.toStdString());
}
// clear attribute values
#include "ModuleBase_IModule.h"
#include "ModuleBase_IPropertyPanel.h"
#include "ModuleBase_PageWidget.h"
+#include "ModuleBase_WidgetSelector.h"
#include <QLayout>
#include <QPushButton>
#include <QGroupBox>
#include <QDialog>
+static int SelectionType = 0;
+
ModuleBase_FilterStarter::ModuleBase_FilterStarter(const std::string& theFeature,
QWidget* theParent, ModuleBase_IWorkshop* theWorkshop)
: QWidget(theParent),
void ModuleBase_FilterStarter::onFiltersLaunch()
{
- // ModuleBase_OperationFiltering* aOperation = new ModuleBase_OperationFiltering(myWorkshop, this);
- // myWorkshop->processLaunchOperation(aOperation);
+ SelectionType = myShapeType;
+ ModuleBase_WidgetSelector* aSelector = dynamic_cast<ModuleBase_WidgetSelector*>(parent());
+ aSelector->storeValue(); // Store values defined by user
ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
(myWorkshop->module()->createOperation(myFeatureName));
myWorkshop->processLaunchOperation(aFOperation);
}
+void ModuleBase_FilterStarter::setSelectionType(const QString& theType)
+{
+ QString aType = theType.toUpper();
+ if ((aType == "VERTEX") || (aType == "VERTICES"))
+ myShapeType = GeomAPI_Shape::VERTEX;
+ else if ((aType == "EDGE") || (aType == "EDGES"))
+ myShapeType = GeomAPI_Shape::EDGE;
+ else if ((aType == "WIRE") || (aType == "WIRES"))
+ myShapeType = GeomAPI_Shape::WIRE;
+ else if ((aType == "FACE") || (aType == "FACES"))
+ myShapeType = GeomAPI_Shape::FACE;
+ else if ((aType == "SHELL") || (aType == "SHELLS"))
+ myShapeType = GeomAPI_Shape::SHELL;
+ else if ((aType == "SOLID") || (aType == "SOLIDS"))
+ myShapeType = GeomAPI_Shape::SOLID;
+ else if ((aType == "COMPSOLID") || (aType == "COMPSOLIDS"))
+ myShapeType = GeomAPI_Shape::COMPSOLID;
+ else if ((aType == "COMPOUND") || (aType == "COMPOUNDS"))
+ myShapeType = GeomAPI_Shape::COMPOUND;
+ else
+ myShapeType = GeomAPI_Shape::SHAPE;
+}
//*****************************************************************************
ModuleBase_WidgetSelectionFilter::ModuleBase_WidgetSelectionFilter(QWidget* theParent,
ModuleBase_IWorkshop* theWorkshop, const Config_WidgetAPI* theData)
: ModuleBase_ModelWidget(theParent, theData),
- myWorkshop(theWorkshop)
+ myWorkshop(theWorkshop), mySelectionType(SelectionType)
{
QVBoxLayout* aMainLayout = new QVBoxLayout(this);
ModuleBase_Tools::adjustMargins(aMainLayout);
~ModuleBase_FilterStarter() {}
+ void setSelectionType(const QString& theType);
+
private slots:
void onFiltersLaunch();
QLabel* myFilterLbl;
QLabel* myModifyLbl;
-
+ int myShapeType;
};
QComboBox* myFiltersCombo;
QGroupBox* myFiltersGroup;
+
+ int mySelectionType;
};
#endif
\ No newline at end of file
--- /dev/null
+## Copyright (C) 2014-2017 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<mailto:webmaster.salome@opencascade.com>
+##
+
+INCLUDE(Common)
+
+SET(PROJECT_HEADERS
+ ViewFilters.h
+ ViewFilters_Plugin.h
+ ViewFilters_HorizontalPlane.h
+ ViewFilters_VerticalPlane.h
+)
+
+SET(PROJECT_SOURCES
+ ViewFilters_Plugin.cpp
+ ViewFilters_HorizontalPlane.cpp
+ ViewFilters_VerticalPlane.cpp
+)
+
+SET(PROJECT_LIBRARIES
+ ModelAPI
+ Events
+ Config
+ GeomAPI
+)
+
+ADD_DEFINITIONS(-DVIEWFILTERS_EXPORTS ${OpenCASCADE_DEFINITIONS})
+ADD_LIBRARY(ViewFilters SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+TARGET_LINK_LIBRARIES(ViewFilters ${PROJECT_LIBRARIES})
+
+INCLUDE_DIRECTORIES(
+ ${OpenCASCADE_INCLUDE_DIR}
+ ${PROJECT_SOURCE_DIR}/src/ModelAPI
+ ${PROJECT_SOURCE_DIR}/src/Config
+ ${PROJECT_SOURCE_DIR}/src/Events
+ ${PROJECT_SOURCE_DIR}/src/GeomAPI
+ ${PROJECT_SOURCE_DIR}/src/GeomDataAPI
+)
+
+INSTALL(TARGETS ViewFilters DESTINATION ${SHAPER_INSTALL_PLUGIN_FILES})
--- /dev/null
+// Copyright (C) 2014-2017 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<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef VIEWFILTERS_H
+#define VIEWFILTERS_H
+
+#if defined VIEWFILTERS_EXPORTS
+#if defined WIN32
+#define VIEWFILTERS_EXPORT __declspec( dllexport )
+#else
+#define VIEWFILTERS_EXPORT
+#endif
+#else
+#if defined WIN32
+#define VIEWFILTERS_EXPORT __declspec( dllimport )
+#else
+#define VIEWFILTERS_EXPORT
+#endif
+#endif
+
+#endif
--- /dev/null
+// Copyright (C) 2014-2017 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<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "ViewFilters_HorizontalPlane.h"
+
+#include <GeomAPI_Face.h>
+#include <GeomAPI_Pln.h>
+
+bool ViewFilters_HorizontalPlane::isOk(const GeomShapePtr& theShape) const
+{
+ if (!theShape->isFace())
+ return false;
+
+ if (!theShape->isPlanar())
+ return false;
+ GeomFacePtr aFace = std::dynamic_pointer_cast<GeomAPI_Face>(theShape);
+
+ GeomPlanePtr aPlane = aFace->getPlane();
+ GeomDirPtr aDir = aPlane->direction();
+ if (aDir->isParallel(GeomDirPtr(new GeomAPI_Dir(0,0,1))))
+ return true;
+ return false;
+}
+
+std::list<int> ViewFilters_HorizontalPlane::shapeTypes() const
+{
+ std::list<int> aList;
+ aList.push_back(GeomAPI_Shape::FACE);
+ return aList;
+}
--- /dev/null
+// Copyright (C) 2014-2017 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<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef VIEWFILTERS_HORIZONTALPLANE_H_
+#define VIEWFILTERS_HORIZONTALPLANE_H_
+
+#include "ViewFilters.h"
+
+#include <ModelAPI_ViewFilter.h>
+
+class ViewFilters_HorizontalPlane : public ModelAPI_ViewFilter
+{
+public:
+ virtual bool isOk(const GeomShapePtr& theShape) const;
+
+ /// Returns list of supported types of shapes (see GeomAPI_Shape::ShapeType)
+ virtual std::list<int> shapeTypes() const;
+
+ /// Returns name of the filter to represent it in GUI
+ virtual std::string name() const { return "Horizontal faces"; }
+};
+
+
+#endif
\ No newline at end of file
--- /dev/null
+// Copyright (C) 2014-2017 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<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "ViewFilters_Plugin.h"
+#include "ViewFilters_HorizontalPlane.h"
+#include "ViewFilters_VerticalPlane.h"
+
+#include <ModelAPI_Session.h>
+#include <ModelAPI_ViewFilter.h>
+
+// the only created instance of this plugin
+static ViewFilters_Plugin* MY_VIEWFILTERS_INSTANCE = new ViewFilters_Plugin();
+
+ViewFilters_Plugin::ViewFilters_Plugin()
+{
+ // register validators
+ SessionPtr aMgr = ModelAPI_Session::get();
+ ModelAPI_FiltersFactory* aFactory = aMgr->filters();
+ aFactory->registerFilter("HorizontalFaces", new ViewFilters_HorizontalPlane);
+ aFactory->registerFilter("VerticalFaces", new ViewFilters_VerticalPlane);
+
+ // register this plugin
+ ModelAPI_Session::get()->registerPlugin(this);
+}
+
+FeaturePtr ViewFilters_Plugin::createFeature(std::string theFeatureID)
+{
+ // feature of such kind is not found
+ return FeaturePtr();
+}
--- /dev/null
+// Copyright (C) 2014-2017 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<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef VIEWFILTERS_PLUGIN_H_
+#define VIEWFILTERS_PLUGIN_H_
+
+#include "ViewFilters.h"
+#include <ModelAPI_Plugin.h>
+#include <ModelAPI_Feature.h>
+
+/**\class GeomValidators_Plugin
+ * \ingroup Plugins
+ * \brief Interface common for any plugin: allows to use plugin by the plugins manager.
+ */
+class VIEWFILTERS_EXPORT ViewFilters_Plugin : public ModelAPI_Plugin
+{
+public:
+ /// Creates the feature object of this plugin by the feature string ID
+ virtual FeaturePtr createFeature(std::string theFeatureID);
+
+public:
+ ViewFilters_Plugin();
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2014-2017 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<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "ViewFilters_VerticalPlane.h"
+
+#include <GeomAPI_Face.h>
+#include <GeomAPI_Pln.h>
+
+bool ViewFilters_VerticalPlane::isOk(const GeomShapePtr& theShape) const
+{
+ if (!theShape->isFace())
+ return false;
+
+ if (!theShape->isPlanar())
+ return false;
+ GeomFacePtr aFace = std::dynamic_pointer_cast<GeomAPI_Face>(theShape);
+
+ GeomPlanePtr aPlane = aFace->getPlane();
+ GeomDirPtr aDir = aPlane->direction();
+ if (aDir->z() <= 1.e-7)
+ return true;
+ return false;
+}
+
+std::list<int> ViewFilters_VerticalPlane::shapeTypes() const
+{
+ std::list<int> aList;
+ aList.push_back(GeomAPI_Shape::FACE);
+ return aList;
+}
--- /dev/null
+// Copyright (C) 2014-2017 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<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef VIEWFILTERS_VERTICALPLANE_H_
+#define VIEWFILTERS_VERTICALPLANE_H_
+
+#include "ViewFilters.h"
+
+#include <ModelAPI_ViewFilter.h>
+
+class ViewFilters_VerticalPlane : public ModelAPI_ViewFilter
+{
+public:
+ virtual bool isOk(const GeomShapePtr& theShape) const;
+
+ /// Returns list of supported types of shapes (see GeomAPI_Shape::ShapeType)
+ virtual std::list<int> shapeTypes() const;
+
+ /// Returns name of the filter to represent it in GUI
+ virtual std::string name() const { return "Vertical faces"; }
+};
+
+
+#endif
\ No newline at end of file
// Exit if the selected index belongs to non active document
if (aIsRoot && (aActiveDoc != aMgr->moduleDocument()))
return;
- if ((!aIsRoot) && (aIdx.internalPointer() != aActiveDoc.get()))
- return;
// Get name of the selected index
aName = aIdx.data().toString();
#include <QAbstractItemModel>
-class Config_DataModelReader;
class XGUI_Workshop;
class ModuleBase_ITreeNode;
mySubShapesTab->setColumnWidth(0, 90);
mySubShapesTab->setColumnWidth(1, 70);
- //mySubShapesTab->setMaximumWidth(170);
- //mySubShapesTab->setMinimumHeight(300);
-
aSplitter->addWidget(mySubShapesTab);
// Type of object