KiCad PCB EDA Suite
Loading...
Searching...
No Matches
kicad3d_info.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2025 Mark Roszko <[email protected]>
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
22
23const Standard_GUID& KICAD3D_INFO::GetID()
24{
25 static Standard_GUID ID( "D683031E-AD81-4084-B0F3-C0A474CAA93D" );
26 return ID;
27}
28
29
30Handle( KICAD3D_INFO ) KICAD3D_INFO::Set( const TDF_Label& aLabel,
31 KICAD3D_MODEL_TYPE aModelType,
32 std::string aDisplayName )
33{
35 if( !aLabel.FindAttribute( KICAD3D_INFO::GetID(), T ) )
36 {
37 T = new KICAD3D_INFO();
38 T->SetModelType( aModelType );
39 T->SetDisplayName( aDisplayName );
40 aLabel.AddAttribute( T );
41 }
42 return T;
43}
44
45
46const Standard_GUID& KICAD3D_INFO::ID() const
47{
48 return GetID();
49}
50
51
52void KICAD3D_INFO::Restore( const Handle( TDF_Attribute ) & aAttribute )
53{
54 Handle( KICAD3D_INFO ) old = Handle( KICAD3D_INFO )::DownCast( aAttribute );
55
56 m_modelType = old->m_modelType;
57 m_displayName = old->m_displayName;
58}
59
60
61Handle( TDF_Attribute ) KICAD3D_INFO::NewEmpty() const
62{
63 return new KICAD3D_INFO();
64}
65
66
67void KICAD3D_INFO::Paste( const Handle( TDF_Attribute ) & aAttribute,
68 const Handle( TDF_RelocationTable ) & aRelocationTable ) const
69{
70 Handle( KICAD3D_INFO ) that = Handle( KICAD3D_INFO )::DownCast( aAttribute );
71
72 that->m_modelType = m_modelType;
73 that->m_displayName = m_displayName;
74}
75
76
77Standard_OStream& KICAD3D_INFO::Dump( Standard_OStream& aOS ) const
78{
79 aOS << "KICAD3D_INFO" << "\n";
80 aOS << "Model Type: " << ( m_modelType == KICAD3D_MODEL_TYPE::BOARD ? "Board" : "Component" ) << "\n";
81 return aOS;
82}
83
84
86{
87}
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:372
This is an internal KiCad use attribute to add additional markup to a opencascade document for intern...
void Paste(const Handle(TDF_Attribute) &aAttribute, const Handle(TDF_RelocationTable) &aRelocationTable) const override
static KICAD3D_MODEL_TYPE std::string aDisplayName
static const Standard_GUID & GetID()
Get the GUID of this attribute.
Standard_OStream & Dump(Standard_OStream &aOS) const override
std::string m_displayName
void Restore(const Handle(TDF_Attribute) &aAttribute) override
static KICAD3D_MODEL_TYPE aModelType
static Handle(KICAD3D_INFO) Set(const TDF_Label &aLabel
Finds or creates the attribute attached to <theLabel>.
const Standard_GUID & ID() const override
KICAD3D_MODEL_TYPE m_modelType
Handle(KICAD3D_INFO) KICAD3D_INFO
KICAD3D_MODEL_TYPE