//
// This file is part of Open CASCADE Technology software library.
//
-// This library is free software; you can redistribute it and / or modify it
-// under the terms of the GNU Lesser General Public version 2.1 as published
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-#include <MeshVS_TextPrsBuilder.ixx>
-#include <MeshVS_DisplayModeFlags.hxx>
-
-#include <Graphic3d_Group.hxx>
-#include <Prs3d_Root.hxx>
-#include <Prs3d_TextAspect.hxx>
-#include <Graphic3d_AspectText3d.hxx>
+#include <Font_NameOfFont.hxx>
#include <Graphic3d_ArrayOfPoints.hxx>
-#include <TColStd_ListIteratorOfListOfReal.hxx>
-#include <Graphic3d_Vertex.hxx>
#include <Graphic3d_AspectMarker3d.hxx>
-#include <TColStd_Array1OfReal.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
-#include <TColStd_HPackedMapOfInteger.hxx>
-
+#include <Graphic3d_AspectText3d.hxx>
+#include <Graphic3d_Text.hxx>
+#include <Graphic3d_Group.hxx>
+#include <Graphic3d_Vertex.hxx>
+#include <MeshVS_Buffer.hxx>
#include <MeshVS_DataSource.hxx>
+#include <MeshVS_DisplayModeFlags.hxx>
#include <MeshVS_Drawer.hxx>
-#include <MeshVS_Mesh.hxx>
#include <MeshVS_DrawerAttribute.hxx>
-#include <MeshVS_Buffer.hxx>
+#include <MeshVS_Mesh.hxx>
+#include <MeshVS_TextPrsBuilder.hxx>
+#include <Prs3d_Presentation.hxx>
+#include <Prs3d_Root.hxx>
+#include <Prs3d_TextAspect.hxx>
+#include <Quantity_Color.hxx>
+#include <Standard_Type.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <TColStd_Array1OfReal.hxx>
+#include <TColStd_HPackedMapOfInteger.hxx>
+#include <TColStd_ListIteratorOfListOfReal.hxx>
+#include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
-#include <Font_NameOfFont.hxx>
+IMPLEMENT_STANDARD_RTTIEXT(MeshVS_TextPrsBuilder,MeshVS_PrsBuilder)
//================================================================
// Function : Constructor MeshVS_TextPrsBuilder
!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 WNT
- 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;
- Standard_Integer AStyleInt;
Aspect_TypeOfDisplayText ADisplayType = Aspect_TODT_NORMAL;
- TCollection_AsciiString AFontString;
- Standard_Integer ADispInt;
// Bold font is used by default for better text readability
Font_FontAspect AFontAspectType = Font_FA_Bold;
- Standard_Integer AAspect;
-
aDrawer->GetColor ( MeshVS_DA_TextColor, AColor );
aDrawer->GetDouble ( MeshVS_DA_TextExpansionFactor, AExpansionFactor );
aDrawer->GetDouble ( MeshVS_DA_TextSpace, ASpace );
+ TCollection_AsciiString AFontString = Font_NOF_ASCII_MONO;
if ( aDrawer->GetAsciiString ( MeshVS_DA_TextFont, AFontString ) )
AFont = AFontString.ToCString();
+
+ Standard_Integer AStyleInt = Aspect_TOST_ANNOTATION;
if ( aDrawer->GetInteger ( MeshVS_DA_TextStyle, AStyleInt ) )
ATextStyle = (Aspect_TypeOfStyleText) AStyleInt;
+
+ Standard_Integer ADispInt = Aspect_TODT_NORMAL;
if ( aDrawer->GetInteger ( MeshVS_DA_TextDisplayType, ADispInt ) )
ADisplayType = (Aspect_TypeOfDisplayText) ADispInt;
+
+ Standard_Integer AAspect = Font_FA_Bold;
if ( aDrawer->GetInteger ( MeshVS_DA_TextFontAspect, AAspect ) )
- AFontAspectType = (Font_FontAspect)AAspect;
+ AFontAspectType = (Font_FontAspect)AAspect;
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);
}
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 ) )
continue;
}
- 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);
+ aPnts.Append (Graphic3d_Vec3 ((float )X, (float )Y, (float )Z));
+
+ Handle(Graphic3d_Text) aText = new Graphic3d_Text ((Standard_ShortReal)aHeight);
+ aText->SetText (aStr);
+ aText->SetPosition (gp_Pnt (X, Y, Z));
+ aTextGroup->AddText(aText);
}
}
}
+ 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 );
}