KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
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 The 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
73 virtual std::vector<int> ViewGetLayers() const override;
74
75 void Move( const VECTOR2I& aMoveVector ) override;
76
83 bool IsMovableFromAnchorPoint() const override { return false; }
84
85 void MirrorHorizontally( int aCenter ) override;
86 void MirrorVertically( int aCenter ) override;
87 void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
88
89 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override
90 {
91 return wxString( _( "Image" ) );
92 }
93
94 BITMAPS GetMenuImage() const override;
95
96 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
97
98 VECTOR2I GetPosition() const override;
99 void SetPosition( const VECTOR2I& aPosition ) override;
100
101 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
102 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
103
104 void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
105 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
106
107 EDA_ITEM* Clone() const override;
108
109 double Similarity( const SCH_ITEM& aOther ) const override;
110
111 bool operator==( const SCH_ITEM& aOther ) const override;
112
113#if defined(DEBUG)
114 void Show( int nestLevel, std::ostream& os ) const override;
115#endif
116
117protected:
118 void swapData( SCH_ITEM* aItem ) override;
119
120private:
121 friend struct SCH_BITMAP_DESC;
122
123 // Property manager interfaces
124 int GetWidth() const;
125 void SetWidth( int aWidth );
126 int GetHeight() const;
127 void SetHeight( int aHeight );
128 int GetTransformOriginOffsetX() const;
129 void SetTransformOriginOffsetX( int aX );
130 int GetTransformOriginOffsetY() const;
131 void SetTransformOriginOffsetY( int aY );
132
133 double GetImageScale() const;
134 void SetImageScale( double aScale );
135
137};
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:95
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:107
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:135
double GetImageScale() const
Definition: sch_bitmap.cpp:257
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:275
VECTOR2I GetPosition() const override
Definition: sch_bitmap.cpp:105
static bool ClassOf(const EDA_ITEM *aItem)
Definition: sch_bitmap.h:60
int GetTransformOriginOffsetY() const
Definition: sch_bitmap.cpp:243
void SetHeight(int aHeight)
Definition: sch_bitmap.cpp:287
virtual std::vector< int > ViewGetLayers() const override
Definition: sch_bitmap.cpp:200
int GetWidth() const
Definition: sch_bitmap.cpp:269
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:164
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: sch_bitmap.h:89
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:123
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:184
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:83
void swapData(SCH_ITEM *aItem) override
Swap the internal data structures aItem with the schematic item.
Definition: sch_bitmap.cpp:86
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:216
int GetHeight() const
Definition: sch_bitmap.cpp:281
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:178
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:152
int GetX() const
Definition: sch_bitmap.h:54
void SetTransformOriginOffsetX(int aX)
Definition: sch_bitmap.cpp:235
void SetPosition(const VECTOR2I &aPosition) override
Definition: sch_bitmap.cpp:111
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
Definition: sch_bitmap.cpp:117
SCH_BITMAP & operator=(const SCH_ITEM &aItem)
Definition: sch_bitmap.cpp:62
void SetX(int aX)
Definition: sch_bitmap.h:55
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
Definition: sch_bitmap.cpp:129
bool operator==(const SCH_ITEM &aOther) const override
Definition: sch_bitmap.cpp:206
REFERENCE_IMAGE m_referenceImage
Definition: sch_bitmap.h:136
int GetTransformOriginOffsetX() const
Definition: sch_bitmap.cpp:229
void SetTransformOriginOffsetY(int aY)
Definition: sch_bitmap.cpp:249
void SetImageScale(double aScale)
Definition: sch_bitmap.cpp:263
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:168
#define _(s)
@ SCH_BITMAP_T
Definition: typeinfo.h:164
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:695