24#include <api/board/board_types.pb.h>
46 m_symbolSize = board->GetDesignSettings().GetDrillSymbolProfile().GetSymbolSize();
105 box = board->DrillSymbolCache()->m_HoleExtent;
107 box.
Merge( board->GetBoardEdgesBoundingBox() );
123 return std::make_shared<const SHAPE_POLY_SET>();
130 std::shared_ptr<SHAPE_POLY_SET> rebuilt = std::make_shared<SHAPE_POLY_SET>();
132 if(
const_cast<BOARD*
>( board )->GetBoardPolygonOutlines( *rebuilt,
false ) )
135 rebuilt->RemoveAllContours();
169 const std::shared_ptr<const DRILL_SYMBOL_CACHE> cache = board->
DrillSymbolCache();
171 for(
const auto& [itemId, entries] : cache->m_ByItem )
178 if(
std::abs( entry.m_Position.x - where.
x ) <= reach
179 &&
std::abs( entry.m_Position.y - where.
y ) <= reach )
214 return wxString::Format(
_(
"Drill Map on %s" ),
GetLayerName() );
220 aList.emplace_back(
_(
"Drill Map" ), wxEmptyString );
222 aList.emplace_back(
_(
"Spans" ),
m_allSpans ?
_(
"All" ) :
_(
"Single" ) );
228 wxCHECK_RET( aImage && aImage->
Type() ==
Type(), wxT(
"Cannot swap data with invalid map." ) );
274 map.mutable_id()->set_value(
m_Uuid.AsStdString() );
277 map.set_locked(
IsLocked() ? kiapi::common::types::LockedState::LS_LOCKED
278 : kiapi::common::types::LockedState::LS_UNLOCKED );
282 types::DrillSpan* span = map.mutable_span();
285 span->set_is_backdrill(
m_span.m_IsBackdrill );
286 span->set_is_non_plated(
m_span.m_IsNonPlatedFile );
292 aContainer.PackFrom( map );
301 if( !aContainer.UnpackTo( &map ) )
318 SetLocked( map.locked() == kiapi::common::types::LockedState::LS_LOCKED );
326 map.span().is_backdrill(), map.span().is_non_plated() );
332 if( map.has_symbol_size() && map.symbol_size().value_nm() > 0 )
345 const auto it = std::find( spans.begin(), spans.end(),
m_span );
348 if( it == spans.end() )
351 return static_cast<int>( it - spans.begin() );
365 if( aIndex >=
static_cast<int>( spans.size() ) )
386 const wxString mapProps =
_(
"Drill Map Properties" );
KICOMMON_API types::KiCadObjectType ToProtoEnum(KICAD_T aValue)
KICOMMON_API KICAD_T FromProtoEnum(types::KiCadObjectType aValue)
DRILL_SYMBOL_PROFILE & GetDrillSymbolProfile()
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.
wxString GetLayerName() const
Return the name of the PCB layer on which the item resides.
Information pertinent to a Pcbnew printed circuit board.
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayer) const
std::shared_ptr< const DRILL_SYMBOL_CACHE > DrillSymbolCache() const
Resolved drill symbols, by group and by owning item.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
uint64_t GetBoardOutlineGeneration() const
Bumped by every UpdateBoardOutline(), so anything deriving geometry from the edge cuts can tell wheth...
const DRAWINGS & Drawings() const
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
constexpr bool Contains(const Vec &aPoint) const
constexpr void Move(const Vec &aMoveVector)
Move the rectangle by the aMoveVector.
constexpr bool Intersects(const BOX2< Vec > &aRect) const
Grouping rules and symbol assignments, shared by reference so a chart and its map can never disagree ...
int GetSymbolWidth() const
The base class for create windows for drawing purpose.
KICAD_T Type() const
Returns the type of object.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Turns on drill symbols at the holes, for one layer.
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
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< const SHAPE_POLY_SET > m_outlineCache
void SetSpanChoice(int aIndex)
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
VECTOR2I m_outlineCacheOffset
std::mutex m_outlineCacheMutex
int GetSymbolSize() const
bool GetGuideCross() const
void SetGuideCross(bool aOn)
void SetSymbolSize(int aSize)
VECTOR2I GetPosition() const override
The map has no place of its own.
void swapData(BOARD_ITEM *aImage) override
uint64_t m_outlineCacheGeneration
bool GetOutlineSlots() const
void SetOutlineSlots(bool aOn)
bool operator==(const BOARD_ITEM &aOther) const override
int GetSymbolExtent() const
void Rotate(const VECTOR2I &aCentre, const EDA_ANGLE &aAngle) override
Configuration operations, deliberately not geometry transforms.
std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
std::shared_ptr< const SHAPE_POLY_SET > GetBoardOutlines() const
The board outline displaced by this map's offset.
double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
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.
PCB_DRILL_MAP(BOARD_ITEM *aParent)
void SetPosition(const VECTOR2I &aPos) override
int GetSpanChoice() const
The span as an index into the board's spans, with -1 for every span.
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.
void Mask(TYPE_ID aDerived, TYPE_ID aBase, const wxString &aName)
Sets a base class property as masked in a derived class.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
bool PointOnEdge(const VECTOR2I &aP, int aAccuracy=0) const
Check if point aP lies on an edge or vertex of some of the outlines or holes.
std::vector< DRILL_SPAN > EnumerateDrillSpans(const BOARD &aBoard)
Every drill span present on the board, through-holes first.
LSET DrillDocumentationLayers()
Layers a chart or map may live on.
Some functions to handle hotkeys in KiCad.
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
PCB_LAYER_ID
A quick note on layer IDs:
Message panel definition file.
@ REPAINT
Item needs to be redrawn.
@ GEOMETRY
Position or shape has changed.
KICOMMON_API int UnpackDistance(const types::Distance &aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API VECTOR2I UnpackVector2(const types::Vector2 &aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API void PackDistance(types::Distance &aOutput, int aInput, const EDA_IU_SCALE &aScale)
KICOMMON_API void PackVector2(types::Vector2 &aOutput, const VECTOR2I &aInput, const EDA_IU_SCALE &aScale)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
static struct PCB_DRILL_MAP_DESC _PCB_DRILL_MAP_DESC
void RefreshDrillMapOutlines(const BOARD &aBoard, KIGFX::VIEW *aView)
Repaint every drill map after an Edge.Cuts edit.
@ PT_COORD
Coordinate expressed in distance units (mm/inch)
@ PT_SIZE
Size expressed in distance units (mm/inch)
One drawable mark, with the geometry the renderer needs to place it.
@ PCB_DRILL_MAP_T
class PCB_DRILL_MAP, drill symbols drawn at the holes
VECTOR2< int32_t > VECTOR2I