26 #ifndef CADSTAR_PCB_ARCHIVE_LOADER_H_ 27 #define CADSTAR_PCB_ARCHIVE_LOADER_H_ 59 for( std::pair<SYMDEF_ID, FOOTPRINT*> libItem :
m_libraryMap )
96 std::map<NET_ID, NETINFO_ITEM*>
m_netMap;
145 int aDielectricSublayer );
177 const GROUP_ID& aCadstarGroupID = wxEmptyString,
178 const LAYER_ID& aCadstarLayerOverride = wxEmptyString,
179 const wxPoint& aMoveVector = { 0, 0 },
180 const double& aRotationAngle = 0.0,
181 const double& aScalingFactor = 1.0,
182 const wxPoint& aTransformCentre = { 0, 0 },
183 const bool& aMirrorInvert = false );
200 const int& aLineThickness,
const wxString& aShapeName,
202 const GROUP_ID& aCadstarGroupID = wxEmptyString,
203 const wxPoint& aMoveVector = { 0, 0 },
204 const double& aRotationAngle = 0.0,
const double& aScalingFactor = 1.0,
205 const wxPoint& aTransformCentre = { 0, 0 },
206 const bool& aMirrorInvert = false );
222 const PCB_LAYER_ID& aKiCadLayer,
const int& aLineThickness,
224 const GROUP_ID& aCadstarGroupID = wxEmptyString,
225 const wxPoint& aMoveVector = { 0, 0 },
226 const double& aRotationAngle = 0.0,
227 const double& aScalingFactor = 1.0,
228 const wxPoint& aTransformCentre = { 0, 0 },
229 const bool& aMirrorInvert = false );
246 const PCB_LAYER_ID& aKiCadLayer,
const int& aLineThickness,
248 const GROUP_ID& aCadstarGroupID = wxEmptyString,
249 const wxPoint& aMoveVector = { 0, 0 },
250 const double& aRotationAngle = 0.0,
251 const double& aScalingFactor = 1.0,
252 const wxPoint& aTransformCentre = { 0, 0 },
253 const bool& aMirrorInvert = false );
269 const GROUP_ID& aCadstarGroupID = wxEmptyString,
270 const wxPoint& aMoveVector = { 0, 0 },
271 const double& aRotationAngle = 0.0,
272 const double& aScalingFactor = 1.0,
273 const wxPoint& aTransformCentre = { 0, 0 },
274 const bool& aMirrorInvert = false );
290 const VERTEX& aCadstarVertex,
292 const GROUP_ID& aCadstarGroupID = wxEmptyString,
293 const wxPoint& aMoveVector = { 0, 0 },
294 const double& aRotationAngle = 0.0,
295 const double& aScalingFactor = 1.0,
296 const wxPoint& aTransformCentre = { 0, 0 },
297 const bool& aMirrorInvert = false );
322 const int& aLineThickness = -1,
324 const wxPoint& aMoveVector = { 0, 0 },
325 const double& aRotationAngle = 0.0,
326 const double& aScalingFactor = 1.0,
327 const wxPoint& aTransformCentre = { 0, 0 },
328 const bool& aMirrorInvert = false );
352 int aWidthOverride = -1 );
361 void addAttribute(
const ATTRIBUTE_LOCATION& aCadstarAttrLoc,
363 const wxString& aAttributeValue );
377 const std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE>& aCadstarAttributeMap );
416 return (
double) aCadstarAngle / 100.0;
420 return (
double) aCadstarAngle;
497 #endif // CADSTAR_PCB_ARCHIVE_LOADER_H_ COPPERCODE getCopperCode(const COPPERCODE_ID &aCadstaCopperCodeID)
int getKiCadLength(long long aCadstarLength)
void addAttribute(const ATTRIBUTE_LOCATION &aCadstarAttrLoc, const ATTRIBUTE_ID &aCadstarAttributeID, FOOTPRINT *aFootprint, const wxString &aAttributeValue)
Adds a CADSTAR Attribute to a KiCad footprint.
int getKiCadHatchCodeGap(const HATCHCODE_ID &aCadstarHatchcodeID)
Pcbnew PLUGIN for CADSTAR PCB Archive (*.cpa) format: an ASCII format based on S-expressions.
NETINFO_ITEM * getKiCadNet(const NET_ID &aCadstarNetID)
Searches m_netMap and returns the NETINFO_ITEM pointer if exists.
Container for project specific data.
double getAngleDegrees(const long long &aCadstarAngle)
ZONE * getZoneFromCadstarShape(const SHAPE &aCadstarShape, const int &aLineThickness, BOARD_ITEM_CONTAINER *aParentContainer)
std::map< COMPONENT_ID, FOOTPRINT * > m_componentMap
Map between Cadstar and KiCad components on the board.
double getAngleTenthDegree(const long long &aCadstarAngle)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
void drawCadstarShape(const SHAPE &aCadstarShape, const PCB_LAYER_ID &aKiCadLayer, const int &aLineThickness, const wxString &aShapeName, BOARD_ITEM_CONTAINER *aContainer, const GROUP_ID &aCadstarGroupID=wxEmptyString, const wxPoint &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const wxPoint &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
A set of BOARD_ITEMs (i.e., without duplicates).
void loadNetTracks(const NET_ID &aCadstarNetID, const NET_PCB::ROUTE &aCadstarRoute)
wxString getAttributeValue(const ATTRIBUTE_ID &aCadstarAttributeID, const std::map< ATTRIBUTE_ID, ATTRIBUTE_VALUE > &aCadstarAttributeMap)
LAYER_MAPPING_HANDLER m_layerMappingHandler
Callback to get layer mapping.
CADSTAR_PCB_ARCHIVE_LOADER(wxString aFilename, LAYER_MAPPING_HANDLER aLayerMappingHandler, bool aLogLayerWarnings)
wxPoint m_designCenter
Used for calculating the required offset to apply to the Cadstar design so that it fits in KiCad canv...
PCB_GROUP * getKiCadGroup(const GROUP_ID &aCadstarGroupID)
LAYERPAIR getLayerPair(const LAYERPAIR_ID &aCadstarLayerPairID)
void remapUnsureLayers()
Callback m_layerMappingHandler for layers we aren't sure of.
bool m_doneSpacingClassWarning
Used by getKiCadNet() to avoid multiple duplicate warnings.
std::map< SYMDEF_ID, FOOTPRINT * > m_libraryMap
Map between Cadstar and KiCad components in the library.
ROUTECODE getRouteCode(const ROUTECODE_ID &aCadstarRouteCodeID)
void checkAndLogHatchCode(const HATCHCODE_ID &aCadstarHatchcodeID)
std::set< HATCHCODE_ID > m_hatchcodesTested
Used by checkAndLogHatchCode() to avoid multiple duplicate warnings.
void loadComponentAttributes(const COMPONENT &aComponent, FOOTPRINT *aFootprint)
void loadDocumentationSymbols()
void loadNetVia(const NET_ID &aCadstarNetID, const NET_PCB::VIA &aCadstarVia)
void logBoardStackupWarning(const wxString &aCadstarLayerName, const PCB_LAYER_ID &aKiCadLayer)
void loadLibraryPads(const SYMDEF_PCB &aComponent, FOOTPRINT *aFootprint)
std::vector< FOOTPRINT * > GetLoadedLibraryFootpints() const
Return a copy of the loaded library footprints (caller owns the objects)
void applyDimensionSettings(const DIMENSION &aCadstarDim, DIMENSION_BASE *aKiCadDim)
void drawCadstarText(const TEXT &aCadstarText, BOARD_ITEM_CONTAINER *aContainer, const GROUP_ID &aCadstarGroupID=wxEmptyString, const LAYER_ID &aCadstarLayerOverride=wxEmptyString, const wxPoint &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const wxPoint &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
std::map< GROUP_ID, PCB_GROUP * > m_groupMap
Map between Cadstar and KiCad groups.
void drawCadstarVerticesAsSegments(const std::vector< VERTEX > &aCadstarVertices, const PCB_LAYER_ID &aKiCadLayer, const int &aLineThickness, BOARD_ITEM_CONTAINER *aContainer, const GROUP_ID &aCadstarGroupID=wxEmptyString, const wxPoint &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const wxPoint &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
Uses PCB_SHAPE to draw the vertices on m_board object.
std::function< std::map< wxString, PCB_LAYER_ID >(const std::vector< INPUT_LAYER_DESC > &)> LAYER_MAPPING_HANDLER
Pointer to a function that takes a map of source and KiCad layers and returns a re-mapped version.
void loadLibraryAreas(const SYMDEF_PCB &aComponent, FOOTPRINT *aFootprint)
PCB_LAYER_ID
A quick note on layer IDs:
PAD * getKiCadPad(const COMPONENT_PAD &aCadstarPad, FOOTPRINT *aParent)
bool m_doneNetClassWarning
Used by getKiCadNet() to avoid multiple duplicate warnings.
LSET is a set of PCB_LAYER_IDs.
PART getPart(const PART_ID &aCadstarPartID)
void initStackupItem(const LAYER &aCadstarLayer, BOARD_STACKUP_ITEM *aKiCadItem, int aDielectricSublayer)
void loadLibraryCoppers(const SYMDEF_PCB &aComponent, FOOTPRINT *aFootprint)
Represent a set of closed polygons.
bool isFootprint(BOARD_ITEM_CONTAINER *aContainer)
std::set< PADCODE_ID > m_padcodesTested
Used by getKiCadPad() to avoid multiple duplicate warnings.
PCB_LAYER_ID getKiCadCopperLayerID(unsigned int aLayerNum, bool aDetectMaxLayer=true)
SHAPE_LINE_CHAIN getLineChainFromDrawsegments(const std::vector< PCB_SHAPE * > aDrawSegments)
Returns a SHAPE_LINE_CHAIN object from a series of PCB_SHAPE objects.
double getPolarAngle(wxPoint aPoint)
ZONE handles a list of polygons defining a copper zone.
An abstract shape on 2D plane.
int getKiCadHatchCodeThickness(const HATCHCODE_ID &aCadstarHatchcodeID)
void Load(BOARD *aBoard, PROJECT *aProject)
Loads a CADSTAR PCB Archive file into the KiCad BOARD object given.
std::map< TEMPLATE_ID, ZONE * > m_zonesMap
Map between Cadstar and KiCad zones.
wxString getAttributeName(const ATTRIBUTE_ID &aCadstarAttributeID)
this class manage one layer needed to make a physical board it can be a solder mask,...
Represents a CADSTAR PCB Archive (CPA) file.
class FOOTPRINT, a footprint
void loadComponentLibrary()
PADCODE getPadCode(const PADCODE_ID &aCadstarPadCodeID)
TEXTCODE getTextCode(const TEXTCODE_ID &aCadstarTextCodeID)
int getLineThickness(const LINECODE_ID &aCadstarLineCodeID)
Handle the data for a net.
PCB_SHAPE * getDrawSegmentFromVertex(const POINT &aCadstarStartPoint, const VERTEX &aCadstarVertex, BOARD_ITEM_CONTAINER *aContainer=nullptr, const GROUP_ID &aCadstarGroupID=wxEmptyString, const wxPoint &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const wxPoint &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
Returns a pointer to a PCB_SHAPE object.
std::map< NET_ID, NETINFO_ITEM * > m_netMap
Map between Cadstar and KiCad Nets.
Information pertinent to a Pcbnew printed circuit board.
bool m_logLayerWarnings
Used in loadBoardStackup()
GROUP_ID createUniqueGroupID(const wxString &aName)
Adds a new PCB_GROUP* to m_groupMap.
bool m_doneCopperWarning
Used by loadCoppers() to avoid multiple duplicate warnings.
PCB_LAYER_ID getKiCadLayer(const LAYER_ID &aCadstarLayerID)
void addToGroup(const GROUP_ID &aCadstarGroupID, BOARD_ITEM *aKiCadItem)
void drawCadstarCutoutsAsSegments(const std::vector< CUTOUT > &aCutouts, const PCB_LAYER_ID &aKiCadLayer, const int &aLineThickness, BOARD_ITEM_CONTAINER *aContainer, const GROUP_ID &aCadstarGroupID=wxEmptyString, const wxPoint &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const wxPoint &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
Uses PCB_SHAPE to draw the cutouts on m_board object.
void loadLibraryFigures(const SYMDEF_PCB &aComponent, FOOTPRINT *aFootprint)
void calculateZonePriorities()
Tries to make a best guess as to the zone priorities based on the pour status.
wxString LAYER_ID
ID of a Sheet (if schematic) or board Layer (if PCB)
bool isLayerSet(const LAYER_ID &aCadstarLayerID)
Abstract interface for BOARD_ITEMs capable of storing other items inside.
std::vector< PCB_SHAPE * > getDrawSegmentsFromVertices(const std::vector< VERTEX > &aCadstarVertices, BOARD_ITEM_CONTAINER *aContainer=nullptr, const GROUP_ID &aCadstarGroupID=wxEmptyString, const wxPoint &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const wxPoint &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
Returns a vector of pointers to PCB_SHAPE objects.
std::map< LAYER_ID, PCB_LAYER_ID > m_layermap
Map between Cadstar and KiCad Layers.
double getHatchCodeAngleDegrees(const HATCHCODE_ID &aCadstarHatchcodeID)
HATCHCODE getHatchCode(const HATCHCODE_ID &aCadstarHatchcodeID)
FOOTPRINT * getFootprintFromCadstarID(const COMPONENT_ID &aCadstarComponentID)
VIACODE getViaCode(const VIACODE_ID &aCadstarViaCodeID)
std::map< ROUTECODE_ID, NETCLASSPTR > m_netClassMap
Map between Cadstar and KiCad classes.
std::vector< LAYER_ID > m_powerPlaneLayers
List of layers that are marked as power plane in CADSTAR.
LSET getKiCadLayerSet(const LAYER_ID &aCadstarLayerID)
SHAPE_POLY_SET getPolySetFromCadstarShape(const SHAPE &aCadstarShape, const int &aLineThickness=-1, BOARD_ITEM_CONTAINER *aContainer=nullptr, const wxPoint &aMoveVector={ 0, 0 }, const double &aRotationAngle=0.0, const double &aScalingFactor=1.0, const wxPoint &aTransformCentre={ 0, 0 }, const bool &aMirrorInvert=false)
Returns a SHAPE_POLY_SET object from a Cadstar SHAPE.
void logBoardStackupMessage(const wxString &aCadstarLayerName, const PCB_LAYER_ID &aKiCadLayer)
int m_numNets
Number of nets loaded so far.
wxPoint getKiCadPoint(wxPoint aCadstarPoint)
Scales, offsets and inverts y axis to make the point usable directly in KiCad.
int KiCadUnitMultiplier
Use this value to convert units in this CPA file to KiCad units.
Linear, leader (radius/diameter) or angular dimension.
KICAD_T Type() const
Returns the type of object.
~CADSTAR_PCB_ARCHIVE_LOADER()
std::vector< TRACK * > makeTracksFromDrawsegments(const std::vector< PCB_SHAPE * > aDrawsegments, BOARD_ITEM_CONTAINER *aParentContainer, NETINFO_ITEM *aNet=nullptr, PCB_LAYER_ID aLayerOverride=UNDEFINED_LAYER, int aWidthOverride=-1)
Returns a vector of pointers to TRACK/ARC objects.