mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-05 06:10:33 +05:00
Bug NPAL12872 - EDF189 GEOM, SMESH : Visualization of groups with many colors
This commit is contained in:
parent
068112a9e4
commit
1949fa0f3e
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include "SALOME_Exception.idl"
|
#include "SALOME_Exception.idl"
|
||||||
#include "SALOME_GenericObj.idl"
|
#include "SALOME_GenericObj.idl"
|
||||||
|
#include "SALOMEDS_Attributes.idl"
|
||||||
|
|
||||||
#include "SMESH_Mesh.idl"
|
#include "SMESH_Mesh.idl"
|
||||||
|
|
||||||
@ -86,14 +87,14 @@ module SMESH
|
|||||||
SMESH_Mesh GetMesh();
|
SMESH_Mesh GetMesh();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Sets group color number
|
* Sets group color
|
||||||
*/
|
*/
|
||||||
void SetColorNumber( in long color );
|
void SetColor(in SALOMEDS::Color theColor);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Returns group color number
|
* Returns group color
|
||||||
*/
|
*/
|
||||||
long GetColorNumber();
|
SALOMEDS::Color GetColor();
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -335,6 +335,20 @@ module SMESH
|
|||||||
void ClearLog()
|
void ClearLog()
|
||||||
raises (SALOME::SALOME_Exception);
|
raises (SALOME::SALOME_Exception);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Toggle auto color mode on the object.
|
||||||
|
* @params
|
||||||
|
* - theAutoColor : flag which toggles auto color mode.
|
||||||
|
*/
|
||||||
|
void SetAutoColor(in boolean theAutoColor)
|
||||||
|
raises (SALOME::SALOME_Exception);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Get flag of object's auto color mode.
|
||||||
|
*/
|
||||||
|
boolean GetAutoColor()
|
||||||
|
raises (SALOME::SALOME_Exception);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get the internal Id
|
* Get the internal Id
|
||||||
*/
|
*/
|
||||||
|
@ -129,6 +129,16 @@ DriverMED_Family
|
|||||||
return myElements.empty();
|
return myElements.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CompareColors( const SALOMEDS::Color& theColor, const SALOMEDS::Color& theRefColor )
|
||||||
|
{
|
||||||
|
if( fabs( theColor.R - theRefColor.R ) < 0.01 &&
|
||||||
|
fabs( theColor.G - theRefColor.G ) < 0.01 &&
|
||||||
|
fabs( theColor.B - theRefColor.B ) < 0.01 )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* Split each group from list <aGroups> on some parts (families)
|
* Split each group from list <aGroups> on some parts (families)
|
||||||
@ -201,11 +211,33 @@ DriverMED_Family
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Process groups
|
// Process groups
|
||||||
SMESHDS_GroupBasePtrList::const_iterator aGroupsIter = theGroups.begin();
|
SMESHDS_GroupBasePtrList::const_iterator aGroupsIter;
|
||||||
for (; aGroupsIter != theGroups.end(); aGroupsIter++)
|
|
||||||
|
int id = 0;
|
||||||
|
ColorMap aColorMap;
|
||||||
|
for (aGroupsIter = theGroups.begin(); aGroupsIter != theGroups.end(); aGroupsIter++)
|
||||||
|
{
|
||||||
|
SALOMEDS::Color aColor = (*aGroupsIter)->GetColor();
|
||||||
|
|
||||||
|
bool isFound = false;
|
||||||
|
for (ColorMap::iterator aColorIter = aColorMap.begin(); aColorIter != aColorMap.end(); aColorIter++)
|
||||||
|
{
|
||||||
|
SALOMEDS::Color aRefColor = aColorIter->second;
|
||||||
|
if( CompareColors( aColor, aRefColor ) )
|
||||||
|
{
|
||||||
|
isFound = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !isFound )
|
||||||
|
aColorMap[ id++ ] = aColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (aGroupsIter = theGroups.begin(); aGroupsIter != theGroups.end(); aGroupsIter++)
|
||||||
{
|
{
|
||||||
DriverMED_FamilyPtr aFam2 (new DriverMED_Family);
|
DriverMED_FamilyPtr aFam2 (new DriverMED_Family);
|
||||||
aFam2->Init(*aGroupsIter);
|
aFam2->Init(*aGroupsIter, aColorMap);
|
||||||
|
|
||||||
DriverMED_FamilyPtrList::iterator aFamsIter = aFamilies.begin();
|
DriverMED_FamilyPtrList::iterator aFamsIter = aFamilies.begin();
|
||||||
while (aFamsIter != aFamilies.end())
|
while (aFamsIter != aFamilies.end())
|
||||||
@ -364,7 +396,7 @@ DriverMED_Family::GetFamilyInfo(const MED::PWrapper& theWrapper,
|
|||||||
* Initialize the tool by SMESHDS_GroupBase
|
* Initialize the tool by SMESHDS_GroupBase
|
||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
void DriverMED_Family::Init (SMESHDS_GroupBase* theGroup)
|
void DriverMED_Family::Init (SMESHDS_GroupBase* theGroup, const ColorMap& theColorMap)
|
||||||
{
|
{
|
||||||
// Elements
|
// Elements
|
||||||
myElements.clear();
|
myElements.clear();
|
||||||
@ -383,11 +415,16 @@ void DriverMED_Family::Init (SMESHDS_GroupBase* theGroup)
|
|||||||
|
|
||||||
myGroupAttributVal = 0;
|
myGroupAttributVal = 0;
|
||||||
|
|
||||||
if (theGroup->GetColorGroup()!=0)
|
ColorMap::const_iterator aColorIter = theColorMap.begin();
|
||||||
|
for (; aColorIter != theColorMap.end(); aColorIter++)
|
||||||
|
{
|
||||||
|
SALOMEDS::Color aColor = aColorIter->second;
|
||||||
|
if( CompareColors( theGroup->GetColor(), aColor ) )
|
||||||
{
|
{
|
||||||
myGroupAttributVal = theGroup->GetColorGroup();
|
myGroupAttributVal = aColorIter->first;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -51,6 +51,7 @@ typedef std::list<DriverMED_FamilyPtr> DriverMED_FamilyPtrList;
|
|||||||
typedef std::map<int,SMESHDS_SubMesh*> SMESHDS_SubMeshPtrMap;
|
typedef std::map<int,SMESHDS_SubMesh*> SMESHDS_SubMeshPtrMap;
|
||||||
typedef std::list<SMESHDS_GroupBase*> SMESHDS_GroupBasePtrList;
|
typedef std::list<SMESHDS_GroupBase*> SMESHDS_GroupBasePtrList;
|
||||||
typedef std::set<const SMDS_MeshElement*> ElementsSet;
|
typedef std::set<const SMDS_MeshElement*> ElementsSet;
|
||||||
|
typedef std::map<int,SALOMEDS::Color> ColorMap;
|
||||||
|
|
||||||
class MESHDRIVERMED_EXPORT DriverMED_Family
|
class MESHDRIVERMED_EXPORT DriverMED_Family
|
||||||
{
|
{
|
||||||
@ -107,7 +108,7 @@ class MESHDRIVERMED_EXPORT DriverMED_Family
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
//! Initialize the tool by SMESHDS_GroupBase
|
//! Initialize the tool by SMESHDS_GroupBase
|
||||||
void Init (SMESHDS_GroupBase* group);
|
void Init (SMESHDS_GroupBase* theGroup, const ColorMap& theColorMap);
|
||||||
|
|
||||||
//! Split <theSubMesh> on some parts (families) on the basis of the elements type.
|
//! Split <theSubMesh> on some parts (families) on the basis of the elements type.
|
||||||
static
|
static
|
||||||
|
@ -34,6 +34,9 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <TopoDS_Shape.hxx>
|
#include <TopoDS_Shape.hxx>
|
||||||
|
|
||||||
|
#include "SALOMEconfig.h"
|
||||||
|
#include CORBA_SERVER_HEADER(SALOMEDS)
|
||||||
|
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
|
||||||
|
|
||||||
class SMESHDS_GroupBase;
|
class SMESHDS_GroupBase;
|
||||||
class SMESH_Mesh;
|
class SMESH_Mesh;
|
||||||
@ -55,8 +58,8 @@ class SMESH_EXPORT SMESH_Group
|
|||||||
|
|
||||||
SMESHDS_GroupBase * GetGroupDS () { return myGroupDS; }
|
SMESHDS_GroupBase * GetGroupDS () { return myGroupDS; }
|
||||||
|
|
||||||
void SetColorNumber (int theColorNumber) { myColorNumber = theColorNumber; }
|
void SetColor (const SALOMEDS::Color& theColor) { myColor = theColor; }
|
||||||
int GetColorNumber() const { return myColorNumber; }
|
SALOMEDS::Color GetColor() const { return myColor; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SMESH_Group (const SMESH_Group& theOther);
|
SMESH_Group (const SMESH_Group& theOther);
|
||||||
@ -67,6 +70,7 @@ class SMESH_EXPORT SMESH_Group
|
|||||||
SMESHDS_GroupBase * myGroupDS;
|
SMESHDS_GroupBase * myGroupDS;
|
||||||
std::string myName;
|
std::string myName;
|
||||||
int myColorNumber;
|
int myColorNumber;
|
||||||
|
SALOMEDS::Color myColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -98,6 +98,7 @@ SMESH_Mesh::SMESH_Mesh(int theLocalId,
|
|||||||
_idDoc = theDocument->NewMesh(theIsEmbeddedMode);
|
_idDoc = theDocument->NewMesh(theIsEmbeddedMode);
|
||||||
_myMeshDS = theDocument->GetMesh(_idDoc);
|
_myMeshDS = theDocument->GetMesh(_idDoc);
|
||||||
_isShapeToMesh = false;
|
_isShapeToMesh = false;
|
||||||
|
_isAutoColor = false;
|
||||||
_myMeshDS->ShapeToMesh( PseudoShape() );
|
_myMeshDS->ShapeToMesh( PseudoShape() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -871,6 +872,23 @@ void SMESH_Mesh::NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* h
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* Auto color functionality
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
void SMESH_Mesh::SetAutoColor(bool theAutoColor) throw(SALOME_Exception)
|
||||||
|
{
|
||||||
|
Unexpect aCatch(SalomeException);
|
||||||
|
_isAutoColor = theAutoColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SMESH_Mesh::GetAutoColor() throw(SALOME_Exception)
|
||||||
|
{
|
||||||
|
Unexpect aCatch(SalomeException);
|
||||||
|
return _isAutoColor;
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*! Export* methods.
|
/*! Export* methods.
|
||||||
* To store mesh contents on disk in different formats.
|
* To store mesh contents on disk in different formats.
|
||||||
|
@ -174,6 +174,10 @@ public:
|
|||||||
// return list of ancestors of theSubShape in the order
|
// return list of ancestors of theSubShape in the order
|
||||||
// that lower dimention shapes come first.
|
// that lower dimention shapes come first.
|
||||||
|
|
||||||
|
void SetAutoColor(bool theAutoColor) throw(SALOME_Exception);
|
||||||
|
|
||||||
|
bool GetAutoColor() throw(SALOME_Exception);
|
||||||
|
|
||||||
/*! Check group names for duplications.
|
/*! Check group names for duplications.
|
||||||
* Consider maximum group name length stored in MED file.
|
* Consider maximum group name length stored in MED file.
|
||||||
*/
|
*/
|
||||||
@ -249,6 +253,8 @@ protected:
|
|||||||
map <int, SMESH_subMesh *> _mapSubMesh;
|
map <int, SMESH_subMesh *> _mapSubMesh;
|
||||||
map <int, SMESH_Group *> _mapGroup;
|
map <int, SMESH_Group *> _mapGroup;
|
||||||
SMESH_Gen * _gen;
|
SMESH_Gen * _gen;
|
||||||
|
|
||||||
|
bool _isAutoColor;
|
||||||
|
|
||||||
TopTools_IndexedDataMapOfShapeListOfShape _mapAncestors;
|
TopTools_IndexedDataMapOfShapeListOfShape _mapAncestors;
|
||||||
|
|
||||||
|
@ -41,8 +41,11 @@ SMESHDS_GroupBase::SMESHDS_GroupBase (const int theID,
|
|||||||
const SMESHDS_Mesh* theMesh,
|
const SMESHDS_Mesh* theMesh,
|
||||||
const SMDSAbs_ElementType theType):
|
const SMDSAbs_ElementType theType):
|
||||||
myID(theID), myMesh(theMesh), myType(theType), myStoreName(""),
|
myID(theID), myMesh(theMesh), myType(theType), myStoreName(""),
|
||||||
myCurIndex(0), myCurID(-1), myColorGroup(0)
|
myCurIndex(0), myCurID(-1)
|
||||||
{
|
{
|
||||||
|
myColor.R = 0.f;
|
||||||
|
myColor.G = 0.f;
|
||||||
|
myColor.B = 0.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -33,6 +33,10 @@
|
|||||||
#include "SMDSAbs_ElementType.hxx"
|
#include "SMDSAbs_ElementType.hxx"
|
||||||
#include "SMDS_MeshElement.hxx"
|
#include "SMDS_MeshElement.hxx"
|
||||||
|
|
||||||
|
#include "SALOMEconfig.h"
|
||||||
|
#include CORBA_SERVER_HEADER(SALOMEDS)
|
||||||
|
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
|
||||||
|
|
||||||
class SMESHDS_Mesh;
|
class SMESHDS_Mesh;
|
||||||
|
|
||||||
class SMESHDS_EXPORT SMESHDS_GroupBase
|
class SMESHDS_EXPORT SMESHDS_GroupBase
|
||||||
@ -68,11 +72,11 @@ class SMESHDS_EXPORT SMESHDS_GroupBase
|
|||||||
|
|
||||||
virtual ~SMESHDS_GroupBase() {}
|
virtual ~SMESHDS_GroupBase() {}
|
||||||
|
|
||||||
void SetColorGroup (int theColorGroup)
|
void SetColor (const SALOMEDS::Color& theColor)
|
||||||
{ myColorGroup = theColorGroup;}
|
{ myColor = theColor;}
|
||||||
|
|
||||||
int GetColorGroup() const
|
SALOMEDS::Color GetColor() const
|
||||||
{ return myColorGroup;}
|
{ return myColor;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const SMDS_MeshElement* findInMesh (const int theID) const;
|
const SMDS_MeshElement* findInMesh (const int theID) const;
|
||||||
@ -92,7 +96,7 @@ class SMESHDS_EXPORT SMESHDS_GroupBase
|
|||||||
int myCurIndex;
|
int myCurIndex;
|
||||||
int myCurID;
|
int myCurID;
|
||||||
SMDS_ElemIteratorPtr myIterator;
|
SMDS_ElemIteratorPtr myIterator;
|
||||||
int myColorGroup;
|
SALOMEDS::Color myColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -500,12 +500,81 @@ using namespace std;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetDisplayMode(int theCommandID){
|
void AutoColor(){
|
||||||
|
SALOME_ListIO selected;
|
||||||
|
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
|
||||||
|
if( !app )
|
||||||
|
return;
|
||||||
|
|
||||||
|
LightApp_SelectionMgr* aSel = app->selectionMgr();
|
||||||
|
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
|
||||||
|
if( !aSel || !appStudy )
|
||||||
|
return;
|
||||||
|
|
||||||
|
aSel->selectedObjects( selected );
|
||||||
|
if( selected.IsEmpty() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Handle(SALOME_InteractiveObject) anIObject = selected.First();
|
||||||
|
|
||||||
|
_PTR(Study) aStudy = appStudy->studyDS();
|
||||||
|
_PTR(SObject) aMainSObject( aStudy->FindObjectID( anIObject->getEntry() ) );
|
||||||
|
SMESH::SMESH_Mesh_var aMainObject = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
|
||||||
|
if( aMainObject->_is_nil() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
aMainObject->SetAutoColor( true );
|
||||||
|
|
||||||
|
QValueList<SALOMEDS::Color> aReservedColors;
|
||||||
|
|
||||||
|
SMESH::ListOfGroups aListOfGroups = *aMainObject->GetGroups();
|
||||||
|
for( int i = 0, n = aListOfGroups.length(); i < n; i++ )
|
||||||
|
{
|
||||||
|
SMESH::SMESH_GroupBase_var aGroupObject = aListOfGroups[i];
|
||||||
|
SALOMEDS::Color aCurrentColor = aGroupObject->GetColor();
|
||||||
|
|
||||||
|
SALOMEDS::Color aColor = SMESHGUI::getUniqueColor( aReservedColors );
|
||||||
|
aGroupObject->SetColor( aColor );
|
||||||
|
aReservedColors.append( aColor );
|
||||||
|
|
||||||
|
_PTR(SObject) aGroupSObject = SMESH::FindSObject(aGroupObject);
|
||||||
|
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aGroupSObject->GetID().c_str()))
|
||||||
|
anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B );
|
||||||
|
}
|
||||||
|
|
||||||
|
SMESH::RepaintCurrentView();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisableAutoColor(){
|
||||||
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
||||||
SALOME_ListIO selected;
|
SALOME_ListIO selected;
|
||||||
if( aSel )
|
if( aSel )
|
||||||
aSel->selectedObjects( selected );
|
aSel->selectedObjects( selected );
|
||||||
|
|
||||||
|
if(selected.Extent()){
|
||||||
|
Handle(SALOME_InteractiveObject) anIObject = selected.First();
|
||||||
|
SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
|
||||||
|
if ( !aMesh->_is_nil() ) {
|
||||||
|
aMesh->SetAutoColor( false );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetDisplayMode(int theCommandID){
|
||||||
|
SALOME_ListIO selected;
|
||||||
|
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
|
||||||
|
if( !app )
|
||||||
|
return;
|
||||||
|
|
||||||
|
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
||||||
|
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
|
||||||
|
if( !aSel || !appStudy )
|
||||||
|
return;
|
||||||
|
|
||||||
|
_PTR(Study) aStudy = appStudy->studyDS();
|
||||||
|
|
||||||
|
aSel->selectedObjects( selected );
|
||||||
|
|
||||||
if(selected.Extent() >= 1){
|
if(selected.Extent() >= 1){
|
||||||
switch(theCommandID){
|
switch(theCommandID){
|
||||||
case 1134:{
|
case 1134:{
|
||||||
@ -611,6 +680,16 @@ using namespace std;
|
|||||||
vtkFloatingPointType (nodecolor.blue()) / 255.);
|
vtkFloatingPointType (nodecolor.blue()) / 255.);
|
||||||
anActor->SetNodeSize(aDlg->GetIntValue(2));
|
anActor->SetNodeSize(aDlg->GetIntValue(2));
|
||||||
|
|
||||||
|
SMESH::SMESH_GroupBase_var aGroupObject = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
|
||||||
|
if( !aGroupObject->_is_nil() )
|
||||||
|
{
|
||||||
|
SALOMEDS::Color aColor;
|
||||||
|
aColor.R = (float)color.red() / 255.0;
|
||||||
|
aColor.G = (float)color.green() / 255.0;
|
||||||
|
aColor.B = (float)color.blue() / 255.0;
|
||||||
|
aGroupObject->SetColor( aColor );
|
||||||
|
}
|
||||||
|
|
||||||
delete aDlg;
|
delete aDlg;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1237,6 +1316,15 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Auto-color
|
||||||
|
case 1136:
|
||||||
|
::AutoColor();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1137:
|
||||||
|
::DisableAutoColor();
|
||||||
|
break;
|
||||||
|
|
||||||
case 1134: // Clipping
|
case 1134: // Clipping
|
||||||
case 1133: // Tranparency
|
case 1133: // Tranparency
|
||||||
case 1132: // Colors / Size
|
case 1132: // Colors / Size
|
||||||
@ -2422,6 +2510,8 @@ void SMESHGUI::initialize( CAM_Application* app )
|
|||||||
createSMESHAction( 1133, "TRANSP" );
|
createSMESHAction( 1133, "TRANSP" );
|
||||||
createSMESHAction( 1134, "CLIP" );
|
createSMESHAction( 1134, "CLIP" );
|
||||||
createSMESHAction( 1135, "DISP_ENT" );
|
createSMESHAction( 1135, "DISP_ENT" );
|
||||||
|
createSMESHAction( 1136, "AUTO_COLOR" );
|
||||||
|
createSMESHAction( 1137, "DISABLE_AUTO_COLOR" );
|
||||||
createSMESHAction( 2000, "CTRL" );
|
createSMESHAction( 2000, "CTRL" );
|
||||||
|
|
||||||
createSMESHAction( 300, "ERASE" );
|
createSMESHAction( 300, "ERASE" );
|
||||||
@ -2698,6 +2788,10 @@ void SMESHGUI::initialize( CAM_Application* app )
|
|||||||
createPopupItem( 902, View, mesh ); // STD_INFO
|
createPopupItem( 902, View, mesh ); // STD_INFO
|
||||||
popupMgr()->insert( separator(), -1, 0 );
|
popupMgr()->insert( separator(), -1, 0 );
|
||||||
|
|
||||||
|
createPopupItem( 1136, OB + " " + View, mesh, "&& (not isAutoColor)" ); // AUTO_COLOR
|
||||||
|
createPopupItem( 1137, OB + " " + View, mesh, "&& isAutoColor" ); // DISABLE_AUTO_COLOR
|
||||||
|
popupMgr()->insert( separator(), -1, 0 );
|
||||||
|
|
||||||
int anId;
|
int anId;
|
||||||
QString
|
QString
|
||||||
isInvisible("not( isVisible )"),
|
isInvisible("not( isVisible )"),
|
||||||
@ -2718,6 +2812,10 @@ void SMESHGUI::initialize( CAM_Application* app )
|
|||||||
aType = aType.arg( mesh_group );
|
aType = aType.arg( mesh_group );
|
||||||
QString aMeshInVTK = aClient + "&&" + aType;
|
QString aMeshInVTK = aClient + "&&" + aType;
|
||||||
|
|
||||||
|
aClient = "($client in {'VTKViewer' 'ObjectBrowser'})";
|
||||||
|
QString anActiveVTK = QString("activeView = '%1'").arg(SVTK_Viewer::Type());
|
||||||
|
QString aSelCount = QString( "%1 > 0" ).arg( QtxPopupMgr::Selection::defSelCountParam() );
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// Numbering
|
// Numbering
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
@ -2885,10 +2983,6 @@ void SMESHGUI::initialize( CAM_Application* app )
|
|||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// Display / Erase
|
// Display / Erase
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
aClient = "($client in {'VTKViewer' 'ObjectBrowser'})";
|
|
||||||
QString anActiveVTK = QString("activeView = '%1'").arg(SVTK_Viewer::Type());
|
|
||||||
QString aSelCount = QString( "%1 > 0" ).arg( QtxPopupMgr::Selection::defSelCountParam() );
|
|
||||||
|
|
||||||
QString aRule = "$component={'SMESH'} and ( type='Component' or (" + aClient + " and " +
|
QString aRule = "$component={'SMESH'} and ( type='Component' or (" + aClient + " and " +
|
||||||
aType + " and " + aSelCount + " and " + anActiveVTK + " and " + isNotEmpty + " %1 ) )";
|
aType + " and " + aSelCount + " and " + anActiveVTK + " and " + isNotEmpty + " %1 ) )";
|
||||||
popupMgr()->insert( action( 301 ), -1, -1 ); // DISPLAY
|
popupMgr()->insert( action( 301 ), -1, -1 ); // DISPLAY
|
||||||
@ -3335,3 +3429,61 @@ LightApp_Displayer* SMESHGUI::displayer()
|
|||||||
myDisplayer = new SMESHGUI_Displayer( getApp() );
|
myDisplayer = new SMESHGUI_Displayer( getApp() );
|
||||||
return myDisplayer;
|
return myDisplayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SALOMEDS::Color SMESHGUI::getUniqueColor( const QValueList<SALOMEDS::Color>& theReservedColors )
|
||||||
|
{
|
||||||
|
int aHue = -1;
|
||||||
|
int aTolerance = 64;
|
||||||
|
int anIterations = 0;
|
||||||
|
int aPeriod = 5;
|
||||||
|
|
||||||
|
while( 1 )
|
||||||
|
{
|
||||||
|
anIterations++;
|
||||||
|
if( anIterations % aPeriod == 0 )
|
||||||
|
{
|
||||||
|
aTolerance /= 2;
|
||||||
|
if( aTolerance < 1 )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
//cout << "Iteration N" << anIterations << " (tolerance=" << aTolerance << ")"<< endl;
|
||||||
|
|
||||||
|
aHue = (int)( 360.0 * rand() / RAND_MAX );
|
||||||
|
//cout << "Hue = " << aHue << endl;
|
||||||
|
|
||||||
|
//cout << "Auto colors : ";
|
||||||
|
bool ok = true;
|
||||||
|
QValueList<SALOMEDS::Color>::const_iterator it = theReservedColors.constBegin();
|
||||||
|
QValueList<SALOMEDS::Color>::const_iterator itEnd = theReservedColors.constEnd();
|
||||||
|
for( ; it != itEnd; ++it )
|
||||||
|
{
|
||||||
|
SALOMEDS::Color anAutoColor = *it;
|
||||||
|
QColor aQColor( (int)( anAutoColor.R * 255.0 ), (int)( anAutoColor.G * 255.0 ), (int)( anAutoColor.B * 255.0 ) );
|
||||||
|
|
||||||
|
int h, s, v;
|
||||||
|
aQColor.getHsv( &h, &s, &v );
|
||||||
|
//cout << h << " ";
|
||||||
|
if( abs( h - aHue ) < aTolerance )
|
||||||
|
{
|
||||||
|
ok = false;
|
||||||
|
//cout << "break (diff = " << abs( h - aHue ) << ")";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//cout << endl;
|
||||||
|
|
||||||
|
if( ok )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//cout << "Hue of the returned color = " << aHue << endl;
|
||||||
|
QColor aColor;
|
||||||
|
aColor.setHsv( aHue, 255, 255 );
|
||||||
|
|
||||||
|
SALOMEDS::Color aSColor;
|
||||||
|
aSColor.R = (double)aColor.red() / 255.0;
|
||||||
|
aSColor.G = (double)aColor.green() / 255.0;
|
||||||
|
aSColor.B = (double)aColor.blue() / 255.0;
|
||||||
|
|
||||||
|
return aSColor;
|
||||||
|
}
|
||||||
|
@ -109,6 +109,8 @@ public :
|
|||||||
|
|
||||||
virtual void update( const int );
|
virtual void update( const int );
|
||||||
|
|
||||||
|
static SALOMEDS::Color getUniqueColor( const QValueList<SALOMEDS::Color>& );
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual bool deactivateModule( SUIT_Study* );
|
virtual bool deactivateModule( SUIT_Study* );
|
||||||
virtual bool activateModule( SUIT_Study* );
|
virtual bool activateModule( SUIT_Study* );
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
|
|
||||||
#include "SMESH_TypeFilter.hxx"
|
#include "SMESH_TypeFilter.hxx"
|
||||||
#include "SMESH_Actor.h"
|
#include "SMESH_Actor.h"
|
||||||
|
#include "SMESH_ActorUtils.h"
|
||||||
|
|
||||||
#include "GEOMBase.h"
|
#include "GEOMBase.h"
|
||||||
#include "GEOM_SelectionFilter.h"
|
#include "GEOM_SelectionFilter.h"
|
||||||
@ -82,6 +83,7 @@
|
|||||||
#include <qpixmap.h>
|
#include <qpixmap.h>
|
||||||
#include <qmemarray.h>
|
#include <qmemarray.h>
|
||||||
#include <qwidgetstack.h>
|
#include <qwidgetstack.h>
|
||||||
|
#include <qcolordialog.h>
|
||||||
|
|
||||||
#include <QtxIntSpinBox.h>
|
#include <QtxIntSpinBox.h>
|
||||||
|
|
||||||
@ -321,16 +323,10 @@ void SMESHGUI_GroupDlg::initDialog(bool create)
|
|||||||
QGroupBox* aColorBox = new QGroupBox(2, Qt::Horizontal, this, "color box");
|
QGroupBox* aColorBox = new QGroupBox(2, Qt::Horizontal, this, "color box");
|
||||||
aColorBox->setTitle(tr("SMESH_SET_COLOR"));
|
aColorBox->setTitle(tr("SMESH_SET_COLOR"));
|
||||||
|
|
||||||
mySelectColorGroup = new QCheckBox(aColorBox, "color checkbox");
|
new QLabel( tr("SMESH_CHECK_COLOR"), aColorBox, "color label" );
|
||||||
mySelectColorGroup->setText(tr("SMESH_CHECK_COLOR"));
|
myColorBtn = new QPushButton(aColorBox, "color button");
|
||||||
|
myColorBtn->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
||||||
myColorSpinBox = new QtxIntSpinBox( aColorBox );
|
|
||||||
myColorSpinBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
|
||||||
myColorSpinBox->setMinValue( 0 );
|
|
||||||
myColorSpinBox->setMaxValue( 9999 );
|
|
||||||
|
|
||||||
onSelectColorGroup(false);
|
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
QFrame* aButtons = new QFrame(this, "button box");
|
QFrame* aButtons = new QFrame(this, "button box");
|
||||||
@ -391,8 +387,7 @@ void SMESHGUI_GroupDlg::initDialog(bool create)
|
|||||||
connect(mySubMeshBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
|
connect(mySubMeshBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
|
||||||
connect(myGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
|
connect(myGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
|
||||||
connect(myGeomGroupBtn, SIGNAL(toggled(bool)), this, SLOT(onGeomSelectionButton(bool)));
|
connect(myGeomGroupBtn, SIGNAL(toggled(bool)), this, SLOT(onGeomSelectionButton(bool)));
|
||||||
connect(mySelectColorGroup, SIGNAL(toggled(bool)), this, SLOT(onSelectColorGroup(bool)));
|
connect(myColorBtn, SIGNAL(clicked()), this, SLOT(onSelectColor()));
|
||||||
connect(myColorSpinBox, SIGNAL(valueChanged(const QString&)), this, SLOT(onNbColorsChanged(const QString&)));
|
|
||||||
|
|
||||||
connect(aOKBtn, SIGNAL(clicked()), this, SLOT(onOK()));
|
connect(aOKBtn, SIGNAL(clicked()), this, SLOT(onOK()));
|
||||||
connect(aApplyBtn, SIGNAL(clicked()), this, SLOT(onApply()));
|
connect(aApplyBtn, SIGNAL(clicked()), this, SLOT(onApply()));
|
||||||
@ -453,6 +448,8 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_Mesh_ptr theMesh)
|
|||||||
myActor = SMESH::FindActorByObject(myMesh);
|
myActor = SMESH::FindActorByObject(myMesh);
|
||||||
SMESH::SetPickable(myActor);
|
SMESH::SetPickable(myActor);
|
||||||
|
|
||||||
|
setDefaultGroupColor();
|
||||||
|
|
||||||
SALOME_ListIO aList;
|
SALOME_ListIO aList;
|
||||||
mySelectionMgr->selectedObjects( aList );
|
mySelectionMgr->selectedObjects( aList );
|
||||||
if( !aList.IsEmpty() )
|
if( !aList.IsEmpty() )
|
||||||
@ -479,7 +476,8 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup)
|
|||||||
myName->setText(theGroup->GetName());
|
myName->setText(theGroup->GetName());
|
||||||
myName->home(false);
|
myName->home(false);
|
||||||
|
|
||||||
myColorSpinBox->setValue( theGroup->GetColorNumber() );
|
SALOMEDS::Color aColor = theGroup->GetColor();
|
||||||
|
setGroupColor( aColor );
|
||||||
|
|
||||||
myMeshGroupLine->setText(theGroup->GetName());
|
myMeshGroupLine->setText(theGroup->GetName());
|
||||||
|
|
||||||
@ -581,15 +579,6 @@ void SMESHGUI_GroupDlg::onNameChanged (const QString& text)
|
|||||||
updateButtons();
|
updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : onNbColorsChanged()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void SMESHGUI_GroupDlg::onNbColorsChanged (const QString& text)
|
|
||||||
{
|
|
||||||
updateButtons();
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : onTypeChanged()
|
// function : onTypeChanged()
|
||||||
// purpose : Group elements type radio button management
|
// purpose : Group elements type radio button management
|
||||||
@ -617,6 +606,19 @@ void SMESHGUI_GroupDlg::onGrpTypeChanged (int id)
|
|||||||
myGrpTypeId = id;
|
myGrpTypeId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : onSelectColor()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_GroupDlg::onSelectColor()
|
||||||
|
{
|
||||||
|
QColor color = getGroupQColor();
|
||||||
|
color = QColorDialog::getColor( color );
|
||||||
|
setGroupQColor( color );
|
||||||
|
|
||||||
|
updateButtons();
|
||||||
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : setSelectionMode()
|
// function : setSelectionMode()
|
||||||
// purpose : Radio button management
|
// purpose : Radio button management
|
||||||
@ -713,25 +715,28 @@ bool SMESHGUI_GroupDlg::onApply()
|
|||||||
myGroup = SMESH::AddGroup(myMesh, aType, myName->text());
|
myGroup = SMESH::AddGroup(myMesh, aType, myName->text());
|
||||||
myGroup->Add(anIdList.inout());
|
myGroup->Add(anIdList.inout());
|
||||||
|
|
||||||
int aColorNumber = myColorSpinBox->value();
|
SALOMEDS::Color aColor = getGroupColor();
|
||||||
myGroup->SetColorNumber(aColorNumber);
|
myGroup->SetColor(aColor);
|
||||||
|
|
||||||
_PTR(SObject) aMeshGroupSO = SMESH::FindSObject(myGroup);
|
_PTR(SObject) aMeshGroupSO = SMESH::FindSObject(myGroup);
|
||||||
|
|
||||||
SMESH::setFileName ( aMeshGroupSO, QString::number(myColorSpinBox->value()) );
|
//SMESH::setFileName ( aMeshGroupSO, QString::number(myColorSpinBox->value()) );
|
||||||
SMESH::setFileType ( aMeshGroupSO, "COULEURGROUP" );
|
SMESH::setFileType ( aMeshGroupSO, "COULEURGROUP" );
|
||||||
|
|
||||||
/* init for next operation */
|
/* init for next operation */
|
||||||
myName->setText("");
|
myName->setText("");
|
||||||
myColorSpinBox->setValue(0);
|
|
||||||
myElements->clear();
|
myElements->clear();
|
||||||
myGroup = SMESH::SMESH_Group::_nil();
|
myGroup = SMESH::SMESH_Group::_nil();
|
||||||
|
|
||||||
} else { // edition
|
} else { // edition
|
||||||
myGroup->SetName(myName->text());
|
myGroup->SetName(myName->text());
|
||||||
|
|
||||||
int aColorNumber = myColorSpinBox->value();
|
SALOMEDS::Color aColor = getGroupColor();
|
||||||
myGroup->SetColorNumber(aColorNumber);
|
myGroup->SetColor(aColor);
|
||||||
|
|
||||||
|
_PTR(SObject) aMeshGroupSO = SMESH::FindSObject(myGroup);
|
||||||
|
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str()))
|
||||||
|
anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B );
|
||||||
|
|
||||||
QValueList<int> aAddList;
|
QValueList<int> aAddList;
|
||||||
QValueList<int>::iterator anIt;
|
QValueList<int>::iterator anIt;
|
||||||
@ -836,25 +841,27 @@ bool SMESHGUI_GroupDlg::onApply()
|
|||||||
myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType, myName->text(), aGroupVar);
|
myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType, myName->text(), aGroupVar);
|
||||||
}
|
}
|
||||||
|
|
||||||
int aColorNumber = myColorSpinBox->value();
|
SALOMEDS::Color aColor = getGroupColor();
|
||||||
myGroupOnGeom->SetColorNumber(aColorNumber);
|
myGroupOnGeom->SetColor(aColor);
|
||||||
|
|
||||||
_PTR(SObject) aMeshGroupSO = SMESH::FindSObject(myGroupOnGeom);
|
_PTR(SObject) aMeshGroupSO = SMESH::FindSObject(myGroupOnGeom);
|
||||||
|
|
||||||
SMESH::setFileName ( aMeshGroupSO, QString::number(myColorSpinBox->value()) );
|
//SMESH::setFileName ( aMeshGroupSO, QString::number(myColorSpinBox->value()) );
|
||||||
|
|
||||||
SMESH::setFileType ( aMeshGroupSO,"COULEURGROUP" );
|
SMESH::setFileType ( aMeshGroupSO,"COULEURGROUP" );
|
||||||
|
|
||||||
/* init for next operation */
|
/* init for next operation */
|
||||||
myName->setText("");
|
myName->setText("");
|
||||||
myColorSpinBox->setValue(0);
|
|
||||||
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
|
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
|
||||||
}
|
}
|
||||||
else { // edition
|
else { // edition
|
||||||
myGroupOnGeom->SetName(myName->text());
|
myGroupOnGeom->SetName(myName->text());
|
||||||
|
|
||||||
int aColorNumber = myColorSpinBox->value();
|
SALOMEDS::Color aColor = getGroupColor();
|
||||||
myGroupOnGeom->SetColorNumber(aColorNumber);
|
myGroupOnGeom->SetColor(aColor);
|
||||||
|
|
||||||
|
_PTR(SObject) aMeshGroupSO = SMESH::FindSObject(myGroupOnGeom);
|
||||||
|
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str()))
|
||||||
|
anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B );
|
||||||
}
|
}
|
||||||
|
|
||||||
mySMESHGUI->updateObjBrowser(true);
|
mySMESHGUI->updateObjBrowser(true);
|
||||||
@ -1222,17 +1229,6 @@ void SMESHGUI_GroupDlg::onSelectGeomGroup(bool on)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : (onSelectColorGroup)
|
|
||||||
// purpose : Called when setting a color on group
|
|
||||||
//=================================================================================
|
|
||||||
void SMESHGUI_GroupDlg::onSelectColorGroup(bool on)
|
|
||||||
{
|
|
||||||
if (!on)
|
|
||||||
myColorSpinBox->setValue(0);
|
|
||||||
|
|
||||||
myColorSpinBox->setEnabled(on);
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : setCurrentSelection()
|
// function : setCurrentSelection()
|
||||||
@ -1854,3 +1850,95 @@ void SMESHGUI_GroupDlg::onCloseShapeByMeshDlg(SUIT_Operation* op)
|
|||||||
setSelectionMode(7);
|
setSelectionMode(7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : setGroupColor()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_GroupDlg::setGroupColor( const SALOMEDS::Color& theColor )
|
||||||
|
{
|
||||||
|
QColor aQColor( (int)( theColor.R * 255.0 ),
|
||||||
|
(int)( theColor.G * 255.0 ),
|
||||||
|
(int)( theColor.B * 255.0 ) );
|
||||||
|
setGroupQColor( aQColor );
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : getGroupColor()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
SALOMEDS::Color SMESHGUI_GroupDlg::getGroupColor() const
|
||||||
|
{
|
||||||
|
QColor aQColor = getGroupQColor();
|
||||||
|
|
||||||
|
SALOMEDS::Color aColor;
|
||||||
|
aColor.R = (float)aQColor.red() / 255.0;
|
||||||
|
aColor.G = (float)aQColor.green() / 255.0;
|
||||||
|
aColor.B = (float)aQColor.blue() / 255.0;
|
||||||
|
|
||||||
|
return aColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : setGroupQColor()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_GroupDlg::setGroupQColor( const QColor& theColor )
|
||||||
|
{
|
||||||
|
if( theColor.isValid() )
|
||||||
|
{
|
||||||
|
QPalette pal = myColorBtn->palette();
|
||||||
|
pal.setColor(QColorGroup::Button, theColor);
|
||||||
|
myColorBtn->setPalette(pal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : getGroupQColor()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
QColor SMESHGUI_GroupDlg::getGroupQColor() const
|
||||||
|
{
|
||||||
|
QColor aColor = myColorBtn->palette().active().button();
|
||||||
|
return aColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : setDefaultGroupColor()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void SMESHGUI_GroupDlg::setDefaultGroupColor()
|
||||||
|
{
|
||||||
|
if( myMesh->_is_nil() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
bool isAutoColor = myMesh->GetAutoColor();
|
||||||
|
|
||||||
|
QColor aQColor;
|
||||||
|
if( !isAutoColor )
|
||||||
|
{
|
||||||
|
int r = 0, g = 0, b = 0;
|
||||||
|
SMESH::GetColor( "SMESH", "fill_color", r, g, b, QColor( 0, 170, 255 ) );
|
||||||
|
aQColor.setRgb( r, g, b );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SMESH::ListOfGroups aListOfGroups = *myMesh->GetGroups();
|
||||||
|
|
||||||
|
QValueList<SALOMEDS::Color> aReservedColors;
|
||||||
|
for( int i = 0, n = aListOfGroups.length(); i < n; i++ )
|
||||||
|
{
|
||||||
|
SMESH::SMESH_GroupBase_var aGroupObject = aListOfGroups[i];
|
||||||
|
SALOMEDS::Color aReservedColor = aGroupObject->GetColor();
|
||||||
|
aReservedColors.append( aReservedColor );
|
||||||
|
}
|
||||||
|
|
||||||
|
SALOMEDS::Color aColor = SMESHGUI::getUniqueColor( aReservedColors );
|
||||||
|
aQColor.setRgb( (int)( aColor.R * 255.0 ),
|
||||||
|
(int)( aColor.G * 255.0 ),
|
||||||
|
(int)( aColor.B * 255.0 ) );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
setGroupQColor( aQColor );
|
||||||
|
}
|
||||||
|
@ -103,16 +103,16 @@ private slots:
|
|||||||
void onSelectSubMesh(bool on);
|
void onSelectSubMesh(bool on);
|
||||||
void onSelectGroup(bool on);
|
void onSelectGroup(bool on);
|
||||||
void onSelectGeomGroup(bool on);
|
void onSelectGeomGroup(bool on);
|
||||||
void onSelectColorGroup(bool on);
|
|
||||||
void setCurrentSelection();
|
void setCurrentSelection();
|
||||||
|
|
||||||
void setFilters();
|
void setFilters();
|
||||||
void onSort();
|
void onSort();
|
||||||
|
|
||||||
void onNameChanged(const QString& text);
|
void onNameChanged(const QString& text);
|
||||||
void onNbColorsChanged(const QString& text);
|
|
||||||
void onFilterAccepted();
|
void onFilterAccepted();
|
||||||
|
|
||||||
|
void onSelectColor();
|
||||||
|
|
||||||
void onGeomPopup( int );
|
void onGeomPopup( int );
|
||||||
void onGeomSelectionButton( bool );
|
void onGeomSelectionButton( bool );
|
||||||
|
|
||||||
@ -131,6 +131,14 @@ private:
|
|||||||
void updateButtons();
|
void updateButtons();
|
||||||
void updateGeomPopup();
|
void updateGeomPopup();
|
||||||
|
|
||||||
|
void setGroupColor( const SALOMEDS::Color& );
|
||||||
|
SALOMEDS::Color getGroupColor() const;
|
||||||
|
|
||||||
|
void setGroupQColor( const QColor& );
|
||||||
|
QColor getGroupQColor() const;
|
||||||
|
|
||||||
|
void setDefaultGroupColor();
|
||||||
|
|
||||||
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
|
||||||
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
|
||||||
SMESH_Actor* myActor; /* Current mesh actor */
|
SMESH_Actor* myActor; /* Current mesh actor */
|
||||||
@ -159,8 +167,7 @@ private:
|
|||||||
QPushButton* myGroupBtn;
|
QPushButton* myGroupBtn;
|
||||||
QLineEdit* myGroupLine;
|
QLineEdit* myGroupLine;
|
||||||
|
|
||||||
QCheckBox* mySelectColorGroup;
|
QPushButton* myColorBtn;
|
||||||
QtxIntSpinBox* myColorSpinBox;
|
|
||||||
|
|
||||||
QCheckBox* mySelectGeomGroup;
|
QCheckBox* mySelectGeomGroup;
|
||||||
QToolButton* myGeomGroupBtn;
|
QToolButton* myGeomGroupBtn;
|
||||||
|
@ -100,6 +100,7 @@ QtxValue SMESHGUI_Selection::param( const int ind, const QString& p ) const
|
|||||||
if ( p=="client" ) val = QtxValue( globalParam( p ) );
|
if ( p=="client" ) val = QtxValue( globalParam( p ) );
|
||||||
else if ( p=="type" ) val = QtxValue( myTypes[ind] );
|
else if ( p=="type" ) val = QtxValue( myTypes[ind] );
|
||||||
else if ( p=="elemTypes" ) val = QtxValue( elemTypes( ind ) );
|
else if ( p=="elemTypes" ) val = QtxValue( elemTypes( ind ) );
|
||||||
|
else if ( p=="isAutoColor" ) val = QtxValue( isAutoColor( ind ) );
|
||||||
else if ( p=="numberOfNodes" ) val = QtxValue( numberOfNodes( ind ) );
|
else if ( p=="numberOfNodes" ) val = QtxValue( numberOfNodes( ind ) );
|
||||||
else if ( p=="labeledTypes" ) val = QtxValue( labeledTypes( ind ) );
|
else if ( p=="labeledTypes" ) val = QtxValue( labeledTypes( ind ) );
|
||||||
else if ( p=="shrinkMode" ) val = QtxValue( shrinkMode( ind ) );
|
else if ( p=="shrinkMode" ) val = QtxValue( shrinkMode( ind ) );
|
||||||
@ -252,6 +253,27 @@ QString SMESHGUI_Selection::controlMode( int ind ) const
|
|||||||
return "eNone";
|
return "eNone";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : isAutoColor
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
bool SMESHGUI_Selection::isAutoColor( int ind ) const
|
||||||
|
{
|
||||||
|
if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
|
||||||
|
{
|
||||||
|
_PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).latin1() );
|
||||||
|
CORBA::Object_var obj = SMESH::SObjectToObject( sobj, SMESH::GetActiveStudyDocument() );
|
||||||
|
|
||||||
|
if ( ! CORBA::is_nil( obj )) {
|
||||||
|
SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( obj );
|
||||||
|
if ( ! mesh->_is_nil() )
|
||||||
|
return mesh->GetAutoColor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : numberOfNodes
|
//function : numberOfNodes
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -50,6 +50,7 @@ public:
|
|||||||
virtual void processOwner( const LightApp_DataOwner* );
|
virtual void processOwner( const LightApp_DataOwner* );
|
||||||
|
|
||||||
// got from object, not from actor
|
// got from object, not from actor
|
||||||
|
virtual bool isAutoColor( int ind ) const;
|
||||||
virtual int numberOfNodes( int ind ) const;
|
virtual int numberOfNodes( int ind ) const;
|
||||||
virtual QVariant isComputable( int ind ) const;
|
virtual QVariant isComputable( int ind ) const;
|
||||||
virtual QVariant hasReference( int ind ) const;
|
virtual QVariant hasReference( int ind ) const;
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "SMESHGUI.h"
|
#include "SMESHGUI.h"
|
||||||
#include "SMESH_Actor.h"
|
#include "SMESH_Actor.h"
|
||||||
|
#include "SMESH_ActorUtils.h"
|
||||||
#include "SMESH_ObjectDef.h"
|
#include "SMESH_ObjectDef.h"
|
||||||
#include <SMDS_Mesh.hxx>
|
#include <SMDS_Mesh.hxx>
|
||||||
|
|
||||||
@ -484,6 +485,22 @@ namespace SMESH {
|
|||||||
std::string aNameVal = aName->Value();
|
std::string aNameVal = aName->Value();
|
||||||
anActor = SMESH_Actor::New(aVisualObj,theEntry,aNameVal.c_str(),theIsClear);
|
anActor = SMESH_Actor::New(aVisualObj,theEntry,aNameVal.c_str(),theIsClear);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( SMESH::SObjectToObject( aSObj ));
|
||||||
|
if(!CORBA::is_nil(aGroup))
|
||||||
|
{
|
||||||
|
SALOMEDS::Color aColor = aGroup->GetColor();
|
||||||
|
if( !( aColor.R > 0 || aColor.G > 0 || aColor.B > 0 ) )
|
||||||
|
{
|
||||||
|
int r = 0, g = 0, b = 0;
|
||||||
|
SMESH::GetColor( "SMESH", "fill_color", r, g, b, QColor( 0, 170, 255 ) );
|
||||||
|
aColor.R = (float)r / 255.0;
|
||||||
|
aColor.G = (float)g / 255.0;
|
||||||
|
aColor.B = (float)b / 255.0;
|
||||||
|
aGroup->SetColor( aColor );
|
||||||
|
}
|
||||||
|
anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return anActor;
|
return anActor;
|
||||||
|
@ -986,7 +986,7 @@ msgstr "Color group"
|
|||||||
|
|
||||||
#Check color group
|
#Check color group
|
||||||
msgid "SMESH_CHECK_COLOR"
|
msgid "SMESH_CHECK_COLOR"
|
||||||
msgstr "Color number"
|
msgstr "Color"
|
||||||
|
|
||||||
#%1 SubMeshes
|
#%1 SubMeshes
|
||||||
msgid "SMESH_SUBMESH_SELECTED"
|
msgid "SMESH_SUBMESH_SELECTED"
|
||||||
@ -2385,6 +2385,12 @@ msgstr "Shrink"
|
|||||||
msgid "MEN_AUTO_UPD"
|
msgid "MEN_AUTO_UPD"
|
||||||
msgstr "Automatic update"
|
msgstr "Automatic update"
|
||||||
|
|
||||||
|
msgid "MEN_AUTO_COLOR"
|
||||||
|
msgstr "Auto color"
|
||||||
|
|
||||||
|
msgid "MEN_DISABLE_AUTO_COLOR"
|
||||||
|
msgstr "Disable auto color"
|
||||||
|
|
||||||
msgid "MEN_COLORS"
|
msgid "MEN_COLORS"
|
||||||
msgstr "Colors / Size"
|
msgstr "Colors / Size"
|
||||||
|
|
||||||
@ -2747,6 +2753,12 @@ msgstr "Shrink"
|
|||||||
msgid "TOP_AUTO_UPD"
|
msgid "TOP_AUTO_UPD"
|
||||||
msgstr "Automatic update"
|
msgstr "Automatic update"
|
||||||
|
|
||||||
|
msgid "TOP_AUTO_COLOR"
|
||||||
|
msgstr "Auto color"
|
||||||
|
|
||||||
|
msgid "TOP_DISABLE_AUTO_COLOR"
|
||||||
|
msgstr "Disable auto color"
|
||||||
|
|
||||||
msgid "TOP_COLORS"
|
msgid "TOP_COLORS"
|
||||||
msgstr "Colors / Size"
|
msgstr "Colors / Size"
|
||||||
|
|
||||||
@ -3060,6 +3072,12 @@ msgstr "Shrink"
|
|||||||
msgid "STB_AUTO_UPD"
|
msgid "STB_AUTO_UPD"
|
||||||
msgstr "Automatic update"
|
msgstr "Automatic update"
|
||||||
|
|
||||||
|
msgid "STB_AUTO_COLOR"
|
||||||
|
msgstr "Auto color"
|
||||||
|
|
||||||
|
msgid "STB_DISABLE_AUTO_COLOR"
|
||||||
|
msgstr "Disable auto color"
|
||||||
|
|
||||||
msgid "STB_COLORS"
|
msgid "STB_COLORS"
|
||||||
msgstr "Colors / Size"
|
msgstr "Colors / Size"
|
||||||
|
|
||||||
|
@ -751,7 +751,7 @@ bool _pyMesh::NeedMeshAccess( const Handle(_pyCommand)& theCommand )
|
|||||||
"GetSubMeshElementsId","GetSubMeshNodesId","GetSubMeshElementType","Dump","GetNodeXYZ",
|
"GetSubMeshElementsId","GetSubMeshNodesId","GetSubMeshElementType","Dump","GetNodeXYZ",
|
||||||
"GetNodeInverseElements","GetShapeID","GetShapeIDForElem","GetElemNbNodes",
|
"GetNodeInverseElements","GetShapeID","GetShapeIDForElem","GetElemNbNodes",
|
||||||
"GetElemNode","IsMediumNode","IsMediumNodeOfAnyElem","ElemNbEdges","ElemNbFaces",
|
"GetElemNode","IsMediumNode","IsMediumNodeOfAnyElem","ElemNbEdges","ElemNbFaces",
|
||||||
"IsPoly","IsQuadratic","BaryCenter","GetHypothesisList",
|
"IsPoly","IsQuadratic","BaryCenter","GetHypothesisList", "SetAutoColor", "GetAutoColor",
|
||||||
"" }; // <- mark of end
|
"" }; // <- mark of end
|
||||||
sameMethods.Insert( names );
|
sameMethods.Insert( names );
|
||||||
}
|
}
|
||||||
|
@ -749,6 +749,53 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
|
|||||||
if (aSeq->Value(aLen) < aScriptLength)
|
if (aSeq->Value(aLen) < aScriptLength)
|
||||||
anUpdatedScript += aScript.SubString(aSeq->Value(aLen) + 1, aScriptLength);
|
anUpdatedScript += aScript.SubString(aSeq->Value(aLen) + 1, aScriptLength);
|
||||||
|
|
||||||
|
|
||||||
|
SMESH_Gen_i* aSMESHGenI = SMESH_Gen_i::GetSMESHGen();
|
||||||
|
SALOMEDS::Study_ptr aStudy = aSMESHGenI->GetCurrentStudy();
|
||||||
|
if( !CORBA::is_nil(aStudy) )
|
||||||
|
{
|
||||||
|
SALOMEDS::SObject_var aComp = aStudy->FindComponent(ComponentDataType());
|
||||||
|
if( !CORBA::is_nil(aComp) )
|
||||||
|
{
|
||||||
|
SALOMEDS::ChildIterator_var Itr = aStudy->NewChildIterator(aComp);
|
||||||
|
for( Itr->InitEx(true); Itr->More(); Itr->Next() )
|
||||||
|
{
|
||||||
|
SALOMEDS::SObject_var aSObj = Itr->Value();
|
||||||
|
CORBA::String_var aName = aSObj->GetName();
|
||||||
|
|
||||||
|
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( SMESH_Gen_i::SObjectToObject( aSObj ) );
|
||||||
|
if( !CORBA::is_nil(aMesh) )
|
||||||
|
{
|
||||||
|
bool isAutoColor = aMesh->GetAutoColor();
|
||||||
|
if( isAutoColor )
|
||||||
|
{
|
||||||
|
anUpdatedScript += "\n\t";
|
||||||
|
anUpdatedScript += (char*)aName.in();
|
||||||
|
anUpdatedScript += ".SetAutoColor(1)";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( SMESH_Gen_i::SObjectToObject( aSObj ) );
|
||||||
|
if( !CORBA::is_nil(aGroup) )
|
||||||
|
{
|
||||||
|
SALOMEDS::Color aColor = aGroup->GetColor();
|
||||||
|
if ( aColor.R > 0 || aColor.G > 0 || aColor.B > 0 )
|
||||||
|
{
|
||||||
|
anUpdatedScript += "\n\t";
|
||||||
|
anUpdatedScript += (char*)aName.in();
|
||||||
|
anUpdatedScript += ".SetColor(SALOMEDS.Color(";
|
||||||
|
anUpdatedScript += aColor.R;
|
||||||
|
anUpdatedScript += ",";
|
||||||
|
anUpdatedScript += aColor.G;
|
||||||
|
anUpdatedScript += ",";
|
||||||
|
anUpdatedScript += aColor.B;
|
||||||
|
anUpdatedScript += "))";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Remove removed objects
|
// Remove removed objects
|
||||||
if ( seqRemoved.Length() > 0 ) {
|
if ( seqRemoved.Length() > 0 ) {
|
||||||
anUpdatedScript += "\n\t## some objects were removed";
|
anUpdatedScript += "\n\t## some objects were removed";
|
||||||
|
@ -1822,6 +1822,18 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
|
|||||||
aDataset->WriteOnDisk( ( char* )( strHasData.c_str() ) );
|
aDataset->WriteOnDisk( ( char* )( strHasData.c_str() ) );
|
||||||
aDataset->CloseOnDisk();
|
aDataset->CloseOnDisk();
|
||||||
|
|
||||||
|
// ouv : NPAL12872
|
||||||
|
// for each mesh open the HDF group basing on its auto color parameter
|
||||||
|
char meshAutoColorName[ 30 ];
|
||||||
|
sprintf( meshAutoColorName, "AutoColorMesh %d", id );
|
||||||
|
int anAutoColor[1];
|
||||||
|
anAutoColor[0] = myImpl->GetAutoColor();
|
||||||
|
aSize[ 0 ] = 1;
|
||||||
|
aDataset = new HDFdataset( meshAutoColorName, aTopGroup, HDF_INT32, aSize, 1 );
|
||||||
|
aDataset->CreateOnDisk();
|
||||||
|
aDataset->WriteOnDisk( anAutoColor );
|
||||||
|
aDataset->CloseOnDisk();
|
||||||
|
|
||||||
// write reference on a shape if exists
|
// write reference on a shape if exists
|
||||||
SALOMEDS::SObject_var myRef;
|
SALOMEDS::SObject_var myRef;
|
||||||
bool shapeRefFound = false;
|
bool shapeRefFound = false;
|
||||||
@ -2147,6 +2159,22 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
|
|||||||
aDataset->WriteOnDisk( aUserName );
|
aDataset->WriteOnDisk( aUserName );
|
||||||
aDataset->CloseOnDisk();
|
aDataset->CloseOnDisk();
|
||||||
|
|
||||||
|
// ouv : NPAL12872
|
||||||
|
// For each group, create a dataset named "Group <group_persistent_id> Color"
|
||||||
|
// and store the group's color into it
|
||||||
|
char grpColorName[ 30 ];
|
||||||
|
sprintf( grpColorName, "ColorGroup %d", anId );
|
||||||
|
SALOMEDS::Color aColor = myGroupImpl->GetColor();
|
||||||
|
double anRGB[3];
|
||||||
|
anRGB[ 0 ] = aColor.R;
|
||||||
|
anRGB[ 1 ] = aColor.G;
|
||||||
|
anRGB[ 2 ] = aColor.B;
|
||||||
|
aSize[ 0 ] = 3;
|
||||||
|
aDataset = new HDFdataset( grpColorName, aGroup, HDF_FLOAT64, aSize, 1 );
|
||||||
|
aDataset->CreateOnDisk();
|
||||||
|
aDataset->WriteOnDisk( anRGB );
|
||||||
|
aDataset->CloseOnDisk();
|
||||||
|
|
||||||
// Store the group contents into MED file
|
// Store the group contents into MED file
|
||||||
if ( myLocMesh.GetGroup( myGroupImpl->GetLocalID() ) ) {
|
if ( myLocMesh.GetGroup( myGroupImpl->GetLocalID() ) ) {
|
||||||
|
|
||||||
@ -2821,6 +2849,21 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
|
|||||||
int newId = myStudyContext->findId( iorString );
|
int newId = myStudyContext->findId( iorString );
|
||||||
myStudyContext->mapOldToNew( id, newId );
|
myStudyContext->mapOldToNew( id, newId );
|
||||||
|
|
||||||
|
// ouv : NPAL12872
|
||||||
|
// try to read and set auto color flag
|
||||||
|
char aMeshAutoColorName[ 30 ];
|
||||||
|
sprintf( aMeshAutoColorName, "AutoColorMesh %d", id);
|
||||||
|
if( aTopGroup->ExistInternalObject( aMeshAutoColorName ) )
|
||||||
|
{
|
||||||
|
aDataset = new HDFdataset( aMeshAutoColorName, aTopGroup );
|
||||||
|
aDataset->OpenOnDisk();
|
||||||
|
size = aDataset->GetSize();
|
||||||
|
int* anAutoColor = new int[ size ];
|
||||||
|
aDataset->ReadFromDisk( anAutoColor );
|
||||||
|
aDataset->CloseOnDisk();
|
||||||
|
myNewMeshImpl->SetAutoColor( (bool)anAutoColor[0] );
|
||||||
|
}
|
||||||
|
|
||||||
// try to read and set reference to shape
|
// try to read and set reference to shape
|
||||||
GEOM::GEOM_Object_var aShapeObject;
|
GEOM::GEOM_Object_var aShapeObject;
|
||||||
if ( aTopGroup->ExistInternalObject( "Ref on shape" ) ) {
|
if ( aTopGroup->ExistInternalObject( "Ref on shape" ) ) {
|
||||||
@ -3425,6 +3468,25 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
|
|||||||
SMESHDS_GroupBase* aGroupBaseDS = aLocalGroup->GetGroupDS();
|
SMESHDS_GroupBase* aGroupBaseDS = aLocalGroup->GetGroupDS();
|
||||||
aGroupBaseDS->SetStoreName( name_dataset );
|
aGroupBaseDS->SetStoreName( name_dataset );
|
||||||
|
|
||||||
|
// ouv : NPAL12872
|
||||||
|
// Read color of the group
|
||||||
|
char aGroupColorName[ 30 ];
|
||||||
|
sprintf( aGroupColorName, "ColorGroup %d", subid);
|
||||||
|
if ( aGroup->ExistInternalObject( aGroupColorName ) )
|
||||||
|
{
|
||||||
|
aDataset = new HDFdataset( aGroupColorName, aGroup );
|
||||||
|
aDataset->OpenOnDisk();
|
||||||
|
size = aDataset->GetSize();
|
||||||
|
double* anRGB = new double[ size ];
|
||||||
|
aDataset->ReadFromDisk( anRGB );
|
||||||
|
aDataset->CloseOnDisk();
|
||||||
|
SALOMEDS::Color aColor;
|
||||||
|
aColor.R = anRGB[0];
|
||||||
|
aColor.G = anRGB[1];
|
||||||
|
aColor.B = anRGB[2];
|
||||||
|
aGroupBaseDS->SetColor( aColor );
|
||||||
|
}
|
||||||
|
|
||||||
// Fill group with contents from MED file
|
// Fill group with contents from MED file
|
||||||
SMESHDS_Group* aGrp = dynamic_cast<SMESHDS_Group*>( aGroupBaseDS );
|
SMESHDS_Group* aGrp = dynamic_cast<SMESHDS_Group*>( aGroupBaseDS );
|
||||||
if ( aGrp )
|
if ( aGrp )
|
||||||
|
@ -424,13 +424,13 @@ GEOM::GEOM_Object_ptr SMESH_GroupOnGeom_i::GetShape()
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
CORBA::Long SMESH_GroupBase_i::GetColorNumber()
|
SALOMEDS::Color SMESH_GroupBase_i::GetColor()
|
||||||
{
|
{
|
||||||
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
|
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
|
||||||
if (aGroupDS)
|
if (aGroupDS)
|
||||||
return aGroupDS->GetColorGroup();
|
return aGroupDS->GetColor();
|
||||||
MESSAGE("get color number of a vague group");
|
MESSAGE("get color of a group");
|
||||||
return 0;
|
return SALOMEDS::Color();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -438,14 +438,11 @@ CORBA::Long SMESH_GroupBase_i::GetColorNumber()
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
void SMESH_GroupBase_i::SetColorNumber(CORBA::Long color)
|
void SMESH_GroupBase_i::SetColor(const SALOMEDS::Color& color)
|
||||||
{
|
{
|
||||||
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
|
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
|
||||||
if (aGroupDS)
|
if (aGroupDS)
|
||||||
return aGroupDS->SetColorGroup(color);
|
return aGroupDS->SetColor(color);
|
||||||
MESSAGE("set color number of a vague group");
|
MESSAGE("set color of a group");
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,8 +75,8 @@ class SMESH_I_EXPORT SMESH_GroupBase_i:
|
|||||||
SMESH_Group* GetSmeshGroup() const;
|
SMESH_Group* GetSmeshGroup() const;
|
||||||
SMESHDS_GroupBase* GetGroupDS() const;
|
SMESHDS_GroupBase* GetGroupDS() const;
|
||||||
|
|
||||||
void SetColorNumber(CORBA::Long color);
|
void SetColor(const SALOMEDS::Color& color);
|
||||||
CORBA::Long GetColorNumber();
|
SALOMEDS::Color GetColor();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SMESH_Mesh_i* myMeshServant;
|
SMESH_Mesh_i* myMeshServant;
|
||||||
|
@ -1392,6 +1392,29 @@ SMESH::SMESH_MeshEditor_ptr SMESH_Mesh_i::GetMeshEditPreviewer()
|
|||||||
return aMesh._retn();
|
return aMesh._retn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
void SMESH_Mesh_i::SetAutoColor(CORBA::Boolean theAutoColor) throw(SALOME::SALOME_Exception)
|
||||||
|
{
|
||||||
|
Unexpect aCatch(SALOME_SalomeException);
|
||||||
|
_impl->SetAutoColor(theAutoColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
CORBA::Boolean SMESH_Mesh_i::GetAutoColor() throw(SALOME::SALOME_Exception)
|
||||||
|
{
|
||||||
|
Unexpect aCatch(SALOME_SalomeException);
|
||||||
|
return _impl->GetAutoColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* Export in different formats
|
* Export in different formats
|
||||||
|
@ -160,6 +160,15 @@ public:
|
|||||||
SMESH::DriverMED_ReadStatus ImportMEDFile( const char* theFileName, const char* theMeshName )
|
SMESH::DriverMED_ReadStatus ImportMEDFile( const char* theFileName, const char* theMeshName )
|
||||||
throw (SALOME::SALOME_Exception);
|
throw (SALOME::SALOME_Exception);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Auto color
|
||||||
|
*/
|
||||||
|
void SetAutoColor(CORBA::Boolean theAutoColor)
|
||||||
|
throw (SALOME::SALOME_Exception);
|
||||||
|
|
||||||
|
CORBA::Boolean GetAutoColor()
|
||||||
|
throw (SALOME::SALOME_Exception);
|
||||||
|
|
||||||
/*! Check group names for duplications.
|
/*! Check group names for duplications.
|
||||||
* Consider maximum group name length stored in MED file.
|
* Consider maximum group name length stored in MED file.
|
||||||
*/
|
*/
|
||||||
|
@ -1893,6 +1893,12 @@ class Mesh:
|
|||||||
def ClearLog(self):
|
def ClearLog(self):
|
||||||
self.mesh.ClearLog()
|
self.mesh.ClearLog()
|
||||||
|
|
||||||
|
def SetAutoColor(self, color):
|
||||||
|
self.mesh.SetAutoColor(color)
|
||||||
|
|
||||||
|
def GetAutoColor(self):
|
||||||
|
return self.mesh.GetAutoColor()
|
||||||
|
|
||||||
## Get the internal Id
|
## Get the internal Id
|
||||||
def GetId(self):
|
def GetId(self):
|
||||||
return self.mesh.GetId()
|
return self.mesh.GetId()
|
||||||
|
Loading…
Reference in New Issue
Block a user