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, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef PCBNEW_LENGTH_DELAY_CALCULATION_ITEM_H
21#define PCBNEW_LENGTH_DELAY_CALCULATION_ITEM_H
22
24#include <layer_ids.h>
25#include <pcb_track_types.h>
26
27class BOARD;
28class PAD;
29class NETCLASS;
30
31
37{
38public:
40 enum class TYPE
41 {
46 };
47
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 SetWidth( const int aWidth ) { m_width = aWidth; }
83
85 int GetWidth() const { return m_width; }
86
88 void SetVia( const PCB_VIA* aVia )
89 {
90 m_type = TYPE::VIA;
91 m_via = aVia;
92 }
93
95 const PCB_VIA* GetVia() const { return m_via; }
96
100 {
101 if( aEnd != UNDEFINED_LAYER && IsCopperLayerLowerThan( aStart, aEnd ) )
102 {
103 m_layerStart = aEnd;
104 m_layerEnd = aStart;
105 }
106 else
107 {
108 m_layerStart = aStart;
109 m_layerEnd = aEnd;
110 }
111 }
112
115 void SetMergeStatus( const MERGE_STATUS aStatus ) { m_mergeStatus = aStatus; }
116
119
121 std::tuple<PCB_LAYER_ID, PCB_LAYER_ID> GetLayers() const { return { m_layerStart, m_layerEnd }; }
122
125
128
130 void CalculateViaLayers( const BOARD* aBoard );
131
133 void SetEffectiveNetClass( const NETCLASS* aNetClass ) { m_netClass = aNetClass; }
134
136 const NETCLASS* GetEffectiveNetClass() const { return m_netClass; }
137
138protected:
140 const PAD* m_pad{ nullptr };
141
144
146 int m_width{ 0 };
147
149 const PCB_VIA* m_via{ nullptr };
150
153
156
159
161 TYPE m_type{ TYPE::UNKNOWN };
162
164 const NETCLASS* m_netClass{ nullptr };
165};
166
167#endif //PCBNEW_LENGTH_DELAY_CALCULATION_ITEM_H
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:372
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.
int GetWidth() const
Gets the line width.
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.
int m_width
The width of a line segment.
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.
void SetWidth(const int aWidth)
Sets the line width.
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:38
Definition pad.h:61
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:822
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
@ UNDEFINED_LAYER
Definition layer_ids.h:57
Declarations of types for tracks and vias.