2020-09-08 19:51:22 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2021-01-31 20:47:36 +00:00
|
|
|
* Copyright (C) 2020-2021 Roberto Fernandez Bautista <roberto.fer.bau@gmail.com>
|
|
|
|
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2020-09-08 19:51:22 +00:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
* option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file cadstar_sch_archive_loader.h
|
|
|
|
* @brief Loads a csa file into a KiCad SCHEMATIC object
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CADSTAR_SCH_ARCHIVE_LOADER_H_
|
|
|
|
#define CADSTAR_SCH_ARCHIVE_LOADER_H_
|
|
|
|
|
|
|
|
#include <sch_plugins/cadstar/cadstar_sch_archive_parser.h>
|
|
|
|
|
2021-08-18 20:38:14 +00:00
|
|
|
#include <layer_ids.h> // SCH_LAYER_ID
|
|
|
|
#include <plotters/plotter.h> // PLOT_DASH_TYPE
|
|
|
|
#include <pin_type.h> // ELECTRICAL_PINTYPE
|
2020-09-20 21:08:46 +00:00
|
|
|
#include <sch_io_mgr.h>
|
2020-10-24 14:45:37 +00:00
|
|
|
#include <wx/filename.h>
|
2020-09-20 21:08:46 +00:00
|
|
|
|
2020-11-26 18:11:06 +00:00
|
|
|
class BUS_ALIAS;
|
2020-09-20 21:08:46 +00:00
|
|
|
class EDA_TEXT;
|
2022-01-24 13:40:39 +00:00
|
|
|
class TEXT_SPIN_STYLE;
|
2020-09-20 21:08:46 +00:00
|
|
|
class LIB_FIELD;
|
2021-06-10 18:51:46 +00:00
|
|
|
class LIB_SYMBOL;
|
2021-06-10 14:10:55 +00:00
|
|
|
class SCH_SYMBOL;
|
2020-09-27 02:35:24 +00:00
|
|
|
class SCH_ITEM;
|
2020-09-20 21:08:46 +00:00
|
|
|
class SCH_FIELD;
|
2020-09-23 20:39:11 +00:00
|
|
|
class SCH_GLOBALLABEL;
|
|
|
|
class SCH_HIERLABEL;
|
|
|
|
class SCH_SHEET;
|
2020-11-22 19:55:21 +00:00
|
|
|
class SCH_SHEET_PATH;
|
2020-09-27 02:35:24 +00:00
|
|
|
class SCH_TEXT;
|
2020-09-20 21:08:46 +00:00
|
|
|
class SCHEMATIC;
|
2020-09-08 19:51:22 +00:00
|
|
|
|
|
|
|
class CADSTAR_SCH_ARCHIVE_LOADER : public CADSTAR_SCH_ARCHIVE_PARSER
|
|
|
|
{
|
|
|
|
public:
|
2021-09-01 19:12:56 +00:00
|
|
|
// Size of tiny net labels when none present in original design
|
|
|
|
const int SMALL_LABEL_SIZE = KiROUND( (double) SCH_IU_PER_MM * 0.4 );
|
2023-01-10 21:25:28 +00:00
|
|
|
const double ARC_ACCURACY = SCH_IU_PER_MM * 0.01; // 0.01mm
|
2021-09-01 19:12:56 +00:00
|
|
|
|
2021-09-09 21:15:38 +00:00
|
|
|
explicit CADSTAR_SCH_ARCHIVE_LOADER( wxString aFilename, REPORTER* aReporter,
|
|
|
|
PROGRESS_REPORTER* aProgressReporter ) :
|
|
|
|
CADSTAR_SCH_ARCHIVE_PARSER( aFilename )
|
2020-09-08 19:51:22 +00:00
|
|
|
{
|
2021-09-09 21:15:38 +00:00
|
|
|
m_schematic = nullptr;
|
|
|
|
m_rootSheet = nullptr;
|
|
|
|
m_plugin = nullptr;
|
2021-02-13 20:00:17 +00:00
|
|
|
m_designCenter.x = 0;
|
|
|
|
m_designCenter.y = 0;
|
2021-09-09 21:15:38 +00:00
|
|
|
m_reporter = aReporter;
|
|
|
|
m_progressReporter = aProgressReporter;
|
2020-09-08 19:51:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
~CADSTAR_SCH_ARCHIVE_LOADER()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Loads a CADSTAR PCB Archive file into the KiCad BOARD object given
|
2020-10-24 14:45:37 +00:00
|
|
|
* @param aSchematic Schematic to add the design onto
|
|
|
|
* @param aRootSheet Root sheet to add the design onto
|
2020-09-08 19:51:22 +00:00
|
|
|
*/
|
2021-02-13 20:00:17 +00:00
|
|
|
void Load( SCHEMATIC* aSchematic, SCH_SHEET* aRootSheet,
|
2020-10-27 00:25:08 +00:00
|
|
|
SCH_PLUGIN::SCH_PLUGIN_RELEASER* aSchPlugin, const wxFileName& aLibraryFileName );
|
2020-09-08 19:51:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
private:
|
2020-09-23 20:39:11 +00:00
|
|
|
typedef std::pair<BLOCK_ID, TERMINAL_ID> BLOCK_PIN_ID;
|
2021-03-28 18:47:48 +00:00
|
|
|
typedef std::pair<PART_ID, GATE_ID> PART_GATE_ID;
|
2021-02-13 20:00:17 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Map between a terminal ID in a symbol definition to the pin number that should
|
|
|
|
* be imported into KiCad.
|
|
|
|
*/
|
2021-02-03 20:06:41 +00:00
|
|
|
typedef std::map<TERMINAL_ID, wxString> TERMINAL_TO_PINNUM_MAP;
|
2020-09-23 20:39:11 +00:00
|
|
|
|
2021-03-31 21:33:30 +00:00
|
|
|
REPORTER* m_reporter;
|
2021-02-13 20:00:17 +00:00
|
|
|
SCHEMATIC* m_schematic;
|
|
|
|
SCH_SHEET* m_rootSheet;
|
|
|
|
SCH_PLUGIN::SCH_PLUGIN_RELEASER* m_plugin;
|
|
|
|
wxFileName m_libraryFileName;
|
|
|
|
wxPoint m_designCenter; ///< Used for calculating the required
|
|
|
|
///< offset to apply to the Cadstar design
|
|
|
|
///< so that it fits in KiCad canvas
|
|
|
|
std::map<LAYER_ID, SCH_SHEET*> m_sheetMap; ///< Map between Cadstar and KiCad Sheets
|
2020-09-23 20:39:11 +00:00
|
|
|
std::map<BLOCK_PIN_ID, SCH_HIERLABEL*>
|
2021-02-13 20:00:17 +00:00
|
|
|
m_sheetPinMap; ///< Map between Cadstar and KiCad Sheets Pins
|
2021-06-10 18:51:46 +00:00
|
|
|
std::map<PART_ID, LIB_SYMBOL*> m_partMap; ///< Map between Cadstar and KiCad Parts
|
2021-03-28 18:47:48 +00:00
|
|
|
std::map<PART_GATE_ID, SYMDEF_ID> m_partSymbolsMap; ///< Map holding the symbols loaded so far
|
|
|
|
/// for a particular PART_ID and GATE_ID
|
2021-02-13 20:00:17 +00:00
|
|
|
std::map<PART_ID, TERMINAL_TO_PINNUM_MAP> m_pinNumsMap; ///< Map of pin numbers in CADSTAR parts
|
2021-06-10 18:51:46 +00:00
|
|
|
std::map<wxString, LIB_SYMBOL*> m_powerSymLibMap; ///< Map of KiCad Power Symbol Library items
|
2021-06-10 14:10:55 +00:00
|
|
|
std::map<SYMBOL_ID, SCH_SYMBOL*>
|
2021-02-13 20:00:17 +00:00
|
|
|
m_powerSymMap; ///< Map between Cadstar and KiCad Power Symbols
|
2020-09-23 20:39:11 +00:00
|
|
|
std::map<SYMBOL_ID, SCH_GLOBALLABEL*>
|
2021-02-13 20:00:17 +00:00
|
|
|
m_globalLabelsMap; ///< Map between Cadstar and KiCad Global Labels
|
|
|
|
std::map<BUS_ID, std::shared_ptr<BUS_ALIAS>> m_busesMap; ///< Map of Cadstar and KiCad Buses
|
2020-09-19 22:05:02 +00:00
|
|
|
|
|
|
|
void loadSheets();
|
2020-09-23 20:39:11 +00:00
|
|
|
void loadHierarchicalSheetPins();
|
2020-09-20 21:08:46 +00:00
|
|
|
void loadPartsLibrary();
|
|
|
|
void loadSchematicSymbolInstances();
|
2020-09-26 13:27:03 +00:00
|
|
|
void loadBusses();
|
2020-09-23 20:39:11 +00:00
|
|
|
void loadNets();
|
2020-09-26 18:23:13 +00:00
|
|
|
void loadFigures();
|
2020-09-27 02:35:24 +00:00
|
|
|
void loadTexts();
|
2020-09-27 12:19:51 +00:00
|
|
|
void loadDocumentationSymbols();
|
2020-12-13 17:28:00 +00:00
|
|
|
void loadTextVariables();
|
2020-09-19 22:05:02 +00:00
|
|
|
|
2020-09-20 21:08:46 +00:00
|
|
|
//Helper Functions for loading sheets
|
2022-01-01 06:04:08 +00:00
|
|
|
void loadSheetAndChildSheets( LAYER_ID aCadstarSheetID, const VECTOR2I& aPosition,
|
|
|
|
VECTOR2I aSheetSize, const SCH_SHEET_PATH& aParentSheet );
|
2020-09-27 12:19:51 +00:00
|
|
|
|
2020-11-22 19:55:21 +00:00
|
|
|
void loadChildSheets( LAYER_ID aCadstarSheetID, const SCH_SHEET_PATH& aSheet );
|
2020-09-27 12:19:51 +00:00
|
|
|
|
2020-09-19 22:05:02 +00:00
|
|
|
std::vector<LAYER_ID> findOrphanSheets();
|
2020-09-27 12:19:51 +00:00
|
|
|
|
|
|
|
int getSheetNumber( LAYER_ID aCadstarSheetID );
|
|
|
|
|
|
|
|
void loadItemOntoKiCadSheet( LAYER_ID aCadstarSheetID, SCH_ITEM* aItem );
|
2020-09-19 22:05:02 +00:00
|
|
|
|
2020-09-23 20:39:11 +00:00
|
|
|
//Helper Functions for loading library items
|
|
|
|
void loadSymDefIntoLibrary( const SYMDEF_ID& aSymdefID, const PART* aCadstarPart,
|
2021-06-10 18:51:46 +00:00
|
|
|
const GATE_ID& aGateID, LIB_SYMBOL* aSymbol );
|
2020-09-27 12:19:51 +00:00
|
|
|
|
2020-09-23 20:39:11 +00:00
|
|
|
void loadLibrarySymbolShapeVertices( const std::vector<VERTEX>& aCadstarVertices,
|
2021-08-29 18:55:47 +00:00
|
|
|
wxPoint aSymbolOrigin, LIB_SYMBOL* aSymbol,
|
|
|
|
int aGateNumber, int aLineThickness );
|
2020-09-27 12:19:51 +00:00
|
|
|
|
2021-01-27 00:09:58 +00:00
|
|
|
void applyToLibraryFieldAttribute( const ATTRIBUTE_LOCATION& aCadstarAttrLoc,
|
2020-09-23 20:39:11 +00:00
|
|
|
wxPoint aSymbolOrigin, LIB_FIELD* aKiCadField );
|
|
|
|
|
|
|
|
//Helper Functions for loading symbols in schematic
|
2021-06-10 18:51:46 +00:00
|
|
|
SCH_SYMBOL* loadSchematicSymbol( const SYMBOL& aCadstarSymbol, const LIB_SYMBOL& aKiCadPart,
|
2022-01-18 02:26:40 +00:00
|
|
|
EDA_ANGLE& aComponentOrientation );
|
2020-09-27 12:19:51 +00:00
|
|
|
|
|
|
|
void loadSymbolFieldAttribute( const ATTRIBUTE_LOCATION& aCadstarAttrLoc,
|
2022-01-18 02:26:40 +00:00
|
|
|
const EDA_ANGLE& aComponentOrientation, bool aIsMirrored,
|
2021-01-27 00:09:58 +00:00
|
|
|
SCH_FIELD* aKiCadField );
|
2020-09-27 12:19:51 +00:00
|
|
|
|
2022-01-18 02:26:40 +00:00
|
|
|
int getComponentOrientation( const EDA_ANGLE& aOrientAngle, EDA_ANGLE& aReturnedOrientation );
|
2020-09-20 21:08:46 +00:00
|
|
|
|
2020-09-23 20:39:11 +00:00
|
|
|
//Helper functions for loading nets
|
2020-09-27 12:19:51 +00:00
|
|
|
POINT getLocationOfNetElement( const NET_SCH& aNet, const NETELEMENT_ID& aNetElementID );
|
|
|
|
|
2020-09-23 20:39:11 +00:00
|
|
|
wxString getNetName( const NET_SCH& aNet );
|
2020-09-19 22:05:02 +00:00
|
|
|
|
2020-09-26 18:23:13 +00:00
|
|
|
//Helper functions for loading figures / graphical items
|
2022-01-18 02:26:40 +00:00
|
|
|
void loadGraphicStaightSegment( const VECTOR2I& aStartPoint, const VECTOR2I& aEndPoint,
|
|
|
|
const LINECODE_ID& aCadstarLineCodeID,
|
|
|
|
const LAYER_ID& aCadstarSheetID,
|
|
|
|
const SCH_LAYER_ID& aKiCadSchLayerID,
|
|
|
|
const VECTOR2I& aMoveVector = { 0, 0 },
|
|
|
|
const EDA_ANGLE& aRotation = ANGLE_0,
|
|
|
|
const double& aScalingFactor = 1.0,
|
|
|
|
const VECTOR2I& aTransformCentre = { 0, 0 },
|
|
|
|
const bool& aMirrorInvert = false );
|
2020-11-21 22:56:56 +00:00
|
|
|
|
2020-09-26 18:23:13 +00:00
|
|
|
void loadShapeVertices( const std::vector<VERTEX>& aCadstarVertices,
|
2022-01-01 06:04:08 +00:00
|
|
|
LINECODE_ID aCadstarLineCodeID, LAYER_ID aCadstarSheetID,
|
|
|
|
SCH_LAYER_ID aKiCadSchLayerID, const VECTOR2I& aMoveVector = { 0, 0 },
|
2022-01-18 02:26:40 +00:00
|
|
|
const EDA_ANGLE& aRotation = ANGLE_0,
|
|
|
|
const double& aScalingFactor = 1.0,
|
|
|
|
const VECTOR2I& aTransformCentre = { 0, 0 },
|
|
|
|
const bool& aMirrorInvert = false );
|
2020-09-27 12:19:51 +00:00
|
|
|
|
2020-09-27 02:35:24 +00:00
|
|
|
void loadFigure( const FIGURE& aCadstarFigure, const LAYER_ID& aCadstarSheetIDOverride,
|
2022-01-01 06:04:08 +00:00
|
|
|
SCH_LAYER_ID aKiCadSchLayerID, const VECTOR2I& aMoveVector = { 0, 0 },
|
2022-01-18 02:26:40 +00:00
|
|
|
const EDA_ANGLE& aRotation = ANGLE_0, const double& aScalingFactor = 1.0,
|
2022-01-01 06:04:08 +00:00
|
|
|
const VECTOR2I& aTransformCentre = { 0, 0 },
|
|
|
|
const bool& aMirrorInvert = false );
|
2020-09-27 12:19:51 +00:00
|
|
|
|
|
|
|
//Helper functions for loading text elements
|
2021-04-02 18:50:30 +00:00
|
|
|
void applyTextSettings( EDA_TEXT* aKiCadTextItem,
|
|
|
|
const TEXTCODE_ID& aCadstarTextCodeID,
|
|
|
|
const ALIGNMENT& aCadstarAlignment,
|
|
|
|
const JUSTIFICATION& aCadstarJustification,
|
|
|
|
const long long aCadstarOrientAngle = 0,
|
|
|
|
bool aMirrored = false );
|
|
|
|
|
2020-09-27 12:19:51 +00:00
|
|
|
SCH_TEXT* getKiCadSchText( const TEXT& aCadstarTextElement );
|
|
|
|
|
2020-09-26 18:23:13 +00:00
|
|
|
|
2020-09-23 20:39:11 +00:00
|
|
|
//Helper Functions for obtaining CADSTAR elements from the parsed structures
|
2020-09-20 21:08:46 +00:00
|
|
|
SYMDEF_ID getSymDefFromName( const wxString& aSymdefName, const wxString& aSymDefAlternate );
|
2021-01-27 00:09:58 +00:00
|
|
|
bool isAttributeVisible( const ATTRIBUTE_ID& aCadstarAttributeID );
|
2020-09-27 12:19:51 +00:00
|
|
|
|
|
|
|
int getLineThickness( const LINECODE_ID& aCadstarLineCodeID );
|
|
|
|
PLOT_DASH_TYPE getLineStyle( const LINECODE_ID& aCadstarLineCodeID );
|
|
|
|
PART getPart( const PART_ID& aCadstarPartID );
|
|
|
|
ROUTECODE getRouteCode( const ROUTECODE_ID& aCadstarRouteCodeID );
|
|
|
|
TEXTCODE getTextCode( const TEXTCODE_ID& aCadstarTextCodeID );
|
2021-09-01 19:12:56 +00:00
|
|
|
int getTextHeightFromTextCode( const TEXTCODE_ID& aCadstarTextCodeID );
|
2020-09-27 12:19:51 +00:00
|
|
|
wxString getAttributeName( const ATTRIBUTE_ID& aCadstarAttributeID );
|
|
|
|
|
2022-01-24 13:40:39 +00:00
|
|
|
PART::DEFINITION::PIN getPartDefinitionPin( const PART& aCadstarPart, const GATE_ID& aGateID,
|
|
|
|
const TERMINAL_ID& aTerminalID );
|
2020-09-19 22:05:02 +00:00
|
|
|
|
2020-09-27 13:10:59 +00:00
|
|
|
//Helper Functions for obtaining individual elements as KiCad elements:
|
2021-02-02 15:37:10 +00:00
|
|
|
ELECTRICAL_PINTYPE getKiCadPinType( const PART::PIN_TYPE& aPinType );
|
|
|
|
|
2022-01-24 13:40:39 +00:00
|
|
|
int getKiCadUnitNumberFromGate( const GATE_ID& aCadstarGateID );
|
|
|
|
TEXT_SPIN_STYLE getSpinStyle( const long long& aCadstarOrientation, bool aMirror );
|
|
|
|
TEXT_SPIN_STYLE getSpinStyle( const EDA_ANGLE& aOrientation );
|
|
|
|
ALIGNMENT mirrorX( const ALIGNMENT& aCadstarAlignment );
|
|
|
|
ALIGNMENT rotate180( const ALIGNMENT& aCadstarAlignment );
|
2020-09-27 02:35:24 +00:00
|
|
|
|
2020-09-27 13:10:59 +00:00
|
|
|
//General Graphical manipulation functions
|
2021-05-28 15:19:04 +00:00
|
|
|
|
2021-06-10 18:51:46 +00:00
|
|
|
LIB_SYMBOL* getScaledLibPart( const LIB_SYMBOL* aSymbol, long long aScalingFactorNumerator,
|
|
|
|
long long aScalingFactorDenominator );
|
2021-05-28 15:19:04 +00:00
|
|
|
|
2021-06-10 18:51:46 +00:00
|
|
|
void fixUpLibraryPins( LIB_SYMBOL* aSymbolToFix, int aGateNumber );
|
2021-05-28 18:39:08 +00:00
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
std::pair<VECTOR2I, wxSize> getFigureExtentsKiCad( const FIGURE& aCadstarFigure );
|
2020-09-19 22:05:02 +00:00
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
VECTOR2I getKiCadPoint( const VECTOR2I& aCadstarPoint );
|
2020-09-19 22:05:02 +00:00
|
|
|
|
2023-01-10 21:25:28 +00:00
|
|
|
VECTOR2I getKiCadLibraryPoint( const VECTOR2I& aCadstarPoint, const VECTOR2I& aCadstarCentre );
|
2020-09-20 21:08:46 +00:00
|
|
|
|
2022-01-01 06:04:08 +00:00
|
|
|
VECTOR2I applyTransform( const VECTOR2I& aPoint, const VECTOR2I& aMoveVector = { 0, 0 },
|
2022-01-18 02:26:40 +00:00
|
|
|
const EDA_ANGLE& aRotation = ANGLE_0,
|
|
|
|
const double& aScalingFactor = 1.0,
|
|
|
|
const VECTOR2I& aTransformCentre = { 0, 0 },
|
|
|
|
const bool& aMirrorInvert = false );
|
2020-09-19 22:05:02 +00:00
|
|
|
|
|
|
|
int getKiCadLength( long long aCadstarLength )
|
|
|
|
{
|
2021-02-18 18:02:49 +00:00
|
|
|
int mod = aCadstarLength % KiCadUnitDivider;
|
|
|
|
int absmod = sign( mod ) * mod;
|
|
|
|
int offset = 0;
|
|
|
|
|
|
|
|
// Round half-way cases away from zero
|
|
|
|
if( absmod >= KiCadUnitDivider / 2 )
|
|
|
|
offset = sign( aCadstarLength );
|
|
|
|
|
|
|
|
return ( aCadstarLength / KiCadUnitDivider ) + offset;
|
2020-09-19 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
2022-01-18 02:26:40 +00:00
|
|
|
EDA_ANGLE getAngle( const long long& aCadstarAngle )
|
2020-09-19 22:05:02 +00:00
|
|
|
{
|
2020-11-22 01:50:04 +00:00
|
|
|
// CADSTAR v6 (which outputted Schematic Format Version 8) and earlier used 1/10 degree
|
|
|
|
// as the unit for angles/orientations. It is assumed that CADSTAR version 7 (i.e. Schematic
|
|
|
|
// Format Version 9 and later) is the version that introduced 1/1000 degree for angles.
|
|
|
|
if( Header.Format.Version > 8 )
|
|
|
|
{
|
2022-01-18 02:26:40 +00:00
|
|
|
return EDA_ANGLE( (double) aCadstarAngle / 1000.0, DEGREES_T );
|
2020-11-22 01:50:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-01-18 02:26:40 +00:00
|
|
|
return EDA_ANGLE( (double) aCadstarAngle, TENTHS_OF_A_DEGREE_T );
|
2020-11-22 01:50:04 +00:00
|
|
|
}
|
2020-09-19 22:05:02 +00:00
|
|
|
}
|
|
|
|
|
2022-01-18 02:26:40 +00:00
|
|
|
long long getCadstarAngle( const EDA_ANGLE& aAngle )
|
2021-04-02 18:50:30 +00:00
|
|
|
{
|
2022-01-18 02:26:40 +00:00
|
|
|
// CADSTAR v6 (which outputted Schematic Format Version 8) and earlier used 1/10 degree
|
|
|
|
// as the unit for angles/orientations. It is assumed that CADSTAR version 7 (i.e. Schematic
|
|
|
|
// Format Version 9 and later) is the version that introduced 1/1000 degree for angles.
|
|
|
|
if( Header.Format.Version > 8 )
|
|
|
|
{
|
|
|
|
return KiROUND( aAngle.AsDegrees() * 1000.0 );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return aAngle.AsTenthsOfADegree();
|
|
|
|
}
|
2021-04-02 18:50:30 +00:00
|
|
|
}
|
|
|
|
|
2020-09-20 21:08:46 +00:00
|
|
|
/**
|
2020-10-24 14:45:37 +00:00
|
|
|
* @brief
|
|
|
|
* @param aPoint
|
2020-09-20 21:08:46 +00:00
|
|
|
* @return Radius of polar representation of the point
|
|
|
|
*/
|
2022-01-01 06:04:08 +00:00
|
|
|
double getPolarRadius( const VECTOR2I& aPoint );
|
2020-09-20 21:08:46 +00:00
|
|
|
|
2020-09-08 19:51:22 +00:00
|
|
|
}; // CADSTAR_SCH_ARCHIVE_LOADER
|
|
|
|
|
|
|
|
|
|
|
|
#endif // CADSTAR_SCH_ARCHIVE_LOADER_H_
|