//--------------------------------------------------------------
void trackingManager::draw(){
	
	if (!bFocusScreenMode){
		
		// Draw Input
		ofSetColor(255,255,255);
		drawInput(0, 0, IM.width/4, IM.height/4, IM.width/4, 0, IM.width/4, IM.height/4);	

		// Draw EyeFinder
		tracker.eFinder.draw(0, IM.height/4+30, IM.width/2, IM.height/2);

		// Draw Pupil Finder	
		tracker.thresCal.drawPupilImageWithScanLine(IM.width/2 + 20, 0, tracker.pFinder.imgBeforeThreshold.width, tracker.pFinder.imgBeforeThreshold.height, tracker.pFinder.imgBeforeThreshold);
		tracker.pFinder.draw(IM.width/2 + 20, tracker.pFinder.imgBeforeThreshold.height + 30);

		// Draw Glint Finder
		tracker.gFinder.draw(IM.width/2 + 20, tracker.pFinder.imgBeforeThreshold.height*2 + 60);
		tracker.gFinder.checkBrightEye.draw(IM.width/2 + tracker.pFinder.imgBeforeThreshold.width + 40, 255 * 2 + 60);
		tracker.gFinder.contourFinderBright.draw(IM.width/2 + tracker.pFinder.imgBeforeThreshold.width + 40, 255 * 2 + 60);
		
		// Draw BrightEye, DarkEye
		ofSetColor(255,255,255);
		tracker.brightEyeImg.draw(0, IM.height/4 + IM.height/2 + 60);
		tracker.darkEyeImg.draw(tracker.targetRect.width, IM.height/4 + IM.height/2 + 60);
		
		// Draw auto threshold Line for bright/dark eye.
		tracker.briDarkFinder.drawAutoThresholdBrightnessGraph(0, IM.height/4 + IM.height/2 + 60);
		
		// Draw brightness graph
		int	tempX = IM.width/2 + tracker.pFinder.imgBeforeThreshold.width + 40;
		tracker.thresCal.drawBrightnessScanGraph(tempX, 0, tracker.pFinder.imgBeforeThreshold, false, tracker.threshold_p, tracker.threshold_g, "BrightnessScan/Horizontal");
		tracker.thresCal.drawBrightnessScanGraph(tempX, 255 + 30, tracker.pFinder.imgBeforeThreshold, true, tracker.threshold_p, tracker.threshold_g, "BrightnessScan/Vertical");

		// Draw warpedImg		
		if(tracker.bUseHomography && tracker.gFinder.bFourGlints){
			tracker.homographyCal.draw(IM.width/2 + tracker.pFinder.imgBeforeThreshold.width + 40, 255 * 2 + 60, 88*4, 64*4);
		}
				
		// Draw trail circles.
		if (bDrawRawInput) drawRawInput(ofGetWidth()/2, ofGetHeight()/2, 20);
				
	} else {
		drawInput(0, 0, IM.width, IM.height, IM.width, 0, IM.width, IM.height);
	}
	
	panel.draw();
	
	// this is temporary.
	
}
Ejemplo n.º 2
0
void TextManager::mvInput(int dire){
  drawInput(0);
  if(dire<0){
    if(inputPos>0){
      inputPos--;
      inputCol--;
    }
  }else{
    if(inputPos<16){
      inputPos++;
      inputCol++;
    }
  }
  drawInput(1);
}
Ejemplo n.º 3
0
void data()
{
	unsigned char msg_id;
	unsigned char interface_id;
	
	drawInput();
	wmove(w_in,1,1);
	waddstr(w_in,"Interface id: ");
	echo();
	wscanw(w_in,"%hhd",&interface_id);
	noecho();
	wmove(w_in,2,1);
	waddstr(w_in,"Message id: ");
	echo();
	wscanw(w_in,"%hhd",&msg_id);
	noecho();
	wmove(w_in,3,1);
	if(sensor.ReqData(interface_id,msg_id))
	{
		wprintw(w_in,"Data Requested (%hhd)",msg_id);
	}
	else
	{
		waddstr(w_in,"Data Request Failed");
	}
	wrefresh(w_in);
	
}
Ejemplo n.º 4
0
void stream()
{
	unsigned char msg_id;
	unsigned long count;
	unsigned char interface_id;

	drawInput();
	wmove(w_in,1,1);
	waddstr(w_in,"Interface id: ");
	echo();
	wscanw(w_in,"%hhd",&interface_id);
	noecho();
	wmove(w_in,2,1);
	waddstr(w_in,"Message id: ");
	echo();
	wscanw(w_in,"%hhd",&msg_id);
	noecho();
	wmove(w_in,3,1);
	waddstr(w_in,"Message count: ");
	echo();
	wscanw(w_in,"%ld",&count);
	noecho();
	wmove(w_in,4,1);
	if(sensor.ReqStream(interface_id,msg_id,count))
	{
		wprintw(w_in,"Data Requested (%hhd)",msg_id);
	}
	else
	{
		waddstr(w_in,"Stream Request Failed");
	}
	wrefresh(w_in);
}
Ejemplo n.º 5
0
void timeattone()
{
	long sec,usec;

	drawInput();
	wmove(w_in,1,1);
	waddstr(w_in,"seconds: ");
	echo();
	wscanw(w_in,"%ld",&sec);
	noecho();
	wmove(w_in,2,1);
	waddstr(w_in,"microsecons: ");
	echo();
	wscanw(w_in,"%ld",&usec);
	noecho();
	wmove(w_in,3,1);
	wprintw(w_in,"Time at Tone:");
	wmove(w_in,4,1);
	wprintw(w_in,"%ld s %ld us",sec,usec);	
	wmove(w_in,5,1);
	if(sensor.TimeAtTone(sec,usec))
	{
		waddstr(w_in,"Time at Tone Sent");
	}
	else
	{
		waddstr(w_in,"Time at Tone Failed");
	}
	wrefresh(w_in);	
}
Ejemplo n.º 6
0
void cancel()
{
	unsigned char msg_id;
unsigned char interface_id;

	drawInput();
	wmove(w_in,1,1);
	waddstr(w_in,"Interface id: ");
	echo();
	wscanw(w_in,"%hhd",&interface_id);
	noecho();
	wmove(w_in,2,1);
	waddstr(w_in,"Message id: ");
	echo();
	wscanw(w_in,"%hhd",&msg_id);
	noecho();
	wmove(w_in,3,1);
	wprintw(w_in,"Data Canceled (%hhd)",msg_id);
	wmove(w_in,4,1);
	if(sensor.Cancel(interface_id,msg_id))
	{		
		waddstr(w_in,"Cancel Sent");
	}
	else
	{
		waddstr(w_in,"Cancel Failed");
	}
	wrefresh(w_in);
}
Ejemplo n.º 7
0
void InputStream::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
    painter->setPen(QPen(getColorFrame()));
    painter->setBrush(QBrush(getColorBackground()));
    drawBackground(painter);
    drawName(painter);
    drawInput(painter);
    drawCountReceivingElements(painter);
}
Ejemplo n.º 8
0
void init()
{
	drawInput();
	wmove(w_in,1,1);
	if(sensor.Initialize())
	{
		waddstr(w_in,"Initialize Sent");
	}
	else
	{
		waddstr(w_in,"Initialize Failed");
	}
	wrefresh(w_in);
}
Ejemplo n.º 9
0
void drawGUI(void)
{
	//make main border with title
	box(stdscr,0,0);
	move(0,1);
	wprintw(stdscr,"ASIM Tester %s",SDM_VERSION);
	w_menu = subwin(stdscr,MENU_HEIGHT,MENU_WIDTH,1,1);
	w_out = subwin(stdscr,LINES-2,COLS-2-MENU_WIDTH,1,MENU_WIDTH+1);
	w_in = subwin(stdscr,LINES-2-MENU_HEIGHT,MENU_WIDTH,MENU_HEIGHT+1,1);
	drawInput();
	drawOutput();
	drawMenu();
	wrefresh(stdscr);
}
Ejemplo n.º 10
0
void selftest()
{
	drawInput();
	wmove(w_in,1,1);
	if(sensor.SelfTest())
	{
		waddstr(w_in,"Self Test Sent");
	}
	else
	{
		waddstr(w_in,"Self Test Failed");
	}
	wrefresh(w_in);
}
Ejemplo n.º 11
0
void reset()
{
	drawInput();
	wmove(w_in,1,1);
	if(sensor.Reset())
	{
		waddstr(w_in,"Reset Sent");
	}
	else
	{
		waddstr(w_in,"Reset Failed");
	}
	wrefresh(w_in);	
}
Ejemplo n.º 12
0
void xteds()
{
	drawInput();
	wmove(w_in,1,1);
	if(sensor.ReqxTEDS())
	{
		waddstr(w_in,"xTEDS Request Sent");
	}
	else
	{
		waddstr(w_in,"xTEDS Request Failed");
	}
	wrefresh(w_in);
}
Ejemplo n.º 13
0
void version()
{
	drawInput();
	wmove(w_in,1,1);
	if(sensor.ReqVersion())
	{
		waddstr(w_in,"Version Request Sent");
	}
	else
	{
		waddstr(w_in,"Version Request Failed");
	}
	wrefresh(w_in);
}
Ejemplo n.º 14
0
void powerdown()
{
	drawInput();
	wmove(w_in,1,1);
	if(sensor.PowerDown())
	{
		waddstr(w_in,"Power Down Sent");
	}
	else
	{
		waddstr(w_in,"Power Down Failed");
	}
	wrefresh(w_in);
}
Ejemplo n.º 15
0
void TextManager::getInput(int lin, int col){
  writeText(lin,col,">");  //Input indicator
  
  writeText(lin, col+1, inputPool);
  
  inputLin=lin;  //Ini input cursor
  inputCol=col+1;
  inputPos=0;
  drawInput(true);
  
  Vkey.display(100);//Vkey is a object of VirtualKeyboard class
  
  while(true){
    switch(Robot.keyboardRead()){
      case BUTTON_LEFT:
        //Robot.beep(BEEP_SIMPLE);
        mvInput(-1);
        break;
      case BUTTON_RIGHT:
        //Robot.beep(BEEP_SIMPLE);
        mvInput(1);
        break;
      case BUTTON_MIDDLE:
        //Robot.beep(BEEP_DOUBLE);
        char selection=Vkey.getSelection();
        if(selection!='\0'){
          refreshCurrentLetter(selection);
          mvInput(1);
        }else{
          drawInput(false);
          return;
        }
    }
    Vkey.run();
    delay(10);
  }
}
Ejemplo n.º 16
0
void asim_command()
{
	unsigned char cmd_id;
	short length;
	unsigned char* data;
	int i;
	unsigned char interface_id;

	drawInput();
	wmove(w_in,1,1);
	waddstr(w_in,"Interface id: ");
	echo();
	wscanw(w_in,"%hhd",&interface_id);
	noecho();
	wmove(w_in,2,1);
	waddstr(w_in,"Command id: ");
	echo();
	wscanw(w_in,"%hhd",&cmd_id);
	noecho();
	wmove(w_in,3,1);
	waddstr(w_in,"Command length: ");
	echo();
	wscanw(w_in,"%hd",&length);
	noecho();
	data = (unsigned char*)malloc(sizeof(unsigned char)*length);
	for(i=0;i<length;i++)
	{
		wmove(w_in,4+i,1);
		waddstr(w_in,"Command byte: ");
		echo();
		wscanw(w_in,"%hhd",&(data[i]));
		noecho();
	}
	wmove(w_in,5+i,1);
	if(sensor.Command(interface_id,cmd_id,length,data))
	{
		wprintw(w_in,"Command %hhd Sent",cmd_id);
	}
	else
	{
		wprintw(w_in,"Command %hhd Failed",cmd_id);
	}
	free(data);
	wrefresh(w_in);
}
Ejemplo n.º 17
0
void drawCmdLine() {
  drawInput(panelA.cmdLineOff, ROWS_CNT+6, 62-panelA.cmdLineOff);
}
Ejemplo n.º 18
0
View2D::View2D(QWidget *parent) : QWidget(parent) {
    canvas = new Canvas(this);
    guide = canvas->getGuide();
    label = new QLabel("Command: ", this);
    command = new QLineEdit(this);

    isShowInputPoints = new QCheckBox("Input Points", this);
    isShowInputPoints->setCheckState(Qt::Checked);
    isShowDelaunayEdges = new QCheckBox("Delaunay Graph", this);
    isShowDelaunayEdges->setCheckState(Qt::Unchecked);
    isShowVoronoiEdges = new QCheckBox("Voronoi Graph", this);
    isShowVoronoiEdges->setCheckState(Qt::Unchecked);
    isShowMSTreeEdges = new QCheckBox("Minimum Spanning Tree", this);
    isShowMSTreeEdges->setCheckState(Qt::Unchecked);

    pointPen.setWidth(2);
    edgePen.setWidth(2);

    buttonErase = new QPushButton("Erase", this);

    pointTable = new TableView(this);
    pointTable->setSelectionBehavior(QAbstractItemView::SelectRows);
    pointTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
    pointTable->setEditTriggers(QAbstractItemView::NoEditTriggers);

    outerLayout = new QVBoxLayout();
    mainLayout = new QHBoxLayout();
    leftLayout = new QVBoxLayout();
    rightLayout = new QVBoxLayout();
    canvasLayout = new QGridLayout();
    guideLayout = new QGridLayout();
    leftBottomLayout = new QHBoxLayout();


    inputPoints = delaunayEdges = voronoiEdges = mSTreeEdges = 0;

    menubar = new QMenuBar();
    toolbar = new QToolBar();
    menuFile = new QMenu("File", menubar);
    menubar->addMenu(menuFile);
    actionLoad = new QAction("Load", menuFile);
    actionLoad->setIcon(QIcon(":/load.icns"));
    menuFile->addAction(actionLoad);
    toolbar->addAction(actionLoad);
    menuEdit = new QMenu("Edit", menubar);
    menubar->addMenu(menuEdit);
    actionAdd = new QAction("Add", menuEdit);
    actionAdd->setIcon(QIcon(":/add.icns"));
    menuEdit->addAction(actionAdd);
    toolbar->addAction(actionAdd);
    actionZoomIn = new QAction("Zoom In", menuEdit);
    actionZoomOut = new QAction("Zoom Out", menuEdit);
    actionZoomIn->setIcon(QIcon(":/zoomin.icns"));
    actionZoomOut->setIcon(QIcon(":/zoomout.icns"));
    menuEdit->addAction(actionZoomIn);
    menuEdit->addAction(actionZoomOut);
    toolbar->addAction(actionZoomIn);
    toolbar->addAction(actionZoomOut);


    outerLayout->addWidget(toolbar);
    outerLayout->addLayout(mainLayout);
    mainLayout->addLayout(leftLayout);
    mainLayout->addLayout(rightLayout);
    leftLayout->addLayout(canvasLayout);
    leftLayout->addLayout(leftBottomLayout);
    rightLayout->addWidget(isShowInputPoints);
    rightLayout->addWidget(isShowDelaunayEdges);
    rightLayout->addWidget(isShowMSTreeEdges);
    rightLayout->addWidget(isShowVoronoiEdges);
    rightLayout->addWidget(pointTable);
    rightLayout->addWidget(buttonErase);
    canvasLayout->addWidget(canvas, 0, 0, 2, 2);
    canvasLayout->addLayout(guideLayout, 1, 1, 1, 1);
    guideLayout->addWidget(guide);
    guideLayout->setContentsMargins(0, 0, 20, 20);
    leftBottomLayout->addWidget(label);
    leftBottomLayout->addWidget(command);

    pointTable->setFixedWidth(300);
    pointTable->verticalHeader()->hide();
    pointTableModel = new QStandardItemModel(pointTable);
    pointTableModel->setHorizontalHeaderItem(0, new QStandardItem("Index"));
    pointTableModel->setHorizontalHeaderItem(1, new QStandardItem("X"));
    pointTableModel->setHorizontalHeaderItem(2, new QStandardItem("Y"));
    this->setLayout(outerLayout);

    qRegisterMetaType<Spantree::PointIds>("Spantree::PointIds");
    qRegisterMetaType<Spantree::Graph>("Spantree::Graph");

    QObject::connect(actionLoad, SIGNAL(triggered()), this, SLOT(loadFile()));
    QObject::connect(actionAdd, SIGNAL(triggered()), this, SLOT(addPointDialog()));
    QObject::connect(actionZoomIn, SIGNAL(triggered()), this->canvas, SLOT(zoomIn()));
    QObject::connect(actionZoomOut, SIGNAL(triggered()), this->canvas, SLOT(zoomOut()));

    QObject::connect(isShowInputPoints, SIGNAL(stateChanged(int)), this, SLOT(switchInputPoints()));
    QObject::connect(isShowDelaunayEdges, SIGNAL(stateChanged(int)), this, SLOT(switchDelaunayEdges()));
    QObject::connect(isShowMSTreeEdges, SIGNAL(stateChanged(int)), this, SLOT(switchMSTreeEdges()));
    QObject::connect(isShowVoronoiEdges, SIGNAL(stateChanged(int)), this, SLOT(switchVoronoiEdges()));

    QObject::connect(this, SIGNAL(datasetChange()), this, SLOT(updateItem()));

    QObject::connect(canvas->getPainter(), SIGNAL(addPoint(double, double)), this, SLOT(addPoint(double, double)));
    QObject::connect(this, SIGNAL(drawInputPoints(Spantree::PointIds)), this, SLOT(drawInput(Spantree::PointIds)));
    QObject::connect(this, SIGNAL(drawDelaunayEdges(Spantree::Graph)), this, SLOT(drawDelaunay(Spantree::Graph)));
    QObject::connect(this, SIGNAL(drawMSTreeEdges(Spantree::Graph)), this, SLOT(drawMSTree(Spantree::Graph)));
    QObject::connect(this, SIGNAL(drawVoronoiEdges(Spantree::Graph)), this, SLOT(drawVoronoi(Spantree::Graph)));
    QObject::connect(buttonErase, SIGNAL(clicked()), this, SLOT(erase()));

    QObject::connect(pointTable, SIGNAL(changehighlight(std::vector<int>)), this, SLOT(highlight(std::vector<int>)));

}
Ejemplo n.º 19
0
void drawWindowInput(uchar x, uchar y, uchar max) {
  drawInput(WINDOW_X+x, WINDOW_Y+y, max);
}