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


C++ CGESTUREptr::endpt_line方法代码示例

本文整理汇总了C++中CGESTUREptr::endpt_line方法的典型用法代码示例。如果您正苦于以下问题:C++ CGESTUREptr::endpt_line方法的具体用法?C++ CGESTUREptr::endpt_line怎么用?C++ CGESTUREptr::endpt_line使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CGESTUREptr的用法示例。


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

示例1:

int
SWEEP_BASE::trim_line_cb(CGESTUREptr& g, DrawState*&)
{
   // Activity occurred to extend the deadline for fading away:
   reset_timeout();

   // A slash gesture across the guideline trims its tip

   static bool debug =
      Config::get_var_bool("DEBUG_SWEEP_TRIM",false) || debug_all;

   err_adv(debug, "SWEEP_BASE::trim_cb");

   // Find where the slash intersects the guideline.
   PIXEL p;
   if (g->endpt_line().intersect_segs(pix_line(), p)) {

      // Reset the endpoint to match screen position p:
      reset_endpoint(p);

      return 1;
   }

   // The slash gesture missed the guideline...
   // XXX - policy on failure?

   err_adv(debug, "SWEEP_BASE::trim_line_cb: Missed the guideline");

   return 1; // This means we DID use up the gesture
}
开发者ID:QuLogic,项目名称:jot-lib,代码行数:30,代码来源:sweep.cpp

示例2: trim_line_cb

int  
SWEEP_BASE::line_cb(CGESTUREptr& g, DrawState*& s)
{
   // Activity occurred to extend the deadline for fading away:
   reset_timeout();

   static bool debug =
      Config::get_var_bool("DEBUG_SWEEP_LINE_CB",false) || debug_all;

   err_adv(debug, "SWEEP_BASE::line_cb");

   // If gesture aligns with guideline:
   //    if it starts near the end and extends past the end, extend
   //    if it starts near the beginning, do uniform sweep
   // If it's across the gesture, trim

   // If it's a trim stroke, it has to be short and run
   // across the guideline.
   const double TRIM_MAX_LEN = 65;
   if (g->length() < TRIM_MAX_LEN) {
      const double TRIM_ANGLE_THRESH = 80; // degrees
      double angle = line_angle(g->endpt_vec(), pix_line().direction());
      if (rad2deg(angle) > TRIM_ANGLE_THRESH) {
         // Nice angle. But did it cross?
         if (g->endpt_line().intersect_segs(pix_line()))
            return trim_line_cb(g, s);
      }
   }

   // do uniform sweep if straight gesture starts at sweep origin
   // and ends near the guideline:
   if (from_center(g)) {
      if (hits_line(g->end()))
         return do_uniform_sweep(project_to_guideline(g->end()) - sweep_origin());
      return stroke_cb(g,s);
   }

   // extend the guideline if straight gesture starts near guideline end
   // and is nearly parallel:
   const double ALIGN_ANGLE_THRESH = 15; // degrees
   if (pix_line().endpt().dist(g->start()) < DIST_THRESH_PIXELS &&
       rad2deg(g->endpt_vec().angle(pix_line().direction())) < ALIGN_ANGLE_THRESH)
      return extend_line_cb(g, s);

   return stroke_cb(g,s);
}
开发者ID:QuLogic,项目名称:jot-lib,代码行数:46,代码来源:sweep.cpp


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