MESSAGE("BLSURFPluginGUI_HypothesisCreator::buildFrame");
QFrame* fr = new QFrame( 0 );
+ // fr-> setMinimumSize(600,400);
QVBoxLayout* lay = new QVBoxLayout( fr );
+ // lay->setSizeConstraint(QLayout::SetDefaultConstraint);
lay->setMargin( 5 );
lay->setSpacing( 0 );
// Size Maps parameters
mySmpGroup = new QWidget();
+ mySmpGroup->setMinimumWidth(450);
+// mySmpGroup->setMinimumHeight(300);
QGridLayout* anSmpLayout = new QGridLayout(mySmpGroup);
-
+ //anSmpLayout->setColumnStretch(0,1);
mySizeMapTable = new QTableWidget( 0, SMP_NB_COLUMNS, mySmpGroup );
//mySizeMapTable->setSortingEnabled(true);
QStringList sizeMapHeaders;
mySizeMapTable->verticalHeader()->hide();
mySizeMapTable->setShowGrid(true);
-/*
- addAttractorButton = new QPushButton(tr("BLSURF_SM_ATTRACTOR"),mySmpGroup);
- QFrame *line = new QFrame(mySmpGroup);
- line->setFrameShape(QFrame::HLine);
- line->setFrameShadow(QFrame::Sunken);
-*/
- //addSurfaceButton = new QPushButton(tr("BLSURF_SM_SURFACE"),mySmpGroup);
- //addEdgeButton = new QPushButton(tr("BLSURF_SM_EDGE"),mySmpGroup);
- //addPointButton = new QPushButton(tr("BLSURF_SM_POINT"),mySmpGroup);
-
// Filters of selection
TColStd_MapOfInteger SM_ShapeTypes, ATT_ShapeTypes;
Qt::ItemIsEnabled );
}
mySizeMapTable->setItem( row, SMP_DIST_COLUMN, new QTableWidgetItem( QString::number( that->myDistMap[entry], 'g', 6) ) );
- mySizeMapTable->item( row, SMP_DIST_COLUMN )->setFlags( 0 );
+ mySizeMapTable->item( row, SMP_DIST_COLUMN )->setFlags( Qt::ItemIsSelectable |
+ Qt::ItemIsEnabled );
}
mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN );
myAttractorGroup->setEnabled(true);
if (!myAttractorGroup->isChecked()){
myDistanceGroup->setEnabled(false);
+ myDistanceGroup->setChecked(false);
}
}
else
}
else{
myDistanceGroup->setEnabled(false);
+ myDistanceGroup->setChecked(false);
}
}
+void BLSURFPluginGUI_HypothesisCreator::onItemClicked(QTableWidgetItem * item)
+{
+ int row = item->row();
+ int col = item->column();
+ MESSAGE("BLSURFPluginGUI_HypothesisCreator::onCellClicked("<<row<<", "<<col<<")")
+ BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
+ if (col == SMP_SIZEMAP_COLUMN){
+ QString entry = that->mySizeMapTable->item(row, SMP_ENTRY_COLUMN)->text();
+ QString sizeMap = that->mySizeMapTable->item(row, SMP_SIZEMAP_COLUMN)->text().trimmed();
+
+ if (sizeMap.startsWith("Attractor :")){
+ myAttractorGroup->setChecked( true );
+ myDistanceGroup->setChecked( true );
+ myDistanceGroup->setEnabled( true );
+ double phySize = that->mySMPMap[entry].toDouble();
+ double infDist = that->myAttDistMap[entry];
+ QString attEntry = that->myATTMap[entry];
+ CORBA::Object_var attObj = entryToObject(attEntry);
+
+ myAttSelWdg->SetObject(attObj);
+ myAttSizeSpin->setValue(phySize);
+ myAttDistSpin->setValue(infDist);
+ }
+ else {
+ myAttractorGroup->setChecked( false );
+ }
+ CORBA::Object_var obj = entryToObject(entry);
+ double constDist = that->myDistMap[entry];
+
+ myGeomSelWdg->SetObject(obj);
+ mySmpDistSpin->setValue(constDist);
+ }
+}
+
+
void BLSURFPluginGUI_HypothesisCreator::onRemoveMap()
{
mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN);
}
-CORBA::Object_var BLSURFPluginGUI_HypothesisCreator::entryToObject(QString entry)
-{
- SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
- SALOMEDS::Study_ptr myStudy = smeshGen_i->GetCurrentStudy();
- CORBA::Object_var obj;
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::SObject_var aSObj = myStudy->FindObjectID( entry.toStdString().c_str() );
- if (!aSObj->_is_nil() && aSObj->FindAttribute(anAttr, "AttributeIOR")) {
- SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- CORBA::String_var aVal = anIOR->Value();
- obj = myStudy->ConvertIORToObject(aVal);
- }
- return obj;
-}
-
-void BLSURFPluginGUI_HypothesisCreator::onItemClicked(QTableWidgetItem * item)
-{
- int row = item->row();
- int col = item->column();
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::onCellClicked("<<row<<", "<<col<<")")
- BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
- if (col == SMP_SIZEMAP_COLUMN){
- QString entry = that->mySizeMapTable->item(row, SMP_ENTRY_COLUMN)->text();
- QString sizeMap = that->mySizeMapTable->item(row, SMP_SIZEMAP_COLUMN)->text().trimmed();
-
- if (sizeMap.startsWith("Attractor :")){
- myAttractorGroup->setChecked( true );
- myDistanceGroup->setChecked( true );
- double phySize = that->mySMPMap[entry].toDouble();
- double infDist = that->myAttDistMap[entry];
- QString attEntry = that->myATTMap[entry];
- CORBA::Object_var attObj = entryToObject(attEntry);
-
- myAttSelWdg->SetObject(attObj);
- myAttSizeSpin->setValue(phySize);
- myAttDistSpin->setValue(infDist);
- }
- else {
- myAttractorGroup->setChecked( false );
- }
- CORBA::Object_var obj = entryToObject(entry);
- double constDist = that->myDistMap[entry];
-
- myGeomSelWdg->SetObject(obj);
- mySmpDistSpin->setValue(constDist);
- }
-}
-
void BLSURFPluginGUI_HypothesisCreator::onSetSizeMap(int row,int col)
{
MESSAGE("BLSURFPluginGUI_HypothesisCreator::onSetSizeMap("<< row << "," << col << ")");
mySizeMapTable->setItem( row, SMP_SIZEMAP_COLUMN, new QTableWidgetItem( sizeMap ) );
mySizeMapTable->item( row, SMP_SIZEMAP_COLUMN )->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEditable |Qt::ItemIsEnabled );
mySizeMapTable->setItem( row, SMP_DIST_COLUMN, new QTableWidgetItem( ) );
- mySizeMapTable->item( row, SMP_DIST_COLUMN )->setFlags( 0 );
+ mySizeMapTable->item( row, SMP_DIST_COLUMN )->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEnabled );
mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN );
mySizeMapTable->resizeColumnToContents( SMP_SIZEMAP_COLUMN );
mySizeMapTable->resizeColumnToContents( SMP_DIST_COLUMN );
}
}
-int BLSURFPluginGUI_HypothesisCreator::findRowFromEntry(QString entry){
- QString entryForChecking;
- int endRow = mySizeMapTable->rowCount()-1;
- int row = 0;
- entryForChecking = mySizeMapTable->item( row, SMP_ENTRY_COLUMN )->text();
- while (entry != entryForChecking && row <= endRow){
- row++;
- entryForChecking = mySizeMapTable->item( row, SMP_ENTRY_COLUMN )->text();
- }
- MESSAGE("BLSURFPluginGUI_HypothesisCreator::findRowFromEntry; row = "<<row<<" , endRow ="<<endRow)
- return row;
-}
-
void BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aFace, GEOM::GEOM_Object_var anAttractor)
{
MESSAGE("BLSURFPluginGUI_HypothesisCreator::insertAttractor()");
int row = mySizeMapTable->rowCount();
int rowToChange;
- if (!that->mySMPMap.contains(shapeEntry)) {
+ if (!that->mySMPMap.contains(shapeEntry) || that->mySMPMap[shapeEntry] == "__TO_DELETE__") {
mySizeMapTable->setRowCount( row + 1 );
mySizeMapTable->setItem( row, SMP_ENTRY_COLUMN, new QTableWidgetItem( ) );
mySizeMapTable->item( row, SMP_ENTRY_COLUMN )->setFlags( 0 );
mySizeMapTable->setItem( row, SMP_SIZEMAP_COLUMN, new QTableWidgetItem( ) );
mySizeMapTable->item( row, SMP_SIZEMAP_COLUMN )->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEnabled );
mySizeMapTable->setItem( row, SMP_DIST_COLUMN, new QTableWidgetItem( ) );
- mySizeMapTable->item( row, SMP_DIST_COLUMN )->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEditable |Qt::ItemIsEnabled);
+ mySizeMapTable->item( row, SMP_DIST_COLUMN )->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEnabled);
rowToChange = row;
}
// if (that->mySMPMap[shapeEntry] != "__TO_DELETE__") {
mySizeMapTable->item( rowToChange, SMP_ENTRY_COLUMN )->setText(shapeEntry);
mySizeMapTable->item( rowToChange, SMP_NAME_COLUMN )->setText( QString::fromStdString(faceName));
mySizeMapTable->item( rowToChange, SMP_SIZEMAP_COLUMN )->setText(QString::fromStdString("Attractor : "+attName));
+ mySizeMapTable->item( rowToChange, SMP_SIZEMAP_COLUMN )->setFlags( Qt::ItemIsSelectable |Qt::ItemIsEnabled );
mySizeMapTable->item( rowToChange, SMP_DIST_COLUMN )->setText(constDistString );
mySizeMapTable->resizeColumnToContents( SMP_NAME_COLUMN );
mySizeMapTable->resizeColumnToContents( SMP_SIZEMAP_COLUMN );
return 0;
}
+CORBA::Object_var BLSURFPluginGUI_HypothesisCreator::entryToObject(QString entry)
+{
+ SMESH_Gen_i* smeshGen_i = SMESH_Gen_i::GetSMESHGen();
+ SALOMEDS::Study_ptr myStudy = smeshGen_i->GetCurrentStudy();
+ CORBA::Object_var obj;
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::SObject_var aSObj = myStudy->FindObjectID( entry.toStdString().c_str() );
+ if (!aSObj->_is_nil() && aSObj->FindAttribute(anAttr, "AttributeIOR")) {
+ SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ CORBA::String_var aVal = anIOR->Value();
+ obj = myStudy->ConvertIORToObject(aVal);
+ }
+ return obj;
+}
+
+int BLSURFPluginGUI_HypothesisCreator::findRowFromEntry(QString entry){
+ QString entryForChecking;
+ int endRow = mySizeMapTable->rowCount()-1;
+ int row = 0;
+ entryForChecking = mySizeMapTable->item( row, SMP_ENTRY_COLUMN )->text();
+ while (entry != entryForChecking && row <= endRow){
+ row++;
+ entryForChecking = mySizeMapTable->item( row, SMP_ENTRY_COLUMN )->text();
+ }
+ MESSAGE("BLSURFPluginGUI_HypothesisCreator::findRowFromEntry; row = "<<row<<" , endRow ="<<endRow)
+ return row;
+}
+