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 aContainer.PackFrom( ruleArea );
94}
95
96
97bool SCH_RULE_AREA::Deserialize( const google::protobuf::Any& aContainer )
98{
99 kiapi::schematic::types::SchematicRuleArea ruleArea;
100
101 if( !aContainer.UnpackTo( &ruleArea ) )
102 return false;
103
104 const_cast<KIID&>( m_Uuid ) = KIID( ruleArea.id().value() );
105 SetLocked( ruleArea.locked() == kiapi::common::types::LockedState::LS_LOCKED );
106 SetExcludedFromSim( ruleArea.exclude_from_sim() );
107 SetExcludedFromBOM( ruleArea.exclude_from_bom() );
108 SetExcludedFromBoard( ruleArea.exclude_from_board() );
109 SetDNP( ruleArea.dnp() );
110 kiapi::common::UnpackCustomProperties( ruleArea.custom_properties(), *this );
111
112 if( !EDA_SHAPE::Deserialize( ruleArea.shape(), schIUScale ) )
113 return false;
114
115 if( GetShape() != SHAPE_T::POLY )
116 return false;
117
118 return true;
119}
120
121
126
127
128std::vector<SHAPE*> SCH_RULE_AREA::MakeEffectiveShapes( bool aEdgeOnly ) const
129{
130 std::vector<SHAPE*> effectiveShapes;
131 int width = GetEffectiveWidth();
132
133 switch( m_shape )
134 {
135 case SHAPE_T::POLY:
136 if( GetPolyShape().OutlineCount() == 0 ) // malformed/empty polygon
137 break;
138
139 for( int ii = 0; ii < GetPolyShape().OutlineCount(); ++ii )
140 {
141 const SHAPE_LINE_CHAIN& l = GetPolyShape().COutline( ii );
142
143 if( IsSolidFill() && !aEdgeOnly )
144 effectiveShapes.emplace_back( new SHAPE_SIMPLE( l ) );
145
146 if( width > 0 || !IsSolidFill() || aEdgeOnly )
147 {
148 int segCount = l.SegmentCount();
149
150 for( int jj = 0; jj < segCount; jj++ )
151 effectiveShapes.emplace_back( new SHAPE_SEGMENT( l.CSegment( jj ), width ) );
152 }
153 }
154
155 break;
156
157 default:
158 return SCH_SHAPE::MakeEffectiveShapes( aEdgeOnly );
159 }
160
161 return effectiveShapes;
162}
163
164
165void SCH_RULE_AREA::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
166 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed )
167{
168 if( IsPrivate() )
169 return;
170
171 SCH_RENDER_SETTINGS* renderSettings = getRenderSettings( aPlotter );
172 int pen_size = GetEffectivePenWidth( renderSettings );
173
174 if( GetShape() != SHAPE_T::POLY )
175 SCH_SHAPE::Plot( aPlotter, aBackground, aPlotOpts, aUnit, aBodyStyle, aOffset, aDimmed );
176
177 static std::vector<VECTOR2I> ptList;
178
179 ptList.clear();
180
181 if( GetPolyShape().IsEmpty() )
182 return;
183
184 const std::vector<VECTOR2I>& polyPoints = GetPolyShape().Outline( 0 ).CPoints();
185
186 for( const VECTOR2I& pt : polyPoints )
187 ptList.push_back( pt );
188
189 ptList.push_back( polyPoints[0] );
190
191 COLOR4D color = GetStroke().GetColor();
192 COLOR4D bg = renderSettings->GetBackgroundColor();
193 LINE_STYLE lineStyle = GetStroke().GetLineStyle();
194 FILL_T fill = m_fill;
195
196 if( aBackground )
197 {
198 if( !aPlotter->GetColorMode() )
199 return;
200
201 switch( m_fill )
202 {
204 return;
205
207 color = GetFillColor();
208 break;
209
211 color = renderSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
212 break;
213
214 default:
215 return;
216 }
217
218 pen_size = 0;
219 lineStyle = LINE_STYLE::SOLID;
220 }
221 else /* if( aForeground ) */
222 {
223 if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
224 color = renderSettings->GetLayerColor( m_layer );
225
226 if( lineStyle == LINE_STYLE::DEFAULT )
227 lineStyle = LINE_STYLE::SOLID;
228
230 fill = m_fill;
231 else
232 fill = FILL_T::NO_FILL;
233
234 pen_size = GetEffectivePenWidth( renderSettings );
235 }
236
237 if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
238 bg = COLOR4D::WHITE;
239
240 if( color.m_text && Schematic() )
241 color = COLOR4D( ResolveText( *color.m_text, &Schematic()->CurrentSheet() ) );
242
243 if( aDimmed )
244 {
245 color.Desaturate();
246 color = color.Mix( bg, 0.5f );
247 }
248
249 aPlotter->SetColor( color );
250 aPlotter->SetCurrentLineWidth( pen_size );
251 aPlotter->SetDash( pen_size, lineStyle );
252
253 aPlotter->PlotPoly( ptList, fill, pen_size, nullptr );
254
255 aPlotter->SetDash( pen_size, LINE_STYLE::SOLID );
256}
257
258
259wxString SCH_RULE_AREA::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
260{
261 return _( "Schematic rule area" );
262}
263
264
266{
267 // Save the current state
270
271 // Reset the rule area
272 // Do NOT assume these pointers are valid.
273 m_items.clear();
274 m_itemIDs.clear();
275 m_directives.clear();
276 m_directiveIDs.clear();
277}
278
279
281{
282 EE_RTREE& items = screen->Items();
284
285 // Get any SCH_DIRECTIVE_LABELs which are attached to the rule area border
286 std::unordered_set<SCH_DIRECTIVE_LABEL*> attachedDirectives;
287 EE_RTREE::EE_TYPE candidateDirectives = items.Overlapping( SCH_DIRECTIVE_LABEL_T, boundingBox );
288
289 for( SCH_ITEM* candidateDirective : candidateDirectives )
290 {
291 SCH_DIRECTIVE_LABEL* label = static_cast<SCH_DIRECTIVE_LABEL*>( candidateDirective );
292 const std::vector<VECTOR2I> labelConnectionPoints = label->GetConnectionPoints();
293 assert( labelConnectionPoints.size() == 1 );
294
295 if( GetPolyShape().CollideEdge( labelConnectionPoints[0], nullptr, 5 ) )
296 addDirective( label );
297 }
298
299 // Next find any connectable items which lie within the rule area
300 EE_RTREE::EE_TYPE ruleAreaItems = items.Overlapping( boundingBox );
301
302 for( SCH_ITEM* areaItem : ruleAreaItems )
303 {
304 if( areaItem->IsType( { SCH_ITEM_LOCATE_WIRE_T, SCH_ITEM_LOCATE_BUS_T } ) )
305 {
306 SCH_LINE* lineItem = static_cast<SCH_LINE*>( areaItem );
307 SHAPE_SEGMENT lineSeg( lineItem->GetStartPoint(), lineItem->GetEndPoint(),
308 lineItem->GetLineWidth() );
309
310 if( GetPolyShape().Collide( &lineSeg ) )
311 addContainedItem( areaItem );
312 }
313 else if( areaItem->IsType( { SCH_PIN_T, SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T } ) )
314 {
315 std::vector<VECTOR2I> connectionPoints = areaItem->GetConnectionPoints();
316 wxASSERT( connectionPoints.size() == 1 );
317
318 if( GetPolyShape().Collide( connectionPoints[0] ) )
319 addContainedItem( areaItem );
320 }
321 else if( areaItem->IsType( { SCH_SYMBOL_T } ) )
322 {
323 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( areaItem );
324 const BOX2I symbolBb = symbol->GetBoundingBox();
325 const SHAPE_RECT rect( symbolBb );
326
327 if( GetPolyShape().Collide( &rect ) )
328 {
329 addContainedItem( areaItem );
330
331 // Add child pins which are within the rule area
333 {
334 if( GetPolyShape().Collide( pin->GetPosition() ) )
336 }
337 }
338 }
339 else if( areaItem->IsType( { SCH_SHEET_T } ) )
340 {
341 const BOX2I sheetBb = areaItem->GetBoundingBox();
342 const SHAPE_RECT rect( sheetBb );
343
344 if( GetPolyShape().Collide( &rect ) )
345 {
346 addContainedItem( areaItem );
347 }
348 }
349 }
350}
351
352
353std::vector<std::pair<SCH_RULE_AREA*, SCH_SCREEN*>>
354SCH_RULE_AREA::UpdateRuleAreasInScreens( std::unordered_set<SCH_SCREEN*>& screens, KIGFX::SCH_VIEW* view )
355{
356 std::vector<std::pair<SCH_RULE_AREA*, SCH_SCREEN*>> forceUpdateRuleAreas;
357
358 for( SCH_SCREEN* screen : screens )
359 {
360 // First reset all item caches - must be done first to ensure two rule areas
361 // on the same item don't overwrite each other's caches
362 for( SCH_ITEM* item : screen->Items() )
363 {
364 if( item->Type() == SCH_RULE_AREA_T )
365 static_cast<SCH_RULE_AREA*>( item )->resetCaches();
366
367 if( item->Type() == SCH_DIRECTIVE_LABEL_T && view )
368 view->Update( item, KIGFX::REPAINT );
369
370 item->ClearRuleAreasCache();
371 }
372
373 // Secondly refresh the contained items
374 for( SCH_ITEM* ruleAreaAsItem : screen->Items().OfType( SCH_RULE_AREA_T ) )
375 {
376 SCH_RULE_AREA* ruleArea = static_cast<SCH_RULE_AREA*>( ruleAreaAsItem );
377
378 ruleArea->RefreshContainedItemsAndDirectives( screen );
379
380 if( ruleArea->m_directiveIDs != ruleArea->m_prev_directives )
381 forceUpdateRuleAreas.push_back( { ruleArea, screen } );
382 }
383 }
384
385 return forceUpdateRuleAreas;
386}
387
388
389const std::unordered_set<SCH_ITEM*>& SCH_RULE_AREA::GetContainedItems() const
390{
391 return m_items;
392}
393
394
395const std::unordered_set<SCH_DIRECTIVE_LABEL*>& SCH_RULE_AREA::GetDirectives() const
396{
397 return m_directives;
398}
399
400
401const std::unordered_set<KIID>& SCH_RULE_AREA::GetPastContainedItems() const
402{
403 return m_prev_items;
404}
405
406
407const std::vector<std::pair<wxString, SCH_ITEM*>>
409{
410 std::vector<std::pair<wxString, SCH_ITEM*>> resolvedNetclasses;
411
412 for( SCH_DIRECTIVE_LABEL* directive : m_directives )
413 {
414 directive->RunOnChildren(
415 [&]( SCH_ITEM* aChild )
416 {
417 if( aChild->Type() == SCH_FIELD_T )
418 {
419 SCH_FIELD* field = static_cast<SCH_FIELD*>( aChild );
420
421 if( field->GetUntranslatedName() == wxT( "Netclass" ) )
422 {
423 wxString netclass = field->GetShownText( aSheetPath, FOR_NETNAME );
424
425 if( netclass != wxEmptyString )
426 resolvedNetclasses.push_back( { netclass, directive } );
427 }
428 }
429
430 return true;
431 },
433 }
434
435 return resolvedNetclasses;
436}
437
438
439void SCH_RULE_AREA::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
440{
441 aList.emplace_back( _( "Rule Area" ), wxEmptyString );
442
443 wxString msg = wxString::Format( wxS( "%d" ),
444 GetPolyShape().IsEmpty() ? 0 : GetPolyShape().Outline( 0 ).PointCount() );
445 aList.emplace_back( _( "Points" ), msg );
446
447 m_stroke.GetMsgPanelInfo( aFrame, aList );
448
449 const std::vector<std::pair<wxString, SCH_ITEM*>> netclasses = SCH_RULE_AREA::GetResolvedNetclasses( nullptr );
450 wxString resolvedNetclass = _( "<None>" );
451
452 if( netclasses.size() > 0 )
453 resolvedNetclass = netclasses[0].first;
454
455 aList.emplace_back( _( "Resolved netclass" ), resolvedNetclass );
456}
457
458
460{
461 label->AddConnectedRuleArea( this );
462 m_directives.insert( label );
463 m_directiveIDs.insert( label->m_Uuid );
464}
465
466
468{
469 item->AddRuleAreaToCache( this );
470 m_items.insert( item );
471 m_itemIDs.insert( item->m_Uuid );
472}
473
474
476{
477 m_items.erase( aItem );
478 m_prev_items.erase( aItem->m_Uuid );
479}
480
481
483{
484 m_directives.erase( aLabel );
485 m_prev_directives.erase( aLabel->m_Uuid );
486}
487
488
490{
492 {
501
502 const wxString groupAttributes = _HKI( "Attributes" );
503
504 propMgr.AddProperty( new PROPERTY<SCH_RULE_AREA, bool>( _HKI( "Exclude From Board" ),
506 groupAttributes );
507
508 propMgr.AddProperty( new PROPERTY<SCH_RULE_AREA, bool>( _HKI( "Exclude From Simulation" ),
510 groupAttributes );
511
512 propMgr.AddProperty( new PROPERTY<SCH_RULE_AREA, bool>( _HKI( "Exclude From Bill of Materials" ),
514 groupAttributes );
515
516 propMgr.AddProperty( new PROPERTY<SCH_RULE_AREA, bool>( _HKI( "Do not Populate" ),
518 groupAttributes );
519 }
constexpr EDA_IU_SCALE schIUScale
Definition base_units.h:130
BOX2< VECTOR2I > BOX2I
Definition box2.h:914
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:738
SHAPE_POLY_SET & GetPolyShape()
SHAPE_T GetShape() const
Definition eda_shape.h:175
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
bool IsSolidFill() const
Definition eda_shape.h:123
COLOR4D GetFillColor() const
Definition eda_shape.h:159
STROKE_PARAMS m_stroke
Definition eda_shape.h:739
FILL_T m_fill
Definition eda_shape.h:742
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:136
virtual void SetDash(int aLineWidth, LINE_STYLE aLineStyle)=0
bool GetColorMode() const
Definition plotter.h:164
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: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:838
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:118
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:57
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:73
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:92
#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:487
@ LAYER_DEVICE_BACKGROUND
Definition layer_ids.h:506
@ LAYER_NOTES_BACKGROUND
Definition layer_ids.h:491
@ LAYER_SELECTION_SHADOWS
Definition layer_ids.h:517
@ 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_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