20#ifndef TARGET3001_PARSER_H
21#define TARGET3001_PARSER_H
32#include <wx/datetime.h>
100 std::vector<std::pair<std::string, std::string>>
props;
103 const std::string*
FindProp(
const std::string& aKey )
const;
106 bool FlagProp(
const std::string& aKey )
const;
109 std::optional<std::pair<int32_t, int32_t>>
TextRightEnd()
const;
112 std::vector<uint8_t>
Picture()
const;
396 std::array<bool, BOARD_LAYER_COUNT>
onLayer{};
480 const std::string*
FindProperty(
const std::string& aKey )
const;
488 std::optional<wxString>
FunctionText(
const TEXT& aText,
bool aSchematic )
const;
515wxString
ToWx(
const std::string& aRaw );
LAYER_FUNCTION
Board layer function codes stored per layer in the project header.
constexpr int FIRST_PADSTACK_LAYER
A pad on board layer FIRST_PADSTACK_LAYER + n takes its layers from project padstack n.
wxString PadNumber(const ELEMENT &aPad)
Number of a pad element in KiCad, its PADNAME when present, else its stored number.
PROJECT ParseBuffer(const std::vector< uint8_t > &aData)
Parse a project held in memory.
constexpr int ALL_COPPER_LAYER
Board elements on this layer exist on every copper layer.
@ POLYGON
vertices in the POLY_PAD property
FIDUCIAL_KIND
Drawing of a fiducial mark.
@ CROSSHAIR_RINGS
cross and rings at 1, 2/3 and 1/3 of the outer centreline radius
@ FILLED_CIRCLE
solid disc of the outer radius
PROJECT ParseFile(const wxString &aFileName)
Parse a complete .T3001 file.
constexpr int SCHEMATIC_SHEET_COUNT
Sheets occupy layers 101 to 200.
bool LooksLikeProject(const wxString &aFileName)
Cheap check used by the plugin managers: the extension matches and the header is plausible.
wxString ToWx(const std::string &aRaw)
Convert a stored ANSI string to a wxString.
ELEMENT_TYPE
Element class tags as stored in the file.
constexpr int BOARD_LAYER_COUNT
Board layers 0..99 carry a per-project function; 100 and above have fixed meanings.
constexpr uint8_t NO_ASSOCIATION
Layer association value for a layer that belongs to no copper layer.
constexpr int SCHEMATIC_LAYER_BASE
First layer number used for schematic sheets; sheet N (1-based) is layer 100 + N.
Stroked arc or circle. The base position is the start point.
double Sweep() const
Counter-clockwise sweep in (0, 360]; equal angles give a full circle.
float startAngle
degrees, counter-clockwise from +X
std::vector< ELEMENT > symbols
std::vector< ELEMENT > packageItems
std::string packageSource
std::string prefix
reference designator prefix
std::optional< uint16_t > referenceExtension
Filled disc centred on the base position.
Fields shared by every drawable element.
std::vector< uint8_t > Picture() const
Encoded image a rectangle shows stretched over its area instead of its fill, empty for none.
bool FlagProp(const std::string &aKey) const
True when property aKey holds one of the format's boolean true words.
std::optional< uint32_t > extra
uint16_t component
ID of the owning component (a component stores its own), 0 for none.
uint16_t signal
ID of the owning signal (a signal stores its own), 0 for none.
std::vector< std::pair< std::string, std::string > > props
Free-form key/value properties in file order.
uint8_t classTag
repeats the element's class tag
std::optional< std::pair< int32_t, int32_t > > TextRightEnd() const
Right end of right-aligned text from its ARXY property, in file coordinates.
const std::string * FindProp(const std::string &aKey) const
Return the value of the first property named aKey, if any.
One element of any class.
std::shared_ptr< COMPONENT > component
std::shared_ptr< SYMBOL > symbol
std::shared_ptr< SIGNAL > signal
std::shared_ptr< PACKAGE > package
std::vector< ELEMENT > children
Children of a pin (its number text).
uint8_t kind
FIDUCIAL_KIND.
uint8_t dashStyle
0 solid, 1 long dash, 2 dash-dot, 3 other, 4 short dash
Footprint placement. Pads and graphics of the footprint are stored in board coordinates.
Project padstack; the board layers a pad exists on and how far it grows on each.
std::array< bool, BOARD_LAYER_COUNT > onLayer
std::array< int32_t, BOARD_LAYER_COUNT > oversize
growth per side, nm
int32_t width
along the pad's own X axis before rotation
int32_t drill
0 for no hole
Schematic pin. The base position is the connection point; the pin extends along direction.
Settings that the importers use. The rest of the settings block is validated and skipped.
std::vector< std::string > sheetNames
one entry per schematic sheet slot
std::vector< std::pair< std::string, std::string > > properties
Project properties in file order, as (key, value)
std::vector< PADSTACK_DEF > padstacks
std::optional< TEXT_LANGUAGE > textLanguage
Language whose text variants the project shows; absent in older files.
void ApplyTextLanguage()
Replace literal texts by their variant in the project's stored language when a text reads AUTOLANGUAG...
std::array< uint8_t, BOARD_LAYER_COUNT > layerFunctions
Function code of each board layer, see LAYER_FUNCTION.
std::string boardTextFont
std::string signalNameFont
const std::string * FindProperty(const std::string &aKey) const
Value of project property aKey, compared case-insensitively.
wxString fileName
source file name without directory, empty for a buffer
const ELEMENT * FindSignal(uint16_t aId) const
Signal element whose ID is aId, or nullptr.
std::vector< ELEMENT > signals
PROJECT_SETTINGS settings
std::vector< ELEMENT > boardItems
std::vector< ELEMENT > components
std::vector< ELEMENT > schematicItems
wxDateTime fileModified
source file modification time, invalid for a buffer
std::array< uint8_t, BOARD_LAYER_COUNT > layerAssociations
Copper layer each board layer belongs to; area and deletion layers point at the copper they affect.
std::optional< wxString > FunctionText(const TEXT &aText, bool aSchematic) const
Text that a computed text function shows, where KiCad has an equivalent.
std::string schematicTextFont
Filled rectangle anchored at a corner (the base position); sizes are signed.
std::vector< uint8_t > record
std::vector< ELEMENT > tracks
board copper
std::vector< ELEMENT > connections
schematic wires, junctions and labels
Quadratic Bezier from the base position to the end point.
One schematic gate of a component. Children are already in sheet coordinates.
std::string suffix
gate suffix, e.g. "a"
std::string name
full gate name, e.g. "R1a"
std::vector< ELEMENT > children
Filled triangle given by three absolute corners (the first is the base position).
static double sweep(float aStart, float aEnd)