KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_rule_area.cpp
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#include <algorithm>
21#include <iterator>
22#include <map>
23#include <vector>
24
25#include <eda_draw_frame.h>
26#include <erc/erc_item.h>
27#include <erc/erc_settings.h>
30#include <sch_line.h>
31#include <sch_marker.h>
32#include <sch_rtree.h>
33#include <sch_rule_area.h>
34#include <sch_screen.h>
35#include <sch_sheet_path.h>
36#include <geometry/shape_rect.h>
37#include <api/api_utils.h>
38#include <api/schematic/schematic_types.pb.h>
39#include <base_units.h>
40#include <properties/property.h>
42
43
45{
46 // Break bidirectional references so that items destroyed after this rule area
47 // don't try to call RemoveItem() on freed memory.
48 for( SCH_ITEM* item : m_items )
49 item->RemoveRuleAreaFromCache( this );
50
51 for( SCH_DIRECTIVE_LABEL* label : m_directives )
52 label->RemoveConnectedRuleArea( this );
53}
54
55
57{
58 return wxT( "SCH_RULE_AREA" );
59}
60
61
63{
64 return _( "Rule Area" );
65}
66
67
69{
70 auto clone = new SCH_RULE_AREA( *this );
71
72 // A clone has no reciprocal links to the source schematic's items.
73 clone->resetCaches();
74 return clone;
75}
76
77
78void SCH_RULE_AREA::Serialize( google::protobuf::Any& aContainer ) const
79{
80 kiapi::schematic::types::SchematicRuleArea ruleArea;
81
82 ruleArea.mutable_id()->set_value( m_Uuid.AsStdString() );
83 ruleArea.set_locked( IsLocked() ? kiapi::common::types::LockedState::LS_LOCKED
84 : kiapi::common::types::LockedState::LS_UNLOCKED );
85 ruleArea.set_exclude_from_sim( m_excludedFromSim );
86 ruleArea.set_exclude_from_bom( m_excludedFromBOM );
87 ruleArea.set_exclude_from_board( m_excludedFromBoard );
88 ruleArea.set_dnp( m_DNP );
89
90 EDA_SHAPE::Serialize( *ruleArea.mutable_shape(), schIUScale );
91
92 kiapi::common::PackCustomProperties( ruleArea.mutable_custom_properties(), *this );
93
94 if( !aContainer.PackFrom( ruleArea ) )
95 wxFAIL_MSG( wxT( "Failed to pack SCH_RULE_AREA" ) );
96}
97
98
99bool SCH_RULE_AREA::Deserialize( const google::protobuf::Any& aContainer )
100{
101 kiapi::schematic::types::SchematicRuleArea ruleArea;
102
103 if( !aContainer.UnpackTo( &ruleArea ) )
104 return false;
105
106 const_cast<KIID&>( m_Uuid ) = KIID( ruleArea.id().value() );
107 SetLocked( ruleArea.locked() == kiapi::common::types::LockedState::LS_LOCKED );
108 SetExcludedFromSim( ruleArea.exclude_from_sim() );
109 SetExcludedFromBOM( ruleArea.exclude_from_bom() );
110 SetExcludedFromBoard( ruleArea.exclude_from_board() );
111 SetDNP( ruleArea.dnp() );
112 kiapi::common::UnpackCustomProperties( ruleArea.custom_properties(), *this );
113
114 if( !EDA_SHAPE::Deserialize( ruleArea.shape(), schIUScale ) )
115 return false;
116
117 if( GetShape() != SHAPE_T::POLY )
118 return false;
119
120 return true;
121}
122
123
128
129
130std::vector<SHAPE*> SCH_RULE_AREA::MakeEffectiveShapes( bool aEdgeOnly ) const
131{
132 std::vector<SHAPE*> effectiveShapes;
133 int width = GetEffectiveWidth();
134
135 switch( m_shape )
136 {
137 case SHAPE_T::POLY:
138 if( GetPolyShape().OutlineCount() == 0 ) // malformed/empty polygon
139 break;
140
141 for( int ii = 0; ii < GetPolyShape().OutlineCount(); ++ii )
142 {
143 const SHAPE_LINE_CHAIN& l = GetPolyShape().COutline( ii );
144
145 if( IsSolidFill() && !aEdgeOnly )
146 effectiveShapes.emplace_back( new SHAPE_SIMPLE( l ) );
147
148 if( width > 0 || !IsSolidFill() || aEdgeOnly )
149 {
150 int segCount = l.SegmentCount();
151
152 for( int jj = 0; jj < segCount; jj++ )
153 effectiveShapes.emplace_back( new SHAPE_SEGMENT( l.CSegment( jj ), width ) );
154 }
155 }
156
157 break;
158
159 default:
160 return SCH_SHAPE::MakeEffectiveShapes( aEdgeOnly );
161 }
162
163 return effectiveShapes;
164}
165
166
167void SCH_RULE_AREA::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
168 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed )
169{
170 if( IsPrivate() )
171 return;
172
173 SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter );
174 int pen_size = GetEffectivePenWidth( renderSettings );
175
176 if( GetShape() != SHAPE_T::POLY )
177 SCH_SHAPE::Plot( aPlotter, aBackground, aPlotOpts, aUnit, aBodyStyle, aOffset, aDimmed );
178
179 static std::vector<VECTOR2I> ptList;
180
181 ptList.clear();
182
183 if( GetPolyShape().IsEmpty() )
184 return;
185
186 const std::vector<VECTOR2I>& polyPoints = GetPolyShape().Outline( 0 ).CPoints();
187
188 for( const VECTOR2I& pt : polyPoints )
189 ptList.push_back( pt );
190
191 ptList.push_back( polyPoints[0] );
192
193 COLOR4D color = GetStroke().GetColor();
194 COLOR4D bg = renderSettings->GetBackgroundColor();
195 LINE_STYLE lineStyle = GetStroke().GetLineStyle();
196 FILL_T fill = m_fill;
197
198 if( aBackground )
199 {
200 if( !aPlotter->GetColorMode() )
201 return;
202
203 switch( m_fill )
204 {
206 return;
207
209 color = GetFillColor();
210 break;
211
213 color = renderSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
214 break;
215
216 default:
217 return;
218 }
219
220 pen_size = 0;
221 lineStyle = LINE_STYLE::SOLID;
222 }
223 else /* if( aForeground ) */
224 {
225 if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
226 color = renderSettings->GetLayerColor( m_layer );
227
228 if( lineStyle == LINE_STYLE::DEFAULT )
229 lineStyle = LINE_STYLE::SOLID;
230
232 fill = m_fill;
233 else
234 fill = FILL_T::NO_FILL;
235
236 pen_size = GetEffectivePenWidth( renderSettings );
237 }
238
239 if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
240 bg = COLOR4D::WHITE;
241
242 if( color.m_text && Schematic() )
243 color = COLOR4D( ResolveText( *color.m_text, &Schematic()->CurrentSheet() ) );
244
245 if( aDimmed )
246 {
247 color.Desaturate();
248 color = color.Mix( bg, 0.5f );
249 }
250
251 aPlotter->SetColor( color );
252 aPlotter->SetCurrentLineWidth( pen_size );
253 aPlotter->SetDash( pen_size, lineStyle );
254
255 aPlotter->PlotPoly( ptList, fill, pen_size, nullptr );
256
257 aPlotter->SetDash( pen_size, LINE_STYLE::SOLID );
258}
259
260
261wxString SCH_RULE_AREA::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
262{
263 return _( "Schematic rule area" );
264}
265
266
268{
269 // Save the current state
272
273 // Reset the rule area
274 // Do NOT assume these pointers are valid.
275 m_items.clear();
276 m_itemIDs.clear();
277 m_directives.clear();
278 m_directiveIDs.clear();
279}
280
281
283{
284 EE_RTREE& items = screen->Items();
286
287 // Get any SCH_DIRECTIVE_LABELs which are attached to the rule area border
288 std::unordered_set<SCH_DIRECTIVE_LABEL*> attachedDirectives;
289 EE_RTREE::EE_TYPE candidateDirectives = items.Overlapping( SCH_DIRECTIVE_LABEL_T, boundingBox );
290
291 for( SCH_ITEM* candidateDirective : candidateDirectives )
292 {
293 SCH_DIRECTIVE_LABEL* label = static_cast<SCH_DIRECTIVE_LABEL*>( candidateDirective );
294 const std::vector<VECTOR2I> labelConnectionPoints = label->GetConnectionPoints();
295 assert( labelConnectionPoints.size() == 1 );
296
297 if( GetPolyShape().CollideEdge( labelConnectionPoints[0], nullptr, 5 ) )
298 addDirective( label );
299 }
300
301 // Next find any connectable items which lie within the rule area
302 EE_RTREE::EE_TYPE ruleAreaItems = items.Overlapping( boundingBox );
303
304 for( SCH_ITEM* areaItem : ruleAreaItems )
305 {
306 if( areaItem->IsType( { SCH_ITEM_LOCATE_WIRE_T, SCH_ITEM_LOCATE_BUS_T } ) )
307 {
308 SCH_LINE* lineItem = static_cast<SCH_LINE*>( areaItem );
309 SHAPE_SEGMENT lineSeg( lineItem->GetStartPoint(), lineItem->GetEndPoint(),
310 lineItem->GetLineWidth() );
311
312 if( GetPolyShape().Collide( &lineSeg ) )
313 addContainedItem( areaItem );
314 }
315 else if( areaItem->IsType( { SCH_PIN_T, SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T } ) )
316 {
317 std::vector<VECTOR2I> connectionPoints = areaItem->GetConnectionPoints();
318 wxASSERT( connectionPoints.size() == 1 );
319
320 if( GetPolyShape().Collide( connectionPoints[0] ) )
321 addContainedItem( areaItem );
322 }
323 else if( areaItem->IsType( { SCH_SYMBOL_T } ) )
324 {
325 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( areaItem );
326 const BOX2I symbolBb = symbol->GetBoundingBox();
327 const SHAPE_RECT rect( symbolBb );
328
329 if( GetPolyShape().Collide( &rect ) )
330 {
331 addContainedItem( areaItem );
332
333 // Add child pins which are within the rule area
335 {
336 if( GetPolyShape().Collide( pin->GetPosition() ) )
338 }
339 }
340 }
341 else if( areaItem->IsType( { SCH_SHEET_T } ) )
342 {
343 const BOX2I sheetBb = areaItem->GetBoundingBox();
344 const SHAPE_RECT rect( sheetBb );
345
346 if( GetPolyShape().Collide( &rect ) )
347 {
348 addContainedItem( areaItem );
349 }
350 }
351 }
352}
353
354
355std::vector<std::pair<SCH_RULE_AREA*, SCH_SCREEN*>>
356SCH_RULE_AREA::UpdateRuleAreasInScreens( std::unordered_set<SCH_SCREEN*>& screens, KIGFX::SCH_VIEW* view )
357{
358 std::vector<std::pair<SCH_RULE_AREA*, SCH_SCREEN*>> forceUpdateRuleAreas;
359
360 for( SCH_SCREEN* screen : screens )
361 {
362 // First reset all item caches - must be done first to ensure two rule areas
363 // on the same item don't overwrite each other's caches. Pins are owned by
364 // symbols and are not in the screen's item tree, so clear them through their parent.
365 for( SCH_ITEM* item : screen->Items() )
366 {
367 if( item->Type() == SCH_RULE_AREA_T )
368 static_cast<SCH_RULE_AREA*>( item )->resetCaches();
369
370 if( item->Type() == SCH_DIRECTIVE_LABEL_T )
371 {
372 static_cast<SCH_DIRECTIVE_LABEL*>( item )->ClearConnectedRuleAreas();
373
374 if( view )
375 view->Update( item, KIGFX::REPAINT );
376 }
377
378 item->ClearRuleAreasCache();
379
380 if( item->Type() == SCH_SYMBOL_T )
381 {
382 item->RunOnChildren(
383 []( SCH_ITEM* aChild )
384 {
385 aChild->ClearRuleAreasCache();
386 },
388 }
389 }
390
391 // Secondly refresh the contained items
392 for( SCH_ITEM* ruleAreaAsItem : screen->Items().OfType( SCH_RULE_AREA_T ) )
393 {
394 SCH_RULE_AREA* ruleArea = static_cast<SCH_RULE_AREA*>( ruleAreaAsItem );
395
396 ruleArea->RefreshContainedItemsAndDirectives( screen );
397
398 if( ruleArea->m_directiveIDs != ruleArea->m_prev_directives )
399 forceUpdateRuleAreas.push_back( { ruleArea, screen } );
400 }
401 }
402
403 return forceUpdateRuleAreas;
404}
405
406
407const std::unordered_set<SCH_ITEM*>& SCH_RULE_AREA::GetContainedItems() const
408{
409 return m_items;
410}
411
412
413const std::unordered_set<SCH_DIRECTIVE_LABEL*>& SCH_RULE_AREA::GetDirectives() const
414{
415 return m_directives;
416}
417
418
419const std::unordered_set<KIID>& SCH_RULE_AREA::GetPastContainedItems() const
420{
421 return m_prev_items;
422}
423
424
425const std::vector<std::pair<wxString, SCH_ITEM*>>
427{
428 std::vector<std::pair<wxString, SCH_ITEM*>> resolvedNetclasses;
429
430 for( SCH_DIRECTIVE_LABEL* directive : m_directives )
431 {
432 directive->RunOnChildren(
433 [&]( SCH_ITEM* aChild )
434 {
435 if( aChild->Type() == SCH_FIELD_T )
436 {
437 SCH_FIELD* field = static_cast<SCH_FIELD*>( aChild );
438
439 if( field->GetUntranslatedName() == wxT( "Netclass" ) )
440 {
441 wxString netclass = field->GetShownText( aSheetPath, FOR_NETNAME );
442
443 if( netclass != wxEmptyString )
444 resolvedNetclasses.push_back( { netclass, directive } );
445 }
446 }
447
448 return true;
449 },
451 }
452
453 return resolvedNetclasses;
454}
455
456
457void SCH_RULE_AREA::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
458{
459 aList.emplace_back( _( "Rule Area" ), wxEmptyString );
460
461 wxString msg = wxString::Format( wxS( "%d" ),
462 GetPolyShape().IsEmpty() ? 0 : GetPolyShape().Outline( 0 ).PointCount() );
463 aList.emplace_back( _( "Points" ), msg );
464
465 m_stroke.GetMsgPanelInfo( aFrame, aList );
466
467 const std::vector<std::pair<wxString, SCH_ITEM*>> netclasses = SCH_RULE_AREA::GetResolvedNetclasses( nullptr );
468 wxString resolvedNetclass = _( "<None>" );
469
470 if( netclasses.size() > 0 )
471 resolvedNetclass = netclasses[0].first;
472
473 aList.emplace_back( _( "Resolved netclass" ), resolvedNetclass );
474}
475
476
478{
479 label->AddConnectedRuleArea( this );
480 m_directives.insert( label );
481 m_directiveIDs.insert( label->m_Uuid );
482}
483
484
486{
487 item->AddRuleAreaToCache( this );
488 m_items.insert( item );
489 m_itemIDs.insert( item->m_Uuid );
490}
491
492
494{
495 m_items.erase( aItem );
496 m_prev_items.erase( aItem->m_Uuid );
497}
498
499
501{
502 m_directives.erase( aLabel );
503 m_prev_directives.erase( aLabel->m_Uuid );
504}
505
506
508{
510 {
519
520 const wxString groupAttributes = _HKI( "Attributes" );
521
522 propMgr.AddProperty( new PROPERTY<SCH_RULE_AREA, bool>( _HKI( "Exclude From Board" ),
524 groupAttributes );
525
526 propMgr.AddProperty( new PROPERTY<SCH_RULE_AREA, bool>( _HKI( "Exclude From Simulation" ),
528 groupAttributes );
529
530 propMgr.AddProperty( new PROPERTY<SCH_RULE_AREA, bool>( _HKI( "Exclude From Bill of Materials" ),
532 groupAttributes );
533
534 propMgr.AddProperty( new PROPERTY<SCH_RULE_AREA, bool>( _HKI( "Do not Populate" ),
536 groupAttributes );
537 }
constexpr EDA_IU_SCALE schIUScale
Definition base_units.h:130
BOX2< VECTOR2I > BOX2I
Definition box2.h:917
static const COLOR4D WHITE
Definition color4d.h:403
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
Definition color4d.h:400
The base class for create windows for drawing purpose.
const KIID m_Uuid
Definition eda_item.h:599
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:84
SHAPE_T m_shape
Definition eda_shape.h:754
SHAPE_POLY_SET & GetPolyShape()
SHAPE_T GetShape() const
Definition eda_shape.h:178
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
bool IsSolidFill() const
Definition eda_shape.h:126
COLOR4D GetFillColor() const
Definition eda_shape.h:162
STROKE_PARAMS m_stroke
Definition eda_shape.h:755
FILL_T m_fill
Definition eda_shape.h:759
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Implement an R-tree for fast spatial and type indexing of schematic items.
Definition sch_rtree.h:37
EE_TYPE Overlapping(const BOX2I &aRect) const
Definition sch_rtree.h:253
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
std::shared_ptr< wxString > m_text
Definition color4d.h:397
COLOR4D & Desaturate()
Removes color (in HSL model)
Definition color4d.cpp:530
COLOR4D Mix(const COLOR4D &aColor, double aFactor) const
Return a color that is mixed with the input by a factor.
Definition color4d.h:293
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
void Update(const KIGFX::VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition sch_view.cpp:73
Definition kiid.h:46
Base plotter engine class.
Definition plotter.h:138
virtual void SetDash(int aLineWidth, LINE_STYLE aLineStyle)=0
bool GetColorMode() const
Definition plotter.h:166
virtual void SetCurrentLineWidth(int width, void *aData=nullptr)=0
Set the line width for the next drawing.
virtual void PlotPoly(const std::vector< VECTOR2I > &aCornerList, FILL_T aFill, int aWidth, void *aData)=0
Draw a polygon ( filled or not ).
virtual void SetColor(const COLOR4D &color)=0
Provide class metadata.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
void AddConnectedRuleArea(SCH_RULE_AREA *aRuleArea)
Adds an entry to the connected rule area cache.
wxString GetUntranslatedName() const
Get the untranslated field name for storage, variable look-up, etc.
wxString GetShownText(const SCH_SHEET_PATH *aPath, RESOLUTION_CONTEXT aContext, const wxString &aVariantName=wxEmptyString, int aDepth=0) const
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:170
void SetLocked(bool aLocked) override
Definition sch_item.h:262
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
Definition sch_item.cpp:46
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
Definition sch_item.cpp:302
bool IsLocked() const override
Definition sch_item.cpp:179
bool IsPrivate() const
Definition sch_item.h:259
void AddRuleAreaToCache(SCH_RULE_AREA *aRuleArea)
Add a rule area to the item's cache.
Definition sch_item.h:728
void ClearRuleAreasCache()
Reset the cache of rule areas (called prior to schematic connectivity computation)
Definition sch_item.h:723
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
Definition sch_item.cpp:65
wxString ResolveText(const wxString &aText, const SCH_SHEET_PATH *aPath, int aDepth=0) const
Definition sch_item.cpp:464
int GetEffectivePenWidth(const SCH_RENDER_SETTINGS *aSettings) const
SCH_LAYER_ID m_layer
Definition sch_item.h:843
std::vector< VECTOR2I > GetConnectionPoints() const override
Add all the connection points for this item to aPoints.
Segment description base class to describe items which have 2 end points (track, wire,...
Definition sch_line.h:39
VECTOR2I GetEndPoint() const
Definition sch_line.h:145
VECTOR2I GetStartPoint() const
Definition sch_line.h:136
int GetLineWidth() const
Definition sch_line.h:195
const KIGFX::COLOR4D & GetBackgroundColor() const override
Return current background color settings.
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
std::unordered_set< KIID > m_directiveIDs
virtual std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const override
Make a set of SHAPE objects representing the EDA_SHAPE.
const std::unordered_set< SCH_ITEM * > & GetContainedItems() const
Return a set of all items contained within the rule area.
void addContainedItem(SCH_ITEM *item)
Add an item to the list of items which this rule area affects.
std::unordered_set< KIID > m_prev_items
All SCH_ITEM objectss contained or intersecting the rule area in the previous update.
std::unordered_set< KIID > m_prev_directives
All SCH_DIRECTIVE_LABEL objects attached to the rule area border in the previous update.
void RefreshContainedItemsAndDirectives(SCH_SCREEN *screen)
Refresh the list of items which this rule area affects.
void SetExcludedFromBOMProp(bool aExcludeFromBOM)
bool m_DNP
True if symbol is set to 'Do Not Populate'.
void resetCaches()
Reset all item and directive caches, saving the current state first.
const std::unordered_set< SCH_DIRECTIVE_LABEL * > & GetDirectives() const
Return the set of all directive labels attached to the rule area border.
void addDirective(SCH_DIRECTIVE_LABEL *label)
Add a directive label which applies to items within ths rule area.
std::vector< int > ViewGetLayers() const override
Return the layers the item is drawn on (which may be more than its "home" layer)
bool GetExcludedFromBoardProp() const
void SetExcludedFromSimProp(bool aExcludeFromSim)
wxString GetFriendlyName() const override
virtual void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Plot the item to aPlotter.
std::unordered_set< SCH_DIRECTIVE_LABEL * > m_directives
All SCH_DIRECTIVE_LABEL objects attached to the rule area border. No ownership.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
bool GetExcludedFromSimProp() const
const std::vector< std::pair< wxString, SCH_ITEM * > > GetResolvedNetclasses(const SCH_SHEET_PATH *aSheetPath) const
Resolve the netclass of this rule area from connected directive labels.
void SetDNP(bool aDNP, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
void SetExcludedFromSim(bool aExcludeFromSim, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
Set or clear the exclude from simulation flag.
static std::vector< std::pair< SCH_RULE_AREA *, SCH_SCREEN * > > UpdateRuleAreasInScreens(std::unordered_set< SCH_SCREEN * > &screens, KIGFX::SCH_VIEW *view)
Update all rule area connectvity / caches in the given sheet paths.
void SetExcludedFromBOM(bool aExcludeFromBOM, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
Set or clear the exclude from schematic bill of materials flag.
virtual ~SCH_RULE_AREA()
std::unordered_set< SCH_ITEM * > m_items
All SCH_ITEM objects currently contained or intersecting the rule area. No ownership.
const std::unordered_set< KIID > & GetPastContainedItems() const
void SetExcludedFromBoardProp(bool aExclude)
std::unordered_set< KIID > m_itemIDs
void RemoveDirective(SCH_DIRECTIVE_LABEL *aLabel)
Remove a directive label from this rule area's caches (called when the label is deleted).
bool GetExcludedFromBOMProp() const
bool GetDNPProp() const
wxString GetClass() const override
Return the class name.
void RemoveItem(SCH_ITEM *aItem)
Remove an item from this rule area's caches (called when the item is deleted).
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Get the message panel info for the rule area.
void SetExcludedFromBoard(bool aExclude, const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) override
Set or clear exclude from board netlist flag.
void SetDNPProp(bool aDNP)
EE_RTREE & Items()
Get the full RTree, usually for iterating.
Definition sch_screen.h:122
std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const override
Make a set of SHAPE objects representing the SCH_SHAPE.
Definition sch_shape.h:126
void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Plot the item to aPlotter.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
STROKE_PARAMS GetStroke() const override
Definition sch_shape.h:59
int GetEffectiveWidth() const override
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
Schematic symbol object.
Definition sch_symbol.h:76
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
std::vector< SCH_PIN * > GetGraphicalPins(int aUnit, int aBodyStyle) const override
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
int SegmentCount() const
Return the number of segments in this line chain.
const SEG CSegment(int aIndex) const
Return a constant copy of the aIndex segment in the line chain.
const std::vector< VECTOR2I > & CPoints() const
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
int OutlineCount() const
Return the number of outlines in the set.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
Represent a simple polygon consisting of a zero-thickness closed chain of connected line segments.
LINE_STYLE GetLineStyle() const
KIGFX::COLOR4D GetColor() const
@ FOR_NETNAME
Definition common.h:94
#define _(s)
FILL_T
Definition eda_fill.h:29
@ FILLED_WITH_COLOR
Definition eda_fill.h:33
@ NO_FILL
Definition eda_fill.h:30
@ FILLED_WITH_BG_BODYCOLOR
Definition eda_fill.h:32
@ FILLED_SHAPE
Fill with object color.
Definition eda_fill.h:31
@ NO_RECURSE
Definition eda_item.h:52
@ LAYER_RULE_AREAS
Definition layer_ids.h:496
@ LAYER_DEVICE_BACKGROUND
Definition layer_ids.h:515
@ LAYER_NOTES_BACKGROUND
Definition layer_ids.h:500
@ LAYER_SELECTION_SHADOWS
Definition layer_ids.h:526
@ REPAINT
Item needs to be redrawn.
Definition view_item.h:54
KICOMMON_API void PackCustomProperties(google::protobuf::RepeatedPtrField< types::CustomProperty > *aOutput, const EDA_ITEM &aItem)
KICOMMON_API void UnpackCustomProperties(const google::protobuf::RepeatedPtrField< types::CustomProperty > &aInput, EDA_ITEM &aItem)
#define _HKI(x)
Definition page_info.cpp:40
#define TYPE_HASH(x)
Macro to generate unique identifier for a type.
Definition property.h:74
#define REGISTER_TYPE(x)
Helper macro to map type hashes to names.
static struct SCH_RULE_AREA_DESC _SCH_RULE_AREA_DESC
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
static bool Collide(const SHAPE_CIRCLE &aA, const SHAPE_CIRCLE &aB, int aClearance, int *aActual, VECTOR2I *aLocation, VECTOR2I *aMTV)
BOX2I boundingBox(T aObject, int aLayer)
Used by SHAPE_INDEX to get the bounding box of a generic T object.
Definition shape_index.h:61
LINE_STYLE
Dashed line types.
The EE_TYPE struct provides a type-specific auto-range iterator to the RTree.
Definition sch_rtree.h:198
#define ALL_UNITS
Definition symbol.h:150
#define ALL_BODY_STYLES
Definition symbol.h:151
KIBIS_PIN * pin
@ SCH_SYMBOL_T
Definition typeinfo.h:168
@ SCH_FIELD_T
Definition typeinfo.h:146
@ SCH_DIRECTIVE_LABEL_T
Definition typeinfo.h:167
@ SCH_RULE_AREA_T
Definition typeinfo.h:166
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708
static PIECE rect(double aLeft, double aTop, double aRight, double aBottom, bool aMixed=false)