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#pragma once
22
23#include <eda_item.h>
25#include <pcb_base_edit_frame.h>
26#include <router/pns_meander.h>
28#include <router/pns_router.h>
30
31
32namespace KIGFX
33{
34 class VIEW;
35 class RENDER_SETTINGS;
36}
37
44
45
47{
48public:
50
51 wxString GetClass() const override;
52
53#if defined(DEBUG)
54 void Show( int nestLevel, std::ostream& os ) const override;
55#endif
56
57 VECTOR2I GetPosition() const override;
58 void SetPosition( const VECTOR2I& aPos ) override;
59
60 void SetMinMax( const double aMin, const double aMax );
61 void SetChainMinMax( const double aMin, const double aMax );
62
63 void ClearMinMax();
64 void ClearChainMinMax();
65
66 void SetCurrent( const double aCurrent, const wxString& aLabel );
67
68 void SetIsTimeDomain( const bool aIsTimeDomain );
69
70 const BOX2I ViewBBox() const override;
71
72 std::vector<int> ViewGetLayers() const override;
73
74 void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override;
75
76protected:
79 double m_min;
80 double m_max;
81 double m_current;
82 wxString m_currentLabel; // Header line label ("current length" etc.)
83 wxString m_currentText; // (unused now for dual-line layout but kept for compatibility)
84 wxString m_minText;
85 wxString m_maxText;
86 double m_chainMin = 0.0;
87 double m_chainMax = 0.0;
91 wxString m_scopeLine;
92 wxString m_netValue;
93 wxString m_chainValue;
94 bool m_hasSignalValue = false;
95public:
96 void SetScopeLine( const wxString& aLine ) { m_scopeLine = aLine; }
97 void SetNetAndSignalValues( const wxString& aNetVal, const wxString& aSignalVal, bool aHasSignal )
98 {
99 m_netValue = aNetVal;
100 m_chainValue = aSignalVal;
101 m_hasSignalValue = aHasSignal;
102 }
103};
104
105
107{
108public:
109 static const wxString GENERATOR_TYPE;
110 static const wxString DISPLAY_NAME;
111
112 PCB_TUNING_PATTERN( BOARD_ITEM* aParent = nullptr, PCB_LAYER_ID aLayer = F_Cu,
114
115 wxString GetGeneratorType() const override { return wxS( "tuning_pattern" ); }
116
117 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override
118 {
119 return _( "Tuning Pattern" );
120 }
121
122 wxString GetFriendlyName() const override
123 {
124 return _( "Tuning Pattern" );
125 }
126
127 wxString GetPluralName() const override
128 {
129 return _( "Tuning Patterns" );
130 }
131
132 wxString GetCommitMessage() const override
133 {
134 return _( "Edit Tuning Pattern" );
135 }
136
137 BITMAPS GetMenuImage() const override
138 {
139 switch( m_tuningMode )
140 {
141 case SINGLE: return BITMAPS::ps_tune_length; break;
144 }
145
146 return BITMAPS::unknown;
147 }
148
150 BOARD_CONNECTED_ITEM* aStartItem,
151 LENGTH_TUNING_MODE aMode );
152
153 void EditStart( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit ) override;
154 bool Update( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit ) override;
155 void EditFinish( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit ) override;
156 void EditCancel( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit ) override;
157
158 void Remove( GENERATOR_TOOL* aTool, BOARD* aBoard, BOARD_COMMIT* aCommit ) override;
159
160 bool MakeEditPoints( EDIT_POINTS& points ) const override;
161
162 bool UpdateFromEditPoints( EDIT_POINTS& aEditPoints ) override;
163
164 bool UpdateEditPoints( EDIT_POINTS& aEditPoints ) override;
165
166 void Move( const VECTOR2I& aMoveVector ) override
167 {
168 m_origin += aMoveVector;
169 m_end += aMoveVector;
170
171 if( !this->HasFlag( IN_EDIT ) )
172 {
173 PCB_GROUP::Move( aMoveVector );
174
175 if( m_baseLine )
176 m_baseLine->Move( aMoveVector );
177
179 m_baseLineCoupled->Move( aMoveVector );
180 }
181 }
182
183 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override
184 {
185 if( !this->HasFlag( IN_EDIT ) )
186 {
187 PCB_GENERATOR::Rotate( aRotCentre, aAngle );
188 RotatePoint( m_end, aRotCentre, aAngle );
189
190 if( m_baseLine )
191 m_baseLine->Rotate( aAngle, aRotCentre );
192
194 m_baseLineCoupled->Rotate( aAngle, aRotCentre );
195 }
196 }
197
198 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override
199 {
200 if( !this->HasFlag( IN_EDIT ) )
201 {
202 PCB_GENERATOR::Flip( aCentre, aFlipDirection );
203
204 baseMirror( aCentre, aFlipDirection );
205 }
206 }
207
208 void Mirror( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override
209 {
210 if( !this->HasFlag( IN_EDIT ) )
211 {
212 PCB_GENERATOR::Mirror( aCentre, aFlipDirection );
213
214 baseMirror( aCentre, aFlipDirection );
215 }
216 }
217
218 void SetLayer( PCB_LAYER_ID aLayer ) override
219 {
220 PCB_GENERATOR::SetLayer( aLayer );
221
222 for( BOARD_ITEM* item : GetBoardItems() )
223 item->SetLayer( aLayer );
224 }
225
226 PCB_LAYER_ID GetLayer() const override
227 {
228 for( BOARD_ITEM* item : GetBoardItems() )
229 {
230 if( PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( item ) )
231 return track->GetLayer();
232 }
233
235 }
236
237 const BOX2I GetBoundingBox() const override
238 {
239 BOX2I bbox = getOutline().BBox();
240
241 // The outline is synthesized from the baseline and the meander settings, so it can both be
242 // empty and under-cover the copper. PCB_GROUP inflates unconditionally, so skip it when
243 // there are no members rather than absorb a half-millimetre box at the origin.
244 if( !m_items.empty() )
246
247 return bbox;
248 }
249
250 std::vector<int> ViewGetLayers() const override
251 {
252 return { LAYER_ANCHOR, GetLayer() };
253 }
254
255 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override
256 {
257 if( getOutline().Collide( aPosition, aAccuracy ) )
258 return true;
259
260 // Members of a generator are never selectable on their own, so the pattern has to answer
261 // for any copper the outline misses
262 for( BOARD_ITEM* item : GetBoardItems() )
263 {
264 if( item->HitTest( aPosition, aAccuracy ) )
265 return true;
266 }
267
268 return false;
269 }
270
271 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const override
272 {
273 bool anyItems = false;
274
275 for( BOARD_ITEM* item : GetBoardItems() )
276 {
277 anyItems = true;
278
279 if( aContained )
280 {
281 if( !item->HitTest( aRect, true, aAccuracy ) )
282 return false;
283 }
284 else if( item->HitTest( aRect, false, aAccuracy ) )
285 {
286 return true;
287 }
288 }
289
290 if( anyItems )
291 return aContained;
292
293 BOX2I sel = aRect;
294
295 if( aAccuracy )
296 sel.Inflate( aAccuracy );
297
298 // Convert selection box to polygon for accurate hit testing against the actual outline
299 SHAPE_LINE_CHAIN selPoly(
300 {
301 sel.GetOrigin(),
302 VECTOR2I( sel.GetRight(), sel.GetTop() ),
303 sel.GetEnd(),
304 VECTOR2I( sel.GetLeft(), sel.GetBottom() )
305 },
306 true );
307
308 return KIGEOM::ShapeHitTest( selPoly, getOutline(), aContained );
309 }
310
311 bool HitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const override
312 {
313 bool anyItems = false;
314
315 for( BOARD_ITEM* item : GetBoardItems() )
316 {
317 anyItems = true;
318
319 if( aContained )
320 {
321 if( !item->HitTest( aPoly, true ) )
322 return false;
323 }
324 else if( item->HitTest( aPoly, false ) )
325 {
326 return true;
327 }
328 }
329
330 if( anyItems )
331 return aContained;
332
333 return KIGEOM::ShapeHitTest( aPoly, getOutline(), aContained );
334 }
335
336 const BOX2I ViewBBox() const override { return GetBoundingBox(); }
337
338 EDA_ITEM* Clone() const override { return new PCB_TUNING_PATTERN( *this ); }
339
340 void ViewDraw( int aLayer, KIGFX::VIEW* aView ) const override final;
341
342 const VECTOR2I& GetEnd() const { return m_end; }
343 void SetEnd( const VECTOR2I& aValue ) { m_end = aValue; }
344
345 int GetEndX() const { return m_end.x; }
346 void SetEndX( int aValue ) { m_end.x = aValue; }
347
348 int GetEndY() const { return m_end.y; }
349 void SetEndY( int aValue ) { m_end.y = aValue; }
350
351 int GetWidth() const
352 {
353 for( BOARD_ITEM* item : GetBoardItems() )
354 if( PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( item ) )
355 return track->GetWidth();
356
357 return m_trackWidth;
358 }
359
360 void SetWidth( int aValue )
361 {
362 m_trackWidth = aValue;
363 }
364
365 int GetNetCode() const
366 {
367 for( BOARD_ITEM* item : GetBoardItems() )
368 if( BOARD_CONNECTED_ITEM* bci = dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) )
369 return bci->GetNetCode();
370
371 return 0;
372 }
373
374 void SetNetCode( int aNetCode )
375 {
376 if( BOARD* board = GetBoard() )
377 {
378 if( NETINFO_ITEM* net = board->FindNet( aNetCode ) )
379 m_lastNetName = net->GetNetname();
380 else
381 m_lastNetName.clear();
382 }
383
384 for( BOARD_ITEM* item : GetBoardItems() )
385 if( BOARD_CONNECTED_ITEM* bci = dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) )
386 bci->SetNetCode( aNetCode );
387 }
388
389 bool HasSolderMask() const
390 {
391 for( BOARD_ITEM* item : GetBoardItems() )
392 if( PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( item ) )
393 return track->HasSolderMask();
394
395 return true;
396 }
397
398 void SetHasSolderMask( bool aVal )
399 {
400 for( BOARD_ITEM* item : GetBoardItems() )
401 if( PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( item ) )
402 track->SetHasSolderMask( aVal );
403 }
404
405 std::optional<int> GetLocalSolderMaskMargin() const
406 {
407 for( BOARD_ITEM* item : GetBoardItems() )
408 if( PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( item ) )
409 return track->GetLocalSolderMaskMargin();
410
411 return std::optional<int>();
412 }
413
414 void SetLocalSolderMaskMargin( std::optional<int> aMargin )
415 {
416 for( BOARD_ITEM* item : GetBoardItems() )
417 if( PCB_TRACK* track = dynamic_cast<PCB_TRACK*>( item ) )
418 track->SetLocalSolderMaskMargin( aMargin );
419 }
420
423
424 // The un-meandered route the pattern was placed over; the outline is derived from it.
425 const std::optional<SHAPE_LINE_CHAIN>& GetBaseLine() const { return m_baseLine; }
426 void SetBaseLine( const SHAPE_LINE_CHAIN& aBaseLine ) { m_baseLine = aBaseLine; }
427
428 const std::optional<SHAPE_LINE_CHAIN>& GetBaseLineCoupled() const { return m_baseLineCoupled; }
429 void SetBaseLineCoupled( const SHAPE_LINE_CHAIN& aBaseLine ) { m_baseLineCoupled = aBaseLine; }
430
431 int GetDiffPairGap() const { return m_diffPairGap; }
432 void SetDiffPairGap( int aValue ) { m_diffPairGap = aValue; }
433
434 const wxString& GetLastNetName() const { return m_lastNetName; }
435 void SetLastNetName( const wxString& aNetName ) { m_lastNetName = aNetName; }
436
447
449
450 int GetMinAmplitude() const { return m_settings.m_minAmplitude; }
451 void SetMinAmplitude( int aValue )
452 {
453 aValue = std::max( aValue, 0 );
454
455 m_settings.m_minAmplitude = aValue;
456
457 if( m_settings.m_maxAmplitude < m_settings.m_minAmplitude )
458 m_settings.m_maxAmplitude = m_settings.m_minAmplitude;
459 }
460
461 int GetMaxAmplitude() const { return m_settings.m_maxAmplitude; }
462 void SetMaxAmplitude( int aValue )
463 {
464 aValue = std::max( aValue, 0 );
465
466 m_settings.m_maxAmplitude = aValue;
467
468 if( m_settings.m_maxAmplitude < m_settings.m_minAmplitude )
469 m_settings.m_minAmplitude = m_settings.m_maxAmplitude;
470 }
471
472 // Update the initial side one time at EditStart based on m_end.
474
475 PNS::MEANDER_SIDE GetInitialSide() const { return m_settings.m_initialSide; }
476 void SetInitialSide( PNS::MEANDER_SIDE aValue ) { m_settings.m_initialSide = aValue; }
477
478 int GetSpacing() const { return m_settings.m_spacing; }
479 void SetSpacing( int aValue ) { m_settings.m_spacing = aValue; }
480
481 std::optional<int> GetTargetLength() const
482 {
483 if( m_settings.m_targetLength.Opt() == PNS::MEANDER_SETTINGS::LENGTH_UNCONSTRAINED )
484 return std::optional<int>();
485 else
486 return m_settings.m_targetLength.Opt();
487 }
488
489 void SetTargetLength( std::optional<int> aValue )
490 {
491 m_settings.m_isTimeDomain = false;
492
493 if( aValue.has_value() )
494 m_settings.SetTargetLength( aValue.value() );
495 else
497 }
498
499 std::optional<int> GetTargetDelay() const
500 {
501 if( m_settings.m_targetLengthDelay.Opt() == PNS::MEANDER_SETTINGS::DELAY_UNCONSTRAINED )
502 return std::optional<int>();
503 else
504 return m_settings.m_targetLengthDelay.Opt();
505 }
506
507 void SetTargetDelay( std::optional<int> aValue )
508 {
509 m_settings.m_isTimeDomain = true;
510
511 if( aValue.has_value() )
512 m_settings.SetTargetLengthDelay( aValue.value() );
513 else
515 }
516
517 int GetTargetSkew() const { return m_settings.m_targetSkew.Opt(); }
518 void SetTargetSkew( int aValue ) { m_settings.SetTargetSkew( aValue ); }
519
520 int GetTargetSkewDelay() const { return m_settings.m_targetSkewDelay.Opt(); }
521 void SetTargetSkewDelay( int aValue ) { m_settings.SetTargetSkewDelay( aValue ); }
522
523 bool GetOverrideCustomRules() const { return m_settings.m_overrideCustomRules; }
524 void SetOverrideCustomRules( bool aOverride ) { m_settings.m_overrideCustomRules = aOverride; }
525
526 int GetCornerRadiusPercentage() const { return m_settings.m_cornerRadiusPercentage; }
527 void SetCornerRadiusPercentage( int aValue ) { m_settings.m_cornerRadiusPercentage = aValue; }
528
529 bool IsSingleSided() const { return m_settings.m_singleSided; }
530 void SetSingleSided( bool aValue ) { m_settings.m_singleSided = aValue; }
531
532 bool IsRounded() const { return m_settings.m_cornerStyle == PNS::MEANDER_STYLE_ROUND; }
533 void SetRounded( bool aFlag ) { m_settings.m_cornerStyle = aFlag ? PNS::MEANDER_STYLE_ROUND
535
536 std::vector<std::pair<wxString, wxVariant>> GetRowData() override
537 {
538 std::vector<std::pair<wxString, wxVariant>> data = PCB_GENERATOR::GetRowData();
539 data.emplace_back( _HKI( "Net" ), m_lastNetName );
540 data.emplace_back( _HKI( "Tuning" ), m_tuningInfo );
541 return data;
542 }
543
544 const STRING_ANY_MAP GetProperties() const override;
545 void SetProperties( const STRING_ANY_MAP& aProps ) override;
546
547 void ShowPropertiesDialog( PCB_BASE_EDIT_FRAME* aEditFrame ) override;
548
549 std::vector<EDA_ITEM*> GetPreviewItems( GENERATOR_TOOL* aTool, PCB_BASE_EDIT_FRAME* aFrame,
550 bool aStatusItemsOnly = false ) override;
551
552 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
553
554protected:
555 void swapData( BOARD_ITEM* aImage ) override
556 {
557 wxASSERT( aImage->Type() == PCB_GENERATOR_T );
558
559 std::swap( *this, *static_cast<PCB_TUNING_PATTERN*>( aImage ) );
560 }
561
562 bool recoverBaseline( PNS::ROUTER* aRouter, int aPNSLayer );
563
564 bool baselineValid();
565
566 bool initBaseLine( PNS::ROUTER* aRouter, int aPNSLayer, BOARD* aBoard, VECTOR2I& aStart,
567 VECTOR2I& aEnd, NETINFO_ITEM* aNet,
568 std::optional<SHAPE_LINE_CHAIN>& aBaseLine );
569
570 bool initBaseLines( PNS::ROUTER* aRouter, int aPNSLayer, BOARD* aBoard );
571
572 bool removeToBaseline( PNS::ROUTER* aRouter, int aPNSLayer, SHAPE_LINE_CHAIN& aBaseLine );
573
574 bool resetToBaseline( GENERATOR_TOOL* aTool, int aPNSLayer, SHAPE_LINE_CHAIN& aBaseLine,
575 bool aPrimary );
576
578
579 void baseMirror( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection )
580 {
581 PCB_GENERATOR::baseMirror( aCentre, aFlipDirection );
582
583 if( m_baseLine )
584 {
585 m_baseLine->Mirror( aCentre, aFlipDirection );
586 m_origin = m_baseLine->CPoint( 0 );
587 m_end = m_baseLine->CLastPoint();
588 }
589
591 m_baseLineCoupled->Mirror( aCentre, aFlipDirection );
592
593 if( m_settings.m_initialSide == PNS::MEANDER_SIDE_RIGHT )
594 m_settings.m_initialSide = PNS::MEANDER_SIDE_LEFT;
595 else
596 m_settings.m_initialSide = PNS::MEANDER_SIDE_RIGHT;
597 }
598
599protected:
601
603
604 std::optional<SHAPE_LINE_CHAIN> m_baseLine;
605 std::optional<SHAPE_LINE_CHAIN> m_baseLineCoupled;
606
610
612
614 wxString m_tuningInfo;
615 long long m_tuningLength;
616
618
620
621 // Bridging cache (pad-to-pad gaps across 2-net series components in a chain)
622public:
623 long long GetCachedBridgingLength( BOARD* aBoard, const wxString& aNetChain, double* aDelayIUOut );
624
625private:
631};
BITMAPS
A list of all bitmap identifiers.
@ ps_diff_pair_tune_length
@ ps_diff_pair_tune_phase
BOX2< VECTOR2I > BOX2I
Definition box2.h:927
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:86
friend class BOARD
Definition board_item.h:578
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:409
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition box2.h:553
constexpr const Vec GetEnd() const
Definition box2.h:209
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition box2.h:653
constexpr coord_type GetLeft() const
Definition box2.h:225
constexpr const Vec & GetOrigin() const
Definition box2.h:207
constexpr coord_type GetRight() const
Definition box2.h:214
constexpr coord_type GetTop() const
Definition box2.h:226
constexpr coord_type GetBottom() const
Definition box2.h:219
The base class for create windows for drawing purpose.
std::unordered_set< EDA_ITEM * > m_items
Definition eda_group.h:91
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
Definition eda_item.h:168
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:84
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:50
Common, abstract interface for edit frames.
void baseMirror(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection)
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
PCB_LAYER_ID GetLayer() const override
Return the primary 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()
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void Move(const VECTOR2I &aMoveVector) override
Move this object.
std::unordered_set< BOARD_ITEM * > GetBoardItems() const
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 SetBaseLine(const SHAPE_LINE_CHAIN &aBaseLine)
void SetEnd(const VECTOR2I &aValue)
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
void SetMinAmplitude(int aValue)
bool recoverBaseline(PNS::ROUTER *aRouter, int aPNSLayer)
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.
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 SetLastNetName(const wxString &aNetName)
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)
const wxString & GetLastNetName() const
LENGTH_TUNING_MODE m_tuningMode
std::vector< std::pair< wxString, wxVariant > > GetRowData() override
const std::optional< SHAPE_LINE_CHAIN > & GetBaseLine() const
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 SetDiffPairGap(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()
const std::optional< SHAPE_LINE_CHAIN > & GetBaseLineCoupled() const
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)
void SetBaseLineCoupled(const SHAPE_LINE_CHAIN &aBaseLine)
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...
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:30
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
static bool Collide(const SHAPE_CIRCLE &aA, const SHAPE_CIRCLE &aB, int aClearance, int *aActual, VECTOR2I *aLocation, VECTOR2I *aMTV)
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:83
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683