void CCtrlBounds::Resize() { RECT vp; GLfloat x,z; if (cam == 0)return; //пытаемся определить видимую часть десктопа cam->Apply(); cam->GetViewPort(vp); //vp.right = vp.bottom = 250; CBaseOglInput::GetWorld(vp.left, vp.top, zOrder, MP_XY, left, top, z); //(a)b::cd CBaseOglInput::GetWorld(vp.right, vp.top, zOrder, MP_XY, right, top, z); //a(b)::cd CBaseOglInput::GetWorld(vp.left, vp.bottom, zOrder, MP_XY, x, bottom, z); //ab::(c)d left = max(left,x); CBaseOglInput::GetWorld(vp.right, vp.bottom, zOrder, MP_XY, x, bottom, z); //ab::c(d) right = min(right, x); //вычисляем отношение. ratioX = (vp.right - vp.left)/(right - left); if (ratioX < 0)ratioX *= (-1); ratioY = (vp.bottom - vp.top)/(bottom - top); if (ratioY < 0)ratioY *= (-1); RecalcGrid(); }
void CCtrlBounds::Resize(CCtrlBounds* p, size_t l, size_t t, size_t w, size_t h) { if (p == 0)return; left = p->GetX((GLfloat)l); if (l == 0)left += brdr; top = p->GetY((GLfloat)t + p->headerHeight); if (t == 0)top-=brdr; right = p->GetX((GLfloat)w); if (w >= p->countX)right = p->GetX((GLfloat)p->countX) - brdr; bottom = p->GetY((GLfloat)h + p->headerHeight); if (h >= p->countY)bottom = p->GetY((GLfloat)p->countY) + brdr; RecalcGrid(); }
void CMapGridPainter::Paint (CG16bitImage &Dest, CMapViewportCtx &PaintCtx) // Paint // // Paints the grid { if (IsEmpty()) return; if (m_bRecalcNeeded) { RecalcGrid(); m_bRecalcNeeded = false; } Paint(Dest, PaintCtx, m_HorzLines); Paint(Dest, PaintCtx, m_VertLines); }
void CCtrlBounds::SetGrid(size_t gX, size_t gY) { countX = gX; countY = gY; RecalcGrid(); }