KiCad PCB EDA Suite
pcb_bright_box.cpp
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) 2017 KiCad Developers, see change_log.txt for contributors.
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 
24 #include "pcb_bright_box.h"
26 #include <class_track.h>
27 
28 using namespace KIGFX;
29 
30 const double PCB_BRIGHT_BOX::PCB_LINE_WIDTH = 100000.0;
31 
32 
34  BRIGHT_BOX()
35 {
37 }
38 
39 
40 void PCB_BRIGHT_BOX::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
41 {
42  if( !m_item )
43  return;
44 
45  if( m_item->Type() == PCB_TRACE_T )
46  {
47  const TRACK* track = static_cast<const TRACK*>( m_item );
48 
49  auto gal = aView->GetGAL();
50 
51  gal->SetIsStroke( true );
52  gal->SetIsFill( false );
53  gal->SetLineWidth( m_lineWidth );
54  gal->SetStrokeColor( m_color );
55 
56  gal->DrawSegment( track->GetStart(), track->GetEnd(), track->GetWidth() );
57  }
58  else
59  {
60  BRIGHT_BOX::ViewDraw( aLayer, aView );
61  }
62 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
void SetLineWidth(double aWidth)
Definition: bright_box.h:81
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:57
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
static const double PCB_LINE_WIDTH
const wxPoint & GetEnd() const
Definition: class_track.h:120
Functions relatives to tracks, vias and segments used to fill zones.
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
GAL * GetGAL() const
Function GetGAL() Returns the GAL this view is using to draw graphical primitives.
Definition: view.h:177
KIGFX::COLOR4D m_color
Definition: bright_box.h:97
const wxPoint & GetStart() const
Definition: class_track.h:123
void ViewDraw(int aLayer, KIGFX::VIEW *aView) const override
Function ViewDraw() Draws the parts of the object belonging to layer aLayer.
EDA_ITEM * m_item
Definition: bright_box.h:95
int GetWidth() const
Definition: class_track.h:117
Class BRIGHT_BOX.
Definition: bright_box.h:39
Class VIEW.
Definition: view.h:58
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
double m_lineWidth
Definition: bright_box.h:96