KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_grid_item.cpp File Reference
#include <api/api_enums.h>
#include <api/api_utils.h>
#include <api/board/board_types.pb.h>
#include <bitmaps.h>
#include <board.h>
#include <board_design_settings.h>
#include <pcb_grid_item.h>
#include <base_units.h>
#include <settings/color_settings.h>
#include <settings/settings_manager.h>
#include <trigo.h>
#include <view/view.h>
#include <i18n_utility.h>
#include <geometry/shape_circle.h>
#include <geometry/shape_line_chain.h>
#include <geometry/geometry_utils.h>
#include <eda_draw_frame.h>
#include <pcb_shape.h>
#include <geometry/shape_null.h>
#include <properties/property_mgr.h>
#include <properties/property.h>
#include <google/protobuf/any.pb.h>

Go to the source code of this file.

Classes

struct  PCB_GRIDITEM_DESC
 

Functions

PCB_GRID_ITEMFindActiveGridAt (const BOARD &aBoard, const VECTOR2I &aPos, PCB_GRID_ROLE aRole)
 Pick the grid item active for aRole at aPos.
 
EDA_ANGLE GridFrameAngleAt (const BOARD &aBoard, const VECTOR2I &aPos, PCB_GRID_ROLE aRole)
 World frame angle of the grid active for aRole at aPos; ANGLE_0 when no grid applies.
 
EDA_ANGLE GridFrameRotationDelta (const EDA_ANGLE &aFrom, const EDA_ANGLE &aTo, const EDA_ANGLE &aRotationStep)
 Minimal rotation that re-aligns an item from frame angle aFrom to aTo, reduced modulo min( aRotationStep, 90° ) so step-aligned footprints stay step-aligned.
 
 ENUM_TO_WXANY (PCB_GRID_TYPE)
 

Variables

static struct PCB_GRIDITEM_DESC _PCB_GRIDITEM_DESC
 

Function Documentation

◆ ENUM_TO_WXANY()

ENUM_TO_WXANY ( PCB_GRID_TYPE )

◆ FindActiveGridAt()

PCB_GRID_ITEM * FindActiveGridAt ( const BOARD & aBoard,
const VECTOR2I & aPos,
PCB_GRID_ROLE aRole )

Pick the grid item active for aRole at aPos.

Priority-descending; smaller coverage area wins ties.

Returns
nullptr if no applicable grid covers aPos.

Definition at line 425 of file pcb_grid_item.cpp.

References CURSOR, BOARD::Drawings(), grid, PCB_GRID_ITEM_T, PLACEMENT, ROUTING, and GRID_GEOMETRY::TakesPrecedenceOver().

Referenced by PCB_GRID_HELPER::Align(), and GridFrameAngleAt().

◆ GridFrameAngleAt()

EDA_ANGLE GridFrameAngleAt ( const BOARD & aBoard,
const VECTOR2I & aPos,
PCB_GRID_ROLE aRole )

World frame angle of the grid active for aRole at aPos; ANGLE_0 when no grid applies.

Definition at line 469 of file pcb_grid_item.cpp.

References ANGLE_0, FindActiveGridAt(), and grid.

Referenced by EDIT_TOOL::doMoveSelection(), and BOARD_EDITOR_CONTROL::PlaceFootprint().

◆ GridFrameRotationDelta()

EDA_ANGLE GridFrameRotationDelta ( const EDA_ANGLE & aFrom,
const EDA_ANGLE & aTo,
const EDA_ANGLE & aRotationStep )

Minimal rotation that re-aligns an item from frame angle aFrom to aTo, reduced modulo min( aRotationStep, 90° ) so step-aligned footprints stay step-aligned.

Definition at line 478 of file pcb_grid_item.cpp.

References ANGLE_0, ANGLE_90, and EDA_ANGLE::Snapped().

Referenced by EDIT_TOOL::doMoveSelection(), and BOARD_EDITOR_CONTROL::PlaceFootprint().

Variable Documentation

◆ _PCB_GRIDITEM_DESC

struct PCB_GRIDITEM_DESC _PCB_GRIDITEM_DESC
static