0031313: Foundation Classes - Dump improvement for classes
[occt.git] / src / Prs3d / Prs3d_DatumAspect.hxx
CommitLineData
42cf5bc1 1// Created on: 1993-07-30
2// Created by: Jean-Louis FRENKEL
3// Copyright (c) 1993-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _Prs3d_DatumAspect_HeaderFile
18#define _Prs3d_DatumAspect_HeaderFile
19
bc001a40 20#include <NCollection_DataMap.hxx>
21#include <Prs3d_ArrowAspect.hxx>
22#include <Prs3d_DatumAttribute.hxx>
23#include <Prs3d_DatumAxes.hxx>
24#include <Prs3d_DatumMode.hxx>
25#include <Prs3d_DatumParts.hxx>
4e1bc39a 26#include <Prs3d_LineAspect.hxx>
bc001a40 27#include <Prs3d_PointAspect.hxx>
28#include <Prs3d_ShadingAspect.hxx>
29#include <Prs3d_TextAspect.hxx>
42cf5bc1 30
31//! A framework to define the display of datums.
32class Prs3d_DatumAspect : public Prs3d_BasicAspect
33{
4e1bc39a 34 DEFINE_STANDARD_RTTIEXT(Prs3d_DatumAspect, Prs3d_BasicAspect)
42cf5bc1 35public:
36
42cf5bc1 37 //! An empty framework to define the display of datums.
38 Standard_EXPORT Prs3d_DatumAspect();
bc001a40 39
40 //! Returns the right-handed coordinate system set in SetComponent.
41 Standard_EXPORT Handle(Prs3d_LineAspect) LineAspect (Prs3d_DatumParts thePart) const;
42
43 //! Returns the right-handed coordinate system set in SetComponent.
44 Standard_EXPORT Handle(Prs3d_ShadingAspect) ShadingAspect (Prs3d_DatumParts thePart) const;
45
2108d9a2 46 //! Returns the text attributes for rendering labels.
bc001a40 47 const Handle(Prs3d_TextAspect)& TextAspect() const { return myTextAspect; }
48
2108d9a2 49 //! Sets text attributes for rendering labels.
50 void SetTextAspect (const Handle(Prs3d_TextAspect)& theTextAspect) { myTextAspect = theTextAspect; }
51
bc001a40 52 //! Returns the point aspect of origin wireframe presentation
53 const Handle(Prs3d_PointAspect)& PointAspect() const { return myPointAspect; }
54
2108d9a2 55 //! Returns the point aspect of origin wireframe presentation
56 void SetPointAspect (const Handle(Prs3d_PointAspect)& theAspect) { myPointAspect = theAspect; }
57
bc001a40 58 //! Returns the arrow aspect of presentation
59 const Handle(Prs3d_ArrowAspect)& ArrowAspect() const { return myArrowAspect; }
60
2108d9a2 61 //! Sets the arrow aspect of presentation
62 void SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect) { myArrowAspect = theAspect; }
63
42cf5bc1 64 //! Returns the attributes for display of the first axis.
bc001a40 65 Standard_DEPRECATED("This method is deprecated - LineAspect() should be called instead")
66 const Handle(Prs3d_LineAspect)& FirstAxisAspect() const { return myLineAspects.Find (Prs3d_DP_XAxis); }
67
42cf5bc1 68 //! Returns the attributes for display of the second axis.
bc001a40 69 Standard_DEPRECATED("This method is deprecated - LineAspect() should be called instead")
70 const Handle(Prs3d_LineAspect)& SecondAxisAspect() const { return myLineAspects.Find (Prs3d_DP_YAxis); }
71
42cf5bc1 72 //! Returns the attributes for display of the third axis.
bc001a40 73 Standard_DEPRECATED("This method is deprecated - LineAspect() should be called instead")
74 const Handle(Prs3d_LineAspect)& ThirdAxisAspect() const { return myLineAspects.Find (Prs3d_DP_ZAxis); }
75
42cf5bc1 76 //! Sets the DrawFirstAndSecondAxis attributes to active.
bc001a40 77 Standard_DEPRECATED("This method is deprecated - SetDrawDatumAxes() should be called instead")
78 Standard_EXPORT void SetDrawFirstAndSecondAxis (Standard_Boolean theToDraw);
79
42cf5bc1 80 //! Returns true if the first and second axes can be drawn.
bc001a40 81 Standard_DEPRECATED("This method is deprecated - DatumAxes() should be called instead")
82 Standard_Boolean DrawFirstAndSecondAxis() const
83 {
84 return (myAxes & Prs3d_DA_XAxis) != 0
85 && (myAxes & Prs3d_DA_YAxis) != 0;
86 }
4e1bc39a 87
42cf5bc1 88 //! Sets the DrawThirdAxis attributes to active.
bc001a40 89 Standard_DEPRECATED("This method is deprecated - SetDrawDatumAxes() should be called instead")
90 Standard_EXPORT void SetDrawThirdAxis (Standard_Boolean theToDraw);
91
42cf5bc1 92 //! Returns true if the third axis can be drawn.
bc001a40 93 Standard_DEPRECATED("This method is deprecated - DatumAxes() should be called instead")
94 Standard_Boolean DrawThirdAxis() const { return (myAxes & Prs3d_DA_ZAxis) != 0; }
95
96 //! Returns true if the given part is used in axes of aspect
97 Standard_EXPORT Standard_Boolean DrawDatumPart (Prs3d_DatumParts thePart) const;
98
99 //! Sets the axes used in the datum aspect
bb88f3ff 100 void SetDrawDatumAxes (Prs3d_DatumAxes theType) { myAxes = theType; }
bc001a40 101
102 //! Returns axes used in the datum aspect
bb88f3ff 103 Prs3d_DatumAxes DatumAxes() const { return myAxes; }
bc001a40 104
105 //! Sets the attribute of the datum type
106 void SetAttribute (Prs3d_DatumAttribute theType, const Standard_Real& theValue)
107 {
108 myAttributes.Bind (theType, theValue);
109 }
110
111 //! Returns the attribute of the datum type
112 Standard_Real Attribute (Prs3d_DatumAttribute theType) const
113 {
114 return myAttributes.Find (theType);
115 }
4e1bc39a 116
117 //! Sets the lengths of the three axes.
bc001a40 118 void SetAxisLength (Standard_Real theL1, Standard_Real theL2, Standard_Real theL3)
4e1bc39a 119 {
bc001a40 120 myAttributes.Bind (Prs3d_DA_XAxisLength, theL1);
121 myAttributes.Bind (Prs3d_DA_YAxisLength, theL2);
122 myAttributes.Bind (Prs3d_DA_ZAxisLength, theL3);
4e1bc39a 123 }
124
42cf5bc1 125 //! Returns the length of the displayed first axis.
bc001a40 126 Standard_EXPORT Standard_Real AxisLength (Prs3d_DatumParts thePart) const;
127
128 //! Returns the length of the displayed first axis.
129 Standard_DEPRECATED("This method is deprecated - AxisLength() should be called instead")
130 Standard_Real FirstAxisLength() const { return myAttributes.Find (Prs3d_DA_XAxisLength); }
4e1bc39a 131
42cf5bc1 132 //! Returns the length of the displayed second axis.
bc001a40 133 Standard_DEPRECATED("This method is deprecated - AxisLength() should be called instead")
134 Standard_Real SecondAxisLength() const { return myAttributes.Find (Prs3d_DA_YAxisLength); }
135
42cf5bc1 136 //! Returns the length of the displayed third axis.
bc001a40 137 Standard_DEPRECATED("This method is deprecated - AxisLength() should be called instead")
138 Standard_Real ThirdAxisLength() const { return myAttributes.Find (Prs3d_DA_ZAxisLength); }
42cf5bc1 139
fae1ae11
ZA
140 //! @return true if axes labels are drawn; TRUE by default.
141 Standard_Boolean ToDrawLabels() const { return myToDrawLabels; }
142
046a1c9d 143 //! Sets option to draw or not to draw text labels for axes
fae1ae11 144 void SetDrawLabels (Standard_Boolean theToDraw) { myToDrawLabels = theToDraw; }
bc001a40 145 void SetToDrawLabels (Standard_Boolean theToDraw) { myToDrawLabels = theToDraw; }
42cf5bc1 146
fae1ae11
ZA
147 //! @return true if axes arrows are drawn; TRUE by default.
148 Standard_Boolean ToDrawArrows() const { return myToDrawArrows; }
149
150 //! Sets option to draw or not arrows for axes
151 void SetDrawArrows (Standard_Boolean theToDraw) { myToDrawArrows = theToDraw; }
42cf5bc1 152
bc001a40 153 //! Returns type of arrow for a type of axis
154 Standard_EXPORT Prs3d_DatumParts ArrowPartForAxis (Prs3d_DatumParts thePart) const;
42cf5bc1 155
0904aa63 156 //! Dumps the content of me into the stream
bc73b006 157 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
0904aa63 158
bc001a40 159private:
160 Prs3d_DatumAxes myAxes;
046a1c9d 161 Standard_Boolean myToDrawLabels;
fae1ae11 162 Standard_Boolean myToDrawArrows;
bc001a40 163 NCollection_DataMap<Prs3d_DatumAttribute, Standard_Real> myAttributes;
164
165 NCollection_DataMap<Prs3d_DatumParts, Handle(Prs3d_ShadingAspect)> myShadedAspects;
166 NCollection_DataMap<Prs3d_DatumParts, Handle(Prs3d_LineAspect)> myLineAspects;
42cf5bc1 167
bc001a40 168 Handle(Prs3d_TextAspect) myTextAspect;
169 Handle(Prs3d_PointAspect) myPointAspect;
170 Handle(Prs3d_ArrowAspect) myArrowAspect;
42cf5bc1 171};
172
4e1bc39a 173DEFINE_STANDARD_HANDLE(Prs3d_DatumAspect, Prs3d_BasicAspect)
42cf5bc1 174
175#endif // _Prs3d_DatumAspect_HeaderFile