示例#1
0
//! Same as try_select_edge(), but deselects.
//! Also requires the found edge is currently selected.
bool
SELECT_WIDGET::try_deselect_edge(CPIXEL &pix)
{

   Bedge* e = find_edge(pix);
   if (!(e && e->is_selected()))
      return false;
   WORLD::add_command(new MESH_DESELECT_CMD(e));
   return true;
}
示例#2
0
bool
SELECT_WIDGET::select_edges(CPIXEL_list& pts)
{
   err_adv(debug, "SELECT_WIDGET::select_edges:");

   if (pts.num() < 2) {
      err_adv(debug, "  bad gesture: %d points", pts.num());
      return false;
   }

   // Find edit-level vert near start of pixel trail:
   Bvert* v = find_vert(pts[0]);
   if (!v) {
      err_adv(debug, "  can't get starter vertex");
      return false;
   }

   // 2. Extract edge sequence within tolerance of gest

   Bedge_list chain;

   int k = 0;                           // index of cur position in gesture
   Bvert* cur = v;                      // current vertex
   Bedge* e = 0;
   while ((e = match_span(cur, pts, k))) {
      if(!e->is_selected()) chain += e;
      cur = e->other_vertex(cur);
   }

   err_adv(debug, "  got %d edges", chain.num());

   // Confirm gest is sufficiently close to edge chain

   // 3. Select the edges

   WORLD::add_command(new MESH_SELECT_CMD(chain));

   return true;
}