KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_tuning_pattern.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) 2023 Alex Shvartzkop <[email protected]>
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#include <eda_item.h>
23#include <pcb_base_edit_frame.h>
24#include <router/pns_meander.h>
26#include <router/pns_router.h>
28
29
30namespace KIGFX
31{
32 class VIEW;
33 class RENDER_SETTINGS;
34}
35
42
43
45{
46public:
48
49 wxString GetClass() const override;
50
51#if defined(DEBUG)
52 void Show( int nestLevel, std::ostream& os ) const override;
53#endif
54
55 VECTOR2I GetPosition() const override;
56 void SetPosition( const VECTOR2I& aPos ) override;
57
58 void SetMinMax( const double aMin, const double aMax );
59 void SetChainMinMax( const double aMin, const double aMax );
60
61 void ClearMinMax();
62 void ClearChainMinMax();
63
64 void SetCurrent( const double aCurrent, const wxString& aLabel );
65
66 void SetIsTimeDomain( const bool aIsTimeDomain );
67
68 const BOX2I ViewBBox() const override;
69
70 std::vector<int> ViewGetLayers() const override;
71
72 void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override;
73
74protected:
77 double m_min;
78 double m_max;
79 double m_current;
80 wxString m_currentLabel; // Header line label ("current length" etc.)
81 wxString m_currentText; // (unused now for dual-line layout but kept for compatibility)
82 wxString m_minText;
83 wxString m_maxText;
84 double m_chainMin = 0.0;
85 double m_chainMax = 0.0;
89 wxString m_scopeLine;
90 wxString m_netValue;
91 wxString m_chainValue;
92 bool m_hasSignalValue = false;
93public:
94 void SetScopeLine( const wxString& aLine ) { m_scopeLine = aLine; }
95 void SetNetAndSignalValues( const wxString& aNetVal, const wxString& aSignalVal, bool aHasSignal )
96 {
97 m_netValue = aNetVal;
98 m_chainValue = aSignalVal;
99 m_hasSignalValue = aHasSignal;
100 }
101};
102
103
105{
106public:
107 static const wxString GENERATOR_TYPE;
108 static const wxString DISPLAY_NAME;
109
110 PCB_TUNING_PATTERN( BOARD_ITEM* aParent = nullptr, PCB_LAYER_ID aLayer = F_Cu,
112
113 wxString GetGeneratorType() const override { return wxS( "tuning_pattern" ); }
114
115 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override
116 {
117 return _( "Tuning Pattern" );
118 }
119
120 wxString GetFriendlyName() const override
121 {
122 return _( "Tuning Pattern" );
123 }
124
125 wxString GetPluralName() const override
126 {
127 return _( "Tuning Patterns" );
128 }
129
130 wxString GetCommitMessage() const override
131 {
132 return _( "Edit Tuning Pattern" );
133 }
134
135 BITMAPS GetMenuImage() const override
136 {
137 switch( m_tuningMode )
138 {
139 case SINGLE: return BITMAPS::ps_tune_length; break;
142 }
143
144 return BITMAPS::unknown;
145 }
146
148 BOARD_CONNECTED_ITEM* aStartItem,
149 LENGTH_TUNING_MODE aMode );
150
151 void EditStart( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit ) override;
152 bool Update( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit ) override;
153 void EditFinish( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit ) override;
154 void EditCancel( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit ) override;
155
156 void Remove( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit ) override;
157
158 bool MakeEditPoints( EDIT_POINTS& points ) const override;
159
160 bool UpdateFromEditPoints( EDIT_POINTS& aEditPoints ) override;
161
162 bool UpdateEditPoints( EDIT_POINTS& aEditPoints ) override;
163
164 void Move( const VECTOR2I& aMoveVector ) override
165 {
166 m_origin += aMoveVector;
167 m_end += aMoveVector;
168
169 if( !this->HasFlag( IN_EDIT ) )
170 {
171 PCB_GROUP::Move( aMoveVector );
172
173 if( m_baseLine )
174 m_baseLine->Move( aMoveVector );
175
177 m_baseLineCoupled->Move( aMoveVector );
178 }
179 }
180
181 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override
182 {
183 if( !this->HasFlag( IN_EDIT ) )
184 {
185 PCB_GENERATOR::Rotate( aRotCentre, aAngle );
186 RotatePoint( m_end, aRotCentre, aAngle );
187
188 if( m_baseLine )
189 m_baseLine->Rotate( aAngle, aRotCentre );
190
192 m_baseLineCoupled->Rotate( aAngle, aRotCentre );
193 }
194 }
195
196 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override
197 {
198 if( !this->HasFlag( IN_EDIT ) )
199 {
200 PCB_GENERATOR::Flip( aCentre, aFlipDirection );
201
202 baseMirror( aCentre, aFlipDirection );
203 }
204 }
205
206 void Mirror( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override
207 {
208 if( !this->HasFlag( IN_EDIT ) )
209 {
210 PCB_GENERATOR::Mirror( aCentre, aFlipDirection );
211
212 baseMirror( aCentre, aFlipDirection );
213 }
214 }
215
216 void SetLayer( PCB_LAYER_ID aLayer ) override
217 {
218 PCB_GENERATOR::SetLayer( aLayer );
219
220 for( BOARD_ITEM* item : GetBoardItems() )
221 item->SetLayer( aLayer );
222 }
223
224 PCB_LAYER_ID GetLayer() const override
225 {
226 for( BOARD_ITEM* item : GetBoardItems() )
227 {
228 if( PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( item ) )
229 return track->GetLayer();
230 }
231
233 }
234
235 const BOX2I GetBoundingBox() const override
236 {
237 return getOutline().BBox();
238 }
239
240 std::vector<int> ViewGetLayers() const override
241 {
242 return { LAYER_ANCHOR, GetLayer() };
243 }
244
245 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override
246 {
247 return getOutline().Collide( aPosition, aAccuracy );
248 }
249
250 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const override
251 {
252 bool anyItems = false;
253
254 for( BOARD_ITEM* item : GetBoardItems() )
255 {
256 anyItems = true;
257
258 if( aContained )
259 {
260 if( !item->HitTest( aRect, true, aAccuracy ) )
261 return false;
262 }
263 else if( item->HitTest( aRect, false, aAccuracy ) )
264 {
265 return true;
266 }
267 }
268
269 if( anyItems )
270 return aContained;
271
272 BOX2I sel = aRect;
273
274 if( aAccuracy )
275 sel.Inflate( aAccuracy );
276
277 // Convert selection box to polygon for accurate hit testing against the actual outline
278 SHAPE_LINE_CHAIN selPoly(
279 {
280 sel.GetOrigin(),
281 VECTOR2I( sel.GetRight(), sel.GetTop() ),
282 sel.GetEnd(),
283 VECTOR2I( sel.GetLeft(), sel.GetBottom() )
284 },
285 true );
286
287 return KIGEOM::ShapeHitTest( selPoly, getOutline(), aContained );
288 }
289
290 bool HitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const override
291 {
292 bool anyItems = false;
293
294 for( BOARD_ITEM* item : GetBoardItems() )
295 {
296 anyItems = true;
297
298 if( aContained )
299 {
300 if( !item->HitTest( aPoly, true ) )
301 return false;
302 }
303 else if( item->HitTest( aPoly, false ) )
304 {
305 return true;
306 }
307 }
308
309 if( anyItems )
310 return aContained;
311
312 return KIGEOM::ShapeHitTest( aPoly, getOutline(), aContained );
313 }
314
315 const BOX2I ViewBBox() const override { return GetBoundingBox(); }
316
317 EDA_ITEM* Clone() const override { return new PCB_TUNING_PATTERN( *this ); }
318
319 void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override final;
320
321 const VECTOR2I& GetEnd() const { return m_end; }
322 void SetEnd( const VECTOR2I& aValue ) { m_end = aValue; }
323
324 int GetEndX() const { return m_end.x; }
325 void SetEndX( int aValue ) { m_end.x = aValue; }
326
327 int GetEndY() const { return m_end.y; }
328 void SetEndY( int aValue ) { m_end.y = aValue; }
329
330 int GetWidth() const
331 {
332 for( BOARD_ITEM* item : GetBoardItems() )
333 if( PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( item ) )
334 return track->GetWidth();
335
336 return m_trackWidth;
337 }
338
339 void SetWidth( int aValue )
340 {
341 m_trackWidth = aValue;
342
343 for( BOARD_ITEM* item : GetBoardItems() )
344 if( PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( item ) )
345 track->SetWidth( aValue );
346 }
347
348 int GetNetCode() const
349 {
350 for( BOARD_ITEM* item : GetBoardItems() )
351 if( BOARD_CONNECTED_ITEM* bci = dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) )
352 return bci->GetNetCode();
353
354 return 0;
355 }
356
357 void SetNetCode( int aNetCode )
358 {
359 if( BOARD* board = GetBoard() )
360 {
361 if( NETINFO_ITEM* net = board->FindNet( aNetCode ) )
362 m_lastNetName = net->GetNetname();
363 else
364 m_lastNetName.clear();
365 }
366
367 for( BOARD_ITEM* item : GetBoardItems() )
368 if( BOARD_CONNECTED_ITEM* bci = dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) )
369 bci->SetNetCode( aNetCode );
370 }
371
372 bool HasSolderMask() const
373 {
374 for( BOARD_ITEM* item : GetBoardItems() )
375 if( PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( item ) )
376 return track->HasSolderMask();
377
378 return true;
379 }
380
381 void SetHasSolderMask( bool aVal )
382 {
383 for( BOARD_ITEM* item : GetBoardItems() )
384 if( PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( item ) )
385 track->SetHasSolderMask( aVal );
386 }
387
388 std::optional<int> GetLocalSolderMaskMargin() const
389 {
390 for( BOARD_ITEM* item : GetBoardItems() )
391 if( PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( item ) )
392 return track->GetLocalSolderMaskMargin();
393
394 return std::optional<int>();
395 }
396
397 void SetLocalSolderMaskMargin( std::optional<int> aMargin )
398 {
399 for( BOARD_ITEM* item : GetBoardItems() )
400 if( PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( item ) )
401 track->SetLocalSolderMaskMargin( aMargin );
402 }
403
406
417
419
420 int GetMinAmplitude() const { return m_settings.m_minAmplitude; }
421 void SetMinAmplitude( int aValue )
422 {
423 aValue = std::max( aValue, 0 );
424
425 m_settings.m_minAmplitude = aValue;
426
427 if( m_settings.m_maxAmplitude < m_settings.m_minAmplitude )
428 m_settings.m_maxAmplitude = m_settings.m_minAmplitude;
429 }
430
431 int GetMaxAmplitude() const { return m_settings.m_maxAmplitude; }
432 void SetMaxAmplitude( int aValue )
433 {
434 aValue = std::max( aValue, 0 );
435
436 m_settings.m_maxAmplitude = aValue;
437
438 if( m_settings.m_maxAmplitude < m_settings.m_minAmplitude )
439 m_settings.m_minAmplitude = m_settings.m_maxAmplitude;
440 }
441
442 // Update the initial side one time at EditStart based on m_end.
444
445 PNS::MEANDER_SIDE GetInitialSide() const { return m_settings.m_initialSide; }
446 void SetInitialSide( PNS::MEANDER_SIDE aValue ) { m_settings.m_initialSide = aValue; }
447
448 int GetSpacing() const { return m_settings.m_spacing; }
449 void SetSpacing( int aValue ) { m_settings.m_spacing = aValue; }
450
451 std::optional<int> GetTargetLength() const
452 {
453 if( m_settings.m_targetLength.Opt() == PNS::MEANDER_SETTINGS::LENGTH_UNCONSTRAINED )
454 return std::optional<int>();
455 else
456 return m_settings.m_targetLength.Opt();
457 }
458
459 void SetTargetLength( std::optional<int> aValue )
460 {
461 m_settings.m_isTimeDomain = false;
462
463 if( aValue.has_value() )
464 m_settings.SetTargetLength( aValue.value() );
465 else
467 }
468
469 std::optional<int> GetTargetDelay() const
470 {
471 if( m_settings.m_targetLengthDelay.Opt() == PNS::MEANDER_SETTINGS::DELAY_UNCONSTRAINED )
472 return std::optional<int>();
473 else
474 return m_settings.m_targetLengthDelay.Opt();
475 }
476
477 void SetTargetDelay( std::optional<int> aValue )
478 {
479 m_settings.m_isTimeDomain = true;
480
481 if( aValue.has_value() )
482 m_settings.SetTargetLengthDelay( aValue.value() );
483 else
485 }
486
487 int GetTargetSkew() const { return m_settings.m_targetSkew.Opt(); }
488 void SetTargetSkew( int aValue ) { m_settings.SetTargetSkew( aValue ); }
489
490 int GetTargetSkewDelay() const { return m_settings.m_targetSkewDelay.Opt(); }
491 void SetTargetSkewDelay( int aValue ) { m_settings.SetTargetSkewDelay( aValue ); }
492
493 bool GetOverrideCustomRules() const { return m_settings.m_overrideCustomRules; }
494 void SetOverrideCustomRules( bool aOverride ) { m_settings.m_overrideCustomRules = aOverride; }
495
496 int GetCornerRadiusPercentage() const { return m_settings.m_cornerRadiusPercentage; }
497 void SetCornerRadiusPercentage( int aValue ) { m_settings.m_cornerRadiusPercentage = aValue; }
498
499 bool IsSingleSided() const { return m_settings.m_singleSided; }
500 void SetSingleSided( bool aValue ) { m_settings.m_singleSided = aValue; }
501
502 bool IsRounded() const { return m_settings.m_cornerStyle == PNS::MEANDER_STYLE_ROUND; }
503 void SetRounded( bool aFlag ) { m_settings.m_cornerStyle = aFlag ? PNS::MEANDER_STYLE_ROUND
505
506 std::vector<std::pair<wxString, wxVariant>> GetRowData() override
507 {
508 std::vector<std::pair<wxString, wxVariant>> data = PCB_GENERATOR::GetRowData();
509 data.emplace_back( _HKI( "Net" ), m_lastNetName );
510 data.emplace_back( _HKI( "Tuning" ), m_tuningInfo );
511 return data;
512 }
513
514 const STRING_ANY_MAP GetProperties() const override;
515 void SetProperties( const STRING_ANY_MAP& aProps ) override;
516
517 void ShowPropertiesDialog( PCB_BASE_EDIT_FRAME* aEditFrame ) override;
518
519 std::vector<EDA_ITEM*> GetPreviewItems( GENERATOR_TOOL* aTool, PCB_BASE_EDIT_FRAME* aFrame,
520 bool aStatusItemsOnly = false ) override;
521
522 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
523
524protected:
525 void swapData( BOARD_ITEM* aImage ) override
526 {
527 wxASSERT( aImage->Type() == PCB_GENERATOR_T );
528
529 std::swap( *this, *static_cast<PCB_TUNING_PATTERN*>( aImage ) );
530 }
531
532 bool recoverBaseline( PNS::ROUTER* aRouter );
533
534 bool baselineValid();
535
536 bool initBaseLine( PNS::ROUTER* aRouter, int aPNSLayer, BOARD* aBoard, VECTOR2I& aStart,
537 VECTOR2I& aEnd, NETINFO_ITEM* aNet,
538 std::optional<SHAPE_LINE_CHAIN>& aBaseLine );
539
540 bool initBaseLines( PNS::ROUTER* aRouter, int aPNSLayer, BOARD* aBoard );
541
542 bool removeToBaseline( PNS::ROUTER* aRouter, int aPNSLayer, SHAPE_LINE_CHAIN& aBaseLine );
543
544 bool resetToBaseline( GENERATOR_TOOL* aTool, int aPNSLayer, SHAPE_LINE_CHAIN& aBaseLine,
545 bool aPrimary );
546
548
549 void baseMirror( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection )
550 {
551 PCB_GENERATOR::baseMirror( aCentre, aFlipDirection );
552
553 if( m_baseLine )
554 {
555 m_baseLine->Mirror( aCentre, aFlipDirection );
556 m_origin = m_baseLine->CPoint( 0 );
557 m_end = m_baseLine->CLastPoint();
558 }
559
561 m_baseLineCoupled->Mirror( aCentre, aFlipDirection );
562
563 if( m_settings.m_initialSide == PNS::MEANDER_SIDE_RIGHT )
564 m_settings.m_initialSide = PNS::MEANDER_SIDE_LEFT;
565 else
566 m_settings.m_initialSide = PNS::MEANDER_SIDE_RIGHT;
567 }
568
569protected:
571
573
574 std::optional<SHAPE_LINE_CHAIN> m_baseLine;
575 std::optional<SHAPE_LINE_CHAIN> m_baseLineCoupled;
576
579
581
583 wxString m_tuningInfo;
584 long long m_tuningLength;
585
587
589
590 // Bridging cache (pad-to-pad gaps across 2-net series components in a chain)
591public:
592 long long GetCachedBridgingLength( BOARD* aBoard, const wxString& aNetChain, double* aDelayIUOut );
593
594private:
600};
BITMAPS
A list of all bitmap identifiers.
@ ps_diff_pair_tune_length
@ ps_diff_pair_tune_phase
BOX2< VECTOR2I > BOX2I
Definition box2.h:918
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
Definition board_item.h:83
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition board_item.h:265
friend class BOARD
Definition board_item.h:512
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:372
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition box2.h:554
constexpr const Vec GetEnd() const
Definition box2.h:208
constexpr coord_type GetLeft() const
Definition box2.h:224
constexpr const Vec & GetOrigin() const
Definition box2.h:206
constexpr coord_type GetRight() const
Definition box2.h:213
constexpr coord_type GetTop() const
Definition box2.h:225
constexpr coord_type GetBottom() const
Definition box2.h:218
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:96
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:108
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
Definition eda_item.h:156
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:37
EDIT_POINTS is a VIEW_ITEM that manages EDIT_POINTs and EDIT_LINEs and draws them.
Handle actions specific to filling copper zones.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:63
Handle the data for a net.
Definition netinfo.h:46
Common, abstract interface for edit frames.
void baseMirror(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection)
virtual void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
PCB_GENERATOR(BOARD_ITEM *aParent, PCB_LAYER_ID aLayer)
void Mirror(const VECTOR2I &aCentre, FLIP_DIRECTION aMirrorDirection) override
Mirror this object relative to a given horizontal axis the layer is not changed.
VECTOR2I m_origin
virtual std::vector< std::pair< wxString, wxVariant > > GetRowData()
void Move(const VECTOR2I &aMoveVector) override
Move this object.
std::unordered_set< BOARD_ITEM * > GetBoardItems() const
Definition pcb_group.cpp:98
void SetTargetSkew(int aValue)
void Mirror(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Mirror this object relative to a given horizontal axis the layer is not changed.
bool initBaseLines(PNS::ROUTER *aRouter, int aPNSLayer, BOARD *aBoard)
const STRING_ANY_MAP GetProperties() const override
bool HitTest(const BOX2I &aRect, bool aContained, int aAccuracy) const override
Test if aPosition is inside or on the boundary of this item.
void SetEnd(const VECTOR2I &aValue)
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
void SetMinAmplitude(int aValue)
void SetSpacing(int aValue)
void SetTuningMode(LENGTH_TUNING_MODE aMode)
wxString GetGeneratorType() const override
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
std::vector< int > ViewGetLayers() const override
bool HitTest(const SHAPE_LINE_CHAIN &aPoly, bool aContained) const override
Test if aPosition is inside or on the boundary of this item.
static const wxString DISPLAY_NAME
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
PNS::ROUTER_MODE GetPNSMode()
bool initBaseLine(PNS::ROUTER *aRouter, int aPNSLayer, BOARD *aBoard, VECTOR2I &aStart, VECTOR2I &aEnd, NETINFO_ITEM *aNet, std::optional< SHAPE_LINE_CHAIN > &aBaseLine)
void SetTargetSkewDelay(int aValue)
PCB_TUNING_PATTERN(BOARD_ITEM *aParent=nullptr, PCB_LAYER_ID aLayer=F_Cu, LENGTH_TUNING_MODE aMode=LENGTH_TUNING_MODE::SINGLE)
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
void swapData(BOARD_ITEM *aImage) override
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
bool recoverBaseline(PNS::ROUTER *aRouter)
void SetWidth(int aValue)
PNS::MEANDER_SIDE GetInitialSide() const
std::optional< int > GetLocalSolderMaskMargin() const
const VECTOR2I & GetEnd() const
void SetInitialSide(PNS::MEANDER_SIDE aValue)
wxString GetFriendlyName() const override
void SetTargetDelay(std::optional< int > aValue)
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
wxString GetCommitMessage() const override
LENGTH_TUNING_MODE GetTuningMode() const
void SetHasSolderMask(bool aVal)
std::optional< int > GetTargetDelay() const
void Move(const VECTOR2I &aMoveVector) override
Move this object.
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
std::vector< EDA_ITEM * > GetPreviewItems(GENERATOR_TOOL *aTool, PCB_BASE_EDIT_FRAME *aFrame, bool aStatusItemsOnly=false) override
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
void EditStart(GENERATOR_TOOL *aTool, BOARD *aBoard, BOARD_COMMIT *aCommit) override
void baseMirror(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection)
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
long long GetCachedBridgingLength(BOARD *aBoard, const wxString &aNetChain, double *aDelayIUOut)
void SetOverrideCustomRules(bool aOverride)
void SetRounded(bool aFlag)
LENGTH_TUNING_MODE m_tuningMode
std::vector< std::pair< wxString, wxVariant > > GetRowData() override
static const wxString GENERATOR_TYPE
bool resetToBaseline(GENERATOR_TOOL *aTool, int aPNSLayer, SHAPE_LINE_CHAIN &aBaseLine, bool aPrimary)
bool MakeEditPoints(EDIT_POINTS &points) const override
void SetCornerRadiusPercentage(int aValue)
PNS::MEANDER_PLACER_BASE::TUNING_STATUS m_tuningStatus
std::optional< SHAPE_LINE_CHAIN > m_baseLineCoupled
const BOARD * m_cachedBridgingBoardPtr
void SetProperties(const STRING_ANY_MAP &aProps) override
wxString GetPluralName() const override
void ViewDraw(int aLayer, KIGFX::VIEW *aView) const override final
Draw the parts of the object belonging to layer aLayer.
void Remove(GENERATOR_TOOL *aTool, BOARD *aBoard, BOARD_COMMIT *aCommit) override
bool UpdateFromEditPoints(EDIT_POINTS &aEditPoints) override
std::optional< SHAPE_LINE_CHAIN > m_baseLine
PNS::MEANDER_SETTINGS m_settings
void SetEndX(int aValue)
void ShowPropertiesDialog(PCB_BASE_EDIT_FRAME *aEditFrame) override
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
bool Update(GENERATOR_TOOL *aTool, BOARD *aBoard, BOARD_COMMIT *aCommit) override
void SetNetCode(int aNetCode)
bool UpdateEditPoints(EDIT_POINTS &aEditPoints) override
void EditCancel(GENERATOR_TOOL *aTool, BOARD *aBoard, BOARD_COMMIT *aCommit) override
bool GetOverrideCustomRules() const
void SetMaxAmplitude(int aValue)
PNS::MEANDER_SETTINGS & GetSettings()
void SetSingleSided(bool aValue)
bool removeToBaseline(PNS::ROUTER *aRouter, int aPNSLayer, SHAPE_LINE_CHAIN &aBaseLine)
std::optional< int > GetTargetLength() const
void EditFinish(GENERATOR_TOOL *aTool, BOARD *aBoard, BOARD_COMMIT *aCommit) override
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
int GetCornerRadiusPercentage() const
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
SHAPE_LINE_CHAIN getOutline() const
void SetEndY(int aValue)
void SetTargetLength(std::optional< int > aValue)
static PCB_TUNING_PATTERN * CreateNew(GENERATOR_TOOL *aTool, PCB_BASE_EDIT_FRAME *aFrame, BOARD_CONNECTED_ITEM *aStartItem, LENGTH_TUNING_MODE aMode)
TUNING_STATUS
< Result of the length tuning operation
Dimensions for the meandering algorithm.
Definition pns_meander.h:70
static const long long int LENGTH_UNCONSTRAINED
Definition pns_meander.h:73
static const long long int DELAY_UNCONSTRAINED
Definition pns_meander.h:76
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
virtual bool Collide(const VECTOR2I &aP, int aClearance=0, int *aActual=nullptr, VECTOR2I *aLocation=nullptr) const override
Check if point aP lies closer to us than aClearance.
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
A name/value tuple with unique names and wxAny values.
void SetIsTimeDomain(const bool aIsTimeDomain)
void SetCurrent(const double aCurrent, const wxString &aLabel)
wxString GetClass() const override
Return the class name.
VECTOR2I GetPosition() const override
void SetScopeLine(const wxString &aLine)
void SetMinMax(const double aMin, const double aMax)
void ViewDraw(int aLayer, KIGFX::VIEW *aView) const override
Draw the parts of the object belonging to layer aLayer.
void SetChainMinMax(const double aMin, const double aMax)
std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
TUNING_STATUS_VIEW_ITEM(PCB_BASE_EDIT_FRAME *aFrame)
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
void SetNetAndSignalValues(const wxString &aNetVal, const wxString &aSignalVal, bool aHasSignal)
void SetPosition(const VECTOR2I &aPos) override
#define _(s)
#define IN_EDIT
Item currently edited.
a few functions useful in geometry calculations.
@ LAYER_ANCHOR
Anchor of items having an anchor point (texts, footprints).
Definition layer_ids.h:244
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
@ F_Cu
Definition layer_ids.h:60
FLIP_DIRECTION
Definition mirror.h:23
bool ShapeHitTest(const SHAPE_LINE_CHAIN &aHitter, const SHAPE &aHittee, bool aHitteeContained)
Perform a shape-to-shape hit test.
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:29
MEANDER_SIDE
Definition pns_meander.h:60
@ MEANDER_SIDE_RIGHT
Definition pns_meander.h:63
@ MEANDER_SIDE_LEFT
Definition pns_meander.h:61
@ MEANDER_STYLE_ROUND
Definition pns_meander.h:54
@ MEANDER_STYLE_CHAMFER
Definition pns_meander.h:55
ROUTER_MODE
Definition pns_router.h:67
@ PNS_MODE_TUNE_DIFF_PAIR
Definition pns_router.h:71
@ PNS_MODE_TUNE_SINGLE
Definition pns_router.h:70
@ PNS_MODE_TUNE_DIFF_PAIR_SKEW
Definition pns_router.h:72
#define _HKI(x)
Definition page_info.cpp:40
LENGTH_TUNING_MODE
@ DIFF_PAIR
@ DIFF_PAIR_SKEW
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
Definition trigo.cpp:225
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
Definition typeinfo.h:84
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683