26#include <api/board/board_types.pb.h>
43#include <google/protobuf/any.pb.h>
72 wxCHECK_MSG(
Type() == aItem.
Type(), *
this,
73 wxT(
"Cannot assign object type " ) + aItem.
GetClass() + wxT(
" to type " )
103 wxString::Format( wxT(
"% object cannot swap data with %s object." ),
178 ReferenceImage refImage;
180 refImage.mutable_id()->set_value(
m_Uuid.AsStdString() );
186 refImage.mutable_image_scale()->set_value(
m_referenceImage.GetImageScale() );
187 refImage.set_locked(
IsLocked() ? kiapi::common::types::LockedState::LS_LOCKED
188 : kiapi::common::types::LockedState::LS_UNLOCKED );
191 refImage.mutable_parent()->set_value( parent->m_Uuid.AsStdString() );
193 refImage.mutable_parent()->set_value(
board->m_Uuid.AsStdString() );
198 aContainer.PackFrom( refImage );
206 ReferenceImage refImage;
208 if( !aContainer.UnpackTo( &refImage ) )
216 if( !refImage.image_data().empty() )
222 if( refImage.has_image_scale() )
225 SetLocked( refImage.locked() == kiapi::common::types::LockedState::LS_LOCKED );
256void PCB_REFERENCE_IMAGE::Show(
int nestLevel, std::ostream& os )
const
292 std::vector<MSG_PANEL_ITEM>& aList )
294 aList.emplace_back(
_(
"Reference Image" ), wxEmptyString );
296 aList.emplace_back(
_(
"PPI" ),
298 aList.emplace_back(
_(
"Scale" ),
301 aList.emplace_back(
_(
"Width" ),
303 aList.emplace_back(
_(
"Height" ),
322 return *
this == other;
345 double similarity = 1.0;
432 const wxString groupImage =
_HKI(
"Image Properties" );
457 const wxString greyscale =
_HKI(
"Greyscale" );
KICOMMON_API types::KiCadObjectType ToProtoEnum(KICAD_T aValue)
KICOMMON_API KICAD_T FromProtoEnum(types::KiCadObjectType aValue)
constexpr EDA_IU_SCALE pcbIUScale
BITMAPS
A list of all bitmap identifiers.
@ HIDDEN
Inactive layers are hidden.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
void SetUuidDirect(const KIID &aUuid)
Raw UUID assignment.
void SetLocked(bool aLocked) override
bool IsLocked() const override
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.
FOOTPRINT * GetParentFootprint() const
BOARD_ITEM & operator=(const BOARD_ITEM &aOther)
constexpr const Vec & GetPosition() const
constexpr size_type GetWidth() const
constexpr size_type GetHeight() const
The base class for create windows for drawing purpose.
KICAD_T Type() const
Returns the type of object.
std::map< wxString, wxString > m_customProperties
EDA_ITEM * m_parent
Owner.
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
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.
virtual wxString GetClass() const =0
Return the class name.
static constexpr double LOD_HIDE
Return this constant from ViewGetLOD() to hide the item unconditionally.
static constexpr double LOD_SHOW
Return this constant from ViewGetLOD() to show the item unconditionally.
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 SetTransformOriginOffsetY(int aY)
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
void swapData(BOARD_ITEM *aItem) override
VECTOR2I GetPosition() const override
Get the position of the image (this is the center of the image).
double Similarity(const BOARD_ITEM &aBoardItem) const override
Return a measure of how likely the other object is to represent the same object.
void Move(const VECTOR2I &aMoveVector) override
Move this object.
virtual std::vector< int > ViewGetLayers() const override
double GetImageScale() const
int GetTransformOriginOffsetY() const
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT, DRC_CONSTRAINT_T aUsage=NULL_CONSTRAINT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
void SetTransformOriginOffsetX(int aX)
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
bool operator==(const PCB_REFERENCE_IMAGE &aOther) const
void SetImageScale(double aScale)
int GetTransformOriginOffsetX() const
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
wxString GetClass() const override
Return the class name.
void Rotate(const VECTOR2I &aCenter, const EDA_ANGLE &aAngle) override
Rotate this object.
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
void SetPosition(const VECTOR2I &aPosition) override
Set the position of the image.
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
void SetWidth(int aWidth)
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.
REFERENCE_IMAGE m_referenceImage
void Mirror(const VECTOR2I &aMirrorRef, FLIP_DIRECTION aFlipDirection) override
Mirror this object relative to a given horizontal axis the layer is not changed.
void SetHeight(int aHeight)
PCB_REFERENCE_IMAGE & operator=(const BOARD_ITEM &aItem)
void CopyFrom(const BOARD_ITEM *aOther) override
PROPERTY_BASE & SetIsCopyable(bool aIsCopyable=true)
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.
VECTOR2I GetPosition() const
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
wxString MessageTextFromValue(double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const
A lower-precision version of StringFromValue().
a few functions useful in geometry calculations.
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
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
Draw images.
PCB_LAYER_ID
A quick note on layer IDs:
bool BoxHitTest(const VECTOR2I &aHitPoint, const BOX2I &aHittee, int aAccuracy)
Perform a point-to-box hit test.
KICOMMON_API void PackCustomProperties(google::protobuf::RepeatedPtrField< types::CustomProperty > *aOutput, const EDA_ITEM &aItem)
KICOMMON_API VECTOR2I UnpackVector2(const types::Vector2 &aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API void PackVector2(types::Vector2 &aOutput, const VECTOR2I &aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API void UnpackCustomProperties(const google::protobuf::RepeatedPtrField< types::CustomProperty > &aInput, EDA_ITEM &aItem)
static struct PCB_REFERENCE_IMAGE_DESC _PCB_REFERENCE_IMAGE_DESC
@ PT_COORD
Coordinate expressed in distance units (mm/inch)
PCB_REFERENCE_IMAGE_DESC()
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer
VECTOR2< int32_t > VECTOR2I