Android Open Source - Visu Channel






From Project

Back to project page Visu.

License

The source code is released under:

Apache License

If you think the Android project Visu listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.ufavaloro.android.visu.draw.channel;
//w  ww. j a v a  2s.  c  om
import java.text.DecimalFormat;
import java.util.ArrayList;

import com.ufavaloro.android.visu.draw.RGB;
import com.ufavaloro.android.visu.storage.datatypes.StudyData;
import com.ufavaloro.android.visu.study.StudyType;

public class Channel {

  private SignalBox mSignalBox;
  private InfoBox mInfoBox;
  private int mAdcChannelNumber;
  private int mChannelIndex;
  private boolean mOnline;
  private boolean mPaused;
  private static int mWidth;
  private double mWidthMarginPercent = 0.95;
  private static int mHeight;
  private double mHeightMarginPercent = 0.95;
  private static int mTotalScreenHeight;
  private static double mSignalBoxWidthPercent = 0.8;
  private static double mInfoBoxWidthPercent = 1 - mSignalBoxWidthPercent;
  private RGB mColor;
  private StudyData mStudyData;
  
  // Offline channel constructor
  public Channel(int channelNumber, int totalScreenHeight, int totalScreenWidth
           , RGB channelColor, StudyData studyData) {
    mStudyData = studyData;
    mAdcChannelNumber = channelNumber;
    mWidth = (int) (totalScreenWidth);
    mTotalScreenHeight = totalScreenHeight;
    mColor = channelColor;
    setOnline(false);
    mPaused = false;
    
    // Creo SignalBox
    SignalBox.setWidth((float) (totalScreenWidth*mSignalBoxWidthPercent));
    mSignalBox = new SignalBox(channelNumber, studyData);
    
    // Creo InfoBox
    InfoBox.setWidth((float) (totalScreenWidth*mInfoBoxWidthPercent));
    InfoBox.setVerticalDivisorXPosition((int) SignalBox.getWidth());
    mInfoBox = new InfoBox(channelNumber, studyData);
  }
  
  // Online channel constructor
  public Channel(int channelNumber, int totalScreenHeight, int totalScreenWidth
           , RGB channelColor, int totalPages, StudyData studyData) {
    setStudyData(studyData);
    mAdcChannelNumber = channelNumber;
    mWidth = (int) (totalScreenWidth);
    mTotalScreenHeight = totalScreenHeight;
    mColor = channelColor;
    setOnline(true);
    mPaused = false;
    
    // Creo SignalBox
    SignalBox.setWidth((float) (totalScreenWidth*mSignalBoxWidthPercent));
    mSignalBox = new SignalBox(channelNumber, totalPages, studyData);
    
    // Creo InfoBox
    InfoBox.setWidth((float) (totalScreenWidth*mInfoBoxWidthPercent));
    InfoBox.setVerticalDivisorXPosition((int) SignalBox.getWidth());
    mInfoBox = new InfoBox(channelNumber, studyData);
  }
  
  public void update(int totalChannels, int channelIndex) {
    // Actualizo Altura
    mHeight = (mTotalScreenHeight/totalChannels);
    // Actualizo ?ndice del canal
    mChannelIndex = channelIndex;
    // Actualizo SignalBox
    mSignalBox.update(mHeight, mChannelIndex);
    //Actualizo InfoBox
    mInfoBox.update(mHeight, mChannelIndex);
  }

  public static double getSignalBoxWidthPercent() {
    return mSignalBoxWidthPercent;
  }
  
  public SignalBox getSignalBox() {
    return mSignalBox;
  }
  
  public void setSignalBox(SignalBox mSignalBox) {
  this.mSignalBox = mSignalBox;
  }

  public InfoBox getInfoBox() {
    return mInfoBox;
  }

  public void setInfoBox(InfoBox mInfoBox) {
    this.mInfoBox = mInfoBox;
  }

  public int getChannelNumber() {
    return mAdcChannelNumber;
  }
  
  public void storeSamples(short[] samples) {
    mSignalBox.getDrawBuffer().storeSamples(samples);
  }
  
  public RGB getColor() {
    return mColor;
  }
  
  public void setColor(RGB color) {
    mColor = color;
  }
  
  public static int getWidth() {
    return mWidth;
  }
  
  public static int getHeight() {
    return mHeight;
  }

  public StudyData getStudyData() {
    return mStudyData;
  }

  public void setStudyData(StudyData studyData) {
    mStudyData = studyData;
  }

  public float getHorizontalZoom() {
    return mSignalBox.getDrawBuffer().getHorizontalZoom();
  }
  
  public void setHorizontalZoom(float newZoomValue) {
    mSignalBox.updateHorizontalZoom(newZoomValue);
  }
  
  public float getVerticalZoom() {
    return mSignalBox.getDrawBuffer().getVerticalZoom();
  }
  
  public void setVerticalZoom(float newZoomValue) {
    mSignalBox.updateVerticalZoom(newZoomValue);
  }

  public boolean isOnline() {
    return mOnline;
  }

  public void setOnline(boolean mOnline) {
    this.mOnline = mOnline;
  }

  
  public boolean isPaused() {
    return mPaused;
  }

  public void setPaused(boolean mPaused) {
    this.mPaused = mPaused;
  }
  
  public void setStudyType(int studyType) {
    mInfoBox.studyData.getAcquisitionData().setStudyType(studyType);
  }
  
  public void setPatientNameSurname(String patientName, String patientSurname) {
    
  }
  
  public void setStudyName(String studyName) {
    
  }

  public void setAMax(double aMax) {
    mSignalBox.studyData.getAcquisitionData().setAMax(aMax);
  }
  
  public void setAMin(double aMin) {
    mSignalBox.studyData.getAcquisitionData().setAMin(aMin);
  }
  
}




Java Source Code List

com.samsung.sprc.fileselector.FileData.java
com.samsung.sprc.fileselector.FileListAdapter.java
com.samsung.sprc.fileselector.FileOperation.java
com.samsung.sprc.fileselector.FileSelector.java
com.samsung.sprc.fileselector.FileUtils.java
com.samsung.sprc.fileselector.OnHandleFileListener.java
com.samsung.sprc.fileselector.SaveLoadClickListener.java
com.samsung.sprc.fileselector.TextViewWithImage.java
com.ufavaloro.android.visu.UI.ChannelOptionsDialog.java
com.ufavaloro.android.visu.UI.LoadFileFromGoogleDriveDialog.java
com.ufavaloro.android.visu.UI.LoadFileFromLocalStorageDialog.java
com.ufavaloro.android.visu.UI.MainActivity.java
com.ufavaloro.android.visu.UI.MainMenuDialog.java
com.ufavaloro.android.visu.UI.NewStudyDialog.java
com.ufavaloro.android.visu.UI.OfflineChannelPropertiesDialog.java
com.ufavaloro.android.visu.UI.OnlineChannelPropertiesDialog.java
com.ufavaloro.android.visu.UI.StopStudyDialog.java
com.ufavaloro.android.visu.bluetooth.BluetoothProtocolMessage.java
com.ufavaloro.android.visu.bluetooth.BluetoothProtocol.java
com.ufavaloro.android.visu.bluetooth.BluetoothServiceMessage.java
com.ufavaloro.android.visu.bluetooth.BluetoothService.java
com.ufavaloro.android.visu.draw.BitmapManager.java
com.ufavaloro.android.visu.draw.DrawHelper.java
com.ufavaloro.android.visu.draw.RGB.java
com.ufavaloro.android.visu.draw.ReferenceMatrix.java
com.ufavaloro.android.visu.draw.TouchPointer.java
com.ufavaloro.android.visu.draw.channel.ChannelList.java
com.ufavaloro.android.visu.draw.channel.Channel.java
com.ufavaloro.android.visu.draw.channel.DrawBuffer.java
com.ufavaloro.android.visu.draw.channel.InfoBox.java
com.ufavaloro.android.visu.draw.channel.Label.java
com.ufavaloro.android.visu.draw.channel.ScreenElement.java
com.ufavaloro.android.visu.draw.channel.SignalBox.java
com.ufavaloro.android.visu.storage.DataConversion.java
com.ufavaloro.android.visu.storage.SamplesBuffer.java
com.ufavaloro.android.visu.storage.StorageHelperMessage.java
com.ufavaloro.android.visu.storage.StorageHelper.java
com.ufavaloro.android.visu.storage.StudyDataParser.java
com.ufavaloro.android.visu.storage.datatypes.AcquisitionData.java
com.ufavaloro.android.visu.storage.datatypes.AdcData.java
com.ufavaloro.android.visu.storage.datatypes.PatientData.java
com.ufavaloro.android.visu.storage.datatypes.StorageData.java
com.ufavaloro.android.visu.storage.datatypes.StudyData.java
com.ufavaloro.android.visu.storage.googledrive.GoogleDriveClientMessage.java
com.ufavaloro.android.visu.storage.googledrive.GoogleDriveClient.java
com.ufavaloro.android.visu.storage.googledrive.GoogleDriveManagerMessage.java
com.ufavaloro.android.visu.storage.googledrive.GoogleDriveManager.java
com.ufavaloro.android.visu.storage.local.LocalStorageManager.java
com.ufavaloro.android.visu.study.StudyMessage.java
com.ufavaloro.android.visu.study.StudyType.java
com.ufavaloro.android.visu.study.Study.java