Package clips.dicom.model

Source Code of clips.dicom.model.WaveModel

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package clips.dicom.model;

import clips.dicom.waveform.DICOMWaveformGroup;
import clips.dicom.waveform.WaveDrawer;
import framework.utils.events.TypedChangeEvent;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.util.ArrayList;
import javax.swing.event.ChangeEvent;

/**
*
* @author finder
*/

public class WaveModel extends DicomModel<WaveModel.Params>{
  public static enum Params{
    vertiaclZoom,
    horizontalZoom,
    scroolPosition,
    filtring,
    wavesType,
    wavesCahge
  }
 
  WaveDrawer        drawer;
 
  @SuppressWarnings("unchecked")
  WaveModel(AgregatorItem imagesItem) {
    super(imagesItem);
    drawer = new WaveDrawer((ArrayList<DICOMWaveformGroup>)(ArrayList)imagesItem.getItems());
  }
 
  @SuppressWarnings("unchecked")
  public final void itemStateChanged(ItemEvent e) {
    setWaves((ArrayList<DICOMWaveformGroup>)(ArrayList)imagesItem.getItems());
  }
 
  final void setWaves(ArrayList<DICOMWaveformGroup> wawes){
    drawer.setWavegroups(wawes);
  }

 
  public void notifyListeners(WaveModel.Params notifyType) {
    ChangeEvent      evt = new TypedChangeEvent<Params>(this, notifyType);
    if (notifyType == null){
      notifyAllListeners(null, evt);
    }
    else {
      switch (notifyType) {
        case vertiaclZoom:
          notifyTypeListeners(Params.vertiaclZoom, evt);
          notifyTypeListeners(null, evt);
          break;
        case horizontalZoom:
          notifyTypeListeners(Params.horizontalZoom, evt);
          notifyTypeListeners(Params.scroolPosition, evt);
          notifyTypeListeners(null, evt);
          break;
        case scroolPosition:
          notifyTypeListeners(Params.scroolPosition, evt);
          notifyTypeListeners(null, evt);
          break;
        case filtring:
          notifyTypeListeners(Params.filtring, evt);
          notifyTypeListeners(null, evt);
          break;
        case wavesType:
          notifyTypeListeners(Params.wavesType, evt);
          notifyTypeListeners(null, evt);
          break;
        case wavesCahge:
          notifyAllListeners(null, evt);
          break;
      }
    }
  }

  public double getVerticalZoom() {
    return drawer.getVerticalZoom();
  }
 
  public void setVerticalZoom(double zoom) {
    drawer.setVerticalZoom(zoom);
    notifyListeners(Params.vertiaclZoom);
  }

  public void setScrollPosition(double scrollpos) {
    drawer.setScrollPosition(scrollpos);
    notifyListeners(Params.scroolPosition);
  }

  public String setMousePoint(Graphics canva, int x, int y) {
    return drawer.setMousePoint(canva, x, y);
  }

  public double getHorizontalZoom() {
    return drawer.getHorizontalZoom();
  }
 
  public void setHorizontalZoom(double zoom) {
    drawer.setHorizontalZoom(zoom);
    notifyListeners(Params.horizontalZoom);
  }
 
  public double getScrolPosition() {
    return drawer.getScrollPosition();
  }

  public double getMaxScrolPosition(Rectangle paintrect) {
    return drawer.getMaxScrolPosition(paintrect);
  }

  public boolean getFiltreUpZoomWaves() {
    return drawer.getFiltreUpZoomWaves();
  }

  public void setFiltreUpZoomWaves(boolean filtreUpZoomWaves) {
    drawer.setFiltreUpZoomWaves(filtreUpZoomWaves);
    notifyListeners(Params.filtring);
  }

  public boolean getFiltreDownZoomWaves() {
    return drawer.getFiltreDownZoomWaves();
  }
 
  public void setFiltreDownZoomWaves(boolean filtreDownZoomWaves) {
    drawer.setFiltreDownZoomWaves(filtreDownZoomWaves);
    notifyListeners(Params.filtring);
  }

  public int getWaveCount(){
    return drawer.size();
  }

  public WaveDrawer getDrawer() {
    return drawer;
  }
 
  public long getWavesTypeID(){
    return drawer.getWavesTypeID();
  }
 
  public void setWavesTypeID(long wavesTypeID) {
    drawer.setWavesTypeID(wavesTypeID);
    notifyListeners(Params.wavesType);
  }

}
TOP

Related Classes of clips.dicom.model.WaveModel

TOP
Copyright © 2018 www.massapi.com. 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.