本文整理汇总了C++中Draw::GetDrawInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ Draw::GetDrawInfo方法的具体用法?C++ Draw::GetDrawInfo怎么用?C++ Draw::GetDrawInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Draw
的用法示例。
在下文中一共展示了Draw::GetDrawInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
std::set<std::set<int> > DrawsPrintout::ChooseDraws() {
int count;
if (wxConfig::Get()->Read(_T("MaxPrintedAxesNumber"), &count) == false)
count = 3;
if (count < 1)
count = 1;
Axis sr;
std::tr1::unordered_map<Axis, std::set<int>, AxisHasher> ranges;
for (int i = 0; i < m_draws_count; ++i) {
Draw* draw = m_draws[i];
if (!draw->GetEnable())
continue;
Axis r;
r.min = draw->GetDrawInfo()->GetMin();
r.max = draw->GetDrawInfo()->GetMax();
r.prec = draw->GetDrawInfo()->GetPrec();
r.unit = draw->GetDrawInfo()->GetUnit();
for (auto it = ranges.begin(); it!=ranges.end(); ++it) // for each axis in ranges
{
if (it->first.min == r.min && it->first.max == r.max && it->first.unit == r.unit) // check, if they differ only by precision. If so, change the axis
{
if (it->first.prec < r.prec) r.prec = it->first.prec;
else {
for (auto jt = ranges[it->first].begin(); jt != ranges[it->first].end(); ++jt)
ranges[r].insert(*jt);
if (sr == it->first)
sr = r;
}
}
}
if (m_draws[i]->GetSelected())
sr = r;
ranges[r].insert(i);
}
std::set<std::set<int> > ret;
std::tr1::unordered_map<Axis, std::set<int>, AxisHasher>::iterator it = ranges.begin();
for (int added = 0; added < count - 1 && it != ranges.end(); it++) {
if (it->first == sr)
continue;
added++;
ret.insert(it->second);
}
ret.insert(ranges[sr]);
return ret;
}
示例2: GetUrl
wxString DrawsWidget::GetUrl(bool with_infinity) {
Draw* d = m_draws_controller->GetSelectedDraw();
if (d == NULL)
return wxEmptyString;
time_t t;
if (with_infinity && m_draws_controller->AtTheNewestValue()) {
t = std::numeric_limits<time_t>::max();
} else {
t = GetCurrentTime().GetTicks();
}
wxString prefix = m_draws_controller->GetSet()->GetDrawsSets()->GetPrefix();
DrawInfo* di = d->GetDrawInfo();
SetInfoDataObject* wido =
new SetInfoDataObject(prefix, di->GetSetName(), d->GetPeriod(), t , d->GetDrawNo());
wxString tmp = wido->GetUrl();
delete wido;
return tmp;
}
示例3: OnRemarksResponse
void RemarksFetcher::OnRemarksResponse(RemarksResponseEvent &e) {
std::vector<Remark>& remarks = e.GetRemarks();
Draw* d = m_draws_controller->GetSelectedDraw();
if (d == NULL)
return;
ConfigNameHash& cnh = d->GetDrawInfo()->GetDrawsSets()->GetParentManager()->GetConfigTitles();
for (std::vector<Remark>::iterator i = remarks.begin();
i != remarks.end();
i++) {
ConfigNameHash::iterator j = cnh.find(i->GetPrefix());
if (j != cnh.end())
i->SetBaseName(j->second.c_str());
}
if (e.GetResponseType() == RemarksResponseEvent::BASE_RESPONSE) {
if (!m_awaiting_for_whole_base)
return;
m_awaiting_for_whole_base = false;
RemarksListDialog *d = new RemarksListDialog(m_draw_frame, m_remarks_handler);
d->SetViewedRemarks(remarks);
d->ShowModal();
d->Destroy();
} else
RemarksReceived(remarks);
}
示例4: RemarksReceived
void RemarksFetcher::RemarksReceived(std::vector<Remark>& remarks) {
Draw* d = m_draws_controller->GetSelectedDraw();
if (d == NULL)
return;
DrawInfo* di = d->GetDrawInfo();
wxDateTime start = d->GetTimeOfIndex(0);
wxDateTime end = d->GetTimeOfIndex(d->GetValuesTable().size());
wxString prefix = di->GetBasePrefix();
wxString set = di->GetSetName();
std::vector<wxDateTime> remarks_times;
for (std::vector<Remark>::iterator i = remarks.begin(); i != remarks.end(); i++) {
wxDateTime rt = i->GetTime();
std::wstring rset = i->GetSet();
if (prefix != i->GetAttachedPrefix()
|| (!rset.empty() && set != rset)
|| rt < start
|| rt >= end)
continue;
remarks_times.push_back(rt);
m_remarks[i->GetId()] = *i;
}
if (remarks_times.size()) {
d->SetRemarksTimes(remarks_times);
}
}
示例5: InsertSomeDraws
void SelectDrawWidget::InsertSomeDraws(size_t start, size_t count) {
wxSizer *sizer = GetSizer();
int width = GetCheckBoxWidth();
ConfigNameHash& cnm = const_cast<ConfigNameHash&>(m_cfg->GetConfigTitles());
for (size_t i = start; count; count--, i++) {
if (i >= m_cb_l.size()) {
i = m_cb_l.size();
m_cb_l.push_back(new wxCheckBox());
m_cb_l[i]->Create(this, drawID_SELDRAWCB,
wxString::Format(_T("%d."), i + 1),
wxDefaultPosition, wxSize(width, -1), 0,
SelectDrawValidator(m_draws_wdg, i, m_cb_l[i]));
m_cb_l[i]->Enable(FALSE);
m_cb_l[i]->SetToolTip(wxEmptyString);
m_cb_l[i]->SetBackgroundColour(DRAW3_BG_COLOR);
sizer->Add(m_cb_l[i], 0, wxTOP | wxLEFT | wxRIGHT, 1);
}
Draw* draw = m_dc->GetDraw(i);
DrawInfo* draw_info = draw->GetDrawInfo();
wxString label;
if (draw_info->IsValid()) {
m_cb_l[i]->Enable(TRUE);
m_cb_l[i]->SetValue(draw->GetEnable());
m_cb_l[i]->SetToolTip(cnm[draw_info->GetBasePrefix()] + _T(":") + draw_info->GetParamName());
label = wxString::Format(_T("%d."), draw->GetInitialDrawNo() + 1) + draw_info->GetName();
if (draw_info->GetParam()->GetIPKParam()->GetPSC())
label += _T("*");
if (draw->GetBlocked())
label.Replace(wxString::Format(_T("%d."), draw->GetInitialDrawNo() + 1), wxString::Format(_("%d.[B]"), i + 1), false);
} else {
label = _T("***");
}
m_cb_l[i]->SetLabel(label);
wxValidator* validator = m_cb_l[i]->GetValidator();
if (validator)
dynamic_cast<SelectDrawValidator*>(validator)->Set(m_draws_wdg, i, m_cb_l[i]);
else
m_cb_l[i]->SetValidator(SelectDrawValidator(m_draws_wdg, i, m_cb_l[i]));
m_cb_l[i]->SetBackgroundColour(draw_info->GetDrawColor());
#ifdef MINGW32
m_cb_l[i]->Refresh();
#endif
}
if (m_cb_l.size() > MIN_DRAWS_COUNT)
SetScrollRate(10, 10);
else
SetScrollRate(0, 0);
sizer->Layout();
}
示例6: OnCopyParamName
void DrawsWidget::OnCopyParamName(wxCommandEvent &event) {
Draw *d = m_draws_controller->GetSelectedDraw();
if (d == NULL)
return;
CopyParamName(d->GetDrawInfo());
}
示例7: ShowRemarks
void RemarksFetcher::ShowRemarks() {
if (!m_remarks_handler->Configured())
return;
m_awaiting_for_whole_base = true;
Draw* d = m_draws_controller->GetSelectedDraw();
if (d == NULL)
return;
m_remarks_handler->GetStorage()->GetAllRemarks(d->GetDrawInfo()->GetBasePrefix(), this);
}
示例8: FindVerticalAxesDistance
int BackgroundPrinter::FindVerticalAxesDistance(wxDC *dc, std::vector<Draw*> draws, const SS& sd) {
int d = 0;
for (SS::const_iterator ssi = sd.begin(); ssi != sd.end(); ssi++) {
set<int>::const_iterator si = (*ssi).begin();
if ((*ssi).end() == si)
assert(false);
int di = *si;
Draw *draw = draws[di];
double max = draw->GetDrawInfo()->GetMax();
double min = draw->GetDrawInfo()->GetMin();
wxString maxs = draw->GetDrawInfo()->GetValueStr(max, _T(""));
wxString mins = draw->GetDrawInfo()->GetValueStr(min, _T(""));
wxString unit = draw->GetDrawInfo()->GetUnit();
int maxext, minext, unitext, texth;
dc->GetTextExtent(maxs, &maxext, &texth);
dc->GetTextExtent(mins, &minext, &texth);
dc->GetTextExtent(unit, &unitext, &texth);
int msn = 0;
do {
int tw, th;
dc->GetTextExtent(draws[*si]->GetDrawInfo()->GetUnit(), &tw, &th);
msn = wxMax(msn, tw);
} while (++si != (*ssi).end());
int ext = wxMax(unitext, wxMax(maxext, minext));
ext = wxMax(ext, msn) + line_width;
d = wxMax(d, ext);
}
return d;
}
示例9: OnMouseRightDown
void WxGraphs::OnMouseRightDown(wxMouseEvent &event) {
if (m_draws_wdg->GetSelectedDrawIndex() == -1)
return;
Draw *d = m_draws[m_draws_wdg->GetSelectedDrawIndex()];
DrawInfo *di = d->GetDrawInfo();
SetInfoDataObject wido(di->GetBasePrefix(), di->GetSetName(), d->GetPeriod(), d->GetCurrentTime().GetTicks(), m_draws_wdg->GetSelectedDrawIndex());
wxDropSource ds(wido, this);
ds.DoDragDrop(0);
}
示例10: DrawUnit
void GCDCGraphs::DrawUnit(wxGraphicsContext &dc) {
Draw* draw = m_draws_wdg->GetSelectedDraw();
if (draw == NULL)
return;
double textw, texth, th, tsel;
wxString unit = draw->GetDrawInfo()->GetUnit();
dc.GetTextExtent(unit, &textw, &texth, &th, &tsel);
dc.DrawText(unit, m_screen_margins.leftmargin - 6 - textw, m_screen_margins.topmargin - 2 - texth);
}
示例11: DrawSeasonsLimitsInfo
void GCDCGraphs::DrawSeasonsLimitsInfo(wxGraphicsContext &dc) {
Draw* draw = m_draws_wdg->GetSelectedDraw();
if (draw == NULL)
return;
DrawsSets *cfg = m_cfg_mgr->GetConfigByPrefix(draw->GetDrawInfo()->GetBasePrefix());
std::vector<SeasonLimit> limits = get_season_limits_indexes(cfg, draw);
for (std::vector<SeasonLimit>::iterator i = limits.begin(); i != limits.end(); i++)
DrawSeasonLimitInfo(dc, i->index, i->month, i->day, i->summer);
}
示例12: StartDisplaying
void SummaryWindow::StartDisplaying(int no) {
assert(m_active);
Draw* draw = m_draws[no]->draw;
m_draws[no]->update = true;
m_draws[no]->tooltip = true;
m_summary_draws_count++;
m_labels[no] = new TTLabel(this, wxID_ANY);
m_labels[no]->SetUnitText(draw->GetDrawInfo()->GetShortName() + _T(":"));
m_labels[no]->SetBackgroundColour(draw->GetDrawInfo()->GetDrawColor());
m_lines[no] = new wxStaticLine(this, wxID_ANY);
m_values_sizer->Add(m_labels[no], 0, wxEXPAND);
m_values_sizer->Add(m_lines[no], 0, wxEXPAND);
m_tooltip = true;
m_update = true;
}
示例13: GetDrawInfoList
DrawInfoList SelectDrawWidget::GetDrawInfoList() {
DrawInfoList draw_info;
DrawSet *selected_set = m_dc->GetSet();
for (size_t i = 0; i < selected_set->GetDraws()->size(); ++i)
if (m_cb_l[i]->GetValue()) {
Draw* draw = m_dc->GetDraw(i);
draw_info.push_back(draw->GetDrawInfo());
}
return draw_info;
}
示例14: CopyToClipboard
void DrawsWidget::CopyToClipboard() {
Draw *d = m_draws_controller->GetSelectedDraw();
if (d == NULL)
return;
if (wxTheClipboard->Open() == false)
return;
DrawInfo *di = d->GetDrawInfo();
SetInfoDataObject* wido =
new SetInfoDataObject(di->GetBasePrefix(), di->GetSetName(), d->GetPeriod(), d->GetCurrentTime().GetTicks(), d->GetDrawNo());
wxTheClipboard->SetData(wido);
wxTheClipboard->Close();
}
示例15: Fetch
void RemarksFetcher::Fetch() {
if (!m_remarks_handler->Configured())
return;
Draw* d = m_draws_controller->GetSelectedDraw();
if (d == NULL)
return;
wxDateTime start = d->GetTimeOfIndex(0);
if (!start.IsValid())
return;
wxDateTime end = d->GetTimeOfIndex(d->GetValuesTable().size());
DrawInfo *di = d->GetDrawInfo();
m_remarks_handler->GetStorage()->GetRemarks(
di->GetBasePrefix(),
di->GetSetName(),
start.GetTicks(),
end.GetTicks(),
this);
}