diff --git a/src/RWStepAP214/RWStepAP214_GeneralModule.cxx b/src/RWStepAP214/RWStepAP214_GeneralModule.cxx index 05081cb5ad..70db37a12a 100644 --- a/src/RWStepAP214/RWStepAP214_GeneralModule.cxx +++ b/src/RWStepAP214/RWStepAP214_GeneralModule.cxx @@ -532,8 +532,12 @@ #include #include #include +#include +#include +#include #include #include +#include #include #include #include @@ -1084,8 +1088,12 @@ #include #include #include +#include +#include +#include #include #include +#include #include #include #include @@ -5156,6 +5164,34 @@ void RWStepAP214_GeneralModule::FillSharedCase(const Standard_Integer CN, RWStepVisual_RWAnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem tool; tool.Share(anent, iter); } + break; + case 720: + { + DeclareAndCast(StepVisual_SurfaceStyleTransparent, anent, ent); + RWStepVisual_RWSurfaceStyleTransparent tool; + tool.Share(anent, iter); + } + break; + case 721: + { + DeclareAndCast(StepVisual_SurfaceStyleReflectanceAmbient, anent, ent); + RWStepVisual_RWSurfaceStyleReflectanceAmbient tool; + tool.Share(anent, iter); + } + break; + case 722: + { + DeclareAndCast(StepVisual_SurfaceStyleRendering, anent, ent); + RWStepVisual_RWSurfaceStyleRendering tool; + tool.Share(anent, iter); + } + break; + case 723: + { + DeclareAndCast(StepVisual_SurfaceStyleRenderingWithProperties, anent, ent); + RWStepVisual_RWSurfaceStyleRenderingWithProperties tool; + tool.Share(anent, iter); + } break; default : break; } @@ -7169,8 +7205,18 @@ Standard_Boolean RWStepAP214_GeneralModule::NewVoid case 719: ent = new StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem; break; - - + case 720: + ent = new StepVisual_SurfaceStyleTransparent; + break; + case 721: + ent = new StepVisual_SurfaceStyleReflectanceAmbient; + break; + case 722: + ent = new StepVisual_SurfaceStyleRendering; + break; + case 723: + ent = new StepVisual_SurfaceStyleRenderingWithProperties; + break; default: return Standard_False; } @@ -7769,7 +7815,11 @@ Standard_Integer RWStepAP214_GeneralModule::CategoryNumber case 717: case 718: return cataux; case 719: return catdr; - + case 720: + case 721: + case 722: + case 723: return catdr; + default : break; } return 0; diff --git a/src/RWStepAP214/RWStepAP214_ReadWriteModule.cxx b/src/RWStepAP214/RWStepAP214_ReadWriteModule.cxx index 3f1af6de27..5e4749acea 100644 --- a/src/RWStepAP214/RWStepAP214_ReadWriteModule.cxx +++ b/src/RWStepAP214/RWStepAP214_ReadWriteModule.cxx @@ -433,6 +433,10 @@ IMPLEMENT_STANDARD_RTTIEXT(RWStepAP214_ReadWriteModule,StepData_ReadWriteModule) #include +#include +#include +#include +#include #include #include @@ -1405,6 +1409,10 @@ IMPLEMENT_STANDARD_RTTIEXT(RWStepAP214_ReadWriteModule,StepData_ReadWriteModule) #include #include +#include +#include +#include +#include // -- General Declarations (Recognize, StepType) --- @@ -2046,6 +2054,12 @@ static TCollection_AsciiString Reco_CharacterizedRepresentation("CHARACTERIZED_R static TCollection_AsciiString Reco_CameraModelD3MultiClipping("CAMERA_MODEL_D3_MULTI_CLIPPING"); static TCollection_AsciiString Reco_CameraModelD3MultiClippingIntersection("CAMERA_MODEL_D3_MULTI_CLIPPING_INTERSECTION"); static TCollection_AsciiString Reco_CameraModelD3MultiClippingUnion("CAMERA_MODEL_D3_MULTI_CLIPPING_UNION"); + +static TCollection_AsciiString Reco_SurfaceStyleTransparent("SURFACE_STYLE_TRANSPARENT"); +static TCollection_AsciiString Reco_SurfaceStyleReflectanceAmbient("SURFACE_STYLE_REFLECTANCE_AMBIENT"); +static TCollection_AsciiString Reco_SurfaceStyleRendering("SURFACE_STYLE_RENDERING"); +static TCollection_AsciiString Reco_SurfaceStyleRenderingWithProperties("SURFACE_STYLE_RENDERING_WITH_PROPERTIES"); + // -- Definition of the libraries -- static NCollection_DataMap typenums; @@ -2703,7 +2717,11 @@ RWStepAP214_ReadWriteModule::RWStepAP214_ReadWriteModule () typenums.Bind ( Reco_CameraModelD3MultiClippingIntersection, 717); typenums.Bind ( Reco_CameraModelD3MultiClippingUnion, 718); - + typenums.Bind (Reco_SurfaceStyleTransparent, 720); + typenums.Bind (Reco_SurfaceStyleReflectanceAmbient, 721); + typenums.Bind (Reco_SurfaceStyleRendering, 722); + typenums.Bind (Reco_SurfaceStyleRenderingWithProperties, 723); + // SHORT NAMES // NB : la liste est celle de AP203 // Directement exploite pour les types simples @@ -4558,6 +4576,11 @@ const TCollection_AsciiString& RWStepAP214_ReadWriteModule::StepType case 717 : return Reco_CameraModelD3MultiClippingIntersection; case 718 : return Reco_CameraModelD3MultiClippingUnion; + case 720 : return Reco_SurfaceStyleTransparent; + case 721 : return Reco_SurfaceStyleReflectanceAmbient; + case 722 : return Reco_SurfaceStyleRendering; + case 723 : return Reco_SurfaceStyleRenderingWithProperties; + default : return PasReco; } } @@ -9457,7 +9480,34 @@ void RWStepAP214_ReadWriteModule::ReadStep(const Standard_Integer CN, tool.ReadStep(data, num, ach, anent); } break; - + case 720: + { + DeclareAndCast(StepVisual_SurfaceStyleTransparent, anent, ent); + RWStepVisual_RWSurfaceStyleTransparent tool; + tool.ReadStep(data, num, ach, anent); + } + break; + case 721: + { + DeclareAndCast(StepVisual_SurfaceStyleReflectanceAmbient, anent, ent); + RWStepVisual_RWSurfaceStyleReflectanceAmbient tool; + tool.ReadStep(data, num, ach, anent); + } + break; + case 722: + { + DeclareAndCast(StepVisual_SurfaceStyleRendering, anent, ent); + RWStepVisual_RWSurfaceStyleRendering tool; + tool.ReadStep(data, num, ach, anent); + } + break; + case 723: + { + DeclareAndCast(StepVisual_SurfaceStyleRenderingWithProperties, anent, ent); + RWStepVisual_RWSurfaceStyleRenderingWithProperties tool; + tool.ReadStep(data, num, ach, anent); + } + break; default: ach->AddFail("Type Mismatch when reading - Entity"); @@ -14314,7 +14364,34 @@ void RWStepAP214_ReadWriteModule::WriteStep(const Standard_Integer CN, tool.WriteStep(SW, anent); } break; - + case 720: + { + DeclareAndCast(StepVisual_SurfaceStyleTransparent, anent, ent); + RWStepVisual_RWSurfaceStyleTransparent tool; + tool.WriteStep(SW, anent); + } + break; + case 721: + { + DeclareAndCast(StepVisual_SurfaceStyleReflectanceAmbient, anent, ent); + RWStepVisual_RWSurfaceStyleReflectanceAmbient tool; + tool.WriteStep(SW, anent); + } + break; + case 722: + { + DeclareAndCast(StepVisual_SurfaceStyleRendering, anent, ent); + RWStepVisual_RWSurfaceStyleRendering tool; + tool.WriteStep(SW, anent); + } + break; + case 723: + { + DeclareAndCast(StepVisual_SurfaceStyleRenderingWithProperties, anent, ent); + RWStepVisual_RWSurfaceStyleRenderingWithProperties tool; + tool.WriteStep(SW, anent); + } + break; default: return; } diff --git a/src/RWStepVisual/FILES b/src/RWStepVisual/FILES index 623a4da6a8..33aa198544 100644 --- a/src/RWStepVisual/FILES +++ b/src/RWStepVisual/FILES @@ -118,10 +118,18 @@ RWStepVisual_RWSurfaceStyleFillArea.cxx RWStepVisual_RWSurfaceStyleFillArea.hxx RWStepVisual_RWSurfaceStyleParameterLine.cxx RWStepVisual_RWSurfaceStyleParameterLine.hxx +RWStepVisual_RWSurfaceStyleReflectanceAmbient.cxx +RWStepVisual_RWSurfaceStyleReflectanceAmbient.hxx +RWStepVisual_RWSurfaceStyleRendering.cxx +RWStepVisual_RWSurfaceStyleRendering.hxx +RWStepVisual_RWSurfaceStyleRenderingWithProperties.cxx +RWStepVisual_RWSurfaceStyleRenderingWithProperties.hxx RWStepVisual_RWSurfaceStyleSegmentationCurve.cxx RWStepVisual_RWSurfaceStyleSegmentationCurve.hxx RWStepVisual_RWSurfaceStyleSilhouette.cxx RWStepVisual_RWSurfaceStyleSilhouette.hxx +RWStepVisual_RWSurfaceStyleTransparent.cxx +RWStepVisual_RWSurfaceStyleTransparent.hxx RWStepVisual_RWSurfaceStyleUsage.cxx RWStepVisual_RWSurfaceStyleUsage.hxx RWStepVisual_RWTemplate.cxx diff --git a/src/RWStepVisual/RWStepVisual_RWSurfaceStyleReflectanceAmbient.cxx b/src/RWStepVisual/RWStepVisual_RWSurfaceStyleReflectanceAmbient.cxx new file mode 100644 index 0000000000..94f5b75358 --- /dev/null +++ b/src/RWStepVisual/RWStepVisual_RWSurfaceStyleReflectanceAmbient.cxx @@ -0,0 +1,78 @@ +// Created on : Thu May 14 15:13:19 2020 +// Created by: Igor KHOZHANOV +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0 +// Copyright (c) Open CASCADE 2020 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : RWStepVisual_RWSurfaceStyleReflectanceAmbient +//purpose : +//======================================================================= + +RWStepVisual_RWSurfaceStyleReflectanceAmbient::RWStepVisual_RWSurfaceStyleReflectanceAmbient() {} + + +//======================================================================= +//function : ReadStep +//purpose : +//======================================================================= + +void RWStepVisual_RWSurfaceStyleReflectanceAmbient::ReadStep (const Handle(StepData_StepReaderData)& data, + const Standard_Integer num, + Handle(Interface_Check)& ach, + const Handle(StepVisual_SurfaceStyleReflectanceAmbient)& ent) const +{ + // Check number of parameters + if ( ! data->CheckNbParams(num,1,ach,"surface_style_reflectance_ambient") ) return; + + // Own fields of SurfaceStyleReflectanceAmbient + + Standard_Real aAmbientReflectance; + data->ReadReal (num, 1, "ambient_reflectance", ach, aAmbientReflectance); + + // Initialize entity + ent->Init(aAmbientReflectance); +} + +//======================================================================= +//function : WriteStep +//purpose : +//======================================================================= + +void RWStepVisual_RWSurfaceStyleReflectanceAmbient::WriteStep (StepData_StepWriter& SW, + const Handle(StepVisual_SurfaceStyleReflectanceAmbient)& ent) const +{ + + // Own fields of SurfaceStyleReflectanceAmbient + + SW.Send (ent->AmbientReflectance()); +} + +//======================================================================= +//function : Share +//purpose : +//======================================================================= + +void RWStepVisual_RWSurfaceStyleReflectanceAmbient::Share (const Handle(StepVisual_SurfaceStyleReflectanceAmbient)& , + Interface_EntityIterator& ) const +{ + + // Own fields of SurfaceStyleReflectanceAmbient +} diff --git a/src/RWStepVisual/RWStepVisual_RWSurfaceStyleReflectanceAmbient.hxx b/src/RWStepVisual/RWStepVisual_RWSurfaceStyleReflectanceAmbient.hxx new file mode 100644 index 0000000000..9097568d73 --- /dev/null +++ b/src/RWStepVisual/RWStepVisual_RWSurfaceStyleReflectanceAmbient.hxx @@ -0,0 +1,46 @@ +// Created on : Thu May 14 15:13:19 2020 +// Created by: Igor KHOZHANOV +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0 +// Copyright (c) Open CASCADE 2020 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _RWStepVisual_RWSurfaceStyleReflectanceAmbient_HeaderFile_ +#define _RWStepVisual_RWSurfaceStyleReflectanceAmbient_HeaderFile_ + +#include +#include +#include + +class StepData_StepReaderData; +class Interface_Check; +class StepData_StepWriter; +class Interface_EntityIterator; +class StepVisual_SurfaceStyleReflectanceAmbient; + +//! Read & Write tool for SurfaceStyleReflectanceAmbient +class RWStepVisual_RWSurfaceStyleReflectanceAmbient +{ +public: + + DEFINE_STANDARD_ALLOC + + Standard_EXPORT RWStepVisual_RWSurfaceStyleReflectanceAmbient(); + + Standard_EXPORT void ReadStep(const Handle(StepData_StepReaderData)& data, const Standard_Integer num, Handle(Interface_Check)& ach, const Handle(StepVisual_SurfaceStyleReflectanceAmbient)& ent) const; + + Standard_EXPORT void WriteStep(StepData_StepWriter& SW, const Handle(StepVisual_SurfaceStyleReflectanceAmbient)& ent) const; + + Standard_EXPORT void Share(const Handle(StepVisual_SurfaceStyleReflectanceAmbient)& ent, Interface_EntityIterator& iter) const; + +}; +#endif // _RWStepVisual_RWSurfaceStyleReflectanceAmbient_HeaderFile_ diff --git a/src/RWStepVisual/RWStepVisual_RWSurfaceStyleRendering.cxx b/src/RWStepVisual/RWStepVisual_RWSurfaceStyleRendering.cxx new file mode 100644 index 0000000000..c9c726b47c --- /dev/null +++ b/src/RWStepVisual/RWStepVisual_RWSurfaceStyleRendering.cxx @@ -0,0 +1,100 @@ +// Created on : Thu May 14 15:13:19 2020 +// Created by: Igor KHOZHANOV +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0 +// Copyright (c) Open CASCADE 2020 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : RWStepVisual_RWSurfaceStyleRendering +//purpose : +//======================================================================= + +RWStepVisual_RWSurfaceStyleRendering::RWStepVisual_RWSurfaceStyleRendering() {} + + +//======================================================================= +//function : ReadStep +//purpose : +//======================================================================= + +void RWStepVisual_RWSurfaceStyleRendering::ReadStep (const Handle(StepData_StepReaderData)& data, + const Standard_Integer num, + Handle(Interface_Check)& ach, + const Handle(StepVisual_SurfaceStyleRendering)& ent) const +{ + // Check number of parameters + if ( ! data->CheckNbParams(num,2,ach,"surface_style_rendering") ) return; + + // Own fields of SurfaceStyleRendering + + StepVisual_ShadingSurfaceMethod aRenderingMethod = StepVisual_ssmNormalShading; + if (data->ParamType (num, 1) == Interface_ParamEnum) { + Standard_CString text = data->ParamCValue(num, 1); + if (strcmp(text, ".CONSTANT_SHADING.")) aRenderingMethod = StepVisual_ssmConstantShading; + else if (strcmp(text, ".COLOUR_SHADING.")) aRenderingMethod = StepVisual_ssmColourShading; + else if (strcmp(text, ".DOT_SHADING.")) aRenderingMethod = StepVisual_ssmDotShading; + else if (strcmp(text, ".NORMAL_SHADING.")) aRenderingMethod = StepVisual_ssmNormalShading; + else ach->AddFail("Parameter #1 (rendering_method) has not allowed value"); + } + else ach->AddFail("Parameter #1 (rendering_method) is not enumeration"); + + Handle(StepVisual_Colour) aSurfaceColour; + data->ReadEntity (num, 2, "surface_colour", ach, STANDARD_TYPE(StepVisual_Colour), aSurfaceColour); + + // Initialize entity + ent->Init(aRenderingMethod, + aSurfaceColour); +} + +//======================================================================= +//function : WriteStep +//purpose : +//======================================================================= + +void RWStepVisual_RWSurfaceStyleRendering::WriteStep (StepData_StepWriter& SW, + const Handle(StepVisual_SurfaceStyleRendering)& ent) const +{ + + // Own fields of SurfaceStyleRendering + + switch (ent->RenderingMethod()) { + case StepVisual_ssmConstantShading: SW.SendEnum (".CONSTANT_SHADING."); break; + case StepVisual_ssmColourShading: SW.SendEnum (".COLOUR_SHADING."); break; + case StepVisual_ssmDotShading: SW.SendEnum (".DOT_SHADING."); break; + case StepVisual_ssmNormalShading: SW.SendEnum (".NORMAL_SHADING."); break; + } + + SW.Send (ent->SurfaceColour()); +} + +//======================================================================= +//function : Share +//purpose : +//======================================================================= + +void RWStepVisual_RWSurfaceStyleRendering::Share (const Handle(StepVisual_SurfaceStyleRendering)& ent, + Interface_EntityIterator& iter) const +{ + + // Own fields of SurfaceStyleRendering + + iter.AddItem (ent->SurfaceColour()); +} diff --git a/src/RWStepVisual/RWStepVisual_RWSurfaceStyleRendering.hxx b/src/RWStepVisual/RWStepVisual_RWSurfaceStyleRendering.hxx new file mode 100644 index 0000000000..9082b44e00 --- /dev/null +++ b/src/RWStepVisual/RWStepVisual_RWSurfaceStyleRendering.hxx @@ -0,0 +1,46 @@ +// Created on : Thu May 14 15:13:19 2020 +// Created by: Igor KHOZHANOV +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0 +// Copyright (c) Open CASCADE 2020 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _RWStepVisual_RWSurfaceStyleRendering_HeaderFile_ +#define _RWStepVisual_RWSurfaceStyleRendering_HeaderFile_ + +#include +#include +#include + +class StepData_StepReaderData; +class Interface_Check; +class StepData_StepWriter; +class Interface_EntityIterator; +class StepVisual_SurfaceStyleRendering; + +//! Read & Write tool for SurfaceStyleRendering +class RWStepVisual_RWSurfaceStyleRendering +{ +public: + + DEFINE_STANDARD_ALLOC + + Standard_EXPORT RWStepVisual_RWSurfaceStyleRendering(); + + Standard_EXPORT void ReadStep(const Handle(StepData_StepReaderData)& data, const Standard_Integer num, Handle(Interface_Check)& ach, const Handle(StepVisual_SurfaceStyleRendering)& ent) const; + + Standard_EXPORT void WriteStep(StepData_StepWriter& SW, const Handle(StepVisual_SurfaceStyleRendering)& ent) const; + + Standard_EXPORT void Share(const Handle(StepVisual_SurfaceStyleRendering)& ent, Interface_EntityIterator& iter) const; + +}; +#endif // _RWStepVisual_RWSurfaceStyleRendering_HeaderFile_ diff --git a/src/RWStepVisual/RWStepVisual_RWSurfaceStyleRenderingWithProperties.cxx b/src/RWStepVisual/RWStepVisual_RWSurfaceStyleRenderingWithProperties.cxx new file mode 100644 index 0000000000..99623958e4 --- /dev/null +++ b/src/RWStepVisual/RWStepVisual_RWSurfaceStyleRenderingWithProperties.cxx @@ -0,0 +1,134 @@ +// Created on : Thu May 14 15:13:19 2020 +// Created by: Igor KHOZHANOV +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0 +// Copyright (c) Open CASCADE 2020 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : RWStepVisual_RWSurfaceStyleRenderingWithProperties +//purpose : +//======================================================================= + +RWStepVisual_RWSurfaceStyleRenderingWithProperties::RWStepVisual_RWSurfaceStyleRenderingWithProperties() {} + + +//======================================================================= +//function : ReadStep +//purpose : +//======================================================================= + +void RWStepVisual_RWSurfaceStyleRenderingWithProperties::ReadStep (const Handle(StepData_StepReaderData)& data, + const Standard_Integer num, + Handle(Interface_Check)& ach, + const Handle(StepVisual_SurfaceStyleRenderingWithProperties)& ent) const +{ + // Check number of parameters + if ( ! data->CheckNbParams(num,3,ach,"surface_style_rendering_with_properties") ) return; + + // Inherited fields of SurfaceStyleRendering + + StepVisual_ShadingSurfaceMethod aSurfaceStyleRendering_RenderingMethod = StepVisual_ssmNormalShading; + if (data->ParamType (num, 1) == Interface_ParamEnum) { + Standard_CString text = data->ParamCValue(num, 1); + if (strcmp(text, ".CONSTANT_SHADING.")) aSurfaceStyleRendering_RenderingMethod = StepVisual_ssmConstantShading; + else if (strcmp(text, ".COLOUR_SHADING.")) aSurfaceStyleRendering_RenderingMethod = StepVisual_ssmColourShading; + else if (strcmp(text, ".DOT_SHADING.")) aSurfaceStyleRendering_RenderingMethod = StepVisual_ssmDotShading; + else if (strcmp(text, ".NORMAL_SHADING.")) aSurfaceStyleRendering_RenderingMethod = StepVisual_ssmNormalShading; + else ach->AddFail("Parameter #1 (surface_style_rendering.rendering_method) has not allowed value"); + } + else ach->AddFail("Parameter #1 (surface_style_rendering.rendering_method) is not enumeration"); + + Handle(StepVisual_Colour) aSurfaceStyleRendering_SurfaceColour; + data->ReadEntity (num, 2, "surface_style_rendering.surface_colour", ach, STANDARD_TYPE(StepVisual_Colour), aSurfaceStyleRendering_SurfaceColour); + + // Own fields of SurfaceStyleRenderingWithProperties + + Handle(StepVisual_HArray1OfRenderingPropertiesSelect) aProperties; + Standard_Integer sub3 = 0; + if ( data->ReadSubList (num, 3, "properties", ach, sub3) ) { + Standard_Integer nb0 = data->NbParams(sub3); + aProperties = new StepVisual_HArray1OfRenderingPropertiesSelect (1, nb0); + Standard_Integer num2 = sub3; + for ( Standard_Integer i0=1; i0 <= nb0; i0++ ) { + StepVisual_RenderingPropertiesSelect anIt0; + data->ReadEntity (num2, i0, "rendering_properties_select", ach, anIt0); + aProperties->SetValue(i0, anIt0); + } + } + + // Initialize entity + ent->Init(aSurfaceStyleRendering_RenderingMethod, + aSurfaceStyleRendering_SurfaceColour, + aProperties); +} + +//======================================================================= +//function : WriteStep +//purpose : +//======================================================================= + +void RWStepVisual_RWSurfaceStyleRenderingWithProperties::WriteStep (StepData_StepWriter& SW, + const Handle(StepVisual_SurfaceStyleRenderingWithProperties)& ent) const +{ + + // Own fields of SurfaceStyleRendering + + switch (ent->RenderingMethod()) { + case StepVisual_ssmConstantShading: SW.SendEnum (".CONSTANT_SHADING."); break; + case StepVisual_ssmColourShading: SW.SendEnum (".COLOUR_SHADING."); break; + case StepVisual_ssmDotShading: SW.SendEnum (".DOT_SHADING."); break; + case StepVisual_ssmNormalShading: SW.SendEnum (".NORMAL_SHADING."); break; + } + + SW.Send (ent->SurfaceColour()); + + // Own fields of SurfaceStyleRenderingWithProperties + + SW.OpenSub(); + for (Standard_Integer i2=1; i2 <= ent->Properties()->Length(); i2++ ) { + StepVisual_RenderingPropertiesSelect Var0 = ent->Properties()->Value(i2); + SW.Send (Var0.Value()); + } + SW.CloseSub(); +} + +//======================================================================= +//function : Share +//purpose : +//======================================================================= + +void RWStepVisual_RWSurfaceStyleRenderingWithProperties::Share (const Handle(StepVisual_SurfaceStyleRenderingWithProperties)& ent, + Interface_EntityIterator& iter) const +{ + + // Inherited fields of SurfaceStyleRendering + + iter.AddItem (ent->StepVisual_SurfaceStyleRendering::SurfaceColour()); + + // Own fields of SurfaceStyleRenderingWithProperties + + for (Standard_Integer i2=1; i2 <= ent->Properties()->Length(); i2++ ) { + StepVisual_RenderingPropertiesSelect Var0 = ent->Properties()->Value(i2); + iter.AddItem (Var0.Value()); + } +} diff --git a/src/RWStepVisual/RWStepVisual_RWSurfaceStyleRenderingWithProperties.hxx b/src/RWStepVisual/RWStepVisual_RWSurfaceStyleRenderingWithProperties.hxx new file mode 100644 index 0000000000..5e1b0921db --- /dev/null +++ b/src/RWStepVisual/RWStepVisual_RWSurfaceStyleRenderingWithProperties.hxx @@ -0,0 +1,46 @@ +// Created on : Thu May 14 15:13:19 2020 +// Created by: Igor KHOZHANOV +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0 +// Copyright (c) Open CASCADE 2020 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _RWStepVisual_RWSurfaceStyleRenderingWithProperties_HeaderFile_ +#define _RWStepVisual_RWSurfaceStyleRenderingWithProperties_HeaderFile_ + +#include +#include +#include + +class StepData_StepReaderData; +class Interface_Check; +class StepData_StepWriter; +class Interface_EntityIterator; +class StepVisual_SurfaceStyleRenderingWithProperties; + +//! Read & Write tool for SurfaceStyleRenderingWithProperties +class RWStepVisual_RWSurfaceStyleRenderingWithProperties +{ +public: + + DEFINE_STANDARD_ALLOC + + Standard_EXPORT RWStepVisual_RWSurfaceStyleRenderingWithProperties(); + + Standard_EXPORT void ReadStep(const Handle(StepData_StepReaderData)& data, const Standard_Integer num, Handle(Interface_Check)& ach, const Handle(StepVisual_SurfaceStyleRenderingWithProperties)& ent) const; + + Standard_EXPORT void WriteStep(StepData_StepWriter& SW, const Handle(StepVisual_SurfaceStyleRenderingWithProperties)& ent) const; + + Standard_EXPORT void Share(const Handle(StepVisual_SurfaceStyleRenderingWithProperties)& ent, Interface_EntityIterator& iter) const; + +}; +#endif // _RWStepVisual_RWSurfaceStyleRenderingWithProperties_HeaderFile_ diff --git a/src/RWStepVisual/RWStepVisual_RWSurfaceStyleTransparent.cxx b/src/RWStepVisual/RWStepVisual_RWSurfaceStyleTransparent.cxx new file mode 100644 index 0000000000..49aaf8ade3 --- /dev/null +++ b/src/RWStepVisual/RWStepVisual_RWSurfaceStyleTransparent.cxx @@ -0,0 +1,79 @@ +// Created on : Tue May 12 14:11:46 2020 +// Created by: Igor KHOZHANOV +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0 +// Copyright (c) Open CASCADE 2020 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include +#include +#include +#include +#include +#include +#include + +//======================================================================= +//function : RWStepVisual_RWSurfaceStyleTransparent +//purpose : +//======================================================================= + +RWStepVisual_RWSurfaceStyleTransparent::RWStepVisual_RWSurfaceStyleTransparent() {} + + +//======================================================================= +//function : ReadStep +//purpose : +//======================================================================= +#include + +void RWStepVisual_RWSurfaceStyleTransparent::ReadStep (const Handle(StepData_StepReaderData)& data, + const Standard_Integer num, + Handle(Interface_Check)& ach, + const Handle(StepVisual_SurfaceStyleTransparent)& ent) const +{ + // Check number of parameters + if ( ! data->CheckNbParams(num,1,ach,"surface_style_transparent") ) return; + + // Own fields of SurfaceStyleTransparent + + Standard_Real aTransparency; + data->ReadReal (num, 1, "transparency", ach, aTransparency); + + // Initialize entity + ent->Init(aTransparency); +} + +//======================================================================= +//function : WriteStep +//purpose : +//======================================================================= + +void RWStepVisual_RWSurfaceStyleTransparent::WriteStep (StepData_StepWriter& SW, + const Handle(StepVisual_SurfaceStyleTransparent)& ent) const +{ + + // Own fields of SurfaceStyleTransparent + + SW.Send (ent->Transparency()); +} + +//======================================================================= +//function : Share +//purpose : +//======================================================================= + +void RWStepVisual_RWSurfaceStyleTransparent::Share (const Handle(StepVisual_SurfaceStyleTransparent)& , + Interface_EntityIterator& ) const +{ + +} diff --git a/src/RWStepVisual/RWStepVisual_RWSurfaceStyleTransparent.hxx b/src/RWStepVisual/RWStepVisual_RWSurfaceStyleTransparent.hxx new file mode 100644 index 0000000000..c5386fdef7 --- /dev/null +++ b/src/RWStepVisual/RWStepVisual_RWSurfaceStyleTransparent.hxx @@ -0,0 +1,48 @@ +// Created on : Tue May 12 14:11:46 2020 +// Created by: Igor KHOZHANOV +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0 +// Copyright (c) Open CASCADE 2020 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _RWStepVisual_RWSurfaceStyleTransparent_HeaderFile_ +#define _RWStepVisual_RWSurfaceStyleTransparent_HeaderFile_ + +#include +#include +#include +#include + +class StepData_StepReaderData; +class Interface_Check; +class StepData_StepWriter; +class Interface_EntityIterator; +class StepVisual_SurfaceStyleTransparent; +class Interface_EntityIterator; + +//! Read & Write tool for SurfaceStyleTransparent +class RWStepVisual_RWSurfaceStyleTransparent +{ +public: + + DEFINE_STANDARD_ALLOC + + Standard_EXPORT RWStepVisual_RWSurfaceStyleTransparent(); + + Standard_EXPORT void ReadStep(const Handle(StepData_StepReaderData)& data, const Standard_Integer num, Handle(Interface_Check)& ach, const Handle(StepVisual_SurfaceStyleTransparent)& ent) const; + + Standard_EXPORT void WriteStep(StepData_StepWriter& SW, const Handle(StepVisual_SurfaceStyleTransparent)& ent) const; + + Standard_EXPORT void Share(const Handle(StepVisual_SurfaceStyleTransparent)& ent, Interface_EntityIterator& iter) const; + +}; +#endif // _RWStepVisual_RWSurfaceStyleTransparent_HeaderFile_ diff --git a/src/STEPCAFControl/STEPCAFControl_Reader.cxx b/src/STEPCAFControl/STEPCAFControl_Reader.cxx index 2573a8dc31..487c991812 100644 --- a/src/STEPCAFControl/STEPCAFControl_Reader.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Reader.cxx @@ -968,10 +968,11 @@ Standard_Boolean STEPCAFControl_Reader::ReadColors(const Handle(XSControl_WorkSe break; } - Handle(StepVisual_Colour) SurfCol, BoundCol, CurveCol; + Handle(StepVisual_Colour) SurfCol, BoundCol, CurveCol, RenderCol; + Standard_Real RenderTransp; // check if it is component style Standard_Boolean IsComponent = Standard_False; - if (!Styles.GetColors(style, SurfCol, BoundCol, CurveCol, IsComponent) && IsVisible) + if (!Styles.GetColors(style, SurfCol, BoundCol, CurveCol, RenderCol, RenderTransp, IsComponent) && IsVisible) continue; // collect styled items @@ -1042,23 +1043,30 @@ Standard_Boolean STEPCAFControl_Reader::ReadColors(const Handle(XSControl_WorkSe if (S.IsNull()) continue; - if (!SurfCol.IsNull() || !BoundCol.IsNull() || !CurveCol.IsNull() || !IsVisible) + if (!SurfCol.IsNull() || !BoundCol.IsNull() || !CurveCol.IsNull() || !RenderCol.IsNull() || !IsVisible) { TDF_Label aL; Standard_Boolean isFound = STool->SearchUsingMap(S, aL, Standard_False, Standard_True); - if (!SurfCol.IsNull() || !BoundCol.IsNull() || !CurveCol.IsNull()) + if (!SurfCol.IsNull() || !BoundCol.IsNull() || !CurveCol.IsNull() || !RenderCol.IsNull()) { - Quantity_Color aSCol, aBCol, aCCol; - if (!SurfCol.IsNull()) + Quantity_Color aSCol, aBCol, aCCol, aRCol; + Quantity_ColorRGBA aFullSCol; + if (!SurfCol.IsNull()) { Styles.DecodeColor(SurfCol, aSCol); + aFullSCol = Quantity_ColorRGBA(aSCol); + } if (!BoundCol.IsNull()) Styles.DecodeColor(BoundCol, aBCol); if (!CurveCol.IsNull()) Styles.DecodeColor(CurveCol, aCCol); + if (!RenderCol.IsNull()) { + Styles.DecodeColor(RenderCol, aRCol); + aFullSCol = Quantity_ColorRGBA(aRCol, static_cast(1.0f - RenderTransp)); + } if (isFound) { - if (!SurfCol.IsNull()) - CTool->SetColor(aL, aSCol, XCAFDoc_ColorSurf); + if (!SurfCol.IsNull() || !RenderCol.IsNull()) + CTool->SetColor(aL, aFullSCol, XCAFDoc_ColorSurf); if (!BoundCol.IsNull()) CTool->SetColor(aL, aBCol, XCAFDoc_ColorCurv); if (!CurveCol.IsNull()) @@ -1071,8 +1079,8 @@ Standard_Boolean STEPCAFControl_Reader::ReadColors(const Handle(XSControl_WorkSe TDF_Label aL1; if (STool->SearchUsingMap(it.Value(), aL1, Standard_False, Standard_True)) { - if (!SurfCol.IsNull()) - CTool->SetColor(aL1, aSCol, XCAFDoc_ColorSurf); + if (!SurfCol.IsNull() || !RenderCol.IsNull()) + CTool->SetColor(aL1, aFullSCol, XCAFDoc_ColorSurf); if (!BoundCol.IsNull()) CTool->SetColor(aL1, aBCol, XCAFDoc_ColorCurv); if (!CurveCol.IsNull()) @@ -1622,10 +1630,11 @@ Standard_Boolean STEPCAFControl_Reader::ReadSHUOs(const Handle(XSControl_WorkSes break; } - Handle(StepVisual_Colour) SurfCol, BoundCol, CurveCol; + Handle(StepVisual_Colour) SurfCol, BoundCol, CurveCol, RenderCol; + Standard_Real RenderTransp; // check if it is component style Standard_Boolean IsComponent = Standard_False; - if (!Styles.GetColors(style, SurfCol, BoundCol, CurveCol, IsComponent) && IsVisible) + if (!Styles.GetColors(style, SurfCol, BoundCol, CurveCol, RenderCol, RenderTransp, IsComponent) && IsVisible) continue; if (!IsComponent) continue; @@ -1660,10 +1669,18 @@ Standard_Boolean STEPCAFControl_Reader::ReadSHUOs(const Handle(XSControl_WorkSes continue; } // now set the style to the SHUO main label. - if (!SurfCol.IsNull()) { + if (!SurfCol.IsNull() || !RenderCol.IsNull()) { Quantity_Color col; - Styles.DecodeColor(SurfCol, col); - CTool->SetColor(aLabelForStyle, col, XCAFDoc_ColorSurf); + Quantity_ColorRGBA colRGBA; + if (!SurfCol.IsNull()) { + Styles.DecodeColor(SurfCol, col); + colRGBA = Quantity_ColorRGBA(col); + } + if (!RenderCol.IsNull()) { + Styles.DecodeColor(RenderCol, col); + colRGBA = Quantity_ColorRGBA(col, static_cast(1.0 - RenderTransp)); + } + CTool->SetColor(aLabelForStyle, colRGBA, XCAFDoc_ColorSurf); } if (!BoundCol.IsNull()) { Quantity_Color col; diff --git a/src/STEPCAFControl/STEPCAFControl_Writer.cxx b/src/STEPCAFControl/STEPCAFControl_Writer.cxx index 9dba1aea02..74aeb3971a 100644 --- a/src/STEPCAFControl/STEPCAFControl_Writer.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Writer.cxx @@ -1062,13 +1062,17 @@ static void MakeSTEPStyles (STEPConstruct_Styles &Styles, XCAFPrs_Style own = settings.FindFromKey(S); if ( !own.IsVisible() ) style.SetVisibility ( Standard_False ); if ( own.IsSetColorCurv() ) style.SetColorCurv ( own.GetColorCurv() ); - if ( own.IsSetColorSurf() ) style.SetColorSurf ( own.GetColorSurf() ); + if ( own.IsSetColorSurf() ) style.SetColorSurf ( own.GetColorSurfRGBA() ); } // translate colors to STEP Handle(StepVisual_Colour) surfColor, curvColor; - if ( style.IsSetColorSurf() ) - surfColor = Styles.EncodeColor(style.GetColorSurf(),DPDCs,ColRGBs); + Standard_Real RenderTransp = 0.0; + if ( style.IsSetColorSurf() ) { + Quantity_ColorRGBA sCol = style.GetColorSurfRGBA(); + RenderTransp = 1.0 - sCol.Alpha(); + surfColor = Styles.EncodeColor(sCol.GetRGB(),DPDCs,ColRGBs); + } if ( style.IsSetColorCurv() ) curvColor = Styles.EncodeColor(style.GetColorCurv(),DPDCs,ColRGBs); @@ -1096,12 +1100,12 @@ static void MakeSTEPStyles (STEPConstruct_Styles &Styles, Handle(StepRepr_RepresentationItem)::DownCast(seqRI(i)); Handle(StepVisual_PresentationStyleAssignment) PSA; if ( style.IsVisible() || !surfColor.IsNull() || !curvColor.IsNull() ) { - PSA = Styles.MakeColorPSA ( item, surfColor, curvColor, isComponent ); + PSA = Styles.MakeColorPSA ( item, surfColor, curvColor, surfColor, RenderTransp, isComponent ); } else { // default white color surfColor = Styles.EncodeColor(Quantity_Color(Quantity_NOC_WHITE),DPDCs,ColRGBs); - PSA = Styles.MakeColorPSA ( item, surfColor, curvColor, isComponent ); + PSA = Styles.MakeColorPSA ( item, surfColor, curvColor, surfColor, 0.0, isComponent ); if ( isComponent ) setDefaultInstanceColor( override, PSA); @@ -1219,7 +1223,7 @@ Standard_Boolean STEPCAFControl_Writer::WriteColors (const Handle(XSControl_Work for ( Standard_Integer j = 1; j <= seq.Length(); j++ ) { TDF_Label lab = seq.Value(j); XCAFPrs_Style style; - Quantity_Color C; + Quantity_ColorRGBA C; if ( lab == L ) { // check for invisible status of object on label if ( !CTool->IsVisible( lab ) ) { @@ -1228,13 +1232,13 @@ Standard_Boolean STEPCAFControl_Writer::WriteColors (const Handle(XSControl_Work } } if ( CTool->GetColor ( lab, XCAFDoc_ColorGen, C ) ) { - style.SetColorCurv ( C ); + style.SetColorCurv ( C.GetRGB() ); style.SetColorSurf ( C ); } if ( CTool->GetColor ( lab, XCAFDoc_ColorSurf, C ) ) style.SetColorSurf ( C ); if ( CTool->GetColor ( lab, XCAFDoc_ColorCurv, C ) ) - style.SetColorCurv ( C ); + style.SetColorCurv ( C.GetRGB() ); if (!style.IsSetColorSurf()) { Handle(XCAFDoc_VisMaterial) aVisMat = aMatTool->GetShapeMaterial (lab); @@ -1872,8 +1876,12 @@ static Standard_Boolean createSHUOStyledItem (const XCAFPrs_Style& style, STEPConstruct_Styles Styles( WS ); // translate colors to STEP Handle(StepVisual_Colour) surfColor, curvColor; - if ( style.IsSetColorSurf() ) - surfColor = Styles.EncodeColor ( style.GetColorSurf() ); + Standard_Real RenderTransp = 0.0; + if ( style.IsSetColorSurf() ) { + Quantity_ColorRGBA sCol = style.GetColorSurfRGBA(); + RenderTransp = 1.0 - sCol.Alpha(); + surfColor = Styles.EncodeColor ( sCol.GetRGB() ); + } if ( style.IsSetColorCurv() ) curvColor = Styles.EncodeColor ( style.GetColorCurv() ); Standard_Boolean isComponent = Standard_True;// cause need to get PSBC @@ -1885,7 +1893,7 @@ static Standard_Boolean createSHUOStyledItem (const XCAFPrs_Style& style, isSetDefaultColor = Standard_True; } Handle(StepVisual_PresentationStyleAssignment) PSA = - Styles.MakeColorPSA ( item, surfColor, curvColor, isComponent ); + Styles.MakeColorPSA ( item, surfColor, curvColor, surfColor, RenderTransp, isComponent ); Handle(StepVisual_StyledItem) override; //null styled item // find the repr item of the shape @@ -3742,7 +3750,7 @@ Standard_Boolean STEPCAFControl_Writer::WriteDGTsAP242 (const Handle(XSControl_W STEPConstruct_Styles aStyles (WS); Handle(StepVisual_Colour) aCurvColor = aStyles.EncodeColor(Quantity_NOC_WHITE); Handle(StepRepr_RepresentationItem) anItem = NULL; - myGDTPrsCurveStyle->SetValue(1, aStyles.MakeColorPSA(anItem, aCurvColor, aCurvColor)); + myGDTPrsCurveStyle->SetValue(1, aStyles.MakeColorPSA(anItem, aCurvColor, aCurvColor, aCurvColor, 0.0)); Interface_EntityIterator aModelIter = aModel->Entities(); for (; aModelIter.More() && myGDTCommonPDS.IsNull(); aModelIter.Next()) myGDTCommonPDS = Handle(StepRepr_ProductDefinitionShape)::DownCast(aModelIter.Value()); diff --git a/src/STEPConstruct/STEPConstruct_Styles.cxx b/src/STEPConstruct/STEPConstruct_Styles.cxx index 8bb1b3c45a..9356606171 100644 --- a/src/STEPConstruct/STEPConstruct_Styles.cxx +++ b/src/STEPConstruct/STEPConstruct_Styles.cxx @@ -66,6 +66,10 @@ #include #include #include +#include +#include +#include +#include #include #include #include @@ -429,6 +433,8 @@ Standard_Boolean STEPConstruct_Styles::LoadInvisStyles (Handle(TColStd_HSequence Handle(StepVisual_PresentationStyleAssignment) STEPConstruct_Styles::MakeColorPSA (const Handle(StepRepr_RepresentationItem) &/*item*/, const Handle(StepVisual_Colour) &SurfCol, const Handle(StepVisual_Colour) &CurveCol, + const Handle(StepVisual_Colour) &RenderCol, + const Standard_Real RenderTransp, const Standard_Boolean isForNAUO) const { Handle(StepVisual_PresentationStyleAssignment) PSA; @@ -456,10 +462,29 @@ Handle(StepVisual_PresentationStyleAssignment) STEPConstruct_Styles::MakeColorPS StepVisual_SurfaceStyleElementSelect SES; SES.SetValue ( SSFA ); - Handle(StepVisual_HArray1OfSurfaceStyleElementSelect) SSESs = - new StepVisual_HArray1OfSurfaceStyleElementSelect ( 1, 1 ); + Handle(StepVisual_HArray1OfSurfaceStyleElementSelect) SSESs; + if (RenderTransp == 0.0) { + SSESs = new StepVisual_HArray1OfSurfaceStyleElementSelect ( 1, 1 ); + } else { + Handle(StepVisual_SurfaceStyleTransparent) SST = new StepVisual_SurfaceStyleTransparent; + SST->Init(RenderTransp); + StepVisual_RenderingPropertiesSelect RPS; + RPS.SetValue(SST); + Handle(StepVisual_HArray1OfRenderingPropertiesSelect) HARP = new + StepVisual_HArray1OfRenderingPropertiesSelect (1, 1); + HARP->SetValue(1, RPS); + Handle(StepVisual_SurfaceStyleRenderingWithProperties) SSRWP = new StepVisual_SurfaceStyleRenderingWithProperties; + + SSRWP->Init(StepVisual_ssmNormalShading, RenderCol, HARP); + + StepVisual_SurfaceStyleElementSelect SESR; + SESR.SetValue (SSRWP); + + SSESs = new StepVisual_HArray1OfSurfaceStyleElementSelect ( 1, 2 ); + SSESs->SetValue ( 2, SESR ); + } SSESs->SetValue ( 1, SES ); - + Handle(TCollection_HAsciiString) SSSName = new TCollection_HAsciiString ( "" ); Handle(StepVisual_SurfaceSideStyle) SSS = new StepVisual_SurfaceSideStyle; SSS->Init ( SSSName, SSESs ); @@ -533,7 +558,7 @@ Handle(StepVisual_PresentationStyleAssignment) STEPConstruct_Styles::GetColorPSA DownCast(myMapOfStyles.FindFromKey(Col)); } else { - PSA = MakeColorPSA ( item, Col, Col ); + PSA = MakeColorPSA ( item, Col, Col, Col, 0.0 ); myMapOfStyles.Add(Col,PSA); } return PSA; @@ -549,11 +574,14 @@ Standard_Boolean STEPConstruct_Styles::GetColors (const Handle(StepVisual_Styled Handle(StepVisual_Colour) &SurfCol, Handle(StepVisual_Colour) &BoundCol, Handle(StepVisual_Colour) &CurveCol, + Handle(StepVisual_Colour) &RenderCol, + Standard_Real& RenderTransp, Standard_Boolean& IsComponent) const { SurfCol.Nullify(); BoundCol.Nullify(); CurveCol.Nullify(); + RenderCol.Nullify(); // parse on styles for(Standard_Integer j=1; j<=style->NbStyles(); j++ ) { @@ -591,6 +619,27 @@ Standard_Boolean STEPConstruct_Styles::GetColors (const Handle(StepVisual_Styled if ( ! CS.IsNull() ) BoundCol = CS->CurveColour(); continue; } + // try rendering color and transparency + Handle(StepVisual_SurfaceStyleRendering) SSR = SSES.SurfaceStyleRendering(); + if (!SSR.IsNull()) { + RenderCol = SSR->SurfaceColour(); + RenderTransp = 0.0; + Handle(StepVisual_SurfaceStyleRenderingWithProperties) SSRWP = + Handle(StepVisual_SurfaceStyleRenderingWithProperties)::DownCast(SSR); + if (!SSRWP.IsNull()) { + Handle(StepVisual_HArray1OfRenderingPropertiesSelect) HARP = SSRWP->Properties(); + if (!HARP.IsNull()) + { + for (Standard_Integer aPropIndex = 1; aPropIndex <= HARP->Length(); ++aPropIndex) { + Handle(StepVisual_SurfaceStyleTransparent) SST = HARP->Value(aPropIndex).SurfaceStyleTransparent(); + if (!SST.IsNull()) { + RenderTransp = SST->Transparency(); + } + } + } + } + } + } continue; } @@ -600,7 +649,7 @@ Standard_Boolean STEPConstruct_Styles::GetColors (const Handle(StepVisual_Styled if ( ! CS.IsNull() ) CurveCol = CS->CurveColour(); } } - return ! SurfCol.IsNull() || ! BoundCol.IsNull() || ! CurveCol.IsNull(); + return ! SurfCol.IsNull() || ! BoundCol.IsNull() || ! CurveCol.IsNull() || ! RenderCol.IsNull(); } diff --git a/src/STEPConstruct/STEPConstruct_Styles.hxx b/src/STEPConstruct/STEPConstruct_Styles.hxx index 72ef678e88..6a92031f81 100644 --- a/src/STEPConstruct/STEPConstruct_Styles.hxx +++ b/src/STEPConstruct/STEPConstruct_Styles.hxx @@ -117,7 +117,7 @@ public: //! Create a PresentationStyleAssignment entity which defines //! two colors (for filling surfaces and curves) //! if isForNAUO true then returns PresentationStyleByContext - 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; + Standard_EXPORT Handle(StepVisual_PresentationStyleAssignment) MakeColorPSA (const Handle(StepRepr_RepresentationItem)& item, const Handle(StepVisual_Colour)& SurfCol, const Handle(StepVisual_Colour)& CurveCol, const Handle(StepVisual_Colour) &RenderCol, const Standard_Real RenderTransp, const Standard_Boolean isForNAUO = Standard_False) const; //! Returns a PresentationStyleAssignment entity which defines //! surface and curve colors as Col. This PSA is either created @@ -129,7 +129,7 @@ public: //! For each type of color supported, result can be either //! NULL if it is not defined by that style, or last //! definition (if they are 1 or more) - 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; + Standard_EXPORT Standard_Boolean GetColors (const Handle(StepVisual_StyledItem)& style, Handle(StepVisual_Colour)& SurfCol, Handle(StepVisual_Colour)& BoundCol, Handle(StepVisual_Colour)& CurveCol, Handle(StepVisual_Colour)& RenderCol, Standard_Real& RenderTransp, Standard_Boolean& IsComponent) const; //! Create STEP color entity by given Quantity_Color //! The analysis is performed for whether the color corresponds to diff --git a/src/StepAP214/StepAP214_Protocol.cxx b/src/StepAP214/StepAP214_Protocol.cxx index 9d67f7ca2d..e638995c6c 100644 --- a/src/StepAP214/StepAP214_Protocol.cxx +++ b/src/StepAP214/StepAP214_Protocol.cxx @@ -750,6 +750,11 @@ static Standard_CString schemaAP242DIS = "AP242_MANAGED_MODEL_BASED_3D_ENGINEERI #include #include +#include +#include +#include +#include + static int THE_StepAP214_Protocol_init = 0; static Interface_DataMapOfTransientInteger types(800); @@ -1459,6 +1464,10 @@ StepAP214_Protocol::StepAP214_Protocol () types.Bind (STANDARD_TYPE(StepVisual_CameraModelD3MultiClippingIntersection), 717); types.Bind (STANDARD_TYPE(StepVisual_CameraModelD3MultiClippingUnion), 718); types.Bind (STANDARD_TYPE(StepVisual_AnnotationCurveOccurrenceAndAnnotationOccurrenceAndGeomReprItemAndReprItemAndStyledItem), 719); + types.Bind (STANDARD_TYPE(StepVisual_SurfaceStyleTransparent), 720); + types.Bind (STANDARD_TYPE(StepVisual_SurfaceStyleReflectanceAmbient), 721); + types.Bind (STANDARD_TYPE(StepVisual_SurfaceStyleRendering), 722); + types.Bind (STANDARD_TYPE(StepVisual_SurfaceStyleRenderingWithProperties), 723); } diff --git a/src/StepVisual/FILES b/src/StepVisual/FILES index 300781c5c5..b6e6a0c1a0 100644 --- a/src/StepVisual/FILES +++ b/src/StepVisual/FILES @@ -32,6 +32,7 @@ StepVisual_Array1OfInvisibleItem.hxx StepVisual_Array1OfLayeredItem.hxx StepVisual_Array1OfPresentationStyleAssignment.hxx StepVisual_Array1OfPresentationStyleSelect.hxx +StepVisual_Array1OfRenderingPropertiesSelect.hxx StepVisual_Array1OfStyleContextSelect.hxx StepVisual_Array1OfSurfaceStyleElementSelect.hxx StepVisual_Array1OfTextOrCharacter.hxx @@ -126,6 +127,7 @@ StepVisual_HArray1OfInvisibleItem.hxx StepVisual_HArray1OfLayeredItem.hxx StepVisual_HArray1OfPresentationStyleAssignment.hxx StepVisual_HArray1OfPresentationStyleSelect.hxx +StepVisual_HArray1OfRenderingPropertiesSelect.hxx StepVisual_HArray1OfStyleContextSelect.hxx StepVisual_HArray1OfSurfaceStyleElementSelect.hxx StepVisual_HArray1OfTextOrCharacter.hxx @@ -193,6 +195,9 @@ StepVisual_PresentedItem.cxx StepVisual_PresentedItem.hxx StepVisual_PresentedItemRepresentation.cxx StepVisual_PresentedItemRepresentation.hxx +StepVisual_RenderingPropertiesSelect.cxx +StepVisual_RenderingPropertiesSelect.hxx +StepVisual_ShadingSurfaceMethod.hxx StepVisual_StyleContextSelect.cxx StepVisual_StyleContextSelect.hxx StepVisual_StyledItem.cxx @@ -212,10 +217,18 @@ StepVisual_SurfaceStyleFillArea.cxx StepVisual_SurfaceStyleFillArea.hxx StepVisual_SurfaceStyleParameterLine.cxx StepVisual_SurfaceStyleParameterLine.hxx +StepVisual_SurfaceStyleReflectanceAmbient.cxx +StepVisual_SurfaceStyleReflectanceAmbient.hxx +StepVisual_SurfaceStyleRendering.cxx +StepVisual_SurfaceStyleRendering.hxx +StepVisual_SurfaceStyleRenderingWithProperties.cxx +StepVisual_SurfaceStyleRenderingWithProperties.hxx StepVisual_SurfaceStyleSegmentationCurve.cxx StepVisual_SurfaceStyleSegmentationCurve.hxx StepVisual_SurfaceStyleSilhouette.cxx StepVisual_SurfaceStyleSilhouette.hxx +StepVisual_SurfaceStyleTransparent.cxx +StepVisual_SurfaceStyleTransparent.hxx StepVisual_SurfaceStyleUsage.cxx StepVisual_SurfaceStyleUsage.hxx StepVisual_Template.cxx diff --git a/src/StepVisual/StepVisual_Array1OfRenderingPropertiesSelect.hxx b/src/StepVisual/StepVisual_Array1OfRenderingPropertiesSelect.hxx new file mode 100644 index 0000000000..ce6b633696 --- /dev/null +++ b/src/StepVisual/StepVisual_Array1OfRenderingPropertiesSelect.hxx @@ -0,0 +1,26 @@ +// Created on : Thu May 14 15:13:19 2020 +// Created by: Igor KHOZHANOV +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0 +// Copyright (c) Open CASCADE 2020 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef StepVisual_Array1OfRenderingPropertiesSelect_HeaderFile +#define StepVisual_Array1OfRenderingPropertiesSelect_HeaderFile + +#include +#include + +typedef NCollection_Array1 StepVisual_Array1OfRenderingPropertiesSelect; + + +#endif diff --git a/src/StepVisual/StepVisual_HArray1OfRenderingPropertiesSelect.hxx b/src/StepVisual/StepVisual_HArray1OfRenderingPropertiesSelect.hxx new file mode 100644 index 0000000000..62f713725f --- /dev/null +++ b/src/StepVisual/StepVisual_HArray1OfRenderingPropertiesSelect.hxx @@ -0,0 +1,27 @@ +// Created on : Thu May 14 15:13:19 2020 +// Created by: Igor KHOZHANOV +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0 +// Copyright (c) Open CASCADE 2020 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef StepVisual_HArray1OfRenderingPropertiesSelect_HeaderFile +#define StepVisual_HArray1OfRenderingPropertiesSelect_HeaderFile + +#include +#include +#include + +DEFINE_HARRAY1(StepVisual_HArray1OfRenderingPropertiesSelect, StepVisual_Array1OfRenderingPropertiesSelect) + + +#endif diff --git a/src/StepVisual/StepVisual_RenderingPropertiesSelect.cxx b/src/StepVisual/StepVisual_RenderingPropertiesSelect.cxx new file mode 100644 index 0000000000..8ee599e86b --- /dev/null +++ b/src/StepVisual/StepVisual_RenderingPropertiesSelect.cxx @@ -0,0 +1,61 @@ +// Created on : Thu May 14 15:13:19 2020 +// Created by: Igor KHOZHANOV +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0 +// Copyright (c) Open CASCADE 2020 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include +#include +#include + +//======================================================================= +//function : StepVisual_RenderingPropertiesSelect +//purpose : +//======================================================================= + +StepVisual_RenderingPropertiesSelect::StepVisual_RenderingPropertiesSelect () +{ +} + +//======================================================================= +//function : CaseNum +//purpose : +//======================================================================= + +Standard_Integer StepVisual_RenderingPropertiesSelect::CaseNum (const Handle(Standard_Transient)& ent) const +{ + if (ent.IsNull()) return 0; + if (ent->IsKind(STANDARD_TYPE(StepVisual_SurfaceStyleReflectanceAmbient))) return 1; + if (ent->IsKind(STANDARD_TYPE(StepVisual_SurfaceStyleTransparent))) return 2; + return 0; +} + +//======================================================================= +//function : SurfaceStyleReflectanceAmbient +//purpose : +//======================================================================= + +Handle(StepVisual_SurfaceStyleReflectanceAmbient) StepVisual_RenderingPropertiesSelect::SurfaceStyleReflectanceAmbient () const +{ + return Handle(StepVisual_SurfaceStyleReflectanceAmbient)::DownCast(Value()); +} + +//======================================================================= +//function : SurfaceStyleTransparent +//purpose : +//======================================================================= + +Handle(StepVisual_SurfaceStyleTransparent) StepVisual_RenderingPropertiesSelect::SurfaceStyleTransparent () const +{ + return Handle(StepVisual_SurfaceStyleTransparent)::DownCast(Value()); +} diff --git a/src/StepVisual/StepVisual_RenderingPropertiesSelect.hxx b/src/StepVisual/StepVisual_RenderingPropertiesSelect.hxx new file mode 100644 index 0000000000..52f38f51b2 --- /dev/null +++ b/src/StepVisual/StepVisual_RenderingPropertiesSelect.hxx @@ -0,0 +1,53 @@ +// Created on : Thu May 14 15:13:19 2020 +// Created by: Igor KHOZHANOV +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0 +// Copyright (c) Open CASCADE 2020 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepVisual_RenderingPropertiesSelect_HeaderFile +#define _StepVisual_RenderingPropertiesSelect_HeaderFile + +#include +#include +#include +#include +#include + +class Standard_Transient; +class StepVisual_SurfaceStyleReflectanceAmbient; +class StepVisual_SurfaceStyleTransparent; + +//! Representation of STEP SELECT type RenderingPropertiesSelect +class StepVisual_RenderingPropertiesSelect : public StepData_SelectType +{ + +public: + + DEFINE_STANDARD_ALLOC + + //! Empty constructor + Standard_EXPORT StepVisual_RenderingPropertiesSelect(); + + //! Recognizes a kind of RenderingPropertiesSelect select type + //! -- 1 -> SurfaceStyleReflectanceAmbient + //! -- 2 -> SurfaceStyleTransparent + Standard_EXPORT Standard_Integer CaseNum (const Handle(Standard_Transient)& ent) const Standard_OVERRIDE; + + //! Returns Value as SurfaceStyleReflectanceAmbient (or Null if another type) + Standard_EXPORT Handle(StepVisual_SurfaceStyleReflectanceAmbient) SurfaceStyleReflectanceAmbient() const; + + //! Returns Value as SurfaceStyleTransparent (or Null if another type) + Standard_EXPORT Handle(StepVisual_SurfaceStyleTransparent) SurfaceStyleTransparent() const; + +}; +#endif // _StepVisual_RenderingPropertiesSelect_HeaderFile diff --git a/src/StepVisual/StepVisual_ShadingSurfaceMethod.hxx b/src/StepVisual/StepVisual_ShadingSurfaceMethod.hxx new file mode 100644 index 0000000000..45cf9a1976 --- /dev/null +++ b/src/StepVisual/StepVisual_ShadingSurfaceMethod.hxx @@ -0,0 +1,27 @@ +// Created on : Thu May 14 15:13:19 2020 +// Created by: Igor KHOZHANOV +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0 +// Copyright (c) Open CASCADE 2020 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepVisual_ShadingSurfaceMethod_HeaderFile +#define _StepVisual_ShadingSurfaceMethod_HeaderFile + +enum StepVisual_ShadingSurfaceMethod +{ + StepVisual_ssmConstantShading, + StepVisual_ssmColourShading, + StepVisual_ssmDotShading, + StepVisual_ssmNormalShading +}; +#endif // _StepVisual_ShadingSurfaceMethod_HeaderFile diff --git a/src/StepVisual/StepVisual_SurfaceStyleElementSelect.cxx b/src/StepVisual/StepVisual_SurfaceStyleElementSelect.cxx index a2ea78caa0..a004d195cc 100644 --- a/src/StepVisual/StepVisual_SurfaceStyleElementSelect.cxx +++ b/src/StepVisual/StepVisual_SurfaceStyleElementSelect.cxx @@ -21,6 +21,7 @@ #include #include #include +#include StepVisual_SurfaceStyleElementSelect::StepVisual_SurfaceStyleElementSelect () { } @@ -33,6 +34,7 @@ Standard_Integer StepVisual_SurfaceStyleElementSelect::CaseNum(const Handle(Stan // if (ent->IsKind(STANDARD_TYPE(StepVisual_SurfaceStyleSilhouette))) return 4; // if (ent->IsKind(STANDARD_TYPE(StepVisual_SurfaceStyleSegmentationCurve))) return 5; // if (ent->IsKind(STANDARD_TYPE(StepVisual_SurfaceStyleControlGrid))) return 6; + if (ent->IsKind(STANDARD_TYPE(StepVisual_SurfaceStyleRendering))) return 7; return 0; } @@ -50,3 +52,8 @@ Handle(StepVisual_SurfaceStyleParameterLine) StepVisual_SurfaceStyleElementSelec { return GetCasted(StepVisual_SurfaceStyleParameterLine,Value()); } + +Handle(StepVisual_SurfaceStyleRendering) StepVisual_SurfaceStyleElementSelect::SurfaceStyleRendering () const +{ + return GetCasted(StepVisual_SurfaceStyleRendering,Value()); +} diff --git a/src/StepVisual/StepVisual_SurfaceStyleElementSelect.hxx b/src/StepVisual/StepVisual_SurfaceStyleElementSelect.hxx index 965c6d5bb6..d3b39f3b24 100644 --- a/src/StepVisual/StepVisual_SurfaceStyleElementSelect.hxx +++ b/src/StepVisual/StepVisual_SurfaceStyleElementSelect.hxx @@ -27,7 +27,7 @@ class Standard_Transient; class StepVisual_SurfaceStyleFillArea; class StepVisual_SurfaceStyleBoundary; class StepVisual_SurfaceStyleParameterLine; - +class StepVisual_SurfaceStyleRendering; class StepVisual_SurfaceStyleElementSelect : public StepData_SelectType @@ -47,6 +47,7 @@ public: //! 4 -> SurfaceStyleSilhouette //! 5 -> SurfaceStyleSegmentationCurve //! 6 -> SurfaceStyleControlGrid + //! 7 -> SurfaceStyleRendering //! 0 else Standard_EXPORT Standard_Integer CaseNum (const Handle(Standard_Transient)& ent) const; @@ -59,6 +60,8 @@ public: //! returns Value as a SurfaceStyleParameterLine (Null if another type) Standard_EXPORT Handle(StepVisual_SurfaceStyleParameterLine) SurfaceStyleParameterLine() const; + //! returns Value as a SurfaceStyleRendering (Null if another type) + Standard_EXPORT Handle(StepVisual_SurfaceStyleRendering) SurfaceStyleRendering() const; diff --git a/src/StepVisual/StepVisual_SurfaceStyleReflectanceAmbient.cxx b/src/StepVisual/StepVisual_SurfaceStyleReflectanceAmbient.cxx new file mode 100644 index 0000000000..61de29891b --- /dev/null +++ b/src/StepVisual/StepVisual_SurfaceStyleReflectanceAmbient.cxx @@ -0,0 +1,59 @@ +// Created on : Thu May 14 15:13:19 2020 +// Created by: Igor KHOZHANOV +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0 +// Copyright (c) Open CASCADE 2020 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +IMPLEMENT_STANDARD_RTTIEXT(StepVisual_SurfaceStyleReflectanceAmbient, Standard_Transient) + +//======================================================================= +//function : StepVisual_SurfaceStyleReflectanceAmbient +//purpose : +//======================================================================= + +StepVisual_SurfaceStyleReflectanceAmbient::StepVisual_SurfaceStyleReflectanceAmbient () +{ +} + +//======================================================================= +//function : Init +//purpose : +//======================================================================= + +void StepVisual_SurfaceStyleReflectanceAmbient::Init (const Standard_Real theAmbientReflectance) +{ + + myAmbientReflectance = theAmbientReflectance; +} + +//======================================================================= +//function : AmbientReflectance +//purpose : +//======================================================================= + +Standard_Real StepVisual_SurfaceStyleReflectanceAmbient::AmbientReflectance () const +{ + return myAmbientReflectance; +} + +//======================================================================= +//function : SetAmbientReflectance +//purpose : +//======================================================================= + +void StepVisual_SurfaceStyleReflectanceAmbient::SetAmbientReflectance (const Standard_Real theAmbientReflectance) +{ + myAmbientReflectance = theAmbientReflectance; +} diff --git a/src/StepVisual/StepVisual_SurfaceStyleReflectanceAmbient.hxx b/src/StepVisual/StepVisual_SurfaceStyleReflectanceAmbient.hxx new file mode 100644 index 0000000000..baf55343c7 --- /dev/null +++ b/src/StepVisual/StepVisual_SurfaceStyleReflectanceAmbient.hxx @@ -0,0 +1,49 @@ +// Created on : Thu May 14 15:13:19 2020 +// Created by: Igor KHOZHANOV +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0 +// Copyright (c) Open CASCADE 2020 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepVisual_SurfaceStyleReflectanceAmbient_HeaderFile_ +#define _StepVisual_SurfaceStyleReflectanceAmbient_HeaderFile_ + +#include +#include +#include + +class StepVisual_SurfaceStyleReflectanceAmbient; +DEFINE_STANDARD_HANDLE(StepVisual_SurfaceStyleReflectanceAmbient, Standard_Transient) + +//! Representation of STEP entity SurfaceStyleReflectanceAmbient +class StepVisual_SurfaceStyleReflectanceAmbient : public Standard_Transient +{ +public : + + //! default constructor + Standard_EXPORT StepVisual_SurfaceStyleReflectanceAmbient(); + + //! Initialize all fields (own and inherited) + Standard_EXPORT void Init(const Standard_Real theAmbientReflectance); + + //! Returns field AmbientReflectance + Standard_EXPORT Standard_Real AmbientReflectance() const; + //! Sets field AmbientReflectance + Standard_EXPORT void SetAmbientReflectance (const Standard_Real theAmbientReflectance); + +DEFINE_STANDARD_RTTIEXT(StepVisual_SurfaceStyleReflectanceAmbient, Standard_Transient) + +private: + Standard_Real myAmbientReflectance; + +}; +#endif // _StepVisual_SurfaceStyleReflectanceAmbient_HeaderFile_ diff --git a/src/StepVisual/StepVisual_SurfaceStyleRendering.cxx b/src/StepVisual/StepVisual_SurfaceStyleRendering.cxx new file mode 100644 index 0000000000..c985709016 --- /dev/null +++ b/src/StepVisual/StepVisual_SurfaceStyleRendering.cxx @@ -0,0 +1,82 @@ +// Created on : Thu May 14 15:13:19 2020 +// Created by: Igor KHOZHANOV +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0 +// Copyright (c) Open CASCADE 2020 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +IMPLEMENT_STANDARD_RTTIEXT(StepVisual_SurfaceStyleRendering, Standard_Transient) + +//======================================================================= +//function : StepVisual_SurfaceStyleRendering +//purpose : +//======================================================================= + +StepVisual_SurfaceStyleRendering::StepVisual_SurfaceStyleRendering () +{ +} + +//======================================================================= +//function : Init +//purpose : +//======================================================================= + +void StepVisual_SurfaceStyleRendering::Init (const StepVisual_ShadingSurfaceMethod theRenderingMethod, + const Handle(StepVisual_Colour)& theSurfaceColour) +{ + + myRenderingMethod = theRenderingMethod; + + mySurfaceColour = theSurfaceColour; +} + +//======================================================================= +//function : RenderingMethod +//purpose : +//======================================================================= + +StepVisual_ShadingSurfaceMethod StepVisual_SurfaceStyleRendering::RenderingMethod () const +{ + return myRenderingMethod; +} + +//======================================================================= +//function : SetRenderingMethod +//purpose : +//======================================================================= + +void StepVisual_SurfaceStyleRendering::SetRenderingMethod (const StepVisual_ShadingSurfaceMethod theRenderingMethod) +{ + myRenderingMethod = theRenderingMethod; +} + +//======================================================================= +//function : SurfaceColour +//purpose : +//======================================================================= + +Handle(StepVisual_Colour) StepVisual_SurfaceStyleRendering::SurfaceColour () const +{ + return mySurfaceColour; +} + +//======================================================================= +//function : SetSurfaceColour +//purpose : +//======================================================================= + +void StepVisual_SurfaceStyleRendering::SetSurfaceColour (const Handle(StepVisual_Colour)& theSurfaceColour) +{ + mySurfaceColour = theSurfaceColour; +} diff --git a/src/StepVisual/StepVisual_SurfaceStyleRendering.hxx b/src/StepVisual/StepVisual_SurfaceStyleRendering.hxx new file mode 100644 index 0000000000..15cecc8b55 --- /dev/null +++ b/src/StepVisual/StepVisual_SurfaceStyleRendering.hxx @@ -0,0 +1,59 @@ +// Created on : Thu May 14 15:13:19 2020 +// Created by: Igor KHOZHANOV +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0 +// Copyright (c) Open CASCADE 2020 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepVisual_SurfaceStyleRendering_HeaderFile_ +#define _StepVisual_SurfaceStyleRendering_HeaderFile_ + +#include +#include +#include + +#include +#include + +class StepVisual_SurfaceStyleRendering; +DEFINE_STANDARD_HANDLE(StepVisual_SurfaceStyleRendering, Standard_Transient) + +//! Representation of STEP entity SurfaceStyleRendering +class StepVisual_SurfaceStyleRendering : public Standard_Transient +{ +public : + + //! default constructor + Standard_EXPORT StepVisual_SurfaceStyleRendering(); + + //! Initialize all fields (own and inherited) + Standard_EXPORT void Init(const StepVisual_ShadingSurfaceMethod theRenderingMethod, + const Handle(StepVisual_Colour)& theSurfaceColour); + + //! Returns field RenderingMethod + Standard_EXPORT StepVisual_ShadingSurfaceMethod RenderingMethod() const; + //! Sets field RenderingMethod + Standard_EXPORT void SetRenderingMethod (const StepVisual_ShadingSurfaceMethod theRenderingMethod); + + //! Returns field SurfaceColour + Standard_EXPORT Handle(StepVisual_Colour) SurfaceColour() const; + //! Sets field SurfaceColour + Standard_EXPORT void SetSurfaceColour (const Handle(StepVisual_Colour)& theSurfaceColour); + +DEFINE_STANDARD_RTTIEXT(StepVisual_SurfaceStyleRendering, Standard_Transient) + +private: + StepVisual_ShadingSurfaceMethod myRenderingMethod; + Handle(StepVisual_Colour) mySurfaceColour; + +}; +#endif // _StepVisual_SurfaceStyleRendering_HeaderFile_ diff --git a/src/StepVisual/StepVisual_SurfaceStyleRenderingWithProperties.cxx b/src/StepVisual/StepVisual_SurfaceStyleRenderingWithProperties.cxx new file mode 100644 index 0000000000..e4aa058e3c --- /dev/null +++ b/src/StepVisual/StepVisual_SurfaceStyleRenderingWithProperties.cxx @@ -0,0 +1,63 @@ +// Created on : Thu May 14 15:13:19 2020 +// Created by: Igor KHOZHANOV +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0 +// Copyright (c) Open CASCADE 2020 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +IMPLEMENT_STANDARD_RTTIEXT(StepVisual_SurfaceStyleRenderingWithProperties, StepVisual_SurfaceStyleRendering) + +//======================================================================= +//function : StepVisual_SurfaceStyleRenderingWithProperties +//purpose : +//======================================================================= + +StepVisual_SurfaceStyleRenderingWithProperties::StepVisual_SurfaceStyleRenderingWithProperties () +{ +} + +//======================================================================= +//function : Init +//purpose : +//======================================================================= + +void StepVisual_SurfaceStyleRenderingWithProperties::Init (const StepVisual_ShadingSurfaceMethod theSurfaceStyleRendering_RenderingMethod, + const Handle(StepVisual_Colour)& theSurfaceStyleRendering_SurfaceColour, + const Handle(StepVisual_HArray1OfRenderingPropertiesSelect)& theProperties) +{ + StepVisual_SurfaceStyleRendering::Init(theSurfaceStyleRendering_RenderingMethod, + theSurfaceStyleRendering_SurfaceColour); + + myProperties = theProperties; +} + +//======================================================================= +//function : Properties +//purpose : +//======================================================================= + +Handle(StepVisual_HArray1OfRenderingPropertiesSelect) StepVisual_SurfaceStyleRenderingWithProperties::Properties () const +{ + return myProperties; +} + +//======================================================================= +//function : SetProperties +//purpose : +//======================================================================= + +void StepVisual_SurfaceStyleRenderingWithProperties::SetProperties (const Handle(StepVisual_HArray1OfRenderingPropertiesSelect)& theProperties) +{ + myProperties = theProperties; +} diff --git a/src/StepVisual/StepVisual_SurfaceStyleRenderingWithProperties.hxx b/src/StepVisual/StepVisual_SurfaceStyleRenderingWithProperties.hxx new file mode 100644 index 0000000000..df4106b992 --- /dev/null +++ b/src/StepVisual/StepVisual_SurfaceStyleRenderingWithProperties.hxx @@ -0,0 +1,55 @@ +// Created on : Thu May 14 15:13:19 2020 +// Created by: Igor KHOZHANOV +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0 +// Copyright (c) Open CASCADE 2020 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepVisual_SurfaceStyleRenderingWithProperties_HeaderFile_ +#define _StepVisual_SurfaceStyleRenderingWithProperties_HeaderFile_ + +#include +#include +#include + +#include +#include +#include + +class StepVisual_SurfaceStyleRenderingWithProperties; +DEFINE_STANDARD_HANDLE(StepVisual_SurfaceStyleRenderingWithProperties, StepVisual_SurfaceStyleRendering) + +//! Representation of STEP entity SurfaceStyleRenderingWithProperties +class StepVisual_SurfaceStyleRenderingWithProperties : public StepVisual_SurfaceStyleRendering +{ +public : + + //! default constructor + Standard_EXPORT StepVisual_SurfaceStyleRenderingWithProperties(); + + //! Initialize all fields (own and inherited) + Standard_EXPORT void Init(const StepVisual_ShadingSurfaceMethod theSurfaceStyleRendering_RenderingMethod, + const Handle(StepVisual_Colour)& theSurfaceStyleRendering_SurfaceColour, + const Handle(StepVisual_HArray1OfRenderingPropertiesSelect)& theProperties); + + //! Returns field Properties + Standard_EXPORT Handle(StepVisual_HArray1OfRenderingPropertiesSelect) Properties() const; + //! Sets field Properties + Standard_EXPORT void SetProperties (const Handle(StepVisual_HArray1OfRenderingPropertiesSelect)& theProperties); + +DEFINE_STANDARD_RTTIEXT(StepVisual_SurfaceStyleRenderingWithProperties, StepVisual_SurfaceStyleRendering) + +private: + Handle(StepVisual_HArray1OfRenderingPropertiesSelect) myProperties; + +}; +#endif // _StepVisual_SurfaceStyleRenderingWithProperties_HeaderFile_ diff --git a/src/StepVisual/StepVisual_SurfaceStyleTransparent.cxx b/src/StepVisual/StepVisual_SurfaceStyleTransparent.cxx new file mode 100644 index 0000000000..9ef17ea258 --- /dev/null +++ b/src/StepVisual/StepVisual_SurfaceStyleTransparent.cxx @@ -0,0 +1,59 @@ +// Created on : Tue May 12 14:11:46 2020 +// Created by: Igor KHOZHANOV +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0 +// Copyright (c) Open CASCADE 2020 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#include + +IMPLEMENT_STANDARD_RTTIEXT(StepVisual_SurfaceStyleTransparent, Standard_Transient) + +//======================================================================= +//function : StepVisual_SurfaceStyleTransparent +//purpose : +//======================================================================= + +StepVisual_SurfaceStyleTransparent::StepVisual_SurfaceStyleTransparent () +{ +} + +//======================================================================= +//function : Init +//purpose : +//======================================================================= + +void StepVisual_SurfaceStyleTransparent::Init (const Standard_Real theTransparency) +{ + + myTransparency = theTransparency; +} + +//======================================================================= +//function : Transparency +//purpose : +//======================================================================= + +Standard_Real StepVisual_SurfaceStyleTransparent::Transparency () const +{ + return myTransparency; +} + +//======================================================================= +//function : SetTransparency +//purpose : +//======================================================================= + +void StepVisual_SurfaceStyleTransparent::SetTransparency (const Standard_Real theTransparency) +{ + myTransparency = theTransparency; +} diff --git a/src/StepVisual/StepVisual_SurfaceStyleTransparent.hxx b/src/StepVisual/StepVisual_SurfaceStyleTransparent.hxx new file mode 100644 index 0000000000..28b293a606 --- /dev/null +++ b/src/StepVisual/StepVisual_SurfaceStyleTransparent.hxx @@ -0,0 +1,49 @@ +// Created on : Tue May 12 14:11:46 2020 +// Created by: Igor KHOZHANOV +// Generator: Express (EXPRESS -> CASCADE/XSTEP Translator) V2.0 +// Copyright (c) Open CASCADE 2020 +// +// This file is part of Open CASCADE Technology software library. +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License version 2.1 as published +// by the Free Software Foundation, with special exception defined in the file +// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +// distribution for complete text of the license and disclaimer of any warranty. +// +// Alternatively, this file may be used under the terms of Open CASCADE +// commercial license or contractual agreement. + +#ifndef _StepVisual_SurfaceStyleTransparent_HeaderFile_ +#define _StepVisual_SurfaceStyleTransparent_HeaderFile_ + +#include +#include +#include + +class StepVisual_SurfaceStyleTransparent; +DEFINE_STANDARD_HANDLE(StepVisual_SurfaceStyleTransparent, Standard_Transient) + +//! Representation of STEP entity SurfaceStyleTransparent +class StepVisual_SurfaceStyleTransparent : public Standard_Transient +{ +public : + + //! default constructor + Standard_EXPORT StepVisual_SurfaceStyleTransparent(); + + //! Initialize all fields (own and inherited) + Standard_EXPORT void Init(const Standard_Real theTransparency); + + //! Returns field Transparency + Standard_EXPORT Standard_Real Transparency() const; + //! Sets field Transparency + Standard_EXPORT void SetTransparency (const Standard_Real theTransparency); + +DEFINE_STANDARD_RTTIEXT(StepVisual_SurfaceStyleTransparent, Standard_Transient) + +private: + Standard_Real myTransparency; + +}; +#endif // _StepVisual_SurfaceStyleTransparent_HeaderFile_ diff --git a/tests/bugs/step/bug31550 b/tests/bugs/step/bug31550 new file mode 100644 index 0000000000..2d8c8aaad2 --- /dev/null +++ b/tests/bugs/step/bug31550 @@ -0,0 +1,37 @@ +puts "====================================" +puts "OCC31550: Surface transparency is ignored" +puts "====================================" + +# Step file +set filename [locate_data_file bug29525_rev_part_neu_01.prt_converted_from_datakit.stp] + +# Read file +if { [catch { ReadStep D ${filename} } result] } { + puts "ERROR: Couldn't read ${filename} file" +} + +# Static data +set Transparency 0.5 +set TempFilename ${imagedir}/bug31550_temp.stp + +# Get colors +set Colors [XGetAllColors D] +if { [string first ${Transparency} ${Colors}] == -1 } { + puts "ERROR: OCC31550 is reproduced while STEP import." +} + +# Write file +if { [catch { WriteStep D ${TempFilename} } result] } { + puts "ERROR: Couldn't write ${TempFilename} file" +} + +# Read temporary file +if { [catch { ReadStep D1 ${TempFilename} } result] } { + puts "ERROR: Couldn't read ${TempFilename} file" +} + +# Get colors +set Colors [XGetAllColors D1] +if { [string first ${Transparency} ${Colors}] == -1 } { + puts "ERROR: OCC31550 is reproduced while STEP export." +} \ No newline at end of file