KiCad PCB EDA Suite
Loading...
Searching...
No Matches
mirror_axis_item.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KICAD, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
24
25
30{
31public:
33 m_geomMgr( aGeomMgr )
34 {
35 }
36
37 const BOX2I ViewBBox() const override
38 {
39 BOX2I bbox( m_geomMgr.GetOrigin(), m_geomMgr.GetEnd() - m_geomMgr.GetOrigin() );
40 bbox.Normalize();
41 return bbox;
42 }
43
44 wxString GetClass() const override { return wxT( "MIRROR_AXIS_ITEM" ); }
45
46#if defined( DEBUG )
47 void Show( int, std::ostream& ) const override {}
48#endif
49
50private:
51 void drawPreviewShape( KIGFX::VIEW* aView ) const override
52 {
53 KIGFX::GAL* gal = aView->GetGAL();
54
55 gal->SetLineWidth( aView->ToWorld( 1.0 ) );
56 gal->DrawLine( m_geomMgr.GetOrigin(), m_geomMgr.GetEnd() );
57 }
58
60};
BOX2< VECTOR2I > BOX2I
Definition box2.h:917
constexpr BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
Definition box2.h:149
Abstract interface for drawing on a 2D-surface.
virtual void SetLineWidth(float aLineWidth)
Set the line width.
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
SIMPLE_OVERLAY_ITEM is class that represents a visual area drawn on a canvas, used to temporarily dem...
Represent a very simple geometry manager for items that have a start and end point.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:68
GAL * GetGAL() const
Return the GAL this view is using to draw graphical primitives.
Definition view.h:224
VECTOR2D ToWorld(const VECTOR2D &aCoord, bool aAbsolute=true) const
Converts a screen space point/vector to a point/vector in world space coordinates.
Definition view.cpp:790
wxString GetClass() const override
Get class name.
MIRROR_AXIS_ITEM(const KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER &aGeomMgr)
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
const KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER & m_geomMgr
void drawPreviewShape(KIGFX::VIEW *aView) const override
Draw the preview onto the given GAL.