本文整理汇总了C++中DrawInfo::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ DrawInfo::GetName方法的具体用法?C++ DrawInfo::GetName怎么用?C++ DrawInfo::GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DrawInfo
的用法示例。
在下文中一共展示了DrawInfo::GetName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnDrawChange
void XYDialog::OnDrawChange(wxCommandEvent &event) {
DrawInfo **draw;
wxButton *button;
int i = event.GetId() - XY_XAXIS_BUTTON;
draw = &m_di[i];
button = wxDynamicCast(FindWindowById(event.GetId()), wxButton);
if (m_draw_search->ShowModal() == wxID_CANCEL)
return;
#ifdef __WXMSW__
//hilarious...
Raise();
#endif
long previous = -1;
DrawInfo *choosen = m_draw_search->GetDrawInfo(&previous);
if (choosen == NULL)
return;
*draw = choosen;
button->SetLabel(choosen->GetName());
}
示例2: DrawYAxisVals
void GCDCGraphs::DrawYAxisVals(wxGraphicsContext& dc) {
Draw* draw = m_draws_wdg->GetSelectedDraw();
if (draw == NULL)
return;
DrawInfo *di = draw->GetDrawInfo();
if (!di->IsValid())
return;
double min = di->GetMin();
double max = di->GetMax();
if( max <= min ) {
// FIXME: Draw3 should atomaticly detect axes in that case, but
// it currently doesnt :(
wxLogWarning(_T("Parameter %s has invalid min/max values: min %f, max %f. Min is set to 0, and max to 100."), di->GetName().c_str(), min, max);
min = 0;
max = 100;
}
//procedure for calculating distance between marks stolen from SzarpDraw2
double x = max - min;
double step;
int i = 0;
if (x < 1)
for (;x < 1; x *=10, --i);
else
for (;(int)x / 10; x /=10, ++i);
if (x <= 1.5)
step = .1;
else if (x <= 3.)
step = .2;
else if (x <= 7.5)
step = .5;
else
step = 1.;
double acc = 1;
int prec = di->GetPrec();
for (int p = prec; p > 0; --p)
acc /= 10;
double factor = (i > 0) ? 10 : .1;
for (;i; i -= i / abs(i))
step *= factor;
if (step < acc)
step = acc;
dc.SetPen(wxPen(*wxWHITE, 1, wxSOLID));
int w, h;
GetClientSize(&w, &h);
h -= m_screen_margins.bottommargin + m_screen_margins.topmargin;
for (double val = max; (min - val) < acc; val -= step) {
int y = GetY(val, di);
dc.StrokeLine(m_screen_margins.leftmargin - 8, y, m_screen_margins.leftmargin, y);
wxString sval = di->GetValueStr(val, _T("- -"));
double textw, texth, textd, textel;
dc.GetTextExtent(sval, &textw, &texth, &textd, &textel);
dc.DrawText(sval, m_screen_margins.leftmargin - textw - 1, y + 2);
}
}
示例3: OnIdle
//.........这里部分代码省略.........
resize = true;
continue;
}
if (!std::isnan(val) && !l->IsShown()) {
SHOW(l, true);
SHOW(li, true);
resize = true;
od->tooltip = true;
m_tooltip = true;
}
od->update = false;
if (l->IsShown() == false)
continue;
Draw* draw = od->draw;
assert(draw);
DrawInfo* info = draw->GetDrawInfo();
assert(info);
//convert unit, idea taken from draw2 :)
wxString sunit = info->GetSumUnit();
wxString unit = info->GetUnit();
wxString text;
if (!sunit.IsEmpty()) {
text = wxString(info->GetValueStr(val, _T(""))) + _T(" ") + sunit;
} else if (unit == _T("kW")) {
text = wxString(info->GetValueStr(val, _T(""))) + _T(" ") + _T("kWh") +
_T(" (") + wxString(info->GetValueStr(val * 3.6 / 1000, _T(""))) + _T(" GJ)");
} else if (unit == _T("MW")) {
text = wxString(info->GetValueStr(val, _T(""))) + _T(" ") + _T("MWh") +
_T(" (") + wxString(info->GetValueStr(val * 3.6, _T(""))) + _T(" GJ)");
} else if (unit.Replace(_T("/h"), _T("")) == 0) {
unit += _T("*h");
text = wxString(info->GetValueStr(val, _T(""))) + _T(" ") + unit;
} else {
text = wxString(info->GetValueStr(val, _T(""))) + _T(" ") + unit;
}
if (!std::isnan(data_percentage) && !(data_percentage > 0.9999))
text += wxString::Format(_T(" (%.2f%%)"), data_percentage * 100);
l->SetValueText(text);
resize = true;
}
if (m_no_draws_label->IsShown()) {
SHOW(m_no_draws_label, false);
SHOW(m_no_draws_line, false);
}
}
}
if (m_tooltip) for (size_t i = 0; i < m_draws.Count(); ++i) {
ObservedDraw* od = m_draws[i];
if (od == NULL)
continue;
if (od->tooltip == false)
continue;
Draw* draw = od->draw;
DrawInfo* info = draw->GetDrawInfo();
wxString tooltip = _T("");
tooltip += info->GetName();
tooltip += _T("\n");
PeriodType period = draw->GetPeriod();
const Draw::VT& vt = draw->GetValuesTable();
wxDateTime s = draw->GetTimeOfIndex(vt.m_stats.Start() - vt.m_view.Start());
wxDateTime e = draw->GetTimeOfIndex(vt.m_stats.End() - vt.m_view.Start());
tooltip += _("From:");
tooltip += _T("\n") + FormatTime(s, period) + _T("\n") + _("To:") + _T("\n") + FormatTime(e, period);
double data_percentage = od->draw->GetValuesTable().m_data_probes_ratio;
if (std::isnan(data_percentage))
data_percentage = 0;
tooltip += _T("\n\n") + wxString::Format(_("Data contains %.2f%% probes from current period"), data_percentage * 100);
m_labels[i]->SetToolTip(tooltip);
od->tooltip = false;
}
if (resize)
Resize();
m_update = m_tooltip = false;
}
示例4: PrintDrawsInfo
//.........这里部分代码省略.........
time += _("From: ");
time += FormatTime(fd->GetTimeOfIndex(0), pt);
time += _(" to: ");
time += FormatTime(fd->GetTimeOfIndex(fd->GetValuesTable().size() - 1), pt);
dc->GetTextExtent(time, &tw, &th);
if (tw > w && f.GetPointSize() >= 2) {
f.SetPointSize(f.GetPointSize() - 1);
dc->SetFont(f);
} else {
dc->DrawText(time, hw - tw / 2, maxy);
maxy += int(1.4 * th);
painted = true;
}
} while (!painted);
f.SetPointSize(point_size) ;
dc->SetFont(f);
painted = false;
bool painting = false;
int pmaxy = maxy;
do {
for (int i = 0; i < m_draws_count; ++i) {
Draw *d = m_draws[i];
if (!d->GetEnable())
continue;
DrawInfo* di = d->GetDrawInfo();
int cx = 0.02 * w;
wxString str = wxString::Format(_T("%s = %s "),
di->GetShortName().c_str(),
di->GetName().c_str());
dc->SetTextForeground(di->GetDrawColor());
dc->GetTextExtent(str, &tw, &th);
if (painting)
dc->DrawText(str, cx, maxy);
cx += tw;
const Draw::VT& vt = d->GetValuesTable();
if (vt.m_count) {
dc->SetTextForeground(*wxBLACK);
wxString unit = di->GetUnit();
str = wxString(_T(": "))
+ _("min.=") + d->GetDrawInfo()->GetValueStr(vt.m_min, _T("- -")) +
+ _T(" ; ") + _("avg.=") + wxString(d->GetDrawInfo()->GetValueStr(vt.m_sum / vt.m_count, _T("- -"))) +
+ _T(" ; ") + _("max.=") + wxString(d->GetDrawInfo()->GetValueStr(vt.m_max, _T("- -"))) +
+ _T(" ") + unit;
if (painting) {
dc->GetTextExtent(str, &tw, &th);
dc->DrawText(str, cx, maxy);
}
cx += tw;
if (di->GetSpecial() == TDraw::HOURSUM) {
wxString u = unit;
if (u.Replace(_T("/h"), _T("")) == 0)
u += _T("*h");
wxString vals;
double val = vt.m_hsum;