Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:32

0001 // Created on: 2006-05-28
0002 // Created by: Alexander GRIGORIEV
0003 // Copyright (c) 2006-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef VrmlData_Color_HeaderFile
0017 #define VrmlData_Color_HeaderFile
0018 
0019 #include <VrmlData_ArrayVec3d.hxx>
0020 #include <Quantity_Color.hxx>
0021 #include <gp_XYZ.hxx>
0022 
0023 /**
0024  *  Implementation of the node Color
0025  */
0026 class VrmlData_Color : public VrmlData_ArrayVec3d
0027 {
0028  public:
0029   // ---------- PUBLIC METHODS ----------
0030 
0031   /**
0032    * Empty constructor.
0033    */
0034   inline VrmlData_Color () {}
0035 
0036   /**
0037    * Constructor.
0038    */
0039   inline VrmlData_Color                 (const VrmlData_Scene&  theScene,
0040                                          const char             * theName,
0041                                          const size_t           nColors    =0,
0042                                          const gp_XYZ           * arrColors=0L)
0043     : VrmlData_ArrayVec3d (theScene, theName, nColors, arrColors)
0044   {}
0045 
0046   /**
0047    * Query one color
0048    * @param i
0049    *   index in the array of colors [0 .. N-1]
0050    * @return
0051    *   the color value for the index. If index irrelevant, returns (0., 0., 0.)
0052    */
0053   inline const Quantity_Color Color (const Standard_Integer i) const
0054   { return Quantity_Color (Value(i).X(), Value(i).Y(), Value(i).Z(),
0055                            Quantity_TOC_sRGB); }
0056 
0057   /**
0058    * Set the array data
0059    */
0060   inline void           SetColors (const size_t nColors,
0061                                    const gp_XYZ * arrColors)
0062   { myLength = nColors; myArray = arrColors; }
0063 
0064   /**
0065    * Create a copy of this node.
0066    * If the parameter is null, a new copied node is created. Otherwise new node
0067    * is not created, but rather the given one is modified.<p>
0068    */
0069   Standard_EXPORT virtual Handle(VrmlData_Node)
0070                         Clone     (const Handle(VrmlData_Node)& theOther)const Standard_OVERRIDE;
0071 
0072   /**
0073    * Read the Node from input stream.
0074    */
0075   Standard_EXPORT virtual VrmlData_ErrorStatus
0076                         Read      (VrmlData_InBuffer& theBuffer) Standard_OVERRIDE;
0077 
0078   /**
0079    * Write the Node to the Scene output.
0080    */
0081   Standard_EXPORT virtual VrmlData_ErrorStatus
0082                         Write     (const char * thePrefix) const Standard_OVERRIDE;
0083 
0084  private:
0085   // ---------- PRIVATE FIELDS ----------
0086 
0087 
0088 
0089 
0090  public:
0091 // Declaration of CASCADE RTTI
0092 DEFINE_STANDARD_RTTI_INLINE(VrmlData_Color,VrmlData_ArrayVec3d)
0093 };
0094 
0095 // Definition of HANDLE object using Standard_DefineHandle.hxx
0096 DEFINE_STANDARD_HANDLE (VrmlData_Color, VrmlData_ArrayVec3d)
0097 
0098 
0099 #endif