KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_collectors.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) 2011 Wayne Stambaugh <[email protected]>
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 * Copyright (C) 2019 CERN
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, you may find one here:
20 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * or you may search the http://www.gnu.org website for the version 2 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
26#ifndef SCH_COLLECTORS_H
27#define SCH_COLLECTORS_H
28
29#include <lib_symbol.h>
30#include <collector.h>
31#include <sch_item.h>
32
33
34class SCH_SHEET_PATH;
35class SCH_SYMBOL;
36
37
39{
40public:
41 static const std::vector<KICAD_T> EditableItems;
42 static const std::vector<KICAD_T> MovableItems;
43 static const std::vector<KICAD_T> FieldOwners;
44
45 SCH_COLLECTOR( const std::vector<KICAD_T>& aScanTypes = { SCH_LOCATE_ANY_T } ) :
46 m_Unit( 0 ),
47 m_BodyStyle( 0 ),
49 {
50 SetScanTypes( aScanTypes );
51 }
52
59 SCH_ITEM* operator[]( int aIndex ) const override
60 {
61 if( (unsigned)aIndex < (unsigned)GetCount() )
62 return (SCH_ITEM*) m_list[ aIndex ];
63
64 return nullptr;
65 }
66
67 INSPECT_RESULT Inspect( EDA_ITEM* aItem, void* aTestData ) override;
68
79 void Collect( SCH_SCREEN* aScreen, const std::vector<KICAD_T>& aScanTypes,
80 const VECTOR2I& aPos, int aUnit = 0, int aConvert = 0 );
81
92 void Collect( LIB_ITEMS_CONTAINER& aItems, const std::vector<KICAD_T>& aScanTypes,
93 const VECTOR2I& aPos, int aUnit = 0, int aConvert = 0 );
94
100 bool IsCorner() const;
101
102public:
103 int m_Unit; // Fixed symbol unit filter (for symbol editor)
104 int m_BodyStyle; // Fixed DeMorgan filter (for symbol editor)
105
107};
108
109
110void CollectOtherUnits( const wxString& thisRef, int thisUnit, const LIB_ID& aLibId,
111 SCH_SHEET_PATH& aSheet, std::vector<SCH_SYMBOL*>* otherUnits );
112
113#endif // SCH_COLLECTORS_H
An abstract class that will find and hold all the objects according to an inspection done by the Insp...
Definition: collector.h:49
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:83
void SetScanTypes(const std::vector< KICAD_T > &aTypes)
Record the list of KICAD_T types to consider for collection by the Inspect() function.
Definition: collector.h:213
std::vector< EDA_ITEM * > m_list
Definition: collector.h:242
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:98
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
static const std::vector< KICAD_T > FieldOwners
SCH_COLLECTOR(const std::vector< KICAD_T > &aScanTypes={ SCH_LOCATE_ANY_T })
static const std::vector< KICAD_T > EditableItems
SCH_ITEM * operator[](int aIndex) const override
Overload COLLECTOR::operator[](int) to return a SCH_ITEM instead of an EDA_ITEM.
INSPECT_RESULT Inspect(EDA_ITEM *aItem, void *aTestData) override
bool IsCorner() const
Test if the collected items form a corner of two line segments.
void Collect(SCH_SCREEN *aScreen, const std::vector< KICAD_T > &aScanTypes, const VECTOR2I &aPos, int aUnit=0, int aConvert=0)
Scan a EDA_ITEM using this class's Inspector method which does the collection.
bool m_ShowPinElectricalTypes
static const std::vector< KICAD_T > MovableItems
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:168
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
INSPECT_RESULT
Definition: eda_item.h:44
void CollectOtherUnits(const wxString &thisRef, int thisUnit, const LIB_ID &aLibId, SCH_SHEET_PATH &aSheet, std::vector< SCH_SYMBOL * > *otherUnits)
@ SCH_LOCATE_ANY_T
Definition: typeinfo.h:200