MCPcopy Create free account
hub / github.com/GeoDaCenter/geoda / oglDrawFormattedText

Function oglDrawFormattedText

ogl/oglmisc.cpp:487–516  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

485}
486
487void oglDrawFormattedText(wxDC& dc, wxList *text_list,
488 double m_xpos, double m_ypos, double width, double height,
489 int formatMode)
490{
491 double xoffset, yoffset;
492 if (formatMode & FORMAT_CENTRE_HORIZ)
493 xoffset = m_xpos;
494 else
495 xoffset = (double)(m_xpos - (width / 2.0));
496
497 if (formatMode & FORMAT_CENTRE_VERT)
498 yoffset = m_ypos;
499 else
500 yoffset = (double)(m_ypos - (height / 2.0));
501
502 dc.SetClippingRegion(
503 (long)(m_xpos - width/2.0), (long)(m_ypos - height/2.0),
504 (long)width+1, (long)height+1); // +1 to allow for rounding errors
505
506 wxObjectList::compatibility_iterator current = text_list->GetFirst();
507 while (current)
508 {
509 wxShapeTextLine *line = (wxShapeTextLine *)current->GetData();
510
511 dc.DrawText(line->GetText(), WXROUND(xoffset + line->GetX()), WXROUND(yoffset + line->GetY()));
512 current = current->GetNext();
513 }
514
515 dc.DestroyClippingRegion();
516}
517
518/*
519 * Find centroid given list of points comprising polyline

Callers 3

OnDrawContentsMethod · 0.85
OnDrawContentsMethod · 0.85
DrawRegionMethod · 0.85

Calls 4

DrawTextMethod · 0.80
GetTextMethod · 0.45
GetXMethod · 0.45
GetYMethod · 0.45

Tested by

no test coverage detected