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 void MARKER_BASE::DrawMarker( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset )
12 {
13  // Build the marker shape polygon in internal units:
14  const int ccount = GetShapePolygonCornerCount();
15  std::vector<wxPoint> shape;
16  shape.reserve( ccount );
17 
18  for( int ii = 0; ii < ccount; ii++ )
19  {
20  shape.push_back( wxPoint( GetShapePolygonCorner( ii ).x * MarkerScale(),
21  GetShapePolygonCorner( ii ).y * MarkerScale() ) );
22  }
23 
24  for( int ii = 0; ii < ccount; ii++ )
25  {
26  shape[ii] += m_Pos + aOffset;
27  }
28 
29  GRClosedPoly( aPanel->GetClipBox(), aDC, ccount, &shape[0],
30  true, // = Filled
31  0, // outline width
32  m_Color, // outline color
33  m_Color // fill collor
34  );
35 }
int GetShapePolygonCornerCount() const
wxPoint m_Pos
position of the marker
Definition: marker_base.h:54
virtual EDA_RECT * GetClipBox()
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.
COLOR4D m_Color
color
Definition: marker_base.h:61
int MarkerScale() const
The scaling factor to convert polygonal shape coordinates to internal units.
Definition: marker_base.h:123
void DrawMarker(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset)
Function DrawMarker draws the shape is the polygon defined in m_Corners (array of wxPoints).
const VECTOR2I & GetShapePolygonCorner(int aIdx) const
The common library.
BASE_SCREEN class implementation.