KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pns_test_debug_decorator.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2020-2021 KiCad Developers.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24#ifndef __PNS_TEST_DEBUG_DECORATOR_H
25#define __PNS_TEST_DEBUG_DECORATOR_H
26
27#include <geometry/shape.h>
28
30
31class REPORTER;
32
34{
35public:
36 PNS_DEBUG_SHAPE( PNS_DEBUG_SHAPE* aParent = nullptr );
38
40 void AddChild( PNS_DEBUG_SHAPE* ent );
41 bool IsVisible() const;
42 void IterateTree( std::function<bool( PNS_DEBUG_SHAPE* )> visitor, int depth = 0 );
43
45 std::vector<SHAPE*> m_shapes;
46 std::vector<PNS_DEBUG_SHAPE*> m_children;
49 bool m_hasLabels = true;
50 int m_iter;
51 wxString m_name;
52 wxString m_msg;
58};
59
61{
64
65 wxString m_name;
66 int m_iter;
69};
70
71
73{
74public:
77
78 virtual void SetIteration( int iter ) override { m_iter = iter; }
79
80 virtual void Message( const wxString& msg,
81 const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override;
82 virtual void NewStage( const wxString& name, int iter,
83 const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override;
84 virtual void BeginGroup( const wxString& name, int aLevel = 0,
85 const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override;
86 virtual void EndGroup( const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override;
87
88 virtual void AddPoint( const VECTOR2I& aP, const KIGFX::COLOR4D& aColor, int aSize,
89 const wxString& aName = wxT( "" ),
90 const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override;
91
92 virtual void AddItem( const PNS::ITEM* aItem, const KIGFX::COLOR4D& aColor,
93 int aOverrideWidth = 0, const wxString& aName = wxT( "" ),
94 const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override;
95
96 virtual void AddShape( const SHAPE* aShape, const KIGFX::COLOR4D& aColor,
97 int aOverrideWidth = 0, const wxString& aName = wxT( "" ),
98 const SRC_LOCATION_INFO& aSrcLoc = SRC_LOCATION_INFO() ) override;
99
100 virtual void Clear() override{};
101
102 int GetStageCount() const { return m_stages.size(); }
103
104 PNS_DEBUG_STAGE* GetStage( int index ) { return m_stages[index]; }
105
106 BOX2I GetStageExtents( int stage ) const;
107
108 void SetCurrentStageStatus( bool stat );
109
110private:
111 void addEntry( PNS_DEBUG_SHAPE* ent );
113
117 std::vector<PNS_DEBUG_STAGE*> m_stages;
118
120};
121
122#endif
const char * name
Definition: DXF_plotter.cpp:57
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Base class for PNS router board items.
Definition: pns_item.h:97
std::vector< SHAPE * > m_shapes
PNS_DEBUG_SHAPE * NewChild()
void IterateTree(std::function< bool(PNS_DEBUG_SHAPE *)> visitor, int depth=0)
void AddChild(PNS_DEBUG_SHAPE *ent)
PNS_DEBUG_SHAPE * m_parent
PNS::DEBUG_DECORATOR::SRC_LOCATION_INFO m_srcLoc
std::vector< PNS_DEBUG_SHAPE * > m_children
virtual 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 addEntry(PNS_DEBUG_SHAPE *ent)
virtual 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()) override
std::vector< PNS_DEBUG_STAGE * > m_stages
BOX2I GetStageExtents(int stage) const
virtual void Message(const wxString &msg, const SRC_LOCATION_INFO &aSrcLoc=SRC_LOCATION_INFO()) override
PNS_DEBUG_STAGE * GetStage(int index)
virtual void BeginGroup(const wxString &name, int aLevel=0, const SRC_LOCATION_INFO &aSrcLoc=SRC_LOCATION_INFO()) override
virtual void EndGroup(const SRC_LOCATION_INFO &aSrcLoc=SRC_LOCATION_INFO()) override
virtual void SetIteration(int iter) override
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()) override
virtual void NewStage(const wxString &name, int iter, const SRC_LOCATION_INFO &aSrcLoc=SRC_LOCATION_INFO()) override
virtual void Clear() override
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:72
An abstract shape on 2D plane.
Definition: shape.h:126
PNS_DEBUG_SHAPE * m_entries