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
14 changes: 12 additions & 2 deletions src/application/LayoutCanvasRendering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
namespace safecrowd::application {
namespace {

const QColor kDoorStrokeColor("#ff8c00");
const QColor kOpeningStrokeColor("#2f6fb2");

bool matchesFloor(const std::string& elementFloorId, const std::string& floorId) {
return floorId.empty() || elementFloorId.empty() || elementFloorId == floorId;
}
Expand All @@ -27,6 +30,13 @@ bool isVerticalConnection(const safecrowd::domain::Connection2D& connection) {
|| connection.isRamp;
}

QColor connectionStrokeColor(const safecrowd::domain::Connection2D& connection) {
if (connection.kind == safecrowd::domain::ConnectionKind::Doorway) {
return kDoorStrokeColor;
}
return kOpeningStrokeColor;
}

const safecrowd::domain::Zone2D* findZone(
const safecrowd::domain::FacilityLayout2D& layout,
const std::string& zoneId) {
Expand Down Expand Up @@ -763,11 +773,11 @@ void drawFacilityLayoutCanvas(QPainter& painter, const safecrowd::domain::Facili
painter.drawPath(layoutCanvasPolygonPath(zone.area, transform));
}

painter.setPen(QPen(QColor(56, 122, 186), 2.5));
for (const auto& connection : layout.connections) {
if (isVerticalConnection(connection) || isStairAdjacentOpening(layout, connection)) {
continue;
}
painter.setPen(QPen(connectionStrokeColor(connection), 3.0));
drawLayoutCanvasLine(painter, connection.centerSpan, transform);
}

Expand Down Expand Up @@ -806,11 +816,11 @@ void drawFacilityLayoutCanvas(
}
}

painter.setPen(QPen(QColor(56, 122, 186), 2.5));
for (const auto& connection : layout.connections) {
if (!isVerticalConnection(connection)
&& !isStairAdjacentOpening(layout, connection)
&& matchesFloor(connection.floorId, floorId)) {
painter.setPen(QPen(connectionStrokeColor(connection), 3.0));
drawLayoutCanvasLine(painter, connection.centerSpan, transform);
}
}
Expand Down
9 changes: 6 additions & 3 deletions src/application/LayoutNavigationPanelWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <utility>
#include <vector>

#include <QColor>
#include <QVBoxLayout>

#include "application/NavigationTreeWidget.h"
Expand All @@ -15,6 +16,8 @@ namespace safecrowd::application {
namespace {

constexpr double kGeometryEpsilon = 1e-4;
const QColor kExitAccentColor("#2d8f5b");
const QColor kDoorAccentColor("#ff8c00");

QString floorActionId(const std::string& floorId) {
return QString("floor:%1").arg(QString::fromStdString(floorId));
Expand All @@ -34,7 +37,7 @@ QIcon floorIcon() {

QIcon zoneIcon(const safecrowd::domain::Zone2D& zone) {
if (zone.kind == safecrowd::domain::ZoneKind::Exit) {
return treeIcon(QStringLiteral(":/tool-icons/layout-authoring/draw-exit.svg"), QColor("#2d8f5b"));
return treeIcon(QStringLiteral(":/tool-icons/layout-authoring/draw-exit.svg"), kExitAccentColor);
}
if (zone.kind == safecrowd::domain::ZoneKind::Stair || zone.isStair || zone.isRamp) {
return treeIcon(QStringLiteral(":/tool-icons/layout-authoring/draw-stair-ramp.svg"), QColor("#6a5d9f"));
Expand All @@ -56,9 +59,9 @@ QIcon connectionIcon(const safecrowd::domain::Connection2D& connection) {
return treeIcon(QStringLiteral(":/tool-icons/layout-authoring/draw-stair-ramp.svg"), QColor("#6a5d9f"));
}
if (connection.kind == safecrowd::domain::ConnectionKind::Exit) {
return treeIcon(QStringLiteral(":/tool-icons/layout-authoring/draw-exit.svg"), QColor("#2d8f5b"));
return treeIcon(QStringLiteral(":/tool-icons/layout-authoring/draw-exit.svg"), kExitAccentColor);
}
return treeIcon(QStringLiteral(":/tool-icons/layout-authoring/draw-door.svg"), QColor("#8e6b23"));
return treeIcon(QStringLiteral(":/tool-icons/layout-authoring/draw-door.svg"), kDoorAccentColor);
}

QString zoneLabel(const safecrowd::domain::Zone2D& zone) {
Expand Down
11 changes: 8 additions & 3 deletions src/application/LayoutPreviewWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ constexpr int kPropertyPanelHeight = 42;
constexpr int kSideToolbarWidth = 44;
constexpr int kToolbarButtonSize = 44;
const QColor kSelectionHighlightColor("#0b3d78");
const QColor kExitAccentColor("#2d8f5b");
const QColor kDoorAccentColor("#ff8c00");

QRectF previewViewport(const QRect& widgetRect) {
return layoutCanvasViewport(widgetRect, kSideToolbarWidth + 16, kTopToolbarHeight + kPropertyPanelHeight + 16, 16, 16);
Expand Down Expand Up @@ -2922,8 +2924,11 @@ void LayoutPreviewWidget::paintEvent(QPaintEvent* event) {
drawLine(painter, wall.segment, transform);
}

painter.setPen(QPen(QColor(66, 156, 96), 2.5, Qt::DashLine));
for (const auto& opening : importResult_.canonicalGeometry->openings) {
const auto openingColor = opening.kind == safecrowd::domain::OpeningKind::Doorway
? kDoorAccentColor
: QColor(66, 156, 96);
painter.setPen(QPen(openingColor, 3.0, Qt::DashLine));
drawLine(painter, opening.span, transform);
}
}
Expand Down Expand Up @@ -5042,10 +5047,10 @@ void LayoutPreviewWidget::setupToolbars() {
topLayout->addStretch(1);

roomToolButton_ = makeButton(sideToolbar_, sideLayout, makeToolIcon("room", QColor("#2f5d8a")), "Draw Room");
exitToolButton_ = makeButton(sideToolbar_, sideLayout, makeToolIcon("exit", QColor("#2d8f5b")), "Draw Exit");
exitToolButton_ = makeButton(sideToolbar_, sideLayout, makeToolIcon("exit", kExitAccentColor), "Draw Exit");
wallToolButton_ = makeButton(sideToolbar_, sideLayout, makeToolIcon("wall", QColor("#4f5d6b")), "Draw Wall");
obstructionToolButton_ = makeButton(sideToolbar_, sideLayout, makeToolIcon("obstruction", QColor("#6c4f38")), "Draw Obstruction");
doorToolButton_ = makeButton(sideToolbar_, sideLayout, makeToolIcon("door", QColor("#8e6b23")), "Draw Door");
doorToolButton_ = makeButton(sideToolbar_, sideLayout, makeToolIcon("door", kDoorAccentColor), "Draw Door");
stairToolButton_ = makeButton(sideToolbar_, sideLayout, makeToolIcon("stair", QColor("#6a5d9f")), "Draw Stair/Ramp");
uStairToolButton_ = makeButton(sideToolbar_, sideLayout, makeToolIcon("u-stair", QColor("#4f46a5")), "Draw U-shaped Stair");
sideLayout->addStretch(1);
Expand Down
Loading