// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-#include <MeshVS_MeshPrsBuilder.ixx>
-#include <Prs3d_Root.hxx>
-#include <Prs3d_ShadingAspect.hxx>
-#include <Prs3d_LineAspect.hxx>
-#include <Prs3d_PointAspect.hxx>
-
-#include <Graphic3d_AspectLine3d.hxx>
-#include <Graphic3d_AspectFillArea3d.hxx>
-#include <Graphic3d_AspectMarker3d.hxx>
-#include <Graphic3d_ArrayOfPolygons.hxx>
-#include <Graphic3d_ArrayOfTriangles.hxx>
-#include <Graphic3d_ArrayOfSegments.hxx>
+#include <Aspect_InteriorStyle.hxx>
#include <Graphic3d_ArrayOfPoints.hxx>
+#include <Graphic3d_ArrayOfPolygons.hxx>
#include <Graphic3d_ArrayOfPolylines.hxx>
+#include <Graphic3d_ArrayOfPrimitives.hxx>
+#include <Graphic3d_ArrayOfSegments.hxx>
+#include <Graphic3d_ArrayOfTriangles.hxx>
+#include <Graphic3d_AspectFillArea3d.hxx>
+#include <Graphic3d_AspectLine3d.hxx>
+#include <Graphic3d_AspectMarker3d.hxx>
#include <Graphic3d_Group.hxx>
-
-#include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
-#include <TColStd_ListIteratorOfListOfReal.hxx>
-#include <TColStd_MapIntegerHasher.hxx>
-#include <TColStd_Array1OfReal.hxx>
-#include <TColStd_Array1OfInteger.hxx>
-#include <TColStd_SequenceOfInteger.hxx>
-#include <TColStd_PackedMapOfInteger.hxx>
-#include <TColStd_HPackedMapOfInteger.hxx>
-#include <TColStd_MapOfInteger.hxx>
-
-#include <Quantity_NameOfColor.hxx>
-#include <Aspect_InteriorStyle.hxx>
-#include <Select3D_SensitivePoint.hxx>
-
+#include <MeshVS_Buffer.hxx>
#include <MeshVS_DataSource.hxx>
#include <MeshVS_Drawer.hxx>
-#include <MeshVS_Mesh.hxx>
-#include <MeshVS_Tool.hxx>
#include <MeshVS_DrawerAttribute.hxx>
#include <MeshVS_MapOfTwoNodes.hxx>
-#include <MeshVS_Buffer.hxx>
+#include <MeshVS_Mesh.hxx>
+#include <MeshVS_MeshPrsBuilder.hxx>
#include <MeshVS_SymmetricPairHasher.hxx>
-
+#include <MeshVS_Tool.hxx>
#include <NCollection_Map.hxx>
#include <NCollection_Vector.hxx>
+#include <Prs3d_LineAspect.hxx>
+#include <Prs3d_PointAspect.hxx>
+#include <Prs3d_Presentation.hxx>
+#include <Prs3d_Root.hxx>
+#include <Prs3d_ShadingAspect.hxx>
+#include <Quantity_NameOfColor.hxx>
+#include <Select3D_SensitivePoint.hxx>
+#include <Standard_Type.hxx>
+#include <TColStd_Array1OfInteger.hxx>
+#include <TColStd_Array1OfReal.hxx>
+#include <TColStd_HPackedMapOfInteger.hxx>
+#include <TColStd_ListIteratorOfListOfReal.hxx>
+#include <TColStd_MapIntegerHasher.hxx>
+#include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_PackedMapOfInteger.hxx>
+#include <TColStd_SequenceOfInteger.hxx>
+
+#ifdef _WIN32
+ #include <malloc.h> // for alloca()
+#endif
+
+IMPLEMENT_STANDARD_RTTIEXT(MeshVS_MeshPrsBuilder,MeshVS_PrsBuilder)
//================================================================
// Function : Constructor MeshVS_MeshPrsBuilder
aDispMode &= MeshVS_DMF_OCCMask;
//--------------------------------------------------------
- Standard_Real aShrinkCoef;
+ Standard_Real aShrinkCoef = 0.0;
aDrawer->GetDouble ( MeshVS_DA_ShrinkCoeff, aShrinkCoef );
Standard_Boolean IsWireFrame = ( aDispMode==MeshVS_DMF_WireFrame ),
IsShrink = ( aDispMode==MeshVS_DMF_Shrink ),
HasHilightFlag = ( ( DisplayMode & MeshVS_DMF_HilightPrs ) != 0 ),
HasSelectFlag = ( ( DisplayMode & MeshVS_DMF_SelectionPrs ) != 0 ),
- IsMeshReflect, IsMeshAllowOverlap, IsReflect, IsMeshSmoothShading = Standard_False;
+ IsMeshReflect = Standard_False, IsMeshAllowOverlap = Standard_False,
+ IsMeshSmoothShading = Standard_False;
aDrawer->GetBoolean ( MeshVS_DA_Reflection, IsMeshReflect );
aDrawer->GetBoolean ( MeshVS_DA_IsAllowOverlapped, IsMeshAllowOverlap );
- IsReflect = ( IsMeshReflect && !HasHilightFlag );
+ const Standard_Boolean IsReflect = ( IsMeshReflect && !HasHilightFlag );
aDrawer->GetBoolean ( MeshVS_DA_SmoothShading, IsMeshSmoothShading );
// display mode for highlighted prs of groups
aDrawer->GetMaterial ( MeshVS_DA_FrontMaterial, AMat );
if ( !IsReflect )
{
- AMat.SetReflectionModeOff(Graphic3d_TOR_AMBIENT);
- AMat.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
- AMat.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
- AMat.SetReflectionModeOff(Graphic3d_TOR_EMISSION);
+ AMat.SetAmbientColor (Quantity_NOC_BLACK);
+ AMat.SetDiffuseColor (Quantity_NOC_BLACK);
+ AMat.SetSpecularColor(Quantity_NOC_BLACK);
+ AMat.SetEmissiveColor(Quantity_NOC_BLACK);
}
Handle( Graphic3d_AspectFillArea3d ) aFill = MeshVS_Tool::CreateAspectFillArea3d( GetDrawer(), AMat );
Handle( Graphic3d_AspectLine3d ) aBeam = MeshVS_Tool::CreateAspectLine3d ( GetDrawer() );
aEdgeSegments = new Graphic3d_ArrayOfSegments (aNbEdgePrimitives * 2);
}
- Standard_Integer howMany = 1;
- if ( IsOverlapControl )
- howMany = 2;
-
TColStd_PackedMapOfInteger aCustomElements;
- Quantity_Color anOldEdgeColor;
- Quantity_Color anEdgeColor;
- Quantity_Color anIntColor;
- Aspect_InteriorStyle anIntType;
- Aspect_TypeOfLine aLine;
- Standard_Real aWidth;
-
- aFill->Values (anIntType, anIntColor, anEdgeColor, aLine, aWidth);
-
+ Quantity_Color anOldEdgeColor;
+ Quantity_Color anEdgeColor = aFill->EdgeColor();
MeshVS_MapOfTwoNodes aLinkNodes;
// Forbid drawings of edges which overlap with some links
Graphic3d_MaterialAspect AMat;
aDrawer->GetMaterial ( MeshVS_DA_FrontMaterial, AMat );
- AMat.SetReflectionModeOff(Graphic3d_TOR_AMBIENT);
- AMat.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
- AMat.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
- AMat.SetReflectionModeOff(Graphic3d_TOR_EMISSION);
+ AMat.SetAmbientColor (Quantity_NOC_BLACK);
+ AMat.SetDiffuseColor (Quantity_NOC_BLACK);
+ AMat.SetSpecularColor(Quantity_NOC_BLACK);
+ AMat.SetEmissiveColor(Quantity_NOC_BLACK);
Handle( Graphic3d_AspectFillArea3d ) aFill = MeshVS_Tool::CreateAspectFillArea3d( GetDrawer(), AMat );
Handle( Graphic3d_AspectLine3d ) aBeam = MeshVS_Tool::CreateAspectLine3d( GetDrawer() );
IsPolylines = ( !theLines.IsNull() && theLines->ItemNumber() > 0 ),
IsLinkPolylines = ( !theLinkLines.IsNull() && theLinkLines->ItemNumber() > 0 );
- Aspect_InteriorStyle aStyle;
- Quantity_Color anIntColor, aBackColor, anEdgeColor;
- Aspect_TypeOfLine aType;
- Standard_Real aWidth;
+ Quantity_Color anIntColor = theFillAsp->InteriorColor();
+ Quantity_Color aBackColor = theFillAsp->BackInteriorColor();
+ Quantity_Color anEdgeColor = theFillAsp->EdgeColor();
+ Standard_Real aWidth = theFillAsp->EdgeWidth();
- theFillAsp->Values( aStyle, anIntColor, aBackColor, anEdgeColor, aType, aWidth );
+ Standard_Boolean isSupressBackFaces = Standard_False;
+ Handle(MeshVS_Drawer) aDrawer = GetDrawer();
+ if (!aDrawer.IsNull())
+ {
+ aDrawer->GetBoolean (MeshVS_DA_SupressBackFaces, isSupressBackFaces);
+ }
if ( IsPolygons && theFillAsp->FrontMaterial().Transparency()<0.01 )
{
Prs3d_Root::NewGroup ( Prs );
Handle (Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup ( Prs );
-
+ aGroup->SetClosed (isSupressBackFaces == Standard_True);
+ Handle(Graphic3d_AspectFillArea3d) aFillAsp = new Graphic3d_AspectFillArea3d (*theFillAsp);
//if ( IsPolygonsEdgesOff )
- theFillAsp->SetEdgeOff ();
+ aFillAsp->SetEdgeOff ();
//else
- // theFillAsp->SetEdgeOn ();
+ // aFillAsp->SetEdgeOn ();
if( anIntColor!=aBackColor )
- theFillAsp->SetDistinguishOn();
+ aFillAsp->SetDistinguishOn();
else
- theFillAsp->SetDistinguishOff();
+ aFillAsp->SetDistinguishOff();
+
+ aGroup->SetPrimitivesAspect (aFillAsp);
if( IsFacePolygons )
{
- aGroup->SetPrimitivesAspect ( theFillAsp );
aGroup->AddPrimitiveArray ( thePolygons );
}
if( IsVolumePolygons )
{
- Handle( Graphic3d_AspectFillArea3d ) aCullFillAsp =
- new Graphic3d_AspectFillArea3d( *( theFillAsp.operator->() ) );
-
- Standard_Boolean isSupressBackFaces = Standard_False;
- Handle( MeshVS_Drawer ) aDrawer = GetDrawer();
- if (!aDrawer.IsNull())
- aDrawer->GetBoolean ( MeshVS_DA_SupressBackFaces, isSupressBackFaces );
-
- if (isSupressBackFaces)
- aCullFillAsp->SuppressBackFace();
-
- aGroup->SetPrimitivesAspect ( aCullFillAsp );
aGroup->AddPrimitiveArray ( theVolumesInShad );
}
}
Prs3d_Root::NewGroup ( Prs );
Handle (Graphic3d_Group) aLGroup = Prs3d_Root::CurrentGroup ( Prs );
- theFillAsp->SetEdgeOff();
if ( IsSelected )
aLGroup->SetPrimitivesAspect ( theLineAsp );
else
( anEdgeColor, Aspect_TOL_SOLID, aWidth ) );
}
aLGroup->AddPrimitiveArray ( theLines );
- theFillAsp->SetEdgeOn();
}
if ( IsLinkPolylines )
{
Prs3d_Root::NewGroup ( Prs );
Handle (Graphic3d_Group) aBeamGroup = Prs3d_Root::CurrentGroup ( Prs );
-
- theFillAsp->SetEdgeOff();
if ( !IsSelected )
aBeamGroup->SetPrimitivesAspect ( theFillAsp );
aBeamGroup->SetPrimitivesAspect ( theLineAsp );
aBeamGroup->AddPrimitiveArray ( theLinkLines );
- theFillAsp->SetEdgeOn();
}
if ( IsPolygons && theFillAsp->FrontMaterial().Transparency()>=0.01 )
{
Prs3d_Root::NewGroup ( Prs );
Handle (Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup ( Prs );
-
+ aGroup->SetClosed (isSupressBackFaces == Standard_True);
+ Handle(Graphic3d_AspectFillArea3d) aFillAsp = new Graphic3d_AspectFillArea3d (*theFillAsp);
//if ( IsPolygonsEdgesOff )
- theFillAsp->SetEdgeOff ();
+ aFillAsp->SetEdgeOff ();
//else
- // theFillAsp->SetEdgeOn ();
+ // aFillAsp->SetEdgeOn ();
if( anIntColor!=aBackColor )
- theFillAsp->SetDistinguishOn();
+ aFillAsp->SetDistinguishOn();
else
- theFillAsp->SetDistinguishOff();
+ aFillAsp->SetDistinguishOff();
+
+ aGroup->SetPrimitivesAspect (aFillAsp);
if( IsFacePolygons )
{
- aGroup->SetPrimitivesAspect ( theFillAsp );
aGroup->AddPrimitiveArray ( thePolygons );
}
if( IsVolumePolygons )
{
- Handle( Graphic3d_AspectFillArea3d ) aCullFillAsp =
- new Graphic3d_AspectFillArea3d( *( theFillAsp.operator->() ) );
-
- Standard_Boolean isSupressBackFaces = Standard_False;
- Handle( MeshVS_Drawer ) aDrawer = GetDrawer();
- if (!aDrawer.IsNull())
- aDrawer->GetBoolean ( MeshVS_DA_SupressBackFaces, isSupressBackFaces );
-
- if (isSupressBackFaces)
- aCullFillAsp->SuppressBackFace();
-
- aGroup->SetPrimitivesAspect ( aCullFillAsp );
aGroup->AddPrimitiveArray ( theVolumesInShad );
}
}