Package de.offis.faint.gui.events

Examples of de.offis.faint.gui.events.EventRegionSelectionChanged


    public void mouseClicked(MouseEvent e) {
      Region selectedRegion = getRegionUnderCursor(e);
      if (isCursorOnIcon(e, iconTraining, trainingDelta))
        mainFrame.eventDispatcher.dispatchEvent(new EventModifyTrainingData(selectedRegion, !selectedRegion.isUsedForTraining()));
      else if (isCursorOnIcon(e, iconCorner, cornerDelta))
        mainFrame.eventDispatcher.dispatchEvent(new EventRegionSelectionChanged(selectedRegion));       
      repaint();
    }
View Full Code Here


      MainController.getInstance().getFaceDB().put(null, event.getName());
    }
   
    // Selected region changed
    else if (incomingEvent instanceof EventRegionSelectionChanged){
      EventRegionSelectionChanged event = (EventRegionSelectionChanged) incomingEvent;
      Region newRegion = event.getRegion();
     
      if (newRegion != null){
        ImageModel image = new ImageModel(newRegion.getImage());
        if (currentImage == null || !currentImage.equals(image))
        {
          dispatchEvent(new EventOpenImage(image));
         
          if (currentImage == null || !currentImage.equals(image))
            newRegion = null;
        }
      }
     
      if (currentRegion == null || !currentRegion.equals(newRegion)){
        currentRegion = newRegion;
        mainFrame.browserTab.getImagePanel().setSelectedRegion(newRegion);
        mainFrame.browserTab.getAnnotationPanel().setSelectedRegion(newRegion);
      }
     
      // Make sure browser tab is active
      if (currentRegion != null)
        this.dispatchEvent(new EventShowTab(MainFrame.TAB.BROWSER));
    }
   
    // AnnotationPanel has to be updated
    else if (incomingEvent instanceof EventUpdateAnnotationPanel) {
      mainFrame.browserTab.getAnnotationPanel().updateFromModel();     
    }
   
    // Delete selected region
    else if (incomingEvent instanceof EventDeleteRegion) {
      EventDeleteRegion event = (EventDeleteRegion) incomingEvent;
     
      // Delete region from database
      MainController.getInstance().getFaceDB().deleteRegion(event.getRegion());
     
      // Update view
      if (event.getRegion().getImage().equals(currentImage.getFile().getAbsolutePath())){
       
        mainFrame.browserTab.getAnnotationPanel().updateFromModel();
        mainFrame.browserTab.getImagePanel().repaint();
      }     
    }

    // Run Face Detection on current image
    else if (incomingEvent instanceof EventDetectFacesOnCurrentImage) {
     
      DetectionDialog dialog = mainFrame.browserTab.getDetectionDialog();
     
      dialog.performDetection(this.currentImage);
    }
   
    // Run Face Recognition on selected region
    else if (incomingEvent instanceof EventRecognizeFace) {
      EventRecognizeFace event = (EventRecognizeFace) incomingEvent;
     
      mainFrame.setEnabled(false);
     
      HashMap<String, Integer> recognitionResult = (MainController.getInstance().recognizeFace(event.getRegion()));
     
      if (this.currentRegion == event.getRegion())
        mainFrame.browserTab.getImagePanel().getClassificationPanel().updateRecognitionData(recognitionResult);
     
      mainFrame.setEnabled(true);
    }
   
    // Change minimum size of scan window
    else if (incomingEvent instanceof EventChangeScanWindowSize) {
        EventChangeScanWindowSize event = (EventChangeScanWindowSize) incomingEvent;
      MainController.getInstance().setScanWindowSize(event.getNewSize());
      mainFrame.browserTab.getImagePanel().repaint();
    }
   
    // Update menu bar
    else if (incomingEvent instanceof EventUpdateMenuBar) {
      EventUpdateMenuBar event = (EventUpdateMenuBar) incomingEvent;
      mainFrame.browserTab.getMenuBar().update(event.isDetectionAllowed());
    }
   
    // Shut down application and save settings
    else if (incomingEvent instanceof EventShutdownMainFrame) {
        MainController.getInstance().getDetectionHotSpot().serializeContent();
View Full Code Here

        int deltaY = currentRegion.getY() - (int) Math.round(p.getY());
        radiusDelta = (int)Math.abs(Math.sqrt(deltaX*deltaX + deltaY*deltaY)-(currentRegion.getHeight()/2));
      }
      else {
        mode = Mode.CREATE;
        mainFrame.eventDispatcher.dispatchEvent(new EventRegionSelectionChanged(null));       
      }
    }
View Full Code Here

       
        newRegionA = null;
       
        MainController.getInstance().getFaceDB().put(r,Constants.UNKNOWN_FACE);       
        mainFrame.eventDispatcher.dispatchEvent(new EventUpdateAnnotationPanel());
        mainFrame.eventDispatcher.dispatchEvent(new EventRegionSelectionChanged(r));
      }
     
      mode = Mode.NORMAL;
    }
View Full Code Here

     */
    public void mouseClicked(MouseEvent e){
      requestFocus();
      if (currentImageModel != null){
        Region r = currentImageModel.getRegionAtPoint(imageViewBehaviour.viewToModel(e.getPoint()));
        mainFrame.eventDispatcher.dispatchEvent(new EventRegionSelectionChanged(r));
      }
      imageCursorBehaviour.updateCursor(e.getPoint());
    }
View Full Code Here

     *
     *  (non-Javadoc)
     * @see javax.swing.event.InternalFrameListener#internalFrameClosing(javax.swing.event.InternalFrameEvent)
     */
    public void internalFrameClosing(InternalFrameEvent e) {
      mainFrame.eventDispatcher.dispatchEvent(new EventRegionSelectionChanged(null));
    }
View Full Code Here

        if (!e.getValueIsAdjusting()){
          Region region = null;
          if (table.getSelectedColumn()!=-1)
            region = (Region) table.getAnnotationModel().getValueAt(0, table.getSelectedColumn());
          if ((currentRegion != null && region == null) || (region != null && !region.equals(currentRegion))){
            mainFrame.eventDispatcher.dispatchEvent(new EventRegionSelectionChanged(region));
          }
        }
      }
View Full Code Here

TOP

Related Classes of de.offis.faint.gui.events.EventRegionSelectionChanged

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.