1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-16 10:08:36 +03:00
occt/src/RWStepBasic/RWStepBasic_RWGeneralPropertyRelationship.cxx
ichesnok f286953d85 0033530: Data Exchange, Step Import - Implement GENERAL_PROPERTY support
The necessary classes for GeneralProperty support were added.
The ReadMetadata method was created for reading and saving attributes.
2024-02-15 14:00:40 +00:00

104 lines
4.0 KiB
C++

// Copyright (c) 2024 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_EntityIterator.hxx>
#include <RWStepBasic_RWGeneralPropertyRelationship.hxx>
#include <StepBasic_GeneralProperty.hxx>
#include <StepBasic_GeneralPropertyRelationship.hxx>
#include <StepData_StepReaderData.hxx>
#include <StepData_StepWriter.hxx>
#include <StepRepr_PropertyDefinition.hxx>
//=======================================================================
//function : RWStepBasic_RWGeneralPropertyRelationship
//purpose :
//=======================================================================
RWStepBasic_RWGeneralPropertyRelationship::RWStepBasic_RWGeneralPropertyRelationship()
{
}
//=======================================================================
//function : ReadStep
//purpose :
//=======================================================================
void RWStepBasic_RWGeneralPropertyRelationship::ReadStep(const Handle(StepData_StepReaderData)& theData,
const Standard_Integer theNum,
Handle(Interface_Check)& theAch,
const Handle(StepBasic_GeneralPropertyRelationship)& theEnt) const
{
// Check number of parameters
if (!theData->CheckNbParams(theNum, 4, theAch, "general_property_association")) return;
Handle(TCollection_HAsciiString) aName;
theData->ReadString(theNum, 1, "name", theAch, aName);
Handle(TCollection_HAsciiString) aDescription;
Standard_Boolean hasDescription = Standard_True;
if (theData->IsParamDefined(theNum, 2))
{
theData->ReadString(theNum, 2, "description", theAch, aDescription);
}
else
{
hasDescription = Standard_False;
}
Handle(StepBasic_GeneralProperty) aRelatingGeneralProperty;
theData->ReadEntity(theNum, 3, "relating_property", theAch, STANDARD_TYPE(StepBasic_GeneralProperty), aRelatingGeneralProperty);
Handle(StepBasic_GeneralProperty) aRelatedGeneralProperty;
theData->ReadEntity(theNum, 4, "related_property", theAch, STANDARD_TYPE(StepBasic_GeneralProperty), aRelatedGeneralProperty);
// Initialize entity
theEnt->Init(aName,
hasDescription,
aDescription,
aRelatingGeneralProperty,
aRelatedGeneralProperty);
}
//=======================================================================
//function : WriteStep
//purpose :
//=======================================================================
void RWStepBasic_RWGeneralPropertyRelationship::WriteStep(StepData_StepWriter& theSW,
const Handle(StepBasic_GeneralPropertyRelationship)& theEnt) const
{
theSW.Send(theEnt->Name());
if (theEnt->HasDescription())
{
theSW.Send(theEnt->Description());
}
else
{
theSW.SendUndef();
}
theSW.Send(theEnt->RelatingGeneralProperty());
theSW.Send(theEnt->RelatedGeneralProperty());
}
//=======================================================================
//function : Share
//purpose :
//=======================================================================
void RWStepBasic_RWGeneralPropertyRelationship::Share(const Handle(StepBasic_GeneralPropertyRelationship)& theEnt,
Interface_EntityIterator& theIter) const
{
theIter.AddItem(theEnt->RelatingGeneralProperty());
theIter.AddItem(theEnt->RelatedGeneralProperty());
}