void DashboardInstrument_Dial::Draw(wxGCDC* bdc) { wxColour c1; GetGlobalColor(_T("DASHB"), &c1); wxBrush b1(c1); bdc->SetBackground(b1); bdc->Clear(); wxSize size = GetClientSize(); m_cx = size.x / 2; int availableHeight = size.y - m_TitleHeight - 6; int width, height; bdc->GetTextExtent( _T("000"), &width, &height, 0, 0, g_pFontLabel ); m_cy = m_TitleHeight + 2; m_cy += availableHeight / 2; m_radius = availableHeight / 2; DrawLabels(bdc); DrawFrame(bdc); DrawMarkers(bdc); DrawBackground(bdc); DrawData(bdc, m_MainValue, m_MainValueUnit, m_MainValueFormat, m_MainValueOption); DrawData(bdc, m_ExtraValue, m_ExtraValueUnit, m_ExtraValueFormat, m_ExtraValueOption); DrawForeground(bdc); }
void UReporterGraph::Draw(UCanvas* Canvas) { if(!bVisible) { return; } DrawBackground(Canvas); switch(DataStyle) { case EGraphDataStyle::Lines: { // order doesn't *really* matter, as they're lines DrawAxes(Canvas); DrawData(Canvas); } break; case EGraphDataStyle::Filled: { // draw data first and overlay axes DrawData(Canvas); DrawAxes(Canvas); } break; } DrawLegend(Canvas); DrawThresholds(Canvas); }
void TacticsInstrument_AppTrueWindAngle::Draw(wxGCDC* bdc) { wxColour c1; GetGlobalColor(_T("DASHB"), &c1); wxBrush b1(c1); bdc->SetBackground(b1); bdc->Clear(); wxSize size = GetClientSize(); m_cx = size.x / 2; int availableHeight = size.y - m_TitleHeight - 6; int width, height; bdc->GetTextExtent(_T("000"), &width, &height, 0, 0, g_pFontLabel); m_cy = m_TitleHeight + 2; m_cy += availableHeight / 2; m_radius = availableHeight / 2.0 * 0.95; DrawLabels(bdc); DrawFrame(bdc); DrawMarkers(bdc); DrawBackground(bdc); DrawData(bdc, m_MainValueApp, m_MainValueAppUnit, m_MainValueFormat, m_MainValueOption1); DrawData(bdc, m_MainValueTrue, m_MainValueTrueUnit, m_MainValueFormat, m_MainValueOption2); DrawData(bdc, m_ExtraValueApp, m_ExtraValueAppUnit, m_ExtraValueFormat, m_ExtraValueOption1); DrawData(bdc, m_ExtraValueTrue, m_ExtraValueTrueUnit, m_ExtraValueFormat, m_ExtraValueOption2); DrawData(bdc, m_TWD, m_MainValueTrueUnit, _T("TWD:%.0f"), DIAL_POSITION_INSIDE); DrawForeground(bdc); }
/*-----------------------------------------------------------------*/ void __fastcall TFixeinzugForm::pbFixeinzugMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { int i = X / dx; int j = maxy-1 - (Y / dy); dbw3_assert(i>=0); dbw3_assert(j>=0); if (i>=maxx || j>=maxy) return; short old = einzug[scrollx+i]; if (old==j+1) einzug[scrollx+i] = 0; else einzug[scrollx+i] = short(j+1); changed = true; CalcRange(); if (old!=0) { pbFixeinzug->Canvas->Pen->Color = clBtnFace; pbFixeinzug->Canvas->Brush->Color = clBtnFace; pbFixeinzug->Canvas->Rectangle (i*dx+2, (maxy-old)*dy+2, (i+1)*dx-1, (maxy-old+1)*dy-1); } DrawData (pbFixeinzug, i); DeleteCursor(); cx = i; cy = j; DeleteRange(); CalcRange(); DrawRange(); DrawCursor(); }
/*-----------------------------------------------------------------*/ void __fastcall TFixeinzugForm::pbFixeinzugPaint(TObject *Sender) { DrawGrid (pbFixeinzug); DrawData (pbFixeinzug); DrawRange(); DrawCursor(); }
///////////////////////// OpenGL //////////////////////////////////// void DataLoad::renderScence(void) { glClear(GL_COLOR_BUFFER_BIT || GL_DEPTH_TEST); glViewport(0, 0, 800, 800); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-1.f, 1.f, -1.f, 1.f, -1.f, 1.f); //gluPerspective(45, 1, 0.01, 1000); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); // 버텍스 버퍼 사용 //glEnableClientState(GL_VERTEX_ARRAY); //glVertexPointer() //glDrawArrays(); //glDisableClientState(GL_VERTEX_ARRAY); Background(); // DrawQuad(); DrawGraph(); DrawData(); glutSwapBuffers(); }
void do_redraw(char *userdata, GraphWin * wi) { if ( TransformCompute(wi) ) { DrawTitle(userdata, wi); DrawLegend(userdata, wi); DrawGridAndAxis(userdata, wi); DrawData(userdata, wi); DrawLabel(userdata, wi); } }
void Plot::Draw(wxDC &dc, wxRect rc) { m_background->Draw(dc, rc); if (HasData()) { DrawData(dc, rc); } else { DrawNoDataMessage(dc, rc); } }
void TacticsInstrument_BearingCompass::Draw(wxGCDC* bdc) { wxColour c1; GetGlobalColor(_T("DASHB"), &c1); wxBrush b1(c1); bdc->SetBackground(b1); bdc->Clear(); wxSize size = GetClientSize(); m_cx = size.x / 2; int availableHeight = size.y - m_TitleHeight - 6; int width, height; bdc->GetTextExtent(_T("000"), &width, &height, 0, 0, g_pFontLabel); m_cy = m_TitleHeight + 2; m_cy += availableHeight / 2; m_radius = availableHeight / 2 *0.80; DrawLabels(bdc); DrawFrame(bdc); DrawMarkers(bdc); DrawBackground(bdc); if (!wxIsNaN(m_Bearing)){ DrawData(bdc, m_Bearing, m_BearingUnit, _T("BRG:%.f"), DIAL_POSITION_TOPLEFT); DrawData(bdc, 0, m_ToWpt, _T(""), DIAL_POSITION_TOPRIGHT); } if (!wxIsNaN(m_CurrSpeed)) DrawData(bdc, m_CurrSpeed, m_CurrSpeedUnit, _T("Curr:%.2f"), DIAL_POSITION_INSIDE); if (!wxIsNaN(m_ExtraValueDTW)) DrawData(bdc, m_ExtraValueDTW, m_ExtraValueDTWUnit, _T("DTW:%.1f"), DIAL_POSITION_BOTTOMLEFT); if (!wxIsNaN(m_CurrDir) && m_CurrDir >= 0 && m_CurrDir < 360) DrawCurrent(bdc); DrawForeground(bdc); DrawLaylines(bdc); if (!wxIsNaN(m_MainValue)) DrawData(bdc, m_MainValue, m_MainValueUnit, _T("%.0f"), DIAL_POSITION_TOPINSIDE); if (!wxIsNaN(m_predictedSog)) DrawData(bdc, m_predictedSog, getUsrSpeedUnit_Plugin(g_iDashSpeedUnit), _T("prd.SOG: ~%.1f"), DIAL_POSITION_BOTTOMRIGHT); }
TBool CT_ActiveRConsoleRead::VerifyDataAndKick(const TInt aAsyncErrorIndex, RConsole& aConsole) { TInt eventType=iKey.Type(); iDataWrapperBase.INFO_PRINTF2(KLogEvent, eventType); // Do we ignore the event TBool moreToDo=!ExitEvent(); TBool eventOk=EFalse; TEventConfig config=iEvent[iEventIndex]; while ( iEventIndex<iEvent.Count() && !eventOk && moreToDo ) { config=iEvent[iEventIndex]; if ( eventType==config.iEventType ) { ++iEventCount; eventOk=ETrue; iDataWrapperBase.INFO_PRINTF3(_L("Events type match Expected=%d, Actual=%d"), config.iEventType,eventType); } else { switch(config.iEventOccurance) { case EEventOccuranceOnce: iDataWrapperBase.ERR_PRINTF4(KLogUnexpectedEvent, config.iEventType, eventType, iEventIndex); iDataWrapperBase.SetBlockResult(EFail); moreToDo=EFalse; break; case EEventOccuranceZeroOrMore: // If the event may not occur then go to the next one ++iEventIndex; iEventCount=0; break; case EEventOccuranceOneOrMore: if(iEventCount==0) { iDataWrapperBase.ERR_PRINTF4(KLogUnexpectedEvent, config.iEventType, eventType, iEventIndex); iDataWrapperBase.SetBlockResult(EFail); moreToDo=EFalse; } else { ++iEventIndex; iEventCount=0; } break; } } } if ( eventOk ) { if ( config.iDataDraw ) { DrawData(); } if ( config.iDataVerify ) { if ( iHasExpectedRectangle ) { TPoint point=iKey.MousePos(); if ( !iExpectedRectangle.Contains(point) ) { iDataWrapperBase.ERR_PRINTF3(KLogUnexpectedPoint, point.iX, point.iY); iDataWrapperBase.SetBlockResult(EFail); } } if ( iHasExpectedKeyCode ) { TKeyCode keyCode=iKey.Code(); if ( keyCode!=iExpectedKeyCode ) { iDataWrapperBase.ERR_PRINTF2(KLogUnexpectedKeyCode, keyCode); iDataWrapperBase.SetBlockResult(EFail); } else { iDataWrapperBase.INFO_PRINTF3(_L("keycodes match as expected:%d, actual:%d"), iExpectedKeyCode,keyCode); } } } if ( config.iEventOccurance==EEventOccuranceOnce ) { ++iEventIndex; iEventCount=0; } if ( iEventIndex>=iEvent.Count() ) { moreToDo=KickNext(aAsyncErrorIndex, aConsole); } else { // Event can occur multiple times Kick(aAsyncErrorIndex, aConsole); } } return moreToDo; }
/*-----------------------------------------------------------------*/ void __fastcall TFixeinzugForm::DrawData (TPaintBox* _pb) { for (int i=0; i<maxx; i++) DrawData (_pb, i); }
/*-----------------------------------------------------------------*/ void __fastcall TFixeinzugForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift) { switch (Key) { case VK_SPACE: { DeleteCursor(); DeleteRange(); short old = einzug[scrollx+cx]; if (old==cy+1) einzug[scrollx+cx] = 0; else einzug[scrollx+cx] = short(cy+1); CalcRange(); if (old!=0) { pbFixeinzug->Canvas->Pen->Color = clBtnFace; pbFixeinzug->Canvas->Brush->Color = clBtnFace; int x, y; if (frm->righttoleft) x = (maxx-cx-1)*dx; else x = cx*dx; if (frm->toptobottom) y = (old-1)*dy; else y = (maxy-old)*dy; pbFixeinzug->Canvas->Rectangle (x+2, y+2, x+dx-1, y+dy-1); } DrawData(pbFixeinzug, cx); DrawRange(); CurMove(); DrawCursor(); changed = true; break; } case VK_LEFT: if (Shift.Contains(ssCtrl) && Shift.Contains(ssAlt)) { if (frm->righttoleft) CurDirRight(); else CurDirLeft(); break; } if (frm->righttoleft) CurRight(Shift.Contains(ssCtrl)); else CurLeft (Shift.Contains(ssCtrl)); break; case VK_RIGHT: if (Shift.Contains(ssCtrl) && Shift.Contains(ssAlt)) { if (frm->righttoleft) CurDirLeft(); else CurDirRight(); break; } if (frm->righttoleft) CurLeft(Shift.Contains(ssCtrl)); else CurRight (Shift.Contains(ssCtrl)); break; case VK_UP: if (Shift.Contains(ssCtrl) && Shift.Contains(ssAlt)) { if (frm->toptobottom) CurDirDown(); else CurDirUp(); break; } if (frm->toptobottom) CurDown (Shift.Contains(ssCtrl)); else CurUp (Shift.Contains(ssCtrl)); break; case VK_DOWN: if (Shift.Contains(ssCtrl) && Shift.Contains(ssAlt)) { if (frm->toptobottom) CurDirUp(); else CurDirDown(); break; } if (frm->toptobottom) CurUp (Shift.Contains(ssCtrl)); else CurDown (Shift.Contains(ssCtrl)); break; } }
void matrixOperations_do(std::string type, bool clhep, bool drawSingleGraph) { systemName = type; std::string cName = "c1_" + type; std::string cTitle = "Matrix operations " + type; TCanvas * c1 = new TCanvas(cName.c_str(),cTitle.c_str(),topX,topY,800*sqrt(2),800); topX+=20; topY+=20; c1->Divide(3,2); const int nb = N; //double x[N] = { 2.,3.,4.,5.,7.,10,15,20,50,75,100}; double x[N] = { 2.,3.,4.,5.,6,7.,10,15,20,30}; // timings double smat[N]; // = { 1., 2., 3., 4,5,10,100,300,1000 }; double tmat[N]; // = { 1.4, 2.4, 3.4, 5,6,20,200,500,2000 }; double cmat[N]; // = { 2., 3., 4., 5,8,10,300,800,5000 }; double ymat[N]; // = { 2., 3., 4., 5,8,10,300,800,5000 }; double wmat[N]; // = { 2., 3., 4., 5,8,10,300,800,5000 }; double zmat[N]; // = { 2., 3., 4., 5,8,10,300,800,5000 }; double es[N]; double et[N]; double ec[N]; double ey[N]; double ew[N]; double ez[N]; c1->cd(1); GetData("SMatrix_dot",x,smat,es); GetData("TMatrix_dot",x,tmat,et); if (clhep) GetData("HepMatrix_dot",x,cmat,ec); TGraphErrors * g10 = new TGraphErrors(nb,x, smat,0, es); TGraphErrors * g20 = new TGraphErrors(nb,x, tmat,0, et); TGraphErrors * g30 = 0; TGraphErrors * g40 = 0; TGraphErrors * g50 = 0; if (clhep) g50 = new TGraphErrors(nb,x, cmat,0, ec); DrawData("#vec{v} #upoint #vec{w}",g10,g20,g30,g40,g50); c1->cd(2); GetData("SMatrix_M*V+",x,smat,es); GetData("TMatrix_M*V+",x,tmat,et); GetData("SMatrix_sym_M*V+",x,ymat,ey); GetData("TMatrix_sym_M*V+",x,wmat,ew); if (clhep) GetData("HepMatrix_M*V+",x,cmat,ec); if (clhep) GetData("HepMatrix_sym_M*V+",x,zmat,ez); TGraphErrors * g11 = new TGraphErrors(nb,x, smat,0,es); TGraphErrors * g21 = new TGraphErrors(nb,x, tmat,0,et); TGraphErrors * g31 = new TGraphErrors(nb,x, ymat,0,ey); TGraphErrors * g41 = new TGraphErrors(nb,x, wmat,0,ew); TGraphErrors * g51 = 0; TGraphErrors * g61 = 0; if (clhep) g51 = new TGraphErrors(nb,x, cmat,0, ec); if (clhep) g61 = new TGraphErrors(nb,x, zmat,0, ez); DrawData("M #upoint #vec{v} + #vec{w}",g11,g21,g31,g41,g51,g61); c1->cd(3); GetData("SMatrix_prod",x,smat,es); GetData("TMatrix_prod",x,tmat,et); GetData("SMatrix_sym_prod",x,ymat,ey); GetData("TMatrix_sym_prod",x,wmat,ew); if (clhep) { GetData("HepMatrix_M*V+",x,cmat,ec); GetData("HepMatrix_sym_M*V+",x,zmat,ez); } TGraphErrors * g12 = new TGraphErrors(nb,x, smat,0,es); TGraphErrors * g22 = new TGraphErrors(nb,x, tmat,0,et); TGraphErrors * g32 = new TGraphErrors(nb,x, ymat,0,ey); TGraphErrors * g42 = new TGraphErrors(nb,x, wmat,0,ew); TGraphErrors * g52 = 0; TGraphErrors * g62 = 0; if (clhep) g52 = new TGraphErrors(nb,x, cmat,0, ec); if (clhep) g62 = new TGraphErrors(nb,x, zmat,0, ez); DrawData("v^{T} * M * v",g12,g22,g32,g42,g52,g62); c1->cd(4); GetData("SMatrix_M*M",x,smat,es); GetData("TMatrix_M*M",x,tmat,et); GetData("SMatrix_sym_M*M",x,ymat,ey); GetData("TMatrix_sym_M*M",x,wmat,ew); if (clhep) { GetData("HepMatrix_M*M",x,cmat,ec); GetData("HepMatrix_sym_M*M",x,zmat,ez); } TGraphErrors * g14 = new TGraphErrors(nb,x, smat,0,es); TGraphErrors * g24 = new TGraphErrors(nb,x, tmat,0,et); TGraphErrors * g34 = new TGraphErrors(nb,x, ymat,0,ey); TGraphErrors * g44 = new TGraphErrors(nb,x, wmat,0,ew); TGraphErrors * g54 = 0; TGraphErrors * g64 = 0; if (clhep) g54 = new TGraphErrors(nb,x, cmat,0, ec); if (clhep) g64 = new TGraphErrors(nb,x, zmat,0, ez); DrawData("A * B + C",g14,g24,g34,g44,g54,g64); c1->cd(5); GetData("SMatrix_At*M*A",x,smat,es); GetData("TMatrix_At*M*A",x,tmat,et); GetData("SMatrix_sym_At*M*A",x,ymat,ey); GetData("TMatrix_sym_At*M*A",x,wmat,ew); if (clhep) { GetData("HepMatrix_At*M*A",x,cmat,ec); GetData("HepMatrix_sym_At*M*A",x,zmat,ez); } TGraphErrors * g15 = new TGraphErrors(nb,x, smat,0,es); TGraphErrors * g25 = new TGraphErrors(nb,x, tmat,0,et); TGraphErrors * g35 = new TGraphErrors(nb,x, ymat,0,ey); TGraphErrors * g45 = new TGraphErrors(nb,x, wmat,0,ew); TGraphErrors * g55 = 0; TGraphErrors * g65 = 0; if (clhep) g55 = new TGraphErrors(nb,x, cmat,0, ec); if (clhep) g65 = new TGraphErrors(nb,x, zmat,0, ez); DrawData("A * M * A^{T}",g15,g25,g35,g45,g55,g65); c1->cd(6); GetData("SMatrix_inv",x,smat,es); GetData("TMatrix_inv",x,tmat,et); GetData("SMatrix_sym_inv",x,ymat,ey); GetData("TMatrix_sym_inv",x,wmat,ew); if (clhep) { GetData("HepMatrix_inv",x,cmat,ec); GetData("HepMatrix_sym_inv",x,zmat,ez); } TGraphErrors * g16 = new TGraphErrors(nb,x, smat,0,es); TGraphErrors * g26 = new TGraphErrors(nb,x, tmat,0,et); TGraphErrors * g36 = new TGraphErrors(nb,x, ymat,0,ey); TGraphErrors * g46 = new TGraphErrors(nb,x, wmat,0,ew); TGraphErrors * g56 = 0; TGraphErrors * g66 = 0; if (clhep) g56 = new TGraphErrors(nb,x, cmat,0, ec); if (clhep) g66 = new TGraphErrors(nb,x, zmat,0, ez); DrawData("A^{-1}",g16,g26,g36,g46,g56,g66); // TCanvas::Update() draws the frame, after which one can change it c1->Update(); c1->SetFillColor(fillCol); c1->GetFrame()->SetFillColor(21); c1->GetFrame()->SetBorderSize(12); c1->Modified(); if (drawSingleGraph) { std::string c2Name = "c2_" + type; TCanvas * c2 = new TCanvas(c2Name.c_str(),"Matrix Operations",200,10,700,600); DrawData("A * M * A^{T}",g15,g25,g35,g45,g55,g65); c2->SetRightMargin(0.028); c2->Update(); } }
#include "Globals.h" Camera Globals::camera = Camera(); Cube Globals::cube = Cube(10.0); Light Globals::light = Light(); DrawData Globals::drawData = DrawData(); UpdateData Globals::updateData = UpdateData(); OFFObject *Globals::offObject = new OFFObject("testpatch.off"); //OFFObject *Globals::offObject = new OFFObject("teapot.off");
//------------------------------------------------------------------------------ // methods //------------------------------------------------------------------------------ void CStatsWidget::paintEvent(QPaintEvent* p) { DrawData(); DrawBars(); }