42cf5bc1 |
1 | // Created on: 2003-10-13 |
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_VectorPrsBuilder_HeaderFile |
17 | #define _MeshVS_VectorPrsBuilder_HeaderFile |
18 | |
42cf5bc1 |
19 | #include <MeshVS_DataMapOfIntegerVector.hxx> |
20 | #include <MeshVS_PrsBuilder.hxx> |
21 | #include <MeshVS_DisplayModeFlags.hxx> |
42cf5bc1 |
22 | #include <MeshVS_BuilderPriority.hxx> |
42cf5bc1 |
23 | #include <TColgp_Array1OfPnt.hxx> |
7dd7c146 |
24 | |
42cf5bc1 |
25 | class MeshVS_Mesh; |
26 | class Quantity_Color; |
27 | class MeshVS_DataSource; |
42cf5bc1 |
28 | class gp_Trsf; |
29 | class Graphic3d_ArrayOfPrimitives; |
30 | class gp_Vec; |
31 | |
42cf5bc1 |
32 | DEFINE_STANDARD_HANDLE(MeshVS_VectorPrsBuilder, MeshVS_PrsBuilder) |
33 | |
34 | //! This class provides methods to create vector data presentation. |
35 | //! It store map of vectors assigned with nodes or elements. |
36 | //! In simplified mode vectors draws with thickened ends instead of arrows |
37 | class MeshVS_VectorPrsBuilder : public MeshVS_PrsBuilder |
38 | { |
39 | |
40 | public: |
41 | |
42 | |
43 | Standard_EXPORT MeshVS_VectorPrsBuilder(const Handle(MeshVS_Mesh)& Parent, const Standard_Real MaxLength, const Quantity_Color& VectorColor, const MeshVS_DisplayModeFlags& Flags = MeshVS_DMF_VectorDataPrs, const Handle(MeshVS_DataSource)& DS = 0, const Standard_Integer Id = -1, const MeshVS_BuilderPriority& Priority = MeshVS_BP_Vector, const Standard_Boolean IsSimplePrs = Standard_False); |
44 | |
45 | //! Builds vector data presentation |
79104795 |
46 | Standard_EXPORT virtual void Build (const Handle(Prs3d_Presentation)& Prs, const TColStd_PackedMapOfInteger& IDs, TColStd_PackedMapOfInteger& IDsToExclude, const Standard_Boolean IsElement, const Standard_Integer theDisplayMode) const Standard_OVERRIDE; |
42cf5bc1 |
47 | |
48 | //! Adds to array of polygons and polylines some primitive representing single vector |
49 | Standard_EXPORT void DrawVector (const gp_Trsf& theTrsf, const Standard_Real Length, const Standard_Real MaxLength, const TColgp_Array1OfPnt& ArrowPoints, const Handle(Graphic3d_ArrayOfPrimitives)& Lines, const Handle(Graphic3d_ArrayOfPrimitives)& ArrowLines, const Handle(Graphic3d_ArrayOfPrimitives)& Triangles) const; |
50 | |
51 | //! Calculates points of arrow presentation |
52 | Standard_EXPORT static Standard_Real calculateArrow (TColgp_Array1OfPnt& Points, const Standard_Real Length, const Standard_Real ArrowPart); |
53 | |
54 | //! Returns map of vectors assigned with nodes or elements |
55 | Standard_EXPORT const MeshVS_DataMapOfIntegerVector& GetVectors (const Standard_Boolean IsElement) const; |
56 | |
57 | //! Sets map of vectors assigned with nodes or elements |
58 | Standard_EXPORT void SetVectors (const Standard_Boolean IsElement, const MeshVS_DataMapOfIntegerVector& Map); |
59 | |
60 | //! Returns true, if map isn't empty |
61 | Standard_EXPORT Standard_Boolean HasVectors (const Standard_Boolean IsElement) const; |
62 | |
63 | //! Returns vector assigned with certain node or element |
64 | Standard_EXPORT Standard_Boolean GetVector (const Standard_Boolean IsElement, const Standard_Integer ID, gp_Vec& Vect) const; |
65 | |
66 | //! Sets vector assigned with certain node or element |
67 | Standard_EXPORT void SetVector (const Standard_Boolean IsElement, const Standard_Integer ID, const gp_Vec& Vect); |
68 | |
69 | //! Calculates minimal and maximal length of vectors in map |
70 | //! ( nodal, if IsElement = False or elemental, if IsElement = True ) |
71 | Standard_EXPORT void GetMinMaxVectorValue (const Standard_Boolean IsElement, Standard_Real& MinValue, Standard_Real& MaxValue) const; |
72 | |
73 | //! Sets flag that indicates is simple vector arrow mode uses or not |
74 | //! default value is False |
75 | Standard_EXPORT void SetSimplePrsMode (const Standard_Boolean IsSimpleArrow); |
76 | |
77 | //! Sets parameters of simple vector arrwo presentation |
78 | //! theLineWidthParam - coefficient of vector line width (to draw line instead of arrow) |
79 | //! theStartParam and theEndParam parameters of start and end of thickened ends |
80 | //! position of thickening calculates according to parameters and maximum vector length |
81 | //! default values are: |
82 | //! theLineWidthParam = 2.5 |
83 | //! theStartParam = 0.85 |
84 | //! theEndParam = 0.95 |
85 | Standard_EXPORT void SetSimplePrsParams (const Standard_Real theLineWidthParam, const Standard_Real theStartParam, const Standard_Real theEndParam); |
86 | |
87 | |
88 | |
89 | |
92efcf78 |
90 | DEFINE_STANDARD_RTTIEXT(MeshVS_VectorPrsBuilder,MeshVS_PrsBuilder) |
42cf5bc1 |
91 | |
92 | protected: |
93 | |
94 | |
95 | |
96 | |
97 | private: |
98 | |
99 | |
100 | Standard_Boolean myIsSimplePrs; |
101 | Standard_Real mySimpleWidthPrm; |
102 | Standard_Real mySimpleStartPrm; |
103 | Standard_Real mySimpleEndPrm; |
104 | MeshVS_DataMapOfIntegerVector myNodeVectorMap; |
105 | MeshVS_DataMapOfIntegerVector myElemVectorMap; |
106 | |
107 | |
108 | }; |
109 | |
110 | |
111 | |
112 | |
113 | |
114 | |
115 | |
116 | #endif // _MeshVS_VectorPrsBuilder_HeaderFile |