From 526f50ce4300d4c7a4bbd319555897e480e95612 Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Mon, 10 Feb 2025 10:39:32 +1000 Subject: [PATCH 01/44] Checkpoint select imports working --- src/openstudio_lib/LocationTabView.cpp | 69 +++++++++++++++++++++++++- src/openstudio_lib/LocationTabView.hpp | 6 ++- 2 files changed, 73 insertions(+), 2 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index 4b778957c..151903739 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -625,6 +626,71 @@ void LocationView::onWeatherFileBtnClicked() { } } +void LocationView::showDesignDaySelectionDialog(const std::vector& days99, + const std::vector& days99_6, + const std::vector& days2, + const std::vector& days1, + const std::vector& days0_4) { + QDialog dialog(this); + dialog.setWindowTitle(tr("Select Design Days")); + + QVBoxLayout* layout = new QVBoxLayout(&dialog); + + QRadioButton* radio99 = new QRadioButton(tr("99% Design Days"), &dialog); + QRadioButton* radio99_6 = new QRadioButton(tr("99.6% Design Days"), &dialog); + QRadioButton* radio2 = new QRadioButton(tr("2% Design Days"), &dialog); + QRadioButton* radio1 = new QRadioButton(tr("1% Design Days"), &dialog); + QRadioButton* radio0_4 = new QRadioButton(tr("0.4% Design Days"), &dialog); + + layout->addWidget(radio99); + layout->addWidget(radio99_6); + layout->addWidget(radio2); + layout->addWidget(radio1); + layout->addWidget(radio0_4); + + QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, &dialog); + layout->addWidget(buttonBox); + + connect(buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept); + connect(buttonBox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject); + + if (dialog.exec() == QDialog::Accepted) { + if (radio99->isChecked()) { + std::vector modelObjects(days99.begin(), days99.end()); + std::vector idfObjectsToInsert; + for (const auto& modelObject : modelObjects) { + idfObjectsToInsert.push_back(modelObject.idfObject()); + } + m_model.insertObjects(idfObjectsToInsert); + } else if (radio99_6->isChecked()) { + std::vector modelObjects(days99_6.begin(), days99_6.end()); + std::vector idfObjectsToInsert; + for (const auto& modelObject : modelObjects) { + idfObjectsToInsert.push_back(modelObject.idfObject()); + } + m_model.insertObjects(idfObjectsToInsert); + } else if (radio2->isChecked()) { + std::vector idfObjectsToInsert; + for (const auto& modelObject : days2) { + idfObjectsToInsert.push_back(modelObject.idfObject()); + } + m_model.insertObjects(idfObjectsToInsert); + } else if (radio1->isChecked()) { + std::vector idfObjectsToInsert; + for (const auto& modelObject : days1) { + idfObjectsToInsert.push_back(modelObject.idfObject()); + } + m_model.insertObjects(idfObjectsToInsert); + } else if (radio0_4->isChecked()) { + std::vector idfObjectsToInsert; + for (const auto& modelObject : days0_4) { + idfObjectsToInsert.push_back(modelObject.idfObject()); + } + m_model.insertObjects(idfObjectsToInsert); + } + } + } + void LocationView::onDesignDayBtnClicked() { QString fileTypes("Files (*.ddy)"); @@ -718,7 +784,8 @@ void LocationView::onDesignDayBtnClicked() { // sizingPeriod.remove(); //} - m_model.insertObjects(ddyModel.objects()); + //m_model.insertObjects(ddyModel.objects()); + showDesignDaySelectionDialog(days99, days99_6, days2, days1, days0_4); m_lastDdyPathOpened = QFileInfo(fileName).absoluteFilePath(); } diff --git a/src/openstudio_lib/LocationTabView.hpp b/src/openstudio_lib/LocationTabView.hpp index b733e3d67..7d45be11a 100644 --- a/src/openstudio_lib/LocationTabView.hpp +++ b/src/openstudio_lib/LocationTabView.hpp @@ -9,7 +9,7 @@ #include #include #include - +#include #include "MainTabView.hpp" #include "YearSettingsWidget.hpp" @@ -124,6 +124,10 @@ class LocationView : public QWidget void onWeatherFileBtnClicked(); + void showDesignDaySelectionDialog(const std::vector& days99, const std::vector& days99_6, + const std::vector& days2, const std::vector& days1, + const std::vector& days0_4); + void onDesignDayBtnClicked(); void onASHRAEClimateZoneChanged(const QString& climateZone); From 756760d62708d49a42f47b579bc9c95f0be896e1 Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Mon, 10 Feb 2025 10:50:27 +1000 Subject: [PATCH 02/44] Checkpoint appears to be working --- src/openstudio_lib/LocationTabView.cpp | 128 +++++++++++++------------ 1 file changed, 68 insertions(+), 60 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index 151903739..fb01e15bf 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #include #include #include @@ -627,69 +628,76 @@ void LocationView::onWeatherFileBtnClicked() { } void LocationView::showDesignDaySelectionDialog(const std::vector& days99, - const std::vector& days99_6, - const std::vector& days2, - const std::vector& days1, - const std::vector& days0_4) { - QDialog dialog(this); - dialog.setWindowTitle(tr("Select Design Days")); - - QVBoxLayout* layout = new QVBoxLayout(&dialog); - - QRadioButton* radio99 = new QRadioButton(tr("99% Design Days"), &dialog); - QRadioButton* radio99_6 = new QRadioButton(tr("99.6% Design Days"), &dialog); - QRadioButton* radio2 = new QRadioButton(tr("2% Design Days"), &dialog); - QRadioButton* radio1 = new QRadioButton(tr("1% Design Days"), &dialog); - QRadioButton* radio0_4 = new QRadioButton(tr("0.4% Design Days"), &dialog); - - layout->addWidget(radio99); - layout->addWidget(radio99_6); - layout->addWidget(radio2); - layout->addWidget(radio1); - layout->addWidget(radio0_4); - - QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, &dialog); - layout->addWidget(buttonBox); - - connect(buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept); - connect(buttonBox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject); - - if (dialog.exec() == QDialog::Accepted) { - if (radio99->isChecked()) { - std::vector modelObjects(days99.begin(), days99.end()); - std::vector idfObjectsToInsert; - for (const auto& modelObject : modelObjects) { - idfObjectsToInsert.push_back(modelObject.idfObject()); - } - m_model.insertObjects(idfObjectsToInsert); - } else if (radio99_6->isChecked()) { - std::vector modelObjects(days99_6.begin(), days99_6.end()); - std::vector idfObjectsToInsert; - for (const auto& modelObject : modelObjects) { - idfObjectsToInsert.push_back(modelObject.idfObject()); - } - m_model.insertObjects(idfObjectsToInsert); - } else if (radio2->isChecked()) { - std::vector idfObjectsToInsert; - for (const auto& modelObject : days2) { - idfObjectsToInsert.push_back(modelObject.idfObject()); - } - m_model.insertObjects(idfObjectsToInsert); - } else if (radio1->isChecked()) { - std::vector idfObjectsToInsert; - for (const auto& modelObject : days1) { - idfObjectsToInsert.push_back(modelObject.idfObject()); - } - m_model.insertObjects(idfObjectsToInsert); - } else if (radio0_4->isChecked()) { - std::vector idfObjectsToInsert; - for (const auto& modelObject : days0_4) { - idfObjectsToInsert.push_back(modelObject.idfObject()); - } - m_model.insertObjects(idfObjectsToInsert); + const std::vector& days99_6, + const std::vector& days2, + const std::vector& days1, + const std::vector& days0_4) { + QDialog dialog(this); + dialog.setWindowTitle(tr("Select Design Days")); + + QVBoxLayout* layout = new QVBoxLayout(&dialog); + + QCheckBox* checkBox99 = new QCheckBox(tr("99% Design Days"), &dialog); + QCheckBox* checkBox99_6 = new QCheckBox(tr("99.6% Design Days"), &dialog); + QCheckBox* checkBox2 = new QCheckBox(tr("2% Design Days"), &dialog); + QCheckBox* checkBox1 = new QCheckBox(tr("1% Design Days"), &dialog); + QCheckBox* checkBox0_4 = new QCheckBox(tr("0.4% Design Days"), &dialog); + + layout->addWidget(checkBox99); + layout->addWidget(checkBox99_6); + layout->addWidget(checkBox2); + layout->addWidget(checkBox1); + layout->addWidget(checkBox0_4); + + QPushButton* selectAllButton = new QPushButton(tr("Select All"), &dialog); + layout->addWidget(selectAllButton); + + QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, &dialog); + layout->addWidget(buttonBox); + + connect(selectAllButton, &QPushButton::clicked, [=]() { + checkBox99->setChecked(true); + checkBox99_6->setChecked(true); + checkBox2->setChecked(true); + checkBox1->setChecked(true); + checkBox0_4->setChecked(true); + }); + + connect(buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept); + connect(buttonBox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject); + + if (dialog.exec() == QDialog::Accepted) { + std::vector idfObjectsToInsert; + + if (checkBox99->isChecked()) { + for (const auto& modelObject : days99) { + idfObjectsToInsert.push_back(modelObject.idfObject()); + } + } + if (checkBox99_6->isChecked()) { + for (const auto& modelObject : days99_6) { + idfObjectsToInsert.push_back(modelObject.idfObject()); } } + if (checkBox2->isChecked()) { + for (const auto& modelObject : days2) { + idfObjectsToInsert.push_back(modelObject.idfObject()); + } + } + if (checkBox1->isChecked()) { + for (const auto& modelObject : days1) { + idfObjectsToInsert.push_back(modelObject.idfObject()); + } + } + if (checkBox0_4->isChecked()) { + for (const auto& modelObject : days0_4) { + idfObjectsToInsert.push_back(modelObject.idfObject()); + } + } + + m_model.insertObjects(idfObjectsToInsert); } +} void LocationView::onDesignDayBtnClicked() { QString fileTypes("Files (*.ddy)"); From cf4cf775c625687b01a0e29a7dc9219bc47b2837 Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Thu, 13 Feb 2025 14:40:13 +1000 Subject: [PATCH 03/44] Checkpoint --- src/openstudio_lib/LocationTabView.cpp | 199 +++++++++++++++++++------ src/openstudio_lib/LocationTabView.hpp | 8 +- 2 files changed, 156 insertions(+), 51 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index fb01e15bf..20493f195 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -627,27 +627,52 @@ void LocationView::onWeatherFileBtnClicked() { } } -void LocationView::showDesignDaySelectionDialog(const std::vector& days99, - const std::vector& days99_6, - const std::vector& days2, - const std::vector& days1, - const std::vector& days0_4) { +void LocationView::showDesignDaySelectionDialog(const std::vector& summerDays99, + const std::vector& summerDays99_6, + const std::vector& summerDays2, + const std::vector& summerDays1, + const std::vector& summerDays0_4, + const std::vector& winterDays99, + const std::vector& winterDays99_6, + const std::vector& winterDays2, + const std::vector& winterDays1, + const std::vector& winterDays0_4) { + + QDialog dialog(this); dialog.setWindowTitle(tr("Select Design Days")); QVBoxLayout* layout = new QVBoxLayout(&dialog); - QCheckBox* checkBox99 = new QCheckBox(tr("99% Design Days"), &dialog); - QCheckBox* checkBox99_6 = new QCheckBox(tr("99.6% Design Days"), &dialog); - QCheckBox* checkBox2 = new QCheckBox(tr("2% Design Days"), &dialog); - QCheckBox* checkBox1 = new QCheckBox(tr("1% Design Days"), &dialog); - QCheckBox* checkBox0_4 = new QCheckBox(tr("0.4% Design Days"), &dialog); + QLabel* summerLabel = new QLabel(tr("Summer Design Days"), &dialog); + layout->addWidget(summerLabel); - layout->addWidget(checkBox99); - layout->addWidget(checkBox99_6); - layout->addWidget(checkBox2); - layout->addWidget(checkBox1); - layout->addWidget(checkBox0_4); + QCheckBox* summerCheckBox99 = new QCheckBox(tr("99% Design Days"), &dialog); + QCheckBox* summerCheckBox99_6 = new QCheckBox(tr("99.6% Design Days"), &dialog); + QCheckBox* summerCheckBox2 = new QCheckBox(tr("2% Design Days"), &dialog); + QCheckBox* summerCheckBox1 = new QCheckBox(tr("1% Design Days"), &dialog); + QCheckBox* summerCheckBox0_4 = new QCheckBox(tr("0.4% Design Days"), &dialog); + + layout->addWidget(summerCheckBox99); + layout->addWidget(summerCheckBox99_6); + layout->addWidget(summerCheckBox2); + layout->addWidget(summerCheckBox1); + layout->addWidget(summerCheckBox0_4); + + QLabel* winterLabel = new QLabel(tr("Winter Design Days"), &dialog); + layout->addWidget(winterLabel); + + QCheckBox* winterCheckBox99 = new QCheckBox(tr("99% Design Days"), &dialog); + QCheckBox* winterCheckBox99_6 = new QCheckBox(tr("99.6% Design Days"), &dialog); + QCheckBox* winterCheckBox2 = new QCheckBox(tr("2% Design Days"), &dialog); + QCheckBox* winterCheckBox1 = new QCheckBox(tr("1% Design Days"), &dialog); + QCheckBox* winterCheckBox0_4 = new QCheckBox(tr("0.4% Design Days"), &dialog); + + layout->addWidget(winterCheckBox99); + layout->addWidget(winterCheckBox99_6); + layout->addWidget(winterCheckBox2); + layout->addWidget(winterCheckBox1); + layout->addWidget(winterCheckBox0_4); QPushButton* selectAllButton = new QPushButton(tr("Select All"), &dialog); layout->addWidget(selectAllButton); @@ -656,11 +681,16 @@ void LocationView::showDesignDaySelectionDialog(const std::vectoraddWidget(buttonBox); connect(selectAllButton, &QPushButton::clicked, [=]() { - checkBox99->setChecked(true); - checkBox99_6->setChecked(true); - checkBox2->setChecked(true); - checkBox1->setChecked(true); - checkBox0_4->setChecked(true); + summerCheckBox99->setChecked(true); + summerCheckBox99_6->setChecked(true); + summerCheckBox2->setChecked(true); + summerCheckBox1->setChecked(true); + summerCheckBox0_4->setChecked(true); + winterCheckBox99->setChecked(true); + winterCheckBox99_6->setChecked(true); + winterCheckBox2->setChecked(true); + winterCheckBox1->setChecked(true); + winterCheckBox0_4->setChecked(true); }); connect(buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept); @@ -669,28 +699,54 @@ void LocationView::showDesignDaySelectionDialog(const std::vector idfObjectsToInsert; - if (checkBox99->isChecked()) { - for (const auto& modelObject : days99) { + if (summerCheckBox99->isChecked()) { + for (const auto& modelObject : summerDays99) { idfObjectsToInsert.push_back(modelObject.idfObject()); } } - if (checkBox99_6->isChecked()) { - for (const auto& modelObject : days99_6) { + if (summerCheckBox99_6->isChecked()) { + for (const auto& modelObject : summerDays99_6) { idfObjectsToInsert.push_back(modelObject.idfObject()); } } - if (checkBox2->isChecked()) { - for (const auto& modelObject : days2) { + if (summerCheckBox2->isChecked()) { + for (const auto& modelObject : summerDays2) { idfObjectsToInsert.push_back(modelObject.idfObject()); } } - if (checkBox1->isChecked()) { - for (const auto& modelObject : days1) { + if (summerCheckBox1->isChecked()) { + for (const auto& modelObject : summerDays1) { idfObjectsToInsert.push_back(modelObject.idfObject()); } } - if (checkBox0_4->isChecked()) { - for (const auto& modelObject : days0_4) { + if (summerCheckBox0_4->isChecked()) { + for (const auto& modelObject : summerDays0_4) { + idfObjectsToInsert.push_back(modelObject.idfObject()); + } + } + + if (winterCheckBox99->isChecked()) { + for (const auto& modelObject : winterDays99) { + idfObjectsToInsert.push_back(modelObject.idfObject()); + } + } + if (winterCheckBox99_6->isChecked()) { + for (const auto& modelObject : winterDays99_6) { + idfObjectsToInsert.push_back(modelObject.idfObject()); + } + } + if (winterCheckBox2->isChecked()) { + for (const auto& modelObject : winterDays2) { + idfObjectsToInsert.push_back(modelObject.idfObject()); + } + } + if (winterCheckBox1->isChecked()) { + for (const auto& modelObject : winterDays1) { + idfObjectsToInsert.push_back(modelObject.idfObject()); + } + } + if (winterCheckBox0_4->isChecked()) { + for (const auto& modelObject : winterDays0_4) { idfObjectsToInsert.push_back(modelObject.idfObject()); } } @@ -734,11 +790,16 @@ void LocationView::onDesignDayBtnClicked() { // Filter out the days that are not helpful. if (!ddyModel.objects().empty()) { // Containers to hold 99%, 99.6%, 2%, 1%, and 0.4% design points - std::vector days99; - std::vector days99_6; - std::vector days2; - std::vector days1; - std::vector days0_4; + std::vector summerdays99; + std::vector summerdays99_6; + std::vector summerdays2; + std::vector summerdays1; + std::vector summerdays0_4; + std::vector winterDays99; + std::vector winterDays99_6; + std::vector winterDays2; + std::vector winterDays1; + std::vector winterDays0_4; bool unknownDay = false; @@ -747,18 +808,40 @@ void LocationView::onDesignDayBtnClicked() { name = designDay.name(); if (name) { + QString qname = QString::fromStdString(name.get()); + QString dayType = QString::fromStdString(designDay.dayType()); if (qname.contains("99%")) { - days99.push_back(designDay); + if (dayType.contains("Winter")) { + winterDays99.push_back(designDay); + } else if (dayType.contains("Summer")) { + summerdays99.push_back(designDay); + } } else if (qname.contains("99.6%")) { - days99_6.push_back(designDay); + if (dayType.contains("Winter")) { + winterDays99_6.push_back(designDay); + } else if (dayType.contains("Summer")) { + summerdays99_6.push_back(designDay); + } } else if (qname.contains("2%")) { - days2.push_back(designDay); + if (dayType.contains("Winter")) { + winterDays2.push_back(designDay); + } else if (dayType.contains("Summer")) { + summerdays2.push_back(designDay); + } } else if (qname.contains("1%")) { - days1.push_back(designDay); + if (dayType.contains("Winter")) { + winterDays1.push_back(designDay); + } else if (dayType.contains("Summer")) { + summerdays1.push_back(designDay); + } } else if (qname.contains(".4%")) { - days0_4.push_back(designDay); + if (dayType.contains("Winter")) { + winterDays0_4.push_back(designDay); + } else if (dayType.contains("Summer")) { + summerdays0_4.push_back(designDay); + } } else { unknownDay = true; } @@ -767,21 +850,40 @@ void LocationView::onDesignDayBtnClicked() { // Pick only the most stringent design points if (!unknownDay) { - if (!days99_6.empty()) { - for (model::DesignDay designDay : days99) { + if (!summerdays99_6.empty()) { + for (model::DesignDay designDay : summerdays99) { + designDay.remove(); + } + } + + if (!summerdays0_4.empty()) { + for (model::DesignDay designDay : summerdays1) { + designDay.remove(); + } + for (model::DesignDay designDay : summerdays2) { + designDay.remove(); + } + } else if (!summerdays1.empty()) { + for (model::DesignDay designDay : summerdays2) { + designDay.remove(); + } + } + + if (!winterDays99_6.empty()) { + for (model::DesignDay designDay : winterDays99) { designDay.remove(); } } - if (!days0_4.empty()) { - for (model::DesignDay designDay : days1) { + if (!winterDays0_4.empty()) { + for (model::DesignDay designDay : winterDays1) { designDay.remove(); } - for (model::DesignDay designDay : days2) { + for (model::DesignDay designDay : winterDays2) { designDay.remove(); } - } else if (!days1.empty()) { - for (model::DesignDay designDay : days2) { + } else if (!winterDays1.empty()) { + for (model::DesignDay designDay : winterDays2) { designDay.remove(); } } @@ -793,7 +895,8 @@ void LocationView::onDesignDayBtnClicked() { //} //m_model.insertObjects(ddyModel.objects()); - showDesignDaySelectionDialog(days99, days99_6, days2, days1, days0_4); + showDesignDaySelectionDialog(summerdays99, summerdays99_6, summerdays2, summerdays1, summerdays0_4, winterDays99, winterDays99_6, winterDays2, winterDays1, winterDays0_4); + //showDesignDaySelectionDialog(summerdays99, summerdays99_6, summerdays2, summerdays1, summerdays0_4, winterDays99, winterDays99_6, winterDays2, winterDays1, winterDays0_4); m_lastDdyPathOpened = QFileInfo(fileName).absoluteFilePath(); } diff --git a/src/openstudio_lib/LocationTabView.hpp b/src/openstudio_lib/LocationTabView.hpp index 7d45be11a..06be26406 100644 --- a/src/openstudio_lib/LocationTabView.hpp +++ b/src/openstudio_lib/LocationTabView.hpp @@ -124,9 +124,11 @@ class LocationView : public QWidget void onWeatherFileBtnClicked(); - void showDesignDaySelectionDialog(const std::vector& days99, const std::vector& days99_6, - const std::vector& days2, const std::vector& days1, - const std::vector& days0_4); + void showDesignDaySelectionDialog(const std::vector& summerDays99, const std::vector& summerDays99_6, + const std::vector& summerDays2, const std::vector& summerDays1, + const std::vector& summerDays0_4, const std::vector& winterDays99, + const std::vector& winterDays99_6, const std::vector& winterDays2, + const std::vector& winterDays1, const std::vector& winterDays0_4); void onDesignDayBtnClicked(); From 78ee212c678341a4c1416aef8d5b6d566832e32d Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Fri, 14 Feb 2025 14:05:54 +1000 Subject: [PATCH 04/44] Checkpoint looking better --- src/openstudio_lib/LocationTabView.cpp | 112 +++++++++++++++---------- 1 file changed, 70 insertions(+), 42 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index 20493f195..4d257297b 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -637,8 +637,6 @@ void LocationView::showDesignDaySelectionDialog(const std::vector& winterDays2, const std::vector& winterDays1, const std::vector& winterDays0_4) { - - QDialog dialog(this); dialog.setWindowTitle(tr("Select Design Days")); @@ -647,32 +645,62 @@ void LocationView::showDesignDaySelectionDialog(const std::vectoraddWidget(summerLabel); - QCheckBox* summerCheckBox99 = new QCheckBox(tr("99% Design Days"), &dialog); - QCheckBox* summerCheckBox99_6 = new QCheckBox(tr("99.6% Design Days"), &dialog); - QCheckBox* summerCheckBox2 = new QCheckBox(tr("2% Design Days"), &dialog); - QCheckBox* summerCheckBox1 = new QCheckBox(tr("1% Design Days"), &dialog); - QCheckBox* summerCheckBox0_4 = new QCheckBox(tr("0.4% Design Days"), &dialog); + QCheckBox* summerCheckBox99 = nullptr; + QCheckBox* summerCheckBox99_6 = nullptr; + QCheckBox* summerCheckBox2 = nullptr; + QCheckBox* summerCheckBox1 = nullptr; + QCheckBox* summerCheckBox0_4 = nullptr; - layout->addWidget(summerCheckBox99); - layout->addWidget(summerCheckBox99_6); - layout->addWidget(summerCheckBox2); - layout->addWidget(summerCheckBox1); - layout->addWidget(summerCheckBox0_4); + if (!summerDays99.empty()) { + summerCheckBox99 = new QCheckBox(tr("99% Design Days"), &dialog); + layout->addWidget(summerCheckBox99); + } + if (!summerDays99_6.empty()) { + summerCheckBox99_6 = new QCheckBox(tr("99.6% Design Days"), &dialog); + layout->addWidget(summerCheckBox99_6); + } + if (!summerDays2.empty()) { + summerCheckBox2 = new QCheckBox(tr("2% Design Days"), &dialog); + layout->addWidget(summerCheckBox2); + } + if (!summerDays1.empty()) { + summerCheckBox1 = new QCheckBox(tr("1% Design Days"), &dialog); + layout->addWidget(summerCheckBox1); + } + if (!summerDays0_4.empty()) { + summerCheckBox0_4 = new QCheckBox(tr("0.4% Design Days"), &dialog); + layout->addWidget(summerCheckBox0_4); + } QLabel* winterLabel = new QLabel(tr("Winter Design Days"), &dialog); layout->addWidget(winterLabel); - QCheckBox* winterCheckBox99 = new QCheckBox(tr("99% Design Days"), &dialog); - QCheckBox* winterCheckBox99_6 = new QCheckBox(tr("99.6% Design Days"), &dialog); - QCheckBox* winterCheckBox2 = new QCheckBox(tr("2% Design Days"), &dialog); - QCheckBox* winterCheckBox1 = new QCheckBox(tr("1% Design Days"), &dialog); - QCheckBox* winterCheckBox0_4 = new QCheckBox(tr("0.4% Design Days"), &dialog); + QCheckBox* winterCheckBox99 = nullptr; + QCheckBox* winterCheckBox99_6 = nullptr; + QCheckBox* winterCheckBox2 = nullptr; + QCheckBox* winterCheckBox1 = nullptr; + QCheckBox* winterCheckBox0_4 = nullptr; - layout->addWidget(winterCheckBox99); - layout->addWidget(winterCheckBox99_6); - layout->addWidget(winterCheckBox2); - layout->addWidget(winterCheckBox1); - layout->addWidget(winterCheckBox0_4); + if (!winterDays99.empty()) { + winterCheckBox99 = new QCheckBox(tr("99% Design Days"), &dialog); + layout->addWidget(winterCheckBox99); + } + if (!winterDays99_6.empty()) { + winterCheckBox99_6 = new QCheckBox(tr("99.6% Design Days"), &dialog); + layout->addWidget(winterCheckBox99_6); + } + if (!winterDays2.empty()) { + winterCheckBox2 = new QCheckBox(tr("2% Design Days"), &dialog); + layout->addWidget(winterCheckBox2); + } + if (!winterDays1.empty()) { + winterCheckBox1 = new QCheckBox(tr("1% Design Days"), &dialog); + layout->addWidget(winterCheckBox1); + } + if (!winterDays0_4.empty()) { + winterCheckBox0_4 = new QCheckBox(tr("0.4% Design Days"), &dialog); + layout->addWidget(winterCheckBox0_4); + } QPushButton* selectAllButton = new QPushButton(tr("Select All"), &dialog); layout->addWidget(selectAllButton); @@ -681,16 +709,16 @@ void LocationView::showDesignDaySelectionDialog(const std::vectoraddWidget(buttonBox); connect(selectAllButton, &QPushButton::clicked, [=]() { - summerCheckBox99->setChecked(true); - summerCheckBox99_6->setChecked(true); - summerCheckBox2->setChecked(true); - summerCheckBox1->setChecked(true); - summerCheckBox0_4->setChecked(true); - winterCheckBox99->setChecked(true); - winterCheckBox99_6->setChecked(true); - winterCheckBox2->setChecked(true); - winterCheckBox1->setChecked(true); - winterCheckBox0_4->setChecked(true); + if (summerCheckBox99) summerCheckBox99->setChecked(true); + if (summerCheckBox99_6) summerCheckBox99_6->setChecked(true); + if (summerCheckBox2) summerCheckBox2->setChecked(true); + if (summerCheckBox1) summerCheckBox1->setChecked(true); + if (summerCheckBox0_4) summerCheckBox0_4->setChecked(true); + if (winterCheckBox99) winterCheckBox99->setChecked(true); + if (winterCheckBox99_6) winterCheckBox99_6->setChecked(true); + if (winterCheckBox2) winterCheckBox2->setChecked(true); + if (winterCheckBox1) winterCheckBox1->setChecked(true); + if (winterCheckBox0_4) winterCheckBox0_4->setChecked(true); }); connect(buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept); @@ -699,53 +727,53 @@ void LocationView::showDesignDaySelectionDialog(const std::vector idfObjectsToInsert; - if (summerCheckBox99->isChecked()) { + if (summerCheckBox99 && summerCheckBox99->isChecked()) { for (const auto& modelObject : summerDays99) { idfObjectsToInsert.push_back(modelObject.idfObject()); } } - if (summerCheckBox99_6->isChecked()) { + if (summerCheckBox99_6 && summerCheckBox99_6->isChecked()) { for (const auto& modelObject : summerDays99_6) { idfObjectsToInsert.push_back(modelObject.idfObject()); } } - if (summerCheckBox2->isChecked()) { + if (summerCheckBox2 && summerCheckBox2->isChecked()) { for (const auto& modelObject : summerDays2) { idfObjectsToInsert.push_back(modelObject.idfObject()); } } - if (summerCheckBox1->isChecked()) { + if (summerCheckBox1 && summerCheckBox1->isChecked()) { for (const auto& modelObject : summerDays1) { idfObjectsToInsert.push_back(modelObject.idfObject()); } } - if (summerCheckBox0_4->isChecked()) { + if (summerCheckBox0_4 && summerCheckBox0_4->isChecked()) { for (const auto& modelObject : summerDays0_4) { idfObjectsToInsert.push_back(modelObject.idfObject()); } } - if (winterCheckBox99->isChecked()) { + if (winterCheckBox99 && winterCheckBox99->isChecked()) { for (const auto& modelObject : winterDays99) { idfObjectsToInsert.push_back(modelObject.idfObject()); } } - if (winterCheckBox99_6->isChecked()) { + if (winterCheckBox99_6 && winterCheckBox99_6->isChecked()) { for (const auto& modelObject : winterDays99_6) { idfObjectsToInsert.push_back(modelObject.idfObject()); } } - if (winterCheckBox2->isChecked()) { + if (winterCheckBox2 && winterCheckBox2->isChecked()) { for (const auto& modelObject : winterDays2) { idfObjectsToInsert.push_back(modelObject.idfObject()); } } - if (winterCheckBox1->isChecked()) { + if (winterCheckBox1 && winterCheckBox1->isChecked()) { for (const auto& modelObject : winterDays1) { idfObjectsToInsert.push_back(modelObject.idfObject()); } } - if (winterCheckBox0_4->isChecked()) { + if (winterCheckBox0_4 && winterCheckBox0_4->isChecked()) { for (const auto& modelObject : winterDays0_4) { idfObjectsToInsert.push_back(modelObject.idfObject()); } From f3a7267110f29b22834338ae62c2650d0f281b41 Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Sat, 15 Feb 2025 13:23:56 +1000 Subject: [PATCH 05/44] this is looking good --- src/openstudio_lib/LocationTabView.cpp | 30 +++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index 4d257297b..087ba8cb6 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -651,25 +651,49 @@ void LocationView::showDesignDaySelectionDialog(const std::vector& designDays) { + if (checkBox && checkBox->isChecked()) { + for (const auto& modelObject : designDays) { + QString dryBulbTemp = QString::number(modelObject.maximumDryBulbTemperature()); + QString wetBulbTemp = modelObject.wetBulbOrDewPointAtMaximumDryBulb() ? QString::number(modelObject.wetBulbOrDewPointAtMaximumDryBulb().get()) : "N/A"; + QLabel* tempLabel = new QLabel(tr("Dry Bulb: %1, Wet Bulb: %2").arg(dryBulbTemp).arg(wetBulbTemp), &dialog); + tempLabel->setObjectName(checkBox->text()); + layout->addWidget(tempLabel); + } + } else { + for (int i = layout->count() - 1; i >= 0; --i) { + QWidget* widget = layout->itemAt(i)->widget(); + if (widget && widget->objectName() == checkBox->text()) { + delete widget; + } + } + } + }; + if (!summerDays99.empty()) { summerCheckBox99 = new QCheckBox(tr("99% Design Days"), &dialog); layout->addWidget(summerCheckBox99); + connect(summerCheckBox99, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox99, summerDays99); }); } if (!summerDays99_6.empty()) { summerCheckBox99_6 = new QCheckBox(tr("99.6% Design Days"), &dialog); layout->addWidget(summerCheckBox99_6); + connect(summerCheckBox99_6, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox99_6, summerDays99_6); }); } if (!summerDays2.empty()) { summerCheckBox2 = new QCheckBox(tr("2% Design Days"), &dialog); layout->addWidget(summerCheckBox2); + connect(summerCheckBox2, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox2, summerDays2); }); } if (!summerDays1.empty()) { summerCheckBox1 = new QCheckBox(tr("1% Design Days"), &dialog); layout->addWidget(summerCheckBox1); + connect(summerCheckBox1, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox1, summerDays1); }); } if (!summerDays0_4.empty()) { summerCheckBox0_4 = new QCheckBox(tr("0.4% Design Days"), &dialog); layout->addWidget(summerCheckBox0_4); + connect(summerCheckBox0_4, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox0_4, summerDays0_4); }); } QLabel* winterLabel = new QLabel(tr("Winter Design Days"), &dialog); @@ -684,22 +708,27 @@ void LocationView::showDesignDaySelectionDialog(const std::vectoraddWidget(winterCheckBox99); + connect(winterCheckBox99, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(winterCheckBox99, winterDays99); }); } if (!winterDays99_6.empty()) { winterCheckBox99_6 = new QCheckBox(tr("99.6% Design Days"), &dialog); layout->addWidget(winterCheckBox99_6); + connect(winterCheckBox99_6, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(winterCheckBox99_6, winterDays99_6); }); } if (!winterDays2.empty()) { winterCheckBox2 = new QCheckBox(tr("2% Design Days"), &dialog); layout->addWidget(winterCheckBox2); + connect(winterCheckBox2, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(winterCheckBox2, winterDays2); }); } if (!winterDays1.empty()) { winterCheckBox1 = new QCheckBox(tr("1% Design Days"), &dialog); layout->addWidget(winterCheckBox1); + connect(winterCheckBox1, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(winterCheckBox1, winterDays1); }); } if (!winterDays0_4.empty()) { winterCheckBox0_4 = new QCheckBox(tr("0.4% Design Days"), &dialog); layout->addWidget(winterCheckBox0_4); + connect(winterCheckBox0_4, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(winterCheckBox0_4, winterDays0_4); }); } QPushButton* selectAllButton = new QPushButton(tr("Select All"), &dialog); @@ -924,7 +953,6 @@ void LocationView::onDesignDayBtnClicked() { //m_model.insertObjects(ddyModel.objects()); showDesignDaySelectionDialog(summerdays99, summerdays99_6, summerdays2, summerdays1, summerdays0_4, winterDays99, winterDays99_6, winterDays2, winterDays1, winterDays0_4); - //showDesignDaySelectionDialog(summerdays99, summerdays99_6, summerdays2, summerdays1, summerdays0_4, winterDays99, winterDays99_6, winterDays2, winterDays1, winterDays0_4); m_lastDdyPathOpened = QFileInfo(fileName).absoluteFilePath(); } From f7ac13bde609c9d03b299320bf065d55f5db0cbf Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Sat, 15 Feb 2025 14:11:03 +1000 Subject: [PATCH 06/44] Checkpoint only considering annual design days now --- src/openstudio_lib/LocationTabView.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index 087ba8cb6..3dadbfc00 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -656,9 +656,10 @@ void LocationView::showDesignDaySelectionDialog(const std::vectorsetObjectName(checkBox->text()); - layout->addWidget(tempLabel); + layout->insertWidget(layout->indexOf(checkBox) + 1, tempLabel); } } else { for (int i = layout->count() - 1; i >= 0; --i) { @@ -833,10 +834,11 @@ void LocationView::onDesignDayBtnClicked() { openstudio::Workspace ddyWorkspace(StrictnessLevel::None, IddFileType::EnergyPlus); for (const IdfObject& idfObject : ddyIdfFile->objects()) { IddObjectType iddObjectType = idfObject.iddObject().type(); - if ((iddObjectType == IddObjectType::SizingPeriod_DesignDay) || (iddObjectType == IddObjectType::SizingPeriod_WeatherFileDays) - || (iddObjectType == IddObjectType::SizingPeriod_WeatherFileConditionType)) { - - ddyWorkspace.addObject(idfObject); + if (iddObjectType == IddObjectType::SizingPeriod_DesignDay) { + boost::optional name = idfObject.name(); + if (name && name->find("Ann") != std::string::npos) { + ddyWorkspace.addObject(idfObject); + } } } From 8d1da8383f2d140ec4b1988507b99d14c0db5213 Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Sat, 15 Feb 2025 22:14:57 -0600 Subject: [PATCH 07/44] Good checkpoint, Importing design days appears to be working --- src/openstudio_lib/LocationTabView.cpp | 215 ++++++++++++++++--------- src/openstudio_lib/LocationTabView.hpp | 3 +- 2 files changed, 139 insertions(+), 79 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index 3dadbfc00..c261208d2 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -627,37 +627,38 @@ void LocationView::onWeatherFileBtnClicked() { } } -void LocationView::showDesignDaySelectionDialog(const std::vector& summerDays99, - const std::vector& summerDays99_6, - const std::vector& summerDays2, - const std::vector& summerDays1, - const std::vector& summerDays0_4, - const std::vector& winterDays99, - const std::vector& winterDays99_6, - const std::vector& winterDays2, - const std::vector& winterDays1, - const std::vector& winterDays0_4) { +void LocationView::showDesignDaySelectionDialog(const std::vector> &summerDays99, + const std::vector> &summerDays99_6, + const std::vector> &summerDays2, + const std::vector> &summerDays1, + const std::vector> &summerDays0_4, + const std::vector> &winterDays99, + const std::vector> &winterDays99_6, + const std::vector> &winterDays2, + const std::vector> &winterDays1, + const std::vector> &winterDays0_4, + const std::vector> &allNonAnnual) { QDialog dialog(this); dialog.setWindowTitle(tr("Select Design Days")); QVBoxLayout* layout = new QVBoxLayout(&dialog); - QLabel* summerLabel = new QLabel(tr("Summer Design Days"), &dialog); + QLabel* summerLabel = new QLabel(tr("Annual Summer Design Days"), &dialog); layout->addWidget(summerLabel); - QCheckBox* summerCheckBox99 = nullptr; - QCheckBox* summerCheckBox99_6 = nullptr; - QCheckBox* summerCheckBox2 = nullptr; - QCheckBox* summerCheckBox1 = nullptr; - QCheckBox* summerCheckBox0_4 = nullptr; - - auto addTemperatureLabel = [&](QCheckBox* checkBox, const std::vector& designDays) { + auto addTemperatureLabel = [&](QCheckBox* checkBox, const std::vector& designDays, const bool isSummer) { if (checkBox && checkBox->isChecked()) { for (const auto& modelObject : designDays) { QString dryBulbTemp = QString::number(modelObject.maximumDryBulbTemperature()); QString wetBulbTemp = modelObject.wetBulbOrDewPointAtMaximumDryBulb() ? QString::number(modelObject.wetBulbOrDewPointAtMaximumDryBulb().get()) : "N/A"; QString humidityConditionType = QString::fromStdString(modelObject.humidityConditionType()); - QLabel* tempLabel = new QLabel(tr("Dry Bulb: %1, Wet Bulb: %2, Humidity Condition Type: %3").arg(dryBulbTemp).arg(wetBulbTemp).arg(humidityConditionType), &dialog); + QLabel* tempLabel; + if (isSummer) + { + tempLabel = new QLabel(tr("Dry Bulb: %1, Wet Bulb: %2, Humidity Condition Type: %3").arg(dryBulbTemp).arg(wetBulbTemp).arg(humidityConditionType), &dialog); + } else { + tempLabel = new QLabel(tr("Dry Bulb: %1").arg(dryBulbTemp), &dialog); + } tempLabel->setObjectName(checkBox->text()); layout->insertWidget(layout->indexOf(checkBox) + 1, tempLabel); } @@ -669,76 +670,123 @@ void LocationView::showDesignDaySelectionDialog(const std::vectorbutton(QDialogButtonBox::Ok)->setEnabled(false); + layout->addWidget(buttonBox); + + auto updateOkButtonState = [&]() { + bool anyChecked = (summerCheckBox99 && summerCheckBox99->isChecked()) || + (summerCheckBox99_6 && summerCheckBox99_6->isChecked()) || + (summerCheckBox2 && summerCheckBox2->isChecked()) || + (summerCheckBox1 && summerCheckBox1->isChecked()) || + (summerCheckBox0_4 && summerCheckBox0_4->isChecked()) || + (winterCheckBox99 && winterCheckBox99->isChecked()) || + (winterCheckBox99_6 && winterCheckBox99_6->isChecked()) || + (winterCheckBox2 && winterCheckBox2->isChecked()) || + (winterCheckBox1 && winterCheckBox1->isChecked()) || + (winterCheckBox0_4 && winterCheckBox0_4->isChecked()) || (allNonAnnualCheckBox && allNonAnnualCheckBox->isChecked()); + buttonBox->button(QDialogButtonBox::Ok)->setEnabled(anyChecked); }; if (!summerDays99.empty()) { summerCheckBox99 = new QCheckBox(tr("99% Design Days"), &dialog); layout->addWidget(summerCheckBox99); - connect(summerCheckBox99, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox99, summerDays99); }); + connect(summerCheckBox99, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox99, summerDays99, true); updateOkButtonState(); }); } if (!summerDays99_6.empty()) { summerCheckBox99_6 = new QCheckBox(tr("99.6% Design Days"), &dialog); layout->addWidget(summerCheckBox99_6); - connect(summerCheckBox99_6, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox99_6, summerDays99_6); }); + connect(summerCheckBox99_6, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox99_6, summerDays99_6, true); updateOkButtonState(); }); } if (!summerDays2.empty()) { summerCheckBox2 = new QCheckBox(tr("2% Design Days"), &dialog); layout->addWidget(summerCheckBox2); - connect(summerCheckBox2, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox2, summerDays2); }); + connect(summerCheckBox2, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox2, summerDays2, true); updateOkButtonState(); }); } if (!summerDays1.empty()) { summerCheckBox1 = new QCheckBox(tr("1% Design Days"), &dialog); layout->addWidget(summerCheckBox1); - connect(summerCheckBox1, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox1, summerDays1); }); + connect(summerCheckBox1, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox1, summerDays1, true); updateOkButtonState(); }); } if (!summerDays0_4.empty()) { summerCheckBox0_4 = new QCheckBox(tr("0.4% Design Days"), &dialog); layout->addWidget(summerCheckBox0_4); - connect(summerCheckBox0_4, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox0_4, summerDays0_4); }); + connect(summerCheckBox0_4, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox0_4, summerDays0_4, true); updateOkButtonState(); }); } - QLabel* winterLabel = new QLabel(tr("Winter Design Days"), &dialog); + QLabel* winterLabel = new QLabel(tr("Annual Winter Design Days"), &dialog); layout->addWidget(winterLabel); - QCheckBox* winterCheckBox99 = nullptr; - QCheckBox* winterCheckBox99_6 = nullptr; - QCheckBox* winterCheckBox2 = nullptr; - QCheckBox* winterCheckBox1 = nullptr; - QCheckBox* winterCheckBox0_4 = nullptr; - if (!winterDays99.empty()) { winterCheckBox99 = new QCheckBox(tr("99% Design Days"), &dialog); layout->addWidget(winterCheckBox99); - connect(winterCheckBox99, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(winterCheckBox99, winterDays99); }); + connect(winterCheckBox99, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(winterCheckBox99, winterDays99, false); updateOkButtonState(); }); } if (!winterDays99_6.empty()) { winterCheckBox99_6 = new QCheckBox(tr("99.6% Design Days"), &dialog); layout->addWidget(winterCheckBox99_6); - connect(winterCheckBox99_6, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(winterCheckBox99_6, winterDays99_6); }); + connect(winterCheckBox99_6, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(winterCheckBox99_6, winterDays99_6, false); updateOkButtonState(); }); } if (!winterDays2.empty()) { winterCheckBox2 = new QCheckBox(tr("2% Design Days"), &dialog); layout->addWidget(winterCheckBox2); - connect(winterCheckBox2, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(winterCheckBox2, winterDays2); }); + connect(winterCheckBox2, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(winterCheckBox2, winterDays2, false); updateOkButtonState(); }); } if (!winterDays1.empty()) { winterCheckBox1 = new QCheckBox(tr("1% Design Days"), &dialog); layout->addWidget(winterCheckBox1); - connect(winterCheckBox1, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(winterCheckBox1, winterDays1); }); + connect(winterCheckBox1, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(winterCheckBox1, winterDays1, false); updateOkButtonState(); }); } if (!winterDays0_4.empty()) { winterCheckBox0_4 = new QCheckBox(tr("0.4% Design Days"), &dialog); layout->addWidget(winterCheckBox0_4); - connect(winterCheckBox0_4, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(winterCheckBox0_4, winterDays0_4); }); + connect(winterCheckBox0_4, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(winterCheckBox0_4, winterDays0_4, false); updateOkButtonState(); }); } - QPushButton* selectAllButton = new QPushButton(tr("Select All"), &dialog); + if (!allNonAnnual.empty()) { + allNonAnnualCheckBox = new QCheckBox(tr("All Non-Annual Design Days"), &dialog); + layout->addWidget(allNonAnnualCheckBox); + connect(allNonAnnualCheckBox, &QCheckBox::stateChanged, [=]() { updateOkButtonState(); }); + } + QPushButton* selectAllButton = new QPushButton(tr("Select All Design Days"), &dialog); layout->addWidget(selectAllButton); - QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, &dialog); + buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); layout->addWidget(buttonBox); - connect(selectAllButton, &QPushButton::clicked, [=]() { + if (summerCheckBox99) { + connect(summerCheckBox99, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox99, summerDays99, true); updateOkButtonState(); }); + } + if (summerCheckBox99_6) { + connect(summerCheckBox99_6, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox99_6, summerDays99_6, true); updateOkButtonState(); }); + } + if (summerCheckBox2) { + connect(summerCheckBox2, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox2, summerDays2, true); updateOkButtonState(); }); + } + if (summerCheckBox1) { + connect(summerCheckBox1, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox1, summerDays1, true); updateOkButtonState(); }); + } + if (summerCheckBox0_4) { + connect(summerCheckBox0_4, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox0_4, summerDays0_4, true); updateOkButtonState(); }); + } + + connect(selectAllButton, &QPushButton::clicked, [=]() -> void { if (summerCheckBox99) summerCheckBox99->setChecked(true); if (summerCheckBox99_6) summerCheckBox99_6->setChecked(true); if (summerCheckBox2) summerCheckBox2->setChecked(true); @@ -749,6 +797,8 @@ void LocationView::showDesignDaySelectionDialog(const std::vectorsetChecked(true); if (winterCheckBox1) winterCheckBox1->setChecked(true); if (winterCheckBox0_4) winterCheckBox0_4->setChecked(true); + if (allNonAnnualCheckBox) allNonAnnualCheckBox->setChecked(true); + updateOkButtonState(); }); connect(buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept); @@ -808,8 +858,14 @@ void LocationView::showDesignDaySelectionDialog(const std::vectorisChecked()) { + for (const auto& modelObject : allNonAnnual) { + idfObjectsToInsert.push_back(modelObject.idfObject()); + } + } m_model.insertObjects(idfObjectsToInsert); + QTimer::singleShot(0, this, &LocationView::checkNumDesignDays); } } @@ -832,17 +888,16 @@ void LocationView::onDesignDayBtnClicked() { if (ddyIdfFile) { openstudio::Workspace ddyWorkspace(StrictnessLevel::None, IddFileType::EnergyPlus); + for (const IdfObject& idfObject : ddyIdfFile->objects()) { IddObjectType iddObjectType = idfObject.iddObject().type(); - if (iddObjectType == IddObjectType::SizingPeriod_DesignDay) { - boost::optional name = idfObject.name(); - if (name && name->find("Ann") != std::string::npos) { - ddyWorkspace.addObject(idfObject); - } + if ((iddObjectType == IddObjectType::SizingPeriod_DesignDay) || (iddObjectType == IddObjectType::SizingPeriod_WeatherFileDays) + || (iddObjectType == IddObjectType::SizingPeriod_WeatherFileConditionType)) { + ddyWorkspace.addObject(idfObject); } } - energyplus::ReverseTranslator reverseTranslator; + openstudio::energyplus::ReverseTranslator reverseTranslator; model::Model ddyModel = reverseTranslator.translateWorkspace(ddyWorkspace); // Use a heuristic based on the ddy files provided by EnergyPlus @@ -859,6 +914,7 @@ void LocationView::onDesignDayBtnClicked() { std::vector winterDays2; std::vector winterDays1; std::vector winterDays0_4; + std::vector allNonAnnual; bool unknownDay = false; @@ -871,38 +927,43 @@ void LocationView::onDesignDayBtnClicked() { QString qname = QString::fromStdString(name.get()); QString dayType = QString::fromStdString(designDay.dayType()); - if (qname.contains("99%")) { - if (dayType.contains("Winter")) { - winterDays99.push_back(designDay); - } else if (dayType.contains("Summer")) { - summerdays99.push_back(designDay); - } - } else if (qname.contains("99.6%")) { - if (dayType.contains("Winter")) { - winterDays99_6.push_back(designDay); - } else if (dayType.contains("Summer")) { - summerdays99_6.push_back(designDay); - } - } else if (qname.contains("2%")) { - if (dayType.contains("Winter")) { - winterDays2.push_back(designDay); - } else if (dayType.contains("Summer")) { - summerdays2.push_back(designDay); - } - } else if (qname.contains("1%")) { - if (dayType.contains("Winter")) { - winterDays1.push_back(designDay); - } else if (dayType.contains("Summer")) { - summerdays1.push_back(designDay); - } - } else if (qname.contains(".4%")) { - if (dayType.contains("Winter")) { - winterDays0_4.push_back(designDay); - } else if (dayType.contains("Summer")) { - summerdays0_4.push_back(designDay); + if (qname.toLower().contains("ann")) + { + if (qname.contains("99%")) { + if (dayType.contains("Winter")) { + winterDays99.push_back(designDay); + } else if (dayType.contains("Summer")) { + summerdays99.push_back(designDay); + } + } else if (qname.contains("99.6%")) { + if (dayType.contains("Winter")) { + winterDays99_6.push_back(designDay); + } else if (dayType.contains("Summer")) { + summerdays99_6.push_back(designDay); + } + } else if (qname.contains("2%")) { + if (dayType.contains("Winter")) { + winterDays2.push_back(designDay); + } else if (dayType.contains("Summer")) { + summerdays2.push_back(designDay); + } + } else if (qname.contains("1%")) { + if (dayType.contains("Winter")) { + winterDays1.push_back(designDay); + } else if (dayType.contains("Summer")) { + summerdays1.push_back(designDay); + } + } else if (qname.contains(".4%")) { + if (dayType.contains("Winter")) { + winterDays0_4.push_back(designDay); + } else if (dayType.contains("Summer")) { + summerdays0_4.push_back(designDay); + } + } else { + unknownDay = true; } } else { - unknownDay = true; + allNonAnnual.push_back(designDay); } } } @@ -954,13 +1015,11 @@ void LocationView::onDesignDayBtnClicked() { //} //m_model.insertObjects(ddyModel.objects()); - showDesignDaySelectionDialog(summerdays99, summerdays99_6, summerdays2, summerdays1, summerdays0_4, winterDays99, winterDays99_6, winterDays2, winterDays1, winterDays0_4); + showDesignDaySelectionDialog(summerdays99, summerdays99_6, summerdays2, summerdays1, summerdays0_4, winterDays99, winterDays99_6, winterDays2, winterDays1, winterDays0_4,allNonAnnual); m_lastDdyPathOpened = QFileInfo(fileName).absoluteFilePath(); } } - - QTimer::singleShot(0, this, &LocationView::checkNumDesignDays); } } diff --git a/src/openstudio_lib/LocationTabView.hpp b/src/openstudio_lib/LocationTabView.hpp index 06be26406..82bf1fa9c 100644 --- a/src/openstudio_lib/LocationTabView.hpp +++ b/src/openstudio_lib/LocationTabView.hpp @@ -128,7 +128,8 @@ class LocationView : public QWidget const std::vector& summerDays2, const std::vector& summerDays1, const std::vector& summerDays0_4, const std::vector& winterDays99, const std::vector& winterDays99_6, const std::vector& winterDays2, - const std::vector& winterDays1, const std::vector& winterDays0_4); + const std::vector& winterDays1, const std::vector& winterDays0_4, + const std::vector& allNonAnnual); void onDesignDayBtnClicked(); From b30ab1bb29e3a91daac7f7b338da99f9afe81f17 Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Sat, 15 Feb 2025 22:59:39 -0600 Subject: [PATCH 08/44] Highlight things --- src/openstudio_lib/LocationTabView.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index c261208d2..f238549b8 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -639,11 +639,12 @@ void LocationView::showDesignDaySelectionDialog(const std::vector> &winterDays0_4, const std::vector> &allNonAnnual) { QDialog dialog(this); - dialog.setWindowTitle(tr("Select Design Days")); + dialog.setWindowTitle(tr("Select Design Days")); QVBoxLayout* layout = new QVBoxLayout(&dialog); QLabel* summerLabel = new QLabel(tr("Annual Summer Design Days"), &dialog); + summerLabel->setObjectName("H2"); layout->addWidget(summerLabel); auto addTemperatureLabel = [&](QCheckBox* checkBox, const std::vector& designDays, const bool isSummer) { @@ -731,6 +732,7 @@ void LocationView::showDesignDaySelectionDialog(const std::vectorsetObjectName("H2"); layout->addWidget(winterLabel); if (!winterDays99.empty()) { From 3e55ddfe05566de58393a388ea4b728051b3ade5 Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Sun, 16 Feb 2025 15:40:05 -0600 Subject: [PATCH 09/44] Checkpoint, remove widgets before they are added --- src/openstudio_lib/LocationTabView.cpp | 171 +++++++++++++------------ src/openstudio_lib/LocationTabView.hpp | 19 ++- 2 files changed, 105 insertions(+), 85 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index f238549b8..0f1dd1500 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -627,7 +627,8 @@ void LocationView::onWeatherFileBtnClicked() { } } -void LocationView::showDesignDaySelectionDialog(const std::vector> &summerDays99, +std::vector LocationView::showDesignDaySelectionDialog( + const std::vector> &summerDays99, const std::vector> &summerDays99_6, const std::vector> &summerDays2, const std::vector> &summerDays1, @@ -648,11 +649,19 @@ void LocationView::showDesignDaySelectionDialog(const std::vectoraddWidget(summerLabel); auto addTemperatureLabel = [&](QCheckBox* checkBox, const std::vector& designDays, const bool isSummer) { + // Clear existing labels associated with the checkbox + for (int i = layout->count() - 1; i >= 0; --i) { + QWidget* widget = layout->itemAt(i)->widget(); + if (widget && widget->objectName() == checkBox->text()) { + delete widget; + } + } + if (checkBox && checkBox->isChecked()) { - for (const auto& modelObject : designDays) { - QString dryBulbTemp = QString::number(modelObject.maximumDryBulbTemperature()); - QString wetBulbTemp = modelObject.wetBulbOrDewPointAtMaximumDryBulb() ? QString::number(modelObject.wetBulbOrDewPointAtMaximumDryBulb().get()) : "N/A"; - QString humidityConditionType = QString::fromStdString(modelObject.humidityConditionType()); + for (model::DesignDay designDay : designDays) { + QString dryBulbTemp = QString::number(designDay.maximumDryBulbTemperature()); + QString wetBulbTemp = designDay.wetBulbOrDewPointAtMaximumDryBulb() ? QString::number(designDay.wetBulbOrDewPointAtMaximumDryBulb().get()) : "N/A"; + QString humidityConditionType = QString::fromStdString(designDay.humidityConditionType()); QLabel* tempLabel; if (isSummer) { @@ -663,13 +672,6 @@ void LocationView::showDesignDaySelectionDialog(const std::vectorsetObjectName(checkBox->text()); layout->insertWidget(layout->indexOf(checkBox) + 1, tempLabel); } - } else { - for (int i = layout->count() - 1; i >= 0; --i) { - QWidget* widget = layout->itemAt(i)->widget(); - if (widget && widget->objectName() == checkBox->text()) { - delete widget; - } - } } dialog.adjustSize(); }; @@ -806,73 +808,75 @@ void LocationView::showDesignDaySelectionDialog(const std::vector idfObjectsToInsert; + std::vector designDaysToInsert; + if (dialog.exec() == QDialog::Accepted) { + if (summerCheckBox99 && summerCheckBox99->isChecked()) { - for (const auto& modelObject : summerDays99) { - idfObjectsToInsert.push_back(modelObject.idfObject()); + for (model::DesignDay designDay : summerDays99) { + + designDaysToInsert.push_back(designDay); } } if (summerCheckBox99_6 && summerCheckBox99_6->isChecked()) { - for (const auto& modelObject : summerDays99_6) { - idfObjectsToInsert.push_back(modelObject.idfObject()); + for (model::DesignDay designDay : summerDays99_6) { + designDaysToInsert.push_back(designDay); } } if (summerCheckBox2 && summerCheckBox2->isChecked()) { - for (const auto& modelObject : summerDays2) { - idfObjectsToInsert.push_back(modelObject.idfObject()); + for (model::DesignDay designDay : summerDays2) { + designDaysToInsert.push_back(designDay); } } if (summerCheckBox1 && summerCheckBox1->isChecked()) { - for (const auto& modelObject : summerDays1) { - idfObjectsToInsert.push_back(modelObject.idfObject()); + for (model::DesignDay designDay : summerDays1) { + designDaysToInsert.push_back(designDay); } } if (summerCheckBox0_4 && summerCheckBox0_4->isChecked()) { - for (const auto& modelObject : summerDays0_4) { - idfObjectsToInsert.push_back(modelObject.idfObject()); + for (model::DesignDay designDay : summerDays0_4) { + designDaysToInsert.push_back(designDay); } } if (winterCheckBox99 && winterCheckBox99->isChecked()) { - for (const auto& modelObject : winterDays99) { - idfObjectsToInsert.push_back(modelObject.idfObject()); + for (model::DesignDay designDay : winterDays99) { + designDaysToInsert.push_back(designDay); } } if (winterCheckBox99_6 && winterCheckBox99_6->isChecked()) { - for (const auto& modelObject : winterDays99_6) { - idfObjectsToInsert.push_back(modelObject.idfObject()); + for (model::DesignDay designDay : winterDays99_6) { + designDaysToInsert.push_back(designDay); } } if (winterCheckBox2 && winterCheckBox2->isChecked()) { - for (const auto& modelObject : winterDays2) { - idfObjectsToInsert.push_back(modelObject.idfObject()); + for (model::DesignDay designDay : winterDays2) { + designDaysToInsert.push_back(designDay); } } if (winterCheckBox1 && winterCheckBox1->isChecked()) { - for (const auto& modelObject : winterDays1) { - idfObjectsToInsert.push_back(modelObject.idfObject()); + for (model::DesignDay designDay : winterDays1) { + designDaysToInsert.push_back(designDay); } } if (winterCheckBox0_4 && winterCheckBox0_4->isChecked()) { - for (const auto& modelObject : winterDays0_4) { - idfObjectsToInsert.push_back(modelObject.idfObject()); + for (model::DesignDay designDay : winterDays0_4) { + designDaysToInsert.push_back(designDay); } } if (allNonAnnualCheckBox && allNonAnnualCheckBox->isChecked()) { - for (const auto& modelObject : allNonAnnual) { - idfObjectsToInsert.push_back(modelObject.idfObject()); + for (model::DesignDay designDay : allNonAnnual) { + designDaysToInsert.push_back(designDay); } } - - m_model.insertObjects(idfObjectsToInsert); - QTimer::singleShot(0, this, &LocationView::checkNumDesignDays); } + + return designDaysToInsert; } void LocationView::onDesignDayBtnClicked() { QString fileTypes("Files (*.ddy)"); + std::vector designDaysToInsert; QString lastPath = m_lastDdyPathOpened; if (lastPath.isEmpty() && m_lastEpwPathOpened.isEmpty()) { @@ -971,45 +975,45 @@ void LocationView::onDesignDayBtnClicked() { } // Pick only the most stringent design points - if (!unknownDay) { - if (!summerdays99_6.empty()) { - for (model::DesignDay designDay : summerdays99) { - designDay.remove(); - } - } - - if (!summerdays0_4.empty()) { - for (model::DesignDay designDay : summerdays1) { - designDay.remove(); - } - for (model::DesignDay designDay : summerdays2) { - designDay.remove(); - } - } else if (!summerdays1.empty()) { - for (model::DesignDay designDay : summerdays2) { - designDay.remove(); - } - } - - if (!winterDays99_6.empty()) { - for (model::DesignDay designDay : winterDays99) { - designDay.remove(); - } - } - - if (!winterDays0_4.empty()) { - for (model::DesignDay designDay : winterDays1) { - designDay.remove(); - } - for (model::DesignDay designDay : winterDays2) { - designDay.remove(); - } - } else if (!winterDays1.empty()) { - for (model::DesignDay designDay : winterDays2) { - designDay.remove(); - } - } - } + // if (!unknownDay) { + // if (!summerdays99_6.empty()) { + // for (model::DesignDay designDay : summerdays99) { + // designDay.remove(); + // } + // } + + // if (!summerdays0_4.empty()) { + // for (model::DesignDay designDay : summerdays1) { + // designDay.remove(); + // } + // for (model::DesignDay designDay : summerdays2) { + // designDay.remove(); + // } + // } else if (!summerdays1.empty()) { + // for (model::DesignDay designDay : summerdays2) { + // designDay.remove(); + // } + // } + + // if (!winterDays99_6.empty()) { + // for (model::DesignDay designDay : winterDays99) { + // designDay.remove(); + // } + // } + + // if (!winterDays0_4.empty()) { + // for (model::DesignDay designDay : winterDays1) { + // designDay.remove(); + // } + // for (model::DesignDay designDay : winterDays2) { + // designDay.remove(); + // } + // } else if (!winterDays1.empty()) { + // for (model::DesignDay designDay : winterDays2) { + // designDay.remove(); + // } + // } + // } // Evan note: do not remove existing design days //for (model::SizingPeriod sizingPeriod : m_model.getModelObjects()){ @@ -1017,7 +1021,16 @@ void LocationView::onDesignDayBtnClicked() { //} //m_model.insertObjects(ddyModel.objects()); - showDesignDaySelectionDialog(summerdays99, summerdays99_6, summerdays2, summerdays1, summerdays0_4, winterDays99, winterDays99_6, winterDays2, winterDays1, winterDays0_4,allNonAnnual); + designDaysToInsert = showDesignDaySelectionDialog(summerdays99, summerdays99_6, summerdays2, summerdays1, summerdays0_4, winterDays99, winterDays99_6, winterDays2, winterDays1, winterDays0_4,allNonAnnual); + + // Remove design days from ddyModel that are not in designDaysToInsert + for (auto& designDay : ddyModel.getConcreteModelObjects()) { + if (std::find(designDaysToInsert.begin(), designDaysToInsert.end(), designDay) == designDaysToInsert.end()) { + designDay.remove(); + } + } + + m_model.insertObjects(ddyModel.objects()); m_lastDdyPathOpened = QFileInfo(fileName).absoluteFilePath(); } diff --git a/src/openstudio_lib/LocationTabView.hpp b/src/openstudio_lib/LocationTabView.hpp index 82bf1fa9c..f360cc584 100644 --- a/src/openstudio_lib/LocationTabView.hpp +++ b/src/openstudio_lib/LocationTabView.hpp @@ -124,12 +124,19 @@ class LocationView : public QWidget void onWeatherFileBtnClicked(); - void showDesignDaySelectionDialog(const std::vector& summerDays99, const std::vector& summerDays99_6, - const std::vector& summerDays2, const std::vector& summerDays1, - const std::vector& summerDays0_4, const std::vector& winterDays99, - const std::vector& winterDays99_6, const std::vector& winterDays2, - const std::vector& winterDays1, const std::vector& winterDays0_4, - const std::vector& allNonAnnual); + std::vector + showDesignDaySelectionDialog(const std::vector>& summerDays99, + const std::vector>& summerDays99_6, + const std::vector>& summerDays2, + const std::vector>& summerDays1, + const std::vector>& summerDays0_4, + const std::vector>& winterDays99, + const std::vector>& winterDays99_6, + const std::vector>& winterDays2, + const std::vector>& winterDays1, + const std::vector>& winterDays0_4, + const std::vector>& allNonAnnual); + void onDesignDayBtnClicked(); From e50e396366e01205629ae79f385242d22a1f80d4 Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Sun, 16 Feb 2025 22:23:39 -0600 Subject: [PATCH 10/44] Checkpoint clean up and appears to be working --- src/openstudio_lib/LocationTabView.cpp | 206 ++++++++++--------------- src/openstudio_lib/LocationTabView.hpp | 6 +- 2 files changed, 84 insertions(+), 128 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index 0f1dd1500..c13948165 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -64,6 +64,8 @@ #include #include #include +#include +#include static constexpr auto NAME("Name: "); static constexpr auto LATITUDE("Latitude: "); @@ -627,18 +629,75 @@ void LocationView::onWeatherFileBtnClicked() { } } -std::vector LocationView::showDesignDaySelectionDialog( - const std::vector> &summerDays99, - const std::vector> &summerDays99_6, - const std::vector> &summerDays2, - const std::vector> &summerDays1, - const std::vector> &summerDays0_4, - const std::vector> &winterDays99, - const std::vector> &winterDays99_6, - const std::vector> &winterDays2, - const std::vector> &winterDays1, - const std::vector> &winterDays0_4, - const std::vector> &allNonAnnual) { +std::tuple, std::vector, std::vector, std::vector, std::vector, std::vector, std::vector, std::vector, std::vector, std::vector, std::vector> LocationView::sortDesignDays(const model::Model& ddyModel) { + std::vector summerdays99; + std::vector summerdays99_6; + std::vector summerdays2; + std::vector summerdays1; + std::vector summerdays0_4; + std::vector winterDays99; + std::vector winterDays99_6; + std::vector winterDays2; + std::vector winterDays1; + std::vector winterDays0_4; + std::vector allNonAnnual; + + for (const model::DesignDay& designDay : ddyModel.getConcreteModelObjects()) { + boost::optional name = designDay.name(); + + if (name) { + QString qname = QString::fromStdString(name.get()); + QString dayType = QString::fromStdString(designDay.dayType()); + + if (qname.toLower().contains("ann")) { + if (qname.contains("99%")) { + if (dayType.contains("Winter")) { + winterDays99.push_back(designDay); + } else if (dayType.contains("Summer")) { + summerdays99.push_back(designDay); + } + } else if (qname.contains("99.6%")) { + if (dayType.contains("Winter")) { + winterDays99_6.push_back(designDay); + } else if (dayType.contains("Summer")) { + summerdays99_6.push_back(designDay); + } + } else if (qname.contains("2%")) { + if (dayType.contains("Winter")) { + winterDays2.push_back(designDay); + } else if (dayType.contains("Summer")) { + summerdays2.push_back(designDay); + } + } else if (qname.contains("1%")) { + if (dayType.contains("Winter")) { + winterDays1.push_back(designDay); + } else if (dayType.contains("Summer")) { + summerdays1.push_back(designDay); + } + } else if (qname.contains(".4%")) { + if (dayType.contains("Winter")) { + winterDays0_4.push_back(designDay); + } else if (dayType.contains("Summer")) { + summerdays0_4.push_back(designDay); + } + } + } else { + allNonAnnual.push_back(designDay); + } + } + } + return std::make_tuple( + summerdays99, summerdays99_6, summerdays2, summerdays1, summerdays0_4, + winterDays99, winterDays99_6, winterDays2, winterDays1, winterDays0_4, + allNonAnnual + ); +} + +std::vector LocationView::showDesignDaySelectionDialog( + const std::vector& summerDays99, const std::vector& summerDays99_6, const std::vector& summerDays2, + const std::vector& summerDays1, const std::vector& summerDays0_4, const std::vector& winterDays99, + const std::vector& winterDays99_6, const std::vector& winterDays2, const std::vector& winterDays1, + const std::vector& winterDays0_4, const std::vector& allNonAnnual) { QDialog dialog(this); dialog.setWindowTitle(tr("Select Design Days")); @@ -663,8 +722,7 @@ std::vector LocationView::showDesignDaySelectionD QString wetBulbTemp = designDay.wetBulbOrDewPointAtMaximumDryBulb() ? QString::number(designDay.wetBulbOrDewPointAtMaximumDryBulb().get()) : "N/A"; QString humidityConditionType = QString::fromStdString(designDay.humidityConditionType()); QLabel* tempLabel; - if (isSummer) - { + if (isSummer) { tempLabel = new QLabel(tr("Dry Bulb: %1, Wet Bulb: %2, Humidity Condition Type: %3").arg(dryBulbTemp).arg(wetBulbTemp).arg(humidityConditionType), &dialog); } else { tempLabel = new QLabel(tr("Dry Bulb: %1").arg(dryBulbTemp), &dialog); @@ -730,7 +788,7 @@ std::vector LocationView::showDesignDaySelectionD if (!summerDays0_4.empty()) { summerCheckBox0_4 = new QCheckBox(tr("0.4% Design Days"), &dialog); layout->addWidget(summerCheckBox0_4); - connect(summerCheckBox0_4, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox0_4, summerDays0_4, true); updateOkButtonState(); }); + connect(summerCheckBox0_4, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox0_4,summerDays0_4, true); updateOkButtonState(); }); } QLabel* winterLabel = new QLabel(tr("Annual Winter Design Days"), &dialog); @@ -745,7 +803,7 @@ std::vector LocationView::showDesignDaySelectionD if (!winterDays99_6.empty()) { winterCheckBox99_6 = new QCheckBox(tr("99.6% Design Days"), &dialog); layout->addWidget(winterCheckBox99_6); - connect(winterCheckBox99_6, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(winterCheckBox99_6, winterDays99_6, false); updateOkButtonState(); }); + connect(winterCheckBox99_6, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(winterCheckBox99_6, winterDays99_6 , false); updateOkButtonState(); }); } if (!winterDays2.empty()) { winterCheckBox2 = new QCheckBox(tr("2% Design Days"), &dialog); @@ -760,7 +818,7 @@ std::vector LocationView::showDesignDaySelectionD if (!winterDays0_4.empty()) { winterCheckBox0_4 = new QCheckBox(tr("0.4% Design Days"), &dialog); layout->addWidget(winterCheckBox0_4); - connect(winterCheckBox0_4, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(winterCheckBox0_4, winterDays0_4, false); updateOkButtonState(); }); + connect(winterCheckBox0_4, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(winterCheckBox0_4, winterDays0_4 , false); updateOkButtonState(); }); } if (!allNonAnnual.empty()) { @@ -790,7 +848,7 @@ std::vector LocationView::showDesignDaySelectionD connect(summerCheckBox0_4, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox0_4, summerDays0_4, true); updateOkButtonState(); }); } - connect(selectAllButton, &QPushButton::clicked, [=]() -> void { + connect(selectAllButton, &QPushButton::clicked, [=]() -> void { if (summerCheckBox99) summerCheckBox99->setChecked(true); if (summerCheckBox99_6) summerCheckBox99_6->setChecked(true); if (summerCheckBox2) summerCheckBox2->setChecked(true); @@ -811,10 +869,8 @@ std::vector LocationView::showDesignDaySelectionD std::vector designDaysToInsert; if (dialog.exec() == QDialog::Accepted) { - if (summerCheckBox99 && summerCheckBox99->isChecked()) { for (model::DesignDay designDay : summerDays99) { - designDaysToInsert.push_back(designDay); } } @@ -909,111 +965,7 @@ void LocationView::onDesignDayBtnClicked() { // Use a heuristic based on the ddy files provided by EnergyPlus // Filter out the days that are not helpful. if (!ddyModel.objects().empty()) { - // Containers to hold 99%, 99.6%, 2%, 1%, and 0.4% design points - std::vector summerdays99; - std::vector summerdays99_6; - std::vector summerdays2; - std::vector summerdays1; - std::vector summerdays0_4; - std::vector winterDays99; - std::vector winterDays99_6; - std::vector winterDays2; - std::vector winterDays1; - std::vector winterDays0_4; - std::vector allNonAnnual; - - bool unknownDay = false; - - for (const model::DesignDay& designDay : ddyModel.getConcreteModelObjects()) { - boost::optional name; - name = designDay.name(); - - if (name) { - - QString qname = QString::fromStdString(name.get()); - QString dayType = QString::fromStdString(designDay.dayType()); - - if (qname.toLower().contains("ann")) - { - if (qname.contains("99%")) { - if (dayType.contains("Winter")) { - winterDays99.push_back(designDay); - } else if (dayType.contains("Summer")) { - summerdays99.push_back(designDay); - } - } else if (qname.contains("99.6%")) { - if (dayType.contains("Winter")) { - winterDays99_6.push_back(designDay); - } else if (dayType.contains("Summer")) { - summerdays99_6.push_back(designDay); - } - } else if (qname.contains("2%")) { - if (dayType.contains("Winter")) { - winterDays2.push_back(designDay); - } else if (dayType.contains("Summer")) { - summerdays2.push_back(designDay); - } - } else if (qname.contains("1%")) { - if (dayType.contains("Winter")) { - winterDays1.push_back(designDay); - } else if (dayType.contains("Summer")) { - summerdays1.push_back(designDay); - } - } else if (qname.contains(".4%")) { - if (dayType.contains("Winter")) { - winterDays0_4.push_back(designDay); - } else if (dayType.contains("Summer")) { - summerdays0_4.push_back(designDay); - } - } else { - unknownDay = true; - } - } else { - allNonAnnual.push_back(designDay); - } - } - } - - // Pick only the most stringent design points - // if (!unknownDay) { - // if (!summerdays99_6.empty()) { - // for (model::DesignDay designDay : summerdays99) { - // designDay.remove(); - // } - // } - - // if (!summerdays0_4.empty()) { - // for (model::DesignDay designDay : summerdays1) { - // designDay.remove(); - // } - // for (model::DesignDay designDay : summerdays2) { - // designDay.remove(); - // } - // } else if (!summerdays1.empty()) { - // for (model::DesignDay designDay : summerdays2) { - // designDay.remove(); - // } - // } - - // if (!winterDays99_6.empty()) { - // for (model::DesignDay designDay : winterDays99) { - // designDay.remove(); - // } - // } - - // if (!winterDays0_4.empty()) { - // for (model::DesignDay designDay : winterDays1) { - // designDay.remove(); - // } - // for (model::DesignDay designDay : winterDays2) { - // designDay.remove(); - // } - // } else if (!winterDays1.empty()) { - // for (model::DesignDay designDay : winterDays2) { - // designDay.remove(); - // } - // } - // } + // Evan note: do not remove existing design days //for (model::SizingPeriod sizingPeriod : m_model.getModelObjects()){ @@ -1021,7 +973,9 @@ void LocationView::onDesignDayBtnClicked() { //} //m_model.insertObjects(ddyModel.objects()); - designDaysToInsert = showDesignDaySelectionDialog(summerdays99, summerdays99_6, summerdays2, summerdays1, summerdays0_4, winterDays99, winterDays99_6, winterDays2, winterDays1, winterDays0_4,allNonAnnual); + auto [summerDays99, summerDays99_6, summerDays2, summerDays1, summerDays0_4, winterDays99, winterDays99_6, winterDays2, winterDays1, winterDays0_4, allNonAnnual] = sortDesignDays(ddyModel); + + std::vector designDaysToInsert = showDesignDaySelectionDialog(summerDays99, summerDays99_6, summerDays2, summerDays1, summerDays0_4, winterDays99, winterDays99_6, winterDays2, winterDays1, winterDays0_4, allNonAnnual); // Remove design days from ddyModel that are not in designDaysToInsert for (auto& designDay : ddyModel.getConcreteModelObjects()) { diff --git a/src/openstudio_lib/LocationTabView.hpp b/src/openstudio_lib/LocationTabView.hpp index f360cc584..124f67671 100644 --- a/src/openstudio_lib/LocationTabView.hpp +++ b/src/openstudio_lib/LocationTabView.hpp @@ -124,8 +124,10 @@ class LocationView : public QWidget void onWeatherFileBtnClicked(); - std::vector - showDesignDaySelectionDialog(const std::vector>& summerDays99, + + std::tuple, std::vector, std::vector, std::vector, std::vector, std::vector, std::vector, std::vector, std::vector, std::vector, std::vector> sortDesignDays(const model::Model& ddyModel); + + std::vector showDesignDaySelectionDialog(const std::vector>& summerDays99, const std::vector>& summerDays99_6, const std::vector>& summerDays2, const std::vector>& summerDays1, From cca6bbc65631ecea8cb938f95cba037d21eba3f7 Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Mon, 17 Feb 2025 15:21:52 -0600 Subject: [PATCH 11/44] Checkpoint this is much cleaner --- src/openstudio_lib/LocationTabView.cpp | 219 +++++++------------------ src/openstudio_lib/LocationTabView.hpp | 14 +- 2 files changed, 57 insertions(+), 176 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index c13948165..657813371 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -629,75 +629,33 @@ void LocationView::onWeatherFileBtnClicked() { } } -std::tuple, std::vector, std::vector, std::vector, std::vector, std::vector, std::vector, std::vector, std::vector, std::vector, std::vector> LocationView::sortDesignDays(const model::Model& ddyModel) { - std::vector summerdays99; - std::vector summerdays99_6; - std::vector summerdays2; - std::vector summerdays1; - std::vector summerdays0_4; - std::vector winterDays99; - std::vector winterDays99_6; - std::vector winterDays2; - std::vector winterDays1; - std::vector winterDays0_4; - std::vector allNonAnnual; - - for (const model::DesignDay& designDay : ddyModel.getConcreteModelObjects()) { - boost::optional name = designDay.name(); +std::string toLowerCase(const std::string& str) { + std::string lowerStr = str; + std::transform(lowerStr.begin(), lowerStr.end(), lowerStr.begin(), [](unsigned char c) { return std::tolower(c); }); + return lowerStr; +} - if (name) { - QString qname = QString::fromStdString(name.get()); - QString dayType = QString::fromStdString(designDay.dayType()); +std::vector filterDesignDays(const std::vector& designDays, const std::string& dayType, const std::string& percentage, const std::string& humidityConditionType = "") { + std::vector filteredDesignDays; - if (qname.toLower().contains("ann")) { - if (qname.contains("99%")) { - if (dayType.contains("Winter")) { - winterDays99.push_back(designDay); - } else if (dayType.contains("Summer")) { - summerdays99.push_back(designDay); - } - } else if (qname.contains("99.6%")) { - if (dayType.contains("Winter")) { - winterDays99_6.push_back(designDay); - } else if (dayType.contains("Summer")) { - summerdays99_6.push_back(designDay); - } - } else if (qname.contains("2%")) { - if (dayType.contains("Winter")) { - winterDays2.push_back(designDay); - } else if (dayType.contains("Summer")) { - summerdays2.push_back(designDay); - } - } else if (qname.contains("1%")) { - if (dayType.contains("Winter")) { - winterDays1.push_back(designDay); - } else if (dayType.contains("Summer")) { - summerdays1.push_back(designDay); - } - } else if (qname.contains(".4%")) { - if (dayType.contains("Winter")) { - winterDays0_4.push_back(designDay); - } else if (dayType.contains("Summer")) { - summerdays0_4.push_back(designDay); - } - } - } else { - allNonAnnual.push_back(designDay); - } + std::copy_if(designDays.begin(), designDays.end(), std::back_inserter(filteredDesignDays), [&](const model::DesignDay& designDay) { + boost::optional name = designDay.name(); + + if (!QString::fromStdString(toLowerCase(name.get())).contains("ann")) { + return false; } - } - return std::make_tuple( - summerdays99, summerdays99_6, summerdays2, summerdays1, summerdays0_4, - winterDays99, winterDays99_6, winterDays2, winterDays1, winterDays0_4, - allNonAnnual - ); + + bool matchesHumidityConditionType = humidityConditionType.empty() || toLowerCase(designDay.humidityConditionType()) == toLowerCase(humidityConditionType); + return name && QString::fromStdString(name.get()).contains(QString::fromStdString(percentage)) && + toLowerCase(designDay.dayType()) == toLowerCase(dayType) && matchesHumidityConditionType; + }); + + return filteredDesignDays; } std::vector LocationView::showDesignDaySelectionDialog( - const std::vector& summerDays99, const std::vector& summerDays99_6, const std::vector& summerDays2, - const std::vector& summerDays1, const std::vector& summerDays0_4, const std::vector& winterDays99, - const std::vector& winterDays99_6, const std::vector& winterDays2, const std::vector& winterDays1, - const std::vector& winterDays0_4, const std::vector& allNonAnnual) { + const std::vector& allDesignDays) { + QDialog dialog(this); dialog.setWindowTitle(tr("Select Design Days")); @@ -733,57 +691,47 @@ std::vector LocationView::showDesignDaySelectionDi } dialog.adjustSize(); }; + + + std::vector summerDesignDays2 = filterDesignDays(allDesignDays, "SummerDesignDay", "2%", "Wetbulb"); + std::vector summerdays1 = filterDesignDays(allDesignDays, "SummerDesignDay", "1%", "Wetbulb"); + std::vector summerDays0_4 = filterDesignDays(allDesignDays, "SummerDesignDay", "0.4%", "Wetbulb"); + + + std::vector winterDays99 = filterDesignDays(allDesignDays, "WinterDesignDay", "99%"); + std::vector winterDays99_6 = filterDesignDays(allDesignDays, "WinterDesignDay", "1%"); + + bool import_all_design_days = false; - QCheckBox* summerCheckBox99 = nullptr; - QCheckBox* summerCheckBox99_6 = nullptr; QCheckBox* summerCheckBox2 = nullptr; QCheckBox* summerCheckBox1 = nullptr; QCheckBox* summerCheckBox0_4 = nullptr; QCheckBox* winterCheckBox99 = nullptr; QCheckBox* winterCheckBox99_6 = nullptr; - QCheckBox* winterCheckBox2 = nullptr; - QCheckBox* winterCheckBox1 = nullptr; - QCheckBox* winterCheckBox0_4 = nullptr; - QCheckBox* allNonAnnualCheckBox = nullptr; QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, &dialog); buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); layout->addWidget(buttonBox); auto updateOkButtonState = [&]() { - bool anyChecked = (summerCheckBox99 && summerCheckBox99->isChecked()) || - (summerCheckBox99_6 && summerCheckBox99_6->isChecked()) || - (summerCheckBox2 && summerCheckBox2->isChecked()) || + bool anyChecked = (summerCheckBox2 && summerCheckBox2->isChecked()) || (summerCheckBox1 && summerCheckBox1->isChecked()) || (summerCheckBox0_4 && summerCheckBox0_4->isChecked()) || (winterCheckBox99 && winterCheckBox99->isChecked()) || - (winterCheckBox99_6 && winterCheckBox99_6->isChecked()) || - (winterCheckBox2 && winterCheckBox2->isChecked()) || - (winterCheckBox1 && winterCheckBox1->isChecked()) || - (winterCheckBox0_4 && winterCheckBox0_4->isChecked()) || (allNonAnnualCheckBox && allNonAnnualCheckBox->isChecked()); + (winterCheckBox99_6 && winterCheckBox99_6->isChecked()); buttonBox->button(QDialogButtonBox::Ok)->setEnabled(anyChecked); }; - if (!summerDays99.empty()) { - summerCheckBox99 = new QCheckBox(tr("99% Design Days"), &dialog); - layout->addWidget(summerCheckBox99); - connect(summerCheckBox99, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox99, summerDays99, true); updateOkButtonState(); }); - } - if (!summerDays99_6.empty()) { - summerCheckBox99_6 = new QCheckBox(tr("99.6% Design Days"), &dialog); - layout->addWidget(summerCheckBox99_6); - connect(summerCheckBox99_6, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox99_6, summerDays99_6, true); updateOkButtonState(); }); - } - if (!summerDays2.empty()) { + if (!summerDesignDays2.empty()) { summerCheckBox2 = new QCheckBox(tr("2% Design Days"), &dialog); layout->addWidget(summerCheckBox2); - connect(summerCheckBox2, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox2, summerDays2, true); updateOkButtonState(); }); + connect(summerCheckBox2, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox2, summerDesignDays2, true); updateOkButtonState(); }); } - if (!summerDays1.empty()) { + if (!summerdays1.empty()) { summerCheckBox1 = new QCheckBox(tr("1% Design Days"), &dialog); layout->addWidget(summerCheckBox1); - connect(summerCheckBox1, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox1, summerDays1, true); updateOkButtonState(); }); + connect(summerCheckBox1, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox1, summerdays1, true); updateOkButtonState(); }); } if (!summerDays0_4.empty()) { summerCheckBox0_4 = new QCheckBox(tr("0.4% Design Days"), &dialog); @@ -805,61 +753,30 @@ std::vector LocationView::showDesignDaySelectionDi layout->addWidget(winterCheckBox99_6); connect(winterCheckBox99_6, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(winterCheckBox99_6, winterDays99_6 , false); updateOkButtonState(); }); } - if (!winterDays2.empty()) { - winterCheckBox2 = new QCheckBox(tr("2% Design Days"), &dialog); - layout->addWidget(winterCheckBox2); - connect(winterCheckBox2, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(winterCheckBox2, winterDays2, false); updateOkButtonState(); }); - } - if (!winterDays1.empty()) { - winterCheckBox1 = new QCheckBox(tr("1% Design Days"), &dialog); - layout->addWidget(winterCheckBox1); - connect(winterCheckBox1, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(winterCheckBox1, winterDays1, false); updateOkButtonState(); }); - } - if (!winterDays0_4.empty()) { - winterCheckBox0_4 = new QCheckBox(tr("0.4% Design Days"), &dialog); - layout->addWidget(winterCheckBox0_4); - connect(winterCheckBox0_4, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(winterCheckBox0_4, winterDays0_4 , false); updateOkButtonState(); }); - } - if (!allNonAnnual.empty()) { - allNonAnnualCheckBox = new QCheckBox(tr("All Non-Annual Design Days"), &dialog); - layout->addWidget(allNonAnnualCheckBox); - connect(allNonAnnualCheckBox, &QCheckBox::stateChanged, [=]() { updateOkButtonState(); }); - } - QPushButton* selectAllButton = new QPushButton(tr("Select All Design Days"), &dialog); + QPushButton* selectAllButton = new QPushButton(tr("Skip selection and import all design days from ddy"), &dialog); layout->addWidget(selectAllButton); buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); layout->addWidget(buttonBox); - if (summerCheckBox99) { - connect(summerCheckBox99, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox99, summerDays99, true); updateOkButtonState(); }); - } - if (summerCheckBox99_6) { - connect(summerCheckBox99_6, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox99_6, summerDays99_6, true); updateOkButtonState(); }); - } if (summerCheckBox2) { - connect(summerCheckBox2, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox2, summerDays2, true); updateOkButtonState(); }); + connect(summerCheckBox2, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox2, summerDesignDays2, true); updateOkButtonState(); }); } if (summerCheckBox1) { - connect(summerCheckBox1, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox1, summerDays1, true); updateOkButtonState(); }); + connect(summerCheckBox1, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox1, summerdays1, true); updateOkButtonState(); }); } if (summerCheckBox0_4) { connect(summerCheckBox0_4, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox0_4, summerDays0_4, true); updateOkButtonState(); }); } - connect(selectAllButton, &QPushButton::clicked, [=]() -> void { - if (summerCheckBox99) summerCheckBox99->setChecked(true); - if (summerCheckBox99_6) summerCheckBox99_6->setChecked(true); + connect(selectAllButton, &QPushButton::clicked, [&]() -> void { if (summerCheckBox2) summerCheckBox2->setChecked(true); if (summerCheckBox1) summerCheckBox1->setChecked(true); if (summerCheckBox0_4) summerCheckBox0_4->setChecked(true); if (winterCheckBox99) winterCheckBox99->setChecked(true); if (winterCheckBox99_6) winterCheckBox99_6->setChecked(true); - if (winterCheckBox2) winterCheckBox2->setChecked(true); - if (winterCheckBox1) winterCheckBox1->setChecked(true); - if (winterCheckBox0_4) winterCheckBox0_4->setChecked(true); - if (allNonAnnualCheckBox) allNonAnnualCheckBox->setChecked(true); + import_all_design_days = true; updateOkButtonState(); }); @@ -869,23 +786,13 @@ std::vector LocationView::showDesignDaySelectionDi std::vector designDaysToInsert; if (dialog.exec() == QDialog::Accepted) { - if (summerCheckBox99 && summerCheckBox99->isChecked()) { - for (model::DesignDay designDay : summerDays99) { - designDaysToInsert.push_back(designDay); - } - } - if (summerCheckBox99_6 && summerCheckBox99_6->isChecked()) { - for (model::DesignDay designDay : summerDays99_6) { - designDaysToInsert.push_back(designDay); - } - } if (summerCheckBox2 && summerCheckBox2->isChecked()) { - for (model::DesignDay designDay : summerDays2) { + for (model::DesignDay designDay : summerDesignDays2) { designDaysToInsert.push_back(designDay); } } if (summerCheckBox1 && summerCheckBox1->isChecked()) { - for (model::DesignDay designDay : summerDays1) { + for (model::DesignDay designDay : summerdays1) { designDaysToInsert.push_back(designDay); } } @@ -905,29 +812,16 @@ std::vector LocationView::showDesignDaySelectionDi designDaysToInsert.push_back(designDay); } } - if (winterCheckBox2 && winterCheckBox2->isChecked()) { - for (model::DesignDay designDay : winterDays2) { - designDaysToInsert.push_back(designDay); - } - } - if (winterCheckBox1 && winterCheckBox1->isChecked()) { - for (model::DesignDay designDay : winterDays1) { - designDaysToInsert.push_back(designDay); - } - } - if (winterCheckBox0_4 && winterCheckBox0_4->isChecked()) { - for (model::DesignDay designDay : winterDays0_4) { - designDaysToInsert.push_back(designDay); - } - } - if (allNonAnnualCheckBox && allNonAnnualCheckBox->isChecked()) { - for (model::DesignDay designDay : allNonAnnual) { - designDaysToInsert.push_back(designDay); - } - } } - return designDaysToInsert; + if (import_all_design_days) + { + return allDesignDays; + } else + { + return designDaysToInsert; + } + } void LocationView::onDesignDayBtnClicked() { @@ -973,9 +867,8 @@ void LocationView::onDesignDayBtnClicked() { //} //m_model.insertObjects(ddyModel.objects()); - auto [summerDays99, summerDays99_6, summerDays2, summerDays1, summerDays0_4, winterDays99, winterDays99_6, winterDays2, winterDays1, winterDays0_4, allNonAnnual] = sortDesignDays(ddyModel); - std::vector designDaysToInsert = showDesignDaySelectionDialog(summerDays99, summerDays99_6, summerDays2, summerDays1, summerDays0_4, winterDays99, winterDays99_6, winterDays2, winterDays1, winterDays0_4, allNonAnnual); + std::vector designDaysToInsert = showDesignDaySelectionDialog(ddyModel.getModelObjects()); // Remove design days from ddyModel that are not in designDaysToInsert for (auto& designDay : ddyModel.getConcreteModelObjects()) { @@ -1049,7 +942,7 @@ void LocationView::setDstStartDayOfWeekAndMonth(int newWeek, int newDay, int new void LocationView::setDstStartDate(const QDate& newdate) { auto dst = m_model.getUniqueModelObject(); - dst.setStartDate(monthOfYear(newdate.month()), newdate.day()); + dst.setStartDate(MonthOfYear(newdate.month()), newdate.day()); } void LocationView::setDstEndDayOfWeekAndMonth(int newWeek, int newDay, int newMonth) { @@ -1061,7 +954,7 @@ void LocationView::setDstEndDayOfWeekAndMonth(int newWeek, int newDay, int newMo void LocationView::setDstEndDate(const QDate& newdate) { auto dst = m_model.getUniqueModelObject(); - dst.setEndDate(monthOfYear(newdate.month()), newdate.day()); + dst.setEndDate(MonthOfYear(newdate.month()), newdate.day()); } void LocationView::onSelectItem() { diff --git a/src/openstudio_lib/LocationTabView.hpp b/src/openstudio_lib/LocationTabView.hpp index 124f67671..3d380a17b 100644 --- a/src/openstudio_lib/LocationTabView.hpp +++ b/src/openstudio_lib/LocationTabView.hpp @@ -125,19 +125,7 @@ class LocationView : public QWidget void onWeatherFileBtnClicked(); - std::tuple, std::vector, std::vector, std::vector, std::vector, std::vector, std::vector, std::vector, std::vector, std::vector, std::vector> sortDesignDays(const model::Model& ddyModel); - - std::vector showDesignDaySelectionDialog(const std::vector>& summerDays99, - const std::vector>& summerDays99_6, - const std::vector>& summerDays2, - const std::vector>& summerDays1, - const std::vector>& summerDays0_4, - const std::vector>& winterDays99, - const std::vector>& winterDays99_6, - const std::vector>& winterDays2, - const std::vector>& winterDays1, - const std::vector>& winterDays0_4, - const std::vector>& allNonAnnual); + std::vector showDesignDaySelectionDialog(const std::vector>& allNonAnnual); void onDesignDayBtnClicked(); From 96cc1dcb27406ff508cbb38b9f7bea3779bcdde5 Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Mon, 17 Feb 2025 17:50:42 -0600 Subject: [PATCH 12/44] Checkpoint make the interface more like what Dan Macumber suggested --- src/openstudio_lib/LocationTabView.cpp | 64 +++++++++++++++++++++++++- src/openstudio_lib/LocationTabView.hpp | 3 +- 2 files changed, 65 insertions(+), 2 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index 657813371..c938802e9 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -66,6 +66,9 @@ #include #include #include +#include +#include +#include static constexpr auto NAME("Name: "); static constexpr auto LATITUDE("Latitude: "); @@ -653,6 +656,65 @@ std::vector filterDesignDays(const std::vector LocationView::showDesignDaySelectionDialogTwo(const std::vector& allDesignDays) { + std::vector designDaysToInsert; + + QDialog dialog(this); + dialog.setWindowTitle(QCoreApplication::translate("LocationView", "Import Design Days")); + + QGridLayout *layout = new QGridLayout(&dialog); + + QLabel *title = new QLabel("Import Design Days"); + layout->addWidget(title, 0, 0, 1, 5); + + // Define row labels and percentages + QStringList rowLabels = {"Heating", "Cooling"}; + std::vector percentages = {"99.6%", "99%", "2%", "1%", "0.4%"}; + + // Add percentage labels + for (int col = 0; col < percentages.size(); ++col) { + QLabel *percentageLabel = new QLabel(QString::fromStdString(percentages[col])); + layout->addWidget(percentageLabel, 1, col + 1); + } + + // Populate table for Heating and Cooling + for (int row = 0; row < rowLabels.size(); ++row) { + QLabel *rowLabel = new QLabel(rowLabels[row]); + layout->addWidget(rowLabel, row + 2, 0); + + for (int col = 0; col < percentages.size(); ++col) { + QCheckBox *checkBox = new QCheckBox(); + layout->addWidget(checkBox, row + 2, col + 1); + + connect(checkBox, &QCheckBox::toggled, [=, &designDaysToInsert](bool checked) { + if (checked) { + std::string dayType = (row == 0) ? "WinterDesignDay" : "SummerDesignDay"; + std::vector filteredDays = filterDesignDays(allDesignDays, dayType, percentages[col]); + designDaysToInsert.insert(designDaysToInsert.end(), filteredDays.begin(), filteredDays.end()); + } + }); + } + } + + // Ok and Cancel buttons + QPushButton *okButton = new QPushButton(tr("Ok"), &dialog); + QPushButton *cancelButton = new QPushButton(tr("Cancel"), &dialog); + layout->addWidget(okButton, rowLabels.size() + 2, 1); + layout->addWidget(cancelButton, rowLabels.size() + 2, 2); + + connect(okButton, &QPushButton::clicked, &dialog, &QDialog::accept); + connect(cancelButton, &QPushButton::clicked, &dialog, &QDialog::reject); + + dialog.setLayout(layout); + + // Execute the dialog and wait for user interaction + if (dialog.exec() == QDialog::Accepted) { + return designDaysToInsert; + } else { + return {}; + } +} + std::vector LocationView::showDesignDaySelectionDialog( const std::vector& allDesignDays) { @@ -868,7 +930,7 @@ void LocationView::onDesignDayBtnClicked() { //m_model.insertObjects(ddyModel.objects()); - std::vector designDaysToInsert = showDesignDaySelectionDialog(ddyModel.getModelObjects()); + std::vector designDaysToInsert = showDesignDaySelectionDialogTwo(ddyModel.getModelObjects()); // Remove design days from ddyModel that are not in designDaysToInsert for (auto& designDay : ddyModel.getConcreteModelObjects()) { diff --git a/src/openstudio_lib/LocationTabView.hpp b/src/openstudio_lib/LocationTabView.hpp index 3d380a17b..d9e9b2d7e 100644 --- a/src/openstudio_lib/LocationTabView.hpp +++ b/src/openstudio_lib/LocationTabView.hpp @@ -124,7 +124,8 @@ class LocationView : public QWidget void onWeatherFileBtnClicked(); - + std::vector showDesignDaySelectionDialogTwo(const std::vector>& allNonAnnual); + std::vector showDesignDaySelectionDialog(const std::vector>& allNonAnnual); From ee1910685d2fa7acd6d242a18f1bab2828d413b9 Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Mon, 17 Feb 2025 18:00:05 -0600 Subject: [PATCH 13/44] Even better --- src/openstudio_lib/LocationTabView.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index c938802e9..4dc50b96b 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -669,22 +669,22 @@ std::vector LocationView::showDesignDaySelectionDialogTwo(cons // Define row labels and percentages QStringList rowLabels = {"Heating", "Cooling"}; - std::vector percentages = {"99.6%", "99%", "2%", "1%", "0.4%"}; - - // Add percentage labels - for (int col = 0; col < percentages.size(); ++col) { - QLabel *percentageLabel = new QLabel(QString::fromStdString(percentages[col])); - layout->addWidget(percentageLabel, 1, col + 1); - } + std::vector heatingPercentages = {"99.6%", "99%"}; + std::vector coolingPercentages = {"2%", "1%", "0.4%"}; // Populate table for Heating and Cooling for (int row = 0; row < rowLabels.size(); ++row) { QLabel *rowLabel = new QLabel(rowLabels[row]); layout->addWidget(rowLabel, row + 2, 0); + const auto& percentages = (row == 0) ? heatingPercentages : coolingPercentages; + for (int col = 0; col < percentages.size(); ++col) { + QLabel *percentageLabel = new QLabel(QString::fromStdString(percentages[col])); + layout->addWidget(percentageLabel, 1, col + 1 + (row == 1 ? heatingPercentages.size() : 0)); + QCheckBox *checkBox = new QCheckBox(); - layout->addWidget(checkBox, row + 2, col + 1); + layout->addWidget(checkBox, row + 2, col + 1 + (row == 1 ? heatingPercentages.size() : 0)); connect(checkBox, &QCheckBox::toggled, [=, &designDaysToInsert](bool checked) { if (checked) { From ffdf175499ada77085570f79fe346839ee3fdf84 Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Mon, 17 Feb 2025 18:22:32 -0600 Subject: [PATCH 14/44] Looking better but layout still sucks --- src/openstudio_lib/LocationTabView.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index 4dc50b96b..39e7cf59d 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -660,11 +660,11 @@ std::vector LocationView::showDesignDaySelectionDialogTwo(cons std::vector designDaysToInsert; QDialog dialog(this); - dialog.setWindowTitle(QCoreApplication::translate("LocationView", "Import Design Days")); + dialog.setWindowTitle(QCoreApplication::translate("LocationView", "Import Design Days")); QGridLayout *layout = new QGridLayout(&dialog); - QLabel *title = new QLabel("Import Design Days"); + QLabel *title = new QLabel("Import Design Days"); layout->addWidget(title, 0, 0, 1, 5); // Define row labels and percentages @@ -696,15 +696,28 @@ std::vector LocationView::showDesignDaySelectionDialogTwo(cons } } + // Add a spacer item to add more space between the checkboxes and the buttons + QSpacerItem *spacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); + layout->addItem(spacer, rowLabels.size() + 2, 0, 1, 5); + // Ok and Cancel buttons QPushButton *okButton = new QPushButton(tr("Ok"), &dialog); QPushButton *cancelButton = new QPushButton(tr("Cancel"), &dialog); - layout->addWidget(okButton, rowLabels.size() + 2, 1); - layout->addWidget(cancelButton, rowLabels.size() + 2, 2); + layout->addWidget(okButton, rowLabels.size() + 3, 1); + layout->addWidget(cancelButton, rowLabels.size() + 3, 2); connect(okButton, &QPushButton::clicked, &dialog, &QDialog::accept); connect(cancelButton, &QPushButton::clicked, &dialog, &QDialog::reject); + // Skip selection and import all DDYs button + QPushButton *importAllButton = new QPushButton(tr("Skip selection and import all DDYs"), &dialog); + layout->addWidget(importAllButton, rowLabels.size() + 3, 3); + + connect(importAllButton, &QPushButton::clicked, [&dialog, &designDaysToInsert, &allDesignDays]() { + designDaysToInsert = allDesignDays; + dialog.accept(); + }); + dialog.setLayout(layout); // Execute the dialog and wait for user interaction From 17cab5acb807ac148597e8a51194456936250873 Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Mon, 17 Feb 2025 18:39:02 -0600 Subject: [PATCH 15/44] Checkpoint basic functionality is there --- src/openstudio_lib/LocationTabView.cpp | 200 ++++--------------------- src/openstudio_lib/LocationTabView.hpp | 3 - 2 files changed, 28 insertions(+), 175 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index 39e7cf59d..14218f9de 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -656,8 +656,35 @@ std::vector filterDesignDays(const std::vector LocationView::showDesignDaySelectionDialogTwo(const std::vector& allDesignDays) { +std::vector LocationView::showDesignDaySelectionDialog(const std::vector& allDesignDays) { std::vector designDaysToInsert; + // Lambda to add temperatures to the dialog of the design days + // auto addTemperatureLabel = [&](QCheckBox* checkBox, const std::vector& designDays, const bool isSummer) { + // // Clear existing labels associated with the checkbox + // for (int i = layout->count() - 1; i >= 0; --i) { + // QWidget* widget = layout->itemAt(i)->widget(); + // if (widget && widget->objectName() == checkBox->text()) { + // delete widget; + // } + // } + + // if (checkBox && checkBox->isChecked()) { + // for (model::DesignDay designDay : designDays) { + // QString dryBulbTemp = QString::number(designDay.maximumDryBulbTemperature()); + // QString wetBulbTemp = designDay.wetBulbOrDewPointAtMaximumDryBulb() ? QString::number(designDay.wetBulbOrDewPointAtMaximumDryBulb().get()) : "N/A"; + // QString humidityConditionType = QString::fromStdString(designDay.humidityConditionType()); + // QLabel* tempLabel; + // if (isSummer) { + // tempLabel = new QLabel(tr("Dry Bulb: %1, Wet Bulb: %2, Humidity Condition Type: %3").arg(dryBulbTemp).arg(wetBulbTemp).arg(humidityConditionType), &dialog); + // } else { + // tempLabel = new QLabel(tr("Dry Bulb: %1").arg(dryBulbTemp), &dialog); + // } + // tempLabel->setObjectName(checkBox->text()); + // layout->insertWidget(layout->indexOf(checkBox) + 1, tempLabel); + // } + // } + // dialog.adjustSize(); + // }; QDialog dialog(this); dialog.setWindowTitle(QCoreApplication::translate("LocationView", "Import Design Days")); @@ -728,177 +755,6 @@ std::vector LocationView::showDesignDaySelectionDialogTwo(cons } } -std::vector LocationView::showDesignDaySelectionDialog( - const std::vector& allDesignDays) { - - QDialog dialog(this); - dialog.setWindowTitle(tr("Select Design Days")); - - QVBoxLayout* layout = new QVBoxLayout(&dialog); - - QLabel* summerLabel = new QLabel(tr("Annual Summer Design Days"), &dialog); - summerLabel->setObjectName("H2"); - layout->addWidget(summerLabel); - - auto addTemperatureLabel = [&](QCheckBox* checkBox, const std::vector& designDays, const bool isSummer) { - // Clear existing labels associated with the checkbox - for (int i = layout->count() - 1; i >= 0; --i) { - QWidget* widget = layout->itemAt(i)->widget(); - if (widget && widget->objectName() == checkBox->text()) { - delete widget; - } - } - - if (checkBox && checkBox->isChecked()) { - for (model::DesignDay designDay : designDays) { - QString dryBulbTemp = QString::number(designDay.maximumDryBulbTemperature()); - QString wetBulbTemp = designDay.wetBulbOrDewPointAtMaximumDryBulb() ? QString::number(designDay.wetBulbOrDewPointAtMaximumDryBulb().get()) : "N/A"; - QString humidityConditionType = QString::fromStdString(designDay.humidityConditionType()); - QLabel* tempLabel; - if (isSummer) { - tempLabel = new QLabel(tr("Dry Bulb: %1, Wet Bulb: %2, Humidity Condition Type: %3").arg(dryBulbTemp).arg(wetBulbTemp).arg(humidityConditionType), &dialog); - } else { - tempLabel = new QLabel(tr("Dry Bulb: %1").arg(dryBulbTemp), &dialog); - } - tempLabel->setObjectName(checkBox->text()); - layout->insertWidget(layout->indexOf(checkBox) + 1, tempLabel); - } - } - dialog.adjustSize(); - }; - - - std::vector summerDesignDays2 = filterDesignDays(allDesignDays, "SummerDesignDay", "2%", "Wetbulb"); - std::vector summerdays1 = filterDesignDays(allDesignDays, "SummerDesignDay", "1%", "Wetbulb"); - std::vector summerDays0_4 = filterDesignDays(allDesignDays, "SummerDesignDay", "0.4%", "Wetbulb"); - - - std::vector winterDays99 = filterDesignDays(allDesignDays, "WinterDesignDay", "99%"); - std::vector winterDays99_6 = filterDesignDays(allDesignDays, "WinterDesignDay", "1%"); - - bool import_all_design_days = false; - - QCheckBox* summerCheckBox2 = nullptr; - QCheckBox* summerCheckBox1 = nullptr; - QCheckBox* summerCheckBox0_4 = nullptr; - - QCheckBox* winterCheckBox99 = nullptr; - QCheckBox* winterCheckBox99_6 = nullptr; - - QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, &dialog); - buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); - layout->addWidget(buttonBox); - - auto updateOkButtonState = [&]() { - bool anyChecked = (summerCheckBox2 && summerCheckBox2->isChecked()) || - (summerCheckBox1 && summerCheckBox1->isChecked()) || - (summerCheckBox0_4 && summerCheckBox0_4->isChecked()) || - (winterCheckBox99 && winterCheckBox99->isChecked()) || - (winterCheckBox99_6 && winterCheckBox99_6->isChecked()); - buttonBox->button(QDialogButtonBox::Ok)->setEnabled(anyChecked); - }; - - if (!summerDesignDays2.empty()) { - summerCheckBox2 = new QCheckBox(tr("2% Design Days"), &dialog); - layout->addWidget(summerCheckBox2); - connect(summerCheckBox2, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox2, summerDesignDays2, true); updateOkButtonState(); }); - } - if (!summerdays1.empty()) { - summerCheckBox1 = new QCheckBox(tr("1% Design Days"), &dialog); - layout->addWidget(summerCheckBox1); - connect(summerCheckBox1, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox1, summerdays1, true); updateOkButtonState(); }); - } - if (!summerDays0_4.empty()) { - summerCheckBox0_4 = new QCheckBox(tr("0.4% Design Days"), &dialog); - layout->addWidget(summerCheckBox0_4); - connect(summerCheckBox0_4, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox0_4,summerDays0_4, true); updateOkButtonState(); }); - } - - QLabel* winterLabel = new QLabel(tr("Annual Winter Design Days"), &dialog); - winterLabel->setObjectName("H2"); - layout->addWidget(winterLabel); - - if (!winterDays99.empty()) { - winterCheckBox99 = new QCheckBox(tr("99% Design Days"), &dialog); - layout->addWidget(winterCheckBox99); - connect(winterCheckBox99, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(winterCheckBox99, winterDays99, false); updateOkButtonState(); }); - } - if (!winterDays99_6.empty()) { - winterCheckBox99_6 = new QCheckBox(tr("99.6% Design Days"), &dialog); - layout->addWidget(winterCheckBox99_6); - connect(winterCheckBox99_6, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(winterCheckBox99_6, winterDays99_6 , false); updateOkButtonState(); }); - } - - QPushButton* selectAllButton = new QPushButton(tr("Skip selection and import all design days from ddy"), &dialog); - layout->addWidget(selectAllButton); - - buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); - layout->addWidget(buttonBox); - - if (summerCheckBox2) { - connect(summerCheckBox2, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox2, summerDesignDays2, true); updateOkButtonState(); }); - } - if (summerCheckBox1) { - connect(summerCheckBox1, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox1, summerdays1, true); updateOkButtonState(); }); - } - if (summerCheckBox0_4) { - connect(summerCheckBox0_4, &QCheckBox::stateChanged, [=]() { addTemperatureLabel(summerCheckBox0_4, summerDays0_4, true); updateOkButtonState(); }); - } - - connect(selectAllButton, &QPushButton::clicked, [&]() -> void { - if (summerCheckBox2) summerCheckBox2->setChecked(true); - if (summerCheckBox1) summerCheckBox1->setChecked(true); - if (summerCheckBox0_4) summerCheckBox0_4->setChecked(true); - if (winterCheckBox99) winterCheckBox99->setChecked(true); - if (winterCheckBox99_6) winterCheckBox99_6->setChecked(true); - import_all_design_days = true; - updateOkButtonState(); - }); - - connect(buttonBox, &QDialogButtonBox::accepted, &dialog, &QDialog::accept); - connect(buttonBox, &QDialogButtonBox::rejected, &dialog, &QDialog::reject); - - std::vector designDaysToInsert; - - if (dialog.exec() == QDialog::Accepted) { - if (summerCheckBox2 && summerCheckBox2->isChecked()) { - for (model::DesignDay designDay : summerDesignDays2) { - designDaysToInsert.push_back(designDay); - } - } - if (summerCheckBox1 && summerCheckBox1->isChecked()) { - for (model::DesignDay designDay : summerdays1) { - designDaysToInsert.push_back(designDay); - } - } - if (summerCheckBox0_4 && summerCheckBox0_4->isChecked()) { - for (model::DesignDay designDay : summerDays0_4) { - designDaysToInsert.push_back(designDay); - } - } - - if (winterCheckBox99 && winterCheckBox99->isChecked()) { - for (model::DesignDay designDay : winterDays99) { - designDaysToInsert.push_back(designDay); - } - } - if (winterCheckBox99_6 && winterCheckBox99_6->isChecked()) { - for (model::DesignDay designDay : winterDays99_6) { - designDaysToInsert.push_back(designDay); - } - } - } - - if (import_all_design_days) - { - return allDesignDays; - } else - { - return designDaysToInsert; - } - -} - void LocationView::onDesignDayBtnClicked() { QString fileTypes("Files (*.ddy)"); std::vector designDaysToInsert; diff --git a/src/openstudio_lib/LocationTabView.hpp b/src/openstudio_lib/LocationTabView.hpp index d9e9b2d7e..1a093fd92 100644 --- a/src/openstudio_lib/LocationTabView.hpp +++ b/src/openstudio_lib/LocationTabView.hpp @@ -124,11 +124,8 @@ class LocationView : public QWidget void onWeatherFileBtnClicked(); - std::vector showDesignDaySelectionDialogTwo(const std::vector>& allNonAnnual); - std::vector showDesignDaySelectionDialog(const std::vector>& allNonAnnual); - void onDesignDayBtnClicked(); void onASHRAEClimateZoneChanged(const QString& climateZone); From 22a470e6863bf30258884ad1d561787ebb0d2219 Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Tue, 18 Feb 2025 22:08:27 -0600 Subject: [PATCH 16/44] Oopps --- src/openstudio_lib/LocationTabView.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index 14218f9de..801b95eef 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -799,7 +799,7 @@ void LocationView::onDesignDayBtnClicked() { //m_model.insertObjects(ddyModel.objects()); - std::vector designDaysToInsert = showDesignDaySelectionDialogTwo(ddyModel.getModelObjects()); + std::vector designDaysToInsert = showDesignDaySelectionDialog(ddyModel.getModelObjects()); // Remove design days from ddyModel that are not in designDaysToInsert for (auto& designDay : ddyModel.getConcreteModelObjects()) { From f8315f9c76e7a5394adb3e8f479290e70a2ac305 Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Thu, 20 Feb 2025 21:28:24 -0600 Subject: [PATCH 17/44] Checkpoint --- src/openstudio_lib/LocationTabView.cpp | 76 +++++++++++--------------- 1 file changed, 31 insertions(+), 45 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index 801b95eef..13f75135f 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -658,33 +658,6 @@ std::vector filterDesignDays(const std::vector LocationView::showDesignDaySelectionDialog(const std::vector& allDesignDays) { std::vector designDaysToInsert; - // Lambda to add temperatures to the dialog of the design days - // auto addTemperatureLabel = [&](QCheckBox* checkBox, const std::vector& designDays, const bool isSummer) { - // // Clear existing labels associated with the checkbox - // for (int i = layout->count() - 1; i >= 0; --i) { - // QWidget* widget = layout->itemAt(i)->widget(); - // if (widget && widget->objectName() == checkBox->text()) { - // delete widget; - // } - // } - - // if (checkBox && checkBox->isChecked()) { - // for (model::DesignDay designDay : designDays) { - // QString dryBulbTemp = QString::number(designDay.maximumDryBulbTemperature()); - // QString wetBulbTemp = designDay.wetBulbOrDewPointAtMaximumDryBulb() ? QString::number(designDay.wetBulbOrDewPointAtMaximumDryBulb().get()) : "N/A"; - // QString humidityConditionType = QString::fromStdString(designDay.humidityConditionType()); - // QLabel* tempLabel; - // if (isSummer) { - // tempLabel = new QLabel(tr("Dry Bulb: %1, Wet Bulb: %2, Humidity Condition Type: %3").arg(dryBulbTemp).arg(wetBulbTemp).arg(humidityConditionType), &dialog); - // } else { - // tempLabel = new QLabel(tr("Dry Bulb: %1").arg(dryBulbTemp), &dialog); - // } - // tempLabel->setObjectName(checkBox->text()); - // layout->insertWidget(layout->indexOf(checkBox) + 1, tempLabel); - // } - // } - // dialog.adjustSize(); - // }; QDialog dialog(this); dialog.setWindowTitle(QCoreApplication::translate("LocationView", "Import Design Days")); @@ -699,6 +672,26 @@ std::vector LocationView::showDesignDaySelectionDialog(const s std::vector heatingPercentages = {"99.6%", "99%"}; std::vector coolingPercentages = {"2%", "1%", "0.4%"}; + // Ok and Cancel buttons + QPushButton *okButton = new QPushButton(tr("Ok"), &dialog); + QPushButton *cancelButton = new QPushButton(tr("Cancel"), &dialog); + layout->addWidget(okButton, rowLabels.size() + 3, 1); + layout->addWidget(cancelButton, rowLabels.size() + 3, 2); + + okButton->setEnabled(false); // Initially disable the Ok button + + connect(okButton, &QPushButton::clicked, &dialog, &QDialog::accept); + connect(cancelButton, &QPushButton::clicked, &dialog, &QDialog::reject); + + // Skip selection and import all DDYs button + QPushButton *importAllButton = new QPushButton(tr("Skip selection and import all DDYs"), &dialog); + layout->addWidget(importAllButton, rowLabels.size() + 3, 3); + + connect(importAllButton, &QPushButton::clicked, [&dialog, &designDaysToInsert, &allDesignDays]() { + designDaysToInsert = allDesignDays; + dialog.accept(); + }); + // Populate table for Heating and Cooling for (int row = 0; row < rowLabels.size(); ++row) { QLabel *rowLabel = new QLabel(rowLabels[row]); @@ -718,7 +711,18 @@ std::vector LocationView::showDesignDaySelectionDialog(const s std::string dayType = (row == 0) ? "WinterDesignDay" : "SummerDesignDay"; std::vector filteredDays = filterDesignDays(allDesignDays, dayType, percentages[col]); designDaysToInsert.insert(designDaysToInsert.end(), filteredDays.begin(), filteredDays.end()); + } else { + // Remove unchecked design days + std::string dayType = (row == 0) ? "WinterDesignDay" : "SummerDesignDay"; + std::vector filteredDays = filterDesignDays(allDesignDays, dayType, percentages[col]); + for (const auto& day : filteredDays) { + auto it = std::find(designDaysToInsert.begin(), designDaysToInsert.end(), day); + if (it != designDaysToInsert.end()) { + designDaysToInsert.erase(it); + } + } } + okButton->setEnabled(!designDaysToInsert.empty()); }); } } @@ -727,24 +731,6 @@ std::vector LocationView::showDesignDaySelectionDialog(const s QSpacerItem *spacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); layout->addItem(spacer, rowLabels.size() + 2, 0, 1, 5); - // Ok and Cancel buttons - QPushButton *okButton = new QPushButton(tr("Ok"), &dialog); - QPushButton *cancelButton = new QPushButton(tr("Cancel"), &dialog); - layout->addWidget(okButton, rowLabels.size() + 3, 1); - layout->addWidget(cancelButton, rowLabels.size() + 3, 2); - - connect(okButton, &QPushButton::clicked, &dialog, &QDialog::accept); - connect(cancelButton, &QPushButton::clicked, &dialog, &QDialog::reject); - - // Skip selection and import all DDYs button - QPushButton *importAllButton = new QPushButton(tr("Skip selection and import all DDYs"), &dialog); - layout->addWidget(importAllButton, rowLabels.size() + 3, 3); - - connect(importAllButton, &QPushButton::clicked, [&dialog, &designDaysToInsert, &allDesignDays]() { - designDaysToInsert = allDesignDays; - dialog.accept(); - }); - dialog.setLayout(layout); // Execute the dialog and wait for user interaction From 0ae541438d54305dfd46842aff21e5355d2b2ebd Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Thu, 20 Feb 2025 22:13:56 -0600 Subject: [PATCH 18/44] Checkpoint --- src/openstudio_lib/LocationTabView.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index 13f75135f..6dace5cdf 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -664,8 +664,9 @@ std::vector LocationView::showDesignDaySelectionDialog(const s QGridLayout *layout = new QGridLayout(&dialog); - QLabel *title = new QLabel("Import Design Days"); - layout->addWidget(title, 0, 0, 1, 5); + // // QLabel *title = new QLabel("Import Design Days"); + //// title->setAlignment(Qt::AlignCenter); + //// layout->addWidget(title, 0, 0, 1, 5, Qt::AlignCenter); // Define row labels and percentages QStringList rowLabels = {"Heating", "Cooling"}; @@ -695,16 +696,16 @@ std::vector LocationView::showDesignDaySelectionDialog(const s // Populate table for Heating and Cooling for (int row = 0; row < rowLabels.size(); ++row) { QLabel *rowLabel = new QLabel(rowLabels[row]); - layout->addWidget(rowLabel, row + 2, 0); + layout->addWidget(rowLabel, row * 2 + 1, 0, Qt::AlignCenter); const auto& percentages = (row == 0) ? heatingPercentages : coolingPercentages; for (int col = 0; col < percentages.size(); ++col) { QLabel *percentageLabel = new QLabel(QString::fromStdString(percentages[col])); - layout->addWidget(percentageLabel, 1, col + 1 + (row == 1 ? heatingPercentages.size() : 0)); + layout->addWidget(percentageLabel, row * 2, col + 1, Qt::AlignCenter); QCheckBox *checkBox = new QCheckBox(); - layout->addWidget(checkBox, row + 2, col + 1 + (row == 1 ? heatingPercentages.size() : 0)); + layout->addWidget(checkBox, row * 2 + 1, col + 1, Qt::AlignCenter); connect(checkBox, &QCheckBox::toggled, [=, &designDaysToInsert](bool checked) { if (checked) { @@ -729,7 +730,7 @@ std::vector LocationView::showDesignDaySelectionDialog(const s // Add a spacer item to add more space between the checkboxes and the buttons QSpacerItem *spacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); - layout->addItem(spacer, rowLabels.size() + 2, 0, 1, 5); + layout->addItem(spacer, rowLabels.size() * 2 + 2, 0, 1, 5); dialog.setLayout(layout); From 1ec73092a7f6cc2f44bef869c784bfa035d54bb3 Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Thu, 20 Feb 2025 22:49:53 -0600 Subject: [PATCH 19/44] Checkpoint --- src/openstudio_lib/LocationTabView.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index 6dace5cdf..cf848c0e9 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -649,8 +649,9 @@ std::vector filterDesignDays(const std::vector LocationView::showDesignDaySelectionDialog(const s // Ok and Cancel buttons QPushButton *okButton = new QPushButton(tr("Ok"), &dialog); QPushButton *cancelButton = new QPushButton(tr("Cancel"), &dialog); - layout->addWidget(okButton, rowLabels.size() + 3, 1); - layout->addWidget(cancelButton, rowLabels.size() + 3, 2); + QPushButton *importAllButton = new QPushButton(tr("Skip selection\nimport all DDYs"), &dialog); + + // Set the same size for all buttons + okButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); + cancelButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); + importAllButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); + + // Adjust the order of the buttons + layout->addWidget(importAllButton, rowLabels.size() * 2 + 3, 1); + layout->addWidget(okButton, rowLabels.size() * 2 + 3, 2); + layout->addWidget(cancelButton, rowLabels.size() * 2 + 3, 3); okButton->setEnabled(false); // Initially disable the Ok button connect(okButton, &QPushButton::clicked, &dialog, &QDialog::accept); connect(cancelButton, &QPushButton::clicked, &dialog, &QDialog::reject); - - // Skip selection and import all DDYs button - QPushButton *importAllButton = new QPushButton(tr("Skip selection and import all DDYs"), &dialog); - layout->addWidget(importAllButton, rowLabels.size() + 3, 3); - connect(importAllButton, &QPushButton::clicked, [&dialog, &designDaysToInsert, &allDesignDays]() { designDaysToInsert = allDesignDays; dialog.accept(); From 869173ff8cd498db20e0ef6dd32705d23c2c71ba Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Thu, 20 Feb 2025 23:03:03 -0600 Subject: [PATCH 20/44] Checkpoint --- src/openstudio_lib/LocationTabView.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index cf848c0e9..de7620917 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -665,10 +665,6 @@ std::vector LocationView::showDesignDaySelectionDialog(const s QGridLayout *layout = new QGridLayout(&dialog); - // // QLabel *title = new QLabel("Import Design Days"); - //// title->setAlignment(Qt::AlignCenter); - //// layout->addWidget(title, 0, 0, 1, 5, Qt::AlignCenter); - // Define row labels and percentages QStringList rowLabels = {"Heating", "Cooling"}; std::vector heatingPercentages = {"99.6%", "99%"}; @@ -689,6 +685,9 @@ std::vector LocationView::showDesignDaySelectionDialog(const s layout->addWidget(okButton, rowLabels.size() * 2 + 3, 2); layout->addWidget(cancelButton, rowLabels.size() * 2 + 3, 3); + okButton->setMinimumSize(cancelButton->sizeHint()); + importAllButton->setMinimumSize(cancelButton->sizeHint()); + okButton->setEnabled(false); // Initially disable the Ok button connect(okButton, &QPushButton::clicked, &dialog, &QDialog::accept); From 142559adbfeb8cbcc6c4217ed954d9787eea5b22 Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Thu, 20 Feb 2025 23:34:02 -0600 Subject: [PATCH 21/44] Checkpoint looking good --- src/openstudio_lib/LocationTabView.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index de7620917..fc8ef8c74 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -673,7 +673,7 @@ std::vector LocationView::showDesignDaySelectionDialog(const s // Ok and Cancel buttons QPushButton *okButton = new QPushButton(tr("Ok"), &dialog); QPushButton *cancelButton = new QPushButton(tr("Cancel"), &dialog); - QPushButton *importAllButton = new QPushButton(tr("Skip selection\nimport all DDYs"), &dialog); + QPushButton *importAllButton = new QPushButton(tr("Skip\nselection\nimport\nall DDYs"), &dialog); // Set the same size for all buttons okButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); @@ -737,6 +737,7 @@ std::vector LocationView::showDesignDaySelectionDialog(const s layout->addItem(spacer, rowLabels.size() * 2 + 2, 0, 1, 5); dialog.setLayout(layout); + dialog.setMinimumSize(dialog.sizeHint()); // Execute the dialog and wait for user interaction if (dialog.exec() == QDialog::Accepted) { From 4d0be7c5f7fe0d1ebad836f6c2701327f9f763f5 Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Thu, 27 Feb 2025 21:37:08 -0600 Subject: [PATCH 22/44] Just use boost::to_lower_copy --- src/openstudio_lib/LocationTabView.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index fc8ef8c74..e03c8876b 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -632,26 +632,20 @@ void LocationView::onWeatherFileBtnClicked() { } } -std::string toLowerCase(const std::string& str) { - std::string lowerStr = str; - std::transform(lowerStr.begin(), lowerStr.end(), lowerStr.begin(), [](unsigned char c) { return std::tolower(c); }); - return lowerStr; -} - std::vector filterDesignDays(const std::vector& designDays, const std::string& dayType, const std::string& percentage, const std::string& humidityConditionType = "") { std::vector filteredDesignDays; std::copy_if(designDays.begin(), designDays.end(), std::back_inserter(filteredDesignDays), [&](const model::DesignDay& designDay) { boost::optional name = designDay.name(); - if (!QString::fromStdString(toLowerCase(name.get())).contains("ann")) { + if (!QString::fromStdString(boost::to_lower_copy(name.get())).contains("ann")) { return false; } - bool matchesHumidityConditionType = humidityConditionType.empty() || toLowerCase(designDay.humidityConditionType()) == toLowerCase(humidityConditionType); + bool matchesHumidityConditionType = humidityConditionType.empty() || boost::to_lower_copy(designDay.humidityConditionType()) == boost::to_lower_copy(humidityConditionType); bool matchesPercentage = QString::fromStdString(name.get()).contains(QString::fromStdString(percentage)) || (percentage == "0.4%" && QString::fromStdString(name.get()).contains(".4%")); - return name && matchesPercentage && toLowerCase(designDay.dayType()) == toLowerCase(dayType) && matchesHumidityConditionType; + return name && matchesPercentage && boost::to_lower_copy(designDay.dayType()) == boost::to_lower_copy(dayType) && matchesHumidityConditionType; }); return filteredDesignDays; From 7b4a42caa69106eb6a8e04af1e80218342bc2aa3 Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Thu, 27 Feb 2025 22:48:31 -0600 Subject: [PATCH 23/44] use QString contains and use openstudio::isEqual --- src/openstudio_lib/LocationTabView.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index e03c8876b..6be10919d 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -636,16 +636,20 @@ std::vector filterDesignDays(const std::vector filteredDesignDays; std::copy_if(designDays.begin(), designDays.end(), std::back_inserter(filteredDesignDays), [&](const model::DesignDay& designDay) { - boost::optional name = designDay.name(); + QString nameString = QString::fromStdString(designDay.name().get()); - if (!QString::fromStdString(boost::to_lower_copy(name.get())).contains("ann")) { + if (!nameString.contains("ann",Qt::CaseInsensitive)) + { return false; } - bool matchesHumidityConditionType = humidityConditionType.empty() || boost::to_lower_copy(designDay.humidityConditionType()) == boost::to_lower_copy(humidityConditionType); - bool matchesPercentage = QString::fromStdString(name.get()).contains(QString::fromStdString(percentage)) || - (percentage == "0.4%" && QString::fromStdString(name.get()).contains(".4%")); - return name && matchesPercentage && boost::to_lower_copy(designDay.dayType()) == boost::to_lower_copy(dayType) && matchesHumidityConditionType; + bool matchesHumidityConditionType = humidityConditionType.empty() || openstudio::istringEqual(designDay.humidityConditionType(),humidityConditionType); + bool matchesPercentage = nameString.contains(QString::fromStdString(percentage)) || + (percentage == "0.4%" && nameString.contains(".4%")); + + bool matchesDesignDay = openstudio::istringEqual(designDay.dayType(), dayType); + + return matchesPercentage && matchesDesignDay && matchesHumidityConditionType; }); return filteredDesignDays; From 5c715e4b32caedd93d80cdc9eb72f29ec87d7267 Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Fri, 28 Feb 2025 22:11:01 -0600 Subject: [PATCH 24/44] Rever space for DesignDaysToInsert --- src/openstudio_lib/LocationTabView.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index 6be10919d..6c495875f 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -657,6 +657,7 @@ std::vector filterDesignDays(const std::vector LocationView::showDesignDaySelectionDialog(const std::vector& allDesignDays) { std::vector designDaysToInsert; + designDaysToInsert.reserve(allDesignDays.size()); // Reserve space for designDaysToInsert QDialog dialog(this); dialog.setWindowTitle(QCoreApplication::translate("LocationView", "Import Design Days")); From 7c6bde876dd23f1daf913f6199e2a0687f283d80 Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Fri, 28 Feb 2025 22:57:07 -0600 Subject: [PATCH 25/44] Avoid refiltering and delaying filtering until Ok button is clicked --- src/openstudio_lib/LocationTabView.cpp | 39 ++++++++++++++------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index 6c495875f..21e30b2dd 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -689,7 +689,21 @@ std::vector LocationView::showDesignDaySelectionDialog(const s okButton->setEnabled(false); // Initially disable the Ok button - connect(okButton, &QPushButton::clicked, &dialog, &QDialog::accept); + connect(okButton, &QPushButton::clicked, [&dialog, &designDaysToInsert, &allDesignDays, rowLabels, heatingPercentages, coolingPercentages]() { + for (int row = 0; row < rowLabels.size(); ++row) { + const auto& percentages = (row == 0) ? heatingPercentages : coolingPercentages; + for (int col = 0; col < percentages.size(); ++col) { + QCheckBox *checkBox = dialog.findChild(QString("checkBox_%1_%2").arg(row).arg(col)); + if (checkBox && checkBox->isChecked()) { + std::string dayType = (row == 0) ? "WinterDesignDay" : "SummerDesignDay"; + std::vector filteredDays = filterDesignDays(allDesignDays, dayType, percentages[col]); + designDaysToInsert.insert(designDaysToInsert.end(), filteredDays.begin(), filteredDays.end()); + } + } + } + dialog.accept(); + }); + connect(cancelButton, &QPushButton::clicked, &dialog, &QDialog::reject); connect(importAllButton, &QPushButton::clicked, [&dialog, &designDaysToInsert, &allDesignDays]() { designDaysToInsert = allDesignDays; @@ -708,25 +722,14 @@ std::vector LocationView::showDesignDaySelectionDialog(const s layout->addWidget(percentageLabel, row * 2, col + 1, Qt::AlignCenter); QCheckBox *checkBox = new QCheckBox(); + checkBox->setObjectName(QString("checkBox_%1_%2").arg(row).arg(col)); layout->addWidget(checkBox, row * 2 + 1, col + 1, Qt::AlignCenter); - connect(checkBox, &QCheckBox::toggled, [=, &designDaysToInsert](bool checked) { - if (checked) { - std::string dayType = (row == 0) ? "WinterDesignDay" : "SummerDesignDay"; - std::vector filteredDays = filterDesignDays(allDesignDays, dayType, percentages[col]); - designDaysToInsert.insert(designDaysToInsert.end(), filteredDays.begin(), filteredDays.end()); - } else { - // Remove unchecked design days - std::string dayType = (row == 0) ? "WinterDesignDay" : "SummerDesignDay"; - std::vector filteredDays = filterDesignDays(allDesignDays, dayType, percentages[col]); - for (const auto& day : filteredDays) { - auto it = std::find(designDaysToInsert.begin(), designDaysToInsert.end(), day); - if (it != designDaysToInsert.end()) { - designDaysToInsert.erase(it); - } - } - } - okButton->setEnabled(!designDaysToInsert.empty()); + connect(checkBox, &QCheckBox::toggled, [=, &dialog](bool checked) { + auto checkBoxes = dialog.findChildren(); + okButton->setEnabled(std::any_of(checkBoxes.begin(), checkBoxes.end(), [](QCheckBox* cb) { + return cb->isChecked(); + })); }); } } From 18d64bd0d93dd2b9990914430e645aca2aff538e Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Fri, 28 Feb 2025 23:47:12 -0600 Subject: [PATCH 26/44] Only add check box if the design days exist in ddy --- src/openstudio_lib/LocationTabView.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index 21e30b2dd..46b3d17e1 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -721,6 +721,13 @@ std::vector LocationView::showDesignDaySelectionDialog(const s QLabel *percentageLabel = new QLabel(QString::fromStdString(percentages[col])); layout->addWidget(percentageLabel, row * 2, col + 1, Qt::AlignCenter); + std::string dayType = (row == 0) ? "WinterDesignDay" : "SummerDesignDay"; + + if (filterDesignDays(allDesignDays, dayType, percentages[col]).empty()) + { + continue; + } + QCheckBox *checkBox = new QCheckBox(); checkBox->setObjectName(QString("checkBox_%1_%2").arg(row).arg(col)); layout->addWidget(checkBox, row * 2 + 1, col + 1, Qt::AlignCenter); @@ -731,6 +738,7 @@ std::vector LocationView::showDesignDaySelectionDialog(const s return cb->isChecked(); })); }); + } } From 956f285852bba8e12ece91d1591aeac287ffe98e Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Sat, 1 Mar 2025 00:08:28 -0600 Subject: [PATCH 27/44] clag format --- src/openstudio_lib/LocationTabView.cpp | 51 ++++++++++++-------------- src/openstudio_lib/LocationTabView.hpp | 3 +- 2 files changed, 25 insertions(+), 29 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index 46b3d17e1..8ed84e146 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -632,20 +632,20 @@ void LocationView::onWeatherFileBtnClicked() { } } -std::vector filterDesignDays(const std::vector& designDays, const std::string& dayType, const std::string& percentage, const std::string& humidityConditionType = "") { +std::vector filterDesignDays(const std::vector& designDays, const std::string& dayType, + const std::string& percentage, const std::string& humidityConditionType = "") { std::vector filteredDesignDays; std::copy_if(designDays.begin(), designDays.end(), std::back_inserter(filteredDesignDays), [&](const model::DesignDay& designDay) { - QString nameString = QString::fromStdString(designDay.name().get()); + QString nameString = QString::fromStdString(designDay.name().get()); - if (!nameString.contains("ann",Qt::CaseInsensitive)) - { + if (!nameString.contains("ann", Qt::CaseInsensitive)) { return false; } - bool matchesHumidityConditionType = humidityConditionType.empty() || openstudio::istringEqual(designDay.humidityConditionType(),humidityConditionType); - bool matchesPercentage = nameString.contains(QString::fromStdString(percentage)) || - (percentage == "0.4%" && nameString.contains(".4%")); + bool matchesHumidityConditionType = + humidityConditionType.empty() || openstudio::istringEqual(designDay.humidityConditionType(), humidityConditionType); + bool matchesPercentage = nameString.contains(QString::fromStdString(percentage)) || (percentage == "0.4%" && nameString.contains(".4%")); bool matchesDesignDay = openstudio::istringEqual(designDay.dayType(), dayType); @@ -657,12 +657,12 @@ std::vector filterDesignDays(const std::vector LocationView::showDesignDaySelectionDialog(const std::vector& allDesignDays) { std::vector designDaysToInsert; - designDaysToInsert.reserve(allDesignDays.size()); // Reserve space for designDaysToInsert + designDaysToInsert.reserve(allDesignDays.size()); // Reserve space for designDaysToInsert QDialog dialog(this); dialog.setWindowTitle(QCoreApplication::translate("LocationView", "Import Design Days")); - QGridLayout *layout = new QGridLayout(&dialog); + QGridLayout* layout = new QGridLayout(&dialog); // Define row labels and percentages QStringList rowLabels = {"Heating", "Cooling"}; @@ -670,9 +670,9 @@ std::vector LocationView::showDesignDaySelectionDialog(const s std::vector coolingPercentages = {"2%", "1%", "0.4%"}; // Ok and Cancel buttons - QPushButton *okButton = new QPushButton(tr("Ok"), &dialog); - QPushButton *cancelButton = new QPushButton(tr("Cancel"), &dialog); - QPushButton *importAllButton = new QPushButton(tr("Skip\nselection\nimport\nall DDYs"), &dialog); + QPushButton* okButton = new QPushButton(tr("Ok"), &dialog); + QPushButton* cancelButton = new QPushButton(tr("Cancel"), &dialog); + QPushButton* importAllButton = new QPushButton(tr("Skip\nselection\nimport\nall DDYs"), &dialog); // Set the same size for all buttons okButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); @@ -687,13 +687,13 @@ std::vector LocationView::showDesignDaySelectionDialog(const s okButton->setMinimumSize(cancelButton->sizeHint()); importAllButton->setMinimumSize(cancelButton->sizeHint()); - okButton->setEnabled(false); // Initially disable the Ok button + okButton->setEnabled(false); // Initially disable the Ok button connect(okButton, &QPushButton::clicked, [&dialog, &designDaysToInsert, &allDesignDays, rowLabels, heatingPercentages, coolingPercentages]() { for (int row = 0; row < rowLabels.size(); ++row) { const auto& percentages = (row == 0) ? heatingPercentages : coolingPercentages; for (int col = 0; col < percentages.size(); ++col) { - QCheckBox *checkBox = dialog.findChild(QString("checkBox_%1_%2").arg(row).arg(col)); + QCheckBox* checkBox = dialog.findChild(QString("checkBox_%1_%2").arg(row).arg(col)); if (checkBox && checkBox->isChecked()) { std::string dayType = (row == 0) ? "WinterDesignDay" : "SummerDesignDay"; std::vector filteredDays = filterDesignDays(allDesignDays, dayType, percentages[col]); @@ -712,38 +712,34 @@ std::vector LocationView::showDesignDaySelectionDialog(const s // Populate table for Heating and Cooling for (int row = 0; row < rowLabels.size(); ++row) { - QLabel *rowLabel = new QLabel(rowLabels[row]); + QLabel* rowLabel = new QLabel(rowLabels[row]); layout->addWidget(rowLabel, row * 2 + 1, 0, Qt::AlignCenter); const auto& percentages = (row == 0) ? heatingPercentages : coolingPercentages; for (int col = 0; col < percentages.size(); ++col) { - QLabel *percentageLabel = new QLabel(QString::fromStdString(percentages[col])); + QLabel* percentageLabel = new QLabel(QString::fromStdString(percentages[col])); layout->addWidget(percentageLabel, row * 2, col + 1, Qt::AlignCenter); std::string dayType = (row == 0) ? "WinterDesignDay" : "SummerDesignDay"; - if (filterDesignDays(allDesignDays, dayType, percentages[col]).empty()) - { + if (filterDesignDays(allDesignDays, dayType, percentages[col]).empty()) { continue; } - QCheckBox *checkBox = new QCheckBox(); + QCheckBox* checkBox = new QCheckBox(); checkBox->setObjectName(QString("checkBox_%1_%2").arg(row).arg(col)); layout->addWidget(checkBox, row * 2 + 1, col + 1, Qt::AlignCenter); connect(checkBox, &QCheckBox::toggled, [=, &dialog](bool checked) { auto checkBoxes = dialog.findChildren(); - okButton->setEnabled(std::any_of(checkBoxes.begin(), checkBoxes.end(), [](QCheckBox* cb) { - return cb->isChecked(); - })); + okButton->setEnabled(std::any_of(checkBoxes.begin(), checkBoxes.end(), [](QCheckBox* cb) { return cb->isChecked(); })); }); - } } // Add a spacer item to add more space between the checkboxes and the buttons - QSpacerItem *spacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); + QSpacerItem* spacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); layout->addItem(spacer, rowLabels.size() * 2 + 2, 0, 1, 5); dialog.setLayout(layout); @@ -777,12 +773,12 @@ void LocationView::onDesignDayBtnClicked() { if (ddyIdfFile) { openstudio::Workspace ddyWorkspace(StrictnessLevel::None, IddFileType::EnergyPlus); - + for (const IdfObject& idfObject : ddyIdfFile->objects()) { IddObjectType iddObjectType = idfObject.iddObject().type(); - if ((iddObjectType == IddObjectType::SizingPeriod_DesignDay) || (iddObjectType == IddObjectType::SizingPeriod_WeatherFileDays) + if ((iddObjectType == IddObjectType::SizingPeriod_DesignDay) || (iddObjectType == IddObjectType::SizingPeriod_WeatherFileDays) || (iddObjectType == IddObjectType::SizingPeriod_WeatherFileConditionType)) { - ddyWorkspace.addObject(idfObject); + ddyWorkspace.addObject(idfObject); } } @@ -792,7 +788,6 @@ void LocationView::onDesignDayBtnClicked() { // Use a heuristic based on the ddy files provided by EnergyPlus // Filter out the days that are not helpful. if (!ddyModel.objects().empty()) { - // Evan note: do not remove existing design days //for (model::SizingPeriod sizingPeriod : m_model.getModelObjects()){ diff --git a/src/openstudio_lib/LocationTabView.hpp b/src/openstudio_lib/LocationTabView.hpp index 1a093fd92..67d0373b5 100644 --- a/src/openstudio_lib/LocationTabView.hpp +++ b/src/openstudio_lib/LocationTabView.hpp @@ -124,7 +124,8 @@ class LocationView : public QWidget void onWeatherFileBtnClicked(); - std::vector showDesignDaySelectionDialog(const std::vector>& allNonAnnual); + std::vector + showDesignDaySelectionDialog(const std::vector>& allNonAnnual); void onDesignDayBtnClicked(); From 8f2eaedf41ddfcb4f70605c564fac95e9033c5c6 Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Sat, 1 Mar 2025 00:12:55 -0600 Subject: [PATCH 28/44] this is not needed --- src/openstudio_lib/LocationTabView.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index 8ed84e146..60890096a 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -755,7 +755,6 @@ std::vector LocationView::showDesignDaySelectionDialog(const s void LocationView::onDesignDayBtnClicked() { QString fileTypes("Files (*.ddy)"); - std::vector designDaysToInsert; QString lastPath = m_lastDdyPathOpened; if (lastPath.isEmpty() && m_lastEpwPathOpened.isEmpty()) { From fe8f4964b642128d6597b891c66428f84c2c5ded Mon Sep 17 00:00:00 2001 From: antonszilasi Date: Sat, 1 Mar 2025 14:35:06 -0600 Subject: [PATCH 29/44] Adding some documentation --- src/openstudio_lib/LocationTabView.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index 60890096a..e2108ee71 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -655,6 +655,21 @@ std::vector filterDesignDays(const std::vector LocationView::showDesignDaySelectionDialog(const std::vector& allDesignDays) { std::vector designDaysToInsert; designDaysToInsert.reserve(allDesignDays.size()); // Reserve space for designDaysToInsert @@ -664,7 +679,7 @@ std::vector LocationView::showDesignDaySelectionDialog(const s QGridLayout* layout = new QGridLayout(&dialog); - // Define row labels and percentages + // Define row labels and percentages to present to the user from the DDY QStringList rowLabels = {"Heating", "Cooling"}; std::vector heatingPercentages = {"99.6%", "99%"}; std::vector coolingPercentages = {"2%", "1%", "0.4%"}; @@ -687,7 +702,7 @@ std::vector LocationView::showDesignDaySelectionDialog(const s okButton->setMinimumSize(cancelButton->sizeHint()); importAllButton->setMinimumSize(cancelButton->sizeHint()); - okButton->setEnabled(false); // Initially disable the Ok button + okButton->setEnabled(false); // Initially disable the Ok button until something is checked connect(okButton, &QPushButton::clicked, [&dialog, &designDaysToInsert, &allDesignDays, rowLabels, heatingPercentages, coolingPercentages]() { for (int row = 0; row < rowLabels.size(); ++row) { @@ -722,7 +737,7 @@ std::vector LocationView::showDesignDaySelectionDialog(const s layout->addWidget(percentageLabel, row * 2, col + 1, Qt::AlignCenter); std::string dayType = (row == 0) ? "WinterDesignDay" : "SummerDesignDay"; - + // Only display the checkbox if there are design days to select in the ddy file if (filterDesignDays(allDesignDays, dayType, percentages[col]).empty()) { continue; } From 35d685bc53064b319a865425766fef508a76330f Mon Sep 17 00:00:00 2001 From: Anton Szilasi Date: Sat, 1 Mar 2025 14:38:58 -0600 Subject: [PATCH 30/44] Update LocationTabView.cpp --- src/openstudio_lib/LocationTabView.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index e2108ee71..300f8a00d 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -660,8 +660,8 @@ std::vector filterDesignDays(const std::vector Date: Sat, 1 Mar 2025 23:48:47 -0700 Subject: [PATCH 31/44] Refactor code to use a helper class to find the design day types and levels, add a gtest --- src/openstudio_lib/CMakeLists.txt | 1 + src/openstudio_lib/LocationTabView.cpp | 241 ++++++++++-------- src/openstudio_lib/LocationTabView.hpp | 26 ++ src/openstudio_lib/test/LocationTab_GTest.cpp | 53 ++++ translations/OpenStudioApp_ar.ts | 72 ++++-- translations/OpenStudioApp_ca.ts | 72 ++++-- translations/OpenStudioApp_de.ts | 72 ++++-- translations/OpenStudioApp_el.ts | 72 ++++-- translations/OpenStudioApp_es.ts | 72 ++++-- translations/OpenStudioApp_fa.ts | 72 ++++-- translations/OpenStudioApp_fr.ts | 72 ++++-- translations/OpenStudioApp_he.ts | 72 ++++-- translations/OpenStudioApp_hi.ts | 72 ++++-- translations/OpenStudioApp_it.ts | 72 ++++-- translations/OpenStudioApp_ja.ts | 72 ++++-- translations/OpenStudioApp_pl.ts | 72 ++++-- translations/OpenStudioApp_vi.ts | 72 ++++-- translations/OpenStudioApp_zh_CN.ts | 72 ++++-- 18 files changed, 905 insertions(+), 424 deletions(-) create mode 100644 src/openstudio_lib/test/LocationTab_GTest.cpp diff --git a/src/openstudio_lib/CMakeLists.txt b/src/openstudio_lib/CMakeLists.txt index e86ce3f40..917c074b2 100644 --- a/src/openstudio_lib/CMakeLists.txt +++ b/src/openstudio_lib/CMakeLists.txt @@ -792,6 +792,7 @@ set(${target_name}_test_src test/FacilityShading_GTest.cpp test/Geometry_GTest.cpp test/IconLibrary_GTest.cpp + test/LocationTab_GTest.cpp test/ObjectSelector_GTest.cpp test/OSDropZone_GTest.cpp test/OSLineEdit_GTest.cpp diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index 300f8a00d..282442cdf 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -50,6 +50,7 @@ #include #include +#include #include #include #include @@ -57,15 +58,15 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include -#include -#include #include #include #include @@ -81,6 +82,42 @@ static constexpr auto CHANGEWEATHERFILE("Change Weather File"); namespace openstudio { +SortableDesignDay::SortableDesignDay(const openstudio::model::DesignDay& designDay) : m_designDay(designDay) { + QRegExp regex("^.*Ann.*([\\d\\.]+)[\\s]?%.*$", Qt::CaseInsensitive); + if (regex.exactMatch(toQString(designDay.nameString())) && regex.captureCount() == 1) { + m_permil = qstringToPermil(regex.capturedTexts()[1]); + if (m_permil > 500) { + m_type = "Heating"; + } else { + m_type = "Cooling"; + } + } +} + +int SortableDesignDay::qstringToPermil(const QString& str) { + return (int)(str.toDouble() * 10.0); +} + +QString SortableDesignDay::permilToQString(int permil) { + return QString::number((double)permil / 10.0, 'f', 1); +} + +QString SortableDesignDay::key(const QString& type, int sortablePermil) { + return type + permilToQString(sortablePermil); +} + +QString SortableDesignDay::type() const { + return m_type; +} + +int SortableDesignDay::permil() const { + return m_permil; +} + +int SortableDesignDay::sortablePermil() const { + return ((m_permil < 500) ? m_permil : 1000 - m_permil); +} + LocationTabView::LocationTabView(const model::Model& model, const QString& modelTempDir, QWidget* parent) : MainTabView(tr("Site"), MainTabView::SUB_TAB, parent) {} @@ -632,29 +669,6 @@ void LocationView::onWeatherFileBtnClicked() { } } -std::vector filterDesignDays(const std::vector& designDays, const std::string& dayType, - const std::string& percentage, const std::string& humidityConditionType = "") { - std::vector filteredDesignDays; - - std::copy_if(designDays.begin(), designDays.end(), std::back_inserter(filteredDesignDays), [&](const model::DesignDay& designDay) { - QString nameString = QString::fromStdString(designDay.name().get()); - - if (!nameString.contains("ann", Qt::CaseInsensitive)) { - return false; - } - - bool matchesHumidityConditionType = - humidityConditionType.empty() || openstudio::istringEqual(designDay.humidityConditionType(), humidityConditionType); - bool matchesPercentage = nameString.contains(QString::fromStdString(percentage)) || (percentage == "0.4%" && nameString.contains(".4%")); - - bool matchesDesignDay = openstudio::istringEqual(designDay.dayType(), dayType); - - return matchesPercentage && matchesDesignDay && matchesHumidityConditionType; - }); - - return filteredDesignDays; -} - /** * @brief Displays a dialog for selecting design days from a given list. * @@ -671,101 +685,124 @@ std::vector filterDesignDays(const std::vector LocationView::showDesignDaySelectionDialog(const std::vector& allDesignDays) { - std::vector designDaysToInsert; - designDaysToInsert.reserve(allDesignDays.size()); // Reserve space for designDaysToInsert + std::vector result; + + // parse out the design day names into SortableDesignDays and figure out the column and row names + std::vector sortableDesignDays; + std::set designDayTypes; // rows + std::set sortedDesignDayPermils; // columns + + // key is designDayType + sortedDesignDayPermil, value is names of dds + // each cell in the table has a unique key + std::map> designDayMap; + for (const auto& dd : allDesignDays) { + SortableDesignDay sdd(dd); + + // skip Design Days with unknown type + if (sdd.type().isEmpty()) { + continue; + } + + sortableDesignDays.push_back(sdd); + designDayTypes.insert(sdd.type()); + sortedDesignDayPermils.insert(sdd.sortablePermil()); + QString key = SortableDesignDay::key(sdd.type(), sdd.sortablePermil()); + if (!designDayMap.contains(key)) { + designDayMap[key] = QVector(); + } + designDayMap[key].append(dd); + } + + // main dialog QDialog dialog(this); dialog.setWindowTitle(QCoreApplication::translate("LocationView", "Import Design Days")); + dialog.setModal(true); + QVBoxLayout* layout = new QVBoxLayout(&dialog); + + // grid view for the design day types and permils to import + QGridLayout* gridLayout = new QGridLayout(); + + // first row is for headers + int row = 0; + int column = 1; + for (const auto& sddp : sortedDesignDayPermils) { + QLabel* header = new QLabel(SortableDesignDay::permilToQString(sddp) + "%"); + gridLayout->addWidget(header, row, column++, Qt::AlignCenter); + } - QGridLayout* layout = new QGridLayout(&dialog); - - // Define row labels and percentages to present to the user from the DDY - QStringList rowLabels = {"Heating", "Cooling"}; - std::vector heatingPercentages = {"99.6%", "99%"}; - std::vector coolingPercentages = {"2%", "1%", "0.4%"}; + // one row for each design day type + row = 1; + QVector allRadioButtons; + for (const auto& ddt : designDayTypes) { + column = 0; + bool checkedFirst = false; + QLabel* label = new QLabel(ddt); + gridLayout->addWidget(label, row, column++, Qt::AlignCenter); + + QButtonGroup* buttonGroup = new QButtonGroup(gridLayout); + for (const auto& sddp : sortedDesignDayPermils) { + QString key = SortableDesignDay::key(ddt, sddp); + QRadioButton* radioButton = new QRadioButton(); + allRadioButtons.append(radioButton); + if (!designDayMap.contains(key)) { + radioButton->setCheckable(false); + radioButton->setToolTip(QString::number(0) + " " + tr("Design Days")); + } else { + radioButton->setCheckable(true); + if (!checkedFirst) { + radioButton->setChecked(true); + checkedFirst = true; + } + radioButton->setToolTip(QString::number(designDayMap[key].size()) + " " + tr("Design Days")); + radioButton->setProperty("designDays", QVariant::fromValue(designDayMap[key])); + } + buttonGroup->addButton(radioButton); + gridLayout->addWidget(radioButton, row, column++, Qt::AlignCenter); + } + ++row; + } + layout->addLayout(gridLayout); + int columnCount = gridLayout->columnCount(); + int rowCount = gridLayout->rowCount(); - // Ok and Cancel buttons + // ok button only imports the checked design days QPushButton* okButton = new QPushButton(tr("Ok"), &dialog); - QPushButton* cancelButton = new QPushButton(tr("Cancel"), &dialog); - QPushButton* importAllButton = new QPushButton(tr("Skip\nselection\nimport\nall DDYs"), &dialog); - - // Set the same size for all buttons - okButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); - cancelButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); - importAllButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); - - // Adjust the order of the buttons - layout->addWidget(importAllButton, rowLabels.size() * 2 + 3, 1); - layout->addWidget(okButton, rowLabels.size() * 2 + 3, 2); - layout->addWidget(cancelButton, rowLabels.size() * 2 + 3, 3); - - okButton->setMinimumSize(cancelButton->sizeHint()); - importAllButton->setMinimumSize(cancelButton->sizeHint()); - - okButton->setEnabled(false); // Initially disable the Ok button until something is checked - - connect(okButton, &QPushButton::clicked, [&dialog, &designDaysToInsert, &allDesignDays, rowLabels, heatingPercentages, coolingPercentages]() { - for (int row = 0; row < rowLabels.size(); ++row) { - const auto& percentages = (row == 0) ? heatingPercentages : coolingPercentages; - for (int col = 0; col < percentages.size(); ++col) { - QCheckBox* checkBox = dialog.findChild(QString("checkBox_%1_%2").arg(row).arg(col)); - if (checkBox && checkBox->isChecked()) { - std::string dayType = (row == 0) ? "WinterDesignDay" : "SummerDesignDay"; - std::vector filteredDays = filterDesignDays(allDesignDays, dayType, percentages[col]); - designDaysToInsert.insert(designDaysToInsert.end(), filteredDays.begin(), filteredDays.end()); + connect(okButton, &QPushButton::clicked, [&dialog, &result, &allRadioButtons]() { + for (const auto& rb : allRadioButtons) { + if (rb->isChecked()) { + QVariant variant = rb->property("designDays"); + if (variant.canConvert>()) { + for (const auto& dd : variant.value>()) { + result.push_back(dd); + } } } } dialog.accept(); }); + // cancel button imports nothing + QPushButton* cancelButton = new QPushButton(tr("Cancel"), &dialog); connect(cancelButton, &QPushButton::clicked, &dialog, &QDialog::reject); - connect(importAllButton, &QPushButton::clicked, [&dialog, &designDaysToInsert, &allDesignDays]() { - designDaysToInsert = allDesignDays; + + // import all imports everythig + QPushButton* importAllButton = new QPushButton(tr("Import all"), &dialog); + connect(importAllButton, &QPushButton::clicked, [&dialog, &result, &allDesignDays]() { + result = allDesignDays; dialog.accept(); }); - // Populate table for Heating and Cooling - for (int row = 0; row < rowLabels.size(); ++row) { - QLabel* rowLabel = new QLabel(rowLabels[row]); - layout->addWidget(rowLabel, row * 2 + 1, 0, Qt::AlignCenter); - - const auto& percentages = (row == 0) ? heatingPercentages : coolingPercentages; - - for (int col = 0; col < percentages.size(); ++col) { - QLabel* percentageLabel = new QLabel(QString::fromStdString(percentages[col])); - layout->addWidget(percentageLabel, row * 2, col + 1, Qt::AlignCenter); - - std::string dayType = (row == 0) ? "WinterDesignDay" : "SummerDesignDay"; - // Only display the checkbox if there are design days to select in the ddy file - if (filterDesignDays(allDesignDays, dayType, percentages[col]).empty()) { - continue; - } - - QCheckBox* checkBox = new QCheckBox(); - checkBox->setObjectName(QString("checkBox_%1_%2").arg(row).arg(col)); - layout->addWidget(checkBox, row * 2 + 1, col + 1, Qt::AlignCenter); - - connect(checkBox, &QCheckBox::toggled, [=, &dialog](bool checked) { - auto checkBoxes = dialog.findChildren(); - okButton->setEnabled(std::any_of(checkBoxes.begin(), checkBoxes.end(), [](QCheckBox* cb) { return cb->isChecked(); })); - }); - } - } - - // Add a spacer item to add more space between the checkboxes and the buttons - QSpacerItem* spacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); - layout->addItem(spacer, rowLabels.size() * 2 + 2, 0, 1, 5); - - dialog.setLayout(layout); - dialog.setMinimumSize(dialog.sizeHint()); + // add all the buttons in a button box + QDialogButtonBox* buttonBox = new QDialogButtonBox(Qt::Horizontal); + buttonBox->addButton(okButton, QDialogButtonBox::AcceptRole); + buttonBox->addButton(cancelButton, QDialogButtonBox::RejectRole); + buttonBox->addButton(importAllButton, QDialogButtonBox::YesRole); + layout->addWidget(buttonBox); // Execute the dialog and wait for user interaction - if (dialog.exec() == QDialog::Accepted) { - return designDaysToInsert; - } else { - return {}; - } + dialog.exec(); + return result; } void LocationView::onDesignDayBtnClicked() { diff --git a/src/openstudio_lib/LocationTabView.hpp b/src/openstudio_lib/LocationTabView.hpp index 67d0373b5..18911999a 100644 --- a/src/openstudio_lib/LocationTabView.hpp +++ b/src/openstudio_lib/LocationTabView.hpp @@ -31,6 +31,32 @@ class Site; class YearDescription; } // namespace model +/// +/// SortableDesignDay is a helper class for sorting DesignDays +/// +class SortableDesignDay +{ + public: + SortableDesignDay(const openstudio::model::DesignDay& designDay); + + static int qstringToPermil(const QString& str); + + static QString permilToQString(int permil); + + static QString key(const QString& type, int sortablePermil); + + QString type() const; + + int permil() const; + + int sortablePermil() const; + + private: + QString m_type; + int m_permil{0}; // per thousand, e.g. 0.4% -> 4, 99.6% -> 996 + openstudio::model::DesignDay m_designDay; +}; + class LocationView : public QWidget { diff --git a/src/openstudio_lib/test/LocationTab_GTest.cpp b/src/openstudio_lib/test/LocationTab_GTest.cpp new file mode 100644 index 000000000..7dafe578e --- /dev/null +++ b/src/openstudio_lib/test/LocationTab_GTest.cpp @@ -0,0 +1,53 @@ +/*********************************************************************************************************************** +* OpenStudio(R), Copyright (c) OpenStudio Coalition and other contributors. +* See also https://openstudiocoalition.org/about/software_license/ +***********************************************************************************************************************/ + +#include + +#include "OpenStudioLibFixture.hpp" + +#include "../LocationTabView.hpp" + +#include +#include +#include + +#include + +using namespace openstudio; + +TEST_F(OpenStudioLibFixture, SortableDesignDay) { + + model::Model model = model::exampleModel(); + auto designDays = model.getConcreteModelObjects(); + std::sort(designDays.begin(), designDays.end(), WorkspaceObjectNameLess()); + + ASSERT_EQ(2u, designDays.size()); + auto dd = designDays[0]; + + EXPECT_EQ("Sizing Period Design Day 1", dd.nameString()); + SortableDesignDay sdd(dd); + EXPECT_EQ("", sdd.type()); + EXPECT_EQ(0, sdd.permil()); + EXPECT_EQ(0, sdd.sortablePermil()); + + dd.setName("El Paso International Ap Ut Ann Clg .4% Condns DB = > MWB"); + sdd = SortableDesignDay(dd); + EXPECT_EQ("Cooling", sdd.type()); + EXPECT_EQ(4, sdd.permil()); + EXPECT_EQ(4, sdd.sortablePermil()); + + dd.setName("El Paso International Ap Ut Ann Clg .4 % Condns DB = > MWB"); + sdd = SortableDesignDay(dd); + EXPECT_EQ("Cooling", sdd.type()); + EXPECT_EQ(4, sdd.permil()); + EXPECT_EQ(4, sdd.sortablePermil()); + + dd.setName("Buffalo Niagara Intl Ap Ann Htg 99.6% Condns DB"); + sdd = SortableDesignDay(dd); + EXPECT_EQ("Heating", sdd.type()); + EXPECT_EQ(996, sdd.permil()); + EXPECT_EQ(4, sdd.sortablePermil()); + +} \ No newline at end of file diff --git a/translations/OpenStudioApp_ar.ts b/translations/OpenStudioApp_ar.ts index 4bbab43f8..b275fc2ac 100644 --- a/translations/OpenStudioApp_ar.ts +++ b/translations/OpenStudioApp_ar.ts @@ -54,6 +54,14 @@ + + LocationView + + + Import Design Days + + + ModelObjectSelectorDialog @@ -317,7 +325,7 @@ Zone openstudio::LocationTabView - + Site @@ -325,108 +333,126 @@ Zone openstudio::LocationView - + Weather File - + Name: - + Latitude: - + Longitude: - + Elevation: - + Time Zone: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> - + Measure Tags (Optional): - + ASHRAE Climate Zone - + CEC Climate Zone - + Design Days - + Import From DDY - + Change Weather File - - + + Set Weather File - + EPW Files (*.epw);; All Files (*.*) - + Open Weather File - + Failed To Set Weather File - + Failed To Set Weather File To - + + Ok + + + + + Cancel + + + + + Skip +selection +import +all DDYs + + + + Open DDY File - + No Design Days in DDY File - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. diff --git a/translations/OpenStudioApp_ca.ts b/translations/OpenStudioApp_ca.ts index e6f710738..a58995603 100644 --- a/translations/OpenStudioApp_ca.ts +++ b/translations/OpenStudioApp_ca.ts @@ -55,6 +55,14 @@ Afegir/Eliminat Grups Extensibles + + LocationView + + + Import Design Days + + + ModelObjectSelectorDialog @@ -321,7 +329,7 @@ Zona openstudio::LocationTabView - + Site Lloc @@ -329,108 +337,126 @@ Zona openstudio::LocationView - + Weather File Fitxer Climàtic - + Name: Nom: - + Latitude: Latitud: - + Longitude: Longitud: - + Elevation: Altitud: - + Time Zone: Zona Horària: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> Descarregar fitxers climàtics a <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> - + Measure Tags (Optional): Etiqueta per les Mesures (Opcional): - + ASHRAE Climate Zone Zona Climàtica d'ASHRAE - + CEC Climate Zone Zona Climàtica CEC - + Design Days Dies de Disseny - + Import From DDY Importar des de DDY - + Change Weather File Canviar el Fitxer Climàtic - - + + Set Weather File Definir el Fitxer Climàtic - + EPW Files (*.epw);; All Files (*.*) EPW Files (*.epw);; All Files (*.*) - + Open Weather File Obrir Fitxer Climàtic - + Failed To Set Weather File Error al Definir el Fitxer Climàtic - + Failed To Set Weather File To Error al Definir el Fitxer Climàtic a - + + Ok + + + + + Cancel + Cancel·lar + + + + Skip +selection +import +all DDYs + + + + Open DDY File Obrir Fitxer DDY - + No Design Days in DDY File No hi ha Dies de Disseny al fitxer DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Aquest fitxer DDY no conté cap dia de disseny vàlid. Comproveu el fitxer DDY. diff --git a/translations/OpenStudioApp_de.ts b/translations/OpenStudioApp_de.ts index 4a2bf5952..efb20696d 100644 --- a/translations/OpenStudioApp_de.ts +++ b/translations/OpenStudioApp_de.ts @@ -54,6 +54,14 @@ Hinzufügen/Entfernen von erweiterbaren Gruppen + + LocationView + + + Import Design Days + + + ModelObjectSelectorDialog @@ -326,7 +334,7 @@ Zone openstudio::LocationTabView - + Site Standort @@ -334,108 +342,126 @@ Zone openstudio::LocationView - + Weather File Wetterdatei - + Name: Name: - + Latitude: Breitengrad: - + Longitude: Längengrad: - + Elevation: Höhe über Meer: - + Time Zone: Zeitzone: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> Hier Wetterdaten herunterladen - + Measure Tags (Optional): Kennzeichnung (optional): - + ASHRAE Climate Zone ASHRAE Klimazone - + CEC Climate Zone CEC Klimazone - + Design Days Auslegungstage - + Import From DDY Von DDY importieren - + Change Weather File Wetterdatei ändern - - + + Set Weather File Ausgewählte Wetterdatei - + EPW Files (*.epw);; All Files (*.*) EPW Datei (*.epw);; Alle Dateien (*.*) - + Open Weather File Wetterdatei öffnen - + Failed To Set Weather File Wetterdatei konnte nicht geladen werden - + Failed To Set Weather File To Wetterdatei konnte nicht geladen werden als - + + Ok + + + + + Cancel + Abbrechen + + + + Skip +selection +import +all DDYs + + + + Open DDY File DDY Datei öffnen - + No Design Days in DDY File Keine Auslegungstage in DDY Datei vorhanden - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Die DDY Datei beinhaltet keine gültigen Auslegungstage. Überprüfen Sie die DDY Datei auf Fehler. diff --git a/translations/OpenStudioApp_el.ts b/translations/OpenStudioApp_el.ts index 8acdc4eeb..024c37e50 100644 --- a/translations/OpenStudioApp_el.ts +++ b/translations/OpenStudioApp_el.ts @@ -54,6 +54,14 @@ Προσθήκη/Κατάργηση επεκτάσιμων ομάδων + + LocationView + + + Import Design Days + + + ModelObjectSelectorDialog @@ -319,7 +327,7 @@ Zone openstudio::LocationTabView - + Site Τοποθεσία @@ -327,108 +335,126 @@ Zone openstudio::LocationView - + Weather File Αρχείο καιρού - + Name: Όνομα: - + Latitude: Γεωγραφικό πλάτος: - + Longitude: Γεωγραφικό μήκος: - + Elevation: Υψόμετρο: - + Time Zone: Ζώνη ώρας: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> Λήψη αρχείων καιρού στη διεύθυνση <a href="http://www.energyplus.net/weather"> www.energyplus.net/weather </a> - + Measure Tags (Optional): Ενεργειακά Μέτρα σημείωση (προαιρετικός): - + ASHRAE Climate Zone Κλιματική ζώνη ASHRAE - + CEC Climate Zone Κλιματική ζώνη CEC - + Design Days Ημέρες σχεδιασμού/αξιολόγησης - + Import From DDY Εισαγωγή από DDY - + Change Weather File Αλλαγή αρχείου καιρού - - + + Set Weather File Ορισμός αρχείου καιρού - + EPW Files (*.epw);; All Files (*.*) EPW Files (*.epw);; All Files (*.*) - + Open Weather File Άνοιγμα αρχείου καιρού - + Failed To Set Weather File Αποτυχία ορισμού αρχείου καιρού - + Failed To Set Weather File To Αποτυχία ορισμού αρχείου καιρού σε - + + Ok + + + + + Cancel + Ακύρωση + + + + Skip +selection +import +all DDYs + + + + Open DDY File Άνοιγμα αρχείου DDY - + No Design Days in DDY File Δεν υπάρχουν ημέρες αξιολόγησης στο αρχείο DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Αυτό το αρχείο DDY δεν περιέχει έγκυρες ημέρες σχεδιασμού/αξιολόγησης. Ελέγξτε το ίδιο το αρχείο DDY για σφάλματα ή παραλείψεις. diff --git a/translations/OpenStudioApp_es.ts b/translations/OpenStudioApp_es.ts index 3ca40c79a..c7d965384 100644 --- a/translations/OpenStudioApp_es.ts +++ b/translations/OpenStudioApp_es.ts @@ -55,6 +55,14 @@ Añadir/Remover Grupos Extendibles + + LocationView + + + Import Design Days + + + ModelObjectSelectorDialog @@ -320,7 +328,7 @@ Zone openstudio::LocationTabView - + Site Sitio @@ -328,108 +336,126 @@ Zone openstudio::LocationView - + Weather File Archivo de Clima - + Name: Nombre: - + Latitude: Latitud: - + Longitude: Longitud: - + Elevation: Elevación: - + Time Zone: Zona Horaria: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> Descarga Archivos de Clima en<a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> - + Measure Tags (Optional): Etiquetas de Medida (Opcional): - + ASHRAE Climate Zone Zona Climática de ASHRAE - + CEC Climate Zone Zona Climática de CEC - + Design Days Dias de Diseño - + Import From DDY Importar de DDY - + Change Weather File Cambiar Archivo de Clima - - + + Set Weather File Especificar Archivo de Clima - + EPW Files (*.epw);; All Files (*.*) Archivos EPW (*.epw);; Todos los Archivos (*.*) - + Open Weather File Abrir Archivo de Clima - + Failed To Set Weather File Error al Especificar el Archivo de Clima - + Failed To Set Weather File To Error al Especificar el Archivo de Clima a - + + Ok + + + + + Cancel + Cancelar + + + + Skip +selection +import +all DDYs + + + + Open DDY File Abrir Archivo DDY - + No Design Days in DDY File No hay Dias de Diseño en el Archivo DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Este Archivo DDY no contiene dias de diseño válidos. Revise el Archivo DDY en busca de errores u omisiones. diff --git a/translations/OpenStudioApp_fa.ts b/translations/OpenStudioApp_fa.ts index 5ffbe55dc..234cefa72 100644 --- a/translations/OpenStudioApp_fa.ts +++ b/translations/OpenStudioApp_fa.ts @@ -54,6 +54,14 @@ افزودن/حذف گروههای قابل توسعه + + LocationView + + + Import Design Days + + + ModelObjectSelectorDialog @@ -319,7 +327,7 @@ Zone openstudio::LocationTabView - + Site سایت @@ -327,108 +335,126 @@ Zone openstudio::LocationView - + Weather File فایل آب و هوایی - + Name: نام: - + Latitude: عرض جغرافیایی: - + Longitude: طول جغرافیایی: - + Elevation: ارتفاع: - + Time Zone: منطقه زمانی: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> دانلود فایل آب و هوایی از <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> - + Measure Tags (Optional): برچسب های تمهیدی (اختیاری): - + ASHRAE Climate Zone ASHRAEمنطقه اقلیمی - + CEC Climate Zone CEC منطقه اقلیمی - + Design Days روزهای طراحی - + Import From DDY وارد کردن از DDY - + Change Weather File تغییر فایل آب و هوایی - - + + Set Weather File تنظیم فایل آب و هوایی - + EPW Files (*.epw);; All Files (*.*) فایل های EPW (*.epw)؛ تمام فایل ها (*.*) - + Open Weather File باز کردن فایل آب و هوایی - + Failed To Set Weather File ناموفق در تنظیم فایل آب و هوایی - + Failed To Set Weather File To ناموفق در تنظیم فایل آب و هوایی برای - + + Ok + + + + + Cancel + لغو + + + + Skip +selection +import +all DDYs + + + + Open DDY File باز کردن فایل DDY - + No Design Days in DDY File در فایل DDY روزهای طراحی وجود ندارد - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. در فایل DDY روزهای طراحی معتبر وجود ندارد. diff --git a/translations/OpenStudioApp_fr.ts b/translations/OpenStudioApp_fr.ts index 20109389a..bf6088a47 100644 --- a/translations/OpenStudioApp_fr.ts +++ b/translations/OpenStudioApp_fr.ts @@ -54,6 +54,14 @@ Ajouter / Supprimer des groupes extensibles + + LocationView + + + Import Design Days + + + ModelObjectSelectorDialog @@ -319,7 +327,7 @@ Zone openstudio::LocationTabView - + Site Site @@ -327,108 +335,126 @@ Zone openstudio::LocationView - + Weather File Fichier météo - + Name: Nom : - + Latitude: Latitude : - + Longitude: Longitude : - + Elevation: Elévation : - + Time Zone: Fuseau horaire : - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> Fichiers météo téléchargeables sur <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> - + Measure Tags (Optional): Tags de Mesures (Optionnel) : - + ASHRAE Climate Zone Zone Climate ASHRAE - + CEC Climate Zone Zone Climatique CEC - + Design Days Jours de dimensionnement - + Import From DDY Importer depuis fichier DDY - + Change Weather File Changer fichier météo - - + + Set Weather File Attributer fichier météo - + EPW Files (*.epw);; All Files (*.*) Fichiers EPW (*.epw);; Tous (*.*) - + Open Weather File Ouvrir fichier météo - + Failed To Set Weather File Impossible d'attribuer le fichier météo - + Failed To Set Weather File To Impossible d'attribuer le fichier météo suivant : - + + Ok + + + + + Cancel + Annuler + + + + Skip +selection +import +all DDYs + + + + Open DDY File Ouvrir fichier DDY - + No Design Days in DDY File Aucun jours de dimensionnement dans le fichier DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Ce fichier DDY ne contient aucun jours de dimensionnement valides. Vérifiez le fichier DDY. diff --git a/translations/OpenStudioApp_he.ts b/translations/OpenStudioApp_he.ts index db0b23c60..af1d04c60 100644 --- a/translations/OpenStudioApp_he.ts +++ b/translations/OpenStudioApp_he.ts @@ -54,6 +54,14 @@ הוסף/הסר קבוצות מורחבות + + LocationView + + + Import Design Days + + + ModelObjectSelectorDialog @@ -317,7 +325,7 @@ Zone openstudio::LocationTabView - + Site אתר @@ -325,108 +333,126 @@ Zone openstudio::LocationView - + Weather File קובץ אקלימי - + Name: שם: - + Latitude: קו רוחב: - + Longitude: קו אורך: - + Elevation: חזית: - + Time Zone: אזור זמן: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> קובצי מזג אוויר להורדה בכתובת <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> - + Measure Tags (Optional): תגי מדידה (אופציונלי): - + ASHRAE Climate Zone אזור אקלים ASHRAE - + CEC Climate Zone אזור האקלים של CEC - + Design Days ימי תכנון - + Import From DDY ייבוא מ-DDY - + Change Weather File החלף קובץ אקלימי - - + + Set Weather File הגדר קובץ אקלימי - + EPW Files (*.epw);; All Files (*.*) קבצי EPW (*.epw);; הכל (*.*) - + Open Weather File פתח קובץ אקלימי - + Failed To Set Weather File לא ניתן להקצות קובץ אקלימי - + Failed To Set Weather File To לא ניתן להקצות את הקובץ אקלימי הבא: - + + Ok + + + + + Cancel + ביטול + + + + Skip +selection +import +all DDYs + + + + Open DDY File פתח קובץ DDY - + No Design Days in DDY File אין ימי תכנון בקובץ DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. קובץ DDY זה אינו מכיל ימי תכנון תקפים. בדוק את קובץ ה-DDY עצמו עבור שגיאות או השמטות. diff --git a/translations/OpenStudioApp_hi.ts b/translations/OpenStudioApp_hi.ts index 564674de8..8d971d33a 100644 --- a/translations/OpenStudioApp_hi.ts +++ b/translations/OpenStudioApp_hi.ts @@ -54,6 +54,14 @@ एक्स्टेंसिबल समूह जोड़ें/निकालें + + LocationView + + + Import Design Days + + + ModelObjectSelectorDialog @@ -318,7 +326,7 @@ Zone openstudio::LocationTabView - + Site स्थल @@ -326,108 +334,126 @@ Zone openstudio::LocationView - + Weather File मौसम फ़ाइल - + Name: नाम: - + Latitude: अक्षांश: - + Longitude: देशान्तर: - + Elevation: ऊंचाई: - + Time Zone: समय क्षेत्र: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> मौसम फ़ाइल डाउनलोड करें <a href="http://www.energyplus.net/weather">www.energyplus.net - + Measure Tags (Optional): उपाय टैग(ऐच्छिक): - + ASHRAE Climate Zone ASHRAE जलवायु क्षेत्र - + CEC Climate Zone CEC जलवायु क्षेत्र - + Design Days डिजाइन के दिन - + Import From DDY डीडीवाई से आयात करें - + Change Weather File मौसम फ़ाइल बदलें - - + + Set Weather File मौसम फ़ाइल सेट करें - + EPW Files (*.epw);; All Files (*.*) ईपीडब्ल्यू फाइलें (*.epw);; सब फाइलें (*.*) - + Open Weather File मौसम फ़ाइल खोले - + Failed To Set Weather File मौसम फ़ाइल सेट करने में विफल - + Failed To Set Weather File To निम्लिखित मौसम फ़ाइल सेट करने में विफल - + + Ok + + + + + Cancel + रद्द करें + + + + Skip +selection +import +all DDYs + + + + Open DDY File डीडीवाई फ़ाइल खोलें - + No Design Days in DDY File डीडीवाई फ़ाइल में कोई डिज़ाइन दिवस नहीं - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. इस डीडीवाई फ़ाइल में कोई मान्य डिज़ाइन दिवस नहीं है। त्रुटियों या चूक के लिए स्वयं डीडीवाई फ़ाइल की जाँच करें. diff --git a/translations/OpenStudioApp_it.ts b/translations/OpenStudioApp_it.ts index 2a4a55c28..b0d68746d 100644 --- a/translations/OpenStudioApp_it.ts +++ b/translations/OpenStudioApp_it.ts @@ -54,6 +54,14 @@ Aggiungi/Rimuovi Gruppi d'Estensione + + LocationView + + + Import Design Days + + + ModelObjectSelectorDialog @@ -320,7 +328,7 @@ Entità openstudio::LocationTabView - + Site Sito @@ -328,108 +336,126 @@ Entità openstudio::LocationView - + Weather File Weather File - + Name: Nome: - + Latitude: Latitudine: - + Longitude: Longitudine: - + Elevation: Quota: - + Time Zone: TimeZone: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> Scarica I Weather Files Presso <a href=\"http://www.energyplus.net/weather\">www.energyplus.net/weather</a> - + Measure Tags (Optional): Etichette Per Misure (Facoltativo): - + ASHRAE Climate Zone Zona Climatica ASHRAE - + CEC Climate Zone Zona Climatica CEC - + Design Days Giorni di Simulazione - + Import From DDY Importa Da DDY - + Change Weather File Cambia Weather File - - + + Set Weather File Stabilisci Weather File - + EPW Files (*.epw);; All Files (*.*) EPW Files (*.epw);; All Files (*.*) - + Open Weather File Apri Weather File - + Failed To Set Weather File Errore Nel Settaggio Del Weather File - + Failed To Set Weather File To Errore Nell' Allocazione Del Weather File - + + Ok + + + + + Cancel + Annulla + + + + Skip +selection +import +all DDYs + + + + Open DDY File Apri File DDY - + No Design Days in DDY File Nessun Giorno Impostato Nel File DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Questo File DDY non contiene alcun giorno valido. Controlla il File DDY per errori od omissioni. diff --git a/translations/OpenStudioApp_ja.ts b/translations/OpenStudioApp_ja.ts index 62290d82a..067792645 100644 --- a/translations/OpenStudioApp_ja.ts +++ b/translations/OpenStudioApp_ja.ts @@ -54,6 +54,14 @@ 追加/削除 + + LocationView + + + Import Design Days + + + ModelObjectSelectorDialog @@ -320,7 +328,7 @@ Zone openstudio::LocationTabView - + Site 敷地 @@ -328,108 +336,126 @@ Zone openstudio::LocationView - + Weather File 気象データ - + Name: ファイル名: - + Latitude: 緯度: - + Longitude: 経度: - + Elevation: 標高: - + Time Zone: タイムゾーン: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> 気象データをダウンロード: <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> - + Measure Tags (Optional): メジャータブ(任意): - + ASHRAE Climate Zone ASHRAE気候帯 - + CEC Climate Zone CEC気候帯 - + Design Days 気象条件 - + Import From DDY DDYからインポート - + Change Weather File 気象データの変更 - - + + Set Weather File 気象データの選択 - + EPW Files (*.epw);; All Files (*.*) EPW (*.epw);; すべてのファイル形式(*.*) - + Open Weather File 気象データを開く - + Failed To Set Weather File 気象データの選択に失敗しました - + Failed To Set Weather File To 気象データの選択に失敗しました - + + Ok + + + + + Cancel + キャンセル + + + + Skip +selection +import +all DDYs + + + + Open DDY File DDYファイルを開く - + No Design Days in DDY File DDYファイルに気象条件がありません - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. DDYファイルに有効な気象条件がありません。ファイルにエラーや欠損がないか確認してください。 diff --git a/translations/OpenStudioApp_pl.ts b/translations/OpenStudioApp_pl.ts index 4a37222ea..f76f262eb 100644 --- a/translations/OpenStudioApp_pl.ts +++ b/translations/OpenStudioApp_pl.ts @@ -54,6 +54,14 @@ Dodaj/Usuń rozszerzalne grupy + + LocationView + + + Import Design Days + + + ModelObjectSelectorDialog @@ -320,7 +328,7 @@ Pomieszczenie openstudio::LocationTabView - + Site Teren @@ -328,108 +336,126 @@ Pomieszczenie openstudio::LocationView - + Weather File Plik pogodowy - + Name: Nazwa: - + Latitude: Szerokość geograficzna: - + Longitude: Długość geograficzna: - + Elevation: Przewyższenie: - + Time Zone: Strefa czasowa: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> Pobierz pliki pogodowe z <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> - + Measure Tags (Optional): Tagi pomiaru (opcjonalnie): - + ASHRAE Climate Zone Strefa klimatyczna ASHRAE - + CEC Climate Zone Strefa klimatyczna CEC - + Design Days Dni projektowe - + Import From DDY Importuj z DDY - + Change Weather File Zmień plik pogodowy - - + + Set Weather File Ustaw plik pogodowy - + EPW Files (*.epw);; All Files (*.*) Pliki EPW (*.epw);; Wszystkie pliki (*.*) - + Open Weather File Otwórz plik pogodowy - + Failed To Set Weather File Nie udało się ustawić pliku pogody - + Failed To Set Weather File To Nie udało się ustawić pliku pogody na - + + Ok + + + + + Cancel + Anuluj + + + + Skip +selection +import +all DDYs + + + + Open DDY File - + No Design Days in DDY File Brak dni projektowych w pliku DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Ten plik DDY nie zawiera poprawnych dni projektowych. Sprawdź plik DDY pod kątem błędów. diff --git a/translations/OpenStudioApp_vi.ts b/translations/OpenStudioApp_vi.ts index 98abd4f77..da8766bb1 100644 --- a/translations/OpenStudioApp_vi.ts +++ b/translations/OpenStudioApp_vi.ts @@ -54,6 +54,14 @@ Thêm/bớt các nhóm có thể mở rộng + + LocationView + + + Import Design Days + + + ModelObjectSelectorDialog @@ -317,7 +325,7 @@ Zone openstudio::LocationTabView - + Site Khu đất @@ -325,108 +333,126 @@ Zone openstudio::LocationView - + Weather File File thời tiết - + Name: Tên: - + Latitude: Vĩ độ: - + Longitude: Kinh độ: - + Elevation: Cao độ : - + Time Zone: Múi giờ: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> Tải file thời tiết - + Measure Tags (Optional): Tags tính toán bổ sung (tuỳ chọn): - + ASHRAE Climate Zone Vùng khí hậu theo ASHRAE - + CEC Climate Zone Vùng khí hậu theo CEC - + Design Days Ngày thiết kế - + Import From DDY Nhập từ file DDY - + Change Weather File Thay đổi file thời tiết - - + + Set Weather File Thiết lập file thời tiết - + EPW Files (*.epw);; All Files (*.*) File EPW (*.epw);; Tất cả file (*.) - + Open Weather File Mở file thời tiết - + Failed To Set Weather File Lỗi khi thiết lập file thời tiết - + Failed To Set Weather File To Lỗi khi thiết lập file thời tiết tới - + + Ok + + + + + Cancel + Huỷ + + + + Skip +selection +import +all DDYs + + + + Open DDY File Mở file DDY - + No Design Days in DDY File Không có Ngày thiết kế trong file DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. File DDY này không chứa dữ liệu đúng cho ngày thiết kế. Kiểm tra file DDY để soát lỗi. diff --git a/translations/OpenStudioApp_zh_CN.ts b/translations/OpenStudioApp_zh_CN.ts index ed1e9d4a5..d9d8379f9 100644 --- a/translations/OpenStudioApp_zh_CN.ts +++ b/translations/OpenStudioApp_zh_CN.ts @@ -54,6 +54,14 @@ 增加/删除 扩展组 + + LocationView + + + Import Design Days + + + ModelObjectSelectorDialog @@ -320,7 +328,7 @@ Zone openstudio::LocationTabView - + Site 场地 @@ -328,108 +336,126 @@ Zone openstudio::LocationView - + Weather File 气候文件 - + Name: 名字: - + Latitude: 纬度: - + Longitude: 经度: - + Elevation: 高度: - + Time Zone: 时区: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> 下载气候文件从: <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> - + Measure Tags (Optional): 度量标签(可选): - + ASHRAE Climate Zone ASHRAE标准 气候区 - + CEC Climate Zone CEC标准气候区 - + Design Days 设计日 - + Import From DDY 从DDY文件导入 - + Change Weather File 修改气候文件 - - + + Set Weather File 设置气候文件 - + EPW Files (*.epw);; All Files (*.*) EPW 文件 (*.epw);; 所有文件 (*.*) - + Open Weather File 打开气候文件 - + Failed To Set Weather File 设置气候文件失败 - + Failed To Set Weather File To 设置气候文件失败 - + + Ok + + + + + Cancel + 取消 + + + + Skip +selection +import +all DDYs + + + + Open DDY File 打开DDY文件 - + No Design Days in DDY File DDY不含设计日 - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. 这个DDY文件不含任何设计日。请检查这个DDY文件是否有误。 From 7eeee4b64988085730d38036fcc5841ecbbd40c9 Mon Sep 17 00:00:00 2001 From: Dan Macumber Date: Sat, 1 Mar 2025 23:51:13 -0700 Subject: [PATCH 32/44] Remove unintended change --- src/openstudio_lib/test/LocationTab_GTest.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/openstudio_lib/test/LocationTab_GTest.cpp b/src/openstudio_lib/test/LocationTab_GTest.cpp index 7dafe578e..9882e7d89 100644 --- a/src/openstudio_lib/test/LocationTab_GTest.cpp +++ b/src/openstudio_lib/test/LocationTab_GTest.cpp @@ -49,5 +49,4 @@ TEST_F(OpenStudioLibFixture, SortableDesignDay) { EXPECT_EQ("Heating", sdd.type()); EXPECT_EQ(996, sdd.permil()); EXPECT_EQ(4, sdd.sortablePermil()); - } \ No newline at end of file From 3124b85a8d91e93352fe1993c83dbdf913aed618 Mon Sep 17 00:00:00 2001 From: Dan Macumber Date: Sat, 1 Mar 2025 23:55:12 -0700 Subject: [PATCH 33/44] Fix cppcheck --- src/openstudio_lib/LocationTabView.hpp | 2 +- translations/OpenStudioApp_ar.ts | 61 +++++++++++++------------- translations/OpenStudioApp_ca.ts | 61 +++++++++++++------------- translations/OpenStudioApp_de.ts | 61 +++++++++++++------------- translations/OpenStudioApp_el.ts | 61 +++++++++++++------------- translations/OpenStudioApp_es.ts | 61 +++++++++++++------------- translations/OpenStudioApp_fa.ts | 61 +++++++++++++------------- translations/OpenStudioApp_fr.ts | 61 +++++++++++++------------- translations/OpenStudioApp_he.ts | 61 +++++++++++++------------- translations/OpenStudioApp_hi.ts | 61 +++++++++++++------------- translations/OpenStudioApp_it.ts | 61 +++++++++++++------------- translations/OpenStudioApp_ja.ts | 61 +++++++++++++------------- translations/OpenStudioApp_pl.ts | 61 +++++++++++++------------- translations/OpenStudioApp_vi.ts | 61 +++++++++++++------------- translations/OpenStudioApp_zh_CN.ts | 61 +++++++++++++------------- 15 files changed, 421 insertions(+), 435 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.hpp b/src/openstudio_lib/LocationTabView.hpp index 18911999a..e865c41f5 100644 --- a/src/openstudio_lib/LocationTabView.hpp +++ b/src/openstudio_lib/LocationTabView.hpp @@ -37,7 +37,7 @@ class YearDescription; class SortableDesignDay { public: - SortableDesignDay(const openstudio::model::DesignDay& designDay); + explicit SortableDesignDay(const openstudio::model::DesignDay& designDay); static int qstringToPermil(const QString& str); diff --git a/translations/OpenStudioApp_ar.ts b/translations/OpenStudioApp_ar.ts index b275fc2ac..223567b90 100644 --- a/translations/OpenStudioApp_ar.ts +++ b/translations/OpenStudioApp_ar.ts @@ -57,7 +57,7 @@ LocationView - + Import Design Days @@ -325,7 +325,7 @@ Zone openstudio::LocationTabView - + Site @@ -333,126 +333,125 @@ Zone openstudio::LocationView - + Weather File - + Name: - + Latitude: - + Longitude: - + Elevation: - + Time Zone: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> - + Measure Tags (Optional): - + ASHRAE Climate Zone - + CEC Climate Zone - + + + Design Days - + Import From DDY - + Change Weather File - - + + Set Weather File - + EPW Files (*.epw);; All Files (*.*) - + Open Weather File - + Failed To Set Weather File - + Failed To Set Weather File To - + Ok - + Cancel - - Skip -selection -import -all DDYs + + Import all - + Open DDY File - + No Design Days in DDY File - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. diff --git a/translations/OpenStudioApp_ca.ts b/translations/OpenStudioApp_ca.ts index a58995603..cf06d604b 100644 --- a/translations/OpenStudioApp_ca.ts +++ b/translations/OpenStudioApp_ca.ts @@ -58,7 +58,7 @@ LocationView - + Import Design Days @@ -329,7 +329,7 @@ Zona openstudio::LocationTabView - + Site Lloc @@ -337,126 +337,125 @@ Zona openstudio::LocationView - + Weather File Fitxer Climàtic - + Name: Nom: - + Latitude: Latitud: - + Longitude: Longitud: - + Elevation: Altitud: - + Time Zone: Zona Horària: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> Descarregar fitxers climàtics a <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> - + Measure Tags (Optional): Etiqueta per les Mesures (Opcional): - + ASHRAE Climate Zone Zona Climàtica d'ASHRAE - + CEC Climate Zone Zona Climàtica CEC - + + + Design Days Dies de Disseny - + Import From DDY Importar des de DDY - + Change Weather File Canviar el Fitxer Climàtic - - + + Set Weather File Definir el Fitxer Climàtic - + EPW Files (*.epw);; All Files (*.*) EPW Files (*.epw);; All Files (*.*) - + Open Weather File Obrir Fitxer Climàtic - + Failed To Set Weather File Error al Definir el Fitxer Climàtic - + Failed To Set Weather File To Error al Definir el Fitxer Climàtic a - + Ok - + Cancel Cancel·lar - - Skip -selection -import -all DDYs + + Import all - + Open DDY File Obrir Fitxer DDY - + No Design Days in DDY File No hi ha Dies de Disseny al fitxer DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Aquest fitxer DDY no conté cap dia de disseny vàlid. Comproveu el fitxer DDY. diff --git a/translations/OpenStudioApp_de.ts b/translations/OpenStudioApp_de.ts index efb20696d..e03cc0341 100644 --- a/translations/OpenStudioApp_de.ts +++ b/translations/OpenStudioApp_de.ts @@ -57,7 +57,7 @@ LocationView - + Import Design Days @@ -334,7 +334,7 @@ Zone openstudio::LocationTabView - + Site Standort @@ -342,126 +342,125 @@ Zone openstudio::LocationView - + Weather File Wetterdatei - + Name: Name: - + Latitude: Breitengrad: - + Longitude: Längengrad: - + Elevation: Höhe über Meer: - + Time Zone: Zeitzone: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> Hier Wetterdaten herunterladen - + Measure Tags (Optional): Kennzeichnung (optional): - + ASHRAE Climate Zone ASHRAE Klimazone - + CEC Climate Zone CEC Klimazone - + + + Design Days Auslegungstage - + Import From DDY Von DDY importieren - + Change Weather File Wetterdatei ändern - - + + Set Weather File Ausgewählte Wetterdatei - + EPW Files (*.epw);; All Files (*.*) EPW Datei (*.epw);; Alle Dateien (*.*) - + Open Weather File Wetterdatei öffnen - + Failed To Set Weather File Wetterdatei konnte nicht geladen werden - + Failed To Set Weather File To Wetterdatei konnte nicht geladen werden als - + Ok - + Cancel Abbrechen - - Skip -selection -import -all DDYs + + Import all - + Open DDY File DDY Datei öffnen - + No Design Days in DDY File Keine Auslegungstage in DDY Datei vorhanden - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Die DDY Datei beinhaltet keine gültigen Auslegungstage. Überprüfen Sie die DDY Datei auf Fehler. diff --git a/translations/OpenStudioApp_el.ts b/translations/OpenStudioApp_el.ts index 024c37e50..ab092c041 100644 --- a/translations/OpenStudioApp_el.ts +++ b/translations/OpenStudioApp_el.ts @@ -57,7 +57,7 @@ LocationView - + Import Design Days @@ -327,7 +327,7 @@ Zone openstudio::LocationTabView - + Site Τοποθεσία @@ -335,126 +335,125 @@ Zone openstudio::LocationView - + Weather File Αρχείο καιρού - + Name: Όνομα: - + Latitude: Γεωγραφικό πλάτος: - + Longitude: Γεωγραφικό μήκος: - + Elevation: Υψόμετρο: - + Time Zone: Ζώνη ώρας: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> Λήψη αρχείων καιρού στη διεύθυνση <a href="http://www.energyplus.net/weather"> www.energyplus.net/weather </a> - + Measure Tags (Optional): Ενεργειακά Μέτρα σημείωση (προαιρετικός): - + ASHRAE Climate Zone Κλιματική ζώνη ASHRAE - + CEC Climate Zone Κλιματική ζώνη CEC - + + + Design Days Ημέρες σχεδιασμού/αξιολόγησης - + Import From DDY Εισαγωγή από DDY - + Change Weather File Αλλαγή αρχείου καιρού - - + + Set Weather File Ορισμός αρχείου καιρού - + EPW Files (*.epw);; All Files (*.*) EPW Files (*.epw);; All Files (*.*) - + Open Weather File Άνοιγμα αρχείου καιρού - + Failed To Set Weather File Αποτυχία ορισμού αρχείου καιρού - + Failed To Set Weather File To Αποτυχία ορισμού αρχείου καιρού σε - + Ok - + Cancel Ακύρωση - - Skip -selection -import -all DDYs + + Import all - + Open DDY File Άνοιγμα αρχείου DDY - + No Design Days in DDY File Δεν υπάρχουν ημέρες αξιολόγησης στο αρχείο DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Αυτό το αρχείο DDY δεν περιέχει έγκυρες ημέρες σχεδιασμού/αξιολόγησης. Ελέγξτε το ίδιο το αρχείο DDY για σφάλματα ή παραλείψεις. diff --git a/translations/OpenStudioApp_es.ts b/translations/OpenStudioApp_es.ts index c7d965384..173680f1c 100644 --- a/translations/OpenStudioApp_es.ts +++ b/translations/OpenStudioApp_es.ts @@ -58,7 +58,7 @@ LocationView - + Import Design Days @@ -328,7 +328,7 @@ Zone openstudio::LocationTabView - + Site Sitio @@ -336,126 +336,125 @@ Zone openstudio::LocationView - + Weather File Archivo de Clima - + Name: Nombre: - + Latitude: Latitud: - + Longitude: Longitud: - + Elevation: Elevación: - + Time Zone: Zona Horaria: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> Descarga Archivos de Clima en<a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> - + Measure Tags (Optional): Etiquetas de Medida (Opcional): - + ASHRAE Climate Zone Zona Climática de ASHRAE - + CEC Climate Zone Zona Climática de CEC - + + + Design Days Dias de Diseño - + Import From DDY Importar de DDY - + Change Weather File Cambiar Archivo de Clima - - + + Set Weather File Especificar Archivo de Clima - + EPW Files (*.epw);; All Files (*.*) Archivos EPW (*.epw);; Todos los Archivos (*.*) - + Open Weather File Abrir Archivo de Clima - + Failed To Set Weather File Error al Especificar el Archivo de Clima - + Failed To Set Weather File To Error al Especificar el Archivo de Clima a - + Ok - + Cancel Cancelar - - Skip -selection -import -all DDYs + + Import all - + Open DDY File Abrir Archivo DDY - + No Design Days in DDY File No hay Dias de Diseño en el Archivo DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Este Archivo DDY no contiene dias de diseño válidos. Revise el Archivo DDY en busca de errores u omisiones. diff --git a/translations/OpenStudioApp_fa.ts b/translations/OpenStudioApp_fa.ts index 234cefa72..c2342dc3e 100644 --- a/translations/OpenStudioApp_fa.ts +++ b/translations/OpenStudioApp_fa.ts @@ -57,7 +57,7 @@ LocationView - + Import Design Days @@ -327,7 +327,7 @@ Zone openstudio::LocationTabView - + Site سایت @@ -335,126 +335,125 @@ Zone openstudio::LocationView - + Weather File فایل آب و هوایی - + Name: نام: - + Latitude: عرض جغرافیایی: - + Longitude: طول جغرافیایی: - + Elevation: ارتفاع: - + Time Zone: منطقه زمانی: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> دانلود فایل آب و هوایی از <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> - + Measure Tags (Optional): برچسب های تمهیدی (اختیاری): - + ASHRAE Climate Zone ASHRAEمنطقه اقلیمی - + CEC Climate Zone CEC منطقه اقلیمی - + + + Design Days روزهای طراحی - + Import From DDY وارد کردن از DDY - + Change Weather File تغییر فایل آب و هوایی - - + + Set Weather File تنظیم فایل آب و هوایی - + EPW Files (*.epw);; All Files (*.*) فایل های EPW (*.epw)؛ تمام فایل ها (*.*) - + Open Weather File باز کردن فایل آب و هوایی - + Failed To Set Weather File ناموفق در تنظیم فایل آب و هوایی - + Failed To Set Weather File To ناموفق در تنظیم فایل آب و هوایی برای - + Ok - + Cancel لغو - - Skip -selection -import -all DDYs + + Import all - + Open DDY File باز کردن فایل DDY - + No Design Days in DDY File در فایل DDY روزهای طراحی وجود ندارد - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. در فایل DDY روزهای طراحی معتبر وجود ندارد. diff --git a/translations/OpenStudioApp_fr.ts b/translations/OpenStudioApp_fr.ts index bf6088a47..8bedc2118 100644 --- a/translations/OpenStudioApp_fr.ts +++ b/translations/OpenStudioApp_fr.ts @@ -57,7 +57,7 @@ LocationView - + Import Design Days @@ -327,7 +327,7 @@ Zone openstudio::LocationTabView - + Site Site @@ -335,126 +335,125 @@ Zone openstudio::LocationView - + Weather File Fichier météo - + Name: Nom : - + Latitude: Latitude : - + Longitude: Longitude : - + Elevation: Elévation : - + Time Zone: Fuseau horaire : - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> Fichiers météo téléchargeables sur <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> - + Measure Tags (Optional): Tags de Mesures (Optionnel) : - + ASHRAE Climate Zone Zone Climate ASHRAE - + CEC Climate Zone Zone Climatique CEC - + + + Design Days Jours de dimensionnement - + Import From DDY Importer depuis fichier DDY - + Change Weather File Changer fichier météo - - + + Set Weather File Attributer fichier météo - + EPW Files (*.epw);; All Files (*.*) Fichiers EPW (*.epw);; Tous (*.*) - + Open Weather File Ouvrir fichier météo - + Failed To Set Weather File Impossible d'attribuer le fichier météo - + Failed To Set Weather File To Impossible d'attribuer le fichier météo suivant : - + Ok - + Cancel Annuler - - Skip -selection -import -all DDYs + + Import all - + Open DDY File Ouvrir fichier DDY - + No Design Days in DDY File Aucun jours de dimensionnement dans le fichier DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Ce fichier DDY ne contient aucun jours de dimensionnement valides. Vérifiez le fichier DDY. diff --git a/translations/OpenStudioApp_he.ts b/translations/OpenStudioApp_he.ts index af1d04c60..bd8df8b3d 100644 --- a/translations/OpenStudioApp_he.ts +++ b/translations/OpenStudioApp_he.ts @@ -57,7 +57,7 @@ LocationView - + Import Design Days @@ -325,7 +325,7 @@ Zone openstudio::LocationTabView - + Site אתר @@ -333,126 +333,125 @@ Zone openstudio::LocationView - + Weather File קובץ אקלימי - + Name: שם: - + Latitude: קו רוחב: - + Longitude: קו אורך: - + Elevation: חזית: - + Time Zone: אזור זמן: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> קובצי מזג אוויר להורדה בכתובת <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> - + Measure Tags (Optional): תגי מדידה (אופציונלי): - + ASHRAE Climate Zone אזור אקלים ASHRAE - + CEC Climate Zone אזור האקלים של CEC - + + + Design Days ימי תכנון - + Import From DDY ייבוא מ-DDY - + Change Weather File החלף קובץ אקלימי - - + + Set Weather File הגדר קובץ אקלימי - + EPW Files (*.epw);; All Files (*.*) קבצי EPW (*.epw);; הכל (*.*) - + Open Weather File פתח קובץ אקלימי - + Failed To Set Weather File לא ניתן להקצות קובץ אקלימי - + Failed To Set Weather File To לא ניתן להקצות את הקובץ אקלימי הבא: - + Ok - + Cancel ביטול - - Skip -selection -import -all DDYs + + Import all - + Open DDY File פתח קובץ DDY - + No Design Days in DDY File אין ימי תכנון בקובץ DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. קובץ DDY זה אינו מכיל ימי תכנון תקפים. בדוק את קובץ ה-DDY עצמו עבור שגיאות או השמטות. diff --git a/translations/OpenStudioApp_hi.ts b/translations/OpenStudioApp_hi.ts index 8d971d33a..cf8809b13 100644 --- a/translations/OpenStudioApp_hi.ts +++ b/translations/OpenStudioApp_hi.ts @@ -57,7 +57,7 @@ LocationView - + Import Design Days @@ -326,7 +326,7 @@ Zone openstudio::LocationTabView - + Site स्थल @@ -334,126 +334,125 @@ Zone openstudio::LocationView - + Weather File मौसम फ़ाइल - + Name: नाम: - + Latitude: अक्षांश: - + Longitude: देशान्तर: - + Elevation: ऊंचाई: - + Time Zone: समय क्षेत्र: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> मौसम फ़ाइल डाउनलोड करें <a href="http://www.energyplus.net/weather">www.energyplus.net - + Measure Tags (Optional): उपाय टैग(ऐच्छिक): - + ASHRAE Climate Zone ASHRAE जलवायु क्षेत्र - + CEC Climate Zone CEC जलवायु क्षेत्र - + + + Design Days डिजाइन के दिन - + Import From DDY डीडीवाई से आयात करें - + Change Weather File मौसम फ़ाइल बदलें - - + + Set Weather File मौसम फ़ाइल सेट करें - + EPW Files (*.epw);; All Files (*.*) ईपीडब्ल्यू फाइलें (*.epw);; सब फाइलें (*.*) - + Open Weather File मौसम फ़ाइल खोले - + Failed To Set Weather File मौसम फ़ाइल सेट करने में विफल - + Failed To Set Weather File To निम्लिखित मौसम फ़ाइल सेट करने में विफल - + Ok - + Cancel रद्द करें - - Skip -selection -import -all DDYs + + Import all - + Open DDY File डीडीवाई फ़ाइल खोलें - + No Design Days in DDY File डीडीवाई फ़ाइल में कोई डिज़ाइन दिवस नहीं - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. इस डीडीवाई फ़ाइल में कोई मान्य डिज़ाइन दिवस नहीं है। त्रुटियों या चूक के लिए स्वयं डीडीवाई फ़ाइल की जाँच करें. diff --git a/translations/OpenStudioApp_it.ts b/translations/OpenStudioApp_it.ts index b0d68746d..6a4dc4fd4 100644 --- a/translations/OpenStudioApp_it.ts +++ b/translations/OpenStudioApp_it.ts @@ -57,7 +57,7 @@ LocationView - + Import Design Days @@ -328,7 +328,7 @@ Entità openstudio::LocationTabView - + Site Sito @@ -336,126 +336,125 @@ Entità openstudio::LocationView - + Weather File Weather File - + Name: Nome: - + Latitude: Latitudine: - + Longitude: Longitudine: - + Elevation: Quota: - + Time Zone: TimeZone: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> Scarica I Weather Files Presso <a href=\"http://www.energyplus.net/weather\">www.energyplus.net/weather</a> - + Measure Tags (Optional): Etichette Per Misure (Facoltativo): - + ASHRAE Climate Zone Zona Climatica ASHRAE - + CEC Climate Zone Zona Climatica CEC - + + + Design Days Giorni di Simulazione - + Import From DDY Importa Da DDY - + Change Weather File Cambia Weather File - - + + Set Weather File Stabilisci Weather File - + EPW Files (*.epw);; All Files (*.*) EPW Files (*.epw);; All Files (*.*) - + Open Weather File Apri Weather File - + Failed To Set Weather File Errore Nel Settaggio Del Weather File - + Failed To Set Weather File To Errore Nell' Allocazione Del Weather File - + Ok - + Cancel Annulla - - Skip -selection -import -all DDYs + + Import all - + Open DDY File Apri File DDY - + No Design Days in DDY File Nessun Giorno Impostato Nel File DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Questo File DDY non contiene alcun giorno valido. Controlla il File DDY per errori od omissioni. diff --git a/translations/OpenStudioApp_ja.ts b/translations/OpenStudioApp_ja.ts index 067792645..fe21096fb 100644 --- a/translations/OpenStudioApp_ja.ts +++ b/translations/OpenStudioApp_ja.ts @@ -57,7 +57,7 @@ LocationView - + Import Design Days @@ -328,7 +328,7 @@ Zone openstudio::LocationTabView - + Site 敷地 @@ -336,126 +336,125 @@ Zone openstudio::LocationView - + Weather File 気象データ - + Name: ファイル名: - + Latitude: 緯度: - + Longitude: 経度: - + Elevation: 標高: - + Time Zone: タイムゾーン: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> 気象データをダウンロード: <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> - + Measure Tags (Optional): メジャータブ(任意): - + ASHRAE Climate Zone ASHRAE気候帯 - + CEC Climate Zone CEC気候帯 - + + + Design Days 気象条件 - + Import From DDY DDYからインポート - + Change Weather File 気象データの変更 - - + + Set Weather File 気象データの選択 - + EPW Files (*.epw);; All Files (*.*) EPW (*.epw);; すべてのファイル形式(*.*) - + Open Weather File 気象データを開く - + Failed To Set Weather File 気象データの選択に失敗しました - + Failed To Set Weather File To 気象データの選択に失敗しました - + Ok - + Cancel キャンセル - - Skip -selection -import -all DDYs + + Import all - + Open DDY File DDYファイルを開く - + No Design Days in DDY File DDYファイルに気象条件がありません - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. DDYファイルに有効な気象条件がありません。ファイルにエラーや欠損がないか確認してください。 diff --git a/translations/OpenStudioApp_pl.ts b/translations/OpenStudioApp_pl.ts index f76f262eb..baaa1d63a 100644 --- a/translations/OpenStudioApp_pl.ts +++ b/translations/OpenStudioApp_pl.ts @@ -57,7 +57,7 @@ LocationView - + Import Design Days @@ -328,7 +328,7 @@ Pomieszczenie openstudio::LocationTabView - + Site Teren @@ -336,126 +336,125 @@ Pomieszczenie openstudio::LocationView - + Weather File Plik pogodowy - + Name: Nazwa: - + Latitude: Szerokość geograficzna: - + Longitude: Długość geograficzna: - + Elevation: Przewyższenie: - + Time Zone: Strefa czasowa: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> Pobierz pliki pogodowe z <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> - + Measure Tags (Optional): Tagi pomiaru (opcjonalnie): - + ASHRAE Climate Zone Strefa klimatyczna ASHRAE - + CEC Climate Zone Strefa klimatyczna CEC - + + + Design Days Dni projektowe - + Import From DDY Importuj z DDY - + Change Weather File Zmień plik pogodowy - - + + Set Weather File Ustaw plik pogodowy - + EPW Files (*.epw);; All Files (*.*) Pliki EPW (*.epw);; Wszystkie pliki (*.*) - + Open Weather File Otwórz plik pogodowy - + Failed To Set Weather File Nie udało się ustawić pliku pogody - + Failed To Set Weather File To Nie udało się ustawić pliku pogody na - + Ok - + Cancel Anuluj - - Skip -selection -import -all DDYs + + Import all - + Open DDY File - + No Design Days in DDY File Brak dni projektowych w pliku DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Ten plik DDY nie zawiera poprawnych dni projektowych. Sprawdź plik DDY pod kątem błędów. diff --git a/translations/OpenStudioApp_vi.ts b/translations/OpenStudioApp_vi.ts index da8766bb1..482efdb5a 100644 --- a/translations/OpenStudioApp_vi.ts +++ b/translations/OpenStudioApp_vi.ts @@ -57,7 +57,7 @@ LocationView - + Import Design Days @@ -325,7 +325,7 @@ Zone openstudio::LocationTabView - + Site Khu đất @@ -333,126 +333,125 @@ Zone openstudio::LocationView - + Weather File File thời tiết - + Name: Tên: - + Latitude: Vĩ độ: - + Longitude: Kinh độ: - + Elevation: Cao độ : - + Time Zone: Múi giờ: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> Tải file thời tiết - + Measure Tags (Optional): Tags tính toán bổ sung (tuỳ chọn): - + ASHRAE Climate Zone Vùng khí hậu theo ASHRAE - + CEC Climate Zone Vùng khí hậu theo CEC - + + + Design Days Ngày thiết kế - + Import From DDY Nhập từ file DDY - + Change Weather File Thay đổi file thời tiết - - + + Set Weather File Thiết lập file thời tiết - + EPW Files (*.epw);; All Files (*.*) File EPW (*.epw);; Tất cả file (*.) - + Open Weather File Mở file thời tiết - + Failed To Set Weather File Lỗi khi thiết lập file thời tiết - + Failed To Set Weather File To Lỗi khi thiết lập file thời tiết tới - + Ok - + Cancel Huỷ - - Skip -selection -import -all DDYs + + Import all - + Open DDY File Mở file DDY - + No Design Days in DDY File Không có Ngày thiết kế trong file DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. File DDY này không chứa dữ liệu đúng cho ngày thiết kế. Kiểm tra file DDY để soát lỗi. diff --git a/translations/OpenStudioApp_zh_CN.ts b/translations/OpenStudioApp_zh_CN.ts index d9d8379f9..d8db324ca 100644 --- a/translations/OpenStudioApp_zh_CN.ts +++ b/translations/OpenStudioApp_zh_CN.ts @@ -57,7 +57,7 @@ LocationView - + Import Design Days @@ -328,7 +328,7 @@ Zone openstudio::LocationTabView - + Site 场地 @@ -336,126 +336,125 @@ Zone openstudio::LocationView - + Weather File 气候文件 - + Name: 名字: - + Latitude: 纬度: - + Longitude: 经度: - + Elevation: 高度: - + Time Zone: 时区: - + Download weather files at <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> 下载气候文件从: <a href="http://www.energyplus.net/weather">www.energyplus.net/weather</a> - + Measure Tags (Optional): 度量标签(可选): - + ASHRAE Climate Zone ASHRAE标准 气候区 - + CEC Climate Zone CEC标准气候区 - + + + Design Days 设计日 - + Import From DDY 从DDY文件导入 - + Change Weather File 修改气候文件 - - + + Set Weather File 设置气候文件 - + EPW Files (*.epw);; All Files (*.*) EPW 文件 (*.epw);; 所有文件 (*.*) - + Open Weather File 打开气候文件 - + Failed To Set Weather File 设置气候文件失败 - + Failed To Set Weather File To 设置气候文件失败 - + Ok - + Cancel 取消 - - Skip -selection -import -all DDYs + + Import all - + Open DDY File 打开DDY文件 - + No Design Days in DDY File DDY不含设计日 - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. 这个DDY文件不含任何设计日。请检查这个DDY文件是否有误。 From d2a46c07805963ebb7d11a7d17539409de748aab Mon Sep 17 00:00:00 2001 From: Dan Macumber Date: Sun, 2 Mar 2025 09:27:48 -0700 Subject: [PATCH 34/44] Avoid copying QVector around by adding design day key to radio button instead, attempt to fix the Mac CI issue. Really want https://github.com/NREL/OpenStudio/issues/5229 to be fixed as the root cause --- .github/workflows/app_build.yml | 2 +- src/openstudio_lib/LocationTabView.cpp | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/app_build.yml b/.github/workflows/app_build.yml index 9494b9e33..c28a388af 100644 --- a/.github/workflows/app_build.yml +++ b/.github/workflows/app_build.yml @@ -502,7 +502,7 @@ jobs: set -x if [ "$RUNNER_OS" == "macOS" ]; then # Avoid "builtin __has_nothrow_assign is deprecated; use __is_nothrow_assignable instead" in boost/1.78 with recent clang - conan install . --output-folder=./build --build=missing -c tools.cmake.cmaketoolchain:generator=Ninja -s compiler.cppstd=20 -s build_type=Release -c tools.build:cxxflags="['-D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION']" + conan install . --output-folder=./build --build=missing -c tools.cmake.cmaketoolchain:generator=Ninja -s compiler.cppstd=20 -s build_type=Release -c tools.build:cxxflags="['-D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION', '-Wno-enum-constexpr-conversion']" else conan install . --output-folder=./build --build=missing -c tools.cmake.cmaketoolchain:generator=Ninja -s compiler.cppstd=20 -s build_type=Release fi diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index 282442cdf..eeb739cb8 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -695,7 +695,7 @@ std::vector LocationView::showDesignDaySelectionDialog(const s // key is designDayType + sortedDesignDayPermil, value is names of dds // each cell in the table has a unique key - std::map> designDayMap; + std::map> designDayMap; for (const auto& dd : allDesignDays) { SortableDesignDay sdd(dd); @@ -709,9 +709,9 @@ std::vector LocationView::showDesignDaySelectionDialog(const s sortedDesignDayPermils.insert(sdd.sortablePermil()); QString key = SortableDesignDay::key(sdd.type(), sdd.sortablePermil()); if (!designDayMap.contains(key)) { - designDayMap[key] = QVector(); + designDayMap[key] = std::vector(); } - designDayMap[key].append(dd); + designDayMap[key].push_back(dd); } // main dialog @@ -746,16 +746,19 @@ std::vector LocationView::showDesignDaySelectionDialog(const s QRadioButton* radioButton = new QRadioButton(); allRadioButtons.append(radioButton); if (!designDayMap.contains(key)) { + radioButton->setEnabled(false); radioButton->setCheckable(false); radioButton->setToolTip(QString::number(0) + " " + tr("Design Days")); + radioButton->setProperty("designDayKey", ""); } else { + radioButton->setEnabled(true); radioButton->setCheckable(true); if (!checkedFirst) { radioButton->setChecked(true); checkedFirst = true; } radioButton->setToolTip(QString::number(designDayMap[key].size()) + " " + tr("Design Days")); - radioButton->setProperty("designDays", QVariant::fromValue(designDayMap[key])); + radioButton->setProperty("designDayKey", key); } buttonGroup->addButton(radioButton); gridLayout->addWidget(radioButton, row, column++, Qt::AlignCenter); @@ -768,12 +771,12 @@ std::vector LocationView::showDesignDaySelectionDialog(const s // ok button only imports the checked design days QPushButton* okButton = new QPushButton(tr("Ok"), &dialog); - connect(okButton, &QPushButton::clicked, [&dialog, &result, &allRadioButtons]() { + connect(okButton, &QPushButton::clicked, [&dialog, &result, &allRadioButtons, &designDayMap]() { for (const auto& rb : allRadioButtons) { if (rb->isChecked()) { - QVariant variant = rb->property("designDays"); - if (variant.canConvert>()) { - for (const auto& dd : variant.value>()) { + QString key = rb->property("designDayKey").toString(); + if (!key.isEmpty() && designDayMap.contains(key)) { + for (const auto& dd : designDayMap[key]) { result.push_back(dd); } } From 4f9a7eb9e8de3f3565cbfa473a1eca3c95f3a1c7 Mon Sep 17 00:00:00 2001 From: Dan Macumber Date: Sat, 8 Mar 2025 11:03:14 -0700 Subject: [PATCH 35/44] Hide borders on cells when deleted, update select all check box when objects are deleted --- src/shared_gui_components/OSCellWrapper.cpp | 40 +++++++++++++++---- src/shared_gui_components/OSCellWrapper.hpp | 3 ++ .../OSObjectSelector.cpp | 15 ++++++- 3 files changed, 50 insertions(+), 8 deletions(-) diff --git a/src/shared_gui_components/OSCellWrapper.cpp b/src/shared_gui_components/OSCellWrapper.cpp index ebeb573c2..bc70b8a42 100644 --- a/src/shared_gui_components/OSCellWrapper.cpp +++ b/src/shared_gui_components/OSCellWrapper.cpp @@ -43,6 +43,7 @@ #include #include +#include #include #include #include @@ -63,13 +64,14 @@ OSCellWrapper::OSCellWrapper(OSGridView* gridView, QSharedPointer b m_layout->setSpacing(0); m_layout->setVerticalSpacing(0); m_layout->setHorizontalSpacing(0); - m_layout->setContentsMargins(0, 0, 1, 1); this->setLayout(m_layout); this->setAttribute(Qt::WA_StyledBackground); this->setObjectName("OSCellWrapper"); - setStyleSheet("QWidget#OSCellWrapper { border: none; border-right: 1px solid gray; border-bottom: 1px solid gray; }" - "QWidget#OSCellWrapper[header=\"true\"]{ border: none; border-top: 1px solid black; border-right: 1px solid gray; border-bottom: 1px " + setStyleSheet("QWidget#OSCellWrapper[style=\"01\"] { border: none; border-right: 1px solid gray; border-bottom: 1px solid gray; }" // header = false, visible = true + "QWidget#OSCellWrapper[style=\"00\"] { border: none; border-right: none; border-bottom: none; }" // header = false, visible = false + "QWidget#OSCellWrapper[style=\"11\"]{ border: none; border-top: 1px solid black; border-right: 1px solid gray; border-bottom: 1px " // header = true, visible = true "solid black; }"); + updateStyle(); connect(this, &OSCellWrapper::rowNeedsStyle, objectSelector, &OSObjectSelector::onRowNeedsStyle); } @@ -175,6 +177,8 @@ void OSCellWrapper::setCellProperties(const GridCellLocation& location, const Gr for (auto* holder : m_holders) { holder->setCellProperties(location, info); } + m_visible = info.isVisible(); + updateStyle(); } } @@ -570,10 +574,32 @@ void OSCellWrapper::disconnectModelSignals() { } void OSCellWrapper::makeHeader() { - m_layout->setContentsMargins(0, 1, 1, 1); - setProperty("header", true); - this->style()->unpolish(this); - this->style()->polish(this); + m_header = true; + m_visible = true; + updateStyle(); +} + +void OSCellWrapper::updateStyle() { + // Locked, Focused, Defaulted + std::bitset<3> style; + style[0] = m_header; + style[1] = m_visible; + QString thisStyle = QString::fromStdString(style.to_string()); + + QVariant currentStyle = property("style"); + if (currentStyle.isNull() || currentStyle.toString() != thisStyle) { + if (m_header) { + m_layout->setContentsMargins(0, 1, 1, 1); + } else if (m_visible) { + m_layout->setContentsMargins(0, 0, 1, 1); + } else { + m_layout->setContentsMargins(0, 0, 0, 0); + } + + this->setProperty("style", thisStyle); + this->style()->unpolish(this); + this->style()->polish(this); + } } void OSCellWrapper::onRemoveWorkspaceObject(const WorkspaceObject& object, const openstudio::IddObjectType& iddObjectType, diff --git a/src/shared_gui_components/OSCellWrapper.hpp b/src/shared_gui_components/OSCellWrapper.hpp index a58ae6cce..dbef423fb 100644 --- a/src/shared_gui_components/OSCellWrapper.hpp +++ b/src/shared_gui_components/OSCellWrapper.hpp @@ -75,6 +75,7 @@ class OSCellWrapper : public QWidget void connectModelSignals(); void disconnectModelSignals(); void makeHeader(); + void updateStyle(); OSGridView* m_gridView; QGridLayout* m_layout; @@ -86,6 +87,8 @@ class OSCellWrapper : public QWidget int m_column = 0; bool m_hasSubRows = false; int m_refreshCount = 0; + bool m_header = false; + bool m_visible = true; // only has these members if not a header cell boost::optional m_modelObject; diff --git a/src/shared_gui_components/OSObjectSelector.cpp b/src/shared_gui_components/OSObjectSelector.cpp index c30661b3d..b078b4254 100644 --- a/src/shared_gui_components/OSObjectSelector.cpp +++ b/src/shared_gui_components/OSObjectSelector.cpp @@ -279,16 +279,29 @@ void OSObjectSelector::setObjectRemoved(const openstudio::Handle& handle) { const PropertyChange visible = ChangeToFalse; const PropertyChange selected = ChangeToFalse; const PropertyChange locked = ChangeToTrue; + int numSelected = 0; + int numSelectable = 0; for (auto* const location : m_selectorCellLocations) { GridCellInfo* info = getGridCellInfo(location); - if ((info != nullptr) && info->modelObject && info->modelObject->handle() == handle) { + if (info == nullptr) { + continue; + } + if (info->modelObject && info->modelObject->handle() == handle) { if (location->subrow) { setSubrowProperties(location->gridRow, location->subrow.get(), visible, selected, locked); } else { setRowProperties(location->gridRow, visible, selected, locked); } + } else { + if (info->isSelected()) { + ++numSelected; + } + if (info->isSelectable()) { + ++numSelectable; + } } } + emit gridRowSelectionChanged(numSelected, numSelectable); } //bool OSObjectSelector::containsObject(const openstudio::model::ModelObject& t_obj) const { From 12907edffa3d72673546a1de6ea558bce95fc65c Mon Sep 17 00:00:00 2001 From: Dan Macumber Date: Sat, 8 Mar 2025 11:07:06 -0700 Subject: [PATCH 36/44] Clang format --- src/shared_gui_components/OSCellWrapper.cpp | 9 +++++---- translations/OpenStudioApp_ar.ts | 16 ++++++++-------- translations/OpenStudioApp_ca.ts | 16 ++++++++-------- translations/OpenStudioApp_de.ts | 16 ++++++++-------- translations/OpenStudioApp_el.ts | 16 ++++++++-------- translations/OpenStudioApp_es.ts | 16 ++++++++-------- translations/OpenStudioApp_fa.ts | 16 ++++++++-------- translations/OpenStudioApp_fr.ts | 16 ++++++++-------- translations/OpenStudioApp_he.ts | 16 ++++++++-------- translations/OpenStudioApp_hi.ts | 16 ++++++++-------- translations/OpenStudioApp_it.ts | 16 ++++++++-------- translations/OpenStudioApp_ja.ts | 16 ++++++++-------- translations/OpenStudioApp_pl.ts | 16 ++++++++-------- translations/OpenStudioApp_vi.ts | 16 ++++++++-------- translations/OpenStudioApp_zh_CN.ts | 16 ++++++++-------- 15 files changed, 117 insertions(+), 116 deletions(-) diff --git a/src/shared_gui_components/OSCellWrapper.cpp b/src/shared_gui_components/OSCellWrapper.cpp index bc70b8a42..86dc4c24c 100644 --- a/src/shared_gui_components/OSCellWrapper.cpp +++ b/src/shared_gui_components/OSCellWrapper.cpp @@ -67,10 +67,11 @@ OSCellWrapper::OSCellWrapper(OSGridView* gridView, QSharedPointer b this->setLayout(m_layout); this->setAttribute(Qt::WA_StyledBackground); this->setObjectName("OSCellWrapper"); - setStyleSheet("QWidget#OSCellWrapper[style=\"01\"] { border: none; border-right: 1px solid gray; border-bottom: 1px solid gray; }" // header = false, visible = true - "QWidget#OSCellWrapper[style=\"00\"] { border: none; border-right: none; border-bottom: none; }" // header = false, visible = false - "QWidget#OSCellWrapper[style=\"11\"]{ border: none; border-top: 1px solid black; border-right: 1px solid gray; border-bottom: 1px " // header = true, visible = true - "solid black; }"); + setStyleSheet( + "QWidget#OSCellWrapper[style=\"01\"] { border: none; border-right: 1px solid gray; border-bottom: 1px solid gray; }" // header = false, visible = true + "QWidget#OSCellWrapper[style=\"00\"] { border: none; border-right: none; border-bottom: none; }" // header = false, visible = false + "QWidget#OSCellWrapper[style=\"11\"]{ border: none; border-top: 1px solid black; border-right: 1px solid gray; border-bottom: 1px " // header = true, visible = true + "solid black; }"); updateStyle(); connect(this, &OSCellWrapper::rowNeedsStyle, objectSelector, &OSObjectSelector::onRowNeedsStyle); diff --git a/translations/OpenStudioApp_ar.ts b/translations/OpenStudioApp_ar.ts index 223567b90..ceb78c591 100644 --- a/translations/OpenStudioApp_ar.ts +++ b/translations/OpenStudioApp_ar.ts @@ -384,8 +384,8 @@ Zone - - + + Design Days @@ -426,32 +426,32 @@ Zone - + Ok - + Cancel - + Import all - + Open DDY File - + No Design Days in DDY File - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. diff --git a/translations/OpenStudioApp_ca.ts b/translations/OpenStudioApp_ca.ts index cf06d604b..f7f5f9ddf 100644 --- a/translations/OpenStudioApp_ca.ts +++ b/translations/OpenStudioApp_ca.ts @@ -388,8 +388,8 @@ Zona - - + + Design Days Dies de Disseny @@ -430,32 +430,32 @@ Zona Error al Definir el Fitxer Climàtic a - + Ok - + Cancel Cancel·lar - + Import all - + Open DDY File Obrir Fitxer DDY - + No Design Days in DDY File No hi ha Dies de Disseny al fitxer DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Aquest fitxer DDY no conté cap dia de disseny vàlid. Comproveu el fitxer DDY. diff --git a/translations/OpenStudioApp_de.ts b/translations/OpenStudioApp_de.ts index e03cc0341..0b2909930 100644 --- a/translations/OpenStudioApp_de.ts +++ b/translations/OpenStudioApp_de.ts @@ -393,8 +393,8 @@ Zone - - + + Design Days Auslegungstage @@ -435,32 +435,32 @@ Zone Wetterdatei konnte nicht geladen werden als - + Ok - + Cancel Abbrechen - + Import all - + Open DDY File DDY Datei öffnen - + No Design Days in DDY File Keine Auslegungstage in DDY Datei vorhanden - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Die DDY Datei beinhaltet keine gültigen Auslegungstage. Überprüfen Sie die DDY Datei auf Fehler. diff --git a/translations/OpenStudioApp_el.ts b/translations/OpenStudioApp_el.ts index ab092c041..8ee9937d6 100644 --- a/translations/OpenStudioApp_el.ts +++ b/translations/OpenStudioApp_el.ts @@ -386,8 +386,8 @@ Zone - - + + Design Days Ημέρες σχεδιασμού/αξιολόγησης @@ -428,32 +428,32 @@ Zone Αποτυχία ορισμού αρχείου καιρού σε - + Ok - + Cancel Ακύρωση - + Import all - + Open DDY File Άνοιγμα αρχείου DDY - + No Design Days in DDY File Δεν υπάρχουν ημέρες αξιολόγησης στο αρχείο DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Αυτό το αρχείο DDY δεν περιέχει έγκυρες ημέρες σχεδιασμού/αξιολόγησης. Ελέγξτε το ίδιο το αρχείο DDY για σφάλματα ή παραλείψεις. diff --git a/translations/OpenStudioApp_es.ts b/translations/OpenStudioApp_es.ts index 173680f1c..bb4672c4f 100644 --- a/translations/OpenStudioApp_es.ts +++ b/translations/OpenStudioApp_es.ts @@ -387,8 +387,8 @@ Zone - - + + Design Days Dias de Diseño @@ -429,32 +429,32 @@ Zone Error al Especificar el Archivo de Clima a - + Ok - + Cancel Cancelar - + Import all - + Open DDY File Abrir Archivo DDY - + No Design Days in DDY File No hay Dias de Diseño en el Archivo DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Este Archivo DDY no contiene dias de diseño válidos. Revise el Archivo DDY en busca de errores u omisiones. diff --git a/translations/OpenStudioApp_fa.ts b/translations/OpenStudioApp_fa.ts index c2342dc3e..56836ebcf 100644 --- a/translations/OpenStudioApp_fa.ts +++ b/translations/OpenStudioApp_fa.ts @@ -386,8 +386,8 @@ Zone - - + + Design Days روزهای طراحی @@ -428,32 +428,32 @@ Zone ناموفق در تنظیم فایل آب و هوایی برای - + Ok - + Cancel لغو - + Import all - + Open DDY File باز کردن فایل DDY - + No Design Days in DDY File در فایل DDY روزهای طراحی وجود ندارد - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. در فایل DDY روزهای طراحی معتبر وجود ندارد. diff --git a/translations/OpenStudioApp_fr.ts b/translations/OpenStudioApp_fr.ts index 8bedc2118..287b0d1f2 100644 --- a/translations/OpenStudioApp_fr.ts +++ b/translations/OpenStudioApp_fr.ts @@ -386,8 +386,8 @@ Zone - - + + Design Days Jours de dimensionnement @@ -428,32 +428,32 @@ Zone Impossible d'attribuer le fichier météo suivant : - + Ok - + Cancel Annuler - + Import all - + Open DDY File Ouvrir fichier DDY - + No Design Days in DDY File Aucun jours de dimensionnement dans le fichier DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Ce fichier DDY ne contient aucun jours de dimensionnement valides. Vérifiez le fichier DDY. diff --git a/translations/OpenStudioApp_he.ts b/translations/OpenStudioApp_he.ts index bd8df8b3d..4e928795c 100644 --- a/translations/OpenStudioApp_he.ts +++ b/translations/OpenStudioApp_he.ts @@ -384,8 +384,8 @@ Zone - - + + Design Days ימי תכנון @@ -426,32 +426,32 @@ Zone לא ניתן להקצות את הקובץ אקלימי הבא: - + Ok - + Cancel ביטול - + Import all - + Open DDY File פתח קובץ DDY - + No Design Days in DDY File אין ימי תכנון בקובץ DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. קובץ DDY זה אינו מכיל ימי תכנון תקפים. בדוק את קובץ ה-DDY עצמו עבור שגיאות או השמטות. diff --git a/translations/OpenStudioApp_hi.ts b/translations/OpenStudioApp_hi.ts index cf8809b13..987174fad 100644 --- a/translations/OpenStudioApp_hi.ts +++ b/translations/OpenStudioApp_hi.ts @@ -385,8 +385,8 @@ Zone - - + + Design Days डिजाइन के दिन @@ -427,32 +427,32 @@ Zone निम्लिखित मौसम फ़ाइल सेट करने में विफल - + Ok - + Cancel रद्द करें - + Import all - + Open DDY File डीडीवाई फ़ाइल खोलें - + No Design Days in DDY File डीडीवाई फ़ाइल में कोई डिज़ाइन दिवस नहीं - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. इस डीडीवाई फ़ाइल में कोई मान्य डिज़ाइन दिवस नहीं है। त्रुटियों या चूक के लिए स्वयं डीडीवाई फ़ाइल की जाँच करें. diff --git a/translations/OpenStudioApp_it.ts b/translations/OpenStudioApp_it.ts index 6a4dc4fd4..fcb26ba82 100644 --- a/translations/OpenStudioApp_it.ts +++ b/translations/OpenStudioApp_it.ts @@ -387,8 +387,8 @@ Entità - - + + Design Days Giorni di Simulazione @@ -429,32 +429,32 @@ Entità Errore Nell' Allocazione Del Weather File - + Ok - + Cancel Annulla - + Import all - + Open DDY File Apri File DDY - + No Design Days in DDY File Nessun Giorno Impostato Nel File DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Questo File DDY non contiene alcun giorno valido. Controlla il File DDY per errori od omissioni. diff --git a/translations/OpenStudioApp_ja.ts b/translations/OpenStudioApp_ja.ts index fe21096fb..a15361672 100644 --- a/translations/OpenStudioApp_ja.ts +++ b/translations/OpenStudioApp_ja.ts @@ -387,8 +387,8 @@ Zone - - + + Design Days 気象条件 @@ -429,32 +429,32 @@ Zone 気象データの選択に失敗しました - + Ok - + Cancel キャンセル - + Import all - + Open DDY File DDYファイルを開く - + No Design Days in DDY File DDYファイルに気象条件がありません - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. DDYファイルに有効な気象条件がありません。ファイルにエラーや欠損がないか確認してください。 diff --git a/translations/OpenStudioApp_pl.ts b/translations/OpenStudioApp_pl.ts index baaa1d63a..661653c21 100644 --- a/translations/OpenStudioApp_pl.ts +++ b/translations/OpenStudioApp_pl.ts @@ -387,8 +387,8 @@ Pomieszczenie - - + + Design Days Dni projektowe @@ -429,32 +429,32 @@ Pomieszczenie Nie udało się ustawić pliku pogody na - + Ok - + Cancel Anuluj - + Import all - + Open DDY File - + No Design Days in DDY File Brak dni projektowych w pliku DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Ten plik DDY nie zawiera poprawnych dni projektowych. Sprawdź plik DDY pod kątem błędów. diff --git a/translations/OpenStudioApp_vi.ts b/translations/OpenStudioApp_vi.ts index 482efdb5a..6bb9c5767 100644 --- a/translations/OpenStudioApp_vi.ts +++ b/translations/OpenStudioApp_vi.ts @@ -384,8 +384,8 @@ Zone - - + + Design Days Ngày thiết kế @@ -426,32 +426,32 @@ Zone Lỗi khi thiết lập file thời tiết tới - + Ok - + Cancel Huỷ - + Import all - + Open DDY File Mở file DDY - + No Design Days in DDY File Không có Ngày thiết kế trong file DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. File DDY này không chứa dữ liệu đúng cho ngày thiết kế. Kiểm tra file DDY để soát lỗi. diff --git a/translations/OpenStudioApp_zh_CN.ts b/translations/OpenStudioApp_zh_CN.ts index d8db324ca..77d153b66 100644 --- a/translations/OpenStudioApp_zh_CN.ts +++ b/translations/OpenStudioApp_zh_CN.ts @@ -387,8 +387,8 @@ Zone - - + + Design Days 设计日 @@ -429,32 +429,32 @@ Zone 设置气候文件失败 - + Ok - + Cancel 取消 - + Import all - + Open DDY File 打开DDY文件 - + No Design Days in DDY File DDY不含设计日 - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. 这个DDY文件不含任何设计日。请检查这个DDY文件是否有误。 From 2a38bfc93796a0004710a604e0111170dcfe7024 Mon Sep 17 00:00:00 2001 From: Dan Macumber Date: Sat, 8 Mar 2025 20:36:03 -0700 Subject: [PATCH 37/44] Fixing bug in style which prevented lines from being drawn --- src/shared_gui_components/OSCellWrapper.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/shared_gui_components/OSCellWrapper.cpp b/src/shared_gui_components/OSCellWrapper.cpp index 86dc4c24c..b315eae94 100644 --- a/src/shared_gui_components/OSCellWrapper.cpp +++ b/src/shared_gui_components/OSCellWrapper.cpp @@ -68,9 +68,9 @@ OSCellWrapper::OSCellWrapper(OSGridView* gridView, QSharedPointer b this->setAttribute(Qt::WA_StyledBackground); this->setObjectName("OSCellWrapper"); setStyleSheet( - "QWidget#OSCellWrapper[style=\"01\"] { border: none; border-right: 1px solid gray; border-bottom: 1px solid gray; }" // header = false, visible = true - "QWidget#OSCellWrapper[style=\"00\"] { border: none; border-right: none; border-bottom: none; }" // header = false, visible = false - "QWidget#OSCellWrapper[style=\"11\"]{ border: none; border-top: 1px solid black; border-right: 1px solid gray; border-bottom: 1px " // header = true, visible = true + "QWidget#OSCellWrapper[style=\"10\"] { border: none; border-right: 1px solid gray; border-bottom: 1px solid gray; }" // visible = true, header = false + "QWidget#OSCellWrapper[style=\"00\"] { border: none; border-right: none; border-bottom: none; }" // visible = false, header = false + "QWidget#OSCellWrapper[style=\"11\"]{ border: none; border-top: 1px solid black; border-right: 1px solid gray; border-bottom: 1px " // visible = true, header = true "solid black; }"); updateStyle(); @@ -582,7 +582,7 @@ void OSCellWrapper::makeHeader() { void OSCellWrapper::updateStyle() { // Locked, Focused, Defaulted - std::bitset<3> style; + std::bitset<2> style; style[0] = m_header; style[1] = m_visible; QString thisStyle = QString::fromStdString(style.to_string()); From e97930d265d14ce35b664351f6790d4b4bf2b7df Mon Sep 17 00:00:00 2001 From: Dan Macumber Date: Sat, 8 Mar 2025 20:46:56 -0700 Subject: [PATCH 38/44] Update all checkbox when adding new objects too --- src/shared_gui_components/OSObjectSelector.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/shared_gui_components/OSObjectSelector.cpp b/src/shared_gui_components/OSObjectSelector.cpp index b078b4254..3808879a0 100644 --- a/src/shared_gui_components/OSObjectSelector.cpp +++ b/src/shared_gui_components/OSObjectSelector.cpp @@ -273,6 +273,22 @@ void OSObjectSelector::addObject(const boost::optional& t_ob } m_gridCellLocationToInfoMap.insert(std::make_pair(location, info)); + + int numSelected = 0; + int numSelectable = 0; + for (const auto& location : m_selectorCellLocations) { + GridCellInfo* info = getGridCellInfo(location); + if (info){ + if (info->isSelected()) { + ++numSelected; + } + if (info->isSelectable()) { + ++numSelectable; + } + } + } + + emit gridRowSelectionChanged(numSelected, numSelectable); } void OSObjectSelector::setObjectRemoved(const openstudio::Handle& handle) { From 4b1544f0412415c3d61e4f5407928cd8520a8f19 Mon Sep 17 00:00:00 2001 From: Dan Macumber Date: Sat, 8 Mar 2025 20:47:25 -0700 Subject: [PATCH 39/44] Clang format --- src/shared_gui_components/OSObjectSelector.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared_gui_components/OSObjectSelector.cpp b/src/shared_gui_components/OSObjectSelector.cpp index 3808879a0..f03588a0a 100644 --- a/src/shared_gui_components/OSObjectSelector.cpp +++ b/src/shared_gui_components/OSObjectSelector.cpp @@ -278,7 +278,7 @@ void OSObjectSelector::addObject(const boost::optional& t_ob int numSelectable = 0; for (const auto& location : m_selectorCellLocations) { GridCellInfo* info = getGridCellInfo(location); - if (info){ + if (info) { if (info->isSelected()) { ++numSelected; } From 20acd2f67765d1b6e10350cbbf90d0f0fa08b493 Mon Sep 17 00:00:00 2001 From: Dan Macumber Date: Thu, 3 Jul 2025 16:13:42 -0600 Subject: [PATCH 40/44] Final tweaks --- src/openstudio_lib/LocationTabView.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index eeb739cb8..bd3ccb13b 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -770,7 +770,7 @@ std::vector LocationView::showDesignDaySelectionDialog(const s int rowCount = gridLayout->rowCount(); // ok button only imports the checked design days - QPushButton* okButton = new QPushButton(tr("Ok"), &dialog); + QPushButton* okButton = new QPushButton(tr("OK"), &dialog); connect(okButton, &QPushButton::clicked, [&dialog, &result, &allRadioButtons, &designDayMap]() { for (const auto& rb : allRadioButtons) { if (rb->isChecked()) { @@ -789,7 +789,7 @@ std::vector LocationView::showDesignDaySelectionDialog(const s QPushButton* cancelButton = new QPushButton(tr("Cancel"), &dialog); connect(cancelButton, &QPushButton::clicked, &dialog, &QDialog::reject); - // import all imports everythig + // import all imports everything QPushButton* importAllButton = new QPushButton(tr("Import all"), &dialog); connect(importAllButton, &QPushButton::clicked, [&dialog, &result, &allDesignDays]() { result = allDesignDays; From 8f8f89d68a0816e1af83ec35433af4c8fcd204f8 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 4 Jul 2025 10:56:20 +0200 Subject: [PATCH 41/44] Remove useless allocator, use concretemodelobjects + use auto to avoid repeating type --- src/openstudio_lib/LocationTabView.cpp | 21 +++++++++++---------- src/openstudio_lib/LocationTabView.hpp | 3 +-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index bd3ccb13b..00fe21542 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -676,7 +676,7 @@ void LocationView::onWeatherFileBtnClicked() { * from a provided list of all available design days which are * heatingPercentages "99.6%", "99%" * and coolingPercentages "2%", "1%", "0.4%" - * + * * . The dialog includes options for selecting heating * and cooling design days based on predefined percentages. The user can choose to import all design days, * select specific ones, or cancel the operation. @@ -727,7 +727,7 @@ std::vector LocationView::showDesignDaySelectionDialog(const s int row = 0; int column = 1; for (const auto& sddp : sortedDesignDayPermils) { - QLabel* header = new QLabel(SortableDesignDay::permilToQString(sddp) + "%"); + auto* header = new QLabel(SortableDesignDay::permilToQString(sddp) + "%"); gridLayout->addWidget(header, row, column++, Qt::AlignCenter); } @@ -737,13 +737,13 @@ std::vector LocationView::showDesignDaySelectionDialog(const s for (const auto& ddt : designDayTypes) { column = 0; bool checkedFirst = false; - QLabel* label = new QLabel(ddt); + auto* label = new QLabel(ddt); gridLayout->addWidget(label, row, column++, Qt::AlignCenter); - QButtonGroup* buttonGroup = new QButtonGroup(gridLayout); + auto* buttonGroup = new QButtonGroup(gridLayout); for (const auto& sddp : sortedDesignDayPermils) { QString key = SortableDesignDay::key(ddt, sddp); - QRadioButton* radioButton = new QRadioButton(); + auto* radioButton = new QRadioButton(); allRadioButtons.append(radioButton); if (!designDayMap.contains(key)) { radioButton->setEnabled(false); @@ -770,7 +770,7 @@ std::vector LocationView::showDesignDaySelectionDialog(const s int rowCount = gridLayout->rowCount(); // ok button only imports the checked design days - QPushButton* okButton = new QPushButton(tr("OK"), &dialog); + auto* okButton = new QPushButton(tr("OK"), &dialog); connect(okButton, &QPushButton::clicked, [&dialog, &result, &allRadioButtons, &designDayMap]() { for (const auto& rb : allRadioButtons) { if (rb->isChecked()) { @@ -786,18 +786,18 @@ std::vector LocationView::showDesignDaySelectionDialog(const s }); // cancel button imports nothing - QPushButton* cancelButton = new QPushButton(tr("Cancel"), &dialog); + auto* cancelButton = new QPushButton(tr("Cancel"), &dialog); connect(cancelButton, &QPushButton::clicked, &dialog, &QDialog::reject); // import all imports everything - QPushButton* importAllButton = new QPushButton(tr("Import all"), &dialog); + auto* importAllButton = new QPushButton(tr("Import all"), &dialog); connect(importAllButton, &QPushButton::clicked, [&dialog, &result, &allDesignDays]() { result = allDesignDays; dialog.accept(); }); // add all the buttons in a button box - QDialogButtonBox* buttonBox = new QDialogButtonBox(Qt::Horizontal); + auto* buttonBox = new QDialogButtonBox(Qt::Horizontal); buttonBox->addButton(okButton, QDialogButtonBox::AcceptRole); buttonBox->addButton(cancelButton, QDialogButtonBox::RejectRole); buttonBox->addButton(importAllButton, QDialogButtonBox::YesRole); @@ -850,7 +850,8 @@ void LocationView::onDesignDayBtnClicked() { //m_model.insertObjects(ddyModel.objects()); - std::vector designDaysToInsert = showDesignDaySelectionDialog(ddyModel.getModelObjects()); + std::vector designDaysToInsert = + showDesignDaySelectionDialog(ddyModel.getConcreteModelObjects()); // Remove design days from ddyModel that are not in designDaysToInsert for (auto& designDay : ddyModel.getConcreteModelObjects()) { diff --git a/src/openstudio_lib/LocationTabView.hpp b/src/openstudio_lib/LocationTabView.hpp index e865c41f5..4aea184d8 100644 --- a/src/openstudio_lib/LocationTabView.hpp +++ b/src/openstudio_lib/LocationTabView.hpp @@ -150,8 +150,7 @@ class LocationView : public QWidget void onWeatherFileBtnClicked(); - std::vector - showDesignDaySelectionDialog(const std::vector>& allNonAnnual); + std::vector showDesignDaySelectionDialog(const std::vector& allDesignDays); void onDesignDayBtnClicked(); From 58bc75daab706d742be0dd3a4b9da5cb40d00dbd Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 4 Jul 2025 11:53:11 +0200 Subject: [PATCH 42/44] Style the QDialog and add high level metrics for number of DDYs. --- src/openstudio_lib/LocationTabView.cpp | 37 +++++++++++++++++++++----- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/src/openstudio_lib/LocationTabView.cpp b/src/openstudio_lib/LocationTabView.cpp index 00fe21542..a9051b6e8 100644 --- a/src/openstudio_lib/LocationTabView.cpp +++ b/src/openstudio_lib/LocationTabView.cpp @@ -696,11 +696,13 @@ std::vector LocationView::showDesignDaySelectionDialog(const s // key is designDayType + sortedDesignDayPermil, value is names of dds // each cell in the table has a unique key std::map> designDayMap; + size_t numUnknownType = 0; for (const auto& dd : allDesignDays) { SortableDesignDay sdd(dd); // skip Design Days with unknown type if (sdd.type().isEmpty()) { + ++numUnknownType; continue; } @@ -715,30 +717,53 @@ std::vector LocationView::showDesignDaySelectionDialog(const s } // main dialog - QDialog dialog(this); + QDialog dialog(this, Qt::Dialog | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); dialog.setWindowTitle(QCoreApplication::translate("LocationView", "Import Design Days")); + dialog.setMinimumWidth(450); dialog.setModal(true); - QVBoxLayout* layout = new QVBoxLayout(&dialog); + dialog.setStyleSheet("background: #E6E6E6;"); + + auto* layout = new QVBoxLayout(&dialog); // grid view for the design day types and permils to import - QGridLayout* gridLayout = new QGridLayout(); + auto* gridLayout = new QGridLayout(); // first row is for headers int row = 0; + + auto msg = tr("There are %1 Design Days available for import").arg(QString::number(allDesignDays.size())); + if (numUnknownType > 0) { + msg += tr(", %1 of which are unknown type").arg(QString::number(numUnknownType)); + } + + auto* numInfo = new QLabel(msg); + gridLayout->addWidget(numInfo, row, 0, 1, -1, Qt::AlignCenter); + + ++row; int column = 1; for (const auto& sddp : sortedDesignDayPermils) { auto* header = new QLabel(SortableDesignDay::permilToQString(sddp) + "%"); + header->setStyleSheet("font-weight: bold;"); gridLayout->addWidget(header, row, column++, Qt::AlignCenter); } // one row for each design day type - row = 1; + ++row; QVector allRadioButtons; for (const auto& ddt : designDayTypes) { column = 0; bool checkedFirst = false; - auto* label = new QLabel(ddt); - gridLayout->addWidget(label, row, column++, Qt::AlignCenter); + auto* rowHeader = new QLabel(); + if (ddt == "Heating") { + rowHeader->setText(tr("Heating")); + rowHeader->setStyleSheet("font-weight: bold; color: #EF1C21;"); + } else if (ddt == "Cooling") { + rowHeader->setText(tr("Cooling")); + rowHeader->setStyleSheet("font-weight: bold; color: #0071BD;"); + } else { + rowHeader->setText(ddt); + } + gridLayout->addWidget(rowHeader, row, column++, Qt::AlignCenter); auto* buttonGroup = new QButtonGroup(gridLayout); for (const auto& sddp : sortedDesignDayPermils) { From bdf03a41031cb58e2c089336447b28a64cf3b5bc Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 4 Jul 2025 11:53:44 +0200 Subject: [PATCH 43/44] Run lupdate and complete the french translation --- translations/OpenStudioApp_ar.ts | 40 ++++++-- translations/OpenStudioApp_ca.ts | 40 ++++++-- translations/OpenStudioApp_de.ts | 40 ++++++-- translations/OpenStudioApp_el.ts | 40 ++++++-- translations/OpenStudioApp_es.ts | 40 ++++++-- translations/OpenStudioApp_fa.ts | 40 ++++++-- translations/OpenStudioApp_fr.ts | 146 ++++++++++++++++------------ translations/OpenStudioApp_he.ts | 40 ++++++-- translations/OpenStudioApp_hi.ts | 40 ++++++-- translations/OpenStudioApp_it.ts | 40 ++++++-- translations/OpenStudioApp_ja.ts | 40 ++++++-- translations/OpenStudioApp_pl.ts | 40 ++++++-- translations/OpenStudioApp_vi.ts | 40 ++++++-- translations/OpenStudioApp_zh_CN.ts | 40 ++++++-- 14 files changed, 475 insertions(+), 191 deletions(-) diff --git a/translations/OpenStudioApp_ar.ts b/translations/OpenStudioApp_ar.ts index ceb78c591..23c02b418 100644 --- a/translations/OpenStudioApp_ar.ts +++ b/translations/OpenStudioApp_ar.ts @@ -57,7 +57,7 @@ LocationView - + Import Design Days @@ -384,8 +384,8 @@ Zone - - + + Design Days @@ -426,32 +426,52 @@ Zone - - Ok + + There are <span style="font-weight:bold;">%1</span> Design Days available for import - + + , %1 of which are unknown type + + + + + Heating + + + + + Cooling + + + + + OK + + + + Cancel - + Import all - + Open DDY File - + No Design Days in DDY File - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. diff --git a/translations/OpenStudioApp_ca.ts b/translations/OpenStudioApp_ca.ts index f7f5f9ddf..c5724b1c1 100644 --- a/translations/OpenStudioApp_ca.ts +++ b/translations/OpenStudioApp_ca.ts @@ -58,7 +58,7 @@ LocationView - + Import Design Days @@ -388,8 +388,8 @@ Zona - - + + Design Days Dies de Disseny @@ -430,32 +430,52 @@ Zona Error al Definir el Fitxer Climàtic a - - Ok + + There are <span style="font-weight:bold;">%1</span> Design Days available for import - + + , %1 of which are unknown type + + + + + Heating + + + + + Cooling + + + + + OK + OK + + + Cancel Cancel·lar - + Import all - + Open DDY File Obrir Fitxer DDY - + No Design Days in DDY File No hi ha Dies de Disseny al fitxer DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Aquest fitxer DDY no conté cap dia de disseny vàlid. Comproveu el fitxer DDY. diff --git a/translations/OpenStudioApp_de.ts b/translations/OpenStudioApp_de.ts index 0b2909930..7de666add 100644 --- a/translations/OpenStudioApp_de.ts +++ b/translations/OpenStudioApp_de.ts @@ -57,7 +57,7 @@ LocationView - + Import Design Days @@ -393,8 +393,8 @@ Zone - - + + Design Days Auslegungstage @@ -435,32 +435,52 @@ Zone Wetterdatei konnte nicht geladen werden als - - Ok + + There are <span style="font-weight:bold;">%1</span> Design Days available for import - + + , %1 of which are unknown type + + + + + Heating + + + + + Cooling + + + + + OK + OK + + + Cancel Abbrechen - + Import all - + Open DDY File DDY Datei öffnen - + No Design Days in DDY File Keine Auslegungstage in DDY Datei vorhanden - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Die DDY Datei beinhaltet keine gültigen Auslegungstage. Überprüfen Sie die DDY Datei auf Fehler. diff --git a/translations/OpenStudioApp_el.ts b/translations/OpenStudioApp_el.ts index 8ee9937d6..403a8a771 100644 --- a/translations/OpenStudioApp_el.ts +++ b/translations/OpenStudioApp_el.ts @@ -57,7 +57,7 @@ LocationView - + Import Design Days @@ -386,8 +386,8 @@ Zone - - + + Design Days Ημέρες σχεδιασμού/αξιολόγησης @@ -428,32 +428,52 @@ Zone Αποτυχία ορισμού αρχείου καιρού σε - - Ok + + There are <span style="font-weight:bold;">%1</span> Design Days available for import - + + , %1 of which are unknown type + + + + + Heating + + + + + Cooling + + + + + OK + Εντάξει + + + Cancel Ακύρωση - + Import all - + Open DDY File Άνοιγμα αρχείου DDY - + No Design Days in DDY File Δεν υπάρχουν ημέρες αξιολόγησης στο αρχείο DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Αυτό το αρχείο DDY δεν περιέχει έγκυρες ημέρες σχεδιασμού/αξιολόγησης. Ελέγξτε το ίδιο το αρχείο DDY για σφάλματα ή παραλείψεις. diff --git a/translations/OpenStudioApp_es.ts b/translations/OpenStudioApp_es.ts index bb4672c4f..4a1004ee6 100644 --- a/translations/OpenStudioApp_es.ts +++ b/translations/OpenStudioApp_es.ts @@ -58,7 +58,7 @@ LocationView - + Import Design Days @@ -387,8 +387,8 @@ Zone - - + + Design Days Dias de Diseño @@ -429,32 +429,52 @@ Zone Error al Especificar el Archivo de Clima a - - Ok + + There are <span style="font-weight:bold;">%1</span> Design Days available for import - + + , %1 of which are unknown type + + + + + Heating + + + + + Cooling + + + + + OK + OK + + + Cancel Cancelar - + Import all - + Open DDY File Abrir Archivo DDY - + No Design Days in DDY File No hay Dias de Diseño en el Archivo DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Este Archivo DDY no contiene dias de diseño válidos. Revise el Archivo DDY en busca de errores u omisiones. diff --git a/translations/OpenStudioApp_fa.ts b/translations/OpenStudioApp_fa.ts index 56836ebcf..a49a0d86f 100644 --- a/translations/OpenStudioApp_fa.ts +++ b/translations/OpenStudioApp_fa.ts @@ -57,7 +57,7 @@ LocationView - + Import Design Days @@ -386,8 +386,8 @@ Zone - - + + Design Days روزهای طراحی @@ -428,32 +428,52 @@ Zone ناموفق در تنظیم فایل آب و هوایی برای - - Ok + + There are <span style="font-weight:bold;">%1</span> Design Days available for import - + + , %1 of which are unknown type + + + + + Heating + + + + + Cooling + + + + + OK + تایید + + + Cancel لغو - + Import all - + Open DDY File باز کردن فایل DDY - + No Design Days in DDY File در فایل DDY روزهای طراحی وجود ندارد - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. در فایل DDY روزهای طراحی معتبر وجود ندارد. diff --git a/translations/OpenStudioApp_fr.ts b/translations/OpenStudioApp_fr.ts index 287b0d1f2..d25fd8ab6 100644 --- a/translations/OpenStudioApp_fr.ts +++ b/translations/OpenStudioApp_fr.ts @@ -57,9 +57,9 @@ LocationView - + Import Design Days - + Importer des jours de dimensionnement @@ -386,8 +386,8 @@ Zone - - + + Design Days Jours de dimensionnement @@ -428,32 +428,56 @@ Zone Impossible d'attribuer le fichier météo suivant : - + + There are <span style="font-weight:bold;">%1</span> Design Days available for import + Il y a <span style="font-weight:bold;">%1</span> Jours de dimensionnement importables + + + + , %1 of which are unknown type + , dont %1 de type inconnu + + + + Heating + Chauffage + + + + Cooling + Refroidissement + + + + OK + OK + + Ok - + Ok - + Cancel - Annuler + Annuler - + Import all - + Importer tous - + Open DDY File Ouvrir fichier DDY - + No Design Days in DDY File Aucun jours de dimensionnement dans le fichier DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Ce fichier DDY ne contient aucun jours de dimensionnement valides. Vérifiez le fichier DDY. @@ -616,17 +640,17 @@ Zone E&xamples - + E&xemples &Example Model - + Modèle d'&Exemple Shoebox Model - + Boîte à chaussure @@ -735,17 +759,17 @@ Zone Vietnamese - + Vietnamien Japanese - + Japonais German - + Allemand @@ -760,12 +784,12 @@ Zone &Use Classic CLI - + &Utiliser le Classic CLI &Display Additional Proprerties - + &Montrer les propriétés additionnelles @@ -810,12 +834,12 @@ Zone Allow Analytics - + Autoriser la télémétrie Debug Webgl - + Déboggage WebGL @@ -844,12 +868,12 @@ Si vous voulez voir l'Application OpenStudio traduite dans la langue de vot Allow Analytics - + Autoriser la télémétrie Allow OpenStudio Coalition to collect anonymous usage statistics to help improve the OpenStudio Application? See the <a href="https://openstudiocoalition.org/about/privacy_policy/">privacy policy</a> for more information. - + Voulez-vous autoriser OpenStucio Coalition à collecter des statistiques d'utilisation anonymes pour améliorer l'Application OpenStudio ? Consultez la <a href="https://openstudiocoalition.org/about/privacy_policy/">politique de confidentialité</a> pour plus d'informations. @@ -858,23 +882,24 @@ Si vous voulez voir l'Application OpenStudio traduite dans la langue de vot Measures Updated - + Mesures mises à jour All measures are up-to-date. - + Toutes les mesures sont à jour. measures have been updated on BCL compared to your local BCL directory. - + mesures ont été mises à jour sur la BCL par rapport à votre dossier BCL local. + Would you like update them? - + Voulez-vous les mettre à jour ? @@ -941,7 +966,7 @@ Si vous voulez voir l'Application OpenStudio traduite dans la langue de vot Failed to start the Measure Manager. Would you like to keep waiting? - + Impossible de démarrer le Manager de Measure. Voulez-vous attendre ? @@ -1170,12 +1195,12 @@ Si vous voulez voir l'Application OpenStudio traduite dans la langue de vot Measure Manager has crashed. Do you want to retry? - + Impossible de démarrer le Manager de Measure. Voulez-vous réessayer ? Measure Manager Crashed - + Le Manager des Mesures a planté About @@ -1229,7 +1254,7 @@ Les scrips Ruby sont désormais obsolètes et ont été remplacés par les Mesur ' is not writable. Adjust the file permissions - ' n'est pas accessible en écriture. Ajustez les droits. + ' n'est pas accessible en écriture. Ajustez les droits @@ -1294,7 +1319,6 @@ Souhaitez-vous redémarrer maintenant ? Would you like to Restore library paths to default values or Open the library settings to change them manually? - Souhaitez-vous restaurer les chemins de bibliothèque aux valeurs par défaut ou ouvrir les paramètres de la bibliothèque pour les modifier manuellement ? @@ -1303,17 +1327,17 @@ Souhaitez-vous restaurer les chemins de bibliothèque aux valeurs par défaut ou Open Directory - + Ouvrir le dossier Open Read File - + Ouvrir le fichier de lecture Select Save File - + Selectionnez le fichier à écrire @@ -1329,12 +1353,12 @@ Souhaitez-vous restaurer les chemins de bibliothèque aux valeurs par défaut ou onRunProcessErrored: Simulation failed to run, QProcess::ProcessError: - + onRunProcessErrored: La simulation a échouée, QProcess::ProcessError : Simulation failed to run, with exit code - + La simulation a échouée, avec le code d'erreur @@ -1342,17 +1366,17 @@ Souhaitez-vous restaurer les chemins de bibliothèque aux valeurs par défaut ou CSV Files(*.csv) - + CSV Files(*.csv) Select External File - + Sélectionner Fichier Externe All files (*.*);;CSV Files(*.csv);;TSV Files(*.tsv) - + All files (*.*);;CSV Files(*.csv);;TSV Files(*.tsv) @@ -1360,7 +1384,7 @@ Souhaitez-vous restaurer les chemins de bibliothèque aux valeurs par défaut ou Drop Space Infiltration - + Déposer Infiltration pour le Space @@ -1428,7 +1452,7 @@ Souhaitez-vous restaurer les chemins de bibliothèque aux valeurs par défaut ou Debug Webgl - + Déboggage WebGL @@ -1441,87 +1465,87 @@ Souhaitez-vous restaurer les chemins de bibliothèque aux valeurs par défaut ou Select Output Variables - + Sélectionner les variables de sortie All - All + Tous Enabled - + Activées Disabled - + Désactivées Filter Variables - + Filtrer les variables Use Regex - + Utiliser une expression régulière Update Visible Variables - + Mettre à jour les variables visibles All On - + Activer toutes All Off - + Désactiver toutes Apply Frequency - + Appliquer la fréquence Detailed - + Detaillée (Detailed) Timestep - + Pas de temps (Timestep) Hourly - + Horaire (Hourly) Daily - + Journalier (Daily) Monthly - + Mensuel (Monthly) RunPeriod - + Période de simulation (RunPeriod) Annual - + Annuelle (Annual) diff --git a/translations/OpenStudioApp_he.ts b/translations/OpenStudioApp_he.ts index 4e928795c..66ac9d9bc 100644 --- a/translations/OpenStudioApp_he.ts +++ b/translations/OpenStudioApp_he.ts @@ -57,7 +57,7 @@ LocationView - + Import Design Days @@ -384,8 +384,8 @@ Zone - - + + Design Days ימי תכנון @@ -426,32 +426,52 @@ Zone לא ניתן להקצות את הקובץ אקלימי הבא: - - Ok + + There are <span style="font-weight:bold;">%1</span> Design Days available for import - + + , %1 of which are unknown type + + + + + Heating + + + + + Cooling + + + + + OK + אוקיי + + + Cancel ביטול - + Import all - + Open DDY File פתח קובץ DDY - + No Design Days in DDY File אין ימי תכנון בקובץ DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. קובץ DDY זה אינו מכיל ימי תכנון תקפים. בדוק את קובץ ה-DDY עצמו עבור שגיאות או השמטות. diff --git a/translations/OpenStudioApp_hi.ts b/translations/OpenStudioApp_hi.ts index 987174fad..b2247088a 100644 --- a/translations/OpenStudioApp_hi.ts +++ b/translations/OpenStudioApp_hi.ts @@ -57,7 +57,7 @@ LocationView - + Import Design Days @@ -385,8 +385,8 @@ Zone - - + + Design Days डिजाइन के दिन @@ -427,32 +427,52 @@ Zone निम्लिखित मौसम फ़ाइल सेट करने में विफल - - Ok + + There are <span style="font-weight:bold;">%1</span> Design Days available for import - + + , %1 of which are unknown type + + + + + Heating + + + + + Cooling + + + + + OK + ठीक है + + + Cancel रद्द करें - + Import all - + Open DDY File डीडीवाई फ़ाइल खोलें - + No Design Days in DDY File डीडीवाई फ़ाइल में कोई डिज़ाइन दिवस नहीं - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. इस डीडीवाई फ़ाइल में कोई मान्य डिज़ाइन दिवस नहीं है। त्रुटियों या चूक के लिए स्वयं डीडीवाई फ़ाइल की जाँच करें. diff --git a/translations/OpenStudioApp_it.ts b/translations/OpenStudioApp_it.ts index fcb26ba82..0b1905b8b 100644 --- a/translations/OpenStudioApp_it.ts +++ b/translations/OpenStudioApp_it.ts @@ -57,7 +57,7 @@ LocationView - + Import Design Days @@ -387,8 +387,8 @@ Entità - - + + Design Days Giorni di Simulazione @@ -429,32 +429,52 @@ Entità Errore Nell' Allocazione Del Weather File - - Ok + + There are <span style="font-weight:bold;">%1</span> Design Days available for import - + + , %1 of which are unknown type + + + + + Heating + + + + + Cooling + + + + + OK + OK + + + Cancel Annulla - + Import all - + Open DDY File Apri File DDY - + No Design Days in DDY File Nessun Giorno Impostato Nel File DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Questo File DDY non contiene alcun giorno valido. Controlla il File DDY per errori od omissioni. diff --git a/translations/OpenStudioApp_ja.ts b/translations/OpenStudioApp_ja.ts index a15361672..021394026 100644 --- a/translations/OpenStudioApp_ja.ts +++ b/translations/OpenStudioApp_ja.ts @@ -57,7 +57,7 @@ LocationView - + Import Design Days @@ -387,8 +387,8 @@ Zone - - + + Design Days 気象条件 @@ -429,32 +429,52 @@ Zone 気象データの選択に失敗しました - - Ok + + There are <span style="font-weight:bold;">%1</span> Design Days available for import - + + , %1 of which are unknown type + + + + + Heating + + + + + Cooling + + + + + OK + OK + + + Cancel キャンセル - + Import all - + Open DDY File DDYファイルを開く - + No Design Days in DDY File DDYファイルに気象条件がありません - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. DDYファイルに有効な気象条件がありません。ファイルにエラーや欠損がないか確認してください。 diff --git a/translations/OpenStudioApp_pl.ts b/translations/OpenStudioApp_pl.ts index 661653c21..db509dc98 100644 --- a/translations/OpenStudioApp_pl.ts +++ b/translations/OpenStudioApp_pl.ts @@ -57,7 +57,7 @@ LocationView - + Import Design Days @@ -387,8 +387,8 @@ Pomieszczenie - - + + Design Days Dni projektowe @@ -429,32 +429,52 @@ Pomieszczenie Nie udało się ustawić pliku pogody na - - Ok + + There are <span style="font-weight:bold;">%1</span> Design Days available for import - + + , %1 of which are unknown type + + + + + Heating + + + + + Cooling + + + + + OK + Dobrze + + + Cancel Anuluj - + Import all - + Open DDY File - + No Design Days in DDY File Brak dni projektowych w pliku DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. Ten plik DDY nie zawiera poprawnych dni projektowych. Sprawdź plik DDY pod kątem błędów. diff --git a/translations/OpenStudioApp_vi.ts b/translations/OpenStudioApp_vi.ts index 6bb9c5767..b4342122c 100644 --- a/translations/OpenStudioApp_vi.ts +++ b/translations/OpenStudioApp_vi.ts @@ -57,7 +57,7 @@ LocationView - + Import Design Days @@ -384,8 +384,8 @@ Zone - - + + Design Days Ngày thiết kế @@ -426,32 +426,52 @@ Zone Lỗi khi thiết lập file thời tiết tới - - Ok + + There are <span style="font-weight:bold;">%1</span> Design Days available for import - + + , %1 of which are unknown type + + + + + Heating + + + + + Cooling + + + + + OK + OK + + + Cancel Huỷ - + Import all - + Open DDY File Mở file DDY - + No Design Days in DDY File Không có Ngày thiết kế trong file DDY - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. File DDY này không chứa dữ liệu đúng cho ngày thiết kế. Kiểm tra file DDY để soát lỗi. diff --git a/translations/OpenStudioApp_zh_CN.ts b/translations/OpenStudioApp_zh_CN.ts index 77d153b66..3f0b4c83c 100644 --- a/translations/OpenStudioApp_zh_CN.ts +++ b/translations/OpenStudioApp_zh_CN.ts @@ -57,7 +57,7 @@ LocationView - + Import Design Days @@ -387,8 +387,8 @@ Zone - - + + Design Days 设计日 @@ -429,32 +429,52 @@ Zone 设置气候文件失败 - - Ok + + There are <span style="font-weight:bold;">%1</span> Design Days available for import - + + , %1 of which are unknown type + + + + + Heating + + + + + Cooling + + + + + OK + + + + Cancel 取消 - + Import all - + Open DDY File 打开DDY文件 - + No Design Days in DDY File DDY不含设计日 - + This DDY file does not contain any valid design days. Check the DDY file itself for errors or omissions. 这个DDY文件不含任何设计日。请检查这个DDY文件是否有误。 From 219b9bd9c61fc2f2e855ddec2a725da51221186e Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 4 Jul 2025 11:57:00 +0200 Subject: [PATCH 44/44] Run lupdate with --no-obsolete flag to prune old entries /opt/Qt/6.5.2/gcc_64/bin/lupdate -project /media/DataExt4/Software/Others/OSApp-build-release/translations/.lupdate/translations_interface_project.json -no-obsolete --- translations/OpenStudioApp_fr.ts | 115 ------------------------------- 1 file changed, 115 deletions(-) diff --git a/translations/OpenStudioApp_fr.ts b/translations/OpenStudioApp_fr.ts index d25fd8ab6..a23443fb0 100644 --- a/translations/OpenStudioApp_fr.ts +++ b/translations/OpenStudioApp_fr.ts @@ -452,10 +452,6 @@ Zone OK OK - - Ok - Ok - Cancel @@ -482,85 +478,6 @@ Zone Ce fichier DDY ne contient aucun jours de dimensionnement valides. Vérifiez le fichier DDY. - - openstudio::LostCloudConnectionDialog - - Requirements for cloud: - Conditions requises pour l'utilisation du Cloud : - - - Internet Connection: - Connexion Internet : - - - yes - Oui - - - no - Non - - - Cloud Log-in: - Authentification Cloud : - - - accepted - Acceptée - - - denied - Refusée - - - Cloud Connection: - Connexion au Cloud : - - - reconnected - reconnectée - - - unable to reconnect. - Impossible de se reconnecter. - - - Remember that cloud charges may currently be accruing. - Souvenez-vous que des frais d'utilisations du Cloud peuvent s'accumuler. - - - Options to correct the problem: - Options pour corriger le problème : - - - Try Again Later. - Essayez plus tard. - - - Verify your computer's internet connection then click "Lost Cloud Connection" to recover the lost cloud session. - Vérifiez la connexion Internet de votre ordinateur, puis cliquez sur "Connexion cloud perdue" pour récupérer la session cloud perdue. - - - Or - Ou - - - Stop Cloud. - Arrêter le Cloud. - - - Disconnect from cloud. This option will make the failed cloud session unavailable to Pat. Any data that has not been downloaded to Pat will be lost. Use the AWS Console to verify that the Amazon service have been completely shutdown. - Déconnecter le Cloud. Cet option entraînera que la session cloud abortée sera inaccessible pour PAT. Toute donnée non téléchargée dans PAT sera perdue. Utilisez la cement onsole AWS pour vérifier que le service Amazon a été complètement arrêté. - - - Launch AWS Console. - Lancer la console AWS. - - - Use the AWS Console to diagnose Amazon services. You may still attempt to recover the lost cloud session. - Utiliser la console AWS pour diagnoster les services Amazon. Vous pourrez toujours tenter de récupérer la session cloud perdue. - - openstudio::MainMenu @@ -707,10 +624,6 @@ Zone French Français - - Arabic - Arabe - Spanish @@ -861,10 +774,6 @@ Si vous voulez voir l'Application OpenStudio traduite dans la langue de vot openstudio::MainWindow - - Restart required - Redémarrage requis - Allow Analytics @@ -947,10 +856,6 @@ Si vous voulez voir l'Application OpenStudio traduite dans la langue de vot Select My Measures Directory Selectionner le dossier "My Measures" - - Online BCL - Online BCL - openstudio::OpenStudioApp @@ -959,10 +864,6 @@ Si vous voulez voir l'Application OpenStudio traduite dans la langue de vot Timeout Délai expiré - - Failed to start the Measure Manager. Would you like to retry? - Impossible de démarrer le Manager de Measure Voulez-vous réessayer ? - Failed to start the Measure Manager. Would you like to keep waiting? @@ -1202,10 +1103,6 @@ Si vous voulez voir l'Application OpenStudio traduite dans la langue de vot Measure Manager Crashed Le Manager des Mesures a planté - - About - A propos de - Failed to load model @@ -1274,18 +1171,6 @@ Voulez-vous créer un nouveau modèle ? Are you sure you want to revert to the last saved version? Etes-vous sûr de vouloir revenir à la dernière version sauvegardée ? - - Measure Manager has crashed, attempting to restart - - - Le Manager des Mesures a planté, tentative de redémarrage - - - - - Measure Manager has crashed - Le Manager des Mesures a planté - Restart required