KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sg_colors.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_COLORS_H
30#define SG_COLORS_H
31
32#include <vector>
33#include "3d_cache/sg/sg_node.h"
34
38class SGCOLORS : public SGNODE
39{
40public:
41 SGCOLORS( SGNODE* aParent );
42 virtual ~SGCOLORS();
43
44 virtual bool SetParent( SGNODE* aParent, bool notify = true ) override;
45
46 void unlinkChildNode( const SGNODE* aNode ) noexcept override;
47 void unlinkRefNode( const SGNODE* aNode ) noexcept override;
48
49 SGNODE* FindNode(const char *aNodeName, const SGNODE *aCaller) noexcept override;
50 bool AddRefNode( SGNODE* aNode ) noexcept override;
51 bool AddChildNode( SGNODE* aNode ) noexcept override;
52
53 bool GetColorList( size_t& aListSize, SGCOLOR*& aColorList );
54 void SetColorList( size_t aListSize, const SGCOLOR* aColorList );
55 void AddColor( double aRedValue, double aGreenValue, double aBlueValue );
56 void AddColor( const SGCOLOR& aColor );
57
58 void ReNameNodes( void ) override;
59 bool WriteVRML( std::ostream& aFile, bool aReuseFlag ) override;
60
61 bool WriteCache( std::ostream& aFile, SGNODE* parentNode ) override;
62 bool ReadCache( std::istream& aFile, SGNODE* parentNode ) override;
63
64 std::vector< SGCOLOR > colors;
65};
66
67#endif // SG_COLORS_H
Define an RGB color set for a scenegraph object.
Definition: sg_colors.h:39
virtual ~SGCOLORS()
Definition: sg_colors.cpp:52
void unlinkChildNode(const SGNODE *aNode) noexcept override
Remove references to an owned child.
Definition: sg_colors.cpp:100
bool WriteCache(std::ostream &aFile, SGNODE *parentNode) override
Write this node's data to a binary cache file.
Definition: sg_colors.cpp:239
bool ReadCache(std::istream &aFile, SGNODE *parentNode) override
Reads binary format data from a cache file.
Definition: sg_colors.cpp:284
bool AddChildNode(SGNODE *aNode) noexcept override
Definition: sg_colors.cpp:120
bool AddRefNode(SGNODE *aNode) noexcept override
Definition: sg_colors.cpp:112
virtual bool SetParent(SGNODE *aParent, bool notify=true) override
Set the parent SGNODE of this object.
Definition: sg_colors.cpp:58
void unlinkRefNode(const SGNODE *aNode) noexcept override
Remove pointers to a referenced node.
Definition: sg_colors.cpp:106
bool WriteVRML(std::ostream &aFile, bool aReuseFlag) override
Writes this node's data to a VRML file.
Definition: sg_colors.cpp:181
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_colors.cpp:88
void AddColor(double aRedValue, double aGreenValue, double aBlueValue)
Definition: sg_colors.cpp:157
void SetColorList(size_t aListSize, const SGCOLOR *aColorList)
Definition: sg_colors.cpp:143
std::vector< SGCOLOR > colors
Definition: sg_colors.h:64
bool GetColorList(size_t &aListSize, SGCOLOR *&aColorList)
Definition: sg_colors.cpp:128
void ReNameNodes(void) override
Rename a node and all its child nodes in preparation for write operations.
Definition: sg_colors.cpp:171
The base class of all Scene Graph nodes.
Definition: sg_node.h:75