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 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
24
25#ifndef SG_COORDS_H
26#define SG_COORDS_H
27
28#include <vector>
29#include "3d_cache/sg/sg_node.h"
30
31class SGFACESET;
32
36class SGCOORDS : public SGNODE
37{
38public:
39 SGCOORDS( SGNODE* aParent );
40 virtual ~SGCOORDS();
41
42 void unlinkChildNode( const SGNODE* aNode ) noexcept override;
43 void unlinkRefNode( const SGNODE* aNode ) noexcept override;
44
45 virtual bool SetParent( SGNODE* aParent, bool notify = true ) override;
46
47 SGNODE* FindNode(const char *aNodeName, const SGNODE *aCaller) noexcept override;
48 bool AddRefNode( SGNODE* aNode ) noexcept override;
49 bool AddChildNode( SGNODE* aNode ) noexcept override;
50
51 bool GetCoordsList( size_t& aListSize, SGPOINT*& aCoordsList );
52 void SetCoordsList( size_t aListSize, const SGPOINT* aCoordsList );
53 void AddCoord( double aXValue, double aYValue, double aZValue );
54 void AddCoord( const SGPOINT& aPoint );
55
60 bool CalcNormals( SGFACESET* callingNode, SGNODE** aPtr = nullptr );
61
62 void ReNameNodes( void ) override;
63 bool WriteVRML( std::ostream& aFile, bool aReuseFlag ) override;
64
65 bool WriteCache( std::ostream& aFile, SGNODE* parentNode ) override;
66 bool ReadCache( std::istream& aFile, SGNODE* parentNode ) override;
67
68 std::vector< SGPOINT > coords;
69};
70
71#endif // SG_COORDS_H
bool WriteCache(std::ostream &aFile, SGNODE *parentNode) override
Write this node's data to a binary cache file.
void unlinkChildNode(const SGNODE *aNode) noexcept override
Remove references to an owned child.
Definition sg_coords.cpp:98
void unlinkRefNode(const SGNODE *aNode) noexcept override
Remove pointers to a referenced node.
bool WriteVRML(std::ostream &aFile, bool aReuseFlag) override
Writes this node's data to a VRML file.
std::vector< SGPOINT > coords
Definition sg_coords.h:68
bool AddRefNode(SGNODE *aNode) noexcept override
void AddCoord(double aXValue, double aYValue, double aZValue)
bool ReadCache(std::istream &aFile, SGNODE *parentNode) override
Reads binary format data from a cache file.
SGCOORDS(SGNODE *aParent)
Definition sg_coords.cpp:31
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:86
virtual bool SetParent(SGNODE *aParent, bool notify=true) override
Set the parent SGNODE of this object.
Definition sg_coords.cpp:56
bool AddChildNode(SGNODE *aNode) noexcept override
bool GetCoordsList(size_t &aListSize, SGPOINT *&aCoordsList)
void ReNameNodes(void) override
Rename a node and all its child nodes in preparation for write operations.
virtual ~SGCOORDS()
Definition sg_coords.cpp:50
void SetCoordsList(size_t aListSize, const SGPOINT *aCoordsList)
bool CalcNormals(SGFACESET *callingNode, SGNODE **aPtr=nullptr)
Calculate normals for this coordinate list and sets the normals list in the parent SGFACESET.
Define an indexed face set for a scenegraph.
Definition sg_faceset.h:43
SGNODE(SGNODE *aParent)
Definition sg_node.cpp:72