mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-11 16:19:17 +05:00
Implemented a new method of displaying shading with edges mode of object using OCC technologies
This commit is contained in:
parent
a8393a0169
commit
806956971e
@ -854,9 +854,6 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap
|
||||
// - color for edges in shading+edges mode
|
||||
AISShape->SetEdgesInShadingColor( SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::OutlineColor ) ).value<QColor>() ) );
|
||||
|
||||
// ???
|
||||
AISShape->storeBoundaryColors();
|
||||
|
||||
// set display mode
|
||||
AISShape->SetDisplayMode( HasDisplayMode() ?
|
||||
// predefined display mode, manually set to displayer via GEOM_Displayer::SetDisplayMode() function
|
||||
@ -864,6 +861,13 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap
|
||||
// display mode from properties
|
||||
propMap.value( GEOM::propertyName( GEOM::DisplayMode ) ).toInt() );
|
||||
|
||||
// - face boundaries color
|
||||
if( AISShape->DisplayMode() == GEOM_AISShape::ShadingWithEdges )
|
||||
AISShape->Attributes()->SetFaceBoundaryDraw( Standard_True );
|
||||
anAspect = AISShape->Attributes()->FaceBoundaryAspect();
|
||||
anAspect->SetColor( SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::OutlineColor ) ).value<QColor>() ) );
|
||||
AISShape->Attributes()->SetFaceBoundaryAspect( anAspect );
|
||||
|
||||
// set display vectors flag
|
||||
AISShape->SetDisplayVectors( propMap.value( GEOM::propertyName( GEOM::EdgesDirection ) ).toBool() );
|
||||
|
||||
|
@ -158,14 +158,9 @@ GEOM_AISShape::GEOM_AISShape(const TopoDS_Shape& shape,
|
||||
|
||||
myShadingColor = Quantity_Color( Quantity_NOC_GOLDENROD );
|
||||
myPrevDisplayMode = 0;
|
||||
storeBoundaryColors();
|
||||
|
||||
|
||||
myEdgesInShadingColor = Quantity_Color( Quantity_NOC_GOLDENROD );
|
||||
|
||||
myUIsoNumber = -1;
|
||||
myVIsoNumber = -1;
|
||||
|
||||
myTopLevel = Standard_False;
|
||||
Graphic3d_MaterialAspect aMatAspect;
|
||||
if ( !HasMaterial() ) {
|
||||
@ -226,9 +221,6 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent
|
||||
case 0://StdSelect_DM_Wireframe:
|
||||
case CustomHighlight:
|
||||
{
|
||||
restoreIsoNumbers();
|
||||
// Restore wireframe edges colors
|
||||
restoreBoundaryColors();
|
||||
if(isTopLev) {
|
||||
SetColor(topLevelColor());
|
||||
Handle(Prs3d_LineAspect) anAspect = Attributes()->WireAspect();
|
||||
@ -243,10 +235,16 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent
|
||||
}
|
||||
case 1://StdSelect_DM_Shading:
|
||||
{
|
||||
restoreIsoNumbers();
|
||||
shadingMode(aPresentationManager, aPrs, aMode);
|
||||
// Store wireframe edges colors
|
||||
storeBoundaryColors();
|
||||
break;
|
||||
}
|
||||
case 2: { //ShadingWithEdges
|
||||
//Shaded faces
|
||||
shadingMode(aPresentationManager, aPrs, AIS_Shaded);
|
||||
myDrawer->SetFaceBoundaryDraw( Standard_True );
|
||||
Handle(Prs3d_LineAspect) aBoundaryAspect =
|
||||
new Prs3d_LineAspect ( myEdgesInShadingColor, Aspect_TOL_SOLID, myOwnWidth );
|
||||
myDrawer->SetFaceBoundaryAspect (aBoundaryAspect);
|
||||
break;
|
||||
}
|
||||
case 3: //StdSelect_DM_HLR:
|
||||
@ -258,38 +256,6 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( aMode == ShadingWithEdges ) {
|
||||
// Temporary store number of iso lines in order to recover its later
|
||||
// when display mode is achnged to 'Wirefame' or 'Shading'.
|
||||
// Iso lines are not displayed in 'Shading with edges' mode.
|
||||
storeIsoNumbers();
|
||||
|
||||
// Reset number of iso lines to 0
|
||||
resetIsoNumbers();
|
||||
|
||||
//Shaded faces
|
||||
shadingMode(aPresentationManager, aPrs, AIS_Shaded);
|
||||
|
||||
// Store wireframe edges colors
|
||||
storeBoundaryColors();
|
||||
|
||||
// Coloring edges
|
||||
Handle(Prs3d_LineAspect) anAspect = myDrawer->UnFreeBoundaryAspect();
|
||||
anAspect->SetColor( myEdgesInShadingColor );
|
||||
myDrawer->SetUnFreeBoundaryAspect( anAspect );
|
||||
|
||||
anAspect = myDrawer->FreeBoundaryAspect();
|
||||
anAspect->SetColor( myEdgesInShadingColor );
|
||||
myDrawer->SetFreeBoundaryAspect( anAspect );
|
||||
|
||||
// Add edges to presentation
|
||||
if( anIsColorField && myFieldDimension == 1 )
|
||||
drawField( aPrs );
|
||||
else
|
||||
StdPrs_WFDeflectionShape::Add(aPrs,myshape,myDrawer);
|
||||
}
|
||||
|
||||
if (isShowVectors())
|
||||
{
|
||||
const bool isVector = IsKind(STANDARD_TYPE(GEOM_AISVector));
|
||||
@ -428,61 +394,6 @@ void GEOM_AISShape::shadingMode(const Handle(PrsMgr_PresentationManager3d)& aPre
|
||||
}
|
||||
}
|
||||
|
||||
void GEOM_AISShape::storeIsoNumbers()
|
||||
{
|
||||
myUIsoNumber = myDrawer->UIsoAspect()->Number();
|
||||
myVIsoNumber = myDrawer->VIsoAspect()->Number();
|
||||
}
|
||||
|
||||
void GEOM_AISShape::restoreIsoNumbers()
|
||||
{
|
||||
if ( myUIsoNumber > 0 ) {
|
||||
// Restore number of U iso lines
|
||||
Handle(Prs3d_IsoAspect) anAspect = myDrawer->UIsoAspect();
|
||||
anAspect->SetNumber( myUIsoNumber );
|
||||
myDrawer->SetUIsoAspect( anAspect );
|
||||
}
|
||||
|
||||
if ( myVIsoNumber > 0 ) {
|
||||
// Restore number of V iso lines
|
||||
Handle(Prs3d_IsoAspect) anAspect = myDrawer->VIsoAspect();
|
||||
anAspect->SetNumber( myVIsoNumber );
|
||||
myDrawer->SetVIsoAspect( anAspect );
|
||||
}
|
||||
}
|
||||
|
||||
void GEOM_AISShape::resetIsoNumbers()
|
||||
{
|
||||
Handle(Prs3d_IsoAspect) anAspect = myDrawer->UIsoAspect();
|
||||
anAspect->SetNumber( 0 );
|
||||
myDrawer->SetUIsoAspect( anAspect );
|
||||
|
||||
anAspect = myDrawer->VIsoAspect();
|
||||
anAspect->SetNumber( 0 );
|
||||
myDrawer->SetVIsoAspect( anAspect );
|
||||
}
|
||||
|
||||
void GEOM_AISShape::storeBoundaryColors()
|
||||
{
|
||||
Aspect_TypeOfLine aLT;
|
||||
Standard_Real aW;
|
||||
|
||||
myDrawer->FreeBoundaryAspect()->Aspect()->Values( myFreeBoundaryColor, aLT, aW);
|
||||
myDrawer->UnFreeBoundaryAspect()->Aspect()->Values( myUnFreeBoundaryColor, aLT, aW);
|
||||
}
|
||||
|
||||
void GEOM_AISShape::restoreBoundaryColors()
|
||||
{
|
||||
Handle(Prs3d_LineAspect) anAspect = myDrawer->FreeBoundaryAspect();
|
||||
anAspect->SetColor( myFreeBoundaryColor );
|
||||
myDrawer->SetFreeBoundaryAspect( anAspect );
|
||||
|
||||
anAspect = myDrawer->UnFreeBoundaryAspect();
|
||||
anAspect->SetColor( myUnFreeBoundaryColor );
|
||||
myDrawer->SetUnFreeBoundaryAspect( anAspect );
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean GEOM_AISShape::isTopLevel() {
|
||||
return myTopLevel;
|
||||
}
|
||||
|
@ -139,12 +139,6 @@ public:
|
||||
const Handle(Standard_Type)& DynamicType() const;
|
||||
Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
|
||||
|
||||
void storeIsoNumbers();
|
||||
void restoreIsoNumbers();
|
||||
void resetIsoNumbers();
|
||||
|
||||
void storeBoundaryColors();
|
||||
|
||||
static Quantity_Color topLevelColor();
|
||||
static void setTopLevelColor(const Quantity_Color c);
|
||||
|
||||
@ -173,8 +167,6 @@ protected:
|
||||
const Handle(Prs3d_Presentation)& aPrs,
|
||||
const Standard_Integer aMode);
|
||||
|
||||
void restoreBoundaryColors();
|
||||
|
||||
// Displaying the field data
|
||||
void drawField( const Handle(Prs3d_Presentation)& thePrs,
|
||||
const bool theIsText = false,
|
||||
@ -185,15 +177,8 @@ protected:
|
||||
gp_Pnt& theCenter );
|
||||
|
||||
Quantity_Color myShadingColor;
|
||||
|
||||
Quantity_Color myFreeBoundaryColor;
|
||||
Quantity_Color myUnFreeBoundaryColor;
|
||||
|
||||
Quantity_Color myEdgesInShadingColor;
|
||||
|
||||
int myUIsoNumber;
|
||||
int myVIsoNumber;
|
||||
|
||||
private:
|
||||
TCollection_AsciiString myName;
|
||||
bool myDisplayVectors;
|
||||
|
@ -186,9 +186,6 @@ GEOM_Actor::GEOM_Actor():
|
||||
|
||||
myShadingFaceActor->SetProperty(myShadingFaceProp.GetPointer());
|
||||
|
||||
myNbIsos[0] = -1;
|
||||
myNbIsos[1] = -1;
|
||||
|
||||
// Toggle display mode
|
||||
setDisplayMode(0); // WIRE FRAME
|
||||
SetVectorMode(0); //
|
||||
@ -297,16 +294,6 @@ setDisplayMode(int theMode)
|
||||
MESSAGE ( "GEOM_Actor::setDisplayMode = "<<theMode );
|
||||
#endif
|
||||
|
||||
if ( theMode == (int)eShading || theMode == (int)eShadingWithEdges ) {
|
||||
// Temporary store number of iso lines in order to recover its later
|
||||
// when display mode is changed to 'Wirefame'
|
||||
// Iso lines are not displayed in 'Shading' and 'Shading with edges' modes.
|
||||
StoreIsoNumbers();
|
||||
|
||||
// Reset number of iso lines to 0
|
||||
ResetIsoNumbers();
|
||||
}
|
||||
|
||||
if ( theMode == (int)eShadingWithEdges ) {
|
||||
// Coloring edges
|
||||
myIsolatedEdgeActor->GetProperty()->SetColor(myIsolatedEdgeColor[0],
|
||||
@ -320,9 +307,6 @@ setDisplayMode(int theMode)
|
||||
myEdgesInShadingColor[2]);
|
||||
}
|
||||
else {
|
||||
// Restore number of iso-lines
|
||||
RestoreIsoNumbers();
|
||||
|
||||
// Coloring edges
|
||||
myIsolatedEdgeActor->GetProperty()->SetColor(myIsolatedEdgeColor[0],
|
||||
myIsolatedEdgeColor[1],
|
||||
@ -896,14 +880,6 @@ GEOM_Actor
|
||||
MESSAGE ( this << " GEOM_Actor::Highlight myIsSelected="<<myIsSelected );
|
||||
#endif
|
||||
|
||||
if ( myDisplayMode == (int)eShading || myDisplayMode == (int)eShadingWithEdges ) {
|
||||
if ( theIsHighlight )
|
||||
RestoreIsoNumbers();
|
||||
else
|
||||
// Reset number of iso lines to 0
|
||||
ResetIsoNumbers();
|
||||
}
|
||||
|
||||
SALOME_Actor::Highlight(theIsHighlight); // this method call ::highlight(theIsHighlight) in the end
|
||||
SetVisibility(GetVisibility());
|
||||
}
|
||||
@ -924,14 +900,6 @@ GEOM_Actor
|
||||
if ( !GetPickable() )
|
||||
return false;
|
||||
|
||||
if ( myDisplayMode == (int)eShading || myDisplayMode == (int)eShadingWithEdges ) {
|
||||
if ( theIsHighlight )
|
||||
RestoreIsoNumbers();
|
||||
else
|
||||
// Reset number of iso lines to 0
|
||||
ResetIsoNumbers();
|
||||
}
|
||||
|
||||
myPreHighlightActor->SetVisibility( false );
|
||||
bool anIsPreselected = myIsPreselected;
|
||||
|
||||
@ -1081,11 +1049,6 @@ void GEOM_Actor::SetEdgesInShadingColor(double r,double g,double b)
|
||||
myEdgesInShadingColor[2] = b;
|
||||
}
|
||||
|
||||
void GEOM_Actor::StoreIsoNumbers()
|
||||
{
|
||||
myWireframeFaceSource->GetNbIso(myNbIsos[0], myNbIsos[1]);
|
||||
}
|
||||
|
||||
void GEOM_Actor::SetIsosWidth(const int width) {
|
||||
myWireframeFaceActor->GetProperty()->SetLineWidth(width);
|
||||
}
|
||||
@ -1106,16 +1069,3 @@ void GEOM_Actor::SetWidth(const int width) {
|
||||
int GEOM_Actor::GetWidth() const {
|
||||
return (int)myIsolatedEdgeActor->GetProperty()->GetLineWidth();
|
||||
}
|
||||
|
||||
void GEOM_Actor::RestoreIsoNumbers()
|
||||
{
|
||||
if ( myNbIsos[0] > 0 || myNbIsos[1] > 0 )
|
||||
// Restore number of U and (or) V iso lines
|
||||
myWireframeFaceSource->SetNbIso(myNbIsos);
|
||||
}
|
||||
|
||||
void GEOM_Actor::ResetIsoNumbers()
|
||||
{
|
||||
int aNb[2] = {0, 0};
|
||||
myWireframeFaceSource->SetNbIso(aNb);
|
||||
}
|
||||
|
@ -202,15 +202,6 @@ public:
|
||||
bool
|
||||
GetVectorMode();
|
||||
|
||||
void
|
||||
StoreIsoNumbers();
|
||||
|
||||
void
|
||||
RestoreIsoNumbers();
|
||||
|
||||
void
|
||||
ResetIsoNumbers();
|
||||
|
||||
protected:
|
||||
void SetModified();
|
||||
|
||||
@ -221,7 +212,6 @@ protected:
|
||||
|
||||
private:
|
||||
TopoDS_Shape myShape;
|
||||
int myNbIsos[2];
|
||||
bool isOnlyVertex;
|
||||
|
||||
float myDeflection;
|
||||
|
Loading…
Reference in New Issue
Block a user