From 171a1a91703fce68cf83debefc344eadbf421730 Mon Sep 17 00:00:00 2001 From: gdd Date: Wed, 18 Feb 2009 15:56:00 +0000 Subject: [PATCH] SIGSEGV corrected Attractor button added (currently not used) --- src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx | 39 ++++++++++++------- src/GUI/BLSURFPluginGUI_HypothesisCreator.h | 3 +- src/GUI/BLSURFPlugin_msg_en.ts | 4 ++ 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx index 747c61e..5080e6d 100644 --- a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx @@ -208,7 +208,8 @@ BLSURFPluginGUI_HypothesisCreator::BLSURFPluginGUI_HypothesisCreator( const QStr cout << "BLSURFPluginGUI_HypothesisCreator::BLSURFPluginGUI_HypothesisCreator" << endl; this->mySMPMap.clear(); - this->getGeomSelectionTool(); + _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); + GeomToolSelected = new GeomSelectionTools(aStudy); /* Initialize the Python interpreter */ assert(Py_IsInitialized()); @@ -487,7 +488,7 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame() QGridLayout* anSmpLayout = new QGridLayout(mySmpGroup); mySizeMapTable = new QTableWidget( 0, SMP_NB_COLUMNS, mySmpGroup ); - anSmpLayout->addWidget(mySizeMapTable, 1, 0, 6, 1); + anSmpLayout->addWidget(mySizeMapTable, 1, 0, 8, 1); QStringList sizeMapHeaders; sizeMapHeaders << tr( "SMP_ENTRY_COLUMN" )<< tr( "SMP_NAME_COLUMN" ) << tr( "SMP_SIZEMAP_COLUMN" ); mySizeMapTable->setHorizontalHeaderLabels(sizeMapHeaders); @@ -497,22 +498,30 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame() mySizeMapTable->setAlternatingRowColors(true); mySizeMapTable->verticalHeader()->hide(); + addAttractorButton = new QPushButton(tr("BLSURF_SM_ATTRACTOR"),mySmpGroup); + anSmpLayout->addWidget(addAttractorButton, 1, 1, 1, 1); + + QFrame *line = new QFrame(mySmpGroup); + line->setFrameShape(QFrame::HLine); + line->setFrameShadow(QFrame::Sunken); + anSmpLayout->addWidget(line, 2, 1, 1, 1); + addSurfaceButton = new QPushButton(tr("BLSURF_SM_SURFACE"),mySmpGroup); - anSmpLayout->addWidget(addSurfaceButton, 1, 1, 1, 1); + anSmpLayout->addWidget(addSurfaceButton, 3, 1, 1, 1); addEdgeButton = new QPushButton(tr("BLSURF_SM_EDGE"),mySmpGroup); - anSmpLayout->addWidget(addEdgeButton, 2, 1, 1, 1); + anSmpLayout->addWidget(addEdgeButton, 4, 1, 1, 1); addPointButton = new QPushButton(tr("BLSURF_SM_POINT"),mySmpGroup); - anSmpLayout->addWidget(addPointButton, 3, 1, 1, 1); + anSmpLayout->addWidget(addPointButton, 5, 1, 1, 1); - QFrame *line = new QFrame(mySmpGroup); - line->setFrameShape(QFrame::HLine); - line->setFrameShadow(QFrame::Sunken); - anSmpLayout->addWidget(line, 4, 1, 1, 1); + QFrame *line2 = new QFrame(mySmpGroup); + line2->setFrameShape(QFrame::HLine); + line2->setFrameShadow(QFrame::Sunken); + anSmpLayout->addWidget(line2, 6, 1, 1, 1); removeButton = new QPushButton(tr("BLSURF_SM_REMOVE"),mySmpGroup); - anSmpLayout->addWidget(removeButton, 5, 1, 1, 1); + anSmpLayout->addWidget(removeButton, 7, 1, 1, 1); // --- @@ -596,7 +605,7 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const while (i.hasNext()) { i.next(); const QString entry = i.key(); - string shapeName = that->getGeomSelectionTool()->getNameFromEntry(entry.toStdString()); + string shapeName = GeomToolSelected->getNameFromEntry(entry.toStdString()); const QString sizeMap = i.value(); int row = mySizeMapTable->rowCount(); mySizeMapTable->setRowCount( row+1 ); @@ -681,7 +690,7 @@ bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData int pos = fullSizeMap.find("return")+7; QString sizeMap = QString::fromStdString(fullSizeMap.substr(pos, fullSizeMap.size()-pos)); that->mySMPMap[entry_sm[0]] = sizeMap; - that->mySMPShapeTypeMap[entry_sm[0]] = that->getGeomSelectionTool()->entryToShape(entry_sm[0].toStdString()).ShapeType(); + that->mySMPShapeTypeMap[entry_sm[0]] = GeomToolSelected->entryToShape(entry_sm[0].toStdString()).ShapeType(); MESSAGE("mySMPMap[" << entry_sm[0].toStdString() << "] = " << sizeMap.toStdString()); MESSAGE("mySMPShapeTypeMap[" << entry_sm[0].toStdString() << "] = " << that->mySMPShapeTypeMap[entry_sm[0]]); } @@ -1068,7 +1077,7 @@ void BLSURFPluginGUI_HypothesisCreator::insertElementType(TopAbs_ShapeEnum typeS TopoDS_Shape S; string entry, shapeName; - LightApp_SelectionMgr* aSel = that->getGeomSelectionTool()->selectionMgr(); + LightApp_SelectionMgr* aSel = GeomToolSelected->selectionMgr(); SALOME_ListIO ListSelectedObjects; aSel->selectedObjects(ListSelectedObjects, NULL, false ); if (!ListSelectedObjects.IsEmpty()) @@ -1077,9 +1086,9 @@ void BLSURFPluginGUI_HypothesisCreator::insertElementType(TopAbs_ShapeEnum typeS for (; Object_It.More(); Object_It.Next()) { Handle(SALOME_InteractiveObject) anObject = Object_It.Value(); - entry = that->getGeomSelectionTool()->getEntryOfObject(anObject); + entry = GeomToolSelected->getEntryOfObject(anObject); shapeName = anObject->getName(); - S = that->getGeomSelectionTool()->entryToShape(entry); + S = GeomToolSelected->entryToShape(entry); if ((! S.IsNull()) && (S.ShapeType() == typeShapeAsked)) { mySizeMapTable->setFocus(); diff --git a/src/GUI/BLSURFPluginGUI_HypothesisCreator.h b/src/GUI/BLSURFPluginGUI_HypothesisCreator.h index 1794574..2c85f45 100644 --- a/src/GUI/BLSURFPluginGUI_HypothesisCreator.h +++ b/src/GUI/BLSURFPluginGUI_HypothesisCreator.h @@ -139,8 +139,9 @@ private: QWidget *mySmpGroup; QTableWidget *mySizeMapTable; - QPushButton *addEdgeButton; + QPushButton *addAttractorButton; QPushButton *addSurfaceButton; + QPushButton *addEdgeButton; QPushButton *addPointButton; QPushButton *removeButton; diff --git a/src/GUI/BLSURFPlugin_msg_en.ts b/src/GUI/BLSURFPlugin_msg_en.ts index 5712ed2..5c33a10 100644 --- a/src/GUI/BLSURFPlugin_msg_en.ts +++ b/src/GUI/BLSURFPlugin_msg_en.ts @@ -123,6 +123,10 @@ BLSURF_SM_POINT Add Map on Point + + BLSURF_SM_ATTRACTOR + Add Attractor + BLSURF_SM_REMOVE Remove Map -- 2.39.2