KiCad PCB EDA Suite
Loading...
Searching...
No Matches
ifsg_coordindex.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) 2015 Cirilo Bernardo <
[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
21
22
#include <iostream>
23
#include <sstream>
24
#include <wx/log.h>
25
26
#include "
plugins/3dapi/ifsg_coordindex.h
"
27
#include "
3d_cache/sg/sg_coordindex.h
"
28
29
30
extern
char
BadParent
[];
31
extern
char
WrongParent
[];
32
33
34
IFSG_COORDINDEX::IFSG_COORDINDEX
(
bool
create )
35
{
36
m_node
=
nullptr
;
37
38
if
( !create )
39
return
;
40
41
m_node
=
new
SGCOORDINDEX
(
nullptr
);
42
43
m_node
->AssociateWrapper( &
m_node
);
44
}
45
46
47
IFSG_COORDINDEX::IFSG_COORDINDEX
(
SGNODE
* aParent )
48
{
49
m_node
=
new
SGCOORDINDEX
(
nullptr
);
50
51
if
( !
m_node
->SetParent( aParent ) )
52
{
53
delete
m_node
;
54
m_node
=
nullptr
;
55
56
wxLogTrace( MASK_3D_SG, wxT(
"%s:%s:%d %s"
), __FILE__, __FUNCTION__, __LINE__,
57
WrongParent
);
58
59
return
;
60
}
61
62
m_node
->AssociateWrapper( &
m_node
);
63
}
64
65
66
IFSG_COORDINDEX::IFSG_COORDINDEX
(
IFSG_NODE
& aParent )
67
{
68
SGNODE
* pp = aParent.
GetRawPtr
();
69
70
if
( !pp )
71
{
72
wxLogTrace( MASK_3D_SG, wxT(
"%s:%s:%d %s"
), __FILE__, __FUNCTION__, __LINE__,
73
BadParent
);
74
75
return
;
76
}
77
78
m_node
=
new
SGCOORDINDEX
(
nullptr
);
79
80
if
( !
m_node
->SetParent( pp ) )
81
{
82
wxLogTrace( MASK_3D_SG, wxT(
"%s:%s:%d %s"
), __FILE__, __FUNCTION__, __LINE__,
83
WrongParent
);
84
85
delete
m_node
;
86
m_node
=
nullptr
;
87
return
;
88
}
89
90
m_node
->AssociateWrapper( &
m_node
);
91
}
92
93
94
bool
IFSG_COORDINDEX::Attach
(
SGNODE
* aNode )
95
{
96
if
(
m_node
)
97
m_node
->DisassociateWrapper( &
m_node
);
98
99
m_node
=
nullptr
;
100
101
if
( !aNode )
102
return
false
;
103
104
if
(
S3D::SGTYPE_COORDINDEX
!= aNode->
GetNodeType
() )
105
{
106
return
false
;
107
}
108
109
m_node
= aNode;
110
m_node
->AssociateWrapper( &
m_node
);
111
112
return
true
;
113
}
114
115
116
bool
IFSG_COORDINDEX::NewNode
(
SGNODE
* aParent )
117
{
118
if
(
m_node
)
119
m_node
->DisassociateWrapper( &
m_node
);
120
121
m_node
=
new
SGCOORDINDEX
( aParent );
122
123
if
( aParent !=
m_node
->GetParent() )
124
{
125
wxLogTrace( MASK_3D_SG,
126
wxT(
"%s:%s:%d * [BUG] invalid SGNODE parent (%s) to SGCOORDINDEX"
),
127
__FILE__, __FUNCTION__, __LINE__,
128
aParent->
GetNodeTypeName
( aParent->
GetNodeType
() ) );
129
130
delete
m_node
;
131
m_node
=
nullptr
;
132
return
false
;
133
}
134
135
m_node
->AssociateWrapper( &
m_node
);
136
137
return
true
;
138
}
139
140
141
bool
IFSG_COORDINDEX::NewNode
(
IFSG_NODE
& aParent )
142
{
143
SGNODE
* np = aParent.
GetRawPtr
();
144
145
wxCHECK( np,
false
);
146
147
return
NewNode
( np );
148
}
IFSG_COORDINDEX::NewNode
bool NewNode(SGNODE *aParent) override
Create a new node to associate with this wrapper.
Definition
ifsg_coordindex.cpp:116
IFSG_COORDINDEX::Attach
bool Attach(SGNODE *aNode) override
Associate a given SGNODE* with this wrapper.
Definition
ifsg_coordindex.cpp:94
IFSG_COORDINDEX::IFSG_COORDINDEX
IFSG_COORDINDEX(bool create)
Definition
ifsg_coordindex.cpp:34
IFSG_NODE::GetRawPtr
SGNODE * GetRawPtr(void) noexcept
Return the raw internal SGNODE pointer.
Definition
ifsg_node.cpp:61
IFSG_NODE::IFSG_NODE
IFSG_NODE()
Definition
ifsg_node.cpp:38
IFSG_NODE::m_node
SGNODE * m_node
Definition
ifsg_node.h:47
SGCOORDINDEX
An object to maintain a coordinate index list.
Definition
sg_coordindex.h:39
SGNODE
The base class of all Scene Graph nodes.
Definition
sg_node.h:71
SGNODE::GetNodeType
S3D::SGTYPES GetNodeType(void) const noexcept
Return the type of this node instance.
Definition
sg_node.cpp:100
SGNODE::GetNodeTypeName
const char * GetNodeTypeName(S3D::SGTYPES aNodeType) const noexcept
Definition
sg_node.cpp:160
BadParent
char BadParent[]
Definition
ifsg_node.cpp:34
WrongParent
char WrongParent[]
Definition
ifsg_node.cpp:35
ifsg_coordindex.h
defines the CoordIndex node wrapper
S3D::SGTYPE_COORDINDEX
@ SGTYPE_COORDINDEX
Definition
sg_types.h:39
sg_coordindex.h
src
3d-viewer
3d_cache
sg
ifsg_coordindex.cpp
Generated on Fri Jun 26 2026 00:05:31 for KiCad PCB EDA Suite by
1.13.2