KiCad PCB EDA Suite
Loading...
Searching...
No Matches
length_delay_calculation_item.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 The KiCad Developers, see AUTHORS.txt for contributors.
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 PCBNEW_LENGTH_DELAY_CALCULATION_ITEM_H
25#define PCBNEW_LENGTH_DELAY_CALCULATION_ITEM_H
26
28#include <layer_ids.h>
29#include <pad.h>
30#include <pcb_track.h>
31
37{
38public:
40 enum class TYPE
41 {
42 UNKNOWN,
43 PAD,
44 LINE,
45 VIA
46 };
47
51 enum class MERGE_STATUS
52 {
56 };
57
59 TYPE Type() const { return m_type; };
60
62 void SetPad( const PAD* aPad )
63 {
64 m_type = TYPE::PAD;
65 m_pad = aPad;
66 }
67
69 const PAD* GetPad() const { return m_pad; }
70
72 void SetLine( const SHAPE_LINE_CHAIN& aLine )
73 {
74 m_type = TYPE::LINE;
75 m_line = aLine;
76 }
77
79 SHAPE_LINE_CHAIN& GetLine() const { return m_line; }
80
82 void SetVia( const PCB_VIA* aVia )
83 {
84 m_type = TYPE::VIA;
85 m_via = aVia;
86 }
87
89 const PCB_VIA* GetVia() const { return m_via; }
90
93 void SetLayers( const PCB_LAYER_ID aStart, const PCB_LAYER_ID aEnd = PCB_LAYER_ID::UNDEFINED_LAYER )
94 {
95 if( aEnd != UNDEFINED_LAYER && IsCopperLayerLowerThan( aStart, aEnd ) )
96 {
97 m_layerStart = aEnd;
98 m_layerEnd = aStart;
99 }
100 else
101 {
102 m_layerStart = aStart;
103 m_layerEnd = aEnd;
104 }
105 }
106
109 void SetMergeStatus( const MERGE_STATUS aStatus ) { m_mergeStatus = aStatus; }
110
113
115 std::tuple<PCB_LAYER_ID, PCB_LAYER_ID> GetLayers() const { return { m_layerStart, m_layerEnd }; }
116
119
122
124 void CalculateViaLayers( const BOARD* aBoard );
125
127 void SetEffectiveNetClass( const NETCLASS* aNetClass ) { m_netClass = aNetClass; }
128
130 const NETCLASS* GetEffectiveNetClass() const { return m_netClass; }
131
132protected:
134 const PAD* m_pad{ nullptr };
135
138
140 const PCB_VIA* m_via{ nullptr };
141
143 PCB_LAYER_ID m_layerStart{ PCB_LAYER_ID::UNDEFINED_LAYER };
144
146 PCB_LAYER_ID m_layerEnd{ PCB_LAYER_ID::UNDEFINED_LAYER };
147
150
152 TYPE m_type{ TYPE::UNKNOWN };
153
155 const NETCLASS* m_netClass{ nullptr };
156};
157
158#endif //PCBNEW_LENGTH_DELAY_CALCULATION_ITEM_H
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:317
Lightweight class which holds a pad, via, or a routed trace outline.
const PCB_VIA * m_via
A proxied PCB_VIA object. Set to nullptr if not proxying a VIA.
MERGE_STATUS GetMergeStatus() const
Gets the MERGE_STATUS of this item.
void SetLine(const SHAPE_LINE_CHAIN &aLine)
Sets the source SHAPE_LINE_CHAIN of this item.
void SetVia(const PCB_VIA *aVia)
Sets the VIA associated with this item.
TYPE
The type of routing object this item proxies.
TYPE Type() const
Gets the routing item type.
const PCB_VIA * GetVia() const
Gets the VIA associated with this item.
const NETCLASS * m_netClass
The net class of the object.
PCB_LAYER_ID m_layerStart
The start board layer for the proxied object.
std::tuple< PCB_LAYER_ID, PCB_LAYER_ID > GetLayers() const
Gets the upper and lower layers for the proxied item.
void SetPad(const PAD *aPad)
Sets the parent PAD associated with this item.
void SetMergeStatus(const MERGE_STATUS aStatus)
Sets the MERGE_STATUS of this item.
SHAPE_LINE_CHAIN m_line
A proxied SHAPE_LINE_CHAIN object. Line is empty if not proxying a SHAPE_LINE_CHAIN.
const NETCLASS * GetEffectiveNetClass() const
Returns the effective net class for the item.
TYPE m_type
The routing object type of the proxied parent.
SHAPE_LINE_CHAIN & GetLine() const
Gets the SHAPE_LINE_CHAIN associated with this item.
PCB_LAYER_ID GetEndLayer() const
Gets the end board layer for the proxied item.
MERGE_STATUS m_mergeStatus
Flags whether this item has already been merged with another.
const PAD * GetPad() const
Gets the parent PAD associated with this item.
PCB_LAYER_ID GetStartLayer() const
Gets the start board layer for the proxied item.
void SetEffectiveNetClass(const NETCLASS *aNetClass)
Sets the effective net class for the item.
void CalculateViaLayers(const BOARD *aBoard)
Calculates active via payers for a proxied VIA object.
PCB_LAYER_ID m_layerEnd
The end board layer for the proxied object.
void SetLayers(const PCB_LAYER_ID aStart, const PCB_LAYER_ID aEnd=PCB_LAYER_ID::UNDEFINED_LAYER)
Sets the first and last layers associated with this item.
const PAD * m_pad
A proxied PAD object. Set to nullptr if not proxying a PAD.
MERGE_STATUS
Whether this item is UNMERGED, it has been merged and should be used (MERGED_IN_USE),...
A collection of nets and the parameters used to route or test these nets.
Definition: netclass.h:45
Definition: pad.h:54
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
bool IsCopperLayerLowerThan(PCB_LAYER_ID aLayerA, PCB_LAYER_ID aLayerB)
Return true if copper aLayerA is placed lower than aLayerB, false otherwise.
Definition: layer_ids.h:811
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ UNDEFINED_LAYER
Definition: layer_ids.h:61