KiCad PCB EDA Suite
legacy_wx/other.cpp
Go to the documentation of this file.
1 #include "fctsys.h"
2 #include "gr_basic.h"
3 #include "base_screen.h"
4 #include "common.h"
5 #include "macros.h"
6 #include "class_drawpanel.h"
7 #include "marker_base.h"
9 
10 
11 static const wxPoint MarkerShapeCorners[] =
12 {
13  wxPoint( 0, 0 ),
14  wxPoint( 8, 1 ),
15  wxPoint( 4, 3 ),
16  wxPoint( 13, 8 ),
17  wxPoint( 9, 9 ),
18  wxPoint( 8, 13 ),
19  wxPoint( 3, 4 ),
20  wxPoint( 1, 8 )
21 };
22 const unsigned CORNERS_COUNT = DIM( MarkerShapeCorners );
23 
24 
25 
26 void MARKER_BASE::DrawMarker( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
27  const wxPoint& aOffset )
28 {
29  wxPoint corners[CORNERS_COUNT];
30 
31  GRSetDrawMode( aDC, aDrawMode );
32 
33  for( unsigned ii = 0; ii < CORNERS_COUNT; ii++ )
34  {
35  corners[ii] = MarkerShapeCorners[ii];
36  corners[ii].x *= m_ScalingFactor;
37  corners[ii].y *= m_ScalingFactor;
38  corners[ii] += m_Pos + aOffset;
39  }
40 
41  GRClosedPoly( aPanel->GetClipBox(), aDC, CORNERS_COUNT, corners,
42  true, // = Filled
43  0, // outline width
44  m_Color, // outline color
45  m_Color // fill collor
46  );
47 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:223
static const wxPoint MarkerShapeCorners[]
wxPoint m_Pos
position of the marker
Definition: marker_base.h:54
virtual EDA_RECT * GetClipBox()
void DrawMarker(EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset)
Function DrawMarker draws the shape is the polygon defined in m_Corners (array of wxPoints)...
void GRClosedPoly(EDA_RECT *ClipBox, wxDC *DC, int n, wxPoint Points[], bool Fill, COLOR4D Color, COLOR4D BgColor)
Function GRClosedPoly draws a closed polygon onto the drawing context aDC and optionally fills and/or...
Definition: gr_basic.cpp:711
This file contains miscellaneous commonly used macros and functions.
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:37
COLOR4D m_Color
color
Definition: marker_base.h:61
int m_ScalingFactor
Scaling factor for m_Size and m_Corners (can set the physical size)
Definition: marker_base.h:55
The common library.
BASE_SCREEN class implementation.
const unsigned CORNERS_COUNT