2018-10-13 18:37:28 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2016 CERN
|
2023-03-30 11:49:23 +00:00
|
|
|
* Copyright (C) 2018-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2021-01-27 22:15:38 +00:00
|
|
|
*
|
2018-10-13 18:37:28 +00:00
|
|
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
|
|
|
*
|
|
|
|
* 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 2
|
|
|
|
* 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, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GRAPHICS_IMPORTER_PCBNEW_H
|
|
|
|
#define GRAPHICS_IMPORTER_PCBNEW_H
|
|
|
|
|
2023-08-18 12:55:01 +00:00
|
|
|
#include <import_gfx/graphics_importer.h>
|
2021-07-29 09:47:43 +00:00
|
|
|
#include <layer_ids.h>
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2023-10-18 13:20:34 +00:00
|
|
|
class BOARD_ITEM_CONTAINER;
|
2018-10-13 18:37:28 +00:00
|
|
|
|
|
|
|
class GRAPHICS_IMPORTER_PCBNEW : public GRAPHICS_IMPORTER
|
|
|
|
{
|
|
|
|
public:
|
2023-10-18 13:20:34 +00:00
|
|
|
GRAPHICS_IMPORTER_PCBNEW( BOARD_ITEM_CONTAINER* aParent );
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2023-10-18 13:20:34 +00:00
|
|
|
void SetLayer( PCB_LAYER_ID aLayer ) { m_layer = aLayer; }
|
|
|
|
PCB_LAYER_ID GetLayer() const { return m_layer; }
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2023-10-09 00:54:34 +00:00
|
|
|
void AddLine( const VECTOR2D& aStart, const VECTOR2D& aEnd,
|
2023-10-09 03:56:13 +00:00
|
|
|
const IMPORTED_STROKE& aStroke ) override;
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2023-10-09 03:56:13 +00:00
|
|
|
void AddCircle( const VECTOR2D& aCenter, double aRadius, const IMPORTED_STROKE& aStroke,
|
2023-10-09 00:54:34 +00:00
|
|
|
bool aFilled, const COLOR4D& aFillColor = COLOR4D::UNSPECIFIED ) override;
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2022-01-20 23:08:48 +00:00
|
|
|
void AddArc( const VECTOR2D& aCenter, const VECTOR2D& aStart, const EDA_ANGLE& aAngle,
|
2023-10-09 03:56:13 +00:00
|
|
|
const IMPORTED_STROKE& aStroke ) override;
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2023-10-09 03:56:13 +00:00
|
|
|
void AddPolygon( const std::vector<VECTOR2D>& aVertices, const IMPORTED_STROKE& aStroke,
|
2023-10-09 00:54:34 +00:00
|
|
|
bool aFilled, const COLOR4D& aFillColor = COLOR4D::UNSPECIFIED ) override;
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2021-12-28 22:13:54 +00:00
|
|
|
void AddText( const VECTOR2D& aOrigin, const wxString& aText, double aHeight, double aWidth,
|
|
|
|
double aThickness, double aOrientation, GR_TEXT_H_ALIGN_T aHJustify,
|
2023-10-09 00:54:34 +00:00
|
|
|
GR_TEXT_V_ALIGN_T aVJustify,
|
|
|
|
const COLOR4D& aColor = COLOR4D::UNSPECIFIED ) override;
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2018-11-01 09:47:41 +00:00
|
|
|
void AddSpline( const VECTOR2D& aStart, const VECTOR2D& aBezierControl1,
|
2023-10-09 00:54:34 +00:00
|
|
|
const VECTOR2D& aBezierControl2, const VECTOR2D& aEnd,
|
2023-10-09 03:56:13 +00:00
|
|
|
const IMPORTED_STROKE& aStroke ) override;
|
2018-11-01 09:47:41 +00:00
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
/**
|
|
|
|
* Convert an imported coordinate to a board coordinate, according to the internal units,
|
|
|
|
* user scale and offset
|
|
|
|
*
|
|
|
|
* @param aCoordinate is the imported coordinate in mm.
|
2018-11-05 16:04:05 +00:00
|
|
|
*/
|
2023-02-19 03:40:07 +00:00
|
|
|
VECTOR2I MapCoordinate( const VECTOR2D& aCoordinate );
|
2018-11-05 16:04:05 +00:00
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
/**
|
|
|
|
* If aLineWidth < 0, the default line thickness value is returned.
|
|
|
|
*
|
|
|
|
* @param aLineWidth is the line thickness in mm to convert.
|
|
|
|
* @return a line thickness in a board Iu value, according to the internal units.
|
2018-11-05 16:04:05 +00:00
|
|
|
*/
|
|
|
|
int MapLineWidth( double aLineWidth );
|
|
|
|
|
2023-10-09 03:56:13 +00:00
|
|
|
STROKE_PARAMS MapStrokeParams( const IMPORTED_STROKE& aStroke );
|
2023-10-09 00:54:34 +00:00
|
|
|
|
2018-10-13 18:37:28 +00:00
|
|
|
protected:
|
2021-01-27 22:15:38 +00:00
|
|
|
///< Target layer for the imported shapes.
|
2023-10-18 13:20:34 +00:00
|
|
|
PCB_LAYER_ID m_layer;
|
|
|
|
BOARD_ITEM_CONTAINER* m_parent;
|
2018-10-13 18:37:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-18 13:20:34 +00:00
|
|
|
#endif /* GRAPHICS_IMPORTER_PCBNEW_H */
|