Skip to content

Commit

Permalink
Coding - Move StepData_ConfParameters to DESTEP package Open-Cascade-…
Browse files Browse the repository at this point in the history
…SAS#201

Replace StepData_ConfParameters with DESTEP_Parameters across multiple files.
New location will help to keep any translate related stuff in one place for high level usage.
  • Loading branch information
dpasukhi committed Jan 16, 2025
1 parent 427adb0 commit 6063eb4
Show file tree
Hide file tree
Showing 20 changed files with 372 additions and 330 deletions.
41 changes: 22 additions & 19 deletions src/DESTEP/DESTEP_ConfigurationNode.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ bool DESTEP_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theRe
THE_CONFIGURATION_SCOPE() + "." + GetFormat() + "." + GetVendor();

InternalParameters.ReadBSplineContinuity =
(StepData_ConfParameters::ReadMode_BSplineContinuity)theResource->IntegerVal(
(DESTEP_Parameters::ReadMode_BSplineContinuity)theResource->IntegerVal(
"read.iges.bspline.continuity",
InternalParameters.ReadBSplineContinuity,
aScope);
InternalParameters.ReadPrecisionMode =
(StepData_ConfParameters::ReadMode_Precision)
(DESTEP_Parameters::ReadMode_Precision)
theResource->IntegerVal("read.precision.mode", InternalParameters.ReadPrecisionMode, aScope);
InternalParameters.ReadPrecisionVal =
theResource->RealVal("read.precision.val", InternalParameters.ReadPrecisionVal, aScope);
InternalParameters.ReadMaxPrecisionMode =
(StepData_ConfParameters::ReadMode_MaxPrecision)theResource->IntegerVal(
(DESTEP_Parameters::ReadMode_MaxPrecision)theResource->IntegerVal(
"read.maxprecision.mode",
InternalParameters.ReadMaxPrecisionMode,
aScope);
Expand All @@ -76,16 +76,16 @@ bool DESTEP_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theRe
InternalParameters.ReadSameParamMode,
aScope);
InternalParameters.ReadSurfaceCurveMode =
(StepData_ConfParameters::ReadMode_SurfaceCurve)theResource->IntegerVal(
(DESTEP_Parameters::ReadMode_SurfaceCurve)theResource->IntegerVal(
"read.surfacecurve.mode",
InternalParameters.ReadSurfaceCurveMode,
aScope);
InternalParameters.EncodeRegAngle =
theResource->RealVal("read.encoderegularity.angle", InternalParameters.EncodeRegAngle, aScope);
InternalParameters.AngleUnit =
(StepData_ConfParameters::AngleUnitMode)theResource->IntegerVal("angleunit.mode",
InternalParameters.AngleUnit,
aScope);
(DESTEP_Parameters::AngleUnitMode)theResource->IntegerVal("angleunit.mode",
InternalParameters.AngleUnit,
aScope);

InternalParameters.ReadResourceName =
theResource->StringVal("read.resource.name", InternalParameters.ReadResourceName, aScope);
Expand All @@ -94,18 +94,19 @@ bool DESTEP_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theRe
InternalParameters.ReadProductMode =
theResource->BooleanVal("read.product.mode", InternalParameters.ReadProductMode, aScope);
InternalParameters.ReadProductContext =
(StepData_ConfParameters::ReadMode_ProductContext)theResource->IntegerVal(
(DESTEP_Parameters::ReadMode_ProductContext)theResource->IntegerVal(
"read.product.context",
InternalParameters.ReadProductContext,
aScope);
InternalParameters.ReadShapeRepr =
(StepData_ConfParameters::ReadMode_ShapeRepr)
theResource->IntegerVal("read.shape.repr", InternalParameters.ReadShapeRepr, aScope);
(DESTEP_Parameters::ReadMode_ShapeRepr)theResource->IntegerVal("read.shape.repr",
InternalParameters.ReadShapeRepr,
aScope);
InternalParameters.ReadTessellated =
(StepData_ConfParameters::RWMode_Tessellated)
(DESTEP_Parameters::RWMode_Tessellated)
theResource->IntegerVal("read.tessellated", InternalParameters.ReadTessellated, aScope);
InternalParameters.ReadAssemblyLevel =
(StepData_ConfParameters::ReadMode_AssemblyLevel)
(DESTEP_Parameters::ReadMode_AssemblyLevel)
theResource->IntegerVal("read.assembly.level", InternalParameters.ReadAssemblyLevel, aScope);
InternalParameters.ReadRelationship =
theResource->BooleanVal("read.shape.relationship", InternalParameters.ReadRelationship, aScope);
Expand Down Expand Up @@ -145,20 +146,22 @@ bool DESTEP_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theRe
theResource->BooleanVal("read.metadata", InternalParameters.ReadMetadata, aScope);

InternalParameters.WritePrecisionMode =
(StepData_ConfParameters::WriteMode_PrecisionMode)theResource->IntegerVal(
(DESTEP_Parameters::WriteMode_PrecisionMode)theResource->IntegerVal(
"write.precision.mode",
InternalParameters.WritePrecisionMode,
aScope);
InternalParameters.WritePrecisionVal =
theResource->RealVal("write.precision.val", InternalParameters.WritePrecisionVal, aScope);
InternalParameters.WriteAssembly =
(StepData_ConfParameters::WriteMode_Assembly)
theResource->IntegerVal("write.assembly", InternalParameters.WriteAssembly, aScope);
(DESTEP_Parameters::WriteMode_Assembly)theResource->IntegerVal("write.assembly",
InternalParameters.WriteAssembly,
aScope);
InternalParameters.WriteSchema =
(StepData_ConfParameters::WriteMode_StepSchema)
theResource->IntegerVal("write.schema", InternalParameters.WriteSchema, aScope);
(DESTEP_Parameters::WriteMode_StepSchema)theResource->IntegerVal("write.schema",
InternalParameters.WriteSchema,
aScope);
InternalParameters.WriteTessellated =
(StepData_ConfParameters::RWMode_Tessellated)
(DESTEP_Parameters::RWMode_Tessellated)
theResource->IntegerVal("write.tessellated", InternalParameters.WriteTessellated, aScope);
InternalParameters.WriteProductName =
theResource->StringVal("write.product.name", InternalParameters.WriteProductName, aScope);
Expand All @@ -175,7 +178,7 @@ bool DESTEP_ConfigurationNode::Load(const Handle(DE_ConfigurationContext)& theRe
InternalParameters.WriteSequence =
theResource->StringVal("write.sequence", InternalParameters.WriteSequence, aScope);
InternalParameters.WriteVertexMode =
(StepData_ConfParameters::WriteMode_VertexMode)
(DESTEP_Parameters::WriteMode_VertexMode)
theResource->IntegerVal("write.vertex.mode", InternalParameters.WriteVertexMode, aScope);
InternalParameters.WriteSubshapeNames =
theResource->BooleanVal("write.stepcaf.subshapes.name",
Expand Down
4 changes: 2 additions & 2 deletions src/DESTEP/DESTEP_ConfigurationNode.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
#ifndef _DESTEP_ConfigurationNode_HeaderFile
#define _DESTEP_ConfigurationNode_HeaderFile

#include <DESTEP_Parameters.hxx>
#include <DE_ConfigurationNode.hxx>
#include <Resource_FormatType.hxx>
#include <STEPControl_StepModelType.hxx>
#include <StepData_ConfParameters.hxx>
#include <UnitsMethods_LengthUnit.hxx>

//! The purpose of this class is to configure the transfer process for STEP format
Expand Down Expand Up @@ -87,7 +87,7 @@ public:
Standard_OVERRIDE;

public:
StepData_ConfParameters InternalParameters;
DESTEP_Parameters InternalParameters;
};

#endif // _DESTEP_ConfigurationNode_HeaderFile
97 changes: 97 additions & 0 deletions src/DESTEP/DESTEP_Parameters.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// Copyright (c) 2023 OPEN CASCADE SAS
//
// 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 <Interface_Static.hxx>

#include <DESTEP_Parameters.hxx>

//=================================================================================================

DESTEP_Parameters::DESTEP_Parameters() {}

//=================================================================================================

void DESTEP_Parameters::InitFromStatic()
{
ReadBSplineContinuity = (DESTEP_Parameters::ReadMode_BSplineContinuity)Interface_Static::IVal(
"read.iges.bspline.continuity");
ReadPrecisionMode =
(DESTEP_Parameters::ReadMode_Precision)Interface_Static::IVal("read.precision.mode");
ReadPrecisionVal = Interface_Static::RVal("read.precision.val");
ReadMaxPrecisionMode =
(DESTEP_Parameters::ReadMode_MaxPrecision)Interface_Static::IVal("read.maxprecision.mode");
ReadMaxPrecisionVal = Interface_Static::RVal("read.maxprecision.val");
ReadSameParamMode = Interface_Static::IVal("read.stdsameparameter.mode") == 1;
ReadSurfaceCurveMode =
(DESTEP_Parameters::ReadMode_SurfaceCurve)Interface_Static::IVal("read.surfacecurve.mode");
EncodeRegAngle = Interface_Static::RVal("read.encoderegularity.angle") * 180.0 / M_PI;
AngleUnit = (DESTEP_Parameters::AngleUnitMode)Interface_Static::IVal("step.angleunit.mode");

ReadResourceName = Interface_Static::CVal("read.step.resource.name");
ReadSequence = Interface_Static::CVal("read.step.sequence");
ReadProductMode = Interface_Static::IVal("read.step.product.mode") == 1;
ReadProductContext =
(DESTEP_Parameters::ReadMode_ProductContext)Interface_Static::IVal("read.step.product.context");
ReadShapeRepr =
(DESTEP_Parameters::ReadMode_ShapeRepr)Interface_Static::IVal("read.step.shape.repr");
ReadTessellated =
(DESTEP_Parameters::RWMode_Tessellated)Interface_Static::IVal("read.step.tessellated");
ReadAssemblyLevel =
(DESTEP_Parameters::ReadMode_AssemblyLevel)Interface_Static::IVal("read.step.assembly.level");
ReadRelationship = Interface_Static::IVal("read.step.shape.relationship") == 1;
ReadShapeAspect = Interface_Static::IVal("read.step.shape.aspect") == 1;
ReadConstrRelation = Interface_Static::IVal("read.step.constructivegeom.relationship") == 1;
ReadSubshapeNames = Interface_Static::IVal("read.stepcaf.subshapes.name") == 1;
ReadCodePage = (Resource_FormatType)Interface_Static::IVal("read.step.codepage");
ReadNonmanifold = Interface_Static::IVal("read.step.nonmanifold") == 1;
ReadIdeas = Interface_Static::IVal("read.step.ideas") == 1;
ReadAllShapes = Interface_Static::IVal("read.step.all.shapes") == 1;
ReadRootTransformation = Interface_Static::IVal("read.step.root.transformation") == 1;
ReadColor = Interface_Static::IVal("read.color") == 1;
ReadName = Interface_Static::IVal("read.name") == 1;
ReadLayer = Interface_Static::IVal("read.layer") == 1;
ReadProps = Interface_Static::IVal("read.props") == 1;
ReadMetadata = Interface_Static::IVal("read.metadata") == 1;

WritePrecisionMode =
(DESTEP_Parameters::WriteMode_PrecisionMode)Interface_Static::IVal("write.precision.mode");
WritePrecisionVal = Interface_Static::RVal("write.precision.val");
WriteAssembly =
(DESTEP_Parameters::WriteMode_Assembly)Interface_Static::IVal("write.step.assembly");
WriteSchema =
(DESTEP_Parameters::WriteMode_StepSchema)Interface_Static::IVal("write.step.schema");
WriteTessellated =
(DESTEP_Parameters::RWMode_Tessellated)Interface_Static::IVal("write.step.tessellated");
WriteProductName = Interface_Static::CVal("write.step.product.name");
WriteSurfaceCurMode = Interface_Static::IVal("write.surfacecurve.mode") == 1;
WriteUnit = (UnitsMethods_LengthUnit)Interface_Static::IVal("write.step.unit");
WriteResourceName = Interface_Static::CVal("write.step.resource.name");
WriteSequence = Interface_Static::CVal("write.step.sequence");
WriteVertexMode =
(DESTEP_Parameters::WriteMode_VertexMode)Interface_Static::IVal("write.step.vertex.mode");
WriteSubshapeNames = Interface_Static::IVal("write.stepcaf.subshapes.name") == 1;
WriteColor = Interface_Static::IVal("write.color") == 1;
WriteNonmanifold = Interface_Static::IVal("write.step.nonmanifold") == 1;
WriteName = Interface_Static::IVal("write.name") == 1;
WriteLayer = Interface_Static::IVal("write.layer") == 1;
WriteProps = Interface_Static::IVal("write.props") == 1;
WriteModelType = (STEPControl_StepModelType)Interface_Static::IVal("write.model.type");
}

//=================================================================================================

void DESTEP_Parameters::Reset()
{
DESTEP_Parameters aParameters;
*this = aParameters;
}
Loading

0 comments on commit 6063eb4

Please sign in to comment.