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 const std::vector<VECTOR2I>& polyPoints = GetPolyShape().Outline( 0 ).CPoints();
182
183 for( const VECTOR2I& pt : polyPoints )
184 ptList.push_back( pt );
185
186 ptList.push_back( polyPoints[0] );
187
188 COLOR4D color = GetStroke().GetColor();
189 COLOR4D bg = renderSettings->GetBackgroundColor();
190 LINE_STYLE lineStyle = GetStroke().GetLineStyle();
191 FILL_T fill = m_fill;
192
193 if( aBackground )
194 {
195 if( !aPlotter->GetColorMode() )
196 return;
197
198 switch( m_fill )
199 {
201 return;
202
204 color = GetFillColor();
205 break;
206
208 color = renderSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
209 break;
210
211 default:
212 return;
213 }
214
215 pen_size = 0;
216 lineStyle = LINE_STYLE::SOLID;
217 }
218 else /* if( aForeground ) */
219 {
220 if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
221 color = renderSettings->GetLayerColor( m_layer );
222
223 if( lineStyle == LINE_STYLE::DEFAULT )
224 lineStyle = LINE_STYLE::SOLID;
225
227 fill = m_fill;
228 else
229 fill = FILL_T::NO_FILL;
230
231 pen_size = GetEffectivePenWidth( renderSettings );
232 }
233
234 if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
235 bg = COLOR4D::WHITE;
236
237 if( color.m_text && Schematic() )
238 color = COLOR4D( ResolveText( *color.m_text, &Schematic()->CurrentSheet() ) );
239
240 if( aDimmed )
241 {
242 color.Desaturate();
243 color = color.Mix( bg, 0.5f );
244 }
245
246 aPlotter->SetColor( color );
247 aPlotter->SetCurrentLineWidth( pen_size );
248 aPlotter->SetDash( pen_size, lineStyle );
249
250 aPlotter->PlotPoly( ptList, fill, pen_size, nullptr );
251
252 aPlotter->SetDash( pen_size, LINE_STYLE::SOLID );
253}
254
255
256wxString SCH_RULE_AREA::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
257{
258 return _( "Schematic rule area" );
259}
260
261
263{
264 // Save the current state
267
268 // Reset the rule area
269 // Do NOT assume these pointers are valid.
270 m_items.clear();
271 m_itemIDs.clear();
272 m_directives.clear();
273 m_directiveIDs.clear();
274}
275
276
278{
279 EE_RTREE& items = screen->Items();
281
282 // Get any SCH_DIRECTIVE_LABELs which are attached to the rule area border
283 std::unordered_set<SCH_DIRECTIVE_LABEL*> attachedDirectives;
284 EE_RTREE::EE_TYPE candidateDirectives = items.Overlapping( SCH_DIRECTIVE_LABEL_T, boundingBox );
285
286 for( SCH_ITEM* candidateDirective : candidateDirectives )
287 {
288 SCH_DIRECTIVE_LABEL* label = static_cast<SCH_DIRECTIVE_LABEL*>( candidateDirective );
289 const std::vector<VECTOR2I> labelConnectionPoints = label->GetConnectionPoints();
290 assert( labelConnectionPoints.size() == 1 );
291
292 if( GetPolyShape().CollideEdge( labelConnectionPoints[0], nullptr, 5 ) )
293 addDirective( label );
294 }
295
296 // Next find any connectable items which lie within the rule area
297 EE_RTREE::EE_TYPE ruleAreaItems = items.Overlapping( boundingBox );
298
299 for( SCH_ITEM* areaItem : ruleAreaItems )
300 {
301 if( areaItem->IsType( { SCH_ITEM_LOCATE_WIRE_T, SCH_ITEM_LOCATE_BUS_T } ) )
302 {
303 SCH_LINE* lineItem = static_cast<SCH_LINE*>( areaItem );
304 SHAPE_SEGMENT lineSeg( lineItem->GetStartPoint(), lineItem->GetEndPoint(),
305 lineItem->GetLineWidth() );
306
307 if( GetPolyShape().Collide( &lineSeg ) )
308 addContainedItem( areaItem );
309 }
310 else if( areaItem->IsType( { SCH_PIN_T, SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIER_LABEL_T } ) )
311 {
312 std::vector<VECTOR2I> connectionPoints = areaItem->GetConnectionPoints();
313 wxASSERT( connectionPoints.size() == 1 );
314
315 if( GetPolyShape().Collide( connectionPoints[0] ) )
316 addContainedItem( areaItem );
317 }
318 else if( areaItem->IsType( { SCH_SYMBOL_T } ) )
319 {
320 SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( areaItem );
321 const BOX2I symbolBb = symbol->GetBoundingBox();
322 const SHAPE_RECT rect( symbolBb );
323
324 if( GetPolyShape().Collide( &rect ) )
325 {
326 addContainedItem( areaItem );
327
328 // Add child pins which are within the rule area
329 for( SCH_PIN* pin : symbol->GetPins() )
330 {
331 if( GetPolyShape().Collide( pin->GetPosition() ) )
333 }
334 }
335 }
336 else if( areaItem->IsType( { SCH_SHEET_T } ) )
337 {
338 const BOX2I sheetBb = areaItem->GetBoundingBox();
339 const SHAPE_RECT rect( sheetBb );
340
341 if( GetPolyShape().Collide( &rect ) )
342 {
343 addContainedItem( areaItem );
344 }
345 }
346 }
347}
348
349
350std::vector<std::pair<SCH_RULE_AREA*, SCH_SCREEN*>>
351SCH_RULE_AREA::UpdateRuleAreasInScreens( std::unordered_set<SCH_SCREEN*>& screens, KIGFX::SCH_VIEW* view )
352{
353 std::vector<std::pair<SCH_RULE_AREA*, SCH_SCREEN*>> forceUpdateRuleAreas;
354
355 for( SCH_SCREEN* screen : screens )
356 {
357 // First reset all item caches - must be done first to ensure two rule areas
358 // on the same item don't overwrite each other's caches
359 for( SCH_ITEM* item : screen->Items() )
360 {
361 if( item->Type() == SCH_RULE_AREA_T )
362 static_cast<SCH_RULE_AREA*>( item )->resetCaches();
363
364 if( item->Type() == SCH_DIRECTIVE_LABEL_T && view )
365 view->Update( item, KIGFX::REPAINT );
366
367 item->ClearRuleAreasCache();
368 }
369
370 // Secondly refresh the contained items
371 for( SCH_ITEM* ruleAreaAsItem : screen->Items().OfType( SCH_RULE_AREA_T ) )
372 {
373 SCH_RULE_AREA* ruleArea = static_cast<SCH_RULE_AREA*>( ruleAreaAsItem );
374
375 ruleArea->RefreshContainedItemsAndDirectives( screen );
376
377 if( ruleArea->m_directiveIDs != ruleArea->m_prev_directives )
378 forceUpdateRuleAreas.push_back( { ruleArea, screen } );
379 }
380 }
381
382 return forceUpdateRuleAreas;
383}
384
385
386const std::unordered_set<SCH_ITEM*>& SCH_RULE_AREA::GetContainedItems() const
387{
388 return m_items;
389}
390
391
392const std::unordered_set<SCH_DIRECTIVE_LABEL*>& SCH_RULE_AREA::GetDirectives() const
393{
394 return m_directives;
395}
396
397
398const std::unordered_set<KIID>& SCH_RULE_AREA::GetPastContainedItems() const
399{
400 return m_prev_items;
401}
402
403
404const std::vector<std::pair<wxString, SCH_ITEM*>>
406{
407 std::vector<std::pair<wxString, SCH_ITEM*>> resolvedNetclasses;
408
409 for( SCH_DIRECTIVE_LABEL* directive : m_directives )
410 {
411 directive->RunOnChildren(
412 [&]( SCH_ITEM* aChild )
413 {
414 if( aChild->Type() == SCH_FIELD_T )
415 {
416 SCH_FIELD* field = static_cast<SCH_FIELD*>( aChild );
417
418 if( field->GetUntranslatedName() == wxT( "Netclass" ) )
419 {
420 wxString netclass = field->GetShownText( aSheetPath, FOR_NETNAME );
421
422 if( netclass != wxEmptyString )
423 resolvedNetclasses.push_back( { netclass, directive } );
424 }
425 }
426
427 return true;
428 },
430 }
431
432 return resolvedNetclasses;
433}
434
435
436void SCH_RULE_AREA::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList )
437{
438 aList.emplace_back( _( "Rule Area" ), wxEmptyString );
439
440 wxString msg;
441 msg.Printf( wxS( "%d" ), GetPolyShape().Outline( 0 ).PointCount() );
442 aList.emplace_back( _( "Points" ), msg );
443
444 m_stroke.GetMsgPanelInfo( aFrame, aList );
445
446 const std::vector<std::pair<wxString, SCH_ITEM*>> netclasses = SCH_RULE_AREA::GetResolvedNetclasses( nullptr );
447 wxString resolvedNetclass = _( "<None>" );
448
449 if( netclasses.size() > 0 )
450 resolvedNetclass = netclasses[0].first;
451
452 aList.emplace_back( _( "Resolved netclass" ), resolvedNetclass );
453}
454
455
457{
458 label->AddConnectedRuleArea( this );
459 m_directives.insert( label );
460 m_directiveIDs.insert( label->m_Uuid );
461}
462
463
465{
466 item->AddRuleAreaToCache( this );
467 m_items.insert( item );
468 m_itemIDs.insert( item->m_Uuid );
469}
470
471
473{
474 m_items.erase( aItem );
475 m_prev_items.erase( aItem->m_Uuid );
476}
477
478
480{
481 m_directives.erase( aLabel );
482 m_prev_directives.erase( aLabel->m_Uuid );
483}
484
485
487{
489 {
498
499 const wxString groupAttributes = _HKI( "Attributes" );
500
501 propMgr.AddProperty( new PROPERTY<SCH_RULE_AREA, bool>( _HKI( "Exclude From Board" ),
503 groupAttributes );
504
505 propMgr.AddProperty( new PROPERTY<SCH_RULE_AREA, bool>( _HKI( "Exclude From Simulation" ),
507 groupAttributes );
508
509 propMgr.AddProperty( new PROPERTY<SCH_RULE_AREA, bool>( _HKI( "Exclude From Bill of Materials" ),
511 groupAttributes );
512
513 propMgr.AddProperty( new PROPERTY<SCH_RULE_AREA, bool>( _HKI( "Do not Populate" ),
515 groupAttributes );
516 }
constexpr EDA_IU_SCALE schIUScale
Definition base_units.h:123
BOX2< VECTOR2I > BOX2I
Definition box2.h:927
static const COLOR4D WHITE
Definition color4d.h:402
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
Definition color4d.h:399
The base class for create windows for drawing purpose.
const KIID m_Uuid
Definition eda_item.h:597
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:733
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:734
FILL_T m_fill
Definition eda_shape.h:737
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:396
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:292
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.Helper macro to map type hashes to names.
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:165
void SetLocked(bool aLocked) override
Definition sch_item.h:256
SCH_RENDER_SETTINGS * getRenderSettings(PLOTTER *aPlotter) const
Definition sch_item.h:739
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
Definition sch_item.cpp:281
bool IsLocked() const override
Definition sch_item.cpp:158
bool IsPrivate() const
Definition sch_item.h:253
void AddRuleAreaToCache(SCH_RULE_AREA *aRuleArea)
Add a rule area to the item's cache.
Definition sch_item.h:684
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
Definition sch_item.cpp:52
wxString ResolveText(const wxString &aText, const SCH_SHEET_PATH *aPath, int aDepth=0) const
Definition sch_item.cpp:390
int GetEffectivePenWidth(const SCH_RENDER_SETTINGS *aSettings) const
Definition sch_item.cpp:824
SCH_LAYER_ID m_layer
Definition sch_item.h:790
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:118
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:75
std::vector< const SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet) const
Retrieve a list of the SCH_PINs for the given sheet path.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
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:90
#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)
Definition property.h:74
#define REGISTER_TYPE(x)
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:58
LINE_STYLE
Dashed line types.
The EE_TYPE struct provides a type-specific auto-range iterator to the RTree.
Definition sch_rtree.h:198
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:683