void CDrawShapeView::OnDynDraw(GiGraphics* gs) { MgCommand* cmd = mgGetCommandManager()->getCommand(); if (cmd) { cmd->draw(&m_proxy->motion, gs); } }
bool TransformCmd::draw(const MgMotion* sender, GiGraphics* gs) { if (_lastCmd) _lastCmd->draw(sender, gs); char text[20]; GiContext ctx(-10, GiColor(255, 0, 0, 128)); gs->drawLine(&ctx, getPointM(0, sender), getPointM(1, sender)); Point2d pt(getPointM(1, sender) * gs->xf().modelToDisplay()); #if defined(_MSC_VER) && _MSC_VER >= 1400 // VC8 sprintf_s(text, sizeof(text), "X %d %dd", #else sprintf(text, "X %d %dd", #endif mgRound(_axis[0].length()), mgRound(_axis[0].angle2() * _M_R2D)); gs->rawTextCenter(text, pt.x, pt.y, 40); ctx.setLineColor(GiColor(0, 0, 255, 128)); gs->drawLine(&ctx, getPointM(0, sender), getPointM(2, sender)); pt = getPointM(2, sender) * gs->xf().modelToDisplay(); #if defined(_MSC_VER) && _MSC_VER >= 1400 // VC8 sprintf_s(text, sizeof(text), "Y %d %dd", #else sprintf(text, "Y %d %dd", #endif mgRound(_axis[1].length()), mgRound(_axis[1].angle2() * _M_R2D)); gs->rawTextCenter(text, pt.x, pt.y, 40); return true; }
bool GiCoreViewImpl::drawCommand(GcBaseView* view, const MgMotion& motion, GiGraphics& gs) { bool ret = false; if (view == curview) { MgDynShapeLock locker(false, this); MgCommand* cmd = _cmds->getCommand(); ret = cmd && cmd->draw(&motion, &gs); if (ret && cmd->isDrawingCommand()) { getCmdSubject()->drawInShapeCommand(&motion, cmd, &gs); } } return ret; }