0023510: Integration of test grid "vis" into the new testing system
[occt.git] / src / V2d / V2d_DefaultMap.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 <V2d_DefaultMap.ixx>
19 #include <TColStd_Array1OfInteger.hxx>
20 #include <Aspect_ColorMapEntry.hxx>
21 #include <Quantity_NameOfColor.hxx>
22 #include <Aspect_TypeMapEntry.hxx>
23 #include <Aspect_LineStyle.hxx>
24 #include <Aspect_WidthMapEntry.hxx>
25 #include <Aspect_FontMapEntry.hxx>
26 #include <Aspect_FontStyle.hxx>
27 #include <Aspect_TypeOfLine.hxx>
28 #include <Aspect_MarkMapEntry.hxx>
29 #include <Aspect_MarkerStyle.hxx>
30 #include <Aspect_Units.hxx>
31 #include <TColStd_Array1OfReal.hxx>
32 #include <TColStd_Array1OfBoolean.hxx>
33
34 static Handle(Aspect_GenericColorMap) V2dDMGCM;
35 static Handle(Aspect_TypeMap) V2dDMTM;
36 static Handle(Aspect_WidthMap) V2dDMWM;
37 static Handle(Aspect_FontMap) V2dDMFM;
38 static Handle(Aspect_MarkMap) V2dDMMM;
39
40 Handle(Aspect_GenericColorMap) V2d_DefaultMap::ColorMap () {
41   if (V2dDMGCM.IsNull()) {
42     Standard_Integer nbcol=12;
43     TColStd_Array1OfInteger a(1,nbcol);
44     a( 1) = (Standard_Integer) Quantity_NOC_WHITE;
45     a( 2) = (Standard_Integer) Quantity_NOC_BLACK;
46     a( 3) = (Standard_Integer) Quantity_NOC_RED;
47     a( 4) = (Standard_Integer) Quantity_NOC_GREEN;
48     a( 5) = (Standard_Integer) Quantity_NOC_BLUE1;
49     a( 6) = (Standard_Integer) Quantity_NOC_YELLOW;
50     a( 7) = (Standard_Integer) Quantity_NOC_SIENNA;
51     a( 8) = (Standard_Integer) Quantity_NOC_ORANGE2;
52     a( 9) = (Standard_Integer) Quantity_NOC_LIGHTGRAY;
53     a(10) = (Standard_Integer) Quantity_NOC_LIGHTSEAGREEN;
54     a(11) = (Standard_Integer) Quantity_NOC_GRAY50;
55     a(12) = (Standard_Integer) Quantity_NOC_GRAY70;
56
57     V2dDMGCM = new Aspect_GenericColorMap();
58     Aspect_ColorMapEntry e;
59     for (Standard_Integer i = 1; i <= nbcol; i++) {
60 //JR/Hp
61       Standard_Integer iq = a(i) ;
62       e.SetValue(i,Quantity_Color( (Quantity_NameOfColor) iq ));
63 //      e.SetValue(i,Quantity_Color((Quantity_NameOfColor) a(i)));
64       V2dDMGCM->AddEntry(e);
65     }
66   }
67
68   return V2dDMGCM;
69
70 }
71
72
73 Handle(Aspect_TypeMap) V2d_DefaultMap::TypeMap() {
74   if(V2dDMTM.IsNull()) {
75     V2dDMTM = new Aspect_TypeMap();
76     V2dDMTM->AddEntry(Aspect_TypeMapEntry(1, Aspect_LineStyle(Aspect_TOL_SOLID)));
77     V2dDMTM->AddEntry(Aspect_TypeMapEntry(2, Aspect_LineStyle(Aspect_TOL_DASH)));
78     V2dDMTM->AddEntry(Aspect_TypeMapEntry(3, Aspect_LineStyle(Aspect_TOL_DOT)));
79     V2dDMTM->AddEntry(Aspect_TypeMapEntry(4, Aspect_LineStyle(Aspect_TOL_DOTDASH)));
80   }
81   return V2dDMTM;
82 }
83
84 Handle(Aspect_WidthMap) V2d_DefaultMap::WidthMap() {
85   if(V2dDMWM.IsNull()) {
86     V2dDMWM = new Aspect_WidthMap();
87     V2dDMWM->AddEntry(Aspect_WidthMapEntry(1,0.00013 METER));
88     V2dDMWM->AddEntry(Aspect_WidthMapEntry(2,0.00018 METER));
89     V2dDMWM->AddEntry(Aspect_WidthMapEntry(3,0.00025 METER));
90     V2dDMWM->AddEntry(Aspect_WidthMapEntry(4,0.00035 METER));
91     V2dDMWM->AddEntry(Aspect_WidthMapEntry(5,0.00050 METER));
92     V2dDMWM->AddEntry(Aspect_WidthMapEntry(6,0.00070 METER));
93     V2dDMWM->AddEntry(Aspect_WidthMapEntry(7,0.00100 METER));
94     V2dDMWM->AddEntry(Aspect_WidthMapEntry(8,0.00140 METER));
95   }
96   return V2dDMWM;
97 }
98
99 Handle(Aspect_FontMap) V2d_DefaultMap::FontMap() {
100   if(V2dDMFM.IsNull()) {
101     V2dDMFM = new Aspect_FontMap();    
102
103     V2dDMFM->AddEntry(Aspect_FontMapEntry(1,Aspect_FontStyle("TABTXT01",0.01 METER,0.0,Standard_True)));
104
105
106     V2dDMFM->AddEntry(Aspect_FontMapEntry(2,Aspect_FontStyle("TABTXT02",0.01 METER,0.0,Standard_True)));
107
108     V2dDMFM->AddEntry(Aspect_FontMapEntry(3,Aspect_FontStyle("TABTXT03",0.01 METER,0.0,Standard_True)));
109
110     V2dDMFM->AddEntry(Aspect_FontMapEntry(4,Aspect_FontStyle("TABTXT04",0.01 METER,0.0,Standard_True)));    
111
112     V2dDMFM->AddEntry(Aspect_FontMapEntry(5,Aspect_FontStyle("TABTXT05",0.01 METER,0.0,Standard_True)));
113
114     V2dDMFM->AddEntry(Aspect_FontMapEntry(6,Aspect_FontStyle("TABTXT06",0.01 METER,0.0,Standard_True)));
115     V2dDMFM->AddEntry(Aspect_FontMapEntry(7,Aspect_FontStyle("TABTXT07",0.01 METER,0.0,Standard_True)));
116     V2dDMFM->AddEntry(Aspect_FontMapEntry(8,Aspect_FontStyle("TABTXT08",0.01 METER,0.0,Standard_True)));
117     V2dDMFM->AddEntry(Aspect_FontMapEntry(9,Aspect_FontStyle("TABTXT15",0.01 METER,0.0,Standard_True)));
118     V2dDMFM->AddEntry(Aspect_FontMapEntry
119                       (10,Aspect_FontStyle("Defaultfont",0.01 METER,0.0,Standard_False)));
120     V2dDMFM->AddEntry(Aspect_FontMapEntry
121                       (11,Aspect_FontStyle("Symbol",0.01 METER,0.0,Standard_False)));
122     
123     V2dDMFM->AddEntry(Aspect_FontMapEntry
124                       (12,Aspect_FontStyle("Courier",0.01 METER,0.0,Standard_False)));
125     V2dDMFM->AddEntry(Aspect_FontMapEntry
126                       (13,Aspect_FontStyle("Courier-Bold",0.01 METER,0.0,Standard_False)));
127     V2dDMFM->AddEntry(Aspect_FontMapEntry
128                       (14,Aspect_FontStyle("Courier-Italic",0.01 METER,0.0,Standard_False)));
129     V2dDMFM->AddEntry(Aspect_FontMapEntry
130                       (15,Aspect_FontStyle("Courier-BoldItalic",0.01 METER,0.0,Standard_False)));    
131     V2dDMFM->AddEntry(Aspect_FontMapEntry
132                       (16,Aspect_FontStyle("Courier-Oblique",0.01 METER,0.0,Standard_False)));
133     V2dDMFM->AddEntry(Aspect_FontMapEntry
134                       (17,Aspect_FontStyle("Helvetica",0.01 METER,0.0,Standard_False)));
135     V2dDMFM->AddEntry(Aspect_FontMapEntry
136                       (18,Aspect_FontStyle("Helvetica-Bold",0.01 METER,0.0,Standard_False)));
137     
138     V2dDMFM->AddEntry(Aspect_FontMapEntry
139                       (19,Aspect_FontStyle("Helvetica-Oblique",0.01 METER,0.0,Standard_False)));
140     V2dDMFM->AddEntry(Aspect_FontMapEntry
141                       (20,Aspect_FontStyle("Helvetica-BoldOblique",0.01 METER,0.0,Standard_False)));
142     V2dDMFM->AddEntry(Aspect_FontMapEntry
143                       (21,Aspect_FontStyle("Helvetica-Medium",0.01 METER,0.0,Standard_False)));   
144     V2dDMFM->AddEntry(Aspect_FontMapEntry
145                       (22,Aspect_FontStyle("Times",0.01 METER,0.0,Standard_False)));
146     V2dDMFM->AddEntry(Aspect_FontMapEntry
147                       (23,Aspect_FontStyle("Times-Bold",0.01 METER,0.0,Standard_False)));   
148     V2dDMFM->AddEntry(Aspect_FontMapEntry
149                       (24,Aspect_FontStyle("Times-Italic",0.01 METER,0.0,Standard_False)));
150     V2dDMFM->AddEntry(Aspect_FontMapEntry
151                       (25,Aspect_FontStyle("Times-BoldItalic",0.01 METER,0.0,Standard_False)));  
152     V2dDMFM->AddEntry(Aspect_FontMapEntry
153                       (26,Aspect_FontStyle("Times-Roman",0.01 METER,0.0,Standard_False)));
154
155     V2dDMFM->AddEntry(Aspect_FontMapEntry
156                       (27,Aspect_FontStyle("Utopia-Bold",0.01 METER,0.0,Standard_False)));
157     V2dDMFM->AddEntry(Aspect_FontMapEntry
158                       (28,Aspect_FontStyle("Utopia-Italic",0.01 METER,0.0,Standard_False)));
159     V2dDMFM->AddEntry(Aspect_FontMapEntry
160                       (29,Aspect_FontStyle("Utopia-BoldItalic",0.01 METER,0.0,Standard_False)));
161     V2dDMFM->AddEntry(Aspect_FontMapEntry
162                       (30,Aspect_FontStyle("Utopia-Regular",0.01 METER,0.0,Standard_False)));   
163     //V2dDMFM->AddEntry(Aspect_FontMapEntry(10,Aspect_FontStyle("-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1" ,0.003 METER,0.0,Standard_False)));
164
165   }
166   return V2dDMFM;
167 }
168
169 Handle(Aspect_MarkMap) V2d_DefaultMap::MarkMap() {
170   if(V2dDMMM.IsNull()) {
171     V2dDMMM = new Aspect_MarkMap();
172     V2dDMMM->AddEntry(Aspect_MarkMapEntry( 1, Aspect_MarkerStyle(Aspect_TOM_POINT)));
173     V2dDMMM->AddEntry(Aspect_MarkMapEntry( 2, Aspect_MarkerStyle(Aspect_TOM_PLUS)));
174     V2dDMMM->AddEntry(Aspect_MarkMapEntry( 3, Aspect_MarkerStyle(Aspect_TOM_STAR)));
175     V2dDMMM->AddEntry(Aspect_MarkMapEntry( 4, Aspect_MarkerStyle(Aspect_TOM_O)));
176     V2dDMMM->AddEntry(Aspect_MarkMapEntry( 5, Aspect_MarkerStyle(Aspect_TOM_X)));
177     V2dDMMM->AddEntry(Aspect_MarkMapEntry( 6, Aspect_MarkerStyle(Aspect_TOM_O_POINT)));
178     V2dDMMM->AddEntry(Aspect_MarkMapEntry( 7, Aspect_MarkerStyle(Aspect_TOM_O_PLUS)));
179     V2dDMMM->AddEntry(Aspect_MarkMapEntry( 8, Aspect_MarkerStyle(Aspect_TOM_O_STAR)));
180     V2dDMMM->AddEntry(Aspect_MarkMapEntry( 9, Aspect_MarkerStyle(Aspect_TOM_O_X)));
181     V2dDMMM->AddEntry(Aspect_MarkMapEntry(10, Aspect_MarkerStyle(Aspect_TOM_BALL)));
182     V2dDMMM->AddEntry(Aspect_MarkMapEntry(11, Aspect_MarkerStyle(Aspect_TOM_RING1)));
183     V2dDMMM->AddEntry(Aspect_MarkMapEntry(12, Aspect_MarkerStyle(Aspect_TOM_RING2)));
184     V2dDMMM->AddEntry(Aspect_MarkMapEntry(13, Aspect_MarkerStyle(Aspect_TOM_RING3)));
185     TColStd_Array1OfReal X(1,5);
186     TColStd_Array1OfReal Y(1,5);
187     TColStd_Array1OfBoolean B(1,5);
188     X(1) = 0.;   Y(1) = 0.  ; B(1) = Standard_False;
189     X(2) = 1.;   Y(2) = 0.  ; B(2) = Standard_True;
190     X(3) = 0.7;  Y(3) = 0.2 ; B(3) = Standard_True;
191     X(4) = 1.;   Y(4) = 0.  ; B(4) = Standard_False;
192     X(5) = 0.7;  Y(5) = -0.2; B(5) = Standard_True;
193     V2dDMMM->AddEntry(Aspect_MarkMapEntry(14,Aspect_MarkerStyle(X,Y,B)));
194
195   }
196   return V2dDMMM;
197 }