void SetSizeMapEntry(in string entry,
in double size);
+ void UnsetSizeMapEntry(in string entry);
+
void SetSizeMap(in GEOM::GEOM_Object GeomObj,
in double size);
- void ClearSizeMaps();
+ void UnsetSizeMap(in GEOM::GEOM_Object GeomObj);
+
HexoticPluginSizeMapsList GetSizeMaps();
};
};
<hypothesis type="Hexotic_Parameters"
label-id="Hexotic Parameters"
icon-id="mesh_hypo_Hexotic.png"
- dim="3"/>
+ dim="3">
+ <python-wrap>
+ <accumulative-methods>
+ SetSizeMap
+ UnsetSizeMap
+ </accumulative-methods>
+ </python-wrap>
+ </hypothesis>
</hypotheses>
<algorithms>
HexoticPluginGUI_HypothesisCreator::HexoticPluginGUI_HypothesisCreator( const QString& theHypType )
: SMESHGUI_GenericHypothesisCreator( theHypType ),
myIs3D( true ),
- mySizeMapRemoved ( false )
+ mySizeMapsToRemove ()
{
}
myIs3D = true;
// Size Maps
+ mySizeMapsToRemove.clear();
connect( mySmpWidget->pushButton_1, SIGNAL( clicked() ), this, SLOT( onAddLocalSize() ) );
connect( mySmpWidget->pushButton_2, SIGNAL( clicked() ), this, SLOT( onRemoveLocalSize() ) );
if ( ranges.isEmpty() ) // If none is selected remove the last one
{
int lastRow = mySmpWidget->tableWidget->rowCount() - 1;
+ std::string entry = mySmpWidget->tableWidget->item( lastRow, ENTRY_COL )->text().toStdString();
+ mySizeMapsToRemove.push_back(entry);
mySmpWidget->tableWidget->removeRow( lastRow );
}
else
{
QTableWidgetSelectionRange& range = ranges.first();
+ for ( int row = range.topRow(); row < range.rowCount(); row++ )
+ {
+ std::string entry = mySmpWidget->tableWidget->item( row, ENTRY_COL )->text().toStdString();
+ mySizeMapsToRemove.push_back(entry);
+ }
mySmpWidget->tableWidget->model()->removeRows(range.topRow(), range.rowCount());
}
- mySizeMapRemoved = true;
}
//=================================================================================
HexoticPlugin_Hypothesis::THexoticSizeMaps::const_iterator it;
- // Clear size maps in hypothesis if one of them as been removed by the user
- if ( mySizeMapRemoved )
- h->ClearSizeMaps();
-
for ( it = h_data.mySizeMaps.begin(); it != h_data.mySizeMaps.end(); it++ )
{
- h->SetSizeMapEntry( it->first.c_str(), it->second );
- MESSAGE("STORING Size map : entry "<<it->first.c_str()<<" size : "<<it->second)
+ h->SetSizeMapEntry( it->first.c_str(), it->second );
+ MESSAGE("STORING Size map : entry "<<it->first.c_str()<<" size : "<<it->second)
+ }
+ std::vector< std::string >::const_iterator entry_it;
+ for ( entry_it = mySizeMapsToRemove.begin(); entry_it!= mySizeMapsToRemove.end(); entry_it++ )
+ {
+ h->UnsetSizeMapEntry(entry_it->c_str());
}
}
catch(const SALOME::SALOME_Exception& ex)
HexoticPluginGUI_SizeMapsWidget* mySmpWidget;
StdMeshersGUI_ObjectReferenceParamWdg* myGeomSelWdg;
- bool myIs3D;
- bool mySizeMapRemoved;
+ bool myIs3D;
+ std::vector< std::string > mySizeMapsToRemove;
protected slots:
void onAddLocalSize();
self.Parameters().SetSizeMap(theObject, theSize)
return self.Parameters()
- ## Clears all size maps : this is meant to be used only by the dump
- def ClearSizeMaps(self):
- self.Parameters().ClearSizeMaps()
+ ## Unsets a size map : this is meant to be used only by the dump
+ # @param theObject geometrical object to unassign local size
+ # @return hypothesis object
+ def UnsetSizeMap(self, theObject, theSize):
+ AssureGeomPublished( self.mesh, theObject )
+ self.Parameters().UnsetSizeMap(theObject)
return self.Parameters()
## (OBSOLETE) Defines "MinMaxQuad" hypothesis to give three hexotic parameters
}
}
-void HexoticPlugin_Hypothesis::ClearSizeMaps()
-{
- _sizeMaps.clear();
+bool HexoticPlugin_Hypothesis::UnsetSizeMap(std::string theEntry) {
+ THexoticSizeMaps::iterator it;
+ it=_sizeMaps.find(theEntry);
+ if( it != _sizeMaps.end() )
+ {
+ _sizeMaps.erase(it);
+ return true;
+ }
+ else
+ return false;
}
//=============================================================================
// For the GUI HexoticPluginGUI_HypothesisCreator::storeParamToHypo
THexoticSizeMaps GetSizeMaps() const { return _sizeMaps; };
- void ClearSizeMaps();
// Add one size map to the collection of size maps (user interface)
bool AddSizeMap(std::string theEntry, double theSize);
+ bool UnsetSizeMap(std::string theEntry);
// the parameters default values
static int GetDefaultHexesMinLevel();
void HexoticPlugin_Hypothesis_i::SetSizeMapEntry ( const char* theEntry, CORBA::Double theSize )
{
- MESSAGE("HexoticPlugin_Hypothesis_i::SetSizeMapEntry");
- std::string anEntry = theEntry;
+// MESSAGE("HexoticPlugin_Hypothesis_i::SetSizeMapEntry");
bool valueChanged = this->GetImpl()->AddSizeMap(theEntry, theSize);
- MESSAGE("valueChanged = "<<valueChanged);
if (valueChanged)
SMESH::TPythonDump() << _this() << ".SetSizeMap( "<< theEntry << ", " << theSize << " )";
}
+void HexoticPlugin_Hypothesis_i::UnsetSizeMapEntry ( const char* theEntry )
+{
+// MESSAGE("HexoticPlugin_Hypothesis_i::UnsetSizeMapEntry");
+ bool entryRemoved = this->GetImpl()->UnsetSizeMap(theEntry);
+ if (entryRemoved)
+ SMESH::TPythonDump() << _this() << ".UnsetSizeMap( "<< theEntry << " )";
+}
+
void HexoticPlugin_Hypothesis_i::SetSizeMap (const GEOM::GEOM_Object_ptr theGeomObj, const double theSize)
{
- MESSAGE("HexoticPlugin_Hypothesis_i::SetSizeMap");
+// MESSAGE("HexoticPlugin_Hypothesis_i::SetSizeMap");
ASSERT(myBaseImpl);
std::string entry = theGeomObj->GetStudyEntry();
SetSizeMapEntry( entry.c_str(), theSize);
}
-void HexoticPlugin_Hypothesis_i::ClearSizeMaps ()
+void HexoticPlugin_Hypothesis_i::UnsetSizeMap (const GEOM::GEOM_Object_ptr theGeomObj)
{
- this->GetImpl()->ClearSizeMaps();
- SMESH::TPythonDump() << _this() << ".ClearSizeMaps()";
+// MESSAGE("HexoticPlugin_Hypothesis_i::UnsetSizeMap");
+ ASSERT(myBaseImpl);
+ std::string entry = theGeomObj->GetStudyEntry();
+ UnsetSizeMapEntry( entry.c_str());
}
//=============================================================================
CORBA::Long GetHexoticMaxMemory();
void SetSizeMapEntry(const char* theEntry, CORBA::Double theSize);
+ void UnsetSizeMapEntry(const char* theEntry);
+
void SetSizeMap(GEOM::GEOM_Object_ptr theGeomObj, double theSize);
+ void UnsetSizeMap(GEOM::GEOM_Object_ptr theGeomObj);
HexoticPlugin::HexoticPluginSizeMapsList* GetSizeMaps ();
- void ClearSizeMaps();
// Get implementation
::HexoticPlugin_Hypothesis* GetImpl();