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 <collectors.h>
#include <pcb_edit_frame.h>
#include <drawing_sheet/ds_proxy_view_item.h>
#include <kiway.h>
#include <array_creator.h>
#include <pcbnew_settings.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 wxPoint mirrorPointX (const wxPoint &aPoint, const wxPoint &aMirrorPoint)
 Mirror a point about the vertical axis passing through another point. More...
 
static void mirrorPadX (PAD &aPad, const wxPoint &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 wxPoint &  aMirrorPoint 
)
static

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

Definition at line 1568 of file edit_tool.cpp.

1569 {
1570  if( aPad.GetShape() == PAD_SHAPE::CUSTOM )
1571  aPad.FlipPrimitives( true ); // mirror primitives left to right
1572 
1573  wxPoint tmpPt = mirrorPointX( aPad.GetPosition(), aMirrorPoint );
1574  aPad.SetPosition( tmpPt );
1575 
1576  aPad.SetX0( aPad.GetPosition().x );
1577 
1578  tmpPt = aPad.GetOffset();
1579  tmpPt.x = -tmpPt.x;
1580  aPad.SetOffset( tmpPt );
1581 
1582  auto tmpz = aPad.GetDelta();
1583  tmpz.x = -tmpz.x;
1584  aPad.SetDelta( tmpz );
1585 
1586  aPad.SetOrientation( -aPad.GetOrientation() );
1587 }
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:656
void SetOffset(const wxPoint &aOffset)
Definition: pad.h:249
void SetDelta(const wxSize &aSize)
Definition: pad.h:239
const wxPoint & GetOffset() const
Definition: pad.h:250
double GetOrientation() const
Return the rotation angle of the pad in a variety of units (the basic call returns tenths of degrees)...
Definition: pad.h:349
PAD_SHAPE GetShape() const
Definition: pad.h:170
void SetX0(int x)
Definition: pad.h:230
const wxSize & GetDelta() const
Definition: pad.h:240
wxPoint GetPosition() const override
Definition: pad.h:178
void SetPosition(const wxPoint &aPos) override
Definition: pad.h:172
static wxPoint mirrorPointX(const wxPoint &aPoint, const wxPoint &aMirrorPoint)
Mirror a point about the vertical axis passing through another point.
Definition: edit_tool.cpp:1553
void SetOrientation(double aAngle)
Set the rotation angle of the pad.
Definition: pad.cpp:589

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

Referenced by EDIT_TOOL::Mirror().

◆ mirrorPointX()

static wxPoint mirrorPointX ( const wxPoint &  aPoint,
const wxPoint &  aMirrorPoint 
)
static

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

Definition at line 1553 of file edit_tool.cpp.

1554 {
1555  wxPoint mirrored = aPoint;
1556 
1557  mirrored.x -= aMirrorPoint.x;
1558  mirrored.x = -mirrored.x;
1559  mirrored.x += aMirrorPoint.x;
1560 
1561  return mirrored;
1562 }

Referenced by mirrorPadX().