From: abuhsing Date: Wed, 4 Dec 2013 15:42:41 +0000 (+0000) Subject: Abu : Mise a jour HEXABLOCK X-Git-Tag: V7_3_0b1~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=05081927a6add4ea848333bed2fb9b40d64cd4b0;p=modules%2Fhexablock.git Abu : Mise a jour HEXABLOCK Modified Files: Tag: V7_3_BR HEXABLOCK/HexDocument.hxx HEXABLOCK/HexDocument_quads.cxx HEXABLOCK/HexEdge.cxx HEXABLOCK/HexEdge.hxx HEXABLOCK/HexEdgeShape.cxx HEXABLOCK/HexEdgeShape.hxx HEXABLOCK/HexNewShape.cxx HEXABLOCK/HexNewShape.hxx HEXABLOCK/HexSubShape.cxx HEXABLOCK/HexSubShape.hxx HEXABLOCK/HexVertexShape.cxx HEXABLOCK/HexVertexShape.hxx HEXABLOCK/hexa_base.hxx HEXABLOCK/hexa_utils.cxx HEXABLOCKGUI/HEXABLOCKGUI.cxx HEXABLOCKGUI/HEXABLOCKGUI.hxx HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.cxx HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.hxx HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.cxx HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.hxx HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.hxx HEXABLOCKGUI/HEXABLOCKGUI_Model.hxx HEXABLOCK_SWIG/hexablock_swig.py HEXABLOCK_SWIG/hexablock_swig_wrap.cc Added Files: Tag: V7_3_BR HEXABLOCKGUI/HEXABLOCKGUI_Browser.cxx HEXABLOCKGUI/HEXABLOCKGUI_Browser.hxx ---------------------------------------------------------------------- --- diff --git a/src/HEXABLOCK/HexDocument.hxx b/src/HEXABLOCK/HexDocument.hxx index 4d7df44..4a02ca5 100755 --- a/src/HEXABLOCK/HexDocument.hxx +++ b/src/HEXABLOCK/HexDocument.hxx @@ -107,8 +107,8 @@ public : Elements* disconnectVertex (Hexa* maille, Vertex* noeud); Elements* disconnectEdges (Hexas thexas, Edges edges); - Elements* replace (Quads pattern, Vertex* p1, Vertex* c1, - Vertex* p2, Vertex* c2, Vertex* p3, Vertex* c3); + Elements* replace (Quads pattern, Quads cible, Vertex* p1, Vertex* c1, + Vertex* p2, Vertex* c2); int mergeVertices (Vertex* v1, Vertex* v2); int mergeEdges (Edge* e1, Edge* e2, Vertex* v1, Vertex* v2); @@ -301,6 +301,18 @@ public : void clearAssoEdges (); void clearAssoQuads (); + // PERIMES + Elements* replaceHexa (Quads pattern, Vertex* p1, Vertex* c1, Vertex* p2, + Vertex* c2, Vertex* p3, Vertex* c3); + Elements* replace (Quads pattern, Vertex* p1, Vertex* c1, Vertex* p2, + Vertex* c2, Vertex* p3, Vertex* c3) + { return replaceHexa (pattern, p1, c1, p2, c2, p3, c3); } + + Elements* replaceHexas (Quads pattern, Quads cible, Vertex* p1, Vertex* c1, + Vertex* p2, Vertex* c2, Vertex* p3, Vertex* c3) + { return replace (pattern, cible, p1, c1, p2, c2); } + + public: ~Document (); diff --git a/src/HEXABLOCK/HexDocument_quads.cxx b/src/HEXABLOCK/HexDocument_quads.cxx index 7470fbc..746d4a4 100755 --- a/src/HEXABLOCK/HexDocument_quads.cxx +++ b/src/HEXABLOCK/HexDocument_quads.cxx @@ -591,11 +591,11 @@ Hexa* Document::addHexaQuadsACDE (AnaQuads& strquads) Hexa* hexa = new Hexa (q_a, q_b, q_c, q_d, q_e, q_f); return hexa; } -// ========================================================= replace -Elements* Document::replace (Quads pattern, Vertex* p1, Vertex* c1, +// ========================================================= replaceHexa +Elements* Document::replaceHexa (Quads pattern, Vertex* p1, Vertex* c1, Vertex* p2, Vertex* c2, Vertex* p3, Vertex* c3) { - DumpStart ("replace", pattern << p1 << c1 << p2 << c2 << p3 << c3); + DumpStart ("replaceHexa", pattern << p1 << c1 << p2 << c2 << p3 << c3); Elements* t_hexas = new Elements (this); int ier = t_hexas->replaceHexas (pattern, p1, c1, p2, c2, p3, c3); @@ -608,6 +608,22 @@ Elements* Document::replace (Quads pattern, Vertex* p1, Vertex* c1, DumpReturn (t_hexas); return t_hexas; } +// ========================================================= repla +Elements* Document::replace (Quads motif, Quads cible, Vertex* p1, Vertex* c1, Vertex* p2, Vertex* c2) +{ + DumpStart ("replace", motif << cible << p1 << c1 << p2 << c2); + + Elements* t_hexas = new Elements (this); + + //if (BadElement (edge)) + { + t_hexas->setError (HERR); + Mess << "This function is not yet implemented"; + } + + DumpReturn (t_hexas); + return t_hexas; +} // ========================================================= print_replace void print_replace (Edge* zig, Edge* zag) { diff --git a/src/HEXABLOCK/HexEdge.cxx b/src/HEXABLOCK/HexEdge.cxx index 7fc3dc5..b5c5404 100755 --- a/src/HEXABLOCK/HexEdge.cxx +++ b/src/HEXABLOCK/HexEdge.cxx @@ -28,6 +28,7 @@ #include "HexXmlWriter.hxx" #include "HexNewShape.hxx" #include "HexAssoEdge.hxx" +#include "HexVertexShape.hxx" static int niveau = 0; @@ -517,4 +518,97 @@ double Edge::getAssoLen () return longueur; } +// ========================================================= getLength +double Edge::getLength () +{ + Real3 p1, p2; + e_vertex [V_AMONT]-> getAssoCoord (p1); + e_vertex [V_AVAL ]-> getAssoCoord (p2); + double longueur = calc_distance (p1, p2); + return longueur; +} +// ========================================================= findAssociation +int Edge::findAssociation (NewShape* geom) +{ + Real3 point, p2; + if (geom==NULL) + return NOTHING; + + e_vertex [V_AMONT]-> getAssoCoord (point); + e_vertex [V_AVAL ]-> getAssoCoord (p2); + + EdgeShape* gline = geom->findEdge (point, p2); + if (gline==NULL) + { + cout << " *** FindAssociation " << el_name << endl; + for (int nv=0 ; nv < V_TWO ; ++nv) + { + e_vertex [nv]-> getAssoCoord (point); + VertexShape* shape = geom->findVertex (point); + cout << " *** Vertex nro " << nv; + if (shape==NULL) + { + cout << " absent : "; + PutCoord (point); + } + else + { + cout << " : Subid = " << shape->getIdent() << endl; + } + } + return NOTHING; + } + + clearAssociation (); + addAssociation (gline, 0, 1); + return gline->getIdent(); +} +// ========================================================= setAssociation +int Edge::setAssociation (NewShape* geom, int subid) +{ + if (geom == NULL) + { + if (el_root->debug ()) + cout << " Edge " << el_name << " addAssociation of NULL ignored" + << endl; + return HERR; + } + + EdgeShape* gline = geom->findEdge (subid); + if (gline == NULL) + { + if (el_root->debug ()) + cout << " Edge " << el_name << " addAssociation bad subid : " + << subid << endl; + return HERR; + } + + Real3 p1, p2, pa, pb; + gline->getCoords (p1, p2); + e_vertex [V_AMONT]-> getAssoCoord (pa); + e_vertex [V_AVAL ]-> getAssoCoord (pb); + + double da1 = calc_d2 (pa, p1); + double da2 = calc_d2 (pa, p2); + double db1 = calc_d2 (pb, p1); + double db2 = calc_d2 (pb, p2); + + cout << "setAssociation " << el_name << " :" <setAssociation (p2); + e_vertex [V_AVAL ]->setAssociation (p1); + } + else + { + e_vertex [V_AMONT]->setAssociation (p1); + e_vertex [V_AVAL ]->setAssociation (p2); + } + + + clearAssociation (); + int ier = addAssociation (gline, 0, 1); + return ier; +} END_NAMESPACE_HEXA diff --git a/src/HEXABLOCK/HexEdge.hxx b/src/HEXABLOCK/HexEdge.hxx index 0e05e80..8b60c1f 100755 --- a/src/HEXABLOCK/HexEdge.hxx +++ b/src/HEXABLOCK/HexEdge.hxx @@ -31,10 +31,13 @@ class HexaExport Edge : public EltBase public: virtual Vertex* getVertex (int nro); - int addAssociation (NewShape* geom, int subid, double deb, double fin); + int addAssociation (NewShape* geom, int subid, double deb, double fin); + int setAssociation (NewShape* geom, int subid); + int findAssociation (NewShape* geom); virtual void clearAssociation (); void setColor (double valeur); bool getWay () { return e_way ; } + double getLength (); Edge (Vertex* va, Vertex* vb); diff --git a/src/HEXABLOCK/HexEdgeShape.cxx b/src/HEXABLOCK/HexEdgeShape.cxx index 5aed434..0b90d6b 100755 --- a/src/HEXABLOCK/HexEdgeShape.cxx +++ b/src/HEXABLOCK/HexEdgeShape.cxx @@ -34,6 +34,19 @@ #include #include +#include + +/**************** +#include +#include +#include +#include +#include +#include +#include +#include +#include +*********************************/ BEGIN_NAMESPACE_HEXA @@ -50,6 +63,8 @@ EdgeShape::EdgeShape (NewShape* dad, int id) lin_end [dir_x] = lin_end [dir_y] = lin_end [dir_z] = 0; par_mini = 0; par_maxi = 0; + lin_radius = 0; + lin_angle = 0; } // ====================================================== getCurve BRepAdaptor_Curve* EdgeShape::getCurve () @@ -119,7 +134,7 @@ int EdgeShape::getPoint (double param, double* point) // ========================================================= samePoints bool EdgeShape::samePoints (double* point1, double* point2) { - const double Epsilon2 = 1e-6; + const double Epsilon2 = 1e-4; bool rep = same_coords (point1, point2, Epsilon2); return rep; } @@ -136,6 +151,19 @@ int EdgeShape::onExtremity (double* point) else return NOTHING; } +// ========================================================= definedBy +bool EdgeShape::definedBy (double p1[], double p2[]) +{ + if (maj_curve) + updateCurve (); + + bool rep = false; + if (samePoints (p1, lin_start)) + rep = samePoints (p2, lin_end); + else if (samePoints (p1, lin_end)) + rep = samePoints (p2, lin_start); + return rep; +} // ========================================================= getParam double EdgeShape::getParam (double* coord) { @@ -168,7 +196,6 @@ double EdgeShape::getParam (double* coord) return -1.0; GeomAdaptor_Curve adapt_curve (handle); - kind_of = (EnumKindOfShape) (adapt_curve.GetType() + 1); /****************** enum GeomAbs_CurveType { GeomAbs_Line, GeomAbs_Circle, GeomAbs_Ellipse, @@ -197,6 +224,9 @@ void EdgeShape::addAssociation (Edge* edge) is_associated = true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + // ------- Cf GEOMImpl_IMeasureOperations.cxx + // ====================================================== updateCurve void EdgeShape::updateCurve () { @@ -224,5 +254,40 @@ void EdgeShape::updateCurve () // Extremites getPoint (0, lin_start); getPoint (1, lin_end); + + lin_radius = lin_angle = 0; + kind_of = (EnumKindOfShape) adapt_curve.GetType(); +#ifndef NO_CASCADE + if (kind_of==KS_Circle) + { + Handle(Geom_Circle) hgc = Handle(Geom_Circle)::DownCast (handle); + lin_radius = hgc->Radius (); + lin_angle = (par_maxi-par_mini)*180/M_PI; + } +#endif +} +// ====================================================== getAngle +double EdgeShape::getAngle () +{ + if (maj_curve) + updateCurve (); + + return lin_angle; +} +// ====================================================== getRadius +double EdgeShape::getRadius () +{ + if (maj_curve) + updateCurve (); + + return lin_radius; +} +// ====================================================== getRadius +EnumKindOfShape EdgeShape::kindOf () +{ + if (maj_curve) + updateCurve (); + + return kind_of; } END_NAMESPACE_HEXA diff --git a/src/HEXABLOCK/HexEdgeShape.hxx b/src/HEXABLOCK/HexEdgeShape.hxx index 212a728..38f1062 100644 --- a/src/HEXABLOCK/HexEdgeShape.hxx +++ b/src/HEXABLOCK/HexEdgeShape.hxx @@ -24,10 +24,14 @@ public : int getPoint (double param, double point[]); double getParam (double point[]); double getLength (); + double getRadius (); + double getAngle (); int onExtremity (double point[]); + bool definedBy (double p1[], double p2[]); bool isLinear () { return kind_of == KS_Line ; } static bool samePoints (double point1[], double point2[]); + virtual EnumKindOfShape kindOf (); // void saveXml (XmlWriter* xml); private : @@ -38,6 +42,7 @@ private : Real3 lin_start; Real3 lin_end; double lin_length, par_mini, par_maxi; + double lin_radius, lin_angle; bool maj_curve; Edges tab_assoc; diff --git a/src/HEXABLOCK/HexNewShape.cxx b/src/HEXABLOCK/HexNewShape.cxx index 7f109cf..3018526 100755 --- a/src/HEXABLOCK/HexNewShape.cxx +++ b/src/HEXABLOCK/HexNewShape.cxx @@ -291,6 +291,18 @@ VertexShape* NewShape::findVertex (int shid) } return NULL; } +// ====================================================== findVertex +VertexShape* NewShape::findVertex (double point[]) +{ + int nbre = tab_vertex.size (); + for (int nro=0 ; nro < nbre ; nro++) + { + VertexShape* shape = tab_vertex [nro]; + if (shape->definedBy (point)) + return shape; + } + return NULL; +} // ====================================================== findEdge EdgeShape* NewShape::findEdge (int shid) { @@ -303,6 +315,18 @@ EdgeShape* NewShape::findEdge (int shid) } return NULL; } +// ====================================================== findEdge +EdgeShape* NewShape::findEdge (double p1[], double p2[]) +{ + int nbre = tab_edge.size (); + for (int nro=0 ; nro < nbre ; nro++) + { + EdgeShape* shape = tab_edge [nro]; + if (shape->definedBy (p1, p2)) + return shape; + } + return NULL; +} // ====================================================== findFace FaceShape* NewShape::findFace (int shid) { diff --git a/src/HEXABLOCK/HexNewShape.hxx b/src/HEXABLOCK/HexNewShape.hxx index eb57659..2dec047 100644 --- a/src/HEXABLOCK/HexNewShape.hxx +++ b/src/HEXABLOCK/HexNewShape.hxx @@ -51,11 +51,14 @@ public : // for Others void addAssociation (Quad* elt, int subid); VertexShape* findVertex (int subid); + VertexShape* findVertex (double point[]); EdgeShape* findEdge (int subid); + EdgeShape* findEdge (double p1[], double p2[]); FaceShape* findFace (int subid); SubShape* findSubShape (int subid); + const TopoDS_Shape& getGeoShape (int subid); int saveBrep (); diff --git a/src/HEXABLOCK/HexSubShape.cxx b/src/HEXABLOCK/HexSubShape.cxx index 5195eb9..ba29f01 100755 --- a/src/HEXABLOCK/HexSubShape.cxx +++ b/src/HEXABLOCK/HexSubShape.cxx @@ -41,6 +41,7 @@ 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 1feea54..a2d8cc2 100644 --- a/src/HEXABLOCK/HexSubShape.hxx +++ b/src/HEXABLOCK/HexSubShape.hxx @@ -18,7 +18,7 @@ public : cpchar getParentName () const; int getIdent () { return sub_ident ; } int getDim () { return sub_dim ; } - EnumKindOfShape kindOf () { return kind_of ; } + virtual EnumKindOfShape kindOf () { return kind_of ; } const string& getBrep (); virtual const TopoDS_Shape& getShape (); diff --git a/src/HEXABLOCK/HexVertexShape.cxx b/src/HEXABLOCK/HexVertexShape.cxx index d532eb2..2e06e05 100755 --- a/src/HEXABLOCK/HexVertexShape.cxx +++ b/src/HEXABLOCK/HexVertexShape.cxx @@ -83,6 +83,7 @@ void VertexShape::getCoords (double& px, double& py, double& pz) py = ss_coord[dir_y]; pz = ss_coord[dir_z]; } +#if 0 // ====================================================== getShape const TopoDS_Shape& VertexShape::getShape() { @@ -97,6 +98,7 @@ const TopoDS_Shape& VertexShape::getShape() return SubShape::getShape (); } +#endif // ====================================================== addAssociation void VertexShape::addAssociation (Vertex* elt) { @@ -111,6 +113,16 @@ Vertex* VertexShape::getAssociation (int nro) else return NULL; } +// ====================================================== definedBy +bool VertexShape::definedBy (double point[]) +{ + if (maj_coords) + updateCoords (); + + const double Epsilon2 = 1e-4; + bool rep = same_coords (point, ss_coord, Epsilon2); + return rep; +} // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // ====================================================== saveXml void VertexShape::saveXml (XmlWriter* xml) diff --git a/src/HEXABLOCK/HexVertexShape.hxx b/src/HEXABLOCK/HexVertexShape.hxx index a04a843..549b9bc 100644 --- a/src/HEXABLOCK/HexVertexShape.hxx +++ b/src/HEXABLOCK/HexVertexShape.hxx @@ -21,7 +21,8 @@ public : void getCoords (double& px, double& py, double& pz); void saveXml (XmlWriter* xml); - virtual const TopoDS_Shape& getShape(); // #mbarry + // virtual const TopoDS_Shape& getShape(); // #mbarry + bool definedBy (double point[]); private : void updateCoords (); diff --git a/src/HEXABLOCK/hexa_base.hxx b/src/HEXABLOCK/hexa_base.hxx index 684ec49..32065ea 100755 --- a/src/HEXABLOCK/hexa_base.hxx +++ b/src/HEXABLOCK/hexa_base.hxx @@ -173,9 +173,9 @@ enum EnumHVertex {V_ACE, V_ACF, V_ADE, V_ADF, V_BCE, V_BCF, V_BDE, V_BDF, enum EnumQDirection {Q_INSIDE, Q_DIRECT, Q_INVERSE, Q_UNDEFINED, Q_WAITING }; -enum EnumKindOfShape {KS_None, KS_Line, KS_Circle, KS_Ellipse, KS_Hyperbola, +enum EnumKindOfShape {KS_Line, KS_Circle, KS_Ellipse, KS_Hyperbola, KS_Parabola, KS_BezierCurve, KS_BSplineCurve, - KS_OtherCurve }; + KS_OtherCurve, KS_None=-1 }; enum { CylSmall=0, CylBig=1, NxInt=1, NxExt=2 }; @@ -263,6 +263,7 @@ HexaExport inline double rad2degres (double angle) { return (angle*180.0/M_PI HexaExport double calc_norme (double v1[]); HexaExport double calc_distance (double v1[], double v2[]); +HexaExport double calc_d2 (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[]); diff --git a/src/HEXABLOCK/hexa_utils.cxx b/src/HEXABLOCK/hexa_utils.cxx index 7188589..cf05020 100755 --- a/src/HEXABLOCK/hexa_utils.cxx +++ b/src/HEXABLOCK/hexa_utils.cxx @@ -104,6 +104,13 @@ double calc_distance (double v1[], double v2[]) Real3 vv = { v2[dir_x]-v1[dir_x], v2[dir_y]-v1[dir_y], v2[dir_z]-v1[dir_z] }; return calc_norme (vv); } +// ======================================================== calc_d2 +double calc_d2 (double v1[], double v2[]) +{ + double dd = carre (v2[dir_x]-v1[dir_x]) + carre (v2[dir_y]-v1[dir_y]) + + carre (v2[dir_z]-v1[dir_z]); + return dd; +} // ========================================================= calc_vecteur void calc_vecteur (double pta[], double ptb[], double vab[]) { diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx index d5843db..a57319c 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx @@ -108,8 +108,12 @@ #include +#include +#include #include #include +#include +#include #include #include #include @@ -617,6 +621,7 @@ void HEXABLOCKGUI::onObjectBrowserClick(const QModelIndex& index) { docGView->setViewWindow(graphicViewsHandler->createVtkWindow()); docGView->getViewWindow()->installEventFilter(this); + showAllMenus(); } else docGView->setViewWindow(currentDocGView->getViewWindow()); @@ -649,7 +654,6 @@ void HEXABLOCKGUI::onWindowClosed( SUIT_ViewWindow* svw) SVTK_ViewWindow* window = dynamic_cast(svw); if (window != NULL) { - //VTK clean close if (currentDocGView != NULL && currentDocGView->getViewWindow() == window) { //HexaBlock Vtk Window has been closed @@ -697,7 +701,6 @@ void HEXABLOCKGUI::onWindowClosed( SUIT_ViewWindow* svw) // if (_treeViewDelegate != NULL) _treeViewDelegate->closeDialog(); currentOccGView->getViewWindow()->removeEventFilter(this); - currentOccGView->setViewWindow(NULL); } } @@ -1689,35 +1692,13 @@ void HEXABLOCKGUI::showMeshMenus(bool show) setToolShown( _computeMesh, show); } -void HEXABLOCKGUI::showActor() -{ - VtkDocumentGraphicView* currentVtkGView = getCurrentVtkGraphicView(); - if (currentVtkGView == NULL || currentVtkGView->getViewWindow() == NULL || - currentVtkGView->isEmpty() || currentVtkGView->getDocumentActor() == NULL) - return; - - currentVtkGView->getViewWindow()->setFocus(); - currentVtkGView->getViewWindow()->Display(currentVtkGView->getDocumentActor()->getIO()); - currentVtkGView->update(); - currentVtkGView->getViewWindow()->onFitAll(); - - //update the visibility state now - SalomeApp_Study* aStudy = HEXABLOCKGUI::activeStudy(); - SUIT_ViewManager* vman = currentVtkGView->getViewWindow()->getViewManager(); - if (aStudy == NULL || vman == NULL) return; - - Handle(SALOME_InteractiveObject) anIO = currentVtkGView->getDocumentActor()->getIO(); - aStudy->setObjectProperty(vman->getId(), anIO->getEntry(), "Visibility", 1 ); - displayer()->setVisibilityState(anIO->getEntry(), Qtx::ShownState); -} - -//SOCC_Prs* currentPrs = NULL; -void HEXABLOCKGUI::showOnlyActor() +void HEXABLOCKGUI::showVtkActor() { VtkDocumentGraphicView* currentVtkGView = getCurrentVtkGraphicView(); if (currentVtkGView == NULL || currentVtkGView->isEmpty() || currentVtkGView->getDocumentActor() == NULL) return; + SVTK_ViewWindow* vtkView = currentVtkGView->getViewWindow(); if (vtkView == NULL) return; @@ -1727,8 +1708,8 @@ void HEXABLOCKGUI::showOnlyActor() //show only the current actor ----------------- vtkView->setFocus(); -// vtkView->DisplayOnly(currentVtkGView->getDocumentActor()->getIO()); - Document_Actor *lastDocActor, *currentDocActor = currentVtkGView->getDocumentActor(); + // vtkView->DisplayOnly(currentVtkGView->getDocumentActor()->getIO()); + Document_Actor *lastDocActor; if (lastVtkDocGView != NULL) { lastDocActor = lastVtkDocGView->getDocumentActor(); @@ -1749,11 +1730,12 @@ void HEXABLOCKGUI::showOnlyActor() displayer()->setVisibilityState(anIO->getEntry(), Qtx::ShownState); } vtkView->onFitAll(); +} -// //showOnly in occ viewer ------------- - +void HEXABLOCKGUI::showOccActor() +{ if (currentOccGView == NULL) - return; + return; OCCViewer_ViewWindow* occView = currentOccGView->getViewWindow(); if (occView == NULL) return; @@ -1761,7 +1743,6 @@ void HEXABLOCKGUI::showOnlyActor() if (vf == NULL) return; -// vf->EraseAll(); if (lastOccPrs != NULL) vf->Erase(lastOccPrs); currentOccGView->globalSelection(); @@ -1772,13 +1753,12 @@ void HEXABLOCKGUI::showOnlyActor() occView->onFitAll(); } -void HEXABLOCKGUI::hideActor() +void HEXABLOCKGUI::hideVtkActor() { - // * vtk -- VtkDocumentGraphicView* currentVtkGView = getCurrentVtkGraphicView(); if (currentVtkGView == NULL || currentVtkGView->isEmpty() || - currentVtkGView->getViewWindow() == NULL || - currentVtkGView->getDocumentActor() == NULL) return; + currentVtkGView->getViewWindow() == NULL || + currentVtkGView->getDocumentActor() == NULL) return; currentVtkGView->getViewWindow()->Erase(currentVtkGView->getDocumentActor()->getIO()); currentVtkGView->getViewWindow()->onResetView(); @@ -1791,17 +1771,19 @@ void HEXABLOCKGUI::hideActor() Handle(SALOME_InteractiveObject) anIO = currentVtkGView->getDocumentActor()->getIO(); aStudy->setObjectProperty(vman->getId(), anIO->getEntry(), "Visibility", 0 ); displayer()->setVisibilityState(anIO->getEntry(), Qtx::HiddenState); +} - // * occ -- +void HEXABLOCKGUI::hideOccActor() +{ OCCViewer_ViewWindow* occView = currentOccGView == NULL ? NULL : currentOccGView->getViewWindow(); - DocumentModel* docModel = currentVtkGView->getDocumentModel(); + VtkDocumentGraphicView* currentVtkGView = getCurrentVtkGraphicView(); + DocumentModel* docModel = (currentVtkGView == NULL ? NULL : currentVtkGView->getDocumentModel()); if (occView == NULL || docModel == NULL) return; SALOME_View* vf = dynamic_cast(occView->getViewManager()->getViewModel()); if (vf == NULL) return; -// vf->EraseAll(); SOCC_Prs* currentOccPrs = getOccPrs(currentDocGView); if (currentOccPrs != NULL) vf->Erase(currentOccPrs); @@ -1809,6 +1791,18 @@ void HEXABLOCKGUI::hideActor() occView->onResetView(); } +void HEXABLOCKGUI::showOnlyActor() +{ + showVtkActor(); + showOccActor(); +} + +void HEXABLOCKGUI::hideActor() +{ + hideVtkActor(); + hideOccActor(); +} + void HEXABLOCKGUI::showDockWidgets(bool isVisible) { @@ -2922,12 +2916,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 b0a6170..f844c41 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI.hxx @@ -30,7 +30,6 @@ #include #include - #include "klinkitemselectionmodel.hxx" #include @@ -128,6 +127,7 @@ public: enum ViewType { VTK, OCC, + VTK_OCC, UNKNOWN }; @@ -201,6 +201,11 @@ public: void showLawInfoDialog(HEXA_NS::Law* law); void showPropagationInfoDialog(HEXA_NS::Propagation* propagation); + void showVtkActor(); + void showOccActor(); + void hideVtkActor(); + void hideOccActor(); + public slots: bool deactivateModule( SUIT_Study* theStudy); bool activateModule( SUIT_Study* theStudy); @@ -220,7 +225,6 @@ protected slots: virtual void onViewManagerRemoved( SUIT_ViewManager* ); void onSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected ); - void showActor(); void hideActor(); void showOnlyActor(); diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_Browser.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_Browser.cxx new file mode 100644 index 0000000..d87fd70 --- /dev/null +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_Browser.cxx @@ -0,0 +1,131 @@ +// 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 "HEXABLOCKGUI_Browser.hxx" +#include "HEXABLOCKGUI.hxx" + +#include "Hex.hxx" +#include "HexDocument.hxx" + +#include +#include +#include +#include +#include + +// --------------------------------------------------- classe SaLObject +class SalObject : public LightApp_DataObject +{ +public : + SalObject (cpchar nom="") : LightApp_DataObject (NULL) + { obj_name = nom ; obj_entry = "6.6.66" ; } + + virtual ~SalObject () { cout << "SalObject::delete" << endl ; } + virtual QString name () const { return obj_name ; } + virtual QString entry () const { return obj_entry ; } + void rename (cpchar nom) { obj_name = nom ; } + +private : + QString obj_name; + QString obj_entry; +}; +//--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +// --------------------------------------------------- classe SaLModel +class SalModel : public LightApp_DataModel +{ +public : + SalModel (HEXABLOCKGUI* guy); + void clear (); + void addItem (cpchar fils); + +private : + CAM_ModuleObject* obj_root; +}; + +// =================================================== Constructeur SalModel +SalModel::SalModel (HEXABLOCKGUI* guy) + : LightApp_DataModel (guy) +{ +/* ********************************************** + LightApp_Study* study = (LightApp_Study*) guy->activeStudy(); + obj_root = createModuleObject (study->root()); + + obj_root ->setDataModel (this); + setRoot (obj_root); + + SalObject* obj1 = new SalObject ("Document1"); + SalObject* obj2 = new SalObject ("Document2"); + + PutData (obj1->name ().toStdString()); + PutData (obj2->name ().toStdString()); + + obj_root->appendChild (obj1); + obj_root->appendChild (obj2); + PutData (obj_root->childCount()); + + ********************************************** */ +} +// ================================================================ clear +void SalModel::clear () +{ + const bool nodel = false; + while (true) + { + SUIT_DataObject* obj = obj_root->firstChild (); + if (obj==NULL) + return; + obj_root->removeChild (obj, nodel); + cout << " Delete object " << obj->name ().toStdString() + << endl; + } +} +// ================================================================ addItem +void SalModel::addItem (cpchar name) +{ + SalObject* obj1 = new SalObject (name); + obj_root->appendChild (obj1); +} +//--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +// =================================================== Constructeur H.G.Browser +HEXABLOCKGUI_Browser::HEXABLOCKGUI_Browser (HEXABLOCKGUI* guy) +{ + hexa_gui = guy; + hexa_root = HEXA_NS::Hex::getInstance (); + data_model = NULL; +} + +// =============================================================== rebuildTree +void HEXABLOCKGUI_Browser::rebuildTree () +{ + if (data_model==NULL) + data_model = new SalModel (hexa_gui); + + data_model->clear (); + + int nbre = hexa_root->countDocument (); + for (int nro=0 ; nrogetDocument (nro); + cpchar nom = doc->getName (); + data_model->addItem (nom); + } + + hexa_gui->updateObjBrowser( true ); +} + diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_Browser.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_Browser.hxx new file mode 100644 index 0000000..cd16e5d --- /dev/null +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_Browser.hxx @@ -0,0 +1,45 @@ +// 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 +// + +#ifndef _HEXABLOCKGUI_BROWSER_HXX_ +#define _HEXABLOCKGUI_BROWSER_HXX_ + +//--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 + +#include "hexa_base.hxx" +#include "HEXABLOCKGUI_Export.hxx" + +using namespace Hex; + +class HEXABLOCKGUI; +class SalModel; + +class HEXABLOCK_EXPORT HEXABLOCKGUI_Browser +{ +public : + HEXABLOCKGUI_Browser (HEXABLOCKGUI* dad); + void rebuildTree (); + + +private : + Hex::Hex* hexa_root; + SalModel* data_model; + HEXABLOCKGUI* hexa_gui; +}; +#endif diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.cxx index 2c89d3a..80fc85e 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.cxx @@ -49,7 +49,10 @@ #include "HEXABLOCKGUI_VtkDocumentGraphicView.hxx" - +#include +#include +#include +#include //#define _DEVDEBUG_ @@ -238,6 +241,44 @@ int DocumentModel::getNbrUnusedElt(HEXA_NS::EnumElt eltType) return getNbrElt(eltType) - getNbrUsedElt(eltType); } +// compute the length of the given edge +double DocumentModel::getLength(const QModelIndex& iEdge) +{ + // * Get the pointer to the edge + HEXA_NS::Edge* edge = getHexaPtr(iEdge); + HEXA_NS::EdgeShape* geomEdge = getHexaPtr(iEdge); + + // * The edge can be from VTK or OCC View + if (edge != NULL) + return edge->getLength(); + else if (geomEdge != NULL) + return geomEdge->getLength(); + else + return 0.; +} + +// Compute the radius of the given edge +double DocumentModel::getRadius(const QModelIndex& iEdge) +{ + // * Get the pointer to the edge + // * In our case only an OCC edge can have a radius + HEXA_NS::EdgeShape* edge = getHexaPtr(iEdge); + if (edge == NULL) + return 0.; + + return edge->getRadius(); +} + +// Compute the angle of the given edge (internal angle) +double DocumentModel::getAngle(const QModelIndex& iEdge) +{ + // * Get the pointer to the edge + HEXA_NS::EdgeShape* edge = getHexaPtr(iEdge); + if (edge == NULL) + return 0.; + + return edge->getAngle(); +} //Load the current Document void DocumentModel::load() @@ -512,7 +553,7 @@ void DocumentModel::fillData() void DocumentModel::fillGeometry() { PatternGeomSelectionModel* pgsm = HEXABLOCKGUI::currentDocGView->getPatternGeomSelectionModel(); - if (_hexaDocument == NULL || isEmpty() || pgsm == NULL) + if (_hexaDocument == NULL /*|| isEmpty()*/ || pgsm == NULL) return; HEXA_NS::NewShape* shape; @@ -1462,8 +1503,6 @@ QModelIndex DocumentModel::makeScale( const QModelIndex& ielts, const QModelInde return iElts; } - - QModelIndex DocumentModel::makeRotation( const QModelIndex& ielts, const QModelIndex& iv, const QModelIndex& ivec, double angle ) @@ -1666,7 +1705,7 @@ QModelIndex DocumentModel::replace( const QModelIndexList& iquadsPattern, } HEXA_NS::Elements* helts = _hexaDocument->replace( hquads, - hp1, hc1, hp2, hc2, hp3, hc3 ); + hp1, hc1, hp2, hc2, hp3, hc3 ); if ( BadElement(helts) ) return ielts; updateData(); @@ -1677,6 +1716,47 @@ QModelIndex DocumentModel::replace( const QModelIndexList& iquadsPattern, return ielts; } +QModelIndex DocumentModel::replace( const QModelIndexList& iquads_source, + const QModelIndexList& iquads_dest, + const QModelIndex& ip1_source, const QModelIndex& ic1_dest, + const QModelIndex& ip2_source, const QModelIndex& ic2_dest, + const QModelIndex& ip3_source, const QModelIndex& ic3_dest) +{ + QModelIndex ielts; + + HEXA_NS::Vertex* hp1 = getHexaPtr(ip1_source); + HEXA_NS::Vertex* hp2 = getHexaPtr(ip2_source); + HEXA_NS::Vertex* hp3 = getHexaPtr(ip3_source); + HEXA_NS::Vertex* hc1 = getHexaPtr(ic1_dest); + HEXA_NS::Vertex* hc2 = getHexaPtr(ic2_dest); + HEXA_NS::Vertex* hc3 = getHexaPtr(ic3_dest); + + HEXA_NS::Quads hquads_source, hquads_dest; + HEXA_NS::Quad* hquad = NULL; + foreach( const QModelIndex& iquad, iquads_source ){ + hquad = getHexaPtr(iquad); + hquads_source.push_back( hquad ); + } + + foreach( const QModelIndex& iquad, iquads_dest) { + hquad = getHexaPtr(iquad); + hquads_dest.push_back(hquad); + } + + HEXA_NS::Elements* helts = _hexaDocument->replaceHexas( hquads_source, + hquads_dest, + hp1, hc1, hp2, hc2, hp3, hc3); + if ( BadElement(helts) ) + return ielts; + + updateData(); + ElementsItem* eltsItem = new ElementsItem(helts); + _elementsDirItem->appendRow(eltsItem); + ielts = eltsItem->index(); + + return ielts; +} + QModelIndex DocumentModel::getGeomModelIndex(QString& id) const { QModelIndex result; @@ -2295,7 +2375,7 @@ QStandardItem* PatternDataModel::itemFromIndex ( const QModelIndex & index ) con //QVariant PatternBuilderModel::headerData ( int section, Qt::Orientation orientation, int role ) const //{ -// if ( section == 0 and orientation == Qt::Horizontal and role == Qt::DisplayRole ){ +// if ( section == 0 && orientation == Qt::Horizontal && role == Qt::DisplayRole ){ // return QVariant( "Builder" ); // } else { // return QSortFilterProxyModel::headerData ( section, orientation, role ); diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.hxx index 26d216d..a44306e 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.hxx @@ -74,6 +74,10 @@ namespace HEXABLOCK void refresh(); //refresh data bool isEmpty() const; + double getLength(const QModelIndex& iEdge); + double getRadius(const QModelIndex& iEdge); + double getAngle(const QModelIndex& iEdge); + void clearAll(); void clearData(); // void clearBuilder(); @@ -363,9 +367,14 @@ namespace HEXABLOCK bool performSymmetryPlane( const QModelIndex& elts, const QModelIndex& v, const QModelIndex& vec ); QModelIndex replace( const QModelIndexList& quadsPattern, - const QModelIndex& p1, const QModelIndex& c1, - const QModelIndex& p2, const QModelIndex& c2, - const QModelIndex& p3, const QModelIndex& c3 ); //NEW HEXA3 + const QModelIndex& ip1, const QModelIndex& ic1, + const QModelIndex& ip2, const QModelIndex& ic2, + const QModelIndex& ip3, const QModelIndex& ic3 ); //NEW HEXA3 + + QModelIndex replace( const QModelIndexList& iquads_source, const QModelIndexList& iquads_dest, + const QModelIndex& ip1_source, const QModelIndex& ic1_dest, + const QModelIndex& ip2_source, const QModelIndex& ic2_dest, + const QModelIndex& ip3_source, const QModelIndex& ic3_dest ); // ************ ASSOCIATION ************ @@ -480,7 +489,6 @@ namespace HEXABLOCK QStandardItem *_lawDirItem; QStandardItem *_propagationDirItem; - Qt::ItemFlags _vertexItemFlags; Qt::ItemFlags _edgeItemFlags; Qt::ItemFlags _quadItemFlags; @@ -493,7 +501,6 @@ namespace HEXABLOCK Qt::ItemFlags _groupItemFlags; Qt::ItemFlags _lawItemFlags; Qt::ItemFlags _propagationItemFlags; - }; diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.cxx index 6852676..0c4db33 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.cxx @@ -115,7 +115,6 @@ public: const QModelIndex &index) const{ QDoubleSpinBox *sb = new QDoubleSpinBox( parent ); sb->setMinimum(SPINBOX_POSITIVE_DOUBLE_MIN); - /////// sb->setMaximum(1000000000000000); //10e15 Abu : Pb en 32 bits sb->setMaximum(SPINBOX_DOUBLE_MAX); //10e9 sb->setDecimals(NB_DECIMALS); return sb; @@ -148,7 +147,6 @@ HexaBaseDialog::HexaBaseDialog( QWidget * parent, Mode editmode, Qt::WindowFlags _strHexaWidgetType[GEOMEDGE_TREE] = tr( "GEOMEDGE" ); _strHexaWidgetType[GEOMFACE_TREE] = tr( "GEOMFACE" ); - _strHexaWidgetType[GROUP_TREE] = tr( "GROUP" ); _strHexaWidgetType[LAW_TREE] = tr( "LAW" ); _strHexaWidgetType[PROPAGATION_TREE]= tr( "PROPAGATION" ); @@ -176,6 +174,59 @@ QModelIndexList HexaBaseDialog::getIndexList(QListWidget* itemsList, bool mapToS return iItems; } + +// ================================================================ computeAndSetDimension +void HexaBaseDialog::computeAndSetDimension(const QModelIndex& elt) +{ + // * Check if everything is OK for the computing + DocumentModel* docModel = getDocumentModel(); + if (docModel == NULL || _currentObj == NULL) + return; + + int selectedType = elt.data(HEXA_TREE_ROLE).toInt(); + if (selectedType != EDGE_TREE && selectedType != GEOMEDGE_TREE) + return; + + QListWidget* list = dynamic_cast(_currentObj); + QDoubleSpinBox* spb = dynamic_cast(_currentObj); + + if (list == NULL && spb == NULL) + return; + + // * Compute the value of the dimension + double value = 0.; + + if (_currentObj->property("Radius").isValid()) + value = docModel->getRadius(elt); + else if (_currentObj->property("Angle").isValid()) + value = docModel->getAngle(elt); + else if (_currentObj->property("Length").isValid()) + value = docModel->getLength(elt); + + if (value == 0.) + return; + + // * Set the value to the field (radius, length or height) + if (list != NULL) + { + QListWidgetItem* item = list->currentItem(); + if (item != NULL) + { + if (value != 0.) + { + item->setText(QString::number(value)); + list->editItem(item); + } + } + } + else if (spb != NULL) + { + spb->setValue(value); + spb->setFocus(); + spb->selectAll(); + } +} + // ============================================================= resetSizeAndShow void HexaBaseDialog::resetSizeAndShow(QDockWidget* parent) { @@ -278,6 +329,7 @@ void HexaBaseDialog::onCurrentSelectionChanged() highlightSelectedAssocs(); } +// ============================================================= clearCurrentObjectFocus void HexaBaseDialog::clearCurrentObjectFocus() { QWidget* currentWidget = dynamic_cast(_currentObj); @@ -426,21 +478,33 @@ void HexaBaseDialog::refreshHighlight() highlightSelectedAssocs(); } +bool HexaBaseDialog::isDimensionType(const QObject* obj) +{ + if (obj == NULL) + return false; + + return (obj->property("Radius").isValid()) || + (obj->property("Angle").isValid()) || + (obj->property("Length").isValid()); +} + // ============================================================== getObjectViewType HEXABLOCKGUI::ViewType HexaBaseDialog::getObjectViewType(QObject* obj) { if (obj == NULL) return HEXABLOCKGUI::UNKNOWN; - QVariant v = obj->property("GeomWidgetType"); - if ( v.isValid() ) - return HEXABLOCKGUI::OCC; + QVariant v1 = obj->property("GeomWidgetType"); + QVariant v2 = obj->property("HexaWidgetType"); - v = obj->property("HexaWidgetType"); - if ( v.isValid() ) + if (v1.isValid() && v2.isValid() && isDimensionType(obj)) + return HEXABLOCKGUI::VTK_OCC; + else if (v1.isValid()) + return HEXABLOCKGUI::OCC; + else if (v2.isValid()) return HEXABLOCKGUI::VTK; - - return HEXABLOCKGUI::UNKNOWN; + else + return HEXABLOCKGUI::UNKNOWN; } // ============================================================== _selectAndHighlight @@ -470,7 +534,6 @@ void HexaBaseDialog::_disallowSelection() // ============================================================== _allowVTKSelection bool HexaBaseDialog::_allowVTKSelection( QObject* obj ) { - bool isOk = false; QVariant v = obj->property("HexaWidgetType"); @@ -507,13 +570,16 @@ bool HexaBaseDialog::_allowOCCSelection( QObject* obj ) // ============================================================== _getSelector QItemSelectionModel* HexaBaseDialog::_getSelector( QObject* obj ) { + if (obj == NULL) + return NULL; + QItemSelectionModel* selector = NULL; HexaWidgetType wtype; QVariant v = obj->property("HexaWidgetType"); - if ( !v.isValid() ) { + QVariant v2 = obj->property("GeomWidgetType"); + if ( !v.isValid() || (v2.isValid() && isDimensionType(obj)) ) return NULL; - } wtype = v.value(); @@ -539,6 +605,7 @@ QItemSelectionModel* HexaBaseDialog::_getSelector( QObject* obj ) return selector; } +// ============================================================== getGeomObj DocumentModel::GeomObj* HexaBaseDialog::getGeomObj(const QModelIndex& index) { HEXA_NS::NewShape* aSh = getDocumentModel()->getHexaPtr(index); @@ -688,15 +755,29 @@ bool HexaBaseDialog::_onSelectionChanged( const QItemSelection& sel, QListWidget */ void HexaBaseDialog::onSelectionChanged( const QItemSelection& sel, const QItemSelection& unsel ) { + QModelIndexList l = sel.indexes(); + + if ( l.count() == 0 ) + return; + QModelIndex selected = l[0]; + // * no edition for Info Dialogs - if ( _editMode == INFO_MODE ) + if ( _editMode == INFO_MODE || _currentObj == NULL || !selected.isValid()) return; - QLineEdit* aLineEdit = NULL; - QListWidget* aListWidget = NULL; + if (isDimensionType(_currentObj)) + { + // ** set the dimension of the selected object in the editor **/ + int selectedType = selected.data(HEXA_TREE_ROLE).toInt(); + if (selectedType == EDGE_TREE || selectedType == GEOMEDGE_TREE) + computeAndSetDimension(selected); + return; + } + + QLineEdit* aLineEdit = dynamic_cast(_currentObj); + QListWidget* aListWidget = dynamic_cast(_currentObj); // * fill the lineedit with selection - aLineEdit = dynamic_cast(_currentObj); if ( aLineEdit) { _onSelectionChanged( sel, aLineEdit ); @@ -704,8 +785,7 @@ void HexaBaseDialog::onSelectionChanged( const QItemSelection& sel, const QItemS } // * fill the listWidget with selection - aListWidget = dynamic_cast(_currentObj); - if ( aListWidget) + if (aListWidget) _onSelectionChanged( sel, aListWidget ); } @@ -736,10 +816,8 @@ void HexaBaseDialog::hideEvent ( QHideEvent * event ) { //Disconnection salome selection signals if (HEXABLOCKGUI::selectionMgr() != NULL) - { disconnect( HEXABLOCKGUI::selectionMgr() , SIGNAL(currentSelectionChanged()), this, SLOT(onCurrentSelectionChanged()) ); - } //Disconnect vtk window activation signals // if (HEXABLOCKGUI::currentDocGView->getViewWindow() != NULL) @@ -755,7 +833,6 @@ void HexaBaseDialog::hideEvent ( QHideEvent * event ) //Disconnect model selection signals disconnectDocumentGraphicView(); - getDocumentModel()->allowEdition(); QDialog::hideEvent( event ); @@ -838,13 +915,14 @@ bool HexaBaseDialog::_isLineOrListWidget(QObject *widget) */ void HexaBaseDialog::_highlightWidget(QObject *obj, Qt::GlobalColor clr) { - if (!_isLineOrListWidget(obj)) return; + QDoubleSpinBox* spb = dynamic_cast(obj); + if (!_isLineOrListWidget(obj) && spb == NULL) + return; - QWidget *widget = dynamic_cast(obj); //sure it's not NULL (_isLineOrListWidget(obj)) + QWidget *widget = dynamic_cast(obj); QPalette palette1 = widget->palette(); - palette1.setColor(widget->backgroundRole(), clr); + palette1.setColor(QPalette::Active, widget->backgroundRole(), clr); widget->setPalette(palette1); - }//_highlightWidget @@ -884,13 +962,15 @@ bool HexaBaseDialog::eventFilter(QObject *obj, QEvent *event) return false; // * Focus In ------ - - // allow vtk selection - if (getObjectViewType(obj) == HEXABLOCKGUI::VTK) + HEXABLOCKGUI::ViewType vtype = getObjectViewType(obj); + if (vtype == HEXABLOCKGUI::VTK_OCC) + { + _allowVTKSelection(obj); + _allowOCCSelection(obj); + } + else if (vtype == HEXABLOCKGUI::VTK) _allowVTKSelection( obj ); - - //allow occ selection - if (getObjectViewType(obj) == HEXABLOCKGUI::OCC) + else if (vtype == HEXABLOCKGUI::OCC) _allowOCCSelection( obj ); //Depending on the focused widget type, get the right selector for it @@ -930,7 +1010,6 @@ VertexDialog::VertexDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ): _helpFileName = "gui_vertex.html"; setupUi( this ); _initWidget(editmode); - // setFocusProxy( name_le ); if ( editmode == NEW_MODE ){ setWindowTitle( tr("Vertex Construction") ); @@ -1056,7 +1135,7 @@ bool VertexDialog::apply(QModelIndex& result) } QString newName = name_le->text(); - if ( !newName.isEmpty() )/*{*/ + if ( !newName.isEmpty() ) getDocumentModel()->setName( iVertex, newName ); //the default name in the dialog box @@ -1067,8 +1146,6 @@ bool VertexDialog::apply(QModelIndex& result) // to select/highlight result result = patternDataModel->mapFromSource(iVertex); - // updateDialogBoxName(name_le, result); - // const char *defaultName = getDocumentModel()->getHexaPtr(last)->getName(); return isOk; } @@ -1083,9 +1160,6 @@ EdgeDialog::EdgeDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ): setupUi( this ); _initWidget(editmode); - // rb0->setFocusProxy( v0_le_rb0 ); - // rb1->setFocusProxy( vex_le_rb1 ); - if ( editmode == INFO_MODE ){ setWindowTitle( tr("Edge Information") ); rb1->hide(); @@ -1137,8 +1211,6 @@ void EdgeDialog::_initInputWidget( Mode editmode ) if (editmode == INFO_MODE) name_le->setReadOnly(true); - //connect( name_le, SIGNAL(returnPressed()), this, SLOT(updateName()) ); - } // ============================================================== Clear @@ -1536,7 +1608,6 @@ void HexaDialog::_initInputWidget( Mode editmode ) if (editmode == INFO_MODE) name_le->setReadOnly(true); - } // ============================================================== clear @@ -1718,9 +1789,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] ); } @@ -2134,7 +2205,6 @@ bool MakeGridDialog::apply(QModelIndex& result) iNewElts = docModel->makeCartesian( icenter, ibase, ivec, iaxis, radius, angles, heights); } - } if ( !iNewElts.isValid() ) @@ -2171,19 +2241,60 @@ MakeCylinderDialog::~MakeCylinderDialog() void MakeCylinderDialog::_initInputWidget( Mode editmode ) { - origin_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE)); - axis_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - base_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE)); - installEventFilter(this); - origin_le->installEventFilter(this); - axis_le->installEventFilter(this); - base_le->installEventFilter(this); + rb0->installEventFilter(this); + rb1->installEventFilter(this); + rb2->installEventFilter(this); + + origin_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE)); + origin_le->installEventFilter(this); origin_le->setReadOnly(true); + + axis_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + axis_le->installEventFilter(this); axis_le->setReadOnly(true); + + base_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE)); + base_le->installEventFilter(this); base_le->setReadOnly(true); + ext_radius_spb->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + ext_radius_spb->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + ext_radius_spb->setProperty("Radius", QVariant::fromValue(true)); + ext_radius_spb->installEventFilter(this); + + int_radius_spb->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + int_radius_spb->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + int_radius_spb->setProperty("Radius", QVariant::fromValue(true)); + int_radius_spb->installEventFilter(this); + + angle_spb->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + angle_spb->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + angle_spb->setProperty("Angle", QVariant::fromValue(true)); + angle_spb->installEventFilter(this); + + height_spb->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + height_spb->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + height_spb->setProperty("Length", QVariant::fromValue(true)); + height_spb->installEventFilter(this); + + radius_lw->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + radius_lw->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + radius_lw->setProperty("Radius", QVariant::fromValue(true)); + radius_lw->installEventFilter(this); + + + angle_lw->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + angle_lw->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + angle_lw->setProperty("Angle", QVariant::fromValue(true)); + angle_lw->installEventFilter(this); + + height_lw->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + height_lw->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + height_lw->setProperty("Length", QVariant::fromValue(true)); + height_lw->installEventFilter(this); + radius_lw->setItemDelegate(new HexaPositiveDoubleSpinBoxDelegate(radius_lw)); radius_lw->setEditTriggers(QAbstractItemView::DoubleClicked); @@ -2409,10 +2520,49 @@ void MakePipeDialog::_initInputWidget( Mode editmode ) axis_le->installEventFilter(this); base_le->installEventFilter(this); + rb0->installEventFilter(this); + rb1->installEventFilter(this); + rb2->installEventFilter(this); + origin_le->setReadOnly(true); axis_le->setReadOnly(true); base_le->setReadOnly(true); + ext_radius_spb->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + ext_radius_spb->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + ext_radius_spb->setProperty("Radius", QVariant::fromValue(true)); + ext_radius_spb->installEventFilter(this); + + int_radius_spb->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + int_radius_spb->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + int_radius_spb->setProperty("Radius", QVariant::fromValue(true)); + int_radius_spb->installEventFilter(this); + + angle_spb->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + angle_spb->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + angle_spb->setProperty("Angle", QVariant::fromValue(true)); + angle_spb->installEventFilter(this); + + height_spb->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + height_spb->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + height_spb->setProperty("Length", QVariant::fromValue(true)); + height_spb->installEventFilter(this); + + radius_lw->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + radius_lw->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + radius_lw->setProperty("Radius", QVariant::fromValue(true)); + radius_lw->installEventFilter(this); + + angle_lw->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + angle_lw->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + angle_lw->setProperty("Angle", QVariant::fromValue(true)); + angle_lw->installEventFilter(this); + + height_lw->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + height_lw->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + height_lw->setProperty("Length", QVariant::fromValue(true)); + height_lw->installEventFilter(this); + radius_lw->setItemDelegate(new HexaPositiveDoubleSpinBoxDelegate(radius_lw)); radius_lw->setEditTriggers(QAbstractItemView::DoubleClicked); @@ -2630,6 +2780,26 @@ void MakeCylindersDialog::_initInputWidget( Mode editmode ) direction_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); direction2_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + radius_spb->setProperty("HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + radius_spb->setProperty("GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + radius_spb->setProperty("Radius", QVariant::fromValue(true)); + radius_spb->installEventFilter(this); + + height_spb->setProperty("HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + height_spb->setProperty("GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + height_spb->setProperty("Length", QVariant::fromValue(true)); + height_spb->installEventFilter(this); + + radius2_spb->setProperty("HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + radius2_spb->setProperty("GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + radius2_spb->setProperty("Radius", QVariant::fromValue(true)); + radius2_spb->installEventFilter(this); + + height2_spb->setProperty("HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + height2_spb->setProperty("GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + height2_spb->setProperty("Length", QVariant::fromValue(true)); + height2_spb->installEventFilter(this); + installEventFilter(this); center_le->installEventFilter(this); center2_le->installEventFilter(this); @@ -2721,7 +2891,36 @@ void MakePipesDialog::_initInputWidget( Mode editmode ) dir_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); dir2_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - installEventFilter(this); + ext_radius_spb->setProperty("HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + ext_radius_spb->setProperty("GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + ext_radius_spb->setProperty("Radius", QVariant::fromValue(true)); + ext_radius_spb->installEventFilter(this); + + int_radius_spb->setProperty("HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + int_radius_spb->setProperty("GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + int_radius_spb->setProperty("Radius", QVariant::fromValue(true)); + int_radius_spb->installEventFilter(this); + + height_spb->setProperty("HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + height_spb->setProperty("GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + height_spb->setProperty("Length", QVariant::fromValue(true)); + height_spb->installEventFilter(this); + + ext_radius2_spb->setProperty("HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + ext_radius2_spb->setProperty("GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + ext_radius2_spb->setProperty("Radius", QVariant::fromValue(true)); + ext_radius2_spb->installEventFilter(this); + + int_radius2_spb->setProperty("HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + int_radius2_spb->setProperty("GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + int_radius2_spb->setProperty("Radius", QVariant::fromValue(true)); + int_radius2_spb->installEventFilter(this); + + height2_spb->setProperty("HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + height2_spb->setProperty("GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + height2_spb->setProperty("Length", QVariant::fromValue(true)); + height2_spb->installEventFilter(this); + origin_le->installEventFilter(this); origin2_le->installEventFilter(this); dir_le->installEventFilter(this); @@ -2909,10 +3108,25 @@ void PrismQuadDialog::_initInputWidget( Mode editmode ) quads_lw->setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); axis_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + length_spb->setProperty("HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + length_spb->setProperty("GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + length_spb->setProperty("Length", QVariant::fromValue(true)); + length_spb->installEventFilter(this); + + + height_lw->setProperty("HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + height_lw->setProperty("GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + height_lw->setProperty("Length", QVariant::fromValue(true)); + height_lw->installEventFilter(this); + installEventFilter(this); quads_lw->installEventFilter(this); axis_le->installEventFilter(this); + extrudeTop_rb->installEventFilter(this); + extrudeUni_rb->installEventFilter(this); + extrude_rb->installEventFilter(this); + axis_le->setReadOnly(true); QShortcut* delQuadShortcut = new QShortcut( QKeySequence(Qt::Key_X), quads_lw ); @@ -3095,6 +3309,11 @@ void JoinQuadDialog::_initInputWidget( Mode editmode ) vex2_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); vex3_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + height_lw->setProperty("HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + height_lw->setProperty("GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + height_lw->setProperty("Length", QVariant::fromValue(true)); + height_lw->installEventFilter(this); + installEventFilter(this); quad_dest_le->installEventFilter(this); quads_lw->installEventFilter(this); @@ -3103,6 +3322,9 @@ void JoinQuadDialog::_initInputWidget( Mode editmode ) vex2_le->installEventFilter(this); vex3_le->installEventFilter(this); + joinUni_rb->installEventFilter(this); + join_rb->installEventFilter(this); + QShortcut* delQuadShortcut = new QShortcut( QKeySequence(Qt::Key_X), quads_lw ); delQuadShortcut->setContext( Qt::WidgetShortcut ); connect( delQuadShortcut, SIGNAL(activated()), this, SLOT(removeQuad()) ); @@ -3753,8 +3975,16 @@ void CutEdgeDialog::_initInputWidget( Mode editmode ) e_le->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); e_le->installEventFilter(this); + cutUni_rb->installEventFilter(this); + cut_rb->installEventFilter(this); + e_le->setReadOnly(true); + height_lw->setProperty("HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + height_lw->setProperty("GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + height_lw->setProperty("Length", QVariant::fromValue(true)); + height_lw->installEventFilter(this); + height_lw->setItemDelegate(new HexaPositiveDoubleSpinBoxDelegate(height_lw)); height_lw->setEditTriggers(QAbstractItemView::DoubleClicked); @@ -3882,6 +4112,9 @@ void MakeTransformationDialog::_initInputWidget( Mode editmode ) QValidator *validator = new QRegExpValidator(rx, this); installEventFilter(this); + rb0->installEventFilter(this); + rb1->installEventFilter(this); + rb2->installEventFilter(this); vec_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); elts_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); @@ -3908,6 +4141,11 @@ void MakeTransformationDialog::_initInputWidget( Mode editmode ) vec_le_rb2->installEventFilter(this); elts_le_rb2->installEventFilter(this); + angle_spb->setProperty("HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + angle_spb->setProperty("GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + angle_spb->setProperty("Angle", QVariant::fromValue(true)); + angle_spb->installEventFilter(this); + vec_le_rb0->setReadOnly(true); elts_le_rb0->setReadOnly(true); @@ -4012,6 +4250,16 @@ bool MakeTransformationDialog::apply(QModelIndex& result) } result = patternDataModel->mapFromSource(iNewElts); + if (result.isValid()) + { + MESSAGE("======> Result is valid!"); + HEXA_NS::Elements* elts = getDocumentModel()->getHexaPtr(result); + MESSAGE("======> " << elts->getName()); + } + else + { + MESSAGE("======> Result is not valid!"); + } // result = patternBuilderModel->mapFromSource(iNewElts); return true; @@ -4209,6 +4457,11 @@ void PerformTransformationDialog::_initInputWidget( Mode editmode ) QRegExp rx(""); QValidator *validator = new QRegExpValidator(rx, this); + installEventFilter(this); + rb0->installEventFilter(this); + rb1->installEventFilter(this); + rb2->installEventFilter(this); + vec_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); elts_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); vec_le_rb0->setValidator( validator ); @@ -4234,6 +4487,11 @@ void PerformTransformationDialog::_initInputWidget( Mode editmode ) vec_le_rb2->installEventFilter(this); elts_le_rb2->installEventFilter(this); + angle_spb->setProperty("HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + angle_spb->setProperty("GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + angle_spb->setProperty("Angle", QVariant::fromValue(true)); + angle_spb->installEventFilter(this); + vec_le_rb0->setReadOnly(true); elts_le_rb0->setReadOnly(true); vex_le_rb1->setReadOnly(true); @@ -4854,7 +5112,6 @@ void QuadAssocDialog::_initInputWidget( Mode editmode ) quad_le->installEventFilter(this); quad_le->setValidator( validator ); - faces_lw->setProperty( "HexaWidgetType", QVariant::fromValue(GEOMFACE_TREE) ); faces_lw->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_FACE) ); faces_lw->installEventFilter(this); @@ -5642,6 +5899,8 @@ HexaBaseDialog(parent, editmode, f) _helpFileName = "gui_replace_hexa.html"; setupUi( this ); _initWidget(editmode); + + radioButton->click(); } // ============================================================== Destructeur @@ -5660,15 +5919,27 @@ QModelIndexList ReplaceHexaDialog::getAssocsVTK() QListWidgetItem* item = NULL; //ListWidget content - const PatternDataModel* patternDataModel = getPatternDataModel(); - if ( !patternDataModel ) return assocs; int nbQuads = quads_lw->count(); for ( int r = 0; r < nbQuads; ++r ){ item = quads_lw->item(r); - // iQuad = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); //unsafe + //iQuad = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); //unsafe iQuad = getPatternDataSelectionModel()->indexBy(HEXA_DATA_ROLE, item->data(LW_DATA_ROLE)); - if ( iQuad.isValid() ) assocs << iQuad; + if ( iQuad.isValid() ) + assocs << iQuad; } + + if (radioButton_2->isChecked()) + { + nbQuads = quads_lw_2->count(); + for( int i = 0; i < nbQuads; ++i) + { + item = quads_lw_2->item(i); + iQuad = getPatternDataSelectionModel()->indexBy(HEXA_DATA_ROLE, item->data(LW_DATA_ROLE)); + if (iQuad.isValid()) + assocs << iQuad; + } + } + return assocs; } @@ -5698,12 +5969,18 @@ void ReplaceHexaDialog::_initInputWidget( Mode editmode ) quads_lw->setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); quads_lw->installEventFilter(this); + quads_lw_2->setProperty("HexaWidgetType", QVariant::fromValue(QUAD_TREE)); + quads_lw_2->installEventFilter(this); + if ( editmode == NEW_MODE ){ QShortcut* delQuadShortcut = new QShortcut( QKeySequence(Qt::Key_X), quads_lw ); + QShortcut* delQuadShortcut2 = new QShortcut( QKeySequence(Qt::Key_X), quads_lw_2 ); delQuadShortcut->setContext( Qt::WidgetShortcut ); - + delQuadShortcut2->setContext( Qt::WidgetShortcut ); connect( delQuadShortcut, SIGNAL(activated()), this, SLOT(deleteQuadItem()) ); connect( quads_lw, SIGNAL(currentRowChanged(int)), this, SLOT(updateButtonBox(int)) ); + connect( delQuadShortcut2, SIGNAL(activated()), this, SLOT(deleteQuadItem2())); + connect( quads_lw_2, SIGNAL(currentRowChanged(int)), this, SLOT(updateButtonBox(int)) ); } c1_le->setReadOnly(true); @@ -5716,6 +5993,9 @@ void ReplaceHexaDialog::_initInputWidget( Mode editmode ) connect(quads_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfModel()), Qt::UniqueConnection); + + connect(quads_lw_2, SIGNAL(itemSelectionChanged()), + this, SLOT(selectElementOfModel()), Qt::UniqueConnection); } // ============================================================== clear @@ -5764,6 +6044,13 @@ void ReplaceHexaDialog::deleteQuadItem() updateButtonBox(); } +// ============================================================== deleteQuadItem2 +void ReplaceHexaDialog::deleteQuadItem2() +{ + delete quads_lw_2->currentItem(); + updateButtonBox(); +} + // ============================================================== apply bool ReplaceHexaDialog::apply(QModelIndex& result) { @@ -5778,30 +6065,53 @@ bool ReplaceHexaDialog::apply(QModelIndex& result) QModelIndex ielts; //result QListWidgetItem* item = NULL; - QModelIndexList iquads; + QModelIndexList iquads_source; QModelIndex iquad; int nbQuads = quads_lw->count(); for ( int r = 0; r < nbQuads; ++r){ item = quads_lw->item(r); iquad = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); if ( iquad.isValid() ) - iquads << iquad; + iquads_source << iquad; } - QModelIndex ic1 = patternDataModel->mapToSource( _index[c1_le] ); - QModelIndex ic2 = patternDataModel->mapToSource( _index[c2_le] ); - QModelIndex ic3 = patternDataModel->mapToSource( _index[c3_le] ); + QModelIndex ip1_source = patternDataModel->mapToSource( _index[p1_le] ); + QModelIndex ip2_source = patternDataModel->mapToSource( _index[p2_le] ); + QModelIndex ip3_source = patternDataModel->mapToSource( _index[p3_le] ); + + QModelIndex ic1_dest = patternDataModel->mapToSource( _index[c1_le] ); + QModelIndex ic2_dest = patternDataModel->mapToSource( _index[c2_le] ); + QModelIndex ic3_dest = patternDataModel->mapToSource( _index[c3_le] ); - QModelIndex ip1 = patternDataModel->mapToSource( _index[p1_le] ); - QModelIndex ip2 = patternDataModel->mapToSource( _index[p2_le] ); - QModelIndex ip3 = patternDataModel->mapToSource( _index[p3_le] ); + bool ipts_ok = ip1_source.isValid() && ip2_source.isValid() && ip3_source.isValid() && + ic1_dest.isValid() && ic2_dest.isValid() && ic3_dest.isValid(); - if ( ic1.isValid() && ic2.isValid() && ic3.isValid() - && ip1.isValid() && ip2.isValid() && ip3.isValid() ){ - ielts = getDocumentModel()->replace( iquads, - ip1, ic1, - ip2, ic2, - ip3, ic3 ); + if (ipts_ok) + { + if (radioButton->isChecked()) + { + ielts = getDocumentModel()->replace( iquads_source, + ip1_source, ic1_dest, + ip2_source, ic2_dest, + ip3_source, ic3_dest ); + } + else if (radioButton_2->isChecked()) + { + QModelIndexList iquads_dest; + nbQuads = quads_lw_2->count(); + for (int i = 0; i < nbQuads; ++i) + { + item = quads_lw_2->item(i); + iquad = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); + if (iquad.isValid()) + iquads_dest << iquad; + } + + ielts = getDocumentModel()->replace( iquads_source, iquads_dest, + ip1_source, ic1_dest, + ip2_source, ic2_dest, + ip3_source, ic3_dest); + } } if ( !ielts.isValid() ){ @@ -5873,7 +6183,20 @@ void QuadRevolutionDialog::_initInputWidget( Mode editmode ) center_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); axis_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + angle_spb->setProperty("HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + angle_spb->setProperty("GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + angle_spb->setProperty("Angle", QVariant::fromValue(true)); + angle_spb->installEventFilter(this); + + angles_lw->setProperty("HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + angles_lw->setProperty("GeomWidgetType", QVariant::fromValue(TopAbs_EDGE)); + angles_lw->setProperty("Angle", QVariant::fromValue(true)); + angles_lw->installEventFilter(this); + installEventFilter(this); + revolutionUni_rb->installEventFilter(this); + revolution_rb->installEventFilter(this); + quads_lw->installEventFilter(this); center_le->installEventFilter(this); axis_le->installEventFilter(this); @@ -6023,21 +6346,21 @@ MakeHemiSphereDialog::MakeHemiSphereDialog( QWidget* parent, Mode editmode, Qt:: connect( sphereTop_rb, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); connect( sphereUni_rb, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); - connect( sphere2_rb, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); - connect( sphere_rb, SIGNAL(clicked()), this, SLOT(clearVTKSelection()) ); - connect( sphere_rb, SIGNAL(clicked()), this, SLOT(clearCurrentObjectFocus()) ); + connect( sphere2_rb, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( sphere_rb, SIGNAL(clicked()), this, SLOT(clearVTKSelection()) ); + connect( sphere_rb, SIGNAL(clicked()), this, SLOT(clearCurrentObjectFocus()) ); connect( sphericalTop_rb, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); connect( sphericalUni_rb, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); - connect( spherical2_rb, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); - connect( spherical_rb, SIGNAL(clicked()), this, SLOT(clearVTKSelection()) ); - connect( spherical_rb, SIGNAL(clicked()), this, SLOT(clearCurrentObjectFocus()) ); + connect( spherical2_rb, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( spherical_rb, SIGNAL(clicked()), this, SLOT(clearVTKSelection()) ); + connect( spherical_rb, SIGNAL(clicked()), this, SLOT(clearCurrentObjectFocus()) ); connect( rindTop_rb, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); connect( rindUni_rb, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); - connect( rind2_rb, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); - connect( rind_rb, SIGNAL(clicked()), this, SLOT(clearVTKSelection()) ); - connect( rind_rb, SIGNAL(clicked()), this, SLOT(clearCurrentObjectFocus()) ); + connect( rind2_rb, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( rind_rb, SIGNAL(clicked()), this, SLOT(clearVTKSelection()) ); + connect( rind_rb, SIGNAL(clicked()), this, SLOT(clearCurrentObjectFocus()) ); } // ============================================================== Destructeur @@ -6053,12 +6376,66 @@ void MakeHemiSphereDialog::_initInputWidget( Mode editmode ) base_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); vplan_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + sphere_radext_spb->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); + sphere_radext_spb->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE) ); + sphere_radext_spb->setProperty("Radius", QVariant::fromValue(true)); + + sphere_radint_spb->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); + sphere_radint_spb->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE) ); + sphere_radint_spb->setProperty("Radius", QVariant::fromValue(true)); + + hole_rad_spb->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); + hole_rad_spb->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE) ); + hole_rad_spb->setProperty("Radius", QVariant::fromValue(true)); + + radial_angle_spb->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); + radial_angle_spb->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE) ); + radial_angle_spb->setProperty("Angle", QVariant::fromValue(true)); + + radius_lw_1->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); + radius_lw_1->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE) ); + radius_lw_1->setProperty("Radius", QVariant::fromValue(true)); + + radius_lw_2->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); + radius_lw_2->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE) ); + radius_lw_2->setProperty("Radius", QVariant::fromValue(true)); + + height_lw->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); + height_lw->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE) ); + height_lw->setProperty("Length", QVariant::fromValue(true)); + + angle_lw->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); + angle_lw->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE) ); + angle_lw->setProperty("Angle", QVariant::fromValue(true)); + installEventFilter(this); center_le->installEventFilter(this); hole_axis_le->installEventFilter(this); base_le->installEventFilter(this); vplan_le->installEventFilter(this); + sphere_radext_spb->installEventFilter(this); + sphere_radint_spb->installEventFilter(this); + hole_rad_spb->installEventFilter(this); + radial_angle_spb->installEventFilter(this); + radius_lw_1->installEventFilter(this); + radius_lw_2->installEventFilter(this); + height_lw->installEventFilter(this); + angle_lw->installEventFilter(this); + + sphere_rb->installEventFilter(this); + sphereTop_rb->installEventFilter(this); + sphereUni_rb->installEventFilter(this); + sphere2_rb->installEventFilter(this); + rind_rb->installEventFilter(this); + rindTop_rb->installEventFilter(this); + rindUni_rb->installEventFilter(this); + rind2_rb->installEventFilter(this); + spherical_rb->installEventFilter(this); + sphericalTop_rb->installEventFilter(this); + sphericalUni_rb->installEventFilter(this); + spherical2_rb->installEventFilter(this); + center_le->setReadOnly(true); hole_axis_le->setReadOnly(true); base_le->setReadOnly(true); diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.hxx index c123698..5f52285 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.hxx @@ -134,10 +134,6 @@ namespace HEXABLOCK return HEXABLOCKGUI::currentDocGView->getPatternGeomModel(); } -// PatternBuilderModel* getPatternBuilderModel() const { -// return HEXABLOCKGUI::currentDocGView->getPatternBuilderModel(); -// } - GroupsModel* getGroupsModel() const { return HEXABLOCKGUI::currentDocGView->getGroupsModel(); } @@ -151,10 +147,6 @@ namespace HEXABLOCK return HEXABLOCKGUI::currentDocGView->getPatternDataSelectionModel(); } -// PatternBuilderSelectionModel* getPatternBuilderSelectionModel() const { -// return HEXABLOCKGUI::currentDocGView->getPatternBuilderSelectionModel(); -// } - PatternGeomSelectionModel* getPatternGeomSelectionModel() const { return HEXABLOCKGUI::currentDocGView->getPatternGeomSelectionModel(); } @@ -183,6 +175,7 @@ namespace HEXABLOCK return assocs; } virtual void setCurrentGeomObj(DocumentModel::GeomObj* geomObj) {} + virtual void computeAndSetDimension(const QModelIndex& elt); bool debugEdgeAssoc; //Temporary bool autoFocusSwitch; @@ -229,13 +222,15 @@ namespace HEXABLOCK void _updateCurrentObject(QObject*); + bool isDimensionType(const QObject* obj); + Mode _editMode; - QMap _index; - QObject* _currentObj; + QMap _index; + QObject* _currentObj; QMap _strHexaWidgetType; - QPushButton* _applyButton; - QString _helpFileName; + QPushButton* _applyButton; + QString _helpFileName; private: bool _isLineOrListWidget(QObject*); @@ -251,8 +246,6 @@ namespace HEXABLOCK }; - - class HEXABLOCK_EXPORT VertexDialog : public HexaBaseDialog, public Ui::VertexDialog { @@ -560,9 +553,9 @@ namespace HEXABLOCK void updateHelpFileName(); private slots: - //void addQuad(); + void addQuad(); void removeQuad(); - //void clearQuads(); + void clearQuads(); }; @@ -590,9 +583,9 @@ namespace HEXABLOCK void updateHelpFileName(); private slots: - //void addQuad(); + void addQuad(); void removeQuad(); - //void clearQuads(); + void clearQuads(); }; @@ -909,7 +902,7 @@ class HEXABLOCK_EXPORT EdgeAssocDialog : public HexaBaseDialog, void _initInputWidget( Mode editmode ); protected slots: - //void updateHelpFileName(); + void updateHelpFileName(); void deletePropagationItem(); virtual void selectElementOfModel(); @@ -963,7 +956,9 @@ class HEXABLOCK_EXPORT EdgeAssocDialog : public HexaBaseDialog, protected slots: void deleteQuadItem(); + void deleteQuadItem2(); void updateButtonBox(); + void updateHelpFileName(); private: HEXA_NS::Elements *_value; diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.hxx index 923f1de..fcc7d46 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.hxx @@ -23,12 +23,12 @@ #include "HEXABLOCKGUI_Export.hxx" #include -#include +//#include -#include +//#include #include -#include "klinkitemselectionmodel.hxx" +//#include "klinkitemselectionmodel.hxx" #include "HEXABLOCKGUI_DocumentModel.hxx" diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_Model.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_Model.hxx index 9f3b3e2..0f5c2ee 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_Model.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_Model.hxx @@ -20,11 +20,11 @@ #ifndef _HEXABLOCKGUI_MODEL_HXX_ #define _HEXABLOCKGUI_MODEL_HXX_ -#include +#include "HEXABLOCKGUI_Export.hxx" -#include "hexa_base.hxx" +#include -class HexaExport HEXABLOCKGUI_Model : public SalomeApp_DataModel +class HEXABLOCK_EXPORT HEXABLOCKGUI_Model : public SalomeApp_DataModel { public: HEXABLOCKGUI_Model(CAM_Module* theModule); diff --git a/src/HEXABLOCK_SWIG/hexablock_swig.py b/src/HEXABLOCK_SWIG/hexablock_swig.py index 9be3a70..4453b2f 100644 --- a/src/HEXABLOCK_SWIG/hexablock_swig.py +++ b/src/HEXABLOCK_SWIG/hexablock_swig.py @@ -526,7 +526,6 @@ 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 @@ -535,6 +534,7 @@ KS_Parabola = _hexablock_swig.KS_Parabola KS_BezierCurve = _hexablock_swig.KS_BezierCurve KS_BSplineCurve = _hexablock_swig.KS_BSplineCurve KS_OtherCurve = _hexablock_swig.KS_OtherCurve +KS_None = _hexablock_swig.KS_None CylSmall = _hexablock_swig.CylSmall CylBig = _hexablock_swig.CylBig NxInt = _hexablock_swig.NxInt @@ -547,6 +547,7 @@ deg2radians = _hexablock_swig.deg2radians rad2degres = _hexablock_swig.rad2degres calc_norme = _hexablock_swig.calc_norme calc_distance = _hexablock_swig.calc_distance +calc_d2 = _hexablock_swig.calc_d2 calc_vecteur = _hexablock_swig.calc_vecteur copy_vecteur = _hexablock_swig.copy_vecteur calc_milieu = _hexablock_swig.calc_milieu @@ -561,6 +562,7 @@ set_special_option = _hexablock_swig.set_special_option sizeof_file = _hexablock_swig.sizeof_file read_file = _hexablock_swig.read_file get_time = _hexablock_swig.get_time +make_basename = _hexablock_swig.make_basename class EltBase(_object): __swig_setmethods__ = {} __setattr__ = lambda self, name, value: _swig_setattr(self, EltBase, name, value) @@ -666,9 +668,12 @@ class Edge(EltBase): __repr__ = _swig_repr def getVertex(*args): return _hexablock_swig.Edge_getVertex(*args) def addAssociation(*args): return _hexablock_swig.Edge_addAssociation(*args) + def setAssociation(*args): return _hexablock_swig.Edge_setAssociation(*args) + def findAssociation(*args): return _hexablock_swig.Edge_findAssociation(*args) def clearAssociation(*args): return _hexablock_swig.Edge_clearAssociation(*args) def setColor(*args): return _hexablock_swig.Edge_setColor(*args) def getWay(*args): return _hexablock_swig.Edge_getWay(*args) + def getLength(*args): return _hexablock_swig.Edge_getLength(*args) def __init__(self, *args): this = _hexablock_swig.new_Edge(*args) try: self.this.append(this) diff --git a/src/HEXABLOCK_SWIG/hexablock_swig_wrap.cc b/src/HEXABLOCK_SWIG/hexablock_swig_wrap.cc index 5b9833e..fa1932d 100644 --- a/src/HEXABLOCK_SWIG/hexablock_swig_wrap.cc +++ b/src/HEXABLOCK_SWIG/hexablock_swig_wrap.cc @@ -17136,6 +17136,37 @@ fail: } +SWIGINTERN PyObject *_wrap_calc_d2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + double *arg1 ; + double *arg2 ; + double result; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:calc_d2",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_double, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "calc_d2" "', argument " "1"" of type '" "double []""'"); + } + arg1 = reinterpret_cast< double * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_double, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "calc_d2" "', argument " "2"" of type '" "double []""'"); + } + arg2 = reinterpret_cast< double * >(argp2); + result = (double)Hex::calc_d2(arg1,arg2); + resultobj = SWIG_From_double(static_cast< double >(result)); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_calc_vecteur(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; double *arg1 ; @@ -17703,6 +17734,43 @@ fail: } +SWIGINTERN PyObject *_wrap_make_basename(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + cpchar arg1 = (cpchar) 0 ; + string *arg2 = 0 ; + int result; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:make_basename",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "make_basename" "', argument " "1"" of type '" "cpchar""'"); + } + arg1 = reinterpret_cast< cpchar >(buf1); + res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_string, 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "make_basename" "', argument " "2"" of type '" "string &""'"); + } + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "make_basename" "', argument " "2"" of type '" "string &""'"); + } + arg2 = reinterpret_cast< string * >(argp2); + result = (int)Hex::make_basename((char const *)arg1,*arg2); + resultobj = SWIG_From_int(static_cast< int >(result)); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + return resultobj; +fail: + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + return NULL; +} + + SWIGINTERN int Epsil_set(PyObject *) { SWIG_Error(SWIG_AttributeError,"Variable Epsil is read-only."); return 1; @@ -19779,6 +19847,77 @@ fail: } +SWIGINTERN PyObject *_wrap_Edge_setAssociation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Hex::Edge *arg1 = (Hex::Edge *) 0 ; + Hex::NewShape *arg2 = (Hex::NewShape *) 0 ; + int arg3 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + int val3 ; + int ecode3 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOO:Edge_setAssociation",&obj0,&obj1,&obj2)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Hex__Edge, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Edge_setAssociation" "', argument " "1"" of type '" "Hex::Edge *""'"); + } + arg1 = reinterpret_cast< Hex::Edge * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Hex__NewShape, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Edge_setAssociation" "', argument " "2"" of type '" "Hex::NewShape *""'"); + } + arg2 = reinterpret_cast< Hex::NewShape * >(argp2); + ecode3 = SWIG_AsVal_int(obj2, &val3); + if (!SWIG_IsOK(ecode3)) { + SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Edge_setAssociation" "', argument " "3"" of type '" "int""'"); + } + arg3 = static_cast< int >(val3); + result = (int)(arg1)->setAssociation(arg2,arg3); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + +SWIGINTERN PyObject *_wrap_Edge_findAssociation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Hex::Edge *arg1 = (Hex::Edge *) 0 ; + Hex::NewShape *arg2 = (Hex::NewShape *) 0 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OO:Edge_findAssociation",&obj0,&obj1)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Hex__Edge, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Edge_findAssociation" "', argument " "1"" of type '" "Hex::Edge *""'"); + } + arg1 = reinterpret_cast< Hex::Edge * >(argp1); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Hex__NewShape, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Edge_findAssociation" "', argument " "2"" of type '" "Hex::NewShape *""'"); + } + arg2 = reinterpret_cast< Hex::NewShape * >(argp2); + result = (int)(arg1)->findAssociation(arg2); + resultobj = SWIG_From_int(static_cast< int >(result)); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_Edge_clearAssociation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; Hex::Edge *arg1 = (Hex::Edge *) 0 ; @@ -19852,6 +19991,28 @@ fail: } +SWIGINTERN PyObject *_wrap_Edge_getLength(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + Hex::Edge *arg1 = (Hex::Edge *) 0 ; + double result; + void *argp1 = 0 ; + int res1 = 0 ; + PyObject * obj0 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"O:Edge_getLength",&obj0)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Hex__Edge, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Edge_getLength" "', argument " "1"" of type '" "Hex::Edge *""'"); + } + arg1 = reinterpret_cast< Hex::Edge * >(argp1); + result = (double)(arg1)->getLength(); + resultobj = SWIG_From_double(static_cast< double >(result)); + return resultobj; +fail: + return NULL; +} + + SWIGINTERN PyObject *_wrap_new_Edge(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; Hex::Vertex *arg1 = (Hex::Vertex *) 0 ; @@ -23342,17 +23503,14 @@ SWIGINTERN PyObject *_wrap_Document_replace(PyObject *SWIGUNUSEDPARM(self), PyOb PyObject *resultobj = 0; Hex::Document *arg1 = (Hex::Document *) 0 ; Hex::Quads arg2 ; - Hex::Vertex *arg3 = (Hex::Vertex *) 0 ; + Hex::Quads arg3 ; Hex::Vertex *arg4 = (Hex::Vertex *) 0 ; Hex::Vertex *arg5 = (Hex::Vertex *) 0 ; Hex::Vertex *arg6 = (Hex::Vertex *) 0 ; Hex::Vertex *arg7 = (Hex::Vertex *) 0 ; - Hex::Vertex *arg8 = (Hex::Vertex *) 0 ; Hex::Elements *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - void *argp3 = 0 ; - int res3 = 0 ; void *argp4 = 0 ; int res4 = 0 ; void *argp5 = 0 ; @@ -23361,8 +23519,6 @@ SWIGINTERN PyObject *_wrap_Document_replace(PyObject *SWIGUNUSEDPARM(self), PyOb int res6 = 0 ; void *argp7 = 0 ; int res7 = 0 ; - void *argp8 = 0 ; - int res8 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -23370,9 +23526,8 @@ SWIGINTERN PyObject *_wrap_Document_replace(PyObject *SWIGUNUSEDPARM(self), PyOb PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; PyObject * obj6 = 0 ; - PyObject * obj7 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOO:Document_replace",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:Document_replace",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Hex__Document, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Document_replace" "', argument " "1"" of type '" "Hex::Document *""'"); @@ -23387,11 +23542,15 @@ SWIGINTERN PyObject *_wrap_Document_replace(PyObject *SWIGUNUSEDPARM(self), PyOb arg2 = *ptr; if (SWIG_IsNewObj(res)) delete ptr; } - res3 = SWIG_ConvertPtr(obj2, &argp3,SWIGTYPE_p_Hex__Vertex, 0 | 0 ); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Document_replace" "', argument " "3"" of type '" "Hex::Vertex *""'"); + { + std::vector > *ptr = (std::vector > *)0; + int res = swig::asptr(obj2, &ptr); + if (!SWIG_IsOK(res) || !ptr) { + SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "Document_replace" "', argument " "3"" of type '" "Hex::Quads""'"); + } + arg3 = *ptr; + if (SWIG_IsNewObj(res)) delete ptr; } - arg3 = reinterpret_cast< Hex::Vertex * >(argp3); res4 = SWIG_ConvertPtr(obj3, &argp4,SWIGTYPE_p_Hex__Vertex, 0 | 0 ); if (!SWIG_IsOK(res4)) { SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "Document_replace" "', argument " "4"" of type '" "Hex::Vertex *""'"); @@ -23412,12 +23571,7 @@ SWIGINTERN PyObject *_wrap_Document_replace(PyObject *SWIGUNUSEDPARM(self), PyOb SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "Document_replace" "', argument " "7"" of type '" "Hex::Vertex *""'"); } arg7 = reinterpret_cast< Hex::Vertex * >(argp7); - res8 = SWIG_ConvertPtr(obj7, &argp8,SWIGTYPE_p_Hex__Vertex, 0 | 0 ); - if (!SWIG_IsOK(res8)) { - SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "Document_replace" "', argument " "8"" of type '" "Hex::Vertex *""'"); - } - arg8 = reinterpret_cast< Hex::Vertex * >(argp8); - result = (Hex::Elements *)(arg1)->replace(arg2,arg3,arg4,arg5,arg6,arg7,arg8); + result = (Hex::Elements *)(arg1)->replace(arg2,arg3,arg4,arg5,arg6,arg7); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Hex__Elements, 0 | 0 ); return resultobj; fail: @@ -31428,6 +31582,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"rad2degres", _wrap_rad2degres, METH_VARARGS, NULL}, { (char *)"calc_norme", _wrap_calc_norme, METH_VARARGS, NULL}, { (char *)"calc_distance", _wrap_calc_distance, METH_VARARGS, NULL}, + { (char *)"calc_d2", _wrap_calc_d2, METH_VARARGS, NULL}, { (char *)"calc_vecteur", _wrap_calc_vecteur, METH_VARARGS, NULL}, { (char *)"copy_vecteur", _wrap_copy_vecteur, METH_VARARGS, NULL}, { (char *)"calc_milieu", _wrap_calc_milieu, METH_VARARGS, NULL}, @@ -31444,6 +31599,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"sizeof_file", _wrap_sizeof_file, METH_VARARGS, NULL}, { (char *)"read_file", _wrap_read_file, METH_VARARGS, NULL}, { (char *)"get_time", _wrap_get_time, METH_VARARGS, NULL}, + { (char *)"make_basename", _wrap_make_basename, METH_VARARGS, NULL}, { (char *)"EltBase_countHexa", _wrap_EltBase_countHexa, METH_VARARGS, NULL}, { (char *)"EltBase_countQuad", _wrap_EltBase_countQuad, METH_VARARGS, NULL}, { (char *)"EltBase_countEdge", _wrap_EltBase_countEdge, METH_VARARGS, NULL}, @@ -31505,9 +31661,12 @@ static PyMethodDef SwigMethods[] = { { (char *)"Vertex_swigregister", Vertex_swigregister, METH_VARARGS, NULL}, { (char *)"Edge_getVertex", _wrap_Edge_getVertex, METH_VARARGS, NULL}, { (char *)"Edge_addAssociation", _wrap_Edge_addAssociation, METH_VARARGS, NULL}, + { (char *)"Edge_setAssociation", _wrap_Edge_setAssociation, METH_VARARGS, NULL}, + { (char *)"Edge_findAssociation", _wrap_Edge_findAssociation, METH_VARARGS, NULL}, { (char *)"Edge_clearAssociation", _wrap_Edge_clearAssociation, METH_VARARGS, NULL}, { (char *)"Edge_setColor", _wrap_Edge_setColor, METH_VARARGS, NULL}, { (char *)"Edge_getWay", _wrap_Edge_getWay, METH_VARARGS, NULL}, + { (char *)"Edge_getLength", _wrap_Edge_getLength, METH_VARARGS, NULL}, { (char *)"new_Edge", _wrap_new_Edge, METH_VARARGS, NULL}, { (char *)"delete_Edge", _wrap_delete_Edge, METH_VARARGS, NULL}, { (char *)"Edge_swigregister", Edge_swigregister, METH_VARARGS, NULL}, @@ -32686,7 +32845,6 @@ 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))); @@ -32695,6 +32853,7 @@ SWIGEXPORT void SWIG_init(void) { 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, "KS_None",SWIG_From_int(static_cast< int >(Hex::KS_None))); 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)));