X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FOBJECT%2FSMESH_Actor.cxx;h=5c64804eca223a049966f2fa596578f2818f5c12;hp=88616e325f0ad2f34bbdb24ca2919162b40d3652;hb=refs%2Ftags%2FV9_7_0b1;hpb=ead0b153bd628d3b2faa4b983701cf548de6634c diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index 88616e325..5c64804ec 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -139,8 +139,8 @@ SMESH_ActorDef::SMESH_ActorDef() myIsFacesOriented = false; - int controlsIncrement = SMESH_ActorProps::props()->controlsIncrement(); - int selectionIncrement = SMESH_ActorProps::props()->selectionIncrement(); + float controlsIncrement = (float) SMESH_ActorProps::props()->controlsIncrement(); + float selectionIncrement = (float) SMESH_ActorProps::props()->selectionIncrement(); myControlsPrecision = -1; SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr(); @@ -148,11 +148,11 @@ SMESH_ActorDef::SMESH_ActorDef() if ( mgr && mgr->booleanValue( "SMESH", "use_precision", false ) ) myControlsPrecision = mgr->integerValue( "SMESH", "controls_precision", -1); - double aElem0DSize = SMESH::GetFloat("SMESH:elem0d_size",5); - double aBallElemSize = SMESH::GetFloat("SMESH:ball_elem_size",10); - double aBallElemScale = SMESH::GetFloat("SMESH:ball_elem_scale",1.0); - double aLineWidth = SMESH::GetFloat("SMESH:element_width",1); - double aOutlineWidth = SMESH::GetFloat("SMESH:outline_width",1); + float aElem0DSize = (float) SMESH::GetFloat("SMESH:elem0d_size",5); + float aBallElemSize = (float) SMESH::GetFloat("SMESH:ball_elem_size",10); + float aBallElemScale = (float) SMESH::GetFloat("SMESH:ball_elem_scale",1.0); + float aLineWidth = (float) SMESH::GetFloat("SMESH:element_width",1); + float aOutlineWidth = (float) SMESH::GetFloat("SMESH:outline_width",1); SMESH::LabelFont aFamilyNd = SMESH::FntTimes; bool aBoldNd = true; @@ -732,6 +732,7 @@ void SMESH_ActorDef::SetCellsLabeled(bool theIsCellsLabeled) if(myBallActor) myBallActor->SetCellsLabeled(theIsCellsLabeled); + SetRepresentation(GetRepresentation()); myTimeStamp->Modified(); } @@ -1034,7 +1035,7 @@ void SMESH_ActorDef::SetControlMode( eControl theMode, bool theCheckEntityMode ) return; } - int aNbCells = myFunctor ? myVisualObj->GetNbEntities( myFunctor->GetType() ) : 0; + smIdType aNbCells = myFunctor ? myVisualObj->GetNbEntities( myFunctor->GetType() ) : 0; bool aShowOnlyScalarBarTitle = false; if(aNbCells) { //myControlMode = theMode; @@ -1134,7 +1135,7 @@ void SMESH_ActorDef::SetControlMode( eControl theMode, bool theCheckEntityMode ) //Update(); } -int SMESH_ActorDef::GetNumberControlEntities() +smIdType SMESH_ActorDef::GetNumberControlEntities() { SMESH_DeviceActor* anAct = NULL; switch(myControlMode){ @@ -1160,7 +1161,7 @@ int SMESH_ActorDef::GetNumberControlEntities() break; default:; } - return (anAct) ? anAct->GetUnstructuredGrid()->GetNumberOfCells() : -1; + return anAct ? anAct->GetUnstructuredGrid()->GetNumberOfCells() : -1; } void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer) @@ -1452,27 +1453,27 @@ void SMESH_ActorDef::UnShrink() } -int SMESH_ActorDef::GetNodeObjId(int theVtkID) +vtkIdType SMESH_ActorDef::GetNodeObjId(vtkIdType theVtkID) { return myPickableActor->GetNodeObjId(theVtkID); } -double* SMESH_ActorDef::GetNodeCoord(int theObjID) +double* SMESH_ActorDef::GetNodeCoord(vtkIdType theObjID) { return myPickableActor->GetNodeCoord(theObjID); } -int SMESH_ActorDef::GetNodeVtkId(int theObjID) +vtkIdType SMESH_ActorDef::GetNodeVtkId(vtkIdType theObjID) { return myPickableActor->GetNodeVtkId(theObjID); } -int SMESH_ActorDef::GetElemObjId(int theVtkID) +vtkIdType SMESH_ActorDef::GetElemObjId(vtkIdType theVtkID) { return myPickableActor->GetElemObjId(theVtkID); } -vtkCell* SMESH_ActorDef::GetElemCell(int theObjID) +vtkCell* SMESH_ActorDef::GetElemCell(vtkIdType theObjID) { return myPickableActor->GetElemCell(theObjID); } @@ -1545,7 +1546,8 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation) myScalarBarActor->VisibilityOn(); } - myPickableActor->VisibilityOn(); + if ( GetPickable( )) + myPickableActor->VisibilityOn(); if ( GetRepresentation() != ePoint ) { @@ -1555,7 +1557,8 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation) if(myEntityMode & eBallElem ){ myBallActor->VisibilityOn(); } - if(myEntityMode & eEdges && GetCellsLabeled() ){ // my1DActor shows labels only + if(myEntityMode & eEdges && ( GetCellsLabeled() || // my1DActor shows labels only + ( myControlActor == my1DActor && myControlMode != eNone ))){ my1DActor->VisibilityOn(); } if(myEntityMode & eFaces ){ @@ -1640,7 +1643,8 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode) theMode |= eVolumes; } - myBaseActor->myGeomFilter->SetInside(myEntityMode != anObjectEntities); + // rnv : Fix volume selection on Display Entity + //myBaseActor->myGeomFilter->SetInside(myEntityMode != anObjectEntities); if ( anObjectEntities == 0 && myRepresentation != ePoint ) // no elements, show nodes { @@ -1661,11 +1665,11 @@ void SMESH_ActorDef::SetEntityMode(unsigned int theMode) void SMESH_ActorDef::SetRepresentation (int theMode) { - int aNbEdges = myVisualObj->GetNbEntities(SMDSAbs_Edge); - int aNbFaces = myVisualObj->GetNbEntities(SMDSAbs_Face); - int aNbVolumes = myVisualObj->GetNbEntities(SMDSAbs_Volume); - int aNb0Ds = myVisualObj->GetNbEntities(SMDSAbs_0DElement); - int aNbBalls = myVisualObj->GetNbEntities(SMDSAbs_Ball); + smIdType aNbEdges = myVisualObj->GetNbEntities(SMDSAbs_Edge); + smIdType aNbFaces = myVisualObj->GetNbEntities(SMDSAbs_Face); + smIdType aNbVolumes = myVisualObj->GetNbEntities(SMDSAbs_Volume); + smIdType aNb0Ds = myVisualObj->GetNbEntities(SMDSAbs_0DElement); + smIdType aNbBalls = myVisualObj->GetNbEntities(SMDSAbs_Ball); if ( myRepresentationCache && aNbEdges + aNbFaces + aNbVolumes + aNb0Ds + aNbBalls ) { @@ -1710,7 +1714,7 @@ void SMESH_ActorDef::SetRepresentation (int theMode) myPickableActor = myBaseActor; vtkProperty *aProp = NULL, *aBackProp = NULL; vtkProperty *aPropVN = NULL, *aPropVR = NULL; - SMESH_DeviceActor::EReperesent aReperesent = SMESH_DeviceActor::EReperesent(-1); + SMESH_DeviceActor::EReperesent aReperesent = SMESH_DeviceActor::eNoneRepr; SMESH_Actor::EQuadratic2DRepresentation aQuadraticMode = GetQuadratic2DRepresentation(); switch (myRepresentation) { case ePoint: @@ -1759,6 +1763,12 @@ void SMESH_ActorDef::SetRepresentation (int theMode) if ( myRepresentation != ePoint ) aReperesent = SMESH_DeviceActor::eInsideframe; break; + case eCustomControl: + if ( myControlActor == my1DActor ) + aProp = aBackProp = my1DProp; + if ( myRepresentation != ePoint ) + aReperesent = SMESH_DeviceActor::eInsideframe; + break; default:; } @@ -1905,7 +1915,7 @@ int SMESH_ActorDef::RenderTranslucentGeometry(vtkViewport *vp) } -void SMESH_ActorDef::Render(vtkRenderer *ren) +void SMESH_ActorDef::Render(vtkRenderer* /*ren*/) { vtkMTimeType aTime = myTimeStamp->GetMTime(); vtkMTimeType anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime(); @@ -2116,8 +2126,8 @@ void SMESH_ActorDef::UpdateSelectionProps() { QColor selectionColor = SMESH_ActorProps::props()->selectionColor(); QColor highlightColor = SMESH_ActorProps::props()->highlightColor(); - int selectionIncrement = SMESH_ActorProps::props()->selectionIncrement(); - double width = GetLineWidth(); + float selectionIncrement = (float) SMESH_ActorProps::props()->selectionIncrement(); + float width = (float) GetLineWidth(); myHighlightProp->SetColor(selectionColor.redF(), selectionColor.greenF(), selectionColor.blueF()); myHighlightProp->SetLineWidth(width + selectionIncrement); myPreselectProp->SetColor(highlightColor.redF(), highlightColor.greenF(), highlightColor.blueF()); @@ -2133,17 +2143,17 @@ double SMESH_ActorDef::GetLineWidth() void SMESH_ActorDef::SetLineWidth(double theVal) { - int controlsIncrement = SMESH_ActorProps::props()->controlsIncrement(); - int selectionIncrement = SMESH_ActorProps::props()->selectionIncrement(); + float controlsIncrement = (float) SMESH_ActorProps::props()->controlsIncrement(); + float selectionIncrement = (float) SMESH_ActorProps::props()->selectionIncrement(); - myEdgeProp->SetLineWidth(theVal); + myEdgeProp->SetLineWidth((float) theVal); - my1DProp->SetLineWidth(theVal + controlsIncrement); - my1DExtProp->SetLineWidth(theVal + controlsIncrement); - my2DExtProp->SetLineWidth(theVal + controlsIncrement); - my3DExtProp->SetLineWidth(theVal + controlsIncrement); - myHighlightProp->SetLineWidth(theVal + selectionIncrement); - myPreselectProp->SetLineWidth(theVal + selectionIncrement); + my1DProp ->SetLineWidth((float) theVal + controlsIncrement); + my1DExtProp ->SetLineWidth((float) theVal + controlsIncrement); + my2DExtProp ->SetLineWidth((float) theVal + controlsIncrement); + my3DExtProp ->SetLineWidth((float) theVal + controlsIncrement); + myHighlightProp->SetLineWidth((float) theVal + selectionIncrement); + myPreselectProp->SetLineWidth((float) theVal + selectionIncrement); Modified(); } @@ -2154,21 +2164,21 @@ double SMESH_ActorDef::GetOutlineWidth() void SMESH_ActorDef::SetOutlineWidth(double theVal) { - myOutLineProp->SetLineWidth(theVal); + myOutLineProp->SetLineWidth((float) theVal); Modified(); } void SMESH_ActorDef::Set0DSize(double theVal) { - my0DProp->SetPointSize(theVal); - myHighlightProp->SetPointSize(theVal); - myPreselectProp->SetPointSize(theVal); + my0DProp ->SetPointSize((float) theVal); + myHighlightProp->SetPointSize((float) theVal); + myPreselectProp->SetPointSize((float) theVal); if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myHighlightActor )) { - aCustom->Set0DSize(theVal); + aCustom->Set0DSize((float) theVal); } if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myPreHighlightActor )) { - aCustom->Set0DSize(theVal); + aCustom->Set0DSize((float) theVal); } Modified(); @@ -2181,13 +2191,13 @@ double SMESH_ActorDef::Get0DSize() void SMESH_ActorDef::SetBallSize(double theVal) { - myBallProp->SetPointSize(theVal); + myBallProp->SetPointSize((float) theVal); if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myHighlightActor )) { - aCustom->SetBallSize(theVal); + aCustom->SetBallSize((float) theVal); } if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myPreHighlightActor )) { - aCustom->SetBallSize(theVal); + aCustom->SetBallSize((float) theVal); } Modified(); @@ -2216,7 +2226,7 @@ void SMESH_ActorDef::SetBallScale( double theVal ) Modified(); } -int SMESH_ActorDef::GetObjDimension( const int theObjId ) +int SMESH_ActorDef::GetObjDimension( const vtkIdType theObjId ) { return myVisualObj->GetElemDimension( theObjId ); } @@ -2484,9 +2494,9 @@ void SMESH_ActorDef::UpdateDistribution() std::vector nbEvents; std::vector funValues; SMESH_VisualObjDef::TEntityList elems; - if ( ! dynamic_cast(myVisualObj.get())) - dynamic_cast(myVisualObj.get())->GetEntities( fun->GetType(), elems ); - std::vector elemIds; elemIds.reserve( elems.size() ); + if ( dynamic_cast(myVisualObj.get())) + dynamic_cast(myVisualObj.get())->GetEntities( fun->GetType(), elems ); + std::vector elemIds; elemIds.reserve( elems.size() ); for ( SMESH_VisualObjDef::TEntityList::iterator e = elems.begin(); e != elems.end(); ++e) elemIds.push_back( (*e)->GetID()); vtkLookupTable* lookupTable = static_cast(myScalarBarActor->GetLookupTable()); @@ -2670,9 +2680,9 @@ SPlot2d_Histogram* SMESH_ActorDef::UpdatePlot2Histogram() std::vector nbEvents; std::vector funValues; SMESH_VisualObjDef::TEntityList elems; - if ( ! dynamic_cast(myVisualObj.get())) - dynamic_cast(myVisualObj.get())->GetEntities( fun->GetType(), elems ); - std::vector elemIds; + if ( dynamic_cast(myVisualObj.get())) + dynamic_cast(myVisualObj.get())->GetEntities( fun->GetType(), elems ); + std::vector elemIds; for ( SMESH_VisualObjDef::TEntityList::iterator e = elems.begin(); e != elems.end(); ++e) elemIds.push_back( (*e)->GetID());