KiCad PCB EDA Suite
ifsg_index.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 <cirilo.bernardo@gmail.com>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
24 
25 #include <iostream>
26 #include <sstream>
27 #include <wx/log.h>
28 
31 
32 
33 extern char BadObject[];
34 extern char BadOperand[];
35 extern char BadParent[];
36 extern char WrongParent[];
37 
38 
40 {
41  return;
42 }
43 
44 
45 bool IFSG_INDEX::GetIndices( size_t& nIndices, int*& aIndexList )
46 {
47  if( NULL == m_node )
48  {
49  #ifdef DEBUG
50  std::ostringstream ostr;
51  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
52  ostr << BadObject;
53  wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
54  #endif
55 
56  return false;
57  }
58 
59  return ((SGINDEX*)m_node)->GetIndices( nIndices, aIndexList );
60 }
61 
62 
63 bool IFSG_INDEX::SetIndices( size_t nIndices, int* aIndexList )
64 {
65  if( NULL == m_node )
66  {
67  #ifdef DEBUG
68  std::ostringstream ostr;
69  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
70  ostr << BadObject;
71  wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
72  #endif
73 
74  return false;
75  }
76 
77  ((SGINDEX*)m_node)->SetIndices( nIndices, aIndexList );
78 
79  return true;
80 }
81 
82 
83 bool IFSG_INDEX::AddIndex( int aIndex )
84 {
85  if( NULL == m_node )
86  {
87  #ifdef DEBUG
88  std::ostringstream ostr;
89  ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
90  ostr << BadObject;
91  wxLogTrace( MASK_3D_SG, "%s\n", ostr.str().c_str() );
92  #endif
93 
94  return false;
95  }
96 
97  ((SGINDEX*)m_node)->AddIndex( aIndex );
98 
99  return true;
100 }
char BadOperand[]
Definition: ifsg_node.cpp:35
char BadParent[]
Definition: ifsg_node.cpp:36
defines the index nodes wrapper
SGNODE * m_node
Definition: ifsg_node.h:57
Class IFSG_NODE represents the base class of all DLL-safe Scene Graph nodes.
Definition: ifsg_node.h:54
bool AddIndex(int aIndex)
Function AddIndex adds a single index to the list.
Definition: ifsg_index.cpp:83
char WrongParent[]
Definition: ifsg_node.cpp:37
defines an coordinate index set for a scenegraph object
bool SetIndices(size_t nIndices, int *aIndexList)
Function SetIndices sets the number of indices and creates a copy of the given index data...
Definition: ifsg_index.cpp:63
char BadObject[]
Definition: ifsg_node.cpp:34
bool GetIndices(size_t &nIndices, int *&aIndexList)
Definition: ifsg_index.cpp:45