Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
284 changes: 284 additions & 0 deletions docs/제출용/종합설계/세부_내용.md

Large diffs are not rendered by default.

Binary file added presentation_assets/agent_movement_flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
122 changes: 122 additions & 0 deletions presentation_assets/agent_movement_flow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 6 additions & 5 deletions src/application/ProjectWorkspaceState.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ enum class SavedRightPanelMode {
};

enum class SavedResultNavigationView {
Bottleneck,
Hotspot,
Zone,
Groups,
Recommendations,
Bottleneck = 0,
Hotspot = 1,
Zone = 2,
Groups = 3,
Recommendations = 4,
HazardExposure = 5,
};

struct SavedScenarioState {
Expand Down
123 changes: 123 additions & 0 deletions src/application/ResultArtifactsCodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,124 @@ safecrowd::domain::PlacementCompletionMetric placementCompletionMetricFromJson(c
return placement;
}

QString hazardExposureKindToJson(safecrowd::domain::EnvironmentHazardKind kind) {
switch (kind) {
case safecrowd::domain::EnvironmentHazardKind::Smoke:
return "smoke";
case safecrowd::domain::EnvironmentHazardKind::Fire:
default:
return "fire";
}
}

safecrowd::domain::EnvironmentHazardKind hazardExposureKindFromJson(const QJsonValue& value) {
if (value.isDouble()) {
return value.toInt() == static_cast<int>(safecrowd::domain::EnvironmentHazardKind::Smoke)
? safecrowd::domain::EnvironmentHazardKind::Smoke
: safecrowd::domain::EnvironmentHazardKind::Fire;
}

const auto text = value.toString().trimmed().toLower();
if (text == "smoke") {
return safecrowd::domain::EnvironmentHazardKind::Smoke;
}
if (text == "fire") {
return safecrowd::domain::EnvironmentHazardKind::Fire;
}
return safecrowd::domain::EnvironmentHazardKind::Fire;
}

QString hazardExposureSeverityToJson(safecrowd::domain::ScenarioElementSeverity severity) {
switch (severity) {
case safecrowd::domain::ScenarioElementSeverity::Low:
return "low";
case safecrowd::domain::ScenarioElementSeverity::High:
return "high";
case safecrowd::domain::ScenarioElementSeverity::Medium:
default:
return "medium";
}
}

safecrowd::domain::ScenarioElementSeverity hazardExposureSeverityFromJson(const QJsonValue& value) {
if (value.isDouble()) {
const auto raw = value.toInt();
if (raw == static_cast<int>(safecrowd::domain::ScenarioElementSeverity::Low)) {
return safecrowd::domain::ScenarioElementSeverity::Low;
}
if (raw == static_cast<int>(safecrowd::domain::ScenarioElementSeverity::High)) {
return safecrowd::domain::ScenarioElementSeverity::High;
}
return safecrowd::domain::ScenarioElementSeverity::Medium;
}

const auto text = value.toString().trimmed().toLower();
if (text == "low") {
return safecrowd::domain::ScenarioElementSeverity::Low;
}
if (text == "high") {
return safecrowd::domain::ScenarioElementSeverity::High;
}
if (text == "medium") {
return safecrowd::domain::ScenarioElementSeverity::Medium;
}
return safecrowd::domain::ScenarioElementSeverity::Medium;
}

QJsonObject hazardExposureMetricToJson(const safecrowd::domain::HazardExposureMetric& metric) {
QJsonObject object;
object["hazardId"] = QString::fromStdString(metric.hazardId);
object["hazardName"] = QString::fromStdString(metric.hazardName);
object["kind"] = hazardExposureKindToJson(metric.kind);
object["severity"] = hazardExposureSeverityToJson(metric.severity);
object["affectedZoneId"] = QString::fromStdString(metric.affectedZoneId);
object["floorId"] = QString::fromStdString(metric.floorId);
object["position"] = pointArray(metric.position);
object["exposedAgentSeconds"] = metric.exposedAgentSeconds;
object["peakExposedAgentCount"] = static_cast<qint64>(metric.peakExposedAgentCount);
object["firstExposureSeconds"] = optionalDoubleToJson(metric.firstExposureSeconds);
object["peakAtSeconds"] = optionalDoubleToJson(metric.peakAtSeconds);
object["exposureScore"] = metric.exposureScore;
return object;
}

safecrowd::domain::HazardExposureMetric hazardExposureMetricFromJson(const QJsonObject& object) {
safecrowd::domain::HazardExposureMetric metric;
metric.hazardId = object.value("hazardId").toString().toStdString();
metric.hazardName = object.value("hazardName").toString().toStdString();
metric.kind = hazardExposureKindFromJson(object.value("kind"));
metric.severity = hazardExposureSeverityFromJson(object.value("severity"));
metric.affectedZoneId = object.value("affectedZoneId").toString().toStdString();
metric.floorId = object.value("floorId").toString().toStdString();
metric.position = pointFromJson(object.value("position"));
metric.exposedAgentSeconds = object.value("exposedAgentSeconds").toDouble();
metric.peakExposedAgentCount = static_cast<std::size_t>(object.value("peakExposedAgentCount").toInteger());
metric.firstExposureSeconds = optionalDoubleFromJson(object.value("firstExposureSeconds"));
metric.peakAtSeconds = optionalDoubleFromJson(object.value("peakAtSeconds"));
metric.exposureScore = object.value("exposureScore").toDouble();
return metric;
}

QJsonObject hazardExposureSummaryToJson(const safecrowd::domain::HazardExposureSummary& summary) {
QJsonObject object;
object["totalExposureScore"] = summary.totalExposureScore;
QJsonArray hazards;
for (const auto& metric : summary.hazards) {
hazards.append(hazardExposureMetricToJson(metric));
}
object["hazards"] = hazards;
return object;
}

safecrowd::domain::HazardExposureSummary hazardExposureSummaryFromJson(const QJsonObject& object) {
safecrowd::domain::HazardExposureSummary summary;
summary.totalExposureScore = object.value("totalExposureScore").toDouble();
for (const auto& value : object.value("hazards").toArray()) {
summary.hazards.push_back(hazardExposureMetricFromJson(value.toObject()));
}
return summary;
}

QJsonObject resultArtifactsToJson(const safecrowd::domain::ScenarioResultArtifacts& artifacts) {
QJsonObject object;
QJsonArray progress;
Expand Down Expand Up @@ -335,6 +453,7 @@ QJsonObject resultArtifactsToJson(const safecrowd::domain::ScenarioResultArtifac
object["timingSummary"] = timing;

object["densitySummary"] = densitySummaryToJson(artifacts.densitySummary);
object["hazardExposureSummary"] = hazardExposureSummaryToJson(artifacts.hazardExposureSummary);

QJsonArray exitUsage;
for (const auto& exit : artifacts.exitUsage) {
Expand Down Expand Up @@ -389,6 +508,10 @@ safecrowd::domain::ScenarioResultArtifacts resultArtifactsFromJson(const QJsonOb
if (object.value("densitySummary").isObject()) {
artifacts.densitySummary = densitySummaryFromJson(object.value("densitySummary").toObject());
}
if (object.value("hazardExposureSummary").isObject()) {
artifacts.hazardExposureSummary =
hazardExposureSummaryFromJson(object.value("hazardExposureSummary").toObject());
}
for (const auto& value : object.value("exitUsage").toArray()) {
artifacts.exitUsage.push_back(exitUsageMetricFromJson(value.toObject()));
}
Expand Down
Loading
Loading