KiCad PCB EDA Suite
muonde.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 <wxPcbStruct.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 <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 muonde.cpp.

Enumeration Type Documentation

enum id_mw_cmd
Enumerator
ID_READ_SHAPE_FILE 

Definition at line 389 of file muonde.cpp.

389  {
390  ID_READ_SHAPE_FILE = 1000
391 };

Function Documentation

void Exit_Self ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC 
)
static

Definition at line 129 of file muonde.cpp.

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

Referenced by PCB_EDIT_FRAME::Begin_Self().

130 {
131  if( aPanel->IsMouseCaptured() )
132  aPanel->CallMouseCapture( aDC, wxDefaultPosition, false );
133 
134  s_inductorInProgress = false;
135  aPanel->SetMouseCapture( NULL, NULL );
136 }
bool IsMouseCaptured() const
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: muonde.cpp:73
void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
static void ShowBoundingBoxMicroWaveInductor ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
const wxPoint aPosition,
bool  aErase 
)
static

Definition at line 79 of file muonde.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().

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

bool s_inductorInProgress = false
static

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

Definition at line 73 of file muonde.cpp.

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

double ShapeScaleX
static
double ShapeScaleY
static