void CAnimMixer::getElemRect(sInt elemIndex, RECT& rc) const { frAnimationClip::element& elem = m_thisClip->m_elements[elemIndex]; elem.updateLen(); rc.left = mapTime(elem.relStart); rc.right = mapTime(elem.relStart + elem.len); rc.top = elem.trackID * 22 + 46; rc.bottom = (elem.trackID + 1) * 22 + 46; }
void HectorMappingRos::publishMapLoop(double map_pub_period) { ros::Rate r(1.0 / map_pub_period); while(ros::ok()) { //ros::WallTime t1 = ros::WallTime::now(); ros::Time mapTime (ros::Time::now()); //publishMap(mapPubContainer[2],slamProcessor->getGridMap(2), mapTime); //publishMap(mapPubContainer[1],slamProcessor->getGridMap(1), mapTime); //if(p_update_given_map_ || first_Time){ publishMap(mapPubContainer[0],slamProcessor->getGridMap(0), mapTime, slamProcessor->getMapMutex(0)); //first_Time = false; //} //ros::WallDuration t2 = ros::WallTime::now() - t1; //std::cout << "time s: " << t2.toSec(); //ROS_INFO("HectorSM ms: %4.2f", t2.toSec()*1000.0f); r.sleep(); } }
LRESULT CAnimMixer::OnFrameChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { if (m_flags & 8) // follow mode { RECT rc; sInt mapped = mapTime(m_curFrame); GetClientRect(&rc); if (mapped >= rc.right * 7 / 8) // need to scroll right processScroll(mapped - rc.right / 8, sTRUE); else if (mapped < 0) // need to scroll left processScroll(mapped - rc.right * 7 / 8, sTRUE); } m_curFrame = lParam; drawBar(); return 0; }
void CAnimMixer::drawBar(sInt mode) { CDCHandle dc = GetDC(); CPen timePen; timePen.CreatePen(PS_SOLID, 3, RGB(255, 0, 0)^RGB(128, 128, 128)); CPenHandle oldPen = dc.SelectPen(timePen); int op = dc.SetROP2(R2_XORPEN); CRect rc; GetClientRect(&rc); rc.left += 4; rc.top += 45; rc.right -= 4; if (mode != 2) { if (m_timeBarPos != -0x7fffffff) { dc.MoveTo(m_timeBarPos, rc.bottom - 1); dc.LineTo(m_timeBarPos, rc.top + 1); m_timeBarPos = -0x7fffffff; } } if (mode != 1) { m_timeBarPos = mapTime(m_curFrame); dc.MoveTo(m_timeBarPos, rc.bottom - 1); dc.LineTo(m_timeBarPos, rc.top + 1); } dc.SelectPen(oldPen); dc.SetROP2(op); ReleaseDC(dc); }
LRESULT CAnimMixer::OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { drawBar(1); CDCHandle dc = (HDC) wParam; // prepare... CRect rc; GetClientRect(&rc); CFontHandle oldFont = dc.SelectFont(AtlGetDefaultGuiFont()); dc.SetTextColor(RGB(0, 0, 0)); dc.SetBkMode(TRANSPARENT); CPen blackPen; blackPen.CreatePen(PS_SOLID, 1, RGB(0, 0, 0)); CPenHandle oldPen = dc.SelectPen(blackPen); // fill background dc.FillSolidRect(&rc, RGB(174, 169, 167)); // draw tl bar at y 45 dc.MoveTo(mapTime(0), 45); dc.LineTo(rc.right, 45); // track grid CPen pen_grid; pen_grid.CreatePen(PS_DOT, 1, RGB(174*3/4, 169*3/4, 167*3/4)^RGB(174, 169, 167)); dc.SelectPen(pen_grid); dc.SetROP2(R2_XORPEN); dc.SetBkColor(RGB(0, 0, 0)); dc.SetBkMode(TRANSPARENT); for (sInt trackY=46+22; trackY<rc.bottom; trackY+=22) { dc.MoveTo(mapTime(0), trackY); dc.LineTo(rc.right, trackY); } // bar marks dc.SetROP2(R2_COPYPEN); dc.SelectPen(blackPen); const sF32 xstep = 60000.0f / g_graph->m_bpmRate; const sF32 ixstep = g_graph->m_bpmRate / (60000.0f * m_frameStep); const sInt xms = (m_startPixel) * ixstep; const sInt xme = (m_startPixel + rc.right) * ixstep; LOGFONT lf; ((CFontHandle) AtlGetDefaultGuiFont()).GetLogFont(lf); if (lf.lfHeight<0) lf.lfHeight=MulDiv(-lf.lfHeight, dc.GetDeviceCaps(LOGPIXELSY), 72); for (sInt i=fr::maximum(xms-1,0); i<=xme+1; i++) { const sInt xpos=mapTime(i*xstep); const sInt beat=i&3; dc.MoveTo(xpos, 45); dc.LineTo(xpos, 37-(beat==0)*2); TCHAR buf[32]; sprintf(buf, "%d.%d", i/4, beat); dc.SetTextAlign(TA_BOTTOM|(i?TA_CENTER:TA_LEFT)); dc.TextOut(xpos, 35, buf); if (!beat) { dc.MoveTo(xpos, rc.bottom); dc.LineTo(xpos, 45); } } dc.SelectPen(oldPen); dc.SelectFont(oldFont); return 1; }