From: abuhsing Date: Thu, 14 Nov 2013 17:42:31 +0000 (+0000) Subject: Livraison IHM Hexa7 X-Git-Tag: V7_3_0a1~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7e372bca8f08bce752e415ebf847d0a93fa703dc;p=modules%2Fhexablock.git Livraison IHM Hexa7 src/HEXABLOCKGUI/AddShapeDialog_QTD.ui src/HEXABLOCKGUI/CutEdge_QTD.ui src/HEXABLOCKGUI/Disconnect_QTD.ui src/HEXABLOCKGUI/EdgeAssoc_QTD.ui src/HEXABLOCKGUI/Edge_QTD.ui src/HEXABLOCKGUI/Group_QTD.ui src/HEXABLOCKGUI/HEXABLOCKGUI.cxx src/HEXABLOCKGUI/HEXABLOCKGUI.hxx src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.cxx src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.hxx src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentItem.cxx src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentItem.hxx src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.cxx src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.hxx src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.cxx src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.hxx src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.cxx src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.hxx src/HEXABLOCKGUI/HEXABLOCKGUI_Exception.hxx src/HEXABLOCKGUI/HEXABLOCKGUI_GraphicViewsHandler.hxx src/HEXABLOCKGUI/HEXABLOCKGUI_Model.hxx src/HEXABLOCKGUI/HEXABLOCKGUI_OCCSelector.h src/HEXABLOCKGUI/HEXABLOCKGUI_OccGraphicView.cxx src/HEXABLOCKGUI/HEXABLOCKGUI_OccGraphicView.hxx src/HEXABLOCKGUI/HEXABLOCKGUI_Resource.hxx src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.hxx src/HEXABLOCKGUI/HEXABLOCKGUI_Trace.hxx src/HEXABLOCKGUI/HEXABLOCKGUI_VtkDocumentGraphicView.cxx src/HEXABLOCKGUI/HEXABLOCKGUI_VtkDocumentGraphicView.hxx src/HEXABLOCKGUI/Hexa_QTD.ui src/HEXABLOCKGUI/Law_QTD.ui src/HEXABLOCKGUI/MakeCylinders_QTD.ui src/HEXABLOCKGUI/MakeHemiSphere_QTD.ui src/HEXABLOCKGUI/MakePipes_QTD.ui src/HEXABLOCKGUI/MergeEdges_QTD.ui src/HEXABLOCKGUI/Merge_QTD.ui src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx src/HEXABLOCKGUI/MyBasicGUI_PointDlg.hxx src/HEXABLOCKGUI/MyGEOMBase_Skeleton.hxx src/HEXABLOCKGUI/PrismQuad_QTD.ui src/HEXABLOCKGUI/Propagation_QTD.ui src/HEXABLOCKGUI/QuadAssoc_QTD.ui src/HEXABLOCKGUI/QuadRevolution_QTD.ui src/HEXABLOCKGUI/Quad_QTD.ui src/HEXABLOCKGUI/RemoveHexa_QTD.ui src/HEXABLOCKGUI/ReplaceHexa_QTD.ui src/HEXABLOCKGUI/Resource.hxx src/HEXABLOCKGUI/Symmetry_QTD.ui src/HEXABLOCKGUI/Transformation_QTD.ui src/HEXABLOCKGUI/Vector_QTD.ui src/HEXABLOCKGUI/Vertex_QTD.ui src/HEXABLOCKGUI/klinkitemselectionmodel.hxx src/HEXABLOCKGUI/kmodelindexproxymapper.hxx src/HEXABLOCKGUI/MyDlgRef/DlgRef_Skeleton_QTD.ui src/HEXABLOCKGUI/resources/HEXABLOCKCatalog.xml.in src/HEXABLOCKGUI/resources/SalomeApp.xml.in src/HEXABLOCK_SWIG/hexablock_swig.py src/HEXABLOCK_SWIG/hexablock_swig_wrap.cc src/TEST_CPP/test_hexa1.cxx Removed Files: Tag: V7_main src/HEXABLOCK/HexCrossElements.cxx src/HEXABLOCK/HexCrossElements_build.cxx src/HEXABLOCK/HexCylinder.cxx src/HEXABLOCK/HexDocument_del.cxx src/HEXABLOCK/HexElements_del.cxx src/HEXABLOCK/HexPipe.cxx --- diff --git a/HEXABLOCK_version.h.in b/HEXABLOCK_version.h.in index 2fd948b..b2dc846 100755 --- a/HEXABLOCK_version.h.in +++ b/HEXABLOCK_version.h.in @@ -20,22 +20,12 @@ #if !defined(__HEXABLOCK_VERSION_H__) #define __HEXABLOCK_VERSION_H__ -/*! - Specify version of SALOME HEXABLOCK module, as follows - - HEXABLOCK_VERSION_MAJOR : (integer) number identifying major version - HEXABLOCK_VERSION_MINOR : (integer) number identifying minor version - HEXABLOCK_VERSION_MAINTENANCE : (integer) number identifying maintenance version - HEXABLOCK_VERSION_STR : (string) complete version number "major.minor.maintenance" - HEXABLOCK_VERSION : (hex) complete version number (major << 16) + (minor << 8) + maintenance - HEXABLOCK_DEVELOPMENT : (integer) indicates development version when set to 1 +/* + HEXABLOCK_VERSION is (major << 16) + (minor << 8) + patch. */ -#define HEXABLOCK_VERSION_MAJOR @SALOMEHEXABLOCK_MAJOR_VERSION@ -#define HEXABLOCK_VERSION_MINOR @SALOMEHEXABLOCK_MINOR_VERSION@ -#define HEXABLOCK_VERSION_MAINTENANCE @SALOMEHEXABLOCK_PATCH_VERSION@ -#define HEXABLOCK_VERSION_STR "@SALOMEHEXABLOCK_VERSION@" -#define HEXABLOCK_VERSION @SALOMEHEXABLOCK_XVERSION@ -#define HEXABLOCK_DEVELOPMENT @SALOMEHEXABLOCK_VERSION_DEV@ +#define HEXABLOCK_VERSION_STR "@VERSION@" +#define HEXABLOCK_VERSION @XVERSION@ +#define HEXABLOCK_DEVELOPMENT @VERSION_DEV@ #endif // __HEXABLOCK_VERSION_H__ diff --git a/src/HEXABLOCK/Hex.hxx b/src/HEXABLOCK/Hex.hxx index 7cdbc2a..7c727c1 100755 --- a/src/HEXABLOCK/Hex.hxx +++ b/src/HEXABLOCK/Hex.hxx @@ -24,8 +24,6 @@ #ifndef __HEX_H #define __HEX_H -#include "Hex_defines.hxx" - #include "hexa_base.hxx" #if defined WIN32 @@ -34,10 +32,9 @@ BEGIN_NAMESPACE_HEXA -class Hex; -HEXABLOCKENGINE_EXPORT Hex* hex_instance (); +HexaExport Hex* hex_instance (); -class HEXABLOCKENGINE_EXPORT Hex +class HexaExport Hex { public: static Hex* getInstance (); @@ -75,7 +72,7 @@ private: #endif // not SWIG }; -HEXABLOCKENGINE_EXPORT void what (); +HexaExport void what (); END_NAMESPACE_HEXA #endif diff --git a/src/HEXABLOCK/HexAnaQuads.hxx b/src/HEXABLOCK/HexAnaQuads.hxx index 854afd7..1751e18 100755 --- a/src/HEXABLOCK/HexAnaQuads.hxx +++ b/src/HEXABLOCK/HexAnaQuads.hxx @@ -22,13 +22,12 @@ #ifndef __ANA_QUADS_H #define __ANA_QUADS_H -#include "Hex_defines.hxx" #include "HexQuad.hxx" // #include "HexEdge.hxx" BEGIN_NAMESPACE_HEXA -class HEXABLOCKENGINE_EXPORT AnaQuads +class HexaExport AnaQuads { public: AnaQuads (Quad* q1, Quad* q2, Quad* q3=NULL, Quad* q4=NULL, Quad* q5=NULL); diff --git a/src/HEXABLOCK/HexAssoEdge.hxx b/src/HEXABLOCK/HexAssoEdge.hxx index e6813fd..7e9898e 100644 --- a/src/HEXABLOCK/HexAssoEdge.hxx +++ b/src/HEXABLOCK/HexAssoEdge.hxx @@ -4,7 +4,6 @@ #ifndef __ASSO_EDGE_H_ #define __ASSO_EDGE_H_ -#include "Hex_defines.hxx" #include "HexEdgeShape.hxx" #include @@ -12,7 +11,7 @@ BEGIN_NAMESPACE_HEXA -class HEXABLOCKENGINE_EXPORT AssoEdge +class HexaExport AssoEdge { public : AssoEdge (EdgeShape* shape, double deb, double fin); diff --git a/src/HEXABLOCK/HexBiCylinder.hxx b/src/HEXABLOCK/HexBiCylinder.hxx index 3033bf7..ba6d369 100755 --- a/src/HEXABLOCK/HexBiCylinder.hxx +++ b/src/HEXABLOCK/HexBiCylinder.hxx @@ -23,14 +23,12 @@ #ifndef __BI_CYLINDER_H_ #define __BI_CYLINDER_H_ -#include "Hex_defines.hxx" - #include "HexElements.hxx" #include BEGIN_NAMESPACE_HEXA -class HEXABLOCKENGINE_EXPORT BiCylinder : public Elements +class HexaExport BiCylinder : public Elements { public: BiCylinder (Document* doc); diff --git a/src/HEXABLOCK/HexBiCylinderShape.hxx b/src/HEXABLOCK/HexBiCylinderShape.hxx index f8dcb4e..7309f45 100755 --- a/src/HEXABLOCK/HexBiCylinderShape.hxx +++ b/src/HEXABLOCK/HexBiCylinderShape.hxx @@ -23,12 +23,11 @@ #ifndef __BI_CYLINDER_SHAPE_HXX_ #define __BI_CYLINDER_SHAPE_HXX_ -#include "Hex_defines.hxx" #include "HexGlobale.hxx" BEGIN_NAMESPACE_HEXA -class HEXABLOCKENGINE_EXPORT BiCylinderShape +class HexaExport BiCylinderShape { public : BiCylinderShape (Document* doc); diff --git a/src/HEXABLOCK/HexCloner.hxx b/src/HEXABLOCK/HexCloner.hxx index 1d32a42..1f9390b 100755 --- a/src/HEXABLOCK/HexCloner.hxx +++ b/src/HEXABLOCK/HexCloner.hxx @@ -22,14 +22,13 @@ #ifndef __CLONER_H #define __CLONER_H -#include "Hex_defines.hxx" #include "hexa_base.hxx" #include BEGIN_NAMESPACE_HEXA -class HEXABLOCKENGINE_EXPORT Cloner +class HexaExport Cloner { public: Cloner (Matrix* mat); diff --git a/src/HEXABLOCK/HexCramer.hxx b/src/HEXABLOCK/HexCramer.hxx index 84d8cac..0898f0a 100755 --- a/src/HEXABLOCK/HexCramer.hxx +++ b/src/HEXABLOCK/HexCramer.hxx @@ -22,13 +22,12 @@ #ifndef __CRAMER_H_ #define __CRAMER_H_ -#include "Hex_defines.hxx" #include "hexa_base.hxx" // #include BEGIN_NAMESPACE_HEXA -class HEXABLOCKENGINE_EXPORT Cramer +class HexaExport Cramer { public: Cramer (int size); diff --git a/src/HEXABLOCK/HexCrossElements.cxx b/src/HEXABLOCK/HexCrossElements.cxx deleted file mode 100755 index 9fab3c2..0000000 --- a/src/HEXABLOCK/HexCrossElements.cxx +++ /dev/null @@ -1,807 +0,0 @@ - -// C++ : Gestion des cylindres croises - -// Copyright (C) 2009-2013 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. -// -// 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 "HexCrossElements.hxx" - -#include "HexDocument.hxx" -#include "HexVector.hxx" -#include "HexVertex.hxx" -#include "HexHexa.hxx" -#include "HexEdge.hxx" - -#include "HexGlobale.hxx" -#include "HexCylinder.hxx" -#include "HexNewShape.hxx" - -#include - -static bool db = false; - -static const double UnSur2pi = DEMI/M_PI; - -BEGIN_NAMESPACE_HEXA - -// ====================================================== Constructeur -CrossElements::CrossElements (Document* doc, EnumGrid type) - : Elements (doc) -{ - cross_cyl1 = NULL; - cross_cyl1 = NULL; - cross_cyl2 = NULL; - cross_center = NULL; - grid_type = type; - angle_intermed = angle_inter [CylSmall] = angle_inter [CylBig] = 0; - at_right = at_left = true; - is_filled = false; - grid_geom = NULL; -} -// ====================================================== resize -void CrossElements::resize () -{ - size_hx = 2; - size_hy = S_MAXI; - size_hz [CylSmall] = size_h1z; - size_hz [CylBig] = size_h2z; - - size_vx = size_hx + 1; - size_vy = size_hy; - size_vz[CylSmall] = size_v1z; - size_vz[CylBig] = size_v2z; - - nbr_vertex1 = size_vx*size_vy* size_v1z; - nbr_quads1 = nbr_vertex1*DIM3; - nbr_edges1 = nbr_quads1; - nbr_hexas1 = size_hx * size_hy * size_h1z; - - nbr_vertex = nbr_vertex1 + size_vx * size_vy * size_v1z; - nbr_quads = nbr_vertex*DIM3; - nbr_edges = nbr_quads; - nbr_hexas = nbr_hexas1 + size_hx * size_hy * size_h2z; - - tab_hexa .resize (nbr_hexas*2); - tab_quad .resize (nbr_quads*2); - tab_edge .resize (nbr_edges*2); - tab_vertex.resize (nbr_vertex*2); - - for (int nc=0 ; nc< nbr_hexas ; nc++) tab_hexa [nc] = NULL; - for (int nc=0 ; nc< nbr_quads ; nc++) tab_quad [nc] = NULL; - for (int nc=0 ; nc< nbr_edges ; nc++) tab_edge [nc] = NULL; - for (int nc=0 ; nc< nbr_vertex ; nc++) tab_vertex [nc] = NULL; -} -// ====================================================== indHexa -int CrossElements::indHexa (int cyl, int nx, int ny, int nz) -{ - if (cyl<0 || cyl>1) - return NOTHING; - if ( nx < 0 || nx >= size_hx || ny < 0 || ny >= size_hy - || nz < 0 || nz >= size_hz[cyl]) return NOTHING; - - int nro = cyl*nbr_hexas1 + nx + size_hx*ny + size_hx*size_hy*nz; - return nro; -} -// ====================================================== indQuad -int CrossElements::indQuad (int cyl, int dd, int nx, int ny, int nz) -{ - if (cyl<0 || cyl>1 || dd <0 || dd >= DIM3) - return NOTHING; - if ( nx < 0 || nx >= size_vx || ny < 0 || ny >= size_vy - || nz < 0 || nz >= size_vz[cyl]) return NOTHING; - - int nro = cyl*nbr_quads1 + nx + size_vx*ny + size_vx*size_vy*nz - + size_vx*size_vy*size_vz[cyl]*dd; - return nro; -} -// ====================================================== indEdge -int CrossElements::indEdge (int cyl, int dd, int nx, int ny, int nz) -{ - return indQuad (cyl, dd, nx, ny, nz); -} -// ====================================================== indVertex -int CrossElements::indVertex (int cyl, int nx, int ny, int nz) -{ - if (cyl<0 || cyl>1) - return NOTHING; - if ( nx < 0 || nx >= size_vx || ny < 0 || ny >= size_vy - || nz < 0 || nz >= size_vz[cyl]) - return NOTHING; - - int nro = cyl*nbr_vertex1 + nx + size_vx*ny + size_vx*size_vy*nz; - return nro; -} -// ------------------------------------------------------------------------ -// ====================================================== getHexaIJK -Hexa* CrossElements::getHexaIJK (int cyl, int nx, int ny, int nz) -{ - int nro = indHexa (cyl, nx, ny, nz); - - if (nro >= 0 && tab_hexa[nro]!= NULL && tab_hexa[nro]->isHere ()) - return tab_hexa [nro]; - else - return NULL; -} -// ====================================================== getQuadIJ -Quad* CrossElements::getQuadIJ (int cyl, int nx, int ny, int nz) -{ - int nro = indQuad (cyl, dir_z, nx, ny, nz); - if (nro<0) - return NULL; - - return tab_quad [nro]; -} -// ====================================================== getQuadJK -Quad* CrossElements::getQuadJK (int cyl, int nx, int ny, int nz) -{ - int nro = indQuad (cyl, dir_x, nx, ny, nz); - if (nro<0) - return NULL; - return tab_quad [nro]; -} -// ====================================================== getQuadIK -Quad* CrossElements::getQuadIK (int cyl, int nx, int ny, int nz) -{ - int nro = indQuad (cyl, dir_y, nx, ny, nz); - if (nro<0) - return NULL; - return tab_quad [nro]; -} -// ====================================================== getEdgeI -Edge* CrossElements::getEdgeI (int cyl, int nx, int ny, int nz) -{ - int nro = indEdge (cyl, dir_x, nx, ny, nz); - if (nro<0) - return NULL; - return tab_edge [nro]; -} -// ====================================================== getEdgeJ -Edge* CrossElements::getEdgeJ (int cyl, int nx, int ny, int nz) -{ - int nro = indEdge (cyl, dir_y, nx, ny, nz); - if (nro<0) - return NULL; - return tab_edge [nro]; -} -// ====================================================== getEdgeK -Edge* CrossElements::getEdgeK (int cyl, int nx, int ny, int nz) -{ - int nro = indEdge (cyl, dir_z, nx, ny, nz); - if (nro<0) - return NULL; - return tab_edge [nro]; -} -// ====================================================== getVertexIJK -Vertex* CrossElements::getVertexIJK (int cyl, int nx, int ny, int nz) -{ - int nro = indVertex (cyl, nx, ny, nz); - if (nro<0) - return NULL; - return tab_vertex [nro]; -} -// ------------------------------------------------------------------------ -// ====================================================== setHexa -void CrossElements::setHexa (Hexa* elt, int cyl, int nx, int ny, int nz) -{ - if (db) - { - printf ("tab_hexa [%d, %d,%d,%d] = ", cyl, nx, ny, nz); - PrintName (elt); - printf ("\n"); - } - - int nro = indHexa (cyl, nx, ny, nz); - if (nro<0) - return; - tab_hexa [nro] = elt; -} -// ====================================================== setQuad -void CrossElements::setQuad (Quad* elt, int cyl, int dd, int nx, int ny, int nz) -{ - if (db) - { - printf ("tab_quad [%d,%d, %d,%d,%d] = ", cyl, dd, nx, ny, nz); - PrintName (elt); - printf ("\n"); - } - - int nro = indQuad (cyl, dd, nx, ny, nz); - if (nro<0) - return; - tab_quad [nro] = elt; -} -// ====================================================== setEdge -void CrossElements::setEdge (Edge* elt, int cyl, int dd, int nx, int ny, int nz) -{ - if (db) - { - printf ("tab_edge [%d,%d, %d,%d,%d] = ", cyl, dd, nx, ny, nz); - PrintName (elt); - printf ("\n"); - } - - int nro = indEdge (cyl, dd, nx, ny, nz); - if (nro<0) - return; - tab_edge [nro] = elt; -} -// ====================================================== setVertex -void CrossElements::setVertex (Vertex* elt, int cyl, int nx, int ny, int nz) -{ - if (db) - { - printf ("tab_vertex [%d, %d,%d,%d] = ", cyl, nx, ny, nz); - PrintName (elt); - printf ("\n"); - } - - int nro = indVertex (cyl, nx, ny, nz); - if (nro<0) - return; - tab_vertex [nro] = elt; -} -// ====================================================== setVertex (2) -inline bool isequals (double v1, double v2) -{ - const double eps = 0.01; - bool equals = v1 <= v2 + eps && v1 >= v2 - eps; - return equals; -} -// ====================================================== setVertex (2) -void CrossElements::setVertex (int cyl, int nx, int ny, int nz, double px, - double py, double pz) -{ - if (isequals (px, 0) && isequals (py, -1.5) && isequals (pz, 5)) - printf (" Vertex trouve : Cyl%d [%d,%d,%d] = (%g,%g,%g)\n", - cyl, nx,ny,nz, px,py,pz); - - int nro = indVertex (cyl, nx, ny, nz); - if (nro<0) - return; - else if (tab_vertex[nro] != NULL) - { - Vertex* node = tab_vertex[nro]; - if (node->definedBy (px, py, pz)) - return; - - printf (" ************ ATTENTION ****************\n"); - printf (" Creation d'un vertex : Cyl%d [%d,%d,%d] = (%g,%g,%g)\n", - cyl, nx,ny,nz, px,py,pz); - printf (" Indice %d deja occupe par le vertex (%g,%g,%g)\n", nro, - node->getX(), node->getY(), node->getZ()); - - return; - } - - int trouve = findVertex (px, py, pz); - if (trouve>=0) - { - printf (" Creation d'un vertex : Cyl%d [%d,%d,%d] = (%g,%g,%g)\n", - cyl, nx,ny,nz, px,py,pz); - printf (" Vertex %d present a l'indice %d\n", nro, trouve); - tab_vertex [nro] = tab_vertex [trouve]; - return; - } - Vertex* node = el_root->addVertex (px, py, pz); - setVertex (node, cyl, nx, ny, nz); -} -// ====================================================== copyEdge -void CrossElements::copyEdge (int d1, int i1, int j1, int k1, int d2, int i2, - int j2, int k2) -{ - Edge* edge = NULL; - switch (d1) - { - case dir_x : edge = getEdgeI (CylSmall, i1, j1, k1); - break; - case dir_y : edge = getEdgeJ (CylSmall, i1, j1, k1); - break; - case dir_z : edge = getEdgeK (CylSmall, i1, j1, k1); - break; - } - - setEdge (edge, CylBig, d2, i2, j2, k2); -} -// ====================================================== copyQuad -void CrossElements::copyQuad (int d1, int i1, int j1, int k1, int d2, int i2, - int j2, int k2) -{ - Quad* quad = NULL; - switch (d1) - { - case dir_x : quad = getQuadJK (CylSmall, i1, j1, k1); - break; - case dir_y : quad = getQuadIK (CylSmall, i1, j1, k1); - break; - case dir_z : quad = getQuadIJ (CylSmall, i1, j1, k1); - break; - } - - setQuad (quad, CylBig, d2, i2, j2, k2); -} -// ====================================================== addEdge -Edge* CrossElements::addEdge (Vertex* v1, Vertex* v2, int cyl, int dir, - int nx, int ny, int nz) -{ - Edge* edge = NULL; - if (v1==NULL || v2==NULL) - return NULL; - - else if (cyl==CylBig) - { - edge = findEdge1 (v1, v2); - /* ************************************************ - if (edge != NULL) - { - printf (" Edge (%d, %d,%d,%d) trouve = ", dir, nx, ny, nz); - edge->printName ("\n"); - } - ************************************************ */ - } - - if (edge == NULL) - edge = newEdge (v1, v2); - - setEdge (edge, cyl, dir, nx, ny, nz); - return edge; -} -// ====================================================== addHexa -Hexa* CrossElements::addHexa (Quad* q1, Quad* q2, Quad* q3, Quad* q4, Quad* q5, - Quad* q6, int cyl, int nx, int ny, int nz) -{ -/* ************************** - if (cyl==CylSmall) - { - if (nx == 0) return NULL; - if (nz != 1) return NULL; - if (ny != 4) return NULL; - return NULL; - } - - if (cyl==CylBig) - { - if (nz > 2) return NULL; - if (nz < 1) return NULL; - // if (nx == 0) return NULL; - // if (ny != 4) return NULL; - } - ************************** */ - - Hexa* hexa = NULL; - if (cyl==CylBig) - hexa = findHexa1 (q1, q2); - - if (hexa == NULL) - hexa = newHexa (q1, q2, q3, q4, q5, q6); - else if (db) - { - printf (" Hexa (%d,%d,%d) trouve = ", nx, ny, nz); - hexa->printName ("\n"); - } - - setHexa (hexa, cyl, nx, ny, nz); - return hexa; -} -// ====================================================== addQuad -Quad* CrossElements::addQuad (Edge* e1, Edge* e2, Edge* e3, Edge* e4, int cyl, - int dir, int nx, int ny, int nz) -{ - Quad* quad = NULL; - if (cyl==CylBig) - quad = findQuad1 (e1, e3); - - if (quad == NULL) - quad = newQuad (e1, e2, e3, e4); - else if (db) - { - printf (" Quad (%d, %d,%d,%d) trouve = ", dir, nx, ny, nz); - quad->printName ("\n"); - } - - setQuad (quad, cyl, dir, nx, ny, nz); - return quad; -} -// ====================================================== findEdge1 -Edge* CrossElements::findEdge1 (Vertex* v1, Vertex* v2) -{ - for (int nc=0; nc < nbr_edges1 ; nc++) - if (tab_edge[nc] != NULL && tab_edge[nc]->definedBy (v1, v2)) - return tab_edge[nc]; - - return NULL; -} -// ====================================================== findHexa1 -Hexa* CrossElements::findHexa1 (Quad* e1, Quad* e2) -{ - for (int nc=0; nc < nbr_hexas1 ; nc++) - if (tab_hexa[nc] != NULL && tab_hexa[nc]->definedBy (e1, e2)) - return tab_hexa[nc]; - - return NULL; -} -// ====================================================== findQuad1 -Quad* CrossElements::findQuad1 (Edge* e1, Edge* e2) -{ - for (int nc=0; nc < nbr_quads1 ; nc++) - if (tab_quad[nc] != NULL && tab_quad[nc]->definedBy (e1, e2)) - return tab_quad[nc]; - - return NULL; -} -// ====================================================== fillGrid -void CrossElements::fillGrid (int cyl, int deb, int fin) -{ - int nz0 = deb >= 0 ? deb : 0; - int nzn = fin > 0 ? fin : size_vz [cyl]; - - fillCenter (cyl, nz0, nzn); - - for (int nz=nz0 ; nz0) - { - // Edges verticaux + cloisons interieures - for (int ny=0 ; ny0) - { - // Edges verticaux + cloisons interieures - Vertex* vhaut = getVertexIJK (cyl,nx,0, nz-1); - Edge* pilier = addEdge (center, vhaut, cyl, dir_z, nx, 0, nz-1); - - for (int ny=0 ; nygetX () - orig->getX (); - double dy = inter->getY () - orig->getY (); - double dz = inter->getZ () - orig->getZ (); - double dd = sqrt (dx*dx + dy*dy + dz*dz); - return dd; -} -// ===================================================== assoSlice -void CrossElements::assoSlice (int cyl, double* base, double* normal, int nx, - int nzs) -{ - Real3 center, pnt1, pnt2; - // string brep; - - Vertex* v_n = getVertexIJK (cyl, nx, S_N , nzs); - Vertex* v_s = getVertexIJK (cyl, nx, S_S , nzs); - - v_s->getPoint (pnt1); - v_n->getPoint (pnt2); - - double rayon = calc_distance (pnt1, pnt2)/2; - for (int nro=0 ; nroaddCircle (center, rayon, normal, base); - - for (int ny=0 ; nyaddAssociation (edge, subid, angle1*UnSur2pi, angle2*UnSur2pi); - - // Assurer avec les vertex - int ny2 = ny>=S_MAXI-1 ? 0 : ny+1; - Vertex* node1 = getVertexIJK (cyl, nx, ny, nz); - Vertex* node2 = getVertexIJK (cyl, nx, ny2, nz); - - grid_geom->addAssociation (node1, subid, angle1*UnSur2pi); - grid_geom->addAssociation (node2, subid, angle2*UnSur2pi); -} -// ====================================================== getAngleInter -// ==== Angle intersection intermediaire -double CrossElements::getAngleInter (int cyl, int nz) -{ - if (cyl==CylBig && (nz==1 || nz==3)) - return angle_intermed; - else - return angle_inter[cyl]; -} -// ====================================================== getAngle -double CrossElements::getAngle (int cyl, int nj, int nz) -{ - switch (nj) - { - case S_E : return 0; - case S_NE : return angle_inter[cyl]; - case S_N : return M_PI/2; - case S_NW : return M_PI - angle_inter[cyl]; - case S_W : return M_PI; - case S_SW : return M_PI + angle_inter[cyl]; - case S_S : return 3*M_PI/2; - case S_SE : return 2*M_PI - angle_inter[cyl]; - case S_MAXI : return 2*M_PI; - default : break; - } - return 0; -} -// ====================================================== addVertex -void CrossElements::addVertex (int cyl, int ni, int nj, int nk, double px, - double rayon) -{ - if (rayon<0.0) - rayon = cross_rayon [cyl][ni]; - double theta = getAngle (cyl, nj); - - if (cyl==CylSmall) - setVertex (cyl, ni, nj, nk, px, rayon*cos(theta), rayon*sin(theta)); - else - setVertex (cyl, ni, nj, nk, rayon*cos(theta), rayon*sin(theta), px); -} -// ====================================================== addSlice -void CrossElements::addSlice (int cyl, int ni, int nk, double px, double rayon) -{ - for (int nj=0 ; nj < S_MAXI ; nj++) - addVertex (cyl, ni, nj, nk, px, rayon); -} -END_NAMESPACE_HEXA diff --git a/src/HEXABLOCK/HexCrossElements_build.cxx b/src/HEXABLOCK/HexCrossElements_build.cxx deleted file mode 100755 index 6b4fda5..0000000 --- a/src/HEXABLOCK/HexCrossElements_build.cxx +++ /dev/null @@ -1,635 +0,0 @@ - -// C++ : Gestion des cylindres croises : construction - -// Copyright (C) 2009-2013 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. -// -// 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 "HexCrossElements.hxx" - -#include "HexDocument.hxx" -#include "HexVector.hxx" -#include "HexVertex.hxx" -#include "HexHexa.hxx" -#include "HexEdge.hxx" - -#include "HexGlobale.hxx" -#include "HexCylinder.hxx" -#include "HexNewShape.hxx" -#include "HexBiCylinderShape.hxx" -#include "HexAssoEdge.hxx" -#include "HexEdgeShape.hxx" - -static bool db = false; - -BEGIN_NAMESPACE_HEXA - -static const int MaxLevel = 7; -static const double epaiss2 = 0.5; -static const double UnSur2pi = DEMI/M_PI; - -double calcul_centre (Vertex* orig, Vertex* inter); - -// ====================================================== createBigCyl -void CrossElements::createBigCyl () -{ - const int iv0 = 0; - const int kv_mil = cyl_left != NO_PIPE ? 2 : 3 ; - - enum { k0, k1, k2, k3, k4 }; - double z0, z2, z4; - - z0 = big_hauteur[0] = - calcul_centre (cross_cyl2->getBase(), cross_center); - z4 = big_hauteur[4] = z0 + cross_cyl2->getHeight (); - - big_hauteur[1] = getVertexIJK (CylSmall, NxExt, S_SE, kv_mil)->getZ(); - z2 = big_hauteur[2] = getVertexIJK (CylSmall, NxExt, S_E, kv_mil)->getZ(); - big_hauteur[3] = getVertexIJK (CylSmall, NxExt, S_NE, kv_mil)->getZ(); - - setVertex (CylBig, iv0, 0, k0, 0, 0, z0); - addSlice (CylBig, NxInt, k0, z0); - addSlice (CylBig, NxExt, k0, z0); - - setVertex (CylBig, iv0, 0, k4, 0, 0, z4); - addSlice (CylBig, NxInt, k4, z4); - addSlice (CylBig, NxExt, k4, z4); - - //------------------------------- Points intermediaires : - - double xe1 = getVertexIJK (CylBig, NxExt, S_N, k0)->getX(); - double ye1 = getVertexIJK (CylBig, NxExt, S_N, k0)->getY(); - - double xe2 = getVertexIJK (CylBig, NxExt, S_S, k0)->getX(); - double ye2 = getVertexIJK (CylBig, NxExt, S_S, k0)->getY(); - - double xi1 = getVertexIJK (CylBig, NxInt, S_N, k0)->getX(); - double yi1 = getVertexIJK (CylBig, NxInt, S_N, k0)->getY(); - - double xi2 = getVertexIJK (CylBig, NxInt, S_S, k0)->getX(); - double yi2 = getVertexIJK (CylBig, NxInt, S_S, k0)->getY(); - - //------------------------------- Reprise des vertex du cylindre 1 - - //------------------------------- Centre - if (grid_type != GR_BIPIPE) - copyVertex (NxExt, S_S, 3, iv0, 0, k1); - - //------------------------------- Creation Vertex Nord-Sud - for (int nk=k1 ; nkgetX(); - double py = node->getY(); - for (int nk=1; nk<4 ; nk++) - { - node = getVertexIJK (CylBig, NxInt, nj, nk); - if (node != NULL) - { - node -> setX (px); - node -> setY (py); - } - } - } - } - fillGrid (CylBig); -} -// ====================================================== createLittleCyl -void CrossElements::createLittleCyl () -{ - double c1 = calcul_centre (cross_cyl1->getBase(), cross_center); - // double cosalpha = cos (angle_inter[CylBig]); - double prayext = cross_rayon [CylBig][NxExt]; // * cosalpha; - double prayint = cross_rayon [CylBig][NxInt]; // * cosalpha; - - double t_haut [MaxLevel] = { -c1, -prayext, -prayint, - 0, prayint, prayext, - cross_cyl1->getHeight () -c1 }; - - double rm = ( cross_rayon [CylSmall][NxExt] - + cross_rayon [CylSmall][NxInt]) / 2; - double rc = cross_rayon [CylBig] [NxInt]; - - double t_rayext [MaxLevel] = { -1, -1, rm, rc, rm, -1, -1 }; - -/* ******************************************************************* - int nkdeb = at_left ? 0 : size_v1z/2; - int nkfin = at_right ? size_v1z : size_v1z/2; - ******************************************************************* */ - - int nkdeb, nkfin; - switch (cyl_left) - { - case IS_HERE : nkdeb = 0; - break; - case NO_PIPE : nkdeb = size_v1z/2; - break; - case NO_CYL : nkdeb = 1; - break; - } - switch (cyl_right) - { - case IS_HERE : nkfin = size_v1z; - break; - case NO_PIPE : nkfin = size_v1z/2; - break; - case NO_CYL : nkfin = size_v1z-1; - break; - } - - for (int nk = nkdeb ; nkgetRadius() < lautre->getRadius()) - { - cross_cyl1 = lun; - cross_cyl2 = lautre; - } - else - { - cross_cyl1 = lautre; - cross_cyl2 = lun; - } - - double pr = cross_cyl1->getRadius (); - double gr = cross_cyl2->getRadius (); - if (pr>=gr*0.95) - { - cout << " **** crossCylinders : les deux rayons sont trop proches" - << endl; - setError (HERR); - return HERR; - } - - cross_center = cross_cyl2->interCylinder(cross_cyl1, at_left, at_right); - if (cross_center==NULL) - { - setError (HERR); - return HERR; - } - - if (at_left) cyl_left = IS_HERE; - else if (grid_type == GR_BIPIPE) cyl_left = NO_PIPE; - else cyl_left = NO_CYL; - - if (at_right) cyl_right = IS_HERE; - else if (grid_type == GR_BIPIPE) cyl_right = NO_PIPE; - else cyl_right = NO_CYL; - - double cross_gray1 = cross_cyl1->getRadius (); - double cross_gray2 = cross_cyl2->getRadius (); - double cross_igray1 = cross_gray1 * epaiss2; - double cross_igray2 = cross_gray2 * epaiss2; - - if (db) - { - HexDisplay (cross_gray1); - HexDisplay (cross_gray2); - HexDisplay (cross_igray2); - HexDisplay (cross_igray1); - } - - angle_inter [CylSmall] = M_PI/6; - angle_inter [CylBig] = asin (cross_gray1/cross_gray2); - angle_intermed = angle_inter [CylBig]; - - cross_rayon [CylSmall] [0] = cross_rayon [CylBig] [0] = 0; - - cross_rayon [CylSmall] [NxInt] = cross_igray1; - cross_rayon [CylSmall] [NxExt] = cross_gray1; - cross_rayon [CylBig] [NxInt] = cross_igray2; - cross_rayon [CylBig] [NxExt] = cross_gray2; - - createLittleCyl (); - createBigCyl (); - - double h1=0, h3=0, dx=1 , dy=1; - if (cyl_left!=NO_PIPE) - { - adjustLittleSlice (NxExt, 1, NxExt); - adjustLittleSlice (NxInt, 1, NxExt); - if (grid_type == GR_BIPIPE) - adjustLittleSlice (NxInt, 2, NxInt); - dx = getVertexIJK (CylBig, NxExt, S_NW, 1)->getX(); - dy = getVertexIJK (CylBig, NxExt, S_NW, 1)->getY(); - h1 = getVertexIJK (CylBig, NxExt, S_NW, 1)->getZ(); - h3 = getVertexIJK (CylBig, NxExt, S_NW, 3)->getZ(); - } - - if (cyl_right!=NO_PIPE) - { - adjustLittleSlice (NxExt, 5, NxExt); - adjustLittleSlice (NxInt, 5, NxExt); - if (grid_type == GR_BIPIPE) - adjustLittleSlice (NxInt, 4, NxInt); - dx = -getVertexIJK (CylBig, NxExt, S_NE, 1)->getX(); - dy = getVertexIJK (CylBig, NxExt, S_NE, 1)->getY(); - h1 = getVertexIJK (CylBig, NxExt, S_NE, 1)->getZ(); - h3 = getVertexIJK (CylBig, NxExt, S_NE, 3)->getZ(); - } - - for (int ny=0 ; nysetZ(h1); - getVertexIJK (CylBig, NxExt, ny, 3)->setZ(h3); - } - } - - angle_intermed = atan (dy/dx); - Vector* iprim = new Vector (cross_cyl1->getDirection()); - Vector* kprim = new Vector (cross_cyl2->getDirection()); - Vector* jprim = new Vector (kprim); - - iprim->renormer (); - kprim->renormer (); - jprim->vectoriel (kprim, iprim); - - transfoVertices (cross_center, iprim, jprim, kprim); - - Real3 snorm, bnorm; - iprim->getCoord (snorm); - kprim->getCoord (bnorm); - - char name [12]; - sprintf (name, "grid_%02d", el_id); - grid_geom = el_root->addShape (name, SH_INTER); - grid_geom -> openShape(); - assoCylinder (CylSmall, snorm); - assoCylinder (CylBig, bnorm); - grid_geom -> closeShape(); - - if (cyl_left == IS_HERE) - { - assoIntersection (NxExt, 1, snorm, bnorm); - if (grid_type == GR_BIPIPE) - { - assoIntersection (NxInt, 2, snorm, bnorm); - } - } - - if (cyl_right == IS_HERE) - { - assoIntersection (NxExt, NbrSlices1-1, snorm, bnorm); - if (grid_type == GR_BIPIPE) - { - assoIntersection (NxInt, NbrSlices1-2, snorm, bnorm); - } - } - - if (cyl_left == IS_HERE) - { - adjustAsso (NxExt, S_N, 1, V_AVAL); - adjustAsso (NxExt, S_SW, 1, V_AMONT); - - adjustAsso (NxExt, S_N, 3, V_AVAL); - adjustAsso (NxExt, S_SW, 3, V_AMONT); - } - - if (cyl_right == IS_HERE) - { - adjustAsso (NxExt, S_NE, 1, V_AMONT); - adjustAsso (NxExt, S_S, 1, V_AVAL); - - adjustAsso (NxExt, S_NE, 3, V_AMONT); - adjustAsso (NxExt, S_S, 3, V_AVAL); - } - - // assoResiduelle (); - return HOK; -} -// ====================================================== copyVertex -void CrossElements::copyVertex (int i1, int j1, int k1, int i2, int j2, int k2) -{ - Vertex* node = getVertexIJK (CylSmall, i1, j1, k1); - if (node!=NULL) - { - setVertex (node, CylBig, i2, j2, k2); - return; - } - - double rayon = cross_rayon [CylBig][i2]; - double hauteur = big_hauteur [k2]; - - addVertex (CylBig, i2, j2, k2, hauteur, rayon); -} -// ===================================================== assoCylinder -void CrossElements::assoCylinder (int cyl, double* normal) -{ - Real3 base, vec1, center, east, west, nordest; - int nk = 0; - if (cyl==CylSmall && cyl_left != IS_HERE) - nk = size_hz[cyl]; - - Vertex* v_e = getVertexIJK (cyl, NxExt, S_E , nk); - Vertex* v_ne = getVertexIJK (cyl, NxExt, S_NE, nk); - Vertex* v_w = getVertexIJK (cyl, NxExt, S_W , nk); - - v_e->getPoint (east); - v_w->getPoint (west); - calc_vecteur (west, east, base); - - for (int nro=0 ; nrogetPoint (nordest); - calc_vecteur (center, nordest, vec1); - - double ps = prod_scalaire (base, vec1); - double pnorm = calc_norme(base) * calc_norme(vec1); - - angle_inter [cyl] = acos (ps/pnorm); - - if (cyl==CylBig || at_left) - { - assoSlice (cyl, base, normal, NxExt, 0); - if (grid_type == GR_BIPIPE) - { - assoSlice (cyl, base, normal, NxInt, 0); - assoSlice (cyl, base, normal, NxInt, 1); - } - } - - if (cyl==CylBig || cyl_right == IS_HERE) - { - assoSlice (cyl, base, normal, NxExt, size_hz[cyl]); - if (grid_type == GR_BIPIPE) - { - assoSlice (cyl, base, normal, NxInt, size_hz[cyl]); - assoSlice (cyl, base, normal, NxInt, size_hz[cyl]-1); - } - } - - if (cyl==CylBig) - for (int nz=1 ; nz<=3 ; nz++) - assoBigMiddle (base, normal, nz); -} -// ===================================================== assoBigMiddle -void CrossElements::assoBigMiddle (double* base, double* normal, int nzs) -{ - Real3 center, pnt1, pnt2; - int nx = NxExt; - - Vertex* v_n = getVertexIJK (CylBig, nx, S_N , nzs); - Vertex* v_s = getVertexIJK (CylBig, nx, S_S , nzs); - - v_s->getPoint (pnt1); - v_n->getPoint (pnt2); - - double rayon = calc_distance (pnt1, pnt2)/2; - // double alpha = angle_inter [CylBig]; - // if (nzs != 2) - // { - // double h1 = cross_rayon[CylSmall][NxExt] * cos (angle_inter[CylSmall]); - // alpha = asin (h1/cross_rayon[CylBig][NxExt]); - // } - - for (int nro=0 ; nroaddCircle (center, rayon, normal, base); - - if (cyl_right != IS_HERE) - { - assoArc (CylBig, NxExt, S_SE, nzs, subid); - assoArc (CylBig, NxExt, S_E, nzs, subid); - } - - assoArc (CylBig, NxExt, S_NE, nzs, subid); - assoArc (CylBig, NxExt, S_N , nzs, subid); - - if (cyl_left != IS_HERE) - { - assoArc (CylBig, NxExt, S_NW, nzs, subid); - assoArc (CylBig, NxExt, S_W , nzs, subid); - } - - assoArc (CylBig, NxExt, S_SW, nzs, subid); - assoArc (CylBig, NxExt, S_S , nzs, subid); -} -// ====================================================== adjustLittleSlice -void CrossElements::adjustLittleSlice (int ni, int nk, int nibig) -{ - Vertex* node = getVertexIJK (CylSmall, ni, S_N, nk); - if (node==NULL) - return; - - double grayon2 = cross_rayon[CylBig][nibig] * cross_rayon[CylBig][nibig]; - double prayon = cross_rayon[CylSmall][ni]; - - for (int nj=0; njgetX(); - if (qx>=0) node->setX ( px); - else node->setX (-px); - node->setY (py); - node->setZ (pz); - } -} -// ===================================================== assoIntersection -int CrossElements::assoIntersection (int nxs, int nzs, double* snorm, - double* bnorm) -{ - Real3 center; - Real3 pse, psw, sorig, sbase; - Real3 pbe, pbw, borig, bbase; - - cross_center->getPoint (center); - int nz = nzs < MiddleSlice1 ? 0 : NbrSlices1; - - getVertexIJK (CylSmall, nxs, S_E , nz)->getPoint (pse); - getVertexIJK (CylSmall, nxs, S_W , nz)->getPoint (psw); - getVertexIJK (CylBig, nxs, S_E , 0) ->getPoint (pbe); - getVertexIJK (CylBig, nxs, S_W , 0) ->getPoint (pbw); - - double srayon = calc_distance (pse, psw)/2; - double brayon = calc_distance (pbe, pbw)/2; - - calc_milieu (psw, pse, sorig); - calc_milieu (pbw, pbe, borig); - calc_vecteur (psw, pse, sbase); - calc_vecteur (pbw, pbe, bbase); - - double shaut = calc_distance (center, sorig); - double bhaut = calc_distance (center, borig)*2; - double* orig = nzs < MiddleSlice1 ? sorig : center; // Pb orientation - - BiCylinderShape bicyl_shape (el_root); - int ier = bicyl_shape.defineCyls (borig, bnorm, bbase, brayon, bhaut, - orig, snorm, sbase, srayon, shaut); - if (ier != HOK) - return ier; - - for (int ny=S_E ; ny<=S_SE ; ny++) - { - Vertex* node = getVertexIJK (CylSmall, nxs, ny, nzs); - if (node!=NULL) - node->clearAssociation (); - } - - for (int ny=S_E ; ny<=S_SE ; ny++) - { - Edge* edge = getEdgeJ (CylSmall, nxs, ny, nzs); - bicyl_shape.associate (edge); - } - - return HOK; -} -// ===================================================== adjustAsso -void CrossElements::adjustAsso (int nx, int ny, int nz, int sens) -{ - Edge* edge = getEdgeJ (CylBig, nx, ny, nz); - if (edge==NULL) - return; - - Real3 point; - Vertex* vertex = edge->getVertex (sens); - AssoEdge* asso = edge->getAssociation (0); - if (asso==NULL) - return; - - vertex->getPoint (point); - - EdgeShape* line = asso->getEdgeShape (); - double param = line->getParam (point); - - if (param<0) - return; - if (sens==V_AMONT) - asso->setStart (param); - else - asso->setEnd (param); -} -END_NAMESPACE_HEXA diff --git a/src/HEXABLOCK/HexCylinder.cxx b/src/HEXABLOCK/HexCylinder.cxx deleted file mode 100644 index 0211f7a..0000000 --- a/src/HEXABLOCK/HexCylinder.cxx +++ /dev/null @@ -1,289 +0,0 @@ - -// C++ : Gestion des cylindres - -// Copyright (C) 2009-2013 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. -// -// 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 "HexCylinder.hxx" -#include "HexVertex.hxx" -#include "HexVector.hxx" -#include "HexXmlWriter.hxx" -#include "HexDocument.hxx" - -#include - -BEGIN_NAMESPACE_HEXA - -bool is_out (double val, double orig, double lg); - -// ======================================================== Constructeur -Cylinder::Cylinder(Vertex* b, Vector* v, double r, double h) - : EltBase (b->dad(), EL_CYLINDER) -{ - c_base = b; - c_dir = v; - c_radius = r; - c_height = h; - - if (el_root->debug ()) - { - Echo ("---------------------------------- AddCylinder"); - HexDisplay (c_radius); - HexDisplay (c_height); - HexDump (c_base); - HexDump (c_dir); - cout << endl; - } - - if (c_base==NULL || c_dir==NULL || el_root==NULL) - setError (); - else - { - double tol = el_root->getTolerance (); - double norme = c_dir ->getNorm (); - if (c_radius <= tol || c_height <= tol || norme <= tol) - setError (); - } -} -// ======================================================== rdiffers -bool rdiffers (double v1, double v2) -{ - double dd = v1-v2; - return dd*dd > 1e-12; -} -// ======================================================== norme -double norme (double px, double py, double pz) -{ - double res = sqrt (px*px + py*py + pz*pz); - return res; -} -// ======================================================== interCylinder -/// Intersection de 2 droites (c1,v1) et (c2,v2) -/// Le point M(x,yz) est solutions de 2 equations : -/// (c1,m) = k * v1 -/// (c2,m) vectoriel v2 = 0 -/// -/// x = xc1 + k * xv1 (1) -/// y = yc1 + k * yv1 (2) -/// z = zc1 + k * zv1 (3) -/// (x-xc2) * yv2 - (y-yc2) * xv2 = 0 (4) -/// (z-zc2) * yv2 - (y-yc2) * zv2 = 0 (5) -/// (x-xc2) * zv2 - (z-zc2) * xv2 = 0 (6) -/// -/// En substituant les (x,y,z) -/// -/// (k*xv1+xc1-xc2) * yv2 - (k*yv1+yc1-yc2) * xv2 = 0 (4) -/// (k*zv1+zc1-zc2) * yv2 - (k*yv1+yc1-yc2) * zv2 = 0 (5) -/// (k*xv1+xc1-xc2) * zv2 - (k*zv1+zc1-zc2) * xv2 = 0 (6) -/// -/// k * (xv1*yv2 - yv1*xv2) + (xc1-xc2) * yv2 - (yc1-yc2) * xv2 = 0 (4) -/// k * dxy - nxy = 0 (4) -/// k * dzy - nzy = 0 (5) -/// k * dxz - nxz = 0 (6) -/// -/// nxy = (xc2-xc1) * yv2 - (yc2-yc1) * xv2 -/// dxy = xv1*yv2 - yv1*xv2 -/// -// ======================================================== interCylinder -Vertex* Cylinder::interCylinder(Cylinder* small, bool& left, bool& right) -{ - Real3 orig; - int ier = interCylinder (small, left, right, orig); - if (ier!=HOK) - return NULL; - - Vertex* sol = new Vertex (c_base->dad(), orig[0], orig[1], orig[2]); - return sol; -} -/// -// ======================================================== interCylinder -int Cylinder::interCylinder (Cylinder* small, bool& left, bool& right, - double* orig) -{ - left = right = true; - if (el_root->debug ()) - { - Echo ("---------------------------------- interCylinders"); - PutData (this->c_radius); - PutData (small->c_radius); - PutData (this->c_height); - PutData (small->c_height); - HexDump (this->c_base); - HexDump (small->c_base); - HexDump (this->c_dir); - HexDump (small->c_dir); - } - - double norm1 = c_dir->getNorm(); - double norm2 = small->c_dir->getNorm(); - - double xc1 = c_base->getX(); - double yc1 = c_base->getY(); - double zc1 = c_base->getZ(); - - double xc2 = small->c_base->getX(); - double yc2 = small->c_base->getY(); - double zc2 = small->c_base->getZ(); - - double xv1 = c_dir->getDx()/norm1; - double yv1 = c_dir->getDy()/norm1; - double zv1 = c_dir->getDz()/norm1; - - double xv2 = small->c_dir->getDx()/norm2; - double yv2 = small->c_dir->getDy()/norm2; - double zv2 = small->c_dir->getDz()/norm2; - - double nxyz [DIM3] = { (xc2-xc1) * yv2 - (yc2-yc1) * xv2, - (zc2-zc1) * yv2 - (yc2-yc1) * zv2, - (xc2-xc1) * zv2 - (zc2-zc1) * xv2 }; - - double dxyz [DIM3] = { xv1*yv2 - yv1*xv2, - zv1*yv2 - yv1*zv2, - xv1*zv2 - zv1*xv2 }; - double lambda = 0; - bool prems = true; - for (int dd=0 ; ddc_base->getPoint (base1); - small->c_base->getPoint (base2); - - this ->c_dir->getCoord (dir1); - small->c_dir->getCoord (dir2); - - for (int dd=dir_x ; dd<=dir_z ; dd++) - { - extr1 [dd] = base1[dd] + dir1[dd]*this ->c_height/norm1; - extr2 [dd] = base2[dd] + dir2[dd]*small->c_height/norm2; - } - - double dbase1 = calc_distance (orig, base1); - double dbase2 = calc_distance (orig, base2); - double dextr1 = calc_distance (orig, extr1); - double dextr2 = calc_distance (orig, extr2); - - double dmin2 = std::min (dbase2, dextr2); - double dmax2 = std::max (dbase2, dextr2); - double dmax1 = std::max (dbase1, dextr1); - double coeff = 1.1; - // Appartenance axe petit cylindre - if (dmax2 > small->c_height + c_radius) - { - cout << "*** InterCylinders : Petit cylindre trop court" << endl; - cout << "*** Intersection = (" << orig[0] << ", " << orig[1] - << ", " << orig[2] << " )" << endl; - cout << "*** distance = " << dmin2 - << " > gros rayon + longueur " - << small->c_height + c_radius << endl; - cout << endl; - PutCoord (base2); - PutCoord (extr2); - PutData(dbase2); - PutData(dextr2); - PutData(dextr2); - return HERR; - } - - left = dbase2 > c_radius*coeff; - right = dextr2 > c_radius*coeff; - // Le gros cylindre doit depasser le petit - if (dmax1 > c_height-coeff*small->c_radius) - { - cout << "*** InterCylinders : Gros cylindre trop court" << endl; - cout << "*** Intersection = (" << orig[0] << ", " << orig[1] - << ", " << orig[2] << " )" << endl; - cout << "*** distance maximale = " << dmax1 << endl; - cout << endl; - return HERR; - } - - if (el_root->debug ()) - { - PutCoord (orig); - HexDisplay (left); - HexDisplay (right); - } - return HOK; -} -// ======================================================== is_out -bool is_out (double val, double v1, double v2) -{ - if (v1 < v2) - return (val < v1-Epsil || val > v2+Epsil) ; - - else if (v1 > v2) - return (val < v2-Epsil || val > v1+Epsil) ; - - else - return fabs (val - v1)>Epsil; -} -// ========================================================= saveXml -void Cylinder::saveXml (XmlWriter* xml) -{ - char buffer[12]; - - xml->openMark ("Cylinder"); - xml->addAttribute ("c_base", c_base->getName (buffer)); - xml->addAttribute ("c_dir", c_dir->getName (buffer)); - xml->addAttribute ("c_radius", c_radius); - xml->addAttribute ("c_height", c_height); - xml->closeMark (); -} -END_NAMESPACE_HEXA - diff --git a/src/HEXABLOCK/HexDocument.hxx b/src/HEXABLOCK/HexDocument.hxx index 991de22..dacddc6 100755 --- a/src/HEXABLOCK/HexDocument.hxx +++ b/src/HEXABLOCK/HexDocument.hxx @@ -23,21 +23,14 @@ #ifndef __DOCUMENT_H_ #define __DOCUMENT_H_ -#include "Hex_defines.hxx" #include "HexEltBase.hxx" -#ifdef WIN32 - #ifdef max - #undef max -#endif -#endif - BEGIN_NAMESPACE_HEXA -class NewShape; +class HexaExport NewShape; -class HEXABLOCKENGINE_EXPORT Document : public EltBase +class Document : public EltBase { // Fonctions utilisateur public : diff --git a/src/HEXABLOCK/HexDocument_Xml.cxx b/src/HEXABLOCK/HexDocument_Xml.cxx index 39cfb4b..8238bd4 100755 --- a/src/HEXABLOCK/HexDocument_Xml.cxx +++ b/src/HEXABLOCK/HexDocument_Xml.cxx @@ -20,7 +20,7 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "HexDocument.hxx" -#include +// #include #include // Pour atoi et atof #include "Hex.hxx" @@ -121,7 +121,8 @@ int Document::loadXml (cpchar ficname) { XmlTree xml(""); string filename = ficname; - el_name = Kernel_Utils::GetBaseName ((pchar)ficname); + //el_name = Kernel_Utils::GetBaseName ((pchar)ficname); + make_basename (ficname, el_name); static const int NbExt = 3; static cpchar t_ext [NbExt] = { ".xml", ".XML", ".Xml" }; diff --git a/src/HEXABLOCK/HexDocument_del.cxx b/src/HEXABLOCK/HexDocument_del.cxx deleted file mode 100644 index 9e17c93..0000000 --- a/src/HEXABLOCK/HexDocument_del.cxx +++ /dev/null @@ -1,378 +0,0 @@ - -// C++ : Fonctions perimees de HexDocument - -// Copyright (C) 2009-2013 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. -// -// 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 "HexDocument.hxx" - -#include "HexEltBase.hxx" -#include "HexVertex.hxx" -#include "HexEdge.hxx" -#include "HexQuad.hxx" -#include "HexHexa.hxx" - -#include "HexElements.hxx" -#include "HexCrossElements.hxx" - -#include "HexVector.hxx" -#include "HexCylinder.hxx" -#include "HexPipe.hxx" -#include "HexMatrix.hxx" -#include "HexCloner.hxx" -#include "HexPropagation.hxx" -#include "HexLaw.hxx" - -#include "HexXmlWriter.hxx" -#include "HexXmlTree.hxx" -#include "HexGlobale.hxx" -#include "HexGroup.hxx" -#include "Hex.hxx" -#include "HexNewShape.hxx" - -BEGIN_NAMESPACE_HEXA - - -// ======================================================== makeCartesian -Elements* Document::makeCartesian (Vertex* v, Vector* dir, - int px, int py, int pz, int mx, int my, int mz) -{ - DumpStart ("makeCartesianDiag", v << dir << px << py << pz << mx << my << mz); - - Vector* v1 = new Vector (this, dir->getDx(), 0, 0); - Vector* v2 = new Vector (this, 0, dir->getDy(), 0); - Vector* v3 = new Vector (this, 0,0, dir->getDz()); - Elements* grille = new Elements (this); - grille->makeCartesianGrid (v, v1, v2, v3, px, py, pz, mx, my, mz); - - DumpReturn (grille); - return grille; -} -// ======================================================== makeCartesian -Elements* Document::makeCartesian (Vertex* v, Vector* v1, Vector* v2, - Vector* v3, int px, int py, int pz) -{ - DumpStart ("makeCartesian", v << v1 << v2 << v3 << px << py << pz); - - Elements* grille = new Elements (this); - grille->makeCartesianGrid (v, v1, v2, v3, px, py, pz); - - DumpReturn (grille); - return grille; -} -// ======================================================== makeCartesian1 -Elements* Document::makeCartesian1 (Vertex* v, Vector* v1, Vector* v2, - Vector* v3, int px, int py, int pz, int mx, int my, int mz) -{ - DumpStart ("makeCartesian1", v << v1 << v2 << v3 << px << py << pz - << mx << my << mz); - - Elements* grille = new Elements (this); - grille->makeCartesianGrid (v, v1, v2, v3, px, py, pz, mx, my, mz); - - DumpReturn (grille); - return grille; -} -// ======================================================== makeSpherical -Elements* Document::makeSpherical (Vertex* c, double rayon, int nb, double k) -{ - DumpStart ("makeSpherical", c << rayon << nb << k ); - - Elements* grille = new Elements (this); - grille->makeSphericalGrid (c, rayon, nb, k); - - DumpReturn (grille); - return grille; -} -// ======================================================== makeCylindrical -Elements* Document::makeCylindrical (Vertex* c, Vector* b, Vector* h, - double dr, double da, double dl, int nr, int na, int nl, bool fill) -{ - DumpStart ("makeCylindrical", c << b << h << dr << da << dl << nr << na - << nl << fill); - - Elements* grille = new Elements (this); - grille->makeCylindricalGrid (c, b, h, dr, da, dl, nr, na, nl, fill); - - DumpReturn (grille); - return grille; -} -// ======================================================== makeSphere -Elements* Document::makeSphere (Vertex* center, Vector* vx, Vector* vz, - double radius, double radhole, Vertex* plorig, - int nrad, int nang, int nhaut) -{ - DumpStart ("makeSphere", center << vx << vz << radius << radhole << plorig - << nrad << nang << nhaut); - - Elements* grille = new Elements (this); - double radint = (radhole + radius)*DEMI; - grille->makeRind (GR_HEMISPHERIC, center, vx, vz, radius, radint, radhole, - plorig, 360.0, nrad, nang, nhaut); - - DumpReturn (grille); - return grille; -} -// ======================================================== makePartSphere -Elements* Document::makePartSphere (Vertex* center, Vector* vx, Vector* vz, - double radius, double radhole, - Vertex* plorig, double angle, - int nrad, int nang, int nhaut) -{ - DumpStart ("makePartSphere", center << vx << vz - << radius << radhole - << plorig << angle - << nrad << nang << nhaut); - - Elements* grille = new Elements (this); - double radint = (radhole + radius)*DEMI; - grille->makeRind (GR_PART_SPHERIC, center, vx, vz, radius, radint, radhole, - plorig, angle, nrad, nang, nhaut); - - DumpReturn (grille); - return grille; -} -// ======================================================== makeRind -Elements* Document::makeRind (Vertex* center, Vector* vx, Vector* vz, - double radext, double radint, double radhole, - Vertex* plorig, int nrad, int nang, int nhaut) -{ - DumpStart ("makeRind", center << vx << vz - << radext << radint << radhole - << plorig << nrad << nang << nhaut); - - Elements* grille = new Elements (this); - grille->makeRind (GR_RIND, center, vx, vz, radext, radint, radhole, - plorig, 360.0, nrad, nang, nhaut); - - DumpReturn (grille); - return grille; -} -// ======================================================== makePartRind -Elements* Document::makePartRind (Vertex* center, Vector* vx, Vector* vz, - double radext, double radint, double radhole, - Vertex* plorig, double angle, - int nrad, int nang, int nhaut) -{ - DumpStart ("makePartRind", center << vx << vz - << radext << radint << radhole - << plorig << angle << nrad << nang << nhaut); - - Elements* grille = new Elements (this); - grille->makeRind (GR_PART_RIND, center, vx, vz, radext, radint, radhole, - plorig, angle, nrad, nang, nhaut); - - DumpReturn (grille); - return grille; -} -// ======================================================== prismQuad -Elements* Document::prismQuad (Quad* qstart, Vector* dir, int nb) -{ - DumpStart ("prismQuad", qstart << dir << nb); - - Quads tstart; - tstart.push_back (qstart); - - update (); - Elements* prisme = prismQuads (tstart, dir, nb); - - DumpReturn (prisme); - return prisme; -} -// ======================================================== prismQuads -Elements* Document::prismQuads (Quads tstart, Vector* dir, int nb) -{ - DumpStart ("prismQuads", tstart << dir << nb); - - Elements* prisme = new Elements (this); - - prisme->prismQuads (tstart, dir, nb); - - DumpReturn (prisme); - return prisme; -} -// ======================================================== prismQuadsVec -Elements* Document::prismQuadsVec (Quads tstart, Vector* dir, RealVector tlen, - int crit) -{ - DumpStart ("prismQuadVec", tstart << dir << tlen << crit); - Elements* prisme = new Elements (this); - if (tlen.size()<=0) return prisme; - - prisme->prismQuadsVec (tstart, dir, tlen, crit); - - DumpReturn (prisme); - return prisme; -} -// ======================================================== joinQuads -Elements* Document::joinQuads (Quads tstart, Quad* dest, Vertex* v1, - Vertex* v2, Vertex* v3, Vertex* v4, int nb) -{ - DumpStart ("joinQuads", tstart << dest << v1 << v2 << v3 << v4 << nb); - update (); - Elements* joint = new Elements (this); - if (nb<=0) return joint; - - int ier = joint->joinQuads (tstart, nb, v1, v2, v3, v4, dest); - if (ier !=HOK) - printf ("\n ****\n **** Error in joinQuad(s)\n ****\n"); - - DumpReturn (joint); - return joint; -} -// ======================================================== joinQuad -Elements* Document::joinQuad (Quad* qstart, Quad* dest, Vertex* v1, - Vertex* v2, Vertex* v3, Vertex* v4, int nb) -{ - DumpStart ("joinQuad", qstart << dest << v1 << v2 << v3 << v4 << nb); - - Quads tstart; - tstart.push_back (qstart); - - Elements* joint = joinQuads (tstart, dest, v1, v2, v3, v4, nb); - - DumpReturn (joint); - return joint; -} -// ======================================================== cut -Elements* Document::cut (Edge* edge, int nbcuts) -{ - Elements* t_hexas = new Elements (this); - - if (edge==NULL || nbcuts<=0) - return t_hexas; - - Propagation* prop = findPropagation (edge); - const Edges& t_edges = prop->getEdges (); - - t_hexas->cutHexas (t_edges, nbcuts); - - majPropagation (); - return t_hexas; -} -// ======================================================== makeCylinder -Elements* Document::makeCylinder (Cylinder* cyl, Vector* base, int nr, int na, - int nl) -{ - DumpStart ("makeCylinder", cyl << base << nr << na << nl); - - Elements* grille = new Elements (this); - grille->makeCylinder (cyl, base, nr, na, nl); - - DumpReturn (grille); - return grille; -} -// ======================================================== makeCylinders -CrossElements* Document::makeCylinders (Cylinder* cyl1, Cylinder* cyl2) -{ - DumpStart ("makeCylinders", cyl1 << cyl2 ); - - CrossElements* grille = new CrossElements (this, GR_BICYL); - grille->crossCylinders (cyl1, cyl2, true); - - DumpReturn (grille); - return grille; -} - -// ======================================================== makePipe -Elements* Document::makePipe (Pipe* pipe, Vector* bx, int nr, int na, int nl) -{ - DumpStart ("makePipe", - pipe << bx << nr << na << nl); - - Elements* grille = new Elements (this); - grille->makePipe (pipe, bx, nr, na, nr); - - DumpReturn (grille); - return grille; -} -// ======================================================== makePipes -CrossElements* Document::makePipes (Pipe* pipe1, Pipe* pipe2) -{ - DumpStart ("makePipes", - pipe1 << pipe2); - - CrossElements* grille = new CrossElements (this, GR_BIPIPE); - grille->crossCylinders (pipe1, pipe2, false); - - DumpReturn (grille); - return grille; -} -// ======================================================== getCylinder -Cylinder* Document::getCylinder (int nro) -{ - int size = doc_cylinder.size(); - if (nro>=0 && nro=0 && nrorevolutionQuads (start, orig, axis, angles); - return prisme; -} -// ======================================================== makeCylindricals -Elements* Document::makeCylindricals (Vertex* c, Vector* b, Vector* h, - RealVector tdr, RealVector tda, RealVector tdl, bool fill) -{ - Elements* grille = new Elements (this); - grille->makeCylindricalGrid (c, b, h, tdr, tda, tdl, fill); - return grille; -} -END_NAMESPACE_HEXA diff --git a/src/HEXABLOCK/HexDumpStudy.cxx b/src/HEXABLOCK/HexDumpStudy.cxx index 21445b6..d13effe 100755 --- a/src/HEXABLOCK/HexDumpStudy.cxx +++ b/src/HEXABLOCK/HexDumpStudy.cxx @@ -90,7 +90,7 @@ bool DumpStudy::start (cpchar obj, cpchar method, bool raz) // =================================================== operator << (int) DumpStudy& DumpStudy::operator << (int val) { - if (! is_open) + if (NOT is_open) return *this; char valeur [20]; @@ -102,7 +102,7 @@ DumpStudy& DumpStudy::operator << (int val) // =================================================== operator << (double) DumpStudy& DumpStudy::operator << (double val) { - if (! is_open) + if (NOT is_open) return *this; char valeur [20]; @@ -114,7 +114,7 @@ DumpStudy& DumpStudy::operator << (double val) // =================================================== operator << (cpchar) DumpStudy& DumpStudy::operator << (cpchar val) { - if (! is_open) + if (NOT is_open) return *this; string valeur ("'"); @@ -127,7 +127,7 @@ DumpStudy& DumpStudy::operator << (cpchar val) // =================================================== operator << (elt) DumpStudy& DumpStudy::operator << (EltBase* elt) { - if (! is_open) + if (NOT is_open) return *this; cpchar name = findName (elt); @@ -137,7 +137,7 @@ DumpStudy& DumpStudy::operator << (EltBase* elt) // =================================================== operator << (Quads) DumpStudy& DumpStudy::operator << (Quads& tab) { - if (! is_open) + if (NOT is_open) return *this; TabElts& tabelt = (TabElts&) tab; @@ -147,7 +147,7 @@ DumpStudy& DumpStudy::operator << (Quads& tab) // =================================================== operator << (Edges) DumpStudy& DumpStudy::operator << (Edges& tab) { - if (! is_open) + if (NOT is_open) return *this; TabElts& tabelt = (TabElts&) tab; @@ -157,7 +157,7 @@ DumpStudy& DumpStudy::operator << (Edges& tab) // =================================================== operator << (Hexas) DumpStudy& DumpStudy::operator << (Hexas& tab) { - if (!is_open) + if (NOT is_open) return *this; TabElts& tabelt = (TabElts&) tab; @@ -167,7 +167,7 @@ DumpStudy& DumpStudy::operator << (Hexas& tab) // =================================================== operator << (Reals) DumpStudy& DumpStudy::operator << (RealVector& tab) { - if (! is_open) + if (NOT is_open) return *this; char name [20], valeur [30]; diff --git a/src/HEXABLOCK/HexDumpStudy.hxx b/src/HEXABLOCK/HexDumpStudy.hxx index f0e6a54..0d089bb 100755 --- a/src/HEXABLOCK/HexDumpStudy.hxx +++ b/src/HEXABLOCK/HexDumpStudy.hxx @@ -23,7 +23,6 @@ #ifndef __DUMP_STUDY_H_ #define __DUMP_STUDY_H_ -#include "Hex_defines.hxx" #include "hexa_base.hxx" #include @@ -31,10 +30,8 @@ #pragma warning ( disable: 4251 ) #endif - BEGIN_NAMESPACE_HEXA - #define DumpStart0(p) bool actif=el_root->glob->dump.start(this, p) #define DumpStart(p,args) bool actif=el_root->glob->dump.start(this, p); if (actif) el_root->glob->dump << args #define DumpEnd el_root->glob->dump.close (actif) @@ -44,7 +41,7 @@ BEGIN_NAMESPACE_HEXA #define DumpRestore el_root->glob->dump.restore (actif) class Witness; -class HEXABLOCKENGINE_EXPORT DumpStudy +class HexaExport DumpStudy { public : DumpStudy (); diff --git a/src/HEXABLOCK/HexEdge.hxx b/src/HEXABLOCK/HexEdge.hxx index 3e41f9d..0e05e80 100755 --- a/src/HEXABLOCK/HexEdge.hxx +++ b/src/HEXABLOCK/HexEdge.hxx @@ -22,12 +22,11 @@ #ifndef __EDGE_H #define __EDGE_H -#include "Hex_defines.hxx" #include "HexVertex.hxx" BEGIN_NAMESPACE_HEXA -class HEXABLOCKENGINE_EXPORT Edge : public EltBase +class HexaExport Edge : public EltBase { public: virtual Vertex* getVertex (int nro); diff --git a/src/HEXABLOCK/HexEdgeShape.hxx b/src/HEXABLOCK/HexEdgeShape.hxx index 12b33ee..212a728 100644 --- a/src/HEXABLOCK/HexEdgeShape.hxx +++ b/src/HEXABLOCK/HexEdgeShape.hxx @@ -4,12 +4,11 @@ #ifndef __LIBE_SHAPE_H_ #define __LIBE_SHAPE_H_ -#include "Hex_defines.hxx" #include "HexSubShape.hxx" BEGIN_NAMESPACE_HEXA -class HEXABLOCKENGINE_EXPORT EdgeShape : public SubShape +class HexaExport EdgeShape : public SubShape { public : EdgeShape (NewShape* dad, int id); diff --git a/src/HEXABLOCK/HexElements.hxx b/src/HEXABLOCK/HexElements.hxx index 0f3aa21..1373c28 100755 --- a/src/HEXABLOCK/HexElements.hxx +++ b/src/HEXABLOCK/HexElements.hxx @@ -23,7 +23,6 @@ #ifndef __ELEMENTS_H #define __ELEMENTS_H -#include "Hex_defines.hxx" #include "HexEltBase.hxx" #include "HexMatrix.hxx" @@ -31,7 +30,7 @@ BEGIN_NAMESPACE_HEXA -class HEXABLOCKENGINE_EXPORT Elements : public EltBase +class HexaExport Elements : public EltBase { public: virtual Hexa* getHexa (int nro); diff --git a/src/HEXABLOCK/HexElements_del.cxx b/src/HEXABLOCK/HexElements_del.cxx deleted file mode 100644 index 71845a7..0000000 --- a/src/HEXABLOCK/HexElements_del.cxx +++ /dev/null @@ -1,131 +0,0 @@ - -// C++ : Grilles - -// Copyright (C) 2009-2013 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. -// -// 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 "HexElements.hxx" -#include "HexDocument.hxx" -#include "HexVector.hxx" -#include "HexVertex.hxx" -#include "HexHexa.hxx" -#include "HexEdge.hxx" -#include "HexGlobale.hxx" -#include "HexCylinder.hxx" - -#include - -BEGIN_NAMESPACE_HEXA - -// ====================================================== makeCartesianGrid -int Elements::makeCartesianGrid (Vertex* orig, Vector* v1, Vector* v2, - Vector* v3, int px, int py, int pz, int mx, int my, int mz) -{ - return HERR; -} -// ====================================================== makeCartesianNodes -int Elements::makeCartesianNodes (Vertex* orig, Vector* v1, Vector* v2, - Vector* v3, int px, int py, int pz, int mx, int my, int mz) -{ - return HERR; -} -// ====================================================== makeBasicCylinder -int Elements::makeBasicCylinder (double dr, double da, double dl, int nr, - int na, int nl, bool fill) -{ - return HERR; -} -// ====================================================== transfoVertices -void Elements::transfoVertices (Vertex* orig, Vector* base, Vector* haut) -{ -} -// ====================================================== transfoVertices -void Elements::transfoVertices (Vertex* orig, Vector* iprim, Vector* jprim, - Vector* kprim) -{ -} -// ====================================================== makeSphericalGrid -int Elements::makeSphericalGrid (Vertex* c, double rayon, int nb, double k) -{ - return HERR; -} -// ====================================================== makeSphericalGrid -// ==== Deja perimee en Hexa5 -int Elements::makeSphericalGrid (Vertex* c, Vector* dv, int nb, double k) -{ - return HERR; -} -// ====================================================== addStrate -int Elements::addStrate (Quad* i_quad[], Edge* i_edge[], Vertex* i_node[], - Vertex* center, double lambda) -{ - return HERR; -} -// ====================================================== makeCylinder -int Elements::makeCylinder (Cylinder* cyl, Vector* vx, int nr, int na, int nl) -{ - return HERR; -} -// ====================================================== makePipe -int Elements::makePipe (Cylinder* cyl, Vector* vx, int nr, int na, int nl) -{ - return HERR; -} -// -// ---------------------------------------- prism Quads -// -// ====================================================== prismQuads -int Elements::prismQuads (Quads& tstart, Vector* dir, int nbiter) -{ - return HERR; -} -// ====================================================== prismQuadsVec -int Elements::prismQuadsVec (Quads& tstart, Vector* dir, RealVector& tlen, - int mode) -{ - return HERR; -} -// ======================================================== revolutionQuads -int Elements::revolutionQuads (Quads& start, Vertex* center, Vector* axis, - RealVector &angles) -{ - return HERR; -} -// ====================================================== joinQuads -int Elements::joinQuads (Quads& orig, int nb, Vertex* v1, Vertex* v2, - Vertex* v3, Vertex* v4, Quad* cible) -{ - return HERR; -} -// ====================================================== makeCylindricalGrid -// ==== Version avec vecteurs --> TODO DELETE ???? -int Elements::makeCylindricalGrid (Vertex* orig, Vector* base, Vector* haut, - RealVector& tdr, RealVector& tda, RealVector& tdh, - bool fill) -{ - return HOK; -} -// ====================================================== makeCylindricalGrid -int Elements::makeCylindricalGrid (Vertex* c, Vector* b, Vector* h, - double dr, double da, double dl, int nr, int na, int nl, bool fill) -{ - return HOK; -} - -END_NAMESPACE_HEXA diff --git a/src/HEXABLOCK/HexEltBase.hxx b/src/HEXABLOCK/HexEltBase.hxx index 81658d4..4d5bf8e 100755 --- a/src/HEXABLOCK/HexEltBase.hxx +++ b/src/HEXABLOCK/HexEltBase.hxx @@ -23,7 +23,6 @@ #ifndef __ELT_BASE_H #define __ELT_BASE_H -#include "Hex_defines.hxx" #include "hexa_base.hxx" #include @@ -41,7 +40,7 @@ BEGIN_NAMESPACE_HEXA -class HEXABLOCKENGINE_EXPORT EltBase +class HexaExport EltBase { public : virtual int countHexa () { return 0; } diff --git a/src/HEXABLOCK/HexFaceShape.hxx b/src/HEXABLOCK/HexFaceShape.hxx index ca9c17c..c149510 100644 --- a/src/HEXABLOCK/HexFaceShape.hxx +++ b/src/HEXABLOCK/HexFaceShape.hxx @@ -4,12 +4,11 @@ #ifndef __FACE_SHAPE_H_ #define __FACE_SHAPE_H_ -#include "Hex_defines.hxx" #include "HexSubShape.hxx" BEGIN_NAMESPACE_HEXA -class HEXABLOCKENGINE_EXPORT FaceShape : public SubShape +class HexaExport FaceShape : public SubShape { public : FaceShape (NewShape* dad, int id); diff --git a/src/HEXABLOCK/HexGlobale.hxx b/src/HEXABLOCK/HexGlobale.hxx index 1a3016c..7c75580 100755 --- a/src/HEXABLOCK/HexGlobale.hxx +++ b/src/HEXABLOCK/HexGlobale.hxx @@ -24,7 +24,6 @@ #ifndef _HEX_GLOBALE_H #define _HEX_GLOBALE_H -#include "Hex_defines.hxx" #include "hexa_base.hxx" #include "HexDumpStudy.hxx" #include "HexWitness.hxx" @@ -52,7 +51,7 @@ BEGIN_NAMESPACE_HEXA -class HEXABLOCKENGINE_EXPORT Globale +class HexaExport Globale { public : static Globale* getInstance (); diff --git a/src/HEXABLOCK/HexGroup.hxx b/src/HEXABLOCK/HexGroup.hxx index 5f7b756..abb7e8f 100755 --- a/src/HEXABLOCK/HexGroup.hxx +++ b/src/HEXABLOCK/HexGroup.hxx @@ -23,12 +23,11 @@ #ifndef __GROUP_H #define __GROUP_H -#include "Hex_defines.hxx" #include "HexEltBase.hxx" BEGIN_NAMESPACE_HEXA -class HEXABLOCKENGINE_EXPORT Group : public EltBase +class HexaExport Group : public EltBase { public : int addElement (EltBase* elt); diff --git a/src/HEXABLOCK/HexHexa.hxx b/src/HEXABLOCK/HexHexa.hxx index 0d7a0a0..a00569a 100755 --- a/src/HEXABLOCK/HexHexa.hxx +++ b/src/HEXABLOCK/HexHexa.hxx @@ -42,7 +42,6 @@ #ifndef __HEX_HEXA_H_ #define __HEX_HEXA_H_ -#include "Hex_defines.hxx" #include "HexEltBase.hxx" #include "HexQuad.hxx" @@ -51,7 +50,7 @@ BEGIN_NAMESPACE_HEXA -class HEXABLOCKENGINE_EXPORT Hexa : public EltBase +class HexaExport Hexa : public EltBase { public: virtual Quad* getQuad (int nro); diff --git a/src/HEXABLOCK/HexKas_functions.hxx b/src/HEXABLOCK/HexKas_functions.hxx index def53f0..84f57ec 100755 --- a/src/HEXABLOCK/HexKas_functions.hxx +++ b/src/HEXABLOCK/HexKas_functions.hxx @@ -25,26 +25,25 @@ class gp_Pnt; -#include "Hex_defines.hxx" #include "HexGlobale.hxx" BEGIN_NAMESPACE_HEXA -int HEXABLOCKENGINE_EXPORT geom_create_cylcyl (double* borig, double* bnorm, double* bbase, - double bray, double bhaut, - double* sorig, double* snorm, double* sbase, - double sray, double shaut); -int HEXABLOCKENGINE_EXPORT geom_asso_cylcyl (Edge* edge); +int HexaExport geom_create_cylcyl (double* borig, double* bnorm, double* bbase, + double bray, double bhaut, + double* sorig, double* snorm, double* sbase, + double sray, double shaut); +int HexaExport geom_asso_cylcyl (Edge* edge); -bool HEXABLOCKENGINE_EXPORT same_coords (gp_Pnt& pa, gp_Pnt& pb, double epsil2=1e-6); -void HEXABLOCKENGINE_EXPORT save_brep (cpchar nom, string brep, int& nro); -void HEXABLOCKENGINE_EXPORT clean_brep (string& brep); +bool HexaExport same_coords (gp_Pnt& pa, gp_Pnt& pb, double epsil2=1e-6); +void HexaExport save_brep (cpchar nom, string brep, int& nro); +void HexaExport clean_brep (string& brep); -void HEXABLOCKENGINE_EXPORT geom_make_brep (TopoDS_Shape& shape, string& brep); -int HEXABLOCKENGINE_EXPORT geom_brep2point (rcstring brep, double& px, double& py, double& pz); -int HEXABLOCKENGINE_EXPORT geom_brep2shape (rcstring brep, TopoDS_Shape& shape); +void HexaExport geom_make_brep (TopoDS_Shape& shape, string& brep); +int HexaExport geom_brep2point (rcstring brep, double& px, double& py, double& pz); +int HexaExport geom_brep2shape (rcstring brep, TopoDS_Shape& shape); -TopoDS_Shape HEXABLOCKENGINE_EXPORT geom_brep2shape (rcstring brep); +TopoDS_Shape HexaExport geom_brep2shape (rcstring brep); END_NAMESPACE_HEXA #endif diff --git a/src/HEXABLOCK/HexLaw.hxx b/src/HEXABLOCK/HexLaw.hxx index 86a9ed4..0138e22 100755 --- a/src/HEXABLOCK/HexLaw.hxx +++ b/src/HEXABLOCK/HexLaw.hxx @@ -22,13 +22,12 @@ #ifndef __LAW_H_ #define __LAW_H_ -#include "Hex_defines.hxx" #include "HexEltBase.hxx" #include "HexXmlWriter.hxx" BEGIN_NAMESPACE_HEXA -class HEXABLOCKENGINE_EXPORT Law : public EltBase +class HexaExport Law : public EltBase { public: const char* getName () { return law_name.c_str() ; } diff --git a/src/HEXABLOCK/HexMatrix.hxx b/src/HEXABLOCK/HexMatrix.hxx index 5832873..fd8ef38 100755 --- a/src/HEXABLOCK/HexMatrix.hxx +++ b/src/HEXABLOCK/HexMatrix.hxx @@ -23,7 +23,6 @@ #ifndef __MATRIX_H #define __MATRIX_H -#include "Hex_defines.hxx" #include "HexVertex.hxx" #include "HexVector.hxx" @@ -31,7 +30,7 @@ BEGIN_NAMESPACE_HEXA -class HEXABLOCKENGINE_EXPORT Matrix +class HexaExport Matrix { public: Matrix (); diff --git a/src/HEXABLOCK/HexNewShape.hxx b/src/HEXABLOCK/HexNewShape.hxx index 3c1a17e..eb57659 100644 --- a/src/HEXABLOCK/HexNewShape.hxx +++ b/src/HEXABLOCK/HexNewShape.hxx @@ -4,7 +4,6 @@ #ifndef __NEW_SHAPE_H_ #define __NEW_SHAPE_H_ -#include "Hex_defines.hxx" #include "HexEltBase.hxx" #ifndef SWIG @@ -16,7 +15,7 @@ BEGIN_NAMESPACE_HEXA -class HEXABLOCKENGINE_EXPORT NewShape : public EltBase +class HexaExport NewShape : public EltBase { public : // for TUI virtual int countVertex () { return tab_vertex.size (); } diff --git a/src/HEXABLOCK/HexPipe.cxx b/src/HEXABLOCK/HexPipe.cxx deleted file mode 100755 index 51fdfa8..0000000 --- a/src/HEXABLOCK/HexPipe.cxx +++ /dev/null @@ -1,53 +0,0 @@ - -// C++ : Gestion des tuyaux - -// Copyright (C) 2009-2013 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. -// -// 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 "HexPipe.hxx" - -#include "HexDocument.hxx" -#include "HexVertex.hxx" -#include "HexVector.hxx" -#include "HexXmlWriter.hxx" - -BEGIN_NAMESPACE_HEXA - -// ======================================================== Constructeur -Pipe::Pipe (Vertex* b, Vector* v, double ri, double re, double h) - : Cylinder (b, v, re, h) -{ - c_int_radius = ri; - if (isBad () || c_int_radius <= el_root->getTolerance () - || c_int_radius >= c_radius) - setError (); -} -// ========================================================= saveXml -void Pipe::saveXml (XmlWriter* xml) -{ - char buffer[12]; - - xml->openMark ("Pipe"); - xml->addAttribute ("c_base", c_base->getName (buffer)); - xml->addAttribute ("c_dir", c_dir->getName (buffer)); - xml->addAttribute ("c_radius", c_radius); - xml->addAttribute ("c_int_radius", c_int_radius); - xml->addAttribute ("c_height", c_height); - xml->closeMark (); -} -END_NAMESPACE_HEXA diff --git a/src/HEXABLOCK/HexPropagation.hxx b/src/HEXABLOCK/HexPropagation.hxx index 2b8838f..ed1c435 100755 --- a/src/HEXABLOCK/HexPropagation.hxx +++ b/src/HEXABLOCK/HexPropagation.hxx @@ -22,7 +22,6 @@ #ifndef __PROPAGATION_H #define __PROPAGATION_H -#include "Hex_defines.hxx" #include "HexEltBase.hxx" #include "HexDocument.hxx" @@ -33,7 +32,7 @@ BEGIN_NAMESPACE_HEXA -class HEXABLOCKENGINE_EXPORT Propagation : public EltBase +class HexaExport Propagation : public EltBase { public: const Edges& getEdges () { return prop_edges; } diff --git a/src/HEXABLOCK/HexQuad.hxx b/src/HEXABLOCK/HexQuad.hxx index 6ebc426..47e9848 100755 --- a/src/HEXABLOCK/HexQuad.hxx +++ b/src/HEXABLOCK/HexQuad.hxx @@ -22,13 +22,12 @@ #ifndef __QUAD_H #define __QUAD_H -#include "Hex_defines.hxx" #include "HexEdge.hxx" BEGIN_NAMESPACE_HEXA #ifndef SWIG -struct HEXABLOCKENGINE_EXPORT StrOrient +struct StrOrient { Vertex* v11; // 1er sommet 1er quad Vertex* v12; // 2eme @@ -45,7 +44,7 @@ StrOrient ( StrOrient* s) }; #endif -class HEXABLOCKENGINE_EXPORT Quad : public EltBase +class HexaExport Quad : public EltBase { public: virtual Edge* getEdge (int nro); diff --git a/src/HEXABLOCK/HexShape.hxx b/src/HEXABLOCK/HexShape.hxx index 94d3070..bb70765 100755 --- a/src/HEXABLOCK/HexShape.hxx +++ b/src/HEXABLOCK/HexShape.hxx @@ -23,12 +23,11 @@ #ifndef __SHAPE_H_ #define __SHAPE_H_ -#include "Hex_defines.hxx" #include "hexa_base.hxx" BEGIN_NAMESPACE_HEXA -class HEXABLOCKENGINE_EXPORT Shape +class HexaExport Shape { public : Shape (string brep); diff --git a/src/HEXABLOCK/HexSubShape.cxx b/src/HEXABLOCK/HexSubShape.cxx index b978fb1..5195eb9 100755 --- a/src/HEXABLOCK/HexSubShape.cxx +++ b/src/HEXABLOCK/HexSubShape.cxx @@ -41,7 +41,6 @@ SubShape::SubShape (NewShape* dad, int id, int dim) sub_ident = id; sub_dim = dim; maj_brep = maj_shape = true; - kind_of = KS_None; } // ====================================================== getShape const TopoDS_Shape& SubShape::getShape () diff --git a/src/HEXABLOCK/HexSubShape.hxx b/src/HEXABLOCK/HexSubShape.hxx index a65fa83..1feea54 100644 --- a/src/HEXABLOCK/HexSubShape.hxx +++ b/src/HEXABLOCK/HexSubShape.hxx @@ -4,21 +4,20 @@ #ifndef __SUB_SHAPE_H_ #define __SUB_SHAPE_H_ -#include "Hex_defines.hxx" #include "HexEltBase.hxx" #include BEGIN_NAMESPACE_HEXA -class HEXABLOCKENGINE_EXPORT SubShape : public EltBase +class HexaExport SubShape : public EltBase { public : SubShape (NewShape* dad, int id, int dim); - NewShape* getParentShape() const { return ss_parent; } - cpchar getParentName () const; - int getIdent () { return sub_ident ; } - int getDim () { return sub_dim ; } + NewShape* getParentShape() const { return ss_parent; } + cpchar getParentName () const; + int getIdent () { return sub_ident ; } + int getDim () { return sub_dim ; } EnumKindOfShape kindOf () { return kind_of ; } const string& getBrep (); diff --git a/src/HEXABLOCK/HexVector.hxx b/src/HEXABLOCK/HexVector.hxx index 7f12dfe..322f7f4 100755 --- a/src/HEXABLOCK/HexVector.hxx +++ b/src/HEXABLOCK/HexVector.hxx @@ -22,14 +22,13 @@ #ifndef __VECTOR_H #define __VECTOR_H -#include "Hex_defines.hxx" #include "HexEltBase.hxx" #include BEGIN_NAMESPACE_HEXA -class HEXABLOCKENGINE_EXPORT Vector : public EltBase +class HexaExport Vector : public EltBase { public: double getDx () { return v_dx ; } diff --git a/src/HEXABLOCK/HexVertex.hxx b/src/HEXABLOCK/HexVertex.hxx index 4cfc41b..a57efbd 100755 --- a/src/HEXABLOCK/HexVertex.hxx +++ b/src/HEXABLOCK/HexVertex.hxx @@ -23,12 +23,11 @@ #ifndef __VERTEX_H_ #define __VERTEX_H_ -#include "Hex_defines.hxx" #include "HexEltBase.hxx" BEGIN_NAMESPACE_HEXA -class HEXABLOCKENGINE_EXPORT Vertex : public EltBase +class HexaExport Vertex : public EltBase { public : double getX() { return v_x; } diff --git a/src/HEXABLOCK/HexVertexShape.hxx b/src/HEXABLOCK/HexVertexShape.hxx index a2bd45b..a04a843 100644 --- a/src/HEXABLOCK/HexVertexShape.hxx +++ b/src/HEXABLOCK/HexVertexShape.hxx @@ -4,12 +4,11 @@ #ifndef __NODE_SHAPE_H_ #define __NODE_SHAPE_H_ -#include "Hex_defines.hxx" #include "HexSubShape.hxx" BEGIN_NAMESPACE_HEXA -class HEXABLOCKENGINE_EXPORT VertexShape : public SubShape +class HexaExport VertexShape : public SubShape { public : VertexShape (NewShape* dad, int id); diff --git a/src/HEXABLOCK/HexWitness.hxx b/src/HEXABLOCK/HexWitness.hxx index 087a4bc..e8d74be 100644 --- a/src/HEXABLOCK/HexWitness.hxx +++ b/src/HEXABLOCK/HexWitness.hxx @@ -23,8 +23,6 @@ #ifndef __WITNESS_H_ #define __WITNESS_H_ -#include "Hex_defines.hxx" - #define Mess el_root->glob->mess << Begin #define Follow el_root->glob->mess @@ -39,7 +37,7 @@ BEGIN_NAMESPACE_HEXA const std::string Begin (" **** "); class DumpStudy; -class HEXABLOCKENGINE_EXPORT Witness +class HexaExport Witness { public : Witness (); diff --git a/src/HEXABLOCK/HexXmlTree.hxx b/src/HEXABLOCK/HexXmlTree.hxx index ad919df..2bff3f7 100755 --- a/src/HEXABLOCK/HexXmlTree.hxx +++ b/src/HEXABLOCK/HexXmlTree.hxx @@ -22,7 +22,6 @@ #ifndef __XML_TREE_H_ #define __XML_TREE_H_ -#include "Hex_defines.hxx" #include "hexa_base.hxx" #include @@ -33,7 +32,7 @@ BEGIN_NAMESPACE_HEXA M_IDENT, M_EQUALS, M_STRING, M_COMMENT, M_END_COMMENT, M_PROLOG, M_END_PROLOG, M_ERROR}; -class HEXABLOCKENGINE_EXPORT XmlTree +class HexaExport XmlTree { public : XmlTree (const string& name, XmlTree* dad=NULL); diff --git a/src/HEXABLOCK/HexXmlWriter.hxx b/src/HEXABLOCK/HexXmlWriter.hxx index a83ce06..82dc9ad 100755 --- a/src/HEXABLOCK/HexXmlWriter.hxx +++ b/src/HEXABLOCK/HexXmlWriter.hxx @@ -22,14 +22,13 @@ #ifndef __XML_WRITER_H #define __XML_WRITER_H -#include "Hex_defines.hxx" #include "hexa_base.hxx" #include #include BEGIN_NAMESPACE_HEXA -class HEXABLOCKENGINE_EXPORT XmlWriter +class HexaExport XmlWriter { public : XmlWriter (); diff --git a/src/HEXABLOCK/Hex_defines.hxx b/src/HEXABLOCK/Hex_defines.hxx index 89652e0..90126b3 100755 --- a/src/HEXABLOCK/Hex_defines.hxx +++ b/src/HEXABLOCK/Hex_defines.hxx @@ -29,5 +29,6 @@ #else #define HEXABLOCKENGINE_EXPORT #endif +#define HexaExport HEXABLOCKENGINE_EXPORT -#endif //_HEX_DEFINES_HXX_ \ No newline at end of file +#endif //_HEX_DEFINES_HXX_ diff --git a/src/HEXABLOCK/hexa_base.hxx b/src/HEXABLOCK/hexa_base.hxx index e79dd9e..684ec49 100755 --- a/src/HEXABLOCK/hexa_base.hxx +++ b/src/HEXABLOCK/hexa_base.hxx @@ -240,49 +240,58 @@ typedef std::vector TabText; typedef double Real; typedef double Real3 [DIM3]; + // a cause de Swig +#ifndef HEXABLOCKENGINE_EXPORT +#define HEXABLOCKENGINE_EXPORT +#endif + +#ifndef HexaExport +#define HexaExport +#endif + // Quelques fonctions : -HEXABLOCKENGINE_EXPORT pchar get_temp_name (cpchar format, pchar nomfic); -HEXABLOCKENGINE_EXPORT void fatal_error (cpchar format, cpchar info1=NULL, cpchar info2=NULL); +HexaExport pchar get_temp_name (cpchar format, pchar nomfic); +HexaExport void fatal_error (cpchar format, cpchar info1=NULL, cpchar info2=NULL); -HEXABLOCKENGINE_EXPORT double prod_scalaire (double v1[], double v2[]); -HEXABLOCKENGINE_EXPORT double* prod_vectoriel (double v1[], double v2[], double v3[]); -HEXABLOCKENGINE_EXPORT double prod_mixte (double vi[], double vj[], double vk[]); +HexaExport double prod_scalaire (double v1[], double v2[]); +HexaExport double* prod_vectoriel (double v1[], double v2[], double v3[]); +HexaExport double prod_mixte (double vi[], double vj[], double vk[]); -HEXABLOCKENGINE_EXPORT inline double deg2radians (double angle) { return (angle*M_PI/180.0); } -HEXABLOCKENGINE_EXPORT inline double rad2degres (double angle) { return (angle*180.0/M_PI); } +HexaExport inline double deg2radians (double angle) { return (angle*M_PI/180.0); } +HexaExport inline double rad2degres (double angle) { return (angle*180.0/M_PI); } -HEXABLOCKENGINE_EXPORT double calc_norme (double v1[]); -HEXABLOCKENGINE_EXPORT double calc_distance (double v1[], double v2[]); -HEXABLOCKENGINE_EXPORT void calc_vecteur (double pta[], double ptb[], double vab[]); -HEXABLOCKENGINE_EXPORT void copy_vecteur (double va [], double vb []); -HEXABLOCKENGINE_EXPORT void calc_milieu (double pta[], double ptb[], double milieu[]); -HEXABLOCKENGINE_EXPORT int normer_vecteur (double v1[]); +HexaExport double calc_norme (double v1[]); +HexaExport double calc_distance (double v1[], double v2[]); +HexaExport void calc_vecteur (double pta[], double ptb[], double vab[]); +HexaExport void copy_vecteur (double va [], double vb []); +HexaExport void calc_milieu (double pta[], double ptb[], double milieu[]); +HexaExport int normer_vecteur (double v1[]); -HEXABLOCKENGINE_EXPORT double carre (double val); -HEXABLOCKENGINE_EXPORT bool same_coords (double* pa, double* pb, double epsilon=1e-6); +HexaExport double carre (double val); +HexaExport bool same_coords (double* pa, double* pb, double epsilon=1e-6); -HEXABLOCKENGINE_EXPORT bool requals (const double v1, const double v2); -HEXABLOCKENGINE_EXPORT bool requals (const double* v1, const double* v2); +HexaExport bool requals (const double v1, const double v2); +HexaExport bool requals (const double* v1, const double* v2); -HEXABLOCKENGINE_EXPORT bool on_debug(); // == getenv ("HEXA_DB") > 0 -HEXABLOCKENGINE_EXPORT bool in_test (); // == getenv ("HEXA_TEST") > 0 -HEXABLOCKENGINE_EXPORT int niv_debug(); // Implemente prochainement +HexaExport bool on_debug(); // == getenv ("HEXA_DB") > 0 +HexaExport bool in_test (); // == getenv ("HEXA_TEST") > 0 +HexaExport int niv_debug(); // Implemente prochainement -HEXABLOCKENGINE_EXPORT void set_minus (string& chaine); +HexaExport void set_minus (string& chaine); -HEXABLOCKENGINE_EXPORT bool special_option (); -HEXABLOCKENGINE_EXPORT void set_special_option (bool opt); +HexaExport bool special_option (); +HexaExport void set_special_option (bool opt); -HEXABLOCKENGINE_EXPORT int sizeof_file (cpchar filename); -HEXABLOCKENGINE_EXPORT char* read_file (cpchar filename, int& size); -HEXABLOCKENGINE_EXPORT cpchar get_time (string& buffer); +HexaExport int sizeof_file (cpchar filename); +HexaExport char* read_file (cpchar filename, int& size); +HexaExport cpchar get_time (string& buffer); +HexaExport int make_basename (cpchar filename, string& base); const double Epsil = 1e-6; const double UnEpsil = 0.999999; const double Epsil2 = 1e-12; - END_NAMESPACE_HEXA #endif diff --git a/src/HEXABLOCK/hexa_utils.cxx b/src/HEXABLOCK/hexa_utils.cxx index 76a039e..7188589 100755 --- a/src/HEXABLOCK/hexa_utils.cxx +++ b/src/HEXABLOCK/hexa_utils.cxx @@ -269,4 +269,40 @@ bool requals (const double* lun, const double* lautre) return lun!=NULL && lautre!=NULL && requals (lun [0], lautre [0]) && requals (lun [1], lautre [1]) && requals (lun [2], lautre [2]) ; } +// ======================================================== make_basename +int make_basename (cpchar filename, string& base) +{ + const char slash = '/'; + const char antis = '\\'; + int lg = strlen (filename); + int ifin = -1; + int ideb = 0; + bool more = true; + + for (int nc = lg-1 ; more && nc>=0 ; --nc) + { + char car = filename[nc]; + if (car==slash || car==antis) + { + if (ifin >0) + { + ideb = nc + 1; + more = false; + } + } + else if (ifin<0) + ifin = nc; + } + + if (ifin <0) + { + base = "undefined"; + return HERR; + } + + base = ""; + for (int nc=ideb ; nc <= ifin ; ++nc) + base += filename[nc]; + return HOK; +} END_NAMESPACE_HEXA diff --git a/src/HEXABLOCKGUI/AddShapeDialog_QTD.ui b/src/HEXABLOCKGUI/AddShapeDialog_QTD.ui index a5f3229..1e98f73 100644 --- a/src/HEXABLOCKGUI/AddShapeDialog_QTD.ui +++ b/src/HEXABLOCKGUI/AddShapeDialog_QTD.ui @@ -7,15 +7,21 @@ 0 0 242 - 72 + 129 - + 0 0 + + + 5 + 0 + + Dialog @@ -37,7 +43,27 @@ - + + + + 0 + 0 + + + + + + + + Qt::Vertical + + + + 20 + 16777215 + + + diff --git a/src/HEXABLOCKGUI/CutEdge_QTD.ui b/src/HEXABLOCKGUI/CutEdge_QTD.ui index c70bc29..c5380f5 100644 --- a/src/HEXABLOCKGUI/CutEdge_QTD.ui +++ b/src/HEXABLOCKGUI/CutEdge_QTD.ui @@ -6,7 +6,7 @@ 0 0 - 289 + 270 326 @@ -16,6 +16,12 @@ 0 + + + 5 + 0 + + Cut Edge Operation @@ -28,6 +34,12 @@ + + + 0 + 0 + + Uniform @@ -38,6 +50,12 @@ + + + 0 + 0 + + Custom @@ -49,7 +67,7 @@ - + 0 0 @@ -65,7 +83,7 @@ - + 0 0 @@ -103,7 +121,7 @@ - + 0 0 diff --git a/src/HEXABLOCKGUI/Disconnect_QTD.ui b/src/HEXABLOCKGUI/Disconnect_QTD.ui index 0a58bd0..bccf87b 100644 --- a/src/HEXABLOCKGUI/Disconnect_QTD.ui +++ b/src/HEXABLOCKGUI/Disconnect_QTD.ui @@ -6,8 +6,8 @@ 0 0 - 338 - 598 + 320 + 632 @@ -16,12 +16,24 @@ 0 + + + 5 + 0 + + Disconnect Operation + + + 0 + 0 + + true @@ -30,8 +42,8 @@ 0 0 - 318 - 578 + 300 + 612 @@ -41,7 +53,7 @@ true - + 0 0 @@ -55,7 +67,7 @@ 16777215 - 50 + 16777215 @@ -68,7 +80,7 @@ - + 0 0 @@ -84,7 +96,7 @@ - + 0 0 @@ -97,7 +109,7 @@ - + 0 0 @@ -109,6 +121,12 @@ + + + 0 + 0 + + Quad @@ -120,7 +138,7 @@ - + 0 0 @@ -154,7 +172,7 @@ - + 0 0 @@ -180,7 +198,7 @@ - + 0 0 @@ -202,7 +220,7 @@ - + 0 0 @@ -224,7 +242,7 @@ - + 0 0 @@ -250,7 +268,7 @@ - + 0 0 @@ -272,7 +290,7 @@ - + 0 0 @@ -300,7 +318,7 @@ - + 0 0 @@ -326,7 +344,7 @@ - + 0 0 @@ -449,22 +467,22 @@ + + + + Qt::Vertical + + + + 20 + 16777215 + + + + - - - - Qt::Vertical - - - - 20 - 40 - - - - diff --git a/src/HEXABLOCKGUI/EdgeAssoc_QTD.ui b/src/HEXABLOCKGUI/EdgeAssoc_QTD.ui index b193aa3..b7fbf7e 100644 --- a/src/HEXABLOCKGUI/EdgeAssoc_QTD.ui +++ b/src/HEXABLOCKGUI/EdgeAssoc_QTD.ui @@ -11,14 +11,14 @@ - + 0 0 - 260 + 5 0 @@ -46,6 +46,12 @@ + + + 0 + 0 + + One edge @@ -56,6 +62,12 @@ + + + 0 + 0 + + Line @@ -70,7 +82,7 @@ - + 0 0 @@ -117,7 +129,14 @@ - + + + + 0 + 0 + + + @@ -143,7 +162,7 @@ - + 0 0 @@ -214,7 +233,7 @@ - + 0 0 @@ -268,6 +287,12 @@ + + + 0 + 0 + + 6 @@ -288,6 +313,12 @@ + + + 0 + 0 + + 6 diff --git a/src/HEXABLOCKGUI/Edge_QTD.ui b/src/HEXABLOCKGUI/Edge_QTD.ui index 4ad095f..bab8021 100644 --- a/src/HEXABLOCKGUI/Edge_QTD.ui +++ b/src/HEXABLOCKGUI/Edge_QTD.ui @@ -9,16 +9,28 @@ 0 0 - 244 - 323 + 226 + 369 - + 0 0 + + + 5 + 0 + + + + + 16777215 + 16777215 + + Edge Construction @@ -29,7 +41,7 @@ - + 0 0 @@ -37,7 +49,7 @@ 16777215 - 50 + 16777215 @@ -50,7 +62,7 @@ - + 0 0 @@ -66,7 +78,7 @@ - + 0 0 @@ -82,11 +94,23 @@ - + 0 0 + + + 0 + 0 + + + + + 16777215 + 16777215 + + @@ -94,17 +118,10 @@ - - - - Name - - - - + 0 0 @@ -120,23 +137,26 @@ + + + + Name + + + - - - - Point - - - + + QFormLayout::AllNonFixedFieldsGrow + - + 0 0 @@ -152,17 +172,10 @@ - - - - Vector - - - - + 0 0 @@ -178,23 +191,33 @@ + + + + Vector + + + + + + + Point + + + - - - - Point 1 - - - + + QFormLayout::AllNonFixedFieldsGrow + - + 0 0 @@ -216,17 +239,10 @@ - - - - Point 2 - - - - + - + 0 0 @@ -242,9 +258,36 @@ + + + + Point 2 + + + + + + + Point 1 + + + + + + + Qt::Vertical + + + + 20 + 16777215 + + + + @@ -261,22 +304,6 @@ - - rb0 - clicked() - widget_2 - show() - - - 77 - 47 - - - 73 - 218 - - - rb0 clicked() @@ -309,6 +336,22 @@ + + rb0 + clicked() + widget_2 + show() + + + 77 + 47 + + + 73 + 218 + + + rb1 clicked() diff --git a/src/HEXABLOCKGUI/Group_QTD.ui b/src/HEXABLOCKGUI/Group_QTD.ui index 621f8f9..1b53670 100644 --- a/src/HEXABLOCKGUI/Group_QTD.ui +++ b/src/HEXABLOCKGUI/Group_QTD.ui @@ -7,7 +7,7 @@ 0 0 194 - 206 + 222 @@ -36,7 +36,7 @@ - + 0 @@ -54,7 +54,7 @@ - + 0 0 diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx index 62a4ae8..1cf55c6 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx @@ -92,7 +92,7 @@ #include "HEXABLOCKGUI_DocumentModel.hxx" #include "HEXABLOCKGUI_DocumentSelectionModel.hxx" -#include "HEXABLOCKGUI_DocumentDelegate.hxx" +//#include "HEXABLOCKGUI_DocumentDelegate.hxx" #include "HEXABLOCKGUI_DocumentPanel.hxx" #include "HEXABLOCKGUI_VtkDocumentGraphicView.hxx" #include "HEXABLOCKGUI_OccGraphicView.hxx" @@ -108,8 +108,12 @@ #include +#include +#include #include #include +#include +#include #include #include #include @@ -138,6 +142,7 @@ SalomeApp_Application* HEXABLOCKGUI::myApplication = NULL; HEXABLOCKGUI::HEXABLOCKGUI() : SalomeApp_Module( "HEXABLOCK" ), +// LightApp_Module( "HEXABLOCK" ), _menuId(190), _dwPattern(0), _dwAssociation(0), @@ -146,11 +151,11 @@ HEXABLOCKGUI::HEXABLOCKGUI() : _dwObjectBrowser(0), _dwInputPanel(0), _patternDataTreeView(0), - _patternBuilderTreeView(0), +// _patternBuilderTreeView(0), _patternGeomTreeView(0), _groupsTreeView(0), _meshTreeView(0), - _treeViewDelegate(0), +// _treeViewDelegate(0), _isSaved( false ), moduleActivatedOnce(false), _vertexDiag(0), @@ -187,6 +192,14 @@ HEXABLOCKGUI::HEXABLOCKGUI() : _makeHemiSphereDiag(0), _modelInfoDiag(NULL), _addShapeDiag(NULL), + _vertexInfoDialog(NULL), + _edgeInfoDialog(NULL), + _quadInfoDialog(NULL), + _hexaInfoDialog(NULL), + _vectorInfoDialog(NULL), + _groupInfoDialog(NULL), + _lawInfoDialog(NULL), + _propagationInfoDialog(NULL), currentDialog(NULL), lastOccPrs(NULL), lastVtkDocGView(NULL) @@ -646,7 +659,7 @@ void HEXABLOCKGUI::onWindowClosed( SUIT_ViewWindow* svw) { //HexaBlock Vtk Window has been closed if (currentDialog != NULL) currentDialog->close(); - if (_treeViewDelegate != NULL) _treeViewDelegate->closeDialog(); +// if (_treeViewDelegate != NULL) _treeViewDelegate->closeDialog(); if (currentDocGView != NULL) currentDocGView->setViewWindow(NULL); @@ -685,7 +698,7 @@ void HEXABLOCKGUI::onWindowClosed( SUIT_ViewWindow* svw) if (_edgeAssocDiag != NULL) _edgeAssocDiag->clear(); if (_quadAssocDiag != NULL) _quadAssocDiag->clear(); if (currentDialog != NULL) currentDialog->close(); - if (_treeViewDelegate != NULL) _treeViewDelegate->closeDialog(); +// if (_treeViewDelegate != NULL) _treeViewDelegate->closeDialog(); currentOccGView->getViewWindow()->removeEventFilter(this); @@ -744,7 +757,7 @@ void HEXABLOCKGUI::onViewManagerRemoved( SUIT_ViewManager* vm) { //close opened dialog if (currentDialog != NULL) currentDialog->close(); - if (_treeViewDelegate != NULL) _treeViewDelegate->closeDialog(); +// if (_treeViewDelegate != NULL) _treeViewDelegate->closeDialog(); initialMenus(); } @@ -788,9 +801,11 @@ void HEXABLOCKGUI::onSelectionChanged( const QItemSelection & selected, const QI QTreeView* theTree = NULL; if ( sender() == currentGraphicView->getPatternDataSelectionModel() ){ theTree = _patternDataTreeView; - } else if ( sender() == currentGraphicView->getPatternBuilderSelectionModel() ){ + } + /*else if ( sender() == currentGraphicView->getPatternBuilderSelectionModel() ){ theTree = _patternBuilderTreeView; - } else if ( sender() == currentGraphicView->getPatternGeomSelectionModel() ) { + }*/ + else if ( sender() == currentGraphicView->getPatternGeomSelectionModel() ) { theTree = _patternGeomTreeView; } else if ( sender() == currentGraphicView->getGroupsSelectionModel() ){ @@ -929,9 +944,9 @@ void HEXABLOCKGUI::createAndFillDockWidget() _dwInputPanel = new QDockWidget(aParent); _dwInputPanel->setVisible(false); _dwInputPanel->setWindowTitle("Input Panel"); - _dwInputPanel->setMinimumWidth(DWINPUT_MINIMUM_WIDTH); // --- force a minimum until display +// _dwInputPanel->setMinimumWidth(DWINPUT_MINIMUM_WIDTH); // --- force a minimum until display - _treeViewDelegate = new DocumentDelegate(_dwInputPanel); +// _treeViewDelegate = new DocumentDelegate(_dwInputPanel); //2) ************* document data ( Pattern, Association, Mesh ) in treeview representation // Pattern @@ -946,20 +961,20 @@ void HEXABLOCKGUI::createAndFillDockWidget() patternLayout->setSizeConstraint(QLayout::SetMaximumSize); QSplitter *splitter = new QSplitter(Qt::Vertical,patternFrame); _patternDataTreeView = new QTreeView(patternFrame);//_dwPattern); - _patternBuilderTreeView = new QTreeView(patternFrame); +// _patternBuilderTreeView = new QTreeView(patternFrame); // ---> TO REMOVE _patternGeomTreeView = new QTreeView(patternFrame); splitter->addWidget(_patternDataTreeView); - splitter->addWidget(_patternBuilderTreeView); +// splitter->addWidget(_patternBuilderTreeView); // ---> TO REMOVE splitter->addWidget(_patternGeomTreeView); patternLayout->addWidget(splitter); - _patternDataTreeView->setEditTriggers(QAbstractItemView::AllEditTriggers/*QAbstractItemView::DoubleClicked*/); + _patternDataTreeView->setEditTriggers(QAbstractItemView::NoEditTriggers/*QAbstractItemView::DoubleClicked*/); _patternDataTreeView->setSelectionMode(QAbstractItemView::SingleSelection/*QAbstractItemView::MultiSelection*/); - _patternDataTreeView->setItemDelegate(_treeViewDelegate); +// _patternDataTreeView->setItemDelegate(_treeViewDelegate); - _patternBuilderTreeView->setEditTriggers(QAbstractItemView::AllEditTriggers); - _patternBuilderTreeView->setItemDelegate(_treeViewDelegate); +// _patternBuilderTreeView->setEditTriggers(QAbstractItemView::AllEditTriggers); +// _patternBuilderTreeView->setItemDelegate(_treeViewDelegate); _patternGeomTreeView->setEditTriggers(QAbstractItemView::NoEditTriggers); _patternGeomTreeView->setSelectionMode(QAbstractItemView::SingleSelection/*QAbstractItemView::MultiSelection*/); @@ -974,8 +989,8 @@ void HEXABLOCKGUI::createAndFillDockWidget() _dwGroups->setWindowTitle("Groups"); _dwGroups->setMinimumWidth(DW_MINIMUM_WIDTH); // --- force a minimum until display _groupsTreeView = new QTreeView(_dwGroups); - _groupsTreeView->setEditTriggers(QAbstractItemView::AllEditTriggers); - _groupsTreeView->setItemDelegate(_treeViewDelegate); + _groupsTreeView->setEditTriggers(QAbstractItemView::NoEditTriggers); +// _groupsTreeView->setItemDelegate(_treeViewDelegate); _dwGroups->setWidget(_groupsTreeView); _groupsTreeView->show(); @@ -985,9 +1000,9 @@ void HEXABLOCKGUI::createAndFillDockWidget() _dwMesh->setWindowTitle("Mesh"); _dwMesh->setMinimumWidth(DW_MINIMUM_WIDTH); // --- force a minimum until display _meshTreeView = new QTreeView(_dwMesh); - _meshTreeView->setEditTriggers(QAbstractItemView::AllEditTriggers); + _meshTreeView->setEditTriggers(QAbstractItemView::NoEditTriggers); _meshTreeView->setSelectionMode(QAbstractItemView::SingleSelection); - _meshTreeView->setItemDelegate(_treeViewDelegate); +// _meshTreeView->setItemDelegate(_treeViewDelegate); _dwMesh->setWidget(_meshTreeView); _meshTreeView->show(); @@ -1003,7 +1018,8 @@ void HEXABLOCKGUI::createAndFillDockWidget() // dock widget position aParent->addDockWidget( Qt::LeftDockWidgetArea, _dwObjectBrowser ); - aParent->addDockWidget( Qt::LeftDockWidgetArea, _dwInputPanel ); +// aParent->addDockWidget( Qt::LeftDockWidgetArea, _dwInputPanel ); + aParent->addDockWidget( Qt::RightDockWidgetArea, _dwInputPanel ); aParent->tabifyDockWidget( _dwObjectBrowser, _dwPattern ); aParent->tabifyDockWidget( _dwPattern, _dwGroups ); @@ -1843,8 +1859,8 @@ void HEXABLOCKGUI::switchOnGraphicView(VtkDocumentGraphicView* dgview) dgview->getPatternDataSelectionModel(), SLOT( salomeSelectionChanged() ), Qt::UniqueConnection ); connect( dgview->getPatternDataSelectionModel(), SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ), Qt::UniqueConnection ); - connect( dgview->getPatternBuilderSelectionModel(), SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), - this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ), Qt::UniqueConnection ); +// connect( dgview->getPatternBuilderSelectionModel(), SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), +// this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ), Qt::UniqueConnection ); connect( dgview->getPatternGeomSelectionModel(), SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ), Qt::UniqueConnection ); connect( dgview->getGroupsSelectionModel(), SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), @@ -1864,8 +1880,8 @@ void HEXABLOCKGUI::switchOffGraphicView(VtkDocumentGraphicView* dgview, bool sav dgview->getPatternDataSelectionModel(), SLOT( salomeSelectionChanged() ) ); disconnect( dgview->getPatternDataSelectionModel(), SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); - disconnect( dgview->getPatternBuilderSelectionModel(), SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), - this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); +// disconnect( dgview->getPatternBuilderSelectionModel(), SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), +// this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); disconnect( dgview->getPatternGeomSelectionModel(), SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); disconnect( dgview->getGroupsSelectionModel(), SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), @@ -1878,7 +1894,7 @@ void HEXABLOCKGUI::switchOffGraphicView(VtkDocumentGraphicView* dgview, bool sav //close opened dialog if (currentDialog != NULL) currentDialog->close(); - if (_treeViewDelegate != NULL) _treeViewDelegate->closeDialog(); +// if (_treeViewDelegate != NULL) _treeViewDelegate->closeDialog(); initialMenus(); @@ -1906,25 +1922,25 @@ void HEXABLOCKGUI::switchModel(VtkDocumentGraphicView* dgview) if (currentDocGView != dgview) clearDialogs(); _patternDataTreeView->setModel(dgview->getPatternDataModel()); - _patternBuilderTreeView->setModel(dgview->getPatternBuilderModel()); +// _patternBuilderTreeView->setModel(dgview->getPatternBuilderModel()); _patternGeomTreeView->setModel(dgview->getPatternGeomModel()); _groupsTreeView->setModel(dgview->getGroupsModel()); _meshTreeView->setModel(dgview->getMeshModel()); _patternDataTreeView->setSelectionModel(dgview->getPatternDataSelectionModel()); - _patternDataTreeView->setEditTriggers(QAbstractItemView::AllEditTriggers); + _patternDataTreeView->setEditTriggers(QAbstractItemView::NoEditTriggers); - _patternBuilderTreeView->setSelectionModel(dgview->getPatternBuilderSelectionModel()); - _patternBuilderTreeView->setEditTriggers(QAbstractItemView::AllEditTriggers); +// _patternBuilderTreeView->setSelectionModel(dgview->getPatternBuilderSelectionModel()); +// _patternBuilderTreeView->setEditTriggers(QAbstractItemView::AllEditTriggers); _patternGeomTreeView->setSelectionModel(dgview->getPatternGeomSelectionModel()); _patternGeomTreeView->setEditTriggers(QAbstractItemView::NoEditTriggers); _groupsTreeView->setSelectionModel(dgview->getGroupsSelectionModel()); - _groupsTreeView->setEditTriggers(QAbstractItemView::AllEditTriggers); + _groupsTreeView->setEditTriggers(QAbstractItemView::NoEditTriggers); _meshTreeView->setSelectionModel(dgview->getMeshSelectionModel()); - _meshTreeView->setEditTriggers(QAbstractItemView::AllEditTriggers); + _meshTreeView->setEditTriggers(QAbstractItemView::NoEditTriggers); // = * init occ view * = @@ -2207,11 +2223,11 @@ void HEXABLOCKGUI::_showDialogBox( HexaBaseDialog* diag ) currentModelDialogs.insert(diag); //close the current dialog box info - if (_treeViewDelegate != NULL) - _treeViewDelegate->closeDialog(); +// if (_treeViewDelegate != NULL) +// _treeViewDelegate->closeDialog(); - if (_dwInputPanel->widget()) - _dwInputPanel->widget()->close(); +// if (_dwInputPanel->widget()) +// _dwInputPanel->widget()->close(); //Temporary for debugging EdgeAssoc Faked InfoDialog if (diag == _edgeAssocDiag) @@ -2233,6 +2249,113 @@ void HEXABLOCKGUI::_showDialogBox( HexaBaseDialog* diag ) currentDialog = diag; diag->setFocus(); + + if (currentDocGView != NULL) + currentDocGView->getPatternDataSelectionModel()->setInfoMode(false); +} + +void HEXABLOCKGUI::showVertexInfoDialog(HEXA_NS::Vertex* vertex) +{ + if (vertex == NULL || _dwInputPanel == NULL) + return; + + if (_vertexInfoDialog == NULL) + _vertexInfoDialog = new VertexDialog(_dwInputPanel, HexaBaseDialog::INFO_MODE); + + _vertexInfoDialog->setValue(vertex); + _vertexInfoDialog->resetSizeAndShow(_dwInputPanel); + currentDialog = _vertexInfoDialog; +} + +void HEXABLOCKGUI::showEdgeInfoDialog(HEXA_NS::Edge* edge) +{ + if (edge == NULL || _dwInputPanel == NULL) + return; + + if (_edgeInfoDialog == NULL) + _edgeInfoDialog = new EdgeDialog(_dwInputPanel, HexaBaseDialog::INFO_MODE); + + _edgeInfoDialog->setValue(edge); + _edgeInfoDialog->resetSizeAndShow(_dwInputPanel); + currentDialog = _edgeInfoDialog; +} + +void HEXABLOCKGUI::showQuadInfoDialog(HEXA_NS::Quad* quad) +{ + if (quad == NULL || _dwInputPanel == NULL) + return; + + if (_quadInfoDialog == NULL) + _quadInfoDialog = new QuadDialog(_dwInputPanel, HexaBaseDialog::INFO_MODE); + + _quadInfoDialog->setValue(quad); + _quadInfoDialog->resetSizeAndShow(_dwInputPanel); + currentDialog = _quadInfoDialog; +} + +void HEXABLOCKGUI::showHexaInfoDialog(HEXA_NS::Hexa* hexa) +{ + if (hexa == NULL || _dwInputPanel == NULL) + return; + + if (_hexaInfoDialog == NULL) + _hexaInfoDialog = new HexaDialog(_dwInputPanel, HexaBaseDialog::INFO_MODE); + + _hexaInfoDialog->setValue(hexa); + _hexaInfoDialog->resetSizeAndShow(_dwInputPanel); + currentDialog = _hexaInfoDialog; +} + +void HEXABLOCKGUI::showVectorInfoDialog(HEXA_NS::Vector* vector) +{ + if (vector == NULL || _dwInputPanel == NULL) + return; + + if (_vectorInfoDialog == NULL) + _vectorInfoDialog = new VectorDialog(_dwInputPanel, HexaBaseDialog::INFO_MODE); + + _vectorInfoDialog->setValue(vector); + _vectorInfoDialog->resetSizeAndShow(_dwInputPanel); + currentDialog = _vectorInfoDialog; +} + +void HEXABLOCKGUI::showGroupInfoDialog(HEXA_NS::Group* group) +{ + if (group == NULL || _dwInputPanel == NULL) + return; + + if (_groupInfoDialog == NULL) + _groupInfoDialog = new GroupDialog(_dwInputPanel, HexaBaseDialog::INFO_MODE); + + _groupInfoDialog->setValue(group); + _groupInfoDialog->resetSizeAndShow(_dwInputPanel); + currentDialog = _groupInfoDialog; +} + +void HEXABLOCKGUI::showLawInfoDialog(HEXA_NS::Law* law) +{ + if (law == NULL || _dwInputPanel == NULL) + return; + + if (_lawInfoDialog == NULL) + _lawInfoDialog = new LawDialog(_dwInputPanel, HexaBaseDialog::INFO_MODE); + + _lawInfoDialog->setValue(law); + _lawInfoDialog->resetSizeAndShow(_dwInputPanel); + currentDialog = _lawInfoDialog; +} + +void HEXABLOCKGUI::showPropagationInfoDialog(HEXA_NS::Propagation* propagation) +{ + if (propagation == NULL || _dwInputPanel == NULL) + return; + + if (_propagationInfoDialog == NULL) + _propagationInfoDialog = new PropagationDialog(_dwInputPanel, HexaBaseDialog::INFO_MODE); + + _propagationInfoDialog->setValue(propagation); + _propagationInfoDialog->resetSizeAndShow(_dwInputPanel); + currentDialog = _propagationInfoDialog; } void HEXABLOCKGUI::addVertex() @@ -2301,32 +2424,32 @@ void HEXABLOCKGUI::addVector() _vectorDiag->name_le->setText(doc->getNextName(HEXA_NS::EL_VECTOR).c_str()); } -void HEXABLOCKGUI::addCylinder() -{ - if ( !_cylinderDiag ){ - _cylinderDiag = new CylinderDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _cylinderDiag ); - - //set default name - HEXA_NS::Document* doc = getCurrentModel() ? getCurrentModel()->getHexaDocument() : NULL; - if (_cylinderDiag != NULL && doc != NULL) - _cylinderDiag->name_le->setText(doc->getNextName(HEXA_NS::EL_CYLINDER).c_str()); -} - +//void HEXABLOCKGUI::addCylinder() +//{ +// if ( !_cylinderDiag ){ +// _cylinderDiag = new CylinderDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); +// } +// _showDialogBox( _cylinderDiag ); +// +// //set default name +// HEXA_NS::Document* doc = getCurrentModel() ? getCurrentModel()->getHexaDocument() : NULL; +// if (_cylinderDiag != NULL && doc != NULL) +// _cylinderDiag->name_le->setText(doc->getNextName(HEXA_NS::EL_CYLINDER).c_str()); +//} -void HEXABLOCKGUI::addPipe() -{ - if ( !_pipeDiag){ - _pipeDiag = new PipeDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _pipeDiag ); - //set default name - HEXA_NS::Document* doc = getCurrentModel() ? getCurrentModel()->getHexaDocument() : NULL; - if (_pipeDiag != NULL && doc != NULL) - _pipeDiag->name_le->setText(doc->getNextName(HEXA_NS::EL_CYLINDER).c_str()); -} +//void HEXABLOCKGUI::addPipe() +//{ +// if ( !_pipeDiag){ +// _pipeDiag = new PipeDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); +// } +// _showDialogBox( _pipeDiag ); +// +// //set default name +// HEXA_NS::Document* doc = getCurrentModel() ? getCurrentModel()->getHexaDocument() : NULL; +// if (_pipeDiag != NULL && doc != NULL) +// _pipeDiag->name_le->setText(doc->getNextName(HEXA_NS::EL_CYLINDER).c_str()); +//} void HEXABLOCKGUI::makeGrid() @@ -2630,9 +2753,9 @@ void HEXABLOCKGUI::removeLaw() void HEXABLOCKGUI::setPropagation() { - if ( !_propagationDiag ){ + if ( !_propagationDiag ) _propagationDiag = new PropagationDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } + _showDialogBox( _propagationDiag ); } @@ -2640,10 +2763,9 @@ void HEXABLOCKGUI::setPropagation() // -------------------------------------------- void HEXABLOCKGUI::computeMesh() { - if ( !_computeMeshDiag ){ + if ( !_computeMeshDiag ) _computeMeshDiag = new ComputeMeshDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _computeMeshDiag->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + _showDialogBox( _computeMeshDiag ); } @@ -2804,12 +2926,12 @@ QStringList HEXABLOCKGUI::getQuickDirList() extern "C" { - HEXABLOCK_EXPORT CAM_Module* createModule() + HexaExport CAM_Module* createModule() { return new HEXABLOCKGUI(); } - HEXABLOCK_EXPORT char* getModuleVersion() + HexaExport char* getModuleVersion() { return (char*)HEXABLOCK_VERSION_STR; } diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI.hxx index fbc8652..b045166 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI.hxx @@ -20,8 +20,6 @@ #ifndef _HEXABLOCKGUI_HXX_ #define _HEXABLOCKGUI_HXX_ -#include "HEXABLOCKGUI_Export.hxx" - #include #include #include @@ -56,15 +54,15 @@ namespace HEXABLOCK class VtkDocumentGraphicView; class OccGraphicView; class GraphicViewsHandler; - class DocumentDelegate; +// class DocumentDelegate; class DocumentModel; class PatternDataModel; - class PatternBuilderModel; +// class PatternBuilderModel; class AssociationsModel; class GroupsModel; class MeshModel; class PatternDataSelectionModel; - class PatternBuilderSelectionModel; +// class PatternBuilderSelectionModel; class GroupsSelectionModel; class MeshSelectionModel; @@ -115,7 +113,7 @@ class OCCViewer_ViewWindow; class LightApp_VTKSelector; -class HEXABLOCK_EXPORT HEXABLOCKGUI : public SalomeApp_Module +class HexaExport HEXABLOCKGUI : public SalomeApp_Module { Q_OBJECT @@ -192,6 +190,15 @@ public: QTreeView* getPatternDataTreeView() const { return _patternDataTreeView; } QTreeView* getPatternGeomTreeView() const { return _patternGeomTreeView; } + void showVertexInfoDialog(HEXA_NS::Vertex* vertex); + void showEdgeInfoDialog(HEXA_NS::Edge* edge); + void showQuadInfoDialog(HEXA_NS::Quad* quad); + void showHexaInfoDialog(HEXA_NS::Hexa* hexa); + void showVectorInfoDialog(HEXA_NS::Vector* vector); + void showGroupInfoDialog(HEXA_NS::Group* group); + void showLawInfoDialog(HEXA_NS::Law* law); + void showPropagationInfoDialog(HEXA_NS::Propagation* propagation); + public slots: bool deactivateModule( SUIT_Study* theStudy); bool activateModule( SUIT_Study* theStudy); @@ -248,8 +255,8 @@ private slots: void addHexa(); void addVector(); - void addCylinder(); - void addPipe(); +// void addCylinder(); +// void addPipe(); void makeGrid(); void makeCylinder(); void makePipe(); @@ -327,6 +334,8 @@ private: QDockWidget *_dwInputPanel; // user Input + // ** Elements creation and modification Dialogs ** + // Dialog Box ( to keep persistent values ) HEXABLOCK::GUI::VertexDialog* _vertexDiag; HEXABLOCK::GUI::EdgeDialog* _edgeDiag; @@ -363,6 +372,16 @@ private: HEXABLOCK::GUI::ModelInfoDialog* _modelInfoDiag; HEXABLOCK::GUI::AddShapeDialog* _addShapeDiag; + // ** Elements information dialogs ** + HEXABLOCK::GUI::VertexDialog* _vertexInfoDialog; + HEXABLOCK::GUI::EdgeDialog* _edgeInfoDialog; + HEXABLOCK::GUI::QuadDialog* _quadInfoDialog; + HEXABLOCK::GUI::HexaDialog* _hexaInfoDialog; + HEXABLOCK::GUI::VectorDialog* _vectorInfoDialog; + HEXABLOCK::GUI::GroupDialog* _groupInfoDialog; + HEXABLOCK::GUI::LawDialog* _lawInfoDialog; + HEXABLOCK::GUI::PropagationDialog* _propagationInfoDialog; + std::set currentModelDialogs; // Actions @@ -381,8 +400,8 @@ private: // Pattern Builder QAction *_addVector; - QAction *_addCylinder; - QAction *_addPipe; +// QAction *_addCylinder; +// QAction *_addPipe; QAction *_makeGrid; //Cartesian, Cylindrical, Spherical QAction *_makeCylinder; QAction *_makePipe; @@ -425,9 +444,7 @@ private: // Meshing QAction *_computeMesh; - QAction* _showModelInfoAct; - QAction* _addShapeAct; @@ -444,14 +461,14 @@ private: // VIEW VIEW VIEW VIEW VIEW VIEW VIEW VIEW VIEW VIEW QTreeView* _patternDataTreeView; // document's pattern : 1 ( only one view ) - QTreeView* _patternBuilderTreeView; // document's pattern : 1 ( only one view ) +// QTreeView* _patternBuilderTreeView; // document's pattern : 1 ( only one view ) QTreeView* _patternGeomTreeView; // the geometries' tree view QTreeView* _associationTreeView; // document's association : 1 ( only one view ) QTreeView* _groupsTreeView; // document's groups QTreeView* _meshTreeView; // document's mesh property: 1 ( only one view ) // DELEGATE DELEGATE DELEGATE DELEGATE DELEGATE DELEGATE DELEGATE - HEXABLOCK::GUI::DocumentDelegate *_treeViewDelegate; // specific editor for each item of the tree +// HEXABLOCK::GUI::DocumentDelegate *_treeViewDelegate; // specific editor for each item of the tree HEXABLOCK::GUI::GraphicViewsHandler* graphicViewsHandler; //vtk views hanlder (create, close, ...) diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.cxx index 36c274b..4d4a27d 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.cxx @@ -60,7 +60,8 @@ QWidget *DocumentDelegate::createEditor( QWidget *parent, if (_dw->widget()) _dw->widget()->close(); if ( !_dw->isVisible() ) _dw->setVisible(true); - switch ( index.data(HEXA_TREE_ROLE).toInt() ){ + switch ( index.data(HEXA_TREE_ROLE).toInt() ) + { case VERTEX_TREE : editor = new VertexDialog(_dw, HexaBaseDialog::INFO_MODE); break; case EDGE_TREE : editor = new EdgeDialog(_dw, HexaBaseDialog::INFO_MODE); break; case QUAD_TREE : editor = new QuadDialog(_dw, HexaBaseDialog::INFO_MODE); break; @@ -78,7 +79,9 @@ QWidget *DocumentDelegate::createEditor( QWidget *parent, case LAW_TREE : editor = new LawDialog(_dw, HexaBaseDialog::INFO_MODE); break; case PROPAGATION_TREE : editor = new PropagationDialog(_dw, HexaBaseDialog::INFO_MODE); break; } - if ( editor != NULL ){ + + if ( editor != NULL ) + { HEXABLOCKGUI::assocInProgress = false; //show the editor in the dockwidget @@ -88,6 +91,7 @@ QWidget *DocumentDelegate::createEditor( QWidget *parent, _dw->close(); _currentEditor = editor; + return editor; } @@ -97,7 +101,7 @@ void DocumentDelegate::closeDialog() if (_currentEditor!=NULL) { _currentEditor->close(); - emit closeEditor(_currentEditor, NoHint); + emit closeEditor(_currentEditor, NoHint); //Problem delete _currentEditor; _currentEditor = NULL; } @@ -186,7 +190,6 @@ void DocumentDelegate::setEditorData( QWidget *editor, } break; } - } diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.hxx index 0022196..59ecf19 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.hxx @@ -19,7 +19,7 @@ #ifndef __HEXABLOCKGUI_DOCUMENTDELEGATE_HXX_ #define __HEXABLOCKGUI_DOCUMENTDELEGATE_HXX_ -#include "HEXABLOCKGUI_Export.hxx" + // QEvent * event, QAbstractItemModel #include @@ -37,11 +37,13 @@ #include "HEXABLOCKGUI_DocumentItem.hxx" #include "HEXABLOCKGUI_DocumentPanel.hxx" +#include "hexa_base.hxx" + namespace HEXABLOCK { namespace GUI { - class HEXABLOCK_EXPORT DocumentDelegate : public QItemDelegate + class HexaExport DocumentDelegate : public QItemDelegate { Q_OBJECT @@ -79,7 +81,7 @@ namespace HEXABLOCK QDockWidget* _dw; // creator's container private slots: - //void commitEditor(); + void commitEditor(); }; } diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentItem.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentItem.cxx index 04a0bc5..7e3e2b7 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentItem.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentItem.cxx @@ -122,7 +122,7 @@ QVariant ElementItem::data( int role ) const // case CYLINDERITEM: return QVariant::fromValue( (HEXA_NS::Cylinder*)m_DocElt ); // case PIPEITEM: return QVariant::fromValue( (HEXA_NS::Pipe*)m_DocElt ); case ELEMENTSITEM: return QVariant::fromValue( (HEXA_NS::Elements*)m_DocElt ); - case CROSSELEMENTSITEM: return QVariant::fromValue( (HEXA_NS::CrossElements*)m_DocElt ); +// case CROSSELEMENTSITEM: return QVariant::fromValue( (HEXA_NS::CrossElements*)m_DocElt ); case GEOMSHAPEITEM: return QVariant::fromValue( (HEXA_NS::NewShape*) m_DocElt ); case GEOMPOINTITEM: return QVariant::fromValue( (HEXA_NS::VertexShape*) m_DocElt ); case GEOMEDGEITEM: return QVariant::fromValue( (HEXA_NS::EdgeShape*) m_DocElt ); diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentItem.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentItem.hxx index dc1a3c3..4bab98b 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentItem.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentItem.hxx @@ -20,31 +20,25 @@ #ifndef _HEXABLOCKGUI_DOCUMENTITEM_HXX_ #define _HEXABLOCKGUI_DOCUMENTITEM_HXX_ -#include "HEXABLOCKGUI_Export.hxx" #include -#include -#include -#include -#include +#include "HexVertex.hxx" +#include "HexEdge.hxx" +#include "HexQuad.hxx" +#include "HexHexa.hxx" -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "HexVector.hxx" +#include "HexElements.hxx" +#include "HexNewShape.hxx" +#include "HexVertexShape.hxx" +#include "HexEdgeShape.hxx" +#include "HexFaceShape.hxx" - - -#include -#include -#include +#include "HexGroup.hxx" +#include "HexLaw.hxx" +#include "HexPropagation.hxx" #include "vtkActor.h" @@ -56,10 +50,10 @@ Q_DECLARE_METATYPE( HEXA_NS::Quad* ); Q_DECLARE_METATYPE( HEXA_NS::Hexa* ); Q_DECLARE_METATYPE( HEXA_NS::Vector* ); -Q_DECLARE_METATYPE( HEXA_NS::Cylinder* ); -Q_DECLARE_METATYPE( HEXA_NS::Pipe* ); +// Q_DECLARE_METATYPE( HEXA_NS::Cylinder* ); +// Q_DECLARE_METATYPE( HEXA_NS::Pipe* ); Q_DECLARE_METATYPE( HEXA_NS::Elements* ); -Q_DECLARE_METATYPE( HEXA_NS::CrossElements* ); +// Q_DECLARE_METATYPE( HEXA_NS::CrossElements* ); Q_DECLARE_METATYPE( HEXA_NS::NewShape* ); Q_DECLARE_METATYPE( HEXA_NS::SubShape* ); Q_DECLARE_METATYPE( HEXA_NS::VertexShape* ); @@ -99,7 +93,7 @@ namespace HEXABLOCK PROPAGATIONITEM, }; - enum HexaTreeRole { + enum HexaTreeRole { VERTEX_TREE = 10, EDGE_TREE, QUAD_TREE, @@ -157,7 +151,7 @@ namespace HEXABLOCK // QVariant::UserType //=================================================================================== - class HEXABLOCK_EXPORT ElementItem : public QStandardItem + class HexaExport ElementItem : public QStandardItem { public: ElementItem( HEXA_NS::EltBase* docElement, QString entry, HexaType ttype, HexaTreeRole treeRole); @@ -175,7 +169,7 @@ namespace HEXABLOCK }; //=================================================================================== - class HEXABLOCK_EXPORT GraphicElementItem : public ElementItem + class HexaExport GraphicElementItem : public ElementItem { public: GraphicElementItem( HEXA_NS::EltBase* docElement, QString entry, HexaType ttype, HexaTreeRole treeRole): @@ -188,7 +182,7 @@ namespace HEXABLOCK int IDinActor; }; - class HEXABLOCK_EXPORT StandardElementItem : public ElementItem + class HexaExport StandardElementItem : public ElementItem { public: StandardElementItem( HEXA_NS::EltBase* docElement, QString entry, HexaType ttype, HexaTreeRole treeRole): @@ -197,40 +191,40 @@ namespace HEXABLOCK } }; - class HEXABLOCK_EXPORT VertexItem : public GraphicElementItem + class HexaExport VertexItem : public GraphicElementItem { public: VertexItem( HEXA_NS::Vertex* hexaVertex, QString entry = ""); }; - class HEXABLOCK_EXPORT EdgeItem : public GraphicElementItem + class HexaExport EdgeItem : public GraphicElementItem { public: EdgeItem( HEXA_NS::Edge* hexaEdge, QString entry = ""); }; //----------------------------------------- - class HEXABLOCK_EXPORT QuadItem : public GraphicElementItem + class HexaExport QuadItem : public GraphicElementItem { public: QuadItem( HEXA_NS::Quad* hexaQuad, QString entry = ""); }; //----------------------------------------- - class HEXABLOCK_EXPORT HexaItem : public GraphicElementItem + class HexaExport HexaItem : public GraphicElementItem { public: HexaItem( HEXA_NS::Hexa* hexaHexa, QString entry = ""); }; //----------------------------------------- - class HEXABLOCK_EXPORT VectorItem : public StandardElementItem + class HexaExport VectorItem : public StandardElementItem { public: VectorItem( HEXA_NS::Vector* hexaVector, QString entry = ""); }; //----------------------------------------- -// class HEXABLOCK_EXPORT CylinderItem : public StandardElementItem +// class HexaExport CylinderItem : public StandardElementItem // { // public: // CylinderItem( HEXA_NS::Cylinder* hexaCyl, QString entry = ""); @@ -244,7 +238,7 @@ namespace HEXABLOCK // }; //----------------------------------------- - class HEXABLOCK_EXPORT ElementsItem : public StandardElementItem + class HexaExport ElementsItem : public StandardElementItem { public: ElementsItem( HEXA_NS::Elements* hexaElements, QString entry = "" ); @@ -257,7 +251,7 @@ namespace HEXABLOCK // }; //------------------------------------------------ - class HEXABLOCK_EXPORT GeomItem: public StandardElementItem + class HexaExport GeomItem: public StandardElementItem { public: GeomItem( HEXA_NS::EltBase* geomShape, QString entry, HexaType ttype, HexaTreeRole treeRole, HEXA_NS::EltBase* assoc = NULL ); @@ -269,35 +263,35 @@ namespace HEXABLOCK }; //------------------------------------------------ - class HEXABLOCK_EXPORT GeomShapeItem: public GeomItem + class HexaExport GeomShapeItem: public GeomItem { public: GeomShapeItem( HEXA_NS::NewShape* shape, HEXA_NS::EltBase* assoc = NULL); }; //------------------------------------------------ - class HEXABLOCK_EXPORT GeomPointItem: public GeomItem + class HexaExport GeomPointItem: public GeomItem { public: GeomPointItem( HEXA_NS::VertexShape* geomPoint, HEXA_NS::Vertex* associatedVertex = NULL); }; //------------------------------------------------ - class HEXABLOCK_EXPORT GeomEdgeItem: public GeomItem + class HexaExport GeomEdgeItem: public GeomItem { public: GeomEdgeItem( HEXA_NS::EdgeShape* geomEdge, HEXA_NS::Edge* associatedEdge = NULL); }; //------------------------------------------------ - class HEXABLOCK_EXPORT GeomFaceItem: public GeomItem + class HexaExport GeomFaceItem: public GeomItem { public: GeomFaceItem( HEXA_NS::FaceShape* geomFace, HEXA_NS::Quad* associatedQuad = NULL); }; //----------------------------------------- - class HEXABLOCK_EXPORT GroupItem : public QStandardItem + class HexaExport GroupItem : public QStandardItem { public: GroupItem( HEXA_NS::Group* hexaGroup ); @@ -309,7 +303,7 @@ namespace HEXABLOCK }; - class HEXABLOCK_EXPORT LawItem : public QStandardItem + class HexaExport LawItem : public QStandardItem { public: LawItem( HEXA_NS::Law* hexaLaw ); @@ -321,7 +315,7 @@ namespace HEXABLOCK }; - class HEXABLOCK_EXPORT PropagationItem : public QStandardItem + class HexaExport PropagationItem : public QStandardItem { public: PropagationItem( HEXA_NS::Propagation* hexaPropagation ); diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.cxx index 317dd5a..dfb011b 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.cxx @@ -168,7 +168,7 @@ HEXA_NS::EltBase* DocumentModel::getHexaPtr(const QModelIndex& iElt) case HEXA_TREE : elt = getHexaPtr(iElt); break; case VECTOR_TREE : elt = getHexaPtr(iElt); break; case ELEMENTS_TREE : elt = getHexaPtr(iElt); break; - case CROSSELEMENTS_TREE : elt = getHexaPtr(iElt); break; +// case CROSSELEMENTS_TREE : elt = getHexaPtr(iElt); break; case GEOMSHAPE_TREE: elt = getHexaPtr(iElt); break; case GEOMPOINT_TREE: elt = getHexaPtr(iElt); break; case GEOMEDGE_TREE: elt = getHexaPtr(iElt); break; @@ -255,7 +255,7 @@ void DocumentModel::load( const QString& xmlFileName ) // Fill Data clearAll(); fillData(); - fillBuilder(); +// fillBuilder(); fillGeometry(); fillAssociation(); fillGroups(); @@ -313,7 +313,7 @@ void DocumentModel::refresh() clearAll(); fillData(); - fillBuilder(); +// fillBuilder(); fillGeometry(); fillAssociation(); fillGroups(); @@ -325,7 +325,7 @@ void DocumentModel::refresh() void DocumentModel::clearAll() { clearData(); - clearBuilder(); +// clearBuilder(); clearGeometry(); clearAssociation(); clearGroups(); @@ -338,16 +338,20 @@ void DocumentModel::clearData() _edgeDirItem->removeRows(0, _edgeDirItem->rowCount() ); _quadDirItem->removeRows(0, _quadDirItem->rowCount() ); _hexaDirItem->removeRows(0, _hexaDirItem->rowCount() ); -} - -void DocumentModel::clearBuilder() -{ _vectorDirItem->removeRows(0, _vectorDirItem->rowCount() ); _elementsDirItem->removeRows(0, _elementsDirItem->rowCount() ); _crossElementsDirItem->removeRows(0, _crossElementsDirItem->rowCount() ); } + +//void DocumentModel::clearBuilder() +//{ +// _vectorDirItem->removeRows(0, _vectorDirItem->rowCount() ); +// _elementsDirItem->removeRows(0, _elementsDirItem->rowCount() ); +// _crossElementsDirItem->removeRows(0, _crossElementsDirItem->rowCount() ); +//} + void DocumentModel::clearGeometry() { _explicitShapesDirItem->removeRows(0, _explicitShapesDirItem->rowCount() ); @@ -415,53 +419,96 @@ void DocumentModel::fillData() hItem = new HexaItem(h, _entry); _hexaDirItem->appendRow(hItem); } -} + // +++++ Builder ++++++++++++++++++++++++++++++ -void DocumentModel::fillBuilder() -{ - HEXA_NS::Vector *v = NULL; - VectorItem *vItem = NULL; + HEXA_NS::Vector *vec = NULL; + VectorItem *vecItem = NULL; int nbVector = _hexaDocument->countVector(); for ( int i=0; igetVector(i); - vItem = new VectorItem(v); - _vectorDirItem->appendRow(vItem); + vec = _hexaDocument->getVector(i); + vecItem = new VectorItem(vec); + _vectorDirItem->appendRow(vecItem); } //******* A VOIR AVEC ALAIN POUR LE REMPLISSAGE DE L'ARBRE ELEMENTS ET CROSSELEMENTS (ByCylinder) *******/ //******* OU SONT STOCKES LES ELEMENTS ET LES CROSSELEMENTS DANS LE DOCUMENT? ******/ // _cylinderDirItem -// HEXA_NS::Cylinder *c = NULL; -// HEXA_NS::Elements* c = NULL; -// CylinderItem *cItem = NULL; -// ElementsItem* cItem = NULL; -// int nbCylinder = _hexaDocument->countCylinder(); -// for ( int i=0; igetCylinder(i); -// cItem = new CylinderItem(c, _entry); -// cItem = new ElementsItem(c, _entry); -// _cylinderDirItem->appendRow(cItem); -// _elementsDirItem->appendRow(cItem); -// } + // HEXA_NS::Cylinder *c = NULL; + // HEXA_NS::Elements* c = NULL; + // CylinderItem *cItem = NULL; + // ElementsItem* cItem = NULL; + // int nbCylinder = _hexaDocument->countCylinder(); + // for ( int i=0; igetCylinder(i); + // cItem = new CylinderItem(c, _entry); + // cItem = new ElementsItem(c, _entry); + // _cylinderDirItem->appendRow(cItem); + // _elementsDirItem->appendRow(cItem); + // } // _pipeDirItem -// HEXA_NS::Pipe *p = NULL; -// HEXA_NS::Elements* p = NULL; -// PipeItem *pItem = NULL; -// ElementsItem* pItem = NULL; -// int nbPipe = _hexaDocument->countPipe(); -// for ( int i=0; igetPipe(i); -// pItem = new PipeItem(p); -// pItem = new ElementsItem(p, _entry); -// _pipeDirItem->appendRow(pItem); -// _elementsDirItem->appendRow(pItem); -// } + // HEXA_NS::Pipe *p = NULL; + // HEXA_NS::Elements* p = NULL; + // PipeItem *pItem = NULL; + // ElementsItem* pItem = NULL; + // int nbPipe = _hexaDocument->countPipe(); + // for ( int i=0; igetPipe(i); + // pItem = new PipeItem(p); + // pItem = new ElementsItem(p, _entry); + // _pipeDirItem->appendRow(pItem); + // _elementsDirItem->appendRow(pItem); + // } //******************************************************************************************************** } + +//void DocumentModel::fillBuilder() +//{ +// HEXA_NS::Vector *v = NULL; +// VectorItem *vItem = NULL; +// int nbVector = _hexaDocument->countVector(); +// for ( int i=0; igetVector(i); +// vItem = new VectorItem(v); +// _vectorDirItem->appendRow(vItem); +// } +// +// //******* A VOIR AVEC ALAIN POUR LE REMPLISSAGE DE L'ARBRE ELEMENTS ET CROSSELEMENTS (ByCylinder) *******/ +// //******* OU SONT STOCKES LES ELEMENTS ET LES CROSSELEMENTS DANS LE DOCUMENT? ******/ +// +// // _cylinderDirItem +//// HEXA_NS::Cylinder *c = NULL; +//// HEXA_NS::Elements* c = NULL; +//// CylinderItem *cItem = NULL; +//// ElementsItem* cItem = NULL; +//// int nbCylinder = _hexaDocument->countCylinder(); +//// for ( int i=0; igetCylinder(i); +//// cItem = new CylinderItem(c, _entry); +//// cItem = new ElementsItem(c, _entry); +//// _cylinderDirItem->appendRow(cItem); +//// _elementsDirItem->appendRow(cItem); +//// } +// +// // _pipeDirItem +//// HEXA_NS::Pipe *p = NULL; +//// HEXA_NS::Elements* p = NULL; +//// PipeItem *pItem = NULL; +//// ElementsItem* pItem = NULL; +//// int nbPipe = _hexaDocument->countPipe(); +//// for ( int i=0; igetPipe(i); +//// pItem = new PipeItem(p); +//// pItem = new ElementsItem(p, _entry); +//// _pipeDirItem->appendRow(pItem); +//// _elementsDirItem->appendRow(pItem); +//// } +// //******************************************************************************************************** +//} + void DocumentModel::fillGeometry() { PatternGeomSelectionModel* pgsm = HEXABLOCKGUI::currentDocGView->getPatternGeomSelectionModel(); @@ -828,6 +875,7 @@ void DocumentModel::allowElementsSelectionOnly() _propagationItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); } +/********************************************************** void DocumentModel::allowCrossElementsSelectionOnly() { _vertexItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); @@ -843,6 +891,7 @@ void DocumentModel::allowCrossElementsSelectionOnly() _lawItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); _propagationItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); } + ********************************************************** */ void DocumentModel::allowLawSelectionOnly() { @@ -987,19 +1036,30 @@ QModelIndex DocumentModel::addEdgeVertices (const QModelIndex &i_v0, const QMode return edgeIndex; } -QModelIndex DocumentModel::addEdgeVector ( const QModelIndex &i_v, const QModelIndex &i_vec ) +QModelIndex DocumentModel::addEdgeVector( const QModelIndex &i_v, const QModelIndex &i_vec ) { QModelIndex edgeIndex; - HEXA_NS::Vertex* hv0 = getHexaPtr(i_v); + HEXA_NS::Vertex* hv = getHexaPtr(i_v); HEXA_NS::Vector* hvec = getHexaPtr(i_vec); - HEXA_NS::Edge* he = _hexaDocument->addEdgeVector( hv0, hvec ); + if (hv == NULL || hvec == NULL) return edgeIndex; + + HEXA_NS::Edge* he = _hexaDocument->addEdgeVector( hv, hvec ); if ( BadElement(he) ) return edgeIndex; + HEXA_NS::Vertex* hv2 = he->getAval(); //the new vertex resulting from the creation of the edge + if (hv2 == NULL) return edgeIndex; + + //ADD the edge in the treeview EdgeItem* e = new EdgeItem(he, _entry); - _vectorDirItem->appendRow(e); + _edgeDirItem->appendRow(e); edgeIndex = e->index(); + + //The resulting Vertex + VertexItem* v = new VertexItem(hv2, _entry); + _vertexDirItem->appendRow(v); + emit patternDataChanged(); return edgeIndex; @@ -1015,7 +1075,7 @@ QModelIndex DocumentModel::addQuadVertices( const QModelIndex &i_v0, const QMode HEXA_NS::Vertex* hv2 = getHexaPtr(i_v2); HEXA_NS::Vertex* hv3 = getHexaPtr(i_v3); - if ( hv0 && hv1 && hv2 && hv3 ){ + if ( hv0 and hv1 and hv2 and hv3 ){ HEXA_NS::Quad* hq = _hexaDocument->addQuadVertices( hv0, hv1, hv2, hv3 ); if ( BadElement(hq) ) return quadIndex; @@ -1038,7 +1098,7 @@ QModelIndex DocumentModel::addQuadEdges( const QModelIndex &e0, const QModelInde HEXA_NS::Edge* he2 = getHexaPtr(e2); HEXA_NS::Edge* he3 = getHexaPtr(e3); - if ( he0 && he1 && he2 && he3 ){ + if ( he0 and he1 and he2 and he3 ){ HEXA_NS::Quad* hq = _hexaDocument->addQuad( he0, he1, he2, he3 ); if ( BadElement(hq) ) return quadIndex; @@ -2125,9 +2185,10 @@ QString DocumentModel::documentEntry() PatternDataModel::PatternDataModel( QObject * parent ) : QSortFilterProxyModel( parent ) { - QString dataRegExp = QString("(%1|%2|%3|%4|%5|%6|%7|%8)"). - arg(VERTEX_TREE).arg(EDGE_TREE).arg(QUAD_TREE).arg(HEXA_TREE). - arg(VERTEX_DIR_TREE).arg(EDGE_DIR_TREE).arg(QUAD_DIR_TREE).arg(HEXA_DIR_TREE); + QString dataRegExp = QString("(%1|%2|%3|%4|%5|%6|%7|%8|%9|%10|%11|%12)"). + arg(VERTEX_TREE).arg(EDGE_TREE).arg(QUAD_TREE).arg(HEXA_TREE).arg(VECTOR_TREE).arg(ELEMENTS_TREE). + arg(VERTEX_DIR_TREE).arg(EDGE_DIR_TREE).arg(QUAD_DIR_TREE).arg(HEXA_DIR_TREE).arg(VECTOR_DIR_TREE). + arg(ELEMENTS_DIR_TREE); setFilterRole(HEXA_TREE_ROLE); setFilterRegExp ( QRegExp(dataRegExp) ); @@ -2188,7 +2249,7 @@ Qt::ItemFlags PatternDataModel::flags(const QModelIndex &index) const QVariant PatternDataModel::headerData ( int section, Qt::Orientation orientation, int role ) const { - if ( section == 0 && orientation == Qt::Horizontal && role == Qt::DisplayRole ){ + if ( section == 0 and orientation == Qt::Horizontal and role == Qt::DisplayRole ){ return QVariant( "Data" ); } else { return QSortFilterProxyModel::headerData ( section, orientation, role ); @@ -2206,50 +2267,50 @@ QStandardItem* PatternDataModel::itemFromIndex ( const QModelIndex & index ) con return item; } -PatternBuilderModel::PatternBuilderModel( QObject * parent ) : - QSortFilterProxyModel( parent ) -{ - QString builderRegExp =QString("(%1|%2|%3|%4|%5|%6)"). - arg(VECTOR_TREE).arg(ELEMENTS_TREE). - arg(CROSSELEMENTS_TREE).arg(VECTOR_DIR_TREE).arg(ELEMENTS_DIR_TREE).arg(CROSSELEMENTS_DIR_TREE); - - setFilterRole( HEXA_TREE_ROLE ); - setFilterRegExp ( QRegExp( builderRegExp ) ); -} - -PatternBuilderModel::~PatternBuilderModel() -{ -} +//PatternBuilderModel::PatternBuilderModel( QObject * parent ) : +// QSortFilterProxyModel( parent ) +//{ +// QString builderRegExp =QString("(%1|%2|%3|%4|%5|%6)"). +// arg(VECTOR_TREE).arg(ELEMENTS_TREE). +// arg(CROSSELEMENTS_TREE).arg(VECTOR_DIR_TREE).arg(ELEMENTS_DIR_TREE).arg(CROSSELEMENTS_DIR_TREE); +// +// setFilterRole( HEXA_TREE_ROLE ); +// setFilterRegExp ( QRegExp( builderRegExp ) ); +//} -Qt::ItemFlags PatternBuilderModel::flags(const QModelIndex &index) const -{ - Qt::ItemFlags flags; +//PatternBuilderModel::~PatternBuilderModel() +//{ +//} - DocumentModel *m = dynamic_cast( sourceModel() ); - if ( m != NULL ){ - flags = m->flags( mapToSource(index) ); - } - return flags; -} +//Qt::ItemFlags PatternBuilderModel::flags(const QModelIndex &index) const +//{ +// Qt::ItemFlags flags; +// +// DocumentModel *m = dynamic_cast( sourceModel() ); +// if ( m != NULL ){ +// flags = m->flags( mapToSource(index) ); +// } +// return flags; +//} -QVariant PatternBuilderModel::headerData ( int section, Qt::Orientation orientation, int role ) const -{ - if ( section == 0 && orientation == Qt::Horizontal && role == Qt::DisplayRole ){ - return QVariant( "Builder" ); - } else { - return QSortFilterProxyModel::headerData ( section, orientation, role ); - } -} +//QVariant PatternBuilderModel::headerData ( int section, Qt::Orientation orientation, int role ) const +//{ +// if ( section == 0 and orientation == Qt::Horizontal and role == Qt::DisplayRole ){ +// return QVariant( "Builder" ); +// } else { +// return QSortFilterProxyModel::headerData ( section, orientation, role ); +// } +//} -QStandardItem* PatternBuilderModel::itemFromIndex ( const QModelIndex & index ) const -{ - QStandardItem *item = NULL; - DocumentModel *m = dynamic_cast( sourceModel() ); - if ( m != NULL ){ - item = m->itemFromIndex( mapToSource(index) ); - } - return item; -} +//QStandardItem* PatternBuilderModel::itemFromIndex ( const QModelIndex & index ) const +//{ +// QStandardItem *item = NULL; +// DocumentModel *m = dynamic_cast( sourceModel() ); +// if ( m != NULL ){ +// item = m->itemFromIndex( mapToSource(index) ); +// } +// return item; +//} //==================================================================== // PatternGeomModel @@ -2284,7 +2345,7 @@ Qt::ItemFlags PatternGeomModel::flags(const QModelIndex &index) const QVariant PatternGeomModel::headerData ( int section, Qt::Orientation orientation, int role ) const { - if ( section == 0 && orientation == Qt::Horizontal && role == Qt::DisplayRole ){ + if ( section == 0 and orientation == Qt::Horizontal and role == Qt::DisplayRole ){ return QVariant( "Geometry" ); } else { return QSortFilterProxyModel::headerData ( section, orientation, role ); @@ -2329,7 +2390,7 @@ Qt::ItemFlags AssociationsModel::flags(const QModelIndex &index) const QVariant AssociationsModel::headerData ( int section, Qt::Orientation orientation, int role ) const { - if ( section == 0 && orientation == Qt::Horizontal && role == Qt::DisplayRole ){ + if ( section == 0 and orientation == Qt::Horizontal and role == Qt::DisplayRole ){ return QVariant( "Associations" ); } else { return QSortFilterProxyModel::headerData ( section, orientation, role ); @@ -2372,7 +2433,7 @@ Qt::ItemFlags GroupsModel::flags(const QModelIndex &index) const QVariant GroupsModel::headerData ( int section, Qt::Orientation orientation, int role ) const { - if ( section == 0 && orientation == Qt::Horizontal && role == Qt::DisplayRole ){ + if ( section == 0 and orientation == Qt::Horizontal and role == Qt::DisplayRole ){ return QVariant( "Groups" ); } else { return QSortFilterProxyModel::headerData ( section, orientation, role ); @@ -2425,7 +2486,7 @@ Qt::ItemFlags MeshModel::flags(const QModelIndex &index) const QVariant MeshModel::headerData ( int section, Qt::Orientation orientation, int role ) const { - if ( section == 0 && orientation == Qt::Horizontal && role == Qt::DisplayRole ){ + if ( section == 0 and orientation == Qt::Horizontal and role == Qt::DisplayRole ){ return QVariant( "Mesh" ); } else { return QSortFilterProxyModel::headerData ( section, orientation, role ); diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.hxx index 317f201..4c37cc9 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.hxx @@ -21,8 +21,6 @@ #define _HEXABLOCKGUI_DOCUMENTMODEL_HXX_ -#include "HEXABLOCKGUI_Export.hxx" - #include #include #include @@ -37,7 +35,7 @@ namespace HEXABLOCK { namespace GUI { - class HEXABLOCK_EXPORT DocumentModel : public QStandardItemModel + class HexaExport DocumentModel : public QStandardItemModel { Q_OBJECT public: @@ -77,14 +75,14 @@ namespace HEXABLOCK 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(); @@ -498,7 +496,7 @@ namespace HEXABLOCK }; - class HEXABLOCK_EXPORT PatternDataModel : public QSortFilterProxyModel + class PatternDataModel : public QSortFilterProxyModel { public: PatternDataModel( QObject * parent = 0 ); @@ -514,16 +512,16 @@ namespace HEXABLOCK }; - 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 { diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.cxx index 42106e0..126faf9 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.cxx @@ -176,37 +176,23 @@ QModelIndexList HexaBaseDialog::getIndexList(QListWidget* itemsList, bool mapToS return iItems; } -// ============================================================= lockSizeToSizeHint -void HexaBaseDialog::lockSizeToSizeHint() -{ - setMaximumHeight(sizeHint().height()); - // setMaximumWidth(sizeHint().width()); - // setMinimumHeight(sizeHint().height()); - // setMinimumWidth(sizeHint().width()); -} - -// ============================================================= unlockSizeModification -void HexaBaseDialog::unlockSizeModification() -{ - setMaximumHeight(MAX_HEIGHT); - // setMaximumWidth(MAX_WIDTH); - // setMinimumHeight(MIN_HEIGHT); - // setMinimumWidth(MIN_WIDTH); -} - // ============================================================= resetSizeAndShow void HexaBaseDialog::resetSizeAndShow(QDockWidget* parent) { + if (parent == NULL) + return; + //force the dialog to fit its contain - lockSizeToSizeHint(); +// setMinimumWidth(sizeHint().width()); //set the dialog in the dockwidget + if (parent->widget()) + parent->widget()->close(); parent->setWidget(this); parent->setWindowTitle(windowTitle()); - parent->setVisible(true); - show(); + parent->show(); - unlockSizeModification(); +// setMinimumWidth(MIN_WIDTH); } QString HexaBaseDialog::getErrorMsg() @@ -252,8 +238,8 @@ void HexaBaseDialog::connectDocumentGraphicView(VtkDocumentGraphicView* docGView //Connect the graphic view and its model to the dialog box connect( docGView->getPatternDataSelectionModel(), SIGNAL( selectionChanged ( const QItemSelection &, const QItemSelection &) ), this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ), Qt::UniqueConnection ); - connect( docGView->getPatternBuilderSelectionModel(), SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection &) ), - this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ), Qt::UniqueConnection ); +// connect( docGView->getPatternBuilderSelectionModel(), SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection &) ), +// this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ), Qt::UniqueConnection ); connect( docGView->getPatternGeomSelectionModel(), SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection &) ), this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ), Qt::UniqueConnection ); connect( docGView->getGroupsSelectionModel(), SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection &) ), @@ -273,8 +259,8 @@ void HexaBaseDialog::disconnectDocumentGraphicView(VtkDocumentGraphicView* docGV disconnect(docGView->getPatternDataSelectionModel(), SIGNAL( selectionChanged ( const QItemSelection &, const QItemSelection &) ), this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); - disconnect(docGView->getPatternBuilderSelectionModel(), SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection &) ), - this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); +// disconnect(docGView->getPatternBuilderSelectionModel(), SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection &) ), +// this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); disconnect(docGView->getPatternGeomSelectionModel(), SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection &) ), this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); @@ -380,7 +366,7 @@ void HexaBaseDialog::close() { //reset the data selection pattern (forget all selections of the current context) getPatternDataSelectionModel()->reset(); - getPatternBuilderSelectionModel()->reset(); +// getPatternBuilderSelectionModel()->reset(); getPatternGeomSelectionModel()->reset(); //Clear vtk selection @@ -392,6 +378,8 @@ void HexaBaseDialog::close() //Close the dialog box if (parentWidget()) parentWidget()->close(); + + getPatternDataSelectionModel()->setInfoMode(true); } // ============================================================== onHelpRequested @@ -533,12 +521,12 @@ QItemSelectionModel* HexaBaseDialog::_getSelector( QObject* obj ) case VERTEX_TREE: case EDGE_TREE: case QUAD_TREE: - case HEXA_TREE: selector = getPatternDataSelectionModel(); break; - case VECTOR_TREE: + case HEXA_TREE: + case VECTOR_TREE: selector = getPatternDataSelectionModel(); break; // case CYLINDER_TREE: // case PIPE_TREE: - case ELEMENTS_TREE: - case CROSSELEMENTS_TREE: selector = getPatternBuilderSelectionModel(); break; +// case ELEMENTS_TREE: +// case CROSSELEMENTS_TREE: selector = getPatternBuilderSelectionModel(); break; case GEOMPOINT_TREE: case GEOMEDGE_TREE: case GEOMFACE_TREE: selector = getPatternGeomSelectionModel(); break; @@ -1209,8 +1197,8 @@ bool EdgeDialog::apply(QModelIndex& result) if ( !getDocumentModel() ) return false; const PatternDataModel* patternDataModel = getPatternDataModel(); - const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); - if ( !patternDataModel || !patternBuilderModel ) return false; +// const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternDataModel /*|| !patternBuilderModel*/ ) return false; QModelIndex iEdge; @@ -1222,7 +1210,8 @@ bool EdgeDialog::apply(QModelIndex& result) } } else if ( rb1->isChecked() ){ QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb1] ); - QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb1] ); + QModelIndex ivec = patternDataModel->mapToSource( _index[vec_le_rb1] ); +// QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb1] ); if ( ivex.isValid() && ivec.isValid() ){ iEdge = getDocumentModel()->addEdgeVector( ivex, ivec ); } @@ -1499,6 +1488,8 @@ HexaDialog::HexaDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ): if ( editmode == INFO_MODE ){ setWindowTitle( tr("Hexahedron Information") ); + quads_lw->viewport()->setAttribute( Qt::WA_TransparentForMouseEvents ); + vertices_lw->viewport()->setAttribute( Qt::WA_TransparentForMouseEvents ); } } @@ -1521,7 +1512,6 @@ void HexaDialog::_initInputWidget( Mode editmode ) vertices_lw->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); vertices_lw->installEventFilter(this); - if ( editmode != INFO_MODE ) { // delete item from listwidget QShortcut* delQuadShortcut = new QShortcut( QKeySequence(Qt::Key_X), quads_lw ); @@ -1728,9 +1718,9 @@ bool HexaDialog::apply(QModelIndex& result) } nbItems = iElts.count(); - if ( quads_rb->isChecked() && (nbItems>=2 && nbItems<=6) ){ // build from quads iElts.count() should be between [2,6] + if ( quads_rb->isChecked() and (nbItems>=2 and nbItems<=6) ){ // build from quads iElts.count() should be between [2,6] iHexa = getDocumentModel()->addHexaQuads( iElts ); - } else if ( vertices_rb->isChecked() && nbItems== 8 ){ // build from vertices + } else if ( vertices_rb->isChecked() and nbItems== 8 ){ // build from vertices iHexa = getDocumentModel()->addHexaVertices( iElts[0], iElts[1], iElts[2], iElts[3], iElts[4], iElts[5], iElts[6], iElts[7] ); } @@ -1851,8 +1841,8 @@ bool VectorDialog::apply(QModelIndex& result) if ( !getDocumentModel() ) return false; const PatternDataModel* patternDataModel = getPatternDataModel(); - const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); - if ( !patternDataModel || !patternBuilderModel) return false; +// const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternDataModel /*|| !patternBuilderModel*/) return false; QModelIndex iVector; @@ -1888,7 +1878,8 @@ bool VectorDialog::apply(QModelIndex& result) updateDefaultName(name_le, _value->getType()); // to select/highlight result - result = patternBuilderModel->mapFromSource(iVector); + result = patternDataModel->mapFromSource(iVector); +// result = patternBuilderModel->mapFromSource(iVector); return true; } @@ -2061,7 +2052,7 @@ bool MakeGridDialog::apply(QModelIndex& result) DocumentModel* docModel = getDocumentModel(); PatternDataModel* patternDataModel = getPatternDataModel(); - PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); +// PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); QModelIndex iNewElts; if ( rb0->isChecked() ) @@ -2074,9 +2065,12 @@ bool MakeGridDialog::apply(QModelIndex& result) else if ( rb1->isChecked() ) { QModelIndex icenter = patternDataModel->mapToSource( _index[center_le] ); - QModelIndex iaxis = patternBuilderModel->mapToSource( _index[axis_le] ); - QModelIndex ibase = patternBuilderModel->mapToSource( _index[base_le] ); - QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le] ); + QModelIndex iaxis = patternDataModel->mapToSource( _index[axis_le] ); + QModelIndex ibase = patternDataModel->mapToSource( _index[base_le] ); + QModelIndex ivec = patternDataModel->mapToSource( _index[vec_le] ); +// QModelIndex iaxis = patternBuilderModel->mapToSource( _index[axis_le] ); +// QModelIndex ibase = patternBuilderModel->mapToSource( _index[base_le] ); +// QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le] ); if ( icenter.isValid() && iaxis.isValid() && ibase.isValid() && ivec.isValid() ) { @@ -2094,9 +2088,12 @@ bool MakeGridDialog::apply(QModelIndex& result) } else if ( rb2->isChecked() ) { QModelIndex icenter = patternDataModel->mapToSource( _index[center_le] ); - QModelIndex iaxis = patternBuilderModel->mapToSource( _index[axis_le] ); - QModelIndex ibase = patternBuilderModel->mapToSource( _index[base_le] ); - QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le] ); + QModelIndex iaxis = patternDataModel->mapToSource( _index[axis_le] ); + QModelIndex ibase = patternDataModel->mapToSource( _index[base_le] ); + QModelIndex ivec = patternDataModel->mapToSource( _index[vec_le] ); +// QModelIndex iaxis = patternBuilderModel->mapToSource( _index[axis_le] ); +// QModelIndex ibase = patternBuilderModel->mapToSource( _index[base_le] ); +// QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le] ); if ( icenter.isValid() && iaxis.isValid() && ibase.isValid() && ivec.isValid() ) { @@ -2146,7 +2143,8 @@ bool MakeGridDialog::apply(QModelIndex& result) return false; } - result = patternBuilderModel->mapFromSource( iNewElts ); + result = patternDataModel->mapFromSource(iNewElts); +// result = patternBuilderModel->mapFromSource( iNewElts ); return true; } @@ -2303,11 +2301,13 @@ bool MakeCylinderDialog::apply(QModelIndex& result) DocumentModel* docModel = getDocumentModel(); PatternDataModel* patternDataModel = getPatternDataModel(); - PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); +// PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); QModelIndex iorigin = patternDataModel->mapToSource( _index[origin_le] ); - QModelIndex iaxis = patternBuilderModel->mapToSource( _index[axis_le] ); - QModelIndex ibase = patternBuilderModel->mapToSource( _index[base_le] ); + QModelIndex iaxis = patternDataModel->mapToSource( _index[axis_le] ); + QModelIndex ibase = patternDataModel->mapToSource( _index[base_le] ); +// QModelIndex iaxis = patternBuilderModel->mapToSource( _index[axis_le] ); +// QModelIndex ibase = patternBuilderModel->mapToSource( _index[base_le] ); double rext = ext_radius_spb->value(); double rint = int_radius_spb->value(); double angle = angle_spb->value(); @@ -2371,7 +2371,8 @@ bool MakeCylinderDialog::apply(QModelIndex& result) return false; } - result = patternBuilderModel->mapFromSource(iElts); + result = patternDataModel->mapFromSource(iElts); +// result = patternBuilderModel->mapFromSource(iElts); return true; } @@ -2530,11 +2531,13 @@ bool MakePipeDialog::apply(QModelIndex& result) DocumentModel* docModel = getDocumentModel(); PatternDataModel* patternDataModel = getPatternDataModel(); - PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); +// PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); QModelIndex iorigin = patternDataModel->mapToSource( _index[origin_le] ); - QModelIndex iaxis = patternBuilderModel->mapToSource( _index[axis_le] ); - QModelIndex ibase = patternBuilderModel->mapToSource( _index[base_le] ); + QModelIndex iaxis = patternDataModel->mapToSource( _index[axis_le] ); + QModelIndex ibase = patternDataModel->mapToSource( _index[base_le] ); +// QModelIndex iaxis = patternBuilderModel->mapToSource( _index[axis_le] ); +// QModelIndex ibase = patternBuilderModel->mapToSource( _index[base_le] ); double rext = ext_radius_spb->value(); double rint = int_radius_spb->value(); double angle = angle_spb->value(); @@ -2598,7 +2601,8 @@ bool MakePipeDialog::apply(QModelIndex& result) } // to select/highlight result - result = patternBuilderModel->mapFromSource(iElts); + result = patternDataModel->mapFromSource(iElts); +// result = patternBuilderModel->mapFromSource(iElts); return true; } @@ -2664,13 +2668,15 @@ bool MakeCylindersDialog::apply(QModelIndex& result) DocumentModel* docModel = getDocumentModel(); PatternDataModel* patternDataModel = getPatternDataModel(); - PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); +// PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); QModelIndex iElts; QModelIndex icenter = patternDataModel->mapToSource( _index[center_le] ); QModelIndex icenter2 = patternDataModel->mapToSource( _index[center2_le] ); - QModelIndex idir = patternBuilderModel->mapToSource( _index[direction_le] ); - QModelIndex idir2 = patternBuilderModel->mapToSource( _index[direction2_le] ); + QModelIndex idir = patternDataModel->mapToSource( _index[direction_le] ); + QModelIndex idir2 = patternDataModel->mapToSource( _index[direction2_le] ); +// QModelIndex idir = patternBuilderModel->mapToSource( _index[direction_le] ); +// QModelIndex idir2 = patternBuilderModel->mapToSource( _index[direction2_le] ); if ( icenter.isValid() && icenter2.isValid() && idir.isValid() && idir2.isValid()){ double r1 = radius_spb->value(); @@ -2685,7 +2691,8 @@ bool MakeCylindersDialog::apply(QModelIndex& result) return false; } - result = patternBuilderModel->mapFromSource(iElts); + result = patternDataModel->mapFromSource(iElts); +// result = patternBuilderModel->mapFromSource(iElts); return true; } @@ -2752,12 +2759,14 @@ bool MakePipesDialog::apply(QModelIndex& result) DocumentModel* docModel = getDocumentModel(); PatternDataModel* patternDataModel = getPatternDataModel(); - PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); +// PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); QModelIndex iorigin1 = patternDataModel->mapToSource( _index[origin_le] ); QModelIndex iorigin2 = patternDataModel->mapToSource( _index[origin2_le] ); - QModelIndex idir1 = patternBuilderModel->mapToSource( _index[dir_le] ); - QModelIndex idir2 = patternBuilderModel->mapToSource( _index[dir2_le] ); + QModelIndex idir1 = patternDataModel->mapToSource( _index[dir_le] ); + QModelIndex idir2 = patternDataModel->mapToSource( _index[dir2_le] ); +// QModelIndex idir1 = patternBuilderModel->mapToSource( _index[dir_le] ); +// QModelIndex idir2 = patternBuilderModel->mapToSource( _index[dir2_le] ); double rint1 = int_radius_spb->value(); double rext1 = ext_radius_spb->value(); double height1 = height_spb->value(); @@ -2776,7 +2785,8 @@ bool MakePipesDialog::apply(QModelIndex& result) return false; } - result = patternBuilderModel->mapFromSource(iElts); + result = patternDataModel->mapFromSource(iElts); +// result = patternBuilderModel->mapFromSource(iElts); return true; } @@ -2980,10 +2990,12 @@ bool PrismQuadDialog::apply(QModelIndex& result) _currentObj = NULL; DocumentModel* docModel = getDocumentModel(); - PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + PatternDataModel* patternDataModel = getPatternDataModel(); +// PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); QModelIndexList iquads = getIndexList(quads_lw); - QModelIndex iaxis = patternBuilderModel->mapToSource( _index[axis_le] ); + QModelIndex iaxis = patternDataModel->mapToSource( _index[axis_le] ); +// QModelIndex iaxis = patternBuilderModel->mapToSource( _index[axis_le] ); double length = length_spb->value(); int nb = nb_spb->value(); @@ -3023,7 +3035,8 @@ bool PrismQuadDialog::apply(QModelIndex& result) return false; } - result = patternBuilderModel->mapFromSource(iElts); + result = patternDataModel->mapFromSource(iElts); +// result = patternBuilderModel->mapFromSource(iElts); return true; } @@ -3185,7 +3198,7 @@ bool JoinQuadDialog::apply(QModelIndex& result) DocumentModel* docModel = getDocumentModel(); PatternDataModel* patternDataModel = getPatternDataModel(); - PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); +// PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); QModelIndexList iquads; QModelIndex iquad; @@ -3233,7 +3246,8 @@ bool JoinQuadDialog::apply(QModelIndex& result) SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT JOIN QUAD(S)" ) + "\n" + getErrorMsg() ); return false; } - result = patternBuilderModel->mapFromSource(iElts); + result = patternDataModel->mapFromSource(iElts); +// result = patternBuilderModel->mapFromSource(iElts); return true; } @@ -3643,8 +3657,8 @@ bool DisconnectDialog::apply(QModelIndex& result) _currentObj = NULL; if (getDocumentModel() == NULL) return false; const PatternDataModel* patternDataModel = getPatternDataModel(); - const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); - if ( !patternDataModel || !patternBuilderModel) return false; +// const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternDataModel /*|| !patternBuilderModel*/) return false; QModelIndex iElts; @@ -3704,7 +3718,8 @@ bool DisconnectDialog::apply(QModelIndex& result) return false; } - result = patternBuilderModel->mapFromSource(iElts); + result = patternDataModel->mapFromSource(iElts); +// result = patternBuilderModel->mapFromSource(iElts); return true; } @@ -3795,7 +3810,7 @@ bool CutEdgeDialog::apply(QModelIndex& result) DocumentModel* docModel = getDocumentModel(); PatternDataModel* patternDataModel = getPatternDataModel(); - PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); +// PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); QModelIndex iElts; QModelIndex iedge = patternDataModel->mapToSource( _index[e_le] ); @@ -3824,7 +3839,8 @@ bool CutEdgeDialog::apply(QModelIndex& result) return false; } - result = patternBuilderModel->mapFromSource(iElts); + result = patternDataModel->mapFromSource(iElts); +// result = patternBuilderModel->mapFromSource(iElts); //Update the line edit QVariant invalid; @@ -3951,21 +3967,24 @@ bool MakeTransformationDialog::apply(QModelIndex& result) if (getDocumentModel() == NULL) return false; const PatternDataModel* patternDataModel = getPatternDataModel(); - const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); - if ( !patternDataModel || !patternBuilderModel) return false; +// const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternDataModel /*|| !patternBuilderModel*/) return false; QModelIndex iNewElts; if ( rb0->isChecked() ){ - QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb0] ); - QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb0] ); + QModelIndex ielts = patternDataModel->mapToSource( _index[elts_le_rb0] ); + QModelIndex ivec = patternDataModel->mapToSource( _index[vec_le_rb0] ); +// QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb0] ); +// QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb0] ); if ( ielts.isValid() && ivec.isValid() ) iNewElts = getDocumentModel()->makeTranslation( ielts, ivec ); } else if ( rb1->isChecked() ){ - QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb1] ); +// QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb1] ); + QModelIndex ielts = patternDataModel->mapToSource( _index[elts_le_rb1] ); QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb1] ); double k = k_spb->value(); @@ -3974,9 +3993,11 @@ bool MakeTransformationDialog::apply(QModelIndex& result) iNewElts = getDocumentModel()->makeScale( ielts, ivex, k ); } else if ( rb2->isChecked() ){ - QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb2] ); +// QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb2] ); + QModelIndex ielts = patternDataModel->mapToSource( _index[elts_le_rb2] ); QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb2] ); - QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb2] ); +// QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb2] ); + QModelIndex ivec = patternDataModel->mapToSource( _index[vec_le_rb2] ); double angle = angle_spb->value(); if ( ielts.isValid() @@ -3990,7 +4011,8 @@ bool MakeTransformationDialog::apply(QModelIndex& result) return false; } - result = patternBuilderModel->mapFromSource(iNewElts); + result = patternDataModel->mapFromSource(iNewElts); +// result = patternBuilderModel->mapFromSource(iNewElts); return true; } @@ -4110,13 +4132,14 @@ bool MakeSymmetryDialog::apply(QModelIndex& result) _currentObj = NULL; if (getDocumentModel() == NULL) return false; const PatternDataModel* patternDataModel = getPatternDataModel(); - const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); - if ( !patternDataModel || !patternBuilderModel) return false; +// const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternDataModel /*|| !patternBuilderModel*/) return false; QModelIndex iNewElts; if ( rb0->isChecked() ){ - QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb0] ); +// QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb0] ); + QModelIndex ielts = patternDataModel->mapToSource( _index[elts_le_rb0] ); QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb0] ); if ( ielts.isValid() @@ -4125,9 +4148,11 @@ bool MakeSymmetryDialog::apply(QModelIndex& result) } else if ( rb1->isChecked() ){ - QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb1] ); +// QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb1] ); + QModelIndex ielts = patternDataModel->mapToSource( _index[elts_le_rb1] ); QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb1] ); - QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb1] ); +// QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb1] ); + QModelIndex ivec = patternDataModel->mapToSource( _index[vec_le_rb1] ); if ( ielts.isValid() && ivex.isValid() @@ -4135,9 +4160,11 @@ bool MakeSymmetryDialog::apply(QModelIndex& result) iNewElts = getDocumentModel()->makeSymmetryLine( ielts, ivex, ivec ); } else if ( rb2->isChecked() ){ - QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb2] ); +// QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb2] ); + QModelIndex ielts = patternDataModel->mapToSource(_index[elts_le_rb2]); QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb2] ); - QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb2] ); +// QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb2] ); + QModelIndex ivec = patternDataModel->mapToSource(_index[vec_le_rb2]); if ( ielts.isValid() && ivex.isValid() @@ -4150,7 +4177,8 @@ bool MakeSymmetryDialog::apply(QModelIndex& result) return false; } - result = patternBuilderModel->mapFromSource(iNewElts); +// result = patternBuilderModel->mapFromSource(iNewElts); + result = patternDataModel->mapFromSource(iNewElts); return true; } @@ -4263,21 +4291,24 @@ bool PerformTransformationDialog::apply(QModelIndex& result) if (getDocumentModel() == NULL) return false; const PatternDataModel* patternDataModel = getPatternDataModel(); - const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); - if ( !patternDataModel || !patternBuilderModel) return false; +// const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternDataModel /*|| !patternBuilderModel*/) return false; bool performed = false; if ( rb0->isChecked() ){ - QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb0] ); - QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb0] ); +// QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb0] ); + QModelIndex ielts = patternDataModel->mapToSource(_index[elts_le_rb0]); +// QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb0] ); + QModelIndex ivec = patternDataModel->mapToSource(_index[vec_le_rb0]); if ( ielts.isValid() && ivec.isValid() ) performed = getDocumentModel()->performTranslation( ielts, ivec ); } else if ( rb1->isChecked() ){ - QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb1] ); +// QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb1] ); + QModelIndex ielts = patternDataModel->mapToSource(_index[elts_le_rb1]); QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb1] ); double k = k_spb->value(); @@ -4286,9 +4317,11 @@ bool PerformTransformationDialog::apply(QModelIndex& result) performed = getDocumentModel()->performScale( ielts, ivex, k ); } else if ( rb2->isChecked() ){ - QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb2] ); +// QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb2] ); + QModelIndex ielts = patternDataModel->mapToSource(_index[elts_le_rb2]); QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb2] ); - QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb2] ); +// QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb2] ); + QModelIndex ivec = patternDataModel->mapToSource(_index[vec_le_rb2]); double angle = angle_spb->value(); if ( ielts.isValid() @@ -4419,13 +4452,14 @@ bool PerformSymmetryDialog::apply(QModelIndex& result) if (getDocumentModel() == NULL) return false; const PatternDataModel* patternDataModel = getPatternDataModel(); - const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); - if ( !patternDataModel || !patternBuilderModel) return false; +// const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternDataModel /*|| !patternBuilderModel*/) return false; bool performed = false; if ( rb0->isChecked() ){ - QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb0] ); +// QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb0] ); + QModelIndex ielts = patternDataModel->mapToSource(_index[elts_le_rb0]); QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb0] ); if ( ielts.isValid() @@ -4433,9 +4467,11 @@ bool PerformSymmetryDialog::apply(QModelIndex& result) performed = getDocumentModel()->performSymmetryPoint( ielts, ivex ); } else if ( rb1->isChecked() ){ - QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb1] ); +// QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb1] ); + QModelIndex ielts = patternDataModel->mapToSource(_index[elts_le_rb1]); QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb1] ); - QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb1] ); +// QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb1] ); + QModelIndex ivec = patternDataModel->mapToSource(_index[vec_le_rb1]); if ( ielts.isValid() && ivex.isValid() @@ -4443,9 +4479,11 @@ bool PerformSymmetryDialog::apply(QModelIndex& result) performed = getDocumentModel()->performSymmetryLine( ielts, ivex, ivec ); } else if ( rb2->isChecked() ){ - QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb2] ); +// QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb2] ); + QModelIndex ielts = patternDataModel->mapToSource(_index[elts_le_rb2]); QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb2] ); - QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb2] ); +// QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb2] ); + QModelIndex ivec = patternDataModel->mapToSource(_index[vec_le_rb2]); if ( ielts.isValid() && ivex.isValid() @@ -5055,6 +5093,7 @@ void GroupDialog::_initInputWidget( Mode editmode ) { name_le->setReadOnly(true); kind_cb->setEnabled(false); + eltBase_lw->viewport()->setAttribute( Qt::WA_TransparentForMouseEvents ); } connect(eltBase_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfModel()), Qt::UniqueConnection); @@ -5544,36 +5583,7 @@ HexaBaseDialog(parent, editmode, f) { _helpFileName = "gui_mesh.html"; setWindowTitle( tr("Compute mesh") ); - QVBoxLayout* layout = new QVBoxLayout; - setLayout(layout); - - QHBoxLayout* up = new QHBoxLayout; - QHBoxLayout* down = new QHBoxLayout; - - layout->addLayout(up); - layout->addLayout(down); - - QVBoxLayout* vlg = new QVBoxLayout; - QVBoxLayout* vld = new QVBoxLayout; - - up->addLayout(vlg); - up->addLayout(vld); - - vlg->addWidget(new QLabel("Name")); - vlg->addWidget(new QLabel("Dimension")); - vlg->addWidget(new QLabel("Container")); - - _name = new QLineEdit("Mesh"); - _dim = new QSpinBox(); - _fact = new QLineEdit("FactoryServer"); - - vld->addWidget(_name); - vld->addWidget(_dim); - vld->addWidget(_fact); - - _dim->setRange(1, 3); - _dim->setValue(3); - + setupUi( this ); _initWidget(editmode); } @@ -5762,8 +5772,8 @@ bool ReplaceHexaDialog::apply(QModelIndex& result) if ( !getDocumentModel() ) return false; const PatternDataModel* patternDataModel = getPatternDataModel(); - const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); - if ( !patternDataModel || !patternBuilderModel) return false; +// const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternDataModel /*|| !patternBuilderModel*/) return false; QModelIndex ielts; //result @@ -5799,7 +5809,8 @@ bool ReplaceHexaDialog::apply(QModelIndex& result) return false; } _value = ielts.model()->data(ielts, HEXA_DATA_ROLE).value(); - result = patternBuilderModel->mapFromSource(ielts); +// result = patternBuilderModel->mapFromSource(ielts); + result = patternDataModel->mapFromSource(ielts); //update the list (indexes) for ( int r = 0; r < nbQuads; ++r ){ @@ -5946,7 +5957,7 @@ bool QuadRevolutionDialog::apply(QModelIndex& result) DocumentModel* docModel = getDocumentModel(); PatternDataModel* patternDataModel = getPatternDataModel(); - PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); +// PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); QListWidgetItem* item = NULL; @@ -5961,7 +5972,8 @@ bool QuadRevolutionDialog::apply(QModelIndex& result) } QModelIndex icenter = patternDataModel->mapToSource( _index[center_le] ); - QModelIndex iaxis = patternBuilderModel->mapToSource( _index[axis_le] ); + QModelIndex iaxis = patternDataModel->mapToSource(_index[axis_le]); +// QModelIndex iaxis = patternBuilderModel->mapToSource( _index[axis_le] ); int angle = angle_spb->value(); int nbre = nbre_spb->value(); @@ -5993,7 +6005,8 @@ bool QuadRevolutionDialog::apply(QModelIndex& result) return false; } _value = iElts.model()->data(iElts, HEXA_DATA_ROLE).value(); - result = patternBuilderModel->mapFromSource(iElts); + result = patternDataModel->mapFromSource(iElts); +// result = patternBuilderModel->mapFromSource(iElts); return true; } @@ -6208,13 +6221,15 @@ bool MakeHemiSphereDialog::apply(QModelIndex& result) DocumentModel* docModel = getDocumentModel(); PatternDataModel* patternDataModel = getPatternDataModel(); - PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); +// PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); QModelIndex iElts; QModelIndex icenter = patternDataModel->mapToSource( _index[center_le] ); QModelIndex ivplan = patternDataModel->mapToSource( _index[vplan_le] ); - QModelIndex ivecx = patternBuilderModel->mapToSource( _index[base_le] ); - QModelIndex ivecz = patternBuilderModel->mapToSource( _index[hole_axis_le] ); + QModelIndex ivecx = patternDataModel->mapToSource(_index[base_le]); + QModelIndex ivecz = patternDataModel->mapToSource(_index[hole_axis_le]); +// QModelIndex ivecx = patternBuilderModel->mapToSource( _index[base_le] ); +// QModelIndex ivecz = patternBuilderModel->mapToSource( _index[hole_axis_le] ); double radhole = hole_rad_spb->value(); double radext = sphere_radext_spb->value(); @@ -6334,7 +6349,8 @@ bool MakeHemiSphereDialog::apply(QModelIndex& result) return false; } _value = iElts.model()->data(iElts, HEXA_DATA_ROLE).value(); - result = patternBuilderModel->mapFromSource(iElts); + result = patternDataModel->mapFromSource(iElts); +// result = patternBuilderModel->mapFromSource(iElts); return true; } @@ -6479,308 +6495,3 @@ bool AddShapeDialog::apply(QModelIndex& result) return true; } - - - - - - -//***************************** OBSOLETE: A SUPPRIMER !!!! ************************************// - -// ============================================================== Constructeur -CylinderDialog::CylinderDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ) -: HexaBaseDialog(parent, editmode, f), - _value(0) -{ - _helpFileName = "gui_cyl.html"; - setupUi( this ); - _initWidget(editmode); - - if ( editmode == INFO_MODE ){ - setWindowTitle( tr("Cylinder Information") ); - } -} - -// ============================================================== Destructeur -CylinderDialog::~CylinderDialog() -{ -} - -// ============================================================== _initInputWidget -void CylinderDialog::_initInputWidget( Mode editmode ) -{ - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); - - installEventFilter(this); - name_le->installEventFilter(this); - - vex_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - vec_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - - vex_le->setValidator( validator ); - vec_le->setValidator( validator ); - - vex_le->installEventFilter(this); - vec_le->installEventFilter(this); - - vex_le->setReadOnly(true); - vec_le->setReadOnly(true); - - if (editmode == INFO_MODE) - { - name_le->setReadOnly(true); - r_spb->setReadOnly(true); - h_spb->setReadOnly(true); - } - -} - -// ============================================================== clear -void CylinderDialog::clear() -{ - name_le->clear(); - - vex_le->clear(); - modelUnregister(vex_le); - - vec_le->clear(); - modelUnregister(vec_le); - - r_spb->clear(); - h_spb->clear(); - - modelUnregister(this); - -} - -// ============================================================== setValue -void CylinderDialog::setValue(HEXA_NS::Cylinder* c) -{ - HEXA_NS::Vertex* base = c->getBase(); - HEXA_NS::Vector* direction = c->getDirection(); - double r = c->getRadius(); - double h = c->getHeight(); - - name_le->setText( c->getName() ); - vex_le->setText( base->getName() ); - vec_le->setText( direction->getName() ); - r_spb->setValue(r); - h_spb->setValue(h); - - if ( getPatternDataSelectionModel() ){ - QModelIndex iCyl = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(c) ); - QModelIndex iBase = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(base) ); - QModelIndex iDirection = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(direction) ); - - name_le->setProperty( "QModelIndex", QVariant::fromValue(iCyl) ); - vex_le->setProperty( "QModelIndex", QVariant::fromValue(iBase) ); - vec_le->setProperty( "QModelIndex", QVariant::fromValue(iDirection) ); - } - _value = c; -} - -// ============================================================== getValue -HEXA_NS::Cylinder* CylinderDialog::getValue() -{ - return _value; -} - -// ============================================================== apply -bool CylinderDialog::apply(QModelIndex& result) -{ -// if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); -// _currentObj = NULL; -// -// if ( !getDocumentModel() ) return false; -// const PatternDataModel* patternDataModel = getPatternDataModel(); -// const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); -// if ( !patternDataModel || !patternBuilderModel) return false; -// -// QModelIndex iCyl; -// QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le] ); -// QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le] ); -// double r = r_spb->value(); -// double h = h_spb->value(); -// -// if ( ivex.isValid() -// && ivec.isValid() ){ -// iCyl = getDocumentModel()->addCylinder( ivex, ivec, r, h ); -// } -// -// if ( !iCyl.isValid() ){ -// SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT ADD CYLINDER" ) ); -// return false; -// } -// -// _value = iCyl.model()->data(iCyl, HEXA_DATA_ROLE).value(); -// -// QString newName = name_le->text(); -// if (!newName.isEmpty()) /*{*/ -// getDocumentModel()->setName( iCyl, newName ); -// -// //update the default name in the dialog box -// if (_value != NULL) -// updateDefaultName(name_le, _value->getType()); -// -// // to select/highlight result -// result = patternBuilderModel->mapFromSource(iCyl); - - return true; -} - -//------------------------------- PipeDialog ----------------------------------- - -// ============================================================== Constructeur - -PipeDialog::PipeDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ) -: HexaBaseDialog(parent, editmode, f), - _value(0) -{ - _helpFileName = "gui_pipe.html"; - setupUi( this ); - _initWidget(editmode); - // setFocusProxy( vex_le ); - - if ( editmode == INFO_MODE ){ - setWindowTitle( tr("Pipe Information") ); - } - -} - -// ============================================================== Destructeur -PipeDialog::~PipeDialog() -{ -} - -// ============================================================== _initInputWidget -void PipeDialog::_initInputWidget( Mode editmode ) -{ - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); - - installEventFilter(this); - name_le->installEventFilter(this); - - //Vertex Field config - vex_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - vex_le->installEventFilter(this); - vex_le->setValidator( validator ); - - //Vector Field config - vec_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - vec_le->installEventFilter(this); - vec_le->setValidator( validator ); - - - if ( editmode == INFO_MODE ){ - name_le->setReadOnly(true); - ir_spb->setReadOnly(true); - er_spb->setReadOnly(true); - h_spb->setReadOnly(true); - } - - vex_le->setReadOnly(true); - vec_le->setReadOnly(true); - - //connect( name_le, SIGNAL(returnPressed()), this, SLOT(updateName())); -} - -// ============================================================== clear -void PipeDialog::clear() -{ - name_le->clear(); - - vex_le->clear(); - modelUnregister(vex_le); - - vec_le->clear(); - modelUnregister(vec_le); - - modelUnregister(this); -} - -// ============================================================== setValue -void PipeDialog::setValue(HEXA_NS::Pipe* p) -{ - HEXA_NS::Vertex* base = p->getBase(); - HEXA_NS::Vector* direction = p->getDirection(); - double ir = p->getInternalRadius(); - double er = p->getRadius(); - double h = p->getHeight(); - - name_le->setText( p->getName() ); - vex_le->setText( base->getName() ); - vec_le->setText( direction->getName() ); - ir_spb->setValue(ir); - er_spb->setValue(er); - h_spb->setValue(h); - - if ( getPatternDataSelectionModel() ){ - QModelIndex iPipe = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(p) ); - QModelIndex iBase = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(base) ); - QModelIndex iDirection = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(direction) ); - - name_le->setProperty( "QModelIndex", QVariant::fromValue(iPipe) ); - vex_le->setProperty( "QModelIndex", QVariant::fromValue(iBase) ); - vec_le->setProperty( "QModelIndex", QVariant::fromValue(iDirection) ); - } - _value = p; -} - -// ============================================================== getValue -HEXA_NS::Pipe* PipeDialog::getValue() -{ - return _value; -} - -// ============================================================== apply -bool PipeDialog::apply(QModelIndex& result) -{ -// if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); -// _currentObj = NULL; -// -// if ( !getDocumentModel() ) return false; -// const PatternDataModel* patternDataModel = getPatternDataModel(); -// const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); -// if ( !patternDataModel || !patternBuilderModel) return false; -// -// QModelIndex iPipe; -// QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le] ); -// QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le] ); -// double ir = ir_spb->value(); -// double er = er_spb->value(); -// double h = h_spb->value(); -// -// if (ir >= er) { -// SUIT_MessageBox::information( this, tr( "CANNOT ADD PIPE" ), tr( "External radius must be greather than Internal radius!" ) ); -// return false; -// } -// -// -// if ( ivex.isValid() -// && ivec.isValid() ){ -// iPipe = getDocumentModel()->addPipe( ivex, ivec, ir, er, h ); -// } -// -// if ( !iPipe.isValid() ){ -// SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT ADD PIPE" ) ); -// return false; -// } -// _value = iPipe.model()->data(iPipe, HEXA_DATA_ROLE).value(); -// -// QString newName = name_le->text(); -// if ( !newName.isEmpty() )/*{*/ -// getDocumentModel()->setName( iPipe, newName ); -// -// //update the default name in the dialog box -// if (_value != NULL) -// updateDefaultName(name_le, _value->getType()); -// -// // to select/highlight result -// result = patternBuilderModel->mapFromSource(iPipe); - - return true; -} -// ************************************** FIN A SUPPRIMER ******************************************// - diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.hxx index cc5ca6c..f9ba91b 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.hxx @@ -19,11 +19,9 @@ #ifndef __HEXABLOCKGUI_DOCUMENTPANEL_HXX_ #define __HEXABLOCKGUI_DOCUMENTPANEL_HXX_ -#include "HEXABLOCKGUI_Export.hxx" - #define MAX_WIDTH 16777215 #define MAX_HEIGHT 16777215 -#define MIN_WIDTH 0 +#define MIN_WIDTH 5 #define MIN_HEIGHT 0 #include @@ -64,6 +62,7 @@ #include "ui_MakeHemiSphere_QTD.h" #include "ui_ModelInfo_QTD.h" #include "ui_AddShapeDialog_QTD.h" +#include "ui_ComputeMesh_QTD.h" #include "HexVertex.hxx" #include "HexEdge.hxx" @@ -84,7 +83,7 @@ namespace HEXABLOCK { namespace GUI { - class HEXABLOCK_EXPORT HexaBaseDialog : public QDialog + class HexaExport HexaBaseDialog : public QDialog { Q_OBJECT @@ -133,9 +132,9 @@ namespace HEXABLOCK return HEXABLOCKGUI::currentDocGView->getPatternGeomModel(); } - PatternBuilderModel* getPatternBuilderModel() const { - return HEXABLOCKGUI::currentDocGView->getPatternBuilderModel(); - } +// PatternBuilderModel* getPatternBuilderModel() const { +// return HEXABLOCKGUI::currentDocGView->getPatternBuilderModel(); +// } GroupsModel* getGroupsModel() const { return HEXABLOCKGUI::currentDocGView->getGroupsModel(); @@ -150,9 +149,9 @@ namespace HEXABLOCK return HEXABLOCKGUI::currentDocGView->getPatternDataSelectionModel(); } - PatternBuilderSelectionModel* getPatternBuilderSelectionModel() const { - return HEXABLOCKGUI::currentDocGView->getPatternBuilderSelectionModel(); - } +// PatternBuilderSelectionModel* getPatternBuilderSelectionModel() const { +// return HEXABLOCKGUI::currentDocGView->getPatternBuilderSelectionModel(); +// } PatternGeomSelectionModel* getPatternGeomSelectionModel() const { return HEXABLOCKGUI::currentDocGView->getPatternGeomSelectionModel(); @@ -171,8 +170,6 @@ namespace HEXABLOCK HEXABLOCKGUI::ViewType getObjectViewType(QObject* obj); void modelUnregister(QWidget* widget); //unlink the widget from the model void resetSizeAndShow(QDockWidget* parent); - void lockSizeToSizeHint(); - void unlockSizeModification(); virtual QModelIndexList getAssocsVTK() { QModelIndexList assocs; @@ -254,7 +251,7 @@ namespace HEXABLOCK - class HEXABLOCK_EXPORT VertexDialog : public HexaBaseDialog, + class HexaExport VertexDialog : public HexaBaseDialog, public Ui::VertexDialog { Q_OBJECT @@ -282,7 +279,7 @@ namespace HEXABLOCK }; - class HEXABLOCK_EXPORT EdgeDialog : public HexaBaseDialog, + class HexaExport EdgeDialog : public HexaBaseDialog, public Ui::EdgeDialog { Q_OBJECT @@ -308,7 +305,7 @@ namespace HEXABLOCK }; - class HEXABLOCK_EXPORT QuadDialog : public HexaBaseDialog, + class HexaExport QuadDialog : public HexaBaseDialog, public Ui::QuadDialog { Q_OBJECT @@ -335,7 +332,7 @@ namespace HEXABLOCK - class HEXABLOCK_EXPORT HexaDialog : public HexaBaseDialog, + class HexaExport HexaDialog : public HexaBaseDialog, public Ui::HexaDialog { Q_OBJECT @@ -370,7 +367,7 @@ namespace HEXABLOCK }; - class HEXABLOCK_EXPORT VectorDialog : public HexaBaseDialog, + class HexaExport VectorDialog : public HexaBaseDialog, public Ui::VectorDialog { Q_OBJECT @@ -395,7 +392,7 @@ namespace HEXABLOCK QModelIndex _ivalue; }; - class HEXABLOCK_EXPORT MakeGridDialog : public HexaBaseDialog, + class HexaExport MakeGridDialog : public HexaBaseDialog, public Ui::MakeGridDialog { Q_OBJECT @@ -424,7 +421,7 @@ namespace HEXABLOCK }; - class HEXABLOCK_EXPORT MakeCylinderDialog : public HexaBaseDialog, + class HexaExport MakeCylinderDialog : public HexaBaseDialog, public Ui::MakeCylinderDialog { Q_OBJECT @@ -452,7 +449,7 @@ namespace HEXABLOCK }; - class HEXABLOCK_EXPORT MakePipeDialog : public HexaBaseDialog, + class HexaExport MakePipeDialog : public HexaBaseDialog, public Ui::MakePipeDialog { Q_OBJECT @@ -480,7 +477,7 @@ namespace HEXABLOCK }; - class HEXABLOCK_EXPORT MakeCylindersDialog : public HexaBaseDialog, + class HexaExport MakeCylindersDialog : public HexaBaseDialog, public Ui::MakeCylindersDialog { Q_OBJECT @@ -499,7 +496,7 @@ namespace HEXABLOCK }; - class HEXABLOCK_EXPORT MakePipesDialog : public HexaBaseDialog, + class HexaExport MakePipesDialog : public HexaBaseDialog, public Ui::MakePipesDialog { Q_OBJECT @@ -519,7 +516,7 @@ namespace HEXABLOCK - class HEXABLOCK_EXPORT RemoveHexaDialog : public HexaBaseDialog, + class HexaExport RemoveHexaDialog : public HexaBaseDialog, public Ui::RemoveHexaDialog { Q_OBJECT @@ -538,7 +535,7 @@ namespace HEXABLOCK }; - class HEXABLOCK_EXPORT PrismQuadDialog : public HexaBaseDialog, + class HexaExport PrismQuadDialog : public HexaBaseDialog, public Ui::PrismQuadDialog { Q_OBJECT @@ -561,13 +558,13 @@ namespace HEXABLOCK void updateHelpFileName(); private slots: - //void addQuad(); + void addQuad(); void removeQuad(); - //void clearQuads(); + void clearQuads(); }; - class HEXABLOCK_EXPORT JoinQuadDialog : public HexaBaseDialog, + class HexaExport JoinQuadDialog : public HexaBaseDialog, public Ui::JoinQuadDialog { Q_OBJECT @@ -591,14 +588,14 @@ namespace HEXABLOCK void updateHelpFileName(); private slots: - //void addQuad(); + void addQuad(); void removeQuad(); - //void clearQuads(); + void clearQuads(); }; - class HEXABLOCK_EXPORT MergeDialog : public HexaBaseDialog, + class HexaExport MergeDialog : public HexaBaseDialog, public Ui::MergeDialog { Q_OBJECT @@ -622,7 +619,7 @@ namespace HEXABLOCK }; - class HEXABLOCK_EXPORT DisconnectDialog : public HexaBaseDialog, + class HexaExport DisconnectDialog : public HexaBaseDialog, public Ui::DisconnectDialog { Q_OBJECT @@ -648,7 +645,7 @@ namespace HEXABLOCK - class HEXABLOCK_EXPORT CutEdgeDialog : public HexaBaseDialog, + class HexaExport CutEdgeDialog : public HexaBaseDialog, public Ui::CutEdgeDialog { Q_OBJECT @@ -672,7 +669,7 @@ namespace HEXABLOCK }; - class HEXABLOCK_EXPORT MakeTransformationDialog : public HexaBaseDialog, + class HexaExport MakeTransformationDialog : public HexaBaseDialog, public Ui::TransformationDialog { Q_OBJECT @@ -694,7 +691,7 @@ namespace HEXABLOCK }; - class HEXABLOCK_EXPORT MakeSymmetryDialog : public HexaBaseDialog, + class HexaExport MakeSymmetryDialog : public HexaBaseDialog, public Ui::SymmetryDialog { Q_OBJECT @@ -718,7 +715,7 @@ namespace HEXABLOCK - class HEXABLOCK_EXPORT PerformTransformationDialog : public HexaBaseDialog, + class HexaExport PerformTransformationDialog : public HexaBaseDialog, public Ui::TransformationDialog { Q_OBJECT @@ -740,7 +737,7 @@ namespace HEXABLOCK }; - class HEXABLOCK_EXPORT PerformSymmetryDialog : public HexaBaseDialog, + class HexaExport PerformSymmetryDialog : public HexaBaseDialog, public Ui::SymmetryDialog { Q_OBJECT @@ -761,7 +758,7 @@ namespace HEXABLOCK void updateHelpFileName(); }; -class HEXABLOCK_EXPORT EdgeAssocDialog : public HexaBaseDialog, +class HexaExport EdgeAssocDialog : public HexaBaseDialog, public Ui::EdgeAssocDialog { Q_OBJECT @@ -799,7 +796,7 @@ class HEXABLOCK_EXPORT EdgeAssocDialog : public HexaBaseDialog, }; - class HEXABLOCK_EXPORT QuadAssocDialog : public HexaBaseDialog, + class HexaExport QuadAssocDialog : public HexaBaseDialog, public Ui::QuadAssocDialog { Q_OBJECT @@ -830,7 +827,7 @@ class HEXABLOCK_EXPORT EdgeAssocDialog : public HexaBaseDialog, - class HEXABLOCK_EXPORT GroupDialog : public HexaBaseDialog, + class HexaExport GroupDialog : public HexaBaseDialog, public Ui::GroupDialog { Q_OBJECT @@ -862,7 +859,7 @@ class HEXABLOCK_EXPORT EdgeAssocDialog : public HexaBaseDialog, - class HEXABLOCK_EXPORT LawDialog : public HexaBaseDialog, + class HexaExport LawDialog : public HexaBaseDialog, public Ui::LawDialog { Q_OBJECT @@ -890,7 +887,7 @@ class HEXABLOCK_EXPORT EdgeAssocDialog : public HexaBaseDialog, - class HEXABLOCK_EXPORT PropagationDialog : public HexaBaseDialog, + class HexaExport PropagationDialog : public HexaBaseDialog, public Ui::PropagationDialog { Q_OBJECT @@ -910,7 +907,7 @@ class HEXABLOCK_EXPORT EdgeAssocDialog : public HexaBaseDialog, void _initInputWidget( Mode editmode ); protected slots: - //void updateHelpFileName(); + void updateHelpFileName(); void deletePropagationItem(); virtual void selectElementOfModel(); @@ -923,7 +920,8 @@ class HEXABLOCK_EXPORT EdgeAssocDialog : public HexaBaseDialog, // Define the compute mesh dialog box // ---------------------------------- - class HEXABLOCK_EXPORT ComputeMeshDialog : public HexaBaseDialog + class HexaExport ComputeMeshDialog : public HexaBaseDialog, + public Ui::ComputeMeshDialog { Q_OBJECT @@ -939,16 +937,11 @@ class HEXABLOCK_EXPORT EdgeAssocDialog : public HexaBaseDialog, protected: void _initInputWidget( Mode editmode ); - - private: - QLineEdit* _name; - QSpinBox* _dim; - QLineEdit* _fact; }; - class HEXABLOCK_EXPORT ReplaceHexaDialog : public HexaBaseDialog, + class HexaExport ReplaceHexaDialog : public HexaBaseDialog, public Ui::ReplaceHexaDialog { Q_OBJECT @@ -978,7 +971,7 @@ class HEXABLOCK_EXPORT EdgeAssocDialog : public HexaBaseDialog, - class HEXABLOCK_EXPORT QuadRevolutionDialog : public HexaBaseDialog, + class HexaExport QuadRevolutionDialog : public HexaBaseDialog, public Ui::QuadRevolutionDialog { Q_OBJECT @@ -1007,7 +1000,7 @@ class HEXABLOCK_EXPORT EdgeAssocDialog : public HexaBaseDialog, - class HEXABLOCK_EXPORT MakeHemiSphereDialog : public HexaBaseDialog, + class HexaExport MakeHemiSphereDialog : public HexaBaseDialog, public Ui::MakeHemiSphereDialog { Q_OBJECT @@ -1038,7 +1031,7 @@ class HEXABLOCK_EXPORT EdgeAssocDialog : public HexaBaseDialog, HEXA_NS::Elements *_value; }; - class HEXABLOCK_EXPORT ModelInfoDialog : public HexaBaseDialog, + class HexaExport ModelInfoDialog : public HexaBaseDialog, public Ui::ModelInfoDialog { Q_OBJECT @@ -1057,7 +1050,7 @@ class HEXABLOCK_EXPORT EdgeAssocDialog : public HexaBaseDialog, virtual void _initInputWidget( Mode editmode ){} }; - class HEXABLOCK_EXPORT AddShapeDialog : public HexaBaseDialog, + class HexaExport AddShapeDialog : public HexaBaseDialog, public Ui::AddShapeDialog { Q_OBJECT @@ -1079,65 +1072,7 @@ class HEXABLOCK_EXPORT EdgeAssocDialog : public HexaBaseDialog, virtual void onCurrentSelectionChanged(); }; - - //***************************** OBSOLETE: A SUPPRIMER !!!! ************************************// - - class HEXABLOCK_EXPORT CylinderDialog : public HexaBaseDialog, - public Ui::CylinderDialog - { - Q_OBJECT - - public: - CylinderDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~CylinderDialog(); - - void clear(); - - void setValue( HEXA_NS::Cylinder* v ); - HEXA_NS::Cylinder* getValue(); - - public slots: - virtual bool apply(QModelIndex& result); - - protected: - void _initInputWidget( Mode editmode ); - - private: - HEXA_NS::Cylinder *_value; - QModelIndex _ivalue; - }; - - class HEXABLOCK_EXPORT PipeDialog : public HexaBaseDialog, - public Ui::PipeDialog - { - Q_OBJECT - - public: - PipeDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~PipeDialog(); - - void clear(); - - void setValue( HEXA_NS::Pipe* p ); - HEXA_NS::Pipe* getValue(); - - public slots: - virtual bool apply(QModelIndex& result); - - protected: - void _initInputWidget( Mode editmode ); - - private: - HEXA_NS::Pipe *_value; - QModelIndex _ivalue; - - }; - // ************************************** FIN A SUPPRIMER ******************************************// - - } } - - #endif diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.cxx index 60d44fc..7abc8b7 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.cxx @@ -47,7 +47,6 @@ #include "HEXABLOCKGUI_OccGraphicView.hxx" #include "HEXABLOCKGUI_SalomeTools.hxx" #include "HEXABLOCKGUI_DocumentSelectionModel.hxx" -#include "HEXABLOCKGUI_DocumentModel.hxx" #include "HEXABLOCKGUI_DocumentItem.hxx" #include "HEXABLOCKGUI.hxx" @@ -88,6 +87,8 @@ using namespace HEXABLOCK::GUI; // SelectionModel // //=========================================================================== +bool SelectionModel::infoMode = true; + SelectionModel::SelectionModel( QAbstractItemModel * model ): QItemSelectionModel( model ) { @@ -161,14 +162,58 @@ QModelIndexList SelectionModel::indexListOf( const QString& anEntry, int role ) return theIndexes; } +DocumentModel* SelectionModel::getDocModel() const +{ + DocumentModel* docModel = NULL; + const QSortFilterProxyModel *pModel = dynamic_cast( model() ); + if ( pModel != NULL) + docModel = dynamic_cast( pModel->sourceModel() ); + + return docModel; +} + +void SelectionModel::showEltInfo(QModelIndex& elt) +{ + DocumentModel* docModel = getDocModel(); + if (!elt.isValid() || docModel == NULL) + return; + + HEXA_NS::Vertex* vertex = docModel->getHexaPtr(elt); + HEXA_NS::Edge* edge = docModel->getHexaPtr(elt); + HEXA_NS::Quad* quad = docModel->getHexaPtr(elt); + HEXA_NS::Hexa* hexa = docModel->getHexaPtr(elt); + HEXA_NS::Vector* vector = docModel->getHexaPtr(elt); + HEXA_NS::Group* group = docModel->getHexaPtr(elt); + HEXA_NS::Law* law = docModel->getHexaPtr(elt); + HEXA_NS::Propagation* propagation = docModel->getHexaPtr(elt); + + HEXABLOCKGUI* hexagui = HEXABLOCKGUI::getInstance(); + if (vertex != NULL) + hexagui->showVertexInfoDialog(vertex); + else if (edge != NULL) + hexagui->showEdgeInfoDialog(edge); + else if (quad != NULL) + hexagui->showQuadInfoDialog(quad); + else if (hexa != NULL) + hexagui->showHexaInfoDialog(hexa); + else if (vector != NULL) + hexagui->showVectorInfoDialog(vector); + else if (group != NULL) + hexagui->showGroupInfoDialog(group); + else if (law != NULL) + hexagui->showLawInfoDialog(law); + else if (propagation != NULL) + hexagui->showPropagationInfoDialog(propagation); +} + void SelectionModel::salomeSelectionChanged() { // clear highlights and selections in the trees PatternDataSelectionModel* pdsm = HEXABLOCKGUI::currentDocGView->getPatternDataSelectionModel(); - PatternBuilderSelectionModel* pbsm = HEXABLOCKGUI::currentDocGView->getPatternBuilderSelectionModel(); +// PatternBuilderSelectionModel* pbsm = HEXABLOCKGUI::currentDocGView->getPatternBuilderSelectionModel(); PatternGeomSelectionModel* pgsm = HEXABLOCKGUI::currentDocGView->getPatternGeomSelectionModel(); pdsm->clearSelection(); - pbsm->clearSelection(); +// pbsm->clearSelection(); pgsm->clearSelection(); pdsm->unhighlightTreeItems(); pgsm->unhighlightTreeItems(); @@ -279,14 +324,12 @@ void PatternDataSelectionModel::highlightTreeItems(QModelIndexList& indexes, // * highlight item QAbstractItemModel* theModel = (QAbstractItemModel*) model(); - QMap roles; - roles[Qt::BackgroundRole] = bgColor; - roles[Qt::ForegroundRole] = fgColor; foreach( const QModelIndex& anItemIndex, indexes ) { if (anItemIndex.isValid()) { - theModel->setItemData(anItemIndex, roles); + theModel->setData(anItemIndex, fgColor, Qt::ForegroundRole); + theModel->setData(anItemIndex, bgColor, Qt::BackgroundRole); currentHighlightedItems << anItemIndex; } } @@ -305,13 +348,13 @@ void PatternDataSelectionModel::unhighlightTreeItems(bool clearSelected) return; QAbstractItemModel* theModel = (QAbstractItemModel*) model(); - QMap roles; - roles[Qt::BackgroundRole] = Qt::white; - roles[Qt::ForegroundRole] = Qt::darkGreen; foreach( const QModelIndex& anItemIndex, currentHighlightedItems) { if (anItemIndex.isValid()) - theModel->setItemData(anItemIndex, roles); + { + theModel->setData(anItemIndex, Qt::darkGreen, Qt::ForegroundRole); + theModel->setData(anItemIndex, Qt::white, Qt::BackgroundRole); + } } currentHighlightedItems.clear(); } @@ -319,16 +362,12 @@ void PatternDataSelectionModel::unhighlightTreeItems(bool clearSelected) QModelIndexList PatternDataSelectionModel::getGeomAssociations(const QModelIndex& dataIndex) { QModelIndexList geomIndexList; - DocumentModel *docModel = NULL; - const QSortFilterProxyModel *pModel = dynamic_cast( model() ); - PatternGeomSelectionModel* pGSModel = HEXABLOCKGUI::currentDocGView->getPatternGeomSelectionModel(); - - if ( pModel != NULL) - docModel = dynamic_cast( pModel->sourceModel() ); - + DocumentModel* docModel = getDocModel(); + PatternGeomSelectionModel* pGSModel = HEXABLOCKGUI::currentDocGView->getPatternGeomSelectionModel(); if (docModel == NULL || pGSModel == NULL) return geomIndexList; + const QSortFilterProxyModel *pModel = dynamic_cast( model() ); HEXA_NS::Vertex* vertex = docModel->getHexaPtr(dataIndex); HEXA_NS::Edge* edge = docModel->getHexaPtr(dataIndex); HEXA_NS::Quad* quad = docModel->getHexaPtr(dataIndex); @@ -347,7 +386,8 @@ QModelIndexList PatternDataSelectionModel::getGeomAssociations(const QModelIndex void PatternDataSelectionModel::onSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected ) { QModelIndexList indexes = selected.indexes(); - if (indexes.count() == 0) + int nbSelected = indexes.count(); + if (nbSelected == 0) return; // ** unhighlight current highlighted items in the trees @@ -369,6 +409,12 @@ void PatternDataSelectionModel::onSelectionChanged( const QItemSelection & selec // ** highlight association in the occ view HEXABLOCKGUI::currentOccGView->highlight(indexes); + if (!infoMode || nbSelected > 1) + return; + + // ** Show informations of the selected element + QModelIndex elt = indexes[0]; + showEltInfo(elt); } void PatternDataSelectionModel::geomSelectionChanged( const Handle(SALOME_InteractiveObject)& anIObject ) @@ -398,29 +444,24 @@ void PatternDataSelectionModel::vtkSelectionChanged( const Handle(SALOME_Interac //Temporary Debug for hexa selection ------------------------------ if (HEXABLOCKGUI::currentDocGView->getSelectionMode() == HEXA_TREE) { - DocumentModel *docModel = NULL; - const QSortFilterProxyModel *pModel = dynamic_cast( model() ); + DocumentModel* docModel = getDocModel(); + if ( docModel != NULL && anIOIndex.isValid()) + { + //get the selected quad + HEXA_NS::Quad* quad = docModel->getHexaPtr(anIOIndex); - if ( pModel != NULL){ - docModel = dynamic_cast( pModel->sourceModel() ); - if ( docModel != NULL && anIOIndex.isValid()) + if (quad != NULL) { - //get the selected quad - HEXA_NS::Quad* quad = docModel->getHexaPtr(anIOIndex); - - if (quad != NULL) + //get the hexa the quad belongs to + HEXA_NS::Hexa* hexa = docModel->getQuadHexa(quad); + if (hexa != NULL) //convert the hexa to a QModelIndex so we can select it in the model + anIOIndex = indexBy( HEXA_DATA_ROLE, QVariant::fromValue(hexa)); + else { - //get the hexa the quad belongs to - HEXA_NS::Hexa* hexa = docModel->getQuadHexa(quad); - if (hexa != NULL) //convert the hexa to a QModelIndex so we can select it in the model - anIOIndex = indexBy( HEXA_DATA_ROLE, QVariant::fromValue(hexa)); - else - { - SUIT_MessageBox::critical( 0, - tr("HexaBlock"), - tr("The Hexahedron this quad belongs to has been deleted!")); - return; - } + SUIT_MessageBox::critical( 0, + tr("HexaBlock"), + tr("The Hexahedron this quad belongs to has been deleted!")); + return; } } } @@ -548,14 +589,12 @@ void PatternGeomSelectionModel::highlightTreeItems(QModelIndexList& indexes, // * highlight items QAbstractItemModel* theModel = (QAbstractItemModel*) model(); - QMap roles; - roles[Qt::BackgroundRole] = bgColor; - roles[Qt::ForegroundRole] = fgColor; foreach( const QModelIndex& anItemIndex, indexes ) { if (anItemIndex.isValid()) { - theModel->setItemData(anItemIndex, roles); + theModel->setData(anItemIndex, fgColor, Qt::ForegroundRole); + theModel->setData(anItemIndex, bgColor, Qt::BackgroundRole); currentHighlightedItems << anItemIndex; } } @@ -573,13 +612,13 @@ void PatternGeomSelectionModel::unhighlightTreeItems(bool clearSelected) if (currentHighlightedItems.count() == 0) return; QAbstractItemModel* theModel = (QAbstractItemModel*) model(); - QMap roles; - roles[Qt::BackgroundRole] = Qt::white; - roles[Qt::ForegroundRole] = Qt::darkGreen; foreach( const QModelIndex& anItemIndex, currentHighlightedItems) { if (anItemIndex.isValid()) - theModel->setItemData(anItemIndex, roles); + { + theModel->setData(anItemIndex, Qt::darkGreen, Qt::ForegroundRole); + theModel->setData(anItemIndex, Qt::white, Qt::BackgroundRole); + } } currentHighlightedItems.clear(); } @@ -604,51 +643,71 @@ GroupsSelectionModel::~GroupsSelectionModel() this, SLOT( onSelectionChanged( const QItemSelection & , const QItemSelection & ) ) ); } - void GroupsSelectionModel::onSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected ) { - try { QModelIndexList indexes = selected.indexes(); - for( QModelIndexList::const_iterator i_index = indexes.begin(); i_index != indexes.end(); ++i_index ){ - HEXABLOCKGUI::currentDocGView->highlightGroups( *i_index ); + int nbSelected = indexes.count(); + if (nbSelected == 0) + return; + + // ** Highlight the group in the vtk view **/ + try { + for( QModelIndexList::const_iterator i_index = indexes.begin(); i_index != indexes.end(); ++i_index ){ + HEXABLOCKGUI::currentDocGView->highlightGroups( *i_index ); + } + } catch ( ... ) { + MESSAGE("Unknown exception was cought !!!"); } - } catch ( ... ) { - MESSAGE("Unknown exception was cought !!!"); - } + + if (!infoMode || nbSelected > 1) + return; + + // ** Show informations of the selected element **/ + QModelIndex elt = indexes[0]; + showEltInfo(elt); } // //=========================================================================== // MeshSelectionModel // //=========================================================================== MeshSelectionModel::MeshSelectionModel( QAbstractItemModel * model ): -SelectionModel( model ) + SelectionModel( model ) { - connect( this, SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ), - this, SLOT( onCurrentChanged( const QModelIndex & , const QModelIndex & ) ), Qt::UniqueConnection ); - connect( this, SIGNAL( selectionChanged( const QItemSelection & , const QItemSelection & ) ), - this, SLOT( onSelectionChanged( const QItemSelection & , const QItemSelection & ) ), Qt::UniqueConnection ); + connect( this, SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ), + this, SLOT( onCurrentChanged( const QModelIndex & , const QModelIndex & ) ), Qt::UniqueConnection ); + connect( this, SIGNAL( selectionChanged( const QItemSelection & , const QItemSelection & ) ), + this, SLOT( onSelectionChanged( const QItemSelection & , const QItemSelection & ) ), Qt::UniqueConnection ); } - MeshSelectionModel::~MeshSelectionModel() { - disconnect( this, SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ), - this, SLOT( onCurrentChanged( const QModelIndex & , const QModelIndex & ) ) ); - disconnect( this, SIGNAL( selectionChanged( const QItemSelection & , const QItemSelection & ) ), - this, SLOT( onSelectionChanged( const QItemSelection & , const QItemSelection & ) ) ); + disconnect( this, SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ), + this, SLOT( onCurrentChanged( const QModelIndex & , const QModelIndex & ) ) ); + disconnect( this, SIGNAL( selectionChanged( const QItemSelection & , const QItemSelection & ) ), + this, SLOT( onSelectionChanged( const QItemSelection & , const QItemSelection & ) ) ); } void MeshSelectionModel::onSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected ) { - try { - QModelIndexList indexes = selected.indexes(); - for( QModelIndexList::const_iterator i_index = indexes.begin(); i_index != indexes.end(); ++i_index ){ - HEXABLOCKGUI::currentDocGView->highlightPropagation( *i_index ); + int nbSelected = indexes.count(); + if (nbSelected == 0) + return; + + try { + for( QModelIndexList::const_iterator i_index = indexes.begin(); i_index != indexes.end(); ++i_index ){ + HEXABLOCKGUI::currentDocGView->highlightPropagation( *i_index ); + } + } catch ( ... ) { + MESSAGE("Unknown exception was cought !!!"); } - } catch ( ... ) { - MESSAGE("Unknown exception was cought !!!"); - } + + if (!infoMode || nbSelected > 1) + return; + + // ** Show informations of the selected element **/ + QModelIndex elt = indexes[0]; + showEltInfo(elt); } diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.hxx index bb6d13b..6cf842d 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.hxx @@ -20,7 +20,7 @@ #ifndef _HEXABLOCKGUI_DOCUMENTSELECTIONMODEL_HXX_ #define _HEXABLOCKGUI_DOCUMENTSELECTIONMODEL_HXX_ -#include "HEXABLOCKGUI_Export.hxx" +#include "hexa_base.hxx" #include #include @@ -30,6 +30,8 @@ #include "klinkitemselectionmodel.hxx" +#include "HEXABLOCKGUI_DocumentModel.hxx" + class OCCViewer_ViewWindow; @@ -38,7 +40,7 @@ namespace HEXABLOCK namespace GUI { - class HEXABLOCK_EXPORT SelectionModel: public QItemSelectionModel + class HexaExport SelectionModel: public QItemSelectionModel { Q_OBJECT @@ -51,12 +53,16 @@ namespace HEXABLOCK QModelIndex indexBy( int role, const QVariant& var ); QModelIndex indexOf( const QString& anIOEntry, int role ); QModelIndexList indexListOf( const QString& anEntry, int role ); + DocumentModel* getDocModel() const; + void showEltInfo(QModelIndex& elt); virtual void geomSelectionChanged( const Handle(SALOME_InteractiveObject)& anIObject ) {} virtual void vtkSelectionChanged( const Handle(SALOME_InteractiveObject)& anIObject ) {} void clearHighlightedItems() { currentHighlightedItems.clear(); } + void setInfoMode(bool isOn) { infoMode = isOn; } + protected slots: virtual void onCurrentChanged( const QModelIndex & current, @@ -69,21 +75,21 @@ namespace HEXABLOCK protected: QModelIndexList getSelectionFromModel(const Handle(SALOME_InteractiveObject)& anIObject); - QModelIndexList currentHighlightedItems; + static bool infoMode; }; - class PatternBuilderSelectionModel: public KLinkItemSelectionModel - { - public: - PatternBuilderSelectionModel( QAbstractItemModel *model, - QItemSelectionModel *proxySelector, QObject *parent = 0 ): - KLinkItemSelectionModel( model, proxySelector, parent ) - { - } - }; - - class PatternDataSelectionModel : public SelectionModel +// class PatternBuilderSelectionModel: public KLinkItemSelectionModel +// { +// public: +// PatternBuilderSelectionModel( QAbstractItemModel *model, +// QItemSelectionModel *proxySelector, QObject *parent = 0 ): +// KLinkItemSelectionModel( model, proxySelector, parent ) +// { +// } +// }; + + class HexaExport PatternDataSelectionModel : public SelectionModel { Q_OBJECT @@ -107,7 +113,7 @@ namespace HEXABLOCK }; - class PatternGeomSelectionModel : public SelectionModel + class HexaExport PatternGeomSelectionModel : public SelectionModel { Q_OBJECT @@ -128,7 +134,7 @@ namespace HEXABLOCK }; - class GroupsSelectionModel : public SelectionModel + class HexaExport GroupsSelectionModel : public SelectionModel { Q_OBJECT @@ -143,7 +149,7 @@ namespace HEXABLOCK }; - class MeshSelectionModel : public SelectionModel + class HexaExport MeshSelectionModel : public SelectionModel { Q_OBJECT diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_Exception.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_Exception.hxx index 6ba6a00..3cda2ab 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_Exception.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_Exception.hxx @@ -20,7 +20,7 @@ #ifndef __HEXABLOCKGUI_EXCEPTION_HXX__ #define __HEXABLOCKGUI_EXCEPTION_HXX__ -#include "HEXABLOCKGUI_Export.hxx" +#include "hexa_base.hxx" #include #include @@ -29,7 +29,7 @@ namespace HEXABLOCK { namespace GUI { - class HEXABLOCK_EXPORT Exception : public std::exception + class HexaExport Exception : public std::exception { protected: std::string _what; diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_GraphicViewsHandler.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_GraphicViewsHandler.hxx index 2c38d6c..717694e 100644 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_GraphicViewsHandler.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_GraphicViewsHandler.hxx @@ -20,8 +20,6 @@ #ifndef _HEXABLOCKGUI_VTKGRAPHICVIEWSHANDLER_HXX_ #define _HEXABLOCKGUI_VTKGRAPHICVIEWSHANDLER_HXX_ -#include "HEXABLOCKGUI_Export.hxx" - //Salome Includes #include #include @@ -30,6 +28,7 @@ #include //HEXABLOCK Includes +#include "hexa_base.hxx" #include "HEXABLOCKGUI_VtkDocumentGraphicView.hxx" namespace HEXABLOCK @@ -37,7 +36,7 @@ namespace HEXABLOCK namespace GUI { - class HEXABLOCK_EXPORT GraphicViewsHandler + class HexaExport GraphicViewsHandler { public: diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_Model.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_Model.hxx index 7a66039..9f3b3e2 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_Model.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_Model.hxx @@ -20,12 +20,11 @@ #ifndef _HEXABLOCKGUI_MODEL_HXX_ #define _HEXABLOCKGUI_MODEL_HXX_ -#include "HEXABLOCKGUI_Export.hxx" - #include +#include "hexa_base.hxx" -class HEXABLOCK_EXPORT CHEXABLOCKGUI_Model : public SalomeApp_DataModel +class HexaExport HEXABLOCKGUI_Model : public SalomeApp_DataModel { public: HEXABLOCKGUI_Model(CAM_Module* theModule); diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_OCCSelector.h b/src/HEXABLOCKGUI/HEXABLOCKGUI_OCCSelector.h index cab143c..cf93b4a 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_OCCSelector.h +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_OCCSelector.h @@ -27,11 +27,11 @@ #ifndef HEXABLOCKGUI_OCCSELECTOR_H #define HEXABLOCKGUI_OCCSELECTOR_H -#include "HEXABLOCKGUI_Export.hxx" #include +#include "hexa_base.hxx" -class HEXABLOCK_EXPORT HEXABLOCKGUI_OCCSelector : public LightApp_OCCSelector +class HexaExport HEXABLOCKGUI_OCCSelector : public LightApp_OCCSelector { public: HEXABLOCKGUI_OCCSelector( OCCViewer_Viewer*, SUIT_SelectionMgr* ); diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_OccGraphicView.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_OccGraphicView.cxx index d807d0c..512c985 100644 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_OccGraphicView.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_OccGraphicView.cxx @@ -20,20 +20,8 @@ #include "HEXABLOCKGUI_OccGraphicView.hxx" -#include "utilities.h" #include "HEXABLOCKGUI.hxx" -#include "HEXABLOCKGUI_DocumentModel.hxx" #include "HEXABLOCKGUI_VtkDocumentGraphicView.hxx" -#include "HexNewShape.hxx" -#include "HexVertexShape.hxx" -#include "HexEdgeShape.hxx" -#include "HexFaceShape.hxx" - -#include -#include -#include -#include -#include #include #include @@ -206,7 +194,7 @@ void OccGraphicView::highlight( const QModelIndexList & indexList, bool only ) } highlight( assocEntrySubIDs, only ); } -#include + void OccGraphicView::highlightSubShapes(const Handle(AIS_Shape)& anObj, const TColStd_IndexedMapOfInteger& aIndexMap, bool only) { diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_OccGraphicView.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_OccGraphicView.hxx index e5d3e59..d269eb6 100644 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_OccGraphicView.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_OccGraphicView.hxx @@ -22,8 +22,6 @@ #ifndef _HEXABLOCKGUI_OCCGRAPHICVIEW_HXX_ #define _HEXABLOCKGUI_OCCGRAPHICVIEW_HXX_ -#include "HEXABLOCKGUI_Export.hxx" - #include #include "HEXABLOCKGUI_SalomeTools.hxx" @@ -34,8 +32,7 @@ #include #include - - +#include "hexa_base.hxx" namespace HEXABLOCK { @@ -47,7 +44,7 @@ namespace HEXABLOCK * OccGraphicView ********************************************************************************/ - class HEXABLOCK_EXPORT OccGraphicView + class HexaExport OccGraphicView { public: diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_Resource.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_Resource.hxx index 87d1621..50e7a16 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_Resource.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_Resource.hxx @@ -20,7 +20,7 @@ #ifndef _HEXABLOCKGUI_RESOURCE_HXX_ #define _HEXABLOCKGUI_RESOURCE_HXX_ -#include "HEXABLOCKGUI_Export.hxx" +#include "hexa_base.hxx" #include @@ -29,7 +29,7 @@ class SUIT_ResourceMgr; -class HEXABLOCK_EXPORT HEXABLOCKGUI_Resource +class HexaExport HEXABLOCKGUI_Resource { public: HEXABLOCKGUI_Resource(SUIT_ResourceMgr* r); diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.hxx index af2a4a6..3965885 100644 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.hxx @@ -20,7 +20,7 @@ #ifndef _HEXABLOCKGUI_SALOMETOOLS_HXX_ #define _HEXABLOCKGUI_SALOMETOOLS_HXX_ -#include "HEXABLOCKGUI_Export.hxx" +#include "hexa_base.hxx" #include #include @@ -41,48 +41,48 @@ namespace HEXABLOCK namespace GUI { - HEXABLOCK_EXPORT SALOME_Actor* findActorByEntry( SVTK_ViewWindow *theVtkViewWindow, const char* theEntry ); - HEXABLOCK_EXPORT _PTR(Study) GetActiveStudyDocument(); +HexaExport SALOME_Actor* findActorByEntry( SVTK_ViewWindow *theVtkViewWindow, const char* theEntry ); + _PTR(Study) GetActiveStudyDocument(); - HEXABLOCK_EXPORT int GetNameOfSelectedElements( SVTK_ViewWindow *theWindow,/* SVTK_Selector* theSelector,*/ - const Handle(SALOME_InteractiveObject)& theIO, - QString& theName ); +HexaExport int GetNameOfSelectedElements( SVTK_ViewWindow *theWindow,/* SVTK_Selector* theSelector,*/ + const Handle(SALOME_InteractiveObject)& theIO, + QString& theName ); - HEXABLOCK_EXPORT std::string shape2string( const TopoDS_Shape& aShape ); +HexaExport std::string shape2string( const TopoDS_Shape& aShape ); - HEXABLOCK_EXPORT void getEntityOwners( const Handle(AIS_InteractiveObject)& theObj, - const Handle(AIS_InteractiveContext)& theIC, - SelectMgr_IndexedMapOfOwner& theMap ); +HexaExport void getEntityOwners( const Handle(AIS_InteractiveObject)& theObj, + const Handle(AIS_InteractiveContext)& theIC, + SelectMgr_IndexedMapOfOwner& theMap ); - HEXABLOCK_EXPORT void indicesToOwners( const TColStd_IndexedMapOfInteger& aIndexMap, - const TopoDS_Shape& aMainShape, - const SelectMgr_IndexedMapOfOwner& anAllMap, - SelectMgr_IndexedMapOfOwner& aToHiliteMap ); +HexaExport void indicesToOwners( const TColStd_IndexedMapOfInteger& aIndexMap, + const TopoDS_Shape& aMainShape, + const SelectMgr_IndexedMapOfOwner& anAllMap, + SelectMgr_IndexedMapOfOwner& aToHiliteMap ); - HEXABLOCK_EXPORT TopoDS_Shape getSubShape(const TopoDS_Shape& theShape, const int theIndex); - HEXABLOCK_EXPORT int getSubId(const TopoDS_Shape& theShape, const TopoDS_Shape& theSubShape); +HexaExport TopoDS_Shape getSubShape(const TopoDS_Shape& theShape, const int theIndex); +HexaExport int getSubId(const TopoDS_Shape& theShape, const TopoDS_Shape& theSubShape); - HEXABLOCK_EXPORT Standard_Boolean getExtremaSolution(const gp_Pnt& theInitPnt, +HexaExport Standard_Boolean getExtremaSolution(const gp_Pnt& theInitPnt, const TopoDS_Shape& theRefShape, gp_Pnt& thePnt); - HEXABLOCK_EXPORT TopoDS_Vertex makePoint(const double x, const double y, const double z); +HexaExport TopoDS_Vertex makePoint(const double x, const double y, const double z); - HEXABLOCK_EXPORT TopoDS_Vertex makePointWithReference(const TopoDS_Shape& point, const double dx, +HexaExport TopoDS_Vertex makePointWithReference(const TopoDS_Shape& point, const double dx, const double dy, const double dz); - HEXABLOCK_EXPORT TopoDS_Vertex makePointOnCurve(const TopoDS_Shape& edge, const double param); +HexaExport TopoDS_Vertex makePointOnCurve(const TopoDS_Shape& edge, const double param); - HEXABLOCK_EXPORT TopoDS_Vertex makePointOnCurveByLength(const TopoDS_Shape& edge, const TopoDS_Shape& point, const double length); +HexaExport TopoDS_Vertex makePointOnCurveByLength(const TopoDS_Shape& edge, const TopoDS_Shape& point, const double length); - HEXABLOCK_EXPORT TopoDS_Vertex makePointOnCurveByCoord(const TopoDS_Shape& edge, const double x, const double y, const double z); +HexaExport TopoDS_Vertex makePointOnCurveByCoord(const TopoDS_Shape& edge, const double x, const double y, const double z); - HEXABLOCK_EXPORT TopoDS_Vertex makePointOnLinesIntersection(const TopoDS_Shape& line1, const TopoDS_Shape& line2); + TopoDS_Vertex makePointOnLinesIntersection(const TopoDS_Shape& line1, const TopoDS_Shape& line2); - HEXABLOCK_EXPORT TopoDS_Vertex makePointOnSurface(const TopoDS_Shape& face, const double param_u, const double param_v); +HexaExport TopoDS_Vertex makePointOnSurface(const TopoDS_Shape& face, const double param_u, const double param_v); - HEXABLOCK_EXPORT TopoDS_Vertex makePointOnSurfaceByCoord(const TopoDS_Shape& face, const double x, const double y, const double z); +HexaExport TopoDS_Vertex makePointOnSurfaceByCoord(const TopoDS_Shape& face, const double x, const double y, const double z); } } diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_Trace.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_Trace.hxx index 35bf54a..cccd3e3 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_Trace.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_Trace.hxx @@ -20,12 +20,10 @@ #ifndef __HEXABLOCKGUI_TRACE_HXX__ #define __HEXABLOCKGUI_TRACE_HXX__ - - #include #include -#include "HEXABLOCKGUI_Export.hxx" +#include "hexa_base.hxx" #include "HEXABLOCKGUI_Exception.hxx" #ifdef _DEVDEBUG_ @@ -36,7 +34,7 @@ namespace HEXABLOCK { namespace GUI { - extern HEXABLOCK_EXPORT int traceLevel; + extern HexaExport int traceLevel; } } diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_VtkDocumentGraphicView.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_VtkDocumentGraphicView.cxx index 07eb8f3..0c4d3bd 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_VtkDocumentGraphicView.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_VtkDocumentGraphicView.cxx @@ -19,88 +19,28 @@ //#define _DEVDEBUG_ -#include - -#include - -#include - -#include "utilities.h" - -#include - - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - // VTK includes #include -#include -#include -#include -#include -#include -// test tutorial (sphere) -#include -#include - -// test point (cf. SMESHGUI) -#include -#include -#include #include #include -#include -#include - -#include -#include -#include - -#include "vtkLookupTable.h" -#include "vtkPoints.h" #include "vtkCellArray.h" -#include "vtkFloatArray.h" #include "vtkPolyData.h" -#include "vtkPolyDataMapper.h" -#include "vtkActor.h" -#include "vtkPointData.h" -#include "vtkProperty.h" - - -// #include "vtkStructuredGridReader.h" -#include "vtkUnstructuredGridReader.h" #include - - - - - -#ifndef M_PI -#define M_PI 3.1415927 -#endif +#include #include "HEXABLOCKGUI_Trace.hxx" -#include "HEXABLOCKGUI_DocumentModel.hxx" #include "HEXABLOCKGUI_VtkDocumentGraphicView.hxx" #include "HEXABLOCKGUI.hxx" - +#ifndef M_PI +#define M_PI 3.1415927 +#endif using namespace std; using namespace HEXABLOCK::GUI; using namespace HEXA_NS; -// !!! ceci est ni pipe ni un actor mais un mélange des deux + Document_Actor::Document_Actor( Document* doc, const QString& entry ): SALOME_Actor(), _doc( doc ) @@ -111,7 +51,8 @@ Document_Actor::Document_Actor( Document* doc, const QString& entry ): setIO(anIO); vtkUnstructuredGrid* aGrid = getUnstructuredGrid(); vtkDataSetMapper* aMapper = vtkDataSetMapper::New(); - aMapper->SetInputData(aGrid); + aMapper->SetInputData(aGrid); // saclay +// aMapper->SetInput(aGrid); aGrid->Delete(); SetVisibility( true );//VisibilityOff(); @@ -306,7 +247,8 @@ Associate_Actor::Associate_Actor( Document* doc, const QString& entry) vtkUnstructuredGrid* aGrid = getUnstructuredGrid(); vtkDataSetMapper* aMapper = vtkDataSetMapper::New(); - aMapper->SetInputData(aGrid); + aMapper->SetInputData(aGrid); // saclay +// aMapper->SetInput (aGrid); aGrid->Delete(); SetVisibility( true );//VisibilityOff(); @@ -500,20 +442,17 @@ VtkDocumentGraphicView::VtkDocumentGraphicView( DocumentModel* documentModel, //Model setModel(documentModel); patternDataModel = new PatternDataModel(parent); - patternBuilderModel = new PatternBuilderModel(parent); patternGeomModel = new PatternGeomModel(parent); groupsModel = new GroupsModel(parent); meshModel = new MeshModel(parent); patternDataModel->setSourceModel(documentModel); - patternBuilderModel->setSourceModel(documentModel); patternGeomModel->setSourceModel(documentModel); groupsModel->setSourceModel(documentModel); meshModel->setSourceModel(documentModel); //Selection Model patternDataSelectionModel = new PatternDataSelectionModel(patternDataModel); - patternBuilderSelectionModel = new PatternBuilderSelectionModel(patternBuilderModel, patternDataSelectionModel); patternGeomSelectionModel = new PatternGeomSelectionModel(patternGeomModel); groupsSelectionModel = new GroupsSelectionModel(groupsModel); meshSelectionModel = new MeshSelectionModel(meshModel ); @@ -550,13 +489,11 @@ VtkDocumentGraphicView::~VtkDocumentGraphicView() //Delete Model delete patternDataModel; - delete patternBuilderModel; delete groupsModel; delete meshModel; //Delete Selection Model/ Disconnect signals on delete (Qt) // delete patternDataSelectionModel; -// delete patternBuilderSelectionModel; // delete groupsSelectionModel; // delete meshSelectionModel; } @@ -606,13 +543,6 @@ void VtkDocumentGraphicView::update() void VtkDocumentGraphicView::setVertexSelection() { setSelectionMode(NodeSelection); -// // NodeSelection, -// // CellSelection, -// // EdgeOfCellSelection, -// // EdgeSelection, -// // FaceSelection, -// // VolumeSelection, -// // ActorSelection }; } void VtkDocumentGraphicView::setEdgeSelection() @@ -677,10 +607,6 @@ void VtkDocumentGraphicView::setSelectionMode( const QModelIndex& eltIndex ) case PROPAGATION_TREE : case PROPAGATION_DIR_TREE : setEdgeSelection(); break; default: setAllSelection(); -// CellSelection, -// EdgeOfCellSelection, -// VolumeSelection, -// ActorSelection } } @@ -834,11 +760,9 @@ void VtkDocumentGraphicView::highlightPropagation( const QModelIndex& eltIndex ) /******************************************************************************** * ABSTRACT METHOD ( MUST BE IMPLEMENTED ) ********************************************************************************/ - /* Returns the item that covers the coordinate given in the view. */ - QModelIndex VtkDocumentGraphicView::indexAt(const QPoint &point) const { return QModelIndex(); @@ -848,7 +772,6 @@ void VtkDocumentGraphicView::scrollTo(const QModelIndex &index, ScrollHint) { } - /* Returns the position of the item in viewport coordinates. */ @@ -955,71 +878,3 @@ void VtkDocumentGraphicView::setModel ( QAbstractItemModel * model ) // connect( dm, SIGNAL( nameChanged(const QString&) ), this, SLOT ( setWindowTitle(const QString&) ) ); } } - -// void DocumentGraphicView::loadVTK( const QString& path ) //CS_TEST -// { -// std::cout << "DocumentGraphicView::loadVTK=>"<(_suitView); -// -// // vtkStructuredGridReader -// vtkUnstructuredGridReader* r = vtkUnstructuredGridReader::New(); -// // r->SetFileName( path.toLocal8Bit().constData() ); -// r->SetInputString( vtkData.toLocal8Bit().constData() ); -// r->SetReadFromInputString( true ); -// r->Update(); -// -// vtkUnstructuredGrid* myGrid = r->GetOutput();//vtkUnstructuredGrid::New(); -// std::cout << "GetNumberOfCells =>"<< myGrid->GetNumberOfCells(); -// // Create and display actor -// -// vtkDataSetMapper* myMapper = vtkDataSetMapper::New(); -// myMapper->SetInputData(myGrid); -// -// // if ( myPreviewActor ){ -// // myVTKViewWindow->RemoveActor(myPreviewActor); -// // myPreviewActor->Delete(); -// // } -// -// SALOME_Actor* myPreviewActor = SALOME_Actor::New(); -// myPreviewActor = SALOME_Actor::New(); -// Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(QString::number( reinterpret_cast(_hexaDocument) ),"HEXABLOCK");//,theName); -// myPreviewActor->setIO(anIO); -// -// // myPreviewActor->PickableOff(); -// myPreviewActor->SetVisibility( true );//VisibilityOff(); -// myPreviewActor->SetPickable( true ); -// myPreviewActor->SetMapper(myMapper); -// -// vtkProperty* aProp = vtkProperty::New(); -// // aProp->SetRepresentationToWireframe(); -// aProp->SetRepresentationToSurface(); -// aProp->EdgeVisibilityOn (); -// -// // aProp->SetColor(10, 10, 250); -// aProp->SetPointSize(5); -// myPreviewActor->SetProperty(aProp); -// aProp->Delete(); -// -// /*vtkProperty* myBackProp = vtkProperty::New(); -// GetColor( "SMESH", "backface_color", aBackRGB[0], aBackRGB[1], aBackRGB[2], QColor( 0, 0, 255 ) ); -// myBackProp->SetColor( aBackRGB[0], aBackRGB[1], aBackRGB[2] ); -// myPreviewActor->SetBackfaceProperty( myBackProp ); -// myBackProp->Delete()*/; -// myVTKViewWindow->AddActor(myPreviewActor); -// myVTKViewWindow->getRenderer()->Render(); -// myVTKViewWindow->Repaint(); -// myVTKViewWindow->onFitAll(); -// -// myVTKViewWindow->SetSelectionMode( ActorSelection ); -// // myVTKViewWindow->SetSelectionMode( NodeSelection ); -// // myVTKViewWindow->SetSelectionMode( EdgeSelection ); -// // myVTKViewWindow->SetSelectionMode( FaceSelection ); -// } diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_VtkDocumentGraphicView.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_VtkDocumentGraphicView.hxx index 2e947e7..d1b74ea 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_VtkDocumentGraphicView.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_VtkDocumentGraphicView.hxx @@ -20,8 +20,6 @@ #ifndef _HEXABLOCKGUI_VTKDOCUMENTGRAPHICVIEW_HXX_ #define _HEXABLOCKGUI_VTKDOCUMENTGRAPHICVIEW_HXX_ -#include "HEXABLOCKGUI_Export.hxx" - // SALOME GUI includes #include #include @@ -55,7 +53,7 @@ namespace HEXABLOCK namespace GUI { - class HEXABLOCK_EXPORT Document_Actor : public SALOME_Actor + class HexaExport Document_Actor : public SALOME_Actor { public: Document_Actor(HEXA_NS::Document* doc, const QString& entry); @@ -73,7 +71,7 @@ namespace HEXABLOCK }; // Abu - class Associate_Actor : public SALOME_Actor + class HexaExport Associate_Actor : public SALOME_Actor { public: Associate_Actor(HEXA_NS::Document* doc, const QString& entry); @@ -90,11 +88,10 @@ namespace HEXABLOCK HEXA_NS::Document* _doc; }; - /******************************************************************************** * VtkDocumentGraphicView ********************************************************************************/ - class HEXABLOCK_EXPORT VtkDocumentGraphicView : public QAbstractItemView + class HexaExport VtkDocumentGraphicView : public QAbstractItemView { Q_OBJECT @@ -135,9 +132,6 @@ namespace HEXABLOCK PatternDataSelectionModel* getPatternDataSelectionModel() const { return patternDataSelectionModel; } - PatternBuilderSelectionModel* getPatternBuilderSelectionModel() const - { return patternBuilderSelectionModel; } - PatternGeomSelectionModel* getPatternGeomSelectionModel() const { return patternGeomSelectionModel;} @@ -148,7 +142,6 @@ namespace HEXABLOCK { return meshSelectionModel; } PatternDataModel* getPatternDataModel() const {return patternDataModel;} - PatternBuilderModel* getPatternBuilderModel() const {return patternBuilderModel;} PatternGeomModel* getPatternGeomModel() const { return patternGeomModel;} GroupsModel* getGroupsModel() const {return groupsModel;} MeshModel* getMeshModel() const {return meshModel;} @@ -191,13 +184,11 @@ namespace HEXABLOCK Associate_Actor* associateActor; PatternDataSelectionModel* patternDataSelectionModel; - PatternBuilderSelectionModel* patternBuilderSelectionModel; PatternGeomSelectionModel* patternGeomSelectionModel; GroupsSelectionModel* groupsSelectionModel; MeshSelectionModel* meshSelectionModel; PatternDataModel* patternDataModel; - PatternBuilderModel* patternBuilderModel; PatternGeomModel* patternGeomModel; GroupsModel* groupsModel; MeshModel* meshModel; diff --git a/src/HEXABLOCKGUI/Hexa_QTD.ui b/src/HEXABLOCKGUI/Hexa_QTD.ui index ffcedc9..654939a 100755 --- a/src/HEXABLOCKGUI/Hexa_QTD.ui +++ b/src/HEXABLOCKGUI/Hexa_QTD.ui @@ -16,6 +16,12 @@ 0 + + + 5 + 0 + + Hexahedron Construction diff --git a/src/HEXABLOCKGUI/Law_QTD.ui b/src/HEXABLOCKGUI/Law_QTD.ui index 961c15b..2fc0fb2 100644 --- a/src/HEXABLOCKGUI/Law_QTD.ui +++ b/src/HEXABLOCKGUI/Law_QTD.ui @@ -7,11 +7,11 @@ 0 0 282 - 180 + 248 - + 0 0 @@ -30,7 +30,7 @@ - 5 + 0 0 @@ -48,7 +48,7 @@ - + 0 0 @@ -70,6 +70,12 @@ + + + 0 + 0 + + 0 @@ -90,6 +96,12 @@ + + + 0 + 0 + + 6 @@ -111,7 +123,7 @@ - + 0 0 @@ -133,6 +145,19 @@ + + + + Qt::Vertical + + + + 20 + 16777215 + + + + diff --git a/src/HEXABLOCKGUI/MakeCylinders_QTD.ui b/src/HEXABLOCKGUI/MakeCylinders_QTD.ui index 302e7b8..5bf8b48 100644 --- a/src/HEXABLOCKGUI/MakeCylinders_QTD.ui +++ b/src/HEXABLOCKGUI/MakeCylinders_QTD.ui @@ -6,16 +6,22 @@ 0 0 - 275 - 407 + 226 + 422 - + 0 0 + + + 5 + 0 + + Cylinders Construction @@ -42,7 +48,7 @@ - + 0 0 @@ -61,7 +67,7 @@ - + 0 0 @@ -77,6 +83,12 @@ + + + 0 + 0 + + 6 @@ -90,6 +102,12 @@ + + + 0 + 0 + + 6 @@ -134,7 +152,7 @@ - + 0 0 @@ -153,7 +171,7 @@ - + 0 0 @@ -169,6 +187,12 @@ + + + 0 + 0 + + 6 @@ -182,6 +206,12 @@ + + + 0 + 0 + + 6 @@ -218,7 +248,7 @@ 20 - 0 + 16777215 diff --git a/src/HEXABLOCKGUI/MakeHemiSphere_QTD.ui b/src/HEXABLOCKGUI/MakeHemiSphere_QTD.ui index aec53ea..b9904a6 100644 --- a/src/HEXABLOCKGUI/MakeHemiSphere_QTD.ui +++ b/src/HEXABLOCKGUI/MakeHemiSphere_QTD.ui @@ -18,7 +18,7 @@ - 0 + 5 324 diff --git a/src/HEXABLOCKGUI/MakePipes_QTD.ui b/src/HEXABLOCKGUI/MakePipes_QTD.ui index 3df3a49..6828f33 100644 --- a/src/HEXABLOCKGUI/MakePipes_QTD.ui +++ b/src/HEXABLOCKGUI/MakePipes_QTD.ui @@ -6,16 +6,22 @@ 0 0 - 305 - 464 + 253 + 480 - + 0 0 + + + 5 + 0 + + Pipes Construction @@ -42,7 +48,7 @@ - + 0 0 @@ -59,7 +65,7 @@ - + 0 0 @@ -75,6 +81,12 @@ + + + 0 + 0 + + 6 @@ -88,6 +100,12 @@ + + + 0 + 0 + + hole radius @@ -95,6 +113,12 @@ + + + 0 + 0 + + 6 @@ -115,6 +139,12 @@ + + + 0 + 0 + + 6 @@ -145,7 +175,7 @@ - + 0 0 @@ -162,7 +192,7 @@ - + 0 0 @@ -178,6 +208,12 @@ + + + 0 + 0 + + 6 @@ -191,6 +227,12 @@ + + + 0 + 0 + + hole radius @@ -198,6 +240,12 @@ + + + 0 + 0 + + 6 @@ -218,6 +266,12 @@ + + + 0 + 0 + + 6 @@ -232,22 +286,22 @@ + + + + Qt::Vertical + + + + 20 + 16777215 + + + + - - - - Qt::Vertical - - - - 20 - 0 - - - - diff --git a/src/HEXABLOCKGUI/MergeEdges_QTD.ui b/src/HEXABLOCKGUI/MergeEdges_QTD.ui index d80ae66..e8da098 100644 --- a/src/HEXABLOCKGUI/MergeEdges_QTD.ui +++ b/src/HEXABLOCKGUI/MergeEdges_QTD.ui @@ -10,6 +10,12 @@ 198 + + + 5 + 0 + + Merge Operation @@ -36,7 +42,7 @@ - + 0 0 @@ -54,6 +60,12 @@ + + + 0 + 0 + + 16777215 @@ -67,6 +79,12 @@ + + + 0 + 0 + + 16777215 @@ -80,6 +98,12 @@ + + + 0 + 0 + + 127 diff --git a/src/HEXABLOCKGUI/Merge_QTD.ui b/src/HEXABLOCKGUI/Merge_QTD.ui index 6a6275f..89414fd 100644 --- a/src/HEXABLOCKGUI/Merge_QTD.ui +++ b/src/HEXABLOCKGUI/Merge_QTD.ui @@ -6,8 +6,8 @@ 0 0 - 254 - 736 + 304 + 836 @@ -16,6 +16,12 @@ 0 + + + 5 + 0 + + Merge Operation @@ -31,6 +37,12 @@ 0 + + + 0 + 0 + + true @@ -39,8 +51,8 @@ 0 0 - 216 - 784 + 284 + 816 @@ -59,7 +71,7 @@ - + 0 0 @@ -75,7 +87,7 @@ - + 0 0 @@ -87,6 +99,12 @@ + + + 0 + 0 + + Quad @@ -157,6 +175,12 @@ + + + 0 + 0 + + 16777215 @@ -192,6 +216,12 @@ + + + 0 + 0 + + 16777215 @@ -212,6 +242,12 @@ + + + 0 + 0 + + 16777215 @@ -245,6 +281,12 @@ + + + 0 + 0 + + 16777215 @@ -265,6 +307,12 @@ + + + 0 + 0 + + 16777215 @@ -303,6 +351,12 @@ + + + 0 + 0 + + 16777215 @@ -323,6 +377,12 @@ + + + 0 + 0 + + 16777215 @@ -343,6 +403,12 @@ + + + 0 + 0 + + 16777215 @@ -372,6 +438,12 @@ + + + 0 + 0 + + 16777215 @@ -392,6 +464,12 @@ + + + 0 + 0 + + 16777215 @@ -412,6 +490,12 @@ + + + 0 + 0 + + 16777215 @@ -429,22 +513,22 @@ + + + + Qt::Vertical + + + + 20 + 16777215 + + + + - - - - Qt::Vertical - - - - 20 - 40 - - - - diff --git a/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx b/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx index 02eab54..5270548 100644 --- a/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx +++ b/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx @@ -99,8 +99,8 @@ MyBasicGUI_PointDlg::MyBasicGUI_PointDlg(QWidget* parent, Qt::WindowFlags fl) QPixmap image7 (aResMgr->loadPixmap("GEOM", tr("ICO_WIRE"))); setWindowTitle( tr("Vertex Association") ); - setMinimumWidth(260); - setMinimumHeight(400); +// setMinimumWidth(260); +// setMinimumHeight(400); mainFrame()->GroupConstructors->setTitle(tr("GEOM_POINTS")); mainFrame()->RadioButton1->setIcon(image0); diff --git a/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.hxx b/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.hxx index fcfc9c2..730c224 100755 --- a/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.hxx +++ b/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.hxx @@ -21,7 +21,7 @@ #ifndef MYBASICGUI_POINTDLG_H #define MYBASICGUI_POINTDLG_H -#include "HEXABLOCKGUI_Export.hxx" + #include "MyGEOMBase_Skeleton.hxx" @@ -63,7 +63,8 @@ namespace HEXABLOCK // class : MyBasicGUI_PointDlg // purpose : //================================================================================= -typedef class HEXABLOCK_EXPORT MyBasicGUI_PointDlg : public MyGEOMBase_Skeleton +#include "hexa_base.hxx" +typedef class HexaExport MyBasicGUI_PointDlg : public MyGEOMBase_Skeleton { Q_OBJECT @@ -112,8 +113,8 @@ private slots: void ClickParamCoord( int ); void onBtnPopup( QAction* ); void updateSize(); -//void onRefPointChanged(const QString& pointName); -//void onStartPointSelected(const QString& pointName); + void onRefPointChanged(const QString& pointName); + void onStartPointSelected(const QString& pointName); void onParamValueChanged(double newValue); void onXCoordChanged(double newValue); void onYCoordChanged(double newValue); diff --git a/src/HEXABLOCKGUI/MyDlgRef/DlgRef_Skeleton_QTD.ui b/src/HEXABLOCKGUI/MyDlgRef/DlgRef_Skeleton_QTD.ui index 4254a82..8a6ec71 100755 --- a/src/HEXABLOCKGUI/MyDlgRef/DlgRef_Skeleton_QTD.ui +++ b/src/HEXABLOCKGUI/MyDlgRef/DlgRef_Skeleton_QTD.ui @@ -7,7 +7,7 @@ 0 0 345 - 538 + 401 @@ -16,12 +16,24 @@ 0 + + + 5 + 0 + + + + + 0 + 0 + + Qt::ScrollBarAsNeeded @@ -34,12 +46,18 @@ 0 0 325 - 518 + 381 + + + 5 + 0 + + Vertex of the model @@ -59,6 +77,12 @@ + + + 5 + 0 + + Point of the geometry @@ -154,14 +178,14 @@ - + Qt::Vertical 20 - 10 + 16777215 diff --git a/src/HEXABLOCKGUI/MyGEOMBase_Skeleton.hxx b/src/HEXABLOCKGUI/MyGEOMBase_Skeleton.hxx index 531f0c8..da14e2a 100755 --- a/src/HEXABLOCKGUI/MyGEOMBase_Skeleton.hxx +++ b/src/HEXABLOCKGUI/MyGEOMBase_Skeleton.hxx @@ -20,7 +20,7 @@ #ifndef MYGEOMBASE_SKELETON_H #define MYGEOMBASE_SKELETON_H -#include "HEXABLOCKGUI_Export.hxx" + #include "HEXABLOCKGUI_OccGraphicView.hxx" #include "HEXABLOCKGUI.hxx" @@ -43,12 +43,14 @@ class QPushButton; # define DBL_DIGITS_DISPLAY 13 #endif // COORD_MIN +#include "hexa_base.hxx" + namespace HEXABLOCK { namespace GUI { -class HEXABLOCK_EXPORT MyGEOMBase_Skeleton : public HexaBaseDialog +class HexaExport MyGEOMBase_Skeleton : public HexaBaseDialog { Q_OBJECT diff --git a/src/HEXABLOCKGUI/PrismQuad_QTD.ui b/src/HEXABLOCKGUI/PrismQuad_QTD.ui index 71505ad..5d958bc 100644 --- a/src/HEXABLOCKGUI/PrismQuad_QTD.ui +++ b/src/HEXABLOCKGUI/PrismQuad_QTD.ui @@ -18,7 +18,7 @@ - 0 + 5 300 @@ -186,6 +186,12 @@ 0 + + + 5 + 0 + + 0 diff --git a/src/HEXABLOCKGUI/Propagation_QTD.ui b/src/HEXABLOCKGUI/Propagation_QTD.ui index f9ea14b..edc03e3 100644 --- a/src/HEXABLOCKGUI/Propagation_QTD.ui +++ b/src/HEXABLOCKGUI/Propagation_QTD.ui @@ -6,8 +6,8 @@ 0 0 - 196 - 297 + 251 + 341 @@ -16,10 +16,16 @@ 0 + + + 5 + 0 + + Propagation - + @@ -37,15 +43,21 @@ Propagation(s) - + - + 0 0 + + + 0 + 130 + + @@ -54,7 +66,7 @@ - + 0 0 @@ -62,7 +74,7 @@ Law - + @@ -87,11 +99,30 @@ + + + 0 + 0 + + way + + + + Qt::Vertical + + + + 20 + 16777215 + + + + diff --git a/src/HEXABLOCKGUI/QuadAssoc_QTD.ui b/src/HEXABLOCKGUI/QuadAssoc_QTD.ui index 30bbdee..71678fc 100644 --- a/src/HEXABLOCKGUI/QuadAssoc_QTD.ui +++ b/src/HEXABLOCKGUI/QuadAssoc_QTD.ui @@ -7,7 +7,7 @@ 0 0 232 - 271 + 378 @@ -18,14 +18,14 @@ - 0 + 5 0 16777215 - 378 + 16777215 @@ -53,7 +53,7 @@ - + 0 0 @@ -71,7 +71,7 @@ - + 0 0 @@ -115,6 +115,19 @@ + + + + Qt::Vertical + + + + 20 + 40 + + + + diff --git a/src/HEXABLOCKGUI/QuadRevolution_QTD.ui b/src/HEXABLOCKGUI/QuadRevolution_QTD.ui index 6b661e8..69775fd 100644 --- a/src/HEXABLOCKGUI/QuadRevolution_QTD.ui +++ b/src/HEXABLOCKGUI/QuadRevolution_QTD.ui @@ -7,13 +7,13 @@ 0 0 389 - 584 + 712 5 - 300 + 0 @@ -22,9 +22,21 @@ + + + 0 + 0 + + + + + 0 + 0 + + Uniform @@ -35,6 +47,12 @@ + + + 0 + 0 + + Custom @@ -45,6 +63,12 @@ + + + 0 + 0 + + true @@ -54,7 +78,7 @@ 0 0 369 - 518 + 646 @@ -91,7 +115,7 @@ - + 0 0 @@ -121,7 +145,7 @@ - + 0 0 @@ -160,6 +184,12 @@ + + + 0 + 0 + + 6 @@ -183,6 +213,12 @@ + + + 0 + 0 + + 1000000 @@ -265,6 +301,19 @@ + + + + Qt::Vertical + + + + 20 + 40 + + + + diff --git a/src/HEXABLOCKGUI/Quad_QTD.ui b/src/HEXABLOCKGUI/Quad_QTD.ui index 38360a6..435496f 100755 --- a/src/HEXABLOCKGUI/Quad_QTD.ui +++ b/src/HEXABLOCKGUI/Quad_QTD.ui @@ -6,19 +6,19 @@ 0 0 - 216 - 463 + 232 + 495 - + 0 0 - 0 + 5 0 @@ -32,14 +32,14 @@ - + 0 0 - 5 + 1 0 @@ -50,7 +50,7 @@ - + 0 0 @@ -66,7 +66,7 @@ - + 0 0 @@ -82,14 +82,14 @@ - + 0 0 - 5 + 1 0 @@ -99,6 +99,12 @@ + + + 0 + 0 + + @@ -129,12 +135,15 @@ - + 0 0 + + QFormLayout::AllNonFixedFieldsGrow + @@ -142,25 +151,6 @@ - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - false - - - @@ -245,13 +235,32 @@ + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + false + + + - + 0 0 @@ -267,7 +276,7 @@ - + 0 0 @@ -293,7 +302,7 @@ - + 0 0 @@ -319,7 +328,7 @@ - + 0 0 @@ -345,7 +354,7 @@ - + 0 0 @@ -370,6 +379,19 @@ + + + + Qt::Vertical + + + + 20 + 16777215 + + + + @@ -425,32 +447,32 @@ rb1 clicked() - widget_2 - show() + widget + hide() - 297 - 46 + 353 + 49 - 310 - 264 + 351 + 110 rb1 clicked() - widget - hide() + widget_2 + show() - 353 - 49 + 297 + 46 - 351 - 110 + 310 + 264 diff --git a/src/HEXABLOCKGUI/RemoveHexa_QTD.ui b/src/HEXABLOCKGUI/RemoveHexa_QTD.ui index cdb9fcd..52598f5 100644 --- a/src/HEXABLOCKGUI/RemoveHexa_QTD.ui +++ b/src/HEXABLOCKGUI/RemoveHexa_QTD.ui @@ -6,12 +6,12 @@ 0 0 - 225 - 109 + 257 + 156 - + 0 0 @@ -37,40 +37,63 @@ - - - - - Hexa - - + + + + + + + Hexa + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + false + + + + - - + + - + 0 0 - - - 16777215 - 16777215 - - - - false - - - - - including connected hexa + + + + Qt::Vertical + + + + 20 + 16777215 + + + + diff --git a/src/HEXABLOCKGUI/ReplaceHexa_QTD.ui b/src/HEXABLOCKGUI/ReplaceHexa_QTD.ui index a1908f0..e387f00 100644 --- a/src/HEXABLOCKGUI/ReplaceHexa_QTD.ui +++ b/src/HEXABLOCKGUI/ReplaceHexa_QTD.ui @@ -6,13 +6,13 @@ 0 0 - 369 - 457 + 287 + 500 - 0 + 5 0 @@ -22,6 +22,12 @@ + + + 0 + 0 + + true @@ -30,8 +36,8 @@ 0 0 - 349 - 437 + 267 + 480 @@ -69,7 +75,7 @@ - + 0 0 @@ -85,7 +91,7 @@ - + 0 0 @@ -111,7 +117,7 @@ - + 0 0 @@ -137,7 +143,7 @@ - + 0 0 @@ -162,7 +168,7 @@ - + 0 0 @@ -181,7 +187,7 @@ - + 0 0 @@ -207,7 +213,7 @@ - + 0 0 @@ -233,7 +239,7 @@ - + 0 0 diff --git a/src/HEXABLOCKGUI/Resource.hxx b/src/HEXABLOCKGUI/Resource.hxx index f745ea3..1b33510 100755 --- a/src/HEXABLOCKGUI/Resource.hxx +++ b/src/HEXABLOCKGUI/Resource.hxx @@ -20,7 +20,7 @@ #ifndef _RESOURCE_HXX_ #define _RESOURCE_HXX_ -#include "HEXABLOCKGUI_Export.hxx" +#include "hexa_base.hxx" #include #include @@ -183,7 +183,7 @@ namespace HEXABLOCK { namespace GUI { - class HEXABLOCK_EXPORT Resource { + class HexaExport Resource { public: Resource(); diff --git a/src/HEXABLOCKGUI/Symmetry_QTD.ui b/src/HEXABLOCKGUI/Symmetry_QTD.ui index ceb71a1..dc53b8a 100644 --- a/src/HEXABLOCKGUI/Symmetry_QTD.ui +++ b/src/HEXABLOCKGUI/Symmetry_QTD.ui @@ -6,12 +6,12 @@ 0 0 - 234 + 280 422 - + 0 0 @@ -39,8 +39,8 @@ - 5 - 50 + 1 + 0 @@ -56,7 +56,7 @@ - + 0 0 @@ -72,7 +72,7 @@ - + 0 0 @@ -84,6 +84,12 @@ + + + 0 + 0 + + Plane @@ -96,7 +102,7 @@ - 5 + 1 0 @@ -117,7 +123,7 @@ - + 0 0 @@ -141,7 +147,14 @@ - + + + + 0 + 0 + + + @@ -159,7 +172,7 @@ - + 0 0 @@ -185,7 +198,7 @@ - + 0 0 @@ -211,7 +224,7 @@ - + 0 0 @@ -243,7 +256,7 @@ - + 0 0 @@ -269,7 +282,7 @@ - + 0 0 @@ -295,7 +308,7 @@ - + 0 0 diff --git a/src/HEXABLOCKGUI/Transformation_QTD.ui b/src/HEXABLOCKGUI/Transformation_QTD.ui index 78b0ba1..b25436c 100644 --- a/src/HEXABLOCKGUI/Transformation_QTD.ui +++ b/src/HEXABLOCKGUI/Transformation_QTD.ui @@ -6,16 +6,22 @@ 0 0 - 287 + 266 475 - + 0 0 + + + 5 + 0 + + Transform Operation @@ -37,6 +43,12 @@ 0 + + + 16777215 + 50 + + @@ -44,7 +56,7 @@ - + 0 0 @@ -60,7 +72,7 @@ - + 0 0 @@ -73,7 +85,7 @@ - + 0 0 @@ -95,6 +107,9 @@ + + QFormLayout::AllNonFixedFieldsGrow + @@ -104,6 +119,12 @@ + + + 0 + 0 + + 16777215 @@ -147,8 +168,24 @@ + + QFormLayout::AllNonFixedFieldsGrow + + + + + elements + + + + + + 0 + 0 + + 16777215 @@ -169,6 +206,12 @@ + + + 0 + 0 + + 16777215 @@ -189,6 +232,12 @@ + + + 0 + 0 + + 6 @@ -200,21 +249,30 @@ - - - - elements - - - + + QFormLayout::AllNonFixedFieldsGrow + + + + + elements + + + + + + 0 + 0 + + 16777215 @@ -235,6 +293,12 @@ + + + 0 + 0 + + 16777215 @@ -255,6 +319,12 @@ + + + 0 + 0 + + 16777215 @@ -275,6 +345,12 @@ + + + 0 + 0 + + false @@ -295,13 +371,6 @@ - - - - elements - - - diff --git a/src/HEXABLOCKGUI/Vector_QTD.ui b/src/HEXABLOCKGUI/Vector_QTD.ui index 80e9001..16b215e 100644 --- a/src/HEXABLOCKGUI/Vector_QTD.ui +++ b/src/HEXABLOCKGUI/Vector_QTD.ui @@ -6,16 +6,22 @@ 0 0 - 255 - 364 + 231 + 395 - + 0 0 + + + 5 + 0 + + Vector Construction @@ -26,7 +32,7 @@ - + 0 0 @@ -38,7 +44,7 @@ - + 0 0 @@ -54,7 +60,7 @@ - + 0 0 @@ -89,7 +95,7 @@ true - + 0 0 @@ -124,7 +130,7 @@ - + 0 0 @@ -162,7 +168,7 @@ true - + 0 0 @@ -194,7 +200,7 @@ - + 0 0 @@ -226,7 +232,7 @@ - + 0 0 @@ -252,7 +258,7 @@ - + 0 0 @@ -271,6 +277,19 @@ + + + + Qt::Vertical + + + + 20 + 16777215 + + + + diff --git a/src/HEXABLOCKGUI/Vertex_QTD.ui b/src/HEXABLOCKGUI/Vertex_QTD.ui index 4a140bf..5c711a0 100755 --- a/src/HEXABLOCKGUI/Vertex_QTD.ui +++ b/src/HEXABLOCKGUI/Vertex_QTD.ui @@ -6,19 +6,19 @@ 0 0 - 246 - 216 + 228 + 248 - + 0 0 - 0 + 5 0 @@ -54,7 +54,7 @@ - + 0 0 @@ -114,6 +114,12 @@ + + + 0 + 0 + + 0 @@ -121,6 +127,12 @@ + + + 0 + 0 + + 0 @@ -128,6 +140,12 @@ + + + 0 + 0 + + 0 @@ -136,6 +154,19 @@ + + + + Qt::Vertical + + + + 20 + 16777215 + + + + diff --git a/src/HEXABLOCKGUI/klinkitemselectionmodel.hxx b/src/HEXABLOCKGUI/klinkitemselectionmodel.hxx index 089b8f3..f861f74 100644 --- a/src/HEXABLOCKGUI/klinkitemselectionmodel.hxx +++ b/src/HEXABLOCKGUI/klinkitemselectionmodel.hxx @@ -22,8 +22,6 @@ #ifndef KLINKITEMSELECTIONMODEL_H #define KLINKITEMSELECTIONMODEL_H -#include "HEXABLOCKGUI_Export.hxx" - #include #include #include @@ -33,11 +31,12 @@ // #include "kdeui_export.h" // #include "klinkitemselectionmodel_p.hxx" +#include "hexa_base.hxx" #include "kmodelindexproxymapper.hxx" class KLinkItemSelectionModelPrivate; -class HEXABLOCK_EXPORT KLinkItemSelectionModel : public QItemSelectionModel +class HexaExport KLinkItemSelectionModel : public QItemSelectionModel { Q_OBJECT public: @@ -86,7 +85,7 @@ static QItemSelection klink_removeInvalidRanges(const QItemSelection &selection) #endif -class HEXABLOCK_EXPORT KLinkItemSelectionModelPrivate +class KLinkItemSelectionModelPrivate { public: KLinkItemSelectionModelPrivate(KLinkItemSelectionModel *proxySelectionModel, QAbstractItemModel *model, diff --git a/src/HEXABLOCKGUI/kmodelindexproxymapper.hxx b/src/HEXABLOCKGUI/kmodelindexproxymapper.hxx index ac03dc0..6af03c9 100644 --- a/src/HEXABLOCKGUI/kmodelindexproxymapper.hxx +++ b/src/HEXABLOCKGUI/kmodelindexproxymapper.hxx @@ -22,10 +22,10 @@ #ifndef KMODELINDEXPROXYMAPPER_H #define KMODELINDEXPROXYMAPPER_H -#include "HEXABLOCKGUI_Export.hxx" - #include +#include "hexa_base.hxx" + // #include "kdeui_export.h" class QAbstractItemModel; @@ -33,7 +33,7 @@ class QModelIndex; class QItemSelection; class KModelIndexProxyMapperPrivate; -class HEXABLOCK_EXPORT KModelIndexProxyMapper : public QObject +class HexaExport KModelIndexProxyMapper : public QObject { Q_OBJECT public: diff --git a/src/HEXABLOCKGUI/resources/HEXABLOCKCatalog.xml.in b/src/HEXABLOCKGUI/resources/HEXABLOCKCatalog.xml.in index 6876096..e6d2fbe 100755 --- a/src/HEXABLOCKGUI/resources/HEXABLOCKCatalog.xml.in +++ b/src/HEXABLOCKGUI/resources/HEXABLOCKCatalog.xml.in @@ -37,7 +37,7 @@ HEXABLOCK TUI Data CS - @SALOMEHEXABLOCK_VERSION@ + @VERSION@ CEA - RD 1 ModuleHexablock.png diff --git a/src/HEXABLOCKGUI/resources/SalomeApp.xml.in b/src/HEXABLOCKGUI/resources/SalomeApp.xml.in index 0961944..a003c8e 100755 --- a/src/HEXABLOCKGUI/resources/SalomeApp.xml.in +++ b/src/HEXABLOCKGUI/resources/SalomeApp.xml.in @@ -24,7 +24,7 @@ - +
diff --git a/src/HEXABLOCK_SWIG/hexablock_swig.py b/src/HEXABLOCK_SWIG/hexablock_swig.py index 7f174a8..9be3a70 100644 --- a/src/HEXABLOCK_SWIG/hexablock_swig.py +++ b/src/HEXABLOCK_SWIG/hexablock_swig.py @@ -526,6 +526,15 @@ Q_DIRECT = _hexablock_swig.Q_DIRECT Q_INVERSE = _hexablock_swig.Q_INVERSE Q_UNDEFINED = _hexablock_swig.Q_UNDEFINED Q_WAITING = _hexablock_swig.Q_WAITING +KS_None = _hexablock_swig.KS_None +KS_Line = _hexablock_swig.KS_Line +KS_Circle = _hexablock_swig.KS_Circle +KS_Ellipse = _hexablock_swig.KS_Ellipse +KS_Hyperbola = _hexablock_swig.KS_Hyperbola +KS_Parabola = _hexablock_swig.KS_Parabola +KS_BezierCurve = _hexablock_swig.KS_BezierCurve +KS_BSplineCurve = _hexablock_swig.KS_BSplineCurve +KS_OtherCurve = _hexablock_swig.KS_OtherCurve CylSmall = _hexablock_swig.CylSmall CylBig = _hexablock_swig.CylBig NxInt = _hexablock_swig.NxInt diff --git a/src/HEXABLOCK_SWIG/hexablock_swig_wrap.cc b/src/HEXABLOCK_SWIG/hexablock_swig_wrap.cc index 9c10fbe..5b9833e 100644 --- a/src/HEXABLOCK_SWIG/hexablock_swig_wrap.cc +++ b/src/HEXABLOCK_SWIG/hexablock_swig_wrap.cc @@ -32686,6 +32686,15 @@ SWIGEXPORT void SWIG_init(void) { SWIG_Python_SetConstant(d, "Q_INVERSE",SWIG_From_int(static_cast< int >(Hex::Q_INVERSE))); SWIG_Python_SetConstant(d, "Q_UNDEFINED",SWIG_From_int(static_cast< int >(Hex::Q_UNDEFINED))); SWIG_Python_SetConstant(d, "Q_WAITING",SWIG_From_int(static_cast< int >(Hex::Q_WAITING))); + SWIG_Python_SetConstant(d, "KS_None",SWIG_From_int(static_cast< int >(Hex::KS_None))); + SWIG_Python_SetConstant(d, "KS_Line",SWIG_From_int(static_cast< int >(Hex::KS_Line))); + SWIG_Python_SetConstant(d, "KS_Circle",SWIG_From_int(static_cast< int >(Hex::KS_Circle))); + SWIG_Python_SetConstant(d, "KS_Ellipse",SWIG_From_int(static_cast< int >(Hex::KS_Ellipse))); + SWIG_Python_SetConstant(d, "KS_Hyperbola",SWIG_From_int(static_cast< int >(Hex::KS_Hyperbola))); + SWIG_Python_SetConstant(d, "KS_Parabola",SWIG_From_int(static_cast< int >(Hex::KS_Parabola))); + SWIG_Python_SetConstant(d, "KS_BezierCurve",SWIG_From_int(static_cast< int >(Hex::KS_BezierCurve))); + SWIG_Python_SetConstant(d, "KS_BSplineCurve",SWIG_From_int(static_cast< int >(Hex::KS_BSplineCurve))); + SWIG_Python_SetConstant(d, "KS_OtherCurve",SWIG_From_int(static_cast< int >(Hex::KS_OtherCurve))); SWIG_Python_SetConstant(d, "CylSmall",SWIG_From_int(static_cast< int >(Hex::CylSmall))); SWIG_Python_SetConstant(d, "CylBig",SWIG_From_int(static_cast< int >(Hex::CylBig))); SWIG_Python_SetConstant(d, "NxInt",SWIG_From_int(static_cast< int >(Hex::NxInt))); diff --git a/src/TEST_CPP/test_hexa1.cxx b/src/TEST_CPP/test_hexa1.cxx index 913a791..1d00f93 100755 --- a/src/TEST_CPP/test_hexa1.cxx +++ b/src/TEST_CPP/test_hexa1.cxx @@ -1,31 +1,30 @@ // C++ : Tests unitaires -// Copyright (C) 2009-2013 CEA/DEN, EDF R&D +// Copyright (C) 2009-2011 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. +// 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. // -// 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. +// 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 +// 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 "test_unit.hxx" #include "Hex.hxx" #include "HexDocument.hxx" #include "HexElements.hxx" -#include "HexCrossElements.hxx" #include "HexHexa.hxx" #include "HexQuad.hxx" @@ -103,12 +102,10 @@ int test_sphere (int nbargs, cpchar tabargs[]) { Hex::Hex mon_ex; Hex::Document* doc = mon_ex.addDocument (); - Hex::Vertex* orig = doc->addVertex (0,0,0); int ncouches = 2; double k = 1; - double rayon = 1; - Hex::Elements* sphere = doc->makeSpherical (orig, rayon, ncouches, k); + Hex::Elements* sphere = doc->makeSphericalTop (ncouches, k); if (ncouches>0) { @@ -135,10 +132,8 @@ int test_cartesi1 () Hex::Hex mon_ex; Hex::Document* doc = mon_ex.addDocument (); - Hex::Vertex* orig = doc->addVertex (0,0,0); - Hex::Vector* dir = doc->addVector (1,1,1); - Hex::Elements* grid = doc->makeCartesian (orig, dir, size_x,size_y,size_z); + Hex::Elements* grid = doc->makeCartesianTop (size_x,size_y,size_z); // print_propagations (doc); @@ -180,9 +175,7 @@ int test_find () Hex::Hex mon_ex; Hex::Document* doc = mon_ex.addDocument (); - Hex::Vertex* orig = doc->addVertex (0,0,0); - Hex::Vector* dir = doc->addVector (1,1,1); - Hex::Elements* grid = doc->makeCartesian (orig, dir, size_x,size_y,size_z); + Hex::Elements* grid = doc->makeCartesianTop (size_x,size_y,size_z); grid->saveVtk ("mini1.vtk"); doc->dump (); @@ -224,15 +217,12 @@ int test_joint (int nbargs, cpchar tabargs[]) Hex::Hex mon_ex; Hex::Document* doc = mon_ex.addDocument (); - Hex::Vertex* orig1 = doc->addVertex (0,0,0); - Hex::Vector* dir = doc->addVector (1,1,1); - - Hex::Elements* grid1 = doc->makeCartesian (orig1, dir, dimx,dimy,dimz); + Hex::Elements* grid1 = doc->makeCartesianTop (dimx,dimy,dimz); Hex::Vertex* orig2 = doc->addVertex (dimx/2.0,0,8); Hex::Vector* vectj = doc->addVector (0,1,0); Hex::Vector* vecti = doc->addVector (1,0,0); - Hex::Elements* grid2 = doc->makeCylindrical (orig2, vecti, vectj, + Hex::Elements* grid2 = doc->makeCylinderUni (orig2, vecti, vectj, 1, 180, 1, dimz,dimy,dimx, true); int mx = dimx/2; @@ -264,7 +254,7 @@ int test_joint (int nbargs, cpchar tabargs[]) doc->saveVtk ("joint1.vtk"); const int hauteur = 5; - Hex::Elements* joint = doc->joinQuads(liste, cible, v1,v2,v3,v4, hauteur); + Hex::Elements* joint = doc->joinQuadsUni(liste,cible, v1,v2,v3,v4, hauteur); // for (int nh=0 ; nhgetHexa(nh)->setScalar (5); int nbr_joint_vertex = joint->countVertex (); @@ -285,298 +275,17 @@ int test_joint (int nbargs, cpchar tabargs[]) doc->saveVtk ("joint2.vtk"); return HOK; } -// ======================================================== test_prism -int test_prism (int nbargs, cpchar tabargs[]) -{ - const int dimx = 11; - const int dimy = 11; - const int dimz = 2; - - Hex::Hex mon_ex; - Hex::Document* doc = mon_ex.addDocument (); - - Hex::Vertex* orig1 = doc->addVertex ( 0,0,0); - Hex::Vector* dir1 = doc->addVector ( 1,1,1); - Hex::Vector* dir2 = doc->addVector ( 1,1,-1); - - Hex::Elements* grid1 = doc->makeCartesian (orig1, dir1, dimx,dimy,dimz); - - int mx = dimx/2; - int my = dimy/2; - Hex::Quads liste1, liste2; - - liste1.push_back (grid1->getQuadIJ (mx, my, dimz)); - liste2.push_back (grid1->getQuadIJ (mx, my, 0)); - for (int nx=0; nxgetQuadIJ (nx, my, dimz)); - liste2.push_back (grid1->getQuadIJ (nx, my, 0)); - } - - for (int ny=0; nygetQuadIJ (mx, ny, dimz)); - liste2.push_back (grid1->getQuadIJ (mx, ny, 0)); - } - - Hex::RealVector tlen; - double dh = 2; - for (int nro=0; nro<5; nro++) - { - dh = 2*dh + 1; - tlen.push_back (dh); - } - - const int nbiter = 5; - doc->saveVtk ("prisme1.vtk"); - Hex::Elements* prisme2 = doc->prismQuads (liste2, dir2, nbiter); - doc->saveVtk ("prisme2.vtk"); - - Hex::Elements* prisme1 = doc->prismQuadsVec (liste1, dir1, tlen, 0); - - PutData (liste1.size()); - PutData (tlen.size()); - PutData (prisme1->countHexa()); - PutData (prisme1->countQuad()); - PutData (prisme1->countEdge()); - PutData (prisme1->countVertex()); - - for (int nro=0 ; nro getHexa (nbiter+nro); - cell->setScalar (5); - } - - doc->saveVtk ("prisme3.vtk"); - return HOK; -} -// ======================================================== test_revolution9 -int test_revolution9 (int nbargs, cpchar tabargs[]) -{ - const int dimx = 11; - const int dimy = 11; - const int dimz = 2; - - Hex::Hex mon_ex; - Hex::Document* doc = mon_ex.addDocument (); - - Hex::Vertex* orig1 = doc->addVertex (0,0,0); - Hex::Vector* dir = doc->addVector (1,1,1); - - Hex::Elements* grid1 = doc->makeCartesian (orig1, dir, dimx,dimy,dimz); - - int mx = dimx/2; - int my = dimy/2; - Hex::Quad* prems = grid1->getQuadIJ (mx, my, dimz); - Hex::Quads liste; - - liste.push_back (prems); - prems -> setScalar (5); - for (int nx=0; nxgetQuadIJ (nx, my, dimz); - liste.push_back (cell); - cell -> setScalar (5); - } - - for (int ny=0; nygetQuadIJ (mx, ny, dimz); - liste.push_back (cell); - cell -> setScalar (5); - } - - Hex::Vertex* center = doc->addVertex (0, -10, 0); - Hex::Vector* axis = doc->addVector (1, 0, 0); - Hex::RealVector angles; - - Hex::Vector* dir1 = doc->addVector (10,0.3,0.3); - Hex::Elements* grid2 = doc->makeCartesian (center, dir1, 1,1,1); - Hex::Hexa* cell = grid2->getHexaIJK (0,0,0); - cell->setScalar (5); - - doc->saveVtk ("revolution1.vtk"); - - double alpha = 5; - int niter = 5; - double coeff = 1.5; - for (int na=0 ; narevolutionQuads (liste, center, axis, angles); - if (bloc != NULL) - doc->saveVtk ("revolution2.vtk"); - - return HOK; -} -// ======================================================== test_revolution -int test_revolution (int nbargs, cpchar tabargs[]) -{ - Hex::Hex mon_ex; - Hex::Document* doc = mon_ex.addDocument (); - - Hex::Vertex* ori = doc->addVertex (0,0,0); - Hex::Vector* vx = doc->addVector (1,0,0); - Hex::Vector* vz = doc->addVector (0,0,1); - - int dr = 1; - int da = 360; - int dl = 1; - - int nr = 1; - int na = 6; - int nl = 1; - - Hex::Elements* grid = doc->makeCylindrical (ori, vx,vz, dr,da,dl, - nr,na,nl, false); - - Hex::Quads liste; - for (int nx=0; nxgetQuadIJ (nx, ny, nl); - liste.push_back (cell); - cell -> setScalar (5); - } - - Hex::Vertex* center = doc->addVertex (0, -10, 0); - Hex::Vector* axis = doc->addVector (1, 0, 0); - Hex::RealVector angles; - - Hex::Vector* dir1 = doc->addVector (10,0.3,0.3); - Hex::Elements* grid2 = doc->makeCartesian (center, dir1, 1,1,1); - Hex::Hexa* cell = grid2->getHexaIJK (0,0,0); - cell->setScalar (5); - - doc->saveVtk ("revolution1.vtk"); - - double alpha = 5; - int niter = 5; - double coeff = 1.5; - for (int na=0 ; narevolutionQuads (liste, center, axis, angles); - if (bloc != NULL) - doc->saveVtk ("revolution2.vtk"); - - return HOK; -} -// ======================================================== test_coude -int test_coude (int nbargs, cpchar tabargs[]) -{ -#if 0 - const int dimx = 11; - const int dimy = 11; - const int dimz = 2; - - Hex::Hex mon_ex; - Hex::Document* doc = mon_ex.addDocument (); - - Hex::Vertex* orig = doc->addVertex (0,0,0); - Hex::Vector* vx = doc->addVector (1,0,0); - Hex::Vector* vz = doc->addVector (0,0,1); - - // grid1 = doc->makeCartesian (orig1, dir, dimx,dimy,dimz); - double dr = 1; - int dl = 5; - int nr = 4; - int na = 8; - - Hex::Elements* grid1 = doc->makeCylindrical (orig1, vx,vz,dr,360, dl, - nr, 10, nl, false); - int mx = dimx/2; - int my = dimy/2; - Hex::Quad* prems = grid1->getQuadIJ (mx, my, dimz); - Hex::Quads liste; - - liste.push_back (prems); - prems -> setScalar (5); - for (int nx=0; nxgetQuadIJ (nx, my, dimz); - liste.push_back (cell); - cell -> setScalar (5); - } - - for (int ny=0; nygetQuadIJ (mx, ny, dimz); - liste.push_back (cell); - cell -> setScalar (5); - } - - - Hex::Vertex* center = doc->addVertex (0, -10, 0); - Hex::Vector* axis = doc->addVector (1, 0, 0); - Hex::RealVector angles; - - Hex::Vector* dir1 = doc->addVector (10,0.3,0.3); - Hex::Elements* grid2 = doc->makeCartesian (center, dir1, 1,1,1); - Hex::Hexa* cell = grid2->getHexaIJK (0,0,0); - cell->setScalar (5); - - doc->saveVtk ("revolution1.vtk"); - - double alpha = 5; - int niter = 5; - double coeff = 1.5; - for (int na=0 ; narevolutionQuads (liste, center, axis, angles); - if (bloc != NULL) - doc->saveVtk ("revolution2.vtk"); -#endif - return HOK; -} // ======================================================== test_count int test_count (int nbargs, cpchar tabargs[]) { Hex::Hex mon_ex; Hex::Document* doc = mon_ex.addDocument (); - Hex::Vertex* orig1 = doc->addVertex ( 0, 0,0); - Hex::Vector* vx = doc->addVector (1,0,0); - Hex::Vector* vz = doc->addVector (0,0,1); - - double dr = 1; - double dl = 1; int nr = 2; int nl = 3; // Hex::Elements* c1 = - doc->makeCylindrical (orig1, vx,vz,dr, 360, dl,nr, 10, nl, false); + doc->makeCylinderTop (nr, 10, nl); HexDisplay (doc->countVertex ()); HexDisplay (doc->countUsedVertex ()); @@ -594,16 +303,13 @@ int test_decoupage (int nbargs, cpchar tabargs[]) Hex::Hex mon_ex; Hex::Document* doc = mon_ex.addDocument (); - Hex::Vertex* orig = doc->addVertex (0,0,0); - Hex::Vector* dir = doc->addVector (1,1,1); - - Hex::Elements* grid = doc->makeCartesian (orig, dir, size_x,size_y,size_z); + Hex::Elements* grid = doc->makeCartesianTop (size_x,size_y,size_z); Hex::Edge* arete = grid->getEdgeK (0, 0, 0); // doc ->dump (); int nvtk=0; doc ->saveVtk ("decoupe", nvtk); -/* Hex::Elements* grid2 = */ doc->cut (arete, 1); +/* Hex::Elements* grid2 = */ doc->cutUni (arete, 1); /// doc ->dump (); doc ->saveVtk ("decoupe", nvtk); @@ -620,10 +326,8 @@ int test_gen_xml (int nbargs, cpchar tabargs[]) Hex::Hex mon_ex; Hex::Document* doc = mon_ex.addDocument (); - Hex::Vertex* orig = doc->addVertex (0,0,0); - Hex::Vector* dir = doc->addVector (1,1,1); // Hex::Elements* grid = - doc->makeCartesian (orig, dir, size_x,size_y,size_z); + doc->makeCartesianTop (size_x,size_y,size_z); // Hex::Hexa* cell = grid->getHexa (0); // Hex::Quad* face = cell->getQuad (0); @@ -673,23 +377,8 @@ int test_string_xml (int nbargs, cpchar tabargs[]) Hex::Hex mon_ex; Hex::Document* doc = mon_ex.addDocument (); - Hex::Vertex* orig = doc->addVertex (0,0,0); - Hex::Vector* dir = doc->addVector (1,1,1); // Hex::Elements* grid = - doc->makeCartesian (orig, dir, size_x,size_y,size_z); - - // Hex::Hexa* cell = grid->getHexa (0); - // Hex::Quad* face = cell->getQuad (0); - // Hex::Edge* arete = cell->getEdge (0); - // Hex::Vertex* noeud = cell->getVertex (0); - - // Hex::Shape* shape1 = new Hex::Shape("riri"); - // Hex::Shape* shape2 = new Hex::Shape("fifi"); - // Hex::Shape* shape3 = new Hex::Shape("loulou"); - - // noeud->setAssociation (shape1); - // arete->setAssociation (shape2); - // face ->setAssociation (shape3); + doc->makeCartesianTop (size_x,size_y,size_z); Hex::Law* law1 = doc->addLaw("loi1", 1); Hex::Law* law2 = doc->addLaw("loi2", 2); @@ -762,10 +451,7 @@ int test_clone () Hex::Hex mon_ex; Hex::Document* doc = mon_ex.addDocument (); - Hex::Vertex* orig = doc->addVertex (0,0,0); - Hex::Vector* dir = doc->addVector (1,1,1); - Hex::Elements* grid = doc->makeCartesian (orig, dir, size_x,size_y,size_z); - + Hex::Elements* grid = doc->makeCartesianTop (size_x,size_y,size_z); Hex::Vector* bond = doc->addVector (0, 0, 7); Hex::Elements* grid2 = doc->makeTranslation (grid, bond); @@ -788,10 +474,7 @@ int test_separ () Hex::Hex mon_ex; Hex::Document* doc = mon_ex.addDocument (); - Hex::Vertex* orig = doc->addVertex (0,0,0); - Hex::Vector* dir = doc->addVector (1,1,1); - // Hex::Elements* grid = - doc->makeCartesian (orig, dir, size_x,size_y,size_z); + doc->makeCartesianTop (size_x,size_y,size_z); doc ->saveVtk ("separ.vtk"); doc ->dump(); @@ -804,11 +487,9 @@ int test_spherical (int nbargs, const char* tabargs[]) Hex::Hex mon_ex; Hex::Document* doc = mon_ex.addDocument (); - Hex::Vertex* orig = doc->addVertex (0,0,0); - double rayon = 1; int nbr = 3; - Hex::Elements* grid = doc->makeSpherical (orig, rayon, nbr, 1); + Hex::Elements* grid = doc->makeSphericalTop (nbr, 1); int nbhexas = grid->countHexa (); HexDisplay (nbhexas); @@ -838,18 +519,19 @@ int test_grille_cyl (int nbargs, cpchar tabargs[]) Hex::Vector* vz = doc->addVector (0,0,1); Hex::Vector* vx = doc->addVector (1,0,0); - double dr = 1; + double rint = 5; + double rext = 1; double dl = 1; int nr = 2; int nl = 3; - doc->makeCylindrical (orig1, vx,vz,dr, 360, dl,nr, 4, nl, true); + doc->makeCylinderUni (orig1, vx,vz, rint,rext, 360,dl,nr, 4, nl); Hex::Elements* c2 = - doc->makeCylindrical (orig2, vx,vz,dr, 360, dl,nr, 8, nl, true); - doc->makeCylindrical (orig3, vx,vz,dr, 270, dl,nr, 8, nl, true); - doc->makeCylindrical (orig4, vx,vz,dr, 270, dl,nr, 7, nl, true); - doc->makeCylindrical (orig5, vx,vz,dr, 360, dl,nr, 5, nl, true); - doc->makeCylindrical (orig6, vx,vz,dr, 360, dl,nr, 6, nl, true); + doc->makeCylinderUni (orig2, vx,vz, rint,rext, 360,dl,nr, 8, nl); + doc->makeCylinderUni (orig3, vx,vz, rint,rext, 270,dl,nr, 8, nl); + doc->makeCylinderUni (orig4, vx,vz, rint,rext, 270,dl,nr, 7, nl); + doc->makeCylinderUni (orig5, vx,vz, rint,rext, 360,dl,nr, 5, nl); + doc->makeCylinderUni (orig6, vx,vz, rint,rext, 360,dl,nr, 6, nl); int base2 = nr*nl*8; c2->getHexa(base2 + 0)->setScalar (5); @@ -873,7 +555,6 @@ int test_cylindrical (int nbargs, cpchar tabargs[]) Hex::Vector* vx = doc->addVector (1, 0, 0); Hex::Vector* vz = doc->addVector (0, 0, 1); - double dr = 1; double da = 360; double dl = 1; @@ -895,133 +576,10 @@ int test_cylindrical (int nbargs, cpchar tabargs[]) HexDisplay (da); } - // Hex::Cylinder* cyl = doc->addCylinder (orig, vz, nr, nl); - // Hex::Elements* grid = doc->makeCylinder (cyl, vx, nr, na, nl); - doc->makeCylindrical (orig,vx, vz, dr,da,dl, nr,na, nl, true); + doc->makeCylinderUni (orig,vx, vz, 5.0,1.0,da,dl, nr,na, nl); doc->saveVtk (fic_vtk, na); return HOK; } -// ===================================================== test_cylinder -int test_cylinder (int nbargs, cpchar tabargs[]) -{ - int nvtk = 1; - cpchar fic_vtk = "cylindre"; - - Hex::Hex mon_ex; - Hex::Document* doc = mon_ex.addDocument (); - - Hex::Vertex* orig = doc->addVertex (0, 0, 0); - Hex::Vector* vx = doc->addVector (1, 0, 0); - Hex::Vector* vz = doc->addVector (0, 0, 1); - - double rayon = 10; - double hauteur = 6; - - int nr = 2; - int na = 8; - int nl = 5; - - Hex::Cylinder* cyl = doc->addCylinder (orig, vz, rayon, hauteur); - doc->makeCylinder (cyl, vx, nr, na, nl); - doc ->saveVtk (fic_vtk, nvtk); - return HOK; -} -// ===================================================== test_xml_cylinder -int test_xml_cylinder (int nbargs, cpchar tabargs[]) -{ - int nvtk = 0; - cpchar fic_vtk = "cylindre"; - - Hex::Hex mon_ex; - Hex::Document* doc = mon_ex.addDocument (); - - Hex::Vertex* orig1 = doc->addVertex (0, 0,0); - Hex::Vertex* orig2 = doc->addVertex (50,0,0); - Hex::Vector* vz = doc->addVector (0,0,1); - Hex::Vector* vx = doc->addVector (1,0,0); - - vx->setName ("vx"); - vz->setName ("vz"); - orig1->setName ("orig1"); - orig2->setName ("orig2"); - - int nr = 4; - int nri = 3; - int nre = nr; - int na = 9; - int nl = 5; - - Hex::Cylinder* cyl = doc->addCylinder (orig1, vz, nr, nl); - Hex::Pipe* pipe = doc->addPipe (orig2, vz, nri, nre, nl); - - Hex::Elements* grid = doc->makeCylinder (cyl, vx, nr, na, nl); - doc ->saveVtk (fic_vtk, nvtk); - - Hex::Group* groupe = doc->addGroup ("GroupeAMA", Hex::HexaCell); - groupe->addElement (grid->getHexaIJK (0,0,0)); - groupe->addElement (grid->getHexaIJK (1,0,0)); - groupe->addElement (grid->getHexaIJK (0,1,0)); - groupe->addElement (grid->getHexaIJK (1,1,0)); - groupe->addElement (grid->getHexaIJK (2,1,0)); - - grid->getHexaIJK (0,0,0)->setName ("Hexa0"); - grid->getQuadIJ (0,0,0)->setName ("QuadIJ0"); - grid->getEdgeK (0,0,0)->setName ("EdgeK0"); - - doc->makePipe (pipe, vx, nr, na, nl); - doc ->saveVtk (fic_vtk, nvtk); - doc->save ("cylindre"); - - return HOK; -} -// ===================================================== test_pipe -int test_pipe (int nbargs, cpchar tabargs[]) -{ - int nvtk = 0; - cpchar fic_vtk = "cylindre"; - - Hex::Hex mon_ex; - Hex::Document* doc = mon_ex.addDocument (); - - Hex::Vertex* orig1 = doc->addVertex (0, 0,0); - Hex::Vector* vx = doc->addVector (1,0,0); - Hex::Vector* vy = doc->addVector (0,1,0); - - int nr = 1; - int nri = 1; - int nre = 2; - int na = 2; - int nl = 1; - - Hex::Pipe* pipe = doc->addPipe (orig1, vx, nri, nre, nl); - doc->makePipe (pipe, vy, nr, na, nl); - doc ->saveVtk (fic_vtk, nvtk); - - return HOK; -} -// ======================================================== del_hexa -void del_hexa (Hex::CrossElements* gr, int cyl, int ni, int nj, int nk, int dr) -{ - Hex::Hexa* hexa = gr->getHexaIJK (cyl, ni, nj, nk); - if (hexa!=NULL) - { - hexa->remove (); - if (dr>1) - save_vtk (); - } -} -// ======================================================== del_tranche -int del_tranche (Hex::CrossElements* grid, int cyl, int ni, int nk, int dr=1) -{ - for (int nj = 0 ; nj < 8 ; nj++) - del_hexa (grid, cyl, ni, nj, nk, dr); - - if (dr==1) - save_vtk (); - printf ("del_tranche (g=%d, i=%d, k=%d) : fic = %d\n", - cyl, ni, nk, nbr_vtk-1); - return nbr_vtk; -} // ======================================================== test_joint2 int test_joint2 (int nbargs, cpchar tabargs[]) { @@ -1034,21 +592,19 @@ int test_joint2 (int nbargs, cpchar tabargs[]) Hex::Vertex* hori = docu->addVertex (0, 0, 0); double da = 360; - double dr = 2; double dl = 1; int nr = 1; int na = 8; int nl = 1; - bool fill = true; Hex::Elements *bgrid=NULL, *hgrid=NULL; - hgrid = docu->makeCylindrical (hori, vx,vz, dr,da,dl, nr,na,nl, fill); + hgrid = docu->makeCylinderUni (hori, vx,vz, 5.0,1.0,da,dl, nr,na,nl); docu->dump (); save_vtk (); Hex::Vertex* bori = docu->addVertex (0, 0, -5); - bgrid = docu->makeCylindrical (bori, vx,vz, dr,da,dl, nr,na,nl, fill); + bgrid = docu->makeCylinderUni (bori, vx,vz, 5.0,1.0,da,dl, nr,na,nl); save_vtk (); Hex::Quads qsource, qdest; @@ -1092,238 +648,9 @@ int test_joint2 (int nbargs, cpchar tabargs[]) Hex::Vertex* vs1 = hgrid->getVertexIJK (0, 0, 0); Hex::Vertex* vs2 = hgrid->getVertexIJK (1, 0, 0); - docu->joinQuads (qsource, cible, vs1, vc1, vs2, vc2, 1); - save_vtk (); - - return HOK; -} -// ======================================================== test_croix -int test_croix (int nbargs, cpchar tabargs[]) -{ - Hex::Hex mon_ex; - case_name = "croix"; - docu = mon_ex.addDocument (case_name); - - Hex::Vertex* ori1 = docu->addVertex ( 0,0,0); - Hex::Vertex* ori2 = docu->addVertex (-5,0,5); - Hex::Vector* vz = docu->addVector ( 0,0,1); - Hex::Vector* vx = docu->addVector ( 1,0,0); - - double r1 = 2; - double r2 = 3; - double l1 = 10; - double l2 = 10; - - Hex::Cylinder* cyl1 = docu->addCylinder (ori1, vz, r1, l1); - Hex::Cylinder* cyl2 = docu->addCylinder (ori2, vx, r2, l2); - Hex::CrossElements* grid = docu->makeCylinders (cyl1, cyl2); - - save_vtk (); - PutData ((BadElement (grid))); - - - Hex::Edge* pipo = docu->addEdge (ori1, ori1); - PutData (pipo->isValid()); - PutData ((BadElement (pipo))); - return HOK; - - del_tranche (grid, 0, 1, 0); - del_tranche (grid, 0, 1, 5); - - del_tranche (grid, 1, 1, 0); - del_tranche (grid, 1, 1, 3); - - del_tranche (grid, 1, 0, 0); - del_tranche (grid, 1, 0, 3); - // Le trognon - del_tranche (grid, 0, 0, 0); - del_tranche (grid, 0, 0, 5); - del_tranche (grid, 0, 0, 1); - del_tranche (grid, 0, 0, 2); - del_tranche (grid, 0, 0, 3); - del_tranche (grid, 0, 0, 4); - // Partie critique - - del_tranche (grid, 1, 1, 1, 2); - - del_tranche (grid, 0, 1, 1, 2); - del_tranche (grid, 0, 1, 4, 2); - del_tranche (grid, 0, 1, 3, 2); - del_tranche (grid, 0, 1, 2, 2); - - del_tranche (grid, 1, 1, 2, 2); - return HOK; -} -// ======================================================== test_croix2 -int test_croix2 (int nbargs, cpchar tabargs[]) -{ - Hex::Hex mon_ex; - case_name = "croix"; - docu = mon_ex.addDocument (case_name); - - Hex::Vertex* pt1 = docu->addVertex ( 0,0,0); - Hex::Vertex* pt2 = docu->addVertex (10,0,0); - - Hex::Vector* dx = docu->addVector ( 1,0,0); - Hex::Vector* dy = docu->addVector ( 0,1,0); - Hex::Vector* dz = docu->addVector ( 0,0,1); - - double r1 = 4; - double r2 = 2; - double l1 = 20; - double l2 = 15; - - Hex::Cylinder* cyl1 = docu->addCylinder (pt1, dx, r1, l1); - Hex::Cylinder* cyl2 = docu->addCylinder (pt2, dz, r2, l2); - - int nr = 3; - int na = 8; - int nl = 2; - Hex::Elements* grid1 = docu->makeCylinder (cyl1, dy, nr, na, nl); - grid1->saveVtk ("cyl_big.vtk"); - Hex::Elements* grid2 = docu->makeCylinder (cyl2, dy, nr, na, nl); - grid2->saveVtk ("cyl_small.vtk"); - - PutData ((BadElement (grid1))); - PutData ((BadElement (grid2))); - - Hex::CrossElements* grid = docu->makeCylinders (cyl1, cyl2); - - grid->saveVtk ("cyl_all.vtk"); - return HOK; -} -// ======================================================== test_pipes -int test_pipes (int nbargs, cpchar tabargs[]) -{ - Hex::Hex mon_ex; - Hex::Document* doc = mon_ex.addDocument (); - - Hex::Vertex* ori1 = doc->addVertex ( 0,0,0); - Hex::Vertex* ori2 = doc->addVertex (-5,0,5); - Hex::Vector* vz = doc->addVector ( 0,0,1); - Hex::Vector* vx = doc->addVector ( 1,0,0); - -// double h1 = 5, ri1 = 1, re1 = 2; - double h1 = 10, ri1 = 1, re1 = 2; - double h2 = 10, ri2 = 2, re2 = 3; - - Hex::Pipe* pipe1 = doc->addPipe (ori1, vz, ri1, re1, h1); - Hex::Pipe* pipe2 = doc->addPipe (ori2, vx, ri2, re2, h2); - Hex::CrossElements* grid = doc->makePipes (pipe1, pipe2); - - case_name = "pipe"; - docu = doc; + docu->joinQuadsUni (qsource, cible, vs1, vc1, vs2, vc2, 1); save_vtk (); - del_tranche (grid, 0, 1, 0); - del_tranche (grid, 0, 1, 5); - - del_tranche (grid, 1, 1, 0); - del_tranche (grid, 1, 1, 3); - // Partie critique - - del_tranche (grid, 1, 1, 1, 2); - - del_tranche (grid, 0, 1, 1, 2); - del_tranche (grid, 0, 1, 4, 2); - del_tranche (grid, 0, 1, 3, 2); - del_tranche (grid, 0, 1, 2, 2); - - del_tranche (grid, 1, 1, 2, 2); - /* *************************************************** - - int nbz [2] = { 8, 4 }; - int ni = 1; - for (int cyl = 0 ; cyl < 2 ; cyl++) - for (int nk = 0 ; nk < nbz[cyl] ; nk++) - for (int nj = 0 ; nj < 4 ; nj++) - { - int jj = nj; - if (cyl==0) jj = (jj+6) MODULO 8 ; - Hex::Hexa* hexa = grid->getHexaIJK (cyl, ni, jj, nk); - if (hexa!=NULL) - { - hexa->remove (); - doc->saveVtk (case_name, nbr_vtk); - } - } - *************************************************** */ - return HOK; -} -// ======================================================== test_lorraine -int test_lorraine(int nbargs, cpchar tabargs[]) -{ - Hex::Hex mon_ex; - Hex::Document* doc = mon_ex.addDocument (); - - Hex::Vertex* ori1 = doc->addVertex ( 0,0,0); - Hex::Vertex* ori2 = doc->addVertex (-5,0,5); - Hex::Vertex* ori3 = doc->addVertex ( 0,0,12); - Hex::Vertex* ori4 = doc->addVertex (-5,0,17); - - Hex::Vector* vz = doc->addVector ( 0,0,1); - Hex::Vector* vx = doc->addVector ( 1,0,0); - - int nl1 = 10; - int nl2 = 10; - - double rsmall = 1; - double rmoy = 2; - double rbig = 3; - - Hex::Cylinder* cyl1 = doc->addCylinder (ori1, vz, rmoy, nl1); - Hex::Cylinder* cyl2 = doc->addCylinder (ori2, vx, rsmall, nl2); - - Hex::Cylinder* cyl3 = doc->addCylinder (ori3, vz, rmoy, nl1); - Hex::Cylinder* cyl4 = doc->addCylinder (ori4, vx, rbig, nl2); - - Hex::CrossElements* grid1 = doc->makeCylinders (cyl1, cyl2); - Hex::CrossElements* grid2 = doc->makeCylinders (cyl4, cyl3); - -#define Imprimer(x) printf (#x " = ") ; if (x) x->dump() ; else printf ("NULL\n") - const int nx_int = 0; - const int nx_ext = 1; - - // vc2 = grid1->getVertexIJK (Hex::CylBig, 0,0,0); - // vc3 = grid2->getVertexIJK (Hex::CylSmall, 0,0,0); - // Cyl i j k - Hex::Quad* qb = grid1-> getQuadIJ (Hex::CylBig, nx_ext, Hex::S_E, 4); - Hex::Quad* qh = grid2-> getQuadIJ (Hex::CylSmall, nx_ext, Hex::S_N, 0); - - Hex::Vertex* vb0 = qb->getVertex (3); - Hex::Vertex* vb1 = qb->getVertex (2); - Hex::Vertex* vh0 = qh->getVertex (0); - Hex::Vertex* vh1 = qh->getVertex (1); - - vb0 = grid1->getVertexIJK (Hex::CylBig, 2, Hex::S_E, 4); // cible - vb1 = grid1->getVertexIJK (Hex::CylBig, 2, Hex::S_NE, 4); - vh0 = grid2->getVertexIJK (Hex::CylSmall, 2, Hex::S_N, 0); // depart - vh1 = grid2->getVertexIJK (Hex::CylSmall, 2, Hex::S_NW, 0); - - Imprimer (vh0); - Imprimer (vh1); - Imprimer (vb0); - Imprimer (vb1); - - // qb->remove (); - // qh->remove (); - Hex::Quads hliste; - - hliste.push_back (qh); - for (int ny=1; nygetQuadIJ (Hex::CylSmall, nx_ext, ns, 0)); - } - - for (int ny=0; ny<4 ; ny++) - hliste.push_back (grid2->getQuadIJ (Hex::CylSmall, nx_int, ny, 0)); - - int hauteur = 3; - doc->joinQuads (hliste, qb, vh0, vb0, vh1, vb1, hauteur); - doc->saveVtk ("lorraine.vtk"); - - // doc->dump (); return HOK; } // ======================================================== test_disconnect2 @@ -1335,25 +662,17 @@ int test_disconnect2 (int nbargs, cpchar tabargs[]) const int size_z = 1; Hex::Hex mon_ex; - Hex::Document* doc = mon_ex.addDocument (); - - Hex::Vertex* orig2 = doc->addVertex (0,0,0); - Hex::Vector* dir = doc->addVector (1,1,1); - Hex::Elements* grid2 = doc->makeCartesian (orig2, dir, size_x,size_y,size_z); - - doc->dump (); + Hex::Document* doc = mon_ex.addDocument (); + Hex::Elements* grid2 = doc->makeCartesianTop (size_x,size_y,size_z); int nvtk = 0; doc->setLevel (1); - Hex::Matrix matrice; - Hex::Vector* ecart = doc->addVector (0.5,0.5,0); - matrice.defTranslation (ecart); Hex::Hexa* hexa2 = grid2->getHexaIJK (1,1,0); Hex::Edge* edge = grid2->getEdgeK (1,2,0); - hexa2->setScalar (2); - edge->setScalar (5); + hexa2->setColor (2); + edge->setColor (5); doc->saveVtk ("test_disco", nvtk); @@ -1365,22 +684,12 @@ int test_disconnect2 (int nbargs, cpchar tabargs[]) HexDisplay (disco_edges->countQuad()); HexDisplay (disco_edges->countHexa()); - // hexa2->transform (&matrice); - /********************************** - for (int ns=0; nscountVertex(); ns++) - { - Hex::Vertex* sommet = disco_edges->getVertex(ns); - sommet->setX (sommet->getX()+0.5); - sommet->setY (sommet->getY()+0.5); - } - ********************************* */ - doc->saveVtk ("test_disco", nvtk); doc->save ("test_disco"); - doc->dump (); - hexa2->dumpFull (); + // doc->dump (); + // hexa2->dumpFull (); - doc->setLevel (4); + // doc->setLevel (4); return HOK; } // ======================================================== test_disconnect4 @@ -1394,11 +703,7 @@ int test_disconnect4 (int nbargs, cpchar tabargs[]) Hex::Hex mon_ex; Hex::Document* doc = mon_ex.addDocument (); - Hex::Vertex* orig2 = doc->addVertex (0,0,0); - Hex::Vector* vx = doc->addVector (1,0,0); - Hex::Vector* vy = doc->addVector (0,1,0); - Hex::Vector* vz = doc->addVector (0,0,1); - Hex::Elements* grid2 = doc->makeCartesian (orig2, vx,vy,vz, size_x,size_y,size_z); + Hex::Elements* grid2 = doc->makeCartesianTop (size_x,size_y,size_z); int nvtk = 0; doc->setLevel (1); @@ -1428,7 +733,7 @@ int test_disconnect4 (int nbargs, cpchar tabargs[]) doc->setLevel (4); return HOK; } -// ======================================================== test_disconnect +// ======================================================== test_disconnect1 // ==== Disconnect Quad int test_disconnect1 (int nbargs, cpchar tabargs[]) { @@ -1439,9 +744,7 @@ int test_disconnect1 (int nbargs, cpchar tabargs[]) Hex::Hex mon_ex; Hex::Document* doc = mon_ex.addDocument (); - Hex::Vertex* orig1 = doc->addVertex (0,0,0); - Hex::Vector* dir = doc->addVector (1,1,1); - Hex::Elements* grid1 = doc->makeCartesian (orig1, dir, size_x,size_y,size_z); + Hex::Elements* grid1 = doc->makeCartesianTop (size_x,size_y,size_z); int nvtk = 0; doc->setLevel (1); @@ -1476,10 +779,7 @@ int test_disconnect3 (int nbargs, cpchar tabargs[]) Hex::Hex mon_ex; Hex::Document* doc = mon_ex.addDocument (); - Hex::Vertex* orig1 = doc->addVertex (0,0,0); - - Hex::Vector* dir = doc->addVector (1,1,1); - Hex::Elements* grid1 = doc->makeCartesian (orig1, dir, size_x,size_y,size_z); + Hex::Elements* grid1 = doc->makeCartesianTop (size_x,size_y,size_z); int nvtk = 0; doc->setLevel (1); @@ -1547,10 +847,17 @@ int test_disconnect (int nbargs, cpchar tabargs[]) Hex::Vertex* orig2 = doc->addVertex (4,0,0); Hex::Vertex* orig3 = doc->addVertex (8,0,0); - Hex::Vector* dir = doc->addVector (1,1,1); - Hex::Elements* grid1 = doc->makeCartesian (orig1, dir, size_x,size_y,size_z); - Hex::Elements* grid2 = doc->makeCartesian (orig2, dir, size_x,size_y,size_z); - Hex::Elements* grid3 = doc->makeCartesian (orig3, dir, size_x,size_y,size_z); + Hex::Vector* vx = doc->addVector (1,0,0); + Hex::Vector* vy = doc->addVector (0,1,0); + Hex::Vector* vz = doc->addVector (0,0,1); + double dx=1, dy=1, dz=1; + + Hex::Elements* grid1 = doc->makeCartesianUni (orig1, vx,vy,vz, dx,dy,dz, + size_x,size_y,size_z); + Hex::Elements* grid2 = doc->makeCartesianUni (orig2, vx,vy,vz, dx,dy,dz, + size_x,size_y,size_z); + Hex::Elements* grid3 = doc->makeCartesianUni (orig3, vx,vy,vz, dx,dy,dz, + size_x,size_y,size_z); int nvtk = 0; doc->setLevel (1); @@ -1596,10 +903,7 @@ int test_propagation () Hex::Hex mon_ex; Hex::Document* doc = mon_ex.addDocument (); - Hex::Vertex* orig = doc->addVertex (0,0,0); - Hex::Vector* dir = doc->addVector (1,1,1); - // Hex::Elements* grid = - doc->makeCartesian (orig, dir, size_x,size_y,size_z); + doc->makeCartesianTop (size_x,size_y,size_z); int nb = doc->countPropagation (); for (int nro=0 ; nroaddVertex (0,0,0); - Hex::Vector* dir = doc->addVector (1,1,1); - Hex::Elements* grid = doc->makeCartesian (orig, dir, size_x,size_y,size_z); + Hex::Elements* grid = doc->makeCartesianTop (size_x,size_y,size_z); Hex::Vector* enhaut = doc->addVector (0, 0, 5); Hex::Vector* devant = doc->addVector (5, 0, 0); @@ -1688,8 +990,7 @@ int test_transfo2 (int nbargs, cpchar tabargs[]) Hex::Vertex* orig = doc->addVertex (0,0,0); Hex::Vector* dir = doc->addVector (1,1,1); - Hex::Elements* grid = doc->makeCartesian (orig, dir, size_x, size_y, - size_z); + Hex::Elements* grid = doc->makeCartesianTop (size_x, size_y, size_z); if (grid==NULL) return HERR; @@ -1766,40 +1067,6 @@ int test_transfo2 (int nbargs, cpchar tabargs[]) return HOK; } -// ======================================================== test_transfo -int test_transfo (int nbargs, cpchar tabargs[]) -{ - int nvtk = 0; - cpchar fic_vtk = "transfo"; - - Hex::Hex mon_ex; - Hex::Document* doc = mon_ex.addDocument (); - doc ->setLevel (1); - - Hex::Vertex* orig = doc->addVertex (0,0,0); - Hex::Vector* vx = doc->addVector (1,0,0); - Hex::Vector* vz = doc->addVector (0,0,1); - double dr = 1; - double da = 360; - double dl = 1; - int nr = 3; - int na = 8; - int nl = 3; - Hex::Elements* grid = doc->makeCylindrical (orig, vx,vz, dr, da, dl, - nr, na, nl, false); - if (grid==NULL) - return HERR; - - doc ->saveVtk (fic_vtk, nvtk); - Hex::Vector* devant = doc->addVector (10, 0, 0); - - Hex::Elements* grid2 = doc->makeTranslation (grid, devant); - if (grid2==NULL) - return HERR; - doc ->saveVtk (fic_vtk, nvtk); - - return HOK; -} // ======================================================== test_copy_document int test_copy_document (int nbargs, cpchar tabargs[]) { @@ -1822,11 +1089,7 @@ int test_remove () Hex::Hex mon_ex; Hex::Document* doc = mon_ex.addDocument (); - Hex::Vertex* orig = doc->addVertex (0,0,0); - Hex::Vertex* orig1 = doc->addVertex (6,0,0); - Hex::Vector* dir = doc->addVector (1,1,1); - Hex::Elements* grid = doc->makeCartesian (orig, dir, size_x,size_y,size_z); - doc->makeCartesian (orig1, dir, 1,1,1); + Hex::Elements* grid = doc->makeCartesianTop (size_x,size_y,size_z); doc->saveVtk ("removeConn1.vtk"); Echo ("--------- Avant destruction"); @@ -1882,43 +1145,6 @@ void init_vec (Hex::RealVector& tab, double n0=0, double n1=0, double n2=0, if (n15>0.0) tab.push_back (n15); if (n16>0.0) tab.push_back (n16); } -// ================================================== test_cylindricals -int test_cylindricals (int nbargs, cpchar tabargs[]) -{ - Hex::Hex mon_ex; - Hex::Document* doc = mon_ex.addDocument (); - - Hex::Vertex* orig = doc->addVertex (0, 0, 0); - Hex::Vector* vz = doc->addVector (0, 0, 1); - Hex::Vector* vx = doc->addVector (1 ,0, 0); - - Hex::RealVector tdr, tda, tdl; - - /****************** - init_vec (tdr, 2, 1, 0.5); - init_vec (tda, 40, 35, 30, 25, 20, 15, 10, 5, - 5, 10, 15, 20, 25, 30, 35, 40); - init_vec (tdl, 1, 2, 3 ); - - init_vec (tdr, 1, 1, 1, 1); - init_vec (tda, 45,45, 45,45, 45,45, 45,45 ); - init_vec (tdl, 1, 1, 1 ); - - ****************** */ - - - init_vec (tdr, 1, 2, 1, 2); - init_vec (tda, 20, 20, 20 ); - init_vec (tdl, 1 ); - - Hex::Elements* grid=doc->makeCylindricals (orig, vx,vz, tdr,tda,tdl, false); - - doc->saveVtk ("cylindricals.vtk"); - doc->dump(); - grid->clearAssociation(); - doc->clearAssociation(); - return HOK; -} // ======================================================== test_edge int test_edge (int nbargs, cpchar tabargs[]) { @@ -1947,8 +1173,6 @@ int test_hexa (int nbargs, cpchar tabargs[]) goto_workspace (); - ier = test_cylindricals (nbargs, tabargs); - ier = test_transfo (nbargs, tabargs); free_workspace (); return ier;