44 wxFont font = m_dc.GetFont();
46 font.SetPixelSize(wxSize(0, font_size_in_points));
52 double r = col.get<0>();
53 double g = col.get<1>();
54 double b = col.get<2>();
55 wxColour
colour(r * 255, g * 255, b * 255);
56 m_dc.SetTextForeground(
colour);
57 m_dc.SetPen(wxPen(
colour));
58 m_dc.SetBrush(wxBrush(
colour));
64 m_dc.DrawLine(c1.
x, c1.
y, c2.
x, c2.
y);
68 m_dc.DrawText(wxString(c), cds.
x, cds.
y);
72 PRECONDITION(cds.size() >= 3,
"must have at least three points");
73 wxPoint lines[cds.size()];
74 for (
unsigned int i = 0; i < cds.size(); ++i) {
76 lines[i] = wxPoint(c1.
x, c1.
y);
79 m_dc.DrawPolygon(cds.size(), lines);
83 const wxBrush &brush = m_dc.GetBrush();
84 const wxPen &pen = m_dc.GetPen();
94 double &label_height)
const {
95 if (m_dc.CanGetTextExtent()) {
97 m_dc.GetTextExtent(wxString(label), &
width, &
height);
#define PRECONDITION(expr, mess)
int panelHeight() const
return the height of the drawing panels.
virtual void setFontSize(double new_size)
MolDraw2D(int width, int height, int panelWidth, int panelHeight)
constructor for a particular size
int height() const
return the height of the drawing area.
virtual DrawColour colour() const
returns the current draw color
virtual void setColour(const DrawColour &col)
sets the current draw color
virtual Point2D getDrawCoords(const Point2D &mol_cds) const
int panelWidth() const
return the width of the drawing panels.
int width() const
return the width of the drawing area.
virtual double fontSize() const
font size in drawing coordinate units. That's probably pixels.
MolDrawOptions & drawOptions()
returns our current drawing options
void getStringSize(const std::string &label, double &label_width, double &label_height) const
void setColour(const DrawColour &col)
sets the current draw color
void drawPolygon(const std::vector< Point2D > &cds)
void drawChar(char c, const Point2D &cds)
void clearDrawing()
clears the contents of the drawing
void drawLine(const Point2D &cds1, const Point2D &cds2)
void setFontSize(double new_size)
MolDraw2Dwx(int width, int height, wxDC &dc, int panelWidth=-1, int panelHeight=-1)
#define RDKIT_MOLDRAW2D_EXPORT