1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0029570: Visualization, Graphic3d_Aspect - merge Graphic3d_Group aspects

Graphic3d_AspectFillArea3d, Graphic3d_AspectLine3d, Graphic3d_AspectMarker3d
and Graphic3d_AspectText3d have been merged into new class Graphic3d_Aspects.
The old classes are preserved as dummy sub-classes of Graphic3d_Aspects
preserving different per-aspect defaults.

Methods IsGroupPrimitivesAspectSet(), GroupPrimitivesAspect(), FillAreaAspect(),
LineAspect() and MarkerAspect() have been removed from Graphic3d_Group.
Instead, a new method Graphic3d_Group::ReplaceAspects() has been introduced
for replacing existing group aspects.

AIS_Shape now uses new method AIS_InteractiveObject::replaceAspects()
for updating computed groups with new aspects without presentation recomputation
in places where SynchronizeAspects() is not applicable.

OpenGl_AspectFace, OpenGl_AspectLine, OpenGl_AspectMarker
and OpenGl_AspectText have been merged into new class OpenGl_Aspects.

ViewerTest::parseColor() - fix uninitialized alpha component.
Graphic3d_AspectText3d/Prs3d_TextAspect - removed unused properties Space, ExpansionFactor, Angle.
Remove getters Values() deprecated since OCCT 7.1.0.
This commit is contained in:
kgv
2019-03-03 21:07:55 +03:00
committed by apn
parent e08a9b0302
commit bf5f0ca20a
86 changed files with 2275 additions and 3412 deletions

View File

@@ -159,15 +159,10 @@ void MeshVS_TextPrsBuilder::Build ( const Handle(Prs3d_Presentation)& Prs,
!aDrawer->GetDouble ( MeshVS_DA_TextHeight, aHeight ) )
return;
Prs3d_Root::NewGroup ( Prs );
Handle (Graphic3d_Group) aTextGroup = Prs3d_Root::CurrentGroup ( Prs );
Handle(Graphic3d_Group) aTextGroup = Prs->NewGroup();
Quantity_Color AColor = Quantity_NOC_YELLOW;
#ifdef _WIN32
Standard_CString AFont = "Courier New";
#else
Standard_CString AFont = "Courier";
#endif
Standard_CString AFont = Font_NOF_ASCII_MONO;
Standard_Real AExpansionFactor = 1.0;
Standard_Real ASpace = 0.0;
Aspect_TypeOfStyleText ATextStyle = Aspect_TOST_ANNOTATION;
@@ -196,10 +191,7 @@ void MeshVS_TextPrsBuilder::Build ( const Handle(Prs3d_Presentation)& Prs,
Handle (Graphic3d_AspectText3d) aTextAspect = new Graphic3d_AspectText3d ( AColor, AFont, AExpansionFactor, ASpace,
ATextStyle, ADisplayType );
aTextAspect->SetTextFontAspect( AFontAspectType );
Handle (Graphic3d_AspectMarker3d) anAspectMarker3d =
new Graphic3d_AspectMarker3d( Aspect_TOM_POINT, Quantity_NOC_GRAY, 1. );
aTextGroup->SetPrimitivesAspect( aTextAspect );
aTextGroup->SetPrimitivesAspect( anAspectMarker3d );
aTextGroup->SetGroupPrimitivesAspect( aTextAspect );
MeshVS_Buffer aCoordsBuf (3*aMaxFaceNodes*sizeof(Standard_Real));
TColStd_Array1OfReal aCoords (aCoordsBuf, 1, 3*aMaxFaceNodes);
@@ -221,8 +213,8 @@ void MeshVS_TextPrsBuilder::Build ( const Handle(Prs3d_Presentation)& Prs,
}
anIDs.Subtract( IDsToExclude );
TColStd_MapIteratorOfPackedMapOfInteger it (anIDs);
for( ; it.More(); it.Next() )
NCollection_Sequence<Graphic3d_Vec3> aPnts;
for (TColStd_MapIteratorOfPackedMapOfInteger it (anIDs); it.More(); it.Next())
{
Standard_Integer aKey = it.Key();
if( GetText ( IsElement, aKey, aStr ) )
@@ -258,15 +250,27 @@ void MeshVS_TextPrsBuilder::Build ( const Handle(Prs3d_Presentation)& Prs,
continue;
}
aPnts.Append (Graphic3d_Vec3 ((float )X, (float )Y, (float )Z));
Graphic3d_Vertex aPoint (X, Y, Z);
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (1);
anArrayOfPoints->AddVertex (X, Y, Z);
aTextGroup->AddPrimitiveArray (anArrayOfPoints);
aTextGroup->Text (aStr.ToCString(), aPoint, aHeight);
}
}
}
if (!aPnts.IsEmpty())
{
Handle(Graphic3d_Group) aMarkerGroup = Prs->NewGroup();
Handle(Graphic3d_ArrayOfPoints) anArrayOfPoints = new Graphic3d_ArrayOfPoints (aPnts.Size());
for (NCollection_Sequence<Graphic3d_Vec3>::Iterator aPntIter (aPnts); aPntIter.More(); aPntIter.Next())
{
const Graphic3d_Vec3& aPnt = aPntIter.Value();
anArrayOfPoints->AddVertex (aPnt.x(), aPnt.y(), aPnt.z());
}
Handle (Graphic3d_AspectMarker3d) anAspectMarker3d = new Graphic3d_AspectMarker3d (Aspect_TOM_POINT, Quantity_NOC_GRAY, 1.0);
aMarkerGroup->SetGroupPrimitivesAspect (anAspectMarker3d);
aMarkerGroup->AddPrimitiveArray (anArrayOfPoints);
}
if (!aCustomElements.IsEmpty())
CustomBuild ( Prs, aCustomElements, IDsToExclude, theDisplayMode );
}