-// Copyright (C) 2009-2013 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2024 CEA, EDF
//
// 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 _HEXABLOCKGUI_DOCUMENTMODEL_HXX_
#define _HEXABLOCKGUI_DOCUMENTMODEL_HXX_
+#include "HEXABLOCKGUI_Export.hxx"
#include <QTemporaryFile>
#include <QStandardItemModel>
#include <QSortFilterProxyModel>
-#include "GEOM_GenericObjPtr.h"
-
#include "HEXABLOCKGUI_DocumentItem.hxx"
#include "HexDocument.hxx"
#include "HexNewShape.hxx"
{
namespace GUI
{
- class DocumentModel : public QStandardItemModel
+ class HEXABLOCK_EXPORT DocumentModel : public QStandardItemModel
{
Q_OBJECT
public:
typedef HEXA_NS::EnumGroup Group;
typedef HEXA_NS::KindLaw KindLaw;
-// struct GeomObj
-// {
-// QString shapeName;
-// QString name;
-// QString subid; // sub-shape id
-// QString brep;
-// double start;
-// double end;
-// };
-
typedef QList<GeomObj> GeomObjList;
DocumentModel( HEXA_NS::Document* doc, const QString& entry, QObject * parent = 0 );
void refresh(); //refresh data
bool isEmpty() const;
+ double getLength(const QModelIndex& iEdge);
+ double getRadius(const QModelIndex& iEdge);
+ double getAngle(const QModelIndex& iEdge);
+
void clearAll();
void clearData();
- void clearBuilder();
+// void clearBuilder();
void clearGeometry();
void clearAssociation();
void clearGroups();
void clearMesh();
void fillData();
- void fillBuilder();
+// void fillBuilder();
void fillGeometry();
void fillAssociation();
void fillGroups();
int getNbrUsedElt(HEXA_NS::EnumElt eltType);
int getNbrUnusedElt(HEXA_NS::EnumElt eltType);
- QModelIndex addToElementsTree(HEXA_NS::Elements* helts);
+ QModelIndex addElementsToTree(HEXA_NS::Elements* helts, QStandardItem* tree);
//associate a shape to the current document
bool addShape(TopoDS_Shape& forme, QString& shapeName, bool publish=true);
QModelIndex addVectorVertices( const QModelIndex &i_v0, const QModelIndex &i_v1 );
//
- QModelIndex addCylinder( const QModelIndex &iv, const QModelIndex &ivec, double r, double h );
-
- //
- QModelIndex addPipe( const QModelIndex &iv, const QModelIndex &ivec, double ri, double re, double h );
-
-
- // ===================== OBSOLETE =================================
- QModelIndex makeCartesian( const QModelIndex& ivex,
- const QModelIndex& ivecx, const QModelIndex& ivecy, const QModelIndex& ivecz,
- long nx, long ny, long nz);
-
- QModelIndex makeCartesian( const QModelIndex& ivex,
- const QModelIndex& ivec,
- int nx, int ny, int nz );
-
- QModelIndex makeCylindrical( const QModelIndex& i_pt,
- const QModelIndex& i_vx, const QModelIndex& i_vz,
- double dr, double da, double dl,
- long nr, long na, long nl,
- bool fill = false );
-
- QModelIndex makeCylindricals(
- const QModelIndex& i_center, const QModelIndex& i_base, const QModelIndex& i_height,
- QList< double> i_radius, QList<double> i_angles, QList<double> i_heights,
- bool fill = false ); //NEW HEXA3
-
- QModelIndex makeSpherical( const QModelIndex& i_v, const QModelIndex& i_vec, int nb, double k = 1 ); //CS_TO_DEL
-
- QModelIndex makeSpherical( const QModelIndex& i_center, double rayon, int nb, double k = 1 );
-
- QModelIndex makeCylinder( const QModelIndex& cyl, const QModelIndex& vec,
- int nr, int na, int nl );
-
- QModelIndex makeCylinders(const QModelIndex& cyl1, const QModelIndex& cyl2);
-
- //
- QModelIndex makePipe( const QModelIndex& pipe, const QModelIndex& vecx,
- int nr, int na, int nl );
-
- //
- QModelIndex makePipes( const QModelIndex& pipe1, const QModelIndex& pipe2 );
-
- QModelIndex makeRind( const QModelIndex& center, const QModelIndex& vecx, const QModelIndex& vecz,
- double radext, double radint, double radhole,
- const QModelIndex& plorig,
- int nrad, int nang, int nhaut ); //NEW HEXA3
-
- QModelIndex makePartRind( const QModelIndex& center, const QModelIndex& vecx, const QModelIndex& vecz,
- double radext, double radint, double radhole,
- const QModelIndex& plorig, double angle,
- int nrad, int nang, int nhaut ); //NEW HEXA3
-
- QModelIndex makeSphere( const QModelIndex& center, const QModelIndex& vecx, const QModelIndex& vecz,
- double radius, double radhole,
- const QModelIndex& plorig,
- int nrad, int nang, int nhaut ); //NEW HEXA3
-
- QModelIndex makePartSphere( const QModelIndex& center, const QModelIndex& vecx, const QModelIndex& vecz,
- double radius, double radhole,
- const QModelIndex& plorig, double angle,
- int nrad, int nang, int nhaut ); //NEW HEXA3
-
- // OBSOLETE: replaced by extrudeQuad...
- QModelIndex prismQuad( const QModelIndex& quad, const QModelIndex& dv, int nb);
- QModelIndex prismQuads( const QModelIndexList& quads, const QModelIndex& dv, int nb);
- QModelIndex prismQuads( const QModelIndexList& quads, const QModelIndex& dv, std::vector<double>, int nb=0);
-
- //
- QModelIndex joinQuad( const QModelIndex& start_q, const QModelIndex& dest_q,
- const QModelIndex& v0, const QModelIndex& v1,
- const QModelIndex& v2, const QModelIndex& v3, int nb );
-
- QModelIndex joinQuads( const QModelIndexList& start_q, const QModelIndex& dest_q,
- const QModelIndex& v0, const QModelIndex& v1,
- const QModelIndex& v2, const QModelIndex& v3, int nb );
-
- QModelIndex revolutionQuads( const QModelIndexList& startQuads, const QModelIndex& center,
- const QModelIndex& vec_axis, const QList<double>& angles); //NEW HEXA3
-
- //
- QModelIndex cutEdge( const QModelIndex &e, int nbcuts );
-
- // ======================= END OBSOLETE =================================
+// QModelIndex addCylinder( const QModelIndex &iv, const QModelIndex &ivec, double r, double h );
+//
+// //
+// QModelIndex addPipe( const QModelIndex &iv, const QModelIndex &ivec, double ri, double re, double h );
QModelIndex makeCartesianUni(const QModelIndex& icenter, const QModelIndex& ibase, const QModelIndex& ivec,
const QModelIndex& iaxis, double lx, double ly, double lz, int nx, int ny, int nz);
QModelIndex makeCartesian(const QModelIndex& icenter, const QModelIndex& ibase, const QModelIndex& ivec,
- const QModelIndex& iaxis, vector<double>& radius, vector<double>& angles, vector<double>& heights);
+ const QModelIndex& iaxis, std::vector<double>& radius, std::vector<double>& angles, std::vector<double>& heights);
// ====== SPHERE
QModelIndex makeSphere (QModelIndex& icenter,
QModelIndex& ivec_x, QModelIndex& ivec_z,
- vector<double>& tray, vector<double>& tang, vector<double>& thaut);
+ std::vector<double>& tray, std::vector<double>& tang, std::vector<double>& thaut);
// ====== SPHERICAL
QModelIndex makeSpherical (QModelIndex& icenter,
QModelIndex& ivec_x, QModelIndex& ivec_z,
- vector<double>& rayon,
+ std::vector<double>& rayon,
int crit);
// =========== RIND
QModelIndex makeRind (QModelIndex& icenter,
QModelIndex& ivec_x, QModelIndex& ivec_z,
- vector<double>& tray, vector<double>& tang, vector<double>& thaut);
+ std::vector<double>& tray, std::vector<double>& tang, std::vector<double>& thaut);
// ======== Cylinder
QModelIndex makeCylinderTop(int nr, int na, int nh);
int nr, int na, int nh);
QModelIndex makeCylinder (QModelIndex& iorig, QModelIndex& ivecx, QModelIndex& ivecz,
- vector<double>& tray, vector<double>& tang, vector<double>& thaut);
+ std::vector<double>& tray, std::vector<double>& tang, std::vector<double>& thaut);
// ======== Cylinders
QModelIndex makeCylinders (QModelIndex& iorig1, QModelIndex& ivecz1, double r1, double h1,
int nr, int na, int nh);
QModelIndex makePipe (QModelIndex& iorig, QModelIndex& ivecx, QModelIndex& ivecz,
- vector<double>& tray, vector<double>& tang, vector<double>& thaut);
+ std::vector<double>& tray, std::vector<double>& tang, std::vector<double>& thaut);
// ======== Pipes
QModelIndex makePipes (QModelIndex& iorig1, QModelIndex& ivecz1, double rint1, double rex1, double h1,
QModelIndex& iv3, QModelIndex& iv4, int nb);
QModelIndex joinQuad (QModelIndex& istart, QModelIndex& idest, QModelIndex& iva1, QModelIndex& ivb1,
- QModelIndex& iva2, QModelIndex& ivb2, vector<double>& tlen);
+ QModelIndex& iva2, QModelIndex& ivb2, std::vector<double>& tlen);
QModelIndex joinQuadsUni (QModelIndexList& istarts, QModelIndex& idest, QModelIndex& iv1, QModelIndex& iv2,
QModelIndex& iv3, QModelIndex& iv4, int nb);
QModelIndex joinQuads (QModelIndexList& istarts, QModelIndex& idest, QModelIndex& iva1, QModelIndex& ivb1,
- QModelIndex& iva2, QModelIndex& ivb2, vector<double>& tlen);
+ QModelIndex& iva2, QModelIndex& ivb2, std::vector<double>& tlen);
// ======== Quad Revolution
QModelIndex revolutionQuadUni(QModelIndex& istart, QModelIndex& icenter, QModelIndex& iaxis,
double angle, int nbre);
QModelIndex revolutionQuad(QModelIndex& istart, QModelIndex& icenter, QModelIndex& iaxis,
- vector<double>& angles);
+ std::vector<double>& angles);
QModelIndex revolutionQuadsUni(QModelIndexList& istarts, QModelIndex& icenter, QModelIndex& iaxis,
double angle, int nbre);
QModelIndex revolutionQuads(QModelIndexList& istarts, QModelIndex& icenter, QModelIndex& iaxis,
- vector<double>& angles);
+ std::vector<double>& angles);
// ==== PrismQuad or ExtrudeQuad
QModelIndex extrudeQuadTop (QModelIndex& istart, int nbre);
QModelIndex extrudeQuadUni (QModelIndex& istart, QModelIndex& dv, double len, int nbre);
- QModelIndex extrudeQuad (QModelIndex& istart, QModelIndex& dv, vector<double>& tlen);
+ QModelIndex extrudeQuad (QModelIndex& istart, QModelIndex& dv, std::vector<double>& tlen);
QModelIndex extrudeQuadsTop (QModelIndexList& istarts, int nbre);
QModelIndex extrudeQuadsUni (QModelIndexList& istarts, QModelIndex& axis, double len, int nbre);
- QModelIndex extrudeQuads (QModelIndexList& istarts, QModelIndex& iaxis, vector<double>& tlen);
+ QModelIndex extrudeQuads (QModelIndexList& istarts, QModelIndex& iaxis, std::vector<double>& tlen);
// ==== Cut Edge
QModelIndex cutUni (QModelIndex& iEdge, int nbre);
- QModelIndex cut (QModelIndex& iEdge, vector<double>& tlen);
+ QModelIndex cut (QModelIndex& iEdge, std::vector<double>& tlen);
// ============================== END NEW ================================
bool performSymmetryLine( const QModelIndex& elts, const QModelIndex& v, const QModelIndex& vec );
bool performSymmetryPlane( const QModelIndex& elts, const QModelIndex& v, const QModelIndex& vec );
- QModelIndex replace( const QModelIndexList& quadsPattern,
- const QModelIndex& p1, const QModelIndex& c1,
- const QModelIndex& p2, const QModelIndex& c2,
- const QModelIndex& p3, const QModelIndex& c3 ); //NEW HEXA3
+ QModelIndex replace( const QModelIndexList& iquads_source, const QModelIndexList& iquads_dest,
+ const QModelIndex& ip1_source, const QModelIndex& ic1_dest,
+ const QModelIndex& ip2_source, const QModelIndex& ic2_dest);
// ************ ASSOCIATION ************
//builder
QStandardItem *_vectorDirItem;
- QStandardItem *_cylinderDirItem;
- QStandardItem *_pipeDirItem;
QStandardItem *_elementsDirItem;
QStandardItem *_crossElementsDirItem;
QStandardItem *_lawDirItem;
QStandardItem *_propagationDirItem;
-
Qt::ItemFlags _vertexItemFlags;
Qt::ItemFlags _edgeItemFlags;
Qt::ItemFlags _quadItemFlags;
Qt::ItemFlags _hexaItemFlags;
Qt::ItemFlags _vectorItemFlags;
- Qt::ItemFlags _cylinderItemFlags;
- Qt::ItemFlags _pipeItemFlags;
Qt::ItemFlags _elementsItemFlags;
Qt::ItemFlags _crossElementsItemFlags;
Qt::ItemFlags _groupItemFlags;
Qt::ItemFlags _lawItemFlags;
Qt::ItemFlags _propagationItemFlags;
-
};
};
- class PatternBuilderModel : public QSortFilterProxyModel
- {
- public:
- PatternBuilderModel( QObject * parent = 0 );
- virtual ~PatternBuilderModel();
-
- virtual Qt::ItemFlags flags(const QModelIndex &index) const;
- virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
- QStandardItem * itemFromIndex ( const QModelIndex & index ) const;
- };
+// class PatternBuilderModel : public QSortFilterProxyModel
+// {
+// public:
+// PatternBuilderModel( QObject * parent = 0 );
+// virtual ~PatternBuilderModel();
+//
+// virtual Qt::ItemFlags flags(const QModelIndex &index) const;
+// virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
+// QStandardItem * itemFromIndex ( const QModelIndex & index ) const;
+// };
class PatternGeomModel : public QSortFilterProxyModel
{