KiCad PCB EDA Suite
KIGFX::PCB_PAINTER Class Reference

Contains methods for drawing PCB-specific items. More...

#include <pcb_painter.h>

Inheritance diagram for KIGFX::PCB_PAINTER:
KIGFX::PAINTER KIGFX::PCB_PRINT_PAINTER

Public Member Functions

 PCB_PAINTER (GAL *aGal)
 
virtual PCB_RENDER_SETTINGSGetSettings () override
 Return a pointer to current settings that are going to be used when drawing items. More...
 
virtual bool Draw (const VIEW_ITEM *aItem, int aLayer) override
 Takes an instance of VIEW_ITEM and passes it to a function that knows how to draw the item. More...
 
void SetGAL (GAL *aGal)
 Changes Graphics Abstraction Layer used for drawing items for a new one. More...
 

Protected Member Functions

void draw (const PCB_TRACK *aTrack, int aLayer)
 
void draw (const PCB_ARC *aArc, int aLayer)
 
void draw (const PCB_VIA *aVia, int aLayer)
 
void draw (const PAD *aPad, int aLayer)
 
void draw (const PCB_SHAPE *aSegment, int aLayer)
 
void draw (const PCB_TEXT *aText, int aLayer)
 
void draw (const FP_TEXT *aText, int aLayer)
 
void draw (const FOOTPRINT *aFootprint, int aLayer)
 
void draw (const PCB_GROUP *aGroup, int aLayer)
 
void draw (const ZONE *aZone, int aLayer)
 
void draw (const PCB_DIMENSION_BASE *aDimension, int aLayer)
 
void draw (const PCB_TARGET *aTarget)
 
void draw (const PCB_MARKER *aMarker, int aLayer)
 
int getLineThickness (int aActualThickness) const
 Get the thickness to draw for a line (e.g. More...
 
virtual int getDrillShape (const PAD *aPad) const
 Return drill shape of a pad. More...
 
virtual VECTOR2D getDrillSize (const PAD *aPad) const
 Return drill size for a pad (internal units). More...
 
virtual int getDrillSize (const PCB_VIA *aVia) const
 Return drill diameter for a via (internal units). More...
 

Protected Attributes

PCB_RENDER_SETTINGS m_pcbSettings
 
int m_maxError
 
int m_holePlatingThickness
 
GALm_gal
 Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg. More...
 

Detailed Description

Contains methods for drawing PCB-specific items.

Definition at line 241 of file pcb_painter.h.

Constructor & Destructor Documentation

◆ PCB_PAINTER()

PCB_PAINTER::PCB_PAINTER ( GAL aGal)

Definition at line 423 of file pcb_painter.cpp.

423  :
424  PAINTER( aGal ),
425  m_maxError( ARC_HIGH_DEF ),
427 {
428 }
PAINTER(GAL *aGal)
Initialize this object for painting on any of the polymorphic GRAPHICS_ABSTRACTION_LAYER* derivatives...
Definition: painter.cpp:32

Member Function Documentation

◆ Draw()

bool PCB_PAINTER::Draw ( const VIEW_ITEM aItem,
int  aLayer 
)
overridevirtual

Takes an instance of VIEW_ITEM and passes it to a function that knows how to draw the item.

Parameters
aItemis an item to be drawn.
aLayertells which layer is currently rendered so that draw functions may know what to draw (eg. for pads there are separate layers for holes, because they have other dimensions then the pad itself.

Implements KIGFX::PAINTER.

Definition at line 461 of file pcb_painter.cpp.

462 {
463  const BOARD_ITEM* item = dynamic_cast<const BOARD_ITEM*>( aItem );
464 
465  if( !item )
466  return false;
467 
468  if( const BOARD* board = item->GetBoard() )
469  {
470  BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
471  m_maxError = bds.m_MaxError;
473  }
474  else
475  {
476  m_maxError = ARC_HIGH_DEF;
478  }
479 
480  // the "cast" applied in here clarifies which overloaded draw() is called
481  switch( item->Type() )
482  {
483  case PCB_TRACE_T:
484  draw( static_cast<const PCB_TRACK*>( item ), aLayer );
485  break;
486 
487  case PCB_ARC_T:
488  draw( static_cast<const PCB_ARC*>( item ), aLayer );
489  break;
490 
491  case PCB_VIA_T:
492  draw( static_cast<const PCB_VIA*>( item ), aLayer );
493  break;
494 
495  case PCB_PAD_T:
496  draw( static_cast<const PAD*>( item ), aLayer );
497  break;
498 
499  case PCB_SHAPE_T:
500  case PCB_FP_SHAPE_T:
501  draw( static_cast<const PCB_SHAPE*>( item ), aLayer );
502  break;
503 
504  case PCB_TEXT_T:
505  draw( static_cast<const PCB_TEXT*>( item ), aLayer );
506  break;
507 
508  case PCB_FP_TEXT_T:
509  draw( static_cast<const FP_TEXT*>( item ), aLayer );
510  break;
511 
512  case PCB_FOOTPRINT_T:
513  draw( static_cast<const FOOTPRINT*>( item ), aLayer );
514  break;
515 
516  case PCB_GROUP_T:
517  draw( static_cast<const PCB_GROUP*>( item ), aLayer );
518  break;
519 
520  case PCB_ZONE_T:
521  draw( static_cast<const ZONE*>( item ), aLayer );
522  break;
523 
524  case PCB_FP_ZONE_T:
525  draw( static_cast<const ZONE*>( item ), aLayer );
526  break;
527 
528  case PCB_DIM_ALIGNED_T:
529  case PCB_DIM_CENTER_T:
531  case PCB_DIM_LEADER_T:
532  draw( static_cast<const PCB_DIMENSION_BASE*>( item ), aLayer );
533  break;
534 
535  case PCB_TARGET_T:
536  draw( static_cast<const PCB_TARGET*>( item ) );
537  break;
538 
539  case PCB_MARKER_T:
540  draw( static_cast<const PCB_MARKER*>( item ), aLayer );
541  break;
542 
543  default:
544  // Painter does not know how to draw the object
545  return false;
546  }
547 
548  // Draw bounding boxes after drawing objects so they can be seen.
549  if( ADVANCED_CFG::GetCfg().m_DrawBoundingBoxes )
550  {
551  // Show bounding boxes of painted objects for debugging.
552  EDA_RECT box = item->GetBoundingBox();
553  m_gal->SetIsFill( false );
554  m_gal->SetIsStroke( true );
555 
556  if( item->Type() == PCB_FOOTPRINT_T )
557  m_gal->SetStrokeColor( item->IsSelected() ? COLOR4D( 1.0, 0.2, 0.2, 1 ) :
558  COLOR4D( MAGENTA ) );
559  else
560  m_gal->SetStrokeColor( item->IsSelected() ? COLOR4D( 1.0, 0.2, 0.2, 1 ) :
561  COLOR4D( 0.2, 0.2, 0.2, 1 ) );
562 
563  m_gal->SetLineWidth( 1.5 / m_gal->GetWorldScale() );
564  m_gal->DrawRectangle( box.GetOrigin(), box.GetEnd() );
565 
566  if( item->Type() == PCB_FOOTPRINT_T )
567  {
568  m_gal->SetStrokeColor( item->IsSelected() ? COLOR4D( 1.0, 0.2, 0.2, 1 ) :
569  COLOR4D( CYAN ) );
570 
571  const FOOTPRINT* fp = static_cast<const FOOTPRINT*>( item );
572 
573  if( fp )
574  {
575  SHAPE_POLY_SET convex = fp->GetBoundingHull();
576 
577  m_gal->DrawPolyline( convex.COutline( 0 ) );
578  }
579  }
580  }
581 
582  return true;
583 }
virtual void DrawPolyline(const std::deque< VECTOR2D > &aPointList)
Draw a polyline.
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
SHAPE_POLY_SET GetBoundingHull() const
Return a bounding polygon for the shapes and pads in the footprint.
Definition: footprint.cpp:787
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition: typeinfo.h:100
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition: typeinfo.h:101
class FP_TEXT, text in a footprint
Definition: typeinfo.h:92
bool IsSelected() const
Definition: eda_item.h:123
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:108
int GetHolePlatingThickness() const
Pad & via drills are finish size.
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition: typeinfo.h:102
class PCB_TEXT, text on a layer
Definition: typeinfo.h:91
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:97
class FP_SHAPE, a footprint edge
Definition: typeinfo.h:93
class PAD, a pad in a footprint
Definition: typeinfo.h:89
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
virtual void SetLineWidth(float aLineWidth)
Set the line width.
const wxPoint GetEnd() const
Definition: eda_rect.h:103
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
Represent a set of closed polygons.
const wxPoint GetOrigin() const
Definition: eda_rect.h:101
Definition: color4d.h:58
class ZONE, a copper pour area
Definition: typeinfo.h:105
class PCB_TARGET, a target (graphic item)
Definition: typeinfo.h:104
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
class PCB_MARKER, a marker used to show something
Definition: typeinfo.h:98
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
class ZONE, managed by a footprint
Definition: typeinfo.h:94
Handle the component boundary box.
Definition: eda_rect.h:42
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition: typeinfo.h:103
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
virtual const EDA_RECT GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
Definition: eda_item.cpp:75
double GetWorldScale() const
Get the world scale.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
class PCB_SHAPE, a segment not on copper layers
Definition: typeinfo.h:90
void draw(const PCB_TRACK *aTrack, int aLayer)
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113
Container for design settings for a BOARD object.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References SHAPE_POLY_SET::COutline(), CYAN, draw(), KIGFX::GAL::DrawPolyline(), KIGFX::GAL::DrawRectangle(), BOARD_ITEM::GetBoard(), EDA_ITEM::GetBoundingBox(), FOOTPRINT::GetBoundingHull(), ADVANCED_CFG::GetCfg(), EDA_RECT::GetEnd(), BOARD_DESIGN_SETTINGS::GetHolePlatingThickness(), EDA_RECT::GetOrigin(), KIGFX::GAL::GetWorldScale(), EDA_ITEM::IsSelected(), KIGFX::PAINTER::m_gal, m_holePlatingThickness, m_maxError, BOARD_DESIGN_SETTINGS::m_MaxError, MAGENTA, PCB_ARC_T, PCB_DIM_ALIGNED_T, PCB_DIM_CENTER_T, PCB_DIM_LEADER_T, PCB_DIM_ORTHOGONAL_T, PCB_FOOTPRINT_T, PCB_FP_SHAPE_T, PCB_FP_TEXT_T, PCB_FP_ZONE_T, PCB_GROUP_T, PCB_MARKER_T, PCB_PAD_T, PCB_SHAPE_T, PCB_TARGET_T, PCB_TEXT_T, PCB_TRACE_T, PCB_VIA_T, PCB_ZONE_T, KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), and EDA_ITEM::Type().

◆ draw() [1/13]

void PCB_PAINTER::draw ( const PCB_TRACK aTrack,
int  aLayer 
)
protected

Definition at line 586 of file pcb_painter.cpp.

587 {
588  VECTOR2D start( aTrack->GetStart() );
589  VECTOR2D end( aTrack->GetEnd() );
590  int width = aTrack->GetWidth();
591  COLOR4D color = m_pcbSettings.GetColor( aTrack, aLayer );
592 
593  if( IsNetnameLayer( aLayer ) )
594  {
596  return;
597 
598  if( aTrack->GetNetCode() <= NETINFO_LIST::UNCONNECTED )
599  return;
600 
601  VECTOR2D line = ( end - start );
602  double length = line.EuclideanNorm();
603 
604  // Check if the track is long enough to have a netname displayed
605  if( length < 10 * width )
606  return;
607 
608  const wxString& netName = UnescapeString( aTrack->GetShortNetname() );
609  double textSize = width;
610  double penWidth = width / 12.0;
611  VECTOR2D textPosition = start + line / 2.0; // center of the track
612  double textOrientation;
613 
614  if( end.y == start.y ) // horizontal
615  {
616  textOrientation = 0;
617  textPosition.y += penWidth;
618  }
619  else if( end.x == start.x ) // vertical
620  {
621  textOrientation = M_PI / 2;
622  textPosition.x += penWidth;
623  }
624  else
625  {
626  textOrientation = -atan( line.y / line.x );
627  textPosition.x += penWidth / 1.4;
628  textPosition.y += penWidth / 1.4;
629  }
630 
631 
632  m_gal->SetIsStroke( true );
633  m_gal->SetIsFill( false );
635  m_gal->SetLineWidth( penWidth );
636  m_gal->SetFontBold( false );
637  m_gal->SetFontItalic( false );
638  m_gal->SetFontUnderlined( false );
639  m_gal->SetTextMirrored( false );
640  m_gal->SetGlyphSize( VECTOR2D( textSize * 0.55, textSize * 0.55 ) );
643  m_gal->BitmapText( netName, textPosition, textOrientation );
644 
645  return;
646  }
647  else if( IsCopperLayer( aLayer ) )
648  {
649  // Draw a regular track
650  bool outline_mode = m_pcbSettings.m_sketchMode[LAYER_TRACKS];
653  m_gal->SetIsStroke( outline_mode );
654  m_gal->SetIsFill( not outline_mode );
656 
657  m_gal->DrawSegment( start, end, width );
658  }
659 
660  // Clearance lines
661  constexpr int clearanceFlags = PCB_RENDER_SETTINGS::CL_EXISTING
663 
664  if( ( m_pcbSettings.m_clearanceDisplayFlags & clearanceFlags ) == clearanceFlags )
665  {
666  int clearance = aTrack->GetOwnClearance( m_pcbSettings.GetActiveLayer() );
667 
669  m_gal->SetIsFill( false );
670  m_gal->SetIsStroke( true );
672  m_gal->DrawSegment( start, end, width + clearance * 2 );
673  }
674 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
const wxPoint & GetEnd() const
Definition: pcb_track.h:105
virtual void BitmapText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draw a text using a bitmap font.
bool m_sketchMode[GAL_LAYER_ID_END]
Definition: pcb_painter.h:196
int color
Definition: DXF_plotter.cpp:57
Define a general 2D-vector/point.
Definition: vector2d.h:61
void SetFontBold(bool aBold)
Set bold property of current font.
int GetWidth() const
Definition: pcb_track.h:102
PCB_RENDER_SETTINGS m_pcbSettings
Definition: pcb_painter.h:295
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
virtual void DrawSegment(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth)
Draw a rounded segment.
wxString GetShortNetname() const
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
void SetVerticalJustify(const EDA_TEXT_VJUSTIFY_T aVerticalJustify)
Set the vertical justify for text drawing.
void SetFontItalic(bool aItalic)
Set italic property of current font.
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:787
wxString UnescapeString(const wxString &aSource)
void SetGlyphSize(const VECTOR2D &aSize)
Set the font glyph size.
int m_clearanceDisplayFlags
How to display nets and netclasses with color overrides.
Definition: pcb_painter.h:216
void SetTextMirrored(bool aMirrored)
Set a mirrored property of text.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
void SetFontUnderlined(bool aUnderlined)
bool IsNetnameLayer(LAYER_NUM aLayer)
Test whether a layer is a netname layer.
Definition: layer_ids.h:955
virtual COLOR4D GetColor(const VIEW_ITEM *aItem, int aLayer) const override
Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using curr...
PCB_LAYER_ID GetActiveLayer() const
virtual int GetOwnClearance(PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const
Return an item's "own" clearance in internal units.
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
Definition: vector2d.h:293
void SetHorizontalJustify(const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
Set the horizontal justify for text drawing.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
static const int UNCONNECTED
Constant that forces initialization of a netinfo item to the NETINFO_ITEM ORPHANED (typically -1) whe...
Definition: netinfo.h:365
const wxPoint & GetStart() const
Definition: pcb_track.h:108
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References KIGFX::GAL::BitmapText(), KIGFX::PCB_RENDER_SETTINGS::CL_EXISTING, KIGFX::PCB_RENDER_SETTINGS::CL_TRACKS, color, KIGFX::GAL::DrawSegment(), VECTOR2< T >::EuclideanNorm(), KIGFX::RENDER_SETTINGS::GetActiveLayer(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), PCB_TRACK::GetEnd(), BOARD_CONNECTED_ITEM::GetNetCode(), BOARD_CONNECTED_ITEM::GetOwnClearance(), BOARD_CONNECTED_ITEM::GetShortNetname(), PCB_TRACK::GetStart(), PCB_TRACK::GetWidth(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, IsCopperLayer(), IsNetnameLayer(), LAYER_TRACKS, KIGFX::PCB_RENDER_SETTINGS::m_clearanceDisplayFlags, KIGFX::PAINTER::m_gal, KIGFX::PCB_RENDER_SETTINGS::m_netNamesOnTracks, KIGFX::RENDER_SETTINGS::m_outlineWidth, m_pcbSettings, KIGFX::PCB_RENDER_SETTINGS::m_sketchMode, KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetFontBold(), KIGFX::GAL::SetFontItalic(), KIGFX::GAL::SetFontUnderlined(), KIGFX::GAL::SetGlyphSize(), KIGFX::GAL::SetHorizontalJustify(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), KIGFX::GAL::SetTextMirrored(), KIGFX::GAL::SetVerticalJustify(), NETINFO_LIST::UNCONNECTED, UnescapeString(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by Draw().

◆ draw() [2/13]

void PCB_PAINTER::draw ( const PCB_ARC aArc,
int  aLayer 
)
protected

Definition at line 677 of file pcb_painter.cpp.

678 {
679  VECTOR2D center( aArc->GetCenter() );
680  int width = aArc->GetWidth();
681  COLOR4D color = m_pcbSettings.GetColor( aArc, aLayer );
682  double radius = aArc->GetRadius();
683  double start_angle = DECIDEG2RAD( aArc->GetArcAngleStart() );
684  double angle = DECIDEG2RAD( aArc->GetAngle() );
685 
686  if( IsNetnameLayer( aLayer ) )
687  {
688  // Ummm, yeah. Anyone fancy implementing text on a path?
689  return;
690  }
691  else if( IsCopperLayer( aLayer ) )
692  {
693  // Draw a regular track
694  bool outline_mode = m_pcbSettings.m_sketchMode[LAYER_TRACKS];
697  m_gal->SetIsStroke( outline_mode );
698  m_gal->SetIsFill( not outline_mode );
700 
701  m_gal->DrawArcSegment( center, radius, start_angle, start_angle + angle, width, m_maxError );
702  }
703 
704  // Clearance lines
705  constexpr int clearanceFlags = PCB_RENDER_SETTINGS::CL_EXISTING
707 
708  if( ( m_pcbSettings.m_clearanceDisplayFlags & clearanceFlags ) == clearanceFlags )
709  {
710  int clearance = aArc->GetOwnClearance( m_pcbSettings.GetActiveLayer() );
711 
713  m_gal->SetIsFill( false );
714  m_gal->SetIsStroke( true );
716 
717  m_gal->DrawArcSegment( center, radius, start_angle, start_angle + angle,
718  width + clearance * 2, m_maxError );
719  }
720 
721 // Debug only: enable this code only to test the TransformArcToPolygon function
722 // and display the polygon outline created by it.
723 // arcs on F_Cu are approximated with ERROR_INSIDE, others with ERROR_OUTSIDE
724 #if 0
725  SHAPE_POLY_SET cornerBuffer;
727  TransformArcToPolygon( cornerBuffer, aArc->GetStart(), aArc->GetMid(), aArc->GetEnd(), width,
728  m_maxError, errorloc );
730  m_gal->SetIsFill( false );
731  m_gal->SetIsStroke( true );
732  m_gal->SetStrokeColor( COLOR4D( 0, 0, 1.0, 1.0 ) );
733  m_gal->DrawPolygon( cornerBuffer );
734 #endif
735 
736 // Debug only: enable this code only to test the SHAPE_ARC::ConvertToPolyline function
737 // and display the polyline created by it.
738 #if 0
739  SHAPE_ARC arc( aArc->GetCenter(), aArc->GetStart(), aArc->GetAngle() / 10.0, aArc->GetWidth() );
740  SHAPE_LINE_CHAIN arcSpine = arc.ConvertToPolyline( m_maxError );
742  m_gal->SetIsFill( false );
743  m_gal->SetIsStroke( true );
744  m_gal->SetStrokeColor( COLOR4D( 0.3, 0.2, 0.5, 1.0 ) );
745 
746  for( int idx = 1; idx < arcSpine.PointCount(); idx++ )
747  m_gal->DrawSegment( arcSpine.CPoint( idx-1 ), arcSpine.CPoint( idx ), aArc->GetWidth() );
748 #endif
749 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
virtual wxPoint GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pcb_track.h:282
const wxPoint & GetEnd() const
Definition: pcb_track.h:105
bool m_sketchMode[GAL_LAYER_ID_END]
Definition: pcb_painter.h:196
int color
Definition: DXF_plotter.cpp:57
Define a general 2D-vector/point.
Definition: vector2d.h:61
int GetWidth() const
Definition: pcb_track.h:102
PCB_RENDER_SETTINGS m_pcbSettings
Definition: pcb_painter.h:295
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
virtual void DrawSegment(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth)
Draw a rounded segment.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
double GetArcAngleStart() const
Definition: pcb_track.cpp:986
Represent a set of closed polygons.
double GetRadius() const
Definition: pcb_track.cpp:968
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:787
int m_clearanceDisplayFlags
How to display nets and netclasses with color overrides.
Definition: pcb_painter.h:216
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
double GetAngle() const
Definition: pcb_track.cpp:974
virtual void DrawPolygon(const std::deque< VECTOR2D > &aPointList)
Draw a polygon.
Represent a polyline (an zero-thickness chain of connected line segments).
bool IsNetnameLayer(LAYER_NUM aLayer)
Test whether a layer is a netname layer.
Definition: layer_ids.h:955
Definition: layer_ids.h:70
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
virtual COLOR4D GetColor(const VIEW_ITEM *aItem, int aLayer) const override
Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using curr...
double DECIDEG2RAD(double deg)
Definition: trigo.h:233
PCB_LAYER_ID GetActiveLayer() const
virtual int GetOwnClearance(PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const
Return an item's "own" clearance in internal units.
void TransformArcToPolygon(SHAPE_POLY_SET &aCornerBuffer, const wxPoint &aStart, const wxPoint &aMid, const wxPoint &aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc)
Convert arc to multiple straight segments.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
const wxPoint & GetMid() const
Definition: pcb_track.h:273
virtual void DrawArcSegment(const VECTOR2D &aCenterPoint, double aRadius, double aStartAngle, double aEndAngle, double aWidth, double aMaxError)
Draw an arc segment.
const wxPoint & GetStart() const
Definition: pcb_track.h:108
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References PNS::angle(), KIGFX::PCB_RENDER_SETTINGS::CL_EXISTING, KIGFX::PCB_RENDER_SETTINGS::CL_TRACKS, color, DECIDEG2RAD(), KIGFX::GAL::DrawArcSegment(), KIGFX::GAL::DrawPolygon(), KIGFX::GAL::DrawSegment(), ERROR_INSIDE, ERROR_OUTSIDE, F_Cu, KIGFX::RENDER_SETTINGS::GetActiveLayer(), PCB_ARC::GetAngle(), PCB_ARC::GetArcAngleStart(), PCB_ARC::GetCenter(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), PCB_TRACK::GetEnd(), PCB_ARC::GetMid(), BOARD_CONNECTED_ITEM::GetOwnClearance(), PCB_ARC::GetRadius(), PCB_TRACK::GetStart(), PCB_TRACK::GetWidth(), IsCopperLayer(), IsNetnameLayer(), LAYER_TRACKS, KIGFX::PCB_RENDER_SETTINGS::m_clearanceDisplayFlags, KIGFX::PAINTER::m_gal, m_maxError, KIGFX::RENDER_SETTINGS::m_outlineWidth, m_pcbSettings, KIGFX::PCB_RENDER_SETTINGS::m_sketchMode, KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), and TransformArcToPolygon().

◆ draw() [3/13]

void PCB_PAINTER::draw ( const PCB_VIA aVia,
int  aLayer 
)
protected

Definition at line 752 of file pcb_painter.cpp.

753 {
754  COLOR4D color = m_pcbSettings.GetColor( aVia, aLayer );
755  VECTOR2D center( aVia->GetStart() );
756 
757  if( color == COLOR4D::CLEAR )
758  return;
759 
760  // Draw description layer
761  if( IsNetnameLayer( aLayer ) )
762  {
763  VECTOR2D position( center );
764 
765  // Is anything that we can display enabled?
766  if( !m_pcbSettings.m_netNamesOnVias || aVia->GetNetname().empty() )
767  return;
768 
769  double maxSize = PCB_RENDER_SETTINGS::MAX_FONT_SIZE;
770  double size = aVia->GetWidth();
771 
772  // Font size limits
773  if( size > maxSize )
774  size = maxSize;
775 
776  m_gal->Save();
777  m_gal->Translate( position );
778 
779  // Default font settings
781  m_gal->SetStrokeColor( m_pcbSettings.GetColor( nullptr, aLayer ) );
782 
783  // Set the text position to the pad shape position (the pad position is not the best place)
784  VECTOR2D textpos( 0.0, 0.0 );
785 
786  wxString netname = UnescapeString( aVia->GetShortNetname() );
787 
788  // approximate the size of net name text:
789  double tsize = 1.5 * size / std::max( PrintableCharCount( netname ), 1 );
790  tsize = std::min( tsize, size );
791 
792  // Use a smaller text size to handle interline, pen size..
793  tsize *= 0.7;
794  VECTOR2D namesize( tsize, tsize );
795 
796  m_gal->SetGlyphSize( namesize );
797  m_gal->SetLineWidth( namesize.x / 12.0 );
798  m_gal->BitmapText( netname, textpos, 0.0 );
799 
800  m_gal->Restore();
801 
802  return;
803  }
804  else if( aLayer == LAYER_VIA_HOLEWALLS )
805  {
806  m_gal->SetIsFill( false );
807  m_gal->SetIsStroke( true );
810 
811  m_gal->DrawCircle( center, ( getDrillSize( aVia ) + m_holePlatingThickness ) / 2.0 );
812 
813  return;
814  }
815 
816  bool sketchMode = false;
817 
818  switch( aVia->GetViaType() )
819  {
823  default: wxASSERT( false ); break;
824  }
825 
826  if( sketchMode )
827  {
828  // Outline mode
829  m_gal->SetIsStroke( true );
830  m_gal->SetIsFill( false );
833  }
834  else
835  {
836  // Filled mode
837  m_gal->SetIsFill( true );
838  m_gal->SetIsStroke( false );
840  }
841 
842  if( aLayer == LAYER_VIA_HOLES )
843  {
844  m_gal->DrawCircle( center, getDrillSize( aVia ) / 2.0 );
845  }
847  {
848  m_gal->DrawCircle( center, aVia->GetWidth() / 2.0 );
849  }
850  else if( aLayer == LAYER_VIA_BBLIND || aLayer == LAYER_VIA_MICROVIA )
851  {
852  // Outer circles of blind/buried and micro-vias are drawn in a special way to indicate the
853  // top and bottom layers
854  PCB_LAYER_ID layerTop, layerBottom;
855  aVia->LayerPair( &layerTop, &layerBottom );
856 
857  double radius = aVia->GetWidth() / 2.0;
858 
859  if( !sketchMode )
860  m_gal->SetLineWidth( ( aVia->GetWidth() - aVia->GetDrillValue() ) / 2.0 );
861 
862  m_gal->DrawArc( center, radius, M_PI * -0.375, M_PI * 0.375 );
863  m_gal->DrawArc( center, radius, M_PI * 0.625, M_PI * 1.375 );
864 
865  if( sketchMode )
866  m_gal->SetStrokeColor( m_pcbSettings.GetColor( aVia, layerTop ) );
867  else
868  m_gal->SetFillColor( m_pcbSettings.GetColor( aVia, layerTop ) );
869 
870  m_gal->DrawArc( center, radius, M_PI * 1.375, M_PI * 1.625 );
871 
872  if( sketchMode )
873  m_gal->SetStrokeColor( m_pcbSettings.GetColor( aVia, layerBottom ) );
874  else
875  m_gal->SetFillColor( m_pcbSettings.GetColor( aVia, layerBottom ) );
876 
877  m_gal->DrawArc( center, radius, M_PI * 0.375, M_PI * 0.625 );
878  }
879 
880  // Clearance lines
881  constexpr int clearanceFlags = PCB_RENDER_SETTINGS::CL_EXISTING | PCB_RENDER_SETTINGS::CL_VIAS;
882 
883  if( ( m_pcbSettings.m_clearanceDisplayFlags & clearanceFlags ) == clearanceFlags
884  && aLayer != LAYER_VIA_HOLES )
885  {
886  PCB_LAYER_ID activeLayer = m_pcbSettings.GetActiveLayer();
887  double radius;
888 
889  if( aVia->FlashLayer( activeLayer ) )
890  radius = aVia->GetWidth() / 2.0;
891  else
892  radius = getDrillSize( aVia ) / 2.0 + m_holePlatingThickness;
893 
895  m_gal->SetIsFill( false );
896  m_gal->SetIsStroke( true );
898  m_gal->DrawCircle( center, radius + aVia->GetOwnClearance( activeLayer ) );
899  }
900 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
to draw micro vias
Definition: layer_ids.h:189
bool FlashLayer(int aLayer) const
Checks to see whether the via should have a pad on the specific layer.
Definition: pcb_track.cpp:520
virtual void BitmapText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draw a text using a bitmap font.
VIATYPE GetViaType() const
Definition: pcb_track.h:354
virtual void DrawArc(const VECTOR2D &aCenterPoint, double aRadius, double aStartAngle, double aEndAngle)
Draw an arc.
bool m_sketchMode[GAL_LAYER_ID_END]
Definition: pcb_painter.h:196
int color
Definition: DXF_plotter.cpp:57
Define a general 2D-vector/point.
Definition: vector2d.h:61
int GetWidth() const
Definition: pcb_track.h:102
PCB_RENDER_SETTINGS m_pcbSettings
Definition: pcb_painter.h:295
to draw via holes (pad holes do not use this layer)
Definition: layer_ids.h:210
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
virtual VECTOR2D getDrillSize(const PAD *aPad) const
Return drill size for a pad (internal units).
to draw usual through hole vias
Definition: layer_ids.h:191
bool GetDrawIndividualViaLayers() const
Definition: pcb_painter.h:174
void ResetTextAttributes()
Reset text attributes to default styling.
wxString GetShortNetname() const
static const double MAX_FONT_SIZE
< Maximum font size for netnames (and other dynamically shown strings)
Definition: pcb_painter.h:194
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
int PrintableCharCount(const wxString &aString)
Return the number of printable (ie: non-formatting) chars.
static const COLOR4D CLEAR
Definition: color4d.h:382
void LayerPair(PCB_LAYER_ID *top_layer, PCB_LAYER_ID *bottom_layer) const
Function LayerPair Return the 2 layers used by the via (the via actually uses all layers between thes...
Definition: pcb_track.cpp:461
wxString UnescapeString(const wxString &aSource)
void SetGlyphSize(const VECTOR2D &aSize)
Set the font glyph size.
int m_clearanceDisplayFlags
How to display nets and netclasses with color overrides.
Definition: pcb_painter.h:216
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual void Restore()
Restore the context.
to draw blind/buried vias
Definition: layer_ids.h:190
virtual void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.
bool IsNetnameLayer(LAYER_NUM aLayer)
Test whether a layer is a netname layer.
Definition: layer_ids.h:955
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:64
virtual COLOR4D GetColor(const VIEW_ITEM *aItem, int aLayer) const override
Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using curr...
PCB_LAYER_ID GetActiveLayer() const
virtual int GetOwnClearance(PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const
Return an item's "own" clearance in internal units.
int GetDrillValue() const
Function GetDrillValue "calculates" the drill value for vias (m-Drill if > 0, or default drill value ...
Definition: pcb_track.cpp:193
virtual void Save()
Save the context.
virtual void Translate(const VECTOR2D &aTranslation)
Translate the context.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
const wxPoint & GetStart() const
Definition: pcb_track.h:108
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References KIGFX::GAL::BitmapText(), BLIND_BURIED, KIGFX::PCB_RENDER_SETTINGS::CL_EXISTING, KIGFX::PCB_RENDER_SETTINGS::CL_VIAS, KIGFX::COLOR4D::CLEAR, color, KIGFX::GAL::DrawArc(), KIGFX::GAL::DrawCircle(), PCB_VIA::FlashLayer(), KIGFX::RENDER_SETTINGS::GetActiveLayer(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetDrawIndividualViaLayers(), getDrillSize(), PCB_VIA::GetDrillValue(), BOARD_CONNECTED_ITEM::GetNetname(), BOARD_CONNECTED_ITEM::GetOwnClearance(), BOARD_CONNECTED_ITEM::GetShortNetname(), PCB_TRACK::GetStart(), PCB_VIA::GetViaType(), PCB_TRACK::GetWidth(), IsNetnameLayer(), LAYER_VIA_BBLIND, LAYER_VIA_HOLES, LAYER_VIA_HOLEWALLS, LAYER_VIA_MICROVIA, LAYER_VIA_THROUGH, PCB_VIA::LayerPair(), KIGFX::PCB_RENDER_SETTINGS::m_clearanceDisplayFlags, KIGFX::PAINTER::m_gal, m_holePlatingThickness, KIGFX::PCB_RENDER_SETTINGS::m_netNamesOnVias, KIGFX::RENDER_SETTINGS::m_outlineWidth, m_pcbSettings, KIGFX::PCB_RENDER_SETTINGS::m_sketchMode, KIGFX::PCB_RENDER_SETTINGS::MAX_FONT_SIZE, MICROVIA, PrintableCharCount(), KIGFX::GAL::ResetTextAttributes(), KIGFX::GAL::Restore(), KIGFX::GAL::Save(), KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetGlyphSize(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), THROUGH, KIGFX::GAL::Translate(), UnescapeString(), and VECTOR2< T >::x.

◆ draw() [4/13]

void PCB_PAINTER::draw ( const PAD aPad,
int  aLayer 
)
protected

Definition at line 903 of file pcb_painter.cpp.

904 {
905  COLOR4D color = m_pcbSettings.GetColor( aPad, aLayer );
906 
907  if( IsNetnameLayer( aLayer ) )
908  {
909  // Is anything that we can display enabled?
911  {
912  bool displayNetname = ( m_pcbSettings.m_netNamesOnPads && !aPad->GetNetname().empty() );
913  EDA_RECT padBBox = aPad->GetBoundingBox();
914  VECTOR2D position = padBBox.Centre();
915  VECTOR2D padsize = VECTOR2D( padBBox.GetSize() );
916 
917  if( aPad->GetShape() != PAD_SHAPE::CUSTOM )
918  {
919  // Don't allow a 45ยบ rotation to bloat a pad's bounding box unnecessarily
920  double limit = std::min( aPad->GetSize().x, aPad->GetSize().y ) * 1.1;
921 
922  if( padsize.x > limit && padsize.y > limit )
923  {
924  padsize.x = limit;
925  padsize.y = limit;
926  }
927  }
928 
929  double maxSize = PCB_RENDER_SETTINGS::MAX_FONT_SIZE;
930  double size = padsize.y;
931 
932  m_gal->Save();
933  m_gal->Translate( position );
934 
935  // Keep the size ratio for the font, but make it smaller
936  if( padsize.x < padsize.y )
937  {
938  m_gal->Rotate( DECIDEG2RAD( -900.0 ) );
939  size = padsize.x;
940  std::swap( padsize.x, padsize.y );
941  }
942 
943  // Font size limits
944  if( size > maxSize )
945  size = maxSize;
946 
947  // Default font settings
950  m_gal->SetFontBold( false );
951  m_gal->SetFontItalic( false );
952  m_gal->SetFontUnderlined( false );
953  m_gal->SetTextMirrored( false );
954  m_gal->SetStrokeColor( m_pcbSettings.GetColor( aPad, aLayer ) );
955  m_gal->SetIsStroke( true );
956  m_gal->SetIsFill( false );
957 
958  // We have already translated the GAL to be centered at the center of the pad's
959  // bounding box
960  VECTOR2D textpos( 0.0, 0.0 );
961 
962  // Divide the space, to display both pad numbers and netnames and set the Y text
963  // position to display 2 lines
964  if( displayNetname && m_pcbSettings.m_padNumbers )
965  {
966  size = size / 2.5;
967  textpos.y = size / 1.7;
968  }
969 
970  if( displayNetname )
971  {
972  wxString netname = UnescapeString( aPad->GetShortNetname() );
973  wxString pinType = aPad->GetPinType();
974 
975  if( pinType == wxT( "no_connect" ) || pinType.EndsWith( wxT( "+no_connect" ) ) )
976  netname = "x";
977  else if( pinType == wxT( "free" ) && netname.StartsWith( wxT( "unconnected-(" ) ) )
978  netname = "*";
979 
980  // approximate the size of net name text:
981  double tsize = 1.5 * padsize.x / std::max( PrintableCharCount( netname ), 1 );
982  tsize = std::min( tsize, size );
983 
984  // Use a smaller text size to handle interline, pen size...
985  tsize *= 0.7;
986  VECTOR2D namesize( tsize, tsize );
987 
988  m_gal->SetGlyphSize( namesize );
989  m_gal->SetLineWidth( namesize.x / 12.0 );
990  m_gal->BitmapText( netname, textpos, 0.0 );
991  }
992 
994  {
995  const wxString& padNumber = aPad->GetNumber();
996  textpos.y = -textpos.y;
997 
998  // approximate the size of the pad number text:
999  double tsize = 1.5 * padsize.x / std::max( PrintableCharCount( padNumber ), 1 );
1000  tsize = std::min( tsize, size );
1001 
1002  // Use a smaller text size to handle interline, pen size...
1003  tsize *= 0.7;
1004  tsize = std::min( tsize, size );
1005  VECTOR2D numsize( tsize, tsize );
1006 
1007  m_gal->SetGlyphSize( numsize );
1008  m_gal->SetLineWidth( numsize.x / 12.0 );
1009  m_gal->BitmapText( padNumber, textpos, 0.0 );
1010  }
1011 
1012  m_gal->Restore();
1013  }
1014 
1015  return;
1016  }
1017  else if( aLayer == LAYER_PAD_HOLEWALLS )
1018  {
1019  m_gal->SetIsFill( false );
1020  m_gal->SetIsStroke( true );
1023 
1024  const SHAPE_SEGMENT* seg = aPad->GetEffectiveHoleShape();
1025  int holeSize = seg->GetWidth() + m_holePlatingThickness;
1026 
1027  if( seg->GetSeg().A == seg->GetSeg().B ) // Circular hole
1028  m_gal->DrawCircle( seg->GetSeg().A, holeSize / 2 );
1029  else
1030  m_gal->DrawSegment( seg->GetSeg().A, seg->GetSeg().B, holeSize );
1031 
1032  return;
1033  }
1034 
1036  {
1037  // Outline mode
1038  m_gal->SetIsFill( false );
1039  m_gal->SetIsStroke( true );
1042  }
1043  else
1044  {
1045  // Filled mode
1046  m_gal->SetIsFill( true );
1047  m_gal->SetIsStroke( false );
1048  m_gal->SetFillColor( color );
1049  }
1050 
1051  if( aLayer == LAYER_PAD_PLATEDHOLES || aLayer == LAYER_NON_PLATEDHOLES )
1052  {
1053  const SHAPE_SEGMENT* seg = aPad->GetEffectiveHoleShape();
1054 
1055  if( seg->GetSeg().A == seg->GetSeg().B ) // Circular hole
1056  m_gal->DrawCircle( seg->GetSeg().A, getDrillSize( aPad ).x / 2 );
1057  else
1058  m_gal->DrawSegment( seg->GetSeg().A, seg->GetSeg().B, seg->GetWidth() );
1059  }
1060  else
1061  {
1062  wxSize pad_size = aPad->GetSize();
1063  wxSize margin;
1064 
1065  switch( aLayer )
1066  {
1067  case F_Mask:
1068  case B_Mask:
1069  margin.x = margin.y = aPad->GetSolderMaskMargin();
1070  break;
1071 
1072  case F_Paste:
1073  case B_Paste:
1074  margin = aPad->GetSolderPasteMargin();
1075  break;
1076 
1077  default:
1078  margin.x = margin.y = 0;
1079  break;
1080  }
1081 
1082  std::unique_ptr<PAD> dummyPad;
1083  std::shared_ptr<SHAPE_COMPOUND> shapes;
1084 
1085  // Drawing components of compound shapes in outline mode produces a mess.
1086  bool simpleShapes = !m_pcbSettings.m_sketchMode[LAYER_PADS_TH];
1087 
1088  if( simpleShapes )
1089  {
1090  if( ( margin.x != margin.y && aPad->GetShape() != PAD_SHAPE::CUSTOM )
1091  || ( aPad->GetShape() == PAD_SHAPE::ROUNDRECT && ( margin.x < 0 || margin.y < 0 ) ) )
1092  {
1093  // Our algorithms below (polygon inflation in particular) can't handle differential
1094  // inflation along separate axes. So for those cases we build a dummy pad instead,
1095  // and inflate it.
1096 
1097  // Margin is added to both sides. If the total margin is larger than the pad
1098  // then don't display this layer
1099  if( pad_size.x + 2 * margin.x <= 0 || pad_size.y + 2 * margin.y <= 0 )
1100  return;
1101 
1102  dummyPad.reset( static_cast<PAD*>( aPad->Duplicate() ) );
1103  int initial_radius = dummyPad->GetRoundRectCornerRadius();
1104 
1105  dummyPad->SetSize( pad_size + margin + margin );
1106 
1107  if( dummyPad->GetShape() == PAD_SHAPE::ROUNDRECT )
1108  {
1109  // To keep the right margin around the corners, we need to modify the corner radius.
1110  // We must have only one radius correction, so use the smallest absolute margin.
1111  int radius_margin = std::max( margin.x, margin.y ); // radius_margin is < 0
1112  dummyPad->SetRoundRectCornerRadius( std::max( initial_radius + radius_margin, 0 ) );
1113  }
1114 
1115  shapes = std::dynamic_pointer_cast<SHAPE_COMPOUND>( dummyPad->GetEffectiveShape() );
1116  margin.x = margin.y = 0;
1117  }
1118  else
1119  {
1120  shapes = std::dynamic_pointer_cast<SHAPE_COMPOUND>( aPad->GetEffectiveShape() );
1121  }
1122 
1123  if( aPad->GetShape() == PAD_SHAPE::CUSTOM && ( margin.x || margin.y ) )
1124  {
1125  // We can't draw as shapes because we don't know which edges are internal and which
1126  // are external (so we don't know when to apply the margin and when not to).
1127  simpleShapes = false;
1128  }
1129 
1130  for( const SHAPE* shape : shapes->Shapes() )
1131  {
1132  if( !simpleShapes )
1133  break;
1134 
1135  switch( shape->Type() )
1136  {
1137  case SH_SEGMENT:
1138  case SH_CIRCLE:
1139  case SH_RECT:
1140  case SH_SIMPLE:
1141  // OK so far
1142  break;
1143 
1144  default:
1145  // Not OK
1146  simpleShapes = false;
1147  break;
1148  }
1149  }
1150  }
1151 
1152  if( simpleShapes )
1153  {
1154  for( const SHAPE* shape : shapes->Shapes() )
1155  {
1156  switch( shape->Type() )
1157  {
1158  case SH_SEGMENT:
1159  {
1160  const SHAPE_SEGMENT* seg = (const SHAPE_SEGMENT*) shape;
1161  int effectiveWidth = seg->GetWidth() + 2 * margin.x;
1162 
1163  if( effectiveWidth > 0 )
1164  m_gal->DrawSegment( seg->GetSeg().A, seg->GetSeg().B, effectiveWidth );
1165 
1166  break;
1167  }
1168 
1169  case SH_CIRCLE:
1170  {
1171  const SHAPE_CIRCLE* circle = (const SHAPE_CIRCLE*) shape;
1172  int effectiveRadius = circle->GetRadius() + margin.x;
1173 
1174  if( effectiveRadius > 0 )
1175  m_gal->DrawCircle( circle->GetCenter(), effectiveRadius );
1176 
1177  break;
1178  }
1179 
1180  case SH_RECT:
1181  {
1182  const SHAPE_RECT* r = (const SHAPE_RECT*) shape;
1183  VECTOR2I pos = r->GetPosition();
1184  VECTOR2I effectiveMargin = margin;
1185 
1186  if( effectiveMargin.x < 0 )
1187  {
1188  // A negative margin just produces a smaller rect.
1189  VECTOR2I effectiveSize = r->GetSize() + effectiveMargin;
1190 
1191  if( effectiveSize.x > 0 && effectiveSize.y > 0 )
1192  m_gal->DrawRectangle( pos - effectiveMargin, pos + effectiveSize );
1193  }
1194  else if( effectiveMargin.x > 0 )
1195  {
1196  // A positive margin produces a larger rect, but with rounded corners
1197  m_gal->DrawRectangle( r->GetPosition(), r->GetPosition() + r->GetSize() );
1198 
1199  // Use segments to produce the margin with rounded corners
1200  m_gal->DrawSegment( pos,
1201  pos + VECTOR2I( r->GetWidth(), 0 ),
1202  effectiveMargin.x * 2 );
1203  m_gal->DrawSegment( pos + VECTOR2I( r->GetWidth(), 0 ),
1204  pos + r->GetSize(),
1205  effectiveMargin.x * 2 );
1206  m_gal->DrawSegment( pos + r->GetSize(),
1207  pos + VECTOR2I( 0, r->GetHeight() ),
1208  effectiveMargin.x * 2 );
1209  m_gal->DrawSegment( pos + VECTOR2I( 0, r->GetHeight() ),
1210  pos,
1211  effectiveMargin.x * 2 );
1212  }
1213  else
1214  {
1215  m_gal->DrawRectangle( r->GetPosition(), r->GetPosition() + r->GetSize() );
1216  }
1217 
1218  break;
1219  }
1220 
1221  case SH_SIMPLE:
1222  {
1223  const SHAPE_SIMPLE* poly = static_cast<const SHAPE_SIMPLE*>( shape );
1224 
1225  if( margin.x < 0 ) // The poly shape must be deflated
1226  {
1227  int numSegs = GetArcToSegmentCount( -margin.x, m_maxError, 360.0 );
1228  SHAPE_POLY_SET outline;
1229  outline.NewOutline();
1230 
1231  for( int ii = 0; ii < poly->PointCount(); ++ii )
1232  outline.Append( poly->CPoint( ii ) );
1233 
1234  outline.Deflate( -margin.x, numSegs );
1235 
1236  m_gal->DrawPolygon( outline );
1237  }
1238  else
1239  {
1240  m_gal->DrawPolygon( poly->Vertices() );
1241  }
1242 
1243  // Now add on a rounded margin (using segments) if the margin > 0
1244  if( margin.x > 0 )
1245  {
1246  for( size_t ii = 0; ii < poly->GetSegmentCount(); ++ii )
1247  {
1248  SEG seg = poly->GetSegment( ii );
1249  m_gal->DrawSegment( seg.A, seg.B, margin.x * 2 );
1250  }
1251  }
1252 
1253  break;
1254  }
1255 
1256  default:
1257  // Better not get here; we already pre-flighted the shapes...
1258  break;
1259  }
1260  }
1261  }
1262  else
1263  {
1264  // This is expensive. Avoid if possible.
1265  SHAPE_POLY_SET polySet;
1266  aPad->TransformShapeWithClearanceToPolygon( polySet, ToLAYER_ID( aLayer ), margin.x,
1268  m_gal->DrawPolygon( polySet );
1269  }
1270  }
1271 
1272  constexpr int clearanceFlags = PCB_RENDER_SETTINGS::CL_PADS;
1273 
1274  if( ( m_pcbSettings.m_clearanceDisplayFlags & clearanceFlags ) == clearanceFlags
1275  && ( aLayer == LAYER_PAD_FR || aLayer == LAYER_PAD_BK || aLayer == LAYER_PADS_TH ) )
1276  {
1277  /* Showing the clearance area is not obvious.
1278  * - A pad can be removed from some copper layers.
1279  * - For non copper layers, what is the clearance area?
1280  * So for copper layers, the clearance area is the shape if the pad is flashed on this
1281  * layer and the hole clearance area for other copper layers.
1282  * For other layers, use the pad shape, although one can use an other criteria,
1283  * depending on the non copper layer.
1284  */
1285  int activeLayer = m_pcbSettings.GetActiveLayer();
1286  bool flashActiveLayer = true;
1287 
1288  if( IsCopperLayer( activeLayer ) )
1289  flashActiveLayer = aPad->FlashLayer( activeLayer );
1290 
1291  if( flashActiveLayer || aPad->GetDrillSize().x )
1292  {
1294  m_gal->SetIsStroke( true );
1295  m_gal->SetIsFill( false );
1297 
1298  int clearance = aPad->GetOwnClearance( m_pcbSettings.GetActiveLayer() );
1299 
1300  if( flashActiveLayer && clearance > 0 )
1301  {
1302  auto shape = std::dynamic_pointer_cast<SHAPE_COMPOUND>( aPad->GetEffectiveShape() );
1303 
1304  if( shape && shape->Size() == 1 && shape->Shapes()[0]->Type() == SH_SEGMENT )
1305  {
1306  const SHAPE_SEGMENT* seg = (SHAPE_SEGMENT*) shape->Shapes()[0];
1307  m_gal->DrawSegment( seg->GetSeg().A, seg->GetSeg().B,
1308  seg->GetWidth() + 2 * clearance );
1309  }
1310  else if( shape && shape->Size() == 1 && shape->Shapes()[0]->Type() == SH_CIRCLE )
1311  {
1312  const SHAPE_CIRCLE* circle = (SHAPE_CIRCLE*) shape->Shapes()[0];
1313  m_gal->DrawCircle( circle->GetCenter(), circle->GetRadius() + clearance );
1314  }
1315  else
1316  {
1317  SHAPE_POLY_SET polySet;
1318 
1319  // Use ERROR_INSIDE because it avoids Clipper and is therefore much faster.
1320  aPad->TransformShapeWithClearanceToPolygon( polySet, ToLAYER_ID( aLayer ),
1321  clearance, m_maxError, ERROR_INSIDE );
1322  m_gal->DrawPolygon( polySet );
1323  }
1324  }
1325  else if( aPad->GetEffectiveHoleShape() && clearance > 0 )
1326  {
1327  clearance += m_holePlatingThickness;
1328 
1329  const SHAPE_SEGMENT* seg = aPad->GetEffectiveHoleShape();
1330  m_gal->DrawSegment( seg->GetSeg().A, seg->GetSeg().B,
1331  seg->GetWidth() + 2 * clearance );
1332  }
1333  }
1334  }
1335 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
virtual const SEG GetSegment(int aIndex) const override
Definition: shape_simple.h:174
smd pads, front layer
Definition: layer_ids.h:197
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
Represent a simple polygon consisting of a zero-thickness closed chain of connected line segments.
Definition: shape_simple.h:41
const VECTOR2I & CPoint(int aIndex) const
Return a const reference to a given point in the polygon.
Definition: shape_simple.h:102
int GetRadius() const
Definition: shape_circle.h:107
virtual void BitmapText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draw a text using a bitmap font.
bool m_sketchMode[GAL_LAYER_ID_END]
Definition: pcb_painter.h:196
smd pads, back layer
Definition: layer_ids.h:198
int color
Definition: DXF_plotter.cpp:57
Define a general 2D-vector/point.
Definition: vector2d.h:61
void SetFontBold(bool aBold)
Set bold property of current font.
const SHAPE_SEGMENT * GetEffectiveHoleShape() const
Return a SHAPE object representing the pad's hole.
Definition: pad.cpp:306
const VECTOR2I GetCenter() const
Definition: shape_circle.h:112
PCB_RENDER_SETTINGS m_pcbSettings
Definition: pcb_painter.h:295
VECTOR2< int > VECTOR2I
Definition: vector2d.h:623
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
const SEG & GetSeg() const
virtual void SetLineWidth(float aLineWidth)
Set the line width.
virtual void Rotate(double aAngle)
Rotate the context.
virtual VECTOR2D getDrillSize(const PAD *aPad) const
Return drill size for a pad (internal units).
const VECTOR2I GetSize() const
Definition: shape_rect.h:124
const wxSize & GetDrillSize() const
Definition: pad.h:243
bool FlashLayer(int aLayer) const
Check to see whether the pad should be flashed on the specific layer.
Definition: pad.cpp:223
handle color for not plated holes (holes, not pads)
Definition: layer_ids.h:192
virtual void DrawSegment(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth)
Draw a rounded segment.
wxString GetShortNetname() const
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
static const double MAX_FONT_SIZE
< Maximum font size for netnames (and other dynamically shown strings)
Definition: pcb_painter.h:194
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
int PrintableCharCount(const wxString &aString)
Return the number of printable (ie: non-formatting) chars.
Represent a set of closed polygons.
const VECTOR2I & GetPosition() const
Definition: shape_rect.h:116
const wxSize & GetSize() const
Definition: pad.h:233
void Deflate(int aAmount, int aCircleSegmentsCount, CORNER_STRATEGY aCornerStrategy=ROUND_ALL_CORNERS)
const EDA_RECT GetBoundingBox() const override
The bounding box is cached, so this will be efficient most of the time.
Definition: pad.cpp:536
const wxString & GetNumber() const
Definition: pad.h:129
const wxString & GetPinType() const
Definition: pad.h:146
PAD_SHAPE GetShape() const
Definition: pad.h:170
const SHAPE_LINE_CHAIN & Vertices() const
Return the list of vertices defining this simple polygon.
Definition: shape_simple.h:124
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
Definition: pad.cpp:297
An abstract shape on 2D plane.
Definition: shape.h:116
void SetVerticalJustify(const EDA_TEXT_VJUSTIFY_T aVerticalJustify)
Set the vertical justify for text drawing.
void SetFontItalic(bool aItalic)
Set italic property of current font.
int NewOutline()
Creates a new hole in a given outline.
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:787
wxString UnescapeString(const wxString &aSource)
circle
Definition: shape.h:46
void SetGlyphSize(const VECTOR2D &aSize)
Set the font glyph size.
int m_clearanceDisplayFlags
How to display nets and netclasses with color overrides.
Definition: pcb_painter.h:216
int GetSolderMaskMargin() const
Definition: pad.cpp:711
Definition: seg.h:40
virtual size_t GetSegmentCount() const override
Definition: shape_simple.h:176
void SetTextMirrored(bool aMirrored)
Set a mirrored property of text.
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, PCB_LAYER_ID aLayer, int aClearanceValue, int aMaxError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Convert the pad shape to a closed polygon.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual void Restore()
Restore the context.
virtual void DrawPolygon(const std::deque< VECTOR2D > &aPointList)
Draw a polygon.
void SetFontUnderlined(bool aUnderlined)
multilayer pads, usually with holes
Definition: layer_ids.h:208
wxSize GetSolderPasteMargin() const
Usually < 0 (mask shape smaller than pad)because the margin can be dependent on the pad size,...
Definition: pad.cpp:756
virtual void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.
bool IsNetnameLayer(LAYER_NUM aLayer)
Test whether a layer is a netname layer.
Definition: layer_ids.h:955
virtual COLOR4D GetColor(const VIEW_ITEM *aItem, int aLayer) const override
Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using curr...
VECTOR2I A
Definition: seg.h:48
int PointCount() const
Return the number of points (vertices) in this polygon.
Definition: shape_simple.h:88
Handle the component boundary box.
Definition: eda_rect.h:42
double DECIDEG2RAD(double deg)
Definition: trigo.h:233
PCB_LAYER_ID GetActiveLayer() const
virtual int GetOwnClearance(PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const
Return an item's "own" clearance in internal units.
wxPoint Centre() const
Definition: eda_rect.h:55
to draw pad holes (plated)
Definition: layer_ids.h:209
virtual BOARD_ITEM * Duplicate() const
Create a copy of this BOARD_ITEM.
Definition: board_item.h:200
const int GetHeight() const
Definition: shape_rect.h:140
axis-aligned rectangle
Definition: shape.h:43
virtual void Save()
Save the context.
void SetHorizontalJustify(const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
Set the horizontal justify for text drawing.
const int GetWidth() const
Definition: shape_rect.h:132
virtual void Translate(const VECTOR2D &aTranslation)
Translate the context.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
int GetWidth() const
simple polygon
Definition: shape.h:47
int GetArcToSegmentCount(int aRadius, int aErrorMax, double aArcAngleDegree)
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:905
const wxSize GetSize() const
Definition: eda_rect.h:91
line segment
Definition: shape.h:44
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103
VECTOR2I B
Definition: seg.h:49

References SEG::A, SHAPE_POLY_SET::Append(), SEG::B, B_Mask, B_Paste, KIGFX::GAL::BitmapText(), EDA_RECT::Centre(), KIGFX::PCB_RENDER_SETTINGS::CL_PADS, color, SHAPE_SIMPLE::CPoint(), CUSTOM, DECIDEG2RAD(), SHAPE_POLY_SET::Deflate(), KIGFX::GAL::DrawCircle(), KIGFX::GAL::DrawPolygon(), KIGFX::GAL::DrawRectangle(), KIGFX::GAL::DrawSegment(), BOARD_ITEM::Duplicate(), ERROR_INSIDE, F_Mask, F_Paste, PAD::FlashLayer(), KIGFX::RENDER_SETTINGS::GetActiveLayer(), GetArcToSegmentCount(), PAD::GetBoundingBox(), SHAPE_CIRCLE::GetCenter(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), PAD::GetDrillSize(), getDrillSize(), PAD::GetEffectiveHoleShape(), PAD::GetEffectiveShape(), SHAPE_RECT::GetHeight(), BOARD_CONNECTED_ITEM::GetNetname(), PAD::GetNumber(), BOARD_CONNECTED_ITEM::GetOwnClearance(), PAD::GetPinType(), SHAPE_RECT::GetPosition(), SHAPE_CIRCLE::GetRadius(), SHAPE_SEGMENT::GetSeg(), SHAPE_SIMPLE::GetSegment(), SHAPE_SIMPLE::GetSegmentCount(), PAD::GetShape(), BOARD_CONNECTED_ITEM::GetShortNetname(), EDA_RECT::GetSize(), SHAPE_RECT::GetSize(), PAD::GetSize(), PAD::GetSolderMaskMargin(), PAD::GetSolderPasteMargin(), SHAPE_RECT::GetWidth(), SHAPE_SEGMENT::GetWidth(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, IsCopperLayer(), IsNetnameLayer(), LAYER_NON_PLATEDHOLES, LAYER_PAD_BK, LAYER_PAD_FR, LAYER_PAD_HOLEWALLS, LAYER_PAD_PLATEDHOLES, LAYER_PADS_TH, KIGFX::PCB_RENDER_SETTINGS::m_clearanceDisplayFlags, KIGFX::PAINTER::m_gal, m_holePlatingThickness, m_maxError, KIGFX::PCB_RENDER_SETTINGS::m_netNamesOnPads, KIGFX::RENDER_SETTINGS::m_outlineWidth, KIGFX::PCB_RENDER_SETTINGS::m_padNumbers, m_pcbSettings, KIGFX::PCB_RENDER_SETTINGS::m_sketchMode, KIGFX::PCB_RENDER_SETTINGS::MAX_FONT_SIZE, SHAPE_POLY_SET::NewOutline(), SHAPE_SIMPLE::PointCount(), PrintableCharCount(), KIGFX::GAL::Restore(), KIGFX::GAL::Rotate(), ROUNDRECT, KIGFX::GAL::Save(), KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetFontBold(), KIGFX::GAL::SetFontItalic(), KIGFX::GAL::SetFontUnderlined(), KIGFX::GAL::SetGlyphSize(), KIGFX::GAL::SetHorizontalJustify(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), KIGFX::GAL::SetTextMirrored(), KIGFX::GAL::SetVerticalJustify(), SH_CIRCLE, SH_RECT, SH_SEGMENT, SH_SIMPLE, ToLAYER_ID(), PAD::TransformShapeWithClearanceToPolygon(), KIGFX::GAL::Translate(), UnescapeString(), SHAPE_SIMPLE::Vertices(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ draw() [5/13]

void PCB_PAINTER::draw ( const PCB_SHAPE aSegment,
int  aLayer 
)
protected

Definition at line 1338 of file pcb_painter.cpp.

1339 {
1340  const COLOR4D& color = m_pcbSettings.GetColor( aShape, aShape->GetLayer() );
1341  bool sketch = m_pcbSettings.m_sketchGraphics;
1342  int thickness = getLineThickness( aShape->GetWidth() );
1343  VECTOR2D start( aShape->GetStart() );
1344  VECTOR2D end( aShape->GetEnd() );
1345 
1346  if( sketch )
1347  {
1348  m_gal->SetIsFill( false );
1349  m_gal->SetIsStroke( true );
1351  }
1352 
1353  m_gal->SetFillColor( color );
1355 
1356  switch( aShape->GetShape() )
1357  {
1358  case SHAPE_T::SEGMENT:
1359  if( sketch )
1360  {
1361  m_gal->DrawSegment( start, end, thickness );
1362  }
1363  else
1364  {
1365  m_gal->SetIsFill( true );
1366  m_gal->SetIsStroke( false );
1367 
1368  m_gal->DrawSegment( start, end, thickness );
1369  }
1370 
1371  break;
1372 
1373  case SHAPE_T::RECT:
1374  {
1375  std::vector<wxPoint> pts = aShape->GetRectCorners();
1376 
1377  if( sketch )
1378  {
1379  m_gal->DrawSegment( pts[0], pts[1], thickness );
1380  m_gal->DrawSegment( pts[1], pts[2], thickness );
1381  m_gal->DrawSegment( pts[2], pts[3], thickness );
1382  m_gal->DrawSegment( pts[3], pts[0], thickness );
1383  }
1384  else
1385  {
1386  m_gal->SetIsFill( true );
1387  m_gal->SetIsStroke( false );
1388 
1389  if( thickness > 0 )
1390  {
1391  m_gal->DrawSegment( pts[0], pts[1], thickness );
1392  m_gal->DrawSegment( pts[1], pts[2], thickness );
1393  m_gal->DrawSegment( pts[2], pts[3], thickness );
1394  m_gal->DrawSegment( pts[3], pts[0], thickness );
1395  }
1396 
1397  if( aShape->IsFilled() )
1398  {
1399  SHAPE_POLY_SET poly;
1400  poly.NewOutline();
1401 
1402  for( const wxPoint& pt : pts )
1403  poly.Append( pt );
1404 
1405  m_gal->DrawPolygon( poly );
1406  }
1407  }
1408 
1409  break;
1410  }
1411 
1412  case SHAPE_T::ARC:
1413  if( sketch )
1414  {
1415  m_gal->DrawArcSegment( start, aShape->GetRadius(),
1416  DECIDEG2RAD( aShape->GetArcAngleStart() ),
1417  DECIDEG2RAD( aShape->GetArcAngleStart() + aShape->GetAngle() ), // Change this
1418  thickness, m_maxError );
1419  }
1420  else
1421  {
1422  m_gal->SetIsFill( true );
1423  m_gal->SetIsStroke( false );
1424 
1425  m_gal->DrawArcSegment( start, aShape->GetRadius(),
1426  DECIDEG2RAD( aShape->GetArcAngleStart() ),
1427  DECIDEG2RAD( aShape->GetArcAngleStart() + aShape->GetAngle() ), // Change this
1428  thickness, m_maxError );
1429  }
1430  break;
1431 
1432  case SHAPE_T::CIRCLE:
1433  if( sketch )
1434  {
1435  m_gal->DrawCircle( start, aShape->GetRadius() - thickness / 2 );
1436  m_gal->DrawCircle( start, aShape->GetRadius() + thickness / 2 );
1437  }
1438  else
1439  {
1440  m_gal->SetIsFill( aShape->IsFilled() );
1441  m_gal->SetIsStroke( thickness > 0 );
1442  m_gal->SetLineWidth( thickness );
1443 
1444  m_gal->DrawCircle( start, aShape->GetRadius() );
1445  }
1446  break;
1447 
1448  case SHAPE_T::POLY:
1449  {
1450  SHAPE_POLY_SET& shape = const_cast<PCB_SHAPE*>( aShape )->GetPolyShape();
1451  const FOOTPRINT* parentFootprint = aShape->GetParentFootprint();
1452 
1453  if( shape.OutlineCount() == 0 )
1454  break;
1455 
1456  if( parentFootprint )
1457  {
1458  m_gal->Save();
1459  m_gal->Translate( parentFootprint->GetPosition() );
1460  m_gal->Rotate( -parentFootprint->GetOrientationRadians() );
1461  }
1462 
1463  if( sketch )
1464  {
1465  for( int ii = 0; ii < shape.Outline( 0 ).SegmentCount(); ++ii )
1466  {
1467  SEG seg = shape.Outline( 0 ).Segment( ii );
1468  m_gal->DrawSegment( seg.A, seg.B, thickness );
1469  }
1470  }
1471  else
1472  {
1473  m_gal->SetIsFill( true );
1474  m_gal->SetIsStroke( false );
1475 
1476  if( thickness > 0 )
1477  {
1478  for( int ii = 0; ii < shape.Outline( 0 ).SegmentCount(); ++ii )
1479  {
1480  SEG seg = shape.Outline( 0 ).Segment( ii );
1481  m_gal->DrawSegment( seg.A, seg.B, thickness );
1482  }
1483  }
1484 
1485  if( aShape->IsFilled() )
1486  {
1487  // On Opengl, a not convex filled polygon is usually drawn by using triangles
1488  // as primitives. CacheTriangulation() can create basic triangle primitives to
1489  // draw the polygon solid shape on Opengl. GLU tessellation is much slower, so
1490  // currently we are using our tessellation.
1491  if( m_gal->IsOpenGlEngine() && !shape.IsTriangulationUpToDate() )
1492  shape.CacheTriangulation();
1493 
1494  m_gal->DrawPolygon( shape );
1495  }
1496  }
1497 
1498  if( parentFootprint )
1499  m_gal->Restore();
1500 
1501  break;
1502  }
1503 
1504  case SHAPE_T::BEZIER:
1505  if( sketch )
1506  {
1507  // Use thickness as filter value to convert the curve to polyline when the curve
1508  // is not supported
1509  m_gal->DrawCurve( VECTOR2D( aShape->GetStart() ),
1510  VECTOR2D( aShape->GetBezierC1() ),
1511  VECTOR2D( aShape->GetBezierC2() ),
1512  VECTOR2D( aShape->GetEnd() ), thickness );
1513  }
1514  else
1515  {
1516  m_gal->SetIsFill( aShape->IsFilled() );
1517  m_gal->SetIsStroke( thickness > 0 );
1518  m_gal->SetLineWidth( thickness );
1519 
1520  // Use thickness as filter value to convert the curve to polyline when the curve
1521  // is not supported
1522  m_gal->DrawCurve( VECTOR2D( aShape->GetStart() ),
1523  VECTOR2D( aShape->GetBezierC1() ),
1524  VECTOR2D( aShape->GetBezierC2() ),
1525  VECTOR2D( aShape->GetEnd() ), thickness );
1526  }
1527 
1528  break;
1529 
1530  case SHAPE_T::LAST:
1531  break;
1532  }
1533 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
Arcs (with rounded ends)
Bezier Curve.
double GetOrientationRadians() const
Definition: footprint.h:192
int OutlineCount() const
Return the number of vertices in a given outline/hole.
polygon (not yet used for tracks, but could be in microwave apps)
int color
Definition: DXF_plotter.cpp:57
Define a general 2D-vector/point.
Definition: vector2d.h:61
usual segment : line with rounded ends
last value for this list
PCB_RENDER_SETTINGS m_pcbSettings
Definition: pcb_painter.h:295
bool IsTriangulationUpToDate() const
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
virtual void Rotate(double aAngle)
Rotate the context.
int getLineThickness(int aActualThickness) const
Get the thickness to draw for a line (e.g.
virtual void DrawSegment(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth)
Draw a rounded segment.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
Represent a set of closed polygons.
SHAPE_LINE_CHAIN & Outline(int aIndex)
virtual bool IsOpenGlEngine()
Return true if the GAL engine is a OpenGL based type.
int NewOutline()
Creates a new hole in a given outline.
int SegmentCount() const
Return the number of segments in this line chain.
Definition: seg.h:40
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
SEG Segment(int aIndex)
Return a copy of the aIndex-th segment in the line chain.
virtual void Restore()
Restore the context.
virtual void DrawPolygon(const std::deque< VECTOR2D > &aPointList)
Draw a polygon.
virtual void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.
virtual COLOR4D GetColor(const VIEW_ITEM *aItem, int aLayer) const override
Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using curr...
VECTOR2I A
Definition: seg.h:48
double DECIDEG2RAD(double deg)
Definition: trigo.h:233
wxPoint GetPosition() const override
Definition: footprint.h:186
void CacheTriangulation(bool aPartition=true)
virtual void Save()
Save the context.
segment with non rounded ends
virtual void Translate(const VECTOR2D &aTranslation)
Translate the context.
virtual void DrawCurve(const VECTOR2D &startPoint, const VECTOR2D &controlPointA, const VECTOR2D &controlPointB, const VECTOR2D &endPoint, double aFilterValue=0.0)
Draw a cubic bezier spline.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
virtual void DrawArcSegment(const VECTOR2D &aCenterPoint, double aRadius, double aStartAngle, double aEndAngle, double aWidth, double aMaxError)
Draw an arc segment.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103
VECTOR2I B
Definition: seg.h:49

References SEG::A, SHAPE_POLY_SET::Append(), ARC, SEG::B, BEZIER, SHAPE_POLY_SET::CacheTriangulation(), CIRCLE, color, DECIDEG2RAD(), KIGFX::GAL::DrawArcSegment(), KIGFX::GAL::DrawCircle(), KIGFX::GAL::DrawCurve(), KIGFX::GAL::DrawPolygon(), KIGFX::GAL::DrawSegment(), PCB_SHAPE::GetAngle(), PCB_SHAPE::GetArcAngleStart(), PCB_SHAPE::GetBezierC1(), PCB_SHAPE::GetBezierC2(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), PCB_SHAPE::GetEnd(), BOARD_ITEM::GetLayer(), getLineThickness(), FOOTPRINT::GetOrientationRadians(), PCB_SHAPE::GetParentFootprint(), FOOTPRINT::GetPosition(), PCB_SHAPE::GetRadius(), PCB_SHAPE::GetRectCorners(), PCB_SHAPE::GetShape(), PCB_SHAPE::GetStart(), PCB_SHAPE::GetWidth(), PCB_SHAPE::IsFilled(), KIGFX::GAL::IsOpenGlEngine(), SHAPE_POLY_SET::IsTriangulationUpToDate(), LAST, KIGFX::PAINTER::m_gal, m_maxError, KIGFX::RENDER_SETTINGS::m_outlineWidth, m_pcbSettings, KIGFX::PCB_RENDER_SETTINGS::m_sketchGraphics, SHAPE_POLY_SET::NewOutline(), SHAPE_POLY_SET::Outline(), SHAPE_POLY_SET::OutlineCount(), POLY, RECT, KIGFX::GAL::Restore(), KIGFX::GAL::Rotate(), KIGFX::GAL::Save(), SEGMENT, SHAPE_LINE_CHAIN::Segment(), SHAPE_LINE_CHAIN::SegmentCount(), KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), and KIGFX::GAL::Translate().

◆ draw() [6/13]

void PCB_PAINTER::draw ( const PCB_TEXT aText,
int  aLayer 
)
protected

Definition at line 1536 of file pcb_painter.cpp.

1537 {
1538  wxString shownText( aText->GetShownText() );
1539 
1540  if( shownText.Length() == 0 )
1541  return;
1542 
1543  const COLOR4D& color = m_pcbSettings.GetColor( aText, aText->GetLayer() );
1544  VECTOR2D position( aText->GetTextPos().x, aText->GetTextPos().y );
1545 
1547  {
1548  // Outline mode
1550  }
1551  else
1552  {
1553  // Filled mode
1555  }
1556 
1558  m_gal->SetIsFill( false );
1559  m_gal->SetIsStroke( true );
1560  m_gal->SetTextAttributes( aText );
1561  m_gal->StrokeText( shownText, position, aText->GetTextAngleRadians() );
1562 }
virtual void SetTextAttributes(const EDA_TEXT *aText)
Loads attributes of the given text (bold/italic/underline/mirrored and so on).
bool m_sketchMode[GAL_LAYER_ID_END]
Definition: pcb_painter.h:196
int color
Definition: DXF_plotter.cpp:57
Define a general 2D-vector/point.
Definition: vector2d.h:61
PCB_RENDER_SETTINGS m_pcbSettings
Definition: pcb_painter.h:295
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:149
virtual void SetLineWidth(float aLineWidth)
Set the line width.
wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: pcb_text.cpp:56
int getLineThickness(int aActualThickness) const
Get the thickness to draw for a line (e.g.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void StrokeText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draw a vector type text using preloaded Newstroke font.
double GetTextAngleRadians() const
Definition: eda_text.h:177
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual COLOR4D GetColor(const VIEW_ITEM *aItem, int aLayer) const override
Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using curr...
const wxPoint & GetTextPos() const
Definition: eda_text.h:247
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:171
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References color, KIGFX::PCB_RENDER_SETTINGS::GetColor(), EDA_TEXT::GetEffectiveTextPenWidth(), BOARD_ITEM::GetLayer(), getLineThickness(), PCB_TEXT::GetShownText(), EDA_TEXT::GetTextAngleRadians(), EDA_TEXT::GetTextPos(), KIGFX::PAINTER::m_gal, KIGFX::RENDER_SETTINGS::m_outlineWidth, m_pcbSettings, KIGFX::PCB_RENDER_SETTINGS::m_sketchMode, KIGFX::PCB_RENDER_SETTINGS::m_sketchText, KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), KIGFX::GAL::SetTextAttributes(), and KIGFX::GAL::StrokeText().

◆ draw() [7/13]

void PCB_PAINTER::draw ( const FP_TEXT aText,
int  aLayer 
)
protected

Definition at line 1565 of file pcb_painter.cpp.

1566 {
1567  wxString shownText( aText->GetShownText() );
1568 
1569  if( shownText.Length() == 0 )
1570  return;
1571 
1572  const COLOR4D& color = m_pcbSettings.GetColor( aText, aLayer );
1573  VECTOR2D position( aText->GetTextPos().x, aText->GetTextPos().y );
1574 
1576  {
1577  // Outline mode
1579  }
1580  else
1581  {
1582  // Filled mode
1584  }
1585 
1587  m_gal->SetIsFill( false );
1588  m_gal->SetIsStroke( true );
1589  m_gal->SetTextAttributes( aText );
1590  m_gal->StrokeText( shownText, position, aText->GetDrawRotationRadians() );
1591 
1592  // Draw the umbilical line
1593  if( aText->IsSelected() )
1594  {
1597  m_gal->DrawLine( position, aText->GetParent()->GetPosition() );
1598  }
1599 }
bool IsSelected() const
Definition: eda_item.h:123
virtual void SetTextAttributes(const EDA_TEXT *aText)
Loads attributes of the given text (bold/italic/underline/mirrored and so on).
int color
Definition: DXF_plotter.cpp:57
Define a general 2D-vector/point.
Definition: vector2d.h:61
anchor of items having an anchor point (texts, footprints)
Definition: layer_ids.h:196
PCB_RENDER_SETTINGS m_pcbSettings
Definition: pcb_painter.h:295
virtual wxPoint GetPosition() const
Definition: eda_item.h:252
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
int GetEffectiveTextPenWidth(int aDefaultWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultWidth.
Definition: eda_text.cpp:149
virtual void SetLineWidth(float aLineWidth)
Set the line width.
int getLineThickness(int aActualThickness) const
Get the thickness to draw for a line (e.g.
double GetDrawRotationRadians() const
Definition: fp_text.h:175
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void StrokeText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draw a vector type text using preloaded Newstroke font.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual COLOR4D GetColor(const VIEW_ITEM *aItem, int aLayer) const override
Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using curr...
const wxPoint & GetTextPos() const
Definition: eda_text.h:247
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:166
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
virtual wxString GetShownText(int aDepth=0) const override
Return the string actually shown after processing of the base text.
Definition: fp_text.cpp:414
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References color, KIGFX::GAL::DrawLine(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), FP_TEXT::GetDrawRotationRadians(), EDA_TEXT::GetEffectiveTextPenWidth(), getLineThickness(), BOARD_ITEM::GetParent(), EDA_ITEM::GetPosition(), FP_TEXT::GetShownText(), EDA_TEXT::GetTextPos(), EDA_ITEM::IsSelected(), LAYER_ANCHOR, KIGFX::PAINTER::m_gal, KIGFX::RENDER_SETTINGS::m_outlineWidth, m_pcbSettings, KIGFX::PCB_RENDER_SETTINGS::m_sketchText, KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), KIGFX::GAL::SetTextAttributes(), and KIGFX::GAL::StrokeText().

◆ draw() [8/13]

void PCB_PAINTER::draw ( const FOOTPRINT aFootprint,
int  aLayer 
)
protected

Definition at line 1602 of file pcb_painter.cpp.

1603 {
1604  if( aLayer == LAYER_ANCHOR )
1605  {
1606  const COLOR4D color = m_pcbSettings.GetColor( aFootprint, aLayer );
1607 
1608  // Keep the size and width constant, not related to the scale because the anchor
1609  // is just a marker on screen
1610  double anchorSize = 5.0 / m_gal->GetWorldScale(); // 5 pixels size
1611  double anchorThickness = 1.0 / m_gal->GetWorldScale(); // 1 pixels width
1612 
1613  // Draw anchor
1614  m_gal->SetIsFill( false );
1615  m_gal->SetIsStroke( true );
1617  m_gal->SetLineWidth( anchorThickness );
1618 
1619  VECTOR2D center = aFootprint->GetPosition();
1620  m_gal->DrawLine( center - VECTOR2D( anchorSize, 0 ), center + VECTOR2D( anchorSize, 0 ) );
1621  m_gal->DrawLine( center - VECTOR2D( 0, anchorSize ), center + VECTOR2D( 0, anchorSize ) );
1622  }
1623 }
int color
Definition: DXF_plotter.cpp:57
Define a general 2D-vector/point.
Definition: vector2d.h:61
anchor of items having an anchor point (texts, footprints)
Definition: layer_ids.h:196
PCB_RENDER_SETTINGS m_pcbSettings
Definition: pcb_painter.h:295
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual COLOR4D GetColor(const VIEW_ITEM *aItem, int aLayer) const override
Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using curr...
wxPoint GetPosition() const override
Definition: footprint.h:186
double GetWorldScale() const
Get the world scale.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References color, KIGFX::GAL::DrawLine(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), FOOTPRINT::GetPosition(), KIGFX::GAL::GetWorldScale(), LAYER_ANCHOR, KIGFX::PAINTER::m_gal, m_pcbSettings, KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), and KIGFX::GAL::SetStrokeColor().

◆ draw() [9/13]

void PCB_PAINTER::draw ( const PCB_GROUP aGroup,
int  aLayer 
)
protected

Definition at line 1626 of file pcb_painter.cpp.

1627 {
1628  if( aLayer == LAYER_ANCHOR )
1629  {
1630  if( aGroup->IsSelected() && !( aGroup->GetParent() && aGroup->GetParent()->IsSelected() ) )
1631  {
1632  // Selected on our own; draw enclosing box
1633  }
1634  else if( aGroup->IsEntered() )
1635  {
1636  // Entered group; draw enclosing box
1637  }
1638  else
1639  {
1640  // Neither selected nor entered; draw nothing at the group level (ie: only draw
1641  // its members)
1642  return;
1643  }
1644 
1645  const COLOR4D color = m_pcbSettings.GetColor( aGroup, LAYER_ANCHOR );
1646 
1647  EDA_RECT bbox = aGroup->GetBoundingBox();
1650  wxPoint topLeft = bbox.GetPosition();
1651  wxPoint width = wxPoint( bbox.GetWidth(), 0 );
1652  wxPoint height = wxPoint( 0, bbox.GetHeight() );
1653 
1654  m_gal->DrawLine( topLeft, topLeft + width );
1655  m_gal->DrawLine( topLeft + width, topLeft + width + height );
1656  m_gal->DrawLine( topLeft + width + height, topLeft + height );
1657  m_gal->DrawLine( topLeft + height, topLeft );
1658 
1659  wxString name = aGroup->GetName();
1660 
1661  if( name.IsEmpty() )
1662  return;
1663 
1664  int ptSize = 12;
1665  int scaledSize = abs( KiROUND( m_gal->GetScreenWorldMatrix().GetScale().x * ptSize ) );
1666  int unscaledSize = Mils2iu( ptSize );
1667 
1668  // Scale by zoom a bit, but not too much
1669  int textSize = ( scaledSize + ( unscaledSize * 2 ) ) / 3;
1670  int penWidth = textSize / 10;
1671  wxPoint textOffset = wxPoint( width.x / 2, - KiROUND( textSize * 0.5 ) );
1672  wxPoint titleHeight = wxPoint( 0, KiROUND( textSize * 2.0 ) );
1673 
1674  if( PrintableCharCount( name ) * textSize < bbox.GetWidth() )
1675  {
1676  m_gal->DrawLine( topLeft, topLeft - titleHeight );
1677  m_gal->DrawLine( topLeft - titleHeight, topLeft + width - titleHeight );
1678  m_gal->DrawLine( topLeft + width - titleHeight, topLeft + width );
1679 
1680  m_gal->SetFontBold( false );
1681  m_gal->SetFontItalic( true );
1682  m_gal->SetFontUnderlined( false );
1686  m_gal->SetIsFill( false );
1687  m_gal->SetGlyphSize( VECTOR2D( textSize, textSize ) );
1688  m_gal->SetLineWidth( penWidth );
1689  m_gal->StrokeText( aGroup->GetName(), topLeft + textOffset, 0.0 );
1690  }
1691  }
1692 }
bool IsSelected() const
Definition: eda_item.h:123
const MATRIX3x3D & GetScreenWorldMatrix() const
Get the screen <-> world transformation matrix.
bool IsFlippedX() const
Return true if flip flag for the X axis is set.
int color
Definition: DXF_plotter.cpp:57
void SetFontBold(bool aBold)
Set bold property of current font.
int GetWidth() const
Definition: eda_rect.h:109
anchor of items having an anchor point (texts, footprints)
Definition: layer_ids.h:196
PCB_RENDER_SETTINGS m_pcbSettings
Definition: pcb_painter.h:295
const EDA_RECT GetBoundingBox() const override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: pcb_group.cpp:210
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
VECTOR2< T > GetScale() const
Get the scale components of the matrix.
Definition: matrix3x3.h:265
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
bool IsEntered() const
Definition: eda_item.h:124
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
wxString GetName() const
Definition: pcb_group.h:65
int PrintableCharCount(const wxString &aString)
Return the number of printable (ie: non-formatting) chars.
virtual void StrokeText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draw a vector type text using preloaded Newstroke font.
const wxPoint GetPosition() const
Definition: eda_rect.h:102
void SetVerticalJustify(const EDA_TEXT_VJUSTIFY_T aVerticalJustify)
Set the vertical justify for text drawing.
void SetFontItalic(bool aItalic)
Set italic property of current font.
int GetHeight() const
Definition: eda_rect.h:110
void SetGlyphSize(const VECTOR2D &aSize)
Set the font glyph size.
void SetTextMirrored(bool aMirrored)
Set a mirrored property of text.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
void SetFontUnderlined(bool aUnderlined)
const char * name
Definition: DXF_plotter.cpp:56
virtual COLOR4D GetColor(const VIEW_ITEM *aItem, int aLayer) const override
Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using curr...
Handle the component boundary box.
Definition: eda_rect.h:42
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:73
void SetHorizontalJustify(const EDA_TEXT_HJUSTIFY_T aHorizontalJustify)
Set the horizontal justify for text drawing.
BOARD_ITEM_CONTAINER * GetParent() const
Definition: board_item.h:166
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References color, KIGFX::GAL::DrawLine(), PCB_GROUP::GetBoundingBox(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), EDA_RECT::GetHeight(), PCB_GROUP::GetName(), BOARD_ITEM::GetParent(), EDA_RECT::GetPosition(), MATRIX3x3< T >::GetScale(), KIGFX::GAL::GetScreenWorldMatrix(), EDA_RECT::GetWidth(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, EDA_ITEM::IsEntered(), KIGFX::GAL::IsFlippedX(), EDA_ITEM::IsSelected(), KiROUND(), LAYER_ANCHOR, KIGFX::PAINTER::m_gal, KIGFX::RENDER_SETTINGS::m_outlineWidth, m_pcbSettings, name, PrintableCharCount(), KIGFX::GAL::SetFontBold(), KIGFX::GAL::SetFontItalic(), KIGFX::GAL::SetFontUnderlined(), KIGFX::GAL::SetGlyphSize(), KIGFX::GAL::SetHorizontalJustify(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), KIGFX::GAL::SetTextMirrored(), KIGFX::GAL::SetVerticalJustify(), KIGFX::GAL::StrokeText(), and VECTOR2< T >::x.

◆ draw() [10/13]

void PCB_PAINTER::draw ( const ZONE aZone,
int  aLayer 
)
protected

Definition at line 1695 of file pcb_painter.cpp.

1696 {
1697  /*
1698  * aLayer will be the virtual zone layer (LAYER_ZONE_START, ... in GAL_LAYER_ID)
1699  * This is used for draw ordering in the GAL.
1700  * The color for the zone comes from the associated copper layer ( aLayer - LAYER_ZONE_START )
1701  * and the visibility comes from the combination of that copper layer and LAYER_ZONES
1702  */
1703  wxASSERT( IsZoneLayer( aLayer ) );
1704  PCB_LAYER_ID layer = static_cast<PCB_LAYER_ID>( aLayer - LAYER_ZONE_START );
1705 
1706  if( !aZone->IsOnLayer( layer ) )
1707  return;
1708 
1709  COLOR4D color = m_pcbSettings.GetColor( aZone, layer );
1710  std::deque<VECTOR2D> corners;
1712 
1713  // Draw the outline
1714  const SHAPE_POLY_SET* outline = aZone->Outline();
1715 
1716  if( m_pcbSettings.m_zoneOutlines && outline && outline->OutlineCount() > 0 )
1717  {
1718  m_gal->SetStrokeColor( color.a > 0.0 ? color.WithAlpha( 1.0 ) : color );
1719  m_gal->SetIsFill( false );
1720  m_gal->SetIsStroke( true );
1722 
1723  // Draw each contour (main contour and holes)
1724 
1725  /* This line:
1726  * m_gal->DrawPolygon( *outline );
1727  * should be enough, but currently does not work to draw holes contours in a complex polygon
1728  * so each contour is draw as a simple polygon
1729  */
1730 
1731  // Draw the main contour
1732  m_gal->DrawPolyline( outline->COutline( 0 ) );
1733 
1734  // Draw holes
1735  int holes_count = outline->HoleCount( 0 );
1736 
1737  for( int ii = 0; ii < holes_count; ++ii )
1738  m_gal->DrawPolyline( outline->CHole( 0, ii ) );
1739 
1740  // Draw hatch lines
1741  for( const SEG& hatchLine : aZone->GetHatchLines() )
1742  m_gal->DrawLine( hatchLine.A, hatchLine.B );
1743  }
1744 
1745  // Draw the filling
1746  if( displayMode == ZONE_DISPLAY_MODE::SHOW_FILLED
1748  || displayMode == ZONE_DISPLAY_MODE::SHOW_TRIANGULATION )
1749  {
1750  const SHAPE_POLY_SET& polySet = aZone->GetFilledPolysList( layer );
1751 
1752  if( polySet.OutlineCount() == 0 ) // Nothing to draw
1753  return;
1754 
1755  // Set up drawing options
1756  int outline_thickness = 0;
1757 
1758  if( aZone->GetFilledPolysUseThickness( layer ) )
1759  outline_thickness = aZone->GetMinThickness();
1760 
1762  m_gal->SetFillColor( color );
1763  m_gal->SetLineWidth( outline_thickness );
1764 
1765  if( displayMode == ZONE_DISPLAY_MODE::SHOW_FILLED )
1766  {
1767  m_gal->SetIsFill( true );
1768  m_gal->SetIsStroke( outline_thickness > 0 );
1769  }
1770  else
1771  {
1772  m_gal->SetIsFill( false );
1773  m_gal->SetIsStroke( true );
1774  }
1775 
1776  m_gal->DrawPolygon( polySet, displayMode == ZONE_DISPLAY_MODE::SHOW_TRIANGULATION );
1777  }
1778 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
virtual void DrawPolyline(const std::deque< VECTOR2D > &aPointList)
Draw a polyline.
int OutlineCount() const
Return the number of vertices in a given outline/hole.
SHAPE_POLY_SET * Outline()
Definition: zone.h:320
int color
Definition: DXF_plotter.cpp:57
virtual bool IsOnLayer(PCB_LAYER_ID) const override
Test to see if this object is on the given layer.
Definition: zone.cpp:316
const SHAPE_POLY_SET & GetFilledPolysList(PCB_LAYER_ID aLayer) const
Definition: zone.h:635
const SHAPE_LINE_CHAIN & CHole(int aOutline, int aHole) const
PCB_RENDER_SETTINGS m_pcbSettings
Definition: pcb_painter.h:295
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
int GetMinThickness() const
Definition: zone.h:244
const std::vector< SEG > & GetHatchLines() const
Definition: zone.h:800
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
Represent a set of closed polygons.
Virtual layers for stacking zones and tracks on a given copper layer.
Definition: layer_ids.h:241
int HoleCount(int aOutline) const
Return the reference to aIndex-th outline in the set.
Definition: seg.h:40
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual void DrawPolygon(const std::deque< VECTOR2D > &aPointList)
Draw a polygon.
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:64
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
virtual COLOR4D GetColor(const VIEW_ITEM *aItem, int aLayer) const override
Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using curr...
bool IsZoneLayer(LAYER_NUM aLayer)
Definition: layer_ids.h:962
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
ZONE_DISPLAY_MODE m_zoneDisplayMode
Definition: pcb_painter.h:212
bool GetFilledPolysUseThickness() const
Definition: zone.h:689
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References SHAPE_POLY_SET::CHole(), color, SHAPE_POLY_SET::COutline(), KIGFX::GAL::DrawLine(), KIGFX::GAL::DrawPolygon(), KIGFX::GAL::DrawPolyline(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), ZONE::GetFilledPolysList(), ZONE::GetFilledPolysUseThickness(), ZONE::GetHatchLines(), ZONE::GetMinThickness(), SHAPE_POLY_SET::HoleCount(), ZONE::IsOnLayer(), IsZoneLayer(), LAYER_ZONE_START, KIGFX::PAINTER::m_gal, KIGFX::RENDER_SETTINGS::m_outlineWidth, m_pcbSettings, KIGFX::PCB_RENDER_SETTINGS::m_zoneDisplayMode, KIGFX::PCB_RENDER_SETTINGS::m_zoneOutlines, ZONE::Outline(), SHAPE_POLY_SET::OutlineCount(), KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), SHOW_FILLED, SHOW_FRACTURE_BORDERS, and SHOW_TRIANGULATION.

◆ draw() [11/13]

void PCB_PAINTER::draw ( const PCB_DIMENSION_BASE aDimension,
int  aLayer 
)
protected

Definition at line 1781 of file pcb_painter.cpp.

1782 {
1783  const COLOR4D& strokeColor = m_pcbSettings.GetColor( aDimension, aLayer );
1784 
1785  m_gal->SetStrokeColor( strokeColor );
1786  m_gal->SetIsFill( false );
1787  m_gal->SetIsStroke( true );
1788 
1790  {
1791  // Outline mode
1793  }
1794  else
1795  {
1796  // Filled mode
1797  m_gal->SetLineWidth( getLineThickness( aDimension->GetLineThickness() ) );
1798  }
1799 
1800  // Draw dimension shapes
1801  // TODO(JE) lift this out
1802  for( const std::shared_ptr<SHAPE>& shape : aDimension->GetShapes() )
1803  {
1804  switch( shape->Type() )
1805  {
1806  case SH_SEGMENT:
1807  {
1808  const SEG& seg = static_cast<const SHAPE_SEGMENT*>( shape.get() )->GetSeg();
1809  m_gal->DrawLine( seg.A, seg.B );
1810  break;
1811  }
1812 
1813  case SH_CIRCLE:
1814  {
1815  int radius = static_cast<const SHAPE_CIRCLE*>( shape.get() )->GetRadius();
1816  m_gal->DrawCircle( shape->Centre(), radius );
1817  break;
1818  }
1819 
1820  default:
1821  break;
1822  }
1823  }
1824 
1825  // Draw text
1826  const PCB_TEXT& text = aDimension->Text();
1827  VECTOR2D position( text.GetTextPos().x, text.GetTextPos().y );
1828 
1830  {
1831  // Outline mode
1833  }
1834  else
1835  {
1836  // Filled mode
1837  m_gal->SetLineWidth( getLineThickness( text.GetEffectiveTextPenWidth() ) );
1838  }
1839 
1840  m_gal->SetTextAttributes( &text );
1841  m_gal->StrokeText( text.GetShownText(), position, text.GetTextAngleRadians() );
1842 }
PCB_TEXT & Text()
virtual void SetTextAttributes(const EDA_TEXT *aText)
Loads attributes of the given text (bold/italic/underline/mirrored and so on).
Define a general 2D-vector/point.
Definition: vector2d.h:61
const std::vector< std::shared_ptr< SHAPE > > & GetShapes() const
PCB_RENDER_SETTINGS m_pcbSettings
Definition: pcb_painter.h:295
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
int getLineThickness(int aActualThickness) const
Get the thickness to draw for a line (e.g.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void StrokeText(const wxString &aText, const VECTOR2D &aPosition, double aRotationAngle)
Draw a vector type text using preloaded Newstroke font.
circle
Definition: shape.h:46
Definition: seg.h:40
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.
virtual COLOR4D GetColor(const VIEW_ITEM *aItem, int aLayer) const override
Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using curr...
VECTOR2I A
Definition: seg.h:48
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
int GetLineThickness() const
line segment
Definition: shape.h:44
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103
VECTOR2I B
Definition: seg.h:49

References SEG::A, SEG::B, KIGFX::GAL::DrawCircle(), KIGFX::GAL::DrawLine(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), PCB_DIMENSION_BASE::GetLineThickness(), getLineThickness(), PCB_DIMENSION_BASE::GetShapes(), KIGFX::PAINTER::m_gal, KIGFX::RENDER_SETTINGS::m_outlineWidth, m_pcbSettings, KIGFX::PCB_RENDER_SETTINGS::m_sketchGraphics, KIGFX::PCB_RENDER_SETTINGS::m_sketchText, KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), KIGFX::GAL::SetTextAttributes(), SH_CIRCLE, SH_SEGMENT, KIGFX::GAL::StrokeText(), PCB_DIMENSION_BASE::Text(), and text.

◆ draw() [12/13]

void PCB_PAINTER::draw ( const PCB_TARGET aTarget)
protected

Definition at line 1845 of file pcb_painter.cpp.

1846 {
1847  const COLOR4D& strokeColor = m_pcbSettings.GetColor( aTarget, aTarget->GetLayer() );
1848  VECTOR2D position( aTarget->GetPosition() );
1849  double size, radius;
1850 
1851  m_gal->SetLineWidth( getLineThickness( aTarget->GetWidth() ) );
1852  m_gal->SetStrokeColor( strokeColor );
1853  m_gal->SetIsFill( false );
1854  m_gal->SetIsStroke( true );
1855 
1856  m_gal->Save();
1857  m_gal->Translate( position );
1858 
1859  if( aTarget->GetShape() )
1860  {
1861  // shape x
1862  m_gal->Rotate( M_PI / 4.0 );
1863  size = 2.0 * aTarget->GetSize() / 3.0;
1864  radius = aTarget->GetSize() / 2.0;
1865  }
1866  else
1867  {
1868  // shape +
1869  size = aTarget->GetSize() / 2.0;
1870  radius = aTarget->GetSize() / 3.0;
1871  }
1872 
1873  m_gal->DrawLine( VECTOR2D( -size, 0.0 ), VECTOR2D( size, 0.0 ) );
1874  m_gal->DrawLine( VECTOR2D( 0.0, -size ), VECTOR2D( 0.0, size ) );
1875  m_gal->DrawCircle( VECTOR2D( 0.0, 0.0 ), radius );
1876 
1877  m_gal->Restore();
1878 }
int GetSize() const
Definition: pcb_target.h:62
Define a general 2D-vector/point.
Definition: vector2d.h:61
PCB_RENDER_SETTINGS m_pcbSettings
Definition: pcb_painter.h:295
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
virtual void Rotate(double aAngle)
Rotate the context.
wxPoint GetPosition() const override
Definition: pcb_target.h:56
int GetWidth() const
Definition: pcb_target.h:65
int getLineThickness(int aActualThickness) const
Get the thickness to draw for a line (e.g.
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual void Restore()
Restore the context.
virtual void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.
virtual COLOR4D GetColor(const VIEW_ITEM *aItem, int aLayer) const override
Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using curr...
int GetShape() const
Definition: pcb_target.h:59
virtual void Save()
Save the context.
virtual void Translate(const VECTOR2D &aTranslation)
Translate the context.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:171
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References KIGFX::GAL::DrawCircle(), KIGFX::GAL::DrawLine(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), BOARD_ITEM::GetLayer(), getLineThickness(), PCB_TARGET::GetPosition(), PCB_TARGET::GetShape(), PCB_TARGET::GetSize(), PCB_TARGET::GetWidth(), KIGFX::PAINTER::m_gal, m_pcbSettings, KIGFX::GAL::Restore(), KIGFX::GAL::Rotate(), KIGFX::GAL::Save(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), and KIGFX::GAL::Translate().

◆ draw() [13/13]

void PCB_PAINTER::draw ( const PCB_MARKER aMarker,
int  aLayer 
)
protected

Definition at line 1881 of file pcb_painter.cpp.

1882 {
1883  bool isShadow = aLayer == LAYER_MARKER_SHADOWS;
1884 
1885  // Don't paint shadows for invisible markers.
1886  // It would be nice to do this through layer dependencies but we can't do an "or" there today
1887  if( isShadow && aMarker->GetBoard()
1888  && !aMarker->GetBoard()->IsElementVisible( aMarker->GetColorLayer() ) )
1889  {
1890  return;
1891  }
1892 
1893  SHAPE_LINE_CHAIN polygon;
1894  aMarker->ShapeToPolygon( polygon );
1895 
1897  : aMarker->GetColorLayer() );
1898 
1899  m_gal->Save();
1900  m_gal->Translate( aMarker->GetPosition() );
1901 
1902  if( isShadow )
1903  {
1905  m_gal->SetIsStroke( true );
1906  m_gal->SetLineWidth( aMarker->MarkerScale() );
1907  }
1908  else
1909  {
1910  m_gal->SetFillColor( color );
1911  m_gal->SetIsFill( true );
1912  }
1913 
1914  m_gal->DrawPolygon( polygon );
1915  m_gal->Restore();
1916 }
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
int color
Definition: DXF_plotter.cpp:57
PCB_RENDER_SETTINGS m_pcbSettings
Definition: pcb_painter.h:295
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101
virtual void SetLineWidth(float aLineWidth)
Set the line width.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
shadows for drc markers
Definition: layer_ids.h:232
GAL_LAYER_ID GetColorLayer() const
Definition: pcb_marker.cpp:180
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
Definition: board.cpp:532
void ShapeToPolygon(SHAPE_LINE_CHAIN &aPolygon, int aScale=-1) const
Return the shape polygon in internal units in a SHAPE_LINE_CHAIN the coordinates are relatives to the...
int MarkerScale() const
The scaling factor to convert polygonal shape coordinates to internal units.
Definition: marker_base.h:66
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual void Restore()
Restore the context.
virtual void DrawPolygon(const std::deque< VECTOR2D > &aPointList)
Draw a polygon.
Represent a polyline (an zero-thickness chain of connected line segments).
virtual COLOR4D GetColor(const VIEW_ITEM *aItem, int aLayer) const override
Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using curr...
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:50
virtual void Save()
Save the context.
virtual void Translate(const VECTOR2D &aTranslation)
Translate the context.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
wxPoint GetPosition() const override
Definition: pcb_marker.h:67
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:103

References color, KIGFX::GAL::DrawPolygon(), BOARD_ITEM::GetBoard(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), PCB_MARKER::GetColorLayer(), PCB_MARKER::GetPosition(), BOARD::IsElementVisible(), LAYER_MARKER_SHADOWS, KIGFX::PAINTER::m_gal, m_pcbSettings, MARKER_BASE::MarkerScale(), KIGFX::GAL::Restore(), KIGFX::GAL::Save(), KIGFX::GAL::SetFillColor(), KIGFX::GAL::SetIsFill(), KIGFX::GAL::SetIsStroke(), KIGFX::GAL::SetLineWidth(), KIGFX::GAL::SetStrokeColor(), MARKER_BASE::ShapeToPolygon(), and KIGFX::GAL::Translate().

◆ getDrillShape()

int PCB_PAINTER::getDrillShape ( const PAD aPad) const
protectedvirtual

Return drill shape of a pad.

Reimplemented in KIGFX::PCB_PRINT_PAINTER.

Definition at line 443 of file pcb_painter.cpp.

444 {
445  return aPad->GetDrillShape();
446 }
PAD_DRILL_SHAPE_T GetDrillShape() const
Definition: pad.h:354

References PAD::GetDrillShape().

Referenced by KIGFX::PCB_PRINT_PAINTER::getDrillShape().

◆ getDrillSize() [1/2]

VECTOR2D PCB_PAINTER::getDrillSize ( const PAD aPad) const
protectedvirtual

Return drill size for a pad (internal units).

Reimplemented in KIGFX::PCB_PRINT_PAINTER.

Definition at line 449 of file pcb_painter.cpp.

450 {
451  return VECTOR2D( aPad->GetDrillSize() );
452 }
const wxSize & GetDrillSize() const
Definition: pad.h:243
VECTOR2< double > VECTOR2D
Definition: vector2d.h:622

References PAD::GetDrillSize().

Referenced by draw(), and KIGFX::PCB_PRINT_PAINTER::getDrillSize().

◆ getDrillSize() [2/2]

int PCB_PAINTER::getDrillSize ( const PCB_VIA aVia) const
protectedvirtual

Return drill diameter for a via (internal units).

Reimplemented in KIGFX::PCB_PRINT_PAINTER.

Definition at line 455 of file pcb_painter.cpp.

456 {
457  return aVia->GetDrillValue();
458 }
int GetDrillValue() const
Function GetDrillValue "calculates" the drill value for vias (m-Drill if > 0, or default drill value ...
Definition: pcb_track.cpp:193

References PCB_VIA::GetDrillValue().

◆ getLineThickness()

int PCB_PAINTER::getLineThickness ( int  aActualThickness) const
protected

Get the thickness to draw for a line (e.g.

0 thickness lines get a minimum value).

Parameters
aActualThicknessline own thickness
Returns
the thickness to draw

Definition at line 431 of file pcb_painter.cpp.

432 {
433  // if items have 0 thickness, draw them with the outline
434  // width, otherwise respect the set value (which, no matter
435  // how small will produce something)
436  if( aActualThickness == 0 )
438 
439  return aActualThickness;
440 }
PCB_RENDER_SETTINGS m_pcbSettings
Definition: pcb_painter.h:295

References KIGFX::RENDER_SETTINGS::m_outlineWidth, and m_pcbSettings.

Referenced by draw().

◆ GetSettings()

virtual PCB_RENDER_SETTINGS* KIGFX::PCB_PAINTER::GetSettings ( )
inlineoverridevirtual

Return a pointer to current settings that are going to be used when drawing items.

Returns
Current rendering settings.

Implements KIGFX::PAINTER.

Definition at line 247 of file pcb_painter.h.

248  {
249  return &m_pcbSettings;
250  }
PCB_RENDER_SETTINGS m_pcbSettings
Definition: pcb_painter.h:295

References m_pcbSettings.

Referenced by APPEARANCE_CONTROLS::OnLayerAlphaChanged(), PCBNEW_PRINTOUT::setupPainter(), PANEL_DISPLAY_OPTIONS::TransferDataFromWindow(), PANEL_EDIT_OPTIONS::TransferDataFromWindow(), PCB_TRACK::ViewGetLOD(), PCB_VIA::ViewGetLOD(), and PAD::ViewGetLOD().

◆ SetGAL()

void KIGFX::PAINTER::SetGAL ( GAL aGal)
inlineinherited

Changes Graphics Abstraction Layer used for drawing items for a new one.

Parameters
aGalis the new GAL instance.

Definition at line 75 of file painter.h.

76  {
77  m_gal = aGal;
78  }
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Definition: painter.h:101

References KIGFX::PAINTER::m_gal.

Member Data Documentation

◆ m_gal

◆ m_holePlatingThickness

int KIGFX::PCB_PAINTER::m_holePlatingThickness
protected

Definition at line 298 of file pcb_painter.h.

Referenced by Draw(), and draw().

◆ m_maxError

int KIGFX::PCB_PAINTER::m_maxError
protected

Definition at line 297 of file pcb_painter.h.

Referenced by Draw(), and draw().

◆ m_pcbSettings

PCB_RENDER_SETTINGS KIGFX::PCB_PAINTER::m_pcbSettings
protected

The documentation for this class was generated from the following files: