| 485 | } |
| 486 | |
| 487 | void 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 |
no test coverage detected