@@ -638,7 +638,8 @@ std::string toLowerCase(const std::string& str) {
638
638
return lowerStr;
639
639
}
640
640
641
- std::vector<model::DesignDay> filterDesignDays (const std::vector<model::DesignDay>& designDays, const std::string& dayType, const std::string& percentage, const std::string& humidityConditionType = " " ) {
641
+ std::vector<model::DesignDay> filterDesignDays (const std::vector<model::DesignDay>& designDays, const std::string& dayType,
642
+ const std::string& percentage, const std::string& humidityConditionType = " " ) {
642
643
std::vector<model::DesignDay> filteredDesignDays;
643
644
644
645
std::copy_if (designDays.begin (), designDays.end (), std::back_inserter (filteredDesignDays), [&](const model::DesignDay& designDay) {
@@ -648,9 +649,10 @@ std::vector<model::DesignDay> filterDesignDays(const std::vector<model::DesignDa
648
649
return false ;
649
650
}
650
651
651
- bool matchesHumidityConditionType = humidityConditionType.empty () || toLowerCase (designDay.humidityConditionType ()) == toLowerCase (humidityConditionType);
652
- bool matchesPercentage = QString::fromStdString (name.get ()).contains (QString::fromStdString (percentage)) ||
653
- (percentage == " 0.4%" && QString::fromStdString (name.get ()).contains (" .4%" ));
652
+ bool matchesHumidityConditionType =
653
+ humidityConditionType.empty () || toLowerCase (designDay.humidityConditionType ()) == toLowerCase (humidityConditionType);
654
+ bool matchesPercentage = QString::fromStdString (name.get ()).contains (QString::fromStdString (percentage))
655
+ || (percentage == " 0.4%" && QString::fromStdString (name.get ()).contains (" .4%" ));
654
656
return name && matchesPercentage && toLowerCase (designDay.dayType ()) == toLowerCase (dayType) && matchesHumidityConditionType;
655
657
});
656
658
@@ -663,17 +665,17 @@ std::vector<model::DesignDay> LocationView::showDesignDaySelectionDialog(const s
663
665
QDialog dialog (this );
664
666
dialog.setWindowTitle (QCoreApplication::translate (" LocationView" , " Import Design Days" ));
665
667
666
- QGridLayout * layout = new QGridLayout (&dialog);
668
+ QGridLayout* layout = new QGridLayout (&dialog);
667
669
668
670
// Define row labels and percentages
669
671
QStringList rowLabels = {" Heating" , " Cooling" };
670
672
std::vector<std::string> heatingPercentages = {" 99.6%" , " 99%" };
671
673
std::vector<std::string> coolingPercentages = {" 2%" , " 1%" , " 0.4%" };
672
674
673
675
// Ok and Cancel buttons
674
- QPushButton * okButton = new QPushButton (tr (" Ok" ), &dialog);
675
- QPushButton * cancelButton = new QPushButton (tr (" Cancel" ), &dialog);
676
- QPushButton * importAllButton = new QPushButton (tr (" Skip\n selection\n import\n all DDYs" ), &dialog);
676
+ QPushButton* okButton = new QPushButton (tr (" Ok" ), &dialog);
677
+ QPushButton* cancelButton = new QPushButton (tr (" Cancel" ), &dialog);
678
+ QPushButton* importAllButton = new QPushButton (tr (" Skip\n selection\n import\n all DDYs" ), &dialog);
677
679
678
680
// Set the same size for all buttons
679
681
okButton->setSizePolicy (QSizePolicy::Minimum, QSizePolicy::Preferred);
@@ -688,7 +690,7 @@ std::vector<model::DesignDay> LocationView::showDesignDaySelectionDialog(const s
688
690
okButton->setMinimumSize (cancelButton->sizeHint ());
689
691
importAllButton->setMinimumSize (cancelButton->sizeHint ());
690
692
691
- okButton->setEnabled (false ); // Initially disable the Ok button
693
+ okButton->setEnabled (false ); // Initially disable the Ok button
692
694
693
695
connect (okButton, &QPushButton::clicked, &dialog, &QDialog::accept);
694
696
connect (cancelButton, &QPushButton::clicked, &dialog, &QDialog::reject);
@@ -699,16 +701,16 @@ std::vector<model::DesignDay> LocationView::showDesignDaySelectionDialog(const s
699
701
700
702
// Populate table for Heating and Cooling
701
703
for (int row = 0 ; row < rowLabels.size (); ++row) {
702
- QLabel * rowLabel = new QLabel (rowLabels[row]);
704
+ QLabel* rowLabel = new QLabel (rowLabels[row]);
703
705
layout->addWidget (rowLabel, row * 2 + 1 , 0 , Qt::AlignCenter);
704
706
705
707
const auto & percentages = (row == 0 ) ? heatingPercentages : coolingPercentages;
706
708
707
709
for (int col = 0 ; col < percentages.size (); ++col) {
708
- QLabel * percentageLabel = new QLabel (QString::fromStdString (percentages[col]));
710
+ QLabel* percentageLabel = new QLabel (QString::fromStdString (percentages[col]));
709
711
layout->addWidget (percentageLabel, row * 2 , col + 1 , Qt::AlignCenter);
710
712
711
- QCheckBox * checkBox = new QCheckBox ();
713
+ QCheckBox* checkBox = new QCheckBox ();
712
714
layout->addWidget (checkBox, row * 2 + 1 , col + 1 , Qt::AlignCenter);
713
715
714
716
connect (checkBox, &QCheckBox::toggled, [=, &designDaysToInsert](bool checked) {
@@ -733,7 +735,7 @@ std::vector<model::DesignDay> LocationView::showDesignDaySelectionDialog(const s
733
735
}
734
736
735
737
// Add a spacer item to add more space between the checkboxes and the buttons
736
- QSpacerItem * spacer = new QSpacerItem (20 , 40 , QSizePolicy::Minimum, QSizePolicy::Expanding);
738
+ QSpacerItem* spacer = new QSpacerItem (20 , 40 , QSizePolicy::Minimum, QSizePolicy::Expanding);
737
739
layout->addItem (spacer, rowLabels.size () * 2 + 2 , 0 , 1 , 5 );
738
740
739
741
dialog.setLayout (layout);
@@ -749,7 +751,6 @@ std::vector<model::DesignDay> LocationView::showDesignDaySelectionDialog(const s
749
751
750
752
void LocationView::onDesignDayBtnClicked () {
751
753
QString fileTypes (" Files (*.ddy)" );
752
- std::vector<openstudio::model::DesignDay> designDaysToInsert;
753
754
754
755
QString lastPath = m_lastDdyPathOpened;
755
756
if (lastPath.isEmpty () && m_lastEpwPathOpened.isEmpty ()) {
@@ -767,12 +768,12 @@ void LocationView::onDesignDayBtnClicked() {
767
768
if (ddyIdfFile) {
768
769
769
770
openstudio::Workspace ddyWorkspace (StrictnessLevel::None, IddFileType::EnergyPlus);
770
-
771
+
771
772
for (const IdfObject& idfObject : ddyIdfFile->objects ()) {
772
773
IddObjectType iddObjectType = idfObject.iddObject ().type ();
773
- if ((iddObjectType == IddObjectType::SizingPeriod_DesignDay) || (iddObjectType == IddObjectType::SizingPeriod_WeatherFileDays)
774
+ if ((iddObjectType == IddObjectType::SizingPeriod_DesignDay) || (iddObjectType == IddObjectType::SizingPeriod_WeatherFileDays)
774
775
|| (iddObjectType == IddObjectType::SizingPeriod_WeatherFileConditionType)) {
775
- ddyWorkspace.addObject (idfObject);
776
+ ddyWorkspace.addObject (idfObject);
776
777
}
777
778
}
778
779
@@ -782,7 +783,6 @@ void LocationView::onDesignDayBtnClicked() {
782
783
// Use a heuristic based on the ddy files provided by EnergyPlus
783
784
// Filter out the days that are not helpful.
784
785
if (!ddyModel.objects ().empty ()) {
785
-
786
786
787
787
// Evan note: do not remove existing design days
788
788
// for (model::SizingPeriod sizingPeriod : m_model.getModelObjects<model::SizingPeriod>()){
0 commit comments