KiCad PCB EDA Suite
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-2017 Cirilo Bernardo <>
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
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  *
19  * or you may search the 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  */
29 #ifndef SG_COORDS_H
30 #define SG_COORDS_H
32 #include <vector>
33 #include "3d_cache/sg/sg_node.h"
35 class SGFACESET;
37 class SGCOORDS : public SGNODE
38 {
39 public:
40  std::vector< SGPOINT > coords;
42  void unlinkChildNode( const SGNODE* aNode ) noexcept override;
43  void unlinkRefNode( const SGNODE* aNode ) noexcept override;
45 public:
46  SGCOORDS( SGNODE* aParent );
47  virtual ~SGCOORDS();
49  virtual bool SetParent( SGNODE* aParent, bool notify = true ) override;
51  SGNODE* FindNode(const char *aNodeName, const SGNODE *aCaller) noexcept override;
52  bool AddRefNode( SGNODE* aNode ) noexcept override;
53  bool AddChildNode( SGNODE* aNode ) noexcept override;
55  bool GetCoordsList( size_t& aListSize, SGPOINT*& aCoordsList );
56  void SetCoordsList( size_t aListSize, const SGPOINT* aCoordsList );
57  void AddCoord( double aXValue, double aYValue, double aZValue );
58  void AddCoord( const SGPOINT& aPoint );
65  bool CalcNormals( SGFACESET* callingNode, SGNODE** aPtr = NULL );
67  void ReNameNodes( void ) override;
68  bool WriteVRML( std::ostream& aFile, bool aReuseFlag ) override;
70  bool WriteCache( std::ostream& aFile, SGNODE* parentNode ) override;
71  bool ReadCache( std::istream& aFile, SGNODE* parentNode ) override;
72 };
74 #endif // SG_COORDS_H
void unlinkRefNode(const SGNODE *aNode) noexcept override
Function unlinkRef removes pointers to a referenced node; it is invoked by the referenced node upon d...
Definition: sg_coords.cpp:121
void SetCoordsList(size_t aListSize, const SGPOINT *aCoordsList)
Definition: sg_coords.cpp:175
void ReNameNodes(void) override
Function ReNameNodes renames a node and all its child nodes in preparation for Write() operations.
Definition: sg_coords.cpp:203
virtual ~SGCOORDS()
Definition: sg_coords.cpp:59
Definition: sg_coords.cpp:34
bool WriteVRML(std::ostream &aFile, bool aReuseFlag) override
Function WriteVRML writes this node's data to a VRML file; this includes all data of child and refere...
Definition: sg_coords.cpp:213
SGNODE * FindNode(const char *aNodeName, const SGNODE *aCaller) noexcept override
Function FindNode searches the tree of linked nodes and returns a reference to the first node found w...
Definition: sg_coords.cpp:96
bool ReadCache(std::istream &aFile, SGNODE *parentNode) override
Function ReadCache Reads binary format data from a cache file.
Definition: sg_coords.cpp:344
defines the base class of the intermediate scene graph NODE
bool GetCoordsList(size_t &aListSize, SGPOINT *&aCoordsList)
Definition: sg_coords.cpp:160
SGNODE represents the base class of all Scene Graph nodes.
Definition: sg_node.h:76
#define NULL
void unlinkChildNode(const SGNODE *aNode) noexcept override
Function unlinkChild removes references to an owned child; it is invoked by the child upon destructio...
Definition: sg_coords.cpp:108
virtual bool SetParent(SGNODE *aParent, bool notify=true) override
Function SetParent sets the parent SGNODE of this object.
Definition: sg_coords.cpp:66
bool AddRefNode(SGNODE *aNode) noexcept override
Definition: sg_coords.cpp:134
bool AddChildNode(SGNODE *aNode) noexcept override
Definition: sg_coords.cpp:147
std::vector< SGPOINT > coords
Definition: sg_coords.h:40
bool CalcNormals(SGFACESET *callingNode, SGNODE **aPtr=NULL)
Function CalcNormals calculates normals for this coordinate list and sets the normals list in the par...
Definition: sg_coords.cpp:377
void AddCoord(double aXValue, double aYValue, double aZValue)
Definition: sg_coords.cpp:189
bool WriteCache(std::ostream &aFile, SGNODE *parentNode) override
Function WriteCache write's this node's data to a binary cache file; the data includes all data of ch...
Definition: sg_coords.cpp:275