Exemplo n.º 1
0
TabletWidget::TabletWidget(bool mouseToo) : mMouseToo(mouseToo)
{
    QPalette newPalette = palette();
    newPalette.setColor(QPalette::Window, Qt::white);
    newPalette.setColor(QPalette::WindowText, Qt::black);
    setPalette(newPalette);
    qApp->installEventFilter(this);
    resetAttributes();
}
Exemplo n.º 2
0
void Display::drawHeader() {
  resetAttributes();

  // Set background to blue
//  std::cout << "\x1b[44m";
  setBackgroundColour(BLUE);

  // Set foreground to white
  std::cout << "\x1b[37m";

  // Draw header
  for(int i=0; i<columns; i++) {
    std::cout << ' ';
  }

  currentLine = 2;
}
Exemplo n.º 3
0
void Display::drawLog() {
  resetAttributes();

  std::cout << std::endl;
  currentLine++;

  for(int i = 0; i < logList.size(); i++) {

    if(currentLine > lines)
      break;

    QString log = logList.at(i);

    std::cout << log.toStdString() << std::endl;
    currentLine++;
  }
}
Exemplo n.º 4
0
void Function::postRun(MasterTimer* timer, UniverseArray* universes)
{
    Q_UNUSED(timer);
    Q_UNUSED(universes);

    qDebug() << "Function postRun. ID: " << m_id;
    m_stopMutex.lock();
    resetElapsed();
    resetAttributes();
    m_stop = true;
    //m_overrideFadeInSpeed = defaultSpeed();
    //m_overrideFadeOutSpeed = defaultSpeed();
    //m_overrideDuration = defaultSpeed();
    m_functionStopped.wakeAll();
    m_stopMutex.unlock();

    m_running = false;
    emit stopped(m_id);
}
Exemplo n.º 5
0
bool TabletWidget::eventFilter(QObject *, QEvent *ev)
{
    switch (ev->type()) {
    case QEvent::TabletEnterProximity:
    case QEvent::TabletLeaveProximity:
    case QEvent::TabletMove:
    case QEvent::TabletPress:
    case QEvent::TabletRelease:
        {
            QTabletEvent *event = static_cast<QTabletEvent*>(ev);
            mType = event->type();
            mPos = event->pos();
            mGPos = event->globalPos();
            mHiResGlobalPos = event->hiResGlobalPos();
            mDev = event->device();
            mPointerType = event->pointerType();
            mUnique = event->uniqueId();
            mXT = event->xTilt();
            mYT = event->yTilt();
            mZ = event->z();
            mPress = event->pressure();
            mTangential = event->tangentialPressure();
            mRot = event->rotation();
            mButton = event->button();
            mButtons = event->buttons();
            if (isVisible())
                update();
            break;
        }
    case QEvent::MouseMove:
        if (mMouseToo) {
            resetAttributes();
            QMouseEvent *event = static_cast<QMouseEvent*>(ev);
            mType = event->type();
            mPos = event->pos();
            mGPos = event->globalPos();
        }
    default:
        break;
    }
    return false;
}
Exemplo n.º 6
0
void Display::drawWorkOrders() {
  resetAttributes();

  for(int i = 0; i < woList.size(); i++) {

    if(currentLine > lines)
      break;

    QString wo = woList.at(i);

    if(wo.contains("ERROR"))
      setForegroundColour(RED);
    else if(wo.contains("COMPLETE"))
      setForegroundColour(GREEN);
    else
      setForegroundColour(WHITE);

    std::cout << wo.toStdString() << std::endl;
    currentLine++;
  }
}
Exemplo n.º 7
0
void Tank::resetAll(void){
	hp = 1.0f;
	powerUpDurationP = 0.f;
	powerUpDurationS = 0.f;
	powerUpDurationR = 0.f;
	weaponTimer = 0.f;

	deathTimer = 5.f;
	mDestination = Ogre::Vector3::ZERO;
	mDirection = Ogre::Vector3::ZERO;

	mMove = 0.f;
	bodyRotate = 0.f;
	turretRotation = 0.f;
	barrelRotation = 0.f;
	turretDegree = 0.f;
	barrelDegree = 0.f;

	//wee initialize here
	pathCreated = false;
	mMoveSpd = 70.0; 
	mRotSpd = 50.0; 
	//!!!
	mWalkList.clear();
	aStarPath->clear();
	tankStarted = false;
	mDistance = 0;
	currentState = A_STAR;
	sphereSceneTime = 0;

	mHealthBarBB->setTexcoordRect(0.0, 0.0, 0.5, 1.0);

	//wander initialise
	wanderAngle = 0.f;
	ANGLE_CHANGE = 10.f;

	setSelected(false);
	resetAttributes();




	checkPosition = 0;
	previousLocation = mTankBodyNode->getPosition();
	
	seekStartNode = 0;
	seekGoalNode = 0;
	seekPathCreated = false;
	seekTarget = Ogre::Vector3::ZERO ;
	mSeekList.clear();
	mSeekDestination = Ogre::Vector3::ZERO ;
	mSeekDirection = Ogre::Vector3::ZERO ;
	mSeekDistance = 0;

	resetWander();

	if(!orientationEquals(initBodyOrientation, mTankBodyNode->getOrientation()))
	{
		mTankBodyNode->setOrientation(initBodyOrientation);
	}
	if(!orientationEquals(initBarrelOrientation, mTankBarrelNode->getOrientation()))
	{
		mTankBarrelNode->setOrientation(initBarrelOrientation);
	}
	if(!orientationEquals(initTurretOrientation, mTankTurretNode->getOrientation()))
	{
		mTankTurretNode->setOrientation(initTurretOrientation);
	}

}
Exemplo n.º 8
0
void Plotter2::plot() {
    open();

    if ((width > 0.0) && (aspect > 0.0)) {
        cpgpap(width, aspect);
    }

    cpgscr(0, 1.0, 1.0, 1.0); // set background color white
    cpgscr(1, 0.0, 0.0, 0.0); // set foreground color black

    for (unsigned int i = 0; i < vInfo.size(); ++i) {
        Plotter2ViewportInfo vi = vInfo[i];

	if (vi.showViewport) {
	    resetAttributes(vi);

	    // setup viewport
            cpgsvp(vi.vpPosXMin, vi.vpPosXMax, vi.vpPosYMin, vi.vpPosYMax);
	    cpgswin(vi.vpRangeXMin, vi.vpRangeXMax, vi.vpRangeYMin, vi.vpRangeYMax);

	    // background color (default is transparent)
	    if (vi.vpBColor >= 0) {
	        cpgsci(vi.vpBColor);
	        cpgrect(vi.vpRangeXMin, vi.vpRangeXMax, vi.vpRangeYMin, vi.vpRangeYMax);
	        cpgsci(1);  // reset foreground colour to the initial one (black)
	    }

	    // data
	    for (unsigned int j = 0; j < vi.vData.size(); ++j) {
	        resetAttributes(vi);

	        Plotter2DataInfo di = vi.vData[j];
	        std::vector<float> vxdata = di.xData;
                int ndata = vxdata.size();
	        float* pxdata = new float[ndata];
	        float* pydata = new float[ndata];
	        for (int k = 0; k < ndata; ++k) {
	            pxdata[k] = di.xData[k];
	            pydata[k] = di.yData[k];
	        }

	        if (di.drawLine) {
  	            cpgsls(di.lineStyle);
	            cpgslw(di.lineWidth);
		    int colorIdx = di.lineColor;
		    if (colorIdx < 0) {
		        colorIdx = (j + 1) % 15 + 1;
		    }
	            cpgsci(colorIdx);
	            cpgline(ndata, pxdata, pydata);
	        }

	        if (di.drawMarker) {
	            cpgsch(di.markerSize);
	            cpgsci(di.markerColor);
	            cpgpt(ndata, pxdata, pydata, di.markerType);
	        }

	        delete [] pxdata;
	        delete [] pydata;
	    }

	    //calculate y-range of xmasks
	    std::vector<float> yrange = vi.getRangeY();
	    float yexcess = 0.1*(yrange[1] - yrange[0]);
	    float xmaskymin = yrange[0] - yexcess;
	    float xmaskymax = yrange[1] + yexcess;

	    // masks
	    for (unsigned int j = 0; j < vi.vRect.size(); ++j) {
	        resetAttributes(vi);

	        Plotter2RectInfo ri = vi.vRect[j];
                cpgsci(ri.color);
	        cpgsfs(ri.fill);
	        cpgslw(ri.width);
	        cpgshs(45.0, ri.hsep, 0.0);
	        float* mxdata = new float[4];
	        float* mydata = new float[4];
	        mxdata[0] = ri.xmin;
	        mxdata[1] = ri.xmax;
	        mxdata[2] = ri.xmax;
	        mxdata[3] = ri.xmin;
	        mydata[0] = xmaskymin;
	        mydata[1] = xmaskymin;
	        mydata[2] = xmaskymax;
	        mydata[3] = xmaskymax;
                cpgpoly(4, mxdata, mydata);
	    }

	    // arrows
	    for (unsigned int j = 0; j < vi.vArro.size(); ++j) {
  	        resetAttributes(vi);

		Plotter2ArrowInfo ai = vi.vArro[j];
		cpgsci(ai.color);
		cpgslw(ai.width);
                cpgsls(ai.lineStyle);
		cpgsch(ai.headSize);
		cpgsah(ai.headFillStyle, ai.headAngle, ai.headVent);
		cpgarro(ai.xtail, ai.ytail, ai.xhead, ai.yhead);
	    }

	    // arbitrary texts
	    for (unsigned int j = 0; j < vi.vText.size(); ++j) {
  	        resetAttributes(vi);

		Plotter2TextInfo ti = vi.vText[j];
		cpgsch(ti.size);
		cpgsci(ti.color);
		cpgstbg(ti.bgcolor);
		cpgptxt(ti.posx, ti.posy, ti.angle, ti.fjust, ti.text.c_str());
	    }

	    // viewport outline and ticks
	    resetAttributes(vi);

            cpgbox("BCTS",  vi.majorTickIntervalX, vi.nMinorTickWithinMajorTicksX, 
	           "BCTSV", vi.majorTickIntervalY, vi.nMinorTickWithinMajorTicksY);

	    // viewport numberings
	    std::string numformatx, numformaty;
	    if (vi.numLocationX == "b") {
	        numformatx = "N";
	    } else if (vi.numLocationX == "t") {
	        numformatx = "M";
	    } else if (vi.numLocationX == "") {
	        numformatx = "";
	    }
	    if (vi.numLocationY == "l") {
	        numformaty = "NV";
	    } else if (vi.numLocationY == "r") {
	        numformaty = "MV";
	    } else if (vi.numLocationY == "") {
	        numformaty = "";
	    }

            cpgbox(numformatx.c_str(), vi.majorTickIntervalX * vi.nMajorTickWithinTickNumsX, 0, 
	           numformaty.c_str(), vi.majorTickIntervalY * vi.nMajorTickWithinTickNumsY, 0);

	    float xpos, ypos;

	    // x-label
	    vi.getWorldCoordByWindowCoord(vi.labelXPosX, vi.labelXPosY, &xpos, &ypos);
	    cpgsch(vi.labelXSize);
            cpgsci(vi.labelXColor);
            cpgstbg(vi.labelXBColor); //outside viewports, works ONLY with /xwindow
            cpgptxt(xpos, ypos, vi.labelXAngle, vi.labelXFJust, vi.labelXString.c_str());

	    // y-label
	    vi.getWorldCoordByWindowCoord(vi.labelYPosX, vi.labelYPosY, &xpos, &ypos);
	    cpgsch(vi.labelYSize);
            cpgsci(vi.labelYColor);
            cpgstbg(vi.labelYBColor); //outside viewports, works ONLY with /xwindow
            cpgptxt(xpos, ypos, vi.labelYAngle, vi.labelYFJust, vi.labelYString.c_str());

	    // title
	    vi.getWorldCoordByWindowCoord(vi.titlePosX, vi.titlePosY, &xpos, &ypos);
	    cpgsch(vi.titleSize);
            cpgsci(vi.titleColor);
            cpgstbg(vi.titleBColor); //outside viewports, works ONLY with /xwindow
            cpgptxt(xpos, ypos, vi.titleAngle, vi.titleFJust, vi.titleString.c_str());
	}

    }

    close();
}
Exemplo n.º 9
0
areaAttribute::areaAttribute(){
   resetAttributes();
}
Exemplo n.º 10
0
void XMLTag:: parse
(
  XMLTag::XMLReader* xmlReader )
{
  preciceTrace1("parse()", _fullName);
  try {
    resetAttributes();
    if (xmlReader->getNodeType() == tarch::irr::io::EXN_ELEMENT){
      assertion(xmlReader->getNodeName() != NULL);
      preciceDebug("reading attributes of tag " << xmlReader->getNodeName());
      readAttributes(xmlReader);
      _listener.xmlTagCallback(*this);
    }

    if (_subtags.size() > 0){
      while (xmlReader->read()){
        if (xmlReader->getNodeType() == tarch::irr::io::EXN_ELEMENT){
          assertion(xmlReader->getNodeName() != NULL);
          preciceDebug("reading subtag " << xmlReader->getNodeName()
                       << " of tag " << _fullName);
          parseSubtag(xmlReader);
        }
        else if (xmlReader->getNodeType() == tarch::irr::io::EXN_ELEMENT_END){
          assertion(xmlReader->getNodeName() != NULL);
          if (std::string(xmlReader->getNodeName()) == _fullName){
            preciceDebug("end of tag " << xmlReader->getNodeName());
            areAllSubtagsConfigured();
            _configured = true;
            _listener.xmlEndTagCallback(*this);
            //resetAttributes();
            return;
          }
          else {
            std::ostringstream stream;
            if (not _fullName.empty()){
              stream << "Invalid closing tag </" << xmlReader->getNodeName() << ">";
              throw stream.str();
            }
            //else {
            //  stream << "Invalid closing tag </" << xmlReader->getNodeName()
            //         << ">, expected closing of tag <" << _fullName << "> instead";
            //}
          }
        }
      }
      if (not _name.empty()){
        std::ostringstream error;
        error << "Missing closing tag </" << _fullName << ">";
        throw error.str();
      }
    }
    else {
      _configured = true;
    }
  }
  catch (std::string errorMsg){
    if (not _name.empty()){
      errorMsg += "\n   in tag <" + _fullName + ">";
    }
    throw errorMsg;
  }
}