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 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
28
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 bool HitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const override;
104
105 void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
106 int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
107
108 EDA_ITEM* Clone() const override;
109
110 double Similarity( const SCH_ITEM& aOther ) const override;
111
112 bool operator==( const SCH_ITEM& aOther ) const override;
113
114#if defined(DEBUG)
115 void Show( int nestLevel, std::ostream& os ) const override;
116#endif
117
118protected:
119 void swapData( SCH_ITEM* aItem ) override;
120
121private:
122 friend struct SCH_BITMAP_DESC;
123
124 // Property manager interfaces
125 int GetWidth() const;
126 void SetWidth( int aWidth );
127 int GetHeight() const;
128 void SetHeight( int aHeight );
129 int GetTransformOriginOffsetX() const;
130 void SetTransformOriginOffsetX( int aX );
131 int GetTransformOriginOffsetY() const;
132 void SetTransformOriginOffsetY( int aY );
133
134 double GetImageScale() const;
135 void SetImageScale( double aScale );
136
138};
BITMAPS
A list of all bitmap identifiers.
BOX2< VECTOR2I > BOX2I
Definition box2.h:922
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:98
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:39
Base plotter engine class.
Definition plotter.h:121
A REFERENCE_IMAGE is a wrapper around a BITMAP_IMAGE that is displayed in an editor as a reference fo...
void Rotate(const VECTOR2I &aCenter, bool aRotateCCW) override
Rotate the item around aCenter 90 degrees in the clockwise direction.
double GetImageScale() const
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
SCH_BITMAP(const VECTOR2I &pos=VECTOR2I(0, 0))
void SetWidth(int aWidth)
VECTOR2I GetPosition() const override
static bool ClassOf(const EDA_ITEM *aItem)
Definition sch_bitmap.h:60
int GetTransformOriginOffsetY() const
void SetHeight(int aHeight)
virtual std::vector< int > ViewGetLayers() const override
int GetWidth() const
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.
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.
wxString GetClass() const override
Return the class name.
Definition sch_bitmap.h:65
void MirrorVertically(int aCenter) override
Mirror item vertically about aCenter.
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.
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.
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.
int GetHeight() const
void SetY(int aY)
Definition sch_bitmap.h:58
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
int GetX() const
Definition sch_bitmap.h:54
void SetTransformOriginOffsetX(int aX)
void SetPosition(const VECTOR2I &aPosition) override
void Move(const VECTOR2I &aMoveVector) override
Move the item by aMoveVector to a new position.
SCH_BITMAP & operator=(const SCH_ITEM &aItem)
void SetX(int aX)
Definition sch_bitmap.h:55
friend struct SCH_BITMAP_DESC
Definition sch_bitmap.h:122
void MirrorHorizontally(int aCenter) override
Mirror item horizontally about aCenter.
bool operator==(const SCH_ITEM &aOther) const override
REFERENCE_IMAGE m_referenceImage
Definition sch_bitmap.h:137
int GetTransformOriginOffsetX() const
void SetTransformOriginOffsetY(int aY)
void SetImageScale(double aScale)
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:167
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
Definition sch_item.cpp:51
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
#define _(s)
@ SCH_BITMAP_T
Definition typeinfo.h:166
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:695