73 void SetBadges(
const std::vector<CONSTRAINT_BADGE>& aBadges,
const KIID& aSelected )
96 wxString
GetClass()
const override {
return wxT(
"CONSTRAINT_BADGE_ITEM" ); }
99 void Show(
int, std::ostream& )
const override {}
108 BITMAP_BASE*
disc(
const KIGFX::COLOR4D& aColor )
const;
114 mutable std::map<PCB_CONSTRAINT_TYPE, std::unique_ptr<BITMAP_BASE>>
m_icons;
115 mutable std::map<uint32_t, std::unique_ptr<BITMAP_BASE>>
m_discs;
180 const std::optional<VECTOR2I>& aAnchor );
204 static std::vector<VECTOR2D>
LayoutBadges(
const std::vector<CONSTRAINT_BADGE>& aBadges,
205 double aWorldPerPx );
This class handle bitmap images in KiCad.
Information pertinent to a Pcbnew printed circuit board.
constexpr void SetMaximum()
Draws the constraint type-glyph badges at a constant on-screen size, like the edit handles.
std::optional< VECTOR2I > m_previewAnchor
std::vector< CONSTRAINT_BADGE > m_badges
void ViewDraw(int aLayer, KIGFX::VIEW *aView) const override
Draw the parts of the object belonging to layer aLayer.
bool HitTest(const VECTOR2I &, int=0) const override
Test if aPosition is inside or on the boundary of this item.
std::map< uint32_t, std::unique_ptr< BITMAP_BASE > > m_discs
BITMAP_BASE * disc(const KIGFX::COLOR4D &aColor) const
A filled disc of the given colour, built and cached on first use.
~CONSTRAINT_BADGE_ITEM() override
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
std::map< PCB_CONSTRAINT_TYPE, std::unique_ptr< BITMAP_BASE > > m_icons
std::vector< VECTOR2D > m_layout
BITMAP_BASE * icon(PCB_CONSTRAINT_TYPE aType) const
The badge icon for a constraint type, loaded and cached on first use (nullptr for UNDEFINED).
void SetBadges(const std::vector< CONSTRAINT_BADGE > &aBadges, const KIID &aSelected)
void SetPreviewAnchor(const std::optional< VECTOR2I > &aAnchor)
Pick preview anchor drawn at constant on screen size like edit handles nullopt draws none.
wxString GetClass() const override
Return the class name.
static double BadgeHitRadius()
Click hit radius in screen pixels.
bool SetPickPreview(const KIID &aElement, bool aWholeElement, const std::optional< VECTOR2I > &aAnchor)
Preview next constraint pick target while authoring a point based constraint aElement is shape or dim...
bool SetVisibilityMode(OVERLAY_MODE aMode)
Set the visibility mode (HOVER vs ALWAYS). Returns true if it changed.
void RefreshSelection()
Redraw from the last diagnosis without re-solving (for a selection-only change).
bool SetIsolated(const KIID &aConstraint)
Show only this constraint, or niluuid to show all. Returns true if it changed.
CONSTRAINT_OVERLAY(BOARD *aBoard, KIGFX::VIEW *aView)
CONSTRAINT_BADGE_ITEM m_badgeItem
~CONSTRAINT_OVERLAY() override
const std::vector< CONSTRAINT_BADGE > & Badges() const
Badges placed by the last Update(), for canvas hit-testing.
void ClearPickPreview()
Drop any pick preview.
BOARD_CONSTRAINT_DIAGNOSTICS m_lastDiag
std::vector< CONSTRAINT_BADGE > m_badges
std::optional< VECTOR2I > m_previewAnchor
static double BadgeWorldPerPixel(double aWorldScale)
World units per screen pixel for badge sizing, capped at far zoom-out.
void render()
Redraw the tint and badges from m_lastDiag (no re-solve).
void Clear()
Hide the overlay.
static VECTOR2D BadgeScreenOffset()
Screen-pixel offset from a badge's anchor to where its glyph draws and hit-tests, keeping the glyph c...
bool SetSelected(const KIID &aConstraint)
Mark a constraint as selected so its badge draws enlarged and ringed; pass niluuid to clear.
const KIID & GetHoverShape() const
bool SetHoverShape(const KIID &aShape)
In HOVER mode, show only this shape's constraints; niluuid draws nothing.
const KIID & GetIsolated() const
OVERLAY_MODE GetVisibilityMode() const
static std::vector< VECTOR2D > LayoutBadges(const std::vector< CONSTRAINT_BADGE > &aBadges, double aWorldPerPx)
The on-screen draw position (world units) of each badge at the given scale: the anchor offset by Badg...
void Update(const BOARD_CONSTRAINT_DIAGNOSTICS &aDiag)
Redraw the tint and badges from aDiag (the caller owns the one board-wide solve).
const KIID & GetSelected() const
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
A color representation with 4 components: red, green, blue, alpha.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
VIEW_OVERLAY_HOLDER(KIGFX::VIEW *aView)
OVERLAY_MODE
Draws the geometric-constraint diagnostics tint onto a GAL overlay (issue #2329): every constrained s...
@ LAYER_GP_OVERLAY
General purpose overlay.
The Cairo implementation of the graphics abstraction layer.
PCB_CONSTRAINT_TYPE
The geometric relationship a PCB_CONSTRAINT enforces between its members.
Board-wide diagnostics for the constraint overlay and info bar.
An on-canvas constraint badge.
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D