KiCad PCB EDA Suite
Loading...
Searching...
No Matches
easypc_sch_items.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 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
27
28#ifndef EASYPC_SCH_ITEMS_H
29#define EASYPC_SCH_ITEMS_H
30
31#include <memory>
32#include <vector>
33
34#include <layer_ids.h>
35#include <math/vector2d.h>
36#include <wx/arrstr.h>
37#include <wx/string.h>
38
39class EDA_TEXT;
40class LIB_ID;
41class LIB_SYMBOL;
42class SCH_SHAPE;
43class SCH_TEXT;
44
45namespace EASYPC
46{
47
48struct SOURCE_FREE_TEXT;
51struct SOURCE_SEGMENT;
52struct SOURCE_SHAPE;
54struct SOURCE_SYMBOL;
57
58
61{
62 int32_t OriginX = 0;
63 int32_t OriginY = 0;
64
66 VECTOR2I Map( int64_t aX, int64_t aY ) const;
67};
68
69
71std::vector<const SOURCE_SEGMENT*> ShapeVertices( const SOURCE_SHAPE& aShape );
72
74std::vector<std::unique_ptr<SCH_SHAPE>> ConvertShape( const SOURCE_SHAPE& aShape, const SCH_FRAME& aFrame,
75 SCH_LAYER_ID aLayer, int aStrokeWidth, bool aFilled,
76 int aUnit = 0 );
77
79std::vector<std::unique_ptr<SCH_SHAPE>> ConvertShapeItem( const SOURCE_SHAPE_ITEM& aItem, const SCH_FRAME& aFrame,
80 SCH_LAYER_ID aLayer, int aUnit = 0 );
81
83VECTOR2I TextSize( const SOURCE_TEXT_STYLE& aStyle );
84
86bool DrawsUpright( const SOURCE_TEXT_POSITION& aPos, bool aKeepUpright );
87
92void ApplyTextPosition( EDA_TEXT& aText, const SOURCE_TEXT_POSITION& aPos, const SCH_FRAME& aFrame,
93 bool aKeepUpright = false, const wxString& aMeasured = wxEmptyString );
94
95std::unique_ptr<SCH_TEXT> ConvertFreeText( const SOURCE_FREE_TEXT& aText, const SCH_FRAME& aFrame, SCH_LAYER_ID aLayer,
96 int aUnit = 0, bool aKeepUpright = false );
97
98
101{
103 const SOURCE_PCB_COMPONENT* Board = nullptr;
104 std::vector<const SOURCE_SYMBOL*> Gates;
105 bool PinTexts = true;
106 wxString Footprint;
107 wxArrayString FootprintFilters;
108};
109
114std::unique_ptr<LIB_SYMBOL> ConvertComponentSymbol( const SCH_COMPONENT_SOURCE& aSrc, const LIB_ID& aId );
115
117std::unique_ptr<LIB_SYMBOL> ConvertSymbol( const SOURCE_SYMBOL& aSymbol, const LIB_ID& aId );
118
119
122{
123 bool Mapped = false;
124 wxString Number;
125 wxString Display;
126 bool NoConnect = false;
127};
128
130GATE_TERMINAL ResolveTerminal( const SOURCE_PCB_COMPONENT* aPcb, int aGate, int aTerminal );
131
132} // namespace EASYPC
133
134#endif // EASYPC_SCH_ITEMS_H
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
Definition eda_text.h:94
A logical library item identifier and consists of various portions much like a URI.
Definition lib_id.h:45
Define a library symbol object.
Definition lib_symbol.h:114
SCH_LAYER_ID
Eeschema drawing layers.
Definition layer_ids.h:471
GATE_TERMINAL ResolveTerminal(const SOURCE_PCB_COMPONENT *aPcb, int aGate, int aTerminal)
Terminal aTerminal (0-based) of gate aGate; formats before 9000 map a bare pad number,...
std::unique_ptr< SCH_TEXT > ConvertFreeText(const SOURCE_FREE_TEXT &aText, const SCH_FRAME &aFrame, SCH_LAYER_ID aLayer, int aUnit, bool aKeepUpright)
std::unique_ptr< LIB_SYMBOL > ConvertComponentSymbol(const SCH_COMPONENT_SOURCE &aSrc, const LIB_ID &aId)
One unit per gate in symbol-local coordinates, zero-length passive pins at the pads,...
bool DrawsUpright(const SOURCE_TEXT_POSITION &aPos, bool aKeepUpright)
True when a design that keeps text upright turns aPos about the far end of its first line.
std::vector< std::unique_ptr< SCH_SHAPE > > ConvertShape(const SOURCE_SHAPE &aShape, const SCH_FRAME &aFrame, SCH_LAYER_ID aLayer, int aStrokeWidth, bool aFilled, int aUnit)
Outline of a shape: polylines, arcs and circles; a filled outline with arcs is one polygon.
std::unique_ptr< LIB_SYMBOL > ConvertSymbol(const SOURCE_SYMBOL &aSymbol, const LIB_ID &aId)
A .ssl symbol alone: one unit, pins numbered by pad number.
std::vector< std::unique_ptr< SCH_SHAPE > > ConvertShapeItem(const SOURCE_SHAPE_ITEM &aItem, const SCH_FRAME &aFrame, SCH_LAYER_ID aLayer, int aUnit)
A shape item with its own line style and fill.
VECTOR2I TextSize(const SOURCE_TEXT_STYLE &aStyle)
KiCad text size for a source text style: its height as the width, its capital height as the height.
void ApplyTextPosition(EDA_TEXT &aText, const SOURCE_TEXT_POSITION &aPos, const SCH_FRAME &aFrame, bool aKeepUpright, const wxString &aMeasured)
Place any KiCad text as the source position says: anchor, angle, mirror, justification and style.
std::vector< const SOURCE_SEGMENT * > ShapeVertices(const SOURCE_SHAPE &aShape)
A shape's vertices in drawing order, following next references for formats 1 and 2.
What a package's gate map says about one gate terminal.
wxString Display
the number shown beside the pin, the part before '=' when there is one
wxString Number
KiCad pin number, stacked notation for a pad list.
Everything one component LIB_SYMBOL is made from.
std::vector< const SOURCE_SYMBOL * > Gates
symbol per gate; null leaves that unit empty
const SOURCE_SCM_COMPONENT * Schematic
const SOURCE_PCB_COMPONENT * Board
the package whose gate map numbers the pins
bool PinTexts
a placed part draws its pin texts from its pad instances
Design to KiCad mapping: X shifted, Y negated about the origin.
VECTOR2I Map(int64_t aX, int64_t aY) const
The package half of a component.
Footprints and schematic symbols alike.
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708