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 | |
21 | #ifndef OpenGl_Structure_Header | |
22 | #define OpenGl_Structure_Header | |
23 | ||
24 | #include <NCollection_List.hxx> | |
25 | #include <InterfaceGraphic_Graphic3d.hxx> | |
26 | ||
27 | #include <OpenGl_AspectLine.hxx> | |
28 | #include <OpenGl_AspectFace.hxx> | |
29 | #include <OpenGl_AspectMarker.hxx> | |
30 | #include <OpenGl_AspectText.hxx> | |
31 | ||
32 | #include <OpenGl_Group.hxx> | |
33 | #include <OpenGl_Matrix.hxx> | |
34 | ||
35 | typedef NCollection_List<const OpenGl_Structure *> OpenGl_ListOfStructure; | |
36 | typedef NCollection_List<const OpenGl_Group *> OpenGl_ListOfGroup; | |
37 | ||
38 | class OpenGl_Structure : public OpenGl_Element | |
39 | { | |
5e27df78 | 40 | |
41 | public: | |
42 | ||
43 | OpenGl_Structure(); | |
2166f0fa SK |
44 | |
45 | void SetTransformation (const float *AMatrix); | |
46 | ||
47 | void SetTransformPersistence (const CALL_DEF_TRANSFORM_PERSISTENCE &ATransPers); | |
48 | ||
49 | void SetDegenerateModel (const Standard_Integer AMode, const float ASkipRatio); | |
50 | ||
51 | void SetAspectLine (const CALL_DEF_CONTEXTLINE &AContext); | |
52 | void SetAspectFace (const CALL_DEF_CONTEXTFILLAREA &AContext); | |
53 | void SetAspectMarker (const CALL_DEF_CONTEXTMARKER &AContext); | |
54 | void SetAspectText (const CALL_DEF_CONTEXTTEXT &AContext); | |
55 | ||
5e27df78 | 56 | void SetHighlightBox (const Handle(OpenGl_Context)& theGlCtx, |
57 | const CALL_DEF_BOUNDBOX& theBoundBox); | |
58 | ||
59 | void ClearHighlightBox (const Handle(OpenGl_Context)& theGlCtx); | |
60 | ||
61 | void SetHighlightColor (const Handle(OpenGl_Context)& theGlCtx, | |
62 | const Standard_ShortReal R, | |
63 | const Standard_ShortReal G, | |
64 | const Standard_ShortReal B); | |
2166f0fa | 65 | |
5e27df78 | 66 | void ClearHighlightColor (const Handle(OpenGl_Context)& theGlCtx); |
2166f0fa SK |
67 | |
68 | void SetNamedStatus (const Standard_Integer aStatus) { myNamedStatus = aStatus; } | |
69 | ||
70 | void Connect (const OpenGl_Structure *astructure); | |
71 | void Disconnect (const OpenGl_Structure *astructure); | |
72 | ||
5e27df78 | 73 | OpenGl_Group* AddGroup(); |
74 | void RemoveGroup (const Handle(OpenGl_Context)& theGlCtx, | |
75 | const OpenGl_Group* theGroup); | |
76 | void Clear (const Handle(OpenGl_Context)& theGlCtx); | |
2166f0fa | 77 | |
59f45b7c | 78 | //! Set z layer ID to display the structure in specified layer |
79 | void SetZLayer (const Standard_Integer theLayerIndex); | |
80 | ||
81 | //! Get z layer ID | |
82 | Standard_Integer GetZLayer () const; | |
2166f0fa | 83 | |
5e27df78 | 84 | virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const; |
85 | virtual void Release (const Handle(OpenGl_Context)& theGlCtx); | |
86 | ||
dd8a4ce9 | 87 | //! This method releases GL resources without actual elements destruction. |
88 | //! As result structure could be correctly destroyed layter without GL context | |
89 | //! (after last window was closed for example). | |
90 | //! | |
91 | //! Notice however that reusage of this structure after calling this method is incorrect | |
92 | //! and will lead to broken visualization due to loosed data. | |
93 | void ReleaseGlResources (const Handle(OpenGl_Context)& theGlCtx); | |
94 | ||
5e27df78 | 95 | protected: |
96 | ||
97 | virtual ~OpenGl_Structure(); | |
98 | ||
99 | protected: | |
2166f0fa SK |
100 | |
101 | //Structure_LABBegin | |
5e27df78 | 102 | OpenGl_Matrix* myTransformation; |
103 | TEL_TRANSFORM_PERSISTENCE* myTransPers; | |
104 | DEGENERATION* myDegenerateModel; | |
105 | OpenGl_AspectLine* myAspectLine; | |
106 | OpenGl_AspectFace* myAspectFace; | |
107 | OpenGl_AspectMarker* myAspectMarker; | |
108 | OpenGl_AspectText* myAspectText; | |
2166f0fa | 109 | //Structure_LABHighlight |
5e27df78 | 110 | OpenGl_Group* myHighlightBox; |
111 | TEL_COLOUR* myHighlightColor; | |
2166f0fa SK |
112 | //Structure_LABVisibility |
113 | //Structure_LABPick | |
5e27df78 | 114 | int myNamedStatus; //Structure_LABNameSet |
115 | int myZLayer; | |
2166f0fa | 116 | |
5e27df78 | 117 | OpenGl_ListOfStructure myConnected; |
118 | OpenGl_ListOfGroup myGroups; | |
2166f0fa | 119 | |
5e27df78 | 120 | public: |
2166f0fa | 121 | |
1c35b92f | 122 | DEFINE_STANDARD_ALLOC |
5e27df78 | 123 | |
2166f0fa SK |
124 | }; |
125 | ||
126 | #endif //OpenGl_Structure_Header |