0052555: TC7.5.0: regression of free faces visualization

This commit is contained in:
vsr 2014-11-07 18:36:38 +03:00 committed by Florian BRUNET
parent e20cec221f
commit 696752954d
3 changed files with 120 additions and 45 deletions

View File

@ -473,25 +473,24 @@ GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* st )
myHasDisplayMode = false; myHasDisplayMode = false;
int aType = resMgr->integerValue("Geometry", "type_of_marker", (int)Aspect_TOM_PLUS); int aType = resMgr->integerValue("Geometry", "type_of_marker", (int)Aspect_TOM_PLUS);
myWidth = resMgr->integerValue("Geometry", "edge_width", -1);
myIsosWidth = resMgr->integerValue("Geometry", "isolines_width", -1);
myTransparency = resMgr->integerValue("Geometry", "transparency", 0) / 100.;
myHasTransparency = false;
myTypeOfMarker = (Aspect_TypeOfMarker)(std::min((int)Aspect_TOM_RING3, std::max((int)Aspect_TOM_POINT, aType))); myTypeOfMarker = (Aspect_TypeOfMarker)(std::min((int)Aspect_TOM_RING3, std::max((int)Aspect_TOM_POINT, aType)));
myScaleOfMarker = (resMgr->integerValue("Geometry", "marker_scale", 1)-(int)GEOM::MS_10)*0.5 + 1.0; myScaleOfMarker = (resMgr->integerValue("Geometry", "marker_scale", 1)-(int)GEOM::MS_10)*0.5 + 1.0;
myScaleOfMarker = std::min(7.0, std::max(1., myScaleOfMarker)); myScaleOfMarker = std::min(7.0, std::max(1., myScaleOfMarker));
// Next properties provide a way to customize displaying of presentations;
// for instance, this is useful for preview
myColor = -1; myColor = -1;
// This color is used for shape displaying. If it is equal -1 then
// default color is used.
myTexture = ""; myTexture = "";
myNbIsos = -1;
myWidth = -1; myWidth = -1;
myTransparency = -1;
myType = -1; myType = -1;
myIsosColor = -1;
myIsosWidth = -1;
// This parameter is used for activisation/deactivisation (selection) of objects to be displayed
myToActivate = true; myToActivate = true;
// This parameter is used for activisation/deactivisation of objects to be displayed
// Activate parallel vizualisation only for testing purpose // Activate parallel vizualisation only for testing purpose
// and if the corresponding env variable is set to 1 // and if the corresponding env variable is set to 1
@ -864,12 +863,34 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap
int isosWidth = propMap.value( GEOM::propertyName( GEOM::IsosWidth ) ).toInt(); int isosWidth = propMap.value( GEOM::propertyName( GEOM::IsosWidth ) ).toInt();
Handle(Prs3d_IsoAspect) uIsoAspect = AISShape->Attributes()->UIsoAspect(); Handle(Prs3d_IsoAspect) uIsoAspect = AISShape->Attributes()->UIsoAspect();
Handle(Prs3d_IsoAspect) vIsoAspect = AISShape->Attributes()->VIsoAspect(); Handle(Prs3d_IsoAspect) vIsoAspect = AISShape->Attributes()->VIsoAspect();
if ( HasIsosColor() ) {
uIsoAspect->SetColor( (Quantity_NameOfColor)GetIsosColor() );
vIsoAspect->SetColor( (Quantity_NameOfColor)GetIsosColor() );
}
else {
uIsoAspect->SetColor( isosColor ); uIsoAspect->SetColor( isosColor );
uIsoAspect->SetWidth( isosWidth );
uIsoAspect->SetNumber( uIsos );
vIsoAspect->SetColor( isosColor ); vIsoAspect->SetColor( isosColor );
}
if ( HasIsosWidth() ) {
uIsoAspect->SetWidth( GetIsosWidth() );
vIsoAspect->SetWidth( GetIsosWidth() );
}
else {
uIsoAspect->SetWidth( isosWidth );
vIsoAspect->SetWidth( isosWidth ); vIsoAspect->SetWidth( isosWidth );
}
if ( HasNbIsos() ) {
uIsoAspect->SetNumber( GetNbIsos() );
vIsoAspect->SetNumber( GetNbIsos() );
}
else {
uIsoAspect->SetNumber( uIsos );
vIsoAspect->SetNumber( vIsos ); vIsoAspect->SetNumber( vIsos );
}
AISShape->Attributes()->SetUIsoAspect( uIsoAspect ); AISShape->Attributes()->SetUIsoAspect( uIsoAspect );
AISShape->Attributes()->SetVIsoAspect( vIsoAspect ); AISShape->Attributes()->SetVIsoAspect( vIsoAspect );
@ -1035,15 +1056,24 @@ void GEOM_Displayer::updateActorProperties( GEOM_Actor* actor, bool create )
// - set number of iso-lines // - set number of iso-lines
int nbIsos[2]= { 1, 1 }; int nbIsos[2]= { 1, 1 };
if ( HasNbIsos() ) {
nbIsos[0] = GetNbIsos();
nbIsos[1] = GetNbIsos();
}
else {
QStringList isos = propMap.value( GEOM::propertyName( GEOM::NbIsos ) ).toString().split( GEOM::subSectionSeparator() ); QStringList isos = propMap.value( GEOM::propertyName( GEOM::NbIsos ) ).toString().split( GEOM::subSectionSeparator() );
nbIsos[0] = isos[0].toInt(); nbIsos[0] = isos[0].toInt();
nbIsos[1] = isos[1].toInt(); nbIsos[1] = isos[1].toInt();
}
actor->SetNbIsos( nbIsos ); actor->SetNbIsos( nbIsos );
// - set iso-lines width // - set iso-lines width
actor->SetIsosWidth( propMap.value( GEOM::propertyName( GEOM::IsosWidth ) ).toInt() ); actor->SetIsosWidth( HasIsosWidth() ? GetIsosWidth() : propMap.value( GEOM::propertyName( GEOM::IsosWidth ) ).toInt() );
// - set iso-lines color // - set iso-lines color
if ( HasIsosColor() )
c = SalomeApp_Tools::color( Quantity_Color((Quantity_NameOfColor)GetIsosColor()) );
else
c = propMap.value( GEOM::propertyName( GEOM::IsosColor ) ).value<QColor>(); c = propMap.value( GEOM::propertyName( GEOM::IsosColor ) ).value<QColor>();
actor->SetIsosColor( c.redF(), c.greenF(), c.blueF() ); actor->SetIsosColor( c.redF(), c.greenF(), c.blueF() );
@ -2022,15 +2052,9 @@ void GEOM_Displayer::UnsetColor()
//================================================================= //=================================================================
double GEOM_Displayer::SetTransparency( const double transparency ) double GEOM_Displayer::SetTransparency( const double transparency )
{ {
double aPrevTransparency = myTransparency; double prevTransparency = myTransparency;
if ( transparency < 0 ) {
UnsetTransparency();
}
else {
myTransparency = transparency; myTransparency = transparency;
myHasTransparency = true; return prevTransparency;
}
return aPrevTransparency;
} }
//================================================================= //=================================================================
@ -2052,7 +2076,7 @@ double GEOM_Displayer::GetTransparency() const
//================================================================= //=================================================================
bool GEOM_Displayer::HasTransparency() const bool GEOM_Displayer::HasTransparency() const
{ {
return myHasTransparency; return myTransparency >= 0;
} }
//================================================================= //=================================================================
@ -2063,27 +2087,17 @@ bool GEOM_Displayer::HasTransparency() const
//================================================================= //=================================================================
double GEOM_Displayer::UnsetTransparency() double GEOM_Displayer::UnsetTransparency()
{ {
double aPrevTransparency = myTransparency; return SetTransparency( -1 );
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
myTransparency = resMgr->integerValue("Geometry", "transparency", 0) / 100.;
myHasTransparency = false;
return aPrevTransparency;
} }
//================================================================= //=================================================================
/*! /*!
* GEOM_Displayer::SetTexture * GEOM_Displayer::SetTexture
* Set color for shape displaying. If it is equal -1 then default color is used.
* Available values are from Quantity_NameOfColor enumeration
*/ */
//================================================================= //=================================================================
void GEOM_Displayer::SetTexture( const std::string& texureFileName ) void GEOM_Displayer::SetTexture( const std::string& texureFileName )
{ {
if(texureFileName!="")
{
myTexture = texureFileName; myTexture = texureFileName;
}
} }
bool GEOM_Displayer::HasTexture() const bool GEOM_Displayer::HasTexture() const
@ -2122,7 +2136,6 @@ void GEOM_Displayer::UnsetWidth()
myWidth = -1; myWidth = -1;
} }
int GEOM_Displayer::GetIsosWidth() const int GEOM_Displayer::GetIsosWidth() const
{ {
return myIsosWidth; return myIsosWidth;
@ -2138,6 +2151,49 @@ bool GEOM_Displayer::HasIsosWidth() const
return myIsosWidth != -1; return myIsosWidth != -1;
} }
int GEOM_Displayer::SetNbIsos( const int nbIsos )
{
int prevNbIsos = myNbIsos;
myNbIsos = nbIsos;
return prevNbIsos;
}
int GEOM_Displayer::UnsetNbIsos()
{
return SetNbIsos( -1 );
}
int GEOM_Displayer::GetNbIsos() const
{
return myNbIsos;
}
bool GEOM_Displayer::HasNbIsos() const
{
return myNbIsos >= 0;
}
int GEOM_Displayer::SetIsosColor( const int color )
{
int prevColor = myIsosColor;
myIsosColor = color;
return prevColor;
}
int GEOM_Displayer::GetIsosColor() const
{
return myIsosColor;
}
bool GEOM_Displayer::HasIsosColor() const
{
return myIsosColor != -1;
}
int GEOM_Displayer::UnsetIsosColor()
{
return SetIsosColor( -1 );
}
//================================================================= //=================================================================
/*! /*!

View File

@ -163,6 +163,19 @@ public:
int GetIsosWidth () const; int GetIsosWidth () const;
bool HasIsosWidth () const; bool HasIsosWidth () const;
/* Set nb iso-libes for displaying. Use -1 to set default values. */
int SetNbIsos( const int );
int UnsetNbIsos();
int GetNbIsos() const;
bool HasNbIsos() const;
/* Set color for iso-lines displaying. If it is equal -1 then default color is used.
Available values are from Quantity_NameOfColor enumeration */
int SetIsosColor ( const int );
int UnsetIsosColor();
int GetIsosColor () const;
bool HasIsosColor () const;
/* Set display mode shape displaying. If it is equal -1 then display mode is used. */ /* Set display mode shape displaying. If it is equal -1 then display mode is used. */
int SetDisplayMode( const int ); int SetDisplayMode( const int );
int GetDisplayMode() const; int GetDisplayMode() const;
@ -289,13 +302,14 @@ protected:
int myColor; int myColor;
double myWidth; double myWidth;
int myIsosWidth; int myIsosWidth;
int myNbIsos;
int myIsosColor;
bool myToActivate; bool myToActivate;
int myDisplayMode; int myDisplayMode;
bool myHasDisplayMode; bool myHasDisplayMode;
Aspect_TypeOfMarker myTypeOfMarker; Aspect_TypeOfMarker myTypeOfMarker;
double myScaleOfMarker; double myScaleOfMarker;
double myTransparency; double myTransparency;
bool myHasTransparency;
private: private:
SalomeApp_Application* myApp; SalomeApp_Application* myApp;

View File

@ -354,8 +354,13 @@ bool RepairGUI_FreeFacesDlg::execute( ObjectList& objects )
aFace = anIndices.FindKey( aFaceLst[i] ); aFace = anIndices.FindKey( aFaceLst[i] );
try { try {
getDisplayer()->SetColor( Quantity_NOC_RED ); getDisplayer()->SetColor( Quantity_NOC_RED );
getDisplayer()->SetToActivate( false );
getDisplayer()->SetTransparency( transparency ); getDisplayer()->SetTransparency( transparency );
getDisplayer()->SetWidth( 2 );
getDisplayer()->SetNbIsos( 1 );
getDisplayer()->SetIsosWidth( 1 );
getDisplayer()->SetIsosColor( Quantity_NOC_RED );
getDisplayer()->SetDisplayMode( 0 );
getDisplayer()->SetToActivate( false );
aPrs = !aFace.IsNull() ? getDisplayer()->BuildPrs( aFace ) : 0; aPrs = !aFace.IsNull() ? getDisplayer()->BuildPrs( aFace ) : 0;
if ( aPrs ) if ( aPrs )
displayPreview( aPrs, true ); displayPreview( aPrs, true );