26#include <api/board/board_types.pb.h>
79 m_libPos = fp->GetTransform().InverseApply( aPos );
124 const int size =
GetSize() / 2;
126 const SEG loc =
SEG( aPosition, aPosition );
132 bool hit = seg1.
Collide( loc, aAccuracy ) || seg2.Collide( loc, aAccuracy ) ||
circle.Collide( loc, aAccuracy );
148 std::vector<int> layers = {
186 const VECTOR2I libAxis = fp->GetTransform().InverseApply( aCentre );
193 MIRROR( newPos, aCentre, aFlipDirection );
234 *
this = *
static_cast<const PCB_POINT*
>( aOther );
248 kiapi::board::types::ReferencePoint point;
250 point.mutable_id()->set_value(
m_Uuid.AsStdString() );
253 point.mutable_size()->set_value_nm(
m_size );
254 point.set_locked(
IsLocked() ? kiapi::common::types::LockedState::LS_LOCKED
255 : kiapi::common::types::LockedState::LS_UNLOCKED );
258 point.mutable_parent()->set_value( parent->m_Uuid.AsStdString() );
260 point.mutable_parent()->set_value( board->m_Uuid.AsStdString() );
263 aContainer.PackFrom( point );
269 kiapi::board::types::ReferencePoint point;
271 if( !aContainer.UnpackTo( &point ) )
277 SetSize( point.size().value_nm() );
278 SetLocked( point.locked() == kiapi::common::types::LockedState::LS_LOCKED );
287 aList.emplace_back(
_(
"PCB Point" ), wxEmptyString );
297 int aClearance,
int aError,
ERROR_LOC aErrorLoc,
298 bool ignoreLineWidth )
const
310 return *
this == other;
327 double similarity = 1.0;
KICOMMON_API types::KiCadObjectType ToProtoEnum(KICAD_T aValue)
KICOMMON_API KICAD_T FromProtoEnum(types::KiCadObjectType aValue)
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
constexpr EDA_IU_SCALE pcbIUScale
BITMAPS
A list of all bitmap identifiers.
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
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
static constexpr BOX2< VECTOR2I > ByCenter(const VECTOR2I &aCenter, const SizeVec &aSize)
The base class for create windows for drawing purpose.
KICAD_T Type() const
Returns the type of object.
virtual void SetParent(EDA_ITEM *aParent)
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
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.
A PCB_POINT is a 0-dimensional point that is used to mark a position on a PCB, or more usually a foot...
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Convert the shape to a closed polygon.
PCB_POINT(BOARD_ITEM *aParent)
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.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
bool operator==(const PCB_POINT &aOther) const
void recomputePosition()
Recompute the cached board position from the library position and parent transform.
void SetParent(EDA_ITEM *aParent) override
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
void SetPosition(const VECTOR2I &aPos) override
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
virtual void swapData(BOARD_ITEM *aImage) override
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.
void SetSize(const int aSize)
void OnFootprintTransformed() override
Refresh the cached board position after the parent footprint's transform changed.
double Similarity(const BOARD_ITEM &aBoardItem) const override
Return a measure of how likely the other object is to represent the same object.
void CopyFrom(const BOARD_ITEM *aOther) override
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.
VECTOR2I GetPosition() const override
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.
bool Collide(const SEG &aSeg, int aClearance, int *aActual=nullptr) const
Represent a set of closed polygons.
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)
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
#define POINT_LAYER_FOR(boardLayer)
@ LAYER_POINTS
PCB reference/manual snap points visibility.
@ LAYER_LOCKED_ITEM_SHADOW
Shadow layer for locked items.
PCB_LAYER_ID
A quick note on layer IDs:
constexpr void MIRROR(T &aPoint, const T &aMirrorRef)
Updates aPoint with the mirror of aPoint relative to the aMirrorRef.
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 const double DEFAULT_PT_SIZE_MM
static struct PCB_POINT_DESC _PCB_POINT_DESC
@ PT_SIZE
Size expressed in distance units (mm/inch)
bool operator()(const PCB_POINT *a, const PCB_POINT *b) const
SHAPE_CIRCLE circle(c.m_circle_center, c.m_circle_radius)
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_POINT_T
class PCB_POINT, a 0-dimensional point
VECTOR2< int32_t > VECTOR2I