0023510: Integration of test grid "vis" into the new testing system
[occt.git] / src / Prs2d / Prs2d_AspectLine.cxx
1 // Copyright (c) 1999-2012 OPEN CASCADE SAS
2 //
3 // The content of this file is subject to the Open CASCADE Technology Public
4 // License Version 6.5 (the "License"). You may not use the content of this file
5 // except in compliance with the License. Please obtain a copy of the License
6 // at http://www.opencascade.org and read it completely before using this file.
7 //
8 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
10 //
11 // The Original Code and all software distributed under the License is
12 // distributed on an "AS IS" basis, without warranty of any kind, and the
13 // Initial Developer hereby disclaims all such warranties, including without
14 // limitation, any warranties of merchantability, fitness for a particular
15 // purpose or non-infringement. Please see the License for the specific terms
16 // and conditions governing the rights and limitations under the License.
17
18 #include <Prs2d_AspectLine.ixx>
19 #include <Aspect_LineStyle.hxx>
20 #include <Aspect_GenericColorMap.hxx> 
21 #include <Aspect_TypeMap.hxx>
22 #include <Aspect_WidthMap.hxx>
23
24 Prs2d_AspectLine::Prs2d_AspectLine()
25   :
26    Prs2d_AspectRoot( Prs2d_AN_LINE ),
27
28    myColor( Quantity_Color(Quantity_NOC_YELLOW) ),
29    myType( Aspect_TOL_SOLID ),
30    myWidth( Aspect_WOL_THIN ),
31    myInterColor( Quantity_Color(Quantity_NOC_YELLOW) ),
32    myFillType( Graphic2d_TOPF_EMPTY ),
33    myTile( 0 ),
34    myDrawEdge( Standard_True ),
35    myColorIndex( 0 ),
36    myTypeIndex( 0 ),
37    myWidthIndex( 0 ),
38    myIntColorInd( 0 )
39
40 {
41 }
42
43 Prs2d_AspectLine::Prs2d_AspectLine( 
44                                 const Quantity_NameOfColor aColor, 
45                         const Aspect_TypeOfLine aType,
46                                 const Aspect_WidthOfLine aWidth,
47                 const Quantity_NameOfColor aIntColor,
48                 const Graphic2d_TypeOfPolygonFilling aTypeFill,
49                     const Standard_Integer aTile,
50                 const Standard_Boolean aDrawEdge ) 
51  :
52    Prs2d_AspectRoot( Prs2d_AN_LINE ),
53
54    myColor( Quantity_Color(aColor) ),
55    myType( aType ),
56    myWidth( aWidth ),
57    myInterColor( Quantity_Color(aIntColor) ),
58    myFillType( aTypeFill ),
59    myTile( aTile ),
60    myDrawEdge( aDrawEdge ),
61    myColorIndex( 0 ),
62    myTypeIndex( 0 ),
63    myWidthIndex( 0 ),
64    myIntColorInd( 0 )
65 {
66 }
67
68 Prs2d_AspectLine::Prs2d_AspectLine( 
69                                 const Quantity_Color& aColor, 
70                         const Aspect_TypeOfLine aType,
71                                 const Aspect_WidthOfLine aWidth,
72                 const Quantity_Color& aIntColor,
73                 const Graphic2d_TypeOfPolygonFilling aTypeFill,
74                     const Standard_Integer aTile,
75                 const Standard_Boolean aDrawEdge )
76  :
77    Prs2d_AspectRoot( Prs2d_AN_LINE ),
78
79    myColor( aColor ),
80    myType( aType ),
81    myWidth( aWidth ),
82    myInterColor( aIntColor ),
83    myFillType( aTypeFill ),
84    myTile( aTile ),
85    myDrawEdge( aDrawEdge ),
86    myColorIndex(0),
87    myTypeIndex(0),
88    myWidthIndex(0),
89    myIntColorInd( 0 )
90 {
91 }
92
93 void Prs2d_AspectLine::SetColor(const Quantity_NameOfColor aColor) {
94
95          SetColor( Quantity_Color(aColor) );
96 }
97
98 void Prs2d_AspectLine::SetColor(const Quantity_Color& aColor) {
99
100         if ( myColor != aColor ) {
101        myColor = aColor;
102        myColorIndex = 0;
103     }
104 }
105
106 void Prs2d_AspectLine::SetType(const Aspect_TypeOfLine aType) {
107
108         if ( myType != aType ) {
109        myType = aType;
110        myTypeIndex = 0;
111     }
112 }
113
114 void Prs2d_AspectLine::SetWidth(const Aspect_WidthOfLine aWidth) {
115
116         if ( myWidth != aWidth ) {
117        myWidth = aWidth;
118        myWidthIndex = 0;
119     }
120 }
121
122 void Prs2d_AspectLine::SetInterColor(const Quantity_NameOfColor aColor) {
123
124          SetInterColor( Quantity_Color(aColor) );
125 }
126
127 void Prs2d_AspectLine::SetInterColor(const Quantity_Color& aColor) {
128
129         if ( myInterColor != aColor ) {
130        myInterColor = aColor;
131        myIntColorInd = 0;
132     }
133 }
134
135 void Prs2d_AspectLine::SetTypeOfFill( const Graphic2d_TypeOfPolygonFilling aType ) {
136     myFillType = aType;
137 }
138
139 void Prs2d_AspectLine::SetTile( const Standard_Integer aTile ) {
140          myTile = aTile;
141 }
142
143 void Prs2d_AspectLine::SetDrawEdge( const Standard_Boolean aDrawEdge ) {
144           myDrawEdge = aDrawEdge;
145 }
146
147 void Prs2d_AspectLine::ValuesOfLine( Quantity_Color& aColor,
148                                          Aspect_TypeOfLine& aType,
149                                          Aspect_WidthOfLine& aWidth) const{
150         aColor = myColor;
151         aType  = myType;
152         aWidth = myWidth;
153
154 }
155
156 void Prs2d_AspectLine::ValuesOfPoly( Quantity_Color& aColor,
157                                      Graphic2d_TypeOfPolygonFilling& aType,
158                                          Standard_Integer& aTile,
159                                          Standard_Boolean& aDrawEdge ) const {
160     aColor    = myInterColor;
161     aType     = myFillType;
162         aTile     = myTile;
163         aDrawEdge = myDrawEdge;
164 }
165
166 Standard_Integer Prs2d_AspectLine::ColorIndex() const {
167
168   return myColorIndex;
169 }
170
171 Standard_Integer Prs2d_AspectLine::TypeIndex() const {
172
173   return myTypeIndex;
174 }
175
176 Standard_Integer Prs2d_AspectLine::WidthIndex() const {
177
178    return myWidthIndex;
179 }
180
181 Standard_Integer Prs2d_AspectLine::InterColorIndex() const {
182
183   return myIntColorInd;
184 }
185
186 void Prs2d_AspectLine::SetColorIndex( const Standard_Integer anInd )  {
187   
188         myColorIndex = anInd;
189 }
190
191 void Prs2d_AspectLine::SetTypeIndex( const Standard_Integer anInd )  {
192
193     myTypeIndex = anInd;
194 }
195
196 void Prs2d_AspectLine::SetWidthIndex( const Standard_Integer anInd )  {
197  
198         myWidthIndex = anInd;
199 }
200
201 void Prs2d_AspectLine::SetIntColorInd( const Standard_Integer anInd )  {
202   
203         myIntColorInd = anInd;
204 }