KiCad PCB EDA Suite
Loading...
Searching...
No Matches
symb_transforms_utils.cpp File Reference
#include "symb_transforms_utils.h"
#include <lib_symbol.h>
#include <sch_symbol.h>

Go to the source code of this file.

Classes

struct  ORIENT_MIRROR
 

Functions

void OrientAndMirrorSymbolItems (LIB_SYMBOL *aSymbol, int aOrientation)
 Rotate and/or mirror graphic objects of LIB_SYMBOL aSymbol according to aOrientMirror.
 
void RotateAndMirrorPin (SCH_PIN &aPin, int aOrientMirror)
 Rotate and/or mirror a SCH_PIN according to aOrientMirror.
 
SPIN_STYLE GetPinSpinStyle (const SCH_PIN &aPin, const SCH_SYMBOL &aSymbol)
 Get the spin style for a pin's label, taking into account the pin's orientation, as well as the given symbol's orientation.
 

Variables

static ORIENT_MIRROR symbols_orientations_list []
 

Function Documentation

◆ GetPinSpinStyle()

SPIN_STYLE GetPinSpinStyle ( const SCH_PIN aPin,
const SCH_SYMBOL aSymbol 
)

Get the spin style for a pin's label, taking into account the pin's orientation, as well as the given symbol's orientation.

For example, pin with PIN_RIGHT (i.e. a pin on the left side of a symbol, probably) and no symbol rotation/mirror will return SPIN_STYLE::LEFT.

Definition at line 111 of file symb_transforms_utils.cpp.

References SPIN_STYLE::BOTTOM, SCH_PIN::GetOrientation(), SCH_SYMBOL::GetOrientation(), SPIN_STYLE::LEFT, PIN_DOWN, PIN_LEFT, PIN_RIGHT, PIN_UP, SPIN_STYLE::RIGHT, SYM_MIRROR_X, SYM_MIRROR_Y, SYM_NORMAL, SYM_ORIENT_0, SYM_ORIENT_180, SYM_ORIENT_270, SYM_ORIENT_90, SYM_ROTATE_CLOCKWISE, SYM_ROTATE_COUNTERCLOCKWISE, and SPIN_STYLE::UP.

Referenced by SCH_SCREEN::GetLabelOrientationForPoint().

◆ OrientAndMirrorSymbolItems()

void OrientAndMirrorSymbolItems ( LIB_SYMBOL aLibSymbol,
int  aOrientation 
)

Rotate and/or mirror graphic objects of LIB_SYMBOL aSymbol according to aOrientMirror.

Parameters
aLibSymbolis the LIB_SYMBOL to modify
aOrientationis the orientation+mirror value like returned by SCH_SYMBOL::GetOrientation()

Definition at line 56 of file symb_transforms_utils.cpp.

References LIB_SYMBOL::GetDrawItems(), ORIENT_MIRROR::mirror_x, ORIENT_MIRROR::mirror_y, ORIENT_MIRROR::n_rots, and symbols_orientations_list.

Referenced by KIGFX::SCH_PAINTER::draw().

◆ RotateAndMirrorPin()

void RotateAndMirrorPin ( SCH_PIN aPin,
int  aOrientMirror 
)

Rotate and/or mirror a SCH_PIN according to aOrientMirror.

aOrientMirror is usually the orientation/mirror of the parent symbol. The modified pin orientation is the actual pin orientation/mirror when the parent symbol is drawn.

Parameters
aPinis the SCH_PIN to modify
aOrientationis the orientation+mirror value like returned by SCH_SYMBOL::GetOrientation()

Definition at line 88 of file symb_transforms_utils.cpp.

References ORIENT_MIRROR::mirror_x, ORIENT_MIRROR::mirror_y, SCH_PIN::MirrorHorizontallyPin(), SCH_PIN::MirrorVerticallyPin(), ORIENT_MIRROR::n_rots, SCH_PIN::RotatePin(), and symbols_orientations_list.

Referenced by EE_SELECTION_TOOL::Main().

Variable Documentation

◆ symbols_orientations_list

ORIENT_MIRROR symbols_orientations_list[]
static
Initial value:
=
{
{ SYM_ORIENT_0, 0, 0, 0 },
{ SYM_ORIENT_90, 1, 0, 0 },
{ SYM_ORIENT_180, 2, 0, 0 },
{ SYM_ORIENT_270, 3, 0, 0 },
{ SYM_MIRROR_X + SYM_ORIENT_0, 0, 1, 0 },
{ SYM_MIRROR_X + SYM_ORIENT_90, 1, 1, 0 },
{ SYM_MIRROR_Y, 0, 0, 1 },
{ SYM_MIRROR_X + SYM_ORIENT_270, 3, 1, 0 },
{ SYM_MIRROR_Y + SYM_ORIENT_0, 0, 0, 1 },
{ SYM_MIRROR_Y + SYM_ORIENT_90, 1, 0, 1 },
{ SYM_MIRROR_Y + SYM_ORIENT_180, 2, 0, 1 },
}
@ SYM_ORIENT_270
Definition: sch_symbol.h:83
@ SYM_MIRROR_Y
Definition: sch_symbol.h:85
@ SYM_ORIENT_180
Definition: sch_symbol.h:82
@ SYM_MIRROR_X
Definition: sch_symbol.h:84
@ SYM_ORIENT_90
Definition: sch_symbol.h:81
@ SYM_ORIENT_0
Definition: sch_symbol.h:80

Definition at line 39 of file symb_transforms_utils.cpp.

Referenced by OrientAndMirrorSymbolItems(), and RotateAndMirrorPin().