// File generated by CPPExt (Value)
//
//                     Copyright (C) 1991 - 2000 by  
//                      Matra Datavision SA.  All rights reserved.
//  
//                     Copyright (C) 2001 - 2004 by
//                     Open CASCADE SA.  All rights reserved.
// 
// This file is part of the Open CASCADE Technology software.
//
// This software may be distributed and/or modified under the terms and
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
// and appearing in the file LICENSE included in the packaging of this file.
//  
// This software is distributed on an "AS IS" basis, without warranty of any
// kind, and Open CASCADE SA hereby disclaims all such warranties,
// including without limitation, any warranties of merchantability, fitness
// for a particular purpose or non-infringement. Please see the License for
// the specific terms and conditions governing rights and limitations under the
// License.

#ifndef _STEPConstruct_Styles_HeaderFile
#define _STEPConstruct_Styles_HeaderFile

#ifndef _TColStd_IndexedDataMapOfTransientTransient_HeaderFile
#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
#endif
#ifndef _TColStd_SequenceOfTransient_HeaderFile
#include <TColStd_SequenceOfTransient.hxx>
#endif
#ifndef _STEPConstruct_Tool_HeaderFile
#include <STEPConstruct_Tool.hxx>
#endif
#ifndef _Handle_XSControl_WorkSession_HeaderFile
#include <Handle_XSControl_WorkSession.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _Handle_StepVisual_StyledItem_HeaderFile
#include <Handle_StepVisual_StyledItem.hxx>
#endif
#ifndef _Handle_StepRepr_RepresentationItem_HeaderFile
#include <Handle_StepRepr_RepresentationItem.hxx>
#endif
#ifndef _Handle_StepVisual_PresentationStyleAssignment_HeaderFile
#include <Handle_StepVisual_PresentationStyleAssignment.hxx>
#endif
#ifndef _Handle_StepRepr_RepresentationContext_HeaderFile
#include <Handle_StepRepr_RepresentationContext.hxx>
#endif
#ifndef _Handle_StepVisual_MechanicalDesignGeometricPresentationRepresentation_HeaderFile
#include <Handle_StepVisual_MechanicalDesignGeometricPresentationRepresentation.hxx>
#endif
#ifndef _Handle_StepShape_ContextDependentShapeRepresentation_HeaderFile
#include <Handle_StepShape_ContextDependentShapeRepresentation.hxx>
#endif
#ifndef _Handle_StepRepr_ProductDefinitionShape_HeaderFile
#include <Handle_StepRepr_ProductDefinitionShape.hxx>
#endif
#ifndef _Handle_TColStd_HSequenceOfTransient_HeaderFile
#include <Handle_TColStd_HSequenceOfTransient.hxx>
#endif
#ifndef _Handle_StepVisual_Colour_HeaderFile
#include <Handle_StepVisual_Colour.hxx>
#endif
class XSControl_WorkSession;
class StepVisual_StyledItem;
class StepRepr_RepresentationItem;
class StepVisual_PresentationStyleAssignment;
class TopoDS_Shape;
class StepRepr_RepresentationContext;
class StepVisual_MechanicalDesignGeometricPresentationRepresentation;
class StepShape_ContextDependentShapeRepresentation;
class StepRepr_ProductDefinitionShape;
class TColStd_HSequenceOfTransient;
class StepVisual_Colour;
class Quantity_Color;
class STEPConstruct_DataMapOfAsciiStringTransient;
class STEPConstruct_DataMapOfPointTransient;


#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif

//! Provides a mechanism for reading and writing shape styles <br>
//!          (such as color) to and from the STEP file <br>
//!          This tool maintains a list of styles, either taking them <br>
//!          from STEP model (reading), or filling it by calls to <br>
//!          AddStyle or directly (writing). <br>
//!          Some methods deal with general structures of styles and <br>
//!          presentations in STEP, but there are methods which deal <br>
//!          with particular implementation of colors (as described in RP) <br>
class STEPConstruct_Styles  : public STEPConstruct_Tool {

public:

    void* operator new(size_t,void* anAddress) 
      {
        return anAddress;
      }
    void* operator new(size_t size) 
      { 
        return Standard::Allocate(size); 
      }
    void  operator delete(void *anAddress) 
      { 
        if (anAddress) Standard::Free((Standard_Address&)anAddress); 
      }
 // Methods PUBLIC
 // 

//! Creates an empty tool <br>
Standard_EXPORT STEPConstruct_Styles();

//! Creates a tool and initializes it <br>
Standard_EXPORT STEPConstruct_Styles(const Handle(XSControl_WorkSession)& WS);

//! Initializes tool; returns True if succeeded <br>
Standard_EXPORT   Standard_Boolean Init(const Handle(XSControl_WorkSession)& WS) ;

//! Returns number of defined styles <br>
Standard_EXPORT   Standard_Integer NbStyles() const;

//! Returns style with given index <br>
Standard_EXPORT   Handle_StepVisual_StyledItem Style(const Standard_Integer i) const;

//! Clears all defined styles and PSA sequence <br>
Standard_EXPORT   void ClearStyles() ;

//! Adds a style to a sequence <br>
Standard_EXPORT   void AddStyle(const Handle(StepVisual_StyledItem)& style) ;

//! Create a style linking giving PSA to the item, and add it to the <br>
//!          sequence of stored styles. If Override is not Null, then <br>
//!          the resulting style will be of the subtype OverridingStyledItem. <br>
Standard_EXPORT   Handle_StepVisual_StyledItem AddStyle(const Handle(StepRepr_RepresentationItem)& item,const Handle(StepVisual_PresentationStyleAssignment)& PSA,const Handle(StepVisual_StyledItem)& Override) ;

//! Create a style linking giving PSA to the Shape, and add it to the <br>
//!          sequence of stored styles. If Override is not Null, then <br>
//!          the resulting style will be of the subtype OverridingStyledItem. <br>
//!          The Sape is used to find corresponding STEP entity by call to <br>
//!          STEPConstruct::FindEntity(), then previous method is called. <br>
Standard_EXPORT   Handle_StepVisual_StyledItem AddStyle(const TopoDS_Shape& Shape,const Handle(StepVisual_PresentationStyleAssignment)& PSA,const Handle(StepVisual_StyledItem)& Override) ;

//! Create MDGPR, fill it with all the styles previously defined, <br>
//!          and add it to the model <br>
Standard_EXPORT   Standard_Boolean CreateMDGPR(const Handle(StepRepr_RepresentationContext)& Context,Handle(StepVisual_MechanicalDesignGeometricPresentationRepresentation)& MDGPR) ;

//! Create MDGPR, fill it with all the styles previously defined, <br>
//!          and add it to the model <br>
//!          IMPORTANT: <initPDS> must be null when use for NAUO colors <br>
//!          <initPDS> initialised only for SHUO case. <br>
Standard_EXPORT   Standard_Boolean CreateNAUOSRD(const Handle(StepRepr_RepresentationContext)& Context,const Handle(StepShape_ContextDependentShapeRepresentation)& CDSR,const Handle(StepRepr_ProductDefinitionShape)& initPDS) ;

//! Searches the STEP model for the RepresentationContext in which <br>
//!          given shape is defined. This context (if found) can be used <br>
//!          then in call to CreateMDGPR() <br>
Standard_EXPORT   Handle_StepRepr_RepresentationContext FindContext(const TopoDS_Shape& Shape) const;

//! Searches the STEP model for the MDGPR or DM entities <br>
//!          (which bring styles) and fills sequence of styles <br>
Standard_EXPORT   Standard_Boolean LoadStyles() ;

//! Searches the STEP model for the INISIBILITY enteties <br>
//!          (which bring styles) and fills out sequence of styles <br>
Standard_EXPORT   Standard_Boolean LoadInvisStyles(Handle(TColStd_HSequenceOfTransient)& InvSyles) const;

//! Create a PresentationStyleAssignment entity which defines <br>
//!          two colors (for filling surfaces and curves) <br>
//!          if isForNAUO true then returns PresentationStyleByContext <br>
Standard_EXPORT   Handle_StepVisual_PresentationStyleAssignment MakeColorPSA(const Handle(StepRepr_RepresentationItem)& item,const Handle(StepVisual_Colour)& SurfCol,const Handle(StepVisual_Colour)& CurveCol,const Standard_Boolean isForNAUO = Standard_False) const;

//! Returns a PresentationStyleAssignment entity which defines <br>
//!          surface and curve colors as Col. This PSA is either created <br>
//!          or taken from internal map where all PSAs created by this <br>
//!          method are remembered. <br>
Standard_EXPORT   Handle_StepVisual_PresentationStyleAssignment GetColorPSA(const Handle(StepRepr_RepresentationItem)& item,const Handle(StepVisual_Colour)& Col) ;

//! Extract color definitions from the style entity <br>
//!          For each type of color supported, result can be either <br>
//!          NULL if it is not defined by that style, or last <br>
//!          definition (if they are 1 or more) <br>
Standard_EXPORT   Standard_Boolean GetColors(const Handle(StepVisual_StyledItem)& style,Handle(StepVisual_Colour)& SurfCol,Handle(StepVisual_Colour)& BoundCol,Handle(StepVisual_Colour)& CurveCol,Standard_Boolean& IsComponent) const;

//! Create STEP color entity by given Quantity_Color <br>
//!          The analysis is performed for whether the color corresponds to <br>
//!          one of standard colors predefined in STEP. In that case, <br>
//!          PredefinedColour entity is created instead of RGBColour <br>
Standard_EXPORT static  Handle_StepVisual_Colour EncodeColor(const Quantity_Color& Col) ;

//! Create STEP color entity by given Quantity_Color <br>
//!          The analysis is performed for whether the color corresponds to <br>
//!          one of standard colors predefined in STEP. In that case, <br>
//!          PredefinedColour entity is created instead of RGBColour <br>
Standard_EXPORT static  Handle_StepVisual_Colour EncodeColor(const Quantity_Color& Col,STEPConstruct_DataMapOfAsciiStringTransient& DPDCs,STEPConstruct_DataMapOfPointTransient& ColRGBs) ;

//! Decodes STEP color and fills the Quantity_Color. <br>
//!          Returns True if OK or False if color is not recognized <br>
Standard_EXPORT static  Standard_Boolean DecodeColor(const Handle(StepVisual_Colour)& Colour,Quantity_Color& Col) ;





protected:

 // Methods PROTECTED
 // 


 // Fields PROTECTED
 //


private: 

 // Methods PRIVATE
 // 


 // Fields PRIVATE
 //
TColStd_IndexedDataMapOfTransientTransient myMapOfStyles;
TColStd_SequenceOfTransient myStyles;
TColStd_SequenceOfTransient myPSA;


};





// other Inline functions and methods (like "C++: function call" methods)
//


#endif
