0029915: Porting to VC 2017 : Regressions in Modeling Algorithms on VC 2017
[occt.git] / src / MeshVS / MeshVS_MeshPrsBuilder.hxx
1 // Created on: 2003-10-10
2 // Created by: Alexander SOLOVYOV
3 // Copyright (c) 2003-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #ifndef _MeshVS_MeshPrsBuilder_HeaderFile
17 #define _MeshVS_MeshPrsBuilder_HeaderFile
18
19 #include <Standard.hxx>
20 #include <Standard_Type.hxx>
21
22 #include <MeshVS_PrsBuilder.hxx>
23 #include <MeshVS_DisplayModeFlags.hxx>
24 #include <Standard_Integer.hxx>
25 #include <MeshVS_BuilderPriority.hxx>
26 #include <TColStd_PackedMapOfInteger.hxx>
27 #include <Standard_Boolean.hxx>
28 #include <TColStd_Array1OfReal.hxx>
29 #include <Standard_Real.hxx>
30 #include <MeshVS_HArray1OfSequenceOfInteger.hxx>
31 class MeshVS_Mesh;
32 class MeshVS_DataSource;
33 class Prs3d_Presentation;
34 class Graphic3d_ArrayOfSegments;
35 class Graphic3d_ArrayOfTriangles;
36 class Graphic3d_ArrayOfPrimitives;
37 class Graphic3d_AspectFillArea3d;
38 class Graphic3d_AspectLine3d;
39
40
41 class MeshVS_MeshPrsBuilder;
42 DEFINE_STANDARD_HANDLE(MeshVS_MeshPrsBuilder, MeshVS_PrsBuilder)
43
44 //! This class provides methods to compute base mesh presentation
45 class MeshVS_MeshPrsBuilder : public MeshVS_PrsBuilder
46 {
47
48 public:
49
50   
51   //! Creates builder with certain display mode flags, data source, ID and priority
52   Standard_EXPORT MeshVS_MeshPrsBuilder(const Handle(MeshVS_Mesh)& Parent, const MeshVS_DisplayModeFlags& Flags = MeshVS_DMF_OCCMask, const Handle(MeshVS_DataSource)& DS = 0, const Standard_Integer Id = -1, const MeshVS_BuilderPriority& Priority = MeshVS_BP_Mesh);
53   
54   //! Builds base mesh presentation by calling the methods below
55   Standard_EXPORT virtual void Build (const Handle(Prs3d_Presentation)& Prs, const TColStd_PackedMapOfInteger& IDs, TColStd_PackedMapOfInteger& IDsToExclude, const Standard_Boolean IsElement, const Standard_Integer DisplayMode) const Standard_OVERRIDE;
56   
57   //! Builds nodes presentation
58   Standard_EXPORT virtual void BuildNodes (const Handle(Prs3d_Presentation)& Prs, const TColStd_PackedMapOfInteger& IDs, TColStd_PackedMapOfInteger& IDsToExclude, const Standard_Integer DisplayMode) const;
59   
60   //! Builds elements presentation
61   Standard_EXPORT virtual void BuildElements (const Handle(Prs3d_Presentation)& Prs, const TColStd_PackedMapOfInteger& IDs, TColStd_PackedMapOfInteger& IDsToExclude, const Standard_Integer DisplayMode) const;
62   
63   //! Builds presentation of hilighted entity
64   Standard_EXPORT virtual void BuildHilightPrs (const Handle(Prs3d_Presentation)& Prs, const TColStd_PackedMapOfInteger& IDs, const Standard_Boolean IsElement) const;
65   
66   //! Add to array polygons or polylines representing volume
67   Standard_EXPORT static void AddVolumePrs (const Handle(MeshVS_HArray1OfSequenceOfInteger)& Topo, const TColStd_Array1OfReal& Nodes, const Standard_Integer NbNodes, const Handle(Graphic3d_ArrayOfPrimitives)& Array, const Standard_Boolean IsReflected, const Standard_Boolean IsShrinked, const Standard_Boolean IsSelect, const Standard_Real ShrinkCoef);
68   
69   //! Calculate how many polygons or polylines are necessary to draw passed topology
70   Standard_EXPORT static void HowManyPrimitives (const Handle(MeshVS_HArray1OfSequenceOfInteger)& Topo, const Standard_Boolean AsPolygons, const Standard_Boolean IsSelect, const Standard_Integer NbNodes, Standard_Integer& Vertices, Standard_Integer& Bounds);
71
72
73
74
75   DEFINE_STANDARD_RTTIEXT(MeshVS_MeshPrsBuilder,MeshVS_PrsBuilder)
76
77 protected:
78
79   
80   //! Add to array of polylines some lines representing link
81   Standard_EXPORT void AddLinkPrs (const TColStd_Array1OfReal& theCoords, const Handle(Graphic3d_ArrayOfSegments)& theLines, const Standard_Boolean IsShrinked, const Standard_Real ShrinkCoef) const;
82   
83   //! Add to array of segments representing face's wire
84   Standard_EXPORT void AddFaceWirePrs (const TColStd_Array1OfReal& theCoords, const Standard_Integer theNbNodes, const Handle(Graphic3d_ArrayOfSegments)& theLines, const Standard_Boolean theIsShrinked, const Standard_Real theShrinkingCoef) const;
85   
86   //! Add to array of polygons a polygon representing face
87   Standard_EXPORT void AddFaceSolidPrs (const Standard_Integer ID, const TColStd_Array1OfReal& theCoords, const Standard_Integer theNbNodes, const Standard_Integer theMaxNodes, const Handle(Graphic3d_ArrayOfTriangles)& theTriangles, const Standard_Boolean theIsReflected, const Standard_Boolean theIsShrinked, const Standard_Real theShrinkCoef, const Standard_Boolean theIsMeshSmoothShading) const;
88   
89   //! Draw array of polygons and polylines in the certain order according to transparency
90   Standard_EXPORT void DrawArrays (const Handle(Prs3d_Presentation)& Prs, const Handle(Graphic3d_ArrayOfPrimitives)& thePolygons, const Handle(Graphic3d_ArrayOfPrimitives)& theLines, const Handle(Graphic3d_ArrayOfPrimitives)& theLinkLines, const Handle(Graphic3d_ArrayOfPrimitives)& theVolumesInShad, const Standard_Boolean IsPolygonsEdgesOff, const Standard_Boolean IsSelected, const Handle(Graphic3d_AspectFillArea3d)& theFillAsp, const Handle(Graphic3d_AspectLine3d)& theLineAsp) const;
91   
92   //! Default calculation of center of face or link. This method if useful for shrink mode presentation
93   //! theCoords is array of nodes co-ordinates in the strict order X1, Y1, Z1, X2...
94   //! NbNodes is number of nodes an element consist of
95   //! xG, yG, zG are co-ordinates of center whose will be returned
96   Standard_EXPORT static void CalculateCenter (const TColStd_Array1OfReal& theCoords, const Standard_Integer NbNodes, Standard_Real& xG, Standard_Real& yG, Standard_Real& zG);
97
98
99
100 private:
101
102
103
104
105 };
106
107
108
109
110
111
112
113 #endif // _MeshVS_MeshPrsBuilder_HeaderFile