void WhiteDetectLineDlg::on_addBtn_clicked()
{
	//点击完未确定状态,此时舍弃绘制重新框选
	if (theApp.m_group_state == WhiteLineState && theApp.m_state == BaseRelease)
	{
		//触发重绘
		theApp.is_synchronous = false;
		ui->addBtn->setText(tr("取消"));
		ui->confirmBtn->setEnabled(false);
	}
	else if (theApp.m_group_state == WhiteLineState && theApp.m_state == BaseBegin)
	{
		theApp.m_state = BaseInitial;
		ui->confirmBtn->setEnabled(false);
		ui->nameEdit->setEnabled(true);
		setProcessing(false);
		ui->addBtn->setText(tr("添加"));
		emit whiteLineDone();
		return;
	}
	else
	{
		QString name = ui->nameEdit->text();

		//判断是否存在
		int foundIdx = -1;

		for (ushort i = 0; i < theApp.whiteLineGroup.size(); i++)
		{
			if (theApp.whiteLineGroup[i].name == name.toStdString())
			{
				foundIdx = i;
			}
		}

		if (foundIdx != -1)
		{
			//已存在该名字
			QMessageBox::information(this, 
				tr("重名"), 
				tr("该名称已存在!"));
			return;
		}

		ui->addBtn->setText(tr("取消"));
		ui->nameEdit->setEnabled(false);
		setProcessing(true);
		emit whiteLinebegin();
	}

	//状态控制
	theApp.m_group_state = WhiteLineState;
	theApp.m_state = BaseBegin;
}
Example #2
0
void CUIEditorView::OnLButtonUp(UINT nFlags, CPoint point)
{
	
	//查看模式是否正确
	if ( !getShowMode() ) return;

	if (m_lButtonDown)
	{
		setProcessing(false);
		m_lButtonDown = FALSE;
		m_ptMouseMovePos = CPoint(0,0);
		if (getCreateWindowFlag())
		{
			showRenameDlg();
			setCreateWindowFlag(false);
			setCreateWindow(NULL);
			::SetRect(&(m_nQuadInfo[QC_CREATE_WINDOW].quadRect),0,0,0,0);	
			SetCursor(m_BorderResponse[BRP_SELECT_WINDOW_MIDDLE_MIDDLE_QUAD].cursor);
		}
	}
	g_CoreSystem.getCEGUISystem()->injectMousePosition(point.x, point.y);
	g_CoreSystem.getCEGUISystem()->injectMouseButtonUp(CEGUI::LeftButton);
	while( ShowCursor(TRUE) < 0 );
	CView::OnLButtonUp(nFlags, point);
}
void WhiteDetectLineDlg::on_confirmBtn_clicked()
{
	if (theApp.m_group_state != WhiteLineState || theApp.m_state != BaseRelease)
	{
		QMessageBox::information(this, tr(" "),tr("名称不能为空"));
		return;
	}

	QString name = ui->nameEdit->text();
	
	WhiteLine_info info;
	info.name = name.toStdString();
	info.pos = cv::Rect(theApp.cfp_tmpRect);
	theApp.whiteLineGroup.push_back(info);

	//更新listbox
	QString itemStr;
	itemStr = QString("%1").arg(name);
	ui->list->addItem(itemStr);

	//状态控制
	theApp.m_group_state = WhiteLineState;
	theApp.m_state = BaseEnd;

	//界面控制
	ui->addBtn->setText(tr("添加"));
	ui->confirmBtn->setEnabled(false);
	ui->nameEdit->setEnabled(true);
	setProcessing(false);

	emit whiteLineDone();
}
void CNode::processData(QString gate_name, const CConstDataPointer &data)
{
    // Can we process this message now or should we keep it in a queue for later
    // ... processing?
    if(isProcessing()) {
        qDebug() << "The node"
                 << m_config.getName()
                 << "is queuing the data type"
                 << data->getType();
        // Store the name of the gate and the data it is sending in the queue.
        QPair<QString, CConstDataPointer> gate_and_data;
        gate_and_data.first = gate_name;
        gate_and_data.second = data;
        m_processing_queue.enqueue(gate_and_data);
    }
    else {
        // Set the node as processing something.
        setProcessing(true);
        // Setup and start the task in another thread.
        startGateTask(gate_name, data);
    }
}
Example #5
0
void CUIEditorView::OnLButtonDown(UINT nFlags, CPoint point)
{
	m_lButtonDown = TRUE;
	g_CoreSystem.getCEGUISystem()->injectMousePosition(point.x, point.y);
	g_CoreSystem.getCEGUISystem()->injectMouseButtonDown(CEGUI::LeftButton);
	if (m_beginDraw == DST_DRAW_PREPARE)
	{
		m_beginDraw = DST_DRAW_BEGIN;
	}

	//如果要创建窗口
	if( getCreateWindowFlag() && m_bProcessing == false && getShowMode() )
	{
		if( g_DataPool.OnCreateNewWindow(m_pSelectedWindow) )
		{
			setProcessing(true);
			CEGUI::Rect rect = m_pCreatedWindow->getPixelRect();
			m_pCreatedWindow->setPosition(CEGUI::Absolute,CEGUI::Point(point.x - rect.d_left, point.y -rect.d_top));
			//setWindowSelected(m_pCreatedWindow->getName().c_str());
		}
	}
	CView::OnLButtonDown(nFlags, point);
}
Example #6
0
bool
QA::init(void)
{
   // Open the qa-result.nc file, when available or create
   // it from scratch. Meta data checks are performed.
   // Initialisation of time and time boundary testing.
   // Eventually, entry() is called to test the data of fields.

   notes->init();  // safe

   qaExp.setParent(this);
   qaTime.setParent(this);

   // default for the qaFile
   setFilename( pIn->file );

   // apply parsed command-line args
   applyOptions();

   std::string vName(qaExp.getVarnameFromFilename());

   if(isRequiredVariable)
     pIn->pullMetaData('V', vName);

   if(isRequiredTime && !isRequiredVariable)
     pIn->pullMetaData('T');

   if(isRequiredGlobal)
     pIn->pullMetaData('G');

   initCheckStatus();

   // check for CF Convention.
   if(isCheckCF)
   {
     cF->setDataVarName(vName);
     cF->setFilename(pIn->file);
     (void) cF->run();
   }

   // exclude user-defined data variables from any checking
   pIn->excludeVars();

   qaTime.init(optStr);
   qaExp.init(optStr);

   // DRS specifications
   if(isCheckDRS_F || isCheckDRS_P)
   {
     drs_cv_table.setParent(this);
     drs_cv_table.setPath(tablePath);
     drs_cv_table.applyOptions(optStr);
     drs_cv_table.read();
   }

   // experiment specific obj: set parent, pass over options
   // check consistency between sub-sequent files or experiments
   if(isCheckCNSTY && (fileSequenceState == 's' || fileSequenceState == 'x') )
   {
      // return true for a) no previous check available,
      //                 b) deviation from a privous check are found
      if( checkConsistency(*pIn, optStr, tablePath) )
        qaExp.run();
   }
   else
     qaExp.run();

   // check existence of any data at all
   if( pIn->ncRecBeg == 0 && pIn->ncRecEnd == 0 )
   {
      isCheckData=false;

      std::string key("6_15");
      if( notes->inq( key, fileStr) )
      {
        std::string capt("No records in the file") ;

        if( notes->operate(capt) )
        {
          notes->setCheckStatus(n_data,  n_fail );
          setExitState( notes->getExitState() ) ;
        }
      }
   }

   if( isCheckData )
   {
     if( !checkDataBody() )
     {
       isCheckData = false;
       notes->setCheckStatus(n_data, n_fail);
       setExitState(2);
//       return true;
     }
   }

   if(isCheckTimeValues && !qaTime.isTime)
      notes->setCheckStatus(n_time, "FIXED");

   if(isCheckTimeValues)
   {
      if( qaTime.isTime)
      {
         if( !checkDataBody(qaTime.name) )
         {
           // time is defined, but there is no data
           qaTime.isTime = false;
           notes->setCheckStatus(n_time, n_fail);
           setExitState(2);
         }
      }
   }

   if(isCheckData || isCheckTimeValues)
   {
     notes->setConstraintFreq( qaExp.getFrequency() );

     // enable detection of outlier and replicated records
     setProcessing();

     // open netCDF for creating, continuation or resuming qa_<varname>.nc.
     // note that this must happen before checkMetaData which uses currQARec
     openQA_Nc(*pIn);

     if( isExit() || qaExp.isUseStrict || qaTime.isNoProgress )
     {
       isCheckData=false;
       return true;
     }

   }


   if( isCheckData || isCheckTimeValues )
   {
     // set pointer to function for operating tests
//     execPtr = &IObj::entry ;
     (void) entry();
   }

   return true;  // only meta-data check
}
Example #7
0
void Telnet::onSocketError()
{
    setProcessing(false);
}
Example #8
0
void Telnet::onSocketDisconnected()
{
    setProcessing(false);
    setConnected(false);
    emit disconnected();
}
Example #9
0
void CUIEditorView::OnMouseMove(UINT nFlags, CPoint point)
{
	g_CoreSystem.getCEGUISystem()->injectMousePosition(point.x, point.y);

	if( !getShowMode() ) return;

	//如果是创建窗口的过程
	if (getCreateWindowFlag())
	{
		//创建了窗口,那么改变他的大小
		if (m_pCreatedWindow)
		{
			//setWindowSelected(m_pCreatedWindow->getName().c_str());
			m_nResponseType = BRP_CREATE_NEW_WINDOW_QUAD;
		}
		SetCursor(m_BorderResponse[BRP_CREATE_NEW_WINDOW_QUAD].cursor);
	}
	else
	{
		//如果按住了CTRL那么鼠标移动的时候选择窗口
		if ( isControlDown() && getShowMode() )
		{
			CEGUI::Window* mouseWindow = g_CoreSystem.getCEGUISystem()->getWindowContainingMouse();
			if (mouseWindow)
			{
				setWindowSelected(mouseWindow->getName(),false);
			}
		}
		//检测鼠标感应
		if ( !m_bProcessing )
		{
			m_nResponseType = BRP_INVALID;
			for (INT i=0; i<BRP_NUM; i++)
			{
				if( m_BorderResponse[i].hoverRect.PtInRect(point) )
				{
					SetCursor(m_BorderResponse[i].cursor);
					m_nResponseType = (BorderResponsePos)i;
					break;
				}
			}
		}
	}

	//处理拖动和改变查看大小的操作
	if (m_lButtonDown)
	{
		if(m_nResponseType == BRP_SELECT_WINDOW_MIDDLE_MIDDLE_QUAD)
		{
			while( ShowCursor(FALSE) > 0 );
		}
		SetCursor(m_BorderResponse[m_nResponseType].cursor);
		setProcessing(true);
		processMoveAndSizing(point);
	}

	//显示鼠标位置
	CHAR szMouseText[MAX_PATH] = {0};
	sprintf(szMouseText, "鼠标(%d,%d)",point.x, point.y);
	((CMainFrame*)AfxGetMainWnd())->SetStatusText(1,szMouseText);

	updateCurrentOperationStatusText();

	SetFocus();

	CView::OnMouseMove(nFlags, point);
	
}