-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2023 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.
+// 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
#ifndef BLSURFPLUGINGUI_HypothesisCreator_H
#define BLSURFPLUGINGUI_HypothesisCreator_H
+// akl: avoid compilation warning on Linux : "_POSIX_C_SOURCE" and "_XOPEN_SOURCE" are redefined
+#ifdef _POSIX_C_SOURCE
+#undef _POSIX_C_SOURCE
+#endif
+
+#ifdef _XOPEN_SOURCE
+#undef _XOPEN_SOURCE
+#endif
+
#ifdef WIN32
#if defined BLSURFPLUGIN_GUI_EXPORTS || defined BLSURFPluginGUI_EXPORTS
#define BLSURFPLUGIN_GUI_EXPORT __declspec( dllexport )
#define BLSURFPLUGIN_GUI_EXPORT
#endif
-#ifdef WNT
+#ifdef WIN32
// E.A. : On windows with python 2.6, there is a conflict
// E.A. : between pymath.h and Standard_math.h which define
// E.A. : some same symbols : acosh, asinh, ...
class QComboBox;
class QCheckBox;
class QLineEdit;
+class QRadioButton;
class QTableWidget;
class QTreeWidget;
class QModelIndex;
class QTreeWidgetItem;
class QTableWidgetItem;
class QObject;
+class QSplitter;
+class QGridLayout;
+class QVBoxLayout;
+class QSpacerItem;
class SMESHGUI_SpinBox;
+class SMESH_NumberFilter;
class LightApp_SelectionMgr;
+class BLSURFPluginGUI_StdWidget;
+class BLSURFPluginGUI_AdvWidget;
+class StdMeshersGUI_SubShapeSelectorWdg;
// class DlgBlSurfHyp_Enforced;
// Name
TEnfVertexCoords coords;
TEnfName grpName;
};
-
+// Attractor
+struct TAttractor{
+ std::string attEntry;
+ double startSize;
+ double infDist;
+ double constDist;
+ TAttractor( const char* theAttEntry, double theStartSize, double theInfDist, double theConstDist)
+ : attEntry( theAttEntry ),
+ startSize( theStartSize ),
+ infDist( theInfDist ),
+ constDist( theConstDist )
+ {}
+ void SetToDelete() { startSize = -1; }
+ bool IsToDelete() const { return startSize < 0; }
+};
+typedef std::vector< TAttractor > TAttractorVec;
struct CompareEnfVertices
{
// Map Face Entry / InternalEnforcedVertices
typedef std::map< TEntry, bool > TFaceEntryInternalVerticesMap;
+// PreCad Face and Edge periodicity
+typedef std::vector<std::string> TPreCadPeriodicity;
+typedef std::vector< TPreCadPeriodicity > TPreCadPeriodicityVector;
+
typedef struct
{
int myTopology, myVerbosity;
int myPhysicalMesh, myGeometricMesh;
- double myAngleMeshS, myAngleMeshC, myGradation;
- double myPhySize, myGeoMin, myGeoMax, myPhyMin,myPhyMax;
- bool myAllowQuadrangles, myDecimesh,mySmpsurface,mySmpedge,mySmppoint,myEnforcedVertex,myInternalEnforcedVerticesAllFaces;
- bool myPreCADMergeEdges, myPreCADRemoveNanoEdges, myPreCADDiscardInput;
- double myPreCADEpsNano;
+ double myPhySize, myMinSize, myMaxSize;
+ bool myPhySizeRel, myMinSizeRel, myMaxSizeRel;
+ bool myUseMinSize, myUseMaxSize, myUseGradation, myUseVolumeGradation;
+ double myGradation, myVolumeGradation, myAngleMesh, myChordalError;
+ bool myAnisotropic, myOptimiseTinyEdges, myRemoveTinyEdges, myForceBadElementRemoval, myCorrectSurfaceIntersection;
+ double myAnisotropicRatio, myTinyEdgeLength, myTinyEdgeOptimisLength, myBadElementAspectRatio, myCorrectSurfaceIntersectionMaxCost;
+ bool myOptimizeMesh, myQuadraticMesh;
+ bool mySmpsurface,mySmpedge,mySmppoint,myEnforcedVertex,myInternalEnforcedVerticesAllFaces;
+ int myElementType;
+ bool myUseSurfaceProximity;
+ int myNbSurfaceProximityLayers;
+ double mySurfaceProximityRatio;
+ bool myUseVolumeProximity;
+ int myNbVolumeProximityLayers;
+ double myVolumeProximityRatio;
+ // bool myPreCADMergeEdges, myPreCADProcess3DTopology, myPreCADDiscardInput;
// bool myGMFFileMode;
std::string myGMFFileName, myInternalEnforcedVerticesAllFacesGroup;
TEnfVertexList enfVertexList;
/* TODO GROUPS
TGroupNameEnfVertexListMap groupNameEnfVertexListMap;
*/
+ TPreCadPeriodicityVector preCadPeriodicityVector;
+ QStringList hyperpatches, hyperEntries;
QString myName;
} BlsurfHypothesisData;
-
-// class BLSURFPluginGUI_ObjectReferenceParamWdg: public StdMeshersGUI_ObjectReferenceParamWdg
-// {
-// Q_OBJECT
-// public:
-// BLSURFPluginGUI_ObjectReferenceParamWdg( SUIT_SelectionFilter* filter,
-// QWidget* parent,
-// bool multiSelection=false);
-// BLSURFPluginGUI_ObjectReferenceParamWdg( MeshObjectType objType,
-// QWidget* parent,
-// bool multiSelection=false);
-// ~BLSURFPluginGUI_ObjectReferenceParamWdg();
-//
-// private:
-// void init();
-//
-// public slots:
-// void activateSelectionOnly();
-// void deactivateSelectionOnly();
-// void setActivationStatus(bool status);
-// };
-
/*!
- * \brief Class for creation of BLSURF hypotheses
+ * \brief Class for creation of MG-CADSurf hypotheses
*/
class BLSURFPLUGIN_GUI_EXPORT BLSURFPluginGUI_HypothesisCreator : public SMESHGUI_GenericHypothesisCreator
{
virtual QString type() const;
protected slots:
- void onPhysicalMeshChanged();
- void onGeometricMeshChanged();
+ void onStateChange();
+ // Advanced tab
void onAddOption();
- void onDeleteOption();
- void onChooseGMFFile();
- void onOptionChosenInPopup( QAction* );
- void onTopologyChanged( int );
+ void onChangeOptionName( int, int );
+ // Sizemap tab
void onMapGeomContentModified();
void onSmpItemClicked( QTreeWidgetItem *, int );
- void onSmpTabChanged(int);
+ void onTabChanged(int);
void onAttractorClicked(int);
void onConstSizeClicked(int);
void onAddMap();
void onRemoveMap();
void onModifyMap();
void onSetSizeMap(QTreeWidgetItem *, int);
-
+ // Enforced vertices tab
QTreeWidgetItem* addEnforcedFace(std::string theFaceEntry, std::string theFaceName);
-
- void addEnforcedVertex(QTreeWidgetItem * theFaceItem, double x=0, double y=0, double z=0,
- std::string vertexName = "", std::string geomEntry = "", std::string groupName = "");
-
+ void addEnforcedVertex(double x=0, double y=0, double z=0,
+ std::string vertexName = "",
+ std::string geomEntry = "",
+ std::string groupName = "");
void onAddEnforcedVertices();
void onRemoveEnforcedVertex();
void synchronizeCoords();
void updateEnforcedVertexValues(QTreeWidgetItem* , int );
void onSelectEnforcedVertex();
-// void deactivateSelection(QWidget*, QWidget*);
void clearEnforcedVertexWidgets();
void onInternalVerticesClicked(int);
+ // Enforced mesh tab
+ void onAddEnforcedMesh();
+ void onRemoveEnforcedMesh();
+ void onEnforcedMeshSelected();
+ void onEnfMeshTableSelected();
+ // Periodicity tab
+ void onPeriodicityByVerticesChecked(bool);
+ void onAddPeriodicity();
+ void onRemovePeriodicity();
+ void onPeriodicityTreeClicked(QTreeWidgetItem*, int);
+ void onPeriodicityContentModified();
+ // HyperPatch tab
+ void onHyPatchFaceSelection(bool);
+ void onHyPatchGroupSelection(bool);
+ void onHyPatchSelectionChanged();
+ void onHyPatchAdd();
+ void onHyPatchRemove();
private:
bool readParamsFromHypo( BlsurfHypothesisData& ) const;
bool sizeMapsValidation();
bool sizeMapValidationFromRow(int,bool displayError = true);
bool sizeMapValidationFromEntry(QString,bool displayError = true);
- GeomSelectionTools* getGeomSelectionTool();
+ GeomSelectionTools* getGeomSelectionTool() const;
GEOM::GEOM_Gen_var getGeomEngine();
- //void insertElementType( TopAbs_ShapeEnum );
- void insertElement( GEOM::GEOM_Object_var, bool modify = false );
- void insertAttractor(GEOM::GEOM_Object_var, GEOM::GEOM_Object_var, bool modify = false);
+ bool insertElement( GEOM::GEOM_Object_var, bool modify = false );
+ bool insertAttractor(GEOM::GEOM_Object_var, GEOM::GEOM_Object_var, bool modify = false);
int findRowFromEntry(QString entry);
CORBA::Object_var entryToObject(QString entry);
static LightApp_SelectionMgr* selectionMgr();
+ void avoidSimultaneousSelection(ListOfWidgets &myCustomWidgets) const;
+ void AddPreCadSequenceToVector(BlsurfHypothesisData& h_data, BLSURFPlugin::TPeriodicityList_var preCadFacePeriodicityVector, bool onFace) const;
+ void addHyPatchToTable(const QString& tags, const QString& entries);
+ bool hasGeom() const;
+
+ void addEnforcedMesh( SMESH::SMESH_IDSource_ptr mesh, const QString& groupName );
private:
- QWidget* myStdGroup;
- QLineEdit* myName;
- QComboBox* myPhysicalMesh;
- SMESHGUI_SpinBox* myPhySize;
- SMESHGUI_SpinBox* myPhyMin;
- SMESHGUI_SpinBox* myPhyMax;
- QComboBox* myGeometricMesh;
- SMESHGUI_SpinBox* myAngleMeshS;
- SMESHGUI_SpinBox* myAngleMeshC;
- SMESHGUI_SpinBox* myGeoMin;
- SMESHGUI_SpinBox* myGeoMax;
- SMESHGUI_SpinBox* myGradation;
- QCheckBox* myAllowQuadrangles;
- QCheckBox* myDecimesh;
-
- QWidget* myAdvGroup;
- QComboBox* myTopology;
- QGroupBox* myPreCADGroupBox;
- QCheckBox* myPreCADMergeEdges;
- QCheckBox* myPreCADRemoveNanoEdges;
- QCheckBox* myPreCADDiscardInput;
- SMESHGUI_SpinBox* myPreCADEpsNano;
- QSpinBox* myVerbosity;
- QTableWidget* myOptionTable;
- QLineEdit* myGMFFileName;
-// QCheckBox* myGMFFileMode;
+
+ QTabWidget* myTabWidget;
+ QWidget* myStdGroup;
+ BLSURFPluginGUI_StdWidget* myStdWidget;
+ QLineEdit* myName;
+
+ QWidget* myAdvGroup;
+ BLSURFPluginGUI_AdvWidget* myAdvWidget;
// Sizemap widgets
- QWidget *mySmpGroup;
- QTreeWidget *mySizeMapTable;
- QPushButton *addMapButton;
- QPushButton *removeMapButton;
- QPushButton *modifyMapButton;
- QTabWidget *smpTab;
- QWidget *myAttractorGroup;
- QWidget *mySmpStdGroup;
- QCheckBox *myAttractorCheck;
- QCheckBox *myConstSizeCheck;
- QGroupBox *myDistanceGroup;
-// QGroupBox *myParamsGroup;
-// QWidget *myParamsGroup;
- SMESHGUI_SpinBox *myAttSizeSpin;
- SMESHGUI_SpinBox *myAttDistSpin;
- SMESHGUI_SpinBox *myAttDistSpin2;
- SMESHGUI_SpinBox *mySmpSizeSpin;
- QLabel *myAttDistLabel;
- QLabel *myAttDistLabel2;
- QLabel *myAttSizeLabel;
+ QWidget *mySmpGroup;
+ QTreeWidget *mySizeMapTable;
+ QPushButton *addMapButton;
+ QPushButton *removeMapButton;
+ QPushButton *modifyMapButton;
+ QTabWidget *smpTab;
+ QWidget *myAttractorGroup;
+ QWidget *mySmpStdGroup;
+ QCheckBox *myAttractorCheck;
+ QCheckBox *myConstSizeCheck;
+ QGroupBox *myDistanceGroup;
+// QGroupBox *myParamsGroup;
+// QWidget *myParamsGroup;
+ SMESHGUI_SpinBox *myAttSizeSpin;
+ SMESHGUI_SpinBox *myAttDistSpin;
+ SMESHGUI_SpinBox *myAttDistSpin2;
+ SMESHGUI_SpinBox *mySmpSizeSpin;
+ QLabel *myAttDistLabel;
+ QLabel *myAttDistLabel2;
+ QLabel *myAttSizeLabel;
// Selection widgets for size maps
StdMeshersGUI_ObjectReferenceParamWdg *myGeomSelWdg1;
StdMeshersGUI_ObjectReferenceParamWdg *myGeomSelWdg2;
QWidget* myEnfGroup;
-// TODO FACE AND VERTEX SELECTION
StdMeshersGUI_ObjectReferenceParamWdg *myEnfFaceWdg;
GEOM::GEOM_Object_var myEnfFace;
StdMeshersGUI_ObjectReferenceParamWdg *myEnfVertexWdg;
GEOM::GEOM_Object_var myEnfVertex;
-// DlgBlSurfHyp_Enforced* myEnforcedVertexWidget;
QTreeWidget* myEnforcedTreeWidget;
SMESHGUI_SpinBox* myXCoord;
SMESHGUI_SpinBox* myYCoord;
SMESHGUI_SpinBox* myZCoord;
QLineEdit* myGroupName;
-// QGroupBox* makeGroupsCheck;
-// QCheckBox* myGlobalGroupName;
QPushButton* addVertexButton;
QPushButton* removeVertexButton;
QCheckBox *myInternalEnforcedVerticesAllFaces;
QLineEdit *myInternalEnforcedVerticesAllFacesGroup;
+
+ // Enforced meshes
+ QWidget* myEnfMeshGroup;
+ StdMeshersGUI_ObjectReferenceParamWdg *myEnfMeshWdg;
+ QTableWidget* myEnfMeshTableWdg;
+ QLineEdit* myEnforcedGroupName;
+ QPushButton* myAddEnfMeshButton;
+ QPushButton* myRemoveEnfMeshButton;
+
+
+
// map = entry , size map
QMap<QString, QString> mySMPMap; // Map <face entry, size>
- QMap<QString, QString> myATTMap; // Map <face entry, att. entry>
- QMap<QString, double> myDistMap; // Map <entry,distance with constant size>
- QMap<QString, double> myAttDistMap; // Map <entry, influence distance>
+ QMap<QString, TAttractorVec > myATTMap; // Map <face entry, att. entry, etc>
QMap<QString, TopAbs_ShapeEnum> mySMPShapeTypeMap;
GeomSelectionTools* GeomToolSelected;
LightApp_SelectionMgr* aSel;
- BLSURFPlugin::string_array_var myOptions, myPreCADOptions;
+ // Periodicity
+ QWidget* myPeriodicityGroup;
+ QSplitter* myPeriodicitySplitter;
+ QTreeWidget* myPeriodicityTreeWidget;
+ QWidget* myPeriodicityRightWidget;
+ QGridLayout* myPeriodicityRightGridLayout;
+ QGroupBox* myPeriodicityGroupBox1;
+ QGroupBox* myPeriodicityGroupBox2;
+ QGridLayout* aPeriodicityLayout1;
+ QGridLayout* myPeriodicityGroupBox1Layout;
+ QGridLayout* myPeriodicityGroupBox2Layout;
+ QRadioButton* myPeriodicityOnFaceRadioButton;
+ QRadioButton* myPeriodicityOnEdgeRadioButton;
+ QLabel* myPeriodicityMainSourceLabel;
+ QLabel* myPeriodicityMainTargetLabel;
+ QLabel* myPeriodicitySourceLabel;
+ QLabel* myPeriodicityTargetLabel;
+ StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicitySourceFaceWdg;
+ GEOM::GEOM_Object_var myPeriodicityFace;
+ StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityTargetFaceWdg;
+ GEOM::GEOM_Object_var myPeriodicityEdge;
+ QLabel* myPeriodicityP1SourceLabel;
+ QLabel* myPeriodicityP2SourceLabel;
+ QLabel* myPeriodicityP3SourceLabel;
+ QLabel* myPeriodicityP1TargetLabel;
+ QLabel* myPeriodicityP2TargetLabel;
+ QLabel* myPeriodicityP3TargetLabel;
+ StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP1SourceWdg;
+ StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP2SourceWdg;
+ StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP3SourceWdg;
+ StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP1TargetWdg;
+ StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP2TargetWdg;
+ StdMeshersGUI_ObjectReferenceParamWdg* myPeriodicityP3TargetWdg;
+ ListOfWidgets myPeriodicitySelectionWidgets;
+ QPushButton* myPeriodicityAddButton;
+ QPushButton* myPeriodicityRemoveButton;
+ QSpacerItem* myPeriodicityVerticalSpacer;
+
+ QTableWidget* myHyPatchTable;
+ StdMeshersGUI_SubShapeSelectorWdg* myHyPatchFaceSelector;
+ QLineEdit* myHyPatchTagsLE;
+ QPushButton* myHyPatchFaceSelBtn;
+ QPushButton* myHyPatchGroupSelBtn;
+
+ BLSURFPlugin::string_array_var myOptions, myPreCADOptions, myCustomOptions;
PyObject * main_mod;
PyObject * main_dict;
class EnforcedTreeWidgetDelegate : public QItemDelegate
{
- Q_OBJECT
+ Q_OBJECT
public:
EnforcedTreeWidgetDelegate(QObject *parent = 0);
- QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
+ QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem & option,
const QModelIndex &index) const;
void setEditorData(QWidget *editor, const QModelIndex &index) const;
const QModelIndex &index) const;
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
- const QModelIndex &index) const;
+ const QModelIndex &index) const;
bool vertexExists(QAbstractItemModel *model, const QModelIndex &index, QString value) const;
};