KiCad PCB EDA Suite
microwave.cpp File Reference

Microwave pcb layout code. More...

#include <fctsys.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <trigo.h>
#include <kicad_string.h>
#include <gestfich.h>
#include <pcb_edit_frame.h>
#include <dialog_helpers.h>
#include <richio.h>
#include <filter_reader.h>
#include <gr_basic.h>
#include <macros.h>
#include <base_units.h>
#include <validators.h>
#include <dialog_text_entry.h>
#include <class_board.h>
#include <class_module.h>
#include <class_edge_mod.h>
#include <microwave/microwave_inductor.h>
#include <pcbnew.h>

Go to the source code of this file.

Classes

class  MWAVE_POLYGONAL_SHAPE_DLG
 

Enumerations

enum  id_mw_cmd { ID_READ_SHAPE_FILE = 1000 }
 

Functions

static void Exit_Self (EDA_DRAW_PANEL *aPanel, wxDC *aDC)
 
static void ShowBoundingBoxMicroWaveInductor (EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
 

Variables

static std::vector< wxRealPoint > PolyEdges
 
static double ShapeScaleX
 
static double ShapeScaleY
 
static wxSize ShapeSize
 
static int PolyShapeType
 
static MWAVE::INDUCTOR_PATTERN s_inductor_pattern
 

An inductor pattern temporarily used during mu-wave inductor creation

More...
 
static bool s_inductorInProgress = false
 

A flag set to true when mu-wave inductor is being created

More...
 

Detailed Description

Microwave pcb layout code.

Definition in file microwave.cpp.

Enumeration Type Documentation

enum id_mw_cmd
Enumerator
ID_READ_SHAPE_FILE 

Definition at line 386 of file microwave.cpp.

386  {
387  ID_READ_SHAPE_FILE = 1000
388 };

Function Documentation

void Exit_Self ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC 
)
static

Definition at line 130 of file microwave.cpp.

References EDA_DRAW_PANEL::CallMouseCapture(), EDA_DRAW_PANEL::IsMouseCaptured(), s_inductorInProgress, and EDA_DRAW_PANEL::SetMouseCapture().

Referenced by PCB_EDIT_FRAME::Begin_Self().

131 {
132  if( aPanel->IsMouseCaptured() )
133  aPanel->CallMouseCapture( aDC, wxDefaultPosition, false );
134 
135  s_inductorInProgress = false;
136  aPanel->SetMouseCapture( NULL, NULL );
137 }
virtual void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
virtual void CallMouseCapture(wxDC *aDC, const wxPoint &aPosition, bool aErase)
Function CallMouseCapture calls the mouse capture callback.
static bool s_inductorInProgress
A flag set to true when mu-wave inductor is being created
Definition: microwave.cpp:74
static void ShowBoundingBoxMicroWaveInductor ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
const wxPoint aPosition,
bool  aErase 
)
static

Definition at line 80 of file microwave.cpp.

References PNS::angle(), ArcTangente(), EuclideanNorm(), EDA_DRAW_PANEL::GetClipBox(), EDA_DRAW_FRAME::GetCrossHairPosition(), EDA_DRAW_PANEL::GetParent(), GR_XOR, GRPoly(), GRSetDrawMode(), KiROUND(), MWAVE::INDUCTOR_PATTERN::m_End, MWAVE::INDUCTOR_PATTERN::m_Start, RotatePoint(), wxPoint::x, wxPoint::y, and YELLOW.

Referenced by PCB_EDIT_FRAME::Begin_Self().

82 {
83  /* Calculate the orientation and size of the box containing the inductor:
84  * the box is a rectangle with height = length/2
85  * the shape is defined by a rectangle, nor necessary horizontal or vertical
86  */
87  GRSetDrawMode( aDC, GR_XOR );
88 
89  wxPoint poly[5];
91  double angle = -ArcTangente( pt.y, pt.x );
92  int len = KiROUND( EuclideanNorm( pt ) );
93 
94  // calculate corners
95  pt.x = 0; pt.y = len / 4;
96  RotatePoint( &pt, angle );
97  poly[0] = s_inductor_pattern.m_Start + pt;
98  poly[1] = s_inductor_pattern.m_End + pt;
99  pt.x = 0; pt.y = -len / 4;
100  RotatePoint( &pt, angle );
101  poly[2] = s_inductor_pattern.m_End + pt;
102  poly[3] = s_inductor_pattern.m_Start + pt;
103  poly[4] = poly[0];
104 
105  if( aErase )
106  {
107  GRPoly( aPanel->GetClipBox(), aDC, 5, poly, false, 0, YELLOW, YELLOW );
108  }
109 
112  angle = -ArcTangente( pt.y, pt.x );
113  len = KiROUND( EuclideanNorm( pt ) );
114 
115  // calculate new corners
116  pt.x = 0; pt.y = len / 4;
117  RotatePoint( &pt, angle );
118  poly[0] = s_inductor_pattern.m_Start + pt;
119  poly[1] = s_inductor_pattern.m_End + pt;
120  pt.x = 0; pt.y = -len / 4;
121  RotatePoint( &pt, angle );
122  poly[2] = s_inductor_pattern.m_End + pt;
123  poly[3] = s_inductor_pattern.m_Start + pt;
124  poly[4] = poly[0];
125 
126  GRPoly( aPanel->GetClipBox(), aDC, 5, poly, false, 0, YELLOW, YELLOW );
127 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:112
void GRPoly(EDA_RECT *ClipBox, wxDC *DC, int n, wxPoint Points[], bool Fill, int width, COLOR4D Color, COLOR4D BgColor)
Definition: gr_basic.cpp:701
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:223
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:120
virtual EDA_RECT * GetClipBox()
void RotatePoint(int *pX, int *pY, double angle)
Definition: trigo.cpp:216
virtual EDA_DRAW_FRAME * GetParent() const =0
double ArcTangente(int dy, int dx)
Definition: trigo.cpp:170
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
static MWAVE::INDUCTOR_PATTERN s_inductor_pattern
An inductor pattern temporarily used during mu-wave inductor creation
Definition: microwave.cpp:71
Definition: colors.h:68
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.

Variable Documentation

int PolyShapeType
static
MWAVE::INDUCTOR_PATTERN s_inductor_pattern
static

An inductor pattern temporarily used during mu-wave inductor creation

Definition at line 71 of file microwave.cpp.

bool s_inductorInProgress = false
static

A flag set to true when mu-wave inductor is being created

Definition at line 74 of file microwave.cpp.

Referenced by PCB_EDIT_FRAME::Begin_Self(), and Exit_Self().

double ShapeScaleX
static
double ShapeScaleY
static