KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sch_bitmap.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 (C) 2011 jean-pierre.charras
5 * Copyright (C) 2011-2021 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
29#pragma once
30
31
32#include <sch_item.h>
33#include <reference_image.h>
34
35
39class SCH_BITMAP : public SCH_ITEM
40{
41public:
42 SCH_BITMAP( const VECTOR2I& pos = VECTOR2I( 0, 0 ) );
43
44 SCH_BITMAP( const SCH_BITMAP& aSchBitmap );
45
46 SCH_BITMAP& operator=( const SCH_ITEM& aItem );
47
53
54 int GetX() const { return GetPosition().x; };
55 void SetX( int aX ) { SetPosition( VECTOR2I( aX, GetY() ) ); }
56
57 int GetY() const { return GetPosition().y; }
58 void SetY( int aY ) { SetPosition( VECTOR2I( GetX(), aY ) ); }
59
60 static inline bool ClassOf( const EDA_ITEM* aItem )
61 {
62 return aItem && SCH_BITMAP_T == aItem->Type();
63 }
64
65 wxString GetClass() const override
66 {
67 return wxT( "SCH_BITMAP" );
68 }
69
70 const BOX2I GetBoundingBox() const override;
71
72 void SwapData( SCH_ITEM* aItem ) override;
73
75 virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
76
77 void Move( const VECTOR2I& aMoveVector ) override;
78
85 bool IsMovableFromAnchorPoint() const override { return false; }
86
87 void MirrorHorizontally( int aCenter ) override;
88 void MirrorVertically( int aCenter ) override;
89 void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
90
91 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override
92 {
93 return wxString( _( "Image" ) );
94 }
95
96 BITMAPS GetMenuImage() const override;
97
98 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
99
100 VECTOR2I GetPosition() const override;
101 void SetPosition( const VECTOR2I& aPosition ) override;
102
103 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
104 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
105
106 void Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBodyStyle,
107 const VECTOR2I& aOffset, bool aForceNoFill, bool aDimmed ) override;
108
109 void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
110 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
111
112 EDA_ITEM* Clone() const override;
113
114 double Similarity( const SCH_ITEM& aOther ) const override;
115
116 bool operator==( const SCH_ITEM& aOther ) const override;
117
118#if defined(DEBUG)
119 void Show( int nestLevel, std::ostream& os ) const override;
120#endif
121
122private:
123 friend struct SCH_BITMAP_DESC;
124
125 // Property manager interfaces
126 int GetWidth() const;
127 void SetWidth( int aWidth );
128 int GetHeight() const;
129 void SetHeight( int aHeight );
130 int GetTransformOriginOffsetX() const;
131 void SetTransformOriginOffsetX( int aX );
132 int GetTransformOriginOffsetY() const;
133 void SetTransformOriginOffsetY( int aY );
134
135 double GetImageScale() const;
136 void SetImageScale( double aScale );
137
139};
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:89
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:101
Base plotter engine class.
Definition: plotter.h:105
A REFERENCE_IMAGE is a wrapper around a BITMAP_IMAGE that is displayed in an editor as a reference fo...
Object to handle a bitmap image that can be inserted in a schematic.
Definition: sch_bitmap.h:40
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
Definition: sch_bitmap.cpp:145
double GetImageScale() const
Definition: sch_bitmap.cpp:267
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: sch_bitmap.cpp:80
void SetWidth(int aWidth)
Definition: sch_bitmap.cpp:285
VECTOR2I GetPosition() const override
Definition: sch_bitmap.cpp:115
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_bitmap.h:60
int GetTransformOriginOffsetY() const
Definition: sch_bitmap.cpp:253
void SetHeight(int aHeight)
Definition: sch_bitmap.cpp:297
int GetWidth() const
Definition: sch_bitmap.cpp:279
int GetY() const
Definition: sch_bitmap.h:57
void Plot(PLOTTER *aPlotter, bool aBackground, const SCH_PLOT_OPTS &aPlotOpts, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aDimmed) override
Plot the item to aPlotter.
Definition: sch_bitmap.cpp:174
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: sch_bitmap.h:91
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Definition: sch_bitmap.cpp:208
REFERENCE_IMAGE & GetReferenceImage()
Definition: sch_bitmap.h:51
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: sch_bitmap.cpp:99
wxString GetClass() const override
Return the class name.
Definition: sch_bitmap.h:65
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
Definition: sch_bitmap.cpp:133
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: sch_bitmap.cpp:192
bool IsMovableFromAnchorPoint() const override
Return true for items which are moved with the anchor point at mouse cursor and false for items moved...
Definition: sch_bitmap.h:85
const REFERENCE_IMAGE & GetReferenceImage() const
Definition: sch_bitmap.h:52
double Similarity(const SCH_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
Definition: sch_bitmap.cpp:226
int GetHeight() const
Definition: sch_bitmap.cpp:291
void SetY(int aY)
Definition: sch_bitmap.h:58
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: sch_bitmap.cpp:186
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition: sch_bitmap.cpp:162
int GetX() const
Definition: sch_bitmap.h:54
void SetTransformOriginOffsetX(int aX)
Definition: sch_bitmap.cpp:245
void SetPosition(const VECTOR2I &aPosition) override
Definition: sch_bitmap.cpp:121
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_bitmap.cpp:127
SCH_BITMAP & operator=(const SCH_ITEM &aItem)
Definition: sch_bitmap.cpp:62
void SwapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_bitmap.cpp:86
void SetX(int aX)
Definition: sch_bitmap.h:55
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition: sch_bitmap.cpp:139
bool operator==(const SCH_ITEM &aOther) const override
Definition: sch_bitmap.cpp:216
void Print(const SCH_RENDER_SETTINGS *aSettings, int aUnit, int aBodyStyle, const VECTOR2I &aOffset, bool aForceNoFill, bool aDimmed) override
Print an item.
Definition: sch_bitmap.cpp:105
REFERENCE_IMAGE m_referenceImage
Definition: sch_bitmap.h:138
int GetTransformOriginOffsetX() const
Definition: sch_bitmap.cpp:239
void SetTransformOriginOffsetY(int aY)
Definition: sch_bitmap.cpp:259
void SetImageScale(double aScale)
Definition: sch_bitmap.cpp:273
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:166
#define _(s)
@ SCH_BITMAP_T
Definition: typeinfo.h:164
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:691