Exemple #1
0
void Sun::advanceTime( F32 timeDelta )
{
   if (mAnimateSun)
   {
      if (mCurrTime >= mTotalTime)
      {
         mAnimateSun = false;
         mCurrTime = 0.0f;
      }
      else
      {
         mCurrTime += timeDelta;

         F32 fract   = mCurrTime / mTotalTime;
         F32 inverse = 1.0f - fract;

         F32 newAzimuth   = mStartAzimuth * inverse + mEndAzimuth * fract;
         F32 newElevation = mStartElevation * inverse + mEndElevation * fract;

         if (newAzimuth > 360.0f)
            newAzimuth -= 360.0f;
         if (newElevation > 360.0f)
            newElevation -= 360.0f;

         setAzimuth(newAzimuth);
         setElevation(newElevation);
      }
   }
}
Exemple #2
0
caScriptButton::caScriptButton(QWidget *parent) : QWidget(parent)
{

    QGridLayout *l = new QGridLayout;
    l->setMargin(0);
    displayScript = new QCheckBox();
    displayScript->setText("");
    displayScript->setGeometry(0,0,15,15);
    displayScript->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    buttonScript = new EPushButton( "Action", this );
    buttonScript->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    setFontScaleModeL(EPushButton::WidthAndHeight);

    l->addWidget(buttonScript, 0, 0);
    l->addWidget(displayScript, 0, 1);
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    setLayout(l);

    thisForeColor = Qt::black;
    thisBackColor = Qt::gray;

    thisShowExecution = false;

    connect(displayScript, SIGNAL(clicked()), this, SLOT(buttonToggled()) );
    connect(buttonScript, SIGNAL(clicked()), this, SLOT(scriptButtonClicked()) );

    installEventFilter(this);
    setAccessW(true);

    setElevation(on_top);

    setCheckboxDisplay(true);
}
Exemple #3
0
caChoice::caChoice(QWidget *parent) : QWidget(parent)
{
    numCells = 2;
    labels << "1" << "2" << "3" << "4" << "5" << "6" << "7" << "8" << "9" << "10" << "11" << "12" << "13" << "14" << "15" << "16";
    texts << "1" << "2" << "3" << "4" << "5" << "6" << "7" << "8" << "9" << "10" << "11" << "12" << "13" << "14" << "15" << "16";
    signalMapper = new QSignalMapper(this);

    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    grid = new QGridLayout(this);
    grid->setMargin(0);
    grid->setSpacing(2);

    thisStacking = Row;
    thisStartBit = 0;
    thisEndBit = 15;

    thisColorMode = Default;
    thisForeColor = QColor(0,0,0);
    thisBackColor = QColor(155,255,255);
    thisBorderColor = QColor(0,0,176);
    thisAlignment = center;
    thisScaleMode = EPushButton::WidthAndHeight;

    setAccessW(true);
    installEventFilter(this);

    populateCells(labels, -1);
    setColorMode(thisColorMode);

    setElevation(on_top);
}
bool WeatherDataModel::readLocation(QString line)
{
    QStringList list = line.split(',');
    // Require 10 items in the list
    if(list.size() > 10) {
        LOG(warning) << "Location: Expected 10 entries, got " << list.size();
    } else if(list.size() != 10) {
        LOG(error) << "Location: Expected 10 entries, got " << list.size();
        return false;
    }
    setCity(list[1].toStdString());
    setStateProvinceRegion(list[2].toStdString());
    setCountry(list[3].toStdString());
    setSource(list[4].toStdString());
    setWMO(list[5].toStdString());
    if(!setLatitude(list[6].toStdString())) {
        LOG(error) << QString("Location: Bad latitude value '%1'").arg(list[6]).toStdString();
        return false;
    }
    if(!setLongitude(list[7].toStdString())) {
        LOG(error) << QString("Location: Bad latitude value '%1'").arg(list[7]).toStdString();
        return false;
    }
    if(!setTimeZone(list[8].toStdString())) {
        LOG(error) << QString("Location: Bad time zone value '%1'").arg(list[8]).toStdString();
        return false;
    }
    if(!setElevation(list[9].toStdString())) {
        LOG(error) << QString("Location: Bad elevation value '%1'").arg(list[9]).toStdString();
        return false;
    }
    return true;
}
//------------------------------------------------------------------------------
// Event handlers
//------------------------------------------------------------------------------
bool TdElevPtr::onUpdateValue(const Basic::Number* const msg)
{
    bool ok = false;
    if (msg != 0) {
      ok = setElevation(msg->getReal());
    }
    return ok;
}
Exemple #6
0
caMessageButton::caMessageButton(QWidget *parent) : EPushButton(parent)
{
    setAccessW(true);
    thisColorMode = Static;
    thisForeColor = Qt::black;
    thisDisabledForeColor = Qt::gray;
    setBackground(QColor(0xe8, 0xe8, 0xe8));
    installEventFilter(this);

    setElevation(on_top);
}
void Camera::dragMouse( int x, int y )
{
	Vec3f mouseDelta   = Vec3f(x,y,0.0f) - mLastMousePosition;
	mLastMousePosition = Vec3f(x,y,0.0f);

	switch(mCurrentMouseAction)
	{
	case kActionTranslate:
		{
			calculateViewingTransformParameters();

			double xTrack =  -mouseDelta[0] * kMouseTranslationXSensitivity;
			double yTrack =  mouseDelta[1] * kMouseTranslationYSensitivity;

			Vec3f transXAxis = mUpVector ^ (mPosition - mLookAt);
			transXAxis /= sqrt((transXAxis*transXAxis));
			Vec3f transYAxis = (mPosition - mLookAt) ^ transXAxis;
			transYAxis /= sqrt((transYAxis*transYAxis));

			setLookAt(getLookAt() + transXAxis*xTrack + transYAxis*yTrack);
			
			break;
		}
	case kActionRotate:
		{
			float dAzimuth		=   -mouseDelta[0] * kMouseRotationSensitivity;
			float dElevation	=   mouseDelta[1] * kMouseRotationSensitivity;
			
			setAzimuth(getAzimuth() + dAzimuth);
			setElevation(getElevation() + dElevation);

			if (getAzimuth() > M_PI) 
				mAzimuth -= 2.0*M_PI;
			if (getElevation() > M_PI) 
				mElevation -= 2.0*M_PI;

			fprintf(stderr, "az %f, elev %f\n", mAzimuth, mElevation);

			break;
		}
	case kActionZoom:
		{
			float dDolly = -mouseDelta[1] * kMouseZoomSensitivity;
			setDolly(getDolly() + dDolly);
			break;
		}
	case kActionTwist:
		// Not implemented
	default:
		break;
	}

}
int main() {
   char buffer[200];
   int devfilefd, fd, i;
   float elevation, azimuth;

   readconfig();

   /* open the pseudo terminal device */
   fd=getpt();
   if (fd<0) {
      fprintf(stderr, "Unable to open serial line!\n");
      return -1;
   }
   unlockpt(fd);

   /* write the device file */

   devfilefd = open(PSEUDODEVICEFILE, O_WRONLY|O_CREAT, 0666);
   write(devfilefd, (char*)ptsname(fd), strlen((char*)ptsname(fd)));
   close(devfilefd);


   /* open the fodtrack device */

   openfodtrack(fodtrackdev);

   /* print informations about the devices */

   printf("Using %s as pseudo terminal device.\n", ptsname(fd));
   printf("Using %s as port for the fodtrack device.\n", fodtrackdev);

   /* going for the background */

   daemon(0,0);


   /* Main loop - reads from the device, and sets the antenna on the output */

   for(;;) {
      usleep(100);
      i=read(fd, buffer, 199);
      if(i>0) {
          sscanf(buffer, "AZ%f  EL%f", &azimuth, &elevation);
          /*printf("New Data:\nElevation: %f\nAzimuth: %f\n\n", elevation, azimuth);*/
          setElevation(elevation);
          setAzimuth(azimuth);
      }
   }
}
 void Opcode80A9::_run()
 {
     Logger::debug("SCRIPT") << "[80A9] [+] void override_map_start(int x, int y, int elevation, int orientation)" << std::endl;
     auto orientation = _script->dataStack()->popInteger();
     auto elevation = _script->dataStack()->popInteger();
     auto y = _script->dataStack()->popInteger();
     auto x = _script->dataStack()->popInteger();
     auto position = y*200 + x;
     auto game = Game::Game::getInstance();
     auto player = game->player();
     auto hexagon = game->locationState()->hexagonGrid()->at(position);
     Game::getInstance()->locationState()->moveObjectToHexagon(player, hexagon);
                 //player->setPosition(position);
     player->setOrientation(orientation);
     player->setElevation(elevation);
     Game::Game::getInstance()->locationState()->centerCameraAtHexagon(player->hexagon());
 }
Exemple #10
0
caNumeric::caNumeric(QWidget *parent) : ENumeric(parent)
{
     setStyleSheet("");

     setAccessW(true);
     setPrecisionMode(Channel);
     setLimitsMode(Channel);
     setMaxValue(100000.0);
     setMinValue(-100000.0);
     thisFixedFormat = false;
     thisColorMode = Static;
     setDigitsFontScaleEnabled(true);
     setForeground(Qt::black);

     renewStyleSheet = true;
     setBackground(QColor(230,230,230));
     setElevation(on_top);
}
void TerrainTile::decode(const int bitset)
{
  clearFlags();

  if (bitset & 0x1)    {  setTree(true);      }
  if (bitset & 0x2)    {  setRock(true);      }
  if (bitset & 0x4)    {  setWater(true);     }
  if (bitset & 0x8)    {  setBuilding(true);  }
  if (bitset & 0x10)   {  setTree(true);      }
  if (bitset & 0x20)   {  setGarden(true);    }
  if (bitset & 0x40)   {  setRoad(true);      }
  if (bitset & 0x100)  {  setAqueduct(true);  }

  if (bitset & 0x200)  {  setElevation(true); }
  if (bitset & 0x400)  {  setRock( true );    }
  if (bitset & 0x800)  {  setMeadow(true);    }
  if (bitset & 0x4000) {  setWall(true);      }
  if (bitset & 0x8000) {  setGateHouse(true); }
}
Exemple #12
0
void ScatterSky::_updateTimeOfDay( TimeOfDay *timeOfDay, F32 time )
{
   setElevation( timeOfDay->getElevationDegrees() );
   setAzimuth( timeOfDay->getAzimuthDegrees() );
}
Exemple #13
0
void ScatterSky::unpackUpdate(NetConnection *con, BitStream *stream)
{
   Parent::unpackUpdate(con, stream);

   if ( stream->readFlag() ) // TimeMask
   {
      F32 temp = 0;
      stream->read( &temp );
      setAzimuth( temp );

      stream->read( &temp );
      setElevation( temp );
   }

   if ( stream->readFlag() ) // UpdateMask
   {
      stream->read( &mRayleighScattering );
      stream->read( &mRayleighScattering4PI );

      stream->read( &mMieScattering );
      stream->read( &mMieScattering4PI );

      stream->read( &mSunSize );

      stream->read( &mSkyBrightness );

      stream->read( &mMiePhaseAssymetry );

      stream->read( &mSphereInnerRadius );
      stream->read( &mSphereOuterRadius );

      stream->read( &mScale );

      ColorF tmpColor( 0, 0, 0 );

      stream->read( &tmpColor );

      stream->read( &mWavelength4[0] );
      stream->read( &mWavelength4[1] );
      stream->read( &mWavelength4[2] );

      stream->read( &mRayleighScaleDepth );
      stream->read( &mMieScaleDepth );

      stream->read( &mNightColor );
      stream->read( &mNightFogColor );
      stream->read( &mAmbientScale );
      stream->read( &mSunScale );
      stream->read( &mFogScale );
	  F32 colorizeAmt;
      stream->read( &colorizeAmt );

      if(mColorizeAmt != colorizeAmt) {
         mColorizeAmt = colorizeAmt;
         mShader = NULL; //forces shader refresh
      }

      stream->read( &mColorize );


      if ( tmpColor != mWavelength )
      {
         mWavelength = tmpColor;
         mWavelength4[0] = mPow(mWavelength[0], 4.0f);
         mWavelength4[1] = mPow(mWavelength[1], 4.0f);
         mWavelength4[2] = mPow(mWavelength[2], 4.0f);
      }

      stream->read( &mExposure );

      stream->read( &mBrightness );

      mCastShadows = stream->readFlag();

      stream->read( &mFlareScale );

      if ( stream->readFlag() )
      {
         SimObjectId id = stream->readRangedU32( DataBlockObjectIdFirst, DataBlockObjectIdLast );
         LightFlareData *datablock = NULL;

         if ( Sim::findObject( id, datablock ) )
            mFlareData = datablock;
         else
         {
            con->setLastError( "ScatterSky::unpackUpdate() - invalid LightFlareData!" );
            mFlareData = NULL;
         }
      }
      else
         mFlareData = NULL;

      mMoonEnabled = stream->readFlag();
      stream->read( &mMoonMatName );
      stream->read( &mMoonScale );
      stream->read( &mMoonTint );
      mUseNightCubemap = stream->readFlag();
      stream->read( &mNightCubemapName );

      stream->read( &mMoonAzimuth );
      stream->read( &mMoonElevation );

      mLight->unpackExtended( stream );

      if ( isProperlyAdded() )
      {
         mDirty = true;
         _initMoon();
         Sim::findObject( mNightCubemapName, mNightCubemap );
      }
   }
}
Exemple #14
0
void VisualBall::setDistanceEst(estimate ball_est)
{
    setBearingWithSD(ball_est.bearing);
    setElevation(ball_est.elevation);
    setDistanceWithSD(ball_est.dist);
}
void Baro::reset(const StateVector& state)
{
  setElevation(state(POSITION_Z) + getElevation());
}
Exemple #16
0
void 
ViewLightGL::setElevation(int elevation)
{
  setElevation(double(elevation));
}