Warnings on vc14 were eliminated
[occt.git] / src / VrmlData / VrmlData_Color.hxx
1 // Created on: 2006-05-28
2 // Created by: Alexander GRIGORIEV
3 // Copyright (c) 2006-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 #ifndef VrmlData_Color_HeaderFile
17 #define VrmlData_Color_HeaderFile
18
19 #include <VrmlData_ArrayVec3d.hxx>
20 #include <Quantity_Color.hxx>
21 #include <gp_XYZ.hxx>
22
23 /**
24  *  Implementation of the node Color
25  */
26 class VrmlData_Color : public VrmlData_ArrayVec3d
27 {
28  public:
29   // ---------- PUBLIC METHODS ----------
30
31   /**
32    * Empty constructor.
33    */
34   inline VrmlData_Color () {}
35
36   /**
37    * Constructor.
38    */
39   inline VrmlData_Color                 (const VrmlData_Scene&  theScene,
40                                          const char             * theName,
41                                          const size_t           nColors    =0,
42                                          const gp_XYZ           * arrColors=0L)
43     : VrmlData_ArrayVec3d (theScene, theName, nColors, arrColors)
44   {}
45
46   /**
47    * Query one color
48    * @param i
49    *   index in the array of colors [0 .. N-1]
50    * @return
51    *   the color value for the index. If index irrelevant, returns (0., 0., 0.)
52    */
53   inline const Quantity_Color Color (const Standard_Integer i) const
54   { return Quantity_Color (Value(i).X(), Value(i).Y(), Value(i).Z(),
55                            Quantity_TOC_RGB); }
56
57   /**
58    * Set the array data
59    */
60   inline void           SetColors (const size_t nColors,
61                                    const gp_XYZ * arrColors)
62   { myLength = nColors; myArray = arrColors; }
63
64   /**
65    * Create a copy of this node.
66    * If the parameter is null, a new copied node is created. Otherwise new node
67    * is not created, but rather the given one is modified.<p>
68    */
69   Standard_EXPORT virtual Handle(VrmlData_Node)
70                         Clone     (const Handle(VrmlData_Node)& theOther)const Standard_OVERRIDE;
71
72   /**
73    * Read the Node from input stream.
74    */
75   Standard_EXPORT virtual VrmlData_ErrorStatus
76                         Read      (VrmlData_InBuffer& theBuffer) Standard_OVERRIDE;
77
78   /**
79    * Write the Node to the Scene output.
80    */
81   Standard_EXPORT virtual VrmlData_ErrorStatus
82                         Write     (const char * thePrefix) const Standard_OVERRIDE;
83
84  private:
85   // ---------- PRIVATE FIELDS ----------
86
87
88
89
90  public:
91 // Declaration of CASCADE RTTI
92 DEFINE_STANDARD_RTTI_INLINE(VrmlData_Color,VrmlData_ArrayVec3d)
93 };
94
95 // Definition of HANDLE object using Standard_DefineHandle.hxx
96 DEFINE_STANDARD_HANDLE (VrmlData_Color, VrmlData_ArrayVec3d)
97
98
99 #endif