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) override
 
void AddBox (BOX2I aB, int aColor) override
 
void AddSegment (SEG aS, int aColor) override
 
void AddDirections (VECTOR2D aP, int aMask, int aColor) override
 
void AddLine (const SHAPE_LINE_CHAIN &aLine, int aType, int aWidth) override
 
void Clear () override
 

Private Attributes

KIGFX::VIEWm_view
 
KIGFX::VIEW_GROUPm_items
 

Detailed Description

Definition at line 346 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 349 of file pns_kicad_iface.cpp.

References SetView().

350  m_view( NULL ), m_items( NULL )
351  {
352  SetView( aView );
353  }
KIGFX::VIEW_GROUP * m_items
void SetView(KIGFX::VIEW *aView)

◆ ~PNS_PCBNEW_DEBUG_DECORATOR()

PNS_PCBNEW_DEBUG_DECORATOR::~PNS_PCBNEW_DEBUG_DECORATOR ( )
inline

Definition at line 355 of file pns_kicad_iface.cpp.

References Clear(), and m_items.

356  {
357  Clear();
358  delete m_items;
359  }
KIGFX::VIEW_GROUP * m_items

Member Function Documentation

◆ AddBox()

void PNS_PCBNEW_DEBUG_DECORATOR::AddBox ( BOX2I  aB,
int  aColor 
)
inlineoverridevirtual

Reimplemented from PNS::DEBUG_DECORATOR.

Definition at line 392 of file pns_kicad_iface.cpp.

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

Referenced by AddDirections().

393  {
395 
396  VECTOR2I o = aB.GetOrigin();
397  VECTOR2I s = aB.GetSize();
398 
399  l.Append( o );
400  l.Append( o.x + s.x, o.y );
401  l.Append( o.x + s.x, o.y + s.y );
402  l.Append( o.x, o.y + s.y );
403  l.Append( o );
404 
405  AddLine( l, aColor, 10000 );
406  }
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
Class SHAPE_LINE_CHAIN.
void AddLine(const SHAPE_LINE_CHAIN &aLine, int aType, int aWidth) override
const Vec & GetSize() const
Definition: box2.h:187
const Vec & GetOrigin() const
Definition: box2.h:191

◆ AddDirections()

void PNS_PCBNEW_DEBUG_DECORATOR::AddDirections ( VECTOR2D  aP,
int  aMask,
int  aColor 
)
inlineoverridevirtual

Reimplemented from PNS::DEBUG_DECORATOR.

Definition at line 418 of file pns_kicad_iface.cpp.

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

419  {
420  BOX2I b( aP - VECTOR2I( 10000, 10000 ), VECTOR2I( 20000, 20000 ) );
421 
422  AddBox( b, aColor );
423  for( int i = 0; i < 8; i++ )
424  {
425  if( ( 1 << i ) & aMask )
426  {
428  AddSegment( SEG( aP, aP + v ), aColor );
429  }
430  }
431  }
const VECTOR2I ToVector() const
Function ToVector()
Definition: direction45.h:298
void AddBox(BOX2I aB, int aColor) override
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587
Class DIRECTION_45.
Definition: direction45.h:36
Definition: seg.h:36
size_t i
Definition: json11.cpp:597
Directions
Enum Directions Represents available directions - there are 8 of them, as on a rectilinear map (north...
Definition: direction45.h:45
void AddSegment(SEG aS, int aColor) override

◆ AddLine()

void PNS_PCBNEW_DEBUG_DECORATOR::AddLine ( const SHAPE_LINE_CHAIN aLine,
int  aType,
int  aWidth 
)
inlineoverridevirtual

Reimplemented from PNS::DEBUG_DECORATOR.

Definition at line 433 of file pns_kicad_iface.cpp.

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

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

434  {
435  ROUTER_PREVIEW_ITEM* pitem = new ROUTER_PREVIEW_ITEM( NULL, m_view );
436 
437  pitem->Line( aLine, aWidth, aType );
438  m_items->Add( pitem ); // Should not be needed, as m_items has been passed as a parent group in alloc;
439  m_view->Update( m_items );
440  }
void Line(const SHAPE_LINE_CHAIN &aLine, int aWidth=0, int aStyle=0)
KIGFX::VIEW_GROUP * m_items
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:1539

◆ AddPoint()

void PNS_PCBNEW_DEBUG_DECORATOR::AddPoint ( VECTOR2I  aP,
int  aColor 
)
inlineoverridevirtual

Reimplemented from PNS::DEBUG_DECORATOR.

Definition at line 376 of file pns_kicad_iface.cpp.

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

377  {
379 
380  l.Append( aP - VECTOR2I( -50000, -50000 ) );
381  l.Append( aP + VECTOR2I( -50000, -50000 ) );
382 
383  AddLine( l, aColor, 10000 );
384 
385  l.Clear();
386  l.Append( aP - VECTOR2I( 50000, -50000 ) );
387  l.Append( aP + VECTOR2I( 50000, -50000 ) );
388 
389  AddLine( l, aColor, 10000 );
390  }
VECTOR2< int > VECTOR2I
Definition: vector2d.h:587
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
Class 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) override

◆ AddSegment()

void PNS_PCBNEW_DEBUG_DECORATOR::AddSegment ( SEG  aS,
int  aColor 
)
inlineoverridevirtual

Reimplemented from PNS::DEBUG_DECORATOR.

Definition at line 408 of file pns_kicad_iface.cpp.

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

Referenced by AddDirections().

409  {
411 
412  l.Append( aS.A );
413  l.Append( aS.B );
414 
415  AddLine( l, aColor, 10000 );
416  }
void Append(int aX, int aY, bool aAllowDuplication=false)
Function Append()
Class SHAPE_LINE_CHAIN.
VECTOR2I A
Definition: seg.h:44
void AddLine(const SHAPE_LINE_CHAIN &aLine, int aType, int aWidth) override
VECTOR2I B
Definition: seg.h:45

◆ Clear()

void PNS_PCBNEW_DEBUG_DECORATOR::Clear ( )
inlineoverridevirtual

Reimplemented from PNS::DEBUG_DECORATOR.

Definition at line 442 of file pns_kicad_iface.cpp.

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

Referenced by PNS_KICAD_IFACE::EraseView(), SetView(), and ~PNS_PCBNEW_DEBUG_DECORATOR().

443  {
444  if( m_view && m_items )
445  {
446  m_items->FreeItems();
447  m_view->Update( m_items );
448  }
449  }
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:1539

◆ SetView()

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

Definition at line 361 of file pns_kicad_iface.cpp.

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

Referenced by PNS_PCBNEW_DEBUG_DECORATOR(), and PNS_KICAD_IFACE::SetView().

362  {
363  Clear();
364  delete m_items;
365  m_items = NULL;
366  m_view = aView;
367 
368  if( m_view == NULL )
369  return;
370 
373  m_view->Add( m_items );
374  }
KIGFX::VIEW_GROUP * m_items
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

Member Data Documentation

◆ m_items

KIGFX::VIEW_GROUP* PNS_PCBNEW_DEBUG_DECORATOR::m_items
private

Definition at line 453 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 452 of file pns_kicad_iface.cpp.

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


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