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.

Classes

class  GAL_ARRAY_CREATOR
 

Functions

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 
)
static

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

Definition at line 540 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().

541 {
542  wxPoint tmpPt = mirrorPointX( aPad.GetPosition(), aMirrorPoint );
543 
544  aPad.SetPosition( tmpPt );
545 
546  aPad.SetX0( aPad.GetPosition().x );
547 
548  tmpPt = aPad.GetOffset();
549  tmpPt.x = -tmpPt.x;
550  aPad.SetOffset( tmpPt );
551 
552  auto tmpz = aPad.GetDelta();
553  tmpz.x = -tmpz.x;
554  aPad.SetDelta( tmpz );
555 
556  aPad.SetOrientation( -aPad.GetOrientation() );
557 }
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:525
void SetOrientation(double aAngle)
Function SetOrientation sets the rotation angle of the pad.
Definition: class_pad.cpp:306
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 
)
static

Mirror a point about the vertical axis passing through another point

Definition at line 525 of file edit_tool.cpp.

References wxPoint::x.

Referenced by mirrorPadX().

526 {
527  wxPoint mirrored = aPoint;
528 
529  mirrored.x -= aMirrorPoint.x;
530  mirrored.x = -mirrored.x;
531  mirrored.x += aMirrorPoint.x;
532 
533  return mirrored;
534 }