KiCad PCB EDA Suite
edit_tool.cpp File Reference
#include <advanced_config.h>
#include <limits>
#include <board.h>
#include <board_design_settings.h>
#include <footprint.h>
#include <fp_shape.h>
#include <fp_textbox.h>
#include <collectors.h>
#include <convert_to_biu.h>
#include <pcb_edit_frame.h>
#include <drawing_sheet/ds_proxy_view_item.h>
#include <kiway.h>
#include <array_creator.h>
#include <status_popup.h>
#include <tool/selection_conditions.h>
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <tools/pcb_selection_tool.h>
#include <tools/edit_tool.h>
#include <tools/pcb_picker_tool.h>
#include <tools/tool_event_utils.h>
#include <tools/pcb_grid_helper.h>
#include <tools/pad_tool.h>
#include <view/view_controls.h>
#include <connectivity/connectivity_algo.h>
#include <connectivity/connectivity_items.h>
#include <bitmaps.h>
#include <cassert>
#include <functional>
#include "kicad_clipboard.h"
#include <wx/hyperlink.h>
#include <router/router_tool.h>
#include <dialogs/dialog_move_exact.h>
#include <dialogs/dialog_track_via_properties.h>
#include <dialogs/dialog_unit_entry.h>
#include <board_commit.h>
#include <pcb_group.h>
#include <pcb_target.h>
#include <zone_filler.h>

Go to the source code of this file.

Functions

static VECTOR2I mirrorPointX (const VECTOR2I &aPoint, const VECTOR2I &aMirrorPoint)
 Mirror a point about the vertical axis passing through another point. More...
 
static void mirrorPadX (PAD &aPad, const VECTOR2I &aMirrorPoint)
 Mirror a pad in the vertical axis passing through a point (mirror left to right). More...
 

Function Documentation

◆ mirrorPadX()

static void mirrorPadX ( PAD aPad,
const VECTOR2I aMirrorPoint 
)
static

Mirror a pad in the vertical axis passing through a point (mirror left to right).

Definition at line 1153 of file edit_tool.cpp.

1154{
1155 if( aPad.GetShape() == PAD_SHAPE::CUSTOM )
1156 aPad.FlipPrimitives( true ); // mirror primitives left to right
1157
1158 VECTOR2I tmpPt = mirrorPointX( aPad.GetPosition(), aMirrorPoint );
1159 aPad.SetPosition( tmpPt );
1160
1161 aPad.SetX0( aPad.GetPosition().x );
1162
1163 tmpPt = aPad.GetOffset();
1164 tmpPt.x = -tmpPt.x;
1165 aPad.SetOffset( tmpPt );
1166
1167 auto tmpz = aPad.GetDelta();
1168 tmpz.x = -tmpz.x;
1169 aPad.SetDelta( tmpz );
1170
1171 aPad.SetOrientation( -aPad.GetOrientation() );
1172}
void SetX0(int x)
Definition: pad.h:237
void FlipPrimitives(bool aFlipLeftRight)
Flip (mirror) the primitives left to right or top to bottom, around the anchor position in custom pad...
Definition: pad.cpp:701
VECTOR2I GetPosition() const override
Definition: pad.h:185
void SetOffset(const VECTOR2I &aOffset)
Definition: pad.h:256
const VECTOR2I & GetOffset() const
Definition: pad.h:257
void SetDelta(const VECTOR2I &aSize)
Definition: pad.h:246
void SetPosition(const VECTOR2I &aPos) override
Definition: pad.h:179
const VECTOR2I & GetDelta() const
Definition: pad.h:247
PAD_SHAPE GetShape() const
Definition: pad.h:177
EDA_ANGLE GetOrientation() const
Return the rotation angle of the pad.
Definition: pad.h:348
void SetOrientation(const EDA_ANGLE &aAngle)
Set the rotation angle of the pad.
Definition: pad.cpp:634
static VECTOR2I mirrorPointX(const VECTOR2I &aPoint, const VECTOR2I &aMirrorPoint)
Mirror a point about the vertical axis passing through another point.
Definition: edit_tool.cpp:1138

References CUSTOM, PAD::FlipPrimitives(), PAD::GetDelta(), PAD::GetOffset(), PAD::GetOrientation(), PAD::GetPosition(), PAD::GetShape(), mirrorPointX(), PAD::SetDelta(), PAD::SetOffset(), PAD::SetOrientation(), PAD::SetPosition(), PAD::SetX0(), and VECTOR2< T >::x.

Referenced by EDIT_TOOL::Mirror().

◆ mirrorPointX()

static VECTOR2I mirrorPointX ( const VECTOR2I aPoint,
const VECTOR2I aMirrorPoint 
)
static

Mirror a point about the vertical axis passing through another point.

Definition at line 1138 of file edit_tool.cpp.

1139{
1140 VECTOR2I mirrored = aPoint;
1141
1142 mirrored.x -= aMirrorPoint.x;
1143 mirrored.x = -mirrored.x;
1144 mirrored.x += aMirrorPoint.x;
1145
1146 return mirrored;
1147}

References VECTOR2< T >::x.

Referenced by mirrorPadX().