KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sg_coords.h
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 <[email protected]>
5 * Copyright (C) 2020 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
29#ifndef SG_COORDS_H
30#define SG_COORDS_H
31
32#include <vector>
33#include "3d_cache/sg/sg_node.h"
34
35class SGFACESET;
36
40class SGCOORDS : public SGNODE
41{
42public:
43 SGCOORDS( SGNODE* aParent );
44 virtual ~SGCOORDS();
45
46 void unlinkChildNode( const SGNODE* aNode ) noexcept override;
47 void unlinkRefNode( const SGNODE* aNode ) noexcept override;
48
49 virtual bool SetParent( SGNODE* aParent, bool notify = true ) override;
50
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;
54
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 );
59
64 bool CalcNormals( SGFACESET* callingNode, SGNODE** aPtr = nullptr );
65
66 void ReNameNodes( void ) override;
67 bool WriteVRML( std::ostream& aFile, bool aReuseFlag ) override;
68
69 bool WriteCache( std::ostream& aFile, SGNODE* parentNode ) override;
70 bool ReadCache( std::istream& aFile, SGNODE* parentNode ) override;
71
72 std::vector< SGPOINT > coords;
73};
74
75#endif // SG_COORDS_H
Define a vertex coordinate set for a scenegraph object.
Definition: sg_coords.h:41
bool WriteCache(std::ostream &aFile, SGNODE *parentNode) override
Write this node's data to a binary cache file.
Definition: sg_coords.cpp:241
void unlinkChildNode(const SGNODE *aNode) noexcept override
Remove references to an owned child.
Definition: sg_coords.cpp:102
void unlinkRefNode(const SGNODE *aNode) noexcept override
Remove pointers to a referenced node.
Definition: sg_coords.cpp:108
bool WriteVRML(std::ostream &aFile, bool aReuseFlag) override
Writes this node's data to a VRML file.
Definition: sg_coords.cpp:179
std::vector< SGPOINT > coords
Definition: sg_coords.h:72
bool AddRefNode(SGNODE *aNode) noexcept override
Definition: sg_coords.cpp:114
void AddCoord(double aXValue, double aYValue, double aZValue)
Definition: sg_coords.cpp:157
bool ReadCache(std::istream &aFile, SGNODE *parentNode) override
Reads binary format data from a cache file.
Definition: sg_coords.cpp:286
SGNODE * FindNode(const char *aNodeName, const SGNODE *aCaller) noexcept override
Search the tree of linked nodes and return a reference to the first node found with the given name.
Definition: sg_coords.cpp:90
virtual bool SetParent(SGNODE *aParent, bool notify=true) override
Set the parent SGNODE of this object.
Definition: sg_coords.cpp:60
bool AddChildNode(SGNODE *aNode) noexcept override
Definition: sg_coords.cpp:122
bool GetCoordsList(size_t &aListSize, SGPOINT *&aCoordsList)
Definition: sg_coords.cpp:130
void ReNameNodes(void) override
Rename a node and all its child nodes in preparation for write operations.
Definition: sg_coords.cpp:169
virtual ~SGCOORDS()
Definition: sg_coords.cpp:54
void SetCoordsList(size_t aListSize, const SGPOINT *aCoordsList)
Definition: sg_coords.cpp:145
bool CalcNormals(SGFACESET *callingNode, SGNODE **aPtr=nullptr)
Calculate normals for this coordinate list and sets the normals list in the parent SGFACESET.
Definition: sg_coords.cpp:309
Define an indexed face set for a scenegraph.
Definition: sg_faceset.h:47
The base class of all Scene Graph nodes.
Definition: sg_node.h:75