Пример #1
0
bool PressureCoefficientPoint::setCoef(const std::string &coef)
{
  bool ok;
  FLOAT_CHECK(coef,&ok);
  if(ok)
  {
    m_coef = STR_TO_FLOAT(coef);
    return true;
  }
  return false;
}
Пример #2
0
bool SchedulePoint::setCtrl(const std::string &ctrl)
{
  bool ok;
  FLOAT_CHECK(ctrl,&ok);
  if(ok)
  {
    m_ctrl = STR_TO_FLOAT(ctrl);
    return true;
  }
  return false;
}
Пример #3
0
bool AirflowSubelementData::setRelHt(const std::string &relHt)
{
  bool ok;
  FLOAT_CHECK(relHt,&ok);
  if(ok)
  {
    m_relHt = STR_TO_FLOAT(relHt);
    return true;
  }
  return false;
}
Пример #4
0
bool PressureCoefficientPoint::setAzm(const std::string &azm)
{
  bool ok;
  FLOAT_CHECK(azm,&ok);
  if(ok)
  {
    m_azm = STR_TO_FLOAT(azm);
    return true;
  }
  return false;
}
Пример #5
0
bool XyDataPoint::setX(const std::string &x)
{
  bool ok;
  FLOAT_CHECK(x,&ok);
  if(ok)
  {
    m_x = STR_TO_FLOAT(x);
    return true;
  }
  return false;
}
Пример #6
0
bool XyDataPoint::setY(const std::string &y)
{
  bool ok;
  FLOAT_CHECK(y,&ok);
  if(ok)
  {
    m_y = STR_TO_FLOAT(y);
    return true;
  }
  return false;
}
Пример #7
0
bool FanDataPoint::setDP(const std::string &dP)
{
  bool ok;
  FLOAT_CHECK(dP,&ok);
  if(ok)
  {
    m_dP = STR_TO_FLOAT(dP);
    return true;
  }
  return false;
}
Пример #8
0
bool FanDataPoint::setRP(const std::string &rP)
{
  bool ok;
  FLOAT_CHECK(rP,&ok);
  if(ok)
  {
    m_rP = STR_TO_FLOAT(rP);
    return true;
  }
  return false;
}
Пример #9
0
bool FanDataPoint::setMF(const std::string &mF)
{
  bool ok;
  FLOAT_CHECK(mF,&ok);
  if(ok)
  {
    m_mF = STR_TO_FLOAT(mF);
    return true;
  }
  return false;
}
Пример #10
0
bool WeatherDataImpl::setRelhum(const std::string &relhum)
{
  bool ok;
  FLOAT_CHECK(relhum,&ok);
  if(ok)
  {
    m_relhum = STR_TO_FLOAT(relhum);
    return true;
  }
  return false;
}
Пример #11
0
bool WeatherDataImpl::setWinddir(const std::string &winddir)
{
  bool ok;
  FLOAT_CHECK(winddir,&ok);
  if(ok)
  {
    m_winddir = STR_TO_FLOAT(winddir);
    return true;
  }
  return false;
}
Пример #12
0
bool WeatherDataImpl::setBarpres(const std::string &barpres)
{
  bool ok;
  FLOAT_CHECK(barpres,&ok);
  if(ok)
  {
    m_barpres = STR_TO_FLOAT(barpres);
    return true;
  }
  return false;
}
Пример #13
0
bool WeatherDataImpl::setTambt(const std::string &Tambt)
{
  bool ok;
  FLOAT_CHECK(Tambt,&ok);
  if(ok)
  {
    m_Tambt = STR_TO_FLOAT(Tambt);
    return true;
  }
  return false;
}
Пример #14
0
static int ReadSURF(LWSurface *lwsur, surfAttr *surf)
{
   unsigned char *p,r,g,b,*databuf;
   short *size,*t,s;
   int len,max;
   char     *st;

   max = lwsur->size;
   databuf = lwsur->data;
   surf->su_tx.xTextureCenter = 0.0f;
   surf->su_tx.yTextureCenter = 0.0f;
   surf->su_tx.zTextureCenter = 0.0f;
   surf->su_tx.xTextureSize = 1.0f;
   surf->su_tx.yTextureSize = 1.0f;
   surf->su_tx.zTextureSize = 1.0f;
   surf->su_tx.textureAxis = TA_Z;
   surf->su_tx.textureType = TT_CUBIC;
   surf->su_tx.textureFlags = 0;
   surf->su_tx.wTiles = 1.0f;
   surf->su_tx.hTiles = 1.0f;
   surf->su_red = 0.8f;
   surf->su_green = 0.8f;
   surf->su_blue = 0.8f;
   surf->su_lumi = 0;
   surf->su_diff = 256; // 256 = 100%
   surf->su_spec = 0;
   surf->su_refl = 0;
   surf->su_tran = 0;
   surf->su_image = NULL;


   for(len=0; len<max; databuf +=(6 + s), len+=(6 + s) )
   {
      size=(short *)&(databuf[4]);
      s=*size;
      BSWAP_W(s);
      if( STR_IS_ID(databuf,'C','O','L','R') ) //if(!strncmp(data,"COLR",4))
      {
         p=&databuf[6]; // Skip COLR, 2-byte size
         r=*p++;
         surf->su_red=r;
         surf->su_red /= 255;
         g=*p++;
         surf->su_green=g;
         surf->su_green /= 255;
         b=*p++;
         surf->su_blue=b;
         surf->su_blue /= 255;
      }
      else if( STR_IS_ID(databuf,'F','L','A','G') ) //  if(!strncmp(data,"FLAG",4))
      {
         t=(short *)&(databuf[6]);
         surf->su_flags = (short)*t;
         BSWAP_W(surf->su_flags);
      }
      else if( STR_IS_ID(databuf,'S','M','A','N') ) //  if(!strncmp(data,"SMAN",4))
      {
         float f;
         /*at = (float *)(data+6);
         f = at[0];*/
         f = STR_TO_FLOAT( (&(databuf[6])) );
         BSWAP_L(f);
         surf->su_tx.smAngle = f;
      }
      else if( STR_IS_ID(databuf,'T','R','A','N') ) // if(!strncmp(data,"TRAN",4))
      {
         t=(short *)(databuf+6);
         surf->su_tran = *t;
         BSWAP_W(surf->su_tran);
      }
      else if( STR_IS_ID(databuf,'L','U','M','I') ) // if(!strncmp(data,"LUMI",4))
      {
         t=(short *)(databuf+6);
         surf->su_lumi = *t;
         BSWAP_W(surf->su_lumi);
      }
      else if( STR_IS_ID(databuf,'S','P','E','C') ) // if(!strncmp(data,"SPEC",4))
      {
         t=(short *)(databuf+6);
         surf->su_spec = *t;
         BSWAP_W(surf->su_spec);
      }
      else if( STR_IS_ID(databuf,'D','I','F','F') ) // if(!strncmp(data,"DIFF",4))
      {
         t=(short *)(databuf+6);
         surf->su_diff = *t;
         BSWAP_W(surf->su_diff);
      }
      else if( STR_IS_ID(databuf,'C','T','E','X') ) // if(!strncmp(data,"CTEX",4))
      {
         st=(char *)databuf+6;
         surf->su_tx.textureType = TT_PLANAR;

         if( STR_IS_ID(st,'P','l','a','n') )  // if(!strncmp(st,"Plan",4))
         {
            surf->su_tx.textureType = TT_PLANAR;
         }
         else if( STR_IS_ID(st,'C','y','l','i') )  // if(!strncmp(st,"Cyli",4))
         {
            surf->su_tx.textureType = TT_CYLINDRICAL;
         }
         else if( STR_IS_ID(st,'S','p','h','e') )  // if(!strncmp(st,"Sphe",4))
         {
            surf->su_tx.textureType = TT_SPHERICAL;
         }
         else if( STR_IS_ID(st,'C','u','b','i') )  // if(!strncmp(st,"Cubi",4))
         {
            surf->su_tx.textureType = TT_CUBIC;
         }
      }
      else if( STR_IS_ID(databuf,'T','I','M','G') ) // if(chnk=='TIMG') //if(!strncmp(databuf,"TIMG",4))
      {
         surf->su_image = (char *)(databuf+6);
      }
      else if( STR_IS_ID(databuf,'T','F','P','0') ) // if(chnk=='TFP0') //if(!strncmp(databuf,"TFP0",4))  // width tiling.. for spher,cyl
      {
         float f;
         //at = (float *)(databuf+6);
         //f = at[0];
         f = STR_TO_FLOAT( (&(databuf[6])) );
         BSWAP_L(f);
         surf->su_tx.wTiles = f;
      }
      else if( STR_IS_ID(databuf,'T','F','P','1') ) // if(chnk=='TFP1') //if(!strncmp(databuf,"TFP1",4))   // height tiling.. for spher
      {
         float f;
         //at = (float *)(databuf+6);
         //f = at[0];
         f = STR_TO_FLOAT( (&(databuf[6])) );
         BSWAP_L(f);
         surf->su_tx.hTiles = f;
      }
      else if( STR_IS_ID(databuf,'T','W','R','P') ) // if(!strncmp(data,"TWRP",4))
      {
         unsigned short *f;
         f=(unsigned short *)(databuf+6);
         if(*f!=0)
            surf->su_tx.textureFlags |= TXF_UDECAL;
         f++;
         if(*f!=0)
            surf->su_tx.textureFlags |= TXF_VDECAL;
      }


      else if( STR_IS_ID(databuf,'T','C','T','R') ) // if(!strncmp(data,"TCTR",4))
      {
         float *at,f;


         at = (float *)(databuf+6);


         f = STR_TO_FLOAT( (&(databuf[6])) );
         //f = at[0];
         BSWAP_L(f);
         surf->su_tx.xTextureCenter = f;
         f = STR_TO_FLOAT( (&(databuf[10])) );
         //f = at[1];
         BSWAP_L(f);
         surf->su_tx.yTextureCenter = f;
         f = STR_TO_FLOAT( (&(databuf[14])) );
         //f = at[2];
         BSWAP_L(f);
         surf->su_tx.zTextureCenter = f;
      }
      else if( STR_IS_ID(databuf,'T','S','I','Z') ) // if(chnk=='TSIZ') //if(!strncmp(databuf,"TSIZ",4))
      {
         float *at,f;
         at = (float *)(databuf+6);
         f = STR_TO_FLOAT( (&(databuf[6])) );
         //f = at[0];
         BSWAP_L(f);
         surf->su_tx.xTextureSize = f;
         f = STR_TO_FLOAT( (&(databuf[10])) );
         //f = at[1];
         BSWAP_L(f);
         surf->su_tx.yTextureSize = f;
         f = STR_TO_FLOAT( (&(databuf[14])) );
         //f = at[2];
         BSWAP_L(f);
         surf->su_tx.zTextureSize = f;
      }
      else if( STR_IS_ID(databuf,'T','F','L','G') ) // if(chnk=='TFLG') //if(!strncmp(databuf,"TFLG",4))
      {
         unsigned short f;
         t=(short *)(databuf+6);
         f= *t;
         BSWAP_W(f);
         surf->su_tx.textureFlags |= f;
         if(f&TXF_AXIS_X)
            surf->su_tx.textureAxis = TA_X;
         else if(f&TXF_AXIS_Y)
            surf->su_tx.textureAxis = TA_Y;
         else // if(*t&TXF_AXIS_Z)
            surf->su_tx.textureAxis = TA_Z;
   //    BSWAP_W(surf->su_tx.textureFlags);
      }
   }
   return(len);
}