KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pads_common.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 modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation, either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * 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#ifndef PADS_COMMON_H
21#define PADS_COMMON_H
22
23#include <kiid.h>
24#include <string>
25
27#include <stroke_params.h>
28#include <wx/string.h>
29
34
35namespace PADS_COMMON
36{
37
46KIID GenerateDeterministicUuid( const std::string& aIdentifier );
47
48
55
56
58{
59 wxString pcbFile;
60 wxString schematicFile;
61
62 bool HasPcb() const { return !pcbFile.IsEmpty(); }
63 bool HasSchematic() const { return !schematicFile.IsEmpty(); }
64 bool HasBoth() const { return HasPcb() && HasSchematic(); }
65};
66
67
71PADS_FILE_TYPE DetectPadsFileType( const wxString& aFilePath );
72
73
78RELATED_FILES FindRelatedPadsFiles( const wxString& aFilePath );
79
80
85int ParseInt( const std::string& aStr, int aDefault = 0, const std::string& aContext = {} );
86
91double ParseDouble( const std::string& aStr, double aDefault = 0.0,
92 const std::string& aContext = {} );
93
99wxString ConvertInvertedNetName( const std::string& aNetName );
100
110wxString ConvertText( const std::string& aText );
111
118LINE_STYLE PadsLineStyleToKiCad( int aPadsStyle );
119
136void DecodeJustification( int aJustification, GR_TEXT_H_ALIGN_T& aHJustify,
137 GR_TEXT_V_ALIGN_T& aVJustify );
138
146int PadsScaleCoord( double aVal, bool aIsX, double aOriginX, double aOriginY, double aScaleFactor );
147
148} // namespace PADS_COMMON
149
150#endif // PADS_COMMON_H
Common utilities and types for parsing PADS file formats, shared by the PCB and schematic importers.
void DecodeJustification(int aJustification, GR_TEXT_H_ALIGN_T &aHJustify, GR_TEXT_V_ALIGN_T &aVJustify)
Decode a PADS text justification code into KiCad horizontal and vertical alignment.
int PadsScaleCoord(double aVal, bool aIsX, double aOriginX, double aOriginY, double aScaleFactor)
Map a PADS board coordinate to a KiCad internal coordinate.
RELATED_FILES FindRelatedPadsFiles(const wxString &aFilePath)
Find the related PADS project file (schematic for a PCB source, or vice versa) in the same directory,...
int ParseInt(const std::string &aStr, int aDefault, const std::string &aContext)
Parse integer from string with error context.
wxString ConvertText(const std::string &aText)
Decode text from a PADS file, which uses an 8-bit codepage rather than UTF-8.
PADS_FILE_TYPE DetectPadsFileType(const wxString &aFilePath)
Detect the type of a PADS file by examining its header.
wxString ConvertInvertedNetName(const std::string &aNetName)
Convert a PADS net name to KiCad notation.
LINE_STYLE PadsLineStyleToKiCad(int aPadsStyle)
Convert a PADS line style integer to a KiCad LINE_STYLE enum value.
KIID GenerateDeterministicUuid(const std::string &aIdentifier)
Generate a deterministic KIID from a PADS component identifier.
double ParseDouble(const std::string &aStr, double aDefault, const std::string &aContext)
Parse double from string with error context.
LINE_STYLE
Dashed line types.
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
GR_TEXT_V_ALIGN_T
This is API surface mapped to common.types.VertialAlignment.