当前位置: 首页>>代码示例>>C++>>正文


C++ CDate::Convert2SM方法代码示例

本文整理汇总了C++中CDate::Convert2SM方法的典型用法代码示例。如果您正苦于以下问题:C++ CDate::Convert2SM方法的具体用法?C++ CDate::Convert2SM怎么用?C++ CDate::Convert2SM使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CDate的用法示例。


在下文中一共展示了CDate::Convert2SM方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ComputeHighResolutionFields

//----------------------------------------
void CProductErs::ComputeHighResolutionFields(CDataSet* dataSet, double deltaLat, double deltaLon)
{
  // Save current recordset pointer
  CRecordSet* currentRecordSetOld = dataSet->GetCurrentRecordSet();

  //dataSet->SetCurrentRecordSet(dataSet->GetFirstRecordSet());

  CFieldSetDbl *fieldSetLat = NULL;
  CFieldSetDbl *fieldSetLon = NULL;
  CFieldSetDbl *fieldSetTimeStampSecond = NULL;
  CFieldSetDbl *fieldSetTimeStampMicrosecond = NULL;

  int32_t count = dataSet->size();

  for (int32_t index = 0 ; index < count ; index++)
  {
    dataSet->SetCurrentRecordSet(index);

    fieldSetLat = dataSet->GetFieldSetAsDbl( m_fieldNameEquivalence.Exists(m_latitudeFieldName) );
    fieldSetLon = dataSet->GetFieldSetAsDbl( m_fieldNameEquivalence.Exists(m_longitudeFieldName) );
    fieldSetTimeStampSecond = dataSet->GetFieldSetAsDbl( m_fieldNameEquivalence.Exists(m_timeStampSecondFieldName) );
    fieldSetTimeStampMicrosecond = dataSet->GetFieldSetAsDbl( m_fieldNameEquivalence.Exists(m_timeStampMicrosecondFieldName) );

    // Compute latitude
    if (fieldSetLat != NULL)
    {
      fieldSetLat->m_value = CTools::Plus(fieldSetLat->m_value, 
                                          CTools::Multiply(deltaLat, 
                                                           static_cast<double>(index - m_refPoint)));
    }

    // Compute longitude
    if (fieldSetLon != NULL)
    {
      //fieldSetLon->m_value = CTools::NormalizeLongitude(-180,  
      //                                                  CTools::Plus(fieldSetLon->m_value, 
      //                                                               CTools::Multiply(deltaLon, 
      //                                                                                static_cast<double>(index - m_refPoint))));
      fieldSetLon->m_value = CTools::Plus(fieldSetLon->m_value, 
                                          CTools::Multiply(deltaLon, 
                                                           static_cast<double>(index - m_refPoint)));
    }

    // Compute timestamp
    
    // WARNING -  fieldSetTimeStampSecond, fieldSetTimeStampMicrosecond are converted to SI
    // after they have been read. So their value are stated in seconds
    
    // fieldSetTimeStampSecond = number of seconds from reference SI unit (i.e. 1950-01-01 00:00:00.0)
    
    // fieldSetTimeStampMicrosecond = number of museconds  within the seconds ( < 1 second)
    
    double nbSeconds = 0;

    if (fieldSetTimeStampSecond != NULL)
    {
      nbSeconds = CTools::Plus(nbSeconds, fieldSetTimeStampSecond->m_value);
    }

    if (fieldSetTimeStampMicrosecond != NULL)
    {
      nbSeconds = CTools::Plus(nbSeconds, fieldSetTimeStampMicrosecond->m_value);
    }
    
    nbSeconds = CTools::Plus(nbSeconds, 
                             CTools::Multiply(m_deltaTimeHighResolution, 
                                              static_cast<double>(index - m_refPoint)));
    double seconds;
    double muSeconds;

    CDate timeStamp;
    timeStamp.SetDate(nbSeconds);

    //WARNING At this point,
    // fieldSetTimeStampSecond is stated  in number of seconds and fieldSetTimeStampMicrosecond in numbers of microseconds
    timeStamp.Convert2SM(seconds,
                         muSeconds);

    // WARNING -  fieldSetTimeStampSecond, fieldSetTimeStampMicrosecond are converted to SI
    // after they have been read. So their value are stated in seconds
    //
    //WARNING At this point, muSeconds is stated in numbers of microseconds
    //
    // ====> Convert again muSeconds to a number of seconds     

    if (fieldSetTimeStampSecond != NULL)
    {
      fieldSetTimeStampSecond->m_value = seconds;
    }

    if (fieldSetTimeStampMicrosecond != NULL)
    {
      fieldSetTimeStampMicrosecond->m_value = muSeconds / 1.0E+6;
    }
      

    /*  
    // WARNING -  convert fieldSetTimeStampSecond, fieldSetTimeStampMicrosecond in SI
    // after they have been read. So their value are stated in seconds
//.........这里部分代码省略.........
开发者ID:adakite,项目名称:main,代码行数:101,代码来源:ProductErs.cpp


注:本文中的CDate::Convert2SM方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。