KiCad PCB EDA Suite
edit_tool.cpp File Reference
#include <limits>
#include <class_board.h>
#include <class_module.h>
#include <class_edge_mod.h>
#include <class_zone.h>
#include <collectors.h>
#include <wxPcbStruct.h>
#include <kiway.h>
#include <class_draw_panel_gal.h>
#include <module_editor_frame.h>
#include <array_creator.h>
#include <pcbnew_id.h>
#include <tool/tool_manager.h>
#include <view/view_controls.h>
#include <view/view.h>
#include <gal/graphics_abstraction_layer.h>
#include <ratsnest_data.h>
#include <confirm.h>
#include <bitmaps.h>
#include <hotkeys.h>
#include <cassert>
#include <functional>
#include "pcb_actions.h"
#include "selection_tool.h"
#include "edit_tool.h"
#include "grid_helper.h"
#include <router/router_tool.h>
#include <dialogs/dialog_move_exact.h>
#include <dialogs/dialog_track_via_properties.h>
#include <dialogs/dialog_exchange_modules.h>
#include <tools/tool_event_utils.h>
#include <preview_items/ruler_item.h>
#include <board_commit.h>

Go to the source code of this file.




static wxPoint mirrorPointX (const wxPoint &aPoint, const wxPoint &aMirrorPoint)
static void mirrorPadX (D_PAD &aPad, const wxPoint &aMirrorPoint)
 Mirror a pad in the vertical axis passing through a point. More...

Function Documentation

static void mirrorPadX ( D_PAD aPad,
const wxPoint aMirrorPoint 

Mirror a pad in the vertical axis passing through a point.

Definition at line 543 of file edit_tool.cpp.

References D_PAD::GetDelta(), D_PAD::GetOffset(), D_PAD::GetOrientation(), D_PAD::GetPosition(), mirrorPointX(), D_PAD::SetDelta(), D_PAD::SetOffset(), D_PAD::SetOrientation(), D_PAD::SetPosition(), D_PAD::SetX0(), and wxPoint::x.

Referenced by EDIT_TOOL::Mirror().

544 {
545  wxPoint tmpPt = mirrorPointX( aPad.GetPosition(), aMirrorPoint );
547  aPad.SetPosition( tmpPt );
549  aPad.SetX0( aPad.GetPosition().x );
551  tmpPt = aPad.GetOffset();
552  tmpPt.x = -tmpPt.x;
553  aPad.SetOffset( tmpPt );
555  auto tmpz = aPad.GetDelta();
556  tmpz.x = -tmpz.x;
557  aPad.SetDelta( tmpz );
559  aPad.SetOrientation( -aPad.GetOrientation() );
560 }
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:169
const wxPoint & GetPosition() const override
Definition: class_pad.h:170
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees, but soon degrees.
Definition: class_pad.h:214
const wxSize & GetDelta() const
Definition: class_pad.h:185
static wxPoint mirrorPointX(const wxPoint &aPoint, const wxPoint &aMirrorPoint)
Definition: edit_tool.cpp:528
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:357
void SetX0(int x)
Definition: class_pad.h:179
void SetOffset(const wxPoint &aOffset)
Definition: class_pad.h:190
const wxPoint & GetOffset() const
Definition: class_pad.h:191
void SetDelta(const wxSize &aSize)
Definition: class_pad.h:184
static wxPoint mirrorPointX ( const wxPoint aPoint,
const wxPoint aMirrorPoint 

Mirror a point about the vertical axis passing through another point

Definition at line 528 of file edit_tool.cpp.

References wxPoint::x.

Referenced by mirrorPadX().

529 {
530  wxPoint mirrored = aPoint;
532  mirrored.x -= aMirrorPoint.x;
533  mirrored.x = -mirrored.x;
534  mirrored.x += aMirrorPoint.x;
536  return mirrored;
537 }