SimpleProject AnalysisDriverTestLibrarySingleton::createProject( const std::string& projectName, bool isPAT, const LibraryProblem& libraryProblem, const std::string& baselineModelName) { openstudio::path projectDir = outputDataDirectory() / toPath(projectName); if (boost::filesystem::exists(projectDir)) { boost::filesystem::remove_all(projectDir); } OptionalSimpleProject result; SimpleProjectOptions options; options.setLogLevel(Debug); if (isPAT) { result = createPATProject(projectDir,options); } else { result = SimpleProject::create(projectDir,options); } OS_ASSERT(result); setProblem(*result,libraryProblem); std::vector<openstudio::path>::const_iterator it; it = std::find_if(m_baselineModels.begin(), m_baselineModels.end(), std::bind(AnalysisDriverTestLibrarySingleton::pathStemEquals,std::placeholders::_1,baselineModelName)); OS_ASSERT(it != m_baselineModels.end()); bool test = result->setSeed(FileReference(*it)).first; OS_ASSERT(test); return *result; }
FileReference toFileReference(const QVariant& variant, const VersionString& version) { QVariantMap map = variant.toMap(); OptionalDateTime timestampCreate, timestampLast; if (version < VersionString("1.0.4")) { timestampCreate = DateTime(map["timestamp_create"].toString().toStdString()); timestampLast = DateTime(map["timestamp_last"].toString().toStdString()); } else { timestampCreate = DateTime::fromISO8601(map["timestamp_create"].toString().toStdString()); timestampLast = DateTime::fromISO8601(map["timestamp_last"].toString().toStdString()); } OS_ASSERT(timestampCreate); OS_ASSERT(timestampLast); return FileReference(toUUID(map["uuid"].toString().toStdString()), toUUID(map["version_uuid"].toString().toStdString()), map.contains("name") ? map["name"].toString().toStdString() : std::string(), map.contains("display_name") ? map["display_name"].toString().toStdString() : std::string(), map.contains("description") ? map["description"].toString().toStdString() : std::string(), toPath(map["path"].toString()), FileReferenceType(map["file_type"].toString().toStdString()), timestampCreate.get(), timestampLast.get(), map["checksum_create"].toString().toStdString(), map["checksum_last"].toString().toStdString()); }
bool Analysis_Impl::clearSeed(const FileReferenceType& seedType) { if (problem().inputFileType() && (seedType != problem().inputFileType().get())) { return false; } m_seed = FileReference(toPath("*." + seedType.valueDescription())); m_seed.makePathRelative(); emit seedChanged(); onChange(AnalysisObject_Impl::InvalidatesResults); return true; }