Logo Search packages:      
Sourcecode: codeblocks version File versions  Download package

void wxPdfDocument::RegularPolygon ( double  x0,
double  y0,
double  r,
int  ns,
double  angle = 0,
bool  circle = false,
int  style = wxPDF_STYLE_DRAW,
int  circleStyle = wxPDF_STYLE_DRAW,
const wxPdfLineStyle circleLineStyle = wxPdfLineStyle(),
const wxPdfColour circleFillColor = wxPdfColour() 
) [virtual]

Draws a regular polygon.

Parameters:
x0,:Abscissa of Center point
y0,:Ordinate of Center point
r,:Radius of circumscribed circle
ns,:Number of sides
angle,:Orientation angle (anti-clockwise)
circle,:Flag whether to draw circumscribed circle or not
style,:Style of polygon (draw and/or fill)
circleStyle,:Style of circumscribed circle (draw and/or fill) (if draw)
circleLineStyle,:Line style for circumscribed circle. (if draw)
circleFillColor,:Fill color for circumscribed circle. (if draw fill circle)

Definition at line 1271 of file pdfgraphics.cpp.

References Circle(), GetFillColor(), GetLineStyle(), Polygon(), SetFillColor(), and SetLineStyle().

{
  if (ns < 3)
  {
    ns = 3;
  }
  if (circle)
  {
    wxPdfLineStyle saveStyle = GetLineStyle();
    SetLineStyle(circleLineStyle);
    wxPdfColour saveColor = GetFillColor();
    SetFillColor(circleFillColor);
    Circle(x0, y0, r, 0, 360, circleStyle);
    SetLineStyle(saveStyle);
    SetFillColor(saveColor);
  }
  static double pi = 4. * atan(1.);
  double a;
  wxPdfArrayDouble x, y;
  int i;
  for (i = 0; i < ns; i++)
  {
    a = (angle + (i * 360 / ns)) / 180. * pi;
    x.Add(x0 + (r * sin(a)));
    y.Add(y0 + (r * cos(a)));
  }
  Polygon(x, y, style);
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index