isis/src/qisis/objs/RubberBandTool/RubberBandTool.cpp
void RubberBandTool::mouseButtonRelease(QPoint p, Qt::MouseButton s) {
    if ((s & Qt::ControlModifier) == Qt::ControlModifier)
      *p_mouseLoc = snapMouse(p);
    else
      *p_mouseLoc = p;

    p_mouseButton = s;

    if((s & Qt::LeftButton) == Qt::LeftButton || p_allClicks) {
      p_mouseDown = false;
    }
    else {
      return;
    }

    switch(p_bandingMode) {
      case AngleMode: {
          if(p_vertices->size() == 3) {
            reset();
          }

          p_vertices->push_back(*p_mouseLoc);
          p_tracking = true;

          if(p_vertices->size() == 3) {
            p_tracking = false;
            emit bandingComplete();
          }
        }
        break;

      case LineMode:
      case CircleMode:
      case EllipseMode:
      case RectangleMode: {
          *p_vertices = vertices();
          p_tracking = false;
          emit bandingComplete();
        }
        break;

      case RotatedRectangleMode: {
          if(p_vertices->size() == 1) {
            p_vertices->push_back(*p_mouseLoc);
          }
          else if(p_vertices->size() == 2) {
            *p_vertices = vertices();
            p_tracking = false;
            emit bandingComplete();
          }
        }
        break;

      case SegmentedLineMode:
      case PolygonMode:
        break;
    }

    p_doubleClicking = false; // If we were in a double click, it's over now.


    MdiCubeViewport * activeViewport = cubeViewport();
    for (int i = 0; i < (int) cubeViewportList()->size(); i++) {
      MdiCubeViewport * curViewport = cubeViewportList()->at(i);
      if (curViewport == activeViewport ||
          (activeViewport->isLinked() && curViewport->isLinked())) {
        curViewport->viewport()->repaint();
      }
    }
  }
/**
   * If this is not the left mouse button, this does nothing.
   *
   * This will set mouseDown as false. When the calculations are complete,
   * p_doubleClicking is
   *   set to false. The double click event occurs with
   * `the press event so it's safe to set that flag here.
   *
   * The implementation differs, based on the mode, as follows:
   *
   * For angles,
   *   This signifies a click. We're always setting one of the
   *  three vertexes, but if there is an already
   *     complete vertex go ahead and reset first to start a new angle.
   *
   * For circles,
   *   Since this is a drag-only rubber band, a release signifies a complete. Figure out the corner, based
   *     on the mouse location, and push it onto the back of the vertex list and emit a complete.
   *
   * For EllipseModes,
   *   Since this is a drag-only rubber band, a release signifies a complete. We know the corner, it's the mouse loc,
   *     push it onto the back of the vertex list and emit a complete.
   *
   * For lines,
   *   Since this is a drag-only rubber band, a release signifies a complete. We know the end point,
   *     push it onto the back of the vertex list and emit a complete.
   *
   * For rectangles,
   *   Since this is a drag-only rubber band, a release signifies a complete. We know the opposite corner,
   *     figure out the others and push them onto the back of the vertex list and emit a complete.
   *
   * For rotated rectangles,
   *   If we're finishing dragging the first side, store the end point.
   *
   * For polygons,
   *   Do nothing, this is taken care of on press.
   *
   * @param p Current mouse Location
   * @param s Which mouse button was released
   */
If this is not the left mouse button, this does nothing.
This will set mouseDown as false. When the calculations are complete,
p_doubleClicking is
set to false. The double click event occurs with
`the press event so it's safe to set that flag here.

The implementation differs, based on the mode, as follows.

For angles,
This signifies a click. We're always setting one of the
three vertexes, but if there is an already
complete vertex go ahead and reset first to start a new angle.

For circles,
Since this is a drag-only rubber band, a release signifies a complete. Figure out the corner, based
on the mouse location, and push it onto the back of the vertex list and emit a complete.

For EllipseModes,
Since this is a drag-only rubber band, a release signifies a complete. We know the corner, it's the mouse loc,
push it onto the back of the vertex list and emit a complete.

For lines,
Since this is a drag-only rubber band, a release signifies a complete. We know the end point,
push it onto the back of the vertex list and emit a complete.

For rectangles,
Since this is a drag-only rubber band, a release signifies a complete. We know the opposite corner,
figure out the others and push them onto the back of the vertex list and emit a complete.

For rotated rectangles,
If we're finishing dragging the first side, store the end point.

For polygons,
Do nothing, this is taken care of on press.

@param p Current mouse Location
@param s Which mouse button was released
If this is not the left mouse button this does nothing . This will set mouseDown as false . When the calculations are complete p_doubleClicking is set to false . The double click event occurs with ` the press event so it ' s safe to set that flag here . The implementation differs based on the mode as follows . For angles This signifies a click . We ' re always setting one of the three vertexes but if there is an already complete vertex go ahead and reset first to start a new angle . For circles Since this is a drag - only rubber band a release signifies a complete . Figure out the corner based on the mouse location and push it onto the back of the vertex list and emit a complete . For EllipseModes Since this is a drag - only rubber band a release signifies a complete . We know the corner it ' s the mouse loc push it onto the back of the vertex list and emit a complete . For lines Since this is a drag - only rubber band a release signifies a complete . We know the end point push it onto the back of the vertex list and emit a complete . For rectangles Since this is a drag - only rubber band a release signifies a complete . We know the opposite corner figure out the others and push them onto the back of the vertex list and emit a complete . For rotated rectangles If we ' re finishing dragging the first side store the end point . For polygons Do nothing this is taken care of on press . @param p Current mouse Location @param s Which mouse button was released
void RubberBandTool::mouseButtonRelease(QPoint p, Qt::MouseButton s) {
    if ((s & Qt::ControlModifier) == Qt::ControlModifier)
      *p_mouseLoc = snapMouse(p);
    else
      *p_mouseLoc = p;
    p_mouseButton = s;
    if((s & Qt::LeftButton) == Qt::LeftButton || p_allClicks) {
      p_mouseDown = false;
    }
    else {
      return;
    }
    switch(p_bandingMode) {
      case AngleMode: {
          if(p_vertices->size() == 3) {
            reset();
          }
          p_vertices->push_back(*p_mouseLoc);
          p_tracking = true;
          if(p_vertices->size() == 3) {
            p_tracking = false;
            emit bandingComplete();
          }
        }
        break;
      case LineMode:
      case CircleMode:
      case EllipseMode:
      case RectangleMode: {
          *p_vertices = vertices();
          p_tracking = false;
          emit bandingComplete();
        }
        break;
      case RotatedRectangleMode: {
          if(p_vertices->size() == 1) {
            p_vertices->push_back(*p_mouseLoc);
          }
          else if(p_vertices->size() == 2) {
            *p_vertices = vertices();
            p_tracking = false;
            emit bandingComplete();
          }
        }
        break;
      case SegmentedLineMode:
      case PolygonMode:
        break;
    }
    p_doubleClicking = false; 
    MdiCubeViewport * activeViewport = cubeViewport();
    for (int i = 0; i < (int) cubeViewportList()->size(); i++) {
      MdiCubeViewport * curViewport = cubeViewportList()->at(i);
      if (curViewport == activeViewport ||
          (activeViewport->isLinked() && curViewport->isLinked())) {
        curViewport->viewport()->repaint();
      }
    }
  }
void RubberBandTool :: mouseButtonRelease ( QPoint p , Qt :: MouseButton s ) { if ( ( s & Qt :: ControlModifier ) == Qt :: ControlModifier ) * p_mouseLoc = snapMouse ( p ) ; else * p_mouseLoc = p ; p_mouseButton = s ; if ( ( s & Qt :: LeftButton ) == Qt :: LeftButton || p_allClicks ) { p_mouseDown = false ; } else { return ; } switch ( p_bandingMode ) { case AngleMode : { if ( p_vertices -> size ( ) == 3 ) { reset ( ) ; } p_vertices -> push_back ( * p_mouseLoc ) ; p_tracking = true ; if ( p_vertices -> size ( ) == 3 ) { p_tracking = false ; emit bandingComplete ( ) ; } } break ; case LineMode : case CircleMode : case EllipseMode : case RectangleMode : { * p_vertices = vertices ( ) ; p_tracking = false ; emit bandingComplete ( ) ; } break ; case RotatedRectangleMode : { if ( p_vertices -> size ( ) == 1 ) { p_vertices -> push_back ( * p_mouseLoc ) ; } else if ( p_vertices -> size ( ) == 2 ) { * p_vertices = vertices ( ) ; p_tracking = false ; emit bandingComplete ( ) ; } } break ; case SegmentedLineMode : case PolygonMode : break ; } p_doubleClicking = false ; MdiCubeViewport * activeViewport = cubeViewport ( ) ; for ( int i = 0 ; i < ( int ) cubeViewportList ( ) -> size ( ) ; i ++ ) { MdiCubeViewport * curViewport = cubeViewportList ( ) -> at ( i ) ; if ( curViewport == activeViewport || ( activeViewport -> isLinked ( ) && curViewport -> isLinked ( ) ) ) { curViewport -> viewport ( ) -> repaint ( ) ; } } }
If this is not the left mouse button, this does nothing.
If this is not the left mouse button this does nothing .
// If we were in a double click, it's over now.