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