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, GR_DRAWMODE aDrawMode,
12  const wxPoint& aOffset )
13 {
14  // Build the marker shape polygon in internal units:
15  const int ccount = GetShapePolygonCornerCount();
16  std::vector<wxPoint> shape;
17  shape.reserve( ccount );
18 
19  for( int ii = 0; ii < ccount; ii++ )
20  shape.push_back( wxPoint( GetShapePolygonCorner( ii ).x * MarkerScale(),
21  GetShapePolygonCorner( ii ).y * MarkerScale() ) );
22 
23  GRSetDrawMode( aDC, aDrawMode );
24 
25  for( int ii = 0; ii < ccount; ii++ )
26  {
27  shape[ii] += m_Pos + aOffset;
28  }
29 
30  GRClosedPoly( aPanel->GetClipBox(), aDC, ccount, &shape[0],
31  true, // = Filled
32  0, // outline width
33  m_Color, // outline color
34  m_Color // fill collor
35  );
36 
37 #if 0 // For testing purpose only:
39  GRRect( aPanel->GetClipBox(), aDC, bbox, 10, m_Color );
40 #endif
41 }
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:223
EDA_RECT GetBoundingBoxMarker() const
Function GetBoundingBoxMarker returns the orthogonal, bounding box of this object for display purpose...
wxPoint m_Pos
position of the marker
Definition: marker_base.h:54
int GetShapePolygonCornerCount() const
virtual EDA_RECT * GetClipBox()
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, 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.
void GRRect(EDA_RECT *aClipBox, wxDC *aDC, int x1, int y1, int x2, int y2, COLOR4D aColor)
Definition: gr_basic.cpp:1003
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:37
COLOR4D m_Color
color
Definition: marker_base.h:61
const VECTOR2I & GetShapePolygonCorner(int aIdx) const
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
The common library.
BASE_SCREEN class implementation.