1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0032731: Data Exchange, Step Import - Incorrect PMI text location

Added new complex Entity for representation of PMI
Added moving the presentation with new entity
This commit is contained in:
dpasukhi
2022-01-31 11:09:20 +03:00
committed by smoskvin
parent 0b6a0adb3a
commit e1f5ac2c9b
15 changed files with 535 additions and 6 deletions

View File

@@ -106,6 +106,10 @@ RWStepVisual_RWPresentationView.cxx
RWStepVisual_RWPresentationView.hxx
RWStepVisual_RWPresentedItemRepresentation.cxx
RWStepVisual_RWPresentedItemRepresentation.hxx
RWStepVisual_RWRepositionedTessellatedGeometricSet.cxx
RWStepVisual_RWRepositionedTessellatedGeometricSet.hxx
RWStepVisual_RWRepositionedTessellatedItem.cxx
RWStepVisual_RWRepositionedTessellatedItem.hxx
RWStepVisual_RWStyledItem.cxx
RWStepVisual_RWStyledItem.hxx
RWStepVisual_RWSurfaceSideStyle.cxx

View File

@@ -0,0 +1,99 @@
// Copyright (c) 2022 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 <RWStepVisual_RWRepositionedTessellatedGeometricSet.hxx>
#include <Interface_Check.hxx>
#include <Interface_EntityIterator.hxx>
#include <StepData_StepReaderData.hxx>
#include <StepData_StepWriter.hxx>
#include <StepRepr_RepresentationItem.hxx>
#include <StepVisual_HArray1OfPresentationStyleAssignment.hxx>
#include <StepVisual_PresentationStyleAssignment.hxx>
#include <StepVisual_RepositionedTessellatedGeometricSet.hxx>
#include <StepGeom_Axis2Placement3d.hxx>
//=======================================================================
//function : ReadStep
//purpose :
//=======================================================================
void RWStepVisual_RWRepositionedTessellatedGeometricSet::ReadStep
(const Handle(StepData_StepReaderData)& theData,
const Standard_Integer theNum,
Handle(Interface_Check)& theAch,
const Handle(StepVisual_RepositionedTessellatedGeometricSet)& theEnt) const
{
Standard_Integer aNum = 0;
theData->NamedForComplex("REPOSITIONED_TESSELLATED_ITEM", theNum, aNum, theAch);
if (!theData->CheckNbParams(aNum, 1, theAch, "location"))
return;
Handle(StepGeom_Axis2Placement3d) aLocation;
theData->ReadEntity(aNum,1,"location",theAch,STANDARD_TYPE(StepGeom_Axis2Placement3d), aLocation);
theData->NamedForComplex("REPRESENTATION_ITEM", theNum, aNum, theAch);
if (!theData->CheckNbParams(aNum, 1, theAch, "name"))
return;
Handle(TCollection_HAsciiString) aName;
theData->ReadString (aNum, 1, "name", theAch, aName);
theData->NamedForComplex("TESSELLATED_GEOMETRIC_SET", theNum, aNum, theAch);
NCollection_Handle<StepVisual_Array1OfTessellatedItem> anItems;
Standard_Integer aNSub2;
if (theData->ReadSubList (aNum,1,"items",theAch,aNSub2)) {
Standard_Integer aNb2 = theData->NbParams(aNSub2);
anItems = new StepVisual_Array1OfTessellatedItem(1, aNb2);
for (Standard_Integer i2 = 1; i2 <= aNb2; i2 ++) {
Handle(StepVisual_TessellatedItem) anItem;
if (theData->ReadEntity (aNSub2,i2,"item",theAch,STANDARD_TYPE(StepVisual_TessellatedItem), anItem))
anItems->SetValue(i2,anItem);
}
}
theEnt->Init(aName, anItems, aLocation);
}
//=======================================================================
//function : WriteStep
//purpose :
//=======================================================================
void RWStepVisual_RWRepositionedTessellatedGeometricSet::WriteStep
(StepData_StepWriter& theSW,
const Handle(StepVisual_RepositionedTessellatedGeometricSet)& theEnt) const
{
theSW.StartEntity("GEOMETRIC_REPRESENTATION_ITEM");
theSW.StartEntity("REPOSITIONED_TESSELLATED_ITEM");
theSW.Send(theEnt->Location());
theSW.StartEntity("REPRESENTATION_ITEM");
theSW.Send(theEnt->Name());
theSW.StartEntity("TESSELLATED_GEOMETRIC_SET");
theSW.OpenSub();
for(StepVisual_Array1OfTessellatedItem::Iterator anIter(*theEnt->Items());
anIter.More(); anIter.Next())
{
theSW.Send(anIter.Value());
}
theSW.CloseSub();
theSW.StartEntity("TESSELLATED_ITEM");
}
//=======================================================================
//function : Share
//purpose :
//=======================================================================
void RWStepVisual_RWRepositionedTessellatedGeometricSet::Share(const Handle(StepVisual_RepositionedTessellatedGeometricSet)& theEnt,
Interface_EntityIterator& theIter) const
{
// Own field : children
for (Standard_Integer i = 1; i <= theEnt->Items()->Length(); i++)
theIter.AddItem(theEnt->Items()->Value(i));
theIter.AddItem(theEnt->Location());
}

View File

@@ -0,0 +1,50 @@
// Copyright (c) 2022 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.
#ifndef _RWStepVisual_RWRepositionedTessellatedGeometricSet_HeaderFile
#define _RWStepVisual_RWRepositionedTessellatedGeometricSet_HeaderFile
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
class StepData_StepReaderData;
class Interface_Check;
class StepVisual_RepositionedTessellatedGeometricSet;
class StepData_StepWriter;
class Interface_EntityIterator;
//! Read & Write tool for complex RepositionedTessellatedGeometricSet
class RWStepVisual_RWRepositionedTessellatedGeometricSet
{
public:
DEFINE_STANDARD_ALLOC
//! Empty constructor
RWStepVisual_RWRepositionedTessellatedGeometricSet() {};
//! Reads RepositionedTessellatedGeometricSet
Standard_EXPORT void ReadStep (const Handle(StepData_StepReaderData)& theData,
const Standard_Integer theNum,
Handle(Interface_Check)& theAch,
const Handle(StepVisual_RepositionedTessellatedGeometricSet)& theEnt) const;
//! Writes RepositionedTessellatedGeometricSet
Standard_EXPORT void WriteStep (StepData_StepWriter& theSW,
const Handle(StepVisual_RepositionedTessellatedGeometricSet)& theEnt) const;
//! Fills data for graph (shared items)
Standard_EXPORT void Share (const Handle(StepVisual_RepositionedTessellatedGeometricSet)& theEnt,
Interface_EntityIterator& theIter) const;
};
#endif // _RWStepVisual_RWRepositionedTessellatedGeometricSet_HeaderFile

View File

@@ -0,0 +1,58 @@
// Copyright (c) 2022 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 <RWStepVisual_RWRepositionedTessellatedItem.hxx>
#include <Interface_Check.hxx>
#include <StepData_StepReaderData.hxx>
#include <StepData_StepWriter.hxx>
#include <StepVisual_RepositionedTessellatedItem.hxx>
#include <StepGeom_Axis2Placement3d.hxx>
//=======================================================================
//function : ReadStep
//purpose :
//=======================================================================
void RWStepVisual_RWRepositionedTessellatedItem::ReadStep
(const Handle(StepData_StepReaderData)& theData,
const Standard_Integer theNum,
Handle(Interface_Check)& theAch,
const Handle(StepVisual_RepositionedTessellatedItem)& theEnt) const
{
// --- Number of Parameter Control ---
if (!theData->CheckNbParams(theNum,2,theAch,"tessellated_item"))
return;
// --- inherited field : name ---
Handle(TCollection_HAsciiString) aName;
theData->ReadString (theNum,1,"name",theAch,aName);
// --- inherited field : location ---
Handle(StepGeom_Axis2Placement3d) aLocation;
theData->ReadEntity(theNum,2,"location", theAch, STANDARD_TYPE(StepGeom_Axis2Placement3d),aLocation);
//--- Initialisation of the read entity ---
theEnt->Init(aName, aLocation);
}
//=======================================================================
//function : WriteStep
//purpose :
//=======================================================================
void RWStepVisual_RWRepositionedTessellatedItem::WriteStep
(StepData_StepWriter& theSW,
const Handle(StepVisual_RepositionedTessellatedItem)& theEnt) const
{
// --- inherited field name ---
theSW.Send(theEnt->Name());
theSW.Send(theEnt->Location());
}

View File

@@ -0,0 +1,46 @@
// Copyright (c) 2022 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.
#ifndef _RWStepVisual_RWRepositionedTessellatedItem_HeaderFile
#define _RWStepVisual_RWRepositionedTessellatedItem_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
class StepData_StepReaderData;
class Interface_Check;
class StepVisual_RepositionedTessellatedItem;
class StepData_StepWriter;
//! Read & Write tool for RepositionedTessellatedItem
class RWStepVisual_RWRepositionedTessellatedItem
{
public:
DEFINE_STANDARD_ALLOC
//! Empty constructor
RWStepVisual_RWRepositionedTessellatedItem() {};
//! Reads RepositionedTessellatedItem
Standard_EXPORT void ReadStep (const Handle(StepData_StepReaderData)& theData,
const Standard_Integer theNum,
Handle(Interface_Check)& theAch,
const Handle(StepVisual_RepositionedTessellatedItem)& theEnt) const;
//! Writes RepositionedTessellatedItem
Standard_EXPORT void WriteStep (StepData_StepWriter& theSW,
const Handle(StepVisual_RepositionedTessellatedItem)& theEnt) const;
};
#endif // _RWStepVisual_RWRepositionedTessellatedItem_HeaderFile