Loading files
// Created by: CKY / Contract Toubro-Larsen
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 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 <IGESData_DirChecker.hxx>
#include <IGESData_Dump.hxx>
#include <IGESData_IGESDumper.hxx>
#include <IGESData_IGESReaderData.hxx>
#include <IGESData_IGESWriter.hxx>
#include <IGESData_ParamReader.hxx>
#include <IGESDraw_NetworkSubfigureDef.hxx>
#include <IGESDraw_ToolNetworkSubfigureDef.hxx>
#include <IGESGraph_TextDisplayTemplate.hxx>
#include <Interface_Check.hxx>
#include <Interface_CopyTool.hxx>
#include <Interface_EntityIterator.hxx>
#include <MoniTool_Macros.hxx>
#include <Interface_ShareTool.hxx>
#include <Message_Messenger.hxx>
#include <TCollection_HAsciiString.hxx>
IGESDraw_ToolNetworkSubfigureDef::IGESDraw_ToolNetworkSubfigureDef() = default;
void IGESDraw_ToolNetworkSubfigureDef::ReadOwnParams(
const occ::handle<IGESDraw_NetworkSubfigureDef>& ent,
const occ::handle<IGESData_IGESReaderData>& IR,
IGESData_ParamReader& PR) const
{
// bool st; //szv#4:S4163:12Mar99 not needed
int tempDepth, tempNbEntities1, tempTypeFlag, tempNbEntities2;
occ::handle<TCollection_HAsciiString> tempName, tempDesignator;
occ::handle<IGESGraph_TextDisplayTemplate> tempTemplate;
occ::handle<NCollection_HArray1<occ::handle<IGESData_IGESEntity>>> tempEntities;
occ::handle<NCollection_HArray1<occ::handle<IGESDraw_ConnectPoint>>> tempPointEntities;
// szv#4:S4163:12Mar99 `st=` not needed
PR.ReadInteger(PR.Current(), "Depth Of Subfigure", tempDepth);
PR.ReadText(PR.Current(), "Subfigure Name", tempName);
// st = PR.ReadInteger(PR.Current(), "Number Of Child Entities", tempNbEntities1);
// //szv#4:S4163:12Mar99 moved in if
if (PR.ReadInteger(PR.Current(), "Number Of Child Entities", tempNbEntities1))
{
// Initialize HArray1 only if there is no error reading its Length
if (tempNbEntities1 < 0)
{
PR.AddFail("Number Of Child Entities : Not Positive");
}
else if (tempNbEntities1 > 0)
{
// clang-format off
PR.ReadEnts(IR,PR.CurrentList(tempNbEntities1),"Child Entities",tempEntities); //szv#4:S4163:12Mar99 `st=` not needed
}
// tempEntities = new NCollection_HArray1<occ::handle<IGESData_IGESEntity>> (1,tempNbEntities1);
// clang-format on
}
// Read the HArray1 only if its Length was read without any Error
/*
if (! tempEntities.IsNull()) {
occ::handle<IGESData_IGESEntity> tempEntity1;
int I;
for (I = 1; I <= tempNbEntities1; I++) {
st = PR.ReadEntity(IR, PR.Current(), "Associated Entity",
tempEntity1);
if (st) tempEntities->SetValue(I, tempEntity1);
}
}
*/
PR.ReadInteger(PR.Current(), "Type Flag", tempTypeFlag); // szv#4:S4163:12Mar99 `st=` not needed
if (PR.DefinedElseSkip())
{
// clang-format off
PR.ReadText(PR.Current(), "Primary Reference Designator", tempDesignator); //szv#4:S4163:12Mar99 `st=` not needed
// clang-format on
}
else
{
PR.AddWarning("Primary Reference Designator : Null");
}
bool st = PR.ReadEntity(IR,
PR.Current(),
"Primary Reference Designator",
STANDARD_TYPE(IGESGraph_TextDisplayTemplate),
tempTemplate,
true);
if (PR.DefinedElseSkip())
{
st = PR.ReadInteger(PR.Current(), "Number Of Connect Points", tempNbEntities2);
}
else
{
tempNbEntities2 = 0;
}
if (st)
{
// Initialise HArray1 only if there is no error reading its Length
if (tempNbEntities2 < 0)
{
PR.AddFail("Number Of Connect Points : Less Than Zero");
}
else if (tempNbEntities2 > 0)
{
tempPointEntities =
new NCollection_HArray1<occ::handle<IGESDraw_ConnectPoint>>(1, tempNbEntities2);
}
}
// Read the HArray1 only if its Length was read without any Error
if (!tempPointEntities.IsNull())
{
occ::handle<IGESDraw_ConnectPoint> tempConnectPoint;
int I;
for (I = 1; I <= tempNbEntities2; I++)
{
// st = PR.ReadEntity(IR, PR.Current(),"Associated Connect Point Entity",
// STANDARD_TYPE(IGESDraw_ConnectPoint), tempConnectPoint,
// true); //szv#4:S4163:12Mar99 moved in if
if (PR.ReadEntity(IR,
PR.Current(),
"Associated Connect Point Entity",
STANDARD_TYPE(IGESDraw_ConnectPoint),
tempConnectPoint,
true))
{
tempPointEntities->SetValue(I, tempConnectPoint);
}
}
}
DirChecker(ent).CheckTypeAndForm(PR.CCheck(), ent);
ent->Init(tempDepth,
tempName,
tempEntities,
tempTypeFlag,
tempDesignator,
tempTemplate,
tempPointEntities);
}
void IGESDraw_ToolNetworkSubfigureDef::WriteOwnParams(
const occ::handle<IGESDraw_NetworkSubfigureDef>& ent,
IGESData_IGESWriter& IW) const
{
int up = ent->NbEntities();
IW.Send(ent->Depth());
IW.Send(ent->Name());
IW.Send(up);
int I;
for (I = 1; I <= up; I++)
{
IW.Send(ent->Entity(I));
}
IW.Send(ent->TypeFlag());
IW.Send(ent->Designator());
IW.Send(ent->DesignatorTemplate());
up = ent->NbPointEntities();
IW.Send(up);
for (I = 1; I <= up; I++)
{
IW.Send(ent->PointEntity(I));
}
}
void IGESDraw_ToolNetworkSubfigureDef::OwnShared(
const occ::handle<IGESDraw_NetworkSubfigureDef>& ent,
Interface_EntityIterator& iter) const
{
int I;
int up = ent->NbEntities();
for (I = 1; I <= up; I++)
{
iter.GetOneItem(ent->Entity(I));
}
up = ent->NbPointEntities();
for (I = 1; I <= up; I++)
{
iter.GetOneItem(ent->PointEntity(I));
}
}
void IGESDraw_ToolNetworkSubfigureDef::OwnCopy(
const occ::handle<IGESDraw_NetworkSubfigureDef>& another,
const occ::handle<IGESDraw_NetworkSubfigureDef>& ent,
Interface_CopyTool& TC) const
{
int tempDepth = another->Depth();
occ::handle<TCollection_HAsciiString> tempName = new TCollection_HAsciiString(another->Name());
occ::handle<NCollection_HArray1<occ::handle<IGESData_IGESEntity>>> tempEntities;
int up = another->NbEntities();
if (up > 0)
{
tempEntities = new NCollection_HArray1<occ::handle<IGESData_IGESEntity>>(1, up);
}
int I;
for (I = 1; I <= up; I++)
{
DeclareAndCast(IGESData_IGESEntity, tempEntity, TC.Transferred(another->Entity(I)));
tempEntities->SetValue(I, tempEntity);
}
int tempTypeFlag = another->TypeFlag();
occ::handle<TCollection_HAsciiString> tempDesignator;
if (!another->Designator().IsNull())
{
tempDesignator = new TCollection_HAsciiString(another->Designator());
}
up = another->NbPointEntities();
occ::handle<NCollection_HArray1<occ::handle<IGESDraw_ConnectPoint>>> tempPointEntities;
if (up > 0)
{
tempPointEntities = new NCollection_HArray1<occ::handle<IGESDraw_ConnectPoint>>(1, up);
}
for (I = 1; I <= up; I++)
{
if (another->HasPointEntity(I))
{
DeclareAndCast(IGESDraw_ConnectPoint,
tempPointEntity,
TC.Transferred(another->PointEntity(I)));
tempPointEntities->SetValue(I, tempPointEntity);
}
}
if (another->HasDesignatorTemplate())
{
DeclareAndCast(IGESGraph_TextDisplayTemplate,
tempDesignatorTemplate,
TC.Transferred(another->DesignatorTemplate()));
ent->Init(tempDepth,
tempName,
tempEntities,
tempTypeFlag,
tempDesignator,
tempDesignatorTemplate,
tempPointEntities);
}
else
{
occ::handle<IGESGraph_TextDisplayTemplate> tempDesignatorTemplate;
ent->Init(tempDepth,
tempName,
tempEntities,
tempTypeFlag,
tempDesignator,
tempDesignatorTemplate,
tempPointEntities);
}
}
IGESData_DirChecker IGESDraw_ToolNetworkSubfigureDef::DirChecker(
const occ::handle<IGESDraw_NetworkSubfigureDef>& /*ent*/) const
{
IGESData_DirChecker DC(320, 0);
DC.Structure(IGESData_DefVoid);
DC.LineFont(IGESData_DefAny);
DC.LineWeight(IGESData_DefValue);
DC.BlankStatusIgnored();
DC.UseFlagRequired(2);
DC.GraphicsIgnored(1);
return DC;
}
void IGESDraw_ToolNetworkSubfigureDef::OwnCheck(
const occ::handle<IGESDraw_NetworkSubfigureDef>& ent,
const Interface_ShareTool&,
occ::handle<Interface_Check>& ach) const
{
if ((ent->TypeFlag() < 0) || (ent->TypeFlag() > 2))
{
ach->AddFail("TypeFlag has Invalid value");
}
if (ent->Designator().IsNull())
{
ach->AddFail("Primary Reference Designator : not defined");
}
}
void IGESDraw_ToolNetworkSubfigureDef::OwnDump(const occ::handle<IGESDraw_NetworkSubfigureDef>& ent,
const IGESData_IGESDumper& dumper,
Standard_OStream& S,
const int level) const
{
int tempSubLevel = (level <= 4) ? 0 : 1;
S << "IGESDraw_NetworkSubfigureDef\n"
<< "Depth Of Subfigure(Nesting) : " << ent->Depth() << "\n"
<< "Name Of Subfigure : ";
IGESData_DumpString(S, ent->Name());
S << "\nAssociated Entities : ";
IGESData_DumpEntities(S, dumper, level, 1, ent->NbEntities(), ent->Entity);
S << "\nType Flag : " << ent->TypeFlag() << "\n"
<< "Primary Reference Designator : ";
IGESData_DumpString(S, ent->Designator());
S << "\nText Display Template Entity : ";
dumper.Dump(ent->DesignatorTemplate(), S, tempSubLevel);
S << "\nConnect Point Entities : ";
IGESData_DumpEntities(S, dumper, level, 1, ent->NbPointEntities(), ent->PointEntity);
S << '\n';
}
f2929057eThis file is pinned to the selected release. Download the original to open it in your design tool.