40#include <wx/mstream.h>
68 wxCHECK_MSG(
Type() == aItem.
Type(), *
this,
69 wxT(
"Cannot assign object type " ) + aItem.
GetClass() + wxT(
" to type " )
121 wxString::Format( wxT(
"% object cannot swap data with %s object." ),
138 constexpr double HIDE = std::numeric_limits<double>::max();
165 return BOX2I( topLeft, size );
206 for(
double ang = 45.0; ang < norm.
AsDegrees(); ang += 90.0 )
212void PCB_REFERENCE_IMAGE::Show(
int nestLevel, std::ostream& os )
const
217 NestedSpace( nestLevel, os ) <<
'<' << s.Lower().mb_str() <<
m_pos <<
"/>\n";
247 return BITMAPS::image;
252 std::vector<MSG_PANEL_ITEM>& aList )
254 aList.emplace_back(
_(
"Reference Image" ), wxEmptyString );
256 aList.emplace_back(
_(
"PPI" ), wxString::Format( wxT(
"%d "),
GetImage()->GetPPI() ) );
257 aList.emplace_back(
_(
"Scale" ), wxString::Format( wxT(
"%f "),
GetImageScale() ) );
311 double similarity = 1.0;
350 const wxString groupImage =
_HKI(
"Image Properties" );
358 const wxString greyscale =
_HKI(
"Greyscale" );
constexpr EDA_IU_SCALE pcbIUScale
BITMAPS
A list of all bitmap identifiers.
This class handle bitmap images in KiCad.
void Rotate(bool aRotateCCW)
Rotate image CW or CCW.
void Mirror(bool aVertically)
Mirror image vertically (i.e.
void SetPixelSizeIu(double aPixSize)
bool ReadImageFile(const wxString &aFullFilename)
Reads and stores in memory an image file.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
bool IsLayerVisible(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
const Vec & GetPosition() const
size_type GetHeight() const
bool Intersects(const BOX2< Vec > &aRect) const
size_type GetWidth() const
bool Contains(const Vec &aPoint) const
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
EDA_ITEM & operator=(const EDA_ITEM &aItem)
Assign the members of aItem to another object.
KICAD_T Type() const
Returns the type of object.
virtual wxString GetClass() const =0
Return the class name.
EDA_ITEM * m_parent
Linked list: Link (parent struct)
Contains methods for drawing PCB-specific items.
virtual PCB_RENDER_SETTINGS * GetSettings() override
Return a pointer to current settings that are going to be used when drawing items.
PCB specific render settings.
HIGH_CONTRAST_MODE m_ContrastModeDisplay
bool GetHighContrast() const
bool GetLayerIsHighContrast(int aLayerId) const
Return information whether the queried layer is marked as high-contrast.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Object to handle a bitmap image that can be inserted in a PCB.
void swapData(BOARD_ITEM *aItem) override
double Similarity(const BOARD_ITEM &aBoardItem) const override
Return a measure of how likely the other object is to represent the same object.
double GetImageScale() const
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
bool ReadImageFile(const wxString &aFullFilename)
Read and store an image file.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
const BITMAP_BASE * GetImage() const
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
void SetImageScale(double aScale)
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
wxString GetClass() const override
Return the class name.
void Rotate(const VECTOR2I &aCenter, const EDA_ANGLE &aAngle) override
Rotate this object.
bool operator==(const BOARD_ITEM &aBoardItem) const override
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
const VECTOR2I GetSize() const
PCB_REFERENCE_IMAGE(BOARD_ITEM *aParent, const VECTOR2I &pos=VECTOR2I(0, 0), PCB_LAYER_ID aLayer=F_Cu)
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.
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
BITMAP_BASE * m_bitmapBase
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
PCB_REFERENCE_IMAGE & operator=(const BOARD_ITEM &aItem)
Provide class metadata.Helper macro to map type hashes to names.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
PROPERTY_BASE & ReplaceProperty(size_t aBase, const wxString &aName, PROPERTY_BASE *aNew, const wxString &aGroup=wxEmptyString)
Replace an existing property for a specific type.
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
wxString LayerName(int aLayer)
Returns the default display name for a given layer.
#define BITMAP_LAYER_FOR(boardLayer)
Macros for getting the extra layers for a given board layer.
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
@ LAYER_DRAW_BITMAPS
to handle and draw images bitmaps
PCB_LAYER_ID
A quick note on layer IDs:
void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
static struct PCB_REFERENCE_IMAGE_DESC _PCB_REFERENCE_IMAGE_DESC
constexpr int MilsToIU(int mils) const
PCB_REFERENCE_IMAGE_DESC()
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer