本文整理汇总了C++中BoxRegion::origin方法的典型用法代码示例。如果您正苦于以下问题:C++ BoxRegion::origin方法的具体用法?C++ BoxRegion::origin怎么用?C++ BoxRegion::origin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BoxRegion
的用法示例。
在下文中一共展示了BoxRegion::origin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: region
// Region occupied by edge
BoxRegion LineGraphEdge::region(const GraphGC& gc) const
{
BoxRegion r;
if (gc.drawAnnotations && annotation() != 0)
{
BoxPoint anno_pos = annotationPosition(gc);
if (anno_pos.isValid())
{
BoxRegion anno_region = annotation()->region(anno_pos, gc);
if (r.origin().isValid())
r = r | anno_region;
else
r = anno_region;
}
}
if (from() == to())
{
BoxRegion region = from()->region(gc);
if (from()->selected())
region.origin() += gc.offsetIfSelected;
LineGraphEdgeSelfInfo info(region, gc);
BoxRegion self_region(info.arc_pos,
BoxSize(info.diameter, info.diameter));
if (r.origin().isValid())
r = r | self_region;
else
r = self_region;
}
return r;
}
示例2: _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";
}
}
}
示例3: _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]);
}
}
示例4: 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 ;
}
示例5: 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";
}
}
示例6: 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);
}
示例7: drawSelf
// Draw self edge
void LineGraphEdge::drawSelf(Widget w,
const BoxRegion& exposed,
const GraphGC& gc) const
{
assert(from() == to());
// Get region
BoxRegion region = from()->region(gc);
if (from()->selected())
region.origin() += gc.offsetIfSelected;
LineGraphEdgeSelfInfo info(region, gc);
XDrawArc(XtDisplay(w), XtWindow(w), gc.edgeGC, info.arc_pos[X],
info.arc_pos[Y], info.diameter, info.diameter,
info.arc_start * 64, info.arc_extend * 64);
if (annotation() != 0)
{
// Draw annotation
annotation()->draw(w, info.anno_pos, exposed, gc);
}
// Find arrow angle
drawArrowHead(w, exposed, gc, info.arrow_pos, info.arrow_alpha);
}
示例8: _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)
}
示例9: printSelf
void LineGraphEdge::printSelf(ostream& os, const GraphGC &gc) const
{
assert(from() == to());
// Get region
BoxRegion region = from()->region(gc);
if (from()->selected())
region.origin() += gc.offsetIfSelected;
LineGraphEdgeSelfInfo info(region, gc);
if (gc.printGC->isPostScript())
{
int start = (720 - info.arc_start - info.arc_extend) % 360 ;
int end = (720 - info.arc_start) % 360 ;
BoxCoordinate line_width = 1;
// Draw arc
os << start << " " << end << " "
<< info.radius << " " << info.radius << " "
<< info.arc_center[X] << " " << info.arc_center[Y] << " "
<< line_width << " arc*\n";
// Now draw the arrow head
int angle = (720 - info.arrow_angle) % 360;
os << gc.arrowAngle << " " << gc.arrowLength << " " << angle << " "
<< info.arrow_pos[X] << " " << info.arrow_pos[Y] << " arrowhead*\n";
}
else if (gc.printGC->isFig())
{
BoxCoordinate line_width = 1;
os << ARCARROWHEAD1 << line_width << ARCARROWHEAD2;
switch (gc.selfEdgeDirection)
{
case Clockwise:
os << ARCCLOCKWISE;
break;
case Counterclockwise:
os << ARCCOUNTERCLOCKWISE;
break;
}
os << ARCARROWHEAD3
<< float(info.arc_center[X]) << " "
<< float(info.arc_center[Y]) << " ";
for (int i = 0; i < 3; i++)
os << info.fig_pos[i][X] << " " << info.fig_pos[i][Y] << " ";
os << ARCARROWHEAD4;
}
if (annotation() != 0)
{
// Print annotation
annotation()->_print(os, info.anno_pos, gc);
}
}
示例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: _draw
// Draw
void StringBox::_draw(Widget w,
const BoxRegion& r,
const BoxRegion&,
GC gc,
bool) const
{
BoxPoint origin = r.origin();
if (_font != 0)
XSetFont(XtDisplay(w), gc, _font->fid);
XDrawString(XtDisplay(w), XtWindow(w), gc, origin[X], origin[Y] + _ascent,
_string.chars(), _string.length());
}
示例14: _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";
}
}
示例15: 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);
}
}