KiCad PCB EDA Suite
PNS_PCBNEW_DEBUG_DECORATOR Class Reference
Inheritance diagram for PNS_PCBNEW_DEBUG_DECORATOR:
PNS::DEBUG_DECORATOR

Public Member Functions

 PNS_PCBNEW_DEBUG_DECORATOR (KIGFX::VIEW *aView=NULL)
 
 ~PNS_PCBNEW_DEBUG_DECORATOR ()
 
void SetView (KIGFX::VIEW *aView)
 
void AddPoint (VECTOR2I aP, int aColor, const std::string aName="") override
 
void AddBox (BOX2I aB, int aColor, const std::string aName="") override
 
void AddSegment (SEG aS, int aColor, const std::string aName="") override
 
void AddDirections (VECTOR2D aP, int aMask, int aColor, const std::string aName="") override
 
void AddLine (const SHAPE_LINE_CHAIN &aLine, int aType, int aWidth, const std::string aName="") override
 
void Clear () override
 

Private Attributes

KIGFX::VIEWm_view
 
KIGFX::VIEW_GROUPm_items
 

Detailed Description

Definition at line 414 of file pns_kicad_iface.cpp.

Constructor & Destructor Documentation

◆ PNS_PCBNEW_DEBUG_DECORATOR()

PNS_PCBNEW_DEBUG_DECORATOR::PNS_PCBNEW_DEBUG_DECORATOR ( KIGFX::VIEW aView = NULL)
inline

Definition at line 417 of file pns_kicad_iface.cpp.

418  m_view( NULL ), m_items( NULL )
419  {
420  SetView( aView );
421  }
KIGFX::VIEW_GROUP * m_items
#define NULL
void SetView(KIGFX::VIEW *aView)

References SetView().

◆ ~PNS_PCBNEW_DEBUG_DECORATOR()

PNS_PCBNEW_DEBUG_DECORATOR::~PNS_PCBNEW_DEBUG_DECORATOR ( )
inline

Definition at line 423 of file pns_kicad_iface.cpp.

424  {
425  Clear();
426  delete m_items;
427  }
KIGFX::VIEW_GROUP * m_items

References Clear(), and m_items.

Member Function Documentation

◆ AddBox()

void PNS_PCBNEW_DEBUG_DECORATOR::AddBox ( BOX2I  aB,
int  aColor,
const std::string  aName = "" 
)
inlineoverridevirtual

Reimplemented from PNS::DEBUG_DECORATOR.

Definition at line 460 of file pns_kicad_iface.cpp.

461  {
463 
464  VECTOR2I o = aB.GetOrigin();
465  VECTOR2I s = aB.GetSize();
466 
467  l.Append( o );
468  l.Append( o.x + s.x, o.y );
469  l.Append( o.x + s.x, o.y + s.y );
470  l.Append( o.x, o.y + s.y );
471  l.Append( o );
472 
473  AddLine( l, aColor, 10000 );
474  }
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
SHAPE_LINE_CHAIN.
const Vec & GetSize() const
Definition: box2.h:188
const Vec & GetOrigin() const
Definition: box2.h:192
void AddLine(const SHAPE_LINE_CHAIN &aLine, int aType, int aWidth, const std::string aName="") override

References AddLine(), SHAPE_LINE_CHAIN::Append(), BOX2< Vec >::GetOrigin(), BOX2< Vec >::GetSize(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by AddDirections().

◆ AddDirections()

void PNS_PCBNEW_DEBUG_DECORATOR::AddDirections ( VECTOR2D  aP,
int  aMask,
int  aColor,
const std::string  aName = "" 
)
inlineoverridevirtual

Reimplemented from PNS::DEBUG_DECORATOR.

Definition at line 486 of file pns_kicad_iface.cpp.

487  {
488  BOX2I b( aP - VECTOR2I( 10000, 10000 ), VECTOR2I( 20000, 20000 ) );
489 
490  AddBox( b, aColor );
491  for( int i = 0; i < 8; i++ )
492  {
493  if( ( 1 << i ) & aMask )
494  {
495  VECTOR2I v = DIRECTION_45( ( DIRECTION_45::Directions ) i ).ToVector() * 100000;
496  AddSegment( SEG( aP, aP + v ), aColor );
497  }
498  }
499  }
Directions
Enum Directions Represents available directions - there are 8 of them, as on a rectilinear map (north...
Definition: direction45.h:46
void AddSegment(SEG aS, int aColor, const std::string aName="") override
const VECTOR2I ToVector() const
Function ToVector()
Definition: direction45.h:269
void AddBox(BOX2I aB, int aColor, const std::string aName="") override
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
DIRECTION_45.
Definition: direction45.h:37
Definition: seg.h:39

References AddBox(), AddSegment(), and DIRECTION_45::ToVector().

◆ AddLine()

void PNS_PCBNEW_DEBUG_DECORATOR::AddLine ( const SHAPE_LINE_CHAIN aLine,
int  aType,
int  aWidth,
const std::string  aName = "" 
)
inlineoverridevirtual

Reimplemented from PNS::DEBUG_DECORATOR.

Definition at line 501 of file pns_kicad_iface.cpp.

502  {
503  if( !m_view )
504  return;
505 
507 
508  pitem->Line( aLine, aWidth, aType );
509  m_items->Add( pitem ); // Should not be needed, as m_items has been passed as a parent group in alloc;
510  m_view->Update( m_items );
511  }
void Line(const SHAPE_LINE_CHAIN &aLine, int aWidth=0, int aStyle=0)
KIGFX::VIEW_GROUP * m_items
#define NULL
virtual void Add(VIEW_ITEM *aItem)
Function Add() Adds an item to the group.
Definition: view_group.cpp:55
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1540

References KIGFX::VIEW_GROUP::Add(), ROUTER_PREVIEW_ITEM::Line(), m_items, m_view, NULL, and KIGFX::VIEW::Update().

Referenced by AddBox(), AddPoint(), and AddSegment().

◆ AddPoint()

void PNS_PCBNEW_DEBUG_DECORATOR::AddPoint ( VECTOR2I  aP,
int  aColor,
const std::string  aName = "" 
)
inlineoverridevirtual

Reimplemented from PNS::DEBUG_DECORATOR.

Definition at line 444 of file pns_kicad_iface.cpp.

445  {
447 
448  l.Append( aP - VECTOR2I( -50000, -50000 ) );
449  l.Append( aP + VECTOR2I( -50000, -50000 ) );
450 
451  AddLine( l, aColor, 10000 );
452 
453  l.Clear();
454  l.Append( aP - VECTOR2I( 50000, -50000 ) );
455  l.Append( aP + VECTOR2I( 50000, -50000 ) );
456 
457  AddLine( l, aColor, 10000 );
458  }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:594
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
SHAPE_LINE_CHAIN.
void Clear()
Function Clear() Removes all points from the line chain.
void AddLine(const SHAPE_LINE_CHAIN &aLine, int aType, int aWidth, const std::string aName="") override

References AddLine(), SHAPE_LINE_CHAIN::Append(), and SHAPE_LINE_CHAIN::Clear().

◆ AddSegment()

void PNS_PCBNEW_DEBUG_DECORATOR::AddSegment ( SEG  aS,
int  aColor,
const std::string  aName = "" 
)
inlineoverridevirtual

Reimplemented from PNS::DEBUG_DECORATOR.

Definition at line 476 of file pns_kicad_iface.cpp.

477  {
479 
480  l.Append( aS.A );
481  l.Append( aS.B );
482 
483  AddLine( l, aColor, 10000 );
484  }
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
SHAPE_LINE_CHAIN.
VECTOR2I A
Definition: seg.h:47
void AddLine(const SHAPE_LINE_CHAIN &aLine, int aType, int aWidth, const std::string aName="") override
VECTOR2I B
Definition: seg.h:48

References SEG::A, AddLine(), SHAPE_LINE_CHAIN::Append(), and SEG::B.

Referenced by AddDirections().

◆ Clear()

void PNS_PCBNEW_DEBUG_DECORATOR::Clear ( )
inlineoverridevirtual

Reimplemented from PNS::DEBUG_DECORATOR.

Definition at line 513 of file pns_kicad_iface.cpp.

514  {
515  if( m_view && m_items )
516  {
517  m_items->FreeItems();
518  m_view->Update( m_items );
519  }
520  }
KIGFX::VIEW_GROUP * m_items
void FreeItems()
Function FreeItems() Frees all the items that were added to the group.
Definition: view_group.cpp:197
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags)
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: view.cpp:1540

References KIGFX::VIEW_GROUP::FreeItems(), m_items, m_view, and KIGFX::VIEW::Update().

Referenced by SetView(), and ~PNS_PCBNEW_DEBUG_DECORATOR().

◆ SetView()

void PNS_PCBNEW_DEBUG_DECORATOR::SetView ( KIGFX::VIEW aView)
inline

Definition at line 429 of file pns_kicad_iface.cpp.

430  {
431  Clear();
432  delete m_items;
433  m_items = NULL;
434  m_view = aView;
435 
436  if( m_view == NULL )
437  return;
438 
441  m_view->Add( m_items );
442  }
KIGFX::VIEW_GROUP * m_items
#define NULL
virtual void SetLayer(int aLayer)
Function SetLayer() Sets layer used to draw the group.
Definition: view_group.h:115
currently selected items overlay
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Function Add() Adds a VIEW_ITEM to the view.
Definition: view.cpp:346

References KIGFX::VIEW::Add(), Clear(), LAYER_SELECT_OVERLAY, m_items, m_view, NULL, and KIGFX::VIEW_GROUP::SetLayer().

Referenced by PNS_PCBNEW_DEBUG_DECORATOR().

Member Data Documentation

◆ m_items

KIGFX::VIEW_GROUP* PNS_PCBNEW_DEBUG_DECORATOR::m_items
private

Definition at line 524 of file pns_kicad_iface.cpp.

Referenced by AddLine(), Clear(), SetView(), and ~PNS_PCBNEW_DEBUG_DECORATOR().

◆ m_view

KIGFX::VIEW* PNS_PCBNEW_DEBUG_DECORATOR::m_view
private

Definition at line 523 of file pns_kicad_iface.cpp.

Referenced by AddLine(), Clear(), and SetView().


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