本文整理汇总了C++中CGESTUREptr::is_line方法的典型用法代码示例。如果您正苦于以下问题:C++ CGESTUREptr::is_line方法的具体用法?C++ CGESTUREptr::is_line怎么用?C++ CGESTUREptr::is_line使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGESTUREptr
的用法示例。
在下文中一共展示了CGESTUREptr::is_line方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create_rect
//! Draw a straight line cross-ways to an existing
//! straight Bcurve to create a rectangle:
bool
SWEEP_LINE::create_rect(CGESTUREptr& gest)
{
static bool debug =
Config::get_var_bool("DEBUG_CREATE_RECT",false) || debug_all;
err_adv(debug, "SWEEP_LINE::create_rect");
if (!(gest && gest->is_line())) {
err_adv(debug, "SWEEP_LINE::create_rect: gesture is not a line");
return false;
}
// central axis must be on-screen
if (!sweep_origin().in_frustum()) {
err_adv(debug_all, "SWEEP_LINE::stroke_cb: error: sweep origin off-screen");
return false;
}
if (!from_center(gest)) {
WORLD::message("Stroke must begin on curve at guideline");
return false;
}
if (!hits_line(gest->end())) {
WORLD::message("Line must follow axis");
return false;
}
// compute vector along guideline, based on input stroke:
Wvec v = project_to_guideline(gest->end()) - sweep_origin();
return create_rect(v);
}
示例2: assert
int
CIRCLE_WIDGET::stroke_cb(CGESTUREptr& g, DrawState*&)
{
err_adv(debug_all, "CIRCLE_WIDGET::stroke_cb()");
// Activity occurred to extend the deadline for fading away:
reset_timeout();
// sanity check
assert(g);
if( !g->is_line() )
return 1;
_preview.update_length();
if (PIXEL_list(_preview).dist(g->start()) < PIXEL_DIST_THRESH ||
g->start().dist(_center) < PIXEL_DIST_THRESH ) {
if ( _circle ) {
Bcurve *border = Bcurve::lookup(_circle->bfaces().get_boundary().edges());
if ( border != 0 ) {
Wplane plane = border->plane();
_radius = _center.dist(Wpt(plane, Wline(XYpt(g->end()))));
}
} else {
Wplane P = get_draw_plane(g->end());
if (!P.is_valid())
return 1;
_radius = _center.dist(Wpt(P, Wline(XYpt(g->end()))));
}
make_preview();
}
return 1;
}