KiCad PCB EDA Suite
bright_box.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) 2013 CERN
5  * @author Maciej Suminski <maciej.suminski@cern.ch>
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 
25 #ifndef __BRIGHT_BOX_H
26 #define __BRIGHT_BOX_H
27 
28 #include <math/box2.h>
29 #include <view/view.h>
30 #include <base_struct.h>
32 #include <gal/color4d.h>
33 
39 class BRIGHT_BOX : public EDA_ITEM
40 {
41 public:
42  BRIGHT_BOX();
44 
45  virtual const BOX2I ViewBBox() const override
46  {
47  if( !m_item )
48  {
49  BOX2I bb;
50  bb.SetMaximum();
51  return bb;
52  }
53 
54  return m_item->ViewBBox();
55  }
56 
57  void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override;
58 
59  void ViewGetLayers( int aLayers[], int& aCount ) const override
60  {
61  aLayers[0] = ITEM_GAL_LAYER( GP_OVERLAY );
62  aCount = 1;
63  }
64 
65 #if defined(DEBUG)
66  void Show( int x, std::ostream& st ) const override
67  {
68  }
69 #endif
70 
74  virtual wxString GetClass() const override
75  {
76  return wxT( "BRIGHT_BOX" );
77  }
78 
79  void SetItem( EDA_ITEM* aItem );
80 
81  void SetLineWidth( double aWidth )
82  {
83  m_lineWidth = aWidth;
84  }
85 
86  void SetColor( KIGFX::COLOR4D aColor )
87  {
88  m_color = aColor;
89  }
90 
91 protected:
92  static const KIGFX::COLOR4D BOX_COLOR;
93  static const double LINE_WIDTH;
94 
96  double m_lineWidth;
98 };
99 
100 #endif
virtual const BOX2I ViewBBox() const override
Definition: bright_box.h:45
void SetLineWidth(double aWidth)
Definition: bright_box.h:81
void ViewDraw(int aLayer, KIGFX::VIEW *aView) const override
Function ViewDraw() Draws the parts of the object belonging to layer aLayer.
Definition: bright_box.cpp:43
virtual wxString GetClass() const override
Get class name.
Definition: bright_box.h:74
void SetItem(EDA_ITEM *aItem)
Definition: bright_box.cpp:61
KIGFX::COLOR4D m_color
Definition: bright_box.h:97
void SetMaximum()
Definition: box2.h:61
void ViewGetLayers(int aLayers[], int &aCount) const override
Definition: bright_box.h:59
static const KIGFX::COLOR4D BOX_COLOR
Definition: bright_box.h:92
#define ITEM_GAL_LAYER(layer)
macro for obtaining layer number for specific item (eg. pad or text)
Board layer functions and definitions.
EDA_ITEM * m_item
Definition: bright_box.h:95
void SetColor(KIGFX::COLOR4D aColor)
Definition: bright_box.h:86
Class BRIGHT_BOX.
Definition: bright_box.h:39
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:151
general purpose overlay
Basic classes for most KiCad items.
Class VIEW.
Definition: view.h:58
virtual const BOX2I ViewBBox() const override
static const double LINE_WIDTH
Definition: bright_box.h:93
double m_lineWidth
Definition: bright_box.h:96
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39