5398fe27fb389914d8901eb04733b8e9ba44201d
[occt.git] / src / Graphic3d / Graphic3d_AspectFillArea3d.cxx
1 // Created by: NW,JPB,CAL
2 // Copyright (c) 1991-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #include <Graphic3d_AspectFillArea3d.hxx>
17
18 IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_AspectFillArea3d, Standard_Transient)
19
20 // =======================================================================
21 // function : Graphic3d_AspectFillArea3d
22 // purpose  :
23 // =======================================================================
24 Graphic3d_AspectFillArea3d::Graphic3d_AspectFillArea3d()
25 : myInteriorColor       (Quantity_NOC_CYAN1),
26   myBackInteriorColor   (Quantity_NOC_CYAN1),
27   myEdgeColor           (Quantity_NOC_WHITE),
28   myInteriorStyle       (Aspect_IS_EMPTY),
29   myShadingModel        (Graphic3d_TOSM_DEFAULT),
30   myEdgeType            (Aspect_TOL_SOLID),
31   myEdgeWidth           (1.0f),
32   myHatchStyle          (Handle(Graphic3d_HatchStyle)()),
33   myToDistinguishMaterials (false),
34   myToDrawEdges         (false),
35   myToSuppressBackFaces (true),
36   myToMapTexture        (false)
37 {
38   //
39 }
40
41 // =======================================================================
42 // function : Graphic3d_AspectFillArea3d
43 // purpose  :
44 // =======================================================================
45 Graphic3d_AspectFillArea3d::Graphic3d_AspectFillArea3d (const Aspect_InteriorStyle theInteriorStyle,
46                                                         const Quantity_Color&      theInteriorColor,
47                                                         const Quantity_Color&      theEdgeColor,
48                                                         const Aspect_TypeOfLine    theEdgeLineType,
49                                                         const Standard_Real        theEdgeLineWidth,
50                                                         const Graphic3d_MaterialAspect& theFrontMaterial,
51                                                         const Graphic3d_MaterialAspect& theBackMaterial)
52 : myFrontMaterial       (theFrontMaterial),
53   myBackMaterial        (theBackMaterial),
54   myInteriorColor       (theInteriorColor),
55   myBackInteriorColor   (theInteriorColor),
56   myEdgeColor           (theEdgeColor),
57   myInteriorStyle       (theInteriorStyle),
58   myShadingModel        (Graphic3d_TOSM_DEFAULT),
59   myEdgeType            (theEdgeLineType),
60   myEdgeWidth           ((float )theEdgeLineWidth),
61   myHatchStyle          (Handle(Graphic3d_HatchStyle)()),
62   myToDistinguishMaterials (false),
63   myToDrawEdges         (false),
64   myToSuppressBackFaces (true),
65   myToMapTexture        (false)
66 {
67   if (theEdgeLineWidth <= 0.0)
68   {
69     throw Aspect_AspectFillAreaDefinitionError("Bad value for EdgeLineWidth");
70   }
71 }
72
73 // =======================================================================
74 // function : Graphic3d_AspectFillArea3d
75 // purpose  :
76 // =======================================================================
77 void Graphic3d_AspectFillArea3d::SetTextureMap (const Handle(Graphic3d_TextureMap)& theTexture)
78 {
79   if (theTexture.IsNull())
80   {
81     myTextureSet.Nullify();
82     return;
83   }
84
85   myTextureSet = new Graphic3d_TextureSet (theTexture);
86 }