/**
   * Reimplementación del método mouseReleased de Behavior.
   *
   * @param e MouseEvent
   * @throws BehaviorException Excepción lanzada cuando el Behavior.
   */
  public void mouseReleased(MouseEvent e) throws BehaviorException {
    super.mouseReleased(e);
    dragged = false;
    if (getLayoutControl().getFirstPoint() == null) return;
    Point2D p1;
    Point2D p2;
    Point pScreen = getLayoutControl().getLastPoint();

    AffineTransform at = getLayoutControl().getAT();

    p1 = FLayoutUtilities.toSheetPoint(getLayoutControl().getFirstPoint(), at);
    p2 = FLayoutUtilities.toSheetPoint(pScreen, at);

    if (e.getButton() == MouseEvent.BUTTON1) {
      //	Fijamos el nuevo extent
      Rectangle2D.Double r = new Rectangle2D.Double();
      r.setFrameFromDiagonal(p1, p2);

      Rectangle2D rectPixel = new Rectangle();
      rectPixel.setFrameFromDiagonal(getLayoutControl().getFirstPoint(), pScreen);

      RectangleEvent event = new RectangleEvent(r, e, rectPixel);
      listener.rectangle(event);
    }
  }
  /**
   * @see
   *     com.iver.cit.gvsig.fmap.tools.Listeners.RectangleListener#rectangle(com.iver.cit.gvsig.fmap.tools.Events.RectangleEvent)
   */
  public void rectangle(RectangleEvent event) throws BehaviorException {
    FFrameOverView fframe =
        (FFrameOverView) FrameFactory.createFrameFromName(FFrameOverViewFactory.registerName);

    fframe.setLayout(layout);
    Rectangle2D r =
        new Rectangle2D
            .Double(); // rectOrigin.x+m_PointAnt.x,rectOrigin.y+m_PointAnt.y,m_LastPoint.x-m_PointAnt.x,m_LastPoint.y-m_PointAnt.y);

    r = getRectangle(TOLERANCE);
    fframe.setBoundBox(FLayoutUtilities.toSheetRect(r, layout.getLayoutControl().getAT()));
    FFrameOverViewDialog fframedialog = new FFrameOverViewDialog(layout, fframe);
    if (fframedialog != null) {
      fframedialog.setRectangle(fframe.getBoundingBox(layout.getLayoutControl().getAT()));
      PluginServices.getMDIManager().addWindow(fframedialog);
    }

    IFFrame newFrame = fframedialog.getFFrame();
    if (newFrame != null) {
      layout.getLayoutContext().addFFrame(newFrame, true, true);
    }
    PluginServices.getMainFrame().enableControls();
    layout.getLayoutControl().refresh();
  }