2018-08-23 21:54:42 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013-2017 CERN
|
2021-06-08 17:47:06 +00:00
|
|
|
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
|
2018-08-23 21:54:42 +00:00
|
|
|
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
|
|
|
* @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 __VIEW_OVERLAY_H
|
|
|
|
#define __VIEW_OVERLAY_H
|
|
|
|
|
2023-09-26 11:40:17 +00:00
|
|
|
#include <gal/gal.h>
|
2018-08-23 21:54:42 +00:00
|
|
|
#include <view/view_item.h>
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <deque>
|
|
|
|
|
2018-12-11 09:25:24 +00:00
|
|
|
#include <geometry/shape_poly_set.h>
|
|
|
|
|
2018-08-23 21:54:42 +00:00
|
|
|
class SEG;
|
|
|
|
|
|
|
|
namespace KIGFX
|
|
|
|
{
|
|
|
|
class VIEW;
|
|
|
|
|
2023-09-26 11:40:17 +00:00
|
|
|
class GAL_API VIEW_OVERLAY : public VIEW_ITEM
|
2018-08-23 21:54:42 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
VIEW_OVERLAY();
|
|
|
|
virtual ~VIEW_OVERLAY();
|
|
|
|
|
|
|
|
struct COMMAND;
|
|
|
|
struct COMMAND_ARC;
|
|
|
|
struct COMMAND_LINE;
|
|
|
|
struct COMMAND_CIRCLE;
|
2018-12-11 09:25:24 +00:00
|
|
|
struct COMMAND_RECTANGLE;
|
|
|
|
|
2018-08-23 21:54:42 +00:00
|
|
|
struct COMMAND_SET_STROKE;
|
|
|
|
struct COMMAND_SET_FILL;
|
|
|
|
struct COMMAND_SET_COLOR;
|
|
|
|
struct COMMAND_SET_WIDTH;
|
|
|
|
|
2018-12-11 09:25:24 +00:00
|
|
|
struct COMMAND_POLYGON;
|
|
|
|
struct COMMAND_POINT_POLYGON;
|
|
|
|
struct COMMAND_POLY_POLYGON;
|
|
|
|
|
|
|
|
struct COMMAND_POLYLINE;
|
|
|
|
struct COMMAND_POINT_POLYLINE;
|
|
|
|
|
2021-02-11 22:05:03 +00:00
|
|
|
struct COMMAND_GLYPH_SIZE;
|
|
|
|
struct COMMAND_BITMAP_TEXT;
|
|
|
|
|
2018-08-23 21:54:42 +00:00
|
|
|
void Clear();
|
|
|
|
|
|
|
|
virtual const BOX2I ViewBBox() const override;
|
|
|
|
virtual void ViewDraw( int aLayer, VIEW *aView ) const override;
|
|
|
|
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
|
|
|
|
2018-12-11 09:25:24 +00:00
|
|
|
// Basic shape primitives
|
2018-08-23 21:54:42 +00:00
|
|
|
void Line( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
|
|
|
|
void Line( const SEG& aSeg );
|
|
|
|
void Segment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint, double aWidth );
|
|
|
|
void Circle( const VECTOR2D& aCenterPoint, double aRadius );
|
2022-01-16 16:15:07 +00:00
|
|
|
void Arc( const VECTOR2D& aCenterPoint, double aRadius, const EDA_ANGLE& aStartAngle,
|
|
|
|
const EDA_ANGLE& aEndAngle );
|
2018-08-23 21:54:42 +00:00
|
|
|
void Rectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
|
2020-10-07 12:59:06 +00:00
|
|
|
void Cross( const VECTOR2D& aP, int aSize );
|
2018-12-11 09:25:24 +00:00
|
|
|
|
|
|
|
// polygon primitives
|
2018-08-23 21:54:42 +00:00
|
|
|
void Polygon( const std::deque<VECTOR2D>& aPointList );
|
2018-12-11 09:25:24 +00:00
|
|
|
void Polygon( const SHAPE_POLY_SET& aPolySet );
|
2021-02-11 22:05:03 +00:00
|
|
|
void Polyline( const SHAPE_LINE_CHAIN& aPolyLine );
|
2018-12-11 09:25:24 +00:00
|
|
|
void Polygon( const VECTOR2D aPointList[], int aListSize );
|
|
|
|
|
2022-01-11 13:47:21 +00:00
|
|
|
void BitmapText( const wxString& aText, const VECTOR2I& aPosition, const EDA_ANGLE& aAngle );
|
2021-06-08 17:47:06 +00:00
|
|
|
|
2018-12-11 09:25:24 +00:00
|
|
|
// Draw settings
|
2018-08-23 21:54:42 +00:00
|
|
|
void SetIsFill( bool aIsFillEnabled );
|
|
|
|
void SetIsStroke( bool aIsStrokeEnabled );
|
|
|
|
void SetFillColor( const COLOR4D& aColor );
|
|
|
|
void SetStrokeColor( const COLOR4D& aColor );
|
2022-01-11 13:47:21 +00:00
|
|
|
void SetGlyphSize( const VECTOR2I& aSize );
|
2018-08-23 21:54:42 +00:00
|
|
|
void SetLineWidth( double aLineWidth );
|
|
|
|
|
2021-05-30 22:15:16 +00:00
|
|
|
const COLOR4D& GetStrokeColor() const { return m_strokeColor; }
|
|
|
|
const COLOR4D& GetFillColor() const { return m_fillColor; }
|
|
|
|
|
2018-08-23 21:54:42 +00:00
|
|
|
private:
|
|
|
|
void releaseCommands();
|
|
|
|
|
2021-05-30 22:15:16 +00:00
|
|
|
COLOR4D m_strokeColor;
|
|
|
|
COLOR4D m_fillColor;
|
|
|
|
|
2018-08-23 21:54:42 +00:00
|
|
|
std::vector<COMMAND*> m_commands;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace KIGFX
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|