Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/VrmlData_Color.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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() = default;
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 = nullptr)
0043       : VrmlData_ArrayVec3d(theScene, theName, nColors, arrColors)
0044   {
0045   }
0046 
0047   /**
0048    * Query one color
0049    * @param i
0050    *   index in the array of colors [0 .. N-1]
0051    * @return
0052    *   the color value for the index. If index irrelevant, returns (0., 0., 0.)
0053    */
0054   inline const Quantity_Color Color(const int i) const
0055   {
0056     return Quantity_Color(Value(i).X(), Value(i).Y(), Value(i).Z(), Quantity_TOC_sRGB);
0057   }
0058 
0059   /**
0060    * Set the array data
0061    */
0062   inline void SetColors(const size_t nColors, const gp_XYZ* arrColors)
0063   {
0064     myLength = nColors;
0065     myArray  = arrColors;
0066   }
0067 
0068   /**
0069    * Create a copy of this node.
0070    * If the parameter is null, a new copied node is created. Otherwise new node
0071    * is not created, but rather the given one is modified.<p>
0072    */
0073   Standard_EXPORT occ::handle<VrmlData_Node> Clone(
0074     const occ::handle<VrmlData_Node>& theOther) const override;
0075 
0076   /**
0077    * Read the Node from input stream.
0078    */
0079   Standard_EXPORT VrmlData_ErrorStatus Read(VrmlData_InBuffer& theBuffer) override;
0080 
0081   /**
0082    * Write the Node to the Scene output.
0083    */
0084   Standard_EXPORT VrmlData_ErrorStatus Write(const char* thePrefix) const override;
0085 
0086 public:
0087   // Declaration of CASCADE RTTI
0088   DEFINE_STANDARD_RTTI_INLINE(VrmlData_Color, VrmlData_ArrayVec3d)
0089 };
0090 
0091 // Definition of HANDLE object using Standard_DefineHandle.hxx
0092 #endif