KiCad PCB EDA Suite
sg_base.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 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 
30 #ifndef SG_BASE_H
31 #define SG_BASE_H
32 
34 
35 #ifndef SGLIB_API
36  #if defined (COMPILE_SGLIB)
37  #define SGLIB_API APIEXPORT
38  #else
39  #define SGLIB_API APIIMPORT
40  #endif
41 #endif
42 
44 {
45 protected:
46  float red;
47  float green;
48  float blue;
49 
50 public:
51  SGCOLOR();
52  SGCOLOR( float aRVal, float aGVal, float aBVal );
53 
54  void GetColor( float& aRedVal, float& aGreenVal, float& aBlueVal ) const;
55  void GetColor( SGCOLOR& aColor ) const;
56  void GetColor( SGCOLOR* aColor ) const;
57 
58  bool SetColor( float aRedVal, float aGreenVal, float aBlueVal );
59  bool SetColor( const SGCOLOR& aColor );
60  bool SetColor( const SGCOLOR* aColor );
61 
62 private:
63  bool checkRange( float aRedVal, float aGreenVal, float aBlueVal ) const;
64 };
65 
66 
68 {
69 public:
70  double x;
71  double y;
72  double z;
73 
74 public:
75  SGPOINT();
76  SGPOINT( double aXVal, double aYVal, double aZVal );
77 
78  void GetPoint( double& aXVal, double& aYVal, double& aZVal );
79  void GetPoint( SGPOINT& aPoint );
80  void GetPoint( SGPOINT* aPoint );
81 
82  void SetPoint( double aXVal, double aYVal, double aZVal );
83  void SetPoint( const SGPOINT& aPoint );
84 };
85 
86 
88 {
89 private:
90  void normalize( void );
91 
92  double vx;
93  double vy;
94  double vz;
95 
96 public:
97  SGVECTOR();
98  SGVECTOR( double aXVal, double aYVal, double aZVal );
99 
100  void GetVector( double& aXVal, double& aYVal, double& aZVal ) const;
101 
102  void SetVector( double aXVal, double aYVal, double aZVal );
103  void SetVector( const SGVECTOR& aVector );
104 
105  SGVECTOR& operator=( const SGVECTOR& source );
106 };
107 
108 
109 #endif // SG_BASE_H
float blue
Definition: sg_base.h:48
double x
Definition: sg_base.h:70
float red
Definition: sg_base.h:46
double y
Definition: sg_base.h:71
double vz
Definition: sg_base.h:94
double vx
Definition: sg_base.h:92
#define SGLIB_API
Definition: ifsg_defs.h:56
double z
Definition: sg_base.h:72
double vy
Definition: sg_base.h:93
float green
Definition: sg_base.h:47