Commit | Line | Data |
---|---|---|
b311480e | 1 | // Created on: 2011-08-01 |
2 | // Created by: Sergey ZERCHANINOV | |
3 | // Copyright (c) 2011-2012 OPEN CASCADE SAS | |
4 | // | |
5 | // The content of this file is subject to the Open CASCADE Technology Public | |
6 | // License Version 6.5 (the "License"). You may not use the content of this file | |
7 | // except in compliance with the License. Please obtain a copy of the License | |
8 | // at http://www.opencascade.org and read it completely before using this file. | |
9 | // | |
10 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its | |
11 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. | |
12 | // | |
13 | // The Original Code and all software distributed under the License is | |
14 | // distributed on an "AS IS" basis, without warranty of any kind, and the | |
15 | // Initial Developer hereby disclaims all such warranties, including without | |
16 | // limitation, any warranties of merchantability, fitness for a particular | |
17 | // purpose or non-infringement. Please see the License for the specific terms | |
18 | // and conditions governing the rights and limitations under the License. | |
19 | ||
2166f0fa SK |
20 | #ifndef OpenGl_Structure_Header |
21 | #define OpenGl_Structure_Header | |
22 | ||
23 | #include <NCollection_List.hxx> | |
24 | #include <InterfaceGraphic_Graphic3d.hxx> | |
25 | ||
26 | #include <OpenGl_AspectLine.hxx> | |
27 | #include <OpenGl_AspectFace.hxx> | |
28 | #include <OpenGl_AspectMarker.hxx> | |
29 | #include <OpenGl_AspectText.hxx> | |
30 | ||
31 | #include <OpenGl_Group.hxx> | |
32 | #include <OpenGl_Matrix.hxx> | |
33 | ||
bf75be98 | 34 | class OpenGl_Structure; |
35 | ||
36 | typedef NCollection_List<const OpenGl_Structure* > OpenGl_ListOfStructure; | |
37 | typedef NCollection_List<const OpenGl_Group* > OpenGl_ListOfGroup; | |
2166f0fa SK |
38 | |
39 | class OpenGl_Structure : public OpenGl_Element | |
40 | { | |
5e27df78 | 41 | |
42 | public: | |
43 | ||
44 | OpenGl_Structure(); | |
2166f0fa SK |
45 | |
46 | void SetTransformation (const float *AMatrix); | |
47 | ||
48 | void SetTransformPersistence (const CALL_DEF_TRANSFORM_PERSISTENCE &ATransPers); | |
49 | ||
50 | void SetDegenerateModel (const Standard_Integer AMode, const float ASkipRatio); | |
51 | ||
52 | void SetAspectLine (const CALL_DEF_CONTEXTLINE &AContext); | |
bf75be98 | 53 | void SetAspectFace (const Handle(OpenGl_Context)& theCtx, |
54 | const CALL_DEF_CONTEXTFILLAREA& theAspect); | |
2166f0fa SK |
55 | void SetAspectMarker (const CALL_DEF_CONTEXTMARKER &AContext); |
56 | void SetAspectText (const CALL_DEF_CONTEXTTEXT &AContext); | |
57 | ||
5e27df78 | 58 | void SetHighlightBox (const Handle(OpenGl_Context)& theGlCtx, |
59 | const CALL_DEF_BOUNDBOX& theBoundBox); | |
60 | ||
61 | void ClearHighlightBox (const Handle(OpenGl_Context)& theGlCtx); | |
62 | ||
63 | void SetHighlightColor (const Handle(OpenGl_Context)& theGlCtx, | |
64 | const Standard_ShortReal R, | |
65 | const Standard_ShortReal G, | |
66 | const Standard_ShortReal B); | |
2166f0fa | 67 | |
5e27df78 | 68 | void ClearHighlightColor (const Handle(OpenGl_Context)& theGlCtx); |
2166f0fa SK |
69 | |
70 | void SetNamedStatus (const Standard_Integer aStatus) { myNamedStatus = aStatus; } | |
71 | ||
72 | void Connect (const OpenGl_Structure *astructure); | |
73 | void Disconnect (const OpenGl_Structure *astructure); | |
74 | ||
5e27df78 | 75 | OpenGl_Group* AddGroup(); |
76 | void RemoveGroup (const Handle(OpenGl_Context)& theGlCtx, | |
77 | const OpenGl_Group* theGroup); | |
78 | void Clear (const Handle(OpenGl_Context)& theGlCtx); | |
2166f0fa | 79 | |
59f45b7c | 80 | //! Set z layer ID to display the structure in specified layer |
81 | void SetZLayer (const Standard_Integer theLayerIndex); | |
82 | ||
83 | //! Get z layer ID | |
84 | Standard_Integer GetZLayer () const; | |
2166f0fa | 85 | |
5e27df78 | 86 | virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const; |
87 | virtual void Release (const Handle(OpenGl_Context)& theGlCtx); | |
88 | ||
dd8a4ce9 | 89 | //! This method releases GL resources without actual elements destruction. |
90 | //! As result structure could be correctly destroyed layter without GL context | |
91 | //! (after last window was closed for example). | |
92 | //! | |
93 | //! Notice however that reusage of this structure after calling this method is incorrect | |
94 | //! and will lead to broken visualization due to loosed data. | |
95 | void ReleaseGlResources (const Handle(OpenGl_Context)& theGlCtx); | |
96 | ||
5e27df78 | 97 | protected: |
98 | ||
99 | virtual ~OpenGl_Structure(); | |
100 | ||
101 | protected: | |
2166f0fa SK |
102 | |
103 | //Structure_LABBegin | |
5e27df78 | 104 | OpenGl_Matrix* myTransformation; |
105 | TEL_TRANSFORM_PERSISTENCE* myTransPers; | |
106 | DEGENERATION* myDegenerateModel; | |
107 | OpenGl_AspectLine* myAspectLine; | |
108 | OpenGl_AspectFace* myAspectFace; | |
109 | OpenGl_AspectMarker* myAspectMarker; | |
110 | OpenGl_AspectText* myAspectText; | |
2166f0fa | 111 | //Structure_LABHighlight |
5e27df78 | 112 | OpenGl_Group* myHighlightBox; |
113 | TEL_COLOUR* myHighlightColor; | |
2166f0fa SK |
114 | //Structure_LABVisibility |
115 | //Structure_LABPick | |
5e27df78 | 116 | int myNamedStatus; //Structure_LABNameSet |
117 | int myZLayer; | |
2166f0fa | 118 | |
5e27df78 | 119 | OpenGl_ListOfStructure myConnected; |
120 | OpenGl_ListOfGroup myGroups; | |
2166f0fa | 121 | |
5e27df78 | 122 | public: |
2166f0fa | 123 | |
1c35b92f | 124 | DEFINE_STANDARD_ALLOC |
5e27df78 | 125 | |
2166f0fa SK |
126 | }; |
127 | ||
128 | #endif //OpenGl_Structure_Header |