//---------------------------------------- void CSelectionCriteriaDlg::StoreCriteriaValueDatetime(CProduct* product, bool checkDefault /* = true */) { if (product == NULL) { return; } if (!product->HasDatetimeCriteria()) { return; } CCriteriaDatetime* criteria = product->GetDatetimeCriteria(); criteria->SetDefaultValue(); double defaultValue; CTools::SetDefaultValue(defaultValue); CDate dateMin; CDate dateMax; double min = 0.0; double max = 0.0; dateMin.InitDateZero(); dateMax.SetDateNow(); /* CDate dateMin; CDate dateMax; dateMin.SetDefaultValue(); dateMax.SetDefaultValue(); GetCritDateMin()->GetValue(dateMin, defaultValue); GetCritDateMax()->GetValue(dateMax, defaultValue); */ //GetCritDateMin()->GetValueAsDate(min, defaultValue, dateMin.Value(), dateMax.Value()); //GetCritDateMax()->GetValueAsDate(max, defaultValue, dateMin.Value(), dateMax.Value()); GetCritDateMin()->GetValueAsDate(min, defaultValue); GetCritDateMax()->GetValueAsDate(max, defaultValue); // to set right date string format GetCritDateMin()->SetValueAsDate(min, ""); GetCritDateMax()->SetValueAsDate(max, ""); criteria->Set(min, max); }
//---------------------------------------- int32_t CBratProcessExportAscii::Execute(string& msg) { int32_t result = BRATHL_SUCCESS; CDate startExec; startExec.SetDateNow(); if (m_product == NULL) { throw CException("PROGRAM ERROR: product is NULL (CBratProcessExportAscii::Execute) - Perhaps, initialization has not been called", BRATHL_LOGIC_ERROR); } m_product->SetExpandArray(m_expandArray); // Always 'expand array' for Netcdf Product (To show data in column and data value by line) m_product->SetForceReadDataOneByOne(true); m_writeHeader = true; uint32_t nbFiles = m_inputFiles.size(); uint32_t cptFile = 0; CStringArray::iterator itFile; //for each file, read and write data for (itFile = m_inputFiles.begin() ; itFile != m_inputFiles.end() ; itFile++) { cptFile++; CTrace::Tracer(1,"File %d/%d - Reading record data from %s ... and registering data ...", cptFile, nbFiles, (*itFile).c_str()); // open file an set record name and list of field to read m_product->SetFieldSpecificUnits(m_fieldSpecificUnit); m_product->Open(*itFile, m_recordName); m_product->SetListFieldToRead(m_listFieldsToRead, false); // Get the number of record for the default record name (set in Open method of CProduct above) int32_t nRecords = m_product->GetNumberOfRecords(); for (int32_t iRecord = 0 ; iRecord < nRecords ; iRecord++) { //Read fields for the record name (listof field and record name are set in Open method of CProduct above) m_product->ReadBratRecord(iRecord); WriteData(); //m_writeHeader = false; } m_product->Close(); } if (m_product->GetSkippedRecordCount() > 0) { string msg = CTools::Format("WARNING - %d input data records have been skipped due to inconsistency between two measures", m_product->GetSkippedRecordCount()); CTrace::Tracer(1, msg); } CTrace::Tracer(1,"End processing - OK"); CDate endExec; endExec.SetDateNow(); CTrace::Tracer(1, CTools::Format("Processing time: %.3f seconds (%.2f minutes)\n", (endExec - startExec), (endExec - startExec) / 60.0)); return result; }