本文整理汇总了C++中BoxRegion::space方法的典型用法代码示例。如果您正苦于以下问题:C++ BoxRegion::space方法的具体用法?C++ BoxRegion::space怎么用?C++ BoxRegion::space使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BoxRegion
的用法示例。
在下文中一共展示了BoxRegion::space方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: crosside
static Side crosside (BoxRegion ®ion, BoxPoint &p)
{
BoxPoint center = region.origin() + (region.space() / BoxPoint(2)) ;
BoxPoint delta = center - p ;
int side = North | South | East | West ;
// exclude opposite side
if (p[X] > center[X])
side &= ~West ;
else
side &= ~East ;
if (p[Y] > center[Y])
side &= ~North ;
else
side &= ~South ;
delta[X] = abs(delta[X]);
delta[Y] = abs(delta[Y]);
if (region.space(Y) * delta[X] > region.space(X) * delta[Y])
side &= ~(North | South);
else
side &= ~(East | West);
return Side(side);
}
示例2: crosspoint
static BoxPoint crosspoint (BoxRegion ®ion, BoxPoint &p)
{
int side = crosside (region, p);
BoxDimension d1, d2;
BoxPoint center = region.origin() + (region.space() / BoxPoint(2)) ;
BoxPoint cross = center;
int offset;
offset = (side & (North | West)? -1 : 1) ;
if (side & (North | South)) {
d1 = X ;
d2 = Y ;
} else {
d1 = Y ;
d2 = X ;
}
if (center[d1] != p[d1] && center[d2] != p[d2]) {
cross[d1] += offset * (region.space(d2) / 2)
* ( center[d1] - p[d1]) / ( center[d2] - p[d2] ) ;
}
cross[d2] += offset * region.space(d2) / 2;
return cross ;
}
示例3: _print
// Print
void HatBox::_print(std::ostream& os,
const BoxRegion& region,
const PrintGC& gc) const
{
BoxRegion childRegion = region;
if (extend(X) == 0)
childRegion.space(X) = size(X);
if (extend(Y) == 0)
childRegion.space(Y) = size(Y);
_box->_print(os, childRegion, gc);
}
示例4: clipToCircle
// Clip point P to side SIDE of region B centered around C. Assume
// that B contains a circle.
void LineGraphEdge::clipToCircle(const BoxRegion& b, int /* side */,
BoxPoint& p, const BoxPoint& c)
{
// assert(side == North || side == South || side == East || side == West);
double radius = max(b.space(X), b.space(Y)) / 2;
if (radius > 0.0)
{
double hyp = hypot(c[X] - p[X], c[Y] - p[Y]);
p[X] += BoxCoordinate((radius * (c[X] - p[X])) / hyp);
p[Y] += BoxCoordinate((radius * (c[Y] - p[Y])) / hyp);
}
}
示例5: _print
void GraphEdge::_print(std::ostream& os, const GraphGC &gc) const
{
// Don't print if we're hidden
if (hidden())
return;
// Fetch the regions
BoxRegion start = from()->region(gc);
BoxRegion end = to()->region(gc);
// Don't print edges with zero length
if (start <= end)
return;
BoxPoint startc = start.origin() + (start.space() / BoxPoint(2));
BoxPoint endc = end.origin() + (end.space() / BoxPoint(2));
BoxPoint startp = crosspoint (start, endc);
BoxPoint endp = crosspoint (end, startc);
// This should come from gc.edgeGC
BoxCoordinate line_width = 1;
if (gc.printGC->isFig()) {
if (!gc.drawArrowHeads || to()->isHint()) {
os << EDGEHEAD1 << line_width;
os << EDGEHEAD2 ;
os << startp[X] << " " << startp[Y] << " " ;
os << endp[X] << " " << endp[Y] << " " ;
os << "9999 9999\n" ;
} else {
os << ARROWHEAD1 << line_width;
os << ARROWHEAD2 ;
os << startp[X] << " " << startp[Y] << " " ;
os << endp[X] << " " << endp[Y] << " " ;
os << "9999 9999\n" ;
}
} else if (gc.printGC->isPostScript()) {
if (!gc.drawArrowHeads || to()->isHint()) {
os << startp[X] << " " << startp[Y] << " " ;
os << endp[X] << " " << endp[Y] << " " ;
os << line_width << " line*\n";
} else {
os << gc.arrowAngle << " " << gc.arrowLength << " ";
os << startp[X] << " " << startp[Y] << " " ;
os << endp[X] << " " << endp[Y] << " " ;
os << line_width << " arrowline*\n";
}
}
}
示例6: _draw
// Draw
void HatBox::_draw(Widget w,
const BoxRegion& r,
const BoxRegion& exposed, GC gc,
bool context_selected) const
{
BoxRegion childRegion = r;
// If not extensible, shrink to minimal size
if (extend(X) == 0)
childRegion.space(X) = size(X);
if (extend(Y) == 0)
childRegion.space(Y) = size(Y);
_box->draw(w, childRegion, exposed, gc, context_selected);
}
示例7: _draw
// Draw RuleBox
void RuleBox::_draw(Widget w,
const BoxRegion& r,
const BoxRegion&,
GC gc,
bool) const
{
BoxSize space = r.space();
BoxPoint origin = r.origin();
BoxPoint width(extend(X) ? space[X] : size(X),
extend(Y) ? space[Y] : size(Y));
if (width[Y] == 1)
{
// Horizontal line
XDrawLine(XtDisplay(w), XtWindow(w), gc,
origin[X], origin[Y], origin[X] + width[X], origin[Y]);
}
else if (width[X] == 1)
{
// Vertical line
XDrawLine(XtDisplay(w), XtWindow(w), gc,
origin[X], origin[Y], origin[X], origin[Y] + width[Y]);
}
else
{
// Rectangle
XFillRectangle(XtDisplay(w), XtWindow(w), gc, origin[X], origin[Y],
width[X], width[Y]);
}
}
示例8: cleanRegion
// cleanRegion
// clean a region with white ink
//
static void cleanRegion (std::ostream& os, const GraphGC& gc, BoxRegion region)
{
BoxPoint origin = region.origin();
BoxPoint width = region.space();
if (gc.printGC->isPostScript())
{
os << origin[X] << " " << origin[Y] << " ";
os << origin[X] + width[X] << " " << origin[Y];
os << " ";
os << origin[X] + width[X] << " ";
os << origin[Y] + width[Y] << " ";
os << origin[X] << " " << origin[Y] + width[Y];
os << " clean*\n";
}
else if (gc.printGC->isFig())
{
os << CLEANHEAD;
os << origin[X] << " " << origin[Y] << " ";
os << origin[X] + width[X] << " " << origin[Y];
os << " ";
os << origin[X] + width[X] << " ";
os << origin[Y] + width[Y] << " ";
os << origin[X] << " " << origin[Y] + width[Y];
os << " ";
os << origin[X] << " "<< origin[Y] << " 9999 9999\n";
}
}
示例9: _draw
// Draw
void LineBox::_draw(Widget w,
const BoxRegion& r,
const BoxRegion& exposed,
GC gc,
bool context_selected) const
{
XGCValues gcvalues;
// Set width and cap style; project beyond end point up to 1/2
// line thickness
gcvalues.line_width = _linethickness;
gcvalues.cap_style = CapProjecting;
XChangeGC(XtDisplay(w), gc, GCLineWidth | GCCapStyle, &gcvalues);
// Keep an empty frame of 1/2 line thickness around R (X may cross
// R's boundaries otherwise)
BoxPoint origin = r.origin();
BoxSize space = r.space();
origin += _linethickness / 2;
space -= _linethickness;
// Draw children
__draw(w, BoxRegion(origin, space), exposed, gc, context_selected);
// Attention: We leave LINE_WIDTH and CAP_STYLE changed!
// (Works within Box::draw(), but the used GC may be changed)
}
示例10: startCompound
// mark the following objects as one XFIG compound object
static void startCompound(std::ostream& os, BoxRegion region)
{
BoxPoint origin = region.origin();
BoxPoint width = region.space();
os << CMPHEAD;
os << origin[X] + width[X] + 1 << " " << origin[Y] - 1 << " ";
os << origin[X] - 1 << " " << origin[Y] + width[Y] + 1 << "\n";
}
示例11: forceDraw
// Draw a BoxGraphNode
void BoxGraphNode::forceDraw(Widget w,
const BoxRegion& /* exposed */,
const GraphGC& gc) const
{
assert(box() != 0);
// assert(box()->OK());
// We do not check for exposures here --
// boxes are usually small and partial display
// doesn't work well with scrolling
static BoxRegion exposed(BoxPoint(0, 0), BoxSize(INT_MAX, INT_MAX));
if (selected() && highlight())
{
box()->draw(w, region(gc), exposed, gc.nodeGC, false);
bool use_color = ColorBox::use_color;
ColorBox::use_color = false;
BoxRegion r = highlightRegion(gc);
if (r <= exposed)
{
XFillRectangle(XtDisplay(w), XtWindow(w), gc.clearGC,
r.origin(X), r.origin(Y),
r.space(X), r.space(Y));
highlight()->draw(w, r, r, gc.nodeGC, false);
}
ColorBox::use_color = use_color;
}
else if (selected())
{
bool use_color = ColorBox::use_color;
ColorBox::use_color = false;
box()->draw(w, region(gc), exposed, gc.nodeGC, false);
ColorBox::use_color = use_color;
}
else
{
box()->draw(w, region(gc), exposed, gc.nodeGC, false);
}
}
示例12: __draw
// Draw
void RiseBox::__draw(Widget w,
const BoxRegion& r,
const BoxRegion&,
GC gc,
bool) const
{
BoxSize space = r.space();
BoxPoint origin = r.origin();
XDrawLine(XtDisplay(w), XtWindow(w), gc, origin[X], origin[Y] + space[Y],
origin[X] + space[X], origin[Y]);
}
示例13: moveToSide
// Clip point P to side SIDE of region B.
void LineGraphEdge::moveToSide(const BoxRegion& b, int side,
BoxPoint& p, const BoxPoint&)
{
assert(side == North || side == South || side == East || side == West);
p = b.origin();
// Fetch points
if (side & (North | South))
{
p[X] += b.space(X) / 2;
if (side & South)
p[Y] += b.space(Y);
}
if (side & (East | West))
{
p[Y] += b.space(Y) / 2;
if (side & East)
p[X] += b.space(X);
}
}
示例14: clipToSide
// Clip point P to side SIDE of region B centered around C.
void LineGraphEdge::clipToSide(const BoxRegion& b, int side,
BoxPoint& p, const BoxPoint& c)
{
assert(side == North || side == South || side == East || side == West);
BoxDimension d1, d2;
if (side & (North | South))
d1 = X, d2 = Y;
else
d1 = Y, d2 = X;
int offset;
if (side & (North | West))
offset = -1;
else
offset = 1;
if (c[d1] != p[d1] && c[d2] != p[d2])
p[d1] += offset * (b.space(d2) / 2) * (c[d1] - p[d1])
/ (c[d2] - p[d2]);
p[d2] += offset * b.space(d2) / 2;
}
示例15: _print
// Print
void RiseBox::_print(std::ostream& os,
const BoxRegion& region,
const PrintGC& gc) const
{
BoxPoint origin = region.origin();
BoxPoint space = region.space();
if (gc.isFig()) {
os << LINEHEAD1 ;
os << linethickness() << LINEHEAD2 ;
os << origin[X] << " " << origin[Y] + space[Y] << " " ;
os << origin[X] + space[X] << " " << origin[Y] << " " ;
os << "9999 9999\n" ;
} else if (gc.isPostScript()) {
os << origin[X] << " " << origin[Y] + space[Y] << " " ;
os << origin[X] + space[X] << " " << origin[Y] << " " ;
os << linethickness() << " line*\n";
}
}