void Vertices::f_getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { float bx0, by0, bx1, by1, tcx, tcy, dummy1, dummy2; if (extentCached()) { getCachedExtent(bx0, by0, tcx, tcy, tol); bx1 = 2*tcx - bx0; by1 = 2*tcy - by0; } else { bx0 = bx1 = x()[0]; by0 = by1 = y()[0]; for (int i = 1; i < count(); ++i) { bx0 = min(bx0, float(x()[i])); by0 = min(by0, float(y()[i])); bx1 = max(bx1, float(x()[i])); by1 = max(by1, float(y()[i])); } tcx = (bx0 + bx1) / 2; tcy = (by0 + by1) / 2; tol = 0; cacheExtent(bx0, by0, tcx, tcy, tol); } transformRect(bx0, by0, bx1, by1, l, b, dummy1, dummy2, gs); transform(tcx, tcy, cx, cy, gs); }
void BSplineSelection::getExtent (float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs) { Extent e; if (extentCached()) { getCachedExtent(e.left, e.bottom, e.cx, e.cy, e.tol); } else { FullGraphic gstmp; concatGSGraphic(ifillbspline, this, gs, &gstmp); getExtentGraphic( ifillbspline, e.left, e.bottom, e.cx, e.cy, e.tol, &gstmp ); Extent te; concatGSGraphic(bspline, this, gs, &gstmp); getExtentGraphic( bspline, te.left, te.bottom, te.cx, te.cy, te.tol, &gstmp ); e.Merge(te); cacheExtent(e.left, e.bottom, e.cx, e.cy, e.tol); } float right = 2*e.cx - e.left; float top = 2*e.cy - e.bottom; float dummy = 0; transformRect(e.left, e.bottom, right, top, l, b, dummy, dummy, gs); transform(e.cx, e.cy, cx, cy, gs); tol = MergeArrowHeadTol(e.tol, gs); }
void Vertices::s_getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { float bx0, by0, bx1, by1, tcx, tcy, width, dummy1, dummy2; if (extentCached()) { getCachedExtent(bx0, by0, tcx, tcy, tol); bx1 = 2*tcx - bx0; by1 = 2*tcy - by0; } else { width = float(gs->GetBrush()->Width()); tol = (width > 1) ? width/2 : 0; bx0 = bx1 = x() ? x()[0] : 0.0; by0 = by1 = y() ? y()[0] : 0.0; for (int i = 1; i < count(); ++i) { bx0 = min(bx0, float(x()[i])); by0 = min(by0, float(y()[i])); bx1 = max(bx1, float(x()[i])); by1 = max(by1, float(y()[i])); } tcx = (bx0 + bx1) / 2; tcy = (by0 + by1) / 2; cacheExtent(bx0, by0, tcx, tcy, tol); } transformRect(bx0, by0, bx1, by1, l, b, dummy1, dummy2, gs); transform(tcx, tcy, cx, cy, gs); }
void Picture::getExtent ( float& l, float& b, float& cx, float& cy, float& tol, Graphic* gs ) { Extent e; float right, top, dummy1, dummy2; if (extentCached()) { getCachedExtent(e._left, e._bottom, e._cx, e._cy, e._tol); } else { if (IsEmpty()) { l = b = cx = cy = tol = 0.0; return; } else { Iterator i; FullGraphic gstemp; Transformer ttemp; Extent te; gstemp.SetTransformer(&ttemp); First(i); Graphic* gr = GetGraphic(i); concatGSGraphic(gr, gr, gs, &gstemp); concatTransformerGraphic(gr, nil, gr->GetTransformer(), &ttemp); getExtentGraphic(gr, e._left,e._bottom,e._cx,e._cy,e._tol,&gstemp); for (Next(i); !Done(i); Next(i)) { gr = GetGraphic(i); concatGSGraphic(gr, gr, gs, &gstemp); concatTransformerGraphic(gr,nil, gr->GetTransformer(), &ttemp); getExtentGraphic( gr, te._left, te._bottom, te._cx, te._cy, te._tol, &gstemp ); e.Merge(te); } cacheExtent(e._left, e._bottom, e._cx, e._cy, e._tol); gstemp.SetTransformer(nil); // to avoid deleting ttemp explicitly } } right = 2*e._cx - e._left; top = 2*e._cy - e._bottom; transformRect(e._left, e._bottom, right, top, l, b, dummy1, dummy2, gs); transform(e._cx, e._cy, cx, cy, gs); tol = e._tol; }