当前位置: 首页>>代码示例>>C++>>正文


C++ BoxRegion类代码示例

本文整理汇总了C++中BoxRegion的典型用法代码示例。如果您正苦于以下问题:C++ BoxRegion类的具体用法?C++ BoxRegion怎么用?C++ BoxRegion使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了BoxRegion类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: crosside

static Side crosside (BoxRegion  &region, 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);
}
开发者ID:fooeybartoni,项目名称:CSI702,代码行数:28,代码来源:GraphEdge.C

示例2: XChangeGC

// 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)
}
开发者ID:fooeybartoni,项目名称:CSI702,代码行数:28,代码来源:LineBox.C

示例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]);
    }
}
开发者ID:Stabledog,项目名称:dddbash,代码行数:32,代码来源:PrimitiveB.C

示例4: annotationPosition

// 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;
}
开发者ID:aidanfarrow,项目名称:GC_tidy,代码行数:36,代码来源:LineGraphE.C

示例5: assert

// 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);
}
开发者ID:aidanfarrow,项目名称:GC_tidy,代码行数:27,代码来源:LineGraphE.C

示例6: 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";
      }	  
}
开发者ID:fooeybartoni,项目名称:CSI702,代码行数:31,代码来源:RegionGN.C

示例7: crosspoint

static BoxPoint crosspoint (BoxRegion &region, 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 ;
}
开发者ID:fooeybartoni,项目名称:CSI702,代码行数:26,代码来源:GraphEdge.C

示例8: 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";
}
开发者ID:Stabledog,项目名称:dddbash,代码行数:10,代码来源:BoxGraphN.C

示例9: __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]);
}
开发者ID:fooeybartoni,项目名称:CSI702,代码行数:13,代码来源:SlopeBox.C

示例10: _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);
}
开发者ID:fooeybartoni,项目名称:CSI702,代码行数:14,代码来源:HatBox.C

示例11: 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);
    }
}
开发者ID:aidanfarrow,项目名称:GC_tidy,代码行数:16,代码来源:LineGraphE.C

示例12: _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);
}
开发者ID:fooeybartoni,项目名称:CSI702,代码行数:16,代码来源:HatBox.C

示例13: _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";
    }
}
开发者ID:fooeybartoni,项目名称:CSI702,代码行数:20,代码来源:SlopeBox.C

示例14: assert

// 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);
    }
}
开发者ID:Stabledog,项目名称:dddbash,代码行数:42,代码来源:BoxGraphN.C

示例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);
    }
}
开发者ID:aidanfarrow,项目名称:GC_tidy,代码行数:23,代码来源:LineGraphE.C


注:本文中的BoxRegion类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。