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, see <https://www.gnu.org/licenses/>.
19 */
20
24
25#pragma once
26
27
28#include <sch_item.h>
29#include <reference_image.h>
30
31
35class SCH_BITMAP : public SCH_ITEM
36{
37public:
38 SCH_BITMAP( const VECTOR2I& pos = VECTOR2I( 0, 0 ) );
39
40 SCH_BITMAP( const SCH_BITMAP& aSchBitmap );
41
42 SCH_BITMAP& operator=( const SCH_ITEM& aItem );
43
44 void Serialize( google::protobuf::Any& aContainer ) const override;
45 bool Deserialize( const google::protobuf::Any& aContainer ) override;
46
52
53 int GetX() const { return GetPosition().x; };
54 void SetX( int aX ) { SetPosition( VECTOR2I( aX, GetY() ) ); }
55
56 int GetY() const { return GetPosition().y; }
57 void SetY( int aY ) { SetPosition( VECTOR2I( GetX(), aY ) ); }
58
59 static inline bool ClassOf( const EDA_ITEM* aItem )
60 {
61 return aItem && SCH_BITMAP_T == aItem->Type();
62 }
63
64 wxString GetClass() const override
65 {
66 return wxT( "SCH_BITMAP" );
67 }
68
69 const BOX2I GetBoundingBox() const override;
70
72 virtual std::vector<int> ViewGetLayers() const override;
73
74 void Move( const VECTOR2I& aMoveVector ) override;
75
82 bool IsMovableFromAnchorPoint() const override { return false; }
83
84 void MirrorHorizontally( int aCenter ) override;
85 void MirrorVertically( int aCenter ) override;
86 void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
87
88 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override
89 {
90 return wxString( _( "Image" ) );
91 }
92
93 BITMAPS GetMenuImage() const override;
94
95 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
96
97 VECTOR2I GetPosition() const override;
98 void SetPosition( const VECTOR2I& aPosition ) override;
99
100 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
101 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
102 bool HitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) 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.
BOX2< VECTOR2I > BOX2I
Definition box2.h:918
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:96
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:108
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:37
Base plotter engine class.
Definition plotter.h:133
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:59
int GetTransformOriginOffsetY() const
void SetHeight(int aHeight)
virtual std::vector< int > ViewGetLayers() const override
int GetWidth() const
int GetY() const
Definition sch_bitmap.h:56
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.
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition sch_bitmap.h:88
REFERENCE_IMAGE & GetReferenceImage()
Definition sch_bitmap.h:50
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
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:64
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:82
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:51
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:57
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:53
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:54
friend struct SCH_BITMAP_DESC
Definition sch_bitmap.h:121
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:136
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:162
SCH_ITEM(EDA_ITEM *aParent, KICAD_T aType, int aUnit=0, int aBodyStyle=0)
Definition sch_item.cpp:52
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:161
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683