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, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
26
27const Standard_GUID& KICAD3D_INFO::GetID()
28{
29 static Standard_GUID ID( "D683031E-AD81-4084-B0F3-C0A474CAA93D" );
30 return ID;
31}
32
33
34Handle( KICAD3D_INFO ) KICAD3D_INFO::Set( const TDF_Label& aLabel,
35 KICAD3D_MODEL_TYPE aModelType,
36 std::string aDisplayName )
37{
39 if( !aLabel.FindAttribute( KICAD3D_INFO::GetID(), T ) )
40 {
41 T = new KICAD3D_INFO();
42 T->SetModelType( aModelType );
43 T->SetDisplayName( aDisplayName );
44 aLabel.AddAttribute( T );
45 }
46 return T;
47}
48
49
50const Standard_GUID& KICAD3D_INFO::ID() const
51{
52 return GetID();
53}
54
55
56void KICAD3D_INFO::Restore( const Handle( TDF_Attribute ) & aAttribute )
57{
58 Handle( KICAD3D_INFO ) old = Handle( KICAD3D_INFO )::DownCast( aAttribute );
59
60 m_modelType = old->m_modelType;
61 m_displayName = old->m_displayName;
62}
63
64
65Handle( TDF_Attribute ) KICAD3D_INFO::NewEmpty() const
66{
67 return new KICAD3D_INFO();
68}
69
70
71void KICAD3D_INFO::Paste( const Handle( TDF_Attribute ) & aAttribute,
72 const Handle( TDF_RelocationTable ) & aRelocationTable ) const
73{
74 Handle( KICAD3D_INFO ) that = Handle( KICAD3D_INFO )::DownCast( aAttribute );
75
76 that->m_modelType = m_modelType;
77 that->m_displayName = m_displayName;
78}
79
80
81Standard_OStream& KICAD3D_INFO::Dump( Standard_OStream& aOS ) const
82{
83 aOS << "KICAD3D_INFO" << "\n";
84 aOS << "Model Type: " << ( m_modelType == KICAD3D_MODEL_TYPE::BOARD ? "Board" : "Component" ) << "\n";
85 return aOS;
86}
87
88
90{
91}
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:317
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