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=nullptr)
 
 ~PNS_PCBNEW_DEBUG_DECORATOR ()
 
void SetView (KIGFX::VIEW *aView)
 
void AddPoint (const VECTOR2I &aP, const KIGFX::COLOR4D &aColor, int aSize, const wxString &aName=wxT(""), const SRC_LOCATION_INFO &aSrcLoc=SRC_LOCATION_INFO()) override
 
void AddItem (const PNS::ITEM *aItem, const KIGFX::COLOR4D &aColor, int aOverrideWidth=0, const wxString &aName=wxT(""), const SRC_LOCATION_INFO &aSrcLoc=SRC_LOCATION_INFO())
 
void AddShape (const BOX2I &aBox, const KIGFX::COLOR4D &aColor, int aOverrideWidth=0, const wxString &aName=wxT(""), const SRC_LOCATION_INFO &aSrcLoc=SRC_LOCATION_INFO()) override
 
void AddShape (const SHAPE *aShape, const KIGFX::COLOR4D &aColor, int aOverrideWidth=0, const wxString &aName=wxT(""), const SRC_LOCATION_INFO &aSrcLoc=SRC_LOCATION_INFO())
 
void Clear () override
 
void SetDebugEnabled (bool aEnabled)
 
bool IsDebugEnabled () const
 
virtual void SetIteration (int iter)
 
virtual void Message (const wxString &msg, const SRC_LOCATION_INFO &aSrcLoc=SRC_LOCATION_INFO())
 
virtual void NewStage (const wxString &name, int iter, const SRC_LOCATION_INFO &aSrcLoc=SRC_LOCATION_INFO())
 
virtual void BeginGroup (const wxString &name, int aLevel=0, const SRC_LOCATION_INFO &aSrcLoc=SRC_LOCATION_INFO())
 
virtual void EndGroup (const SRC_LOCATION_INFO &aSrcLoc=SRC_LOCATION_INFO())
 
void AddShape (const SEG &aSeg, const KIGFX::COLOR4D &aColor, int aOverrideWidth=0, const wxString &aName=wxT(""), const SRC_LOCATION_INFO &aSrcLoc=SRC_LOCATION_INFO())
 

Private Member Functions

double nextDepth ()
 

Private Attributes

KIGFX::VIEWm_view
 
KIGFX::VIEW_GROUPm_items
 
double m_depth
 
bool m_debugEnabled
 

Detailed Description

Definition at line 879 of file pns_kicad_iface.cpp.

Constructor & Destructor Documentation

◆ PNS_PCBNEW_DEBUG_DECORATOR()

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

Definition at line 882 of file pns_kicad_iface.cpp.

882 :
884 m_view( nullptr ),
885 m_items( nullptr ),
886 m_depth( 0 )
887 {
888 SetView( aView );
889 }
void SetView(KIGFX::VIEW *aView)

References SetView().

◆ ~PNS_PCBNEW_DEBUG_DECORATOR()

PNS_PCBNEW_DEBUG_DECORATOR::~PNS_PCBNEW_DEBUG_DECORATOR ( )
inline

Definition at line 892 of file pns_kicad_iface.cpp.

893 {
895 delete m_items;
896 }

References Clear(), and m_items.

Member Function Documentation

◆ AddItem()

void PNS_PCBNEW_DEBUG_DECORATOR::AddItem ( const PNS::ITEM aItem,
const KIGFX::COLOR4D aColor,
int  aOverrideWidth = 0,
const wxString &  aName = wxT( "" ),
const SRC_LOCATION_INFO aSrcLoc = SRC_LOCATION_INFO() 
)
inlinevirtual

Reimplemented from PNS::DEBUG_DECORATOR.

Definition at line 937 of file pns_kicad_iface.cpp.

940 {
941 if( !m_view || !aItem )
942 return;
943
944 ROUTER_PREVIEW_ITEM* pitem = new ROUTER_PREVIEW_ITEM( aItem, m_view );
945
946 pitem->SetColor( aColor.WithAlpha( 0.5 ) );
947 pitem->SetWidth( aOverrideWidth );
948 pitem->SetDepth( nextDepth() );
949
950 m_items->Add( pitem );
952 }
COLOR4D WithAlpha(double aAlpha) const
Return a color with the same color, but the given alpha.
Definition: color4d.h:327
virtual void Add(VIEW_ITEM *aItem)
Add an item to the group.
Definition: view_group.cpp:57
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1591
void SetWidth(double aWidth)
void SetColor(const KIGFX::COLOR4D &aColor)
void SetDepth(double aDepth)

References KIGFX::VIEW_GROUP::Add(), m_items, m_view, nextDepth(), ROUTER_PREVIEW_ITEM::SetColor(), ROUTER_PREVIEW_ITEM::SetDepth(), ROUTER_PREVIEW_ITEM::SetWidth(), KIGFX::VIEW::Update(), and KIGFX::COLOR4D::WithAlpha().

◆ AddPoint()

void PNS_PCBNEW_DEBUG_DECORATOR::AddPoint ( const VECTOR2I aP,
const KIGFX::COLOR4D aColor,
int  aSize,
const wxString &  aName = wxT( "" ),
const SRC_LOCATION_INFO aSrcLoc = SRC_LOCATION_INFO() 
)
inlineoverridevirtual

Reimplemented from PNS::DEBUG_DECORATOR.

Definition at line 918 of file pns_kicad_iface.cpp.

922 {
924
925 sh.SetWidth( 10000 );
926
927 sh.Append( aP.x - aSize, aP.y - aSize );
928 sh.Append( aP.x + aSize, aP.y + aSize );
929 sh.Append( aP.x, aP.y );
930 sh.Append( aP.x - aSize, aP.y + aSize );
931 sh.Append( aP.x + aSize, aP.y - aSize );
932
933 AddShape( &sh, aColor, sh.Width(), aName, aSrcLoc );
934 }
void AddShape(const BOX2I &aBox, const KIGFX::COLOR4D &aColor, int aOverrideWidth=0, const wxString &aName=wxT(""), const SRC_LOCATION_INFO &aSrcLoc=SRC_LOCATION_INFO()) override
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
int Width() const
Get the current width of the segments in the chain.
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
void SetWidth(int aWidth)
Set the width of all segments in the chain.

References AddShape(), SHAPE_LINE_CHAIN::Append(), SHAPE_LINE_CHAIN::SetWidth(), SHAPE_LINE_CHAIN::Width(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ AddShape() [1/3]

void PNS_PCBNEW_DEBUG_DECORATOR::AddShape ( const BOX2I aBox,
const KIGFX::COLOR4D aColor,
int  aOverrideWidth = 0,
const wxString &  aName = wxT( "" ),
const SRC_LOCATION_INFO aSrcLoc = SRC_LOCATION_INFO() 
)
inlineoverridevirtual

Reimplemented from PNS::DEBUG_DECORATOR.

Definition at line 955 of file pns_kicad_iface.cpp.

958 {
960 l.SetWidth( aOverrideWidth );
961
962 VECTOR2I o = aBox.GetOrigin();
963 VECTOR2I s = aBox.GetSize();
964
965 l.Append( o );
966 l.Append( o.x + s.x, o.y );
967 l.Append( o.x + s.x, o.y + s.y );
968 l.Append( o.x, o.y + s.y );
969 l.Append( o );
970
971 AddShape( &l, aColor, aOverrideWidth, aName, aSrcLoc );
972 }
const Vec & GetOrigin() const
Definition: box2.h:183
const Vec & GetSize() const
Definition: box2.h:179

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

Referenced by AddPoint(), and AddShape().

◆ AddShape() [2/3]

void PNS::DEBUG_DECORATOR::AddShape ( const SEG aSeg,
const KIGFX::COLOR4D aColor,
int  aOverrideWidth = 0,
const wxString &  aName = wxT( "" ),
const SRC_LOCATION_INFO aSrcLoc = SRC_LOCATION_INFO() 
)
inlineinherited

Definition at line 97 of file pns_debug_decorator.h.

101 {
103 lc.Append( aSeg.A );
104 lc.Append( aSeg.B );
105 AddShape( &lc, aColor, aOverrideWidth, aName, aSrcLoc );
106 }
virtual void AddShape(const SHAPE *aShape, const KIGFX::COLOR4D &aColor, int aOverrideWidth=0, const wxString &aName=wxT(""), const SRC_LOCATION_INFO &aSrcLoc=SRC_LOCATION_INFO())
VECTOR2I A
Definition: seg.h:49
VECTOR2I B
Definition: seg.h:50

References SEG::A, PNS::DEBUG_DECORATOR::AddShape(), SHAPE_LINE_CHAIN::Append(), and SEG::B.

◆ AddShape() [3/3]

void PNS_PCBNEW_DEBUG_DECORATOR::AddShape ( const SHAPE aShape,
const KIGFX::COLOR4D aColor,
int  aOverrideWidth = 0,
const wxString &  aName = wxT( "" ),
const SRC_LOCATION_INFO aSrcLoc = SRC_LOCATION_INFO() 
)
inlinevirtual

Reimplemented from PNS::DEBUG_DECORATOR.

Definition at line 975 of file pns_kicad_iface.cpp.

978 {
979 if( !m_view || !aShape )
980 return;
981
982 ROUTER_PREVIEW_ITEM* pitem = new ROUTER_PREVIEW_ITEM( *aShape, m_view );
983
984 pitem->SetColor( aColor.WithAlpha( 0.5 ) );
985 pitem->SetWidth( aOverrideWidth );
986 pitem->SetDepth( nextDepth() );
987
988 m_items->Add( pitem );
990 }

References KIGFX::VIEW_GROUP::Add(), m_items, m_view, nextDepth(), ROUTER_PREVIEW_ITEM::SetColor(), ROUTER_PREVIEW_ITEM::SetDepth(), ROUTER_PREVIEW_ITEM::SetWidth(), KIGFX::VIEW::Update(), and KIGFX::COLOR4D::WithAlpha().

◆ BeginGroup()

virtual void PNS::DEBUG_DECORATOR::BeginGroup ( const wxString &  name,
int  aLevel = 0,
const SRC_LOCATION_INFO aSrcLoc = SRC_LOCATION_INFO() 
)
inlinevirtualinherited

Reimplemented in PNS_TEST_DEBUG_DECORATOR.

Definition at line 70 of file pns_debug_decorator.h.

71 {};

◆ Clear()

void PNS_PCBNEW_DEBUG_DECORATOR::Clear ( )
inlineoverridevirtual

Reimplemented from PNS::DEBUG_DECORATOR.

Definition at line 993 of file pns_kicad_iface.cpp.

994 {
995 if( m_view && m_items )
996 {
999
1000 if( m_view->GetGAL() )
1002 }
1003 }
double GetMinDepth() const
void FreeItems()
Free all the items that were added to the group.
Definition: view_group.cpp:191
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
Definition: view.h:195

References KIGFX::VIEW_GROUP::FreeItems(), KIGFX::VIEW::GetGAL(), KIGFX::GAL::GetMinDepth(), m_depth, m_items, m_view, and KIGFX::VIEW::Update().

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

◆ EndGroup()

virtual void PNS::DEBUG_DECORATOR::EndGroup ( const SRC_LOCATION_INFO aSrcLoc = SRC_LOCATION_INFO())
inlinevirtualinherited

Reimplemented in PNS_TEST_DEBUG_DECORATOR.

Definition at line 73 of file pns_debug_decorator.h.

73{};

◆ IsDebugEnabled()

bool PNS::DEBUG_DECORATOR::IsDebugEnabled ( ) const
inlineinherited

Definition at line 60 of file pns_debug_decorator.h.

References PNS::DEBUG_DECORATOR::m_debugEnabled.

◆ Message()

virtual void PNS::DEBUG_DECORATOR::Message ( const wxString &  msg,
const SRC_LOCATION_INFO aSrcLoc = SRC_LOCATION_INFO() 
)
inlinevirtualinherited

Reimplemented in PNS_TEST_DEBUG_DECORATOR.

Definition at line 64 of file pns_debug_decorator.h.

65 {};

◆ NewStage()

virtual void PNS::DEBUG_DECORATOR::NewStage ( const wxString &  name,
int  iter,
const SRC_LOCATION_INFO aSrcLoc = SRC_LOCATION_INFO() 
)
inlinevirtualinherited

Reimplemented in PNS_TEST_DEBUG_DECORATOR.

Definition at line 67 of file pns_debug_decorator.h.

68 {};

◆ nextDepth()

double PNS_PCBNEW_DEBUG_DECORATOR::nextDepth ( )
inlineprivate

Definition at line 1006 of file pns_kicad_iface.cpp.

1007 {
1008 // Use different depths so that the transculent shapes won't overwrite each other.
1009
1010 m_depth++;
1011
1012 if( m_depth >= 0 && m_view->GetGAL() )
1014
1015 return m_depth;
1016 }

References KIGFX::VIEW::GetGAL(), KIGFX::GAL::GetMinDepth(), m_depth, and m_view.

Referenced by AddItem(), and AddShape().

◆ SetDebugEnabled()

void PNS::DEBUG_DECORATOR::SetDebugEnabled ( bool  aEnabled)
inlineinherited

◆ SetIteration()

virtual void PNS::DEBUG_DECORATOR::SetIteration ( int  iter)
inlinevirtualinherited

Reimplemented in PNS_TEST_DEBUG_DECORATOR.

Definition at line 62 of file pns_debug_decorator.h.

62{};

Referenced by PNS::SHOVE::shoveIteration().

◆ SetView()

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

Definition at line 899 of file pns_kicad_iface.cpp.

900 {
901 Clear();
902 delete m_items;
903 m_items = nullptr;
904 m_view = aView;
905
906 if( m_view == nullptr )
907 return;
908
909 if( m_view->GetGAL() )
911
914 m_view->Add( m_items );
915 }
Extend VIEW_ITEM by possibility of grouping items into a single object.
Definition: view_group.h:47
virtual void SetLayer(int aLayer)
Set layer used to draw the group.
Definition: view_group.h:98
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:316
@ LAYER_SELECT_OVERLAY
currently selected items overlay
Definition: layer_ids.h:219

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

Referenced by PNS_PCBNEW_DEBUG_DECORATOR().

Member Data Documentation

◆ m_debugEnabled

bool PNS::DEBUG_DECORATOR::m_debugEnabled
privateinherited

◆ m_depth

double PNS_PCBNEW_DEBUG_DECORATOR::m_depth
private

Definition at line 1021 of file pns_kicad_iface.cpp.

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

◆ m_items

KIGFX::VIEW_GROUP* PNS_PCBNEW_DEBUG_DECORATOR::m_items
private

Definition at line 1019 of file pns_kicad_iface.cpp.

Referenced by AddItem(), AddShape(), Clear(), SetView(), and ~PNS_PCBNEW_DEBUG_DECORATOR().

◆ m_view

KIGFX::VIEW* PNS_PCBNEW_DEBUG_DECORATOR::m_view
private

Definition at line 1018 of file pns_kicad_iface.cpp.

Referenced by AddItem(), AddShape(), Clear(), nextDepth(), and SetView().


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