From deb4076813bc15317d293a3de18c34f42122ca5f Mon Sep 17 00:00:00 2001 From: Michal Dengusiak Date: Mon, 5 Jan 2026 15:05:12 +0100 Subject: [PATCH 01/15] Create spdx-check.yml --- .github/workflows/spdx-check.yml | 45 ++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/spdx-check.yml diff --git a/.github/workflows/spdx-check.yml b/.github/workflows/spdx-check.yml new file mode 100644 index 000000000..d950747c5 --- /dev/null +++ b/.github/workflows/spdx-check.yml @@ -0,0 +1,45 @@ +name: SPDX + Copyright header check + +on: + pull_request: + +jobs: + spdx: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check header in changed .cs files + run: | + set -e + BASE="${{ github.event.pull_request.base.sha }}" + HEAD="${{ github.event.pull_request.head.sha }}" + + FILES=$(git diff --name-only "$BASE" "$HEAD" -- '*.cs' || true) + + if [ -z "$FILES" ]; then + echo "No C# files changed." + exit 0 + fi + + MISSING="" + for f in $FILES; do + HEADBLOCK=$(head -n 6 "$f") + + echo "$HEADBLOCK" | grep -q "// SPDX-License-Identifier: LGPL-3.0-or-later" || MISSING="$MISSING $f" + echo "$HEADBLOCK" | grep -q "// Copyright (c) 2020–2025 Michal Dengusiak & Jakub Ziolkowski and contributors" || MISSING="$MISSING $f" + done + + if [ -n "$MISSING" ]; then + echo "❌ Missing required header in:" + for f in $MISSING; do echo " - $f"; done + echo "" + echo "Each changed .cs file must start with:" + echo "// SPDX-License-Identifier: LGPL-3.0-or-later" + echo "// Copyright (c) 2020–2025 Michal Dengusiak & Jakub Ziolkowski and contributors" + exit 1 + fi + + echo "✅ SPDX + copyright headers OK." From 5f5e94eef991b0bfb0732622e6a00b29435480d6 Mon Sep 17 00:00:00 2001 From: Michal Dengusiak Date: Mon, 5 Jan 2026 15:34:58 +0100 Subject: [PATCH 02/15] Update spdx-check.yml --- .github/workflows/spdx-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spdx-check.yml b/.github/workflows/spdx-check.yml index d950747c5..9b1f74e1c 100644 --- a/.github/workflows/spdx-check.yml +++ b/.github/workflows/spdx-check.yml @@ -38,7 +38,7 @@ jobs: echo "" echo "Each changed .cs file must start with:" echo "// SPDX-License-Identifier: LGPL-3.0-or-later" - echo "// Copyright (c) 2020–2025 Michal Dengusiak & Jakub Ziolkowski and contributors" + echo "// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors" exit 1 fi From 49e1d059e32814d1a2a20b3b56b078f8378f8147 Mon Sep 17 00:00:00 2001 From: Michal Dengusiak Date: Mon, 5 Jan 2026 16:37:24 +0100 Subject: [PATCH 03/15] Update spdx-check.yml --- .github/workflows/spdx-check.yml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/spdx-check.yml b/.github/workflows/spdx-check.yml index 9b1f74e1c..ae0dd3f28 100644 --- a/.github/workflows/spdx-check.yml +++ b/.github/workflows/spdx-check.yml @@ -16,30 +16,32 @@ jobs: set -e BASE="${{ github.event.pull_request.base.sha }}" HEAD="${{ github.event.pull_request.head.sha }}" - + FILES=$(git diff --name-only "$BASE" "$HEAD" -- '*.cs' || true) - + if [ -z "$FILES" ]; then echo "No C# files changed." exit 0 fi - + MISSING="" for f in $FILES; do - HEADBLOCK=$(head -n 6 "$f") - - echo "$HEADBLOCK" | grep -q "// SPDX-License-Identifier: LGPL-3.0-or-later" || MISSING="$MISSING $f" - echo "$HEADBLOCK" | grep -q "// Copyright (c) 2020–2025 Michal Dengusiak & Jakub Ziolkowski and contributors" || MISSING="$MISSING $f" + HEADBLOCK=$(head -n 20 "$f") + + echo "$HEADBLOCK" | grep -qE "^// SPDX-License-Identifier: LGPL-3\.0-or-later" || MISSING="$MISSING $f" + echo "$HEADBLOCK" | grep -qE "^// Copyright \(c\) 2020[-–]2026 Michal Dengusiak & Jakub Ziolkowski and contributors" || MISSING="$MISSING $f" done - + if [ -n "$MISSING" ]; then echo "❌ Missing required header in:" for f in $MISSING; do echo " - $f"; done echo "" echo "Each changed .cs file must start with:" echo "// SPDX-License-Identifier: LGPL-3.0-or-later" - echo "// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors" + echo "// Copyright (c) 2020-2026 Michal Dengusiak & Jakub Ziolkowski and contributors" exit 1 fi - - echo "✅ SPDX + copyright headers OK." + + echo "✅ Headers OK." + + \ No newline at end of file From db346e7a25f55d7402f421812d3750f725a330d1 Mon Sep 17 00:00:00 2001 From: Michal Dengusiak Date: Mon, 5 Jan 2026 16:59:16 +0100 Subject: [PATCH 04/15] Update spdx-check.yml --- .github/workflows/spdx-check.yml | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/spdx-check.yml b/.github/workflows/spdx-check.yml index ae0dd3f28..7d5d53cce 100644 --- a/.github/workflows/spdx-check.yml +++ b/.github/workflows/spdx-check.yml @@ -10,8 +10,8 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - - name: Check header in changed .cs files + + - name: Check SPDX + copyright header in changed .cs files run: | set -e BASE="${{ github.event.pull_request.base.sha }}" @@ -26,22 +26,27 @@ jobs: MISSING="" for f in $FILES; do - HEADBLOCK=$(head -n 20 "$f") + # Read first 30 lines, strip BOM, normalize CRLF + HEADBLOCK=$(head -n 30 "$f" | sed '1s/^\xEF\xBB\xBF//' | tr -d '\r') + + echo "$HEADBLOCK" | grep -q "SPDX-License-Identifier: LGPL-3.0-or-later" \ + || MISSING="$MISSING $f" - echo "$HEADBLOCK" | grep -qE "^// SPDX-License-Identifier: LGPL-3\.0-or-later" || MISSING="$MISSING $f" - echo "$HEADBLOCK" | grep -qE "^// Copyright \(c\) 2020[-–]2026 Michal Dengusiak & Jakub Ziolkowski and contributors" || MISSING="$MISSING $f" + echo "$HEADBLOCK" | grep -q "Copyright (c) 2020[-–]2026 Michal Dengusiak & Jakub Ziolkowski and contributors" \ + || MISSING="$MISSING $f" done if [ -n "$MISSING" ]; then echo "❌ Missing required header in:" for f in $MISSING; do echo " - $f"; done echo "" - echo "Each changed .cs file must start with:" + echo "Each changed .cs file must contain:" echo "// SPDX-License-Identifier: LGPL-3.0-or-later" echo "// Copyright (c) 2020-2026 Michal Dengusiak & Jakub Ziolkowski and contributors" exit 1 fi - echo "✅ Headers OK." + echo "✅ SPDX + copyright headers OK." - \ No newline at end of file + + \ No newline at end of file From ae0378e0a9c239259faec2d864e6170b68ef0179 Mon Sep 17 00:00:00 2001 From: Michal Dengusiak Date: Mon, 5 Jan 2026 17:11:28 +0100 Subject: [PATCH 05/15] Update spdx-check.yml --- .github/workflows/spdx-check.yml | 98 +++++++++++++++----------------- 1 file changed, 46 insertions(+), 52 deletions(-) diff --git a/.github/workflows/spdx-check.yml b/.github/workflows/spdx-check.yml index 7d5d53cce..99db48331 100644 --- a/.github/workflows/spdx-check.yml +++ b/.github/workflows/spdx-check.yml @@ -1,52 +1,46 @@ -name: SPDX + Copyright header check - -on: - pull_request: - -jobs: - spdx: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Check SPDX + copyright header in changed .cs files - run: | - set -e - BASE="${{ github.event.pull_request.base.sha }}" - HEAD="${{ github.event.pull_request.head.sha }}" - - FILES=$(git diff --name-only "$BASE" "$HEAD" -- '*.cs' || true) - - if [ -z "$FILES" ]; then - echo "No C# files changed." - exit 0 - fi - - MISSING="" - for f in $FILES; do - # Read first 30 lines, strip BOM, normalize CRLF - HEADBLOCK=$(head -n 30 "$f" | sed '1s/^\xEF\xBB\xBF//' | tr -d '\r') - - echo "$HEADBLOCK" | grep -q "SPDX-License-Identifier: LGPL-3.0-or-later" \ - || MISSING="$MISSING $f" - - echo "$HEADBLOCK" | grep -q "Copyright (c) 2020[-–]2026 Michal Dengusiak & Jakub Ziolkowski and contributors" \ - || MISSING="$MISSING $f" - done - - if [ -n "$MISSING" ]; then - echo "❌ Missing required header in:" - for f in $MISSING; do echo " - $f"; done - echo "" - echo "Each changed .cs file must contain:" - echo "// SPDX-License-Identifier: LGPL-3.0-or-later" - echo "// Copyright (c) 2020-2026 Michal Dengusiak & Jakub Ziolkowski and contributors" - exit 1 - fi - - echo "✅ SPDX + copyright headers OK." - - - \ No newline at end of file +- uses: actions/checkout@v4 + with: + fetch-depth: 0 + +- name: Check SPDX + copyright header in changed .cs files + shell: bash + run: | + set -euo pipefail + BASE="${{ github.event.pull_request.base.sha }}" + HEAD="${{ github.event.pull_request.head.sha }}" + + FILES=$(git diff --name-only "$BASE" "$HEAD" -- '*.cs' || true) + + if [ -z "$FILES" ]; then + echo "No C# files changed." + exit 0 + fi + + MISSING="" + while IFS= read -r f; do + echo "Checking: $f" + + # Read from the HEAD commit (not the working tree), normalize CRLF + HEADBLOCK=$(git show "$HEAD:$f" 2>/dev/null | head -n 30 | tr -d '\r' || true) + + if [ -z "$HEADBLOCK" ]; then + echo " Could not read $f from $HEAD (renamed/deleted?)" + MISSING="$MISSING $f" + continue + fi + + echo "$HEADBLOCK" | grep -Fq "SPDX-License-Identifier: LGPL-3.0-or-later" \ + || { echo " Missing SPDX line. First lines were:"; echo "$HEADBLOCK" | sed -n '1,5p'; MISSING="$MISSING $f"; continue; } + + echo "$HEADBLOCK" | grep -Eq "Copyright \(c\) 2020[–-]2026 Michal Dengusiak & Jakub Ziolkowski and contributors" \ + || { echo " Missing copyright line. First lines were:"; echo "$HEADBLOCK" | sed -n '1,5p'; MISSING="$MISSING $f"; continue; } + + done <<< "$FILES" + + if [ -n "$MISSING" ]; then + echo "❌ Missing required header in:" + for f in $MISSING; do echo " - $f"; done + exit 1 + fi + + echo "✅ SPDX + copyright headers OK." From acad525f769571630af90137105f08e406a45d14 Mon Sep 17 00:00:00 2001 From: Michal Dengusiak Date: Mon, 5 Jan 2026 17:15:34 +0100 Subject: [PATCH 06/15] Update spdx-check.yml --- .github/workflows/spdx-check.yml | 37 ++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/.github/workflows/spdx-check.yml b/.github/workflows/spdx-check.yml index 99db48331..cf6429e89 100644 --- a/.github/workflows/spdx-check.yml +++ b/.github/workflows/spdx-check.yml @@ -6,6 +6,7 @@ shell: bash run: | set -euo pipefail + BASE="${{ github.event.pull_request.base.sha }}" HEAD="${{ github.event.pull_request.head.sha }}" @@ -16,31 +17,39 @@ exit 0 fi - MISSING="" + missing=() + + # Regexes: + # - SPDX: exact identifier, but allow spaces + spdx_re='SPDX-License-Identifier:[[:space:]]*LGPL-3\.0-or-later' + # - Copyright: tolerate dash types and spaces, (c) case-insensitive + cr_re='Copyright[[:space:]]*\(c\)[[:space:]]*2020[[:space:]]*[-–—][[:space:]]*2026[[:space:]]*Michal[[:space:]]+Dengusiak[[:space:]]*&[[:space:]]*Jakub[[:space:]]+Ziolkowski[[:space:]]+and[[:space:]]+contributors' + while IFS= read -r f; do echo "Checking: $f" - # Read from the HEAD commit (not the working tree), normalize CRLF - HEADBLOCK=$(git show "$HEAD:$f" 2>/dev/null | head -n 30 | tr -d '\r' || true) + # Read from PR HEAD commit, normalize CRLF, and look at first 80 lines + headblock=$(git show "$HEAD:$f" 2>/dev/null | head -n 80 | tr -d '\r' || true) - if [ -z "$HEADBLOCK" ]; then - echo " Could not read $f from $HEAD (renamed/deleted?)" - MISSING="$MISSING $f" + if [ -z "$headblock" ]; then + echo " Could not read file content from PR head." + missing+=("$f") continue fi - echo "$HEADBLOCK" | grep -Fq "SPDX-License-Identifier: LGPL-3.0-or-later" \ - || { echo " Missing SPDX line. First lines were:"; echo "$HEADBLOCK" | sed -n '1,5p'; MISSING="$MISSING $f"; continue; } - - echo "$HEADBLOCK" | grep -Eq "Copyright \(c\) 2020[–-]2026 Michal Dengusiak & Jakub Ziolkowski and contributors" \ - || { echo " Missing copyright line. First lines were:"; echo "$HEADBLOCK" | sed -n '1,5p'; MISSING="$MISSING $f"; continue; } + echo "$headblock" | grep -Eiq "$spdx_re" || { echo " Missing SPDX line."; missing+=("$f"); continue; } + echo "$headblock" | grep -Eiq "$cr_re" || { echo " Missing copyright line."; missing+=("$f"); continue; } done <<< "$FILES" - if [ -n "$MISSING" ]; then + if [ ${#missing[@]} -ne 0 ]; then echo "❌ Missing required header in:" - for f in $MISSING; do echo " - $f"; done + for f in "${missing[@]}"; do echo " - $f"; done + echo "" + echo "Expected somewhere in first 80 lines:" + echo "// SPDX-License-Identifier: LGPL-3.0-or-later" + echo "// Copyright (c) 2020-2026 Michal Dengusiak & Jakub Ziolkowski and contributors" exit 1 fi - echo "✅ SPDX + copyright headers OK." + echo "✅ Headers OK." From b49edd1c976e4368f3828564091960e16e746499 Mon Sep 17 00:00:00 2001 From: Michal Dengusiak Date: Mon, 5 Jan 2026 17:31:29 +0100 Subject: [PATCH 07/15] Feature/cases (#2) * Create method for AnalyticalModel added (AnalyticalModel_ByWindowSize) * AnalyticalModel_ByApertureByAzimuths implemented * AnalyticalModel_ByApertureConstruction create method implemented * AnalyticalModel AnalyticalModel_ByOpening create method implemented * AnalyticalModel_ByShade create method implemented * AnalyticalModel_ByShade create method implemented for shades * AnalyticalModel_ByVentilation create method added * AnalyticalModel_ByWeatherData create method implemented * Code cleaning * Code reorganization for cases creation * Bug fixes for cases creation methods * Case initial implementation * CaseSelection initial implementation * VentilationCase implemented * CaseSelection implemented for Cases * ApertureCaseSelection implemented * ApertureToPanelRatios initial implementation * Cases class implemented * Create Cases method added * WindowSizeCase updated * FilterSelection implemented * Bug fixes for Case and CaseSelection * ShadeCase renamed to FinShadeCase * ApertureCase initial implementation * ApertureCase updated * ApertureToPanelRatio updated * Update AnalyticalModel.cs * Bug fix for Create AnalyticalModel method * Code cleaning * Headers added * Test update --------- Co-authored-by: Jakub Ziolkowski --- .editorconfig | 3 +- .../Classes/GooAdjacencyCluster.cs | 33 +- .../Classes/GooAirHandlingUnit.cs | 7 +- .../Classes/GooAirMovement.cs | 7 +- .../Classes/GooAnalyticalEquipment.cs | 7 +- .../Classes/GooAnalyticalModel.cs | 17 +- .../Classes/GooAnalyticalObject.cs | 7 +- .../Classes/GooAperture.cs | 33 +- .../Classes/GooApertureConstruction.cs | 9 +- .../Classes/GooApertureConstructionLibrary.cs | 9 +- .../Classes/GooConstruction.cs | 9 +- .../Classes/GooConstructionLayer.cs | 17 +- .../Classes/GooConstructionLibrary.cs | 9 +- .../Classes/GooConstructionManager.cs | 9 +- .../Classes/GooDegreeOfActivity.cs | 7 +- .../Classes/GooDegreeOfActivityLibrary.cs | 9 +- .../Classes/GooDesignDay.cs | 9 +- .../Classes/GooExternalSpace.cs | 9 +- .../Classes/GooFeatureShade.cs | 9 +- .../Classes/GooInternalCondition.cs | 9 +- .../Classes/GooInternalConditionLibrary.cs | 9 +- .../Classes/GooMergeSettings.cs | 9 +- .../Classes/GooOpeningProperties.cs | 9 +- .../Classes/GooPanel.cs | 51 +- .../Classes/GooPlanarBoundary3D.cs | 9 +- .../Classes/GooProfile.cs | 9 +- .../Classes/GooProfileLibrary.cs | 9 +- .../Classes/GooSection.cs | 9 +- .../Classes/GooSpace.cs | 13 +- .../Classes/GooText3D.cs | 9 +- .../Classes/GooTypeMergeSettings.cs | 9 +- .../Classes/New/GooArchitecturalModel.cs | 13 +- .../Classes/New/GooFloorType.cs | 9 +- .../Classes/New/GooHostPartitionType.cs | 9 +- .../Classes/New/GooOpening.cs | 19 +- .../Classes/New/GooOpeningType.cs | 9 +- .../Classes/New/GooPartition.cs | 41 +- .../Classes/New/GooRoofType.cs | 9 +- .../Classes/New/GooWallType.cs | 9 +- .../Component/A_SAMAnalytical.cs | 18 +- .../New/SAMAnalyticalAddAirPartitions.cs | 9 +- .../New/SAMAnalyticalAddMissingMaterials.cs | 9 +- .../New/SAMAnalyticalAddMissingProfiles.cs | 21 +- .../Component/New/SAMAnalyticalAddOpenings.cs | 19 +- .../New/SAMAnalyticalAddOpeningsByAzimuth.cs | 21 +- ...yticalCreateBuildingModelBy2DGeometries.cs | 15 +- ...AMAnalyticalCreateBuildingModelByShells.cs | 17 +- .../SAMAnalyticalCreateHostPartitionType.cs | 14 +- ...lyticalCreateHostPartitionsBy3DGeometry.cs | 11 +- ...AMAnalyticalCreateMaterialLayersByNames.cs | 18 +- ...SAMAnalyticalCreateOpeningsBy3DGeometry.cs | 17 +- .../New/SAMAnalyticalHostPartitionCategory.cs | 9 +- .../SAMAnalyticalUpdateArchitecturalModel.cs | 11 +- .../SAMAnalyticalUpdateHostPartitionType.cs | 17 +- .../New/SAMArchitecturalRelatedObjects.cs | 9 +- .../Component/SAMAnalyticalAddAirPanels.cs | 23 +- .../SAMAnalyticalAddAperturesByAperture.cs | 15 +- .../SAMAnalyticalAddAperturesByAzimuths..cs | 5 +- ...rturesByGeometryAndApertureConstruction.cs | 19 +- ...alAddAperturesByGeometryAndApertureType.cs | 25 +- ...erturesByGeometryAndConstructionManager.cs | 47 +- .../SAMAnalyticalAddAperturesByRatio.cs | 23 +- .../Component/SAMAnalyticalAddFeatureShade.cs | 37 +- .../Component/SAMAnalyticalAddMaterials.cs | 13 +- .../SAMAnalyticalAddMechanicalSystems.cs | 31 +- .../SAMAnalyticalAddMissingMaterials.cs | 11 +- .../SAMAnalyticalAddOpeningProperties.cs | 25 +- ...AMAnalyticalAddOpeningPropertiesByPartO.cs | 27 +- .../Component/SAMAnalyticalAddPanels.cs | 23 +- .../Component/SAMAnalyticalAddResults.cs | 15 +- .../Component/SAMAnalyticalAddSpace.cs | 15 +- .../Component/SAMAnalyticalAddSpacesByBrep.cs | 21 +- .../SAMAnalyticalAddVentilationSystem.cs | 25 +- ...MAnalyticalAddVentilationSystemsByZones.cs | 47 +- .../Component/SAMAnalyticalAdjacentSpaces.cs | 39 +- .../Component/SAMAnalyticalAdjustPanels.cs | 11 +- .../Component/SAMAnalyticalAdjustRoofs.cs | 11 +- .../Component/SAMAnalyticalAirFlow.cs | 13 +- ...lyticalAlignHorizontalPanelByElevations.cs | 19 +- .../Component/SAMAnalyticalAlignPanels.cs | 19 +- ...icalAlignPanelsByLowerAndUpperElevation.cs | 25 +- .../SAMAnalyticalAlignSpaceLocation.cs | 28 +- .../SAMAnalyticalApertureConstructions.cs | 21 +- .../Component/SAMAnalyticalApertureType.cs | 9 +- .../Component/SAMAnalyticalBake.cs | 23 +- .../SAMAnalyticalCalculateDaylightFactor.cs | 23 +- .../SAMAnalyticalCalculateFloorArea.cs | 34 +- ...alyticalCalculateGlazingValueByAperture.cs | 15 +- ...icalCalculateGlazingValueByConstruction.cs | 23 +- .../SAMAnalyticalCalculateSpacePanelArea.cs | 25 +- .../Component/SAMAnalyticalCheck.cs | 15 +- ...nalyticalCopyApertureConstructionLayers.cs | 9 +- .../SAMAnalyticalCopyConstructionLayers.cs | 9 +- .../SAMAnalyticalCreateAdjacencyCluster.cs | 33 +- ...AnalyticalCreateAdjacencyClusterByBreps.cs | 30 +- ...alCreateAdjacencyClusterByBrepsAndNames.cs | 32 +- ...ticalCreateAdjacencyClusterByElevations.cs | 9 +- ...CreateAdjacencyClusterByPanelsAndSpaces.cs | 7 +- ...nalyticalCreateAdjacencyClusterByShells.cs | 9 +- ...CreateAnalyticalModelByAdjacencyCluster.cs | 15 +- ...AnalyticalCreateAnalyticalModelBySpaces.cs | 11 +- ...SAMAnalyticalCreateApertureConstruction.cs | 17 +- ...calCreateApertureConstructionByAperture.cs | 13 +- ...yticalCreateApertureConstructionLibrary.cs | 17 +- ...nalyticalCreateCaseByApertureByAzimuths.cs | 154 +-- ...lyticalCreateCaseByApertureConstruction.cs | 111 +- .../SAMAnalyticalCreateCaseByOpening.cs | 326 +++-- .../SAMAnalyticalCreateCaseByShade.cs | 210 +-- .../SAMAnalyticalCreateCaseByShade1.cs | 108 +- .../SAMAnalyticalCreateCaseByVentilation.cs | 364 +++--- .../SAMAnalyticalCreateCaseByWeather.cs | 134 +- .../SAMAnalyticalCreateCaseByWindowSize.cs | 224 ++-- .../SAMAnalyticalCreateConstruction.cs | 11 +- ...icalCreateConstructionLayersByMaterials.cs | 19 +- ...alyticalCreateConstructionLayersByNames.cs | 21 +- .../SAMAnalyticalCreateConstructionLibrary.cs | 9 +- .../SAMAnalyticalCreateConstructionManager.cs | 23 +- ...reateConstructionManagerByPanelAperture.cs | 27 +- ...calCreateConstructionManagerByPanelType.cs | 21 +- ...icalCreateDegreeOfActivityByTemperature.cs | 11 +- .../SAMAnalyticalCreateDesignExplorer.cs | 13 +- .../SAMAnalyticalCreateFeatureShade.cs | 13 +- .../SAMAnalyticalCreateGasMaterial.cs | 13 +- .../Component/SAMAnalyticalCreateIZAM.cs | 11 +- .../SAMAnalyticalCreateIZAMBySetPoint.cs | 27 +- .../SAMAnalyticalCreateIZAMBySpaces.cs | 13 +- .../SAMAnalyticalCreateInternalCondition.cs | 21 +- ...yticalCreateInternalConditionByProfiles.cs | 65 +- .../Component/SAMAnalyticalCreateLevels.cs | 21 +- .../SAMAnalyticalCreateOpaqueMaterial.cs | 11 +- .../SAMAnalyticalCreatePanelBy3DGeometry.cs | 33 +- ...MAnalyticalCreatePanelByBottomAndHeight.cs | 13 +- .../SAMAnalyticalCreatePanelByPanels.cs | 15 +- .../SAMAnalyticalCreatePanelsByPlane.cs | 13 +- .../SAMAnalyticalCreatePanelsByShell.cs | 17 +- .../SAMAnalyticalCreatePerimeterZones.cs | 39 +- .../SAMAnalyticalCreatePerimeterZones_2.cs | 39 +- .../SAMAnalyticalCreateProfileByBooleans.cs | 13 +- ...lyticalCreateProfileByBooleansAndValues.cs | 11 +- .../SAMAnalyticalCreateProfileByProfiles.cs | 33 +- .../SAMAnalyticalCreateProfileByValues.cs | 21 +- ...SAMAnalyticalCreateProfileByWeatherYear.cs | 13 +- .../Component/SAMAnalyticalCreateShade.cs | 10 +- .../SAMAnalyticalCreateShadeByFeatureShade.cs | 10 +- .../Component/SAMAnalyticalCreateShells.cs | 29 +- .../SAMAnalyticalCreateShellsByElevations.cs | 35 +- ...hellsByElevationsAndAuxiliaryElevations.cs | 29 +- .../Component/SAMAnalyticalCreateSpace.cs | 15 +- .../SAMAnalyticalCreateTransparentMaterial.cs | 11 +- .../SAMAnalyticalCreateZonesByValues.cs | 33 +- ...nalyticalDailyIndoorComfortTemperatures.cs | 25 +- .../Component/SAMAnalyticalDataTree.cs | 9 +- .../Component/SAMAnalyticalDaylightFactor.cs | 15 +- .../SAMAnalyticalDefaultColorByPanelType.cs | 21 +- ...SAMAnalyticalDefaultConstructionManager.cs | 9 +- .../Component/SAMAnalyticalDefaultGasType.cs | 9 +- .../Component/SAMAnalyticalDesignDays.cs | 29 +- ...lyticalDuplicateConstructionByPanelType.cs | 15 +- .../SAMAnalyticalExtendExternalPanels.cs | 15 +- .../SAMAnalyticalExtendPanelByPanels.cs | 9 +- .../SAMAnalyticalExtendPanelByPlane.cs | 9 +- .../Component/SAMAnalyticalExtendPanels.cs | 11 +- .../Component/SAMAnalyticalExternalPanels.cs | 11 +- .../SAMAnalyticalExternalVector3D.cs | 9 +- .../Component/SAMAnalyticalFiles.cs | 21 +- .../SAMAnalyticalFillFloorsAndRoofs.cs | 9 +- .../Component/SAMAnalyticalFilter.cs | 15 +- .../Component/SAMAnalyticalFilterByAzimuth.cs | 55 +- .../SAMAnalyticalFilterByBoundaryType.cs | 15 +- .../SAMAnalyticalFilterByElevation.cs | 25 +- .../SAMAnalyticalFilterByGeometry.cs | 27 +- .../SAMAnalyticalFilterByMaxRectangle3D.cs | 21 +- ...yticalFilterByPanelAreaAndThinnessRatio.cs | 15 +- .../SAMAnalyticalFilterByPanelType.cs | 29 +- .../Component/SAMAnalyticalFilterByPoints.cs | 35 +- .../Component/SAMAnalyticalFilterBySpaces.cs | 21 +- .../SAMAnalyticalFixAdjacencyCluster.cs | 9 +- .../Component/SAMAnalyticalFixNames.cs | 29 +- .../Component/SAMAnalyticalFlipPanel.cs | 9 +- .../Component/SAMAnalyticalGeometry.cs | 15 +- .../SAMAnalyticalGetAdjacentSpaceNames.cs | 13 +- .../Component/SAMAnalyticalGetApertures.cs | 45 +- ...alGetDefaultApertureConstructionLibrary.cs | 9 +- ...alyticalGetDefaultApertureConstructions.cs | 11 +- ...AnalyticalGetDefaultConstructionLibrary.cs | 9 +- .../SAMAnalyticalGetDefaultConstructions.cs | 15 +- ...yticalGetDefaultDegreeOfActivityLibrary.cs | 11 +- .../SAMAnalyticalGetDefaultGasMaterials.cs | 15 +- ...ticalGetDefaultInternalConditionLibrary.cs | 9 +- .../SAMAnalyticalGetDefaultLibrary.cs | 23 +- .../SAMAnalyticalGetDefaultMaterialLibrary.cs | 9 +- .../SAMAnalyticalGetDefaultProfileLibrary.cs | 9 +- ...AMAnalyticalGetDefaultSystemTypeLibrary.cs | 9 +- .../SAMAnalyticalGetExternalMaterials.cs | 17 +- ...AMAnalyticalGetInternalConditionTextMap.cs | 9 +- ...AnalyticalGetInternalConstructionLayers.cs | 9 +- .../SAMAnalyticalGetInternalMaterials.cs | 17 +- .../Component/SAMAnalyticalGetPanels.cs | 49 +- .../SAMAnalyticalGetPanelsByConstruction.cs | 17 +- .../Component/SAMAnalyticalGetSortedKeys.cs | 11 +- .../Component/SAMAnalyticalGetSpaces.cs | 39 +- .../Component/SAMAnalyticalGetSpacesByName.cs | 23 +- .../SAMAnalyticalGetValuesByReference.cs | 25 +- .../Component/SAMAnalyticalGetZonesByName.cs | 21 +- .../Component/SAMAnalyticalGetZonesBySpace.cs | 19 +- .../Component/SAMAnalyticalGrid.cs | 13 +- .../SAMAnalyticalHeatFlowDirection.cs | 9 +- ...HeatTransferCoefficientByDefaultGasType.cs | 11 +- .../SAMAnalyticalHourOfYearToDateTime.cs | 15 +- .../Component/SAMAnalyticalHourlyValues.cs | 13 +- .../Component/SAMAnalyticalInsideSpace.cs | 9 +- ...SAMAnalyticalInternalConditionParameter.cs | 9 +- .../Component/SAMAnalyticalJoinPanels.cs | 23 +- .../SAMAnalyticalJoinSpacesByPanels.cs | 15 +- .../Component/SAMAnalyticalLabelPanel.cs | 19 +- .../Component/SAMAnalyticalLabelSpace.cs | 30 +- .../SAMAnalyticalLightingOccupancyControls.cs | 9 +- ...AnalyticalLightingPhotoelectricControls.cs | 9 +- .../Component/SAMAnalyticalLoadWeatherData.cs | 30 +- .../SAMAnalyticalMapAdjacencyCluster.cs | 9 +- .../SAMAnalyticalMapInternalCondtions.cs | 13 +- .../Component/SAMAnalyticalMapPanels.cs | 25 +- .../SAMAnalyticalMechanicalSystemTypes.cs | 15 +- .../Component/SAMAnalyticalMerge.cs | 13 +- .../SAMAnalyticalMergeAdjacencyCluster.cs | 21 +- ...MAnalyticalMergeAperturesByMinRectangle.cs | 13 +- .../SAMAnalyticalMergeCoplanarApertures.cs | 15 +- .../SAMAnalyticalMergeCoplanarPanels.cs | 9 +- ...SAMAnalyticalMergeCoplanarPanelsBySpace.cs | 11 +- .../SAMAnalyticalMergeOverlapApertures.cs | 9 +- .../SAMAnalyticalMergeOverlapPanels.cs | 11 +- .../Component/SAMAnalyticalMergePanels.cs | 25 +- .../Component/SAMAnalyticalMergeSettings.cs | 13 +- .../SAMAnalyticalMergeSpacesByAirPanels.cs | 13 +- .../SAMAnalyticalMergeSpacesByPanels.cs | 19 +- .../SAMAnalyticalMergeSpacesByZones.cs | 29 +- .../SAMAnalyticalModifyAirHandlingUnits.cs | 31 +- ...lyticalModifyInternalConditionByProfile.cs | 25 +- .../SAMAnalyticalModifyMechanicalSystems.cs | 41 +- .../Component/SAMAnalyticalModifyObject.cs | 23 +- ...alyticalModifyProfileByNumberComparison.cs | 51 +- .../Component/SAMAnalyticalModifySpaces.cs | 17 +- ...ticalModifyVentilationProfileByFunction.cs | 8 +- .../SAMAnalyticalModifyZonesCategoryName.cs | 19 +- .../Component/SAMAnalyticalMovePanel.cs | 9 +- .../Component/SAMAnalyticalNCMSystemType.cs | 9 +- .../Component/SAMAnalyticalNormalsDisplay.cs | 21 +- .../Component/SAMAnalyticalObjects.cs | 25 +- .../SAMAnalyticalOffsetAperturesOnEdge.cs | 9 +- .../Component/SAMAnalyticalOffsetPanel.cs | 11 +- .../Component/SAMAnalyticalOverlapPanels.cs | 9 +- .../Component/SAMAnalyticalPanelDistance.cs | 9 +- .../Component/SAMAnalyticalPanelGroup.cs | 9 +- .../Component/SAMAnalyticalPanelLocation.cs | 11 +- .../Component/SAMAnalyticalPanelSpacing.cs | 13 +- .../Component/SAMAnalyticalPanelType.cs | 9 +- .../Component/SAMAnalyticalPanelTypeByText.cs | 23 +- .../SAMAnalyticalPanelsDifference.cs | 19 +- .../Component/SAMAnalyticalPaths.cs | 18 +- .../Component/SAMAnalyticalPerimeterSpaces.cs | 19 +- .../SAMAnalyticalPlanarBoundary3D.cs | 9 +- .../SAMAnalyticalPlaneIntersection.cs | 9 +- .../Component/SAMAnalyticalProfileBySpace.cs | 11 +- .../Component/SAMAnalyticalProfileDivide.cs | 19 +- .../Component/SAMAnalyticalProfileGroup.cs | 9 +- .../Component/SAMAnalyticalProfileMultiply.cs | 19 +- .../Component/SAMAnalyticalProfileSum.cs | 19 +- .../Component/SAMAnalyticalProfileType.cs | 9 +- .../Component/SAMAnalyticalRelatedObjects.cs | 27 +- .../Component/SAMAnalyticalRemove.cs | 11 +- .../SAMAnalyticalRemoveAirMovementObjects.cs | 21 +- .../SAMAnalyticalRemoveExternalSpaces.cs | 17 +- ...AnalyticalRemoveFromConstructionManager.cs | 11 +- .../SAMAnalyticalRemoveInternalEdges.cs | 19 +- .../SAMAnalyticalRemoveOpeningProperties.cs | 29 +- .../SAMAnalyticalRemoveOverlapApertures.cs | 15 +- .../Component/SAMAnalyticalRemoveSpaces.cs | 28 +- .../SAMAnalyticalRemoveSpacesByBrep.cs | 19 +- .../SAMAnalyticalRenameAnalyticalModel.cs | 7 +- .../SAMAnalyticalRenameConstruction.cs | 9 +- .../Component/SAMAnalyticalReplaceObject.cs | 39 +- .../Component/SAMAnalyticalReportRooms.cs | 33 +- .../Component/SAMAnalyticalReportRoomsList.cs | 38 +- .../Component/SAMAnalyticalReportSpaces.cs | 19 +- .../Component/SAMAnalyticalRoundAzimuth.cs | 25 +- .../SAMAnalyticalSeasonProfileBySetPoint.cs | 21 +- .../Component/SAMAnalyticalSection.cs | 35 +- .../Component/SAMAnalyticalSetAdiabatic.cs | 19 +- .../Component/SAMAnalyticalSetAirflow.cs | 33 +- .../SAMAnalyticalSetApertureConstruction.cs | 19 +- ...etApertureConstructionByAnalyticalModel.cs | 21 +- .../Component/SAMAnalyticalSetConstruction.cs | 15 +- .../SAMAnalyticalSetConstructionByCsv.cs | 9 +- ...lyticalSetConstructionLayersByPanelType.cs | 11 +- ...nalyticalSetDefaultApertureConstruction.cs | 15 +- ...calSetDefaultApertureConstructionLayers.cs | 15 +- ...yticalSetDefaultConstructionByPanelType.cs | 15 +- ...lSetDefaultConstructionLayerByPanelType.cs | 15 +- .../SAMAnalyticalSetExternalSpaces.cs | 17 +- .../SAMAnalyticalSetInternalCondition.cs | 11 +- ...rnalConditionByInternalConditionLibrary.cs | 21 +- ...AMAnalyticalSetInternalConditionPerArea.cs | 25 +- .../Component/SAMAnalyticalSetLocation.cs | 17 +- .../SAMAnalyticalSetOccupancyGains.cs | 15 +- .../Component/SAMAnalyticalSetPanelType.cs | 17 +- .../SAMAnalyticalSetSystemTypeNames.cs | 21 +- .../SAMAnalyticalSnapByElevations.cs | 13 +- .../Component/SAMAnalyticalSnapByLines.cs | 9 +- .../Component/SAMAnalyticalSnapByOffset.cs | 9 +- .../Component/SAMAnalyticalSnapByPlanes.cs | 13 +- .../Component/SAMAnalyticalSnapByPoints.cs | 9 +- .../Component/SAMAnalyticalSnapPoints.cs | 9 +- .../SAMAnalyticalSplitByInternalEdges.cs | 9 +- .../SAMAnalyticalSplitPanelByElevations.cs | 19 +- .../SAMAnalyticalSplitPanelsByElevations.cs | 33 +- .../SAMAnalyticalSplitPanelsByGeometries.cs | 29 +- .../SAMAnalyticalSplitPanelsByPanels.cs | 21 +- .../SAMAnalyticalTM52BuildingCategory.cs | 9 +- ...icalTM52SpaceExtendedResultByDayOfYears.cs | 11 +- .../Component/SAMAnalyticalTransfom.cs | 17 +- .../SAMAnalyticalTriangulateConcavePanels.cs | 17 +- .../Component/SAMAnalyticalTrimPanels.cs | 11 +- .../SAMAnalyticalTypeMergeSettings.cs | 13 +- ...SAMAnalyticalUpdateApertureConstruction.cs | 15 +- ...yticalUpdateApertureConstructionsByName.cs | 21 +- ...lUpdateApertureConstructionsByPanelType.cs | 21 +- .../Component/SAMAnalyticalUpdateByModel.cs | 15 +- .../SAMAnalyticalUpdateConstructionManager.cs | 11 +- ...pdateConstructionsByConstructionManager.cs | 9 +- ...tructionsByConstructionManagerAndPanels.cs | 25 +- .../SAMAnalyticalUpdateConstructionsByMap.cs | 21 +- .../SAMAnalyticalUpdateConstructionsByName.cs | 21 +- ...nalyticalUpdateConstructionsByPanelType.cs | 35 +- ...AMAnalyticalUpdateConstructionsByPanels.cs | 19 +- .../SAMAnalyticalUpdateEquipmentGains.cs | 29 +- .../Component/SAMAnalyticalUpdateGeometry.cs | 15 +- ...nalyticalUpdateHeatTransferCoefficients.cs | 19 +- .../SAMAnalyticalUpdateInfiltrationGains.cs | 29 +- .../SAMAnalyticalUpdateInternalCondition.cs | 55 +- ...AMAnalyticalUpdateInternalConditionList.cs | 52 +- .../Component/SAMAnalyticalUpdateLibraries.cs | 11 +- .../SAMAnalyticalUpdateLightingGains.cs | 31 +- .../Component/SAMAnalyticalUpdateNCM.cs | 41 +- .../Component/SAMAnalyticalUpdateName.cs | 13 +- .../Component/SAMAnalyticalUpdateNormals.cs | 13 +- .../Component/SAMAnalyticalUpdateObjects.cs | 13 +- .../SAMAnalyticalUpdateOccupancyGains.cs | 27 +- .../SAMAnalyticalUpdatePanelTypes.cs | 17 +- .../SAMAnalyticalUpdatePanelTypes_Obsolete.cs | 11 +- .../SAMAnalyticalUpdatePollutantGains.cs | 9 +- .../Component/SAMAnalyticalUpdateSetPoint.cs | 27 +- .../Component/SAMAnalyticalUpdateSpace.cs | 17 +- ...MAnalyticalUpdateSpaceByLocationAndName.cs | 9 +- .../SAMAnalyticalUpdateSpaceLoactionPoint.cs | 37 +- .../SAMAnalyticalUpdateSpaceNames.cs | 19 +- .../SAMAnalyticalUpdateTypesByMap.cs | 21 +- .../SAMAnalyticalUpdateTypesByName.cs | 17 +- .../SAMAnalyticalUpdateVentilationProfile.cs | 43 +- .../SAMAnalyticalUpdateZoneByName.cs | 25 +- .../Component/SAMAnalyticalZoneType.cs | 9 +- .../Convert/ToGrasshopper/GH_Breps.cs | 7 +- .../Convert/ToGrasshopper/GH_Mesh.cs | 9 +- .../Convert/ToGrasshopper/GH_Point.cs | 7 +- .../Convert/ToGrasshopper/GH_Surface.cs | 7 +- .../Convert/ToGrasshopper/GH_Surfaces.cs | 21 +- .../Convert/ToGrasshopper/New/GH_Mesh.cs | 9 +- .../Convert/ToUI/Process.cs | 9 +- .../Enums/PanelBakeMethod.cs | 5 +- .../Kernel/AssemblyInfo.cs | 7 +- .../BakeGeometry_ByApertureConstruction.cs | 11 +- .../Modify/BakeGeometry_ByApertureType.cs | 11 +- .../Modify/BakeGeometry_ByBoundaryType.cs | 11 +- .../Modify/BakeGeometry_ByConstruction.cs | 7 +- .../BakeGeometry_ByDischargeCoefficient.cs | 17 +- .../Modify/BakeGeometry_ByInternalCondtion.cs | 8 +- .../Modify/BakeGeometry_ByLevel.cs | 8 +- .../Modify/BakeGeometry_ByPanelType.cs | 9 +- .../New/BakeGeometry_ByAnalyticalType.cs | 7 +- .../Modify/New/BakeGeometry_ByCategory.cs | 7 +- .../Modify/New/BakeGeometry_ByType.cs | 7 +- .../Modify/New/DrawViewportMeshes.cs | 9 +- .../Modify/New/DrawViewportWires.cs | 11 +- .../Properties/AssemblyInfo.cs | 5 +- .../Properties/Resources.Designer.cs | 5 +- .../Query/AnalyticalUIPath.cs | 9 +- .../Query/DataTree.cs | 13 +- .../Query/DisplayMaterial.cs | 7 +- .../Query/New/DisplayMaterial.cs | 7 +- .../Query/Offset.cs | 11 +- .../Query/TryConvertToPanelGeometries.cs | 11 +- .../Classes/GooLevel.cs | 7 +- .../Classes/GooMaterialLayer.cs | 17 +- .../Component/SAMArchitecturalCreateLevel.cs | 7 +- .../Kernel/AssemblyInfo.cs | 7 +- .../Properties/AssemblyInfo.cs | 5 +- .../Properties/Resources.Designer.cs | 5 +- .../Classes/GH_SAMComponent.cs | 7 +- .../Classes/GH_SAMComponentAttributes.cs | 5 +- .../GH_SAMComponentButtonAttributes.cs | 7 +- .../Classes/GH_SAMEnumComponent.cs | 10 +- .../Classes/GH_SAMNullAttributes.cs | 9 +- .../Classes/GH_SAMParam.cs | 5 +- .../GH_SAMVariableOutputParameterComponent.cs | 6 +- .../Classes/GooAddress.cs | 9 +- .../Classes/GooDelimitedFileTable.cs | 13 +- .../SAM.Core.Grasshopper/Classes/GooGroup.cs | 9 +- .../Classes/GooIndexedObjects.cs | 7 +- .../Classes/GooJSAMObject.cs | 25 +- .../Classes/GooLocation.cs | 9 +- .../SAM.Core.Grasshopper/Classes/GooLog.cs | 9 +- .../Classes/GooMaterial.cs | 21 +- .../Classes/GooMaterialLibrary.cs | 9 +- .../SAM.Core.Grasshopper/Classes/GooObject.cs | 35 +- .../Classes/GooRelationCluster.cs | 9 +- .../SAM.Core.Grasshopper/Classes/GooResult.cs | 9 +- .../Classes/GooSAMObject.cs | 9 +- .../SAM.Core.Grasshopper/Classes/GooSystem.cs | 13 +- .../Classes/GooSystemType.cs | 9 +- .../Classes/GooSystemTypeLibrary.cs | 9 +- .../Classes/GooTableModifier.cs | 9 +- .../Classes/GooTextMap.cs | 7 +- .../Component/SAMCoreARGBToUint.cs | 7 +- .../Component/SAMCoreAbout.cs | 7 +- .../Component/SAMCoreAddMaterials.cs | 9 +- .../Component/SAMCoreColorToUint.cs | 7 +- .../Component/SAMCoreCombineType.cs | 9 +- .../Component/SAMCoreCombineValues.cs | 17 +- .../Component/SAMCoreConvert.cs | 11 +- .../Component/SAMCoreCopyMaterials.cs | 11 +- .../Component/SAMCoreCountryCode.cs | 7 +- .../Component/SAMCoreCreateAddress.cs | 7 +- ...oreCreateDelimitedFileTableBySAMObjects.cs | 11 +- .../SAMCoreCreateGasMaterial_Obsolete.cs | 7 +- .../Component/SAMCoreCreateLocation.cs | 9 +- .../Component/SAMCoreCreateMaterialLibrary.cs | 7 +- .../SAMCoreCreateOpaqueMaterial_Obsolete.cs | 7 +- .../Component/SAMCoreCreateTextMap.cs | 13 +- ...MCoreCreateTransparentMaterial_Obsolete.cs | 7 +- .../SAMCoreCsvToDelimitedFileTable.cs | 11 +- .../Component/SAMCoreDateTimeToHourOfYear.cs | 11 +- .../Component/SAMCoreDayOfYearToHourOfYear.cs | 11 +- .../SAMCoreDelimitedFileTableGetValue.cs | 21 +- .../Component/SAMCoreDelimitedFileTableMap.cs | 25 +- ...SAMCoreDelimitedFileTableSetColumnNames.cs | 15 +- .../SAMCoreDelimitedFileTableSetValue.cs | 27 +- .../SAMCoreDelimitedFileTableSort.cs | 17 +- .../Component/SAMCoreDirection.cs | 9 +- .../Component/SAMCoreError.cs | 17 +- .../Component/SAMCoreFilter.cs | 21 +- .../Component/SAMCoreFilterByType.cs | 10 +- .../Component/SAMCoreFromFile.cs | 7 +- .../Component/SAMCoreFromJson.cs | 7 +- .../Component/SAMCoreGetNames.cs | 7 +- .../Component/SAMCoreGetType.cs | 7 +- .../Component/SAMCoreGetValue.cs | 9 +- .../Component/SAMCoreInspect.cs | 38 +- .../Component/SAMCoreLoadMaterialLibrary.cs | 7 +- .../Component/SAMCoreLogToFile.cs | 15 +- .../Component/SAMCoreNumberComparisonType.cs | 7 +- .../Component/SAMCoreNumberFilter.cs | 17 +- .../Component/SAMCoreObjects.cs | 19 +- .../Component/SAMCoreParameterByType.cs | 7 +- .../Component/SAMCoreParameterType.cs | 7 +- .../Component/SAMCorePeriod.cs | 7 +- .../Component/SAMCoreRelatedObjects.cs | 7 +- .../SAMCoreRelationClusterAddObjects.cs | 9 +- .../Component/SAMCoreRemoveValue.cs | 11 +- .../Component/SAMCoreReplaceByGuid.cs | 17 +- .../Component/SAMCoreRound.cs | 11 +- .../Component/SAMCoreSAMLibraryAddObjects.cs | 11 +- .../Component/SAMCoreSamples.cs | 6 +- .../Component/SAMCoreSaveMaterialLibrary.cs | 7 +- .../Component/SAMCoreSelectByName.cs | 17 +- .../Component/SAMCoreSetValue.cs | 15 +- .../Component/SAMCoreSetValues.cs | 21 +- .../Component/SAMCoreStringReplace.cs | 9 +- .../Component/SAMCoreTableModifier.cs | 15 +- .../Component/SAMCoreTextComparisonType.cs | 7 +- .../Component/SAMCoreTextMapValues.cs | 11 +- .../Component/SAMCoreToCsv.cs | 7 +- .../Component/SAMCoreToFile.cs | 7 +- .../Component/SAMCoreToJson.cs | 7 +- .../Component/SAMCoreToList.cs | 7 +- .../Component/SAMCoreUintToARGB.cs | 7 +- .../Component/SAMCoreUintToColor.cs | 7 +- .../Component/SAMCoreUpdate.cs | 11 +- .../Component/SAMHydraExportFile.cs | 9 +- .../Component/SAMVersion.cs | 7 +- .../Convert/ToSAM/GH_SAMParam.cs | 7 +- .../Create/GH_SAMParam.cs | 7 +- .../Enums/ParamVisibility.cs | 5 +- .../Interfaces/IGH_SAMComponent.cs | 11 +- .../Interfaces/IGooParameter.cs | 9 +- .../Interfaces/IGooSAMObject.cs | 7 +- .../Kernel/AssemblyInfo.cs | 7 +- .../Kernel/AssemblyPriority.cs | 7 +- .../AppendNewComponentAdditionalMenuItem.cs | 13 +- .../AppendSourceCodeAdditionalMenuItem.cs | 14 +- .../Modify/AppendVersionMenuItem.cs | 7 +- .../Modify/CopyParameteres.cs | 7 +- .../Modify/ExportHydra.cs | 17 +- .../Modify/RunGrasshopperScript.cs | 9 +- .../Modify/UpdateComponent.cs | 9 +- .../Modify/UpdateComponents.cs | 11 +- .../Properties/AssemblyInfo.cs | 5 +- .../Properties/Resources.Designer.cs | 5 +- .../SAM.Core.Grasshopper/Query/Clone.cs | 7 +- .../SAM.Core.Grasshopper/Query/Copy.cs | 7 +- .../SAM.Core.Grasshopper/Query/DataTree.cs | 7 +- .../Query/GenericSubclassOf.cs | 7 +- .../Query/HasComponentVersion.cs | 7 +- .../SAM.Core.Grasshopper/Query/JSAMObjects.cs | 9 +- .../SAM.Core.Grasshopper/Query/Layer.cs | 9 +- .../SAM.Core.Grasshopper/Query/Objects.cs | 19 +- .../SAM.Core.Grasshopper/Query/Obsolete.cs | 9 +- .../Query/RhinocerosExePath.cs | 9 +- .../Query/RhinocerosVersions.cs | 7 +- .../SAM.Core.Grasshopper/Query/SaveAs.cs | 7 +- .../SAM.Core.Grasshopper/Query/TryGetValue.cs | 9 +- .../Classes/GooSAMGeometry.cs | 27 +- .../Classes/GooTransform3D.cs | 7 +- .../CreateSAMTransform3DOriginToPlane.cs | 9 +- .../CreateSAMTransform3DPlaneToOrigin.cs | 7 +- .../CreateSAMTransform3DPlaneToPlane.cs | 7 +- .../Component/GeometryCreatePlane.cs | 7 +- .../Component/GeometryCreateShell.cs | 7 +- .../Component/GeometryFilterShells.cs | 9 +- .../Component/GeometryGetShellsByPoint3D.cs | 7 +- .../Component/GeometryGetShellsByPoint3Ds.cs | 17 +- .../Component/GeometryMeshClose.cs | 7 +- .../Component/GeometryMeshReduce.cs | 7 +- .../Component/GeometryModifyDifference.cs | 7 +- .../Component/GeometryModifyIntersection.cs | 7 +- .../Component/GeometryModifyUnion.cs | 7 +- .../Component/GeometryPolycurveLoop2D.cs | 7 +- .../Component/GeometrySAMGeometry.cs | 7 +- .../Component/GeometrySnapByDistance.cs | 7 +- .../Component/GeometrySnapByPoints.cs | 7 +- .../Component/GeometryTriangulate.cs | 11 +- .../Component/NTSSAMGeometry2D.cs | 9 +- .../Component/SAMGeometry2DSAMGeometry.cs | 7 +- .../Component/SAMGeometry2DToNTS.cs | 9 +- .../SAMGeometryCreateShellsByElevations.cs | 13 +- .../SAMGeometryCreateShellsByOffset.cs | 7 +- .../SAMGeometryCreateShellsByTopAndBottom.cs | 7 +- .../Component/SAMGeometryCutShell.cs | 17 +- .../Component/SAMGeometryFace3DSpacing.cs | 23 +- .../Component/SAMGeometryFill.cs | 9 +- .../Component/SAMGeometryFlipNormal.cs | 7 +- .../Component/SAMGeometryGeometry.cs | 7 +- .../Component/SAMGeometryIsClosed.cs | 7 +- .../Component/SAMGeometryMargeOverlaps.cs | 9 +- .../Component/SAMGeometryPlaneIntersection.cs | 7 +- .../Component/SAMGeometrySAMGeometry2D.cs | 33 +- .../Component/SAMGeometrySectionByFace3D.cs | 21 +- .../Component/SAMGeometrySectionByShell.cs | 21 +- .../SAMGeometrySegment2DIntersection.cs | 7 +- .../Component/SAMGeometryShellContains.cs | 9 +- .../Component/SAMGeometryShellDifference.cs | 7 +- .../Component/SAMGeometryShellIntersection.cs | 7 +- .../SAMGeometryShellNakedSegment3Ds.cs | 7 +- .../Component/SAMGeometryShellsSplit.cs | 7 +- .../SAMGeometryShellsSplitByFace3Ds.cs | 7 +- .../SAMGeometryShellsSplitFace3Ds.cs | 7 +- .../Component/SAMGeometryShellsUnion.cs | 7 +- .../Component/SAMGeometrySplit.cs | 7 +- .../SAMGeometrySplitCoplanarFace3Ds.cs | 15 +- .../Component/SAMGeometryThinnessRatio.cs | 13 +- .../Component/SAMGeometryTransform.cs | 7 +- .../Convert/ToGrasshopper/GH_Brep.cs | 11 +- .../Convert/ToGrasshopper/GH_Curve.cs | 7 +- .../Convert/ToGrasshopper/GH_Line.cs | 7 +- .../Convert/ToGrasshopper/GH_Mesh.cs | 7 +- .../Convert/ToGrasshopper/GH_Plane.cs | 7 +- .../Convert/ToGrasshopper/GH_Point.cs | 7 +- .../Convert/ToGrasshopper/GH_Rectangle.cs | 9 +- .../Convert/ToGrasshopper/GH_Surface.cs | 7 +- .../Convert/ToGrasshopper/GH_Vector.cs | 7 +- .../Convert/ToGrasshopper/IGH_Goo.cs | 7 +- .../Convert/ToSAM/Circle3D.cs | 7 +- .../Convert/ToSAM/Extrusion.cs | 9 +- .../Convert/ToSAM/IGeometry3D.cs | 9 +- .../Convert/ToSAM/IGeometry3Ds.cs | 7 +- .../Convert/ToSAM/Mesh3D.cs | 9 +- .../Convert/ToSAM/Plane.cs | 7 +- .../Convert/ToSAM/Point3D.cs | 7 +- .../Convert/ToSAM/Rectangle3D.cs | 7 +- .../Convert/ToSAM/Segment3D.cs | 7 +- .../Convert/ToSAM/Surface.cs | 7 +- .../Convert/ToSAM/Transform3D.cs | 7 +- .../Convert/ToSAM/Vector3D.cs | 7 +- .../SAM.Geometry.Grasshopper/Create/Shell.cs | 7 +- .../SAM.Geometry.Grasshopper/Enum/MeshType.cs | 7 +- .../Kernel/AssemblyInfo.cs | 7 +- .../Modify/Convert.cs | 9 +- .../Modify/DrawViewportMeshes.cs | 5 +- .../Modify/DrawViewportWires.cs | 25 +- .../SAM.Geometry.Grasshopper/Modify/Reduce.cs | 7 +- .../Properties/AssemblyInfo.cs | 5 +- .../Properties/Resources.Designer.cs | 5 +- .../SAM.Geometry.Grasshopper/Query/Close.cs | 9 +- .../Query/TryGetSAMGeometries.cs | 25 +- .../Template/TemplateComponent.cs | 7 +- .../SAM.Math.Grasshopper/Classes/GooMatrix.cs | 11 +- .../Convert/ToGrasshopper/GH_Matrix.cs | 7 +- .../Convert/ToSAM/Matrix.cs | 7 +- .../Kernel/AssemblyInfo.cs | 7 +- .../Properties/AssemblyInfo.cs | 5 +- .../Properties/Resources.Designer.cs | 5 +- .../Classes/GooWeatherData.cs | 13 +- .../Classes/GooWeatherObject.cs | 13 +- .../Classes/GooWeatherYear.cs | 13 +- .../SAMWeatherAdaptiveSetpointACCI.cs | 21 +- ...eatherAdaptiveSetpointACCIByTemperature.cs | 13 +- .../SAMWeatherHourlyModifyWeatherData.cs | 18 +- .../Component/SAMWeatherHourlyValue.cs | 9 +- .../Component/SAMWeatherHourlyValues.cs | 21 +- ...herPrevailingMeanOutdoorAirTemperatures.cs | 21 +- .../Component/SAMWeatherWeatherDataType.cs | 7 +- .../SAMWeatherWeatherHoursByHourOfYear.cs | 9 +- .../SAMWeatherWeatherHoursByPercentage.cs | 35 +- .../Kernel/AssemblyInfo.cs | 7 +- .../Properties/AssemblyInfo.cs | 5 +- .../Properties/Resources.Designer.cs | 5 +- .../Convert/ToRhino/Brep.cs | 7 +- .../Convert/ToRhino/Breps.cs | 19 +- .../Convert/ToRhino/Mesh.cs | 41 +- .../Convert/ToRhino/New/Brep.cs | 9 +- .../Convert/ToRhino/New/Mesh.cs | 23 +- .../Modify/BakeGeometry.cs | 11 +- .../BakeGeometry_ByApertureConstruction.cs | 7 +- .../Modify/BakeGeometry_ByApertureType.cs | 7 +- .../Modify/BakeGeometry_ByBoundaryType.cs | 11 +- .../Modify/BakeGeometry_ByConstruction.cs | 17 +- .../BakeGeometry_ByDischargeCoefficient.cs | 19 +- .../Modify/BakeGeometry_ByInternalCondtion.cs | 7 +- .../Modify/BakeGeometry_ByLevel.cs | 7 +- .../Modify/BakeGeometry_ByPanelType.cs | 17 +- .../Modify/New/BakeGeometry.cs | 7 +- .../New/BakeGeometry_ByAnalyticalType.cs | 7 +- .../Modify/New/BakeGeometry_ByCategory.cs | 9 +- .../Modify/New/BakeGeometry_ByType.cs | 15 +- Rhino/SAM.Core.Rhino/Modify/AddLayer.cs | 15 +- Rhino/SAM.Core.Rhino/Modify/AddSAMLayer.cs | 7 +- Rhino/SAM.Core.Rhino/Modify/GetLayer.cs | 9 +- Rhino/SAM.Core.Rhino/Modify/SetUserStrings.cs | 9 +- Rhino/SAM.Core.Rhino/Query/Layers.cs | 9 +- .../Convert/ToRhino/BoundingBox.cs | 11 +- .../Convert/ToRhino/Brep.cs | 33 +- .../Convert/ToRhino/Curve.cs | 7 +- .../Convert/ToRhino/Line.cs | 7 +- .../Convert/ToRhino/LineCurve.cs | 7 +- .../Convert/ToRhino/Mesh.cs | 23 +- .../Convert/ToRhino/Plane.cs | 7 +- .../Convert/ToRhino/Point3d.cs | 9 +- .../Convert/ToRhino/Polyline.cs | 7 +- .../Convert/ToRhino/PolylineCurve.cs | 9 +- .../Convert/ToRhino/Rectangle3d.cs | 9 +- .../Convert/ToRhino/Vector3d.cs | 7 +- .../Convert/ToSAM/Circle3D.cs | 7 +- .../Convert/ToSAM/IClosed3D.cs | 7 +- .../Convert/ToSAM/IGeometry3D.cs | 13 +- .../Convert/ToSAM/IGeometry3Ds.cs | 33 +- .../Convert/ToSAM/Mesh3D.cs | 13 +- .../SAM.Geometry.Rhino/Convert/ToSAM/Plane.cs | 7 +- .../Convert/ToSAM/Point3D.cs | 7 +- .../Convert/ToSAM/Polycurve3D.cs | 17 +- .../Convert/ToSAM/Polyline3D.cs | 7 +- .../Convert/ToSAM/Rectangle3D.cs | 11 +- .../Convert/ToSAM/Segment3D.cs | 7 +- .../SAM.Geometry.Rhino/Convert/ToSAM/Shell.cs | 13 +- .../Convert/ToSAM/Transform3D.cs | 7 +- .../Convert/ToSAM/Vector3D.cs | 7 +- Rhino/SAM.Geometry.Rhino/Create/Shell.cs | 13 +- .../Manager/ActiveSetting.cs | 7 +- .../SAM.Geometry.Rhino/Modify/BakeGeometry.cs | 13 +- Rhino/SAM.Geometry.Rhino/Query/UnitScale.cs | 9 +- .../SAM.Math.Rhino/Convert/ToRhino/Matrix.cs | 5 +- Rhino/SAM.Math.Rhino/Convert/ToSAM/Matrix.cs | 9 +- .../Classes/AdjacencyCluster.cs | 8 +- .../AirMovement/AirHandlingUnitAirMovement.cs | 15 +- .../Classes/AirMovement/SpaceAirMovement.cs | 15 +- .../AnalyticalEquipment/AirHandlingUnit.cs | 11 +- .../Classes/AnalyticalEquipment/Coil.cs | 13 +- .../AnalyticalEquipment/ComplexEquipment.cs | 33 +- .../ComplexEquipmentModel.cs | 103 +- .../AnalyticalEquipment/CoolingCoil.cs | 5 +- .../AnalyticalEquipment/EmptySection.cs | 5 +- .../Classes/AnalyticalEquipment/Fan.cs | 5 +- .../Classes/AnalyticalEquipment/Filter.cs | 7 +- .../AnalyticalEquipment/HeatRecoveryUnit.cs | 15 +- .../AnalyticalEquipment/HeatingCoil.cs | 7 +- .../Classes/AnalyticalEquipment/Humidifier.cs | 5 +- .../AnalyticalEquipment/MixingSection.cs | 5 +- .../Classes/AnalyticalEquipment/Silencer.cs | 5 +- .../AnalyticalEquipment/SimpleEquipment.cs | 5 +- SAM/SAM.Analytical/Classes/AnalyticalModel.cs | 39 +- SAM/SAM.Analytical/Classes/Aperture.cs | 47 +- .../Classes/ApertureConstruction.cs | 17 +- .../Classes/ApertureConstructionLibrary.cs | 9 +- SAM/SAM.Analytical/Classes/Boundary2D.cs | 11 +- SAM/SAM.Analytical/Classes/BoundaryEdge2D.cs | 7 +- .../Classes/BoundaryEdge2DLoop.cs | 9 +- SAM/SAM.Analytical/Classes/BoundaryEdge3D.cs | 9 +- .../Classes/BoundaryEdge3DLoop.cs | 11 +- .../Classes/Case/ApertureCase.cs | 263 ++++ .../Classes/Case/ApertureConstructionCase.cs | 106 ++ .../Classes/Case/ApertureToPanelRatio.cs | 177 +++ .../Classes/Case/ApertureToPanelRatios.cs | 101 ++ SAM/SAM.Analytical/Classes/Case/Case.cs | 62 + .../CaseSelection/ApertureCaseSelection.cs | 37 + .../Case/CaseSelection/CaseSelection.cs | 57 + .../Case/CaseSelection/FilterSelection.cs | 69 + .../ObjectReferenceCaseSelection.cs | 92 ++ .../CaseSelection/SAMObjectCaseSelection.cs | 121 ++ SAM/SAM.Analytical/Classes/Case/Cases.cs | 174 +++ .../Classes/Case/FinShadeCase.cs | 351 +++++ .../Classes/Case/PanelShadeCase.cs | 87 ++ .../Classes/Case/VentilationCase.cs | 241 ++++ .../Classes/Case/WeatherDataCase.cs | 80 ++ .../Classes/Case/WindowSizeCase.cs | 116 ++ .../Classes/CaseData/ApertureCaseData.cs | 25 +- .../CaseData/ApertureConstructionCaseData.cs | 23 +- .../Classes/CaseData/BuiltInCaseData.cs | 11 +- .../Classes/CaseData/CaseData.cs | 15 +- .../Classes/CaseData/CaseDataCollection.cs | 21 +- .../Classes/CaseData/OpeningCaseData.cs | 24 +- .../Classes/CaseData/ShadeCaseData.cs | 35 +- .../Classes/CaseData/VentilationCaseData.cs | 23 +- .../Classes/CaseData/WeatherCaseData.cs | 24 +- .../Classes/CaseData/WindowSizeCaseData.cs | 24 +- SAM/SAM.Analytical/Classes/Construction.cs | 15 +- .../Classes/ConstructionLayer.cs | 9 +- .../Classes/ConstructionLibrary.cs | 11 +- .../Classes/ConstructionManager.cs | 47 +- .../Classes/DailyWeightedExceedance.cs | 25 +- .../Classes/DegreeOfActivity.cs | 9 +- .../Classes/DegreeOfActivityLibrary.cs | 9 +- SAM/SAM.Analytical/Classes/DesignDay.cs | 21 +- SAM/SAM.Analytical/Classes/Emitter.cs | 13 +- SAM/SAM.Analytical/Classes/ExternalPanel.cs | 15 +- SAM/SAM.Analytical/Classes/ExternalSpace.cs | 13 +- SAM/SAM.Analytical/Classes/FeatureShade.cs | 11 +- .../ApertureApertureConstructionFilter.cs | 5 +- .../Filter/ApertureApertureTypeFilter.cs | 11 +- .../Classes/Filter/ApertureAzimuthFilter.cs | 7 +- .../Classes/Filter/ApertureFrameAreaFilter.cs | 7 +- .../Classes/Filter/AperturePaneAreaFilter.cs | 7 +- .../MultiRelationAdjacencyClusterFilter.cs | 13 +- .../Filter/PanelApertureCountFilter.cs | 7 +- .../Classes/Filter/PanelAperturesFilter.cs | 13 +- .../Classes/Filter/PanelAreaFilter.cs | 7 +- .../Classes/Filter/PanelAzimuthFilter.cs | 7 +- .../Classes/Filter/PanelBoundaryTypeFilter.cs | 17 +- .../Classes/Filter/PanelConstructionFilter.cs | 11 +- .../Classes/Filter/PanelMaxElevationFilter.cs | 7 +- .../Classes/Filter/PanelMinElevationFilter.cs | 7 +- .../Classes/Filter/PanelPanelGroupFilter.cs | 15 +- .../Classes/Filter/PanelPanelTypeFilter.cs | 11 +- .../Classes/Filter/PanelTiltFilter.cs | 7 +- .../Classes/Filter/SpaceAreaFilter.cs | 9 +- .../SpaceCoolingSystemFullNameFilter.cs | 9 +- .../SpaceCoolingSystemTypeNameFilter.cs | 9 +- .../Classes/Filter/SpaceElevationFilter.cs | 7 +- .../SpaceHeatingSystemFullNameFilter.cs | 9 +- .../SpaceHeatinigSystemTypeNameFilter.cs | 9 +- .../Filter/SpaceInternalConditionFilter.cs | 7 +- .../SpaceMechanicalSystemFullNameFilter.cs | 11 +- .../SpaceMechanicalSystemTypeNameFilter.cs | 11 +- .../Classes/Filter/SpacePanelsFilter.cs | 9 +- .../SpaceVentilationSystemFullNameFilter.cs | 9 +- .../SpaceVentilationSystemTypeNameFilter.cs | 9 +- .../Classes/Filter/SpaceVolumeFilter.cs | 7 +- .../Classes/Filter/SpaceZonesFilter.cs | 9 +- SAM/SAM.Analytical/Classes/Function.cs | 32 +- SAM/SAM.Analytical/Classes/Glazing.cs | 7 +- .../Classes/InternalCondition.cs | 13 +- .../Classes/InternalConditionLibrary.cs | 9 +- SAM/SAM.Analytical/Classes/MergeSettings.cs | 31 +- .../Classes/Modifier/DailyModifier.cs | 43 +- .../Modifier/IndexedDoublesModifier.cs | 17 +- .../Classes/Modifier/ProfileModifier.cs | 23 +- SAM/SAM.Analytical/Classes/NCM/NCMData.cs | 23 +- SAM/SAM.Analytical/Classes/NCM/NCMName.cs | 19 +- .../Classes/NCM/NCMNameCollection.cs | 25 +- .../Classes/New/AirPartition.cs | 7 +- .../Classes/New/BuildingElement.cs | 17 +- .../Classes/New/BuildingElementType.cs | 5 +- .../Classes/New/BuildingModel.cs | 444 +++---- SAM/SAM.Analytical/Classes/New/Door.cs | 5 +- SAM/SAM.Analytical/Classes/New/DoorType.cs | 5 +- SAM/SAM.Analytical/Classes/New/Floor.cs | 7 +- SAM/SAM.Analytical/Classes/New/FloorType.cs | 6 +- .../Classes/New/HostPartition.cs | 51 +- .../Classes/New/HostPartitionType.cs | 18 +- .../Classes/New/HostPartitionTypeLibrary.cs | 11 +- SAM/SAM.Analytical/Classes/New/Opening.cs | 13 +- SAM/SAM.Analytical/Classes/New/OpeningType.cs | 18 +- .../Classes/New/OpeningTypeLibrary.cs | 15 +- SAM/SAM.Analytical/Classes/New/Roof.cs | 5 +- SAM/SAM.Analytical/Classes/New/RoofType.cs | 6 +- .../BuildingModelSimulationResult.cs | 9 +- .../OpeningSimulationResult.cs | 9 +- .../PartitionSimulationResult.cs | 9 +- SAM/SAM.Analytical/Classes/New/Wall.cs | 5 +- SAM/SAM.Analytical/Classes/New/WallType.cs | 6 +- SAM/SAM.Analytical/Classes/New/Window.cs | 5 +- SAM/SAM.Analytical/Classes/New/WindowType.cs | 7 +- .../MultipleOpeningProperties.cs | 29 +- .../OpeningProperties/OpeningProperties.cs | 21 +- .../PartOOpeningProperties.cs | 29 +- .../ProfileOpeningProperties.cs | 23 +- SAM/SAM.Analytical/Classes/Panel.cs | 21 +- .../Classes/PlanarBoundary3D.cs | 27 +- SAM/SAM.Analytical/Classes/Profile.cs | 103 +- SAM/SAM.Analytical/Classes/ProfileLibrary.cs | 23 +- .../AdjacencyClusterSimulationResult.cs | 9 +- .../Result/AnalyticalModelSimulationResult.cs | 9 +- .../Classes/Result/SpaceSimulationResult.cs | 9 +- .../Classes/Result/SurfaceSimulationResult.cs | 9 +- .../Classes/Result/TM/TM52ExtendedResult.cs | 55 +- .../Classes/Result/TM/TM52Result.cs | 23 +- .../Result/TM/TM59CorridorExtendedResult.cs | 7 +- .../Classes/Result/TM/TM59CorridorResult.cs | 19 +- .../Classes/Result/TM/TM59ExtendedResult.cs | 11 +- ...TM59MechanicalVentilationExtendedResult.cs | 7 +- .../TM/TM59MechanicalVentilationResult.cs | 19 +- ...NaturalVentilationBedroomExtendedResult.cs | 7 +- .../TM/TM59NaturalVentilationBedroomResult.cs | 19 +- .../TM59NaturalVentilationExtendedResult.cs | 7 +- .../Result/TM/TM59NaturalVentilationResult.cs | 21 +- .../Classes/Result/TM/TM59Result.cs | 23 +- .../Classes/Result/TM/TMExtendedResult.cs | 31 +- .../Classes/Result/TM/TMResult.cs | 13 +- .../Classes/Result/ZoneSimulationResult.cs | 9 +- .../Classes/RoomLabelCoordinate.cs | 5 +- SAM/SAM.Analytical/Classes/Space.cs | 12 +- .../Classes/System/CoolingSystem.cs | 9 +- .../Classes/System/CoolingSystemType.cs | 9 +- .../Classes/System/HeatingSystem.cs | 9 +- .../Classes/System/HeatingSystemType.cs | 9 +- .../Classes/System/MechanicalSystem.cs | 9 +- .../Classes/System/MechanicalSystemType.cs | 13 +- .../Classes/System/VentilationSystem.cs | 9 +- .../Classes/System/VentilationSystemType.cs | 9 +- SAM/SAM.Analytical/Classes/TM59Manager.cs | 13 +- .../Classes/TypeMergeSettings.cs | 19 +- SAM/SAM.Analytical/Classes/Zone.cs | 9 +- .../Convert/ToDesignExplorer/File.cs | 23 +- .../Convert/ToSAM/AnalyticalModel.cs | 19 +- SAM/SAM.Analytical/Convert/ToSAM/Aperture.cs | 11 +- .../Convert/ToSAM/ApertureConstruction.cs | 15 +- .../Convert/ToSAM/Construction.cs | 11 +- .../Convert/ToSAM/ConstructionLayer.cs | 11 +- SAM/SAM.Analytical/Convert/ToSAM/Function.cs | 9 +- SAM/SAM.Analytical/Convert/ToSAM/Panel.cs | 7 +- .../Convert/ToSystem/DateTime.cs | 7 +- .../Convert/ToSystem/Dictionary.cs | 44 + SAM/SAM.Analytical/Convert/ToSystem/String.cs | 7 +- SAM/SAM.Analytical/Create/AdjacencyCluster.cs | 125 +- SAM/SAM.Analytical/Create/AirHandlingUnit.cs | 9 +- SAM/SAM.Analytical/Create/AnalyticalModel.cs | 1136 +++++++++++++++++ SAM/SAM.Analytical/Create/AnalyticalModels.cs | 55 + SAM/SAM.Analytical/Create/Aperture.cs | 11 +- .../Create/ApertureConstruction.cs | 9 +- SAM/SAM.Analytical/Create/Apertures.cs | 7 +- SAM/SAM.Analytical/Create/Cases.cs | 33 + SAM/SAM.Analytical/Create/Construction.cs | 7 +- .../Create/ConstructionLayers.cs | 9 +- .../Create/ConstructionLibrary.cs | 11 +- .../Create/ConstructionManager.cs | 29 +- .../Create/CoolingSystemType.cs | 7 +- SAM/SAM.Analytical/Create/DegreeOfActivity.cs | 9 +- SAM/SAM.Analytical/Create/DesignDay.cs | 15 +- SAM/SAM.Analytical/Create/Emitter.cs | 11 +- SAM/SAM.Analytical/Create/GasMaterial.cs | 13 +- .../Create/HeatingSystemType.cs | 7 +- SAM/SAM.Analytical/Create/Id.cs | 9 +- .../Create/InternalCondition.cs | 11 +- SAM/SAM.Analytical/Create/Levels.cs | 11 +- SAM/SAM.Analytical/Create/Log.cs | 151 +-- SAM/SAM.Analytical/Create/MaterialLibrary.cs | 21 +- SAM/SAM.Analytical/Create/MechanicalSystem.cs | 7 +- .../Create/New/BuildingModel.cs | 34 +- .../Create/New/HostPartition.cs | 13 +- .../Create/New/HostPartitionType.cs | 10 +- .../Create/New/HostPartitions.cs | 13 +- SAM/SAM.Analytical/Create/New/Log.cs | 21 +- SAM/SAM.Analytical/Create/New/Opening.cs | 15 +- SAM/SAM.Analytical/Create/New/OpeningType.cs | 7 +- SAM/SAM.Analytical/Create/New/Openings.cs | 9 +- SAM/SAM.Analytical/Create/New/Partition.cs | 9 +- SAM/SAM.Analytical/Create/New/Partitions.cs | 13 +- SAM/SAM.Analytical/Create/New/Rectangle2D.cs | 9 +- SAM/SAM.Analytical/Create/New/Walls.cs | 7 +- SAM/SAM.Analytical/Create/OpaqueMaterial.cs | 7 +- SAM/SAM.Analytical/Create/Panel.cs | 37 +- SAM/SAM.Analytical/Create/Panels.cs | 10 +- SAM/SAM.Analytical/Create/Profile.cs | 13 +- SAM/SAM.Analytical/Create/Rectangle2D.cs | 9 +- SAM/SAM.Analytical/Create/RiserName.cs | 7 +- .../Create/SpaceSimulationResult.cs | 11 +- .../Create/TM52ExtendedResult.cs | 11 +- .../Create/TransparentMaterial.cs | 7 +- .../Create/VentilationSystem.cs | 7 +- .../Create/VentilationSystemType.cs | 7 +- SAM/SAM.Analytical/Create/Zone.cs | 7 +- SAM/SAM.Analytical/Enums/ActivityLevel.cs | 9 +- SAM/SAM.Analytical/Enums/AirSupplyMethod.cs | 7 +- SAM/SAM.Analytical/Enums/AperturePart.cs | 7 +- SAM/SAM.Analytical/Enums/ApertureType.cs | 7 +- SAM/SAM.Analytical/Enums/BoundaryType.cs | 7 +- SAM/SAM.Analytical/Enums/DefaultGasType.cs | 7 +- SAM/SAM.Analytical/Enums/EmitterCategory.cs | 7 +- SAM/SAM.Analytical/Enums/EmitterType.cs | 7 +- SAM/SAM.Analytical/Enums/FilterGroup.cs | 7 +- .../Enums/FlowClassification.cs | 7 +- SAM/SAM.Analytical/Enums/FunctionType.cs | 7 +- SAM/SAM.Analytical/Enums/HeatFlowDirection.cs | 7 +- .../Enums/LightingOccupancyControls.cs | 7 +- .../Enums/LightingPhotoelectricControls.cs | 7 +- SAM/SAM.Analytical/Enums/LoadType.cs | 7 +- .../Enums/MechanicalSystemCategory.cs | 7 +- SAM/SAM.Analytical/Enums/NCMCountry.cs | 7 +- SAM/SAM.Analytical/Enums/NCMSystemType.cs | 7 +- .../Enums/New/HostPartitionCategory.cs | 7 +- .../Enums/New/OpeningAnalyticalType.cs | 7 +- SAM/SAM.Analytical/Enums/New/OpeningPart.cs | 7 +- .../Enums/New/PartitionAnalyticalType.cs | 7 +- SAM/SAM.Analytical/Enums/PanelGroup.cs | 7 +- SAM/SAM.Analytical/Enums/PanelType.cs | 7 +- ...jacencyClusterSimulationResultParameter.cs | 7 +- .../Parameter/AirHandlingUnitParameter.cs | 7 +- .../Parameter/AnalyticalModelParameter.cs | 7 +- ...nalyticalModelSimulationResultParameter.cs | 7 +- .../Parameter/AnalyticalSettingParameter.cs | 7 +- .../ApertureConstructionParameter.cs | 9 +- .../Enums/Parameter/ApertureParameter.cs | 7 +- .../Enums/Parameter/ConstructionParameter.cs | 9 +- .../Parameter/CoolingSystemTypeParameter.cs | 7 +- .../Enums/Parameter/GasMaterialParameter.cs | 5 +- .../Parameter/HeatingSystemTypeParameter.cs | 7 +- .../Parameter/InternalConditionParameter.cs | 7 +- .../Enums/Parameter/MaterialParameter.cs | 7 +- .../New/ArchitecturalModelParameter.cs | 7 +- .../Parameter/New/HostPartitionParameter.cs | 7 +- .../New/HostPartitionTypeParameter.cs | 7 +- .../Parameter/New/OpeningTypeParameter.cs | 7 +- .../New/PartitionSimulationResultParameter.cs | 7 +- .../Parameter/OpaqueMaterialParameter.cs | 7 +- .../Parameter/OpeningPropertiesParameter.cs | 7 +- .../Enums/Parameter/PanelParameter.cs | 7 +- .../Enums/Parameter/SpaceParameter.cs | 9 +- .../SpaceSimulationResultParameter.cs | 9 +- .../SurfaceSimulationResultParameter.cs | 7 +- .../Parameter/TransparentMaterialParameter.cs | 7 +- .../Parameter/VentilationSystemParameter.cs | 7 +- .../VentilationSystemTypeParameter.cs | 7 +- .../Enums/Parameter/ZoneParameter.cs | 7 +- .../ZoneSimulationResultParameter.cs | 7 +- SAM/SAM.Analytical/Enums/ProfileGroup.cs | 7 +- SAM/SAM.Analytical/Enums/ProfileType.cs | 7 +- SAM/SAM.Analytical/Enums/SeasonType.cs | 9 +- SAM/SAM.Analytical/Enums/SizingMethod.cs | 7 +- .../Enums/TM52BuildingCategory.cs | 5 +- .../Enums/TM59SpaceApplication.cs | 5 +- SAM/SAM.Analytical/Enums/VentilationType.cs | 7 +- SAM/SAM.Analytical/Enums/ZoneType.cs | 7 +- .../Filter/IAdjacencyClusterFilter.cs | 5 +- .../Interfaces/IAirMovementObject.cs | 5 +- .../Interfaces/IAnalyticalEquipment.cs | 7 +- .../Interfaces/IAnalyticalObject.cs | 5 +- .../Interfaces/IAnalyticalResult.cs | 5 +- .../Interfaces/IComplexEquipment.cs | 7 +- SAM/SAM.Analytical/Interfaces/IPanel.cs | 5 +- SAM/SAM.Analytical/Interfaces/ISection.cs | 5 +- .../Interfaces/ISelectiveCase.cs | 12 + .../Interfaces/ISimpleEquipment.cs | 7 +- SAM/SAM.Analytical/Interfaces/ISpace.cs | 5 +- .../Interfaces/New/IBuildingElement.cs | 7 +- .../Interfaces/New/IHostPartition.cs | 5 +- SAM/SAM.Analytical/Interfaces/New/IOpening.cs | 5 +- .../Interfaces/New/IPartition.cs | 5 +- .../OpeningProperties/IOpeningProperties.cs | 5 +- .../ISingleOpeningProperties.cs | 5 +- SAM/SAM.Analytical/Manager/ActiveSetting.cs | 7 +- .../Modify/AddAirMovementObjects.cs | 27 +- SAM/SAM.Analytical/Modify/AddAirPanels.cs | 39 +- SAM/SAM.Analytical/Modify/AddAperture.cs | 15 +- SAM/SAM.Analytical/Modify/AddApertures.cs | 43 +- .../Modify/AddMechanicalSystem.cs | 9 +- .../Modify/AddMechanicalSystems.cs | 21 +- .../Modify/AddMissingMaterials.cs | 19 +- SAM/SAM.Analytical/Modify/AddPanels.cs | 45 +- SAM/SAM.Analytical/Modify/AddResults.cs | 27 +- .../Modify/AddSingleOpeningProperties.cs | 13 +- SAM/SAM.Analytical/Modify/AddSpace.cs | 11 +- .../Modify/AddVentilationSystem.cs | 21 +- SAM/SAM.Analytical/Modify/Align.cs | 41 +- .../Modify/AssignAdjacencyCluster.cs | 9 +- .../Modify/AssignMechanicalSystem.cs | 23 +- .../Modify/AssignSpaceColors.cs | 21 +- .../Modify/ChangeExternalSpaces.cs | 29 +- SAM/SAM.Analytical/Modify/CopyZones.cs | 17 +- SAM/SAM.Analytical/Modify/Cut.cs | 17 +- SAM/SAM.Analytical/Modify/Extend.cs | 9 +- SAM/SAM.Analytical/Modify/ExtendExternal.cs | 33 +- .../Modify/FixAdjacencyCluster.cs | 43 +- SAM/SAM.Analytical/Modify/Join.cs | 7 +- SAM/SAM.Analytical/Modify/Map.cs | 17 +- .../Modify/MapInternalConditions.cs | 7 +- SAM/SAM.Analytical/Modify/MapPanels.cs | 17 +- SAM/SAM.Analytical/Modify/MapZones.cs | 7 +- SAM/SAM.Analytical/Modify/Merge.cs | 46 +- SAM/SAM.Analytical/Modify/MergeApertures.cs | 49 +- SAM/SAM.Analytical/Modify/MergePanel.cs | 9 +- SAM/SAM.Analytical/Modify/MergeSpaces.cs | 25 +- .../Modify/New/AddAirPartitions.cs | 13 +- .../Modify/New/AddMechanicalSystem.cs | 9 +- .../Modify/New/AddMissingMaterials.cs | 19 +- .../Modify/New/AddMissingProfiles.cs | 23 +- SAM/SAM.Analytical/Modify/New/AddOpening.cs | 13 +- SAM/SAM.Analytical/Modify/New/AddOpenings.cs | 13 +- SAM/SAM.Analytical/Modify/New/FixEdges.cs | 13 +- .../Modify/New/MapInternalConditions.cs | 7 +- SAM/SAM.Analytical/Modify/New/MapZones.cs | 9 +- .../New/MergeCoplanarPartitionsBySpace.cs | 17 +- .../Modify/New/OffsetAperturesOnEdge.cs | 17 +- .../Modify/New/OrientPartitions.cs | 17 +- .../New/ReplaceTransparentPartitions.cs | 29 +- .../Modify/New/SimplifyByAngle.cs | 15 +- .../Modify/New/SplitByInternalEdges.cs | 17 +- .../New/TriangulateConcavePartitions.cs | 9 +- .../Modify/New/TryAddOpening.cs | 15 +- SAM/SAM.Analytical/Modify/New/Type.cs | 13 +- .../Modify/New/UpdateHostPartitionType.cs | 48 +- .../Modify/New/UpdateMaterials.cs | 22 +- ...dateMaterialsByHeatTransferCoefficients.cs | 13 +- ...UpdateMaterialsByMaterialLayerThickness.cs | 31 +- SAM/SAM.Analytical/Modify/New/UpdateSpace.cs | 11 +- SAM/SAM.Analytical/Modify/New/UpdateZone.cs | 7 +- SAM/SAM.Analytical/Modify/Normalize.cs | 11 +- .../Modify/OffsetAperturesOnEdge.cs | 11 +- .../Modify/OrientedPartitions.cs | 23 +- SAM/SAM.Analytical/Modify/Remove.cs | 33 +- .../Modify/RemoveAirMovementObjects.cs | 19 +- .../Modify/RemoveExternalSpaces.cs | 7 +- .../Modify/RemoveInvalidAirPanels.cs | 17 +- .../Modify/RemoveOverlapApertures.cs | 33 +- SAM/SAM.Analytical/Modify/RemoveSpaces.cs | 25 +- .../Modify/RemoveUnusedMaterials.cs | 21 +- SAM/SAM.Analytical/Modify/Replace.cs | 47 +- .../Modify/ReplaceApertureConstruction.cs | 23 +- .../Modify/ReplaceConstruction.cs | 15 +- .../Modify/ReplaceTransparentPanels.cs | 15 +- .../SetConstructionsDefaultPanelType.cs | 15 +- .../Modify/SetDefaultApertureConstruction.cs | 29 +- .../SetDefaultApertureConstructionLayers.cs | 37 +- .../SetDefaultConstructionByPanelType.cs | 11 +- .../SetDefaultConstructionLayerByPanelType.cs | 19 +- .../Modify/SetInternalCondition.cs | 9 +- SAM/SAM.Analytical/Modify/SetOccupantGains.cs | 9 +- SAM/SAM.Analytical/Modify/SimplifyByAngle.cs | 21 +- .../Modify/SplitMaterialsByThickness.cs | 39 +- SAM/SAM.Analytical/Modify/SplitPanels.cs | 21 +- SAM/SAM.Analytical/Modify/SplitSpace.cs | 121 +- .../Modify/TriangulateConcavePanels.cs | 11 +- SAM/SAM.Analytical/Modify/Trim.cs | 19 +- ...dateApertureConstructionsByApertureType.cs | 13 +- .../UpdateApertureConstructionsByName.cs | 13 +- SAM/SAM.Analytical/Modify/UpdateApertures.cs | 13 +- .../Modify/UpdateAreaAndVolume.cs | 19 +- .../Modify/UpdateConstruction.cs | 13 +- .../Modify/UpdateConstructionsByName.cs | 19 +- .../Modify/UpdateConstructionsByPanelType.cs | 11 +- .../Modify/UpdateDaylightFactors.cs | 15 +- SAM/SAM.Analytical/Modify/UpdatePanelTypes.cs | 27 +- SAM/SAM.Analytical/Modify/UpdateSpace.cs | 11 +- SAM/SAM.Analytical/Modify/UpdateSpaceNames.cs | 17 +- .../Modify/UpdateSpacePanelArea.cs | 35 +- SAM/SAM.Analytical/Modify/UpdateWeather.cs | 9 +- SAM/SAM.Analytical/Modify/UpdateZone.cs | 7 +- SAM/SAM.Analytical/Query/Adiabatic.cs | 11 +- SAM/SAM.Analytical/Query/AdjacentSpaces.cs | 21 +- SAM/SAM.Analytical/Query/AdjustPanels.cs | 49 +- SAM/SAM.Analytical/Query/AdjustRoofs.cs | 35 +- SAM/SAM.Analytical/Query/AirFlow.cs | 11 +- SAM/SAM.Analytical/Query/AirSupplyMethod.cs | 7 +- ...rspaceConvectiveHeatTransferCoefficient.cs | 9 +- .../Query/AirspaceIntersurfaceEmittance.cs | 7 +- .../Query/AirspaceRadiativeCoefficient.cs | 7 +- .../Query/AirspaceThermalResistance.cs | 7 +- .../Query/ApertureConstructions.cs | 11 +- SAM/SAM.Analytical/Query/ApertureHost.cs | 9 +- SAM/SAM.Analytical/Query/ApertureHosts.cs | 9 +- SAM/SAM.Analytical/Query/ApertureType.cs | 7 +- SAM/SAM.Analytical/Query/Apertures.cs | 25 +- SAM/SAM.Analytical/Query/Area.cs | 21 +- SAM/SAM.Analytical/Query/Azimuth.cs | 7 +- .../BlackBodySurfaceRadiativeCoefficient.cs | 7 +- SAM/SAM.Analytical/Query/BoundaryType.cs | 25 +- SAM/SAM.Analytical/Query/BuildingHeight.cs | 9 +- SAM/SAM.Analytical/Query/CalculatedArea.cs | 25 +- .../Query/CalculatedEquipmentGain.cs | 7 +- .../Query/CalculatedEquipmentLatentGain.cs | 9 +- .../Query/CalculatedEquipmentSensibleGain.cs | 9 +- .../CalculatedExhaustAirChangesPerHour.cs | 7 +- .../Query/CalculatedExhaustAirFlowPerArea.cs | 7 +- .../CalculatedExhaustAirFlowPerPerson.cs | 7 +- .../Query/CalculatedExhaustAirflow.cs | 7 +- .../Query/CalculatedInfiltrationAirFlow.cs | 7 +- .../Query/CalculatedInfiltrationLatentGain.cs | 11 +- .../CalculatedInfiltrationSensibleGain.cs | 11 +- .../Query/CalculatedLightingGain.cs | 7 +- .../Query/CalculatedOccupancy.cs | 7 +- .../Query/CalculatedOccupancyLatentGain.cs | 11 +- .../Query/CalculatedOutsideSupplyAirflow.cs | 7 +- .../Query/CalculatedPeoplePerArea.cs | 7 +- .../Query/CalculatedPollutantGeneration.cs | 7 +- .../CalculatedSupplyAirChangesPerHour.cs | 7 +- .../Query/CalculatedSupplyAirFlowPerArea.cs | 7 +- .../Query/CalculatedSupplyAirFlowPerPerson.cs | 7 +- .../Query/CalculatedSupplyAirflow.cs | 13 +- SAM/SAM.Analytical/Query/CalculatedVolume.cs | 7 +- SAM/SAM.Analytical/Query/Color.cs | 15 +- SAM/SAM.Analytical/Query/Constructions.cs | 9 +- SAM/SAM.Analytical/Query/CoolingDesignDay.cs | 7 +- .../Query/CoolingDesignRelativeHumidity.cs | 7 +- .../Query/CoolingDesignTemperature.cs | 7 +- SAM/SAM.Analytical/Query/Cut.cs | 31 +- SAM/SAM.Analytical/Query/CutShading.cs | 15 +- SAM/SAM.Analytical/Query/DaylightFactor.cs | 35 +- .../Query/DefaultApertureConstruction.cs | 7 +- .../DefaultApertureConstructionLibrary.cs | 7 +- .../Query/DefaultApertureConstructionName.cs | 7 +- .../Query/DefaultConstruction.cs | 7 +- .../Query/DefaultConstructionLibrary.cs | 7 +- .../Query/DefaultConstructionLibraryPath.cs | 7 +- .../Query/DefaultConstructionManager.cs | 7 +- .../Query/DefaultConstructionName.cs | 7 +- .../Query/DefaultGasMaterial.cs | 9 +- SAM/SAM.Analytical/Query/DefaultGasType.cs | 15 +- .../Query/DefaultHoursOfYear.cs | 7 +- .../Query/DefaultInternalConditionLibrary.cs | 7 +- .../DefaultInternalConditionLibrary_TM59.cs | 7 +- .../Query/DefaultInternalConditionTextMap.cs | 7 +- .../DefaultInternalConditionTextMap_TM59.cs | 7 +- .../Query/DefaultMergeSettings.cs | 7 +- .../Query/DefaultNCMNameCollection.cs | 7 +- SAM/SAM.Analytical/Query/DefaultPath.cs | 9 +- .../Query/DefaultProfileLibrary_TM59.cs | 7 +- .../Query/DefaultSystemTypeLibrary.cs | 7 +- SAM/SAM.Analytical/Query/DesignHeatingLoad.cs | 11 +- SAM/SAM.Analytical/Query/Difference.cs | 29 +- .../Query/DuplicatedSpacesDictionary.cs | 9 +- SAM/SAM.Analytical/Query/EmitterCategory.cs | 9 +- SAM/SAM.Analytical/Query/EmitterTypes.cs | 7 +- SAM/SAM.Analytical/Query/ExposedToSun.cs | 7 +- SAM/SAM.Analytical/Query/Extend.cs | 27 +- SAM/SAM.Analytical/Query/External.cs | 9 +- .../Query/ExternalConstructionLayer.cs | 7 +- .../ExternalConstructionLayerDictionary.cs | 9 +- SAM/SAM.Analytical/Query/ExternalMaterial.cs | 7 +- .../Query/ExternalMaterialDictionary.cs | 7 +- SAM/SAM.Analytical/Query/ExternalPanels.cs | 31 +- .../Query/ExternalPanelsArea.cs | 11 +- SAM/SAM.Analytical/Query/ExternalVector3D.cs | 9 +- SAM/SAM.Analytical/Query/Extrusion.cs | 13 +- SAM/SAM.Analytical/Query/Fill.cs | 37 +- .../Query/FillFloorsAndRoofs.cs | 15 +- SAM/SAM.Analytical/Query/Filter.cs | 31 +- SAM/SAM.Analytical/Query/FilterByElevation.cs | 9 +- .../Query/FilteringSAMObjects.cs | 17 +- SAM/SAM.Analytical/Query/FindSimilar.cs | 7 +- .../Query/FirstConstructionLayer.cs | 7 +- SAM/SAM.Analytical/Query/FirstMaterial.cs | 7 +- SAM/SAM.Analytical/Query/Fit.cs | 35 +- SAM/SAM.Analytical/Query/FixEdges.cs | 29 +- .../FrameApertureConstructionUniqueName.cs | 7 +- .../Query/GeometricalFloorPanels.cs | 9 +- SAM/SAM.Analytical/Query/GrashofNumber.cs | 7 +- SAM/SAM.Analytical/Query/Ground.cs | 9 +- SAM/SAM.Analytical/Query/HasMaterial.cs | 9 +- .../Query/HeatTransferCoefficient.cs | 7 +- SAM/SAM.Analytical/Query/HeatingDesignDay.cs | 7 +- .../Query/HeatingDesignRelativeHumidity.cs | 7 +- .../Query/HeatingDesignTemperature.cs | 7 +- SAM/SAM.Analytical/Query/Height.cs | 9 +- SAM/SAM.Analytical/Query/IJSAMObjects.cs | 114 ++ SAM/SAM.Analytical/Query/Id.cs | 9 +- SAM/SAM.Analytical/Query/InRange.cs | 13 +- SAM/SAM.Analytical/Query/Inside.cs | 15 +- SAM/SAM.Analytical/Query/Internal.cs | 9 +- .../Query/InternalConditionParameter.cs | 7 +- .../Query/InternalConstructionLayer.cs | 7 +- .../InternalConstructionLayerDictionary.cs | 9 +- SAM/SAM.Analytical/Query/InternalMaterial.cs | 7 +- .../Query/InternalMaterialDictionary.cs | 7 +- .../Query/IsMechanicalVentilation.cs | 13 +- SAM/SAM.Analytical/Query/IsPerimeter.cs | 17 +- SAM/SAM.Analytical/Query/IsValid.cs | 7 +- .../Query/LastConstructionLayer.cs | 7 +- SAM/SAM.Analytical/Query/LoadType.cs | 7 +- SAM/SAM.Analytical/Query/Material.cs | 7 +- SAM/SAM.Analytical/Query/MaterialType.cs | 13 +- SAM/SAM.Analytical/Query/Materials.cs | 13 +- .../Query/MaxIndoorComfortTemperatures.cs | 11 +- SAM/SAM.Analytical/Query/MaxThickness.cs | 11 +- .../Query/MechanicalSystemCategory.cs | 11 +- .../Query/MechanicalSystemTypes.cs | 13 +- SAM/SAM.Analytical/Query/MechanicalSystems.cs | 13 +- SAM/SAM.Analytical/Query/Merge.cs | 12 +- .../Query/MergeCoplanarApertures.cs | 57 +- .../Query/MergeCoplanarPanels.cs | 15 +- .../Query/MergeCoplanarPanelsBySpace.cs | 31 +- .../Query/MergeOverlapApertures.cs | 43 +- .../Query/MergeOverlapPanels.cs | 19 +- SAM/SAM.Analytical/Query/MinElevation.cs | 9 +- .../Query/MinElevationDictionary.cs | 15 +- .../Query/MinIndoorComfortTemperatures.cs | 11 +- .../Query/MissingInternalConditionsNames.cs | 23 +- .../Query/MissingMaterialsNames.cs | 29 +- .../Query/MissingProfileNameDictionary.cs | 25 +- SAM/SAM.Analytical/Query/Name.cs | 19 +- SAM/SAM.Analytical/Query/New/Adiabatic.cs | 17 +- SAM/SAM.Analytical/Query/New/Azimuth.cs | 7 +- SAM/SAM.Analytical/Query/New/BoundaryType.cs | 19 +- .../Query/New/CalculatedArea.cs | 7 +- .../Query/New/CalculatedExhaustAirflow.cs | 7 +- .../New/CalculatedOutsideSupplyAirflow.cs | 7 +- .../Query/New/CalculatedSupplyAirflow.cs | 7 +- .../Query/New/CalculatedVolume.cs | 7 +- SAM/SAM.Analytical/Query/New/Color.cs | 15 +- .../Query/New/CoolingDesignTemperature.cs | 9 +- SAM/SAM.Analytical/Query/New/Cut.cs | 19 +- .../Query/New/DefaultHostPartitionType.cs | 11 +- .../New/DefaultHostPartitionTypeLibrary.cs | 7 +- .../Query/New/DefaultMaterialLibrary.cs | 7 +- .../Query/New/DefaultOpeningType.cs | 7 +- .../Query/New/DefaultOpeningTypeLibrary.cs | 7 +- .../Query/New/DefaultProfileLibrary.cs | 7 +- .../Query/New/DesignHeatingLoad.cs | 9 +- .../Query/New/DuplicatedSpacesDictionary.cs | 9 +- SAM/SAM.Analytical/Query/New/Extend.cs | 27 +- SAM/SAM.Analytical/Query/New/External.cs | 9 +- .../Query/New/ExternalMaterial.cs | 7 +- .../Query/New/ExternalMaterialLayer.cs | 9 +- .../Query/New/ExternalPartitions.cs | 33 +- .../Query/New/ExternalPartitionsArea.cs | 11 +- .../Query/New/ExternalVector3D.cs | 13 +- SAM/SAM.Analytical/Query/New/Extrusion.cs | 11 +- SAM/SAM.Analytical/Query/New/Face3D.cs | 11 +- SAM/SAM.Analytical/Query/New/Fill.cs | 39 +- SAM/SAM.Analytical/Query/New/FirstMaterial.cs | 7 +- .../Query/New/FirstMaterialLayer.cs | 7 +- SAM/SAM.Analytical/Query/New/Fit.cs | 35 +- SAM/SAM.Analytical/Query/New/FixEdges.cs | 37 +- SAM/SAM.Analytical/Query/New/FlipNormal.cs | 15 +- SAM/SAM.Analytical/Query/New/HasMaterial.cs | 9 +- .../Query/New/HeatingDesignTemperature.cs | 7 +- .../Query/New/HostPartitionCategory.cs | 13 +- .../Query/New/InternalMaterialDictionary.cs | 7 +- .../Query/New/InternalMaterialLayer.cs | 7 +- .../New/InternalMaterialLayerDictionary.cs | 13 +- SAM/SAM.Analytical/Query/New/IsValid.cs | 11 +- SAM/SAM.Analytical/Query/New/Material.cs | 7 +- SAM/SAM.Analytical/Query/New/Materials.cs | 27 +- SAM/SAM.Analytical/Query/New/MergeCoplanar.cs | 15 +- SAM/SAM.Analytical/Query/New/MinElevation.cs | 11 +- .../Query/New/NormalDictionary.cs | 7 +- .../Query/New/OpeningAnalyticalType.cs | 13 +- .../Query/New/PartitionAnalyticalType.cs | 11 +- SAM/SAM.Analytical/Query/New/Profiles.cs | 7 +- SAM/SAM.Analytical/Query/New/Project.cs | 13 +- .../Query/New/SpaceDictionary.cs | 10 +- SAM/SAM.Analytical/Query/New/Split.cs | 21 +- .../Query/New/SplitByInternalEdges.cs | 11 +- SAM/SAM.Analytical/Query/New/Sum.cs | 7 +- SAM/SAM.Analytical/Query/New/Transparent.cs | 7 +- SAM/SAM.Analytical/Query/New/Triangulate.cs | 11 +- SAM/SAM.Analytical/Query/New/Type.cs | 7 +- SAM/SAM.Analytical/Query/New/UniqueIndex.cs | 7 +- SAM/SAM.Analytical/Query/New/Width.cs | 7 +- SAM/SAM.Analytical/Query/Next.cs | 17 +- SAM/SAM.Analytical/Query/NextId.cs | 19 +- SAM/SAM.Analytical/Query/NormalDictionary.cs | 9 +- SAM/SAM.Analytical/Query/NusseltNumber.cs | 7 +- SAM/SAM.Analytical/Query/OccupancyGain.cs | 7 +- .../Query/OccupancyGainPerPerson.cs | 7 +- .../Query/OccupancyLatentGain.cs | 7 +- .../Query/OccupancySensibleGain.cs | 7 +- SAM/SAM.Analytical/Query/Offset.cs | 9 +- .../Query/OffsetAperturesOnEdge.cs | 11 +- SAM/SAM.Analytical/Query/Openable.cs | 9 +- SAM/SAM.Analytical/Query/OpeningLocation.cs | 9 +- SAM/SAM.Analytical/Query/Overlap.cs | 7 +- SAM/SAM.Analytical/Query/OverlapPanels.cs | 7 +- .../PaneApertureConstructionUniqueName.cs | 7 +- SAM/SAM.Analytical/Query/PanelGroup.cs | 7 +- SAM/SAM.Analytical/Query/PanelType.cs | 23 +- SAM/SAM.Analytical/Query/Panels.cs | 15 +- SAM/SAM.Analytical/Query/PanelsByFace3D.cs | 39 +- SAM/SAM.Analytical/Query/Point3Ds.cs | 11 +- SAM/SAM.Analytical/Query/PrandtlNumber.cs | 7 +- SAM/SAM.Analytical/Query/Profile.cs | 7 +- SAM/SAM.Analytical/Query/ProfileGroup.cs | 9 +- SAM/SAM.Analytical/Query/Profiles.cs | 11 +- SAM/SAM.Analytical/Query/Rectangular.cs | 7 +- .../Query/ReplaceNameSpecialCharacters.cs | 7 +- SAM/SAM.Analytical/Query/Rescale.cs | 35 +- .../Query/ResourcesDirectory.cs | 7 +- SAM/SAM.Analytical/Query/RiserName.cs | 9 +- SAM/SAM.Analytical/Query/RiserNamePrefix.cs | 9 +- .../Query/RiserNameSpaceParameter.cs | 13 +- SAM/SAM.Analytical/Query/SAMObject.cs | 15 +- SAM/SAM.Analytical/Query/SectionDictionary.cs | 23 +- SAM/SAM.Analytical/Query/Shell.cs | 9 +- SAM/SAM.Analytical/Query/ShellDictionary.cs | 11 +- SAM/SAM.Analytical/Query/Shells.cs | 19 +- SAM/SAM.Analytical/Query/Simplify.cs | 27 +- .../Query/SingleOpeningProperties.cs | 7 +- SAM/SAM.Analytical/Query/SizingMethod.cs | 7 +- SAM/SAM.Analytical/Query/SnapByElevations.cs | 75 +- SAM/SAM.Analytical/Query/SnapByEnds.cs | 21 +- .../Query/SnapByIntersections.cs | 37 +- SAM/SAM.Analytical/Query/SnapByOffset.cs | 7 +- SAM/SAM.Analytical/Query/SnapByPlanes.cs | 13 +- SAM/SAM.Analytical/Query/SnapByPoints.cs | 7 +- SAM/SAM.Analytical/Query/SpaceShells.cs | 7 +- SAM/SAM.Analytical/Query/Spaces.cs | 17 +- SAM/SAM.Analytical/Query/SpacingDictionary.cs | 23 +- .../Query/SpecificDesignLoad.cs | 7 +- .../Query/SpecificHeatTransferGain.cs | 7 +- SAM/SAM.Analytical/Query/SpecificLoad.cs | 7 +- .../Query/SpecificOccupancySensibleGain.cs | 7 +- .../Query/SplitByConcaveEdges.cs | 19 +- .../Query/SplitByInternalEdges.cs | 19 +- SAM/SAM.Analytical/Query/Sum.cs | 7 +- .../SystemTypeInternalConditionParameter.cs | 7 +- SAM/SAM.Analytical/Query/Systems.cs | 9 +- SAM/SAM.Analytical/Query/TemperatureRange.cs | 9 +- SAM/SAM.Analytical/Query/Text.cs | 7 +- SAM/SAM.Analytical/Query/Tilt.cs | 7 +- SAM/SAM.Analytical/Query/Transparent.cs | 13 +- SAM/SAM.Analytical/Query/TransparentPanels.cs | 11 +- SAM/SAM.Analytical/Query/Triangulate.cs | 41 +- .../Query/TryGetConstruction.cs | 9 +- SAM/SAM.Analytical/Query/TryGetEnums.cs | 13 +- .../Query/TryGetInternalCondition.cs | 9 +- .../Query/TryGetInternalConditions.cs | 9 +- .../Query/TryGetSeasonProfiles.cs | 13 +- SAM/SAM.Analytical/Query/UniqueName.cs | 15 +- .../Query/UniqueNameDecomposition.cs | 25 +- SAM/SAM.Analytical/Query/UniqueNamePrefix.cs | 7 +- .../Query/UpdateApertureConstructions.cs | 21 +- .../UpdateConstructionLayersByPanelType.cs | 7 +- .../Query/UpdateConstructions.cs | 41 +- .../Query/UpdateConstructionsByPanels.cs | 33 +- .../Query/UpdateHeatTransferCoefficients.cs | 25 +- SAM/SAM.Analytical/Query/UpdateNormals.cs | 21 +- .../Query/VentilationSystems.cs | 9 +- SAM/SAM.Analytical/Query/Volume.cs | 11 +- SAM/SAM.Analytical/Query/Width.cs | 7 +- SAM/SAM.Analytical/Query/Zone.cs | 9 +- SAM/SAM.Analytical/Query/ZoneType.cs | 7 +- SAM/SAM.Analytical/Variables/FluidProperty.cs | 5 +- SAM/SAM.Analytical/Variables/HourOfYear.cs | 5 +- SAM/SAM.Architectural/Classes/Level.cs | 7 +- .../Classes/MaterialLayer.cs | 7 +- .../Classes/PlanarTerrain.cs | 7 +- SAM/SAM.Architectural/Classes/Terrain.cs | 7 +- SAM/SAM.Architectural/Create/Level.cs | 7 +- SAM/SAM.Architectural/Create/Levels.cs | 7 +- SAM/SAM.Architectural/Create/Log.cs | 7 +- .../Create/MaterialLayers.cs | 9 +- SAM/SAM.Architectural/Create/PlanarTerrain.cs | 9 +- .../Interfaces/IArchitecturalObject.cs | 5 +- SAM/SAM.Architectural/Interfaces/ITerrain.cs | 5 +- .../Query/LevelsDictionary.cs | 17 +- SAM/SAM.Architectural/Query/Material.cs | 7 +- SAM/SAM.Architectural/Query/MaterialType.cs | 7 +- SAM/SAM.Architectural/Query/Materials.cs | 11 +- .../Attributes/Enum/AssociatedTypes.cs | 5 +- SAM/SAM.Core/Attributes/Enum/Operator.cs | 5 +- .../Parameter/DoubleParameterValue.cs | 5 +- .../Parameter/IntegerParameterValue.cs | 5 +- .../Parameter/NullableParameterValue.cs | 5 +- .../Parameter/ParameterProperties.cs | 5 +- .../Attributes/Parameter/ParameterValue.cs | 7 +- .../Parameter/SAMObjectParameterValue.cs | 17 +- SAM/SAM.Core/Classes/Base/AnyOf.cs | 72 +- SAM/SAM.Core/Classes/Base/Category.cs | 27 +- .../Classes/Base/EnumParameterData.cs | 5 +- SAM/SAM.Core/Classes/Base/Group.cs | 7 +- SAM/SAM.Core/Classes/Base/IntegerId.cs | 11 +- SAM/SAM.Core/Classes/Base/LongId.cs | 11 +- SAM/SAM.Core/Classes/Base/ParameterData.cs | 5 +- SAM/SAM.Core/Classes/Base/ParameterSet.cs | 15 +- .../Classes/Base/ParameterizedSAMObject.cs | 13 +- SAM/SAM.Core/Classes/Base/Range.cs | 17 +- SAM/SAM.Core/Classes/Base/Result.cs | 9 +- SAM/SAM.Core/Classes/Base/SAMColor.cs | 11 +- SAM/SAM.Core/Classes/Base/SAMInstance.cs | 11 +- SAM/SAM.Core/Classes/Base/SAMObject.cs | 23 +- SAM/SAM.Core/Classes/Base/SAMObjectWrapper.cs | 9 +- SAM/SAM.Core/Classes/Base/SAMType.cs | 7 +- SAM/SAM.Core/Classes/Base/StartupOptions.cs | 5 +- SAM/SAM.Core/Classes/Base/Tag.cs | 23 +- SAM/SAM.Core/Classes/Base/Types.cs | 27 +- SAM/SAM.Core/Classes/Base/ZipArchiveInfo.cs | 7 +- .../Classes/Collection/GuidCollection.cs | 5 +- .../Classes/Collection/IndexedDoubles.cs | 31 +- .../Classes/Collection/IndexedObjects.cs | 65 +- .../Classes/Collection/SAMCollection.cs | 21 +- .../Classes/Collection/SAMJsonCollection.cs | 9 +- SAM/SAM.Core/Classes/Connection/Connection.cs | 5 +- .../Classes/Connection/ConnectionModel.cs | 5 +- .../DelimitedFile/DelimitedFileReader.cs | 7 +- .../Classes/DelimitedFile/DelimitedFileRow.cs | 9 +- .../DelimitedFile/DelimitedFileTable.cs | 53 +- .../DelimitedFile/DelimitedFileWriter.cs | 7 +- SAM/SAM.Core/Classes/Expression/Command.cs | 17 +- SAM/SAM.Core/Classes/Expression/Expression.cs | 11 +- .../Classes/Expression/ExpressionVariable.cs | 13 +- .../Classes/Filter/ComplexReferenceFilter.cs | 13 +- .../Filter/ComplexReferenceNumberFilter.cs | 21 +- .../Filter/ComplexReferenceTextFilter.cs | 21 +- SAM/SAM.Core/Classes/Filter/EnumFilter.cs | 17 +- SAM/SAM.Core/Classes/Filter/Filter.cs | 5 +- SAM/SAM.Core/Classes/Filter/GuidFilter.cs | 5 +- SAM/SAM.Core/Classes/Filter/LogicalFilter.cs | 5 +- .../Classes/Filter/MultiRelationFilter.cs | 7 +- SAM/SAM.Core/Classes/Filter/NameFilter.cs | 7 +- SAM/SAM.Core/Classes/Filter/NumberFilter.cs | 7 +- .../Classes/Filter/ParameterFilter.cs | 7 +- SAM/SAM.Core/Classes/Filter/RelationFilter.cs | 7 +- SAM/SAM.Core/Classes/Filter/TextFilter.cs | 11 +- SAM/SAM.Core/Classes/Filter/TypeFilter.cs | 7 +- SAM/SAM.Core/Classes/Graph/Graph.cs | 7 +- SAM/SAM.Core/Classes/Graph/GraphEdge.cs | 7 +- SAM/SAM.Core/Classes/Graph/GraphNode.cs | 7 +- SAM/SAM.Core/Classes/Graph/GraphPath.cs | 7 +- SAM/SAM.Core/Classes/Library/SAMLibrary.cs | 9 +- .../Classes/Library/SystemTypeLibrary.cs | 11 +- SAM/SAM.Core/Classes/Log/Log.cs | 17 +- SAM/SAM.Core/Classes/Log/LogRecord.cs | 7 +- SAM/SAM.Core/Classes/Manager/ActionManager.cs | 9 +- .../Classes/Material/FluidMaterial.cs | 9 +- SAM/SAM.Core/Classes/Material/GasMaterial.cs | 11 +- .../Classes/Material/LiquidMaterial.cs | 11 +- SAM/SAM.Core/Classes/Material/Material.cs | 15 +- .../Classes/Material/MaterialLibrary.cs | 9 +- .../Classes/Material/OpaqueMaterial.cs | 7 +- .../Classes/Material/SolidMaterial.cs | 7 +- .../Classes/Material/TransparentMaterial.cs | 9 +- SAM/SAM.Core/Classes/Message/Message.cs | 5 +- SAM/SAM.Core/Classes/Model/Address.cs | 9 +- SAM/SAM.Core/Classes/Model/Location.cs | 9 +- SAM/SAM.Core/Classes/Model/SAMModel.cs | 9 +- .../Classes/Modifier/ComplexModifier.cs | 21 +- .../Modifier/IndexedComplexModifier.cs | 27 +- .../Modifier/IndexedDoublesModifier.cs | 19 +- .../Classes/Modifier/IndexedModifier.cs | 9 +- .../Classes/Modifier/IndexedSimpleModifier.cs | 11 +- .../Classes/Modifier/ModifableValue.cs | 17 +- SAM/SAM.Core/Classes/Modifier/Modifier.cs | 7 +- .../Classes/Modifier/SimpleModifier.cs | 15 +- .../Classes/Modifier/TableModifier.cs | 102 +- .../Classes/Reference/ObjectReference.cs | 29 +- .../Classes/Reference/PathReference.cs | 29 +- .../Classes/Reference/PropertyReference.cs | 27 +- SAM/SAM.Core/Classes/Reference/Reference.cs | 13 +- SAM/SAM.Core/Classes/Relation/Relation.cs | 31 +- .../Classes/Relation/RelationCluster.cs | 39 +- .../Classes/Relation/RelationCollection.cs | 67 +- .../Classes/Relation/RelationModel.cs | 93 +- .../Relation/SAMObjectRelationCluster.cs | 13 +- SAM/SAM.Core/Classes/Relation/TextMap.cs | 41 +- SAM/SAM.Core/Classes/Relation/TypeMap.cs | 29 +- .../Classes/Search/SearchObjectWrapper.cs | 27 +- SAM/SAM.Core/Classes/Search/SearchWrapper.cs | 73 +- SAM/SAM.Core/Convert/ToBitmap/Bitmap.cs | 7 +- SAM/SAM.Core/Convert/ToColor/Color.cs | 13 +- SAM/SAM.Core/Convert/ToCsv/String.cs | 9 +- SAM/SAM.Core/Convert/ToFile/File.cs | 13 +- .../Convert/ToHexadecimal/Hexadecimal.cs | 7 +- SAM/SAM.Core/Convert/ToList/List.cs | 17 +- .../Convert/ToSAM/ComplexReference.cs | 11 +- SAM/SAM.Core/Convert/ToSAM/IJSAMObjects.cs | 9 +- SAM/SAM.Core/Convert/ToSAM/ObjectReference.cs | 35 +- SAM/SAM.Core/Convert/ToString/String.cs | 13 +- SAM/SAM.Core/Convert/ToUint/Uint.cs | 7 +- SAM/SAM.Core/Create/Array.cs | 9 +- SAM/SAM.Core/Create/Category.cs | 19 +- SAM/SAM.Core/Create/Color.cs | 15 +- SAM/SAM.Core/Create/Colors.cs | 9 +- SAM/SAM.Core/Create/Commands.cs | 15 +- SAM/SAM.Core/Create/DelimitedFileRows.cs | 9 +- SAM/SAM.Core/Create/DelimitedFileTable.cs | 9 +- SAM/SAM.Core/Create/Directory.cs | 19 +- SAM/SAM.Core/Create/EnumParameterDatas.cs | 23 +- SAM/SAM.Core/Create/GuidCollection.cs | 11 +- SAM/SAM.Core/Create/IJSAMObject.cs | 5 +- SAM/SAM.Core/Create/IJSAMObjects.cs | 5 +- SAM/SAM.Core/Create/IndexedDoubles.cs | 11 +- SAM/SAM.Core/Create/JArray.cs | 7 +- SAM/SAM.Core/Create/Material.cs | 17 +- SAM/SAM.Core/Create/MaterialLibrary.cs | 7 +- SAM/SAM.Core/Create/Object.cs | 13 +- SAM/SAM.Core/Create/ObjectReference.cs | 9 +- SAM/SAM.Core/Create/ParameterFilter.cs | 11 +- SAM/SAM.Core/Create/ParameterSet.cs | 9 +- SAM/SAM.Core/Create/ParameterSets.cs | 7 +- SAM/SAM.Core/Create/SearchObjectWrapper.cs | 11 +- SAM/SAM.Core/Create/StartupOptions.cs | 5 +- SAM/SAM.Core/Create/TextMap.cs | 9 +- SAM/SAM.Core/Create/TypeMap.cs | 7 +- SAM/SAM.Core/Create/ZipArchiveInfo.cs | 7 +- SAM/SAM.Core/Enums/AboutInfoType.cs | 7 +- SAM/SAM.Core/Enums/AccessType.cs | 7 +- SAM/SAM.Core/Enums/CombineType.cs | 7 +- SAM/SAM.Core/Enums/CountryCode.cs | 5 +- SAM/SAM.Core/Enums/DelimitedFileType.cs | 7 +- SAM/SAM.Core/Enums/Direction.cs | 7 +- SAM/SAM.Core/Enums/FilterLogicalOperator.cs | 7 +- SAM/SAM.Core/Enums/LogRecordType.cs | 7 +- SAM/SAM.Core/Enums/MaterialType.cs | 7 +- SAM/SAM.Core/Enums/MessageType.cs | 7 +- SAM/SAM.Core/Enums/NumberComparisonType.cs | 7 +- .../Enums/Operator/ArithmeticOperator.cs | 7 +- .../Enums/Operator/AssignmentOperator.cs | 7 +- .../Enums/Operator/BitwiseOperator.cs | 7 +- .../Enums/Operator/CommandOperator.cs | 7 +- .../Operator/IncrementAndDecrementOperator.cs | 7 +- .../Enums/Operator/LogicalOperator.cs | 7 +- .../Enums/Operator/RelationalOperator.cs | 7 +- SAM/SAM.Core/Enums/PageOrientation.cs | 7 +- SAM/SAM.Core/Enums/PageSize.cs | 7 +- .../Enums/Parameter/CoreSettingParameter.cs | 7 +- .../Enums/Parameter/LocationParameter.cs | 7 +- .../Enums/Parameter/MaterialParameter.cs | 7 +- .../ParameterizedSAMObjectParameter.cs | 7 +- SAM/SAM.Core/Enums/ParameterType.cs | 9 +- SAM/SAM.Core/Enums/Period.cs | 7 +- SAM/SAM.Core/Enums/RelationType.cs | 7 +- SAM/SAM.Core/Enums/SAMFileType.cs | 7 +- SAM/SAM.Core/Enums/StartupArgument.cs | 5 +- SAM/SAM.Core/Enums/TextComparisonType.cs | 7 +- SAM/SAM.Core/Enums/UTC.cs | 5 +- SAM/SAM.Core/Enums/ValueType.cs | 9 +- SAM/SAM.Core/Enums/Week.cs | 7 +- SAM/SAM.Core/Enums/YesNo.cs | 7 +- SAM/SAM.Core/Interfaces/Base/IDispatch.cs | 5 +- SAM/SAM.Core/Interfaces/Base/IId.cs | 5 +- SAM/SAM.Core/Interfaces/Base/IJSAMObject.cs | 7 +- .../Interfaces/Base/IParameterData.cs | 5 +- .../Base/IParameterizedSAMObject.cs | 7 +- SAM/SAM.Core/Interfaces/Base/IResult.cs | 7 +- SAM/SAM.Core/Interfaces/Base/ISAMInstance.cs | 7 +- SAM/SAM.Core/Interfaces/Base/ISAMObject.cs | 7 +- SAM/SAM.Core/Interfaces/Base/ISAMType.cs | 7 +- SAM/SAM.Core/Interfaces/Base/ISystem.cs | 7 +- SAM/SAM.Core/Interfaces/Base/ISystemType.cs | 7 +- SAM/SAM.Core/Interfaces/Base/ITaggable.cs | 7 +- .../Interfaces/Collection/IIndexedObjects.cs | 7 +- .../DelimitedFile/IDelimitedFileReader.cs | 7 +- .../DelimitedFile/IDelimitedFileWriter.cs | 7 +- SAM/SAM.Core/Interfaces/Filter/IEnumFilter.cs | 7 +- SAM/SAM.Core/Interfaces/Filter/IFilter.cs | 7 +- .../Interfaces/Filter/IMultiRelationFilter.cs | 7 +- .../Interfaces/Filter/INumberFilter.cs | 7 +- .../Interfaces/Filter/IRelationFilter.cs | 7 +- .../Filter/ISAMObjectRelationClusterFilter.cs | 5 +- SAM/SAM.Core/Interfaces/Filter/ITextFilter.cs | 7 +- .../Interfaces/Library/ISAMLibrary.cs | 7 +- SAM/SAM.Core/Interfaces/Material/IMaterial.cs | 9 +- .../Interfaces/Modifier/IComplexModifier.cs | 7 +- .../Modifier/IIndexedComplexModifier.cs | 5 +- .../Interfaces/Modifier/IIndexedModifier.cs | 7 +- .../Interfaces/Modifier/IModifableValue.cs | 7 +- SAM/SAM.Core/Interfaces/Modifier/IModifier.cs | 7 +- .../Interfaces/Modifier/ISimpleModifier.cs | 7 +- .../Interfaces/Reference/IComplexReference.cs | 7 +- .../Interfaces/Reference/IReference.cs | 7 +- .../Interfaces/Relation/IRelationCluster.cs | 7 +- .../Relation/ISAMObjectRelationCluster.cs | 5 +- SAM/SAM.Core/Manager/ActiveManager.cs | 15 +- SAM/SAM.Core/Manager/ActiveSetting.cs | 7 +- SAM/SAM.Core/Manager/Manager.cs | 7 +- SAM/SAM.Core/Manager/Setting.cs | 7 +- SAM/SAM.Core/Modify/Add.cs | 11 +- SAM/SAM.Core/Modify/AddRange.cs | 7 +- SAM/SAM.Core/Modify/Copy.cs | 11 +- SAM/SAM.Core/Modify/CopyParameterSets.cs | 11 +- SAM/SAM.Core/Modify/CopyValues.cs | 23 +- SAM/SAM.Core/Modify/Delete.cs | 7 +- SAM/SAM.Core/Modify/DeleteObject.cs | 7 +- SAM/SAM.Core/Modify/District.cs | 13 +- SAM/SAM.Core/Modify/Extend.cs | 7 +- SAM/SAM.Core/Modify/Log.cs | 15 +- SAM/SAM.Core/Modify/MatchLength.cs | 7 +- SAM/SAM.Core/Modify/ReleaseCOMObject.cs | 7 +- SAM/SAM.Core/Modify/RemoveValue.cs | 9 +- SAM/SAM.Core/Modify/Reorder.cs | 7 +- SAM/SAM.Core/Modify/Replace.cs | 11 +- SAM/SAM.Core/Modify/SetValue.cs | 21 +- SAM/SAM.Core/Modify/UpdateByType.cs | 13 +- SAM/SAM.Core/Query/AboutInfoTypeText.cs | 7 +- SAM/SAM.Core/Query/ActiveObject.cs | 7 +- SAM/SAM.Core/Query/AlmostEqual.cs | 7 +- SAM/SAM.Core/Query/Array.cs | 13 +- .../Query/AssociatedTypesDictionary.cs | 11 +- SAM/SAM.Core/Query/BaseFilter.cs | 7 +- SAM/SAM.Core/Query/BoundedIndex.cs | 17 +- SAM/SAM.Core/Query/Brightness.cs | 7 +- SAM/SAM.Core/Query/COMObjectTypeName.cs | 9 +- SAM/SAM.Core/Query/Calculate.cs | 55 +- SAM/SAM.Core/Query/CamelCase.cs | 7 +- SAM/SAM.Core/Query/Categories.cs | 13 +- SAM/SAM.Core/Query/Category.cs | 7 +- SAM/SAM.Core/Query/Clamp.cs | 9 +- SAM/SAM.Core/Query/Clone.cs | 23 +- SAM/SAM.Core/Query/Combine.cs | 29 +- SAM/SAM.Core/Query/CommandMask.cs | 9 +- SAM/SAM.Core/Query/Compare.cs | 25 +- SAM/SAM.Core/Query/Compress.cs | 15 +- SAM/SAM.Core/Query/ComputeHash.cs | 7 +- SAM/SAM.Core/Query/Copy.cs | 13 +- SAM/SAM.Core/Query/Count.cs | 9 +- SAM/SAM.Core/Query/CountryCode.cs | 7 +- SAM/SAM.Core/Query/CurrentVersion.cs | 7 +- SAM/SAM.Core/Query/CustomAttribute.cs | 11 +- SAM/SAM.Core/Query/DayOfYear.cs | 7 +- SAM/SAM.Core/Query/Decompress.cs | 11 +- SAM/SAM.Core/Query/DefaultAddress.cs | 7 +- SAM/SAM.Core/Query/DefaultLocation.cs | 7 +- SAM/SAM.Core/Query/Description.cs | 7 +- SAM/SAM.Core/Query/Descriptions.cs | 11 +- SAM/SAM.Core/Query/Dictionary.cs | 7 +- SAM/SAM.Core/Query/Double.cs | 13 +- SAM/SAM.Core/Query/Enum.cs | 13 +- SAM/SAM.Core/Query/Enums.cs | 31 +- SAM/SAM.Core/Query/Equals.cs | 7 +- SAM/SAM.Core/Query/Error/MeanAbsoluteError.cs | 7 +- .../Error/MeanAbsolutePercentageError.cs | 7 +- .../Query/Error/MeanDifferenceError.cs | 9 +- SAM/SAM.Core/Query/Error/MeanError.cs | 9 +- .../Error/NormalizedRootMeanSquaredError.cs | 10 +- .../Query/Error/RootMeanSquaredError.cs | 7 +- .../SymmetricMeanAbsolutePercentageError.cs | 7 +- .../Query/ExecutingAssemblyDirectory.cs | 9 +- SAM/SAM.Core/Query/FileExists.cs | 7 +- SAM/SAM.Core/Query/Filter.cs | 25 +- SAM/SAM.Core/Query/FindByType.cs | 15 +- SAM/SAM.Core/Query/FindIndexs.cs | 21 +- SAM/SAM.Core/Query/FullName.cs | 7 +- SAM/SAM.Core/Query/FullTypeName.cs | 13 +- SAM/SAM.Core/Query/GetMethodInfo.cs | 19 +- SAM/SAM.Core/Query/Graft.cs | 11 +- SAM/SAM.Core/Query/Guid.cs | 9 +- SAM/SAM.Core/Query/HashCode.cs | 7 +- SAM/SAM.Core/Query/HourOfDay.cs | 7 +- SAM/SAM.Core/Query/HourOfYear.cs | 7 +- SAM/SAM.Core/Query/HoursOfYear.cs | 17 +- SAM/SAM.Core/Query/IndexOf.cs | 7 +- SAM/SAM.Core/Query/Indexes.cs | 17 +- SAM/SAM.Core/Query/IndexesOf.cs | 13 +- SAM/SAM.Core/Query/IsHex.cs | 7 +- SAM/SAM.Core/Query/IsNullable.cs | 7 +- SAM/SAM.Core/Query/IsNumeric.cs | 7 +- SAM/SAM.Core/Query/IsValid.cs | 11 +- SAM/SAM.Core/Query/IsValidEmail.cs | 7 +- SAM/SAM.Core/Query/IsValidHash.cs | 13 +- SAM/SAM.Core/Query/JArray.cs | 11 +- SAM/SAM.Core/Query/JSAMObject.cs | 13 +- SAM/SAM.Core/Query/Label.cs | 7 +- SAM/SAM.Core/Query/LatestVersion.cs | 13 +- SAM/SAM.Core/Query/Lerp.cs | 7 +- SAM/SAM.Core/Query/Lerps.cs | 9 +- SAM/SAM.Core/Query/Locked.cs | 7 +- .../LogarithmicMeanTemperatureDifference.cs | 11 +- SAM/SAM.Core/Query/Mask.cs | 7 +- SAM/SAM.Core/Query/MaterialType.cs | 7 +- SAM/SAM.Core/Query/Max.cs | 13 +- SAM/SAM.Core/Query/MemoryStream.cs | 7 +- SAM/SAM.Core/Query/MethodInfo.cs | 11 +- SAM/SAM.Core/Query/MethodInfos.cs | 25 +- SAM/SAM.Core/Query/Min.cs | 13 +- SAM/SAM.Core/Query/Name.cs | 9 +- SAM/SAM.Core/Query/Names.cs | 19 +- SAM/SAM.Core/Query/Next.cs | 13 +- SAM/SAM.Core/Query/NextDouble.cs | 7 +- SAM/SAM.Core/Query/Operator.cs | 7 +- SAM/SAM.Core/Query/Opposite.cs | 9 +- SAM/SAM.Core/Query/ParameterSet.cs | 9 +- SAM/SAM.Core/Query/ParseDouble.cs | 9 +- SAM/SAM.Core/Query/ParseInt.cs | 9 +- SAM/SAM.Core/Query/Paths.cs | 11 +- SAM/SAM.Core/Query/Period.cs | 15 +- SAM/SAM.Core/Query/Permutations.cs | 15 +- SAM/SAM.Core/Query/Ping.cs | 9 +- SAM/SAM.Core/Query/Previous.cs | 11 +- SAM/SAM.Core/Query/QuotedText.cs | 11 +- SAM/SAM.Core/Query/RangeDictionary.cs | 11 +- SAM/SAM.Core/Query/ReadAccess.cs | 9 +- SAM/SAM.Core/Query/RelationType.cs | 15 +- SAM/SAM.Core/Query/Repeat.cs | 17 +- .../Query/ReplaceSpecialCharacters.cs | 9 +- SAM/SAM.Core/Query/ResourcesDirectory.cs | 11 +- SAM/SAM.Core/Query/Round.cs | 7 +- SAM/SAM.Core/Query/SAMFileType.cs | 11 +- SAM/SAM.Core/Query/Search.cs | 21 +- SAM/SAM.Core/Query/Separator.cs | 7 +- SAM/SAM.Core/Query/ShortText.cs | 19 +- SAM/SAM.Core/Query/Similar.cs | 11 +- SAM/SAM.Core/Query/StartProcess.cs | 9 +- SAM/SAM.Core/Query/Tag.cs | 11 +- SAM/SAM.Core/Query/TemplatesDirectory.cs | 13 +- SAM/SAM.Core/Query/Text.cs | 9 +- SAM/SAM.Core/Query/Texts.cs | 9 +- SAM/SAM.Core/Query/Tolerance.cs | 7 +- SAM/SAM.Core/Query/Transpose.cs | 7 +- SAM/SAM.Core/Query/TryCompute.cs | 7 +- SAM/SAM.Core/Query/TryConvert.cs | 45 +- SAM/SAM.Core/Query/TryGetEnum.cs | 15 +- SAM/SAM.Core/Query/TryGetFieldValue.cs | 7 +- SAM/SAM.Core/Query/TryGetJToken.cs | 9 +- SAM/SAM.Core/Query/TryGetObjects.cs | 17 +- .../Query/TryGetTypeNameAndAssemblyName.cs | 7 +- SAM/SAM.Core/Query/TryGetValue.cs | 23 +- SAM/SAM.Core/Query/TryInvokeDeclaredMethod.cs | 7 +- SAM/SAM.Core/Query/TryInvokeMethod.cs | 7 +- SAM/SAM.Core/Query/TryInvokeRuntimeMethod.cs | 7 +- SAM/SAM.Core/Query/TryParseDouble.cs | 9 +- SAM/SAM.Core/Query/TryParseGuids.cs | 17 +- SAM/SAM.Core/Query/TryParseInt.cs | 9 +- SAM/SAM.Core/Query/Type.cs | 19 +- SAM/SAM.Core/Query/TypeDictionary.cs | 9 +- SAM/SAM.Core/Query/TypeName.cs | 9 +- SAM/SAM.Core/Query/Types.cs | 15 +- SAM/SAM.Core/Query/UTC.cs | 25 +- SAM/SAM.Core/Query/UniqueTypes.cs | 9 +- SAM/SAM.Core/Query/UserDocumentsDirectory.cs | 7 +- SAM/SAM.Core/Query/UserFriendlyName.cs | 7 +- SAM/SAM.Core/Query/UserFriendlyNames.cs | 7 +- SAM/SAM.Core/Query/UserSAMDirectory.cs | 7 +- .../Query/UserSAMTemporaryDirectory.cs | 7 +- SAM/SAM.Core/Query/ValidFileName.cs | 7 +- SAM/SAM.Core/Query/ValidTypes.cs | 7 +- SAM/SAM.Core/Query/Value.cs | 11 +- SAM/SAM.Core/Query/ValueType.cs | 21 +- SAM/SAM.Core/Query/VapourizationLatentHeat.cs | 9 +- SAM/SAM.Core/Query/WaitToUnlock.cs | 13 +- SAM/SAM.Core/Query/Weekday.cs | 9 +- SAM/SAM.Core/Query/Weekend.cs | 7 +- SAM/SAM.Core/Query/Write.cs | 7 +- SAM/SAM.Core/Query/WriteAccess.cs | 9 +- SAM/SAM.Core/Variables/Link.cs | 5 +- SAM/SAM.Core/Variables/Rounding.cs | 5 +- SAM/SAM.Core/Variables/Tolerance.cs | 7 +- .../Documentation/Samples/Query/Sample.cs | 7 +- .../Geometry/Base/Classes/Face.cs | 23 +- .../Geometry/Base/Classes/PointGraph.cs | 69 +- .../Geometry/Base/Classes/PointGraphEdge.cs | 15 +- .../Geometry/Base/Classes/SAMGeometry.cs | 7 +- .../Geometry/Base/Create/ISAMGeometries.cs | 7 +- .../Geometry/Base/Create/ISAMGeometry.cs | 7 +- .../Geometry/Base/Create/JArray.cs | 7 +- .../Geometry/Base/Enums/Alignment.cs | 7 +- .../Geometry/Base/Enums/AlignmentPoint.cs | 7 +- .../Geometry/Base/Enums/Corner.cs | 7 +- .../Geometry/Base/Enums/Dimension.cs | 7 +- .../Base/Enums/EdgeOrientationMethod.cs | 7 +- .../Geometry/Base/Enums/LineFormulaForm.cs | 7 +- .../Geometry/Base/Enums/Orientation.cs | 7 +- .../Geometry/Base/Enums/Padding.cs | 7 +- .../Geometry/Base/Enums/PointConnectMethod.cs | 7 +- .../Geometry/Base/Enums/VerticalPosition.cs | 7 +- .../Geometry/Base/Interfaces/IMesh.cs | 7 +- .../Geometry/Base/Interfaces/IPoint.cs | 7 +- .../Geometry/Base/Interfaces/IReversible.cs | 7 +- .../Geometry/Base/Interfaces/ISAMGeometry.cs | 7 +- .../Geometry/Base/Query/Opposite.cs | 7 +- .../Geometry/Planar/Classes/BoundingBox2D.cs | 7 +- .../Geometry/Planar/Classes/Circle2D.cs | 11 +- .../Planar/Classes/ConvexHullComparer.cs | 7 +- .../Planar/Classes/CoordinateSystem2D.cs | 17 +- .../Geometry/Planar/Classes/Ellipse2D.cs | 11 +- .../Geometry/Planar/Classes/Face2D.cs | 11 +- .../Geometry/Planar/Classes/Line2D.cs | 15 +- .../Geometry/Planar/Classes/Mesh2D.cs | 11 +- .../Geometry/Planar/Classes/Point2D.cs | 23 +- .../Geometry/Planar/Classes/Point2DGraph.cs | 7 +- .../Geometry/Planar/Classes/Polycurve2D.cs | 7 +- .../Planar/Classes/PolycurveLoop2D.cs | 7 +- .../Geometry/Planar/Classes/Polygon2D.cs | 11 +- .../Geometry/Planar/Classes/Polyline2D.cs | 17 +- .../Geometry/Planar/Classes/Rectangle2D.cs | 11 +- .../Planar/Classes/SAMGeometry2DGroup.cs | 49 +- .../Geometry/Planar/Classes/Segment2D.cs | 15 +- .../Planar/Classes/Solver2D/Solver2D.cs | 17 +- .../Planar/Classes/Solver2D/Solver2DData.cs | 7 +- .../Planar/Classes/Solver2D/Solver2DResult.cs | 11 +- .../Classes/Solver2D/Solver2DSettings.cs | 5 +- .../Geometry/Planar/Classes/Transform2D.cs | 9 +- .../Planar/Classes/TransformGroup2D.cs | 27 +- .../Geometry/Planar/Classes/Triangle2D.cs | 11 +- .../Geometry/Planar/Classes/Vector2D.cs | 17 +- .../Planar/Convert/ToNTS/Coordinate.cs | 7 +- .../Planar/Convert/ToNTS/Coordinates.cs | 7 +- .../Geometry/Planar/Convert/ToNTS/Geometry.cs | 13 +- .../Planar/Convert/ToNTS/LineString.cs | 9 +- .../Planar/Convert/ToNTS/LinearRing.cs | 7 +- .../Planar/Convert/ToNTS/MultiPolygon.cs | 9 +- .../Geometry/Planar/Convert/ToNTS/Point.cs | 7 +- .../Geometry/Planar/Convert/ToNTS/Polygon.cs | 7 +- .../Geometry/Planar/Convert/ToNTS/Polygons.cs | 11 +- .../Geometry/Planar/Convert/ToSAM/Face2D.cs | 7 +- .../Geometry/Planar/Convert/ToSAM/Face2Ds.cs | 11 +- .../Planar/Convert/ToSAM/ISAMGeometry2D.cs | 9 +- .../Planar/Convert/ToSAM/ISAMGeometry2Ds.cs | 17 +- .../Geometry/Planar/Convert/ToSAM/Point2D.cs | 9 +- .../Geometry/Planar/Convert/ToSAM/Point2Ds.cs | 13 +- .../Planar/Convert/ToSAM/Polygon2D.cs | 11 +- .../Planar/Convert/ToSAM/Polygon2Ds.cs | 7 +- .../Planar/Convert/ToSAM/Polyline2D.cs | 7 +- .../Planar/Convert/ToSAM/Polyline2Ds.cs | 7 +- .../Geometry/Planar/Create/AdjacencyGraph.cs | 13 +- .../Geometry/Planar/Create/BoundingBox2D.cs | 9 +- .../Geometry/Planar/Create/Face2D.cs | 9 +- .../Geometry/Planar/Create/Face2Ds.cs | 37 +- .../Geometry/Planar/Create/IClosed2D.cs | 13 +- .../Geometry/Planar/Create/ICurve2D.cs | 7 +- .../Geometry/Planar/Create/Line2D.cs | 7 +- .../Geometry/Planar/Create/LinearEquation.cs | 9 +- .../Geometry/Planar/Create/Mesh2D.cs | 9 +- .../Geometry/Planar/Create/Point2D.cs | 7 +- .../Geometry/Planar/Create/Point2Ds.cs | 13 +- .../Geometry/Planar/Create/Polygon2D.cs | 11 +- .../Geometry/Planar/Create/Polygon2Ds.cs | 31 +- .../Geometry/Planar/Create/Polyline2D.cs | 21 +- .../Geometry/Planar/Create/Polyline2Ds.cs | 17 +- .../Planar/Create/PolynomialEquation.cs | 11 +- .../Geometry/Planar/Create/Rectangle2D.cs | 7 +- .../Geometry/Planar/Create/Segment2D.cs | 7 +- .../Geometry/Planar/Create/Segment2Ds.cs | 19 +- .../Geometry/Planar/Create/UndirectedGraph.cs | 7 +- .../Geometry/Planar/Create/Vector2D.cs | 13 +- .../Planar/Interfaces/IBoundable2D.cs | 7 +- .../Geometry/Planar/Interfaces/IClosed2D.cs | 7 +- .../Geometry/Planar/Interfaces/ICurvable2D.cs | 7 +- .../Geometry/Planar/Interfaces/ICurve2D.cs | 7 +- .../Geometry/Planar/Interfaces/IMovable2D.cs | 7 +- .../Planar/Interfaces/ISAMGeometry2D.cs | 7 +- .../Planar/Interfaces/ISegmentable2D.cs | 7 +- .../Planar/Interfaces/ITransform2D.cs | 7 +- .../Geometry/Planar/Modify/Add.cs | 15 +- .../Geometry/Planar/Modify/Connect.cs | 23 +- .../Geometry/Planar/Modify/District.cs | 9 +- .../Geometry/Planar/Modify/Draw.cs | 7 +- .../Geometry/Planar/Modify/InsertClosest.cs | 9 +- .../Planar/Modify/JoinByIntersections.cs | 19 +- .../Geometry/Planar/Modify/JoinInRange.cs | 9 +- .../Geometry/Planar/Modify/MergeOverlaps.cs | 31 +- .../Geometry/Planar/Modify/Mirror.cs | 7 +- .../Geometry/Planar/Modify/Move.cs | 7 +- .../Geometry/Planar/Modify/OrientByEnds.cs | 7 +- .../Planar/Modify/RemoveAlmostSimilar.cs | 7 +- .../Geometry/Planar/Modify/RemoveSimilar.cs | 13 +- .../Geometry/Planar/Modify/Reverse.cs | 7 +- .../Geometry/Planar/Modify/Scale.cs | 7 +- .../Geometry/Planar/Modify/SortByDistance.cs | 7 +- .../Geometry/Planar/Modify/Tighten.cs | 9 +- .../Geometry/Planar/Query/Above.cs | 7 +- .../Planar/Query/AdjacentSegment2Ds.cs | 11 +- .../Geometry/Planar/Query/AlmostSimilar.cs | 11 +- .../Geometry/Planar/Query/Angle.cs | 7 +- .../Geometry/Planar/Query/Area.cs | 11 +- .../Geometry/Planar/Query/Average.cs | 9 +- .../Geometry/Planar/Query/BottomLeft.cs | 7 +- .../Geometry/Planar/Query/Bounce.cs | 7 +- .../Geometry/Planar/Query/Centroid.cs | 7 +- .../Geometry/Planar/Query/Clone.cs | 9 +- .../Geometry/Planar/Query/Closest.cs | 9 +- .../Planar/Query/ClosestDictionary.cs | 7 +- .../Planar/Query/ClosestSegment2Ds.cs | 7 +- .../Geometry/Planar/Query/Collinear.cs | 7 +- .../Geometry/Planar/Query/Concave.cs | 15 +- .../Geometry/Planar/Query/Connected.cs | 17 +- .../Geometry/Planar/Query/Contains.cs | 7 +- .../Geometry/Planar/Query/Convex.cs | 19 +- .../Geometry/Planar/Query/ConvexHull.cs | 7 +- SAM/SAM.Geometry/Geometry/Planar/Query/Cut.cs | 31 +- .../Geometry/Planar/Query/Determinant.cs | 7 +- .../Geometry/Planar/Query/Determinants.cs | 9 +- .../Geometry/Planar/Query/DiagonalLength.cs | 11 +- .../Geometry/Planar/Query/Difference.cs | 55 +- .../Geometry/Planar/Query/Direction.cs | 9 +- .../Geometry/Planar/Query/Directions.cs | 7 +- .../Geometry/Planar/Query/Distance.cs | 7 +- .../Geometry/Planar/Query/Edges.cs | 15 +- .../Planar/Query/EqualsTopologically.cs | 7 +- .../Geometry/Planar/Query/Evaluate.cs | 9 +- .../Geometry/Planar/Query/Extend.cs | 7 +- .../Planar/Query/ExternalPolygon2Ds.cs | 9 +- .../Geometry/Planar/Query/ExtremePoints.cs | 7 +- .../Geometry/Planar/Query/Fill.cs | 23 +- .../Geometry/Planar/Query/FilterRelevant.cs | 17 +- .../Geometry/Planar/Query/FixEdges.cs | 7 +- .../Geometry/Planar/Query/Grid.cs | 25 +- .../Geometry/Planar/Query/Holes.cs | 11 +- .../Geometry/Planar/Query/InRange.cs | 11 +- .../Planar/Query/IndexOfClosestPoint2D.cs | 7 +- .../Planar/Query/IndexOfClosestSegment2D.cs | 7 +- .../Planar/Query/IndexesOfClosestSegment2D.cs | 7 +- .../Geometry/Planar/Query/Inside.cs | 9 +- .../Geometry/Planar/Query/InternalPoint2D.cs | 9 +- .../Planar/Query/InternalVector2Ds.cs | 9 +- .../Geometry/Planar/Query/Intersect.cs | 7 +- .../Geometry/Planar/Query/Intersection.cs | 83 +- .../Planar/Query/IntersectionDictionary.cs | 7 +- .../Planar/Query/IntersectionSegment2Ds.cs | 7 +- .../Geometry/Planar/Query/Intersections.cs | 17 +- .../Geometry/Planar/Query/IsValid.cs | 55 +- .../Geometry/Planar/Query/Join.cs | 7 +- .../Geometry/Planar/Query/LongestPath.cs | 23 +- SAM/SAM.Geometry/Geometry/Planar/Query/Max.cs | 7 +- .../Geometry/Planar/Query/MaxDistance.cs | 7 +- SAM/SAM.Geometry/Geometry/Planar/Query/Mid.cs | 7 +- .../Geometry/Planar/Query/MidVector2D.cs | 7 +- SAM/SAM.Geometry/Geometry/Planar/Query/Min.cs | 7 +- .../Geometry/Planar/Query/MinDistance.cs | 7 +- .../Geometry/Planar/Query/Move.cs | 17 +- .../Geometry/Planar/Query/MovePoint2D.cs | 19 +- .../Geometry/Planar/Query/MoveSegment2D.cs | 25 +- .../Geometry/Planar/Query/MoveToSegment2D.cs | 7 +- .../Geometry/Planar/Query/ObtuseAngles.cs | 9 +- .../Geometry/Planar/Query/Offset.cs | 50 +- SAM/SAM.Geometry/Geometry/Planar/Query/On.cs | 9 +- .../Geometry/Planar/Query/Orient.cs | 7 +- .../Geometry/Planar/Query/Orientation.cs | 15 +- .../Geometry/Planar/Query/Orientations.cs | 7 +- .../Geometry/Planar/Query/Parameter.cs | 7 +- .../Geometry/Planar/Query/Perimeter.cs | 11 +- .../Geometry/Planar/Query/Point2D.cs | 7 +- .../Geometry/Planar/Query/Polygons.cs | 15 +- .../Geometry/Planar/Query/Rectangular.cs | 9 +- .../Geometry/Planar/Query/Reduce.cs | 23 +- .../Geometry/Planar/Query/RemoveAngle.cs | 7 +- .../Geometry/Planar/Query/Rotate.cs | 15 +- .../Geometry/Planar/Query/Scale.cs | 9 +- .../Geometry/Planar/Query/Segment2Ds.cs | 7 +- .../Geometry/Planar/Query/SelfIntersect.cs | 7 +- .../Planar/Query/SelfIntersectionFace2Ds.cs | 33 +- .../Planar/Query/SelfIntersectionPoint3D.cs | 7 +- .../Planar/Query/SelfIntersectionPoint3Ds.cs | 7 +- .../Query/SelfIntersectionPolygon2Ds.cs | 9 +- .../Query/SelfIntersectionSegment2Ds.cs | 7 +- .../Geometry/Planar/Query/ShortestPath.cs | 13 +- .../Geometry/Planar/Query/Similar.cs | 21 +- .../Geometry/Planar/Query/Simplify.cs | 7 +- .../Geometry/Planar/Query/SimplifyByAngle.cs | 15 +- .../Planar/Query/SimplifyByDouglasPeucker.cs | 7 +- .../Geometry/Planar/Query/SimplifyByLength.cs | 7 +- .../Planar/Query/SimplifyBySnapper.cs | 7 +- .../SimplifyByTopologyPreservingSimplifier.cs | 7 +- .../Geometry/Planar/Query/SmallestAngle.cs | 7 +- .../Planar/Query/SmallestAngleVector.cs | 7 +- .../Geometry/Planar/Query/Snap.cs | 33 +- .../Geometry/Planar/Query/Split.cs | 51 +- .../Planar/Query/SplitByInternalEdges.cs | 21 +- .../Geometry/Planar/Query/Straight.cs | 11 +- .../Geometry/Planar/Query/ThinnessRatio.cs | 7 +- .../Geometry/Planar/Query/Trace.cs | 7 +- .../Geometry/Planar/Query/TraceData.cs | 7 +- .../Geometry/Planar/Query/TraceDataFirst.cs | 7 +- .../Geometry/Planar/Query/TraceFirst.cs | 7 +- .../Geometry/Planar/Query/Transform.cs | 31 +- .../Geometry/Planar/Query/Triangulate.cs | 57 +- .../Geometry/Planar/Query/TriangulateByNTS.cs | 9 +- .../Geometry/Planar/Query/Trim.cs | 7 +- .../Geometry/Planar/Query/TrimUnconnected.cs | 11 +- .../Geometry/Planar/Query/Truncate.cs | 17 +- .../Geometry/Planar/Query/Union.cs | 31 +- .../Geometry/Planar/Query/UniquePoint2Ds.cs | 11 +- .../Geometry/Planar/Query/Vector2D.cs | 9 +- .../Geometry/Planar/Query/VerticalPosition.cs | 21 +- .../Geometry/Planar/Query/WorkGeometry.cs | 9 +- .../Geometry/Spatial/Classes/BoundingBox3D.cs | 21 +- .../Geometry/Spatial/Classes/Circle3D.cs | 17 +- .../Spatial/Classes/CoordinateSystem3D.cs | 15 +- .../Geometry/Spatial/Classes/Ellipse3D.cs | 7 +- .../Geometry/Spatial/Classes/Extrusion.cs | 13 +- .../Geometry/Spatial/Classes/Face3D.cs | 23 +- .../Geometry/Spatial/Classes/Line3D.cs | 7 +- .../Geometry/Spatial/Classes/Mesh3D.cs | 83 +- .../Classes/PlanarIntersectionResult.cs | 9 +- .../Geometry/Spatial/Classes/Plane.cs | 15 +- .../Geometry/Spatial/Classes/Point3D.cs | 11 +- .../Spatial/Classes/Point3DCluster.cs | 5 +- .../Geometry/Spatial/Classes/Point3DGraph.cs | 15 +- .../Geometry/Spatial/Classes/Polycurve3D.cs | 7 +- .../Spatial/Classes/Polycurveloop3D.cs | 7 +- .../Geometry/Spatial/Classes/Polygon3D.cs | 15 +- .../Geometry/Spatial/Classes/Polyline3D.cs | 7 +- .../Geometry/Spatial/Classes/Rectangle3D.cs | 17 +- .../Spatial/Classes/SAMGeometry3DGroup.cs | 47 +- .../Geometry/Spatial/Classes/Segment3D.cs | 13 +- .../Geometry/Spatial/Classes/Shell.cs | 91 +- .../Geometry/Spatial/Classes/ShellSplitter.cs | 93 +- .../Geometry/Spatial/Classes/Sphere.cs | 7 +- .../Geometry/Spatial/Classes/Surface.cs | 7 +- .../Geometry/Spatial/Classes/Transform3D.cs | 11 +- .../Geometry/Spatial/Classes/Triangle3D.cs | 21 +- .../Geometry/Spatial/Classes/Vector3D.cs | 13 +- .../Geometry/Spatial/Convert/ToSAM/Face3D.cs | 7 +- .../Geometry/Spatial/Convert/ToSAM/Shell.cs | 11 +- .../Geometry/Spatial/Create/Face3D.cs | 9 +- .../Geometry/Spatial/Create/Face3Ds.cs | 9 +- .../Spatial/Create/IClosedPlanar3D.cs | 7 +- .../Geometry/Spatial/Create/ICurve3D.cs | 7 +- .../Geometry/Spatial/Create/ICurve3Ds.cs | 7 +- .../Geometry/Spatial/Create/Matrix.cs | 7 +- .../Geometry/Spatial/Create/Matrix3D.cs | 7 +- .../Geometry/Spatial/Create/Mesh3D.cs | 47 +- .../Create/PlanarIntersectionResult.cs | 65 +- .../Geometry/Spatial/Create/Plane.cs | 17 +- .../Geometry/Spatial/Create/Point3D.cs | 7 +- .../Geometry/Spatial/Create/Point3Ds.cs | 7 +- .../Geometry/Spatial/Create/Polygon3D.cs | 19 +- .../Geometry/Spatial/Create/Polygon3Ds.cs | 11 +- .../Geometry/Spatial/Create/Rectangle3D.cs | 23 +- .../Geometry/Spatial/Create/Segment3D.cs | 7 +- .../Geometry/Spatial/Create/Segment3Ds.cs | 7 +- .../Geometry/Spatial/Create/Shell.cs | 41 +- .../Geometry/Spatial/Create/Shells.cs | 23 +- .../Geometry/Spatial/Create/Vector3D.cs | 7 +- .../Spatial/Interfaces/IBoundable3D.cs | 7 +- .../Geometry/Spatial/Interfaces/IClosed3D.cs | 7 +- .../Spatial/Interfaces/IClosedPlanar3D.cs | 7 +- .../Spatial/Interfaces/ICurvable3D.cs | 7 +- .../Geometry/Spatial/Interfaces/ICurve3D.cs | 7 +- .../Interfaces/IIntersectionResult3D.cs | 7 +- .../Geometry/Spatial/Interfaces/IPlanar3D.cs | 7 +- .../Spatial/Interfaces/ISAMGeometry3D.cs | 7 +- .../Spatial/Interfaces/ISegmentable3D.cs | 7 +- .../Geometry/Spatial/Modify/Add.cs | 11 +- .../Geometry/Spatial/Modify/FillFace3Ds.cs | 7 +- .../Geometry/Spatial/Modify/InsertClosest.cs | 9 +- .../Spatial/Modify/RemoveAlmostSimilar.cs | 7 +- .../Geometry/Spatial/Modify/Round.cs | 7 +- .../Spatial/Modify/SimplifyByAngle.cs | 7 +- .../Geometry/Spatial/Modify/SortByDistance.cs | 7 +- .../Spatial/Modify/SplitCoplanarFace3Ds.cs | 15 +- .../Geometry/Spatial/Modify/SplitEdges.cs | 11 +- .../Geometry/Spatial/Modify/SplitFace3Ds.cs | 13 +- .../Geometry/Spatial/Query/Above.cs | 11 +- .../Geometry/Spatial/Query/AlmostSimilar.cs | 7 +- .../Geometry/Spatial/Query/Angle.cs | 7 +- .../Geometry/Spatial/Query/Area.cs | 21 +- .../Geometry/Spatial/Query/Average.cs | 7 +- .../Geometry/Spatial/Query/AxisX.cs | 7 +- .../Geometry/Spatial/Query/AxisY.cs | 7 +- .../Geometry/Spatial/Query/Azimuth.cs | 7 +- .../Geometry/Spatial/Query/Below.cs | 7 +- .../Geometry/Spatial/Query/Between.cs | 13 +- .../Query/CalculatedInternalPoint3D.cs | 19 +- .../Geometry/Spatial/Query/Centroid.cs | 7 +- .../Geometry/Spatial/Query/Clockwise.cs | 7 +- .../Geometry/Spatial/Query/Clone.cs | 7 +- .../Geometry/Spatial/Query/ClosedPlanar3Ds.cs | 9 +- .../Geometry/Spatial/Query/Closest.cs | 13 +- .../Geometry/Spatial/Query/ClosestEnd.cs | 17 +- .../Geometry/Spatial/Query/ClosestPoint3D.cs | 17 +- .../Geometry/Spatial/Query/Collinear.cs | 7 +- .../Geometry/Spatial/Query/Concave.cs | 17 +- .../Spatial/Query/ConnectedFace3Ds.cs | 37 +- .../Geometry/Spatial/Query/Convert.cs | 29 +- .../Geometry/Spatial/Query/Convex.cs | 17 +- .../Geometry/Spatial/Query/Coplanar.cs | 7 +- .../Geometry/Spatial/Query/Cut.cs | 59 +- .../Geometry/Spatial/Query/CutFace3Ds.cs | 13 +- .../Geometry/Spatial/Query/Difference.cs | 33 +- .../Geometry/Spatial/Query/Distance.cs | 23 +- .../Geometry/Spatial/Query/Eigenvectors.cs | 7 +- .../Spatial/Query/ElevationDictionary.cs | 7 +- .../Geometry/Spatial/Query/Explode.cs | 7 +- .../Geometry/Spatial/Query/Extend.cs | 7 +- .../Geometry/Spatial/Query/External.cs | 7 +- .../Geometry/Spatial/Query/ExtremePoints.cs | 9 +- .../Geometry/Spatial/Query/Face3Ds.cs | 29 +- .../Geometry/Spatial/Query/Fill.cs | 21 +- .../Geometry/Spatial/Query/FixEdges.cs | 15 +- .../Geometry/Spatial/Query/Grid.cs | 13 +- .../Geometry/Spatial/Query/Horizontal.cs | 9 +- .../Geometry/Spatial/Query/InRange.cs | 7 +- .../Geometry/Spatial/Query/Inside.cs | 29 +- .../Geometry/Spatial/Query/InternalFace3Ds.cs | 29 +- .../Geometry/Spatial/Query/InternalPoint2D.cs | 7 +- .../Geometry/Spatial/Query/InternalPoint3D.cs | 7 +- .../Geometry/Spatial/Query/Intersect.cs | 17 +- .../Geometry/Spatial/Query/Intersection.cs | 19 +- .../Spatial/Query/IntersectionDictionary.cs | 11 +- .../Geometry/Spatial/Query/Intersections.cs | 41 +- .../Geometry/Spatial/Query/IsNormalized.cs | 9 +- .../Geometry/Spatial/Query/IsValid.cs | 89 +- .../Geometry/Spatial/Query/Location.cs | 7 +- .../Geometry/Spatial/Query/Max.cs | 7 +- .../Geometry/Spatial/Query/MaxElevation.cs | 11 +- .../Spatial/Query/MaxIntersectionSegment3D.cs | 25 +- .../Geometry/Spatial/Query/MaxRectangle3D.cs | 17 +- .../Geometry/Spatial/Query/Merge.cs | 9 +- .../Geometry/Spatial/Query/Mid.cs | 9 +- .../Geometry/Spatial/Query/Min.cs | 7 +- .../Geometry/Spatial/Query/MinDimension.cs | 15 +- .../Geometry/Spatial/Query/NakedSegment3Ds.cs | 11 +- .../Geometry/Spatial/Query/Normal.cs | 29 +- .../Spatial/Query/NormalDictionary.cs | 13 +- .../Geometry/Spatial/Query/Normalize.cs | 27 +- .../Geometry/Spatial/Query/Normals.cs | 7 +- .../Geometry/Spatial/Query/Offset.cs | 7 +- SAM/SAM.Geometry/Geometry/Spatial/Query/On.cs | 13 +- .../Geometry/Spatial/Query/Orientation.cs | 11 +- .../Geometry/Spatial/Query/Overlap.cs | 9 +- .../Geometry/Spatial/Query/Parallel.cs | 7 +- .../Geometry/Spatial/Query/Permieter.cs | 9 +- .../Geometry/Spatial/Query/Perpendicular.cs | 7 +- .../Spatial/Query/PlanarIntersectionResult.cs | 7 +- .../Geometry/Spatial/Query/Point3Ds.cs | 23 +- .../Geometry/Spatial/Query/Project.cs | 31 +- .../Geometry/Spatial/Query/Range.cs | 9 +- .../Geometry/Spatial/Query/Ranges.cs | 17 +- .../Geometry/Spatial/Query/Rectangular.cs | 7 +- .../Geometry/Spatial/Query/Reduce.cs | 11 +- .../Spatial/Query/RemoveInvalidFace3Ds.cs | 17 +- .../Geometry/Spatial/Query/Rotate.cs | 9 +- .../Geometry/Spatial/Query/Rotate90.cs | 7 +- .../Geometry/Spatial/Query/Round.cs | 7 +- .../Geometry/Spatial/Query/Section.cs | 43 +- .../Spatial/Query/SectionDictionary.cs | 7 +- .../Geometry/Spatial/Query/Segment3Ds.cs | 19 +- .../Geometry/Spatial/Query/SelfIntersect.cs | 7 +- .../Spatial/Query/SelfIntersectionFace3Ds.cs | 7 +- .../Query/SelfIntersectionPolygon3Ds.cs | 7 +- .../Geometry/Spatial/Query/SignedAngle.cs | 7 +- .../Geometry/Spatial/Query/SignedVolume.cs | 13 +- .../Geometry/Spatial/Query/Simplify.cs | 9 +- .../Geometry/Spatial/Query/SimplifyByAngle.cs | 9 +- .../Spatial/Query/SimplifyByDistance.cs | 7 +- ...plifyByNTS_TopologyPreservingSimplifier.cs | 7 +- .../Geometry/Spatial/Query/SmallestAngle.cs | 7 +- .../Geometry/Spatial/Query/Snap.cs | 115 +- .../Spatial/Query/SpacingDictionary.cs | 15 +- .../Geometry/Spatial/Query/Split.cs | 105 +- .../Spatial/Query/SplitByConcaveEdges.cs | 7 +- .../Spatial/Query/SplitByInternalEdges.cs | 13 +- .../Geometry/Spatial/Query/SplitEdges.cs | 7 +- .../Geometry/Spatial/Query/ThinnessRatio.cs | 7 +- .../Geometry/Spatial/Query/Tilt.cs | 9 +- .../Geometry/Spatial/Query/TopFace3Ds.cs | 21 +- .../Geometry/Spatial/Query/Transform.cs | 17 +- .../Geometry/Spatial/Query/Triangulate.cs | 15 +- .../Geometry/Spatial/Query/TryClose.cs | 17 +- .../Geometry/Spatial/Query/TrySplitEdges.cs | 35 +- .../Geometry/Spatial/Query/Union.cs | 43 +- .../Geometry/Spatial/Query/Vertical.cs | 7 +- .../Geometry/Spatial/Query/Volume.cs | 31 +- .../Base/Classes/Appearance/Appearance.cs | 13 +- .../Classes/Appearance/CurveAppearance.cs | 7 +- .../Classes/Appearance/PointAppearance.cs | 17 +- .../Classes/Appearance/SurfaceAppearance.cs | 9 +- .../Base/Classes/Appearance/TextAppearance.cs | 21 +- .../Base/Classes/GeometryObjectModel.cs | 39 +- .../Classes/SAMGeometryObjectCollection.cs | 31 +- .../Base/Convert/ToSAM/ISAMGeometries.cs | 7 +- .../Base/Convert/ToSAM/ISAMGeometryObject.cs | 5 +- .../Object/Base/Interfaces/IAppearance.cs | 7 +- .../Base/Interfaces/ISAMGeometryObject.cs | 7 +- .../Base/Query/DefaultCurveAppearance.cs | 5 +- .../Base/Query/DefaultPointAppearance.cs | 5 +- .../Base/Query/DefaultSurfaceAppearance.cs | 5 +- .../Base/Query/DefaultTextAppearance.cs | 5 +- .../Object/Base/Query/ISAMGeometryObject.cs | 15 +- .../Planar/Classes/BoundingBox2DObject.cs | 5 +- .../Object/Planar/Classes/Polygon2DObject.cs | 5 +- .../Object/Planar/Classes/Polyline2DObject.cs | 5 +- .../Classes/SAMGeometry2DObjectCollection.cs | 5 +- .../Object/Planar/Classes/Segment2DObject.cs | 7 +- .../Create/SAMGeometry2DObjectCollection.cs | 17 +- .../Planar/Interfaces/IBoundable2DObject.cs | 7 +- .../Planar/Interfaces/IBoundingBox2DObject.cs | 7 +- .../Object/Planar/Interfaces/IFace2DObject.cs | 7 +- .../Planar/Interfaces/IPolygon2DObject.cs | 7 +- .../Planar/Interfaces/IPolyline2DObject.cs | 7 +- .../Planar/Interfaces/ISAMGeometry2DObject.cs | 7 +- .../Planar/Interfaces/ISegment2DObject.cs | 7 +- .../Spatial/Classes/BoundingBox3DObject.cs | 5 +- .../Object/Spatial/Classes/ExtrusionObject.cs | 5 +- .../Object/Spatial/Classes/Face3DObject.cs | 15 +- .../Classes/Geometry3DObjectCollection.cs | 15 +- .../Object/Spatial/Classes/LinkedFace3D.cs | 5 +- .../Object/Spatial/Classes/Mesh3DObject.cs | 15 +- .../Object/Spatial/Classes/Point3DObject.cs | 15 +- .../Object/Spatial/Classes/Polygon3DObject.cs | 5 +- .../Spatial/Classes/Polyline3DObject.cs | 5 +- .../Spatial/Classes/Rectangle3DObject.cs | 5 +- .../Classes/SAMGeometry3DGroupObject.cs | 5 +- .../Classes/SAMGeometry3DObjectCollection.cs | 5 +- .../Object/Spatial/Classes/Segment3DObject.cs | 7 +- .../Object/Spatial/Classes/ShellObject.cs | 15 +- .../Object/Spatial/Classes/SphereObject.cs | 15 +- .../Object/Spatial/Classes/Text3DObject.cs | 17 +- .../Spatial/Classes/Triangle3DObject.cs | 5 +- .../Object/Spatial/Create/BoundingBox3D.cs | 15 +- .../Object/Spatial/Create/LinkedFace3D.cs | 13 +- .../Object/Spatial/Create/LinkedFace3Ds.cs | 7 +- .../Interfaces/IBoundingBox3DObject.cs | 7 +- .../Spatial/Interfaces/IExtrusionObject.cs | 7 +- .../Spatial/Interfaces/IFace3DObject.cs | 7 +- .../Spatial/Interfaces/IMesh3DObject.cs | 7 +- .../Spatial/Interfaces/IPoint3DObject.cs | 7 +- .../Spatial/Interfaces/IPolygon3DObject.cs | 7 +- .../Spatial/Interfaces/IPolyline3DObject.cs | 7 +- .../Spatial/Interfaces/IRectangle3DObject.cs | 7 +- .../Interfaces/ISAMGeometry3DGroupObject.cs | 7 +- .../Interfaces/ISAMGeometry3DObject.cs | 7 +- .../Spatial/Interfaces/ISegment3DObject.cs | 7 +- .../Object/Spatial/Interfaces/IShellObject.cs | 7 +- .../Spatial/Interfaces/ISphereObject.cs | 7 +- .../Spatial/Interfaces/IText3DObject.cs | 5 +- .../Spatial/Interfaces/ITriangle3DObject.cs | 7 +- .../Object/Spatial/Query/Above.cs | 7 +- SAM/SAM.Geometry/Object/Spatial/Query/Area.cs | 7 +- .../Object/Spatial/Query/Azimuth.cs | 7 +- .../Object/Spatial/Query/Below.cs | 7 +- .../Object/Spatial/Query/Closest.cs | 7 +- .../Object/Spatial/Query/Concave.cs | 7 +- .../Object/Spatial/Query/Convex.cs | 7 +- .../Spatial/Query/ElevationDictionary.cs | 9 +- .../Object/Spatial/Query/ElevationRanges.cs | 7 +- .../Spatial/Query/Face3DObjectsByFace3D.cs | 37 +- .../Object/Spatial/Query/FilterByElevation.cs | 15 +- SAM/SAM.Geometry/Object/Spatial/Query/Grid.cs | 7 +- .../Spatial/Query/HiddenLinkedFace3Ds.cs | 7 +- .../Object/Spatial/Query/Horizontal.cs | 7 +- .../Object/Spatial/Query/ISAMGeometry3D.cs | 11 +- .../Object/Spatial/Query/InRange.cs | 7 +- .../Object/Spatial/Query/Inside.cs | 7 +- .../Object/Spatial/Query/Intersect.cs | 7 +- .../Spatial/Query/IntersectionDictionary.cs | 25 +- .../Object/Spatial/Query/MaxElevation.cs | 7 +- .../Spatial/Query/MaxIntersectionSegment3D.cs | 7 +- .../Spatial/Query/MaxProjectedDistance.cs | 5 +- .../Object/Spatial/Query/MaxRectangle3D.cs | 7 +- .../Object/Spatial/Query/MinElevation.cs | 15 +- .../Spatial/Query/PlanarIntersectionResult.cs | 9 +- .../Object/Spatial/Query/SAMGeometry3D.cs | 9 +- .../Object/Spatial/Query/SectionDictionary.cs | 19 +- .../Object/Spatial/Query/Shells.cs | 11 +- .../Object/Spatial/Query/SpacingDictionary.cs | 9 +- SAM/SAM.Geometry/Object/Spatial/Query/Tilt.cs | 7 +- .../Object/Spatial/Query/TryConvert.cs | 37 +- .../Object/Spatial/Query/Vertical.cs | 7 +- .../Object/Spatial/Query/ViewField.cs | 9 +- .../Spatial/Query/VisibleLinkedFace3Ds.cs | 7 +- SAM/SAM.Geometry/Properties/AssemblyInfo.cs | 5 +- SAM/SAM.Math/Classes/Constant.cs | 7 +- .../Classes/Equation/LinearEquation.cs | 5 +- .../Classes/Equation/PolynomialEquation.cs | 19 +- .../Interpolation/BilinearInterpolation.cs | 15 +- .../Interpolation/LinearInterpolation.cs | 19 +- SAM/SAM.Math/Classes/Matrix/Matrix.cs | 25 +- SAM/SAM.Math/Classes/Matrix/Matrix2D.cs | 7 +- SAM/SAM.Math/Classes/Matrix/Matrix3D.cs | 7 +- SAM/SAM.Math/Classes/Matrix/Matrix4D.cs | 7 +- SAM/SAM.Math/Classes/PolynomialModifier.cs | 19 +- SAM/SAM.Math/Convert/ToMathNet/Matrix.cs | 7 +- SAM/SAM.Math/Convert/ToMathNet/Polynominal.cs | 7 +- SAM/SAM.Math/Convert/ToSAM/Matrix.cs | 9 +- .../Convert/ToSAM/PolynomialEquation.cs | 7 +- SAM/SAM.Math/Create/LinearEquation.cs | 9 +- SAM/SAM.Math/Create/Matrix.cs | 7 +- SAM/SAM.Math/Create/Matrix2D.cs | 5 +- SAM/SAM.Math/Create/Matrix3D.cs | 5 +- SAM/SAM.Math/Create/Matrix4D.cs | 5 +- SAM/SAM.Math/Create/PolynomialEquation.cs | 9 +- SAM/SAM.Math/Interfaces/IEquation.cs | 5 +- SAM/SAM.Math/Interfaces/ISquareMatrix.cs | 5 +- SAM/SAM.Math/Query/Arccos.cs | 7 +- SAM/SAM.Math/Query/Arccosec.cs | 7 +- SAM/SAM.Math/Query/Arccotan.cs | 7 +- SAM/SAM.Math/Query/Arcosh.cs | 7 +- SAM/SAM.Math/Query/Arcoth.cs | 7 +- SAM/SAM.Math/Query/Arcsch.cs | 7 +- SAM/SAM.Math/Query/Arcsec.cs | 7 +- SAM/SAM.Math/Query/Arcsin.cs | 7 +- SAM/SAM.Math/Query/Arsech.cs | 7 +- SAM/SAM.Math/Query/Arsinh.cs | 7 +- SAM/SAM.Math/Query/Artanh.cs | 7 +- SAM/SAM.Math/Query/Cosec.cs | 7 +- SAM/SAM.Math/Query/Cosech.cs | 7 +- SAM/SAM.Math/Query/Cosh.cs | 7 +- SAM/SAM.Math/Query/Cotan.cs | 7 +- SAM/SAM.Math/Query/Coth.cs | 7 +- SAM/SAM.Math/Query/CubeRoot.cs | 7 +- SAM/SAM.Math/Query/LogN.cs | 7 +- SAM/SAM.Math/Query/Max.cs | 7 +- SAM/SAM.Math/Query/Median.cs | 7 +- SAM/SAM.Math/Query/Min.cs | 7 +- SAM/SAM.Math/Query/Modal.cs | 7 +- SAM/SAM.Math/Query/NeigbourIndices.cs | 17 +- SAM/SAM.Math/Query/RealCubicRoots.cs | 7 +- SAM/SAM.Math/Query/Remap.cs | 16 +- SAM/SAM.Math/Query/Sec.cs | 7 +- SAM/SAM.Math/Query/Sech.cs | 7 +- SAM/SAM.Math/Query/Sinh.cs | 7 +- SAM/SAM.Math/Query/Tanh.cs | 7 +- SAM/SAM.Units/Attributes/Abbreviation.cs | 5 +- SAM/SAM.Units/Convert/ByUnitType.cs | 31 +- SAM/SAM.Units/Convert/ToDegrees.cs | 7 +- SAM/SAM.Units/Convert/ToImperial.cs | 7 +- SAM/SAM.Units/Convert/ToRadians.cs | 7 +- SAM/SAM.Units/Convert/ToSI.cs | 7 +- SAM/SAM.Units/Enums/UnitCategory.cs | 7 +- SAM/SAM.Units/Enums/UnitStyle.cs | 7 +- SAM/SAM.Units/Enums/UnitType.cs | 57 +- SAM/SAM.Units/Properties/AssemblyInfo.cs | 5 +- SAM/SAM.Units/Query/Abbreviation.cs | 7 +- SAM/SAM.Units/Query/DefaultTolerance.cs | 9 +- SAM/SAM.Units/Query/Description.cs | 7 +- SAM/SAM.Units/Query/UnitType.cs | 13 +- SAM/SAM.Units/Query/UnitTypes.cs | 13 +- SAM/SAM.Units/Variables/Factor.cs | 5 +- SAM/SAM.Weather/Classes/GroundTemperature.cs | 5 +- ...lingMeanOutdoorAirTemperatureCalculator.cs | 19 +- .../SimpleArithmeticMeanCalculationMethod.cs | 13 +- .../WeightingCalculationMethod.cs | 23 +- SAM/SAM.Weather/Classes/WeatherData.cs | 17 +- SAM/SAM.Weather/Classes/WeatherDay.cs | 19 +- SAM/SAM.Weather/Classes/WeatherHour.cs | 7 +- SAM/SAM.Weather/Classes/WeatherYear.cs | 21 +- SAM/SAM.Weather/Convert/ToEPW/EPW.cs | 7 +- SAM/SAM.Weather/Convert/ToSAM/WeatherData.cs | 7 +- SAM/SAM.Weather/Create/WeatherYear.cs | 5 +- .../Enums/Parameter/WeatherDataParameter.cs | 5 +- SAM/SAM.Weather/Enums/WeatherDataType.cs | 11 +- SAM/SAM.Weather/Interfaces/IWeatherObject.cs | 5 +- ...nOutdoorAirTemperatureCalculationMethod.cs | 5 +- ...pproximateRunningMeanDryBulbTemperature.cs | 9 +- SAM/SAM.Weather/Query/Color.cs | 7 +- SAM/SAM.Weather/Query/CommentsString.cs | 7 +- SAM/SAM.Weather/Query/Compare.cs | 9 +- .../Query/CoolingDesignWeatherDay.cs | 7 +- SAM/SAM.Weather/Query/DataPeriodsString.cs | 5 +- SAM/SAM.Weather/Query/DataString.cs | 7 +- SAM/SAM.Weather/Query/DayIndex.cs | 7 +- .../Query/DaylightSavingsString.cs | 5 +- .../Query/DesignConditionsString.cs | 7 +- .../Query/DryBulbTemperatureRange.cs | 19 +- .../Query/DryBulbTemperatureRanges.cs | 9 +- .../Query/GroundTemperaturesString.cs | 7 +- .../Query/HeatingDesignWeatherDay.cs | 7 +- SAM/SAM.Weather/Query/LocationString.cs | 7 +- SAM/SAM.Weather/Query/MaxValue.cs | 7 +- .../Query/RunningMeanDryBulbTemperatures.cs | 17 +- SAM/SAM.Weather/Query/TryGetData.cs | 7 +- .../Query/TryGetGroundTemperatures.cs | 7 +- SAM/SAM.Weather/Query/TryGetLocationData.cs | 5 +- SAM/SAM.Weather/Query/TryGetValue.cs | 9 +- SAM/SAM.Weather/Query/TypicalPeriodsString.cs | 5 +- SAM/SAM.Weather/Query/Values.cs | 5 +- SAM/SAM.Weather/Query/WeatherDays.cs | 5 +- 2372 files changed, 23823 insertions(+), 13218 deletions(-) create mode 100644 SAM/SAM.Analytical/Classes/Case/ApertureCase.cs create mode 100644 SAM/SAM.Analytical/Classes/Case/ApertureConstructionCase.cs create mode 100644 SAM/SAM.Analytical/Classes/Case/ApertureToPanelRatio.cs create mode 100644 SAM/SAM.Analytical/Classes/Case/ApertureToPanelRatios.cs create mode 100644 SAM/SAM.Analytical/Classes/Case/Case.cs create mode 100644 SAM/SAM.Analytical/Classes/Case/CaseSelection/ApertureCaseSelection.cs create mode 100644 SAM/SAM.Analytical/Classes/Case/CaseSelection/CaseSelection.cs create mode 100644 SAM/SAM.Analytical/Classes/Case/CaseSelection/FilterSelection.cs create mode 100644 SAM/SAM.Analytical/Classes/Case/CaseSelection/ObjectReferenceCaseSelection.cs create mode 100644 SAM/SAM.Analytical/Classes/Case/CaseSelection/SAMObjectCaseSelection.cs create mode 100644 SAM/SAM.Analytical/Classes/Case/Cases.cs create mode 100644 SAM/SAM.Analytical/Classes/Case/FinShadeCase.cs create mode 100644 SAM/SAM.Analytical/Classes/Case/PanelShadeCase.cs create mode 100644 SAM/SAM.Analytical/Classes/Case/VentilationCase.cs create mode 100644 SAM/SAM.Analytical/Classes/Case/WeatherDataCase.cs create mode 100644 SAM/SAM.Analytical/Classes/Case/WindowSizeCase.cs create mode 100644 SAM/SAM.Analytical/Convert/ToSystem/Dictionary.cs create mode 100644 SAM/SAM.Analytical/Create/AnalyticalModel.cs create mode 100644 SAM/SAM.Analytical/Create/AnalyticalModels.cs create mode 100644 SAM/SAM.Analytical/Create/Cases.cs create mode 100644 SAM/SAM.Analytical/Interfaces/ISelectiveCase.cs create mode 100644 SAM/SAM.Analytical/Query/IJSAMObjects.cs diff --git a/.editorconfig b/.editorconfig index cb76def1f..2c11eddb8 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,4 +2,5 @@ root = true [*.cs] dotnet_diagnostic.IDE0130.severity = none -dotnet_diagnostic.CS1591.severity = none \ No newline at end of file +dotnet_diagnostic.CS1591.severity = none +dotnet_diagnostic.IDE0290.severity = none \ No newline at end of file diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAdjacencyCluster.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAdjacencyCluster.cs index 25d4c8163..13ddeda12 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAdjacencyCluster.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAdjacencyCluster.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using Rhino; using Rhino.DocObjects; @@ -96,9 +99,9 @@ public override IGH_Goo Duplicate() public void DrawViewportWires(GH_PreviewWireArgs args) { List spaces = Value?.GetObjects(); - if(spaces != null) + if (spaces != null) { - foreach(ISpace space in spaces) + foreach (ISpace space in spaces) { Point3d? point3d = Geometry.Rhino.Convert.ToRhino(space?.Location); if (point3d == null || !point3d.HasValue) @@ -117,10 +120,10 @@ public void DrawViewportWires(GH_PreviewWireArgs args) } BoundingBox3D boundingBox3D = null; - if(args.Viewport.IsValidFrustum) + if (args.Viewport.IsValidFrustum) { BoundingBox boundingBox = args.Viewport.GetFrustumBoundingBox(); - boundingBox3D = new BoundingBox3D(new Point3D[] { Geometry.Rhino.Convert.ToSAM(boundingBox.Min), Geometry.Rhino.Convert.ToSAM(boundingBox.Max)}); + boundingBox3D = new BoundingBox3D(new Point3D[] { Geometry.Rhino.Convert.ToSAM(boundingBox.Min), Geometry.Rhino.Convert.ToSAM(boundingBox.Max) }); } foreach (IPanel panel in panels) @@ -137,10 +140,10 @@ public void DrawViewportWires(GH_PreviewWireArgs args) continue; } - if(boundingBox3D != null) + if (boundingBox3D != null) { BoundingBox3D boundingBox3D_Temp = face3D.GetBoundingBox(); - if(boundingBox3D_Temp != null) + if (boundingBox3D_Temp != null) { if (!boundingBox3D.Inside(boundingBox3D_Temp) && !boundingBox3D.Intersect(boundingBox3D_Temp)) { @@ -148,7 +151,7 @@ public void DrawViewportWires(GH_PreviewWireArgs args) } } } - + Dictionary dictionary = new Dictionary(); //Assign Color for Edges @@ -185,7 +188,7 @@ public void DrawViewportWires(GH_PreviewWireArgs args) } public void DrawViewportMeshes(GH_PreviewMeshArgs args) - { + { List panels = Value?.GetObjects(); if (panels == null) { @@ -205,10 +208,10 @@ public void DrawViewportMeshes(GH_PreviewMeshArgs args) face3Ds.Add(null); } - Parallel.For(0, panels.Count, (int i) => + Parallel.For(0, panels.Count, (int i) => { IPanel panel = panels[i]; - + List spaces = Value.GetRelatedObjects(panel); if (spaces != null && spaces.Count > 1) { @@ -236,13 +239,13 @@ public void DrawViewportMeshes(GH_PreviewMeshArgs args) face3Ds[i] = face3D; }); - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { if (face3D == null) { continue; } - + Brep brep = Geometry.Rhino.Convert.ToRhino_Brep(face3D); if (brep == null) { @@ -264,7 +267,7 @@ public bool BakeGeometry(RhinoDoc doc, ObjectAttributes att, out Guid obj_guid) } List breps = new List(); - foreach(IPanel panel in panels) + foreach (IPanel panel in panels) { List breps_Panel = Rhino.Convert.ToRhino(panel); if (breps_Panel == null) @@ -465,4 +468,4 @@ private void Menu_OpenInUI(object sender, EventArgs e) #endregion IGH_PreviewObject } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAirHandlingUnit.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAirHandlingUnit.cs index 044b6356b..1d9d4b944 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAirHandlingUnit.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAirHandlingUnit.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -73,4 +76,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAirMovement.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAirMovement.cs index 280715177..168d2e9f5 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAirMovement.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAirMovement.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -62,4 +65,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAnalyticalEquipment.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAnalyticalEquipment.cs index 1d62295f1..4b544c078 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAnalyticalEquipment.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAnalyticalEquipment.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -62,4 +65,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAnalyticalModel.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAnalyticalModel.cs index 0a6411332..b8f00c5c9 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAnalyticalModel.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAnalyticalModel.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using Rhino; using Rhino.DocObjects; @@ -38,7 +41,7 @@ public BoundingBox ClippingBox public bool BakeGeometry(RhinoDoc doc, ObjectAttributes att, out Guid obj_guid) { obj_guid = Guid.Empty; - + if (Value?.AdjacencyCluster == null) return false; @@ -104,7 +107,7 @@ public override bool CastTo(ref Y target) target = (Y)(object)Value; return true; } - + if (typeof(Y).IsAssignableFrom(typeof(GH_Mesh))) { target = (Y)(object)Value.ToGrasshopper_Mesh(); @@ -133,7 +136,7 @@ public class GooAnalyticalModelParam : GH_PersistentParam, I { public override Guid ComponentGuid => new Guid("01466a73-e3f3-495d-b794-bd322c9edfa0"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public bool Hidden { get; set; } @@ -204,8 +207,8 @@ public override void AppendAdditionalMenuItems(System.Windows.Forms.ToolStripDro Menu_AppendItem(menu, "Bake By BoundaryType", Menu_BakeByBoundaryType, Core.Convert.ToBitmap(Resources.SAM3), VolatileData.AllData(true).Any()); Menu_AppendItem(menu, "Bake By Discharge Coefficient", Menu_BakeByDischargeCoefficient, Core.Convert.ToBitmap(Resources.SAM3), VolatileData.AllData(true).Any()); Menu_AppendItem(menu, "Save As...", Menu_SaveAs, Core.Convert.ToBitmap(Resources.SAM3), VolatileData.AllData(true).Any()); - - if(System.IO.File.Exists(Query.AnalyticalUIPath())) + + if (System.IO.File.Exists(Query.AnalyticalUIPath())) { Menu_AppendItem(menu, "Open in UI", Menu_OpenInUI, Core.Convert.ToBitmap(Resources.SAM3), VolatileData.AllData(true).Any()); } @@ -243,4 +246,4 @@ private void Menu_OpenInUI(object sender, EventArgs e) Process process = Convert.ToUI(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAnalyticalObject.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAnalyticalObject.cs index 551874099..0709df0ae 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAnalyticalObject.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAnalyticalObject.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -103,4 +106,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAperture.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAperture.cs index 3f29b5279..172d0d862 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAperture.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooAperture.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using Rhino; using Rhino.Commands; @@ -51,7 +54,7 @@ public void DrawViewportWires(GH_PreviewWireArgs args) System.Drawing.Color color_ExternalEdge = System.Drawing.Color.Empty; System.Drawing.Color color_InternalEdges = System.Drawing.Color.Empty; - if(Value.ApertureConstruction != null) + if (Value.ApertureConstruction != null) { color_ExternalEdge = Analytical.Query.Color(Value.ApertureConstruction.ApertureType, false); color_InternalEdges = Analytical.Query.Color(Value.ApertureConstruction.ApertureType, true); @@ -69,9 +72,9 @@ public void DrawViewportWires(GH_PreviewWireArgs args) public void DrawViewportWires(GH_PreviewWireArgs args, System.Drawing.Color color_ExternalEdge, System.Drawing.Color color_InternalEdges) { List face3Ds = new List(); - + Face3D face3D = Value?.GetFrameFace3D(); - if(face3D != null) + if (face3D != null) { face3Ds.Add(face3D); } @@ -86,12 +89,12 @@ public void DrawViewportWires(GH_PreviewWireArgs args, System.Drawing.Color colo face3Ds.AddRange(face3Ds_Pane); } - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return; } - foreach(Face3D face3D_Temp in face3Ds) + foreach (Face3D face3D_Temp in face3Ds) { GooPlanarBoundary3D gooPlanarBoundary3D = new GooPlanarBoundary3D(new PlanarBoundary3D(face3D_Temp)); gooPlanarBoundary3D.DrawViewportWires(args, color_ExternalEdge, color_InternalEdges); @@ -113,7 +116,7 @@ public void DrawViewportMeshes(GH_PreviewMeshArgs args) displayMaterial_Frame = Query.DisplayMaterial(Value.ApertureConstruction.ApertureType, AperturePart.Frame); } - if(Value.Openable()) + if (Value.Openable()) { displayMaterial_Pane = Query.DisplayMaterial(Value.ApertureConstruction.ApertureType, AperturePart.Pane, true); } @@ -127,9 +130,9 @@ public void DrawViewportMeshes(GH_PreviewMeshArgs args) List face3Ds = null; face3Ds = Value.GetFace3Ds(AperturePart.Frame); - if(face3Ds != null) + if (face3Ds != null) { - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { GooPlanarBoundary3D gooPlanarBoundary3D = new GooPlanarBoundary3D(new PlanarBoundary3D(face3D)); gooPlanarBoundary3D.DrawViewportMeshes(args, displayMaterial_Frame); @@ -150,7 +153,7 @@ public void DrawViewportMeshes(GH_PreviewMeshArgs args) public bool BakeGeometry(RhinoDoc doc, ObjectAttributes att, out Guid obj_guid) { obj_guid = Guid.Empty; - + return Rhino.Modify.BakeGeometry(Value, doc, att, out obj_guid); } @@ -206,7 +209,7 @@ public class GooApertureParam : GH_PersistentParam, IGH_PreviewObje { public override Guid ComponentGuid => new Guid("d5f56261-608b-4cec-baa4-ca2fb29ab5be"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); bool IGH_PreviewObject.Hidden { get; set; } @@ -352,7 +355,7 @@ protected override GH_GetterResult Prompt_Singular(ref GooAperture value) continue; apertures.RemoveAll(x => x == null); - if(apertures.Count != 0) + if (apertures.Count != 0) { value = new GooAperture(apertures[0]); return GH_GetterResult.success; @@ -372,11 +375,11 @@ public void BakeGeometry(RhinoDoc doc, ObjectAttributes att, List obj_ids) foreach (IGH_Goo goo in VolatileData.AllData(true)) { Guid guid = default; - + IGH_BakeAwareData bakeAwareData = goo as IGH_BakeAwareData; if (bakeAwareData != null) bakeAwareData.BakeGeometry(doc, att, out guid); - + obj_ids.Add(guid); } } @@ -436,4 +439,4 @@ public void BakeGeometry_ByApertureConstructionWithFrame(RhinoDoc doc) Modify.BakeGeometry_ByApertureConstruction(doc, VolatileData, true); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooApertureConstruction.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooApertureConstruction.cs index bbf7ad678..e1c0cc1ad 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooApertureConstruction.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooApertureConstruction.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -64,7 +67,7 @@ public class GooApertureConstructionParam : GH_PersistentParam new Guid("9b821163-e775-48d9-aee8-dc4d51c4186b"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public GooApertureConstructionParam() : base(typeof(ApertureConstruction).Name, typeof(ApertureConstruction).Name, typeof(ApertureConstruction).FullName.Replace(".", " "), "Params", "SAM") @@ -95,4 +98,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooApertureConstructionLibrary.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooApertureConstructionLibrary.cs index 002f34d76..4e4027219 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooApertureConstructionLibrary.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooApertureConstructionLibrary.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -31,7 +34,7 @@ public class GooApertureConstructionLibraryParam : GH_PersistentParam new Guid("4a8077a2-7c38-4996-8fbf-9c508c746eea"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public GooApertureConstructionLibraryParam() : base(typeof(ApertureConstructionLibrary).Name, typeof(ApertureConstructionLibrary).Name, typeof(ApertureConstructionLibrary).FullName.Replace(".", " "), "Params", "SAM") @@ -62,4 +65,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooConstruction.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooConstruction.cs index ad1637c58..7b06073bf 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooConstruction.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooConstruction.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -31,7 +34,7 @@ public class GooConstructionParam : GH_PersistentParam { public override Guid ComponentGuid => new Guid("3ea9345b-ddad-409d-9f9f-5103115123c0"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public GooConstructionParam() : base(typeof(Construction).Name, typeof(Construction).Name, typeof(Construction).FullName.Replace(".", " "), "Params", "SAM") @@ -62,4 +65,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooConstructionLayer.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooConstructionLayer.cs index 8c61e01dc..f778eaafb 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooConstructionLayer.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooConstructionLayer.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -9,7 +12,7 @@ namespace SAM.Analytical.Grasshopper { - public class GooConstructionLayer: GooJSAMObject + public class GooConstructionLayer : GooJSAMObject { public GooConstructionLayer() : base() @@ -74,17 +77,17 @@ public override string ToString() public override bool CastFrom(object source) { - if(source is IGH_Goo) + if (source is IGH_Goo) { object value = (source as dynamic).Value; ConstructionLayer constructionLayer = value as ConstructionLayer; - if(constructionLayer != null) + if (constructionLayer != null) { Value = constructionLayer; return true; } } - + return base.CastFrom(source); } @@ -98,7 +101,7 @@ public class GooConstructionLayerParam : GH_PersistentParam new Guid("8ebc44e2-3c71-401c-acd5-1f9903cb49ee"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public GooConstructionLayerParam() : base(typeof(ConstructionLayer).Name, typeof(ConstructionLayer).Name, typeof(ConstructionLayer).FullName.Replace(".", " "), "Params", "SAM") @@ -129,4 +132,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooConstructionLibrary.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooConstructionLibrary.cs index 9428711a6..4093397f6 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooConstructionLibrary.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooConstructionLibrary.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -31,7 +34,7 @@ public class GooConstructionLibraryParam : GH_PersistentParam new Guid("de88bd44-f2f8-48eb-a90d-459ea413dbab"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public GooConstructionLibraryParam() : base(typeof(ConstructionLibrary).Name, typeof(ConstructionLibrary).Name, typeof(ConstructionLibrary).FullName.Replace(".", " "), "Params", "SAM") @@ -62,4 +65,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooConstructionManager.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooConstructionManager.cs index 0a51009c5..12574c9ea 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooConstructionManager.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooConstructionManager.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -31,7 +34,7 @@ public class GooConstructionManagerParam : GH_PersistentParam new Guid("670d02cc-8a99-43e8-9ad8-b75c6a999f31"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public GooConstructionManagerParam() : base(typeof(ConstructionManager).Name, typeof(ConstructionManager).Name, typeof(ConstructionManager).FullName.Replace(".", " "), "Params", "SAM") @@ -62,4 +65,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooDegreeOfActivity.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooDegreeOfActivity.cs index 8810cae20..d3af868ce 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooDegreeOfActivity.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooDegreeOfActivity.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -64,4 +67,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooDegreeOfActivityLibrary.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooDegreeOfActivityLibrary.cs index 751cb8f5f..cd440142f 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooDegreeOfActivityLibrary.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooDegreeOfActivityLibrary.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -33,7 +36,7 @@ public class GooDegreeOfActivityLibraryParam : GH_PersistentParam GH_Exposure.hidden; - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public GooDegreeOfActivityLibraryParam() : base(typeof(DegreeOfActivityLibrary).Name, typeof(DegreeOfActivityLibrary).Name, typeof(DegreeOfActivityLibrary).FullName.Replace(".", " "), "Params", "SAM") @@ -64,4 +67,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooDesignDay.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooDesignDay.cs index 92cbd2d31..179cb4dec 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooDesignDay.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooDesignDay.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using Rhino.Geometry; using SAM.Analytical.Grasshopper.Properties; @@ -32,7 +35,7 @@ public class GooDesignDayParam : GH_PersistentParam, IGH_PreviewOb { public override Guid ComponentGuid => new Guid("16fcd325-054c-4dd9-b668-4d8589562c34"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); bool IGH_PreviewObject.Hidden { get; set; } @@ -73,4 +76,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooExternalSpace.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooExternalSpace.cs index 6a44174e0..34d4672ce 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooExternalSpace.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooExternalSpace.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -31,7 +34,7 @@ public class GooExternalSpaceParam : GH_PersistentParam { public override Guid ComponentGuid => new Guid("1D59B4F4-8930-48dF-9ADF-C39Fa7D1DB53"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public GooExternalSpaceParam() : base(typeof(ExternalSpace).Name, typeof(ExternalSpace).Name, typeof(ExternalSpace).FullName.Replace(".", " "), "Params", "SAM") @@ -62,4 +65,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooFeatureShade.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooFeatureShade.cs index 5c5d11812..ae251b4a7 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooFeatureShade.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooFeatureShade.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -31,7 +34,7 @@ public class GooFeatureShadeParam : GH_PersistentParam { public override Guid ComponentGuid => new Guid("b2a2c960-278e-4db2-8c2e-fa883881f03a"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public GooFeatureShadeParam() : base(typeof(FeatureShade).Name, typeof(FeatureShade).Name, typeof(FeatureShade).FullName.Replace(".", " "), "Params", "SAM") @@ -62,4 +65,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooInternalCondition.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooInternalCondition.cs index 5cf086ecf..b81b5abe3 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooInternalCondition.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooInternalCondition.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -31,7 +34,7 @@ public class GooInternalConditionParam : GH_PersistentParam new Guid("f9c8a887-a59d-4c09-91f3-e656673db1ea"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public GooInternalConditionParam() : base(typeof(InternalCondition).Name, typeof(InternalCondition).Name, typeof(InternalCondition).FullName.Replace(".", " "), "Params", "SAM") @@ -62,4 +65,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooInternalConditionLibrary.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooInternalConditionLibrary.cs index 268db7e57..ef4673d5a 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooInternalConditionLibrary.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooInternalConditionLibrary.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -31,7 +34,7 @@ public class GooInternalConditionLibraryParam : GH_PersistentParam new Guid("33c1494a-aece-4ac4-a413-a7cb79795579"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public GooInternalConditionLibraryParam() : base(typeof(InternalConditionLibrary).Name, typeof(InternalConditionLibrary).Name, typeof(InternalConditionLibrary).FullName.Replace(".", " "), "Params", "SAM") @@ -62,4 +65,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooMergeSettings.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooMergeSettings.cs index 4d2dbd6cd..42525b264 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooMergeSettings.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooMergeSettings.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -31,7 +34,7 @@ public class GooMergeSettingsParam : GH_PersistentParam { public override Guid ComponentGuid => new Guid("afad3e4c-1e8d-4c08-92d9-cc7b484cba22"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public GooMergeSettingsParam() : base(typeof(MergeSettings).Name, typeof(MergeSettings).Name, typeof(MergeSettings).FullName.Replace(".", " "), "Params", "SAM") @@ -62,4 +65,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooOpeningProperties.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooOpeningProperties.cs index f7e72ce65..43ed21eb7 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooOpeningProperties.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooOpeningProperties.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using Rhino.Geometry; using SAM.Analytical.Grasshopper.Properties; @@ -32,7 +35,7 @@ public class GooOpeningPropertiesParam : GH_PersistentParam new Guid("0e4a7307-0039-4414-bc56-1c7e3253cf0b"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -75,4 +78,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooPanel.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooPanel.cs index 36b095cf3..4cffdf52c 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooPanel.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooPanel.cs @@ -1,4 +1,7 @@ -using GH_IO.Serialization; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using GH_IO.Serialization; using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using Rhino; @@ -8,22 +11,22 @@ using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper; +using SAM.Geometry.Object.Spatial; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Windows.Forms; -using SAM.Geometry.Object.Spatial; namespace SAM.Analytical.Grasshopper { public class GooPanel : GooJSAMObject, IGH_PreviewData, IGH_BakeAwareData { - public BoundaryType? BoundaryType { get; } = null; - - public bool ShowAll { get; set; } = true; - + public BoundaryType? BoundaryType { get; } = null; + + public bool ShowAll { get; set; } = true; + public GooPanel() : base() { @@ -78,7 +81,7 @@ public void DrawViewportWires(GH_PreviewWireArgs args) } Panel panel = Value as Panel; - if(panel == null) + if (panel == null) { return; } @@ -117,7 +120,7 @@ public void DrawViewportMeshes(GH_PreviewMeshArgs args) return; } - if(!ShowAll) + if (!ShowAll) { Point3D point3D_CameraLocation = Geometry.Rhino.Convert.ToSAM(RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport.CameraLocation); if (point3D_CameraLocation == null) @@ -146,7 +149,7 @@ public void DrawViewportMeshes(GH_PreviewMeshArgs args) args.Pipeline.DrawBrepShaded(brep, displayMaterial); - if(Value is Panel) + if (Value is Panel) { List apertures = ((Panel)Value).Apertures; if (apertures != null) @@ -178,17 +181,17 @@ public bool BakeGeometry(RhinoDoc doc, ObjectAttributes att, out Guid obj_guid) } bool result = Rhino.Modify.BakeGeometry(Value, doc, att, out List obj_guids); - if(!result) + if (!result) { return false; } - if(obj_guids == null || obj_guids.Count ==0) + if (obj_guids == null || obj_guids.Count == 0) { return false; } - if(obj_guids.Count == 1) + if (obj_guids.Count == 1) { obj_guid = obj_guids[0]; return result; @@ -197,7 +200,7 @@ public bool BakeGeometry(RhinoDoc doc, ObjectAttributes att, out Guid obj_guid) int index = doc.Groups.Add(Value.Guid.ToString()); Group group = doc.Groups.ElementAt(index); - foreach(Guid guid in obj_guids) + foreach (Guid guid in obj_guids) { doc.Groups.AddToGroup(index, guid); } @@ -259,10 +262,10 @@ public override bool CastTo(ref Y target) public class GooPanelParam : GH_PersistentParam, IGH_PreviewObject, IGH_BakeAwareObject { private bool showAll = true; - + public override Guid ComponentGuid => new Guid("278B438C-43EA-4423-999F-B6A906870939"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); bool IGH_PreviewObject.Hidden { get; set; } @@ -318,12 +321,12 @@ protected override GH_GetterResult Prompt_Plural(ref List values) if (getObject.CommandResult() != Result.Success) return GH_GetterResult.cancel; - if(getObject.ObjectCount == 0) + if (getObject.ObjectCount == 0) return GH_GetterResult.cancel; values = new List(); - for (int i =0; i < getObject.ObjectCount; i++) + for (int i = 0; i < getObject.ObjectCount; i++) { ObjRef objRef = getObject.Object(i); @@ -356,10 +359,10 @@ protected override GH_GetterResult Prompt_Plural(ref List values) if (panels_Old != null && panels_Old.Count != 0) { - for(int j =0; j < panels.Count; j++) + for (int j = 0; j < panels.Count; j++) { Panel panel_Old = panels_Old.Closest(panels[j].GetInternalPoint3D()); - if(panel_Old != null) + if (panel_Old != null) { panels[j] = Create.Panel(panel_Old.Guid, panel_Old, panels[j].GetFace3D()); } @@ -461,7 +464,7 @@ public void BakeGeometry(RhinoDoc doc, List obj_ids) public void BakeGeometry(RhinoDoc doc, ObjectAttributes att, List obj_ids) { foreach (var value in VolatileData.AllData(true)) - { + { Guid uuid = default; (value as IGH_BakeAwareData)?.BakeGeometry(doc, att, out uuid); obj_ids.Add(uuid); @@ -485,7 +488,7 @@ public void BakeGeometry_ByConstruction(RhinoDoc doc) public override void AppendAdditionalMenuItems(ToolStripDropDown menu) { - Menu_AppendItem(menu, "Show All", Menu_ShowAll, Core.Convert.ToBitmap(Resources.SAM3) , VolatileData.AllData(true).Any(), showAll).Tag = showAll; + Menu_AppendItem(menu, "Show All", Menu_ShowAll, Core.Convert.ToBitmap(Resources.SAM3), VolatileData.AllData(true).Any(), showAll).Tag = showAll; Menu_AppendItem(menu, "Bake By Type", Menu_BakeByPanelType, Core.Convert.ToBitmap(Resources.SAM3), VolatileData.AllData(true).Any()); Menu_AppendItem(menu, "Bake By Construction", Menu_BakeByConstruction, Core.Convert.ToBitmap(Resources.SAM3), VolatileData.AllData(true).Any()); @@ -533,9 +536,9 @@ public override bool Write(GH_IWriter writer) public override bool Read(GH_IReader reader) { - if(reader != null) + if (reader != null) reader.TryGetBoolean(GetType().FullName, ref showAll); - + return base.Read(reader); } @@ -544,4 +547,4 @@ private void Menu_OpenInUI(object sender, EventArgs e) Process process = Convert.ToUI(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooPlanarBoundary3D.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooPlanarBoundary3D.cs index bea84ac1d..4525f0ae3 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooPlanarBoundary3D.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooPlanarBoundary3D.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using Rhino; using Rhino.Display; @@ -110,7 +113,7 @@ public class GooPlanarBoundary3DParam : GH_PersistentParam, { public override Guid ComponentGuid => new Guid("3b944b3c-bc94-46cc-aea3-b74385e138dc"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -170,4 +173,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooProfile.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooProfile.cs index 000b0329c..9ae0e3168 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooProfile.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooProfile.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -31,7 +34,7 @@ public class GooProfileParam : GH_PersistentParam { public override Guid ComponentGuid => new Guid("247b6aaf-3b88-4b35-87b4-c418f09a4257"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public GooProfileParam() : base(typeof(Profile).Name, typeof(Profile).Name, typeof(Profile).FullName.Replace(".", " "), "Params", "SAM") @@ -62,4 +65,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooProfileLibrary.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooProfileLibrary.cs index ffa3e72b9..84a67c2be 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooProfileLibrary.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooProfileLibrary.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -31,7 +34,7 @@ public class GooProfileLibraryParam : GH_PersistentParam { public override Guid ComponentGuid => new Guid("3aeebe85-3f0c-4483-ad5c-750120490d63"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public GooProfileLibraryParam() : base(typeof(ProfileLibrary).Name, typeof(ProfileLibrary).Name, typeof(ProfileLibrary).FullName.Replace(".", " "), "Params", "SAM") @@ -62,4 +65,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooSection.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooSection.cs index 5137abdf0..811c855b3 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooSection.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooSection.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -33,7 +36,7 @@ public class GooSectionParam : GH_PersistentParam public override GH_Exposure Exposure => GH_Exposure.hidden; - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public GooSectionParam() : base(typeof(ISection).Name, typeof(ISection).Name, typeof(ISection).FullName.Replace(".", " "), "Params", "SAM") @@ -64,4 +67,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooSpace.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooSpace.cs index 288ad5f45..ca2ac5e8a 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooSpace.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooSpace.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using Rhino; using Rhino.Commands; @@ -74,7 +77,7 @@ public class GooSpaceParam : GH_PersistentParam, IGH_PreviewObject, IG { public override Guid ComponentGuid => new Guid("bbb45545-17b3-49be-b177-db284b2087f3"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); bool IGH_PreviewObject.Hidden { get; set; } @@ -131,7 +134,7 @@ protected override GH_GetterResult Prompt_Plural(ref List values) if (!string.IsNullOrWhiteSpace(@string)) { spaces = Core.Convert.ToSAM(@string); - if(spaces != null) + if (spaces != null) { Point3D point3D = Geometry.Rhino.Convert.ToSAM(point); if (point3D != null) @@ -156,7 +159,7 @@ protected override GH_GetterResult Prompt_Plural(ref List values) if (string.IsNullOrWhiteSpace(name)) name = "Cell"; - spaces = new List() { new Space(name, point3D)}; + spaces = new List() { new Space(name, point3D) }; } if (spaces == null || spaces.Count == 0) @@ -280,4 +283,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooText3D.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooText3D.cs index 1e92332b5..2fc47a2cc 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooText3D.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooText3D.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using Rhino; using Rhino.DocObjects; @@ -165,7 +168,7 @@ public class GooText3DParam : GH_PersistentParam public override GH_Exposure Exposure => GH_Exposure.hidden; - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public GooText3DParam() : base(typeof(global::Rhino.Display.Text3d).Name, typeof(global::Rhino.Display.Text3d).Name, typeof(global::Rhino.Display.Text3d).FullName.Replace(".", " "), "Params", "SAM") @@ -196,4 +199,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooTypeMergeSettings.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooTypeMergeSettings.cs index df14b58cf..b0fb05483 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooTypeMergeSettings.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/GooTypeMergeSettings.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -31,7 +34,7 @@ public class GooTypeMergeSettingsParam : GH_PersistentParam new Guid("b9937ca2-b756-45e5-b891-5dd277b0d29e"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public GooTypeMergeSettingsParam() : base(typeof(TypeMergeSettings).Name, typeof(TypeMergeSettings).Name, typeof(TypeMergeSettings).FullName.Replace(".", " "), "Params", "SAM") @@ -62,4 +65,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooArchitecturalModel.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooArchitecturalModel.cs index bc697b7d7..ed6dd18a2 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooArchitecturalModel.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooArchitecturalModel.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using Rhino; using Rhino.DocObjects; @@ -38,11 +41,11 @@ public BoundingBox ClippingBox public bool BakeGeometry(RhinoDoc doc, ObjectAttributes att, out Guid obj_guid) { obj_guid = Guid.Empty; - + if (Value == null) return false; - return Rhino.Modify.BakeGeometry( Value, doc, att, out obj_guid); + return Rhino.Modify.BakeGeometry(Value, doc, att, out obj_guid); } public void DrawViewportMeshes(GH_PreviewMeshArgs args) @@ -119,7 +122,7 @@ public class GooBuildingModelParam : GH_PersistentParam, IGH_P { public override Guid ComponentGuid => new Guid("F11A6C34-3376-4A5D-8C6C-1D5331A7C96A"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -204,4 +207,4 @@ private void Menu_BakeByAnalyticalType(object sender, EventArgs e) BakeGeometry_ByAnalyticalType(RhinoDoc.ActiveDoc); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooFloorType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooFloorType.cs index 29371f94b..686d07e9d 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooFloorType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooFloorType.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -31,7 +34,7 @@ public class GooFloorTypeParam : GH_PersistentParam { public override Guid ComponentGuid => new Guid("3ace849b-b3f0-463e-88bb-3a1f60803507"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -50,4 +53,4 @@ protected override GH_GetterResult Prompt_Singular(ref GooFloorType value) throw new NotImplementedException(); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooHostPartitionType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooHostPartitionType.cs index 20ff6a259..da7ba5b9f 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooHostPartitionType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooHostPartitionType.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -31,7 +34,7 @@ public class GooHostPartitionTypeParam : GH_PersistentParam new Guid("d906080a-02e8-4a53-b394-ab9889a8b79f"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -50,4 +53,4 @@ protected override GH_GetterResult Prompt_Singular(ref GooHostPartitionType valu throw new NotImplementedException(); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooOpening.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooOpening.cs index 19529488c..eaa03fa3d 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooOpening.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooOpening.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using Rhino; using Rhino.Commands; @@ -14,7 +17,7 @@ namespace SAM.Analytical.Grasshopper { - + [Obsolete("Obsolete since 2021.11.24")] public class GooOpening : GooJSAMObject, IGH_PreviewData, IGH_BakeAwareData { @@ -123,7 +126,7 @@ public void DrawViewportMeshes(GH_PreviewMeshArgs args) public bool BakeGeometry(RhinoDoc doc, ObjectAttributes att, out Guid obj_guid) { obj_guid = Guid.Empty; - + return Rhino.Modify.BakeGeometry(Value, doc, att, out obj_guid); } @@ -180,7 +183,7 @@ public class GooOpeningParam : GH_PersistentParam, IGH_PreviewObject { public override Guid ComponentGuid => new Guid("7c7fd553-1861-44c9-a16d-5c76da18fc1e"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -316,7 +319,7 @@ protected override GH_GetterResult Prompt_Singular(ref GooOpening value) continue; openings.RemoveAll(x => x == null); - if(openings.Count != 0) + if (openings.Count != 0) { value = new GooOpening(openings[0]); return GH_GetterResult.success; @@ -336,13 +339,13 @@ public void BakeGeometry(RhinoDoc doc, ObjectAttributes att, List obj_ids) foreach (IGH_Goo goo in VolatileData.AllData(true)) { Guid guid = default; - + IGH_BakeAwareData bakeAwareData = goo as IGH_BakeAwareData; if (bakeAwareData != null) bakeAwareData.BakeGeometry(doc, att, out guid); - + obj_ids.Add(guid); } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooOpeningType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooOpeningType.cs index 63bc8faf9..63cc1885c 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooOpeningType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooOpeningType.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -31,7 +34,7 @@ public class GooOpeningTypeParam : GH_PersistentParam { public override Guid ComponentGuid => new Guid("9f098df0-3f53-4b32-bf8f-0e974b86e44e"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -50,4 +53,4 @@ protected override GH_GetterResult Prompt_Singular(ref GooOpeningType value) throw new NotImplementedException(); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooPartition.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooPartition.cs index 938fe47f0..57dac3c94 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooPartition.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooPartition.cs @@ -1,4 +1,7 @@ -using GH_IO.Serialization; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using GH_IO.Serialization; using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using Rhino; @@ -8,12 +11,12 @@ using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper; +using SAM.Geometry.Object.Spatial; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; -using SAM.Geometry.Object.Spatial; namespace SAM.Analytical.Grasshopper { @@ -21,7 +24,7 @@ namespace SAM.Analytical.Grasshopper public class GooPartition : GooJSAMObject, IGH_PreviewData, IGH_BakeAwareData { public bool ShowAll = true; - + public GooPartition() : base() { @@ -51,7 +54,7 @@ public override IGH_Goo Duplicate() public void DrawViewportWires(GH_PreviewWireArgs args) { Face3D face3D = Value?.Face3D; - if(face3D == null) + if (face3D == null) { return; } @@ -67,7 +70,7 @@ public void DrawViewportWires(GH_PreviewWireArgs args) Geometry.Grasshopper.Modify.DrawViewportWires(face3D, args, color_ExternalEdge, color_InternalEdges); - if(Value is IHostPartition) + if (Value is IHostPartition) { List openings = ((IHostPartition)Value).GetOpenings(); if (openings != null) @@ -98,7 +101,7 @@ public void DrawViewportMeshes(GH_PreviewMeshArgs args) if (face3D == null) return; - if(!ShowAll) + if (!ShowAll) { Point3D point3D_CameraLocation = Geometry.Rhino.Convert.ToSAM(RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport.CameraLocation); if (point3D_CameraLocation == null) @@ -119,7 +122,7 @@ public void DrawViewportMeshes(GH_PreviewMeshArgs args) args.Pipeline.DrawBrepShaded(brep, displayMaterial); - if(Value is IHostPartition) + if (Value is IHostPartition) { List openings = ((IHostPartition)Value).GetOpenings(); if (openings != null) @@ -202,10 +205,10 @@ public override bool CastTo(ref Y target) public class GooPartitionParam : GH_PersistentParam, IGH_PreviewObject, IGH_BakeAwareObject { private bool showAll = true; - + public override Guid ComponentGuid => new Guid("0091B0F4-8009-4388-8914-A3FE680EF12D"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -263,12 +266,12 @@ protected override GH_GetterResult Prompt_Plural(ref List values) if (getObject.CommandResult() != Result.Success) return GH_GetterResult.cancel; - if(getObject.ObjectCount == 0) + if (getObject.ObjectCount == 0) return GH_GetterResult.cancel; values = new List(); - for (int i =0; i < getObject.ObjectCount; i++) + for (int i = 0; i < getObject.ObjectCount; i++) { ObjRef objRef = getObject.Object(i); @@ -294,10 +297,10 @@ protected override GH_GetterResult Prompt_Plural(ref List values) if (geometryBase.HasUserData) { string @string = geometryBase.GetUserString("SAM"); - if(!string.IsNullOrWhiteSpace(@string)) + if (!string.IsNullOrWhiteSpace(@string)) { partitions = Core.Convert.ToSAM(@string); - if(partitions != null) + if (partitions != null) { partitions.RemoveAll(x => x == null); } @@ -316,8 +319,8 @@ protected override GH_GetterResult Prompt_Plural(ref List values) } } } - - if(partitions == null || partitions.Count == 0) + + if (partitions == null || partitions.Count == 0) { partitions = Create.HostPartitions(sAMGeometry3Ds)?.Cast().ToList(); } @@ -406,7 +409,7 @@ protected override GH_GetterResult Prompt_Singular(ref GooPartition value) continue; partitions.RemoveAll(x => x == null || x.Face3D == null); - if(partitions.Count != 0) + if (partitions.Count != 0) { value = new GooPartition(partitions[0]); return GH_GetterResult.success; @@ -482,10 +485,10 @@ public override bool Write(GH_IWriter writer) public override bool Read(GH_IReader reader) { - if(reader != null) + if (reader != null) reader.TryGetBoolean(GetType().FullName, ref showAll); - + return base.Read(reader); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooRoofType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooRoofType.cs index e90a14990..4b6f59c74 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooRoofType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooRoofType.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -31,7 +34,7 @@ public class GooRoofTypeParam : GH_PersistentParam { public override Guid ComponentGuid => new Guid("4986fedf-7b51-4873-aef6-b6768412b9e9"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -50,4 +53,4 @@ protected override GH_GetterResult Prompt_Singular(ref GooRoofType value) throw new NotImplementedException(); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooWallType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooWallType.cs index 1a41eac03..094cc057a 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooWallType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Classes/New/GooWallType.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -31,7 +34,7 @@ public class GooWallTypeParam : GH_PersistentParam { public override Guid ComponentGuid => new Guid("eb9d3d8d-fd66-4128-a080-8c215f2eec15"); - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -50,4 +53,4 @@ protected override GH_GetterResult Prompt_Singular(ref GooWallType value) throw new NotImplementedException(); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/A_SAMAnalytical.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/A_SAMAnalytical.cs index b2ef02d77..c0080ad7f 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/A_SAMAnalytical.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/A_SAMAnalytical.cs @@ -1,7 +1,9 @@ -using System; -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using Grasshopper.Kernel; -using SAM.Core; +using System; +using System.Collections.Generic; namespace SAM.Analytical.Grasshopper { @@ -24,7 +26,7 @@ protected override void RegisterOutputParams(GH_OutputParamManager manager) } static int ToIndex(char value) => value - 'A'; - + static char ToChar(int value) => (char)('A' + value); public bool CanInsertParameter(GH_ParameterSide side, int index) @@ -51,7 +53,7 @@ public IGH_Param CreateParameter(GH_ParameterSide side, int index) } public bool DestroyParameter(GH_ParameterSide side, int index) => CanRemoveParameter(side, index); - + public void VariableParameterMaintenance() { } public override void AddedToDocument(GH_Document document) @@ -112,11 +114,11 @@ protected override void SolveInstance(IGH_DataAccess DA) string filter = string.Empty; if (DA.GetData(i, ref filter) && filter is object) { - if(Core.Convert.ToSAM(filter) is List panels && panels.Count != 0) + if (Core.Convert.ToSAM(filter) is List panels && panels.Count != 0) { panel = panels[0]; } - else if(Core.Query.TryConvert(filter, out double value)) + else if (Core.Query.TryConvert(filter, out double value)) { ratio = value; } @@ -136,4 +138,4 @@ protected override void SolveInstance(IGH_DataAccess DA) DA.SetData("Filter", string.Join("_", filters)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalAddAirPartitions.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalAddAirPartitions.cs index 4ccefec01..945424dfd 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalAddAirPartitions.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalAddAirPartitions.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -24,7 +27,7 @@ public class SAMAnalyticalAddAirPartitions : GH_SAMVariableOutputParameterCompon /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -153,4 +156,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, new GooBuildingModel(buildingModel)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalAddMissingMaterials.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalAddMissingMaterials.cs index 2a5e39387..3e66f71b9 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalAddMissingMaterials.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalAddMissingMaterials.cs @@ -1,4 +1,7 @@ -//using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +//using Grasshopper.Kernel; //using SAM.Analytical.Grasshopper.Properties; //using SAM.Core.Grasshopper; //using System; @@ -44,7 +47,7 @@ // get // { // List result = new List(); - + // result.Add(new GH_SAMParam(new GooBuildingModelParam() { Name = "_buildingModel", NickName = "_buildingModel", Description = "SAM Architectural BuildingModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); // GooMaterialLibraryParam gooMaterialLibraryParam = new GooMaterialLibraryParam { Name = "_materialLibrary_", NickName = "_materialLibrary_", Description = "SAM Core Material Library", Access = GH_ParamAccess.item }; @@ -113,4 +116,4 @@ // dataAccess.SetDataList(index, missingMaterialNames); // } // } -//} \ No newline at end of file +//} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalAddMissingProfiles.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalAddMissingProfiles.cs index 5e5a2c098..f1bc93d1a 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalAddMissingProfiles.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalAddMissingProfiles.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -22,7 +25,7 @@ public class SAMAddMissingProfiles : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -44,9 +47,9 @@ protected override GH_SAMParam[] Inputs get { List result = new List(); - + result.Add(new GH_SAMParam(new GooBuildingModelParam() { Name = "_buildingModel", NickName = "_buildingModel", Description = "SAM Architectural BuildingModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - + GooProfileLibraryParam gooProfileLibraryParam = new GooProfileLibraryParam { Name = "_profileLibrary_", NickName = "_profileLibrary_", Description = "SAM Analytical Profile Library", Access = GH_ParamAccess.item }; gooProfileLibraryParam.PersistentData.Append(new GooProfileLibrary(Analytical.Query.DefaultProfileLibrary())); result.Add(new GH_SAMParam(gooProfileLibraryParam, ParamVisibility.Binding)); @@ -98,7 +101,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) buildingModel = new BuildingModel(buildingModel); - List profiles = buildingModel.AddMissingProfiles(profileLibrary, out Dictionary> missingProfileNames); + List profiles = buildingModel.AddMissingProfiles(profileLibrary, out Dictionary> missingProfileNames); index = Params.IndexOfOutputParam("buildingModel"); if (index != -1) @@ -112,9 +115,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (index != -1) { List missingProfileNames_Temp = new List(); - if(missingProfileNames != null) + if (missingProfileNames != null) { - foreach(KeyValuePair> keyValuePair in missingProfileNames) + foreach (KeyValuePair> keyValuePair in missingProfileNames) { missingProfileNames_Temp.AddRange(keyValuePair.Value); } @@ -122,7 +125,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, missingProfileNames_Temp); } - + } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalAddOpenings.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalAddOpenings.cs index 8a10a3bc3..d00a60677 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalAddOpenings.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalAddOpenings.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalAddOpenings : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -65,7 +68,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(2, false); List openings = new List(); - if(!dataAccess.GetDataList(1, openings) || openings == null) + if (!dataAccess.GetDataList(1, openings) || openings == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -82,10 +85,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (sAMObject is IHostPartition) { IHostPartition hostPartition = (IHostPartition)sAMObject.Clone(); - - foreach(IOpening opening in openings) + + foreach (IOpening opening in openings) { - if(hostPartition.TryAddOpening(opening)) + if (hostPartition.TryAddOpening(opening)) { openings_Added.Add(opening); } @@ -95,7 +98,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(1, openings_Added?.ConvertAll(x => new GooOpening(x))); dataAccess.SetData(2, openings_Added != null && openings_Added.Count != 0); } - else if(sAMObject is BuildingModel) + else if (sAMObject is BuildingModel) { BuildingModel buildingModel = new BuildingModel((BuildingModel)sAMObject); @@ -107,4 +110,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalAddOpeningsByAzimuth.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalAddOpeningsByAzimuth.cs index c761c65c3..a2b457008 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalAddOpeningsByAzimuth.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalAddOpeningsByAzimuth.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -24,7 +27,7 @@ public class SAMAnalyticalAddOpeningsByAzimuth : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -88,7 +91,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } - if(azimuths.Count != ratios.Count) + if (azimuths.Count != ratios.Count) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -119,7 +122,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; OpeningType openingType_Temp = openingType; - if(openingType_Temp == null) + if (openingType_Temp == null) { openingType_Temp = openingTypeLibrary.GetOpeningTypes(OpeningAnalyticalType.Window, hostPartition.HostPartitionCategory())?.FirstOrDefault(); if (openingType_Temp == null) @@ -142,14 +145,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(1, openings?.ConvertAll(x => new GooOpening(x))); dataAccess.SetData(2, true); } - else if(sAMObject is BuildingModel) + else if (sAMObject is BuildingModel) { BuildingModel buildingModel = new BuildingModel((BuildingModel)sAMObject); List walls = buildingModel.GetObjects(new Func((Wall wall) => buildingModel.External(wall))); - if(walls != null) + if (walls != null) { List openings = new List(); - foreach(Wall wall in walls) + foreach (Wall wall in walls) { double azimuth = wall.Azimuth(); if (double.IsNaN(azimuth)) @@ -170,7 +173,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } IOpening opening = wall.AddOpening(openingType_Temp, ratio); - if(opening != null) + if (opening != null) { openings.Add(opening); } @@ -183,4 +186,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalCreateBuildingModelBy2DGeometries.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalCreateBuildingModelBy2DGeometries.cs index 140faa362..b5605789e 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalCreateBuildingModelBy2DGeometries.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalCreateBuildingModelBy2DGeometries.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -29,7 +32,7 @@ public class SAMAnalyticalCreateBuildingModelBy2DGeometries : GH_SAMVariableOutp /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -62,7 +65,7 @@ protected override GH_SAMParam[] Inputs paramNumber.SetPersistentData(0); result.Add(new GH_SAMParam(paramNumber, ParamVisibility.Voluntary)); - GooLocationParam locationParam = new GooLocationParam() { Name = "_location_", NickName = "_location_", Description = "SAM Core Location", Access = GH_ParamAccess.item}; + GooLocationParam locationParam = new GooLocationParam() { Name = "_location_", NickName = "_location_", Description = "SAM Core Location", Access = GH_ParamAccess.item }; locationParam.SetPersistentData(Core.Query.DefaultLocation()); result.Add(new GH_SAMParam(locationParam, ParamVisibility.Voluntary)); @@ -143,7 +146,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) double tolerance = Core.Tolerance.Distance; index = Params.IndexOfInputParam("tolerance_"); - if(index != -1) + if (index != -1) { double tolerance_Temp = double.NaN; if (dataAccess.GetData(index, ref tolerance_Temp)) @@ -287,7 +290,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (index != -1) { BuildingModel buildingModel = Create.BuildingModel(face3Ds, elevation_Ground, tolerance); - if(buildingModel != null) + if (buildingModel != null) { buildingModel.Address = address; buildingModel.Location = location; @@ -297,4 +300,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalCreateBuildingModelByShells.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalCreateBuildingModelByShells.cs index a89e1284e..e7b5de47d 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalCreateBuildingModelByShells.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalCreateBuildingModelByShells.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -24,7 +27,7 @@ public class SAMAnalyticalCreateBuildingModelByShells : GH_SAMVariableOutputPara /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -61,7 +64,7 @@ protected override GH_SAMParam[] Inputs paramNumber.SetPersistentData(0); result.Add(new GH_SAMParam(paramNumber, ParamVisibility.Voluntary)); - GooLocationParam locationParam = new GooLocationParam() { Name = "_location_", NickName = "_location_", Description = "SAM Core Location", Access = GH_ParamAccess.item}; + GooLocationParam locationParam = new GooLocationParam() { Name = "_location_", NickName = "_location_", Description = "SAM Core Location", Access = GH_ParamAccess.item }; locationParam.SetPersistentData(Core.Query.DefaultLocation()); result.Add(new GH_SAMParam(locationParam, ParamVisibility.Voluntary)); @@ -135,7 +138,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("partitions_"); List partitions = null; - if(index != -1) + if (index != -1) { partitions = new List(); dataAccess.GetDataList(index, partitions); @@ -187,12 +190,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetData(index, ref materialLibrary); BuildingModel buildingModel = Create.BuildingModel(shells, partitions, groundElevation, true, materialLibrary, 0.01, minArea, maxDistance, maxAngle, silverSpacing, tolerance, Core.Tolerance.Angle); - if(buildingModel != null) + if (buildingModel != null) { if (partitions == null || partitions.Count == 0) { HostPartitionTypeLibrary hostPartitionTypeLibrary = Analytical.Query.DefaultHostPartitionTypeLibrary(); - + buildingModel.UpdateHostPartitionType( curtainWallType: hostPartitionTypeLibrary.GetHostPartitionType(PartitionAnalyticalType.CurtainWall), internalWallType: hostPartitionTypeLibrary.GetHostPartitionType(PartitionAnalyticalType.InternalWall), @@ -217,4 +220,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, new GooBuildingModel(buildingModel)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalCreateHostPartitionType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalCreateHostPartitionType.cs index 0ceff8d7d..66832b970 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalCreateHostPartitionType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalCreateHostPartitionType.cs @@ -1,13 +1,15 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; +using SAM.Architectural; +using SAM.Architectural.Grasshopper; using SAM.Core.Grasshopper; using System; using System.Collections.Generic; -using SAM.Architectural.Grasshopper; -using SAM.Architectural; - namespace SAM.Analytical.Grasshopper { [Obsolete("Obsolete since 2021.11.24")] @@ -26,7 +28,7 @@ public class SAMAnalyticalCreateHostPartitionType : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -97,4 +99,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooHostPartitionType(hostPartitionType)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalCreateHostPartitionsBy3DGeometry.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalCreateHostPartitionsBy3DGeometry.cs index 1d8274dd0..0239adbcf 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalCreateHostPartitionsBy3DGeometry.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalCreateHostPartitionsBy3DGeometry.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -25,7 +28,7 @@ public class SAMAnalyticalCreateHostPartitionBy3DGeometry : GH_SAMVariableOutput /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -160,10 +163,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("hostPartitions"); - if(index != -1) + if (index != -1) { dataAccess.SetDataList(index, hostPartitions.ConvertAll(x => new GooPartition(x))); } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalCreateMaterialLayersByNames.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalCreateMaterialLayersByNames.cs index 78767fd9e..db5fb6d53 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalCreateMaterialLayersByNames.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalCreateMaterialLayersByNames.cs @@ -1,12 +1,14 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; +using SAM.Architectural; +using SAM.Architectural.Grasshopper; using SAM.Core.Grasshopper; using System; using System.Collections.Generic; -using SAM.Architectural.Grasshopper; -using SAM.Architectural; - namespace SAM.Analytical.Grasshopper { [Obsolete("Obsolete since 2021.11.24")] @@ -25,7 +27,7 @@ public class SAMAnalyticalCreateMaterialLayersByNames : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -45,9 +47,9 @@ public SAMAnalyticalCreateMaterialLayersByNames() protected override void RegisterInputParams(GH_InputParamManager inputParamManager) { int index = -1; - + inputParamManager.AddTextParameter("_names", "_names", "Material Layer Name", GH_ParamAccess.list); - + index = inputParamManager.AddNumberParameter("_thicknesses_", "_thicknesses_", "Contruction Layer Thicknesses", GH_ParamAccess.list); inputParamManager[index].Optional = true; @@ -98,4 +100,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(0, materialLayers?.ConvertAll(x => new GooMaterialLayer(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalCreateOpeningsBy3DGeometry.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalCreateOpeningsBy3DGeometry.cs index 88282a651..c1a78f678 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalCreateOpeningsBy3DGeometry.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalCreateOpeningsBy3DGeometry.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -25,7 +28,7 @@ public class SAMAnalyticalCreateOpeningsBy3DGeometry : GH_SAMVariableOutputParam /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -121,11 +124,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) PartitionAnalyticalType partitionAnalyticalType = PartitionAnalyticalType.Undefined; HostPartitionCategory hostPartitionCategory = Analytical.Query.HostPartitionCategory(face3D.GetPlane().Normal); - if(hostPartitionCategory == HostPartitionCategory.Floor) + if (hostPartitionCategory == HostPartitionCategory.Floor) { partitionAnalyticalType = PartitionAnalyticalType.ExternalFloor; } - else if(hostPartitionCategory == HostPartitionCategory.Roof) + else if (hostPartitionCategory == HostPartitionCategory.Roof) { partitionAnalyticalType = PartitionAnalyticalType.Roof; } @@ -133,7 +136,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { partitionAnalyticalType = PartitionAnalyticalType.ExternalWall; } - + openingType_Temp = openingTypeLibrary.GetOpeningTypes(OpeningAnalyticalType.Window, partitionAnalyticalType)?.FirstOrDefault(); } @@ -152,10 +155,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("openings"); - if(index != -1) + if (index != -1) { dataAccess.SetDataList(index, openings.ConvertAll(x => new GooOpening(x))); } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalHostPartitionCategory.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalHostPartitionCategory.cs index 9b366c3a1..9153b0915 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalHostPartitionCategory.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalHostPartitionCategory.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalHostPartitionCategory : GH_SAMEnumComponent /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -35,4 +38,4 @@ public SAMAnalyticalHostPartitionCategory() { } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalUpdateArchitecturalModel.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalUpdateArchitecturalModel.cs index 0ff038c43..b1e99beda 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalUpdateArchitecturalModel.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalUpdateArchitecturalModel.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -22,7 +25,7 @@ public class SAMAnalyticalUpdateBuildingModel : GH_SAMVariableOutputParameterCom /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -89,7 +92,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (index != -1) { Core.Location location = null; - if(dataAccess.GetData(index, ref location) && location != null) + if (dataAccess.GetData(index, ref location) && location != null) { buildingModel.Location = location; } @@ -120,4 +123,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, new GooBuildingModel(buildingModel)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalUpdateHostPartitionType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalUpdateHostPartitionType.cs index 102473ca9..817eab119 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalUpdateHostPartitionType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMAnalyticalUpdateHostPartitionType.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -22,7 +25,7 @@ public class SAMAnalyticalUpdateHostPartitionType : GH_SAMVariableOutputParamete /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -97,7 +100,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (index != -1) { List partitions_Temp = new List(); - if(dataAccess.GetDataList(index, partitions_Temp) && partitions_Temp != null && partitions_Temp.Count != 0) + if (dataAccess.GetDataList(index, partitions_Temp) && partitions_Temp != null && partitions_Temp.Count != 0) { partitions = partitions_Temp; } @@ -176,9 +179,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) buildingModel = new BuildingModel(buildingModel); partitions = buildingModel.UpdateHostPartitionType( - partitions, - curtainWallType, - internalWallType, + partitions, + curtainWallType, + internalWallType, externalWallType, undergroundWallType, internalFloorType, @@ -198,4 +201,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, partitions?.ConvertAll(x => new GooPartition(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMArchitecturalRelatedObjects.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMArchitecturalRelatedObjects.cs index 9a8f6d2c7..d1eea56f5 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMArchitecturalRelatedObjects.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/New/SAMArchitecturalRelatedObjects.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMArchitecturalRelatedObjects : GH_SAMVariableOutputParameterCompo /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -116,4 +119,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, relatedObjects); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAirPanels.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAirPanels.cs index 4c5f31237..e7d520ffe 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAirPanels.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAirPanels.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -24,7 +27,7 @@ public class SAMAnalyticalAddAirPanels : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -47,7 +50,7 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_analytical", NickName = "_analytical", Description = "SAM Analytical Object such as AdjacencyCluster or AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject { Name = "_planes", NickName = "_planes", Description = "SAM Geometry Planes", Access = GH_ParamAccess.list}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject { Name = "_planes", NickName = "_planes", Description = "SAM Geometry Planes", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "spaces_", NickName = "spaces_", Description = "SAM Analytical Spaces", Access = GH_ParamAccess.list, Optional = true }, ParamVisibility.Voluntary)); return result.ToArray(); @@ -63,7 +66,7 @@ protected override GH_SAMParam[] Outputs { List result = new List(); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject { Name = "analytical", NickName = "analytical", Description = "SAM Analytical", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooPanelParam() { Name = "airPanels", NickName = "airPanels", Description = "SAM Analytical Panels", Access = GH_ParamAccess.list}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooPanelParam() { Name = "airPanels", NickName = "airPanels", Description = "SAM Analytical Panels", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); return result.ToArray(); } } @@ -96,7 +99,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List planes = new List(); - foreach(GH_ObjectWrapper objectWrapper in objectWrappers) + foreach (GH_ObjectWrapper objectWrapper in objectWrappers) { Plane plane = null; @@ -126,7 +129,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) plane = (Plane)@object; } - if(plane == null) + if (plane == null) { continue; } @@ -137,7 +140,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List spaces = null; index = Params.IndexOfInputParam("spaces_"); - if(index != -1) + if (index != -1) { List spaces_Temp = new List(); @@ -150,9 +153,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List panels = null; AdjacencyCluster adjacencyCluster = sAMObject is AnalyticalModel ? ((AnalyticalModel)sAMObject).AdjacencyCluster : sAMObject as AdjacencyCluster; - if(adjacencyCluster != null) + if (adjacencyCluster != null) { - if(sAMObject is AdjacencyCluster) + if (sAMObject is AdjacencyCluster) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster); } @@ -177,4 +180,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, panels); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAperturesByAperture.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAperturesByAperture.cs index faa0f9cc2..fcb09eb58 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAperturesByAperture.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAperturesByAperture.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalAddAperturesByAperture : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -139,7 +142,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List> tuples_Result = null; List panels = adjacencyCluster.GetPanels(); - if(panels != null && panels.Count != 0) + if (panels != null && panels.Count != 0) { tuples_Result = new List>(); @@ -150,11 +153,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) bool updated = false; foreach (Aperture aperture in apertures) { - if(aperture == null) + if (aperture == null) { continue; } - + List apertures_New = Analytical.Modify.AddApertures(panel_New, aperture.ApertureConstruction, aperture.GetFace3D(), trimApertures, Tolerance.MacroDistance, maxDistance); if (apertures_New != null && apertures_New.Count > 0) { @@ -185,4 +188,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(2, tuples_Result != null && tuples_Result.Count != 0); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAperturesByAzimuths..cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAperturesByAzimuths..cs index 74b7f4db4..f4ef407cb 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAperturesByAzimuths..cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAperturesByAzimuths..cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Rhino.Geometry; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAperturesByGeometryAndApertureConstruction.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAperturesByGeometryAndApertureConstruction.cs index 1c48c8c66..fa1fd68b0 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAperturesByGeometryAndApertureConstruction.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAperturesByGeometryAndApertureConstruction.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -24,7 +27,7 @@ public class SAMAnalyticalAddAperturesByGeometryApertureConstruction : GH_SAMCom /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -116,7 +119,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List apertures = new List(); - if(face3Ds != null) + if (face3Ds != null) { foreach (Face3D face3D in face3Ds) { @@ -141,7 +144,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)sAMObject); } - else if(sAMObject is AnalyticalModel) + else if (sAMObject is AnalyticalModel) { analyticalModel = ((AnalyticalModel)sAMObject); adjacencyCluster = analyticalModel.AdjacencyCluster; @@ -168,7 +171,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } tuples_Result = new List>(); - for(int i=0; i < panels.Count; i++) + for (int i = 0; i < panels.Count; i++) { Panel panel = panels[i]; BoundingBox3D boundingBox3D = panel.GetBoundingBox(maxDistance); @@ -190,7 +193,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (apertureConstruction_Temp == null) continue; - if(panel_Temp == null) + if (panel_Temp == null) panel_Temp = Create.Panel(panel); List apertures = panel_Temp.AddApertures(apertureConstruction_Temp, tuple.Item2, trimGeometry, minArea, maxDistance); @@ -200,7 +203,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) apertures.ForEach(x => tuples_Result.Add(new Tuple(panel_Temp, x))); } - if(panel_Temp != null) + if (panel_Temp != null) adjacencyCluster.AddObject(panel_Temp); } } @@ -218,4 +221,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(1, tuples_Result?.ConvertAll(x => new GooAperture(x.Item2))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAperturesByGeometryAndApertureType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAperturesByGeometryAndApertureType.cs index 256f64a77..c74af189d 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAperturesByGeometryAndApertureType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAperturesByGeometryAndApertureType.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -24,7 +27,7 @@ public class SAMAnalyticalAddAperturesByGeometryAndApertureType : GH_SAMComponen /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -87,7 +90,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) foreach (GH_ObjectWrapper objectWrapper in objectWrappers) { - if(Geometry.Grasshopper.Query.TryGetSAMGeometries(objectWrapper, out List face3Ds_Temp) && face3Ds_Temp != null) + if (Geometry.Grasshopper.Query.TryGetSAMGeometries(objectWrapper, out List face3Ds_Temp) && face3Ds_Temp != null) { face3Ds.AddRange(face3Ds_Temp); } @@ -106,7 +109,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) string apertureTypeString = null; dataAccess.GetData(2, ref apertureTypeString); - if(!string.IsNullOrWhiteSpace(apertureTypeString)) + if (!string.IsNullOrWhiteSpace(apertureTypeString)) { if (!Enum.TryParse(apertureTypeString, out apertureType)) apertureType = ApertureType.Window; @@ -131,7 +134,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { framePercentage = false; } - if(framePercentage) + if (framePercentage) { dataAccess.GetDataList(7, values); } @@ -147,7 +150,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List apertures = new List(); - if(face3Ds != null) + if (face3Ds != null) { foreach (Face3D face3D in face3Ds) { @@ -170,7 +173,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)sAMObject); } - else if(sAMObject is AnalyticalModel) + else if (sAMObject is AnalyticalModel) { analyticalModel = ((AnalyticalModel)sAMObject); adjacencyCluster = analyticalModel.AdjacencyCluster; @@ -197,7 +200,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } tuples_Result = new List>(); - for(int i=0; i < panels.Count; i++) + for (int i = 0; i < panels.Count; i++) { Panel panel = panels[i]; BoundingBox3D boundingBox3D = panel.GetBoundingBox(maxDistance); @@ -217,7 +220,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (apertureConstruction_Temp == null) continue; - if(panel_Temp == null) + if (panel_Temp == null) panel_Temp = Create.Panel(panel); List apertures_Temp = panel_Temp.AddApertures(apertureConstruction_Temp, tuple.Item2, trimGeometry, minArea, maxDistance); @@ -227,7 +230,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) apertures_Temp.ForEach(x => tuples_Result.Add(new Tuple(panel_Temp, x))); } - if(panel_Temp != null) + if (panel_Temp != null) adjacencyCluster.AddObject(panel_Temp); } } @@ -245,4 +248,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(1, tuples_Result?.ConvertAll(x => new GooAperture(x.Item2))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAperturesByGeometryAndConstructionManager.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAperturesByGeometryAndConstructionManager.cs index b0d987f35..038f97455 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAperturesByGeometryAndConstructionManager.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAperturesByGeometryAndConstructionManager.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -24,7 +27,7 @@ public class SAMAnalyticalAddAperturesByGeometryAndConstructionManager : GH_SAMV /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -42,10 +45,10 @@ protected override GH_SAMParam[] Inputs { List result = new List(); - global::Grasshopper.Kernel.Parameters.Param_GenericObject param_GenericObject = new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_geometries_", NickName = "_geometries_", Description = "Geometry incl Rhino geometries", Access = GH_ParamAccess.list , Optional = true, DataMapping = GH_DataMapping.Flatten}; + global::Grasshopper.Kernel.Parameters.Param_GenericObject param_GenericObject = new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_geometries_", NickName = "_geometries_", Description = "Geometry incl Rhino geometries", Access = GH_ParamAccess.list, Optional = true, DataMapping = GH_DataMapping.Flatten }; result.Add(new GH_SAMParam(param_GenericObject, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooAnalyticalObjectParam() { Name = "_analyticalObject", NickName = "_analyticalObject", Description = "SAM Analytical Object such as AdjacencyCluster, Panel or AnalyticalModel", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooAnalyticalObjectParam() { Name = "_analyticalObject", NickName = "_analyticalObject", Description = "SAM Analytical Object such as AdjacencyCluster, Panel or AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooApertureConstructionParam() { Name = "_apertureConstruction_", NickName = "_apertureConstruction_", Description = "SAM Analytical Aperture Construction", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); global::Grasshopper.Kernel.Parameters.Param_Number param_Number; @@ -76,7 +79,7 @@ protected override GH_SAMParam[] Inputs } } - /// + /// /// Registers all the output parameters for this component. /// protected override GH_SAMParam[] Outputs @@ -154,7 +157,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetData(index, ref constructionManager); } - if(constructionManager == null) + if (constructionManager == null) { constructionManager = Analytical.Query.DefaultConstructionManager(); } @@ -199,7 +202,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List apertures = new List(); - if(face3Ds != null) + if (face3Ds != null) { foreach (Face3D face3D in face3Ds) { @@ -230,33 +233,33 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("materials"); - if (index != -1 && constructionManager != null) + if (index != -1 && constructionManager != null) { - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { ApertureConstruction apertureConstruction_Temp = aperture?.ApertureConstruction; - if(apertureConstruction_Temp == null) + if (apertureConstruction_Temp == null) { continue; } - if(apertureConstructions.Find(x => x.Name == apertureConstruction_Temp.Name) != null) + if (apertureConstructions.Find(x => x.Name == apertureConstruction_Temp.Name) != null) { continue; } apertureConstructions.Add(apertureConstruction_Temp); } - + materials = new List(); - foreach(ApertureConstruction apertureConstruction_Temp in apertureConstructions) + foreach (ApertureConstruction apertureConstruction_Temp in apertureConstructions) { IEnumerable materials_Temp = Analytical.Query.Materials(apertureConstruction_Temp, constructionManager.MaterialLibrary); - if(materials_Temp != null) + if (materials_Temp != null) { - foreach(IMaterial material in materials_Temp) + foreach (IMaterial material in materials_Temp) { - if(materials.Find(x => x.Name == material.Name) == null) + if (materials.Find(x => x.Name == material.Name) == null) { materials.Add(material); } @@ -276,7 +279,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)analyticalObject); } - else if(analyticalObject is AnalyticalModel) + else if (analyticalObject is AnalyticalModel) { analyticalModel = ((AnalyticalModel)analyticalObject); adjacencyCluster = analyticalModel.AdjacencyCluster; @@ -328,7 +331,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (panel_Temp == null) panel_Temp = Create.Panel(panel); - if(apertureConstructions.Find(x => x.Name == apertureConstruction_Temp?.Name) == null) + if (apertureConstructions.Find(x => x.Name == apertureConstruction_Temp?.Name) == null) { apertureConstructions.Add(apertureConstruction_Temp); } @@ -364,14 +367,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("analyticalObject"); - if(index != -1) + if (index != -1) { if (analyticalModel != null) { MaterialLibrary materialLibrary = analyticalModel.MaterialLibrary; - foreach(IMaterial material in materials) + foreach (IMaterial material in materials) { - if(materialLibrary.GetMaterial(material.Name) == null) + if (materialLibrary.GetMaterial(material.Name) == null) { materialLibrary.Add(material); } @@ -400,4 +403,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAperturesByRatio.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAperturesByRatio.cs index 85f32966a..96fd0e807 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAperturesByRatio.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddAperturesByRatio.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalAddAperturesByRatio : GH_SAMVariableOutputParameterCom /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Add apertures to SAM Analytical objects (Panel, AdjacencyCluster, AnalyticalModel) @@ -93,7 +96,7 @@ protected override GH_SAMParam[] Inputs global::Grasshopper.Kernel.Parameters.Param_Number number = null; - number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_ratio_", NickName = "_ratio_", Description = "Ratio", Access = GH_ParamAccess.item, Optional = true}; + number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_ratio_", NickName = "_ratio_", Description = "Ratio", Access = GH_ParamAccess.item, Optional = true }; result.Add(new GH_SAMParam(number, ParamVisibility.Binding)); global::Grasshopper.Kernel.Parameters.Param_Boolean boolean = null; @@ -114,7 +117,7 @@ protected override GH_SAMParam[] Inputs number.SetPersistentData(3); result.Add(new GH_SAMParam(number, ParamVisibility.Binding)); - GooApertureConstructionParam apertureConstructionParam = new GooApertureConstructionParam() { Name = "_apertureConstruction_", NickName = "_apertureConstruction_", Description = "SAM Analytical Aperture Construction", Access = GH_ParamAccess.item, Optional = true}; + GooApertureConstructionParam apertureConstructionParam = new GooApertureConstructionParam() { Name = "_apertureConstruction_", NickName = "_apertureConstruction_", Description = "SAM Analytical Aperture Construction", Access = GH_ParamAccess.item, Optional = true }; result.Add(new GH_SAMParam(apertureConstructionParam, ParamVisibility.Binding)); boolean = new global::Grasshopper.Kernel.Parameters.Param_Boolean() { Name = "_keepSeparationDistance_", NickName = "_keepSeparationDistance_", Description = "Keep horizontal separation distance between apertures", Access = GH_ParamAccess.item, Optional = true }; @@ -153,7 +156,7 @@ protected override GH_SAMParam[] Outputs protected override void SolveInstance(IGH_DataAccess dataAccess) { int index_Successful = Params.IndexOfOutputParam("successful"); - if(index_Successful != -1) + if (index_Successful != -1) { dataAccess.SetData(index_Successful, false); } @@ -164,7 +167,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) ApertureConstruction apertureConstruction = null; index = Params.IndexOfInputParam("_apertureConstruction_"); - if(index != -1) + if (index != -1) { dataAccess.GetData(index, ref apertureConstruction); } @@ -253,7 +256,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, apertures?.ConvertAll(x => new GooAperture(x))); } - if(index_Successful != -1) + if (index_Successful != -1) { dataAccess.SetData(index_Successful, apertures != null && apertures.Count != 0); } @@ -267,7 +270,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)sAMObject); } - else if(sAMObject is AnalyticalModel) + else if (sAMObject is AnalyticalModel) { analyticalModel = ((AnalyticalModel)sAMObject); adjacencyCluster = analyticalModel.AdjacencyCluster; @@ -309,7 +312,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("analyticalObject"); - if(index != -1) + if (index != -1) { if (analyticalModel != null) { @@ -336,4 +339,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddFeatureShade.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddFeatureShade.cs index 3ae95d708..ee4398dcc 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddFeatureShade.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddFeatureShade.cs @@ -1,7 +1,8 @@ -using Grasshopper.Kernel; -using Rhino.UI; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; -using SAM.Core; using SAM.Core.Grasshopper; using System; using System.Collections.Generic; @@ -13,7 +14,7 @@ public class SAMAnalyticalAddFeatureShade : GH_SAMVariableOutputParameterCompone /// /// Gets the unique ID for this component. Do not change this ID after release. /// - public override Guid ComponentGuid => new ("19b85b9c-ec97-4a14-9c79-c9f9ce76d3df"); + public override Guid ComponentGuid => new("19b85b9c-ec97-4a14-9c79-c9f9ce76d3df"); /// /// The latest version of this component @@ -46,7 +47,7 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new GooAnalyticalObjectParam() { Name = "_analyticalObject_", NickName = "_analyticalObject_", Description = "SAM Analytical Object such as AdjacencyCluster or AnalyticalModel", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooFeatureShadeParam { Name = "_featureShades", NickName = "_featureShades", Description = "SAM Analytical FeatureShades", Access = GH_ParamAccess.list}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooFeatureShadeParam { Name = "_featureShades", NickName = "_featureShades", Description = "SAM Analytical FeatureShades", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooAnalyticalObjectParam() { Name = "_analyticalObjects_", NickName = "_analyticalObjects_", Description = "SAM Analytical Objects such as Panels or Apertures", Access = GH_ParamAccess.list, Optional = true }, ParamVisibility.Binding)); return result.ToArray(); @@ -62,7 +63,7 @@ protected override GH_SAMParam[] Outputs { List result = new List(); result.Add(new GH_SAMParam(new GooAnalyticalObjectParam { Name = "analyticalObject", NickName = "analyticalObject", Description = "SAM Analytical Object", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooAnalyticalObjectParam() { Name = "analyticalObjects", NickName = "analyticalObjects", Description = "SAM Analytical Objects such as Panels or Apertures", Access = GH_ParamAccess.list}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooAnalyticalObjectParam() { Name = "analyticalObjects", NickName = "analyticalObjects", Description = "SAM Analytical Objects such as Panels or Apertures", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); return result.ToArray(); } } @@ -93,17 +94,17 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } AdjacencyCluster adjacencyCluster = null; - - if(analyticalObject is not null) + + if (analyticalObject is not null) { - if(analyticalObject is AdjacencyCluster adjacencyCluster_Temp) + if (analyticalObject is AdjacencyCluster adjacencyCluster_Temp) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster_Temp, true); } - else if(analyticalObject is AnalyticalModel analytcialModel) + else if (analyticalObject is AnalyticalModel analytcialModel) { adjacencyCluster = analytcialModel.AdjacencyCluster; - if(adjacencyCluster is not null) + if (adjacencyCluster is not null) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster, true); } @@ -117,9 +118,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetDataList(index, analyticalObjects); } - if(analyticalObjects is null || analyticalObjects.Count == 0) + if (analyticalObjects is null || analyticalObjects.Count == 0) { - if(adjacencyCluster is null) + if (adjacencyCluster is null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -154,7 +155,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } panel.SetValue(PanelParameter.FeatureShade, new FeatureShade(featureShades[i])); - + if (adjacencyCluster is not null) { adjacencyCluster.AddObject(panel); @@ -197,13 +198,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(adjacencyCluster != null) + if (adjacencyCluster != null) { - if(analyticalObject is AnalyticalModel analyticalModel) + if (analyticalObject is AnalyticalModel analyticalModel) { analyticalObject = new AnalyticalModel(analyticalModel, adjacencyCluster); } - else if(analyticalObject is AdjacencyCluster) + else if (analyticalObject is AdjacencyCluster) { analyticalObject = adjacencyCluster; } @@ -223,4 +224,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddMaterials.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddMaterials.cs index 698f05156..f43f9d5f6 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddMaterials.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddMaterials.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalAddMaterials : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -61,7 +64,7 @@ protected override void RegisterOutputParams(GH_OutputParamManager outputParamMa protected override void SolveInstance(IGH_DataAccess dataAccess) { AnalyticalModel analyticalModel = null; - if(!dataAccess.GetData(0, ref analyticalModel) || analyticalModel == null) + if (!dataAccess.GetData(0, ref analyticalModel) || analyticalModel == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -73,7 +76,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } - + analyticalModel = new AnalyticalModel(analyticalModel); List successfuls = null; @@ -91,4 +94,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(1, successfuls); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddMechanicalSystems.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddMechanicalSystems.cs index 4bc5215ec..83ca719c8 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddMechanicalSystems.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddMechanicalSystems.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalAddMechanicalSystems : GH_SAMVariableOutputParameterCo /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -109,7 +112,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_systemTypeLibrary_"); SystemTypeLibrary systemTypeLibrary = null; - if(index != -1) + if (index != -1) { dataAccess.GetData(index, ref systemTypeLibrary); } @@ -128,7 +131,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_supplyUnitName_"); string supplyUnitName = null; - if(index != -1) + if (index != -1) { dataAccess.GetData(index, ref supplyUnitName); } @@ -140,7 +143,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_exhaustUnitName_"); string exhaustUnitName = null; - if(index != -1) + if (index != -1) { dataAccess.GetData(index, ref exhaustUnitName); } @@ -152,7 +155,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_ventilationRiserName_"); string ventilationRiserName = null; - if(index != -1) + if (index != -1) { dataAccess.GetData(index, ref ventilationRiserName); } @@ -164,7 +167,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_heatingRiserName_"); string heatingRiserName = null; - if(index != -1) + if (index != -1) { dataAccess.GetData(index, ref heatingRiserName); } @@ -176,7 +179,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_coolingRiserName_"); string coolingRiserName = null; - if(index != -1) + if (index != -1) { dataAccess.GetData(index, ref coolingRiserName); } @@ -206,18 +209,18 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { analyticalEquipments = new List(); - foreach(MechanicalSystem mechanicalSystem in mechanicalSystems) + foreach (MechanicalSystem mechanicalSystem in mechanicalSystems) { - if(!(mechanicalSystem is VentilationSystem)) + if (!(mechanicalSystem is VentilationSystem)) { continue; } string[] names = new string[] { mechanicalSystem.GetValue(VentilationSystemParameter.ExhaustUnitName), mechanicalSystem.GetValue(VentilationSystemParameter.SupplyUnitName) }; - foreach(string name in names) + foreach (string name in names) { - if(string.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { continue; } @@ -257,7 +260,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("analytical"); - if(index != -1) + if (index != -1) { dataAccess.SetData(index, analyticalObject); } @@ -275,4 +278,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddMissingMaterials.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddMissingMaterials.cs index c9975f555..1feb87359 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddMissingMaterials.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddMissingMaterials.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAddMissingMaterials : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -43,7 +46,7 @@ protected override GH_SAMParam[] Inputs get { List result = new List(); - + result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "SAM AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); GooMaterialLibraryParam gooMaterialLibraryParam = new GooMaterialLibraryParam { Name = "_materialLibrary_", NickName = "_materialLibrary_", Description = "SAM Core Material Library", Access = GH_ParamAccess.item }; @@ -112,4 +115,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, missingMaterialNames); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddOpeningProperties.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddOpeningProperties.cs index 730db4c31..e85799091 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddOpeningProperties.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddOpeningProperties.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalAddOpeningProperties : GH_SAMVariableOutputParameterCo /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -48,10 +51,10 @@ protected override GH_SAMParam[] Inputs result.Add(new GH_SAMParam(new GooAnalyticalObjectParam() { Name = "_analytical", NickName = "_analytical", Description = "SAM Analytical Object such as AdjacencyCluster or AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooApertureParam() { Name = "apertures_", NickName = "apertures_", Description = "SAM Analytical Apertures", Access = GH_ParamAccess.list, Optional = true }, ParamVisibility.Binding)); - global::Grasshopper.Kernel.Parameters.Param_Number number = new global::Grasshopper.Kernel.Parameters.Param_Number() + global::Grasshopper.Kernel.Parameters.Param_Number number = new global::Grasshopper.Kernel.Parameters.Param_Number() { - Name = "_dischargeCoefficients", - NickName = "_dischargeCoefficients", + Name = "_dischargeCoefficients", + NickName = "_dischargeCoefficients", Description = @"Discharge Coefficients (dimensionless) DefaulDefault discharge coefficient: 0.62 (typical for a sharp-edged rectangular opening). Discharge coefficients account for the ‘friction’ of an opening; the lower the coefficient, the more the aperture resists flow. @@ -119,11 +122,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } AdjacencyCluster adjacencyCluster = null; - if(sAMObject is AdjacencyCluster) + if (sAMObject is AdjacencyCluster) { adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)sAMObject); } - else if(sAMObject is AnalyticalModel) + else if (sAMObject is AnalyticalModel) { adjacencyCluster = ((AnalyticalModel)sAMObject).AdjacencyCluster; } @@ -220,7 +223,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { Profile profile = profiles.Count > i ? profiles[i] : profiles.Last(); ProfileOpeningProperties profileOpeningProperties = new ProfileOpeningProperties(dischargeCoefficient, profile); - if(!double.IsNaN(factor)) + if (!double.IsNaN(factor)) { profileOpeningProperties.Factor = factor; } @@ -238,7 +241,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) singleOpeningProperties = openingProperties; } - if(descriptions != null && descriptions.Count != 0) + if (descriptions != null && descriptions.Count != 0) { string description = descriptions.Count > i ? descriptions[i] : descriptions.Last(); singleOpeningProperties.SetValue(OpeningPropertiesParameter.Description, description); @@ -263,7 +266,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) aperture_Temp.AddSingleOpeningProperties(singleOpeningProperties); panel.RemoveAperture(aperture.Guid); - if(panel.AddAperture(aperture_Temp)) + if (panel.AddAperture(aperture_Temp)) { adjacencyCluster.AddObject(panel); apertures_Result.Add(aperture_Temp); @@ -299,4 +302,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, openingProperties_Result); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddOpeningPropertiesByPartO.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddOpeningPropertiesByPartO.cs index cfc980fd2..7637f4833 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddOpeningPropertiesByPartO.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddOpeningPropertiesByPartO.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -25,7 +28,7 @@ public class SAMAnalyticalAddOpeningPropertiesByPartO : GH_SAMVariableOutputPara /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -81,7 +84,7 @@ protected override GH_SAMParam[] Inputs result.Add(new GH_SAMParam(new GooAnalyticalObjectParam() { Name = "_analytical", NickName = "_analytical", Description = "SAM Analytical Object such as AdjacencyCluster or AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooApertureParam() { Name = "apertures_", NickName = "apertures_", Description = "SAM Analytical Apertures", Access = GH_ParamAccess.list, Optional = true }, ParamVisibility.Binding)); - global::Grasshopper.Kernel.Parameters.Param_Number number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_openingAngles", NickName = "_openingAngles", Description = "Opening Angles", Access = GH_ParamAccess.list}; + global::Grasshopper.Kernel.Parameters.Param_Number number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_openingAngles", NickName = "_openingAngles", Description = "Opening Angles", Access = GH_ParamAccess.list }; result.Add(new GH_SAMParam(number, ParamVisibility.Binding)); global::Grasshopper.Kernel.Parameters.Param_String @string = new global::Grasshopper.Kernel.Parameters.Param_String() { Name = "descriptions_", NickName = "descriptions_", Description = "Descriptions", Access = GH_ParamAccess.list, Optional = true }; @@ -100,7 +103,7 @@ protected override GH_SAMParam[] Inputs GooProfileParam gooProfileParam = new GooProfileParam() { Name = "profiles_", NickName = "profiles_", Description = "Profiles", Access = GH_ParamAccess.list, Optional = true }; result.Add(new GH_SAMParam(gooProfileParam, ParamVisibility.Voluntary)); - global::Grasshopper.Kernel.Parameters.Param_Boolean param_Boolean = new () { Name = "_sizePaneOnly_", NickName = "_sizePaneOnly_", Description = "Size Pane Only", Access = GH_ParamAccess.item, Optional = true }; + global::Grasshopper.Kernel.Parameters.Param_Boolean param_Boolean = new() { Name = "_sizePaneOnly_", NickName = "_sizePaneOnly_", Description = "Size Pane Only", Access = GH_ParamAccess.item, Optional = true }; param_Boolean.SetPersistentData(true); result.Add(new GH_SAMParam(param_Boolean, ParamVisibility.Voluntary)); @@ -143,11 +146,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } AdjacencyCluster adjacencyCluster = null; - if(sAMObject is AdjacencyCluster) + if (sAMObject is AdjacencyCluster) { adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)sAMObject); } - else if(sAMObject is AnalyticalModel) + else if (sAMObject is AnalyticalModel) { adjacencyCluster = ((AnalyticalModel)sAMObject).AdjacencyCluster; } @@ -208,7 +211,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_sizePaneOnly_"); bool paneSizeOnly = true; - if(index != -1) + if (index != -1) { dataAccess.GetData(index, ref paneSizeOnly); } @@ -248,7 +251,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) double factor = factors != null && factors.Count != 0 ? factors.Count > i ? factors[i] : factors.Last() : double.NaN; - PartOOpeningProperties partOOpeningProperties = new (width, height, openingAngle); + PartOOpeningProperties partOOpeningProperties = new(width, height, openingAngle); double dischargeCoefficient = partOOpeningProperties.GetDischargeCoefficient(); @@ -256,7 +259,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (profiles != null && profiles.Count != 0) { Profile profile = profiles.Count > i ? profiles[i] : profiles.Last(); - ProfileOpeningProperties profileOpeningProperties = new (partOOpeningProperties.GetDischargeCoefficient(), profile); + ProfileOpeningProperties profileOpeningProperties = new(partOOpeningProperties.GetDischargeCoefficient(), profile); if (!double.IsNaN(factor)) { profileOpeningProperties.Factor = factor; @@ -274,7 +277,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) singleOpeningProperties = partOOpeningProperties; } - if(descriptions != null && descriptions.Count != 0) + if (descriptions != null && descriptions.Count != 0) { string description = descriptions.Count > i ? descriptions[i] : descriptions.Last(); singleOpeningProperties.SetValue(OpeningPropertiesParameter.Description, description); @@ -300,7 +303,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) aperture_Temp.AddSingleOpeningProperties(singleOpeningProperties); panel.RemoveAperture(aperture.Guid); - if(panel.AddAperture(aperture_Temp)) + if (panel.AddAperture(aperture_Temp)) { adjacencyCluster.AddObject(panel); apertures_Result.Add(aperture_Temp); @@ -336,4 +339,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, openingProperties_Result); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddPanels.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddPanels.cs index 0294eab8e..e8c2b99e3 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddPanels.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddPanels.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -24,7 +27,7 @@ public class SAMAnalyticalAddPanels : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -47,7 +50,7 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_analytical", NickName = "_analytical", Description = "SAM Analytical Object such as AdjacencyCluster or AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject { Name = "_face3Ds", NickName = "_face3Ds", Description = "SAM Geometry Face3Ds", Access = GH_ParamAccess.list}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject { Name = "_face3Ds", NickName = "_face3Ds", Description = "SAM Geometry Face3Ds", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooConstructionParam() { Name = "construction_", NickName = "construction_", Description = "SAM Analytical Construction", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "spaces_", NickName = "spaces_", Description = "SAM Analytical Spaces", Access = GH_ParamAccess.list, Optional = true }, ParamVisibility.Voluntary)); @@ -64,7 +67,7 @@ protected override GH_SAMParam[] Outputs { List result = new List(); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject { Name = "analytical", NickName = "analytical", Description = "SAM Analytical", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooPanelParam() { Name = "panels", NickName = "panels", Description = "SAM Analytical Panels", Access = GH_ParamAccess.list}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooPanelParam() { Name = "panels", NickName = "panels", Description = "SAM Analytical Panels", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); return result.ToArray(); } } @@ -105,9 +108,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List face3Ds = new List(); - foreach(GH_ObjectWrapper objectWrapper in objectWrappers) + foreach (GH_ObjectWrapper objectWrapper in objectWrappers) { - if(Geometry.Grasshopper.Query.TryGetSAMGeometries(objectWrapper, out List face3Ds_Temp) && face3Ds_Temp != null) + if (Geometry.Grasshopper.Query.TryGetSAMGeometries(objectWrapper, out List face3Ds_Temp) && face3Ds_Temp != null) { face3Ds.AddRange(face3Ds_Temp); } @@ -115,7 +118,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List spaces = null; index = Params.IndexOfInputParam("spaces_"); - if(index != -1) + if (index != -1) { List spaces_Temp = new List(); @@ -128,9 +131,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List panels = null; AdjacencyCluster adjacencyCluster = sAMObject is AnalyticalModel ? ((AnalyticalModel)sAMObject).AdjacencyCluster : sAMObject as AdjacencyCluster; - if(adjacencyCluster != null) + if (adjacencyCluster != null) { - if(sAMObject is AdjacencyCluster) + if (sAMObject is AdjacencyCluster) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster); } @@ -155,4 +158,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, panels); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddResults.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddResults.cs index cec7b8642..3c6f8c31a 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddResults.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddResults.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalAddResults : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -87,16 +90,16 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } AdjacencyCluster adjacencyCluster = null; - if(analyticalObject is AnalyticalModel) + if (analyticalObject is AnalyticalModel) { adjacencyCluster = ((AnalyticalModel)analyticalObject).AdjacencyCluster; } - else if(analyticalObject is AdjacencyCluster) + else if (analyticalObject is AdjacencyCluster) { adjacencyCluster = (AdjacencyCluster)analyticalObject; } - if(adjacencyCluster == null) + if (adjacencyCluster == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -137,4 +140,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddSpace.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddSpace.cs index c17f63cac..32a323fab 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddSpace.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddSpace.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalAddSpace : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -60,7 +63,7 @@ protected override void RegisterOutputParams(GH_OutputParamManager outputParamMa protected override void SolveInstance(IGH_DataAccess dataAccess) { AnalyticalModel analyticalModel = null; - if(!dataAccess.GetData(0, ref analyticalModel) || analyticalModel == null) + if (!dataAccess.GetData(0, ref analyticalModel) || analyticalModel == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -79,9 +82,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } - + analyticalModel = new AnalyticalModel(analyticalModel); - for(int i=0; i < structure_GooPanels.PathCount; i++) + for (int i = 0; i < structure_GooPanels.PathCount; i++) { if (i >= spaces.Count) break; @@ -96,4 +99,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooAnalyticalModel(analyticalModel)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddSpacesByBrep.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddSpacesByBrep.cs index a7068c4b2..4a43743e5 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddSpacesByBrep.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddSpacesByBrep.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalAddSpacesByBrep : GH_SAMVariableOutputParameterCompone /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -46,7 +49,7 @@ protected override GH_SAMParam[] Inputs { List result = []; - GooAnalyticalObjectParam gooAnalyticalObjectParam = new () { Name = "_analyticalObject", NickName = "_analyticalObject", Description = "SAM AdjacencyCluster or AnalyticalModel", Access = GH_ParamAccess.item }; + GooAnalyticalObjectParam gooAnalyticalObjectParam = new() { Name = "_analyticalObject", NickName = "_analyticalObject", Description = "SAM AdjacencyCluster or AnalyticalModel", Access = GH_ParamAccess.item }; result.Add(new GH_SAMParam(gooAnalyticalObjectParam, ParamVisibility.Binding)); global::Grasshopper.Kernel.Parameters.Param_GenericObject genericObject = new() @@ -106,11 +109,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } - if(analyticalObject is AdjacencyCluster adjacencyCluster) + if (analyticalObject is AdjacencyCluster adjacencyCluster) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster); } - else if(analyticalObject is AnalyticalModel analyticalModel) + else if (analyticalObject is AnalyticalModel analyticalModel) { adjacencyCluster = new AdjacencyCluster(analyticalModel.AdjacencyCluster); } @@ -151,16 +154,16 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetData(index, ref tolerance); } - foreach(Shell shell in shells) + foreach (Shell shell in shells) { Analytical.Modify.Merge(adjacencyCluster, shell, silverSpacing: silverSpacing, tolerance_Distance: tolerance); } - if(analyticalObject is AdjacencyCluster) + if (analyticalObject is AdjacencyCluster) { analyticalObject = adjacencyCluster; } - else if(analyticalObject is AnalyticalModel analyticalModel) + else if (analyticalObject is AnalyticalModel analyticalModel) { analyticalObject = new AnalyticalModel(analyticalModel, adjacencyCluster); } @@ -172,4 +175,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddVentilationSystem.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddVentilationSystem.cs index f8b0466d3..466aec5e9 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddVentilationSystem.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddVentilationSystem.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalAddVentilationSystem : GH_SAMVariableOutputParameterCo /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -45,10 +48,10 @@ protected override GH_SAMParam[] Inputs List result = new List(); result.Add(new GH_SAMParam(new GooAnalyticalObjectParam() { Name = "_analytical", NickName = "_analytical", Description = "SAM Analytical Object such as AdjacencyCluster or AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "_spaces_", NickName = "_spaces_", Description = "SAM Analytical Spaces", Access = GH_ParamAccess.list, Optional = true }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooAirHandlingUnitParam() { Name = "_aHU", NickName = "_aHU", Description = "SAM Analytical Air Handling Unit", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooAirHandlingUnitParam() { Name = "_aHU", NickName = "_aHU", Description = "SAM Analytical Air Handling Unit", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooSystemTypeParam() { Name = "_ventilationSystemType_", NickName = "_ventilationSystemType_", Description = "SAM VentilationSystemType", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); - + result.Add(new GH_SAMParam(new GooSystemTypeLibraryParam() { Name = "_systemTypeLibrary_", NickName = "_systemTypeLibrary_", Description = "SAM SystemTypeLibrary", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); global::Grasshopper.Kernel.Parameters.Param_Boolean param_Boolean = new global::Grasshopper.Kernel.Parameters.Param_Boolean() { Name = "_removeAssignments_", NickName = "_removeAssignments_", Description = "All existing spaces' ventilation system type assignments will be removed, and new assignments will be adopted.", Access = GH_ParamAccess.item, Optional = true }; @@ -102,7 +105,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)analyticalObject); } - if(adjacencyCluster == null) + if (adjacencyCluster == null) { index = Params.IndexOfOutputParam("analytical"); if (index != -1) @@ -123,12 +126,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_ventilationSystemType_"); VentilationSystemType ventilationSystemType = null; - if(index != -1) + if (index != -1) { dataAccess.GetData(index, ref ventilationSystemType); } - if(ventilationSystemType == null) + if (ventilationSystemType == null) { index = Params.IndexOfInputParam("_systemTypeLibrary_"); SystemTypeLibrary systemTypeLibrary = null; @@ -137,7 +140,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetData(index, ref systemTypeLibrary); } - if(systemTypeLibrary == null) + if (systemTypeLibrary == null) { systemTypeLibrary = ActiveSetting.Setting.GetValue(AnalyticalSettingParameter.DefaultSystemTypeLibrary); } @@ -158,7 +161,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) spaces = null; } - if(spaces == null) + if (spaces == null) { spaces = adjacencyCluster.GetSpaces(); } @@ -183,7 +186,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("analytical"); - if(index != -1) + if (index != -1) { dataAccess.SetData(index, analyticalObject); } @@ -201,4 +204,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddVentilationSystemsByZones.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddVentilationSystemsByZones.cs index 94ea8b8c2..4bc291ca4 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddVentilationSystemsByZones.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAddVentilationSystemsByZones.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using SAM.Analytical.Grasshopper.Properties; @@ -25,7 +28,7 @@ public class SAMAnalyticalAddVentilationSystemsByZones : GH_SAMVariableOutputPar /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -104,7 +107,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)analyticalObject); } - if(adjacencyCluster == null) + if (adjacencyCluster == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -114,7 +117,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_systemTypeLibrary_"); SystemTypeLibrary systemTypeLibrary = null; - if(index != -1) + if (index != -1) { dataAccess.GetData(index, ref systemTypeLibrary); } @@ -134,22 +137,22 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } - foreach(object @object in objects) + foreach (object @object in objects) { object object_Temp = @object; - if(@object is global::Grasshopper.Kernel.Types.IGH_Goo) + if (@object is global::Grasshopper.Kernel.Types.IGH_Goo) { object_Temp = ((dynamic)@object).Value; } - - if(object_Temp is Zone) + + if (object_Temp is Zone) { zones.Add((Zone)object_Temp); } - else if(object_Temp is string) + else if (object_Temp is string) { Zone zone = adjacencyCluster.GetZones()?.Find(x => x.Name == (string)object_Temp); - if(zone != null) + if (zone != null) { zones.Add((Zone)object_Temp); } @@ -158,7 +161,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_supplyUnitNames_"); List supplyUnitNames = new List(); - if(index != -1) + if (index != -1) { dataAccess.GetDataList(index, supplyUnitNames); } @@ -175,12 +178,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (adjacencyCluster != null) { - for(int i =0; i < zones.Count; i++) + for (int i = 0; i < zones.Count; i++) { Zone zone = zones[i]; List spaces = adjacencyCluster.GetSpaces(zone); - if(spaces == null || spaces.Count == 0) + if (spaces == null || spaces.Count == 0) { continue; } @@ -188,7 +191,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) string supplyUnitName = null; string exhaustUnitName = null; - if(supplyUnitNames.Count > i) + if (supplyUnitNames.Count > i) { supplyUnitName = supplyUnitNames[i]; } @@ -200,10 +203,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) Check(adjacencyCluster, zone, supplyUnitName, exhaustUnitName); - VentilationSystem ventilationSystem = adjacencyCluster.AddVentilationSystem(systemTypeLibrary, spaces, supplyUnitName, exhaustUnitName); + VentilationSystem ventilationSystem = adjacencyCluster.AddVentilationSystem(systemTypeLibrary, spaces, supplyUnitName, exhaustUnitName); if (ventilationSystem != null) { - if(mechanicalSystems.Find(x => x.Guid == ventilationSystem.Guid) == null) + if (mechanicalSystems.Find(x => x.Guid == ventilationSystem.Guid) == null) { mechanicalSystems.Add(ventilationSystem); } @@ -225,7 +228,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(airHandlingUnits != null && airHandlingUnits.Count != 0) + if (airHandlingUnits != null && airHandlingUnits.Count != 0) { GH_Path path = new GH_Path(i); airHandlingUnits.ForEach(x => dataTree_AnalyticalEquipments.Add(x, path)); @@ -244,7 +247,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("analytical"); - if(index != -1) + if (index != -1) { dataAccess.SetData(index, analyticalObject); } @@ -264,7 +267,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) private void Check(AdjacencyCluster adjacencyCluster, Zone zone, string supplyUnitName, string exhaustUnitName) { - if(adjacencyCluster == null || zone == null) + if (adjacencyCluster == null || zone == null) { return; } @@ -277,7 +280,7 @@ private void Check(AdjacencyCluster adjacencyCluster, Zone zone, string supplyUn } IEnumerable ventilationSystemTypeNames = spaces.ConvertAll(x => x.InternalCondition?.GetValue(InternalConditionParameter.VentilationSystemTypeName)).Distinct(); - if(ventilationSystemTypeNames != null && ventilationSystemTypeNames.Count() > 0) + if (ventilationSystemTypeNames != null && ventilationSystemTypeNames.Count() > 0) { if (ventilationSystemTypeNames.Count() != 1) { @@ -302,7 +305,7 @@ private void Check(AdjacencyCluster adjacencyCluster, Zone zone, string supplyUn string exhaustUnitName_Temp = string.IsNullOrWhiteSpace(exhaustUnitName) ? null : exhaustUnitName; List ventilationSystems = adjacencyCluster.GetMechanicalSystems(); - if(ventilationSystems != null) + if (ventilationSystems != null) { foreach (VentilationSystem ventilationSystem in ventilationSystems) { @@ -338,4 +341,4 @@ private void Check(AdjacencyCluster adjacencyCluster, Zone zone, string supplyUn } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAdjacentSpaces.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAdjacentSpaces.cs index 0343712bd..ca6b85641 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAdjacentSpaces.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAdjacentSpaces.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalAdjacentSpaces : GH_SAMVariableOutputParameterComponen /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -83,7 +86,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_analytical"); IAnalyticalObject analyticalObject = null; - if(index == -1 || !dataAccess.GetData(index, ref analyticalObject) || analyticalObject == null) + if (index == -1 || !dataAccess.GetData(index, ref analyticalObject) || analyticalObject == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -99,20 +102,20 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) HashSet panelGroups = null; index = Params.IndexOfInputParam("_panelGroups_"); - if(index != -1) + if (index != -1) { List values = new List(); - if(dataAccess.GetDataList(index, values) && values != null && values.Count != 0) + if (dataAccess.GetDataList(index, values) && values != null && values.Count != 0) { panelGroups = new HashSet(); - foreach(string value in values) + foreach (string value in values) { panelGroups.Add(SAM.Core.Query.Enum(value)); } } } - if(panelGroups == null || panelGroups.Count == 0) + if (panelGroups == null || panelGroups.Count == 0) { panelGroups = new HashSet(); foreach (PanelGroup panelGroup in Enum.GetValues(typeof(PanelGroup))) @@ -122,11 +125,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } AdjacencyCluster adjacencyCluster = null; - if(analyticalObject is AdjacencyCluster) + if (analyticalObject is AdjacencyCluster) { adjacencyCluster = (AdjacencyCluster)analyticalObject; } - else if(analyticalObject is AnalyticalModel) + else if (analyticalObject is AnalyticalModel) { adjacencyCluster = ((AnalyticalModel)analyticalObject).AdjacencyCluster; } @@ -141,22 +144,22 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List panels_Windows = new List(); List panels_Space = adjacencyCluster?.GetRelatedObjects(space); - if(panels_Space != null) + if (panels_Space != null) { - foreach(Panel panel in panels_Space) + foreach (Panel panel in panels_Space) { - if(panel == null) + if (panel == null) { continue; } - if(!panelGroups.Contains(panel.PanelGroup)) + if (!panelGroups.Contains(panel.PanelGroup)) { continue; } List spaces_Panel = adjacencyCluster?.GetRelatedObjects(panel); - if(spaces_Panel == null || spaces_Panel.Count == 0) + if (spaces_Panel == null || spaces_Panel.Count == 0) { continue; } @@ -165,15 +168,15 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) bool hasWindows = false; bool hasDoors = false; - if(apertures != null) + if (apertures != null) { hasDoors = apertures.Find(x => x != null && x.ApertureType == ApertureType.Door) != null; hasWindows = apertures.Find(x => x != null && x.ApertureType == ApertureType.Window) != null; } - foreach(Space space_Panel in spaces_Panel) + foreach (Space space_Panel in spaces_Panel) { - if(space_Panel.Guid == space.Guid) + if (space_Panel.Guid == space.Guid) { continue; } @@ -238,4 +241,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAdjustPanels.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAdjustPanels.cs index 4eb7c2bfa..925bbb020 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAdjustPanels.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAdjustPanels.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalAdjustPanels : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -89,7 +92,7 @@ protected override GH_SAMParam[] Outputs protected override void SolveInstance(IGH_DataAccess dataAccess) { int index = -1; - + List panels = new List(); index = Params.IndexOfInputParam("_panels"); if (index == -1 || !dataAccess.GetDataList(index, panels) || panels == null) @@ -133,4 +136,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, result); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAdjustRoofs.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAdjustRoofs.cs index a1fcbf4f2..ed45c463e 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAdjustRoofs.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAdjustRoofs.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalAdjustRoofs : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -77,7 +80,7 @@ protected override GH_SAMParam[] Outputs protected override void SolveInstance(IGH_DataAccess dataAccess) { int index = -1; - + List panels = new List(); index = Params.IndexOfInputParam("_roofs"); if (index == -1 || !dataAccess.GetDataList(index, panels) || panels == null) @@ -106,4 +109,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, result); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAirFlow.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAirFlow.cs index a30b2c830..547a5c14e 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAirFlow.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAirFlow.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -20,14 +23,14 @@ public class SAMAnalyticalAirflow : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. /// public SAMAnalyticalAirflow() : base("SAMAnalytical.Airflow", "SAMAnalytical.Airflow", - "Calculates Exhaust and Supply Airflow from Internal Condition ONLY"+ + "Calculates Exhaust and Supply Airflow from Internal Condition ONLY" + "Calculated Exhaust/Supply Air Flow [m3/s] for IC inside Space.as Sum of ExhaustAirFlowPerPerson, ExhaustAirFlowPerArea, ExhaustAirFlow and ExhaustAirChangesPerHour", "SAM", "Analytical") { @@ -54,7 +57,7 @@ protected override void RegisterOutputParams(GH_OutputParamManager outputParamMa protected override void SolveInstance(IGH_DataAccess dataAccess) { - Space space= null; + Space space = null; if (!dataAccess.GetData(0, ref space) || space == null) { @@ -69,4 +72,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(3, exhaustAirflow * 1000); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAlignHorizontalPanelByElevations.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAlignHorizontalPanelByElevations.cs index a0fa3efe3..28fbde822 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAlignHorizontalPanelByElevations.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAlignHorizontalPanelByElevations.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -23,7 +26,7 @@ public class SAMAnalyticalAlignHorizontalPanelByElevations : GH_SAMVariableOutpu /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -90,7 +93,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_panel"); Panel panel = null; - if(index == -1 || !dataAccess.GetData(index, ref panel) || panel == null) + if (index == -1 || !dataAccess.GetData(index, ref panel) || panel == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Invalid Data"); return; @@ -105,7 +108,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } List elevations = new List(); - foreach(GH_ObjectWrapper objectWrapper in objectWrappers) + foreach (GH_ObjectWrapper objectWrapper in objectWrappers) { object @object = objectWrapper.Value; if (@object is IGH_Goo) @@ -129,7 +132,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) elevation = ((Architectural.Level)@object).Elevation; } - if(!double.IsNaN(elevation)) + if (!double.IsNaN(elevation)) { elevations.Add(elevation); } @@ -160,13 +163,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) bool horizontal = Geometry.Object.Spatial.Query.Horizontal(panel, tolerance); - if(horizontal || (!horizontal && projectOnElevation)) + if (horizontal || (!horizontal && projectOnElevation)) { double panelElevation = panel.MinElevation(); elevations.Sort((x, y) => System.Math.Abs(x - panelElevation).CompareTo(System.Math.Abs(y - panelElevation))); if (System.Math.Abs(elevations[0] - panelElevation) <= maxDistance) { - if(!horizontal) + if (!horizontal) { Geometry.Spatial.Face3D face3D = panel.GetFace3D(); @@ -186,4 +189,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooPanel(panel)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAlignPanels.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAlignPanels.cs index ad0025626..5534a81c6 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAlignPanels.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAlignPanels.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using SAM.Analytical.Grasshopper.Properties; @@ -24,7 +27,7 @@ public class SAMAnalyticalAlignPanels : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -91,15 +94,15 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_panels"); List panels = new List(); - if(index == -1 || !dataAccess.GetDataList(index, panels) || panels == null) + if (index == -1 || !dataAccess.GetDataList(index, panels) || panels == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Invalid Data"); return; } - + index = Params.IndexOfInputParam("_elevations"); - List elevations = new List(); - if(index == -1 || !dataAccess.GetDataList(index, elevations) || elevations == null || elevations.Count == 0) + List elevations = new List(); + if (index == -1 || !dataAccess.GetDataList(index, elevations) || elevations == null || elevations.Count == 0) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Invalid Data"); return; @@ -138,7 +141,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List panels_Upper = null; DataTree dataTree_Panel = new DataTree(); - for(int i=0; i < elevations.Count; i++) + for (int i = 0; i < elevations.Count; i++) { GH_Path path = new GH_Path(i); @@ -157,4 +160,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, panels?.ConvertAll(x => new GooPanel(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAlignPanelsByLowerAndUpperElevation.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAlignPanelsByLowerAndUpperElevation.cs index b0d1fe7d1..d6ccb1312 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAlignPanelsByLowerAndUpperElevation.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAlignPanelsByLowerAndUpperElevation.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalAlignPanelsByLowerAndUpperElevation : GH_SAMVariableOu /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -86,15 +89,15 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_panels"); List panels = new List(); - if(index == -1 || !dataAccess.GetDataList(index, panels) || panels == null) + if (index == -1 || !dataAccess.GetDataList(index, panels) || panels == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Invalid Data"); return; } - + index = Params.IndexOfInputParam("_upperElevation"); double upperElevation = double.NaN; - if(index == -1 || !dataAccess.GetData(index, ref upperElevation) || double.IsNaN(upperElevation)) + if (index == -1 || !dataAccess.GetData(index, ref upperElevation) || double.IsNaN(upperElevation)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Invalid Data"); return; @@ -122,9 +125,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List panels_Result = new List(); List panels_Upper = new List(); List panels_Lower = new List(); - for (int i=0; i < panels.Count;i++) + for (int i = 0; i < panels.Count; i++) { - if(panels[i] == null) + if (panels[i] == null) continue; List panels_Temp = null; @@ -141,12 +144,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) continue; } - if(panels_Temp == null || panels_Temp.Count == 0) + if (panels_Temp == null || panels_Temp.Count == 0) { panels_Temp = new List() { Create.Panel(panels[i]) }; } - foreach(Panel panel_Result in panels_Temp) + foreach (Panel panel_Result in panels_Temp) { Geometry.Spatial.Point3D point3D = panel_Result.GetInternalPoint3D(); if (Geometry.Spatial.Query.Above(plane_Upper, point3D)) @@ -158,11 +161,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - + dataAccess.SetDataList(0, panels_Result?.ConvertAll(x => new GooPanel(x))); dataAccess.SetDataList(1, panels_Upper?.ConvertAll(x => new GooPanel(x))); dataAccess.SetDataList(2, panels_Lower?.ConvertAll(x => new GooPanel(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAlignSpaceLocation.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAlignSpaceLocation.cs index d391af730..db74445b9 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAlignSpaceLocation.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalAlignSpaceLocation.cs @@ -1,6 +1,8 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; -using SAM.Core; using SAM.Core.Grasshopper; using SAM.Geometry.Spatial; using System; @@ -24,7 +26,7 @@ public class SAMAnalyticalAlignSpaceLocation : GH_SAMVariableOutputParameterComp /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Aligns the space location point with the analytical model. @@ -84,7 +86,7 @@ protected override GH_SAMParam[] Outputs protected override void SolveInstance(IGH_DataAccess dataAccess) { int index_Successful = Params.IndexOfOutputParam("successful"); - if(index_Successful != -1) + if (index_Successful != -1) { dataAccess.SetData(index_Successful, false); } @@ -104,7 +106,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster_Temp); } - else if(analyticalObject is AnalyticalModel analyticalModel) + else if (analyticalObject is AnalyticalModel analyticalModel) { adjacencyCluster = analyticalModel.AdjacencyCluster; } @@ -126,7 +128,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) foreach (Space space in spaces) { Space space_Temp = adjacencyCluster.GetObject(x => x.Guid == space.Guid); - if(space_Temp == null) + if (space_Temp == null) { continue; } @@ -135,25 +137,25 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) Point3D location = space_Temp.Location; - List panels =adjacencyCluster.GetPanels(space); - if(panels == null || !panels.Any()) + List panels = adjacencyCluster.GetPanels(space); + if (panels == null || !panels.Any()) { continue; } List face3Ds = panels.ConvertAll(x => x.GetFace3D(false)); - if(face3Ds == null || !face3Ds.Any()) + if (face3Ds == null || !face3Ds.Any()) { continue; } - if(face3Ds.Find(x => x.On(location)) != null) + if (face3Ds.Find(x => x.On(location)) != null) { continue; } Dictionary dictionary = Geometry.Spatial.Query.IntersectionDictionary(location, vector3D, face3Ds, true, true); - if(dictionary == null || !dictionary.Any()) + if (dictionary == null || !dictionary.Any()) { continue; } @@ -163,7 +165,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("analyticalObject"); - if(index != -1) + if (index != -1) { if (analyticalObject is AdjacencyCluster) { @@ -182,4 +184,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalApertureConstructions.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalApertureConstructions.cs index f46fde200..8336f4242 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalApertureConstructions.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalApertureConstructions.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -23,7 +26,7 @@ public class SAMAnalyticalApertureConstructions : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -43,7 +46,7 @@ protected override void RegisterInputParams(GH_InputParamManager inputParamManag int index; inputParamManager.AddParameter(new GooJSAMObjectParam(), "_SAMAnalytical", "_SAMAnalytical", "SAM Analytical Object ie.Panel, AdjacencyCluster", GH_ParamAccess.item); - + index = inputParamManager.AddGenericParameter("panelType_", "panelType_", "PanelType", GH_ParamAccess.item); inputParamManager[index].Optional = true; @@ -71,22 +74,22 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(1, false); SAMObject sAMObject = null; - if(!dataAccess.GetData(0, ref sAMObject) || sAMObject == null) + if (!dataAccess.GetData(0, ref sAMObject) || sAMObject == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } List panels = null; - if(sAMObject is Panel) + if (sAMObject is Panel) { panels = new List() { (Panel)sAMObject }; } - else if(sAMObject is AdjacencyCluster) + else if (sAMObject is AdjacencyCluster) { panels = ((AdjacencyCluster)sAMObject).GetPanels(); } - else if(sAMObject is AnalyticalModel) + else if (sAMObject is AnalyticalModel) { panels = ((AnalyticalModel)sAMObject).AdjacencyCluster?.GetPanels(); } @@ -103,7 +106,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) PanelType panelType = PanelType.Undefined; - if(objectWrapper != null) + if (objectWrapper != null) { if (objectWrapper.Value is GH_String) panelType = Analytical.Query.PanelType(((GH_String)objectWrapper.Value).Value); @@ -131,4 +134,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(1, apertureConstructions != null); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalApertureType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalApertureType.cs index 8c3ca96b2..0ac789d56 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalApertureType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalApertureType.cs @@ -1,4 +1,7 @@ -using SAM.Analytical.Grasshopper.Properties; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -19,7 +22,7 @@ public class SAMAnalyticalApertureType : GH_SAMEnumComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Panel Type @@ -31,4 +34,4 @@ public SAMAnalyticalApertureType() { } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalBake.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalBake.cs index a8c41b5a1..412cedfc3 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalBake.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalBake.cs @@ -1,4 +1,7 @@ -using GH_IO.Serialization; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using GH_IO.Serialization; using Grasshopper.Kernel; using Rhino; using SAM.Analytical.Grasshopper.Properties; @@ -54,7 +57,7 @@ public override bool Read(GH_IReader reader) /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -98,7 +101,7 @@ protected override void AppendAdditionalComponentMenuItems(ToolStripDropDown men { foreach (PanelBakeMethod panelBakeMethod_Temp in Enum.GetValues(typeof(PanelBakeMethod))) { - if(panelBakeMethod_Temp == PanelBakeMethod.Undefined) + if (panelBakeMethod_Temp == PanelBakeMethod.Undefined) { continue; } @@ -137,32 +140,32 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } RhinoDoc rhinoDoc = RhinoDoc.ActiveDoc; - if(rhinoDoc == null) + if (rhinoDoc == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Active Rhino Document is missing"); return; } List panels = null; - if(analyticalObject is Panel) + if (analyticalObject is Panel) { panels = new List() { (Panel)analyticalObject }; } - else if(analyticalObject is AdjacencyCluster) + else if (analyticalObject is AdjacencyCluster) { panels = ((AdjacencyCluster)analyticalObject).GetPanels(); } - else if(analyticalObject is AnalyticalModel) + else if (analyticalObject is AnalyticalModel) { panels = ((AnalyticalModel)analyticalObject).GetPanels(); } - if(panels == null || panels.Count == 0) + if (panels == null || panels.Count == 0) { return; } - switch(panelBakeMethod) + switch (panelBakeMethod) { case PanelBakeMethod.Construction: Rhino.Modify.BakeGeometry_ByConstruction(rhinoDoc, panels, cutApertures); @@ -174,4 +177,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCalculateDaylightFactor.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCalculateDaylightFactor.cs index ac76fe0b2..431b06ad4 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCalculateDaylightFactor.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCalculateDaylightFactor.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalCalculateDaylightFactor : GH_SAMVariableOutputParamete /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -61,7 +64,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_analytical"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -78,20 +81,20 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List spaces = new List(); dataAccess.GetDataList(index, spaces); - if(spaces != null && spaces.Count == 0) + if (spaces != null && spaces.Count == 0) { spaces = null; } - if(analyticalObject is AnalyticalModel || analyticalObject is AdjacencyCluster) + if (analyticalObject is AnalyticalModel || analyticalObject is AdjacencyCluster) { AdjacencyCluster adjacencyCluster = null; - if(analyticalObject is AnalyticalModel) + if (analyticalObject is AnalyticalModel) adjacencyCluster = ((AnalyticalModel)analyticalObject).AdjacencyCluster; - else if(analyticalObject is AdjacencyCluster) + else if (analyticalObject is AdjacencyCluster) adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)analyticalObject); - if(adjacencyCluster != null) + if (adjacencyCluster != null) { adjacencyCluster.UpdateDaylightFactors(spaces); @@ -101,7 +104,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) analyticalObject = adjacencyCluster; } } - else if(analyticalObject is Space) + else if (analyticalObject is Space) { } @@ -111,4 +114,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, analyticalObject); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCalculateFloorArea.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCalculateFloorArea.cs index e2d2dcd22..adfa730db 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCalculateFloorArea.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCalculateFloorArea.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using SAM.Analytical.Grasshopper.Properties; @@ -26,7 +29,7 @@ public class SAMAnalyticalCalculateFloorArea : GH_SAMVariableOutputParameterComp /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -49,7 +52,7 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_analytical", NickName = "_analytical", Description = "SAM Analytical Object such as AnalyticalModel or AdjacencyCluster", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "spaces_", NickName = "spaces_", Description = "SAM Analytical Spaces", Access = GH_ParamAccess.list, Optional = true}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "spaces_", NickName = "spaces_", Description = "SAM Analytical Spaces", Access = GH_ParamAccess.list, Optional = true }, ParamVisibility.Binding)); global::Grasshopper.Kernel.Parameters.Param_Number number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_maxTiltDifference_", NickName = "_maxTiltDifference_", Description = "Maximal Allowed Tilt Difference", Access = GH_ParamAccess.item }; number.SetPersistentData(20); @@ -87,7 +90,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) SAMObject sAMObject = null; index = Params.IndexOfInputParam("_analytical"); - if(index == -1 || !dataAccess.GetData(index, ref sAMObject) || sAMObject == null) + if (index == -1 || !dataAccess.GetData(index, ref sAMObject) || sAMObject == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -99,7 +102,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) else if (sAMObject is AnalyticalModel) adjacencyCluster = ((AnalyticalModel)sAMObject).AdjacencyCluster; - if(adjacencyCluster == null) + if (adjacencyCluster == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -109,14 +112,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("spaces_"); if (index != -1) { - spaces = new List(); + spaces = new List(); dataAccess.GetDataList(index, spaces); } if (spaces == null || spaces.Count == 0) spaces = adjacencyCluster.GetSpaces(); - if(spaces != null && spaces.Count != 0) + if (spaces != null && spaces.Count != 0) { double maxTiltDifference = 20; index = Params.IndexOfInputParam("_maxTiltDifference_"); @@ -130,9 +133,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) Dictionary dictionary_Area = []; Dictionary> dictionary_Panel = []; List spaces_Temp = []; - foreach(Space space in spaces) + foreach (Space space in spaces) { - if(space == null) + if (space == null) { continue; } @@ -148,10 +151,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dictionary_Panel[space_Temp] = []; } - Parallel.For(0, spaces_Temp.Count, (int i) => { + Parallel.For(0, spaces_Temp.Count, (int i) => + { Space space_Temp = spaces_Temp[i]; - if(space_Temp == null) + if (space_Temp == null) { return; } @@ -170,7 +174,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (dictionary_Panel != null && dictionary_Panel.Count > 0) { int count = 0; - foreach(KeyValuePair> keyValuePair in dictionary_Panel) + foreach (KeyValuePair> keyValuePair in dictionary_Panel) { GH_Path path = new GH_Path(count); keyValuePair.Value.ForEach(x => dataTree_Panel.Add(new GooPanel(x), path)); @@ -190,14 +194,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (index != -1) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster); - foreach(KeyValuePair keyValuePair in dictionary_Area) + foreach (KeyValuePair keyValuePair in dictionary_Area) { Space space = new Space(keyValuePair.Key); space.SetValue(SpaceParameter.Area, keyValuePair.Value); adjacencyCluster.AddObject(space); int index_Space = spaces_Temp.IndexOf(keyValuePair.Key); - if(index_Space != -1) + if (index_Space != -1) { spaces_Temp[index_Space] = space; } @@ -221,4 +225,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCalculateGlazingValueByAperture.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCalculateGlazingValueByAperture.cs index 7c67b620a..fa544a4ea 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCalculateGlazingValueByAperture.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCalculateGlazingValueByAperture.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using Grasshopper.Kernel.Types; @@ -308,9 +311,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(double.IsNaN(hi)) + if (double.IsNaN(hi)) { - if(double.IsNaN(emissivity)) + if (double.IsNaN(emissivity)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid emissivity for layer"); return; @@ -320,9 +323,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } Glazing.Result result = Glazing.Compute(layers, gaps, null, he, hi); - if(result != null) + if (result != null) { - GH_Path gH_Path = new (i); + GH_Path gH_Path = new(i); tvs.Add(new GH_Number(Core.Query.Round(result.Tv, Tolerance.MacroDistance)), gH_Path); rvExts.Add(new GH_Number(Core.Query.Round(result.RvExt, Tolerance.MacroDistance)), gH_Path); @@ -453,4 +456,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCalculateGlazingValueByConstruction.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCalculateGlazingValueByConstruction.cs index ba67bc730..c78f30c22 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCalculateGlazingValueByConstruction.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCalculateGlazingValueByConstruction.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using Grasshopper.Kernel.Types; @@ -222,18 +225,18 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) for (int i = 0; i < analyticalObjects.Count; i++) { - if(analyticalObjects[i] is not IAnalyticalObject analyticalObject) + if (analyticalObjects[i] is not IAnalyticalObject analyticalObject) { continue; } List constructionLayers = null; - if(analyticalObject is Construction construction) + if (analyticalObject is Construction construction) { constructionLayers = construction.ConstructionLayers; } - else if(analyticalObject is ApertureConstruction apertureConstruction) + else if (analyticalObject is ApertureConstruction apertureConstruction) { constructionLayers = apertureConstruction.PaneConstructionLayers; } @@ -242,7 +245,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) continue; } - if(constructionLayers is null) + if (constructionLayers is null) { continue; } @@ -319,9 +322,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(double.IsNaN(hi)) + if (double.IsNaN(hi)) { - if(double.IsNaN(emissivity)) + if (double.IsNaN(emissivity)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid emissivity for layer"); return; @@ -331,9 +334,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } Glazing.Result result = Glazing.Compute(layers, gaps, null, he, hi); - if(result != null) + if (result != null) { - GH_Path gH_Path = new (i); + GH_Path gH_Path = new(i); tvs.Add(new GH_Number(Core.Query.Round(result.Tv, Tolerance.MacroDistance)), gH_Path); rvExts.Add(new GH_Number(Core.Query.Round(result.RvExt, Tolerance.MacroDistance)), gH_Path); @@ -464,4 +467,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCalculateSpacePanelArea.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCalculateSpacePanelArea.cs index 7ab2c6c3a..5451e7d52 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCalculateSpacePanelArea.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCalculateSpacePanelArea.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalCalculateSpacePanelArea : GH_SAMVariableOutputParamete /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -61,7 +64,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_analytical"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -78,22 +81,22 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List spaces = new List(); dataAccess.GetDataList(index, spaces); - if(spaces != null && spaces.Count == 0) + if (spaces != null && spaces.Count == 0) { spaces = null; } - if(analyticalObject is AnalyticalModel || analyticalObject is AdjacencyCluster) + if (analyticalObject is AnalyticalModel || analyticalObject is AdjacencyCluster) { AdjacencyCluster adjacencyCluster = null; - if(analyticalObject is AnalyticalModel) + if (analyticalObject is AnalyticalModel) adjacencyCluster = ((AnalyticalModel)analyticalObject).AdjacencyCluster; - else if(analyticalObject is AdjacencyCluster) + else if (analyticalObject is AdjacencyCluster) adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)analyticalObject); - if(adjacencyCluster != null) + if (adjacencyCluster != null) { - if(spaces == null) + if (spaces == null) { spaces = adjacencyCluster.GetSpaces(); } @@ -106,7 +109,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) analyticalObject = adjacencyCluster; } } - else if(analyticalObject is Space) + else if (analyticalObject is Space) { } @@ -116,4 +119,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, analyticalObject); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCheck.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCheck.cs index ae2d82d72..b49ad28e3 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCheck.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCheck.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalCheck : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -46,7 +49,7 @@ protected override GH_SAMParam[] Inputs @boolean = new global::Grasshopper.Kernel.Parameters.Param_Boolean() { Name = "_run", NickName = "_run", Description = "Connect a boolean toggle to run.", Access = GH_ParamAccess.item }; @boolean.SetPersistentData(false); result.Add(new GH_SAMParam(@boolean, ParamVisibility.Binding)); - + return result.ToArray(); } } @@ -83,9 +86,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { log = Create.Log(analyticalObject as dynamic); } - catch + catch { - if(index_Errors != -1) + if (index_Errors != -1) { dataAccess.SetData(index_Errors, null); } @@ -121,4 +124,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCopyApertureConstructionLayers.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCopyApertureConstructionLayers.cs index b6fe5dbd0..ff3ad3f0b 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCopyApertureConstructionLayers.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCopyApertureConstructionLayers.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -20,7 +23,7 @@ public class SAMAnalyticalCopyApertureConstructionLayers : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -97,4 +100,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooApertureConstruction(result)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCopyConstructionLayers.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCopyConstructionLayers.cs index 7d63915be..16101af3c 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCopyConstructionLayers.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCopyConstructionLayers.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -20,7 +23,7 @@ public class SAMAnalyticalCopyConstructionLayers : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -76,4 +79,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooConstruction(result)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAdjacencyCluster.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAdjacencyCluster.cs index beaa9584d..0b530cbcd 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAdjacencyCluster.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAdjacencyCluster.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -28,14 +31,14 @@ public class SAMAnalyticalCreateAdjacencyCluster : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. /// public SAMAnalyticalCreateAdjacencyCluster() : base("SAMAnalytical.CreateAdjacencyCluster", "SAMAnalytical.CreateAdjacencyCluster", - "Create AdjacencyCluster for Horizontal Floors and Roofs only, Use only Top Floors or Roof shape ONLY this will generate Walls and close Spaces. For 3D shapes use 'Create.SAMAdjacencyCluster' from Topologic \n " + "Create AdjacencyCluster for Horizontal Floors and Roofs only, Use only Top Floors or Roof shape ONLY this will generate Walls and close Spaces. For 3D shapes use 'Create.SAMAdjacencyCluster' from Topologic \n " + "----> ------\n |\n | First Floor\n----> ------\n |\n | Ground Floor\n -------\n\nSECTION" , "SAM", "Analytical") { @@ -85,19 +88,19 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { if (objectWrapper == null || objectWrapper.Value == null) continue; - - if(objectWrapper.Value is ISAMGeometry) + + if (objectWrapper.Value is ISAMGeometry) { sAMGeometries.Add((ISAMGeometry)objectWrapper.Value); } - else if(objectWrapper.Value is GooSAMGeometry) + else if (objectWrapper.Value is GooSAMGeometry) { sAMGeometries.Add(((GooSAMGeometry)objectWrapper.Value).Value); } - else if(objectWrapper.Value is IGH_GeometricGoo) + else if (objectWrapper.Value is IGH_GeometricGoo) { object @object = Geometry.Grasshopper.Convert.ToSAM(objectWrapper.Value as dynamic); - if(@object is IEnumerable) + if (@object is IEnumerable) sAMGeometries.AddRange(((IEnumerable)@object).Cast()); else sAMGeometries.Add(@object as dynamic); @@ -121,23 +124,23 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List segmentable3Ds = new List(); Plane plane_Default = Plane.WorldXY; - foreach(ISAMGeometry sAMGeometry in sAMGeometries) + foreach (ISAMGeometry sAMGeometry in sAMGeometries) { if (sAMGeometry is Face3D) { face3Ds.Add((Face3D)sAMGeometry); continue; } - else if(sAMGeometry is ISegmentable3D) + else if (sAMGeometry is ISegmentable3D) { ISegmentable3D segmentable3D = (ISegmentable3D)sAMGeometry; segmentable3Ds.Add(segmentable3D); } - else if(sAMGeometry is ICurvable3D) + else if (sAMGeometry is ICurvable3D) { List curve3Ds = ((ICurvable3D)sAMGeometry).GetCurves(); - if(curve3Ds != null && curve3Ds.Count != 0) + if (curve3Ds != null && curve3Ds.Count != 0) { if (curve3Ds.TrueForAll(x => x is Segment3D)) { @@ -146,7 +149,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } else { - foreach(ICurve3D curve3D in curve3Ds) + foreach (ICurve3D curve3D in curve3Ds) if (curve3D is ISegmentable3D) segmentable3Ds.Add((ISegmentable3D)curve3D); } @@ -156,7 +159,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } Dictionary> dictionary = new Dictionary>(); - foreach(ISegmentable3D segmentable3D in segmentable3Ds) + foreach (ISegmentable3D segmentable3D in segmentable3Ds) { BoundingBox3D boundingBox3D = segmentable3D.GetBoundingBox(); if (boundingBox3D == null) @@ -239,4 +242,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooAdjacencyCluster(adjacencyCluster)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAdjacencyClusterByBreps.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAdjacencyClusterByBreps.cs index 04e4c798a..07020275c 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAdjacencyClusterByBreps.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAdjacencyClusterByBreps.cs @@ -1,11 +1,13 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; -using static System.Runtime.CompilerServices.RuntimeHelpers; namespace SAM.Analytical.Grasshopper { @@ -24,7 +26,7 @@ public class SAMAnalyticalCreateAdjacencyClusterByBreps : GH_SAMVariableOutputPa /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -113,15 +115,15 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } List breps = new List(); - foreach(GH_ObjectWrapper objectWrapper in objectWrappers) + foreach (GH_ObjectWrapper objectWrapper in objectWrappers) { object @object = objectWrapper?.Value; - if(@object == null) + if (@object == null) { continue; } - if(@object is IGH_Goo) + if (@object is IGH_Goo) { @object = (@object as dynamic).Value; } @@ -136,20 +138,20 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) breps.Add((global::Rhino.Geometry.Brep)@object); continue; } - if(@object is global::Rhino.Geometry.Extrusion) + if (@object is global::Rhino.Geometry.Extrusion) { global::Rhino.Geometry.Extrusion extrusion = (global::Rhino.Geometry.Extrusion)@object; breps.Add(extrusion.ToBrep(true)); continue; } - - if(@object is global::Rhino.Geometry.Mesh) + + if (@object is global::Rhino.Geometry.Mesh) { global::Rhino.Geometry.Mesh mesh = (global::Rhino.Geometry.Mesh)@object; - if(mesh.IsClosed) + if (mesh.IsClosed) { global::Rhino.Geometry.Brep brep = global::Rhino.Geometry.Brep.CreateFromMesh(mesh, true); - if(brep != null) + if (brep != null) { breps.Add(brep); continue; @@ -178,9 +180,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) foreach (global::Rhino.Geometry.Brep brep in breps) { Shell shell = Geometry.Rhino.Convert.ToSAM_Shell(brep); - if(shell != null) + if (shell != null) { - if(!shell.IsClosed(tolerance * 10)) + if (!shell.IsClosed(tolerance * 10)) { if (Geometry.Spatial.Query.TryClose(shell, out Shell shell_Closed, silverSpacing, tolerance * 100) && shell_Closed != null) { @@ -233,4 +235,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, new GooAdjacencyCluster(adjacencyCluster)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAdjacencyClusterByBrepsAndNames.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAdjacencyClusterByBrepsAndNames.cs index d81d28dcd..f2981aad4 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAdjacencyClusterByBrepsAndNames.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAdjacencyClusterByBrepsAndNames.cs @@ -1,11 +1,13 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; -using System.Security; namespace SAM.Analytical.Grasshopper { @@ -24,7 +26,7 @@ public class SAMAnalyticalCreateAdjacencyClusterByBrepsAndNames : GH_SAMVariable /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -103,15 +105,15 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } List breps = new List(); - foreach(GH_ObjectWrapper objectWrapper in objectWrappers) + foreach (GH_ObjectWrapper objectWrapper in objectWrappers) { object @object = objectWrapper?.Value; - if(@object == null) + if (@object == null) { continue; } - if(@object is IGH_Goo) + if (@object is IGH_Goo) { @object = (@object as dynamic).Value; } @@ -126,20 +128,20 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) breps.Add((global::Rhino.Geometry.Brep)@object); continue; } - if(@object is global::Rhino.Geometry.Extrusion) + if (@object is global::Rhino.Geometry.Extrusion) { global::Rhino.Geometry.Extrusion extrusion = (global::Rhino.Geometry.Extrusion)@object; breps.Add(extrusion.ToBrep(true)); continue; } - - if(@object is global::Rhino.Geometry.Mesh) + + if (@object is global::Rhino.Geometry.Mesh) { global::Rhino.Geometry.Mesh mesh = (global::Rhino.Geometry.Mesh)@object; - if(mesh.IsClosed) + if (mesh.IsClosed) { global::Rhino.Geometry.Brep brep = global::Rhino.Geometry.Brep.CreateFromMesh(mesh, true); - if(brep != null) + if (brep != null) { breps.Add(brep); continue; @@ -159,7 +161,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) foreach (global::Rhino.Geometry.Brep brep in breps) { Shell shell = Geometry.Rhino.Convert.ToSAM_Shell(brep); - if(shell != null) + if (shell != null) { shells.Add(shell); } @@ -167,7 +169,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List names = new List(); index = Params.IndexOfInputParam("_names"); - if(index != -1) + if (index != -1) { dataAccess.GetDataList(index, names); } @@ -175,7 +177,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int count = 1; for (int i = 0; i < shells.Count; i++) { - if(names.Count < i) + if (names.Count < i) { while (names.Find(x => x == string.Format("{0} {1}", "Space", count)) != null) { @@ -222,4 +224,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAdjacencyClusterByElevations.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAdjacencyClusterByElevations.cs index 5d3e89c3e..07b7166df 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAdjacencyClusterByElevations.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAdjacencyClusterByElevations.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalCreateAdjacencyClusterByElevations : GH_SAMVariableOut /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -196,4 +199,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, new GooAdjacencyCluster(adjacencyCluster)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAdjacencyClusterByPanelsAndSpaces.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAdjacencyClusterByPanelsAndSpaces.cs index 82d157a3c..c47109c34 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAdjacencyClusterByPanelsAndSpaces.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAdjacencyClusterByPanelsAndSpaces.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -204,4 +207,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, new GooAdjacencyCluster(adjacencyCluster)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAdjacencyClusterByShells.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAdjacencyClusterByShells.cs index caf46431c..59c4c7449 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAdjacencyClusterByShells.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAdjacencyClusterByShells.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalCreateAdjacencyClusterByShells : GH_SAMVariableOutputP /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -184,4 +187,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, new GooAdjacencyCluster(adjacencyCluster)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAnalyticalModelByAdjacencyCluster.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAnalyticalModelByAdjacencyCluster.cs index aed7ea351..3d7159864 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAnalyticalModelByAdjacencyCluster.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAnalyticalModelByAdjacencyCluster.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -24,7 +27,7 @@ public class SAMAnalyticalCreateAnalyticalModelByAdjacencyCluster : GH_SAMCompon /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -97,13 +100,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } WeatherData weatherData = null; - if(!dataAccess.GetData(2, ref weatherData)) + if (!dataAccess.GetData(2, ref weatherData)) { weatherData = null; } Location location = weatherData?.Location; - if(location == null) + if (location == null) { location = Core.Query.DefaultLocation(); } @@ -123,7 +126,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List panels = new List(); dataAccess.GetDataList(5, panels); - if(panels != null && panels.Count > 0) + if (panels != null && panels.Count > 0) { foreach (Panel panel in panels) adjacencyCluster.AddObject(panel); @@ -156,4 +159,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooAnalyticalModel(analyticalModel)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAnalyticalModelBySpaces.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAnalyticalModelBySpaces.cs index 09df63f9f..4ee6424c8 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAnalyticalModelBySpaces.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateAnalyticalModelBySpaces.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -24,7 +27,7 @@ public class SAMAnalyticalCreateAnalyticalModelBySpaces : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -113,7 +116,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetDataList(4, spaces); AdjacencyCluster adjacencyCluster = new AdjacencyCluster(); - if(spaces != null) + if (spaces != null) { spaces.ForEach(x => adjacencyCluster.AddObject(x)); } @@ -136,4 +139,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooAnalyticalModel(analyticalModel)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateApertureConstruction.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateApertureConstruction.cs index 13a1916d4..d2622e233 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateApertureConstruction.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateApertureConstruction.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalCreateApertureConstruction : GH_SAMVariableOutputParam /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -102,17 +105,17 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) string apertureType_String = null; index = Params.IndexOfInputParam("apertureType_"); - if(index != -1 && dataAccess.GetData(index, ref apertureType_String) && !string.IsNullOrWhiteSpace(apertureType_String)) + if (index != -1 && dataAccess.GetData(index, ref apertureType_String) && !string.IsNullOrWhiteSpace(apertureType_String)) { ApertureType apertureType = Analytical.Query.ApertureType(apertureType_String); - if(apertureType != ApertureType.Undefined) + if (apertureType != ApertureType.Undefined) { apertureConstruction = new ApertureConstruction(apertureConstruction, apertureType); } } index = Params.IndexOfInputParam("paneConstructionLayers_"); - if(index != -1) + if (index != -1) { List constructionLayers = new List(); if (dataAccess.GetDataList(index, constructionLayers)) @@ -135,7 +138,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (index != -1) { double paneAdditionalHeatTransfer = double.NaN; - if(dataAccess.GetData(index, ref paneAdditionalHeatTransfer) && !double.IsNaN(paneAdditionalHeatTransfer)) + if (dataAccess.GetData(index, ref paneAdditionalHeatTransfer) && !double.IsNaN(paneAdditionalHeatTransfer)) { apertureConstruction.SetValue(ApertureConstructionParameter.PaneAdditionalHeatTransfer, paneAdditionalHeatTransfer); } @@ -159,4 +162,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateApertureConstructionByAperture.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateApertureConstructionByAperture.cs index b6be9f506..5f5e6fbdb 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateApertureConstructionByAperture.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateApertureConstructionByAperture.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalCreateApertureConstructionByAperture : GH_SAMVariableO /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -84,7 +87,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("apertures_"); List apertures = new List(); - if(index != -1) + if (index != -1) { dataAccess.GetDataList(index, apertures); } @@ -97,7 +100,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) AdjacencyCluster adjacencyCluster = sAMObject is AdjacencyCluster ? (AdjacencyCluster)sAMObject : ((AnalyticalModel)sAMObject).AdjacencyCluster; adjacencyCluster = new AdjacencyCluster(adjacencyCluster); - if(apertures == null || apertures.Count == 0) + if (apertures == null || apertures.Count == 0) { apertures = adjacencyCluster.GetApertures(); } @@ -149,4 +152,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateApertureConstructionLibrary.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateApertureConstructionLibrary.cs index dc2e5c764..85a67aee4 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateApertureConstructionLibrary.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateApertureConstructionLibrary.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalCreateApertureConstructionLibrary : GH_SAMVariableOutp /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -85,27 +88,27 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetData(index, ref apertureConstructionLibrary); } - if(apertureConstructionLibrary == null) + if (apertureConstructionLibrary == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } index = Params.IndexOfInputParam("apertureConstructions_"); - if(index != -1) + if (index != -1) { List apertureConstructions = new List(); - if(dataAccess.GetDataList(index, apertureConstructions)) + if (dataAccess.GetDataList(index, apertureConstructions)) { apertureConstructions?.ForEach(x => apertureConstructionLibrary.Add(x)); } } index = Params.IndexOfOutputParam("apertureConstructionLibrary"); - if(index != -1) + if (index != -1) { dataAccess.SetData(index, new GooApertureConstructionLibrary(apertureConstructionLibrary)); } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByApertureByAzimuths.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByApertureByAzimuths.cs index 662f9d609..1071a3e63 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByApertureByAzimuths.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByApertureByAzimuths.cs @@ -1,10 +1,13 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Parameters; using Rhino.Geometry; using SAM.Analytical.Grasshopper.Properties; +using SAM.Core; using SAM.Core.Grasshopper; using System; -using System.Collections; using System.Collections.Generic; namespace SAM.Analytical.Grasshopper @@ -14,7 +17,7 @@ public class SAMAnalyticalCreateCaseByApertureByAzimuths : GH_SAMVariableOutputP /// /// Gets the unique ID for this component. Do not change this ID after release. /// - public override Guid ComponentGuid => new ("579a3e1c-f514-420b-8849-9f96aef8518b"); + public override Guid ComponentGuid => new("579a3e1c-f514-420b-8849-9f96aef8518b"); /// /// The latest version of this component @@ -47,7 +50,7 @@ protected override GH_SAMParam[] Inputs { List result = []; - GooAnalyticalModelParam analyticalModelParam = new () { Name = "_baseAModel", NickName = "_baseAModel", Description = "Analytical Model", Access = GH_ParamAccess.item }; + GooAnalyticalModelParam analyticalModelParam = new() { Name = "_baseAModel", NickName = "_baseAModel", Description = "Analytical Model", Access = GH_ParamAccess.item }; result.Add(new GH_SAMParam(analyticalModelParam, ParamVisibility.Binding)); Param_Number number = null; @@ -156,7 +159,7 @@ protected override GH_SAMParam[] Outputs { List result = []; - GooAnalyticalModelParam analyticalModelParam = new () { Name = "CaseAModel", NickName = "CaseAModel", Description = "List of SAM AnalyticalModels for cases", Access = GH_ParamAccess.item }; + GooAnalyticalModelParam analyticalModelParam = new() { Name = "CaseAModel", NickName = "CaseAModel", Description = "List of SAM AnalyticalModels for cases", Access = GH_ParamAccess.item }; result.Add(new GH_SAMParam(analyticalModelParam, ParamVisibility.Binding)); Param_String param_String = new() { Name = "CaseDescription", NickName = "CaseDescription", Description = "Case Description", Access = GH_ParamAccess.item }; @@ -334,108 +337,41 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } // Build interval→ratio map (wrap-aware: e.g., 338→22 is split into 338→359 & 0→22) - Dictionary> intervalRatioMap = BuildIntervalRatioMap(azimuths, ratios, apertureConstructions); - - // Cluster / Model path - AdjacencyCluster adjacencyCluster = analyticalModel.AdjacencyCluster; - if (adjacencyCluster == null) - { - AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Failed to resolve AdjacencyCluster."); - return; - } - - var panels = adjacencyCluster.GetPanels(); - if (panels == null) return; - - var tuples_Result = new List>(); + Dictionary, Tuple> intervalRatioMap = BuildIntervalRatioMap(azimuths, ratios, apertureConstructions); - foreach (var panel in panels) + int index_Concatenate = Params.IndexOfInputParam("_concatenate_"); + bool concatenate = true; + if (index_Concatenate != -1) { - if (panel.PanelType != PanelType.WallExternal) - continue; - - double az = NormalizeAngleDegrees(panel.Azimuth()); - if (double.IsNaN(az)) - continue; - - if (!TryGetRatio(intervalRatioMap, az, out double ratio, out ApertureConstruction apertureConstruction_Temp)) - { - continue; - } - - var panel_New = Create.Panel(panel); - - if (apertureConstruction_Temp is null) - { - apertureConstruction_Temp = Analytical.Query.DefaultApertureConstruction(panel_New, ApertureType.Window); - } - - var apertures = panel_New.AddApertures(apertureConstruction_Temp, ratio, subdivide, apertureHeight, sillHeight, horizontalSeparation, offset, keepSeparationDistance); - if (apertures == null || apertures.Count == 0) - continue; - - apertures.ForEach(x => tuples_Result.Add(new Tuple(panel_New, x))); - adjacencyCluster.AddObject(panel_New); + dataAccess.GetData(index_Concatenate, ref concatenate); } - index = Params.IndexOfOutputParam("CaseAModel"); - if (index != -1) + if (!concatenate) { - dataAccess.SetData(index, adjacencyCluster is null ? null : new AnalyticalModel(analyticalModel, adjacencyCluster)); + analyticalModel = new AnalyticalModel(analyticalModel); + analyticalModel.RemoveValue("CaseDescription"); } + analyticalModel = Create.AnalyticalModel_ByApertureByAzimuths(analyticalModel, intervalRatioMap, subdivide, apertureHeight, sillHeight, horizontalSeparation, offset, keepSeparationDistance); index = Params.IndexOfOutputParam("CaseDescription"); if (index != -1) { - int index_Concatenate = Params.IndexOfInputParam("_concatenate_"); - bool concatenate = true; - if (index_Concatenate != -1) - { - dataAccess.GetData(index_Concatenate, ref concatenate); - } string caseDescription = string.Empty; - if (concatenate) + if (!Core.Query.TryGetValue(analyticalModel, "CaseDescription", out caseDescription)) { - if (!Core.Query.TryGetValue(analyticalModel, "CaseDescription", out caseDescription)) - { - caseDescription = string.Empty; - } + caseDescription = string.Empty; } - if (string.IsNullOrWhiteSpace(caseDescription)) - { - caseDescription = "Case"; - } - else - { - caseDescription += "_"; - } - - string sufix = "ByApertureByAzimuths_"; - if (ratios != null && ratios.Count != 0) - { - sufix += "R_" + string.Join("_", ratios); - } - - string value = caseDescription + sufix; - - dataAccess.SetData(index, value); + dataAccess.SetData(index, caseDescription); } - if (!analyticalModel.TryGetValue(AnalyticalModelParameter.CaseDataCollection, out CaseDataCollection caseDataCollection)) - { - caseDataCollection = []; - } - else + index = Params.IndexOfOutputParam("CaseAModel"); + if (index != -1) { - caseDataCollection = [.. caseDataCollection]; + dataAccess.SetData(index, analyticalModel); } - - caseDataCollection.Add(new ApertureCaseData(ratios)); - - analyticalModel?.SetValue(AnalyticalModelParameter.CaseDataCollection, caseDataCollection); } // ========================= Helpers ========================= @@ -444,12 +380,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) /// Build a dictionary from intervals to (ratio, construction), expanding wrap-around /// intervals (T0 > T1) into [T0→359] and [0→T1]. /// - private static Dictionary> BuildIntervalRatioMap( + private static Dictionary, Tuple> BuildIntervalRatioMap( IList intervals, IList ratios, IList apertureConstructions) { - Dictionary> dictionary = []; + Dictionary, Tuple> dictionary = []; for (int i = 0; i < intervals.Count; i++) { Interval interval = intervals[i]; @@ -466,14 +402,14 @@ private static Dictionary> BuildIn // Non-wrapped: a <= b if (a <= b) { - var norm = new Interval(a, b); + var norm = new Range(a, b); dictionary[norm] = new Tuple(ratio, apertureConstruction); } else { // Wrapped: split into two - var iv1 = new Interval(a, 359.0); - var iv2 = new Interval(0.0, b); + var iv1 = new Range(a, 359.0); + var iv2 = new Range(0.0, b); dictionary[iv1] = new Tuple(ratio, apertureConstruction); dictionary[iv2] = new Tuple(ratio, apertureConstruction); } @@ -481,38 +417,6 @@ private static Dictionary> BuildIn return dictionary; } - /// Try to find the ratio whose interval contains the given azimuth. - private static bool TryGetRatio( - Dictionary> map, - double azimuthDeg, - out double ratio, - out ApertureConstruction apertureConstruction) - { - double azimuthDeg_Round = System.Math.Round(azimuthDeg, MidpointRounding.ToEven); - apertureConstruction = null; - ratio = 0.0; - - foreach (var kvp in map) - { - if (kvp.Key.IncludesParameter(azimuthDeg_Round)) - { - ratio = kvp.Value.Item1; - apertureConstruction = kvp.Value.Item2; - return true; - } - } - return false; - } - - /// Normalise angle to [0, 359]. - private static double NormalizeAngleDegrees(double angleDeg) - { - if (double.IsNaN(angleDeg) || double.IsInfinity(angleDeg)) return double.NaN; - double a = angleDeg % 360.0; - if (a < 0) a += 360.0; - return (a >= 360.0) ? 359.0 : a; - } - /// Clamp arbitrary double to [0, 359] while preserving values in that range. private static double ClampTo360(double v) { @@ -535,4 +439,4 @@ private static List NormalizeRatios(List ratios) return norm; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByApertureConstruction.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByApertureConstruction.cs index 329204c62..d4caebf21 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByApertureConstruction.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByApertureConstruction.cs @@ -1,8 +1,10 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Parameters; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; -using SAM.Weather; using System; using System.Collections.Generic; @@ -13,7 +15,7 @@ public class SAMAnalyticalCreateCaseByApertureConstruction : GH_SAMVariableOutpu /// /// Gets the unique ID for this component. Do not change this ID after release. /// - public override Guid ComponentGuid => new ("3f0618c7-7a51-4e61-88c9-60da22ccb245"); + public override Guid ComponentGuid => new("3f0618c7-7a51-4e61-88c9-60da22ccb245"); /// /// The latest version of this component @@ -46,7 +48,7 @@ protected override GH_SAMParam[] Inputs { List result = []; - GooAnalyticalModelParam analyticalModelParam = new () { Name = "_baseAModel", NickName = "_baseAModel", Description = "Analytical Model", Access = GH_ParamAccess.item }; + GooAnalyticalModelParam analyticalModelParam = new() { Name = "_baseAModel", NickName = "_baseAModel", Description = "Analytical Model", Access = GH_ParamAccess.item }; result.Add(new GH_SAMParam(analyticalModelParam, ParamVisibility.Binding)); GooApertureParam gooApertureParam = new() { Name = "_apertures_", NickName = "_apertures_", Description = "SAM Apertures", Access = GH_ParamAccess.list, Optional = true }; @@ -79,7 +81,7 @@ protected override GH_SAMParam[] Outputs { List result = []; - GooAnalyticalModelParam analyticalModelParam = new () { Name = "CaseAModel", NickName = "CaseAModel", Description = "SAM AnalyticalModel", Access = GH_ParamAccess.item }; + GooAnalyticalModelParam analyticalModelParam = new() { Name = "CaseAModel", NickName = "CaseAModel", Description = "SAM AnalyticalModel", Access = GH_ParamAccess.item }; result.Add(new GH_SAMParam(analyticalModelParam, ParamVisibility.Binding)); Param_String param_String = new() { Name = "CaseDescription", NickName = "CaseDescription", Description = "Case Description", Access = GH_ParamAccess.item }; @@ -120,106 +122,33 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetData(index, ref apertureConstruction); } - if(apertures.Count == 0) - { - apertures = analyticalModel.GetApertures(); - } - else + int index_Concatenate = Params.IndexOfInputParam("_concatenate_"); + bool concatenate = true; + if (index_Concatenate != -1) { - for(int i = apertures.Count - 1; i >= 0; i--) - { - if (apertures[i] is null) - { - apertures.RemoveAt(i); - continue; - } - - Aperture aperture = analyticalModel.GetAperture(apertures[i].Guid, out Panel panel); - if(aperture is null) - { - apertures.RemoveAt(i); - continue; - } - - apertures[i] = new Aperture(aperture); - } + dataAccess.GetData(index_Concatenate, ref concatenate); } - if (apertures != null && apertures.Count != 0 && apertureConstruction != null ) + if (!concatenate) { - AdjacencyCluster adjacencyCluster = new(analyticalModel.AdjacencyCluster, true); - - foreach (Aperture aperture in apertures) - { - Aperture aperture_Temp = new(aperture, apertureConstruction); - - if (adjacencyCluster.GetAperture(aperture_Temp.Guid, out Panel panel_Temp) is null || panel_Temp is null) - { - continue; - } - - panel_Temp = Create.Panel(panel_Temp); - - panel_Temp.RemoveAperture(aperture_Temp.Guid); - panel_Temp.AddAperture(aperture_Temp); - - adjacencyCluster.AddObject(panel_Temp); - } - - analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster); + analyticalModel = new AnalyticalModel(analyticalModel); + analyticalModel.RemoveValue("CaseDescription"); } + analyticalModel = Create.AnalyticalModel_ByApertureConstruction(analyticalModel, apertureConstruction); + index = Params.IndexOfOutputParam("CaseDescription"); if (index != -1) { - int index_Concatenate = Params.IndexOfInputParam("_concatenate_"); - bool concatenate = true; - if (index_Concatenate != -1) - { - dataAccess.GetData(index_Concatenate, ref concatenate); - } string caseDescription = string.Empty; - if (concatenate) + if (!Core.Query.TryGetValue(analyticalModel, "CaseDescription", out caseDescription)) { - if (!Core.Query.TryGetValue(analyticalModel, "CaseDescription", out caseDescription)) - { - caseDescription = string.Empty; - } + caseDescription = string.Empty; } - if (string.IsNullOrWhiteSpace(caseDescription)) - { - caseDescription = "Case"; - } - else - { - caseDescription += "_"; - } - - string sufix = "ByApertureConstruction_"; - if (apertureConstruction is not null) - { - sufix += apertureConstruction.Name ?? string.Empty; - } - - string value = caseDescription + sufix; - - dataAccess.SetData(index, value); - } - - if (!analyticalModel.TryGetValue(AnalyticalModelParameter.CaseDataCollection, out CaseDataCollection caseDataCollection)) - { - caseDataCollection = new CaseDataCollection(); + dataAccess.SetData(index, caseDescription); } - else - { - caseDataCollection = new CaseDataCollection(caseDataCollection); - } - - caseDataCollection.Add(new ApertureConstructionCaseData(apertureConstruction)); - - analyticalModel?.SetValue(AnalyticalModelParameter.CaseDataCollection, caseDataCollection); index = Params.IndexOfOutputParam("CaseAModel"); if (index != -1) @@ -228,4 +157,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByOpening.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByOpening.cs index a6c2f98d0..72aae1d4a 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByOpening.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByOpening.cs @@ -1,10 +1,11 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; -using SAM.Weather; using System; using System.Collections.Generic; -using System.Linq; namespace SAM.Analytical.Grasshopper { @@ -342,165 +343,208 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetData(index, ref paneSizeOnly); } - // Process apertures - List apertures_Result = null; - List dischargeCoefficients_Result = null; - List openingProperties_Result = null; - - if (apertures != null && openingAngles != null && apertures.Count > 0 && openingAngles.Count > 0) + int index_Concatenate = Params.IndexOfInputParam("_concatenate_"); + bool concatenate = true; + if (index_Concatenate != -1) { - apertures_Result = []; - dischargeCoefficients_Result = []; - openingProperties_Result = []; + dataAccess.GetData(index_Concatenate, ref concatenate); + } - for (int i = 0; i < apertures.Count; i++) - { - Aperture aperture = apertures[i]; - - Panel panel = adjacencyCluster.GetPanel(aperture); - if (panel == null) - { - continue; - } - - Aperture aperture_Temp = panel.GetAperture(aperture.Guid); - if (aperture_Temp == null) - { - continue; - } - - panel = Create.Panel(panel); - aperture_Temp = new Aperture(aperture_Temp); - - double openingAngle = openingAngles.Count > i ? openingAngles[i] : openingAngles.Last(); - double width = paneSizeOnly ? aperture_Temp.GetWidth(AperturePart.Pane) : aperture_Temp.GetWidth(); - double height = paneSizeOnly ? aperture_Temp.GetHeight(AperturePart.Pane) : aperture_Temp.GetHeight(); - - double factor = (factors != null && factors.Count != 0) ? (factors.Count > i ? factors[i] : factors.Last()) : double.NaN; - - PartOOpeningProperties partOOpeningProperties = new (width, height, openingAngle); - - double dischargeCoefficient = partOOpeningProperties.GetDischargeCoefficient(); - - ISingleOpeningProperties singleOpeningProperties = null; - if (profiles != null && profiles.Count != 0) - { - Profile profile = profiles.Count > i ? profiles[i] : profiles.Last(); - ProfileOpeningProperties profileOpeningProperties = new (partOOpeningProperties.GetDischargeCoefficient(), profile); - if (!double.IsNaN(factor)) - { - profileOpeningProperties.Factor = factor; - } - - singleOpeningProperties = profileOpeningProperties; - } - else - { - if (!double.IsNaN(factor)) - { - partOOpeningProperties.Factor = factor; - } - - singleOpeningProperties = partOOpeningProperties; - } - - if (descriptions != null && descriptions.Count != 0) - { - string description = descriptions.Count > i ? descriptions[i] : descriptions.Last(); - singleOpeningProperties.SetValue(OpeningPropertiesParameter.Description, description); - } - - string function_Temp = DefaultOpeningFunction; - if (functions != null && functions.Count != 0) - { - function_Temp = functions.Count > i ? functions[i] : functions.Last(); - } - singleOpeningProperties.SetValue(OpeningPropertiesParameter.Function, function_Temp); - - if (colors != null && colors.Count != 0) - { - System.Drawing.Color color = colors.Count > i ? colors[i] : colors.Last(); - aperture_Temp.SetValue(ApertureParameter.Color, color); - } - else - { - aperture_Temp.SetValue(ApertureParameter.Color, Analytical.Query.Color(ApertureType.Window, AperturePart.Pane, true)); - } - - aperture_Temp.AddSingleOpeningProperties(singleOpeningProperties); - - panel.RemoveAperture(aperture.Guid); - if (panel.AddAperture(aperture_Temp)) - { - adjacencyCluster.AddObject(panel); - apertures_Result.Add(aperture_Temp); - dischargeCoefficients_Result.Add(singleOpeningProperties.GetDischargeCoefficient()); - openingProperties_Result.Add(singleOpeningProperties); - } - } + if (!concatenate) + { + analyticalModel = new AnalyticalModel(analyticalModel); + analyticalModel.RemoveValue("CaseDescription"); } - // Make a case model with the updated cluster (original model object is not changed) - analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster); + analyticalModel = Create.AnalyticalModel_ByOpening(analyticalModel, + openingAngles, + descriptions, + functions, + colors, + factors, + profiles, + paneSizeOnly, + apertures); index = Params.IndexOfOutputParam("CaseDescription"); if (index != -1) { - int index_Concatenate = Params.IndexOfInputParam("_concatenate_"); - bool concatenate = true; - if (index_Concatenate != -1) - { - dataAccess.GetData(index_Concatenate, ref concatenate); - } string caseDescription = string.Empty; - if (concatenate) - { - if(!Core.Query.TryGetValue(analyticalModel, "CaseDescription", out caseDescription)) - { - caseDescription = string.Empty; - } - } - - if(string.IsNullOrWhiteSpace(caseDescription)) - { - caseDescription = "Case"; - } - else + if (!Core.Query.TryGetValue(analyticalModel, "CaseDescription", out caseDescription)) { - caseDescription += "_"; + caseDescription = string.Empty; } - string sufix = "ByOpening_"; - if (openingAngles is not null) - { - sufix += string.Join("_", openingAngles.ConvertAll(x => string.Format("{0}deg", x))); - } - - string value = caseDescription + sufix; - - dataAccess.SetData(index, value); - } - - if (!analyticalModel.TryGetValue(AnalyticalModelParameter.CaseDataCollection, out CaseDataCollection caseDataCollection)) - { - caseDataCollection = new CaseDataCollection(); - } - else - { - caseDataCollection = new CaseDataCollection(caseDataCollection); + dataAccess.SetData(index, caseDescription); } - caseDataCollection.Add(new OpeningCaseData(openingAngles?.FirstOrDefault() ?? double.NaN)); - - analyticalModel?.SetValue(AnalyticalModelParameter.CaseDataCollection, caseDataCollection); - // Output index = Params.IndexOfOutputParam("CaseAModel"); if (index != -1) { dataAccess.SetData(index, analyticalModel); } + + //// Process apertures + //List apertures_Result = null; + //List dischargeCoefficients_Result = null; + //List openingProperties_Result = null; + + //if (apertures != null && openingAngles != null && apertures.Count > 0 && openingAngles.Count > 0) + //{ + // apertures_Result = []; + // dischargeCoefficients_Result = []; + // openingProperties_Result = []; + + // for (int i = 0; i < apertures.Count; i++) + // { + // Aperture aperture = apertures[i]; + + // Panel panel = adjacencyCluster.GetPanel(aperture); + // if (panel == null) + // { + // continue; + // } + + // Aperture aperture_Temp = panel.GetAperture(aperture.Guid); + // if (aperture_Temp == null) + // { + // continue; + // } + + // panel = Create.Panel(panel); + // aperture_Temp = new Aperture(aperture_Temp); + + // double openingAngle = openingAngles.Count > i ? openingAngles[i] : openingAngles.Last(); + // double width = paneSizeOnly ? aperture_Temp.GetWidth(AperturePart.Pane) : aperture_Temp.GetWidth(); + // double height = paneSizeOnly ? aperture_Temp.GetHeight(AperturePart.Pane) : aperture_Temp.GetHeight(); + + // double factor = (factors != null && factors.Count != 0) ? (factors.Count > i ? factors[i] : factors.Last()) : double.NaN; + + // PartOOpeningProperties partOOpeningProperties = new (width, height, openingAngle); + + // double dischargeCoefficient = partOOpeningProperties.GetDischargeCoefficient(); + + // ISingleOpeningProperties singleOpeningProperties = null; + // if (profiles != null && profiles.Count != 0) + // { + // Profile profile = profiles.Count > i ? profiles[i] : profiles.Last(); + // ProfileOpeningProperties profileOpeningProperties = new (partOOpeningProperties.GetDischargeCoefficient(), profile); + // if (!double.IsNaN(factor)) + // { + // profileOpeningProperties.Factor = factor; + // } + + // singleOpeningProperties = profileOpeningProperties; + // } + // else + // { + // if (!double.IsNaN(factor)) + // { + // partOOpeningProperties.Factor = factor; + // } + + // singleOpeningProperties = partOOpeningProperties; + // } + + // if (descriptions != null && descriptions.Count != 0) + // { + // string description = descriptions.Count > i ? descriptions[i] : descriptions.Last(); + // singleOpeningProperties.SetValue(OpeningPropertiesParameter.Description, description); + // } + + // string function_Temp = DefaultOpeningFunction; + // if (functions != null && functions.Count != 0) + // { + // function_Temp = functions.Count > i ? functions[i] : functions.Last(); + // } + // singleOpeningProperties.SetValue(OpeningPropertiesParameter.Function, function_Temp); + + // if (colors != null && colors.Count != 0) + // { + // System.Drawing.Color color = colors.Count > i ? colors[i] : colors.Last(); + // aperture_Temp.SetValue(ApertureParameter.Color, color); + // } + // else + // { + // aperture_Temp.SetValue(ApertureParameter.Color, Analytical.Query.Color(ApertureType.Window, AperturePart.Pane, true)); + // } + + // aperture_Temp.AddSingleOpeningProperties(singleOpeningProperties); + + // panel.RemoveAperture(aperture.Guid); + // if (panel.AddAperture(aperture_Temp)) + // { + // adjacencyCluster.AddObject(panel); + // apertures_Result.Add(aperture_Temp); + // dischargeCoefficients_Result.Add(singleOpeningProperties.GetDischargeCoefficient()); + // openingProperties_Result.Add(singleOpeningProperties); + // } + // } + //} + + //// Make a case model with the updated cluster (original model object is not changed) + //analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster); + + //index = Params.IndexOfOutputParam("CaseDescription"); + //if (index != -1) + //{ + // int index_Concatenate = Params.IndexOfInputParam("_concatenate_"); + // bool concatenate = true; + // if (index_Concatenate != -1) + // { + // dataAccess.GetData(index_Concatenate, ref concatenate); + // } + + // string caseDescription = string.Empty; + // if (concatenate) + // { + // if(!Core.Query.TryGetValue(analyticalModel, "CaseDescription", out caseDescription)) + // { + // caseDescription = string.Empty; + // } + // } + + // if(string.IsNullOrWhiteSpace(caseDescription)) + // { + // caseDescription = "Case"; + // } + // else + // { + // caseDescription += "_"; + // } + + // string sufix = "ByOpening_"; + // if (openingAngles is not null) + // { + // sufix += string.Join("_", openingAngles.ConvertAll(x => string.Format("{0}deg", x))); + // } + + // string value = caseDescription + sufix; + + // dataAccess.SetData(index, value); + //} + + //if (!analyticalModel.TryGetValue(AnalyticalModelParameter.CaseDataCollection, out CaseDataCollection caseDataCollection)) + //{ + // caseDataCollection = new CaseDataCollection(); + //} + //else + //{ + // caseDataCollection = new CaseDataCollection(caseDataCollection); + //} + + //caseDataCollection.Add(new OpeningCaseData(openingAngles?.FirstOrDefault() ?? double.NaN)); + + //analyticalModel?.SetValue(AnalyticalModelParameter.CaseDataCollection, caseDataCollection); + + //// Output + //index = Params.IndexOfOutputParam("CaseAModel"); + //if (index != -1) + //{ + // dataAccess.SetData(index, analyticalModel); + //} } } } diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByShade.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByShade.cs index 1b3aa2e53..fddf1df91 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByShade.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByShade.cs @@ -1,8 +1,10 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Parameters; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; -using SAM.Weather; using System; using System.Collections.Generic; @@ -345,105 +347,151 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_rightFinFrontOffset_"); double rightFinFrontOffset = 0.0; if (index != -1) dataAccess.GetData(index, ref rightFinFrontOffset); - if (analyticalObjects != null && analyticalObjects.Count != 0) + int index_Concatenate = Params.IndexOfInputParam("_concatenate_"); + bool concatenate = true; + if (index_Concatenate != -1) { - AdjacencyCluster adjacencyCluster = new AdjacencyCluster(analyticalModel.AdjacencyCluster, true); - - foreach (IAnalyticalObject analyticalObject in analyticalObjects) - { - List shades = null; - if (analyticalObject is Panel panel) - { - shades = Create.Panels_Shade(panel, overhangDepth, overhangVerticalOffset, overhangFrontOffset, - leftFinDepth, leftFinOffset, leftFinFrontOffset, - rightFinDepth, rightFinOffset, rightFinFrontOffset); - } - else if (analyticalObject is Aperture aperture) - { - shades = Create.Panels_Shade(aperture, glassPartOnly, overhangDepth, overhangVerticalOffset, overhangFrontOffset, - leftFinDepth, leftFinOffset, leftFinFrontOffset, - rightFinDepth, rightFinOffset, rightFinFrontOffset); - } - - if (shades == null) continue; - - foreach (Panel shade in shades) - { - adjacencyCluster.AddObject(shade); - } - } + dataAccess.GetData(index_Concatenate, ref concatenate); + } - analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster); + if (!concatenate) + { + analyticalModel = new AnalyticalModel(analyticalModel); + analyticalModel.RemoveValue("CaseDescription"); } + analyticalModel = Create.AnalyticalModel_ByShade(analyticalModel, + glassPartOnly, + overhangDepth, + overhangVerticalOffset, + overhangFrontOffset, + leftFinDepth, + leftFinOffset, + leftFinFrontOffset, + rightFinDepth, + rightFinOffset, + rightFinFrontOffset, + analyticalObjects); + index = Params.IndexOfOutputParam("CaseDescription"); if (index != -1) { - int index_Concatenate = Params.IndexOfInputParam("_concatenate_"); - bool concatenate = true; - if (index_Concatenate != -1) - { - dataAccess.GetData(index_Concatenate, ref concatenate); - } string caseDescription = string.Empty; - if (concatenate) - { - if (!Core.Query.TryGetValue(analyticalModel, "CaseDescription", out caseDescription)) - { - caseDescription = string.Empty; - } - } - - if (string.IsNullOrWhiteSpace(caseDescription)) - { - caseDescription = "Case"; - } - else - { - caseDescription += "_"; - } - - string sufix = "ByShade_"; - if (overhangDepth != 0) - { - sufix += string.Format("O{0}m", overhangDepth); - } - - if (leftFinDepth != 0) + if (!Core.Query.TryGetValue(analyticalModel, "CaseDescription", out caseDescription)) { - sufix += string.Format("L{0}m", leftFinDepth); + caseDescription = string.Empty; } - if (rightFinDepth != 0) - { - sufix += string.Format("R{0}m", rightFinDepth); - } - - string value = caseDescription + sufix; - - dataAccess.SetData(index, value); + dataAccess.SetData(index, caseDescription); } - if (!analyticalModel.TryGetValue(AnalyticalModelParameter.CaseDataCollection, out CaseDataCollection caseDataCollection)) - { - caseDataCollection = new CaseDataCollection(); - } - else - { - caseDataCollection = new CaseDataCollection(caseDataCollection); - } - - caseDataCollection.Add(new ShadeCaseData(overhangDepth, leftFinDepth, rightFinDepth)); - - analyticalModel?.SetValue(AnalyticalModelParameter.CaseDataCollection, caseDataCollection); - // Output index = Params.IndexOfOutputParam("CaseAModel"); if (index != -1) { dataAccess.SetData(index, analyticalModel); } + + //if (analyticalObjects != null && analyticalObjects.Count != 0) + //{ + // AdjacencyCluster adjacencyCluster = new AdjacencyCluster(analyticalModel.AdjacencyCluster, true); + + // foreach (IAnalyticalObject analyticalObject in analyticalObjects) + // { + // List shades = null; + // if (analyticalObject is Panel panel) + // { + // shades = Create.Panels_Shade(panel, overhangDepth, overhangVerticalOffset, overhangFrontOffset, + // leftFinDepth, leftFinOffset, leftFinFrontOffset, + // rightFinDepth, rightFinOffset, rightFinFrontOffset); + // } + // else if (analyticalObject is Aperture aperture) + // { + // shades = Create.Panels_Shade(aperture, glassPartOnly, overhangDepth, overhangVerticalOffset, overhangFrontOffset, + // leftFinDepth, leftFinOffset, leftFinFrontOffset, + // rightFinDepth, rightFinOffset, rightFinFrontOffset); + // } + + // if (shades == null) continue; + + // foreach (Panel shade in shades) + // { + // adjacencyCluster.AddObject(shade); + // } + // } + + // analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster); + //} + + //index = Params.IndexOfOutputParam("CaseDescription"); + //if (index != -1) + //{ + // int index_Concatenate = Params.IndexOfInputParam("_concatenate_"); + // bool concatenate = true; + // if (index_Concatenate != -1) + // { + // dataAccess.GetData(index_Concatenate, ref concatenate); + // } + + // string caseDescription = string.Empty; + // if (concatenate) + // { + // if (!Core.Query.TryGetValue(analyticalModel, "CaseDescription", out caseDescription)) + // { + // caseDescription = string.Empty; + // } + // } + + // if (string.IsNullOrWhiteSpace(caseDescription)) + // { + // caseDescription = "Case"; + // } + // else + // { + // caseDescription += "_"; + // } + + // string sufix = "ByShade_"; + // if (overhangDepth != 0) + // { + // sufix += string.Format("O{0}m", overhangDepth); + // } + + // if (leftFinDepth != 0) + // { + // sufix += string.Format("L{0}m", leftFinDepth); + // } + + // if (rightFinDepth != 0) + // { + // sufix += string.Format("R{0}m", rightFinDepth); + // } + + // string value = caseDescription + sufix; + + // dataAccess.SetData(index, value); + //} + + //if (!analyticalModel.TryGetValue(AnalyticalModelParameter.CaseDataCollection, out CaseDataCollection caseDataCollection)) + //{ + // caseDataCollection = new CaseDataCollection(); + //} + //else + //{ + // caseDataCollection = new CaseDataCollection(caseDataCollection); + //} + + //caseDataCollection.Add(new ShadeCaseData(overhangDepth, leftFinDepth, rightFinDepth)); + + //analyticalModel?.SetValue(AnalyticalModelParameter.CaseDataCollection, caseDataCollection); + + //// Output + //index = Params.IndexOfOutputParam("CaseAModel"); + //if (index != -1) + //{ + // dataAccess.SetData(index, analyticalModel); + //} } } } diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByShade1.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByShade1.cs index d71a7d120..173aac5a2 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByShade1.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByShade1.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Parameters; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -175,52 +178,32 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetDataList(index, shades); } - // Only create a copy and add shades when any are provided - if (shades != null && shades.Count != 0) + int index_Concatenate = Params.IndexOfInputParam("_concatenate_"); + bool concatenate = true; + if (index_Concatenate != -1) { - AdjacencyCluster adjacencyCluster = new (analyticalModel.AdjacencyCluster, true); - - foreach (Panel shade in shades) - { - adjacencyCluster.AddObject(shade); - } + dataAccess.GetData(index_Concatenate, ref concatenate); + } - analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster); // copy with shades (original stays unchanged) + if (!concatenate) + { + analyticalModel = new AnalyticalModel(analyticalModel); + analyticalModel.RemoveValue("CaseDescription"); } + analyticalModel = Create.AnalyticalModel_ByShade(analyticalModel, shades); + index = Params.IndexOfOutputParam("CaseDescription"); if (index != -1) { - int index_Concatenate = Params.IndexOfInputParam("_concatenate_"); - bool concatenate = true; - if (index_Concatenate != -1) - { - dataAccess.GetData(index_Concatenate, ref concatenate); - } string caseDescription = string.Empty; - if (concatenate) + if (!Core.Query.TryGetValue(analyticalModel, "CaseDescription", out caseDescription)) { - if (!Core.Query.TryGetValue(analyticalModel, "CaseDescription", out caseDescription)) - { - caseDescription = string.Empty; - } + caseDescription = string.Empty; } - if (string.IsNullOrWhiteSpace(caseDescription)) - { - caseDescription = "Case"; - } - else - { - caseDescription += "_"; - } - - string sufix = "ByShade1_"; - - string value = caseDescription + sufix; - - dataAccess.SetData(index, value); + dataAccess.SetData(index, caseDescription); } // Output @@ -229,6 +212,61 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { dataAccess.SetData(index, analyticalModel); } + + //// Only create a copy and add shades when any are provided + //if (shades != null && shades.Count != 0) + //{ + // AdjacencyCluster adjacencyCluster = new (analyticalModel.AdjacencyCluster, true); + + // foreach (Panel shade in shades) + // { + // adjacencyCluster.AddObject(shade); + // } + + // analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster); // copy with shades (original stays unchanged) + //} + + //index = Params.IndexOfOutputParam("CaseDescription"); + //if (index != -1) + //{ + // int index_Concatenate = Params.IndexOfInputParam("_concatenate_"); + // bool concatenate = true; + // if (index_Concatenate != -1) + // { + // dataAccess.GetData(index_Concatenate, ref concatenate); + // } + + // string caseDescription = string.Empty; + // if (concatenate) + // { + // if (!Core.Query.TryGetValue(analyticalModel, "CaseDescription", out caseDescription)) + // { + // caseDescription = string.Empty; + // } + // } + + // if (string.IsNullOrWhiteSpace(caseDescription)) + // { + // caseDescription = "Case"; + // } + // else + // { + // caseDescription += "_"; + // } + + // string sufix = "ByShade1_"; + + // string value = caseDescription + sufix; + + // dataAccess.SetData(index, value); + //} + + //// Output + //index = Params.IndexOfOutputParam("CaseAModel"); + //if (index != -1) + //{ + // dataAccess.SetData(index, analyticalModel); + //} } } } diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByVentilation.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByVentilation.cs index 9a922707d..0b003f65d 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByVentilation.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByVentilation.cs @@ -1,9 +1,10 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Parameters; using SAM.Analytical.Grasshopper.Properties; -using SAM.Core; using SAM.Core.Grasshopper; -using SAM.Weather; using System; using System.Collections.Generic; @@ -293,185 +294,234 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("description_"); if (index != -1 && !dataAccess.GetData(index, ref description)) description = null; - // Work on a modifiable copy of the cluster - AdjacencyCluster adjacencyCluster = analyticalModel.AdjacencyCluster; - - List spaces = []; - List internalConditions = []; - - if (adjacencyCluster is not null) + List analyticalObjects = []; + index = Params.IndexOfInputParam("_spaces/zones"); + if (index != -1) { - adjacencyCluster = new AdjacencyCluster(adjacencyCluster, true); - - // Scope selection (Spaces or Zones) - List analyticalObjects = []; - index = Params.IndexOfInputParam("_spaces/zones"); - if (index != -1 && dataAccess.GetDataList(index, analyticalObjects) && analyticalObjects != null) - { - foreach (IAnalyticalObject analyticalObject_Temp in analyticalObjects) - { - if (analyticalObject_Temp is not SAMObject sAMObject) - continue; - - List spaces_Temp = []; - if (analyticalObject_Temp is Space space) - { - spaces_Temp.Add(adjacencyCluster.GetObject(sAMObject.Guid)); - } - else if (analyticalObject_Temp is Zone zone) - { - spaces_Temp = adjacencyCluster.GetSpaces(zone); - } - - spaces.AddRange(spaces_Temp); - } - } - - if (spaces is null || spaces.Count == 0) - { - spaces = adjacencyCluster.GetSpaces(); - } + dataAccess.GetDataList(index, analyticalObjects); } - if (adjacencyCluster != null && spaces != null && spaces.Count != 0) + //// Work on a modifiable copy of the cluster + //AdjacencyCluster adjacencyCluster = analyticalModel.AdjacencyCluster; + + //List spaces = []; + //List internalConditions = []; + + //if (adjacencyCluster is not null) + //{ + // adjacencyCluster = new AdjacencyCluster(adjacencyCluster, true); + + // // Scope selection (Spaces or Zones) + // List analyticalObjects = []; + // index = Params.IndexOfInputParam("_spaces/zones"); + // if (index != -1 && dataAccess.GetDataList(index, analyticalObjects) && analyticalObjects != null) + // { + // foreach (IAnalyticalObject analyticalObject_Temp in analyticalObjects) + // { + // if (analyticalObject_Temp is not SAMObject sAMObject) + // continue; + + // List spaces_Temp = []; + // if (analyticalObject_Temp is Space space) + // { + // spaces_Temp.Add(adjacencyCluster.GetObject(sAMObject.Guid)); + // } + // else if (analyticalObject_Temp is Zone zone) + // { + // spaces_Temp = adjacencyCluster.GetSpaces(zone); + // } + + // spaces.AddRange(spaces_Temp); + // } + // } + + // if (spaces is null || spaces.Count == 0) + // { + // spaces = adjacencyCluster.GetSpaces(); + // } + //} + + //if (adjacencyCluster != null && spaces != null && spaces.Count != 0) + //{ + // foreach (Space space in spaces) + // { + // if (space?.InternalCondition is not InternalCondition internalCondition) + // continue; + + // if (function is null) + // { + // internalCondition.RemoveValue(InternalConditionParameter.VentilationFunction); + // } + // else + // { + // Function function_Temp = Analytical.Convert.ToSAM_Function(function); + // if (function_Temp is not null) + // { + // FunctionType functionType = function_Temp.GetFunctionType(); + + // if (functionType == FunctionType.tcmvc || functionType == FunctionType.tcmvn || functionType == FunctionType.tmmvn) + // { + // int vent_Index = 3; // ACH token index for these function types + + // if (!double.IsNaN(ach)) + // { + // function_Temp[vent_Index] = ach; + // } + // else if (!double.IsNaN(m3h)) + // { + // double volume = space.Volume(adjacencyCluster); + // if (!double.IsNaN(volume)) + // { + // function_Temp[vent_Index] = Core.Query.Round(m3h / volume, Tolerance.MacroDistance); + // } + // } + // } + // } + + // internalCondition.SetValue(InternalConditionParameter.VentilationFunction, function_Temp?.ToString() ?? function); + // } + + // if (description is null) + // internalCondition.RemoveValue(InternalConditionParameter.VentilationFunctionDescription); + // else + // internalCondition.SetValue(InternalConditionParameter.VentilationFunctionDescription, description); + + // if (double.IsNaN(factor)) + // internalCondition.RemoveValue(InternalConditionParameter.VentilationFunctionFactor); + // else + // internalCondition.SetValue(InternalConditionParameter.VentilationFunctionFactor, factor); + + // if (double.IsNaN(setback)) + // internalCondition.RemoveValue(InternalConditionParameter.VentilationFunctionSetback); + // else + // internalCondition.SetValue(InternalConditionParameter.VentilationFunctionSetback, setback); + + // space.InternalCondition = internalCondition; + // internalConditions.Add(internalCondition); + // adjacencyCluster.AddObject(space); + // } + //} + + //if (adjacencyCluster != null) + //{ + // analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster); + //} + + int index_Concatenate = Params.IndexOfInputParam("_concatenate_"); + bool concatenate = true; + if (index_Concatenate != -1) { - foreach (Space space in spaces) - { - if (space?.InternalCondition is not InternalCondition internalCondition) - continue; - - if (function is null) - { - internalCondition.RemoveValue(InternalConditionParameter.VentilationFunction); - } - else - { - Function function_Temp = Analytical.Convert.ToSAM_Function(function); - if (function_Temp is not null) - { - FunctionType functionType = function_Temp.GetFunctionType(); - - if (functionType == FunctionType.tcmvc || functionType == FunctionType.tcmvn || functionType == FunctionType.tmmvn) - { - int vent_Index = 3; // ACH token index for these function types - - if (!double.IsNaN(ach)) - { - function_Temp[vent_Index] = ach; - } - else if (!double.IsNaN(m3h)) - { - double volume = space.Volume(adjacencyCluster); - if (!double.IsNaN(volume)) - { - function_Temp[vent_Index] = Core.Query.Round(m3h / volume, Tolerance.MacroDistance); - } - } - } - } - - internalCondition.SetValue(InternalConditionParameter.VentilationFunction, function_Temp?.ToString() ?? function); - } - - if (description is null) - internalCondition.RemoveValue(InternalConditionParameter.VentilationFunctionDescription); - else - internalCondition.SetValue(InternalConditionParameter.VentilationFunctionDescription, description); - - if (double.IsNaN(factor)) - internalCondition.RemoveValue(InternalConditionParameter.VentilationFunctionFactor); - else - internalCondition.SetValue(InternalConditionParameter.VentilationFunctionFactor, factor); - - if (double.IsNaN(setback)) - internalCondition.RemoveValue(InternalConditionParameter.VentilationFunctionSetback); - else - internalCondition.SetValue(InternalConditionParameter.VentilationFunctionSetback, setback); - - space.InternalCondition = internalCondition; - internalConditions.Add(internalCondition); - adjacencyCluster.AddObject(space); - } + dataAccess.GetData(index_Concatenate, ref concatenate); } - if (adjacencyCluster != null) + if (!concatenate) { - analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster); + analyticalModel = new AnalyticalModel(analyticalModel); + analyticalModel.RemoveValue("CaseDescription"); } + analyticalModel = Create.AnalyticalModel_ByVentilation(analyticalModel, + function, + ach, + m3h, + factor, + setback, + description, + analyticalObjects); + index = Params.IndexOfOutputParam("CaseDescription"); if (index != -1) { - int index_Concatenate = Params.IndexOfInputParam("_concatenate_"); - bool concatenate = true; - if (index_Concatenate != -1) - { - dataAccess.GetData(index_Concatenate, ref concatenate); - } string caseDescription = string.Empty; - if (concatenate) - { - if (!Core.Query.TryGetValue(analyticalModel, "CaseDescription", out caseDescription)) - { - caseDescription = string.Empty; - } - } - - if (string.IsNullOrWhiteSpace(caseDescription)) + if (!Core.Query.TryGetValue(analyticalModel, "CaseDescription", out caseDescription)) { - caseDescription = "Case"; - } - else - { - caseDescription += "_"; - } - - string sufix = "ByVentilation_"; - if (!double.IsNaN(ach)) - { - sufix += string.Format("{0}ach", ach); - } - - if (m3h != 0) - { - sufix += string.Format("{0}m3h", m3h); - } - - if (factor != 0) - { - sufix += string.Format("F{0}", factor); + caseDescription = string.Empty; } - if (setback != 0) - { - sufix += string.Format("sb{0}", setback); - } - - string value = caseDescription + sufix; - - dataAccess.SetData(index, value); + dataAccess.SetData(index, caseDescription); } - if (!analyticalModel.TryGetValue(AnalyticalModelParameter.CaseDataCollection, out CaseDataCollection caseDataCollection)) - { - caseDataCollection = new CaseDataCollection(); - } - else - { - caseDataCollection = new CaseDataCollection(caseDataCollection); - } - - caseDataCollection.Add(new VentilationCaseData(ach)); - - analyticalModel?.SetValue(AnalyticalModelParameter.CaseDataCollection, caseDataCollection); - // Output index = Params.IndexOfOutputParam("CaseAModel"); if (index != -1) { dataAccess.SetData(index, analyticalModel); } + + //index = Params.IndexOfOutputParam("CaseDescription"); + //if (index != -1) + //{ + // int index_Concatenate = Params.IndexOfInputParam("_concatenate_"); + // bool concatenate = true; + // if (index_Concatenate != -1) + // { + // dataAccess.GetData(index_Concatenate, ref concatenate); + // } + + // string caseDescription = string.Empty; + // if (concatenate) + // { + // if (!Core.Query.TryGetValue(analyticalModel, "CaseDescription", out caseDescription)) + // { + // caseDescription = string.Empty; + // } + // } + + // if (string.IsNullOrWhiteSpace(caseDescription)) + // { + // caseDescription = "Case"; + // } + // else + // { + // caseDescription += "_"; + // } + + // string sufix = "ByVentilation_"; + // if (!double.IsNaN(ach)) + // { + // sufix += string.Format("{0}ach", ach); + // } + + // if (m3h != 0) + // { + // sufix += string.Format("{0}m3h", m3h); + // } + + // if (factor != 0) + // { + // sufix += string.Format("F{0}", factor); + // } + + // if (setback != 0) + // { + // sufix += string.Format("sb{0}", setback); + // } + + // string value = caseDescription + sufix; + + // dataAccess.SetData(index, value); + //} + + //if (!analyticalModel.TryGetValue(AnalyticalModelParameter.CaseDataCollection, out CaseDataCollection caseDataCollection)) + //{ + // caseDataCollection = new CaseDataCollection(); + //} + //else + //{ + // caseDataCollection = new CaseDataCollection(caseDataCollection); + //} + + //caseDataCollection.Add(new VentilationCaseData(ach)); + + //analyticalModel?.SetValue(AnalyticalModelParameter.CaseDataCollection, caseDataCollection); + + //// Output + //index = Params.IndexOfOutputParam("CaseAModel"); + //if (index != -1) + //{ + // dataAccess.SetData(index, analyticalModel); + //} } } } diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByWeather.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByWeather.cs index e99c493aa..ce7ab2199 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByWeather.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByWeather.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Parameters; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -196,71 +199,106 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetData(index, ref weatherData); } - // Apply weather to a copy when provided - if (weatherData != null) + int index_Concatenate = Params.IndexOfInputParam("_concatenate_"); + bool concatenate = true; + if (index_Concatenate != -1) + { + dataAccess.GetData(index_Concatenate, ref concatenate); + } + + if (!concatenate) { - analyticalModel = new AnalyticalModel(analyticalModel); // copy of the base model (original stays unchanged) - analyticalModel.SetValue(AnalyticalModelParameter.WeatherData, weatherData); + analyticalModel = new AnalyticalModel(analyticalModel); + analyticalModel.RemoveValue("CaseDescription"); } + analyticalModel = Create.AnalyticalModel_ByWeatherData(analyticalModel, weatherData); + index = Params.IndexOfOutputParam("CaseDescription"); if (index != -1) { - int index_Concatenate = Params.IndexOfInputParam("_concatenate_"); - bool concatenate = true; - if (index_Concatenate != -1) - { - dataAccess.GetData(index_Concatenate, ref concatenate); - } string caseDescription = string.Empty; - if (concatenate) - { - if (!Core.Query.TryGetValue(analyticalModel, "CaseDescription", out caseDescription)) - { - caseDescription = string.Empty; - } - } - - if (string.IsNullOrWhiteSpace(caseDescription)) - { - caseDescription = "Case"; - } - else + if (!Core.Query.TryGetValue(analyticalModel, "CaseDescription", out caseDescription)) { - caseDescription += "_"; + caseDescription = string.Empty; } - string sufix = "ByWeather_"; - if (!string.IsNullOrWhiteSpace(weatherData?.Name)) - { - sufix += weatherData.Name; - } - - string value = caseDescription + sufix; - - dataAccess.SetData(index, value); - } - - if (!analyticalModel.TryGetValue(AnalyticalModelParameter.CaseDataCollection, out CaseDataCollection caseDataCollection)) - { - caseDataCollection = new CaseDataCollection(); - } - else - { - caseDataCollection = new CaseDataCollection(caseDataCollection); + dataAccess.SetData(index, caseDescription); } - caseDataCollection.Add(new WeatherCaseData(weatherData?.Name)); - - analyticalModel?.SetValue(AnalyticalModelParameter.CaseDataCollection, caseDataCollection); - // Output index = Params.IndexOfOutputParam("CaseAModel"); if (index != -1) { dataAccess.SetData(index, analyticalModel); } + + //// Apply weather to a copy when provided + //if (weatherData != null) + //{ + // analyticalModel = new AnalyticalModel(analyticalModel); // copy of the base model (original stays unchanged) + // analyticalModel.SetValue(AnalyticalModelParameter.WeatherData, weatherData); + //} + + //index = Params.IndexOfOutputParam("CaseDescription"); + //if (index != -1) + //{ + // int index_Concatenate = Params.IndexOfInputParam("_concatenate_"); + // bool concatenate = true; + // if (index_Concatenate != -1) + // { + // dataAccess.GetData(index_Concatenate, ref concatenate); + // } + + // string caseDescription = string.Empty; + // if (concatenate) + // { + // if (!Core.Query.TryGetValue(analyticalModel, "CaseDescription", out caseDescription)) + // { + // caseDescription = string.Empty; + // } + // } + + // if (string.IsNullOrWhiteSpace(caseDescription)) + // { + // caseDescription = "Case"; + // } + // else + // { + // caseDescription += "_"; + // } + + // string sufix = "ByWeather_"; + // if (!string.IsNullOrWhiteSpace(weatherData?.Name)) + // { + // sufix += weatherData.Name; + // } + + // string value = caseDescription + sufix; + + // dataAccess.SetData(index, value); + //} + + //if (!analyticalModel.TryGetValue(AnalyticalModelParameter.CaseDataCollection, out CaseDataCollection caseDataCollection)) + //{ + // caseDataCollection = new CaseDataCollection(); + //} + //else + //{ + // caseDataCollection = new CaseDataCollection(caseDataCollection); + //} + + //caseDataCollection.Add(new WeatherCaseData(weatherData?.Name)); + + //analyticalModel?.SetValue(AnalyticalModelParameter.CaseDataCollection, caseDataCollection); + + //// Output + //index = Params.IndexOfOutputParam("CaseAModel"); + //if (index != -1) + //{ + // dataAccess.SetData(index, analyticalModel); + //} } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByWindowSize.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByWindowSize.cs index 8c4f8f3fe..83d5775d5 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByWindowSize.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateCaseByWindowSize.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Parameters; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -199,120 +202,155 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetData(index, ref apertureScaleFactor); } - // Resolve aperture list from model when not provided - if (apertures.Count == 0) - { - apertures = analyticalModel.GetApertures(); - } - else + int index_Concatenate = Params.IndexOfInputParam("_concatenate_"); + bool concatenate = true; + if (index_Concatenate != -1) { - // Clean input list and re-fetch from model to ensure consistency - for (int i = apertures.Count - 1; i >= 0; i--) - { - if (apertures[i] is null) - { - apertures.RemoveAt(i); - continue; - } - - Aperture aperture = analyticalModel.GetAperture(apertures[i].Guid, out Panel panel); - if (aperture is null) - { - apertures.RemoveAt(i); - continue; - } - - apertures[i] = new Aperture(aperture); - } + dataAccess.GetData(index_Concatenate, ref concatenate); } - // Apply scaling when we have targets and a valid factor - if (apertures != null && apertures.Count != 0 && !double.IsNaN(apertureScaleFactor)) + if (!concatenate) { - AdjacencyCluster adjacencyCluster = new(analyticalModel.AdjacencyCluster, true); - - foreach (Aperture aperture in apertures) - { - Aperture aperture_Temp = aperture.Rescale(apertureScaleFactor); - if (aperture_Temp is null) - { - continue; - } - - if (adjacencyCluster.GetAperture(aperture_Temp.Guid, out Panel panel_Temp) is null || panel_Temp is null) - { - continue; - } - - panel_Temp = Create.Panel(panel_Temp); - - panel_Temp.RemoveAperture(aperture_Temp.Guid); - panel_Temp.AddAperture(aperture_Temp); - - adjacencyCluster.AddObject(panel_Temp); - } - - analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster); + analyticalModel = new AnalyticalModel(analyticalModel); + analyticalModel.RemoveValue("CaseDescription"); } + analyticalModel = Create.AnalyticalModel_ByWindowSize(analyticalModel, apertureScaleFactor); + index = Params.IndexOfOutputParam("CaseDescription"); if (index != -1) { - int index_Concatenate = Params.IndexOfInputParam("_concatenate_"); - bool concatenate = true; - if (index_Concatenate != -1) - { - dataAccess.GetData(index_Concatenate, ref concatenate); - } string caseDescription = string.Empty; - if (concatenate) + if (!Core.Query.TryGetValue(analyticalModel, "CaseDescription", out caseDescription)) { - if (!Core.Query.TryGetValue(analyticalModel, "CaseDescription", out caseDescription)) - { - caseDescription = string.Empty; - } + caseDescription = string.Empty; } - if (string.IsNullOrWhiteSpace(caseDescription)) - { - caseDescription = "Case"; - } - else - { - caseDescription += "_"; - } - - string sufix = "ByWindowSize_"; - if (!double.IsNaN(apertureScaleFactor)) - { - sufix += apertureScaleFactor.ToString(); - } - - string value = caseDescription + sufix; - - dataAccess.SetData(index, value); + dataAccess.SetData(index, caseDescription); } - if (!analyticalModel.TryGetValue(AnalyticalModelParameter.CaseDataCollection, out CaseDataCollection caseDataCollection)) - { - caseDataCollection = new CaseDataCollection(); - } - else - { - caseDataCollection = new CaseDataCollection(caseDataCollection); - } - - caseDataCollection.Add(new WindowSizeCaseData(apertureScaleFactor)); - - analyticalModel?.SetValue(AnalyticalModelParameter.CaseDataCollection, caseDataCollection); - // Output index = Params.IndexOfOutputParam("CaseAModel"); if (index != -1) { dataAccess.SetData(index, analyticalModel); } + + //// Resolve aperture list from model when not provided + //if (apertures.Count == 0) + //{ + // apertures = analyticalModel.GetApertures(); + //} + //else + //{ + // // Clean input list and re-fetch from model to ensure consistency + // for (int i = apertures.Count - 1; i >= 0; i--) + // { + // if (apertures[i] is null) + // { + // apertures.RemoveAt(i); + // continue; + // } + + // Aperture aperture = analyticalModel.GetAperture(apertures[i].Guid, out Panel panel); + // if (aperture is null) + // { + // apertures.RemoveAt(i); + // continue; + // } + + // apertures[i] = new Aperture(aperture); + // } + //} + + //// Apply scaling when we have targets and a valid factor + //if (apertures != null && apertures.Count != 0 && !double.IsNaN(apertureScaleFactor)) + //{ + // AdjacencyCluster adjacencyCluster = new(analyticalModel.AdjacencyCluster, true); + + // foreach (Aperture aperture in apertures) + // { + // Aperture aperture_Temp = aperture.Rescale(apertureScaleFactor); + // if (aperture_Temp is null) + // { + // continue; + // } + + // if (adjacencyCluster.GetAperture(aperture_Temp.Guid, out Panel panel_Temp) is null || panel_Temp is null) + // { + // continue; + // } + + // panel_Temp = Create.Panel(panel_Temp); + + // panel_Temp.RemoveAperture(aperture_Temp.Guid); + // panel_Temp.AddAperture(aperture_Temp); + + // adjacencyCluster.AddObject(panel_Temp); + // } + + // analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster); + //} + + //index = Params.IndexOfOutputParam("CaseDescription"); + //if (index != -1) + //{ + // int index_Concatenate = Params.IndexOfInputParam("_concatenate_"); + // bool concatenate = true; + // if (index_Concatenate != -1) + // { + // dataAccess.GetData(index_Concatenate, ref concatenate); + // } + + // string caseDescription = string.Empty; + // if (concatenate) + // { + // if (!Core.Query.TryGetValue(analyticalModel, "CaseDescription", out caseDescription)) + // { + // caseDescription = string.Empty; + // } + // } + + // if (string.IsNullOrWhiteSpace(caseDescription)) + // { + // caseDescription = "Case"; + // } + // else + // { + // caseDescription += "_"; + // } + + // string sufix = "ByWindowSize_"; + // if (!double.IsNaN(apertureScaleFactor)) + // { + // sufix += apertureScaleFactor.ToString(); + // } + + // string value = caseDescription + sufix; + + // dataAccess.SetData(index, value); + //} + + //if (!analyticalModel.TryGetValue(AnalyticalModelParameter.CaseDataCollection, out CaseDataCollection caseDataCollection)) + //{ + // caseDataCollection = new CaseDataCollection(); + //} + //else + //{ + // caseDataCollection = new CaseDataCollection(caseDataCollection); + //} + + //caseDataCollection.Add(new WindowSizeCaseData(apertureScaleFactor)); + + //analyticalModel?.SetValue(AnalyticalModelParameter.CaseDataCollection, caseDataCollection); + + //// Output + //index = Params.IndexOfOutputParam("CaseAModel"); + //if (index != -1) + //{ + // dataAccess.SetData(index, analyticalModel); + //} } } } diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstruction.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstruction.cs index c2f0c1c82..c40fd818a 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstruction.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstruction.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalCreateConstruction : GH_SAMVariableOutputParameterComp /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -118,10 +121,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("construction"); - if(index != -1) + if (index != -1) { dataAccess.SetData(index, new GooConstruction(construction)); } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstructionLayersByMaterials.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstructionLayersByMaterials.cs index 6cb646928..82b317753 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstructionLayersByMaterials.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstructionLayersByMaterials.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalCreateConstructionLayersByMaterials : GH_SAMVariableOu /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -89,25 +92,25 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List thicknesses = new List(); index = Params.IndexOfInputParam("_thicknesses_"); - if(index != -1) + if (index != -1) { dataAccess.GetDataList(index, thicknesses); } - if(materials.Count != thicknesses.Count) + if (materials.Count != thicknesses.Count) { int count = thicknesses.Count; for (int i = 0; i < materials.Count - count; i++) { Material material = materials[i + count] as Material; - if(material == null) + if (material == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } double thickness = material.GetValue(Core.MaterialParameter.DefaultThickness); - if(double.IsNaN(thickness)) + if (double.IsNaN(thickness)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -140,7 +143,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("constructionLayers"); - if(index != -1) + if (index != -1) { dataAccess.SetDataList(index, constructionLayers?.ConvertAll(x => new GooConstructionLayer(x))); } @@ -153,4 +156,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstructionLayersByNames.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstructionLayersByNames.cs index a0e9bca02..b4a1b9ccf 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstructionLayersByNames.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstructionLayersByNames.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalCreateConstructionLayersByNames : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -41,7 +44,7 @@ public SAMAnalyticalCreateConstructionLayersByNames() protected override void RegisterInputParams(GH_InputParamManager inputParamManager) { int index = -1; - + inputParamManager.AddTextParameter("_names", "_names", "Contruction Layer Name", GH_ParamAccess.list); index = inputParamManager.AddNumberParameter("_thicknesses_", "_thicknesses_", "Contruction Layer Thicknesses [m]", GH_ParamAccess.list); inputParamManager[index].Optional = true; @@ -77,7 +80,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List thicknesses = new List(); dataAccess.GetDataList(1, thicknesses); - if(names.Count != thicknesses.Count) + if (names.Count != thicknesses.Count) { MaterialLibrary materialLibrary = null; dataAccess.GetData(2, ref materialLibrary); @@ -89,14 +92,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) for (int i = 0; i < names.Count - count; i++) { Material material = materialLibrary.GetObject(names[i + count]); - if(material == null) + if (material == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } double thickness = material.GetValue(Core.MaterialParameter.DefaultThickness); - if(double.IsNaN(thickness)) + if (double.IsNaN(thickness)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -115,10 +118,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List constructionLayers = Create.ConstructionLayers(objects); - if(constructionLayers != null) + if (constructionLayers != null) { double thickness = constructionLayers.ConvertAll(x => x.Thickness).Sum(); - if(thickness >= 1) + if (thickness >= 1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Thickness of construction layers exceed 1m"); return; @@ -128,4 +131,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(0, constructionLayers?.ConvertAll(x => new GooConstructionLayer(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstructionLibrary.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstructionLibrary.cs index 74b02b9b0..de7e8916f 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstructionLibrary.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstructionLibrary.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalCreateConstructionLibrary : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -78,4 +81,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooConstructionLibrary(result)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstructionManager.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstructionManager.cs index bb707a70e..4ec5433a0 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstructionManager.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstructionManager.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalCreateConstructionManager : GH_SAMVariableOutputParame /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -91,12 +94,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) ConstructionManager constructionManager = null; index = Params.IndexOfInputParam("constructionManager_"); - if(index != -1) + if (index != -1) { dataAccess.GetData(index, ref constructionManager); } - if(constructionManager == null) + if (constructionManager == null) { constructionManager = new ConstructionManager(); } @@ -128,7 +131,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(constructions != null && constructions.Count != 0) + if (constructions != null && constructions.Count != 0) { constructions?.ForEach(x => constructionManager.Add(x)); } @@ -187,18 +190,18 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) bool removeUnusedMaterials = false; index = Params.IndexOfInputParam("removeUnused_"); - if (index != -1 && dataAccess.GetData(index, ref removeUnusedMaterials)) + if (index != -1 && dataAccess.GetData(index, ref removeUnusedMaterials)) { - if(removeUnusedMaterials) + if (removeUnusedMaterials) { constructionManager.RemoveUnusedMaterials(); } } List names = Analytical.Query.MissingMaterialsNames(constructionManager); - if(names != null && names.Count != 0) + if (names != null && names.Count != 0) { - AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, string.Format("{0}: {1}", "ConstructionManager is missing following materials:" , string.Join(", ", names))); + AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, string.Format("{0}: {1}", "ConstructionManager is missing following materials:", string.Join(", ", names))); } index = Params.IndexOfOutputParam("constructionManager"); @@ -208,4 +211,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstructionManagerByPanelAperture.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstructionManagerByPanelAperture.cs index 5d391dd4e..2c56d9bc8 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstructionManagerByPanelAperture.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstructionManagerByPanelAperture.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalCreateConstructionManagerByPanelAperture : GH_SAMVaria /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -107,31 +110,31 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) MaterialLibrary materialLibrary = analyticalModel.MaterialLibrary; ConstructionManager constructionManager = new ConstructionManager(); - foreach(Panel panel in panels) + foreach (Panel panel in panels) { Construction construction = panel?.Construction; - if(construction == null) + if (construction == null) { continue; } List constructions = constructionManager.GetConstructions(construction.Name, TextComparisonType.Equals, true); - if(constructions != null && constructions.Count > 0) + if (constructions != null && constructions.Count > 0) { continue; } constructionManager.Add(construction); - IEnumerable materials = Analytical.Query.Materials(construction, materialLibrary); - if(materials == null) + IEnumerable materials = Analytical.Query.Materials(construction, materialLibrary); + if (materials == null) { continue; } - foreach(IMaterial material in materials) + foreach (IMaterial material in materials) { - if(constructionManager.GetMaterial(material.Name) == null) + if (constructionManager.GetMaterial(material.Name) == null) { constructionManager.Add(material); } @@ -139,7 +142,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { ApertureConstruction apertureConstruction = aperture?.ApertureConstruction; if (apertureConstruction == null) @@ -173,7 +176,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfOutputParam("constructionManager"); - if(index != -1) + if (index != -1) { dataAccess.SetData(index, new GooConstructionManager(constructionManager)); } @@ -192,4 +195,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstructionManagerByPanelType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstructionManagerByPanelType.cs index 4b94a8894..b37b8edf6 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstructionManagerByPanelType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateConstructionManagerByPanelType.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalCreateConstructionManagerByPanelType : GH_SAMVariableO /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -105,7 +108,7 @@ protected override GH_SAMParam[] Inputs gooApertureConstructionParam = new GooApertureConstructionParam() { Name = "windowInternal_", NickName = "windowInternal_", Description = "SAM Analytical ApertureConstruction for window internal", Access = GH_ParamAccess.item, Optional = true }; result.Add(new GH_SAMParam(gooApertureConstructionParam, ParamVisibility.Binding)); - GooSAMObjectParam sAMObjectParam = new GooSAMObjectParam() { Name = "materials_", NickName = "materials_", Description = "SAM Materials", Access = GH_ParamAccess.list, Optional = true}; + GooSAMObjectParam sAMObjectParam = new GooSAMObjectParam() { Name = "materials_", NickName = "materials_", Description = "SAM Materials", Access = GH_ParamAccess.list, Optional = true }; result.Add(new GH_SAMParam(sAMObjectParam, ParamVisibility.Binding)); return result.ToArray(); @@ -137,7 +140,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) ConstructionManager constructionManager = null; index = Params.IndexOfInputParam("constructionManager_"); - if(index != -1) + if (index != -1) { dataAccess.GetData(index, ref constructionManager); } @@ -149,7 +152,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) ApertureConstruction apertureConstruction = null; index = Params.IndexOfInputParam("ceiling_"); - if(index != -1 && dataAccess.GetData(index, ref construction) && construction != null) + if (index != -1 && dataAccess.GetData(index, ref construction) && construction != null) { constructionDictionary[PanelType.Ceiling] = construction; } @@ -262,7 +265,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (index != -1 && dataAccess.GetData(index, ref apertureConstruction) && apertureConstruction != null) { apertureConstruction = new ApertureConstruction(apertureConstruction, ApertureType.Window); - + apertureConstructionDictionary[new Tuple(PanelType.WallInternal, ApertureType.Window)] = apertureConstruction; } @@ -275,7 +278,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List materials = new List(); - if(sAMObjects != null) + if (sAMObjects != null) { foreach (ISAMObject sAMObject in sAMObjects) { @@ -294,7 +297,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(materials != null && materials.Count == 0) + if (materials != null && materials.Count == 0) { materials = null; } @@ -308,4 +311,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateDegreeOfActivityByTemperature.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateDegreeOfActivityByTemperature.cs index 4c9d3ca17..287598163 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateDegreeOfActivityByTemperature.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateDegreeOfActivityByTemperature.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -20,7 +23,7 @@ public class SAMAnalyticalCreateDegreeOfActivityByTemperature : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -38,7 +41,7 @@ public SAMAnalyticalCreateDegreeOfActivityByTemperature() protected override void RegisterInputParams(GH_InputParamManager inputParamManager) { int index; - + index = inputParamManager.AddTextParameter("_name_", "_name_", "Name ,default = Activity level", GH_ParamAccess.item, string.Empty); inputParamManager[index].Optional = true; @@ -105,4 +108,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooDegreeOfActivity(Create.DegreeOfActivity((ActivityLevel)activityLevel, name, temperature))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateDesignExplorer.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateDesignExplorer.cs index b75a210e7..02e5a5d3f 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateDesignExplorer.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateDesignExplorer.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Parameters; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -12,7 +15,7 @@ public class SAMAnalyticalCreateDesignExplorer : GH_SAMVariableOutputParameterCo /// /// Gets the unique ID for this component. Do not change this ID after release. /// - public override Guid ComponentGuid => new ("5324c64c-7cd4-4298-bcab-d780275c278a"); + public override Guid ComponentGuid => new("5324c64c-7cd4-4298-bcab-d780275c278a"); /// /// The latest version of this component @@ -45,7 +48,7 @@ protected override GH_SAMParam[] Inputs { List result = []; - GooAnalyticalModelParam analyticalModelParam = new () { Name = "_analyticalModels", NickName = "_analyticalModels", Description = "Analytical Models", Access = GH_ParamAccess.list }; + GooAnalyticalModelParam analyticalModelParam = new() { Name = "_analyticalModels", NickName = "_analyticalModels", Description = "Analytical Models", Access = GH_ParamAccess.list }; result.Add(new GH_SAMParam(analyticalModelParam, ParamVisibility.Binding)); Param_FilePath param_FilePath = new Param_FilePath @@ -105,7 +108,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List lines = Analytical.Convert.ToDesignExplorer(analyticalModels); - if(lines != null && !string.IsNullOrWhiteSpace(path)) + if (lines != null && !string.IsNullOrWhiteSpace(path)) { System.IO.File.WriteAllLines(path, lines); } @@ -117,4 +120,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateFeatureShade.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateFeatureShade.cs index bc3334107..a0cfebe82 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateFeatureShade.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateFeatureShade.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -11,7 +14,7 @@ public class SAMAnalyticalCreateFeatureShade : GH_SAMVariableOutputParameterComp /// /// Gets the unique ID for this component. Do not change this ID after release. /// - public override Guid ComponentGuid => new ("1cc59b32-082e-4967-b05c-b992cd3239d2"); + public override Guid ComponentGuid => new("1cc59b32-082e-4967-b05c-b992cd3239d2"); /// /// The latest version of this component @@ -21,7 +24,7 @@ public class SAMAnalyticalCreateFeatureShade : GH_SAMVariableOutputParameterComp /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -218,7 +221,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetData(index, ref overhangTransmittance); } - FeatureShade featureShade = new (name, description, surfaceHeight, surfaceWidth, leftFinDepth, leftFinOffset, leftFinTransmittance, rightFinDepth, rightFinOffset, rightFinTransmittance, overhangDepth, overhangOffset, overhangTransmittance); + FeatureShade featureShade = new(name, description, surfaceHeight, surfaceWidth, leftFinDepth, leftFinOffset, leftFinTransmittance, rightFinDepth, rightFinOffset, rightFinTransmittance, overhangDepth, overhangOffset, overhangTransmittance); index = Params.IndexOfOutputParam("featureShade"); if (index != -1) @@ -227,4 +230,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateGasMaterial.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateGasMaterial.cs index a907d9c5b..adcbe140b 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateGasMaterial.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateGasMaterial.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalCreateGasMaterial : GH_SAMVariableOutputParameterCompo /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -143,7 +146,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (index != -1) { double value = double.NaN; - if(dataAccess.GetData(index, ref value) && !double.IsNaN(value)) + if (dataAccess.GetData(index, ref value) && !double.IsNaN(value)) { defaultThickness = value; } @@ -216,11 +219,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("material"); - if(index != -1) + if (index != -1) { dataAccess.SetData(index, new GooMaterial(Create.GasMaterial(name, group, displayName, description, thermalConductivity, specificHeatCapacity, density, dynamicViscosity, defaultThickness, vapourDiffusionFactor, heatTransferCoefficient))); } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateIZAM.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateIZAM.cs index c6f5d9ec8..e9ac0ba70 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateIZAM.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateIZAM.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalCreateIZAM : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -61,7 +64,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_analyticalModel"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -91,4 +94,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateIZAMBySetPoint.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateIZAMBySetPoint.cs index 19c1c7680..d83ec7baa 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateIZAMBySetPoint.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateIZAMBySetPoint.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -24,7 +27,7 @@ public class SAMAnalyticalCreateIZAMBySetPoint : GH_SAMVariableOutputParameterCo /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -78,7 +81,7 @@ public SAMAnalyticalCreateIZAMBySetPoint() "Create IZAM AHU object to calculate Inter Zone Air Movement" + "\n Inter Zone Air Movements also know as IZAM’s are used to model air flow in and out of a zone. " + "IZAM’s can be set up to create an air flow that can come from outside or from another zone, " + - "it can also be set up to create an air flow from the zone to outside." + + "it can also be set up to create an air flow from the zone to outside." + "\nhttps://docs.edsl.net/tbd/CoreConcepts/IZAMs.html", "SAM", "Analytical") { @@ -89,7 +92,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_analytical"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -153,16 +156,16 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List densities = null; index = Params.IndexOfInputParam("_densities_"); - if(index != -1) + if (index != -1) { densities = new List(); - if(!dataAccess.GetDataList(index, densities)) + if (!dataAccess.GetDataList(index, densities)) { densities = null; } } - if(densities == null) + if (densities == null) { densities = new List() { FluidProperty.Air.Density }; } @@ -172,15 +175,15 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (sAMObject is AnalyticalModel || sAMObject is AdjacencyCluster) { AdjacencyCluster adjacencyCluster = null; - if(sAMObject is AnalyticalModel) + if (sAMObject is AnalyticalModel) adjacencyCluster = ((AnalyticalModel)sAMObject).AdjacencyCluster; - else if(sAMObject is AdjacencyCluster) + else if (sAMObject is AdjacencyCluster) adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)sAMObject); - if(adjacencyCluster != null) + if (adjacencyCluster != null) { AirHandlingUnit airHandlingUnit = adjacencyCluster.GetObjects()?.Find(x => x.Name == name); - if(airHandlingUnit == null) + if (airHandlingUnit == null) { airHandlingUnit = new AirHandlingUnit(name, temperatures.Average() - (temperatureRanges.Average() / 2), temperatures.Average() + (temperatureRanges.Average() / 2)); adjacencyCluster.AddObject(airHandlingUnit); @@ -251,4 +254,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateIZAMBySpaces.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateIZAMBySpaces.cs index 096b1aacd..dea60d001 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateIZAMBySpaces.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateIZAMBySpaces.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalCreateIZAMBySpaces : GH_SAMVariableOutputParameterComp /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -33,7 +36,7 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "SAM Analytical Model", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - + result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "_spaces", NickName = "_spaces", Description = "SAM Analytical Spaces", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooAnalyticalObjectParam() { Name = "_source", NickName = "_source", Description = "SAM Analytical Source such as AirHandlingUnit or iZAM AirHandlingUnitAirMovement", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); @@ -73,7 +76,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_analyticalModel"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -182,4 +185,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateInternalCondition.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateInternalCondition.cs index 23ca04b60..74cc41a39 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateInternalCondition.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateInternalCondition.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalCreateInternalCondition : GH_SAMVariableOutputParamete /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -45,7 +48,7 @@ protected override GH_SAMParam[] Inputs result.Add(new GH_SAMParam(new GooInternalConditionParam() { Name = "internalCondition_", NickName = "internalCondition_", Description = "Source SAM Analytical InternalCondition", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_String() { Name = "name_", NickName = "name_", Description = "Internal Condition Name", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "areaPerPerson_", NickName = "areaPerPerson_", Description = "Area Per Person, default 10 m2/person", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); - + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "occupancyProfile_", NickName = "occupancyProfile_", Description = "Occupancy Profile", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "occupancySensibleGainPerPerson_", NickName = "occupancySensibleGainPerPerson_", Description = "Occupancy Sensible Gain Per Person [W/p]", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "occupancyLatentGainPerPerson_", NickName = "occupancyLatentGainPerPerson_", Description = "Occupancy Latent Gain Per Person [W/p]", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); @@ -173,11 +176,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfInputParam("occupancyProfile_"); - if(index != -1) + if (index != -1) { Profile profile = null; string profileName = null; - if(dataAccess.GetData(index, ref profile)) + if (dataAccess.GetData(index, ref profile)) { profileName = profile.Name; } @@ -186,7 +189,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetData(index, ref profileName); } - if(!string.IsNullOrEmpty(profileName)) + if (!string.IsNullOrEmpty(profileName)) { internalCondition.SetValue(InternalConditionParameter.OccupancyProfileName, profileName); } @@ -631,7 +634,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (dataAccess.GetData(index, ref analyticalObject)) { NCMData nCMData = analyticalObject as NCMData; - if(nCMData != null) + if (nCMData != null) { internalCondition.SetValue(InternalConditionParameter.NCMData, nCMData); } @@ -648,11 +651,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfOutputParam("internalCondition"); - if(index != -1) + if (index != -1) { dataAccess.SetData(index, new GooInternalCondition(internalCondition)); } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateInternalConditionByProfiles.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateInternalConditionByProfiles.cs index d45d9a60e..3cb5ed51f 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateInternalConditionByProfiles.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateInternalConditionByProfiles.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalCreateInternalConditionByProfiles : GH_SAMVariableOutp /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -38,42 +41,42 @@ protected override GH_SAMParam[] Inputs List result = new List(); result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "SAM Analytical AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - GooSpaceParam gooSpaceParam = new GooSpaceParam() { Name = "_spaces", NickName = "_spaces", Description = "SAM Analytical Spaces. If not provided all Spaces from Analytical Model will be used and modified", Access = GH_ParamAccess.list}; + GooSpaceParam gooSpaceParam = new GooSpaceParam() { Name = "_spaces", NickName = "_spaces", Description = "SAM Analytical Spaces. If not provided all Spaces from Analytical Model will be used and modified", Access = GH_ParamAccess.list }; result.Add(new GH_SAMParam(gooSpaceParam, ParamVisibility.Binding)); global::Grasshopper.Kernel.Parameters.Param_String @string = new global::Grasshopper.Kernel.Parameters.Param_String() { Name = "ICname_", NickName = "ICname_", Description = "new Internal Condition Name to allow name change", Access = GH_ParamAccess.item, Optional = true }; result.Add(new GH_SAMParam(@string, ParamVisibility.Binding)); - GooProfileParam gooProfileParam = new GooProfileParam() { Name = "_gainProfile_", NickName = "_gainProfile_", Description = "SAM Analytical Profile for gains, in not provided default 24h profile: 8to18 profile will be used fro all gains", Access = GH_ParamAccess.item}; + GooProfileParam gooProfileParam = new GooProfileParam() { Name = "_gainProfile_", NickName = "_gainProfile_", Description = "SAM Analytical Profile for gains, in not provided default 24h profile: 8to18 profile will be used fro all gains", Access = GH_ParamAccess.item }; gooProfileParam.SetPersistentData(new GooProfile(profileLibrary.GetProfile("8to18", ProfileGroup.Gain, true))); result.Add(new GH_SAMParam(gooProfileParam, ParamVisibility.Binding)); - GooDegreeOfActivityParam gooDegreeOfActivityParam = new GooDegreeOfActivityParam() { Name = "_degreeOfActivity_", NickName = "_degreeOfActivity_", Description = "SAM Analytical DegreeOfActivity, default: 'Moderate office work' Sens=75 & Lat=55 W/person", Access = GH_ParamAccess.item}; + GooDegreeOfActivityParam gooDegreeOfActivityParam = new GooDegreeOfActivityParam() { Name = "_degreeOfActivity_", NickName = "_degreeOfActivity_", Description = "SAM Analytical DegreeOfActivity, default: 'Moderate office work' Sens=75 & Lat=55 W/person", Access = GH_ParamAccess.item }; gooDegreeOfActivityParam.SetPersistentData(new GooDegreeOfActivity(degreeOfActivityLibrary.GetDegreeOfActivities("Moderate office work").FirstOrDefault())); result.Add(new GH_SAMParam(gooDegreeOfActivityParam, ParamVisibility.Binding)); global::Grasshopper.Kernel.Parameters.Param_Number number = null; - number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_areaPerPerson_", NickName = "_areaPerPerson_", Description = "Area Per Person, default 10 m2/person", Access = GH_ParamAccess.item}; + number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_areaPerPerson_", NickName = "_areaPerPerson_", Description = "Area Per Person, default 10 m2/person", Access = GH_ParamAccess.item }; number.SetPersistentData(10); result.Add(new GH_SAMParam(number, ParamVisibility.Binding)); - number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_occupancy_", NickName = "_occupancy_", Description = "Occupancy(Number of People) will overide _areaPerPerson_ ", Access = GH_ParamAccess.item, Optional = true}; + number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_occupancy_", NickName = "_occupancy_", Description = "Occupancy(Number of People) will overide _areaPerPerson_ ", Access = GH_ParamAccess.item, Optional = true }; result.Add(new GH_SAMParam(number, ParamVisibility.Binding)); number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_lightingGainPerArea_", NickName = "_lightingGainPerArea_", Description = "Lighting Gain Per Area at specified profile, default 8 W/m2", Access = GH_ParamAccess.item, Optional = true }; number.SetPersistentData(8); result.Add(new GH_SAMParam(number, ParamVisibility.Binding)); - number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_lightingLevel_", NickName = "_lightingLevel_", Description = "Lighting Level", Access = GH_ParamAccess.item}; + number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_lightingLevel_", NickName = "_lightingLevel_", Description = "Lighting Level", Access = GH_ParamAccess.item }; number.SetPersistentData(500); result.Add(new GH_SAMParam(number, ParamVisibility.Binding)); - number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_equipmentSensGainPerArea_", NickName = "_equipmentSensGainPerArea_", Description = "Equipment Sensible Gain Per Area at specified profile, default 15 W/m2", Access = GH_ParamAccess.item}; + number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_equipmentSensGainPerArea_", NickName = "_equipmentSensGainPerArea_", Description = "Equipment Sensible Gain Per Area at specified profile, default 15 W/m2", Access = GH_ParamAccess.item }; number.SetPersistentData(15); result.Add(new GH_SAMParam(number, ParamVisibility.Binding)); - number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_equipmentLatGainPerArea_", NickName = "_equipmentLatGainPerArea_", Description = "Equipment Latent Gain Per Area at specified profile, default 0 W/m2", Access = GH_ParamAccess.item}; + number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_equipmentLatGainPerArea_", NickName = "_equipmentLatGainPerArea_", Description = "Equipment Latent Gain Per Area at specified profile, default 0 W/m2", Access = GH_ParamAccess.item }; number.SetPersistentData(0); result.Add(new GH_SAMParam(number, ParamVisibility.Binding)); @@ -83,19 +86,19 @@ protected override GH_SAMParam[] Inputs genericObject.SetPersistentData(21); result.Add(new GH_SAMParam(genericObject, ParamVisibility.Binding)); - genericObject = new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_coolingSetPoint_", NickName = "_coolingSetPoint_", Description = "Cooling SetPoint, default Constant 24 degC", Access = GH_ParamAccess.item}; + genericObject = new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_coolingSetPoint_", NickName = "_coolingSetPoint_", Description = "Cooling SetPoint, default Constant 24 degC", Access = GH_ParamAccess.item }; genericObject.SetPersistentData(24); result.Add(new GH_SAMParam(genericObject, ParamVisibility.Binding)); - genericObject = new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_humidificationSetPoint_", NickName = "_humidificationSetPoint_", Description = "Humidification SetPoint, default Constant 40%", Access = GH_ParamAccess.item}; + genericObject = new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_humidificationSetPoint_", NickName = "_humidificationSetPoint_", Description = "Humidification SetPoint, default Constant 40%", Access = GH_ParamAccess.item }; genericObject.SetPersistentData(40); result.Add(new GH_SAMParam(genericObject, ParamVisibility.Binding)); - genericObject = new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_dehumidificationSetPoint_", NickName = "_dehumidificationSetPoint_", Description = "Dehumidification SetPoint, default Constant 60%", Access = GH_ParamAccess.item}; + genericObject = new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_dehumidificationSetPoint_", NickName = "_dehumidificationSetPoint_", Description = "Dehumidification SetPoint, default Constant 60%", Access = GH_ParamAccess.item }; genericObject.SetPersistentData(60); result.Add(new GH_SAMParam(genericObject, ParamVisibility.Binding)); - number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "infiltrationACH_", NickName = "_infiltrationACH_", Description = "Infiltration, default Constant 0.2 ac/h for spaces with external Panels", Access = GH_ParamAccess.item, Optional = true}; + number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "infiltrationACH_", NickName = "_infiltrationACH_", Description = "Infiltration, default Constant 0.2 ac/h for spaces with external Panels", Access = GH_ParamAccess.item, Optional = true }; result.Add(new GH_SAMParam(number, ParamVisibility.Binding)); number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_pollutantGPerHrPerPerson_", NickName = "_pollutantGPerHrPerPerson_", Description = "Pollutant Generation Per Hour Per Person using Profile, default 37.5 g/hr/person see https://www.irbnet.de/daten/iconda/CIB6974.pdf]", Access = GH_ParamAccess.item }; @@ -111,7 +114,7 @@ protected override GH_SAMParam[] Outputs get { List result = new List(); - result.Add(new GH_SAMParam(new GooAnalyticalModelParam() {Name = "analyticalModel", NickName = "analyticalModel", Description = "SAM Analytical Model with ", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "analyticalModel", NickName = "analyticalModel", Description = "SAM Analytical Model with ", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooInternalConditionParam() { Name = "internalConditions", NickName = "internalConditions", Description = "SAM Analytical InternalConditions", Access = GH_ParamAccess.list }, ParamVisibility.Voluntary)); return result.ToArray(); } @@ -132,7 +135,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_analyticalModel"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -149,7 +152,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List spaces = null; index = Params.IndexOfInputParam("_spaces"); - if(index != -1) + if (index != -1) { spaces = new List(); dataAccess.GetDataList(index, spaces); @@ -211,7 +214,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) object value = objectWrapper.Value; if (value is IGH_Goo) { - value = (value as dynamic).Value; + value = (value as dynamic).Value; } if (value is double) @@ -311,7 +314,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) string name = null; index = Params.IndexOfInputParam("ICname_"); - if(index != -1) + if (index != -1) dataAccess.GetData(index, ref name); double pollutantGenerationPerPerson = double.NaN; @@ -324,12 +327,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) infiltration = 0; List panels = adjacencyCluster.GetPanels(); - if(panels != null && panels.Count != 0) + if (panels != null && panels.Count != 0) { - foreach(Panel panel in panels) + foreach (Panel panel in panels) { List spaces_Adjacent = adjacencyCluster.GetSpaces(panel); - if(spaces_Adjacent != null && spaces_Adjacent.Count == 1) + if (spaces_Adjacent != null && spaces_Adjacent.Count == 1) { infiltration = 0.2; break; @@ -339,12 +342,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } Profile profile_Infiltartion = null; - if(!double.IsNaN(infiltration) && infiltration != 0) + if (!double.IsNaN(infiltration) && infiltration != 0) { ProfileLibrary profileLibrary_Default = ActiveSetting.Setting.GetValue(AnalyticalSettingParameter.DefaultProfileLibrary); profile_Infiltartion = profileLibrary_Default.GetProfile("Constant", ProfileGroup.Gain, true); } - + ProfileLibrary profileLibrary = analyticalModel.ProfileLibrary; if (profile_Gain != null) @@ -367,7 +370,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List internalConditions = new List(); - foreach(Space space in spaces) + foreach (Space space in spaces) { if (space == null) continue; @@ -379,7 +382,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) space_Temp = new Space(space_Temp); InternalCondition internalCondition = space_Temp.InternalCondition; - if(internalCondition == null) + if (internalCondition == null) internalCondition = new InternalCondition(space_Temp.Name); if (!string.IsNullOrEmpty(name)) @@ -392,11 +395,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) internalCondition.SetValue(InternalConditionParameter.EquipmentSensibleProfileName, profile_Gain.Name); internalCondition.SetValue(InternalConditionParameter.EquipmentLatentProfileName, profile_Gain.Name); - if(!double.IsNaN(pollutantGenerationPerPerson)) + if (!double.IsNaN(pollutantGenerationPerPerson)) internalCondition.SetValue(InternalConditionParameter.PollutantProfileName, profile_Gain.Name); } - if(profile_Heating != null) + if (profile_Heating != null) internalCondition.SetValue(InternalConditionParameter.HeatingProfileName, profile_Heating.Name); if (profile_Cooling != null) @@ -408,7 +411,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (profile_Dehumidification != null) internalCondition.SetValue(InternalConditionParameter.DehumidificationProfileName, profile_Dehumidification.Name); - if(profile_Infiltartion != null) + if (profile_Infiltartion != null) internalCondition.SetValue(InternalConditionParameter.InfiltrationProfileName, profile_Infiltartion.Name); if (degreeOfActivity != null) @@ -459,7 +462,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("analyticalModel"); - if(index != -1) + if (index != -1) { analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster, analyticalModel.MaterialLibrary, profileLibrary); dataAccess.SetData(index, new GooAnalyticalModel(analyticalModel)); @@ -470,4 +473,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, internalConditions?.ConvertAll(x => new GooInternalCondition(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateLevels.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateLevels.cs index 04acc12db..ee7253751 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateLevels.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateLevels.cs @@ -1,13 +1,16 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; +using SAM.Architectural; +using SAM.Architectural.Grasshopper; using SAM.Core.Grasshopper; +using SAM.Geometry.Object.Spatial; +using SAM.Geometry.Spatial; using System; using System.Collections.Generic; -using SAM.Geometry.Spatial; -using SAM.Architectural.Grasshopper; -using SAM.Architectural; using System.Linq; -using SAM.Geometry.Object.Spatial; namespace SAM.Analytical.Grasshopper { @@ -26,7 +29,7 @@ public class SAMAnalyticalCreateLevels : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -182,7 +185,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("levels"); - if(index != -1) + if (index != -1) { List levels = elevations_Min.ToList().ConvertAll(x => Architectural.Create.Level(x)); levels.Sort((x, y) => x.Elevation.CompareTo(y.Elevation)); @@ -190,11 +193,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("topLevel"); - if(index != -1) + if (index != -1) { dataAccess.SetData(index, Architectural.Create.Level(Core.Query.Round(elevations_Max.ToList().Max(), tolerance))); } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateOpaqueMaterial.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateOpaqueMaterial.cs index 4c121e42e..52ef68656 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateOpaqueMaterial.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateOpaqueMaterial.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalCreateOpaqueMaterial : GH_SAMVariableOutputParameterCo /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -112,7 +115,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(opaqueMaterial == null) + if (opaqueMaterial == null) { opaqueMaterial = Create.OpaqueMaterial(name, null, null, null, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, false); } @@ -278,4 +281,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePanelBy3DGeometry.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePanelBy3DGeometry.cs index 4b681f17d..640c8bbc9 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePanelBy3DGeometry.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePanelBy3DGeometry.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using SAM.Geometry.Spatial; @@ -22,7 +25,7 @@ public class SAMAnalyticalCreatePanelBy3DGeometry : GH_SAMVariableOutputParamete /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -79,7 +82,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (index != -1) { string panelType_String = null; - if(dataAccess.GetData(index, ref panelType_String)) + if (dataAccess.GetData(index, ref panelType_String)) { panelType = Analytical.Query.PanelType(panelType_String); } @@ -109,19 +112,19 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) bool simplify = true; index = Params.IndexOfInputParam("simplify_"); - if(index != -1) + if (index != -1) { dataAccess.GetData(index, ref simplify); } List geometry3Ds = null; index = Params.IndexOfInputParam("3Dgeometry_"); - if(index != -1) + if (index != -1) { object @object = null; - if(dataAccess.GetData(index, ref @object)) + if (dataAccess.GetData(index, ref @object)) { - if(!Query.TryConvertToPanelGeometries(@object, out geometry3Ds, simplify)) + if (!Query.TryConvertToPanelGeometries(@object, out geometry3Ds, simplify)) { geometry3Ds = null; } @@ -137,28 +140,28 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List panels = null; - if(panel == null) + if (panel == null) { - if(geometry3Ds == null) + if (geometry3Ds == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid Data"); return; } PanelType panelType_Temp = PanelType.Undefined; - if(panelType != null && panelType.HasValue) + if (panelType != null && panelType.HasValue) { panelType_Temp = panelType.Value; } panels = Create.Panels(geometry3Ds, panelType_Temp, construction, minArea, tolerance); - if(panels != null && (panelType == null || !panelType.HasValue)) + if (panels != null && (panelType == null || !panelType.HasValue)) { for (int i = 0; i < panels.Count; i++) { panelType_Temp = Analytical.Query.PanelType(panels[i]?.GetFace3D()?.GetPlane()?.Normal); - if(panelType_Temp != PanelType.Undefined) + if (panelType_Temp != PanelType.Undefined) { panels[i] = Create.Panel(panels[i], panelType_Temp); } @@ -167,7 +170,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } else { - panels = new List { Create.Panel(Guid.NewGuid(), panel) }; + panels = new List { Create.Panel(Guid.NewGuid(), panel) }; } if (panels == null || panels.Count == 0) @@ -177,7 +180,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("panel"); - if(index != -1) + if (index != -1) { if (panels.Count == 1) { @@ -190,4 +193,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePanelByBottomAndHeight.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePanelByBottomAndHeight.cs index c0af8d3b7..492159be7 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePanelByBottomAndHeight.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePanelByBottomAndHeight.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -24,7 +27,7 @@ public class SAMAnalyticalCreatePanelByBottomAndHeight : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -111,9 +114,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetData(2, ref construction); double minElevation = double.NaN; - if(dataAccess.GetData(4, ref minElevation)) + if (dataAccess.GetData(4, ref minElevation)) { - for(int i =0; i < segmentable3Ds.Count; i++) + for (int i = 0; i < segmentable3Ds.Count; i++) { BoundingBox3D boundingBox3D = segmentable3Ds[i].GetBoundingBox(); @@ -126,4 +129,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(0, panels?.ConvertAll(x => new GooPanel(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePanelByPanels.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePanelByPanels.cs index 66faf4ab8..dbaff124e 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePanelByPanels.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePanelByPanels.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -25,7 +28,7 @@ public class SAMAnalyticalCreatePanelByPanels : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -122,7 +125,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (double.TryParse((string)@object, out value)) plane = Geometry.Spatial.Create.Plane(value); } - else if(@object is Architectural.Level) + else if (@object is Architectural.Level) { plane = Geometry.Spatial.Create.Plane(((Architectural.Level)@object).Elevation); } @@ -150,7 +153,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List panels_Upper = new List(); List panels_Lower = new List(); - foreach(Panel panel in panels) + foreach (Panel panel in panels) { if (panel == null) continue; @@ -162,7 +165,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (panels_Cut.Count == 0) panels_Cut.Add(panel); - foreach(Panel panel_Cut in panels_Cut) + foreach (Panel panel_Cut in panels_Cut) { Point3D point3D = panel_Cut.GetInternalPoint3D(); @@ -179,4 +182,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(2, panels_Lower.ConvertAll(x => new GooPanel(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePanelsByPlane.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePanelsByPlane.cs index 48ace2648..fd45bc3b7 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePanelsByPlane.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePanelsByPlane.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -24,7 +27,7 @@ public class SAMAnalyticalCreatePanelsByPlane : GH_SAMVariableOutputParameterCom /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -55,7 +58,7 @@ protected override GH_SAMParam[] Outputs get { List result = new List(); - result.Add(new GH_SAMParam(new GooPanelParam() {Name = "panels", NickName = "panels", Description = "SAM Analytical Panels", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooPanelParam() { Name = "panels", NickName = "panels", Description = "SAM Analytical Panels", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); return result.ToArray(); } } @@ -134,7 +137,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } List result = null; - if(sAMObject is AnalyticalModel || sAMObject is AdjacencyCluster) + if (sAMObject is AnalyticalModel || sAMObject is AdjacencyCluster) { result = Create.Panels(sAMObject as dynamic, plane, tolerance_Distance: tolerance); } @@ -144,4 +147,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, result); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePanelsByShell.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePanelsByShell.cs index 9ed508c24..a30ee7627 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePanelsByShell.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePanelsByShell.cs @@ -1,12 +1,15 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; +using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; +using SAM.Geometry.Spatial; using System; -using System.Linq; using System.Collections.Generic; -using Grasshopper.Kernel.Types; -using SAM.Geometry.Spatial; +using System.Linq; namespace SAM.Analytical.Grasshopper { @@ -25,7 +28,7 @@ public class SAMAnalyticalCreatePanelsByShell : GH_SAMVariableOutputParameterCom /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -103,7 +106,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (Geometry.Grasshopper.Query.TryGetSAMGeometries(objectWrapper, out List shells) && shells != null) shell = shells.FirstOrDefault(); - if(shell == null) + if (shell == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -141,4 +144,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePerimeterZones.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePerimeterZones.cs index 6eff01d44..7512c4023 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePerimeterZones.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePerimeterZones.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalCreatePerimeterZones : GH_SAMVariableOutputParameterCo /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -72,7 +75,7 @@ protected override GH_SAMParam[] Outputs { List result = new List(); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject { Name = "analytical", NickName = "analytical", Description = "SAM Analytical", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooGroupParam() { Name = "zones", NickName = "zones", Description = "SAM Analytical Zones", Access = GH_ParamAccess.list}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooGroupParam() { Name = "zones", NickName = "zones", Description = "SAM Analytical Zones", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); return result.ToArray(); } } @@ -96,7 +99,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } AdjacencyCluster adjacencyCluster = analyticalObject is AnalyticalModel ? ((AnalyticalModel)analyticalObject).AdjacencyCluster : analyticalObject as AdjacencyCluster; - if(adjacencyCluster != null) + if (adjacencyCluster != null) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster); } @@ -107,7 +110,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (index != -1) { double offset_Temp = double.NaN; - if(dataAccess.GetData(index, ref offset_Temp) && !double.IsNaN(offset_Temp)) + if (dataAccess.GetData(index, ref offset_Temp) && !double.IsNaN(offset_Temp)) { offset = offset_Temp; } @@ -126,7 +129,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List spaces = null; index = Params.IndexOfInputParam("spaces_"); - if(index != -1) + if (index != -1) { List spaces_Temp = new List(); @@ -155,42 +158,42 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List zones = null; - if(spaces != null) + if (spaces != null) { zones = new List(); foreach (Space space in spaces) { - Func func = new Func((Panel panel) => + Func func = new Func((Panel panel) => { - if(panel == null) + if (panel == null) { return 0; } - if(panels != null) + if (panels != null) { return panels.Find(x => x.Guid == panel.Guid) != null ? offset : 0; } - if(!adjacencyCluster.External(panel)) + if (!adjacencyCluster.External(panel)) { return 0; } List apertures = panel.Apertures; - if(apertures == null || apertures.Count == 0) + if (apertures == null || apertures.Count == 0) { return 0; } - return offset; + return offset; }); List spaces_Split = adjacencyCluster.SplitSpace(space.Guid, func, minSectionOffset: minOffset / 2); - if(spaces_Split == null || spaces_Split.Count < 2) + if (spaces_Split == null || spaces_Split.Count < 2) { continue; } @@ -198,7 +201,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) Zone zone = new Zone(space.Name); adjacencyCluster.AddObject(zone); - foreach(Space space_Split in spaces_Split) + foreach (Space space_Split in spaces_Split) { adjacencyCluster.AddRelation(zone, space_Split); } @@ -207,11 +210,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(analyticalObject is AnalyticalModel) + if (analyticalObject is AnalyticalModel) { analyticalObject = new AnalyticalModel((AnalyticalModel)analyticalObject, adjacencyCluster); } - else if(analyticalObject is AdjacencyCluster) + else if (analyticalObject is AdjacencyCluster) { analyticalObject = adjacencyCluster; } @@ -229,4 +232,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePerimeterZones_2.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePerimeterZones_2.cs index 30fdd716d..45efdc869 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePerimeterZones_2.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreatePerimeterZones_2.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalCreatePerimeterZones_2 : GH_SAMVariableOutputParameter /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -72,7 +75,7 @@ protected override GH_SAMParam[] Outputs { List result = new List(); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject { Name = "analytical", NickName = "analytical", Description = "SAM Analytical", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooGroupParam() { Name = "zones", NickName = "zones", Description = "SAM Analytical Zones", Access = GH_ParamAccess.list}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooGroupParam() { Name = "zones", NickName = "zones", Description = "SAM Analytical Zones", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); return result.ToArray(); } } @@ -96,7 +99,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } AdjacencyCluster adjacencyCluster = analyticalObject is AnalyticalModel ? ((AnalyticalModel)analyticalObject).AdjacencyCluster : analyticalObject as AdjacencyCluster; - if(adjacencyCluster != null) + if (adjacencyCluster != null) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster); } @@ -107,7 +110,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (index != -1) { double offset_Temp = double.NaN; - if(dataAccess.GetData(index, ref offset_Temp) && !double.IsNaN(offset_Temp)) + if (dataAccess.GetData(index, ref offset_Temp) && !double.IsNaN(offset_Temp)) { offset = offset_Temp; } @@ -126,7 +129,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List spaces = null; index = Params.IndexOfInputParam("spaces_"); - if(index != -1) + if (index != -1) { List spaces_Temp = new List(); @@ -155,42 +158,42 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List zones = null; - if(spaces != null) + if (spaces != null) { zones = new List(); foreach (Space space in spaces) { - Func func = new Func((Panel panel) => + Func func = new Func((Panel panel) => { - if(panel == null) + if (panel == null) { return 0; } - if(panels != null) + if (panels != null) { return panels.Find(x => x.Guid == panel.Guid) != null ? offset : 0; } - if(!adjacencyCluster.External(panel)) + if (!adjacencyCluster.External(panel)) { return 0; } List apertures = panel.Apertures; - if(apertures == null || apertures.Count == 0) + if (apertures == null || apertures.Count == 0) { return 0; } - return offset; + return offset; }); List spaces_Split = adjacencyCluster.SplitSpace_2(space.Guid, func, minSectionOffset: minOffset / 2, adjustmentOffset: minOffset); - if(spaces_Split == null || spaces_Split.Count < 2) + if (spaces_Split == null || spaces_Split.Count < 2) { continue; } @@ -198,7 +201,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) Zone zone = new Zone(space.Name); adjacencyCluster.AddObject(zone); - foreach(Space space_Split in spaces_Split) + foreach (Space space_Split in spaces_Split) { adjacencyCluster.AddRelation(zone, space_Split); } @@ -207,11 +210,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(analyticalObject is AnalyticalModel) + if (analyticalObject is AnalyticalModel) { analyticalObject = new AnalyticalModel((AnalyticalModel)analyticalObject, adjacencyCluster); } - else if(analyticalObject is AdjacencyCluster) + else if (analyticalObject is AdjacencyCluster) { analyticalObject = adjacencyCluster; } @@ -229,4 +232,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateProfileByBooleans.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateProfileByBooleans.cs index 4090f0bb9..28da38d58 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateProfileByBooleans.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateProfileByBooleans.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalCreateProfileByBooleans : GH_SAMVariableOutputParamete /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -41,7 +44,7 @@ protected override GH_SAMParam[] Outputs get { List result = new List(); - result.Add(new GH_SAMParam(new GooProfileParam() {Name = "profile", NickName = "profile", Description = "SAM Analytical Profile", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooProfileParam() { Name = "profile", NickName = "profile", Description = "SAM Analytical Profile", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooProfileParam() { Name = "reversedProfile", NickName = "profile", Description = "SAM Analytical Reversed Profile", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); return result.ToArray(); } @@ -62,7 +65,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_name"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -102,4 +105,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, new GooProfile(profile_Reversed)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateProfileByBooleansAndValues.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateProfileByBooleansAndValues.cs index 35cdb7efc..bb0bad22d 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateProfileByBooleansAndValues.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateProfileByBooleansAndValues.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalCreateProfileByBooleansAndValues : GH_SAMVariableOutpu /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -97,7 +100,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) string category = null; if (index != -1) { - if(!dataAccess.GetData(index, ref category)) + if (!dataAccess.GetData(index, ref category)) { category = null; } @@ -139,4 +142,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateProfileByProfiles.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateProfileByProfiles.cs index 7f595224a..0728698e9 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateProfileByProfiles.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateProfileByProfiles.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalCreateProfileByProfiles : GH_SAMVariableOutputParamete /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -34,7 +37,7 @@ protected override GH_SAMParam[] Inputs result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_String() { Name = "_name", NickName = "_name", Description = "Name of Profile", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_profiles", NickName = "_profiles", Description = "Names of the profiles or SAM Analytical Profiles to be used", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_String() { Name = "_typeOrGroup", NickName = "_typeOrGroup", Description = "SAM Analytical ProfileType or ProfileGroup", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add( new GH_SAMParam(new GooProfileLibraryParam() { Name = "_profileLibrary_", NickName = "_profileLibrary_", Description = "SAM Analytical ProfileLibrary", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); + result.Add(new GH_SAMParam(new GooProfileLibraryParam() { Name = "_profileLibrary_", NickName = "_profileLibrary_", Description = "SAM Analytical ProfileLibrary", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); return result.ToArray(); } } @@ -44,7 +47,7 @@ protected override GH_SAMParam[] Outputs get { List result = new List(); - result.Add(new GH_SAMParam(new GooProfileParam() {Name = "Profile", NickName = "Profile", Description = "SAM Analytical Profile", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooProfileParam() { Name = "Profile", NickName = "Profile", Description = "SAM Analytical Profile", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); return result.ToArray(); } } @@ -64,7 +67,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_name"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -108,14 +111,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) ProfileType profileType = ProfileType.Undefined; ProfileGroup profileGroup = ProfileGroup.Undefined; - if(!Core.Query.TryConvert(typeOrGroup, out profileType)) + if (!Core.Query.TryConvert(typeOrGroup, out profileType)) if (!Core.Query.TryConvert(typeOrGroup, out profileGroup)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } - if(profileType == ProfileType.Undefined && profileGroup == ProfileGroup.Undefined) + if (profileType == ProfileType.Undefined && profileGroup == ProfileGroup.Undefined) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -130,7 +133,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (profileLibrary == null) profileLibrary = ActiveSetting.Setting.GetValue(AnalyticalSettingParameter.DefaultProfileLibrary); - if(profileLibrary == null) + if (profileLibrary == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -138,27 +141,27 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List names = new List(); profileLibrary = new ProfileLibrary(profileLibrary); - foreach(GH_ObjectWrapper gH_ObjectWrapper in objectWrappers) + foreach (GH_ObjectWrapper gH_ObjectWrapper in objectWrappers) { object @object = gH_ObjectWrapper?.Value; if (@object == null) continue; - if(@object is GH_String) + if (@object is GH_String) { names.Add(((GH_String)@object).Value); } else if (gH_ObjectWrapper.Value is GooProfile) { - Profile profile_Temp =((GooProfile)gH_ObjectWrapper.Value).Value; + Profile profile_Temp = ((GooProfile)gH_ObjectWrapper.Value).Value; profileLibrary.Add(profile_Temp); names.Add(profile_Temp.Name); } - else if(@object is string) + else if (@object is string) { names.Add((string)@object); } - else if(gH_ObjectWrapper.Value is Profile) + else if (gH_ObjectWrapper.Value is Profile) { Profile profile_Temp = (Profile)gH_ObjectWrapper.Value; profileLibrary.Add(profile_Temp); @@ -166,7 +169,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(names == null || names.Count == 0) + if (names == null || names.Count == 0) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -183,4 +186,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, new GooProfile(profile)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateProfileByValues.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateProfileByValues.cs index 41d497c6c..6683fc9ac 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateProfileByValues.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateProfileByValues.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalCreateProfileByValues : GH_SAMVariableOutputParameterC /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -43,7 +46,7 @@ protected override GH_SAMParam[] Outputs get { List result = new List(); - result.Add(new GH_SAMParam(new GooProfileParam() {Name = "profile", NickName = "profile", Description = "SAM Analytical Profile", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooProfileParam() { Name = "profile", NickName = "profile", Description = "SAM Analytical Profile", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); return result.ToArray(); } } @@ -78,12 +81,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) Profile profile = null; index = Params.IndexOfInputParam("profile_"); - if(index != -1) + if (index != -1) { dataAccess.GetData(index, ref profile); } - if(profile == null) + if (profile == null) { profile = new Profile(name, ProfileGroup.Gain); } @@ -93,7 +96,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfInputParam("values_"); - if(index != -1) + if (index != -1) { List values = new List(); if (dataAccess.GetDataList(index, values) && values != null && values.Count != 0) @@ -113,7 +116,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) category = profileType.Text(); } - if(string.IsNullOrWhiteSpace( category)) + if (string.IsNullOrWhiteSpace(category)) { if (Core.Query.TryConvert(category, out ProfileGroup profileGroup)) { @@ -121,7 +124,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(!string.IsNullOrWhiteSpace(category)) + if (!string.IsNullOrWhiteSpace(category)) { profile = new Profile(Guid.NewGuid(), profile, category); } @@ -135,4 +138,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateProfileByWeatherYear.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateProfileByWeatherYear.cs index 188187237..6f7d8e3aa 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateProfileByWeatherYear.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateProfileByWeatherYear.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using SAM.Weather; @@ -22,7 +25,7 @@ public class SAMAnalyticalCreateProfileByWeatherYear : GH_SAMVariableOutputParam /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -42,7 +45,7 @@ protected override GH_SAMParam[] Outputs get { List result = new List(); - result.Add(new GH_SAMParam(new GooProfileParam() {Name = "profile", NickName = "profile", Description = "SAM Analytical Profile", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooProfileParam() { Name = "profile", NickName = "profile", Description = "SAM Analytical Profile", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); return result.ToArray(); } } @@ -62,7 +65,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_weatherYear"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -90,4 +93,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, new GooProfile(profile)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateShade.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateShade.cs index 5b35b8cda..f41034938 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateShade.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateShade.cs @@ -1,9 +1,9 @@ -using Grasshopper.Kernel; -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; -using SAM.Geometry.Planar; -using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -435,4 +435,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateShadeByFeatureShade.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateShadeByFeatureShade.cs index 145563eb9..899e784f7 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateShadeByFeatureShade.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateShadeByFeatureShade.cs @@ -1,9 +1,9 @@ -using Grasshopper.Kernel; -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; -using SAM.Geometry.Planar; -using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -263,4 +263,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateShells.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateShells.cs index 196ab289b..bf421f516 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateShells.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateShells.cs @@ -1,11 +1,14 @@ -using Grasshopper.Kernel; -using SAM.Core.Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; +using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; +using SAM.Core.Grasshopper; +using SAM.Geometry.Grasshopper; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; -using SAM.Geometry.Grasshopper; -using Grasshopper.Kernel.Types; namespace SAM.Analytical.Grasshopper { @@ -24,7 +27,7 @@ public class SAMAnalyticalCreateShells : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -119,28 +122,28 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List shells = Analytical.Query.Shells(panels, offset, Core.Tolerance.MacroDistance, tolerance); index = Params.IndexOfInputParam("_points_"); - if(index != -1) + if (index != -1) { List objectWrappers = new List(); - if(dataAccess.GetDataList(index, objectWrappers) && objectWrappers != null && objectWrappers.Count > 0) + if (dataAccess.GetDataList(index, objectWrappers) && objectWrappers != null && objectWrappers.Count > 0) { List point3Ds = new List(); foreach (GH_ObjectWrapper objectWrapper in objectWrappers) if (Geometry.Grasshopper.Query.TryGetSAMGeometries(objectWrapper, out List point3Ds_Temp) && point3Ds_Temp != null) point3Ds.AddRange(point3Ds_Temp); - if(point3Ds != null && point3Ds.Count != 0) + if (point3Ds != null && point3Ds.Count != 0) { bool duplicates = false; List shells_Temp = new List(); - foreach(Point3D point3D in point3Ds) + foreach (Point3D point3D in point3Ds) { List shells_InRange = shells.FindAll(x => x.InRange(point3D, tolerance) || x.Inside(point3D, tolerance: tolerance)); if (shells_InRange == null || shells_InRange.Count == 0) continue; - foreach(Shell shell in shells_InRange) - if(!shells_Temp.Contains(shell)) + foreach (Shell shell in shells_InRange) + if (!shells_Temp.Contains(shell)) { shells.Remove(shell); shells_Temp.Add(shell); @@ -153,7 +156,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) shells = shells_Temp; - if(duplicates) + if (duplicates) AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "There are multiple points enclosed in one shell"); } } @@ -165,4 +168,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, shells?.ConvertAll(x => new GooSAMGeometry(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateShellsByElevations.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateShellsByElevations.cs index b05e2fa7b..d0ca5306f 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateShellsByElevations.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateShellsByElevations.cs @@ -1,13 +1,16 @@ -using Grasshopper.Kernel; -using SAM.Core.Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; +using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; +using SAM.Core.Grasshopper; +using SAM.Geometry.Grasshopper; +using SAM.Geometry.Object.Spatial; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; -using SAM.Geometry.Grasshopper; -using Grasshopper.Kernel.Types; using System.Linq; -using SAM.Geometry.Object.Spatial; namespace SAM.Analytical.Grasshopper { @@ -26,7 +29,7 @@ public class SAMAnalyticalCreateShellsByElevations : GH_SAMVariableOutputParamet /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -125,10 +128,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) tolerance = tolerance_Temp; } - if(elevations == null || elevations.Count == 0) + if (elevations == null || elevations.Count == 0) { List panels_Horizontal = panels.FindAll(x => Geometry.Object.Spatial.Query.Horizontal(x, tolerance)); - + Dictionary> elevationDictionary = panels_Horizontal.ElevationDictionary(tolerance); elevations = elevationDictionary.Keys.ToList(); } @@ -136,28 +139,28 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List shells = Analytical.Query.Shells(panels, elevations, offset, 0.01, Core.Tolerance.MacroDistance, Core.Tolerance.MacroDistance, Core.Tolerance.MacroDistance, Core.Tolerance.Angle, tolerance); index = Params.IndexOfInputParam("_points_"); - if(index != -1) + if (index != -1) { List objectWrappers = new List(); - if(dataAccess.GetDataList(index, objectWrappers) && objectWrappers != null && objectWrappers.Count > 0) + if (dataAccess.GetDataList(index, objectWrappers) && objectWrappers != null && objectWrappers.Count > 0) { List point3Ds = new List(); foreach (GH_ObjectWrapper objectWrapper in objectWrappers) if (Geometry.Grasshopper.Query.TryGetSAMGeometries(objectWrapper, out List point3Ds_Temp) && point3Ds_Temp != null) point3Ds.AddRange(point3Ds_Temp); - if(point3Ds != null && point3Ds.Count != 0) + if (point3Ds != null && point3Ds.Count != 0) { bool duplicates = false; List shells_Temp = new List(); - foreach(Point3D point3D in point3Ds) + foreach (Point3D point3D in point3Ds) { List shells_InRange = shells.FindAll(x => x.InRange(point3D, tolerance) || x.Inside(point3D, tolerance: tolerance)); if (shells_InRange == null || shells_InRange.Count == 0) continue; - foreach(Shell shell in shells_InRange) - if(!shells_Temp.Contains(shell)) + foreach (Shell shell in shells_InRange) + if (!shells_Temp.Contains(shell)) { shells.Remove(shell); shells_Temp.Add(shell); @@ -170,7 +173,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) shells = shells_Temp; - if(duplicates) + if (duplicates) AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "There are multiple points enclosed in one shell"); } } @@ -182,4 +185,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, shells?.ConvertAll(x => new GooSAMGeometry(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateShellsByElevationsAndAuxiliaryElevations.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateShellsByElevationsAndAuxiliaryElevations.cs index ba4d91814..c9c0fb7c2 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateShellsByElevationsAndAuxiliaryElevations.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateShellsByElevationsAndAuxiliaryElevations.cs @@ -1,11 +1,14 @@ -using Grasshopper.Kernel; -using SAM.Core.Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; +using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; +using SAM.Core.Grasshopper; +using SAM.Geometry.Grasshopper; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; -using SAM.Geometry.Grasshopper; -using Grasshopper.Kernel.Types; namespace SAM.Analytical.Grasshopper { @@ -24,7 +27,7 @@ public class SAMAnalyticalCreateShellsByElevationsAndAuxiliaryElevations : GH_SA /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -136,28 +139,28 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List shells = Analytical.Query.Shells(panels, elevations, offsets, Core.Tolerance.MacroDistance, Core.Tolerance.MacroDistance, Core.Tolerance.Angle, tolerance); index = Params.IndexOfInputParam("_points_"); - if(index != -1) + if (index != -1) { List objectWrappers = new List(); - if(dataAccess.GetDataList(index, objectWrappers) && objectWrappers != null && objectWrappers.Count > 0) + if (dataAccess.GetDataList(index, objectWrappers) && objectWrappers != null && objectWrappers.Count > 0) { List point3Ds = new List(); foreach (GH_ObjectWrapper objectWrapper in objectWrappers) if (Geometry.Grasshopper.Query.TryGetSAMGeometries(objectWrapper, out List point3Ds_Temp) && point3Ds_Temp != null) point3Ds.AddRange(point3Ds_Temp); - if(point3Ds != null && point3Ds.Count != 0) + if (point3Ds != null && point3Ds.Count != 0) { bool duplicates = false; List shells_Temp = new List(); - foreach(Point3D point3D in point3Ds) + foreach (Point3D point3D in point3Ds) { List shells_InRange = shells.FindAll(x => x.InRange(point3D, tolerance) || x.Inside(point3D, tolerance: tolerance)); if (shells_InRange == null || shells_InRange.Count == 0) continue; - foreach(Shell shell in shells_InRange) - if(!shells_Temp.Contains(shell)) + foreach (Shell shell in shells_InRange) + if (!shells_Temp.Contains(shell)) { shells.Remove(shell); shells_Temp.Add(shell); @@ -170,7 +173,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) shells = shells_Temp; - if(duplicates) + if (duplicates) AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "There are multiple points enclosed in one shell"); } } @@ -182,4 +185,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, shells?.ConvertAll(x => new GooSAMGeometry(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateSpace.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateSpace.cs index 968523ad1..791f79437 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateSpace.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateSpace.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using SAM.Geometry; @@ -24,7 +27,7 @@ public class SAMAnalyticalCreateSpace : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -80,12 +83,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) Space space = null; index = Params.IndexOfInputParam("space_"); - if(index != -1) + if (index != -1) { dataAccess.GetData(index, ref space); } - if(space == null) + if (space == null) { space = new Space("Space_Default", new Point3D(0, 0, 0.75)); } @@ -111,7 +114,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) InternalCondition internalCondition = null; index = Params.IndexOfInputParam("internalCondition_"); - if(index != -1 && dataAccess.GetData(index, ref internalCondition)) + if (index != -1 && dataAccess.GetData(index, ref internalCondition)) { space.InternalCondition = internalCondition; } @@ -137,4 +140,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateTransparentMaterial.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateTransparentMaterial.cs index 817a6ca0e..520943036 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateTransparentMaterial.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateTransparentMaterial.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalCreateTransparentMaterial : GH_SAMVariableOutputParame /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -115,7 +118,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(transparentMaterial == null) + if (transparentMaterial == null) { transparentMaterial = Create.TransparentMaterial(name, null, null, null, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, false); } @@ -282,4 +285,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateZonesByValues.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateZonesByValues.cs index cf2764b78..6a99fb0d1 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateZonesByValues.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalCreateZonesByValues.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -24,7 +27,7 @@ public class SAMAnalyticalCreateZonesByValues : GH_SAMVariableOutputParameterCom /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -94,7 +97,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_analytical"); SAMObject sAMObject = null; - if(index == -1 || !dataAccess.GetData(index, ref sAMObject) || sAMObject == null) + if (index == -1 || !dataAccess.GetData(index, ref sAMObject) || sAMObject == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -116,7 +119,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } - for(int i =0; i < values.Count; i++) + for (int i = 0; i < values.Count; i++) { if (values[i] is IGH_Goo) { @@ -150,35 +153,35 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) zoneCategory = null; } - if(zoneType == ZoneType.Undefined && zoneCategory ==null) + if (zoneType == ZoneType.Undefined && zoneCategory == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } AdjacencyCluster adjacencyCluster = null; - if(sAMObject is AnalyticalModel) + if (sAMObject is AnalyticalModel) { AnalyticalModel analyticalModel = new AnalyticalModel((AnalyticalModel)sAMObject); adjacencyCluster = analyticalModel.AdjacencyCluster; } - else if(sAMObject is AdjacencyCluster) + else if (sAMObject is AdjacencyCluster) { adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)sAMObject); } - if(adjacencyCluster == null) + if (adjacencyCluster == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } List values_String = values.ConvertAll(x => x?.ToString().Trim()); - + List names = values_String.Distinct().ToList(); names.RemoveAll(x => string.IsNullOrWhiteSpace(x)); - if(zoneType != ZoneType.Undefined && string.IsNullOrWhiteSpace(zoneCategory)) + if (zoneType != ZoneType.Undefined && string.IsNullOrWhiteSpace(zoneCategory)) { zoneCategory = zoneType.Text(); } @@ -186,19 +189,19 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List zones_Result = new List(); foreach (string name_Temp in names) { - if(cleanSpacesByZoneCategory) + if (cleanSpacesByZoneCategory) { Zone zone_Temp = adjacencyCluster.GetZones()?.Find(x => x?.Name == name_Temp && x.GetValue(ZoneParameter.ZoneCategory) == zoneCategory); - if(zone_Temp != null) + if (zone_Temp != null) { adjacencyCluster.RemoveObject(zone_Temp.Guid); } } - + List indexes = values_String.IndexesOf(name_Temp); List spaces_Temp = indexes.ConvertAll(x => spaces[x]); Zone zone = Analytical.Modify.UpdateZone(adjacencyCluster, name_Temp, zoneCategory, spaces_Temp.ToArray()); - if(zone != null) + if (zone != null) { zones_Result.Add(zone); } @@ -222,4 +225,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, zones_Result); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDailyIndoorComfortTemperatures.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDailyIndoorComfortTemperatures.cs index 5fdb97310..18ce6d662 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDailyIndoorComfortTemperatures.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDailyIndoorComfortTemperatures.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using SAM.Weather; @@ -23,7 +26,7 @@ public class SAMAnalyticalDailyIndoorComfortTemperatures : GH_SAMVariableOutputP /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -106,7 +109,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } - if(!Core.Query.TryGetEnum(@string, out TM52BuildingCategory tM52BuildingCategory) || tM52BuildingCategory == TM52BuildingCategory.Undefined) + if (!Core.Query.TryGetEnum(@string, out TM52BuildingCategory tM52BuildingCategory) || tM52BuildingCategory == TM52BuildingCategory.Undefined) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -117,16 +120,16 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List runningMeanTemperatures = new List(); List dailyAverageTemperatures = new List(); - foreach(WeatherYear weatherYear in weatherData.WeatherYears) + foreach (WeatherYear weatherYear in weatherData.WeatherYears) { List dailyAverageTemperatures_Temp = weatherYear?.WeatherDays.ConvertAll(x => x.Average(WeatherDataType.DryBulbTemperature)); - if(dailyAverageTemperatures_Temp != null) + if (dailyAverageTemperatures_Temp != null) { dailyAverageTemperatures.AddRange(dailyAverageTemperatures_Temp); } - + List maxIndoorComfortTemperatures_Temp = Analytical.Query.MaxIndoorComfortTemperatures(weatherYear, tM52BuildingCategory); - if(maxIndoorComfortTemperatures_Temp != null) + if (maxIndoorComfortTemperatures_Temp != null) { maxIndoorComfortTemperatures.AddRange(maxIndoorComfortTemperatures_Temp); } @@ -138,20 +141,20 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } List runningMeanTemperatures_Temp = Weather.Query.RunningMeanDryBulbTemperatures(weatherYear); - if(runningMeanTemperatures_Temp != null) + if (runningMeanTemperatures_Temp != null) { runningMeanTemperatures.AddRange(runningMeanTemperatures_Temp); } } - if(dayOfYears != null && dayOfYears.Count != 0) + if (dayOfYears != null && dayOfYears.Count != 0) { List maxIndoorComfortTemperatures_Temp = new List(); List minIndoorComfortTemperatures_Temp = new List(); List runningMeanTemperatures_Temp = new List(); List dailyAverageTemperatures_Temp = new List(); - foreach(int dayOfYear in dayOfYears) + foreach (int dayOfYear in dayOfYears) { int boundedDayOfYear = Core.Query.BoundedIndex(dailyAverageTemperatures.Count, dayOfYear); @@ -192,4 +195,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDataTree.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDataTree.cs index 46b69eeaa..cdbd2a4ba 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDataTree.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDataTree.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using SAM.Analytical.Grasshopper.Properties; @@ -23,7 +26,7 @@ public class SAMAnalyticalDataTree : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -115,4 +118,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(1, spaces?.ConvertAll(x => new GooSpace(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDaylightFactor.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDaylightFactor.cs index a9790d0c1..da5543af6 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDaylightFactor.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDaylightFactor.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalDaylightFactor : GH_SAMVariableOutputParameterComponen /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -44,7 +47,7 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new GooAnalyticalObjectParam() { Name = "_analytical", NickName = "_analytical", Description = "SAM Analytical Object such as AnalyticalModel or AdjacencyCluster", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "_space", NickName = "_space", Description = "SAM Analytical Space", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "_space", NickName = "_space", Description = "SAM Analytical Space", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); return result.ToArray(); } } @@ -74,7 +77,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) IAnalyticalObject analyticalObject = null; index = Params.IndexOfInputParam("_analytical"); - if(index == -1 || !dataAccess.GetData(index, ref analyticalObject) || analyticalObject == null) + if (index == -1 || !dataAccess.GetData(index, ref analyticalObject) || analyticalObject == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -86,7 +89,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) else if (analyticalObject is AnalyticalModel) adjacencyCluster = ((AnalyticalModel)analyticalObject).AdjacencyCluster; - if(adjacencyCluster == null) + if (adjacencyCluster == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -106,4 +109,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, adjacencyCluster.DaylightFactor(space)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDefaultColorByPanelType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDefaultColorByPanelType.cs index 342848509..9295ddf40 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDefaultColorByPanelType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDefaultColorByPanelType.cs @@ -1,9 +1,12 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; +using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; using System.Collections.Generic; -using Grasshopper.Kernel.Types; namespace SAM.Analytical.Grasshopper { @@ -22,7 +25,7 @@ public class SAMAnalyticalDefaultColorByPanelType : GH_SAMVariableOutputParamete /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -77,7 +80,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) GH_ObjectWrapper objectWrapper = null; index = Params.IndexOfInputParam("_analytical"); - if(index == -1 || !dataAccess.GetData(index, ref objectWrapper) || objectWrapper == null) + if (index == -1 || !dataAccess.GetData(index, ref objectWrapper) || objectWrapper == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -100,9 +103,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { Aperture aperture = @object as Aperture; ApertureConstruction apertureConstruction = aperture.ApertureConstruction; - if(apertureConstruction != null) + if (apertureConstruction != null) { - switch(apertureConstruction.ApertureType) + switch (apertureConstruction.ApertureType) { case ApertureType.Window: color = Analytical.Query.Color(apertureConstruction.ApertureType, AperturePart.Pane); @@ -113,10 +116,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) break; } - + } } - else if(@object is string) + else if (@object is string) { PanelType panelType = Analytical.Query.PanelType((string)@object); if (panelType != PanelType.Undefined) @@ -149,4 +152,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, color); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDefaultConstructionManager.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDefaultConstructionManager.cs index b630a4e23..d248f78c4 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDefaultConstructionManager.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDefaultConstructionManager.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalDefaultConstructionManager : GH_SAMVariableOutputParam /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -74,4 +77,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, new GooConstructionManager(Analytical.Query.DefaultConstructionManager())); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDefaultGasType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDefaultGasType.cs index 0510389a7..c11f73be7 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDefaultGasType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDefaultGasType.cs @@ -1,4 +1,7 @@ -using SAM.Analytical.Grasshopper.Properties; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -19,7 +22,7 @@ public class SAMAnalyticalDefaultGasType : GH_SAMEnumComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Panel Type @@ -31,4 +34,4 @@ public SAMAnalyticalDefaultGasType() { } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDesignDays.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDesignDays.cs index 7a4c2b330..e7c46fe5b 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDesignDays.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDesignDays.cs @@ -1,10 +1,13 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; +using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; +using SAM.Weather; +using SAM.Weather.Grasshopper; using System; using System.Collections.Generic; -using SAM.Weather.Grasshopper; -using SAM.Analytical.Grasshopper.Properties; -using SAM.Weather; namespace SAM.Analytical.Grasshopper { @@ -23,7 +26,7 @@ public class SAMAnalyticalDesignDays : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -44,9 +47,9 @@ protected override GH_SAMParam[] Inputs GooWeatherDataParam gooWeatherData = new GooWeatherDataParam() { Name = "_weatherData", NickName = "_weatherData", Description = "SAM Weather WeatherData", Access = GH_ParamAccess.item, Optional = false }; result.Add(new GH_SAMParam(gooWeatherData, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "heatingDesignDayTemp_", NickName = "heatingDesignDayTemp_", Description = "Heating DesignDay Temperature", Access = GH_ParamAccess.item, Optional = true}, ParamVisibility.Voluntary)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "heatingDesignDayTemp_", NickName = "heatingDesignDayTemp_", Description = "Heating DesignDay Temperature", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "heatingDesignDayRelativeHumidity_", NickName = "heatingDesignDayRelativeHumidity_", Description = "Heating DesignDay Relative Humidity [%]", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "heatingDesignDayWindspeed_", NickName = "heatingDesignDayWindspeed_", Description = "Heating DesignDay Windspeed", Access = GH_ParamAccess.item, Optional = true}, ParamVisibility.Voluntary)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "heatingDesignDayWindspeed_", NickName = "heatingDesignDayWindspeed_", Description = "Heating DesignDay Windspeed", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); return result.ToArray(); } @@ -88,7 +91,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfOutputParam("weatherData"); - if(index != -1) + if (index != -1) { dataAccess.SetData(index, new GooWeatherData(weatherData)); } @@ -103,15 +106,15 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (index_HeatingDesignDay != -1) { DesignDay designDay = weatherData?.HeatingDesignDay(); - if(designDay != null) + if (designDay != null) { index = Params.IndexOfInputParam("heatingDesignDayTemp_"); - if(index != -1) + if (index != -1) { double temperature = double.NaN; - if(dataAccess.GetData(index, ref temperature) && !double.IsNaN(temperature)) + if (dataAccess.GetData(index, ref temperature) && !double.IsNaN(temperature)) { - for(int i=0; i < 24; i++) + for (int i = 0; i < 24; i++) { designDay[WeatherDataType.DryBulbTemperature, i] = temperature; } @@ -150,4 +153,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDuplicateConstructionByPanelType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDuplicateConstructionByPanelType.cs index dd5529f55..835f8e13b 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDuplicateConstructionByPanelType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalDuplicateConstructionByPanelType.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -41,7 +44,7 @@ public class SAMAnalyticalDuplicateConstructionByPanelType : GH_SAMVariableOutpu /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -91,17 +94,17 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } List constructions = new List(); - if(sAMObject is AdjacencyCluster) + if (sAMObject is AdjacencyCluster) { AdjacencyCluster adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)sAMObject); constructions = adjacencyCluster.SetConstructionsDefaultPanelType(true); sAMObject = adjacencyCluster; } - else if(sAMObject is AnalyticalModel) + else if (sAMObject is AnalyticalModel) { AnalyticalModel analyticalModel = new AnalyticalModel((AnalyticalModel)sAMObject); AdjacencyCluster adjacencyCluster = analyticalModel.AdjacencyCluster; - if(adjacencyCluster != null) + if (adjacencyCluster != null) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster); constructions = adjacencyCluster.SetConstructionsDefaultPanelType(true); @@ -120,4 +123,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, constructions?.ConvertAll(x => new GooConstruction(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalExtendExternalPanels.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalExtendExternalPanels.cs index 993eb61a9..b956ed27e 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalExtendExternalPanels.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalExtendExternalPanels.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -23,7 +26,7 @@ public class SAMAnalyticalExtendExternalPanels : GH_SAMVariableOutputParameterCo /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -93,7 +96,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_panels"); List panels = new List(); - if(index == -1 || !dataAccess.GetDataList(index, panels) || panels == null) + if (index == -1 || !dataAccess.GetDataList(index, panels) || panels == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Invalid Data"); return; @@ -116,7 +119,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) offset = 0.1; List elevations = new List(); - foreach(GH_ObjectWrapper objectWrapper_Elevation in objectWrapper_Elevations) + foreach (GH_ObjectWrapper objectWrapper_Elevation in objectWrapper_Elevations) { double elevation = double.NaN; @@ -140,7 +143,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) elevation = ((Architectural.Level)@object).Elevation; } - if(double.IsNaN(elevation)) + if (double.IsNaN(elevation)) { continue; } @@ -186,4 +189,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalExtendPanelByPanels.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalExtendPanelByPanels.cs index e4d3cb691..0a400e709 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalExtendPanelByPanels.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalExtendPanelByPanels.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -16,7 +19,7 @@ public class SAMAnalyticalExtendPanelByPanels : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override string LatestComponentVersion => "1.0.1"; @@ -82,4 +85,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(0, result?.ConvertAll(x => new GooPanel(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalExtendPanelByPlane.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalExtendPanelByPlane.cs index e6e9fff31..a90a54fbc 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalExtendPanelByPlane.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalExtendPanelByPlane.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Rhino.Geometry; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -17,7 +20,7 @@ public class SAMAnalyticalExtendPanelByPlane : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override string LatestComponentVersion => "1.0.0"; @@ -85,4 +88,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(0, result?.ConvertAll(x => new GooPanel(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalExtendPanels.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalExtendPanels.cs index 5c3187b90..82cd66cd3 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalExtendPanels.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalExtendPanels.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -23,7 +26,7 @@ public class SAMAnalyticalExtendPanels : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -88,7 +91,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_panels"); List panels = new List(); - if(index == -1 || !dataAccess.GetDataList(index, panels) || panels == null) + if (index == -1 || !dataAccess.GetDataList(index, panels) || panels == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Invalid Data"); return; @@ -158,4 +161,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalExternalPanels.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalExternalPanels.cs index fa3755ce7..e0fbd148d 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalExternalPanels.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalExternalPanels.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -23,7 +26,7 @@ public class SAMAnalyticalExternalPanels : GH_SAMVariableOutputParameterComponen /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -83,7 +86,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_panels"); List panels = new List(); - if(index == -1 || !dataAccess.GetDataList(index, panels) || panels == null) + if (index == -1 || !dataAccess.GetDataList(index, panels) || panels == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Invalid Data"); return; @@ -146,4 +149,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, externalPolygon3Ds); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalExternalVector3D.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalExternalVector3D.cs index ae0a1e145..d0ed89fdd 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalExternalVector3D.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalExternalVector3D.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -20,7 +23,7 @@ public class SAMAnalyticalExternalVector3D : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -82,4 +85,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, Analytical.Query.ExternalVector3D(adjacencyCluster, space, panel)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFiles.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFiles.cs index 6220ab764..b3f9936fc 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFiles.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFiles.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -24,7 +27,7 @@ public class SAMAnalyticalFiles : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -135,9 +138,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List ifc = []; List other = []; - foreach(string path in paths) + foreach (string path in paths) { - switch(System.IO.Path.GetExtension(path).ToUpper()) + switch (System.IO.Path.GetExtension(path).ToUpper()) { case ".SAM": sam.Add(path); @@ -246,7 +249,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) void Menu_GoToDirectory(object sender, EventArgs e) { int index_Directory = Params.IndexOfInputParam("_directory_"); - if(index_Directory == -1) + if (index_Directory == -1) { return; } @@ -265,7 +268,7 @@ void Menu_GoToDirectory(object sender, EventArgs e) return; } - if(!System.IO.Directory.Exists(directory)) + if (!System.IO.Directory.Exists(directory)) { return; } @@ -276,15 +279,15 @@ void Menu_GoToDirectory(object sender, EventArgs e) void Menu_SetDefaultDirectory(object sender, EventArgs e) { int index = Params.IndexOfInputParam("_directory_"); - if(index != -1) + if (index != -1) { var param = Params.Input[index] as GH_PersistentParam; param.ClearData(); param.PersistentData.ClearData(); param.PersistentData.Append(new GH_String(System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "SAMSimulation"))); - + ExpireSolution(true); } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFillFloorsAndRoofs.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFillFloorsAndRoofs.cs index 4df18f2c7..a52c10dd4 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFillFloorsAndRoofs.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFillFloorsAndRoofs.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalFillFloorsAndRoofs : GH_SAMVariableOutputParameterComp /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -115,4 +118,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, panels?.ConvertAll(x => new GooPanel(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilter.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilter.cs index 539d30518..91957e08d 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilter.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilter.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalFilter : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -61,7 +64,7 @@ protected override void RegisterOutputParams(GH_OutputParamManager outputParamMa protected override void SolveInstance(IGH_DataAccess dataAccess) { AdjacencyCluster adjacencyCluster = null; - if(!dataAccess.GetData(0, ref adjacencyCluster) || adjacencyCluster == null) + if (!dataAccess.GetData(0, ref adjacencyCluster) || adjacencyCluster == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -77,7 +80,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) AdjacencyCluster adjacencyCluster_New = new AdjacencyCluster(); List objects = new List(); - foreach(Space space in spaces) + foreach (Space space in spaces) { adjacencyCluster_New.AddObject(space); @@ -85,7 +88,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (relatedObjects == null || relatedObjects.Count == 0) continue; - foreach(IJSAMObject relatedObject in relatedObjects) + foreach (IJSAMObject relatedObject in relatedObjects) { if (!adjacencyCluster_New.AddObject(relatedObject)) continue; @@ -99,4 +102,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(1, objects); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByAzimuth.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByAzimuth.cs index ada53a180..9e40ac6d7 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByAzimuth.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByAzimuth.cs @@ -1,4 +1,6 @@ -using GH_IO.Serialization; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; @@ -8,7 +10,6 @@ using SAM.Geometry.Spatial; using System; using System.Collections.Generic; -using System.IO; namespace SAM.Analytical.Grasshopper { @@ -17,7 +18,7 @@ public class SAMAnalyticalFilterByAzimuth : GH_SAMVariableOutputParameterCompone /// /// Gets the unique ID for this component. Do not change this ID after release. /// - public override Guid ComponentGuid => new ("72b15a3c-6568-4a93-ac47-1e436c6a1535"); + public override Guid ComponentGuid => new("72b15a3c-6568-4a93-ac47-1e436c6a1535"); /// /// The latest version of this component @@ -27,7 +28,7 @@ public class SAMAnalyticalFilterByAzimuth : GH_SAMVariableOutputParameterCompone /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -37,7 +38,7 @@ protected override GH_SAMParam[] Inputs { List result = []; result.Add(new GH_SAMParam(new GooAnalyticalObjectParam() { Name = "_analyticalObjects", NickName = "_analyticalObjects", Description = "SAM Analytical Objects such as Panels or Apertures", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); - + // Azimuth intervals (4 sectors; North wraps 316→44) var azimuthsParam = new global::Grasshopper.Kernel.Parameters.Param_Interval() { @@ -62,7 +63,7 @@ protected override GH_SAMParam[] Inputs new Interval(135, 225), // South new Interval(226, 315)); //West result.Add(new GH_SAMParam(azimuthsParam, ParamVisibility.Binding)); - + global::Grasshopper.Kernel.Parameters.Param_Number number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_trueNorth_", NickName = "_trueNorth_", Description = "True north [0 - 359 deg] Clockwise", Access = GH_ParamAccess.item }; number.SetPersistentData(0.0); result.Add(new GH_SAMParam(number, ParamVisibility.Binding)); @@ -77,7 +78,7 @@ protected override GH_SAMParam[] Outputs { List result = []; result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Interval() { Name = "Azimuths", NickName = "Azimuths", Description = "Azimuths intervals", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); - + result.Add(new GH_SAMParam(new GooPanelParam() { Name = "Panels", NickName = "Panels", Description = "SAM Panels", Access = GH_ParamAccess.tree }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooApertureParam() { Name = "Apertures", NickName = "Apertures", Description = "SAM Apertures", Access = GH_ParamAccess.tree }, ParamVisibility.Binding)); @@ -117,7 +118,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_trueNorth_"); if (index != -1) { - if(!dataAccess.GetData(index, ref trueNorth)) + if (!dataAccess.GetData(index, ref trueNorth)) { trueNorth = 0.0; } @@ -125,17 +126,17 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List analyticalObjects = []; index = Params.IndexOfInputParam("_analyticalObjects"); - if(index == -1 || !dataAccess.GetDataList(index, analyticalObjects) || analyticalObjects == null || analyticalObjects.Count == 0) + if (index == -1 || !dataAccess.GetDataList(index, analyticalObjects) || analyticalObjects == null || analyticalObjects.Count == 0) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } List panels = []; - List apertures = []; - foreach(IAnalyticalObject analyticalObject in analyticalObjects) + List apertures = []; + foreach (IAnalyticalObject analyticalObject in analyticalObjects) { - if(analyticalObject is Panel panel) + if (analyticalObject is Panel panel) { panels.Add(panel); } @@ -143,28 +144,28 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { apertures.Add(aperture); } - else if(analyticalObject is AnalyticalModel analyticalModel) + else if (analyticalObject is AnalyticalModel analyticalModel) { panels = analyticalModel.GetPanels(); } - else if(analyticalObject is AdjacencyCluster adjacencyCluster) + else if (analyticalObject is AdjacencyCluster adjacencyCluster) { panels = adjacencyCluster.GetPanels(); } } - if(panels is not null && panels.Count != 0) + if (panels is not null && panels.Count != 0) { - foreach(Panel panel in panels) + foreach (Panel panel in panels) { if (!panel.HasApertures) { continue; } - if(panel.Apertures is List apertures_Temp) + if (panel.Apertures is List apertures_Temp) { - foreach(Aperture aperture in apertures_Temp) + foreach (Aperture aperture in apertures_Temp) { apertures.Add(aperture); } @@ -172,8 +173,8 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - DataTree dataTree_Panels = new (); - DataTree dataTree_Apertures = new (); + DataTree dataTree_Panels = new(); + DataTree dataTree_Apertures = new(); List panels_Horizontal = new(); List apertures_Horizontal = new(); @@ -182,9 +183,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) DataTree dataTree_Apertures_Tilted = new(); Vector3D referenceDirection = Vector3D.WorldY; - if(trueNorth != 0.0) + if (trueNorth != 0.0) { - referenceDirection = referenceDirection.Rotate(Geometry.Spatial.Plane.WorldXY, - trueNorth * System.Math.PI / 180.0); + referenceDirection = referenceDirection.Rotate(Geometry.Spatial.Plane.WorldXY, -trueNorth * System.Math.PI / 180.0); } Dictionary dictionary = IntervalDictionary(azimuths); @@ -197,7 +198,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } double tilt = Geometry.Spatial.Query.Tilt(closedPlanar3D); - if(Core.Query.AlmostEqual(tilt, 0, Core.Tolerance.MacroDistance) || Core.Query.AlmostEqual(tilt, 180, Core.Tolerance.MacroDistance)) + if (Core.Query.AlmostEqual(tilt, 0, Core.Tolerance.MacroDistance) || Core.Query.AlmostEqual(tilt, 180, Core.Tolerance.MacroDistance)) { panels_Horizontal.Add(panel); continue; @@ -209,7 +210,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) continue; } - if(!TryGetRatio(dictionary, azimuth, out int index_Temp) || index_Temp == -1) + if (!TryGetRatio(dictionary, azimuth, out int index_Temp) || index_Temp == -1) { continue; } @@ -234,7 +235,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } double azimuth = Geometry.Spatial.Query.Azimuth(closedPlanar3D, referenceDirection); - if(double.IsNaN(azimuth)) + if (double.IsNaN(azimuth)) { continue; } @@ -250,7 +251,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("Azimuths"); - if(index != -1) + if (index != -1) { dataAccess.SetDataList(index, azimuths); } @@ -343,4 +344,4 @@ private static double ClampTo360(double v) return (a >= 360.0) ? 359.0 : a; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByBoundaryType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByBoundaryType.cs index de3ea6d40..10f01c4cc 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByBoundaryType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByBoundaryType.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalFilterByBoundaryType : GH_SAMVariableOutputParameterCo /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -67,7 +70,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) SAMObject sAMObject = null; index = Params.IndexOfInputParam("_analytical"); - if(index == -1 || !dataAccess.GetData(index, ref sAMObject) || sAMObject == null) + if (index == -1 || !dataAccess.GetData(index, ref sAMObject) || sAMObject == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -87,7 +90,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (adjacencyCluster != null) { List panels = adjacencyCluster.GetPanels(); - if(panels != null) + if (panels != null) { foreach (Panel panel in panels) { @@ -108,7 +111,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - foreach(KeyValuePair> keyValuePair in dictionary) + foreach (KeyValuePair> keyValuePair in dictionary) { index = Params.IndexOfOutputParam(keyValuePair.Key.ToString()); if (index != -1) @@ -118,4 +121,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByElevation.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByElevation.cs index 6720d1001..f6ddb8f18 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByElevation.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByElevation.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalFilterByElevation : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -74,9 +77,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } List sAMObjects = new List(); - foreach(GH_ObjectWrapper objectWrapper in objectWrappers) + foreach (GH_ObjectWrapper objectWrapper in objectWrappers) { - if(objectWrapper?.Value is Core.SAMObject) + if (objectWrapper?.Value is Core.SAMObject) { sAMObjects.Add((Core.SAMObject)objectWrapper.Value); } @@ -102,19 +105,19 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { elevation = (double)@object; } - else if(@object is string) + else if (@object is string) { if (double.TryParse((string)@object, out double elevation_Temp)) elevation = elevation_Temp; } - else if(@object is Architectural.Level) + else if (@object is Architectural.Level) { elevation = ((Architectural.Level)@object).Elevation; } - else if(@object is Space) + else if (@object is Space) { Space space = (Space)@object; - if(space.Location != null) + if (space.Location != null) { elevation = space.Location.Z; } @@ -140,11 +143,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List spaces = new List(); foreach (Core.SAMObject sAMObject in sAMObjects) { - if(sAMObject is Panel) + if (sAMObject is Panel) { panels.Add((Panel)sAMObject); } - else if(sAMObject is Space) + else if (sAMObject is Space) { spaces.Add((Space)sAMObject); } @@ -170,4 +173,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(2, result_Lower); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByGeometry.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByGeometry.cs index 026fc1ec3..09a9524a9 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByGeometry.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByGeometry.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalFilterByGeometry : GH_SAMVariableOutputParameterCompon /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -51,7 +54,7 @@ protected override GH_SAMParam[] Inputs gooAnalyticalObjectParam.DataMapping = GH_DataMapping.Flatten; result.Add(new GH_SAMParam(gooAnalyticalObjectParam, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Brep() { Name = "_brep", NickName = "_brep", Description = "Brep", Access = GH_ParamAccess.item, Optional = true}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Brep() { Name = "_brep", NickName = "_brep", Description = "Brep", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); global::Grasshopper.Kernel.Parameters.Param_Boolean boolean = new global::Grasshopper.Kernel.Parameters.Param_Boolean() { Name = "_insideOnly_", NickName = "_insideOnly_", Description = "Inside Only\nif True only fully inside element will be return", Access = GH_ParamAccess.item }; boolean.SetPersistentData(true); @@ -60,8 +63,8 @@ protected override GH_SAMParam[] Inputs global::Grasshopper.Kernel.Parameters.Param_Number paramNumber = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_tolerance_", NickName = "_tolerance_", Description = "Tolerance", Access = GH_ParamAccess.item }; paramNumber.SetPersistentData(Tolerance.Distance); result.Add(new GH_SAMParam(paramNumber, ParamVisibility.Binding)); - - + + return result.ToArray(); } } @@ -128,7 +131,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } Geometry.Spatial.Shell shell = Geometry.Rhino.Convert.ToSAM_Shell(brep, true); - if(shell == null) + if (shell == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -138,24 +141,24 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List spaces = analyticalObjects.FindAll(x => x is Space).Cast().ToList(); List adjacencyClusters = new List(); - foreach(IAnalyticalObject analyticalObject in analyticalObjects) + foreach (IAnalyticalObject analyticalObject in analyticalObjects) { List panels_Temp = null; - if(analyticalObject is AdjacencyCluster) + if (analyticalObject is AdjacencyCluster) { panels_Temp = ((AdjacencyCluster)analyticalObject).GetPanels(); } - else if(analyticalObject is AnalyticalModel) + else if (analyticalObject is AnalyticalModel) { panels_Temp = ((AnalyticalModel)analyticalObject).GetPanels(); } - if(panels_Temp == null || panels_Temp.Count == 0) + if (panels_Temp == null || panels_Temp.Count == 0) { continue; } - if(panels == null) + if (panels == null) { panels = new List(); } @@ -193,4 +196,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByMaxRectangle3D.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByMaxRectangle3D.cs index 4a3c1bebb..42965bb44 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByMaxRectangle3D.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByMaxRectangle3D.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalFilterByMaxRectangle3D : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -87,9 +90,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List panels_In = new List(); List objects_Out = new List(); - - for(int i=0; i < panels.Count; i++) - { + + for (int i = 0; i < panels.Count; i++) + { Panel panel = Create.Panel(panels[i]); if (panel == null) { @@ -97,7 +100,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } Geometry.Spatial.Rectangle3D rectangle3D = Geometry.Object.Spatial.Query.MaxRectangle3D(panel); - if(rectangle3D == null || rectangle3D.Width < panelMinDimension || rectangle3D.Height < panelMinDimension) + if (rectangle3D == null || rectangle3D.Width < panelMinDimension || rectangle3D.Height < panelMinDimension) { objects_Out.Add(panel); } @@ -107,12 +110,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } List apertures = panel.Apertures; - if(apertures == null || apertures.Count == 0) + if (apertures == null || apertures.Count == 0) { continue; } - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { rectangle3D = Geometry.Object.Spatial.Query.MaxRectangle3D(aperture); if (rectangle3D == null || rectangle3D.Width < apertureMinDimension || rectangle3D.Height < apertureMinDimension) @@ -126,4 +129,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(1, objects_Out); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByPanelAreaAndThinnessRatio.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByPanelAreaAndThinnessRatio.cs index 59c81ec30..57878ebf9 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByPanelAreaAndThinnessRatio.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByPanelAreaAndThinnessRatio.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalFilterByPanelAreaAndThinnessRatio : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -64,7 +67,7 @@ protected override void RegisterOutputParams(GH_OutputParamManager outputParamMa protected override void SolveInstance(IGH_DataAccess dataAccess) { Core.SAMObject sAMObject = null; - if(!dataAccess.GetData(0, ref sAMObject) || sAMObject == null) + if (!dataAccess.GetData(0, ref sAMObject) || sAMObject == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -90,7 +93,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) adjacencyCluster = ((AnalyticalModel)sAMObject).AdjacencyCluster; panels = adjacencyCluster?.GetPanels(); } - else if(sAMObject is Panel) + else if (sAMObject is Panel) { panels = new List() { (Panel)sAMObject }; } @@ -133,7 +136,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { dataAccess.SetData(0, new GooAdjacencyCluster(adjacencyCluster)); } - else if(sAMObject is AnalyticalModel) + else if (sAMObject is AnalyticalModel) { dataAccess.SetData(0, new GooAnalyticalModel(new AnalyticalModel((AnalyticalModel)sAMObject, adjacencyCluster))); } @@ -146,4 +149,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(2, panels_Out?.ConvertAll(x => new GooPanel(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByPanelType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByPanelType.cs index daa75bfe2..c2a490c03 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByPanelType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByPanelType.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalFilterByPanelType : GH_SAMVariableOutputParameterCompo /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -67,7 +70,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List sAMObjects = new List(); index = Params.IndexOfInputParam("_analyticals"); - if(index == -1 || !dataAccess.GetDataList(index, sAMObjects) || sAMObjects == null || sAMObjects.Count == 0) + if (index == -1 || !dataAccess.GetDataList(index, sAMObjects) || sAMObjects == null || sAMObjects.Count == 0) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -75,38 +78,38 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List panels = new List(); - foreach(SAMObject sAMObject in sAMObjects) + foreach (SAMObject sAMObject in sAMObjects) { - if(sAMObject is Panel) + if (sAMObject is Panel) { panels.Add((Panel)sAMObject); } - else if(sAMObject is AnalyticalModel) + else if (sAMObject is AnalyticalModel) { panels = ((AnalyticalModel)sAMObject).GetPanels(); } - else if(sAMObject is AdjacencyCluster) + else if (sAMObject is AdjacencyCluster) { panels = ((AdjacencyCluster)sAMObject).GetPanels(); } } - if(panels == null) + if (panels == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } Dictionary> dictionary = new Dictionary>(); - foreach(Panel panel in panels) + foreach (Panel panel in panels) { - if(panel == null) + if (panel == null) { continue; } PanelType panelType = panel.PanelType; - if(!dictionary.TryGetValue(panelType, out List panels_PanelType)) + if (!dictionary.TryGetValue(panelType, out List panels_PanelType)) { panels_PanelType = new List(); dictionary[panelType] = panels_PanelType; @@ -115,7 +118,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) panels_PanelType.Add(panel); } - foreach(KeyValuePair> keyValuePair in dictionary) + foreach (KeyValuePair> keyValuePair in dictionary) { index = Params.IndexOfOutputParam(keyValuePair.Key.ToString()); if (index != -1) @@ -125,4 +128,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByPoints.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByPoints.cs index 9b0e714e8..4aa2fcc68 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByPoints.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterByPoints.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -16,7 +19,7 @@ public class SAMAnalyticalFilterByPoints : GH_SAMVariableOutputParameterComponen /// /// Gets the unique ID for this component. Do not change this ID after release. /// - public override Guid ComponentGuid => new ("be65e704-b18c-4f31-a322-de789d49ba69"); + public override Guid ComponentGuid => new("be65e704-b18c-4f31-a322-de789d49ba69"); /// /// The latest version of this component @@ -26,7 +29,7 @@ public class SAMAnalyticalFilterByPoints : GH_SAMVariableOutputParameterComponen /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -50,17 +53,17 @@ protected override GH_SAMParam[] Inputs { List result = []; - GooAnalyticalObjectParam gooAnalyticalObjectParam = new () { Name = "_analyticals", NickName = "_analyticals", Description = "SAM Analytical Object \nAnalytical Model, Adjacency Cluster, Panels or Apertures", Access = GH_ParamAccess.list }; + GooAnalyticalObjectParam gooAnalyticalObjectParam = new() { Name = "_analyticals", NickName = "_analyticals", Description = "SAM Analytical Object \nAnalytical Model, Adjacency Cluster, Panels or Apertures", Access = GH_ParamAccess.list }; gooAnalyticalObjectParam.DataMapping = GH_DataMapping.Flatten; result.Add(new GH_SAMParam(gooAnalyticalObjectParam, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Point() { Name = "_points", NickName = "_points", Description = "Points", Access = GH_ParamAccess.list, Optional = true }, ParamVisibility.Binding)); - global::Grasshopper.Kernel.Parameters.Param_Number paramNumber = new () { Name = "_tolerance_", NickName = "_tolerance_", Description = "Tolerance", Access = GH_ParamAccess.item }; + global::Grasshopper.Kernel.Parameters.Param_Number paramNumber = new() { Name = "_tolerance_", NickName = "_tolerance_", Description = "Tolerance", Access = GH_ParamAccess.item }; paramNumber.SetPersistentData(Tolerance.Distance); result.Add(new GH_SAMParam(paramNumber, ParamVisibility.Binding)); - - + + return [.. result]; } } @@ -73,13 +76,13 @@ protected override GH_SAMParam[] Outputs get { List result = []; - + result.Add(new GH_SAMParam(new GooAnalyticalObjectParam() { Name = "Panels_In", NickName = "Panels_In", Description = "SAM Analytical Panels In", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooAnalyticalObjectParam() { Name = "Panels_Out", NickName = "Panels_Out", Description = "SAM Analytical Panels Out", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); - + result.Add(new GH_SAMParam(new GooAnalyticalObjectParam() { Name = "Apertures_In", NickName = "Apertures_In", Description = "SAM Analytical Apertures In", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooAnalyticalObjectParam() { Name = "Apertures_Out", NickName = "Apertures_Out", Description = "SAM Analytical Apertures Out", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); - + return [.. result]; } } @@ -132,7 +135,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List apertures = [.. analyticalObjects.FindAll(x => x is Aperture).Cast()]; List adjacencyClusters = []; - foreach(IAnalyticalObject analyticalObject in analyticalObjects) + foreach (IAnalyticalObject analyticalObject in analyticalObjects) { List panels_Temp = null; List apertures_Temp = null; @@ -141,13 +144,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) panels_Temp = adjacencyCluster_Temp.GetPanels(); apertures_Temp = adjacencyCluster_Temp.GetApertures(); } - else if(analyticalObject is AnalyticalModel analyticalModel) + else if (analyticalObject is AnalyticalModel analyticalModel) { panels_Temp = analyticalModel.GetPanels(); apertures_Temp = analyticalModel.GetApertures(x => true); } - if(panels_Temp != null && panels_Temp.Count != 0) + if (panels_Temp != null && panels_Temp.Count != 0) { panels.AddRange(panels_Temp); } @@ -163,10 +166,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) tuples_Panel.RemoveAll(x => x.Item2 == null); Dictionary dictionary_Panel = []; - foreach(GH_Point point in points) + foreach (GH_Point point in points) { Point3D point3D = point?.Value.ToSAM(); - if(point3D == null) + if (point3D == null) { continue; } @@ -230,4 +233,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterBySpaces.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterBySpaces.cs index b567bb143..798510d63 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterBySpaces.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFilterBySpaces.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalFilterBySpaces : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -59,18 +62,18 @@ protected override void RegisterOutputParams(GH_OutputParamManager outputParamMa protected override void SolveInstance(IGH_DataAccess dataAccess) { IAnalyticalObject analyticalObject = null; - if(!dataAccess.GetData(0, ref analyticalObject) || analyticalObject == null) + if (!dataAccess.GetData(0, ref analyticalObject) || analyticalObject == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } AdjacencyCluster adjacencyCluster = null; - if(analyticalObject is AdjacencyCluster) + if (analyticalObject is AdjacencyCluster) { adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)analyticalObject); } - else if(analyticalObject is AnalyticalModel) + else if (analyticalObject is AnalyticalModel) { adjacencyCluster = ((AnalyticalModel)analyticalObject).AdjacencyCluster; } @@ -82,14 +85,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } - if(adjacencyCluster != null) + if (adjacencyCluster != null) { adjacencyCluster = adjacencyCluster.Filter(spaces); - if(analyticalObject is AdjacencyCluster) + if (analyticalObject is AdjacencyCluster) { analyticalObject = adjacencyCluster; } - else if(analyticalObject is AnalyticalModel) + else if (analyticalObject is AnalyticalModel) { analyticalObject = new AnalyticalModel((AnalyticalModel)analyticalObject, adjacencyCluster); } @@ -98,4 +101,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooAnalyticalObject(analyticalObject)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFixAdjacencyCluster.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFixAdjacencyCluster.cs index 5fad80b96..7ec3364f6 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFixAdjacencyCluster.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFixAdjacencyCluster.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalFixAdjacencyCluster : GH_SAMVariableOutputParameterCom /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -105,4 +108,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, apertures?.ConvertAll(x => new GooAperture(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFixNames.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFixNames.cs index 9d4e0e0fa..3adb0f9c1 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFixNames.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFixNames.cs @@ -1,4 +1,7 @@ -using GH_IO.Serialization; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using GH_IO.Serialization; using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -24,7 +27,7 @@ public class SAMAnalyticalFixNames : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -98,7 +101,7 @@ protected override GH_SAMParam[] Outputs { List result = new List(); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "Analytical", NickName = "Analytical", Description = "SAM Analytical AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - + return result.ToArray(); } } @@ -115,31 +118,31 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_analytical"); SAMObject sAMObject = null; - if(index == -1 || !dataAccess.GetData(index, ref sAMObject) || sAMObject == null) + if (index == -1 || !dataAccess.GetData(index, ref sAMObject) || sAMObject == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } - if(string.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Please select language to fix"); } else { - if(sAMObject is AnalyticalModel || sAMObject is AdjacencyCluster) + if (sAMObject is AnalyticalModel || sAMObject is AdjacencyCluster) { AdjacencyCluster adjacencyCluster = null; if (sAMObject is AnalyticalModel) adjacencyCluster = ((AnalyticalModel)sAMObject).AdjacencyCluster; - else if(sAMObject is AdjacencyCluster) + else if (sAMObject is AdjacencyCluster) adjacencyCluster = (AdjacencyCluster)sAMObject; if (adjacencyCluster != null) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster); List panels = adjacencyCluster.GetPanels(); - if(panels != null) + if (panels != null) { foreach (Panel panel in panels) { @@ -170,7 +173,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { foreach (Space space in spaces) { - if(space?.InternalCondition == null) + if (space?.InternalCondition == null) { continue; } @@ -193,13 +196,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) sAMObject = adjacencyCluster; else if (sAMObject is AnalyticalModel) sAMObject = new AnalyticalModel((AnalyticalModel)sAMObject, adjacencyCluster); - + } - else if(sAMObject is Panel) + else if (sAMObject is Panel) { sAMObject = Analytical.Query.ReplaceNameSpecialCharacters((Panel)sAMObject, name); } - else if(sAMObject is Space) + else if (sAMObject is Space) { sAMObject = Analytical.Query.ReplaceNameSpecialCharacters((Space)sAMObject, name); } @@ -222,4 +225,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, sAMObject); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFlipPanel.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFlipPanel.cs index 963c9c8c7..028bfc133 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFlipPanel.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalFlipPanel.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -20,7 +23,7 @@ public class SAMAnalyticalFlipPanel : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -73,4 +76,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooPanel(panel)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGeometry.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGeometry.cs index b7be38a61..95553144e 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGeometry.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGeometry.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -23,7 +26,7 @@ public class SAMAnalyticalGeometry : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -70,7 +73,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } bool cutApertures = false; - if(!dataAccess.GetData(1, ref cutApertures)) + if (!dataAccess.GetData(1, ref cutApertures)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -104,14 +107,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { result.Add(((PlanarBoundary3D)sAMObject).ToGrasshopper()); } - else if(sAMObject is Space) + else if (sAMObject is Space) { result.Add(((Space)sAMObject).ToGrasshopper()); } else if (sAMObject is AdjacencyCluster) { List breps = ((AdjacencyCluster)sAMObject).ToGrasshopper(cutApertures, includeFrame, tolerance); - if(breps != null) + if (breps != null) result.AddRange(breps); } @@ -125,4 +128,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(0, result); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetAdjacentSpaceNames.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetAdjacentSpaceNames.cs index 6b3bca1df..5bfb6a209 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetAdjacentSpaceNames.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetAdjacentSpaceNames.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using SAM.Analytical.Grasshopper.Properties; @@ -24,7 +27,7 @@ public class SAMAnalyticalGetAdjacentSpaceNames : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -67,7 +70,7 @@ protected override void RegisterOutputParams(GH_OutputParamManager outputParamMa protected override void SolveInstance(IGH_DataAccess dataAccess) { SAMObject sAMObject = null; - if(!dataAccess.GetData(0, ref sAMObject) || sAMObject == null) + if (!dataAccess.GetData(0, ref sAMObject) || sAMObject == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -89,7 +92,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetDataList(1, panels); List panels_Temp = adjacencyCluster.GetPanels(); - if(panels != null && panels.Count != 0) + if (panels != null && panels.Count != 0) { List guids = panels.ConvertAll(x => x.Guid); panels_Temp.RemoveAll(x => !guids.Contains(x.Guid)); @@ -111,4 +114,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataTree(1, dataTree_Names); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetApertures.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetApertures.cs index 4cdd5f953..e07e8626b 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetApertures.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetApertures.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using Grasshopper.Kernel.Types; @@ -25,7 +28,7 @@ public class SAMAnalyticalGetApertures : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -48,7 +51,7 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_analytical", NickName = "_analytical", Description = "SAM Analytical Object such as AdjacencyCluster or AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject { Name = "_objects", NickName = "_objects", Description = "Objects such as Point, SAM Analytical Construction, Aperture etc.", Access = GH_ParamAccess.list}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject { Name = "_objects", NickName = "_objects", Description = "Objects such as Point, SAM Analytical Construction, Aperture etc.", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); return result.ToArray(); } @@ -78,14 +81,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index = -1; index = Params.IndexOfInputParam("_analytical"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } - + SAMObject sAMObject_Temp = null; - if(!dataAccess.GetData(index, ref sAMObject_Temp) || sAMObject_Temp == null) + if (!dataAccess.GetData(index, ref sAMObject_Temp) || sAMObject_Temp == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -103,16 +106,16 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) analyticalModel = (AnalyticalModel)sAMObject_Temp; adjacencyCluster = analyticalModel.AdjacencyCluster; } - - if(adjacencyCluster == null) + + if (adjacencyCluster == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } index = Params.IndexOfInputParam("_objects"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -128,7 +131,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) DataTree dataTree = new DataTree(); List> tuples = new List>(); - for (int i=0; i < objects.Count; i++) + for (int i = 0; i < objects.Count; i++) { GH_Path path = new GH_Path(i); @@ -139,7 +142,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (@object is Aperture) { Panel panel = adjacencyCluster.GetPanel((Aperture)@object); - if(panel != null) + if (panel != null) { Aperture aperture = panel.GetAperture(((Aperture)@object).Guid); @@ -154,18 +157,18 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) else if (@object is Construction) { List panels = adjacencyCluster.GetPanels((Construction)@object); - if(panels != null) + if (panels != null) { foreach (Panel panel in panels) { List apertures = panel.GetApertures((ApertureConstruction)@object); - if(apertures != null) + if (apertures != null) { apertures?.ForEach(x => dataTree.Add(new GooAperture(x), path)); } } } - + } else if (@object is Geometry.Spatial.Point3D) { @@ -182,7 +185,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (point3D != null) tuples.Add(new Tuple(path, point3D)); } - else if(@object is global::Rhino.Geometry.Point3d) + else if (@object is global::Rhino.Geometry.Point3d) { Geometry.Spatial.Point3D point3D = Geometry.Rhino.Convert.ToSAM((global::Rhino.Geometry.Point3d)@object); if (point3D != null) @@ -190,10 +193,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(tuples != null && tuples.Count != 0) + if (tuples != null && tuples.Count != 0) { List panels = adjacencyCluster.GetPanels(); - if(panels != null && panels.Count > 0) + if (panels != null && panels.Count > 0) { foreach (Tuple tuple in tuples) { @@ -204,12 +207,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) foreach (Panel panel in panels) { List apertures = panel.Apertures; - if(apertures != null) + if (apertures != null) { - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { Geometry.Spatial.IClosedPlanar3D closedPlanar3D = aperture?.Face3D.GetExternalEdge3D(); - if(closedPlanar3D != null) + if (closedPlanar3D != null) { Geometry.Spatial.Face3D face3D = new Geometry.Spatial.Face3D(closedPlanar3D); if (face3D == null) @@ -235,4 +238,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataTree(index, dataTree); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultApertureConstructionLibrary.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultApertureConstructionLibrary.cs index 1e8bf8f74..27344833f 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultApertureConstructionLibrary.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultApertureConstructionLibrary.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalGetDefaultApertureConstructionLibrary : GH_SAMVariable /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.tertiary | GH_Exposure.obscure; @@ -81,4 +84,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, apertureConstructionLibrary?.GetApertureConstructions()?.ConvertAll(x => new GooApertureConstruction(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultApertureConstructions.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultApertureConstructions.cs index 90eccc29c..b8d785af9 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultApertureConstructions.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultApertureConstructions.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -22,7 +25,7 @@ public class SAMAnalyticalGetDefaultApertureConstructions : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -130,7 +133,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { ApertureConstruction apertureConstruction = Analytical.Query.DefaultApertureConstruction(panelType, apertureType); if (apertureConstruction == null) - continue; + continue; if (apertureConstructions.Find(x => x.Guid.Equals(apertureConstruction.Guid)) == null) apertureConstructions.Add(apertureConstruction); @@ -139,4 +142,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(0, apertureConstructions?.ConvertAll(x => new GooApertureConstruction(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultConstructionLibrary.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultConstructionLibrary.cs index 57d3d3646..2d127bfa2 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultConstructionLibrary.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultConstructionLibrary.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalGetDefaultConstructionLibrary : GH_SAMVariableOutputPa /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.tertiary | GH_Exposure.obscure; @@ -81,4 +84,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, constructionLibrary?.GetConstructions()?.ConvertAll(x => new GooConstruction(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultConstructions.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultConstructions.cs index bb3b1160f..c62482fbc 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultConstructions.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultConstructions.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -22,7 +25,7 @@ public class SAMAnalyticalGetDefaultConstructions : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -63,11 +66,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetDataList(0, panelTypeStrings); List panelTypes = null; - if(panelTypeStrings != null && panelTypeStrings.Count > 0) + if (panelTypeStrings != null && panelTypeStrings.Count > 0) { panelTypes = new List(); - foreach(string panelTypeString in panelTypeStrings) + foreach (string panelTypeString in panelTypeStrings) { PanelType panelType; if (Enum.TryParse(panelTypeString, out panelType)) @@ -81,7 +84,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) panelTypes?.RemoveAll(x => x == PanelType.Undefined || x == PanelType.Air); - if(panelTypes == null || panelTypes.Count == 0) + if (panelTypes == null || panelTypes.Count == 0) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -90,4 +93,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(0, panelTypes.ConvertAll(x => new GooConstruction(Analytical.Query.DefaultConstruction(x)))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultDegreeOfActivityLibrary.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultDegreeOfActivityLibrary.cs index eb9cd93dc..3f7c611c1 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultDegreeOfActivityLibrary.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultDegreeOfActivityLibrary.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalGetDefaultDegreeOfActivityLibrary : GH_SAMVariableOutp /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.tertiary | GH_Exposure.obscure; @@ -42,7 +45,7 @@ protected override GH_SAMParam[] Inputs { get { - return new GH_SAMParam[0]; + return new GH_SAMParam[0]; } } @@ -81,4 +84,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, degreeOfActivityLibrary?.GetDegreeOfActivities()?.ConvertAll(x => new GooDegreeOfActivity(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultGasMaterials.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultGasMaterials.cs index 7c593e2e7..dcbfc4336 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultGasMaterials.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultGasMaterials.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -22,7 +25,7 @@ public class SAMAnalyticalGetDefaultGasMaterials : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -63,11 +66,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetDataList(0, defaultGasTypeStrings); List defaultGasTypes = null; - if(defaultGasTypeStrings != null && defaultGasTypeStrings.Count > 0) + if (defaultGasTypeStrings != null && defaultGasTypeStrings.Count > 0) { defaultGasTypes = new List(); - foreach(string panelTypeString in defaultGasTypeStrings) + foreach (string panelTypeString in defaultGasTypeStrings) { DefaultGasType defaultGasType; if (Enum.TryParse(panelTypeString, out defaultGasType)) @@ -81,7 +84,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) defaultGasTypes?.RemoveAll(x => x == DefaultGasType.Undefined); - if(defaultGasTypes == null || defaultGasTypes.Count == 0) + if (defaultGasTypes == null || defaultGasTypes.Count == 0) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -90,4 +93,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(0, defaultGasTypes.ConvertAll(x => new GooMaterial(Analytical.Query.DefaultGasMaterial(x)))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultInternalConditionLibrary.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultInternalConditionLibrary.cs index ee8c9805d..d251a9313 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultInternalConditionLibrary.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultInternalConditionLibrary.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalGetDefaultInternalConditionLibrary : GH_SAMVariableOut /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.tertiary | GH_Exposure.obscure; @@ -81,4 +84,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, internalConditionLibrary?.GetInternalConditions()?.ConvertAll(x => new GooInternalCondition(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultLibrary.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultLibrary.cs index 146eb7f11..973875d89 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultLibrary.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultLibrary.cs @@ -1,4 +1,7 @@ -using GH_IO.Serialization; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using GH_IO.Serialization; using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -42,7 +45,7 @@ public class SAMAnalyticalGetDefaultLibrary : GH_SAMVariableOutputParameterCompo /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -84,7 +87,7 @@ protected override void AppendAdditionalComponentMenuItems(ToolStripDropDown men Menu_AppendItem(menu, name, Menu_Changed, Core.Convert.ToBitmap(Resources.SAM3), true, @enum.ToString() == value).Tag = @enum; } - + } private void Menu_Changed(object sender, EventArgs e) @@ -133,21 +136,21 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; object @object = null; - foreach(Enum @enum in enums) + foreach (Enum @enum in enums) { - if(@enum.ToString().Equals(value)) + if (@enum.ToString().Equals(value)) { @object = @enum; break; } } - if(@object == null) + if (@object == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } - + ISAMLibrary sAMLibrary = ActiveSetting.Setting.GetValue((Enum)@object); index = Params.IndexOfOutputParam("Library"); @@ -157,12 +160,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfOutputParam("Objects"); if (index != -1) { - if(sAMLibrary.TryGetObjects(out List jSAMObjects)) + if (sAMLibrary.TryGetObjects(out List jSAMObjects)) { dataAccess.SetDataList(index, jSAMObjects); } } - + } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultMaterialLibrary.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultMaterialLibrary.cs index 27b60c52d..a4402c99c 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultMaterialLibrary.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultMaterialLibrary.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalGetDefaultMaterialLibrary : GH_SAMVariableOutputParame /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.tertiary | GH_Exposure.obscure; @@ -82,4 +85,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, materialLibrary?.GetMaterials()?.ConvertAll(x => new GooMaterial(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultProfileLibrary.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultProfileLibrary.cs index d16d3ef08..5adef9eff 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultProfileLibrary.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultProfileLibrary.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalGetDefaultProfileLibrary : GH_SAMVariableOutputParamet /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.tertiary | GH_Exposure.obscure; @@ -81,4 +84,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, profileLibrary?.GetProfiles()?.ConvertAll(x => new GooProfile(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultSystemTypeLibrary.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultSystemTypeLibrary.cs index e68789519..16601dd5a 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultSystemTypeLibrary.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetDefaultSystemTypeLibrary.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalGetDefaultSystemTypeLibrary : GH_SAMVariableOutputPara /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.tertiary | GH_Exposure.obscure; @@ -81,4 +84,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, systemTypeLibrary?.GetSystemTypes()?.ConvertAll(x => new GooSystemType(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetExternalMaterials.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetExternalMaterials.cs index 3d4221d52..4816d35ca 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetExternalMaterials.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetExternalMaterials.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using SAM.Analytical.Grasshopper.Properties; @@ -24,7 +27,7 @@ public class SAMAnalyticalGetExternalMaterials : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -52,7 +55,7 @@ protected override void RegisterInputParams(GH_InputParamManager inputParamManag gooMaterialLibraryParam.Optional = true; inputParamManager.AddParameter(gooMaterialLibraryParam, "_materialLibrary", "_materialLibrary", "SAM MaterialLibrary", GH_ParamAccess.item); } - + /// /// Registers all the output parameters for this component. /// @@ -73,7 +76,7 @@ protected override void RegisterOutputParams(GH_OutputParamManager outputParamMa protected override void SolveInstance(IGH_DataAccess dataAccess) { AdjacencyCluster adjacencyCluster = null; - if(!dataAccess.GetData(0, ref adjacencyCluster) || adjacencyCluster == null) + if (!dataAccess.GetData(0, ref adjacencyCluster) || adjacencyCluster == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -90,10 +93,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (materialLibrary == null) materialLibrary = ActiveSetting.Setting.GetValue(AnalyticalSettingParameter.DefaultMaterialLibrary); - if(spaces != null && spaces.Count != 0) + if (spaces != null && spaces.Count != 0) { List spaces_Temp = new List(); - + DataTree dataTree_Materials = new DataTree(); DataTree dataTree_Panels = new DataTree(); DataTree dataTree_Areas = new DataTree(); @@ -125,4 +128,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetInternalConditionTextMap.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetInternalConditionTextMap.cs index b1091e1f9..4c85dae07 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetInternalConditionTextMap.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetInternalConditionTextMap.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -20,7 +23,7 @@ public class SAMAnalyticalGetInternalConditionTextMap : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -59,4 +62,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooTextMap(ActiveSetting.Setting.GetValue(AnalyticalSettingParameter.InternalConditionTextMap))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetInternalConstructionLayers.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetInternalConstructionLayers.cs index 832245ad6..e1a563478 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetInternalConstructionLayers.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetInternalConstructionLayers.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using SAM.Analytical.Grasshopper.Properties; @@ -23,7 +26,7 @@ public class SAMAnalyticalGetInternalConstructionLayers : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -120,4 +123,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetInternalMaterials.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetInternalMaterials.cs index c10d66e90..79c898207 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetInternalMaterials.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetInternalMaterials.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using SAM.Analytical.Grasshopper.Properties; @@ -24,7 +27,7 @@ public class SAMAnalyticalGetInternalMaterials : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -52,7 +55,7 @@ protected override void RegisterInputParams(GH_InputParamManager inputParamManag gooMaterialLibraryParam.Optional = true; inputParamManager.AddParameter(gooMaterialLibraryParam, "_materialLibrary", "_materialLibrary", "SAM MaterialLibrary", GH_ParamAccess.item); } - + /// /// Registers all the output parameters for this component. /// @@ -73,7 +76,7 @@ protected override void RegisterOutputParams(GH_OutputParamManager outputParamMa protected override void SolveInstance(IGH_DataAccess dataAccess) { AdjacencyCluster adjacencyCluster = null; - if(!dataAccess.GetData(0, ref adjacencyCluster) || adjacencyCluster == null) + if (!dataAccess.GetData(0, ref adjacencyCluster) || adjacencyCluster == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -90,10 +93,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (materialLibrary == null) materialLibrary = ActiveSetting.Setting.GetValue(AnalyticalSettingParameter.DefaultMaterialLibrary); - if(spaces != null && spaces.Count != 0) + if (spaces != null && spaces.Count != 0) { List spaces_Temp = new List(); - + DataTree dataTree_Materials = new DataTree(); DataTree dataTree_Panels = new DataTree(); DataTree dataTree_Areas = new DataTree(); @@ -125,4 +128,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetPanels.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetPanels.cs index ae46c9a96..22d2d848d 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetPanels.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetPanels.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using Grasshopper.Kernel.Types; @@ -26,7 +29,7 @@ public class SAMAnalyticalGetPanels : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -49,9 +52,9 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new GooAnalyticalObjectParam { Name = "_analytical", NickName = "_analytical", Description = "SAM Analytical Object such as AdjacencyCluster or AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject { Name = "_objects", NickName = "_objects", Description = "Objects such as Point, SAM Analytical Construction, Aperture etc.", Access = GH_ParamAccess.list}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject { Name = "_objects", NickName = "_objects", Description = "Objects such as Point, SAM Analytical Construction, Aperture etc.", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); - global::Grasshopper.Kernel.Parameters.Param_Number number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_tolerance_", NickName = "_tolerance_", Description = "Tolerance", Access = GH_ParamAccess.item}; + global::Grasshopper.Kernel.Parameters.Param_Number number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_tolerance_", NickName = "_tolerance_", Description = "Tolerance", Access = GH_ParamAccess.item }; number.SetPersistentData(Tolerance.MacroDistance); result.Add(new GH_SAMParam(number, ParamVisibility.Voluntary)); @@ -83,14 +86,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index = -1; index = Params.IndexOfInputParam("_analytical"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } - + IAnalyticalObject analyticalObject_Temp = null; - if(!dataAccess.GetData(index, ref analyticalObject_Temp) || analyticalObject_Temp == null) + if (!dataAccess.GetData(index, ref analyticalObject_Temp) || analyticalObject_Temp == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -108,16 +111,16 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) analyticalModel = (AnalyticalModel)analyticalObject_Temp; adjacencyCluster = analyticalModel.AdjacencyCluster; } - - if(adjacencyCluster == null) + + if (adjacencyCluster == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } index = Params.IndexOfInputParam("_objects"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -132,9 +135,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) double tolerance = Tolerance.MacroDistance; index = Params.IndexOfInputParam("_tolerance_"); - if(index != -1) + if (index != -1) { - if(!dataAccess.GetData(index, ref tolerance)) + if (!dataAccess.GetData(index, ref tolerance)) { tolerance = Tolerance.MacroDistance; } @@ -143,7 +146,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) DataTree dataTree = new DataTree(); List> tuples = new List>(); - for (int i=0; i < objectWrappers.Count; i++) + for (int i = 0; i < objectWrappers.Count; i++) { GH_Path path = new GH_Path(i); @@ -158,7 +161,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (@object is Aperture) { Panel panel = adjacencyCluster.GetPanel((Aperture)@object); - if(panel != null) + if (panel != null) { dataTree.Add(new GooPanel(Create.Panel(panel)), path); } @@ -188,7 +191,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (point3D != null) tuples.Add(new Tuple(path, point3D)); } - else if(@object is global::Rhino.Geometry.Point3d) + else if (@object is global::Rhino.Geometry.Point3d) { Point3D point3D = Geometry.Rhino.Convert.ToSAM((global::Rhino.Geometry.Point3d)@object); if (point3D != null) @@ -200,29 +203,29 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { face3Ds.ForEach(x => tuples.Add(new Tuple(path, x))); } - else if(Geometry.Grasshopper.Query.TryGetSAMGeometries(objectWrapper, out List planes) && planes != null) + else if (Geometry.Grasshopper.Query.TryGetSAMGeometries(objectWrapper, out List planes) && planes != null) { planes.ForEach(x => tuples.Add(new Tuple(path, x))); } } } - if(tuples != null && tuples.Count != 0) + if (tuples != null && tuples.Count != 0) { List> tuples_Temp = adjacencyCluster.GetPanels()?.ConvertAll(x => new Tuple(x, x?.Face3D)); tuples_Temp.RemoveAll(x => x.Item2 == null || x.Item1 == null); - if(tuples_Temp != null && tuples_Temp.Count > 0) + if (tuples_Temp != null && tuples_Temp.Count > 0) { foreach (Tuple tuple_Geometry in tuples) { ISAMGeometry3D sAMGeometry3D = tuple_Geometry?.Item2; - if(sAMGeometry3D == null) + if (sAMGeometry3D == null) { continue; } - if(sAMGeometry3D is Point3D) + if (sAMGeometry3D is Point3D) { Point3D point3D = (Point3D)sAMGeometry3D; @@ -252,7 +255,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) continue; } - if(face3D.Inside(face3D_Panel)) + if (face3D.Inside(face3D_Panel)) { dataTree.Add(new GooPanel(Create.Panel(tuple_Panel.Item1)), tuple_Geometry.Item1); } @@ -270,7 +273,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) continue; } - if(plane.On(face3D_Panel, tolerance)) + if (plane.On(face3D_Panel, tolerance)) { dataTree.Add(new GooPanel(Create.Panel(tuple_Panel.Item1)), tuple_Geometry.Item1); } @@ -284,4 +287,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataTree(index, dataTree); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetPanelsByConstruction.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetPanelsByConstruction.cs index f4ace4046..e003c2c6c 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetPanelsByConstruction.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetPanelsByConstruction.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalGetPanelsByConstruction : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -77,7 +80,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } - List redundantPanels = new List(); + List redundantPanels = new List(); List panels = sAMObjects.ConvertAll(x => x as Panel); panels.RemoveAll(x => x == null); @@ -90,9 +93,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) panels = panels?.FindAll(x => x.TypeGuid.Equals(construction.Guid)); - if(analyticalModels != null) + if (analyticalModels != null) { - foreach(AnalyticalModel analyticalModel in analyticalModels) + foreach (AnalyticalModel analyticalModel in analyticalModels) { List panels_Temp = analyticalModel?.AdjacencyCluster?.GetPanels(construction); if (panels_Temp == null) @@ -102,7 +105,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(adjacencyClusters != null) + if (adjacencyClusters != null) { foreach (AdjacencyCluster adjacencyCluster in adjacencyClusters) { @@ -117,4 +120,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(0, panels.ConvertAll(x => new GooPanel(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetSortedKeys.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetSortedKeys.cs index 4b5339761..496409109 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetSortedKeys.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetSortedKeys.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -21,7 +24,7 @@ public class SAMAnalyticalGetSortedKeys : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -62,7 +65,7 @@ protected override void RegisterOutputParams(GH_OutputParamManager outputParamMa protected override void SolveInstance(IGH_DataAccess dataAccess) { TextMap textMap = null; - if(!dataAccess.GetData(0, ref textMap) || textMap == null) + if (!dataAccess.GetData(0, ref textMap) || textMap == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -82,4 +85,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(0, textMap.GetSortedKeys(text, caseSensitive)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetSpaces.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetSpaces.cs index 5079f41cc..011262bc0 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetSpaces.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetSpaces.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using Grasshopper.Kernel.Types; @@ -25,7 +28,7 @@ public class SAMAnalyticalGetSpaces : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -48,7 +51,7 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_analytical", NickName = "_analytical", Description = "SAM Analytical Object such as AdjacencyCluster or AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject { Name = "_objects", NickName = "_objects", Description = "Objects such as Point, SAM Analytical InternalCondition etc.", Access = GH_ParamAccess.list}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject { Name = "_objects", NickName = "_objects", Description = "Objects such as Point, SAM Analytical InternalCondition etc.", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); return result.ToArray(); } @@ -79,14 +82,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index = -1; index = Params.IndexOfInputParam("_analytical"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } - + SAMObject sAMObject_Temp = null; - if(!dataAccess.GetData(index, ref sAMObject_Temp) || sAMObject_Temp == null) + if (!dataAccess.GetData(index, ref sAMObject_Temp) || sAMObject_Temp == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -104,16 +107,16 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) analyticalModel = (AnalyticalModel)sAMObject_Temp; adjacencyCluster = analyticalModel.AdjacencyCluster; } - - if(adjacencyCluster == null) + + if (adjacencyCluster == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } index = Params.IndexOfInputParam("_objects"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -130,7 +133,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) DataTree dataTree_Shells = new DataTree(); List> tuples = new List>(); - for (int i=0; i < objects.Count; i++) + for (int i = 0; i < objects.Count; i++) { GH_Path path = new GH_Path(i); @@ -162,7 +165,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List spaces = adjacencyCluster.GetSpaces((Panel)@object); if (spaces != null) { - foreach(Space space in spaces) + foreach (Space space in spaces) { dataTree_Spaces.Add(new GooSpace(space), path); dataTree_Shells.Add(new Geometry.Grasshopper.GooSAMGeometry(adjacencyCluster.Shell(space)), path); @@ -267,13 +270,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (point3D != null) tuples.Add(new Tuple(path, point3D)); } - else if(@object is global::Rhino.Geometry.Point3d) + else if (@object is global::Rhino.Geometry.Point3d) { Geometry.Spatial.Point3D point3D = Geometry.Rhino.Convert.ToSAM((global::Rhino.Geometry.Point3d)@object); if (point3D != null) tuples.Add(new Tuple(path, point3D)); } - else if(@object is string) + else if (@object is string) { List spaces = adjacencyCluster.GetSpaces(); if (spaces == null || spaces.Count == 0) @@ -288,10 +291,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(tuples != null && tuples.Count != 0) + if (tuples != null && tuples.Count != 0) { Dictionary dictionary = adjacencyCluster?.ShellDictionary(); - if(dictionary != null && dictionary.Count > 0) + if (dictionary != null && dictionary.Count > 0) { foreach (Tuple tuple in tuples) { @@ -303,10 +306,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { if (keyValuePair.Key == null) continue; - + if (keyValuePair.Value.InRange(point3D) || keyValuePair.Value.Inside(point3D)) { - dataTree_Spaces.Add( new GooSpace(keyValuePair.Key), tuple.Item1); + dataTree_Spaces.Add(new GooSpace(keyValuePair.Key), tuple.Item1); dataTree_Shells.Add(new Geometry.Grasshopper.GooSAMGeometry(adjacencyCluster.Shell(keyValuePair.Key)), tuple.Item1); break; } @@ -324,4 +327,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataTree(index, dataTree_Shells); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetSpacesByName.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetSpacesByName.cs index b5fcc0113..a1fea4f64 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetSpacesByName.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetSpacesByName.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalGetSpacesByName : GH_SAMVariableOutputParameterCompone /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -44,7 +47,7 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new GooAnalyticalObjectParam() { Name = "_analytical", NickName = "_analytical", Description = "SAM Analytical Object such as AdjacencyCluster or AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_String { Name = "_name", NickName = "_name", Description = "Space Name", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_String { Name = "_name", NickName = "_name", Description = "Space Name", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); return result.ToArray(); } @@ -74,14 +77,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index = -1; index = Params.IndexOfInputParam("_analytical"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } - + IAnalyticalObject analyticalObject = null; - if(!dataAccess.GetData(index, ref analyticalObject) || analyticalObject == null) + if (!dataAccess.GetData(index, ref analyticalObject) || analyticalObject == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -99,9 +102,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) analyticalModel = (AnalyticalModel)analyticalObject; adjacencyCluster = analyticalModel.AdjacencyCluster; } - - if(adjacencyCluster == null) + + if (adjacencyCluster == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -110,7 +113,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) string name = null; index = Params.IndexOfInputParam("_name"); - if(index == -1 || !dataAccess.GetData(index, ref name) || string.IsNullOrEmpty(name)) + if (index == -1 || !dataAccess.GetData(index, ref name) || string.IsNullOrEmpty(name)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -125,4 +128,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetValuesByReference.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetValuesByReference.cs index f7278dd15..0f023f8ad 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetValuesByReference.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetValuesByReference.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalGetValuesByReference : GH_SAMVariableOutputParameterCo /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -45,7 +48,7 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new GooAnalyticalObjectParam() { Name = "_analytical", NickName = "_analytical", Description = "SAM Analytical Object such as AdjacencyCluster or AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_String { Name = "_reference", NickName = "_reference", Description = "Reference", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_String { Name = "_reference", NickName = "_reference", Description = "Reference", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); return result.ToArray(); } @@ -75,14 +78,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index = -1; index = Params.IndexOfInputParam("_analytical"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } - + IAnalyticalObject analyticalObject = null; - if(!dataAccess.GetData(index, ref analyticalObject) || analyticalObject == null) + if (!dataAccess.GetData(index, ref analyticalObject) || analyticalObject == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -98,16 +101,16 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { adjacencyCluster = ((AnalyticalModel)analyticalObject).AdjacencyCluster; } - - if(adjacencyCluster == null) + + if (adjacencyCluster == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } index = Params.IndexOfInputParam("_reference"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -122,7 +125,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) IComplexReference complexReference = Core.Convert.ComplexReference(reference); - if(complexReference == null) + if (complexReference == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -137,4 +140,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetZonesByName.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetZonesByName.cs index bc0ea9f15..976d5e5e0 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetZonesByName.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetZonesByName.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using SAM.Analytical.Grasshopper.Properties; @@ -24,7 +27,7 @@ public class SAMAnalyticalGetZonesByName : GH_SAMVariableOutputParameterComponen /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -63,7 +66,7 @@ protected override GH_SAMParam[] Outputs List result = new List(); result.Add(new GH_SAMParam(new GooGroupParam() { Name = "Zones", NickName = "Zones", Description = "SAM GuidCollections representing Zones", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "Spaces", NickName = "Spaces", Description = "SAM Analytical Spaces", Access = GH_ParamAccess.tree }, ParamVisibility.Binding)); - + return result.ToArray(); } } @@ -80,7 +83,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_analytical"); SAMObject sAMObject = null; - if(index == -1 || !dataAccess.GetData(index, ref sAMObject) || sAMObject == null) + if (index == -1 || !dataAccess.GetData(index, ref sAMObject) || sAMObject == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -100,13 +103,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) AdjacencyCluster adjacencyCluster = null; - if(sAMObject is AnalyticalModel) + if (sAMObject is AnalyticalModel) adjacencyCluster = ((AnalyticalModel)sAMObject)?.AdjacencyCluster; - else if(sAMObject is AdjacencyCluster) + else if (sAMObject is AdjacencyCluster) adjacencyCluster = ((AdjacencyCluster)sAMObject); List zones = adjacencyCluster?.GetObjects(); - if(zones != null) + if (zones != null) { if (name != null) zones.RemoveAll(x => x.Name != name); @@ -136,7 +139,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataTree(index, dataTree_Spaces); } - + } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetZonesBySpace.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetZonesBySpace.cs index 9212c02bf..70d66c9ae 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetZonesBySpace.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGetZonesBySpace.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using SAM.Analytical.Grasshopper.Properties; @@ -24,7 +27,7 @@ public class SAMAnalyticalGetZonesBySpace : GH_SAMVariableOutputParameterCompone /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -62,7 +65,7 @@ protected override GH_SAMParam[] Outputs List result = new List(); result.Add(new GH_SAMParam(new GooGroupParam() { Name = "Zones", NickName = "Zones", Description = "SAM GuidCollections representing Zones", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "Spaces", NickName = "Spaces", Description = "SAM Analytical Spaces", Access = GH_ParamAccess.tree }, ParamVisibility.Binding)); - + return result.ToArray(); } } @@ -79,7 +82,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_analytical"); SAMObject sAMObject = null; - if(index == -1 || !dataAccess.GetData(index, ref sAMObject) || sAMObject == null) + if (index == -1 || !dataAccess.GetData(index, ref sAMObject) || sAMObject == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -97,9 +100,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) AdjacencyCluster adjacencyCluster = null; - if(sAMObject is AnalyticalModel) + if (sAMObject is AnalyticalModel) adjacencyCluster = ((AnalyticalModel)sAMObject)?.AdjacencyCluster; - else if(sAMObject is AdjacencyCluster) + else if (sAMObject is AdjacencyCluster) adjacencyCluster = ((AdjacencyCluster)sAMObject); zones = adjacencyCluster?.GetRelatedObjects(space); @@ -125,7 +128,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataTree(index, dataTree_Spaces); } - + } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGrid.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGrid.cs index cc483e53c..7da308f33 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGrid.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalGrid.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Rhino.Geometry; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -23,7 +26,7 @@ public class SAMAnalyticalGrid : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -77,7 +80,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } List panels = new List(); - foreach(SAMObject sAMObject in sAMObjects) + foreach (SAMObject sAMObject in sAMObjects) { if (sAMObject is Panel) { @@ -89,7 +92,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (panels_Temp != null) panels.AddRange(panels_Temp); } - else if(sAMObject is AnalyticalModel) + else if (sAMObject is AnalyticalModel) { List panels_Temp = ((AnalyticalModel)sAMObject).AdjacencyCluster?.GetPanels(); if (panels_Temp != null) @@ -129,4 +132,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(0, segment3Ds?.ConvertAll(segment2D => Geometry.Rhino.Convert.ToRhino_Line(segment2D))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalHeatFlowDirection.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalHeatFlowDirection.cs index 19111a000..c6328d477 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalHeatFlowDirection.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalHeatFlowDirection.cs @@ -1,4 +1,7 @@ -using SAM.Analytical.Grasshopper.Properties; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -19,7 +22,7 @@ public class SAMAnalyticalHeatFlowDirection : GH_SAMEnumComponent /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Heat Flow Direction @@ -31,4 +34,4 @@ public SAMAnalyticalHeatFlowDirection() { } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalHeatTransferCoefficientByDefaultGasType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalHeatTransferCoefficientByDefaultGasType.cs index ca119ee1b..e7a0932a6 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalHeatTransferCoefficientByDefaultGasType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalHeatTransferCoefficientByDefaultGasType.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Parameters; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; @@ -23,7 +26,7 @@ public class SAMAnalyticalHeatTransferCoefficientByDefaultGasType : GH_SAMCompon /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -77,7 +80,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } DefaultGasType defaultGasType = DefaultGasType.Undefined; - if(!Enum.TryParse(objectWrapper.Value?.ToString(), out defaultGasType) || defaultGasType == DefaultGasType.Undefined) + if (!Enum.TryParse(objectWrapper.Value?.ToString(), out defaultGasType) || defaultGasType == DefaultGasType.Undefined) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -118,4 +121,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, HeatTransferCoefficient); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalHourOfYearToDateTime.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalHourOfYearToDateTime.cs index 41afacff9..cc3a1a0b4 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalHourOfYearToDateTime.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalHourOfYearToDateTime.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalHourOfYearToDateTime : GH_SAMVariableOutputParameterCo /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.tertiary | GH_Exposure.obscure; @@ -50,7 +53,7 @@ protected override GH_SAMParam[] Inputs param_Integer.PersistentData.Append(new GH_Integer(2018)); result.Add(new GH_SAMParam(param_Integer, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Integer() { Name = "timeShift_", NickName = "timeShift_", Description = "Time shift in min", Access = GH_ParamAccess.item, Optional = true}, ParamVisibility.Voluntary)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Integer() { Name = "timeShift_", NickName = "timeShift_", Description = "Time shift in min", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); return result.ToArray(); @@ -90,7 +93,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int hourIndex = -1; index = Params.IndexOfInputParam("_hourOfYear"); - if(index == -1 || !dataAccess.GetData(index, ref hourIndex) || hourIndex < 0 || hourIndex > 8760) + if (index == -1 || !dataAccess.GetData(index, ref hourIndex) || hourIndex < 0 || hourIndex > 8760) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -115,7 +118,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } DateTime dateTime = Analytical.Convert.ToDateTime(hourIndex, year); - if(minute != 0) + if (minute != 0) { dateTime = dateTime.AddMinutes(minute); } @@ -153,4 +156,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, Analytical.Convert.ToString(dateTime)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalHourlyValues.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalHourlyValues.cs index b7c299061..beb45ef3d 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalHourlyValues.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalHourlyValues.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalHourlyValues : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -97,7 +100,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } TMExtendedResult tMExtendedResult = result as TMExtendedResult; - if(tMExtendedResult == null) + if (tMExtendedResult == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -105,7 +108,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_dayOfYear"); int dayOfYear = -1; - if (index == -1 || !dataAccess.GetData(index,ref dayOfYear)) + if (index == -1 || !dataAccess.GetData(index, ref dayOfYear)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -218,4 +221,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalInsideSpace.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalInsideSpace.cs index cf1abdc8a..064b7b774 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalInsideSpace.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalInsideSpace.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalInsideSpace : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -94,4 +97,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, Analytical.Query.Inside(adjacencyCluster, space, point3D)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalInternalConditionParameter.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalInternalConditionParameter.cs index 3426a29ed..6ee55305e 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalInternalConditionParameter.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalInternalConditionParameter.cs @@ -1,4 +1,7 @@ -using SAM.Analytical.Grasshopper.Properties; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -19,7 +22,7 @@ public class SAMAnalyticalInternalConditionParameter : GH_SAMEnumComponent /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Internal Condition Parameter Component @@ -31,4 +34,4 @@ public SAMAnalyticalInternalConditionParameter() { } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalJoinPanels.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalJoinPanels.cs index 58094a516..91ad20637 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalJoinPanels.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalJoinPanels.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -23,7 +26,7 @@ public class SAMAnalyticalJoinPanels : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -104,7 +107,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfInputParam("_elevations"); - List objectWrappers_Elevation = new List() ; + List objectWrappers_Elevation = new List(); if (index == -1 || !dataAccess.GetDataList(index, objectWrappers_Elevation) || objectWrappers_Elevation == null || objectWrappers_Elevation.Count == 0) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Invalid Data"); @@ -113,7 +116,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List elevations = new List(); - foreach(GH_ObjectWrapper objectWrapper_Elevation in objectWrappers_Elevation) + foreach (GH_ObjectWrapper objectWrapper_Elevation in objectWrappers_Elevation) { object @object = objectWrapper_Elevation.Value; if (@object is IGH_Goo) @@ -137,7 +140,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) elevation = ((Architectural.Level)@object).Elevation; } - if(double.IsNaN(elevation)) + if (double.IsNaN(elevation)) { continue; } @@ -176,12 +179,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { Analytical.Modify.Join(panels, elevation + offset, distance, out List panels_Extended_Temp, out List panels_Trimmed_Temp, out List segment3Ds_Temp, Tolerance.MacroDistance, Tolerance.Angle, tolerance); - if(panels_Extended_Temp != null) + if (panels_Extended_Temp != null) { - foreach(Panel panel_Extended in panels_Extended_Temp) + foreach (Panel panel_Extended in panels_Extended_Temp) { int i = panels_Extended.FindIndex(x => x.Guid == panel_Extended.Guid); - if(i == -1) + if (i == -1) { panels_Extended.Add(panel_Extended); } @@ -208,7 +211,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(segment3Ds_Temp != null) + if (segment3Ds_Temp != null) { segment3Ds.AddRange(segment3Ds_Temp); } @@ -231,4 +234,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, segment3Ds); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalJoinSpacesByPanels.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalJoinSpacesByPanels.cs index eb488443d..25adb6bc8 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalJoinSpacesByPanels.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalJoinSpacesByPanels.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using SAM.Analytical.Grasshopper.Properties; @@ -24,7 +27,7 @@ public class SAMAnalyticalJoinSpacesByPanels : GH_SAMVariableOutputParameterComp /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -118,7 +121,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) foreach (Panel panel in panels) { List spaces = adjacencyCluster.GetSpaces(panel); - if (spaces == null || spaces.Count < 2) + if (spaces == null || spaces.Count < 2) { continue; } @@ -127,10 +130,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List panels_Space = adjacencyCluster.GetPanels(space); adjacencyCluster.RemoveObject(space.Guid); - foreach(Panel panel_Space in panels_Space) + foreach (Panel panel_Space in panels_Space) { List spaces_Panel_Space = adjacencyCluster.GetSpaces(panel_Space); - for(int i = 1; i < spaces.Count; i++) + for (int i = 1; i < spaces.Count; i++) { if (spaces_Panel_Space?.Find(x => x.Guid == spaces[i].Guid) == null || spaces_Panel_Space.Count == 0) { @@ -188,4 +191,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalLabelPanel.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalLabelPanel.cs index d7f29d290..38f2db562 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalLabelPanel.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalLabelPanel.cs @@ -1,7 +1,11 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Data; -using Rhino.Display; using Rhino; +using Rhino.Display; +using Rhino.DocObjects; using Rhino.Geometry; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -11,7 +15,6 @@ using System; using System.Collections.Generic; using System.Linq; -using Rhino.DocObjects; namespace SAM.Analytical.Grasshopper { @@ -30,7 +33,7 @@ public class SAMAnalyticalLabelPanel : GH_SAMComponent, IGH_PreviewObject, IGH_B /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -154,7 +157,7 @@ private List GetText3ds() double value = double.NaN; if (double.TryParse(text, out value)) - text = value.Round(RhinoDoc.ActiveDoc.ModelAbsoluteTolerance).ToString(); + text = value.Round(RhinoDoc.ActiveDoc.ModelAbsoluteTolerance).ToString(); Vector3D normal = panel.Face3D?.GetPlane()?.Normal; normal.Round(Tolerance.Distance); @@ -239,7 +242,7 @@ public override void DrawViewportWires(IGH_PreviewArgs args) continue; Point3d point = text3d.TextPlane.Origin; - if (point.DistanceTo(cameraLocation) > 16) + if (point.DistanceTo(cameraLocation) > 16) continue; args.Display.Draw3dText(text3d, System.Drawing.Color.Black); @@ -262,7 +265,7 @@ public override void BakeGeometry(RhinoDoc doc, ObjectAttributes att, List if (text3ds == null || text3ds.Count == 0) return; - foreach(Text3d text3d in text3ds) + foreach (Text3d text3d in text3ds) { Guid guid = doc.Objects.AddText(text3d, att); if (guid != Guid.Empty) @@ -270,4 +273,4 @@ public override void BakeGeometry(RhinoDoc doc, ObjectAttributes att, List } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalLabelSpace.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalLabelSpace.cs index 23ddcf8c5..ee8ba57aa 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalLabelSpace.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalLabelSpace.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using Rhino.Display; using Rhino.Geometry; @@ -9,7 +12,6 @@ using System; using System.Collections.Generic; using System.Linq; -using static SAM.Geometry.Rhino.ActiveSetting; namespace SAM.Analytical.Grasshopper { @@ -28,7 +30,7 @@ public class SAMAnalyticalLabelSpace : GH_SAMComponent, IGH_PreviewObject /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -93,7 +95,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } Text3d text3D = GetText3d(space, parameterName, height); - if(text3D is null) + if (text3D is null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -160,7 +162,7 @@ private List GetText3ds() } Text3d text3d = GetText3d(space, parameterName, height); - if(text3d is not null) + if (text3d is not null) { result.Add(text3d); } @@ -171,7 +173,7 @@ private List GetText3ds() private Text3d GetText3d(ISpace space, string parameterName, double height = double.NaN) { - if(space is null) + if (space is null) { return null; } @@ -260,14 +262,14 @@ public override void DrawViewportMeshes(IGH_PreviewArgs args) if (text3d == null) continue; Point3d point = text3d.TextPlane.Origin; - - if (point.DistanceTo(cameraLocation) > 80) + + if (point.DistanceTo(cameraLocation) > 80) continue; - + args.Display.Draw3dText(text3d, System.Drawing.Color.Black); } } - + base.DrawViewportMeshes(args); } @@ -282,10 +284,10 @@ public override void DrawViewportWires(IGH_PreviewArgs args) if (text3d == null) continue; Point3d point = text3d.TextPlane.Origin; - - if (point.DistanceTo(cameraLocation) > 40) + + if (point.DistanceTo(cameraLocation) > 40) continue; - + args.Display.Draw3dText(text3d, System.Drawing.Color.Black); } } @@ -295,4 +297,4 @@ public override void DrawViewportWires(IGH_PreviewArgs args) #endregion IGH_PreviewObject } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalLightingOccupancyControls.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalLightingOccupancyControls.cs index 4cc20dd51..bb20c6c0f 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalLightingOccupancyControls.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalLightingOccupancyControls.cs @@ -1,4 +1,7 @@ -using SAM.Analytical.Grasshopper.Properties; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -19,7 +22,7 @@ public class SAMAnalyticalLightingOccupancyControls : GH_SAMEnumComponent /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Panel Type @@ -31,4 +34,4 @@ public SAMAnalyticalLightingOccupancyControls() { } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalLightingPhotoelectricControls.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalLightingPhotoelectricControls.cs index 890d0af2e..2205dd407 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalLightingPhotoelectricControls.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalLightingPhotoelectricControls.cs @@ -1,4 +1,7 @@ -using SAM.Analytical.Grasshopper.Properties; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -19,7 +22,7 @@ public class SAMAnalyticalLightingPhotoelectricControls : GH_SAMEnumComponent
  • /// Provides an Icon for the component. ///
  • - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Panel Type @@ -31,4 +34,4 @@ public SAMAnalyticalLightingPhotoelectricControls() { } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalLoadWeatherData.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalLoadWeatherData.cs index f10bd03a3..6ce876314 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalLoadWeatherData.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalLoadWeatherData.cs @@ -1,12 +1,14 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; +using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; +using SAM.Weather; +using SAM.Weather.Grasshopper; using System; using System.Collections.Generic; -using SAM.Weather.Grasshopper; -using SAM.Analytical.Grasshopper.Properties; -using SAM.Weather; using System.Windows.Forms; -using System.Diagnostics; namespace SAM.Analytical.Grasshopper { @@ -25,7 +27,7 @@ public class SAMAnalyticalLoadWeatherData : GH_SAMVariableOutputParameterCompone /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -46,8 +48,8 @@ protected override GH_SAMParam[] Inputs global::Grasshopper.Kernel.Parameters.Param_String @string = new global::Grasshopper.Kernel.Parameters.Param_String() { Name = "_epwPath", NickName = "_epwPath", Description = "EPW File Path", Access = GH_ParamAccess.item, Optional = false }; result.Add(new GH_SAMParam(@string, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "heatingDesignDayTemp_", NickName = "heatingDesignDayTemp_", Description = "Heating DesignDay Temperature", Access = GH_ParamAccess.item, Optional = true}, ParamVisibility.Voluntary)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "heatingDesignDayWindspeed_", NickName = "heatingDesignDayWindspeed_", Description = "Heating DesignDay Windspeed", Access = GH_ParamAccess.item, Optional = true}, ParamVisibility.Voluntary)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "heatingDesignDayTemp_", NickName = "heatingDesignDayTemp_", Description = "Heating DesignDay Temperature", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "heatingDesignDayWindspeed_", NickName = "heatingDesignDayWindspeed_", Description = "Heating DesignDay Windspeed", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); return result.ToArray(); } @@ -96,7 +98,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfOutputParam("weatherData"); - if(index != -1) + if (index != -1) { dataAccess.SetData(index, new GooWeatherData(weatherData)); } @@ -111,15 +113,15 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (index_HeatingDesignDay != -1) { DesignDay designDay = weatherData?.HeatingDesignDay(); - if(designDay != null) + if (designDay != null) { index = Params.IndexOfInputParam("heatingDesignDayTemp_"); - if(index != -1) + if (index != -1) { double temperature = double.NaN; - if(dataAccess.GetData(index, ref temperature) && !double.IsNaN(temperature)) + if (dataAccess.GetData(index, ref temperature) && !double.IsNaN(temperature)) { - for(int i=0; i < 24; i++) + for (int i = 0; i < 24; i++) { designDay[WeatherDataType.DryBulbTemperature, i] = temperature; } @@ -164,4 +166,4 @@ void Menu_GoTo_LadybugTools(object sender, EventArgs e) Core.Query.StartProcess(@"https://www.ladybug.tools/epwmap/"); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMapAdjacencyCluster.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMapAdjacencyCluster.cs index 56ac3f332..babfa8e67 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMapAdjacencyCluster.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMapAdjacencyCluster.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalMapAdjacencyCluster : GH_SAMVariableOutputParameterCom /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -111,4 +114,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, new GooAdjacencyCluster(adjacencyCluster_Destination)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMapInternalCondtions.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMapInternalCondtions.cs index 9c61caf05..059315888 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMapInternalCondtions.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMapInternalCondtions.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalMapInternalConditions : GH_SAMVariableOutputParameterC /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -221,9 +224,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) spaces_Unassigned.Add(spaces[i]); profiles = Analytical.Query.Profiles(buildingModel, profileLibrary); - if(profiles != null) + if (profiles != null) { - foreach(Profile profile in profiles) + foreach (Profile profile in profiles) { buildingModel.Add(profile); } @@ -251,4 +254,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, profiles?.ToList().ConvertAll(x => new GooProfile(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMapPanels.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMapPanels.cs index ac5bbccb6..306be3cc8 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMapPanels.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMapPanels.cs @@ -1,10 +1,13 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; using System; -using System.Linq; using System.Collections.Generic; +using System.Linq; namespace SAM.Analytical.Grasshopper { @@ -23,7 +26,7 @@ public class SAMAnalyticalMapPanels : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -50,13 +53,13 @@ protected override GH_SAMParam[] Inputs result.Add(new GH_SAMParam(genericObject, ParamVisibility.Binding)); - GooPanelParam gooPanelParam = new GooPanelParam() { Name = "_panels", NickName = "_panels", Description = "SAM Analytical Panels", Access = GH_ParamAccess.list}; + GooPanelParam gooPanelParam = new GooPanelParam() { Name = "_panels", NickName = "_panels", Description = "SAM Analytical Panels", Access = GH_ParamAccess.list }; gooPanelParam.DataMapping = GH_DataMapping.Flatten; result.Add(new GH_SAMParam(gooPanelParam, ParamVisibility.Binding)); global::Grasshopper.Kernel.Parameters.Param_Number number; - number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "minArea_", NickName = "minArea_", Description = "Minimal Area", Access = GH_ParamAccess.item}; + number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "minArea_", NickName = "minArea_", Description = "Minimal Area", Access = GH_ParamAccess.item }; number.SetPersistentData(Tolerance.MacroDistance); result.Add(new GH_SAMParam(number, ParamVisibility.Voluntary)); @@ -102,7 +105,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("minArea_"); double minArea = Tolerance.MacroDistance; - if(index != -1) + if (index != -1) { double value = double.NaN; if (dataAccess.GetData(index, ref value) && !double.IsNaN(value)) @@ -119,7 +122,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfInputParam("_analytical"); - SAMObject sAMObject= null; + SAMObject sAMObject = null; if (index == -1 || !dataAccess.GetData(index, ref sAMObject) || sAMObject == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); @@ -128,16 +131,16 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) AdjacencyCluster adjacencyCluster = null; - if(sAMObject is AdjacencyCluster) + if (sAMObject is AdjacencyCluster) { adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)sAMObject); } - else if(sAMObject is AnalyticalModel) + else if (sAMObject is AnalyticalModel) { adjacencyCluster = ((AnalyticalModel)sAMObject).AdjacencyCluster; } - if(adjacencyCluster != null) + if (adjacencyCluster != null) { List panels_Result = adjacencyCluster.MapPanels(panels, minArea, maxDistance); @@ -156,4 +159,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, sAMObject); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMechanicalSystemTypes.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMechanicalSystemTypes.cs index 66f0de833..854d92472 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMechanicalSystemTypes.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMechanicalSystemTypes.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -21,7 +24,7 @@ public class SAMAnalyticalMechanicalSystemTypes : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -78,12 +81,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) InternalCondition internalCondition = null; - if(sAMObject is InternalCondition) + if (sAMObject is InternalCondition) internalCondition = (InternalCondition)sAMObject; - else if(sAMObject is Space) + else if (sAMObject is Space) internalCondition = ((Space)sAMObject).InternalCondition; - if(internalCondition == null) + if (internalCondition == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -94,4 +97,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(2, new GooSystemType(internalCondition.GetSystemType(systemTypeLibrary))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMerge.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMerge.cs index bfa92d76a..8fcd4e722 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMerge.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMerge.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalMerge : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -98,7 +101,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetData(index, ref mergeSettings); } - if(mergeSettings == null) + if (mergeSettings == null) { mergeSettings = Analytical.Query.DefaultMergeSettings(); } @@ -110,7 +113,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { dataAccess.SetData(index, analyticalModel); } - + } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeAdjacencyCluster.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeAdjacencyCluster.cs index 62211d4e5..71f4481f2 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeAdjacencyCluster.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeAdjacencyCluster.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalMergeAdjacencyCluster : GH_SAMVariableOutputParameterC /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -44,7 +47,7 @@ protected override GH_SAMParam[] Inputs { List result = []; - GooAnalyticalObjectParam gooAnalyticalObjectParam = new () { Name = "_analyticalObject", NickName = "_analyticalObject", Description = "SAM AdjacencyCluster or AnalyticalModel", Access = GH_ParamAccess.item }; + GooAnalyticalObjectParam gooAnalyticalObjectParam = new() { Name = "_analyticalObject", NickName = "_analyticalObject", Description = "SAM AdjacencyCluster or AnalyticalModel", Access = GH_ParamAccess.item }; result.Add(new GH_SAMParam(gooAnalyticalObjectParam, ParamVisibility.Binding)); GooAnalyticalObjectParam gooAdjacencyClusterParam = new() { Name = "_adjacencyClusters", NickName = "_adjacencyClusters", Description = "SAM AdjacencyClusters", Access = GH_ParamAccess.list }; @@ -98,11 +101,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } - if(analyticalObject is AdjacencyCluster adjacencyCluster) + if (analyticalObject is AdjacencyCluster adjacencyCluster) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster); } - else if(analyticalObject is AnalyticalModel analyticalModel) + else if (analyticalObject is AnalyticalModel analyticalModel) { adjacencyCluster = new AdjacencyCluster(analyticalModel.AdjacencyCluster); } @@ -134,16 +137,16 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetData(index, ref tolerance); } - foreach(AdjacencyCluster adjacencyCluster_Source in adjacencyClusters) + foreach (AdjacencyCluster adjacencyCluster_Source in adjacencyClusters) { Analytical.Modify.Merge(adjacencyCluster, adjacencyCluster_Source, silverSpacing: silverSpacing, tolerance_Distance: tolerance); } - if(analyticalObject is AdjacencyCluster) + if (analyticalObject is AdjacencyCluster) { analyticalObject = adjacencyCluster; } - else if(analyticalObject is AnalyticalModel analyticalModel) + else if (analyticalObject is AnalyticalModel analyticalModel) { analyticalObject = new AnalyticalModel(analyticalModel, adjacencyCluster); } @@ -155,4 +158,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeAperturesByMinRectangle.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeAperturesByMinRectangle.cs index f09ea2230..c33dfced6 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeAperturesByMinRectangle.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeAperturesByMinRectangle.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalMergeAperturesByMinRectangle : GH_SAMVariableOutputPar /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -52,7 +55,7 @@ protected override GH_SAMParam[] Inputs global::Grasshopper.Kernel.Parameters.Param_Number paramNumber; - paramNumber = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_distance", NickName = "_distance", Description = "Distance", Access = GH_ParamAccess.item}; + paramNumber = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_distance", NickName = "_distance", Description = "Distance", Access = GH_ParamAccess.item }; result.Add(new GH_SAMParam(paramNumber, ParamVisibility.Binding)); global::Grasshopper.Kernel.Parameters.Param_Boolean paramBoolean; @@ -150,7 +153,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) Panel panel = Create.Panel((Panel)sAMObject); List apertures_Panel = panel.MergeApertures(distance, out List removedApertures_Temp, apertures?.ConvertAll(x => x.Guid), removeOverlap); - if(apertures_Panel != null) + if (apertures_Panel != null) { apertures_Result.AddRange(apertures_Panel.ConvertAll(x => new Aperture(x))); } @@ -212,4 +215,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeCoplanarApertures.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeCoplanarApertures.cs index 244ba5696..e5632fb16 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeCoplanarApertures.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeCoplanarApertures.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalMergeCoplanarApertures : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -104,15 +107,15 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) panels = Analytical.Query.MergeCoplanarApertures(panels, out redundantApertures, out mergedApertures, true, tolerance); - for(int i =0; i < adjacencyClusters.Count; i++) + for (int i = 0; i < adjacencyClusters.Count; i++) { List redundantApertures_Temp = null; List mergedApertures_Temp = null; adjacencyClusters[i] = Analytical.Query.MergeCoplanarApertures(adjacencyClusters[i], out mergedApertures_Temp, out redundantApertures_Temp, true, tolerance); - if(redundantApertures_Temp != null) + if (redundantApertures_Temp != null) { - if(redundantApertures == null) + if (redundantApertures == null) { redundantApertures = new List(); } @@ -173,4 +176,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(2, redundantApertures?.ConvertAll(x => new GooAperture(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeCoplanarPanels.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeCoplanarPanels.cs index 65245a507..7bf4d3d0a 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeCoplanarPanels.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeCoplanarPanels.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalMergeCoplanarPanels : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -147,4 +150,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(1, redundantPanels?.ConvertAll(x => new GooPanel(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeCoplanarPanelsBySpace.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeCoplanarPanelsBySpace.cs index fe369f6ed..0e8deb782 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeCoplanarPanelsBySpace.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeCoplanarPanelsBySpace.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalMergeCoplanarPanelsBySpace : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -104,7 +107,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List redundantPanels = new List(); - if(sAMObject is AnalyticalModel || sAMObject is AdjacencyCluster) + if (sAMObject is AnalyticalModel || sAMObject is AdjacencyCluster) { sAMObject = Analytical.Query.MergeCoplanarPanelsBySpace(sAMObject as dynamic, offset, ref redundantPanels, true, true, minArea, tolerance); } @@ -113,4 +116,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(1, redundantPanels?.ConvertAll(x => new GooPanel(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeOverlapApertures.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeOverlapApertures.cs index d4431ad5b..1b899d8d5 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeOverlapApertures.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeOverlapApertures.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalMergeOverlapApertures : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -143,4 +146,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(0, result); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeOverlapPanels.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeOverlapPanels.cs index 5bd128c94..cb5738b62 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeOverlapPanels.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeOverlapPanels.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalMergeOverlapPanels : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -107,7 +110,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List redundantPanels = new List(); - List panels = sAMObjects.ConvertAll(x => x as Panel); + List panels = sAMObjects.ConvertAll(x => x as Panel); panels.RemoveAll(x => x == null); List adjacencyClusters = sAMObjects.ConvertAll(x => x as AdjacencyCluster); @@ -147,4 +150,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(1, redundantPanels?.ConvertAll(x => new GooPanel(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergePanels.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergePanels.cs index d743e41b9..eabed4a4e 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergePanels.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergePanels.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalMergePanels : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -45,7 +48,7 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_analytical", NickName = "_analytical", Description = "SAM Analytical Object such as AdjacencyCluster or AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooPanelParam() { Name = "_panels", NickName = "_panels", Description = "SAM Analytical Panels", Access = GH_ParamAccess.list}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooPanelParam() { Name = "_panels", NickName = "_panels", Description = "SAM Analytical Panels", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); global::Grasshopper.Kernel.Parameters.Param_Number paramNumber; @@ -111,21 +114,21 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } AdjacencyCluster adjacencyCluster = null; - if(sAMObject is AdjacencyCluster) + if (sAMObject is AdjacencyCluster) { adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)sAMObject); } - else if(sAMObject is AnalyticalModel) + else if (sAMObject is AnalyticalModel) { adjacencyCluster = ((AnalyticalModel)sAMObject).AdjacencyCluster; } double maxDistance = 0.2; index = Params.IndexOfInputParam("maxDistance_"); - if(index != -1) + if (index != -1) { double maxDistance_Temp = maxDistance; - if(dataAccess.GetData(index, ref maxDistance_Temp) && !double.IsNaN(maxDistance_Temp)) + if (dataAccess.GetData(index, ref maxDistance_Temp) && !double.IsNaN(maxDistance_Temp)) { maxDistance = maxDistance_Temp; } @@ -168,14 +171,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) foreach (Panel panel in panels) { List panels_Temp = adjacencyCluster.MergePanel(panel.Guid, maxDistance, minArea, thinnessRatio, tolerance); - if(panels_Temp == null || panels_Temp.Count == 0) + if (panels_Temp == null || panels_Temp.Count == 0) { continue; } - foreach(Panel panel_Temp in panels_Temp) + foreach (Panel panel_Temp in panels_Temp) { - if(panels_Merge.Find(x => x.Guid == panel_Temp.Guid) == null) + if (panels_Merge.Find(x => x.Guid == panel_Temp.Guid) == null) { panels_Merge.Add(panel_Temp); } @@ -200,4 +203,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, panels_Merge); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeSettings.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeSettings.cs index 75b6ede71..93c799b7f 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeSettings.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeSettings.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalMergeSettings : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -43,7 +46,7 @@ protected override GH_SAMParam[] Inputs get { List result = new List(); - result.Add(new GH_SAMParam(new GooTypeMergeSettingsParam() { Name = "_typeMergeSettings", NickName = "_typeMergeSettings", Description = "Type merge settings", Access = GH_ParamAccess.list}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooTypeMergeSettingsParam() { Name = "_typeMergeSettings", NickName = "_typeMergeSettings", Description = "Type merge settings", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); return result.ToArray(); } @@ -57,7 +60,7 @@ protected override GH_SAMParam[] Outputs get { List result = new List(); - result.Add(new GH_SAMParam(new GooMergeSettingsParam() { Name = "mergeSettings", NickName = "mergeSettings", Description = "Merge Settings", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooMergeSettingsParam() { Name = "mergeSettings", NickName = "mergeSettings", Description = "Merge Settings", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); return result.ToArray(); } } @@ -88,4 +91,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeSpacesByAirPanels.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeSpacesByAirPanels.cs index 5635a9cc9..248a1c227 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeSpacesByAirPanels.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeSpacesByAirPanels.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -43,7 +46,7 @@ public class SAMAnalyticalMergeSpacesByAirPanels : GH_SAMVariableOutputParameter /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -134,11 +137,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } AdjacencyCluster adjacencyCluster = null; - if(sAMObject is AdjacencyCluster) + if (sAMObject is AdjacencyCluster) { adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)sAMObject); } - else if(sAMObject is AnalyticalModel) + else if (sAMObject is AnalyticalModel) { adjacencyCluster = ((AnalyticalModel)sAMObject).AdjacencyCluster; } @@ -179,4 +182,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, panels?.ConvertAll(x => new GooPanel(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeSpacesByPanels.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeSpacesByPanels.cs index cad8136e6..50d406be5 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeSpacesByPanels.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeSpacesByPanels.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalMergeSpacesByPanels : GH_SAMVariableOutputParameterCom /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -108,11 +111,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } AdjacencyCluster adjacencyCluster = null; - if(sAMObject is AdjacencyCluster) + if (sAMObject is AdjacencyCluster) { adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)sAMObject); } - else if(sAMObject is AnalyticalModel) + else if (sAMObject is AnalyticalModel) { adjacencyCluster = ((AnalyticalModel)sAMObject).AdjacencyCluster; } @@ -136,18 +139,18 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetDataList(index, panels); } - if(panels == null || panels.Count == 0) + if (panels == null || panels.Count == 0) { panels = null; } List panelTypes = new List(); - foreach(PanelType panelType in Enum.GetValues(typeof(PanelType))) + foreach (PanelType panelType in Enum.GetValues(typeof(PanelType))) { panelTypes.Add(panelType); } - List spaces_Result = adjacencyCluster.MergeSpaces(spaces?.FindAll(x => x != null).ConvertAll(x => x.Guid), out List panels_Result, panelTypes, panels?.ConvertAll(x => x.Guid)); + List spaces_Result = adjacencyCluster.MergeSpaces(spaces?.FindAll(x => x != null).ConvertAll(x => x.Guid), out List panels_Result, panelTypes, panels?.ConvertAll(x => x.Guid)); if (sAMObject is AdjacencyCluster) { @@ -171,4 +174,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, panels_Result.ConvertAll(x => new GooPanel(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeSpacesByZones.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeSpacesByZones.cs index 7ad74edd3..cffb993f0 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeSpacesByZones.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMergeSpacesByZones.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -24,7 +27,7 @@ public class SAMAnalyticalMergeSpacesByZones : GH_SAMVariableOutputParameterComp /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -116,11 +119,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } AdjacencyCluster adjacencyCluster = null; - if(sAMObject is AdjacencyCluster) + if (sAMObject is AdjacencyCluster) { adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)sAMObject); } - else if(sAMObject is AnalyticalModel) + else if (sAMObject is AnalyticalModel) { adjacencyCluster = ((AnalyticalModel)sAMObject).AdjacencyCluster; } @@ -134,7 +137,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) objectWrappers = new List(); if (dataAccess.GetDataList(index, objectWrappers) && objectWrappers != null) { - foreach(GH_ObjectWrapper objectWrapper in objectWrappers) + foreach (GH_ObjectWrapper objectWrapper in objectWrappers) { object value = objectWrapper.Value; if (value is IGH_Goo) @@ -142,14 +145,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) value = (value as dynamic).Value; } - if(value is Zone) + if (value is Zone) { zones.Add((Zone)value); } - else if(value is string) + else if (value is string) { Zone zone = adjacencyCluster.GetZones((string)value).FirstOrDefault(); - if(zone != null) + if (zone != null) { zones.Add(zone); } @@ -172,13 +175,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } List panelTypes = new List(); - if(airOnly) + if (airOnly) { panelTypes.Add(PanelType.Air); } else { - foreach(PanelType panelType in Enum.GetValues(typeof(PanelType))) + foreach (PanelType panelType in Enum.GetValues(typeof(PanelType))) { panelTypes.Add(panelType); } @@ -192,7 +195,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List panels_Result = null; List spaces_Result = null; - if(zones != null) + if (zones != null) { panels_Result = new List(); @@ -201,7 +204,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) foreach (Zone zone in zones) { List spaces = adjacencyCluster.GetRelatedObjects(zone); - if(spaces != null && spaces.Count > 1) + if (spaces != null && spaces.Count > 1) { List spaces_Merge = adjacencyCluster.MergeSpaces(out List panels_Merge, panelTypes, spaces?.FindAll(x => x != null).ConvertAll(x => x.Guid)); if (spaces_Merge != null) @@ -260,4 +263,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, panels_Result?.ConvertAll(x => new GooPanel(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyAirHandlingUnits.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyAirHandlingUnits.cs index ab398468d..919d140cf 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyAirHandlingUnits.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyAirHandlingUnits.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalModifyAirHandlingUnits : GH_SAMVariableOutputParameter /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -90,7 +93,7 @@ protected override GH_SAMParam[] Outputs protected override void SolveInstance(IGH_DataAccess dataAccess) { int index = -1; - + IAnalyticalObject analyticalObject = null; index = Params.IndexOfInputParam("_analytical"); if (index == -1 || !dataAccess.GetData(index, ref analyticalObject) || analyticalObject == null) @@ -118,7 +121,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { List objectWrappers = new List(); index = Params.IndexOfInputParam("_airHandlingUnits_"); - + if (index != -1) { dataAccess.GetDataList(index, objectWrappers); @@ -163,7 +166,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) airHandlingUnits = adjacencyCluster.GetObjects(); } - if(airHandlingUnits == null || airHandlingUnits.Count == 0) + if (airHandlingUnits == null || airHandlingUnits.Count == 0) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -292,9 +295,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) summerHeatingCoil = @bool; } - for (int i =0; i < airHandlingUnits.Count;i++) + for (int i = 0; i < airHandlingUnits.Count; i++) { - if(airHandlingUnits[i] == null) + if (airHandlingUnits[i] == null) { continue; } @@ -311,19 +314,19 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) airHandlingUnit.WinterSupplyTemperature = !double.IsNaN(winterSupplyTemperature) ? winterSupplyTemperature : airHandlingUnit.WinterSupplyTemperature; HeatingCoil frostCoil = airHandlingUnit.GetSimpleEquipments(FlowClassification.Supply)?.FirstOrDefault(); - if(frostCoil != null) + if (frostCoil != null) { frostCoil.WinterOffTemperature = !double.IsNaN(frostCoilOffTemperature) ? frostCoilOffTemperature : frostCoil.WinterOffTemperature; frostCoil.SummerOffTemperature = !double.IsNaN(frostCoilOffTemperature) ? frostCoilOffTemperature : frostCoil.SummerOffTemperature; } HeatRecoveryUnit heatRecoveryUnit = airHandlingUnit.GetSimpleEquipments(FlowClassification.Supply)?.FirstOrDefault(); - if(heatRecoveryUnit != null) + if (heatRecoveryUnit != null) { heatRecoveryUnit.WinterLatentEfficiency = !double.IsNaN(winterHeatRecoveryLatentEfficiency) ? winterHeatRecoveryLatentEfficiency : heatRecoveryUnit.WinterLatentEfficiency; heatRecoveryUnit.WinterDryBulbTemperature = !double.IsNaN(winterHeatRecoveryDryBulbTemperature) ? winterHeatRecoveryDryBulbTemperature : heatRecoveryUnit.WinterDryBulbTemperature; heatRecoveryUnit.WinterRelativeHumidity = !double.IsNaN(winterHeatRecoveryRelativeHumidity) ? winterHeatRecoveryRelativeHumidity : heatRecoveryUnit.WinterRelativeHumidity; - + heatRecoveryUnit.SummerSensibleEfficiency = !double.IsNaN(summerHeatRecoverySensibleEfficiency) ? summerHeatRecoverySensibleEfficiency : heatRecoveryUnit.SummerSensibleEfficiency; heatRecoveryUnit.SummerLatentEfficiency = !double.IsNaN(summerHeatRecoveryLatentEfficiency) ? summerHeatRecoveryLatentEfficiency : heatRecoveryUnit.SummerLatentEfficiency; heatRecoveryUnit.SummerDryBulbTemperature = !double.IsNaN(summerHeatRecoveryDryBulbTemperature) ? summerHeatRecoveryDryBulbTemperature : heatRecoveryUnit.SummerDryBulbTemperature; @@ -331,7 +334,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } CoolingCoil coolingCoil = airHandlingUnit.GetSimpleEquipments(FlowClassification.Supply)?.FirstOrDefault(); - if(coolingCoil != null) + if (coolingCoil != null) { coolingCoil.FluidSupplyTemperature = !double.IsNaN(coolingCoilFluidFlowTemperature) ? coolingCoilFluidFlowTemperature : coolingCoil.FluidSupplyTemperature; coolingCoil.FluidReturnTemperature = !double.IsNaN(coolingCoilFluidReturnTemperature) ? coolingCoilFluidReturnTemperature : coolingCoil.FluidReturnTemperature; @@ -339,7 +342,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } HeatingCoil heatingCoil = airHandlingUnit.GetSimpleEquipments(FlowClassification.Supply)?.FirstOrDefault(); - if(heatingCoil != null) + if (heatingCoil != null) { heatingCoil.FluidSupplyTemperature = !double.IsNaN(heatingCoilFluidFlowTemperature) ? heatingCoilFluidFlowTemperature : heatingCoil.FluidSupplyTemperature; heatingCoil.FluidReturnTemperature = !double.IsNaN(heatingCoilFluidReturnTemperature) ? heatingCoilFluidReturnTemperature : heatingCoil.FluidReturnTemperature; @@ -362,8 +365,8 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("analytical"); - if(index != -1) + if (index != -1) dataAccess.SetData(index, analyticalObject); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyInternalConditionByProfile.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyInternalConditionByProfile.cs index d0ef88a12..80a54b6cd 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyInternalConditionByProfile.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyInternalConditionByProfile.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -11,7 +14,7 @@ public class SAMAnalyticalModifyInternalConditionByProfile : GH_SAMVariableOutpu /// /// Gets the unique ID for this component. Do not change this ID after release. /// - public override Guid ComponentGuid => new ("6c2c620a-3932-456e-84f8-b0a4c210dfa5"); + public override Guid ComponentGuid => new("6c2c620a-3932-456e-84f8-b0a4c210dfa5"); /// /// The latest version of this component @@ -21,7 +24,7 @@ public class SAMAnalyticalModifyInternalConditionByProfile : GH_SAMVariableOutpu /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -42,10 +45,10 @@ protected override GH_SAMParam[] Inputs { List result = []; - GooAnalyticalModelParam gooAnalyticalModelParam = new () { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "SAM Analytical Model", Access = GH_ParamAccess.item }; + GooAnalyticalModelParam gooAnalyticalModelParam = new() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "SAM Analytical Model", Access = GH_ParamAccess.item }; result.Add(new GH_SAMParam(gooAnalyticalModelParam, ParamVisibility.Binding)); - GooProfileParam gooProfileParam = new () { Name = "_profile", NickName = "_profile", Description = "SAM Analytical Profile", Access = GH_ParamAccess.item }; + GooProfileParam gooProfileParam = new() { Name = "_profile", NickName = "_profile", Description = "SAM Analytical Profile", Access = GH_ParamAccess.item }; result.Add(new GH_SAMParam(gooProfileParam, ParamVisibility.Binding)); GooSpaceParam gooSpaceParam = new() { Name = "_spaces", NickName = "_spaces", Description = "SAM Analytical Spaces", Access = GH_ParamAccess.list }; @@ -94,7 +97,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } - if(profile.ProfileType == ProfileType.Undefined) + if (profile.ProfileType == ProfileType.Undefined) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Invalid ProfileType"); return; @@ -109,7 +112,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } ProfileLibrary profileLibrary = analyticalModel.ProfileLibrary; - if(profileLibrary == null) + if (profileLibrary == null) { profileLibrary = new ProfileLibrary(analyticalModel.Name); } @@ -117,10 +120,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) profileLibrary.Add(profile); AdjacencyCluster adjacencyCluster = analyticalModel.AdjacencyCluster; - if(adjacencyCluster != null) + if (adjacencyCluster != null) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster); - + foreach (Space space in spaces) { Space space_Temp = adjacencyCluster.GetObject(space.Guid); @@ -140,7 +143,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) ProfileType profileType = profile.ProfileType; internalCondition.SetProfileName(profileType, profile.Name); - if(profileType == ProfileType.Ventilation) + if (profileType == ProfileType.Ventilation) { internalCondition.RemoveValue(InternalConditionParameter.VentilationFunction); internalCondition.RemoveValue(InternalConditionParameter.VentilationFunctionDescription); @@ -163,4 +166,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyMechanicalSystems.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyMechanicalSystems.cs index db09e2457..c52f76f43 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyMechanicalSystems.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyMechanicalSystems.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalModifyMechanicalSystems : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -87,7 +90,7 @@ protected override void RegisterOutputParams(GH_OutputParamManager outputParamMa protected override void SolveInstance(IGH_DataAccess dataAccess) { IAnalyticalObject analyticalObject = null; - if(!dataAccess.GetData(0, ref analyticalObject) || analyticalObject == null) + if (!dataAccess.GetData(0, ref analyticalObject) || analyticalObject == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -121,7 +124,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List mechanicalSystems = new List(); AdjacencyCluster adjacencyCluster = null; - if(analyticalObject is AnalyticalModel) + if (analyticalObject is AnalyticalModel) { adjacencyCluster = ((AnalyticalModel)analyticalObject).AdjacencyCluster; } @@ -130,17 +133,17 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)analyticalObject); } - if(spaces == null || spaces.Count == 0) + if (spaces == null || spaces.Count == 0) { spaces = adjacencyCluster.GetSpaces(); } - if(spaces != null) + if (spaces != null) { if (ventilationSystemType != null) { MechanicalSystem mechanicalSystem = adjacencyCluster.AddMechanicalSystem(ventilationSystemType as VentilationSystemType, spaces); - if(mechanicalSystem != null) + if (mechanicalSystem != null) { mechanicalSystems.Add(mechanicalSystem); } @@ -164,24 +167,24 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(!string.IsNullOrWhiteSpace(supplyUnitName) || !string.IsNullOrWhiteSpace(exhaustUnitName)) + if (!string.IsNullOrWhiteSpace(supplyUnitName) || !string.IsNullOrWhiteSpace(exhaustUnitName)) { VentilationSystem ventilationSystem = null; - foreach(Space space in spaces) + foreach (Space space in spaces) { List ventilationSystems = adjacencyCluster.GetRelatedObjects(space); - if(ventilationSystems != null && ventilationSystems.Count != 0) + if (ventilationSystems != null && ventilationSystems.Count != 0) { - foreach(VentilationSystem ventilationSystem_Temp in ventilationSystems) + foreach (VentilationSystem ventilationSystem_Temp in ventilationSystems) { - if(ventilationSystem_Temp != null) + if (ventilationSystem_Temp != null) { ventilationSystem = ventilationSystem_Temp; break; } } - if(ventilationSystem != null) + if (ventilationSystem != null) { break; } @@ -189,14 +192,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } - if(ventilationSystem == null) + if (ventilationSystem == null) { ventilationSystem = adjacencyCluster.AddMechanicalSystem(systemTypeLibrary?.GetSystemTypes().FirstOrDefault(), spaces) as VentilationSystem; } - if(ventilationSystem != null) + if (ventilationSystem != null) { - if(!string.IsNullOrWhiteSpace(supplyUnitName)) + if (!string.IsNullOrWhiteSpace(supplyUnitName)) { ventilationSystem.SetValue(VentilationSystemParameter.SupplyUnitName, supplyUnitName); } @@ -211,11 +214,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(analyticalObject is AdjacencyCluster) + if (analyticalObject is AdjacencyCluster) { analyticalObject = adjacencyCluster; } - else if(analyticalObject is AnalyticalModel) + else if (analyticalObject is AnalyticalModel) { analyticalObject = new AnalyticalModel((AnalyticalModel)analyticalObject, adjacencyCluster); } @@ -224,4 +227,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(1, mechanicalSystems); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyObject.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyObject.cs index f128b4e31..a99775be4 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyObject.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyObject.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalModifyObject : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -72,7 +75,7 @@ protected override GH_SAMParam[] Outputs protected override void SolveInstance(IGH_DataAccess dataAccess) { int index = -1; - + SAMObject sAMObject = null; index = Params.IndexOfInputParam("_analytical"); if (index == -1 || !dataAccess.GetData(index, ref sAMObject) || sAMObject == null) @@ -86,10 +89,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (index != -1) dataAccess.GetDataList(index, sAMObjects); - if(sAMObjects != null && sAMObjects.Count != 0) + if (sAMObjects != null && sAMObjects.Count != 0) { AdjacencyCluster adjacencyCluster = null; - + if (sAMObject is AnalyticalModel) { AnalyticalModel analyticalModel = new AnalyticalModel((AnalyticalModel)sAMObject); @@ -112,7 +115,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } - if(adjacencyCluster != null) + if (adjacencyCluster != null) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster, true); @@ -190,7 +193,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) foreach (Space space in spaces) { InternalCondition internalCodintion_Space = space.InternalCondition; - if(internalCodintion_Space != null && internalCodintion_Space.Guid == internalCondition.Guid) + if (internalCodintion_Space != null && internalCodintion_Space.Guid == internalCondition.Guid) { space.InternalCondition = internalCondition; adjacencyCluster.AddObject(space); @@ -208,7 +211,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) adjacencyCluster.AddObject((IAnalyticalObject)sAMObject_Temp); } } - + if (sAMObject is AnalyticalModel) { sAMObject = new AnalyticalModel((AnalyticalModel)sAMObject, adjacencyCluster); @@ -221,8 +224,8 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("analytical"); - if(index != -1) + if (index != -1) dataAccess.SetData(index, sAMObject); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyProfileByNumberComparison.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyProfileByNumberComparison.cs index 253732989..dc5d0a046 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyProfileByNumberComparison.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyProfileByNumberComparison.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -24,7 +27,7 @@ public class SAMAnalyticalModifyProfileByNumberComparison : GH_SAMVariableOutput /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -46,14 +49,14 @@ protected override GH_SAMParam[] Inputs get { List result = new List(); - result.Add(new GH_SAMParam(new GooProfileParam() { Name = "_profile", NickName = "_profile", Description = "SAM Analytical Profile", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooProfileParam() { Name = "_profile", NickName = "_profile", Description = "SAM Analytical Profile", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); global::Grasshopper.Kernel.Parameters.Param_Boolean boolean = new global::Grasshopper.Kernel.Parameters.Param_Boolean() { Name = "_profileAsYearlyProfile_", NickName = "_profileAsYearlyProfile_", Description = "Profile As Yearly Profile", Access = GH_ParamAccess.item }; boolean.SetPersistentData(true); result.Add(new GH_SAMParam(boolean, ParamVisibility.Binding)); - + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_String { Name = "name_", NickName = "name_", Description = "Profile Name", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject { Name = "_values", NickName = "_values", Description = "Values or Profile", Access = GH_ParamAccess.list}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject { Name = "_values", NickName = "_values", Description = "Values or Profile", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_String { Name = "_numberComparisonType", NickName = "_numberComparisonType", Description = "NumberComparisonType", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject { Name = "_valuesComparison", NickName = "_valuesComparison", Description = "Comparison Values or Profile", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number { Name = "valueTrue_", NickName = "valueTrue_", Description = "True Value", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); @@ -104,7 +107,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } - if(convertToYearlyProfile) + if (convertToYearlyProfile) { profile = new Profile(profile, new IndexedDoubles(profile.GetYearlyValues())); } @@ -113,13 +116,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) string name = null; if (index != -1) { - if(!dataAccess.GetData(index, ref name)) + if (!dataAccess.GetData(index, ref name)) { name = null; } } - - if(name == null) + + if (name == null) { name = profile.Name; } @@ -132,7 +135,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } - if(!Core.Query.TryGetEnum(@string, out NumberComparisonType numberComparisonType)) + if (!Core.Query.TryGetEnum(@string, out NumberComparisonType numberComparisonType)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -160,7 +163,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List objectWrappers = null; - + index = Params.IndexOfInputParam("_values"); objectWrappers = new List(); if (index == -1 || !dataAccess.GetDataList(index, objectWrappers) || objectWrappers == null) @@ -170,27 +173,27 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } IndexedDoubles indexedDoubles_1 = new IndexedDoubles(); - for(int i =0; i < objectWrappers.Count; i++) + for (int i = 0; i < objectWrappers.Count; i++) { object @object = objectWrappers[i]?.Value; - if(@object is IGH_Goo) + if (@object is IGH_Goo) { @object = (@object as dynamic).Value; } - if(@object == null) + if (@object == null) { continue; } - if(Core.Query.IsNumeric(@object)) + if (Core.Query.IsNumeric(@object)) { - if(Core.Query.TryConvert(@object, out double value)) + if (Core.Query.TryConvert(@object, out double value)) { indexedDoubles_1.Add(i, value); } } - else if(@object is Profile) + else if (@object is Profile) { IndexedDoubles indexDoubles_Temp = ((Profile)@object).GetIndexedDoubles(); @@ -283,13 +286,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List indexesFalse = new List(); for (int i = profile.Min; i <= profile.Max; i++) { - if(indexedDoubles != null) + if (indexedDoubles != null) { indexedDoubles[i] = profile[i]; } double value_1 = profile_1[i]; - if(double.IsNaN(value_1)) + if (double.IsNaN(value_1)) { continue; } @@ -300,10 +303,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) continue; } - if(Core.Query.Compare(value_1, value_2, numberComparisonType)) + if (Core.Query.Compare(value_1, value_2, numberComparisonType)) { indexesTrue.Add(i); - if(!double.IsNaN(valueTrue)) + if (!double.IsNaN(valueTrue)) { indexedDoubles[i] = valueTrue; } @@ -320,12 +323,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } profile = new Profile(profile); - if(name != null) + if (name != null) { profile = new Profile(profile.Guid, profile, name, profile.Category); } - if(indexedDoubles != null) + if (indexedDoubles != null) { profile = new Profile(profile, indexedDoubles); } @@ -350,4 +353,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifySpaces.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifySpaces.cs index 70698911a..207190570 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifySpaces.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifySpaces.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalModifySpaces : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -84,7 +87,7 @@ protected override GH_SAMParam[] Outputs protected override void SolveInstance(IGH_DataAccess dataAccess) { int index = -1; - + SAMObject sAMObject = null; index = Params.IndexOfInputParam("_analytical"); if (index == -1 || !dataAccess.GetData(index, ref sAMObject) || sAMObject == null) @@ -213,9 +216,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) heatingSystemTypeName = @string; } - for(int i =0; i < spaces.Count;i++) + for (int i = 0; i < spaces.Count; i++) { - if(spaces[i] == null) + if (spaces[i] == null) { continue; } @@ -309,8 +312,8 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("analytical"); - if(index != -1) + if (index != -1) dataAccess.SetData(index, sAMObject); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyVentilationProfileByFunction.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyVentilationProfileByFunction.cs index f45c5008a..e904845f1 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyVentilationProfileByFunction.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyVentilationProfileByFunction.cs @@ -1,8 +1,8 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using Grasshopper.Kernel; -using Grasshopper.Kernel.Data; using Grasshopper.Kernel.Parameters; -using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -441,4 +441,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyZonesCategoryName.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyZonesCategoryName.cs index e1dd26fa9..5d8fcffb3 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyZonesCategoryName.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalModifyZonesCategoryName.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalModifyZonesCategoryName : GH_SAMVariableOutputParamete /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -81,7 +84,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_analytical"); IAnalyticalObject analyticalObject = null; - if(index == -1 || !dataAccess.GetData(index, ref analyticalObject) || analyticalObject == null) + if (index == -1 || !dataAccess.GetData(index, ref analyticalObject) || analyticalObject == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -96,12 +99,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) AdjacencyCluster adjacencyCluster = null; - if(analyticalObject is AnalyticalModel) + if (analyticalObject is AnalyticalModel) { AnalyticalModel analyticalModel = new AnalyticalModel((AnalyticalModel)analyticalObject); adjacencyCluster = analyticalModel.AdjacencyCluster; } - else if(analyticalObject is AdjacencyCluster) + else if (analyticalObject is AdjacencyCluster) { adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)analyticalObject); } @@ -113,13 +116,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) zones = adjacencyCluster.GetZones(); } - if(zones != null && zones.Count != 0 && zoneCategory != null) + if (zones != null && zones.Count != 0 && zoneCategory != null) { HashSet guids = new HashSet(zones.ConvertAll(x => x.Guid)); zones = adjacencyCluster.GetZones()?.FindAll(x => x != null && guids.Contains(x.Guid)); - for(int i =0; i < zones.Count; i++) + for (int i = 0; i < zones.Count; i++) { Zone zone = new Zone(zones[i]); @@ -153,4 +156,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMovePanel.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMovePanel.cs index 4062c53df..1f1a5d381 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMovePanel.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalMovePanel.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Rhino.Geometry; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -21,7 +24,7 @@ public class SAMAnalyticalMovePanel : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -80,4 +83,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, result); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalNCMSystemType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalNCMSystemType.cs index 3d3e854eb..61851ef5f 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalNCMSystemType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalNCMSystemType.cs @@ -1,4 +1,7 @@ -using SAM.Analytical.Grasshopper.Properties; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -19,7 +22,7 @@ public class SAMAnalyticalNCMSystemType : GH_SAMEnumComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Panel Type @@ -31,4 +34,4 @@ public SAMAnalyticalNCMSystemType() { } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalNormalsDisplay.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalNormalsDisplay.cs index 2a993316d..ca84678f0 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalNormalsDisplay.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalNormalsDisplay.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalNormalsDisplay : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -66,16 +69,16 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (sAMObject is AnalyticalModel) { planarBoundary3Ds = ((AnalyticalModel)sAMObject).AdjacencyCluster?.GetPanels()?.ConvertAll(x => x.PlanarBoundary3D); - } - else if(sAMObject is AdjacencyCluster) + } + else if (sAMObject is AdjacencyCluster) { planarBoundary3Ds = ((AdjacencyCluster)sAMObject).GetPanels()?.ConvertAll(x => x.PlanarBoundary3D); } - else if(sAMObject is Panel) + else if (sAMObject is Panel) { planarBoundary3Ds = new List() { ((Panel)sAMObject).PlanarBoundary3D }; } - else if(sAMObject is Aperture) + else if (sAMObject is Aperture) { planarBoundary3Ds = new List() { new PlanarBoundary3D(((Aperture)sAMObject).GetExternalEdge3D()) }; } @@ -86,13 +89,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List internalPoints = new List(); List normals = new List(); - foreach(PlanarBoundary3D planarBoundary3D in planarBoundary3Ds) + foreach (PlanarBoundary3D planarBoundary3D in planarBoundary3Ds) { global::Rhino.Geometry.Point3d internalPoint = global::Rhino.Geometry.Point3d.Unset; global::Rhino.Geometry.Vector3d normal = global::Rhino.Geometry.Vector3d.Unset; Face3D face3D = planarBoundary3D.GetFace3D(); - if(face3D != null) + if (face3D != null) { Point3D point3D = face3D.InternalPoint3D(); if (point3D != null) @@ -112,4 +115,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(1, normals); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalObjects.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalObjects.cs index 9fbcb958a..fcee5444a 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalObjects.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalObjects.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalObjects : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -72,7 +75,7 @@ protected override GH_SAMParam[] Outputs protected override void SolveInstance(IGH_DataAccess dataAccess) { int index = -1; - + SAMObject sAMObject = null; index = Params.IndexOfInputParam("_analytical"); if (index == -1 || !dataAccess.GetData(index, ref sAMObject) || sAMObject == null) @@ -84,10 +87,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) AdjacencyCluster adjacencyCluster = null; if (sAMObject is AnalyticalModel) adjacencyCluster = ((AnalyticalModel)sAMObject).AdjacencyCluster; - else if(sAMObject is AdjacencyCluster) + else if (sAMObject is AdjacencyCluster) adjacencyCluster = (AdjacencyCluster)sAMObject; - if(adjacencyCluster == null) + if (adjacencyCluster == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -95,11 +98,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) string fullTypeName = null; index = Params.IndexOfInputParam("_type_"); - if(index != -1) + if (index != -1) dataAccess.GetData(index, ref fullTypeName); Type type = null; - if(!string.IsNullOrWhiteSpace(fullTypeName)) + if (!string.IsNullOrWhiteSpace(fullTypeName)) { try { @@ -109,12 +112,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { type = null; } - + } - + index = Params.IndexOfOutputParam("Objects"); - if(index != -1) + if (index != -1) { List result = null; @@ -127,4 +130,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalOffsetAperturesOnEdge.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalOffsetAperturesOnEdge.cs index afc0f42ea..56901a573 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalOffsetAperturesOnEdge.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalOffsetAperturesOnEdge.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -20,7 +23,7 @@ public class SAMAnalyticalOffsetAperturesOnEdge : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -78,4 +81,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooPanel(panel)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalOffsetPanel.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalOffsetPanel.cs index 9031d7826..41d67226b 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalOffsetPanel.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalOffsetPanel.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalOffsetPanel : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -41,7 +44,7 @@ protected override GH_SAMParam[] Inputs get { List result = new List(); - result.Add(new GH_SAMParam(new GooPanelParam() { Name = "_panel", NickName = "_panel", Description = "SAM Analytical Panel", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooPanelParam() { Name = "_panel", NickName = "_panel", Description = "SAM Analytical Panel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); global::Grasshopper.Kernel.Parameters.Param_Number param_Number; @@ -128,4 +131,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, panel.Offset(offset, includeExternalEdge, includeInternalEdges, tolerance)?.ConvertAll(x => new GooPanel(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalOverlapPanels.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalOverlapPanels.cs index 4548e0126..a61663326 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalOverlapPanels.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalOverlapPanels.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using SAM.Analytical.Grasshopper.Properties; @@ -23,7 +26,7 @@ public class SAMAnalyticalOverlapPanels : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -99,4 +102,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataTree(0, dataTree_GooPanel); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelDistance.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelDistance.cs index 662f8ea18..2d904c7ce 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelDistance.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelDistance.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Rhino.Geometry; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -21,7 +24,7 @@ public class SAMAnalyticalPanelDistance : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -79,4 +82,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(1, panel.DistanceToEdges(point3D)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelGroup.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelGroup.cs index 2be8366f7..334685993 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelGroup.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelGroup.cs @@ -1,4 +1,7 @@ -using SAM.Analytical.Grasshopper.Properties; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -19,7 +22,7 @@ public class SAMAnalyticalPanelGroup : GH_SAMEnumComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Panel Type @@ -31,4 +34,4 @@ public SAMAnalyticalPanelGroup() { } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelLocation.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelLocation.cs index 1fd0f7ba0..8ab75ed4f 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelLocation.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelLocation.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -20,7 +23,7 @@ public class SAMAnalyticalPanelLocation : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -68,7 +71,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } Geometry.Spatial.Plane plane = panel.Plane; - if(panel == null) + if (panel == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -81,4 +84,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(4, Geometry.Rhino.Convert.ToRhino(panel.GetInternalPoint3D())); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelSpacing.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelSpacing.cs index 3080b26ab..5bff3af4d 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelSpacing.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelSpacing.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using SAM.Analytical.Grasshopper.Properties; @@ -26,7 +29,7 @@ public class SAMAnalyticalPanelSpacing : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -113,13 +116,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) Dictionary> dictionary = Analytical.Query.SpacingDictionary(panels, max, min); index = Params.IndexOfOutputParam("points"); - if(index != -1) + if (index != -1) { dataAccess.SetDataList(index, dictionary?.Keys.ToList().ConvertAll(x => Geometry.Rhino.Convert.ToRhino(x))); } index = Params.IndexOfOutputParam("panels"); - if(index != -1) + if (index != -1) { DataTree dataTree_Panel = new DataTree(); @@ -135,4 +138,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelType.cs index 93d52bd95..e26ea0982 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelType.cs @@ -1,4 +1,7 @@ -using SAM.Analytical.Grasshopper.Properties; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -19,7 +22,7 @@ public class SAMAnalyticalPanelType : GH_SAMEnumComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Panel Type Component @@ -31,4 +34,4 @@ public SAMAnalyticalPanelType() { } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelTypeByText.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelTypeByText.cs index 54686bee6..caa4cf06d 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelTypeByText.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelTypeByText.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -20,7 +23,7 @@ public class SAMAnalyticalPanelTypeByText : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -57,21 +60,21 @@ protected override void RegisterOutputParams(GH_OutputParamManager outputParamMa protected override void SolveInstance(IGH_DataAccess dataAccess) { string text = null; - if(!dataAccess.GetData(0, ref text) || string.IsNullOrEmpty(text)) + if (!dataAccess.GetData(0, ref text) || string.IsNullOrEmpty(text)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } PanelType panelType = Analytical.Query.PanelType(text, true); - if(panelType == PanelType.Undefined) + if (panelType == PanelType.Undefined) { text = text.ToLower().Trim(); - if(text.Contains("roof")) + if (text.Contains("roof")) { panelType = PanelType.Roof; } - else if(text.Contains("floor")) + else if (text.Contains("floor")) { panelType = PanelType.Floor; if (text.Contains("ext")) @@ -81,11 +84,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) else if (text.Contains("grd")) panelType = PanelType.SlabOnGrade; } - else if(text.Contains("shd")) + else if (text.Contains("shd")) { panelType = PanelType.Shade; } - else if(text.Contains("sol")) + else if (text.Contains("sol")) { panelType = PanelType.SolarPanel; @@ -95,7 +98,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) panelType = PanelType.Wall; if (text.Contains("ext")) panelType = PanelType.WallExternal; - else if(text.Contains("int")) + else if (text.Contains("int")) panelType = PanelType.WallInternal; } } @@ -103,4 +106,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, panelType.ToString()); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelsDifference.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelsDifference.cs index ffa6b3925..40e62ff2b 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelsDifference.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPanelsDifference.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalPanelsDifference : GH_SAMVariableOutputParameterCompon /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -47,7 +50,7 @@ protected override GH_SAMParam[] Inputs result.Add(new GH_SAMParam(new GooPanelParam { Name = "_panels", NickName = "_panels", Description = "SAM Analytical Panels", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooPanelParam { Name = "_cuttingPanels", NickName = "_cuttingPanels", Description = "SAM Analytical Panels", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); - global::Grasshopper.Kernel.Parameters.Param_Number number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_tolerance_", NickName = "_tolerance_", Description = "Tolerance", Access = GH_ParamAccess.item}; + global::Grasshopper.Kernel.Parameters.Param_Number number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_tolerance_", NickName = "_tolerance_", Description = "Tolerance", Access = GH_ParamAccess.item }; number.SetPersistentData(Tolerance.Distance); result.Add(new GH_SAMParam(number, ParamVisibility.Voluntary)); @@ -96,9 +99,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) double tolerance = Tolerance.MacroDistance; index = Params.IndexOfInputParam("_tolerance_"); - if(index != -1) + if (index != -1) { - if(!dataAccess.GetData(index, ref tolerance)) + if (!dataAccess.GetData(index, ref tolerance)) { tolerance = Tolerance.MacroDistance; } @@ -106,10 +109,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List panels_Result = new List(); - for (int i=0; i < panels.Count; i++) + for (int i = 0; i < panels.Count; i++) { List panels_Difference = Analytical.Query.Difference(panels[i], cuttingPanels, tolerance_Distance: tolerance); - if(panels_Difference == null || panels_Difference.Count == 0) + if (panels_Difference == null || panels_Difference.Count == 0) { continue; } @@ -124,4 +127,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPaths.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPaths.cs index 009adf1be..24b35a392 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPaths.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPaths.cs @@ -1,10 +1,12 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using System.Windows.Forms; @@ -25,7 +27,7 @@ public class SAMAnalyticalPaths : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -209,7 +211,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) void Menu_GoToDirectory(object sender, EventArgs e) { int index_Directory = Params.IndexOfInputParam("_directory_"); - if(index_Directory == -1) + if (index_Directory == -1) { return; } @@ -249,7 +251,7 @@ void Menu_GoToDirectory(object sender, EventArgs e) Core.Create.Directory(directory); - if(!System.IO.Directory.Exists(directory)) + if (!System.IO.Directory.Exists(directory)) { return; } @@ -260,15 +262,15 @@ void Menu_GoToDirectory(object sender, EventArgs e) void Menu_SetDefaultDirectory(object sender, EventArgs e) { int index = Params.IndexOfInputParam("_directory_"); - if(index != -1) + if (index != -1) { var param = Params.Input[index] as GH_PersistentParam; param.ClearData(); param.PersistentData.ClearData(); param.PersistentData.Append(new GH_String(System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "SAMSimulation"))); - + ExpireSolution(true); } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPerimeterSpaces.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPerimeterSpaces.cs index 35cae75d1..66261eef2 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPerimeterSpaces.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPerimeterSpaces.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalPerimeterSpaces : GH_SAMVariableOutputParameterCompone /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -94,7 +97,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } AdjacencyCluster adjacencyCluster = analyticalObject is AnalyticalModel ? ((AnalyticalModel)analyticalObject).AdjacencyCluster : analyticalObject as AdjacencyCluster; - if(adjacencyCluster != null) + if (adjacencyCluster != null) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster); } @@ -105,7 +108,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (index != -1) { bool apertureCheck_Temp = true; - if(dataAccess.GetData(index, ref apertureCheck_Temp)) + if (dataAccess.GetData(index, ref apertureCheck_Temp)) { apertureCheck = apertureCheck_Temp; } @@ -121,7 +124,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) wallsOnly = true; } - if(wallsOnly) + if (wallsOnly) { panelGroups = new List() { PanelGroup.Wall }; } @@ -129,7 +132,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List spaces = null; index = Params.IndexOfInputParam("spaces_"); - if(index != -1) + if (index != -1) { List spaces_Temp = new List(); @@ -156,7 +159,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { bool isPerimeter = adjacencyCluster.IsPerimeter(space, apertureCheck, panelGroups); - if(isPerimeter) + if (isPerimeter) { @in.Add(space); } @@ -180,4 +183,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPlanarBoundary3D.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPlanarBoundary3D.cs index 08f302b5c..3f6402251 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPlanarBoundary3D.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPlanarBoundary3D.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -20,7 +23,7 @@ public class SAMAnalyticalPlanarBoundary3D : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -66,4 +69,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooPlanarBoundary3D(((Panel)sAMObject).PlanarBoundary3D)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPlaneIntersection.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPlaneIntersection.cs index 0178909cb..fd0a6f1af 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPlaneIntersection.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalPlaneIntersection.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -25,7 +28,7 @@ public class SAMAnalyticalPlaneIntersection : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Intersect Panels with Plance and return SAM.Geometry Edge3Ds @@ -115,4 +118,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(0, edge3Ds.ToList().ConvertAll(x => new GooSAMGeometry(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalProfileBySpace.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalProfileBySpace.cs index 53bffe65d..4063fa572 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalProfileBySpace.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalProfileBySpace.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalProfileBySpace : GH_SAMVariableOutputParameterComponen /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -98,7 +101,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } - if(!Core.Query.TryGetEnum(profileTypeString, out ProfileType profileType)) + if (!Core.Query.TryGetEnum(profileTypeString, out ProfileType profileType)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -113,4 +116,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalProfileDivide.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalProfileDivide.cs index dd8a6d3df..8d96d07fa 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalProfileDivide.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalProfileDivide.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalProfileDivide : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -45,7 +48,7 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new GooProfileParam() { Name = "_profile", NickName = "_profile", Description = "SAM Analytical Profile", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject { Name = "_value", NickName = "_value", Description = "Value or Profile", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject { Name = "_value", NickName = "_value", Description = "Value or Profile", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); return result.ToArray(); } @@ -94,19 +97,19 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } object @object = objectWrapper.Value; - if(@object is IGH_Goo) + if (@object is IGH_Goo) { @object = (@object as dynamic).Value; } - if(Core.Query.IsNumeric(@object)) + if (Core.Query.IsNumeric(@object)) { - if(Core.Query.TryConvert(@object, out double value)) + if (Core.Query.TryConvert(@object, out double value)) { profile.Divide(value); } } - else if(@object is Profile) + else if (@object is Profile) { profile.Divide((Profile)@object); } @@ -118,4 +121,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalProfileGroup.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalProfileGroup.cs index 142345b16..063dcbd17 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalProfileGroup.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalProfileGroup.cs @@ -1,4 +1,7 @@ -using SAM.Analytical.Grasshopper.Properties; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -19,7 +22,7 @@ public class SAMAnalyticalProfileGroup : GH_SAMEnumComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Profile Group Component @@ -31,4 +34,4 @@ public SAMAnalyticalProfileGroup() { } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalProfileMultiply.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalProfileMultiply.cs index b2c3cddde..b07e9ae95 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalProfileMultiply.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalProfileMultiply.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalProfileMultiply : GH_SAMVariableOutputParameterCompone /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -45,7 +48,7 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new GooProfileParam() { Name = "_profile", NickName = "_profile", Description = "SAM Analytical Profile", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject { Name = "_value", NickName = "_value", Description = "Value or Profile", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject { Name = "_value", NickName = "_value", Description = "Value or Profile", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); return result.ToArray(); } @@ -94,19 +97,19 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } object @object = objectWrapper.Value; - if(@object is IGH_Goo) + if (@object is IGH_Goo) { @object = (@object as dynamic).Value; } - if(Core.Query.IsNumeric(@object)) + if (Core.Query.IsNumeric(@object)) { - if(Core.Query.TryConvert(@object, out double value)) + if (Core.Query.TryConvert(@object, out double value)) { profile.Multiply(value); } } - else if(@object is Profile) + else if (@object is Profile) { profile.Multiply((Profile)@object); } @@ -118,4 +121,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalProfileSum.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalProfileSum.cs index 8965e18f9..1dd9d2601 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalProfileSum.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalProfileSum.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalProfileSum : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -45,7 +48,7 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new GooProfileParam() { Name = "_profile", NickName = "_profile", Description = "SAM Analytical Profile", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject { Name = "_value", NickName = "_value", Description = "Value or Profile ", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject { Name = "_value", NickName = "_value", Description = "Value or Profile ", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); return result.ToArray(); } @@ -94,19 +97,19 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } object @object = objectWrapper.Value; - if(@object is IGH_Goo) + if (@object is IGH_Goo) { @object = (@object as dynamic).Value; } - if(Core.Query.IsNumeric(@object)) + if (Core.Query.IsNumeric(@object)) { - if(Core.Query.TryConvert(@object, out double value)) + if (Core.Query.TryConvert(@object, out double value)) { profile.Sum(value); } } - else if(@object is Profile) + else if (@object is Profile) { profile.Sum((Profile)@object); } @@ -118,4 +121,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalProfileType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalProfileType.cs index 749aaea1a..a0bbc4422 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalProfileType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalProfileType.cs @@ -1,4 +1,7 @@ -using SAM.Analytical.Grasshopper.Properties; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -19,7 +22,7 @@ public class SAMAnalyticalProfileType : GH_SAMEnumComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Clear Option Enum Component @@ -31,4 +34,4 @@ public SAMAnalyticalProfileType() { } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRelatedObjects.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRelatedObjects.cs index 2678850d2..892f09339 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRelatedObjects.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRelatedObjects.cs @@ -1,9 +1,12 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; -using System; -using System.Collections.Generic; using SAM.Core; using SAM.Core.Grasshopper; +using System; +using System.Collections.Generic; namespace SAM.Analytical.Grasshopper { @@ -22,7 +25,7 @@ public class SAMAnalyticalRelatedObjects : GH_SAMVariableOutputParameterComponen /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -77,7 +80,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) IAnalyticalObject analyticalObject = null; index = Params.IndexOfInputParam("_analytical"); - if(index == -1 || !dataAccess.GetData(index, ref analyticalObject) || analyticalObject == null) + if (index == -1 || !dataAccess.GetData(index, ref analyticalObject) || analyticalObject == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -89,7 +92,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) else if (analyticalObject is AnalyticalModel) adjacencyCluster = ((AnalyticalModel)analyticalObject).AdjacencyCluster; - if(adjacencyCluster == null) + if (adjacencyCluster == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -107,7 +110,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) Type type = null; index = Params.IndexOfInputParam("type_"); - if(index != -1) + if (index != -1) { string fullTypeName = null; if (dataAccess.GetData(index, ref fullTypeName)) @@ -136,18 +139,18 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) else result_Temp = adjacencyCluster.GetRelatedObjects(sAMObject, type); - if(result_Temp != null) + if (result_Temp != null) { - for(int i = result.Count - 1; i >= 0; i--) + for (int i = result.Count - 1; i >= 0; i--) { ISAMObject sAMBaseObject = result[i] as ISAMObject; - if(sAMBaseObject == null) + if (sAMBaseObject == null) { continue; } object @object = result_Temp.Find(x => x is ISAMObject && ((ISAMObject)x).Guid == sAMBaseObject.Guid); - if(@object == null) + if (@object == null) { result.RemoveAt(i); } @@ -160,4 +163,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, result); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemove.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemove.cs index 4eaf124d6..a0627dc88 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemove.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemove.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalRemove : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -42,7 +45,7 @@ protected override void RegisterInputParams(GH_InputParamManager inputParamManag int index = -1; inputParamManager.AddParameter(new GooAnalyticalObjectParam(), "_analyticalObject", "_analyticalObject", "SAM Analytical Object", GH_ParamAccess.item); - + index = inputParamManager.AddParameter(new GooAnalyticalObjectParam(), "_objects", "_objects", "SAM Objects", GH_ParamAccess.list); inputParamManager[index].DataMapping = GH_DataMapping.Flatten; } @@ -117,4 +120,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveAirMovementObjects.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveAirMovementObjects.cs index a18240bcc..1b48b4175 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveAirMovementObjects.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveAirMovementObjects.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Parameters; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalRemoveAirMovementObjects : GH_SAMVariableOutputParamet /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -70,7 +73,7 @@ protected override GH_SAMParam[] Outputs List result = new List(); result.Add(new GH_SAMParam(new GooAnalyticalObjectParam { Name = "analytical", NickName = "analytical", Description = "SAM Analytical", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new Param_Guid { Name = "guids", NickName = "guids", Description = "Guids of removed objects", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new Param_Boolean() { Name = "successful", NickName = "successful", Description = "Successful", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new Param_Boolean() { Name = "successful", NickName = "successful", Description = "Successful", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); return result.ToArray(); } @@ -109,9 +112,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) bool removeAHU = false; index = Params.IndexOfInputParam("removeAHU_"); - if(index != -1) + if (index != -1) { - if(!dataAccess.GetData(index, ref removeAHU)) + if (!dataAccess.GetData(index, ref removeAHU)) { removeAHU = false; } @@ -129,18 +132,18 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) guids = adjacencyCluster.RemoveAirMovementObjects(); successful = guids != null && guids.Count != 0; } - else if(analyticalObject is AnalyticalModel) + else if (analyticalObject is AnalyticalModel) { AnalyticalModel analyticalModel = (AnalyticalModel)analyticalObject; adjacencyCluster = analyticalModel.AdjacencyCluster; - if(adjacencyCluster != null) + if (adjacencyCluster != null) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster); } } - if(adjacencyCluster != null) + if (adjacencyCluster != null) { if (removeAHU) { @@ -195,4 +198,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveExternalSpaces.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveExternalSpaces.cs index aaa7620af..7b7f562b7 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveExternalSpaces.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveExternalSpaces.cs @@ -1,8 +1,9 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; -using SAM.Geometry.Grasshopper; -using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -23,7 +24,7 @@ public class SAMAnalyticalRemoveExternalSpaces : GH_SAMVariableOutputParameterCo /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -45,8 +46,8 @@ protected override GH_SAMParam[] Inputs get { List result = new List(); - result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "SAM AnalyticalModel", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooExternalSpaceParam() { Name = "_externalSpaces_", NickName = "_externalSpaces_", Description = "ExternalSpaces to be removed", Access = GH_ParamAccess.list, Optional = true}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "SAM AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooExternalSpaceParam() { Name = "_externalSpaces_", NickName = "_externalSpaces_", Description = "ExternalSpaces to be removed", Access = GH_ParamAccess.list, Optional = true }, ParamVisibility.Binding)); return result.ToArray(); } } @@ -91,7 +92,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } AdjacencyCluster adjacencyCluster = analyticalModel.AdjacencyCluster; - if(adjacencyCluster != null) + if (adjacencyCluster != null) { adjacencyCluster.RemoveExternalSpaces(externalSpaces); analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster); @@ -104,4 +105,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveFromConstructionManager.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveFromConstructionManager.cs index a686c539c..37ed5be97 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveFromConstructionManager.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveFromConstructionManager.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalRemoveFromConstructionManager : GH_SAMVariableOutputPa /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -90,7 +93,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) ConstructionManager constructionManager = null; index = Params.IndexOfInputParam("_constructionManager"); - if(index == -1 || !dataAccess.GetData(index, ref constructionManager) || constructionManager == null) + if (index == -1 || !dataAccess.GetData(index, ref constructionManager) || constructionManager == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -183,4 +186,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveInternalEdges.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveInternalEdges.cs index 4682fedad..8d0831cb0 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveInternalEdges.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveInternalEdges.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalRemoveInternalEdges : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -58,7 +61,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (!dataAccess.GetData(0, ref sAMObject)) return; - if(sAMObject is Panel) + if (sAMObject is Panel) { Panel panel = Create.Panel((Panel)sAMObject); panel = Create.Panel(panel.Guid, panel, new Face3D(panel.GetFace3D().GetExternalEdge3D()), null, false); @@ -94,16 +97,16 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) foreach (Panel panel in panels_Updated) adjacencyCluster.AddObject(panel); } - - if(analyticalModel == null && adjacencyCluster == null) + + if (analyticalModel == null && adjacencyCluster == null) { dataAccess.SetData(0, sAMObject); return; } - if(analyticalModel != null) + if (analyticalModel != null) { - if(adjacencyCluster == null) + if (adjacencyCluster == null) { dataAccess.SetData(0, sAMObject); return; @@ -117,4 +120,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, adjacencyCluster); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveOpeningProperties.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveOpeningProperties.cs index f64403c23..0e3210b67 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveOpeningProperties.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveOpeningProperties.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalRemoveOpeningProperties : GH_SAMVariableOutputParamete /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -85,9 +88,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List apertures = []; index = Params.IndexOfInputParam("apertures_"); - if(index != -1) + if (index != -1) { - if(!dataAccess.GetDataList(index, apertures)) + if (!dataAccess.GetDataList(index, apertures)) { apertures = []; } @@ -99,18 +102,18 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)analyticalObject, true); } - else if(analyticalObject is AnalyticalModel) + else if (analyticalObject is AnalyticalModel) { AnalyticalModel analyticalModel = (AnalyticalModel)analyticalObject; adjacencyCluster = analyticalModel.AdjacencyCluster; - if(adjacencyCluster != null) + if (adjacencyCluster != null) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster, true); } } - if(adjacencyCluster is null) + if (adjacencyCluster is null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -122,14 +125,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) apertures = adjacencyCluster.GetApertures(); } - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { - if(adjacencyCluster.GetPanel(aperture) is not Panel panel) + if (adjacencyCluster.GetPanel(aperture) is not Panel panel) { continue; } - if(!aperture.RemoveValue(ApertureParameter.OpeningProperties)) + if (!aperture.RemoveValue(ApertureParameter.OpeningProperties)) { continue; } @@ -143,11 +146,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) adjacencyCluster.AddObject(panel); } - if(analyticalObject is AdjacencyCluster) + if (analyticalObject is AdjacencyCluster) { analyticalObject = adjacencyCluster; } - else if(analyticalObject is AnalyticalModel analyticalModel_Temp) + else if (analyticalObject is AnalyticalModel analyticalModel_Temp) { analyticalObject = new AnalyticalModel(analyticalModel_Temp, adjacencyCluster); } @@ -159,4 +162,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveOverlapApertures.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveOverlapApertures.cs index 90303260f..8daae0698 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveOverlapApertures.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveOverlapApertures.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalRemoveOverlapApertures : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -102,13 +105,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) Analytical.Modify.RemoveOverlapApertures(panels, out removedApertures, tolerance); - for(int i=0; i < adjacencyClusters.Count; i++) + for (int i = 0; i < adjacencyClusters.Count; i++) { adjacencyClusters[i] = new AdjacencyCluster(adjacencyClusters[i]); Analytical.Modify.RemoveOverlapApertures(adjacencyClusters[i], out List removedApertures_Temp, tolerance); - if(removedApertures_Temp != null && removedApertures_Temp.Count > 0) + if (removedApertures_Temp != null && removedApertures_Temp.Count > 0) { - if(removedApertures == null) + if (removedApertures == null) { removedApertures = new List(); } @@ -150,4 +153,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(1, removedApertures?.ConvertAll(x => new GooAperture(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveSpaces.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveSpaces.cs index 8c771bcbe..936d6e380 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveSpaces.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveSpaces.cs @@ -1,5 +1,7 @@ -using Grasshopper.Kernel; -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -25,7 +27,7 @@ public class SAMAnalyticalRemoveSpaces : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -48,7 +50,7 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new GooAnalyticalObjectParam() { Name = "_analytical", NickName = "_analytical", Description = "SAM Analytical Object such as AdjacencyCluster or AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new Geometry.Grasshopper.GooSAMGeometryParam { Name = "points_", NickName = "points_", Description = "Points", Access = GH_ParamAccess.list, Optional = true}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new Geometry.Grasshopper.GooSAMGeometryParam { Name = "points_", NickName = "points_", Description = "Points", Access = GH_ParamAccess.list, Optional = true }, ParamVisibility.Binding)); global::Grasshopper.Kernel.Parameters.Param_Boolean boolean = new global::Grasshopper.Kernel.Parameters.Param_Boolean { Name = "_removeExtPanels_", NickName = "_removeExtPanels_", Description = "Remove External Panels", Access = GH_ParamAccess.item, Optional = true }; boolean.SetPersistentData(true); @@ -83,14 +85,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index = -1; index = Params.IndexOfInputParam("_analytical"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } - + SAMObject sAMObject_Temp = null; - if(!dataAccess.GetData(index, ref sAMObject_Temp) || sAMObject_Temp == null) + if (!dataAccess.GetData(index, ref sAMObject_Temp) || sAMObject_Temp == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -109,7 +111,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) adjacencyCluster = analyticalModel.AdjacencyCluster; } - if(adjacencyCluster == null) + if (adjacencyCluster == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -118,14 +120,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List sAMGeometries = []; index = Params.IndexOfInputParam("points_"); - if(index != -1) + if (index != -1) { dataAccess.GetDataList(index, sAMGeometries); } bool removePanels = true; index = Params.IndexOfInputParam("_removeExtPanels_"); - if(index != -1) + if (index != -1) { dataAccess.GetData(index, ref removePanels); } @@ -133,11 +135,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) Dictionary dictionary = adjacencyCluster?.ShellDictionary(); List result = []; - if(sAMGeometries != null) + if (sAMGeometries != null) { foreach (ISAMGeometry sAMGeometry in sAMGeometries) { - if(sAMGeometry is not Point3D point3D) + if (sAMGeometry is not Point3D point3D) { continue; } @@ -214,4 +216,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveSpacesByBrep.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveSpacesByBrep.cs index 26f536be9..134da748d 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveSpacesByBrep.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRemoveSpacesByBrep.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalRemoveSpacesByBrep : GH_SAMVariableOutputParameterComp /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -46,7 +49,7 @@ protected override GH_SAMParam[] Inputs { List result = []; - GooAnalyticalObjectParam gooAnalyticalObjectParam = new () { Name = "_analyticalObject", NickName = "_analyticalObject", Description = "SAM AdjacencyCluster or AnalyticalModel", Access = GH_ParamAccess.item }; + GooAnalyticalObjectParam gooAnalyticalObjectParam = new() { Name = "_analyticalObject", NickName = "_analyticalObject", Description = "SAM AdjacencyCluster or AnalyticalModel", Access = GH_ParamAccess.item }; result.Add(new GH_SAMParam(gooAnalyticalObjectParam, ParamVisibility.Binding)); global::Grasshopper.Kernel.Parameters.Param_GenericObject genericObject = new() @@ -107,11 +110,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } - if(analyticalObject is AdjacencyCluster adjacencyCluster) + if (analyticalObject is AdjacencyCluster adjacencyCluster) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster); } - else if(analyticalObject is AnalyticalModel analyticalModel) + else if (analyticalObject is AnalyticalModel analyticalModel) { adjacencyCluster = new AdjacencyCluster(analyticalModel.AdjacencyCluster); } @@ -154,11 +157,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List spaces = Analytical.Modify.RemoveSpaces(adjacencyCluster, shells.ConvertAll(x => x.InternalPoint3D(silverSpacing, tolerance)), silverSpacing, tolerance); - if(analyticalObject is AdjacencyCluster) + if (analyticalObject is AdjacencyCluster) { analyticalObject = adjacencyCluster; } - else if(analyticalObject is AnalyticalModel analyticalModel) + else if (analyticalObject is AnalyticalModel analyticalModel) { analyticalObject = new AnalyticalModel(analyticalModel, adjacencyCluster); } @@ -176,4 +179,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRenameAnalyticalModel.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRenameAnalyticalModel.cs index c2f721012..3d65d4a1c 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRenameAnalyticalModel.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRenameAnalyticalModel.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -130,4 +133,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRenameConstruction.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRenameConstruction.cs index 7ca2d2c13..d521bef0a 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRenameConstruction.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRenameConstruction.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalRenameConstruction : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -162,4 +165,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(0, result.ConvertAll(x => new GooConstruction(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalReplaceObject.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalReplaceObject.cs index 92e9b1a8e..c11e41288 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalReplaceObject.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalReplaceObject.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalReplaceObject : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -41,8 +44,8 @@ protected override GH_SAMParam[] Inputs List result = new List(); result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "SAM AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooSAMObjectParam() { Name = "_existingObjects", NickName = "_existingObjects", Description = "SAM Objects", Access = GH_ParamAccess.list}, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooSAMObjectParam() { Name = "_newObjects", NickName = "_newObjects", Description = "SAM Objects", Access = GH_ParamAccess.list}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooSAMObjectParam() { Name = "_existingObjects", NickName = "_existingObjects", Description = "SAM Objects", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooSAMObjectParam() { Name = "_newObjects", NickName = "_newObjects", Description = "SAM Objects", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooConstructionManagerParam() { Name = "constructionManager_", NickName = "constructionManager_", Description = "SAM Analytical Construction Manager", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); @@ -51,7 +54,7 @@ protected override GH_SAMParam[] Inputs @boolean = new global::Grasshopper.Kernel.Parameters.Param_Boolean() { Name = "_run", NickName = "_run", Description = "Connect a boolean toggle to run.", Access = GH_ParamAccess.item }; @boolean.SetPersistentData(false); result.Add(new GH_SAMParam(@boolean, ParamVisibility.Binding)); - + return result.ToArray(); } } @@ -75,7 +78,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) bool run = false; index = Params.IndexOfInputParam("_run"); - if(index != -1 ) + if (index != -1) { dataAccess.GetData(index, ref run); } @@ -111,7 +114,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } - if(sAMObject_Existing.Count != sAMObject_New.Count) + if (sAMObject_Existing.Count != sAMObject_New.Count) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -124,13 +127,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetData(index, ref constructionManager); } - if(constructionManager == null) + if (constructionManager == null) { constructionManager = Analytical.Query.DefaultConstructionManager(); } AdjacencyCluster adjacencyCluster = analyticalModel.AdjacencyCluster; - if(adjacencyCluster != null) + if (adjacencyCluster != null) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster, true); } @@ -139,27 +142,27 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) ProfileLibrary profileLibrary = analyticalModel.ProfileLibrary; - for(int i =0; i < sAMObject_Existing.Count; i++) + for (int i = 0; i < sAMObject_Existing.Count; i++) { IJSAMObject jSAMObject_Existing = sAMObject_Existing[i]; IJSAMObject jSAMObject_New = sAMObject_New[i]; - if(sAMObject_Existing == null || sAMObject_New == null) + if (sAMObject_Existing == null || sAMObject_New == null) { continue; } - if(jSAMObject_Existing is ApertureConstruction) + if (jSAMObject_Existing is ApertureConstruction) { bool replaced = Analytical.Modify.Replace(adjacencyCluster, (ApertureConstruction)jSAMObject_Existing, jSAMObject_New as ApertureConstruction); - if(replaced) + if (replaced) { ApertureConstruction apertureConstruction = (ApertureConstruction)jSAMObject_New; List materials = constructionManager.GetMaterials(apertureConstruction); - if(materials != null) + if (materials != null) { - foreach(IMaterial material in materials) + foreach (IMaterial material in materials) { - if(!materialLibrary.Contains(material)) + if (!materialLibrary.Contains(material)) { materialLibrary.Add(material); } @@ -167,7 +170,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } List names = materialLibrary.MissingMaterialsNames(apertureConstruction); - if(names != null && names.Count > 0) + if (names != null && names.Count > 0) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, string.Format("Fllowing materials are missing: {0}", string.Join(", ", names))); } @@ -232,4 +235,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalReportRooms.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalReportRooms.cs index 9c64a9638..571912791 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalReportRooms.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalReportRooms.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Parameters; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -65,8 +68,8 @@ protected override GH_SAMParam[] Inputs { List result = []; - result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "Source SAM AnalyticalModel", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "spaces_", NickName = "spaces_", Description = "SAM Spaces", Access = GH_ParamAccess.list, Optional = true}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "Source SAM AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "spaces_", NickName = "spaces_", Description = "SAM Spaces", Access = GH_ParamAccess.list, Optional = true }, ParamVisibility.Binding)); return [.. result]; } @@ -150,7 +153,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { int index = -1; - AnalyticalModel analyticalModel= null; + AnalyticalModel analyticalModel = null; index = Params.IndexOfInputParam("_analyticalModel"); if (index == -1 || !dataAccess.GetData(index, ref analyticalModel)) { @@ -169,7 +172,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetDataList(index, spaces); } - if(spaces is null || spaces.Count == 0) + if (spaces is null || spaces.Count == 0) { spaces = adjacencyCluster.GetSpaces(); } @@ -191,7 +194,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List openingsEffectiveEfficiency = []; List openingsEffectiveAreaToFloorAreaRatios = []; List openingsProfileNames = []; - for (int i =0; i < spaces.Count; i++) + for (int i = 0; i < spaces.Count; i++) { if (spaces[i] == null) { @@ -202,7 +205,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) double floorArea = space?.GetValue(SpaceParameter.Area) ?? double.NaN; - if(double.IsNaN(floorArea)) + if (double.IsNaN(floorArea)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, string.Format("Area of space {0} [{1}] has not been provided.", space.Name ?? "???", space.Guid)); } @@ -222,14 +225,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List openingProfileNames = []; List panels = adjacencyCluster.GetPanels(space); - if(panels != null) + if (panels != null) { foreach (Panel panel in panels) { bool external = panel.IsExternal() && Analytical.Query.BoundaryType(adjacencyCluster, panel) == BoundaryType.Exposed; if (external) { - double area = panel.GetArea(); + double area = panel.GetArea(); if (panel.PanelType.PanelGroup() == PanelGroup.Wall) { @@ -238,11 +241,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) externalPanelsArea += area; - if(panel.Apertures is List apertures) + if (panel.Apertures is List apertures) { foreach (Aperture aperture in apertures) { - if(!Analytical.Query.Transparent(aperture, materialLibrary)) + if (!Analytical.Query.Transparent(aperture, materialLibrary)) { continue; } @@ -251,14 +254,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) framesArea += aperture.GetArea(AperturePart.Frame); - if(aperture.TryGetValue(ApertureParameter.TotalSolarEnergyTransmittance, out double totalSolarEnergyTransmittance) && totalSolarEnergyTransmittance > windowTotalSolarEnergyTransmittance) + if (aperture.TryGetValue(ApertureParameter.TotalSolarEnergyTransmittance, out double totalSolarEnergyTransmittance) && totalSolarEnergyTransmittance > windowTotalSolarEnergyTransmittance) { windowTotalSolarEnergyTransmittance = totalSolarEnergyTransmittance; } - if(aperture.TryGetValue(ApertureParameter.OpeningProperties, out IOpeningProperties openingProperties) && openingProperties != null) + if (aperture.TryGetValue(ApertureParameter.OpeningProperties, out IOpeningProperties openingProperties) && openingProperties != null) { - if(openingProperties.TryGetValue(OpeningPropertiesParameter.Function, out string function)) + if (openingProperties.TryGetValue(OpeningPropertiesParameter.Function, out string function)) { openingProfileNames.Add(function); } @@ -388,4 +391,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalReportRoomsList.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalReportRoomsList.cs index 1bf4df3c4..4a365cd07 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalReportRoomsList.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalReportRoomsList.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using Grasshopper.Kernel.Parameters; @@ -8,7 +11,6 @@ using SAM.Core.Grasshopper; using System; using System.Collections.Generic; -using System.Linq; namespace SAM.Analytical.Grasshopper { @@ -48,8 +50,8 @@ protected override GH_SAMParam[] Inputs { List result = []; - result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "Source SAM AnalyticalModel", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "spaces_", NickName = "spaces_", Description = "SAM Spaces", Access = GH_ParamAccess.list, Optional = true}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "Source SAM AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "spaces_", NickName = "spaces_", Description = "SAM Spaces", Access = GH_ParamAccess.list, Optional = true }, ParamVisibility.Binding)); return [.. result]; } @@ -69,7 +71,7 @@ protected override GH_SAMParam[] Outputs result.Add(new GH_SAMParam(new Param_String() { Name = "LevelName", NickName = "LevelName", Description = "Space Level Name", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new Param_Number() { Name = "ExternalPanelsArea", NickName = "ExternalPanelsArea", Description = "External Panels Area [m2]", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new Param_Number() { Name = "ExternalWallArea", NickName = "ExternalWallArea", Description = "External Wall Area [m2]", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); - + result.Add(new GH_SAMParam(new Param_Number() { Name = "WindowArea", NickName = "WindowArea", Description = "Window Area [m2]", Access = GH_ParamAccess.tree }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new Param_Number() { Name = "WindowToWallRatio", NickName = "WindowToWallRatio", Description = "Window To Wall Ratio [%]", Access = GH_ParamAccess.tree }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new Param_Number() { Name = "Window-gValue", NickName = "Window-gValue", Description = "Window gValue [0 - 1 max]", Access = GH_ParamAccess.tree }, ParamVisibility.Binding)); @@ -80,7 +82,7 @@ protected override GH_SAMParam[] Outputs result.Add(new GH_SAMParam(new Param_Number() { Name = "OpeningEffectiveEfficiency", NickName = "OpeningEffectiveEfficiency", Description = "Opening Effective Efficiency [%]", Access = GH_ParamAccess.tree }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new Param_Number() { Name = "OpeningEffectiveAreaToFloorAreaRatio", NickName = "OpeningEffectiveAreaToFloorAreaRatio", Description = "Opening Effective Area To Floor Area Ratio [%]", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new Param_String() { Name = "OpeningProfileName", NickName = "OpeningProfile", Description = "Opening Profile Name", Access = GH_ParamAccess.tree }, ParamVisibility.Binding)); - + return [.. result]; } } @@ -95,7 +97,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { int index = -1; - AnalyticalModel analyticalModel= null; + AnalyticalModel analyticalModel = null; index = Params.IndexOfInputParam("_analyticalModel"); if (index == -1 || !dataAccess.GetData(index, ref analyticalModel)) { @@ -114,7 +116,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetDataList(index, spaces); } - if(spaces is null || spaces.Count == 0) + if (spaces is null || spaces.Count == 0) { spaces = adjacencyCluster.GetSpaces(); } @@ -129,7 +131,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List windowsAreas = []; List windowToWallRatios = []; - DataTree windowsAreas_DataTree = new (); + DataTree windowsAreas_DataTree = new(); DataTree windowTotalSolarEnergyTransmittances = new(); @@ -140,8 +142,8 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) DataTree openingsEffectiveEfficiency = new(); List openingsEffectiveAreaToFloorAreaRatios = []; DataTree openingsProfileNames = new(); - - for (int i =0; i < spaces.Count; i++) + + for (int i = 0; i < spaces.Count; i++) { if (spaces[i] == null) { @@ -154,7 +156,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) double floorArea = space?.GetValue(SpaceParameter.Area) ?? double.NaN; - if(double.IsNaN(floorArea)) + if (double.IsNaN(floorArea)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, string.Format("Area of space {0} [{1}] has not been provided.", space.Name ?? "???", space.Guid)); } @@ -172,16 +174,16 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) double openingsEffectiveArea = 0; List panels = adjacencyCluster.GetPanels(space); - if(panels != null) + if (panels != null) { - for(int j =0; j < panels.Count; j++) + for (int j = 0; j < panels.Count; j++) { Panel panel = panels[j]; bool external = panel.IsExternal() && Analytical.Query.BoundaryType(adjacencyCluster, panel) == BoundaryType.Exposed; if (external) { - double area = panel.GetArea(); + double area = panel.GetArea(); if (panel.PanelType.PanelGroup() == PanelGroup.Wall) { @@ -190,11 +192,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) externalPanelsArea += area; - if(panel.Apertures is List apertures) + if (panel.Apertures is List apertures) { foreach (Aperture aperture in apertures) { - if(!Analytical.Query.Transparent(aperture, materialLibrary)) + if (!Analytical.Query.Transparent(aperture, materialLibrary)) { continue; } @@ -342,4 +344,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalReportSpaces.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalReportSpaces.cs index 9e57af3b7..e1cc93e69 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalReportSpaces.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalReportSpaces.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Parameters; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -24,7 +27,7 @@ public class SAMAnalyticalReportSpaces : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -59,7 +62,7 @@ protected override GH_SAMParam[] Outputs get { List result = new List(); - + result.Add(new GH_SAMParam(new Param_String() { Name = "Name", NickName = "Name", Description = "Space Name", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new Param_Guid() { Name = "Guid", NickName = "Guid", Description = "Space Guid", Access = GH_ParamAccess.list }, ParamVisibility.Voluntary)); result.Add(new GH_SAMParam(new Param_Number() { Name = "Area", NickName = "Area", Description = "Space Area", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); @@ -175,7 +178,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List names_Level = new List(); List infiltrations = new List(); - List names_Infiltration= new List(); + List names_Infiltration = new List(); List guids_Infiltration = new List(); List occupancySensibleGains = new List(); @@ -218,7 +221,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List names_Dehumidification = new List(); List guids_Dehumidification = new List(); - List names_InternalCondition= new List(); + List names_InternalCondition = new List(); List guids_InternalCondition = new List(); List names_VentilationSystemType = new List(); @@ -295,7 +298,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) occupancySensibleGainsPerArea.Add(double.IsNaN(occupancySensibleGain) || double.IsNaN(area) || area == 0 ? double.NaN : occupancySensibleGain / area); double occupancyLatentGain = Analytical.Query.OccupancyLatentGain(space); - + occupancyLatentGains.Add(occupancyLatentGain); occupancyLatentGainsPerPerson.Add(double.IsNaN(occupancyLatentGain) || double.IsNaN(occupancy) || occupancy == 0 ? double.NaN : occupancyLatentGain / occupancy); occupancyLatentGainsPerArea.Add(double.IsNaN(occupancyLatentGain) || double.IsNaN(area) || area == 0 ? double.NaN : occupancyLatentGain / area); @@ -425,7 +428,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) names_SupplyUnit.Add(@string); supplyAirFlows.Add(Analytical.Query.CalculatedSupplyAirFlow(space)); - + if (ventilationSystem == null || !ventilationSystem.TryGetValue(VentilationSystemParameter.ExhaustUnitName, out @string)) @string = null; @@ -656,4 +659,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, exhaustAirFlows); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRoundAzimuth.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRoundAzimuth.cs index 06adc8f7f..f8c9550b4 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRoundAzimuth.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalRoundAzimuth.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using SAM.Geometry.Spatial; @@ -22,7 +25,7 @@ public class SAMAnalyticalRoundAzimuth : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -41,12 +44,12 @@ protected override GH_SAMParam[] Inputs param_Number.PersistentData.Append(new global::Grasshopper.Kernel.Types.GH_Number(180)); param_Number.PersistentData.Append(new global::Grasshopper.Kernel.Types.GH_Number(270)); param_Number.PersistentData.Append(new global::Grasshopper.Kernel.Types.GH_Number(360)); - result.Add( new GH_SAMParam(param_Number, ParamVisibility.Voluntary) ); + result.Add(new GH_SAMParam(param_Number, ParamVisibility.Voluntary)); param_Number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_range_", NickName = "_range_", Description = "Range +-", Access = GH_ParamAccess.item, Optional = true }; param_Number.PersistentData.Append(new global::Grasshopper.Kernel.Types.GH_Number(5)); result.Add(new GH_SAMParam(param_Number, ParamVisibility.Voluntary)); - + return result.ToArray(); } } @@ -56,7 +59,7 @@ protected override GH_SAMParam[] Outputs get { List result = new List(); - result.Add(new GH_SAMParam(new GooPanelParam() {Name = "panel", NickName = "panel", Description = "SAM Analytical Panel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooPanelParam() { Name = "panel", NickName = "panel", Description = "SAM Analytical Panel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); return result.ToArray(); } } @@ -76,7 +79,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_panel"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -104,7 +107,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } Face3D face3D = panel?.GetFace3D(); - if(face3D != null) + if (face3D != null) { Point3D point3D = face3D?.GetCentroid(); @@ -113,19 +116,19 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) Plane plane = Plane.WorldXY; normal = plane.Project(normal); - if(normal.Length > 0.5) + if (normal.Length > 0.5) { double rad_Range = range * System.Math.PI / 180; double rad = normal.Angle(Vector3D.WorldX); - foreach(double angle_Temp in angles) + foreach (double angle_Temp in angles) { double rad_Temp = angle_Temp * System.Math.PI / 180; if (rad > rad_Temp - rad_Range && rad < rad_Temp + rad_Range) { double difference = rad_Temp - rad; - if(System.Math.Abs(difference) > Core.Tolerance.Distance) + if (System.Math.Abs(difference) > Core.Tolerance.Distance) { Panel panel_1 = Create.Panel(panel); panel_1.Transform(Transform3D.GetRotation(point3D, Vector3D.WorldZ, -difference)); @@ -154,4 +157,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSeasonProfileBySetPoint.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSeasonProfileBySetPoint.cs index b12505447..384e8927d 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSeasonProfileBySetPoint.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSeasonProfileBySetPoint.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Parameters; using SAM.Analytical.Grasshopper.Properties; @@ -27,7 +30,7 @@ public class SAMAnalyticalSeasonProfileBySetPoint : GH_SAMVariableOutputParamete /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -83,7 +86,7 @@ protected override GH_SAMParam[] Outputs { List result = new List(); result.Add(new GH_SAMParam(new Param_String { Name = "stringProfile", NickName = "stringProfile", Description = "String Profile", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); - + result.Add(new GH_SAMParam(new GooProfileParam() { Name = "heatingProfile", NickName = "heatingProfile", Description = "SAM Analytical Heating Profile", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new Param_Integer() { Name = "heatingHourIndex", NickName = "heatingHourIndex", Description = "Heating Hour Index", Access = GH_ParamAccess.tree }, ParamVisibility.Binding)); @@ -133,7 +136,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_coolingSeasonSetPoint"); double coolingTemperature = double.NaN; - if(index != -1) + if (index != -1) { if (!dataAccess.GetData(index, ref coolingTemperature)) { @@ -160,20 +163,20 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) continue; } - if(freeCoolingProfile == null ? false : freeCoolingProfile[i] == 1) + if (freeCoolingProfile == null ? false : freeCoolingProfile[i] == 1) { seasonTypes[i] = SeasonType.FreeCooling; continue; } - if(coolingProfile == null ? false : coolingProfile[i] == 1) + if (coolingProfile == null ? false : coolingProfile[i] == 1) { seasonTypes[i] = SeasonType.Cooling; continue; - } + } } - if(heatingProfile != null) + if (heatingProfile != null) { dataTree_HeatingHourIndex = Query.DataTree(heatingProfile.GetValues().ToList().ConvertAll(x => x == 1)); } @@ -220,4 +223,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataTree(index, dataTree_FreeCoolingHourIndex); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSection.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSection.cs index 7348b51fc..803230041 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSection.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSection.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using Grasshopper.Kernel.Types; @@ -25,7 +28,7 @@ public class SAMAnalyticalSection : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -76,7 +79,7 @@ protected override GH_SAMParam[] Outputs result.Add(new GH_SAMParam(new GooPanelParam() { Name = "panels", NickName = "panels", Description = "SAM Analytical Panels", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "elevations", NickName = "elevations", Description = "Elevations", Access = GH_ParamAccess.tree }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "geometries", NickName = "geometries", Description = "geometries", Access = GH_ParamAccess.tree }, ParamVisibility.Binding)); - + return result.ToArray(); } } @@ -87,28 +90,28 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_analyticals"); List objectWrappers = new List(); - if(index == -1 || !dataAccess.GetDataList(index, objectWrappers) || objectWrappers == null) + if (index == -1 || !dataAccess.GetDataList(index, objectWrappers) || objectWrappers == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Invalid Data"); return; } List panels = new List(); - foreach(GH_ObjectWrapper objectWrapper in objectWrappers) + foreach (GH_ObjectWrapper objectWrapper in objectWrappers) { - if(objectWrapper.Value is Panel) + if (objectWrapper.Value is Panel) { panels.Add((Panel)objectWrapper.Value); } - else if(objectWrapper.Value is AnalyticalModel) + else if (objectWrapper.Value is AnalyticalModel) { List panels_Temp = ((AnalyticalModel)objectWrapper.Value).GetPanels(); - if(panels_Temp != null) + if (panels_Temp != null) { panels.AddRange(panels_Temp); } } - else if(objectWrapper.Value is AdjacencyCluster) + else if (objectWrapper.Value is AdjacencyCluster) { List panels_Temp = ((AdjacencyCluster)objectWrapper.Value).GetPanels(); if (panels_Temp != null) @@ -128,26 +131,26 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("tolerance_"); double tolerance = Tolerance.Distance; - if(index != -1) + if (index != -1) { dataAccess.GetData(index, ref tolerance); } Dictionary>> dictionary = new Dictionary>>(); - foreach(double elevation in elevations) + foreach (double elevation in elevations) { Geometry.Spatial.Plane plane = Geometry.Spatial.Plane.WorldXY.GetMoved(new Geometry.Spatial.Vector3D(0, 0, elevation)) as Geometry.Spatial.Plane; Dictionary> dictionary_Temp = Analytical.Query.SectionDictionary(panels, plane, tolerance); - if(dictionary_Temp == null || dictionary_Temp.Count == 0) + if (dictionary_Temp == null || dictionary_Temp.Count == 0) { continue; } - foreach(KeyValuePair> keyValuePair in dictionary_Temp) + foreach (KeyValuePair> keyValuePair in dictionary_Temp) { Panel panel = keyValuePair.Key; - + Dictionary> dictionary_Elevation = null; if (!dictionary.TryGetValue(panel, out dictionary_Elevation)) @@ -181,7 +184,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) foreach (KeyValuePair>> keyValuePair in dictionary) { GH_Path path = new GH_Path(count); - foreach(double elevation in keyValuePair.Value.Keys) + foreach (double elevation in keyValuePair.Value.Keys) { dataTree_Elevation.Add(elevation, path); } @@ -215,4 +218,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetAdiabatic.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetAdiabatic.cs index 1f59e5944..c92bd7d52 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetAdiabatic.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetAdiabatic.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalSetAdiabatic : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -40,7 +43,7 @@ public SAMAnalyticalSetAdiabatic() protected override void RegisterInputParams(GH_InputParamManager inputParamManager) { inputParamManager.AddParameter(new GooAnalyticalObjectParam(), "_analytical", "_analytical", "SAM Analytical Object such as AdjacencyCluster or AnalyticalModel", GH_ParamAccess.item); - inputParamManager.AddParameter(new GooPanelParam() { Optional = true}, "panels_", "panels_", "SAM Analytical Panels", GH_ParamAccess.list); + inputParamManager.AddParameter(new GooPanelParam() { Optional = true }, "panels_", "panels_", "SAM Analytical Panels", GH_ParamAccess.list); inputParamManager.AddBooleanParameter("_adiabatic_", "_adiabatic", "Is Adiabatic", GH_ParamAccess.item, true); } @@ -68,7 +71,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } AdjacencyCluster adjacencyCluster = null; - if(sAMObject is AdjacencyCluster) + if (sAMObject is AdjacencyCluster) { adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)sAMObject); } @@ -80,7 +83,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List panels = new List(); dataAccess.GetDataList(1, panels); - if(panels != null && panels.Count != 0) + if (panels != null && panels.Count != 0) { bool adiabatic = true; if (!dataAccess.GetData(2, ref adiabatic)) @@ -109,11 +112,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(sAMObject is AnalyticalModel) + if (sAMObject is AnalyticalModel) { sAMObject = new AnalyticalModel((AnalyticalModel)sAMObject, adjacencyCluster); } - else if(sAMObject is AdjacencyCluster) + else if (sAMObject is AdjacencyCluster) { sAMObject = adjacencyCluster; } @@ -121,4 +124,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, sAMObject); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetAirflow.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetAirflow.cs index 278bb3504..e534a3233 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetAirflow.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetAirflow.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalSetAirflow : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -45,7 +48,7 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_analytical", NickName = "_analytical", Description = "SAM Analytical AdjacencyCluster or AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "_spaces_", NickName = "_spaces_", Description = "SAM Analytical Spaces", Access = GH_ParamAccess.list, Optional = true}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "_spaces_", NickName = "_spaces_", Description = "SAM Analytical Spaces", Access = GH_ParamAccess.list, Optional = true }, ParamVisibility.Binding)); global::Grasshopper.Kernel.Parameters.Param_Boolean boolean; @@ -65,7 +68,7 @@ protected override GH_SAMParam[] Inputs result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_airflow_ACH", NickName = "_airflow_ACH", Description = "Airflow [ACH]", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_airflow_LpSpM2", NickName = "_airflow_LpSpM2", Description = "Airflow [l/s/m2]", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_airflow_LpS", NickName = "_airflow_LpS", Description = "Airflow [l/s]", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); - + return result.ToArray(); @@ -94,7 +97,7 @@ protected override GH_SAMParam[] Outputs protected override void SolveInstance(IGH_DataAccess dataAccess) { int index = -1; - + SAMObject sAMObject = null; index = Params.IndexOfInputParam("_analytical"); if (index == -1 || !dataAccess.GetData(index, ref sAMObject) || sAMObject == null) @@ -106,10 +109,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) AdjacencyCluster adjacencyCluster = null; if (sAMObject is AnalyticalModel) adjacencyCluster = ((AnalyticalModel)sAMObject).AdjacencyCluster; - else if(sAMObject is AdjacencyCluster) + else if (sAMObject is AdjacencyCluster) adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)sAMObject); - if(adjacencyCluster == null) + if (adjacencyCluster == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -132,7 +135,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) double airflow_LpSpP = double.NaN; index = Params.IndexOfInputParam("_airflow_LpSpP"); - if(index != -1) + if (index != -1) dataAccess.GetData(index, ref airflow_LpSpP); double airflow_ACH = double.NaN; @@ -149,17 +152,17 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_airflow_LpS"); if (index != -1) dataAccess.GetData(index, ref airflow_LpS); - - List spaces = new List(); + + List spaces = new List(); index = Params.IndexOfInputParam("_spaces"); if (index != -1) dataAccess.GetDataList(index, spaces); List spaces_Temp = adjacencyCluster.GetSpaces(); - if(spaces != null && spaces.Count != 0) + if (spaces != null && spaces.Count != 0) spaces_Temp = spaces_Temp.FindAll(x => x != null && spaces.Find(y => y != null && y.Guid == x.Guid) != null); - if(supplyAirFlow || exhaustAirFlow || outsideSupplyAirFlow) + if (supplyAirFlow || exhaustAirFlow || outsideSupplyAirFlow) { foreach (Space space in spaces_Temp) { @@ -230,7 +233,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) Space space_New = new Space(space); - if(supplyAirFlow) + if (supplyAirFlow) space_New.SetValue(SpaceParameter.SupplyAirFlow, airflow); if (exhaustAirFlow) @@ -249,8 +252,8 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("Analytical"); - if(index != -1) + if (index != -1) dataAccess.SetData(index, sAMObject); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetApertureConstruction.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetApertureConstruction.cs index a25a7d3f8..cfdb9731f 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetApertureConstruction.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetApertureConstruction.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalSetApertureConstruction : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -88,7 +91,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (adjacencyCluster == null) adjacencyCluster = analyticalModel?.AdjacencyCluster; - if(adjacencyCluster == null) + if (adjacencyCluster == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -96,9 +99,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) AdjacencyCluster adjacencyCluster_Result = new AdjacencyCluster(adjacencyCluster); List apertures_Result = new List(); - + List panels = adjacencyCluster_Result.GetPanels(); - if(panels != null && panels.Count != 0) + if (panels != null && panels.Count != 0) { List panels_Result = new List(); @@ -135,12 +138,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) adjacencyCluster_Result.AddObject(panel); } - if(analyticalModel != null) + if (analyticalModel != null) dataAccess.SetData(0, new AnalyticalModel(analyticalModel, adjacencyCluster_Result)); - else if(adjacencyCluster != null) + else if (adjacencyCluster != null) dataAccess.SetData(0, adjacencyCluster_Result); dataAccess.SetDataList(1, apertures_Result.ConvertAll(x => new GooAperture(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetApertureConstructionByAnalyticalModel.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetApertureConstructionByAnalyticalModel.cs index b2a10b6cf..05fa52750 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetApertureConstructionByAnalyticalModel.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetApertureConstructionByAnalyticalModel.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalSetApertureConstructionByAnalyticalModel : GH_SAMVaria /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -45,7 +48,7 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "SAM AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooApertureParam() { Name = "_apertures", NickName = "apertures", Description = "SAM Analytical Apertures", Access = GH_ParamAccess.list}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooApertureParam() { Name = "_apertures", NickName = "apertures", Description = "SAM Analytical Apertures", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooApertureConstructionParam() { Name = "_apertureConstruction", NickName = "apertureConstruction", Description = "SAM Analytical ApertureConstruction \n*The layers should be ordered from inside to outside" }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooConstructionManagerParam() { Name = "constructionManager_", NickName = "constructionManager_", Description = "SAM Analytical ConstructionManager", Optional = true }, ParamVisibility.Voluntary)); return result.ToArray(); @@ -119,7 +122,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) apertures = adjacencyCluster.UpdateApertures(apertures); - if(apertures != null && apertures.Count != 0) + if (apertures != null && apertures.Count != 0) { List materialNames_Missing = new List(); @@ -127,17 +130,17 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) MaterialLibrary materialLibrary = analyticalModel.MaterialLibrary; List materialNames = materialLibrary?.MissingMaterialsNames(apertureConstruction); - if(materialNames != null && materialNames.Count != 0) + if (materialNames != null && materialNames.Count != 0) { - foreach(string materialName in materialNames) + foreach (string materialName in materialNames) { IMaterial material = constructionManager?.GetMaterial(materialName); - if(material == null) + if (material == null) { material = materialLibrary_Default?.GetMaterial(materialName); } - if(material == null) + if (material == null) { materialNames_Missing.Add(materialName); continue; @@ -166,4 +169,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, apertures?.ConvertAll(x => new GooAperture(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetConstruction.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetConstruction.cs index 4e85a7137..a116b3c3d 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetConstruction.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetConstruction.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalSetConstruction : GH_SAMVariableOutputParameterCompone /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -45,7 +48,7 @@ protected override GH_SAMParam[] Inputs get { List result = new List(); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_analytical", NickName = "_analytical", Description = "SAM Analytical Object such as AdjacencyCluster or AnalyticalModel", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_analytical", NickName = "_analytical", Description = "SAM Analytical Object such as AdjacencyCluster or AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooPanelParam() { Name = "_panels", NickName = "_panels", Description = "SAM Analytical Panels", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooConstructionParam() { Name = "_construction", NickName = "_construction", Description = "SAM Analytical Construction", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooMaterialParam() { Name = "_materials_", NickName = "_materials_", Description = "SAM Materials", Access = GH_ParamAccess.list, Optional = true }, ParamVisibility.Voluntary)); @@ -142,7 +145,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) AdjacencyCluster adjacencyCluster_Result = new AdjacencyCluster(adjacencyCluster); List panels_Result = new List(); - foreach(Panel panel in panels) + foreach (Panel panel in panels) { if (panel == null) continue; @@ -160,7 +163,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("Analytical"); - if(index != -1) + if (index != -1) { if (analyticalModel != null) dataAccess.SetData(index, new AnalyticalModel(analyticalModel, adjacencyCluster_Result)); @@ -177,4 +180,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, materials?.ConvertAll(x => new GooMaterial(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetConstructionByCsv.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetConstructionByCsv.cs index 6f6f3b706..01d2746b4 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetConstructionByCsv.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetConstructionByCsv.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalSetConstructionByCsv : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -180,4 +183,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(0, result.ConvertAll(x => new GooPanel(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetConstructionLayersByPanelType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetConstructionLayersByPanelType.cs index c5200d00f..42ba375e0 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetConstructionLayersByPanelType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetConstructionLayersByPanelType.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -21,7 +24,7 @@ public class SAMAnalyticalSetConstructionLayersByPanelType : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -41,7 +44,7 @@ protected override void RegisterInputParams(GH_InputParamManager inputParamManag int index; inputParamManager.AddParameter(new GooAnalyticalModelParam(), "_analyticalModel", "_analyticalModel", "SAM Analytical Model", GH_ParamAccess.item); - + index = inputParamManager.AddParameter(new GooConstructionLibraryParam(), "_constructionLibrary_", "_constructionLibrary_", "SAM Analytical Contruction Library", GH_ParamAccess.item); inputParamManager[index].Optional = true; @@ -104,4 +107,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooAnalyticalModel(analyticalModel_Result)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetDefaultApertureConstruction.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetDefaultApertureConstruction.cs index 15bdb6f64..9e2ef3564 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetDefaultApertureConstruction.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetDefaultApertureConstruction.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalSetDefaultApertureConstruction : GH_SAMVariableOutputP /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -76,17 +79,17 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (index != -1) dataAccess.GetDataList(index, apertures); - if(sAMObject is AdjacencyCluster) + if (sAMObject is AdjacencyCluster) { AdjacencyCluster adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)sAMObject); apertures = adjacencyCluster.SetDefaultApertureConstruction(apertures?.ConvertAll(x => x.Guid))?.ToList(); sAMObject = adjacencyCluster; } - else if(sAMObject is AnalyticalModel) + else if (sAMObject is AnalyticalModel) { AnalyticalModel analyticalModel = new AnalyticalModel((AnalyticalModel)sAMObject); AdjacencyCluster adjacencyCluster = analyticalModel.AdjacencyCluster; - if(adjacencyCluster != null) + if (adjacencyCluster != null) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster); apertures = adjacencyCluster.SetDefaultApertureConstruction(apertures?.ConvertAll(x => x.Guid))?.ToList(); @@ -105,4 +108,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, apertures?.ConvertAll(x => new GooAperture(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetDefaultApertureConstructionLayers.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetDefaultApertureConstructionLayers.cs index 3975067e3..aa5944c97 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetDefaultApertureConstructionLayers.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetDefaultApertureConstructionLayers.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalSetDefaultApertureConstructionLayers : GH_SAMVariableO /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -76,17 +79,17 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (index != -1) dataAccess.GetDataList(index, apertures); - if(sAMObject is AdjacencyCluster) + if (sAMObject is AdjacencyCluster) { AdjacencyCluster adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)sAMObject); apertures = adjacencyCluster.SetDefaultApertureConstructionLayers(apertures?.ConvertAll(x => x.Guid))?.ToList(); sAMObject = adjacencyCluster; } - else if(sAMObject is AnalyticalModel) + else if (sAMObject is AnalyticalModel) { AnalyticalModel analyticalModel = new AnalyticalModel((AnalyticalModel)sAMObject); AdjacencyCluster adjacencyCluster = analyticalModel.AdjacencyCluster; - if(adjacencyCluster != null) + if (adjacencyCluster != null) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster); apertures = adjacencyCluster.SetDefaultApertureConstructionLayers(apertures?.ConvertAll(x => x.Guid))?.ToList(); @@ -105,4 +108,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, apertures?.ConvertAll(x => new GooAperture(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetDefaultConstructionByPanelType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetDefaultConstructionByPanelType.cs index b768d974e..58ba9ad57 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetDefaultConstructionByPanelType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetDefaultConstructionByPanelType.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalSetDefaultConstructionByPanelType : GH_SAMVariableOutp /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -76,17 +79,17 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (index != -1) dataAccess.GetDataList(index, panels); - if(analyticalObject is AdjacencyCluster) + if (analyticalObject is AdjacencyCluster) { AdjacencyCluster adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)analyticalObject); panels = adjacencyCluster.SetDefaultConstructionByPanelType(panels?.ConvertAll(x => x.Guid))?.ToList(); analyticalObject = adjacencyCluster; } - else if(analyticalObject is AnalyticalModel) + else if (analyticalObject is AnalyticalModel) { AnalyticalModel analyticalModel = new AnalyticalModel((AnalyticalModel)analyticalObject); AdjacencyCluster adjacencyCluster = analyticalModel.AdjacencyCluster; - if(adjacencyCluster != null) + if (adjacencyCluster != null) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster); panels = adjacencyCluster.SetDefaultConstructionByPanelType(panels?.ConvertAll(x => x.Guid))?.ToList(); @@ -105,4 +108,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, panels?.ConvertAll(x => new GooPanel(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetDefaultConstructionLayerByPanelType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetDefaultConstructionLayerByPanelType.cs index 53708927b..e3c5b4a8b 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetDefaultConstructionLayerByPanelType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetDefaultConstructionLayerByPanelType.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalSetDefaultConstructionLayerByPanelType : GH_SAMVariabl /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -79,17 +82,17 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List panelsWithIssues = null; - if(analyticalObject is AdjacencyCluster) + if (analyticalObject is AdjacencyCluster) { AdjacencyCluster adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)analyticalObject); panels = adjacencyCluster.SetDefaultConstructionLayerByPanelType(out panelsWithIssues, panels?.ConvertAll(x => x.Guid))?.ToList(); analyticalObject = adjacencyCluster; } - else if(analyticalObject is AnalyticalModel) + else if (analyticalObject is AnalyticalModel) { AnalyticalModel analyticalModel = new AnalyticalModel((AnalyticalModel)analyticalObject); AdjacencyCluster adjacencyCluster = analyticalModel.AdjacencyCluster; - if(adjacencyCluster != null) + if (adjacencyCluster != null) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster); panels = adjacencyCluster.SetDefaultConstructionLayerByPanelType(out panelsWithIssues, panels?.ConvertAll(x => x.Guid))?.ToList(); @@ -118,4 +121,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetExternalSpaces.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetExternalSpaces.cs index 44806e8b4..df9f60613 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetExternalSpaces.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetExternalSpaces.cs @@ -1,4 +1,7 @@ - using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalSetExternalSpaces : GH_SAMVariableOutputParameterCompo /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -45,8 +48,8 @@ protected override GH_SAMParam[] Inputs get { List result = new List(); - result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "SAM AnalyticalModel", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooSAMGeometryParam() { Name = "_point3Ds", NickName = "_point3Ds", Description = "Space locations to be changed to ExternalSpaces", Access = GH_ParamAccess.list}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "SAM AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooSAMGeometryParam() { Name = "_point3Ds", NickName = "_point3Ds", Description = "Space locations to be changed to ExternalSpaces", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooConstructionParam() { Name = "construction_Wall", NickName = "construction_Wall", Description = "Wall Construction", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooConstructionParam() { Name = "construction_Floor", NickName = "construction_Floor", Description = "Floor Construction", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooConstructionParam() { Name = "construction_Roof", NickName = "construction_Roof", Description = "Roof Construction", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); @@ -96,7 +99,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) Construction construction_Wall = null; index = Params.IndexOfInputParam("construction_Wall"); - if(index != -1) + if (index != -1) { dataAccess.GetData(index, ref construction_Wall); } @@ -118,7 +121,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List externalSpaces = null; AdjacencyCluster adjacencyCluster = analyticalModel.AdjacencyCluster; - if(adjacencyCluster != null) + if (adjacencyCluster != null) { externalSpaces = adjacencyCluster.ChangeExternalSpaces(point3Ds, construction_Wall, construction_Floor, construction_Roof); analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster); @@ -137,4 +140,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetInternalCondition.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetInternalCondition.cs index ff32ad459..325955a32 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetInternalCondition.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetInternalCondition.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalSetInternalCondition : GH_SAMVariableOutputParameterCo /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -76,7 +79,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_space"); Space space = null; - if(index == -1 || !dataAccess.GetData(index, ref space) || space == null) + if (index == -1 || !dataAccess.GetData(index, ref space) || space == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -96,4 +99,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, new GooSpace(space)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetInternalConditionByInternalConditionLibrary.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetInternalConditionByInternalConditionLibrary.cs index 106273992..95fe65890 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetInternalConditionByInternalConditionLibrary.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetInternalConditionByInternalConditionLibrary.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -51,8 +54,8 @@ protected override GH_SAMParam[] Inputs global::Grasshopper.Kernel.Parameters.Param_GenericObject genericObject = new global::Grasshopper.Kernel.Parameters.Param_GenericObject { Name = "_name_", NickName = "_ICname_", Description = "InternalCondition Name or SAM InternalCondition Object \n*use .GetDefaultLibrary and SelectByName \n to select requred IC ", Access = GH_ParamAccess.item }; genericObject.SetPersistentData("S39_OfficeOpen"); result.Add(new GH_SAMParam(genericObject, ParamVisibility.Binding)); - - result.Add(new GH_SAMParam(new GooSpaceParam { Name = "spaces_", NickName = "spaces_", Description = "SAM Analytical Spaces \n*if none all spaces from model will be included", Access = GH_ParamAccess.list, Optional = true}, ParamVisibility.Binding)); + + result.Add(new GH_SAMParam(new GooSpaceParam { Name = "spaces_", NickName = "spaces_", Description = "SAM Analytical Spaces \n*if none all spaces from model will be included", Access = GH_ParamAccess.list, Optional = true }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooInternalConditionLibraryParam { Name = "internalConditionLibrary_", NickName = "internalConditionLibrary_", Description = "SAM Analytical InternalConditionLibrary \n*optional", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); return result.ToArray(); @@ -84,12 +87,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_analyticals"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } - + List sAMObjects = new List(); if (!dataAccess.GetDataList(index, sAMObjects)) { @@ -98,7 +101,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfInputParam("_name_"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -111,8 +114,8 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } - - + + List spaces_Input = new List(); index = Params.IndexOfInputParam("spaces_"); if (index == -1 || !dataAccess.GetDataList(index, spaces_Input)) @@ -225,4 +228,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, spaces_Output?.ConvertAll(x => new GooSpace(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetInternalConditionPerArea.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetInternalConditionPerArea.cs index 0c36f97b8..842626c22 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetInternalConditionPerArea.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetInternalConditionPerArea.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalSetInternalConditionPerArea : GH_SAMVariableOutputPara /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -58,7 +61,7 @@ protected override GH_SAMParam[] Inputs number.SetPersistentData(2); result.Add(new GH_SAMParam(number, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooProfileLibraryParam() { Name = "profileLibrary_", NickName = "profileLibrary_", Description = "SAM Analytical ProfileLibrary", Access = GH_ParamAccess.item, Optional = true}, ParamVisibility.Voluntary)); + result.Add(new GH_SAMParam(new GooProfileLibraryParam() { Name = "profileLibrary_", NickName = "profileLibrary_", Description = "SAM Analytical ProfileLibrary", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); return result.ToArray(); } @@ -106,12 +109,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (index != -1) dataAccess.GetData(index, ref profileLibrary); - if(profileLibrary == null) + if (profileLibrary == null) profileLibrary = ActiveSetting.Setting.GetValue(AnalyticalSettingParameter.DefaultProfileLibrary); bool includeInvalid = true; index = Params.IndexOfInputParam("_includeInvalid_"); - if(index != -1) + if (index != -1) dataAccess.GetData(index, ref includeInvalid); Core.NumberComparisonType numberComparisonType = Core.NumberComparisonType.Less; @@ -130,10 +133,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) AdjacencyCluster adjacencyCluster = analyticalModel.AdjacencyCluster; List spaces = null; - if(adjacencyCluster != null) + if (adjacencyCluster != null) { List spaces_All = adjacencyCluster.GetSpaces(); - if(spaces_All != null) + if (spaces_All != null) { spaces = new List(); foreach (Space space in spaces_All) @@ -142,9 +145,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) continue; double area = space.CalculatedArea(adjacencyCluster); - if(double.IsNaN(area)) + if (double.IsNaN(area)) { - if(includeInvalid) + if (includeInvalid) { space.InternalCondition = internalCondition; adjacencyCluster.AddObject(space); @@ -152,7 +155,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } continue; } - + if (!Core.Query.Compare(area, value, numberComparisonType)) continue; @@ -183,4 +186,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetLocation.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetLocation.cs index e65317a27..3aefd72e4 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetLocation.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetLocation.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalSetLocation : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -45,8 +48,8 @@ protected override GH_SAMParam[] Inputs get { List result = new List(); - result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "SAM AnalyticalModel", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_location", NickName = "_location", Description = "SAM Location \n *or WeatherData it will extract location", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "SAM AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_location", NickName = "_location", Description = "SAM Location \n *or WeatherData it will extract location", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); return result.ToArray(); } } @@ -90,11 +93,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } - if(sAMObject is Location) + if (sAMObject is Location) { analyticalModel = new AnalyticalModel(analyticalModel, (Location)sAMObject); } - else if(sAMObject is WeatherData) + else if (sAMObject is WeatherData) { analyticalModel = new AnalyticalModel(analyticalModel, ((WeatherData)sAMObject).Location); } @@ -104,4 +107,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, new GooAnalyticalModel(analyticalModel)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetOccupancyGains.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetOccupancyGains.cs index 1341df8c8..8d53d2872 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetOccupancyGains.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetOccupancyGains.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalSetOccupancyGains : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -75,15 +78,15 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } - for(int i = 0; i < sAMObjects.Count; i++) + for (int i = 0; i < sAMObjects.Count; i++) { - if(sAMObjects[i] is InternalCondition) + if (sAMObjects[i] is InternalCondition) { InternalCondition internalCondition = new InternalCondition((InternalCondition)sAMObjects[i]); if (internalCondition.SetOccupancyGains(degreeOfActivity)) sAMObjects[i] = internalCondition; } - else if(sAMObjects[i] is Space) + else if (sAMObjects[i] is Space) { Space space = new Space((Space)sAMObjects[i]); if (space.SetOccupancyGains(degreeOfActivity)) @@ -94,4 +97,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(0, sAMObjects.ConvertAll(x => new GooJSAMObject(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetPanelType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetPanelType.cs index 070a6a238..17867aff8 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetPanelType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetPanelType.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalSetPanelType : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -97,18 +100,18 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) PanelType panelType = Analytical.Query.PanelType(value); Panel panel_New = Create.Panel(panel, panelType); - if(setDefaultConstruction) + if (setDefaultConstruction) { Construction construction = Analytical.Query.DefaultConstruction(panelType); panel_New = Create.Panel(panel_New, construction); } - if(setDefaultApertureConstruction) + if (setDefaultApertureConstruction) { List apertures = panel_New.Apertures; - if(apertures != null && apertures.Count != 0) + if (apertures != null && apertures.Count != 0) { - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { ApertureConstruction apertureConstruction = Analytical.Query.DefaultApertureConstruction(panel_New.PanelType, aperture.ApertureType); if (apertureConstruction == null) @@ -125,4 +128,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooPanel(panel_New)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetSystemTypeNames.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetSystemTypeNames.cs index f99eb3bde..34158120f 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetSystemTypeNames.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSetSystemTypeNames.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -23,7 +26,7 @@ public class SAMAnalyticalSetSystemTypeNames : GH_SAMVariableOutputParameterComp /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -110,7 +113,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { objectWrappers = new List(); dataAccess.GetDataList(index, objectWrappers); - foreach(GH_ObjectWrapper objectWrapper in objectWrappers) + foreach (GH_ObjectWrapper objectWrapper in objectWrappers) { object value = objectWrapper?.Value; if (value is IGH_Goo) @@ -119,7 +122,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } List spaces = null; - if(value is Zone) + if (value is Zone) { spaces = analyticalModel.GetSpaces((Zone)value); } @@ -127,7 +130,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { spaces = new List() { (Space)value }; } - else if(value is string) + else if (value is string) { spaces = new List() { analyticalModel?.GetSpaces()?.Find(x => x?.Name == (string)value) }; } @@ -219,19 +222,19 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) for (int i = 0; i < spacesList.Count; i++) { List spaces = spacesList[i]; - if(spaces == null || spaces.Count == 0) + if (spaces == null || spaces.Count == 0) { continue; } - string ventilationSystemTypeName = ventilationSystemTypeNames.Count > i ? ventilationSystemTypeNames[i] : null; + string ventilationSystemTypeName = ventilationSystemTypeNames.Count > i ? ventilationSystemTypeNames[i] : null; string heatingSystemTypeName = heatingSystemTypeNames.Count > i ? heatingSystemTypeNames[i] : null; string coolingSystemTypeName = coolingSystemTypeNames.Count > i ? coolingSystemTypeNames[i] : null; for (int j = 0; j < spaces.Count; j++) { Space space = spaces[j]; - if(space != null) + if (space != null) { space = adjacencyCluster.GetObject(space.Guid); } @@ -277,4 +280,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSnapByElevations.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSnapByElevations.cs index ffe868297..438859ddf 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSnapByElevations.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSnapByElevations.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalSnapByElevations : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -82,7 +85,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List elevations = new List(); - foreach(GH_ObjectWrapper objectWrapper_Elevation in objectWrappers_Elevation) + foreach (GH_ObjectWrapper objectWrapper_Elevation in objectWrappers_Elevation) { double elevation = double.NaN; @@ -106,7 +109,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) elevation = ((Architectural.Level)@object).Elevation; } - if(double.IsNaN(elevation)) + if (double.IsNaN(elevation)) { continue; } @@ -132,4 +135,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(0, result.ConvertAll(x => new GooPanel(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSnapByLines.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSnapByLines.cs index 3ff880493..3d747eb60 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSnapByLines.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSnapByLines.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Rhino.Geometry; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalSnapByLines : GH_SAMComponent /// /// ` Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -98,4 +101,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooPanel(result)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSnapByOffset.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSnapByOffset.cs index a822aa53f..878e12049 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSnapByOffset.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSnapByOffset.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalSnapByOffset : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -82,4 +85,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(1, point3Ds.ConvertAll(x => new Geometry.Grasshopper.GooSAMGeometry(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSnapByPlanes.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSnapByPlanes.cs index 6c807e213..518e42bb0 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSnapByPlanes.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSnapByPlanes.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -23,7 +26,7 @@ public class SAMAnalyticalSnapByPlanes : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -86,7 +89,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_panels"); List panels = new List(); - if(index == -1 || !dataAccess.GetDataList(index, panels) || panels == null) + if (index == -1 || !dataAccess.GetDataList(index, panels) || panels == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Invalid Data"); return; @@ -151,10 +154,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) tolerance = Tolerance.Distance; List result = Analytical.Query.SnapByPlanes(panels, elevations, maxDistance, tolerance); - + index = Params.IndexOfOutputParam("panels"); if (index != -1) dataAccess.SetDataList(index, result); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSnapByPoints.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSnapByPoints.cs index e08002fe2..85aac911a 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSnapByPoints.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSnapByPoints.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -22,7 +25,7 @@ public class SAMAnalyticalSnapByPoints : GH_SAMComponent /// /// ` Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -94,4 +97,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooPanel(result)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSnapPoints.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSnapPoints.cs index ba46c10e8..755ab83cb 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSnapPoints.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSnapPoints.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Rhino.Geometry; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalSnapPoints : GH_SAMComponent /// /// ` Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -132,4 +135,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(0, point2Ds.ConvertAll(x => Geometry.Rhino.Convert.ToRhino(plane.Convert(x)))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSplitByInternalEdges.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSplitByInternalEdges.cs index 7d0d05ceb..c10177264 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSplitByInternalEdges.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSplitByInternalEdges.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalSplitByInternalEdges : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -71,4 +74,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(0, panels.ConvertAll(x => new GooPanel(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSplitPanelByElevations.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSplitPanelByElevations.cs index 8417cd20e..c6c737361 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSplitPanelByElevations.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSplitPanelByElevations.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -24,7 +27,7 @@ public class SAMAnalyticalSplitPanelByElevations : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -64,21 +67,21 @@ protected override void RegisterOutputParams(GH_OutputParamManager outputParamMa protected override void SolveInstance(IGH_DataAccess dataAccess) { Panel panel = null; - if(!dataAccess.GetData(0, ref panel)) + if (!dataAccess.GetData(0, ref panel)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } List objectWrappers = new List(); - if(!dataAccess.GetDataList(1, objectWrappers) || objectWrappers == null) + if (!dataAccess.GetDataList(1, objectWrappers) || objectWrappers == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } List planes = new List(); - foreach(GH_ObjectWrapper objectWrapper in objectWrappers) + foreach (GH_ObjectWrapper objectWrapper in objectWrappers) { object @object = objectWrapper.Value; @@ -112,7 +115,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { plane = ((GH_Plane)@object).ToSAM(); } - else if(@object is global::Rhino.Geometry.Plane) + else if (@object is global::Rhino.Geometry.Plane) { plane = Geometry.Rhino.Convert.ToSAM(((global::Rhino.Geometry.Plane)@object)); } @@ -149,10 +152,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) else result_Lower.Add(panel_Temp); } - + dataAccess.SetDataList(0, result?.ConvertAll(x => new GooPanel(x))); dataAccess.SetDataList(1, result_Upper?.ConvertAll(x => new GooPanel(x))); dataAccess.SetDataList(2, result_Lower?.ConvertAll(x => new GooPanel(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSplitPanelsByElevations.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSplitPanelsByElevations.cs index 272361245..0731135ae 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSplitPanelsByElevations.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSplitPanelsByElevations.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using Grasshopper.Kernel.Types; @@ -27,7 +30,7 @@ public class SAMAnalyticalSplitPanelsByElevations : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -67,21 +70,21 @@ protected override void RegisterOutputParams(GH_OutputParamManager outputParamMa protected override void SolveInstance(IGH_DataAccess dataAccess) { List panels = new List(); - if(!dataAccess.GetDataList(0, panels)) + if (!dataAccess.GetDataList(0, panels)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } List objectWrappers = new List(); - if(!dataAccess.GetDataList(1, objectWrappers) || objectWrappers == null) + if (!dataAccess.GetDataList(1, objectWrappers) || objectWrappers == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } List planes = new List(); - foreach(GH_ObjectWrapper objectWrapper in objectWrappers) + foreach (GH_ObjectWrapper objectWrapper in objectWrappers) { object @object = objectWrapper.Value; @@ -115,7 +118,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { plane = ((GH_Plane)@object).ToSAM(); } - else if(@object is global::Rhino.Geometry.Plane) + else if (@object is global::Rhino.Geometry.Plane) { plane = Geometry.Rhino.Convert.ToSAM(((global::Rhino.Geometry.Plane)@object)); } @@ -135,21 +138,21 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } double threshold = double.NaN; - if(!dataAccess.GetData(2, ref threshold)) + if (!dataAccess.GetData(2, ref threshold)) { threshold = double.NaN; } - if(double.IsNaN(threshold)) + if (double.IsNaN(threshold)) { threshold = 0; } List result = new List(); - foreach(Panel panel in panels) + foreach (Panel panel in panels) { List panels_Temp = Analytical.Query.Cut(panel, planes, threshold, Core.Tolerance.Distance); - if(panels_Temp != null) + if (panels_Temp != null) { result.AddRange(panels_Temp); } @@ -163,7 +166,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) foreach (Panel panel_Temp in result) { BoundingBox3D boundingBox3D = panel_Temp?.GetBoundingBox(); - if(boundingBox3D == null) + if (boundingBox3D == null) { continue; } @@ -176,14 +179,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List planes_Temp = null; - planes_Temp = planes.FindAll(x => x.Below(point3D_Max) || x.On(point3D_Max)); + planes_Temp = planes.FindAll(x => x.Below(point3D_Max) || x.On(point3D_Max)); max = planes_Temp == null || planes_Temp.Count == 0 ? boundingBox3D_Max.Max.Z : planes_Temp.First().Origin.Z; planes_Temp = planes.FindAll(x => x.Above(point3D_Min) || x.On(point3D_Min)); min = planes_Temp == null || planes_Temp.Count == 0 ? boundingBox3D_Max.Min.Z : planes_Temp.Last().Origin.Z; - Tuple> tuple = tuples.Find(x => x.Item1 == max && x.Item2 == min); - if(tuple == null) + Tuple> tuple = tuples.Find(x => x.Item1 == max && x.Item2 == min); + if (tuple == null) { tuple = new Tuple>(max, min, new List()); tuples.Add(tuple); @@ -206,4 +209,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataTree(1, dataTree_Panel); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSplitPanelsByGeometries.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSplitPanelsByGeometries.cs index 0524ff3d5..d01355336 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSplitPanelsByGeometries.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSplitPanelsByGeometries.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -24,7 +27,7 @@ public class SAMAnalyticalSplitPanelsByGeometries : GH_SAMVariableOutputParamete /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -70,7 +73,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index = -1; index = Params.IndexOfInputParam("_analytical"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -85,20 +88,20 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List geometry3Ds = new List(); index = Params.IndexOfInputParam("_geometries"); - if(index != -1) + if (index != -1) { List objectWrappers = new List(); dataAccess.GetDataList(index, objectWrappers); - if(objectWrappers != null) + if (objectWrappers != null) { - foreach(GH_ObjectWrapper objectWrapper in objectWrappers) + foreach (GH_ObjectWrapper objectWrapper in objectWrappers) { - if(objectWrapper.Value is IFace3DObject) + if (objectWrapper.Value is IFace3DObject) { geometry3Ds.Add(((IFace3DObject)objectWrapper.Value).Face3D); continue; } - + if (Geometry.Grasshopper.Query.TryGetSAMGeometries(objectWrapper, out List face3Ds) && face3Ds != null) { face3Ds.ForEach(x => geometry3Ds.Add(x)); @@ -132,14 +135,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List panels = null; - if(adjacencyCluster != null) + if (adjacencyCluster != null) { HashSet panelGuids = null; index = Params.IndexOfInputParam("spaces_"); if (index != -1) { List spaces = new List(); - if(dataAccess.GetDataList(index, spaces) && spaces != null) + if (dataAccess.GetDataList(index, spaces) && spaces != null) { panelGuids = new HashSet(); foreach (Space space in spaces) @@ -148,7 +151,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } - if(geometry3Ds != null) + if (geometry3Ds != null) { panels = adjacencyCluster.SplitPanels(geometry3Ds, panelGuids); } @@ -164,7 +167,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("analytical"); - if(index != -1) + if (index != -1) { dataAccess.SetData(index, new GooAnalyticalObject(analyticalObject)); } @@ -176,4 +179,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSplitPanelsByPanels.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSplitPanelsByPanels.cs index 658483389..15be5140d 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSplitPanelsByPanels.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalSplitPanelsByPanels.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalSplitPanelsByPanels : GH_SAMVariableOutputParameterCom /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -67,7 +70,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index = -1; index = Params.IndexOfInputParam("_analytical"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -82,7 +85,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List panels = new List(); index = Params.IndexOfInputParam("_panels"); - if(index != -1) + if (index != -1) { dataAccess.GetDataList(index, panels); } @@ -98,14 +101,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } List result = null; - if(adjacencyCluster != null) + if (adjacencyCluster != null) { HashSet panelGuids = null; index = Params.IndexOfInputParam("spaces_"); if (index != -1) { List spaces = new List(); - if(dataAccess.GetDataList(index, spaces) && spaces != null) + if (dataAccess.GetDataList(index, spaces) && spaces != null) { panelGuids = new HashSet(); foreach (Space space in spaces) @@ -115,7 +118,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(panels != null) + if (panels != null) { result = adjacencyCluster.SplitPanels(panels, panelGuids); } @@ -131,7 +134,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("analytical"); - if(index != -1) + if (index != -1) { dataAccess.SetData(index, new GooAnalyticalObject(analyticalObject)); } @@ -143,4 +146,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalTM52BuildingCategory.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalTM52BuildingCategory.cs index a1d253152..7fe45b84d 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalTM52BuildingCategory.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalTM52BuildingCategory.cs @@ -1,4 +1,7 @@ -using SAM.Analytical.Grasshopper.Properties; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -19,7 +22,7 @@ public class SAMAnalyticalTM52BuildingCategory : GH_SAMEnumComponent /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Panel Type @@ -31,4 +34,4 @@ public SAMAnalyticalTM52BuildingCategory() { } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalTM52SpaceExtendedResultByDayOfYears.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalTM52SpaceExtendedResultByDayOfYears.cs index 2d62e2aec..fe6c4ad53 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalTM52SpaceExtendedResultByDayOfYears.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalTM52SpaceExtendedResultByDayOfYears.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalTM52SpaceExtendedResultByDaysOfYear : GH_SAMVariableOu /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -86,7 +89,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } TM52ExtendedResult tM52SpaceExtendedResult = result as TM52ExtendedResult; - if(tM52SpaceExtendedResult == null) + if (tM52SpaceExtendedResult == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -111,4 +114,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalTransfom.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalTransfom.cs index a357f4517..80a475b96 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalTransfom.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalTransfom.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalTransform : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -74,25 +77,25 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } - if(sAMObject is Panel) + if (sAMObject is Panel) { Panel panel = Create.Panel((Panel)sAMObject); panel.Transform(transform3D); sAMObject = panel; } - else if(sAMObject is Aperture) + else if (sAMObject is Aperture) { Aperture aperture = new Aperture((Aperture)sAMObject); aperture.Transform(transform3D); sAMObject = aperture; } - else if(sAMObject is Space) + else if (sAMObject is Space) { Space space = new Space((Space)sAMObject); space.Transform(transform3D); sAMObject = space; } - else if(sAMObject is AdjacencyCluster) + else if (sAMObject is AdjacencyCluster) { AdjacencyCluster adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)sAMObject); adjacencyCluster.Transform(transform3D); @@ -108,4 +111,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, sAMObject); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalTriangulateConcavePanels.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalTriangulateConcavePanels.cs index 74e18b255..aa71afc8d 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalTriangulateConcavePanels.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalTriangulateConcavePanels.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalTriangulateConcavePanels : GH_SAMVariableOutputParamet /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -135,7 +138,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) sAMObjects[i] = new AnalyticalModel((AnalyticalModel)sAMObjects[i], adjacencyCluster); } - else if(sAMObjects[i] is AdjacencyCluster) + else if (sAMObjects[i] is AdjacencyCluster) { AdjacencyCluster adjacencyCluster = ((AdjacencyCluster)sAMObjects[i]).Clone(); @@ -152,13 +155,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) sAMObjects[i] = adjacencyCluster; } - else if(sAMObjects[i] is Panel) + else if (sAMObjects[i] is Panel) { Panel panel = (Panel)sAMObjects[i]; - if(Geometry.Object.Spatial.Query.Concave(panel)) + if (Geometry.Object.Spatial.Query.Concave(panel)) { List panels = panel.Triangulate(tolerance); - if(panels != null) + if (panels != null) { oldObjects.Add(panel); panels.ForEach(x => newObjects.Add(panel)); @@ -203,4 +206,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalTrimPanels.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalTrimPanels.cs index 56e9cef10..0eecc8cb2 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalTrimPanels.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalTrimPanels.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; @@ -23,7 +26,7 @@ public class SAMAnalyticalTrimPanels : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -88,7 +91,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_panels"); List panels = new List(); - if(index == -1 || !dataAccess.GetDataList(index, panels) || panels == null) + if (index == -1 || !dataAccess.GetDataList(index, panels) || panels == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Invalid Data"); return; @@ -156,4 +159,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalTypeMergeSettings.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalTypeMergeSettings.cs index 82a6a6457..9b58aee49 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalTypeMergeSettings.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalTypeMergeSettings.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalTypeMergeSettings : GH_SAMVariableOutputParameterCompo /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -58,7 +61,7 @@ protected override GH_SAMParam[] Outputs get { List result = new List(); - result.Add(new GH_SAMParam(new GooTypeMergeSettingsParam() { Name = "typeMergeSettings", NickName = "typeMergeSettings", Description = "Type Merge Settings", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooTypeMergeSettingsParam() { Name = "typeMergeSettings", NickName = "typeMergeSettings", Description = "Type Merge Settings", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); return result.ToArray(); } } @@ -84,7 +87,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("excludedParameterNames_"); List excludedParameterNames = new List(); - if(index != -1) + if (index != -1) { dataAccess.GetDataList(index, excludedParameterNames); } @@ -98,4 +101,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateApertureConstruction.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateApertureConstruction.cs index f28245e24..f103bc7a8 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateApertureConstruction.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateApertureConstruction.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalUpdateApertureConstruction : GH_SAMVariableOutputParam /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -75,7 +78,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_apertureConstructions"); List apertureConstructions = new List(); - if(index == -1 || !dataAccess.GetDataList(index, apertureConstructions)) + if (index == -1 || !dataAccess.GetDataList(index, apertureConstructions)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -107,7 +110,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { Panel panel = (Panel)sAMObject; bool updated = false; - for(int j =0; j < apertures.Count; j++) + for (int j = 0; j < apertures.Count; j++) { Aperture aperture = apertures[j]; if (panel.HasAperture(aperture.Guid)) @@ -128,7 +131,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) sAMObjects[i] = panel; } } - else if(sAMObject is AdjacencyCluster || sAMObject is AnalyticalModel) + else if (sAMObject is AdjacencyCluster || sAMObject is AnalyticalModel) { AdjacencyCluster adjacencyCluster = sAMObject is AdjacencyCluster ? (AdjacencyCluster)sAMObject : ((AnalyticalModel)sAMObject).AdjacencyCluster; adjacencyCluster = new AdjacencyCluster(adjacencyCluster); @@ -169,4 +172,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateApertureConstructionsByName.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateApertureConstructionsByName.cs index e82915a77..c06416771 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateApertureConstructionsByName.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateApertureConstructionsByName.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalUpdateApertureConstructionsByName : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -42,7 +45,7 @@ protected override void RegisterInputParams(GH_InputParamManager inputParamManag int index = -1; inputParamManager.AddParameter(new GooJSAMObjectParam(), "_analytical", "_analytical", "SAM Analytical Model ot Adjacency Cluster", GH_ParamAccess.list); - + index = inputParamManager.AddParameter(new GooApertureConstructionLibraryParam(), "apertureConstructionLibrary_", "apertureConstructionLibrary_", "SAM Analytical Aperture ConstructionLibrary", GH_ParamAccess.item); inputParamManager[index].Optional = true; } @@ -89,13 +92,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) else if (sAMObject is AdjacencyCluster) { AdjacencyCluster adjacencyCluster = (AdjacencyCluster)sAMObject; - ApertureConstructionLibrary apertureConstructionLibrary_Temp = null; - List panels_Temp = adjacencyCluster.GetPanels(); - if(panels_Temp != null) + ApertureConstructionLibrary apertureConstructionLibrary_Temp = null; + List panels_Temp = adjacencyCluster.GetPanels(); + if (panels_Temp != null) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster); apertureConstructionLibrary_Temp = Analytical.Modify.UpdateApertureConstructionsByName(panels_Temp, apertureConstructionLibrary); - foreach(Panel panel_Temp in panels_Temp) + foreach (Panel panel_Temp in panels_Temp) adjacencyCluster.AddObject(panel_Temp); } @@ -120,7 +123,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(panels != null && panels.Count != 0) + if (panels != null && panels.Count != 0) { ApertureConstructionLibrary apertureConstructionLibrary_Temp = Analytical.Modify.UpdateApertureConstructionsByName(panels, apertureConstructionLibrary); panels.ForEach(x => result.Add(x)); @@ -131,4 +134,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(1, constructionLibraries.ConvertAll(x => new GooApertureConstructionLibrary(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateApertureConstructionsByPanelType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateApertureConstructionsByPanelType.cs index 6823fee8a..5e1fd1984 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateApertureConstructionsByPanelType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateApertureConstructionsByPanelType.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalUpdateApertureConstructionsByPanelType : GH_SAMCompone /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -42,7 +45,7 @@ protected override void RegisterInputParams(GH_InputParamManager inputParamManag int index = -1; inputParamManager.AddParameter(new GooJSAMObjectParam(), "_analytical", "_analytical", "SAM Analytical Model ot Adjacency Cluster", GH_ParamAccess.list); - + index = inputParamManager.AddParameter(new GooApertureConstructionLibraryParam(), "apertureConstructionLibrary_", "apertureConstructionLibrary_", "SAM Analytical Aperture ConstructionLibrary", GH_ParamAccess.item); inputParamManager[index].Optional = true; } @@ -89,13 +92,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) else if (sAMObject is AdjacencyCluster) { AdjacencyCluster adjacencyCluster = (AdjacencyCluster)sAMObject; - ApertureConstructionLibrary apertureConstructionLibrary_Temp = null; - List panels_Temp = adjacencyCluster.GetPanels(); - if(panels_Temp != null) + ApertureConstructionLibrary apertureConstructionLibrary_Temp = null; + List panels_Temp = adjacencyCluster.GetPanels(); + if (panels_Temp != null) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster); apertureConstructionLibrary_Temp = Analytical.Modify.UpdateApertureConstructionsByApertureType(panels_Temp, apertureConstructionLibrary); - foreach(Panel panel_Temp in panels_Temp) + foreach (Panel panel_Temp in panels_Temp) adjacencyCluster.AddObject(panel_Temp); } @@ -120,7 +123,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(panels != null && panels.Count != 0) + if (panels != null && panels.Count != 0) { ApertureConstructionLibrary apertureConstructionLibrary_Temp = Analytical.Modify.UpdateApertureConstructionsByApertureType(panels, apertureConstructionLibrary); panels.ForEach(x => result.Add(x)); @@ -131,4 +134,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(1, constructionLibraries.ConvertAll(x => new GooApertureConstructionLibrary(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateByModel.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateByModel.cs index f154162eb..6e9641866 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateByModel.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateByModel.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalUpdateByModel : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -85,14 +88,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } AdjacencyCluster adjacencyCluster_Destination = null; - if(analyticalObject_Destination is AdjacencyCluster) + if (analyticalObject_Destination is AdjacencyCluster) { adjacencyCluster_Destination = new AdjacencyCluster((AdjacencyCluster)analyticalObject_Destination); } - else if(analyticalObject_Destination is AnalyticalModel) + else if (analyticalObject_Destination is AnalyticalModel) { adjacencyCluster_Destination = ((AnalyticalModel)analyticalObject_Destination).AdjacencyCluster; - if(adjacencyCluster_Destination != null) + if (adjacencyCluster_Destination != null) { adjacencyCluster_Destination = new AdjacencyCluster(adjacencyCluster_Destination); } @@ -153,4 +156,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionManager.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionManager.cs index a84685c4c..bcca46118 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionManager.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionManager.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalUpdateConstructionManager : GH_SAMVariableOutputParame /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -90,7 +93,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) ConstructionManager constructionManager = null; index = Params.IndexOfInputParam("_constructionManager"); - if(index == -1 || !dataAccess.GetData(index, ref constructionManager) || constructionManager == null) + if (index == -1 || !dataAccess.GetData(index, ref constructionManager) || constructionManager == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -183,4 +186,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionsByConstructionManager.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionsByConstructionManager.cs index e3dd62c6d..5e34c21dd 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionsByConstructionManager.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionsByConstructionManager.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalUpdateConstructionsByConstructionManager : GH_SAMVaria /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.tertiary; @@ -127,4 +130,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionsByConstructionManagerAndPanels.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionsByConstructionManagerAndPanels.cs index faad48e52..3790c8365 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionsByConstructionManagerAndPanels.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionsByConstructionManagerAndPanels.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalUpdateConstructionsByConstructionManagerAndPanels : GH /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.tertiary; @@ -32,9 +35,9 @@ public class SAMAnalyticalUpdateConstructionsByConstructionManagerAndPanels : GH /// Initializes a new instance of the SAM_point3D class. /// public SAMAnalyticalUpdateConstructionsByConstructionManagerAndPanels() - : base("SAMAnalytical.UpdateConstructionsByConstructionManagerAndPanels", - "SAMAnalytical.UpdateConstructionsByConstructionManagerAndPanels", - "Update Constructions in Analytical Model By ConstructionManager and Panels", + : base("SAMAnalytical.UpdateConstructionsByConstructionManagerAndPanels", + "SAMAnalytical.UpdateConstructionsByConstructionManagerAndPanels", + "Update Constructions in Analytical Model By ConstructionManager and Panels", "SAM", "Analytical04") { @@ -168,22 +171,22 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) foreach (GooPanel gooPanel in gooPanels) { IPanel panel = gooPanel?.Value; - if(panel == null) + if (panel == null) { continue; } panel = panels.Find(x => x.Guid == panel.Guid); - if(panel == null) + if (panel == null) { continue; } - if(panel is Panel) + if (panel is Panel) { panel = Create.Panel((Panel)panel, construction_Temp); } - else if(panel is ExternalPanel) + else if (panel is ExternalPanel) { panel = new ExternalPanel(panel.Face3D, construction_Temp); } @@ -192,7 +195,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } List materials = constructionManager.GetMaterials(construction_Temp); - if(materials != null && materials.Count != 0) + if (materials != null && materials.Count != 0) { materials.ForEach(x => analyticalModel.AddMaterial(x)); } @@ -215,4 +218,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionsByMap.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionsByMap.cs index dff1d5ec5..e27e1c8dd 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionsByMap.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionsByMap.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalUpdateConstructionsByMap : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -133,13 +136,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) else if (sAMObject is AdjacencyCluster) { AdjacencyCluster adjacencyCluster = (AdjacencyCluster)sAMObject; - ConstructionLibrary constructionLibrary_Temp = null; - List panels_Temp = adjacencyCluster.GetPanels(); - if(panels_Temp != null) + ConstructionLibrary constructionLibrary_Temp = null; + List panels_Temp = adjacencyCluster.GetPanels(); + if (panels_Temp != null) { adjacencyCluster = (AdjacencyCluster)adjacencyCluster.Clone(); constructionLibrary_Temp = Analytical.Modify.UpdateConstructionsByName(panels_Temp, constructionLibrary, delimitedFileTable, sourceColumnName, templateColumnName, destinationColumnName); - foreach(Panel panel in panels_Temp) + foreach (Panel panel in panels_Temp) adjacencyCluster.AddObject(panel); } @@ -162,13 +165,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) result.Add(new AnalyticalModel((AnalyticalModel)sAMObject, adjacencyCluster)); constructionLibraries.Add(constructionLibrary_Temp); } - else if(sAMObject is Construction) + else if (sAMObject is Construction) { constructions.Add((Construction)sAMObject); } } - if(panels != null && panels.Count != 0) + if (panels != null && panels.Count != 0) { ConstructionLibrary constructionLibrary_Temp = Analytical.Modify.UpdateConstructionsByName(panels, constructionLibrary, delimitedFileTable, sourceColumnName, templateColumnName, destinationColumnName); panels.ForEach(x => result.Add(x)); @@ -186,4 +189,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(1, constructionLibraries.ConvertAll(x => new GooConstructionLibrary(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionsByName.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionsByName.cs index 56f08a2f5..27f1b249f 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionsByName.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionsByName.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalUpdateConstructionsByName : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -42,7 +45,7 @@ protected override void RegisterInputParams(GH_InputParamManager inputParamManag int index = -1; inputParamManager.AddParameter(new GooJSAMObjectParam(), "_analytical", "_analytical", "SAM Analytical Model ot Adjacency Cluster", GH_ParamAccess.list); - + index = inputParamManager.AddParameter(new GooConstructionLibraryParam(), "constructionLibrary_", "constructionLibrary_", "SAM Analytical ConstructionLibrary", GH_ParamAccess.item); inputParamManager[index].Optional = true; } @@ -89,13 +92,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) else if (sAMObject is AdjacencyCluster) { AdjacencyCluster adjacencyCluster = (AdjacencyCluster)sAMObject; - ConstructionLibrary constructionLibrary_Temp = null; - List panels_Temp = adjacencyCluster.GetPanels(); - if(panels_Temp != null) + ConstructionLibrary constructionLibrary_Temp = null; + List panels_Temp = adjacencyCluster.GetPanels(); + if (panels_Temp != null) { adjacencyCluster = (AdjacencyCluster)adjacencyCluster.Clone(); constructionLibrary_Temp = Analytical.Modify.UpdateConstructionsByName(panels_Temp, constructionLibrary); - foreach(Panel panel in panels_Temp) + foreach (Panel panel in panels_Temp) adjacencyCluster.AddObject(panel); } @@ -120,7 +123,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(panels != null && panels.Count != 0) + if (panels != null && panels.Count != 0) { ConstructionLibrary constructionLibrary_Temp = Analytical.Modify.UpdateConstructionsByName(panels, constructionLibrary); panels.ForEach(x => result.Add(x)); @@ -131,4 +134,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(1, constructionLibraries.ConvertAll(x => new GooConstructionLibrary(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionsByPanelType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionsByPanelType.cs index 2934eaef2..a0d2f5183 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionsByPanelType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionsByPanelType.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalUpdateConstructionsByPanelType : GH_SAMVariableOutputP /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.tertiary; @@ -111,7 +114,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetData(index, ref constructionManager); } - if(constructionManager == null) + if (constructionManager == null) { constructionManager = Analytical.Query.DefaultConstructionManager(); } @@ -121,14 +124,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List materials = new List(); List panels = adjacencyCluster?.GetPanels(); - if(panels != null && panels.Count != 0) + if (panels != null && panels.Count != 0) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster); for (int i = 0; i < panels.Count; i++) { Panel panel = panels[i]; - if(panel == null) + if (panel == null) { continue; } @@ -136,15 +139,15 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) panel = Create.Panel(panel); Construction construction = constructionManager.GetConstructions(panel.PanelType)?.FirstOrDefault(); - if(construction != null) + if (construction != null) { panel = Create.Panel(panel, construction); List materials_Temp = constructionManager.GetMaterials(construction); - if(materials_Temp != null) + if (materials_Temp != null) { - foreach(IMaterial material in materials_Temp) + foreach (IMaterial material in materials_Temp) { - if(materials.Find(x => x.Name == material.Name) == null) + if (materials.Find(x => x.Name == material.Name) == null) { materials.Add(material); } @@ -153,24 +156,24 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } List apertures = panel.Apertures; - if(apertures != null && apertures.Count != 0) + if (apertures != null && apertures.Count != 0) { for (int j = 0; j < apertures.Count; j++) { Aperture aperture = apertures[j]; - if(aperture == null) + if (aperture == null) { continue; } ApertureConstruction apertureConstruction = aperture.ApertureConstruction; - if(apertureConstruction == null) + if (apertureConstruction == null) { continue; } ApertureConstruction apertureConstruction_New = constructionManager.GetApertureConstructions(apertureConstruction.ApertureType, panel.PanelType)?.FirstOrDefault(); - if(apertureConstruction_New == null) + if (apertureConstruction_New == null) { continue; } @@ -199,9 +202,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } MaterialLibrary materialLibrary = analyticalModel.MaterialLibrary; - if(materials != null && materials.Count != 0) + if (materials != null && materials.Count != 0) { - if(materialLibrary == null) + if (materialLibrary == null) { materialLibrary = new MaterialLibrary(analyticalModel.Name); } @@ -223,4 +226,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionsByPanels.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionsByPanels.cs index 97163d9e0..7343f7dd7 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionsByPanels.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateConstructionsByPanels.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalUpdateConstructionsByPanels : GH_SAMVariableOutputPara /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -97,7 +100,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_panels"); List panels = new List(); - if(index == -1 || !dataAccess.GetDataList(index, panels) || panels == null) + if (index == -1 || !dataAccess.GetDataList(index, panels) || panels == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Invalid Data"); return; @@ -105,10 +108,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) double areaFactor = 0.7; index = Params.IndexOfInputParam("areaFactor_"); - if(index != -1) + if (index != -1) { double areaFactor_Temp = 0.7; - if(dataAccess.GetData(index, ref areaFactor_Temp)) + if (dataAccess.GetData(index, ref areaFactor_Temp)) { areaFactor = areaFactor_Temp; } @@ -130,14 +133,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (double.IsNaN(tolerance)) tolerance = Tolerance.Distance; - if(sAMObject is AdjacencyCluster || sAMObject is AnalyticalModel) + if (sAMObject is AdjacencyCluster || sAMObject is AnalyticalModel) { sAMObject = Analytical.Query.UpdateConstructionsByPanels(sAMObject as dynamic, panels, areaFactor, maxDistance, Tolerance.Angle, tolerance); } - + index = Params.IndexOfOutputParam("analytical"); if (index != -1) dataAccess.SetData(index, sAMObject); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateEquipmentGains.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateEquipmentGains.cs index f61481fd6..796883845 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateEquipmentGains.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateEquipmentGains.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalUpdateEquipmentGains : GH_SAMVariableOutputParameterCo /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -31,16 +34,16 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "SAM Analytical AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "spaces_", NickName = "spaces_", Description = "SAM Analytical Space or Spaces. Default all spaces from Analytcial Model", Access = GH_ParamAccess.list, Optional = true}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "spaces_", NickName = "spaces_", Description = "SAM Analytical Space or Spaces. Default all spaces from Analytcial Model", Access = GH_ParamAccess.list, Optional = true }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooProfileParam() { Name = "profileSens_", NickName = "profileSens_", Description = "SAM Analytical Profile for Equipment Sensible Gains", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooProfileParam() { Name = "profileLat_", NickName = "profileLat_", Description = "SAM Analytical Profile for Equipment Latent Gains", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); - result.Add( new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "equipmentSensGainPerArea_", NickName = "equipmentSensGainPerArea_", Description = "Equipment Sensible Gain Per Area, W/m2", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "equipmentSensGainPerArea_", NickName = "equipmentSensGainPerArea_", Description = "Equipment Sensible Gain Per Area, W/m2", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "equipmentLatGainPerArea_", NickName = "equipmentLatGainPerArea_", Description = "Equipment Latent Gain Per Area, W/m2", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "equipmentSensGain_", NickName = "equipmentSensGain_", Description = "Equipment Sensible Gain, W", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "equipmentLatGain_", NickName = "equipmentLatGain_", Description = "Equipment Latent Gain, W", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); //set default values - global::Grasshopper.Kernel.Parameters.Param_Boolean boolean = new global::Grasshopper.Kernel.Parameters.Param_Boolean() { Name = "_multiplySenisbleGainPerPerson_", NickName = "_multiplySenisbleGainPerPerson_", Description = "Multiply Sensible Gain Per Person, Default = false", Access = GH_ParamAccess.item}; + global::Grasshopper.Kernel.Parameters.Param_Boolean boolean = new global::Grasshopper.Kernel.Parameters.Param_Boolean() { Name = "_multiplySenisbleGainPerPerson_", NickName = "_multiplySenisbleGainPerPerson_", Description = "Multiply Sensible Gain Per Person, Default = false", Access = GH_ParamAccess.item }; boolean.SetPersistentData(false); result.Add(new GH_SAMParam(boolean, ParamVisibility.Voluntary)); @@ -53,7 +56,7 @@ protected override GH_SAMParam[] Outputs get { List result = new List(); - result.Add(new GH_SAMParam(new GooAnalyticalModelParam() {Name = "AnalyticalModel", NickName = "AnalyticalModel", Description = "SAM Analytical AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "AnalyticalModel", NickName = "AnalyticalModel", Description = "SAM Analytical AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooInternalConditionParam() { Name = "InternalConditions", NickName = "InternalConditions", Description = "SAM Analytical InternalConditions", Access = GH_ParamAccess.list }, ParamVisibility.Voluntary)); return result.ToArray(); } @@ -74,7 +77,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_analyticalModel"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -91,7 +94,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List spaces = null; index = Params.IndexOfInputParam("spaces_"); - if(index != -1) + if (index != -1) { spaces = new List(); dataAccess.GetDataList(index, spaces); @@ -147,7 +150,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List internalConditions = new List(); - foreach(Space space in spaces) + foreach (Space space in spaces) { if (space == null) continue; @@ -159,7 +162,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) space_Temp = new Space(space_Temp); InternalCondition internalCondition = space_Temp.InternalCondition; - if(internalCondition == null) + if (internalCondition == null) internalCondition = new InternalCondition(space_Temp.Name); if (profile_Sensible != null) @@ -180,7 +183,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (multiplySenisbleGainPerPerson) { double occupancy = space.CalculatedOccupancy(); - if(!double.IsNaN(occupancy)) + if (!double.IsNaN(occupancy)) equipmentSensGain_Temp = equipmentSensGain_Temp * occupancy; else equipmentSensGain_Temp = 0; @@ -198,7 +201,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("AnalyticalModel"); - if(index != -1) + if (index != -1) { analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster, analyticalModel.MaterialLibrary, profileLibrary); dataAccess.SetData(index, new GooAnalyticalModel(analyticalModel)); @@ -209,4 +212,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, internalConditions?.ConvertAll(x => new GooInternalCondition(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateGeometry.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateGeometry.cs index b2767c55b..a79168f4e 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateGeometry.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateGeometry.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using SAM.Geometry.Spatial; @@ -22,7 +25,7 @@ public class SAMAnalyticalUpdateGeometry : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -112,9 +115,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } - if(!includeInternalEdges) + if (!includeInternalEdges) { - for (int i=0; i < geometry3Ds.Count; i++) + for (int i = 0; i < geometry3Ds.Count; i++) { Face3D face3D = geometry3Ds[i] as Face3D; if (face3D == null) @@ -123,7 +126,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) geometry3Ds[i] = new Face3D(face3D.GetExternalEdge3D()); } } - + List panels = Create.Panels(geometry3Ds, panel.PanelType, panel.Construction, minArea, tolerance); if (panels == null || panels.Count == 0) { @@ -148,4 +151,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(0, panels.ConvertAll(x => new GooPanel(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateHeatTransferCoefficients.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateHeatTransferCoefficients.cs index 14ca96de8..bc4c90bd4 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateHeatTransferCoefficients.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateHeatTransferCoefficients.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Parameters; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; @@ -23,7 +26,7 @@ public class SAMAnalyticalUpdateHeatTransferCoefficients : GH_SAMVariableOutputP /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.tertiary | GH_Exposure.obscure; @@ -32,19 +35,19 @@ protected override GH_SAMParam[] Inputs get { Param_Boolean param_Boolean = null; - + GH_SAMParam[] result = new GH_SAMParam[3]; - + result[0] = new GH_SAMParam(new GooAnalyticalModelParam() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "SAM AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding); - param_Boolean = new Param_Boolean() { Name = "_duplicateConstructions", NickName = "_duplicateConstructions", Description = "Duplicate Constructions", Access = GH_ParamAccess.item}; + param_Boolean = new Param_Boolean() { Name = "_duplicateConstructions", NickName = "_duplicateConstructions", Description = "Duplicate Constructions", Access = GH_ParamAccess.item }; param_Boolean.PersistentData.Append(new GH_Boolean(true)); result[1] = new GH_SAMParam(param_Boolean, ParamVisibility.Binding); param_Boolean = new Param_Boolean() { Name = "_duplicateApertureConstructions", NickName = "_duplicateApertureConstructions", Description = "Duplicate Aperture Constructions", Access = GH_ParamAccess.item }; param_Boolean.PersistentData.Append(new GH_Boolean(true)); result[2] = new GH_SAMParam(param_Boolean, ParamVisibility.Binding); - + return result; } } @@ -54,7 +57,7 @@ protected override GH_SAMParam[] Outputs get { GH_SAMParam[] result = new GH_SAMParam[3]; - result[0] = new GH_SAMParam(new GooAnalyticalModelParam() {Name = "AnalyticalModel", NickName = "AnalyticalModel", Description = "SAM AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding); + result[0] = new GH_SAMParam(new GooAnalyticalModelParam() { Name = "AnalyticalModel", NickName = "AnalyticalModel", Description = "SAM AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding); result[1] = new GH_SAMParam(new GooConstructionParam() { Name = "Constructions", NickName = "Constructions", Description = "Modified SAM Analytical Constructions", Access = GH_ParamAccess.list }, ParamVisibility.Voluntary); result[2] = new GH_SAMParam(new GooApertureConstructionParam() { Name = "ApertureConstructions", NickName = "ApertureConstructions", Description = "Modified SAM Analytical ApertureConstructions", Access = GH_ParamAccess.list }, ParamVisibility.Voluntary); return result; @@ -107,4 +110,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, apertureConstructions?.ConvertAll(x => new GooApertureConstruction(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateInfiltrationGains.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateInfiltrationGains.cs index 32d4e5f49..11f7ba559 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateInfiltrationGains.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateInfiltrationGains.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalUpdateInfiltrationGains : GH_SAMVariableOutputParamete /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -31,9 +34,9 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "SAM Analytical AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "_spaces_", NickName = "_spaces_", Description = "SAM Analytical Spaces, if nothing connected all spaces from AnalyticalModel will be used", Access = GH_ParamAccess.list, Optional = true}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "_spaces_", NickName = "_spaces_", Description = "SAM Analytical Spaces, if nothing connected all spaces from AnalyticalModel will be used", Access = GH_ParamAccess.list, Optional = true }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooProfileParam() { Name = "profile_", NickName = "profile_", Description = "SAM Analytical Profile", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); - result.Add( new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "infiltrationACH_", NickName = "infiltrationACH_", Description = "Infiltration Air Changes Per Hour, ac/h", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "infiltrationACH_", NickName = "infiltrationACH_", Description = "Infiltration Air Changes Per Hour, ac/h", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); //result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Boolean() { Name = "toExternalFacing_", NickName = "toExternalFacing_", Description = "If False then value for Infiltration Air Changes Per Hour will be applied to all spaces", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "airflowPerExtArea_", NickName = "airflowPerExtArea_", Description = "Airflow Per Exposed Panel Area, m3/s per m2 \n*typical building pressures of ~4 Pa between inside and outside, \n* 0.0001 (m3/s per m2 facade) - Tight building, \n* 0.0003 (m3/s per m2 facade) - Average building, \n* 0.0006 (m3/s per m2 facade) - Leaky building", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); @@ -50,7 +53,7 @@ protected override GH_SAMParam[] Outputs get { List result = new List(); - result.Add(new GH_SAMParam(new GooAnalyticalModelParam() {Name = "AnalyticalModel", NickName = "AnalyticalModel", Description = "SAM Analytical AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "AnalyticalModel", NickName = "AnalyticalModel", Description = "SAM Analytical AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooInternalConditionParam() { Name = "InternalConditions", NickName = "InternalConditions", Description = "SAM Analytical InternalConditions", Access = GH_ParamAccess.list }, ParamVisibility.Voluntary)); return result.ToArray(); } @@ -71,7 +74,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_analyticalModel"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -88,7 +91,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List spaces = null; index = Params.IndexOfInputParam("_spaces_"); - if(index != -1) + if (index != -1) { spaces = new List(); dataAccess.GetDataList(index, spaces); @@ -126,7 +129,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List internalConditions = new List(); - foreach(Space space in spaces) + foreach (Space space in spaces) { if (space == null) continue; @@ -138,13 +141,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) space_Temp = new Space(space_Temp); InternalCondition internalCondition = space_Temp.InternalCondition; - if(internalCondition == null) + if (internalCondition == null) internalCondition = new InternalCondition(space_Temp.Name); if (profile != null) internalCondition.SetValue(InternalConditionParameter.InfiltrationProfileName, profile.Name); - if(!double.IsNaN(infiltrationAirChangesPerHour) || !double.IsNaN(airflowPerExtArea)) + if (!double.IsNaN(infiltrationAirChangesPerHour) || !double.IsNaN(airflowPerExtArea)) { double value = 0; // m3/s = ac/h * ZoneVolume / 3600 @@ -160,7 +163,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (!space.TryGetValue(SpaceParameter.Volume, out volume)) volume = space.Volume(adjacencyCluster); - if(!double.IsNaN(area_External) && !double.IsNaN(volume) && volume != 0) + if (!double.IsNaN(area_External) && !double.IsNaN(volume) && volume != 0) value = (airflowPerExtArea * area_External * 3600) / volume; } else @@ -185,7 +188,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("AnalyticalModel"); - if(index != -1) + if (index != -1) { analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster, analyticalModel.MaterialLibrary, profileLibrary); dataAccess.SetData(index, new GooAnalyticalModel(analyticalModel)); @@ -196,4 +199,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, internalConditions?.ConvertAll(x => new GooInternalCondition(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateInternalCondition.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateInternalCondition.cs index 04ce077e3..0332c8715 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateInternalCondition.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateInternalCondition.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalUpdateInternalCondition : GH_SAMVariableOutputParamete /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -37,13 +40,13 @@ protected override GH_SAMParam[] Inputs List result = new List(); result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "SAM Analytical AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - GooSpaceParam gooSpaceParam = new GooSpaceParam() { Name = "_spaces", NickName = "_spaces", Description = "SAM Analytical Spaces. If not provided all Spaces from Analytical Model will be used and modified", Access = GH_ParamAccess.list}; + GooSpaceParam gooSpaceParam = new GooSpaceParam() { Name = "_spaces", NickName = "_spaces", Description = "SAM Analytical Spaces. If not provided all Spaces from Analytical Model will be used and modified", Access = GH_ParamAccess.list }; result.Add(new GH_SAMParam(gooSpaceParam, ParamVisibility.Binding)); global::Grasshopper.Kernel.Parameters.Param_String @string = new global::Grasshopper.Kernel.Parameters.Param_String() { Name = "iCname_", NickName = "iCname_", Description = "new Internal Condition Name to allow name change", Access = GH_ParamAccess.item, Optional = true }; result.Add(new GH_SAMParam(@string, ParamVisibility.Binding)); - GooProfileParam gooProfileParam = new GooProfileParam() { Name = "gainProfile_", NickName = "gainProfile_", Description = "SAM Analytical Profile for gains, in not provided default 24h profile: 8to18 profile will be used fro all gains", Access = GH_ParamAccess.item, Optional = true}; + GooProfileParam gooProfileParam = new GooProfileParam() { Name = "gainProfile_", NickName = "gainProfile_", Description = "SAM Analytical Profile for gains, in not provided default 24h profile: 8to18 profile will be used fro all gains", Access = GH_ParamAccess.item, Optional = true }; result.Add(new GH_SAMParam(gooProfileParam, ParamVisibility.Binding)); GooDegreeOfActivityParam gooDegreeOfActivityParam = new GooDegreeOfActivityParam() { Name = "degreeOfActivity_", NickName = "degreeOfActivity_", Description = "SAM Analytical DegreeOfActivity, default: 'Moderate office work' Sens=75 & Lat=55 W/person", Access = GH_ParamAccess.item, Optional = true }; @@ -54,7 +57,7 @@ protected override GH_SAMParam[] Inputs number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "areaPerPerson_", NickName = "areaPerPerson_", Description = "Area Per Person, default 10 m2/person", Access = GH_ParamAccess.item, Optional = true }; result.Add(new GH_SAMParam(number, ParamVisibility.Binding)); - number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "occupancy_", NickName = "occupancy_", Description = "Occupancy(Number of People) will overide _areaPerPerson_ ", Access = GH_ParamAccess.item, Optional = true}; + number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "occupancy_", NickName = "occupancy_", Description = "Occupancy(Number of People) will overide _areaPerPerson_ ", Access = GH_ParamAccess.item, Optional = true }; result.Add(new GH_SAMParam(number, ParamVisibility.Binding)); number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "lightingGainPerArea_", NickName = "lightingGainPerArea_", Description = "Lighting Gain Per Area at specified profile, default 8 W/m2", Access = GH_ParamAccess.item, Optional = true }; @@ -63,10 +66,10 @@ protected override GH_SAMParam[] Inputs number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "lightingLevel_", NickName = "lightingLevel_", Description = "Lighting Level", Access = GH_ParamAccess.item, Optional = true }; result.Add(new GH_SAMParam(number, ParamVisibility.Binding)); - number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "equipmentSensGainPerArea_", NickName = "equipmentSensGainPerArea_", Description = "Equipment Sensible Gain Per Area at specified profile, default 15 W/m2", Access = GH_ParamAccess.item, Optional = true}; + number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "equipmentSensGainPerArea_", NickName = "equipmentSensGainPerArea_", Description = "Equipment Sensible Gain Per Area at specified profile, default 15 W/m2", Access = GH_ParamAccess.item, Optional = true }; result.Add(new GH_SAMParam(number, ParamVisibility.Binding)); - number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "equipmentLatGainPerArea_", NickName = "equipmentLatGainPerArea_", Description = "Equipment Latent Gain Per Area at specified profile, default 0 W/m2", Access = GH_ParamAccess.item, Optional = true}; + number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "equipmentLatGainPerArea_", NickName = "equipmentLatGainPerArea_", Description = "Equipment Latent Gain Per Area at specified profile, default 0 W/m2", Access = GH_ParamAccess.item, Optional = true }; result.Add(new GH_SAMParam(number, ParamVisibility.Binding)); global::Grasshopper.Kernel.Parameters.Param_GenericObject genericObject = null; @@ -74,16 +77,16 @@ protected override GH_SAMParam[] Inputs genericObject = new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "heatingSetPoint_", NickName = "heatingSetPoint_", Description = "Heating SetPoint, default Constant 21 degC", Access = GH_ParamAccess.item, Optional = true }; result.Add(new GH_SAMParam(genericObject, ParamVisibility.Binding)); - genericObject = new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "coolingSetPoint_", NickName = "coolingSetPoint_", Description = "Cooling SetPoint, default Constant 24 degC", Access = GH_ParamAccess.item, Optional = true}; + genericObject = new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "coolingSetPoint_", NickName = "coolingSetPoint_", Description = "Cooling SetPoint, default Constant 24 degC", Access = GH_ParamAccess.item, Optional = true }; result.Add(new GH_SAMParam(genericObject, ParamVisibility.Binding)); - genericObject = new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "humidificationSetPoint_", NickName = "humidificationSetPoint_", Description = "Humidification SetPoint, default Constant 40%", Access = GH_ParamAccess.item, Optional = true}; + genericObject = new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "humidificationSetPoint_", NickName = "humidificationSetPoint_", Description = "Humidification SetPoint, default Constant 40%", Access = GH_ParamAccess.item, Optional = true }; result.Add(new GH_SAMParam(genericObject, ParamVisibility.Binding)); - genericObject = new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "dehumidificationSetPoint_", NickName = "dehumidificationSetPoint_", Description = "Dehumidification SetPoint, default Constant 60%", Access = GH_ParamAccess.item, Optional = true}; + genericObject = new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "dehumidificationSetPoint_", NickName = "dehumidificationSetPoint_", Description = "Dehumidification SetPoint, default Constant 60%", Access = GH_ParamAccess.item, Optional = true }; result.Add(new GH_SAMParam(genericObject, ParamVisibility.Binding)); - number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "infiltrationACH_", NickName = "infiltrationACH_", Description = "Infiltration, default Constant 0.2 ac/h for spaces with external Panels", Access = GH_ParamAccess.item, Optional = true}; + number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "infiltrationACH_", NickName = "infiltrationACH_", Description = "Infiltration, default Constant 0.2 ac/h for spaces with external Panels", Access = GH_ParamAccess.item, Optional = true }; result.Add(new GH_SAMParam(number, ParamVisibility.Binding)); number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "pollutantGPerHrPerPerson_", NickName = "pollutantGPerHrPerPerson_", Description = "Pollutant Generation Per Hour Per Person using Profile, default 37.5 g/hr/person see https://www.irbnet.de/daten/iconda/CIB6974.pdf]", Access = GH_ParamAccess.item, Optional = true }; @@ -98,7 +101,7 @@ protected override GH_SAMParam[] Outputs get { List result = new List(); - result.Add(new GH_SAMParam(new GooAnalyticalModelParam() {Name = "analyticalModel", NickName = "analyticalModel", Description = "SAM Analytical Model with ", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "analyticalModel", NickName = "analyticalModel", Description = "SAM Analytical Model with ", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooInternalConditionParam() { Name = "internalConditions", NickName = "internalConditions", Description = "SAM Analytical InternalConditions", Access = GH_ParamAccess.list }, ParamVisibility.Voluntary)); return result.ToArray(); } @@ -119,7 +122,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_analyticalModel"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -136,7 +139,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List spaces = null; index = Params.IndexOfInputParam("_spaces"); - if(index != -1) + if (index != -1) { spaces = new List(); dataAccess.GetDataList(index, spaces); @@ -213,7 +216,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { GH_ObjectWrapper objectWrapper = null; - if(dataAccess.GetData(index, ref objectWrapper)) + if (dataAccess.GetData(index, ref objectWrapper)) { object value = objectWrapper.Value; if (value is IGH_Goo) @@ -221,7 +224,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) value = (value as dynamic).Value; } - if(value is double) + if (value is double) { double heatingSetPoint = (double)value; profile_Heating = double.IsNaN(heatingSetPoint) ? null : new Profile(string.Format("HTG_1to24_{0}", heatingSetPoint), heatingSetPoint, ProfileGroup.Thermostat); @@ -320,7 +323,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) string name = null; index = Params.IndexOfInputParam("iCname_"); - if(index != -1) + if (index != -1) { dataAccess.GetData(index, ref name); } @@ -333,12 +336,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } Profile profile_Infiltartion = null; - if(!double.IsNaN(infiltration)) + if (!double.IsNaN(infiltration)) { ProfileLibrary profileLibrary_Default = ActiveSetting.Setting.GetValue(AnalyticalSettingParameter.DefaultProfileLibrary); profile_Infiltartion = profileLibrary_Default.GetProfile("Constant", ProfileGroup.Gain, true); } - + ProfileLibrary profileLibrary = analyticalModel.ProfileLibrary; if (profile_Gain != null) @@ -361,7 +364,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List internalConditions = new List(); - foreach(Space space in spaces) + foreach (Space space in spaces) { if (space == null) continue; @@ -373,7 +376,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) space_Temp = new Space(space_Temp); InternalCondition internalCondition = space_Temp.InternalCondition; - if(internalCondition == null) + if (internalCondition == null) internalCondition = new InternalCondition(space_Temp.Name); if (!string.IsNullOrEmpty(name)) @@ -386,11 +389,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) internalCondition.SetValue(InternalConditionParameter.EquipmentSensibleProfileName, profile_Gain.Name); internalCondition.SetValue(InternalConditionParameter.EquipmentLatentProfileName, profile_Gain.Name); - if(!double.IsNaN(pollutantGenerationPerPerson)) + if (!double.IsNaN(pollutantGenerationPerPerson)) internalCondition.SetValue(InternalConditionParameter.PollutantProfileName, profile_Gain.Name); } - if(profile_Heating != null) + if (profile_Heating != null) internalCondition.SetValue(InternalConditionParameter.HeatingProfileName, profile_Heating.Name); if (profile_Cooling != null) @@ -402,7 +405,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (profile_Dehumidification != null) internalCondition.SetValue(InternalConditionParameter.DehumidificationProfileName, profile_Dehumidification.Name); - if(profile_Infiltartion != null) + if (profile_Infiltartion != null) internalCondition.SetValue(InternalConditionParameter.InfiltrationProfileName, profile_Infiltartion.Name); if (degreeOfActivity != null) @@ -453,7 +456,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("analyticalModel"); - if(index != -1) + if (index != -1) { analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster, analyticalModel.MaterialLibrary, profileLibrary); dataAccess.SetData(index, new GooAnalyticalModel(analyticalModel)); @@ -464,4 +467,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, internalConditions?.ConvertAll(x => new GooInternalCondition(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateInternalConditionList.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateInternalConditionList.cs index 265a77993..d73f9d34f 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateInternalConditionList.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateInternalConditionList.cs @@ -1,11 +1,13 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; using System.Collections.Generic; using System.Linq; -using static SAM.Geometry.Rhino.ActiveSetting; namespace SAM.Analytical.Grasshopper { @@ -24,7 +26,7 @@ public class SAMAnalyticalUpdateInternalConditionList : GH_SAMVariableOutputPara /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -39,13 +41,13 @@ protected override GH_SAMParam[] Inputs List result = new List(); result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "SAM Analytical AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - GooSpaceParam gooSpaceParam = new GooSpaceParam() { Name = "_spaces", NickName = "_spaces", Description = "SAM Analytical Spaces. If not provided all Spaces from Analytical Model will be used and modified", Access = GH_ParamAccess.list}; + GooSpaceParam gooSpaceParam = new GooSpaceParam() { Name = "_spaces", NickName = "_spaces", Description = "SAM Analytical Spaces. If not provided all Spaces from Analytical Model will be used and modified", Access = GH_ParamAccess.list }; result.Add(new GH_SAMParam(gooSpaceParam, ParamVisibility.Binding)); global::Grasshopper.Kernel.Parameters.Param_String @string = new global::Grasshopper.Kernel.Parameters.Param_String() { Name = "iCnames_", NickName = "iCnames_", Description = "New Internal Condition Names to allow name change", Access = GH_ParamAccess.list, Optional = true }; result.Add(new GH_SAMParam(@string, ParamVisibility.Binding)); - GooProfileParam gooProfileParam = new GooProfileParam() { Name = "gainProfiles_", NickName = "gainProfiles_", Description = "SAM Analytical Profiles for gains, in not provided default 24h profile: 8to18 profile will be used fro all gains", Access = GH_ParamAccess.list, Optional = true}; + GooProfileParam gooProfileParam = new GooProfileParam() { Name = "gainProfiles_", NickName = "gainProfiles_", Description = "SAM Analytical Profiles for gains, in not provided default 24h profile: 8to18 profile will be used fro all gains", Access = GH_ParamAccess.list, Optional = true }; result.Add(new GH_SAMParam(gooProfileParam, ParamVisibility.Binding)); GooDegreeOfActivityParam gooDegreeOfActivityParam = new GooDegreeOfActivityParam() { Name = "degreeOfActivities_", NickName = "degreeOfActivities_", Description = "SAM Analytical DegreeOfActivities, default: 'Moderate office work' Sens=75 & Lat=55 W/person", Access = GH_ParamAccess.list, Optional = true }; @@ -56,7 +58,7 @@ protected override GH_SAMParam[] Inputs number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "areasPerPerson_", NickName = "areasPerPerson_", Description = "Areas Per Person, default 10 m2/person", Access = GH_ParamAccess.list, Optional = true }; result.Add(new GH_SAMParam(number, ParamVisibility.Binding)); - number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "occupancies_", NickName = "occupancies_", Description = "Occupancies (Number of People) will overide _areaPerPerson_ ", Access = GH_ParamAccess.list, Optional = true}; + number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "occupancies_", NickName = "occupancies_", Description = "Occupancies (Number of People) will overide _areaPerPerson_ ", Access = GH_ParamAccess.list, Optional = true }; result.Add(new GH_SAMParam(number, ParamVisibility.Binding)); number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "lightingGainsPerArea_", NickName = "lightingGainsPerArea_", Description = "Lighting Gains Per Area at specified profiles, default 8 W/m2", Access = GH_ParamAccess.list, Optional = true }; @@ -65,10 +67,10 @@ protected override GH_SAMParam[] Inputs number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "lightingLevels_", NickName = "lightingLevels_", Description = "Lighting Levels", Access = GH_ParamAccess.list, Optional = true }; result.Add(new GH_SAMParam(number, ParamVisibility.Binding)); - number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "equipmentSensGainsPerArea_", NickName = "equipmentSensGainsPerArea_", Description = "Equipment Sensible Gains Per Area at specified profiles, default 15 W/m2", Access = GH_ParamAccess.list, Optional = true}; + number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "equipmentSensGainsPerArea_", NickName = "equipmentSensGainsPerArea_", Description = "Equipment Sensible Gains Per Area at specified profiles, default 15 W/m2", Access = GH_ParamAccess.list, Optional = true }; result.Add(new GH_SAMParam(number, ParamVisibility.Binding)); - number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "equipmentLatGainsPerAreas_", NickName = "equipmentLatGainsPerAreas_", Description = "Equipment Latent Gains Per Area at specified profiles, default 0 W/m2", Access = GH_ParamAccess.list, Optional = true}; + number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "equipmentLatGainsPerAreas_", NickName = "equipmentLatGainsPerAreas_", Description = "Equipment Latent Gains Per Area at specified profiles, default 0 W/m2", Access = GH_ParamAccess.list, Optional = true }; result.Add(new GH_SAMParam(number, ParamVisibility.Binding)); global::Grasshopper.Kernel.Parameters.Param_GenericObject genericObject = null; @@ -76,16 +78,16 @@ protected override GH_SAMParam[] Inputs genericObject = new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "heatingSetPoints_", NickName = "heatingSetPoints_", Description = "Heating SetPoints, default Constant 21 degC \n* Input as Values or Profiles", Access = GH_ParamAccess.list, Optional = true }; result.Add(new GH_SAMParam(genericObject, ParamVisibility.Binding)); - genericObject = new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "coolingSetPoints_", NickName = "coolingSetPoints_", Description = "Cooling SetPoints, default Constant 24 degC\n* Input as Values or Profiles", Access = GH_ParamAccess.list, Optional = true}; + genericObject = new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "coolingSetPoints_", NickName = "coolingSetPoints_", Description = "Cooling SetPoints, default Constant 24 degC\n* Input as Values or Profiles", Access = GH_ParamAccess.list, Optional = true }; result.Add(new GH_SAMParam(genericObject, ParamVisibility.Binding)); - genericObject = new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "humidificationSetPoints_", NickName = "humidificationSetPoints_", Description = "Humidification SetPoints, default Constant 40%\n* Input as Values or Profiles", Access = GH_ParamAccess.list, Optional = true}; + genericObject = new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "humidificationSetPoints_", NickName = "humidificationSetPoints_", Description = "Humidification SetPoints, default Constant 40%\n* Input as Values or Profiles", Access = GH_ParamAccess.list, Optional = true }; result.Add(new GH_SAMParam(genericObject, ParamVisibility.Binding)); - genericObject = new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "dehumidificationSetPoints_", NickName = "dehumidificationSetPoints_", Description = "Dehumidification SetPoints, default Constant 60%\n* Input as Values or Profiles", Access = GH_ParamAccess.list, Optional = true}; + genericObject = new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "dehumidificationSetPoints_", NickName = "dehumidificationSetPoints_", Description = "Dehumidification SetPoints, default Constant 60%\n* Input as Values or Profiles", Access = GH_ParamAccess.list, Optional = true }; result.Add(new GH_SAMParam(genericObject, ParamVisibility.Binding)); - number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "infiltrationsACH_", NickName = "infiltrationsACH_", Description = "Infiltrations, default Constant 0.2 ac/h for spaces with external Panels", Access = GH_ParamAccess.list, Optional = true}; + number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "infiltrationsACH_", NickName = "infiltrationsACH_", Description = "Infiltrations, default Constant 0.2 ac/h for spaces with external Panels", Access = GH_ParamAccess.list, Optional = true }; result.Add(new GH_SAMParam(number, ParamVisibility.Binding)); number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "pollutantGsPerHrPerPerson_", NickName = "pollutantGsPerHrPerPerson_", Description = "Pollutant Generations Per Hour Per Person using Profile, default 37.5 g/hr/person see https://www.irbnet.de/daten/iconda/CIB6974.pdf]", Access = GH_ParamAccess.list, Optional = true }; @@ -100,7 +102,7 @@ protected override GH_SAMParam[] Outputs get { List result = new List(); - result.Add(new GH_SAMParam(new GooAnalyticalModelParam() {Name = "analyticalModel", NickName = "analyticalModel", Description = "SAM Analytical Model with ", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "analyticalModel", NickName = "analyticalModel", Description = "SAM Analytical Model with ", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooInternalConditionParam() { Name = "internalConditions", NickName = "internalConditions", Description = "SAM Analytical InternalConditions", Access = GH_ParamAccess.list }, ParamVisibility.Voluntary)); return result.ToArray(); } @@ -121,7 +123,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_analyticalModel"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -138,7 +140,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List spaces = null; index = Params.IndexOfInputParam("_spaces"); - if(index != -1) + if (index != -1) { spaces = new List(); dataAccess.GetDataList(index, spaces); @@ -153,7 +155,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) spaces = analyticalModel.GetSpaces(); } - List profiles_Gain = new List(); + List profiles_Gain = new List(); index = Params.IndexOfInputParam("gainProfiles_"); if (index != -1) { @@ -216,7 +218,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("heatingSetPoints_"); if (index != -1 && dataAccess.GetDataList(index, objectWrappers)) { - foreach(GH_ObjectWrapper objectWrapper in objectWrappers) + foreach (GH_ObjectWrapper objectWrapper in objectWrappers) { object value = objectWrapper.Value; if (value is IGH_Goo) @@ -352,7 +354,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List names = new List(); index = Params.IndexOfInputParam("iCnames_"); - if(index != -1) + if (index != -1) { dataAccess.GetDataList(index, names); } @@ -365,12 +367,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } Profile profile_Infiltartion = null; - if(infiltrations != null || infiltrations.Count != 0) + if (infiltrations != null || infiltrations.Count != 0) { ProfileLibrary profileLibrary_Default = ActiveSetting.Setting.GetValue(AnalyticalSettingParameter.DefaultProfileLibrary); profile_Infiltartion = profileLibrary_Default.GetProfile("Constant", ProfileGroup.Gain, true); } - + ProfileLibrary profileLibrary = analyticalModel.ProfileLibrary; if (profile_Infiltartion != null) @@ -436,7 +438,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { double value = pollutantGenerationsPerPerson.Count > i ? pollutantGenerationsPerPerson[i] : pollutantGenerationsPerPerson.Last(); string name = internalCondition.GetValue(InternalConditionParameter.OccupancyProfileName); - if(string.IsNullOrWhiteSpace(name)) + if (string.IsNullOrWhiteSpace(name)) { name = value.ToString(); } @@ -446,10 +448,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } Profile profile = profileLibrary.GetProfile(name, ProfileType.Pollutant, true); - if(profile == null) + if (profile == null) { profile = internalCondition.GetProfile(ProfileType.Occupancy, analyticalModel.ProfileLibrary, true); - if(profile != null) + if (profile != null) { profile = new Profile(Guid.NewGuid(), profile, name, ProfileType.Pollutant.ToString()); } @@ -568,7 +570,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("analyticalModel"); - if(index != -1) + if (index != -1) { analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster, analyticalModel.MaterialLibrary, profileLibrary); dataAccess.SetData(index, new GooAnalyticalModel(analyticalModel)); @@ -579,4 +581,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, internalConditions?.ConvertAll(x => new GooInternalCondition(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateLibraries.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateLibraries.cs index 1b5600134..58a1a38d3 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateLibraries.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateLibraries.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -23,7 +26,7 @@ public class SAMAnalyticalUpdateLibraries : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -88,7 +91,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } - foreach(ISAMLibrary sAMLibrary in sAMLibraries) + foreach (ISAMLibrary sAMLibrary in sAMLibraries) { if (sAMLibrary is MaterialLibrary) { @@ -126,4 +129,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooAnalyticalModel(analyticalModel)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateLightingGains.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateLightingGains.cs index eef44be95..26b19f68c 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateLightingGains.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateLightingGains.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalUpdateLightingGains : GH_SAMVariableOutputParameterCom /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -31,9 +34,9 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "SAM Analytical AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "_spaces_", NickName = "_spaces_", Description = "SAM Analytical Spaces, if nothing connected all spaces from AnalyticalModel will be used", Access = GH_ParamAccess.list, Optional = true}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "_spaces_", NickName = "_spaces_", Description = "SAM Analytical Spaces, if nothing connected all spaces from AnalyticalModel will be used", Access = GH_ParamAccess.list, Optional = true }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooProfileParam() { Name = "profile_", NickName = "_profile_", Description = "SAM Analytical Profile", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); - result.Add( new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "lightingGainPerArea_", NickName = "lightingGainPerArea_", Description = "Lighting Gain Per Area, W/m2", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "lightingGainPerArea_", NickName = "lightingGainPerArea_", Description = "Lighting Gain Per Area, W/m2", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "lightingGain_", NickName = "lightingGain_", Description = "Lighting Gain, W", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "lightingLevel_", NickName = "lightingLevel_", Description = "Lighting Level, lux", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "lightingEfficiency_", NickName = "lightingEfficiency_", Description = "Lighting Efficiency, W/m²/100lux", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); @@ -47,7 +50,7 @@ protected override GH_SAMParam[] Outputs get { List result = new List(); - result.Add(new GH_SAMParam(new GooAnalyticalModelParam() {Name = "analyticalModel", NickName = "analyticalModel", Description = "SAM Analytical AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "analyticalModel", NickName = "analyticalModel", Description = "SAM Analytical AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooInternalConditionParam() { Name = "internalConditions", NickName = "internalConditions", Description = "SAM Analytical InternalConditions", Access = GH_ParamAccess.list }, ParamVisibility.Voluntary)); return result.ToArray(); } @@ -68,7 +71,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_analyticalModel"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -85,7 +88,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List spaces = null; index = Params.IndexOfInputParam("_spaces_"); - if(index != -1) + if (index != -1) { spaces = new List(); dataAccess.GetDataList(index, spaces); @@ -127,7 +130,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { dataAccess.GetData(index, ref functions); - if(string.IsNullOrWhiteSpace(functions)) + if (string.IsNullOrWhiteSpace(functions)) { functions = null; } @@ -140,7 +143,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List internalConditions = new List(); - foreach(Space space in spaces) + foreach (Space space in spaces) { if (space == null) continue; @@ -152,13 +155,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) space_Temp = new Space(space_Temp); InternalCondition internalCondition = space_Temp.InternalCondition; - if(internalCondition == null) + if (internalCondition == null) internalCondition = new InternalCondition(space_Temp.Name); if (profile != null) internalCondition.SetValue(InternalConditionParameter.LightingProfileName, profile.Name); - if(!double.IsNaN(lightingGainPerArea)) + if (!double.IsNaN(lightingGainPerArea)) internalCondition.SetValue(InternalConditionParameter.LightingGainPerArea, lightingGainPerArea); if (!double.IsNaN(lightingGain)) @@ -172,7 +175,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (functions != null) { - if(string.IsNullOrEmpty(functions)) + if (string.IsNullOrEmpty(functions)) { internalCondition.RemoveValue(InternalConditionParameter.LightingControlFunction); } @@ -188,7 +191,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("analyticalModel"); - if(index != -1) + if (index != -1) { analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster, analyticalModel.MaterialLibrary, profileLibrary); dataAccess.SetData(index, new GooAnalyticalModel(analyticalModel)); @@ -199,4 +202,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, internalConditions?.ConvertAll(x => new GooInternalCondition(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateNCM.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateNCM.cs index 4b9393b0e..fddac0c53 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateNCM.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateNCM.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalUpdateNCM : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -32,7 +35,7 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "SAM Analytical AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_spaces_", NickName = "_spaces_", Description = "SAM Analytical Spaces or Zones, if nothing connected all spaces from AnalyticalModel will be used", Access = GH_ParamAccess.list, Optional = true}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_spaces_", NickName = "_spaces_", Description = "SAM Analytical Spaces or Zones, if nothing connected all spaces from AnalyticalModel will be used", Access = GH_ParamAccess.list, Optional = true }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_String() { Name = "name_", NickName = "name_", Description = "NCM Name\n *Type under inspect of NCM Data in Internal Condition", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_String() { Name = "systemType_", NickName = "systemType_", Description = "System Type", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); @@ -55,7 +58,7 @@ protected override GH_SAMParam[] Outputs get { List result = new List(); - result.Add(new GH_SAMParam(new GooAnalyticalModelParam() {Name = "analyticalModel", NickName = "analyticalModel", Description = "SAM Analytical AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "analyticalModel", NickName = "analyticalModel", Description = "SAM Analytical AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "spaces", NickName = "spaces", Description = "SAM Analytical Spaces", Access = GH_ParamAccess.list, Optional = true }, ParamVisibility.Binding)); return result.ToArray(); @@ -77,7 +80,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_analyticalModel"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -96,22 +99,22 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List objectWrappers = new List(); index = Params.IndexOfInputParam("_spaces_"); - if(index != -1) + if (index != -1) { spaces = new List(); dataAccess.GetDataList(index, objectWrappers); - if(objectWrappers != null && objectWrappers.Count != 0) + if (objectWrappers != null && objectWrappers.Count != 0) { - foreach(GH_ObjectWrapper objectWrapper in objectWrappers) + foreach (GH_ObjectWrapper objectWrapper in objectWrappers) { - if(objectWrapper.Value is Space) + if (objectWrapper.Value is Space) { spaces.Add((Space)objectWrapper.Value); } - else if(objectWrapper.Value is Zone) + else if (objectWrapper.Value is Zone) { List spaces_Temp = adjacencyCluster.GetRelatedObjects((Zone)objectWrapper.Value); - if(spaces_Temp != null && spaces_Temp.Count != 0) + if (spaces_Temp != null && spaces_Temp.Count != 0) { spaces.AddRange(spaces_Temp); } @@ -257,9 +260,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } List spaces_Result = new List(); - foreach(Space space in spaces) + foreach (Space space in spaces) { - if(space == null) + if (space == null) { continue; } @@ -267,7 +270,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) Space space_Temp = new Space(space); InternalCondition internalCondition = space_Temp.InternalCondition; - if(internalCondition == null) + if (internalCondition == null) { continue; } @@ -286,7 +289,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) nCMData.Name = name; } - if(nCMSystemType != null && nCMSystemType.HasValue) + if (nCMSystemType != null && nCMSystemType.HasValue) { nCMData.SystemType = nCMSystemType.Value; } @@ -301,7 +304,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) nCMData.LightingOccupancyControls = lightingOccupancyControls.Value; } - if(lightingPhotoelectricBackSpaceSensor != null && lightingPhotoelectricBackSpaceSensor.HasValue) + if (lightingPhotoelectricBackSpaceSensor != null && lightingPhotoelectricBackSpaceSensor.HasValue) { nCMData.LightingPhotoelectricBackSpaceSensor = lightingPhotoelectricBackSpaceSensor.Value; } @@ -331,7 +334,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) nCMData.AirPermeability = airPermeability.Value; } - if(description != null) + if (description != null) { nCMData.Description = description; } @@ -345,7 +348,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("analyticalModel"); - if(index != -1) + if (index != -1) { analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster, analyticalModel.MaterialLibrary, analyticalModel.ProfileLibrary); dataAccess.SetData(index, new GooAnalyticalModel(analyticalModel)); @@ -356,4 +359,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, spaces_Result?.ConvertAll(x => new GooSpace(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateName.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateName.cs index c60b23d91..eaec1cb33 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateName.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateName.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -21,7 +24,7 @@ public class SAMAnalyticalUpdateName : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -73,12 +76,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } - if(sAMObject is Space) + if (sAMObject is Space) { Space space = (Space)sAMObject; sAMObject = new Space(space, name, space.Location); } - if(sAMObject is InternalCondition) + if (sAMObject is InternalCondition) { InternalCondition internalCondition = (InternalCondition)sAMObject; sAMObject = new InternalCondition(name, internalCondition); @@ -87,4 +90,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, sAMObject); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateNormals.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateNormals.cs index ed4eb4ccd..513807d04 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateNormals.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateNormals.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalUpdateNormals : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -64,7 +67,7 @@ protected override void RegisterOutputParams(GH_OutputParamManager outputParamMa protected override void SolveInstance(IGH_DataAccess dataAccess) { AdjacencyCluster adjacencyCluster = null; - if(!dataAccess.GetData(0, ref adjacencyCluster) || adjacencyCluster == null) + if (!dataAccess.GetData(0, ref adjacencyCluster) || adjacencyCluster == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -81,7 +84,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } AdjacencyCluster adjacencyCluster_New = null; - if(space == null) + if (space == null) { adjacencyCluster_New = adjacencyCluster.UpdateNormals(includeApertures); } @@ -96,4 +99,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooAdjacencyCluster(adjacencyCluster_New)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateObjects.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateObjects.cs index 68bfe2c9e..500835473 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateObjects.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateObjects.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalUpdateObjects : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -78,9 +81,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) AdjacencyCluster adjacencyCluster_Result = adjacencyCluster.Clone(); List successfuls = new List(); - foreach(IAnalyticalObject analyticalObject in analyticalObjects) + foreach (IAnalyticalObject analyticalObject in analyticalObjects) { - if(!adjacencyCluster.Contains(analyticalObject)) + if (!adjacencyCluster.Contains(analyticalObject)) { successfuls.Add(false); continue; @@ -93,4 +96,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(1, successfuls); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateOccupancyGains.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateOccupancyGains.cs index e518736ab..a36b4ca13 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateOccupancyGains.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateOccupancyGains.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalUpdateOccupancyGains : GH_SAMVariableOutputParameterCo /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -31,10 +34,10 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "SAM Analytical AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "_spaces_", NickName = "_spaces_", Description = "SAM Analytical Spaces , if nothing connected all spaces from AnalyticalModel will be used", Access = GH_ParamAccess.list, Optional = true}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "_spaces_", NickName = "_spaces_", Description = "SAM Analytical Spaces , if nothing connected all spaces from AnalyticalModel will be used", Access = GH_ParamAccess.list, Optional = true }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooProfileParam() { Name = "profile_", NickName = "profile_", Description = "SAM Analytical Profile", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooDegreeOfActivityParam() { Name = "degreeOfActivity_", NickName = "degreeOfActivity_", Description = "SAM Analytical DegreeOfActivity \nuse GetDefaultLibrary component with DegreeOfActivityLibrary ", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); - result.Add( new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "occupancySensibleGainPerPerson_", NickName = "occupancySensibleGainPerPerson_", Description = "Occupancy Sensible Gain Per Person, W \n If you want to input custom value", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "occupancySensibleGainPerPerson_", NickName = "occupancySensibleGainPerPerson_", Description = "Occupancy Sensible Gain Per Person, W \n If you want to input custom value", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "occupancyLatentGainPerPerson_", NickName = "occupancyLatentGainPerPerson_", Description = "Occupancy Latent Gain Per Person, W \n If you want to input custom value", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "areaPerPerson_", NickName = "areaPerPerson_", Description = "Area Per Person, m2/person", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "occupancy_", NickName = "occupancy_", Description = "Occupancy, No of people \nwill override areaPerPerson_ ", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); @@ -47,7 +50,7 @@ protected override GH_SAMParam[] Outputs get { List result = new List(); - result.Add(new GH_SAMParam(new GooAnalyticalModelParam() {Name = "AnalyticalModel", NickName = "AnalyticalModel", Description = "SAM Analytical AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "AnalyticalModel", NickName = "AnalyticalModel", Description = "SAM Analytical AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooInternalConditionParam() { Name = "InternalConditions", NickName = "InternalConditions", Description = "SAM Analytical InternalConditions", Access = GH_ParamAccess.list }, ParamVisibility.Voluntary)); return result.ToArray(); } @@ -68,7 +71,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_analyticalModel"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -85,7 +88,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List spaces = null; index = Params.IndexOfInputParam("_spaces_"); - if(index != -1) + if (index != -1) { spaces = new List(); dataAccess.GetDataList(index, spaces); @@ -133,7 +136,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List internalConditions = new List(); - foreach(Space space in spaces) + foreach (Space space in spaces) { if (space == null) continue; @@ -145,7 +148,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) space_Temp = new Space(space_Temp); InternalCondition internalCondition = space_Temp.InternalCondition; - if(internalCondition == null) + if (internalCondition == null) internalCondition = new InternalCondition(space_Temp.Name); if (profile != null) @@ -153,7 +156,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (double.IsNaN(occupancySensibleGainPerPerson)) { - if(degreeOfActivity != null) + if (degreeOfActivity != null) internalCondition.SetValue(InternalConditionParameter.OccupancySensibleGainPerPerson, degreeOfActivity.Sensible); } else @@ -195,7 +198,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("AnalyticalModel"); - if(index != -1) + if (index != -1) { analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster, analyticalModel.MaterialLibrary, profileLibrary); dataAccess.SetData(index, new GooAnalyticalModel(analyticalModel)); @@ -206,4 +209,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, internalConditions?.ConvertAll(x => new GooInternalCondition(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdatePanelTypes.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdatePanelTypes.cs index 589f6f5f8..3d68cfb00 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdatePanelTypes.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdatePanelTypes.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -22,7 +25,7 @@ public class SAMAnalyticalUpdatePanelTypes : GH_SAMVariableOutputParameterCompon /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -43,7 +46,7 @@ protected override GH_SAMParam[] Outputs get { GH_SAMParam[] result = new GH_SAMParam[2]; - result[0] = new GH_SAMParam(new GooAnalyticalObjectParam() {Name = "analytical", NickName = "analytical", Description = "SAM Analytical Object", Access = GH_ParamAccess.item }, ParamVisibility.Binding); + result[0] = new GH_SAMParam(new GooAnalyticalObjectParam() { Name = "analytical", NickName = "analytical", Description = "SAM Analytical Object", Access = GH_ParamAccess.item }, ParamVisibility.Binding); result[1] = new GH_SAMParam(new GooPanelParam() { Name = "panels", NickName = "panels", Description = "modified SAM Analytical Panels", Access = GH_ParamAccess.list }, ParamVisibility.Voluntary); return result; } @@ -73,7 +76,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List panels = new List(); index = Params.IndexOfInputParam("_panels_"); - if(index != -1) + if (index != -1) { dataAccess.GetDataList(index, panels); } @@ -85,7 +88,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) groundElevation = 0; } - if(analyticalObject is AdjacencyCluster) + if (analyticalObject is AdjacencyCluster) { AdjacencyCluster adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)analyticalObject); @@ -93,7 +96,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) analyticalObject = adjacencyCluster; } - else if(analyticalObject is AnalyticalModel) + else if (analyticalObject is AnalyticalModel) { AdjacencyCluster adjacencyCluster = ((AnalyticalModel)analyticalObject).AdjacencyCluster; @@ -117,4 +120,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdatePanelTypes_Obsolete.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdatePanelTypes_Obsolete.cs index aeacf8558..53b69807d 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdatePanelTypes_Obsolete.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdatePanelTypes_Obsolete.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using Grasshopper.Kernel.Parameters; @@ -28,7 +31,7 @@ public class SAMAnalyticalUpdatePanelType : GH_SAMVariableOutputParameterCompone /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.tertiary | GH_Exposure.hidden; @@ -138,7 +141,7 @@ public class SAMAnalyticalUpdatePanelType : GH_Component /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.tertiary | GH_Exposure.hidden; @@ -220,4 +223,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdatePollutantGains.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdatePollutantGains.cs index 8afb8ca0c..5616c9af6 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdatePollutantGains.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdatePollutantGains.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalUpdatePollutantGains : GH_SAMVariableOutputParameterCo /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -196,4 +199,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, internalConditions?.ConvertAll(x => new GooInternalCondition(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateSetPoint.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateSetPoint.cs index 2af55ad7a..0807cf1bc 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateSetPoint.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateSetPoint.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalUpdateSetPoint : GH_SAMVariableOutputParameterComponen /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -31,9 +34,9 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "SAM Analytical AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "_spaces_", NickName = "_spaces_", Description = "SAM Analytical Spaces, if nothing connected all spaces from AnalyticalModel will be used", Access = GH_ParamAccess.list, Optional = true}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "_spaces_", NickName = "_spaces_", Description = "SAM Analytical Spaces, if nothing connected all spaces from AnalyticalModel will be used", Access = GH_ParamAccess.list, Optional = true }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooProfileParam() { Name = "profileHeating_", NickName = "profileHeating_", Description = "SAM Analytical Profile for Heating", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); - result.Add( new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "emitterHTGRadianProportion_", NickName = "emitterHTGRadianProportion_", Description = "Heating Emitter Radiant Proportion", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "emitterHTGRadianProportion_", NickName = "emitterHTGRadianProportion_", Description = "Heating Emitter Radiant Proportion", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "emitterHTGViewCoefficient_", NickName = "emitterHTGViewCoefficient_", Description = "Heating Emitter View Coefficient", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); result.Add(new GH_SAMParam(new GooProfileParam() { Name = "profileCooling_", NickName = "profileCooling_", Description = "SAM Analytical Profile for Cooling", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "emitterCLGRadianProportion_", NickName = "emitterCLGRadianProportion_", Description = "Cooling Emitter Radiant Proportion", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Voluntary)); @@ -49,7 +52,7 @@ protected override GH_SAMParam[] Outputs get { List result = new List(); - result.Add(new GH_SAMParam(new GooAnalyticalModelParam() {Name = "AnalyticalModel", NickName = "AnalyticalModel", Description = "SAM Analytical AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "AnalyticalModel", NickName = "AnalyticalModel", Description = "SAM Analytical AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooInternalConditionParam() { Name = "InternalConditions", NickName = "InternalConditions", Description = "SAM Analytical InternalConditions", Access = GH_ParamAccess.list }, ParamVisibility.Voluntary)); return result.ToArray(); } @@ -70,7 +73,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_analyticalModel"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -87,7 +90,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List spaces = null; index = Params.IndexOfInputParam("_spaces_"); - if(index != -1) + if (index != -1) { spaces = new List(); dataAccess.GetDataList(index, spaces); @@ -154,7 +157,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List internalConditions = new List(); - foreach(Space space in spaces) + foreach (Space space in spaces) { if (space == null) continue; @@ -166,13 +169,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) space_Temp = new Space(space_Temp); InternalCondition internalCondition = space_Temp.InternalCondition; - if(internalCondition == null) + if (internalCondition == null) internalCondition = new InternalCondition(space_Temp.Name); if (profile_Heating != null) internalCondition.SetValue(InternalConditionParameter.HeatingProfileName, profile_Heating.Name); - if(!double.IsNaN(heatingEmitterRadiantProportion)) + if (!double.IsNaN(heatingEmitterRadiantProportion)) internalCondition.SetValue(InternalConditionParameter.HeatingEmitterRadiantProportion, heatingEmitterRadiantProportion); if (!double.IsNaN(heatingEmitterCoefficient)) @@ -198,7 +201,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("AnalyticalModel"); - if(index != -1) + if (index != -1) { analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster, analyticalModel.MaterialLibrary, profileLibrary); dataAccess.SetData(index, new GooAnalyticalModel(analyticalModel)); @@ -209,4 +212,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, internalConditions?.ConvertAll(x => new GooInternalCondition(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateSpace.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateSpace.cs index d42b98a8b..8392156ba 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateSpace.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateSpace.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalUpdateSpace : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -68,17 +71,17 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) SAMObject sAMObject = null; - if(!dataAccess.GetData(0, ref sAMObject) || sAMObject == null) + if (!dataAccess.GetData(0, ref sAMObject) || sAMObject == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } AdjacencyCluster adjacencyCluster = sAMObject as AdjacencyCluster; - if(adjacencyCluster == null && sAMObject is AnalyticalModel) + if (adjacencyCluster == null && sAMObject is AnalyticalModel) adjacencyCluster = ((AnalyticalModel)sAMObject).AdjacencyCluster; - if(adjacencyCluster == null) + if (adjacencyCluster == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -88,7 +91,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) foreach (Space space in spaces) adjacencyCluster.UpdateSpace(space); - if(sAMObject is AnalyticalModel) + if (sAMObject is AnalyticalModel) { AnalyticalModel analyticalModel = ((AnalyticalModel)sAMObject); analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster); @@ -100,4 +103,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateSpaceByLocationAndName.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateSpaceByLocationAndName.cs index c89daa6d6..95191c1cb 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateSpaceByLocationAndName.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateSpaceByLocationAndName.cs @@ -1,4 +1,7 @@ -using GH_IO.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using GH_IO.Types; using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Analytical.Grasshopper.Properties; @@ -24,7 +27,7 @@ public class SAMAnalyticalUpdateSpaceByLocationAndName : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -101,4 +104,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooSpace(space_Result)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateSpaceLoactionPoint.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateSpaceLoactionPoint.cs index 55bf66bb8..4280ff1ae 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateSpaceLoactionPoint.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateSpaceLoactionPoint.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using NetTopologySuite.Geometries; using SAM.Analytical.Classes; using SAM.Analytical.Grasshopper.Properties; @@ -26,7 +29,7 @@ public class SAMAnalyticalUpdateSpaceLoactionPoint : GH_SAMVariableOutputParamet /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -66,9 +69,9 @@ protected override GH_SAMParam[] Outputs get { List result = []; - result.Add(new GH_SAMParam(new GooAnalyticalObjectParam() {Name = "AnalyticalObject", NickName = "AnalyticalObject", Description = "SAM Analytical Object", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "Spaces", NickName = "Spaces", Description = "SAM Analytical Spaces", Access = GH_ParamAccess.list}, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "Heights", NickName = "Heights", Description = "SAM Heights", Access = GH_ParamAccess.list}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooAnalyticalObjectParam() { Name = "AnalyticalObject", NickName = "AnalyticalObject", Description = "SAM Analytical Object", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "Spaces", NickName = "Spaces", Description = "SAM Analytical Spaces", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "Heights", NickName = "Heights", Description = "SAM Heights", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); return [.. result]; } } @@ -89,23 +92,23 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_analyticalObject"); IAnalyticalObject? analyticalObject = null; - if(index == -1 || !dataAccess.GetData(index, ref analyticalObject)) + if (index == -1 || !dataAccess.GetData(index, ref analyticalObject)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } AdjacencyCluster adjacencyCluster = null; - if(analyticalObject is AdjacencyCluster adjacencyCluster_Temp) + if (analyticalObject is AdjacencyCluster adjacencyCluster_Temp) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster_Temp, true); } - else if(analyticalObject is AnalyticalModel analyticalModel) + else if (analyticalObject is AnalyticalModel analyticalModel) { adjacencyCluster = new AdjacencyCluster(analyticalModel.AdjacencyCluster, true); } - if(adjacencyCluster is null) + if (adjacencyCluster is null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -154,11 +157,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List heights = []; List spaces_Result = []; - if(spaces != null && spaces.Count != 0) + if (spaces != null && spaces.Count != 0) { foreach (Space space in spaces) { - if(adjacencyCluster.GetObject(space.Guid) is not Space space_Temp) + if (adjacencyCluster.GetObject(space.Guid) is not Space space_Temp) { continue; } @@ -182,7 +185,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(segment2Ds is null || segment2Ds.Count == 0) + if (segment2Ds is null || segment2Ds.Count == 0) { continue; } @@ -202,14 +205,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) continue; } - foreach(Face2D face2D in face2Ds) + foreach (Face2D face2D in face2Ds) { (Coordinate center, double width, double height) coordinate = PolygonLabelCoordinate.LargestAxisAlignedRectangle(face2D.ToNTS(), aspect, clerance); Point2D point2D = coordinate.center.ToSAM(); - if(plane.Convert(point2D) is not Point3D point3D) + if (plane.Convert(point2D) is not Point3D point3D) { continue; } @@ -217,7 +220,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) Point3D location = new Point3D(point3D.X, point3D.Y, space.Location.Z); space_Temp = new Space(space_Temp, space_Temp.Name, location); adjacencyCluster.AddObject(space_Temp); - + spaces_Result.Add(space_Temp); heights.Add(coordinate.height * heightFactor); @@ -237,7 +240,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("AnalyticalObject"); - if(index != -1) + if (index != -1) { dataAccess.SetData(index, new GooAnalyticalObject(analyticalObject)); } @@ -255,4 +258,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateSpaceNames.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateSpaceNames.cs index 823a2c159..c4a7e691e 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateSpaceNames.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateSpaceNames.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalUpdateSpaceNames : GH_SAMVariableOutputParameterCompon /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -74,24 +77,24 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_analytical"); IAnalyticalObject analyticalObject = null; - if(index == -1 || !dataAccess.GetData(index, ref analyticalObject) || analyticalObject == null) + if (index == -1 || !dataAccess.GetData(index, ref analyticalObject) || analyticalObject == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } - if(analyticalObject is AnalyticalModel) + if (analyticalObject is AnalyticalModel) { AnalyticalModel analyticalModel = new AnalyticalModel((AnalyticalModel)analyticalObject); AdjacencyCluster adjacencyCluster = analyticalModel.AdjacencyCluster; - if(adjacencyCluster != null) + if (adjacencyCluster != null) { adjacencyCluster.UpdateSpaceNames(); - + analyticalObject = new AnalyticalModel(analyticalModel, adjacencyCluster); } } - else if(analyticalObject is AdjacencyCluster) + else if (analyticalObject is AdjacencyCluster) { AdjacencyCluster adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)analyticalObject); adjacencyCluster.UpdateSpaceNames(); @@ -103,4 +106,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, analyticalObject); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateTypesByMap.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateTypesByMap.cs index 1885b8d53..eae3b33f1 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateTypesByMap.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateTypesByMap.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalUpdateTypesByMap : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -142,7 +145,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { panels.Add((Panel)sAMObject); } - else if(sAMObject is Aperture) + else if (sAMObject is Aperture) { apertures.Add((Aperture)sAMObject); } @@ -151,8 +154,8 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) AdjacencyCluster adjacencyCluster = (AdjacencyCluster)sAMObject; ConstructionLibrary constructionLibrary_Temp = null; ApertureConstructionLibrary apertureConstructionLibrary_Temp = null; - List panels_Temp = adjacencyCluster.GetPanels(); - if(panels_Temp != null) + List panels_Temp = adjacencyCluster.GetPanels(); + if (panels_Temp != null) { adjacencyCluster = (AdjacencyCluster)adjacencyCluster.Clone(); constructionLibrary_Temp = Analytical.Modify.UpdateConstructionsByName(panels_Temp, constructionLibrary, delimitedFileTable, sourceColumnName, templateColumnName, destinationColumnName); @@ -184,17 +187,17 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) constructionLibraries.Add(constructionLibrary_Temp); apertureConstructionLibraries.Add(apertureConstructionLibrary_Temp); } - else if(sAMObject is Construction) + else if (sAMObject is Construction) { constructions.Add((Construction)sAMObject); } - else if(sAMObject is ApertureConstruction) + else if (sAMObject is ApertureConstruction) { apertureConstructions.Add((ApertureConstruction)sAMObject); } } - if(panels != null && panels.Count != 0) + if (panels != null && panels.Count != 0) { ConstructionLibrary constructionLibrary_Temp = Analytical.Modify.UpdateConstructionsByName(panels, constructionLibrary, delimitedFileTable, sourceColumnName, templateColumnName, destinationColumnName); ApertureConstructionLibrary apertureConstructionLibrary_Temp = Analytical.Modify.UpdateApertureConstructionsByName(panels, apertureConstructionLibrary, delimitedFileTable, sourceColumnName, templateColumnName, destinationColumnName); @@ -229,4 +232,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(2, apertureConstructionLibraries.ConvertAll(x => new GooApertureConstructionLibrary(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateTypesByName.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateTypesByName.cs index 3026fdcd1..0c9e3bd5e 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateTypesByName.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateTypesByName.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalUpdateTypesByName : GH_SAMComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Initializes a new instance of the SAM_point3D class. @@ -42,7 +45,7 @@ protected override void RegisterInputParams(GH_InputParamManager inputParamManag int index = -1; inputParamManager.AddParameter(new GooJSAMObjectParam(), "_analytical", "_analytical", "SAM Analytical Model ot Adjacency Cluster", GH_ParamAccess.list); - + index = inputParamManager.AddParameter(new GooConstructionLibraryParam(), "constructionLibrary_", "constructionLibrary_", "SAM Analytical ConstructionLibrary", GH_ParamAccess.item); inputParamManager[index].Optional = true; @@ -106,8 +109,8 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) AdjacencyCluster adjacencyCluster = (AdjacencyCluster)sAMObject; ConstructionLibrary constructionLibrary_Temp = null; ApertureConstructionLibrary apertureConstructionLibrary_Temp = null; - List panels_Temp = adjacencyCluster.GetPanels(); - if(panels_Temp != null) + List panels_Temp = adjacencyCluster.GetPanels(); + if (panels_Temp != null) { adjacencyCluster = (AdjacencyCluster)adjacencyCluster.Clone(); constructionLibrary_Temp = Analytical.Modify.UpdateConstructionsByName(panels_Temp, constructionLibrary); @@ -148,7 +151,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(panels != null && panels.Count != 0) + if (panels != null && panels.Count != 0) { ConstructionLibrary constructionLibrary_Temp = Analytical.Modify.UpdateConstructionsByName(panels, constructionLibrary); ApertureConstructionLibrary apertureConstructionLibrary_Temp = Analytical.Modify.UpdateApertureConstructionsByName(panels, apertureConstructionLibrary); @@ -168,4 +171,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(2, apertureConstructionLibraries.ConvertAll(x => new GooApertureConstructionLibrary(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateVentilationProfile.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateVentilationProfile.cs index 1ed0d5abc..af9621af8 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateVentilationProfile.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateVentilationProfile.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -21,7 +24,7 @@ public class SAMAnalyticalUpdateVentilationProfile : GH_SAMVariableOutputParamet /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -32,10 +35,10 @@ protected override GH_SAMParam[] Inputs List result = new List(); result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "_analyticalModel", NickName = "_analyticalModel", Description = "SAM Analytical AnalyticalModel", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - GooSpaceParam gooSpaceParam = new GooSpaceParam() { Name = "_spaces_", NickName = "_spaces_", Description = "SAM Analytical Spaces. If not provided all Spaces from Analytical Model will be used and modified", Access = GH_ParamAccess.list, Optional = true}; + GooSpaceParam gooSpaceParam = new GooSpaceParam() { Name = "_spaces_", NickName = "_spaces_", Description = "SAM Analytical Spaces. If not provided all Spaces from Analytical Model will be used and modified", Access = GH_ParamAccess.list, Optional = true }; result.Add(new GH_SAMParam(gooSpaceParam, ParamVisibility.Binding)); - GooProfileParam gooProfileParam = new GooProfileParam() { Name = "profile_", NickName = "profile_", Description = "SAM Analytical Profile for ventilation.", Access = GH_ParamAccess.item, Optional = true}; + GooProfileParam gooProfileParam = new GooProfileParam() { Name = "profile_", NickName = "profile_", Description = "SAM Analytical Profile for ventilation.", Access = GH_ParamAccess.item, Optional = true }; result.Add(new GH_SAMParam(gooProfileParam, ParamVisibility.Binding)); global::Grasshopper.Kernel.Parameters.Param_Number number = null; @@ -46,7 +49,7 @@ protected override GH_SAMParam[] Inputs number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "exhaustAirFlow_", NickName = "exhaustAirFlow_", Description = "Exhaust Air Flow [l/s]", Access = GH_ParamAccess.item, Optional = true }; result.Add(new GH_SAMParam(number, ParamVisibility.Binding)); - number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "supplyAirFlowPerPerson_", NickName = "supplyAirFlowPerPerson_", Description = "Supply Air Flow Per Person [l/s/p]", Access = GH_ParamAccess.item, Optional = true}; + number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "supplyAirFlowPerPerson_", NickName = "supplyAirFlowPerPerson_", Description = "Supply Air Flow Per Person [l/s/p]", Access = GH_ParamAccess.item, Optional = true }; result.Add(new GH_SAMParam(number, ParamVisibility.Voluntary)); number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "exhaustAirFlowPerPerson_", NickName = "exhaustAirFlowPerPerson_", Description = "Exhaust Air Flow Per Person [l/s/p]", Access = GH_ParamAccess.item, Optional = true }; @@ -75,7 +78,7 @@ protected override GH_SAMParam[] Outputs get { List result = new List(); - result.Add(new GH_SAMParam(new GooAnalyticalModelParam() {Name = "analyticalModel", NickName = "AnalyticalModel", Description = "SAM Analytical Model with ", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooAnalyticalModelParam() { Name = "analyticalModel", NickName = "AnalyticalModel", Description = "SAM Analytical Model with ", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooSpaceParam() { Name = "spaces", NickName = "spaces", Description = "SAM Analytical Spaces", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new GooInternalConditionParam() { Name = "internalConditions", NickName = "internalConditions", Description = "SAM Analytical InternalConditions", Access = GH_ParamAccess.list }, ParamVisibility.Voluntary)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "calculatedSupplyAirFlow", NickName = "calculatedSupplyAirFlow", Description = "CalculatedSupplyAirFlow [l/s]", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); @@ -105,7 +108,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_analyticalModel"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -121,14 +124,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) analyticalModel = new AnalyticalModel(analyticalModel); AdjacencyCluster adjacencyCluster = analyticalModel.AdjacencyCluster; - if(adjacencyCluster != null) + if (adjacencyCluster != null) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster); } List spaces = null; index = Params.IndexOfInputParam("_spaces_"); - if(index != -1) + if (index != -1) { spaces = new List(); dataAccess.GetDataList(index, spaces); @@ -144,7 +147,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (index != -1) dataAccess.GetData(index, ref profile); - if(profile != null && profile.ProfileGroup != ProfileGroup.Ventilation) + if (profile != null && profile.ProfileGroup != ProfileGroup.Ventilation) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid Profile"); return; @@ -203,7 +206,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } ProfileLibrary profileLibrary = analyticalModel.ProfileLibrary; - if(profile != null) + if (profile != null) { profileLibrary.Add(profile); } @@ -221,7 +224,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) foreach (Space space in spaces) { Space space_Temp = adjacencyCluster.GetObject(space.Guid); - if(space_Temp == null) + if (space_Temp == null) { continue; } @@ -229,12 +232,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) space_Temp = new Space(space_Temp); InternalCondition internalCondition_Temp = space_Temp.InternalCondition; - if(internalCondition_Temp == null) + if (internalCondition_Temp == null) { continue; } - if(profile == null) + if (profile == null) { internalCondition_Temp.RemoveValue(InternalConditionParameter.VentilationProfileName); } @@ -243,7 +246,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) internalCondition_Temp.SetProfileName(profile.ProfileType, profile.Name); } - if(double.IsNaN(supplyAirFlow)) + if (double.IsNaN(supplyAirFlow)) { internalCondition_Temp.RemoveValue(InternalConditionParameter.SupplyAirFlow); } @@ -336,12 +339,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) double calculatedSupplyAirFlow = space_Temp.CalculatedSupplyAirFlow(); double calculatedExhaustAirFlow = space_Temp.CalculatedExhaustAirFlow(); - + double calculatedSupplyAirFlowPerPerson = double.NaN; double calculatedExhaustAirFlowPerPerson = double.NaN; - + double occupancy = space_Temp.CalculatedOccupancy(); - if(!double.IsNaN(occupancy) && occupancy > 0) + if (!double.IsNaN(occupancy) && occupancy > 0) { calculatedSupplyAirFlowPerPerson = calculatedSupplyAirFlow / occupancy; calculatedExhaustAirFlowPerPerson = calculatedExhaustAirFlow / occupancy; @@ -378,7 +381,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfOutputParam("analyticalModel"); - if(index != -1) + if (index != -1) { analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster, analyticalModel.MaterialLibrary, profileLibrary); dataAccess.SetData(index, new GooAnalyticalModel(analyticalModel)); @@ -425,4 +428,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, calculatedExhaustAirChangesPerHours); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateZoneByName.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateZoneByName.cs index 5f8655e1f..ae0824921 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateZoneByName.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalUpdateZoneByName.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Analytical.Grasshopper.Properties; using SAM.Core; using SAM.Core.Grasshopper; @@ -22,7 +25,7 @@ public class SAMAnalyticalUpdateZoneByName : GH_SAMVariableOutputParameterCompon /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); public override GH_Exposure Exposure => GH_Exposure.primary; @@ -86,7 +89,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_analytical"); SAMObject sAMObject = null; - if(index == -1 || !dataAccess.GetData(index, ref sAMObject) || sAMObject == null) + if (index == -1 || !dataAccess.GetData(index, ref sAMObject) || sAMObject == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -115,7 +118,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) zoneCategory = null; } - if(!Enum.TryParse(zoneCategory, out ZoneType zoneType)) + if (!Enum.TryParse(zoneCategory, out ZoneType zoneType)) { zoneType = ZoneType.Undefined; } @@ -127,21 +130,21 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) zoneCategory = null; } - if(zoneType == ZoneType.Undefined && zoneCategory ==null) + if (zoneType == ZoneType.Undefined && zoneCategory == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } Zone zone = null; - if(sAMObject is AnalyticalModel) + if (sAMObject is AnalyticalModel) { AnalyticalModel analyticalModel = new AnalyticalModel((AnalyticalModel)sAMObject); AdjacencyCluster adjacencyCluster = analyticalModel.AdjacencyCluster; - if(adjacencyCluster != null) + if (adjacencyCluster != null) { adjacencyCluster = new AdjacencyCluster(adjacencyCluster); - if(zoneCategory != null) + if (zoneCategory != null) { zone = Analytical.Modify.UpdateZone(adjacencyCluster, name, zoneCategory, spaces.ToArray()); } @@ -149,11 +152,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { zone = Analytical.Modify.UpdateZone(adjacencyCluster, name, zoneType, spaces.ToArray()); } - + sAMObject = new AnalyticalModel(analyticalModel, adjacencyCluster); } } - else if(sAMObject is AdjacencyCluster) + else if (sAMObject is AdjacencyCluster) { AdjacencyCluster adjacencyCluster = new AdjacencyCluster((AdjacencyCluster)sAMObject); if (zoneCategory != null) @@ -176,4 +179,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, zone); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalZoneType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalZoneType.cs index 08b17b61d..9efe48347 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalZoneType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Component/SAMAnalyticalZoneType.cs @@ -1,4 +1,7 @@ -using SAM.Analytical.Grasshopper.Properties; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Analytical.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -19,7 +22,7 @@ public class SAMAnalyticalZoneType : GH_SAMEnumComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); + protected override System.Drawing.Bitmap Icon => Core.Convert.ToBitmap(Resources.SAM_Small); /// /// Zone Type Enum Component @@ -31,4 +34,4 @@ public SAMAnalyticalZoneType() { } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToGrasshopper/GH_Breps.cs b/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToGrasshopper/GH_Breps.cs index c651051cf..034595ba9 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToGrasshopper/GH_Breps.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToGrasshopper/GH_Breps.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; using System.Collections.Generic; namespace SAM.Analytical.Grasshopper @@ -15,4 +18,4 @@ public static List ToGrasshopper(this AdjacencyCluster adjacencyCluster return breps.ConvertAll(x => new GH_Brep(x)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToGrasshopper/GH_Mesh.cs b/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToGrasshopper/GH_Mesh.cs index c6c8eeb27..7cbf0c6f6 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToGrasshopper/GH_Mesh.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToGrasshopper/GH_Mesh.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; using Rhino.Geometry; namespace SAM.Analytical.Grasshopper @@ -19,7 +22,7 @@ public static GH_Mesh ToGrasshopper_Mesh(this Aperture aperture) public static GH_Mesh ToGrasshopper_Mesh(this IPanel panel, bool cutApertures = true, bool includeApertures = true, double tolerance = Core.Tolerance.Distance) { Mesh mesh = Rhino.Convert.ToRhino_Mesh(panel, cutApertures, includeApertures, tolerance); - if(mesh == null) + if (mesh == null) { return null; } @@ -49,4 +52,4 @@ public static GH_Mesh ToGrasshopper_Mesh(this AnalyticalModel analyticalModel, b return new GH_Mesh(mesh); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToGrasshopper/GH_Point.cs b/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToGrasshopper/GH_Point.cs index 604c518c2..3b6b329b5 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToGrasshopper/GH_Point.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToGrasshopper/GH_Point.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; namespace SAM.Analytical.Grasshopper { @@ -12,4 +15,4 @@ public static GH_Point ToGrasshopper(this Space space) return Geometry.Grasshopper.Convert.ToGrasshopper(space.Location); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToGrasshopper/GH_Surface.cs b/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToGrasshopper/GH_Surface.cs index fa3fd9713..82a85b5a4 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToGrasshopper/GH_Surface.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToGrasshopper/GH_Surface.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; namespace SAM.Analytical.Grasshopper { @@ -9,4 +12,4 @@ public static GH_Surface ToGrasshopper(this PlanarBoundary3D planarBoundary3D) return new GH_Surface(Rhino.Convert.ToRhino(planarBoundary3D)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToGrasshopper/GH_Surfaces.cs b/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToGrasshopper/GH_Surfaces.cs index 20724ed17..daf354492 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToGrasshopper/GH_Surfaces.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToGrasshopper/GH_Surfaces.cs @@ -1,7 +1,10 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; +using SAM.Geometry.Grasshopper; using SAM.Geometry.Spatial; using System.Collections.Generic; -using SAM.Geometry.Grasshopper; namespace SAM.Analytical.Grasshopper { @@ -9,14 +12,14 @@ public static partial class Convert { public static List ToGrasshopper(this Aperture aperture, bool includeFrame = false) { - if(aperture == null) + if (aperture == null) { return null; } List surfaces = new List(); - if(!includeFrame) + if (!includeFrame) { surfaces.Add(new GH_Surface(Geometry.Rhino.Convert.ToRhino_Brep(new Face3D(aperture.GetExternalEdge3D())))); } @@ -37,26 +40,26 @@ public static List ToGrasshopper(this Aperture aperture, bool includ public static List ToGrasshopper(this Panel panel, bool cutApertures = false, double tolerance = Core.Tolerance.MicroDistance) { List face3Ds = panel?.GetFace3Ds(cutApertures); - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return null; } List result = new List(); - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { GH_Surface surface = face3D?.ToGrasshopper(tolerance); - if(surface == null) + if (surface == null) { continue; } result.Add(surface); - + } return result; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToGrasshopper/New/GH_Mesh.cs b/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToGrasshopper/New/GH_Mesh.cs index 3f342afd8..b63680f7a 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToGrasshopper/New/GH_Mesh.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToGrasshopper/New/GH_Mesh.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; using Rhino.Geometry; namespace SAM.Analytical.Grasshopper @@ -18,7 +21,7 @@ public static GH_Mesh ToGrasshopper_Mesh(this IOpening opening) public static GH_Mesh ToGrasshopper_Mesh(this IPartition partition, bool cutOpenings = true, bool includeOpenings = true, double tolerance = Core.Tolerance.Distance) { - if(partition == null) + if (partition == null) { return null; } @@ -43,4 +46,4 @@ public static GH_Mesh ToGrasshopper_Mesh(this BuildingModel buildingModel, bool return new GH_Mesh(mesh); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToUI/Process.cs b/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToUI/Process.cs index 04f1cf5d0..c39449371 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToUI/Process.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Convert/ToUI/Process.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; using System.Diagnostics; @@ -8,7 +11,7 @@ public static partial class Convert { public static Process ToUI(this global::Grasshopper.Kernel.Data.IGH_Structure gH_Structure) { - if(gH_Structure == null) + if (gH_Structure == null) { return null; } @@ -46,4 +49,4 @@ public static Process ToUI(this global::Grasshopper.Kernel.Data.IGH_Structure gH return result; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Enums/PanelBakeMethod.cs b/Grasshopper/SAM.Analytical.Grasshopper/Enums/PanelBakeMethod.cs index e97e1b756..83315b317 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Enums/PanelBakeMethod.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Enums/PanelBakeMethod.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical.Grasshopper +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical.Grasshopper { public enum PanelBakeMethod { diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Kernel/AssemblyInfo.cs b/Grasshopper/SAM.Analytical.Grasshopper/Kernel/AssemblyInfo.cs index 5a83e0b78..38a9e8506 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Kernel/AssemblyInfo.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Kernel/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using System; using System.Drawing; @@ -67,4 +70,4 @@ public override string AuthorContact } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByApertureConstruction.cs b/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByApertureConstruction.cs index b128671e5..9ad7d066c 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByApertureConstruction.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByApertureConstruction.cs @@ -1,4 +1,7 @@ -using Rhino; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino; using System.Collections.Generic; namespace SAM.Analytical.Grasshopper @@ -16,7 +19,7 @@ public static void BakeGeometry_ByApertureConstruction(this RhinoDoc rhinoDoc, g if (variable is GooPanel) { List apertures_Temp = (((GooPanel)variable).Value as Panel)?.Apertures; - if(apertures_Temp != null) + if (apertures_Temp != null) { apertures.AddRange(apertures_Temp); } @@ -45,5 +48,5 @@ public static void BakeGeometry_ByApertureConstruction(this RhinoDoc rhinoDoc, g Rhino.Modify.BakeGeometry_ByApertureConstruction(rhinoDoc, apertures, includeFrame); } - } -} \ No newline at end of file + } +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByApertureType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByApertureType.cs index cc1bdefdf..0fea219e9 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByApertureType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByApertureType.cs @@ -1,4 +1,7 @@ -using Rhino; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino; using System.Collections.Generic; namespace SAM.Analytical.Grasshopper @@ -16,7 +19,7 @@ public static void BakeGeometry_ByApertureType(this RhinoDoc rhinoDoc, global::G if (variable is GooPanel) { List apertures_Temp = (((GooPanel)variable).Value as Panel).Apertures; - if(apertures_Temp != null) + if (apertures_Temp != null) { apertures.AddRange(apertures_Temp); } @@ -45,5 +48,5 @@ public static void BakeGeometry_ByApertureType(this RhinoDoc rhinoDoc, global::G Rhino.Modify.BakeGeometry_ByApertureType(rhinoDoc, apertures, includeFrame); } - } -} \ No newline at end of file + } +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByBoundaryType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByBoundaryType.cs index a3fa39df8..daed8dc99 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByBoundaryType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByBoundaryType.cs @@ -1,4 +1,7 @@ -using Rhino; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino; using System.Collections.Generic; namespace SAM.Analytical.Grasshopper @@ -27,10 +30,10 @@ public static void BakeGeometry_ByBoundaryType(this RhinoDoc rhinoDoc, global::G } } - foreach(AdjacencyCluster adjacencyCluster_Temp in adjacencyClusters) + foreach (AdjacencyCluster adjacencyCluster_Temp in adjacencyClusters) { Rhino.Modify.BakeGeometry_ByBoundaryType(rhinoDoc, adjacencyCluster_Temp, cutApertures, tolerance); } } - } -} \ No newline at end of file + } +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByConstruction.cs b/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByConstruction.cs index ce4d008ec..aada78823 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByConstruction.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByConstruction.cs @@ -1,4 +1,7 @@ -using Rhino; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino; using System.Collections.Generic; namespace SAM.Analytical.Grasshopper @@ -39,4 +42,4 @@ public static void BakeGeometry_ByConstruction(this RhinoDoc rhinoDoc, global::G } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByDischargeCoefficient.cs b/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByDischargeCoefficient.cs index 5362f931a..70cd3dfc8 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByDischargeCoefficient.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByDischargeCoefficient.cs @@ -1,4 +1,7 @@ -using Rhino; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino; using System.Collections.Generic; namespace SAM.Analytical.Grasshopper @@ -19,7 +22,7 @@ public static void BakeGeometry_ByDischargeCoefficient(this RhinoDoc rhinoDoc, g { apertures.Add(((GooAperture)variable).Value); } - else if(variable is GooPanel) + else if (variable is GooPanel) { panels.Add(((GooPanel)variable).Value as Panel); } @@ -38,15 +41,15 @@ public static void BakeGeometry_ByDischargeCoefficient(this RhinoDoc rhinoDoc, g } - foreach(Panel panel in panels) + foreach (Panel panel in panels) { - if(panel == null) + if (panel == null) { continue; } List apertures_Panel = panel?.Apertures; - if(apertures_Panel == null) + if (apertures_Panel == null) { continue; } @@ -57,5 +60,5 @@ public static void BakeGeometry_ByDischargeCoefficient(this RhinoDoc rhinoDoc, g Rhino.Modify.BakeGeometry_ByDischargeCoefficient(rhinoDoc, apertures); } - } -} \ No newline at end of file + } +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByInternalCondtion.cs b/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByInternalCondtion.cs index f21684d5d..6bcff5881 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByInternalCondtion.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByInternalCondtion.cs @@ -1,6 +1,8 @@ -using Rhino; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino; using System.Collections.Generic; -using System.Linq; namespace SAM.Analytical.Grasshopper { @@ -35,4 +37,4 @@ public static void BakeGeometry_ByInternalCondition(this RhinoDoc rhinoDoc, glob } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByLevel.cs b/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByLevel.cs index 096b92dcc..f73740aa8 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByLevel.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByLevel.cs @@ -1,6 +1,8 @@ -using Rhino; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino; using System.Collections.Generic; -using System.Linq; namespace SAM.Analytical.Grasshopper { @@ -33,4 +35,4 @@ public static void BakeGeometry_ByLevel(this RhinoDoc rhinoDoc, global::Grasshop Rhino.Modify.BakeGeometry_ByLevel(rhinoDoc, spaces); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByPanelType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByPanelType.cs index 097ea322f..ecf6d4575 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByPanelType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Modify/BakeGeometry_ByPanelType.cs @@ -1,4 +1,7 @@ -using Rhino; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino; using System.Collections.Generic; namespace SAM.Analytical.Grasshopper @@ -37,5 +40,5 @@ public static void BakeGeometry_ByPanelType(this RhinoDoc rhinoDoc, global::Gras Rhino.Modify.BakeGeometry_ByPanelType(rhinoDoc, panels, cutApertures, tolerance); } - } -} \ No newline at end of file + } +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Modify/New/BakeGeometry_ByAnalyticalType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Modify/New/BakeGeometry_ByAnalyticalType.cs index 001980be9..082d203d4 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Modify/New/BakeGeometry_ByAnalyticalType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Modify/New/BakeGeometry_ByAnalyticalType.cs @@ -1,4 +1,7 @@ -using Rhino; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino; using System; namespace SAM.Analytical.Grasshopper @@ -24,4 +27,4 @@ public static void BakeGeometry_ByAnalyticalType(this RhinoDoc rhinoDoc, global: } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Modify/New/BakeGeometry_ByCategory.cs b/Grasshopper/SAM.Analytical.Grasshopper/Modify/New/BakeGeometry_ByCategory.cs index 091a8bd1e..0eaed9186 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Modify/New/BakeGeometry_ByCategory.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Modify/New/BakeGeometry_ByCategory.cs @@ -1,4 +1,7 @@ -using Rhino; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino; using System; using System.Collections.Generic; @@ -36,4 +39,4 @@ public static void BakeGeometry_ByCategory(this RhinoDoc rhinoDoc, global::Grass Rhino.Modify.BakeGeometry_ByCategory(rhinoDoc, partitions, cutOpening, tolerance); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Modify/New/BakeGeometry_ByType.cs b/Grasshopper/SAM.Analytical.Grasshopper/Modify/New/BakeGeometry_ByType.cs index 2d8ec63d3..978c85057 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Modify/New/BakeGeometry_ByType.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Modify/New/BakeGeometry_ByType.cs @@ -1,4 +1,7 @@ -using Rhino; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino; using System; using System.Collections.Generic; @@ -36,4 +39,4 @@ public static void BakeGeometry_ByType(this RhinoDoc rhinoDoc, global::Grasshopp Rhino.Modify.BakeGeometry_ByType(rhinoDoc, partitions, cutOpenings, tolerance); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Modify/New/DrawViewportMeshes.cs b/Grasshopper/SAM.Analytical.Grasshopper/Modify/New/DrawViewportMeshes.cs index 1e4c594df..8f8bfbc00 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Modify/New/DrawViewportMeshes.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Modify/New/DrawViewportMeshes.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Rhino.Geometry; using System.Collections.Generic; using System.Threading.Tasks; @@ -29,7 +32,7 @@ public static void DrawViewportMeshes(this BuildingModel buildingModel, GH_Previ IHostPartition hostPartition = hostPartitions[i]; Geometry.Spatial.Face3D face3D = hostPartition?.Face3D; - if(face3D == null) + if (face3D == null) { return; } @@ -64,4 +67,4 @@ public static void DrawViewportMeshes(this BuildingModel buildingModel, GH_Previ } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Modify/New/DrawViewportWires.cs b/Grasshopper/SAM.Analytical.Grasshopper/Modify/New/DrawViewportWires.cs index c829136f0..992825395 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Modify/New/DrawViewportWires.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Modify/New/DrawViewportWires.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Rhino.Geometry; using System.Collections.Generic; @@ -8,7 +11,7 @@ public static partial class Modify { public static bool DrawViewportWires(this BuildingModel buildingModel, GH_PreviewWireArgs previewWireArgs) { - if(buildingModel == null || previewWireArgs == null) + if (buildingModel == null || previewWireArgs == null) { return false; } @@ -42,7 +45,7 @@ public static bool DrawViewportWires(this BuildingModel buildingModel, GH_Previe foreach (IPartition partition in partitions) { Geometry.Spatial.Face3D face3D = partition?.Face3D; - if(face3D == null) + if (face3D == null) { continue; } @@ -68,4 +71,4 @@ public static bool DrawViewportWires(this BuildingModel buildingModel, GH_Previe } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Properties/AssemblyInfo.cs b/Grasshopper/SAM.Analytical.Grasshopper/Properties/AssemblyInfo.cs index 015c66235..d9a285949 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Properties/AssemblyInfo.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -/* +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +/* * This file is part of the Sustaiable Analytical Model (SAM) * Copyright (c) 2020, the respective contributors. All rights reserved. * diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Properties/Resources.Designer.cs b/Grasshopper/SAM.Analytical.Grasshopper/Properties/Resources.Designer.cs index de219dfe2..56fbd90f7 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Properties/Resources.Designer.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Properties/Resources.Designer.cs @@ -1,4 +1,7 @@ -//------------------------------------------------------------------------------ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.42000 diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Query/AnalyticalUIPath.cs b/Grasshopper/SAM.Analytical.Grasshopper/Query/AnalyticalUIPath.cs index 2e27c3308..19c0b086f 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Query/AnalyticalUIPath.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Query/AnalyticalUIPath.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical.Grasshopper +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical.Grasshopper { public static partial class Query { @@ -7,7 +10,7 @@ public static string AnalyticalUIPath() string fileName = "SAM Analytical.exe"; string path = System.IO.Path.Combine(Core.Query.ExecutingAssemblyDirectory(), fileName); - if(!System.IO.Path.Exists(path)) + if (!System.IO.Path.Exists(path)) { string path_Temp = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Core.Query.ExecutingAssemblyDirectory()), fileName); if (System.IO.Path.Exists(path_Temp)) @@ -28,4 +31,4 @@ public static string AnalyticalUIPath() return path; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Query/DataTree.cs b/Grasshopper/SAM.Analytical.Grasshopper/Query/DataTree.cs index 3bd5743bd..3e9bffd56 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Query/DataTree.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Query/DataTree.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel.Data; using System.Collections.Generic; using System.Linq; @@ -9,7 +12,7 @@ public static partial class Query { public static DataTree DataTree(this IEnumerable bools) { - if(bools == null) + if (bools == null) { return null; } @@ -17,7 +20,7 @@ public static DataTree DataTree(this IEnumerable bools) int count = bools.Count(); DataTree result = new DataTree(); - if(count == 0) + if (count == 0) { return result; } @@ -42,7 +45,7 @@ public static DataTree DataTree(this IEnumerable bools) @bool = bool_New; } - if(bool_New) + if (bool_New) { result.Add(i, path); } @@ -52,4 +55,4 @@ public static DataTree DataTree(this IEnumerable bools) } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Query/DisplayMaterial.cs b/Grasshopper/SAM.Analytical.Grasshopper/Query/DisplayMaterial.cs index 218f28cb0..be196cb97 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Query/DisplayMaterial.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Query/DisplayMaterial.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical.Grasshopper +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical.Grasshopper { public static partial class Query { @@ -59,4 +62,4 @@ public static partial class Query return new global::Rhino.Display.DisplayMaterial(color); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Query/New/DisplayMaterial.cs b/Grasshopper/SAM.Analytical.Grasshopper/Query/New/DisplayMaterial.cs index 26664e4c2..378d855d9 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Query/New/DisplayMaterial.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Query/New/DisplayMaterial.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical.Grasshopper +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical.Grasshopper { public static partial class Query { @@ -37,4 +40,4 @@ public static partial class Query return new global::Rhino.Display.DisplayMaterial(color); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Query/Offset.cs b/Grasshopper/SAM.Analytical.Grasshopper/Query/Offset.cs index b245c70bf..58fc0b84e 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Query/Offset.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Query/Offset.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System; using System.Collections.Generic; using System.Linq; @@ -9,12 +12,12 @@ public static partial class Query { public static List Offset(this IEnumerable face3Ds, IEnumerable values, bool percentage) { - if(face3Ds == null) + if (face3Ds == null) { return null; } - if(face3Ds.Count() == 0 || values == null || values.Count() == 0) + if (face3Ds.Count() == 0 || values == null || values.Count() == 0) { return new List(face3Ds); } @@ -101,4 +104,4 @@ public static List Offset(this IEnumerable face3Ds, IEnumerable< return result; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Analytical.Grasshopper/Query/TryConvertToPanelGeometries.cs b/Grasshopper/SAM.Analytical.Grasshopper/Query/TryConvertToPanelGeometries.cs index 0f3db8d00..a6e139c87 100644 --- a/Grasshopper/SAM.Analytical.Grasshopper/Query/TryConvertToPanelGeometries.cs +++ b/Grasshopper/SAM.Analytical.Grasshopper/Query/TryConvertToPanelGeometries.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; using SAM.Geometry.Grasshopper; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -10,14 +13,14 @@ public static partial class Query public static bool TryConvertToPanelGeometries(this object @object, out List sAMGeometry3Ds, bool simplify = true) { sAMGeometry3Ds = null; - + if (@object is IGH_GeometricGoo) { sAMGeometry3Ds = ((IGH_GeometricGoo)@object).ToSAM(simplify); return true; } - if(@object is ISAMGeometry3D) + if (@object is ISAMGeometry3D) { sAMGeometry3Ds = new List() { (ISAMGeometry3D)@object }; return true; @@ -50,4 +53,4 @@ public static bool TryConvertToPanelGeometries(this object @object, out List + public class GooMaterialLayer : GH_Goo { public GooMaterialLayer() : base() @@ -73,17 +76,17 @@ public override string ToString() public override bool CastFrom(object source) { - if(source is IGH_Goo) + if (source is IGH_Goo) { object value = (source as dynamic).Value; MaterialLayer materialLayer = value as MaterialLayer; - if(materialLayer != null) + if (materialLayer != null) { Value = materialLayer; return true; } } - + return base.CastFrom(source); } @@ -106,7 +109,7 @@ public class GooMaterialLayerParam : GH_PersistentParam { public override Guid ComponentGuid => new Guid("cb6524ab-7111-454a-b6be-5e23007c794c"); - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; public GooMaterialLayerParam() : base(typeof(MaterialLayer).Name, typeof(MaterialLayer).Name, typeof(MaterialLayer).FullName.Replace(".", " "), "Params", "SAM") @@ -137,4 +140,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Architectural.Grasshopper/Component/SAMArchitecturalCreateLevel.cs b/Grasshopper/SAM.Architectural.Grasshopper/Component/SAMArchitecturalCreateLevel.cs index 6ef01b980..9f599e1b5 100644 --- a/Grasshopper/SAM.Architectural.Grasshopper/Component/SAMArchitecturalCreateLevel.cs +++ b/Grasshopper/SAM.Architectural.Grasshopper/Component/SAMArchitecturalCreateLevel.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Architectural.Grasshopper.Properties; using SAM.Core.Grasshopper; using System; @@ -74,4 +77,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooLevel(new Level(name, elevation))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Architectural.Grasshopper/Kernel/AssemblyInfo.cs b/Grasshopper/SAM.Architectural.Grasshopper/Kernel/AssemblyInfo.cs index ae6d58691..54b4d9eda 100644 --- a/Grasshopper/SAM.Architectural.Grasshopper/Kernel/AssemblyInfo.cs +++ b/Grasshopper/SAM.Architectural.Grasshopper/Kernel/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using System; using System.Drawing; @@ -67,4 +70,4 @@ public override string AuthorContact } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Architectural.Grasshopper/Properties/AssemblyInfo.cs b/Grasshopper/SAM.Architectural.Grasshopper/Properties/AssemblyInfo.cs index 9a590b66f..2695d962b 100644 --- a/Grasshopper/SAM.Architectural.Grasshopper/Properties/AssemblyInfo.cs +++ b/Grasshopper/SAM.Architectural.Grasshopper/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -/* +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +/* * This file is part of the Sustaiable Analytical Model (SAM) * Copyright (c) 2020, the respective contributors. All rights reserved. * diff --git a/Grasshopper/SAM.Architectural.Grasshopper/Properties/Resources.Designer.cs b/Grasshopper/SAM.Architectural.Grasshopper/Properties/Resources.Designer.cs index 88c3b899e..0c6ac4be2 100644 --- a/Grasshopper/SAM.Architectural.Grasshopper/Properties/Resources.Designer.cs +++ b/Grasshopper/SAM.Architectural.Grasshopper/Properties/Resources.Designer.cs @@ -1,4 +1,7 @@ -//------------------------------------------------------------------------------ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.42000 diff --git a/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMComponent.cs b/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMComponent.cs index 71e57aa7c..221919d3b 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMComponent.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMComponent.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using System.Windows.Forms; namespace SAM.Core.Grasshopper @@ -43,7 +46,7 @@ public string SAMVersion { get { - return GetValue("SAM_SAMVersion", null); + return GetValue("SAM_SAMVersion", null); } } diff --git a/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMComponentAttributes.cs b/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMComponentAttributes.cs index 134d8866d..4818cec5c 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMComponentAttributes.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMComponentAttributes.cs @@ -1,4 +1,7 @@ -//using Grasshopper.GUI; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +//using Grasshopper.GUI; using Grasshopper.GUI.Canvas; using Grasshopper.Kernel; using Grasshopper.Kernel.Attributes; diff --git a/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMComponentButtonAttributes.cs b/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMComponentButtonAttributes.cs index 1d1a2986b..c3ba99b92 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMComponentButtonAttributes.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMComponentButtonAttributes.cs @@ -1,4 +1,7 @@ -using Grasshopper.GUI; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.GUI; using Grasshopper.GUI.Canvas; using Grasshopper.Kernel; using System; @@ -9,7 +12,7 @@ namespace SAM.Core.Grasshopper { public class GH_SAMComponentButtonAttributes : GH_SAMComponentAttributes { - public GH_SAMComponentButtonAttributes(GH_Component component) + public GH_SAMComponentButtonAttributes(GH_Component component) : base(component) { } diff --git a/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMEnumComponent.cs b/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMEnumComponent.cs index b2e153253..93a0dbbce 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMEnumComponent.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMEnumComponent.cs @@ -1,8 +1,10 @@ -using System; -using System.Windows.Forms; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using GH_IO.Serialization; using Grasshopper.Kernel; -using SAM.Core.Grasshopper.Properties; +using System; +using System.Windows.Forms; namespace SAM.Core.Grasshopper { @@ -69,7 +71,7 @@ protected override void RegisterInputParams(GH_InputParamManager inputParamManag /// protected override void RegisterOutputParams(GH_OutputParamManager outputParamManager) { - outputParamManager.AddParameter(new GooObjectParam() { Name = typeof(T).Name, NickName = typeof(T).Name, Description = typeof(T).Name, Access = GH_ParamAccess.item}); + outputParamManager.AddParameter(new GooObjectParam() { Name = typeof(T).Name, NickName = typeof(T).Name, Description = typeof(T).Name, Access = GH_ParamAccess.item }); } /// diff --git a/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMNullAttributes.cs b/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMNullAttributes.cs index 70105dbe7..d73b25d60 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMNullAttributes.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMNullAttributes.cs @@ -1,4 +1,7 @@ -using GH_IO.Serialization; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using GH_IO.Serialization; using Grasshopper.GUI; using Grasshopper.GUI.Canvas; using Grasshopper.Kernel; @@ -11,8 +14,8 @@ namespace SAM.Core.Grasshopper { public class GH_SAMNullAttributes : IGH_Attributes { - public GH_SAMNullAttributes() - { + public GH_SAMNullAttributes() + { } public PointF Pivot { get => PointF.Empty; set => throw new NotImplementedException(); } diff --git a/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMParam.cs b/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMParam.cs index fa1950c0f..4d4ab4159 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMParam.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMParam.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; namespace SAM.Core.Grasshopper { diff --git a/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMVariableOutputParameterComponent.cs b/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMVariableOutputParameterComponent.cs index 9feccbd1b..26a4c75d2 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMVariableOutputParameterComponent.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Classes/GH_SAMVariableOutputParameterComponent.cs @@ -1,5 +1,7 @@ -using Grasshopper.Kernel; -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using System.Linq; namespace SAM.Core.Grasshopper diff --git a/Grasshopper/SAM.Core.Grasshopper/Classes/GooAddress.cs b/Grasshopper/SAM.Core.Grasshopper/Classes/GooAddress.cs index f499e9938..7f5771bd1 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Classes/GooAddress.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Classes/GooAddress.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -32,7 +35,7 @@ public class GooAddressParam : GH_PersistentParam public override GH_Exposure Exposure => GH_Exposure.hidden; - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; public GooAddressParam() : base(typeof(Address).Name, typeof(Address).Name, typeof(Address).FullName.Replace(".", " "), "Params", "SAM") @@ -62,4 +65,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Classes/GooDelimitedFileTable.cs b/Grasshopper/SAM.Core.Grasshopper/Classes/GooDelimitedFileTable.cs index b67ac18c1..78a4bd795 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Classes/GooDelimitedFileTable.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Classes/GooDelimitedFileTable.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -8,7 +11,7 @@ namespace SAM.Core.Grasshopper { - public class GooDelimitedFileTable: GH_Goo + public class GooDelimitedFileTable : GH_Goo { public GooDelimitedFileTable() : base() @@ -75,12 +78,12 @@ public override bool CastFrom(object source) public override bool CastTo(ref Q target) { - if(typeof(Q).IsAssignableFrom(Value?.GetType())) + if (typeof(Q).IsAssignableFrom(Value?.GetType())) { target = (Q)(object)Value; return true; } - + return base.CastTo(ref target); } } @@ -122,4 +125,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Classes/GooGroup.cs b/Grasshopper/SAM.Core.Grasshopper/Classes/GooGroup.cs index 2e881094f..46de7c5f6 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Classes/GooGroup.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Classes/GooGroup.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -32,7 +35,7 @@ public class GooGroupParam : GH_PersistentParam public override GH_Exposure Exposure => GH_Exposure.hidden; - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; public GooGroupParam() : base("Group", "Group", "SAM Core Group", "Params", "SAM") @@ -63,4 +66,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Classes/GooIndexedObjects.cs b/Grasshopper/SAM.Core.Grasshopper/Classes/GooIndexedObjects.cs index 4e7dc5090..302fa5284 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Classes/GooIndexedObjects.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Classes/GooIndexedObjects.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -63,4 +66,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Classes/GooJSAMObject.cs b/Grasshopper/SAM.Core.Grasshopper/Classes/GooJSAMObject.cs index cd259decd..7996f9aa5 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Classes/GooJSAMObject.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Classes/GooJSAMObject.cs @@ -1,4 +1,7 @@ -using GH_IO.Serialization; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using GH_IO.Serialization; using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using Newtonsoft.Json; @@ -60,7 +63,7 @@ public override bool Write(GH_IWriter writer) } JObject jObject = Value.ToJObject(); - if(jObject == null) + if (jObject == null) { return false; } @@ -107,10 +110,10 @@ public override string ToString() string value = Value.GetType().FullName; - if(Value is SAMObject) + if (Value is SAMObject) { SAMObject sAMObject = (SAMObject)(object)Value; - + if (!string.IsNullOrWhiteSpace(sAMObject.Name)) value += string.Format(" [{0}]", sAMObject.Name); } @@ -122,7 +125,7 @@ public override bool CastFrom(object source) { if (source == null) return false; - + if (source is T) { Value = (T)(object)source; @@ -130,7 +133,7 @@ public override bool CastFrom(object source) } Type type_Source = source?.GetType(); - if(type_Source != null) + if (type_Source != null) { if (typeof(IGooJSAMObject).IsAssignableFrom(type_Source)) { @@ -188,7 +191,7 @@ public override bool CastTo(ref Y target) try { - if(Value != null) + if (Value != null) { //target = (Y)Activator.CreateInstance(typeof(Y), Value); @@ -205,13 +208,13 @@ public override bool CastTo(ref Y target) { } - + return base.CastTo(ref target); } public virtual bool Equals(T t) { - if(t is SAMObject sAMObject_1) + if (t is SAMObject sAMObject_1) { if (Value is SAMObject sAMObject_2) { @@ -226,7 +229,7 @@ public override int GetHashCode() { if (Value is SAMObject sAMObject) { - return Core.Query.FullTypeName(sAMObject)?.GetHashCode() ^ sAMObject.Guid.GetHashCode()?? 0; + return Core.Query.FullTypeName(sAMObject)?.GetHashCode() ^ sAMObject.Guid.GetHashCode() ?? 0; } return base.GetHashCode(); @@ -280,4 +283,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Classes/GooLocation.cs b/Grasshopper/SAM.Core.Grasshopper/Classes/GooLocation.cs index fbd485395..ff99c1597 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Classes/GooLocation.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Classes/GooLocation.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -30,7 +33,7 @@ public class GooLocationParam : GH_PersistentParam { public override Guid ComponentGuid => new Guid("ce7b8666-f1e6-4931-9e86-1b4da97a5056"); - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; public GooLocationParam() : base(typeof(Location).Name, typeof(Location).Name, typeof(Location).FullName.Replace(".", " "), "Params", "SAM") @@ -61,4 +64,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Classes/GooLog.cs b/Grasshopper/SAM.Core.Grasshopper/Classes/GooLog.cs index 8cb907ca2..a428630e9 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Classes/GooLog.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Classes/GooLog.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -38,7 +41,7 @@ public class GooLogParam : GH_PersistentParam { public override Guid ComponentGuid => new Guid("02b69601-dc9d-4a3e-9950-aa6e19c1a033"); - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -71,4 +74,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Classes/GooMaterial.cs b/Grasshopper/SAM.Core.Grasshopper/Classes/GooMaterial.cs index f5cbaaad8..e802a7d94 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Classes/GooMaterial.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Classes/GooMaterial.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -8,7 +11,7 @@ namespace SAM.Core.Grasshopper { - public class GooMaterial: GH_Goo + public class GooMaterial : GH_Goo { public GooMaterial() : base() @@ -75,28 +78,28 @@ public override string ToString() public override bool CastFrom(object source) { - if(source is IMaterial material_Temp) + if (source is IMaterial material_Temp) { Value = material_Temp; return true; } - if(source is IGH_Goo goo) + if (source is IGH_Goo goo) { IMaterial material = (goo as dynamic).Value as IMaterial; - if(material != null) + if (material != null) { Value = material; return true; } } - + return base.CastFrom(source); } public override bool CastTo(ref Q target) { - if(Value is Q) + if (Value is Q) { target = (Q)Value; return true; @@ -116,7 +119,7 @@ public class GooMaterialParam : GH_PersistentParam { public override Guid ComponentGuid => new Guid("8810fd33-f1b7-402e-8c14-78e197a847a8"); - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; public GooMaterialParam() : base(typeof(Material).Name, typeof(Material).Name, typeof(Material).FullName.Replace(".", " "), "Params", "SAM") @@ -147,4 +150,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Classes/GooMaterialLibrary.cs b/Grasshopper/SAM.Core.Grasshopper/Classes/GooMaterialLibrary.cs index 7076a2fae..451d6908c 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Classes/GooMaterialLibrary.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Classes/GooMaterialLibrary.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -30,7 +33,7 @@ public class GooMaterialLibraryParam : GH_PersistentParam { public override Guid ComponentGuid => new Guid("986d8a7b-4a1f-4f5d-a507-d45c535518a7"); - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; public GooMaterialLibraryParam() : base(typeof(MaterialLibrary).Name, typeof(MaterialLibrary).Name, typeof(MaterialLibrary).FullName.Replace(".", " "), "Params", "SAM") @@ -61,4 +64,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Classes/GooObject.cs b/Grasshopper/SAM.Core.Grasshopper/Classes/GooObject.cs index 3cb8ddc04..4e57f12e6 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Classes/GooObject.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Classes/GooObject.cs @@ -1,4 +1,7 @@ -using GH_IO.Serialization; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using GH_IO.Serialization; using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using Newtonsoft.Json.Linq; @@ -10,7 +13,7 @@ namespace SAM.Core.Grasshopper public class GooObject : GH_Goo { public GooObject(object value) - :base(value) + : base(value) { Value = value; } @@ -111,7 +114,7 @@ public override bool CastTo(ref Y target) if (Value == null) return false; - if(Value is Y) + if (Value is Y) { target = (Y)Value; return true; @@ -128,8 +131,8 @@ public override bool CastTo(ref Y target) target = (Y)Value; return true; } - - if(typeof(Y).IsEnum && Value is string) + + if (typeof(Y).IsEnum && Value is string) { try { @@ -140,10 +143,10 @@ public override bool CastTo(ref Y target) { } - + } - if(typeof(Y) == typeof(GH_ObjectWrapper)) + if (typeof(Y) == typeof(GH_ObjectWrapper)) { target = (Y)(object)(new GH_ObjectWrapper(Value)); return true; @@ -151,12 +154,12 @@ public override bool CastTo(ref Y target) if (typeof(Y) == typeof(GH_Boolean)) { - if(Value is bool) + if (Value is bool) { target = (Y)(object)(new GH_Boolean((bool)Value)); return true; } - if(Value is int) + if (Value is int) { target = (Y)(object)(new GH_Boolean((int)Value == 1)); return true; @@ -165,7 +168,7 @@ public override bool CastTo(ref Y target) if (typeof(Y) == typeof(GH_Number)) { - if(Core.Query.IsNumeric(Value)) + if (Core.Query.IsNumeric(Value)) { target = (Y)(object)(new GH_Number(System.Convert.ToDouble(Value))); return true; @@ -180,7 +183,7 @@ public override bool CastTo(ref Y target) } - if(typeof(IGH_QuickCast).IsAssignableFrom(typeof(Y))) + if (typeof(IGH_QuickCast).IsAssignableFrom(typeof(Y))) { //target = (Y)(object)(new GH_String(Value?.ToString())); //return true; @@ -202,7 +205,7 @@ public override bool CastTo(ref Y target) if (Value != null) { object value_Temp = Value; - if(value_Temp.GetType().IsEnum) + if (value_Temp.GetType().IsEnum) { value_Temp = (int)value_Temp; } @@ -227,13 +230,13 @@ public override bool CastTo(ref Y target) } public class GooObjectParam : GH_Param - { + { public override Guid ComponentGuid => new Guid("a7a5eb79-1834-43db-9aa3-30ca105c3bbb"); public override GH_Exposure Exposure => GH_Exposure.hidden; - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; - + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + public GooObjectParam(string name) : base(name, name, name, "Params", "SAM", GH_ParamAccess.item) { @@ -259,7 +262,7 @@ public override sealed bool Read(GH_IReader reader) base.Read(reader); string name = null; - + if (!reader.TryGetString(typeof(GooObject).FullName, ref name)) return false; diff --git a/Grasshopper/SAM.Core.Grasshopper/Classes/GooRelationCluster.cs b/Grasshopper/SAM.Core.Grasshopper/Classes/GooRelationCluster.cs index 056c95174..042567138 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Classes/GooRelationCluster.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Classes/GooRelationCluster.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using Rhino.Geometry; using SAM.Core.Grasshopper.Properties; @@ -42,7 +45,7 @@ public class GooRelationClusterParam : GH_PersistentParam public override GH_Exposure Exposure => GH_Exposure.hidden; - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; //Here we control name, nickname, description, category, sub-category as deafult we use typeofclass name public GooRelationClusterParam() @@ -74,4 +77,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Classes/GooResult.cs b/Grasshopper/SAM.Core.Grasshopper/Classes/GooResult.cs index 4e973f3df..f129abc2a 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Classes/GooResult.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Classes/GooResult.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -38,7 +41,7 @@ public class GooResultParam : GH_PersistentParam { public override Guid ComponentGuid => new Guid("284b34bb-9057-4276-ad5a-591337dd2441"); - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; public GooResultParam() : base("Result", "Result", "SAM Core Result", "Params", "SAM") @@ -69,4 +72,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Classes/GooSAMObject.cs b/Grasshopper/SAM.Core.Grasshopper/Classes/GooSAMObject.cs index a8d8ff910..c243a78da 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Classes/GooSAMObject.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Classes/GooSAMObject.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -48,7 +51,7 @@ public class GooSAMObjectParam : GH_PersistentParam { public override Guid ComponentGuid => new Guid("c2fae9f4-b98a-4cff-be89-e58795cef92d"); - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; public GooSAMObjectParam() : base(typeof(SAMObject).Name, typeof(SAMObject).Name, typeof(SAMObject).FullName.Replace(".", " "), "Params", "SAM") @@ -79,4 +82,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Classes/GooSystem.cs b/Grasshopper/SAM.Core.Grasshopper/Classes/GooSystem.cs index e50a66b62..30db62d59 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Classes/GooSystem.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Classes/GooSystem.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -33,10 +36,10 @@ public override string ToString() } System.Reflection.PropertyInfo propertyInfo = Value.GetType().GetProperty("FullName"); - if(propertyInfo != null) + if (propertyInfo != null) { string fullName = propertyInfo.GetValue(Value) as string; - if(!string.IsNullOrWhiteSpace(fullName)) + if (!string.IsNullOrWhiteSpace(fullName)) { return string.Format("{0} [{1}]", Value.GetType().FullName, fullName); } @@ -50,7 +53,7 @@ public class GooSystemParam : GH_PersistentParam { public override Guid ComponentGuid => new Guid("dc71d798-1059-4a71-a892-891d62cb7fda"); - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; public GooSystemParam() : base("System", "System", "SAM Core System", "Params", "SAM") @@ -81,4 +84,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Classes/GooSystemType.cs b/Grasshopper/SAM.Core.Grasshopper/Classes/GooSystemType.cs index 2a1e2b7df..0bd0e0cf3 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Classes/GooSystemType.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Classes/GooSystemType.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -30,7 +33,7 @@ public class GooSystemTypeParam : GH_PersistentParam { public override Guid ComponentGuid => new Guid("427cbc29-819f-44cc-b4a9-b9b3bfefd81e"); - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -63,4 +66,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Classes/GooSystemTypeLibrary.cs b/Grasshopper/SAM.Core.Grasshopper/Classes/GooSystemTypeLibrary.cs index d966d37a6..3e748fcf3 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Classes/GooSystemTypeLibrary.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Classes/GooSystemTypeLibrary.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -30,7 +33,7 @@ public class GooSystemTypeLibraryParam : GH_PersistentParam new Guid("4835eafb-5626-4d53-8e45-d2cc43c01b6c"); - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -63,4 +66,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Classes/GooTableModifier.cs b/Grasshopper/SAM.Core.Grasshopper/Classes/GooTableModifier.cs index aeb03d0e7..a705f5982 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Classes/GooTableModifier.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Classes/GooTableModifier.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -32,7 +35,7 @@ public class GooTableModifierParam : GH_PersistentParam public override GH_Exposure Exposure => GH_Exposure.hidden; - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; public GooTableModifierParam() : base("TableModifier", "TableModifier", "SAM Core TableModifier", "Params", "SAM") @@ -63,4 +66,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Classes/GooTextMap.cs b/Grasshopper/SAM.Core.Grasshopper/Classes/GooTextMap.cs index 36e5e2d8e..e3d9edc9d 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Classes/GooTextMap.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Classes/GooTextMap.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -61,4 +64,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreARGBToUint.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreARGBToUint.cs index b1c3327cd..922accf92 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreARGBToUint.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreARGBToUint.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; @@ -97,4 +100,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, System.Convert.ToInt32(@uint)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreAbout.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreAbout.cs index cb13dbb4e..c428c8bcc 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreAbout.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreAbout.cs @@ -1,4 +1,7 @@ -using SAM.Core.Grasshopper.Properties; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core.Grasshopper.Properties; using System; namespace SAM.Core.Grasshopper @@ -30,4 +33,4 @@ public SAMCoreAbout() { } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreAddMaterials.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreAddMaterials.cs index 3f795140d..ba941aa39 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreAddMaterials.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreAddMaterials.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; using System.Collections.Generic; @@ -73,7 +76,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) materialLibrary = new MaterialLibrary(materialLibrary); List successfuls = new List(); - foreach(IMaterial material in materials) + foreach (IMaterial material in materials) { bool successful = materialLibrary.Add(material); successfuls.Add(successful); @@ -83,4 +86,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(1, successfuls); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreColorToUint.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreColorToUint.cs index 2c1173cb0..33a93a810 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreColorToUint.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreColorToUint.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; using System.Drawing; @@ -76,4 +79,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, System.Convert.ToInt32(@uint)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCombineType.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCombineType.cs index dae772124..43aea3cf3 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCombineType.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCombineType.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Core.Grasshopper; using SAM.Core.Grasshopper.Properties; using System; @@ -20,7 +23,7 @@ public class SAMCoreCombineType : GH_SAMEnumComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; /// /// Panel Type @@ -32,4 +35,4 @@ public SAMCoreCombineType() { } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCombineValues.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCombineValues.cs index 242b2572b..c7cf75d37 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCombineValues.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCombineValues.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; using System.Collections.Generic; @@ -36,7 +39,7 @@ public SAMCoreCombineResults() { } - + protected override GH_SAMParam[] Inputs { @@ -56,7 +59,7 @@ protected override GH_SAMParam[] Outputs get { List result = new List(); - result.Add(new GH_SAMParam(new GooIndexedObjectsParam() { Name = "results", NickName = "results", Description = "Results (IndexedDoubles) \nInspec to get values", Access = GH_ParamAccess.item }, ParamVisibility.Binding));; + result.Add(new GH_SAMParam(new GooIndexedObjectsParam() { Name = "results", NickName = "results", Description = "Results (IndexedDoubles) \nInspec to get values", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); ; return result.ToArray(); } } @@ -72,7 +75,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_results"); - + IIndexedObjects indexedObjects = null; if (index == -1 || !dataAccess.GetData(index, ref indexedObjects) || indexedObjects == null) { @@ -81,7 +84,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } IndexedDoubles indexedDoubles = indexedObjects as IndexedDoubles; - if(indexedDoubles == null) + if (indexedDoubles == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -99,7 +102,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } period = Core.Query.Enum(text); - if(period == Period.Undefined) + if (period == Period.Undefined) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -129,4 +132,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreConvert.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreConvert.cs index be91d9b1c..74e943eee 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreConvert.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreConvert.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; using System.Collections.Generic; @@ -38,14 +41,14 @@ public SAMCoreConvert() { } - + protected override GH_SAMParam[] Inputs { get { List result = new List(); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Geometry() { Name = "_geometry", NickName = "_geometry", Description = "Geometry", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Geometry() { Name = "_geometry", NickName = "_geometry", Description = "Geometry", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); return result.ToArray(); } @@ -96,4 +99,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, jSAMObject); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCopyMaterials.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCopyMaterials.cs index ef787de15..0ac4fb59c 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCopyMaterials.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCopyMaterials.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; using System.Collections.Generic; @@ -82,7 +85,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } bool overwrite = true; - if(!dataAccess.GetData(2, ref overwrite)) + if (!dataAccess.GetData(2, ref overwrite)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -97,7 +100,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (materials == null || materials.Count == 0) continue; - foreach(IMaterial material in materials) + foreach (IMaterial material in materials) { IMaterial material_Existing = materialLibrary.GetObject(material.Name); if (material_Existing != null) @@ -115,4 +118,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooMaterialLibrary(materialLibrary)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCountryCode.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCountryCode.cs index f40144dfa..9d36acf00 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCountryCode.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCountryCode.cs @@ -1,4 +1,7 @@ -using SAM.Core.Grasshopper.Properties; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core.Grasshopper.Properties; using System; namespace SAM.Core.Grasshopper @@ -30,4 +33,4 @@ public SAMCoreCoutryCode() { } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateAddress.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateAddress.cs index 51ecc9abe..c169c7a0f 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateAddress.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateAddress.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -98,4 +101,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooAddress(new Address(street, city, postalCode, countryCode))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateDelimitedFileTableBySAMObjects.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateDelimitedFileTableBySAMObjects.cs index 8cd97f8bf..ab3140053 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateDelimitedFileTableBySAMObjects.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateDelimitedFileTableBySAMObjects.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; using System.Collections.Generic; @@ -36,7 +39,7 @@ public SAMCoreCreateDelimitedFileTableBySAMObjects() { } - + protected override GH_SAMParam[] Inputs { @@ -44,7 +47,7 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_sAMObjects", NickName = "_sAMObjects", Description = "SAM Objects", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_String() { Name = "_parameters", NickName = "_parameters", Description = "Column Name or Index", Access = GH_ParamAccess.list}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_String() { Name = "_parameters", NickName = "_parameters", Description = "Column Name or Index", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); return result.ToArray(); } } @@ -92,4 +95,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, new GooDelimitedFileTable(result)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateGasMaterial_Obsolete.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateGasMaterial_Obsolete.cs index 4c7135f18..a7c3918f0 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateGasMaterial_Obsolete.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateGasMaterial_Obsolete.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; @@ -69,4 +72,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooMaterial(new GasMaterial(name))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateLocation.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateLocation.cs index e48ad399d..9f5d4e829 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateLocation.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateLocation.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; @@ -37,7 +40,7 @@ public SAMCoreCreateLocation() protected override void RegisterInputParams(GH_InputParamManager inputParamManager) { Location location = Core.Query.DefaultLocation(); - + inputParamManager.AddTextParameter("_name", "_name", "Name", GH_ParamAccess.item, location.Name); inputParamManager.AddNumberParameter("_elevation", "_elevation", "Elevation", GH_ParamAccess.item, location.Elevation); inputParamManager.AddNumberParameter("_latitude", "_latitude", "Latitude", GH_ParamAccess.item, location.Latitude); @@ -92,4 +95,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooLocation(new Location(name, longitude, latitude, elevation))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateMaterialLibrary.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateMaterialLibrary.cs index 49e55bf85..c6acebe9a 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateMaterialLibrary.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateMaterialLibrary.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; @@ -66,4 +69,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooMaterialLibrary(new MaterialLibrary(name))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateOpaqueMaterial_Obsolete.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateOpaqueMaterial_Obsolete.cs index 14abd8e97..a6e8b4ff1 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateOpaqueMaterial_Obsolete.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateOpaqueMaterial_Obsolete.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; @@ -69,4 +72,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooMaterial(new OpaqueMaterial(name))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateTextMap.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateTextMap.cs index e64138809..0cc0af7e2 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateTextMap.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateTextMap.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; using System.Collections.Generic; @@ -88,10 +91,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("TextMap"); - if(index != -1) + if (index != -1) { TextMap result = Core.Create.TextMap("Text Map"); - for(int i = 0; i < keys.Count; i++) + for (int i = 0; i < keys.Count; i++) { if (values.Count <= i) continue; @@ -102,10 +105,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, new GooTextMap(result)); } - + } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateTransparentMaterial_Obsolete.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateTransparentMaterial_Obsolete.cs index 612406352..f31c18884 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateTransparentMaterial_Obsolete.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCreateTransparentMaterial_Obsolete.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; @@ -69,4 +72,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooMaterial(new TransparentMaterial(name))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCsvToDelimitedFileTable.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCsvToDelimitedFileTable.cs index ddd2ddd22..a45f6fdb5 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCsvToDelimitedFileTable.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreCsvToDelimitedFileTable.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; using System.Collections.Generic; @@ -36,14 +39,14 @@ public SAMCoreCsvToDelimitedFileTable() { } - + protected override GH_SAMParam[] Inputs { get { List result = new List(); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_String() { Name = "_csv", NickName = "_csv", Description = "file path to csv text", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); return result.ToArray(); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_String() { Name = "_csv", NickName = "_csv", Description = "file path to csv text", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); return result.ToArray(); } } @@ -91,4 +94,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, new GooDelimitedFileTable(delimitedFileTable)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDateTimeToHourOfYear.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDateTimeToHourOfYear.cs index 943942195..8fdf2134a 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDateTimeToHourOfYear.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDateTimeToHourOfYear.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; using System.Collections.Generic; @@ -36,7 +39,7 @@ public SAMCoreDateTimeToHourOfYear() { } - + protected override GH_SAMParam[] Inputs { @@ -71,7 +74,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_dateTime"); - + DateTime dateTime = DateTime.MinValue; if (index == -1 || !dataAccess.GetData(index, ref dateTime) || dateTime == null) { @@ -92,4 +95,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDayOfYearToHourOfYear.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDayOfYearToHourOfYear.cs index 3888bf102..588964fc6 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDayOfYearToHourOfYear.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDayOfYearToHourOfYear.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; using System.Collections.Generic; @@ -36,7 +39,7 @@ public SAMCoreDayOfYearToHourOfYear() { } - + protected override GH_SAMParam[] Inputs { @@ -75,7 +78,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_dayOfYear"); - + int dayOfYear = -1; if (index == -1 || !dataAccess.GetData(index, ref dayOfYear)) { @@ -116,4 +119,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDelimitedFileTableGetValue.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDelimitedFileTableGetValue.cs index ac12448ff..a64435aae 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDelimitedFileTableGetValue.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDelimitedFileTableGetValue.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -37,7 +40,7 @@ public SAMCoreDelimitedFileTableGetValue() { } - + protected override GH_SAMParam[] Inputs { @@ -47,7 +50,7 @@ protected override GH_SAMParam[] Inputs result.Add(new GH_SAMParam(new GooDelimitedFileTableParam() { Name = "_delimitedFileTable", NickName = "_delimitedFileTable", Description = "SAM DelimitedFileTable", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_column", NickName = "_column", Description = "Column name or index", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Integer() { Name = "row_", NickName = "row_", Description = "Row index", Access = GH_ParamAccess.item, Optional = true }, ParamVisibility.Binding)); - + return result.ToArray(); } @@ -74,7 +77,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_delimitedFileTable"); - + DelimitedFileTable delimitedFileTable = null; if (index == -1 || !dataAccess.GetData(index, ref delimitedFileTable) || delimitedFileTable == null) { @@ -84,7 +87,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) object column = null; index = Params.IndexOfInputParam("_column"); - if(index == -1 || !dataAccess.GetData(index, ref column)) + if (index == -1 || !dataAccess.GetData(index, ref column)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -109,7 +112,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) else column = column.ToString(); } - + int row = -1; index = Params.IndexOfInputParam("row_"); @@ -117,11 +120,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) row = -1; object[] result = null; - if(row is -1) + if (row is -1) { if (column is int) result = delimitedFileTable.GetColumnValues((int)column); - else if(column is string) + else if (column is string) result = delimitedFileTable.GetColumnValues((string)column); } else @@ -137,4 +140,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, result); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDelimitedFileTableMap.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDelimitedFileTableMap.cs index 98891f0c1..ce14385ea 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDelimitedFileTableMap.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDelimitedFileTableMap.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -37,7 +40,7 @@ public SAMCoreDelimitedFileTableMap() { } - + protected override GH_SAMParam[] Inputs { @@ -46,7 +49,7 @@ protected override GH_SAMParam[] Inputs List result = new List(); result.Add(new GH_SAMParam(new GooDelimitedFileTableParam() { Name = "_delimitedFileTable", NickName = "_delimitedFileTable", Description = "SAM DelimitedFileTable", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_sAMObjects", NickName = "_sAMObjects", Description = "SAM Objects to be mapped", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_column", NickName = "_column", Description = "Column Name or Index", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_column", NickName = "_column", Description = "Column Name or Index", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_String() { Name = "_parameter", NickName = "_parameter", Description = "Parameter Name will be used to uniquely identify SAM objects", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); return result.ToArray(); @@ -76,7 +79,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_delimitedFileTable"); - + DelimitedFileTable delimitedFileTable = null; if (index == -1 || !dataAccess.GetData(index, ref delimitedFileTable) || delimitedFileTable == null) { @@ -86,7 +89,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) object column = null; index = Params.IndexOfInputParam("_column"); - if(index == -1 || !dataAccess.GetData(index, ref column)) + if (index == -1 || !dataAccess.GetData(index, ref column)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -103,15 +106,15 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) else { columnIndex = delimitedFileTable.GetColumnIndex(column.ToString()); - if(columnIndex == -1) + if (columnIndex == -1) { if ((column is string) && int.TryParse((string)column, out int columnIndex_Temp)) columnIndex = columnIndex_Temp; } } - - if(columnIndex == -1) + + if (columnIndex == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -136,7 +139,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List indexes = Core.Query.Indexes(delimitedFileTable, sAMObjects, columnIndex, parameterName); - if(indexes == null) + if (indexes == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -145,7 +148,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List indexes_New = new List(); List sAMObjects_In = new List(); List sAMObjects_Out = new List(); - for(int i=0; i < indexes.Count; i++) + for (int i = 0; i < indexes.Count; i++) { if (indexes[i] == -1) { @@ -173,4 +176,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, sAMObjects_Out); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDelimitedFileTableSetColumnNames.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDelimitedFileTableSetColumnNames.cs index b9a48a59b..dbf1dc053 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDelimitedFileTableSetColumnNames.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDelimitedFileTableSetColumnNames.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; using System.Collections.Generic; @@ -36,7 +39,7 @@ public SAMCoreDelimitedFileTableSetColumnNames() { } - + protected override GH_SAMParam[] Inputs { @@ -71,7 +74,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_delimitedFileTable"); - + DelimitedFileTable delimitedFileTable = null; if (index == -1 || !dataAccess.GetData(index, ref delimitedFileTable) || delimitedFileTable == null) { @@ -81,7 +84,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List columnNames_New = new List(); index = Params.IndexOfInputParam("_columnNames"); - if(index == -1 || !dataAccess.GetDataList(index, columnNames_New)) + if (index == -1 || !dataAccess.GetDataList(index, columnNames_New)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -98,7 +101,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) delimitedFileTable = new DelimitedFileTable(delimitedFileTable); - for (int i=0; i < columnNames_New.Count; i++) + for (int i = 0; i < columnNames_New.Count; i++) { string columnName_New = columnNames_New[i]; @@ -117,4 +120,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, new GooDelimitedFileTable(delimitedFileTable)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDelimitedFileTableSetValue.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDelimitedFileTableSetValue.cs index 8a00c1862..c33d24b91 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDelimitedFileTableSetValue.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDelimitedFileTableSetValue.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -37,7 +40,7 @@ public SAMCoreDelimitedFileTableSetValue() { } - + protected override GH_SAMParam[] Inputs { @@ -45,11 +48,11 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new GooDelimitedFileTableParam() { Name = "_delimitedFileTable", NickName = "_delimitedFileTable", Description = "SAM DelimitedFileTable", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_values", NickName = "_values", Description = "Values", Access = GH_ParamAccess.list}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_values", NickName = "_values", Description = "Values", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "columns_", NickName = "columns_", Description = "Columns names or indexes", Access = GH_ParamAccess.list, Optional = true }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Integer() { Name = "rows_", NickName = "rows_", Description = "Rows indexes", Access = GH_ParamAccess.list, Optional = true}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Integer() { Name = "rows_", NickName = "rows_", Description = "Rows indexes", Access = GH_ParamAccess.list, Optional = true }, ParamVisibility.Binding)); + - return result.ToArray(); } @@ -76,7 +79,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_delimitedFileTable"); - + DelimitedFileTable delimitedFileTable = null; if (index == -1 || !dataAccess.GetData(index, ref delimitedFileTable) || delimitedFileTable == null) { @@ -92,7 +95,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } - for(int i=0; i < values.Count; i++) + for (int i = 0; i < values.Count; i++) { if (values[i] is IGH_Goo) values[i] = (values[i] as dynamic).Value; @@ -100,7 +103,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List columns = null; index = Params.IndexOfInputParam("columns_"); - if(index != -1) + if (index != -1) { List columns_Object = new List(); if (dataAccess.GetDataList(index, columns_Object)) @@ -111,7 +114,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) object column_Object = columns_Object[i]; int columnIndex_Object = -1; - + if (Core.Query.IsNumeric(column_Object)) columnIndex_Object = System.Convert.ToInt32(column_Object); else @@ -138,7 +141,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) rows = null; } - if(rows == null && columns == null) + if (rows == null && columns == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -148,7 +151,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int columnIndex = columns == null || columns.Count == 0 ? -1 : columns[0]; int rowIndex = rows == null || rows.Count == 0 ? -1 : rows[0]; - for (int i =0; i < values.Count; i++) + for (int i = 0; i < values.Count; i++) { if (columns != null && i < columns.Count) columnIndex = columns[i]; @@ -164,4 +167,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, new GooDelimitedFileTable(delimitedFileTable)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDelimitedFileTableSort.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDelimitedFileTableSort.cs index 793fdd357..a7bb21e78 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDelimitedFileTableSort.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDelimitedFileTableSort.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -6,7 +9,7 @@ namespace SAM.Core.Grasshopper { - public class SAMCoreDelimitedFileTableSort: GH_SAMVariableOutputParameterComponent + public class SAMCoreDelimitedFileTableSort : GH_SAMVariableOutputParameterComponent { /// /// Gets the unique ID for this component. Do not change this ID after release. @@ -37,7 +40,7 @@ public SAMCoreDelimitedFileTableSort() { } - + protected override GH_SAMParam[] Inputs { @@ -45,7 +48,7 @@ protected override GH_SAMParam[] Inputs { List result = new List(); result.Add(new GH_SAMParam(new GooDelimitedFileTableParam() { Name = "_delimitedFileTable", NickName = "_delimitedFileTable", Description = "SAM DelimitedFileTable", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_column", NickName = "_column", Description = "Column name or index", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_column", NickName = "_column", Description = "Column name or index", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); return result.ToArray(); } } @@ -71,7 +74,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_delimitedFileTable"); - + DelimitedFileTable delimitedFileTable = null; if (index == -1 || !dataAccess.GetData(index, ref delimitedFileTable) || delimitedFileTable == null) { @@ -100,7 +103,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(columnIndex == -1) + if (columnIndex == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Could Not Find Column"); return; @@ -114,4 +117,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, new GooDelimitedFileTable(delimitedFileTable)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDirection.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDirection.cs index 0203d6a8d..a95ca31fb 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDirection.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreDirection.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Core.Grasshopper; using SAM.Core.Grasshopper.Properties; using System; @@ -20,7 +23,7 @@ public class SAMCoreDirection : GH_SAMEnumComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; /// /// Panel Type @@ -32,4 +35,4 @@ public SAMCoreDirection() { } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreError.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreError.cs index 8339b5af7..4da53fd80 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreError.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreError.cs @@ -1,9 +1,10 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; using System.Collections.Generic; -using System.Collections.Specialized; -using System.Linq; namespace SAM.Core.Grasshopper { @@ -38,14 +39,14 @@ public SAMCoreError() { } - + protected override GH_SAMParam[] Inputs { get { List result = new List(); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_values_M", NickName = "_values_M", Description = "Model/engine under test values", Access = GH_ParamAccess.list}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_values_M", NickName = "_values_M", Description = "Model/engine under test values", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "_values_R", NickName = "_values_R", Description = "Reference values", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); return result.ToArray(); @@ -155,7 +156,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("M"); - if(index != -1) + if (index != -1) { dataAccess.SetData(index, Core.Query.MeanError(values_M, values_R)); } @@ -188,7 +189,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index_2 = Params.IndexOfOutputParam("MDUL"); int index_3 = Params.IndexOfOutputParam("MDLL"); - if(index_1 != -1 || index_2 != -1 || index_3 != -1) + if (index_1 != -1 || index_2 != -1 || index_3 != -1) { double meanDifferenceError = Core.Query.MeanDifferenceError(values_M, values_R, out double lower, out double upper); @@ -211,4 +212,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreFilter.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreFilter.cs index f28a60a1d..5997477d6 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreFilter.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreFilter.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -41,7 +44,7 @@ public SAMCoreFilter() protected override void RegisterInputParams(GH_InputParamManager inputParamManager) { int index; - + inputParamManager.AddGenericParameter("_objects", "_objects", "Objects", GH_ParamAccess.list); inputParamManager.AddTextParameter("_name", "_name", "Name", GH_ParamAccess.item, "Name"); inputParamManager.AddGenericParameter("_value", "_value", "Value to Filter elements", GH_ParamAccess.item); @@ -121,18 +124,18 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (value is IGH_Goo) value = (objectWrapper.Value as dynamic).Value; - + objectWrapper = null; dataAccess.GetData(3, ref objectWrapper); object object_ComparisonType = null; - if(objectWrapper?.Value == null) + if (objectWrapper?.Value == null) { if (Core.Query.IsNumeric(value)) object_ComparisonType = NumberComparisonType.Equals; else object_ComparisonType = TextComparisonType.Equals; } - else if(objectWrapper.Value is NumberComparisonType || objectWrapper.Value is TextComparisonType) + else if (objectWrapper.Value is NumberComparisonType || objectWrapper.Value is TextComparisonType) { object_ComparisonType = objectWrapper.Value; } @@ -151,13 +154,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) value_Double = (double)value; else if (Core.Query.IsNumeric(value)) value_Double = System.Convert.ToDouble(value); - else if(value is string) + else if (value is string) { if (!double.TryParse((string)value, out value_Double)) value_Double = double.NaN; } - if(!double.IsNaN(value_Double)) + if (!double.IsNaN(value_Double)) { foreach (object @object in objects) { @@ -168,7 +171,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } - else if(object_ComparisonType is TextComparisonType) + else if (object_ComparisonType is TextComparisonType) { foreach (object @object in objects) { @@ -183,4 +186,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(1, result_out); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreFilterByType.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreFilterByType.cs index d50af0c8c..85df704eb 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreFilterByType.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreFilterByType.cs @@ -1,10 +1,12 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Attributes; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using System.Windows.Forms; @@ -130,7 +132,7 @@ private void Menu_PopulateOutputParameters(object sender, EventArgs e) } string name = value?.GetType()?.Name; - if(string.IsNullOrWhiteSpace(name)) + if (string.IsNullOrWhiteSpace(name)) { continue; } @@ -291,4 +293,4 @@ public override void AddedToDocument(GH_Document document) Message = ComponentVersion; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreFromFile.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreFromFile.cs index 268c82437..90ffc7973 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreFromFile.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreFromFile.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; using System.Collections.Generic; @@ -102,4 +105,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(1, true); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreFromJson.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreFromJson.cs index 8c1208086..aeb9df080 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreFromJson.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreFromJson.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; using System.Collections.Generic; @@ -102,4 +105,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(1, true); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreGetNames.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreGetNames.cs index 7873bb841..cd1f12fa6 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreGetNames.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreGetNames.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -89,4 +92,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(0, Core.Query.Names(@object)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreGetType.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreGetType.cs index f123e0156..a38bad394 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreGetType.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreGetType.cs @@ -1,4 +1,7 @@ -using GH_IO.Serialization; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using GH_IO.Serialization; using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; @@ -104,4 +107,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooObject(Type.GetType(typeFullName))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreGetValue.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreGetValue.cs index 203b326ec..60d733b02 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreGetValue.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreGetValue.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -120,7 +123,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(!hasValue) + if (!hasValue) { if (@object is SAMObject) { @@ -147,4 +150,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, value); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreInspect.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreInspect.cs index d74d6d25a..ccfef320f 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreInspect.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreInspect.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Attributes; using Grasshopper.Kernel.Types; using Newtonsoft.Json.Linq; @@ -6,7 +9,6 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using System.Windows.Forms; @@ -88,7 +90,7 @@ void PopulateOutputParameters(IEnumerable gooParameterParams) dictionary.Add(gooParameterParam.Name, new List(gooParameterParam.Recipients)); } - while(Params.Output != null && Params.Output.Count() > 0) + while (Params.Output != null && Params.Output.Count() > 0) Params.UnregisterOutputParameter(Params.Output[0]); if (gooParameterParams != null) @@ -97,7 +99,7 @@ void PopulateOutputParameters(IEnumerable gooParameterParams) { if (gooParameterParam == null) continue; - + AddOutputParameter(gooParameterParam); IList @params = null; @@ -247,7 +249,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) for (int i = 0; i < Params.Output.Count; ++i) { string name = Params.Output[i]?.Name; - if(string.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { continue; } @@ -276,7 +278,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) @object.TryGetValue(gooParameterParam.Name, out result, true); - if(result is IJSAMObject) + if (result is IJSAMObject) { dataAccess.SetData(i, new GooJSAMObject((IJSAMObject)result)); } @@ -310,9 +312,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { values[j] = new GH_Time((DateTime)values[j]); } - else if(Core.Query.IsNumeric(values[j])) + else if (Core.Query.IsNumeric(values[j])) { - if(values[j] is long || values[j] is int) + if (values[j] is long || values[j] is int) { if (!Core.Query.TryConvert(values[j], out int @int)) { @@ -337,9 +339,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(gooParameterParam.Access == GH_ParamAccess.item) + if (gooParameterParam.Access == GH_ParamAccess.item) { - if(values.Count == 0) + if (values.Count == 0) { dataAccess.SetData(i, null); } @@ -353,7 +355,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(i, values); } - + //List gooObjects = new List(); //foreach (object object_Result in (IEnumerable)result) //{ @@ -422,7 +424,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { dataAccess.SetData(i, new GooObject(result.ToString())); } - else if(result is int || result is long) + else if (result is int || result is long) { int value; if (Core.Query.TryConvert(result, out value)) @@ -446,7 +448,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { dataAccess.SetData(i, new GH_Time((DateTime)result)); } - else if(result != null) + else if (result != null) { dataAccess.SetData(i, new GooObject(result)); } @@ -460,13 +462,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } bool IGH_VariableParameterComponent.CanInsertParameter(GH_ParameterSide side, int index) => false; - + bool IGH_VariableParameterComponent.CanRemoveParameter(GH_ParameterSide side, int index) => side == GH_ParameterSide.Output; - + IGH_Param IGH_VariableParameterComponent.CreateParameter(GH_ParameterSide side, int index) => null; - + bool IGH_VariableParameterComponent.DestroyParameter(GH_ParameterSide side, int index) => true; - + void IGH_VariableParameterComponent.VariableParameterMaintenance() { } @@ -497,4 +499,4 @@ public override void AddedToDocument(GH_Document document) Message = ComponentVersion; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreLoadMaterialLibrary.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreLoadMaterialLibrary.cs index a8f409914..56168b78b 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreLoadMaterialLibrary.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreLoadMaterialLibrary.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; @@ -75,4 +78,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(1, successful); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreLogToFile.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreLogToFile.cs index d17f4f4e4..6024ac661 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreLogToFile.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreLogToFile.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; @@ -61,24 +64,24 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(1, false); Log log = null; - if(!dataAccess.GetData(0, ref log) || log == null) + if (!dataAccess.GetData(0, ref log) || log == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } string path = null; - if(!dataAccess.GetData(1, ref path) || string.IsNullOrWhiteSpace(path)) + if (!dataAccess.GetData(1, ref path) || string.IsNullOrWhiteSpace(path)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } - - if(log.Write(path)) + + if (log.Write(path)) { dataAccess.SetData(0, log); dataAccess.SetData(1, true); } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreNumberComparisonType.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreNumberComparisonType.cs index 0bb726e12..916ae1559 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreNumberComparisonType.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreNumberComparisonType.cs @@ -1,4 +1,7 @@ -using SAM.Core.Grasshopper.Properties; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core.Grasshopper.Properties; using System; namespace SAM.Core.Grasshopper @@ -30,4 +33,4 @@ public SAMCoreNumberComparisonType() { } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreNumberFilter.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreNumberFilter.cs index c69fb4ea9..cabc68157 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreNumberFilter.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreNumberFilter.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; using System.Collections.Generic; @@ -37,7 +40,7 @@ public SAMCoreNumberFilter() { } - + protected override GH_SAMParam[] Inputs { @@ -77,7 +80,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_values"); - + List values = new List(); if (index == -1 || !dataAccess.GetDataList(index, values) || values == null) { @@ -101,7 +104,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } - if(!Core.Query.TryConvert(text, out NumberComparisonType numberComparisonType)) + if (!Core.Query.TryConvert(text, out NumberComparisonType numberComparisonType)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -109,9 +112,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) double valueTrue = double.NaN; index = Params.IndexOfInputParam("valueTrue_"); - if(index != -1) + if (index != -1) { - if(!dataAccess.GetData(index, ref valueTrue)) + if (!dataAccess.GetData(index, ref valueTrue)) { valueTrue = double.NaN; } @@ -172,4 +175,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreObjects.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreObjects.cs index 119e0af53..90c62ff85 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreObjects.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreObjects.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; using System.Collections.Generic; @@ -70,7 +73,7 @@ protected override GH_SAMParam[] Outputs protected override void SolveInstance(IGH_DataAccess dataAccess) { int index = -1; - + IRelationCluster relationCluster = null; index = Params.IndexOfInputParam("_relationCluster"); if (index == -1 || !dataAccess.GetData(index, ref relationCluster) || relationCluster == null) @@ -81,11 +84,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) string fullTypeName = null; index = Params.IndexOfInputParam("_type_"); - if(index != -1) + if (index != -1) dataAccess.GetData(index, ref fullTypeName); Type type = null; - if(!string.IsNullOrWhiteSpace(fullTypeName)) + if (!string.IsNullOrWhiteSpace(fullTypeName)) { try { @@ -95,12 +98,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { type = null; } - + } - + index = Params.IndexOfOutputParam("Objects"); - if(index != -1) + if (index != -1) { List result = null; @@ -113,4 +116,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreParameterByType.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreParameterByType.cs index a3d478642..64d76ab4d 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreParameterByType.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreParameterByType.cs @@ -1,4 +1,7 @@ -using GH_IO.Serialization; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using GH_IO.Serialization; using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Attributes; @@ -181,4 +184,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooObject(result)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreParameterType.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreParameterType.cs index 8c214fa2a..b54017dbb 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreParameterType.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreParameterType.cs @@ -1,4 +1,7 @@ -using SAM.Core.Grasshopper.Properties; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core.Grasshopper.Properties; using System; namespace SAM.Core.Grasshopper @@ -30,4 +33,4 @@ public SAMCoreParameterType() { } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCorePeriod.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCorePeriod.cs index 2e5e6ba29..bc3047473 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCorePeriod.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCorePeriod.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Core.Grasshopper; using SAM.Core.Grasshopper.Properties; using System; @@ -32,4 +35,4 @@ public SAMCorePeriod() { } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreRelatedObjects.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreRelatedObjects.cs index 44dff1eb6..7ac2cf428 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreRelatedObjects.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreRelatedObjects.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; using System.Collections; @@ -120,4 +123,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, result); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreRelationClusterAddObjects.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreRelationClusterAddObjects.cs index 922cd932a..83b4f067d 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreRelationClusterAddObjects.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreRelationClusterAddObjects.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; using System.Collections.Generic; @@ -77,7 +80,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) IRelationCluster relationCluster_Result = relationCluster.Clone(); - foreach(SAMObject sAMObject in sAMObjects) + foreach (SAMObject sAMObject in sAMObjects) { (relationCluster_Result as dynamic).AddObject(sAMObject); } @@ -86,4 +89,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, relationCluster_Result); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreRemoveValue.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreRemoveValue.cs index 12061619d..a8de3d1f5 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreRemoveValue.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreRemoveValue.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Parameters; using SAM.Core.Grasshopper.Properties; using System; @@ -72,7 +75,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_sAMObject"); - if(index == -1) + if (index == -1) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -116,7 +119,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("SAMObject"); - if(index != -1) + if (index != -1) dataAccess.SetData(index, sAMObject); index = Params.IndexOfOutputParam("Succeeded"); @@ -124,4 +127,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, removed); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreReplaceByGuid.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreReplaceByGuid.cs index f86837b76..aae66d137 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreReplaceByGuid.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreReplaceByGuid.cs @@ -1,11 +1,14 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; using System.Collections.Generic; namespace SAM.Core.Grasshopper { - public class SAMCoreReplaceByGuid: GH_SAMVariableOutputParameterComponent + public class SAMCoreReplaceByGuid : GH_SAMVariableOutputParameterComponent { /// /// Gets the unique ID for this component. Do not change this ID after release. @@ -36,14 +39,14 @@ public SAMCoreReplaceByGuid() { } - + protected override GH_SAMParam[] Inputs { get { List result = new List(); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_sAMObjects", NickName = "_sAMobjects", Description = "SAM Objects", Access = GH_ParamAccess.list}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_sAMObjects", NickName = "_sAMobjects", Description = "SAM Objects", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_replacementSAMObjects", NickName = "_replacementSAMObjects", Description = "SAM Objects", Access = GH_ParamAccess.list, Optional = true }, ParamVisibility.Binding)); return result.ToArray(); @@ -88,12 +91,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.GetDataList(index, replacementSAMObjects); } - if(replacementSAMObjects != null && replacementSAMObjects.Count != 0) + if (replacementSAMObjects != null && replacementSAMObjects.Count != 0) { foreach (SAMObject sAMObject in replacementSAMObjects) { int index_Temp = sAMObjects.FindIndex(x => x.Guid == sAMObject.Guid); - if(index_Temp == -1) + if (index_Temp == -1) { sAMObjects.Add(sAMObject); } @@ -109,4 +112,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, sAMObjects); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreRound.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreRound.cs index 18dab6fa9..e651ca4db 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreRound.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreRound.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; using System.Collections.Generic; @@ -34,14 +37,14 @@ public SAMCoreRound() { } - + protected override GH_SAMParam[] Inputs { get { List result = new List(); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number { Name = "_number", NickName = "_number", Description = "Number", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number { Name = "_number", NickName = "_number", Description = "Number", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); global::Grasshopper.Kernel.Parameters.Param_Integer param_Integer = new global::Grasshopper.Kernel.Parameters.Param_Integer { Name = "numberOfDecimals_", NickName = "numberOfDecimals_", Description = "Number Of Decimals", Access = GH_ParamAccess.item, Optional = true }; param_Integer.SetPersistentData(2); result.Add(new GH_SAMParam(param_Integer, ParamVisibility.Binding)); @@ -103,4 +106,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreSAMLibraryAddObjects.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreSAMLibraryAddObjects.cs index 483d1eed3..e6c102f82 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreSAMLibraryAddObjects.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreSAMLibraryAddObjects.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; using System.Collections.Generic; @@ -74,14 +77,14 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) ISAMLibrary sAMLibrary_Result = sAMLibrary.Clone(); - foreach(SAMObject sAMObject in sAMObjects) + foreach (SAMObject sAMObject in sAMObjects) { //sAMLibrary_Result.Add(sAMObject); } - + dataAccess.SetData(0, sAMLibrary_Result); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreSamples.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreSamples.cs index 8ec560bff..f87dd9407 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreSamples.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreSamples.cs @@ -1,6 +1,8 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; -using SAM.Core.Grasshopper; using SAM.Core.Grasshopper.Properties; using System; using System.Collections.Generic; diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreSaveMaterialLibrary.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreSaveMaterialLibrary.cs index 60158ba57..5091b5ce0 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreSaveMaterialLibrary.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreSaveMaterialLibrary.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; @@ -92,4 +95,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(1, successful); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreSelectByName.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreSelectByName.cs index 6f54873d2..307bb70d2 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreSelectByName.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreSelectByName.cs @@ -1,4 +1,7 @@ -using GH_IO.Serialization; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using GH_IO.Serialization; using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; @@ -45,7 +48,7 @@ public override bool Write(GH_IWriter writer) { if (values == null) values = new List(); - + writer.SetString("Values", string.Join("\n", values)); if (value == null) @@ -59,7 +62,7 @@ public override bool Write(GH_IWriter writer) public override bool Read(GH_IReader reader) { string text = null; - + if (reader.TryGetString("Values", ref text) && !string.IsNullOrWhiteSpace(text)) values = text.Split('\n').ToList(); @@ -71,7 +74,7 @@ public override bool Read(GH_IReader reader) protected override void AppendAdditionalComponentMenuItems(ToolStripDropDown menu) { //this.menu = menu; - + foreach (string value in values) Menu_AppendItem(menu, value, Menu_Changed, true, value.Equals(this.value)).Tag = value; } @@ -117,14 +120,14 @@ protected override void RegisterOutputParams(GH_OutputParamManager outputParamMa protected override void SolveInstance(IGH_DataAccess dataAccess) { List sAMObjects = new List(); - if(!dataAccess.GetDataList(0, sAMObjects) || sAMObjects == null) + if (!dataAccess.GetDataList(0, sAMObjects) || sAMObjects == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } HashSet values = new HashSet(); - foreach(SAMObject sAMObject in sAMObjects) + foreach (SAMObject sAMObject in sAMObjects) { string name = null; if (!Core.Query.TryGetValue(sAMObject, "Name", out name)) @@ -169,4 +172,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(1, result_Out.ConvertAll(x => new GooJSAMObject(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreSetValue.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreSetValue.cs index c3cb333a9..81634cd3d 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreSetValue.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreSetValue.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -44,7 +47,7 @@ protected override void RegisterInputParams(GH_InputParamManager inputParamManag global::Grasshopper.Kernel.Parameters.Param_GenericObject genericObject = new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_sAMObject", NickName = "_sAMObject", Description = "SAM Object", Access = GH_ParamAccess.item }; genericObject.DataMapping = GH_DataMapping.Graft; inputParamManager.AddParameter(genericObject, "_sAMObject", "_sAMObject", "SAM Object\nConnect item or list", GH_ParamAccess.item); - + int index = inputParamManager.AddTextParameter("_parameter", "_parameter", "Parameter", GH_ParamAccess.item); inputParamManager[index].DataMapping = GH_DataMapping.Graft; @@ -97,7 +100,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } object value = objectWrapper?.Value; - if(value is IGH_Goo) + if (value is IGH_Goo) { value = (value as dynamic).Value; } @@ -106,7 +109,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) bool result = false; - if(name == "Name") + if (name == "Name") { PropertyInfo[] propertyInfos = parameterizedSAMObject.GetType().GetProperties(); if (propertyInfos != null) @@ -138,7 +141,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(!result) + if (!result) { if (enums != null && enums.Count > 0) { @@ -177,4 +180,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(1, result); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreSetValues.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreSetValues.cs index 94a0a9e74..4bc7ff8cb 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreSetValues.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreSetValues.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -37,14 +40,14 @@ public SAMCoreSetValues() { } - + protected override GH_SAMParam[] Inputs { get { List result = new List(); - + global::Grasshopper.Kernel.Parameters.Param_GenericObject genericObject = new global::Grasshopper.Kernel.Parameters.Param_GenericObject() { Name = "_sAMObject", NickName = "_sAMObject", Description = "SAM Object", Access = GH_ParamAccess.item }; genericObject.DataMapping = GH_DataMapping.Graft; result.Add(new GH_SAMParam(genericObject, ParamVisibility.Binding)); @@ -78,7 +81,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int index; index = Params.IndexOfInputParam("_sAMObject"); - + SAMObject sAMObject = null; if (index == -1 || !dataAccess.GetData(0, ref sAMObject) || sAMObject == null) { @@ -88,7 +91,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List names = new List(); index = Params.IndexOfInputParam("_parameters"); - if(index == -1 || !dataAccess.GetDataList(index, names) || names == null) + if (index == -1 || !dataAccess.GetDataList(index, names) || names == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -106,7 +109,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) sAMObject = sAMObject.Clone(); List names_Result = new List(); - for (int i=0; i < names.Count; i++) + for (int i = 0; i < names.Count; i++) { string name = names[i]; if (name == null) @@ -134,7 +137,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List enums = ActiveManager.GetParameterEnums(sAMObject, name); if (enums != null && enums.Count > 0) { - if(value == null) + if (value == null) { foreach (Enum @enum in enums) { @@ -166,10 +169,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfOutputParam("SAMObject"); if (index != -1) dataAccess.SetData(index, sAMObject); - + index = Params.IndexOfOutputParam("Names"); if (index != -1) dataAccess.SetDataList(index, names_Result); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreStringReplace.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreStringReplace.cs index 9746bae3c..3a40bbaac 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreStringReplace.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreStringReplace.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; using System.Collections.Generic; @@ -102,7 +105,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("Text"); - if(index != -1) + if (index != -1) { string result = textMap.Replace(text); if (result.Length > maxLength) @@ -112,4 +115,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreTableModifier.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreTableModifier.cs index 48114a828..7df966e2e 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreTableModifier.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreTableModifier.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using Rhino.Geometry; @@ -40,14 +43,14 @@ public SAMCoreTableModifier() { } - + protected override GH_SAMParam[] Inputs { get { List result = new List(); - result.Add(new GH_SAMParam(new GooTableModifierParam() { Name = "_tableModifier", NickName = "_tableModifier", Description = "SAM Core TableModifier", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooTableModifierParam() { Name = "_tableModifier", NickName = "_tableModifier", Description = "SAM Core TableModifier", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); return result.ToArray(); } @@ -90,7 +93,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } IEnumerable names = tableModifier.Headers; - if(names == null) + if (names == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "TableModifier has no columns"); return; @@ -101,7 +104,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) double[,] values = tableModifier.GetValues(out List columnHeader, out List> rowHeaders); DataTree dataTree_RowHeaders = new DataTree(); - for(int i =0; i < rowHeaders.Count; i++) + for (int i = 0; i < rowHeaders.Count; i++) { dataTree_RowHeaders.AddRange(rowHeaders[i], new GH_Path(i)); } @@ -173,4 +176,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreTextComparisonType.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreTextComparisonType.cs index bc9db4a47..cd6ad286e 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreTextComparisonType.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreTextComparisonType.cs @@ -1,4 +1,7 @@ -using SAM.Core.Grasshopper.Properties; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core.Grasshopper.Properties; using System; namespace SAM.Core.Grasshopper @@ -30,4 +33,4 @@ public SAMCoreTextComparisonType() { } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreTextMapValues.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreTextMapValues.cs index 0b3f188c3..05e1b5f3a 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreTextMapValues.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreTextMapValues.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; using SAM.Core.Grasshopper.Properties; @@ -39,14 +42,14 @@ public SAMCoreTextMapValues() { } - + protected override GH_SAMParam[] Inputs { get { List result = new List(); - result.Add(new GH_SAMParam(new GooSAMObjectParam() { Name = "_textMap", NickName = "_textMap", Description = "TextMap", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new GooSAMObjectParam() { Name = "_textMap", NickName = "_textMap", Description = "TextMap", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); return result.ToArray(); } @@ -101,4 +104,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataTree(index, dataTree); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreToCsv.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreToCsv.cs index 864219f4c..7c957f92b 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreToCsv.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreToCsv.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -133,4 +136,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(1, true); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreToFile.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreToFile.cs index 53b29d8df..9c5f57f5c 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreToFile.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreToFile.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -107,4 +110,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, result); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreToJson.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreToJson.cs index a51e9be37..bc52ec711 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreToJson.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreToJson.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -116,4 +119,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(1, true); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreToList.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreToList.cs index 311228248..97ffa21a6 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreToList.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreToList.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; @@ -75,4 +78,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataTree(0, result); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreUintToARGB.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreUintToARGB.cs index 6d2aff7df..ea539c153 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreUintToARGB.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreUintToARGB.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; @@ -83,4 +86,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(3, System.Convert.ToInt32(color.B)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreUintToColor.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreUintToColor.cs index 5214ada3c..d13d14d06 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreUintToColor.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreUintToColor.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; @@ -77,4 +80,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, color); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreUpdate.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreUpdate.cs index cb82f84a8..40fe8d438 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreUpdate.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMCoreUpdate.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; using System.Collections.Generic; @@ -23,7 +26,7 @@ public class SAMCoreUpdate : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; public override GH_Exposure Exposure => GH_Exposure.primary; @@ -115,7 +118,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("succeeded"); - if(index != -1) + if (index != -1) { dataAccess.SetData(index, gH_SAMComponents != null && gH_SAMComponents.Count != 0); } @@ -134,4 +137,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) // gH_SAMComponents = null; //} } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMHydraExportFile.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMHydraExportFile.cs index 160480402..ba51bbe43 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMHydraExportFile.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMHydraExportFile.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper.Properties; using System; @@ -37,7 +40,7 @@ public SAMHydraExportFile() { } - + protected override GH_SAMParam[] Inputs { @@ -167,4 +170,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Component/SAMVersion.cs b/Grasshopper/SAM.Core.Grasshopper/Component/SAMVersion.cs index d01867503..6d822ae83 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Component/SAMVersion.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Component/SAMVersion.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; using System; @@ -75,4 +78,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(2, !currentVersion.Equals(latestVersion)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Convert/ToSAM/GH_SAMParam.cs b/Grasshopper/SAM.Core.Grasshopper/Convert/ToSAM/GH_SAMParam.cs index 0e8a2fba5..5497d9d9f 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Convert/ToSAM/GH_SAMParam.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Convert/ToSAM/GH_SAMParam.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using System; @@ -31,4 +34,4 @@ public static GH_SAMParam ToSAM(this IGH_Param param, ParamVisibility paramVisib return result; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Create/GH_SAMParam.cs b/Grasshopper/SAM.Core.Grasshopper/Create/GH_SAMParam.cs index c8c0767e4..19ee67d52 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Create/GH_SAMParam.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Create/GH_SAMParam.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; namespace SAM.Core.Grasshopper { @@ -40,4 +43,4 @@ public static GH_SAMParam GH_SAMParam(string name, string nickname, string de return new GH_SAMParam(param, paramVisibility); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Enums/ParamVisibility.cs b/Grasshopper/SAM.Core.Grasshopper/Enums/ParamVisibility.cs index 1b62cf6f9..e69beda9b 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Enums/ParamVisibility.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Enums/ParamVisibility.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Core.Grasshopper { diff --git a/Grasshopper/SAM.Core.Grasshopper/Interfaces/IGH_SAMComponent.cs b/Grasshopper/SAM.Core.Grasshopper/Interfaces/IGH_SAMComponent.cs index b1585e88d..631d51f71 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Interfaces/IGH_SAMComponent.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Interfaces/IGH_SAMComponent.cs @@ -1,11 +1,14 @@ -namespace SAM.Core.Grasshopper +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core.Grasshopper { public interface IGH_SAMComponent { - string ComponentVersion { get; } + string ComponentVersion { get; } - string SAMVersion { get; } + string SAMVersion { get; } - string LatestComponentVersion { get; } + string LatestComponentVersion { get; } } } diff --git a/Grasshopper/SAM.Core.Grasshopper/Interfaces/IGooParameter.cs b/Grasshopper/SAM.Core.Grasshopper/Interfaces/IGooParameter.cs index aa9530611..831c8eb8a 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Interfaces/IGooParameter.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Interfaces/IGooParameter.cs @@ -1,9 +1,12 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; namespace SAM.Core.Grasshopper { - public interface IGooParameter: IGH_Goo + public interface IGooParameter : IGH_Goo { string Name { get; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Interfaces/IGooSAMObject.cs b/Grasshopper/SAM.Core.Grasshopper/Interfaces/IGooSAMObject.cs index 79a0d3206..e8cf56c5f 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Interfaces/IGooSAMObject.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Interfaces/IGooSAMObject.cs @@ -1,7 +1,10 @@ -namespace SAM.Core.Grasshopper +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core.Grasshopper { public interface IGooJSAMObject { IJSAMObject GetJSAMObject(); } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Kernel/AssemblyInfo.cs b/Grasshopper/SAM.Core.Grasshopper/Kernel/AssemblyInfo.cs index 4ecfc6421..00191f6d5 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Kernel/AssemblyInfo.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Kernel/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using System; using System.Drawing; @@ -67,4 +70,4 @@ public override string AuthorContact } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Kernel/AssemblyPriority.cs b/Grasshopper/SAM.Core.Grasshopper/Kernel/AssemblyPriority.cs index e6cc32774..1b71248ff 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Kernel/AssemblyPriority.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Kernel/AssemblyPriority.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using SAM.Core.Grasshopper.Properties; @@ -13,4 +16,4 @@ public override GH_LoadingInstruction PriorityLoad() return GH_LoadingInstruction.Proceed; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Modify/AppendNewComponentAdditionalMenuItem.cs b/Grasshopper/SAM.Core.Grasshopper/Modify/AppendNewComponentAdditionalMenuItem.cs index 729a5c7b6..9c0197c06 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Modify/AppendNewComponentAdditionalMenuItem.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Modify/AppendNewComponentAdditionalMenuItem.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using System.Windows.Forms; @@ -18,15 +21,15 @@ public static ToolStripMenuItem AppendNewComponentAdditionalMenuItem(this IGH_SA string latestComponentVersion = gH_SAMComponent.LatestComponentVersion; if (!string.IsNullOrWhiteSpace(latestComponentVersion)) - text = string.Format("{0} ({1})", text, latestComponentVersion); - + text = string.Format("{0} ({1})", text, latestComponentVersion); + ToolStripMenuItem toolStripMenuItem = GH_DocumentObject.Menu_AppendItem(menu, text, OnGetNewComponentClick, Properties.Resources.SAM_Small); if (toolStripMenuItem != null) toolStripMenuItem.Tag = gH_Component.InstanceGuid; return toolStripMenuItem; } - + return null; } @@ -43,4 +46,4 @@ private static void OnGetNewComponentClick(object sender = null, object e = null Query.Copy(gH_Component); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Modify/AppendSourceCodeAdditionalMenuItem.cs b/Grasshopper/SAM.Core.Grasshopper/Modify/AppendSourceCodeAdditionalMenuItem.cs index 70b5843f8..8d59be38f 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Modify/AppendSourceCodeAdditionalMenuItem.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Modify/AppendSourceCodeAdditionalMenuItem.cs @@ -1,7 +1,9 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using System; -using System.Diagnostics; using System.Reflection; using System.Windows.Forms; @@ -32,16 +34,16 @@ private static void OnSourceCodeClick(object sender = null, object e = null) if (gH_SAMComponent == null) return; - Assembly assembly = gH_SAMComponent.GetType().Assembly; + Assembly assembly = gH_SAMComponent.GetType().Assembly; string link = @"https://github.com/HoareLea"; string name = assembly.GetName().Name; string[] names = name?.Split('.'); - if(names != null && names.Length > 2) + if (names != null && names.Length > 2) { string project = "SAM"; - if(names.Length > 3) + if (names.Length > 3) project = string.Format("{0}_{1}", project, names[3]); string link_Temp = string.Format(@"{0}/{1}/blob/master/Grasshopper/{2}/Component/{3}.cs", link, project, name, gH_SAMComponent.GetType().Name); @@ -53,4 +55,4 @@ private static void OnSourceCodeClick(object sender = null, object e = null) Core.Query.StartProcess(link); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Modify/AppendVersionMenuItem.cs b/Grasshopper/SAM.Core.Grasshopper/Modify/AppendVersionMenuItem.cs index 2e5421093..9d4be9dce 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Modify/AppendVersionMenuItem.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Modify/AppendVersionMenuItem.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using System.Windows.Forms; namespace SAM.Core.Grasshopper @@ -29,4 +32,4 @@ private static void OnVersionComponentClick(object sender = null, object e = nul } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Modify/CopyParameteres.cs b/Grasshopper/SAM.Core.Grasshopper/Modify/CopyParameteres.cs index 0cd0c1a05..9e069075c 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Modify/CopyParameteres.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Modify/CopyParameteres.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using System.Collections.Generic; using System.Linq; @@ -98,4 +101,4 @@ public static void CopyParameteres(GH_ParameterSide parameterSide, GH_SAMCompone } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Modify/ExportHydra.cs b/Grasshopper/SAM.Core.Grasshopper/Modify/ExportHydra.cs index 483a6da90..5a970e1e4 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Modify/ExportHydra.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Modify/ExportHydra.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.GUI.Canvas; using Grasshopper.Kernel; //using LibGit2Sharp; @@ -20,7 +23,7 @@ public static List ExportHydra(this GH_Document gH_Document, string gith { List result = new List(); - if(gH_Document == null) + if (gH_Document == null) { result.Add("Invalid document"); return result; @@ -31,7 +34,7 @@ public static List ExportHydra(this GH_Document gH_Document, string gith targetFolder = "C:\\Temp\\ScriptsHydra"; } - if(string.IsNullOrWhiteSpace(Path.GetFileName(targetFolder))) + if (string.IsNullOrWhiteSpace(Path.GetFileName(targetFolder))) { targetFolder = Directory.GetParent(targetFolder)?.FullName; } @@ -62,7 +65,7 @@ public static List ExportHydra(this GH_Document gH_Document, string gith targetFolder = Path.Combine(targetFolder, "3-Examples_GH", safeFileName); - if(!Directory.Exists(targetFolder)) + if (!Directory.Exists(targetFolder)) { Directory.CreateDirectory(targetFolder); } @@ -248,7 +251,7 @@ public static List ExportHydra(this GH_Document gH_Document, string gith result.Add($"Export and Git push successful: {zipPath}\n\nTo create a pull request, open this link in your browser:\n{repoUrl}"); Core.Query.StartProcess(repoUrl); - + return result; } @@ -356,7 +359,7 @@ private static Dictionary GetMetaData(IEnumerable { { fileName + "_Rhino.png", "Rhino Viewport Screenshot" } }); } - + metaDataDict["images"] = images; // Addfiles @@ -473,4 +476,4 @@ private static void ExecuteGitCommand(string workingDirectory, string command, o } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Modify/RunGrasshopperScript.cs b/Grasshopper/SAM.Core.Grasshopper/Modify/RunGrasshopperScript.cs index fd42dca10..4fb37b89c 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Modify/RunGrasshopperScript.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Modify/RunGrasshopperScript.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Diagnostics; using System.IO; @@ -37,7 +40,7 @@ public static bool RunGrasshopperScript(string path_Grasshopper, string path_Rhi ProcessStartInfo processStartInfo = new ProcessStartInfo(path_Temp); processStartInfo.WindowStyle = ProcessWindowStyle.Hidden; - + Process process = Process.Start(processStartInfo); process.WaitForExit(); } @@ -54,4 +57,4 @@ public static bool RunGrasshopperScript(string path_Grasshopper, string path_Rhi return true; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Modify/UpdateComponent.cs b/Grasshopper/SAM.Core.Grasshopper/Modify/UpdateComponent.cs index f7cea1cad..ed8bd26b7 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Modify/UpdateComponent.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Modify/UpdateComponent.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using System; namespace SAM.Core.Grasshopper @@ -24,7 +27,7 @@ public static GH_SAMComponent DuplicateComponent(GH_SAMComponent gH_SAMComponent } bool add = gH_Document.AddObject(result, false); - if(!add) + if (!add) { log.Add(new LogRecord("Could not add component to document: {0}", LogRecordType.Error, gH_SAMComponent.Name)); return null; @@ -48,4 +51,4 @@ public static GH_SAMComponent DuplicateComponent(GH_SAMComponent gH_SAMComponent return DuplicateComponent(gH_SAMComponent, out Log log); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Modify/UpdateComponents.cs b/Grasshopper/SAM.Core.Grasshopper/Modify/UpdateComponents.cs index 3da48b069..05af63c16 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Modify/UpdateComponents.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Modify/UpdateComponents.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using System; using System.Collections.Generic; using System.Linq; @@ -58,7 +61,7 @@ public static List UpdateComponents(IEnumerable UpdateComponents(IEnumerable result = new List(); - foreach(Tuple tuple in tuples) + foreach (Tuple tuple in tuples) { //tuple.Item2.ExpireSolution(false); result.Add(tuple.Item2); @@ -82,4 +85,4 @@ public static List UpdateComponents(IEnumerable // This code was generated by a tool. // Runtime Version:4.0.30319.42000 diff --git a/Grasshopper/SAM.Core.Grasshopper/Query/Clone.cs b/Grasshopper/SAM.Core.Grasshopper/Query/Clone.cs index 2e6d4b6c9..93535d8f6 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Query/Clone.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Query/Clone.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; namespace SAM.Core.Grasshopper @@ -27,4 +30,4 @@ public static IGH_Param Clone(this IGH_Param param) finally { param.Attributes = attributes; } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Query/Copy.cs b/Grasshopper/SAM.Core.Grasshopper/Query/Copy.cs index 4ce44bbb9..c074d5be8 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Query/Copy.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Query/Copy.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using System; @@ -27,4 +30,4 @@ public static GH_Component Copy(this GH_Component gH_Component) return result; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Query/DataTree.cs b/Grasshopper/SAM.Core.Grasshopper/Query/DataTree.cs index 8e3c0884d..4deb6c00f 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Query/DataTree.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Query/DataTree.cs @@ -1,4 +1,7 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel.Data; using System.Collections.Generic; @@ -47,4 +50,4 @@ public static DataTree DataTree(this object[,] values) return result; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Query/GenericSubclassOf.cs b/Grasshopper/SAM.Core.Grasshopper/Query/GenericSubclassOf.cs index 622a3dddb..5c268d5d5 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Query/GenericSubclassOf.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Query/GenericSubclassOf.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Core.Grasshopper { @@ -16,4 +19,4 @@ public static bool GenericSubclassOf(this Type type, Type baseGenericType) return false; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Query/HasComponentVersion.cs b/Grasshopper/SAM.Core.Grasshopper/Query/HasComponentVersion.cs index b00cdbc81..560e1db17 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Query/HasComponentVersion.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Query/HasComponentVersion.cs @@ -1,4 +1,7 @@ -namespace SAM.Core.Grasshopper +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core.Grasshopper { public static partial class Query { @@ -7,4 +10,4 @@ public static bool HasComponentVersion(this IGH_SAMComponent gH_SAMComponent) return !string.IsNullOrWhiteSpace(gH_SAMComponent?.ComponentVersion); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Query/JSAMObjects.cs b/Grasshopper/SAM.Core.Grasshopper/Query/JSAMObjects.cs index d52e11701..7b6e47154 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Query/JSAMObjects.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Query/JSAMObjects.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; using System.Collections.Generic; namespace SAM.Core.Grasshopper @@ -34,7 +37,7 @@ public static List JSAMObjects(this global::Grasshopper.Kernel.Data.IGH_St continue; } - if(!(jSAMObject is T)) + if (!(jSAMObject is T)) { continue; } @@ -46,4 +49,4 @@ public static List JSAMObjects(this global::Grasshopper.Kernel.Data.IGH_St return result; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Query/Layer.cs b/Grasshopper/SAM.Core.Grasshopper/Query/Layer.cs index 0f49a04d2..7b1b9348a 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Query/Layer.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Query/Layer.cs @@ -1,4 +1,7 @@ -namespace SAM.Core.Grasshopper +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core.Grasshopper { public static partial class Query { @@ -8,7 +11,7 @@ public static Rhino.DocObjects.Layer Layer(this Rhino.DocObjects.Tables.LayerTab return null; int count = layerTable.Count; - for(int i=0; i < count; i++) + for (int i = 0; i < count; i++) { Rhino.DocObjects.Layer layer = layerTable[i]; if (layer == null) @@ -24,4 +27,4 @@ public static Rhino.DocObjects.Layer Layer(this Rhino.DocObjects.Tables.LayerTab return null; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Query/Objects.cs b/Grasshopper/SAM.Core.Grasshopper/Query/Objects.cs index 3ad5eb279..bb6198038 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Query/Objects.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Query/Objects.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -6,7 +9,7 @@ namespace SAM.Core.Grasshopper { public static partial class Query { - public static object[,] Objects(global::Grasshopper.Kernel.Data.GH_Structure structure) where T: global::Grasshopper.Kernel.Types.IGH_Goo + public static object[,] Objects(global::Grasshopper.Kernel.Data.GH_Structure structure) where T : global::Grasshopper.Kernel.Types.IGH_Goo { if (structure == null) return null; @@ -16,7 +19,7 @@ public static partial class Query return null; int max = 0; - foreach(List list in branches) + foreach (List list in branches) { if (list == null) continue; @@ -31,12 +34,12 @@ public static partial class Query return result; int index = 0; - foreach(List list in branches) + foreach (List list in branches) { if (list == null) continue; - for(int i=0; i < list.Count; i++) + for (int i = 0; i < list.Count; i++) { T t = list[i]; if (t == null) @@ -47,18 +50,18 @@ public static partial class Query { value = (t as dynamic).Value; } - catch(Exception) + catch (Exception) { continue; } result[index, i] = value; } - + index++; } return result; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Query/Obsolete.cs b/Grasshopper/SAM.Core.Grasshopper/Query/Obsolete.cs index eddec55de..b29edc5b1 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Query/Obsolete.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Query/Obsolete.cs @@ -1,4 +1,7 @@ -namespace SAM.Core.Grasshopper +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core.Grasshopper { public static partial class Query { @@ -6,7 +9,7 @@ public static bool Obsolete(this IGH_SAMComponent gH_SAMComponent) { if (gH_SAMComponent == null) return false; - + string componentVersion = gH_SAMComponent.ComponentVersion; string latestComponentVersion = gH_SAMComponent.LatestComponentVersion; @@ -16,4 +19,4 @@ public static bool Obsolete(this IGH_SAMComponent gH_SAMComponent) return componentVersion != latestComponentVersion; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Query/RhinocerosExePath.cs b/Grasshopper/SAM.Core.Grasshopper/Query/RhinocerosExePath.cs index 1a057b6dc..a6cdaef95 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Query/RhinocerosExePath.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Query/RhinocerosExePath.cs @@ -1,4 +1,7 @@ -using Microsoft.Win32; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Microsoft.Win32; using System.Collections.Generic; using System.Linq; @@ -24,7 +27,7 @@ public static string RhinocerosExePath(string version = null) else { version_Temp = versions.Find(x => x.Trim().ToUpper() == version.Trim().ToUpper()); - if(version_Temp == null) + if (version_Temp == null) version_Temp = versions.Find(x => x.Trim().ToUpper().StartsWith(version.Trim().ToUpper())); if (version_Temp == null) @@ -38,4 +41,4 @@ public static string RhinocerosExePath(string version = null) return registryKey.GetValue("ExePath") as string; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Query/RhinocerosVersions.cs b/Grasshopper/SAM.Core.Grasshopper/Query/RhinocerosVersions.cs index ada1bf84c..5b94863b1 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Query/RhinocerosVersions.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Query/RhinocerosVersions.cs @@ -1,4 +1,7 @@ -using Microsoft.Win32; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Microsoft.Win32; namespace SAM.Core.Grasshopper { @@ -17,4 +20,4 @@ public static string[] RhinocerosVersions() return result; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Query/SaveAs.cs b/Grasshopper/SAM.Core.Grasshopper/Query/SaveAs.cs index dbf1bf0c0..fa5a7cb09 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Query/SaveAs.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Query/SaveAs.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Windows.Forms; namespace SAM.Core.Grasshopper @@ -39,4 +42,4 @@ public static bool SaveAs(this global::Grasshopper.Kernel.Data.IGH_Structure gH_ return Core.Convert.ToFile(jSAMObjects, path); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Core.Grasshopper/Query/TryGetValue.cs b/Grasshopper/SAM.Core.Grasshopper/Query/TryGetValue.cs index 7e28a1a53..e7ba97772 100644 --- a/Grasshopper/SAM.Core.Grasshopper/Query/TryGetValue.cs +++ b/Grasshopper/SAM.Core.Grasshopper/Query/TryGetValue.cs @@ -1,4 +1,7 @@ -using Rhino.Geometry; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino.Geometry; using System.Collections.Generic; namespace SAM.Core.Grasshopper @@ -12,7 +15,7 @@ public static bool TryGetValue(this Dictionary dictionary, doubl if (dictionary == null) return false; - foreach(KeyValuePair keyValuePair in dictionary) + foreach (KeyValuePair keyValuePair in dictionary) { double value_Temp = System.Math.Round(value, System.MidpointRounding.ToEven); @@ -27,4 +30,4 @@ public static bool TryGetValue(this Dictionary dictionary, doubl return false; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Classes/GooSAMGeometry.cs b/Grasshopper/SAM.Geometry.Grasshopper/Classes/GooSAMGeometry.cs index 60c48756a..9766e4327 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Classes/GooSAMGeometry.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Classes/GooSAMGeometry.cs @@ -1,4 +1,7 @@ -using GH_IO.Serialization; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using GH_IO.Serialization; using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using Newtonsoft.Json.Linq; @@ -80,7 +83,7 @@ public virtual BoundingBox ClippingBox if (Value is IBoundable2D) { BoundingBox2D boundingBox2D = ((IBoundable2D)Value).GetBoundingBox(); - return Rhino.Convert.ToRhino( new BoundingBox3D(new Point3D(boundingBox2D.Min.X, boundingBox2D.Min.Y, -1), new Point3D(boundingBox2D.Max.X, boundingBox2D.Max.Y, 1))); + return Rhino.Convert.ToRhino(new BoundingBox3D(new Point3D(boundingBox2D.Min.X, boundingBox2D.Min.Y, -1), new Point3D(boundingBox2D.Max.X, boundingBox2D.Max.Y, 1))); } if (Value is Point2D) @@ -164,9 +167,9 @@ public override bool CastFrom(object source) if (source is SAMGeometry2DObjectCollection) { List sAMGeometry2Ds = new List(); - foreach(ISAMGeometry2DObject sAMGeometry2DObject in (SAMGeometry2DObjectCollection)source) + foreach (ISAMGeometry2DObject sAMGeometry2DObject in (SAMGeometry2DObjectCollection)source) { - if(sAMGeometry2DObject is IFace2DObject) + if (sAMGeometry2DObject is IFace2DObject) { sAMGeometry2Ds.Add(((IFace2DObject)sAMGeometry2DObject).Face2D); } @@ -228,7 +231,7 @@ public override bool CastFrom(object source) return true; } - if(source is Rectangle3d) + if (source is Rectangle3d) { Value = Rhino.Convert.ToSAM((Rectangle3d)source); return true; @@ -276,7 +279,7 @@ public override bool CastFrom(object source) return true; } - if(source is Mesh) + if (source is Mesh) { Value = Rhino.Convert.ToSAM((Mesh)source); } @@ -289,7 +292,7 @@ public override bool CastFrom(object source) if (source is Brep) { List sAMGeometry3Ds = Rhino.Convert.ToSAM(((Brep)source)); - if(sAMGeometry3Ds != null && sAMGeometry3Ds.Count != 0) + if (sAMGeometry3Ds != null && sAMGeometry3Ds.Count != 0) { Value = sAMGeometry3Ds[0]; return true; @@ -376,9 +379,9 @@ public override bool CastTo(ref Y target) } } - if(typeof(Y) == typeof(Rectangle3d)) + if (typeof(Y) == typeof(Rectangle3d)) { - if(Value is Rectangle3D) + if (Value is Rectangle3D) { target = (Y)(object)Rhino.Convert.ToRhino((Rectangle3D)Value); return true; @@ -429,14 +432,14 @@ public override bool CastTo(ref Y target) if (Value is Shell) { Mesh mesh = Rhino.Convert.ToRhino_Mesh((Shell)Value); - if(mesh != null) + if (mesh != null) { target = (Y)(object)new GH_Mesh(mesh); return true; } } - if(Value is Mesh3D) + if (Value is Mesh3D) { target = (Y)(object)new GH_Mesh(Rhino.Convert.ToRhino((Mesh3D)Value)); return true; @@ -540,4 +543,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Classes/GooTransform3D.cs b/Grasshopper/SAM.Geometry.Grasshopper/Classes/GooTransform3D.cs index 17b574f8a..37fd94955 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Classes/GooTransform3D.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Classes/GooTransform3D.cs @@ -1,4 +1,7 @@ -using GH_IO.Serialization; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using GH_IO.Serialization; using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using Newtonsoft.Json.Linq; @@ -214,4 +217,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/CreateSAMTransform3DOriginToPlane.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/CreateSAMTransform3DOriginToPlane.cs index cd4329f7f..30e8a6e6b 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/CreateSAMTransform3DOriginToPlane.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/CreateSAMTransform3DOriginToPlane.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -67,7 +70,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } - if(!Query.TryGetSAMGeometries(objectWrapper, out List planes) || planes == null || planes.Count == 0) + if (!Query.TryGetSAMGeometries(objectWrapper, out List planes) || planes == null || planes.Count == 0) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -76,4 +79,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooTransform3D(Transform3D.GetOriginToPlane(planes[0]))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/CreateSAMTransform3DPlaneToOrigin.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/CreateSAMTransform3DPlaneToOrigin.cs index 58feb4b7c..28b4f546c 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/CreateSAMTransform3DPlaneToOrigin.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/CreateSAMTransform3DPlaneToOrigin.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -76,4 +79,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooTransform3D(Transform3D.GetPlaneToOrigin(planes[0]))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/CreateSAMTransform3DPlaneToPlane.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/CreateSAMTransform3DPlaneToPlane.cs index 8c28f18cf..f04a37c96 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/CreateSAMTransform3DPlaneToPlane.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/CreateSAMTransform3DPlaneToPlane.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -103,4 +106,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooTransform3D(Transform3D.GetPlaneToPlane(plane_1, plane_2))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryCreatePlane.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryCreatePlane.cs index b548f5702..5c9d2e8b7 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryCreatePlane.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryCreatePlane.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -87,4 +90,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(1, new GooSAMGeometry(plane?.Normal)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryCreateShell.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryCreateShell.cs index 088b907b1..d45ab7a69 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryCreateShell.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryCreateShell.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Rhino.Geometry; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -86,4 +89,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, new GooSAMGeometry(shell)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryFilterShells.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryFilterShells.cs index d282cdff6..ea8e4417e 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryFilterShells.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryFilterShells.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -159,7 +162,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (shells_Temp == null || shells_Temp.Count == 0) continue; - foreach(Shell shell in shells_Temp) + foreach (Shell shell in shells_Temp) { result_In.Add(shell); shells.Remove(shell); @@ -175,4 +178,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, shells.ConvertAll(x => new GooSAMGeometry(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryGetShellsByPoint3D.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryGetShellsByPoint3D.cs index 4286a1274..fa1f0cd63 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryGetShellsByPoint3D.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryGetShellsByPoint3D.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -161,4 +164,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, shells_Out); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryGetShellsByPoint3Ds.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryGetShellsByPoint3Ds.cs index 81424eed6..26fbf0f57 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryGetShellsByPoint3Ds.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryGetShellsByPoint3Ds.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -123,7 +126,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } List point3Ds = new List(); - foreach(GH_ObjectWrapper objectWrapper in objectWrappers) + foreach (GH_ObjectWrapper objectWrapper in objectWrappers) { if (Query.TryGetSAMGeometries(objectWrapper, out List point3Ds_Temp) && point3Ds_Temp != null && point3Ds_Temp.Count > 0) point3Ds.AddRange(point3Ds_Temp); @@ -157,21 +160,21 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List shells_Out = new List(); foreach (Shell shell in shells) { - if(shell == null) + if (shell == null) { continue; } - foreach(Point3D point3D in point3Ds) + foreach (Point3D point3D in point3Ds) { - if(shell.On(point3D, tolerance) || shell.Inside(point3D, silverSpacing, tolerance)) + if (shell.On(point3D, tolerance) || shell.Inside(point3D, silverSpacing, tolerance)) { shells_In.Add(shell); break; } } - if(!shells_In.Contains(shell)) + if (!shells_In.Contains(shell)) { shells_Out.Add(shell); } @@ -186,4 +189,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, shells_Out); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryMeshClose.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryMeshClose.cs index 48b68bf19..0b2e615f9 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryMeshClose.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryMeshClose.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Rhino.Geometry; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -73,4 +76,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(1, result); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryMeshReduce.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryMeshReduce.cs index 33f738db2..f065b66e6 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryMeshReduce.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryMeshReduce.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Rhino.Geometry; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -88,4 +91,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, mesh); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryModifyDifference.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryModifyDifference.cs index c24bf3972..1fb597f5c 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryModifyDifference.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryModifyDifference.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -114,4 +117,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) //AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, "Run No#"); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryModifyIntersection.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryModifyIntersection.cs index 5b067039d..62a3fbb6a 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryModifyIntersection.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryModifyIntersection.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -113,4 +116,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) //AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, "Run No#"); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryModifyUnion.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryModifyUnion.cs index 871685105..ab4ba4133 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryModifyUnion.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryModifyUnion.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -114,4 +117,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) //AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, "Run No#"); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryPolycurveLoop2D.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryPolycurveLoop2D.cs index 17ffc269f..09fa6f182 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryPolycurveLoop2D.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryPolycurveLoop2D.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Parameters; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; @@ -199,4 +202,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, true); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometrySAMGeometry.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometrySAMGeometry.cs index 8c558b20a..30991baba 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometrySAMGeometry.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometrySAMGeometry.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -75,4 +78,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, @object); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometrySnapByDistance.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometrySnapByDistance.cs index cc364e5a8..d12fbba5c 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometrySnapByDistance.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometrySnapByDistance.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -130,4 +133,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(1, true); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometrySnapByPoints.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometrySnapByPoints.cs index 55bc1b5b7..28bb643f0 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometrySnapByPoints.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometrySnapByPoints.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -158,4 +161,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) //AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Cannot split segments"); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryTriangulate.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryTriangulate.cs index 1dd2ddb38..ccfb29649 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryTriangulate.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/GeometryTriangulate.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -127,9 +130,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } List triangle3Ds = new List(); - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { - if(face3D == null) + if (face3D == null) { continue; } @@ -155,4 +158,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/NTSSAMGeometry2D.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/NTSSAMGeometry2D.cs index c25ee9c9e..07eb3c0e5 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/NTSSAMGeometry2D.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/NTSSAMGeometry2D.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; using SAM.Geometry.Planar; @@ -66,7 +69,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } List geometry2Ds = Planar.Convert.ToSAM(lines_NTS); - if(geometry2Ds == null) + if (geometry2Ds == null) dataAccess.SetDataList(0, null); else dataAccess.SetDataList(0, geometry2Ds.ConvertAll(x => new GooSAMGeometry(x))); @@ -74,4 +77,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometry2DSAMGeometry.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometry2DSAMGeometry.cs index 451be0c1c..e55884658 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometry2DSAMGeometry.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometry2DSAMGeometry.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; using SAM.Geometry.Spatial; @@ -110,4 +113,4 @@ protected override System.Drawing.Bitmap Icon } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometry2DToNTS.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometry2DToNTS.cs index ec32cafb1..75616ebd1 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometry2DToNTS.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometry2DToNTS.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -108,7 +111,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) { foreach (ISAMGeometry3D sAMGeometry3D in sAMGeometry3Ds) { - if(sAMGeometry3D is Face3D) + if (sAMGeometry3D is Face3D) { sAMGeometry2Ds.Add(Spatial.Query.Convert(Plane.WorldXY, (Face3D)sAMGeometry3D)); } @@ -145,4 +148,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) //AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Cannot split segments"); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryCreateShellsByElevations.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryCreateShellsByElevations.cs index 7eb38d658..652189f9e 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryCreateShellsByElevations.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryCreateShellsByElevations.cs @@ -1,10 +1,13 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; +using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; -using Grasshopper.Kernel.Types; using System.Linq; namespace SAM.Geometry.Grasshopper @@ -135,10 +138,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) tolerance = tolerance_Temp; } - if(elevations == null || elevations.Count == 0) + if (elevations == null || elevations.Count == 0) { List face3Ds_Horizontal = face3Ds.FindAll(x => Spatial.Query.Horizontal(x, tolerance)); - + Dictionary> elevationDictionary = face3Ds_Horizontal.ElevationDictionary(tolerance); elevations = elevationDictionary.Keys.ToList(); } @@ -149,4 +152,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, shells?.ConvertAll(x => new GooSAMGeometry(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryCreateShellsByOffset.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryCreateShellsByOffset.cs index 91f4cb3c3..81c52d741 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryCreateShellsByOffset.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryCreateShellsByOffset.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -133,4 +136,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, shells); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryCreateShellsByTopAndBottom.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryCreateShellsByTopAndBottom.cs index a91f1aff7..e74628f3a 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryCreateShellsByTopAndBottom.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryCreateShellsByTopAndBottom.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -238,4 +241,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, shells?.ConvertAll(x => new GooSAMGeometry(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryCutShell.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryCutShell.cs index 66f9c2eeb..c3570f4b8 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryCutShell.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryCutShell.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -135,16 +138,16 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) plane = Spatial.Create.Plane(elevation_Temp); } } - else if(@object is global::Rhino.Geometry.Plane) + else if (@object is global::Rhino.Geometry.Plane) { plane = Rhino.Convert.ToSAM(((global::Rhino.Geometry.Plane)@object)); } - else if(@object is Plane) + else if (@object is Plane) { plane = ((Plane)@object); } - if(plane == null) + if (plane == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -162,10 +165,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) shells = shells.ConvertAll(x => new Shell(x)); List shells_Result = new List(); - foreach(Shell shell in shells) + foreach (Shell shell in shells) { List shells_Result_Temp = shell.Cut(plane); - if(shells_Result_Temp == null || shells_Result_Temp.Count == 0) + if (shells_Result_Temp == null || shells_Result_Temp.Count == 0) { continue; } @@ -178,4 +181,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, shells_Result); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryFace3DSpacing.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryFace3DSpacing.cs index a450ba45e..69ca0a957 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryFace3DSpacing.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryFace3DSpacing.cs @@ -1,14 +1,17 @@ -using Grasshopper; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper; using Grasshopper.Kernel; using Grasshopper.Kernel.Data; -using SAM.Geometry.Grasshopper.Properties; +using Grasshopper.Kernel.Types; using SAM.Core; using SAM.Core.Grasshopper; +using SAM.Geometry.Grasshopper.Properties; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; using System.Linq; -using Grasshopper.Kernel.Types; namespace SAM.Analytical.Grasshopper { @@ -27,7 +30,7 @@ public class SAMGeometryFace3DSpacing : GH_SAMVariableOutputParameterComponent /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; /// /// Initializes a new instance of the SAM_point3D class. @@ -98,15 +101,15 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } List face3Ds = new List(); - foreach(GH_ObjectWrapper objectWrapper in objectWrappers) + foreach (GH_ObjectWrapper objectWrapper in objectWrappers) { - if(Geometry.Grasshopper.Query.TryGetSAMGeometries(objectWrapper, out List face3Ds_Temp)) + if (Geometry.Grasshopper.Query.TryGetSAMGeometries(objectWrapper, out List face3Ds_Temp)) { face3Ds.AddRange(face3Ds_Temp); } } - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -129,13 +132,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) Dictionary> dictionary = Geometry.Spatial.Query.SpacingDictionary(face3Ds, max, min); index = Params.IndexOfOutputParam("points"); - if(index != -1) + if (index != -1) { dataAccess.SetDataList(index, dictionary?.Keys.ToList().ConvertAll(x => Geometry.Rhino.Convert.ToRhino(x))); } index = Params.IndexOfOutputParam("face3Ds"); - if(index != -1) + if (index != -1) { DataTree dataTree_Objects = new DataTree(); @@ -151,4 +154,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryFill.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryFill.cs index 1b2eedb42..0c43f654c 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryFill.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryFill.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -99,7 +102,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List face3Ds = new List(); foreach (GH_ObjectWrapper objectWrapper_Temp in objectWrappers) { - if(Query.TryGetSAMGeometries(objectWrapper_Temp, out face3Ds_Temp)) + if (Query.TryGetSAMGeometries(objectWrapper_Temp, out face3Ds_Temp)) { face3Ds.AddRange(face3Ds_Temp); } @@ -118,4 +121,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(1, true); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryFlipNormal.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryFlipNormal.cs index e23d37a35..fc8db4901 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryFlipNormal.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryFlipNormal.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; using System; @@ -76,4 +79,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, face3D); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryGeometry.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryGeometry.cs index c5994c184..ade105b96 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryGeometry.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryGeometry.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; using System; @@ -74,4 +77,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, @object); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryIsClosed.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryIsClosed.cs index bbd950193..18ebbb1c8 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryIsClosed.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryIsClosed.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -111,4 +114,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, shells?.FirstOrDefault()?.IsClosed(tolerance)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryMargeOverlaps.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryMargeOverlaps.cs index 3cda19826..e77614682 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryMargeOverlaps.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryMargeOverlaps.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -72,7 +75,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List face3Ds = new List(); foreach (GH_ObjectWrapper objectWrapper in objectWrappers) { - if(Query.TryGetSAMGeometries(objectWrapper, out List face3Ds_Temp)) + if (Query.TryGetSAMGeometries(objectWrapper, out List face3Ds_Temp)) { face3Ds.AddRange(face3Ds_Temp); } @@ -100,4 +103,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(1, true); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryPlaneIntersection.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryPlaneIntersection.cs index 07e9250ed..afc44fc26 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryPlaneIntersection.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryPlaneIntersection.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -128,4 +131,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(1, true); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometrySAMGeometry2D.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometrySAMGeometry2D.cs index 7bffbd3aa..881a32b8c 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometrySAMGeometry2D.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometrySAMGeometry2D.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Parameters; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; @@ -83,11 +86,11 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) foreach (ISAMGeometry3D sAMGeometry3D in sAMGeometry3Ds) { - if(sAMGeometry3D == null) + if (sAMGeometry3D == null) { continue; } - + if (sAMGeometry3D is Shell) { ((Shell)sAMGeometry3D).Face3Ds?.ForEach(x => planars.Add(x)); @@ -97,8 +100,8 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) ((Extrusion)sAMGeometry3D).Face3Ds()?.ForEach(x => planars.Add(x)); } else if (sAMGeometry3D is IPlanar3D) - { - if(sAMGeometry3D is IBoundable3D) + { + if (sAMGeometry3D is IBoundable3D) { planars.Add((IPlanar3D)sAMGeometry3D); } @@ -109,7 +112,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(planars.Count == 0 && notPlanars.Count == 0) + if (planars.Count == 0 && notPlanars.Count == 0) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -124,7 +127,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) Plane plane = null; - if(!ownPlane) + if (!ownPlane) { if (!dataAccess.GetData(2, ref objectWrapper) || objectWrapper.Value == null) { @@ -142,32 +145,32 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) plane = Convert.ToSAM(gHPlane); } - if(plane == null) + if (plane == null) { plane = Plane.WorldXY; } List sAMGeometry2Ds = new List(); - foreach(ISAMGeometry3D notPlanar in notPlanars) + foreach (ISAMGeometry3D notPlanar in notPlanars) { - if(notPlanar is Point3D) + if (notPlanar is Point3D) { sAMGeometry2Ds.Add(plane.Convert((Point3D)notPlanar)); } - else if(notPlanar is Segment3D) + else if (notPlanar is Segment3D) { sAMGeometry2Ds.Add(plane.Convert((Segment3D)notPlanar)); } - else if(notPlanar != null) + else if (notPlanar != null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, string.Format("Could not convert {0} geometry.", notPlanar.GetType().FullName)); } } - foreach(IBoundable3D boundable3D in planars) + foreach (IBoundable3D boundable3D in planars) { Plane plane_Boundable3D = plane; - if(ownPlane && boundable3D is IPlanar3D) + if (ownPlane && boundable3D is IPlanar3D) { plane_Boundable3D = (boundable3D as IPlanar3D).GetPlane(); } @@ -191,4 +194,4 @@ protected override System.Drawing.Bitmap Icon } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometrySectionByFace3D.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometrySectionByFace3D.cs index 169b5b4e5..dc95aa915 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometrySectionByFace3D.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometrySectionByFace3D.cs @@ -1,10 +1,13 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; +using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; -using Grasshopper.Kernel.Types; using System.Linq; namespace SAM.Geometry.Grasshopper @@ -54,7 +57,7 @@ protected override GH_SAMParam[] Inputs global::Grasshopper.Kernel.Parameters.Param_Number number = null; - number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "offset_", NickName = "offset_", Description = "Offset", Access = GH_ParamAccess.item}; + number = new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "offset_", NickName = "offset_", Description = "Offset", Access = GH_ParamAccess.item }; number.SetPersistentData(0.1); result.Add(new GH_SAMParam(number, ParamVisibility.Voluntary)); @@ -128,10 +131,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } List sAMGeometries = new List(); - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { BoundingBox3D boundingBox3D = face3D?.GetBoundingBox(); - if(boundingBox3D == null) + if (boundingBox3D == null) { continue; } @@ -139,7 +142,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) Plane plane = Spatial.Create.Plane(boundingBox3D.Min.Z + offset); PlanarIntersectionResult planarIntersectionResult = Spatial.Create.PlanarIntersectionResult(plane, face3D, Core.Tolerance.Angle, tolerance); - if(planarIntersectionResult == null) + if (planarIntersectionResult == null) { continue; } @@ -159,10 +162,10 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List segmentable3Ds = sAMGeometries.ConvertAll(x => x as ISegmentable3D); segmentable3Ds.RemoveAll(x => x == null); double length = segmentable3Ds.ConvertAll(x => x.GetLength()).Sum(); - + dataAccess.SetData(index, length); } - + } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometrySectionByShell.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometrySectionByShell.cs index 789e30585..835b0d997 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometrySectionByShell.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometrySectionByShell.cs @@ -1,10 +1,13 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; +using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; -using Grasshopper.Kernel.Types; namespace SAM.Geometry.Grasshopper { @@ -109,7 +112,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } - if(plane == null) + if (plane == null) { } @@ -117,24 +120,24 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List face3Ds = new List(); foreach (Shell shell in shells) { - if(shell == null) + if (shell == null) { continue; } Plane plane_Temp = plane; - if(plane_Temp == null) + if (plane_Temp == null) { plane_Temp = new Plane(shell.GetBoundingBox().GetCentroid(), Vector3D.WorldZ); } - if(plane_Temp == null) + if (plane_Temp == null) { continue; } List face3Ds_Section = shell.Section(plane_Temp); - if(face3Ds_Section == null || face3Ds_Section.Count == 0) + if (face3Ds_Section == null || face3Ds_Section.Count == 0) { continue; } @@ -145,7 +148,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (index != -1) { dataAccess.SetDataList(index, face3Ds?.ConvertAll(x => new GooSAMGeometry(x))); - } + } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometrySegment2DIntersection.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometrySegment2DIntersection.cs index d885b252a..993157283 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometrySegment2DIntersection.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometrySegment2DIntersection.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -100,4 +103,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Cannot split segments"); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellContains.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellContains.cs index 477d97b6e..8cf0eed28 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellContains.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellContains.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -160,7 +163,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } bool contains = false; - if(shell.Inside(point3D, silverSpacing, tolerance)) + if (shell.Inside(point3D, silverSpacing, tolerance)) { contains = true; if (!allowOnBoundary && shell.On(point3D, tolerance)) @@ -172,4 +175,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(index, contains); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellDifference.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellDifference.cs index 56f6cfad0..3856e984c 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellDifference.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellDifference.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -130,4 +133,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, shells); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellIntersection.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellIntersection.cs index 16b385786..cc875894c 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellIntersection.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellIntersection.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -130,4 +133,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, shells); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellNakedSegment3Ds.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellNakedSegment3Ds.cs index 6ea177ef9..2590fc85c 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellNakedSegment3Ds.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellNakedSegment3Ds.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -117,4 +120,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, shell.NakedSegment3Ds(int.MaxValue, tolerance)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellsSplit.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellsSplit.cs index 7ffe0bd23..f9afdb5d4 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellsSplit.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellsSplit.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -121,4 +124,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, shells); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellsSplitByFace3Ds.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellsSplitByFace3Ds.cs index 554720ee5..1e8efc127 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellsSplitByFace3Ds.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellsSplitByFace3Ds.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -148,4 +151,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, shells); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellsSplitFace3Ds.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellsSplitFace3Ds.cs index d859495e2..9ef3a799c 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellsSplitFace3Ds.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellsSplitFace3Ds.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -122,4 +125,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, shells); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellsUnion.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellsUnion.cs index 872af70d0..406f629da 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellsUnion.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryShellsUnion.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -121,4 +124,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(index, shells); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometrySplit.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometrySplit.cs index dadb9907a..26c763149 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometrySplit.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometrySplit.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -148,4 +151,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(1, true); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometrySplitCoplanarFace3Ds.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometrySplitCoplanarFace3Ds.cs index df07cf77d..0bdd89e67 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometrySplitCoplanarFace3Ds.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometrySplitCoplanarFace3Ds.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; @@ -111,9 +114,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } List shells = new List(); - foreach(GH_ObjectWrapper objectWrapper in objectWrappers) + foreach (GH_ObjectWrapper objectWrapper in objectWrappers) { - if(Query.TryGetSAMGeometries(objectWrapper, out List shells_Temp) && shells_Temp != null) + if (Query.TryGetSAMGeometries(objectWrapper, out List shells_Temp) && shells_Temp != null) { shells.AddRange(shells_Temp); } @@ -121,7 +124,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) double tolerance_Angle = Core.Tolerance.Angle; index = Params.IndexOfInputParam("angleTolerance_"); - if(index != -1) + if (index != -1) { dataAccess.GetData(index, ref tolerance_Angle); } @@ -141,8 +144,8 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (index != -1) dataAccess.SetDataList(index, shells?.ConvertAll(x => new GooSAMGeometry(x))); - if(index_Updated != -1) + if (index_Updated != -1) dataAccess.SetData(index_Updated, result); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryThinnessRatio.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryThinnessRatio.cs index 1cd80b5b6..a0b7c4a53 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryThinnessRatio.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryThinnessRatio.cs @@ -1,10 +1,13 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; +using Grasshopper.Kernel.Types; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; -using Grasshopper.Kernel.Types; namespace SAM.Geometry.Grasshopper { @@ -79,7 +82,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) index = Params.IndexOfInputParam("_face3D"); GH_ObjectWrapper objectWrapper = null; - if (index == -1 || !dataAccess.GetData(index, ref objectWrapper) || objectWrapper == null ) + if (index == -1 || !dataAccess.GetData(index, ref objectWrapper) || objectWrapper == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -101,7 +104,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (index != -1) { dataAccess.SetData(index, face3Ds[0].ThinnessRatio()); - } + } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryTransform.cs b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryTransform.cs index f293058bb..22cf306db 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryTransform.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Component/SAMGeometryTransform.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper; using SAM.Geometry.Grasshopper.Properties; using System; @@ -90,4 +93,4 @@ protected override System.Drawing.Bitmap Icon } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Brep.cs b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Brep.cs index 2b4855142..07b395cc5 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Brep.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Brep.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; using Rhino.Geometry; namespace SAM.Geometry.Grasshopper @@ -18,8 +21,8 @@ public static GH_Brep ToGrasshopper(this Spatial.Shell shell, double tolerance = public static GH_Brep ToGrasshopper_Brep(this Spatial.Face3D face3D, double tolerance = Core.Tolerance.MacroDistance) { - Brep brep =Rhino.Convert.ToRhino_Brep(face3D, tolerance); - if(brep == null) + Brep brep = Rhino.Convert.ToRhino_Brep(face3D, tolerance); + if (brep == null) { return null; } @@ -27,4 +30,4 @@ public static GH_Brep ToGrasshopper_Brep(this Spatial.Face3D face3D, double tole return new GH_Brep(brep); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Curve.cs b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Curve.cs index d5c7ffc8a..569965d8f 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Curve.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Curve.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; namespace SAM.Geometry.Grasshopper { @@ -24,4 +27,4 @@ public static GH_Curve ToGrasshopper(this Spatial.Polycurve3D polycurve3D) return new GH_Curve(global::Rhino.Geometry.Curve.JoinCurves(polycurve3D.GetCurves().ConvertAll(x => Rhino.Convert.ToRhino(x)), Core.Tolerance.Distance, false)[0]); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Line.cs b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Line.cs index 61c801b79..cf60b9f93 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Line.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Line.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; namespace SAM.Geometry.Grasshopper { @@ -14,4 +17,4 @@ public static GH_Line ToGrasshopper(this Planar.Segment2D segment2D) return new GH_Line(Rhino.Convert.ToRhino(segment2D)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Mesh.cs b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Mesh.cs index b676c3138..bc538965f 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Mesh.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Mesh.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; namespace SAM.Geometry.Grasshopper { @@ -9,4 +12,4 @@ public static GH_Mesh ToGrasshopper(this Spatial.Mesh3D mesh3D) return new GH_Mesh(Rhino.Convert.ToRhino(mesh3D)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Plane.cs b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Plane.cs index 36d9aa15d..845ab3cc9 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Plane.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Plane.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; namespace SAM.Geometry.Grasshopper { @@ -9,4 +12,4 @@ public static GH_Plane ToGrasshopper(this Spatial.Plane plane) return new GH_Plane(Rhino.Convert.ToRhino(plane)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Point.cs b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Point.cs index ab230d568..5e19fcc52 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Point.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Point.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; namespace SAM.Geometry.Grasshopper { @@ -14,4 +17,4 @@ public static GH_Point ToGrasshopper(this Planar.Point2D point2D) return new GH_Point(Rhino.Convert.ToRhino(point2D)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Rectangle.cs b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Rectangle.cs index 6c9b038f1..46d1a7386 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Rectangle.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Rectangle.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; namespace SAM.Geometry.Grasshopper { @@ -6,7 +9,7 @@ public static partial class Convert { public static GH_Rectangle ToGrasshopper(this Spatial.Rectangle3D rectangle3D) { - if(rectangle3D == null) + if (rectangle3D == null) { return null; } @@ -14,4 +17,4 @@ public static GH_Rectangle ToGrasshopper(this Spatial.Rectangle3D rectangle3D) return new GH_Rectangle(Rhino.Convert.ToRhino(rectangle3D)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Surface.cs b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Surface.cs index caa7f5bde..a7b29a17c 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Surface.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Surface.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; using SAM.Geometry.Spatial; namespace SAM.Geometry.Grasshopper @@ -24,4 +27,4 @@ public static GH_Surface ToGrasshopper(this Face3D face3D, double tolerance = Co return new GH_Surface(Rhino.Convert.ToRhino_Brep(face3D, tolerance)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Vector.cs b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Vector.cs index 729185a6f..96f58355d 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Vector.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/GH_Vector.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; namespace SAM.Geometry.Grasshopper { @@ -14,4 +17,4 @@ public static GH_Vector ToGrasshopper(this Planar.Vector2D vector2D) return new GH_Vector(Rhino.Convert.ToRhino(vector2D)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/IGH_Goo.cs b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/IGH_Goo.cs index 572daa2be..adec2460b 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/IGH_Goo.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToGrasshopper/IGH_Goo.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; using SAM.Geometry.Spatial; @@ -59,4 +62,4 @@ public static IGH_Goo ToGrasshopper(this ISAMGeometry geometry) return (geometry as dynamic).ToGrasshopper(); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Circle3D.cs b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Circle3D.cs index 3a94f8931..99f7c0039 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Circle3D.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Circle3D.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; namespace SAM.Geometry.Grasshopper { @@ -9,4 +12,4 @@ public static Spatial.Circle3D ToSAM(this GH_Circle circle) return Rhino.Convert.ToSAM(circle.Value); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Extrusion.cs b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Extrusion.cs index f303dc376..5ec2fe745 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Extrusion.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Extrusion.cs @@ -1,13 +1,16 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; using SAM.Geometry.Spatial; namespace SAM.Geometry.Grasshopper { public static partial class Convert - { + { public static Shell ToSAM_Shell(this GH_Extrusion ghExtrusion) { return Rhino.Convert.ToSAM_Shell(ghExtrusion?.Value); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/IGeometry3D.cs b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/IGeometry3D.cs index c63687f86..af81d650d 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/IGeometry3D.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/IGeometry3D.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; using Rhino.Geometry; namespace SAM.Geometry.Grasshopper @@ -10,7 +13,7 @@ public static Spatial.ISAMGeometry3D ToSAM(this GH_Curve curve, bool simplify = if (curve.Value is LineCurve) return Rhino.Convert.ToSAM(((LineCurve)curve.Value).Line); else - return Rhino.Convert.ToSAM( curve.Value, simplify); + return Rhino.Convert.ToSAM(curve.Value, simplify); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/IGeometry3Ds.cs b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/IGeometry3Ds.cs index 2493b006c..b2c583742 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/IGeometry3Ds.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/IGeometry3Ds.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; using SAM.Geometry.Spatial; using System.Collections; using System.Collections.Generic; @@ -52,4 +55,4 @@ public static List ToSAM(this GH_Surface surface, bool simplify return Rhino.Convert.ToSAM(surface.Value, simplify); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Mesh3D.cs b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Mesh3D.cs index 3d9599d2b..0f11b91ca 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Mesh3D.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Mesh3D.cs @@ -1,13 +1,16 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; using SAM.Geometry.Spatial; namespace SAM.Geometry.Grasshopper { public static partial class Convert - { + { public static Mesh3D ToSAM(this GH_Mesh ghMesh) { return Rhino.Convert.ToSAM(ghMesh?.Value); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Plane.cs b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Plane.cs index 3163c26d0..b00b6422c 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Plane.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Plane.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; namespace SAM.Geometry.Grasshopper { @@ -9,4 +12,4 @@ public static Spatial.Plane ToSAM(this GH_Plane plane) return Rhino.Convert.ToSAM(plane.Value); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Point3D.cs b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Point3D.cs index a023ad3b6..f22df0d56 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Point3D.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Point3D.cs @@ -1,4 +1,7 @@ -using GH_IO.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using GH_IO.Types; using Grasshopper.Kernel.Types; namespace SAM.Geometry.Grasshopper @@ -15,4 +18,4 @@ public static Spatial.Point3D ToSAM(this GH_Point3D point3D) return new Spatial.Point3D(point3D.x, point3D.y, point3D.z); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Rectangle3D.cs b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Rectangle3D.cs index a4f8b35b9..23c404c1f 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Rectangle3D.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Rectangle3D.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; namespace SAM.Geometry.Grasshopper { @@ -9,4 +12,4 @@ public static Spatial.Rectangle3D ToSAM(this GH_Rectangle rectangle) return Rhino.Convert.ToSAM(rectangle.Value); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Segment3D.cs b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Segment3D.cs index 4a435fc84..abbe1bc39 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Segment3D.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Segment3D.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; namespace SAM.Geometry.Grasshopper { @@ -9,4 +12,4 @@ public static Spatial.Segment3D ToSAM(this GH_Line line) return Rhino.Convert.ToSAM(line.Value); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Surface.cs b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Surface.cs index 7b2a60f3c..852291c68 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Surface.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Surface.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; using System.Collections.Generic; namespace SAM.Geometry.Grasshopper @@ -10,4 +13,4 @@ public static partial class Convert return Rhino.Convert.ToSAM(brep.Value, simplify); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Transform3D.cs b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Transform3D.cs index e8e9330d1..a7d61b035 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Transform3D.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Transform3D.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; namespace SAM.Geometry.Grasshopper { @@ -14,4 +17,4 @@ public static Spatial.Transform3D ToSAM(this GH_Transform transform) return Rhino.Convert.ToSAM(transform.Value); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Vector3D.cs b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Vector3D.cs index d35927680..5f3693afe 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Vector3D.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Convert/ToSAM/Vector3D.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; namespace SAM.Geometry.Grasshopper { @@ -10,4 +13,4 @@ public static Spatial.Vector3D ToSAM(this GH_Vector vector) return Rhino.Convert.ToSAM(vector.Value); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Create/Shell.cs b/Grasshopper/SAM.Geometry.Grasshopper/Create/Shell.cs index d88cbe7fe..80b36035c 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Create/Shell.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Create/Shell.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; using SAM.Geometry.Spatial; namespace SAM.Geometry.Grasshopper @@ -13,4 +16,4 @@ public static Shell Shell(this GH_Mesh mesh, bool simplify = true, double tolera return Rhino.Create.Shell(mesh.Value, simplify, tolerance_Angle, tolerance_Distance); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Enum/MeshType.cs b/Grasshopper/SAM.Geometry.Grasshopper/Enum/MeshType.cs index 2b5392965..80c97adc7 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Enum/MeshType.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Enum/MeshType.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Geometry.Grasshopper { @@ -9,4 +12,4 @@ public enum MeshType [Description("Triangle")] Triangle, [Description("Quad")] Quad } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Kernel/AssemblyInfo.cs b/Grasshopper/SAM.Geometry.Grasshopper/Kernel/AssemblyInfo.cs index 55ad7a565..3f778dfe3 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Kernel/AssemblyInfo.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Kernel/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using System; using System.Drawing; @@ -67,4 +70,4 @@ public override string AuthorContact } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Modify/Convert.cs b/Grasshopper/SAM.Geometry.Grasshopper/Modify/Convert.cs index 5ff09d849..c17ee7416 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Modify/Convert.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Modify/Convert.cs @@ -1,4 +1,7 @@ -using Rhino.Geometry; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino.Geometry; namespace SAM.Geometry.Grasshopper { @@ -18,8 +21,8 @@ public static bool Convert(this Mesh mesh, MeshType meshType) mesh.Faces.ConvertQuadsToTriangles(); break; } - + return true; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Modify/DrawViewportMeshes.cs b/Grasshopper/SAM.Geometry.Grasshopper/Modify/DrawViewportMeshes.cs index 9f06e17c3..f14820f5b 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Modify/DrawViewportMeshes.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Modify/DrawViewportMeshes.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Rhino.Geometry; using SAM.Geometry.Spatial; diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Modify/DrawViewportWires.cs b/Grasshopper/SAM.Geometry.Grasshopper/Modify/DrawViewportWires.cs index d5776fc3e..3ec508114 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Modify/DrawViewportWires.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Modify/DrawViewportWires.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Rhino.Geometry; using SAM.Geometry.Object; using SAM.Geometry.Planar; @@ -39,7 +42,7 @@ public static void DrawViewportWires(this ISAMGeometry sAMGeomery, GH_PreviewWir else if (sAMGeomery is Face2D) { Face3D face3D = Spatial.Query.Convert(Spatial.Plane.WorldXY, (Face2D)sAMGeomery); - if(face3D != null) + if (face3D != null) { curve3Ds = new List(); @@ -95,7 +98,7 @@ public static void DrawViewportWires(this ISAMGeometry sAMGeomery, GH_PreviewWir if (sAMGeomery is Mesh3D) { Mesh mesh = Rhino.Convert.ToRhino(((Mesh3D)sAMGeomery)); - if(mesh != null) + if (mesh != null) { previewWireArgs.Pipeline.DrawMeshWires(mesh, color); } @@ -103,9 +106,9 @@ public static void DrawViewportWires(this ISAMGeometry sAMGeomery, GH_PreviewWir return; } - if(sAMGeomery is SAMGeometry2DGroup) + if (sAMGeomery is SAMGeometry2DGroup) { - foreach(ISAMGeometry sAMGeometry in (SAMGeometry2DGroup)sAMGeomery) + foreach (ISAMGeometry sAMGeometry in (SAMGeometry2DGroup)sAMGeomery) { DrawViewportWires(sAMGeometry, previewWireArgs, color); } @@ -132,12 +135,12 @@ public static void DrawViewportWires(this ISAMGeometryObject sAMGeometryObject, } List sAMGeometries = Object.Convert.ToSAM_ISAMGeometry(sAMGeometryObject); - if(sAMGeometries == null) + if (sAMGeometries == null) { return; } - foreach(ISAMGeometry sAMGeometry in sAMGeometries) + foreach (ISAMGeometry sAMGeometry in sAMGeometries) { DrawViewportWires(sAMGeometry, previewWireArgs, color); } @@ -158,15 +161,15 @@ public static void DrawViewportWires(this Face3D face3D, GH_PreviewWireArgs prev } IClosedPlanar3D externalEdge3D = face3D.GetExternalEdge3D(); - if(externalEdge3D != null) + if (externalEdge3D != null) { DrawViewportWires(externalEdge3D, previewWireArgs, color_ExternalEdges); } List internalEdge3Ds = face3D.GetInternalEdge3Ds(); - if(internalEdge3Ds != null && internalEdge3Ds.Count != 0) + if (internalEdge3Ds != null && internalEdge3Ds.Count != 0) { - foreach(IClosedPlanar3D internalEdge3D in internalEdge3Ds) + foreach (IClosedPlanar3D internalEdge3D in internalEdge3Ds) { DrawViewportWires(internalEdge3D, previewWireArgs, color_InternalEdges); } @@ -174,4 +177,4 @@ public static void DrawViewportWires(this Face3D face3D, GH_PreviewWireArgs prev } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Modify/Reduce.cs b/Grasshopper/SAM.Geometry.Grasshopper/Modify/Reduce.cs index 8c124a945..67896231e 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Modify/Reduce.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Modify/Reduce.cs @@ -1,4 +1,7 @@ -using Rhino.Geometry; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino.Geometry; namespace SAM.Geometry.Grasshopper { @@ -20,4 +23,4 @@ public static bool Reduce(this Mesh mesh, bool allowDistortion, int desiredPolyg return true; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Properties/AssemblyInfo.cs b/Grasshopper/SAM.Geometry.Grasshopper/Properties/AssemblyInfo.cs index ae455c4f5..744cbd829 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Properties/AssemblyInfo.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -/* +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +/* * This file is part of the Sustaiable Analytical Model (SAM) * Copyright (c) 2020, the respective contributors. All rights reserved. * diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Properties/Resources.Designer.cs b/Grasshopper/SAM.Geometry.Grasshopper/Properties/Resources.Designer.cs index 4aa466ff0..0e96ae136 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Properties/Resources.Designer.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Properties/Resources.Designer.cs @@ -1,4 +1,7 @@ -//------------------------------------------------------------------------------ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.42000 diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Query/Close.cs b/Grasshopper/SAM.Geometry.Grasshopper/Query/Close.cs index 82d2f6b58..1e112487d 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Query/Close.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Query/Close.cs @@ -1,4 +1,7 @@ -using Rhino.Geometry; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino.Geometry; namespace SAM.Geometry.Grasshopper { @@ -28,7 +31,7 @@ public static bool TryClose(this Mesh mesh_Input, out Mesh mesh_Output, MeshType return false; bool result = true; - foreach(Polyline polyline in polylines) + foreach (Polyline polyline in polylines) { Mesh mesh_Temp = Mesh.CreateFromClosedPolyline(polyline); if (mesh_Temp == null) @@ -53,4 +56,4 @@ public static bool TryClose(this Mesh mesh_Input, out Mesh mesh_Output, MeshType return result; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Query/TryGetSAMGeometries.cs b/Grasshopper/SAM.Geometry.Grasshopper/Query/TryGetSAMGeometries.cs index 38eaebc28..f549d9cdc 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Query/TryGetSAMGeometries.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Query/TryGetSAMGeometries.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; using SAM.Geometry.Object.Spatial; using SAM.Geometry.Spatial; using System.Collections; @@ -113,7 +116,7 @@ public static bool TryGetSAMGeometries(this GH_ObjectWrapper objectWrapper, o } else if (@object is Polycurve3D) { - if(Polycurve3D.TryGetPolyline3D((Polycurve3D)@object, out Polyline3D polyline3D)) + if (Polycurve3D.TryGetPolyline3D((Polycurve3D)@object, out Polyline3D polyline3D)) { sAMGeometries = new List() { (T)(object)Spatial.Create.Face3D(polyline3D?.ToPolygon3D()) }; return true; @@ -122,7 +125,7 @@ public static bool TryGetSAMGeometries(this GH_ObjectWrapper objectWrapper, o //sAMGeometries = ((Spatial.Mesh3D)@object).GetTriangles()?.ConvertAll(x => (T)(object)(new Spatial.Face3D(x))); //return true; } - else if(@object is Polyline3D) + else if (@object is Polyline3D) { Polyline3D polyline3D = (Polyline3D)@object; if (polyline3D.IsClosed()) @@ -134,7 +137,7 @@ public static bool TryGetSAMGeometries(this GH_ObjectWrapper objectWrapper, o } } - else if(typeof(T) == typeof(Point3D)) + else if (typeof(T) == typeof(Point3D)) { if (@object is Point3D) { @@ -150,7 +153,7 @@ public static bool TryGetSAMGeometries(this GH_ObjectWrapper objectWrapper, o return true; } } - else if(typeof(T) == typeof(ISegmentable3D)) + else if (typeof(T) == typeof(ISegmentable3D)) { if (@object is Polycurve3D) { @@ -227,7 +230,7 @@ public static bool TryGetSAMGeometries(this GH_ObjectWrapper objectWrapper, o return true; } - if(@object is Polycurve3D && typeof(T) == typeof(ISegmentable3D)) + if (@object is Polycurve3D && typeof(T) == typeof(ISegmentable3D)) { if (Polycurve3D.TryGetPolyline3D((Polycurve3D)@object, out Polyline3D polyline3D) && polyline3D != null) { @@ -244,20 +247,20 @@ public static bool TryGetSAMGeometries(this IEnumerable obj { sAMGeometries = null; - if(objectWrappers == null) + if (objectWrappers == null) { return false; } sAMGeometries = new List(); - foreach(GH_ObjectWrapper objectWrapper in objectWrappers) + foreach (GH_ObjectWrapper objectWrapper in objectWrappers) { - if(!TryGetSAMGeometries(objectWrapper, out List sAMGeometries_Temp) || sAMGeometries_Temp == null || sAMGeometries_Temp.Count == 0) + if (!TryGetSAMGeometries(objectWrapper, out List sAMGeometries_Temp) || sAMGeometries_Temp == null || sAMGeometries_Temp.Count == 0) { continue; } - foreach(T sAMGeometry in sAMGeometries_Temp) + foreach (T sAMGeometry in sAMGeometries_Temp) { sAMGeometries.Add(sAMGeometry); } @@ -266,4 +269,4 @@ public static bool TryGetSAMGeometries(this IEnumerable obj return sAMGeometries != null && sAMGeometries.Count > 0; } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Geometry.Grasshopper/Template/TemplateComponent.cs b/Grasshopper/SAM.Geometry.Grasshopper/Template/TemplateComponent.cs index aaba57de9..f7c27e6b6 100644 --- a/Grasshopper/SAM.Geometry.Grasshopper/Template/TemplateComponent.cs +++ b/Grasshopper/SAM.Geometry.Grasshopper/Template/TemplateComponent.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Grasshopper +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Grasshopper { //public class TemplateCompoment : GH_Component //{ @@ -56,4 +59,4 @@ // get { return new Guid("060a9d71-9c97-4502-9e30-e9a7d51d21db"); } // } //} -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Math.Grasshopper/Classes/GooMatrix.cs b/Grasshopper/SAM.Math.Grasshopper/Classes/GooMatrix.cs index 730f6d222..5b22da8b4 100644 --- a/Grasshopper/SAM.Math.Grasshopper/Classes/GooMatrix.cs +++ b/Grasshopper/SAM.Math.Grasshopper/Classes/GooMatrix.cs @@ -1,4 +1,7 @@ -using GH_IO.Serialization; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using GH_IO.Serialization; using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using Newtonsoft.Json.Linq; @@ -81,7 +84,7 @@ public override string ToString() { if (Value == null) return typeof(Matrix).Name; - + return Value?.GetType().Name; } @@ -158,7 +161,7 @@ public class GooMatrixParam : GH_PersistentParam { public override Guid ComponentGuid => new Guid("79fbe851-272a-4c4e-8d0a-6033eed12102"); - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -193,4 +196,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Math.Grasshopper/Convert/ToGrasshopper/GH_Matrix.cs b/Grasshopper/SAM.Math.Grasshopper/Convert/ToGrasshopper/GH_Matrix.cs index ce8702552..a4db1ec77 100644 --- a/Grasshopper/SAM.Math.Grasshopper/Convert/ToGrasshopper/GH_Matrix.cs +++ b/Grasshopper/SAM.Math.Grasshopper/Convert/ToGrasshopper/GH_Matrix.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; namespace SAM.Math.Grasshopper { @@ -9,4 +12,4 @@ public static GH_Matrix ToGrasshopper(this Matrix matrix) return new GH_Matrix(Rhino.Convert.ToRhino(matrix)); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Math.Grasshopper/Convert/ToSAM/Matrix.cs b/Grasshopper/SAM.Math.Grasshopper/Convert/ToSAM/Matrix.cs index e4ff543e7..dbc48d50f 100644 --- a/Grasshopper/SAM.Math.Grasshopper/Convert/ToSAM/Matrix.cs +++ b/Grasshopper/SAM.Math.Grasshopper/Convert/ToSAM/Matrix.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel.Types; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel.Types; namespace SAM.Math.Grasshopper { @@ -10,4 +13,4 @@ public static Matrix ToSAM(this GH_Matrix matrix) return Rhino.Convert.ToSAM(matrix?.Value); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Math.Grasshopper/Kernel/AssemblyInfo.cs b/Grasshopper/SAM.Math.Grasshopper/Kernel/AssemblyInfo.cs index 36aa61876..39fd3cecd 100644 --- a/Grasshopper/SAM.Math.Grasshopper/Kernel/AssemblyInfo.cs +++ b/Grasshopper/SAM.Math.Grasshopper/Kernel/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using System; using System.Drawing; @@ -67,4 +70,4 @@ public override string AuthorContact } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Math.Grasshopper/Properties/AssemblyInfo.cs b/Grasshopper/SAM.Math.Grasshopper/Properties/AssemblyInfo.cs index 0fce29413..fd53c07c1 100644 --- a/Grasshopper/SAM.Math.Grasshopper/Properties/AssemblyInfo.cs +++ b/Grasshopper/SAM.Math.Grasshopper/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -/* +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +/* * This file is part of the Sustaiable Analytical Model (SAM) * Copyright (c) 2020, the respective contributors. All rights reserved. * diff --git a/Grasshopper/SAM.Math.Grasshopper/Properties/Resources.Designer.cs b/Grasshopper/SAM.Math.Grasshopper/Properties/Resources.Designer.cs index a45144b25..5ec5d07d9 100644 --- a/Grasshopper/SAM.Math.Grasshopper/Properties/Resources.Designer.cs +++ b/Grasshopper/SAM.Math.Grasshopper/Properties/Resources.Designer.cs @@ -1,4 +1,7 @@ -//------------------------------------------------------------------------------ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.42000 diff --git a/Grasshopper/SAM.Weather.Grasshopper/Classes/GooWeatherData.cs b/Grasshopper/SAM.Weather.Grasshopper/Classes/GooWeatherData.cs index 743e867ff..4f0e1769c 100644 --- a/Grasshopper/SAM.Weather.Grasshopper/Classes/GooWeatherData.cs +++ b/Grasshopper/SAM.Weather.Grasshopper/Classes/GooWeatherData.cs @@ -1,12 +1,15 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using Rhino.Geometry; -using SAM.Weather.Grasshopper.Properties; using SAM.Core.Grasshopper; +using SAM.Weather.Grasshopper.Properties; using System; using System.Collections.Generic; -using System.Windows.Forms; using System.Linq; +using System.Windows.Forms; namespace SAM.Weather.Grasshopper { @@ -32,7 +35,7 @@ public class GooWeatherDataParam : GH_PersistentParam, IGH_Previ { public override Guid ComponentGuid => new Guid("3de17bc3-6f46-4b97-ad5a-ce311ac9c02f"); - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; bool IGH_PreviewObject.Hidden { get; set; } @@ -73,4 +76,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Weather.Grasshopper/Classes/GooWeatherObject.cs b/Grasshopper/SAM.Weather.Grasshopper/Classes/GooWeatherObject.cs index 654e33360..5342d85cb 100644 --- a/Grasshopper/SAM.Weather.Grasshopper/Classes/GooWeatherObject.cs +++ b/Grasshopper/SAM.Weather.Grasshopper/Classes/GooWeatherObject.cs @@ -1,12 +1,15 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using Rhino.Geometry; -using SAM.Weather.Grasshopper.Properties; using SAM.Core.Grasshopper; +using SAM.Weather.Grasshopper.Properties; using System; using System.Collections.Generic; -using System.Windows.Forms; using System.Linq; +using System.Windows.Forms; namespace SAM.Weather.Grasshopper { @@ -32,7 +35,7 @@ public class GooWeatherObjectParam : GH_PersistentParam, IGH_P { public override Guid ComponentGuid => new Guid("b96713e0-5cde-4774-a061-0f3490d3d0a5"); - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; public override GH_Exposure Exposure => GH_Exposure.hidden; @@ -75,4 +78,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Weather.Grasshopper/Classes/GooWeatherYear.cs b/Grasshopper/SAM.Weather.Grasshopper/Classes/GooWeatherYear.cs index 16e2d3fd6..e9c635a9e 100644 --- a/Grasshopper/SAM.Weather.Grasshopper/Classes/GooWeatherYear.cs +++ b/Grasshopper/SAM.Weather.Grasshopper/Classes/GooWeatherYear.cs @@ -1,12 +1,15 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using Rhino.Geometry; -using SAM.Weather.Grasshopper.Properties; using SAM.Core.Grasshopper; +using SAM.Weather.Grasshopper.Properties; using System; using System.Collections.Generic; -using System.Windows.Forms; using System.Linq; +using System.Windows.Forms; namespace SAM.Weather.Grasshopper { @@ -32,7 +35,7 @@ public class GooWeatherYearParam : GH_PersistentParam, IGH_Previ { public override Guid ComponentGuid => new Guid("3778cda9-ca09-4d52-b9fb-ed23780dc0e4"); - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; bool IGH_PreviewObject.Hidden { get; set; } @@ -73,4 +76,4 @@ private void Menu_SaveAs(object sender, EventArgs e) Core.Grasshopper.Query.SaveAs(VolatileData); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherAdaptiveSetpointACCI.cs b/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherAdaptiveSetpointACCI.cs index b129e795a..9698d81cc 100644 --- a/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherAdaptiveSetpointACCI.cs +++ b/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherAdaptiveSetpointACCI.cs @@ -1,11 +1,14 @@ -using Grasshopper.Kernel; -using SAM.Weather.Grasshopper.Properties; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core; using SAM.Core.Grasshopper; +using SAM.Weather; using SAM.Weather.Grasshopper; +using SAM.Weather.Grasshopper.Properties; using System; using System.Collections.Generic; -using SAM.Weather; namespace SAM.Analytical.Grasshopper { @@ -24,7 +27,7 @@ public class SAMWeatherAdaptiveSetpointACCI : GH_SAMVariableOutputParameterCompo /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; public override GH_Exposure Exposure => GH_Exposure.primary; @@ -85,7 +88,7 @@ protected override GH_SAMParam[] Outputs List result = new List(); result.Add(new GH_SAMParam(new GooWeatherObjectParam() { Name = "weatherObject", NickName = "weatherObject", Description = "SAM Weather Object such as WeatherHour, WeatherDay etc.", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number { Name = "upper", NickName = "upper", Description = "Upper Dry Bulb Temperature", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number { Name = "lower", NickName = "lower", Description = "Lower Dry Bulb Temperature", Access = GH_ParamAccess.list}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number { Name = "lower", NickName = "lower", Description = "Lower Dry Bulb Temperature", Access = GH_ParamAccess.list }, ParamVisibility.Binding)); return result.ToArray(); } } @@ -109,15 +112,15 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } List> ranges = null; - if(weatherObject is WeatherHour) + if (weatherObject is WeatherHour) { Range range = ((WeatherHour)weatherObject).DryBulbTemperatureRange(); - if(range != null) + if (range != null) { ranges = new List>() { range }; } } - else if(weatherObject is WeatherDay) + else if (weatherObject is WeatherDay) { ranges = ((WeatherDay)weatherObject).DryBulbTemperatureRanges(); } @@ -150,4 +153,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherAdaptiveSetpointACCIByTemperature.cs b/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherAdaptiveSetpointACCIByTemperature.cs index a639641ff..8a8d2dac6 100644 --- a/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherAdaptiveSetpointACCIByTemperature.cs +++ b/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherAdaptiveSetpointACCIByTemperature.cs @@ -1,7 +1,10 @@ -using Grasshopper.Kernel; -using SAM.Weather.Grasshopper.Properties; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core; using SAM.Core.Grasshopper; +using SAM.Weather.Grasshopper.Properties; using System; using System.Collections.Generic; @@ -22,7 +25,7 @@ public class SAMWeatherAdaptiveSetpointACCIByTemperature : GH_SAMVariableOutputP /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; public override GH_Exposure Exposure => GH_Exposure.primary; @@ -83,7 +86,7 @@ protected override GH_SAMParam[] Outputs List result = new List(); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number() { Name = "temperature", NickName = "temperature", Description = "Temperature", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number { Name = "upper", NickName = "upper", Description = "Upper Dry Bulb Temperature", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); - result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number { Name = "lower", NickName = "lower", Description = "Lower Dry Bulb Temperature", Access = GH_ParamAccess.item}, ParamVisibility.Binding)); + result.Add(new GH_SAMParam(new global::Grasshopper.Kernel.Parameters.Param_Number { Name = "lower", NickName = "lower", Description = "Lower Dry Bulb Temperature", Access = GH_ParamAccess.item }, ParamVisibility.Binding)); return result.ToArray(); } } @@ -128,4 +131,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherHourlyModifyWeatherData.cs b/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherHourlyModifyWeatherData.cs index 31ab74af2..a88921538 100644 --- a/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherHourlyModifyWeatherData.cs +++ b/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherHourlyModifyWeatherData.cs @@ -1,15 +1,17 @@ -using Grasshopper.Kernel; -using SAM.Weather.Grasshopper.Properties; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; +using Grasshopper.Kernel.Data; +using Grasshopper.Kernel.Types; using SAM.Core; using SAM.Core.Grasshopper; +using SAM.Weather; using SAM.Weather.Grasshopper; +using SAM.Weather.Grasshopper.Properties; using System; using System.Collections.Generic; -using SAM.Weather; -using Grasshopper.Kernel.Data; -using Grasshopper.Kernel.Types; using System.Linq; -using MathNet.Numerics; namespace SAM.Analytical.Grasshopper { @@ -268,7 +270,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) for (int k = 0; k < hoursOfYear.Count; k++) { int hourOfYear = hoursOfYear[k]; - if(hourOfYear == -1) + if (hourOfYear == -1) { continue; } @@ -296,4 +298,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherHourlyValue.cs b/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherHourlyValue.cs index 45a3aba4d..3e57bc822 100644 --- a/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherHourlyValue.cs +++ b/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherHourlyValue.cs @@ -1,6 +1,9 @@ -using Grasshopper.Kernel; -using SAM.Weather.Grasshopper.Properties; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper; +using SAM.Weather.Grasshopper.Properties; using System; using System.Linq; @@ -113,4 +116,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetData(0, result); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherHourlyValues.cs b/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherHourlyValues.cs index 3e19ab6c4..e8b4cc80c 100644 --- a/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherHourlyValues.cs +++ b/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherHourlyValues.cs @@ -1,11 +1,14 @@ -using Grasshopper.Kernel; -using SAM.Weather.Grasshopper.Properties; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core; using SAM.Core.Grasshopper; +using SAM.Weather; using SAM.Weather.Grasshopper; +using SAM.Weather.Grasshopper.Properties; using System; using System.Collections.Generic; -using SAM.Weather; namespace SAM.Analytical.Grasshopper { @@ -94,13 +97,13 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List indexes = new List(); index = Params.IndexOfInputParam("hoursOfYear_"); - if(index != -1) + if (index != -1) { dataAccess.GetDataList(index, indexes); } IndexedDoubles indexDoubles = null; - if(weatherObject is WeatherDay) + if (weatherObject is WeatherDay) { indexDoubles = ((WeatherDay)weatherObject).GetIndexedDoubles(name); } @@ -113,16 +116,16 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) indexDoubles = ((WeatherData)weatherObject).GetIndexedDoubles(name); } - if(indexDoubles == null) + if (indexDoubles == null) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; } - if(indexes != null && indexes.Count >0) + if (indexes != null && indexes.Count > 0) { IndexedDoubles indexedDoubles_Temp = new IndexedDoubles(); - foreach(int index_Temp in indexes) + foreach (int index_Temp in indexes) { indexedDoubles_Temp.Add(index_Temp, indexDoubles[index_Temp]); } @@ -137,4 +140,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherPrevailingMeanOutdoorAirTemperatures.cs b/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherPrevailingMeanOutdoorAirTemperatures.cs index f1d09acaa..a17147c42 100644 --- a/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherPrevailingMeanOutdoorAirTemperatures.cs +++ b/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherPrevailingMeanOutdoorAirTemperatures.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper; using SAM.Weather.Grasshopper.Properties; using System; @@ -21,7 +24,7 @@ public class SAMWeatherPrevailingMeanOutdoorAirTemperatures : GH_SAMVariableOutp /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; /// /// Initializes a new instance of the SAM_point3D class. @@ -85,7 +88,7 @@ protected override GH_SAMParam[] Outputs protected override void SolveInstance(IGH_DataAccess dataAccess) { int index = -1; - + bool run = false; index = Params.IndexOfInputParam("_run"); if (index == -1 || !dataAccess.GetData(index, ref run)) @@ -107,7 +110,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) return; } - if(!(weatherObject is WeatherData) && !(weatherObject is WeatherYear)) + if (!(weatherObject is WeatherData) && !(weatherObject is WeatherYear)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -115,12 +118,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) int sequentialDays = int.MinValue; index = Params.IndexOfInputParam("_sequentialDays_"); - if(index != -1) + if (index != -1) { dataAccess.GetData(index, ref sequentialDays); } - if(sequentialDays == int.MinValue || sequentialDays == int.MaxValue) + if (sequentialDays == int.MinValue || sequentialDays == int.MaxValue) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -140,9 +143,9 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) if (dryBulbTemperatures != null) { List dryBulbTemperatures_Temp = new List(); - foreach(double dryBulbTemperature in dryBulbTemperatures) + foreach (double dryBulbTemperature in dryBulbTemperatures) { - for(int i=0; i < 24; i++) + for (int i = 0; i < 24; i++) { dryBulbTemperatures_Temp.Add(dryBulbTemperature); } @@ -160,4 +163,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherWeatherDataType.cs b/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherWeatherDataType.cs index 72a7c4522..b486e4b10 100644 --- a/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherWeatherDataType.cs +++ b/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherWeatherDataType.cs @@ -1,5 +1,8 @@ -using SAM.Weather.Grasshopper.Properties; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Grasshopper; +using SAM.Weather.Grasshopper.Properties; using System; namespace SAM.Weather.Grasshopper @@ -31,4 +34,4 @@ public SAMAnalyticalWeatherDataType() { } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherWeatherHoursByHourOfYear.cs b/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherWeatherHoursByHourOfYear.cs index 77a0f8d80..4681d6658 100644 --- a/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherWeatherHoursByHourOfYear.cs +++ b/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherWeatherHoursByHourOfYear.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using SAM.Core.Grasshopper; using SAM.Weather.Grasshopper.Properties; using System; @@ -21,7 +24,7 @@ public class SAMWeatherWeatherHoursByHourOfYear : GH_SAMVariableOutputParameterC /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; /// /// Initializes a new instance of the SAM_point3D class. @@ -130,4 +133,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) dataAccess.SetDataList(0, weatherHours?.ConvertAll(x => new GooWeatherObject(x))); } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherWeatherHoursByPercentage.cs b/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherWeatherHoursByPercentage.cs index 938c6d6d2..a13b2b572 100644 --- a/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherWeatherHoursByPercentage.cs +++ b/Grasshopper/SAM.Weather.Grasshopper/Component/SAMWeatherWeatherHoursByPercentage.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using Grasshopper.Kernel.Types; using SAM.Core; using SAM.Core.Grasshopper; @@ -24,7 +27,7 @@ public class SAMWeatherWeatherHoursByPercentage : GH_SAMVariableOutputParameterC /// /// Provides an Icon for the component. /// - protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; + protected override System.Drawing.Bitmap Icon => Resources.SAM_Small; /// /// Initializes a new instance of the SAM_point3D class. @@ -108,7 +111,7 @@ protected override GH_SAMParam[] Outputs protected override void SolveInstance(IGH_DataAccess dataAccess) { int index = -1; - + bool run = false; index = Params.IndexOfInputParam("_run"); if (index == -1 || !dataAccess.GetData(index, ref run)) @@ -140,7 +143,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) weatherDataType = Core.Query.Enum(weatherDataTypeString); } - if(weatherDataType == WeatherDataType.Undefined) + if (weatherDataType == WeatherDataType.Undefined) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -148,12 +151,12 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) double percentage = double.NaN; index = Params.IndexOfInputParam("_percentage_"); - if(index != -1) + if (index != -1) { dataAccess.GetData(index, ref percentage); } - if(double.IsNaN(percentage)) + if (double.IsNaN(percentage)) { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Invalid data"); return; @@ -201,7 +204,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) List weatherHours = weatherYear?.GetWeatherHours(); for (int i = 0; i < weatherHours.Count; i++) { - tuples.Add(new Tuple (i, weatherHours[i])); + tuples.Add(new Tuple(i, weatherHours[i])); } } } @@ -217,7 +220,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) else if (weatherObject is WeatherDay) { List weatherHours = ((WeatherDay)weatherObject).GetWeatherHours(); - for(int i = 0; i< weatherHours.Count; i++) + for (int i = 0; i < weatherHours.Count; i++) { tuples.Add(new Tuple(i, weatherHours[i])); } @@ -225,25 +228,25 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) tuples.RemoveAll(x => x.Item2 == null || double.IsNaN(x.Item2[weatherDataType])); - if(!double.IsNaN(minValue)) + if (!double.IsNaN(minValue)) { tuples.RemoveAll(x => x.Item2[weatherDataType] < minValue); } double value = double.NaN; - if(average) + if (average) { double min = double.MaxValue; double max = double.MinValue; - foreach(Tuple tuple in tuples) + foreach (Tuple tuple in tuples) { double value_Temp = tuple.Item2[weatherDataType]; - if(value_Temp < min) + if (value_Temp < min) { min = value_Temp; } - if(value_Temp > max) + if (value_Temp > max) { max = value_Temp; } @@ -278,7 +281,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) foreach (Tuple tuple in tuples) { - if(tuple.Item2.Compare(weatherDataType, value, numberComparisonType)) + if (tuple.Item2.Compare(weatherDataType, value, numberComparisonType)) { weatherHours_In.Add(tuple.Item2); indexes_In.Add(tuple.Item1); @@ -297,7 +300,7 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } index = Params.IndexOfOutputParam("weatherHours_In"); - if(index != -1) + if (index != -1) { dataAccess.SetDataList(index, weatherHours_In?.ConvertAll(x => new GooWeatherObject(x))); } @@ -322,4 +325,4 @@ protected override void SolveInstance(IGH_DataAccess dataAccess) } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Weather.Grasshopper/Kernel/AssemblyInfo.cs b/Grasshopper/SAM.Weather.Grasshopper/Kernel/AssemblyInfo.cs index 9c3126fe0..521cd38a4 100644 --- a/Grasshopper/SAM.Weather.Grasshopper/Kernel/AssemblyInfo.cs +++ b/Grasshopper/SAM.Weather.Grasshopper/Kernel/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using Grasshopper.Kernel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Grasshopper.Kernel; using System; using System.Drawing; @@ -67,4 +70,4 @@ public override string AuthorContact } } } -} \ No newline at end of file +} diff --git a/Grasshopper/SAM.Weather.Grasshopper/Properties/AssemblyInfo.cs b/Grasshopper/SAM.Weather.Grasshopper/Properties/AssemblyInfo.cs index 63bdb6add..178f8de70 100644 --- a/Grasshopper/SAM.Weather.Grasshopper/Properties/AssemblyInfo.cs +++ b/Grasshopper/SAM.Weather.Grasshopper/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -/* +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +/* * This file is part of the Sustaiable Analytical Model (SAM) * Copyright (c) 2020, the respective contributors. All rights reserved. * diff --git a/Grasshopper/SAM.Weather.Grasshopper/Properties/Resources.Designer.cs b/Grasshopper/SAM.Weather.Grasshopper/Properties/Resources.Designer.cs index e8a1c037f..a10b44305 100644 --- a/Grasshopper/SAM.Weather.Grasshopper/Properties/Resources.Designer.cs +++ b/Grasshopper/SAM.Weather.Grasshopper/Properties/Resources.Designer.cs @@ -1,4 +1,7 @@ -//------------------------------------------------------------------------------ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.42000 diff --git a/Rhino/SAM.Analytical.Rhino/Convert/ToRhino/Brep.cs b/Rhino/SAM.Analytical.Rhino/Convert/ToRhino/Brep.cs index 7b618723e..d2d4aa7d4 100644 --- a/Rhino/SAM.Analytical.Rhino/Convert/ToRhino/Brep.cs +++ b/Rhino/SAM.Analytical.Rhino/Convert/ToRhino/Brep.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical.Rhino +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical.Rhino { public static partial class Convert { @@ -7,4 +10,4 @@ public static partial class Convert return Geometry.Rhino.Convert.ToRhino_Brep(planarBoundary3D?.GetFace3D()); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Analytical.Rhino/Convert/ToRhino/Breps.cs b/Rhino/SAM.Analytical.Rhino/Convert/ToRhino/Breps.cs index 882afa332..d486c13a8 100644 --- a/Rhino/SAM.Analytical.Rhino/Convert/ToRhino/Breps.cs +++ b/Rhino/SAM.Analytical.Rhino/Convert/ToRhino/Breps.cs @@ -1,4 +1,7 @@ -using Rhino.Geometry; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino.Geometry; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -70,9 +73,9 @@ public static List ToRhino(this AdjacencyCluster adjacencyCluster, bool cu } List apertures = panel.Apertures; - if(apertures != null) + if (apertures != null) { - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { aperture.ToRhino(includeFrame)?.ForEach(x => result.Add(x)); } @@ -86,7 +89,7 @@ public static List ToRhino(this AdjacencyCluster adjacencyCluster, bool cu public static List ToRhino(this Aperture aperture, bool includeFrame = false) { - if(aperture == null) + if (aperture == null) { return null; } @@ -118,16 +121,16 @@ public static List ToRhino(this IPanel panel, bool cutApertures = false, d } List face3Ds = panel is Panel ? ((Panel)panel).GetFace3Ds(cutApertures) : new List() { panel.Face3D }; - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return null; } List result = new List(); - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { Brep brep = Geometry.Rhino.Convert.ToRhino_Brep(face3D, tolerance); - if(brep == null) + if (brep == null) { continue; } @@ -138,4 +141,4 @@ public static List ToRhino(this IPanel panel, bool cutApertures = false, d return result; } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Analytical.Rhino/Convert/ToRhino/Mesh.cs b/Rhino/SAM.Analytical.Rhino/Convert/ToRhino/Mesh.cs index fbaae4968..ea24a4d2d 100644 --- a/Rhino/SAM.Analytical.Rhino/Convert/ToRhino/Mesh.cs +++ b/Rhino/SAM.Analytical.Rhino/Convert/ToRhino/Mesh.cs @@ -1,6 +1,9 @@ -using SAM.Geometry.Spatial; -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using Rhino.Geometry; +using SAM.Geometry.Spatial; +using System.Collections.Generic; namespace SAM.Analytical.Rhino { @@ -9,14 +12,14 @@ public static partial class Convert public static Mesh ToRhino_Mesh(this Aperture aperture) { Face3D face3D = aperture?.GetFace3D(); - if(face3D == null) + if (face3D == null) { return null; } - + Mesh mesh = Geometry.Rhino.Convert.ToRhino_Mesh(face3D); - if(mesh != null) + if (mesh != null) { mesh.VertexColors.CreateMonotoneMesh(Query.Color(aperture.ApertureType)); } @@ -27,21 +30,21 @@ public static Mesh ToRhino_Mesh(this Aperture aperture) public static Mesh ToRhino_Mesh(this IPanel panel, bool cutApertures = true, bool includeApertures = true, double tolerance = Core.Tolerance.Distance) { - if(panel == null) + if (panel == null) { return null; } - List face3Ds = panel is ExternalPanel ? new List() { panel.Face3D } : (panel as Panel)?.GetFace3Ds(cutApertures); + List face3Ds = panel is ExternalPanel ? new List() { panel.Face3D } : (panel as Panel)?.GetFace3Ds(cutApertures); if (face3Ds == null || face3Ds.Count == 0) { return null; } Mesh result = null; - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { - if(result == null) + if (result == null) { result = Geometry.Rhino.Convert.ToRhino_Mesh(face3D); } @@ -55,7 +58,7 @@ public static Mesh ToRhino_Mesh(this IPanel panel, bool cutApertures = true, boo } } - if(face3Ds.Count > 1) + if (face3Ds.Count > 1) { result.Normals.ComputeNormals(); } @@ -65,14 +68,14 @@ public static Mesh ToRhino_Mesh(this IPanel panel, bool cutApertures = true, boo return null; } - if(panel is ExternalPanel) + if (panel is ExternalPanel) { result.VertexColors.CreateMonotoneMesh(Query.Color((ExternalPanel)panel)); return result; } Panel panel_Temp = panel as Panel; - if(panel_Temp == null) + if (panel_Temp == null) { return null; } @@ -82,12 +85,12 @@ public static Mesh ToRhino_Mesh(this IPanel panel, bool cutApertures = true, boo if (includeApertures) { List apertures = panel_Temp.Apertures; - if(apertures != null && apertures.Count != 0) + if (apertures != null && apertures.Count != 0) { - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { Mesh mesh_Aperture = aperture.ToRhino_Mesh(); - if(mesh_Aperture != null) + if (mesh_Aperture != null) { result.Append(mesh_Aperture); } @@ -103,16 +106,16 @@ public static Mesh ToRhino_Mesh(this IPanel panel, bool cutApertures = true, boo public static Mesh ToRhino_Mesh(this AdjacencyCluster adjacencyCluster, bool cutApertures = true, bool includeApertures = true, double tolerance = Core.Tolerance.Distance) { List panels = adjacencyCluster.GetPanels(); - if(panels == null || panels.Count == 0) + if (panels == null || panels.Count == 0) { return null; } List meshes = new List(); - foreach(Panel panel in panels) + foreach (Panel panel in panels) { Mesh mesh_Temp = panel?.ToRhino_Mesh(cutApertures, includeApertures, tolerance); - if(mesh_Temp == null) + if (mesh_Temp == null) { continue; } @@ -140,4 +143,4 @@ public static Mesh ToRhino_Mesh(this AnalyticalModel analyticalModel, bool cutAp return analyticalModel?.AdjacencyCluster?.ToRhino_Mesh(cutApertures, includeApertures, tolerance); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Analytical.Rhino/Convert/ToRhino/New/Brep.cs b/Rhino/SAM.Analytical.Rhino/Convert/ToRhino/New/Brep.cs index e455c2e7b..fd2a66ba8 100644 --- a/Rhino/SAM.Analytical.Rhino/Convert/ToRhino/New/Brep.cs +++ b/Rhino/SAM.Analytical.Rhino/Convert/ToRhino/New/Brep.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Analytical.Rhino { @@ -6,7 +9,7 @@ public static partial class Convert { public static global::Rhino.Geometry.Brep ToRhino(this IPartition partition, bool cutOpenings = false, double tolerance = Core.Tolerance.MicroDistance) { - if(partition == null) + if (partition == null) { return null; } @@ -24,4 +27,4 @@ public static partial class Convert return Geometry.Rhino.Convert.ToRhino_Brep(face3D); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Analytical.Rhino/Convert/ToRhino/New/Mesh.cs b/Rhino/SAM.Analytical.Rhino/Convert/ToRhino/New/Mesh.cs index d725f850e..2c77e3152 100644 --- a/Rhino/SAM.Analytical.Rhino/Convert/ToRhino/New/Mesh.cs +++ b/Rhino/SAM.Analytical.Rhino/Convert/ToRhino/New/Mesh.cs @@ -1,6 +1,9 @@ -using SAM.Geometry.Spatial; -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using Rhino.Geometry; +using SAM.Geometry.Spatial; +using System.Collections.Generic; namespace SAM.Analytical.Rhino { @@ -9,14 +12,14 @@ public static partial class Convert public static Mesh ToRhino_Mesh(this IOpening opening) { Face3D face3D = opening?.Face3D; - if(face3D == null) + if (face3D == null) { return null; } - + Mesh mesh = Geometry.Rhino.Convert.ToRhino_Mesh(face3D); - if(mesh != null) + if (mesh != null) { mesh.VertexColors.CreateMonotoneMesh(Query.Color(opening)); } @@ -27,7 +30,7 @@ public static Mesh ToRhino_Mesh(this IOpening opening) public static Mesh ToRhino_Mesh(this IPartition partition, bool cutOpenings = true, bool includeOpenings = true, double tolerance = Core.Tolerance.Distance) { - if(partition == null) + if (partition == null) { return null; } @@ -51,12 +54,12 @@ public static Mesh ToRhino_Mesh(this IPartition partition, bool cutOpenings = tr if (includeOpenings && partition is IHostPartition) { List openings = ((IHostPartition)partition).GetOpenings(); - if(openings != null && openings.Count != 0) + if (openings != null && openings.Count != 0) { - foreach(IOpening opening in openings) + foreach (IOpening opening in openings) { Mesh mesh_Aperture = opening.ToRhino_Mesh(); - if(mesh_Aperture != null) + if (mesh_Aperture != null) { result.Append(mesh_Aperture); } @@ -104,4 +107,4 @@ public static Mesh ToRhino_Mesh(this BuildingModel buildingModel, bool cutOpenin return mesh; } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry.cs b/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry.cs index 6ae3e2e8d..b14e8c404 100644 --- a/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry.cs +++ b/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry.cs @@ -1,4 +1,7 @@ -using Rhino; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino; using Rhino.DocObjects; using Rhino.Geometry; using SAM.Geometry.Spatial; @@ -94,7 +97,7 @@ public static bool BakeGeometry(this Aperture aperture, RhinoDoc rhinoDoc, Objec //Core.Grasshopper.Modify.SetUserStrings(objectAttributes, aperture); objectAttributes.Name = aperture.Name; - if(!includeFrame) + if (!includeFrame) { if (!Geometry.Rhino.Modify.BakeGeometry(new Face3D(aperture.GetExternalEdge3D()), rhinoDoc, objectAttributes, out guid)) { @@ -108,7 +111,7 @@ public static bool BakeGeometry(this Aperture aperture, RhinoDoc rhinoDoc, Objec List face3Ds_Temp = null; face3Ds_Temp = aperture.GetFace3Ds(AperturePart.Frame); - if(face3Ds_Temp != null) + if (face3Ds_Temp != null) { face3Ds.AddRange(face3Ds_Temp); } @@ -165,4 +168,4 @@ public static bool BakeGeometry(this ISpace space, RhinoDoc rhinoDoc, ObjectAttr return true; } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByApertureConstruction.cs b/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByApertureConstruction.cs index 491f771d3..c76bdda80 100644 --- a/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByApertureConstruction.cs +++ b/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByApertureConstruction.cs @@ -1,4 +1,7 @@ -using Rhino; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino; using Rhino.DocObjects; using System; using System.Collections.Generic; @@ -61,4 +64,4 @@ public static void BakeGeometry_ByApertureConstruction(this RhinoDoc rhinoDoc, I //layerTable.SetCurrentLayerIndex(currentIndex, true); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByApertureType.cs b/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByApertureType.cs index 27cbf2a69..4277b6f7f 100644 --- a/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByApertureType.cs +++ b/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByApertureType.cs @@ -1,4 +1,7 @@ -using Rhino; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino; using Rhino.DocObjects; using System; using System.Collections.Generic; @@ -47,4 +50,4 @@ public static void BakeGeometry_ByApertureType(this RhinoDoc rhinoDoc, IEnumerab } } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByBoundaryType.cs b/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByBoundaryType.cs index c07bf142b..caae31c80 100644 --- a/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByBoundaryType.cs +++ b/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByBoundaryType.cs @@ -1,4 +1,7 @@ -using Rhino; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino; using Rhino.DocObjects; using System; using System.Collections.Generic; @@ -40,7 +43,7 @@ public static void BakeGeometry_ByBoundaryType(this RhinoDoc rhinoDoc, Adjacency if (panel is ExternalPanel) { layer_Temp = Core.Rhino.Modify.GetLayer(layerTable, layer.Id, panel.GetType().Name, Query.Color((ExternalPanel)panel)); - + objectAttributes.LayerIndex = layer_Temp.Index; if (BakeGeometry(panel, rhinoDoc, objectAttributes, out guids_Panel, cutApertures, tolerance) && guids_Panel != null) @@ -51,7 +54,7 @@ public static void BakeGeometry_ByBoundaryType(this RhinoDoc rhinoDoc, Adjacency } Panel panel_Temp = panel as Panel; - if(panel_Temp == null) + if (panel_Temp == null) { continue; } @@ -86,4 +89,4 @@ public static void BakeGeometry_ByBoundaryType(this RhinoDoc rhinoDoc, Adjacency } } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByConstruction.cs b/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByConstruction.cs index e2dfe86b2..e92062549 100644 --- a/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByConstruction.cs +++ b/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByConstruction.cs @@ -1,4 +1,7 @@ -using Rhino; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino; using Rhino.DocObjects; using System; using System.Collections.Generic; @@ -44,16 +47,16 @@ public static void BakeGeometry_ByConstruction(this RhinoDoc rhinoDoc, IEnumerab PanelType panelType = panel is Panel ? ((Panel)panel).PanelType : PanelType.Air; System.Drawing.Color color = System.Drawing.Color.FromArgb(random.Next(0, 254), random.Next(0, 254), random.Next(0, 254)); - + string layerName = null; - if(panel is Panel) + if (panel is Panel) { layerName = ((Panel)panel).Name; } - else if(panel is ExternalPanel) + else if (panel is ExternalPanel) { ExternalPanel externalPanel = (ExternalPanel)panel; - if(externalPanel.Construction == null) + if (externalPanel.Construction == null) { layerName = panel.GetType().Name; } @@ -86,7 +89,7 @@ public static void BakeGeometry_ByConstruction(this RhinoDoc rhinoDoc, IEnumerab guids.AddRange(guids_Panel); } - if(panel is Panel) + if (panel is Panel) { List apertures = ((Panel)panel).Apertures; @@ -124,4 +127,4 @@ public static void BakeGeometry_ByConstruction(this RhinoDoc rhinoDoc, IEnumerab //layerTable.SetCurrentLayerIndex(currentIndex, true); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByDischargeCoefficient.cs b/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByDischargeCoefficient.cs index 750d384d3..4de1466a4 100644 --- a/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByDischargeCoefficient.cs +++ b/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByDischargeCoefficient.cs @@ -1,4 +1,7 @@ -using Rhino; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino; using Rhino.DocObjects; using System; using System.Collections.Generic; @@ -27,7 +30,7 @@ public static void BakeGeometry_ByDischargeCoefficient(this RhinoDoc rhinoDoc, I SortedDictionary> dictionary = new SortedDictionary>(); List apertures_NoDischargeCoefficient = new List(); - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { if (aperture == null) { @@ -35,10 +38,10 @@ public static void BakeGeometry_ByDischargeCoefficient(this RhinoDoc rhinoDoc, I } double dischargeCoefficient = 0; - if(aperture.TryGetValue(ApertureParameter.OpeningProperties, out IOpeningProperties openingProperties) && openingProperties != null) + if (aperture.TryGetValue(ApertureParameter.OpeningProperties, out IOpeningProperties openingProperties) && openingProperties != null) { dischargeCoefficient = openingProperties.GetDischargeCoefficient(); - if(double.IsNaN(dischargeCoefficient)) + if (double.IsNaN(dischargeCoefficient)) { dischargeCoefficient = 0; } @@ -46,13 +49,13 @@ public static void BakeGeometry_ByDischargeCoefficient(this RhinoDoc rhinoDoc, I dischargeCoefficient = Core.Query.Round(dischargeCoefficient, Core.Tolerance.MacroDistance); - if(dischargeCoefficient == 0) + if (dischargeCoefficient == 0) { apertures_NoDischargeCoefficient.Add(aperture); continue; } - if(!dictionary.TryGetValue(dischargeCoefficient, out List apertures_Temp) || apertures_Temp == null) + if (!dictionary.TryGetValue(dischargeCoefficient, out List apertures_Temp) || apertures_Temp == null) { apertures_Temp = new List(); dictionary[dischargeCoefficient] = apertures_Temp; @@ -88,7 +91,7 @@ public static void BakeGeometry_ByDischargeCoefficient(this RhinoDoc rhinoDoc, I objectAttributes.LayerIndex = layer.Index; - foreach(Aperture aperture in keyValuePair.Value) + foreach (Aperture aperture in keyValuePair.Value) { if (BakeGeometry(aperture, rhinoDoc, objectAttributes, out Guid guid)) { @@ -98,4 +101,4 @@ public static void BakeGeometry_ByDischargeCoefficient(this RhinoDoc rhinoDoc, I } } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByInternalCondtion.cs b/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByInternalCondtion.cs index 442ac1259..19ccac9fe 100644 --- a/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByInternalCondtion.cs +++ b/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByInternalCondtion.cs @@ -1,4 +1,7 @@ -using Rhino; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino; using Rhino.DocObjects; using System; using System.Collections.Generic; @@ -64,4 +67,4 @@ public static void BakeGeometry_ByInternalCondition(this RhinoDoc rhinoDoc, IEnu //layerTable.SetCurrentLayerIndex(currentIndex, true); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByLevel.cs b/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByLevel.cs index 44f6c0f9a..f5d58877f 100644 --- a/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByLevel.cs +++ b/Rhino/SAM.Analytical.Rhino/Modify/BakeGeometry_ByLevel.cs @@ -1,4 +1,7 @@ -using Rhino; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino; using Rhino.DocObjects; using System; using System.Collections.Generic; @@ -67,4 +70,4 @@ public static void BakeGeometry_ByLevel(this RhinoDoc rhinoDoc, IEnumerable apertures = ((Panel)panel).Apertures; if (apertures == null || apertures.Count == 0) @@ -122,4 +125,4 @@ public static void BakeGeometry_ByPanelType(this RhinoDoc rhinoDoc, IEnumerable< //layerTable.SetCurrentLayerIndex(currentIndex, true); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Analytical.Rhino/Modify/New/BakeGeometry.cs b/Rhino/SAM.Analytical.Rhino/Modify/New/BakeGeometry.cs index 7523fa302..74529a983 100644 --- a/Rhino/SAM.Analytical.Rhino/Modify/New/BakeGeometry.cs +++ b/Rhino/SAM.Analytical.Rhino/Modify/New/BakeGeometry.cs @@ -1,4 +1,7 @@ -using Rhino; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino; using Rhino.DocObjects; using Rhino.Geometry; using System; @@ -96,4 +99,4 @@ public static bool BakeGeometry(this BuildingModel buildingModel, RhinoDoc rhino return true; } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Analytical.Rhino/Modify/New/BakeGeometry_ByAnalyticalType.cs b/Rhino/SAM.Analytical.Rhino/Modify/New/BakeGeometry_ByAnalyticalType.cs index 38913e178..ac6765564 100644 --- a/Rhino/SAM.Analytical.Rhino/Modify/New/BakeGeometry_ByAnalyticalType.cs +++ b/Rhino/SAM.Analytical.Rhino/Modify/New/BakeGeometry_ByAnalyticalType.cs @@ -1,4 +1,7 @@ -using Rhino; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino; using Rhino.DocObjects; using System; using System.Collections.Generic; @@ -98,4 +101,4 @@ public static void BakeGeometry_ByAnalyticalType(this RhinoDoc rhinoDoc, Buildin //layerTable.SetCurrentLayerIndex(currentIndex, true); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Analytical.Rhino/Modify/New/BakeGeometry_ByCategory.cs b/Rhino/SAM.Analytical.Rhino/Modify/New/BakeGeometry_ByCategory.cs index 2eff664e1..3aa55e31a 100644 --- a/Rhino/SAM.Analytical.Rhino/Modify/New/BakeGeometry_ByCategory.cs +++ b/Rhino/SAM.Analytical.Rhino/Modify/New/BakeGeometry_ByCategory.cs @@ -1,4 +1,7 @@ -using Rhino; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino; using Rhino.DocObjects; using System; using System.Collections.Generic; @@ -48,7 +51,7 @@ public static void BakeGeometry_ByCategory(this RhinoDoc rhinoDoc, IEnumerable openings = ((IHostPartition)partition).GetOpenings(); if (openings == null || openings.Count == 0) @@ -74,4 +77,4 @@ public static void BakeGeometry_ByCategory(this RhinoDoc rhinoDoc, IEnumerable partitions_FixEdges = null; - if(partition is IHostPartition) + if (partition is IHostPartition) { partitions_FixEdges = ((IHostPartition)partition).FixEdges(cutOpenings)?.ConvertAll(x => x as IPartition); } @@ -64,12 +67,12 @@ public static void BakeGeometry_ByType(this RhinoDoc rhinoDoc, IEnumerable indexes = new List(); List layers = Query.Layers(layerTable, prefix, TextComparisonType.StartsWith, true); - if(layers != null || layers.Count != 0) + if (layers != null || layers.Count != 0) { - foreach(Layer layer in layers) + foreach (Layer layer in layers) { string text = layer.Name.Substring(prefix.Length); - if(!string.IsNullOrEmpty(text)) + if (!string.IsNullOrEmpty(text)) { int index = -1; if (int.TryParse(text, out index)) @@ -41,4 +44,4 @@ public static Layer AddLayer(this LayerTable layerTable, string prefix) } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Core.Rhino/Modify/AddSAMLayer.cs b/Rhino/SAM.Core.Rhino/Modify/AddSAMLayer.cs index 530f83b00..d93e536dc 100644 --- a/Rhino/SAM.Core.Rhino/Modify/AddSAMLayer.cs +++ b/Rhino/SAM.Core.Rhino/Modify/AddSAMLayer.cs @@ -1,4 +1,7 @@ -using Rhino.DocObjects; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino.DocObjects; using Rhino.DocObjects.Tables; namespace SAM.Core.Rhino @@ -10,4 +13,4 @@ public static Layer AddSAMLayer(this LayerTable layerTable) return AddLayer(layerTable, "SAM_"); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Core.Rhino/Modify/GetLayer.cs b/Rhino/SAM.Core.Rhino/Modify/GetLayer.cs index ccff207eb..2a32fbf0a 100644 --- a/Rhino/SAM.Core.Rhino/Modify/GetLayer.cs +++ b/Rhino/SAM.Core.Rhino/Modify/GetLayer.cs @@ -1,4 +1,7 @@ -using Rhino.DocObjects; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino.DocObjects; using Rhino.DocObjects.Tables; namespace SAM.Core.Rhino @@ -11,7 +14,7 @@ public static Layer GetLayer(this LayerTable layerTable, System.Guid parentId, s return null; int index = layerTable.Find(parentId, name, -1); - if(index == -1) + if (index == -1) { index = layerTable.Add(); layerTable[index].Name = name; @@ -23,4 +26,4 @@ public static Layer GetLayer(this LayerTable layerTable, System.Guid parentId, s return layerTable[index]; } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Core.Rhino/Modify/SetUserStrings.cs b/Rhino/SAM.Core.Rhino/Modify/SetUserStrings.cs index e958ca84a..1b203cf44 100644 --- a/Rhino/SAM.Core.Rhino/Modify/SetUserStrings.cs +++ b/Rhino/SAM.Core.Rhino/Modify/SetUserStrings.cs @@ -1,4 +1,7 @@ -using Rhino.DocObjects; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino.DocObjects; namespace SAM.Core.Rhino { @@ -9,7 +12,7 @@ public static bool SetUserStrings(this ObjectAttributes objectAttributes, SAMObj if (objectAttributes == null || sAMObject == null) return false; - foreach(string name in Core.Query.Names(sAMObject)) + foreach (string name in Core.Query.Names(sAMObject)) { if (sAMObject.TryGetValue(name, out string value, true)) objectAttributes.SetUserString(name, value); @@ -18,4 +21,4 @@ public static bool SetUserStrings(this ObjectAttributes objectAttributes, SAMObj return true; } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Core.Rhino/Query/Layers.cs b/Rhino/SAM.Core.Rhino/Query/Layers.cs index f80b5f5e3..b76ef3b1b 100644 --- a/Rhino/SAM.Core.Rhino/Query/Layers.cs +++ b/Rhino/SAM.Core.Rhino/Query/Layers.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core.Rhino { @@ -12,7 +15,7 @@ public static partial class Query List result = new List(); int count = layerTable.Count; - for(int i=0; i < count; i++) + for (int i = 0; i < count; i++) { global::Rhino.DocObjects.Layer layer = layerTable[i]; if (layer == null) @@ -27,4 +30,4 @@ public static partial class Query return result; } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/BoundingBox.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/BoundingBox.cs index ec6b9bae0..e425bf1d4 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/BoundingBox.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/BoundingBox.cs @@ -1,15 +1,18 @@ -namespace SAM.Geometry.Rhino +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Rhino { public static partial class Convert { public static global::Rhino.Geometry.BoundingBox ToRhino(this Spatial.BoundingBox3D boundingBox3D) { - if(boundingBox3D == null) + if (boundingBox3D == null) { return global::Rhino.Geometry.BoundingBox.Unset; } - + return new global::Rhino.Geometry.BoundingBox(boundingBox3D.Min.ToRhino(), boundingBox3D.Max.ToRhino()); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Brep.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Brep.cs index 228b9fc3e..69171a095 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Brep.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Brep.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -112,7 +115,7 @@ public static partial class Convert public static global::Rhino.Geometry.Brep ToRhino_Brep(this Triangle3D triangle3D, double tolerance = Core.Tolerance.Distance) { - if(triangle3D == null || !triangle3D.IsValid() || triangle3D.GetArea() < tolerance) + if (triangle3D == null || !triangle3D.IsValid() || triangle3D.GetArea() < tolerance) { return null; } @@ -128,7 +131,7 @@ public static partial class Convert double unitScale = Query.UnitScale(); global::Rhino.Geometry.Brep[] breps = global::Rhino.Geometry.Brep.CreatePlanarBreps(polylineCurves, unitScale * tolerance); - if(breps == null || breps.Length == 0) + if (breps == null || breps.Length == 0) { return null; } @@ -138,7 +141,7 @@ public static partial class Convert public static global::Rhino.Geometry.Brep ToRhino_Brep(this IClosedPlanar3D externalEdge3D, IEnumerable internalEdge3Ds, double tolerance = Core.Tolerance.Distance) { - if(externalEdge3D == null) + if (externalEdge3D == null) { return null; } @@ -148,22 +151,22 @@ public static partial class Convert IClosed2D externalEdge2D = plane.Convert(externalEdge3D); List internalEdge2Ds = null; - if(internalEdge3Ds != null) + if (internalEdge3Ds != null) { internalEdge2Ds = new List(); foreach (IClosedPlanar3D internalEdge3D in internalEdge3Ds) { IClosed2D internalEdge2D = plane.Convert(plane.Project(internalEdge3D)); - if(internalEdge2D != null) + if (internalEdge2D != null) { internalEdge2Ds.Add(internalEdge2D); } } } - List face3Ds = Spatial.Create.Face3Ds(externalEdge2D, internalEdge2Ds, plane, tolerance : tolerance); - if(face3Ds == null || face3Ds.Count == 0) + List face3Ds = Spatial.Create.Face3Ds(externalEdge2D, internalEdge2Ds, plane, tolerance: tolerance); + if (face3Ds == null || face3Ds.Count == 0) { return null; } @@ -172,25 +175,25 @@ public static partial class Convert foreach (Face3D face3D in face3Ds) { List face3Ds_FixEdges = face3D.FixEdges(); - if(face3Ds_FixEdges == null || face3Ds_FixEdges.Count == 0) + if (face3Ds_FixEdges == null || face3Ds_FixEdges.Count == 0) { face3Ds_FixEdges = new List() { face3D }; } - foreach(Face3D face3D_FixEdge in face3Ds_FixEdges) + foreach (Face3D face3D_FixEdge in face3Ds_FixEdges) { IClosedPlanar3D externalEdge3D_Face3D = face3D_FixEdge?.GetExternalEdge3D(); - if(externalEdge3D_Face3D != null) + if (externalEdge3D_Face3D != null) { closed3Ds.Add(externalEdge3D_Face3D); } List internalEdge3Ds_Face3D = face3D_FixEdge?.GetInternalEdge3Ds(); - if(internalEdge3Ds_Face3D != null) + if (internalEdge3Ds_Face3D != null) { - foreach(IClosedPlanar3D internalEdge3D_Face3D in internalEdge3Ds_Face3D) + foreach (IClosedPlanar3D internalEdge3D_Face3D in internalEdge3Ds_Face3D) { - if(internalEdge3D_Face3D == null) + if (internalEdge3D_Face3D == null) { continue; } @@ -264,4 +267,4 @@ public static partial class Convert return breps[0]; } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Curve.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Curve.cs index 878e6caf3..519f4ceba 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Curve.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Curve.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Rhino { @@ -19,4 +22,4 @@ public static partial class Convert return null; } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Line.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Line.cs index d3d7878e5..5efd43a39 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Line.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Line.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Rhino +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Rhino { public static partial class Convert { @@ -22,4 +25,4 @@ public static partial class Convert return new global::Rhino.Geometry.Line(segment2D[0].ToRhino(), segment2D[1].ToRhino()); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/LineCurve.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/LineCurve.cs index 15057b379..2e6396800 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/LineCurve.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/LineCurve.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Rhino +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Rhino { public static partial class Convert { @@ -7,4 +10,4 @@ public static partial class Convert return new global::Rhino.Geometry.LineCurve(segment3D[0].ToRhino(), segment3D[1].ToRhino()); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Mesh.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Mesh.cs index 502a97727..a2e784349 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Mesh.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Mesh.cs @@ -1,4 +1,7 @@ -using Rhino.Geometry; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino.Geometry; using System.Collections.Generic; namespace SAM.Geometry.Rhino @@ -7,7 +10,7 @@ public static partial class Convert { public static Mesh ToRhino(this Spatial.Mesh3D mesh3D) { - if(mesh3D == null) + if (mesh3D == null) { return null; } @@ -15,11 +18,11 @@ public static Mesh ToRhino(this Spatial.Mesh3D mesh3D) Mesh result = new Mesh(); List triangle3Ds = mesh3D.GetTriangles(); - if(triangle3Ds != null) + if (triangle3Ds != null) { - foreach(Spatial.Triangle3D triangle in triangle3Ds) + foreach (Spatial.Triangle3D triangle in triangle3Ds) { - if(triangle == null) + if (triangle == null) { continue; } @@ -27,7 +30,7 @@ public static Mesh ToRhino(this Spatial.Mesh3D mesh3D) List lines = triangle.GetSegments().ConvertAll(x => (Curve)x.ToRhino_LineCurve()); Mesh mesh = Mesh.CreateFromLines(lines.ToArray(), 3, Core.Tolerance.Distance); - if(mesh == null) + if (mesh == null) { continue; } @@ -38,17 +41,17 @@ public static Mesh ToRhino(this Spatial.Mesh3D mesh3D) return result; } - + public static Mesh ToRhino_Mesh(this Spatial.Face3D face3D) { Brep brep = face3D?.ToRhino_Brep(); - if(brep == null) + if (brep == null) { return null; } Mesh[] meshes = Mesh.CreateFromBrep(brep, ActiveSetting.GetMeshingParameters()); - if(meshes == null || meshes.Length == 0) + if (meshes == null || meshes.Length == 0) { return null; } @@ -97,4 +100,4 @@ public static Mesh ToRhino_Mesh(this Spatial.Shell shell) return mesh; } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Plane.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Plane.cs index 9e1024eeb..3cea009dd 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Plane.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Plane.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Rhino +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Rhino { public static partial class Convert { @@ -7,4 +10,4 @@ public static partial class Convert return new global::Rhino.Geometry.Plane(ToRhino(plane.Origin), ToRhino(plane.AxisX), ToRhino(plane.AxisY)); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Point3d.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Point3d.cs index 8aceb9e90..272d344f6 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Point3d.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Point3d.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Rhino +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Rhino { public static partial class Convert { @@ -6,7 +9,7 @@ public static partial class Convert { if (point3D == null) return global::Rhino.Geometry.Point3d.Unset; - + return new global::Rhino.Geometry.Point3d(point3D.X, point3D.Y, point3D.Z); } @@ -18,4 +21,4 @@ public static partial class Convert return new global::Rhino.Geometry.Point3d(point2D.X, point2D.Y, 0); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Polyline.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Polyline.cs index 6b817e4b9..4c99a1c47 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Polyline.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Polyline.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Rhino @@ -26,4 +29,4 @@ public static partial class Convert return new global::Rhino.Geometry.Polyline(curve3Ds.ConvertAll(x => x.GetStart().ToRhino())); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/PolylineCurve.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/PolylineCurve.cs index bfab99ebf..f4a3216f3 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/PolylineCurve.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/PolylineCurve.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -15,7 +18,7 @@ public static partial class Convert points.Add(curve3Ds.First().GetStart().ToRhino()); points.AddRange(curve3Ds.ToList().ConvertAll(x => x.GetEnd().ToRhino())); - + if (points == null || points.Count < 2) return null; @@ -77,4 +80,4 @@ public static partial class Convert return polylineCurve; } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Rectangle3d.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Rectangle3d.cs index bc5e16c94..5a9c2c4e1 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Rectangle3d.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Rectangle3d.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Rhino +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Rhino { public static partial class Convert { @@ -14,7 +17,7 @@ public static partial class Convert public static global::Rhino.Geometry.Rectangle3d ToRhino(this Planar.Rectangle2D rectangle2D) { - if(rectangle2D == null) + if (rectangle2D == null) { return global::Rhino.Geometry.Rectangle3d.Unset; } @@ -24,4 +27,4 @@ public static partial class Convert return ToRhino(Spatial.Query.Convert(plane, rectangle2D)); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Vector3d.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Vector3d.cs index d067d57c7..454fff8a5 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Vector3d.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToRhino/Vector3d.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Rhino +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Rhino { public static partial class Convert { @@ -12,4 +15,4 @@ public static partial class Convert return new global::Rhino.Geometry.Vector3d(vector2D.X, vector2D.Y, 0); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Circle3D.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Circle3D.cs index 184377a74..30536092a 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Circle3D.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Circle3D.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Rhino +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Rhino { public static partial class Convert { @@ -7,4 +10,4 @@ public static Spatial.Circle3D ToSAM(this global::Rhino.Geometry.Circle circle) return new Spatial.Circle3D(circle.Plane.ToSAM(), circle.Radius); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/IClosed3D.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/IClosed3D.cs index 2adc2d572..467fbdadc 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/IClosed3D.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/IClosed3D.cs @@ -1,4 +1,7 @@ -using Rhino.Geometry; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino.Geometry; using System.Collections.Generic; namespace SAM.Geometry.Rhino @@ -33,4 +36,4 @@ public static Spatial.IClosed3D ToSAM(this BrepLoop brepLoop, bool simplify = tr return null; } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/IGeometry3D.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/IGeometry3D.cs index eb2196e58..f74e91c33 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/IGeometry3D.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/IGeometry3D.cs @@ -1,4 +1,7 @@ -using Rhino.Geometry; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino.Geometry; using System.Collections.Generic; namespace SAM.Geometry.Rhino @@ -16,12 +19,12 @@ public static Spatial.ISAMGeometry3D ToSAM(this Curve curve, bool simplify = tru if (curve is LineCurve) return ((LineCurve)curve).ToSAM(); - if(curve.IsCircle()) + if (curve.IsCircle()) { - if(curve.TryGetCircle(out Circle circle)) + if (curve.TryGetCircle(out Circle circle)) { Spatial.Circle3D circle3D = new Spatial.Circle3D(circle.Plane.ToSAM(), circle.Radius); - if(!simplify) + if (!simplify) { return circle3D; } @@ -65,4 +68,4 @@ public static Spatial.ISAMGeometry3D ToSAM(this PolylineCurve polylineCurve, boo return new Spatial.Polyline3D(point3Ds, polylineCurve.IsClosed); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/IGeometry3Ds.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/IGeometry3Ds.cs index bc23e7a0b..19c72a5af 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/IGeometry3Ds.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/IGeometry3Ds.cs @@ -1,4 +1,7 @@ -using Rhino.Geometry; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino.Geometry; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -9,7 +12,7 @@ public static partial class Convert //In case of Non planar brep we mesh it and then convert to brep then merge cooplanar and then create ISAMGeometry public static List ToSAM(this Brep brep, bool simplify = true, bool orinetNormals = true, double tolerance = Core.Tolerance.Distance) { - if(brep == null) + if (brep == null) { return null; } @@ -29,11 +32,11 @@ public static List ToSAM(this Brep brep, bool simplify = true, b if (brepFaces != null && brepFaces.Count != 0) { - foreach(BrepFace brepFace in brepFaces) + foreach (BrepFace brepFace in brepFaces) { Mesh mesh = Mesh.CreateFromSurface(brepFace.UnderlyingSurface(), ActiveSetting.GetMeshingParameters()); Brep brep_Mesh = Brep.CreateFromMesh(mesh, true); - if(brep_Mesh != null) + if (brep_Mesh != null) { brep_Mesh.MergeCoplanarFaces(unitScale * tolerance); @@ -43,7 +46,7 @@ public static List ToSAM(this Brep brep, bool simplify = true, b } } - + List face3Ds = []; foreach (BrepFace brepFace in brepFaces_Planar) { @@ -53,7 +56,7 @@ public static List ToSAM(this Brep brep, bool simplify = true, b plane = plane_BrepFace.ToSAM(); Vector3D normal = brepFace.NormalAt(0.5, 0.5).ToSAM(); - if(normal != null) + if (normal != null) { if (!plane.Normal.SameHalf(normal)) { @@ -61,7 +64,7 @@ public static List ToSAM(this Brep brep, bool simplify = true, b } } } - + List closedPlanar3Ds = []; foreach (BrepLoop brepLoop in brepFace.Loops) { @@ -69,7 +72,7 @@ public static List ToSAM(this Brep brep, bool simplify = true, b if (geometry3D is Polycurve3D) { List point3Ds = ((Polycurve3D)geometry3D).Explode().ConvertAll(x => x.GetStart()); - if(plane == null) + if (plane == null) { PlaneFitResult planeFitResult = global::Rhino.Geometry.Plane.FitPlaneToPoints(point3Ds.ConvertAll(x => x.ToRhino()), out global::Rhino.Geometry.Plane plane_Rhino); if (planeFitResult != PlaneFitResult.Failure && plane_Rhino != null) @@ -83,11 +86,11 @@ public static List ToSAM(this Brep brep, bool simplify = true, b geometry3D = new Polygon3D(plane, point3Ds.ConvertAll(x => plane.Convert(plane.Project(x)))); } } - else if(geometry3D is Polyline3D) + else if (geometry3D is Polyline3D) { Polyline3D polyline3D = (Polyline3D)geometry3D; List point3Ds = polyline3D.Points; - if(polyline3D.IsClosed()) + if (polyline3D.IsClosed()) { point3Ds.RemoveAt(point3Ds.Count - 1); } @@ -117,15 +120,15 @@ public static List ToSAM(this Brep brep, bool simplify = true, b List result = []; - if(brep.IsSolid) + if (brep.IsSolid) { - Shell shell = new (face3Ds); - if(orinetNormals) + Shell shell = new(face3Ds); + if (orinetNormals) { shell.OrientNormals(); } - if(brepFaces != null && brepFaces.Count != 0) + if (brepFaces != null && brepFaces.Count != 0) { if (!shell.IsClosed(Core.Tolerance.MacroDistance)) { @@ -159,4 +162,4 @@ public static List ToSAM(this global::Rhino.Geometry.Surface sur return result; } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Mesh3D.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Mesh3D.cs index d6967e066..4511f676e 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Mesh3D.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Mesh3D.cs @@ -1,4 +1,7 @@ -using Rhino.Geometry; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino.Geometry; using Rhino.Geometry.Collections; using SAM.Geometry.Spatial; using System; @@ -7,10 +10,10 @@ namespace SAM.Geometry.Rhino { public static partial class Convert - { + { public static Mesh3D ToSAM(this Mesh mesh, double tolerance = Core.Tolerance.MicroDistance) { - if(mesh == null) + if (mesh == null) { return null; } @@ -67,7 +70,7 @@ public static Mesh3D ToSAM(this Mesh mesh, double tolerance = Core.Tolerance.Mic else if (meshFace.IsTriangle) { int index_1 = meshFace.A; - if(!sortedDictionary.ContainsKey(index_1)) + if (!sortedDictionary.ContainsKey(index_1)) { sortedDictionary[index_1] = meshVertexList[meshFace.A].ToSAM(); } @@ -107,4 +110,4 @@ public static Mesh3D ToSAM(this Mesh mesh, double tolerance = Core.Tolerance.Mic //return Spatial.Create.Mesh3D(triangle3Ds, tolerance); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Plane.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Plane.cs index f271ff644..ed06cbfa6 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Plane.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Plane.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Rhino +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Rhino { public static partial class Convert { @@ -7,4 +10,4 @@ public static Spatial.Plane ToSAM(this global::Rhino.Geometry.Plane plane) return new Spatial.Plane(plane.Origin.ToSAM(), plane.XAxis.ToSAM(), plane.YAxis.ToSAM()); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Point3D.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Point3D.cs index 0ed211eb3..0399feb8f 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Point3D.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Point3D.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Rhino +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Rhino { public static partial class Convert { @@ -16,4 +19,4 @@ public static Spatial.Point3D ToSAM(this global::Rhino.Geometry.Point point) return ToSAM(point.Location); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Polycurve3D.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Polycurve3D.cs index 1ed397408..ca979746c 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Polycurve3D.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Polycurve3D.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -19,21 +22,21 @@ public static ISAMGeometry3D ToSAM(this global::Rhino.Geometry.PolyCurve polyCur curve3Ds.Add(new Segment3D(curve.PointAtStart.ToSAM(), curve.PointAtEnd.ToSAM())); } - if(curve3Ds.TrueForAll(x => x is Segment3D)) + if (curve3Ds.TrueForAll(x => x is Segment3D)) { List point3Ds = new List(); - for(int i =0; i < curve3Ds.Count; i++) + for (int i = 0; i < curve3Ds.Count; i++) { point3Ds.Add(((Segment3D)curve3Ds[i]).GetStart()); } point3Ds.Add(((Segment3D)curve3Ds.Last()).GetEnd()); - if(point3Ds.Count > 2) + if (point3Ds.Count > 2) { - if(point3Ds.First().AlmostEquals(point3Ds.Last(), tolerance) && polyCurve.IsPlanar() && polyCurve.TryGetPlane(out global::Rhino.Geometry.Plane plane)) + if (point3Ds.First().AlmostEquals(point3Ds.Last(), tolerance) && polyCurve.IsPlanar() && polyCurve.TryGetPlane(out global::Rhino.Geometry.Plane plane)) { - Plane plane_SAM = plane.ToSAM(); + Plane plane_SAM = plane.ToSAM(); point3Ds.RemoveAt(0); return new Polygon3D(plane_SAM, point3Ds.ConvertAll(x => plane_SAM.Convert(x))); @@ -46,4 +49,4 @@ public static ISAMGeometry3D ToSAM(this global::Rhino.Geometry.PolyCurve polyCur return new Polycurve3D(curve3Ds); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Polyline3D.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Polyline3D.cs index b3380fbf6..c2033af4c 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Polyline3D.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Polyline3D.cs @@ -1,4 +1,7 @@ -using System.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Linq; namespace SAM.Geometry.Rhino { @@ -9,4 +12,4 @@ public static Spatial.Polyline3D ToSAM(this global::Rhino.Geometry.Polyline poly return new Spatial.Polyline3D(polyline.ToList().ConvertAll(x => x.ToSAM())); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Rectangle3D.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Rectangle3D.cs index 1a654d142..da57e23da 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Rectangle3D.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Rectangle3D.cs @@ -1,16 +1,19 @@ -namespace SAM.Geometry.Rhino +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Rhino { public static partial class Convert { public static Spatial.Rectangle3D ToSAM(this global::Rhino.Geometry.Rectangle3d rectangle3d) { - if(!rectangle3d.IsValid) + if (!rectangle3d.IsValid) { return null; } Spatial.Plane plane = rectangle3d.Plane.ToSAM(); - if(plane == null) + if (plane == null) { return null; } @@ -20,4 +23,4 @@ public static Spatial.Rectangle3D ToSAM(this global::Rhino.Geometry.Rectangle3d return new Spatial.Rectangle3D(plane, rectangle2D); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Segment3D.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Segment3D.cs index 367f4623f..9149ec03a 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Segment3D.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Segment3D.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Rhino +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Rhino { public static partial class Convert { @@ -12,4 +15,4 @@ public static Spatial.Segment3D ToSAM(this global::Rhino.Geometry.LineCurve line return new Spatial.Segment3D(lineCurve.PointAtStart.ToSAM(), lineCurve.PointAtEnd.ToSAM()); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Shell.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Shell.cs index a0c2f3971..d07c17ed7 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Shell.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Shell.cs @@ -1,4 +1,7 @@ -using Rhino.Geometry; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino.Geometry; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -12,7 +15,7 @@ public static Shell ToSAM_Shell(this Brep brep, bool simplify = true) { return null; } - + List sAMGeometry3Ds = ToSAM(brep, simplify); if (sAMGeometry3Ds == null || sAMGeometry3Ds.Count == 0) { @@ -26,7 +29,7 @@ public static Shell ToSAM_Shell(this Brep brep, bool simplify = true) } List face3Ds = []; - foreach(ISAMGeometry3D sAMGeometry3D in sAMGeometry3Ds) + foreach (ISAMGeometry3D sAMGeometry3D in sAMGeometry3Ds) { Face3D face3D = sAMGeometry3D as Face3D; if (face3D == null) @@ -47,7 +50,7 @@ public static Shell ToSAM_Shell(this Brep brep, bool simplify = true) public static Shell ToSAM_Shell(this global::Rhino.Geometry.Extrusion extrusion, bool simplify = true) { - if(extrusion is null) + if (extrusion is null) { return null; } @@ -55,4 +58,4 @@ public static Shell ToSAM_Shell(this global::Rhino.Geometry.Extrusion extrusion, return ToSAM_Shell(extrusion.ToBrep(simplify), simplify); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Transform3D.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Transform3D.cs index 94f5e10d1..50bee6b85 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Transform3D.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Transform3D.cs @@ -1,4 +1,7 @@ -using Rhino.Geometry; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino.Geometry; using SAM.Math; namespace SAM.Geometry.Rhino @@ -22,4 +25,4 @@ public static Spatial.Transform3D ToSAM(this Transform transform) return ToSAM_Transform3D(new global::Rhino.Geometry.Matrix(transform)); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Vector3D.cs b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Vector3D.cs index 0546ba572..5af90d4e7 100644 --- a/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Vector3D.cs +++ b/Rhino/SAM.Geometry.Rhino/Convert/ToSAM/Vector3D.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Rhino +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Rhino { public static partial class Convert { @@ -7,4 +10,4 @@ public static Spatial.Vector3D ToSAM(this global::Rhino.Geometry.Vector3d vector return new Spatial.Vector3D(vector3d.X, vector3d.Y, vector3d.Z); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Create/Shell.cs b/Rhino/SAM.Geometry.Rhino/Create/Shell.cs index 73d434427..fd631927c 100644 --- a/Rhino/SAM.Geometry.Rhino/Create/Shell.cs +++ b/Rhino/SAM.Geometry.Rhino/Create/Shell.cs @@ -1,4 +1,7 @@ -using Rhino.Geometry; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino.Geometry; using Rhino.Geometry.Collections; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -69,7 +72,7 @@ public static Shell Shell(this Mesh mesh, bool simplify = false, double toleranc { Face3D face3D = null; - List point3Ds = new List(); + List point3Ds = new List(); point3Ds.Add(meshVertexList[meshFace.A].ToSAM()); point3Ds.Add(meshVertexList[meshFace.B].ToSAM()); point3Ds.Add(meshVertexList[meshFace.C].ToSAM()); @@ -90,7 +93,7 @@ public static Shell Shell(this Mesh mesh, bool simplify = false, double toleranc face3D = new Face3D(new Triangle3D(point3Ds[0], point3Ds[1], point3Ds[2])); } - if(face3D == null) + if (face3D == null) { continue; } @@ -99,7 +102,7 @@ public static Shell Shell(this Mesh mesh, bool simplify = false, double toleranc } } - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return null; } @@ -110,4 +113,4 @@ public static Shell Shell(this Mesh mesh, bool simplify = false, double toleranc return result; } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Manager/ActiveSetting.cs b/Rhino/SAM.Geometry.Rhino/Manager/ActiveSetting.cs index 9c70f1e18..f75f35e70 100644 --- a/Rhino/SAM.Geometry.Rhino/Manager/ActiveSetting.cs +++ b/Rhino/SAM.Geometry.Rhino/Manager/ActiveSetting.cs @@ -1,4 +1,7 @@ -using Rhino.Geometry; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino.Geometry; using SAM.Core; using System.Reflection; @@ -14,7 +17,7 @@ public static class Name private static Setting setting = Load(); private static MeshingParameters meshingParameters; - + private static Setting Load() { Setting setting = ActiveManager.GetSetting(Assembly.GetExecutingAssembly()); diff --git a/Rhino/SAM.Geometry.Rhino/Modify/BakeGeometry.cs b/Rhino/SAM.Geometry.Rhino/Modify/BakeGeometry.cs index f2081320c..3be9e37b4 100644 --- a/Rhino/SAM.Geometry.Rhino/Modify/BakeGeometry.cs +++ b/Rhino/SAM.Geometry.Rhino/Modify/BakeGeometry.cs @@ -1,4 +1,7 @@ -using Rhino; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino; using Rhino.DocObjects; using Rhino.Geometry; using SAM.Geometry.Object; @@ -15,15 +18,15 @@ public static bool BakeGeometry(this ISAMGeometryObject sAMGeometryObject, Rhino guids = null; List sAMGeometries = Object.Convert.ToSAM_ISAMGeometry(sAMGeometryObject); - if(sAMGeometries == null || sAMGeometries.Count == 0) + if (sAMGeometries == null || sAMGeometries.Count == 0) { return false; } guids = new List(); - foreach(ISAMGeometry sAMGeometry in sAMGeometries) + foreach (ISAMGeometry sAMGeometry in sAMGeometries) { - if(BakeGeometry(sAMGeometry, rhinoDoc, objectAttributes, out Guid guid)) + if (BakeGeometry(sAMGeometry, rhinoDoc, objectAttributes, out Guid guid)) { guids.Add(guid); } @@ -116,4 +119,4 @@ public static bool BakeGeometry(this IEnumerable face3Ds, RhinoDoc rhino return true; } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Geometry.Rhino/Query/UnitScale.cs b/Rhino/SAM.Geometry.Rhino/Query/UnitScale.cs index 02a9f84f2..8cc7c8f43 100644 --- a/Rhino/SAM.Geometry.Rhino/Query/UnitScale.cs +++ b/Rhino/SAM.Geometry.Rhino/Query/UnitScale.cs @@ -1,4 +1,7 @@ -using Rhino; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Rhino; namespace SAM.Geometry.Rhino { @@ -11,7 +14,7 @@ public static double UnitScale() public static double UnitScale(RhinoDoc rhinoDoc) { - if(rhinoDoc == null) + if (rhinoDoc == null) { return double.NaN; } @@ -19,4 +22,4 @@ public static double UnitScale(RhinoDoc rhinoDoc) return RhinoMath.UnitScale(UnitSystem.Meters, rhinoDoc.ModelUnitSystem); } } -} \ No newline at end of file +} diff --git a/Rhino/SAM.Math.Rhino/Convert/ToRhino/Matrix.cs b/Rhino/SAM.Math.Rhino/Convert/ToRhino/Matrix.cs index b38693ba7..c79bf6f93 100644 --- a/Rhino/SAM.Math.Rhino/Convert/ToRhino/Matrix.cs +++ b/Rhino/SAM.Math.Rhino/Convert/ToRhino/Matrix.cs @@ -1,4 +1,7 @@ -namespace SAM.Math.Rhino +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math.Rhino { /// /// Provides methods to convert between different matrix types. diff --git a/Rhino/SAM.Math.Rhino/Convert/ToSAM/Matrix.cs b/Rhino/SAM.Math.Rhino/Convert/ToSAM/Matrix.cs index e6ddba04c..e994bab84 100644 --- a/Rhino/SAM.Math.Rhino/Convert/ToSAM/Matrix.cs +++ b/Rhino/SAM.Math.Rhino/Convert/ToSAM/Matrix.cs @@ -1,4 +1,7 @@ -namespace SAM.Math.Rhino +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math.Rhino { public static partial class Convert { @@ -12,7 +15,7 @@ public static Matrix ToSAM(this global::Rhino.Geometry.Matrix matrix) for (int j = 0; j < matrix.ColumnCount; j++) result[i, j] = matrix[i, j]; - if(result.IsSquare()) + if (result.IsSquare()) { if (matrix.RowCount == 2) return Create.Matrix2D(result); @@ -28,4 +31,4 @@ public static Matrix ToSAM(this global::Rhino.Geometry.Matrix matrix) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/AdjacencyCluster.cs b/SAM/SAM.Analytical/Classes/AdjacencyCluster.cs index 487e756a5..e19ed5d5a 100644 --- a/SAM/SAM.Analytical/Classes/AdjacencyCluster.cs +++ b/SAM/SAM.Analytical/Classes/AdjacencyCluster.cs @@ -1,4 +1,8 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Spatial; using System; @@ -215,7 +219,7 @@ public Aperture GetAperture(Guid guid, out Panel panel) if (panel_Temp.HasAperture(guid)) { result = panel_Temp.GetAperture(guid); - if(result != null) + if (result != null) { panel = panel_Temp; return result; diff --git a/SAM/SAM.Analytical/Classes/AirMovement/AirHandlingUnitAirMovement.cs b/SAM/SAM.Analytical/Classes/AirMovement/AirHandlingUnitAirMovement.cs index 7759be9cb..64c76f72f 100644 --- a/SAM/SAM.Analytical/Classes/AirMovement/AirHandlingUnitAirMovement.cs +++ b/SAM/SAM.Analytical/Classes/AirMovement/AirHandlingUnitAirMovement.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical @@ -10,7 +13,7 @@ public class AirHandlingUnitAirMovement : SAMObject, IAirMovementObject private Profile humidification; private Profile dehumidification; private Profile density; - + public AirHandlingUnitAirMovement(string name) : base(name) { @@ -30,7 +33,7 @@ public AirHandlingUnitAirMovement(string name, Profile heating, Profile cooling, public AirHandlingUnitAirMovement(AirHandlingUnitAirMovement airHandlingUnitAirMovement) : base(airHandlingUnitAirMovement) { - if(airHandlingUnitAirMovement != null) + if (airHandlingUnitAirMovement != null) { heating = airHandlingUnitAirMovement.heating == null ? null : new Profile(airHandlingUnitAirMovement.heating); cooling = airHandlingUnitAirMovement.cooling == null ? null : new Profile(airHandlingUnitAirMovement.cooling); @@ -93,7 +96,7 @@ public override bool FromJObject(JObject jObject) return false; } - if(jObject.ContainsKey("Heating")) + if (jObject.ContainsKey("Heating")) { heating = new Profile(jObject.Value("Heating")); } @@ -129,7 +132,7 @@ public override JObject ToJObject() return null; } - if(heating != null) + if (heating != null) { jObject.Add("Heating", heating.ToJObject()); } @@ -157,4 +160,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/AirMovement/SpaceAirMovement.cs b/SAM/SAM.Analytical/Classes/AirMovement/SpaceAirMovement.cs index 57f246b02..e9d7a3ede 100644 --- a/SAM/SAM.Analytical/Classes/AirMovement/SpaceAirMovement.cs +++ b/SAM/SAM.Analytical/Classes/AirMovement/SpaceAirMovement.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical @@ -9,7 +12,7 @@ public class SpaceAirMovement : SAMObject, IAirMovementObject private double airFlow; private string from; private string to; - + public SpaceAirMovement(string name, double airFlow, Profile profile, string from, string to) : base(name) { @@ -31,7 +34,7 @@ public SpaceAirMovement(string name, double airflow, string from, string to) public SpaceAirMovement(SpaceAirMovement spaceAirMovement) : base(spaceAirMovement) { - if(spaceAirMovement != null) + if (spaceAirMovement != null) { profile = spaceAirMovement.profile == null ? null : new Profile(spaceAirMovement.profile); airFlow = spaceAirMovement.airFlow; @@ -85,7 +88,7 @@ public override bool FromJObject(JObject jObject) return false; } - if(jObject.ContainsKey("AirFlow")) + if (jObject.ContainsKey("AirFlow")) { airFlow = jObject.Value("AirFlow"); } @@ -116,7 +119,7 @@ public override JObject ToJObject() return null; } - if(!double.IsNaN(airFlow)) + if (!double.IsNaN(airFlow)) { jObject.Add("AirFlow", airFlow); } @@ -139,4 +142,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/AirHandlingUnit.cs b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/AirHandlingUnit.cs index b647577f7..bf255da26 100644 --- a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/AirHandlingUnit.cs +++ b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/AirHandlingUnit.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -42,7 +45,7 @@ public AirHandlingUnit(JObject jObject) public AirHandlingUnit(AirHandlingUnit airHandlingUnit) : base(airHandlingUnit) { - if(airHandlingUnit != null) + if (airHandlingUnit != null) { winterSupplyTemperature = airHandlingUnit.winterSupplyTemperature; summerSupplyTemperature = airHandlingUnit.summerSupplyTemperature; @@ -83,7 +86,7 @@ public override bool FromJObject(JObject jObject) if (!base.FromJObject(jObject)) return false; - if(jObject.ContainsKey("SummerSupplyTemperature")) + if (jObject.ContainsKey("SummerSupplyTemperature")) { summerSupplyTemperature = jObject.Value("SummerSupplyTemperature"); } @@ -138,7 +141,7 @@ public override JObject ToJObject() if (jObject == null) return null; - if(!double.IsNaN(summerSupplyTemperature)) + if (!double.IsNaN(summerSupplyTemperature)) { jObject.Add("SummerSupplyTemperature", summerSupplyTemperature); } diff --git a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/Coil.cs b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/Coil.cs index 8175ab736..85e039159 100644 --- a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/Coil.cs +++ b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/Coil.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Analytical @@ -11,7 +14,7 @@ public abstract class Coil : SimpleEquipment, ISection private double fluidReturnTemperature = double.NaN; private double fluidSupplyTemperature = double.NaN; private double contactFactor = double.NaN; - + private bool summer = true; private double summerOffTemperature = double.NaN; @@ -47,7 +50,7 @@ public Coil(JObject jObject) public Coil(Coil coil) : base(coil) { - if(coil != null) + if (coil != null) { fluidReturnTemperature = coil.fluidReturnTemperature; fluidSupplyTemperature = coil.fluidSupplyTemperature; @@ -175,7 +178,7 @@ public override bool FromJObject(JObject jObject) if (!base.FromJObject(jObject)) return false; - if(jObject.ContainsKey("FluidReturnTemperature")) + if (jObject.ContainsKey("FluidReturnTemperature")) { fluidReturnTemperature = jObject.Value("FluidReturnTemperature"); } @@ -209,7 +212,7 @@ public override JObject ToJObject() if (jObject == null) return null; - if(!double.IsNaN(fluidSupplyTemperature)) + if (!double.IsNaN(fluidSupplyTemperature)) { jObject.Add("FluidSupplyTemperature", fluidSupplyTemperature); } diff --git a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/ComplexEquipment.cs b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/ComplexEquipment.cs index 9e69fe5ef..5c1aa614f 100644 --- a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/ComplexEquipment.cs +++ b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/ComplexEquipment.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; using System.Collections.Generic; @@ -38,17 +41,17 @@ public ComplexEquipment(Guid guid, string name) public bool AddSimpleEquipments(FlowClassification flowClassification, params ISimpleEquipment[] simpleEquipments) { - if(simpleEquipments == null || simpleEquipments.Length == 0) + if (simpleEquipments == null || simpleEquipments.Length == 0) { return false; } - if(complexEquipmentModel == null) + if (complexEquipmentModel == null) { complexEquipmentModel = new ComplexEquipmentModel(); } - if(simpleEquipments.Length == 1) + if (simpleEquipments.Length == 1) { complexEquipmentModel.Add(simpleEquipments[0]); } @@ -58,7 +61,7 @@ public bool AddSimpleEquipments(FlowClassification flowClassification, params IS public bool InsertAfterSimpleEquipment(FlowClassification flowClassification, ISimpleEquipment simpleEquipment_ToBeInserted, ISimpleEquipment simpleEquipment) { - if(complexEquipmentModel == null) + if (complexEquipmentModel == null) { return false; } @@ -78,12 +81,12 @@ public bool InsertBeforeSimpleEquipment(FlowClassification flowClassification, I public bool RemoveSimpleEquipment(ISimpleEquipment simpleEquipment) { - if(simpleEquipment == null) + if (simpleEquipment == null) { - return false; + return false; } - if(complexEquipmentModel == null) + if (complexEquipmentModel == null) { return false; } @@ -94,7 +97,7 @@ public bool RemoveSimpleEquipment(ISimpleEquipment simpleEquipment) public List GetSimpleEquipments(FlowClassification flowClassification, bool sort = true) { List result = complexEquipmentModel?.GetSimpleEquipments(flowClassification); - if(sort && result != null && result.Count > 1) + if (sort && result != null && result.Count > 1) { result = complexEquipmentModel.Sort(result, flowClassification, Direction.In); } @@ -102,7 +105,7 @@ public List GetSimpleEquipments(FlowClassification flowClassif return result; } - public List GetSimpleEquipments(FlowClassification flowClassification) where T: ISimpleEquipment + public List GetSimpleEquipments(FlowClassification flowClassification) where T : ISimpleEquipment { return GetSimpleEquipments(flowClassification, null); } @@ -115,15 +118,15 @@ public List GetSimpleEquipments() where T : ISimpleEquipment public List GetSimpleEquipments(FlowClassification flowClassification, Func func) where T : ISimpleEquipment { List simpleEquipments = complexEquipmentModel?.GetSimpleEquipments(flowClassification); - if(simpleEquipments == null || simpleEquipments.Count == 0) + if (simpleEquipments == null || simpleEquipments.Count == 0) { return null; } List result = new List(); - foreach(ISimpleEquipment simpleEquipment in simpleEquipments) + foreach (ISimpleEquipment simpleEquipment in simpleEquipments) { - if(!(simpleEquipment is T)) + if (!(simpleEquipment is T)) { continue; } @@ -152,7 +155,7 @@ public override bool FromJObject(JObject jObject) if (!base.FromJObject(jObject)) return false; - if(jObject.ContainsKey("ComplexEquipmentModel")) + if (jObject.ContainsKey("ComplexEquipmentModel")) { complexEquipmentModel = Core.Query.IJSAMObject(jObject.Value("ComplexEquipmentModel")); } @@ -166,7 +169,7 @@ public override JObject ToJObject() if (jObject == null) return null; - if(complexEquipmentModel != null) + if (complexEquipmentModel != null) { jObject.Add("ComplexEquipmentModel", complexEquipmentModel.ToJObject()); } diff --git a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/ComplexEquipmentModel.cs b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/ComplexEquipmentModel.cs index 439fc8760..ec822b4d6 100644 --- a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/ComplexEquipmentModel.cs +++ b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/ComplexEquipmentModel.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -13,10 +16,10 @@ public ComplexEquipmentModel() } public ComplexEquipmentModel(ComplexEquipmentModel complexEquipmentModel) - :base(complexEquipmentModel) + : base(complexEquipmentModel) { List simpleEquipments = complexEquipmentModel.GetObjects(); - if(simpleEquipments != null) + if (simpleEquipments != null) { simpleEquipments?.ForEach(x => AddObject(x?.Clone())); } @@ -46,7 +49,7 @@ public bool AddRelation(FlowClassification flowClassification, ISimpleEquipment public bool AddRelation(FlowClassification flowClassification, Direction direction, ISimpleEquipment simpleEquipment_1, ISimpleEquipment simpleEquipment_2) { - if(flowClassification == FlowClassification.Undefined || simpleEquipment_1 == null || simpleEquipment_2 == null) + if (flowClassification == FlowClassification.Undefined || simpleEquipment_1 == null || simpleEquipment_2 == null) { return false; } @@ -54,13 +57,13 @@ public bool AddRelation(FlowClassification flowClassification, Direction directi string id = null; id = Query.Id(flowClassification, direction); - if(string.IsNullOrWhiteSpace(id)) + if (string.IsNullOrWhiteSpace(id)) { return false; } bool result = AddRelation(id, simpleEquipment_1, simpleEquipment_2) != null; - if(!result) + if (!result) { return false; } @@ -90,7 +93,7 @@ public bool AddRelation(FlowClassification flowClassification, Direction directi public bool AddRelations(FlowClassification flowClassification, params ISimpleEquipment[] simpleEquipments) { - if(simpleEquipments == null || simpleEquipments.Length == 0) + if (simpleEquipments == null || simpleEquipments.Length == 0) { return false; } @@ -105,15 +108,15 @@ public bool AddRelations(FlowClassification flowClassification, Direction direct return false; } - if(simpleEquipments.Length == 1) + if (simpleEquipments.Length == 1) { return AddRelation(flowClassification, direction, simpleEquipments[0]); } bool result = false; - for (int i=0; i < simpleEquipments.Length - 1; i++) + for (int i = 0; i < simpleEquipments.Length - 1; i++) { - if(AddRelation(flowClassification, direction, simpleEquipments[i], simpleEquipments[i + 1])) + if (AddRelation(flowClassification, direction, simpleEquipments[i], simpleEquipments[i + 1])) { result = true; } @@ -134,18 +137,18 @@ public bool Replace(ISimpleEquipment simpleEquipment_ToBeReplaced, ISimpleEquipm public bool InsertAfter(FlowClassification flowClassification, ISimpleEquipment simpleEquipment_ToBeInserted, ISimpleEquipment simpleEquipment) { - if(simpleEquipment_ToBeInserted == null || simpleEquipment == null) + if (simpleEquipment_ToBeInserted == null || simpleEquipment == null) { return false; } - if(!Contains(simpleEquipment)) + if (!Contains(simpleEquipment)) { return false; } List simpleEquipments = GetSimpleEquipments(flowClassification); - if(simpleEquipments == null || simpleEquipments.Count == 0) + if (simpleEquipments == null || simpleEquipments.Count == 0) { return false; } @@ -155,7 +158,7 @@ public bool InsertAfter(FlowClassification flowClassification, ISimpleEquipment Reference reference = GetReference(simpleEquipment).Value; int index = simpleEquipments.FindIndex(x => GetReference(x).Value == reference); - if(index == -1) + if (index == -1) { return false; } @@ -241,18 +244,18 @@ public List GetSimpleEquipments(FlowClassification flowClassif return GetObjects(x => HasFlowClassification(x, flowClassification)); } - public List GetSimpleEquipments(FlowClassification flowClassification) where T: ISimpleEquipment + public List GetSimpleEquipments(FlowClassification flowClassification) where T : ISimpleEquipment { List simpleEquipments = GetSimpleEquipments(flowClassification); - if(simpleEquipments == null) + if (simpleEquipments == null) { return null; } List result = new List(); - foreach(ISimpleEquipment simpleEquipment in simpleEquipments) + foreach (ISimpleEquipment simpleEquipment in simpleEquipments) { - if(simpleEquipment is T) + if (simpleEquipment is T) { result.Add((T)simpleEquipment); } @@ -261,20 +264,20 @@ public List GetSimpleEquipments(FlowClassification flowClassification) whe return result; } - public List GetSimpleEquipments() where T: ISimpleEquipment + public List GetSimpleEquipments() where T : ISimpleEquipment { return GetObjects(x => x is T).ConvertAll(x => (T)x); } public List GetSimpleEquipments(ISimpleEquipment simpleEquipment, FlowClassification flowClassification, Direction direction) { - if(simpleEquipment == null) + if (simpleEquipment == null) { return null; } string id = Query.Id(flowClassification, direction); - if(string.IsNullOrWhiteSpace(id)) + if (string.IsNullOrWhiteSpace(id)) { return null; } @@ -285,7 +288,7 @@ public List GetSimpleEquipments(ISimpleEquipment simpleEquipme public HashSet GetFlowClassifications(ISimpleEquipment simpleEquipment) { RelationCollection relationCollection = GetRelations(simpleEquipment); - if(relationCollection == null) + if (relationCollection == null) { return null; } @@ -308,21 +311,21 @@ public HashSet GetFlowClassifications(ISimpleEquipment simpl public HashSet GetFlowClassifications() { List simpleEquipments = GetObjects(); - if(simpleEquipments == null) + if (simpleEquipments == null) { return null; } HashSet result = new HashSet(); - foreach(ISimpleEquipment simpleEquipment in simpleEquipments) + foreach (ISimpleEquipment simpleEquipment in simpleEquipments) { HashSet flowClassifications = GetFlowClassifications(simpleEquipment); - if(flowClassifications == null || flowClassifications.Count == 0) + if (flowClassifications == null || flowClassifications.Count == 0) { continue; } - foreach(FlowClassification flowClassification in flowClassifications) + foreach (FlowClassification flowClassification in flowClassifications) { result.Add(flowClassification); } @@ -334,7 +337,7 @@ public HashSet GetFlowClassifications() public bool HasFlowClassification(ISimpleEquipment simpleEquipment, FlowClassification flowClassification) { HashSet flowClassifications = GetFlowClassifications(simpleEquipment); - if(flowClassifications == null || flowClassifications.Count == 0) + if (flowClassifications == null || flowClassifications.Count == 0) { return false; } @@ -360,7 +363,7 @@ public HashSet GetDirections(ISimpleEquipment simpleEquipment, FlowCl continue; } - if(flowClassification_Temp != flowClassification) + if (flowClassification_Temp != flowClassification) { continue; } @@ -382,7 +385,7 @@ public HashSet GetDirections(ISimpleEquipment simpleEquipment, FlowCl /// /// Flow Calssification /// - public List TerminalSimpleEquipments(FlowClassification flowClassification) where T: ISimpleEquipment + public List TerminalSimpleEquipments(FlowClassification flowClassification) where T : ISimpleEquipment { List simpleEquipments = GetSimpleEquipments(flowClassification); if (simpleEquipments == null) @@ -390,7 +393,7 @@ public List TerminalSimpleEquipments(FlowClassification flowClassification return null; } - if(simpleEquipments.Count < 2) + if (simpleEquipments.Count < 2) { return simpleEquipments.FindAll(x => x is T).ConvertAll(x => (T)x); } @@ -402,7 +405,7 @@ public List TerminalSimpleEquipments(FlowClassification flowClassification List result = new List(); simpleEquipment = simpleEquipments.First(); - if(simpleEquipment is T) + if (simpleEquipment is T) { result.Add((T)simpleEquipment); } @@ -418,13 +421,13 @@ public List TerminalSimpleEquipments(FlowClassification flowClassification public List Sort(IEnumerable simpleEquipments, FlowClassification flowClassification, Direction direction) { - if(simpleEquipments == null) + if (simpleEquipments == null) { return null; } List result = new List(); - if(simpleEquipments.Count() == 0) + if (simpleEquipments.Count() == 0) { return result; } @@ -444,7 +447,7 @@ public List Sort(IEnumerable simpleEquipment } } - if(simpleEquipment_Current == null) + if (simpleEquipment_Current == null) { simpleEquipment_Current = simpleEquipments_Temp[0]; } @@ -453,13 +456,13 @@ public List Sort(IEnumerable simpleEquipment result.Add(simpleEquipment_Current); List simpleEquipments_Related = GetSimpleEquipments(simpleEquipment_Current, flowClassification, direction); - while(simpleEquipments_Related != null && simpleEquipments_Related.Count > 0) + while (simpleEquipments_Related != null && simpleEquipments_Related.Count > 0) { simpleEquipment_Current = simpleEquipments_Related[0]; simpleEquipments_Temp.Remove(simpleEquipment_Current); result.Add(simpleEquipment_Current); simpleEquipments_Related = GetSimpleEquipments(simpleEquipment_Current, flowClassification, direction); - if(simpleEquipments_Related != null && simpleEquipments_Related.Count > 0) + if (simpleEquipments_Related != null && simpleEquipments_Related.Count > 0) { foreach (ISimpleEquipment simpleEquipment in result) { @@ -474,25 +477,25 @@ public List Sort(IEnumerable simpleEquipment public bool FromJObject(JObject jObject) { - if(jObject == null) + if (jObject == null) { return false; } - if(jObject.ContainsKey("SimpleEquipments")) + if (jObject.ContainsKey("SimpleEquipments")) { JArray jArray = jObject.Value("SimpleEquipments"); - if(jArray != null) + if (jArray != null) { - foreach(JObject jObject_SimpleEquipment in jArray) + foreach (JObject jObject_SimpleEquipment in jArray) { - if(jObject_SimpleEquipment == null) + if (jObject_SimpleEquipment == null) { continue; } ISimpleEquipment simpleEquipment = Core.Query.IJSAMObject(jObject_SimpleEquipment); - if(simpleEquipment != null) + if (simpleEquipment != null) { Add(simpleEquipment); } @@ -500,7 +503,7 @@ public bool FromJObject(JObject jObject) } } - if(jObject.ContainsKey("Relations")) + if (jObject.ContainsKey("Relations")) { JArray jArray = jObject.Value("Relations"); if (jArray != null) @@ -529,13 +532,13 @@ public JObject ToJObject() JObject result = new JObject(); result.Add("_type", Core.Query.FullTypeName(this)); - List simpleEquipments = GetObjects(); - if(simpleEquipments != null) + List simpleEquipments = GetObjects(); + if (simpleEquipments != null) { JArray jArray = new JArray(); - foreach(ISimpleEquipment simpleEquipment in simpleEquipments) + foreach (ISimpleEquipment simpleEquipment in simpleEquipments) { - if(simpleEquipment == null) + if (simpleEquipment == null) { continue; } @@ -547,12 +550,12 @@ public JObject ToJObject() } RelationCollection relationCollection = GetRelations(); - if(relationCollection != null) + if (relationCollection != null) { JArray jArray = new JArray(); - foreach(Relation relation in relationCollection) + foreach (Relation relation in relationCollection) { - if(relation == null) + if (relation == null) { continue; } diff --git a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/CoolingCoil.cs b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/CoolingCoil.cs index c5dc9fe62..b50c02140 100644 --- a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/CoolingCoil.cs +++ b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/CoolingCoil.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Analytical diff --git a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/EmptySection.cs b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/EmptySection.cs index 3fb612f7e..02301d435 100644 --- a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/EmptySection.cs +++ b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/EmptySection.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Analytical diff --git a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/Fan.cs b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/Fan.cs index 175d54677..68276bef2 100644 --- a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/Fan.cs +++ b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/Fan.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Analytical diff --git a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/Filter.cs b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/Filter.cs index 3ea28c820..29e0405f6 100644 --- a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/Filter.cs +++ b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/Filter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Analytical @@ -69,7 +72,7 @@ public double Efficiency set { - if(double.IsNaN(value)) + if (double.IsNaN(value)) { efficiency = value; return; diff --git a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/HeatRecoveryUnit.cs b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/HeatRecoveryUnit.cs index d232cc634..b367ac3e6 100644 --- a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/HeatRecoveryUnit.cs +++ b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/HeatRecoveryUnit.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Analytical @@ -38,8 +41,8 @@ public HeatRecoveryUnit( this.summerDryBulbTemperature = summerDryBulbTemperature; } - public HeatRecoveryUnit(string name, - double winterSensibleEfficiency, + public HeatRecoveryUnit(string name, + double winterSensibleEfficiency, double winterLatentEfficiency, double summerSensibleEfficiency, double summerLatentEfficiency, @@ -68,7 +71,7 @@ public HeatRecoveryUnit(JObject jObject) public HeatRecoveryUnit(HeatRecoveryUnit heatRecoveryUnit) : base(heatRecoveryUnit) { - if(heatRecoveryUnit != null) + if (heatRecoveryUnit != null) { winterSensibleEfficiency = heatRecoveryUnit.winterSensibleEfficiency; winterLatentEfficiency = heatRecoveryUnit.winterLatentEfficiency; @@ -196,7 +199,7 @@ public override bool FromJObject(JObject jObject) if (!base.FromJObject(jObject)) return false; - if(jObject.ContainsKey("WinterSensibleEfficiency")) + if (jObject.ContainsKey("WinterSensibleEfficiency")) { winterSensibleEfficiency = jObject.Value("WinterSensibleEfficiency"); } @@ -245,7 +248,7 @@ public override JObject ToJObject() if (jObject == null) return null; - if(!double.IsNaN(winterSensibleEfficiency)) + if (!double.IsNaN(winterSensibleEfficiency)) { jObject.Add("WinterSensibleEfficiency", winterSensibleEfficiency); } diff --git a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/HeatingCoil.cs b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/HeatingCoil.cs index 050d11244..026dca82d 100644 --- a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/HeatingCoil.cs +++ b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/HeatingCoil.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Analytical @@ -17,7 +20,7 @@ public HeatingCoil(double fluidSupplyTemperature, double fluidReturnTemperature, public HeatingCoil(string name, double fluidSupplyTemperature, double fluidReturnTemperature, double contactFactor, double offTemperature) : base(name, fluidSupplyTemperature, fluidReturnTemperature, contactFactor, offTemperature) { - + } public HeatingCoil(string name, double fluidSupplyTemperature, double fluidReturnTemperature, double contactFactor, double summerOffTemperature, double winterOffTemperature) diff --git a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/Humidifier.cs b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/Humidifier.cs index f7301421f..1b5b57cf2 100644 --- a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/Humidifier.cs +++ b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/Humidifier.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Analytical diff --git a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/MixingSection.cs b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/MixingSection.cs index 4cf765c85..3f879dd03 100644 --- a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/MixingSection.cs +++ b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/MixingSection.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Analytical diff --git a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/Silencer.cs b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/Silencer.cs index 6073b9de7..3b08619a4 100644 --- a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/Silencer.cs +++ b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/Silencer.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Analytical diff --git a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/SimpleEquipment.cs b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/SimpleEquipment.cs index 1e7ff66a8..fc183ce20 100644 --- a/SAM/SAM.Analytical/Classes/AnalyticalEquipment/SimpleEquipment.cs +++ b/SAM/SAM.Analytical/Classes/AnalyticalEquipment/SimpleEquipment.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; diff --git a/SAM/SAM.Analytical/Classes/AnalyticalModel.cs b/SAM/SAM.Analytical/Classes/AnalyticalModel.cs index b84813d02..c936941a2 100644 --- a/SAM/SAM.Analytical/Classes/AnalyticalModel.cs +++ b/SAM/SAM.Analytical/Classes/AnalyticalModel.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Architectural; using SAM.Core; using SAM.Geometry; @@ -71,7 +74,7 @@ public AnalyticalModel(AnalyticalModel analyticalModel) return; description = analyticalModel.description; - + if (analyticalModel.location != null) location = new Location(analyticalModel.location); @@ -256,7 +259,7 @@ public MaterialLibrary MaterialLibrary name = value; } } - + public ProfileLibrary ProfileLibrary { get @@ -267,7 +270,7 @@ public ProfileLibrary ProfileLibrary return new ProfileLibrary(profileLibrary); } } - + public bool AddInternalCondition(InternalCondition internalCondition) { if (internalCondition == null) @@ -465,7 +468,7 @@ public List GetApertures(Func func = null) continue; } - if(func is not null) + if (func is not null) { apertures = apertures.FindAll(func.Invoke); } @@ -674,7 +677,7 @@ public List GetZones() { return adjacencyCluster?.GetZones(); } - + public bool HasMaterial(IMaterial material) { if (material == null || materialLibrary == null) @@ -712,7 +715,7 @@ public List Remove(Type type, IEnumerable guids) { if (type == null || guids == null) return null; - + if (typeof(Space).IsAssignableFrom(type) || typeof(Panel).IsAssignableFrom(type) || typeof(Aperture).IsAssignableFrom(type) || typeof(Result).IsAssignableFrom(type) || typeof(Group).IsAssignableFrom(type) || typeof(MechanicalSystem).IsAssignableFrom(type) || typeof(SpaceAirMovement).IsAssignableFrom(type) || typeof(AirHandlingUnitAirMovement).IsAssignableFrom(type) || typeof(IAnalyticalEquipment).IsAssignableFrom(type)) { return adjacencyCluster.Remove(type, guids); @@ -730,7 +733,7 @@ public List Remove(IEnumerable sAMObjects) Dictionary> dictionary = Core.Query.TypeDictionary(sAMObjects); List result = new List(); - foreach(KeyValuePair> keyValuePair in dictionary) + foreach (KeyValuePair> keyValuePair in dictionary) { List guids = Remove(keyValuePair.Key, keyValuePair.Value.ConvertAll(x => x.Guid)); if (guids != null && guids.Count > 0) @@ -739,7 +742,7 @@ public List Remove(IEnumerable sAMObjects) return result; } - + public List ReplaceApertureConstruction(IEnumerable guids, ApertureConstruction apertureConstruction) { return adjacencyCluster?.ReplaceApertureConstruction(guids, apertureConstruction); @@ -749,11 +752,11 @@ public List ReplaceConstruction(IEnumerable guids, Construction con { return adjacencyCluster?.ReplaceConstruction(guids, construction, apertureConstruction, offset); } - + public List ReplaceTransparentPanels(double offset = 0) { List result = adjacencyCluster?.ReplaceTransparentPanels(materialLibrary, offset); - if(result != null && result.Count > 0) + if (result != null && result.Count > 0) { IEnumerable materials = Query.Materials(result, ActiveSetting.Setting.GetValue(AnalyticalSettingParameter.DefaultMaterialLibrary)); if (materials != null) @@ -762,7 +765,7 @@ public List ReplaceTransparentPanels(double offset = 0) } return result; } - + public override JObject ToJObject() { JObject jObject = base.ToJObject(); @@ -789,11 +792,21 @@ public override JObject ToJObject() return jObject; } - + public void Transform(Transform3D transform3D) { if (adjacencyCluster != null) adjacencyCluster.Transform(transform3D); } + + public TJSAMObject GetObject(ObjectReference objectReference) where TJSAMObject : IJSAMObject + { + if (adjacencyCluster.GetObject(objectReference) is not TJSAMObject result) + { + return default; + } + + return result; + } } } diff --git a/SAM/SAM.Analytical/Classes/Aperture.cs b/SAM/SAM.Analytical/Classes/Aperture.cs index 797a4470d..3ce3a0fe4 100644 --- a/SAM/SAM.Analytical/Classes/Aperture.cs +++ b/SAM/SAM.Analytical/Classes/Aperture.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry; @@ -125,7 +128,7 @@ public List GetFace3Ds(AperturePart aperturePart) //Added 18.06.2024 -> Requested by Michal ApertureConstruction apertureConstruction = Type; List constructionLayers = apertureConstruction.FrameConstructionLayers; - if(constructionLayers == null || constructionLayers.Count == 0) + if (constructionLayers == null || constructionLayers.Count == 0) { switch (aperturePart) { @@ -138,15 +141,15 @@ public List GetFace3Ds(AperturePart aperturePart) } List internalEdge2Ds = face3D.InternalEdge2Ds; - if(internalEdge2Ds == null || internalEdge2Ds.Count == 0) + if (internalEdge2Ds == null || internalEdge2Ds.Count == 0) { double frameWidth = 0; - if(apertureConstruction != null) + if (apertureConstruction != null) { double frameThickness = apertureConstruction.GetFrameThickness(); - if(!double.IsNaN(frameThickness) && frameThickness > 0) + if (!double.IsNaN(frameThickness) && frameThickness > 0) { if (apertureConstruction.TryGetValue(ApertureConstructionParameter.DefaultFrameWidth, out double frameThickness_Temp)) { @@ -160,7 +163,7 @@ public List GetFace3Ds(AperturePart aperturePart) } } - if(!double.IsNaN(frameWidth) && frameWidth != 0) + if (!double.IsNaN(frameWidth) && frameWidth != 0) { Plane plane = face3D.GetPlane(); Geometry.Planar.Face2D face2D = plane.Convert(face3D); @@ -193,12 +196,12 @@ public List GetFace3Ds(AperturePart aperturePart) public Face3D GetFrameFace3D() { List face3Ds = GetFace3Ds(AperturePart.Frame); - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return null; } - if(face3Ds.Count > 0) + if (face3Ds.Count > 0) { face3Ds.Sort((x, y) => y.GetArea().CompareTo(x.GetArea())); } @@ -244,7 +247,7 @@ public double GetPaneArea() public double GetArea(AperturePart aperturePart) { List face3Ds = GetFace3Ds(aperturePart); - if(face3Ds == null || face3Ds.Count ==0) + if (face3Ds == null || face3Ds.Count == 0) { return 0; } @@ -259,13 +262,13 @@ public double GetArea(AperturePart aperturePart) public double GetFrameFactor() { double area_Frame = GetArea(AperturePart.Frame); - if(double.IsNaN(area_Frame) || area_Frame == 0) + if (double.IsNaN(area_Frame) || area_Frame == 0) { return 0; } double area_Pane = GetArea(AperturePart.Pane); - if(double.IsNaN(area_Pane) || area_Pane == 0) + if (double.IsNaN(area_Pane) || area_Pane == 0) { return 1; } @@ -275,13 +278,13 @@ public double GetFrameFactor() public double GetThickness(AperturePart aperturePart) { - if(aperturePart == AperturePart.Undefined) + if (aperturePart == AperturePart.Undefined) { return double.NaN; } ApertureConstruction apertureConstruction = Type; - if(apertureConstruction == null) + if (apertureConstruction == null) { return double.NaN; } @@ -312,31 +315,31 @@ public double GetWidth() public double GetWidth(AperturePart aperturePart) { - if(aperturePart == AperturePart.Undefined) + if (aperturePart == AperturePart.Undefined) { return double.NaN; } - switch(aperturePart) + switch (aperturePart) { case AperturePart.Frame: return Query.Width(planarBoundary3D); case AperturePart.Pane: List face3Ds = GetFace3Ds(aperturePart); - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return double.NaN; } double result = 0; - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { PlanarBoundary3D planarBoundary3D_Temp = new PlanarBoundary3D(face3D); result += Query.Width(planarBoundary3D_Temp); } - - if(result == 0) + + if (result == 0) { return double.NaN; } @@ -486,11 +489,11 @@ public PlanarBoundary3D PlanarBoundary3D { get { - if(planarBoundary3D == null) + if (planarBoundary3D == null) { return null; } - + return new PlanarBoundary3D(planarBoundary3D); } } @@ -511,4 +514,4 @@ public void FlipNormal(bool flipX = true) planarBoundary3D = new PlanarBoundary3D(face3D); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/ApertureConstruction.cs b/SAM/SAM.Analytical/Classes/ApertureConstruction.cs index 147f2fda3..76cf363f7 100644 --- a/SAM/SAM.Analytical/Classes/ApertureConstruction.cs +++ b/SAM/SAM.Analytical/Classes/ApertureConstruction.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; using System.Collections.Generic; @@ -119,12 +122,12 @@ public bool HasPaneConstructionLayers() public List GetConstructionLayers(AperturePart aperturePart) { - if(aperturePart == AperturePart.Undefined) + if (aperturePart == AperturePart.Undefined) { return null; } - switch(aperturePart) + switch (aperturePart) { case AperturePart.Frame: return FrameConstructionLayers; @@ -138,13 +141,13 @@ public List GetConstructionLayers(AperturePart aperturePart) public double GetThickness(AperturePart aperturePart) { - if(aperturePart == AperturePart.Undefined) + if (aperturePart == AperturePart.Undefined) { return double.NaN; } List constructionLayers = GetConstructionLayers(aperturePart); - if(constructionLayers == null || constructionLayers.Count == 0) + if (constructionLayers == null || constructionLayers.Count == 0) { return 0; } @@ -157,7 +160,7 @@ public double GetThickness() double paneThickness = GetPaneThickness(); double frameThickness = GetFrameThickness(); - if(double.IsNaN(paneThickness) && double.IsNaN(frameThickness)) + if (double.IsNaN(paneThickness) && double.IsNaN(frameThickness)) { return double.NaN; } @@ -220,4 +223,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/ApertureConstructionLibrary.cs b/SAM/SAM.Analytical/Classes/ApertureConstructionLibrary.cs index de14bbee0..06e053897 100644 --- a/SAM/SAM.Analytical/Classes/ApertureConstructionLibrary.cs +++ b/SAM/SAM.Analytical/Classes/ApertureConstructionLibrary.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; using System.Collections.Generic; @@ -111,7 +114,7 @@ public List GetApertureConstructions(string text, TextComp return null; List result = new List(); - foreach(ApertureConstruction apertureConstruction in apertureConstructions) + foreach (ApertureConstruction apertureConstruction in apertureConstructions) { if (apertureConstruction == null) continue; @@ -123,4 +126,4 @@ public List GetApertureConstructions(string text, TextComp return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Boundary2D.cs b/SAM/SAM.Analytical/Classes/Boundary2D.cs index 61693d914..b183276a8 100644 --- a/SAM/SAM.Analytical/Classes/Boundary2D.cs +++ b/SAM/SAM.Analytical/Classes/Boundary2D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -24,7 +27,7 @@ public class Boundary2D : SAMObject, IAnalyticalObject /// The boundary2d. public Boundary2D(Boundary2D boundary2D) { - if(boundary2D != null) + if (boundary2D != null) { externalEdge2DLoop = new BoundaryEdge2DLoop(boundary2D.externalEdge2DLoop); if (boundary2D.internalEdge2DLoops != null) @@ -43,7 +46,7 @@ public Boundary2D(BoundaryEdge2DLoop edge2DLoop) { externalEdge2DLoop = edge2DLoop == null ? null : new BoundaryEdge2DLoop(edge2DLoop); } - + /// /// Initializes a new instance of the class. /// Replaces geometry closedPlanar3D for Analytical Boundary2D including internal and external @@ -345,4 +348,4 @@ public static List Create(List edge2DLoops) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/BoundaryEdge2D.cs b/SAM/SAM.Analytical/Classes/BoundaryEdge2D.cs index ce6014033..a935e79d7 100644 --- a/SAM/SAM.Analytical/Classes/BoundaryEdge2D.cs +++ b/SAM/SAM.Analytical/Classes/BoundaryEdge2D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Planar; using System.Collections.Generic; @@ -104,4 +107,4 @@ public static IEnumerable FromGeometry(Geometry.Spatial.ISAMGeom return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/BoundaryEdge2DLoop.cs b/SAM/SAM.Analytical/Classes/BoundaryEdge2DLoop.cs index e2d84cdff..632ad3695 100644 --- a/SAM/SAM.Analytical/Classes/BoundaryEdge2DLoop.cs +++ b/SAM/SAM.Analytical/Classes/BoundaryEdge2DLoop.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Planar; using System.Collections.Generic; @@ -92,7 +95,7 @@ public double GetPerimeter() return double.NaN; double perimeter = 0; - foreach(BoundaryEdge2D boundaryEdge2D in boundaryEdge2Ds) + foreach (BoundaryEdge2D boundaryEdge2D in boundaryEdge2Ds) { ICurve2D curve2D = boundaryEdge2D.Curve2D; if (curve2D == null) @@ -151,4 +154,4 @@ public static IClosed2D ToGeometry(BoundaryEdge2DLoop boundaryEdge2DLoop) return new Polygon2D(point2Ds); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/BoundaryEdge3D.cs b/SAM/SAM.Analytical/Classes/BoundaryEdge3D.cs index 7719d76e8..912841950 100644 --- a/SAM/SAM.Analytical/Classes/BoundaryEdge3D.cs +++ b/SAM/SAM.Analytical/Classes/BoundaryEdge3D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Spatial; using System; @@ -96,7 +99,7 @@ public ICurve3D Curve3D public void Flip() { - if(curve3D is Segment3D) + if (curve3D is Segment3D) { ((Segment3D)curve3D).Reverse(); return; @@ -153,4 +156,4 @@ public static IEnumerable FromGeometry(ISAMGeometry3D geometry3D return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/BoundaryEdge3DLoop.cs b/SAM/SAM.Analytical/Classes/BoundaryEdge3DLoop.cs index 27d700c76..07df257f8 100644 --- a/SAM/SAM.Analytical/Classes/BoundaryEdge3DLoop.cs +++ b/SAM/SAM.Analytical/Classes/BoundaryEdge3DLoop.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -39,7 +42,7 @@ public BoundingBox3D GetBoundingBox(double offset = 0) { if (boundaryEdge3Ds == null) return null; - + return new BoundingBox3D(boundaryEdge3Ds.ConvertAll(x => x.GetBoundingBox(offset))); } @@ -51,7 +54,7 @@ public void Snap(IEnumerable point3Ds, double maxDistance = double.NaN) public void Transform(Transform3D transform3D) { - if (boundaryEdge3Ds == null || boundaryEdge3Ds.Count == 0|| transform3D == null) + if (boundaryEdge3Ds == null || boundaryEdge3Ds.Count == 0 || transform3D == null) return; boundaryEdge3Ds.ForEach(x => x.Transform(transform3D)); @@ -76,4 +79,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Case/ApertureCase.cs b/SAM/SAM.Analytical/Classes/Case/ApertureCase.cs new file mode 100644 index 000000000..4c35f4642 --- /dev/null +++ b/SAM/SAM.Analytical/Classes/Case/ApertureCase.cs @@ -0,0 +1,263 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; + +namespace SAM.Analytical.Classes +{ + public class ApertureCase : Case + { + private double apertureHeight; + private ApertureToPanelRatios apertureToPanelRatios; + private CaseSelection caseSelection; + private double horizontalSeparation; + private bool keepSeparationDistance; + private double offset; + private double sillHeight; + private bool subdivide; + + public ApertureCase() + : base() + { + + } + + public ApertureCase(ApertureToPanelRatios apertureToPanelRatios, bool subdivide, double apertureHeight, double sillHeight, double horizontalSeparation, double offset, bool keepSeparationDistance, CaseSelection caseSelection) + : base() + { + this.apertureToPanelRatios = apertureToPanelRatios == null ? null : new ApertureToPanelRatios(apertureToPanelRatios); + this.subdivide = subdivide; + this.apertureHeight = apertureHeight; + this.sillHeight = sillHeight; + this.horizontalSeparation = horizontalSeparation; + this.offset = offset; + this.keepSeparationDistance = keepSeparationDistance; + this.caseSelection = caseSelection; + } + + public ApertureCase(JObject jObject) + : base(jObject) + { + + } + + public ApertureCase(ApertureCase apertureCase) + : base(apertureCase) + { + if (apertureCase != null) + { + apertureToPanelRatios = apertureCase.apertureToPanelRatios; + subdivide = apertureCase.subdivide; + apertureHeight = apertureCase.apertureHeight; + sillHeight = apertureCase.sillHeight; + horizontalSeparation = apertureCase.horizontalSeparation; + offset = apertureCase.offset; + keepSeparationDistance = apertureCase.keepSeparationDistance; + caseSelection = apertureCase.caseSelection; + } + } + + public double ApertureHeight + { + get + { + return apertureHeight; + } + + set + { + apertureHeight = value; + OnPropertyChanged(nameof(ApertureHeight)); + } + } + + public ApertureToPanelRatios ApertureToPanelRatios + { + get + { + return apertureToPanelRatios; + } + set + { + apertureToPanelRatios = value; + OnPropertyChanged(nameof(ApertureToPanelRatios)); + } + } + + public CaseSelection CaseSelection + { + get + { + return caseSelection; + } + + set + { + caseSelection = value; + OnPropertyChanged(nameof(CaseSelection)); + } + } + + public double HorizontalSeparation + { + get + { + return horizontalSeparation; + } + + set + { + horizontalSeparation = value; + OnPropertyChanged(nameof(HorizontalSeparation)); + } + } + + public bool KeepSeparationDistance + { + get + { + return keepSeparationDistance; + } + + set + { + keepSeparationDistance = value; + OnPropertyChanged(nameof(KeepSeparationDistance)); + } + } + + public double Offset + { + get + { + return offset; + } + + set + { + offset = value; + OnPropertyChanged(nameof(Offset)); + } + } + + public double SillHeight + { + get + { + return sillHeight; + } + + set + { + sillHeight = value; + OnPropertyChanged(nameof(SillHeight)); + } + } + + public bool Subdivide + { + get + { + return subdivide; + } + + set + { + subdivide = value; + OnPropertyChanged(nameof(Subdivide)); + } + } + + public override bool FromJObject(JObject jObject) + { + bool result = base.FromJObject(jObject); + if (!result) + { + return false; + } + + if (jObject.ContainsKey("ApertureToPanelRatios")) + { + apertureToPanelRatios = Core.Query.IJSAMObject(jObject.Value("ApertureToPanelRatios")); + } + + if (jObject.ContainsKey("Subdivide")) + { + subdivide = jObject.Value("Subdivide"); + } + + if (jObject.ContainsKey("ApertureHeight")) + { + apertureHeight = jObject.Value("ApertureHeight"); + } + + if (jObject.ContainsKey("SillHeight")) + { + sillHeight = jObject.Value("SillHeight"); + } + + if (jObject.ContainsKey("HorizontalSeparation")) + { + horizontalSeparation = jObject.Value("HorizontalSeparation"); + } + + if (jObject.ContainsKey("Offset")) + { + offset = jObject.Value("Offset"); + } + + if (jObject.ContainsKey("CaseSelection")) + { + caseSelection = Core.Query.IJSAMObject(jObject.Value("CaseSelection")); + } + + return true; + } + + public override JObject ToJObject() + { + JObject result = base.ToJObject(); + if (result is null) + { + return result; + } + + if (apertureToPanelRatios != null) + { + result.Add("ApertureToPanelRatios", apertureToPanelRatios.ToJObject()); + } + + result.Add("Subdivide", subdivide); + + if (!double.IsNaN(apertureHeight)) + { + result.Add("ApertureHeight", apertureHeight); + } + + if (!double.IsNaN(sillHeight)) + { + result.Add("SillHeight", sillHeight); + } + + if (!double.IsNaN(horizontalSeparation)) + { + result.Add("HorizontalSeparation", horizontalSeparation); + } + + if (!double.IsNaN(offset)) + { + result.Add("Offset", offset); + } + + result.Add("KeepSeparationDistance", keepSeparationDistance); + + if (caseSelection != null) + { + result.Add("CaseSelection", caseSelection.ToJObject()); + result.Add("CaseSelection", caseSelection.ToJObject()); + } + + return result; + } + } +} diff --git a/SAM/SAM.Analytical/Classes/Case/ApertureConstructionCase.cs b/SAM/SAM.Analytical/Classes/Case/ApertureConstructionCase.cs new file mode 100644 index 000000000..40f20d0bb --- /dev/null +++ b/SAM/SAM.Analytical/Classes/Case/ApertureConstructionCase.cs @@ -0,0 +1,106 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; + +namespace SAM.Analytical.Classes +{ + public class ApertureConstructionCase : Case, ISelectiveCase + { + private ApertureConstruction apertureConstruction; + private CaseSelection caseSelection; + + public ApertureConstructionCase(ApertureConstruction apertureConstruction, CaseSelection caseSelection) + : base() + { + this.apertureConstruction = apertureConstruction; + this.caseSelection = caseSelection; + } + + public ApertureConstructionCase(ApertureConstructionCase apertureConstructionCase) + : base(apertureConstructionCase) + { + if (apertureConstructionCase != null) + { + apertureConstruction = apertureConstructionCase.apertureConstruction; + caseSelection = apertureConstructionCase.caseSelection; + } + } + + public ApertureConstructionCase(JObject jObject) + : base(jObject) + { + + } + + public ApertureConstruction ApertureConstruction + { + get + { + return apertureConstruction; + } + + set + { + apertureConstruction = value; + OnPropertyChanged(nameof(ApertureConstruction)); + } + } + + public CaseSelection CaseSelection + { + get + { + return caseSelection; + } + + set + { + caseSelection = value; + OnPropertyChanged(nameof(CaseSelection)); + } + } + + public override bool FromJObject(JObject jObject) + { + bool result = base.FromJObject(jObject); + if (!result) + { + return false; + } + + if (jObject.ContainsKey("ApertureConstruction")) + { + apertureConstruction = Core.Query.IJSAMObject(jObject.Value("ApertureConstruction")); + } + + if (jObject.ContainsKey("CaseSelection")) + { + caseSelection = Core.Query.IJSAMObject(jObject.Value("CaseSelection")); + } + + return true; + } + + public override JObject ToJObject() + { + JObject result = base.ToJObject(); + if (result is null) + { + return result; + } + + if (apertureConstruction != null) + { + result.Add("ApertureConstruction", apertureConstruction.ToJObject()); + } + + if (caseSelection != null) + { + result.Add("CaseSelection", caseSelection.ToJObject()); + } + + return result; + } + } +} diff --git a/SAM/SAM.Analytical/Classes/Case/ApertureToPanelRatio.cs b/SAM/SAM.Analytical/Classes/Case/ApertureToPanelRatio.cs new file mode 100644 index 000000000..14a5ebd5c --- /dev/null +++ b/SAM/SAM.Analytical/Classes/Case/ApertureToPanelRatio.cs @@ -0,0 +1,177 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; +using SAM.Core; + +namespace SAM.Analytical.Classes +{ + public class ApertureToPanelRatio : IJSAMObject + { + private ApertureConstruction apertureConstruction; + private Range azimuthRange; + private double ratio; + + public ApertureToPanelRatio(Range azimuthRange, double ratio, ApertureConstruction apertureConstruction) + { + this.azimuthRange = azimuthRange; + this.ratio = ratio; + this.apertureConstruction = apertureConstruction; + } + + public ApertureToPanelRatio(JObject jObject) + { + FromJObject(jObject); + } + + public ApertureToPanelRatio(ApertureToPanelRatio apertureToPanelRatio) + { + if (apertureToPanelRatio != null) + { + azimuthRange = apertureToPanelRatio.AzimuthRange; + ratio = apertureToPanelRatio.Ratio; + apertureConstruction = apertureToPanelRatio.ApertureConstruction; + } + } + + public ApertureConstruction ApertureConstruction + { + get + { + return apertureConstruction; + } + + set + { + apertureConstruction = value; + } + } + + public string ApertureConstructionName + { + get + { + return apertureConstruction?.Name; + } + } + + public Range AzimuthRange + { + get + { + return azimuthRange; + } + } + + public double Max + { + get + { + if (azimuthRange is null) + { + azimuthRange = new Range(0.0, 0.0); + } + + return azimuthRange.Max; + } + + set + { + if (azimuthRange is null) + { + azimuthRange = new Range(value, value); + } + else + { + azimuthRange = new Range(azimuthRange.Min, value); + } + } + } + + public double Min + { + get + { + if (azimuthRange is null) + { + azimuthRange = new Range(0.0, 0.0); + } + + return azimuthRange.Min; + } + + set + { + if (azimuthRange is null) + { + azimuthRange = new Range(value, value); + } + else + { + azimuthRange = new Range(value, azimuthRange.Max); + } + } + } + + public double Ratio + { + get + { + return ratio; + } + + set + { + ratio = value; + } + } + + public virtual bool FromJObject(JObject jObject) + { + if (jObject == null) + { + return false; + } + + if (jObject.ContainsKey("Ratio")) + { + ratio = jObject.Value("Ratio"); + } + + if (jObject.ContainsKey("AzimuthRange")) + { + azimuthRange = Core.Query.IJSAMObject>(jObject.Value("AzimuthRange")); + } + + if (jObject.ContainsKey("ApertureConstruction")) + { + apertureConstruction = Core.Query.IJSAMObject(jObject.Value("ApertureConstruction")); + } + + return true; + } + + public virtual JObject ToJObject() + { + JObject result = new(); + result.Add("_type", Core.Query.FullTypeName(this)); + + if (azimuthRange != null) + { + result.Add("AzimuthRange", azimuthRange.ToJObject()); + } + + if (double.IsNaN(ratio)) + { + result.Add("Ratio", ratio); + } + + if (apertureConstruction != null) + { + result.Add("ApertureConstruction", apertureConstruction.ToJObject()); + } + + return result; + } + } +} diff --git a/SAM/SAM.Analytical/Classes/Case/ApertureToPanelRatios.cs b/SAM/SAM.Analytical/Classes/Case/ApertureToPanelRatios.cs new file mode 100644 index 000000000..4ff138e85 --- /dev/null +++ b/SAM/SAM.Analytical/Classes/Case/ApertureToPanelRatios.cs @@ -0,0 +1,101 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; +using SAM.Core; +using System.Collections.Generic; + +namespace SAM.Analytical.Classes +{ + public class ApertureToPanelRatios : IJSAMObject + { + private List apertureToPanelRatios; + + public ApertureToPanelRatios(IEnumerable apertureToPanelRatios) + { + this.apertureToPanelRatios = apertureToPanelRatios == null ? [] : [.. apertureToPanelRatios]; + } + + public ApertureToPanelRatios(JObject jObject) + { + FromJObject(jObject); + } + + public ApertureToPanelRatios(ApertureToPanelRatios apertureToPanelRatios) + { + if (apertureToPanelRatios is not null) + { + this.apertureToPanelRatios = []; + foreach (var item in apertureToPanelRatios.apertureToPanelRatios) + { + this.apertureToPanelRatios.Add(new ApertureToPanelRatio(item)); + } + } + } + + public ApertureToPanelRatio this[int index] + { + get + { + return apertureToPanelRatios[index]; + } + + set + { + apertureToPanelRatios[index] = value; + + } + } + + public int Count + { + get + { + return apertureToPanelRatios?.Count ?? 0; + } + } + + public virtual bool FromJObject(JObject jObject) + { + if (jObject == null) + { + return false; + } + + if (jObject.ContainsKey("ApertureToPanelRatios")) + { + apertureToPanelRatios = []; + JArray jArray = jObject.Value("ApertureToPanelRatios"); + foreach (JObject jObject_ApertureToPanelRatio in jArray) + { + ApertureToPanelRatio apertureToPanelRatio = Core.Query.IJSAMObject(jObject_ApertureToPanelRatio); + if (apertureToPanelRatio is not null) + { + apertureToPanelRatios.Add(apertureToPanelRatio); + } + } + } + + return true; + } + + public virtual JObject ToJObject() + { + JObject result = new(); + result.Add("_type", Core.Query.FullTypeName(this)); + + if (apertureToPanelRatios != null) + { + JArray jArray = []; + foreach (ApertureToPanelRatio apertureToPanelRatio in apertureToPanelRatios) + { + jArray.Add(apertureToPanelRatio.ToJObject()); + } + + result.Add("ApertureToPanelRatios", jArray); + } + + return result; + } + } +} diff --git a/SAM/SAM.Analytical/Classes/Case/Case.cs b/SAM/SAM.Analytical/Classes/Case/Case.cs new file mode 100644 index 000000000..7fb906f35 --- /dev/null +++ b/SAM/SAM.Analytical/Classes/Case/Case.cs @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; +using SAM.Core; +using System.ComponentModel; + +namespace SAM.Analytical.Classes +{ + public abstract class Case : IJSAMObject, IAnalyticalObject, INotifyPropertyChanged + { + public event PropertyChangedEventHandler PropertyChanged; + + public Case() + { + + } + + public Case(Case @case) + { + + } + + public Case(JObject jObject) + { + FromJObject(jObject); + } + + protected void OnPropertyChanged(string propertyName) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + + public virtual bool FromJObject(JObject jObject) + { + if (jObject == null) + { + return false; + } + + //if (jObject.ContainsKey("Name")) + //{ + // name = jObject.Value("Name"); + //} + + return true; + } + + public virtual JObject ToJObject() + { + JObject result = new JObject(); + result.Add("_type", Core.Query.FullTypeName(this)); + + //if (name != null) + //{ + // jObject.Add("Name", name); + //} + + return result; + } + } +} diff --git a/SAM/SAM.Analytical/Classes/Case/CaseSelection/ApertureCaseSelection.cs b/SAM/SAM.Analytical/Classes/Case/CaseSelection/ApertureCaseSelection.cs new file mode 100644 index 000000000..af4ed6a85 --- /dev/null +++ b/SAM/SAM.Analytical/Classes/Case/CaseSelection/ApertureCaseSelection.cs @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; +using System.Collections.Generic; + +namespace SAM.Analytical +{ + public class ApertureCaseSelection : SAMObjectCaseSelection + { + public ApertureCaseSelection() + : base() + { + } + + public ApertureCaseSelection(IEnumerable apertures) + : base(apertures) + { + } + + public ApertureCaseSelection(JObject jObject) + : base(jObject) + { + } + + public override JObject ToJObject() + { + return base.ToJObject(); + } + + public override bool FromJObject(JObject jObject) + { + return base.FromJObject(jObject); + } + + } +} diff --git a/SAM/SAM.Analytical/Classes/Case/CaseSelection/CaseSelection.cs b/SAM/SAM.Analytical/Classes/Case/CaseSelection/CaseSelection.cs new file mode 100644 index 000000000..f858556dd --- /dev/null +++ b/SAM/SAM.Analytical/Classes/Case/CaseSelection/CaseSelection.cs @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; +using SAM.Core; +using System.ComponentModel; + +namespace SAM.Analytical +{ + public abstract class CaseSelection : IJSAMObject, IAnalyticalObject, INotifyPropertyChanged + { + public event PropertyChangedEventHandler PropertyChanged; + + public CaseSelection() + { + + } + + public CaseSelection(JObject jObject) + { + FromJObject(jObject); + } + + protected void OnPropertyChanged(string propertyName) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + + public virtual bool FromJObject(JObject jObject) + { + if (jObject == null) + { + return false; + } + + //if (jObject.ContainsKey("Name")) + //{ + // name = jObject.Value("Name"); + //} + + return true; + } + + public virtual JObject ToJObject() + { + JObject result = new JObject(); + result.Add("_type", Core.Query.FullTypeName(this)); + + //if (name != null) + //{ + // jObject.Add("Name", name); + //} + + return result; + } + } +} diff --git a/SAM/SAM.Analytical/Classes/Case/CaseSelection/FilterSelection.cs b/SAM/SAM.Analytical/Classes/Case/CaseSelection/FilterSelection.cs new file mode 100644 index 000000000..d382e53f7 --- /dev/null +++ b/SAM/SAM.Analytical/Classes/Case/CaseSelection/FilterSelection.cs @@ -0,0 +1,69 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; +using SAM.Core; + +namespace SAM.Analytical +{ + public class FilterSelection : CaseSelection + { + private IFilter filter; + + public FilterSelection(IFilter filter) + { + this.filter = filter; + } + + public FilterSelection() + { + + } + + public FilterSelection(JObject jObject) + { + FromJObject(jObject); + } + + public IFilter Filter + { + get + { + return filter; + } + + set + { + filter = value; + } + } + + public override bool FromJObject(JObject jObject) + { + if (jObject == null) + { + return false; + } + + if (jObject.ContainsKey("Filter")) + { + filter = Core.Query.IJSAMObject(jObject.Value("Filter")); + } + + return true; + } + + public override JObject ToJObject() + { + JObject result = new JObject(); + result.Add("_type", Core.Query.FullTypeName(this)); + + if (filter != null) + { + result.Add("Filter", filter.ToJObject()); + } + + return result; + } + } +} diff --git a/SAM/SAM.Analytical/Classes/Case/CaseSelection/ObjectReferenceCaseSelection.cs b/SAM/SAM.Analytical/Classes/Case/CaseSelection/ObjectReferenceCaseSelection.cs new file mode 100644 index 000000000..c38b4aa36 --- /dev/null +++ b/SAM/SAM.Analytical/Classes/Case/CaseSelection/ObjectReferenceCaseSelection.cs @@ -0,0 +1,92 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; +using SAM.Core; +using System.Collections.Generic; + +namespace SAM.Analytical +{ + public class ObjectReferenceCaseSelection : CaseSelection + { + private List objectReferences; + + public ObjectReferenceCaseSelection() + { + objectReferences = []; + } + + public ObjectReferenceCaseSelection(IEnumerable objectReferences) + { + this.objectReferences = objectReferences == null ? [] : [.. objectReferences]; + } + + public ObjectReferenceCaseSelection(JObject jObject) + { + FromJObject(jObject); + } + + public IEnumerable ObjectReferences + { + get + { + return objectReferences; + } + } + + public override bool FromJObject(JObject jObject) + { + bool result = base.FromJObject(jObject); + if (!result) + { + return false; + } + + if (jObject.ContainsKey("ObjectReferences")) + { + JArray jArray = jObject.Value("ObjectReferences"); + if (jArray != null) + { + objectReferences = []; + foreach (JObject jObject_Temp in jArray) + { + ObjectReference objectReference = Core.Query.IJSAMObject(jObject_Temp); + if (objectReference != null) + { + objectReferences.Add(objectReference); + } + } + } + } + + return true; + } + + public override JObject ToJObject() + { + JObject result = base.ToJObject(); + if (result is null) + { + return result; + } + + if (objectReferences != null) + { + JArray jArray = []; + + foreach (ObjectReference objectReference in objectReferences) + { + JObject jObject_Temp = objectReference.ToJObject(); + if (jObject_Temp != null) + { + jArray.Add(jObject_Temp); + } + } + + result.Add("ObjectReferences", jArray); + } + + return result; + } + } +} diff --git a/SAM/SAM.Analytical/Classes/Case/CaseSelection/SAMObjectCaseSelection.cs b/SAM/SAM.Analytical/Classes/Case/CaseSelection/SAMObjectCaseSelection.cs new file mode 100644 index 000000000..ba88d3b42 --- /dev/null +++ b/SAM/SAM.Analytical/Classes/Case/CaseSelection/SAMObjectCaseSelection.cs @@ -0,0 +1,121 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; +using SAM.Core; +using System.Collections.Generic; + +namespace SAM.Analytical +{ + public abstract class SAMObjectCaseSelection : CaseSelection where TJSAMObject : IJSAMObject + { + private List objects; + + public SAMObjectCaseSelection() + { + objects = []; + } + + public SAMObjectCaseSelection(IEnumerable objects) + { + this.objects = objects == null ? [] : [.. objects]; + } + + public SAMObjectCaseSelection(JObject jObject) + { + FromJObject(jObject); + } + + public List Objects + { + get + { + return objects; + } + } + + public override bool FromJObject(JObject jObject) + { + bool result = base.FromJObject(jObject); + if (!result) + { + return false; + } + + if (jObject.ContainsKey("Objects")) + { + JArray jArray = jObject.Value("Objects"); + if (jArray != null) + { + objects = []; + foreach (JObject jObject_Temp in jArray) + { + TJSAMObject @object = Core.Query.IJSAMObject(jObject_Temp); + if (@object != null) + { + objects.Add(@object); + } + } + } + } + + return true; + } + + public override JObject ToJObject() + { + JObject result = base.ToJObject(); + if (result is null) + { + return result; + } + + if (objects != null) + { + JArray jArray = []; + + foreach (TJSAMObject @object in objects) + { + JObject jObject_Temp = @object.ToJObject(); + if (jObject_Temp != null) + { + jArray.Add(jObject_Temp); + } + } + + result.Add("Objects", jArray); + } + + return result; + } + } + + public class SAMObjectCaseSelection : SAMObjectCaseSelection + { + public SAMObjectCaseSelection() + : base() + { + } + + public SAMObjectCaseSelection(IEnumerable objects) + : base(objects) + { + } + + public SAMObjectCaseSelection(JObject jObject) + : base(jObject) + { + } + + public override JObject ToJObject() + { + return base.ToJObject(); + } + + public override bool FromJObject(JObject jObject) + { + return base.FromJObject(jObject); + } + + } +} diff --git a/SAM/SAM.Analytical/Classes/Case/Cases.cs b/SAM/SAM.Analytical/Classes/Case/Cases.cs new file mode 100644 index 000000000..222f9e402 --- /dev/null +++ b/SAM/SAM.Analytical/Classes/Case/Cases.cs @@ -0,0 +1,174 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; +using SAM.Core; +using System; +using System.Collections; +using System.Collections.Generic; + +namespace SAM.Analytical.Classes +{ + public class Cases : IJSAMObject, IAnalyticalObject, IEnumerable + { + private List values = []; + + public Cases() + { + + } + + public Cases(IEnumerable cases) + { + values = cases == null ? [] : [.. cases]; + } + + public Cases(JObject jObject) + { + FromJObject(jObject); + } + + public Type BaseType + { + get + { + if (values == null || values.Count == 0) + { + return null; + } + + Type type = values[0].GetType(); + + if (values.TrueForAll(x => x.GetType() == type)) + { + return type; + } + + return null; + } + } + + public int Count + { + get + { + return values?.Count ?? 0; + } + } + + public Case this[int index] + { + get + { + if (values == null || index < 0 || index >= values.Count) + { + return null; + } + return values[index]; + } + set + { + if (values == null || index < 0 || index >= values.Count) + { + return; + } + values[index] = value; + } + } + + public void Add(Case @case) + { + if (@case == null) + { + return; + } + + if (values == null) + { + values = []; + } + + values.Add(@case); + } + + public virtual bool FromJObject(JObject jObject) + { + if (jObject == null) + { + return false; + } + + if (jObject.ContainsKey("Values")) + { + JArray jArray = jObject.Value("Values"); + if (jArray != null) + { + values = []; + foreach (JObject jObject_Temp in jArray) + { + Case @case = Core.Query.IJSAMObject(jObject_Temp); + if (@case == null) + { + continue; + } + + values.Add(@case); + } + } + } + + return true; + } + + public List GetCases() + { + if (values is null) + { + return null; + } + + List result = []; + foreach (Case @case in values) + { + if (@case is TCase case_Temp) + { + result.Add(case_Temp); + } + } + + return result; + } + + public IEnumerator GetEnumerator() + { + return values.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public virtual JObject ToJObject() + { + JObject result = new JObject(); + result.Add("_type", Core.Query.FullTypeName(this)); + + if (values != null) + { + JArray jArray = []; + foreach (Case value in values) + { + if (value?.ToJObject() is JObject jObject_Temp) + { + jArray.Add(jObject_Temp); + } + } + + result.Add("Values", jArray); + } + + return result; + } + } +} diff --git a/SAM/SAM.Analytical/Classes/Case/FinShadeCase.cs b/SAM/SAM.Analytical/Classes/Case/FinShadeCase.cs new file mode 100644 index 000000000..aa9020e43 --- /dev/null +++ b/SAM/SAM.Analytical/Classes/Case/FinShadeCase.cs @@ -0,0 +1,351 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; + +namespace SAM.Analytical.Classes +{ + public class FinShadeCase : Case, ISelectiveCase + { + private bool glassPartOnly; + private double leftFinDepth; + private double leftFinFrontOffset; + private double leftFinOffset; + private double overhangDepth; + private double overhangFrontOffset; + private double overhangVerticalOffset; + private double rightFinDepth; + private double rightFinFrontOffset; + private double rightFinOffset; + private CaseSelection caseSelection; + + public FinShadeCase() + { + + } + + public FinShadeCase(bool glassPartOnly, double overhangDepth, double overhangVerticalOffset, double overhangFrontOffset, double leftFinDepth, double leftFinOffset, double leftFinFrontOffset, double rightFinDepth, double rightFinOffset, double rightFinFrontOffset, CaseSelection caseSelection) + : base() + { + this.glassPartOnly = glassPartOnly; + this.overhangDepth = overhangDepth; + this.overhangVerticalOffset = overhangVerticalOffset; + this.overhangFrontOffset = overhangFrontOffset; + this.leftFinDepth = leftFinDepth; + this.leftFinOffset = leftFinOffset; + this.leftFinFrontOffset = leftFinFrontOffset; + this.rightFinDepth = rightFinDepth; + this.rightFinOffset = rightFinOffset; + this.rightFinFrontOffset = rightFinFrontOffset; + this.caseSelection = caseSelection; + } + + public FinShadeCase(JObject jObject) + : base(jObject) + { + + } + + public FinShadeCase(FinShadeCase shadeCase) + : base(shadeCase) + { + if (shadeCase != null) + { + glassPartOnly = shadeCase.glassPartOnly; + overhangDepth = shadeCase.overhangDepth; + overhangVerticalOffset = shadeCase.overhangVerticalOffset; + overhangFrontOffset = shadeCase.overhangFrontOffset; + leftFinDepth = shadeCase.leftFinDepth; + leftFinOffset = shadeCase.leftFinOffset; + leftFinFrontOffset = shadeCase.leftFinFrontOffset; + rightFinDepth = shadeCase.rightFinDepth; + rightFinOffset = shadeCase.rightFinOffset; + rightFinFrontOffset = shadeCase.rightFinFrontOffset; + caseSelection = shadeCase.caseSelection; + } + } + + public bool GlassPartOnly + { + get + { + return glassPartOnly; + } + + set + { + glassPartOnly = value; + OnPropertyChanged(nameof(GlassPartOnly)); + } + } + + public double LeftFinDepth + { + get + { + return leftFinDepth; + } + + set + { + leftFinDepth = value; + OnPropertyChanged(nameof(LeftFinDepth)); + } + } + + public double LeftFinFrontOffset + { + get + { + return leftFinFrontOffset; + } + + set + { + leftFinFrontOffset = value; + OnPropertyChanged(nameof(LeftFinFrontOffset)); + } + } + + public double LeftFinOffset + { + get + { + return leftFinOffset; + } + + set + { + leftFinOffset = value; + OnPropertyChanged(nameof(LeftFinOffset)); + } + } + + public double OverhangDepth + { + get + { + return overhangDepth; + } + + set + { + overhangDepth = value; + OnPropertyChanged(nameof(OverhangDepth)); + } + } + + public double OverhangFrontOffset + { + get + { + return overhangFrontOffset; + } + + set + { + overhangFrontOffset = value; + OnPropertyChanged(nameof(OverhangFrontOffset)); + } + } + + public double OverhangVerticalOffset + { + get + { + return overhangVerticalOffset; + } + + set + { + overhangVerticalOffset = value; + OnPropertyChanged(nameof(OverhangVerticalOffset)); + } + } + + public double RightFinDepth + { + get + { + return rightFinDepth; + } + + set + { + rightFinDepth = value; + OnPropertyChanged(nameof(RightFinDepth)); + } + } + + public double RightFinFrontOffset + { + get + { + return rightFinFrontOffset; + } + + set + { + rightFinFrontOffset = value; + OnPropertyChanged(nameof(RightFinFrontOffset)); + } + } + + public double RightFinOffset + { + get + { + return rightFinOffset; + } + + set + { + rightFinOffset = value; + OnPropertyChanged(nameof(RightFinOffset)); + } + } + + public CaseSelection CaseSelection + { + get + { + return caseSelection; + } + + set + { + caseSelection = value; + OnPropertyChanged(nameof(CaseSelection)); + } + } + + public override bool FromJObject(JObject jObject) + { + bool result = base.FromJObject(jObject); + if (!result) + { + return false; + } + + if (jObject.ContainsKey("GlassPartOnly")) + { + glassPartOnly = jObject.Value("GlassPartOnly"); + } + + if (jObject.ContainsKey("OverhangDepth")) + { + overhangDepth = jObject.Value("OverhangDepth"); + } + + if (jObject.ContainsKey("OverhangVerticalOffset")) + { + overhangVerticalOffset = jObject.Value("OverhangVerticalOffset"); + } + + if (jObject.ContainsKey("OverhangFrontOffset")) + { + overhangFrontOffset = jObject.Value("OverhangFrontOffset"); + } + + if (jObject.ContainsKey("LeftFinDepth")) + { + leftFinDepth = jObject.Value("LeftFinDepth"); + } + + if (jObject.ContainsKey("LeftFinOffset")) + { + leftFinOffset = jObject.Value("LeftFinOffset"); + } + + if (jObject.ContainsKey("LeftFinFrontOffset")) + { + leftFinFrontOffset = jObject.Value("LeftFinFrontOffset"); + } + + if (jObject.ContainsKey("RightFinDepth")) + { + rightFinDepth = jObject.Value("RightFinDepth"); + } + + if (jObject.ContainsKey("RightFinOffset")) + { + rightFinOffset = jObject.Value("RightFinOffset"); + } + + if (jObject.ContainsKey("RightFinFrontOffset")) + { + rightFinFrontOffset = jObject.Value("RightFinFrontOffset"); + } + + if (jObject.ContainsKey("CaseSelection")) + { + caseSelection = Core.Query.IJSAMObject(jObject.Value("CaseSelection")); + } + + return true; + } + + public override JObject ToJObject() + { + JObject result = base.ToJObject(); + if (result is null) + { + return result; + } + + result.Add("GlassPartOnly", glassPartOnly); + + if (!double.IsNaN(overhangDepth)) + { + result.Add("OverhangDepth", overhangDepth); + } + + if (!double.IsNaN(overhangVerticalOffset)) + { + result.Add("OverhangVerticalOffset", overhangVerticalOffset); + } + + if (!double.IsNaN(overhangFrontOffset)) + { + result.Add("OverhangFrontOffset", overhangFrontOffset); + } + + if (!double.IsNaN(leftFinDepth)) + { + result.Add("LeftFinDepth", leftFinDepth); + } + + if (!double.IsNaN(leftFinOffset)) + { + result.Add("LeftFinOffset", leftFinOffset); + } + + if (!double.IsNaN(leftFinFrontOffset)) + { + result.Add("LeftFinFrontOffset", leftFinFrontOffset); + } + + if (!double.IsNaN(rightFinDepth)) + { + result.Add("RightFinDepth", rightFinDepth); + } + + if (!double.IsNaN(rightFinOffset)) + { + result.Add("RightFinOffset", rightFinOffset); + } + + if (!double.IsNaN(rightFinFrontOffset)) + { + result.Add("RightFinFrontOffset", rightFinFrontOffset); + } + + if (caseSelection != null) + { + result.Add("CaseSelection", caseSelection.ToJObject()); + } + + return result; + } + } +} diff --git a/SAM/SAM.Analytical/Classes/Case/PanelShadeCase.cs b/SAM/SAM.Analytical/Classes/Case/PanelShadeCase.cs new file mode 100644 index 000000000..6fac52f7f --- /dev/null +++ b/SAM/SAM.Analytical/Classes/Case/PanelShadeCase.cs @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; +using System.Collections.Generic; + +namespace SAM.Analytical.Classes +{ + public class PanelShadeCase : Case + { + private List panels = []; + + public PanelShadeCase() + : base() + { + + } + + public PanelShadeCase(JObject jObject) + : base(jObject) + { + + } + + public PanelShadeCase(PanelShadeCase panelShadeCase) + : base(panelShadeCase) + { + if (panelShadeCase != null) + { + panels = panelShadeCase.panels?.ConvertAll(x => Core.Query.Clone(x)); + } + } + + public List Panels + { + get + { + return panels?.ConvertAll(x => Core.Query.Clone(x)); + } + + set + { + panels = value?.ConvertAll(x => Core.Query.Clone(x)); + OnPropertyChanged(nameof(Panels)); + } + } + + public override bool FromJObject(JObject jObject) + { + bool result = base.FromJObject(jObject); + if (!result) + { + return false; + } + + if (jObject.ContainsKey("Panels")) + { + panels = Core.Convert.ToList(jObject.Value("Panels")); + } + + return true; + } + + public override JObject ToJObject() + { + JObject result = base.ToJObject(); + if (result is null) + { + return result; + } + + if (panels is not null) + { + JArray jArray = []; + + foreach (Panel panel in panels) + { + jArray.Add(panel?.ToJObject()); + } + + result.Add("Panels", jArray); + } + + return result; + } + } +} diff --git a/SAM/SAM.Analytical/Classes/Case/VentilationCase.cs b/SAM/SAM.Analytical/Classes/Case/VentilationCase.cs new file mode 100644 index 000000000..7ef30917e --- /dev/null +++ b/SAM/SAM.Analytical/Classes/Case/VentilationCase.cs @@ -0,0 +1,241 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; + +namespace SAM.Analytical.Classes +{ + public class VentilationCase : Case, ISelectiveCase + { + private double ach; + private CaseSelection caseSelection; + private string description; + private double factor; + private string function; + private double m3h; + private double setback; + + public VentilationCase(string function, double ach, double m3h, double factor, double setback, string description, CaseSelection caseSelection) + : base() + { + this.function = function; + this.ach = ach; + this.m3h = m3h; + this.factor = factor; + this.setback = setback; + this.description = description; + this.caseSelection = caseSelection; + } + + public VentilationCase(JObject jObject) + : base(jObject) + { + + } + + public VentilationCase(VentilationCase ventilationCase) + : base(ventilationCase) + { + if (ventilationCase != null) + { + function = ventilationCase.function; + ach = ventilationCase.ach; + m3h = ventilationCase.m3h; + factor = ventilationCase.factor; + setback = ventilationCase.setback; + description = ventilationCase.description; + caseSelection = ventilationCase.caseSelection; + } + } + + public double ACH + { + get + { + return ach; + } + + set + { + ach = value; + OnPropertyChanged(nameof(ACH)); + } + } + + public CaseSelection CaseSelection + { + get + { + return caseSelection; + } + + set + { + caseSelection = value; + OnPropertyChanged(nameof(CaseSelection)); + } + } + + public string Description + { + get + { + return description; + } + + set + { + description = value; + OnPropertyChanged(nameof(Description)); + } + } + + public double Factor + { + get + { + return factor; + } + + set + { + factor = value; + OnPropertyChanged(nameof(Factor)); + } + } + + public string Function + { + get + { + return function; + } + + set + { + function = value; + OnPropertyChanged(nameof(Function)); + } + } + + public double M3h + { + get + { + return m3h; + } + + set + { + m3h = value; + OnPropertyChanged(nameof(M3h)); + } + } + + public double Setback + { + get + { + return setback; + } + + set + { + setback = value; + OnPropertyChanged(nameof(Setback)); + } + } + + public override bool FromJObject(JObject jObject) + { + bool result = base.FromJObject(jObject); + if (!result) + { + return false; + } + + if (jObject.ContainsKey("Function")) + { + function = jObject.Value("Function"); + } + + if (jObject.ContainsKey("ACH")) + { + ach = jObject.Value("ACH"); + } + + if (jObject.ContainsKey("M3h")) + { + m3h = jObject.Value("M3h"); + } + + if (jObject.ContainsKey("Factor")) + { + factor = jObject.Value("Factor"); + } + + if (jObject.ContainsKey("Setback")) + { + setback = jObject.Value("Setback"); + } + + if (jObject.ContainsKey("Description")) + { + description = jObject.Value("Description"); + } + + if (jObject.ContainsKey("CaseSelection")) + { + caseSelection = Core.Query.IJSAMObject(jObject.Value("CaseSelection")); + } + + return true; + } + + public override JObject ToJObject() + { + JObject result = base.ToJObject(); + if (result is null) + { + return result; + } + + if (function != null) + { + result.Add("Function", function); + } + + if (!double.IsNaN(ach)) + { + result.Add("ACH", ach); + } + + if (!double.IsNaN(m3h)) + { + result.Add("M3h", m3h); + } + + if (!double.IsNaN(factor)) + { + result.Add("Factor", factor); + } + + if (!double.IsNaN(setback)) + { + result.Add("Setback", setback); + } + + if (description != null) + { + result.Add("Description", description); + } + + if (caseSelection != null) + { + result.Add("CaseSelection", caseSelection.ToJObject()); + } + + return result; + } + } +} diff --git a/SAM/SAM.Analytical/Classes/Case/WeatherDataCase.cs b/SAM/SAM.Analytical/Classes/Case/WeatherDataCase.cs new file mode 100644 index 000000000..21fddcd43 --- /dev/null +++ b/SAM/SAM.Analytical/Classes/Case/WeatherDataCase.cs @@ -0,0 +1,80 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; +using SAM.Weather; + +namespace SAM.Analytical.Classes +{ + public class WeatherDataCase : Case + { + private WeatherData weatherData; + + public WeatherDataCase(WeatherData weatherData) + : base() + { + this.weatherData = weatherData; + } + + public WeatherDataCase(WeatherDataCase weatherDataCase) + : base(weatherDataCase) + { + if (weatherDataCase != null) + { + weatherData = weatherDataCase.weatherData; + } + } + + public WeatherDataCase(JObject jObject) + : base(jObject) + { + + } + + public WeatherData WeatherData + { + get + { + return weatherData; + } + + set + { + weatherData = value; + OnPropertyChanged(nameof(WeatherData)); + } + } + + public override bool FromJObject(JObject jObject) + { + bool result = base.FromJObject(jObject); + if (!result) + { + return false; + } + + if (jObject.ContainsKey("WeatherData")) + { + weatherData = Core.Query.IJSAMObject(jObject.Value("WeatherData")); + } + + return true; + } + + public override JObject ToJObject() + { + JObject result = base.ToJObject(); + if (result is null) + { + return result; + } + + if (weatherData != null) + { + result.Add("WeatherData", weatherData.ToJObject()); + } + + return result; + } + } +} diff --git a/SAM/SAM.Analytical/Classes/Case/WindowSizeCase.cs b/SAM/SAM.Analytical/Classes/Case/WindowSizeCase.cs new file mode 100644 index 000000000..146878af5 --- /dev/null +++ b/SAM/SAM.Analytical/Classes/Case/WindowSizeCase.cs @@ -0,0 +1,116 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; + +namespace SAM.Analytical.Classes +{ + public class WindowSizeCase : Case, ISelectiveCase + { + private double apertureScaleFactor = 0.8; + private CaseSelection caseSelection; + + public WindowSizeCase() + { + + } + + public WindowSizeCase(double apertureScaleFactor) + { + this.apertureScaleFactor = apertureScaleFactor; + } + + public WindowSizeCase(double apertureScaleFactor, CaseSelection caseSelection) + : base() + { + this.apertureScaleFactor = apertureScaleFactor; + this.caseSelection = caseSelection; + } + + public WindowSizeCase(JObject jObject) + : base(jObject) + { + + } + + public WindowSizeCase(WindowSizeCase windowSizeCase) + : base(windowSizeCase) + { + if (windowSizeCase is not null) + { + apertureScaleFactor = windowSizeCase.apertureScaleFactor; + caseSelection = windowSizeCase.caseSelection; + } + } + + public double ApertureScaleFactor + { + get + { + return apertureScaleFactor; + } + + set + { + apertureScaleFactor = value; + OnPropertyChanged(nameof(ApertureScaleFactor)); + } + } + + public CaseSelection CaseSelection + { + get + { + return caseSelection; + } + + set + { + caseSelection = value; + OnPropertyChanged(nameof(CaseSelection)); + } + } + + public override bool FromJObject(JObject jObject) + { + bool result = base.FromJObject(jObject); + if (!result) + { + return false; + } + + if (jObject.ContainsKey("ApertureScaleFactor")) + { + apertureScaleFactor = jObject.Value("ApertureScaleFactor"); + } + + if (jObject.ContainsKey("CaseSelection")) + { + caseSelection = Core.Query.IJSAMObject(jObject.Value("CaseSelection")); + } + + return true; + } + + public override JObject ToJObject() + { + JObject result = base.ToJObject(); + if (result is null) + { + return result; + } + + if (!double.IsNaN(apertureScaleFactor)) + { + result.Add("ApertureScaleFactor", apertureScaleFactor); + } + + if (caseSelection != null) + { + result.Add("CaseSelection", caseSelection.ToJObject()); + } + + return result; + } + } +} diff --git a/SAM/SAM.Analytical/Classes/CaseData/ApertureCaseData.cs b/SAM/SAM.Analytical/Classes/CaseData/ApertureCaseData.cs index c53857d17..d1dbb7ec9 100644 --- a/SAM/SAM.Analytical/Classes/CaseData/ApertureCaseData.cs +++ b/SAM/SAM.Analytical/Classes/CaseData/ApertureCaseData.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; using System.Linq; @@ -23,7 +26,7 @@ public ApertureCaseData(JObject jObject) public ApertureCaseData(ApertureCaseData apertureCaseData) : base(apertureCaseData) { - if(apertureCaseData != null) + if (apertureCaseData != null) { ratios = apertureCaseData.Ratios; } @@ -31,25 +34,25 @@ public ApertureCaseData(ApertureCaseData apertureCaseData) public List Ratios { - get - { - return ratios?.ToList(); + get + { + return ratios?.ToList(); } } public override bool FromJObject(JObject jObject) { bool result = base.FromJObject(jObject); - if(!result) + if (!result) { return false; } - if(jObject.ContainsKey("Ratios")) + if (jObject.ContainsKey("Ratios")) { ratios = []; JArray jArray = jObject.Value("Ratios"); - foreach(double value in jArray) + foreach (double value in jArray) { ratios.Add(value); } @@ -61,12 +64,12 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { JObject result = base.ToJObject(); - if(result is null) + if (result is null) { return result; } - if(ratios != null) + if (ratios != null) { result.Add("Rations", new JArray(ratios)); } @@ -74,4 +77,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/CaseData/ApertureConstructionCaseData.cs b/SAM/SAM.Analytical/Classes/CaseData/ApertureConstructionCaseData.cs index 60a388714..fbacefab3 100644 --- a/SAM/SAM.Analytical/Classes/CaseData/ApertureConstructionCaseData.cs +++ b/SAM/SAM.Analytical/Classes/CaseData/ApertureConstructionCaseData.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical @@ -22,7 +25,7 @@ public ApertureConstructionCaseData(JObject jObject) public ApertureConstructionCaseData(ApertureConstructionCaseData apertureConstructionCaseData) : base(apertureConstructionCaseData) { - if(apertureConstructionCaseData != null) + if (apertureConstructionCaseData != null) { apertureConstruction = apertureConstructionCaseData.apertureConstruction?.Clone(); } @@ -30,21 +33,21 @@ public ApertureConstructionCaseData(ApertureConstructionCaseData apertureConstru public ApertureConstruction ApertureConstruction { - get - { - return apertureConstruction?.Clone(); + get + { + return apertureConstruction?.Clone(); } } public override bool FromJObject(JObject jObject) { bool result = base.FromJObject(jObject); - if(!result) + if (!result) { return false; } - if(jObject.ContainsKey("ApertureConstruction")) + if (jObject.ContainsKey("ApertureConstruction")) { apertureConstruction = Core.Query.IJSAMObject(jObject.Value("ApertureConstruction")); } @@ -55,12 +58,12 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { JObject result = base.ToJObject(); - if(result is null) + if (result is null) { return result; } - if(apertureConstruction is not null) + if (apertureConstruction is not null) { result.Add("ApertureConstruction", apertureConstruction.ToJObject()); } @@ -68,4 +71,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/CaseData/BuiltInCaseData.cs b/SAM/SAM.Analytical/Classes/CaseData/BuiltInCaseData.cs index e3e8d22ba..815ecc3bf 100644 --- a/SAM/SAM.Analytical/Classes/CaseData/BuiltInCaseData.cs +++ b/SAM/SAM.Analytical/Classes/CaseData/BuiltInCaseData.cs @@ -1,17 +1,20 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Analytical { public abstract class BuiltInCaseData : CaseData { public BuiltInCaseData(string name) - :base(name) + : base(name) { } public BuiltInCaseData(JObject jObject) - :base(jObject) + : base(jObject) { } @@ -32,4 +35,4 @@ public override JObject ToJObject() return base.ToJObject(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/CaseData/CaseData.cs b/SAM/SAM.Analytical/Classes/CaseData/CaseData.cs index 7bc0468b3..d9a369d06 100644 --- a/SAM/SAM.Analytical/Classes/CaseData/CaseData.cs +++ b/SAM/SAM.Analytical/Classes/CaseData/CaseData.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical @@ -19,7 +22,7 @@ public CaseData(JObject jObject) public CaseData(CaseData caseData) { - if(caseData != null) + if (caseData != null) { name = caseData.name; } @@ -27,9 +30,9 @@ public CaseData(CaseData caseData) public string Name { - get - { - return name; + get + { + return name; } } @@ -61,4 +64,4 @@ public virtual JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/CaseData/CaseDataCollection.cs b/SAM/SAM.Analytical/Classes/CaseData/CaseDataCollection.cs index 836bae5af..4c5b36b67 100644 --- a/SAM/SAM.Analytical/Classes/CaseData/CaseDataCollection.cs +++ b/SAM/SAM.Analytical/Classes/CaseData/CaseDataCollection.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections; using System.Collections.Generic; @@ -30,11 +33,11 @@ public CaseDataCollection(CaseDataCollection caseDataCollection) public CaseDataCollection(IEnumerable caseDatas) { - if(caseDatas != null) + if (caseDatas != null) { - foreach(CaseData caseData in caseDatas) + foreach (CaseData caseData in caseDatas) { - if(caseData.Clone() is CaseData caseData_Temp) + if (caseData.Clone() is CaseData caseData_Temp) { this.caseDatas.Add(caseData_Temp); } @@ -57,9 +60,9 @@ public bool FromJObject(JObject jObject) if (jObject.ContainsKey("CaseDatas")) { JArray jArray = jObject.Value("CaseDatas"); - foreach(JObject jObject_Temp in jArray) + foreach (JObject jObject_Temp in jArray) { - if(Core.Query.IJSAMObject(jObject_Temp) is CaseData caseData) + if (Core.Query.IJSAMObject(jObject_Temp) is CaseData caseData) { caseDatas.Add(caseData); } @@ -79,12 +82,12 @@ public List Values public bool Add(CaseData caseData) { - if(caseData is null) + if (caseData is null) { return false; } - if(caseData.Clone() is CaseData caseData_Temp) + if (caseData.Clone() is CaseData caseData_Temp) { caseDatas.Add(caseData_Temp); return true; @@ -122,4 +125,4 @@ public JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/CaseData/OpeningCaseData.cs b/SAM/SAM.Analytical/Classes/CaseData/OpeningCaseData.cs index 019b65e69..5ef1a4cd6 100644 --- a/SAM/SAM.Analytical/Classes/CaseData/OpeningCaseData.cs +++ b/SAM/SAM.Analytical/Classes/CaseData/OpeningCaseData.cs @@ -1,5 +1,7 @@ -using Newtonsoft.Json.Linq; -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Analytical { @@ -22,7 +24,7 @@ public OpeningCaseData(JObject jObject) public OpeningCaseData(OpeningCaseData openingCaseData) : base(openingCaseData) { - if(openingCaseData != null) + if (openingCaseData != null) { openingAngle = openingCaseData.openingAngle; } @@ -30,21 +32,21 @@ public OpeningCaseData(OpeningCaseData openingCaseData) public double OpeningAngle { - get - { - return openingAngle; + get + { + return openingAngle; } } public override bool FromJObject(JObject jObject) { bool result = base.FromJObject(jObject); - if(!result) + if (!result) { return false; } - if(jObject.ContainsKey("OpeningAngle")) + if (jObject.ContainsKey("OpeningAngle")) { openingAngle = jObject.Value("OpeningAngle"); } @@ -55,12 +57,12 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { JObject result = base.ToJObject(); - if(result is null) + if (result is null) { return result; } - if(!double.IsNaN(openingAngle)) + if (!double.IsNaN(openingAngle)) { result.Add("OpeningAngle", openingAngle); } @@ -68,4 +70,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/CaseData/ShadeCaseData.cs b/SAM/SAM.Analytical/Classes/CaseData/ShadeCaseData.cs index 2cb33bf5b..ceb43b872 100644 --- a/SAM/SAM.Analytical/Classes/CaseData/ShadeCaseData.cs +++ b/SAM/SAM.Analytical/Classes/CaseData/ShadeCaseData.cs @@ -1,12 +1,21 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Analytical { public class ShadeCaseData : BuiltInCaseData { - private double overhangDepth; - private double leftFinDepth; - private double rightFinDepth; + private double overhangDepth = double.NaN; + private double leftFinDepth = double.NaN; + private double rightFinDepth = double.NaN; + + public ShadeCaseData() + : base(nameof(ShadeCaseData)) + { + + } public ShadeCaseData(double overhangDepth, double leftFinDepth, double rightFinDepth) : base(nameof(ShadeCaseData)) @@ -25,7 +34,7 @@ public ShadeCaseData(JObject jObject) public ShadeCaseData(ShadeCaseData shadeCaseData) : base(shadeCaseData) { - if(shadeCaseData != null) + if (shadeCaseData != null) { overhangDepth = shadeCaseData.overhangDepth; leftFinDepth = shadeCaseData.leftFinDepth; @@ -35,9 +44,9 @@ public ShadeCaseData(ShadeCaseData shadeCaseData) public double OverhangDepth { - get - { - return overhangDepth; + get + { + return overhangDepth; } } @@ -60,12 +69,12 @@ public double RightFinDepth public override bool FromJObject(JObject jObject) { bool result = base.FromJObject(jObject); - if(!result) + if (!result) { return false; } - if(jObject.ContainsKey("OverhangDepth")) + if (jObject.ContainsKey("OverhangDepth")) { overhangDepth = jObject.Value("OverhangDepth"); } @@ -86,12 +95,12 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { JObject result = base.ToJObject(); - if(result is null) + if (result is null) { return result; } - if(!double.IsNaN(overhangDepth)) + if (!double.IsNaN(overhangDepth)) { result.Add("OverhangDepth", overhangDepth); } @@ -109,4 +118,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/CaseData/VentilationCaseData.cs b/SAM/SAM.Analytical/Classes/CaseData/VentilationCaseData.cs index f66a3f261..1cfffd060 100644 --- a/SAM/SAM.Analytical/Classes/CaseData/VentilationCaseData.cs +++ b/SAM/SAM.Analytical/Classes/CaseData/VentilationCaseData.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Analytical { @@ -21,7 +24,7 @@ public VentilationCaseData(JObject jObject) public VentilationCaseData(VentilationCaseData ventilationCaseData) : base(ventilationCaseData) { - if(ventilationCaseData != null) + if (ventilationCaseData != null) { aCH = ventilationCaseData.aCH; } @@ -29,21 +32,21 @@ public VentilationCaseData(VentilationCaseData ventilationCaseData) public double ACH { - get - { - return aCH; + get + { + return aCH; } } public override bool FromJObject(JObject jObject) { bool result = base.FromJObject(jObject); - if(!result) + if (!result) { return false; } - if(jObject.ContainsKey("ACH")) + if (jObject.ContainsKey("ACH")) { aCH = jObject.Value("ACH"); } @@ -54,12 +57,12 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { JObject result = base.ToJObject(); - if(result is null) + if (result is null) { return result; } - if(!double.IsNaN(aCH)) + if (!double.IsNaN(aCH)) { result.Add("ACH", aCH); } @@ -67,4 +70,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/CaseData/WeatherCaseData.cs b/SAM/SAM.Analytical/Classes/CaseData/WeatherCaseData.cs index 4e89dc735..083b49812 100644 --- a/SAM/SAM.Analytical/Classes/CaseData/WeatherCaseData.cs +++ b/SAM/SAM.Analytical/Classes/CaseData/WeatherCaseData.cs @@ -1,5 +1,7 @@ -using Newtonsoft.Json.Linq; -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Analytical { @@ -22,7 +24,7 @@ public WeatherCaseData(JObject jObject) public WeatherCaseData(WeatherCaseData weatherCaseData) : base(weatherCaseData) { - if(weatherCaseData != null) + if (weatherCaseData != null) { weatherDataName = weatherCaseData.weatherDataName; } @@ -30,21 +32,21 @@ public WeatherCaseData(WeatherCaseData weatherCaseData) public string WeatherDataName { - get - { - return weatherDataName; + get + { + return weatherDataName; } } public override bool FromJObject(JObject jObject) { bool result = base.FromJObject(jObject); - if(!result) + if (!result) { return false; } - if(jObject.ContainsKey("WeatherDataName")) + if (jObject.ContainsKey("WeatherDataName")) { weatherDataName = jObject.Value("WeatherDataName"); } @@ -55,12 +57,12 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { JObject result = base.ToJObject(); - if(result is null) + if (result is null) { return result; } - if(weatherDataName is not null) + if (weatherDataName is not null) { result.Add("WeatherDataName", weatherDataName); } @@ -68,4 +70,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/CaseData/WindowSizeCaseData.cs b/SAM/SAM.Analytical/Classes/CaseData/WindowSizeCaseData.cs index 4b3bd7f67..1a164defa 100644 --- a/SAM/SAM.Analytical/Classes/CaseData/WindowSizeCaseData.cs +++ b/SAM/SAM.Analytical/Classes/CaseData/WindowSizeCaseData.cs @@ -1,5 +1,7 @@ -using Newtonsoft.Json.Linq; -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Analytical { @@ -22,7 +24,7 @@ public WindowSizeCaseData(JObject jObject) public WindowSizeCaseData(WindowSizeCaseData windowSizeCaseData) : base(windowSizeCaseData) { - if(windowSizeCaseData != null) + if (windowSizeCaseData != null) { apertureScaleFactor = windowSizeCaseData.apertureScaleFactor; } @@ -30,21 +32,21 @@ public WindowSizeCaseData(WindowSizeCaseData windowSizeCaseData) public double ApertureScaleFactor { - get - { - return apertureScaleFactor; + get + { + return apertureScaleFactor; } } public override bool FromJObject(JObject jObject) { bool result = base.FromJObject(jObject); - if(!result) + if (!result) { return false; } - if(jObject.ContainsKey("ApertureScaleFactor")) + if (jObject.ContainsKey("ApertureScaleFactor")) { apertureScaleFactor = jObject.Value("ApertureScaleFactor"); } @@ -55,12 +57,12 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { JObject result = base.ToJObject(); - if(result is null) + if (result is null) { return result; } - if(!double.IsNaN(apertureScaleFactor)) + if (!double.IsNaN(apertureScaleFactor)) { result.Add("ApertureScaleFactor", apertureScaleFactor); } @@ -68,4 +70,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Construction.cs b/SAM/SAM.Analytical/Classes/Construction.cs index 82f15de72..6172a8256 100644 --- a/SAM/SAM.Analytical/Classes/Construction.cs +++ b/SAM/SAM.Analytical/Classes/Construction.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; using System.Collections.Generic; @@ -33,7 +36,7 @@ public Construction(string name, IEnumerable constructionLaye public Construction(Guid guid, string name, IEnumerable constructionLayers) : base(guid, name) { - if(constructionLayers != null) + if (constructionLayers != null) { this.constructionLayers = new List(); foreach (ConstructionLayer constructionLayer in constructionLayers) @@ -116,7 +119,7 @@ public override bool FromJObject(JObject jObject) if (!base.FromJObject(jObject)) return false; - if(jObject.ContainsKey("ConstructionLayers")) + if (jObject.ContainsKey("ConstructionLayers")) constructionLayers = Core.Create.IJSAMObjects(jObject.Value("ConstructionLayers")); return true; @@ -124,14 +127,14 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { - JObject jObject = base.ToJObject(); + JObject jObject = base.ToJObject(); if (jObject == null) return null; - if(constructionLayers != null) + if (constructionLayers != null) jObject.Add("ConstructionLayers", Core.Create.JArray(constructionLayers)); return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/ConstructionLayer.cs b/SAM/SAM.Analytical/Classes/ConstructionLayer.cs index a661eb15f..1e6983018 100644 --- a/SAM/SAM.Analytical/Classes/ConstructionLayer.cs +++ b/SAM/SAM.Analytical/Classes/ConstructionLayer.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Architectural; namespace SAM.Analytical @@ -26,7 +29,7 @@ public bool IsSoil { get { - if(string.IsNullOrWhiteSpace(Name)) + if (string.IsNullOrWhiteSpace(Name)) { return false; } @@ -56,4 +59,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/ConstructionLibrary.cs b/SAM/SAM.Analytical/Classes/ConstructionLibrary.cs index 8d2a66725..336d2a070 100644 --- a/SAM/SAM.Analytical/Classes/ConstructionLibrary.cs +++ b/SAM/SAM.Analytical/Classes/ConstructionLibrary.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; using System.Collections.Generic; @@ -92,7 +95,7 @@ public List GetConstructions(IEnumerable panelTypes) { if (panelTypes == null || panelTypes.Count() == 0) return null; - + List constructions = GetConstructions(); if (constructions == null || constructions.Count == 0) return null; @@ -104,7 +107,7 @@ public List GetConstructions(string text, TextComparisonType textC { if (string.IsNullOrWhiteSpace(text)) return null; - + List constructions = GetConstructions(); if (constructions == null || constructions.Count == 0) return null; @@ -112,4 +115,4 @@ public List GetConstructions(string text, TextComparisonType textC return constructions.FindAll(x => Core.Query.Compare(x.Name, text, textComparisonType, caseSensitive)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/ConstructionManager.cs b/SAM/SAM.Analytical/Classes/ConstructionManager.cs index eed4abd5f..c81f8d561 100644 --- a/SAM/SAM.Analytical/Classes/ConstructionManager.cs +++ b/SAM/SAM.Analytical/Classes/ConstructionManager.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections.Generic; @@ -11,7 +14,7 @@ public class ConstructionManager : IJSAMObject, IAnalyticalObject private ApertureConstructionLibrary apertureConstructionLibrary; private ConstructionLibrary constructionLibrary; - + private MaterialLibrary materialLibrary; public ConstructionManager(ApertureConstructionLibrary apertureConstructionLibrary, ConstructionLibrary constructionLibrary, MaterialLibrary materialLibrary) @@ -23,12 +26,12 @@ public ConstructionManager(ApertureConstructionLibrary apertureConstructionLibra public ConstructionManager(IEnumerable apertureConstructions, IEnumerable constructions, MaterialLibrary materialLibrary) { - this.materialLibrary = materialLibrary == null ? null : new MaterialLibrary(materialLibrary); + this.materialLibrary = materialLibrary == null ? null : new MaterialLibrary(materialLibrary); apertureConstructionLibrary = new ApertureConstructionLibrary("Default ApertureConstruction Library"); - if(apertureConstructions != null) + if (apertureConstructions != null) { - foreach(ApertureConstruction apertureConstruction in apertureConstructions) + foreach (ApertureConstruction apertureConstruction in apertureConstructions) { apertureConstructionLibrary.Add(apertureConstruction); } @@ -132,12 +135,12 @@ public bool Remove(Construction construction) public bool Add(IMaterial material) { - if(material == null) + if (material == null) { return false; } - if(materialLibrary == null) + if (materialLibrary == null) { materialLibrary = new MaterialLibrary(string.Empty); } @@ -177,7 +180,7 @@ public bool Add(Construction construction) public bool Add(Construction construction, PanelType panelType) { - if(construction == null) + if (construction == null) { return false; } @@ -225,24 +228,24 @@ public List GetConstructions(PanelType panelType) } List result = new List(); - foreach(Construction construction in constructions) + foreach (Construction construction in constructions) { - if(construction == null) + if (construction == null) { continue; } - if(!construction.TryGetValue(ConstructionParameter.DefaultPanelType, out string panelTypeString) || string.IsNullOrWhiteSpace(panelTypeString)) + if (!construction.TryGetValue(ConstructionParameter.DefaultPanelType, out string panelTypeString) || string.IsNullOrWhiteSpace(panelTypeString)) { continue; } - if(!Core.Query.TryGetEnum(panelTypeString, out PanelType panelType_Temp)) + if (!Core.Query.TryGetEnum(panelTypeString, out PanelType panelType_Temp)) { continue; } - if(panelType_Temp == panelType) + if (panelType_Temp == panelType) { result.Add(construction); } @@ -306,24 +309,24 @@ public IMaterial GetMaterial(string name) return materialLibrary?.GetMaterial(name); } - public List GetMaterials(Construction construction) where T: IMaterial + public List GetMaterials(Construction construction) where T : IMaterial { - if(construction == null || materialLibrary == null) + if (construction == null || materialLibrary == null) { return null; } List constructionLayers = construction.ConstructionLayers; - if(constructionLayers == null) + if (constructionLayers == null) { return null; } List result = new List(); - foreach(ConstructionLayer constructionLayer in constructionLayers) + foreach (ConstructionLayer constructionLayer in constructionLayers) { IMaterial material = materialLibrary.GetMaterial(constructionLayer.Name); - if(material is T) + if (material is T) { result.Add((T)material); } @@ -343,7 +346,7 @@ public List GetMaterials(ApertureConstruction apertureConstruction) where List constructionLayers = null; - constructionLayers = apertureConstruction.FrameConstructionLayers; + constructionLayers = apertureConstruction.FrameConstructionLayers; if (constructionLayers != null) { foreach (ConstructionLayer constructionLayer in constructionLayers) @@ -374,12 +377,12 @@ public List GetMaterials(ApertureConstruction apertureConstruction) where public bool FromJObject(JObject jObject) { - if(jObject == null) + if (jObject == null) { return false; } - if(jObject.ContainsKey("Name")) + if (jObject.ContainsKey("Name")) { Name = jObject.Value("Name"); } @@ -440,4 +443,4 @@ public JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/DailyWeightedExceedance.cs b/SAM/SAM.Analytical/Classes/DailyWeightedExceedance.cs index d1ee383b7..e14c0a77f 100644 --- a/SAM/SAM.Analytical/Classes/DailyWeightedExceedance.cs +++ b/SAM/SAM.Analytical/Classes/DailyWeightedExceedance.cs @@ -1,18 +1,21 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections.Generic; using System.Linq; namespace SAM.Analytical { - public class DailyWeightedExceedance: IAnalyticalObject + public class DailyWeightedExceedance : IAnalyticalObject { private int dayIndex; private IndexedDoubles temperatureDifferences; public DailyWeightedExceedance(DailyWeightedExceedance dailyWeightedExceedance) { - if(dailyWeightedExceedance != null) + if (dailyWeightedExceedance != null) { dayIndex = dailyWeightedExceedance.dayIndex; temperatureDifferences = dailyWeightedExceedance.temperatureDifferences == null ? null : new IndexedDoubles(dailyWeightedExceedance.temperatureDifferences); @@ -57,7 +60,7 @@ public int DayIndex private Dictionary GetCountDictionary() { IEnumerable keys = temperatureDifferences?.Keys; - if(keys == null) + if (keys == null) { return null; } @@ -79,19 +82,19 @@ private Dictionary GetCountDictionary() public bool FromJObject(JObject jObject) { - if(jObject == null) + if (jObject == null) { return false; } - if(jObject.ContainsKey("DayIndex")) + if (jObject.ContainsKey("DayIndex")) { dayIndex = jObject.Value("DayIndex"); } if (jObject.ContainsKey("TemperatureDifferences")) { - temperatureDifferences = new IndexedDoubles( jObject.Value("TemperatureDifferences")); + temperatureDifferences = new IndexedDoubles(jObject.Value("TemperatureDifferences")); } return true; @@ -102,12 +105,12 @@ public JObject ToJObject() JObject jObject = new JObject(); jObject.Add("_type", Core.Query.FullTypeName(this)); - if(dayIndex != -1) + if (dayIndex != -1) { jObject.Add("DayIndex", dayIndex); } - if(temperatureDifferences != null) + if (temperatureDifferences != null) { jObject.Add("TemperatureDifferences", temperatureDifferences.ToJObject()); } @@ -148,7 +151,7 @@ public bool Exceed get { double weightedExceedance = WeightedExceedance; - if(double.IsNaN(weightedExceedance)) + if (double.IsNaN(weightedExceedance)) { return false; } @@ -173,4 +176,4 @@ public int EndHourIndex } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/DegreeOfActivity.cs b/SAM/SAM.Analytical/Classes/DegreeOfActivity.cs index aa83ba8ee..b26069a16 100644 --- a/SAM/SAM.Analytical/Classes/DegreeOfActivity.cs +++ b/SAM/SAM.Analytical/Classes/DegreeOfActivity.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; @@ -34,7 +37,7 @@ public DegreeOfActivity(JObject jObject) : base(jObject) { } - + /// /// Dry (sensible) total heat emission [W/p] /// @@ -105,4 +108,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/DegreeOfActivityLibrary.cs b/SAM/SAM.Analytical/Classes/DegreeOfActivityLibrary.cs index 303521220..87f0a57a5 100644 --- a/SAM/SAM.Analytical/Classes/DegreeOfActivityLibrary.cs +++ b/SAM/SAM.Analytical/Classes/DegreeOfActivityLibrary.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; using System.Collections.Generic; @@ -73,7 +76,7 @@ public List GetDegreeOfActivities(string text, TextComparisonT { if (string.IsNullOrWhiteSpace(text)) return null; - + List degreeOfActivities = GetDegreeOfActivities(); if (degreeOfActivities == null || degreeOfActivities.Count == 0) return null; @@ -81,4 +84,4 @@ public List GetDegreeOfActivities(string text, TextComparisonT return degreeOfActivities.FindAll(x => Core.Query.Compare(x.Name, text, textComparisonType, caseSensitive)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/DesignDay.cs b/SAM/SAM.Analytical/Classes/DesignDay.cs index 5b75765eb..0650117ef 100644 --- a/SAM/SAM.Analytical/Classes/DesignDay.cs +++ b/SAM/SAM.Analytical/Classes/DesignDay.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Analytical { @@ -15,7 +18,7 @@ public class DesignDay : Weather.WeatherDay, IAnalyticalObject public DesignDay(DesignDay designDay) : base(designDay) { - if(designDay != null) + if (designDay != null) { name = designDay.name; description = designDay.description; @@ -129,7 +132,7 @@ public System.DateTime GetDateTime() public Weather.WeatherYear GetWeatherYear() { System.DateTime dateTime = GetDateTime(); - if(dateTime == System.DateTime.MinValue) + if (dateTime == System.DateTime.MinValue) { return null; } @@ -145,7 +148,7 @@ public override bool FromJObject(JObject jObject) if (!base.FromJObject(jObject)) return false; - if(jObject.ContainsKey("Name")) + if (jObject.ContainsKey("Name")) { name = jObject.Value("Name"); } @@ -180,16 +183,16 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { - JObject jObject = base.ToJObject(); + JObject jObject = base.ToJObject(); if (jObject == null) return null; - if(name != null) + if (name != null) { jObject.Add("Name", name); } - if(description != null) + if (description != null) { jObject.Add("Description", description); } @@ -198,7 +201,7 @@ public override JObject ToJObject() jObject.Add("Month", System.Convert.ToInt32(month)); jObject.Add("Day", System.Convert.ToInt32(day)); - if(loadType != LoadType.Undefined) + if (loadType != LoadType.Undefined) { jObject.Add("LoadType", loadType.ToString()); } @@ -206,4 +209,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Emitter.cs b/SAM/SAM.Analytical/Classes/Emitter.cs index 50ffa4eea..85ed8985c 100644 --- a/SAM/SAM.Analytical/Classes/Emitter.cs +++ b/SAM/SAM.Analytical/Classes/Emitter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; @@ -76,7 +79,7 @@ public override bool FromJObject(JObject jObject) if (!base.FromJObject(jObject)) return false; - if(jObject.ContainsKey("RadiantProportion")) + if (jObject.ContainsKey("RadiantProportion")) radiantProportion = jObject.Value("RadiantProportion"); if (jObject.ContainsKey("ViewCoefficient")) @@ -90,11 +93,11 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { - JObject jObject = base.ToJObject(); + JObject jObject = base.ToJObject(); if (jObject == null) return null; - if(!double.IsNaN(radiantProportion)) + if (!double.IsNaN(radiantProportion)) jObject.Add("RadiantProportion", radiantProportion); if (!double.IsNaN(viewCoefficient)) @@ -106,4 +109,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/ExternalPanel.cs b/SAM/SAM.Analytical/Classes/ExternalPanel.cs index c635224f4..8909cb902 100644 --- a/SAM/SAM.Analytical/Classes/ExternalPanel.cs +++ b/SAM/SAM.Analytical/Classes/ExternalPanel.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Spatial; @@ -11,7 +14,7 @@ public class ExternalPanel : SAMInstance, IPanel public ExternalPanel(Face3D face3D, Construction construction) : base(construction) { - this.face3D = face3D == null ? null :new Face3D(face3D); + this.face3D = face3D == null ? null : new Face3D(face3D); } public ExternalPanel(Face3D face3D) @@ -70,7 +73,7 @@ public override bool FromJObject(JObject jObject) return false; } - if(jObject.ContainsKey("Face3D")) + if (jObject.ContainsKey("Face3D")) { face3D = new Face3D(jObject.Value()); } @@ -80,13 +83,13 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { - JObject jObject = base.ToJObject(); + JObject jObject = base.ToJObject(); if (jObject == null) { return null; } - if(face3D != null) + if (face3D != null) { jObject.Add("Face3D", face3D.ToJObject()); } @@ -94,4 +97,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/ExternalSpace.cs b/SAM/SAM.Analytical/Classes/ExternalSpace.cs index 553b2d147..10fc214aa 100644 --- a/SAM/SAM.Analytical/Classes/ExternalSpace.cs +++ b/SAM/SAM.Analytical/Classes/ExternalSpace.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Spatial; using System; @@ -53,7 +56,7 @@ public override bool FromJObject(JObject jObject) return false; } - if(jObject.ContainsKey("Location")) + if (jObject.ContainsKey("Location")) { location = new Point3D(jObject.Value("Location")); } @@ -63,13 +66,13 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { - JObject jObject = base.ToJObject(); + JObject jObject = base.ToJObject(); if (jObject == null) { return null; } - if(location != null) + if (location != null) { jObject.Add("Location", location.ToJObject()); } @@ -77,4 +80,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/FeatureShade.cs b/SAM/SAM.Analytical/Classes/FeatureShade.cs index 7c7b5a0bb..0548018b3 100644 --- a/SAM/SAM.Analytical/Classes/FeatureShade.cs +++ b/SAM/SAM.Analytical/Classes/FeatureShade.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical @@ -44,7 +47,7 @@ public FeatureShade(string name, string description, double surfaceHeight, doubl public FeatureShade(FeatureShade featureShade) : base(featureShade) { - if(featureShade is not null) + if (featureShade is not null) { description = featureShade.description; surfaceHeight = featureShade.surfaceHeight; @@ -135,7 +138,7 @@ public override JObject ToJObject() return null; } - if(description is not null) + if (description is not null) { jObject.Add("Description", description); } @@ -294,4 +297,4 @@ public double OverhangTransmittance } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/ApertureApertureConstructionFilter.cs b/SAM/SAM.Analytical/Classes/Filter/ApertureApertureConstructionFilter.cs index 400fedb67..56737db14 100644 --- a/SAM/SAM.Analytical/Classes/Filter/ApertureApertureConstructionFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/ApertureApertureConstructionFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical diff --git a/SAM/SAM.Analytical/Classes/Filter/ApertureApertureTypeFilter.cs b/SAM/SAM.Analytical/Classes/Filter/ApertureApertureTypeFilter.cs index 0de5c6e64..44f0747e9 100644 --- a/SAM/SAM.Analytical/Classes/Filter/ApertureApertureTypeFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/ApertureApertureTypeFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical @@ -7,7 +10,7 @@ public class ApertureApertureTypeFilter : EnumFilter { public ApertureApertureTypeFilter(ApertureType apertureType) - :base() + : base() { Value = apertureType; } @@ -29,7 +32,7 @@ public override bool TryGetEnum(IJSAMObject jSAMObject, out ApertureType apertur apertureType = ApertureType.Undefined; Aperture aperture = jSAMObject as Aperture; - if(aperture == null) + if (aperture == null) { return false; } @@ -38,4 +41,4 @@ public override bool TryGetEnum(IJSAMObject jSAMObject, out ApertureType apertur return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/ApertureAzimuthFilter.cs b/SAM/SAM.Analytical/Classes/Filter/ApertureAzimuthFilter.cs index 7d50911f9..4bcc04a14 100644 --- a/SAM/SAM.Analytical/Classes/Filter/ApertureAzimuthFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/ApertureAzimuthFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical @@ -36,4 +39,4 @@ public override bool TryGetNumber(IJSAMObject jSAMObject, out double number) return !double.IsNaN(number); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/ApertureFrameAreaFilter.cs b/SAM/SAM.Analytical/Classes/Filter/ApertureFrameAreaFilter.cs index 408a04369..1d43dcc0f 100644 --- a/SAM/SAM.Analytical/Classes/Filter/ApertureFrameAreaFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/ApertureFrameAreaFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical @@ -36,4 +39,4 @@ public override bool TryGetNumber(IJSAMObject jSAMObject, out double number) return !double.IsNaN(number); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/AperturePaneAreaFilter.cs b/SAM/SAM.Analytical/Classes/Filter/AperturePaneAreaFilter.cs index 7df48a669..1ecc0cd15 100644 --- a/SAM/SAM.Analytical/Classes/Filter/AperturePaneAreaFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/AperturePaneAreaFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical @@ -36,4 +39,4 @@ public override bool TryGetNumber(IJSAMObject jSAMObject, out double number) return !double.IsNaN(number); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/MultiRelationAdjacencyClusterFilter.cs b/SAM/SAM.Analytical/Classes/Filter/MultiRelationAdjacencyClusterFilter.cs index 5369c72e6..92ef0926e 100644 --- a/SAM/SAM.Analytical/Classes/Filter/MultiRelationAdjacencyClusterFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/MultiRelationAdjacencyClusterFilter.cs @@ -1,9 +1,12 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical { - public abstract class MultiRelationAdjacencyClusterFilter : MultiRelationFilter, IAdjacencyClusterFilter where T: IJSAMObject + public abstract class MultiRelationAdjacencyClusterFilter : MultiRelationFilter, IAdjacencyClusterFilter where T : IJSAMObject { public AdjacencyCluster AdjacencyCluster { get; set; } @@ -13,15 +16,15 @@ public MultiRelationAdjacencyClusterFilter(IFilter filter) } public MultiRelationAdjacencyClusterFilter(JObject jObject) - :base(jObject) + : base(jObject) { } public MultiRelationAdjacencyClusterFilter(MultiRelationAdjacencyClusterFilter multiRelationAdjacencyClusterFilter) - :base(multiRelationAdjacencyClusterFilter) + : base(multiRelationAdjacencyClusterFilter) { AdjacencyCluster = multiRelationAdjacencyClusterFilter?.AdjacencyCluster; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/PanelApertureCountFilter.cs b/SAM/SAM.Analytical/Classes/Filter/PanelApertureCountFilter.cs index 396f4aa38..160e0f969 100644 --- a/SAM/SAM.Analytical/Classes/Filter/PanelApertureCountFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/PanelApertureCountFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections.Generic; @@ -39,4 +42,4 @@ public override bool TryGetNumber(IJSAMObject jSAMObject, out double number) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/PanelAperturesFilter.cs b/SAM/SAM.Analytical/Classes/Filter/PanelAperturesFilter.cs index 1a1caaf0a..47f3fe58d 100644 --- a/SAM/SAM.Analytical/Classes/Filter/PanelAperturesFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/PanelAperturesFilter.cs @@ -1,4 +1,7 @@ - +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + + using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections.Generic; @@ -8,13 +11,13 @@ namespace SAM.Analytical public class PanelAperturesFilter : MultiRelationFilter { public PanelAperturesFilter(JObject jObject) - :base(jObject) + : base(jObject) { } public PanelAperturesFilter(PanelAperturesFilter panelAperturesFilter) - :base(panelAperturesFilter) + : base(panelAperturesFilter) { } @@ -28,7 +31,7 @@ public PanelAperturesFilter(IFilter filter) public override List GetRelatives(IJSAMObject jSAMObject) { Panel panel = jSAMObject as Panel; - if(panel == null) + if (panel == null) { return null; } @@ -36,4 +39,4 @@ public override List GetRelatives(IJSAMObject jSAMObject) return panel.Apertures; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/PanelAreaFilter.cs b/SAM/SAM.Analytical/Classes/Filter/PanelAreaFilter.cs index 0daee499d..f68795fa7 100644 --- a/SAM/SAM.Analytical/Classes/Filter/PanelAreaFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/PanelAreaFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical @@ -36,4 +39,4 @@ public override bool TryGetNumber(IJSAMObject jSAMObject, out double number) return !double.IsNaN(number); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/PanelAzimuthFilter.cs b/SAM/SAM.Analytical/Classes/Filter/PanelAzimuthFilter.cs index a591a2167..c6f502457 100644 --- a/SAM/SAM.Analytical/Classes/Filter/PanelAzimuthFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/PanelAzimuthFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical @@ -36,4 +39,4 @@ public override bool TryGetNumber(IJSAMObject jSAMObject, out double number) return !double.IsNaN(number); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/PanelBoundaryTypeFilter.cs b/SAM/SAM.Analytical/Classes/Filter/PanelBoundaryTypeFilter.cs index f6e2eef1f..6a919c0ca 100644 --- a/SAM/SAM.Analytical/Classes/Filter/PanelBoundaryTypeFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/PanelBoundaryTypeFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical @@ -8,19 +11,19 @@ public class PanelBoundaryTypeFilter : EnumFilter, IAdjacencyClust public AdjacencyCluster AdjacencyCluster { get; set; } public PanelBoundaryTypeFilter(BoundaryType boundaryType) - :base() + : base() { Value = boundaryType; } public PanelBoundaryTypeFilter(JObject jObject) - :base(jObject) + : base(jObject) { } public PanelBoundaryTypeFilter(PanelBoundaryTypeFilter panelBoundaryTypeFilter) - :base(panelBoundaryTypeFilter) + : base(panelBoundaryTypeFilter) { } @@ -30,13 +33,13 @@ public override bool TryGetEnum(IJSAMObject jSAMObject, out BoundaryType boundar { boundaryType = BoundaryType.Undefined; - if(AdjacencyCluster == null || jSAMObject == null) + if (AdjacencyCluster == null || jSAMObject == null) { return false; } Panel panel = jSAMObject as Panel; - if(panel == null) + if (panel == null) { return false; } @@ -45,4 +48,4 @@ public override bool TryGetEnum(IJSAMObject jSAMObject, out BoundaryType boundar return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/PanelConstructionFilter.cs b/SAM/SAM.Analytical/Classes/Filter/PanelConstructionFilter.cs index 4d51f837d..b264df8ae 100644 --- a/SAM/SAM.Analytical/Classes/Filter/PanelConstructionFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/PanelConstructionFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical @@ -6,7 +9,7 @@ namespace SAM.Analytical public class PanelConstructionFilter : RelationFilter { public PanelConstructionFilter(IFilter filter) - :base(filter) + : base(filter) { } @@ -26,7 +29,7 @@ public PanelConstructionFilter(JObject jObject) public override Construction GetRelative(IJSAMObject jSAMObject) { Panel panel = jSAMObject as Panel; - if(panel == null) + if (panel == null) { return null; } @@ -34,4 +37,4 @@ public override Construction GetRelative(IJSAMObject jSAMObject) return panel.Construction; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/PanelMaxElevationFilter.cs b/SAM/SAM.Analytical/Classes/Filter/PanelMaxElevationFilter.cs index 713fd82fa..f4c5f8de4 100644 --- a/SAM/SAM.Analytical/Classes/Filter/PanelMaxElevationFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/PanelMaxElevationFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical @@ -36,4 +39,4 @@ public override bool TryGetNumber(IJSAMObject jSAMObject, out double number) return !double.IsNaN(number); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/PanelMinElevationFilter.cs b/SAM/SAM.Analytical/Classes/Filter/PanelMinElevationFilter.cs index de8fdce1b..d6e98eb10 100644 --- a/SAM/SAM.Analytical/Classes/Filter/PanelMinElevationFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/PanelMinElevationFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical @@ -36,4 +39,4 @@ public override bool TryGetNumber(IJSAMObject jSAMObject, out double number) return !double.IsNaN(number); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/PanelPanelGroupFilter.cs b/SAM/SAM.Analytical/Classes/Filter/PanelPanelGroupFilter.cs index 502f4d6cb..12d0f72e9 100644 --- a/SAM/SAM.Analytical/Classes/Filter/PanelPanelGroupFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/PanelPanelGroupFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical @@ -7,19 +10,19 @@ public class PanelPanelGroupFilter : EnumFilter { public PanelPanelGroupFilter(PanelGroup panelGroup) - :base() + : base() { Value = panelGroup; } public PanelPanelGroupFilter(PanelPanelGroupFilter panelPanelGroupFilter) - :base(panelPanelGroupFilter) + : base(panelPanelGroupFilter) { } public PanelPanelGroupFilter(JObject jObject) - :base(jObject) + : base(jObject) { } @@ -29,7 +32,7 @@ public override bool TryGetEnum(IJSAMObject jSAMObject, out PanelGroup panelGrou panelGroup = PanelGroup.Undefined; Panel panel = jSAMObject as Panel; - if(panel == null) + if (panel == null) { return false; } @@ -38,4 +41,4 @@ public override bool TryGetEnum(IJSAMObject jSAMObject, out PanelGroup panelGrou return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/PanelPanelTypeFilter.cs b/SAM/SAM.Analytical/Classes/Filter/PanelPanelTypeFilter.cs index 3d0a0d2ff..0bff2fec4 100644 --- a/SAM/SAM.Analytical/Classes/Filter/PanelPanelTypeFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/PanelPanelTypeFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical @@ -7,7 +10,7 @@ public class PanelPanelTypeFilter : EnumFilter { public PanelPanelTypeFilter(PanelType panelType) - :base() + : base() { Value = panelType; } @@ -29,7 +32,7 @@ public override bool TryGetEnum(IJSAMObject jSAMObject, out PanelType panelType) panelType = PanelType.Undefined; Panel panel = jSAMObject as Panel; - if(panel == null) + if (panel == null) { return false; } @@ -38,4 +41,4 @@ public override bool TryGetEnum(IJSAMObject jSAMObject, out PanelType panelType) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/PanelTiltFilter.cs b/SAM/SAM.Analytical/Classes/Filter/PanelTiltFilter.cs index 758c305d2..b2a461c92 100644 --- a/SAM/SAM.Analytical/Classes/Filter/PanelTiltFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/PanelTiltFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical @@ -36,4 +39,4 @@ public override bool TryGetNumber(IJSAMObject jSAMObject, out double number) return !double.IsNaN(number); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/SpaceAreaFilter.cs b/SAM/SAM.Analytical/Classes/Filter/SpaceAreaFilter.cs index fb41da5a3..781240d37 100644 --- a/SAM/SAM.Analytical/Classes/Filter/SpaceAreaFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/SpaceAreaFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Spatial; @@ -7,7 +10,7 @@ namespace SAM.Analytical public class SpaceAreaFilter : NumberFilter, IAdjacencyClusterFilter { public double Offset { get; set; } = 0.01; - + public AdjacencyCluster AdjacencyCluster { get; set; } public SpaceAreaFilter(NumberComparisonType numberComparisonType, double value) @@ -52,4 +55,4 @@ public override bool TryGetNumber(IJSAMObject jSAMObject, out double number) return !double.IsNaN(number); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/SpaceCoolingSystemFullNameFilter.cs b/SAM/SAM.Analytical/Classes/Filter/SpaceCoolingSystemFullNameFilter.cs index 7628c73d9..efc3f5e51 100644 --- a/SAM/SAM.Analytical/Classes/Filter/SpaceCoolingSystemFullNameFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/SpaceCoolingSystemFullNameFilter.cs @@ -1,10 +1,13 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical { public class SpaceCoolingSystemFullNameFilter : SpaceMechanicalSystemFullNameFilter - { + { public SpaceCoolingSystemFullNameFilter(TextComparisonType textComparisonType, string value) : base(textComparisonType, value) { @@ -23,4 +26,4 @@ public SpaceCoolingSystemFullNameFilter(JObject jObject) } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/SpaceCoolingSystemTypeNameFilter.cs b/SAM/SAM.Analytical/Classes/Filter/SpaceCoolingSystemTypeNameFilter.cs index c6a863cf0..d7a9d2165 100644 --- a/SAM/SAM.Analytical/Classes/Filter/SpaceCoolingSystemTypeNameFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/SpaceCoolingSystemTypeNameFilter.cs @@ -1,10 +1,13 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical { public class SpaceCoolingSystemTypeNameFilter : SpaceMechanicalSystemTypeNameFilter - { + { public SpaceCoolingSystemTypeNameFilter(TextComparisonType textComparisonType, string value) : base(textComparisonType, value) { @@ -23,4 +26,4 @@ public SpaceCoolingSystemTypeNameFilter(JObject jObject) } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/SpaceElevationFilter.cs b/SAM/SAM.Analytical/Classes/Filter/SpaceElevationFilter.cs index 041374bef..21e814534 100644 --- a/SAM/SAM.Analytical/Classes/Filter/SpaceElevationFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/SpaceElevationFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Spatial; @@ -56,4 +59,4 @@ public override bool TryGetNumber(IJSAMObject jSAMObject, out double number) return !double.IsNaN(number); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/SpaceHeatingSystemFullNameFilter.cs b/SAM/SAM.Analytical/Classes/Filter/SpaceHeatingSystemFullNameFilter.cs index 898f554d3..ccb611b69 100644 --- a/SAM/SAM.Analytical/Classes/Filter/SpaceHeatingSystemFullNameFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/SpaceHeatingSystemFullNameFilter.cs @@ -1,10 +1,13 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical { public class SpaceHeatingSystemFullNameFilter : SpaceMechanicalSystemFullNameFilter - { + { public SpaceHeatingSystemFullNameFilter(TextComparisonType textComparisonType, string value) : base(textComparisonType, value) { @@ -23,4 +26,4 @@ public SpaceHeatingSystemFullNameFilter(JObject jObject) } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/SpaceHeatinigSystemTypeNameFilter.cs b/SAM/SAM.Analytical/Classes/Filter/SpaceHeatinigSystemTypeNameFilter.cs index 09b582930..3435431d9 100644 --- a/SAM/SAM.Analytical/Classes/Filter/SpaceHeatinigSystemTypeNameFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/SpaceHeatinigSystemTypeNameFilter.cs @@ -1,10 +1,13 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical { public class SpaceHeatingSystemTypeNameFilter : SpaceMechanicalSystemTypeNameFilter - { + { public SpaceHeatingSystemTypeNameFilter(TextComparisonType textComparisonType, string value) : base(textComparisonType, value) { @@ -23,4 +26,4 @@ public SpaceHeatingSystemTypeNameFilter(JObject jObject) } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/SpaceInternalConditionFilter.cs b/SAM/SAM.Analytical/Classes/Filter/SpaceInternalConditionFilter.cs index a33576493..6735e4677 100644 --- a/SAM/SAM.Analytical/Classes/Filter/SpaceInternalConditionFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/SpaceInternalConditionFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical @@ -28,4 +31,4 @@ public override InternalCondition GetRelative(IJSAMObject jSAMObject) return (jSAMObject as Space)?.InternalCondition; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/SpaceMechanicalSystemFullNameFilter.cs b/SAM/SAM.Analytical/Classes/Filter/SpaceMechanicalSystemFullNameFilter.cs index a5ec692a0..467850d75 100644 --- a/SAM/SAM.Analytical/Classes/Filter/SpaceMechanicalSystemFullNameFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/SpaceMechanicalSystemFullNameFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -6,7 +9,7 @@ namespace SAM.Analytical { public abstract class SpaceMechanicalSystemFullNameFilter : TextFilter, IAdjacencyClusterFilter where T : MechanicalSystem - { + { public AdjacencyCluster AdjacencyCluster { get; set; } public SpaceMechanicalSystemFullNameFilter(TextComparisonType textComparisonType, string value) @@ -44,7 +47,7 @@ public override bool TryGetText(IJSAMObject jSAMObject, out string text) } List mechanicalSystems = adjacencyCluster.GetRelatedObjects(space); - if(mechanicalSystems == null || mechanicalSystems.Count == 0) + if (mechanicalSystems == null || mechanicalSystems.Count == 0) { return false; } @@ -53,4 +56,4 @@ public override bool TryGetText(IJSAMObject jSAMObject, out string text) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/SpaceMechanicalSystemTypeNameFilter.cs b/SAM/SAM.Analytical/Classes/Filter/SpaceMechanicalSystemTypeNameFilter.cs index 99ffdbd53..d3d854a84 100644 --- a/SAM/SAM.Analytical/Classes/Filter/SpaceMechanicalSystemTypeNameFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/SpaceMechanicalSystemTypeNameFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -6,7 +9,7 @@ namespace SAM.Analytical { public abstract class SpaceMechanicalSystemTypeNameFilter : TextFilter, IAdjacencyClusterFilter where T : MechanicalSystem - { + { public AdjacencyCluster AdjacencyCluster { get; set; } public SpaceMechanicalSystemTypeNameFilter(TextComparisonType textComparisonType, string value) @@ -44,7 +47,7 @@ public override bool TryGetText(IJSAMObject jSAMObject, out string text) } List mechanicalSystems = adjacencyCluster.GetRelatedObjects(space); - if(mechanicalSystems == null || mechanicalSystems.Count == 0) + if (mechanicalSystems == null || mechanicalSystems.Count == 0) { return false; } @@ -53,4 +56,4 @@ public override bool TryGetText(IJSAMObject jSAMObject, out string text) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/SpacePanelsFilter.cs b/SAM/SAM.Analytical/Classes/Filter/SpacePanelsFilter.cs index df241a144..2458eb31e 100644 --- a/SAM/SAM.Analytical/Classes/Filter/SpacePanelsFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/SpacePanelsFilter.cs @@ -1,4 +1,7 @@ - +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + + using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections.Generic; @@ -28,7 +31,7 @@ public SpacePanelsFilter(JObject jObject) public override List GetRelatives(IJSAMObject jSAMObject) { Space space = (jSAMObject as Space); - if(space == null) + if (space == null) { return null; } @@ -36,4 +39,4 @@ public override List GetRelatives(IJSAMObject jSAMObject) return AdjacencyCluster.GetPanels(space); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/SpaceVentilationSystemFullNameFilter.cs b/SAM/SAM.Analytical/Classes/Filter/SpaceVentilationSystemFullNameFilter.cs index 79d24b8d4..1c8db9896 100644 --- a/SAM/SAM.Analytical/Classes/Filter/SpaceVentilationSystemFullNameFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/SpaceVentilationSystemFullNameFilter.cs @@ -1,10 +1,13 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical { public class SpaceVentilationSystemFullNameFilter : SpaceMechanicalSystemFullNameFilter - { + { public SpaceVentilationSystemFullNameFilter(TextComparisonType textComparisonType, string value) : base(textComparisonType, value) { @@ -23,4 +26,4 @@ public SpaceVentilationSystemFullNameFilter(JObject jObject) } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/SpaceVentilationSystemTypeNameFilter.cs b/SAM/SAM.Analytical/Classes/Filter/SpaceVentilationSystemTypeNameFilter.cs index cda79eab9..9049ffbbd 100644 --- a/SAM/SAM.Analytical/Classes/Filter/SpaceVentilationSystemTypeNameFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/SpaceVentilationSystemTypeNameFilter.cs @@ -1,10 +1,13 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical { public class SpaceVentilationSystemTypeNameFilter : SpaceMechanicalSystemTypeNameFilter - { + { public SpaceVentilationSystemTypeNameFilter(TextComparisonType textComparisonType, string value) : base(textComparisonType, value) { @@ -23,4 +26,4 @@ public SpaceVentilationSystemTypeNameFilter(JObject jObject) } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/SpaceVolumeFilter.cs b/SAM/SAM.Analytical/Classes/Filter/SpaceVolumeFilter.cs index d11b97a29..aaa759414 100644 --- a/SAM/SAM.Analytical/Classes/Filter/SpaceVolumeFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/SpaceVolumeFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Spatial; @@ -50,4 +53,4 @@ public override bool TryGetNumber(IJSAMObject jSAMObject, out double number) return !double.IsNaN(number); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Filter/SpaceZonesFilter.cs b/SAM/SAM.Analytical/Classes/Filter/SpaceZonesFilter.cs index de01b3cc7..2bb671f8f 100644 --- a/SAM/SAM.Analytical/Classes/Filter/SpaceZonesFilter.cs +++ b/SAM/SAM.Analytical/Classes/Filter/SpaceZonesFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections.Generic; @@ -28,7 +31,7 @@ public SpaceZonesFilter(JObject jObject) public override List GetRelatives(IJSAMObject jSAMObject) { Space space = (jSAMObject as Space); - if(space == null) + if (space == null) { return null; } @@ -36,4 +39,4 @@ public override List GetRelatives(IJSAMObject jSAMObject) return AdjacencyCluster.GetZones(space); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Function.cs b/SAM/SAM.Analytical/Classes/Function.cs index 4c43680a4..27e1a9828 100644 --- a/SAM/SAM.Analytical/Classes/Function.cs +++ b/SAM/SAM.Analytical/Classes/Function.cs @@ -1,8 +1,10 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; using System.Collections.Generic; -using System.Drawing; namespace SAM.Analytical { @@ -19,7 +21,7 @@ public Function(string name, IEnumerable values) public Function(Function function) { - if(function != null) + if (function != null) { name = function.name; values = function.values == null ? null : [.. function.values]; @@ -43,11 +45,11 @@ public double this[int index] { get { - if(values is null || index >= values.Count) + if (values is null || index >= values.Count) { return double.NaN; } - + return values[index]; } @@ -91,15 +93,15 @@ public bool FromJObject(JObject jObject) public FunctionType GetFunctionType() { - string name_Temp = name?.Trim().ToLower(); - if(string.IsNullOrWhiteSpace(name_Temp)) + string name_Temp = name?.Trim().ToLower(); + if (string.IsNullOrWhiteSpace(name_Temp)) { return FunctionType.Undefined; } - foreach(FunctionType functionType in Enum.GetValues(typeof(FunctionType))) + foreach (FunctionType functionType in Enum.GetValues(typeof(FunctionType))) { - if(name_Temp.Equals(functionType.ToString())) + if (name_Temp.Equals(functionType.ToString())) { return functionType; } @@ -126,7 +128,7 @@ public JObject ToJObject() if (values != null) { JArray jArray = []; - foreach(double value in values) + foreach (double value in values) { jArray.Add(value); } @@ -139,11 +141,11 @@ public JObject ToJObject() public override string ToString() { - List strings = [ name ?? string.Empty]; - - if(values != null) + List strings = [name ?? string.Empty]; + + if (values != null) { - foreach(double value in values) + foreach (double value in values) { strings.Add(value.ToString()); } @@ -158,4 +160,4 @@ public override bool Equals(object obj) return base.Equals(obj); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Glazing.cs b/SAM/SAM.Analytical/Classes/Glazing.cs index 5fdbc7f05..dd06f1696 100644 --- a/SAM/SAM.Analytical/Classes/Glazing.cs +++ b/SAM/SAM.Analytical/Classes/Glazing.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -193,7 +196,7 @@ public static Result Compute( { gaps = Array.Empty(); } - + if (gaps.Count != System.Math.Max(0, layers.Count - 1)) { throw new ArgumentException("gaps.Count must equal layers.Count - 1."); diff --git a/SAM/SAM.Analytical/Classes/InternalCondition.cs b/SAM/SAM.Analytical/Classes/InternalCondition.cs index 44774c38b..754ccf4d2 100644 --- a/SAM/SAM.Analytical/Classes/InternalCondition.cs +++ b/SAM/SAM.Analytical/Classes/InternalCondition.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; using System.Collections.Generic; @@ -51,7 +54,7 @@ public InternalCondition(JObject jObject) public string GetProfileName(ProfileType profileType) { InternalConditionParameter? internalConditionParameter = Query.InternalConditionParameter(profileType); - if(internalConditionParameter == null || !internalConditionParameter.HasValue) + if (internalConditionParameter == null || !internalConditionParameter.HasValue) { return null; } @@ -70,7 +73,7 @@ public bool SetProfileName(ProfileType profileType, string name) return SetValue(internalConditionParameter.Value, name); } - public string GetSystemTypeName() where T: ISystemType + public string GetSystemTypeName() where T : ISystemType { if (typeof(T) == typeof(VentilationSystemType)) return GetValue(InternalConditionParameter.VentilationSystemTypeName); @@ -147,7 +150,7 @@ public Dictionary GetProfileDictionary(ProfileLibrary prof return result; } - public T GetSystemType(SystemTypeLibrary systemTypeLibrary) where T: ISystemType + public T GetSystemType(SystemTypeLibrary systemTypeLibrary) where T : ISystemType { if (systemTypeLibrary == null) return default; @@ -176,4 +179,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/InternalConditionLibrary.cs b/SAM/SAM.Analytical/Classes/InternalConditionLibrary.cs index c97a09ed6..7f0cb1cf0 100644 --- a/SAM/SAM.Analytical/Classes/InternalConditionLibrary.cs +++ b/SAM/SAM.Analytical/Classes/InternalConditionLibrary.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; using System.Collections.Generic; @@ -73,7 +76,7 @@ public List GetInternalConditions(string text, TextComparison { if (string.IsNullOrWhiteSpace(text)) return null; - + List internalConditions = GetInternalConditions(); if (internalConditions == null || internalConditions.Count == 0) return null; @@ -81,4 +84,4 @@ public List GetInternalConditions(string text, TextComparison return internalConditions.FindAll(x => Core.Query.Compare(x.Name, text, textComparisonType, caseSensitive)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/MergeSettings.cs b/SAM/SAM.Analytical/Classes/MergeSettings.cs index 0460ea086..2d843e216 100644 --- a/SAM/SAM.Analytical/Classes/MergeSettings.cs +++ b/SAM/SAM.Analytical/Classes/MergeSettings.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections.Generic; @@ -7,16 +10,16 @@ namespace SAM.Analytical public class MergeSettings : IJSAMObject { private Dictionary dictionary; - + public MergeSettings(IEnumerable typeMergeSettings) { - if(typeMergeSettings != null) + if (typeMergeSettings != null) { dictionary = new Dictionary(); foreach (TypeMergeSettings typeMergeSettings_Temp in typeMergeSettings) { - if(typeMergeSettings_Temp?.TypeName == null) + if (typeMergeSettings_Temp?.TypeName == null) { continue; } @@ -41,7 +44,7 @@ public TypeMergeSettings this[string name] { get { - if(dictionary == null || !dictionary.TryGetValue(name, out TypeMergeSettings result)) + if (dictionary == null || !dictionary.TryGetValue(name, out TypeMergeSettings result)) { return null; } @@ -49,10 +52,10 @@ public TypeMergeSettings this[string name] return result; } } - + public bool FromJObject(JObject jObject) { - if(jObject == null) + if (jObject == null) { return false; } @@ -60,13 +63,13 @@ public bool FromJObject(JObject jObject) if (jObject.ContainsKey("TypeMergeSettings")) { JArray jArray = jObject.Value("TypeMergeSettings"); - if(jArray != null) + if (jArray != null) { dictionary = new Dictionary(); - foreach(JObject jObject_TypeMergeSettings in jArray) + foreach (JObject jObject_TypeMergeSettings in jArray) { TypeMergeSettings typeMergeSettings = Core.Query.IJSAMObject(jObject_TypeMergeSettings); - if(typeMergeSettings?.TypeName == null) + if (typeMergeSettings?.TypeName == null) { continue; } @@ -83,11 +86,11 @@ public JObject ToJObject() { JObject jObject = new JObject(); jObject.Add("_type", Core.Query.FullTypeName(this)); - - if(dictionary != null) + + if (dictionary != null) { JArray jArray = new JArray(); - foreach(TypeMergeSettings typeMergeSettings in dictionary.Values) + foreach (TypeMergeSettings typeMergeSettings in dictionary.Values) { jArray.Add(typeMergeSettings.ToJObject()); } @@ -98,4 +101,4 @@ public JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Modifier/DailyModifier.cs b/SAM/SAM.Analytical/Classes/Modifier/DailyModifier.cs index af2a74713..bc9944862 100644 --- a/SAM/SAM.Analytical/Classes/Modifier/DailyModifier.cs +++ b/SAM/SAM.Analytical/Classes/Modifier/DailyModifier.cs @@ -1,8 +1,9 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; -using SAM.Core.Attributes; using System.Collections.Generic; -using System.Drawing; using System.Linq; namespace SAM.Analytical @@ -15,7 +16,7 @@ public class DailyModifier : IndexedSimpleModifier public DailyModifier(ArithmeticOperator arithmeticOperator, IEnumerable> values) { ArithmeticOperator = arithmeticOperator; - if(values != null) + if (values != null) { this.values = new Dictionary(); dayNames = new List(); @@ -38,7 +39,7 @@ public DailyModifier(ArithmeticOperator arithmeticOperator, IEnumerable(dailyModifier.dayNames); if (dailyModifier.values != null) @@ -62,7 +63,7 @@ public DailyModifier(DailyModifier dailyModifier) } public DailyModifier(JObject jObject) - :base(jObject) + : base(jObject) { } @@ -95,29 +96,29 @@ public override bool ContainsIndex(int index) public override bool FromJObject(JObject jObject) { bool result = base.FromJObject(jObject); - if(!result) + if (!result) { return result; } - if(jObject.ContainsKey("DayNames")) + if (jObject.ContainsKey("DayNames")) { dayNames = new List(); - foreach(string dayName in jObject.Value("DayNames")) + foreach (string dayName in jObject.Value("DayNames")) { dayNames.Add(dayName); } } - if(jObject.ContainsKey("Values")) + if (jObject.ContainsKey("Values")) { values = new Dictionary(); - foreach(JArray jArray in jObject.Value("Values")) + foreach (JArray jArray in jObject.Value("Values")) { string dayName = jArray[0]?.ToString(); List values_Temp = new List(); - foreach(double value in jArray[1]) + foreach (double value in jArray[1]) { values_Temp.Add(value); } @@ -128,7 +129,7 @@ public override bool FromJObject(JObject jObject) return result; } - + public override double GetCalculatedValue(int index, double value) { if (values == null) @@ -161,12 +162,12 @@ public override double GetCalculatedValue(int index, double value) public double GetValue(string dayName, int index) { - if(dayName == null) + if (dayName == null) { return double.NaN; } - if(values.TryGetValue(dayName, out double[] values_Day)) + if (values.TryGetValue(dayName, out double[] values_Day)) { return values_Day[index]; } @@ -177,12 +178,12 @@ public double GetValue(string dayName, int index) public override JObject ToJObject() { JObject result = base.ToJObject(); - if(result == null) + if (result == null) { return null; } - if(dayNames != null) + if (dayNames != null) { JArray jArray = new JArray(); dayNames.ForEach(x => jArray.Add(x)); @@ -190,16 +191,16 @@ public override JObject ToJObject() result.Add("DayNames", jArray); } - if(values != null) + if (values != null) { JArray jArray = new JArray(); - foreach(KeyValuePair keyValuePair in values) + foreach (KeyValuePair keyValuePair in values) { JArray jArray_Temp = new JArray(); jArray_Temp.Add(keyValuePair.Key); JArray jArray_Values = new JArray(); - foreach(double value in keyValuePair.Value) + foreach (double value in keyValuePair.Value) { jArray_Values.Add(value); } @@ -214,4 +215,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Modifier/IndexedDoublesModifier.cs b/SAM/SAM.Analytical/Classes/Modifier/IndexedDoublesModifier.cs index 08c5e4d7e..aa38c527a 100644 --- a/SAM/SAM.Analytical/Classes/Modifier/IndexedDoublesModifier.cs +++ b/SAM/SAM.Analytical/Classes/Modifier/IndexedDoublesModifier.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical @@ -27,7 +30,7 @@ public IndexedDoublesModifier(JObject jObject) } public IndexedDoubles Values { get; set; } - + public override bool ContainsIndex(int index) { if (Values == null) @@ -41,12 +44,12 @@ public override bool ContainsIndex(int index) public override bool FromJObject(JObject jObject) { bool result = base.FromJObject(jObject); - if(!result) + if (!result) { return result; } - if(jObject.ContainsKey("Values")) + if (jObject.ContainsKey("Values")) { Values = Core.Query.IJSAMObject(jObject.Value("Values")); } @@ -77,12 +80,12 @@ public override double GetCalculatedValue(int index, double value) public override JObject ToJObject() { JObject result = base.ToJObject(); - if(result == null) + if (result == null) { return null; } - if(Values != null) + if (Values != null) { result.Add("Values", Values.ToJObject()); } @@ -90,4 +93,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Modifier/ProfileModifier.cs b/SAM/SAM.Analytical/Classes/Modifier/ProfileModifier.cs index 4a36ca7cb..f889139d8 100644 --- a/SAM/SAM.Analytical/Classes/Modifier/ProfileModifier.cs +++ b/SAM/SAM.Analytical/Classes/Modifier/ProfileModifier.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical @@ -29,9 +32,9 @@ public ProfileModifier(JObject jObject) } public double Setback { get; set; } - + private Profile Profile { get; set; } - + public override bool ContainsIndex(int index) { if (Profile == null) @@ -45,17 +48,17 @@ public override bool ContainsIndex(int index) public override bool FromJObject(JObject jObject) { bool result = base.FromJObject(jObject); - if(!result) + if (!result) { return result; } - if(jObject.ContainsKey("Profile")) + if (jObject.ContainsKey("Profile")) { Profile = Core.Query.IJSAMObject(jObject.Value("Profile")); } - if(jObject.ContainsKey("Setback")) + if (jObject.ContainsKey("Setback")) { Setback = jObject.Value("Setback"); } @@ -86,17 +89,17 @@ public override double GetCalculatedValue(int index, double value) public override JObject ToJObject() { JObject result = base.ToJObject(); - if(result == null) + if (result == null) { return null; } - if(Profile != null) + if (Profile != null) { result.Add("Profile", Profile.ToJObject()); } - if(!double.IsNaN(Setback)) + if (!double.IsNaN(Setback)) { result.Add("Setback", Setback); } @@ -104,4 +107,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/NCM/NCMData.cs b/SAM/SAM.Analytical/Classes/NCM/NCMData.cs index 3b97a7e91..f5648ceb3 100644 --- a/SAM/SAM.Analytical/Classes/NCM/NCMData.cs +++ b/SAM/SAM.Analytical/Classes/NCM/NCMData.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical @@ -8,7 +11,7 @@ namespace SAM.Analytical /// public class NCMData : ParameterizedSAMObject { - public NCMName NCMName { get; set; } = "Unoccupied and Unconditioned"; + public NCMName NCMName { get; set; } = "Unoccupied and Unconditioned"; public NCMSystemType SystemType { get; set; } = NCMSystemType.NaturalVentilation; @@ -36,7 +39,7 @@ public class NCMData : ParameterizedSAMObject public string Description { get; set; } = null; - public string Name + public string Name { get { @@ -50,7 +53,7 @@ public string Name } public NCMData() - :base() + : base() { } @@ -61,9 +64,9 @@ public NCMData(JObject jObject) } public NCMData(NCMData nCMData) - :base(nCMData) + : base(nCMData) { - if(nCMData != null) + if (nCMData != null) { LightingOccupancyControls = nCMData.LightingOccupancyControls; LightingPhotoelectricControls = nCMData.LightingPhotoelectricControls; @@ -83,8 +86,8 @@ public NCMData(NCMData nCMData) public override bool FromJObject(JObject jObject) { bool result = base.FromJObject(jObject); - - if(!result) + + if (!result) { return false; } @@ -163,7 +166,7 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { JObject jObject = base.ToJObject(); - if(jObject == null) + if (jObject == null) { return null; } @@ -216,4 +219,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/NCM/NCMName.cs b/SAM/SAM.Analytical/Classes/NCM/NCMName.cs index 793d80ba5..c52959918 100644 --- a/SAM/SAM.Analytical/Classes/NCM/NCMName.cs +++ b/SAM/SAM.Analytical/Classes/NCM/NCMName.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections.Generic; @@ -69,12 +72,12 @@ public string FullName get { List values = new List(); - if(!string.IsNullOrWhiteSpace(group)) + if (!string.IsNullOrWhiteSpace(group)) { values.Add(group); } - if(!string.IsNullOrWhiteSpace(name)) + if (!string.IsNullOrWhiteSpace(name)) { values.Add(name); } @@ -111,12 +114,12 @@ public string UniqueId public bool FromJObject(JObject jObject) { - if(jObject == null) + if (jObject == null) { return false; } - if(jObject.ContainsKey("Name")) + if (jObject.ContainsKey("Name")) { name = jObject.Value("Name"); } @@ -144,7 +147,7 @@ public JObject ToJObject() JObject jObject = new JObject(); jObject.Add("_type", Core.Query.FullTypeName(this)); - if(name != null) + if (name != null) { jObject.Add("Name", name); } @@ -181,7 +184,7 @@ public static implicit operator string(NCMName nCMName) public static implicit operator NCMName(string value) { - if(value == null) + if (value == null) { return null; } @@ -198,4 +201,4 @@ public static implicit operator NCMName(string value) return new NCMName(name, null, null, group); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/NCM/NCMNameCollection.cs b/SAM/SAM.Analytical/Classes/NCM/NCMNameCollection.cs index 582cf5515..dfc45368e 100644 --- a/SAM/SAM.Analytical/Classes/NCM/NCMNameCollection.cs +++ b/SAM/SAM.Analytical/Classes/NCM/NCMNameCollection.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections; using System.Collections.Generic; @@ -16,7 +19,7 @@ public NCMNameCollection() public NCMNameCollection(IEnumerable nCMNames) { - if(nCMNames != null) + if (nCMNames != null) { this.nCMNames = new List(nCMNames); } @@ -29,7 +32,7 @@ public NCMNameCollection(JObject jObject) public bool Add(NCMName nCMName) { - if(nCMName == null) + if (nCMName == null) { return false; } @@ -40,19 +43,19 @@ public bool Add(NCMName nCMName) public bool FromJObject(JObject jObject) { - if(jObject == null) + if (jObject == null) { return false; } nCMNames = new List(); - if(jObject.ContainsKey("NCMNames")) + if (jObject.ContainsKey("NCMNames")) { JArray jArray = jObject.Value("NCMNames"); - foreach(JObject jObject_NCMName in jArray) + foreach (JObject jObject_NCMName in jArray) { - if(jObject_NCMName == null) + if (jObject_NCMName == null) { continue; } @@ -75,12 +78,12 @@ public JObject ToJObject() JObject jObject = new JObject(); jObject.Add("_type", Core.Query.FullTypeName(this)); - if(nCMNames != null) + if (nCMNames != null) { JArray jArray = new JArray(); - foreach(NCMName nCMName in nCMNames) + foreach (NCMName nCMName in nCMNames) { - if(nCMName == null) + if (nCMName == null) { continue; } @@ -99,4 +102,4 @@ IEnumerator IEnumerable.GetEnumerator() return GetEnumerator(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/New/AirPartition.cs b/SAM/SAM.Analytical/Classes/New/AirPartition.cs index 8f0b55c9c..032eb0fd5 100644 --- a/SAM/SAM.Analytical/Classes/New/AirPartition.cs +++ b/SAM/SAM.Analytical/Classes/New/AirPartition.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Geometry.Spatial; using System; @@ -7,7 +10,7 @@ namespace SAM.Analytical { public class AirPartition : BuildingElement, IPartition { - + public AirPartition(AirPartition airPartition) : base(airPartition) { diff --git a/SAM/SAM.Analytical/Classes/New/BuildingElement.cs b/SAM/SAM.Analytical/Classes/New/BuildingElement.cs index 67873b680..1443ad336 100644 --- a/SAM/SAM.Analytical/Classes/New/BuildingElement.cs +++ b/SAM/SAM.Analytical/Classes/New/BuildingElement.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Object.Spatial; @@ -6,10 +9,10 @@ namespace SAM.Analytical { - public abstract class BuildingElement : SAMInstance, IAnalyticalObject, IFace3DObject where T: BuildingElementType + public abstract class BuildingElement : SAMInstance, IAnalyticalObject, IFace3DObject where T : BuildingElementType { private Face3D face3D; - + public BuildingElement(BuildingElement buildingElement) : base(buildingElement) { @@ -35,9 +38,9 @@ public BuildingElement(System.Guid guid, T buildingElementType, Face3D face3D) } public BuildingElement(System.Guid guid, BuildingElement buildingElement, Face3D face3D) - :base(guid, buildingElement) + : base(guid, buildingElement) { - if(face3D != null) + if (face3D != null) { this.face3D = new Face3D(face3D); } @@ -56,7 +59,7 @@ public Face3D Face3D public virtual double GetArea() { - if(face3D == null) + if (face3D == null) { return double.NaN; } @@ -81,7 +84,7 @@ public override bool FromJObject(JObject jObject) return false; } - if(jObject.ContainsKey("Face3D")) + if (jObject.ContainsKey("Face3D")) { face3D = Geometry.Create.ISAMGeometry(jObject.Value("Face3D")); } diff --git a/SAM/SAM.Analytical/Classes/New/BuildingElementType.cs b/SAM/SAM.Analytical/Classes/New/BuildingElementType.cs index d0e65feec..fe4f1c8aa 100644 --- a/SAM/SAM.Analytical/Classes/New/BuildingElementType.cs +++ b/SAM/SAM.Analytical/Classes/New/BuildingElementType.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; diff --git a/SAM/SAM.Analytical/Classes/New/BuildingModel.cs b/SAM/SAM.Analytical/Classes/New/BuildingModel.cs index a051918d7..7ec8c0e03 100644 --- a/SAM/SAM.Analytical/Classes/New/BuildingModel.cs +++ b/SAM/SAM.Analytical/Classes/New/BuildingModel.cs @@ -1,13 +1,15 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; +using SAM.Architectural; using SAM.Core; +using SAM.Geometry.Object.Spatial; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; using System.Linq; - -using SAM.Architectural; using System.Threading.Tasks; -using SAM.Geometry.Object.Spatial; namespace SAM.Analytical { @@ -51,7 +53,7 @@ public BuildingModel(string description, Location location, Address address, Ter this.location = location?.Clone(); this.address = address?.Clone(); this.terrain = terrain?.Clone(); - if(materialLibrary != null) + if (materialLibrary != null) { this.materialLibrary = new MaterialLibrary(materialLibrary); } @@ -90,7 +92,7 @@ public Location Location } set { - if(value != null) + if (value != null) { location = value; } @@ -114,18 +116,18 @@ public Address Address public List GetObjects() where T : IJSAMObject { - if(typeof(T).IsAssignableFrom(typeof(IMaterial))) + if (typeof(T).IsAssignableFrom(typeof(IMaterial))) { List materials = materialLibrary?.GetObjects(); - if(materials == null) + if (materials == null) { return null; } List result = new List(); - foreach(IMaterial material in materials) + foreach (IMaterial material in materials) { - if(material is T) + if (material is T) { result.Add((T)material); } @@ -175,7 +177,7 @@ public List GetObjects() where T : IJSAMObject //return result; } - public List GetObjects(params Func[] functions) where T: IJSAMObject + public List GetObjects(params Func[] functions) where T : IJSAMObject { if (typeof(T).IsAssignableFrom(typeof(IMaterial))) { @@ -226,49 +228,49 @@ public List GetObjects(params Func[] functions) where T: IJSAMObj public T GetObject(Guid guid) where T : IJSAMObject { - if(relationCluster == null) + if (relationCluster == null) { return default; } T @object = relationCluster.GetObject(guid); - if(@object == null) + if (@object == null) { - if(typeof(IOpening).IsAssignableFrom(typeof(T))) + if (typeof(IOpening).IsAssignableFrom(typeof(T))) { List hostPartitions = relationCluster?.GetObjects(); - if(hostPartitions == null || hostPartitions.Count == 0) + if (hostPartitions == null || hostPartitions.Count == 0) { return default; } - foreach(IHostPartition hostPartition in hostPartitions) + foreach (IHostPartition hostPartition in hostPartitions) { - if(hostPartition == null) + if (hostPartition == null) { continue; } - if(hostPartition.HasOpening(guid)) + if (hostPartition.HasOpening(guid)) { IOpening opening = hostPartition.GetOpening(guid); - if(opening is T) + if (opening is T) { return (T)opening; } } } } - + return default; } return @object.Clone(); } - public List GetRelatedObjects(IJSAMObject jSAMObject) where T: IJSAMObject + public List GetRelatedObjects(IJSAMObject jSAMObject) where T : IJSAMObject { - if(jSAMObject == null) + if (jSAMObject == null) { return null; } @@ -284,7 +286,7 @@ public List GetRelatedObjects(IJSAMObject jSAMObject, Type type = n } List objects = null; - if(type == null) + if (type == null) { objects = relationCluster?.GetRelatedObjects(jSAMObject); } @@ -292,16 +294,16 @@ public List GetRelatedObjects(IJSAMObject jSAMObject, Type type = n { objects = relationCluster?.GetRelatedObjects(jSAMObject, type); } - if(objects == null) + if (objects == null) { return null; } List result = new List(); - foreach(object @object in objects) + foreach (object @object in objects) { IJSAMObject jSAMObject_Temp = Core.Query.Clone(@object as IJSAMObject); - if(jSAMObject_Temp == null) + if (jSAMObject_Temp == null) { continue; } @@ -314,14 +316,14 @@ public List GetRelatedObjects(IJSAMObject jSAMObject, Type type = n public bool RemoveObject(IJSAMObject jSAMObject) { - if(jSAMObject == null || relationCluster == null) + if (jSAMObject == null || relationCluster == null) { return false; } - if(jSAMObject is IMaterial) + if (jSAMObject is IMaterial) { - if(materialLibrary == null) + if (materialLibrary == null) { return false; } @@ -339,25 +341,25 @@ public bool RemoveObject(IJSAMObject jSAMObject) return profileLibrary.Remove((Profile)jSAMObject); } - if(relationCluster == null) + if (relationCluster == null) { return false; } - if(jSAMObject is IOpening) + if (jSAMObject is IOpening) { List hostPartitions = relationCluster?.GetObjects(); - if(hostPartitions != null) + if (hostPartitions != null) { IOpening opening = (IOpening)jSAMObject; - foreach(IHostPartition hostPartition in hostPartitions) + foreach (IHostPartition hostPartition in hostPartitions) { - if(hostPartition.HasOpening(opening.Guid)) + if (hostPartition.HasOpening(opening.Guid)) { hostPartition.RemoveOpening(opening.Guid); List openings = hostPartition.GetOpenings(); - if(openings == null || openings.Count == 0) + if (openings == null || openings.Count == 0) { relationCluster.RemoveRelation(hostPartition, opening.Type()); return true; @@ -365,22 +367,22 @@ public bool RemoveObject(IJSAMObject jSAMObject) bool removeRelation = true; OpeningType openingType = opening.Type(); - foreach(IOpening opening_Temp in openings) + foreach (IOpening opening_Temp in openings) { OpeningType openingType_Temp = opening_Temp?.Type(); - if(openingType_Temp == null) + if (openingType_Temp == null) { continue; } - if(openingType.Guid == openingType_Temp.Guid) + if (openingType.Guid == openingType_Temp.Guid) { removeRelation = false; break; } } - if(removeRelation) + if (removeRelation) { relationCluster.RemoveRelation(hostPartition, openingType); } @@ -390,49 +392,49 @@ public bool RemoveObject(IJSAMObject jSAMObject) } } } - else if(jSAMObject is InternalCondition) + else if (jSAMObject is InternalCondition) { InternalCondition internalCondition = (InternalCondition)jSAMObject; List spaces = relationCluster?.GetObjects(); - if(spaces != null) + if (spaces != null) { - foreach(Space space in spaces) + foreach (Space space in spaces) { InternalCondition internalCondition_Temp = space?.InternalCondition; - if(internalCondition_Temp == null) + if (internalCondition_Temp == null) { continue; } - if(internalCondition_Temp.Guid == internalCondition.Guid) + if (internalCondition_Temp.Guid == internalCondition.Guid) { space.InternalCondition = null; } } } } - else if(jSAMObject is OpeningType) + else if (jSAMObject is OpeningType) { OpeningType openingType = (OpeningType)jSAMObject; List hostPartitions = relationCluster?.GetRelatedObjects(jSAMObject); - if(hostPartitions != null && hostPartitions.Count != 0) + if (hostPartitions != null && hostPartitions.Count != 0) { - foreach(IHostPartition hostPartition in hostPartitions) + foreach (IHostPartition hostPartition in hostPartitions) { List openings = hostPartition?.GetOpenings(); - if(openings != null && openings.Count != 0) + if (openings != null && openings.Count != 0) { - foreach(IOpening opening in openings) + foreach (IOpening opening in openings) { OpeningType openingType_Temp = opening?.Type(); - if(openingType == null) + if (openingType == null) { continue; } - if(openingType.Guid == openingType.Guid) + if (openingType.Guid == openingType.Guid) { hostPartition.RemoveOpening(opening.Guid); } @@ -445,9 +447,9 @@ public bool RemoveObject(IJSAMObject jSAMObject) { HostPartitionType hostPartitionType = (HostPartitionType)jSAMObject; List hostPartitions = relationCluster?.GetRelatedObjects(hostPartitionType); - if(hostPartitions != null) + if (hostPartitions != null) { - foreach(IHostPartition hostPartition in hostPartitions) + foreach (IHostPartition hostPartition in hostPartitions) { relationCluster.RemoveObject(hostPartition.GetType(), hostPartition.Guid); } @@ -467,7 +469,7 @@ public bool RemoveObject(IJSAMObject jSAMObject) } Guid guid = relationCluster.GetGuid(jSAMObject); - if(guid == Guid.Empty) + if (guid == Guid.Empty) { return false; } @@ -477,7 +479,7 @@ public bool RemoveObject(IJSAMObject jSAMObject) public bool AddRelation(IJSAMObject jSAMObject_1, IJSAMObject jSAMObject_2) { - if(jSAMObject_1 == null || jSAMObject_2 == null || relationCluster == null) + if (jSAMObject_1 == null || jSAMObject_2 == null || relationCluster == null) { return false; } @@ -488,7 +490,7 @@ public bool AddRelation(IJSAMObject jSAMObject_1, IJSAMObject jSAMObject_2) public IMaterial GetMaterial(string name) { - if(materialLibrary == null || string.IsNullOrEmpty(name)) + if (materialLibrary == null || string.IsNullOrEmpty(name)) { return null; } @@ -496,15 +498,15 @@ public IMaterial GetMaterial(string name) return materialLibrary.GetObject(name)?.Clone(); } - public T GetMaterial(string name) where T: IMaterial + public T GetMaterial(string name) where T : IMaterial { IMaterial material = GetMaterial(name); - if(material == null) + if (material == null) { return default; } - if(material is T) + if (material is T) { return (T)material; } @@ -514,13 +516,13 @@ public T GetMaterial(string name) where T: IMaterial public Zone GetZone(string name, ZoneType zoneType) { - if(string.IsNullOrWhiteSpace(name)) + if (string.IsNullOrWhiteSpace(name)) { return null; } List zones = relationCluster?.GetObjects(); - if(zones == null || zones.Count == 0) + if (zones == null || zones.Count == 0) { return null; } @@ -546,7 +548,7 @@ public List GetZones() public Profile GetProfile(ProfileType profileType, string name, bool includeProfileGroup = false) { - if(profileLibrary == null) + if (profileLibrary == null) { return null; } @@ -566,13 +568,13 @@ public Profile GetProfile(Space space, ProfileType profileType, bool includeProf public Dictionary GetProfileDictionary(Space space) { - if(profileLibrary == null) + if (profileLibrary == null) { return null; } InternalCondition internalCondition = space?.InternalCondition; - if(internalCondition == null) + if (internalCondition == null) { return null; } @@ -592,7 +594,7 @@ public bool HasMaterial(string name) public bool HasMaterial(HostPartitionType hostPartitionType, MaterialType materialType) { - if(hostPartitionType == null || materialLibrary == null) + if (hostPartitionType == null || materialLibrary == null) { return false; } @@ -612,7 +614,7 @@ public bool HasMaterial(OpeningType openingType, MaterialType materialType) public IMaterial GetMaterial(MaterialLayer materialLayer) { - if(materialLayer == null || materialLibrary == null) + if (materialLayer == null || materialLibrary == null) { return null; } @@ -620,15 +622,15 @@ public IMaterial GetMaterial(MaterialLayer materialLayer) return materialLayer.Material(materialLibrary)?.Clone(); } - public T GetMaterial(MaterialLayer materialLayer) where T: IMaterial + public T GetMaterial(MaterialLayer materialLayer) where T : IMaterial { IMaterial material = GetMaterial(materialLayer); - if(material == null) + if (material == null) { return default; } - if(material is T) + if (material is T) { return (T)material; } @@ -638,7 +640,7 @@ public T GetMaterial(MaterialLayer materialLayer) where T: IMaterial public List GetMaterials(HostPartitionType hostPartitionType) { - if(hostPartitionType == null) + if (hostPartitionType == null) { return null; } @@ -646,7 +648,7 @@ public List GetMaterials(HostPartitionType hostPartitionType) return hostPartitionType.Materials(materialLibrary)?.ConvertAll(x => x.Clone()); } - public List GetHostPartitionTypes() where T: HostPartitionType + public List GetHostPartitionTypes() where T : HostPartitionType { return GetObjects(); @@ -681,7 +683,7 @@ public List GetHostPartitionTypes(string name, TextComparisonType textComp return GetObjects((T hostPartitionType) => !string.IsNullOrWhiteSpace(hostPartitionType?.Name) && Core.Query.Compare(name, hostPartitionType?.Name, textComparisonType)); } - public List GetOpeningTypes() where T: OpeningType + public List GetOpeningTypes() where T : OpeningType { return GetObjects(); @@ -732,7 +734,7 @@ public MaterialType GetMaterialType(HostPartitionType hostPartitionType) public MaterialType GetMaterialType(IHostPartition hostPartition) { - if(hostPartition == null) + if (hostPartition == null) { return MaterialType.Undefined; } @@ -742,13 +744,13 @@ public MaterialType GetMaterialType(IHostPartition hostPartition) public MaterialType GetMaterialType(MaterialLayer materialLayer) { - if(materialLayer == null || materialLibrary == null) + if (materialLayer == null || materialLibrary == null) { return MaterialType.Undefined; } IMaterial material = GetMaterial(materialLayer); - if(material == null) + if (material == null) { return MaterialType.Undefined; } @@ -776,18 +778,18 @@ public List GetSpaces() return GetObjects(); } - public List GetMaterials() where T: IMaterial + public List GetMaterials() where T : IMaterial { List materials = materialLibrary?.GetMaterials(); - if(materials == null) + if (materials == null) { return null; } List result = new List(); - foreach(IMaterial material in materials) + foreach (IMaterial material in materials) { - if(material is T) + if (material is T) { result.Add((T)material.Clone()); } @@ -810,23 +812,23 @@ public List GetMissingMaterialNames() { HashSet materialNames = new HashSet(); - if(relationCluster != null) + if (relationCluster != null) { List hostPartitionTypes = relationCluster.GetObjects(); - if(hostPartitionTypes != null) + if (hostPartitionTypes != null) { - foreach(HostPartitionType hostPartitionType in hostPartitionTypes) + foreach (HostPartitionType hostPartitionType in hostPartitionTypes) { List materialLayers = hostPartitionType?.MaterialLayers; - if(materialLayers == null || materialLayers.Count == 0) + if (materialLayers == null || materialLayers.Count == 0) { continue; } - foreach(MaterialLayer materialLayer in materialLayers) + foreach (MaterialLayer materialLayer in materialLayers) { IMaterial material = GetMaterial(materialLayer); - if(material != null) + if (material != null) { continue; } @@ -837,14 +839,14 @@ public List GetMissingMaterialNames() } List openingTypes = relationCluster.GetObjects(); - if(openingTypes != null) + if (openingTypes != null) { - foreach(OpeningType openingType in openingTypes) + foreach (OpeningType openingType in openingTypes) { List materialLayers = null; materialLayers = openingType?.PaneMaterialLayers; - if(materialLayers != null) + if (materialLayers != null) { foreach (MaterialLayer materialLayer in materialLayers) { @@ -945,7 +947,7 @@ public bool External(IPartition partition) public bool External(IOpening opening) { IHostPartition hostPartition = GetHostPartition(opening); - if(hostPartition == null) + if (hostPartition == null) { return false; } @@ -982,7 +984,7 @@ public List GetShadePartitions() public bool Underground(IPartition partition) { - if(terrain == null || partition == null) + if (terrain == null || partition == null) { return false; } @@ -1008,22 +1010,22 @@ public List GetUndergroundPartitions() public bool ExposedToSun(IPartition partition) { - if(partition == null) + if (partition == null) { return false; } - if(!External(partition)) + if (!External(partition)) { return false; } - if(Underground(partition)) + if (Underground(partition)) { return false; } - if(terrain.On(partition)) + if (terrain.On(partition)) { return false; } @@ -1050,16 +1052,16 @@ public List GetExposedToSunPartitions() public List GetShells() { List spaces = relationCluster?.GetObjects(); - if(spaces == null) + if (spaces == null) { return null; } List result = new List(); - foreach(Space space in spaces) + foreach (Space space in spaces) { Shell shell = GetShell(space); - if(shell != null) + if (shell != null) { result.Add(shell); } @@ -1070,22 +1072,22 @@ public List GetShells() public List GetShells(Zone zone, bool union = true) { - if(zone == null || relationCluster == null) + if (zone == null || relationCluster == null) { return null; } List spaces = GetSpaces(zone); - if(spaces == null) + if (spaces == null) { return null; } List shells = new List(); - foreach(Space space in spaces) + foreach (Space space in spaces) { Shell shell = GetShell(space); - if(shell == null) + if (shell == null) { continue; } @@ -1093,7 +1095,7 @@ public List GetShells(Zone zone, bool union = true) shells.Add(shell); } - if(!union) + if (!union) { return shells; } @@ -1115,7 +1117,7 @@ public Shell GetShell(Space space) public double GetVolume(Space space, double silverSpacing = Tolerance.MacroDistance, double tolerance = Tolerance.Distance) { Shell shell = GetShell(space); - if(shell == null) + if (shell == null) { return double.NaN; } @@ -1166,13 +1168,13 @@ public double GetArea(Space space, double offset, double tolerance_Angle = Toler public double GetArea(Zone zone, double offset, double tolerance_Angle = Tolerance.Angle, double tolerance_Distance = Tolerance.Distance, double tolerance_Snap = Tolerance.MacroDistance) { List spaces = GetSpaces(zone); - if(spaces == null || spaces.Count == 0) + if (spaces == null || spaces.Count == 0) { return double.NaN; } List areas = Enumerable.Repeat(0.0, spaces.Count).ToList(); - Parallel.For(0, spaces.Count, (int i) => + Parallel.For(0, spaces.Count, (int i) => { Shell shell = GetShell(spaces[i]); if (shell == null) @@ -1181,7 +1183,7 @@ public double GetArea(Zone zone, double offset, double tolerance_Angle = Toleran } double area = shell.Area(offset, tolerance_Angle, tolerance_Distance, tolerance_Snap); - if(double.IsNaN(area)) + if (double.IsNaN(area)) { return; } @@ -1204,29 +1206,29 @@ public List GetPartitions(Space space) where T : IPartition public List GetPartitions(Zone zone) { - if(zone == null || relationCluster == null) + if (zone == null || relationCluster == null) { return null; } List spaces = GetSpaces(zone); - if(spaces == null) + if (spaces == null) { return null; } Dictionary dictionary = new Dictionary(); - foreach(Space space in spaces) + foreach (Space space in spaces) { List partitions = GetPartitions(space); - if(partitions == null || partitions.Count == 0) + if (partitions == null || partitions.Count == 0) { continue; } - foreach(IPartition partition in partitions) + foreach (IPartition partition in partitions) { - if(partition == null) + if (partition == null) { continue; } @@ -1269,7 +1271,7 @@ public T GetHostPartition(Guid openingGuid) where T : IHostPartition return result.Clone(); } - public T GetHostPartition(IOpening opening) where T: IHostPartition + public T GetHostPartition(IOpening opening) where T : IHostPartition { if (opening == null || relationCluster == null) { @@ -1284,18 +1286,18 @@ public IHostPartition GetHostPartition(IOpening opening) return GetHostPartition(opening); } - public List GetPartitions(Zone zone) where T: IPartition + public List GetPartitions(Zone zone) where T : IPartition { List partitions = GetPartitions(zone); - if(partitions == null) + if (partitions == null) { return null; } List result = new List(); - foreach(IPartition partition in partitions) + foreach (IPartition partition in partitions) { - if(partition is T) + if (partition is T) { result.Add((T)partition); } @@ -1318,16 +1320,16 @@ public List GetPartitions() where T : IPartition public List GetOpenings() where T : IOpening { List hostPartitions = relationCluster?.GetObjects(); - if(hostPartitions == null) + if (hostPartitions == null) { return null; } List result = new List(); - foreach(IHostPartition hostPartition in hostPartitions) + foreach (IHostPartition hostPartition in hostPartitions) { List openings = hostPartition.GetOpenings(); - if(openings == null || openings.Count == 0) + if (openings == null || openings.Count == 0) { continue; } @@ -1335,7 +1337,7 @@ public List GetOpenings() where T : IOpening openings.ForEach(x => result.Add(x.Clone())); } - return result; + return result; } public List GetOpenings() @@ -1350,37 +1352,37 @@ public List GetMechanicalSystems() where T : MechanicalSystem public List GetOpenings(OpeningType openingType) { - if(relationCluster == null || openingType == null) + if (relationCluster == null || openingType == null) { return null; } List hostPartitions = relationCluster.GetObjects(); - if(hostPartitions == null) + if (hostPartitions == null) { return null; } List openings = null; - List result = new List(); - foreach(IHostPartition hostPartition in hostPartitions) + List result = new List(); + foreach (IHostPartition hostPartition in hostPartitions) { openings = hostPartition.GetOpenings(); - if(openings == null || openings.Count == 0) + if (openings == null || openings.Count == 0) { continue; } - foreach(IOpening opening in openings) + foreach (IOpening opening in openings) { OpeningType openingType_Temp = opening?.Type(); - if(openingType_Temp == null) + if (openingType_Temp == null) { continue; } - if(openingType_Temp.Guid == openingType.Guid) + if (openingType_Temp.Guid == openingType.Guid) { result.Add(opening); } @@ -1399,16 +1401,16 @@ public List GetOpenings(OpeningType openingType) public List GetInternalConditions() { List spaces = GetSpaces(); - if(spaces == null) + if (spaces == null) { return null; } Dictionary dictionary = new Dictionary(); - foreach(Space space in spaces) + foreach (Space space in spaces) { InternalCondition internalCondition = space?.InternalCondition; - if(internalCondition == null) + if (internalCondition == null) { continue; } @@ -1417,7 +1419,7 @@ public List GetInternalConditions() } List internalConditions = GetObjects(); - if(internalConditions != null && internalConditions.Count > 0) + if (internalConditions != null && internalConditions.Count > 0) { internalConditions.ForEach(x => dictionary[x.Guid] = x); } @@ -1430,7 +1432,7 @@ public List GetResults() return GetObjects(); } - public List GetResults() where T: Result + public List GetResults() where T : Result { return GetObjects(); } @@ -1473,10 +1475,10 @@ public List GetOpeningSimulationResults(IOpening openin List result = GetResults(opening, source); IHostPartition hostPartition = GetHostPartition(opening); - if(hostPartition != null) + if (hostPartition != null) { List openingSimulationResults_HostPartition = GetResults(hostPartition, source); - if(openingSimulationResults_HostPartition != null) + if (openingSimulationResults_HostPartition != null) { if (result == null) { @@ -1493,7 +1495,7 @@ public List GetOpeningSimulationResults(IOpening openin public List GetBuildingModelSimulationResults(string source = null) { List result = relationCluster?.GetObjects(); - if(result == null) + if (result == null) { return null; } @@ -1510,7 +1512,7 @@ public List GetBuildingModelSimulationResults(str public bool Add(IPartition partition) { - if(partition == null) + if (partition == null) { return false; } @@ -1531,15 +1533,15 @@ public bool Add(IPartition partition) return false; } - if(partition_Temp is IHostPartition) + if (partition_Temp is IHostPartition) { IHostPartition hostPartition = (IHostPartition)partition_Temp; HostPartitionType hostPartitionType = hostPartition.Type(); - if(hostPartitionType != null) + if (hostPartitionType != null) { HostPartitionType hostPartitionType_Temp = relationCluster.GetObject(hostPartitionType.Guid); - if(hostPartitionType_Temp == null) + if (hostPartitionType_Temp == null) { relationCluster.AddObject(hostPartitionType); hostPartitionType_Temp = hostPartitionType; @@ -1553,19 +1555,19 @@ public bool Add(IPartition partition) } List openings = hostPartition.GetOpenings(); - if(openings != null) + if (openings != null) { Dictionary dictionary = new Dictionary(); - foreach(IOpening opening in openings) + foreach (IOpening opening in openings) { OpeningType openingType = opening?.Type(); - if(openingType == null) + if (openingType == null) { continue; } OpeningType openingType_Temp = relationCluster.GetObject(openingType.Guid); - if(openingType_Temp == null) + if (openingType_Temp == null) { relationCluster.AddObject(openingType); openingType_Temp = openingType; @@ -1597,19 +1599,19 @@ public bool Add(Space space, IEnumerable partitions = null) Space space_Temp = new Space(space); InternalCondition internalCondition = space_Temp.InternalCondition; - if(internalCondition != null) + if (internalCondition != null) { List internalConditions = GetInternalConditions(); - if(internalConditions != null) + if (internalConditions != null) { List guids = internalConditions.ConvertAll(x => x.Guid); Guid guid = internalCondition.Guid; - while(guids.Contains(guid)) + while (guids.Contains(guid)) { guid = Guid.NewGuid(); } - if(internalCondition.Guid != guid) + if (internalCondition.Guid != guid) { space_Temp.InternalCondition = new InternalCondition(guid, internalCondition); } @@ -1617,16 +1619,16 @@ public bool Add(Space space, IEnumerable partitions = null) } bool result = relationCluster.AddObject(space_Temp); - if(!result) + if (!result) { return result; } - if(partitions != null && partitions.Count() != 0) + if (partitions != null && partitions.Count() != 0) { - foreach(IPartition partition in partitions) + foreach (IPartition partition in partitions) { - if(Add(partition)) + if (Add(partition)) { relationCluster.AddRelation(space_Temp, partition); } @@ -1668,7 +1670,7 @@ public bool Add(Profile profile) public bool Add(IOpening opening, double tolerance = Tolerance.Distance) { - if(opening == null) + if (opening == null) { return false; } @@ -1678,9 +1680,9 @@ public bool Add(IOpening opening, double tolerance = Tolerance.Distance) List hostPartitions_Opening = new List(); List hostPartitions = relationCluster?.GetObjects(); - if(hostPartitions != null && hostPartitions.Count == 0) + if (hostPartitions != null && hostPartitions.Count == 0) { - foreach(IHostPartition hostPartition in hostPartitions) + foreach (IHostPartition hostPartition in hostPartitions) { if (hostPartition.HasOpening(opening.Guid)) { @@ -1702,7 +1704,7 @@ public bool Add(IOpening opening, double tolerance = Tolerance.Distance) opening = opening.Clone(); OpeningType openingType = opening.Type(); - if(openingType != null) + if (openingType != null) { OpeningType openingType_Temp = relationCluster.GetObject(openingType.Guid); if (openingType_Temp == null) @@ -1721,23 +1723,23 @@ public bool Add(IOpening opening, double tolerance = Tolerance.Distance) hostPartition_Opening.AddOpening(opening); } - if(hostPartitions_Opening == null || hostPartitions_Opening.Count == 0) + if (hostPartitions_Opening == null || hostPartitions_Opening.Count == 0) { relationCluster.AddObject(opening); relationCluster.AddRelation(opening, openingType); return true; } - if(hostPartition_Opening != null) + if (hostPartition_Opening != null) { hostPartition_Opening.RemoveOpening(opening.Guid); relationCluster.RemoveRelation(hostPartition_Opening, openingType); } - if(hostPartitions_Opening.Count > 0 ) + if (hostPartitions_Opening.Count > 0) { Point3D point3D = opening.Face3D.InternalPoint3D(); - if(point3D != null) + if (point3D != null) { hostPartitions_Opening.Sort((x, y) => x.Face3D.Distance(point3D, tolerance).CompareTo(y.Face3D.Distance(point3D, tolerance))); } @@ -1755,7 +1757,7 @@ public bool Add(IOpening opening, double tolerance = Tolerance.Distance) public bool Add(Zone zone, IEnumerable spaces = null) { - if(zone == null) + if (zone == null) { return false; } @@ -1763,22 +1765,22 @@ public bool Add(Zone zone, IEnumerable spaces = null) Zone zone_Temp = zone.Clone(); bool result = relationCluster.AddObject(zone_Temp); - if(!result) + if (!result) { return result; } - - if(spaces != null && spaces.Count() != 0) + + if (spaces != null && spaces.Count() != 0) { - foreach(Space space in spaces) + foreach (Space space in spaces) { - if(space == null) + if (space == null) { continue; } Space space_Temp = relationCluster.GetObject(space.Guid); - if(space_Temp == null) + if (space_Temp == null) { continue; } @@ -1793,7 +1795,7 @@ public bool Add(Zone zone, IEnumerable spaces = null) public bool Add(InternalCondition internalCondition) { - if(internalCondition == null) + if (internalCondition == null) { return false; } @@ -1802,17 +1804,17 @@ public bool Add(InternalCondition internalCondition) bool exists = false; List spaces = relationCluster?.GetObjects(); - if(spaces != null && spaces.Count != 0) + if (spaces != null && spaces.Count != 0) { - foreach(Space space in spaces) + foreach (Space space in spaces) { InternalCondition internalCondition_Space = space?.InternalCondition; - if(internalCondition_Space == null) + if (internalCondition_Space == null) { continue; } - if(internalCondition_Temp.Guid == internalCondition_Space.Guid) + if (internalCondition_Temp.Guid == internalCondition_Space.Guid) { space.InternalCondition = internalCondition_Temp; exists = true; @@ -1820,7 +1822,7 @@ public bool Add(InternalCondition internalCondition) } } - if(exists) + if (exists) { return true; } @@ -1830,14 +1832,14 @@ public bool Add(InternalCondition internalCondition) public bool Add(HostPartitionType hostPartitionType) { - if(hostPartitionType != null) + if (hostPartitionType != null) { return false; } HostPartitionType hostPartitionType_Temp = hostPartitionType.Clone(); - if(relationCluster == null) + if (relationCluster == null) { relationCluster = new SAMObjectRelationCluster(); } @@ -1845,9 +1847,9 @@ public bool Add(HostPartitionType hostPartitionType) relationCluster.AddObject(hostPartitionType_Temp); List hostPartitions = relationCluster.GetRelatedObjects(hostPartitionType_Temp); - if(hostPartitions != null) + if (hostPartitions != null) { - foreach(IHostPartition hostPartition in hostPartitions) + foreach (IHostPartition hostPartition in hostPartitions) { hostPartition.Type(hostPartitionType_Temp); } @@ -1878,17 +1880,17 @@ public bool Add(OpeningType openingType) foreach (IHostPartition hostPartition in hostPartitions) { List openings = hostPartition?.GetOpenings(); - if(openings != null && openings.Count != 0) + if (openings != null && openings.Count != 0) { - foreach(IOpening opening in openings) + foreach (IOpening opening in openings) { OpeningType openingType_Opening = opening?.Type(); - if(openingType_Opening == null) + if (openingType_Opening == null) { continue; } - if(openingType_Opening.Guid == openingType_Temp.Guid) + if (openingType_Opening.Guid == openingType_Temp.Guid) { opening.Type(openingType_Temp); hostPartition.AddOpening(opening); @@ -1948,12 +1950,12 @@ public bool Add(BuildingModelSimulationResult buildingModelSimulationResult) public bool Add(MechanicalSystem mechanicalSystem, IEnumerable spaces = null) { - if(mechanicalSystem == null) + if (mechanicalSystem == null) { return false; } - if(relationCluster == null) + if (relationCluster == null) { relationCluster = new SAMObjectRelationCluster(); } @@ -1961,10 +1963,10 @@ public bool Add(MechanicalSystem mechanicalSystem, IEnumerable spaces = n MechanicalSystem machanicalSystem_Temp = mechanicalSystem.Clone(); MechanicalSystemType mechanicalSystemType = machanicalSystem_Temp.Type; - if(mechanicalSystemType != null) + if (mechanicalSystemType != null) { MechanicalSystemType mechanicalSystemType_Temp = relationCluster.GetObject(mechanicalSystemType.Guid); - if(mechanicalSystemType_Temp == null) + if (mechanicalSystemType_Temp == null) { relationCluster.AddObject(mechanicalSystemType); mechanicalSystemType_Temp = mechanicalSystemType; @@ -1978,14 +1980,14 @@ public bool Add(MechanicalSystem mechanicalSystem, IEnumerable spaces = n } bool result = relationCluster.AddObject(machanicalSystem_Temp); - if(!result) + if (!result) { return result; } - if(spaces != null) + if (spaces != null) { - foreach(Space space in spaces) + foreach (Space space in spaces) { if (Add(space)) { @@ -1999,25 +2001,25 @@ public bool Add(MechanicalSystem mechanicalSystem, IEnumerable spaces = n public bool Add(SpaceSimulationResult spaceSimulationResult, Space space = null) { - if(spaceSimulationResult == null) + if (spaceSimulationResult == null) { return false; } - if(relationCluster == null) + if (relationCluster == null) { relationCluster = new SAMObjectRelationCluster(); } bool result = relationCluster.AddObject(spaceSimulationResult); - if(!result) + if (!result) { return result; } - if(space != null) + if (space != null) { - if(Add(space)) + if (Add(space)) { relationCluster.AddRelation(spaceSimulationResult, space); } @@ -2058,7 +2060,7 @@ public bool Add(SpaceSimulationResult spaceSimulationResult, Guid spaceGuid) public bool Add(PartitionSimulationResult partitionSimulationResult, IPartition partition = null) { - if(partitionSimulationResult == null) + if (partitionSimulationResult == null) { return false; } @@ -2071,14 +2073,14 @@ public bool Add(PartitionSimulationResult partitionSimulationResult, IPartition PartitionSimulationResult partitionSimulationResult_Temp = new PartitionSimulationResult(partitionSimulationResult); bool result = relationCluster.AddObject(partitionSimulationResult_Temp); - if(!result) + if (!result) { return result; } - if(partition != null) + if (partition != null) { - if(Add(partition)) + if (Add(partition)) { relationCluster.AddRelation(partitionSimulationResult, partition); } @@ -2086,7 +2088,7 @@ public bool Add(PartitionSimulationResult partitionSimulationResult, IPartition return result; } - + public bool Add(PartitionSimulationResult partitionSimulationResult, Guid partitionGuid) { if (partitionSimulationResult == null) @@ -2144,7 +2146,7 @@ public bool Add(OpeningSimulationResult openingSimulationResult, IOpening openin if (Add(opening, tolerance)) { IOpening opening_Temp = relationCluster.GetObject(opening.Guid); - if(opening_Temp != null) + if (opening_Temp != null) { relationCluster.AddRelation(openingSimulationResult, opening_Temp); } @@ -2220,9 +2222,9 @@ public bool Add(ZoneSimulationResult zoneSimulationResult, Zone zone = null) return result; } - if(zone != null) + if (zone != null) { - if(relationCluster.AddObject(zone)) + if (relationCluster.AddObject(zone)) { relationCluster.AddRelation(zoneSimulationResult, zone); } @@ -2234,7 +2236,7 @@ public bool Add(ZoneSimulationResult zoneSimulationResult, Zone zone = null) public bool Add(IResult result, Guid guid) where T : IJSAMObject { IResult result_Temp = result?.Clone(); - if(result_Temp == null) + if (result_Temp == null) { return false; } @@ -2264,19 +2266,19 @@ public bool Add(IResult result, Guid guid) where T : IJSAMObject public bool Contains(ISAMObject sAMObject) { - if(sAMObject is Profile) + if (sAMObject is Profile) { - if(profileLibrary == null) + if (profileLibrary == null) { return false; } return profileLibrary.Contains((Profile)sAMObject); } - - if(sAMObject is IMaterial) + + if (sAMObject is IMaterial) { - if(materialLibrary == null) + if (materialLibrary == null) { return false; } @@ -2284,39 +2286,39 @@ public bool Contains(ISAMObject sAMObject) return materialLibrary.Contains((IMaterial)sAMObject); } - if(relationCluster == null) + if (relationCluster == null) { return false; } - if(sAMObject is IOpening) + if (sAMObject is IOpening) { List hostPartitions = relationCluster.GetObjects(); - if(hostPartitions != null && hostPartitions.Count != 0) + if (hostPartitions != null && hostPartitions.Count != 0) { - if(hostPartitions.Find(x => x.HasOpening(sAMObject.Guid)) != null) + if (hostPartitions.Find(x => x.HasOpening(sAMObject.Guid)) != null) { return true; } } } - if(sAMObject is InternalCondition) + if (sAMObject is InternalCondition) { List spaces = relationCluster.GetObjects(); if (spaces != null && spaces.Count != 0) { - foreach(Space space in spaces) + foreach (Space space in spaces) { InternalCondition internalCondition = space?.InternalCondition; - if(internalCondition == null) + if (internalCondition == null) { continue; } - if(internalCondition.Guid == sAMObject.Guid) + if (internalCondition.Guid == sAMObject.Guid) { - return true; + return true; } } } @@ -2328,7 +2330,7 @@ public bool Contains(ISAMObject sAMObject) public BoundingBox3D GetBoundingBox3D() { List sAMGeometry3DObjects = relationCluster?.GetObjects(); - if(sAMGeometry3DObjects == null || sAMGeometry3DObjects.Count == 0) + if (sAMGeometry3DObjects == null || sAMGeometry3DObjects.Count == 0) { return null; } @@ -2337,7 +2339,7 @@ public BoundingBox3D GetBoundingBox3D() foreach (ISAMGeometry3DObject sAMGeometry3DObject in sAMGeometry3DObjects) { IBoundable3D boundable3D = sAMGeometry3DObject.SAMGeometry3D(); - if(boundable3D == null) + if (boundable3D == null) { continue; } @@ -2345,7 +2347,7 @@ public BoundingBox3D GetBoundingBox3D() boundingBox3Ds.Add(boundable3D.GetBoundingBox()); } - if(boundingBox3Ds == null || boundingBox3Ds.Count == 0) + if (boundingBox3Ds == null || boundingBox3Ds.Count == 0) { return null; } @@ -2415,7 +2417,7 @@ public override JObject ToJObject() public void Transform(Transform3D transform3D) { List buildingElements = relationCluster?.GetObjects(); - if(buildingElements != null && buildingElements.Count != 0) + if (buildingElements != null && buildingElements.Count != 0) { foreach (IBuildingElement buildingElement in buildingElements) { diff --git a/SAM/SAM.Analytical/Classes/New/Door.cs b/SAM/SAM.Analytical/Classes/New/Door.cs index b220eb428..123d906a8 100644 --- a/SAM/SAM.Analytical/Classes/New/Door.cs +++ b/SAM/SAM.Analytical/Classes/New/Door.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Geometry.Spatial; diff --git a/SAM/SAM.Analytical/Classes/New/DoorType.cs b/SAM/SAM.Analytical/Classes/New/DoorType.cs index 0901b3d7a..d8362d555 100644 --- a/SAM/SAM.Analytical/Classes/New/DoorType.cs +++ b/SAM/SAM.Analytical/Classes/New/DoorType.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Architectural; using System.Collections.Generic; diff --git a/SAM/SAM.Analytical/Classes/New/Floor.cs b/SAM/SAM.Analytical/Classes/New/Floor.cs index 6c4500988..a20e22b1d 100644 --- a/SAM/SAM.Analytical/Classes/New/Floor.cs +++ b/SAM/SAM.Analytical/Classes/New/Floor.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Geometry.Spatial; @@ -24,7 +27,7 @@ public Floor(FloorType floorType, Face3D face3D) } - public Floor(System.Guid guid,FloorType floorType, Face3D face3D) + public Floor(System.Guid guid, FloorType floorType, Face3D face3D) : base(guid, floorType, face3D) { diff --git a/SAM/SAM.Analytical/Classes/New/FloorType.cs b/SAM/SAM.Analytical/Classes/New/FloorType.cs index 1b7f4cf2b..6a1dccaf4 100644 --- a/SAM/SAM.Analytical/Classes/New/FloorType.cs +++ b/SAM/SAM.Analytical/Classes/New/FloorType.cs @@ -1,7 +1,9 @@ -using Newtonsoft.Json.Linq; -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors +using Newtonsoft.Json.Linq; using SAM.Architectural; +using System.Collections.Generic; namespace SAM.Analytical { diff --git a/SAM/SAM.Analytical/Classes/New/HostPartition.cs b/SAM/SAM.Analytical/Classes/New/HostPartition.cs index d637e2f3b..7790560bc 100644 --- a/SAM/SAM.Analytical/Classes/New/HostPartition.cs +++ b/SAM/SAM.Analytical/Classes/New/HostPartition.cs @@ -1,16 +1,19 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; -using SAM.Geometry.Spatial; using SAM.Geometry.Planar; +using SAM.Geometry.Spatial; using System; using System.Collections.Generic; namespace SAM.Analytical { - public abstract class HostPartition : BuildingElement, IHostPartition where T: HostPartitionType + public abstract class HostPartition : BuildingElement, IHostPartition where T : HostPartitionType { private List openings; - + public HostPartition(HostPartition hostPartition) : base(hostPartition) { @@ -39,7 +42,7 @@ public HostPartition(Guid guid, HostPartition hostPartition, Face3D face3D, d : base(guid, hostPartition, face3D) { List openings = hostPartition?.GetOpenings(); - if(openings != null) + if (openings != null) { Plane plane = face3D?.GetPlane(); @@ -57,15 +60,15 @@ public List GetOpenings() public List GetOpenings() where O : IOpening { - if(openings == null) + if (openings == null) { return null; } List result = new List(); - foreach(IOpening opening in openings) + foreach (IOpening opening in openings) { - if(opening is O) + if (opening is O) { result.Add((O)opening.Clone()); } @@ -76,19 +79,19 @@ public List GetOpenings() where O : IOpening public IOpening RemoveOpening(Guid guid) { - if(openings == null || openings.Count == 0) + if (openings == null || openings.Count == 0) { return null; } - foreach(IOpening opening in openings) + foreach (IOpening opening in openings) { - if(opening == null) + if (opening == null) { continue; } - if(opening.Guid == guid) + if (opening.Guid == guid) { openings.Remove(opening); return opening; @@ -106,13 +109,13 @@ public List AddOpening(IOpening opening, double tolerance = Tolerance. } Face3D face3D = Face3D; - if(face3D == null) + if (face3D == null) { return null; } Plane plane = face3D.GetPlane(); - if(plane == null) + if (plane == null) { return null; } @@ -129,7 +132,7 @@ public List AddOpening(IOpening opening, double tolerance = Tolerance. return null; } - if(!plane.Coplanar(plane_Opening, tolerance)) + if (!plane.Coplanar(plane_Opening, tolerance)) { return null; } @@ -138,7 +141,7 @@ public List AddOpening(IOpening opening, double tolerance = Tolerance. Face2D face2D_Opening = plane.Convert(face3D_Opening); List face2Ds_Intersection = Geometry.Planar.Query.Intersection(face2D, face2D_Opening, tolerance); - if(face2Ds_Intersection == null || face2Ds_Intersection.Count == 0) + if (face2Ds_Intersection == null || face2Ds_Intersection.Count == 0) { return null; } @@ -151,18 +154,18 @@ public List AddOpening(IOpening opening, double tolerance = Tolerance. } int index = openings.FindIndex(x => x.Guid == opening.Guid); - if(index != -1) + if (index != -1) { openings.RemoveAt(index); } List result = new List(); - for(int i = 0; i < face3Ds_Intersection.Count; i++) + for (int i = 0; i < face3Ds_Intersection.Count; i++) { Guid guid = i == 0 ? opening.Guid : Guid.NewGuid(); IOpening opening_Intersection = Create.Opening(guid, opening, face3Ds_Intersection[i]); - if(opening_Intersection == null) + if (opening_Intersection == null) { continue; } @@ -170,7 +173,7 @@ public List AddOpening(IOpening opening, double tolerance = Tolerance. result.Add(opening_Intersection); } - if(result != null && result.Count != 0) + if (result != null && result.Count != 0) { openings.AddRange(result); } @@ -180,7 +183,7 @@ public List AddOpening(IOpening opening, double tolerance = Tolerance. public bool HasOpening(Guid guid) { - if(openings == null || openings.Count == 0) + if (openings == null || openings.Count == 0) { return false; } @@ -250,19 +253,19 @@ public override void Move(Vector3D vector3D) public List GetFace3Ds(bool cutOpenings = false, double tolerance = Tolerance.Distance) { Face3D face3D = Face3D; - if(face3D == null) + if (face3D == null) { return null; } List result = face3D.FixEdges(tolerance); - if(!cutOpenings || result == null || result.Count == 0) + if (!cutOpenings || result == null || result.Count == 0) { return result; } List face3Ds_Openings = openings?.ConvertAll(x => x?.Face3D); - if(face3Ds_Openings == null || face3Ds_Openings.Count == 0) + if (face3Ds_Openings == null || face3Ds_Openings.Count == 0) { return result; } diff --git a/SAM/SAM.Analytical/Classes/New/HostPartitionType.cs b/SAM/SAM.Analytical/Classes/New/HostPartitionType.cs index 25b87426a..530287076 100644 --- a/SAM/SAM.Analytical/Classes/New/HostPartitionType.cs +++ b/SAM/SAM.Analytical/Classes/New/HostPartitionType.cs @@ -1,8 +1,10 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors +using Newtonsoft.Json.Linq; +using SAM.Architectural; using System.Collections.Generic; using System.Linq; -using SAM.Architectural; namespace SAM.Analytical { @@ -66,7 +68,7 @@ public List MaterialLayers set { - if(value == null) + if (value == null) { return; } @@ -79,7 +81,7 @@ public MaterialLayer this[int i] { get { - if(materialLayers == null) + if (materialLayers == null) { return null; } @@ -100,20 +102,20 @@ public MaterialLayer this[int i] public double GetThickness() { - if(materialLayers == null) + if (materialLayers == null) { return double.NaN; } double result = 0; - foreach(MaterialLayer materialLayer in materialLayers) + foreach (MaterialLayer materialLayer in materialLayers) { double thickness = materialLayer.Thickness; - if(double.IsNaN(thickness)) + if (double.IsNaN(thickness)) { continue; } - + result += thickness; } diff --git a/SAM/SAM.Analytical/Classes/New/HostPartitionTypeLibrary.cs b/SAM/SAM.Analytical/Classes/New/HostPartitionTypeLibrary.cs index 2d3c388ea..7e24add81 100644 --- a/SAM/SAM.Analytical/Classes/New/HostPartitionTypeLibrary.cs +++ b/SAM/SAM.Analytical/Classes/New/HostPartitionTypeLibrary.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; using System.Collections.Generic; @@ -127,7 +130,7 @@ public List GetHostPartitionTypes(IEnumerable hostPartitionTypes = GetHostPartitionTypes(); if (hostPartitionTypes == null || hostPartitionTypes.Count == 0) return null; @@ -139,7 +142,7 @@ public List GetHostPartitionTypes(string text, TextComparison { if (string.IsNullOrWhiteSpace(text)) return null; - + List hostPartitionTypes = GetHostPartitionTypes(); if (hostPartitionTypes == null || hostPartitionTypes.Count == 0) return null; @@ -147,4 +150,4 @@ public List GetHostPartitionTypes(string text, TextComparison return hostPartitionTypes.FindAll(x => Core.Query.Compare(x.Name, text, textComparisonType, caseSensitive)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/New/Opening.cs b/SAM/SAM.Analytical/Classes/New/Opening.cs index 59292b603..77b216424 100644 --- a/SAM/SAM.Analytical/Classes/New/Opening.cs +++ b/SAM/SAM.Analytical/Classes/New/Opening.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -6,7 +9,7 @@ namespace SAM.Analytical { - public class Opening : BuildingElement, IOpening where T : OpeningType + public class Opening : BuildingElement, IOpening where T : OpeningType { public Opening(Opening opening) : base(opening) @@ -41,7 +44,7 @@ public Opening(System.Guid guid, Opening opening, Face3D face3D) public override double GetArea() { Geometry.Planar.IClosed2D closed2D = Face3D?.ExternalEdge2D; - if(closed2D == null) + if (closed2D == null) { return double.NaN; } @@ -70,12 +73,12 @@ public List GetFace3Ds(OpeningPart openingPart) T openingType = Type; if (openingType != null) { - if(openingType.TryGetValue(OpeningTypeParameter.DefaultFrameWidth, out double defaultFrameWidth)) + if (openingType.TryGetValue(OpeningTypeParameter.DefaultFrameWidth, out double defaultFrameWidth)) { frameWidth = defaultFrameWidth; } - if(double.IsNaN(frameWidth) || frameWidth == 0) + if (double.IsNaN(frameWidth) || frameWidth == 0) { frameWidth = openingType.GetFrameThickness(); } diff --git a/SAM/SAM.Analytical/Classes/New/OpeningType.cs b/SAM/SAM.Analytical/Classes/New/OpeningType.cs index 4f39fc7ec..bf6387103 100644 --- a/SAM/SAM.Analytical/Classes/New/OpeningType.cs +++ b/SAM/SAM.Analytical/Classes/New/OpeningType.cs @@ -1,7 +1,9 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors -using System.Collections.Generic; +using Newtonsoft.Json.Linq; using SAM.Architectural; +using System.Collections.Generic; using System.Linq; namespace SAM.Analytical @@ -43,7 +45,7 @@ public OpeningType(string name, IEnumerable paneMaterialLayers, I this.paneMaterialLayers = new List(paneMaterialLayers).ConvertAll(x => new MaterialLayer(x)); } - if(frameMaterialLayers != null) + if (frameMaterialLayers != null) { this.frameMaterialLayers = new List(frameMaterialLayers).ConvertAll(x => new MaterialLayer(x)); } @@ -91,7 +93,7 @@ public List FrameMaterialLayers { get { - if(frameMaterialLayers == null) + if (frameMaterialLayers == null) { return null; } @@ -135,12 +137,12 @@ public List PaneMaterialLayers public List GetMaterialLayers(OpeningPart openingPart) { - if(openingPart == OpeningPart.Undefined) + if (openingPart == OpeningPart.Undefined) { return null; } - switch(openingPart) + switch (openingPart) { case OpeningPart.Frame: return FrameMaterialLayers; @@ -154,13 +156,13 @@ public List GetMaterialLayers(OpeningPart openingPart) public double GetThickness(OpeningPart openingPart) { - if(openingPart == OpeningPart.Undefined) + if (openingPart == OpeningPart.Undefined) { return double.NaN; } List materialLayers = GetMaterialLayers(openingPart); - if(materialLayers == null || materialLayers.Count == 0) + if (materialLayers == null || materialLayers.Count == 0) { return 0; } diff --git a/SAM/SAM.Analytical/Classes/New/OpeningTypeLibrary.cs b/SAM/SAM.Analytical/Classes/New/OpeningTypeLibrary.cs index e489b9528..886c0b2c9 100644 --- a/SAM/SAM.Analytical/Classes/New/OpeningTypeLibrary.cs +++ b/SAM/SAM.Analytical/Classes/New/OpeningTypeLibrary.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; using System.Collections.Generic; @@ -98,15 +101,15 @@ public List GetOpeningTypes(OpeningAnalyticalType openingAnalytical } List result = new List(); - foreach(OpeningType openingType in openingTypes) + foreach (OpeningType openingType in openingTypes) { PartitionAnalyticalType? partitionAnalyticalType = openingType?.PartitionAnalyticalType(); - if(partitionAnalyticalType == null || !partitionAnalyticalType.HasValue) + if (partitionAnalyticalType == null || !partitionAnalyticalType.HasValue) { continue; } - if(Query.HostPartitionCategory(partitionAnalyticalType.Value) != hostPartitionCategory) + if (Query.HostPartitionCategory(partitionAnalyticalType.Value) != hostPartitionCategory) { continue; } @@ -135,7 +138,7 @@ public List GetOpeningTypes(string text, TextComparisonType textCom } List result = new List(); - foreach(OpeningType openingType in openingTypes) + foreach (OpeningType openingType in openingTypes) { if (openingType == null) { @@ -149,4 +152,4 @@ public List GetOpeningTypes(string text, TextComparisonType textCom return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/New/Roof.cs b/SAM/SAM.Analytical/Classes/New/Roof.cs index 1804717f6..09afcd2a0 100644 --- a/SAM/SAM.Analytical/Classes/New/Roof.cs +++ b/SAM/SAM.Analytical/Classes/New/Roof.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Geometry.Spatial; diff --git a/SAM/SAM.Analytical/Classes/New/RoofType.cs b/SAM/SAM.Analytical/Classes/New/RoofType.cs index c9933451e..ffa82f847 100644 --- a/SAM/SAM.Analytical/Classes/New/RoofType.cs +++ b/SAM/SAM.Analytical/Classes/New/RoofType.cs @@ -1,7 +1,9 @@ -using Newtonsoft.Json.Linq; -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors +using Newtonsoft.Json.Linq; using SAM.Architectural; +using System.Collections.Generic; namespace SAM.Analytical { diff --git a/SAM/SAM.Analytical/Classes/New/SimulationResult/BuildingModelSimulationResult.cs b/SAM/SAM.Analytical/Classes/New/SimulationResult/BuildingModelSimulationResult.cs index fa1580dbd..2e7556204 100644 --- a/SAM/SAM.Analytical/Classes/New/SimulationResult/BuildingModelSimulationResult.cs +++ b/SAM/SAM.Analytical/Classes/New/SimulationResult/BuildingModelSimulationResult.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; @@ -45,11 +48,11 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { - JObject jObject = base.ToJObject(); + JObject jObject = base.ToJObject(); if (jObject == null) return null; return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/New/SimulationResult/OpeningSimulationResult.cs b/SAM/SAM.Analytical/Classes/New/SimulationResult/OpeningSimulationResult.cs index fc6ca76cc..895112c72 100644 --- a/SAM/SAM.Analytical/Classes/New/SimulationResult/OpeningSimulationResult.cs +++ b/SAM/SAM.Analytical/Classes/New/SimulationResult/OpeningSimulationResult.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; @@ -39,11 +42,11 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { - JObject jObject = base.ToJObject(); + JObject jObject = base.ToJObject(); if (jObject == null) return null; return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/New/SimulationResult/PartitionSimulationResult.cs b/SAM/SAM.Analytical/Classes/New/SimulationResult/PartitionSimulationResult.cs index ade43628d..a8038bf08 100644 --- a/SAM/SAM.Analytical/Classes/New/SimulationResult/PartitionSimulationResult.cs +++ b/SAM/SAM.Analytical/Classes/New/SimulationResult/PartitionSimulationResult.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; @@ -39,11 +42,11 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { - JObject jObject = base.ToJObject(); + JObject jObject = base.ToJObject(); if (jObject == null) return null; return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/New/Wall.cs b/SAM/SAM.Analytical/Classes/New/Wall.cs index 5ed97ce9a..8fd1a4d3e 100644 --- a/SAM/SAM.Analytical/Classes/New/Wall.cs +++ b/SAM/SAM.Analytical/Classes/New/Wall.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Geometry.Spatial; diff --git a/SAM/SAM.Analytical/Classes/New/WallType.cs b/SAM/SAM.Analytical/Classes/New/WallType.cs index f53c4a1ec..003c83607 100644 --- a/SAM/SAM.Analytical/Classes/New/WallType.cs +++ b/SAM/SAM.Analytical/Classes/New/WallType.cs @@ -1,7 +1,9 @@ -using Newtonsoft.Json.Linq; -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors +using Newtonsoft.Json.Linq; using SAM.Architectural; +using System.Collections.Generic; namespace SAM.Analytical { diff --git a/SAM/SAM.Analytical/Classes/New/Window.cs b/SAM/SAM.Analytical/Classes/New/Window.cs index 28e3ff65d..2565902a7 100644 --- a/SAM/SAM.Analytical/Classes/New/Window.cs +++ b/SAM/SAM.Analytical/Classes/New/Window.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Geometry.Spatial; diff --git a/SAM/SAM.Analytical/Classes/New/WindowType.cs b/SAM/SAM.Analytical/Classes/New/WindowType.cs index 8f0e29511..940042576 100644 --- a/SAM/SAM.Analytical/Classes/New/WindowType.cs +++ b/SAM/SAM.Analytical/Classes/New/WindowType.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Architectural; using System.Collections.Generic; @@ -39,7 +42,7 @@ public WindowType(System.Guid guid, string name) public WindowType(string name, IEnumerable paneMaterialLayers, IEnumerable frameMaterialLayers = null) : base(name, paneMaterialLayers, frameMaterialLayers) { - + } public WindowType(System.Guid guid, string name, IEnumerable paneMaterialLayers, IEnumerable frameMaterialLayers = null) diff --git a/SAM/SAM.Analytical/Classes/OpeningProperties/MultipleOpeningProperties.cs b/SAM/SAM.Analytical/Classes/OpeningProperties/MultipleOpeningProperties.cs index 36c89544b..597963dcb 100644 --- a/SAM/SAM.Analytical/Classes/OpeningProperties/MultipleOpeningProperties.cs +++ b/SAM/SAM.Analytical/Classes/OpeningProperties/MultipleOpeningProperties.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -18,7 +21,7 @@ public MultipleOpeningProperties() } public MultipleOpeningProperties(JObject jObject) - :base(jObject) + : base(jObject) { } @@ -43,21 +46,21 @@ public MultipleOpeningProperties(MultipleOpeningProperties multipleOpeningProper public override bool FromJObject(JObject jObject) { - if(!base.FromJObject(jObject)) + if (!base.FromJObject(jObject)) { return false; } - if(jObject.ContainsKey("SingleOpeningProperties")) + if (jObject.ContainsKey("SingleOpeningProperties")) { JArray jArray = jObject.Value("SingleOpeningProperties"); - if(jArray != null) + if (jArray != null) { singleOpeningProperties = new List(); - foreach(JObject jObject_OpeningProperties in jArray) + foreach (JObject jObject_OpeningProperties in jArray) { ISingleOpeningProperties openingProperties = Core.Query.IJSAMObject(jObject_OpeningProperties); - if(openingProperties == null) + if (openingProperties == null) { continue; } @@ -74,17 +77,17 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { JObject jObject = base.ToJObject(); - if(jObject == null) + if (jObject == null) { return null; } - if(singleOpeningProperties != null) + if (singleOpeningProperties != null) { JArray jArray = new JArray(); - foreach(ISingleOpeningProperties singleOpeningProperties in singleOpeningProperties) + foreach (ISingleOpeningProperties singleOpeningProperties in singleOpeningProperties) { - if(singleOpeningProperties == null) + if (singleOpeningProperties == null) { continue; } @@ -109,7 +112,7 @@ public List SingleOpeningProperties public double GetDischargeCoefficient() { ISingleOpeningProperties singleOpeningProperties = this.SingleOpeningProperties(); - if(singleOpeningProperties == null) + if (singleOpeningProperties == null) { return double.NaN; } @@ -128,4 +131,4 @@ public double GetFactor() return singleOpeningProperties.GetFactor(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/OpeningProperties/OpeningProperties.cs b/SAM/SAM.Analytical/Classes/OpeningProperties/OpeningProperties.cs index 4e9cf4490..e1b0133ea 100644 --- a/SAM/SAM.Analytical/Classes/OpeningProperties/OpeningProperties.cs +++ b/SAM/SAM.Analytical/Classes/OpeningProperties/OpeningProperties.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical @@ -9,7 +12,7 @@ namespace SAM.Analytical public class OpeningProperties : ParameterizedSAMObject, ISingleOpeningProperties { public double Factor { get; set; } = 1; - + private double dischargeCoefficient { get; set; } public OpeningProperties() @@ -23,14 +26,14 @@ public OpeningProperties(double dischargeCoefficient) } public OpeningProperties(JObject jObject) - :base(jObject) + : base(jObject) { } public OpeningProperties(OpeningProperties openingProperties) : base(openingProperties) { - if(openingProperties != null) + if (openingProperties != null) { Factor = openingProperties.Factor; dischargeCoefficient = openingProperties.dischargeCoefficient; @@ -45,12 +48,12 @@ public OpeningProperties(IOpeningProperties openingProperties, double dischargeC public override bool FromJObject(JObject jObject) { - if(!base.FromJObject(jObject)) + if (!base.FromJObject(jObject)) { return false; } - if(jObject.ContainsKey("DischargeCoefficient")) + if (jObject.ContainsKey("DischargeCoefficient")) { dischargeCoefficient = jObject.Value("DischargeCoefficient"); } @@ -66,12 +69,12 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { JObject jObject = base.ToJObject(); - if(jObject == null) + if (jObject == null) { return null; } - if(!double.IsNaN(dischargeCoefficient)) + if (!double.IsNaN(dischargeCoefficient)) { jObject.Add("DischargeCoefficient", dischargeCoefficient); } @@ -102,4 +105,4 @@ public ISingleOpeningProperties SingleOpeningProperties } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/OpeningProperties/PartOOpeningProperties.cs b/SAM/SAM.Analytical/Classes/OpeningProperties/PartOOpeningProperties.cs index d5327c906..758f85787 100644 --- a/SAM/SAM.Analytical/Classes/OpeningProperties/PartOOpeningProperties.cs +++ b/SAM/SAM.Analytical/Classes/OpeningProperties/PartOOpeningProperties.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical @@ -35,7 +38,7 @@ public PartOOpeningProperties(double width, double height, double openingAngle) } public PartOOpeningProperties(JObject jObject) - :base(jObject) + : base(jObject) { } @@ -43,7 +46,7 @@ public PartOOpeningProperties(JObject jObject) public PartOOpeningProperties(PartOOpeningProperties partOOpeningProperties) : base(partOOpeningProperties) { - if(partOOpeningProperties != null) + if (partOOpeningProperties != null) { width = partOOpeningProperties.width; height = partOOpeningProperties.height; @@ -54,12 +57,12 @@ public PartOOpeningProperties(PartOOpeningProperties partOOpeningProperties) public override bool FromJObject(JObject jObject) { - if(!base.FromJObject(jObject)) + if (!base.FromJObject(jObject)) { return false; } - if(jObject.ContainsKey("Width")) + if (jObject.ContainsKey("Width")) { width = jObject.Value("Width"); } @@ -85,12 +88,12 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { JObject jObject = base.ToJObject(); - if(jObject == null) + if (jObject == null) { return null; } - if(!double.IsNaN(width)) + if (!double.IsNaN(width)) { jObject.Add("Width", width); } @@ -152,13 +155,13 @@ public override JObject ToJObject() /// public double GetDischargeCoefficient() { - if(double.IsNaN(width) || double.IsNaN(height) || double.IsNaN(openingAngle) || height == 0 || width == 0) + if (double.IsNaN(width) || double.IsNaN(height) || double.IsNaN(openingAngle) || height == 0 || width == 0) { return double.NaN; } double lengthRatio = width / height; - if(lengthRatio == 0) + if (lengthRatio == 0) { return double.NaN; } @@ -170,12 +173,12 @@ public double GetDischargeCoefficient() gradient = 0.0604762544204005; maxDischargeCoefficient = 0.612341772151899; } - else if(lengthRatio < 1.0) + else if (lengthRatio < 1.0) { gradient = 0.0478352593239432; maxDischargeCoefficient = 0.588607594936709; } - else if(lengthRatio < 2.0) + else if (lengthRatio < 2.0) { gradient = 0.0404635490792875; maxDischargeCoefficient = 0.5625; @@ -186,7 +189,7 @@ public double GetDischargeCoefficient() maxDischargeCoefficient = 0.548259493670886; } - if(double.IsNaN(gradient) || double.IsNaN(maxDischargeCoefficient)) + if (double.IsNaN(gradient) || double.IsNaN(maxDischargeCoefficient)) { return double.NaN; } @@ -215,4 +218,4 @@ public double Height } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/OpeningProperties/ProfileOpeningProperties.cs b/SAM/SAM.Analytical/Classes/OpeningProperties/ProfileOpeningProperties.cs index 12bddb29b..94972ae62 100644 --- a/SAM/SAM.Analytical/Classes/OpeningProperties/ProfileOpeningProperties.cs +++ b/SAM/SAM.Analytical/Classes/OpeningProperties/ProfileOpeningProperties.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Analytical { @@ -15,20 +18,20 @@ public ProfileOpeningProperties() } public ProfileOpeningProperties(double dischargeCoefficient) - :base(dischargeCoefficient) + : base(dischargeCoefficient) { } public ProfileOpeningProperties(JObject jObject) - :base(jObject) + : base(jObject) { } public ProfileOpeningProperties(double dischargeCoefficient, Profile profile) : base(dischargeCoefficient) { - this.profile = profile == null ? null : new Profile(profile); + this.profile = profile == null ? null : new Profile(profile); } public ProfileOpeningProperties(ProfileOpeningProperties profileOpeningProperties) @@ -40,7 +43,7 @@ public ProfileOpeningProperties(ProfileOpeningProperties profileOpeningPropertie public ProfileOpeningProperties(IOpeningProperties openingProperties, double dischargeCoefficient) : base(openingProperties, dischargeCoefficient) { - if(openingProperties is ProfileOpeningProperties) + if (openingProperties is ProfileOpeningProperties) { profile = ((ProfileOpeningProperties)openingProperties).profile == null ? null : new Profile(((ProfileOpeningProperties)openingProperties).profile); } @@ -56,12 +59,12 @@ public Profile Profile public override bool FromJObject(JObject jObject) { - if(!base.FromJObject(jObject)) + if (!base.FromJObject(jObject)) { return false; } - if(jObject.ContainsKey("Profile")) + if (jObject.ContainsKey("Profile")) { profile = Core.Query.IJSAMObject(jObject.Value("Profile")); } @@ -72,12 +75,12 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { JObject jObject = base.ToJObject(); - if(jObject == null) + if (jObject == null) { return null; } - if(profile != null) + if (profile != null) { jObject.Add("Profile", profile.ToJObject()); } @@ -85,4 +88,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Panel.cs b/SAM/SAM.Analytical/Classes/Panel.cs index a530ef820..54b6870e2 100644 --- a/SAM/SAM.Analytical/Classes/Panel.cs +++ b/SAM/SAM.Analytical/Classes/Panel.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry; using SAM.Geometry.Planar; @@ -119,7 +122,7 @@ internal Panel(Guid guid, Panel panel, Face3D face, IEnumerable apertu if (panel.apertures != null) apertures_All.AddRange(panel.apertures); - + if (apertures_All.Count > 0) { foreach (Aperture aperture in apertures_All) @@ -267,19 +270,19 @@ public double GetArea() /// Net Area public double GetAreaNet() { - if(apertures == null || apertures.Count == 0) + if (apertures == null || apertures.Count == 0) { return GetArea(); } List face3Ds = GetFace3Ds(true); - if(face3Ds == null) + if (face3Ds == null) { return double.NaN; } face3Ds = face3Ds.FindAll(x => x != null); - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return double.NaN; } @@ -647,9 +650,9 @@ public bool RemoveAperture(Guid guid) if (apertures == null || apertures.Count == 0) return false; - for(int i=0; i < apertures.Count; i++) + for (int i = 0; i < apertures.Count; i++) { - if(apertures[i].Guid.Equals(guid)) + if (apertures[i].Guid.Equals(guid)) { apertures.RemoveAt(i); return true; @@ -826,7 +829,7 @@ public Face3D Face3D } Plane plane = planarBoundary3D.Plane; - if(plane == null) + if (plane == null) { return null; } @@ -835,4 +838,4 @@ public Face3D Face3D } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/PlanarBoundary3D.cs b/SAM/SAM.Analytical/Classes/PlanarBoundary3D.cs index 336397538..0dc900321 100644 --- a/SAM/SAM.Analytical/Classes/PlanarBoundary3D.cs +++ b/SAM/SAM.Analytical/Classes/PlanarBoundary3D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry; using SAM.Geometry.Planar; @@ -44,7 +47,7 @@ public PlanarBoundary3D(IClosedPlanar3D closedPlanar3D, Point3D location) : base() { plane = closedPlanar3D?.GetPlane(); - if(plane != null) + if (plane != null) { plane = new Plane(plane, plane.Project(location)); @@ -73,7 +76,7 @@ public PlanarBoundary3D(IClosedPlanar3D closedPlanar3D, Point3D location) public PlanarBoundary3D(PlanarBoundary3D planarBoundary3D) : base(planarBoundary3D) { - if(planarBoundary3D != null) + if (planarBoundary3D != null) { plane = planarBoundary3D.plane == null ? null : new Plane(planarBoundary3D.plane); @@ -102,7 +105,7 @@ public PlanarBoundary3D(Plane plane, Boundary2D boundary2D) { this.plane = plane == null ? null : new Plane(plane); - if(boundary2D != null) + if (boundary2D != null) { externalEdge2DLoop = boundary2D.ExternalEdge2DLoop == null ? null : new BoundaryEdge2DLoop(boundary2D.ExternalEdge2DLoop); @@ -157,7 +160,7 @@ public void Transform(Transform3D transform3D) List boundaryEdge3DLoops_Internal = GetInternalEdge3DLoops(); if (boundaryEdge3DLoops_Internal != null && boundaryEdge3DLoops_Internal.Count > 0) { - foreach(BoundaryEdge3DLoop boundaryEdge3DLoop_Internal in boundaryEdge3DLoops_Internal) + foreach (BoundaryEdge3DLoop boundaryEdge3DLoop_Internal in boundaryEdge3DLoops_Internal) boundaryEdge3DLoop_Internal.Transform(transform3D); } @@ -271,7 +274,7 @@ public void Snap(IEnumerable point3Ds, double maxDistance = double.NaN, if (snapInternalEdges && internalEdge2DLoops != null) { - foreach(BoundaryEdge3DLoop boundaryEdge3DLoop_Internal in GetInternalEdge3DLoops()) + foreach (BoundaryEdge3DLoop boundaryEdge3DLoop_Internal in GetInternalEdge3DLoops()) { boundaryEdge3DLoop_Internal.Snap(point3Ds, maxDistance); internalEdge2DLoops_New.Add(new BoundaryEdge2DLoop(plane, boundaryEdge3DLoop_Internal)); @@ -288,13 +291,13 @@ public void Snap(IEnumerable planes, double maxDistance, double tolerance Plane plane_Min = null; double distance_Min = double.MaxValue; - foreach(Plane plane_Temp in planes) + foreach (Plane plane_Temp in planes) { double distance_Temp = plane.Distance(plane_Temp, tolerance); if (distance_Temp > maxDistance) continue; - + if (plane_Temp.Distance(boundingBox3D) > maxDistance) continue; @@ -302,7 +305,7 @@ public void Snap(IEnumerable planes, double maxDistance, double tolerance continue; //This is true only when planes are coplanar - if(distance_Temp < distance_Min) + if (distance_Temp < distance_Min) { plane_Min = plane_Temp; distance_Min = distance_Temp; @@ -337,13 +340,13 @@ public Vector3D Normal public void Normalize(Orientation orientation = Orientation.CounterClockwise, EdgeOrientationMethod edgeOrientationMethod = EdgeOrientationMethod.Opposite, double tolerance_Angle = Tolerance.Angle, double tolerance_Distance = Tolerance.Distance) { Face3D face3D = GetFace3D(); - if(face3D == null) + if (face3D == null) { return; } face3D = Geometry.Spatial.Query.Normalize(face3D, orientation, edgeOrientationMethod, tolerance_Angle, tolerance_Distance); - if(face3D == null) + if (face3D == null) { return; } @@ -377,4 +380,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Profile.cs b/SAM/SAM.Analytical/Classes/Profile.cs index 1bfd7b0af..aafaf2674 100644 --- a/SAM/SAM.Analytical/Classes/Profile.cs +++ b/SAM/SAM.Analytical/Classes/Profile.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Planar; using System; @@ -20,12 +23,12 @@ public Profile(Profile profile) if (profile.values != null) { values = new SortedList, AnyOf>>(); - foreach(KeyValuePair, AnyOf>> keyValuePair in profile.values) + foreach (KeyValuePair, AnyOf>> keyValuePair in profile.values) { Tuple, AnyOf> tuple = null; if (keyValuePair.Value != null) tuple = new Tuple, AnyOf>(keyValuePair.Value.Item1?.Clone(), keyValuePair.Value.Item2?.Value as dynamic); - + values[keyValuePair.Key] = tuple; } } @@ -45,7 +48,7 @@ public Profile(string name, string category, IndexedDoubles indexedDoubles) IEnumerable indexes = indexedDoubles?.Keys; if (indexes != null) { - foreach(int index in indexes) + foreach (int index in indexes) { Add(index, indexedDoubles[index]); } @@ -171,7 +174,7 @@ public Profile(Guid guid, Profile profile, string name, string category) } public Profile(Profile profile, IndexedDoubles indexedDoubles) - :base(profile) + : base(profile) { category = profile?.category; @@ -330,7 +333,7 @@ private double GetMaxValue() if (@object is double) { - value =(double)@object; + value = (double)@object; } else if (@object is Profile) { @@ -338,13 +341,13 @@ private double GetMaxValue() } - if(value > result) + if (value > result) { result = value; } } - if(result == double.MinValue) + if (result == double.MinValue) { return double.NaN; } @@ -430,7 +433,7 @@ public bool Update(int index, double value) } Range range = GetRange(index); - if(range == null || range.Count() == 1) + if (range == null || range.Count() == 1) { values[index] = new Tuple, AnyOf>(null, value); return true; @@ -440,7 +443,7 @@ public bool Update(int index, double value) values.Remove(range.Min); - for(int i = 0; i < range.Count(); i++) + for (int i = 0; i < range.Count(); i++) { values[range.Min + i] = new Tuple, AnyOf>(null, values_Temp[i]); } @@ -451,12 +454,12 @@ public bool Update(int index, double value) public bool Update(int index, int count, double value) { - if(count <= 0) + if (count <= 0) { return false; } - if(count == 1) + if (count == 1) { Update(index, value); } @@ -503,7 +506,7 @@ public bool Update(int index, int count, double value) } } - if(values == null) + if (values == null) { values = new SortedList, AnyOf>>(); values.Add(min, new Tuple, AnyOf>(new Range(min, max), value)); @@ -519,12 +522,12 @@ public bool Update(int index, int count, double value) public bool Update(int index, Profile profile) { - if(profile == null) + if (profile == null) { return false; } - if(values == null) + if (values == null) { values = new SortedList, AnyOf>>(); } @@ -545,10 +548,10 @@ public bool Update(int index, Profile profile) List> ranges = new List>(); HashSet mins = new HashSet(); - for(int i=0; i < count; i++) + for (int i = 0; i < count; i++) { Range range_Temp = GetRange(min + i); - if(range_Temp != null) + if (range_Temp != null) { ranges.Add(range_Temp); mins.Add(range_Temp.Min); @@ -562,7 +565,7 @@ public bool Update(int index, Profile profile) Range range = new Range(min, max); double[] values_Temp = GetValues(range_ToRemove); - foreach(int min_Temp in mins) + foreach (int min_Temp in mins) { values.Remove(min_Temp); } @@ -570,7 +573,7 @@ public bool Update(int index, Profile profile) for (int i = 0; i < range_ToRemove.Count(); i++) { int index_Temp = range_ToRemove.Min + i; - if(!range.In(index_Temp)) + if (!range.In(index_Temp)) { values[index_Temp] = new Tuple, AnyOf>(null, values_Temp[i]); } @@ -583,12 +586,12 @@ public bool Update(int index, Profile profile) public bool Remove(int count) { - if(count < 1) + if (count < 1) { return false; } - if(values == null || values.Count == 0) + if (values == null || values.Count == 0) { return false; } @@ -596,7 +599,7 @@ public bool Remove(int count) int max = Max; int min = max - count + 1; - if(min < Min) + if (min < Min) { min = Min; } @@ -635,9 +638,9 @@ public bool Remove(int count) } } - for(int i = range.Min; i <= range.Max; i++) + for (int i = range.Min; i <= range.Max; i++) { - if(values.ContainsKey(i)) + if (values.ContainsKey(i)) { values.Remove(i); } @@ -845,13 +848,13 @@ public IndexedDoubles GetIndexedDoubles() public double[] GetValues(Range range) { - if(range == null) + if (range == null) { return null; } IndexedDoubles indexedDoubles = GetIndexedDoubles(); - if(indexedDoubles == null) + if (indexedDoubles == null) { return null; } @@ -914,10 +917,10 @@ public double[] GetYearlyValues() //{ // if (i >= result.Length) // break; - + // result[i] = this[i]; //} - + //int index; @@ -981,7 +984,7 @@ public Profile[] GetProfiles() return null; List profiles = new List(); - foreach(Tuple, AnyOf> tuple in values.Values) + foreach (Tuple, AnyOf> tuple in values.Values) { if (tuple != null && tuple.Item2?.Value is Profile) profiles.Add((Profile)tuple.Item2?.Value); @@ -992,7 +995,7 @@ public Profile[] GetProfiles() public Profile GetProfile(int index) { - if(!TryGetValue(index, out Profile result, out double value)) + if (!TryGetValue(index, out Profile result, out double value)) { return null; } @@ -1017,16 +1020,16 @@ public Range GetRange(int index) Tuple, AnyOf> tuple = keyValuePair.Value; Range range = tuple?.Item1; - if(range == null) + if (range == null) { - if(keyValuePair.Key == index) + if (keyValuePair.Key == index) { return new Range(keyValuePair.Key); } continue; } - if(range.In(index)) + if (range.In(index)) { return new Range(range); } @@ -1093,7 +1096,7 @@ public int Max // result++; //} - foreach(Tuple, AnyOf> tuple in values.Values) + foreach (Tuple, AnyOf> tuple in values.Values) { if (tuple.Item1 == null) { @@ -1120,7 +1123,7 @@ public int Min return values.First().Key; } } - + public double MaxValue { get @@ -1179,7 +1182,7 @@ public bool TryGetValue(int index, out Profile profile, out double value) value = (double)@object; return true; } - + Profile profile_Temp = @object as Profile; if (profile_Temp == null) { @@ -1214,7 +1217,7 @@ public double this[int index] int count = max - min + 1; int index_Temp = index; - while(index_Temp > max) + while (index_Temp > max) { index_Temp -= count; } @@ -1256,20 +1259,20 @@ public override bool FromJObject(JObject jObject) if (jObject.ContainsKey("Category")) category = jObject.Value("Category"); - if(jObject.ContainsKey("Values")) + if (jObject.ContainsKey("Values")) { JArray jArray = jObject.Value("Values"); - if(jArray != null) + if (jArray != null) { values = new SortedList, AnyOf>>(); - foreach(JToken jToken in jArray) + foreach (JToken jToken in jArray) { if (jToken.Type == JTokenType.Float) { values[values.Count == 0 ? 0 : values.Keys.Max() + 1] = new Tuple, AnyOf>(null, (double)jToken); } - else if(jToken.Type == JTokenType.Array) + else if (jToken.Type == JTokenType.Array) { JArray jArray_Temp = (JArray)jToken; @@ -1282,7 +1285,7 @@ public override bool FromJObject(JObject jObject) break; case 2: jToken_Temp = jArray_Temp[1]; - if(jToken_Temp.Type == JTokenType.Float) + if (jToken_Temp.Type == JTokenType.Float) values[(int)jArray_Temp[0]] = new Tuple, AnyOf>(null, (double)jToken_Temp); else if (jToken_Temp.Type == JTokenType.Integer) values[(int)jArray_Temp[0]] = new Tuple, AnyOf>(new Range((int)jArray_Temp[0], (int)jArray_Temp[1]), null); @@ -1293,13 +1296,13 @@ public override bool FromJObject(JObject jObject) jToken_Temp = jArray_Temp[2]; if (jToken_Temp.Type == JTokenType.Float) values[(int)jArray_Temp[0]] = new Tuple, AnyOf>(new Range((int)jArray_Temp[0], (int)jArray_Temp[1]), (double)jToken_Temp); - else if(jToken_Temp.Type == JTokenType.Object) + else if (jToken_Temp.Type == JTokenType.Object) values[(int)jArray_Temp[0]] = new Tuple, AnyOf>(new Range((int)jArray_Temp[0], (int)jArray_Temp[1]), new Profile((JObject)jToken_Temp)); break; } } } - } + } } return true; @@ -1314,7 +1317,7 @@ public override JObject ToJObject() if (category != null) jObject.Add("Category", category); - if(values != null) + if (values != null) { JArray jArray = new JArray(); foreach (KeyValuePair, AnyOf>> keyValuePair in values) @@ -1325,15 +1328,15 @@ public override JObject ToJObject() Tuple, AnyOf> tuple = keyValuePair.Value; if (tuple != null) { - if(tuple.Item1 != null) + if (tuple.Item1 != null) jArray_Temp.Add(tuple.Item1.Max); AnyOf value = tuple.Item2; - if(value != null) + if (value != null) { - if(value.Value is double) + if (value.Value is double) jArray_Temp.Add(value.Value); - else if(value.Value != null) + else if (value.Value != null) jArray_Temp.Add((value.Value as Profile).ToJObject()); } } @@ -1348,4 +1351,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/ProfileLibrary.cs b/SAM/SAM.Analytical/Classes/ProfileLibrary.cs index 15072f9fd..3ac00ef99 100644 --- a/SAM/SAM.Analytical/Classes/ProfileLibrary.cs +++ b/SAM/SAM.Analytical/Classes/ProfileLibrary.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; using System.Collections.Generic; @@ -35,7 +38,7 @@ public ProfileLibrary(ProfileLibrary profileLibrary) public ProfileLibrary(string name, IEnumerable profiles) : base(name) { - if(profiles != null) + if (profiles != null) { foreach (Profile profile in profiles) Add(profile); @@ -114,9 +117,9 @@ public Profile GetProfile(string name, ProfileType profileType, bool includeProf return null; List profiles = GetProfiles(profileType); - if(profiles != null) + if (profiles != null) { - foreach(Profile profile in profiles) + foreach (Profile profile in profiles) { if (name.Equals(profile.Name)) return profile; @@ -130,7 +133,7 @@ public Profile GetProfile(string name, ProfileType profileType, bool includeProf if (profiles == null || profiles.Count == 0) return null; - foreach(Profile profile in profiles) + foreach (Profile profile in profiles) { if (name.Equals(profile.Name)) return profile; @@ -138,12 +141,12 @@ public Profile GetProfile(string name, ProfileType profileType, bool includeProf return null; } - + public List GetProfiles(params ProfileType[] profileTypes) { if (profileTypes == null) return null; - + return GetObjects()?.FindAll(x => profileTypes.Contains(x.ProfileType)); } @@ -166,14 +169,14 @@ public List GetProfiles(string text, TextComparisonType textComparisonT { if (string.IsNullOrWhiteSpace(text)) return null; - + List profiles = GetProfiles(); if (profiles == null || profiles.Count == 0) return null; return profiles.FindAll(x => Core.Query.Compare(x.Name, text, textComparisonType, caseSensitive)); } - + public static string UniqueId(Profile profile) { if (profile == null) @@ -197,4 +200,4 @@ public static string UniqueId(Profile profile) return string.Format("{0}::{1}", category, name); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Result/AdjacencyClusterSimulationResult.cs b/SAM/SAM.Analytical/Classes/Result/AdjacencyClusterSimulationResult.cs index 9d63dd80d..5d6e63ff7 100644 --- a/SAM/SAM.Analytical/Classes/Result/AdjacencyClusterSimulationResult.cs +++ b/SAM/SAM.Analytical/Classes/Result/AdjacencyClusterSimulationResult.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; @@ -45,11 +48,11 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { - JObject jObject = base.ToJObject(); + JObject jObject = base.ToJObject(); if (jObject == null) return null; return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Result/AnalyticalModelSimulationResult.cs b/SAM/SAM.Analytical/Classes/Result/AnalyticalModelSimulationResult.cs index bbcca2e85..52d2b5cc4 100644 --- a/SAM/SAM.Analytical/Classes/Result/AnalyticalModelSimulationResult.cs +++ b/SAM/SAM.Analytical/Classes/Result/AnalyticalModelSimulationResult.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; @@ -45,11 +48,11 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { - JObject jObject = base.ToJObject(); + JObject jObject = base.ToJObject(); if (jObject == null) return null; return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Result/SpaceSimulationResult.cs b/SAM/SAM.Analytical/Classes/Result/SpaceSimulationResult.cs index 33935d9be..1782758bb 100644 --- a/SAM/SAM.Analytical/Classes/Result/SpaceSimulationResult.cs +++ b/SAM/SAM.Analytical/Classes/Result/SpaceSimulationResult.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; @@ -45,11 +48,11 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { - JObject jObject = base.ToJObject(); + JObject jObject = base.ToJObject(); if (jObject == null) return null; return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Result/SurfaceSimulationResult.cs b/SAM/SAM.Analytical/Classes/Result/SurfaceSimulationResult.cs index 463736873..c413e249e 100644 --- a/SAM/SAM.Analytical/Classes/Result/SurfaceSimulationResult.cs +++ b/SAM/SAM.Analytical/Classes/Result/SurfaceSimulationResult.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; @@ -45,11 +48,11 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { - JObject jObject = base.ToJObject(); + JObject jObject = base.ToJObject(); if (jObject == null) return null; return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Result/TM/TM52ExtendedResult.cs b/SAM/SAM.Analytical/Classes/Result/TM/TM52ExtendedResult.cs index 03408d125..2b8c7d2d2 100644 --- a/SAM/SAM.Analytical/Classes/Result/TM/TM52ExtendedResult.cs +++ b/SAM/SAM.Analytical/Classes/Result/TM/TM52ExtendedResult.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; using System.Collections.Generic; @@ -11,13 +14,13 @@ public class TM52ExtendedResult : TMExtendedResult public List GetOccupiedTemperatureDifferencesExceedingComfortRange() { HashSet hourIndicesExceedingComfortRange = GetOccupiedHourIndicesExceedingComfortRange(); - if(hourIndicesExceedingComfortRange == null) + if (hourIndicesExceedingComfortRange == null) { return null; } List result = new List(); - foreach(int hourIndex in hourIndicesExceedingComfortRange) + foreach (int hourIndex in hourIndicesExceedingComfortRange) { result.Add(GetTemperatureDifference(hourIndex)); } @@ -36,12 +39,12 @@ private Dictionary> GetOccupiedDailyHourIndicesDictionary() Dictionary> result = new Dictionary>(); - foreach(int occupiedHourIndex in occupiedHourIndices) + foreach (int occupiedHourIndex in occupiedHourIndices) { int boundedIndex = Core.Query.BoundedIndex(24, occupiedHourIndex); int dayIndex = System.Convert.ToInt32(occupiedHourIndex / 24); - if(!result.TryGetValue(dayIndex, out HashSet dailyHourIndexes) || dailyHourIndexes == null) + if (!result.TryGetValue(dayIndex, out HashSet dailyHourIndexes) || dailyHourIndexes == null) { dailyHourIndexes = new HashSet(); result[dayIndex] = dailyHourIndexes; @@ -56,7 +59,7 @@ private Dictionary> GetOccupiedDailyHourIndicesDictionary() private List GetOccupiedDailyWeightedExceedances() { Dictionary> dailyHourIndicesDictionary = GetOccupiedDailyHourIndicesDictionary(); - if(dailyHourIndicesDictionary == null) + if (dailyHourIndicesDictionary == null) { return null; } @@ -82,14 +85,14 @@ private List GetOccupiedDailyWeightedExceedances() public int GetOccupiedDailyWeightedExceedanceStartHourIndex() { GetOccupiedDailyWeightedExceedance(out DailyWeightedExceedance dailyWeightedExceedance); - if(dailyWeightedExceedance == null) + if (dailyWeightedExceedance == null) { return -1; } return dailyWeightedExceedance.StartHourIndex; } - + public double GetOccupiedDailyWeightedExceedance() { return GetOccupiedDailyWeightedExceedance(out DailyWeightedExceedance dailyWeightedExceedance); @@ -100,33 +103,33 @@ public double GetOccupiedDailyWeightedExceedance(out DailyWeightedExceedance dai dailyWeightedExceedance = null; List dailyWeightedExceedances = GetOccupiedDailyWeightedExceedances(); - if(dailyWeightedExceedances == null) + if (dailyWeightedExceedances == null) { return double.NaN; } - if(dailyWeightedExceedances.Count == 0) + if (dailyWeightedExceedances.Count == 0) { return 0; } double result = double.MinValue; - foreach(DailyWeightedExceedance dailyWeightedExceedance_Temp in dailyWeightedExceedances) + foreach (DailyWeightedExceedance dailyWeightedExceedance_Temp in dailyWeightedExceedances) { - if(dailyWeightedExceedance_Temp == null) + if (dailyWeightedExceedance_Temp == null) { continue; } double weightedExceedance = dailyWeightedExceedance_Temp.WeightedExceedance; - if(weightedExceedance > result) + if (weightedExceedance > result) { result = weightedExceedance; dailyWeightedExceedance = dailyWeightedExceedance_Temp; } } - if(result == double.MinValue) + if (result == double.MinValue) { return 0; } @@ -137,7 +140,7 @@ public double GetOccupiedDailyWeightedExceedance(out DailyWeightedExceedance dai public double GetOccupiedMaxTemperatureDifference() { int hourIndex = GetOccupiedMaxTemperatureDifferenceHourIndex(); - if(hourIndex == -1) + if (hourIndex == -1) { return double.NaN; } @@ -148,7 +151,7 @@ public double GetOccupiedMaxTemperatureDifference() public int GetOccupiedMaxTemperatureDifferenceHourIndex() { IndexedDoubles occupiedTemperatureDifferences = GetOccupiedTemperatureDifferences(); - if(occupiedTemperatureDifferences == null || occupiedTemperatureDifferences.Count == 0) + if (occupiedTemperatureDifferences == null || occupiedTemperatureDifferences.Count == 0) { return -1; } @@ -160,7 +163,7 @@ public int GetOccupiedMaxTemperatureDifferenceHourIndex() public int GetOccupiedHoursExceedingAbsoluteLimit() { IndexedDoubles occupiedTemperatureDifferences = GetOccupiedTemperatureDifferences(); - if(occupiedTemperatureDifferences == null) + if (occupiedTemperatureDifferences == null) { return -1; } @@ -188,16 +191,16 @@ public List GetOccupiedHourIndicesExceedingAbsoluteLimit() IndexedDoubles occupiedTemperatureDifferences = GetOccupiedTemperatureDifferences(); IEnumerable keys = occupiedTemperatureDifferences?.Keys; - if(keys == null) + if (keys == null) { return null; } List result = new List(); - foreach(int key in keys) + foreach (int key in keys) { double value = occupiedTemperatureDifferences[key]; - if(value >= 4) + if (value >= 4) { result.Add(key); } @@ -210,7 +213,7 @@ public bool Criterion2 get { List occupiedDailyWeightedExceedances = GetOccupiedDailyWeightedExceedances(); - if(occupiedDailyWeightedExceedances == null) + if (occupiedDailyWeightedExceedances == null) { return false; } @@ -229,20 +232,20 @@ public bool Criterion3 get { IndexedDoubles occupiedTemperatureDifferences = GetOccupiedTemperatureDifferences(); - if(occupiedTemperatureDifferences == null) + if (occupiedTemperatureDifferences == null) { return false; } IEnumerable values = occupiedTemperatureDifferences.Values; - if(values == null || values.Count() == 0) + if (values == null || values.Count() == 0) { return true; } foreach (double value in values) { - if(value >= 4) + if (value >= 4) { return false; } @@ -310,7 +313,7 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { - JObject result = base.ToJObject(); + JObject result = base.ToJObject(); if (result == null) { return null; @@ -319,4 +322,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Result/TM/TM52Result.cs b/SAM/SAM.Analytical/Classes/Result/TM/TM52Result.cs index d8991f419..0b6e177ab 100644 --- a/SAM/SAM.Analytical/Classes/Result/TM/TM52Result.cs +++ b/SAM/SAM.Analytical/Classes/Result/TM/TM52Result.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Analytical @@ -15,11 +18,11 @@ public class TM52Result : TMResult private bool pass; public TM52Result( - string name, - string source, + string name, + string source, string reference, TM52BuildingCategory tM52BuildingCategory, - int occupiedHours, + int occupiedHours, int maxExceedableHours, int hoursExceedingComfortRange, double peakDailyWeightedExceedance, @@ -36,9 +39,9 @@ public TM52Result( } public TM52Result( - Guid guid, - string name, - string source, + Guid guid, + string name, + string source, string reference, TM52BuildingCategory tM52BuildingCategory, int occupiedHours, @@ -112,7 +115,7 @@ public override bool FromJObject(JObject jObject) return false; } - if(jObject.ContainsKey("OccupiedHours")) + if (jObject.ContainsKey("OccupiedHours")) { occupiedHours = jObject.Value("OccupiedHours"); } @@ -153,7 +156,7 @@ public override JObject ToJObject() return null; } - if(occupiedHours != int.MinValue) + if (occupiedHours != int.MinValue) { result.Add("OccupiedHours", occupiedHours); } @@ -183,4 +186,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Result/TM/TM59CorridorExtendedResult.cs b/SAM/SAM.Analytical/Classes/Result/TM/TM59CorridorExtendedResult.cs index 33c068598..e88f7c71b 100644 --- a/SAM/SAM.Analytical/Classes/Result/TM/TM59CorridorExtendedResult.cs +++ b/SAM/SAM.Analytical/Classes/Result/TM/TM59CorridorExtendedResult.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections.Generic; @@ -93,4 +96,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Result/TM/TM59CorridorResult.cs b/SAM/SAM.Analytical/Classes/Result/TM/TM59CorridorResult.cs index 3be55590c..e33f0e17b 100644 --- a/SAM/SAM.Analytical/Classes/Result/TM/TM59CorridorResult.cs +++ b/SAM/SAM.Analytical/Classes/Result/TM/TM59CorridorResult.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Analytical @@ -8,11 +11,11 @@ public class TM59CorridorResult : TM59Result private int hoursExceeding28; public TM59CorridorResult( - string name, - string source, + string name, + string source, string reference, TM52BuildingCategory tM52BuildingCategory, - int occupiedHours, + int occupiedHours, int maxExceedableHours, int hoursExceeding28, bool pass) @@ -22,9 +25,9 @@ public TM59CorridorResult( } public TM59CorridorResult( - Guid guid, - string name, - string source, + Guid guid, + string name, + string source, string reference, TM52BuildingCategory tM52BuildingCategory, int occupiedHours, @@ -76,4 +79,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Result/TM/TM59ExtendedResult.cs b/SAM/SAM.Analytical/Classes/Result/TM/TM59ExtendedResult.cs index 2e07b8c01..422252ca7 100644 --- a/SAM/SAM.Analytical/Classes/Result/TM/TM59ExtendedResult.cs +++ b/SAM/SAM.Analytical/Classes/Result/TM/TM59ExtendedResult.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections.Generic; @@ -77,10 +80,10 @@ public override JObject ToJObject() return null; } - if(tM59SpaceApplications != null) + if (tM59SpaceApplications != null) { JArray jArray = new JArray(); - foreach(TM59SpaceApplication tM59SpaceApplication in tM59SpaceApplications) + foreach (TM59SpaceApplication tM59SpaceApplication in tM59SpaceApplications) { jArray.Add(tM59SpaceApplication.ToString()); } @@ -91,4 +94,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Result/TM/TM59MechanicalVentilationExtendedResult.cs b/SAM/SAM.Analytical/Classes/Result/TM/TM59MechanicalVentilationExtendedResult.cs index 3243c4e7d..24dc082e2 100644 --- a/SAM/SAM.Analytical/Classes/Result/TM/TM59MechanicalVentilationExtendedResult.cs +++ b/SAM/SAM.Analytical/Classes/Result/TM/TM59MechanicalVentilationExtendedResult.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections.Generic; @@ -85,4 +88,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Result/TM/TM59MechanicalVentilationResult.cs b/SAM/SAM.Analytical/Classes/Result/TM/TM59MechanicalVentilationResult.cs index 639927445..0911a3e56 100644 --- a/SAM/SAM.Analytical/Classes/Result/TM/TM59MechanicalVentilationResult.cs +++ b/SAM/SAM.Analytical/Classes/Result/TM/TM59MechanicalVentilationResult.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Analytical @@ -8,11 +11,11 @@ public class TM59MechanicalVentilationResult : TM59Result private int hoursExceeding26; public TM59MechanicalVentilationResult( - string name, - string source, + string name, + string source, string reference, TM52BuildingCategory tM52BuildingCategory, - int occupiedHours, + int occupiedHours, int maxExceedableHours, int hoursExceeding26, bool pass, @@ -23,9 +26,9 @@ public TM59MechanicalVentilationResult( } public TM59MechanicalVentilationResult( - Guid guid, - string name, - string source, + Guid guid, + string name, + string source, string reference, TM52BuildingCategory tM52BuildingCategory, int occupiedHours, @@ -78,4 +81,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Result/TM/TM59NaturalVentilationBedroomExtendedResult.cs b/SAM/SAM.Analytical/Classes/Result/TM/TM59NaturalVentilationBedroomExtendedResult.cs index 3c783b11c..1bc5941b6 100644 --- a/SAM/SAM.Analytical/Classes/Result/TM/TM59NaturalVentilationBedroomExtendedResult.cs +++ b/SAM/SAM.Analytical/Classes/Result/TM/TM59NaturalVentilationBedroomExtendedResult.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections.Generic; @@ -124,4 +127,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Result/TM/TM59NaturalVentilationBedroomResult.cs b/SAM/SAM.Analytical/Classes/Result/TM/TM59NaturalVentilationBedroomResult.cs index 17429f18e..7479204a3 100644 --- a/SAM/SAM.Analytical/Classes/Result/TM/TM59NaturalVentilationBedroomResult.cs +++ b/SAM/SAM.Analytical/Classes/Result/TM/TM59NaturalVentilationBedroomResult.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Analytical @@ -11,11 +14,11 @@ public class TM59NaturalVentilationBedroomResult : TM59NaturalVentilationResult private int nightHoursNumberExceeding26; public TM59NaturalVentilationBedroomResult( - string name, - string source, + string name, + string source, string reference, TM52BuildingCategory tM52BuildingCategory, - int occupiedHours, + int occupiedHours, int maxExceedableHours, int hoursExceedingComfortRange, int annualNightOccupiedHours, @@ -32,9 +35,9 @@ public TM59NaturalVentilationBedroomResult( } public TM59NaturalVentilationBedroomResult( - Guid guid, - string name, - string source, + Guid guid, + string name, + string source, string reference, TM52BuildingCategory tM52BuildingCategory, int occupiedHours, @@ -128,4 +131,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Result/TM/TM59NaturalVentilationExtendedResult.cs b/SAM/SAM.Analytical/Classes/Result/TM/TM59NaturalVentilationExtendedResult.cs index 352fdb15c..ec816bf42 100644 --- a/SAM/SAM.Analytical/Classes/Result/TM/TM59NaturalVentilationExtendedResult.cs +++ b/SAM/SAM.Analytical/Classes/Result/TM/TM59NaturalVentilationExtendedResult.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections.Generic; @@ -80,4 +83,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Result/TM/TM59NaturalVentilationResult.cs b/SAM/SAM.Analytical/Classes/Result/TM/TM59NaturalVentilationResult.cs index 7ca6d2577..c93c66a52 100644 --- a/SAM/SAM.Analytical/Classes/Result/TM/TM59NaturalVentilationResult.cs +++ b/SAM/SAM.Analytical/Classes/Result/TM/TM59NaturalVentilationResult.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Analytical @@ -10,11 +13,11 @@ public class TM59NaturalVentilationResult : TM59Result private int maxExceedableSummerHours; public TM59NaturalVentilationResult( - string name, - string source, - string reference, + string name, + string source, + string reference, TM52BuildingCategory tM52BuildingCategory, - int occupiedHours, + int occupiedHours, int maxExceedableHours, int summerOccupiedHours, int maxExceedableSummerHours, @@ -29,9 +32,9 @@ public TM59NaturalVentilationResult( } public TM59NaturalVentilationResult( - Guid guid, - string name, - string source, + Guid guid, + string name, + string source, string reference, TM52BuildingCategory tM52BuildingCategory, int occupiedHours, @@ -123,4 +126,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Result/TM/TM59Result.cs b/SAM/SAM.Analytical/Classes/Result/TM/TM59Result.cs index 82ee12d25..ca37284d6 100644 --- a/SAM/SAM.Analytical/Classes/Result/TM/TM59Result.cs +++ b/SAM/SAM.Analytical/Classes/Result/TM/TM59Result.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -7,18 +10,18 @@ namespace SAM.Analytical public class TM59Result : TMResult { private HashSet tM59SpaceApplications; - + private int occupiedHours; private int maxExceedableHours; private bool pass; public TM59Result( - string name, - string source, + string name, + string source, string reference, TM52BuildingCategory tM52BuildingCategory, - int occupiedHours, + int occupiedHours, int maxExceedableHours, bool pass, params TM59SpaceApplication[] tM59SpaceApplications) @@ -27,13 +30,13 @@ public TM59Result( this.occupiedHours = occupiedHours; this.maxExceedableHours = maxExceedableHours; this.pass = pass; - this.tM59SpaceApplications = tM59SpaceApplications == null ? null : new HashSet (tM59SpaceApplications); + this.tM59SpaceApplications = tM59SpaceApplications == null ? null : new HashSet(tM59SpaceApplications); } public TM59Result( - Guid guid, - string name, - string source, + Guid guid, + string name, + string source, string reference, TM52BuildingCategory tM52BuildingCategory, int occupiedHours, @@ -153,4 +156,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Result/TM/TMExtendedResult.cs b/SAM/SAM.Analytical/Classes/Result/TM/TMExtendedResult.cs index f4d2b3c44..91134cf77 100644 --- a/SAM/SAM.Analytical/Classes/Result/TM/TMExtendedResult.cs +++ b/SAM/SAM.Analytical/Classes/Result/TM/TMExtendedResult.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; using System.Collections.Generic; @@ -27,7 +30,7 @@ public override int OccupiedHours { get { - if(occupiedHourIndices == null) + if (occupiedHourIndices == null) { return 0; } @@ -92,18 +95,18 @@ public int GetOccupiedHoursExceedingComfortRange() public double GetTemperatureDifference(int index) { - if(maxAcceptableTemperatures == null || operativeTemperatures == null) + if (maxAcceptableTemperatures == null || operativeTemperatures == null) { return double.NaN; } double result = operativeTemperatures[index] - maxAcceptableTemperatures[index]; - if(double.IsNaN(result)) + if (double.IsNaN(result)) { return result; } - if(result < 0.5) + if (result < 0.5) { return 0; } @@ -111,7 +114,7 @@ public double GetTemperatureDifference(int index) double fraction = result % 1; result = System.Math.Truncate(result); - if(fraction >= 0.5) + if (fraction >= 0.5) { result = System.Math.Truncate(result + 1.0); } @@ -150,7 +153,7 @@ public IndexedDoubles GetTemperatureDifferences() for (int i = minIndex; i <= maxIndex; i++) { double temperatureDifference = GetTemperatureDifference(i); - if(double.IsNaN(temperatureDifference)) + if (double.IsNaN(temperatureDifference)) { continue; } @@ -198,7 +201,7 @@ public IndexedDoubles Occupancies int maxIndex = System.Math.Max(maxAcceptableTemperatures.GetMaxIndex().Value, maxAcceptableTemperatures.GetMaxIndex().Value); int minIndex = System.Math.Min(operativeTemperatures.GetMinIndex().Value, operativeTemperatures.GetMinIndex().Value); - for(int i = minIndex; i <= maxIndex; i++) + for (int i = minIndex; i <= maxIndex; i++) { result.Add(i, occupiedHourIndices.Contains(i) ? 1 : 0); } @@ -223,7 +226,7 @@ public virtual bool Criterion1 return false; } - if(hoursExceedingComfortRange == 0) + if (hoursExceedingComfortRange == 0) { return true; } @@ -255,7 +258,7 @@ public TMExtendedResult(string name, string source, string reference, TM52Buildi this.operativeTemperatures = operativeTemperatures == null ? null : new IndexedDoubles(operativeTemperatures); } - public TMExtendedResult(Guid guid, string name, string source, string reference,TM52BuildingCategory tM52BuildingCategory) + public TMExtendedResult(Guid guid, string name, string source, string reference, TM52BuildingCategory tM52BuildingCategory) : base(guid, name, source, reference, tM52BuildingCategory) { @@ -264,7 +267,7 @@ public TMExtendedResult(Guid guid, string name, string source, string reference, public TMExtendedResult(TMExtendedResult tMExtendedResult) : base(tMExtendedResult) { - if(tMExtendedResult != null) + if (tMExtendedResult != null) { exceedanceFactor = tMExtendedResult.exceedanceFactor; @@ -353,7 +356,7 @@ public override JObject ToJObject() if (occupiedHourIndices != null) { JArray jArray = new JArray(); - foreach(int occupiedHourIndex in occupiedHourIndices) + foreach (int occupiedHourIndex in occupiedHourIndices) { jArray.Add(occupiedHourIndex); } @@ -361,7 +364,7 @@ public override JObject ToJObject() result.Add("OccupiedHourIndices", jArray); } - if(minAcceptableTemperatures != null) + if (minAcceptableTemperatures != null) { result.Add("MinAcceptableTemperatures", minAcceptableTemperatures.ToJObject()); } @@ -379,4 +382,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Result/TM/TMResult.cs b/SAM/SAM.Analytical/Classes/Result/TM/TMResult.cs index 36eaeae43..de1df0bcc 100644 --- a/SAM/SAM.Analytical/Classes/Result/TM/TMResult.cs +++ b/SAM/SAM.Analytical/Classes/Result/TM/TMResult.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; @@ -23,7 +26,7 @@ public TMResult(Guid guid, string name, string source, string reference, TM52Bui public TMResult(TMResult tMResult) : base(tMResult) { - if(tMResult != null) + if (tMResult != null) { tM52BuildingCategory = tMResult.tM52BuildingCategory; } @@ -32,7 +35,7 @@ public TMResult(TMResult tMResult) public TMResult(Guid guid, TMResult tMResult) : base(guid, tMResult) { - if(tMResult != null) + if (tMResult != null) { tM52BuildingCategory = tMResult.tM52BuildingCategory; } @@ -65,7 +68,7 @@ public override bool FromJObject(JObject jObject) return false; } - if(jObject.ContainsKey("TM52BuildingCategory")) + if (jObject.ContainsKey("TM52BuildingCategory")) { tM52BuildingCategory = Core.Query.Enum(jObject.Value("TM52BuildingCategory")); } @@ -86,4 +89,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Result/ZoneSimulationResult.cs b/SAM/SAM.Analytical/Classes/Result/ZoneSimulationResult.cs index 3783e3840..63bd0274a 100644 --- a/SAM/SAM.Analytical/Classes/Result/ZoneSimulationResult.cs +++ b/SAM/SAM.Analytical/Classes/Result/ZoneSimulationResult.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; @@ -39,11 +42,11 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { - JObject jObject = base.ToJObject(); + JObject jObject = base.ToJObject(); if (jObject == null) return null; return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/RoomLabelCoordinate.cs b/SAM/SAM.Analytical/Classes/RoomLabelCoordinate.cs index 8d6430a49..f153dec7b 100644 --- a/SAM/SAM.Analytical/Classes/RoomLabelCoordinate.cs +++ b/SAM/SAM.Analytical/Classes/RoomLabelCoordinate.cs @@ -1,6 +1,9 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using NetTopologySuite.Geometries; using NetTopologySuite.Geometries.Prepared; +using System; namespace SAM.Analytical.Classes { diff --git a/SAM/SAM.Analytical/Classes/Space.cs b/SAM/SAM.Analytical/Classes/Space.cs index 826604ba3..fc9aa98ca 100644 --- a/SAM/SAM.Analytical/Classes/Space.cs +++ b/SAM/SAM.Analytical/Classes/Space.cs @@ -1,6 +1,8 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; -using SAM.Geometry.Object.Spatial; using SAM.Geometry.Spatial; using System; @@ -116,7 +118,7 @@ public override bool FromJObject(JObject jObject) if (jObject.ContainsKey("Location")) location = new Point3D(jObject.Value("Location")); - if(jObject.ContainsKey("InternalCondition")) + if (jObject.ContainsKey("InternalCondition")) internalCondition = new InternalCondition(jObject.Value("InternalCondition")); return true; @@ -131,7 +133,7 @@ public override JObject ToJObject() if (location != null) jObject.Add("Location", location.ToJObject()); - if(internalCondition != null) + if (internalCondition != null) jObject.Add("InternalCondition", internalCondition.ToJObject()); return jObject; @@ -148,4 +150,4 @@ public void Move(Vector3D vector3D) location = location?.GetMoved(vector3D) as Point3D; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/System/CoolingSystem.cs b/SAM/SAM.Analytical/Classes/System/CoolingSystem.cs index e90b924d3..07f5d8aaa 100644 --- a/SAM/SAM.Analytical/Classes/System/CoolingSystem.cs +++ b/SAM/SAM.Analytical/Classes/System/CoolingSystem.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Analytical { public class CoolingSystem : MechanicalSystem @@ -36,11 +39,11 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { - JObject jObject = base.ToJObject(); + JObject jObject = base.ToJObject(); if (jObject == null) return null; return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/System/CoolingSystemType.cs b/SAM/SAM.Analytical/Classes/System/CoolingSystemType.cs index a72b69268..4f748a5fb 100644 --- a/SAM/SAM.Analytical/Classes/System/CoolingSystemType.cs +++ b/SAM/SAM.Analytical/Classes/System/CoolingSystemType.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Analytical @@ -40,11 +43,11 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { - JObject jObject = base.ToJObject(); + JObject jObject = base.ToJObject(); if (jObject == null) return null; return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/System/HeatingSystem.cs b/SAM/SAM.Analytical/Classes/System/HeatingSystem.cs index c4a563542..a7c7cb262 100644 --- a/SAM/SAM.Analytical/Classes/System/HeatingSystem.cs +++ b/SAM/SAM.Analytical/Classes/System/HeatingSystem.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Analytical { @@ -37,11 +40,11 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { - JObject jObject = base.ToJObject(); + JObject jObject = base.ToJObject(); if (jObject == null) return null; return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/System/HeatingSystemType.cs b/SAM/SAM.Analytical/Classes/System/HeatingSystemType.cs index f1fea6338..e4897fd34 100644 --- a/SAM/SAM.Analytical/Classes/System/HeatingSystemType.cs +++ b/SAM/SAM.Analytical/Classes/System/HeatingSystemType.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Analytical @@ -40,11 +43,11 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { - JObject jObject = base.ToJObject(); + JObject jObject = base.ToJObject(); if (jObject == null) return null; return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/System/MechanicalSystem.cs b/SAM/SAM.Analytical/Classes/System/MechanicalSystem.cs index f15a1e00d..cc66f0f81 100644 --- a/SAM/SAM.Analytical/Classes/System/MechanicalSystem.cs +++ b/SAM/SAM.Analytical/Classes/System/MechanicalSystem.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Analytical @@ -61,7 +64,7 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { - JObject jObject = base.ToJObject(); + JObject jObject = base.ToJObject(); if (jObject == null) return null; @@ -71,4 +74,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/System/MechanicalSystemType.cs b/SAM/SAM.Analytical/Classes/System/MechanicalSystemType.cs index a7fc38453..9da9ebfe1 100644 --- a/SAM/SAM.Analytical/Classes/System/MechanicalSystemType.cs +++ b/SAM/SAM.Analytical/Classes/System/MechanicalSystemType.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; @@ -44,7 +47,7 @@ public override bool FromJObject(JObject jObject) if (!base.FromJObject(jObject)) return false; - if(jObject.ContainsKey("Description")) + if (jObject.ContainsKey("Description")) description = jObject.Value("Description"); return true; @@ -52,14 +55,14 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { - JObject jObject = base.ToJObject(); + JObject jObject = base.ToJObject(); if (jObject == null) return null; - if(description != null) + if (description != null) jObject.Add("Description", description); return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/System/VentilationSystem.cs b/SAM/SAM.Analytical/Classes/System/VentilationSystem.cs index c3ab951d9..8a461f6a4 100644 --- a/SAM/SAM.Analytical/Classes/System/VentilationSystem.cs +++ b/SAM/SAM.Analytical/Classes/System/VentilationSystem.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Analytical { @@ -37,11 +40,11 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { - JObject jObject = base.ToJObject(); + JObject jObject = base.ToJObject(); if (jObject == null) return null; return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/System/VentilationSystemType.cs b/SAM/SAM.Analytical/Classes/System/VentilationSystemType.cs index 06119e9bb..a3c97798c 100644 --- a/SAM/SAM.Analytical/Classes/System/VentilationSystemType.cs +++ b/SAM/SAM.Analytical/Classes/System/VentilationSystemType.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Analytical @@ -40,11 +43,11 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { - JObject jObject = base.ToJObject(); + JObject jObject = base.ToJObject(); if (jObject == null) return null; return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/TM59Manager.cs b/SAM/SAM.Analytical/Classes/TM59Manager.cs index f626ac273..454e1333c 100644 --- a/SAM/SAM.Analytical/Classes/TM59Manager.cs +++ b/SAM/SAM.Analytical/Classes/TM59Manager.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -8,9 +11,9 @@ namespace SAM.Analytical public class TM59Manager : IJSAMObject { private TextMap textMap; - + public TM59Manager(TextMap textMap) - { + { this.textMap = textMap == null ? null : Core.Create.TextMap(textMap); } @@ -26,7 +29,7 @@ public TM59Manager(JObject jObject) public bool FromJObject(JObject jObject) { - if(jObject == null) + if (jObject == null) { return false; } @@ -120,7 +123,7 @@ public InternalCondition GetInternalCondition(AdjacencyCluster adjacencyCluster, } List applications = TM59SpaceApplications(space, textMap); - if(applications == null || applications.Count == 0) + if (applications == null || applications.Count == 0) { return null; } diff --git a/SAM/SAM.Analytical/Classes/TypeMergeSettings.cs b/SAM/SAM.Analytical/Classes/TypeMergeSettings.cs index 90511e520..ae90e72f8 100644 --- a/SAM/SAM.Analytical/Classes/TypeMergeSettings.cs +++ b/SAM/SAM.Analytical/Classes/TypeMergeSettings.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections.Generic; @@ -45,10 +48,10 @@ public string TypeName return typeName; } } - + public bool FromJObject(JObject jObject) { - if(jObject == null) + if (jObject == null) { return false; } @@ -58,10 +61,10 @@ public bool FromJObject(JObject jObject) typeName = jObject.Value("TypeName"); } - if(jObject.ContainsKey("ExcludedParameterNames")) + if (jObject.ContainsKey("ExcludedParameterNames")) { excludedParameterNames = new HashSet(); - foreach(string parameterName in jObject.Value("ExcludedParameterNames")) + foreach (string parameterName in jObject.Value("ExcludedParameterNames")) { excludedParameterNames.Add(parameterName); } @@ -80,10 +83,10 @@ public JObject ToJObject() jObject.Add("TypeName", typeName); } - if(excludedParameterNames != null) + if (excludedParameterNames != null) { JArray jArray = new JArray(); - foreach(string parameterName in excludedParameterNames) + foreach (string parameterName in excludedParameterNames) { jArray.Add(parameterName); } @@ -94,4 +97,4 @@ public JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Classes/Zone.cs b/SAM/SAM.Analytical/Classes/Zone.cs index e336a1396..628ccdceb 100644 --- a/SAM/SAM.Analytical/Classes/Zone.cs +++ b/SAM/SAM.Analytical/Classes/Zone.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; @@ -45,11 +48,11 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { - JObject jObject = base.ToJObject(); + JObject jObject = base.ToJObject(); if (jObject == null) return null; return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Convert/ToDesignExplorer/File.cs b/SAM/SAM.Analytical/Convert/ToDesignExplorer/File.cs index 778e556e8..a271c8cba 100644 --- a/SAM/SAM.Analytical/Convert/ToDesignExplorer/File.cs +++ b/SAM/SAM.Analytical/Convert/ToDesignExplorer/File.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -23,7 +26,7 @@ public static List ToDesignExplorer(this IEnumerable an } } - if(data == null || data.Count == 0) + if (data == null || data.Count == 0) { return null; } @@ -88,13 +91,13 @@ public static List ToDesignExplorer(this IEnumerable an for (int j = i + 1; j < header.Count; j++) { - if(name == header[j]) + if (name == header[j]) { indexes.Add(j); } } - if(indexes.Count == 0) + if (indexes.Count == 0) { continue; } @@ -103,14 +106,14 @@ public static List ToDesignExplorer(this IEnumerable an name = name.Trim(); string unit = string.Empty; - if(name.LastIndexOf(']') == name.Length - 1 && name.LastIndexOf('[') > 0) + if (name.LastIndexOf(']') == name.Length - 1 && name.LastIndexOf('[') > 0) { int index = name.LastIndexOf('['); name = name.Substring(0, index); unit = name.Substring(index); } - for(int x = 0; x < indexes.Count; x++) + for (int x = 0; x < indexes.Count; x++) { header[indexes[x]] = string.Format("{0} {1} {2}", name, x + 1, unit).Trim(); } @@ -118,10 +121,10 @@ public static List ToDesignExplorer(this IEnumerable an List result = [string.Join(",", header)]; - foreach(Dictionary dictionary in values) + foreach (Dictionary dictionary in values) { List line = Enumerable.Repeat(string.Empty, header.Count).ToList(); - foreach(KeyValuePair keyValuePair in dictionary) + foreach (KeyValuePair keyValuePair in dictionary) { line[keyValuePair.Key] = keyValuePair.Value?.ToString() ?? string.Empty; } @@ -224,7 +227,7 @@ public static List> ToDesignExplorer(this AnalyticalModel double peakCoolingLoadPerArea = double.NaN; double peakCoolingLoadPerVolume = double.NaN; - if(!double.IsNaN(volume)) + if (!double.IsNaN(volume)) { consumptionHeatingPerVolume = double.IsNaN(consumptionHeating) ? double.NaN : consumptionHeating / volume; peakHeatingLoadPerVolume = double.IsNaN(peakHeatingLoad) ? double.NaN : peakHeatingLoad / volume; @@ -302,4 +305,4 @@ public static List> ToDesignExplorer(this AnalyticalModel return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Convert/ToSAM/AnalyticalModel.cs b/SAM/SAM.Analytical/Convert/ToSAM/AnalyticalModel.cs index 2987db8ae..975d40174 100644 --- a/SAM/SAM.Analytical/Convert/ToSAM/AnalyticalModel.cs +++ b/SAM/SAM.Analytical/Convert/ToSAM/AnalyticalModel.cs @@ -1,33 +1,36 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { public static partial class Convert - { + { public static AnalyticalModel ToSAM_AnalyticalModel(this IEnumerable analyticalObjects) { - if(analyticalObjects == null) + if (analyticalObjects == null) { return null; } AnalyticalModel result = new AnalyticalModel(System.Guid.NewGuid(), null); - foreach(IAnalyticalObject analyticalObject in analyticalObjects) + foreach (IAnalyticalObject analyticalObject in analyticalObjects) { - if(analyticalObject is AnalyticalModel) + if (analyticalObject is AnalyticalModel) { AnalyticalModel analyticalModel = (AnalyticalModel)analyticalObject; result = new AnalyticalModel(analyticalModel); } - if(analyticalObject is Panel) + if (analyticalObject is Panel) { result.AddPanel(new Panel((Panel)analyticalObject)); } - if(analyticalObject is AdjacencyCluster) + if (analyticalObject is AdjacencyCluster) { result = new AnalyticalModel(result, new AdjacencyCluster((AdjacencyCluster)analyticalObject)); } @@ -36,4 +39,4 @@ public static AnalyticalModel ToSAM_AnalyticalModel(this IEnumerable, Tuple> ToDictionary(this ApertureToPanelRatios apertureToPanelRatios) + { + if (apertureToPanelRatios is null) + { + return null; + } + + Dictionary, Tuple> result = []; + + int count = apertureToPanelRatios.Count; + + if (count == 0) + { + return result; + + } + + for (int i = 0; i < count; i++) + { + ApertureToPanelRatio apertureToPanelRatio = apertureToPanelRatios[i]; + if (apertureToPanelRatio?.AzimuthRange is not Range azimuthRange) + { + continue; + } + + result[azimuthRange] = Tuple.Create(apertureToPanelRatio.Ratio, apertureToPanelRatio.ApertureConstruction); + } + + return result; + } + } +} diff --git a/SAM/SAM.Analytical/Convert/ToSystem/String.cs b/SAM/SAM.Analytical/Convert/ToSystem/String.cs index e76e94654..3f717ab6a 100644 --- a/SAM/SAM.Analytical/Convert/ToSystem/String.cs +++ b/SAM/SAM.Analytical/Convert/ToSystem/String.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Analytical { @@ -20,4 +23,4 @@ public static string ToString(DateTime dateTime) return dateTime.ToString("dd.MM.yyyy@HH:mm"); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/AdjacencyCluster.cs b/SAM/SAM.Analytical/Create/AdjacencyCluster.cs index 90f36da05..e69740347 100644 --- a/SAM/SAM.Analytical/Create/AdjacencyCluster.cs +++ b/SAM/SAM.Analytical/Create/AdjacencyCluster.cs @@ -1,6 +1,7 @@ -using NetTopologySuite.Algorithm; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core; -using SAM.Geometry; using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System; @@ -14,7 +15,7 @@ public static partial class Create { public static AdjacencyCluster AdjacencyCluster(this IEnumerable shells, IEnumerable spaces, double elevation_Ground = 0, double silverSpacing = Tolerance.MacroDistance, double tolerance_Angle = Tolerance.Angle, double tolerance_Distance = Tolerance.Distance) { - if(shells == null) + if (shells == null) { return null; } @@ -30,12 +31,12 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable shells, List spaces_Temp = spaces == null ? new List() : new List(spaces); List> tuples = new List>(); - + int index = 1; - foreach(Shell shell in shells_Temp) + foreach (Shell shell in shells_Temp) { Space space = spaces_Temp.Find(x => shell.GetBoundingBox().InRange(x.Location, tolerance_Distance) && shell.Inside(x.Location, silverSpacing, tolerance_Distance)); - if(space == null) + if (space == null) { while (spaces_Temp.Find(x => x.Name == string.Format("{0} {1}", "Space", index)) != null) { @@ -46,18 +47,18 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable shells, } List face3Ds = shell.Section(); - if(face3Ds != null && face3Ds.Count != 0) + if (face3Ds != null && face3Ds.Count != 0) { double area = 0; - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { - if(face3D == null) + if (face3D == null) { continue; } double area_Temp = face3D.GetArea(); - if(!double.IsNaN(area_Temp) && area_Temp > 0) + if (!double.IsNaN(area_Temp) && area_Temp > 0) { area += area_Temp; } @@ -68,19 +69,19 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable shells, } double volume = shell.Volume(silverSpacing, tolerance_Distance); - if(!double.IsNaN(volume)) + if (!double.IsNaN(volume)) { space.SetValue(SpaceParameter.Volume, volume); } result.AddObject(space); - foreach(Face3D face3D in shell.Face3Ds) + foreach (Face3D face3D in shell.Face3Ds) { Point3D point3D = face3D.GetInternalPoint3D(tolerance_Distance); Tuple tuple = tuples.Find(x => x.Item1.InRange(point3D, tolerance_Distance) && x.Item2.InRange(point3D, tolerance_Distance)); - if(tuple == null) + if (tuple == null) { PanelType panelType = Query.PanelType(face3D.GetPlane().Normal, tolerance_Angle); @@ -131,10 +132,10 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable Construction construction_Roof = Query.DefaultConstruction(PanelType.Roof); List polygon2Ds = Geometry.Planar.Create.Polygon2Ds(segmentable2Ds, tolerance); - if(polygon2Ds != null && polygon2Ds.Count != 0) + if (polygon2Ds != null && polygon2Ds.Count != 0) { List> tuples = new List>(); - for(int i=0; i < polygon2Ds.Count; i++) + for (int i = 0; i < polygon2Ds.Count; i++) { Polygon2D polygon2D = polygon2Ds[i]?.SimplifyByAngle(); if (polygon2D == null) @@ -155,7 +156,7 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable segment2Ds = Geometry.Planar.Query.Snap(segment2Ds, true); - foreach(Segment2D segment2D in segment2Ds) + foreach (Segment2D segment2D in segment2Ds) { Segment3D segment3D_Min = plane_Min.Convert(segment2D); Segment3D segment3D_Max = plane_Max.Convert(segment2D); @@ -163,7 +164,7 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable Polygon3D polygon3D = new Polygon3D(new Point3D[] { segment3D_Max[0], segment3D_Max[1], segment3D_Min[1], segment3D_Min[0] }); Panel panel = new Panel(construction_Wall, PanelType.Wall, new Face3D(polygon3D)); - tuples.Add(new Tuple (segment2D, panel, space)); + tuples.Add(new Tuple(segment2D, panel, space)); } Polygon3D polygon3D_Min = plane_Min.Convert(polygon2D); @@ -188,7 +189,7 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable } } - while(tuples.Count > 0) + while (tuples.Count > 0) { Tuple tuple = tuples[0]; Segment2D segment2D = tuple.Item1; @@ -218,10 +219,10 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable face3Ds return null; Plane plane_Default = Plane.WorldXY; - plane_Default.Move(new Vector3D(0,0, elevation_Ground)); + plane_Default.Move(new Vector3D(0, 0, elevation_Ground)); Dictionary dictionary_Project = new Dictionary(); - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { Face3D face3D_Project = plane_Default.Project(face3D); if (face3D_Project == null) @@ -242,12 +243,12 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable face3Ds return null; Dictionary> dictionary_Common = new Dictionary>(); - foreach(KeyValuePair keyValuePair_Project in dictionary_Project) + foreach (KeyValuePair keyValuePair_Project in dictionary_Project) { Face2D face2D = null; - foreach(Face2D face2D_Temp in face2Ds) + foreach (Face2D face2D_Temp in face2Ds) { - if(face2D_Temp.InRange(keyValuePair_Project.Key.GetInternalPoint2D(), tolerance)) + if (face2D_Temp.InRange(keyValuePair_Project.Key.GetInternalPoint2D(), tolerance)) { face2D = face2D_Temp; break; @@ -259,15 +260,15 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable face3Ds if (!dictionary_Common.ContainsKey(face2D)) dictionary_Common[face2D] = new List(); - + dictionary_Common[face2D].Add(keyValuePair_Project.Value); } List adjacencyClusters = new List(); - foreach(List face3Ds_Common in dictionary_Common.Values) + foreach (List face3Ds_Common in dictionary_Common.Values) { Dictionary> dictionary = new Dictionary>(); - foreach(Face3D face3D in face3Ds_Common) + foreach (Face3D face3D in face3Ds_Common) { BoundingBox3D boundingBox3D = face3D?.GetBoundingBox(); if (boundingBox3D == null) @@ -281,7 +282,7 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable face3Ds continue; List face2Ds_Elevation = null; - if(!dictionary.TryGetValue(elevation, out face2Ds_Elevation)) + if (!dictionary.TryGetValue(elevation, out face2Ds_Elevation)) { face2Ds_Elevation = new List(); dictionary[elevation] = face2Ds_Elevation; @@ -291,10 +292,10 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable face3Ds } List elevations = dictionary.Keys.ToList(); - if(!elevations.Contains(elevation_Ground)) + if (!elevations.Contains(elevation_Ground)) { elevations.Sort(); - for(int i=1; i < elevations.Count; i++) + for (int i = 1; i < elevations.Count; i++) { if (elevation_Ground > elevations[i]) continue; @@ -303,7 +304,7 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable face3Ds break; } - if(!dictionary.ContainsKey(elevation_Ground)) + if (!dictionary.ContainsKey(elevation_Ground)) dictionary[elevation_Ground] = dictionary[elevations.Last()]; } @@ -380,7 +381,7 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable shells, } Shell shell_Merge = shell.Merge(tolerance_Distance); - if(shell_Merge == null) + if (shell_Merge == null) { shell_Merge = new Shell(shell); } @@ -463,17 +464,17 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable shells, } List elevations = new List(); - foreach(Shell shell_Temp in shells_Temp) + foreach (Shell shell_Temp in shells_Temp) { BoundingBox3D boundingBox3D = shell_Temp?.GetBoundingBox(); - if(boundingBox3D == null) + if (boundingBox3D == null) { continue; } double elevation = Core.Query.Round(boundingBox3D.Min.Z, silverSpacing); int index = elevations.FindIndex(x => elevation.AlmostEqual(x, silverSpacing)); - if(index == -1) + if (index == -1) { elevations.Add(elevation); } @@ -481,7 +482,7 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable shells, elevations.Sort(); List levels = new List(); - for(int i =0; i < elevations.Count; i++) + for (int i = 0; i < elevations.Count; i++) { levels.Add(new Architectural.Level("Level " + i.ToString(), elevations[i])); } @@ -550,7 +551,7 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable shells, continue; Space space_Temp = new Space(space); - if(!double.IsNaN(volume_Shell)) + if (!double.IsNaN(volume_Shell)) { space_Temp.SetValue(SpaceParameter.Volume, volume_Shell); } @@ -560,7 +561,7 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable shells, space_Temp.SetValue(SpaceParameter.Area, area_Shell); } - if(level != null) + if (level != null) { space_Temp.SetValue(SpaceParameter.LevelName, level.Name); } @@ -664,7 +665,7 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable shells, //Panel panel_New_Temp = null; List panels_New_Temp = null; - + if (tuples_Face2D != null && tuples_Face2D.Count != 0) { tuples_Face2D.Sort((x, y) => y.Item3.CompareTo(x.Item3)); @@ -682,7 +683,7 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable shells, else { //Find The Closest Panel - + Point3D point3D = face3D.GetInternalPoint3D(tolerance_Distance); List> tuples_Face2D_Distance = tuples_Face2D_All.ConvertAll(x => new Tuple(x.Item1, x.Item2, x.Item2.Distance(point3D))); tuples_Face2D_Distance.RemoveAll(x => x.Item3 > maxDistance); @@ -703,12 +704,12 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable shells, { Panel panel_New_Temp = panels_New_Temp[0]; List apertures = null; - for(int i = 1; i < panels_New_Temp.Count;i++) + for (int i = 1; i < panels_New_Temp.Count; i++) { List apertures_Temp = panels_New_Temp[i]?.Apertures; - if(apertures_Temp != null) + if (apertures_Temp != null) { - if(apertures == null) + if (apertures == null) { apertures = new List(); } @@ -716,7 +717,7 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable shells, apertures.AddRange(apertures_Temp); } } - + Guid guid = panel_New_Temp.Guid; while (result.GetObject(guid) != null) guid = Guid.NewGuid(); @@ -758,7 +759,7 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable shells, //Creating Shade Panels List> tuples = Enumerable.Repeat>(null, panels.Count()).ToList(); - for(int i =0; i < panels.Count(); i++) + for (int i = 0; i < panels.Count(); i++) //Parallel.For(0, panels.Count(), (int i) => { Panel panel = panels.ElementAt(i); @@ -829,10 +830,10 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable shells, continue; Face3D face3D_New_Snap = face3D_New.Snap(shells, silverSpacing, tolerance_Distance); - if(face3D_New_Snap != null) + if (face3D_New_Snap != null) { face3D_New = face3D_New_Snap; - } + } Panel panel_New = new Panel(guid, panel, face3D_New, null, true, minArea); tuples[i].Add(panel_New); @@ -861,7 +862,7 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable shells, //for (int i = 0; i < spaceCount; i++) { Space space = spaces_Check[i]; - + Shell shell = result.Shell(space); BoundingBox3D boundingBox3D = shell?.GetBoundingBox(); @@ -891,7 +892,7 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable shells, foreach (Guid guid in guids) { - if(guid == Guid.Empty) + if (guid == Guid.Empty) { continue; } @@ -910,7 +911,7 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable shells, public static AdjacencyCluster AdjacencyCluster(this IEnumerable shells, double elevationGround = 0, double thinnessRatio = 0.001, double minArea = 0.1, double maxDistance = 0.1, double maxAngle = 0.0872664626, double silverSpacing = Tolerance.MacroDistance, double tolerance_Distance = Tolerance.Distance, double tolerance_Angle = Tolerance.Angle) { - if(shells == null) + if (shells == null) { return null; } @@ -918,7 +919,7 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable shells, shells = shells.Split(silverSpacing, tolerance_Angle, tolerance_Distance); List panels = new List(); - foreach(Shell shell in shells) + foreach (Shell shell in shells) { List panels_Shell = Panels(shell, silverSpacing, tolerance_Distance); if (panels_Shell != null && panels_Shell.Count != 0) @@ -928,7 +929,7 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable shells, } AdjacencyCluster result = AdjacencyCluster(shells, null, panels, true, true, thinnessRatio, minArea, maxDistance, maxAngle, silverSpacing, tolerance_Distance, tolerance_Angle); - if(result != null) + if (result != null) { result.Cut(elevationGround, null, tolerance_Distance); result.UpdatePanelTypes(elevationGround); @@ -939,7 +940,7 @@ public static AdjacencyCluster AdjacencyCluster(this IEnumerable shells, } public static AdjacencyCluster AdjacencyCluster(this IEnumerable spaces, IEnumerable panels, double offset = 0.1, bool addMissingSpaces = false, bool addMissingPanels = false, double thinnessRatio = 0.01, double minArea = Tolerance.MacroDistance, double maxDistance = 0.1, double maxAngle = 0.0872664626, double silverSpacing = Tolerance.MacroDistance, double tolerance_Distance = Tolerance.Distance, double tolerance_Angle = Tolerance.Angle) - { + { List shells = panels.Shells(offset, maxDistance, tolerance_Distance); if (shells == null || shells.Count == 0) return null; @@ -977,7 +978,7 @@ private static AdjacencyCluster AdjacencyCluster(this Dictionary>(elevations[0], face2Ds[elevations[0]])); - for(int i=1; i < elevations.Count - 1; i++) + for (int i = 1; i < elevations.Count - 1; i++) { double elevation_Top = elevations[i - 1]; double elevation_Bottom = elevations[i]; @@ -994,7 +995,7 @@ private static AdjacencyCluster AdjacencyCluster(this Dictionary x.Edge2Ds).ForEach(x => closed2Ds.AddRange(x)); List segmentable2Ds = new List(); - foreach(IClosed2D closed2D in closed2Ds) + foreach (IClosed2D closed2D in closed2Ds) { ISegmentable2D segmentable2D = closed2D as ISegmentable2D; if (segmentable2D == null) @@ -1014,7 +1015,7 @@ private static AdjacencyCluster AdjacencyCluster(this Dictionary internalEdge2Ds = new List(); - foreach(Face2D face2D_New in face2Ds_New) + foreach (Face2D face2D_New in face2Ds_New) { List internalEdge2Ds_New = face2D_New.InternalEdge2Ds; if (internalEdge2Ds_New == null || internalEdge2Ds_New.Count == 0) @@ -1086,12 +1087,12 @@ private static AdjacencyCluster AdjacencyCluster(this Dictionary segment2Ds = new List(); - foreach(IClosed2D closed2D in face2D.Edge2Ds) + foreach (IClosed2D closed2D in face2D.Edge2Ds) { ISegmentable2D segmentable2D = closed2D as ISegmentable2D; - if(segmentable2D == null) + if (segmentable2D == null) segmentable2D = closed2D as ISegmentable2D; - + if (segmentable2D == null) continue; @@ -1113,14 +1114,14 @@ private static AdjacencyCluster AdjacencyCluster(this Dictionary(Geometry.Spatial.Query.Mid(plane_Bottom.Convert(segment2D)), panel, space)); } List face2Ds_Space_Top = tuple_Top.Item2.FindAll(x => face2D.On(x.GetInternalPoint2D()) || face2D.Inside(x.GetInternalPoint2D())); - foreach(Face2D face2D_Top in face2Ds_Space_Top) + foreach (Face2D face2D_Top in face2Ds_Space_Top) { Face3D face3D_Top = plane_Top.Convert(face2D_Top); if (face3D_Top == null) @@ -1150,7 +1151,7 @@ private static AdjacencyCluster AdjacencyCluster(this Dictionary apertures = null) + { + if (analyticalModel == null || double.IsNaN(apertureScaleFactor)) + { + return null; + } + + List apertures_Temp = apertures == null ? [] : [.. apertures]; + + // Resolve aperture list from model when not provided + if (apertures_Temp.Count == 0) + { + apertures_Temp = analyticalModel.GetApertures(); + } + else + { + // Clean input list and re-fetch from model to ensure consistency + for (int i = apertures_Temp.Count - 1; i >= 0; i--) + { + if (apertures_Temp[i] is null) + { + apertures_Temp.RemoveAt(i); + continue; + } + + Aperture aperture = analyticalModel.GetAperture(apertures_Temp[i].Guid, out Panel panel); + if (aperture is null) + { + apertures_Temp.RemoveAt(i); + continue; + } + + apertures_Temp[i] = new Aperture(aperture); + } + } + + // Apply scaling when we have targets and a valid factor + if (apertures_Temp == null || apertures_Temp.Count == 0) + { + return new AnalyticalModel(analyticalModel); + } + + AdjacencyCluster adjacencyCluster = new(analyticalModel.AdjacencyCluster, true); + + foreach (Aperture aperture in apertures_Temp) + { + Aperture aperture_Temp = aperture.Rescale(apertureScaleFactor); + if (aperture_Temp is null) + { + continue; + } + + if (adjacencyCluster.GetAperture(aperture_Temp.Guid, out Panel panel_Temp) is null || panel_Temp is null) + { + continue; + } + + panel_Temp = Panel(panel_Temp); + + panel_Temp.RemoveAperture(aperture_Temp.Guid); + panel_Temp.AddAperture(aperture_Temp); + + adjacencyCluster.AddObject(panel_Temp); + } + + AnalyticalModel result = new(analyticalModel, adjacencyCluster); + + + //CaseDataCollection + if (!result.TryGetValue(AnalyticalModelParameter.CaseDataCollection, out CaseDataCollection caseDataCollection)) + { + caseDataCollection = []; + } + else + { + caseDataCollection = [.. caseDataCollection]; + } + + caseDataCollection.Add(new WindowSizeCaseData(apertureScaleFactor)); + + result?.SetValue(AnalyticalModelParameter.CaseDataCollection, caseDataCollection); + + + //CaseDescription + string caseDescription = string.Empty; + if (!Core.Query.TryGetValue(result, "CaseDescription", out caseDescription)) + { + caseDescription = string.Empty; + } + + if (string.IsNullOrWhiteSpace(caseDescription)) + { + caseDescription = "Case"; + } + else + { + caseDescription += "_"; + } + + string sufix = "ByWindowSize_"; + if (!double.IsNaN(apertureScaleFactor)) + { + sufix += apertureScaleFactor.ToString(); + } + + caseDescription = caseDescription + sufix; + + Core.Modify.SetValue(result, "CaseDescription", caseDescription); + + return result; + } + + public static AnalyticalModel AnalyticalModel_ByWindowSize(this AnalyticalModel analyticalModel, + WindowSizeCase windowSizeCase) + { + if (analyticalModel == null || windowSizeCase == null) + { + return null; + } + + List apertures = null; + if (windowSizeCase.CaseSelection is CaseSelection caseSelection) + { + apertures = Query.IJSAMObjects(caseSelection, analyticalModel); + } + + return AnalyticalModel_ByWindowSize(analyticalModel, windowSizeCase.ApertureScaleFactor, apertures); + } + + public static AnalyticalModel AnalyticalModel_ByApertureByAzimuths(this AnalyticalModel analyticalModel, + Dictionary, Tuple> intervalRatioMap, + bool subdivide, + double apertureHeight, + double sillHeight, + double horizontalSeparation, + double offset, + bool keepSeparationDistance, + IEnumerable panels = null) + { + if (analyticalModel == null) + { + return null; + } + + if (intervalRatioMap == null || intervalRatioMap.Count == 0) + { + return new AnalyticalModel(analyticalModel); + } + + if (analyticalModel?.AdjacencyCluster is not AdjacencyCluster adjacencyCluster) + { + return new AnalyticalModel(analyticalModel); + } + + adjacencyCluster = new AdjacencyCluster(adjacencyCluster, true); + + List panels_Temp = panels == null ? [] : [.. panels]; + + if (panels_Temp == null || panels_Temp.Count == 0) + { + panels_Temp = analyticalModel.GetPanels(); + } + + HashSet ratios = []; + + foreach (Panel panel in panels_Temp) + { + if (panel.PanelType != PanelType.WallExternal) + { + continue; + } + + double az = NormalizeAngleDegrees(panel.Azimuth()); + if (double.IsNaN(az)) + { + continue; + } + + if (!TryGetRatio(intervalRatioMap, az, out double ratio, out ApertureConstruction apertureConstruction_Temp)) + { + continue; + } + + ratios.Add(ratio); + + Panel panel_New = Panel(panel); + + if (apertureConstruction_Temp is null) + { + apertureConstruction_Temp = Query.DefaultApertureConstruction(panel_New, ApertureType.Window); + } + + List apertures = panel_New.AddApertures(apertureConstruction_Temp, ratio, subdivide, apertureHeight, sillHeight, horizontalSeparation, offset, keepSeparationDistance); + if (apertures == null || apertures.Count == 0) + { + continue; + } + + adjacencyCluster.AddObject(panel_New); + } + + AnalyticalModel result = new(analyticalModel, adjacencyCluster); + + + //CaseDataCollection + if (!result.TryGetValue(AnalyticalModelParameter.CaseDataCollection, out CaseDataCollection caseDataCollection)) + { + caseDataCollection = []; + } + else + { + caseDataCollection = [.. caseDataCollection]; + } + + caseDataCollection.Add(new ApertureCaseData(ratios)); + + result?.SetValue(AnalyticalModelParameter.CaseDataCollection, caseDataCollection); + + + //CaseDescription + string caseDescription = string.Empty; + if (!Core.Query.TryGetValue(result, "CaseDescription", out caseDescription)) + { + caseDescription = string.Empty; + } + + if (string.IsNullOrWhiteSpace(caseDescription)) + { + caseDescription = "Case"; + } + else + { + caseDescription += "_"; + } + + string sufix = "ByApertureByAzimuths_"; + if (ratios != null && ratios.Count != 0) + { + sufix += "R_" + string.Join("_", ratios); + } + + caseDescription = caseDescription + sufix; + + Core.Modify.SetValue(result, "CaseDescription", caseDescription); + + return result; + } + + public static AnalyticalModel AnalyticalModel_ByApertureByAzimuths(this AnalyticalModel analyticalModel, + ApertureCase apertureCase) + { + if (analyticalModel == null) + { + return null; + } + + if (apertureCase == null) + { + return new AnalyticalModel(analyticalModel); + } + + List panels = null; + if (apertureCase.CaseSelection is CaseSelection caseSelection) + { + panels = Query.IJSAMObjects(caseSelection, analyticalModel); + } + + + return AnalyticalModel_ByApertureByAzimuths(analyticalModel, + Convert.ToDictionary(apertureCase.ApertureToPanelRatios), + apertureCase.Subdivide, + apertureCase.ApertureHeight, + apertureCase.SillHeight, + apertureCase.HorizontalSeparation, + apertureCase.Offset, + apertureCase.KeepSeparationDistance, + panels); + } + + public static AnalyticalModel AnalyticalModel_ByApertureConstruction(this AnalyticalModel analyticalModel, + ApertureConstruction apertureConstruction, + IEnumerable apertures = null) + { + if (analyticalModel is null) + { + return null; + } + + List apertures_Temp = apertures == null ? [] : [.. apertures]; + if (apertures_Temp is null || apertures_Temp.Count == 0) + { + apertures_Temp = analyticalModel.GetApertures(); + } + + if (apertures_Temp == null || apertures_Temp.Count == 0) + { + return new AnalyticalModel(analyticalModel); + } + + if (analyticalModel?.AdjacencyCluster is not AdjacencyCluster adjacencyCluster) + { + return new AnalyticalModel(analyticalModel); + } + + adjacencyCluster = new AdjacencyCluster(adjacencyCluster, true); + + foreach (Aperture aperture in apertures_Temp) + { + Aperture aperture_Temp = new(aperture, apertureConstruction); + + if (adjacencyCluster.GetAperture(aperture_Temp.Guid, out Panel panel_Temp) is null || panel_Temp is null) + { + continue; + } + + panel_Temp = Panel(panel_Temp); + + panel_Temp.RemoveAperture(aperture_Temp.Guid); + panel_Temp.AddAperture(aperture_Temp); + + adjacencyCluster.AddObject(panel_Temp); + } + + AnalyticalModel result = new(analyticalModel, adjacencyCluster); + + + //CaseDataCollection + if (!result.TryGetValue(AnalyticalModelParameter.CaseDataCollection, out CaseDataCollection caseDataCollection)) + { + caseDataCollection = []; + } + else + { + caseDataCollection = [.. caseDataCollection]; + } + + caseDataCollection.Add(new ApertureConstructionCaseData(apertureConstruction)); + + result?.SetValue(AnalyticalModelParameter.CaseDataCollection, caseDataCollection); + + + //CaseDescription + string caseDescription = string.Empty; + if (!Core.Query.TryGetValue(result, "CaseDescription", out caseDescription)) + { + caseDescription = string.Empty; + } + + if (string.IsNullOrWhiteSpace(caseDescription)) + { + caseDescription = "Case"; + } + else + { + caseDescription += "_"; + } + + string sufix = "ByApertureConstruction_"; + if (apertureConstruction is not null) + { + sufix += apertureConstruction.Name ?? string.Empty; + } + + caseDescription = caseDescription + sufix; + + Core.Modify.SetValue(result, "CaseDescription", caseDescription); + + return result; + } + + public static AnalyticalModel AnalyticalModel_ByApertureConstruction(this AnalyticalModel analyticalModel, + ApertureConstructionCase apertureConstructionCase) + { + if (analyticalModel is null || apertureConstructionCase == null) + { + return null; + } + + return AnalyticalModel_ByApertureConstruction(analyticalModel, apertureConstructionCase.ApertureConstruction, apertureConstructionCase.CaseSelection?.IJSAMObjects(analyticalModel)); + } + + public static AnalyticalModel AnalyticalModel_ByOpening(this AnalyticalModel analyticalModel, + IEnumerable openingAngles, + IEnumerable descriptions = null, + IEnumerable functions = null, + IEnumerable colors = null, + IEnumerable factors = null, + IEnumerable profiles = null, + bool paneSizeOnly = true, + IEnumerable apertures = null) + { + if (analyticalModel is null) + { + return null; + } + + List apertures_Temp = apertures == null ? [] : [.. apertures]; + if (apertures_Temp is null || apertures_Temp.Count == 0) + { + apertures_Temp = analyticalModel.GetApertures(); + } + + AnalyticalModel result = new AnalyticalModel(analyticalModel); + + if (openingAngles == null || openingAngles.Count() == 0) + { + return result; + } + + + if (apertures_Temp == null || apertures_Temp.Count == 0) + { + return result; + } + + if (analyticalModel?.AdjacencyCluster is not AdjacencyCluster adjacencyCluster) + { + return result; + } + + adjacencyCluster = new AdjacencyCluster(adjacencyCluster, true); + + //List apertures_Result = []; + //List dischargeCoefficients_Result = []; + //List openingProperties_Result = []; + + for (int i = 0; i < apertures_Temp.Count; i++) + { + Aperture aperture = apertures_Temp[i]; + + Panel panel = adjacencyCluster.GetPanel(aperture); + if (panel == null) + { + continue; + } + + Aperture aperture_Temp = panel.GetAperture(aperture.Guid); + if (aperture_Temp == null) + { + continue; + } + + panel = Panel(panel); + aperture_Temp = new Aperture(aperture_Temp); + + double openingAngle = openingAngles.Count() > i ? openingAngles.ElementAt(i) : openingAngles.Last(); + double width = paneSizeOnly ? aperture_Temp.GetWidth(AperturePart.Pane) : aperture_Temp.GetWidth(); + double height = paneSizeOnly ? aperture_Temp.GetHeight(AperturePart.Pane) : aperture_Temp.GetHeight(); + + double factor = (factors != null && factors.Count() != 0) ? (factors.Count() > i ? factors.ElementAt(i) : factors.Last()) : double.NaN; + + PartOOpeningProperties partOOpeningProperties = new(width, height, openingAngle); + + double dischargeCoefficient = partOOpeningProperties.GetDischargeCoefficient(); + + ISingleOpeningProperties singleOpeningProperties = null; + if (profiles != null && profiles.Count() != 0) + { + Profile profile = profiles.Count() > i ? profiles.ElementAt(i) : profiles.Last(); + ProfileOpeningProperties profileOpeningProperties = new(partOOpeningProperties.GetDischargeCoefficient(), profile); + if (!double.IsNaN(factor)) + { + profileOpeningProperties.Factor = factor; + } + + singleOpeningProperties = profileOpeningProperties; + } + else + { + if (!double.IsNaN(factor)) + { + partOOpeningProperties.Factor = factor; + } + + singleOpeningProperties = partOOpeningProperties; + } + + if (descriptions != null && descriptions.Count() != 0) + { + string description = descriptions.Count() > i ? descriptions.ElementAt(i) : descriptions.Last(); + singleOpeningProperties.SetValue(OpeningPropertiesParameter.Description, description); + } + + string function_Temp = "zdwno,0,19.00,21.00,99.00"; + if (functions != null && functions.Count() != 0) + { + function_Temp = functions.Count() > i ? functions.ElementAt(i) : functions.Last(); + } + singleOpeningProperties.SetValue(OpeningPropertiesParameter.Function, function_Temp); + + if (colors != null && colors.Count() != 0) + { + System.Drawing.Color color = colors.Count() > i ? colors.ElementAt(i) : colors.Last(); + aperture_Temp.SetValue(ApertureParameter.Color, color); + } + else + { + aperture_Temp.SetValue(ApertureParameter.Color, Query.Color(ApertureType.Window, AperturePart.Pane, true)); + } + + aperture_Temp.AddSingleOpeningProperties(singleOpeningProperties); + + panel.RemoveAperture(aperture.Guid); + if (panel.AddAperture(aperture_Temp)) + { + adjacencyCluster.AddObject(panel); + //apertures_Result.Add(aperture_Temp); + //dischargeCoefficients_Result.Add(singleOpeningProperties.GetDischargeCoefficient()); + //openingProperties_Result.Add(singleOpeningProperties); + } + } + + + result = new(analyticalModel, adjacencyCluster); + + + //CaseDataCollection + if (!result.TryGetValue(AnalyticalModelParameter.CaseDataCollection, out CaseDataCollection caseDataCollection)) + { + caseDataCollection = []; + } + else + { + caseDataCollection = [.. caseDataCollection]; + } + + caseDataCollection.Add(new OpeningCaseData(openingAngles?.FirstOrDefault() ?? double.NaN)); + + + //CaseDescription + string caseDescription = string.Empty; + if (!Core.Query.TryGetValue(result, "CaseDescription", out caseDescription)) + { + caseDescription = string.Empty; + } + + if (string.IsNullOrWhiteSpace(caseDescription)) + { + caseDescription = "Case"; + } + else + { + caseDescription += "_"; + } + + string sufix = "ByOpening_"; + if (openingAngles is not null) + { + sufix += string.Join("_", openingAngles.ToList().ConvertAll(x => string.Format("{0}deg", x))); + } + + caseDescription = caseDescription + sufix; + + Core.Modify.SetValue(result, "CaseDescription", caseDescription); + + return result; + } + + public static AnalyticalModel AnalyticalModel_ByShade(this AnalyticalModel analyticalModel, + bool glassPartOnly, + double overhangDepth, + double overhangVerticalOffset, + double overhangFrontOffset, + double leftFinDepth, + double leftFinOffset, + double leftFinFrontOffset, + double rightFinDepth, + double rightFinOffset, + double rightFinFrontOffset, + IEnumerable analyticalObjects = null) + { + if (analyticalModel is null) + { + return null; + } + + List analyticalObjects_Temp = analyticalObjects == null ? [] : [.. analyticalObjects]; + if (analyticalObjects_Temp is null || analyticalObjects_Temp.Count == 0) + { + analyticalObjects_Temp = analyticalModel.GetApertures()?.ConvertAll(x => x as IAnalyticalObject); + } + + AnalyticalModel result = new AnalyticalModel(analyticalModel); + + if (analyticalObjects_Temp == null || analyticalObjects_Temp.Count == 0) + { + return result; + } + + if (analyticalModel?.AdjacencyCluster is not AdjacencyCluster adjacencyCluster) + { + return result; + } + + adjacencyCluster = new AdjacencyCluster(adjacencyCluster, true); + + foreach (IAnalyticalObject analyticalObject in analyticalObjects_Temp) + { + List shades = null; + if (analyticalObject is Panel panel) + { + shades = Panels_Shade(panel, overhangDepth, overhangVerticalOffset, overhangFrontOffset, + leftFinDepth, leftFinOffset, leftFinFrontOffset, + rightFinDepth, rightFinOffset, rightFinFrontOffset); + } + else if (analyticalObject is Aperture aperture) + { + shades = Panels_Shade(aperture, glassPartOnly, overhangDepth, overhangVerticalOffset, overhangFrontOffset, + leftFinDepth, leftFinOffset, leftFinFrontOffset, + rightFinDepth, rightFinOffset, rightFinFrontOffset); + } + + if (shades == null) continue; + + foreach (Panel shade in shades) + { + adjacencyCluster.AddObject(shade); + } + } + + analyticalModel = new AnalyticalModel(analyticalModel, adjacencyCluster); + + result = new(analyticalModel, adjacencyCluster); + + + //CaseDataCollection + if (!result.TryGetValue(AnalyticalModelParameter.CaseDataCollection, out CaseDataCollection caseDataCollection)) + { + caseDataCollection = []; + } + else + { + caseDataCollection = [.. caseDataCollection]; + } + + caseDataCollection.Add(new ShadeCaseData(overhangDepth, leftFinDepth, rightFinDepth)); + + result?.SetValue(AnalyticalModelParameter.CaseDataCollection, caseDataCollection); + + + //CaseDescription + string caseDescription = string.Empty; + if (!Core.Query.TryGetValue(result, "CaseDescription", out caseDescription)) + { + caseDescription = string.Empty; + } + + if (string.IsNullOrWhiteSpace(caseDescription)) + { + caseDescription = "Case"; + } + else + { + caseDescription += "_"; + } + + string sufix = "ByShade_"; + if (overhangDepth != 0) + { + sufix += string.Format("O{0}m", overhangDepth); + } + + if (leftFinDepth != 0) + { + sufix += string.Format("L{0}m", leftFinDepth); + } + + if (rightFinDepth != 0) + { + sufix += string.Format("R{0}m", rightFinDepth); + } + + caseDescription = caseDescription + sufix; + + Core.Modify.SetValue(result, "CaseDescription", caseDescription); + + return result; + } + + public static AnalyticalModel AnalyticalModel_ByFinShade(this AnalyticalModel analyticalModel, + FinShadeCase finShadeCase) + { + if (analyticalModel is null || finShadeCase is null) + { + return null; + } + + return AnalyticalModel_ByShade(analyticalModel, + finShadeCase.GlassPartOnly, + finShadeCase.OverhangDepth, + finShadeCase.OverhangVerticalOffset, + finShadeCase.OverhangFrontOffset, + finShadeCase.LeftFinDepth, + finShadeCase.LeftFinOffset, + finShadeCase.LeftFinFrontOffset, + finShadeCase.RightFinDepth, + finShadeCase.RightFinOffset, + finShadeCase.RightFinFrontOffset, + finShadeCase.CaseSelection?.IJSAMObjects(analyticalModel)); + } + + public static AnalyticalModel AnalyticalModel_ByShade(this AnalyticalModel analyticalModel, + IEnumerable shades) + { + if (analyticalModel is null) + { + return null; + } + + if (shades == null || shades.Count() == 0) + { + return new AnalyticalModel(analyticalModel); + } + + if (analyticalModel?.AdjacencyCluster is not AdjacencyCluster adjacencyCluster) + { + return new AnalyticalModel(analyticalModel); + } + + adjacencyCluster = new AdjacencyCluster(adjacencyCluster, true); + + foreach (Panel shade in shades) + { + adjacencyCluster.AddObject(shade); + } + + AnalyticalModel result = new(analyticalModel, adjacencyCluster); + + + //CaseDataCollection + if (!result.TryGetValue(AnalyticalModelParameter.CaseDataCollection, out CaseDataCollection caseDataCollection)) + { + caseDataCollection = []; + } + else + { + caseDataCollection = [.. caseDataCollection]; + } + + caseDataCollection.Add(new ShadeCaseData()); + + result?.SetValue(AnalyticalModelParameter.CaseDataCollection, caseDataCollection); + + + //CaseDescription + string caseDescription = string.Empty; + if (!Core.Query.TryGetValue(result, "CaseDescription", out caseDescription)) + { + caseDescription = string.Empty; + } + + if (string.IsNullOrWhiteSpace(caseDescription)) + { + caseDescription = "Case"; + } + else + { + caseDescription += "_"; + } + + string sufix = "ByShade1_"; + + caseDescription = caseDescription + sufix; + + Core.Modify.SetValue(result, "CaseDescription", caseDescription); + + return result; + } + + public static AnalyticalModel AnalyticalModel_ByVentilation(this AnalyticalModel analyticalModel, + string function, + double ach, + double m3h, + double factor, + double setback, + string description, + IEnumerable analyticalObjects) + { + if (analyticalModel is null) + { + return null; + } + + List analyticalObjects_Temp = analyticalObjects == null ? [] : [.. analyticalObjects]; + if (analyticalObjects_Temp is null || analyticalObjects_Temp.Count == 0) + { + analyticalObjects_Temp = analyticalModel.GetSpaces()?.ConvertAll(x => x as IAnalyticalObject); + } + + if (analyticalObjects_Temp == null || analyticalObjects_Temp.Count == 0) + { + return new AnalyticalModel(analyticalModel); + } + + if (analyticalModel?.AdjacencyCluster is not AdjacencyCluster adjacencyCluster) + { + return new AnalyticalModel(analyticalModel); + } + + adjacencyCluster = new AdjacencyCluster(adjacencyCluster, true); + + List spaces = []; + + foreach (IAnalyticalObject analyticalObject_Temp in analyticalObjects) + { + if (analyticalObject_Temp is not SAMObject sAMObject) + continue; + + List spaces_Temp = []; + if (analyticalObject_Temp is Space space) + { + spaces_Temp.Add(adjacencyCluster.GetObject(sAMObject.Guid)); + } + else if (analyticalObject_Temp is Zone zone) + { + spaces_Temp = adjacencyCluster.GetSpaces(zone); + } + + spaces.AddRange(spaces_Temp); + } + + AnalyticalModel result = new(analyticalModel, adjacencyCluster); + + if (spaces == null || spaces.Count == 0) + { + return result; + } + + //List internalConditions = []; + + foreach (Space space in spaces) + { + if (space?.InternalCondition is not InternalCondition internalCondition) + continue; + + if (function is null) + { + internalCondition.RemoveValue(InternalConditionParameter.VentilationFunction); + } + else + { + Function function_Temp = Analytical.Convert.ToSAM_Function(function); + if (function_Temp is not null) + { + FunctionType functionType = function_Temp.GetFunctionType(); + + if (functionType == FunctionType.tcmvc || functionType == FunctionType.tcmvn || functionType == FunctionType.tmmvn) + { + int vent_Index = 3; // ACH token index for these function types + + if (!double.IsNaN(ach)) + { + function_Temp[vent_Index] = ach; + } + else if (!double.IsNaN(m3h)) + { + double volume = space.Volume(adjacencyCluster); + if (!double.IsNaN(volume)) + { + function_Temp[vent_Index] = Core.Query.Round(m3h / volume, Tolerance.MacroDistance); + } + } + } + } + + internalCondition.SetValue(InternalConditionParameter.VentilationFunction, function_Temp?.ToString() ?? function); + } + + if (description is null) + internalCondition.RemoveValue(InternalConditionParameter.VentilationFunctionDescription); + else + internalCondition.SetValue(InternalConditionParameter.VentilationFunctionDescription, description); + + if (double.IsNaN(factor)) + internalCondition.RemoveValue(InternalConditionParameter.VentilationFunctionFactor); + else + internalCondition.SetValue(InternalConditionParameter.VentilationFunctionFactor, factor); + + if (double.IsNaN(setback)) + internalCondition.RemoveValue(InternalConditionParameter.VentilationFunctionSetback); + else + internalCondition.SetValue(InternalConditionParameter.VentilationFunctionSetback, setback); + + space.InternalCondition = internalCondition; + //internalConditions.Add(internalCondition); + adjacencyCluster.AddObject(space); + } + + + //CaseDataCollection + if (!result.TryGetValue(AnalyticalModelParameter.CaseDataCollection, out CaseDataCollection caseDataCollection)) + { + caseDataCollection = []; + } + else + { + caseDataCollection = [.. caseDataCollection]; + } + + caseDataCollection.Add(new VentilationCaseData(ach)); + + result?.SetValue(AnalyticalModelParameter.CaseDataCollection, caseDataCollection); + + + //CaseDescription + string caseDescription = string.Empty; + if (!Core.Query.TryGetValue(result, "CaseDescription", out caseDescription)) + { + caseDescription = string.Empty; + } + + if (string.IsNullOrWhiteSpace(caseDescription)) + { + caseDescription = "Case"; + } + else + { + caseDescription += "_"; + } + + string sufix = "ByVentilation_"; + if (!double.IsNaN(ach)) + { + sufix += string.Format("{0}ach", ach); + } + + if (m3h != 0) + { + sufix += string.Format("{0}m3h", m3h); + } + + if (factor != 0) + { + sufix += string.Format("F{0}", factor); + } + + if (setback != 0) + { + sufix += string.Format("sb{0}", setback); + } + + caseDescription = caseDescription + sufix; + + Core.Modify.SetValue(result, "CaseDescription", caseDescription); + + return result; + } + + + public static AnalyticalModel AnalyticalModel_ByVentilation(this AnalyticalModel analyticalModel, + VentilationCase ventilationCase) + { + if (analyticalModel is null || ventilationCase is null) + { + return null; + } + + return AnalyticalModel_ByVentilation(analyticalModel, + ventilationCase.Function, + ventilationCase.ACH, + ventilationCase.M3h, + ventilationCase.Factor, + ventilationCase.Setback, + ventilationCase.Description, + ventilationCase.CaseSelection?.IJSAMObjects(analyticalModel)); + } + + public static AnalyticalModel AnalyticalModel_ByWeatherData(this AnalyticalModel analyticalModel, + WeatherData weatherData) + { + if (analyticalModel is null) + { + return null; + } + + AnalyticalModel result = new AnalyticalModel(analyticalModel); + + if (weatherData == null) + { + return result; + } + + result.SetValue(AnalyticalModelParameter.WeatherData, weatherData); + + + //CaseDataCollection + if (!result.TryGetValue(AnalyticalModelParameter.CaseDataCollection, out CaseDataCollection caseDataCollection)) + { + caseDataCollection = []; + } + else + { + caseDataCollection = [.. caseDataCollection]; + } + + caseDataCollection.Add(new WeatherCaseData(weatherData?.Name)); + + result?.SetValue(AnalyticalModelParameter.CaseDataCollection, caseDataCollection); + + + //CaseDescription + string caseDescription = string.Empty; + if (!Core.Query.TryGetValue(result, "CaseDescription", out caseDescription)) + { + caseDescription = string.Empty; + } + + if (string.IsNullOrWhiteSpace(caseDescription)) + { + caseDescription = "Case"; + } + else + { + caseDescription += "_"; + } + + string sufix = "ByWeather_"; + if (!string.IsNullOrWhiteSpace(weatherData?.Name)) + { + sufix += weatherData.Name; + } + + caseDescription = caseDescription + sufix; + + Core.Modify.SetValue(result, "CaseDescription", caseDescription); + + return result; + } + + public static AnalyticalModel AnalyticalModel_ByWeatherData(this AnalyticalModel analyticalModel, + WeatherDataCase weatherDataCase) + { + if (analyticalModel == null || weatherDataCase == null) + { + return null; + } + + return AnalyticalModel_ByWeatherData(analyticalModel, weatherDataCase.WeatherData); + } + + /// Try to find the ratio whose interval contains the given azimuth. + private static bool TryGetRatio(Dictionary, Tuple> map, double azimuthDeg, out double ratio, out ApertureConstruction apertureConstruction) + { + double azimuthDeg_Round = System.Math.Round(azimuthDeg, MidpointRounding.ToEven); + apertureConstruction = null; + ratio = 0.0; + + foreach (var kvp in map) + { + if (kvp.Key.In(azimuthDeg_Round)) + { + ratio = kvp.Value.Item1; + apertureConstruction = kvp.Value.Item2; + return true; + } + } + return false; + } + + /// Normalise angle to [0, 359]. + private static double NormalizeAngleDegrees(double angleDeg) + { + if (double.IsNaN(angleDeg) || double.IsInfinity(angleDeg)) + { + return double.NaN; + } + + double a = angleDeg % 360.0; + + if (a < 0) + { + a += 360.0; + } + + return (a >= 360.0) ? 359.0 : a; + } + + } +} diff --git a/SAM/SAM.Analytical/Create/AnalyticalModels.cs b/SAM/SAM.Analytical/Create/AnalyticalModels.cs new file mode 100644 index 000000000..f5a9a56cf --- /dev/null +++ b/SAM/SAM.Analytical/Create/AnalyticalModels.cs @@ -0,0 +1,55 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Analytical.Classes; +using System.Collections.Generic; + +namespace SAM.Analytical +{ + public static partial class Create + { + public static List AnalyticalModels(this AnalyticalModel analyticalModel, Cases cases) + { + if (analyticalModel == null || cases == null) + { + return null; + } + + List result = []; + foreach (Case @case in cases) + { + AnalyticalModel analyticalModel_Temp = AnalyticalModel(analyticalModel, @case); + if (analyticalModel_Temp is null) + { + continue; + } + + result.Add(analyticalModel_Temp); + } + + return result; + } + + public static List AnalyticalModels(this AnalyticalModel analyticalModel, IEnumerable cases) + { + if (analyticalModel == null || cases == null) + { + return null; + } + + List result = []; + foreach (Cases cases_Temp in cases) + { + if (AnalyticalModels(analyticalModel, cases_Temp) is not List analyticalModels) + { + continue; + } + + result.AddRange(analyticalModels); + } + + return result; + } + + } +} diff --git a/SAM/SAM.Analytical/Create/Aperture.cs b/SAM/SAM.Analytical/Create/Aperture.cs index 4c759afb3..921d86ab1 100644 --- a/SAM/SAM.Analytical/Create/Aperture.cs +++ b/SAM/SAM.Analytical/Create/Aperture.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System; namespace SAM.Analytical @@ -7,7 +10,7 @@ public static partial class Create { public static Aperture Aperture(this ApertureConstruction apertureConstruction, Face3D face3D) { - if(apertureConstruction == null || face3D == null || !face3D.IsValid()) + if (apertureConstruction == null || face3D == null || !face3D.IsValid()) { return null; } @@ -23,7 +26,7 @@ public static Aperture Aperture(this Aperture aperture, Face3D face3D, Guid? gui } Guid guid_Temp = aperture.Guid; - if(guid != null && guid.HasValue && guid.Value != Guid.Empty) + if (guid != null && guid.HasValue && guid.Value != Guid.Empty) { guid_Temp = guid.Value; } @@ -31,4 +34,4 @@ public static Aperture Aperture(this Aperture aperture, Face3D face3D, Guid? gui return new Aperture(guid_Temp, aperture, face3D); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/ApertureConstruction.cs b/SAM/SAM.Analytical/Create/ApertureConstruction.cs index f792a8439..2584912c9 100644 --- a/SAM/SAM.Analytical/Create/ApertureConstruction.cs +++ b/SAM/SAM.Analytical/Create/ApertureConstruction.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Analytical @@ -15,7 +18,7 @@ public static ApertureConstruction ApertureConstruction(Guid guid, string name, public static ApertureConstruction ApertureConstruction(ApertureType apertureType, string name, Construction paneConstruction, Construction frameConstruction = null) { - if(apertureType == ApertureType.Undefined || (paneConstruction == null && frameConstruction == null)) + if (apertureType == ApertureType.Undefined || (paneConstruction == null && frameConstruction == null)) { return null; } @@ -25,4 +28,4 @@ public static ApertureConstruction ApertureConstruction(ApertureType apertureTyp return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/Apertures.cs b/SAM/SAM.Analytical/Create/Apertures.cs index 3c56d73a4..3a54fb7d9 100644 --- a/SAM/SAM.Analytical/Create/Apertures.cs +++ b/SAM/SAM.Analytical/Create/Apertures.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; namespace SAM.Analytical @@ -33,4 +36,4 @@ public static List Apertures(this List geometry3Ds, Ap return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/Cases.cs b/SAM/SAM.Analytical/Create/Cases.cs new file mode 100644 index 000000000..12c1770c7 --- /dev/null +++ b/SAM/SAM.Analytical/Create/Cases.cs @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Analytical.Classes; +using System.Collections.Generic; + +namespace SAM.Analytical +{ + public static partial class Create + { + public static Cases Cases(IEnumerable cases) where T : Case + { + if (cases == null) + { + return null; + } + + List cases_Temp = []; + + foreach (T @case in cases) + { + if (@case is null) + { + continue; + } + + cases_Temp.Add(@case); + } + + return [.. cases_Temp]; + } + } +} diff --git a/SAM/SAM.Analytical/Create/Construction.cs b/SAM/SAM.Analytical/Create/Construction.cs index ac47aeeb4..9bb07e122 100644 --- a/SAM/SAM.Analytical/Create/Construction.cs +++ b/SAM/SAM.Analytical/Create/Construction.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -18,4 +21,4 @@ public static Construction Construction(ConstructionLibrary constructionLibrary, return new Construction(constructions.First(), destinationName); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/ConstructionLayers.cs b/SAM/SAM.Analytical/Create/ConstructionLayers.cs index 85185e628..8749e515b 100644 --- a/SAM/SAM.Analytical/Create/ConstructionLayers.cs +++ b/SAM/SAM.Analytical/Create/ConstructionLayers.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -11,7 +14,7 @@ public static List ConstructionLayers(params object[] values) List names = new List(); List thicknesses = new List(); - foreach(object @object in values) + foreach (object @object in values) { if (@object is string) names.Add((string)@object); @@ -29,4 +32,4 @@ public static List ConstructionLayers(params object[] values) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/ConstructionLibrary.cs b/SAM/SAM.Analytical/Create/ConstructionLibrary.cs index da6c251a8..073ca305b 100644 --- a/SAM/SAM.Analytical/Create/ConstructionLibrary.cs +++ b/SAM/SAM.Analytical/Create/ConstructionLibrary.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Linq; namespace SAM.Analytical @@ -17,14 +20,14 @@ public static ConstructionLibrary ConstructionLibrary(this ConstructionLibrary c int index_Destination = delimitedFileTable.GetColumnIndex(columnName_Destination); ConstructionLibrary result = new ConstructionLibrary(constructionLibrary.Name); - for(int i =0; i < delimitedFileTable.RowCount; i++) + for (int i = 0; i < delimitedFileTable.RowCount; i++) { string name_Template = delimitedFileTable.ToString(i, index_Source); if (string.IsNullOrWhiteSpace(name_Template)) continue; string name_Destination = name_Template; - if(index_Destination != -1) + if (index_Destination != -1) name_Destination = delimitedFileTable.ToString(i, index_Destination); if (string.IsNullOrWhiteSpace(name_Destination)) @@ -43,4 +46,4 @@ public static ConstructionLibrary ConstructionLibrary(this ConstructionLibrary c return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/ConstructionManager.cs b/SAM/SAM.Analytical/Create/ConstructionManager.cs index 84d9ed55b..ffa4b502c 100644 --- a/SAM/SAM.Analytical/Create/ConstructionManager.cs +++ b/SAM/SAM.Analytical/Create/ConstructionManager.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System; using System.Collections.Generic; @@ -9,7 +12,7 @@ public static partial class Create public static ConstructionManager ConstructionManager(this AnalyticalModel analyticalModel) { AdjacencyCluster adjacencyCluster = analyticalModel?.AdjacencyCluster; - if(adjacencyCluster == null) + if (adjacencyCluster == null) { return null; } @@ -27,11 +30,11 @@ public static ConstructionManager ConstructionManager(ConstructionManager constr { ConstructionManager result = constructionManager == null ? new ConstructionManager() : new ConstructionManager(constructionManager); - if(constructionDictionary != null) + if (constructionDictionary != null) { - foreach(KeyValuePair keyValuePair in constructionDictionary) + foreach (KeyValuePair keyValuePair in constructionDictionary) { - if(keyValuePair.Value == null) + if (keyValuePair.Value == null) { continue; } @@ -39,7 +42,7 @@ public static ConstructionManager ConstructionManager(ConstructionManager constr result.GetConstructions(keyValuePair.Key)?.ForEach(x => result.Remove(x)); Construction construction = keyValuePair.Value; - if(construction != null) + if (construction != null) { result.Add(new Construction(construction, System.Guid.NewGuid()), keyValuePair.Key); } @@ -48,7 +51,7 @@ public static ConstructionManager ConstructionManager(ConstructionManager constr if (apertureConctructionDictionary != null) { - foreach (KeyValuePair, ApertureConstruction> keyValuePair in apertureConctructionDictionary) + foreach (KeyValuePair, ApertureConstruction> keyValuePair in apertureConctructionDictionary) { if (keyValuePair.Value == null) { @@ -56,23 +59,23 @@ public static ConstructionManager ConstructionManager(ConstructionManager constr } result.GetApertureConstructions(keyValuePair.Value.ApertureType, keyValuePair.Key.Item1)?.ForEach(x => result.Remove(x)); - + ApertureConstruction apertureConstruction = keyValuePair.Value; if (apertureConstruction != null) { ApertureConstruction apertureConstruction_Temp = new ApertureConstruction(Guid.NewGuid(), apertureConstruction, apertureConstruction.Name); apertureConstruction_Temp = new ApertureConstruction(apertureConstruction_Temp, keyValuePair.Key.Item2); result.Add(apertureConstruction_Temp, keyValuePair.Key.Item1); - + } } } - if(materials != null) + if (materials != null) { - foreach(IMaterial material in materials) + foreach (IMaterial material in materials) { - if(material == null) + if (material == null) { continue; } @@ -84,4 +87,4 @@ public static ConstructionManager ConstructionManager(ConstructionManager constr return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/CoolingSystemType.cs b/SAM/SAM.Analytical/Create/CoolingSystemType.cs index 851448354..77decac2d 100644 --- a/SAM/SAM.Analytical/Create/CoolingSystemType.cs +++ b/SAM/SAM.Analytical/Create/CoolingSystemType.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Create { @@ -27,4 +30,4 @@ public static CoolingSystemType CoolingSystemType(System.Guid guid, string name, return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/DegreeOfActivity.cs b/SAM/SAM.Analytical/Create/DegreeOfActivity.cs index 520d0d54d..185b0154f 100644 --- a/SAM/SAM.Analytical/Create/DegreeOfActivity.cs +++ b/SAM/SAM.Analytical/Create/DegreeOfActivity.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Create { @@ -23,7 +26,7 @@ public static DegreeOfActivity DegreeOfActivity(this ActivityLevel activityLevel if (temperature > 28) temperature = 28; - switch(activityLevel) + switch (activityLevel) { case ActivityLevel.First: senisble = 161 - (3.8 * temperature); @@ -54,4 +57,4 @@ public static DegreeOfActivity DegreeOfActivity(this ActivityLevel activityLevel return new DegreeOfActivity(name, senisble, latent); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/DesignDay.cs b/SAM/SAM.Analytical/Create/DesignDay.cs index ce56bba0b..099729885 100644 --- a/SAM/SAM.Analytical/Create/DesignDay.cs +++ b/SAM/SAM.Analytical/Create/DesignDay.cs @@ -1,4 +1,7 @@ -using SAM.Weather; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Weather; namespace SAM.Analytical { @@ -6,19 +9,19 @@ public static partial class Create { public static DesignDay DesignDay(string name, string description, short year, byte month, byte day, WeatherDay weatherDay) { - if(year < 0) + if (year < 0) { return null; } - if(month < 1 || month > 12) + if (month < 1 || month > 12) { return null; } DesignDay result = new DesignDay(name, description, year, month, day); - - if(weatherDay != null) + + if (weatherDay != null) { foreach (string key in weatherDay.Keys) { @@ -29,4 +32,4 @@ public static DesignDay DesignDay(string name, string description, short year, b return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/Emitter.cs b/SAM/SAM.Analytical/Create/Emitter.cs index fa5167a6d..546927080 100644 --- a/SAM/SAM.Analytical/Create/Emitter.cs +++ b/SAM/SAM.Analytical/Create/Emitter.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Create { @@ -15,8 +18,8 @@ public static Emitter Emitter(this EmitterType emitterType) double radiantProportion = double.NaN; double viewCoefficient = double.NaN; System.Guid guid = System.Guid.Empty; - - switch(emitterType) + + switch (emitterType) { case EmitterType.WarmAirHeater: radiantProportion = 0; @@ -146,4 +149,4 @@ public static Emitter Emitter(this EmitterType emitterType) return new Emitter(guid, emitterType.Text(), emitterType.EmitterCategory(), radiantProportion, viewCoefficient); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/GasMaterial.cs b/SAM/SAM.Analytical/Create/GasMaterial.cs index d7c2ae7af..fab2f6b29 100644 --- a/SAM/SAM.Analytical/Create/GasMaterial.cs +++ b/SAM/SAM.Analytical/Create/GasMaterial.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Analytical { @@ -16,7 +19,7 @@ public static GasMaterial GasMaterial(string name, string group, string displayN public static GasMaterial GasMaterial(string name, string group, string displayName, string description, double thermalConductivity, double specificHeatCapacity, double density, double dynamicViscosity, double defaultThickness, double vapourDiffusionFactor, double heatTransferCoefficient, DefaultGasType defaultGasType) { - GasMaterial gasMaterial = GasMaterial(name, group, displayName, description, thermalConductivity,specificHeatCapacity, density,dynamicViscosity, defaultThickness, vapourDiffusionFactor, heatTransferCoefficient); + GasMaterial gasMaterial = GasMaterial(name, group, displayName, description, thermalConductivity, specificHeatCapacity, density, dynamicViscosity, defaultThickness, vapourDiffusionFactor, heatTransferCoefficient); gasMaterial.SetValue(GasMaterialParameter.DefaultGasType, defaultGasType.Description()); return gasMaterial; @@ -26,12 +29,12 @@ public static GasMaterial GasMaterial(this GasMaterial gasMaterial, string name, { if (gasMaterial == null) return null; - + GasMaterial result = new GasMaterial(name, System.Guid.NewGuid(), gasMaterial, displayName, description); result.SetValue(Core.MaterialParameter.DefaultThickness, defaultThickness); result.SetValue(GasMaterialParameter.HeatTransferCoefficient, heatTransferCoefficient); - if(gasMaterial.TryGetValue(GasMaterialParameter.DefaultGasType, out string defaultGasType) && !string.IsNullOrWhiteSpace(defaultGasType)) + if (gasMaterial.TryGetValue(GasMaterialParameter.DefaultGasType, out string defaultGasType) && !string.IsNullOrWhiteSpace(defaultGasType)) { gasMaterial.SetValue(GasMaterialParameter.DefaultGasType, defaultGasType); } @@ -39,4 +42,4 @@ public static GasMaterial GasMaterial(this GasMaterial gasMaterial, string name, return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/HeatingSystemType.cs b/SAM/SAM.Analytical/Create/HeatingSystemType.cs index 3d210ec90..5341d6287 100644 --- a/SAM/SAM.Analytical/Create/HeatingSystemType.cs +++ b/SAM/SAM.Analytical/Create/HeatingSystemType.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Create { @@ -21,4 +24,4 @@ public static HeatingSystemType HeatingSystemType(System.Guid guid, string name, return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/Id.cs b/SAM/SAM.Analytical/Create/Id.cs index 9d204eb61..1d67cd298 100644 --- a/SAM/SAM.Analytical/Create/Id.cs +++ b/SAM/SAM.Analytical/Create/Id.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -6,7 +9,7 @@ public static partial class Create { public static string Id(this AdjacencyCluster adjacencyCluster, MechanicalSystemType mechanicalSystemType) { - if(adjacencyCluster == null || mechanicalSystemType == null) + if (adjacencyCluster == null || mechanicalSystemType == null) { return null; } @@ -28,4 +31,4 @@ public static string Id(this AdjacencyCluster adjacencyCluster, MechanicalSystem return index.ToString(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/InternalCondition.cs b/SAM/SAM.Analytical/Create/InternalCondition.cs index 97a8246e2..4ce39e9b4 100644 --- a/SAM/SAM.Analytical/Create/InternalCondition.cs +++ b/SAM/SAM.Analytical/Create/InternalCondition.cs @@ -1,9 +1,12 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Create { public static InternalCondition InternalCondition( - string name, + string name, double areaPerPerson, string occupancyProfileName, double equipmentSensibleGain, @@ -69,7 +72,7 @@ string dehumidificationProfileName public static InternalCondition InternalCondition(string name) { - if(string.IsNullOrWhiteSpace(name)) + if (string.IsNullOrWhiteSpace(name)) { return null; } @@ -88,4 +91,4 @@ public static InternalCondition InternalCondition(string name) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/Levels.cs b/SAM/SAM.Analytical/Create/Levels.cs index 1775d2e5f..bc0ffd90a 100644 --- a/SAM/SAM.Analytical/Create/Levels.cs +++ b/SAM/SAM.Analytical/Create/Levels.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -7,7 +10,7 @@ public static partial class Create public static List Levels(this AdjacencyCluster adjacencyCluster, bool includeOtherPanels = false, double tolerance = Core.Tolerance.MacroDistance) { List panels = adjacencyCluster?.GetPanels(); - if(panels == null) + if (panels == null) { return null; } @@ -16,8 +19,8 @@ public static partial class Create { panels.RemoveAll(x => x.PanelType == PanelType.Air || x.PanelType.PanelGroup() == PanelGroup.Other); } - + return Architectural.Create.Levels(panels, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/Log.cs b/SAM/SAM.Analytical/Create/Log.cs index 2bedf1d29..492a1e500 100644 --- a/SAM/SAM.Analytical/Create/Log.cs +++ b/SAM/SAM.Analytical/Create/Log.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -30,15 +33,15 @@ public static Log Log(this AdjacencyCluster adjacencyCluster) } else { - foreach(Panel panel in panels) + foreach (Panel panel in panels) { Core.Modify.AddRange(result, panel?.Log()); List apertures = panel.Apertures; - if(apertures != null && apertures.Count != 0) + if (apertures != null && apertures.Count != 0) { PanelGroup panelGroup_Panel = panel.PanelType.PanelGroup(); - if(panelGroup_Panel != PanelGroup.Undefined) + if (panelGroup_Panel != PanelGroup.Undefined) { foreach (Aperture aperture in apertures) { @@ -47,13 +50,13 @@ public static Log Log(this AdjacencyCluster adjacencyCluster) continue; PanelGroup panelGroup_ApertureConstruction = apertureConstruction.PanelType().PanelGroup(); - if(panelGroup_ApertureConstruction != PanelGroup.Undefined) + if (panelGroup_ApertureConstruction != PanelGroup.Undefined) { string apertureName = aperture.Name; - if(string.IsNullOrEmpty(apertureName)) + if (string.IsNullOrEmpty(apertureName)) apertureName = "???"; - string apertureConstructionName= apertureConstruction.Name; + string apertureConstructionName = apertureConstruction.Name; if (string.IsNullOrEmpty(apertureConstructionName)) apertureConstructionName = "???"; @@ -62,14 +65,14 @@ public static Log Log(this AdjacencyCluster adjacencyCluster) } } } - + } if (spaces != null && spaces.Count != 0) { List spaces_Panel = adjacencyCluster.GetRelatedObjects(panel); - if(spaces_Panel != null && spaces_Panel.Count != 0) + if (spaces_Panel != null && spaces_Panel.Count != 0) { PanelType panelType = panel.PanelType; switch (panelType) @@ -111,24 +114,24 @@ public static Log Log(this AdjacencyCluster adjacencyCluster) } HashSet spaceNames = new HashSet(); - foreach(Space space in spaces) + foreach (Space space in spaces) { Core.Modify.AddRange(result, space?.Log()); Shell shell = adjacencyCluster.Shell(space); - if(shell == null || !shell.IsClosed()) + if (shell == null || !shell.IsClosed()) { result.Add("Space {0} (Guid: {1}) is not enclosed (with 1e-6 tolerance).", LogRecordType.Warning, space.Name, space.Guid); continue; } - if(space.Location == null) + if (space.Location == null) { result.Add("Space {0} (Guid: {1}) has no location.", LogRecordType.Warning, space.Name, space.Guid); continue; } - if(space.Name != null) + if (space.Name != null) { if (spaceNames.Contains(space.Name)) { @@ -140,17 +143,17 @@ public static Log Log(this AdjacencyCluster adjacencyCluster) } List panels_Space = adjacencyCluster.GetPanels(space); - if(panels_Space == null || panels_Space.Count == 0) + if (panels_Space == null || panels_Space.Count == 0) { result.Add("Space {0} (Guid: {1}) is not enclosed.", LogRecordType.Warning, space.Name, space.Guid); continue; } - if(panels_Space.Count < 4) + if (panels_Space.Count < 4) result.Add("Space {0} (Guid: {1}) has less than 4 panels.", LogRecordType.Message, space.Name, space.Guid); Panel panel_Floor = panels_Space.Find(x => Query.PanelGroup(x.PanelType) == PanelGroup.Floor); - if(panel_Floor == null) + if (panel_Floor == null) { Panel panel_Air = panels_Space.Find(x => x.PanelType == PanelType.Air); if (panel_Air != null) @@ -159,12 +162,12 @@ public static Log Log(this AdjacencyCluster adjacencyCluster) result.Add("Space {0} (Guid: {1}) has no floor panels and air panels.", LogRecordType.Message, space.Name, space.Guid); } - foreach(Panel panel in panels_Space) + foreach (Panel panel in panels_Space) { if (panel == null) continue; - if(panel.PanelType == PanelType.Shade || panel.PanelType == PanelType.SolarPanel || panel.PanelType == PanelType.Undefined) + if (panel.PanelType == PanelType.Shade || panel.PanelType == PanelType.SolarPanel || panel.PanelType == PanelType.Undefined) { result.Add("Panel {0} (Guid: {1}) has assigned {2} PanelType and it also encloses {3} space (Guid: {4}).", LogRecordType.Warning, panel.Name, panel.Guid, panel.PanelType, space.Name, space.Guid); return result; @@ -173,9 +176,9 @@ public static Log Log(this AdjacencyCluster adjacencyCluster) } Dictionary> dictionary = Query.DuplicatedSpacesDictionary(adjacencyCluster); - if(dictionary != null && dictionary.Count > 0) + if (dictionary != null && dictionary.Count > 0) { - foreach(List spaces_Duplicated in dictionary.Values) + foreach (List spaces_Duplicated in dictionary.Values) { List names = spaces_Duplicated.ConvertAll(x => x?.Name); for (int i = 0; i < names.Count; i++) @@ -189,13 +192,13 @@ public static Log Log(this AdjacencyCluster adjacencyCluster) } List constructions = adjacencyCluster.GetConstructions(); - if(constructions == null || constructions.Count == 0) + if (constructions == null || constructions.Count == 0) { result.Add("Panels in AdjacencyCluster has no constructions assigned.", LogRecordType.Error); } else { - foreach(Construction construction in constructions) + foreach (Construction construction in constructions) Core.Modify.AddRange(result, construction?.Log()); } @@ -221,12 +224,12 @@ public static Log Log(this AnalyticalModel analyticalModel) ProfileLibrary profileLibrary = analyticalModel.ProfileLibrary; - if(adjacencyCluster == null) + if (adjacencyCluster == null) result.Add("AdjacencyCluster missing in AnalyticalModel", LogRecordType.Error); else Core.Modify.AddRange(result, adjacencyCluster?.Log()); - if(materialLibrary == null) + if (materialLibrary == null) result.Add("MaterialLibrary missing in AnalyticalModel", LogRecordType.Error); else Core.Modify.AddRange(result, materialLibrary.Log()); @@ -240,9 +243,9 @@ public static Log Log(this AnalyticalModel analyticalModel) if (adjacencyCluster != null) { List constructions = adjacencyCluster.GetConstructions(); - if(constructions != null && materialLibrary != null) + if (constructions != null && materialLibrary != null) { - foreach(Construction construction in constructions) + foreach (Construction construction in constructions) Core.Modify.AddRange(result, construction?.Log(materialLibrary)); } @@ -254,14 +257,14 @@ public static Log Log(this AnalyticalModel analyticalModel) } List panels = adjacencyCluster.GetPanels(); - if(panels != null && panels.Count != 0) + if (panels != null && panels.Count != 0) { foreach (Panel panel in panels) Core.Modify.AddRange(result, panel?.Log(materialLibrary)); } List spaces = adjacencyCluster.GetSpaces(); - if(spaces != null && spaces.Count != 0) + if (spaces != null && spaces.Count != 0) { foreach (Space space in spaces) Core.Modify.AddRange(result, space?.Log(profileLibrary)); @@ -280,13 +283,13 @@ public static Log Log(this MaterialLibrary materialLibrary) List materials = materialLibrary.GetMaterials(); - if(materials == null || materials.Count == 0) + if (materials == null || materials.Count == 0) { result.Add("Material Library has no Materials.", LogRecordType.Message); return result; } - - foreach(IMaterial material in materials) + + foreach (IMaterial material in materials) Core.Modify.AddRange(result, material?.Log()); return result; @@ -332,7 +335,7 @@ public static Log Log(this Construction construction) if (construction.TryGetValue(ConstructionParameter.DefaultPanelType, out text) && !string.IsNullOrWhiteSpace(text)) panelType = Query.PanelType(text, false); - if(panelType != PanelType.Air) + if (panelType != PanelType.Air) { List constructionLayers = construction?.ConstructionLayers; if (constructionLayers != null && constructionLayers.Count > 0) @@ -359,7 +362,7 @@ public static Log Log(this Construction construction, MaterialLibrary materialLi IMaterial material = null; material = materialLibrary.GetMaterial(constructionLayers.First()?.Name); - if(material is GasMaterial) + if (material is GasMaterial) { result.Add(string.Format("First construction layer (Name: {0}) for Construction (Name: {1} Guid: {2}) shall not be gas type", material.Name, construction.Name, construction.Guid), LogRecordType.Error); } @@ -372,12 +375,12 @@ public static Log Log(this Construction construction, MaterialLibrary materialLi } double thickness; - if(construction.TryGetValue(ConstructionParameter.DefaultThickness, out thickness)) + if (construction.TryGetValue(ConstructionParameter.DefaultThickness, out thickness)) { double thickness_ConstructionLayers = construction.GetThickness(); - if(!double.IsNaN(thickness_ConstructionLayers)) + if (!double.IsNaN(thickness_ConstructionLayers)) { - if(System.Math.Abs(thickness - thickness_ConstructionLayers) > Tolerance.MacroDistance) + if (System.Math.Abs(thickness - thickness_ConstructionLayers) > Tolerance.MacroDistance) { result.Add(string.Format("Parameter {0} in {1} Construction (Guid: {2}) has different value ({3}) than thickness of its ConstructionLayers ({4})", ConstructionParameter.DefaultThickness.Name(), construction.Name, construction.Guid, thickness, thickness_ConstructionLayers), LogRecordType.Message); } @@ -478,12 +481,12 @@ public static Log Log(this IMaterial material) Log result = new Log(); string name = material.Name; - if(string.IsNullOrWhiteSpace(name)) + if (string.IsNullOrWhiteSpace(name)) { result.Add(string.Format("Material (Guid: {0}) has no name assigned", material.Guid), LogRecordType.Warning); name = "???"; } - + if (material is GasMaterial) { @@ -516,7 +519,7 @@ public static Log Log(this IMaterial material) if (double.IsNaN(transparentMaterial.GetValue(TransparentMaterialParameter.SolarTransmittance))) result.Add(string.Format("Solar Transmittance for {0} Material (Guid: {1}) has invalid value", name, material.Guid), LogRecordType.Error); - + if (double.IsNaN(transparentMaterial.GetValue(TransparentMaterialParameter.LightTransmittance))) result.Add(string.Format("Light Transmittance for {0} Material (Guid: {1}) has invalid value", name, material.Guid), LogRecordType.Error); @@ -559,7 +562,7 @@ public static Log Log(this IMaterial material) if (double.IsNaN(opaqueMaterial.GetValue(OpaqueMaterialParameter.ExternalSolarReflectance))) result.Add(string.Format("External Solar Reflectance for {0} Material (Guid: {1}) has invalid value", name, material.Guid), LogRecordType.Error); - + if (double.IsNaN(opaqueMaterial.GetValue(OpaqueMaterialParameter.InternalSolarReflectance))) result.Add(string.Format("Internal Solar Reflectance for {0} Material (Guid: {1}) has invalid value", name, material.Guid), LogRecordType.Error); @@ -587,13 +590,13 @@ public static Log Log(this Panel panel) Log result = new Log(); string name = panel.Name; - if(string.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { if (panel.PanelType != PanelType.Air) { result.Add(string.Format("Panel (Guid: {1}) has no name.", name, panel.Guid), LogRecordType.Warning); name = "???"; - } + } else { name = "Air"; @@ -601,20 +604,20 @@ public static Log Log(this Panel panel) } PanelType panelType = panel.PanelType; - if(panelType == PanelType.Undefined) + if (panelType == PanelType.Undefined) result.Add(string.Format("Panel Type for {0} Panel (Guid: {1}) is not assigned.", name, panel.Guid), LogRecordType.Error); double area = double.NaN; - + PlanarBoundary3D planarBoundary3D = panel.PlanarBoundary3D; - if(planarBoundary3D == null) + if (planarBoundary3D == null) { result.Add(string.Format("{0} Panel (Guid: {1}) has no geometry assigned.", name, panel.Guid), LogRecordType.Error); } else { area = panel.GetArea(); - if(double.IsNaN(area) || area < Tolerance.MacroDistance) + if (double.IsNaN(area) || area < Tolerance.MacroDistance) result.Add(string.Format("{0} Panel (Guid: {1}) area is less than {2}.", name, panel.Guid, Tolerance.MacroDistance), LogRecordType.Warning); } @@ -622,12 +625,12 @@ public static Log Log(this Panel panel) bool adiabatic = panel.Adiabatic(); Construction construction = panel.Construction; - if(construction == null) + if (construction == null) { if (panelType != PanelType.Air) result.Add(string.Format("{0} Panel (Guid: {1}) has no construction assigned.", name, panel.Guid), LogRecordType.Error); } - else if(panelType != PanelType.Shade && !adiabatic) + else if (panelType != PanelType.Shade && !adiabatic) { PanelGroup panelGroup_Construction = construction.PanelType().PanelGroup(); if (panelGroup_Construction != PanelGroup.Undefined) @@ -646,18 +649,18 @@ public static Log Log(this Panel panel) } List apertures = panel.Apertures; - if(apertures != null && apertures.Count > 0) + if (apertures != null && apertures.Count > 0) { - if(panelType == PanelType.Air) + if (panelType == PanelType.Air) result.Add(string.Format("{0} Panel (Guid: {1}) with PanelType Air hosts Apertures", name, panel.Guid), LogRecordType.Error); - + double area_Apertures = 0; - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { string name_Aperture = aperture.Name; if (string.IsNullOrWhiteSpace(name_Aperture)) name_Aperture = "???"; - + Core.Modify.AddRange(result, aperture?.Log()); double area_Aperture = aperture.GetArea(); @@ -673,23 +676,23 @@ public static Log Log(this Panel panel) result.Add(string.Format("Geometry of {0} aperture (Guid: {1}) is invalid for {2} host panel (Guid: {3})", name_Aperture, aperture.Guid, name, panel.Guid), LogRecordType.Error); ApertureConstruction apertureConstruction = aperture.ApertureConstruction; - if(apertureConstruction == null) + if (apertureConstruction == null) { result.Add(string.Format("{0} aperture (Guid: {1}) in {2} host panel (Guid: {3}) has no ApertureConstruction", name_Aperture, aperture.Guid, name, panel.Guid), LogRecordType.Error); } - else if(!adiabatic) + else if (!adiabatic) { string text; if (apertureConstruction.TryGetValue(ApertureConstructionParameter.DefaultPanelType, out text) && !string.IsNullOrWhiteSpace(text)) { PanelType panelType_ApertureConstruction = Query.PanelType(text, false); - if(panelType_ApertureConstruction != PanelType.Undefined && panelType_ApertureConstruction.PanelGroup() != panelType.PanelGroup()) + if (panelType_ApertureConstruction != PanelType.Undefined && panelType_ApertureConstruction.PanelGroup() != panelType.PanelGroup()) result.Add(string.Format("ApertureConstruction for {0} aperture (Guid: {1}) has diiferent Default Panel Type than its {2} host panel (Guid: {3}) has ", name_Aperture, aperture.Guid, name, panel.Guid), LogRecordType.Warning); } } } - if(!double.IsNaN(area) && area < area_Apertures) + if (!double.IsNaN(area) && area < area_Apertures) result.Add(string.Format("Overall area of apertures is greater than {0} panel (Guid: {1}) area", name, panel.Guid), LogRecordType.Error); } @@ -718,7 +721,7 @@ public static Log Log(this Panel panel, MaterialLibrary materialLibrary) Log result = new Log(); Construction construction = panel.Construction; - if(construction != null) + if (construction != null) { string name_Construction = panel.Construction.Name; if (string.IsNullOrWhiteSpace(name_Construction)) @@ -728,14 +731,14 @@ public static Log Log(this Panel panel, MaterialLibrary materialLibrary) if (materialType != MaterialType.Undefined) { bool transparent; - if(panel.TryGetValue(PanelParameter.Transparent, out transparent)) + if (panel.TryGetValue(PanelParameter.Transparent, out transparent)) { if ((transparent && materialType != MaterialType.Transparent) || (!transparent && materialType == MaterialType.Transparent)) result.Add(string.Format("{0} parameter value for {1} panel (Guid: {2}) does not match witch assigned {3} construction (Guid: {4})", PanelParameter.Transparent.Name(), name, panel.Guid, name_Construction, construction.Guid), LogRecordType.Warning); } PanelType panelType = panel.PanelType; - if(panelType == PanelType.CurtainWall && materialType != MaterialType.Transparent) + if (panelType == PanelType.CurtainWall && materialType != MaterialType.Transparent) result.Add(string.Format("Assigned {3} construction (Guid: {4}) to {1} Courtain Wall panel (Guid: {2}) is not Transparent", PanelParameter.Transparent.Name(), name, panel.Guid, name_Construction, construction.Guid), LogRecordType.Warning); } @@ -776,7 +779,7 @@ public static Log Log(this Aperture aperture) ApertureConstruction apertureConstruction = aperture.ApertureConstruction; - if(apertureConstruction == null) + if (apertureConstruction == null) result.Add(string.Format("{0} Aperture (Guid: {1}) has no ApertureConstruction assigned.", name, aperture.Guid), LogRecordType.Error); return result; @@ -796,18 +799,18 @@ public static Log Log(this Space space) name = "???"; } - if(!space.TryGetValue(SpaceParameter.Area, out double area) || double.IsNaN(area)) + if (!space.TryGetValue(SpaceParameter.Area, out double area) || double.IsNaN(area)) { result.Add(string.Format("Space (Guid: {1}) has no area assigned.", name, space.Guid), LogRecordType.Error); } - if(Core.Query.AlmostEqual(area, 0, Tolerance.MacroDistance)) + if (Core.Query.AlmostEqual(area, 0, Tolerance.MacroDistance)) { result.Add(string.Format("Space (Guid: {1}) has assigned area almost equal to 0.", name, space.Guid), LogRecordType.Error); } InternalCondition internalCondition = space.InternalCondition; - if(internalCondition == null) + if (internalCondition == null) result.Add(string.Format("{0} Space (Guid: {1}) has no InternalCondition assigned.", name, space.Guid), LogRecordType.Warning); return result; @@ -834,7 +837,7 @@ public static Log Log(this Space space, ProfileLibrary profileLibrary) continue; } - switch(profileType) + switch (profileType) { case ProfileType.Ventilation: if (internalCondition.TryGetValue(InternalConditionParameter.VentilationSystemTypeName, out string ventilationSystemTypeName)) @@ -881,7 +884,7 @@ public static Log Log(this InternalCondition internalCondition, ProfileLibrary p Log result = new Log(); - foreach(ProfileType profileType in Enum.GetValues(typeof(ProfileType))) + foreach (ProfileType profileType in Enum.GetValues(typeof(ProfileType))) { if (profileType == ProfileType.Undefined || profileType == ProfileType.Other) continue; @@ -912,7 +915,7 @@ public static Log Log(this InternalCondition internalCondition, ProfileLibrary p case ProfileType.Cooling: if (internalCondition.TryGetValue(InternalConditionParameter.CoolingSystemTypeName, out string coolingSystemTypeName)) { - if(coolingSystemTypeName == "UC") + if (coolingSystemTypeName == "UC") { double coolingDesignTemperature = Query.CoolingDesignTemperature(internalCondition, profileLibrary); if (coolingDesignTemperature <= 50) @@ -947,7 +950,7 @@ public static Log Log(this InternalCondition internalCondition, ProfileLibrary p if (double.IsNaN(value_1) && double.IsNaN(value_2) && profile != null && !profile.IsOff()) result.Add("{0} InternalCondition (Guid: {1}) has {2} {3} (Guid: {4}) assigned but Equipment Latent Gain or Equipment Latent Gain Per Area have not been provided.", LogRecordType.Warning, name, internalCondition.Guid, profileName, profileType.Text(), profile.Guid); - else if((!double.IsNaN(value_1) || !double.IsNaN(value_2)) && profile == null) + else if ((!double.IsNaN(value_1) || !double.IsNaN(value_2)) && profile == null) result.Add("{0} InternalCondition (Guid: {1}) has no {2} assigned but Equipment Latent Gain or Equipment Latent Gain Per Area has been provided.", LogRecordType.Warning, name, internalCondition.Guid, profileType.Text()); break; @@ -972,9 +975,9 @@ public static Log Log(this InternalCondition internalCondition, ProfileLibrary p if (!internalCondition.TryGetValue(InternalConditionParameter.InfiltrationAirChangesPerHour, out value_1)) value_1 = double.NaN; - if(double.IsNaN(value_1) && profile != null && !profile.IsOff()) + if (double.IsNaN(value_1) && profile != null && !profile.IsOff()) result.Add("{0} InternalCondition (Guid: {1}) has {2} {3} (Guid: {4}) assigned but Infiltration Air Changes Per Hour has not been provided.", LogRecordType.Warning, name, internalCondition.Guid, profileName, profileType.Text(), profile.Guid); - else if(!double.IsNaN(value_1) && profile == null) + else if (!double.IsNaN(value_1) && profile == null) result.Add("{0} InternalCondition (Guid: {1}) has no {2} assigned but Infiltration Air Changes Per Hour has been provided.", LogRecordType.Warning, name, internalCondition.Guid, profileType.Text()); break; @@ -1050,13 +1053,13 @@ private static Log Log(this IEnumerable constructionLayers, M if (material == null) result.Add(string.Format("Material Library does not contain Material {0} for {1} (Guid: {2}) (Construction Layer Index: {3})", constructionLayer.Name, name_Temp, guid, index), LogRecordType.Error); - if(material is GasMaterial) + if (material is GasMaterial) { GasMaterial gasMaterial = (GasMaterial)material; DefaultGasType defaultGasType = Query.DefaultGasType(gasMaterial); - if(defaultGasType == DefaultGasType.Undefined) + if (defaultGasType == DefaultGasType.Undefined) result.Add(string.Format("{0} gas material is not recogionzed in {1} (Guid: {2}) (Construction Layer Index: {3}). Heat Transfer Coefficient may not be calculated properly.", constructionLayer.Name, name_Temp, guid, index), LogRecordType.Warning); - else if(materialType == MaterialType.Opaque && defaultGasType != DefaultGasType.Air) + else if (materialType == MaterialType.Opaque && defaultGasType != DefaultGasType.Air) result.Add(string.Format("{0} Construction Layer for Opaque {1} (Guid: {2}) (Construction Layer Index: {3}) in not recognized as air type. Heat Transfer Coefficient may not be calculated properly.", constructionLayer.Name, name_Temp, guid, index), LogRecordType.Warning); if (defaultGasType != DefaultGasType.Undefined) @@ -1095,4 +1098,4 @@ private static Log Log(this IEnumerable constructionLayers, s return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/MaterialLibrary.cs b/SAM/SAM.Analytical/Create/MaterialLibrary.cs index e709c7b95..4d047eadf 100644 --- a/SAM/SAM.Analytical/Create/MaterialLibrary.cs +++ b/SAM/SAM.Analytical/Create/MaterialLibrary.cs @@ -1,17 +1,20 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Analytical { public static partial class Create { public static MaterialLibrary MaterialLibrary( - string path, + string path, string parameterName_Type, string parameterName_Name, - string parameterName_Description, - string parameterName_DefaultThickness, - string parameterName_ThermalConductivity, - string parameterName_SpecificHeatCapacity, + string parameterName_Description, + string parameterName_DefaultThickness, + string parameterName_ThermalConductivity, + string parameterName_SpecificHeatCapacity, string parameterName_Density, string parameterName_VapourDiffusionFactor, string parameterName_ExternalSolarReflectance, @@ -26,8 +29,8 @@ public static MaterialLibrary MaterialLibrary( string parameterName_IsBlind, string parameterName_HeatTransferCoefficient, string parameterName_DynamicViscosity, - string name = null, - int namesIndex = 0, + string name = null, + int namesIndex = 0, int headerCount = 7) { if (string.IsNullOrWhiteSpace(path) || !System.IO.File.Exists(path)) @@ -222,4 +225,4 @@ public static MaterialLibrary MaterialLibrary( return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/MechanicalSystem.cs b/SAM/SAM.Analytical/Create/MechanicalSystem.cs index 6f87b24d7..14a13bfcf 100644 --- a/SAM/SAM.Analytical/Create/MechanicalSystem.cs +++ b/SAM/SAM.Analytical/Create/MechanicalSystem.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Create { @@ -35,4 +38,4 @@ public static MechanicalSystem MechanicalSystem(MechanicalSystemType mechanicalS return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/New/BuildingModel.cs b/SAM/SAM.Analytical/Create/New/BuildingModel.cs index 1d3542520..efd6d4a92 100644 --- a/SAM/SAM.Analytical/Create/New/BuildingModel.cs +++ b/SAM/SAM.Analytical/Create/New/BuildingModel.cs @@ -1,4 +1,8 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Architectural; +using SAM.Core; using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System; @@ -6,8 +10,6 @@ using System.Linq; using System.Threading.Tasks; -using SAM.Architectural; - namespace SAM.Analytical { public static partial class Create @@ -73,7 +75,7 @@ public static BuildingModel BuildingModel(this IEnumerable segme if (polygon3D_Min != null) { IHostPartition hostPartition = HostPartition(new Face3D(polygon3D_Min), null, tolerance_Angle); - if(hostPartition != null) + if (hostPartition != null) { dictionary[space].Add(hostPartition); } @@ -106,7 +108,7 @@ public static BuildingModel BuildingModel(this IEnumerable segme } } - foreach(KeyValuePair> keyValuePair in dictionary) + foreach (KeyValuePair> keyValuePair in dictionary) { result.Add(keyValuePair.Key, keyValuePair.Value); } @@ -233,7 +235,7 @@ public static BuildingModel BuildingModel(this IEnumerable face3Ds, doub public static BuildingModel BuildingModel(this IEnumerable shells, IEnumerable partitions, double groundElevation = 0, bool addMissingPartitions = true, MaterialLibrary materialLibrary = null, double thinnessRatio = 0.01, double minArea = Tolerance.MacroDistance, double maxDistance = 0.1, double maxAngle = 0.0872664626, double silverSpacing = Tolerance.MacroDistance, double tolerance_Distance = Tolerance.Distance, double tolerance_Angle = Tolerance.Angle) { - if(shells == null && partitions == null) + if (shells == null && partitions == null) { return null; } @@ -241,7 +243,7 @@ public static BuildingModel BuildingModel(this IEnumerable shells, IEnume List>> tuples = new List>>(); List> tuples_Partition = new List>(); - if(partitions != null) + if (partitions != null) { foreach (IPartition partition in partitions) { @@ -299,13 +301,13 @@ public static BuildingModel BuildingModel(this IEnumerable shells, IEnume } Shell shell_FixEdges = shell_Merge.FixEdges(tolerance_Distance); - if(shell_FixEdges == null) + if (shell_FixEdges == null) { shell_FixEdges = new Shell(shell_Merge); } Shell shell_CutFace3D = shell_FixEdges.CutFace3Ds(plane_Ground); - if(shell_CutFace3D == null) + if (shell_CutFace3D == null) { shell_CutFace3D = new Shell(shell_FixEdges); } @@ -394,7 +396,7 @@ public static BuildingModel BuildingModel(this IEnumerable shells, IEnume tuples.Add(tuple); List> tuples_hostPartition_Temp = tuples_Partition.FindAll(x => boundingBox3D_Shell.InRange(x.Item4, tolerance_Distance)); - + foreach (Face3D face3D in face3Ds) { Plane plane = face3D?.GetPlane(); @@ -527,21 +529,21 @@ public static BuildingModel BuildingModel(this IEnumerable shells, IEnume } partition_New = Partition(partition_New_Temp, guid, face3D, tolerance_Distance); - if(partition_New == null) + if (partition_New == null) { continue; } - if(partitions_New_Temp.Count > 1 && partition_New is IHostPartition) + if (partitions_New_Temp.Count > 1 && partition_New is IHostPartition) { partitions_New_Temp.RemoveAt(0); IHostPartition hostPartition_New = (IHostPartition)partition_New; - foreach(IPartition partition in partitions_New_Temp) + foreach (IPartition partition in partitions_New_Temp) { List openings = (partition as IHostPartition)?.GetOpenings(); - if(openings == null || openings.Count == 0) + if (openings == null || openings.Count == 0) { continue; } @@ -561,7 +563,7 @@ public static BuildingModel BuildingModel(this IEnumerable shells, IEnume partition_New = new AirPartition(face3D); } - if(partition_New != null) + if (partition_New != null) { tuple.Item2.Add(partition_New); tuples_Partition_New.Add(new Tuple(point3D_Internal, partition_New, partition_New.Face3D.GetBoundingBox(tolerance_Distance))); @@ -581,4 +583,4 @@ public static BuildingModel BuildingModel(this IEnumerable shells, IEnume return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/New/HostPartition.cs b/SAM/SAM.Analytical/Create/New/HostPartition.cs index 71fbb4020..8b7c1298c 100644 --- a/SAM/SAM.Analytical/Create/New/HostPartition.cs +++ b/SAM/SAM.Analytical/Create/New/HostPartition.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Analytical { @@ -6,12 +9,12 @@ public static partial class Create { public static IHostPartition HostPartition(this Face3D face3D, HostPartitionType hostPartitionType = null, double tolerance = Core.Tolerance.Angle) { - if(face3D == null || !face3D.IsValid()) + if (face3D == null || !face3D.IsValid()) { return null; } - if(hostPartitionType == null) + if (hostPartitionType == null) { hostPartitionType = Query.DefaultHostPartitionType(face3D, tolerance); } @@ -21,12 +24,12 @@ public static IHostPartition HostPartition(this Face3D face3D, HostPartitionType return new Wall((WallType)hostPartitionType, face3D); } - if(hostPartitionType is RoofType) + if (hostPartitionType is RoofType) { return new Roof((RoofType)hostPartitionType, face3D); } - if(hostPartitionType is FloorType) + if (hostPartitionType is FloorType) { return new Floor((FloorType)hostPartitionType, face3D); } diff --git a/SAM/SAM.Analytical/Create/New/HostPartitionType.cs b/SAM/SAM.Analytical/Create/New/HostPartitionType.cs index 656ff4d09..cd63a4404 100644 --- a/SAM/SAM.Analytical/Create/New/HostPartitionType.cs +++ b/SAM/SAM.Analytical/Create/New/HostPartitionType.cs @@ -1,6 +1,8 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors using SAM.Architectural; +using System.Collections.Generic; namespace SAM.Analytical { @@ -8,12 +10,12 @@ public static partial class Create { public static HostPartitionType HostPartitionType(this HostPartitionCategory hostPartitionCategory, string name, IEnumerable materialLayers) { - if(name == null || materialLayers == null || hostPartitionCategory == HostPartitionCategory.Undefined) + if (name == null || materialLayers == null || hostPartitionCategory == HostPartitionCategory.Undefined) { return null; } - switch(hostPartitionCategory) + switch (hostPartitionCategory) { case HostPartitionCategory.Floor: return new FloorType(name, materialLayers); @@ -35,7 +37,7 @@ public static HostPartitionType HostPartitionType(this HostPartitionType hostPar return null; } - if(hostPartitionType is WallType) + if (hostPartitionType is WallType) { return new WallType((WallType)hostPartitionType, name); } diff --git a/SAM/SAM.Analytical/Create/New/HostPartitions.cs b/SAM/SAM.Analytical/Create/New/HostPartitions.cs index e384dcca1..afc4ddd8e 100644 --- a/SAM/SAM.Analytical/Create/New/HostPartitions.cs +++ b/SAM/SAM.Analytical/Create/New/HostPartitions.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; namespace SAM.Analytical @@ -59,7 +62,7 @@ public static List HostPartitions(this IEnumerable HostPartitions(this IEnumerable HostPartitions(this Shell shell, double silverSpacing = Core.Tolerance.MacroDistance, double tolerance_Distance = Core.Tolerance.Distance, double tolerance_Angle = Core.Tolerance.Angle) { if (shell == null) @@ -83,7 +86,7 @@ public static List HostPartitions(this Shell shell, double silve return null; List result = new List(); - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { IHostPartition hostPartition = HostPartition(face3D, null, tolerance_Angle); if (hostPartition == null) @@ -97,4 +100,4 @@ public static List HostPartitions(this Shell shell, double silve return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/New/Log.cs b/SAM/SAM.Analytical/Create/New/Log.cs index 6e7094762..0e71d769e 100644 --- a/SAM/SAM.Analytical/Create/New/Log.cs +++ b/SAM/SAM.Analytical/Create/New/Log.cs @@ -1,4 +1,7 @@ -using SAM.Architectural; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Architectural; using SAM.Core; using SAM.Geometry.Spatial; using System; @@ -10,7 +13,7 @@ public static partial class Create { public static Log Log(this BuildingModel buildingModel) { - if(buildingModel == null) + if (buildingModel == null) { return null; } @@ -235,10 +238,10 @@ public static Log Log(this IPartition partition, BuildingModel buildingModel = n { name = "Air Partition"; } - else if(partition is IHostPartition) + else if (partition is IHostPartition) { HostPartitionType hostPartitionType = ((IHostPartition)partition).Type(); - if(hostPartitionType == null) + if (hostPartitionType == null) { result.Add(string.Format("{0} partition (Guid: {1}) has no type assigned", name, partition.Guid), LogRecordType.Error); } @@ -283,7 +286,7 @@ public static Log Log(this OpeningType openingType, BuildingModel buildingModel return result; } - + public static Log Log(this IOpening opening, BuildingModel buildingModel = null) { if (opening == null) @@ -318,10 +321,10 @@ public static Log Log(this IOpening opening, BuildingModel buildingModel = null) result.Add(string.Format("{0} opening (Guid: {1}) has no type assigned.", name, opening.Guid), LogRecordType.Error); } - if(buildingModel != null) + if (buildingModel != null) { IHostPartition hostPartition = buildingModel.GetHostPartition(opening); - if(hostPartition == null) + if (hostPartition == null) { result.Add(string.Format("{0} opening (Guid: {1}) has no host.", name, opening.Guid), LogRecordType.Warning); } @@ -343,7 +346,7 @@ private static Log Log(this IEnumerable materialLayers, string na Core.Modify.AddRange(result, Architectural.Create.Log(materialLayers, name, guid)); - if(buildingModel != null) + if (buildingModel != null) { MaterialType materialType = buildingModel.GetMaterialType(materialLayers); @@ -373,4 +376,4 @@ private static Log Log(this IEnumerable materialLayers, string na return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/New/Opening.cs b/SAM/SAM.Analytical/Create/New/Opening.cs index 1a7afda6a..33b2576ab 100644 --- a/SAM/SAM.Analytical/Create/New/Opening.cs +++ b/SAM/SAM.Analytical/Create/New/Opening.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Analytical { @@ -6,17 +9,17 @@ public static partial class Create { public static IOpening Opening(this OpeningType openingType, Face3D face3D) { - if(openingType == null || face3D == null || !face3D.IsValid()) + if (openingType == null || face3D == null || !face3D.IsValid()) { return null; } - if(openingType is WindowType) + if (openingType is WindowType) { return new Window((WindowType)openingType, face3D); } - if(openingType is DoorType) + if (openingType is DoorType) { return new Door((DoorType)openingType, face3D); } @@ -66,7 +69,7 @@ public static IOpening Opening(System.Guid guid, IOpening opening, Face3D face3D public static IOpening Opening(System.Guid guid, IOpening opening, Face3D face3D, Point3D location) { - if(opening == null || face3D == null || location == null) + if (opening == null || face3D == null || location == null) { return null; } @@ -75,7 +78,7 @@ public static IOpening Opening(System.Guid guid, IOpening opening, Face3D face3D plane = new Plane(plane, plane.Project(location)); Face3D face3D_Temp = plane.Convert(plane.Convert(face3D)); - if(face3D_Temp == null) + if (face3D_Temp == null) { return null; } diff --git a/SAM/SAM.Analytical/Create/New/OpeningType.cs b/SAM/SAM.Analytical/Create/New/OpeningType.cs index 1dc4a33a5..b6eb40c9f 100644 --- a/SAM/SAM.Analytical/Create/New/OpeningType.cs +++ b/SAM/SAM.Analytical/Create/New/OpeningType.cs @@ -1,4 +1,7 @@ - +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + + namespace SAM.Analytical { @@ -11,7 +14,7 @@ public static OpeningType OpeningType(this OpeningType openingType, string name) return null; } - if(openingType is DoorType) + if (openingType is DoorType) { return new DoorType((DoorType)openingType, name); } diff --git a/SAM/SAM.Analytical/Create/New/Openings.cs b/SAM/SAM.Analytical/Create/New/Openings.cs index 2b5858e72..8d8dca0d9 100644 --- a/SAM/SAM.Analytical/Create/New/Openings.cs +++ b/SAM/SAM.Analytical/Create/New/Openings.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; namespace SAM.Analytical @@ -14,7 +17,7 @@ public static List Openings(this List sAMGeometry3Ds, } List result = new List(); - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { if (minArea != 0 && face3D.GetArea() < minArea) { @@ -22,7 +25,7 @@ public static List Openings(this List sAMGeometry3Ds, } IOpening opening = Opening(openingType, face3D); - if(opening == null) + if (opening == null) { continue; } diff --git a/SAM/SAM.Analytical/Create/New/Partition.cs b/SAM/SAM.Analytical/Create/New/Partition.cs index 7a7e9783d..7b92e21e5 100644 --- a/SAM/SAM.Analytical/Create/New/Partition.cs +++ b/SAM/SAM.Analytical/Create/New/Partition.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Analytical { @@ -19,14 +22,14 @@ public static T Partition(this T partition, System.Guid guid, Face3D face3D, if (partition is IHostPartition) { IHostPartition hostPartition = HostPartition(guid, face3D, (IHostPartition)partition, tolerance); - if(hostPartition is T) + if (hostPartition is T) { return (T)hostPartition; } } AirPartition airPartition = new AirPartition(guid, partition as AirPartition, face3D); - if(airPartition is T) + if (airPartition is T) { return (T)(object)airPartition; } diff --git a/SAM/SAM.Analytical/Create/New/Partitions.cs b/SAM/SAM.Analytical/Create/New/Partitions.cs index 790e4887c..11e709e01 100644 --- a/SAM/SAM.Analytical/Create/New/Partitions.cs +++ b/SAM/SAM.Analytical/Create/New/Partitions.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Object.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Object.Spatial; using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -139,11 +142,11 @@ public static List Partitions(this BuildingModel buildingModel, Plan return result; } - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { IPartition partition = null; - if(hostPartitionType == null) + if (hostPartitionType == null) { partition = new AirPartition(face3D); } @@ -152,7 +155,7 @@ public static List Partitions(this BuildingModel buildingModel, Plan partition = HostPartition(face3D, hostPartitionType, tolerance_Angle); } - if(partition != null) + if (partition != null) { result.Add(partition); } @@ -161,4 +164,4 @@ public static List Partitions(this BuildingModel buildingModel, Plan return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/New/Rectangle2D.cs b/SAM/SAM.Analytical/Create/New/Rectangle2D.cs index 314e56e93..8f4c5f79f 100644 --- a/SAM/SAM.Analytical/Create/New/Rectangle2D.cs +++ b/SAM/SAM.Analytical/Create/New/Rectangle2D.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; namespace SAM.Analytical { @@ -16,7 +19,7 @@ public static Rectangle2D Rectangle2D(this Geometry.Spatial.Face3D face3D) if (segmentable2D == null) throw new System.NotImplementedException(); - return Geometry.Planar.Create.Rectangle2D(segmentable2D.GetPoints()); + return Geometry.Planar.Create.Rectangle2D(segmentable2D.GetPoints()); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/New/Walls.cs b/SAM/SAM.Analytical/Create/New/Walls.cs index 5b8c6f582..8d34f71a7 100644 --- a/SAM/SAM.Analytical/Create/New/Walls.cs +++ b/SAM/SAM.Analytical/Create/New/Walls.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; namespace SAM.Analytical @@ -40,4 +43,4 @@ public static List Walls(this IEnumerable segmentable3Ds, return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/OpaqueMaterial.cs b/SAM/SAM.Analytical/Create/OpaqueMaterial.cs index ed54b8418..63407f8e2 100644 --- a/SAM/SAM.Analytical/Create/OpaqueMaterial.cs +++ b/SAM/SAM.Analytical/Create/OpaqueMaterial.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Analytical { @@ -21,4 +24,4 @@ public static OpaqueMaterial OpaqueMaterial(string name, string group, string di return opaqueMaterial; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/Panel.cs b/SAM/SAM.Analytical/Create/Panel.cs index ae1478248..fe68aab23 100644 --- a/SAM/SAM.Analytical/Create/Panel.cs +++ b/SAM/SAM.Analytical/Create/Panel.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -33,24 +36,24 @@ public static Panel Panel(this Panel panel, Segment3D segment3D, double height) public static Panel Panel(this Construction construction, Segment3D segment3D, Vector3D vector3D, PanelType panelType = PanelType.Undefined) { - if(vector3D == null || !vector3D.IsValid() || segment3D == null || !segment3D.IsValid()) + if (vector3D == null || !vector3D.IsValid() || segment3D == null || !segment3D.IsValid()) { return null; } - + Face3D face3D = new Face3D(new Polygon3D(new Point3D[] { segment3D[0], segment3D[1], segment3D[1].GetMoved(vector3D) as Point3D, segment3D[0].GetMoved(vector3D) as Point3D })); - if(panelType == PanelType.Undefined) + if (panelType == PanelType.Undefined) { - if(construction != null && construction.TryGetValue(ConstructionParameter.DefaultPanelType, out string text)) + if (construction != null && construction.TryGetValue(ConstructionParameter.DefaultPanelType, out string text)) { panelType = Query.PanelType(text, false); } - if(panelType == PanelType.Undefined) + if (panelType == PanelType.Undefined) { Vector3D normal = face3D?.GetPlane()?.Normal; - if(normal != null) + if (normal != null) { panelType = normal.PanelType(); } @@ -62,7 +65,7 @@ public static Panel Panel(this Construction construction, Segment3D segment3D, V public static Panel Panel(Construction construction, PanelType panelType, Face3D face3D) { - if(face3D == null || panelType == PanelType.Undefined) + if (face3D == null || panelType == PanelType.Undefined) { return null; } @@ -72,17 +75,17 @@ public static Panel Panel(Construction construction, PanelType panelType, Face3D public static Panel Panel(Guid guid, Panel panel, Face3D face3D, IEnumerable apertures = null, bool trimGeometry = true, double minArea = Tolerance.MacroDistance, double maxDistance = Tolerance.MacroDistance) { - if(panel == null || face3D == null || guid == Guid.Empty) + if (panel == null || face3D == null || guid == Guid.Empty) { return null; } return new Panel(guid, panel, face3D, apertures, trimGeometry, minArea, maxDistance); } - + public static Panel Panel(Panel panel) { - if(panel == null) + if (panel == null) { return null; } @@ -102,7 +105,7 @@ public static Panel Panel(Guid guid, Panel panel) public static Panel Panel(Panel panel, PanelType panelType) { - if(panel == null) + if (panel == null) { return null; } @@ -112,17 +115,17 @@ public static Panel Panel(Panel panel, PanelType panelType) public static Panel Panel(Panel panel, Construction construction) { - if(panel == null) + if (panel == null) { return null; } - + return new Panel(panel, construction); } public static Panel Panel(Construction construction, PanelType panelType, PlanarBoundary3D planarBoundary3D) { - if(planarBoundary3D == null) + if (planarBoundary3D == null) { return null; } @@ -145,11 +148,11 @@ public static Panel Panel(Construction construction, PanelType panelType) public static Panel Panel(Guid guid, Panel panel, PlanarBoundary3D planarBoundary3D) { - if(guid == Guid.Empty || panel == null || planarBoundary3D == null) + if (guid == Guid.Empty || panel == null || planarBoundary3D == null) { return null; } return new Panel(guid, panel, planarBoundary3D); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/Panels.cs b/SAM/SAM.Analytical/Create/Panels.cs index 901993f87..0dd45d395 100644 --- a/SAM/SAM.Analytical/Create/Panels.cs +++ b/SAM/SAM.Analytical/Create/Panels.cs @@ -1,4 +1,6 @@ -using SAM.Geometry; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System; @@ -522,7 +524,7 @@ public static List Panels_Shade(this Panel panel, double overhangDepth, d public static List Panels_Shade(this Aperture aperture, FeatureShade featureShade) { - if(aperture == null || featureShade == null) + if (aperture == null || featureShade == null) { return null; } @@ -561,7 +563,7 @@ public static List Panels_Shade(this Aperture aperture, FeatureShade feat } Rectangle2D rectangle2D = Geometry.Planar.Create.Rectangle2D((face2D.ExternalEdge2D as ISegmentable2D).GetPoints()); - if(rectangle2D is null) + if (rectangle2D is null) { return null; } @@ -620,4 +622,4 @@ public static List Panels_Shade(this Aperture aperture, FeatureShade feat return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/Profile.cs b/SAM/SAM.Analytical/Create/Profile.cs index 8bbed8a9b..d05068040 100644 --- a/SAM/SAM.Analytical/Create/Profile.cs +++ b/SAM/SAM.Analytical/Create/Profile.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -10,7 +13,7 @@ public static Profile Profile(this ProfileLibrary profileLibrary, string name, P return null; List profiles = new List(); - foreach(string name_Profile in names) + foreach (string name_Profile in names) { Profile profile = profileLibrary.GetProfile(name_Profile, profileType, includeProfileGroup); if (profile == null) @@ -51,7 +54,7 @@ public static Profile Profile(this ProfileLibrary profileLibrary, string name, P return result; } - + public static Profile Profile(string name, ProfileType profileType, IEnumerable values) { return Profile(name, profileType.Text(), values); @@ -116,7 +119,7 @@ public static Profile Profile(string name, string category, IEnumerable public static Profile Profile(Weather.WeatherYear weatherYear, Weather.WeatherDataType weatherDataType) { - if(weatherYear == null || weatherDataType == Weather.WeatherDataType.Undefined) + if (weatherYear == null || weatherDataType == Weather.WeatherDataType.Undefined) { return null; } @@ -128,4 +131,4 @@ public static Profile Profile(Weather.WeatherYear weatherYear, Weather.WeatherDa return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/Rectangle2D.cs b/SAM/SAM.Analytical/Create/Rectangle2D.cs index 718dada36..69e1671af 100644 --- a/SAM/SAM.Analytical/Create/Rectangle2D.cs +++ b/SAM/SAM.Analytical/Create/Rectangle2D.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; namespace SAM.Analytical { @@ -16,7 +19,7 @@ public static Rectangle2D Rectangle2D(this PlanarBoundary3D planarBoundary3D) if (segmentable2D == null) throw new System.NotImplementedException(); - return Geometry.Planar.Create.Rectangle2D(segmentable2D.GetPoints()); + return Geometry.Planar.Create.Rectangle2D(segmentable2D.GetPoints()); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/RiserName.cs b/SAM/SAM.Analytical/Create/RiserName.cs index 70375c8cf..a3462d75d 100644 --- a/SAM/SAM.Analytical/Create/RiserName.cs +++ b/SAM/SAM.Analytical/Create/RiserName.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -43,4 +46,4 @@ public static string RiserName(this MechanicalSystemCategory mechanicalSystemCat return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/SpaceSimulationResult.cs b/SAM/SAM.Analytical/Create/SpaceSimulationResult.cs index 49059e1f9..c5798dd87 100644 --- a/SAM/SAM.Analytical/Create/SpaceSimulationResult.cs +++ b/SAM/SAM.Analytical/Create/SpaceSimulationResult.cs @@ -1,9 +1,12 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Create { public static SpaceSimulationResult SpaceSimulationResult( - string name, + string name, string source = null, string reference = null, double volume = double.NaN, @@ -12,7 +15,7 @@ public static SpaceSimulationResult SpaceSimulationResult( double load = double.NaN, double loadIndex = -1, SizingMethod? sizingMethod = null, - double dryBulbTemperature = double.NaN, + double dryBulbTemperature = double.NaN, double resultantTemperature = double.NaN, double solarGain = double.NaN, double lightingGain = double.NaN, @@ -111,4 +114,4 @@ public static SpaceSimulationResult SpaceSimulationResult( return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/TM52ExtendedResult.cs b/SAM/SAM.Analytical/Create/TM52ExtendedResult.cs index 026a84550..653c919b5 100644 --- a/SAM/SAM.Analytical/Create/TM52ExtendedResult.cs +++ b/SAM/SAM.Analytical/Create/TM52ExtendedResult.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Analytical @@ -7,7 +10,7 @@ public static partial class Create { public static TM52ExtendedResult TM52ExtendedResult(TM52ExtendedResult tM52ExtendedResult, int startIndex, int endIndex) { - if(tM52ExtendedResult == null || startIndex > endIndex) + if (tM52ExtendedResult == null || startIndex > endIndex) { return null; } @@ -37,7 +40,7 @@ public static TM52ExtendedResult TM52SpaceExtendedResult(TM52ExtendedResult tM52 IndexedDoubles minAcceptableTemperatures = new IndexedDoubles(); IndexedDoubles maxAcceptableTemperatures = new IndexedDoubles(); IndexedDoubles operativeTemperatures = new IndexedDoubles(); - foreach(int hourIndex in hourIndexes) + foreach (int hourIndex in hourIndexes) { if (occupiedHourIndices_Old.Contains(hourIndex)) { @@ -65,4 +68,4 @@ public static TM52ExtendedResult TM52SpaceExtendedResult(TM52ExtendedResult tM52 return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/TransparentMaterial.cs b/SAM/SAM.Analytical/Create/TransparentMaterial.cs index 7b4c14a2a..b4acfbc06 100644 --- a/SAM/SAM.Analytical/Create/TransparentMaterial.cs +++ b/SAM/SAM.Analytical/Create/TransparentMaterial.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Analytical { @@ -23,4 +26,4 @@ public static TransparentMaterial TransparentMaterial(string name, string group, return transparentMaterial; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/VentilationSystem.cs b/SAM/SAM.Analytical/Create/VentilationSystem.cs index 564243659..173f0bc6e 100644 --- a/SAM/SAM.Analytical/Create/VentilationSystem.cs +++ b/SAM/SAM.Analytical/Create/VentilationSystem.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Create { @@ -18,4 +21,4 @@ public static VentilationSystem VentilationSystem(VentilationSystemType ventilat return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/VentilationSystemType.cs b/SAM/SAM.Analytical/Create/VentilationSystemType.cs index 7e8903fe8..20bd3b43d 100644 --- a/SAM/SAM.Analytical/Create/VentilationSystemType.cs +++ b/SAM/SAM.Analytical/Create/VentilationSystemType.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Create { @@ -15,4 +18,4 @@ public static VentilationSystemType VentilationSystemType(System.Guid guid, stri return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Create/Zone.cs b/SAM/SAM.Analytical/Create/Zone.cs index 2d5874d8c..24aa836d0 100644 --- a/SAM/SAM.Analytical/Create/Zone.cs +++ b/SAM/SAM.Analytical/Create/Zone.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Create { @@ -22,4 +25,4 @@ public static Zone Zone(System.Guid guid, string name, string zoneCategory) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/ActivityLevel.cs b/SAM/SAM.Analytical/Enums/ActivityLevel.cs index 108390c7c..461096e3f 100644 --- a/SAM/SAM.Analytical/Enums/ActivityLevel.cs +++ b/SAM/SAM.Analytical/Enums/ActivityLevel.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -12,7 +15,7 @@ public enum ActivityLevel /// Undefined ActivityLevel /// [Description("Undefined")] Undefined, - + /// /// Sitting, relaxed 100W/person in total /// @@ -33,4 +36,4 @@ public enum ActivityLevel /// [Description("Activity Level IV")] Fourth, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/AirSupplyMethod.cs b/SAM/SAM.Analytical/Enums/AirSupplyMethod.cs index 23eb9b452..35f04e7e4 100644 --- a/SAM/SAM.Analytical/Enums/AirSupplyMethod.cs +++ b/SAM/SAM.Analytical/Enums/AirSupplyMethod.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -23,4 +26,4 @@ public enum AirSupplyMethod /// [Description("Total")] Total } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/AperturePart.cs b/SAM/SAM.Analytical/Enums/AperturePart.cs index 1a0b4b654..01e9f65b2 100644 --- a/SAM/SAM.Analytical/Enums/AperturePart.cs +++ b/SAM/SAM.Analytical/Enums/AperturePart.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -23,4 +26,4 @@ public enum AperturePart /// [Description("Frame")] Frame } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/ApertureType.cs b/SAM/SAM.Analytical/Enums/ApertureType.cs index 5ee9946df..8a971d171 100644 --- a/SAM/SAM.Analytical/Enums/ApertureType.cs +++ b/SAM/SAM.Analytical/Enums/ApertureType.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -23,4 +26,4 @@ public enum ApertureType /// [Description("Door")] Door } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/BoundaryType.cs b/SAM/SAM.Analytical/Enums/BoundaryType.cs index 4d0b5e264..c6b927cc5 100644 --- a/SAM/SAM.Analytical/Enums/BoundaryType.cs +++ b/SAM/SAM.Analytical/Enums/BoundaryType.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -12,4 +15,4 @@ public enum BoundaryType [Description("Linked")] Linked, [Description("Shade")] Shade } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/DefaultGasType.cs b/SAM/SAM.Analytical/Enums/DefaultGasType.cs index ae1cdb859..309fd8049 100644 --- a/SAM/SAM.Analytical/Enums/DefaultGasType.cs +++ b/SAM/SAM.Analytical/Enums/DefaultGasType.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -38,4 +41,4 @@ public enum DefaultGasType /// [Description("Sulfur HexaFluoride (SF6)")] SulfurHexaFluoride } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/EmitterCategory.cs b/SAM/SAM.Analytical/Enums/EmitterCategory.cs index eb5edb518..c0160a2a0 100644 --- a/SAM/SAM.Analytical/Enums/EmitterCategory.cs +++ b/SAM/SAM.Analytical/Enums/EmitterCategory.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -12,4 +15,4 @@ public enum EmitterCategory [Description("Occupant")] Occupant, [Description("Equipment")] Equipment, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/EmitterType.cs b/SAM/SAM.Analytical/Enums/EmitterType.cs index 044becb9d..ef73d16ce 100644 --- a/SAM/SAM.Analytical/Enums/EmitterType.cs +++ b/SAM/SAM.Analytical/Enums/EmitterType.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -34,4 +37,4 @@ public enum EmitterType [Description("Equipment Distributed Over")] EquipmentDistributedOver, [Description("Equipment Distributed")] EquipmentDistributed, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/FilterGroup.cs b/SAM/SAM.Analytical/Enums/FilterGroup.cs index ae31ba06e..2bf4b95d1 100644 --- a/SAM/SAM.Analytical/Enums/FilterGroup.cs +++ b/SAM/SAM.Analytical/Enums/FilterGroup.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -38,4 +41,4 @@ public enum FilterGroup /// [Description("ISO Coarse")] Coarse, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/FlowClassification.cs b/SAM/SAM.Analytical/Enums/FlowClassification.cs index b63f61215..02e4ea542 100644 --- a/SAM/SAM.Analytical/Enums/FlowClassification.cs +++ b/SAM/SAM.Analytical/Enums/FlowClassification.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -12,4 +15,4 @@ public enum FlowClassification [Description("Supply")] Supply, //[Description("Return")] Return, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/FunctionType.cs b/SAM/SAM.Analytical/Enums/FunctionType.cs index 8836604cf..b36f7e422 100644 --- a/SAM/SAM.Analytical/Enums/FunctionType.cs +++ b/SAM/SAM.Analytical/Enums/FunctionType.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -12,4 +15,4 @@ public enum FunctionType [Description("tcbvc")] tcbvc, [Description("Other")] Other } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/HeatFlowDirection.cs b/SAM/SAM.Analytical/Enums/HeatFlowDirection.cs index 0243946ce..2b82b9aa9 100644 --- a/SAM/SAM.Analytical/Enums/HeatFlowDirection.cs +++ b/SAM/SAM.Analytical/Enums/HeatFlowDirection.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public enum HeatFlowDirection { @@ -7,4 +10,4 @@ public enum HeatFlowDirection Up, Down } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/LightingOccupancyControls.cs b/SAM/SAM.Analytical/Enums/LightingOccupancyControls.cs index 99028be5e..9ef7c08f0 100644 --- a/SAM/SAM.Analytical/Enums/LightingOccupancyControls.cs +++ b/SAM/SAM.Analytical/Enums/LightingOccupancyControls.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -13,4 +16,4 @@ public enum LightingOccupancyControls [Description("ManualOn Dimmed")] ManualOn_Dimmed, [Description("ManualOn AutoOff")] ManualOn_AutoOff, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/LightingPhotoelectricControls.cs b/SAM/SAM.Analytical/Enums/LightingPhotoelectricControls.cs index 878039879..9fbd4911e 100644 --- a/SAM/SAM.Analytical/Enums/LightingPhotoelectricControls.cs +++ b/SAM/SAM.Analytical/Enums/LightingPhotoelectricControls.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -11,4 +14,4 @@ public enum LightingPhotoelectricControls [Description("Photocell On Off")] PhotocellOnOff, [Description("Photocell Dimming")] PhotocellDimming, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/LoadType.cs b/SAM/SAM.Analytical/Enums/LoadType.cs index 618d55e75..e7a8ade1f 100644 --- a/SAM/SAM.Analytical/Enums/LoadType.cs +++ b/SAM/SAM.Analytical/Enums/LoadType.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -9,4 +12,4 @@ public enum LoadType [Description("Cooling")] Cooling, [Description("Heating")] Heating, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/MechanicalSystemCategory.cs b/SAM/SAM.Analytical/Enums/MechanicalSystemCategory.cs index fe9522959..5041110a6 100644 --- a/SAM/SAM.Analytical/Enums/MechanicalSystemCategory.cs +++ b/SAM/SAM.Analytical/Enums/MechanicalSystemCategory.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -11,4 +14,4 @@ public enum MechanicalSystemCategory [Description("Ventilation")] Ventilation, [Description("Other")] Other } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/NCMCountry.cs b/SAM/SAM.Analytical/Enums/NCMCountry.cs index f8a1cec4f..635411a85 100644 --- a/SAM/SAM.Analytical/Enums/NCMCountry.cs +++ b/SAM/SAM.Analytical/Enums/NCMCountry.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -10,4 +13,4 @@ public enum NCMCountry [Description("Wales")] Wales, [Description("Scotland")] Scotland, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/NCMSystemType.cs b/SAM/SAM.Analytical/Enums/NCMSystemType.cs index ae32558f2..ebf02d5c6 100644 --- a/SAM/SAM.Analytical/Enums/NCMSystemType.cs +++ b/SAM/SAM.Analytical/Enums/NCMSystemType.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -21,4 +24,4 @@ public enum NCMSystemType [Description("Natural Ventilation")] NaturalVentilation, [Description("Occupied and Unheated")] OccupiedAndUnheated, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/New/HostPartitionCategory.cs b/SAM/SAM.Analytical/Enums/New/HostPartitionCategory.cs index a039bac6e..a1076a816 100644 --- a/SAM/SAM.Analytical/Enums/New/HostPartitionCategory.cs +++ b/SAM/SAM.Analytical/Enums/New/HostPartitionCategory.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -10,4 +13,4 @@ public enum HostPartitionCategory [Description("Roof")] Roof, [Description("Floor")] Floor, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/New/OpeningAnalyticalType.cs b/SAM/SAM.Analytical/Enums/New/OpeningAnalyticalType.cs index 78251b8d7..cc3d3f5d3 100644 --- a/SAM/SAM.Analytical/Enums/New/OpeningAnalyticalType.cs +++ b/SAM/SAM.Analytical/Enums/New/OpeningAnalyticalType.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -9,4 +12,4 @@ public enum OpeningAnalyticalType [Description("Window")] Window, [Description("Door")] Door, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/New/OpeningPart.cs b/SAM/SAM.Analytical/Enums/New/OpeningPart.cs index 63dcc5e8e..3c25651ee 100644 --- a/SAM/SAM.Analytical/Enums/New/OpeningPart.cs +++ b/SAM/SAM.Analytical/Enums/New/OpeningPart.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -9,4 +12,4 @@ public enum OpeningPart [Description("Frame")] Frame, [Description("Pane")] Pane, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/New/PartitionAnalyticalType.cs b/SAM/SAM.Analytical/Enums/New/PartitionAnalyticalType.cs index 22c13a61f..8515608ab 100644 --- a/SAM/SAM.Analytical/Enums/New/PartitionAnalyticalType.cs +++ b/SAM/SAM.Analytical/Enums/New/PartitionAnalyticalType.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -19,4 +22,4 @@ public enum PartitionAnalyticalType [Description("Air")] Air, [Description("Shade")] Shade } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/PanelGroup.cs b/SAM/SAM.Analytical/Enums/PanelGroup.cs index 976976936..1078442b3 100644 --- a/SAM/SAM.Analytical/Enums/PanelGroup.cs +++ b/SAM/SAM.Analytical/Enums/PanelGroup.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -11,4 +14,4 @@ public enum PanelGroup [Description("Wall")] Wall, [Description("Other")] Other } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/PanelType.cs b/SAM/SAM.Analytical/Enums/PanelType.cs index 17ce8d2f0..c0d7701f1 100644 --- a/SAM/SAM.Analytical/Enums/PanelType.cs +++ b/SAM/SAM.Analytical/Enums/PanelType.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -24,4 +27,4 @@ public enum PanelType [Description("Internal Wall")] WallInternal, [Description("Air")] Air } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/AdjacencyClusterSimulationResultParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/AdjacencyClusterSimulationResultParameter.cs index b682be202..b2af6dad1 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/AdjacencyClusterSimulationResultParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/AdjacencyClusterSimulationResultParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -10,4 +13,4 @@ public enum AdjacencyClusterSimulationResultParameter [ParameterProperties("Unmet Hours", "Unmet Hours"), IntegerParameterValue(0, 8760)] UnmetHours, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/AirHandlingUnitParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/AirHandlingUnitParameter.cs index 29138900a..c8d3a1301 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/AirHandlingUnitParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/AirHandlingUnitParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -8,4 +11,4 @@ public enum AirHandlingUnitParameter { } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/AnalyticalModelParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/AnalyticalModelParameter.cs index c9ee6e93c..3d8b06a29 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/AnalyticalModelParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/AnalyticalModelParameter.cs @@ -1,6 +1,9 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core; using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -15,4 +18,4 @@ public enum AnalyticalModelParameter [ParameterProperties("Cooling Design Days", "Cooling Design Days"), SAMObjectParameterValue(typeof(SAMCollection))] CoolingDesignDays, [ParameterProperties("Case Data Collection", "Case Data Collection"), SAMObjectParameterValue(typeof(CaseDataCollection))] CaseDataCollection, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/AnalyticalModelSimulationResultParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/AnalyticalModelSimulationResultParameter.cs index 696becbce..7dbe5aaad 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/AnalyticalModelSimulationResultParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/AnalyticalModelSimulationResultParameter.cs @@ -1,6 +1,9 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core; using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -18,4 +21,4 @@ public enum AnalyticalModelSimulationResultParameter [ParameterProperties("Floor Area", "Floor Area [m2]"), ParameterValue(ParameterType.Double)] FloorArea, [ParameterProperties("Volume", "Volume [m3]"), ParameterValue(ParameterType.Double)] Volume, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/AnalyticalSettingParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/AnalyticalSettingParameter.cs index 568ab7167..6517bf00c 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/AnalyticalSettingParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/AnalyticalSettingParameter.cs @@ -1,6 +1,9 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core; using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -46,4 +49,4 @@ public enum AnalyticalSettingParameter [ParameterProperties("Default MergeSettings File Name", "Default MergeSettings File Name"), ParameterValue(ParameterType.String)] DefaultMergeSettingsFileName, [ParameterProperties("Default MergeSettings", "Default MergeSettings"), SAMObjectParameterValue(typeof(MergeSettings))] DefaultMergeSettings, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/ApertureConstructionParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/ApertureConstructionParameter.cs index 9d5f44af3..6228d2650 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/ApertureConstructionParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/ApertureConstructionParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -12,7 +15,7 @@ public enum ApertureConstructionParameter [ParameterProperties("Color", "Color"), ParameterValue(Core.ParameterType.Color)] Color, [ParameterProperties("Default Frame Width", "Default Frame Width"), ParameterValue(Core.ParameterType.Double)] DefaultFrameWidth, [ParameterProperties("Is Internal Shadow", "Is Internal Shadow"), ParameterValue(Core.ParameterType.Boolean)] IsInternalShadow, - + [ParameterProperties("Light Transmittance", "Light Transmittance (LT Value) [-]"), DoubleParameterValue(0, 1)] LightTransmittance, [ParameterProperties("Total Solar Energy Transmittance", "Total Solar Energy Transmittance (g Value) [-]"), DoubleParameterValue(0, 1)] TotalSolarEnergyTransmittance, [ParameterProperties("Thermal Transmittance", "Thermal Transmittance (U Value) [-]"), DoubleParameterValue()] ThermalTransmittance, @@ -20,4 +23,4 @@ public enum ApertureConstructionParameter [ParameterProperties("Pane Additional Heat Transfer", "Pane Additional Heat Transfer [%]"), DoubleParameterValue(-50, 150)] PaneAdditionalHeatTransfer, [ParameterProperties("Frame Additional Heat Transfer", "Frame Additional Heat Transfer [%]"), DoubleParameterValue(-50, 150)] FrameAdditionalHeatTransfer, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/ApertureParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/ApertureParameter.cs index cd0a50333..6dc5e1dc3 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/ApertureParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/ApertureParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -19,4 +22,4 @@ public enum ApertureParameter [ParameterProperties("Color", "Color"), ParameterValue(Core.ParameterType.Color)] Color, [ParameterProperties("FeatureShade", "FeatureShade"), SAMObjectParameterValue(typeof(FeatureShade))] FeatureShade, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/ConstructionParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/ConstructionParameter.cs index ea8aabeca..cc5888686 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/ConstructionParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/ConstructionParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -14,9 +17,9 @@ public enum ConstructionParameter [ParameterProperties("Is Internal Shadow", "Is Internal Shadow"), ParameterValue(Core.ParameterType.Boolean)] IsInternalShadow, [ParameterProperties("Transparent", "Transparent"), ParameterValue(Core.ParameterType.Boolean)] Transparent, [ParameterProperties("Default Thickness", "Default Thickness"), DoubleParameterValue(0)] DefaultThickness, - + [ParameterProperties("Light Transmittance", "Light Transmittance (LT Value) [-]"), DoubleParameterValue(0, 1)] LightTransmittance, [ParameterProperties("Total Solar Energy Transmittance", "Total Solar Energy Transmittance (g Value) [-]"), DoubleParameterValue(0, 1)] TotalSolarEnergyTransmittance, [ParameterProperties("Thermal Transmittance", "Thermal Transmittance (U Value) [-]"), DoubleParameterValue()] ThermalTransmittance, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/CoolingSystemTypeParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/CoolingSystemTypeParameter.cs index 024878944..14ce699a2 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/CoolingSystemTypeParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/CoolingSystemTypeParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -13,4 +16,4 @@ public enum CoolingSystemTypeParameter [ParameterProperties("Temperature Difference", "Supply And Room Remperature Difference [K]"), DoubleParameterValue(0)] TemperatureDifference, [ParameterProperties("Supply Temperature", "Supply Temperature [K]"), DoubleParameterValue(0)] SupplyTemperature } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/GasMaterialParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/GasMaterialParameter.cs index 3f565d25f..2dee2a64f 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/GasMaterialParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/GasMaterialParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { diff --git a/SAM/SAM.Analytical/Enums/Parameter/HeatingSystemTypeParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/HeatingSystemTypeParameter.cs index a0b22ce77..e425ac306 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/HeatingSystemTypeParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/HeatingSystemTypeParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -11,4 +14,4 @@ public enum HeatingSystemTypeParameter [ParameterProperties("Supply Circuit Temperature", "Supply Circuit Temperature"), DoubleParameterValue(0)] SupplyCircuitTemperature, [ParameterProperties("Return Circuit Temperature", "Return Circuit Temperature"), DoubleParameterValue(0)] ReturnCircuitTemperature, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/InternalConditionParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/InternalConditionParameter.cs index 75b1300e8..6b886cc49 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/InternalConditionParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/InternalConditionParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -72,4 +75,4 @@ public enum InternalConditionParameter [ParameterProperties("Description", "Description"), ParameterValue(Core.ParameterType.String)] Description, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/MaterialParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/MaterialParameter.cs index 836e0e0d9..6a0ae3ff3 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/MaterialParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/MaterialParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -10,4 +13,4 @@ public enum MaterialParameter //[ParameterProperties("Description", "Description"), ParameterValue(Core.ParameterType.String)] Description, [ParameterProperties("Vapour Diffusion Factor", "Vapour Diffusion Factor"), DoubleParameterValue(0)] VapourDiffusionFactor, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/New/ArchitecturalModelParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/New/ArchitecturalModelParameter.cs index 484b5d083..b746ed56b 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/New/ArchitecturalModelParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/New/ArchitecturalModelParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -10,4 +13,4 @@ public enum BuildingModelParameter [ParameterProperties("Cooling Sizing Factor", "Cooling Sizing Factor"), DoubleParameterValue(0)] CoolingSizingFactor, [ParameterProperties("Heating Sizing Factor", "Heating Sizing Factor"), DoubleParameterValue(0)] HeatingSizingFactor, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/New/HostPartitionParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/New/HostPartitionParameter.cs index 218045507..09fec5a40 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/New/HostPartitionParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/New/HostPartitionParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -8,4 +11,4 @@ public enum HostPartitionParameter { [ParameterProperties("Adiabatic", "Adiabatic"), ParameterValue(Core.ParameterType.Boolean)] Adiabatic, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/New/HostPartitionTypeParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/New/HostPartitionTypeParameter.cs index c29c1f659..ce8fc4bf6 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/New/HostPartitionTypeParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/New/HostPartitionTypeParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -10,4 +13,4 @@ public enum HostPartitionTypeParameter [ParameterProperties("Description", "Description"), ParameterValue(Core.ParameterType.String)] Description, [ParameterProperties("Color", "Color"), ParameterValue(Core.ParameterType.Color)] Color } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/New/OpeningTypeParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/New/OpeningTypeParameter.cs index 6ef6bf18e..abc8b5c7e 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/New/OpeningTypeParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/New/OpeningTypeParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -11,4 +14,4 @@ public enum OpeningTypeParameter [ParameterProperties("Default Frame Width", "Default Frame Width"), ParameterValue(Core.ParameterType.Double)] DefaultFrameWidth, [ParameterProperties("Color", "Color"), ParameterValue(Core.ParameterType.Color)] Color, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/New/PartitionSimulationResultParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/New/PartitionSimulationResultParameter.cs index b4ce89926..ac93d7a8f 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/New/PartitionSimulationResultParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/New/PartitionSimulationResultParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -8,4 +11,4 @@ public enum PartitionSimulationResultParameter { [ParameterProperties("Area", "Area [m2]"), DoubleParameterValue()] Area, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/OpaqueMaterialParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/OpaqueMaterialParameter.cs index d8b9877e3..25a6ae6e0 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/OpaqueMaterialParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/OpaqueMaterialParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -14,4 +17,4 @@ public enum OpaqueMaterialParameter [ParameterProperties("Internal Light Reflectance", "Internal Light Reflectance"), DoubleParameterValue(0)] InternalLightReflectance, [ParameterProperties("Internal Solar Reflectance", "Internal Solar Reflectance"), DoubleParameterValue(0)] InternalSolarReflectance, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/OpeningPropertiesParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/OpeningPropertiesParameter.cs index d4f13b7ec..0a0f9cae9 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/OpeningPropertiesParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/OpeningPropertiesParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -9,4 +12,4 @@ public enum OpeningPropertiesParameter [ParameterProperties("Function", "Function"), ParameterValue(Core.ParameterType.String)] Function, [ParameterProperties("Description", "Description"), ParameterValue(Core.ParameterType.String)] Description, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/PanelParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/PanelParameter.cs index a95bc1c06..4dc370d2f 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/PanelParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/PanelParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -20,4 +23,4 @@ public enum PanelParameter [ParameterProperties("Adiabatic", "Adiabatic"), ParameterValue(Core.ParameterType.Boolean)] Adiabatic, [ParameterProperties("FeatureShade", "FeatureShade"), SAMObjectParameterValue(typeof(FeatureShade))] FeatureShade, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/SpaceParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/SpaceParameter.cs index 12696305c..dea255317 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/SpaceParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/SpaceParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -30,7 +33,7 @@ public enum SpaceParameter [ParameterProperties("Outside Supply Air Flow", "Outside Supply Air Flow [m3/s]"), DoubleParameterValue(0)] OutsideSupplyAirFlow, [ParameterProperties("Supply Air Flow", "Supply Air Flow [m3/s]"), DoubleParameterValue(0)] SupplyAirFlow, [ParameterProperties("Exhaust Air Flow", "Exhaust Air Flow [m3/s]"), DoubleParameterValue(0)] ExhaustAirFlow, - + [ParameterProperties("Daylight Factor", "Daylight Factor [-]"), DoubleParameterValue(0)] DaylightFactor, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/SpaceSimulationResultParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/SpaceSimulationResultParameter.cs index d1cee308f..65f3126e1 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/SpaceSimulationResultParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/SpaceSimulationResultParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -17,7 +20,7 @@ public enum SpaceSimulationResultParameter [ParameterProperties("Infiltration Gain", "Infiltration Gain [W]"), DoubleParameterValue()] InfiltrationGain, [ParameterProperties("Air Movement Gain", "Air Movement Gain [W]"), DoubleParameterValue()] AirMovementGain, [ParameterProperties("Building Heat Transfer", "Building Heat Transfer [W]"), DoubleParameterValue()] BuildingHeatTransfer, - [ParameterProperties("Glazing External Conduction", "Glazing External Conduction [W]"), DoubleParameterValue()] GlazingExternalConduction, + [ParameterProperties("Glazing External Conduction", "Glazing External Conduction [W]"), DoubleParameterValue()] GlazingExternalConduction, [ParameterProperties("Opaque External Conduction", "Opaque External Conduction [W]"), DoubleParameterValue()] OpaqueExternalConduction, [ParameterProperties("Occupancy Sensible Gain", "Occupancy Sensible Gain [W]"), DoubleParameterValue()] OccupancySensibleGain, [ParameterProperties("Occupancy Latent Gain", "Occupancy Latent Gain [W]"), DoubleParameterValue()] OccupancyLatentGain, @@ -46,4 +49,4 @@ public enum SpaceSimulationResultParameter [ParameterProperties("Unmet Hour First Index", "Unmet Hour First Index"), IntegerParameterValue(0, 8760)] UnmetHourFirstIndex, [ParameterProperties("Occupied Unmet Hours", "Occupied Unmet Hours"), IntegerParameterValue(0, 8760)] OccupiedUnmetHours, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/SurfaceSimulationResultParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/SurfaceSimulationResultParameter.cs index 8f13370c1..65677e85b 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/SurfaceSimulationResultParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/SurfaceSimulationResultParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -34,4 +37,4 @@ public enum SurfaceSimulationResultParameter [ParameterProperties("Interstitial Condensation", "The amount of condensation within the construction of the selected surface [g/(m^2)]"), DoubleParameterValue()] InterstitialCondensation, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/TransparentMaterialParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/TransparentMaterialParameter.cs index fc1eb6d1b..86a7277a6 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/TransparentMaterialParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/TransparentMaterialParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -16,4 +19,4 @@ public enum TransparentMaterialParameter [ParameterProperties("Light Transmittance", "Light Transmittance"), DoubleParameterValue(0)] LightTransmittance, [ParameterProperties("Solar Transmittance", "Solar Transmittance"), DoubleParameterValue(0)] SolarTransmittance, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/VentilationSystemParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/VentilationSystemParameter.cs index f3a56b9bd..6aafc526d 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/VentilationSystemParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/VentilationSystemParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -9,4 +12,4 @@ public enum VentilationSystemParameter [ParameterProperties("Supply Unit Name", "Supply Unit Name"), ParameterValue(Core.ParameterType.String)] SupplyUnitName, [ParameterProperties("Exhaust Unit Name", "Exhaust Unit Name"), ParameterValue(Core.ParameterType.String)] ExhaustUnitName, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/VentilationSystemTypeParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/VentilationSystemTypeParameter.cs index a56964060..4c34d24d7 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/VentilationSystemTypeParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/VentilationSystemTypeParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -9,4 +12,4 @@ public enum VentilationSystemTypeParameter [ParameterProperties("Temperature Difference", "Supply Air And Room Remperature Difference [K]"), DoubleParameterValue(0)] TemperatureDifference, [ParameterProperties("Air Supply Method", "Air Supply Method"), ParameterValue(Core.ParameterType.String)] AirSupplyMethod, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/ZoneParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/ZoneParameter.cs index 5a5b56a80..97506a1c7 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/ZoneParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/ZoneParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -10,4 +13,4 @@ public enum ZoneParameter [ParameterProperties("Zone Category", "Zone Category"), ParameterValue(Core.ParameterType.String)] ZoneCategory, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/Parameter/ZoneSimulationResultParameter.cs b/SAM/SAM.Analytical/Enums/Parameter/ZoneSimulationResultParameter.cs index ba06aaffe..6525815ed 100644 --- a/SAM/SAM.Analytical/Enums/Parameter/ZoneSimulationResultParameter.cs +++ b/SAM/SAM.Analytical/Enums/Parameter/ZoneSimulationResultParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Analytical { @@ -23,4 +26,4 @@ public enum ZoneSimulationResultParameter [ParameterProperties("Load Type", "Load Type"), ParameterValue(Core.ParameterType.String)] LoadType, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/ProfileGroup.cs b/SAM/SAM.Analytical/Enums/ProfileGroup.cs index 8869be905..1099f3e9a 100644 --- a/SAM/SAM.Analytical/Enums/ProfileGroup.cs +++ b/SAM/SAM.Analytical/Enums/ProfileGroup.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -11,4 +14,4 @@ public enum ProfileGroup [Description("Humidistat")] Humidistat, [Description("Ventilation")] Ventilation, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/ProfileType.cs b/SAM/SAM.Analytical/Enums/ProfileType.cs index 37571e65f..61aeae6ea 100644 --- a/SAM/SAM.Analytical/Enums/ProfileType.cs +++ b/SAM/SAM.Analytical/Enums/ProfileType.cs @@ -1,4 +1,7 @@ - using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -19,4 +22,4 @@ public enum ProfileType [Description("Ventilation")] Ventilation, [Description("Other")] Other, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/SeasonType.cs b/SAM/SAM.Analytical/Enums/SeasonType.cs index 320103555..8f1bddfac 100644 --- a/SAM/SAM.Analytical/Enums/SeasonType.cs +++ b/SAM/SAM.Analytical/Enums/SeasonType.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -12,7 +15,7 @@ public enum SeasonType /// Undefined /// [Description("Undefined")] Undefined, - + /// /// Cooling /// @@ -29,4 +32,4 @@ public enum SeasonType [Description("Free Cooling")] FreeCooling, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/SizingMethod.cs b/SAM/SAM.Analytical/Enums/SizingMethod.cs index ee09ea20a..872509fc3 100644 --- a/SAM/SAM.Analytical/Enums/SizingMethod.cs +++ b/SAM/SAM.Analytical/Enums/SizingMethod.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -10,4 +13,4 @@ public enum SizingMethod [Description("Heating Design Day")] HDD, [Description("Simulation")] Simulation, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/TM52BuildingCategory.cs b/SAM/SAM.Analytical/Enums/TM52BuildingCategory.cs index 436754263..ac17e6820 100644 --- a/SAM/SAM.Analytical/Enums/TM52BuildingCategory.cs +++ b/SAM/SAM.Analytical/Enums/TM52BuildingCategory.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { diff --git a/SAM/SAM.Analytical/Enums/TM59SpaceApplication.cs b/SAM/SAM.Analytical/Enums/TM59SpaceApplication.cs index 5becc40f1..b4ce8b008 100644 --- a/SAM/SAM.Analytical/Enums/TM59SpaceApplication.cs +++ b/SAM/SAM.Analytical/Enums/TM59SpaceApplication.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { diff --git a/SAM/SAM.Analytical/Enums/VentilationType.cs b/SAM/SAM.Analytical/Enums/VentilationType.cs index a8e6a2535..129b7f238 100644 --- a/SAM/SAM.Analytical/Enums/VentilationType.cs +++ b/SAM/SAM.Analytical/Enums/VentilationType.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -9,4 +12,4 @@ public enum VentilationType [Description("Outside Supply Air")] OSA, [Description("Total Supply Air")] TSA, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Enums/ZoneType.cs b/SAM/SAM.Analytical/Enums/ZoneType.cs index 6f2961e07..8a84c04b0 100644 --- a/SAM/SAM.Analytical/Enums/ZoneType.cs +++ b/SAM/SAM.Analytical/Enums/ZoneType.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Analytical { @@ -11,4 +14,4 @@ public enum ZoneType [Description("Ventilation")] Ventilation, [Description("Other")] Other } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Interfaces/Filter/IAdjacencyClusterFilter.cs b/SAM/SAM.Analytical/Interfaces/Filter/IAdjacencyClusterFilter.cs index 869b06eb4..f6739e580 100644 --- a/SAM/SAM.Analytical/Interfaces/Filter/IAdjacencyClusterFilter.cs +++ b/SAM/SAM.Analytical/Interfaces/Filter/IAdjacencyClusterFilter.cs @@ -1,4 +1,7 @@ - +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + + namespace SAM.Analytical { public interface IAdjacencyClusterFilter : Core.IFilter diff --git a/SAM/SAM.Analytical/Interfaces/IAirMovementObject.cs b/SAM/SAM.Analytical/Interfaces/IAirMovementObject.cs index 06fb7d055..498298f93 100644 --- a/SAM/SAM.Analytical/Interfaces/IAirMovementObject.cs +++ b/SAM/SAM.Analytical/Interfaces/IAirMovementObject.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public interface IAirMovementObject : IAnalyticalObject { diff --git a/SAM/SAM.Analytical/Interfaces/IAnalyticalEquipment.cs b/SAM/SAM.Analytical/Interfaces/IAnalyticalEquipment.cs index deed9d71b..1dd8536fe 100644 --- a/SAM/SAM.Analytical/Interfaces/IAnalyticalEquipment.cs +++ b/SAM/SAM.Analytical/Interfaces/IAnalyticalEquipment.cs @@ -1,7 +1,10 @@ - +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + + namespace SAM.Analytical { - public interface IAnalyticalEquipment :IAnalyticalObject + public interface IAnalyticalEquipment : IAnalyticalObject { } } diff --git a/SAM/SAM.Analytical/Interfaces/IAnalyticalObject.cs b/SAM/SAM.Analytical/Interfaces/IAnalyticalObject.cs index faf5cfd9a..b8937387f 100644 --- a/SAM/SAM.Analytical/Interfaces/IAnalyticalObject.cs +++ b/SAM/SAM.Analytical/Interfaces/IAnalyticalObject.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Analytical { diff --git a/SAM/SAM.Analytical/Interfaces/IAnalyticalResult.cs b/SAM/SAM.Analytical/Interfaces/IAnalyticalResult.cs index aa501538b..555e7b633 100644 --- a/SAM/SAM.Analytical/Interfaces/IAnalyticalResult.cs +++ b/SAM/SAM.Analytical/Interfaces/IAnalyticalResult.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public interface IAnalyticalResult : IAnalyticalObject { diff --git a/SAM/SAM.Analytical/Interfaces/IComplexEquipment.cs b/SAM/SAM.Analytical/Interfaces/IComplexEquipment.cs index a45bc83a6..c043342b6 100644 --- a/SAM/SAM.Analytical/Interfaces/IComplexEquipment.cs +++ b/SAM/SAM.Analytical/Interfaces/IComplexEquipment.cs @@ -1,4 +1,7 @@ - +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + + using System; @@ -7,6 +10,6 @@ namespace SAM.Analytical { public interface IComplexEquipment : IAnalyticalEquipment { - Guid Guid {get;} + Guid Guid { get; } } } diff --git a/SAM/SAM.Analytical/Interfaces/IPanel.cs b/SAM/SAM.Analytical/Interfaces/IPanel.cs index 9efc2e990..567b2b887 100644 --- a/SAM/SAM.Analytical/Interfaces/IPanel.cs +++ b/SAM/SAM.Analytical/Interfaces/IPanel.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Object.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Object.Spatial; using System; namespace SAM.Analytical diff --git a/SAM/SAM.Analytical/Interfaces/ISection.cs b/SAM/SAM.Analytical/Interfaces/ISection.cs index 5655a4179..15c107049 100644 --- a/SAM/SAM.Analytical/Interfaces/ISection.cs +++ b/SAM/SAM.Analytical/Interfaces/ISection.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public interface ISection : ISimpleEquipment { diff --git a/SAM/SAM.Analytical/Interfaces/ISelectiveCase.cs b/SAM/SAM.Analytical/Interfaces/ISelectiveCase.cs new file mode 100644 index 000000000..cf44ee80a --- /dev/null +++ b/SAM/SAM.Analytical/Interfaces/ISelectiveCase.cs @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; + +namespace SAM.Analytical +{ + public interface ISelectiveCase : IJSAMObject + { + CaseSelection CaseSelection { get; set; } + } +} diff --git a/SAM/SAM.Analytical/Interfaces/ISimpleEquipment.cs b/SAM/SAM.Analytical/Interfaces/ISimpleEquipment.cs index 43b86b5d5..98c71a410 100644 --- a/SAM/SAM.Analytical/Interfaces/ISimpleEquipment.cs +++ b/SAM/SAM.Analytical/Interfaces/ISimpleEquipment.cs @@ -1,10 +1,13 @@ - +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + + using System; namespace SAM.Analytical { public interface ISimpleEquipment : IAnalyticalEquipment { - Guid Guid {get;} + Guid Guid { get; } } } diff --git a/SAM/SAM.Analytical/Interfaces/ISpace.cs b/SAM/SAM.Analytical/Interfaces/ISpace.cs index 711b98f7c..982af1790 100644 --- a/SAM/SAM.Analytical/Interfaces/ISpace.cs +++ b/SAM/SAM.Analytical/Interfaces/ISpace.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Object.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Object.Spatial; using SAM.Geometry.Spatial; using System; diff --git a/SAM/SAM.Analytical/Interfaces/New/IBuildingElement.cs b/SAM/SAM.Analytical/Interfaces/New/IBuildingElement.cs index d122c7570..dead64a6f 100644 --- a/SAM/SAM.Analytical/Interfaces/New/IBuildingElement.cs +++ b/SAM/SAM.Analytical/Interfaces/New/IBuildingElement.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Object.Spatial; using SAM.Geometry.Spatial; @@ -7,7 +10,7 @@ namespace SAM.Analytical public interface IBuildingElement : IAnalyticalObject, IParameterizedSAMObject, IFace3DObject, ISAMObject { void Transform(Transform3D transform3D); - + void Move(Vector3D vector3D); BoundingBox3D GetBoundingBox(double offset = 0); diff --git a/SAM/SAM.Analytical/Interfaces/New/IHostPartition.cs b/SAM/SAM.Analytical/Interfaces/New/IHostPartition.cs index cee7b4434..f72735bc5 100644 --- a/SAM/SAM.Analytical/Interfaces/New/IHostPartition.cs +++ b/SAM/SAM.Analytical/Interfaces/New/IHostPartition.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Object.Spatial; using SAM.Geometry.Spatial; using System.Collections.Generic; diff --git a/SAM/SAM.Analytical/Interfaces/New/IOpening.cs b/SAM/SAM.Analytical/Interfaces/New/IOpening.cs index 1556e5c0a..f0fa92683 100644 --- a/SAM/SAM.Analytical/Interfaces/New/IOpening.cs +++ b/SAM/SAM.Analytical/Interfaces/New/IOpening.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Object.Spatial; namespace SAM.Analytical diff --git a/SAM/SAM.Analytical/Interfaces/New/IPartition.cs b/SAM/SAM.Analytical/Interfaces/New/IPartition.cs index 4123b7d1b..56cfb682a 100644 --- a/SAM/SAM.Analytical/Interfaces/New/IPartition.cs +++ b/SAM/SAM.Analytical/Interfaces/New/IPartition.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Object.Spatial; namespace SAM.Analytical diff --git a/SAM/SAM.Analytical/Interfaces/OpeningProperties/IOpeningProperties.cs b/SAM/SAM.Analytical/Interfaces/OpeningProperties/IOpeningProperties.cs index b8f100441..d6fc7f551 100644 --- a/SAM/SAM.Analytical/Interfaces/OpeningProperties/IOpeningProperties.cs +++ b/SAM/SAM.Analytical/Interfaces/OpeningProperties/IOpeningProperties.cs @@ -1,4 +1,7 @@ - +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + + namespace SAM.Analytical { public interface IOpeningProperties : Core.IParameterizedSAMObject, IAnalyticalObject diff --git a/SAM/SAM.Analytical/Interfaces/OpeningProperties/ISingleOpeningProperties.cs b/SAM/SAM.Analytical/Interfaces/OpeningProperties/ISingleOpeningProperties.cs index f548597a4..177bc24b3 100644 --- a/SAM/SAM.Analytical/Interfaces/OpeningProperties/ISingleOpeningProperties.cs +++ b/SAM/SAM.Analytical/Interfaces/OpeningProperties/ISingleOpeningProperties.cs @@ -1,4 +1,7 @@ - +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + + namespace SAM.Analytical { public interface ISingleOpeningProperties : IOpeningProperties diff --git a/SAM/SAM.Analytical/Manager/ActiveSetting.cs b/SAM/SAM.Analytical/Manager/ActiveSetting.cs index 844370837..5a9d2d0ab 100644 --- a/SAM/SAM.Analytical/Manager/ActiveSetting.cs +++ b/SAM/SAM.Analytical/Manager/ActiveSetting.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Reflection; namespace SAM.Analytical @@ -120,4 +123,4 @@ public static Setting GetDefault() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/AddAirMovementObjects.cs b/SAM/SAM.Analytical/Modify/AddAirMovementObjects.cs index 1e890b2f1..a955193b4 100644 --- a/SAM/SAM.Analytical/Modify/AddAirMovementObjects.cs +++ b/SAM/SAM.Analytical/Modify/AddAirMovementObjects.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Analytical @@ -8,7 +11,7 @@ public static partial class Modify public static List AddAirMovementObjects(this AnalyticalModel analyticalModel) { AdjacencyCluster adjacencyCluster = analyticalModel?.AdjacencyCluster; - if(adjacencyCluster == null) + if (adjacencyCluster == null) { return null; } @@ -20,7 +23,7 @@ public static List AddAirMovementObjects(this AnalyticalMode } List airHandlingUnits_All = adjacencyCluster.GetObjects(); - if(airHandlingUnits_All == null) + if (airHandlingUnits_All == null) { return null; } @@ -29,30 +32,30 @@ public static List AddAirMovementObjects(this AnalyticalMode List result = new List(); - List airHandlingUnits = new List(); - foreach(VentilationSystem ventilationSystem in ventilationSystems) + List airHandlingUnits = new List(); + foreach (VentilationSystem ventilationSystem in ventilationSystems) { - if(ventilationSystem == null) + if (ventilationSystem == null) { continue; } List spaces = adjacencyCluster.GetRelatedObjects(ventilationSystem); - if(spaces == null || spaces.Count == 0) + if (spaces == null || spaces.Count == 0) { continue; } - if(ventilationSystem.TryGetValue(VentilationSystemParameter.SupplyUnitName, out string supplyName)) + if (ventilationSystem.TryGetValue(VentilationSystemParameter.SupplyUnitName, out string supplyName)) { AirHandlingUnit airHandlingUnit = airHandlingUnits_All.Find(x => x.Name == supplyName); - if(airHandlingUnit != null) + if (airHandlingUnit != null) { - if(airHandlingUnits.Find(x => x.Guid == airHandlingUnit.Guid) == null) + if (airHandlingUnits.Find(x => x.Guid == airHandlingUnit.Guid) == null) { airHandlingUnits.Add(airHandlingUnit); } - + ObjectReference objectReference_AirHandlingUnit = new ObjectReference(airHandlingUnit); foreach (Space space in spaces) @@ -107,4 +110,4 @@ public static List AddAirMovementObjects(this AnalyticalMode return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/AddAirPanels.cs b/SAM/SAM.Analytical/Modify/AddAirPanels.cs index 2a8e0ecee..e25cc0916 100644 --- a/SAM/SAM.Analytical/Modify/AddAirPanels.cs +++ b/SAM/SAM.Analytical/Modify/AddAirPanels.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -11,21 +14,21 @@ public static partial class Modify { public static List AddAirPanels(this AdjacencyCluster adjacencyCluster, IEnumerable planes, IEnumerable spaces = null, double silverSpacing = Core.Tolerance.MacroDistance, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance, double tolerance_Snap = Core.Tolerance.MacroDistance) { - if(adjacencyCluster == null || planes == null) + if (adjacencyCluster == null || planes == null) { return null; } List result = new List(); foreach (Plane plane in planes) - { - if(plane == null) + { + if (plane == null) { continue; } List panels = AddAirPanels(adjacencyCluster, plane, spaces, silverSpacing, tolerance_Angle, tolerance_Distance, tolerance_Snap); - if(panels != null && panels.Count > 0) + if (panels != null && panels.Count > 0) { result.AddRange(panels); } @@ -50,23 +53,23 @@ public static List AddAirPanels(this AdjacencyCluster adjacencyCluster, P return result; } - if(spaces != null) + if (spaces != null) { - for(int i = spaces_Temp.Count - 1; i >= 0; i--) + for (int i = spaces_Temp.Count - 1; i >= 0; i--) { Guid guid = spaces_Temp[i].Guid; bool exists = false; - foreach(Space space in spaces) + foreach (Space space in spaces) { - if(space.Guid == guid) + if (space.Guid == guid) { exists = true; break; } } - if(exists) + if (exists) { continue; } @@ -95,7 +98,7 @@ public static List AddAirPanels(this AdjacencyCluster adjacencyCluster, P } shells_Cut.RemoveAll(x => x == null || x.GetBoundingBox() == null); - if(shells_Cut.Count <= 1) + if (shells_Cut.Count <= 1) { continue; } @@ -110,7 +113,7 @@ public static List AddAirPanels(this AdjacencyCluster adjacencyCluster, P List face3Ds_Existing = panels_Existing?.ConvertAll(x => x.GetFace3D()); - List >>>> tuples_New = Enumerable.Repeat>>>>(null, tuples.Count).ToList(); + List>>>> tuples_New = Enumerable.Repeat>>>>(null, tuples.Count).ToList(); Parallel.For(0, tuples.Count, (int i) => //for(int i=0; i < tuples.Count; i++) @@ -185,9 +188,9 @@ public static List AddAirPanels(this AdjacencyCluster adjacencyCluster, P }); - foreach(Tuple>>> tuple in tuples_New) + foreach (Tuple>>> tuple in tuples_New) { - if(tuple == null) + if (tuple == null) { continue; } @@ -197,13 +200,13 @@ public static List AddAirPanels(this AdjacencyCluster adjacencyCluster, P List relatedObjects = adjacencyCluster.GetRelatedObjects(space_Old)?.FindAll(x => !(x is Panel)); adjacencyCluster.RemoveObject(space_Old.Guid); - foreach(Tuple> tuple_Space_New in tuple.Item2) + foreach (Tuple> tuple_Space_New in tuple.Item2) { Space space_New = tuple_Space_New.Item1; adjacencyCluster.AddObject(space_New); - if(relatedObjects != null) + if (relatedObjects != null) { foreach (IJSAMObject relatedObject in relatedObjects) { @@ -216,7 +219,7 @@ public static List AddAirPanels(this AdjacencyCluster adjacencyCluster, P } } - foreach(Panel panel in tuple_Space_New.Item2) + foreach (Panel panel in tuple_Space_New.Item2) { adjacencyCluster.AddObject(panel); adjacencyCluster.AddRelation(space_New, panel); @@ -227,4 +230,4 @@ public static List AddAirPanels(this AdjacencyCluster adjacencyCluster, P return panels_Air.FindAll(x => adjacencyCluster.Contains(x)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/AddAperture.cs b/SAM/SAM.Analytical/Modify/AddAperture.cs index e4c5129c5..a375e780a 100644 --- a/SAM/SAM.Analytical/Modify/AddAperture.cs +++ b/SAM/SAM.Analytical/Modify/AddAperture.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -8,19 +11,19 @@ public static partial class Modify { public static Aperture AddAperture(this AdjacencyCluster adjacencyCluster, Aperture aperture, double tolerance_Angle = Tolerance.Angle, double tolerance_Distance = Tolerance.Distance) { - if(adjacencyCluster == null || aperture == null) + if (adjacencyCluster == null || aperture == null) { return null; } List panels = adjacencyCluster.GetPanels(); - if(panels == null || panels.Count == 0) + if (panels == null || panels.Count == 0) { return null; } BoundingBox3D boundingBox3D_Aperture = aperture.GetBoundingBox(); - if(boundingBox3D_Aperture == null) + if (boundingBox3D_Aperture == null) { return null; } @@ -29,7 +32,7 @@ public static Aperture AddAperture(this AdjacencyCluster adjacencyCluster, Apert foreach (Panel panel in panels) { BoundingBox3D boundingBox3D_Panel = panel?.GetBoundingBox(); - if(boundingBox3D_Panel == null) + if (boundingBox3D_Panel == null) { continue; } @@ -51,4 +54,4 @@ public static Aperture AddAperture(this AdjacencyCluster adjacencyCluster, Apert return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/AddApertures.cs b/SAM/SAM.Analytical/Modify/AddApertures.cs index 38ee65a9f..8f0d9781a 100644 --- a/SAM/SAM.Analytical/Modify/AddApertures.cs +++ b/SAM/SAM.Analytical/Modify/AddApertures.cs @@ -1,4 +1,7 @@ -using MathNet.Numerics; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using MathNet.Numerics; using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System; @@ -19,9 +22,9 @@ public static List AddApertures(this AdjacencyCluster adjacencyCluster return null; List result = AddApertures(panels, apertureConstruction, closedPlanar3Ds, trimGeometry, minArea, maxDistance, tolerance); - if(result != null && result.Count != 0) + if (result != null && result.Count != 0) { - foreach(Panel panel in panels) + foreach (Panel panel in panels) { adjacencyCluster.AddObject(panel); } @@ -87,10 +90,10 @@ public static List AddApertures(this Panel panel, IEnumerable result = new List(); - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { List apertures_New = AddApertures(new Panel[] { panel }, aperture.ApertureConstruction, new IClosedPlanar3D[] { aperture.GetFace3D() }, trimGeometry, minArea, maxDistance, tolerance); - if(apertures_New != null) + if (apertures_New != null) { result.AddRange(apertures_New); } @@ -154,7 +157,7 @@ public static List AddApertures(this AdjacencyCluster adjacencyCluster return null; List>> tuples = new List>>(); - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { ApertureConstruction apertureConstruction = aperture?.ApertureConstruction; if (apertureConstruction == null) @@ -306,9 +309,9 @@ public static List AddApertures(this Panel panel, ApertureConstruction area_Current = face2D.GetArea(); - if(area_Current.AlmostEqual(area_Panel, tolerance_Area)) + if (area_Current.AlmostEqual(area_Panel, tolerance_Area)) { - if(strikes > 12) + if (strikes > 12) { return null; } @@ -364,7 +367,7 @@ public static List AddApertures(this Panel panel, ApertureConstruction if (area_Target < tolerance_Area) return null; - if(!face3D.Rectangular(tolerance_Area)) + if (!face3D.Rectangular(tolerance_Area)) { return AddApertures(panel, apertureConstruction, ratio, tolerance_Area, tolerance); } @@ -380,7 +383,7 @@ public static List AddApertures(this Panel panel, ApertureConstruction double elevation_Bottom = System.Math.Min(boundingBox3D.Min.Z + sillHeight, boundingBox3D_Offset.Max.Z); double elevation_Top = System.Math.Min(elevation_Bottom + height, boundingBox3D_Offset.Max.Z); - if(elevation_Top == elevation_Bottom) + if (elevation_Top == elevation_Bottom) { return AddApertures(panel, apertureConstruction, ratio, tolerance_Area, tolerance); } @@ -452,7 +455,7 @@ public static List AddApertures(this Panel panel, ApertureConstruction double elevation = (elevation_Top + elevation_Bottom) / 2; - if(elevation + (height / 2) > boundingBox3D_Offset.Max.Z) + if (elevation + (height / 2) > boundingBox3D_Offset.Max.Z) { elevation = boundingBox3D_Offset.Max.Z - (height / 2); } @@ -492,7 +495,7 @@ public static List AddApertures(this Panel panel, ApertureConstruction { double separation_Temp = separation; - if(!keepSeparationDistance) + if (!keepSeparationDistance) { double length = segment3D.GetLength(); @@ -584,7 +587,7 @@ public static List AddApertures(this Panel panel, ApertureConstruction Func getArea = new Func((double x) => { List polygon2Ds = getPolygon2Ds.Invoke(x); - if(polygon2Ds == null || polygon2Ds.Count == 0) + if (polygon2Ds == null || polygon2Ds.Count == 0) { return double.NaN; } @@ -601,16 +604,16 @@ public static List AddApertures(this Panel panel, ApertureConstruction } } - if(face3Ds_Aperture == null || face3Ds_Aperture.Count == 0) + if (face3Ds_Aperture == null || face3Ds_Aperture.Count == 0) { return null; } List result = new List(); - foreach(Face3D face3D_Aperture in face3Ds_Aperture) + foreach (Face3D face3D_Aperture in face3Ds_Aperture) { List apertures = panel.AddApertures(apertureConstruction, face3D_Aperture, false, tolerance_Area, tolerance, tolerance); - if(apertures == null) + if (apertures == null) { continue; } @@ -648,7 +651,7 @@ public static List AddApertures(this Panel panel, ApertureConstruction Face3D face3D = panel.GetFace3D(); if (face3D == null) return null; - + Plane plane = face3D.GetPlane(); if (plane == null) return null; @@ -767,7 +770,7 @@ public static List AddApertures(this Panel panel, Aperture aperture, b } ApertureConstruction apertureConstruction = aperture.ApertureConstruction; - foreach(Face2D face2D_Aperture_New in face2Ds_Aperture_New) + foreach (Face2D face2D_Aperture_New in face2Ds_Aperture_New) { if (face2D_Aperture_New == null) @@ -784,7 +787,7 @@ public static List AddApertures(this Panel panel, Aperture aperture, b Point3D point3D_Location = Query.OpeningLocation(face3D_Aperture_New, tolerance); Aperture aperture_New = new Aperture(apertureConstruction, face3D_Aperture_New, point3D_Location); - if(result.Find(x => x.Guid == aperture.Guid) == null) + if (result.Find(x => x.Guid == aperture.Guid) == null) { aperture_New = new Aperture(aperture.Guid, aperture_New); } @@ -803,4 +806,4 @@ public static List AddApertures(this Panel panel, Aperture aperture, b return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/AddMechanicalSystem.cs b/SAM/SAM.Analytical/Modify/AddMechanicalSystem.cs index 6bd229554..1a008f16b 100644 --- a/SAM/SAM.Analytical/Modify/AddMechanicalSystem.cs +++ b/SAM/SAM.Analytical/Modify/AddMechanicalSystem.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { public static partial class Modify @@ -43,7 +46,7 @@ public static MechanicalSystem AddMechanicalSystem(this AdjacencyCluster adjacen adjacencyCluster.AddObject(mechanicalSystem); - if(spaces_Temp == null || spaces_Temp.Count == 0) + if (spaces_Temp == null || spaces_Temp.Count == 0) { return mechanicalSystem; } @@ -90,4 +93,4 @@ public static MechanicalSystem AddMechanicalSystem(this AdjacencyCluster adjacen return mechanicalSystem; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/AddMechanicalSystems.cs b/SAM/SAM.Analytical/Modify/AddMechanicalSystems.cs index fbae4bea6..c1b22d059 100644 --- a/SAM/SAM.Analytical/Modify/AddMechanicalSystems.cs +++ b/SAM/SAM.Analytical/Modify/AddMechanicalSystems.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -31,7 +34,7 @@ public static List AddMechanicalSystems(this AdjacencyCluster } Dictionary dictionary_MechanicalSystemType = new Dictionary(); - + Dictionary> dictionary_Ventilation = new Dictionary>(); Dictionary> dictionary_Cooling = new Dictionary>(); Dictionary> dictionary_Heating = new Dictionary>(); @@ -44,7 +47,7 @@ public static List AddMechanicalSystems(this AdjacencyCluster Space space_Temp = new Space(space); VentilationSystemType ventilationSystemType = internalCondition.GetSystemType(systemTypeLibrary); - if(ventilationSystemType != null) + if (ventilationSystemType != null) { List spaces_SystemType = null; if (!dictionary_Ventilation.TryGetValue(ventilationSystemType.Guid, out spaces_SystemType)) @@ -88,7 +91,7 @@ public static List AddMechanicalSystems(this AdjacencyCluster } List result = new List(); - foreach(KeyValuePair> keyValuePair in dictionary_Ventilation) + foreach (KeyValuePair> keyValuePair in dictionary_Ventilation) { VentilationSystemType ventilationSystemType = dictionary_MechanicalSystemType[keyValuePair.Key] as VentilationSystemType; if (ventilationSystemType == null) @@ -105,8 +108,8 @@ public static List AddMechanicalSystems(this AdjacencyCluster supplyUnitName_Temp = null; exhaustUnitName_Temp = null; } - - if(name.Equals("EOC") || name.Equals("EOL")) + + if (name.Equals("EOC") || name.Equals("EOL")) { supplyUnitName_Temp = null; } @@ -116,9 +119,9 @@ public static List AddMechanicalSystems(this AdjacencyCluster if (mechanicalSystem == null) continue; - if(ventilationRiserName != null) + if (ventilationRiserName != null) { - if(!string.IsNullOrWhiteSpace(name) && !name.Equals("NV") && !name.Equals("UV")) + if (!string.IsNullOrWhiteSpace(name) && !name.Equals("NV") && !name.Equals("UV")) { foreach (Space space in keyValuePair.Value) { @@ -218,4 +221,4 @@ public static List AddMechanicalSystems(this AdjacencyCluster return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/AddMissingMaterials.cs b/SAM/SAM.Analytical/Modify/AddMissingMaterials.cs index 2d76e6873..4045a6052 100644 --- a/SAM/SAM.Analytical/Modify/AddMissingMaterials.cs +++ b/SAM/SAM.Analytical/Modify/AddMissingMaterials.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -13,8 +16,8 @@ public static partial class Modify public static List AddMissingMaterials(this AnalyticalModel analyticalModel, Core.MaterialLibrary materialLibrary, out List missingMaterialNames) { missingMaterialNames = null; - - if(analyticalModel == null || materialLibrary == null) + + if (analyticalModel == null || materialLibrary == null) { return null; } @@ -22,21 +25,21 @@ public static partial class Modify List result = new List(); List materialNames = analyticalModel.GetMissingMaterialNames(); - if(materialNames == null || materialNames.Count == 0) + if (materialNames == null || materialNames.Count == 0) { return result; } missingMaterialNames = new List(); - foreach(string materialName in materialNames) + foreach (string materialName in materialNames) { - if(string.IsNullOrWhiteSpace(materialName)) + if (string.IsNullOrWhiteSpace(materialName)) { continue; } Core.IMaterial material = materialLibrary.GetMaterial(materialName); - if(material == null) + if (material == null) { missingMaterialNames.Add(materialName); } @@ -50,4 +53,4 @@ public static partial class Modify return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/AddPanels.cs b/SAM/SAM.Analytical/Modify/AddPanels.cs index 547c44900..235c5b665 100644 --- a/SAM/SAM.Analytical/Modify/AddPanels.cs +++ b/SAM/SAM.Analytical/Modify/AddPanels.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System; using System.Collections.Generic; using System.Linq; @@ -9,13 +12,13 @@ public static partial class Modify { public static List AddPanels(this AdjacencyCluster adjacencyCluster, IEnumerable face3Ds, Construction construction, IEnumerable spaces = null, double silverSpacing = Core.Tolerance.MacroDistance, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance, double tolerance_Snap = Core.Tolerance.MacroDistance) { - if(adjacencyCluster == null || face3Ds == null) + if (adjacencyCluster == null || face3Ds == null) { return null; } List spaces_Temp = spaces == null ? adjacencyCluster.GetSpaces() : new List(spaces); - if(spaces_Temp == null || spaces_Temp.Count == 0) + if (spaces_Temp == null || spaces_Temp.Count == 0) { return null; } @@ -25,29 +28,29 @@ public static List AddPanels(this AdjacencyCluster adjacencyCluster, IEnu List result = new List(); - foreach(Space space in spaces_Temp) + foreach (Space space in spaces_Temp) { Shell shell = adjacencyCluster.Shell(space); BoundingBox3D boundingBox3D_Shell = shell?.GetBoundingBox(); - if(boundingBox3D_Shell == null) + if (boundingBox3D_Shell == null) { continue; } - if(!boundingBox3D.InRange(boundingBox3D_Shell, tolerance_Snap)) + if (!boundingBox3D.InRange(boundingBox3D_Shell, tolerance_Snap)) { continue; } List face3Ds_Temp = tuples.FindAll(x => x.Item2.InRange(boundingBox3D_Shell, tolerance_Snap))?.ConvertAll(x => x.Item1); - if(face3Ds_Temp == null || face3Ds_Temp.Count == 0) + if (face3Ds_Temp == null || face3Ds_Temp.Count == 0) { continue; } List shells_Split = Geometry.Spatial.Query.Split(shell, face3Ds_Temp, tolerance_Snap, tolerance_Angle, tolerance_Distance); - if(shells_Split == null || shells_Split.Count < 2) + if (shells_Split == null || shells_Split.Count < 2) { continue; } @@ -55,26 +58,26 @@ public static List AddPanels(this AdjacencyCluster adjacencyCluster, IEnu List panels = adjacencyCluster.GetPanels(space); PanelType panelType = PanelType.Air; - if(construction != null) + if (construction != null) { panelType = construction.PanelType(); } - if(panelType == PanelType.Undefined) + if (panelType == PanelType.Undefined) { panelType = PanelType.Air; } - else if(panelType == PanelType.Wall) + else if (panelType == PanelType.Wall) { panelType = PanelType.WallInternal; } - else if(panelType == PanelType.Floor) + else if (panelType == PanelType.Floor) { panelType = PanelType.FloorInternal; } List panels_New = new List(); - for(int i = 0; i < shells_Split.Count; i++) + for (int i = 0; i < shells_Split.Count; i++) { Shell shell_Split = shells_Split[i]; @@ -84,7 +87,7 @@ public static List AddPanels(this AdjacencyCluster adjacencyCluster, IEnu continue; } string name = space.Name; - if(name != null) + if (name != null) { name += string.Format("_{0}", i + 1); } @@ -94,10 +97,10 @@ public static List AddPanels(this AdjacencyCluster adjacencyCluster, IEnu adjacencyCluster.AddObject(space_Shell); List face3Ds_Shell = shell_Split.Face3Ds; - foreach(Face3D face3D_Shell in face3Ds_Shell) + foreach (Face3D face3D_Shell in face3Ds_Shell) { Point3D point3D_Face3D = face3D_Shell?.GetInternalPoint3D(tolerance_Distance); - if(point3D_Face3D == null) + if (point3D_Face3D == null) { continue; } @@ -123,7 +126,7 @@ public static List AddPanels(this AdjacencyCluster adjacencyCluster, IEnu panel = Create.Panel(Guid.NewGuid(), panel, face3D_Shell, null, true); } - if(spaces_Panel == null) + if (spaces_Panel == null) { spaces_Panel = new List(); } @@ -150,7 +153,7 @@ public static List AddPanels(this AdjacencyCluster adjacencyCluster, IEnu panel_Temp = adjacencyCluster.GetPanel(aperture); } - if(guid == aperture.Guid) + if (guid == aperture.Guid) { continue; } @@ -162,7 +165,7 @@ public static List AddPanels(this AdjacencyCluster adjacencyCluster, IEnu adjacencyCluster.AddObject(panel); - foreach(Space space_Panel in spaces_Panel) + foreach (Space space_Panel in spaces_Panel) { adjacencyCluster.AddRelation(space_Panel, panel); } @@ -173,7 +176,7 @@ public static List AddPanels(this AdjacencyCluster adjacencyCluster, IEnu result.AddRange(panels_New); - foreach(Panel panel in panels) + foreach (Panel panel in panels) { adjacencyCluster.RemoveObject(panel.Guid); } @@ -184,4 +187,4 @@ public static List AddPanels(this AdjacencyCluster adjacencyCluster, IEnu return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/AddResults.cs b/SAM/SAM.Analytical/Modify/AddResults.cs index b15c72e86..a35421b2c 100644 --- a/SAM/SAM.Analytical/Modify/AddResults.cs +++ b/SAM/SAM.Analytical/Modify/AddResults.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System; using System.Collections.Generic; using System.Linq; @@ -25,22 +28,22 @@ public static void AddResults(this AdjacencyCluster adjacencyCluster, IEnumerabl result_Temp = result; } - if(simplify) + if (simplify) { - if(result_Temp is TM52ExtendedResult) + if (result_Temp is TM52ExtendedResult) { result_Temp = ((TM52ExtendedResult)result_Temp).Simplify(); } } - + adjacencyCluster.AddObject(result_Temp); - + if (result_Temp is SpaceSimulationResult) { SpaceSimulationResult spaceSimulationResult = (SpaceSimulationResult)result_Temp; Space space = null; - if(Core.Query.TryConvert(spaceSimulationResult.Reference, out Guid guid)) + if (Core.Query.TryConvert(spaceSimulationResult.Reference, out Guid guid)) { if (spaces == null) { @@ -50,16 +53,16 @@ public static void AddResults(this AdjacencyCluster adjacencyCluster, IEnumerabl space = spaces?.Find(x => x.Guid == guid); } - if(space == null) + if (space == null) { ObjectReference objectReference = Core.Convert.ComplexReference(spaceSimulationResult.Reference); - if(objectReference != null) + if (objectReference != null) { space = adjacencyCluster?.GetObjects(objectReference)?.FirstOrDefault(); } } - if(space == null) + if (space == null) { if (spaces == null) { @@ -74,12 +77,12 @@ public static void AddResults(this AdjacencyCluster adjacencyCluster, IEnumerabl } } - if(space != null) + if (space != null) { adjacencyCluster.AddRelation(space, spaceSimulationResult); } } - else if(result_Temp is SurfaceSimulationResult) + else if (result_Temp is SurfaceSimulationResult) { SurfaceSimulationResult surfaceSimulationResult = (SurfaceSimulationResult)result_Temp; @@ -258,4 +261,4 @@ public static void AddResults(this AdjacencyCluster adjacencyCluster, IEnumerabl } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/AddSingleOpeningProperties.cs b/SAM/SAM.Analytical/Modify/AddSingleOpeningProperties.cs index 8140d66b9..d65e21490 100644 --- a/SAM/SAM.Analytical/Modify/AddSingleOpeningProperties.cs +++ b/SAM/SAM.Analytical/Modify/AddSingleOpeningProperties.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -16,12 +19,12 @@ public static bool AddSingleOpeningProperties(this Aperture aperture, ISingleOpe return aperture.SetValue(ApertureParameter.OpeningProperties, singleOpeningProperties); } - if(openingProperties is MultipleOpeningProperties) + if (openingProperties is MultipleOpeningProperties) { MultipleOpeningProperties multipleOpeningProperties = (MultipleOpeningProperties)openingProperties; List singleOpeningProperties_Temp = multipleOpeningProperties.SingleOpeningProperties; - if(singleOpeningProperties_Temp == null) + if (singleOpeningProperties_Temp == null) { singleOpeningProperties_Temp = new List(); } @@ -33,7 +36,7 @@ public static bool AddSingleOpeningProperties(this Aperture aperture, ISingleOpe return aperture.SetValue(ApertureParameter.OpeningProperties, multipleOpeningProperties); } - if(openingProperties is ISingleOpeningProperties) + if (openingProperties is ISingleOpeningProperties) { List singleOpeningProperties_Temp = new List() { (ISingleOpeningProperties)openingProperties, singleOpeningProperties }; @@ -45,4 +48,4 @@ public static bool AddSingleOpeningProperties(this Aperture aperture, ISingleOpe return false; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/AddSpace.cs b/SAM/SAM.Analytical/Modify/AddSpace.cs index 771fb77e5..6ceb81dd5 100644 --- a/SAM/SAM.Analytical/Modify/AddSpace.cs +++ b/SAM/SAM.Analytical/Modify/AddSpace.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -15,8 +18,8 @@ public static bool AddSpace(this AdjacencyCluster adjacencyCluster, Space space, { return false; } - - if(panels != null) + + if (panels != null) { foreach (Panel panel in panels) { @@ -30,4 +33,4 @@ public static bool AddSpace(this AdjacencyCluster adjacencyCluster, Space space, return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/AddVentilationSystem.cs b/SAM/SAM.Analytical/Modify/AddVentilationSystem.cs index 05a9edaec..d187b3f39 100644 --- a/SAM/SAM.Analytical/Modify/AddVentilationSystem.cs +++ b/SAM/SAM.Analytical/Modify/AddVentilationSystem.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -63,7 +66,7 @@ public static VentilationSystem AddVentilationSystem(this AdjacencyCluster adjac { return null; } - + VentilationSystemType ventilationSystemType = internalCondition.GetSystemType(systemTypeLibrary); string systemTypeName = ventilationSystemType?.Name; if (string.IsNullOrWhiteSpace(systemTypeName)) @@ -91,16 +94,16 @@ public static VentilationSystem AddVentilationSystem(this AdjacencyCluster adjac if (ventilationSystems != null && ventilationSystems.Count != 0) { ventilationSystems = ventilationSystems.FindAll(x => x.Type?.Name == systemTypeName); - if(ventilationSystems != null && ventilationSystems.Count != 0) + if (ventilationSystems != null && ventilationSystems.Count != 0) { for (int i = ventilationSystems.Count - 1; i >= 0; i--) { VentilationSystem ventilationSystem_Temp = ventilationSystems[i]; - if(!string.IsNullOrWhiteSpace(supplyUnitName_Temp)) + if (!string.IsNullOrWhiteSpace(supplyUnitName_Temp)) { string unitName = ventilationSystem_Temp.GetValue(VentilationSystemParameter.SupplyUnitName); - if(unitName != supplyUnitName_Temp) + if (unitName != supplyUnitName_Temp) { ventilationSystems.RemoveAt(i); continue; @@ -119,20 +122,20 @@ public static VentilationSystem AddVentilationSystem(this AdjacencyCluster adjac } } - if(ventilationSystems != null && ventilationSystems.Count != 0) + if (ventilationSystems != null && ventilationSystems.Count != 0) { result = ventilationSystems[0]; } } - if(result != null) + if (result != null) { adjacencyCluster.AssignMechanicalSystem(result, spaces, allowMultipleSystems); } else { result = adjacencyCluster.AddMechanicalSystem(ventilationSystemType, spaces, allowMultipleSystems) as VentilationSystem; - if(result != null) + if (result != null) { //Supply Air Handling Unit if (!string.IsNullOrWhiteSpace(supplyUnitName_Temp)) @@ -173,4 +176,4 @@ public static VentilationSystem AddVentilationSystem(this AdjacencyCluster adjac return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/Align.cs b/SAM/SAM.Analytical/Modify/Align.cs index d9ddede97..aa019d909 100644 --- a/SAM/SAM.Analytical/Modify/Align.cs +++ b/SAM/SAM.Analytical/Modify/Align.cs @@ -1,8 +1,11 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Object.Spatial; using SAM.Geometry.Planar; +using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; -using SAM.Geometry.Object.Spatial; namespace SAM.Analytical { @@ -16,13 +19,13 @@ public static void Align(this List panels, double elevation, double refer } List panels_Temp = panels.FilterByElevation(elevation, out List panels_Lower, out List panels_Upper, tolerance_Distance); - if(panels_Temp == null || panels_Temp.Count == 0) + if (panels_Temp == null || panels_Temp.Count == 0) { return; } - + List panels_Reference = panels.FilterByElevation(referenceElevation, out panels_Lower, out panels_Upper); - if(panels_Reference == null || panels_Reference.Count == 0) + if (panels_Reference == null || panels_Reference.Count == 0) { return; } @@ -56,10 +59,10 @@ public static void Align(this List panels, double elevation, double refer Align(panels_Temp, dictionary_Reference, maxDistance, tolerance_Angle, tolerance_Distance); - for(int i=0; i < indexes.Count; i++) + for (int i = 0; i < indexes.Count; i++) { int index = indexes[i]; - if(index == -1) + if (index == -1) { continue; } @@ -109,7 +112,7 @@ public static void Align(this List panels, Dictionary d foreach (Segment2D segment2D_Temp in segment2Ds_Temp) { double distance = segment2D_Temp.Distance(segment2D, Core.Tolerance.MacroDistance); - if(distance < tolerance_Distance) + if (distance < tolerance_Distance) { segment2Ds_Result = null; break; @@ -199,7 +202,7 @@ public static void Align(this List panels, Dictionary d panels_Temp.Remove(panel); Dictionary> panels_Connected = Geometry.Object.Spatial.Query.IntersectionDictionary(panel, panels_Temp, tolerance_Angle, tolerance_Distance); - panel = new Panel(panel); + panel = new Panel(panel); panel.Move(vector3D); panels[i] = panel; @@ -220,24 +223,24 @@ public static void Align(this List panels, Dictionary d Point3D point3D = null; List geometry3Ds = panels_Connected[panel_Connected]; - foreach(ISAMGeometry3D sAMGeometry3D in geometry3Ds) + foreach (ISAMGeometry3D sAMGeometry3D in geometry3Ds) { - if(sAMGeometry3D is Segment3D) + if (sAMGeometry3D is Segment3D) { point3D = ((Segment3D)sAMGeometry3D).Mid(); } - else if(sAMGeometry3D is Point3D) + else if (sAMGeometry3D is Point3D) { point3D = (Point3D)sAMGeometry3D; } - if(point3D != null) + if (point3D != null) { break; } } - if(point3D != null) + if (point3D != null) { List panels_Connected_Temp = Query.Panels(point3D, panels, true, tolerance_Distance); if (panels_Connected_Temp != null && panels_Connected_Temp.Count != 1) @@ -249,7 +252,7 @@ public static void Align(this List panels, Dictionary d } } - + Face3D face3D_Connected = panel_Connected?.GetFace3D(); if (face3D_Connected == null) continue; @@ -257,10 +260,10 @@ public static void Align(this List panels, Dictionary d Face3D face3D_Connected_New = null; PlanarIntersectionResult planarIntersectionResult_Temp = Geometry.Spatial.Create.PlanarIntersectionResult(plane_Panel, face3D_Connected, tolerance_Angle, tolerance_Distance); - if(planarIntersectionResult_Temp != null && planarIntersectionResult_Temp.Intersecting) + if (planarIntersectionResult_Temp != null && planarIntersectionResult_Temp.Intersecting) { List segmentable3Ds = planarIntersectionResult_Temp.GetGeometry3Ds(); - if(segmentable3Ds != null && segmentable3Ds.Count > 0) + if (segmentable3Ds != null && segmentable3Ds.Count > 0) { List face3Ds = Geometry.Spatial.Query.Cut(face3D_Connected, plane_Panel, tolerance_Distance); if (face3Ds != null && face3Ds.Count != 0) @@ -274,7 +277,7 @@ public static void Align(this List panels, Dictionary d { face3D_Connected_New = Geometry.Spatial.Query.Extend(face3D_Connected, plane_Panel, tolerance_Angle, tolerance_Distance); } - + if (face3D_Connected_New == null) continue; @@ -293,4 +296,4 @@ public static void Align(this List panels, Dictionary d } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/AssignAdjacencyCluster.cs b/SAM/SAM.Analytical/Modify/AssignAdjacencyCluster.cs index 344589d74..b297ec2aa 100644 --- a/SAM/SAM.Analytical/Modify/AssignAdjacencyCluster.cs +++ b/SAM/SAM.Analytical/Modify/AssignAdjacencyCluster.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Analytical { @@ -15,7 +18,7 @@ public static void AssignAdjacencyCluster(this IFilter filter, AdjacencyCluster { ((LogicalFilter)filter).Filters?.ForEach(x => AssignAdjacencyCluster(x, adjacencyCluster)); } - else if(filter is IRelationFilter) + else if (filter is IRelationFilter) { AssignAdjacencyCluster(((IRelationFilter)filter).Filter, adjacencyCluster); } @@ -29,4 +32,4 @@ public static void AssignAdjacencyCluster(this IFilter filter, AdjacencyCluster } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/AssignMechanicalSystem.cs b/SAM/SAM.Analytical/Modify/AssignMechanicalSystem.cs index 253b839ca..045498540 100644 --- a/SAM/SAM.Analytical/Modify/AssignMechanicalSystem.cs +++ b/SAM/SAM.Analytical/Modify/AssignMechanicalSystem.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { public static partial class Modify @@ -37,21 +40,21 @@ public static void AssignMechanicalSystem(this AdjacencyCluster adjacencyCluster MechanicalSystemType mechanicalSystemType = mechanicalSystem.Type; - foreach(Space space in spaces_Temp) + foreach (Space space in spaces_Temp) { - if(space == null) + if (space == null) { continue; } - if(!allowMultipleSystems) + if (!allowMultipleSystems) { List mechanicalSystems_Space = adjacencyCluster.GetRelatedObjects(space); - if(mechanicalSystems_Space != null) + if (mechanicalSystems_Space != null) { - foreach(MechanicalSystem mechanicalSystem_Space in mechanicalSystems_Space) + foreach (MechanicalSystem mechanicalSystem_Space in mechanicalSystems_Space) { - if(mechanicalSystem_Space.MechanicalSystemCategory() == mechanicalSystemType.MechanicalSystemCategory()) + if (mechanicalSystem_Space.MechanicalSystemCategory() == mechanicalSystemType.MechanicalSystemCategory()) { adjacencyCluster.RemoveRelation(space, mechanicalSystem_Space); } @@ -60,10 +63,10 @@ public static void AssignMechanicalSystem(this AdjacencyCluster adjacencyCluster } InternalCondition internalCondition = space.InternalCondition; - if(internalCondition != null) + if (internalCondition != null) { InternalConditionParameter? internalConditionParameter = Query.SystemTypeInternalConditionParameter(mechanicalSystem.MechanicalSystemCategory()); - if(internalConditionParameter != null && internalConditionParameter.HasValue) + if (internalConditionParameter != null && internalConditionParameter.HasValue) { internalCondition.SetValue(internalConditionParameter.Value, mechanicalSystem.Name); space.InternalCondition = internalCondition; @@ -75,4 +78,4 @@ public static void AssignMechanicalSystem(this AdjacencyCluster adjacencyCluster } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/AssignSpaceColors.cs b/SAM/SAM.Analytical/Modify/AssignSpaceColors.cs index f4fa22889..58f5d8438 100644 --- a/SAM/SAM.Analytical/Modify/AssignSpaceColors.cs +++ b/SAM/SAM.Analytical/Modify/AssignSpaceColors.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Drawing; @@ -9,15 +12,15 @@ public static partial class Modify public static Dictionary AssignSpaceColors(this AdjacencyCluster adjacencyCluster) { List spaces = adjacencyCluster?.GetSpaces(); - if(spaces == null || spaces.Count == 0) + if (spaces == null || spaces.Count == 0) { return null; } Dictionary>> dictionary = new Dictionary>>(); - foreach(Space space in spaces) + foreach (Space space in spaces) { InternalCondition internalCondition = space?.InternalCondition; - if(internalCondition == null) + if (internalCondition == null) { continue; } @@ -28,12 +31,12 @@ public static Dictionary AssignSpaceColors(this AdjacencyCluster ad } string name = internalCondition.Name; - if(string.IsNullOrWhiteSpace(name)) + if (string.IsNullOrWhiteSpace(name)) { continue; } - if(!dictionary.TryGetValue(name, out Tuple> tuple) || tuple == null) + if (!dictionary.TryGetValue(name, out Tuple> tuple) || tuple == null) { tuple = new Tuple>(sAMColor.ToColor(), new List()); dictionary[name] = tuple; @@ -51,12 +54,12 @@ public static Dictionary AssignSpaceColors(this AdjacencyCluster ad List colors = Core.Create.Colors(color, spaces_Color.Count, 0, 0.8); //MD to control order of colors first raw and than variations colors.Reverse(); - if(colors == null || colors.Count != spaces_Color.Count) + if (colors == null || colors.Count != spaces_Color.Count) { continue; } - for(int i = 0; i < colors.Count; i++) + for (int i = 0; i < colors.Count; i++) { spaces_Color[i].SetValue(SpaceParameter.Color, colors[i]); result[spaces_Color[i].Guid] = colors[i]; @@ -66,4 +69,4 @@ public static Dictionary AssignSpaceColors(this AdjacencyCluster ad return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/ChangeExternalSpaces.cs b/SAM/SAM.Analytical/Modify/ChangeExternalSpaces.cs index 05fb94aa3..b3758df7b 100644 --- a/SAM/SAM.Analytical/Modify/ChangeExternalSpaces.cs +++ b/SAM/SAM.Analytical/Modify/ChangeExternalSpaces.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -15,12 +18,12 @@ public static List ChangeExternalSpaces(this AdjacencyCluster adj List result = new List(); - foreach(Space space in spaces) + foreach (Space space in spaces) { List panels = adjacencyCluster.GetPanels(space); - if(panels == null || panels.Count == 0) + if (panels == null || panels.Count == 0) { - continue; + continue; } ExternalSpace externalSpace = new ExternalSpace(space.Name, space.Location); @@ -29,14 +32,14 @@ public static List ChangeExternalSpaces(this AdjacencyCluster adj foreach (Panel panel in panels) { - List spaces_Panel = adjacencyCluster.GetRelatedObjects(panel); - if(spaces_Panel != null && spaces_Panel.Count > 1) + List spaces_Panel = adjacencyCluster.GetRelatedObjects(panel); + if (spaces_Panel != null && spaces_Panel.Count > 1) { Panel panel_New = new Panel(panel); PanelType panelType = panel.PanelType; - switch(panel.PanelGroup) + switch (panel.PanelGroup) { case PanelGroup.Wall: panel_New = new Panel(panel_New, PanelType.WallExternal); @@ -51,7 +54,7 @@ public static List ChangeExternalSpaces(this AdjacencyCluster adj break; } - if(panel_New.PanelType != panelType) + if (panel_New.PanelType != panelType) { Construction construction_Default = Query.DefaultConstruction(panel_New.PanelType); if (construction_Default != null) @@ -67,7 +70,7 @@ public static List ChangeExternalSpaces(this AdjacencyCluster adj Construction construction = null; - switch(panel.PanelGroup) + switch (panel.PanelGroup) { case PanelGroup.Roof: construction = construction_Roof; @@ -97,19 +100,19 @@ public static List ChangeExternalSpaces(this AdjacencyCluster adj public static List ChangeExternalSpaces(this AdjacencyCluster adjacencyCluster, IEnumerable point3Ds, Construction construction_Wall, Construction construction_Floor, Construction construction_Roof, double silverSpace = Core.Tolerance.MacroDistance, double tolerance = Core.Tolerance.Distance) { - if(adjacencyCluster == null || point3Ds == null) + if (adjacencyCluster == null || point3Ds == null) { return null; } List> spacesList = adjacencyCluster.GetSpaces(point3Ds, false, silverSpace, tolerance); - if(spacesList == null) + if (spacesList == null) { return null; } Dictionary dictioray = new Dictionary(); - foreach(List spaces in spacesList) + foreach (List spaces in spacesList) { spaces?.ForEach(x => dictioray[x.Guid] = x); } @@ -117,4 +120,4 @@ public static List ChangeExternalSpaces(this AdjacencyCluster adj return ChangeExternalSpaces(adjacencyCluster, dictioray.Values, construction_Wall, construction_Floor, construction_Roof, silverSpace, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/CopyZones.cs b/SAM/SAM.Analytical/Modify/CopyZones.cs index 403bd73aa..502555910 100644 --- a/SAM/SAM.Analytical/Modify/CopyZones.cs +++ b/SAM/SAM.Analytical/Modify/CopyZones.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -8,7 +11,7 @@ public static partial class Modify { public static List CopyZones(this AdjacencyCluster adjacencyCluster_Destination, AdjacencyCluster adjacencyCluster_Source, IEnumerable zoneGuids) { - if(adjacencyCluster_Destination == null || adjacencyCluster_Source == null || zoneGuids == null) + if (adjacencyCluster_Destination == null || adjacencyCluster_Source == null || zoneGuids == null) { return null; } @@ -20,14 +23,14 @@ public static List CopyZones(this AdjacencyCluster adjacencyCluster_Destin foreach (Guid zoneGuid in zoneGuids) { Zone zone_Source = adjacencyCluster_Source.GetObject(zoneGuid); - if(zone_Source == null) + if (zone_Source == null) { continue; } List spaces_Destination = new List(); - if(dictionary_Destination != null) + if (dictionary_Destination != null) { List spaces_Source = adjacencyCluster_Source.GetRelatedObjects(zone_Source); if (spaces_Source != null && spaces_Source.Count != 0) @@ -54,13 +57,13 @@ public static List CopyZones(this AdjacencyCluster adjacencyCluster_Destin } } - if(!zone_Source.TryGetValue(ZoneParameter.ZoneCategory, out string zoneCategory)) + if (!zone_Source.TryGetValue(ZoneParameter.ZoneCategory, out string zoneCategory)) { zoneCategory = null; } Zone zone_Destination = adjacencyCluster_Destination.UpdateZone(zone_Source.Name, zoneCategory, spaces_Destination.ToArray()); - if(zone_Destination != null) + if (zone_Destination != null) { result.Add(zone_Destination); } @@ -69,4 +72,4 @@ public static List CopyZones(this AdjacencyCluster adjacencyCluster_Destin return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/Cut.cs b/SAM/SAM.Analytical/Modify/Cut.cs index 5f2bc2f73..b9ecc548b 100644 --- a/SAM/SAM.Analytical/Modify/Cut.cs +++ b/SAM/SAM.Analytical/Modify/Cut.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -20,24 +23,24 @@ public static List Cut(this AdjacencyCluster adjacencyCluster, Plane plan } List panels = null; - if(spaces == null || spaces.Count() == 0) + if (spaces == null || spaces.Count() == 0) { panels = adjacencyCluster.GetPanels(); } else { panels = new List(); - foreach(Space space in spaces) + foreach (Space space in spaces) { List panels_Space = adjacencyCluster.GetPanels(space); - if(panels_Space == null || panels_Space.Count == 0) + if (panels_Space == null || panels_Space.Count == 0) { continue; } - foreach(Panel panel_Space in panels_Space) + foreach (Panel panel_Space in panels_Space) { - if(panels.Find(x => x.Guid == panel_Space.Guid) == null) + if (panels.Find(x => x.Guid == panel_Space.Guid) == null) { panels.Add(panel_Space); } @@ -73,4 +76,4 @@ public static List Cut(this AdjacencyCluster adjacencyCluster, Plane plan return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/Extend.cs b/SAM/SAM.Analytical/Modify/Extend.cs index e673cd2ea..0782c9a04 100644 --- a/SAM/SAM.Analytical/Modify/Extend.cs +++ b/SAM/SAM.Analytical/Modify/Extend.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -82,7 +85,7 @@ public static void Extend(this List panels, double elevation, double maxD panels_Extended = new List(); - foreach(Geometry.Planar.Segment2D segment2D in segment2Ds) + foreach (Geometry.Planar.Segment2D segment2D in segment2Ds) { Geometry.Planar.Point2D point2D_1 = segment2D[0]; Geometry.Planar.Point2D point2D_2 = segment2D[1]; @@ -185,4 +188,4 @@ public static void Extend(this List panels, double elevation, double maxD } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/ExtendExternal.cs b/SAM/SAM.Analytical/Modify/ExtendExternal.cs index 0242b19b6..5b75db49e 100644 --- a/SAM/SAM.Analytical/Modify/ExtendExternal.cs +++ b/SAM/SAM.Analytical/Modify/ExtendExternal.cs @@ -1,7 +1,10 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using SAM.Geometry.Spatial; +using System; using System.Collections.Generic; -using SAM.Geometry.Planar; using System.Linq; namespace SAM.Analytical @@ -87,10 +90,10 @@ public static void ExtendExternal(this List panels, double elevation, dou } else { - foreach(Polygon2D polygon2D_Temp in polygon2Ds) + foreach (Polygon2D polygon2D_Temp in polygon2Ds) { Point2D point2D = polygon2D_Temp.Points.Find(x => boundingBox2D_Segment2D.InRange(x, snapTolerance) && segment2D.On(x, snapTolerance)); - if(point2D != null) + if (point2D != null) { segment2Ds.Add(segment2D); break; @@ -98,14 +101,14 @@ public static void ExtendExternal(this List panels, double elevation, dou } } - if(!external) + if (!external) { BoundingBox2D boundingBox2D = segment2D.GetBoundingBox(); - foreach(Segment2D segment2D_Polygon2D in segment2Ds_Polygon2Ds) + foreach (Segment2D segment2D_Polygon2D in segment2Ds_Polygon2Ds) { - if(boundingBox2D.InRange(segment2D_Polygon2D.GetBoundingBox(), snapTolerance) && segment2D.Collinear(segment2D_Polygon2D, tolerance_Angle)) + if (boundingBox2D.InRange(segment2D_Polygon2D.GetBoundingBox(), snapTolerance) && segment2D.Collinear(segment2D_Polygon2D, tolerance_Angle)) { - if(segment2D.On(segment2D_Polygon2D[0], snapTolerance) || segment2D.On(segment2D_Polygon2D[1], snapTolerance) || segment2D_Polygon2D.On(segment2D[0], snapTolerance) || segment2D_Polygon2D.On(segment2D[1], snapTolerance)) + if (segment2D.On(segment2D_Polygon2D[0], snapTolerance) || segment2D.On(segment2D_Polygon2D[1], snapTolerance) || segment2D_Polygon2D.On(segment2D[0], snapTolerance) || segment2D_Polygon2D.On(segment2D[1], snapTolerance)) { external = true; } @@ -115,7 +118,7 @@ public static void ExtendExternal(this List panels, double elevation, dou } } - if(external) + if (external) { externalPanels.Add(keyValuePair.Key); } @@ -241,7 +244,7 @@ public static void ExtendExternal(this List panels, double elevation, dou Panel panel_New = new Panel(panel_Old.Guid, panel_Old, face3D); int index = panels.IndexOf(panel_Old); - if(index != -1) + if (index != -1) { if (dictionary.ContainsKey(panel_Old)) { @@ -252,7 +255,7 @@ public static void ExtendExternal(this List panels, double elevation, dou panels[index] = panel_New; index = externalPanels_Extended.IndexOf(panel_Old); - if(index != -1) + if (index != -1) { externalPanels_Extended[index] = panel_New; } @@ -260,14 +263,14 @@ public static void ExtendExternal(this List panels, double elevation, dou } } } - + public static void ExtendExternal(this List panels, IEnumerable elevations, double maxDistance, out List externalPanels, out List externalPanels_Extended, out List externalPolygon3Ds, double snapTolerance = Core.Tolerance.MacroDistance, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { externalPanels = null; externalPanels_Extended = null; externalPolygon3Ds = null; - if(panels == null || elevations == null) + if (panels == null || elevations == null) { return; } @@ -283,7 +286,7 @@ public static void ExtendExternal(this List panels, IEnumerable e externalPanels_Temp?.ForEach(x => dictionary[x.Guid] = x); externalPanels_Extended_Temp?.ForEach(x => dictionary_Extended[x.Guid] = x); - if(externalPolygon3Ds_Temp != null) + if (externalPolygon3Ds_Temp != null) { externalPolygon3Ds.AddRange(externalPolygon3Ds_Temp); } @@ -293,4 +296,4 @@ public static void ExtendExternal(this List panels, IEnumerable e externalPanels_Extended = dictionary_Extended.Values.ToList(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/FixAdjacencyCluster.cs b/SAM/SAM.Analytical/Modify/FixAdjacencyCluster.cs index 992dd895a..344bcec0e 100644 --- a/SAM/SAM.Analytical/Modify/FixAdjacencyCluster.cs +++ b/SAM/SAM.Analytical/Modify/FixAdjacencyCluster.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Analytical @@ -20,7 +23,7 @@ public static void FixAdjacencyCluster(this AdjacencyCluster adjacencyCluster, o return; Dictionary>>> dictionary = new Dictionary>>>(); - foreach(Panel panel in panels_AdjacencyCluster) + foreach (Panel panel in panels_AdjacencyCluster) { if (panel == null) continue; @@ -34,13 +37,13 @@ public static void FixAdjacencyCluster(this AdjacencyCluster adjacencyCluster, o continue; PanelGroup panelGroup = panel.PanelGroup; - if(!dictionary.TryGetValue(panelGroup, out Dictionary>> dictionary_Temp)) + if (!dictionary.TryGetValue(panelGroup, out Dictionary>> dictionary_Temp)) { dictionary_Temp = new Dictionary>>(); dictionary[panelGroup] = dictionary_Temp; } - if(!dictionary_Temp.TryGetValue(name, out Tuple> tuple)) + if (!dictionary_Temp.TryGetValue(name, out Tuple> tuple)) { tuple = new Tuple>(construction, new List()); dictionary_Temp[name] = tuple; @@ -55,18 +58,18 @@ public static void FixAdjacencyCluster(this AdjacencyCluster adjacencyCluster, o panels = new List(); prefixes_Panel = new List(); - + apertures = new List(); prefixes_Aperture = new List(); foreach (KeyValuePair>>> keyValuePair_PanelGroup in dictionary) { - foreach(KeyValuePair>> keyValuePair_Name in keyValuePair_PanelGroup.Value) + foreach (KeyValuePair>> keyValuePair_Name in keyValuePair_PanelGroup.Value) { Construction construction = keyValuePair_Name.Value.Item1; List panels_Temp = keyValuePair_Name.Value.Item2; - for(int i =0; i < panels_Temp.Count; i++) + for (int i = 0; i < panels_Temp.Count; i++) { panels_Temp[i] = new Panel(panels_Temp[i], construction); adjacencyCluster.AddObject(panels_Temp[i]); @@ -75,10 +78,10 @@ public static void FixAdjacencyCluster(this AdjacencyCluster adjacencyCluster, o List panels_Temp_External = panels_Temp?.FindAll(x => x.PanelGroup == PanelGroup.Floor || x.PanelGroup == PanelGroup.Roof); if (panels_Temp_External != null && panels_Temp_External.Count != 0) { - foreach(Panel panel in panels_Temp_External) + foreach (Panel panel in panels_Temp_External) { List spaces = adjacencyCluster.GetSpaces(panel); - if(spaces== null || spaces.Count == 0) + if (spaces == null || spaces.Count == 0) { adjacencyCluster.AddObject(new Panel(panel, PanelType.Shade)); } @@ -97,7 +100,7 @@ public static void FixAdjacencyCluster(this AdjacencyCluster adjacencyCluster, o Panel panel = panels_Temp[i]; Panel panel_New = null; - List spaces = adjacencyCluster.GetSpaces(panel); + List spaces = adjacencyCluster.GetSpaces(panel); if (spaces == null || spaces.Count == 0) { panel_New = new Panel(panel, PanelType.Shade); @@ -107,7 +110,7 @@ public static void FixAdjacencyCluster(this AdjacencyCluster adjacencyCluster, o bool external = spaces.Count == 1; PanelType panelType = panel.PanelType; - if(panelType == PanelType.Wall) + if (panelType == PanelType.Wall) { panelType = external ? PanelType.WallExternal : PanelType.WallInternal; panel = new Panel(panel, panelType); @@ -161,7 +164,7 @@ public static void FixAdjacencyCluster(this AdjacencyCluster adjacencyCluster, o name_New = "SIM_INT_SLD_Core" + name_Panel.Substring(("SIM_EXT_SLD").Length); prefix = "SIM_INT_SLD_Core"; } - + } if (string.IsNullOrWhiteSpace(name_New)) @@ -170,7 +173,7 @@ public static void FixAdjacencyCluster(this AdjacencyCluster adjacencyCluster, o if (!dictionary_Construction.TryGetValue(name_New, out Construction construction_New) || construction_New == null) { construction_New = new Construction(construction, name_New); - } + } panel_New = new Panel(panel, construction_New); if (external) @@ -179,19 +182,19 @@ public static void FixAdjacencyCluster(this AdjacencyCluster adjacencyCluster, o panel_New = new Panel(panel_New, PanelType.WallInternal); System.Drawing.Color color = Query.Color(panel_New.PanelType); - if(color != System.Drawing.Color.Empty) + if (color != System.Drawing.Color.Empty) { panel_New.SetValue(PanelParameter.Color, color); construction_New.SetValue(ConstructionParameter.Color, color); } List apertures_Panel = panel_New.Apertures; - if(apertures_Panel != null && apertures_Panel.Count != 0) + if (apertures_Panel != null && apertures_Panel.Count != 0) { - foreach(Aperture aperture in apertures_Panel) + foreach (Aperture aperture in apertures_Panel) { ApertureConstruction apertureConstruction = aperture.ApertureConstruction; - if(apertureConstruction != null) + if (apertureConstruction != null) { string name_Aperture = apertureConstruction.Name; //string prefix_Aperture = null; @@ -231,11 +234,11 @@ public static void FixAdjacencyCluster(this AdjacencyCluster adjacencyCluster, o apertureConstruction_New = new ApertureConstruction(apertureConstruction, name_New); } - if(apertureConstruction_New.ApertureType == ApertureType.Door) + if (apertureConstruction_New.ApertureType == ApertureType.Door) { color = Query.Color(apertureConstruction_New.ApertureType, AperturePart.Frame); } - else if(apertureConstruction_New.ApertureType == ApertureType.Window) + else if (apertureConstruction_New.ApertureType == ApertureType.Window) { color = Query.Color(apertureConstruction_New.ApertureType, AperturePart.Pane); } @@ -264,4 +267,4 @@ public static void FixAdjacencyCluster(this AdjacencyCluster adjacencyCluster, o panels.ForEach(x => adjacencyCluster.AddObject(x)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/Join.cs b/SAM/SAM.Analytical/Modify/Join.cs index b711921ee..581f6a038 100644 --- a/SAM/SAM.Analytical/Modify/Join.cs +++ b/SAM/SAM.Analytical/Modify/Join.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; namespace SAM.Analytical @@ -18,4 +21,4 @@ public static void Join(this List panels, double elevation, double distan Trim(panels, elevation, distance, out panels_Trimmed, out segment3Ds, snapTolerance, tolerance_Distance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/Map.cs b/SAM/SAM.Analytical/Modify/Map.cs index 01ccd4272..27af73e87 100644 --- a/SAM/SAM.Analytical/Modify/Map.cs +++ b/SAM/SAM.Analytical/Modify/Map.cs @@ -1,7 +1,10 @@ -using System; -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core; using SAM.Geometry.Spatial; +using System; +using System.Collections.Generic; namespace SAM.Analytical { @@ -60,9 +63,9 @@ public static void Map(this AdjacencyCluster adjacencyCluster_Source, AdjacencyC panels_Destination_Invalid.Add(panel_Destination); continue; } - - List> tuples_Source = tuples.FindAll(x => x.Item1.InRange(point3D, tolerance)); + + List> tuples_Source = tuples.FindAll(x => x.Item1.InRange(point3D, tolerance)); if (tuples_Source.Count == 0) { panels_Destination_Invalid.Add(panel_Destination); @@ -89,9 +92,9 @@ public static void Map(this AdjacencyCluster adjacencyCluster_Source, AdjacencyC if (spaces_Destination != null && spaces_Destination.Count != 0 && spaces_Source != null && spaces_Source.Count != 0) { Dictionary dictionary = adjacencyCluster_Destination.ShellDictionary(); - if(dictionary != null) + if (dictionary != null) { - foreach(KeyValuePair keyValuePair in dictionary) + foreach (KeyValuePair keyValuePair in dictionary) { List spaces_Source_Shell = spaces_Source.FindAll(x => keyValuePair.Value.InRange(x.Location, tolerance) || keyValuePair.Value.Inside(x.Location, tolerance)); if (spaces_Source_Shell == null || spaces_Source_Shell.Count == 0) @@ -108,4 +111,4 @@ public static void Map(this AdjacencyCluster adjacencyCluster_Source, AdjacencyC } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/MapInternalConditions.cs b/SAM/SAM.Analytical/Modify/MapInternalConditions.cs index 5361925fe..3fa713109 100644 --- a/SAM/SAM.Analytical/Modify/MapInternalConditions.cs +++ b/SAM/SAM.Analytical/Modify/MapInternalConditions.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Analytical @@ -62,4 +65,4 @@ public static List MapInternalConditions(this AdjacencyCluste return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/MapPanels.cs b/SAM/SAM.Analytical/Modify/MapPanels.cs index d3d4ff263..b0c7d19f8 100644 --- a/SAM/SAM.Analytical/Modify/MapPanels.cs +++ b/SAM/SAM.Analytical/Modify/MapPanels.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -23,7 +26,7 @@ public static List MapPanels(this AdjacencyCluster adjacencyCluster, IEnu return result; List> tuples = new List>(); - foreach(Panel panel_AdjacencyCluster in panels_AdjacencyCluster) + foreach (Panel panel_AdjacencyCluster in panels_AdjacencyCluster) { Point3D point3D = panel_AdjacencyCluster?.GetInternalPoint3D(); if (point3D == null) @@ -32,14 +35,14 @@ public static List MapPanels(this AdjacencyCluster adjacencyCluster, IEnu tuples.Add(new Tuple(point3D, panel_AdjacencyCluster)); } - foreach(Panel panel in panels) + foreach (Panel panel in panels) { Face3D face3D = panel?.GetFace3D(); if (face3D == null) continue; List panels_Panel = new List(); - foreach(Tuple tuple in tuples) + foreach (Tuple tuple in tuples) { double distance = face3D.Distance(tuple.Item1); if (distance <= maxDistance) @@ -49,7 +52,7 @@ public static List MapPanels(this AdjacencyCluster adjacencyCluster, IEnu if (panels_Panel == null || panels_Panel.Count == 0) continue; - for(int i =0; i < panels_Panel.Count; i++) + for (int i = 0; i < panels_Panel.Count; i++) { Panel panel_Panel = panels_Panel[i]; @@ -61,6 +64,6 @@ public static List MapPanels(this AdjacencyCluster adjacencyCluster, IEnu } return result; - } + } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/MapZones.cs b/SAM/SAM.Analytical/Modify/MapZones.cs index 6352bcc30..c0536cad3 100644 --- a/SAM/SAM.Analytical/Modify/MapZones.cs +++ b/SAM/SAM.Analytical/Modify/MapZones.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -43,4 +46,4 @@ public static List MapZones(this AdjacencyCluster adjacencyCluster, TextMa return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/Merge.cs b/SAM/SAM.Analytical/Modify/Merge.cs index 22ab27063..de9046e62 100644 --- a/SAM/SAM.Analytical/Modify/Merge.cs +++ b/SAM/SAM.Analytical/Modify/Merge.cs @@ -1,9 +1,11 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Object.Spatial; using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System; -using System.Collections; using System.Collections.Generic; using System.Linq; @@ -290,12 +292,12 @@ public static bool Merge(this AdjacencyCluster adjacencyCluster, Shell shell, do double groundElevation = 0; - if(adjacencyCluster.GetGroundPanels() is List groundPanels && groundPanels.Count > 0) + if (adjacencyCluster.GetGroundPanels() is List groundPanels && groundPanels.Count > 0) { groundElevation = double.MinValue; foreach (Panel groundPanel in groundPanels) { - if(groundPanel?.GetBoundingBox() is not BoundingBox3D boundingBox3D_GroundPanel) + if (groundPanel?.GetBoundingBox() is not BoundingBox3D boundingBox3D_GroundPanel) { continue; } @@ -308,7 +310,7 @@ public static bool Merge(this AdjacencyCluster adjacencyCluster, Shell shell, do } } - if(groundElevation == double.MinValue) + if (groundElevation == double.MinValue) { groundElevation = 0; } @@ -326,7 +328,7 @@ public static bool Merge(this AdjacencyCluster adjacencyCluster, Shell shell, do public static bool Merge(this AdjacencyCluster adjacencyCluster_Destination, AdjacencyCluster adjacencyCluster_Source, double silverSpacing = Tolerance.MacroDistance, double tolerance_Angle = Tolerance.Angle, double tolerance_Distance = Tolerance.Distance) { - if(adjacencyCluster_Destination is null || adjacencyCluster_Source is null) + if (adjacencyCluster_Destination is null || adjacencyCluster_Source is null) { return false; } @@ -343,21 +345,21 @@ public static bool Merge(this AdjacencyCluster adjacencyCluster_Destination, Adj //Find shade panels and boundingBoxes of source AdjacencyCluster Dictionary dictionary_Source = adjacencyCluster_Source.ShellDictionary(); - if(dictionary_Source is not null) + if (dictionary_Source is not null) { - foreach(KeyValuePair keyValuePair in dictionary_Source) + foreach (KeyValuePair keyValuePair in dictionary_Source) { - if(adjacencyCluster_Source.GetPanels( keyValuePair.Key) is not List panels_Space) + if (adjacencyCluster_Source.GetPanels(keyValuePair.Key) is not List panels_Space) { continue; } - foreach(Panel panel_Space in panels_Space) + foreach (Panel panel_Space in panels_Space) { dictionary_Panel_Source_Shade.Remove(panel_Space.Guid); } - if(keyValuePair.Value?.GetBoundingBox() is not BoundingBox3D boundingBox3D_Space) + if (keyValuePair.Value?.GetBoundingBox() is not BoundingBox3D boundingBox3D_Space) { continue; } @@ -375,26 +377,26 @@ public static bool Merge(this AdjacencyCluster adjacencyCluster_Destination, Adj } //Check if there is no spaces - if(dictionary_Source is null || dictionary_Source.Count == 0) + if (dictionary_Source is null || dictionary_Source.Count == 0) { //Return true if there was any shade panels merged to destination AnalyticalModel return dictionary_Panel_Source_Shade.Count > 0; } Dictionary dictionary_Destination = adjacencyCluster_Destination.ShellDictionary(); - + //Remove destination shells which does not interfere - if(dictionary_Destination != null && dictionary_Destination.Count != 0) + if (dictionary_Destination != null && dictionary_Destination.Count != 0) { Dictionary dictionary_Destination_Temp = []; foreach (KeyValuePair keyValuePair in dictionary_Destination) { - if(keyValuePair.Value.GetBoundingBox() is not BoundingBox3D boundingBox3D_Space) + if (keyValuePair.Value.GetBoundingBox() is not BoundingBox3D boundingBox3D_Space) { continue; } - if(!boundingBox3D_Source.InRange(boundingBox3D_Space, tolerance_Distance)) + if (!boundingBox3D_Source.InRange(boundingBox3D_Space, tolerance_Distance)) { continue; } @@ -406,7 +408,7 @@ public static bool Merge(this AdjacencyCluster adjacencyCluster_Destination, Adj } //Iterating through all spaces from source - foreach(KeyValuePair keyValuePair in dictionary_Source) + foreach (KeyValuePair keyValuePair in dictionary_Source) { Space space_Source = keyValuePair.Key; Shell shell_Source = keyValuePair.Value; @@ -418,7 +420,7 @@ public static bool Merge(this AdjacencyCluster adjacencyCluster_Destination, Adj //Find all spaces which interfere with source space List> tuples_Shell_Existing = []; - if(dictionary_Destination is not null) + if (dictionary_Destination is not null) { foreach (KeyValuePair keyValuePair_Temp in dictionary_Destination) { @@ -484,7 +486,7 @@ public static bool Merge(this AdjacencyCluster adjacencyCluster_Destination, Adj adjacencyCluster_Destination.RemoveObject(tuple_Shell_Existing.Item1); //foreach (Tuple tuple_Shell_New_Inside in tuples_Shell_New_Inside) - for(int j = 0; j < tuples_Shell_New_Inside.Count; j++) + for (int j = 0; j < tuples_Shell_New_Inside.Count; j++) { Tuple tuple_Shell_New_Inside = tuples_Shell_New_Inside[j]; @@ -510,7 +512,7 @@ public static bool Merge(this AdjacencyCluster adjacencyCluster_Destination, Adj //Find existing panel Panel panel = panels_Destination_Shell.Find(x => x.GetBoundingBox().Inside(internalPoint, true, tolerance_Distance) && x.Face3D.Inside(internalPoint, tolerance_Distance)); - if(panel is not null) + if (panel is not null) { //Copy data/links from existing panel to new panel List spaces_Panel = adjacencyCluster_Destination.GetSpaces(panel); @@ -527,7 +529,7 @@ public static bool Merge(this AdjacencyCluster adjacencyCluster_Destination, Adj if (panel is null) { panel = panels_Source_Shell.Find(x => x.GetBoundingBox().Inside(internalPoint, true, tolerance_Distance) && x.Face3D.Inside(internalPoint, tolerance_Distance)); - if(panel is not null) + if (panel is not null) { panel = new Panel(Guid.NewGuid(), panel, face3D); adjacencyCluster_Destination.AddObject(panel); @@ -642,4 +644,4 @@ public static bool Merge(this AdjacencyCluster adjacencyCluster_Destination, Adj return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/MergeApertures.cs b/SAM/SAM.Analytical/Modify/MergeApertures.cs index 693590718..fa419d363 100644 --- a/SAM/SAM.Analytical/Modify/MergeApertures.cs +++ b/SAM/SAM.Analytical/Modify/MergeApertures.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -17,12 +20,12 @@ public static List MergeApertures(this Panel panel, double distance, o return null; } - if(panel.Apertures is not List apertures || apertures.Count == 0) + if (panel.Apertures is not List apertures || apertures.Count == 0) { return null; } - if(apertureGuids != null && apertureGuids.Any()) + if (apertureGuids != null && apertureGuids.Any()) { for (int i = apertures.Count - 1; i >= 0; i--) { @@ -33,12 +36,12 @@ public static List MergeApertures(this Panel panel, double distance, o } } - if(apertures is null || apertures.Count == 0) + if (apertures is null || apertures.Count == 0) { return null; } - if(panel.Plane is not Plane plane) + if (panel.Plane is not Plane plane) { return null; } @@ -55,7 +58,7 @@ public static List MergeApertures(this Panel panel, double distance, o } List>> tuples_Group = []; - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { if ((plane.Convert(aperture?.GetExternalEdge3D()) as ISegmentable2D)?.GetPoints() is not List point2Ds || point2Ds.Count < 3) { @@ -69,7 +72,7 @@ public static List MergeApertures(this Panel panel, double distance, o bool updated = true; - while(updated) + while (updated) { updated = false; @@ -97,11 +100,11 @@ public static List MergeApertures(this Panel panel, double distance, o Guid guid_2 = aperture_2.Guid; int index = tuples_Distance.FindIndex(x => (x.Item1 == guid_1 && x.Item2 == guid_2) || (x.Item1 == guid_2 && x.Item2 == guid_1)); - if(index == -1) + if (index == -1) { index = tuples_Distance.Count; tuples_Distance.Add(new Tuple(guid_1, guid_2, polygon2D_1.Distance(polygon2D_2))); - + } if (tuples_Distance[index].Item3 > distance) @@ -114,7 +117,7 @@ public static List MergeApertures(this Panel panel, double distance, o } - if(match) + if (match) { break; } @@ -131,7 +134,7 @@ public static List MergeApertures(this Panel panel, double distance, o tuples_Group.Remove(tuples_Group_2); } - if(updated) + if (updated) { break; } @@ -158,9 +161,9 @@ public static List MergeApertures(this Panel panel, double distance, o double area_External = 0; double area_Internal = 0; - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { - if(face3D.GetExternalEdge3D() is not IClosedPlanar3D externalEdge) + if (face3D.GetExternalEdge3D() is not IClosedPlanar3D externalEdge) { continue; } @@ -168,12 +171,12 @@ public static List MergeApertures(this Panel panel, double distance, o double area = double.NaN; area = externalEdge.GetArea(); - if(!double.IsNaN(area)) + if (!double.IsNaN(area)) { area_External += area; } - if(face3D.GetInternalEdge3Ds() is not List internalEdges || internalEdges.Count == 0) + if (face3D.GetInternalEdge3Ds() is not List internalEdges || internalEdges.Count == 0) { if (!double.IsNaN(area)) { @@ -183,7 +186,7 @@ public static List MergeApertures(this Panel panel, double distance, o continue; } - foreach(IClosedPlanar3D internalEdge in internalEdges) + foreach (IClosedPlanar3D internalEdge in internalEdges) { area = internalEdge.GetArea(); if (!double.IsNaN(area)) @@ -193,7 +196,7 @@ public static List MergeApertures(this Panel panel, double distance, o } } - if(double.IsNaN(area_External) || Core.Query.AlmostEqual(area_External, Core.Tolerance.MacroDistance)) + if (double.IsNaN(area_External) || Core.Query.AlmostEqual(area_External, Core.Tolerance.MacroDistance)) { continue; } @@ -221,14 +224,14 @@ public static List MergeApertures(this Panel panel, double distance, o rectangle2D_External.Move(rectangle2D.HeightDirection * difference / 2); } - if(rectangle2D_External.GetArea() < Core.Tolerance.MacroDistance) + if (rectangle2D_External.GetArea() < Core.Tolerance.MacroDistance) { continue; } - foreach(Aperture aperture_Temp in tuples.ConvertAll(x => x.Item1)) + foreach (Aperture aperture_Temp in tuples.ConvertAll(x => x.Item1)) { - if(!panel.RemoveAperture(aperture_Temp.Guid)) + if (!panel.RemoveAperture(aperture_Temp.Guid)) { continue; } @@ -236,7 +239,7 @@ public static List MergeApertures(this Panel panel, double distance, o removedApertures.Add(aperture_Temp); } - if(removeOverlap) + if (removeOverlap) { if (panel.Apertures is List apertures_Existing && apertures_Existing.Count != 0) { @@ -264,7 +267,7 @@ public static List MergeApertures(this Panel panel, double distance, o Polygon3D polygon3D = plane.Convert(new Polygon2D(rectangle2D_External.GetPoints())); - Aperture aperture_New = new (Guid.NewGuid(), aperture, new Face3D(polygon3D)); + Aperture aperture_New = new(Guid.NewGuid(), aperture, new Face3D(polygon3D)); panel.AddAperture(aperture_New, tolerance_Distance: Core.Tolerance.MacroDistance); result.Add(aperture_New); @@ -273,4 +276,4 @@ public static List MergeApertures(this Panel panel, double distance, o return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/MergePanel.cs b/SAM/SAM.Analytical/Modify/MergePanel.cs index efeb8e139..d2372bcba 100644 --- a/SAM/SAM.Analytical/Modify/MergePanel.cs +++ b/SAM/SAM.Analytical/Modify/MergePanel.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System; @@ -90,7 +93,7 @@ public static List MergePanel(this AdjacencyCluster adjacencyCluster, Gui continue; } - if(panel_Temp.Guid == panel.Guid) + if (panel_Temp.Guid == panel.Guid) { continue; } @@ -219,4 +222,4 @@ public static List MergePanel(this AdjacencyCluster adjacencyCluster, Gui } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/MergeSpaces.cs b/SAM/SAM.Analytical/Modify/MergeSpaces.cs index 59f48c80a..5bf4c649d 100644 --- a/SAM/SAM.Analytical/Modify/MergeSpaces.cs +++ b/SAM/SAM.Analytical/Modify/MergeSpaces.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using System; using System.Collections.Generic; using System.Linq; @@ -84,7 +87,7 @@ public static Space MergeSpaces(this AdjacencyCluster adjacencyCluster, Guid spa } Space space_1 = adjacencyCluster.GetObject(spaceGuid_1); - if(space_1 == null) + if (space_1 == null) { return null; } @@ -116,7 +119,7 @@ public static Space MergeSpaces(this AdjacencyCluster adjacencyCluster, Guid spa prefix_2 = name_2.Substring(0, index_2); } - if(prefix_2.StartsWith(prefix_1)) + if (prefix_2.StartsWith(prefix_1)) { space_1 = new Space(space_1, prefix_1, space_1.Location); } @@ -124,7 +127,7 @@ public static Space MergeSpaces(this AdjacencyCluster adjacencyCluster, Guid spa } List panels_Adjacent = adjacencyCluster.GetPanels(Core.LogicalOperator.And, space_1, space_2); - if(panels_Adjacent == null || panels_Adjacent.Count == 0) + if (panels_Adjacent == null || panels_Adjacent.Count == 0) { return null; } @@ -141,7 +144,7 @@ public static Space MergeSpaces(this AdjacencyCluster adjacencyCluster, Guid spa panelGuids_ToBeRemoved.ForEach(x => adjacencyCluster.RemoveObject(x)); panels_Adjacent.RemoveAll(x => panelGuids_ToBeRemoved.Contains(x.Guid)); - if(panels_Adjacent.Count != 0) + if (panels_Adjacent.Count != 0) { //panels_Adjacent = panels_Adjacent.ConvertAll(x => Create.Panel(x, PanelType.Shade)); @@ -166,7 +169,7 @@ public static Space MergeSpaces(this AdjacencyCluster adjacencyCluster, Guid spa foreach (Panel panel in panels_2) { Panel panel_Temp = panels_Adjacent.Find(x => x.Guid == panel.Guid); - if(panel_Temp != null) + if (panel_Temp != null) { continue; } @@ -185,17 +188,17 @@ public static List MergeSpaces(this AdjacencyCluster adjacencyCluster, ou { panels = null; - if(adjacencyCluster == null) + if (adjacencyCluster == null) { return null; } - if(spaceGuids == null) + if (spaceGuids == null) { spaceGuids = adjacencyCluster.GetSpaces()?.ConvertAll(x => x.Guid); } - if(spaceGuids == null) + if (spaceGuids == null) { return null; } @@ -222,7 +225,7 @@ public static List MergeSpaces(this AdjacencyCluster adjacencyCluster, ou foreach (Space space_Adjacent in spaces_Adjacent) { List panels_Temp = adjacencyCluster.GetPanels(Core.LogicalOperator.And, space, space_Adjacent); - if(panelTypes != null) + if (panelTypes != null) { panels_Temp.RemoveAll(x => !panelTypes.Contains(x.PanelType)); } @@ -253,4 +256,4 @@ public static List MergeSpaces(this AdjacencyCluster adjacencyCluster, ou return guids.ToList().ConvertAll(x => adjacencyCluster.GetObject(x)).FindAll(x => x != null); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/New/AddAirPartitions.cs b/SAM/SAM.Analytical/Modify/New/AddAirPartitions.cs index 48bdff532..34bd8450d 100644 --- a/SAM/SAM.Analytical/Modify/New/AddAirPartitions.cs +++ b/SAM/SAM.Analytical/Modify/New/AddAirPartitions.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Object.Spatial; using SAM.Geometry.Planar; using SAM.Geometry.Spatial; @@ -13,7 +16,7 @@ public static partial class Modify { public static List AddAirPartitions(this BuildingModel buildingModel, IEnumerable planes, IEnumerable spaces = null, double silverSpacing = Tolerance.MacroDistance, double tolerance_Angle = Tolerance.Angle, double tolerance_Distance = Tolerance.Distance, double tolerance_Snap = Tolerance.MacroDistance) { - if(planes == null) + if (planes == null) { return null; } @@ -29,9 +32,9 @@ public static List AddAirPartitions(this BuildingModel buildingMod List airPartitions = AddAirPartitions(buildingModel, plane, spaces, silverSpacing, tolerance_Angle, tolerance_Distance, tolerance_Snap); if (airPartitions != null && airPartitions.Count > 0) { - foreach(AirPartition airPartition in airPartitions) + foreach (AirPartition airPartition in airPartitions) { - if(airPartition == null) + if (airPartition == null) { continue; } @@ -232,4 +235,4 @@ public static List AddAirPartitions(this BuildingModel buildingMod } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/New/AddMechanicalSystem.cs b/SAM/SAM.Analytical/Modify/New/AddMechanicalSystem.cs index 935b14a96..546f1c696 100644 --- a/SAM/SAM.Analytical/Modify/New/AddMechanicalSystem.cs +++ b/SAM/SAM.Analytical/Modify/New/AddMechanicalSystem.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { public static partial class Modify @@ -16,7 +19,7 @@ public static MechanicalSystem AddMechanicalSystem(this BuildingModel buildingMo return null; } - if(!buildingModel.Add(mechanicalSystem, spaces)) + if (!buildingModel.Add(mechanicalSystem, spaces)) { return null; } @@ -24,4 +27,4 @@ public static MechanicalSystem AddMechanicalSystem(this BuildingModel buildingMo return mechanicalSystem; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/New/AddMissingMaterials.cs b/SAM/SAM.Analytical/Modify/New/AddMissingMaterials.cs index fd48a869c..fd08d56d0 100644 --- a/SAM/SAM.Analytical/Modify/New/AddMissingMaterials.cs +++ b/SAM/SAM.Analytical/Modify/New/AddMissingMaterials.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -13,8 +16,8 @@ public static partial class Modify public static List AddMissingMaterials(this BuildingModel buildingModel, Core.MaterialLibrary materialLibrary, out List missingMaterialNames) { missingMaterialNames = null; - - if(buildingModel == null || materialLibrary == null) + + if (buildingModel == null || materialLibrary == null) { return null; } @@ -22,21 +25,21 @@ public static partial class Modify List result = new List(); List materialNames = buildingModel.GetMissingMaterialNames(); - if(materialNames == null || materialNames.Count == 0) + if (materialNames == null || materialNames.Count == 0) { return result; } missingMaterialNames = new List(); - foreach(string materialName in materialNames) + foreach (string materialName in materialNames) { - if(string.IsNullOrWhiteSpace(materialName)) + if (string.IsNullOrWhiteSpace(materialName)) { continue; } Core.IMaterial material = materialLibrary.GetMaterial(materialName); - if(material == null) + if (material == null) { missingMaterialNames.Add(materialName); } @@ -50,4 +53,4 @@ public static partial class Modify return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/New/AddMissingProfiles.cs b/SAM/SAM.Analytical/Modify/New/AddMissingProfiles.cs index cde8d3cd1..944f42624 100644 --- a/SAM/SAM.Analytical/Modify/New/AddMissingProfiles.cs +++ b/SAM/SAM.Analytical/Modify/New/AddMissingProfiles.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Analytical @@ -22,39 +25,39 @@ public static List AddMissingProfiles(this BuildingModel buildingModel, List result = new List(); List spaces = buildingModel.GetSpaces(); - if(spaces == null || spaces.Count == 0) + if (spaces == null || spaces.Count == 0) { return result; } missingProfileNames = new Dictionary>(); - foreach(Space space in spaces) + foreach (Space space in spaces) { InternalCondition internalCondition = space?.InternalCondition; - if(internalCondition == null) + if (internalCondition == null) { continue; } IEnumerable profileTypes = internalCondition.GetProfileTypes(); - if(profileTypes == null || profileTypes.Count() == 0) + if (profileTypes == null || profileTypes.Count() == 0) { continue; } - foreach(ProfileType profileType in profileTypes) + foreach (ProfileType profileType in profileTypes) { Profile profile = buildingModel.GetProfile(internalCondition, profileType); - if(profile == null) + if (profile == null) { - if(!missingProfileNames.TryGetValue(profileType, out List names)) + if (!missingProfileNames.TryGetValue(profileType, out List names)) { names = new List(); missingProfileNames[profileType] = names; } string name = internalCondition.GetProfileName(profileType); - if(!names.Contains(name)) + if (!names.Contains(name)) { names.Add(name); } @@ -70,4 +73,4 @@ public static List AddMissingProfiles(this BuildingModel buildingModel, return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/New/AddOpening.cs b/SAM/SAM.Analytical/Modify/New/AddOpening.cs index 8338ba882..a424ceb51 100644 --- a/SAM/SAM.Analytical/Modify/New/AddOpening.cs +++ b/SAM/SAM.Analytical/Modify/New/AddOpening.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -9,13 +12,13 @@ public static partial class Modify { public static IOpening AddOpening(this IHostPartition hostPartition, OpeningType openingType, double ratio, double tolerance_Area = Core.Tolerance.MacroDistance, double tolerance_Distance = Core.Tolerance.Distance) { - if(hostPartition == null || openingType == null || ratio == 0) + if (hostPartition == null || openingType == null || ratio == 0) { return null; } Face3D face3D = hostPartition.Face3D; - if(face3D == null) + if (face3D == null) { return null; } @@ -107,7 +110,7 @@ public static IOpening AddOpening(this IHostPartition hostPartition, OpeningType public static IOpening AddOpening(this BuildingModel buildingModel, IOpening opening, double tolerance = Core.Tolerance.Distance) { - if(TryAddOpening(buildingModel, opening, tolerance)) + if (TryAddOpening(buildingModel, opening, tolerance)) { return opening; } @@ -115,4 +118,4 @@ public static IOpening AddOpening(this BuildingModel buildingModel, IOpening ope return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/New/AddOpenings.cs b/SAM/SAM.Analytical/Modify/New/AddOpenings.cs index 65034c8bc..995eb4967 100644 --- a/SAM/SAM.Analytical/Modify/New/AddOpenings.cs +++ b/SAM/SAM.Analytical/Modify/New/AddOpenings.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -6,15 +9,15 @@ public static partial class Modify { public static List AddOpenings(this BuildingModel buildingModel, IEnumerable openings, double tolerance = Core.Tolerance.Distance) { - if(buildingModel == null || openings == null) + if (buildingModel == null || openings == null) { return null; } List result = new List(); - foreach(IOpening opening in openings) + foreach (IOpening opening in openings) { - if(buildingModel.TryAddOpening(opening, tolerance)) + if (buildingModel.TryAddOpening(opening, tolerance)) { result.Add(opening); } @@ -23,4 +26,4 @@ public static List AddOpenings(this BuildingModel buildingModel, IEnum return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/New/FixEdges.cs b/SAM/SAM.Analytical/Modify/New/FixEdges.cs index ded9586f5..7680546dc 100644 --- a/SAM/SAM.Analytical/Modify/New/FixEdges.cs +++ b/SAM/SAM.Analytical/Modify/New/FixEdges.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -16,7 +19,7 @@ public static void FixEdges(this BuildingModel buildingModel, double tolerance = List partitions = buildingModel.GetPartitions(); if (partitions == null || partitions.Count == 0) { - return ; + return; } List> partitionsList = Enumerable.Repeat>(null, partitions.Count).ToList(); @@ -26,10 +29,10 @@ public static void FixEdges(this BuildingModel buildingModel, double tolerance = partitionsList[i] = partitions[i].FixEdges(tolerance); }); - for(int i=0; i < partitions.Count; i++) + for (int i = 0; i < partitions.Count; i++) { List partitions_Temp = partitionsList[i]; - if(partitions_Temp == null || partitions_Temp.Count == 0) + if (partitions_Temp == null || partitions_Temp.Count == 0) { continue; } @@ -56,4 +59,4 @@ public static void FixEdges(this BuildingModel buildingModel, double tolerance = } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/New/MapInternalConditions.cs b/SAM/SAM.Analytical/Modify/New/MapInternalConditions.cs index 6b760d9a4..5efc03be1 100644 --- a/SAM/SAM.Analytical/Modify/New/MapInternalConditions.cs +++ b/SAM/SAM.Analytical/Modify/New/MapInternalConditions.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Analytical @@ -37,4 +40,4 @@ public static List MapInternalConditions(this BuildingModel b return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/New/MapZones.cs b/SAM/SAM.Analytical/Modify/New/MapZones.cs index aedd375dd..97eb1a2d9 100644 --- a/SAM/SAM.Analytical/Modify/New/MapZones.cs +++ b/SAM/SAM.Analytical/Modify/New/MapZones.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -8,7 +11,7 @@ public static partial class Modify { public static List MapZones(this BuildingModel buildingModel, TextMap textMap) { - if(textMap == null || buildingModel == null) + if (textMap == null || buildingModel == null) { return null; } @@ -48,4 +51,4 @@ public static List MapZones(this BuildingModel buildingModel, TextMap text return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/New/MergeCoplanarPartitionsBySpace.cs b/SAM/SAM.Analytical/Modify/New/MergeCoplanarPartitionsBySpace.cs index aeda7dc65..7775cc102 100644 --- a/SAM/SAM.Analytical/Modify/New/MergeCoplanarPartitionsBySpace.cs +++ b/SAM/SAM.Analytical/Modify/New/MergeCoplanarPartitionsBySpace.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -7,30 +10,30 @@ public static partial class Modify public static void MergeCoplanarPartitionsBySpace(this BuildingModel buildingModel, Space space, bool validateHostPartitionType = true, double tolerance = Core.Tolerance.Distance) { List partitions = buildingModel?.GetPartitions(space); - if(partitions == null || partitions.Count == 0) + if (partitions == null || partitions.Count == 0) { return; } List partitions_MergeCoplanar = partitions.MergeCoplanar(tolerance, out List redundantPartitions, validateHostPartitionType, tolerance, tolerance); - if(partitions_MergeCoplanar == null || partitions_MergeCoplanar.Count == 0) + if (partitions_MergeCoplanar == null || partitions_MergeCoplanar.Count == 0) { return; } - if(redundantPartitions != null && redundantPartitions.Count != 0) + if (redundantPartitions != null && redundantPartitions.Count != 0) { - foreach(IPartition partition in redundantPartitions) + foreach (IPartition partition in redundantPartitions) { buildingModel.RemoveObject(partition); } } - foreach(IPartition partition in partitions_MergeCoplanar) + foreach (IPartition partition in partitions_MergeCoplanar) { buildingModel.Add(partition); } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/New/OffsetAperturesOnEdge.cs b/SAM/SAM.Analytical/Modify/New/OffsetAperturesOnEdge.cs index 852388d84..b48821741 100644 --- a/SAM/SAM.Analytical/Modify/New/OffsetAperturesOnEdge.cs +++ b/SAM/SAM.Analytical/Modify/New/OffsetAperturesOnEdge.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -21,13 +24,13 @@ public static List OffsetAperturesOnEdge(this BuildingModel buildingMo } List result = new List(); - foreach(IHostPartition hostPartition in hostPartitions) + foreach (IHostPartition hostPartition in hostPartitions) { List openings = hostPartition?.GetOpenings(); - if(openings != null && openings.Count != 0) + if (openings != null && openings.Count != 0) { List openings_Offset = hostPartition.OffsetAperturesOnEdge(distance, tolerance); - if(openings_Offset != null && openings_Offset.Count != 0) + if (openings_Offset != null && openings_Offset.Count != 0) { buildingModel.Add(hostPartition); result.AddRange(openings_Offset); @@ -104,13 +107,13 @@ public static List OffsetAperturesOnEdge(this IHostPartition hostParti closedPlanar3D = plane.Convert(polygon2Ds.Last()); IOpening opening_New = Create.Opening(opening.Guid, opening, new Face3D(closedPlanar3D), opening.Face3D.GetPlane().Origin); - if(opening_New == null) + if (opening_New == null) { continue; } List openings_New = hostPartition.AddOpening(opening_New, tolerance); - if(openings_New != null) + if (openings_New != null) { result.AddRange(openings_New); } @@ -119,4 +122,4 @@ public static List OffsetAperturesOnEdge(this IHostPartition hostParti return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/New/OrientPartitions.cs b/SAM/SAM.Analytical/Modify/New/OrientPartitions.cs index 358940550..23cc4f070 100644 --- a/SAM/SAM.Analytical/Modify/New/OrientPartitions.cs +++ b/SAM/SAM.Analytical/Modify/New/OrientPartitions.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -25,14 +28,14 @@ public static void OrientPartitions(this BuildingModel buildingModel, bool inclu foreach (Space space in spaces) { List partitions = buildingModel.OrientedPartitions(space, includeOpenings, external, silverSpacing, tolerance); - if(partitions == null || partitions.Count == 0) + if (partitions == null || partitions.Count == 0) { continue; } - foreach(IPartition partition in partitions) + foreach (IPartition partition in partitions) { - if(partition == null || guids.Contains(partition.Guid)) + if (partition == null || guids.Contains(partition.Guid)) { continue; } @@ -62,16 +65,16 @@ public static void OrientPartitions(this BuildingModel buildingModel, Space spac buildingModel.OrientedPartitions(space, includeOpenings, out List flippedPartitions, external, silverSpacing, tolerance); - if(flippedPartitions == null || flippedPartitions.Count == 0) + if (flippedPartitions == null || flippedPartitions.Count == 0) { return; } - foreach(IPartition partition in flippedPartitions) + foreach (IPartition partition in flippedPartitions) { buildingModel.Add(partition); } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/New/ReplaceTransparentPartitions.cs b/SAM/SAM.Analytical/Modify/New/ReplaceTransparentPartitions.cs index 185efa043..0451cec5a 100644 --- a/SAM/SAM.Analytical/Modify/New/ReplaceTransparentPartitions.cs +++ b/SAM/SAM.Analytical/Modify/New/ReplaceTransparentPartitions.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Analytical @@ -13,48 +16,48 @@ public static List ReplaceTransparentPartitions(this BuildingMod } List hostPartitionTypes = buildingModel.GetHostPartitionTypes(); - if(hostPartitionTypes == null || hostPartitionTypes.Count == 0) + if (hostPartitionTypes == null || hostPartitionTypes.Count == 0) { return null; } List result = new List(); - foreach(HostPartitionType hostPartitionType in hostPartitionTypes) + foreach (HostPartitionType hostPartitionType in hostPartitionTypes) { - if(hostPartitionType == null) + if (hostPartitionType == null) { continue; } - if(!buildingModel.Transparent(hostPartitionType)) + if (!buildingModel.Transparent(hostPartitionType)) { continue; } List hostPartitions = buildingModel.GetHostPartitions(hostPartitionType); - if(hostPartitions == null || hostPartitions.Count == 0) + if (hostPartitions == null || hostPartitions.Count == 0) { continue; } WindowType windowType = new WindowType(hostPartitionType.Name, hostPartitionType.MaterialLayers); - foreach(IHostPartition hostPartition in hostPartitions) + foreach (IHostPartition hostPartition in hostPartitions) { PartitionAnalyticalType partitionAnalyticalType = buildingModel.PartitionAnalyticalType(hostPartition, tolerance_Angle, tolerance_Distance); - if(partitionAnalyticalType == PartitionAnalyticalType.Undefined) + if (partitionAnalyticalType == PartitionAnalyticalType.Undefined) { continue; } HostPartitionType hostPartitionType_Default = Query.DefaultHostPartitionType(partitionAnalyticalType); - if(hostPartitionType_Default == null) + if (hostPartitionType_Default == null) { continue; } Geometry.Spatial.IClosedPlanar3D externalEdge3D = hostPartition.Face3D?.GetExternalEdge3D(); - if(externalEdge3D == null) + if (externalEdge3D == null) { continue; } @@ -64,7 +67,7 @@ public static List ReplaceTransparentPartitions(this BuildingMod hostPartition.Type(hostPartitionType_Default); List openings = hostPartition.GetOpenings(); - if(openings != null && openings.Count != 0) + if (openings != null && openings.Count != 0) { openings.ForEach(x => hostPartition.RemoveOpening(x.Guid)); } @@ -79,7 +82,7 @@ public static List ReplaceTransparentPartitions(this BuildingMod face3Ds = Geometry.Spatial.Query.Offset(face3D, offset, true, false, tolerance_Distance); } - foreach(Geometry.Spatial.Face3D face3D_New in face3Ds) + foreach (Geometry.Spatial.Face3D face3D_New in face3Ds) { Window window = new Window(windowType, face3D_New); hostPartition.AddOpening(window, tolerance_Distance); @@ -93,4 +96,4 @@ public static List ReplaceTransparentPartitions(this BuildingMod return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/New/SimplifyByAngle.cs b/SAM/SAM.Analytical/Modify/New/SimplifyByAngle.cs index eaabaf9d0..edd6038de 100644 --- a/SAM/SAM.Analytical/Modify/New/SimplifyByAngle.cs +++ b/SAM/SAM.Analytical/Modify/New/SimplifyByAngle.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; namespace SAM.Analytical @@ -8,23 +11,23 @@ public static partial class Modify public static void SimplifyByAngle(this BuildingModel buildingModel, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { List partitions = buildingModel?.GetPartitions(); - if(partitions == null) + if (partitions == null) { return; } - foreach(IPartition partition in partitions) + foreach (IPartition partition in partitions) { Face3D face3D = partition?.Face3D; - if(face3D == null) + if (face3D == null) { continue; } face3D = face3D.SimplifyByAngle(tolerance_Angle, tolerance_Distance); IPartition partition_New = Create.Partition(partition, partition.Guid, face3D, tolerance_Distance); - if(partition_New is IHostPartition) + if (partition_New is IHostPartition) { IHostPartition hostPartition = (IHostPartition)partition_New; @@ -54,4 +57,4 @@ public static void SimplifyByAngle(this BuildingModel buildingModel, double tole } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/New/SplitByInternalEdges.cs b/SAM/SAM.Analytical/Modify/New/SplitByInternalEdges.cs index dc4b24b01..a81ec87d7 100644 --- a/SAM/SAM.Analytical/Modify/New/SplitByInternalEdges.cs +++ b/SAM/SAM.Analytical/Modify/New/SplitByInternalEdges.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -12,23 +15,23 @@ public static List SplitByInternalEdges(this BuildingModel buildingM List result = new List(); List partitions = buildingModel.GetPartitions(); - if(partitions != null && partitions.Count != 0) + if (partitions != null && partitions.Count != 0) { - foreach(IPartition partition in partitions) + foreach (IPartition partition in partitions) { List partitions_Split = partition.SplitByInternalEdges(tolerance); if (partitions_Split == null || partitions_Split.Count < 2) { continue; } - List relatedObjects = buildingModel.GetRelatedObjects(partition); + List relatedObjects = buildingModel.GetRelatedObjects(partition); - foreach(IPartition partition_Split in partitions_Split) + foreach (IPartition partition_Split in partitions_Split) { buildingModel.Add(partition_Split); result.Add(partition_Split); - if(relatedObjects != null && relatedObjects.Count > 0) + if (relatedObjects != null && relatedObjects.Count > 0) { foreach (Core.IJSAMObject relatedObject in relatedObjects) { @@ -43,4 +46,4 @@ public static List SplitByInternalEdges(this BuildingModel buildingM return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/New/TriangulateConcavePartitions.cs b/SAM/SAM.Analytical/Modify/New/TriangulateConcavePartitions.cs index e57606b27..9542b696f 100644 --- a/SAM/SAM.Analytical/Modify/New/TriangulateConcavePartitions.cs +++ b/SAM/SAM.Analytical/Modify/New/TriangulateConcavePartitions.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Analytical @@ -10,7 +13,7 @@ public static List TriangulateConcavePartitions(this BuildingModel b triangulatedPartitions = null; List partitions = buildingModel?.GetObjects(x => x != null && Geometry.Object.Spatial.Query.Concave(x)); - if(partitions == null) + if (partitions == null) { return null; } @@ -52,4 +55,4 @@ public static List TriangulateConcavePartitions(this BuildingModel b return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/New/TryAddOpening.cs b/SAM/SAM.Analytical/Modify/New/TryAddOpening.cs index fff72522c..356e8af14 100644 --- a/SAM/SAM.Analytical/Modify/New/TryAddOpening.cs +++ b/SAM/SAM.Analytical/Modify/New/TryAddOpening.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -9,7 +12,7 @@ public static partial class Modify public static bool TryAddOpening(this BuildingModel buildingModel, IOpening opening, out IHostPartition hostPartition, double tolerance = Core.Tolerance.Distance) { hostPartition = null; - + if (buildingModel == null || opening == null) { return false; @@ -49,7 +52,7 @@ public static bool TryAddOpening(this BuildingModel buildingModel, IOpening open } List openings_Add = hostPartition_Temp.AddOpening(opening, tolerance); - if(openings_Add == null || openings_Add.Count == 0) + if (openings_Add == null || openings_Add.Count == 0) { continue; } @@ -69,12 +72,12 @@ public static bool TryAddOpening(this BuildingModel buildingModel, IOpening open public static bool TryAddOpening(this IHostPartition hostPartition, IOpening opening, double tolerance = Core.Tolerance.Distance) { - if(hostPartition == null || opening == null) + if (hostPartition == null || opening == null) { return false; } - if(!hostPartition.IsValid(opening, tolerance)) + if (!hostPartition.IsValid(opening, tolerance)) { return false; } @@ -89,4 +92,4 @@ public static bool TryAddOpening(this BuildingModel buildingModel, IOpening open return TryAddOpening(buildingModel, opening, out IHostPartition hostPartition, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/New/Type.cs b/SAM/SAM.Analytical/Modify/New/Type.cs index dcbd3dea2..cd686b7e1 100644 --- a/SAM/SAM.Analytical/Modify/New/Type.cs +++ b/SAM/SAM.Analytical/Modify/New/Type.cs @@ -1,19 +1,22 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Modify { public static bool Type(this IHostPartition hostPartition, HostPartitionType hostPartitionType) { - if(hostPartition == null || hostPartitionType == null) + if (hostPartition == null || hostPartitionType == null) { return false; } - if(hostPartition is Wall && hostPartitionType is WallType) + if (hostPartition is Wall && hostPartitionType is WallType) { ((Wall)hostPartition).Type = (WallType)hostPartitionType; } - else if(hostPartition is Roof && hostPartitionType is RoofType) + else if (hostPartition is Roof && hostPartitionType is RoofType) { ((Roof)hostPartition).Type = (RoofType)hostPartitionType; } @@ -79,4 +82,4 @@ public static bool Type(this MechanicalSystem mechanicalSystem, MechanicalSystem return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/New/UpdateHostPartitionType.cs b/SAM/SAM.Analytical/Modify/New/UpdateHostPartitionType.cs index f02b41e27..826162bfd 100644 --- a/SAM/SAM.Analytical/Modify/New/UpdateHostPartitionType.cs +++ b/SAM/SAM.Analytical/Modify/New/UpdateHostPartitionType.cs @@ -1,10 +1,12 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Architectural; +using SAM.Core; using System; using System.Collections.Generic; using System.Linq; -using SAM.Architectural; - namespace SAM.Analytical { public static partial class Modify @@ -95,7 +97,7 @@ public static List UpdateHostPartitionType(this BuildingModel buildi } } - if(materialLibrary != null && result != null && result.Count != 0) + if (materialLibrary != null && result != null && result.Count != 0) { buildingModel.UpdateMaterials(hostPartitionType.MaterialLayers, materialLibrary, out HashSet missingMaterialsNames); } @@ -105,7 +107,7 @@ public static List UpdateHostPartitionType(this BuildingModel buildi public static List UpdateHostPartitionType(this BuildingModel buildingModel, HostPartitionType hostPartitionType, Func function, IEnumerable partitions = null, MaterialLibrary materialLibrary = null) { - if(function == null) + if (function == null) { return null; } @@ -129,7 +131,7 @@ public static List UpdateHostPartitionType(this BuildingModel buildi double tolerance_Angle = Tolerance.Angle, double tolerance_Distance = Tolerance.Distance) { - if(buildingModel == null) + if (buildingModel == null) { return null; } @@ -142,11 +144,11 @@ public static List UpdateHostPartitionType(this BuildingModel buildi { Func function = new Func((IPartition partition) => { - if(partition is AirPartition) + if (partition is AirPartition) { return false; } - else if(partition is IHostPartition) + else if (partition is IHostPartition) { IHostPartition hostPartition = partition as IHostPartition; if (hostPartition == null) @@ -161,20 +163,20 @@ public static List UpdateHostPartitionType(this BuildingModel buildi }); List partitions_Update = buildingModel.UpdateHostPartitionType(curtainWallType, function, partitions, materialLibrary); - if(partitions_Update != null) + if (partitions_Update != null) { - foreach(IPartition partition_Update in partitions_Update) + foreach (IPartition partition_Update in partitions_Update) { dictionary[partition_Update.Guid] = partition_Update; } } } - if(internalWallType != null) + if (internalWallType != null) { Func function = new Func((IPartition partition) => { - if(partition == null) + if (partition == null) { return false; } @@ -214,12 +216,12 @@ public static List UpdateHostPartitionType(this BuildingModel buildi { Func function = new Func((IPartition partition) => { - if(partition == null) + if (partition == null) { return false; } - if(partition is AirPartition) + if (partition is AirPartition) { if (Query.HostPartitionCategory(partition, tolerance_Angle) != HostPartitionCategory.Wall) { @@ -227,7 +229,7 @@ public static List UpdateHostPartitionType(this BuildingModel buildi } } - if(!buildingModel.External(partition)) + if (!buildingModel.External(partition)) { return false; } @@ -264,7 +266,7 @@ public static List UpdateHostPartitionType(this BuildingModel buildi { Func function = new Func((IPartition partition) => { - if(partition == null) + if (partition == null) { return false; } @@ -282,7 +284,7 @@ public static List UpdateHostPartitionType(this BuildingModel buildi return false; } - if(partition is IHostPartition) + if (partition is IHostPartition) { IHostPartition hostPartition = partition as IHostPartition; if (buildingModel.GetMaterialType(hostPartition) == MaterialType.Transparent) @@ -313,7 +315,7 @@ public static List UpdateHostPartitionType(this BuildingModel buildi { Func function = new Func((IPartition partition) => { - if(partition == null) + if (partition == null) { return false; } @@ -349,7 +351,7 @@ public static List UpdateHostPartitionType(this BuildingModel buildi { Func function = new Func((IPartition partition) => { - if(partition == null) + if (partition == null) { return false; } @@ -512,7 +514,7 @@ public static List UpdateHostPartitionType(this BuildingModel buildi return true; }); - List partitions_Update = buildingModel.UpdateHostPartitionType(undergroundCeilingFloorType, function , partitions, materialLibrary); + List partitions_Update = buildingModel.UpdateHostPartitionType(undergroundCeilingFloorType, function, partitions, materialLibrary); if (partitions_Update != null) { foreach (IPartition partition_Update in partitions_Update) @@ -522,7 +524,7 @@ public static List UpdateHostPartitionType(this BuildingModel buildi } } - if(roofType != null) + if (roofType != null) { Func function = new Func((IPartition partition) => { @@ -554,7 +556,7 @@ public static List UpdateHostPartitionType(this BuildingModel buildi return true; }); - List partitions_Update = buildingModel.UpdateHostPartitionType(roofType, function , partitions, materialLibrary); + List partitions_Update = buildingModel.UpdateHostPartitionType(roofType, function, partitions, materialLibrary); if (partitions_Update != null) { foreach (IPartition partition_Update in partitions_Update) @@ -567,4 +569,4 @@ public static List UpdateHostPartitionType(this BuildingModel buildi return dictionary?.Values?.ToList(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/New/UpdateMaterials.cs b/SAM/SAM.Analytical/Modify/New/UpdateMaterials.cs index 828400963..d0f9a0683 100644 --- a/SAM/SAM.Analytical/Modify/New/UpdateMaterials.cs +++ b/SAM/SAM.Analytical/Modify/New/UpdateMaterials.cs @@ -1,8 +1,10 @@ -using SAM.Core; -using System.Collections.Generic; -using System.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors using SAM.Architectural; +using SAM.Core; +using System.Collections.Generic; +using System.Linq; namespace SAM.Analytical { @@ -20,7 +22,7 @@ public static List UpdateMaterials(this BuildingModel buildingModel, HashSet materialNames = new HashSet(); List hostPartitionTypes = buildingModel.GetHostPartitionTypes(); - if(hostPartitionTypes != null || hostPartitionTypes.Count != 0) + if (hostPartitionTypes != null || hostPartitionTypes.Count != 0) { foreach (HostPartitionType hostPartitionType in hostPartitionTypes) { @@ -71,8 +73,8 @@ public static List UpdateMaterials(this BuildingModel buildingModel, public static List UpdateMaterials(this BuildingModel buildingModel, IEnumerable materialNames, MaterialLibrary materialLibrary, out HashSet missingMaterialsNames) { missingMaterialsNames = null; - - if(buildingModel == null || materialNames == null || materialLibrary == null) + + if (buildingModel == null || materialNames == null || materialLibrary == null) { return null; } @@ -80,7 +82,7 @@ public static List UpdateMaterials(this BuildingModel buildingModel, missingMaterialsNames = new HashSet(); HashSet materialNames_Unique = new HashSet(); - foreach(string materialName in materialNames) + foreach (string materialName in materialNames) { materialNames_Unique.Add(materialName); } @@ -94,7 +96,7 @@ public static List UpdateMaterials(this BuildingModel buildingModel, continue; } - if(buildingModel.HasMaterial(materialName)) + if (buildingModel.HasMaterial(materialName)) { continue; } @@ -114,10 +116,10 @@ public static List UpdateMaterials(this BuildingModel buildingModel, return result; } - + public static List UpdateMaterials(this BuildingModel buildingModel, IEnumerable materialLayers, MaterialLibrary materialLibrary, out HashSet missingMaterialsNames) { return UpdateMaterials(buildingModel, materialLayers?.ToList().ConvertAll(x => x?.Name), materialLibrary, out missingMaterialsNames); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/New/UpdateMaterialsByHeatTransferCoefficients.cs b/SAM/SAM.Analytical/Modify/New/UpdateMaterialsByHeatTransferCoefficients.cs index 62d20895c..7d0241950 100644 --- a/SAM/SAM.Analytical/Modify/New/UpdateMaterialsByHeatTransferCoefficients.cs +++ b/SAM/SAM.Analytical/Modify/New/UpdateMaterialsByHeatTransferCoefficients.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -19,7 +22,7 @@ public static void UpdateMaterialsByHeatTransferCoefficients(this BuildingModel return; } - UpdateMaterialsByHeatTransferCoefficients(buildingModel, duplicateHostPartitionTypes, duplicateOpeningTypes, out List hostPartitionTypes, out List openingTypes); + UpdateMaterialsByHeatTransferCoefficients(buildingModel, duplicateHostPartitionTypes, duplicateOpeningTypes, out List hostPartitionTypes, out List openingTypes); } private static void UpdateMaterialsByHeatTransferCoefficients_HostPartitionTypes(this BuildingModel buildingModel, bool duplicateHostPartitionTypes, out List hostPartitionTypes) @@ -225,7 +228,7 @@ private static void UpdateMaterialsByHeatTransferCoefficients_OpeningTypes(this if (paneUpdate || frameUpdate) { OpeningType openingType_New = null; - if(openingType is WindowType) + if (openingType is WindowType) { openingType_New = new WindowType(openingType.Name, paneMaterialLayers, frameMaterialLayers); } @@ -234,7 +237,7 @@ private static void UpdateMaterialsByHeatTransferCoefficients_OpeningTypes(this openingType_New = new DoorType(openingType.Name, paneMaterialLayers, frameMaterialLayers); } - foreach(IOpening opening in openings) + foreach (IOpening opening in openings) { opening.Type(openingType_New); buildingModel.Add(opening); @@ -457,4 +460,4 @@ private static string GetSAMTypeName(SAMType sAMType, double tilt) return string.Format("{0}_{1}deg", name, tilt_Degree); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/New/UpdateMaterialsByMaterialLayerThickness.cs b/SAM/SAM.Analytical/Modify/New/UpdateMaterialsByMaterialLayerThickness.cs index d5cab3582..c274a6b04 100644 --- a/SAM/SAM.Analytical/Modify/New/UpdateMaterialsByMaterialLayerThickness.cs +++ b/SAM/SAM.Analytical/Modify/New/UpdateMaterialsByMaterialLayerThickness.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System; using System.Collections.Generic; @@ -83,10 +86,10 @@ public static void UpdateMaterialsByMaterialLayerThickness(this BuildingModel bu continue; } - foreach(Architectural.MaterialLayer materialLayer_Temp in materialLayers_Material) + foreach (Architectural.MaterialLayer materialLayer_Temp in materialLayers_Material) { Material material_Thickness = Core.Create.Material(material, GetMaterialName(material.Name, materialLayer_Temp.Thickness, tolerance)); - if(material_Thickness == null) + if (material_Thickness == null) { continue; } @@ -95,7 +98,7 @@ public static void UpdateMaterialsByMaterialLayerThickness(this BuildingModel bu } } - if(tuples == null || tuples.Count == 0) + if (tuples == null || tuples.Count == 0) { return; } @@ -114,13 +117,13 @@ public static void UpdateMaterialsByMaterialLayerThickness(this BuildingModel bu } List materials = new List(); - for(int i =0; i < materialLayers_HostPartitionType.Count; i++) + for (int i = 0; i < materialLayers_HostPartitionType.Count; i++) { Architectural.MaterialLayer materialLayer = materialLayers_HostPartitionType[i]; double thickness = Core.Query.Round(materialLayer.Thickness, tolerance); Tuple tuple = tuples.Find(x => x.Item1.Name == materialLayer.Name && x.Item1.Thickness == thickness); - if(tuple == null) + if (tuple == null) { continue; } @@ -129,7 +132,7 @@ public static void UpdateMaterialsByMaterialLayerThickness(this BuildingModel bu materialLayers_HostPartitionType[i] = new Architectural.MaterialLayer(tuple.Item2.Name, thickness); } - if(materials == null || materials.Count == 0) + if (materials == null || materials.Count == 0) { continue; } @@ -148,7 +151,7 @@ public static void UpdateMaterialsByMaterialLayerThickness(this BuildingModel bu hostPartitionType_New.MaterialLayers = materialLayers_HostPartitionType; List hostPartitions = buildingModel.GetHostPartitions(hostPartitionType); - if(hostPartitions == null || hostPartitions.Count == 0) + if (hostPartitions == null || hostPartitions.Count == 0) { continue; } @@ -166,14 +169,14 @@ public static void UpdateMaterialsByMaterialLayerThickness(this BuildingModel bu } } - if(openingTypes_All != null) + if (openingTypes_All != null) { foreach (OpeningType openingType in openingTypes_All) { List materials = new List(); List materialLayers_Pane = openingType?.PaneMaterialLayers; - if(materialLayers_Pane != null) + if (materialLayers_Pane != null) { for (int i = 0; i < materialLayers_Pane.Count; i++) { @@ -235,10 +238,10 @@ public static void UpdateMaterialsByMaterialLayerThickness(this BuildingModel bu continue; } - foreach(IOpening opening in openings) + foreach (IOpening opening in openings) { IHostPartition hostPartition = buildingModel.GetHostPartition(opening); - if(hostPartition == null) + if (hostPartition == null) { continue; } @@ -253,7 +256,7 @@ public static void UpdateMaterialsByMaterialLayerThickness(this BuildingModel bu public static void UpdateMaterialsByMaterialLayerThickness(this BuildingModel buildingModel, double tolerance = Tolerance.MacroDistance) { - if(buildingModel == null) + if (buildingModel == null) { return; } @@ -269,4 +272,4 @@ private static string GetMaterialName(string name, double thickness, double tole return string.Format("{0}_{1}mm", name, System.Math.Round(thickness / tolerance, 0)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/New/UpdateSpace.cs b/SAM/SAM.Analytical/Modify/New/UpdateSpace.cs index a88491ec4..b051f792e 100644 --- a/SAM/SAM.Analytical/Modify/New/UpdateSpace.cs +++ b/SAM/SAM.Analytical/Modify/New/UpdateSpace.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -17,7 +20,7 @@ public static bool UpdateSpace(this BuildingModel buildingModel, Space space, do return false; Dictionary dictionary = new Dictionary(); - foreach(Space space_Temp in spaces) + foreach (Space space_Temp in spaces) { Shell shell = buildingModel.GetShell(space_Temp); if (shell == null) @@ -32,7 +35,7 @@ public static bool UpdateSpace(this BuildingModel buildingModel, Space space, do Space space_Result = null; - if(dictionary.Count > 1) + if (dictionary.Count > 1) { point3D = point3D.GetMoved(Vector3D.WorldZ * silverSpacing) as Point3D; foreach (KeyValuePair keyValuePair in dictionary) @@ -61,4 +64,4 @@ public static bool UpdateSpace(this BuildingModel buildingModel, Space space, do return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/New/UpdateZone.cs b/SAM/SAM.Analytical/Modify/New/UpdateZone.cs index 40935806a..c8e5194a4 100644 --- a/SAM/SAM.Analytical/Modify/New/UpdateZone.cs +++ b/SAM/SAM.Analytical/Modify/New/UpdateZone.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -45,4 +48,4 @@ public static Zone UpdateZone(this BuildingModel buildingModel, string name, str return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/Normalize.cs b/SAM/SAM.Analytical/Modify/Normalize.cs index f3697d741..5e8b3fc95 100644 --- a/SAM/SAM.Analytical/Modify/Normalize.cs +++ b/SAM/SAM.Analytical/Modify/Normalize.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry; using System.Collections.Generic; @@ -12,12 +15,12 @@ public static bool Normalize(this AdjacencyCluster adjacencyCluster, bool includ return false; List panels = adjacencyCluster.GetPanels(); - if(panels == null) + if (panels == null) { return false; } - foreach(Panel panel in panels) + foreach (Panel panel in panels) { panel.Normalize(includeApertures, orientation, edgeOrientationMethod, tolerance_Angle, tolerance_Distance); adjacencyCluster.AddObject(panel); @@ -26,4 +29,4 @@ public static bool Normalize(this AdjacencyCluster adjacencyCluster, bool includ return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/OffsetAperturesOnEdge.cs b/SAM/SAM.Analytical/Modify/OffsetAperturesOnEdge.cs index 08fa9f44d..12ee5ef0a 100644 --- a/SAM/SAM.Analytical/Modify/OffsetAperturesOnEdge.cs +++ b/SAM/SAM.Analytical/Modify/OffsetAperturesOnEdge.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -13,9 +16,9 @@ public static void OffsetAperturesOnEdge(this AdjacencyCluster adjacencyCluster, if (panels == null || panels.Count == 0) return; - foreach(Panel panel in panels) + foreach (Panel panel in panels) { - if(panel != null && panel.HasApertures) + if (panel != null && panel.HasApertures) { Panel panel_New = new Panel(panel); @@ -25,4 +28,4 @@ public static void OffsetAperturesOnEdge(this AdjacencyCluster adjacencyCluster, } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/OrientedPartitions.cs b/SAM/SAM.Analytical/Modify/OrientedPartitions.cs index 49e7d7bcf..354da6795 100644 --- a/SAM/SAM.Analytical/Modify/OrientedPartitions.cs +++ b/SAM/SAM.Analytical/Modify/OrientedPartitions.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -19,7 +22,7 @@ public static partial class Query public static List OrientedPartitions(this BuildingModel buildingModel, Space space, bool includeOpenings, out List flippedPartitions, bool external = true, double silverSpacing = Core.Tolerance.MacroDistance, double tolerance = Core.Tolerance.Distance) { flippedPartitions = null; - + if (buildingModel == null || space == null) { return null; @@ -56,7 +59,7 @@ public static List OrientedPartitions(this BuildingModel buildingMod if (normal_External != null) { Vector3D normal_Partition = partition.Face3D?.GetPlane()?.Normal; - if(normal_Partition == null) + if (normal_Partition == null) { continue; } @@ -68,13 +71,13 @@ public static List OrientedPartitions(this BuildingModel buildingMod flippedPartition = partition.FlipNormal(false, false); } - if(includeOpenings && partition is IHostPartition) + if (includeOpenings && partition is IHostPartition) { IHostPartition hostPartition = partition as IHostPartition; List openings = hostPartition.GetOpenings(); - if(openings != null && openings.Count != 0) + if (openings != null && openings.Count != 0) { - foreach(IOpening opening in openings) + foreach (IOpening opening in openings) { Vector3D normal_Opening = opening.Face3D?.GetPlane()?.Normal; if (normal_Opening == null) @@ -87,7 +90,7 @@ public static List OrientedPartitions(this BuildingModel buildingMod continue; } - if(flippedPartition == null) + if (flippedPartition == null) { flippedPartition = partition; } @@ -100,7 +103,7 @@ public static List OrientedPartitions(this BuildingModel buildingMod } - if(flippedPartition != null) + if (flippedPartition != null) { flippedPartitions.Add(flippedPartition); } @@ -124,8 +127,8 @@ public static List OrientedPartitions(this BuildingModel buildingMod /// A list of updated partitions. public static List OrientedPartitions(this BuildingModel buildingModel, Space space, bool includeOpenings, bool external = true, double silverSpacing = Core.Tolerance.MacroDistance, double tolerance = Core.Tolerance.Distance) { - return OrientedPartitions(buildingModel, space, includeOpenings, out List flippedPartitions, external, silverSpacing, tolerance); + return OrientedPartitions(buildingModel, space, includeOpenings, out List flippedPartitions, external, silverSpacing, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/Remove.cs b/SAM/SAM.Analytical/Modify/Remove.cs index 4d00d76c8..816bfef08 100644 --- a/SAM/SAM.Analytical/Modify/Remove.cs +++ b/SAM/SAM.Analytical/Modify/Remove.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -78,12 +81,12 @@ public static List Remove(this AdjacencyCluster adjacencyCluster, IEnumera List result = new List(); foreach (KeyValuePair> keyValuePair in dictionary) { - if(keyValuePair.Key.IsAssignableFrom(typeof(Panel))) + if (keyValuePair.Key.IsAssignableFrom(typeof(Panel))) { - foreach(Panel panel in keyValuePair.Value) + foreach (Panel panel in keyValuePair.Value) { List guids_Panel = Remove(adjacencyCluster, panel); - if(guids_Panel != null) + if (guids_Panel != null) { result.AddRange(guids_Panel); } @@ -108,47 +111,47 @@ public static List Remove(this AdjacencyCluster adjacencyCluster, IEnum public static List Remove(this AdjacencyCluster adjacencyCluster, Panel panel) { - if(adjacencyCluster == null || panel == null) + if (adjacencyCluster == null || panel == null) { return null; } Panel panel_AdjacencyCluster = adjacencyCluster.GetObject(panel.Guid); - if(panel_AdjacencyCluster == null) + if (panel_AdjacencyCluster == null) { return null; } List spaces = adjacencyCluster.GetRelatedObjects(panel_AdjacencyCluster); - if(spaces != null && spaces.Count() != 0) + if (spaces != null && spaces.Count() != 0) { List> tuples = new List>(); Dictionary dictionary = new Dictionary(); foreach (Space space_Temp in spaces) { Shell shell = adjacencyCluster.Shell(space_Temp); - if(shell == null) + if (shell == null) { continue; } double volume = shell.Volume(); - if(double.IsNaN(volume)) + if (double.IsNaN(volume)) { continue; } tuples.Add(new Tuple(space_Temp, volume)); - List panels = adjacencyCluster.GetRelatedObjects(space_Temp); - foreach(Panel panel_Temp in panels) + List panels = adjacencyCluster.GetRelatedObjects(space_Temp); + foreach (Panel panel_Temp in panels) { - if(panel_Temp == null) + if (panel_Temp == null) { continue; } - if(panel_Temp.Guid == panel.Guid) + if (panel_Temp.Guid == panel.Guid) { continue; } @@ -157,7 +160,7 @@ public static List Remove(this AdjacencyCluster adjacencyCluster, Panel pa } } - if(tuples != null && tuples.Count != 0) + if (tuples != null && tuples.Count != 0) { Space space = tuples[0].Item1; tuples.Sort((x, y) => y.Item2.CompareTo(x.Item2)); @@ -185,4 +188,4 @@ public static List Remove(this AdjacencyCluster adjacencyCluster, Panel pa return new List() { panel.Guid }; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/RemoveAirMovementObjects.cs b/SAM/SAM.Analytical/Modify/RemoveAirMovementObjects.cs index 15ba28b5b..ef2d8eef2 100644 --- a/SAM/SAM.Analytical/Modify/RemoveAirMovementObjects.cs +++ b/SAM/SAM.Analytical/Modify/RemoveAirMovementObjects.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System; using System.Collections.Generic; @@ -6,24 +9,24 @@ namespace SAM.Analytical { public static partial class Modify { - public static List RemoveAirMovementObjects(this AdjacencyCluster adjacencyCluster) where T : IAirMovementObject + public static List RemoveAirMovementObjects(this AdjacencyCluster adjacencyCluster) where T : IAirMovementObject { - if(adjacencyCluster == null) + if (adjacencyCluster == null) { return null; } List airMovemenetObjects = adjacencyCluster.GetObjects(); - if(airMovemenetObjects == null) + if (airMovemenetObjects == null) { return null; } - List sAMObjects = new List(); - foreach(T airMovemenetObject in airMovemenetObjects) + List sAMObjects = new List(); + foreach (T airMovemenetObject in airMovemenetObjects) { SAMObject sAMObject = airMovemenetObject as SAMObject; - if(airMovemenetObject == null) + if (airMovemenetObject == null) { continue; } @@ -34,4 +37,4 @@ public static List RemoveAirMovementObjects(this AdjacencyCluster adjac return adjacencyCluster.Remove(sAMObjects); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/RemoveExternalSpaces.cs b/SAM/SAM.Analytical/Modify/RemoveExternalSpaces.cs index 43f0202b3..751e9adfd 100644 --- a/SAM/SAM.Analytical/Modify/RemoveExternalSpaces.cs +++ b/SAM/SAM.Analytical/Modify/RemoveExternalSpaces.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -33,4 +36,4 @@ public static void RemoveExternalSpaces(this AdjacencyCluster adjacencyCluster, } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/RemoveInvalidAirPanels.cs b/SAM/SAM.Analytical/Modify/RemoveInvalidAirPanels.cs index 721ed4432..918b8b530 100644 --- a/SAM/SAM.Analytical/Modify/RemoveInvalidAirPanels.cs +++ b/SAM/SAM.Analytical/Modify/RemoveInvalidAirPanels.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -12,25 +15,25 @@ public static partial class Modify List guids = new List(); List panels = adjacencyCluster.GetPanels(); - if(panels == null || panels.Count == 0) + if (panels == null || panels.Count == 0) { return guids; } - foreach(Panel panel in panels) + foreach (Panel panel in panels) { - if(panel == null) + if (panel == null) { continue; } - if(panel.Construction != null && panel.PanelType != PanelType.Air) + if (panel.Construction != null && panel.PanelType != PanelType.Air) { continue; } List spaces = adjacencyCluster.GetSpaces(panel); - if(spaces != null && spaces.Count > 1) + if (spaces != null && spaces.Count > 1) { continue; } @@ -41,4 +44,4 @@ public static partial class Modify return adjacencyCluster.Remove(typeof(Panel), guids); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/RemoveOverlapApertures.cs b/SAM/SAM.Analytical/Modify/RemoveOverlapApertures.cs index 2a1f6de0d..9162b04d1 100644 --- a/SAM/SAM.Analytical/Modify/RemoveOverlapApertures.cs +++ b/SAM/SAM.Analytical/Modify/RemoveOverlapApertures.cs @@ -1,5 +1,8 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Geometry.Planar; +using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -10,7 +13,7 @@ public static partial class Modify public static bool RemoveOverlapApertures(this Panel panel, out List removedApertures, double tolerance = Core.Tolerance.Distance) { removedApertures = null; - + List apertures = panel?.Apertures; if (apertures == null || apertures.Count < 2) { @@ -18,16 +21,16 @@ public static bool RemoveOverlapApertures(this Panel panel, out List r } Plane plane = panel.Plane; - if(plane == null) + if (plane == null) { return false; } List> tuples = new List>(); - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { Face2D face2D = plane.Convert(plane.Project(aperture?.GetFace3D())); - if(face2D == null) + if (face2D == null) { continue; } @@ -35,12 +38,12 @@ public static bool RemoveOverlapApertures(this Panel panel, out List r tuples.Add(new Tuple(face2D.GetBoundingBox(), face2D, aperture)); } - if(tuples == null || tuples.Count == 0) + if (tuples == null || tuples.Count == 0) { return false; } - for(int i=0; i < tuples.Count - 1; i++) + for (int i = 0; i < tuples.Count - 1; i++) { Tuple tuple_1 = tuples[i]; @@ -99,24 +102,24 @@ public static bool RemoveOverlapApertures(this List panels, out List removedApertures_Temp, tolerance)) + if (!RemoveOverlapApertures(panel, out List removedApertures_Temp, tolerance)) { continue; } panels[i] = panel; result = true; - - if(removedApertures_Temp == null || removedApertures_Temp.Count == 0) + + if (removedApertures_Temp == null || removedApertures_Temp.Count == 0) { continue; } @@ -138,7 +141,7 @@ public static bool RemoveOverlapApertures(this AdjacencyCluster adjacencyCluster removedApertures = null; List panels = adjacencyCluster?.GetPanels(); - if(panels == null || panels.Count == 0) + if (panels == null || panels.Count == 0) { return false; } @@ -148,7 +151,7 @@ public static bool RemoveOverlapApertures(this AdjacencyCluster adjacencyCluster return false; } - foreach(Panel panel in panels) + foreach (Panel panel in panels) { adjacencyCluster.AddObject(panel); } @@ -156,4 +159,4 @@ public static bool RemoveOverlapApertures(this AdjacencyCluster adjacencyCluster return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/RemoveSpaces.cs b/SAM/SAM.Analytical/Modify/RemoveSpaces.cs index d36c5e257..854eb671f 100644 --- a/SAM/SAM.Analytical/Modify/RemoveSpaces.cs +++ b/SAM/SAM.Analytical/Modify/RemoveSpaces.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -20,7 +23,7 @@ public static List RemoveSpaces(this AdjacencyCluster adjacencyCluster, I List result = []; - if(point3Ds_Temp.Count == 0) + if (point3Ds_Temp.Count == 0) { return result; } @@ -33,32 +36,32 @@ public static List RemoveSpaces(this AdjacencyCluster adjacencyCluster, I List guids = []; - foreach(KeyValuePair keyValuePair in dictionary) + foreach (KeyValuePair keyValuePair in dictionary) { - if(keyValuePair.Value.GetBoundingBox() is not BoundingBox3D boundingBox3D ) + if (keyValuePair.Value.GetBoundingBox() is not BoundingBox3D boundingBox3D) { continue; } List point3Ds_Shell = point3Ds_Temp.FindAll(x => boundingBox3D.InRange(x, tolerance_Distance)); - if(point3Ds_Shell.Count == 0) + if (point3Ds_Shell.Count == 0) { continue; } Point3D point3D = point3Ds_Shell.Find(x => keyValuePair.Value.InRange(x, tolerance_Distance)); - if(point3D is null) + if (point3D is null) { continue; } List panels = adjacencyCluster.GetPanels(keyValuePair.Key); - if(panels != null && panels.Count > 0) + if (panels != null && panels.Count > 0) { - foreach(Panel panel in panels) + foreach (Panel panel in panels) { List spaces = adjacencyCluster.GetSpaces(panel); - if(spaces != null && spaces.Count == 1 && spaces[0].Guid == keyValuePair.Key.Guid) + if (spaces != null && spaces.Count == 1 && spaces[0].Guid == keyValuePair.Key.Guid) { adjacencyCluster.RemoveObject(panel); continue; @@ -72,7 +75,7 @@ public static List RemoveSpaces(this AdjacencyCluster adjacencyCluster, I result.Add(keyValuePair.Key); } - if(guids == null || guids.Count == 0) + if (guids == null || guids.Count == 0) { return result; } @@ -114,4 +117,4 @@ public static List RemoveSpaces(this AdjacencyCluster adjacencyCluster, I } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/RemoveUnusedMaterials.cs b/SAM/SAM.Analytical/Modify/RemoveUnusedMaterials.cs index a5f91129b..98198ae78 100644 --- a/SAM/SAM.Analytical/Modify/RemoveUnusedMaterials.cs +++ b/SAM/SAM.Analytical/Modify/RemoveUnusedMaterials.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -6,7 +9,7 @@ public static partial class Modify { public static HashSet RemoveUnusedMaterials(this ConstructionManager constructionManager) { - if(constructionManager == null) + if (constructionManager == null) { return null; } @@ -18,14 +21,14 @@ public static HashSet RemoveUnusedMaterials(this ConstructionManager con } HashSet names = new HashSet(); - + List constructions = constructionManager.Constructions; - if(constructions != null) + if (constructions != null) { - foreach(Construction construction in constructions) + foreach (Construction construction in constructions) { List constructionLayers = construction?.ConstructionLayers; - if(constructionLayers == null || constructionLayers.Count == 0) + if (constructionLayers == null || constructionLayers.Count == 0) { continue; } @@ -56,10 +59,10 @@ public static HashSet RemoveUnusedMaterials(this ConstructionManager con } HashSet result = new HashSet(); - + foreach (Core.IMaterial material in materials) { - if(!names.Contains(material.Name)) + if (!names.Contains(material.Name)) { constructionManager.Remove(material); result.Add(material.Name); @@ -69,4 +72,4 @@ public static HashSet RemoveUnusedMaterials(this ConstructionManager con return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/Replace.cs b/SAM/SAM.Analytical/Modify/Replace.cs index f31d2a04f..a9eb88119 100644 --- a/SAM/SAM.Analytical/Modify/Replace.cs +++ b/SAM/SAM.Analytical/Modify/Replace.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Analytical @@ -13,16 +16,16 @@ public static bool Replace(this AdjacencyCluster adjacencyCluster, ApertureConst } List panels = adjacencyCluster.GetPanels(); - if(panels == null || panels.Count == 0) + if (panels == null || panels.Count == 0) { return false; } bool result = false; - foreach (Panel panel in panels) + foreach (Panel panel in panels) { List apertures = panel?.Apertures; - if(apertures == null || apertures.Count == 0) + if (apertures == null || apertures.Count == 0) { continue; } @@ -31,14 +34,14 @@ public static bool Replace(this AdjacencyCluster adjacencyCluster, ApertureConst foreach (Aperture aperture in apertures) { ApertureConstruction apertureConstruction = aperture?.ApertureConstruction; - if(apertureConstruction.Guid != apertureConstruction_Existing.Guid) + if (apertureConstruction.Guid != apertureConstruction_Existing.Guid) { continue; } Aperture aperture_New = new Aperture(aperture, apertureConstruction_New); - if(panel_New == null) + if (panel_New == null) { panel_New = new Panel(panel); } @@ -47,7 +50,7 @@ public static bool Replace(this AdjacencyCluster adjacencyCluster, ApertureConst panel_New.AddAperture(aperture_New); } - if(panel_New != null) + if (panel_New != null) { result = true; adjacencyCluster.AddObject(panel_New); @@ -74,7 +77,7 @@ public static bool Replace(this AdjacencyCluster adjacencyCluster, Construction foreach (Panel panel in panels) { Construction construction = panel?.Construction; - if(construction == null) + if (construction == null) { continue; } @@ -108,12 +111,12 @@ public static bool Replace(this AdjacencyCluster adjacencyCluster, Space space_E bool result = false; foreach (Space space in spaces) { - if(space == null) + if (space == null) { continue; } - if(space.Guid != space_Existing.Guid) + if (space.Guid != space_Existing.Guid) { continue; } @@ -135,7 +138,7 @@ public static bool Replace(this MaterialLibrary materialLibrary, IMaterial mater return false; } - if(!materialLibrary.Contains(material_Existing)) + if (!materialLibrary.Contains(material_Existing)) { return false; } @@ -164,16 +167,16 @@ public static bool Replace(this AdjacencyCluster adjacencyCluster, IMaterial mat Panel panel_New = null; Construction construction = panel?.Construction; - if(construction != null) + if (construction != null) { List constructionLayers = construction.ConstructionLayers; - if(constructionLayers != null) + if (constructionLayers != null) { - for(int i = 0; i < constructionLayers.Count; i++) + for (int i = 0; i < constructionLayers.Count; i++) { if (constructionLayers[i].Name == material_Existing.Name) { - if(panel_New == null) + if (panel_New == null) { panel_New = new Panel(panel); } @@ -183,7 +186,7 @@ public static bool Replace(this AdjacencyCluster adjacencyCluster, IMaterial mat } } - if(panel_New != null) + if (panel_New != null) { adjacencyCluster.AddObject(panel_New); } @@ -200,7 +203,7 @@ public static bool Replace(this AdjacencyCluster adjacencyCluster, IMaterial mat foreach (Aperture aperture in apertures) { Aperture aperture_New = null; - + ApertureConstruction apertureConstruction = aperture?.ApertureConstruction; if (apertureConstruction != null) { @@ -295,22 +298,22 @@ public static bool Replace(this AdjacencyCluster adjacencyCluster, Profile profi } List spaces = adjacencyCluster.GetSpaces(); - if(spaces == null) + if (spaces == null) { return false; } bool result = false; - foreach(Space space in spaces) + foreach (Space space in spaces) { InternalCondition internalCondition = space?.InternalCondition; - if(internalCondition == null) + if (internalCondition == null) { continue; } string profileName = internalCondition.GetProfileName(profile_Existing.ProfileType); - if(profileName == profile_Existing.Name) + if (profileName == profile_Existing.Name) { continue; } @@ -327,4 +330,4 @@ public static bool Replace(this AdjacencyCluster adjacencyCluster, Profile profi return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/ReplaceApertureConstruction.cs b/SAM/SAM.Analytical/Modify/ReplaceApertureConstruction.cs index 7f352d986..e7bb5d059 100644 --- a/SAM/SAM.Analytical/Modify/ReplaceApertureConstruction.cs +++ b/SAM/SAM.Analytical/Modify/ReplaceApertureConstruction.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -10,8 +13,8 @@ public static List ReplaceApertureConstruction(this AdjacencyCluster a { if (adjacencyCluster == null || guids == null || apertureConstruction == null) return null; - - + + List result = new List(); List panels = adjacencyCluster.GetPanels(); @@ -20,23 +23,23 @@ public static List ReplaceApertureConstruction(this AdjacencyCluster a return result; } - foreach(Panel panel in panels) + foreach (Panel panel in panels) { List apertures = panel?.Apertures; - if(apertures == null || apertures.Count == 0) + if (apertures == null || apertures.Count == 0) { continue; } Panel panel_New = null; - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { - if(aperture == null || !guids.Contains(aperture.Guid)) + if (aperture == null || !guids.Contains(aperture.Guid)) { continue; } - if(panel_New == null) + if (panel_New == null) { panel_New = new Panel(panel); } @@ -48,7 +51,7 @@ public static List ReplaceApertureConstruction(this AdjacencyCluster a result.Add(aperture_New); } - if(panel_New != null) + if (panel_New != null) { adjacencyCluster.AddObject(panel_New); } @@ -57,4 +60,4 @@ public static List ReplaceApertureConstruction(this AdjacencyCluster a return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/ReplaceConstruction.cs b/SAM/SAM.Analytical/Modify/ReplaceConstruction.cs index 3e5e1930e..77eaade79 100644 --- a/SAM/SAM.Analytical/Modify/ReplaceConstruction.cs +++ b/SAM/SAM.Analytical/Modify/ReplaceConstruction.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Analytical @@ -9,15 +12,15 @@ public static List ReplaceConstruction(this AdjacencyCluster adjacencyClu { if (adjacencyCluster == null || guids == null || construction == null) return null; - - + + List result = new List(); List panels = adjacencyCluster.GetPanels(); if (panels == null || panels.Count == 0) return result; - foreach(Guid guid in guids) + foreach (Guid guid in guids) { Panel panel = adjacencyCluster.GetObject(guid); if (panel == null) @@ -25,7 +28,7 @@ public static List ReplaceConstruction(this AdjacencyCluster adjacencyClu Panel panel_New = new Panel(panel, construction); - if(apertureConstruction != null) + if (apertureConstruction != null) { panel_New.AddApertures(apertureConstruction, panel.GetFace3D(), false); @@ -42,4 +45,4 @@ public static List ReplaceConstruction(this AdjacencyCluster adjacencyClu return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/ReplaceTransparentPanels.cs b/SAM/SAM.Analytical/Modify/ReplaceTransparentPanels.cs index 27ba7867e..d9b63a564 100644 --- a/SAM/SAM.Analytical/Modify/ReplaceTransparentPanels.cs +++ b/SAM/SAM.Analytical/Modify/ReplaceTransparentPanels.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System; using System.Collections.Generic; @@ -18,11 +21,11 @@ public static List ReplaceTransparentPanels(this AdjacencyCluster adjacen return result; Dictionary dictionary = new Dictionary(); - foreach(Panel panel in panels) + foreach (Panel panel in panels) { PanelType panelType = panel.PanelType; - if(panelType.PanelGroup() == PanelGroup.Wall) + if (panelType.PanelGroup() == PanelGroup.Wall) { List spaces = adjacencyCluster.GetSpaces(panel); if (spaces == null || spaces.Count == 0) @@ -46,8 +49,8 @@ public static List ReplaceTransparentPanels(this AdjacencyCluster adjacen if (construction_Panel == null) construction_Panel = construction; - ApertureConstruction apertureConstruction = null; - if(!dictionary.TryGetValue(construction_Panel.Guid, out apertureConstruction)) + ApertureConstruction apertureConstruction = null; + if (!dictionary.TryGetValue(construction_Panel.Guid, out apertureConstruction)) { apertureConstruction = new ApertureConstruction(Guid.NewGuid(), construction_Panel.Name, ApertureType.Window, construction_Panel.ConstructionLayers); dictionary[construction_Panel.Guid] = apertureConstruction; @@ -69,4 +72,4 @@ public static List ReplaceTransparentPanels(this AdjacencyCluster adjacen } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/SetConstructionsDefaultPanelType.cs b/SAM/SAM.Analytical/Modify/SetConstructionsDefaultPanelType.cs index 0d2d10e5f..34bc2a178 100644 --- a/SAM/SAM.Analytical/Modify/SetConstructionsDefaultPanelType.cs +++ b/SAM/SAM.Analytical/Modify/SetConstructionsDefaultPanelType.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System; using System.Collections.Generic; using System.Linq; @@ -31,21 +34,21 @@ public static List SetConstructionsDefaultPanelType(this Adjacency if (panelTypes.Count == 1 && panelTypes[0].Equals(panelType_Construction)) continue; - if(panelTypes.Contains(panelType_Construction)) + if (panelTypes.Contains(panelType_Construction)) { panels.RemoveAll(x => x.PanelType == panelType_Construction); panelTypes.Remove(panelType_Construction); } - - foreach(PanelType panelType in panelTypes) + + foreach (PanelType panelType in panelTypes) { Construction construction_PanelType = updateNames ? new Construction(construction, string.Format("{0} ({1})", construction.Name, Core.Query.Description(panelType))) : new Construction(construction, Guid.NewGuid()); construction_PanelType.SetValue(ConstructionParameter.DefaultPanelType, panelType.Text()); - + List panels_PanelType = panels.FindAll(x => x.PanelType == panelType); - foreach(Panel panel in panels_PanelType) + foreach (Panel panel in panels_PanelType) { Panel panel_New = new Panel(panel, construction_PanelType); adjacencyCluster.AddObject(panel_New); diff --git a/SAM/SAM.Analytical/Modify/SetDefaultApertureConstruction.cs b/SAM/SAM.Analytical/Modify/SetDefaultApertureConstruction.cs index ac333cf06..439e12133 100644 --- a/SAM/SAM.Analytical/Modify/SetDefaultApertureConstruction.cs +++ b/SAM/SAM.Analytical/Modify/SetDefaultApertureConstruction.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -9,17 +12,17 @@ public static partial class Modify public static IEnumerable SetDefaultApertureConstruction(this AdjacencyCluster adjacencyCluster, IEnumerable guids = null) { List panels = adjacencyCluster?.GetPanels(); - if(panels == null || panels.Count == 0) + if (panels == null || panels.Count == 0) { return null; } List result = new List(); - foreach(Panel panel in panels) + foreach (Panel panel in panels) { List apertures = panel?.Apertures; - if(apertures == null || apertures.Count == 0) + if (apertures == null || apertures.Count == 0) { continue; } @@ -27,9 +30,9 @@ public static IEnumerable SetDefaultApertureConstruction(this Adjacenc PanelType panelType = panel.PanelType; List> tuples = new List>(); - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { - if(aperture == null) + if (aperture == null) { continue; } @@ -40,12 +43,12 @@ public static IEnumerable SetDefaultApertureConstruction(this Adjacenc } ApertureConstruction apertureConstruction = Query.DefaultApertureConstruction(panel, aperture.ApertureType); - if(apertureConstruction == null) + if (apertureConstruction == null) { continue; } - if(aperture.Name != null && apertureConstruction.Name == aperture.Name) + if (aperture.Name != null && apertureConstruction.Name == aperture.Name) { continue; } @@ -53,22 +56,22 @@ public static IEnumerable SetDefaultApertureConstruction(this Adjacenc tuples.Add(new Tuple(aperture, apertureConstruction)); } - if(tuples == null || tuples.Count == 0) + if (tuples == null || tuples.Count == 0) { continue; } Panel panel_New = new Panel(panel); - foreach(Tuple tuple in tuples) + foreach (Tuple tuple in tuples) { Aperture aperture = new Aperture(tuple.Item1, tuple.Item2); - if(aperture == null) + if (aperture == null) { continue; } - if(panel_New.RemoveAperture(aperture.Guid)) + if (panel_New.RemoveAperture(aperture.Guid)) { panel_New.AddAperture(aperture); result.Add(aperture); @@ -81,4 +84,4 @@ public static IEnumerable SetDefaultApertureConstruction(this Adjacenc return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/SetDefaultApertureConstructionLayers.cs b/SAM/SAM.Analytical/Modify/SetDefaultApertureConstructionLayers.cs index 6746d0a90..f469ea64c 100644 --- a/SAM/SAM.Analytical/Modify/SetDefaultApertureConstructionLayers.cs +++ b/SAM/SAM.Analytical/Modify/SetDefaultApertureConstructionLayers.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -9,17 +12,17 @@ public static partial class Modify public static IEnumerable SetDefaultApertureConstructionLayers(this AdjacencyCluster adjacencyCluster, IEnumerable guids = null) { List panels = adjacencyCluster?.GetPanels(); - if(panels == null || panels.Count == 0) + if (panels == null || panels.Count == 0) { return null; } List>>> tuples = new List>>>(); - foreach(Panel panel in panels) + foreach (Panel panel in panels) { List apertures_Panel = panel?.Apertures; - if(apertures_Panel == null || apertures_Panel.Count == 0) + if (apertures_Panel == null || apertures_Panel.Count == 0) { continue; } @@ -27,9 +30,9 @@ public static IEnumerable SetDefaultApertureConstructionLayers(this Ad PanelType panelType = panel.PanelType; List apertures = new List(); - foreach(Aperture aperture_Panel in apertures_Panel) + foreach (Aperture aperture_Panel in apertures_Panel) { - if(aperture_Panel == null) + if (aperture_Panel == null) { continue; } @@ -40,12 +43,12 @@ public static IEnumerable SetDefaultApertureConstructionLayers(this Ad } ApertureConstruction apertureConstruction_Default = Query.DefaultApertureConstruction(panel, aperture_Panel.ApertureType); - if(apertureConstruction_Default == null) + if (apertureConstruction_Default == null) { continue; } - if(aperture_Panel.Name != null && apertureConstruction_Default.Name == aperture_Panel.Name) + if (aperture_Panel.Name != null && apertureConstruction_Default.Name == aperture_Panel.Name) { continue; } @@ -53,20 +56,20 @@ public static IEnumerable SetDefaultApertureConstructionLayers(this Ad apertures.Add(aperture_Panel); } - if(apertures == null || apertures.Count == 0) + if (apertures == null || apertures.Count == 0) { continue; } - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { ApertureConstruction apertureConstruction = aperture.ApertureConstruction; int index = tuples.FindIndex(x => apertureConstruction == null ? x == null : apertureConstruction.Guid == x.Item1?.Guid); Tuple>> tuple = null; - if (index != -1) - { + if (index != -1) + { tuple = tuples[index]; } else @@ -80,19 +83,19 @@ public static IEnumerable SetDefaultApertureConstructionLayers(this Ad } List result = new List(); - foreach(Tuple>> tuple in tuples) + foreach (Tuple>> tuple in tuples) { ApertureConstruction apertureConstruction = tuple.Item1; - foreach(ApertureType apertureType in Enum.GetValues(typeof(ApertureType))) + foreach (ApertureType apertureType in Enum.GetValues(typeof(ApertureType))) { List> tuples_ApertureType = tuple.Item2.FindAll(x => x.Item1.ApertureType == apertureType); - if(tuples_ApertureType == null || tuples_ApertureType.Count == 0) + if (tuples_ApertureType == null || tuples_ApertureType.Count == 0) { continue; } - foreach(PanelType panelType in Enum.GetValues(typeof(PanelType))) + foreach (PanelType panelType in Enum.GetValues(typeof(PanelType))) { List> tuples_PanelType = tuple.Item2.FindAll(x => x.Item3 == panelType); if (tuples_PanelType == null || tuples_PanelType.Count == 0) @@ -131,4 +134,4 @@ public static IEnumerable SetDefaultApertureConstructionLayers(this Ad return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/SetDefaultConstructionByPanelType.cs b/SAM/SAM.Analytical/Modify/SetDefaultConstructionByPanelType.cs index eb72aabae..f69394b4e 100644 --- a/SAM/SAM.Analytical/Modify/SetDefaultConstructionByPanelType.cs +++ b/SAM/SAM.Analytical/Modify/SetDefaultConstructionByPanelType.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -31,7 +34,7 @@ public static IEnumerable SetDefaultConstructionByPanelType(this Adjacenc foreach (Panel panel in panels) { PanelType panelType = panel.PanelType; - if(panelType == PanelType.Undefined) + if (panelType == PanelType.Undefined) { continue; } @@ -41,7 +44,7 @@ public static IEnumerable SetDefaultConstructionByPanelType(this Adjacenc Construction construction = panel.Construction; if (string.IsNullOrWhiteSpace(construction?.Name)) { - if(panelType != PanelType.Air) + if (panelType != PanelType.Air) { update = true; } @@ -168,4 +171,4 @@ public static IEnumerable SetDefaultConstructionByPanelType(this Adjacenc return result.Values; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/SetDefaultConstructionLayerByPanelType.cs b/SAM/SAM.Analytical/Modify/SetDefaultConstructionLayerByPanelType.cs index 8babb49a4..8f42fe879 100644 --- a/SAM/SAM.Analytical/Modify/SetDefaultConstructionLayerByPanelType.cs +++ b/SAM/SAM.Analytical/Modify/SetDefaultConstructionLayerByPanelType.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -33,7 +36,7 @@ public static IEnumerable SetDefaultConstructionLayerByPanelType(this Adj foreach (Panel panel in panels) { PanelType panelType = panel.PanelType; - if(panelType == PanelType.Undefined) + if (panelType == PanelType.Undefined) { continue; } @@ -43,7 +46,7 @@ public static IEnumerable SetDefaultConstructionLayerByPanelType(this Adj Construction construction = panel.Construction; if (string.IsNullOrWhiteSpace(construction?.Name)) { - if(panelType != PanelType.Air) + if (panelType != PanelType.Air) { update = true; } @@ -161,7 +164,7 @@ public static IEnumerable SetDefaultConstructionLayerByPanelType(this Adj continue; } - if(tuples.Find(x => x.Item1.Guid == panel.Guid) != null) + if (tuples.Find(x => x.Item1.Guid == panel.Guid) != null) { continue; } @@ -185,10 +188,10 @@ public static IEnumerable SetDefaultConstructionLayerByPanelType(this Adj tuples_Construction.ForEach(x => tuples.Remove(x)); IEnumerable panelTypes = tuples_Construction.ConvertAll(x => x.Item2).Distinct(); - foreach(PanelType panelType in panelTypes) + foreach (PanelType panelType in panelTypes) { List> tuples_PanelType = tuples_Construction.FindAll(x => x.Item2 == panelType); - foreach(Tuple tuple_PanelType in tuples_PanelType) + foreach (Tuple tuple_PanelType in tuples_PanelType) { Construction construction_Default = Query.DefaultConstruction(panelType); if (construction_Default == null) @@ -202,7 +205,7 @@ public static IEnumerable SetDefaultConstructionLayerByPanelType(this Adj adjacencyCluster.AddObject(panel_New); dictionary[panel_New.Guid] = panel_New; - if(panelTypes.Count() > 1) + if (panelTypes.Count() > 1) { panelsWithIssues.Add(panel_New); } @@ -213,4 +216,4 @@ public static IEnumerable SetDefaultConstructionLayerByPanelType(this Adj return dictionary.Values; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/SetInternalCondition.cs b/SAM/SAM.Analytical/Modify/SetInternalCondition.cs index 256308d41..b90c4b3b2 100644 --- a/SAM/SAM.Analytical/Modify/SetInternalCondition.cs +++ b/SAM/SAM.Analytical/Modify/SetInternalCondition.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Analytical @@ -14,7 +17,7 @@ public static List SetInternalCondition(this AdjacencyCluster adjacencyCl if (guids != null) spaces.RemoveAll(x => x == null || !guids.Contains(x.Guid)); - foreach(Space space in spaces) + foreach (Space space in spaces) { space.InternalCondition = internalCondition; adjacencyCluster.AddObject(space); @@ -23,4 +26,4 @@ public static List SetInternalCondition(this AdjacencyCluster adjacencyCl return spaces; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/SetOccupantGains.cs b/SAM/SAM.Analytical/Modify/SetOccupantGains.cs index 3367b6d50..47112661d 100644 --- a/SAM/SAM.Analytical/Modify/SetOccupantGains.cs +++ b/SAM/SAM.Analytical/Modify/SetOccupantGains.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Modify { @@ -16,7 +19,7 @@ public static bool SetOccupancyGains(this InternalCondition internalCondition, D internalCondition.SetValue(InternalConditionParameter.OccupancyLatentGainPerPerson, latent); result = true; } - + double sensible = degreeOfActivity.Sensible; if (!double.IsNaN(sensible)) @@ -44,4 +47,4 @@ public static bool SetOccupancyGains(this Space space, DegreeOfActivity degreeOf return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/SimplifyByAngle.cs b/SAM/SAM.Analytical/Modify/SimplifyByAngle.cs index 4a5206d8f..beca6d703 100644 --- a/SAM/SAM.Analytical/Modify/SimplifyByAngle.cs +++ b/SAM/SAM.Analytical/Modify/SimplifyByAngle.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; namespace SAM.Analytical @@ -8,16 +11,16 @@ public static partial class Modify public static void SimplifyByAngle(this AdjacencyCluster adjacencyCluster, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { List panels = adjacencyCluster?.GetPanels(); - if(panels == null) + if (panels == null) { return; } - foreach(Panel panel in panels) + foreach (Panel panel in panels) { Face3D face3D = panel?.GetFace3D(); - if(face3D == null) + if (face3D == null) { continue; } @@ -25,19 +28,19 @@ public static void SimplifyByAngle(this AdjacencyCluster adjacencyCluster, doubl face3D = face3D.SimplifyByAngle(tolerance_Angle, tolerance_Distance); Panel panel_New = Create.Panel(panel.Guid, panel, face3D); List apertures = panel_New.Apertures; - if(apertures != null) + if (apertures != null) { - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { Face3D face3D_Aperture = aperture?.Face3D; - if(face3D_Aperture == null) + if (face3D_Aperture == null) { continue; } face3D_Aperture = face3D_Aperture.SimplifyByAngle(tolerance_Angle, tolerance_Distance); Aperture aperture_New = Create.Aperture(aperture, face3D_Aperture, aperture.Guid); - if(aperture_New != null) + if (aperture_New != null) { panel_New.RemoveAperture(aperture.Guid); panel_New.AddAperture(aperture_New); @@ -49,4 +52,4 @@ public static void SimplifyByAngle(this AdjacencyCluster adjacencyCluster, doubl } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/SplitMaterialsByThickness.cs b/SAM/SAM.Analytical/Modify/SplitMaterialsByThickness.cs index 570a17497..1e0b02f7c 100644 --- a/SAM/SAM.Analytical/Modify/SplitMaterialsByThickness.cs +++ b/SAM/SAM.Analytical/Modify/SplitMaterialsByThickness.cs @@ -1,7 +1,10 @@ -using System.Linq; -using System.Collections.Generic; -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core; +using System; +using System.Collections.Generic; +using System.Linq; namespace SAM.Analytical { @@ -10,12 +13,12 @@ public static partial class Modify public static void SplitMaterialsByThickness(this AnalyticalModel analyticalModel, bool includeConstructions = true, bool includeApertureConstructions = true) { AdjacencyCluster adjacencyCluster = analyticalModel?.AdjacencyCluster; - if(adjacencyCluster == null) + if (adjacencyCluster == null) { return; } - if(!includeConstructions && !includeApertureConstructions) + if (!includeConstructions && !includeApertureConstructions) { return; } @@ -43,7 +46,7 @@ public static void SplitMaterialsByThickness(this AnalyticalModel analyticalMode } } - if(includeApertureConstructions) + if (includeApertureConstructions) { apertureConstructions = adjacencyCluster.GetApertureConstructions(); if (apertureConstructions != null) @@ -67,16 +70,16 @@ public static void SplitMaterialsByThickness(this AnalyticalModel analyticalMode } } - if(constructionLayers == null || constructionLayers.Count == 0) + if (constructionLayers == null || constructionLayers.Count == 0) { return; } List> tuples = new List>(); - while(constructionLayers.Count != 0) + while (constructionLayers.Count != 0) { ConstructionLayer constructionLayer = constructionLayers[0]; - if(constructionLayer == null) + if (constructionLayer == null) { constructionLayers.RemoveAt(0); continue; @@ -85,7 +88,7 @@ public static void SplitMaterialsByThickness(this AnalyticalModel analyticalMode string name = constructionLayer.Name; List constructionLayers_Name = constructionLayers.FindAll(x => x.Name == name); - if(constructionLayers_Name == null || constructionLayers.Count < 2) + if (constructionLayers_Name == null || constructionLayers.Count < 2) { constructionLayers.RemoveAt(0); continue; @@ -94,19 +97,19 @@ public static void SplitMaterialsByThickness(this AnalyticalModel analyticalMode constructionLayers.RemoveAt(0); IEnumerable thicknesses = constructionLayers_Name.ConvertAll(x => x.Thickness).Distinct(); - if(thicknesses == null || thicknesses.Count() < 2) + if (thicknesses == null || thicknesses.Count() < 2) { continue; } - foreach(double thickness in thicknesses) + foreach (double thickness in thicknesses) { ConstructionLayer constructionLayer_New = new ConstructionLayer(string.Format("{0}_{1}", name, thickness), thickness); tuples.Add(new Tuple(name, constructionLayer_New)); } } - if(tuples == null || tuples.Count == 0) + if (tuples == null || tuples.Count == 0) { return; } @@ -228,12 +231,12 @@ public static void SplitMaterialsByThickness(this AnalyticalModel analyticalMode } MaterialLibrary materialLibrary = analyticalModel.MaterialLibrary; - if(materialLibrary != null) + if (materialLibrary != null) { - foreach(Tuple tuple in tuples) + foreach (Tuple tuple in tuples) { Material material = materialLibrary.GetMaterial(tuple.Item1) as Material; - if(material == null) + if (material == null) { continue; } @@ -249,8 +252,8 @@ public static void SplitMaterialsByThickness(this AnalyticalModel analyticalMode analyticalModel.AddMaterial(material); } - + } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/SplitPanels.cs b/SAM/SAM.Analytical/Modify/SplitPanels.cs index 0edbd71f1..ed2c7fc0b 100644 --- a/SAM/SAM.Analytical/Modify/SplitPanels.cs +++ b/SAM/SAM.Analytical/Modify/SplitPanels.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System; @@ -48,10 +51,10 @@ public static List SplitPanels(this AdjacencyCluster adjacencyCluster, continue; } - for (int i=0; i < face3Ds.Count; i++) + for (int i = 0; i < face3Ds.Count; i++) { Guid guid = panel.Guid; - if(i > 0) + if (i > 0) { guid = Guid.NewGuid(); } @@ -61,12 +64,12 @@ public static List SplitPanels(this AdjacencyCluster adjacencyCluster, adjacencyCluster.AddObject(panel_New); - if(i > 0) + if (i > 0) { List objects = adjacencyCluster.GetRelatedObjects(panel.Guid); - if(objects != null) + if (objects != null) { - foreach(IJSAMObject @object in objects) + foreach (IJSAMObject @object in objects) { adjacencyCluster.AddRelation(panel_New, @object); } @@ -134,12 +137,12 @@ public static List SplitPanels(this AdjacencyCluster adjacencyCluster, IE Panel panel_Old = null; Point3D point3D = face3Ds[i].GetInternalPoint3D(tolerance_Distance); - if(point3D != null) + if (point3D != null) { panel_Old = tuples.FindAll(x => x.Item3.InRange(point3D, tolerance_Distance)).Find(x => x.Item2.InRange(point3D, tolerance_Distance))?.Item1; } - if(panel_Old == null) + if (panel_Old == null) { panel_Old = panel; } @@ -171,4 +174,4 @@ public static List SplitPanels(this AdjacencyCluster adjacencyCluster, IE return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/SplitSpace.cs b/SAM/SAM.Analytical/Modify/SplitSpace.cs index 85c170a9c..a454ab378 100644 --- a/SAM/SAM.Analytical/Modify/SplitSpace.cs +++ b/SAM/SAM.Analytical/Modify/SplitSpace.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -9,19 +12,19 @@ public static partial class Modify { public static List SplitSpace(this AdjacencyCluster adjacencyCluster, Guid spaceGuid, Func func, double elevationOffset = 0.1, double minSectionOffset = 1, double silverSpacing = Core.Tolerance.MacroDistance, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance, double tolerance_Snap = Core.Tolerance.MacroDistance) { - if(adjacencyCluster == null || spaceGuid == Guid.Empty) + if (adjacencyCluster == null || spaceGuid == Guid.Empty) { return null; } Space space = adjacencyCluster.GetObject(spaceGuid); - if(space == null) + if (space == null) { return null; } Shell shell = adjacencyCluster.Shell(space); - if(shell == null) + if (shell == null) { return null; } @@ -35,7 +38,7 @@ public static List SplitSpace(this AdjacencyCluster adjacencyCluster, Gui Plane plane_Bottom = Geometry.Spatial.Create.Plane(boundingBox3D.Min.Z); List face3Ds = shell.Section(plane_Offset, true, tolerance_Angle, tolerance_Distance, tolerance_Snap); - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return null; } @@ -52,19 +55,19 @@ public static List SplitSpace(this AdjacencyCluster adjacencyCluster, Gui foreach (Face3D face3D in face3Ds) { Plane plane_Face3D = face3D.GetPlane(); - if(plane_Face3D == null) + if (plane_Face3D == null) { continue; } Face2D face2D = plane_Face3D.Convert(face3D); - if(face2D == null) + if (face2D == null) { continue; } - ISegmentable2D segmentable2D = face2D.ExternalEdge2D as ISegmentable2D; - if(segmentable2D == null) + ISegmentable2D segmentable2D = face2D.ExternalEdge2D as ISegmentable2D; + if (segmentable2D == null) { throw new NotImplementedException(); } @@ -72,24 +75,24 @@ public static List SplitSpace(this AdjacencyCluster adjacencyCluster, Gui Polygon2D polygon2D = new Polygon2D(segmentable2D.GetPoints()); List offsets = new List(); - foreach(Segment2D segment2D in polygon2D.GetSegments()) + foreach (Segment2D segment2D in polygon2D.GetSegments()) { Point3D point3D = plane_Face3D.Convert(segment2D.Mid()); - if(point3D == null) + if (point3D == null) { offsets.Add(0); continue; } Panel panel = panels.Find(x => x.GetFace3D().On(point3D, tolerance_Snap)); - if(panel == null) + if (panel == null) { offsets.Add(0); continue; } double offset_Panel = func.Invoke(panel); - if(double.IsNaN(offset_Panel)) + if (double.IsNaN(offset_Panel)) { offsets.Add(0); continue; @@ -98,20 +101,20 @@ public static List SplitSpace(this AdjacencyCluster adjacencyCluster, Gui offsets.Add(offset_Panel); } - if(offsets.FindIndex(x => x > 0) == -1) + if (offsets.FindIndex(x => x > 0) == -1) { continue; } //Offset polygon2D List polygon2Ds_Offset = polygon2D.Offset(offsets, true, true, true, tolerance_Distance); - if(polygon2Ds_Offset == null || polygon2Ds_Offset.Count == 0) + if (polygon2Ds_Offset == null || polygon2Ds_Offset.Count == 0) { continue; } //Remove unwanted polygon2Ds - for(int i = polygon2Ds_Offset.Count - 1; i >= 0; i--) + for (int i = polygon2Ds_Offset.Count - 1; i >= 0; i--) { Polygon2D polygon2D_Offset = polygon2Ds_Offset[i]; @@ -133,20 +136,20 @@ public static List SplitSpace(this AdjacencyCluster adjacencyCluster, Gui Func createFace3D = new Func((Segment2D segment2D) => { - if(segment2D == null) + if (segment2D == null) { return null; } Segment3D segment3D = plane_Face3D.Convert(segment2D); - if(segment3D == null) + if (segment3D == null) { return null; } Segment3D segment3D_Top = plane_Top.Project(segment3D); - if(segment3D_Top == null || !segment3D_Top.IsValid() || segment3D_Top.GetLength() < tolerance_Snap) + if (segment3D_Top == null || !segment3D_Top.IsValid() || segment3D_Top.GetLength() < tolerance_Snap) { return null; } @@ -159,19 +162,19 @@ public static List SplitSpace(this AdjacencyCluster adjacencyCluster, Gui return new Face3D(new Polygon3D(new Point3D[] { segment3D_Bottom[0], segment3D_Bottom[1], segment3D_Top[1], segment3D_Top[0] }, tolerance_Distance)); }); - + //Create new face3Ds - foreach(Polygon2D polygon2D_Offset in polygon2Ds_Offset) + foreach (Polygon2D polygon2D_Offset in polygon2Ds_Offset) { List face3Ds_Polygon2D = new List(); foreach (Segment2D segment2D in polygon2D_Offset.GetSegments()) { - if(segment2D == null) + if (segment2D == null) { continue; } - if(segment2D.GetLength() < tolerance_Distance) + if (segment2D.GetLength() < tolerance_Distance) { continue; } @@ -189,7 +192,7 @@ public static List SplitSpace(this AdjacencyCluster adjacencyCluster, Gui } Face3D face3D_New = createFace3D.Invoke(segment2D); - if(face3D_New == null) + if (face3D_New == null) { continue; } @@ -208,7 +211,7 @@ public static List SplitSpace(this AdjacencyCluster adjacencyCluster, Gui foreach (Polygon2D polygon2D_Offset in polygon2Ds_Offset) { List segment2Ds = polygon2D_Offset.GetSegments(); - if(segment2Ds == null || segment2Ds.Count == 0) + if (segment2Ds == null || segment2Ds.Count == 0) { continue; } @@ -223,7 +226,7 @@ public static List SplitSpace(this AdjacencyCluster adjacencyCluster, Gui Segment2D segment2D_2 = Core.Query.Next(segment2Ds, i); Point2D point2D = segment2D_1[1]; - if(polygon2D.On(point2D, tolerance_Snap)) + if (polygon2D.On(point2D, tolerance_Snap)) { continue; } @@ -235,7 +238,7 @@ public static List SplitSpace(this AdjacencyCluster adjacencyCluster, Gui Vector2D vector2D_2 = point2D_Next.Vector(point2D); int index = point2Ds.FindIndex(x => point2D.AlmostEquals(x, tolerance_Distance)); - if(index == -1) + if (index == -1) { continue; } @@ -268,7 +271,7 @@ public static List SplitSpace(this AdjacencyCluster adjacencyCluster, Gui double distance = double.MaxValue; foreach (Point2D point2D_Temp in polygon2D_Simplify) { - if(polygon2D_Offset.On(point2D_Temp, tolerance_Snap)) + if (polygon2D_Offset.On(point2D_Temp, tolerance_Snap)) { continue; } @@ -311,18 +314,18 @@ public static List SplitSpace(this AdjacencyCluster adjacencyCluster, Gui } List face3Ds_Temp = tuples.Find(x => x.Item1.AlmostEquals(point2D_Polygon2D, tolerance_Snap))?.Item2; - if(face3Ds_Temp == null) + if (face3Ds_Temp == null) { face3Ds_Temp = new List(); - tuples.Add(new Tuple>(point2D_Polygon2D, face3Ds_Temp) ); + tuples.Add(new Tuple>(point2D_Polygon2D, face3Ds_Temp)); } face3Ds_Temp.Add(face3D_New); } - if(tuples != null && tuples.Count != 0) + if (tuples != null && tuples.Count != 0) { - foreach(Tuple> tuple in tuples) + foreach (Tuple> tuple in tuples) { if (tuple.Item2.Count > 1) { @@ -339,29 +342,29 @@ public static List SplitSpace(this AdjacencyCluster adjacencyCluster, Gui } - if(face3Ds_New == null || face3Ds_New.Count == 0) + if (face3Ds_New == null || face3Ds_New.Count == 0) { return null; } List panels_Result = adjacencyCluster.AddPanels(face3Ds_New, null, new Space[] { space }, silverSpacing, tolerance_Angle, tolerance_Distance, tolerance_Snap); - if(panels_Result == null) + if (panels_Result == null) { return null; } List result = new List(); - foreach(Panel panel_Result in panels_Result) + foreach (Panel panel_Result in panels_Result) { List spaces_Panel = adjacencyCluster.GetRelatedObjects(panel_Result); - if(spaces_Panel == null) + if (spaces_Panel == null) { continue; } - foreach(Space space_Panel in spaces_Panel) + foreach (Space space_Panel in spaces_Panel) { - if(result.Find(x => x.Guid == space_Panel.Guid) != null) + if (result.Find(x => x.Guid == space_Panel.Guid) != null) { continue; } @@ -414,25 +417,25 @@ public static List SplitSpace_2(this AdjacencyCluster adjacencyCluster, G List face3Ds_Shell = shell.Face3Ds; - Func adjustPolygon2D = new Func((Face2D face2D, Polygon2D polygon2D, double offset) => + Func adjustPolygon2D = new Func((Face2D face2D, Polygon2D polygon2D, double offset) => { List segmentable2Ds = face2D.Edge2Ds?.ConvertAll(x => x as ISegmentable2D)?.FindAll(x => x != null); - if(segmentable2Ds == null || segmentable2Ds.Count == 0) + if (segmentable2Ds == null || segmentable2Ds.Count == 0) { return null; } List point2Ds = polygon2D.Points; - if(point2Ds == null || point2Ds.Count == 0) + if (point2Ds == null || point2Ds.Count == 0) { return null; } - for(int i =0; i < point2Ds.Count; i++) + for (int i = 0; i < point2Ds.Count; i++) { Point2D point2D = point2Ds[i]; - if(segmentable2Ds.On(point2D, tolerance_Distance)) + if (segmentable2Ds.On(point2D, tolerance_Distance)) { continue; } @@ -479,7 +482,7 @@ public static List SplitSpace_2(this AdjacencyCluster adjacencyCluster, G point2Ds[i] = point2D_Intersection; } - + return new Polygon2D(point2Ds); }); @@ -509,8 +512,8 @@ public static List SplitSpace_2(this AdjacencyCluster adjacencyCluster, G List vector2Ds = polygon2D.InternalVector2Ds(); List segment2Ds = polygon2D.GetSegments(); - List>>> tuples = new List>>>(); - for(int i =0; i < segment2Ds.Count; i++) + List>>> tuples = new List>>>(); + for (int i = 0; i < segment2Ds.Count; i++) { Segment2D segment2D = segment2Ds[i]; Vector2D vector2D = vector2Ds[i]; @@ -536,7 +539,7 @@ public static List SplitSpace_2(this AdjacencyCluster adjacencyCluster, G Polygon2D polygon2D_Panel = new Polygon2D(new Point2D[] { segment2D[0], segment2D[1], segment2D[1].GetMoved(vector2D * offset_Panel), segment2D[0].GetMoved(vector2D * offset_Panel) }); Tuple>> tuple = tuples.Find(x => x.Item1.AlmostEqual(vector2D, tolerance_Angle)); - if(tuple == null) + if (tuple == null) { tuple = new Tuple>>(vector2D, new List>()); tuples.Add(tuple); @@ -545,7 +548,7 @@ public static List SplitSpace_2(this AdjacencyCluster adjacencyCluster, G tuple.Item2.Add(new Tuple(segment2D, polygon2D_Panel)); } - if(tuples == null || tuples.Count == 0) + if (tuples == null || tuples.Count == 0) { continue; } @@ -590,17 +593,17 @@ public static List SplitSpace_2(this AdjacencyCluster adjacencyCluster, G foreach (Polygon2D polygon2D_Temp in polygon2Ds_Temp) { List polygon2Ds_Difference = polygon2D.Difference(polygon2D_Temp); - if(polygon2Ds_Difference == null || polygon2Ds_Difference.Count == 0) + if (polygon2Ds_Difference == null || polygon2Ds_Difference.Count == 0) { polygon2Ds.Add(polygon2D_Temp); continue; } - List polygon2Ds_Union = new List() { polygon2D_Temp}; - foreach(Polygon2D polygon2D_Difference in polygon2Ds_Difference) + List polygon2Ds_Union = new List() { polygon2D_Temp }; + foreach (Polygon2D polygon2D_Difference in polygon2Ds_Difference) { List polygon2Ds_Offset = polygon2D_Difference.Offset(-minSectionOffset, tolerance_Distance); - if(polygon2Ds_Offset != null && polygon2Ds_Offset.Count > 0) + if (polygon2Ds_Offset != null && polygon2Ds_Offset.Count > 0) { continue; } @@ -631,7 +634,7 @@ public static List SplitSpace_2(this AdjacencyCluster adjacencyCluster, G //START List polygon2Ds_Min = new List(); - for(int i = polygon2Ds.Count - 1; i >=0; i--) + for (int i = polygon2Ds.Count - 1; i >= 0; i--) { Polygon2D polygon2D_Temp = polygon2Ds[i]; if (polygon2D_Temp == null || !polygon2D.Inside(polygon2D_Temp.InternalPoint2D(tolerance_Distance))) @@ -657,13 +660,13 @@ public static List SplitSpace_2(this AdjacencyCluster adjacencyCluster, G polygon2Ds.Sort((x, y) => y.GetArea().CompareTo(x.GetArea())); - foreach(Polygon2D polygon2D_Min in polygon2Ds_Min) + foreach (Polygon2D polygon2D_Min in polygon2Ds_Min) { bool merged = false; - for(int i=0; i < polygon2Ds.Count; i++) + for (int i = 0; i < polygon2Ds.Count; i++) { List polygon2Ds_Union = polygon2D_Min.Union(polygon2Ds[i], tolerance_Distance); - if(polygon2Ds_Union != null && polygon2Ds_Union.Count == 1) + if (polygon2Ds_Union != null && polygon2Ds_Union.Count == 1) { merged = true; polygon2Ds[i] = polygon2Ds_Union[0]; @@ -671,7 +674,7 @@ public static List SplitSpace_2(this AdjacencyCluster adjacencyCluster, G } } - if(!merged) + if (!merged) { polygon2Ds.Add(polygon2D_Min); } @@ -720,7 +723,7 @@ public static List SplitSpace_2(this AdjacencyCluster adjacencyCluster, G } Point2D point2D_1 = segment2D[0]; - if(Core.Query.Round(polygon2D.Distance(point2D_1), tolerance_Snap) <= tolerance_Snap) + if (Core.Query.Round(polygon2D.Distance(point2D_1), tolerance_Snap) <= tolerance_Snap) { point2D_1 = Geometry.Planar.Query.Snap(polygon2D, point2D_1); } @@ -780,4 +783,4 @@ public static List SplitSpace_2(this AdjacencyCluster adjacencyCluster, G return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/TriangulateConcavePanels.cs b/SAM/SAM.Analytical/Modify/TriangulateConcavePanels.cs index 069f4a048..317cde90e 100644 --- a/SAM/SAM.Analytical/Modify/TriangulateConcavePanels.cs +++ b/SAM/SAM.Analytical/Modify/TriangulateConcavePanels.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Analytical @@ -10,7 +13,7 @@ public static List TriangulateConcavePanels(this AdjacencyCluster adjacen triangulatedPanels = null; List panels = adjacencyCluster?.GetPanels(); - if(panels == null) + if (panels == null) { return null; } @@ -19,7 +22,7 @@ public static List TriangulateConcavePanels(this AdjacencyCluster adjacen List result = new List(); foreach (Panel panel in panels) { - if(!Geometry.Object.Spatial.Query.Concave(panel)) + if (!Geometry.Object.Spatial.Query.Concave(panel)) { continue; } @@ -60,4 +63,4 @@ public static List TriangulateConcavePanels(this AdjacencyCluster adjacen return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/Trim.cs b/SAM/SAM.Analytical/Modify/Trim.cs index 8ade87e51..ebdb388a7 100644 --- a/SAM/SAM.Analytical/Modify/Trim.cs +++ b/SAM/SAM.Analytical/Modify/Trim.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; namespace SAM.Analytical @@ -39,22 +42,22 @@ public static void Trim(this List panels, double elevation, double minLen int index = panels.IndexOf(keyValuePair.Key); bool updated = false; - foreach(Geometry.Planar.ISegmentable2D segmentable2D in keyValuePair.Value) + foreach (Geometry.Planar.ISegmentable2D segmentable2D in keyValuePair.Value) { - foreach(Geometry.Planar.Segment2D segment2D in segmentable2D.GetSegments()) + foreach (Geometry.Planar.Segment2D segment2D in segmentable2D.GetSegments()) { List segment2Ds_Temp = segment2Ds.FindAll(x => segment2D.On(x.Mid(), snapTolerance)); - if(segment2Ds_Temp.Count == 0) + if (segment2Ds_Temp.Count == 0) { panels_Trimmed.Add(panels[index]); panels.RemoveAt(index); updated = true; break; } - else if(segment2Ds_Temp.Count != 0) + else if (segment2Ds_Temp.Count != 0) { Geometry.Planar.Query.ExtremePoints(Geometry.Planar.Query.UniquePoint2Ds(segment2Ds_Temp, tolerance), out Geometry.Planar.Point2D point2D_1, out Geometry.Planar.Point2D point2D_2); - if(point2D_1 != null && point2D_2 != null) + if (point2D_1 != null && point2D_2 != null) { double distance = point2D_1.Distance(point2D_2); if (distance < tolerance || System.Math.Abs(segment2D.GetLength() - distance) < tolerance) @@ -81,7 +84,7 @@ public static void Trim(this List panels, double elevation, double minLen } } - if(updated) + if (updated) { break; } @@ -89,4 +92,4 @@ public static void Trim(this List panels, double elevation, double minLen } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/UpdateApertureConstructionsByApertureType.cs b/SAM/SAM.Analytical/Modify/UpdateApertureConstructionsByApertureType.cs index e7f6c1999..784e5cf98 100644 --- a/SAM/SAM.Analytical/Modify/UpdateApertureConstructionsByApertureType.cs +++ b/SAM/SAM.Analytical/Modify/UpdateApertureConstructionsByApertureType.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Analytical @@ -20,10 +23,10 @@ public static ApertureConstructionLibrary UpdateApertureConstructionsByApertureT continue; bool updated = false; - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { ApertureConstruction apertureConstruction = aperture?.ApertureConstruction; - if(apertureConstruction == null) + if (apertureConstruction == null) { continue; } @@ -43,7 +46,7 @@ public static ApertureConstructionLibrary UpdateApertureConstructionsByApertureT if (apertureConstruction_New == null) continue; - if(!updated) + if (!updated) { updated = true; panel = new Panel(panel); @@ -60,4 +63,4 @@ public static ApertureConstructionLibrary UpdateApertureConstructionsByApertureT return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/UpdateApertureConstructionsByName.cs b/SAM/SAM.Analytical/Modify/UpdateApertureConstructionsByName.cs index 25d690384..78f4bcfad 100644 --- a/SAM/SAM.Analytical/Modify/UpdateApertureConstructionsByName.cs +++ b/SAM/SAM.Analytical/Modify/UpdateApertureConstructionsByName.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -21,7 +24,7 @@ public static ApertureConstructionLibrary UpdateApertureConstructionsByName(this continue; bool updated = false; - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { string name = aperture?.ApertureConstruction?.Name; if (string.IsNullOrWhiteSpace(name)) @@ -40,7 +43,7 @@ public static ApertureConstructionLibrary UpdateApertureConstructionsByName(this if (apertureConstruction == null) continue; - if(!updated) + if (!updated) { updated = true; panel = new Panel(panel); @@ -84,7 +87,7 @@ public static ApertureConstructionLibrary UpdateApertureConstructionsByName(this if (apertureConstruction == null) continue; - apertures[i] = new Aperture(aperture, apertureConstruction); + apertures[i] = new Aperture(aperture, apertureConstruction); } return result; @@ -324,4 +327,4 @@ public static ApertureConstructionLibrary UpdateApertureConstructionsByName( return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/UpdateApertures.cs b/SAM/SAM.Analytical/Modify/UpdateApertures.cs index a11d0f1bd..a6397d867 100644 --- a/SAM/SAM.Analytical/Modify/UpdateApertures.cs +++ b/SAM/SAM.Analytical/Modify/UpdateApertures.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -20,12 +23,12 @@ public static List UpdateApertures(this AdjacencyCluster adjacencyClus if (panels == null) return result; - foreach(Panel panel in panels) + foreach (Panel panel in panels) { if (!panel.HasApertures) continue; - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { if (aperture == null) continue; @@ -33,7 +36,7 @@ public static List UpdateApertures(this AdjacencyCluster adjacencyClus Guid guid = aperture.Guid; if (panel.RemoveAperture(guid)) - if(panel.AddAperture(aperture)) + if (panel.AddAperture(aperture)) if (adjacencyCluster.AddObject(panel)) result.Add(aperture); } @@ -42,4 +45,4 @@ public static List UpdateApertures(this AdjacencyCluster adjacencyClus return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/UpdateAreaAndVolume.cs b/SAM/SAM.Analytical/Modify/UpdateAreaAndVolume.cs index 21d9e896a..561d2d130 100644 --- a/SAM/SAM.Analytical/Modify/UpdateAreaAndVolume.cs +++ b/SAM/SAM.Analytical/Modify/UpdateAreaAndVolume.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -12,7 +15,7 @@ public static Space UpdateAreaAndVolume(this AdjacencyCluster adjacencyCluster, } Space result = adjacencyCluster.GetObject(space.Guid); - if(result == null) + if (result == null) { return null; } @@ -20,12 +23,12 @@ public static Space UpdateAreaAndVolume(this AdjacencyCluster adjacencyCluster, bool update; update = true; - if(!forceUpdate && result.TryGetValue(SpaceParameter.Volume, out double volume) && volume > 0) + if (!forceUpdate && result.TryGetValue(SpaceParameter.Volume, out double volume) && volume > 0) { update = false; } - if(update) + if (update) { result.RemoveValue(SpaceParameter.Volume); result.SetValue(SpaceParameter.Volume, result.Volume(adjacencyCluster)); @@ -49,15 +52,15 @@ public static Space UpdateAreaAndVolume(this AdjacencyCluster adjacencyCluster, public static void UpdateAreaAndVolume(this AdjacencyCluster adjacencyCluster, bool forceUpdate = true) { List spaces = adjacencyCluster?.GetSpaces(); - if(spaces == null || spaces.Count == 0) + if (spaces == null || spaces.Count == 0) { return; } - foreach(Space space in spaces) + foreach (Space space in spaces) { Space space_New = UpdateAreaAndVolume(adjacencyCluster, space, forceUpdate); - if(space_New == null) + if (space_New == null) { continue; } @@ -66,4 +69,4 @@ public static void UpdateAreaAndVolume(this AdjacencyCluster adjacencyCluster, b } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/UpdateConstruction.cs b/SAM/SAM.Analytical/Modify/UpdateConstruction.cs index de3c06eeb..69a589e8a 100644 --- a/SAM/SAM.Analytical/Modify/UpdateConstruction.cs +++ b/SAM/SAM.Analytical/Modify/UpdateConstruction.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -9,11 +12,11 @@ public static bool UpdateConstruction(this AdjacencyCluster adjacencyCluster, Co if (adjacencyCluster == null || constructionLibrary == null || string.IsNullOrWhiteSpace(constructionName_Source) || string.IsNullOrWhiteSpace(constructionName_Destination) || string.IsNullOrWhiteSpace(constructionName_Template)) return false; - List constructions_Source = adjacencyCluster.GetConstructions()?.FindAll(x => !string.IsNullOrWhiteSpace(x.Name) &&x.Name.Equals(constructionName_Source)); + List constructions_Source = adjacencyCluster.GetConstructions()?.FindAll(x => !string.IsNullOrWhiteSpace(x.Name) && x.Name.Equals(constructionName_Source)); if (constructions_Source == null || constructions_Source.Count == 0) return false; - foreach(Construction construction_Source in constructions_Source) + foreach (Construction construction_Source in constructions_Source) { Construction construction_Destination = Create.Construction(constructionLibrary, constructionName_Template, constructionName_Destination); if (construction_Destination == null) @@ -23,7 +26,7 @@ public static bool UpdateConstruction(this AdjacencyCluster adjacencyCluster, Co if (panels == null || panels.Count == 0) continue; - foreach(Panel panel in panels) + foreach (Panel panel in panels) { Panel panel_Destination = new Panel(panel, construction_Destination); @@ -34,4 +37,4 @@ public static bool UpdateConstruction(this AdjacencyCluster adjacencyCluster, Co return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/UpdateConstructionsByName.cs b/SAM/SAM.Analytical/Modify/UpdateConstructionsByName.cs index 24fb7748c..d112d56d1 100644 --- a/SAM/SAM.Analytical/Modify/UpdateConstructionsByName.cs +++ b/SAM/SAM.Analytical/Modify/UpdateConstructionsByName.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -19,32 +22,32 @@ public static ConstructionLibrary UpdateConstructionsByName(this List pan continue; List constructions = result.GetConstructions(name); - if(constructions == null || constructions.Count == 0) + if (constructions == null || constructions.Count == 0) { constructions = constructionLibrary.GetConstructions(name); } - if(constructions == null || constructions.Count == 0) + if (constructions == null || constructions.Count == 0) { continue; } Construction construction = null; - foreach(Construction construction_Temp in constructions) + foreach (Construction construction_Temp in constructions) { - if(construction_Temp.PanelType() == panels[i].PanelType) + if (construction_Temp.PanelType() == panels[i].PanelType) { construction = construction_Temp; break; } } - if(construction == null) + if (construction == null) { construction = constructions[0]; } - if(construction == null) + if (construction == null) { continue; } @@ -191,4 +194,4 @@ public static ConstructionLibrary UpdateConstructionsByName( return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/UpdateConstructionsByPanelType.cs b/SAM/SAM.Analytical/Modify/UpdateConstructionsByPanelType.cs index e25ebb412..99ec3d64a 100644 --- a/SAM/SAM.Analytical/Modify/UpdateConstructionsByPanelType.cs +++ b/SAM/SAM.Analytical/Modify/UpdateConstructionsByPanelType.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Analytical @@ -14,7 +17,7 @@ public static ConstructionLibrary UpdateConstructionsByPanelType(this List spaces_Temp = adjacencyCluster.GetSpaces(); - if(spaces_Temp == null || spaces_Temp.Count == 0) + if (spaces_Temp == null || spaces_Temp.Count == 0) { return; } - if(spaces != null) + if (spaces != null) { List spaces_Temp_Temp = new List(spaces); spaces_Temp.RemoveAll(x => spaces_Temp_Temp.Find(y => x.Guid == y.Guid) == null); } - foreach(Space space in spaces_Temp) + foreach (Space space in spaces_Temp) { double daylightFactor = adjacencyCluster.DaylightFactor(space); - if(double.IsNaN(daylightFactor) || daylightFactor == 0) + if (double.IsNaN(daylightFactor) || daylightFactor == 0) { space.RemoveValue(SpaceParameter.DaylightFactor); } @@ -40,4 +43,4 @@ public static void UpdateDaylightFactors(this AdjacencyCluster adjacencyCluster, } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/UpdatePanelTypes.cs b/SAM/SAM.Analytical/Modify/UpdatePanelTypes.cs index 98a697c3b..43bc377b7 100644 --- a/SAM/SAM.Analytical/Modify/UpdatePanelTypes.cs +++ b/SAM/SAM.Analytical/Modify/UpdatePanelTypes.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System; using System.Collections.Generic; using System.Linq; @@ -26,12 +29,12 @@ public static IEnumerable UpdatePanelTypes(this AdjacencyCluster adjacenc List spaces = adjacencyCluster.GetRelatedObjects(panel); PanelType panelType = panel.PanelType; - if(spaces == null || spaces.Count == 0) + if (spaces == null || spaces.Count == 0) { if (panelType != PanelType.SolarPanel) panelType = PanelType.Shade; } - else if(spaces.Count == 1) + else if (spaces.Count == 1) { double elevation = double.NaN; @@ -56,10 +59,10 @@ public static IEnumerable UpdatePanelTypes(this AdjacencyCluster adjacenc break; } break; - + case PanelType.Wall: case PanelType.WallInternal: - + elevation = Geometry.Object.Spatial.Query.MaxElevation(panel); if (elevation - elevation_Ground < Tolerance.MacroDistance) @@ -114,13 +117,13 @@ public static IEnumerable UpdatePanelTypes(this AdjacencyCluster adjacenc case PanelType.Roof: elevation = Geometry.Object.Spatial.Query.MaxElevation(panel); panelType_Normal = Query.PanelType(panel.Normal); - if(panelType_Normal == PanelType.Floor) + if (panelType_Normal == PanelType.Floor) { if (elevation < elevation_Ground) { panelType = PanelType.UndergroundSlab; } - else if(System.Math.Abs(elevation - elevation_Ground) < Tolerance.MacroDistance) + else if (System.Math.Abs(elevation - elevation_Ground) < Tolerance.MacroDistance) { panelType = PanelType.SlabOnGrade; } @@ -140,16 +143,16 @@ public static IEnumerable UpdatePanelTypes(this AdjacencyCluster adjacenc case PanelType.Undefined: panelType = Query.PanelType(panel.Normal); break; - } + } } - else if(spaces.Count > 1) + else if (spaces.Count > 1) { switch (panelType) { case PanelType.Shade: case PanelType.SolarPanel: - //case PanelType.Air: + //case PanelType.Air: panelType = Query.PanelType(panel.Normal); switch (panelType.PanelGroup()) { @@ -180,7 +183,7 @@ public static IEnumerable UpdatePanelTypes(this AdjacencyCluster adjacenc } } - if(panelType != panel.PanelType) + if (panelType != panel.PanelType) { Panel panel_New = new Panel(panel, panelType); adjacencyCluster.AddObject(panel_New); @@ -192,4 +195,4 @@ public static IEnumerable UpdatePanelTypes(this AdjacencyCluster adjacenc return result.Values; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/UpdateSpace.cs b/SAM/SAM.Analytical/Modify/UpdateSpace.cs index c6b54b010..6ed6068ff 100644 --- a/SAM/SAM.Analytical/Modify/UpdateSpace.cs +++ b/SAM/SAM.Analytical/Modify/UpdateSpace.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -17,7 +20,7 @@ public static bool UpdateSpace(this AdjacencyCluster adjacencyCluster, Space spa return false; Dictionary dictionary = new Dictionary(); - foreach(Space space_Temp in spaces) + foreach (Space space_Temp in spaces) { Shell shell = adjacencyCluster.Shell(space_Temp); if (shell == null) @@ -32,7 +35,7 @@ public static bool UpdateSpace(this AdjacencyCluster adjacencyCluster, Space spa Space space_Result = null; - if(dictionary.Count > 1) + if (dictionary.Count > 1) { point3D = point3D.GetMoved(Vector3D.WorldZ * silverSpacing) as Point3D; foreach (KeyValuePair keyValuePair in dictionary) @@ -67,4 +70,4 @@ public static bool UpdateSpace(this AdjacencyCluster adjacencyCluster, Space spa return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/UpdateSpaceNames.cs b/SAM/SAM.Analytical/Modify/UpdateSpaceNames.cs index e9f136856..9d232f5c6 100644 --- a/SAM/SAM.Analytical/Modify/UpdateSpaceNames.cs +++ b/SAM/SAM.Analytical/Modify/UpdateSpaceNames.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Analytical @@ -8,7 +11,7 @@ public static partial class Modify public static Dictionary UpdateSpaceNames(this AdjacencyCluster adjacencyCluster, string format = "{0} {1}") { List spaces = adjacencyCluster?.GetSpaces(); - if(spaces == null || spaces.Count == 0) + if (spaces == null || spaces.Count == 0) { return null; } @@ -20,9 +23,9 @@ public static Dictionary UpdateSpaceNames(this AdjacencyCluster a foreach (Guid guid in guids) { spaces = adjacencyCluster.GetSpaces(); - + int spaceIndex = spaces.FindIndex(x => x.Guid == guid); - if(spaceIndex == -1) + if (spaceIndex == -1) { continue; } @@ -31,13 +34,13 @@ public static Dictionary UpdateSpaceNames(this AdjacencyCluster a spaces.RemoveAt(spaceIndex); string name = space.Name; - if(name == null) + if (name == null) { continue; } List spaces_Name = spaces.FindAll(x => x.Name == name); - if(spaces_Name == null || spaces_Name.Count == 0) + if (spaces_Name == null || spaces_Name.Count == 0) { continue; } @@ -63,4 +66,4 @@ public static Dictionary UpdateSpaceNames(this AdjacencyCluster a } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/UpdateSpacePanelArea.cs b/SAM/SAM.Analytical/Modify/UpdateSpacePanelArea.cs index 0419abea8..4d5c2db0e 100644 --- a/SAM/SAM.Analytical/Modify/UpdateSpacePanelArea.cs +++ b/SAM/SAM.Analytical/Modify/UpdateSpacePanelArea.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Analytical @@ -7,20 +10,20 @@ public static partial class Modify { public static Dictionary UpdateSpacePanelArea(this AdjacencyCluster adjacencyCluster, Space space) { - if(adjacencyCluster == null || space == null) + if (adjacencyCluster == null || space == null) { return null; } Space space_Temp = adjacencyCluster.GetObject(space.Guid); - if(space_Temp == null) + if (space_Temp == null) { return null; } List panels = adjacencyCluster.GetPanels(space_Temp); - if(panels == null || panels.Count == 0) + if (panels == null || panels.Count == 0) { return null; } @@ -55,13 +58,13 @@ public static Dictionary UpdateSpacePanelArea(this AdjacencyClus foreach (Panel panel in panels) { - if(panel == null) + if (panel == null) { continue; } double area = panel.GetAreaNet(); - if(double.IsNaN(area) || area <= 0) + if (double.IsNaN(area) || area <= 0) { continue; } @@ -79,7 +82,7 @@ public static Dictionary UpdateSpacePanelArea(this AdjacencyClus break; case PanelType.CurtainWall: - if(external) + if (external) { result["SAM_CurtainWall_External"] += area; } @@ -147,22 +150,22 @@ public static Dictionary UpdateSpacePanelArea(this AdjacencyClus } List apertures = panel.Apertures; - if(apertures != null) + if (apertures != null) { - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { - if(aperture == null) + if (aperture == null) { continue; } - switch(aperture.ApertureType) + switch (aperture.ApertureType) { case ApertureType.Door: - if(external) + if (external) { area = aperture.GetPaneArea(); - if(!double.IsNaN(area) && area > 0) + if (!double.IsNaN(area) && area > 0) { result["SAM_DoorPane_External"] += area; } @@ -187,7 +190,7 @@ public static Dictionary UpdateSpacePanelArea(this AdjacencyClus result["SAM_DoorFrame_Internal"] += area; } } - + break; case ApertureType.Window: @@ -225,7 +228,7 @@ public static Dictionary UpdateSpacePanelArea(this AdjacencyClus } } - foreach(KeyValuePair keyValuePair in result) + foreach (KeyValuePair keyValuePair in result) { space_Temp.SetValue(keyValuePair.Key, keyValuePair.Value); } @@ -235,4 +238,4 @@ public static Dictionary UpdateSpacePanelArea(this AdjacencyClus return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/UpdateWeather.cs b/SAM/SAM.Analytical/Modify/UpdateWeather.cs index 422e9d6ae..121da628e 100644 --- a/SAM/SAM.Analytical/Modify/UpdateWeather.cs +++ b/SAM/SAM.Analytical/Modify/UpdateWeather.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Weather; using System.Collections.Generic; @@ -8,7 +11,7 @@ public static partial class Modify { public static void UpdateWeather(this AnalyticalModel analyticalModel, WeatherData weatherData = null, IEnumerable coolingDesignDays = null, IEnumerable heatingDesignDays = null) { - if(analyticalModel == null) + if (analyticalModel == null) { return; } @@ -41,4 +44,4 @@ public static void UpdateWeather(this AnalyticalModel analyticalModel, WeatherDa } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Modify/UpdateZone.cs b/SAM/SAM.Analytical/Modify/UpdateZone.cs index 767682dd8..c845cc141 100644 --- a/SAM/SAM.Analytical/Modify/UpdateZone.cs +++ b/SAM/SAM.Analytical/Modify/UpdateZone.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -48,4 +51,4 @@ public static Zone UpdateZone(this AdjacencyCluster adjacencyCluster, string nam return Core.Query.Clone(result); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Adiabatic.cs b/SAM/SAM.Analytical/Query/Adiabatic.cs index f7514cd07..debe18035 100644 --- a/SAM/SAM.Analytical/Query/Adiabatic.cs +++ b/SAM/SAM.Analytical/Query/Adiabatic.cs @@ -1,15 +1,18 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { public static bool Adiabatic(this Panel panel) { - if(panel == null) + if (panel == null) { return false; } - if(panel.PanelType == Analytical.PanelType.Air || panel.PanelType == Analytical.PanelType.Shade) + if (panel.PanelType == Analytical.PanelType.Air || panel.PanelType == Analytical.PanelType.Shade) { return false; } @@ -39,4 +42,4 @@ public static bool Adiabatic(this Construction construction) return thickness == 0 || double.IsNaN(thickness); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/AdjacentSpaces.cs b/SAM/SAM.Analytical/Query/AdjacentSpaces.cs index 61893cb05..ed5023a81 100644 --- a/SAM/SAM.Analytical/Query/AdjacentSpaces.cs +++ b/SAM/SAM.Analytical/Query/AdjacentSpaces.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -6,34 +9,34 @@ public static partial class Query { public static List AdjacentSpaces(this AdjacencyCluster adjacencyCluster, Space space) { - if(adjacencyCluster == null || space == null) + if (adjacencyCluster == null || space == null) { return null; } List panels = adjacencyCluster.GetPanels(space); - if(panels == null) + if (panels == null) { return null; } List result = new List(); - foreach(Panel panel in panels) + foreach (Panel panel in panels) { List spaces = adjacencyCluster.GetSpaces(panel); - if(spaces == null) + if (spaces == null) { continue; } - foreach(Space space_Temp in spaces) + foreach (Space space_Temp in spaces) { - if(space_Temp == null || space_Temp.Guid == space.Guid) + if (space_Temp == null || space_Temp.Guid == space.Guid) { continue; } - if(result.Find(x => x.Guid == space_Temp.Guid) != null) + if (result.Find(x => x.Guid == space_Temp.Guid) != null) { continue; } @@ -45,4 +48,4 @@ public static List AdjacentSpaces(this AdjacencyCluster adjacencyCluster, return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/AdjustPanels.cs b/SAM/SAM.Analytical/Query/AdjustPanels.cs index 6c3a0436b..d535cbe6d 100644 --- a/SAM/SAM.Analytical/Query/AdjustPanels.cs +++ b/SAM/SAM.Analytical/Query/AdjustPanels.cs @@ -1,7 +1,10 @@ -using System; -using System.Collections.Generic; -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Geometry.Planar; +using SAM.Geometry.Spatial; +using System; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -23,17 +26,17 @@ public static List AdjustPanels(this Face3D face3D, IEnumerable pa } Face2D face2D = plane.Convert(face3D); - if(face2D == null) + if (face2D == null) { return null; } List> tuples = new List>(); List point2Ds = new List(); - foreach(Panel panel in panels) + foreach (Panel panel in panels) { Face2D face2D_Panel = plane.Convert(panel?.GetFace3D()); - if(face2D_Panel == null || !face2D_Panel.IsValid() || face2D_Panel.GetArea() < tolerance) + if (face2D_Panel == null || !face2D_Panel.IsValid() || face2D_Panel.GetArea() < tolerance) { continue; } @@ -56,63 +59,63 @@ public static List AdjustPanels(this Face3D face3D, IEnumerable pa tuples.Add(new Tuple(panel, boundingBox2D, face2D_Panel)); } - if(tuples == null || tuples.Count == 0) + if (tuples == null || tuples.Count == 0) { return null; } List triangle2Ds = face2D.Triangulate(point2Ds, tolerance); - if(triangle2Ds == null|| triangle2Ds.Count == 0) + if (triangle2Ds == null || triangle2Ds.Count == 0) { return null; } List panels_Temp = new List(); - foreach(Triangle2D triangle2D in triangle2Ds) + foreach (Triangle2D triangle2D in triangle2Ds) { BoundingBox2D boundingBox2D = triangle2D?.GetBoundingBox(); - if(boundingBox2D == null) + if (boundingBox2D == null) { continue; } Point2D point2D = triangle2D.GetCentroid(); - if(point2D == null) + if (point2D == null) { continue; } List> tuples_Temp = tuples.FindAll(x => x.Item2.InRange(boundingBox2D, tolerance)); - if(tuples_Temp == null || tuples_Temp.Count == 0) + if (tuples_Temp == null || tuples_Temp.Count == 0) { tuples_Temp = new List>(tuples); tuples_Temp.Sort((x, y) => x.Item3.Distance(point2D, tolerance).CompareTo(y.Item3.Distance(point2D, tolerance))); tuples_Temp = new List>() { tuples_Temp[0] }; } - - if(tuples_Temp != null && tuples_Temp.Count > 1) + + if (tuples_Temp != null && tuples_Temp.Count > 1) { List> tuples_Temp_Temp = tuples_Temp.FindAll(x => x.Item3.InRange(point2D, tolerance)); - if(tuples_Temp_Temp == null || tuples_Temp_Temp.Count == 0) + if (tuples_Temp_Temp == null || tuples_Temp_Temp.Count == 0) { tuples_Temp_Temp = tuples_Temp; } - if(tuples_Temp_Temp.Count > 1) + if (tuples_Temp_Temp.Count > 1) { Face2D face2D_Triangle2D = new Face2D(triangle2D); List, double>> tuples_Area = new List, double>>(); - foreach(Tuple tuple in tuples_Temp_Temp) + foreach (Tuple tuple in tuples_Temp_Temp) { List face2Ds_Intersection = face2D_Triangle2D.Intersection(tuple.Item3, tolerance); - if(face2Ds_Intersection == null || face2Ds_Intersection.Count == 0) + if (face2Ds_Intersection == null || face2Ds_Intersection.Count == 0) { continue; } double area = face2Ds_Intersection.ConvertAll(x => x.GetArea()).Sum(); - if(area < tolerance) + if (area < tolerance) { continue; } @@ -127,7 +130,7 @@ public static List AdjustPanels(this Face3D face3D, IEnumerable pa } - if(tuples_Temp == null || tuples_Temp.Count == 0) + if (tuples_Temp == null || tuples_Temp.Count == 0) { continue; } @@ -137,13 +140,13 @@ public static List AdjustPanels(this Face3D face3D, IEnumerable pa Plane plane_Panel = panel.Plane; Triangle3D triangle3D = plane_Panel.Project(plane.Convert(triangle2D)); - if(triangle3D == null) + if (triangle3D == null) { continue; } panel = Create.Panel(Guid.NewGuid(), panel, new Face3D(triangle3D), null, true, tolerance, maxDistance); - if(panel == null) + if (panel == null) { continue; } @@ -227,4 +230,4 @@ public static List AdjustPanels(this Face3D face3D, IEnumerable pa return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/AdjustRoofs.cs b/SAM/SAM.Analytical/Query/AdjustRoofs.cs index 8b21ae5cc..e638b98d5 100644 --- a/SAM/SAM.Analytical/Query/AdjustRoofs.cs +++ b/SAM/SAM.Analytical/Query/AdjustRoofs.cs @@ -1,7 +1,10 @@ -using System; -using System.Collections.Generic; -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Geometry.Planar; +using SAM.Geometry.Spatial; +using System; +using System.Collections.Generic; using System.Linq; namespace SAM.Analytical @@ -17,7 +20,7 @@ public static List AdjustRoofs(this IEnumerable roofs, IEnumerable //Extracting Roof Panels data (Face2D is 2D Face representation on horizontal plane) List> tuples_Roof = new List>(); - foreach(Panel roof in roofs) + foreach (Panel roof in roofs) { Face3D face3D = roof.GetFace3D(); if (face3D == null) @@ -46,19 +49,19 @@ public static List AdjustRoofs(this IEnumerable roofs, IEnumerable //Extracting Shell data (Face2D is Section of Shell on offset) List> tuples_Shell = new List>(); - foreach(Shell shell in shells) + foreach (Shell shell in shells) { BoundingBox3D boundingBox3D = shell?.GetBoundingBox(); if (boundingBox3D == null) continue; Plane plane_Temp = plane.GetMoved(new Vector3D(0, 0, boundingBox3D.Min.Z + offset)) as Plane; - + List face3Ds = shell?.Section(plane_Temp, true, tolerance_Angle, tolerance_Distance, tolerance_Snap); if (face3Ds == null) continue; - - foreach(Face3D face3D in face3Ds) + + foreach (Face3D face3D in face3Ds) { Face2D face2D = plane.Convert(face3D); if (face2D == null) @@ -93,9 +96,9 @@ public static List AdjustRoofs(this IEnumerable roofs, IEnumerable } //Adding missing parts of roofs to Roof face2Ds - if(face2Ds_Difference_Shell != null && face2Ds_Difference_Shell.Count > 0) + if (face2Ds_Difference_Shell != null && face2Ds_Difference_Shell.Count > 0) { - for(int i=0; i < tuples_Roof.Count; i++) + for (int i = 0; i < tuples_Roof.Count; i++) { Face2D face2D = Geometry.Planar.Query.Join(tuples_Roof[i].Item1, face2Ds_Difference_Shell, tolerance_Distance); if (face2D == null) @@ -107,7 +110,7 @@ public static List AdjustRoofs(this IEnumerable roofs, IEnumerable //Creating new 3D geometry of Roofs (Face3Ds) including missing parts of roofs List> tuples_Face3D = new List>(); - foreach(Tuple tuple_Roof in tuples_Roof) + foreach (Tuple tuple_Roof in tuples_Roof) { Plane plane_Roof = tuple_Roof.Item2.Plane; @@ -115,7 +118,7 @@ public static List AdjustRoofs(this IEnumerable roofs, IEnumerable //Offseting Face2D to make sure it intersect with other roof panels List face2Ds_Offset = face2D.Offset(1, true, false, tolerance_Distance); - foreach(Face2D face2D_Offset in face2Ds_Offset) + foreach (Face2D face2D_Offset in face2Ds_Offset) { //Adding missing parts of Face2D resulting from shells section (union of shells) and roof face difference List face2Ds_Intersection = new List(); @@ -161,9 +164,9 @@ public static List AdjustRoofs(this IEnumerable roofs, IEnumerable //Converting Segment3Ds (Roofs Face3Ds intersections) to Segment2Ds List segment2Ds = segment3Ds.ConvertAll(x => plane.Convert(plane.Project(x))); - + List face3Ds = new List(); - + //Adding Roof Panel geometry to Segment2Ds and creating list of Face3Ds foreach (Tuple tuple in tuples_Face3D) { @@ -259,7 +262,7 @@ public static List AdjustRoofs(this IEnumerable roofs, IEnumerable //Generate Panels from new Face3Ds List result = new List(); - foreach(Tuple tuple in tuples_Face3D) + foreach (Tuple tuple in tuples_Face3D) { Guid guid = tuple.Item2.Guid; if (result.Find(x => x.Guid == guid) != null) @@ -275,4 +278,4 @@ public static List AdjustRoofs(this IEnumerable roofs, IEnumerable return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/AirFlow.cs b/SAM/SAM.Analytical/Query/AirFlow.cs index 2586b09c4..15a9bd5c4 100644 --- a/SAM/SAM.Analytical/Query/AirFlow.cs +++ b/SAM/SAM.Analytical/Query/AirFlow.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -41,7 +44,7 @@ public static double AirFlow(this AdjacencyCluster adjacencyCluster, AirHandling Profile profile_SpaceAirMovement = spaceAirMovement.Profile; profile_SpaceAirMovement.Multiply(spaceAirMovement.AirFlow); - if(profile == null) + if (profile == null) { profile = profile_SpaceAirMovement; } @@ -51,7 +54,7 @@ public static double AirFlow(this AdjacencyCluster adjacencyCluster, AirHandling } } - if(profile == null) + if (profile == null) { return double.NaN; } @@ -63,4 +66,4 @@ public static double AirFlow(this AdjacencyCluster adjacencyCluster, AirHandling } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/AirSupplyMethod.cs b/SAM/SAM.Analytical/Query/AirSupplyMethod.cs index 6cd20b1fb..ad1488f16 100644 --- a/SAM/SAM.Analytical/Query/AirSupplyMethod.cs +++ b/SAM/SAM.Analytical/Query/AirSupplyMethod.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Analytical @@ -36,4 +39,4 @@ private static AirSupplyMethod AirSupplyMethod(this IEnumerable(airSupplyMethodString); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/AirspaceConvectiveHeatTransferCoefficient.cs b/SAM/SAM.Analytical/Query/AirspaceConvectiveHeatTransferCoefficient.cs index 54e8fa961..cd4ee9571 100644 --- a/SAM/SAM.Analytical/Query/AirspaceConvectiveHeatTransferCoefficient.cs +++ b/SAM/SAM.Analytical/Query/AirspaceConvectiveHeatTransferCoefficient.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -12,7 +15,7 @@ public static double AirspaceConvectiveHeatTransferCoefficient(double angle, dou { if (double.IsNaN(thickness)) return double.NaN; - + double result = 0.025 / thickness; if (angle == 0) @@ -35,4 +38,4 @@ public static double AirspaceConvectiveHeatTransferCoefficient(double angle, dou } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/AirspaceIntersurfaceEmittance.cs b/SAM/SAM.Analytical/Query/AirspaceIntersurfaceEmittance.cs index 1aa5e6634..c537ce3a0 100644 --- a/SAM/SAM.Analytical/Query/AirspaceIntersurfaceEmittance.cs +++ b/SAM/SAM.Analytical/Query/AirspaceIntersurfaceEmittance.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -13,4 +16,4 @@ public static double AirspaceIntersurfaceEmittance(double surfaceEmissivity_1 = return 1 / ((1 / surfaceEmissivity_1) + (1 / surfaceEmissivity_2) - 1); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/AirspaceRadiativeCoefficient.cs b/SAM/SAM.Analytical/Query/AirspaceRadiativeCoefficient.cs index 547f71b22..f5106e91d 100644 --- a/SAM/SAM.Analytical/Query/AirspaceRadiativeCoefficient.cs +++ b/SAM/SAM.Analytical/Query/AirspaceRadiativeCoefficient.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -14,4 +17,4 @@ public static double AirspaceRadiativeCoefficient(double meanTemperature = 283.1 return AirspaceIntersurfaceEmittance(surfaceEmissivity_1, surfaceEmissivity_2) * BlackBodySurfaceRadiativeCoefficient(meanTemperature); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/AirspaceThermalResistance.cs b/SAM/SAM.Analytical/Query/AirspaceThermalResistance.cs index a6e3df33a..4b6f42a76 100644 --- a/SAM/SAM.Analytical/Query/AirspaceThermalResistance.cs +++ b/SAM/SAM.Analytical/Query/AirspaceThermalResistance.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -16,4 +19,4 @@ public static double AirspaceThermalResistance(double angle, double thickness, d return 1 / (AirspaceConvectiveHeatTransferCoefficient(angle, thickness) + AirspaceRadiativeCoefficient(meanTemperature, surfaceEmissivity_1, surfaceEmissivity_2)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/ApertureConstructions.cs b/SAM/SAM.Analytical/Query/ApertureConstructions.cs index 8f8a30b55..0783d8e89 100644 --- a/SAM/SAM.Analytical/Query/ApertureConstructions.cs +++ b/SAM/SAM.Analytical/Query/ApertureConstructions.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System; using System.Collections.Generic; using System.Linq; @@ -29,7 +32,7 @@ public static List ApertureConstructions(this IEnumerable< return null; Dictionary dictionary = new Dictionary(); - foreach(Panel panel in panels) + foreach (Panel panel in panels) { if (panel == null) continue; @@ -41,7 +44,7 @@ public static List ApertureConstructions(this IEnumerable< if (apertures == null || apertures.Count == 0) continue; - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { if (aperture == null) continue; @@ -59,4 +62,4 @@ public static List ApertureConstructions(this IEnumerable< return dictionary.Values.ToList(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/ApertureHost.cs b/SAM/SAM.Analytical/Query/ApertureHost.cs index a7189b60f..0fc838d9a 100644 --- a/SAM/SAM.Analytical/Query/ApertureHost.cs +++ b/SAM/SAM.Analytical/Query/ApertureHost.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using SAM.Geometry.Spatial; namespace SAM.Analytical @@ -32,7 +35,7 @@ public static bool ApertureHost(this Panel panel, IClosedPlanar3D closedPlanar3D if (plane.Normal.Perpendicular(plane_closedPlanar3D.Normal, tolerance)) { return false; - } + } Point3D point3D_ClosedPlanar3D = plane_closedPlanar3D.Origin; Point3D point3D_ClosedPlanar3D_Projected = plane.Project(plane_closedPlanar3D.Origin); @@ -75,4 +78,4 @@ public static bool ApertureHost(this Panel panel, IClosedPlanar3D closedPlanar3D return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/ApertureHosts.cs b/SAM/SAM.Analytical/Query/ApertureHosts.cs index 07c1451bd..70730995b 100644 --- a/SAM/SAM.Analytical/Query/ApertureHosts.cs +++ b/SAM/SAM.Analytical/Query/ApertureHosts.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; namespace SAM.Analytical @@ -19,7 +22,7 @@ public static List ApertureHosts(this IEnumerable panels, IClosedP return null; List result = new List(); - foreach(Panel panel in panels) + foreach (Panel panel in panels) { if (panel.ApertureHost(closedPlanar3D, minArea, maxDistance, tolerance)) result.Add(panel); @@ -28,4 +31,4 @@ public static List ApertureHosts(this IEnumerable panels, IClosedP return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/ApertureType.cs b/SAM/SAM.Analytical/Query/ApertureType.cs index b04a8cc71..2fbfba3ce 100644 --- a/SAM/SAM.Analytical/Query/ApertureType.cs +++ b/SAM/SAM.Analytical/Query/ApertureType.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -54,4 +57,4 @@ public static ApertureType ApertureType(this object @object) return Analytical.ApertureType.Undefined; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Apertures.cs b/SAM/SAM.Analytical/Query/Apertures.cs index 9d203b11e..4db4b79cd 100644 --- a/SAM/SAM.Analytical/Query/Apertures.cs +++ b/SAM/SAM.Analytical/Query/Apertures.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -34,27 +37,27 @@ public static List Apertures(this AdjacencyCluster adjacencyCluster, A public static List Apertures(this AdjacencyCluster adjacencyCluster, Point3D point3D, int maxCount = 1, double tolerance = Core.Tolerance.Distance) { - if(adjacencyCluster == null || point3D == null) + if (adjacencyCluster == null || point3D == null) { return null; } List panels = adjacencyCluster.GetPanels(); - if(panels == null || panels.Count == 0) + if (panels == null || panels.Count == 0) { return null; } List result = new List(); - foreach(Panel panel in panels) + foreach (Panel panel in panels) { List apertures = panel?.Apertures; - if(apertures == null || apertures.Count == 0) + if (apertures == null || apertures.Count == 0) { continue; } - if(apertures.Count > 1) + if (apertures.Count > 1) { if (!panel.GetBoundingBox().InRange(point3D, tolerance)) { @@ -62,18 +65,18 @@ public static List Apertures(this AdjacencyCluster adjacencyCluster, P } } - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { BoundingBox3D boundingBox3D = aperture?.GetBoundingBox(); - if(boundingBox3D == null) + if (boundingBox3D == null) { continue; } - if(aperture.Face3D.InRange(point3D, tolerance)) + if (aperture.Face3D.InRange(point3D, tolerance)) { result.Add(aperture); - if(result.Count == maxCount) + if (result.Count == maxCount) { return result; } @@ -84,4 +87,4 @@ public static List Apertures(this AdjacencyCluster adjacencyCluster, P return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Area.cs b/SAM/SAM.Analytical/Query/Area.cs index 2e3947914..0b65ce4d0 100644 --- a/SAM/SAM.Analytical/Query/Area.cs +++ b/SAM/SAM.Analytical/Query/Area.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -14,7 +17,7 @@ public static double Area(this IEnumerable panels, params PanelGroup[] pa bool filter = panelGroups != null && panelGroups.Length > 0; double result = 0; - foreach(Panel panel in panels) + foreach (Panel panel in panels) { if (filter && !panelGroups.Contains(panel.PanelType.PanelGroup())) continue; @@ -30,31 +33,31 @@ public static double Area(this Aperture aperture, out double paneArea, out doubl paneArea = double.NaN; frameArea = double.NaN; - if(aperture == null) + if (aperture == null) { return double.NaN; } Geometry.Spatial.Face3D face3D = aperture.Face3D; - if(face3D == null) + if (face3D == null) { return double.NaN; } Geometry.Planar.IClosed2D externalEdge2D = face3D.ExternalEdge2D; - if(externalEdge2D == null) + if (externalEdge2D == null) { return double.NaN; } double result = externalEdge2D.GetArea(); - if(double.IsNaN(result)) + if (double.IsNaN(result)) { return double.NaN; } List internalEdge2Ds = face3D.InternalEdge2Ds; - if(internalEdge2Ds == null || internalEdge2Ds.Count == 0) + if (internalEdge2Ds == null || internalEdge2Ds.Count == 0) { ApertureConstruction apertureConstruction = aperture.ApertureConstruction; if (apertureConstruction != null) @@ -71,7 +74,7 @@ public static double Area(this Aperture aperture, out double paneArea, out doubl } } - if(internalEdge2Ds == null || internalEdge2Ds.Count == 0) + if (internalEdge2Ds == null || internalEdge2Ds.Count == 0) { frameArea = 0; paneArea = result; @@ -85,4 +88,4 @@ public static double Area(this Aperture aperture, out double paneArea, out doubl return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Azimuth.cs b/SAM/SAM.Analytical/Query/Azimuth.cs index 9bf1e7296..5b4a264f3 100644 --- a/SAM/SAM.Analytical/Query/Azimuth.cs +++ b/SAM/SAM.Analytical/Query/Azimuth.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -28,4 +31,4 @@ public static double Azimuth(this Aperture aperture) return Geometry.Spatial.Query.Azimuth(aperture.GetFace3D(), Geometry.Spatial.Vector3D.WorldY); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/BlackBodySurfaceRadiativeCoefficient.cs b/SAM/SAM.Analytical/Query/BlackBodySurfaceRadiativeCoefficient.cs index 3061833b7..2f988aa9c 100644 --- a/SAM/SAM.Analytical/Query/BlackBodySurfaceRadiativeCoefficient.cs +++ b/SAM/SAM.Analytical/Query/BlackBodySurfaceRadiativeCoefficient.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -12,4 +15,4 @@ public static double BlackBodySurfaceRadiativeCoefficient(double meanTemperature return 4 * 5.67e-8 * System.Math.Pow(meanTemperature, 3); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/BoundaryType.cs b/SAM/SAM.Analytical/Query/BoundaryType.cs index 2c829b20d..3f9042929 100644 --- a/SAM/SAM.Analytical/Query/BoundaryType.cs +++ b/SAM/SAM.Analytical/Query/BoundaryType.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -6,7 +9,7 @@ public static partial class Query { public static BoundaryType BoundaryType(this AnalyticalModel analyticalModel, Panel panel) { - if(panel == null || analyticalModel == null) + if (panel == null || analyticalModel == null) { return Analytical.BoundaryType.Undefined; } @@ -28,38 +31,38 @@ public static BoundaryType BoundaryType(this AdjacencyCluster adjacencyCluster, } Panel panel_Temp = panel as Panel; - if(panel_Temp == null) + if (panel_Temp == null) { return Analytical.BoundaryType.Undefined; } - if(panel_Temp.Adiabatic()) + if (panel_Temp.Adiabatic()) { return Analytical.BoundaryType.Adiabatic; } - if(adjacencyCluster.Shade(panel_Temp)) + if (adjacencyCluster.Shade(panel_Temp)) { return Analytical.BoundaryType.Shade; } - - if(adjacencyCluster.Ground(panel_Temp)) + + if (adjacencyCluster.Ground(panel_Temp)) { return Analytical.BoundaryType.Ground; } - if(adjacencyCluster.ExposedToSun(panel_Temp)) + if (adjacencyCluster.ExposedToSun(panel_Temp)) { return Analytical.BoundaryType.Exposed; } List spaces = adjacencyCluster.GetSpaces(panel_Temp); - if(spaces != null && spaces.Count >= 2) + if (spaces != null && spaces.Count >= 2) { return Analytical.BoundaryType.Linked; } - if(panel_Temp.PanelType == Analytical.PanelType.Shade || panel_Temp.PanelType == Analytical.PanelType.SolarPanel) + if (panel_Temp.PanelType == Analytical.PanelType.Shade || panel_Temp.PanelType == Analytical.PanelType.SolarPanel) { return Analytical.BoundaryType.Shade; } @@ -67,4 +70,4 @@ public static BoundaryType BoundaryType(this AdjacencyCluster adjacencyCluster, return Analytical.BoundaryType.Undefined; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/BuildingHeight.cs b/SAM/SAM.Analytical/Query/BuildingHeight.cs index de7dc8850..8fb249ad5 100644 --- a/SAM/SAM.Analytical/Query/BuildingHeight.cs +++ b/SAM/SAM.Analytical/Query/BuildingHeight.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Analytical @@ -8,7 +11,7 @@ public static partial class Query public static double BuildingHeight(this AdjacencyCluster adjacencyCluster) { List panels = adjacencyCluster?.GetPanels(); - if(panels == null) + if (panels == null) { return double.NaN; } @@ -21,4 +24,4 @@ public static double BuildingHeight(this AdjacencyCluster adjacencyCluster) return panels.ConvertAll(x => x.GetBoundingBox().Max.Z).Max(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CalculatedArea.cs b/SAM/SAM.Analytical/Query/CalculatedArea.cs index fd58c75d7..b5a9458d9 100644 --- a/SAM/SAM.Analytical/Query/CalculatedArea.cs +++ b/SAM/SAM.Analytical/Query/CalculatedArea.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; namespace SAM.Analytical @@ -7,7 +10,7 @@ public static partial class Query { public static double CalculatedArea(this Space space, AdjacencyCluster adjacencyCluster = null) { - if(space == null) + if (space == null) { return double.NaN; } @@ -19,38 +22,38 @@ public static double CalculatedArea(this Space space, AdjacencyCluster adjacency result = double.NaN; - if(adjacencyCluster != null) + if (adjacencyCluster != null) { Shell shell = adjacencyCluster.Shell(space); - if(shell != null) + if (shell != null) { List face3Ds = shell.Section(); - if(face3Ds != null && face3Ds.Count != 0) + if (face3Ds != null && face3Ds.Count != 0) { result = 0; - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { - if(face3D == null) + if (face3D == null) { continue; } double area = face3D.GetArea(); - if(double.IsNaN(area)) + if (double.IsNaN(area)) { continue; } result += area; } - if(result == 0) + if (result == 0) { result = double.NaN; } } } - if(double.IsNaN(result)) + if (double.IsNaN(result)) { List panels = GeomericalFloorPanels(adjacencyCluster, space); if (panels != null && panels.Count != 0) @@ -86,4 +89,4 @@ public static double CalculatedArea(this Space space, AdjacencyCluster adjacency return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CalculatedEquipmentGain.cs b/SAM/SAM.Analytical/Query/CalculatedEquipmentGain.cs index 90833101a..aea66b34d 100644 --- a/SAM/SAM.Analytical/Query/CalculatedEquipmentGain.cs +++ b/SAM/SAM.Analytical/Query/CalculatedEquipmentGain.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -23,4 +26,4 @@ public static double CalculatedEquipmentGain(this Space space) return gain_1 + gain_2; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CalculatedEquipmentLatentGain.cs b/SAM/SAM.Analytical/Query/CalculatedEquipmentLatentGain.cs index 7d0439e52..65695b1b2 100644 --- a/SAM/SAM.Analytical/Query/CalculatedEquipmentLatentGain.cs +++ b/SAM/SAM.Analytical/Query/CalculatedEquipmentLatentGain.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -12,7 +15,7 @@ public static double CalculatedEquipmentLatentGain(this Space space) return double.NaN; double gain_1 = double.NaN; - if(internalCondition.TryGetValue(Analytical.InternalConditionParameter.EquipmentLatentGainPerArea, out gain_1) && !double.IsNaN(gain_1)) + if (internalCondition.TryGetValue(Analytical.InternalConditionParameter.EquipmentLatentGainPerArea, out gain_1) && !double.IsNaN(gain_1)) { double area = double.NaN; if (!space.TryGetValue(SpaceParameter.Area, out area) || double.IsNaN(area)) @@ -36,4 +39,4 @@ public static double CalculatedEquipmentLatentGain(this Space space) return gain_1 + gain_2; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CalculatedEquipmentSensibleGain.cs b/SAM/SAM.Analytical/Query/CalculatedEquipmentSensibleGain.cs index af67152be..dada6c256 100644 --- a/SAM/SAM.Analytical/Query/CalculatedEquipmentSensibleGain.cs +++ b/SAM/SAM.Analytical/Query/CalculatedEquipmentSensibleGain.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -12,7 +15,7 @@ public static double CalculatedEquipmentSensibleGain(this Space space) return double.NaN; double gain_1 = double.NaN; - if(internalCondition.TryGetValue(Analytical.InternalConditionParameter.EquipmentSensibleGainPerArea, out gain_1) && !double.IsNaN(gain_1)) + if (internalCondition.TryGetValue(Analytical.InternalConditionParameter.EquipmentSensibleGainPerArea, out gain_1) && !double.IsNaN(gain_1)) { double area = double.NaN; if (!space.TryGetValue(SpaceParameter.Area, out area) || double.IsNaN(area)) @@ -60,4 +63,4 @@ public static double CalculatedEquipmentSensibleGain(this Space space) return gain_1 + gain_2 + gain_3; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CalculatedExhaustAirChangesPerHour.cs b/SAM/SAM.Analytical/Query/CalculatedExhaustAirChangesPerHour.cs index adc18a564..99a2fc1bc 100644 --- a/SAM/SAM.Analytical/Query/CalculatedExhaustAirChangesPerHour.cs +++ b/SAM/SAM.Analytical/Query/CalculatedExhaustAirChangesPerHour.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -28,4 +31,4 @@ public static double CalculatedExhaustAirChangesPerHour(this Space space) return supplyAirFlow / volume * 3600; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CalculatedExhaustAirFlowPerArea.cs b/SAM/SAM.Analytical/Query/CalculatedExhaustAirFlowPerArea.cs index f2869e31b..18ccd5b4d 100644 --- a/SAM/SAM.Analytical/Query/CalculatedExhaustAirFlowPerArea.cs +++ b/SAM/SAM.Analytical/Query/CalculatedExhaustAirFlowPerArea.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -28,4 +31,4 @@ public static double CalculatedExhaustAirFlowPerArea(this Space space) return ExhaustAirFlow / area; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CalculatedExhaustAirFlowPerPerson.cs b/SAM/SAM.Analytical/Query/CalculatedExhaustAirFlowPerPerson.cs index 91f57d134..0d8a96d5f 100644 --- a/SAM/SAM.Analytical/Query/CalculatedExhaustAirFlowPerPerson.cs +++ b/SAM/SAM.Analytical/Query/CalculatedExhaustAirFlowPerPerson.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -29,4 +32,4 @@ public static double CalculatedExhaustAirFlowPerPerson(this Space space) return ExhaustAirFlow / occupancy; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CalculatedExhaustAirflow.cs b/SAM/SAM.Analytical/Query/CalculatedExhaustAirflow.cs index 6ff9a9850..c480e955a 100644 --- a/SAM/SAM.Analytical/Query/CalculatedExhaustAirflow.cs +++ b/SAM/SAM.Analytical/Query/CalculatedExhaustAirflow.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -135,4 +138,4 @@ public static double CalculatedExhaustAirFlow(this AdjacencyCluster adjacencyClu return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CalculatedInfiltrationAirFlow.cs b/SAM/SAM.Analytical/Query/CalculatedInfiltrationAirFlow.cs index 6525bed7a..a7245b3b9 100644 --- a/SAM/SAM.Analytical/Query/CalculatedInfiltrationAirFlow.cs +++ b/SAM/SAM.Analytical/Query/CalculatedInfiltrationAirFlow.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -35,4 +38,4 @@ public static double CalculatedInfiltrationAirFlow(this Space space) return volume * airChangesPerHour / 3600; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CalculatedInfiltrationLatentGain.cs b/SAM/SAM.Analytical/Query/CalculatedInfiltrationLatentGain.cs index 40669a516..615060db3 100644 --- a/SAM/SAM.Analytical/Query/CalculatedInfiltrationLatentGain.cs +++ b/SAM/SAM.Analytical/Query/CalculatedInfiltrationLatentGain.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -13,11 +16,11 @@ public static partial class Query /// Calculated Infiltration Latent Gain [W] public static double CalculatedInfiltrationLatentGain(this Space space, double humidityRatio_Outside, double humidityRatio_Inside, double dryBulbTemperature_Inside, double density_Outside) { - if(space == null || double.IsNaN(humidityRatio_Inside) || double.IsNaN(humidityRatio_Outside) || double.IsNaN(dryBulbTemperature_Inside) || double.IsNaN(density_Outside)) + if (space == null || double.IsNaN(humidityRatio_Inside) || double.IsNaN(humidityRatio_Outside) || double.IsNaN(dryBulbTemperature_Inside) || double.IsNaN(density_Outside)) { return double.NaN; } - + double vapourizationLatentHeat = Core.Query.VapourizationLatentHeat(dryBulbTemperature_Inside); if (double.IsNaN(vapourizationLatentHeat)) { @@ -33,4 +36,4 @@ public static double CalculatedInfiltrationLatentGain(this Space space, double h return calculatedInfiltrationMassAirFlow * (humidityRatio_Outside - humidityRatio_Inside) * (1.86 * dryBulbTemperature_Inside + vapourizationLatentHeat); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CalculatedInfiltrationSensibleGain.cs b/SAM/SAM.Analytical/Query/CalculatedInfiltrationSensibleGain.cs index 3ad0d726a..488de8f95 100644 --- a/SAM/SAM.Analytical/Query/CalculatedInfiltrationSensibleGain.cs +++ b/SAM/SAM.Analytical/Query/CalculatedInfiltrationSensibleGain.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -12,11 +15,11 @@ public static partial class Query /// Calculated Infiltration Sensible Gain [W] public static double CalculatedInfiltrationSensibleGain(this Space space, double dryBulbTemperature_Outside, double dryBulbTemperature_Inside, double density_Outside) { - if(space == null|| double.IsNaN(dryBulbTemperature_Inside) || double.IsNaN(density_Outside)) + if (space == null || double.IsNaN(dryBulbTemperature_Inside) || double.IsNaN(density_Outside)) { return double.NaN; } - + double vapourizationLatentHeat = Core.Query.VapourizationLatentHeat(dryBulbTemperature_Inside); if (double.IsNaN(vapourizationLatentHeat)) { @@ -32,4 +35,4 @@ public static double CalculatedInfiltrationSensibleGain(this Space space, double return calculatedInfiltrationMassAirFlow * 1.005 * (dryBulbTemperature_Inside - dryBulbTemperature_Outside); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CalculatedLightingGain.cs b/SAM/SAM.Analytical/Query/CalculatedLightingGain.cs index d54b0cb64..9d1b8515f 100644 --- a/SAM/SAM.Analytical/Query/CalculatedLightingGain.cs +++ b/SAM/SAM.Analytical/Query/CalculatedLightingGain.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -64,4 +67,4 @@ public static double CalculatedLightingGain(this Space space) return gain_1 + gain_2 + gain_3; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CalculatedOccupancy.cs b/SAM/SAM.Analytical/Query/CalculatedOccupancy.cs index 21e0067b5..fd24a3893 100644 --- a/SAM/SAM.Analytical/Query/CalculatedOccupancy.cs +++ b/SAM/SAM.Analytical/Query/CalculatedOccupancy.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -29,4 +32,4 @@ public static double CalculatedOccupancy(this Space space) return area / areaPerPerson; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CalculatedOccupancyLatentGain.cs b/SAM/SAM.Analytical/Query/CalculatedOccupancyLatentGain.cs index 2768e8426..bb63452f6 100644 --- a/SAM/SAM.Analytical/Query/CalculatedOccupancyLatentGain.cs +++ b/SAM/SAM.Analytical/Query/CalculatedOccupancyLatentGain.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -12,10 +15,10 @@ public static double CalculatedOccupancyLatentGain(this Space space) return double.NaN; double gain_1 = double.NaN; - if(internalCondition.TryGetValue(Analytical.InternalConditionParameter.OccupancyLatentGainPerPerson, out gain_1) && !double.IsNaN(gain_1)) + if (internalCondition.TryGetValue(Analytical.InternalConditionParameter.OccupancyLatentGainPerPerson, out gain_1) && !double.IsNaN(gain_1)) { double occupancy = space.CalculatedOccupancy(); - if(!double.IsNaN(occupancy)) + if (!double.IsNaN(occupancy)) { gain_1 = gain_1 * occupancy; } @@ -24,4 +27,4 @@ public static double CalculatedOccupancyLatentGain(this Space space) return gain_1; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CalculatedOutsideSupplyAirflow.cs b/SAM/SAM.Analytical/Query/CalculatedOutsideSupplyAirflow.cs index 6b0d3235a..2ff7e4f56 100644 --- a/SAM/SAM.Analytical/Query/CalculatedOutsideSupplyAirflow.cs +++ b/SAM/SAM.Analytical/Query/CalculatedOutsideSupplyAirflow.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -10,4 +13,4 @@ public static double CalculatedOutsideSupplyAirFlow(this AdjacencyCluster adjace return adjacencyCluster.Sum(zone, SpaceParameter.OutsideSupplyAirFlow); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CalculatedPeoplePerArea.cs b/SAM/SAM.Analytical/Query/CalculatedPeoplePerArea.cs index 635c83ac7..28a1accef 100644 --- a/SAM/SAM.Analytical/Query/CalculatedPeoplePerArea.cs +++ b/SAM/SAM.Analytical/Query/CalculatedPeoplePerArea.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -21,4 +24,4 @@ public static double CalculatedPeoplePerArea(this Space space) return occupancy / area; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CalculatedPollutantGeneration.cs b/SAM/SAM.Analytical/Query/CalculatedPollutantGeneration.cs index 56dad9348..28ccdae50 100644 --- a/SAM/SAM.Analytical/Query/CalculatedPollutantGeneration.cs +++ b/SAM/SAM.Analytical/Query/CalculatedPollutantGeneration.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -43,4 +46,4 @@ public static double CalculatedPollutantGeneration(this Space space) return gain_1 + gain_2; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CalculatedSupplyAirChangesPerHour.cs b/SAM/SAM.Analytical/Query/CalculatedSupplyAirChangesPerHour.cs index 8b4987703..b43c312e2 100644 --- a/SAM/SAM.Analytical/Query/CalculatedSupplyAirChangesPerHour.cs +++ b/SAM/SAM.Analytical/Query/CalculatedSupplyAirChangesPerHour.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -28,4 +31,4 @@ public static double CalculatedSupplyAirChangesPerHour(this Space space) return supplyAirFlow / volume * 3600; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CalculatedSupplyAirFlowPerArea.cs b/SAM/SAM.Analytical/Query/CalculatedSupplyAirFlowPerArea.cs index b923c52ea..08175d30d 100644 --- a/SAM/SAM.Analytical/Query/CalculatedSupplyAirFlowPerArea.cs +++ b/SAM/SAM.Analytical/Query/CalculatedSupplyAirFlowPerArea.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -28,4 +31,4 @@ public static double CalculatedSupplyAirFlowPerArea(this Space space) return supplyAirFlow / area; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CalculatedSupplyAirFlowPerPerson.cs b/SAM/SAM.Analytical/Query/CalculatedSupplyAirFlowPerPerson.cs index c1eca4d1a..3620dccee 100644 --- a/SAM/SAM.Analytical/Query/CalculatedSupplyAirFlowPerPerson.cs +++ b/SAM/SAM.Analytical/Query/CalculatedSupplyAirFlowPerPerson.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -29,4 +32,4 @@ public static double CalculatedSupplyAirFlowPerPerson(this Space space) return supplyAirFlow / occupancy; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CalculatedSupplyAirflow.cs b/SAM/SAM.Analytical/Query/CalculatedSupplyAirflow.cs index c3ba4fd2e..cb8b780dc 100644 --- a/SAM/SAM.Analytical/Query/CalculatedSupplyAirflow.cs +++ b/SAM/SAM.Analytical/Query/CalculatedSupplyAirflow.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -116,15 +119,15 @@ public static double CalculatedSupplyAirFlow(this AdjacencyCluster adjacencyClus double result = 0; List spaces = adjacencyCluster.GetSpaces(zone); - if(spaces == null || spaces.Count == 0) + if (spaces == null || spaces.Count == 0) { return result; } - foreach(Space space in spaces) + foreach (Space space in spaces) { double value = space.CalculatedSupplyAirFlow(); - if(double.IsNaN(value)) + if (double.IsNaN(value)) { continue; } @@ -176,4 +179,4 @@ public static double CalculatedSupplyAirFlow(this AdjacencyCluster adjacencyClus return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CalculatedVolume.cs b/SAM/SAM.Analytical/Query/CalculatedVolume.cs index 5bc51f7e7..7c5ad8865 100644 --- a/SAM/SAM.Analytical/Query/CalculatedVolume.cs +++ b/SAM/SAM.Analytical/Query/CalculatedVolume.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -13,4 +16,4 @@ public static double CalculatedVolume(this Space space, AdjacencyCluster adjacen return space.Volume(adjacencyCluster); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Color.cs b/SAM/SAM.Analytical/Query/Color.cs index 4b5697aa4..20aa4b010 100644 --- a/SAM/SAM.Analytical/Query/Color.cs +++ b/SAM/SAM.Analytical/Query/Color.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -146,7 +149,7 @@ public static System.Drawing.Color Color(this Panel panel) if (panel == null) return System.Drawing.Color.Empty; - if(panel.TryGetValue(PanelParameter.Color, out System.Drawing.Color color) && color != System.Drawing.Color.Empty) + if (panel.TryGetValue(PanelParameter.Color, out System.Drawing.Color color) && color != System.Drawing.Color.Empty) { return color; } @@ -156,7 +159,7 @@ public static System.Drawing.Color Color(this Panel panel) public static System.Drawing.Color Color(this ExternalPanel externalPanel) { - if(externalPanel == null) + if (externalPanel == null) { return System.Drawing.Color.Empty; } @@ -169,7 +172,7 @@ public static System.Drawing.Color Color(this Aperture aperture, AperturePart ap if (aperture == null) return System.Drawing.Color.Empty; - if(aperturePart == AperturePart.Pane || aperture.ApertureType == Analytical.ApertureType.Door) + if (aperturePart == AperturePart.Pane || aperture.ApertureType == Analytical.ApertureType.Door) { if (aperture.TryGetValue(ApertureParameter.Color, out System.Drawing.Color color) && color != System.Drawing.Color.Empty) { @@ -252,7 +255,7 @@ public static System.Drawing.Color Color(this ApertureType apertureType, Apertur public static System.Drawing.Color Color(this ApertureType apertureType) { - switch(apertureType) + switch (apertureType) { case Analytical.ApertureType.Window: return Color(apertureType, AperturePart.Pane); @@ -264,4 +267,4 @@ public static System.Drawing.Color Color(this ApertureType apertureType) return System.Drawing.Color.Empty; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Constructions.cs b/SAM/SAM.Analytical/Query/Constructions.cs index 18b5e1e00..ce7effbcb 100644 --- a/SAM/SAM.Analytical/Query/Constructions.cs +++ b/SAM/SAM.Analytical/Query/Constructions.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Analytical @@ -9,7 +12,7 @@ public static IEnumerable Constructions(this IEnumerable pa { if (panels == null) return null; - + Dictionary dictionary = new Dictionary(); foreach (Panel panel in panels) @@ -27,4 +30,4 @@ public static IEnumerable Constructions(this IEnumerable pa return dictionary.Values; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CoolingDesignDay.cs b/SAM/SAM.Analytical/Query/CoolingDesignDay.cs index b5e7e6b8c..888a4040f 100644 --- a/SAM/SAM.Analytical/Query/CoolingDesignDay.cs +++ b/SAM/SAM.Analytical/Query/CoolingDesignDay.cs @@ -1,4 +1,7 @@ -using SAM.Weather; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Weather; using System; using System.Collections.Generic; @@ -63,4 +66,4 @@ public static DesignDay CoolingDesignDay(this WeatherData weatherData) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CoolingDesignRelativeHumidity.cs b/SAM/SAM.Analytical/Query/CoolingDesignRelativeHumidity.cs index d78b2c0cb..6ff3fdeca 100644 --- a/SAM/SAM.Analytical/Query/CoolingDesignRelativeHumidity.cs +++ b/SAM/SAM.Analytical/Query/CoolingDesignRelativeHumidity.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -25,4 +28,4 @@ public static double CoolingDesignRelativeHumidity(this InternalCondition intern return profile == null ? double.NaN : profile.MaxValue; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CoolingDesignTemperature.cs b/SAM/SAM.Analytical/Query/CoolingDesignTemperature.cs index b153a8e89..91edba107 100644 --- a/SAM/SAM.Analytical/Query/CoolingDesignTemperature.cs +++ b/SAM/SAM.Analytical/Query/CoolingDesignTemperature.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -25,4 +28,4 @@ public static double CoolingDesignTemperature(this InternalCondition internalCon return profile == null ? double.NaN : profile.MinValue; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Cut.cs b/SAM/SAM.Analytical/Query/Cut.cs index 84d58c117..ce13c68c5 100644 --- a/SAM/SAM.Analytical/Query/Cut.cs +++ b/SAM/SAM.Analytical/Query/Cut.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -22,7 +25,7 @@ public static List Cut(this Panel panel, double elevation, double toleran public static List Cut(this Panel panel, Plane plane, double threshold, double tolerance) { List panels = Cut(panel, plane, tolerance); - if(panels == null || panels.Count <= 1) + if (panels == null || panels.Count <= 1) { return panels; } @@ -30,43 +33,43 @@ public static List Cut(this Panel panel, Plane plane, double threshold, d Point3D origin = plane.Origin; Line3D line3D = new Line3D(origin, plane.Normal); - foreach(Panel panel_Temp in panels) + foreach (Panel panel_Temp in panels) { IClosedPlanar3D closedPlanar3D = panel_Temp?.Face3D?.GetExternalEdge3D(); - if(closedPlanar3D == null) + if (closedPlanar3D == null) { continue; } ISegmentable3D segmentable3D = closedPlanar3D as ISegmentable3D; - if(segmentable3D == null) + if (segmentable3D == null) { throw new System.NotImplementedException(); } List point3Ds = segmentable3D.GetPoints(); - if(point3Ds == null || point3Ds.Count == 0) + if (point3Ds == null || point3Ds.Count == 0) { continue; } double max = double.MinValue; - foreach(Point3D point3D in point3Ds) + foreach (Point3D point3D in point3Ds) { Point3D point3D_Project = line3D.Project(point3D); - if(point3D_Project == null || !point3D_Project.IsValid()) + if (point3D_Project == null || !point3D_Project.IsValid()) { continue; } double distance = point3D_Project.Distance(origin); - if(distance > max) + if (distance > max) { max = distance; } } - if(max < threshold) + if (max < threshold) { return new List() { Create.Panel(panel) }; } @@ -76,7 +79,7 @@ public static List Cut(this Panel panel, Plane plane, double threshold, d return panels; } - + public static List Cut(this Panel panel, Plane plane, double tolerance = Tolerance.Distance) { if (plane == null) @@ -87,7 +90,7 @@ public static List Cut(this Panel panel, Plane plane, double tolerance = return null; List result = new List(); - + List face3Ds = Geometry.Spatial.Query.Cut(face3D, plane, tolerance); if (face3Ds == null || face3Ds.Count == 0) { @@ -95,7 +98,7 @@ public static List Cut(this Panel panel, Plane plane, double tolerance = return result; } - foreach(Face3D face3D_New in face3Ds) + foreach (Face3D face3D_New in face3Ds) { if (face3D_New == null) continue; @@ -172,4 +175,4 @@ public static List Cut(this Panel panel, IEnumerable elevations, return Cut(panel, planes, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/CutShading.cs b/SAM/SAM.Analytical/Query/CutShading.cs index 8afea2bd4..80ace7d7a 100644 --- a/SAM/SAM.Analytical/Query/CutShading.cs +++ b/SAM/SAM.Analytical/Query/CutShading.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -13,7 +16,7 @@ public static List CutShading(this IEnumerable panels, IEnumerable return null; List> tuples = new List>(); - foreach(Panel panel in panels) + foreach (Panel panel in panels) { Face3D face3D = panel.GetFace3D(); if (face3D == null) @@ -31,7 +34,7 @@ public static List CutShading(this IEnumerable panels, IEnumerable } List result = new List(); - foreach(Panel panel in panels_ToBeCutted) + foreach (Panel panel in panels_ToBeCutted) { Face3D face3D = panel.GetFace3D(); if (face3D == null) @@ -45,7 +48,7 @@ public static List CutShading(this IEnumerable panels, IEnumerable if (tuples_Temp == null || tuples_Temp.Count == 0) continue; - List face2Ds = tuples_Temp.ConvertAll(x => plane.Convert(plane.Project(x.Item3))); + List face2Ds = tuples_Temp.ConvertAll(x => plane.Convert(plane.Project(x.Item3))); face2Ds?.RemoveAll(x => x == null || x.GetArea() < tolerance); if (face2Ds == null || face2Ds.Count == 0) continue; @@ -56,7 +59,7 @@ public static List CutShading(this IEnumerable panels, IEnumerable if (face2Ds == null || face2Ds.Count == 0) continue; - foreach(Geometry.Planar.Face2D face2D_Shade in face2Ds) + foreach (Geometry.Planar.Face2D face2D_Shade in face2Ds) { if (face2D_Shade == null || face2D_Shade.GetArea() <= tolerance) continue; @@ -74,4 +77,4 @@ public static List CutShading(this IEnumerable panels, IEnumerable return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/DaylightFactor.cs b/SAM/SAM.Analytical/Query/DaylightFactor.cs index dd58ed4a8..f7f803bff 100644 --- a/SAM/SAM.Analytical/Query/DaylightFactor.cs +++ b/SAM/SAM.Analytical/Query/DaylightFactor.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -8,13 +11,13 @@ public static partial class Query { public static double DaylightFactor(this AdjacencyCluster adjacencyCluster, Space space) { - if(adjacencyCluster == null || space == null) + if (adjacencyCluster == null || space == null) { return double.NaN; } List panels = adjacencyCluster.GetPanels(space); - if(panels == null || panels.Count == 0) + if (panels == null || panels.Count == 0) { return double.NaN; } @@ -25,14 +28,14 @@ public static double DaylightFactor(this AdjacencyCluster adjacencyCluster, Spac foreach (Panel panel in panels) { Face3D face3D_Panel = panel?.GetFace3D(); - if(face3D_Panel == null) + if (face3D_Panel == null) { continue; } double area_Panel = face3D_Panel.GetArea(); - if(double.IsNaN(area_Panel)) + if (double.IsNaN(area_Panel)) { continue; } @@ -40,29 +43,29 @@ public static double DaylightFactor(this AdjacencyCluster adjacencyCluster, Spac area += area_Panel; BoundaryType boundaryType = adjacencyCluster.BoundaryType(panel); - if(boundaryType != Analytical.BoundaryType.Exposed) + if (boundaryType != Analytical.BoundaryType.Exposed) { continue; } double tilt = panel.GetTilt(); - if(double.IsNaN(tilt)) + if (double.IsNaN(tilt)) { continue; } List> tuples = new List>(); - if(panel.TryGetValue(PanelParameter.LightTransmittance, out double lightTransmittance) && !double.IsNaN(lightTransmittance) && lightTransmittance > 0) + if (panel.TryGetValue(PanelParameter.LightTransmittance, out double lightTransmittance) && !double.IsNaN(lightTransmittance) && lightTransmittance > 0) { tuples.Add(new Tuple(area_Panel, lightTransmittance)); } List apertures = panel.Apertures; - if(apertures != null && apertures.Count != 0) + if (apertures != null && apertures.Count != 0) { - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { - if(aperture == null) + if (aperture == null) { continue; } @@ -81,14 +84,14 @@ public static double DaylightFactor(this AdjacencyCluster adjacencyCluster, Spac } } - if(tuples == null || tuples.Count == 0) + if (tuples == null || tuples.Count == 0) { continue; } - foreach(Tuple tuple in tuples) + foreach (Tuple tuple in tuples) { - if(tilt < 90) + if (tilt < 90) { double temp_1 = tilt / 90.0; double temp_2 = temp_1 * 45.0; @@ -108,7 +111,7 @@ public static double DaylightFactor(this AdjacencyCluster adjacencyCluster, Spac } } - if(area == 0 || result == 0) + if (area == 0 || result == 0) { return 0; } @@ -118,4 +121,4 @@ public static double DaylightFactor(this AdjacencyCluster adjacencyCluster, Spac return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/DefaultApertureConstruction.cs b/SAM/SAM.Analytical/Query/DefaultApertureConstruction.cs index 791fe533d..6e124c98d 100644 --- a/SAM/SAM.Analytical/Query/DefaultApertureConstruction.cs +++ b/SAM/SAM.Analytical/Query/DefaultApertureConstruction.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Analytical @@ -58,4 +61,4 @@ public static ApertureConstruction DefaultApertureConstruction(this PanelType pa return apertureConstructions.FirstOrDefault(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/DefaultApertureConstructionLibrary.cs b/SAM/SAM.Analytical/Query/DefaultApertureConstructionLibrary.cs index 4fc87846b..29ce136ec 100644 --- a/SAM/SAM.Analytical/Query/DefaultApertureConstructionLibrary.cs +++ b/SAM/SAM.Analytical/Query/DefaultApertureConstructionLibrary.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -12,4 +15,4 @@ public static ApertureConstructionLibrary DefaultApertureConstructionLibrary() return ActiveSetting.Setting.GetValue(AnalyticalSettingParameter.DefaultApertureConstructionLibrary); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/DefaultApertureConstructionName.cs b/SAM/SAM.Analytical/Query/DefaultApertureConstructionName.cs index fa59e2f0a..0b0e97c03 100644 --- a/SAM/SAM.Analytical/Query/DefaultApertureConstructionName.cs +++ b/SAM/SAM.Analytical/Query/DefaultApertureConstructionName.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -11,4 +14,4 @@ public static string DefaultApertureConstructionName(this PanelType panelType, A return apertureConstruction.Name; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/DefaultConstruction.cs b/SAM/SAM.Analytical/Query/DefaultConstruction.cs index a884e688f..60fac248e 100644 --- a/SAM/SAM.Analytical/Query/DefaultConstruction.cs +++ b/SAM/SAM.Analytical/Query/DefaultConstruction.cs @@ -1,4 +1,7 @@ -using System.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Linq; namespace SAM.Analytical { @@ -15,4 +18,4 @@ public static Construction DefaultConstruction(this PanelType panelType) return DefaultConstructionLibrary()?.GetConstructions(panelType)?.FirstOrDefault(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/DefaultConstructionLibrary.cs b/SAM/SAM.Analytical/Query/DefaultConstructionLibrary.cs index 4033c8959..39c7c8b00 100644 --- a/SAM/SAM.Analytical/Query/DefaultConstructionLibrary.cs +++ b/SAM/SAM.Analytical/Query/DefaultConstructionLibrary.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -12,4 +15,4 @@ public static ConstructionLibrary DefaultConstructionLibrary() return ActiveSetting.Setting.GetValue(AnalyticalSettingParameter.DefaultConstructionLibrary); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/DefaultConstructionLibraryPath.cs b/SAM/SAM.Analytical/Query/DefaultConstructionLibraryPath.cs index 4337eeefe..f776361b0 100644 --- a/SAM/SAM.Analytical/Query/DefaultConstructionLibraryPath.cs +++ b/SAM/SAM.Analytical/Query/DefaultConstructionLibraryPath.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -12,4 +15,4 @@ public static string DefaultConstructionLibraryPath() return DefaultPath(ActiveSetting.Setting, AnalyticalSettingParameter.DefaultConstructionLibraryFileName); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/DefaultConstructionManager.cs b/SAM/SAM.Analytical/Query/DefaultConstructionManager.cs index 3db4fdf95..bc5881d0d 100644 --- a/SAM/SAM.Analytical/Query/DefaultConstructionManager.cs +++ b/SAM/SAM.Analytical/Query/DefaultConstructionManager.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -7,4 +10,4 @@ public static ConstructionManager DefaultConstructionManager() return new ConstructionManager(DefaultApertureConstructionLibrary(), DefaultConstructionLibrary(), DefaultMaterialLibrary()); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/DefaultConstructionName.cs b/SAM/SAM.Analytical/Query/DefaultConstructionName.cs index 92d71456d..5c75fc1e1 100644 --- a/SAM/SAM.Analytical/Query/DefaultConstructionName.cs +++ b/SAM/SAM.Analytical/Query/DefaultConstructionName.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -11,4 +14,4 @@ public static string ConstructionName(this PanelType panelType) return construction.Name; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/DefaultGasMaterial.cs b/SAM/SAM.Analytical/Query/DefaultGasMaterial.cs index 56788b956..323f98fc7 100644 --- a/SAM/SAM.Analytical/Query/DefaultGasMaterial.cs +++ b/SAM/SAM.Analytical/Query/DefaultGasMaterial.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Analytical @@ -31,7 +34,7 @@ public static GasMaterial DefaultGasMaterial(this DefaultGasType defaultGasType) name = name.ToLower(); - foreach(GasMaterial gasMaterial in gasMaterials) + foreach (GasMaterial gasMaterial in gasMaterials) { string name_Material = gasMaterial?.Name; if (string.IsNullOrWhiteSpace(name_Material)) @@ -57,4 +60,4 @@ public static GasMaterial DefaultGasMaterial(this GasMaterial gasMaterial) return DefaultGasMaterial(defaultGasType); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/DefaultGasType.cs b/SAM/SAM.Analytical/Query/DefaultGasType.cs index fe1695196..33cf0de1b 100644 --- a/SAM/SAM.Analytical/Query/DefaultGasType.cs +++ b/SAM/SAM.Analytical/Query/DefaultGasType.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System; using System.Collections.Generic; using System.Linq; @@ -13,7 +16,7 @@ public static DefaultGasType DefaultGasType(this GasMaterial gasMaterial) return Analytical.DefaultGasType.Undefined; List names = new List(); - + if (gasMaterial.TryGetValue(GasMaterialParameter.DefaultGasType, out string defaultGasType_String) && !string.IsNullOrWhiteSpace(defaultGasType_String)) { DefaultGasType defaultGasType = Core.Query.Enum(defaultGasType_String); @@ -21,10 +24,10 @@ public static DefaultGasType DefaultGasType(this GasMaterial gasMaterial) { return defaultGasType; } - + names.Add(defaultGasType_String); } - + names.Add(gasMaterial.Name); names.Add(gasMaterial.DisplayName); names.Add(gasMaterial.Description); @@ -34,7 +37,7 @@ public static DefaultGasType DefaultGasType(this GasMaterial gasMaterial) public static DefaultGasType DefaultGasType(params string[] values) { - if(values == null || values.Length == 0) + if (values == null || values.Length == 0) { return Analytical.DefaultGasType.Undefined; } @@ -76,4 +79,4 @@ public static DefaultGasType DefaultGasType(params string[] values) } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/DefaultHoursOfYear.cs b/SAM/SAM.Analytical/Query/DefaultHoursOfYear.cs index 1e5669f91..edcae38ba 100644 --- a/SAM/SAM.Analytical/Query/DefaultHoursOfYear.cs +++ b/SAM/SAM.Analytical/Query/DefaultHoursOfYear.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -9,4 +12,4 @@ public static List DefaultHoursOfYear() return new List() { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 740, 741, 742, 743, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1440, 1441, 1442, 1443, 1444, 1445, 1446, 1447, 1448, 1449, 1450, 1451, 1452, 1453, 1454, 1455, 1456, 1457, 1458, 1459, 1460, 1461, 1462, 1463, 1800, 1801, 1802, 1803, 1804, 1805, 1806, 1807, 1808, 1809, 1810, 1811, 1812, 1813, 1814, 1815, 1816, 1817, 1818, 1819, 1820, 1821, 1822, 1823, 2160, 2161, 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169, 2170, 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2180, 2181, 2182, 2183, 2520, 2521, 2522, 2523, 2524, 2525, 2526, 2527, 2528, 2529, 2530, 2531, 2532, 2533, 2534, 2535, 2536, 2537, 2538, 2539, 2540, 2541, 2542, 2543, 2880, 2881, 2882, 2883, 2884, 2885, 2886, 2887, 2888, 2889, 2890, 2891, 2892, 2893, 2894, 2895, 2896, 2897, 2898, 2899, 2900, 2901, 2902, 2903, 3240, 3241, 3242, 3243, 3244, 3245, 3246, 3247, 3248, 3249, 3250, 3251, 3252, 3253, 3254, 3255, 3256, 3257, 3258, 3259, 3260, 3261, 3262, 3263, 3600, 3601, 3602, 3603, 3604, 3605, 3606, 3607, 3608, 3609, 3610, 3611, 3612, 3613, 3614, 3615, 3616, 3617, 3618, 3619, 3620, 3621, 3622, 3623, 3960, 3961, 3962, 3963, 3964, 3965, 3966, 3967, 3968, 3969, 3970, 3971, 3972, 3973, 3974, 3975, 3976, 3977, 3978, 3979, 3980, 3981, 3982, 3983, 4320, 4321, 4322, 4323, 4324, 4325, 4326, 4327, 4328, 4329, 4330, 4331, 4332, 4333, 4334, 4335, 4336, 4337, 4338, 4339, 4340, 4341, 4342, 4343, 4680, 4681, 4682, 4683, 4684, 4685, 4686, 4687, 4688, 4689, 4690, 4691, 4692, 4693, 4694, 4695, 4696, 4697, 4698, 4699, 4700, 4701, 4702, 4703, 5040, 5041, 5042, 5043, 5044, 5045, 5046, 5047, 5048, 5049, 5050, 5051, 5052, 5053, 5054, 5055, 5056, 5057, 5058, 5059, 5060, 5061, 5062, 5063, 5400, 5401, 5402, 5403, 5404, 5405, 5406, 5407, 5408, 5409, 5410, 5411, 5412, 5413, 5414, 5415, 5416, 5417, 5418, 5419, 5420, 5421, 5422, 5423, 5760, 5761, 5762, 5763, 5764, 5765, 5766, 5767, 5768, 5769, 5770, 5771, 5772, 5773, 5774, 5775, 5776, 5777, 5778, 5779, 5780, 5781, 5782, 5783, 6120, 6121, 6122, 6123, 6124, 6125, 6126, 6127, 6128, 6129, 6130, 6131, 6132, 6133, 6134, 6135, 6136, 6137, 6138, 6139, 6140, 6141, 6142, 6143, 6480, 6481, 6482, 6483, 6484, 6485, 6486, 6487, 6488, 6489, 6490, 6491, 6492, 6493, 6494, 6495, 6496, 6497, 6498, 6499, 6500, 6501, 6502, 6503, 6840, 6841, 6842, 6843, 6844, 6845, 6846, 6847, 6848, 6849, 6850, 6851, 6852, 6853, 6854, 6855, 6856, 6857, 6858, 6859, 6860, 6861, 6862, 6863, 7200, 7201, 7202, 7203, 7204, 7205, 7206, 7207, 7208, 7209, 7210, 7211, 7212, 7213, 7214, 7215, 7216, 7217, 7218, 7219, 7220, 7221, 7222, 7223, 7560, 7561, 7562, 7563, 7564, 7565, 7566, 7567, 7568, 7569, 7570, 7571, 7572, 7573, 7574, 7575, 7576, 7577, 7578, 7579, 7580, 7581, 7582, 7583, 7920, 7921, 7922, 7923, 7924, 7925, 7926, 7927, 7928, 7929, 7930, 7931, 7932, 7933, 7934, 7935, 7936, 7937, 7938, 7939, 7940, 7941, 7942, 7943, 8280, 8281, 8282, 8283, 8284, 8285, 8286, 8287, 8288, 8289, 8290, 8291, 8292, 8293, 8294, 8295, 8296, 8297, 8298, 8299, 8300, 8301, 8302, 8303, 8640, 8641, 8642, 8643, 8644, 8645, 8646, 8647, 8648, 8649, 8650, 8651, 8652, 8653, 8654, 8655, 8656, 8657, 8658, 8659, 8660, 8661, 8662, 8663 }; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/DefaultInternalConditionLibrary.cs b/SAM/SAM.Analytical/Query/DefaultInternalConditionLibrary.cs index f07d5b080..e257c02f7 100644 --- a/SAM/SAM.Analytical/Query/DefaultInternalConditionLibrary.cs +++ b/SAM/SAM.Analytical/Query/DefaultInternalConditionLibrary.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -12,4 +15,4 @@ public static InternalConditionLibrary DefaultInternalConditionLibrary() return ActiveSetting.Setting.GetValue(AnalyticalSettingParameter.DefaultInternalConditionLibrary); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/DefaultInternalConditionLibrary_TM59.cs b/SAM/SAM.Analytical/Query/DefaultInternalConditionLibrary_TM59.cs index 4c9b98b41..002f6bb45 100644 --- a/SAM/SAM.Analytical/Query/DefaultInternalConditionLibrary_TM59.cs +++ b/SAM/SAM.Analytical/Query/DefaultInternalConditionLibrary_TM59.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -12,4 +15,4 @@ public static InternalConditionLibrary DefaultInternalConditionLibrary_TM59() return ActiveSetting.Setting.GetValue(AnalyticalSettingParameter.DefaultInternalConditionLibrary_TM59); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/DefaultInternalConditionTextMap.cs b/SAM/SAM.Analytical/Query/DefaultInternalConditionTextMap.cs index d24ee513c..314a1e242 100644 --- a/SAM/SAM.Analytical/Query/DefaultInternalConditionTextMap.cs +++ b/SAM/SAM.Analytical/Query/DefaultInternalConditionTextMap.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Analytical { @@ -14,4 +17,4 @@ public static TextMap DefaultInternalConditionTextMap() return ActiveSetting.Setting.GetValue(AnalyticalSettingParameter.InternalConditionTextMap); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/DefaultInternalConditionTextMap_TM59.cs b/SAM/SAM.Analytical/Query/DefaultInternalConditionTextMap_TM59.cs index 4e67949c6..147d474ee 100644 --- a/SAM/SAM.Analytical/Query/DefaultInternalConditionTextMap_TM59.cs +++ b/SAM/SAM.Analytical/Query/DefaultInternalConditionTextMap_TM59.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Analytical { @@ -14,4 +17,4 @@ public static TextMap DefaultInternalConditionTextMap_TM59() return ActiveSetting.Setting?.GetValue(AnalyticalSettingParameter.InternalConditionTextMap_TM59); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/DefaultMergeSettings.cs b/SAM/SAM.Analytical/Query/DefaultMergeSettings.cs index 51cb40a2b..b99981bbf 100644 --- a/SAM/SAM.Analytical/Query/DefaultMergeSettings.cs +++ b/SAM/SAM.Analytical/Query/DefaultMergeSettings.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -7,4 +10,4 @@ public static MergeSettings DefaultMergeSettings() return ActiveSetting.Setting.GetValue(AnalyticalSettingParameter.DefaultMergeSettings); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/DefaultNCMNameCollection.cs b/SAM/SAM.Analytical/Query/DefaultNCMNameCollection.cs index d2ef50b18..181def9cb 100644 --- a/SAM/SAM.Analytical/Query/DefaultNCMNameCollection.cs +++ b/SAM/SAM.Analytical/Query/DefaultNCMNameCollection.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -7,4 +10,4 @@ public static NCMNameCollection DefaultNCMNameCollection() return ActiveSetting.Setting.GetValue(AnalyticalSettingParameter.DefaultNCMNameCollection); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/DefaultPath.cs b/SAM/SAM.Analytical/Query/DefaultPath.cs index 842824911..e7dbf779e 100644 --- a/SAM/SAM.Analytical/Query/DefaultPath.cs +++ b/SAM/SAM.Analytical/Query/DefaultPath.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Reflection; namespace SAM.Analytical @@ -9,7 +12,7 @@ public static string DefaultPath(this Setting setting, AnalyticalSettingParamete { if (setting == null) return null; - + string fileName; if (!setting.TryGetValue(analyticalSettingParameter, out fileName) || string.IsNullOrWhiteSpace(fileName)) return null; @@ -24,4 +27,4 @@ public static string DefaultPath(this Setting setting, AnalyticalSettingParamete return System.IO.Path.Combine(resourcesDirectory, fileName); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/DefaultProfileLibrary_TM59.cs b/SAM/SAM.Analytical/Query/DefaultProfileLibrary_TM59.cs index e53e16e39..ee4066d88 100644 --- a/SAM/SAM.Analytical/Query/DefaultProfileLibrary_TM59.cs +++ b/SAM/SAM.Analytical/Query/DefaultProfileLibrary_TM59.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -12,4 +15,4 @@ public static ProfileLibrary DefaultProfileLibrary_TM59() return ActiveSetting.Setting.GetValue(AnalyticalSettingParameter.DefaultProfileLibrary_TM59); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/DefaultSystemTypeLibrary.cs b/SAM/SAM.Analytical/Query/DefaultSystemTypeLibrary.cs index 6d5ea7be0..8b3898c69 100644 --- a/SAM/SAM.Analytical/Query/DefaultSystemTypeLibrary.cs +++ b/SAM/SAM.Analytical/Query/DefaultSystemTypeLibrary.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Analytical { @@ -14,4 +17,4 @@ public static SystemTypeLibrary DefaultSystemTypeLibrary() return ActiveSetting.Setting.GetValue(AnalyticalSettingParameter.DefaultSystemTypeLibrary); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/DesignHeatingLoad.cs b/SAM/SAM.Analytical/Query/DesignHeatingLoad.cs index b68c22a0e..bca887d71 100644 --- a/SAM/SAM.Analytical/Query/DesignHeatingLoad.cs +++ b/SAM/SAM.Analytical/Query/DesignHeatingLoad.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Analytical @@ -9,7 +12,7 @@ public static double DesignHeatingLoad(this AdjacencyCluster adjacencyCluster, Z { if (adjacencyCluster == null || zoneSimulationResult == null) return double.NaN; - + return DesignHeatingLoad(adjacencyCluster, adjacencyCluster.GetRelatedObjects(zoneSimulationResult)?.FirstOrDefault()); } @@ -21,7 +24,7 @@ public static double DesignHeatingLoad(this AdjacencyCluster adjacencyCluster, Z return double.NaN; double result = 0; - foreach(Space space in spaces) + foreach (Space space in spaces) { if (space == null) continue; @@ -35,4 +38,4 @@ public static double DesignHeatingLoad(this AdjacencyCluster adjacencyCluster, Z return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Difference.cs b/SAM/SAM.Analytical/Query/Difference.cs index 2e660b7f0..35bbedb9a 100644 --- a/SAM/SAM.Analytical/Query/Difference.cs +++ b/SAM/SAM.Analytical/Query/Difference.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Object.Spatial; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -10,18 +13,18 @@ public static partial class Query { public static List Difference(this Panel panel, IEnumerable face3DObjects, double tolerance_Angle = Tolerance.Angle, double tolerance_Distance = Tolerance.Distance) where T : IFace3DObject { - if(panel == null || face3DObjects == null) + if (panel == null || face3DObjects == null) { return null; } - if(face3DObjects.Count() == 0) + if (face3DObjects.Count() == 0) { return new List() { panel.Clone() }; } Face3D face3D = panel.GetFace3D(); - if(face3D == null) + if (face3D == null) { return new List() { panel.Clone() }; } @@ -29,17 +32,17 @@ public static List Difference(this Panel panel, IEnumerable face3DO BoundingBox3D boundingBox3D = face3D.GetBoundingBox(); List face3Ds = new List(); - foreach(T face3DObject in face3DObjects) + foreach (T face3DObject in face3DObjects) { Face3D face3D_Face3DObject = face3DObject?.Face3D; - if(face3D_Face3DObject == null) + if (face3D_Face3DObject == null) { continue; } BoundingBox3D boundingBox3D_Face3DObject = face3D_Face3DObject.GetBoundingBox(); - if(!boundingBox3D.InRange(boundingBox3D_Face3DObject, tolerance_Distance)) + if (!boundingBox3D.InRange(boundingBox3D_Face3DObject, tolerance_Distance)) { continue; } @@ -47,7 +50,7 @@ public static List Difference(this Panel panel, IEnumerable face3DO face3Ds.Add(face3D_Face3DObject); } - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return new List() { panel.Clone() }; } @@ -55,20 +58,20 @@ public static List Difference(this Panel panel, IEnumerable face3DO List result = new List(); List face3Ds_Difference = Geometry.Spatial.Query.Difference(face3D, face3Ds, tolerance_Angle, tolerance_Distance); - if(face3Ds_Difference == null || face3Ds_Difference.Count == 0) + if (face3Ds_Difference == null || face3Ds_Difference.Count == 0) { return result; } - foreach(Face3D face3D_Difference in face3Ds_Difference) + foreach (Face3D face3D_Difference in face3Ds_Difference) { - if(face3D_Difference == null) + if (face3D_Difference == null) { continue; } Panel panel_New = Create.Panel(System.Guid.NewGuid(), panel, face3D_Difference, panel.Apertures); - if(panel_New != null) + if (panel_New != null) { result.Add(panel_New); } @@ -78,4 +81,4 @@ public static List Difference(this Panel panel, IEnumerable face3DO } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/DuplicatedSpacesDictionary.cs b/SAM/SAM.Analytical/Query/DuplicatedSpacesDictionary.cs index 663cc57e5..766d98265 100644 --- a/SAM/SAM.Analytical/Query/DuplicatedSpacesDictionary.cs +++ b/SAM/SAM.Analytical/Query/DuplicatedSpacesDictionary.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -18,7 +21,7 @@ public static Dictionary> DuplicatedSpacesDictionary(this Adj Dictionary dictionary = new Dictionary(); - foreach(Space space in spaces) + foreach (Space space in spaces) { Shell shell = adjacencyCluster.Shell(space); if (shell == null) @@ -54,4 +57,4 @@ public static Dictionary> DuplicatedSpacesDictionary(this Adj return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/EmitterCategory.cs b/SAM/SAM.Analytical/Query/EmitterCategory.cs index 199aeaf11..bc47121bc 100644 --- a/SAM/SAM.Analytical/Query/EmitterCategory.cs +++ b/SAM/SAM.Analytical/Query/EmitterCategory.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -7,7 +10,7 @@ public static EmitterCategory EmitterCategory(this EmitterType emitterType) if (emitterType == EmitterType.Undefined) return Analytical.EmitterCategory.Undefined; - switch(emitterType) + switch (emitterType) { case EmitterType.AirConditioning_Heating: case EmitterType.WarmAirHeater: @@ -44,4 +47,4 @@ public static EmitterCategory EmitterCategory(this EmitterType emitterType) return Analytical.EmitterCategory.Undefined; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/EmitterTypes.cs b/SAM/SAM.Analytical/Query/EmitterTypes.cs index 1ba5451b1..6bcc685a4 100644 --- a/SAM/SAM.Analytical/Query/EmitterTypes.cs +++ b/SAM/SAM.Analytical/Query/EmitterTypes.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -18,4 +21,4 @@ public static List EmitterTypes(this EmitterCategory emitterCategor return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/ExposedToSun.cs b/SAM/SAM.Analytical/Query/ExposedToSun.cs index e7c5d8828..404e67062 100644 --- a/SAM/SAM.Analytical/Query/ExposedToSun.cs +++ b/SAM/SAM.Analytical/Query/ExposedToSun.cs @@ -1,4 +1,7 @@ - +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + + namespace SAM.Analytical { public static partial class Query @@ -20,4 +23,4 @@ public static bool ExposedToSun(this PanelType panelType) } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Extend.cs b/SAM/SAM.Analytical/Query/Extend.cs index 5947a0673..577ccc50c 100644 --- a/SAM/SAM.Analytical/Query/Extend.cs +++ b/SAM/SAM.Analytical/Query/Extend.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -69,8 +72,8 @@ public static Panel Extend(this Panel panel, IEnumerable panels, double t if (segment2Ds_Panel == null || segment2Ds_Panel.Count == 0) return null; - List segment2Ds = new List(); - for(int i = 0; i < segment2Ds_Panel.Count; i++) + List segment2Ds = new List(); + for (int i = 0; i < segment2Ds_Panel.Count; i++) { Segment2D segment2D = segment2Ds_Panel[i]; @@ -80,7 +83,7 @@ public static Panel Extend(this Panel panel, IEnumerable panels, double t if (vector2D_1 != null) segment2D = new Segment2D(segment2D[0].GetMoved(vector2D_1), segment2D[1]); - if(vector2D_2 != null) + if (vector2D_2 != null) segment2D = new Segment2D(segment2D[0], segment2D[1].GetMoved(vector2D_2)); segment2Ds.Add(segment2D); @@ -135,10 +138,10 @@ public static List Extend(this IEnumerable panels_ToBeExtended, IE panels_Temp.Add(panel_Temp); } - List planes = panels_Temp.ConvertAll(x => x.Plane); + List planes = panels_Temp.ConvertAll(x => x.Plane); List panels_Cut = new List(); - foreach(Panel panel in panels_Temp) + foreach (Panel panel in panels_Temp) { List panels_Cut_Temp = panel.Cut(planes, tolerance); if (panels_Cut_Temp == null || panels_Cut_Temp.Count == 0) @@ -152,12 +155,12 @@ public static List Extend(this IEnumerable panels_ToBeExtended, IE Vector3D vector3D = Vector3D.WorldZ.GetNegated(); List result = new List(); - foreach(Panel panel in panels_Cut) + foreach (Panel panel in panels_Cut) { Point3D point3D = panel.GetInternalPoint3D(); bool remove = false; - for(int i=0; i < face3Ds.Count; i++) + for (int i = 0; i < face3Ds.Count; i++) { Face3D face3D = face3Ds[i]; if (face3D == null) @@ -171,7 +174,7 @@ public static List Extend(this IEnumerable panels_ToBeExtended, IE if (point3D_Intersection == null) continue; - if(point3D.Z > point3D_Intersection.Z && System.Math.Abs(point3D.Z - point3D_Intersection.Z) > tolerance) + if (point3D.Z > point3D_Intersection.Z && System.Math.Abs(point3D.Z - point3D_Intersection.Z) > tolerance) { remove = true; break; @@ -186,7 +189,7 @@ public static List Extend(this IEnumerable panels_ToBeExtended, IE return result; } - + public static Panel Extend(this Panel panel, Plane plane, double snapTolerance = Core.Tolerance.MacroDistance, double tolerance = Core.Tolerance.Distance) { if (plane == null) @@ -221,7 +224,7 @@ public static Panel Extend(this Panel panel, Plane plane, double snapTolerance = List point3Ds_Projected = point3Ds.ConvertAll(x => line3D.Project(x)); List segment2Ds = new List(); - for(int i =0; i < point3Ds.Count; i++) + for (int i = 0; i < point3Ds.Count; i++) { if (point3Ds[i] == null || point3Ds_Projected[i] == null) continue; @@ -266,4 +269,4 @@ public static Panel Extend(this Panel panel, Plane plane, double snapTolerance = return new Panel(panel.Guid, panel, new Face3D(plane_Panel.Convert(polygon2D))); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/External.cs b/SAM/SAM.Analytical/Query/External.cs index 165650930..2ca0039d1 100644 --- a/SAM/SAM.Analytical/Query/External.cs +++ b/SAM/SAM.Analytical/Query/External.cs @@ -1,10 +1,13 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { public static bool External(this PanelType panelType) { - switch(panelType) + switch (panelType) { case Analytical.PanelType.CurtainWall: case Analytical.PanelType.FloorExposed: @@ -23,4 +26,4 @@ public static bool External(this PanelType panelType) } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/ExternalConstructionLayer.cs b/SAM/SAM.Analytical/Query/ExternalConstructionLayer.cs index 9bb926001..1b6653a6f 100644 --- a/SAM/SAM.Analytical/Query/ExternalConstructionLayer.cs +++ b/SAM/SAM.Analytical/Query/ExternalConstructionLayer.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Analytical @@ -19,4 +22,4 @@ public static ConstructionLayer ExternalConstructionLayer(this Panel panel) return ExternalConstructionLayer(panel?.Construction); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/ExternalConstructionLayerDictionary.cs b/SAM/SAM.Analytical/Query/ExternalConstructionLayerDictionary.cs index 1a77a9a19..4d9fbecda 100644 --- a/SAM/SAM.Analytical/Query/ExternalConstructionLayerDictionary.cs +++ b/SAM/SAM.Analytical/Query/ExternalConstructionLayerDictionary.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Analytical @@ -12,7 +15,7 @@ public static Dictionary ExternalConstructionLayerDict return null; Dictionary result = new Dictionary(); - foreach(IPanel panel in panels) + foreach (IPanel panel in panels) { Panel panel_Temp = adjacencyCluster.GetObject(panel.Guid); if (panel_Temp == null) @@ -25,4 +28,4 @@ public static Dictionary ExternalConstructionLayerDict return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/ExternalMaterial.cs b/SAM/SAM.Analytical/Query/ExternalMaterial.cs index 4f5ef2908..d65c65b82 100644 --- a/SAM/SAM.Analytical/Query/ExternalMaterial.cs +++ b/SAM/SAM.Analytical/Query/ExternalMaterial.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Analytical { @@ -22,4 +25,4 @@ public static IMaterial ExternalMaterial(this Panel panel, MaterialLibrary mater } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/ExternalMaterialDictionary.cs b/SAM/SAM.Analytical/Query/ExternalMaterialDictionary.cs index 242bb2cbf..5511911ea 100644 --- a/SAM/SAM.Analytical/Query/ExternalMaterialDictionary.cs +++ b/SAM/SAM.Analytical/Query/ExternalMaterialDictionary.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Analytical @@ -21,4 +24,4 @@ public static Dictionary ExternalMaterialDictionary(this Space return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/ExternalPanels.cs b/SAM/SAM.Analytical/Query/ExternalPanels.cs index 2f4b9efc9..d26ae7de9 100644 --- a/SAM/SAM.Analytical/Query/ExternalPanels.cs +++ b/SAM/SAM.Analytical/Query/ExternalPanels.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -22,14 +25,14 @@ public static List ExternalPanels(this IEnumerable panels, double if (panels == null) return null; - Plane plane = Plane.WorldXY.GetMoved(new Vector3D(0 , 0, elevation)) as Plane; + Plane plane = Plane.WorldXY.GetMoved(new Vector3D(0, 0, elevation)) as Plane; Dictionary> dictionary = panels.SectionDictionary(plane, tolerance_Distance); List segment2Ds = new List(); - foreach(KeyValuePair> keyValuePair in dictionary) + foreach (KeyValuePair> keyValuePair in dictionary) { - foreach(ISegmentable2D segmentable2D in keyValuePair.Value) + foreach (ISegmentable2D segmentable2D in keyValuePair.Value) { segment2Ds.AddRange(segmentable2D.GetSegments()); } @@ -38,7 +41,7 @@ public static List ExternalPanels(this IEnumerable panels, double segment2Ds = segment2Ds.Split(tolerance_Distance); List polygon2Ds = segment2Ds.ExternalPolygon2Ds(snapTolerance, tolerance_Distance); - if(polygon2Ds == null || polygon2Ds.Count == 0) + if (polygon2Ds == null || polygon2Ds.Count == 0) { return null; } @@ -54,14 +57,14 @@ public static List ExternalPanels(this IEnumerable panels, double HashSet guids = new HashSet(); - foreach(KeyValuePair> keyValuePair in dictionary) + foreach (KeyValuePair> keyValuePair in dictionary) { List segment2Ds_Split = new List(); foreach (ISegmentable2D segmentable2D in keyValuePair.Value) { List segment2Ds_Temp = segmentable2D.GetSegments(); - foreach(Segment2D segment2D_Temp in segment2Ds_Temp) + foreach (Segment2D segment2D_Temp in segment2Ds_Temp) { List segment2Ds_Split_Temp = segment2Ds.FindAll(x => segment2D_Temp.On(x.Mid(), tolerance_Distance)); if (segment2Ds_Split_Temp != null) @@ -73,26 +76,26 @@ public static List ExternalPanels(this IEnumerable panels, double BoundingBox3D boundingBox3D = panel.GetBoundingBox(); Plane plane_Bottom = Plane.WorldXY.GetMoved(new Vector3D(0, 0, boundingBox3D.Min.Z)) as Plane; - foreach (Segment2D segment2D in segment2Ds_Split) + foreach (Segment2D segment2D in segment2Ds_Split) { - if(segment2D == null || segment2D.GetLength() <= snapTolerance) + if (segment2D == null || segment2D.GetLength() <= snapTolerance) { continue; } - + Point2D point2D = segment2D.Mid(); List panels_Temp = null; Polygon2D polygon2D = polygon2Ds.Find(x => x.On(point2D, snapTolerance)); - if(polygon2D != null) + if (polygon2D != null) { panels_Temp = result; } else { polygon2D = polygon2Ds.Find(x => x.Inside(point2D, snapTolerance)); - if(polygon2D != null) + if (polygon2D != null) { panels_Temp = internalPanels; } @@ -102,7 +105,7 @@ public static List ExternalPanels(this IEnumerable panels, double } } - if(panels_Temp == null) + if (panels_Temp == null) { continue; } @@ -122,4 +125,4 @@ public static List ExternalPanels(this IEnumerable panels, double } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/ExternalPanelsArea.cs b/SAM/SAM.Analytical/Query/ExternalPanelsArea.cs index 3daa50c1c..97539a25a 100644 --- a/SAM/SAM.Analytical/Query/ExternalPanelsArea.cs +++ b/SAM/SAM.Analytical/Query/ExternalPanelsArea.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -14,14 +17,14 @@ public static double ExternalPanelsArea(this AdjacencyCluster adjacencyCluster, return double.NaN; double result = 0; - foreach(Panel panel in panels) + foreach (Panel panel in panels) { if (panel == null) continue; if (exposedToSunOnly && !adjacencyCluster.ExposedToSun(panel)) continue; - + double area = panel.GetArea(); if (double.IsNaN(area) || area == 0) continue; @@ -32,4 +35,4 @@ public static double ExternalPanelsArea(this AdjacencyCluster adjacencyCluster, return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/ExternalVector3D.cs b/SAM/SAM.Analytical/Query/ExternalVector3D.cs index 3047f1503..f3fb28e4a 100644 --- a/SAM/SAM.Analytical/Query/ExternalVector3D.cs +++ b/SAM/SAM.Analytical/Query/ExternalVector3D.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; namespace SAM.Analytical @@ -9,7 +12,7 @@ public static Vector3D ExternalVector3D(this AdjacencyCluster adjacencyCluster, { if (adjacencyCluster == null || panel == null || space == null) return null; - + List panels = adjacencyCluster.GetRelatedObjects(space); if (panels.Find(x => x.Guid == panel.Guid) == null) return null; @@ -25,4 +28,4 @@ public static Vector3D ExternalVector3D(this AdjacencyCluster adjacencyCluster, return shell.Normal(face3D.InternalPoint3D(), true, silverSpacing, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Extrusion.cs b/SAM/SAM.Analytical/Query/Extrusion.cs index 69148c375..31f4649d7 100644 --- a/SAM/SAM.Analytical/Query/Extrusion.cs +++ b/SAM/SAM.Analytical/Query/Extrusion.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Analytical { @@ -56,9 +59,9 @@ public static Extrusion Extrusion(this Panel panel, double tolernace = Core.Tole vector3D_Extrusion = normal * thickness; face3D_Extrusion = face3D; - + break; - + case Analytical.PanelGroup.Roof: if (!normal.SameHalf(Vector3D.WorldZ)) @@ -68,7 +71,7 @@ public static Extrusion Extrusion(this Panel panel, double tolernace = Core.Tole face3D_Extrusion = face3D; break; - + default: bool rectangular = Geometry.Planar.Query.Rectangular(externalEdge2D, out Geometry.Planar.Rectangle2D rectangle2D, tolernace); @@ -107,4 +110,4 @@ public static Extrusion Extrusion(this Panel panel, double tolernace = Core.Tole return new Extrusion(face3D_Extrusion, vector3D_Extrusion); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Fill.cs b/SAM/SAM.Analytical/Query/Fill.cs index ceceaaddf..70b27d2ae 100644 --- a/SAM/SAM.Analytical/Query/Fill.cs +++ b/SAM/SAM.Analytical/Query/Fill.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -8,22 +11,22 @@ public static partial class Query { public static List Fill(this Face3D face3D, IEnumerable panels, double offset = 0.1, double tolerance_Area = Core.Tolerance.MacroDistance, double tolerance_Distance = Core.Tolerance.Distance) { - if(face3D == null || panels == null) + if (face3D == null || panels == null) { return null; } List> tuples_Panel = new List>(); - foreach(Panel panel in panels) + foreach (Panel panel in panels) { Face3D face3D_Panel = panel?.GetFace3D(); - if(face3D_Panel == null) + if (face3D_Panel == null) { continue; } Point3D point3D = face3D_Panel.InternalPoint3D(tolerance_Distance); - if(point3D == null) + if (point3D == null) { continue; } @@ -32,41 +35,41 @@ public static List Fill(this Face3D face3D, IEnumerable panels, do } List result = new List(); - if(tuples_Panel == null || tuples_Panel.Count == 0) + if (tuples_Panel == null || tuples_Panel.Count == 0) { return result; } List face3Ds = Geometry.Spatial.Query.Fill(face3D, tuples_Panel.ConvertAll(x => x.Item2), offset, tolerance_Area, tolerance_Distance); - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return result; } - foreach(Face3D face3D_Temp in face3Ds) + foreach (Face3D face3D_Temp in face3Ds) { Plane plane = face3D_Temp.GetPlane(); - if(plane == null) + if (plane == null) { continue; } BoundingBox3D boundingBox3D = face3D_Temp.GetBoundingBox(); - if(boundingBox3D == null) + if (boundingBox3D == null) { continue; } List> tuples_Distance = new List>(); - foreach(Tuple tuple in tuples_Panel) + foreach (Tuple tuple in tuples_Panel) { Point3D point3D = plane.Project(tuple.Item3); - if(point3D == null) + if (point3D == null) { continue; } - if(!boundingBox3D.InRange(point3D, tolerance_Distance) || !face3D_Temp.Inside(point3D, tolerance_Distance)) + if (!boundingBox3D.InRange(point3D, tolerance_Distance) || !face3D_Temp.Inside(point3D, tolerance_Distance)) { continue; } @@ -74,19 +77,19 @@ public static List Fill(this Face3D face3D, IEnumerable panels, do tuples_Distance.Add(new Tuple(tuple.Item1, tuple.Item3.Distance(point3D))); } - if(tuples_Distance == null || tuples_Distance.Count == 0) + if (tuples_Distance == null || tuples_Distance.Count == 0) { continue; } - if(tuples_Distance.Count > 1) + if (tuples_Distance.Count > 1) { tuples_Distance.Sort((x, y) => x.Item2.CompareTo(y.Item2)); } Panel panel = tuples_Distance[0].Item1; panel = Create.Panel(panel.Guid, panel, face3D_Temp); - if(panel != null) + if (panel != null) { result.Add(panel); } @@ -95,4 +98,4 @@ public static List Fill(this Face3D face3D, IEnumerable panels, do return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/FillFloorsAndRoofs.cs b/SAM/SAM.Analytical/Query/FillFloorsAndRoofs.cs index e26ebe2e5..8e46b65df 100644 --- a/SAM/SAM.Analytical/Query/FillFloorsAndRoofs.cs +++ b/SAM/SAM.Analytical/Query/FillFloorsAndRoofs.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -85,7 +88,7 @@ public static List FillFloorsAndRoofs(this IEnumerable panels, dou { closed2Ds.ForEach(x => face2Ds.Add(new Face2D(x))); } - + List> tuples = new List>(); foreach (Panel panel in tuple_Elevation.Item2) { @@ -121,7 +124,7 @@ public static List FillFloorsAndRoofs(this IEnumerable panels, dou double area = face2D.GetArea(); - for (int i =0; i < tuples_Temp.Count; i++) + for (int i = 0; i < tuples_Temp.Count; i++) { List face2Ds_Intersection = face2D.Intersection(tuples_Temp[i].Item2, tolerance); if (face2Ds_Intersection == null || face2Ds_Intersection.Count == 0) @@ -155,9 +158,9 @@ public static List FillFloorsAndRoofs(this IEnumerable panels, dou } } - for(int i=0; i < tuples.Count; i++) + for (int i = 0; i < tuples.Count; i++) { - if(!indexes.Contains(i)) + if (!indexes.Contains(i)) { result.Add(tuples[i].Item4); continue; @@ -176,4 +179,4 @@ public static List FillFloorsAndRoofs(this IEnumerable panels, dou return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Filter.cs b/SAM/SAM.Analytical/Query/Filter.cs index 16ed442ea..304ee0379 100644 --- a/SAM/SAM.Analytical/Query/Filter.cs +++ b/SAM/SAM.Analytical/Query/Filter.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System; using System.Collections.Generic; using System.Linq; @@ -7,9 +10,9 @@ namespace SAM.Analytical { public static partial class Query { - public static List Filter(this AdjacencyCluster adjacencyCluster, IFilter filter, IEnumerable jSAMObjects = null) where T: IJSAMObject + public static List Filter(this AdjacencyCluster adjacencyCluster, IFilter filter, IEnumerable jSAMObjects = null) where T : IJSAMObject { - if(adjacencyCluster == null || filter == null) + if (adjacencyCluster == null || filter == null) { return null; } @@ -18,10 +21,10 @@ public static List Filter(this AdjacencyCluster adjacencyCluster, IFilter Modify.AssignAdjacencyCluster(filter, adjacencyCluster); - if(jSAMObjects != null) + if (jSAMObjects != null) { List> tuples = jSAMObjects.ToList().ConvertAll(x => x as SAMObject).FindAll(x => x != null).ConvertAll(x => new Tuple(x.GetType(), x.Guid)); - if(tuples != null) + if (tuples != null) { for (int i = jSAMObjects_Filtering.Count - 1; i >= 0; i--) { @@ -31,9 +34,9 @@ public static List Filter(this AdjacencyCluster adjacencyCluster, IFilter continue; } - if(tuples.Find(x => x.Item1 == sAMObject.GetType() && x.Item2 == sAMObject.Guid) == null) + if (tuples.Find(x => x.Item1 == sAMObject.GetType() && x.Item2 == sAMObject.Guid) == null) { - if(!jSAMObjects.Contains(jSAMObjects_Filtering[i])) + if (!jSAMObjects.Contains(jSAMObjects_Filtering[i])) { jSAMObjects_Filtering.RemoveAt(i); } @@ -44,7 +47,7 @@ public static List Filter(this AdjacencyCluster adjacencyCluster, IFilter jSAMObjects_Filtering.RemoveAll(x => !(x is SAMObject)); } - if(jSAMObjects_Filtering.Count == 0) + if (jSAMObjects_Filtering.Count == 0) { return new List(); } @@ -54,7 +57,7 @@ public static List Filter(this AdjacencyCluster adjacencyCluster, IFilter public static ConstructionManager Filter(this ConstructionManager constructionManager, IEnumerable constructions = null, IEnumerable apertureConstructions = null, bool removeUnusedMaterials = false) { - if(constructionManager == null) + if (constructionManager == null) { return null; } @@ -70,14 +73,14 @@ public static ConstructionManager Filter(this ConstructionManager constructionMa List constructions_All = result.Constructions; if (constructions_All != null) { - foreach(Construction construction in constructions_All) + foreach (Construction construction in constructions_All) { - if(construction == null) + if (construction == null) { continue; } - if(constrcutions_Temp.Find(x => x.Guid == construction.Guid) == null) + if (constrcutions_Temp.Find(x => x.Guid == construction.Guid) == null) { result.Remove(construction); } @@ -102,7 +105,7 @@ public static ConstructionManager Filter(this ConstructionManager constructionMa } } - if(removeUnusedMaterials) + if (removeUnusedMaterials) { result.RemoveUnusedMaterials(); } @@ -111,4 +114,4 @@ public static ConstructionManager Filter(this ConstructionManager constructionMa } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/FilterByElevation.cs b/SAM/SAM.Analytical/Query/FilterByElevation.cs index 33483dcb5..a82e57123 100644 --- a/SAM/SAM.Analytical/Query/FilterByElevation.cs +++ b/SAM/SAM.Analytical/Query/FilterByElevation.cs @@ -1,9 +1,12 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { public static partial class Query - { + { public static List FilterByElevation(this IEnumerable spaces, double elevation, out List spaces_Lower, out List spaces_Upper, double tolerance = Core.Tolerance.Distance) { spaces_Lower = null; @@ -36,4 +39,4 @@ public static List FilterByElevation(this IEnumerable spaces, doub return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/FilteringSAMObjects.cs b/SAM/SAM.Analytical/Query/FilteringSAMObjects.cs index 1e8fdd82a..52b0326fb 100644 --- a/SAM/SAM.Analytical/Query/FilteringSAMObjects.cs +++ b/SAM/SAM.Analytical/Query/FilteringSAMObjects.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -8,7 +11,7 @@ public static partial class Query { public static List FilteringSAMObjects(this AdjacencyCluster adjacencyCluster) { - if(adjacencyCluster == null) + if (adjacencyCluster == null) { return null; } @@ -16,7 +19,7 @@ public static List FilteringSAMObjects(this AdjacencyCluster adjace List result = new List(); List panels = adjacencyCluster.GetObjects(); - if(panels != null) + if (panels != null) { result.AddRange(panels); } @@ -30,14 +33,14 @@ public static List FilteringSAMObjects(this AdjacencyCluster adjace List apertures_Temp = adjacencyCluster.GetObjects(); if (apertures_Temp != null) { - foreach(Aperture aperture in apertures_Temp) + foreach (Aperture aperture in apertures_Temp) { - if(aperture == null) + if (aperture == null) { continue; } - if(apertures.Find(x => x.Guid == aperture.Guid) != null) + if (apertures.Find(x => x.Guid == aperture.Guid) != null) { continue; } @@ -62,4 +65,4 @@ public static List FilteringSAMObjects(this AdjacencyCluster adjace } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/FindSimilar.cs b/SAM/SAM.Analytical/Query/FindSimilar.cs index 1e4270fbf..935d403b6 100644 --- a/SAM/SAM.Analytical/Query/FindSimilar.cs +++ b/SAM/SAM.Analytical/Query/FindSimilar.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -91,4 +94,4 @@ public static List FindSimilar return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/FirstConstructionLayer.cs b/SAM/SAM.Analytical/Query/FirstConstructionLayer.cs index 97ef707a0..9c7575bb0 100644 --- a/SAM/SAM.Analytical/Query/FirstConstructionLayer.cs +++ b/SAM/SAM.Analytical/Query/FirstConstructionLayer.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Analytical { @@ -23,4 +26,4 @@ public static ConstructionLayer FirstConstructionLayer(this Panel panel, Vector3 return ExternalConstructionLayer(construction); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/FirstMaterial.cs b/SAM/SAM.Analytical/Query/FirstMaterial.cs index 0571dc587..9ca030e53 100644 --- a/SAM/SAM.Analytical/Query/FirstMaterial.cs +++ b/SAM/SAM.Analytical/Query/FirstMaterial.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Spatial; namespace SAM.Analytical @@ -17,4 +20,4 @@ public static IMaterial FirstMaterial(this Panel panel, Vector3D direction, Mate return Material(constructionLayer, materialLibrary); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Fit.cs b/SAM/SAM.Analytical/Query/Fit.cs index 4aea31bff..2068b04dd 100644 --- a/SAM/SAM.Analytical/Query/Fit.cs +++ b/SAM/SAM.Analytical/Query/Fit.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System; using System.Collections.Generic; using System.Linq; @@ -16,13 +19,13 @@ public static Aperture Fit(this Aperture aperture, Face3D face3D, double areaFac } Plane plane = face3D.GetPlane(); - if(plane == null) + if (plane == null) { return null; } Face3D face3D_Aperture = aperture.GetFace3D(); - if(face3D_Aperture == null) + if (face3D_Aperture == null) { return null; } @@ -31,7 +34,7 @@ public static Aperture Fit(this Aperture aperture, Face3D face3D, double areaFac Geometry.Planar.Face2D face2D_Aperture = plane.Convert(face3D_Aperture); Geometry.Planar.ISegmentable2D segmentable2D = face2D.ExternalEdge2D as Geometry.Planar.ISegmentable2D; - if(segmentable2D == null) + if (segmentable2D == null) { throw new NotImplementedException(); } @@ -39,13 +42,13 @@ public static Aperture Fit(this Aperture aperture, Face3D face3D, double areaFac double area = face2D_Aperture.GetArea(); List face2Ds_Difference = Geometry.Planar.Query.Difference(face2D_Aperture, face2D, tolerance); - if(face2Ds_Difference == null || face2Ds_Difference.Count == 0) + if (face2Ds_Difference == null || face2Ds_Difference.Count == 0) { return null; } double area_Difference = face2Ds_Difference.ConvertAll(x => x.GetArea()).Sum(); - if(area_Difference <= tolerance || area_Difference >= (areaFactor * area)) + if (area_Difference <= tolerance || area_Difference >= (areaFactor * area)) { return null; } @@ -58,7 +61,7 @@ public static Aperture Fit(this Aperture aperture, Face3D face3D, double areaFac Geometry.Planar.Vector2D vector2D_Y = null; foreach (Geometry.Planar.Point2D point2D in boundingBox2D.GetPoints()) { - if(face2D.Inside(point2D, tolerance) || face2D.On(point2D, tolerance)) + if (face2D.Inside(point2D, tolerance) || face2D.On(point2D, tolerance)) { continue; } @@ -87,13 +90,13 @@ public static Aperture Fit(this Aperture aperture, Face3D face3D, double areaFac } - if(vector2D_X == null && vector2D_Y == null) + if (vector2D_X == null && vector2D_Y == null) { return null; } vector2D = new Geometry.Planar.Vector2D(vector2D_X == null ? 0 : vector2D_X.X, vector2D_Y == null ? 0 : vector2D_Y.Y); - if(vector2D.Length <= tolerance) + if (vector2D.Length <= tolerance) { return null; } @@ -115,10 +118,10 @@ public static Aperture Fit(this Aperture aperture, Face3D face3D, double areaFac return null; } - + public static Aperture Fit(this Aperture aperture, IEnumerable panels, double areaFactor = 0.5, double maxDistance = Core.Tolerance.MacroDistance, double tolerance = Core.Tolerance.Distance) { - if(aperture == null || panels == null) + if (aperture == null || panels == null) { return null; } @@ -148,12 +151,12 @@ public static Aperture Fit(this Aperture aperture, IEnumerable panels, do apertures.Add(aperture_Temp); } - if(apertures == null || apertures.Count == 0) + if (apertures == null || apertures.Count == 0) { return null; } - if(apertures.Count == 1) + if (apertures.Count == 1) { return apertures[0]; } @@ -164,10 +167,10 @@ public static Aperture Fit(this Aperture aperture, IEnumerable panels, do return tuples.FirstOrDefault()?.Item2; } - + public static List Fit(this IEnumerable apertures, IEnumerable panels, double areaFactor = 0.5, double maxDistance = Core.Tolerance.MacroDistance, double tolerance = Core.Tolerance.Distance) { - if(apertures == null || panels == null) + if (apertures == null || panels == null) { return null; } @@ -190,4 +193,4 @@ public static List Fit(this IEnumerable apertures, IEnumerab return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/FixEdges.cs b/SAM/SAM.Analytical/Query/FixEdges.cs index 824120e81..10c63c228 100644 --- a/SAM/SAM.Analytical/Query/FixEdges.cs +++ b/SAM/SAM.Analytical/Query/FixEdges.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -29,10 +32,10 @@ public static AdjacencyCluster FixEdges(this AdjacencyCluster adjacencyCluster, panelsList[i] = panels[i].FixEdges(cutApertures, tolerance); }); - for(int i=0; i < panels.Count; i++) + for (int i = 0; i < panels.Count; i++) { List panels_Temp = panelsList[i]; - if(panels_Temp == null || panels_Temp.Count == 0) + if (panels_Temp == null || panels_Temp.Count == 0) { continue; } @@ -60,22 +63,22 @@ public static AdjacencyCluster FixEdges(this AdjacencyCluster adjacencyCluster, return result; } - + public static List FixEdges(this IPanel panel, bool cutApertures = false, double tolerance = Core.Tolerance.Distance) { - if(panel == null) + if (panel == null) { return null; } List face3Ds = panel is Panel ? ((Panel)panel).GetFace3Ds(cutApertures) : new List() { panel.Face3D }; - if(face3Ds == null) + if (face3Ds == null) { return null; } List face3Ds_Temp = new List(); - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { List face3Ds_face3D = face3D.FixEdges(tolerance); if (face3Ds_face3D == null) @@ -89,25 +92,25 @@ public static List FixEdges(this IPanel panel, bool cutApertures = false face3Ds = face3Ds_Temp; List result = new List(); - foreach(Face3D face3D_Temp in face3Ds) + foreach (Face3D face3D_Temp in face3Ds) { System.Guid guid = panel.Guid; - while(result.Find(x => x.Guid == guid) != null) + while (result.Find(x => x.Guid == guid) != null) { guid = System.Guid.NewGuid(); } IPanel panel_New = null; - if(panel is Panel) + if (panel is Panel) { panel_New = Create.Panel(guid, (Panel)panel, face3D_Temp, null, true, tolerance, tolerance); } - else if(panel is ExternalPanel) + else if (panel is ExternalPanel) { panel_New = new ExternalPanel(guid, panel as ExternalPanel, face3D_Temp); } - if(panel_New != null) + if (panel_New != null) { result.Add(panel_New); } @@ -116,4 +119,4 @@ public static List FixEdges(this IPanel panel, bool cutApertures = false return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/FrameApertureConstructionUniqueName.cs b/SAM/SAM.Analytical/Query/FrameApertureConstructionUniqueName.cs index 1bbb4e8d0..43e643219 100644 --- a/SAM/SAM.Analytical/Query/FrameApertureConstructionUniqueName.cs +++ b/SAM/SAM.Analytical/Query/FrameApertureConstructionUniqueName.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -15,4 +18,4 @@ public static string FrameApertureConstructionUniqueName(string name) return string.Format("{0} -frame", name); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/GeometricalFloorPanels.cs b/SAM/SAM.Analytical/Query/GeometricalFloorPanels.cs index 568eebd7d..71b509f99 100644 --- a/SAM/SAM.Analytical/Query/GeometricalFloorPanels.cs +++ b/SAM/SAM.Analytical/Query/GeometricalFloorPanels.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; namespace SAM.Analytical @@ -15,7 +18,7 @@ public static List GeomericalFloorPanels(this AdjacencyCluster adjacencyC return null; List result = new List(); - foreach(KeyValuePair keyValuePair in dictionary) + foreach (KeyValuePair keyValuePair in dictionary) { Vector3D vector3D = keyValuePair.Value; if (vector3D == null) @@ -41,4 +44,4 @@ public static List GeomericalFloorPanels(this AdjacencyCluster adjacencyC return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/GrashofNumber.cs b/SAM/SAM.Analytical/Query/GrashofNumber.cs index 7270829a5..7dda3ed97 100644 --- a/SAM/SAM.Analytical/Query/GrashofNumber.cs +++ b/SAM/SAM.Analytical/Query/GrashofNumber.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Analytical { @@ -35,4 +38,4 @@ public static double GrashofNumber(this FluidMaterial fluidMaterial, double temp return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Ground.cs b/SAM/SAM.Analytical/Query/Ground.cs index 68f5c1ccb..07fc59f4e 100644 --- a/SAM/SAM.Analytical/Query/Ground.cs +++ b/SAM/SAM.Analytical/Query/Ground.cs @@ -1,10 +1,13 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { public static bool Ground(this PanelType panelType) { - switch(panelType) + switch (panelType) { case Analytical.PanelType.SlabOnGrade: case Analytical.PanelType.UndergroundWall: @@ -16,4 +19,4 @@ public static bool Ground(this PanelType panelType) } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/HasMaterial.cs b/SAM/SAM.Analytical/Query/HasMaterial.cs index 83d619333..4d7e5a4da 100644 --- a/SAM/SAM.Analytical/Query/HasMaterial.cs +++ b/SAM/SAM.Analytical/Query/HasMaterial.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Analytical @@ -19,7 +22,7 @@ public static bool HasMaterial(this IEnumerable constructionL if (string.IsNullOrWhiteSpace(name)) return false; - foreach(ConstructionLayer constructionLayer in constructionLayers) + foreach (ConstructionLayer constructionLayer in constructionLayers) { if (name.Equals(constructionLayer?.Name)) return true; @@ -53,4 +56,4 @@ public static bool HasMaterial(this IEnumerable constructionL return false; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/HeatTransferCoefficient.cs b/SAM/SAM.Analytical/Query/HeatTransferCoefficient.cs index e3f9defb2..891dcbbb3 100644 --- a/SAM/SAM.Analytical/Query/HeatTransferCoefficient.cs +++ b/SAM/SAM.Analytical/Query/HeatTransferCoefficient.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Analytical { @@ -42,4 +45,4 @@ public static double HeatTransferCoefficient(this FluidMaterial fluidMaterial, d return HeatTransferCoefficient(fluidMaterial, 15, width, 283, angle); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/HeatingDesignDay.cs b/SAM/SAM.Analytical/Query/HeatingDesignDay.cs index 678c7189e..f988a7e18 100644 --- a/SAM/SAM.Analytical/Query/HeatingDesignDay.cs +++ b/SAM/SAM.Analytical/Query/HeatingDesignDay.cs @@ -1,4 +1,7 @@ -using SAM.Weather; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Weather; using System; using System.Collections.Generic; @@ -51,4 +54,4 @@ public static DesignDay HeatingDesignDay(this WeatherData weatherData) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/HeatingDesignRelativeHumidity.cs b/SAM/SAM.Analytical/Query/HeatingDesignRelativeHumidity.cs index dbc7bcc24..524d6361f 100644 --- a/SAM/SAM.Analytical/Query/HeatingDesignRelativeHumidity.cs +++ b/SAM/SAM.Analytical/Query/HeatingDesignRelativeHumidity.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -25,4 +28,4 @@ public static double HeatingDesignRelativeHumidity(this InternalCondition intern return profile == null ? double.NaN : profile.MinValue; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/HeatingDesignTemperature.cs b/SAM/SAM.Analytical/Query/HeatingDesignTemperature.cs index e413c1800..149deb49f 100644 --- a/SAM/SAM.Analytical/Query/HeatingDesignTemperature.cs +++ b/SAM/SAM.Analytical/Query/HeatingDesignTemperature.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -25,4 +28,4 @@ public static double HeatingDesignTemperature(this InternalCondition internalCon return profile == null ? double.NaN : profile.MaxValue; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Height.cs b/SAM/SAM.Analytical/Query/Height.cs index bcdc05cb5..16bf3342f 100644 --- a/SAM/SAM.Analytical/Query/Height.cs +++ b/SAM/SAM.Analytical/Query/Height.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using SAM.Geometry.Spatial; namespace SAM.Analytical @@ -33,7 +36,7 @@ public static double Height(this PlanarBoundary3D planarBoundary3D) Plane plane = Plane.WorldXY; - if(plane.Coplanar(planarBoundary3D.Plane)) + if (plane.Coplanar(planarBoundary3D.Plane)) return rectangle2D.Height; Vector3D vector3D_WidthDirection = plane.Convert(rectangle2D.WidthDirection); @@ -73,4 +76,4 @@ public static double Height(this PlanarBoundary3D planarBoundary3D) //return rectangle2D.Height; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/IJSAMObjects.cs b/SAM/SAM.Analytical/Query/IJSAMObjects.cs new file mode 100644 index 000000000..461166ffd --- /dev/null +++ b/SAM/SAM.Analytical/Query/IJSAMObjects.cs @@ -0,0 +1,114 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; +using System.Collections.Generic; + +namespace SAM.Analytical +{ + public static partial class Query + { + public static List IJSAMObjects(this CaseSelection caseSelection, AnalyticalModel analyticalModel) where TJSAMObject : IJSAMObject + { + if (caseSelection is null || analyticalModel is null) + { + return null; + } + + + if (caseSelection is ObjectReferenceCaseSelection objectReferenceCaseSelection) + { + return IJSAMObjects(objectReferenceCaseSelection, analyticalModel); + } + else if (caseSelection is SAMObjectCaseSelection sAMObjectCaseSelection) + { + + } + else if (caseSelection is FilterSelection filterSelection) + { + return IJSAMObjects(filterSelection, analyticalModel); + } + + throw new System.NotImplementedException(); + + } + + public static List IJSAMObjects(this ObjectReferenceCaseSelection objectReferenceCaseSelection, AnalyticalModel analyticalModel) where TJSAMObject : IJSAMObject + { + if (objectReferenceCaseSelection is null || analyticalModel is null) + { + return null; + } + + List result = []; + + if (objectReferenceCaseSelection.ObjectReferences is not IEnumerable objectReferences) + { + return result; + } + + foreach (ObjectReference objectReference in objectReferences) + { + TJSAMObject jSAMObject = analyticalModel.GetObject(objectReference); + if (jSAMObject is null) + { + continue; + } + + result.Add(jSAMObject); + } + + return result; + } + + public static List IJSAMObjects(this SAMObjectCaseSelection sAMObjectCaseSelection, AnalyticalModel analyticalModel) where TJSAMObject : IJSAMObject + { + if (sAMObjectCaseSelection is null || analyticalModel is null) + { + return null; + } + + List result = []; + + if (sAMObjectCaseSelection.Objects is not IEnumerable sAMObjects) + { + return result; + } + + foreach (IJSAMObject jSAMObject in sAMObjects) + { + if (jSAMObject is TJSAMObject jSAMObject_Temp) + { + result.Add(jSAMObject_Temp); + } + } + + return result; + } + + public static List IJSAMObjects(this ApertureCaseSelection apertureCaseSelection, AnalyticalModel analyticalModel) where TJSAMObject : IJSAMObject + { + if (apertureCaseSelection is null || analyticalModel is null) + { + return null; + } + + List result = []; + + if (apertureCaseSelection.Objects is not IEnumerable apertures) + { + return result; + } + + foreach (Aperture aperture in apertures) + { + if (aperture is TJSAMObject jSAMObject_Temp) + { + result.Add(jSAMObject_Temp); + } + } + + return result; + } + } +} diff --git a/SAM/SAM.Analytical/Query/Id.cs b/SAM/SAM.Analytical/Query/Id.cs index b55003493..1463f9476 100644 --- a/SAM/SAM.Analytical/Query/Id.cs +++ b/SAM/SAM.Analytical/Query/Id.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Analytical { @@ -6,7 +9,7 @@ public static partial class Query { public static string Id(this FlowClassification flowClassification, Direction direction) { - if(flowClassification == FlowClassification.Undefined || direction == Direction.Undefined) + if (flowClassification == FlowClassification.Undefined || direction == Direction.Undefined) { return null; } @@ -14,4 +17,4 @@ public static string Id(this FlowClassification flowClassification, Direction di return string.Format("{0} {1}", flowClassification.Description(), direction.Description()); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/InRange.cs b/SAM/SAM.Analytical/Query/InRange.cs index 433200f7c..dadd97078 100644 --- a/SAM/SAM.Analytical/Query/InRange.cs +++ b/SAM/SAM.Analytical/Query/InRange.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; namespace SAM.Analytical @@ -13,15 +16,15 @@ public static List InRange(this IEnumerable spaces, Shell shell, d } List result = new List(); - foreach(Space space in spaces) + foreach (Space space in spaces) { Point3D point3D = space?.Location; - if(point3D == null) + if (point3D == null) { continue; } - if(shell.InRange(point3D, tolerance)) + if (shell.InRange(point3D, tolerance)) { result.Add(space); } @@ -31,4 +34,4 @@ public static List InRange(this IEnumerable spaces, Shell shell, d return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Inside.cs b/SAM/SAM.Analytical/Query/Inside.cs index b0c6ade60..d05ff2d1d 100644 --- a/SAM/SAM.Analytical/Query/Inside.cs +++ b/SAM/SAM.Analytical/Query/Inside.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; namespace SAM.Analytical @@ -19,21 +22,21 @@ public static bool Inside(this AdjacencyCluster adjacencyCluster, Space space, P public static List Inside(IEnumerable spaces, Shell shell, double silverSpacing = Core.Tolerance.MacroDistance, double tolerance = Core.Tolerance.Distance) { - if(spaces == null || shell == null) + if (spaces == null || shell == null) { return null; } List result = new List(); - foreach(Space space in spaces) + foreach (Space space in spaces) { Point3D point3D = space?.Location; - if(point3D == null) + if (point3D == null) { continue; } - if(shell.Inside(point3D, silverSpacing, tolerance)) + if (shell.Inside(point3D, silverSpacing, tolerance)) { result.Add(space); } @@ -42,4 +45,4 @@ public static List Inside(IEnumerable spaces, Shell shell, double return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Internal.cs b/SAM/SAM.Analytical/Query/Internal.cs index f60ad51b9..6c1336f60 100644 --- a/SAM/SAM.Analytical/Query/Internal.cs +++ b/SAM/SAM.Analytical/Query/Internal.cs @@ -1,10 +1,13 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { public static bool Internal(this PanelType panelType) { - switch(panelType) + switch (panelType) { case Analytical.PanelType.FloorInternal: case Analytical.PanelType.Air: @@ -18,4 +21,4 @@ public static bool Internal(this PanelType panelType) } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/InternalConditionParameter.cs b/SAM/SAM.Analytical/Query/InternalConditionParameter.cs index 9f32f87ae..83e3d1f76 100644 --- a/SAM/SAM.Analytical/Query/InternalConditionParameter.cs +++ b/SAM/SAM.Analytical/Query/InternalConditionParameter.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -46,4 +49,4 @@ public static partial class Query return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/InternalConstructionLayer.cs b/SAM/SAM.Analytical/Query/InternalConstructionLayer.cs index 9e183d561..3aa1e83c4 100644 --- a/SAM/SAM.Analytical/Query/InternalConstructionLayer.cs +++ b/SAM/SAM.Analytical/Query/InternalConstructionLayer.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Analytical @@ -21,4 +24,4 @@ public static ConstructionLayer InternalConstructionLayer(this Panel panel) } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/InternalConstructionLayerDictionary.cs b/SAM/SAM.Analytical/Query/InternalConstructionLayerDictionary.cs index 882b0ac84..df40cfcfb 100644 --- a/SAM/SAM.Analytical/Query/InternalConstructionLayerDictionary.cs +++ b/SAM/SAM.Analytical/Query/InternalConstructionLayerDictionary.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Analytical @@ -12,7 +15,7 @@ public static Dictionary InternalConstructionLayerDict return null; Dictionary result = new Dictionary(); - foreach(IPanel panel in panels) + foreach (IPanel panel in panels) { Panel panel_Temp = adjacencyCluster.GetObject(panel.Guid); if (panel_Temp == null) @@ -25,4 +28,4 @@ public static Dictionary InternalConstructionLayerDict return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/InternalMaterial.cs b/SAM/SAM.Analytical/Query/InternalMaterial.cs index 96d71f444..2aa545400 100644 --- a/SAM/SAM.Analytical/Query/InternalMaterial.cs +++ b/SAM/SAM.Analytical/Query/InternalMaterial.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Analytical { @@ -21,4 +24,4 @@ public static IMaterial InternalMaterial(this Panel panel, MaterialLibrary mater return InternalMaterial(panel?.Construction, materialLibrary); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/InternalMaterialDictionary.cs b/SAM/SAM.Analytical/Query/InternalMaterialDictionary.cs index 399ab1eb1..98192ee63 100644 --- a/SAM/SAM.Analytical/Query/InternalMaterialDictionary.cs +++ b/SAM/SAM.Analytical/Query/InternalMaterialDictionary.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Analytical @@ -21,4 +24,4 @@ public static Dictionary InternalMaterialDictionary(this Space return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/IsMechanicalVentilation.cs b/SAM/SAM.Analytical/Query/IsMechanicalVentilation.cs index 846b337eb..dc52ed7a6 100644 --- a/SAM/SAM.Analytical/Query/IsMechanicalVentilation.cs +++ b/SAM/SAM.Analytical/Query/IsMechanicalVentilation.cs @@ -1,16 +1,19 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { public static bool IsMechanicalVentilation(this VentilationSystem ventilationSystem) { - if(ventilationSystem == null) + if (ventilationSystem == null) { return false; } MechanicalSystemType mechanicalSystemType = ventilationSystem?.Type; - if(!string.IsNullOrWhiteSpace(mechanicalSystemType?.Name)) + if (!string.IsNullOrWhiteSpace(mechanicalSystemType?.Name)) { return IsMechanicalVentilation(mechanicalSystemType.Name); } @@ -25,7 +28,7 @@ public static bool IsMechanicalVentilation(this VentilationSystemType ventilatio public static bool IsMechanicalVentilation(string name) { - if(string.IsNullOrWhiteSpace(name)) + if (string.IsNullOrWhiteSpace(name)) { return false; } @@ -40,4 +43,4 @@ public static bool IsMechanicalVentilation(string name) return false; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/IsPerimeter.cs b/SAM/SAM.Analytical/Query/IsPerimeter.cs index 428160ecf..c183648d2 100644 --- a/SAM/SAM.Analytical/Query/IsPerimeter.cs +++ b/SAM/SAM.Analytical/Query/IsPerimeter.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Analytical @@ -7,19 +10,19 @@ public static partial class Query { public static bool IsPerimeter(this AdjacencyCluster adjacencyCluster, Space space, bool apertureCheck = true, IEnumerable panelGroups = null) { - if(adjacencyCluster == null || space == null) + if (adjacencyCluster == null || space == null) { return false; } Space space_Temp = adjacencyCluster.GetObject(space.Guid); - if(space_Temp == null) + if (space_Temp == null) { return false; } List panels = adjacencyCluster.GetPanels(space_Temp); - if(panels == null || panels.Count == 0) + if (panels == null || panels.Count == 0) { return false; } @@ -31,11 +34,11 @@ public static bool IsPerimeter(this AdjacencyCluster adjacencyCluster, Space spa continue; } - if(panelGroups != null && !panelGroups.Contains(panel.PanelGroup)) + if (panelGroups != null && !panelGroups.Contains(panel.PanelGroup)) { continue; } - + if (apertureCheck) { List apertures = panel.Apertures; @@ -53,4 +56,4 @@ public static bool IsPerimeter(this AdjacencyCluster adjacencyCluster, Space spa } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/IsValid.cs b/SAM/SAM.Analytical/Query/IsValid.cs index f84a18d77..5febff78d 100644 --- a/SAM/SAM.Analytical/Query/IsValid.cs +++ b/SAM/SAM.Analytical/Query/IsValid.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Analytical { @@ -63,4 +66,4 @@ public static bool IsValid(this Panel panel, Aperture aperture, double tolerance // return true; //} } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/LastConstructionLayer.cs b/SAM/SAM.Analytical/Query/LastConstructionLayer.cs index 1a351effa..d715792a2 100644 --- a/SAM/SAM.Analytical/Query/LastConstructionLayer.cs +++ b/SAM/SAM.Analytical/Query/LastConstructionLayer.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Analytical { @@ -23,4 +26,4 @@ public static ConstructionLayer LastConstructionLayer(this Panel panel, Vector3D return InternalConstructionLayer(construction); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/LoadType.cs b/SAM/SAM.Analytical/Query/LoadType.cs index af1766107..2a2bf12c6 100644 --- a/SAM/SAM.Analytical/Query/LoadType.cs +++ b/SAM/SAM.Analytical/Query/LoadType.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -46,4 +49,4 @@ public static LoadType LoadType(this AdjacencyClusterSimulationResult adjacencyC return Core.Query.Enum(text); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Material.cs b/SAM/SAM.Analytical/Query/Material.cs index 38451af3c..583aee09c 100644 --- a/SAM/SAM.Analytical/Query/Material.cs +++ b/SAM/SAM.Analytical/Query/Material.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Analytical { @@ -12,4 +15,4 @@ public static IMaterial Material(this ConstructionLayer constructionLayer, Mater return materialLibrary.GetObject(constructionLayer.Name); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/MaterialType.cs b/SAM/SAM.Analytical/Query/MaterialType.cs index ada44c9eb..38b76a5de 100644 --- a/SAM/SAM.Analytical/Query/MaterialType.cs +++ b/SAM/SAM.Analytical/Query/MaterialType.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Analytical @@ -16,13 +19,13 @@ public static MaterialType MaterialType(this IEnumerable cons foreach (ConstructionLayer constructionLayer in constructionLayers) { IMaterial material = constructionLayer.Material(materialLibrary); - if(material == null) + if (material == null) { return Core.MaterialType.Undefined; } MaterialType materialType = material.MaterialType(); - if(materialType == Core.MaterialType.Undefined) + if (materialType == Core.MaterialType.Undefined) { return Core.MaterialType.Undefined; } @@ -30,7 +33,7 @@ public static MaterialType MaterialType(this IEnumerable cons materialTypes.Add(materialType); } - if(materialTypes.Contains(Core.MaterialType.Opaque)) + if (materialTypes.Contains(Core.MaterialType.Opaque)) { return Core.MaterialType.Opaque; } @@ -48,4 +51,4 @@ public static MaterialType MaterialType(this IEnumerable cons return Core.MaterialType.Undefined; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Materials.cs b/SAM/SAM.Analytical/Query/Materials.cs index 04b2a1b51..ac351fcd5 100644 --- a/SAM/SAM.Analytical/Query/Materials.cs +++ b/SAM/SAM.Analytical/Query/Materials.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System; using System.Collections.Generic; @@ -104,10 +107,10 @@ public static IEnumerable Materials(this Construction construction, M return null; List result = new List(); - foreach(ConstructionLayer constructionLayer in constructionLayers) + foreach (ConstructionLayer constructionLayer in constructionLayers) { Material material = constructionLayer.Material(materialLibrary) as Material; - if(material != null) + if (material != null) { if (materialType == Core.MaterialType.Undefined || materialType == material.MaterialType) result.Add(material); @@ -169,7 +172,7 @@ public static IEnumerable Materials(this ApertureConstruction apertur /// /// /// - public static IEnumerable Materials(this Construction construction, MaterialLibrary materialLibrary) where T: IMaterial + public static IEnumerable Materials(this Construction construction, MaterialLibrary materialLibrary) where T : IMaterial { if (construction == null || materialLibrary == null) return null; @@ -189,4 +192,4 @@ public static IEnumerable Materials(this Construction construction, Materi return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/MaxIndoorComfortTemperatures.cs b/SAM/SAM.Analytical/Query/MaxIndoorComfortTemperatures.cs index 5a60f0ef4..727b697fd 100644 --- a/SAM/SAM.Analytical/Query/MaxIndoorComfortTemperatures.cs +++ b/SAM/SAM.Analytical/Query/MaxIndoorComfortTemperatures.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Weather; using System.Collections.Generic; using System.Linq; @@ -15,7 +18,7 @@ public static List MaxIndoorComfortTemperatures(this WeatherYear weather public static List MaxIndoorComfortTemperatures(this WeatherYear weatherYear, TM52BuildingCategory tM52BuildingCategory, double acceptableTemperatureDifference = double.NaN) { List weatherDays = weatherYear?.WeatherDays; - if(weatherDays == null || weatherDays.Count == 0) + if (weatherDays == null || weatherDays.Count == 0) { return null; } @@ -25,7 +28,7 @@ public static List MaxIndoorComfortTemperatures(this WeatherYear weather public static List MaxIndoorComfortTemperatures(this IEnumerable weatherDays, TM52BuildingCategory tM52BuildingCategory, int startDayIndex, int endDayIndex, double acceptableTemperatureDifference = double.NaN) { - if(weatherDays == null || weatherDays.Count() == 0) + if (weatherDays == null || weatherDays.Count() == 0) { return null; } @@ -58,4 +61,4 @@ public static List MaxIndoorComfortTemperatures(this IEnumerable x.Thickness).Sum(); } @@ -34,4 +37,4 @@ public static double MaxThickness(this ApertureConstruction apertureConstruction return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/MechanicalSystemCategory.cs b/SAM/SAM.Analytical/Query/MechanicalSystemCategory.cs index bc80aa474..807f2a2be 100644 --- a/SAM/SAM.Analytical/Query/MechanicalSystemCategory.cs +++ b/SAM/SAM.Analytical/Query/MechanicalSystemCategory.cs @@ -1,15 +1,18 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { public static MechanicalSystemCategory MechanicalSystemCategory(this MechanicalSystem mechanicalSystem) { - if(mechanicalSystem == null) + if (mechanicalSystem == null) { return Analytical.MechanicalSystemCategory.Undefined; } - if(mechanicalSystem is CoolingSystem) + if (mechanicalSystem is CoolingSystem) { return Analytical.MechanicalSystemCategory.Cooling; } @@ -77,4 +80,4 @@ public static MechanicalSystemCategory MechanicalSystemCategory() where T : M return Analytical.MechanicalSystemCategory.Other; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/MechanicalSystemTypes.cs b/SAM/SAM.Analytical/Query/MechanicalSystemTypes.cs index 0c5fa564b..2dadd227d 100644 --- a/SAM/SAM.Analytical/Query/MechanicalSystemTypes.cs +++ b/SAM/SAM.Analytical/Query/MechanicalSystemTypes.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -6,13 +9,13 @@ public static partial class Query { public static List MechanicalSystemTypes(this Core.SystemTypeLibrary systemTypeLibrary, MechanicalSystemCategory mechanicalSystemCategory) { - if(systemTypeLibrary == null) + if (systemTypeLibrary == null) { return null; } List result = systemTypeLibrary.GetSystemTypes(); - if(result == null || result.Count == 0) + if (result == null || result.Count == 0) { return result; } @@ -21,7 +24,7 @@ public static List MechanicalSystemTypes(this Core.SystemT { for (int i = result.Count - 1; i >= 0; i--) { - if(result[i].MechanicalSystemCategory() == mechanicalSystemCategory) + if (result[i].MechanicalSystemCategory() == mechanicalSystemCategory) { continue; } @@ -33,4 +36,4 @@ public static List MechanicalSystemTypes(this Core.SystemT return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/MechanicalSystems.cs b/SAM/SAM.Analytical/Query/MechanicalSystems.cs index bc575295c..4acd9ac69 100644 --- a/SAM/SAM.Analytical/Query/MechanicalSystems.cs +++ b/SAM/SAM.Analytical/Query/MechanicalSystems.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -6,7 +9,7 @@ public static partial class Query { public static List MechanicalSystems(this AdjacencyCluster adjacencyCluster, Space space) { - if(adjacencyCluster == null || space == null) + if (adjacencyCluster == null || space == null) { return null; } @@ -16,7 +19,7 @@ public static List MechanicalSystems(this AdjacencyCluster adj return result; } - public static List MechanicalSystems(this AdjacencyCluster adjacencyCluster, Space space) where T: MechanicalSystem + public static List MechanicalSystems(this AdjacencyCluster adjacencyCluster, Space space) where T : MechanicalSystem { if (adjacencyCluster == null || space == null) { @@ -29,7 +32,7 @@ public static List MechanicalSystems(this AdjacencyCluster adjacencyCluste public static List MechanicalSystems(this AdjacencyCluster adjacencyCluster, Space space, MechanicalSystemCategory mechanicalSystemCategory) { List mechanicalSystems = MechanicalSystems(adjacencyCluster, space); - if(mechanicalSystems == null || mechanicalSystems.Count == 0) + if (mechanicalSystems == null || mechanicalSystems.Count == 0) { return null; } @@ -37,4 +40,4 @@ public static List MechanicalSystems(this AdjacencyCluster adj return mechanicalSystems.FindAll(x => x.MechanicalSystemCategory() == mechanicalSystemCategory); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Merge.cs b/SAM/SAM.Analytical/Query/Merge.cs index c296046f2..704115c58 100644 --- a/SAM/SAM.Analytical/Query/Merge.cs +++ b/SAM/SAM.Analytical/Query/Merge.cs @@ -1,5 +1,7 @@ -using System; -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Analytical { @@ -7,7 +9,7 @@ public static partial class Query { public static AnalyticalModel Merge(this AnalyticalModel analyticalModel, Type type, MergeSettings mergeSettings) { - if(analyticalModel == null || type == null || mergeSettings == null) + if (analyticalModel == null || type == null || mergeSettings == null) { return null; } @@ -18,7 +20,7 @@ public static AnalyticalModel Merge(this AnalyticalModel analyticalModel, Type t return null; } - if(Modify.Merge(adjacencyCluster, type, mergeSettings)) + if (Modify.Merge(adjacencyCluster, type, mergeSettings)) { return new AnalyticalModel(analyticalModel, adjacencyCluster); } @@ -26,4 +28,4 @@ public static AnalyticalModel Merge(this AnalyticalModel analyticalModel, Type t return new AnalyticalModel(analyticalModel); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/MergeCoplanarApertures.cs b/SAM/SAM.Analytical/Query/MergeCoplanarApertures.cs index d901a3b3a..ba0f03f1d 100644 --- a/SAM/SAM.Analytical/Query/MergeCoplanarApertures.cs +++ b/SAM/SAM.Analytical/Query/MergeCoplanarApertures.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -37,13 +40,13 @@ public static AdjacencyCluster MergeCoplanarApertures(this AdjacencyCluster adja } List panels = adjacencyCluster.GetPanels(); - if(panels == null || panels.Count == 0) + if (panels == null || panels.Count == 0) { return new AdjacencyCluster(adjacencyCluster); } panels = MergeCoplanarApertures(panels, out mergedApertures, out redundantApertures, validateApertureConstruction, tolerance); - if((mergedApertures != null && mergedApertures.Count > 0) || (redundantApertures != null && redundantApertures.Count > 0)) + if ((mergedApertures != null && mergedApertures.Count > 0) || (redundantApertures != null && redundantApertures.Count > 0)) { AdjacencyCluster result = new AdjacencyCluster(adjacencyCluster); foreach (Panel panel in panels) @@ -63,23 +66,23 @@ public static List MergeCoplanarApertures(this IEnumerable panels, mergedApertures = null; redundantApertures = null; - if(panels == null) + if (panels == null) { return null; } List result = new List(); - foreach(Panel panel in panels) + foreach (Panel panel in panels) { List mergedApertures_Panel = null; List redundantApertures_Panel = null; - Panel panel_Temp = panel?.MergeCoplanarApertures(out mergedApertures_Panel, out redundantApertures_Panel, validateApertureConstruction, tolerance); + Panel panel_Temp = panel?.MergeCoplanarApertures(out mergedApertures_Panel, out redundantApertures_Panel, validateApertureConstruction, tolerance); result.Add(panel_Temp); - if(mergedApertures_Panel != null) + if (mergedApertures_Panel != null) { - if(mergedApertures == null) + if (mergedApertures == null) { mergedApertures = new List(); } @@ -115,7 +118,7 @@ public static Panel MergeCoplanarApertures(this Panel panel, out List Panel result = Create.Panel(panel); List apertures = panel.Apertures; - if(apertures == null || apertures.Count < 2) + if (apertures == null || apertures.Count < 2) { return result; } @@ -123,14 +126,14 @@ public static Panel MergeCoplanarApertures(this Panel panel, out List apertures.RemoveAll(x => x == null); List> apertures_Group = new List>(); - if(validateApertureConstruction) + if (validateApertureConstruction) { List guids = new List(); - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { Guid guid = aperture.TypeGuid; int index = guids.IndexOf(guid); - if(index == -1) + if (index == -1) { guids.Add(guid); apertures_Group.Add(new List() { aperture }); @@ -149,39 +152,39 @@ public static Panel MergeCoplanarApertures(this Panel panel, out List Plane plane = panel.Plane; HashSet guids_ToBeRemoved = new HashSet(); - foreach(List apertures_Temp in apertures_Group) + foreach (List apertures_Temp in apertures_Group) { - if(apertures_Temp.Count < 2) + if (apertures_Temp.Count < 2) { continue; } Dictionary dictionary = new Dictionary(); - foreach(Aperture aperture_Temp in apertures_Temp) + foreach (Aperture aperture_Temp in apertures_Temp) { dictionary[aperture_Temp] = plane.Convert(plane.Project(aperture_Temp.GetFace3D())); } List face2Ds = Geometry.Planar.Query.Union(dictionary.Values, tolerance); - if(face2Ds == null || face2Ds.Count == 0) + if (face2Ds == null || face2Ds.Count == 0) { continue; } - foreach(Face2D face2D in face2Ds) + foreach (Face2D face2D in face2Ds) { BoundingBox2D boundingBox2D = face2D.GetBoundingBox(); List apertures_Face2D = new List(); - foreach(KeyValuePair keyValuePair in dictionary) + foreach (KeyValuePair keyValuePair in dictionary) { Point2D point2D = keyValuePair.Value.GetInternalPoint2D(tolerance); - if(!boundingBox2D.InRange(point2D, tolerance)) + if (!boundingBox2D.InRange(point2D, tolerance)) { continue; } - if(!face2D.Inside(point2D, tolerance)) + if (!face2D.Inside(point2D, tolerance)) { continue; } @@ -189,14 +192,14 @@ public static Panel MergeCoplanarApertures(this Panel panel, out List apertures_Face2D.Add(keyValuePair.Key); } - if(apertures_Face2D.Count <= 1) + if (apertures_Face2D.Count <= 1) { continue; } apertures_Face2D.ForEach(x => guids_ToBeRemoved.Add(x.Guid)); - if(mergedApertures == null) + if (mergedApertures == null) { mergedApertures = new List(); } @@ -213,19 +216,19 @@ public static Panel MergeCoplanarApertures(this Panel panel, out List } } - if(guids_ToBeRemoved != null && guids_ToBeRemoved.Count != 0) + if (guids_ToBeRemoved != null && guids_ToBeRemoved.Count != 0) { - foreach(Guid guid in guids_ToBeRemoved) + foreach (Guid guid in guids_ToBeRemoved) { result.RemoveAperture(guid); } } - if(mergedApertures != null && mergedApertures.Count != 0) + if (mergedApertures != null && mergedApertures.Count != 0) { for (int i = mergedApertures.Count - 1; i >= 0; i--) { - if(!result.AddAperture(mergedApertures[i])) + if (!result.AddAperture(mergedApertures[i])) { mergedApertures.RemoveAt(i); } @@ -235,4 +238,4 @@ public static Panel MergeCoplanarApertures(this Panel panel, out List return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/MergeCoplanarPanels.cs b/SAM/SAM.Analytical/Query/MergeCoplanarPanels.cs index bc4168cd5..c63f0f4dc 100644 --- a/SAM/SAM.Analytical/Query/MergeCoplanarPanels.cs +++ b/SAM/SAM.Analytical/Query/MergeCoplanarPanels.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System; @@ -13,7 +16,7 @@ public static List MergeCoplanarPanels(this IEnumerable panels, do { if (panels == null) return null; - + List redundantPanels = new List(); if (validatePanelGroup) @@ -73,7 +76,7 @@ public static AdjacencyCluster MergeCoplanarPanels(this AdjacencyCluster adjacen { result.Remove(redundantPanels); } - + if (mergedPanels != null && mergedPanels.Count != 0) { @@ -118,14 +121,14 @@ private static List MergeCoplanarPanels(this List panels, double o List panels_Offset = new List(); foreach (Panel panel_Temp in panels_Temp) { - if(validateConstruction) + if (validateConstruction) { Construction construction_Temp = panel_Temp.Construction; Construction construction = panel.Construction; if (construction_Temp != null && construction != null) { - if(!(string.IsNullOrEmpty(construction_Temp.Name) && string.IsNullOrEmpty(construction.Name))) + if (!(string.IsNullOrEmpty(construction_Temp.Name) && string.IsNullOrEmpty(construction.Name))) { if (!construction_Temp.Name.Equals(construction.Name)) continue; @@ -242,4 +245,4 @@ private static List MergeCoplanarPanels(this List panels, double o return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/MergeCoplanarPanelsBySpace.cs b/SAM/SAM.Analytical/Query/MergeCoplanarPanelsBySpace.cs index bf864abd7..5073de56b 100644 --- a/SAM/SAM.Analytical/Query/MergeCoplanarPanelsBySpace.cs +++ b/SAM/SAM.Analytical/Query/MergeCoplanarPanelsBySpace.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Analytical @@ -7,7 +10,7 @@ public static partial class Query { public static AdjacencyCluster MergeCoplanarPanelsBySpace(this AdjacencyCluster adjacencyCluster, double offset, ref List redundantPanels, bool validateConstruction = true, bool validatePanelGroup = true, double minArea = Core.Tolerance.MacroDistance, double tolerance = Core.Tolerance.Distance) { - if(adjacencyCluster == null) + if (adjacencyCluster == null) { return null; } @@ -15,12 +18,12 @@ public static AdjacencyCluster MergeCoplanarPanelsBySpace(this AdjacencyCluster AdjacencyCluster result = new AdjacencyCluster(adjacencyCluster); List spaces = adjacencyCluster.GetSpaces(); - if(spaces == null || spaces.Count == 0) + if (spaces == null || spaces.Count == 0) { return result; } - foreach(Space space in spaces) + foreach (Space space in spaces) { List panels = adjacencyCluster?.GetPanels(space); if (panels == null || panels.Count == 0) @@ -29,42 +32,42 @@ public static AdjacencyCluster MergeCoplanarPanelsBySpace(this AdjacencyCluster } List, List>> tuples = new List, List>>(); - foreach(Panel panel in panels) + foreach (Panel panel in panels) { List spaces_Panel = adjacencyCluster.GetSpaces(panel); List guids = spaces_Panel?.ConvertAll(x => x.Guid); - if(guids == null) + if (guids == null) { guids = new List(); } Tuple, List> tuple = tuples.Find(x => x.Item1.Count == guids.Count && x.Item1.TrueForAll(y => guids.Contains(y))); - if(tuple == null) + if (tuple == null) { tuple = new Tuple, List>(guids, new List()); tuples.Add(tuple); } int index = tuple.Item2.FindIndex(x => x.Guid == panel.Guid); - if(index == -1) + if (index == -1) { tuple.Item2.Add(panel); } } - if(tuples == null || tuples.Count == 0) + if (tuples == null || tuples.Count == 0) { continue; } - foreach(Tuple, List> tuple in tuples) + foreach (Tuple, List> tuple in tuples) { - if(tuple.Item2 == null || tuple.Item2.Count < 2) + if (tuple.Item2 == null || tuple.Item2.Count < 2) { continue; } - + List mergedPanels = null; List redundantPanels_Temp = new List(); @@ -85,7 +88,7 @@ public static AdjacencyCluster MergeCoplanarPanelsBySpace(this AdjacencyCluster if (redundantPanels_Temp != null && redundantPanels_Temp.Count != 0) { result.Remove(redundantPanels_Temp); - if(redundantPanels == null) + if (redundantPanels == null) { redundantPanels = new List(); } @@ -108,4 +111,4 @@ public static AnalyticalModel MergeCoplanarPanelsBySpace(this AnalyticalModel an return new AnalyticalModel(analyticalModel, adjacencyCluster); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/MergeOverlapApertures.cs b/SAM/SAM.Analytical/Query/MergeOverlapApertures.cs index dc4aba448..beaaab9b8 100644 --- a/SAM/SAM.Analytical/Query/MergeOverlapApertures.cs +++ b/SAM/SAM.Analytical/Query/MergeOverlapApertures.cs @@ -1,5 +1,8 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Geometry.Planar; +using SAM.Geometry.Spatial; using System; using System.Collections.Generic; using System.Linq; @@ -10,7 +13,7 @@ public static partial class Query { public static List MergeOverlapApertures(this IEnumerable panels, bool validateConstruction = true, double minArea = Core.Tolerance.MacroDistance, double tolerance = Core.Tolerance.Distance) { - if(panels == null) + if (panels == null) { return null; } @@ -61,17 +64,17 @@ public static Panel MergeOverlapApertures(this Panel panel, bool validateConstru } List> aperturesList = new List>(); - if(validateConstruction) + if (validateConstruction) { Dictionary> dictionary = new Dictionary>(); - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { ApertureConstruction apertureConstruction = aperture.ApertureConstruction; string name = apertureConstruction?.Name; if (name == null) name = string.Empty; - if(!dictionary.TryGetValue(name, out List apertures_Temp)) + if (!dictionary.TryGetValue(name, out List apertures_Temp)) { apertures_Temp = new List(); dictionary[name] = apertures_Temp; @@ -90,17 +93,17 @@ public static Panel MergeOverlapApertures(this Panel panel, bool validateConstru } - foreach(List apertures_Temp in aperturesList) + foreach (List apertures_Temp in aperturesList) { List apertures_Merged = MergeOverlapApertures(apertures_Temp, minArea, tolerance); - if(apertures_Merged == null || apertures_Merged.Count == 0) + if (apertures_Merged == null || apertures_Merged.Count == 0) { continue; } panel_New.RemoveApertures(); - foreach(Aperture aperture_New in apertures_Merged) + foreach (Aperture aperture_New in apertures_Merged) { panel_New.AddAperture(aperture_New); } @@ -112,22 +115,22 @@ public static Panel MergeOverlapApertures(this Panel panel, bool validateConstru public static List MergeOverlapApertures(this IEnumerable apertures, double minArea = Core.Tolerance.MacroDistance, double tolerance = Core.Tolerance.Distance) { - if(apertures == null) + if (apertures == null) { return null; } List> tuples = new List>(); - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { Face3D face3D = aperture?.GetFace3D(); - if(face3D == null || !face3D.IsValid()) + if (face3D == null || !face3D.IsValid()) { continue; } - if(face3D.GetArea() < minArea) + if (face3D.GetArea() < minArea) { continue; } @@ -142,12 +145,12 @@ public static List MergeOverlapApertures(this IEnumerable ap } List result = new List(); - while(tuples.Count != 0) + while (tuples.Count != 0) { Plane plane = tuples[0].Item2.GetPlane(); List> tuples_Coplanar = tuples.FindAll(x => x.Item2.GetPlane().Coplanar(plane, tolerance)); - if(tuples_Coplanar == null || tuples_Coplanar.Count == 0) + if (tuples_Coplanar == null || tuples_Coplanar.Count == 0) { result.Add(tuples[0].Item1); tuples.RemoveAt(0); @@ -156,25 +159,25 @@ public static List MergeOverlapApertures(this IEnumerable ap tuples_Coplanar.ForEach(x => tuples.Remove(x)); - if(tuples_Coplanar.Count == 1) + if (tuples_Coplanar.Count == 1) { result.Add(tuples_Coplanar[0].Item1); continue; } List face2Ds_Union = new List(); - foreach(Tuple tuple in tuples_Coplanar) + foreach (Tuple tuple in tuples_Coplanar) { Face2D face2D = plane.Convert(tuple.Item2); List face2Ds_Intersection = new List() { face2D }; - foreach(Face2D face2D_Union in face2Ds_Union) + foreach (Face2D face2D_Union in face2Ds_Union) { List face2Ds_Intersection_Temp = new List(); foreach (Face2D face2D_Intersection in face2Ds_Intersection) { List face2Ds_Difference = face2D_Intersection.Difference(face2D_Union, tolerance); - if(face2Ds_Difference != null && face2Ds_Difference.Count != 0) + if (face2Ds_Difference != null && face2Ds_Difference.Count != 0) { face2Ds_Intersection_Temp.AddRange(face2Ds_Difference); } @@ -193,7 +196,7 @@ public static List MergeOverlapApertures(this IEnumerable ap } Face3D face3D = plane.Convert(face2D_Intersection); - if(!face3D.IsValid()) + if (!face3D.IsValid()) { continue; } @@ -211,4 +214,4 @@ public static List MergeOverlapApertures(this IEnumerable ap return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/MergeOverlapPanels.cs b/SAM/SAM.Analytical/Query/MergeOverlapPanels.cs index 5a2d0061f..e0914fec0 100644 --- a/SAM/SAM.Analytical/Query/MergeOverlapPanels.cs +++ b/SAM/SAM.Analytical/Query/MergeOverlapPanels.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; using SAM.Geometry.Object.Spatial; using SAM.Geometry.Planar; using SAM.Geometry.Spatial; @@ -55,7 +58,7 @@ public static List MergeOverlapPanels(this IEnumerable panels, dou { if (panel.PanelType != Analytical.PanelType.Air) continue; - + if (panel.Normal.Collinear(Vector3D.WorldZ, tolerance)) panels_Temp_Horizontal.Add(panel); else @@ -79,7 +82,7 @@ public static List MergeOverlapPanels(this IEnumerable panels, dou } } - + foreach (KeyValuePair> keyValuePair in dictionary) if (keyValuePair.Value != null && keyValuePair.Value.Count > 0) @@ -167,7 +170,7 @@ private static List MergeOverlapPanels_Horizontal(this IEnumerable Panel panel = tuple_Temp.Item2; Face3D face3D = panel.GetFace3D(); - foreach(IClosedPlanar3D closedPlanar3D in face3D.GetEdge3Ds()) + foreach (IClosedPlanar3D closedPlanar3D in face3D.GetEdge3Ds()) { ISegmentable3D segmentable3D = closedPlanar3D as ISegmentable3D; if (segmentable3D == null) @@ -180,7 +183,7 @@ private static List MergeOverlapPanels_Horizontal(this IEnumerable Face2D face2D = plane.Convert(face3D); - if(face2D == null || !face2D.IsValid() || face2D.GetArea() < tolerance) + if (face2D == null || !face2D.IsValid() || face2D.GetArea() < tolerance) { continue; } @@ -338,7 +341,7 @@ private static List MergeOverlapPanels_Vertical(this IEnumerable p Face3D face3D = null; - List point2Ds = new List(); //Snap Points <- New Face3Ds will be snapped to these points + List point2Ds = new List(); //Snap Points <- New Face3Ds will be snapped to these points List> tuples_Polygon = new List>(); foreach (Tuple tuple_Face3D in tuples_Face3D) { @@ -381,7 +384,7 @@ private static List MergeOverlapPanels_Vertical(this IEnumerable p List> tuples_Polygon_Contains_Unused = tuples_Polygon_Contains.FindAll(x => !guids.Contains(x.Item2.Guid)); Panel panel_Old = tuples_Polygon_Contains.First().Item2; - if(tuples_Polygon_Contains_Unused.Count != 0) + if (tuples_Polygon_Contains_Unused.Count != 0) panel_Old = tuples_Polygon_Contains_Unused.First().Item2; Polygon polygon_Old = tuples_Polygon_Contains.First().Item1; @@ -441,4 +444,4 @@ private static List MergeOverlapPanels_Vertical(this IEnumerable p return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/MinElevation.cs b/SAM/SAM.Analytical/Query/MinElevation.cs index 784fb2910..dfbadb35f 100644 --- a/SAM/SAM.Analytical/Query/MinElevation.cs +++ b/SAM/SAM.Analytical/Query/MinElevation.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -35,7 +38,7 @@ public static double MinElevation(this IEnumerable panels) return double.NaN; double result = double.MaxValue; - foreach(Panel panel in panels) + foreach (Panel panel in panels) { double minElevation = panel.MinElevation(); if (double.IsNaN(minElevation)) @@ -57,4 +60,4 @@ public static double MinElevation(this Space space, AdjacencyCluster adjacencyCl return MinElevation(panels); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/MinElevationDictionary.cs b/SAM/SAM.Analytical/Query/MinElevationDictionary.cs index 55fd689c2..ffa1a015d 100644 --- a/SAM/SAM.Analytical/Query/MinElevationDictionary.cs +++ b/SAM/SAM.Analytical/Query/MinElevationDictionary.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -13,7 +16,7 @@ public static Dictionary> MinElevationDictionary(this IEnum Dictionary> result = new Dictionary>(); foreach (IPanel panel in panels) - { + { double minElevation = Core.Query.Round(panel.MinElevation(), tolerance); List panels_Elevation = null; @@ -43,10 +46,10 @@ public static Dictionary> MinElevationDictionary(this IEnum if (filterElevations) { panels_Levels = new List(); - foreach(IPanel panel in panels_Temp) + foreach (IPanel panel in panels_Temp) { Panel panel_Temp = panel as Panel; - if(panel_Temp == null) + if (panel_Temp == null) { continue; } @@ -68,7 +71,7 @@ public static Dictionary> MinElevationDictionary(this IEnum if (normal == null) continue; - if(normal.AlmostEqual(Geometry.Spatial.Vector3D.WorldZ) || normal.GetNegated().AlmostEqual(Geometry.Spatial.Vector3D.WorldZ) ) + if (normal.AlmostEqual(Geometry.Spatial.Vector3D.WorldZ) || normal.GetNegated().AlmostEqual(Geometry.Spatial.Vector3D.WorldZ)) { panels_Levels.Add(panel); continue; @@ -108,4 +111,4 @@ public static Dictionary> MinElevationDictionary(this IEnum return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/MinIndoorComfortTemperatures.cs b/SAM/SAM.Analytical/Query/MinIndoorComfortTemperatures.cs index a2edb5d50..48c5558c9 100644 --- a/SAM/SAM.Analytical/Query/MinIndoorComfortTemperatures.cs +++ b/SAM/SAM.Analytical/Query/MinIndoorComfortTemperatures.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Weather; using System.Collections.Generic; using System.Linq; @@ -15,7 +18,7 @@ public static List MinIndoorComfortTemperatures(this WeatherYear weather public static List MinIndoorComfortTemperatures(this WeatherYear weatherYear, TM52BuildingCategory tM52BuildingCategory, double acceptableTemperatureDifference = double.NaN) { List weatherDays = weatherYear?.WeatherDays; - if(weatherDays == null || weatherDays.Count == 0) + if (weatherDays == null || weatherDays.Count == 0) { return null; } @@ -25,7 +28,7 @@ public static List MinIndoorComfortTemperatures(this WeatherYear weather public static List MinIndoorComfortTemperatures(this IEnumerable weatherDays, TM52BuildingCategory tM52BuildingCategory, int startDayIndex, int endDayIndex, double acceptableTemperatureDifference = double.NaN) { - if(weatherDays == null || weatherDays.Count() == 0) + if (weatherDays == null || weatherDays.Count() == 0) { return null; } @@ -58,4 +61,4 @@ public static List MinIndoorComfortTemperatures(this IEnumerable MissingInternalConditionsNames(this AnalyticalModel analyticalModel) { AdjacencyCluster adjacencyCluster = analyticalModel?.AdjacencyCluster; - if(adjacencyCluster == null) + if (adjacencyCluster == null) { return null; } List internalConditions = adjacencyCluster.GetInternalConditions(true, false)?.ToList(); - if(internalConditions == null || internalConditions.Count == 0) + if (internalConditions == null || internalConditions.Count == 0) { return new List(); } HashSet names_Templates = new HashSet(); List internalConditions_Templates = adjacencyCluster.GetInternalConditions(false, true)?.ToList(); - if(internalConditions_Templates != null && internalConditions_Templates.Count != 0) + if (internalConditions_Templates != null && internalConditions_Templates.Count != 0) { - foreach(InternalCondition internalCondition_Template in internalConditions_Templates) + foreach (InternalCondition internalCondition_Template in internalConditions_Templates) { string name = internalCondition_Template?.Name; - if(string.IsNullOrWhiteSpace(name)) + if (string.IsNullOrWhiteSpace(name)) { continue; } @@ -36,15 +39,15 @@ public static List MissingInternalConditionsNames(this AnalyticalModel a } HashSet names = new HashSet(); - foreach(InternalCondition internalCondition in internalConditions) + foreach (InternalCondition internalCondition in internalConditions) { string name = internalCondition?.Name; - if(string.IsNullOrWhiteSpace(name)) + if (string.IsNullOrWhiteSpace(name)) { continue; } - if(names_Templates.Contains(name)) + if (names_Templates.Contains(name)) { continue; } @@ -55,4 +58,4 @@ public static List MissingInternalConditionsNames(this AnalyticalModel a return names.ToList(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/MissingMaterialsNames.cs b/SAM/SAM.Analytical/Query/MissingMaterialsNames.cs index a691315cf..c6f357014 100644 --- a/SAM/SAM.Analytical/Query/MissingMaterialsNames.cs +++ b/SAM/SAM.Analytical/Query/MissingMaterialsNames.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System; using System.Collections.Generic; using System.Linq; @@ -14,7 +17,7 @@ public static List MissingMaterialsNames(this AnalyticalModel analytical public static List MissingMaterialsNames(this AdjacencyCluster adjacencyCluster, MaterialLibrary materialLibrary) { - if(adjacencyCluster == null) + if (adjacencyCluster == null) { return null; } @@ -29,7 +32,7 @@ public static List MissingMaterialsNames(this AdjacencyCluster adjacency public static List MissingMaterialsNames(this MaterialLibrary materialLibrary, IEnumerable constructions) { - if(constructions == null) + if (constructions == null) { return null; } @@ -68,14 +71,14 @@ public static List MissingMaterialsNames(this MaterialLibrary materialLi public static List MissingMaterialsNames(this MaterialLibrary materialLibrary, ApertureConstruction apertureConstruction) { - if(apertureConstruction == null) + if (apertureConstruction == null) { return null; } List constructionLayers_1 = apertureConstruction?.FrameConstructionLayers; List constructionLayers_2 = apertureConstruction?.PaneConstructionLayers; - if(constructionLayers_1 == null && constructionLayers_2 == null) + if (constructionLayers_1 == null && constructionLayers_2 == null) { return null; } @@ -90,22 +93,22 @@ public static List MissingMaterialsNames(this MaterialLibrary materialLi public static List MissingMaterialsNames(this MaterialLibrary materialLibrary, IEnumerable constructionLayers) { - if(constructionLayers == null) + if (constructionLayers == null) { return null; } HashSet names = new HashSet(); - foreach(ConstructionLayer constructionLayer in constructionLayers) + foreach (ConstructionLayer constructionLayer in constructionLayers) { string name = constructionLayer?.Name; - if(string.IsNullOrWhiteSpace(name)) + if (string.IsNullOrWhiteSpace(name)) { continue; } - if(materialLibrary?.GetMaterial(name) != null) + if (materialLibrary?.GetMaterial(name) != null) { continue; } @@ -118,7 +121,7 @@ public static List MissingMaterialsNames(this MaterialLibrary materialLi public static List MissingMaterialsNames(this ConstructionManager constructionManager) { - if(constructionManager == null) + if (constructionManager == null) { return null; } @@ -147,10 +150,10 @@ public static List MissingMaterialsNames(this ConstructionManager constr List constructions = new List(); List apertureConstructions = new List(); - foreach(Guid guid in guids) + foreach (Guid guid in guids) { Construction construction = constructionManager.GetConstruction(guid); - if(construction != null) + if (construction != null) { constructions.Add(construction); continue; @@ -170,4 +173,4 @@ public static List MissingMaterialsNames(this ConstructionManager constr return names.ToList(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/MissingProfileNameDictionary.cs b/SAM/SAM.Analytical/Query/MissingProfileNameDictionary.cs index 570652d16..1f83d0bba 100644 --- a/SAM/SAM.Analytical/Query/MissingProfileNameDictionary.cs +++ b/SAM/SAM.Analytical/Query/MissingProfileNameDictionary.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -6,7 +9,7 @@ public static partial class Query { public static Dictionary> MissingProfileNameDictionary(this AnalyticalModel analyticalModel) { - if(analyticalModel == null) + if (analyticalModel == null) { return null; } @@ -16,21 +19,21 @@ public static Dictionary> MissingProfileNameDictionary public static Dictionary> MissingProfileNameDictionary(this ProfileLibrary profileLibrary, IEnumerable internalConditions) { - if(profileLibrary == null || internalConditions == null) + if (profileLibrary == null || internalConditions == null) { return null; } Dictionary> result = new Dictionary>(); - foreach(InternalCondition internalCondition in internalConditions) + foreach (InternalCondition internalCondition in internalConditions) { Dictionary dictionary_Temp = MissingProfileNameDictionary(profileLibrary, internalCondition); - if(dictionary_Temp == null || dictionary_Temp.Count == 0) + if (dictionary_Temp == null || dictionary_Temp.Count == 0) { continue; } - foreach(KeyValuePair keyValuePair in dictionary_Temp) + foreach (KeyValuePair keyValuePair in dictionary_Temp) { if (!result.TryGetValue(keyValuePair.Key, out List names)) { @@ -50,13 +53,13 @@ public static Dictionary> MissingProfileNameDictionary public static Dictionary MissingProfileNameDictionary(this ProfileLibrary profileLibrary, InternalCondition internalCondition) { - if(profileLibrary == null || internalCondition == null) + if (profileLibrary == null || internalCondition == null) { return null; } Dictionary dictionary = internalCondition.GetProfileTypeDictionary(); - if(dictionary == null) + if (dictionary == null) { return null; } @@ -64,13 +67,13 @@ public static Dictionary MissingProfileNameDictionary(this Dictionary result = new Dictionary(); foreach (KeyValuePair keyValuePair in dictionary) { - if(string.IsNullOrEmpty(keyValuePair.Value)) + if (string.IsNullOrEmpty(keyValuePair.Value)) { continue; } Profile profile = internalCondition.GetProfile(keyValuePair.Key, profileLibrary); - if(profile != null) + if (profile != null) { continue; } @@ -81,4 +84,4 @@ public static Dictionary MissingProfileNameDictionary(this return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Name.cs b/SAM/SAM.Analytical/Query/Name.cs index d9b10ac07..5f52c8736 100644 --- a/SAM/SAM.Analytical/Query/Name.cs +++ b/SAM/SAM.Analytical/Query/Name.cs @@ -1,35 +1,38 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { public static string Name(string uniqueName, bool includePrefix = true, bool includeName = true, bool includeGuid = true, bool includeId = true) { - if(string.IsNullOrWhiteSpace(uniqueName)) + if (string.IsNullOrWhiteSpace(uniqueName)) { return uniqueName; } - if(!UniqueNameDecomposition(uniqueName, out string prefix, out string name, out System.Guid? guid, out int id)) + if (!UniqueNameDecomposition(uniqueName, out string prefix, out string name, out System.Guid? guid, out int id)) { return uniqueName; } - if(!includePrefix) + if (!includePrefix) { prefix = null; } - if(!includeName) + if (!includeName) { name = null; } - if(!includeGuid) + if (!includeGuid) { guid = null; } - if(!includeId) + if (!includeId) { id = -1; } @@ -37,4 +40,4 @@ public static string Name(string uniqueName, bool includePrefix = true, bool inc return UniqueName(prefix, name, guid, id); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/Adiabatic.cs b/SAM/SAM.Analytical/Query/New/Adiabatic.cs index 120ddf3c0..87e98e05c 100644 --- a/SAM/SAM.Analytical/Query/New/Adiabatic.cs +++ b/SAM/SAM.Analytical/Query/New/Adiabatic.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -7,12 +10,12 @@ public static partial class Query public static bool Adiabatic(this HostPartitionType hostPartitionType) { List materialLayers = hostPartitionType?.MaterialLayers; - if(materialLayers == null) + if (materialLayers == null) { return false; } - if(materialLayers.Count == 0) + if (materialLayers.Count == 0) { return true; } @@ -22,17 +25,17 @@ public static bool Adiabatic(this HostPartitionType hostPartitionType) public static bool Adiabatic(this IHostPartition hostPartition) { - if(hostPartition == null) + if (hostPartition == null) { return false; } - if(Adiabatic(hostPartition.Type())) + if (Adiabatic(hostPartition.Type())) { return true; } - if(!hostPartition.TryGetValue(HostPartitionParameter.Adiabatic, out bool result)) + if (!hostPartition.TryGetValue(HostPartitionParameter.Adiabatic, out bool result)) { return false; } @@ -40,4 +43,4 @@ public static bool Adiabatic(this IHostPartition hostPartition) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/Azimuth.cs b/SAM/SAM.Analytical/Query/New/Azimuth.cs index e9aaac7fe..8c9f8e76b 100644 --- a/SAM/SAM.Analytical/Query/New/Azimuth.cs +++ b/SAM/SAM.Analytical/Query/New/Azimuth.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Analytical { @@ -9,4 +12,4 @@ public static double Azimuth(this IPartition partition) return Geometry.Object.Spatial.Query.Azimuth(partition, Vector3D.WorldY); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/BoundaryType.cs b/SAM/SAM.Analytical/Query/New/BoundaryType.cs index ec10d303c..ddaf66dec 100644 --- a/SAM/SAM.Analytical/Query/New/BoundaryType.cs +++ b/SAM/SAM.Analytical/Query/New/BoundaryType.cs @@ -1,4 +1,7 @@ -using SAM.Architectural; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Architectural; namespace SAM.Analytical { @@ -6,26 +9,26 @@ public static partial class Query { public static BoundaryType? BoundaryType(this BuildingModel buildingModel, IPartition partition) { - if(partition == null) + if (partition == null) { return null; } - if(partition is IHostPartition) + if (partition is IHostPartition) { - if(Adiabatic((IHostPartition)partition)) + if (Adiabatic((IHostPartition)partition)) { return Analytical.BoundaryType.Adiabatic; } } - if(buildingModel.Shade(partition)) + if (buildingModel.Shade(partition)) { return Analytical.BoundaryType.Shade; } ITerrain terrain = buildingModel.Terrain; - if(terrain != null) + if (terrain != null) { if (terrain.Below(partition.Face3D) || terrain.On(partition.Face3D)) { @@ -33,7 +36,7 @@ public static partial class Query } } - if(buildingModel.External(partition)) + if (buildingModel.External(partition)) { return Analytical.BoundaryType.Exposed; } @@ -46,4 +49,4 @@ public static partial class Query return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/CalculatedArea.cs b/SAM/SAM.Analytical/Query/New/CalculatedArea.cs index 23d8290d1..3462d265d 100644 --- a/SAM/SAM.Analytical/Query/New/CalculatedArea.cs +++ b/SAM/SAM.Analytical/Query/New/CalculatedArea.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -13,4 +16,4 @@ public static double CalculatedArea(this Space space, BuildingModel buildingMode return buildingModel.GetArea(space, offset, tolerance_Angle, tolerance_Distance, tolerance_Snap); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/CalculatedExhaustAirflow.cs b/SAM/SAM.Analytical/Query/New/CalculatedExhaustAirflow.cs index 1088a994d..b3ad1b964 100644 --- a/SAM/SAM.Analytical/Query/New/CalculatedExhaustAirflow.cs +++ b/SAM/SAM.Analytical/Query/New/CalculatedExhaustAirflow.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -10,4 +13,4 @@ public static double CalculatedExhaustAirflow(this BuildingModel buildingModel, return buildingModel.Sum(zone, SpaceParameter.ExhaustAirFlow); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/CalculatedOutsideSupplyAirflow.cs b/SAM/SAM.Analytical/Query/New/CalculatedOutsideSupplyAirflow.cs index b9ef19371..4738ce8a2 100644 --- a/SAM/SAM.Analytical/Query/New/CalculatedOutsideSupplyAirflow.cs +++ b/SAM/SAM.Analytical/Query/New/CalculatedOutsideSupplyAirflow.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -10,4 +13,4 @@ public static double CalculatedOutsideSupplyAirflow(this BuildingModel buildingM return buildingModel.Sum(zone, SpaceParameter.OutsideSupplyAirFlow); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/CalculatedSupplyAirflow.cs b/SAM/SAM.Analytical/Query/New/CalculatedSupplyAirflow.cs index 2eaf5a7c7..c53f551ba 100644 --- a/SAM/SAM.Analytical/Query/New/CalculatedSupplyAirflow.cs +++ b/SAM/SAM.Analytical/Query/New/CalculatedSupplyAirflow.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -10,4 +13,4 @@ public static double CalculatedSupplyAirflow(this BuildingModel buildingModel, Z return buildingModel.Sum(zone, SpaceParameter.SupplyAirFlow); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/CalculatedVolume.cs b/SAM/SAM.Analytical/Query/New/CalculatedVolume.cs index fe6e8b8c1..ee2b0a157 100644 --- a/SAM/SAM.Analytical/Query/New/CalculatedVolume.cs +++ b/SAM/SAM.Analytical/Query/New/CalculatedVolume.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -14,4 +17,4 @@ public static double CalculatedVolume(this Space space, BuildingModel buildingMo } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/Color.cs b/SAM/SAM.Analytical/Query/New/Color.cs index 326a753e2..efad8e4de 100644 --- a/SAM/SAM.Analytical/Query/New/Color.cs +++ b/SAM/SAM.Analytical/Query/New/Color.cs @@ -1,16 +1,19 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { public static System.Drawing.Color Color(this IPartition partition) { System.Drawing.Color result = System.Drawing.Color.Empty; - if(partition == null) + if (partition == null) { return result; } - if(partition is Wall) + if (partition is Wall) { return System.Drawing.ColorTranslator.FromHtml("#FFB400"); } @@ -140,7 +143,7 @@ public static System.Drawing.Color Color(this PartitionAnalyticalType partitionA public static System.Drawing.Color Color(this OpeningAnalyticalType openingAnalyticalType) { - switch(openingAnalyticalType) + switch (openingAnalyticalType) { case Analytical.OpeningAnalyticalType.Door: return Color(openingAnalyticalType, OpeningPart.Frame); @@ -160,7 +163,7 @@ public static System.Drawing.Color Color(this OpeningAnalyticalType openingAnaly switch (openingAnalyticalType) { case Analytical.OpeningAnalyticalType.Door: - switch(openingPart) + switch (openingPart) { case OpeningPart.Frame: return System.Drawing.Color.Brown; @@ -213,4 +216,4 @@ public static System.Drawing.Color Color(this BoundaryType boundaryType) return System.Drawing.Color.Empty; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/CoolingDesignTemperature.cs b/SAM/SAM.Analytical/Query/New/CoolingDesignTemperature.cs index 842a2128a..16c7c1231 100644 --- a/SAM/SAM.Analytical/Query/New/CoolingDesignTemperature.cs +++ b/SAM/SAM.Analytical/Query/New/CoolingDesignTemperature.cs @@ -1,11 +1,14 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { public static double CoolingDesignTemperature(this Space space, BuildingModel buildingModel) { Profile profile = buildingModel?.GetProfile(space, ProfileType.Cooling, true); - if(profile == null) + if (profile == null) { return double.NaN; } @@ -13,4 +16,4 @@ public static double CoolingDesignTemperature(this Space space, BuildingModel bu return profile.MinValue; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/Cut.cs b/SAM/SAM.Analytical/Query/New/Cut.cs index 74976e328..28c9041f9 100644 --- a/SAM/SAM.Analytical/Query/New/Cut.cs +++ b/SAM/SAM.Analytical/Query/New/Cut.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -18,7 +21,7 @@ public static List Cut(this T partition, double elevation, double toleranc return Cut(partition, plane, tolerance); } - + public static List Cut(this T partition, Plane plane, double tolerance = Tolerance.Distance) where T : IPartition { if (plane == null) @@ -29,7 +32,7 @@ public static List Cut(this T partition, Plane plane, double tolerance = T return null; List result = new List(); - + List face3Ds = Geometry.Spatial.Query.Cut(face3D, plane, tolerance); if (face3Ds == null || face3Ds.Count == 0) { @@ -37,12 +40,12 @@ public static List Cut(this T partition, Plane plane, double tolerance = T return result; } - for(int i =0; i < face3Ds.Count; i++) + for (int i = 0; i < face3Ds.Count; i++) { System.Guid guid = i == 0 ? partition.Guid : System.Guid.NewGuid(); - + T partition_New = Create.Partition(partition, guid, face3Ds[i], tolerance); - if(partition_New == null) + if (partition_New == null) { continue; } @@ -79,7 +82,7 @@ public static List Cut(this T partition, IEnumerable planes, double return result; } - public static List Cut(this T partition, IEnumerable elevations, double tolerance = Tolerance.Distance) where T: IPartition + public static List Cut(this T partition, IEnumerable elevations, double tolerance = Tolerance.Distance) where T : IPartition { if (partition == null || elevations == null) return null; @@ -157,4 +160,4 @@ public static List Cut(this BuildingModel buildingModel, Plane plane return Cut(buildingModel, plane, spaces, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/DefaultHostPartitionType.cs b/SAM/SAM.Analytical/Query/New/DefaultHostPartitionType.cs index 06a8e0ab4..d652aa1db 100644 --- a/SAM/SAM.Analytical/Query/New/DefaultHostPartitionType.cs +++ b/SAM/SAM.Analytical/Query/New/DefaultHostPartitionType.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Linq; namespace SAM.Analytical @@ -13,7 +16,7 @@ public static HostPartitionType DefaultHostPartitionType(Vector3D normal, double } HostPartitionTypeLibrary hostPartitionTypeLibrary = DefaultHostPartitionTypeLibrary(); - if(hostPartitionTypeLibrary == null) + if (hostPartitionTypeLibrary == null) { return null; } @@ -40,7 +43,7 @@ public static HostPartitionType DefaultHostPartitionType(Face3D face3D, double t return DefaultHostPartitionType(face3D?.GetPlane()?.Normal, tolerance); } - public static T DefaultHostPartitionType(this PartitionAnalyticalType partitionAnalyticalType) where T: HostPartitionType + public static T DefaultHostPartitionType(this PartitionAnalyticalType partitionAnalyticalType) where T : HostPartitionType { HostPartitionTypeLibrary hostPartitionTypeLibrary = DefaultHostPartitionTypeLibrary(); if (hostPartitionTypeLibrary == null) @@ -56,4 +59,4 @@ public static HostPartitionType DefaultHostPartitionType(this PartitionAnalytica return DefaultHostPartitionType(partitionAnalyticalType); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/DefaultHostPartitionTypeLibrary.cs b/SAM/SAM.Analytical/Query/New/DefaultHostPartitionTypeLibrary.cs index 9d82b58d0..d75afa193 100644 --- a/SAM/SAM.Analytical/Query/New/DefaultHostPartitionTypeLibrary.cs +++ b/SAM/SAM.Analytical/Query/New/DefaultHostPartitionTypeLibrary.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -7,4 +10,4 @@ public static HostPartitionTypeLibrary DefaultHostPartitionTypeLibrary() return ActiveSetting.Setting.GetValue(AnalyticalSettingParameter.DefaultHostPartitionTypeLibrary); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/DefaultMaterialLibrary.cs b/SAM/SAM.Analytical/Query/New/DefaultMaterialLibrary.cs index 03df84ec8..87563b764 100644 --- a/SAM/SAM.Analytical/Query/New/DefaultMaterialLibrary.cs +++ b/SAM/SAM.Analytical/Query/New/DefaultMaterialLibrary.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Analytical { @@ -9,4 +12,4 @@ public static MaterialLibrary DefaultMaterialLibrary() return ActiveSetting.Setting.GetValue(AnalyticalSettingParameter.DefaultMaterialLibrary); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/DefaultOpeningType.cs b/SAM/SAM.Analytical/Query/New/DefaultOpeningType.cs index 533f3a4f9..d2feaf69d 100644 --- a/SAM/SAM.Analytical/Query/New/DefaultOpeningType.cs +++ b/SAM/SAM.Analytical/Query/New/DefaultOpeningType.cs @@ -1,4 +1,7 @@ -using System.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Linq; namespace SAM.Analytical { @@ -15,4 +18,4 @@ public static OpeningType DefaultOpeningType(this OpeningAnalyticalType openingA return openingTypeLibrary.GetOpeningTypes(openingAnalyticalType)?.FirstOrDefault(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/DefaultOpeningTypeLibrary.cs b/SAM/SAM.Analytical/Query/New/DefaultOpeningTypeLibrary.cs index 6d74b73ea..3db3f2a41 100644 --- a/SAM/SAM.Analytical/Query/New/DefaultOpeningTypeLibrary.cs +++ b/SAM/SAM.Analytical/Query/New/DefaultOpeningTypeLibrary.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -7,4 +10,4 @@ public static OpeningTypeLibrary DefaultOpeningTypeLibrary() return ActiveSetting.Setting.GetValue(AnalyticalSettingParameter.DefaultOpeningTypeLibrary); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/DefaultProfileLibrary.cs b/SAM/SAM.Analytical/Query/New/DefaultProfileLibrary.cs index 9874e9443..332c35f09 100644 --- a/SAM/SAM.Analytical/Query/New/DefaultProfileLibrary.cs +++ b/SAM/SAM.Analytical/Query/New/DefaultProfileLibrary.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -7,4 +10,4 @@ public static ProfileLibrary DefaultProfileLibrary() return ActiveSetting.Setting.GetValue(AnalyticalSettingParameter.DefaultProfileLibrary); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/DesignHeatingLoad.cs b/SAM/SAM.Analytical/Query/New/DesignHeatingLoad.cs index a78c280c2..83f35c59f 100644 --- a/SAM/SAM.Analytical/Query/New/DesignHeatingLoad.cs +++ b/SAM/SAM.Analytical/Query/New/DesignHeatingLoad.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -12,7 +15,7 @@ public static double DesignHeatingLoad(this BuildingModel buildingModel, Zone zo return double.NaN; double result = 0; - foreach(Space space in spaces) + foreach (Space space in spaces) { if (space == null) continue; @@ -26,4 +29,4 @@ public static double DesignHeatingLoad(this BuildingModel buildingModel, Zone zo return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/DuplicatedSpacesDictionary.cs b/SAM/SAM.Analytical/Query/New/DuplicatedSpacesDictionary.cs index 00a2f35d4..a7476d01c 100644 --- a/SAM/SAM.Analytical/Query/New/DuplicatedSpacesDictionary.cs +++ b/SAM/SAM.Analytical/Query/New/DuplicatedSpacesDictionary.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -18,7 +21,7 @@ public static Dictionary> DuplicatedSpacesDictionary(this Bui Dictionary dictionary = new Dictionary(); - foreach(Space space in spaces) + foreach (Space space in spaces) { Shell shell = buildingModel.GetShell(space); if (shell == null) @@ -54,4 +57,4 @@ public static Dictionary> DuplicatedSpacesDictionary(this Bui return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/Extend.cs b/SAM/SAM.Analytical/Query/New/Extend.cs index 5384b1c18..4e09cb55a 100644 --- a/SAM/SAM.Analytical/Query/New/Extend.cs +++ b/SAM/SAM.Analytical/Query/New/Extend.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -67,8 +70,8 @@ public static IPartition Extend(this IPartition partition, IEnumerable segment2Ds = new List(); - for(int i = 0; i < segment2Ds_Panel.Count; i++) + List segment2Ds = new List(); + for (int i = 0; i < segment2Ds_Panel.Count; i++) { Segment2D segment2D = segment2Ds_Panel[i]; @@ -78,7 +81,7 @@ public static IPartition Extend(this IPartition partition, IEnumerable Extend(this IEnumerable partitions_To partitions_Temp.Add(partition_Temp); } - List planes = partitions_Temp.ConvertAll(x => x.Face3D.GetPlane()); + List planes = partitions_Temp.ConvertAll(x => x.Face3D.GetPlane()); List partitions_Cut = new List(); - foreach(IPartition partition in partitions_Temp) + foreach (IPartition partition in partitions_Temp) { List partitions_Cut_Temp = partition.Cut(planes, tolerance); if (partitions_Cut_Temp == null || partitions_Cut_Temp.Count == 0) @@ -150,12 +153,12 @@ public static List Extend(this IEnumerable partitions_To Vector3D vector3D = Vector3D.WorldZ.GetNegated(); List result = new List(); - foreach(IPartition partition in partitions_Cut) + foreach (IPartition partition in partitions_Cut) { Point3D point3D = partition.Face3D.GetInternalPoint3D(); bool remove = false; - for(int i=0; i < face3Ds.Count; i++) + for (int i = 0; i < face3Ds.Count; i++) { Face3D face3D = face3Ds[i]; if (face3D == null) @@ -169,7 +172,7 @@ public static List Extend(this IEnumerable partitions_To if (point3D_Intersection == null) continue; - if(point3D.Z > point3D_Intersection.Z && System.Math.Abs(point3D.Z - point3D_Intersection.Z) > tolerance) + if (point3D.Z > point3D_Intersection.Z && System.Math.Abs(point3D.Z - point3D_Intersection.Z) > tolerance) { remove = true; break; @@ -184,7 +187,7 @@ public static List Extend(this IEnumerable partitions_To return result; } - + public static IPartition Extend(this IPartition partition, Plane plane, double snapTolerance = Core.Tolerance.MacroDistance, double tolerance = Core.Tolerance.Distance) { if (plane == null) @@ -219,7 +222,7 @@ public static IPartition Extend(this IPartition partition, Plane plane, double s List point3Ds_Projected = point3Ds.ConvertAll(x => line3D.Project(x)); List segment2Ds = new List(); - for(int i =0; i < point3Ds.Count; i++) + for (int i = 0; i < point3Ds.Count; i++) { if (point3Ds[i] == null || point3Ds_Projected[i] == null) continue; @@ -274,4 +277,4 @@ public static IPartition Extend(this IPartition partition, Plane plane, double s return Create.Partition(partition, partition.Guid, face3D, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/External.cs b/SAM/SAM.Analytical/Query/New/External.cs index 35956b724..31bd4830d 100644 --- a/SAM/SAM.Analytical/Query/New/External.cs +++ b/SAM/SAM.Analytical/Query/New/External.cs @@ -1,10 +1,13 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { public static bool External(this PartitionAnalyticalType panelType) { - switch(panelType) + switch (panelType) { case Analytical.PartitionAnalyticalType.CurtainWall: case Analytical.PartitionAnalyticalType.ExternalFloor: @@ -20,4 +23,4 @@ public static bool External(this PartitionAnalyticalType panelType) } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/ExternalMaterial.cs b/SAM/SAM.Analytical/Query/New/ExternalMaterial.cs index a65f8a4f8..6f6b00559 100644 --- a/SAM/SAM.Analytical/Query/New/ExternalMaterial.cs +++ b/SAM/SAM.Analytical/Query/New/ExternalMaterial.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Analytical { @@ -22,4 +25,4 @@ public static IMaterial ExternalMaterial(this IHostPartition hostPartition, Mate } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/ExternalMaterialLayer.cs b/SAM/SAM.Analytical/Query/New/ExternalMaterialLayer.cs index 3d189bb8a..f87b40ed1 100644 --- a/SAM/SAM.Analytical/Query/New/ExternalMaterialLayer.cs +++ b/SAM/SAM.Analytical/Query/New/ExternalMaterialLayer.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Analytical @@ -7,7 +10,7 @@ public static partial class Query { public static Architectural.MaterialLayer ExternalMaterialLayer(this HostPartitionType hostPartitionType) { - List materialLayers= hostPartitionType?.MaterialLayers; + List materialLayers = hostPartitionType?.MaterialLayers; if (materialLayers == null || materialLayers.Count == 0) return null; @@ -19,4 +22,4 @@ public static Architectural.MaterialLayer ExternalMaterialLayer(this IHostPartit return ExternalMaterialLayer(hostPartition?.Type()); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/ExternalPartitions.cs b/SAM/SAM.Analytical/Query/New/ExternalPartitions.cs index d4d19c865..44baa7c63 100644 --- a/SAM/SAM.Analytical/Query/New/ExternalPartitions.cs +++ b/SAM/SAM.Analytical/Query/New/ExternalPartitions.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Object.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Object.Spatial; using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System; @@ -23,14 +26,14 @@ public static List ExternalPartitions(this IEnumerable p if (partitions == null) return null; - Plane plane = Plane.WorldXY.GetMoved(new Vector3D(0 , 0, elevation)) as Plane; + Plane plane = Plane.WorldXY.GetMoved(new Vector3D(0, 0, elevation)) as Plane; Dictionary> dictionary = partitions.SectionDictionary(plane, tolerance_Distance); List segment2Ds = new List(); - foreach(KeyValuePair> keyValuePair in dictionary) + foreach (KeyValuePair> keyValuePair in dictionary) { - foreach(ISegmentable2D segmentable2D in keyValuePair.Value) + foreach (ISegmentable2D segmentable2D in keyValuePair.Value) { segment2Ds.AddRange(segmentable2D.GetSegments()); } @@ -39,7 +42,7 @@ public static List ExternalPartitions(this IEnumerable p segment2Ds = segment2Ds.Split(tolerance_Distance); List polygon2Ds = segment2Ds.ExternalPolygon2Ds(snapTolerance, tolerance_Distance); - if(polygon2Ds == null || polygon2Ds.Count == 0) + if (polygon2Ds == null || polygon2Ds.Count == 0) { return null; } @@ -55,14 +58,14 @@ public static List ExternalPartitions(this IEnumerable p HashSet guids = new HashSet(); - foreach(KeyValuePair> keyValuePair in dictionary) + foreach (KeyValuePair> keyValuePair in dictionary) { List segment2Ds_Split = new List(); foreach (ISegmentable2D segmentable2D in keyValuePair.Value) { List segment2Ds_Temp = segmentable2D.GetSegments(); - foreach(Segment2D segment2D_Temp in segment2Ds_Temp) + foreach (Segment2D segment2D_Temp in segment2Ds_Temp) { List segment2Ds_Split_Temp = segment2Ds.FindAll(x => segment2D_Temp.On(x.Mid(), tolerance_Distance)); if (segment2Ds_Split_Temp != null) @@ -74,26 +77,26 @@ public static List ExternalPartitions(this IEnumerable p BoundingBox3D boundingBox3D = partition?.Face3D?.GetBoundingBox(); Plane plane_Bottom = Plane.WorldXY.GetMoved(new Vector3D(0, 0, boundingBox3D.Min.Z)) as Plane; - foreach (Segment2D segment2D in segment2Ds_Split) + foreach (Segment2D segment2D in segment2Ds_Split) { - if(segment2D == null || segment2D.GetLength() <= snapTolerance) + if (segment2D == null || segment2D.GetLength() <= snapTolerance) { continue; } - + Point2D point2D = segment2D.Mid(); List partitions_Temp = null; Polygon2D polygon2D = polygon2Ds.Find(x => x.On(point2D, snapTolerance)); - if(polygon2D != null) + if (polygon2D != null) { partitions_Temp = result; } else { polygon2D = polygon2Ds.Find(x => x.Inside(point2D, snapTolerance)); - if(polygon2D != null) + if (polygon2D != null) { partitions_Temp = internalPartitions; } @@ -103,7 +106,7 @@ public static List ExternalPartitions(this IEnumerable p } } - if(partitions_Temp == null) + if (partitions_Temp == null) { continue; } @@ -115,7 +118,7 @@ public static List ExternalPartitions(this IEnumerable p Face3D face3D = Geometry.Spatial.Create.Face3D(plane_Bottom.Convert(segment2D), boundingBox3D.Max.Z - boundingBox3D.Min.Z); IPartition partition_New = Create.Partition(partition, guid, face3D, tolerance_Distance); - if(partition_New == null) + if (partition_New == null) { continue; } @@ -128,4 +131,4 @@ public static List ExternalPartitions(this IEnumerable p } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/ExternalPartitionsArea.cs b/SAM/SAM.Analytical/Query/New/ExternalPartitionsArea.cs index 6c542bc15..b3b539d87 100644 --- a/SAM/SAM.Analytical/Query/New/ExternalPartitionsArea.cs +++ b/SAM/SAM.Analytical/Query/New/ExternalPartitionsArea.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -14,13 +17,13 @@ public static double ExternalPartitionsArea(this BuildingModel buildingModel, Sp return double.NaN; double result = 0; - foreach(IHostPartition hostPartition in hostPartitions) + foreach (IHostPartition hostPartition in hostPartitions) { Geometry.Spatial.Face3D face3D = hostPartition?.Face3D; if (face3D == null) continue; - + double area = face3D.GetArea(); if (double.IsNaN(area) || area == 0) continue; @@ -31,4 +34,4 @@ public static double ExternalPartitionsArea(this BuildingModel buildingModel, Sp return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/ExternalVector3D.cs b/SAM/SAM.Analytical/Query/New/ExternalVector3D.cs index 84d1c0102..3da9523ae 100644 --- a/SAM/SAM.Analytical/Query/New/ExternalVector3D.cs +++ b/SAM/SAM.Analytical/Query/New/ExternalVector3D.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; namespace SAM.Analytical @@ -9,15 +12,15 @@ public static Vector3D ExternalVector3D(this BuildingModel buildingModel, Space { if (buildingModel == null || partition == null || space == null) return null; - + List partitions = buildingModel.GetPartitions(space); - if(partitions == null || partitions.Count == 0) + if (partitions == null || partitions.Count == 0) { return null; } IPartition partition_Temp = partitions.Find(x => x.Guid == partition.Guid); - if(partition_Temp == null) + if (partition_Temp == null) { return null; } @@ -33,4 +36,4 @@ public static Vector3D ExternalVector3D(this BuildingModel buildingModel, Space return shell.Normal(face3D.InternalPoint3D(), true, silverSpacing, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/Extrusion.cs b/SAM/SAM.Analytical/Query/New/Extrusion.cs index a01df9945..72d41718f 100644 --- a/SAM/SAM.Analytical/Query/New/Extrusion.cs +++ b/SAM/SAM.Analytical/Query/New/Extrusion.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Analytical { @@ -42,7 +45,7 @@ public static Extrusion Extrusion(this IHostPartition hostPartition, double tole Vector3D normal = plane.Normal; - if(hostPartition is Floor) + if (hostPartition is Floor) { if (normal.SameHalf(Vector3D.WorldZ)) normal.Negate(); @@ -50,7 +53,7 @@ public static Extrusion Extrusion(this IHostPartition hostPartition, double tole vector3D_Extrusion = normal * thickness; face3D_Extrusion = face3D; } - else if(hostPartition is Roof) + else if (hostPartition is Roof) { if (!normal.SameHalf(Vector3D.WorldZ)) normal.Negate(); @@ -95,4 +98,4 @@ public static Extrusion Extrusion(this IHostPartition hostPartition, double tole return new Extrusion(face3D_Extrusion, vector3D_Extrusion); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/Face3D.cs b/SAM/SAM.Analytical/Query/New/Face3D.cs index 4e25ec28d..e1b01a055 100644 --- a/SAM/SAM.Analytical/Query/New/Face3D.cs +++ b/SAM/SAM.Analytical/Query/New/Face3D.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -16,7 +19,7 @@ public static Face3D Face3D(this IHostPartition hostPartition, bool cutOpenings, } List openings = hostPartition.GetOpenings(); - if(openings == null || openings.Count == 0) + if (openings == null || openings.Count == 0) { return result; } @@ -27,7 +30,7 @@ public static Face3D Face3D(this IHostPartition hostPartition, bool cutOpenings, if (face2D == null) return null; - foreach(IOpening opening in openings) + foreach (IOpening opening in openings) { Face3D face3D_Aperture = opening?.Face3D; if (face3D_Aperture == null) @@ -47,4 +50,4 @@ public static Face3D Face3D(this IHostPartition hostPartition, bool cutOpenings, } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/Fill.cs b/SAM/SAM.Analytical/Query/New/Fill.cs index cf7004a21..6b8e488d8 100644 --- a/SAM/SAM.Analytical/Query/New/Fill.cs +++ b/SAM/SAM.Analytical/Query/New/Fill.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -8,22 +11,22 @@ public static partial class Query { public static List Fill(this Face3D face3D, IEnumerable partitions, double offset = 0.1, double tolerance_Area = Core.Tolerance.MacroDistance, double tolerance_Distance = Core.Tolerance.Distance) { - if(face3D == null || partitions == null) + if (face3D == null || partitions == null) { return null; } List> tuples_Partition = new List>(); - foreach(IPartition partition in partitions) + foreach (IPartition partition in partitions) { Face3D face3D_Partition = partition?.Face3D; - if(face3D_Partition == null) + if (face3D_Partition == null) { continue; } Point3D point3D = face3D_Partition.InternalPoint3D(tolerance_Distance); - if(point3D == null) + if (point3D == null) { continue; } @@ -32,41 +35,41 @@ public static List Fill(this Face3D face3D, IEnumerable } List result = new List(); - if(tuples_Partition == null || tuples_Partition.Count == 0) + if (tuples_Partition == null || tuples_Partition.Count == 0) { return result; } List face3Ds = Geometry.Spatial.Query.Fill(face3D, tuples_Partition.ConvertAll(x => x.Item2), offset, tolerance_Area, tolerance_Distance); - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return result; } - foreach(Face3D face3D_Temp in face3Ds) + foreach (Face3D face3D_Temp in face3Ds) { Plane plane = face3D_Temp.GetPlane(); - if(plane == null) + if (plane == null) { continue; } BoundingBox3D boundingBox3D = face3D_Temp.GetBoundingBox(); - if(boundingBox3D == null) + if (boundingBox3D == null) { continue; } List> tuples_Distance = new List>(); - foreach(Tuple tuple in tuples_Partition) + foreach (Tuple tuple in tuples_Partition) { Point3D point3D = plane.Project(tuple.Item3); - if(point3D == null) + if (point3D == null) { continue; } - if(!boundingBox3D.InRange(point3D, tolerance_Distance) || !face3D_Temp.Inside(point3D, tolerance_Distance)) + if (!boundingBox3D.InRange(point3D, tolerance_Distance) || !face3D_Temp.Inside(point3D, tolerance_Distance)) { continue; } @@ -74,12 +77,12 @@ public static List Fill(this Face3D face3D, IEnumerable tuples_Distance.Add(new Tuple(tuple.Item1, tuple.Item3.Distance(point3D))); } - if(tuples_Distance == null || tuples_Distance.Count == 0) + if (tuples_Distance == null || tuples_Distance.Count == 0) { continue; } - if(tuples_Distance.Count > 1) + if (tuples_Distance.Count > 1) { tuples_Distance.Sort((x, y) => x.Item2.CompareTo(y.Item2)); } @@ -87,12 +90,12 @@ public static List Fill(this Face3D face3D, IEnumerable IPartition partition = tuples_Distance[0].Item1; IPartition partition_New = Create.Partition(partition, partition.Guid, face3D_Temp, tolerance_Distance); - if(partition_New != null) + if (partition_New != null) { partition = partition_New; } - if(partition == null) + if (partition == null) { continue; } @@ -103,4 +106,4 @@ public static List Fill(this Face3D face3D, IEnumerable return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/FirstMaterial.cs b/SAM/SAM.Analytical/Query/New/FirstMaterial.cs index 2ec4c2301..0fe523eb9 100644 --- a/SAM/SAM.Analytical/Query/New/FirstMaterial.cs +++ b/SAM/SAM.Analytical/Query/New/FirstMaterial.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Spatial; namespace SAM.Analytical @@ -17,4 +20,4 @@ public static IMaterial FirstMaterial(this IHostPartition hostPartition, Vector3 return Material(materialLayer, materialLibrary); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/FirstMaterialLayer.cs b/SAM/SAM.Analytical/Query/New/FirstMaterialLayer.cs index f6bec6d00..4b9924f6e 100644 --- a/SAM/SAM.Analytical/Query/New/FirstMaterialLayer.cs +++ b/SAM/SAM.Analytical/Query/New/FirstMaterialLayer.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Analytical { @@ -23,4 +26,4 @@ public static Architectural.MaterialLayer FirstMaterialLayer(this IHostPartition return ExternalMaterialLayer(hostPartitionType); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/Fit.cs b/SAM/SAM.Analytical/Query/New/Fit.cs index d9eb6ec11..ed59337f5 100644 --- a/SAM/SAM.Analytical/Query/New/Fit.cs +++ b/SAM/SAM.Analytical/Query/New/Fit.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System; using System.Collections.Generic; using System.Linq; @@ -16,13 +19,13 @@ public static IOpening Fit(this IOpening opening, Face3D face3D, double areaFact } Plane plane = face3D.GetPlane(); - if(plane == null) + if (plane == null) { return null; } Face3D face3D_Opening = opening.Face3D; - if(face3D_Opening == null) + if (face3D_Opening == null) { return null; } @@ -31,7 +34,7 @@ public static IOpening Fit(this IOpening opening, Face3D face3D, double areaFact Geometry.Planar.Face2D face2D_Opening = plane.Convert(face3D_Opening); Geometry.Planar.ISegmentable2D segmentable2D = face2D.ExternalEdge2D as Geometry.Planar.ISegmentable2D; - if(segmentable2D == null) + if (segmentable2D == null) { throw new NotImplementedException(); } @@ -39,13 +42,13 @@ public static IOpening Fit(this IOpening opening, Face3D face3D, double areaFact double area = face2D_Opening.GetArea(); List face2Ds_Difference = Geometry.Planar.Query.Difference(face2D_Opening, face2D, tolerance); - if(face2Ds_Difference == null || face2Ds_Difference.Count == 0) + if (face2Ds_Difference == null || face2Ds_Difference.Count == 0) { return null; } double area_Difference = face2Ds_Difference.ConvertAll(x => x.GetArea()).Sum(); - if(area_Difference <= tolerance || area_Difference >= (areaFactor * area)) + if (area_Difference <= tolerance || area_Difference >= (areaFactor * area)) { return null; } @@ -58,7 +61,7 @@ public static IOpening Fit(this IOpening opening, Face3D face3D, double areaFact Geometry.Planar.Vector2D vector2D_Y = null; foreach (Geometry.Planar.Point2D point2D in boundingBox2D.GetPoints()) { - if(face2D.Inside(point2D, tolerance) || face2D.On(point2D, tolerance)) + if (face2D.Inside(point2D, tolerance) || face2D.On(point2D, tolerance)) { continue; } @@ -87,13 +90,13 @@ public static IOpening Fit(this IOpening opening, Face3D face3D, double areaFact } - if(vector2D_X == null && vector2D_Y == null) + if (vector2D_X == null && vector2D_Y == null) { return null; } vector2D = new Geometry.Planar.Vector2D(vector2D_X == null ? 0 : vector2D_X.X, vector2D_Y == null ? 0 : vector2D_Y.Y); - if(vector2D.Length <= tolerance) + if (vector2D.Length <= tolerance) { return null; } @@ -115,10 +118,10 @@ public static IOpening Fit(this IOpening opening, Face3D face3D, double areaFact return null; } - + public static IOpening Fit(this IOpening opening, IEnumerable partitions, double areaFactor = 0.5, double maxDistance = Core.Tolerance.MacroDistance, double tolerance = Core.Tolerance.Distance) { - if(opening == null || partitions == null) + if (opening == null || partitions == null) { return null; } @@ -148,12 +151,12 @@ public static IOpening Fit(this IOpening opening, IEnumerable partit openings.Add(opening_Temp); } - if(openings == null || openings.Count == 0) + if (openings == null || openings.Count == 0) { return null; } - if(openings.Count == 1) + if (openings.Count == 1) { return openings[0]; } @@ -164,10 +167,10 @@ public static IOpening Fit(this IOpening opening, IEnumerable partit return tuples.FirstOrDefault()?.Item2; } - + public static List Fit(this IEnumerable openings, IEnumerable partitions, double areaFactor = 0.5, double maxDistance = Core.Tolerance.MacroDistance, double tolerance = Core.Tolerance.Distance) { - if(openings == null || partitions == null) + if (openings == null || partitions == null) { return null; } @@ -190,4 +193,4 @@ public static List Fit(this IEnumerable openings, IEnumerabl return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/FixEdges.cs b/SAM/SAM.Analytical/Query/New/FixEdges.cs index 01cf586d1..f54ab043b 100644 --- a/SAM/SAM.Analytical/Query/New/FixEdges.cs +++ b/SAM/SAM.Analytical/Query/New/FixEdges.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; namespace SAM.Analytical @@ -7,42 +10,42 @@ public static partial class Query { public static List FixEdges(this T buildingElement, double tolerance = Core.Tolerance.Distance) where T : IBuildingElement { - if(buildingElement == null) + if (buildingElement == null) { return null; } Face3D face3D = buildingElement.Face3D; - if(face3D == null) + if (face3D == null) { return null; } List face3Ds = face3D.FixEdges(tolerance); - if(face3Ds == null) + if (face3Ds == null) { return null; } List result = new List(); - foreach(Face3D face3D_Temp in face3Ds) + foreach (Face3D face3D_Temp in face3Ds) { System.Guid guid = buildingElement.Guid; - while(result.Find(x => x.Guid == guid) != null) + while (result.Find(x => x.Guid == guid) != null) { guid = System.Guid.NewGuid(); } T face3DObject_New = default; - if(buildingElement is IPartition) + if (buildingElement is IPartition) { IPartition partition = Create.Partition((IPartition)buildingElement, guid, face3D_Temp, tolerance); - if(partition != null) + if (partition != null) { face3DObject_New = (T)partition; } } - else if(buildingElement is IOpening) + else if (buildingElement is IOpening) { IOpening opening = Create.Opening(guid, (IOpening)buildingElement, face3D_Temp, OpeningLocation(face3D_Temp, tolerance)); if (opening != null) @@ -73,24 +76,24 @@ public static List FixEdges(this T hostPartition, bool cutOpenings, double return null; } - if(cutOpenings) + if (cutOpenings) { List openings = hostPartition.GetOpenings(); - if(openings != null && openings.Count != 0) + if (openings != null && openings.Count != 0) { Plane plane = face3D.GetPlane(); Geometry.Planar.IClosed2D externalEdge = face3D.ExternalEdge2D; List internalEdges = face3D.InternalEdge2Ds; - if(internalEdges == null) + if (internalEdges == null) { internalEdges = new List(); } - foreach(IOpening opening in openings) + foreach (IOpening opening in openings) { Geometry.Planar.IClosed2D closed2D = plane.Convert(opening?.Face3D)?.ExternalEdge2D; - if(closed2D == null) + if (closed2D == null) { continue; } @@ -99,7 +102,7 @@ public static List FixEdges(this T hostPartition, bool cutOpenings, double } Geometry.Planar.Face2D face2D = Geometry.Planar.Create.Face2D(externalEdge, internalEdges); - if(face2D != null) + if (face2D != null) { face3D = plane.Convert(face2D); } @@ -122,7 +125,7 @@ public static List FixEdges(this T hostPartition, bool cutOpenings, double } IHostPartition hostPartition_New = Create.HostPartition(guid, face3D_Temp, (IHostPartition)hostPartition, tolerance); - if(hostPartition_New is T) + if (hostPartition_New is T) { result.Add((T)hostPartition_New); } @@ -133,4 +136,4 @@ public static List FixEdges(this T hostPartition, bool cutOpenings, double } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/FlipNormal.cs b/SAM/SAM.Analytical/Query/New/FlipNormal.cs index bc902ef5d..adf1fb1ed 100644 --- a/SAM/SAM.Analytical/Query/New/FlipNormal.cs +++ b/SAM/SAM.Analytical/Query/New/FlipNormal.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; namespace SAM.Analytical @@ -8,26 +11,26 @@ public static partial class Query public static IPartition FlipNormal(this IPartition partition, bool includeOpenings, bool flipX = true, double tolerance = Core.Tolerance.Distance) { Face3D face3D = partition?.Face3D; - if(face3D == null) + if (face3D == null) { return null; } face3D.FlipNormal(flipX); - if(partition is AirPartition) + if (partition is AirPartition) { return new AirPartition(partition.Guid, face3D); } IHostPartition hostPartition = partition as IHostPartition; - if(hostPartition == null) + if (hostPartition == null) { throw new System.NotImplementedException(); } hostPartition = Create.Partition(hostPartition, partition.Guid, face3D, tolerance); - if(includeOpenings) + if (includeOpenings) { List openings = hostPartition.GetOpenings(); if (openings != null) @@ -60,4 +63,4 @@ public static IOpening FlipNormal(this IOpening opening, bool flipX = true) return Create.Opening((opening as dynamic).SAMType as OpeningType, face3D); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/HasMaterial.cs b/SAM/SAM.Analytical/Query/New/HasMaterial.cs index 3474f9bb6..59203568b 100644 --- a/SAM/SAM.Analytical/Query/New/HasMaterial.cs +++ b/SAM/SAM.Analytical/Query/New/HasMaterial.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Analytical @@ -19,7 +22,7 @@ public static bool HasMaterial(this IEnumerable mat if (string.IsNullOrWhiteSpace(name)) return false; - foreach(Architectural.MaterialLayer materialLayer in materialLayers) + foreach (Architectural.MaterialLayer materialLayer in materialLayers) { if (name.Equals(materialLayer?.Name)) return true; @@ -53,4 +56,4 @@ public static bool HasMaterial(this IEnumerable mat return false; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/HeatingDesignTemperature.cs b/SAM/SAM.Analytical/Query/New/HeatingDesignTemperature.cs index b616786d4..b4ba967a6 100644 --- a/SAM/SAM.Analytical/Query/New/HeatingDesignTemperature.cs +++ b/SAM/SAM.Analytical/Query/New/HeatingDesignTemperature.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -13,4 +16,4 @@ public static double HeatingDesignTemperature(this Space space, BuildingModel bu return profile.MaxValue; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/HostPartitionCategory.cs b/SAM/SAM.Analytical/Query/New/HostPartitionCategory.cs index baf62d143..11706a831 100644 --- a/SAM/SAM.Analytical/Query/New/HostPartitionCategory.cs +++ b/SAM/SAM.Analytical/Query/New/HostPartitionCategory.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Analytical { @@ -26,12 +29,12 @@ public static HostPartitionCategory HostPartitionCategory(this IPartition partit public static HostPartitionCategory HostPartitionCategory(this HostPartitionType hostPartitionType) { - if(hostPartitionType == null) + if (hostPartitionType == null) { return Analytical.HostPartitionCategory.Undefined; } - if(hostPartitionType is WallType) + if (hostPartitionType is WallType) { return Analytical.HostPartitionCategory.Wall; } @@ -51,7 +54,7 @@ public static HostPartitionCategory HostPartitionCategory(this HostPartitionType public static HostPartitionCategory HostPartitionCategory(this PartitionAnalyticalType partitionAnalyticalType) { - switch(partitionAnalyticalType) + switch (partitionAnalyticalType) { case Analytical.PartitionAnalyticalType.Air: return Analytical.HostPartitionCategory.Undefined; @@ -84,4 +87,4 @@ public static HostPartitionCategory HostPartitionCategory(this PartitionAnalytic return Analytical.HostPartitionCategory.Undefined; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/InternalMaterialDictionary.cs b/SAM/SAM.Analytical/Query/New/InternalMaterialDictionary.cs index 72ca913ff..c5e45ff20 100644 --- a/SAM/SAM.Analytical/Query/New/InternalMaterialDictionary.cs +++ b/SAM/SAM.Analytical/Query/New/InternalMaterialDictionary.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Analytical @@ -20,4 +23,4 @@ public static Dictionary InternalMaterialDictionary(this return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/InternalMaterialLayer.cs b/SAM/SAM.Analytical/Query/New/InternalMaterialLayer.cs index df8431329..12c5c33cd 100644 --- a/SAM/SAM.Analytical/Query/New/InternalMaterialLayer.cs +++ b/SAM/SAM.Analytical/Query/New/InternalMaterialLayer.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Analytical @@ -21,4 +24,4 @@ public static Architectural.MaterialLayer InternalConstructionLayer(this IHostPa } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/InternalMaterialLayerDictionary.cs b/SAM/SAM.Analytical/Query/New/InternalMaterialLayerDictionary.cs index 448e8f42b..600b0e45e 100644 --- a/SAM/SAM.Analytical/Query/New/InternalMaterialLayerDictionary.cs +++ b/SAM/SAM.Analytical/Query/New/InternalMaterialLayerDictionary.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -9,15 +12,15 @@ public static partial class Query public static Dictionary InternalMaterialLayerDictionary(this BuildingModel buildingModel, Space space, double silverSpacing = Tolerance.MacroDistance, double tolerance = Tolerance.Distance) { Dictionary dictionary = buildingModel.NormalDictionary(space, out Shell shell, true, silverSpacing, tolerance); - if(dictionary == null) + if (dictionary == null) { return null; } Dictionary result = new Dictionary(); - foreach(KeyValuePair keyValuePair in dictionary) + foreach (KeyValuePair keyValuePair in dictionary) { - if(keyValuePair.Key == null) + if (keyValuePair.Key == null) { continue; } @@ -29,4 +32,4 @@ public static partial class Query return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/IsValid.cs b/SAM/SAM.Analytical/Query/New/IsValid.cs index e4de38435..512d95f23 100644 --- a/SAM/SAM.Analytical/Query/New/IsValid.cs +++ b/SAM/SAM.Analytical/Query/New/IsValid.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Analytical { @@ -7,13 +10,13 @@ public static partial class Query public static bool IsValid(this IHostPartition hostPartition, IOpening opening, double tolerance = Core.Tolerance.Distance) { Face3D face3D_hostPartition = hostPartition?.Face3D; - if(face3D_hostPartition == null) + if (face3D_hostPartition == null) { return false; } Face3D face3D_Opening = opening?.Face3D; - if(face3D_Opening == null) + if (face3D_Opening == null) { return false; } @@ -35,4 +38,4 @@ public static bool IsValid(this IHostPartition hostPartition, IOpening opening, return false; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/Material.cs b/SAM/SAM.Analytical/Query/New/Material.cs index 75eedffd5..f2ca9a853 100644 --- a/SAM/SAM.Analytical/Query/New/Material.cs +++ b/SAM/SAM.Analytical/Query/New/Material.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Analytical { @@ -12,4 +15,4 @@ public static IMaterial Material(this Architectural.MaterialLayer materialLayer, return materialLibrary.GetObject(materialLayer.Name); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/Materials.cs b/SAM/SAM.Analytical/Query/New/Materials.cs index 7cdc50c61..ccf7148dd 100644 --- a/SAM/SAM.Analytical/Query/New/Materials.cs +++ b/SAM/SAM.Analytical/Query/New/Materials.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Analytical @@ -25,22 +28,22 @@ public static List Materials(this OpeningType openingType, MaterialLi List paneMaterials = Architectural.Query.Materials(openingType.PaneMaterialLayers, materialLibrary); List frameMaterials = Architectural.Query.Materials(openingType.FrameMaterialLayers, materialLibrary); - if(paneMaterials == null && frameMaterials == null) + if (paneMaterials == null && frameMaterials == null) { return null; } List result = new List(); - if(paneMaterials != null) + if (paneMaterials != null) { result.AddRange(paneMaterials); } - if(frameMaterials != null) + if (frameMaterials != null) { - foreach(IMaterial material in frameMaterials) + foreach (IMaterial material in frameMaterials) { - if(result.Find(x => x.Name == material.Name) == null) + if (result.Find(x => x.Name == material.Name) == null) { result.Add(material); } @@ -72,23 +75,23 @@ public static List Materials(this IOpening opening, MaterialLibrary m public static List Materials(this IEnumerable hostPartitions, MaterialLibrary materialLibrary) { - if(hostPartitions == null) + if (hostPartitions == null) { return null; } List result = new List(); - foreach(IHostPartition hostPartition in hostPartitions) + foreach (IHostPartition hostPartition in hostPartitions) { List materials = hostPartition?.Materials(materialLibrary); - if(materials == null || materials.Count == 0) + if (materials == null || materials.Count == 0) { continue; } - foreach(IMaterial material in materials) + foreach (IMaterial material in materials) { - if(material == null || result.Find(x => x.Name == material.Name) != null) + if (material == null || result.Find(x => x.Name == material.Name) != null) { continue; } @@ -100,4 +103,4 @@ public static List Materials(this IEnumerable hostPar return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/MergeCoplanar.cs b/SAM/SAM.Analytical/Query/New/MergeCoplanar.cs index 0fb988bab..510935b34 100644 --- a/SAM/SAM.Analytical/Query/New/MergeCoplanar.cs +++ b/SAM/SAM.Analytical/Query/New/MergeCoplanar.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System; @@ -47,12 +50,12 @@ public static List MergeCoplanar(this IEnumerable partit List partitions_Offset = new List(); foreach (IPartition partition_Temp in partitions_Temp) { - if(partition.GetType() != partition_Temp?.GetType()) + if (partition.GetType() != partition_Temp?.GetType()) { continue; } - if(validateHostPartitionType && hostPartitionType != null) + if (validateHostPartitionType && hostPartitionType != null) { HostPartitionType hostPartitionType_Temp = (partition_Temp as IHostPartition)?.Type(); if (hostPartitionType_Temp != null && hostPartitionType != null) @@ -148,7 +151,7 @@ public static List MergeCoplanar(this IEnumerable partit } IPartition partition_New = Create.Partition(partition_Old, guid, face3D, tolerance); - if(partition_New is IHostPartition) + if (partition_New is IHostPartition) { //Adding Openings from redundant Panels foreach (IPartition partition_Redundant in tuples_Partition.ConvertAll(x => x.Item2)) @@ -165,7 +168,7 @@ public static List MergeCoplanar(this IEnumerable partit } } - if(partition_New != null) + if (partition_New != null) { result.Add(partition_New); } @@ -175,4 +178,4 @@ public static List MergeCoplanar(this IEnumerable partit return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/MinElevation.cs b/SAM/SAM.Analytical/Query/New/MinElevation.cs index 9151a797b..2cb14093c 100644 --- a/SAM/SAM.Analytical/Query/New/MinElevation.cs +++ b/SAM/SAM.Analytical/Query/New/MinElevation.cs @@ -1,17 +1,20 @@ - +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + + namespace SAM.Analytical { public static partial class Query { public static double MinElevation(this BuildingModel buildingModel, Space space) { - if(buildingModel == null || space == null) + if (buildingModel == null || space == null) { return double.NaN; } Geometry.Spatial.BoundingBox3D boundingBox3D = buildingModel.GetShell(space)?.GetBoundingBox(); - if(boundingBox3D == null) + if (boundingBox3D == null) { return double.NaN; } @@ -19,4 +22,4 @@ public static double MinElevation(this BuildingModel buildingModel, Space space) return boundingBox3D.Min.Z; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/NormalDictionary.cs b/SAM/SAM.Analytical/Query/New/NormalDictionary.cs index 469634507..a4e16cf62 100644 --- a/SAM/SAM.Analytical/Query/New/NormalDictionary.cs +++ b/SAM/SAM.Analytical/Query/New/NormalDictionary.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -29,4 +32,4 @@ public static Dictionary NormalDictionary(this BuildingMod } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/OpeningAnalyticalType.cs b/SAM/SAM.Analytical/Query/New/OpeningAnalyticalType.cs index 27e034c09..71362862c 100644 --- a/SAM/SAM.Analytical/Query/New/OpeningAnalyticalType.cs +++ b/SAM/SAM.Analytical/Query/New/OpeningAnalyticalType.cs @@ -1,20 +1,23 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { public static OpeningAnalyticalType OpeningAnalyticalType(this IOpening opening) { - if(opening == null) + if (opening == null) { return Analytical.OpeningAnalyticalType.Undefined; } - if(opening is Door) + if (opening is Door) { return Analytical.OpeningAnalyticalType.Door; } - if(opening is Window) + if (opening is Window) { return Analytical.OpeningAnalyticalType.Window; } @@ -42,4 +45,4 @@ public static OpeningAnalyticalType OpeningAnalyticalType(this OpeningType openi return Analytical.OpeningAnalyticalType.Undefined; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/PartitionAnalyticalType.cs b/SAM/SAM.Analytical/Query/New/PartitionAnalyticalType.cs index 285ce9f32..bdaf3a251 100644 --- a/SAM/SAM.Analytical/Query/New/PartitionAnalyticalType.cs +++ b/SAM/SAM.Analytical/Query/New/PartitionAnalyticalType.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -94,12 +97,12 @@ public static PartitionAnalyticalType PartitionAnalyticalType(this BuildingModel public static PartitionAnalyticalType? PartitionAnalyticalType(this HostPartitionType hostPartitionType) { - if(hostPartitionType == null) + if (hostPartitionType == null) { return null; } - if(!hostPartitionType.TryGetValue(HostPartitionTypeParameter.PartitionAnalyticalType, out string value, true)) + if (!hostPartitionType.TryGetValue(HostPartitionTypeParameter.PartitionAnalyticalType, out string value, true)) { return null; } @@ -122,4 +125,4 @@ public static PartitionAnalyticalType PartitionAnalyticalType(this BuildingModel return Core.Query.Enum(value); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/Profiles.cs b/SAM/SAM.Analytical/Query/New/Profiles.cs index 4384d28fc..47c191eb7 100644 --- a/SAM/SAM.Analytical/Query/New/Profiles.cs +++ b/SAM/SAM.Analytical/Query/New/Profiles.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -12,4 +15,4 @@ public static IEnumerable Profiles(this BuildingModel buildingModel, Pr return Profiles(buildingModel.GetSpaces(), profileLibrary, includeProfileGroup); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/Project.cs b/SAM/SAM.Analytical/Query/New/Project.cs index db7768ed3..bc4f3fd94 100644 --- a/SAM/SAM.Analytical/Query/New/Project.cs +++ b/SAM/SAM.Analytical/Query/New/Project.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Analytical { @@ -6,19 +9,19 @@ public static partial class Query { public static IOpening Project(this IPartition partition, IOpening opening) { - if(partition == null || opening == null) + if (partition == null || opening == null) { return null; } Plane plane = partition.Face3D.GetPlane(); - if(plane == null) + if (plane == null) { return null; } Face3D face3D = plane.Project(opening.Face3D); - if(face3D == null || !face3D.IsValid()) + if (face3D == null || !face3D.IsValid()) { return null; } @@ -27,4 +30,4 @@ public static IOpening Project(this IPartition partition, IOpening opening) } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/SpaceDictionary.cs b/SAM/SAM.Analytical/Query/New/SpaceDictionary.cs index 5cad206ce..05553bc6b 100644 --- a/SAM/SAM.Analytical/Query/New/SpaceDictionary.cs +++ b/SAM/SAM.Analytical/Query/New/SpaceDictionary.cs @@ -1,12 +1,14 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Architectural; +using SAM.Core; using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; using System.Linq; -using SAM.Architectural; - namespace SAM.Analytical { public static partial class Query @@ -228,4 +230,4 @@ public static Dictionary> SpaceDictionary(this Dicti } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/Split.cs b/SAM/SAM.Analytical/Query/New/Split.cs index a10b34ae8..75b3e204f 100644 --- a/SAM/SAM.Analytical/Query/New/Split.cs +++ b/SAM/SAM.Analytical/Query/New/Split.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; namespace SAM.Analytical @@ -7,34 +10,34 @@ public static partial class Query { public static List Split(this IOpening opening, IEnumerable face3Ds, double tolerance_Snap = Core.Tolerance.MacroDistance, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { - if(opening == null || face3Ds == null) + if (opening == null || face3Ds == null) { return null; } Face3D face3D = opening.Face3D; - if(face3D == null) + if (face3D == null) { return null; } Plane plane = face3D.GetPlane(); - if(plane == null) + if (plane == null) { return null; } List face3Ds_Split = Geometry.Spatial.Query.Split(face3D, face3Ds, tolerance_Snap, tolerance_Angle, tolerance_Distance); - if(face3Ds_Split == null) + if (face3Ds_Split == null) { - face3Ds_Split = new List() { face3D}; + face3Ds_Split = new List() { face3D }; } List result = new List(); - foreach(Face3D face3D_Split in face3Ds_Split) + foreach (Face3D face3D_Split in face3Ds_Split) { IOpening opening_Split = Create.Opening(opening.Type(), face3D_Split); - if(opening_Split == null) + if (opening_Split == null) { continue; } @@ -45,4 +48,4 @@ public static List Split(this IOpening opening, IEnumerable fa return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/SplitByInternalEdges.cs b/SAM/SAM.Analytical/Query/New/SplitByInternalEdges.cs index 71d0ef54b..53b0be887 100644 --- a/SAM/SAM.Analytical/Query/New/SplitByInternalEdges.cs +++ b/SAM/SAM.Analytical/Query/New/SplitByInternalEdges.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; namespace SAM.Analytical @@ -16,12 +19,12 @@ public static List SplitByInternalEdges(this IPartition partition, d return null; List result = new List(); - for(int i=0; i < face3Ds.Count; i++) + for (int i = 0; i < face3Ds.Count; i++) { System.Guid guid = i == 0 ? partition.Guid : System.Guid.NewGuid(); IPartition partition_Temp = Create.Partition(partition, guid, face3Ds[i], tolerance); - if(partition_Temp == null) + if (partition_Temp == null) { continue; } @@ -32,4 +35,4 @@ public static List SplitByInternalEdges(this IPartition partition, d return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/Sum.cs b/SAM/SAM.Analytical/Query/New/Sum.cs index 73ffc3075..17a76ecd8 100644 --- a/SAM/SAM.Analytical/Query/New/Sum.cs +++ b/SAM/SAM.Analytical/Query/New/Sum.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -56,4 +59,4 @@ public static double Sum(this BuildingModel buildingModel, Zone zone, SpaceParam return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/Transparent.cs b/SAM/SAM.Analytical/Query/New/Transparent.cs index d72c45cb7..e760dee5a 100644 --- a/SAM/SAM.Analytical/Query/New/Transparent.cs +++ b/SAM/SAM.Analytical/Query/New/Transparent.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Analytical { @@ -10,4 +13,4 @@ public static bool Transparent(this HostPartitionType hostPartitionType, Materia return materialType == Core.MaterialType.Transparent; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/Triangulate.cs b/SAM/SAM.Analytical/Query/New/Triangulate.cs index 86aa7af5c..f638e8838 100644 --- a/SAM/SAM.Analytical/Query/New/Triangulate.cs +++ b/SAM/SAM.Analytical/Query/New/Triangulate.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; namespace SAM.Analytical @@ -16,7 +19,7 @@ public static List Triangulate(this T partition, double tolerance = Core.T return null; List result = new List(); - for(int i=0; i < face3Ds.Count; i++) + for (int i = 0; i < face3Ds.Count; i++) { Face3D face3D_Temp = face3Ds[i]; @@ -25,7 +28,7 @@ public static List Triangulate(this T partition, double tolerance = Core.T guid = partition.Guid; T partition_New = Create.Partition(partition, guid, face3D_Temp, tolerance); - if(partition_New == null) + if (partition_New == null) { continue; } @@ -36,4 +39,4 @@ public static List Triangulate(this T partition, double tolerance = Core.T return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/Type.cs b/SAM/SAM.Analytical/Query/New/Type.cs index e779aaf04..cec257a1c 100644 --- a/SAM/SAM.Analytical/Query/New/Type.cs +++ b/SAM/SAM.Analytical/Query/New/Type.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -12,4 +15,4 @@ public static OpeningType Type(this IOpening opening) return (opening as dynamic)?.Type; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/UniqueIndex.cs b/SAM/SAM.Analytical/Query/New/UniqueIndex.cs index 05148bd92..18451b8bd 100644 --- a/SAM/SAM.Analytical/Query/New/UniqueIndex.cs +++ b/SAM/SAM.Analytical/Query/New/UniqueIndex.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -77,4 +80,4 @@ public static int UniqueIndex(this BuildingModel buildingModel, Space space) return index; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/New/Width.cs b/SAM/SAM.Analytical/Query/New/Width.cs index c09923b09..029b94000 100644 --- a/SAM/SAM.Analytical/Query/New/Width.cs +++ b/SAM/SAM.Analytical/Query/New/Width.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using SAM.Geometry.Spatial; namespace SAM.Analytical @@ -54,4 +57,4 @@ public static double Width(this Face3D face3D) //return rectangle2D.Width; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Next.cs b/SAM/SAM.Analytical/Query/Next.cs index 7d823efb9..2df9a5913 100644 --- a/SAM/SAM.Analytical/Query/Next.cs +++ b/SAM/SAM.Analytical/Query/Next.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Analytical @@ -7,22 +10,22 @@ public static partial class Query { public static int Next(this IEnumerable values, T value, int itemCount, int start = 0) { - if(values == null) + if (values == null) { return -1; } int length = values.Count(); - if(length == 0 || length <= itemCount || length <= start) + if (length == 0 || length <= itemCount || length <= start) { return -1; } int count = 0; - for(int i = start; i < length; i++) + for (int i = start; i < length; i++) { T value_Current = values.ElementAt(i); - if(value_Current as dynamic == value as dynamic) + if (value_Current as dynamic == value as dynamic) { count++; } @@ -31,7 +34,7 @@ public static int Next(this IEnumerable values, T value, int itemCount, in count = 0; } - if(count == itemCount) + if (count == itemCount) { return i; } @@ -41,4 +44,4 @@ public static int Next(this IEnumerable values, T value, int itemCount, in return -1; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/NextId.cs b/SAM/SAM.Analytical/Query/NextId.cs index 434e7fdc6..95960f30a 100644 --- a/SAM/SAM.Analytical/Query/NextId.cs +++ b/SAM/SAM.Analytical/Query/NextId.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -6,7 +9,7 @@ public static partial class Query { public static string NextId(this AdjacencyCluster adjacencyCluster, MechanicalSystemType mechanicalSystemType) { - if(adjacencyCluster == null || mechanicalSystemType == null) + if (adjacencyCluster == null || mechanicalSystemType == null) { return null; } @@ -14,22 +17,22 @@ public static string NextId(this AdjacencyCluster adjacencyCluster, MechanicalSy int index = 1; List mechanicalSystems = adjacencyCluster.GetMechanicalSystems(); - if(mechanicalSystems != null && mechanicalSystems.Count != 0) + if (mechanicalSystems != null && mechanicalSystems.Count != 0) { List indexes = new List(); - foreach(MechanicalSystem mechanicalSystem in mechanicalSystems) + foreach (MechanicalSystem mechanicalSystem in mechanicalSystems) { - if(mechanicalSystem.Type.Guid == mechanicalSystemType.Guid) + if (mechanicalSystem.Type.Guid == mechanicalSystemType.Guid) { string id = mechanicalSystem.Id; - if(Core.Query.TryConvert(id, out int index_Temp)) + if (Core.Query.TryConvert(id, out int index_Temp)) { indexes.Add(index_Temp); } } } - while(indexes.Contains(index)) + while (indexes.Contains(index)) { index++; } @@ -38,4 +41,4 @@ public static string NextId(this AdjacencyCluster adjacencyCluster, MechanicalSy return index.ToString(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/NormalDictionary.cs b/SAM/SAM.Analytical/Query/NormalDictionary.cs index f02152fc0..c6d48f6df 100644 --- a/SAM/SAM.Analytical/Query/NormalDictionary.cs +++ b/SAM/SAM.Analytical/Query/NormalDictionary.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -26,7 +29,7 @@ public static Dictionary NormalDictionary(this AdjacencyCluste shell = new Shell(face3Ds); Dictionary result = new Dictionary(); - for(int i=0; i < face3Ds.Count(); i++) + for (int i = 0; i < face3Ds.Count(); i++) { result[panels[i]] = shell.Normal(face3Ds[i].InternalPoint3D(), external, silverSpacing, tolerance); } @@ -34,4 +37,4 @@ public static Dictionary NormalDictionary(this AdjacencyCluste return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/NusseltNumber.cs b/SAM/SAM.Analytical/Query/NusseltNumber.cs index c9d26aac3..f2e496128 100644 --- a/SAM/SAM.Analytical/Query/NusseltNumber.cs +++ b/SAM/SAM.Analytical/Query/NusseltNumber.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Analytical { @@ -109,4 +112,4 @@ public static double NusseltNumber_ConstantAndExponent(this FluidMaterial fluidM return constant * System.Math.Pow(grashofNumber * prandtlNumber, exponent); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/OccupancyGain.cs b/SAM/SAM.Analytical/Query/OccupancyGain.cs index a13ff6fbb..54016024e 100644 --- a/SAM/SAM.Analytical/Query/OccupancyGain.cs +++ b/SAM/SAM.Analytical/Query/OccupancyGain.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -23,4 +26,4 @@ public static double OccupancyGain(this Space space) return gain_1 + gain_2; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/OccupancyGainPerPerson.cs b/SAM/SAM.Analytical/Query/OccupancyGainPerPerson.cs index 1e5f60d10..71c1381cf 100644 --- a/SAM/SAM.Analytical/Query/OccupancyGainPerPerson.cs +++ b/SAM/SAM.Analytical/Query/OccupancyGainPerPerson.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -31,4 +34,4 @@ public static double OccupancyGainPerPerson(this Space space) return gain_1 + gain_2; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/OccupancyLatentGain.cs b/SAM/SAM.Analytical/Query/OccupancyLatentGain.cs index 96c320e64..8eb178df1 100644 --- a/SAM/SAM.Analytical/Query/OccupancyLatentGain.cs +++ b/SAM/SAM.Analytical/Query/OccupancyLatentGain.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -24,4 +27,4 @@ public static double OccupancyLatentGain(this Space space) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/OccupancySensibleGain.cs b/SAM/SAM.Analytical/Query/OccupancySensibleGain.cs index 4220d3dd4..b385ea85b 100644 --- a/SAM/SAM.Analytical/Query/OccupancySensibleGain.cs +++ b/SAM/SAM.Analytical/Query/OccupancySensibleGain.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -24,4 +27,4 @@ public static double OccupancySensibleGain(this Space space) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Offset.cs b/SAM/SAM.Analytical/Query/Offset.cs index 102d30603..31812b1fd 100644 --- a/SAM/SAM.Analytical/Query/Offset.cs +++ b/SAM/SAM.Analytical/Query/Offset.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -16,7 +19,7 @@ public static List Offset(this Panel panel, double offset, bool includeEx face3Ds.Sort((x, y) => y.GetArea().CompareTo(x.GetArea())); List result = new List(); - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { System.Guid guid = panel.Guid; while (result.Find(x => x.Guid == guid) != null) @@ -28,4 +31,4 @@ public static List Offset(this Panel panel, double offset, bool includeEx return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/OffsetAperturesOnEdge.cs b/SAM/SAM.Analytical/Query/OffsetAperturesOnEdge.cs index ac4264256..e0c741b0c 100644 --- a/SAM/SAM.Analytical/Query/OffsetAperturesOnEdge.cs +++ b/SAM/SAM.Analytical/Query/OffsetAperturesOnEdge.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -52,8 +55,8 @@ public static List OffsetAperturesOnEdge(this Panel panel, double dist List point2Ds_Intersections = Geometry.Planar.Query.Intersections(externalEdge, externalEdge_Aperture); if (point2Ds_Intersections == null || point2Ds_Intersections.Count == 0) - if(!externalEdge_Aperture.Inside(externalEdge)) - continue; + if (!externalEdge_Aperture.Inside(externalEdge)) + continue; polygon2Ds = Geometry.Planar.Query.Intersection(externalEdge_Aperture, externalEdge, tolerance); if (polygon2Ds == null || polygon2Ds.Count == 0) @@ -69,4 +72,4 @@ public static List OffsetAperturesOnEdge(this Panel panel, double dist return apertures; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Openable.cs b/SAM/SAM.Analytical/Query/Openable.cs index 3d7a80cb9..3ada3cf58 100644 --- a/SAM/SAM.Analytical/Query/Openable.cs +++ b/SAM/SAM.Analytical/Query/Openable.cs @@ -1,10 +1,13 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { public static bool Openable(this Aperture aperture) { - if(aperture == null) + if (aperture == null) { return false; } @@ -18,4 +21,4 @@ public static bool Openable(this Aperture aperture) return dichargeCoefficient != 0; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/OpeningLocation.cs b/SAM/SAM.Analytical/Query/OpeningLocation.cs index bbcc76343..a7b27a899 100644 --- a/SAM/SAM.Analytical/Query/OpeningLocation.cs +++ b/SAM/SAM.Analytical/Query/OpeningLocation.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Analytical { @@ -6,7 +9,7 @@ public static partial class Query { public static Point3D OpeningLocation(this IClosedPlanar3D closedPlanar3D, double tolerance = Core.Tolerance.Distance) { - if(closedPlanar3D == null) + if (closedPlanar3D == null) { return null; } @@ -22,4 +25,4 @@ public static Point3D OpeningLocation(this IClosedPlanar3D closedPlanar3D, doubl return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Overlap.cs b/SAM/SAM.Analytical/Query/Overlap.cs index 1ac6668dc..d8ac1c0ed 100644 --- a/SAM/SAM.Analytical/Query/Overlap.cs +++ b/SAM/SAM.Analytical/Query/Overlap.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Analytical { @@ -20,4 +23,4 @@ public static bool Overlap(this Panel panel_1, Panel panel_2, double tolerance_A return Geometry.Spatial.Query.Overlap(face3D_1, face3D_2, tolerance_Angle, tolerance_Distance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/OverlapPanels.cs b/SAM/SAM.Analytical/Query/OverlapPanels.cs index 3900681d3..7646c34ca 100644 --- a/SAM/SAM.Analytical/Query/OverlapPanels.cs +++ b/SAM/SAM.Analytical/Query/OverlapPanels.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System; using System.Collections.Generic; using System.Linq; @@ -25,4 +28,4 @@ public static List> OverlapPanels(this IEnumerable panels, do return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/PaneApertureConstructionUniqueName.cs b/SAM/SAM.Analytical/Query/PaneApertureConstructionUniqueName.cs index bafae4bc8..16d72c2c0 100644 --- a/SAM/SAM.Analytical/Query/PaneApertureConstructionUniqueName.cs +++ b/SAM/SAM.Analytical/Query/PaneApertureConstructionUniqueName.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -15,4 +18,4 @@ public static string PaneApertureConstructionUniqueName(string name) return string.Format("{0} -pane", name); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/PanelGroup.cs b/SAM/SAM.Analytical/Query/PanelGroup.cs index 2ad210292..86d8797f6 100644 --- a/SAM/SAM.Analytical/Query/PanelGroup.cs +++ b/SAM/SAM.Analytical/Query/PanelGroup.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -34,4 +37,4 @@ public static PanelGroup PanelGroup(this PanelType panelType) } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/PanelType.cs b/SAM/SAM.Analytical/Query/PanelType.cs index acdaaa621..66208d1d9 100644 --- a/SAM/SAM.Analytical/Query/PanelType.cs +++ b/SAM/SAM.Analytical/Query/PanelType.cs @@ -1,4 +1,7 @@ -using SAM.Architectural; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Architectural; using System; namespace SAM.Analytical @@ -9,7 +12,7 @@ public static PanelType PanelType(this object @object) { if (@object == null) return Analytical.PanelType.Undefined; - + if (@object is PanelType) return (PanelType)@object; @@ -32,7 +35,7 @@ public static PanelType PanelType(this object @object) return Analytical.PanelType.Undefined; } - + if (@object is ApertureConstruction) { @@ -102,7 +105,7 @@ public static PanelType PanelType(string text, bool includeDefaultConstructionNa { string value = null; - if(includeDefaultConstructionNames) + if (includeDefaultConstructionNames) { value = DefaultConstruction(panelType)?.Name; if (text.Equals(value)) @@ -137,7 +140,7 @@ public static PanelType PanelType(string text, bool includeDefaultConstructionNa if (partition is IHostPartition) { IHostPartition hostPartition = partition as IHostPartition; - if(hostPartition is Wall) + if (hostPartition is Wall) { Wall wall = (Wall)hostPartition; @@ -168,14 +171,14 @@ public static PanelType PanelType(string text, bool includeDefaultConstructionNa return Analytical.PanelType.Wall; } - if(hostPartition is Floor) + if (hostPartition is Floor) { Floor floor = (Floor)hostPartition; ITerrain terrain = buildingModel.Terrain; - if(terrain != null) + if (terrain != null) { - if(terrain.On(floor)) + if (terrain.On(floor)) { return Analytical.PanelType.SlabOnGrade; } @@ -199,7 +202,7 @@ public static PanelType PanelType(string text, bool includeDefaultConstructionNa return Analytical.PanelType.Floor; } - if(hostPartition is Roof) + if (hostPartition is Roof) { Roof roof = (Roof)hostPartition; @@ -210,4 +213,4 @@ public static PanelType PanelType(string text, bool includeDefaultConstructionNa return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Panels.cs b/SAM/SAM.Analytical/Query/Panels.cs index 1e50369ee..d6a388b52 100644 --- a/SAM/SAM.Analytical/Query/Panels.cs +++ b/SAM/SAM.Analytical/Query/Panels.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -27,7 +30,7 @@ public static List Panels(this AdjacencyCluster adjacencyCluster, Constru public static List Panels(this Point3D point3D, IEnumerable panels, bool onEdgeOnly = false, double tolerance = Core.Tolerance.Distance) { - if(point3D == null || panels == null) + if (point3D == null || panels == null) { return null; } @@ -36,14 +39,14 @@ public static List Panels(this Point3D point3D, IEnumerable panels foreach (Panel panel in panels) { Face3D face3D = panel?.GetFace3D(); - if(face3D == null) + if (face3D == null) { continue; } bool add = false; - if(onEdgeOnly) + if (onEdgeOnly) { add = face3D.OnEdge(point3D, tolerance); } @@ -52,7 +55,7 @@ public static List Panels(this Point3D point3D, IEnumerable panels add = face3D.On(point3D, tolerance) || face3D.OnEdge(point3D, tolerance); } - if(add) + if (add) { result.Add(panel); } @@ -62,4 +65,4 @@ public static List Panels(this Point3D point3D, IEnumerable panels } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/PanelsByFace3D.cs b/SAM/SAM.Analytical/Query/PanelsByFace3D.cs index 60dbd2756..2a4f78019 100644 --- a/SAM/SAM.Analytical/Query/PanelsByFace3D.cs +++ b/SAM/SAM.Analytical/Query/PanelsByFace3D.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System; using System.Collections.Generic; using System.Linq; @@ -15,20 +18,20 @@ public static List PanelsByFace3D(this IEnumerable panels, Face3D public static List PanelsByFace3D(this IEnumerable panels, Face3D face3D, double areaFactor, double maxDistance, out List intersectionAreas, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { intersectionAreas = null; - + if (panels == null || face3D == null) { return null; } Plane plane = face3D.GetPlane(); - if(plane == null) + if (plane == null) { return null; } BoundingBox3D boundingBox3D = face3D.GetBoundingBox(); - if(boundingBox3D == null) + if (boundingBox3D == null) { return null; } @@ -36,62 +39,62 @@ public static List PanelsByFace3D(this IEnumerable panels, Face3D Geometry.Planar.Face2D face2D = plane.Convert(face3D); double area = face2D.GetArea(); - if(area < tolerance_Distance) + if (area < tolerance_Distance) { return null; } - List> tuples = new List>(); - foreach(Panel panel in panels) + List> tuples = new List>(); + foreach (Panel panel in panels) { Face3D face3D_Panel = panel?.GetFace3D(); - if(face3D_Panel == null) + if (face3D_Panel == null) { continue; } Plane plane_Panel = face3D_Panel.GetPlane(); - if(plane_Panel == null) + if (plane_Panel == null) { continue; } - if(plane.Normal.SmallestAngle(plane_Panel.Normal) > tolerance_Angle) + if (plane.Normal.SmallestAngle(plane_Panel.Normal) > tolerance_Angle) { continue; } BoundingBox3D boundingBox3D_Panel = face3D_Panel.GetBoundingBox(); - if(boundingBox3D_Panel == null) + if (boundingBox3D_Panel == null) { continue; } - if(!boundingBox3D.InRange(boundingBox3D_Panel, maxDistance)) + if (!boundingBox3D.InRange(boundingBox3D_Panel, maxDistance)) { continue; } double distance = face3D.Distance(face3D_Panel, tolerance_Angle, tolerance_Distance); - if(distance > maxDistance) + if (distance > maxDistance) { continue; } Geometry.Planar.Face2D face2D_Panel = plane.Convert(plane.Project(face3D_Panel)); - if(face3D_Panel == null) + if (face3D_Panel == null) { continue; } List face2Ds = Geometry.Planar.Query.Intersection(face2D, face2D_Panel, tolerance_Distance); - if(face2Ds == null || face2Ds.Count == 0) + if (face2Ds == null || face2Ds.Count == 0) { continue; } double area_Intersection = face2Ds.ConvertAll(x => x.GetArea()).Sum(); - if(area_Intersection / area < areaFactor) + if (area_Intersection / area < areaFactor) { continue; } @@ -100,7 +103,7 @@ public static List PanelsByFace3D(this IEnumerable panels, Face3D } - if(tuples == null || tuples.Count == 0) + if (tuples == null || tuples.Count == 0) { return null; } @@ -114,4 +117,4 @@ public static List PanelsByFace3D(this IEnumerable panels, Face3D return tuples.ConvertAll(x => x.Item1); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Point3Ds.cs b/SAM/SAM.Analytical/Query/Point3Ds.cs index d6db9c791..6651b42b5 100644 --- a/SAM/SAM.Analytical/Query/Point3Ds.cs +++ b/SAM/SAM.Analytical/Query/Point3Ds.cs @@ -1,15 +1,18 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; namespace SAM.Analytical { public static partial class Query { - + public static List Point3Ds(this Panel panel, bool externalEdge = true, bool internalEdges = true) { Face3D face3D = panel?.GetFace3D(); - if(face3D == null || !face3D.IsValid()) + if (face3D == null || !face3D.IsValid()) { return null; } @@ -17,4 +20,4 @@ public static List Point3Ds(this Panel panel, bool externalEdge = true, return Geometry.Spatial.Query.Point3Ds(face3D, externalEdge, internalEdges); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/PrandtlNumber.cs b/SAM/SAM.Analytical/Query/PrandtlNumber.cs index a4d0aa3c1..d8c2a2603 100644 --- a/SAM/SAM.Analytical/Query/PrandtlNumber.cs +++ b/SAM/SAM.Analytical/Query/PrandtlNumber.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Analytical { @@ -32,4 +35,4 @@ public static double PrandtlNumber(this FluidMaterial fluidMaterial) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Profile.cs b/SAM/SAM.Analytical/Query/Profile.cs index f06c3f990..597ddec53 100644 --- a/SAM/SAM.Analytical/Query/Profile.cs +++ b/SAM/SAM.Analytical/Query/Profile.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Analytical @@ -36,4 +39,4 @@ public static Profile Profile(this IEnumerable profiles, string name, P return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/ProfileGroup.cs b/SAM/SAM.Analytical/Query/ProfileGroup.cs index b9349e27d..c3fed27e1 100644 --- a/SAM/SAM.Analytical/Query/ProfileGroup.cs +++ b/SAM/SAM.Analytical/Query/ProfileGroup.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -7,7 +10,7 @@ public static ProfileGroup ProfileGroup(this ProfileType profileType) if (profileType == ProfileType.Undefined || profileType == ProfileType.Other) return Analytical.ProfileGroup.Undefined; - switch(profileType) + switch (profileType) { case ProfileType.Dehumidification: case ProfileType.Humidification: @@ -33,4 +36,4 @@ public static ProfileGroup ProfileGroup(this ProfileType profileType) return Analytical.ProfileGroup.Undefined; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Profiles.cs b/SAM/SAM.Analytical/Query/Profiles.cs index 2a0ee61e0..b0e8425bd 100644 --- a/SAM/SAM.Analytical/Query/Profiles.cs +++ b/SAM/SAM.Analytical/Query/Profiles.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Analytical @@ -38,7 +41,7 @@ public static IEnumerable Profiles(this IEnumerable spaces, Prof return null; Dictionary dictionary = new Dictionary(); - foreach(Space space in spaces) + foreach (Space space in spaces) { InternalCondition internalCondition = space?.InternalCondition; if (internalCondition == null) @@ -48,7 +51,7 @@ public static IEnumerable Profiles(this IEnumerable spaces, Prof if (profiles == null) continue; - foreach(Profile profile in profiles) + foreach (Profile profile in profiles) { if (profile == null) continue; @@ -68,4 +71,4 @@ public static IEnumerable Profiles(this AdjacencyCluster adjacencyClust return Profiles(adjacencyCluster.GetSpaces(), profileLibrary, includeProfileGroup); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Rectangular.cs b/SAM/SAM.Analytical/Query/Rectangular.cs index 9c6309c80..25008ad07 100644 --- a/SAM/SAM.Analytical/Query/Rectangular.cs +++ b/SAM/SAM.Analytical/Query/Rectangular.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Analytical { @@ -22,4 +25,4 @@ public static bool Rectangular(this Aperture aperture, double tolerance = Core.T return Geometry.Spatial.Query.Rectangular(face3D, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/ReplaceNameSpecialCharacters.cs b/SAM/SAM.Analytical/Query/ReplaceNameSpecialCharacters.cs index f7b1586b1..bb72a4f8d 100644 --- a/SAM/SAM.Analytical/Query/ReplaceNameSpecialCharacters.cs +++ b/SAM/SAM.Analytical/Query/ReplaceNameSpecialCharacters.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -102,4 +105,4 @@ public static Aperture ReplaceNameSpecialCharacters(Aperture aperture, string la return new Aperture(aperture, apertureConstruction_New); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Rescale.cs b/SAM/SAM.Analytical/Query/Rescale.cs index 2f04140eb..c9819abf3 100644 --- a/SAM/SAM.Analytical/Query/Rescale.cs +++ b/SAM/SAM.Analytical/Query/Rescale.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -11,49 +14,49 @@ public static partial class Query public static Aperture Rescale(this Aperture aperture, double scale, double tolerance = Core.Tolerance.MacroDistance) { Face3D face3D = aperture?.GetFace3D(); - if(face3D is null) + if (face3D is null) { return null; } Plane plane = face3D.GetPlane(); - if(plane is null) + if (plane is null) { return null; } - if(face3D.ExternalEdge2D is not Polygon2D externalEdge) + if (face3D.ExternalEdge2D is not Polygon2D externalEdge) { return null; } double area = externalEdge.GetArea(); - if(double.IsNaN(area)) + if (double.IsNaN(area)) { return null; } double area_Temp = area * scale; - if(double.IsNaN(area_Temp) || Core.Query.AlmostEqual(area_Temp, 0, tolerance)) + if (double.IsNaN(area_Temp) || Core.Query.AlmostEqual(area_Temp, 0, tolerance)) { return null; } - if(Core.Query.AlmostEqual(area_Temp, area, tolerance)) + if (Core.Query.AlmostEqual(area_Temp, area, tolerance)) { return new Aperture(aperture); } Rectangle2D rectangle2D = Geometry.Planar.Create.Rectangle2D(externalEdge, tolerance); - if(rectangle2D is null) + if (rectangle2D is null) { return null; } Func func = (offset) => { - if(externalEdge.Offset(offset) is not List polygon2Ds) + if (externalEdge.Offset(offset) is not List polygon2Ds) { return 0; } @@ -61,7 +64,7 @@ public static Aperture Rescale(this Aperture aperture, double scale, double tole polygon2Ds.Sort((x, y) => x.GetArea().CompareTo(y.GetArea())); double area_Offset = polygon2Ds.Last().GetArea(); - if(double.IsNaN(area_Offset)) + if (double.IsNaN(area_Offset)) { return double.NaN; } @@ -70,14 +73,14 @@ public static Aperture Rescale(this Aperture aperture, double scale, double tole double start = 0; double end = System.Math.Max(rectangle2D.Width, rectangle2D.Height) / 2; - if(scale < 1) + if (scale < 1) { end = -end; } double offset = Core.Query.Calculate_ByDivision(func, area_Temp, start, end, tolerance: tolerance); - if(double.IsNaN(offset)) + if (double.IsNaN(offset)) { return null; } @@ -92,10 +95,10 @@ public static Aperture Rescale(this Aperture aperture, double scale, double tole externalEdge = polygon2Ds[0]; Face3D face3D_New = null; - if(face3D.InternalEdge2Ds is List internalEdges && internalEdges.Count != 0) + if (face3D.InternalEdge2Ds is List internalEdges && internalEdges.Count != 0) { double area_InternalEdges = internalEdges.ConvertAll(x => x.GetArea()).Sum(); - if(!double.IsNaN(area_InternalEdges) && area_InternalEdges > 0) + if (!double.IsNaN(area_InternalEdges) && area_InternalEdges > 0) { double area_Frame = (area - area_InternalEdges); area_Temp = area - (area_Frame * scale); @@ -108,7 +111,7 @@ public static Aperture Rescale(this Aperture aperture, double scale, double tole } } - if(face3D_New is null) + if (face3D_New is null) { face3D_New = new Face3D(plane.Convert(externalEdge)); } @@ -116,4 +119,4 @@ public static Aperture Rescale(this Aperture aperture, double scale, double tole return new Aperture(aperture.Guid, aperture, face3D_New); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/ResourcesDirectory.cs b/SAM/SAM.Analytical/Query/ResourcesDirectory.cs index 46a765946..12ff62ea2 100644 --- a/SAM/SAM.Analytical/Query/ResourcesDirectory.cs +++ b/SAM/SAM.Analytical/Query/ResourcesDirectory.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -7,4 +10,4 @@ public static string ResourcesDirectory() return Core.Query.ResourcesDirectory(Core.ActiveSetting.Setting, typeof(ActiveSetting).Assembly); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/RiserName.cs b/SAM/SAM.Analytical/Query/RiserName.cs index 4af2773e5..f775f84d2 100644 --- a/SAM/SAM.Analytical/Query/RiserName.cs +++ b/SAM/SAM.Analytical/Query/RiserName.cs @@ -1,11 +1,14 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { public static string RiserName(this MechanicalSystemCategory mechanicalSystemCategory, int index = 1) { string prefix = RiserNamePrefix(mechanicalSystemCategory); - if(prefix == null) + if (prefix == null) { return null; } @@ -13,4 +16,4 @@ public static string RiserName(this MechanicalSystemCategory mechanicalSystemCat return string.Format("{0}{1}", prefix, index).Trim(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/RiserNamePrefix.cs b/SAM/SAM.Analytical/Query/RiserNamePrefix.cs index e9323bcf4..da6935eab 100644 --- a/SAM/SAM.Analytical/Query/RiserNamePrefix.cs +++ b/SAM/SAM.Analytical/Query/RiserNamePrefix.cs @@ -1,10 +1,13 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { public static string RiserNamePrefix(this MechanicalSystemCategory mechanicalSystemCategory) { - switch(mechanicalSystemCategory) + switch (mechanicalSystemCategory) { case Analytical.MechanicalSystemCategory.Cooling: return "RC"; @@ -19,4 +22,4 @@ public static string RiserNamePrefix(this MechanicalSystemCategory mechanicalSys return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/RiserNameSpaceParameter.cs b/SAM/SAM.Analytical/Query/RiserNameSpaceParameter.cs index 66c1ebb5a..7d0f26414 100644 --- a/SAM/SAM.Analytical/Query/RiserNameSpaceParameter.cs +++ b/SAM/SAM.Analytical/Query/RiserNameSpaceParameter.cs @@ -1,15 +1,18 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { public static SpaceParameter? RiserNameSpaceParameter(this MechanicalSystemCategory mechanicalSystemCategory) { - if(mechanicalSystemCategory == Analytical.MechanicalSystemCategory.Undefined || mechanicalSystemCategory == Analytical.MechanicalSystemCategory.Other) + if (mechanicalSystemCategory == Analytical.MechanicalSystemCategory.Undefined || mechanicalSystemCategory == Analytical.MechanicalSystemCategory.Other) { return null; } - switch(mechanicalSystemCategory) + switch (mechanicalSystemCategory) { case Analytical.MechanicalSystemCategory.Cooling: return SpaceParameter.CoolingRiserName; @@ -26,7 +29,7 @@ public static partial class Query public static SpaceParameter? RiserNameSpaceParameter(this MechanicalSystem mechanicalSystem) { - if(mechanicalSystem == null) + if (mechanicalSystem == null) { return null; } @@ -34,4 +37,4 @@ public static partial class Query return RiserNameSpaceParameter(mechanicalSystem.MechanicalSystemCategory()); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/SAMObject.cs b/SAM/SAM.Analytical/Query/SAMObject.cs index 27deedce8..2905c185f 100644 --- a/SAM/SAM.Analytical/Query/SAMObject.cs +++ b/SAM/SAM.Analytical/Query/SAMObject.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System; using System.Collections.Generic; @@ -6,7 +9,7 @@ namespace SAM.Analytical { public static partial class Query { - public static T SAMObject(this AnalyticalModel analyticalModel, Guid guid) where T: IParameterizedSAMObject + public static T SAMObject(this AnalyticalModel analyticalModel, Guid guid) where T : IParameterizedSAMObject { IParameterizedSAMObject jSAMObject = SAMObject(analyticalModel, typeof(T), guid); if (jSAMObject == null) @@ -24,7 +27,7 @@ public static T SAMObject(this AdjacencyCluster adjacencyCluster, Guid guid) return (T)jSAMObject; } - public static T SAMObject(this ProfileLibrary profileLibrary, Guid guid)where T : IParameterizedSAMObject + public static T SAMObject(this ProfileLibrary profileLibrary, Guid guid) where T : IParameterizedSAMObject { IParameterizedSAMObject jSAMObject = SAMObject(profileLibrary, guid); if (jSAMObject == null) @@ -38,7 +41,7 @@ public static IParameterizedSAMObject SAMObject(this AnalyticalModel analyticalM if (analyticalModel == null || type == null) return null; - if(typeof(Profile).IsAssignableFrom(type)) + if (typeof(Profile).IsAssignableFrom(type)) return analyticalModel.ProfileLibrary.SAMObject(guid); if (typeof(IMaterial).IsAssignableFrom(type)) @@ -62,7 +65,7 @@ public static IParameterizedSAMObject SAMObject(this AnalyticalModel analyticalM if (typeof(InternalCondition).IsAssignableFrom(type)) return analyticalModel.AdjacencyCluster?.SAMObject(type, guid); - if(typeof(Location).IsAssignableFrom(type)) + if (typeof(Location).IsAssignableFrom(type)) { Location location = analyticalModel.Location; if (location != null) @@ -139,4 +142,4 @@ public static IParameterizedSAMObject SAMObject(this ProfileLibrary profileLibra return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/SectionDictionary.cs b/SAM/SAM.Analytical/Query/SectionDictionary.cs index c5d4c8a47..100470eae 100644 --- a/SAM/SAM.Analytical/Query/SectionDictionary.cs +++ b/SAM/SAM.Analytical/Query/SectionDictionary.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System; using System.Collections.Generic; using System.Threading.Tasks; @@ -7,15 +10,15 @@ namespace SAM.Analytical { public static partial class Query { - public static Dictionary> SectionDictionary(this IEnumerable panels, Plane plane, double tolerance = Core.Tolerance.Distance) where T: Geometry.ISAMGeometry + public static Dictionary> SectionDictionary(this IEnumerable panels, Plane plane, double tolerance = Core.Tolerance.Distance) where T : Geometry.ISAMGeometry { if (plane == null || panels == null) return null; List>> tuples = new List>>(); - foreach(Panel panel in panels) + foreach (Panel panel in panels) { - if(panel == null) + if (panel == null) { continue; } @@ -23,15 +26,15 @@ public static Dictionary> SectionDictionary(this IEnumerable

    >(panel, new List())); } - if(tuples.Count == 0) + if (tuples.Count == 0) { return null; } - Parallel.For(0, tuples.Count, (int i) => + Parallel.For(0, tuples.Count, (int i) => { Panel panel = tuples[i].Item1; - + Face3D face3D = panel?.GetFace3D(); if (face3D == null) { @@ -87,9 +90,9 @@ public static Dictionary> SectionDictionary(this IEnumerable

    > result = new Dictionary>(); - foreach(Tuple> tuple in tuples) + foreach (Tuple> tuple in tuples) { - if(tuple.Item2 == null || tuple.Item2.Count == 0) + if (tuple.Item2 == null || tuple.Item2.Count == 0) { continue; } @@ -100,4 +103,4 @@ public static Dictionary> SectionDictionary(this IEnumerable

    (spaceGuid); - if(space == null) + if (space == null) { return null; } @@ -36,4 +39,4 @@ public static Geometry.Spatial.Shell Shell(this AdjacencyCluster adjacencyCluste return Shell(adjacencyCluster, space); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/ShellDictionary.cs b/SAM/SAM.Analytical/Query/ShellDictionary.cs index 436dcd701..a03fb9cd4 100644 --- a/SAM/SAM.Analytical/Query/ShellDictionary.cs +++ b/SAM/SAM.Analytical/Query/ShellDictionary.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -23,10 +26,10 @@ public static partial class Query continue; List face3Ds = new List(); - foreach(Panel panel in panels) + foreach (Panel panel in panels) { Geometry.Spatial.Face3D face3D = null; - if(!dictionary_Shell.TryGetValue(panel.Guid, out face3D)) + if (!dictionary_Shell.TryGetValue(panel.Guid, out face3D)) { face3D = panel.GetFace3D(); dictionary_Shell[panel.Guid] = face3D; @@ -42,4 +45,4 @@ public static partial class Query return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Shells.cs b/SAM/SAM.Analytical/Query/Shells.cs index 069de45be..53c4e201a 100644 --- a/SAM/SAM.Analytical/Query/Shells.cs +++ b/SAM/SAM.Analytical/Query/Shells.cs @@ -1,10 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Geometry.Object.Spatial; using SAM.Geometry.Planar; using SAM.Geometry.Spatial; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; namespace SAM.Analytical { @@ -209,7 +212,7 @@ public static List Shells(this IEnumerable panels, IEnumerable> dictionary = panels_Bottom.SectionDictionary(plane, tolerance_Distance); - if(dictionary != null) + if (dictionary != null) { List segment2Ds = new List(); foreach (KeyValuePair> keyValuePair in dictionary) @@ -253,7 +256,7 @@ public static List Shells(this IEnumerable panels, IEnumerable(plane, tolerance_Distance); - if(dictionary != null) + if (dictionary != null) { List segment2Ds = new List(); foreach (KeyValuePair> keyValuePair in dictionary) @@ -849,7 +852,7 @@ public static List Shells(this IEnumerable panels, IEnumerable= 0; i--) { - if(!valids[i]) + if (!valids[i]) { result.RemoveAt(i); } @@ -858,4 +861,4 @@ public static List Shells(this IEnumerable panels, IEnumerable occupiedHourIndicesExceedingAbsoluteLimit = tM52ExtendedResult.GetOccupiedHourIndicesExceedingAbsoluteLimit(); return new TM52Result( - tM52ExtendedResult.Name, - tM52ExtendedResult.Source, - tM52ExtendedResult.Reference, + tM52ExtendedResult.Name, + tM52ExtendedResult.Source, + tM52ExtendedResult.Reference, tM52ExtendedResult.TM52BuildingCategory, - tM52ExtendedResult.OccupiedHours, - tM52ExtendedResult.MaxExceedableHours, - tM52ExtendedResult.GetOccupiedHoursExceedingComfortRange(), + tM52ExtendedResult.OccupiedHours, + tM52ExtendedResult.MaxExceedableHours, + tM52ExtendedResult.GetOccupiedHoursExceedingComfortRange(), tM52ExtendedResult.GetOccupiedDailyWeightedExceedance(), occupiedHourIndicesExceedingAbsoluteLimit == null ? 0 : occupiedHourIndicesExceedingAbsoluteLimit.Count, - tM52ExtendedResult.Pass);; + tM52ExtendedResult.Pass); ; } - if(tMExtendedResult is TM59CorridorExtendedResult) + if (tMExtendedResult is TM59CorridorExtendedResult) { TM59CorridorExtendedResult tM59CorridorExtendedResult = (TM59CorridorExtendedResult)tMExtendedResult; @@ -100,4 +103,4 @@ public static TMResult Simplify(this TMExtendedResult tMExtendedResult) throw new System.NotImplementedException(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/SingleOpeningProperties.cs b/SAM/SAM.Analytical/Query/SingleOpeningProperties.cs index 1c18add37..2c121c501 100644 --- a/SAM/SAM.Analytical/Query/SingleOpeningProperties.cs +++ b/SAM/SAM.Analytical/Query/SingleOpeningProperties.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -61,4 +64,4 @@ public static ISingleOpeningProperties SingleOpeningProperties(this MultipleOpen return tuples[0].Item2; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/SizingMethod.cs b/SAM/SAM.Analytical/Query/SizingMethod.cs index bc1575f61..48231885f 100644 --- a/SAM/SAM.Analytical/Query/SizingMethod.cs +++ b/SAM/SAM.Analytical/Query/SizingMethod.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -13,4 +16,4 @@ public static SizingMethod SizingMethod(this SpaceSimulationResult spaceSimulati return Core.Query.Enum(text); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/SnapByElevations.cs b/SAM/SAM.Analytical/Query/SnapByElevations.cs index f13ce1c8b..1146a2bf1 100644 --- a/SAM/SAM.Analytical/Query/SnapByElevations.cs +++ b/SAM/SAM.Analytical/Query/SnapByElevations.cs @@ -1,9 +1,12 @@ -using System.Collections.Generic; -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Object.Spatial; using SAM.Geometry.Planar; +using SAM.Geometry.Spatial; using System; +using System.Collections.Generic; using System.Linq; -using SAM.Geometry.Object.Spatial; namespace SAM.Analytical { @@ -11,7 +14,7 @@ public static partial class Query { public static List SnapByElevations(this IEnumerable panels, IEnumerable elevations, int maxIterations = 1, double maxTolerance = Core.Tolerance.MacroDistance, double minTolerance = Core.Tolerance.MicroDistance) { - if(panels == null) + if (panels == null) { return null; } @@ -21,16 +24,16 @@ public static List SnapByElevations(this IEnumerable panels, IEnum List panels_Other = new List(); foreach (Panel panel in panels) { - if(panel == null) + if (panel == null) { continue; } - if(panel.Horizontal(maxTolerance)) + if (panel.Horizontal(maxTolerance)) { panels_Horizontal.Add(panel); } - else if(panel.Rectangular(maxTolerance)) + else if (panel.Rectangular(maxTolerance)) { panels_Rectangular.Add(panel); } @@ -75,7 +78,7 @@ public static List SnapByElevations(this IEnumerable panels, IEnum panels_Rectangular = SnapByElevations_Ends(panels_Rectangular, elevations, maxTolerance, minTolerance); panels_Rectangular = SnapByElevations_Intersections(panels_Rectangular, elevations, maxTolerance, minTolerance); - if(count != -1) + if (count != -1) { dictionary = SpacingDictionary(panels_Rectangular, maxTolerance, minTolerance); if (dictionary == null || dictionary.Count == 0) @@ -84,12 +87,12 @@ public static List SnapByElevations(this IEnumerable panels, IEnum } int count_Temp = dictionary.Count; - if(count_Temp > count) + if (count_Temp > count) { panels_Rectangular = panels_Rectangular_Temp; break; } - else if(count_Temp == count) + else if (count_Temp == count) { break; } @@ -101,16 +104,16 @@ public static List SnapByElevations(this IEnumerable panels, IEnum if (panels_Rectangular != null && panels_Rectangular.Count != 0) { result.AddRange(panels_Rectangular); - foreach(Panel panel_Rectangular in panels_Rectangular) + foreach (Panel panel_Rectangular in panels_Rectangular) { BoundingBox3D boundingBox3D = panel_Rectangular?.GetBoundingBox(); - if(boundingBox3D == null) + if (boundingBox3D == null) { continue; } Face3D face3D = panel_Rectangular.GetFace3D(); - if(face3D == null) + if (face3D == null) { continue; } @@ -118,10 +121,10 @@ public static List SnapByElevations(this IEnumerable panels, IEnum dictionary_Segmentable3D[boundingBox3D] = new List(); List edge3Ds = face3D.GetEdge3Ds(); - foreach(IClosedPlanar3D edge3D in edge3Ds) + foreach (IClosedPlanar3D edge3D in edge3Ds) { ISegmentable3D segmentable3D = edge3D as ISegmentable3D; - if(segmentable3D == null) + if (segmentable3D == null) { continue; } @@ -134,15 +137,15 @@ public static List SnapByElevations(this IEnumerable panels, IEnum } //Horizontal - if(panels_Horizontal.Count != 0) + if (panels_Horizontal.Count != 0) { - foreach(Panel panel in panels_Horizontal) + foreach (Panel panel in panels_Horizontal) { List segmentable3Ds = new List(); BoundingBox3D boundingBox3D = panel.GetBoundingBox(); - foreach(KeyValuePair> keyValuePair in dictionary_Segmentable3D) + foreach (KeyValuePair> keyValuePair in dictionary_Segmentable3D) { - if(!boundingBox3D.InRange(keyValuePair.Key, maxTolerance)) + if (!boundingBox3D.InRange(keyValuePair.Key, maxTolerance)) { continue; } @@ -150,14 +153,14 @@ public static List SnapByElevations(this IEnumerable panels, IEnum segmentable3Ds.AddRange(keyValuePair.Value); } - if(segmentable3Ds == null || segmentable3Ds.Count == 0) + if (segmentable3Ds == null || segmentable3Ds.Count == 0) { result.Add(new Panel(panel)); continue; } Panel panel_Temp = panel.SnapByEnds(segmentable3Ds, maxTolerance, minTolerance); - if(panel_Temp == null) + if (panel_Temp == null) { panel_Temp = panel; } @@ -226,7 +229,7 @@ private static List SnapByElevations_Ends(this IEnumerable panels, } Dictionary> dictionary = new Dictionary>(); - foreach(double elevation in elevations) + foreach (double elevation in elevations) { Plane plane = Plane.WorldXY.GetMoved(Vector3D.WorldZ * elevation) as Plane; @@ -238,7 +241,7 @@ private static List SnapByElevations_Ends(this IEnumerable panels, foreach (KeyValuePair> keyValuePair in dictionary_Temp) { - if(dictionary.ContainsKey(keyValuePair.Key)) + if (dictionary.ContainsKey(keyValuePair.Key)) { continue; } @@ -352,12 +355,12 @@ private static List SnapByElevations_Ends(this IEnumerable panels, foreach (Tuple> tuple in tuples) { - if(tuple.Item2 == null || tuple.Item2.Count == 0) + if (tuple.Item2 == null || tuple.Item2.Count == 0) { result.Add(tuple.Item1); continue; } - + List> tuples_Point2D_Snap_Panel = new List>(); foreach (Segment2D segment2D in tuple.Item2) { @@ -385,7 +388,7 @@ private static List SnapByElevations_Ends(this IEnumerable panels, } } - if(!segment2D.IsValid() || segment2D.GetLength() < minTolerance) + if (!segment2D.IsValid() || segment2D.GetLength() < minTolerance) { continue; } @@ -404,7 +407,7 @@ private static List SnapByElevations_Ends(this IEnumerable panels, Segment3D segment3D = plane.Convert(segment2D); Face3D face3D = new Face3D(new Polygon3D(new Point3D[] { segment3D[0], segment3D[1], segment3D[1].GetMoved(vector3D) as Point3D, segment3D[0].GetMoved(vector3D) as Point3D })); - if(face3D.IsValid()) + if (face3D.IsValid()) { Panel panel = Create.Panel(guid, tuple.Item1, face3D, null, true, minTolerance, maxTolerance); //Panel panel = Create.Panel(guid, tuple.Item1, new PlanarBoundary3D())); @@ -480,25 +483,25 @@ private static List SnapByElevations_Intersections(this IEnumerable> tuples_Point2D_Snap = new List>(); - foreach(Tuple tuple in tuples_Point2D) + foreach (Tuple tuple in tuples_Point2D) { List segment2Ds_Temp = new List(); - foreach(Tuple tuple_Segment2D in tuples_Segment2D) + foreach (Tuple tuple_Segment2D in tuples_Segment2D) { - if(!tuple_Segment2D.Item2.InRange(tuple.Item1, maxTolerance)) + if (!tuple_Segment2D.Item2.InRange(tuple.Item1, maxTolerance)) { continue; } double distance = tuple_Segment2D.Item1.Distance(tuple.Item1); - if(distance <= maxTolerance && distance>= minTolerance) + if (distance <= maxTolerance && distance >= minTolerance) { segment2Ds_Temp.Add(tuple_Segment2D.Item1); } } segment2Ds_Temp.Remove(tuple.Item2); - if(segment2Ds_Temp.Count < 1) + if (segment2Ds_Temp.Count < 1) { continue; } @@ -506,7 +509,7 @@ private static List SnapByElevations_Intersections(this IEnumerable point2D_Intersections = Geometry.Planar.Query.Intersections(tuple.Item1, direction, segment2Ds_Temp, false, true, true, true, minTolerance); - if(point2D_Intersections == null || point2D_Intersections.Count == 0) + if (point2D_Intersections == null || point2D_Intersections.Count == 0) { continue; } @@ -515,9 +518,9 @@ private static List SnapByElevations_Intersections(this IEnumerable result = new List(); - foreach(Panel panel in panels) + foreach (Panel panel in panels) { - if(!dictionary.ContainsKey(panel)) + if (!dictionary.ContainsKey(panel)) { result.Add(panel); } @@ -584,4 +587,4 @@ private static List SnapByElevations_Intersections(this IEnumerable segmentable3Ds, double maxTolerance = Core.Tolerance.MacroDistance, double minTolerance = Core.Tolerance.MicroDistance) { - if(segmentable3Ds == null) + if (segmentable3Ds == null) { return null; } - if(segmentable3Ds.Count() == 0) + if (segmentable3Ds.Count() == 0) { return new Panel(panel); } @@ -25,15 +28,15 @@ public static Panel SnapByEnds(this Panel panel, IEnumerable seg } List point3Ds = new List(); - foreach(ISegmentable3D segmentable3D in segmentable3Ds) + foreach (ISegmentable3D segmentable3D in segmentable3Ds) { BoundingBox3D boundingBox3D_Segmentable3D = segmentable3D?.GetBoundingBox(); - if(boundingBox3D_Segmentable3D == null) + if (boundingBox3D_Segmentable3D == null) { continue; } - if(!boundingBox3D_Panel.InRange(boundingBox3D_Segmentable3D, maxTolerance)) + if (!boundingBox3D_Panel.InRange(boundingBox3D_Segmentable3D, maxTolerance)) { continue; } @@ -41,13 +44,13 @@ public static Panel SnapByEnds(this Panel panel, IEnumerable seg point3Ds.AddRange(segmentable3D.GetPoints()); } - if(point3Ds == null || point3Ds.Count == 0) + if (point3Ds == null || point3Ds.Count == 0) { return new Panel(panel); } point3Ds.RemoveAll(x => panel.DistanceToEdges(x) <= minTolerance); - if(point3Ds.Count == 0) + if (point3Ds.Count == 0) { return new Panel(panel); } @@ -55,4 +58,4 @@ public static Panel SnapByEnds(this Panel panel, IEnumerable seg return panel.SnapByPoints(point3Ds, maxTolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/SnapByIntersections.cs b/SAM/SAM.Analytical/Query/SnapByIntersections.cs index 4ef077176..b463e06ef 100644 --- a/SAM/SAM.Analytical/Query/SnapByIntersections.cs +++ b/SAM/SAM.Analytical/Query/SnapByIntersections.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -8,24 +11,24 @@ public static partial class Query { public static Panel SnapByIntersections(this Panel panel, IEnumerable segmentable3Ds, double maxTolerance = Core.Tolerance.MacroDistance, double minTolerance = Core.Tolerance.MicroDistance) { - if(segmentable3Ds == null) + if (segmentable3Ds == null) { return null; } - if(segmentable3Ds.Count() == 0) + if (segmentable3Ds.Count() == 0) { return new Panel(panel); } Face3D face3D = panel?.GetFace3D(); - if(face3D == null) + if (face3D == null) { return new Panel(panel); } BoundingBox3D boundingBox3D_Face3D = face3D.GetBoundingBox(); - if(boundingBox3D_Face3D == null) + if (boundingBox3D_Face3D == null) { return new Panel(panel); } @@ -33,16 +36,16 @@ public static Panel SnapByIntersections(this Panel panel, IEnumerable point3Ds = new List(); List edge3Ds = face3D.GetEdge3Ds(); - foreach(IClosedPlanar3D edge3D in edge3Ds) + foreach (IClosedPlanar3D edge3D in edge3Ds) { ISegmentable3D segmentable3D_Edge3D = edge3D as ISegmentable3D; - if(segmentable3D_Edge3D == null) + if (segmentable3D_Edge3D == null) { continue; } List point3Ds_Segmentable3D = segmentable3D_Edge3D.GetPoints(); - if(point3Ds_Segmentable3D == null || point3Ds_Segmentable3D.Count == 0) + if (point3Ds_Segmentable3D == null || point3Ds_Segmentable3D.Count == 0) { continue; } @@ -50,25 +53,25 @@ public static Panel SnapByIntersections(this Panel panel, IEnumerable minTolerance && distance < maxTolerance) + if (point3D != null && distance > minTolerance && distance < maxTolerance) { point3Ds.Add(point3D); } @@ -76,13 +79,13 @@ public static Panel SnapByIntersections(this Panel panel, IEnumerable panel.DistanceToEdges(x) <= minTolerance); - if(point3Ds.Count == 0) + if (point3Ds.Count == 0) { return new Panel(panel); } @@ -90,4 +93,4 @@ public static Panel SnapByIntersections(this Panel panel, IEnumerable SnapByOffset(this IEnumerable panels, do return SnapByPoints(panels, point3DList, maxDixtance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/SnapByPlanes.cs b/SAM/SAM.Analytical/Query/SnapByPlanes.cs index 9da13671c..a1d97339f 100644 --- a/SAM/SAM.Analytical/Query/SnapByPlanes.cs +++ b/SAM/SAM.Analytical/Query/SnapByPlanes.cs @@ -1,6 +1,9 @@ -using System.Collections.Generic; -using System.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Geometry.Spatial; +using System.Collections.Generic; +using System.Linq; namespace SAM.Analytical { @@ -22,7 +25,7 @@ public static List SnapByPlanes(this IEnumerable panels, IEnumerab } List result = new List(); - foreach(Panel panel in panels) + foreach (Panel panel in panels) { result.Add(panel?.SnapByPlanes(planes, maxDistance, tolerance)); } @@ -32,7 +35,7 @@ public static List SnapByPlanes(this IEnumerable panels, IEnumerab public static List SnapByPlanes(this IEnumerable panels, IEnumerable elevations, double maxDistance, double tolerance = Core.Tolerance.Distance) { - if(panels == null) + if (panels == null) { return null; } @@ -42,4 +45,4 @@ public static List SnapByPlanes(this IEnumerable panels, IEnumerab return SnapByPlanes(panels, planes, maxDistance, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/SnapByPoints.cs b/SAM/SAM.Analytical/Query/SnapByPoints.cs index 50a38287d..993766d36 100644 --- a/SAM/SAM.Analytical/Query/SnapByPoints.cs +++ b/SAM/SAM.Analytical/Query/SnapByPoints.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -19,4 +22,4 @@ public static IEnumerable SnapByPoints(this IEnumerable panels, IE return panels.ToList().ConvertAll(x => SnapByPoints(x, point3Ds, maxDixtance)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/SpaceShells.cs b/SAM/SAM.Analytical/Query/SpaceShells.cs index a639f10ed..39ff9d6cd 100644 --- a/SAM/SAM.Analytical/Query/SpaceShells.cs +++ b/SAM/SAM.Analytical/Query/SpaceShells.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -57,4 +60,4 @@ public static List SpaceShells(this IEnumerable shells, Point3D po return tuples.ConvertAll(x => x.Item3); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Spaces.cs b/SAM/SAM.Analytical/Query/Spaces.cs index 50e47e7ef..0cc184864 100644 --- a/SAM/SAM.Analytical/Query/Spaces.cs +++ b/SAM/SAM.Analytical/Query/Spaces.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -9,13 +12,13 @@ public static List Spaces(this AdjacencyCluster adjacencyCluster, string spaces_Supply = null; spaces_Exhaust = null; - if(adjacencyCluster == null || string.IsNullOrWhiteSpace(ventilationUnitName)) + if (adjacencyCluster == null || string.IsNullOrWhiteSpace(ventilationUnitName)) { return null; } List ventilationSystems = adjacencyCluster.VentilationSystems(ventilationUnitName, out List ventilationSystems_Supply, out List ventilationSystems_Exhaust); - if(ventilationSystems == null || ventilationSystems.Count == 0) + if (ventilationSystems == null || ventilationSystems.Count == 0) { return null; } @@ -26,11 +29,11 @@ public static List Spaces(this AdjacencyCluster adjacencyCluster, string foreach (VentilationSystem ventilationSystem in ventilationSystems_Supply) { List spaces_VentilationSystem = adjacencyCluster.GetRelatedObjects(ventilationSystem); - if(spaces_VentilationSystem != null) + if (spaces_VentilationSystem != null) { - foreach(Space space in spaces_VentilationSystem) + foreach (Space space in spaces_VentilationSystem) { - if(spaces_Supply.Find(x => x.Guid == space.Guid) == null) + if (spaces_Supply.Find(x => x.Guid == space.Guid) == null) { spaces_Supply.Add(space); if (result.Find(x => x.Guid == space.Guid) == null) @@ -72,4 +75,4 @@ public static List Spaces(this AdjacencyCluster adjacencyCluster, string return Spaces(adjacencyCluster, ventilationUnitName, out List spaces_Supply, out List spaces_Exhaust); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/SpacingDictionary.cs b/SAM/SAM.Analytical/Query/SpacingDictionary.cs index a23dd529b..6f7927663 100644 --- a/SAM/SAM.Analytical/Query/SpacingDictionary.cs +++ b/SAM/SAM.Analytical/Query/SpacingDictionary.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; namespace SAM.Analytical @@ -7,17 +10,17 @@ public static partial class Query { public static Dictionary> SpacingDictionary(this IEnumerable panels, double maxTolerance = Core.Tolerance.MacroDistance, double minTolerance = Core.Tolerance.MicroDistance) { - if(panels == null) + if (panels == null) { return null; - } + } Dictionary dictionary = new Dictionary(); - foreach(Panel panel in panels) + foreach (Panel panel in panels) { Face3D face3D = panel?.GetFace3D(); - if(face3D == null) + if (face3D == null) { continue; } @@ -27,16 +30,16 @@ public static Dictionary> SpacingDictionary(this IEnumerabl Dictionary> dictionary_Face3D = Geometry.Spatial.Query.SpacingDictionary(dictionary.Keys, maxTolerance, minTolerance); - if(dictionary == null) + if (dictionary == null) { return null; } Dictionary> result = new Dictionary>(); - foreach(KeyValuePair> keyValuePair in dictionary_Face3D) + foreach (KeyValuePair> keyValuePair in dictionary_Face3D) { - List panels_Temp = keyValuePair.Value.ConvertAll(x => dictionary[x]); - if(panels_Temp != null || panels_Temp.Count != 0) + List panels_Temp = keyValuePair.Value.ConvertAll(x => dictionary[x]); + if (panels_Temp != null || panels_Temp.Count != 0) { result[keyValuePair.Key] = panels_Temp; } @@ -45,4 +48,4 @@ public static Dictionary> SpacingDictionary(this IEnumerabl return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/SpecificDesignLoad.cs b/SAM/SAM.Analytical/Query/SpecificDesignLoad.cs index 72b6b3d64..9eb69ae46 100644 --- a/SAM/SAM.Analytical/Query/SpecificDesignLoad.cs +++ b/SAM/SAM.Analytical/Query/SpecificDesignLoad.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -19,4 +22,4 @@ public static double SpecificDesignLoad(this SpaceSimulationResult spaceSimulati return load / area; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/SpecificHeatTransferGain.cs b/SAM/SAM.Analytical/Query/SpecificHeatTransferGain.cs index 2bba803ac..ef42f6d4d 100644 --- a/SAM/SAM.Analytical/Query/SpecificHeatTransferGain.cs +++ b/SAM/SAM.Analytical/Query/SpecificHeatTransferGain.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -26,4 +29,4 @@ public static double SpecificBuildingHeatTransferGain(this SpaceSimulationResult return buildingHeatTransfer / area; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/SpecificLoad.cs b/SAM/SAM.Analytical/Query/SpecificLoad.cs index 83893cd2a..8fa18ffc3 100644 --- a/SAM/SAM.Analytical/Query/SpecificLoad.cs +++ b/SAM/SAM.Analytical/Query/SpecificLoad.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -19,4 +22,4 @@ public static double SpecificLoad(this SpaceSimulationResult spaceSimulationResu return load / area; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/SpecificOccupancySensibleGain.cs b/SAM/SAM.Analytical/Query/SpecificOccupancySensibleGain.cs index d5005405f..83447805d 100644 --- a/SAM/SAM.Analytical/Query/SpecificOccupancySensibleGain.cs +++ b/SAM/SAM.Analytical/Query/SpecificOccupancySensibleGain.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -21,4 +24,4 @@ public static double SpecificOccupancySensibleGain(this Space space) return occupancySensibleGain / area; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/SplitByConcaveEdges.cs b/SAM/SAM.Analytical/Query/SplitByConcaveEdges.cs index 9cf5f25b5..3c4173d39 100644 --- a/SAM/SAM.Analytical/Query/SplitByConcaveEdges.cs +++ b/SAM/SAM.Analytical/Query/SplitByConcaveEdges.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -20,7 +23,7 @@ public static List SplitByConcaveEdges(this Panel panel, double tolerance return null; List result = new List(); - for(int i=0; i < face3Ds.Count; i++) + for (int i = 0; i < face3Ds.Count; i++) { Face3D face3D_Temp = face3Ds[i]; @@ -43,21 +46,21 @@ public static AdjacencyCluster SplitByConcaveEdges(this AdjacencyCluster adjacen AdjacencyCluster result = new AdjacencyCluster(adjacencyCluster); List panels = result.GetPanels(); - if(panels != null && panels.Count > 0) + if (panels != null && panels.Count > 0) { - foreach(Panel panel in panels) + foreach (Panel panel in panels) { List panels_Split = panel.SplitByConcaveEdges(tolerance); if (panels_Split == null || panels_Split.Count < 2) continue; - List relatedObjects = result.GetRelatedObjects(panel); + List relatedObjects = result.GetRelatedObjects(panel); - foreach(Panel panel_Split in panels_Split) + foreach (Panel panel_Split in panels_Split) { result.AddObject(panel_Split); - if(relatedObjects != null && relatedObjects.Count > 0) + if (relatedObjects != null && relatedObjects.Count > 0) { foreach (IJSAMObject relatedObject in relatedObjects) { @@ -71,4 +74,4 @@ public static AdjacencyCluster SplitByConcaveEdges(this AdjacencyCluster adjacen return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/SplitByInternalEdges.cs b/SAM/SAM.Analytical/Query/SplitByInternalEdges.cs index b6ac4742b..16199fd67 100644 --- a/SAM/SAM.Analytical/Query/SplitByInternalEdges.cs +++ b/SAM/SAM.Analytical/Query/SplitByInternalEdges.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -20,7 +23,7 @@ public static List SplitByInternalEdges(this Panel panel, double toleranc return null; List result = new List(); - for(int i=0; i < face3Ds.Count; i++) + for (int i = 0; i < face3Ds.Count; i++) { Face3D face3D_Temp = face3Ds[i]; @@ -43,21 +46,21 @@ public static AdjacencyCluster SplitByInternalEdges(this AdjacencyCluster adjace AdjacencyCluster result = new AdjacencyCluster(adjacencyCluster); List panels = result.GetPanels(); - if(panels != null && panels.Count > 0) + if (panels != null && panels.Count > 0) { - foreach(Panel panel in panels) + foreach (Panel panel in panels) { List panels_Split = panel.SplitByInternalEdges(tolerance); if (panels_Split == null || panels_Split.Count < 2) continue; - List relatedObjects = result.GetRelatedObjects(panel); + List relatedObjects = result.GetRelatedObjects(panel); - foreach(Panel panel_Split in panels_Split) + foreach (Panel panel_Split in panels_Split) { result.AddObject(panel_Split); - if(relatedObjects != null && relatedObjects.Count > 0) + if (relatedObjects != null && relatedObjects.Count > 0) { foreach (IJSAMObject relatedObject in relatedObjects) { @@ -71,4 +74,4 @@ public static AdjacencyCluster SplitByInternalEdges(this AdjacencyCluster adjace return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Sum.cs b/SAM/SAM.Analytical/Query/Sum.cs index 2e0a3e823..53338d710 100644 --- a/SAM/SAM.Analytical/Query/Sum.cs +++ b/SAM/SAM.Analytical/Query/Sum.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -78,4 +81,4 @@ public static double Sum(this IEnumerable spaceSimulation return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/SystemTypeInternalConditionParameter.cs b/SAM/SAM.Analytical/Query/SystemTypeInternalConditionParameter.cs index 0be3f5ce8..7ac3660c7 100644 --- a/SAM/SAM.Analytical/Query/SystemTypeInternalConditionParameter.cs +++ b/SAM/SAM.Analytical/Query/SystemTypeInternalConditionParameter.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -20,4 +23,4 @@ public static partial class Query return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Systems.cs b/SAM/SAM.Analytical/Query/Systems.cs index 790ee8e3f..d7c570f9a 100644 --- a/SAM/SAM.Analytical/Query/Systems.cs +++ b/SAM/SAM.Analytical/Query/Systems.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -6,7 +9,7 @@ public static partial class Query { public static List Systems(this AdjacencyCluster adjacencyCluster, Space space) where T : MechanicalSystem { - if(adjacencyCluster == null || space == null) + if (adjacencyCluster == null || space == null) { return null; } @@ -24,4 +27,4 @@ public static List Systems(this AnalyticalModel analyticalModel, Space spa return analyticalModel.AdjacencyCluster?.GetRelatedObjects(space); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/TemperatureRange.cs b/SAM/SAM.Analytical/Query/TemperatureRange.cs index 421f8b5a0..851521d41 100644 --- a/SAM/SAM.Analytical/Query/TemperatureRange.cs +++ b/SAM/SAM.Analytical/Query/TemperatureRange.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Analytical { @@ -11,7 +14,7 @@ public static Range TemperatureRange(this TM52BuildingCategory tM52Build return null; } - switch(tM52BuildingCategory) + switch (tM52BuildingCategory) { case TM52BuildingCategory.CategoryI: return new Range(-3, 2); @@ -29,4 +32,4 @@ public static Range TemperatureRange(this TM52BuildingCategory tM52Build return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Text.cs b/SAM/SAM.Analytical/Query/Text.cs index 0b045bd3c..97e673b29 100644 --- a/SAM/SAM.Analytical/Query/Text.cs +++ b/SAM/SAM.Analytical/Query/Text.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Analytical { @@ -9,4 +12,4 @@ public static string Text(this Enum @enum) return Core.Query.Description(@enum); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Tilt.cs b/SAM/SAM.Analytical/Query/Tilt.cs index dfab9c0c6..7330a10aa 100644 --- a/SAM/SAM.Analytical/Query/Tilt.cs +++ b/SAM/SAM.Analytical/Query/Tilt.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -28,4 +31,4 @@ public static double Tilt(this Aperture aperture) return Geometry.Spatial.Query.Tilt(aperture.GetFace3D()); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Transparent.cs b/SAM/SAM.Analytical/Query/Transparent.cs index 37ff10fa0..36eab6672 100644 --- a/SAM/SAM.Analytical/Query/Transparent.cs +++ b/SAM/SAM.Analytical/Query/Transparent.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Analytical @@ -29,11 +32,11 @@ public static bool Transparent(this ApertureConstruction apertureConstruction, M } List constructionLayers = apertureConstruction.PaneConstructionLayers; - if(constructionLayers == null || constructionLayers.Count == 0) + if (constructionLayers == null || constructionLayers.Count == 0) { constructionLayers = apertureConstruction.FrameConstructionLayers; } - + MaterialType materialType = MaterialType(constructionLayers, materialLibrary); return materialType == Core.MaterialType.Transparent; } @@ -67,7 +70,7 @@ public static bool Transparent(this Aperture aperture, MaterialLibrary materialL public static bool Transparent(this IEnumerable constructionLayers, MaterialLibrary materialLibrary) { - if(constructionLayers == null || materialLibrary == null) + if (constructionLayers == null || materialLibrary == null) { return false; } @@ -76,4 +79,4 @@ public static bool Transparent(this IEnumerable constructionL return materialType == Core.MaterialType.Transparent; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/TransparentPanels.cs b/SAM/SAM.Analytical/Query/TransparentPanels.cs index b42b08c29..539a7cdf1 100644 --- a/SAM/SAM.Analytical/Query/TransparentPanels.cs +++ b/SAM/SAM.Analytical/Query/TransparentPanels.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Analytical @@ -27,12 +30,12 @@ public static List TransparentPanels(this IEnumerable panels, Mate foreach (Panel panel in panels) { - if(panel == null) + if (panel == null) { continue; } - if(!panel.Transparent(materialLibrary)) + if (!panel.Transparent(materialLibrary)) { continue; } @@ -43,4 +46,4 @@ public static List TransparentPanels(this IEnumerable panels, Mate return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Triangulate.cs b/SAM/SAM.Analytical/Query/Triangulate.cs index 124eb1fe2..7578fd2e3 100644 --- a/SAM/SAM.Analytical/Query/Triangulate.cs +++ b/SAM/SAM.Analytical/Query/Triangulate.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -20,7 +23,7 @@ public static List Triangulate(this Panel panel, double tolerance = Core. return null; List result = new List(); - for(int i=0; i < face3Ds.Count; i++) + for (int i = 0; i < face3Ds.Count; i++) { Face3D face3D_Temp = face3Ds[i]; @@ -79,25 +82,25 @@ public static AdjacencyCluster Triangulate(this AdjacencyCluster adjacencyCluste return null; AdjacencyCluster result = new AdjacencyCluster(adjacencyCluster); - if(!includePanels && !includeApertures) + if (!includePanels && !includeApertures) { return result; } - + List panels = result.GetPanels(); - if(panels != null && panels.Count > 0) + if (panels != null && panels.Count > 0) { - foreach(Panel panel in panels) + foreach (Panel panel in panels) { - if(panel == null) + if (panel == null) { continue; } List panels_Temp = null; - if(includePanels) + if (includePanels) { - if(internalEdgesOnly) + if (internalEdgesOnly) { Face3D face3D = panel.GetFace3D(); if (face3D == null) @@ -106,7 +109,7 @@ public static AdjacencyCluster Triangulate(this AdjacencyCluster adjacencyCluste } List internalEdge2Ds = face3D.InternalEdge2Ds; - if(internalEdge2Ds == null || internalEdge2Ds.Count == 0) + if (internalEdge2Ds == null || internalEdge2Ds.Count == 0) { continue; } @@ -119,33 +122,33 @@ public static AdjacencyCluster Triangulate(this AdjacencyCluster adjacencyCluste panels_Temp = new List() { new Panel(panel) }; } - if(panels_Temp == null) + if (panels_Temp == null) { continue; } - List relatedObjects = result.GetRelatedObjects(panel); + List relatedObjects = result.GetRelatedObjects(panel); - foreach(Panel panel_Temp in panels_Temp) + foreach (Panel panel_Temp in panels_Temp) { - if(panel_Temp == null) + if (panel_Temp == null) { continue; } - if(includeApertures && panel_Temp.HasApertures) + if (includeApertures && panel_Temp.HasApertures) { List apertures = panel_Temp.Apertures; panel_Temp.RemoveApertures(); - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { aperture.Triangulate(tolerance)?.ForEach(x => panel_Temp.AddAperture(x)); } } - + result.AddObject(panel_Temp); - if(relatedObjects != null && relatedObjects.Count > 0) + if (relatedObjects != null && relatedObjects.Count > 0) { foreach (IJSAMObject relatedObject in relatedObjects) { @@ -160,4 +163,4 @@ public static AdjacencyCluster Triangulate(this AdjacencyCluster adjacencyCluste return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/TryGetConstruction.cs b/SAM/SAM.Analytical/Query/TryGetConstruction.cs index f42613a0b..0c1527a4c 100644 --- a/SAM/SAM.Analytical/Query/TryGetConstruction.cs +++ b/SAM/SAM.Analytical/Query/TryGetConstruction.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -48,7 +51,7 @@ public static bool TryGetConstruction(IEnumerable panels_All, IEnumerable List panels_Temp = null; panels_Temp = panels?.ToList().FindAll(x => PanelGroup(x.PanelType) == Analytical.PanelGroup.Wall); - if(panels_Temp == null || panels_Temp.Count == 0) + if (panels_Temp == null || panels_Temp.Count == 0) panels_Temp = panels_All?.ToList().FindAll(x => PanelGroup(x.PanelType) == Analytical.PanelGroup.Wall); if (panels_Temp != null && panels_Temp.Count > 0) @@ -141,4 +144,4 @@ public static bool TryGetConstruction(IEnumerable panels_All, IEnumerable return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/TryGetEnums.cs b/SAM/SAM.Analytical/Query/TryGetEnums.cs index 5795260fd..6e06cac6d 100644 --- a/SAM/SAM.Analytical/Query/TryGetEnums.cs +++ b/SAM/SAM.Analytical/Query/TryGetEnums.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Analytical { @@ -9,14 +12,14 @@ public static bool TryGetEnums(string id, out FlowClassification flowClassificat flowClassification = FlowClassification.Undefined; direction = Direction.Undefined; - if(string.IsNullOrWhiteSpace(id)) + if (string.IsNullOrWhiteSpace(id)) { return false; } - foreach(FlowClassification flowClassification_Temp in System.Enum.GetValues(typeof(FlowClassification))) + foreach (FlowClassification flowClassification_Temp in System.Enum.GetValues(typeof(FlowClassification))) { - if(id.StartsWith(flowClassification_Temp.Description())) + if (id.StartsWith(flowClassification_Temp.Description())) { flowClassification = flowClassification_Temp; break; @@ -35,4 +38,4 @@ public static bool TryGetEnums(string id, out FlowClassification flowClassificat return flowClassification != FlowClassification.Undefined && direction != Direction.Undefined; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/TryGetInternalCondition.cs b/SAM/SAM.Analytical/Query/TryGetInternalCondition.cs index e16d54bfe..10a756f30 100644 --- a/SAM/SAM.Analytical/Query/TryGetInternalCondition.cs +++ b/SAM/SAM.Analytical/Query/TryGetInternalCondition.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Analytical @@ -9,7 +12,7 @@ public static bool TryGetInternalCondition(this Space space, InternalConditionLi { internalCondition = null; - if(!TryGetInternalConditions(space, internalConditionLibrary, textMap, out List internalConditions) || internalConditions == null || internalConditions.Count == 0) + if (!TryGetInternalConditions(space, internalConditionLibrary, textMap, out List internalConditions) || internalConditions == null || internalConditions.Count == 0) { return false; } @@ -18,4 +21,4 @@ public static bool TryGetInternalCondition(this Space space, InternalConditionLi return internalCondition != null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/TryGetInternalConditions.cs b/SAM/SAM.Analytical/Query/TryGetInternalConditions.cs index 62c0b3697..60f24ecfa 100644 --- a/SAM/SAM.Analytical/Query/TryGetInternalConditions.cs +++ b/SAM/SAM.Analytical/Query/TryGetInternalConditions.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Analytical @@ -27,7 +30,7 @@ public static bool TryGetInternalConditions(this Space space, InternalConditionL } internalConditions = new List(); - foreach(string name_InternalCondition in names_InternalCondition) + foreach (string name_InternalCondition in names_InternalCondition) { List internalConditions_Temp = internalConditionLibrary.GetInternalConditions(name_InternalCondition); if (internalConditions_Temp == null || internalConditions_Temp.Count == 0) @@ -41,4 +44,4 @@ public static bool TryGetInternalConditions(this Space space, InternalConditionL return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/TryGetSeasonProfiles.cs b/SAM/SAM.Analytical/Query/TryGetSeasonProfiles.cs index ce61f5c04..e6804020b 100644 --- a/SAM/SAM.Analytical/Query/TryGetSeasonProfiles.cs +++ b/SAM/SAM.Analytical/Query/TryGetSeasonProfiles.cs @@ -1,4 +1,7 @@ -using SAM.Weather; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Weather; using System.Collections.Generic; using System.Linq; @@ -10,7 +13,7 @@ public static bool TryGetSeasonProfiles(IEnumerable temperatures, int da { return TryGetSeasonProfiles(temperatures, days, heatingTemperature, double.NaN, out heatingProfile, out coolingProfile, out Profile freeCoolingProfile); } - + public static bool TryGetSeasonProfiles(IEnumerable temperatures, int days, double heatingTemperature, double coolingTemperature, out Profile heatingProfile, out Profile coolingProfile, out Profile freeCoolingProfile) { heatingProfile = null; @@ -195,10 +198,10 @@ public static bool TryGetSeasonProfiles(this WeatherData weatherData, int days, List weatherDays = new List(); - foreach(WeatherYear weatherYear in weatherYears) + foreach (WeatherYear weatherYear in weatherYears) { List weatherDays_WeatherYear = weatherYear?.WeatherDays; - if(weatherDays_WeatherYear == null) + if (weatherDays_WeatherYear == null) { continue; } @@ -245,4 +248,4 @@ public static bool TryGetSeasonProfiles(this IEnumerable weatherDays return TryGetSeasonProfiles(weatherDays, days, heatingTemperature, double.NaN, out heatingProfile, out coolingProfile, out Profile freeCoolingProfile); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/UniqueName.cs b/SAM/SAM.Analytical/Query/UniqueName.cs index 1021ad4bc..d9825f299 100644 --- a/SAM/SAM.Analytical/Query/UniqueName.cs +++ b/SAM/SAM.Analytical/Query/UniqueName.cs @@ -1,22 +1,25 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { public static string UniqueName(this AdjacencyCluster adjacencyCluster, Panel panel) { - if(panel == null || adjacencyCluster == null) + if (panel == null || adjacencyCluster == null) { return null; } int index = adjacencyCluster.GetIndex(panel); - if(index == -1) + if (index == -1) { return null; } string name = panel.Name; - if(string.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { return index.ToString(); } @@ -48,7 +51,7 @@ public static string UniqueName(this AdjacencyCluster adjacencyCluster, Aperture public static string UniqueName(this IPanel panel, int id = -1) { - if(panel == null) + if (panel == null) { return null; } @@ -196,4 +199,4 @@ public static string UniqueName(string prefix, string name, System.Guid? guid = return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/UniqueNameDecomposition.cs b/SAM/SAM.Analytical/Query/UniqueNameDecomposition.cs index d0aa3e592..987120ebb 100644 --- a/SAM/SAM.Analytical/Query/UniqueNameDecomposition.cs +++ b/SAM/SAM.Analytical/Query/UniqueNameDecomposition.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Analytical { @@ -20,7 +23,7 @@ public static bool UniqueNameDecomposition(string uniqueName, out string prefix, guid = null; id = -1; - if(uniqueName == null) + if (uniqueName == null) { return false; } @@ -31,16 +34,16 @@ public static bool UniqueNameDecomposition(string uniqueName, out string prefix, return true; } - foreach(PanelType panelType in Enum.GetValues(typeof(PanelType))) + foreach (PanelType panelType in Enum.GetValues(typeof(PanelType))) { - if(name.StartsWith(UniqueNamePrefix(panelType) + ":")) + if (name.StartsWith(UniqueNamePrefix(panelType) + ":")) { prefix = UniqueNamePrefix(panelType); break; } } - if(prefix == null) + if (prefix == null) { foreach (ApertureType apertureType in Enum.GetValues(typeof(ApertureType))) { @@ -52,7 +55,7 @@ public static bool UniqueNameDecomposition(string uniqueName, out string prefix, } } - if(prefix != null) + if (prefix != null) { name = name.Substring(prefix.Length + 1).Trim(); } @@ -63,7 +66,7 @@ public static bool UniqueNameDecomposition(string uniqueName, out string prefix, int count_Max = int.MaxValue.ToString().Length; int index_Start = name.LastIndexOf("["); - if(index_Start >= 0) + if (index_Start >= 0) { int count = index_End - index_Start - 1; if (count > 0) @@ -71,7 +74,7 @@ public static bool UniqueNameDecomposition(string uniqueName, out string prefix, string value = name.Substring(index_Start + 1, count); if (count > count_Max) { - if(Guid.TryParse(value, out Guid guid_Temp)) + if (Guid.TryParse(value, out Guid guid_Temp)) { guid = guid_Temp; name = name.Substring(0, index_Start).Trim(); @@ -102,7 +105,7 @@ public static bool UniqueNameDecomposition(string uniqueName, out string prefix, string value = name.Substring(index_Start + 1, count); if (count > count_Max) { - if(guid == null) + if (guid == null) { if (Guid.TryParse(value, out Guid guid_Temp)) { @@ -113,7 +116,7 @@ public static bool UniqueNameDecomposition(string uniqueName, out string prefix, } else { - if(id == -1) + if (id == -1) { if (int.TryParse(value, out int @int)) { @@ -130,4 +133,4 @@ public static bool UniqueNameDecomposition(string uniqueName, out string prefix, return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/UniqueNamePrefix.cs b/SAM/SAM.Analytical/Query/UniqueNamePrefix.cs index f66947695..214e85be1 100644 --- a/SAM/SAM.Analytical/Query/UniqueNamePrefix.cs +++ b/SAM/SAM.Analytical/Query/UniqueNamePrefix.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -64,4 +67,4 @@ public static string UniqueNamePrefix(this ApertureType apertureType) return prefix; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/UpdateApertureConstructions.cs b/SAM/SAM.Analytical/Query/UpdateApertureConstructions.cs index 6e81a6363..28cc18a47 100644 --- a/SAM/SAM.Analytical/Query/UpdateApertureConstructions.cs +++ b/SAM/SAM.Analytical/Query/UpdateApertureConstructions.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Analytical @@ -19,7 +22,7 @@ public static AnalyticalModel UpdateApertureConstructions(this AnalyticalModel a } MaterialLibrary materialLibrary = analyticalModel.MaterialLibrary; - if(materialLibrary == null) + if (materialLibrary == null) { materialLibrary = new MaterialLibrary("Default MaterialLibrary"); } @@ -27,14 +30,14 @@ public static AnalyticalModel UpdateApertureConstructions(this AnalyticalModel a List apertureConstructions = null; List panels = adjacencyCluster.GetPanels(); - if(panels != null && panels.Count != 0) + if (panels != null && panels.Count != 0) { for (int i = 0; i < panels.Count; i++) { Panel panel = panels[i]; List apertures = panel?.Apertures; - if(apertures == null || apertures.Count == 0) + if (apertures == null || apertures.Count == 0) { continue; } @@ -43,16 +46,16 @@ public static AnalyticalModel UpdateApertureConstructions(this AnalyticalModel a bool updated = false; - foreach(Aperture aperture in apertures) + foreach (Aperture aperture in apertures) { ApertureConstruction apertureConstruction = aperture?.ApertureConstruction; - if(apertureConstruction == null) + if (apertureConstruction == null) { continue; } apertureConstructions = constructionManager.ApertureConstructions?.FindAll(x => x.ApertureType == apertureConstruction.ApertureType && x.Guid == apertureConstruction.Guid); - if(apertureConstructions == null || apertureConstructions.Count == 0) + if (apertureConstructions == null || apertureConstructions.Count == 0) { apertureConstructions = constructionManager.GetApertureConstructions(apertureConstruction.ApertureType, apertureConstruction.Name); if (apertureConstructions == null || apertureConstructions.Count == 0) @@ -86,7 +89,7 @@ public static AnalyticalModel UpdateApertureConstructions(this AnalyticalModel a continue; } - if(!panel.RemoveAperture(aperture.Guid)) + if (!panel.RemoveAperture(aperture.Guid)) { continue; } @@ -190,4 +193,4 @@ public static AnalyticalModel UpdateApertureConstructions(this AnalyticalModel a return new AnalyticalModel(analyticalModel, adjacencyCluster, materialLibrary, analyticalModel.ProfileLibrary); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/UpdateConstructionLayersByPanelType.cs b/SAM/SAM.Analytical/Query/UpdateConstructionLayersByPanelType.cs index aa14379e0..33318bac0 100644 --- a/SAM/SAM.Analytical/Query/UpdateConstructionLayersByPanelType.cs +++ b/SAM/SAM.Analytical/Query/UpdateConstructionLayersByPanelType.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -117,4 +120,4 @@ public static AnalyticalModel UpdateConstructionLayersByPanelType(this Analytica return new AnalyticalModel(analyticalModel, adjacencyCluster, materialLibrary_AnalyticalModel, analyticalModel.ProfileLibrary); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/UpdateConstructions.cs b/SAM/SAM.Analytical/Query/UpdateConstructions.cs index 4435e0f20..884123a7e 100644 --- a/SAM/SAM.Analytical/Query/UpdateConstructions.cs +++ b/SAM/SAM.Analytical/Query/UpdateConstructions.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Analytical @@ -19,7 +22,7 @@ public static AnalyticalModel UpdateConstructions(this AnalyticalModel analytica } MaterialLibrary materialLibrary = analyticalModel.MaterialLibrary; - if(materialLibrary == null) + if (materialLibrary == null) { materialLibrary = new MaterialLibrary("Default MaterialLibrary"); } @@ -27,37 +30,37 @@ public static AnalyticalModel UpdateConstructions(this AnalyticalModel analytica List constructions = null; List panels = adjacencyCluster.GetPanels(); - if(panels != null && panels.Count != 0) + if (panels != null && panels.Count != 0) { for (int i = 0; i < panels.Count; i++) { Panel panel = panels[i]; - + Construction construction = panel?.Construction; - if(construction == null) + if (construction == null) { continue; } constructions = constructionManager.GetConstructions(construction.Name); - if(constructions == null || constructions.Count == 0) + if (constructions == null || constructions.Count == 0) { continue; } construction = constructions[0]; - if(constructions.Count > 1) + if (constructions.Count > 1) { - foreach(Construction construction_Temp in constructions) + foreach (Construction construction_Temp in constructions) { - if(!construction_Temp.TryGetValue(ConstructionParameter.DefaultPanelType, out string string_PanelType) || string.IsNullOrWhiteSpace(string_PanelType)) + if (!construction_Temp.TryGetValue(ConstructionParameter.DefaultPanelType, out string string_PanelType) || string.IsNullOrWhiteSpace(string_PanelType)) { continue; } PanelType panelType = Core.Query.Enum(string_PanelType); - if(panelType == panel.PanelType) + if (panelType == panel.PanelType) { construction = construction_Temp; break; @@ -65,7 +68,7 @@ public static AnalyticalModel UpdateConstructions(this AnalyticalModel analytica } } - if(construction == null) + if (construction == null) { continue; } @@ -75,15 +78,15 @@ public static AnalyticalModel UpdateConstructions(this AnalyticalModel analytica adjacencyCluster.AddObject(panel); List constructionLayers = construction.ConstructionLayers; - if(constructionLayers == null || constructionLayers.Count == 0) + if (constructionLayers == null || constructionLayers.Count == 0) { continue; } - foreach(ConstructionLayer constructionLayer in constructionLayers) + foreach (ConstructionLayer constructionLayer in constructionLayers) { IMaterial material = constructionManager.GetMaterial(constructionLayer.Name); - if(material == null) + if (material == null) { continue; } @@ -94,11 +97,11 @@ public static AnalyticalModel UpdateConstructions(this AnalyticalModel analytica } constructions = adjacencyCluster.GetObjects(); - if(constructions != null && constructions.Count != 0) + if (constructions != null && constructions.Count != 0) { - foreach(Construction construction in constructions) + foreach (Construction construction in constructions) { - if(construction == null) + if (construction == null) { continue; } @@ -138,7 +141,7 @@ public static AnalyticalModel UpdateConstructions(this AnalyticalModel analytica } } - if(construction_Temp == null) + if (construction_Temp == null) { continue; } @@ -151,4 +154,4 @@ public static AnalyticalModel UpdateConstructions(this AnalyticalModel analytica return new AnalyticalModel(analyticalModel, adjacencyCluster, materialLibrary, analyticalModel.ProfileLibrary); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/UpdateConstructionsByPanels.cs b/SAM/SAM.Analytical/Query/UpdateConstructionsByPanels.cs index 0eb7e7da9..88b4d720b 100644 --- a/SAM/SAM.Analytical/Query/UpdateConstructionsByPanels.cs +++ b/SAM/SAM.Analytical/Query/UpdateConstructionsByPanels.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -8,23 +11,23 @@ public static partial class Query { public static AnalyticalModel UpdateConstructionsByPanels(this AnalyticalModel analyticalModel, IEnumerable panels, double areaFactor, double maxDistance, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { - if(analyticalModel == null) + if (analyticalModel == null) { return null; } AdjacencyCluster adjacencyCluster = UpdateConstructionsByPanels(analyticalModel.AdjacencyCluster, panels, areaFactor, maxDistance, tolerance_Angle, tolerance_Distance); - if(adjacencyCluster == null) + if (adjacencyCluster == null) { return new AnalyticalModel(analyticalModel); - } + } return new AnalyticalModel(analyticalModel, adjacencyCluster); } public static AdjacencyCluster UpdateConstructionsByPanels(this AdjacencyCluster adjacencyCluster, IEnumerable panels, double areaFactor, double maxDistance, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { - if(adjacencyCluster == null) + if (adjacencyCluster == null) { return null; } @@ -32,15 +35,15 @@ public static AdjacencyCluster UpdateConstructionsByPanels(this AdjacencyCluster AdjacencyCluster result = new AdjacencyCluster(adjacencyCluster); List panels_AdjacencyCluster = adjacencyCluster.GetPanels(); - if(panels_AdjacencyCluster == null || panels_AdjacencyCluster.Count == 0) + if (panels_AdjacencyCluster == null || panels_AdjacencyCluster.Count == 0) { return result; } - foreach(Panel panel in panels_AdjacencyCluster) + foreach (Panel panel in panels_AdjacencyCluster) { Face3D face3D = panel?.GetFace3D(); - if(face3D == null) + if (face3D == null) { continue; } @@ -50,13 +53,13 @@ public static AdjacencyCluster UpdateConstructionsByPanels(this AdjacencyCluster List spaces = result.GetSpaces(panel); Panel panel_New = PanelsByFace3D(panels, face3D, areaFactor, maxDistance, out List intersectionAreas, tolerance_Angle, tolerance_Distance)?.FirstOrDefault(); - if(panel_New == null) + if (panel_New == null) { - if(panel.PanelGroup == Analytical.PanelGroup.Floor && spaces != null && spaces.Count > 1) + if (panel.PanelGroup == Analytical.PanelGroup.Floor && spaces != null && spaces.Count > 1) { panel_Updated = new Panel(panel, null); panel_Updated = new Panel(panel_Updated, Analytical.PanelType.Air); - if(panel_Updated.Normal.SameHalf(Vector3D.WorldZ)) + if (panel_Updated.Normal.SameHalf(Vector3D.WorldZ)) { panel_Updated.FlipNormal(true, false); } @@ -65,7 +68,7 @@ public static AdjacencyCluster UpdateConstructionsByPanels(this AdjacencyCluster result.AddObject(panel_Updated); } - + continue; } @@ -76,10 +79,10 @@ public static AdjacencyCluster UpdateConstructionsByPanels(this AdjacencyCluster else { double area = face3D.GetArea(); - if(intersectionAreas[0]/area < areaFactor) + if (intersectionAreas[0] / area < areaFactor) { panel_Updated = new Panel(panel, null); - + if (panel_Updated.Normal.SameHalf(Vector3D.WorldZ)) { panel_Updated.FlipNormal(true, false); @@ -99,4 +102,4 @@ public static AdjacencyCluster UpdateConstructionsByPanels(this AdjacencyCluster return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/UpdateHeatTransferCoefficients.cs b/SAM/SAM.Analytical/Query/UpdateHeatTransferCoefficients.cs index 2c3f55440..90dcf423e 100644 --- a/SAM/SAM.Analytical/Query/UpdateHeatTransferCoefficients.cs +++ b/SAM/SAM.Analytical/Query/UpdateHeatTransferCoefficients.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -6,7 +9,7 @@ namespace SAM.Analytical { public static partial class Query { - public static AnalyticalModel UpdateHeatTransferCoefficients(this AnalyticalModel analyticalModel, bool duplicateConstructions, bool duplicateApertureConstructions, out List constructions, out List apertureConstructions ) + public static AnalyticalModel UpdateHeatTransferCoefficients(this AnalyticalModel analyticalModel, bool duplicateConstructions, bool duplicateApertureConstructions, out List constructions, out List apertureConstructions) { AnalyticalModel result = null; @@ -49,10 +52,10 @@ private static AnalyticalModel UpdateHeatTransferCoefficients_Constructions(this if (panels == null || panels.Count == 0) continue; - if(duplicateConstructions) + if (duplicateConstructions) { Dictionary> dictionary = new Dictionary>(); - foreach(Panel panel in panels) + foreach (Panel panel in panels) { if (panel == null) continue; @@ -60,7 +63,7 @@ private static AnalyticalModel UpdateHeatTransferCoefficients_Constructions(this double tilt = System.Math.Round(panel.Tilt(), 0) * System.Math.PI / 180; List panels_Tilt = null; - if(!dictionary.TryGetValue(tilt, out panels_Tilt)) + if (!dictionary.TryGetValue(tilt, out panels_Tilt)) { panels_Tilt = new List(); dictionary[tilt] = panels_Tilt; @@ -94,7 +97,7 @@ private static AnalyticalModel UpdateHeatTransferCoefficients_Constructions(this } else { - foreach(KeyValuePair> keyValuePair in dictionary) + foreach (KeyValuePair> keyValuePair in dictionary) { string name = GetSAMTypeName(construction, keyValuePair.Key); if (string.IsNullOrWhiteSpace(name)) @@ -198,7 +201,7 @@ private static AnalyticalModel UpdateHeatTransferCoefficients_ApertureConstructi if (apertures == null || apertures.Count == 0) continue; - if(duplicateApertureConstructions) + if (duplicateApertureConstructions) { Dictionary> dictionary = new Dictionary>(); foreach (Aperture aperture in apertures) @@ -346,7 +349,7 @@ private static bool UpdateHeatTransferCoefficients(IEnumerableSilver Spacing Tolerance /// Distance tolerance /// - public static AdjacencyCluster UpdateNormals(this AdjacencyCluster adjacencyCluster, bool includeApertures, bool external = true, bool flipX = false, double silverSpacing = Core.Tolerance.MacroDistance, double tolerance= Core.Tolerance.Distance) + public static AdjacencyCluster UpdateNormals(this AdjacencyCluster adjacencyCluster, bool includeApertures, bool external = true, bool flipX = false, double silverSpacing = Core.Tolerance.MacroDistance, double tolerance = Core.Tolerance.Distance) { if (adjacencyCluster == null) return null; @@ -30,7 +33,7 @@ public static AdjacencyCluster UpdateNormals(this AdjacencyCluster adjacencyClus HashSet guids = new HashSet(); - foreach(ISpace space in spaces) + foreach (ISpace space in spaces) { Shell shell = null; Dictionary dictionary = result.NormalDictionary(space, out shell, true, silverSpacing, tolerance); @@ -75,11 +78,11 @@ public static AdjacencyCluster UpdateNormals(this AdjacencyCluster adjacencyClus { panel = panel.Clone(); - if(panel is Panel) + if (panel is Panel) { ((Panel)panel).FlipNormal(flipX, false); //2020.09.03 Input changed to false to match with second Method for UpdateNormals } - else if(panel is ExternalPanel) + else if (panel is ExternalPanel) { ((ExternalPanel)panel).FlipNormal(flipX); } @@ -92,7 +95,7 @@ public static AdjacencyCluster UpdateNormals(this AdjacencyCluster adjacencyClus Panel panel_Temp = (Panel)panel; List apertures = panel_Temp.Apertures; - if(apertures != null) + if (apertures != null) { foreach (Aperture aperture in apertures) { @@ -122,7 +125,7 @@ public static AdjacencyCluster UpdateNormals(this AdjacencyCluster adjacencyClus } } - if(updated) + if (updated) { result.AddObject(panel); } @@ -176,7 +179,7 @@ public static List UpdateNormals(this AdjacencyCluster adjacencyCluster, } Vector3D normal_Panel = panel.Face3D?.GetPlane()?.Normal; - if(normal_Panel == null) + if (normal_Panel == null) { continue; } @@ -241,4 +244,4 @@ public static List UpdateNormals(this AdjacencyCluster adjacencyCluster, return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/VentilationSystems.cs b/SAM/SAM.Analytical/Query/VentilationSystems.cs index 974a2a932..3c87c4403 100644 --- a/SAM/SAM.Analytical/Query/VentilationSystems.cs +++ b/SAM/SAM.Analytical/Query/VentilationSystems.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -53,7 +56,7 @@ public static List VentilationSystems(this AdjacencyCluster a } } - if(added) + if (added) { result.Add(ventilationSystem); } @@ -63,4 +66,4 @@ public static List VentilationSystems(this AdjacencyCluster a return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Volume.cs b/SAM/SAM.Analytical/Query/Volume.cs index 2c8c443f6..af0b1f9a5 100644 --- a/SAM/SAM.Analytical/Query/Volume.cs +++ b/SAM/SAM.Analytical/Query/Volume.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -21,10 +24,10 @@ public static double Volume(this Space space, AdjacencyCluster adjacencyCluster) } Shell shell = adjacencyCluster.Shell(space); - if(shell != null) + if (shell != null) { volume = shell.Volume(); - if(!double.IsNaN(volume) && volume > 0) + if (!double.IsNaN(volume) && volume > 0) { return volume; } @@ -50,4 +53,4 @@ public static double Volume(this Space space, AdjacencyCluster adjacencyCluster) return area * (elevation_Max - elevation_Min); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Width.cs b/SAM/SAM.Analytical/Query/Width.cs index 30cb5fdc2..e1e3569e8 100644 --- a/SAM/SAM.Analytical/Query/Width.cs +++ b/SAM/SAM.Analytical/Query/Width.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using SAM.Geometry.Spatial; namespace SAM.Analytical @@ -54,4 +57,4 @@ public static double Width(this PlanarBoundary3D planarBoundary3D) //return rectangle2D.Width; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/Zone.cs b/SAM/SAM.Analytical/Query/Zone.cs index 1d90f260f..05a92fe4f 100644 --- a/SAM/SAM.Analytical/Query/Zone.cs +++ b/SAM/SAM.Analytical/Query/Zone.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Analytical { @@ -15,7 +18,7 @@ public static Zone Zone(this AdjacencyCluster adjacencyCluster, string name, Zon string zoneTypeText = zoneType.Text(); - foreach(Zone zone in zones) + foreach (Zone zone in zones) { if (!zone.TryGetValue(ZoneParameter.ZoneCategory, out string zoneCategory)) continue; @@ -27,4 +30,4 @@ public static Zone Zone(this AdjacencyCluster adjacencyCluster, string name, Zon return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Query/ZoneType.cs b/SAM/SAM.Analytical/Query/ZoneType.cs index 3b932e743..22931dd1c 100644 --- a/SAM/SAM.Analytical/Query/ZoneType.cs +++ b/SAM/SAM.Analytical/Query/ZoneType.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { public static partial class Query { @@ -14,4 +17,4 @@ public static ZoneType ZoneType(this Zone zone) return Core.Query.Enum(category); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Analytical/Variables/FluidProperty.cs b/SAM/SAM.Analytical/Variables/FluidProperty.cs index 2f19cf0bc..17c8734b8 100644 --- a/SAM/SAM.Analytical/Variables/FluidProperty.cs +++ b/SAM/SAM.Analytical/Variables/FluidProperty.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static class FluidProperty { diff --git a/SAM/SAM.Analytical/Variables/HourOfYear.cs b/SAM/SAM.Analytical/Variables/HourOfYear.cs index 00999ed88..615f66b64 100644 --- a/SAM/SAM.Analytical/Variables/HourOfYear.cs +++ b/SAM/SAM.Analytical/Variables/HourOfYear.cs @@ -1,4 +1,7 @@ -namespace SAM.Analytical +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Analytical { ///

    /// Represents a static class that defines various levels of rounding precision for distances and angles. diff --git a/SAM/SAM.Architectural/Classes/Level.cs b/SAM/SAM.Architectural/Classes/Level.cs index 31ffbcb5c..8a168408f 100644 --- a/SAM/SAM.Architectural/Classes/Level.cs +++ b/SAM/SAM.Architectural/Classes/Level.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; @@ -65,4 +68,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Architectural/Classes/MaterialLayer.cs b/SAM/SAM.Architectural/Classes/MaterialLayer.cs index dd3a53b21..28148efee 100644 --- a/SAM/SAM.Architectural/Classes/MaterialLayer.cs +++ b/SAM/SAM.Architectural/Classes/MaterialLayer.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; @@ -95,4 +98,4 @@ public virtual JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Architectural/Classes/PlanarTerrain.cs b/SAM/SAM.Architectural/Classes/PlanarTerrain.cs index 5e663dfb3..b3f8132a0 100644 --- a/SAM/SAM.Architectural/Classes/PlanarTerrain.cs +++ b/SAM/SAM.Architectural/Classes/PlanarTerrain.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Geometry.Spatial; @@ -72,4 +75,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Architectural/Classes/Terrain.cs b/SAM/SAM.Architectural/Classes/Terrain.cs index a816942e3..3a8911dc5 100644 --- a/SAM/SAM.Architectural/Classes/Terrain.cs +++ b/SAM/SAM.Architectural/Classes/Terrain.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Geometry.Object.Spatial; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -70,4 +73,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Architectural/Create/Level.cs b/SAM/SAM.Architectural/Create/Level.cs index 6ea67b365..8c8855d04 100644 --- a/SAM/SAM.Architectural/Create/Level.cs +++ b/SAM/SAM.Architectural/Create/Level.cs @@ -1,4 +1,7 @@ -namespace SAM.Architectural +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Architectural { public static partial class Create { @@ -7,4 +10,4 @@ public static Level Level(double elevation, double tolerance = Core.Tolerance.Ma return new Level(string.Format("Level {0}", Core.Query.Round(elevation, tolerance)), elevation); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Architectural/Create/Levels.cs b/SAM/SAM.Architectural/Create/Levels.cs index 832274887..6b5602b1f 100644 --- a/SAM/SAM.Architectural/Create/Levels.cs +++ b/SAM/SAM.Architectural/Create/Levels.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Object.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Object.Spatial; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -38,4 +41,4 @@ public static List Levels(this List face3Ds, double tolerance = C return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Architectural/Create/Log.cs b/SAM/SAM.Architectural/Create/Log.cs index 0d9927750..406e9aa7c 100644 --- a/SAM/SAM.Architectural/Create/Log.cs +++ b/SAM/SAM.Architectural/Create/Log.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -33,4 +36,4 @@ public static Log Log(this IEnumerable materialLayers, string nam return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Architectural/Create/MaterialLayers.cs b/SAM/SAM.Architectural/Create/MaterialLayers.cs index a0f6910dc..55a0b846f 100644 --- a/SAM/SAM.Architectural/Create/MaterialLayers.cs +++ b/SAM/SAM.Architectural/Create/MaterialLayers.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Architectural { @@ -11,7 +14,7 @@ public static List MaterialLayers(params object[] values) List names = new List(); List thicknesses = new List(); - foreach(object @object in values) + foreach (object @object in values) { if (@object is string) names.Add((string)@object); @@ -29,4 +32,4 @@ public static List MaterialLayers(params object[] values) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Architectural/Create/PlanarTerrain.cs b/SAM/SAM.Architectural/Create/PlanarTerrain.cs index f70092dd8..c3b187ca0 100644 --- a/SAM/SAM.Architectural/Create/PlanarTerrain.cs +++ b/SAM/SAM.Architectural/Create/PlanarTerrain.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Architectural { @@ -7,7 +10,7 @@ public static partial class Create public static PlanarTerrain PlanarTerrain(double elevation) { Plane plane = Geometry.Spatial.Create.Plane(elevation); - if(plane == null) + if (plane == null) { return null; } @@ -15,4 +18,4 @@ public static PlanarTerrain PlanarTerrain(double elevation) return new PlanarTerrain(plane); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Architectural/Interfaces/IArchitecturalObject.cs b/SAM/SAM.Architectural/Interfaces/IArchitecturalObject.cs index 1f54bda89..c1e2bc180 100644 --- a/SAM/SAM.Architectural/Interfaces/IArchitecturalObject.cs +++ b/SAM/SAM.Architectural/Interfaces/IArchitecturalObject.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Architectural { diff --git a/SAM/SAM.Architectural/Interfaces/ITerrain.cs b/SAM/SAM.Architectural/Interfaces/ITerrain.cs index 20ebb0848..402620e15 100644 --- a/SAM/SAM.Architectural/Interfaces/ITerrain.cs +++ b/SAM/SAM.Architectural/Interfaces/ITerrain.cs @@ -1,4 +1,7 @@ -namespace SAM.Architectural +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Architectural { public interface ITerrain : IArchitecturalObject { diff --git a/SAM/SAM.Architectural/Query/LevelsDictionary.cs b/SAM/SAM.Architectural/Query/LevelsDictionary.cs index fcfc972ad..b7db0191d 100644 --- a/SAM/SAM.Architectural/Query/LevelsDictionary.cs +++ b/SAM/SAM.Architectural/Query/LevelsDictionary.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Architectural { @@ -12,15 +15,15 @@ public static Dictionary> LevelsDictionary(this List face3D } List levels = Create.Levels(face3DObjects, tolerance); - if(levels == null) + if (levels == null) { return null; } Dictionary> result = new Dictionary>(); - foreach(T face3Dobject in face3DObjects) + foreach (T face3Dobject in face3DObjects) { - if(face3Dobject == null) + if (face3Dobject == null) { continue; } @@ -46,12 +49,12 @@ public static Dictionary> LevelsDictionary(this List face3D } } - if(level == null) + if (level == null) { continue; } - if(!result.TryGetValue(level, out List face3DObjects_Level)) + if (!result.TryGetValue(level, out List face3DObjects_Level)) { face3DObjects_Level = new List(); result[level] = face3DObjects_Level; @@ -63,4 +66,4 @@ public static Dictionary> LevelsDictionary(this List face3D return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Architectural/Query/Material.cs b/SAM/SAM.Architectural/Query/Material.cs index d89da6c99..0e2d9559c 100644 --- a/SAM/SAM.Architectural/Query/Material.cs +++ b/SAM/SAM.Architectural/Query/Material.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Architectural { @@ -12,4 +15,4 @@ public static IMaterial Material(this MaterialLayer materialLayer, MaterialLibra return materialLibrary.GetObject(materialLayer.Name); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Architectural/Query/MaterialType.cs b/SAM/SAM.Architectural/Query/MaterialType.cs index a36c8f1c3..b25dd7265 100644 --- a/SAM/SAM.Architectural/Query/MaterialType.cs +++ b/SAM/SAM.Architectural/Query/MaterialType.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Architectural @@ -27,4 +30,4 @@ public static MaterialType MaterialType(this IEnumerable material return Core.MaterialType.Transparent; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Architectural/Query/Materials.cs b/SAM/SAM.Architectural/Query/Materials.cs index 16ca6862c..177ab4631 100644 --- a/SAM/SAM.Architectural/Query/Materials.cs +++ b/SAM/SAM.Architectural/Query/Materials.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Architectural @@ -13,10 +16,10 @@ public static List Materials(this IEnumerable material } List result = new List(); - foreach(MaterialLayer materialLayer in materialLayers) + foreach (MaterialLayer materialLayer in materialLayers) { IMaterial material = materialLayer?.Material(materialLibrary); - if(material != null && result.Find(x => x.Name == material.Name) == null) + if (material != null && result.Find(x => x.Name == material.Name) == null) { result.Add(material); } @@ -25,4 +28,4 @@ public static List Materials(this IEnumerable material return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Attributes/Enum/AssociatedTypes.cs b/SAM/SAM.Core/Attributes/Enum/AssociatedTypes.cs index aae96510b..a447f6adb 100644 --- a/SAM/SAM.Core/Attributes/Enum/AssociatedTypes.cs +++ b/SAM/SAM.Core/Attributes/Enum/AssociatedTypes.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections; using System.Linq; diff --git a/SAM/SAM.Core/Attributes/Enum/Operator.cs b/SAM/SAM.Core/Attributes/Enum/Operator.cs index a50f3b8c5..99ca17ad0 100644 --- a/SAM/SAM.Core/Attributes/Enum/Operator.cs +++ b/SAM/SAM.Core/Attributes/Enum/Operator.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Core.Attributes { diff --git a/SAM/SAM.Core/Attributes/Parameter/DoubleParameterValue.cs b/SAM/SAM.Core/Attributes/Parameter/DoubleParameterValue.cs index e7909531b..bb03911fd 100644 --- a/SAM/SAM.Core/Attributes/Parameter/DoubleParameterValue.cs +++ b/SAM/SAM.Core/Attributes/Parameter/DoubleParameterValue.cs @@ -1,4 +1,7 @@ -namespace SAM.Core.Attributes +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core.Attributes { public class DoubleParameterValue : ParameterValue { diff --git a/SAM/SAM.Core/Attributes/Parameter/IntegerParameterValue.cs b/SAM/SAM.Core/Attributes/Parameter/IntegerParameterValue.cs index fc190a336..4490ba73f 100644 --- a/SAM/SAM.Core/Attributes/Parameter/IntegerParameterValue.cs +++ b/SAM/SAM.Core/Attributes/Parameter/IntegerParameterValue.cs @@ -1,4 +1,7 @@ -namespace SAM.Core.Attributes +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core.Attributes { public class IntegerParameterValue : ParameterValue { diff --git a/SAM/SAM.Core/Attributes/Parameter/NullableParameterValue.cs b/SAM/SAM.Core/Attributes/Parameter/NullableParameterValue.cs index 1683d4e1f..446253bc3 100644 --- a/SAM/SAM.Core/Attributes/Parameter/NullableParameterValue.cs +++ b/SAM/SAM.Core/Attributes/Parameter/NullableParameterValue.cs @@ -1,4 +1,7 @@ -namespace SAM.Core.Attributes +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core.Attributes { public abstract class NullableParameterValue : ParameterValue { diff --git a/SAM/SAM.Core/Attributes/Parameter/ParameterProperties.cs b/SAM/SAM.Core/Attributes/Parameter/ParameterProperties.cs index eca595085..a15ce0a60 100644 --- a/SAM/SAM.Core/Attributes/Parameter/ParameterProperties.cs +++ b/SAM/SAM.Core/Attributes/Parameter/ParameterProperties.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Core.Attributes { diff --git a/SAM/SAM.Core/Attributes/Parameter/ParameterValue.cs b/SAM/SAM.Core/Attributes/Parameter/ParameterValue.cs index 633ee8f63..f07b90b34 100644 --- a/SAM/SAM.Core/Attributes/Parameter/ParameterValue.cs +++ b/SAM/SAM.Core/Attributes/Parameter/ParameterValue.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Core.Attributes { @@ -22,7 +25,7 @@ public virtual bool TryConvert(object object_In, out object object_Out) case ParameterType.Double: if (object_In == null) return false; - + double @double; if (!Query.TryConvert(object_In, out @double)) return false; diff --git a/SAM/SAM.Core/Attributes/Parameter/SAMObjectParameterValue.cs b/SAM/SAM.Core/Attributes/Parameter/SAMObjectParameterValue.cs index 4c008b241..862b4bb7b 100644 --- a/SAM/SAM.Core/Attributes/Parameter/SAMObjectParameterValue.cs +++ b/SAM/SAM.Core/Attributes/Parameter/SAMObjectParameterValue.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections; using System.Collections.Generic; using System.Linq; @@ -75,17 +78,17 @@ public override bool TryConvert(object object_In, out object object_Out) return true; } - foreach(Type type_Temp in types) + foreach (Type type_Temp in types) { if (typeof(IEnumerable).IsAssignableFrom(type_Temp)) { if (type_Temp.IsGenericType && type_Temp.GenericTypeArguments[0] == type) { System.Reflection.ConstructorInfo[] constructorInfos = type_Temp.GetConstructors(); - foreach(System.Reflection.ConstructorInfo constructorInfo in constructorInfos) + foreach (System.Reflection.ConstructorInfo constructorInfo in constructorInfos) { System.Reflection.ParameterInfo[] parameterInfos = constructorInfo.GetParameters(); - if(parameterInfos != null && parameterInfos.Length == 1) + if (parameterInfos != null && parameterInfos.Length == 1) { Type type_Parameter = parameterInfos[0].ParameterType; @@ -96,19 +99,19 @@ public override bool TryConvert(object object_In, out object object_Out) } else if (typeof(IEnumerable).IsAssignableFrom(type_Parameter)) { - if(type_Parameter.IsGenericType && type_Parameter.GenericTypeArguments[0] == type) + if (type_Parameter.IsGenericType && type_Parameter.GenericTypeArguments[0] == type) { dynamic list = Activator.CreateInstance(typeof(List<>).MakeGenericType(type)); list.Add(object_In as dynamic); - if(type_Parameter.IsAssignableFrom(list.GetType())) + if (type_Parameter.IsAssignableFrom(list.GetType())) { object_Out = constructorInfo.Invoke(new object[] { list }); return true; } } } - + } } diff --git a/SAM/SAM.Core/Classes/Base/AnyOf.cs b/SAM/SAM.Core/Classes/Base/AnyOf.cs index bedca6b77..c422006f6 100644 --- a/SAM/SAM.Core/Classes/Base/AnyOf.cs +++ b/SAM/SAM.Core/Classes/Base/AnyOf.cs @@ -1,13 +1,16 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Linq; namespace SAM.Core { public class AnyOf { - private object value; + private object? value; - public AnyOf(object value, Type type = null) + public AnyOf(object value, Type? type = null) { if (type == null) { @@ -26,9 +29,9 @@ public AnyOf(object value, Type type = null) this.value = value; } - public virtual Type[] Types => new Type[] { typeof(object) }; - - public object Value + public virtual Type[] Types => [typeof(object)]; + + public object? Value { get { @@ -41,21 +44,21 @@ public object Value } } - public static implicit operator AnyOf(int value) => new AnyOf(value, typeof(int)); + public static implicit operator AnyOf(int value) => new (value, typeof(int)); - public static implicit operator AnyOf(string value) => new AnyOf(value, typeof(string)); + public static implicit operator AnyOf(string value) => new (value, typeof(string)); - public static implicit operator AnyOf(double value) => new AnyOf(value, typeof(double)); + public static implicit operator AnyOf(double value) => new (value, typeof(double)); - public static implicit operator AnyOf(Guid value) => new AnyOf(value, typeof(Guid)); + public static implicit operator AnyOf(Guid value) => new (value, typeof(Guid)); - public static implicit operator AnyOf(DateTime value) => new AnyOf(value, typeof(DateTime)); + public static implicit operator AnyOf(DateTime value) => new(value, typeof(DateTime)); - public static implicit operator AnyOf(long value) => new AnyOf(value, typeof(long)); + public static implicit operator AnyOf(long value) => new (value, typeof(long)); - public static implicit operator AnyOf(bool value) => new AnyOf(value, typeof(bool)); + public static implicit operator AnyOf(bool value) => new (value, typeof(bool)); - public static implicit operator string(AnyOf value) => value?.ToString(); + public static implicit operator string?(AnyOf value) => value?.ToString(); public static bool operator !=(AnyOf anyOf, object @object) { @@ -72,8 +75,15 @@ public object Value public override bool Equals(object @object) { - if (ReferenceEquals(this, null)) - return ReferenceEquals(@object, null) ? true : false; + if (this is null) + { + return @object is null ? true : false; + } + + if(value is null) + { + return @object is null; + } return value.Equals(@object); } @@ -86,17 +96,19 @@ public override int GetHashCode() return value.GetHashCode(); } - public new Type GetType() + public new Type? GetType() { if (value == null) + { return Types?.First(); + } return value.GetType(); } public T GetValue() { - if(value is T) + if (value is T) { return (T)(object)value; } @@ -104,17 +116,21 @@ public T GetValue() return default; } - public bool IsValid(object value) + public bool IsValid(object? value) { if (Types == null || Types.Length == 0) + { return false; + } if (value == null) { - foreach(Type type in Types) + foreach (Type type in Types) { if (Query.IsNullable(type)) + { return true; + } } return false; @@ -123,7 +139,7 @@ public bool IsValid(object value) return Types.Contains(value?.GetType()); } - public override string ToString() + public override string? ToString() { return value?.ToString(); } @@ -136,9 +152,9 @@ public AnyOf(object value) { } - public override Type[] Types => new Type[] { typeof(T) }; - - public static implicit operator string(AnyOf b) => b?.ToString(); + public override Type[] Types => [typeof(T)]; + + public static implicit operator string?(AnyOf b) => b?.ToString(); } public class AnyOf : AnyOf @@ -148,11 +164,11 @@ public AnyOf(object value) { } - public override Type[] Types => new Type[] { typeof(T), typeof(K) }; - - public static implicit operator AnyOf(T value) => new AnyOf(value); + public override Type[] Types => [typeof(T), typeof(K)]; + + public static implicit operator AnyOf(T value) => new(value); - public static implicit operator AnyOf(K value) => new AnyOf(value); + public static implicit operator AnyOf(K value) => new(value); public static implicit operator string(AnyOf value) => value?.ToString(); } diff --git a/SAM/SAM.Core/Classes/Base/Category.cs b/SAM/SAM.Core/Classes/Base/Category.cs index b8766ce3d..3ce478e4a 100644 --- a/SAM/SAM.Core/Classes/Base/Category.cs +++ b/SAM/SAM.Core/Classes/Base/Category.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; namespace SAM.Core @@ -21,7 +24,7 @@ public Category(string name, Category subCategory) public Category(Category category) { - if(category != null) + if (category != null) { name = category.name; subCategory = category.subCategory == null ? null : new Category(category.subCategory); @@ -56,7 +59,7 @@ public override string ToString() public string ToString(string separator) { - if(separator == null) + if (separator == null) { separator = string.Empty; } @@ -64,9 +67,9 @@ public string ToString(string separator) List values = new List(); List categories = this.SubCategories(); - if(categories != null) + if (categories != null) { - foreach(Category category in categories) + foreach (Category category in categories) { string name_Category = category?.Name; if (name_Category == null) @@ -76,7 +79,7 @@ public string ToString(string separator) } values.Add(name_Category); - } + } } values.Add(name == null ? string.Empty : name); @@ -88,17 +91,17 @@ public string ToString(string separator) public bool FromJObject(JObject jObject) { - if(jObject == null) + if (jObject == null) { return false; } - if(jObject.ContainsKey("Name")) + if (jObject.ContainsKey("Name")) { name = jObject.Value("Name"); } - if(jObject.ContainsKey("SubCategory")) + if (jObject.ContainsKey("SubCategory")) { subCategory = new Category(jObject.Value("SubCategory")); } @@ -110,8 +113,8 @@ public JObject ToJObject() { JObject jObject = new JObject(); jObject.Add("_type", Query.FullTypeName(this)); - - if(name != null) + + if (name != null) { jObject.Add("Name", name); } @@ -124,4 +127,4 @@ public JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Base/EnumParameterData.cs b/SAM/SAM.Core/Classes/Base/EnumParameterData.cs index 6f76b1651..bee8331e6 100644 --- a/SAM/SAM.Core/Classes/Base/EnumParameterData.cs +++ b/SAM/SAM.Core/Classes/Base/EnumParameterData.cs @@ -1,4 +1,7 @@ -using SAM.Core.Attributes; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core.Attributes; using System; namespace SAM.Core diff --git a/SAM/SAM.Core/Classes/Base/Group.cs b/SAM/SAM.Core/Classes/Base/Group.cs index 826b4cb08..cb15bb361 100644 --- a/SAM/SAM.Core/Classes/Base/Group.cs +++ b/SAM/SAM.Core/Classes/Base/Group.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Core @@ -51,4 +54,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Base/IntegerId.cs b/SAM/SAM.Core/Classes/Base/IntegerId.cs index ac4ecc351..e75b3efe6 100644 --- a/SAM/SAM.Core/Classes/Base/IntegerId.cs +++ b/SAM/SAM.Core/Classes/Base/IntegerId.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Core { @@ -13,7 +16,7 @@ public IntegerId(int id) } public IntegerId(IntegerId integerId) - :base(integerId) + : base(integerId) { id = integerId.id; } @@ -56,7 +59,7 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { JObject result = base.ToJObject(); - if(result == null) + if (result == null) { return result; } @@ -66,4 +69,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Base/LongId.cs b/SAM/SAM.Core/Classes/Base/LongId.cs index 6d9365f10..14ace1b19 100644 --- a/SAM/SAM.Core/Classes/Base/LongId.cs +++ b/SAM/SAM.Core/Classes/Base/LongId.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Core { @@ -19,7 +22,7 @@ public LongId(int id) } public LongId(LongId longId) - :base(longId) + : base(longId) { id = longId.id; } @@ -67,7 +70,7 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { JObject result = base.ToJObject(); - if(result == null) + if (result == null) { return result; } @@ -77,4 +80,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Base/ParameterData.cs b/SAM/SAM.Core/Classes/Base/ParameterData.cs index 4a819b430..6377ad043 100644 --- a/SAM/SAM.Core/Classes/Base/ParameterData.cs +++ b/SAM/SAM.Core/Classes/Base/ParameterData.cs @@ -1,4 +1,7 @@ -using SAM.Core.Attributes; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core.Attributes; namespace SAM.Core { diff --git a/SAM/SAM.Core/Classes/Base/ParameterSet.cs b/SAM/SAM.Core/Classes/Base/ParameterSet.cs index 43ea81df6..0e38ccb19 100644 --- a/SAM/SAM.Core/Classes/Base/ParameterSet.cs +++ b/SAM/SAM.Core/Classes/Base/ParameterSet.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Reflection; @@ -22,10 +25,10 @@ public ParameterSet(ParameterSet parameterSet) foreach (KeyValuePair keyValuePair in parameterSet.dictionary) { object @object = keyValuePair.Value; - if(@object is IJSAMObject) + if (@object is IJSAMObject) { object @object_Temp = ((IJSAMObject)@object).Clone(); - if(object_Temp != null) + if (object_Temp != null) { @object = @object_Temp; } @@ -316,7 +319,7 @@ public T ToSAMObject(string name) where T : IJSAMObject public System.Drawing.Color ToColor(string name) { - SAMColor sAMColor = ToSAMObject(name); + SAMColor sAMColor = ToSAMObject(name); if (sAMColor == null) return System.Drawing.Color.Empty; @@ -439,7 +442,7 @@ public JObject ToJObject() { if (keyValuePair.Value is IJSAMObject) jObject_Temp.Add("Value", ((IJSAMObject)keyValuePair.Value).ToJObject()); - else if(keyValuePair.Value is JArray) + else if (keyValuePair.Value is JArray) jObject_Temp.Add("Value", (JArray)keyValuePair.Value); else jObject_Temp.Add("Value", keyValuePair.Value as dynamic); @@ -454,4 +457,4 @@ public JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Base/ParameterizedSAMObject.cs b/SAM/SAM.Core/Classes/Base/ParameterizedSAMObject.cs index 2e0de07a1..3744c3857 100644 --- a/SAM/SAM.Core/Classes/Base/ParameterizedSAMObject.cs +++ b/SAM/SAM.Core/Classes/Base/ParameterizedSAMObject.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Reflection; @@ -71,13 +74,13 @@ public bool RemoveValue(Enum @enum) public bool RemoveValue(string name, Assembly assembly = null) { - return Modify.RemoveValue(this, name, assembly == null ? Assembly.GetExecutingAssembly(): assembly); + return Modify.RemoveValue(this, name, assembly == null ? Assembly.GetExecutingAssembly() : assembly); } public bool TryGetValue(Enum @enum, out object value) { value = null; - + if (!Query.IsValid(GetType(), @enum)) { return false; @@ -195,7 +198,7 @@ public bool TryGetValue(Enum @enum, out T value, bool tryConvert = true) return Query.TryConvert(result, out value); } - + public object GetValue(Enum @enum) { object result = null; @@ -324,4 +327,4 @@ public virtual JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Base/Range.cs b/SAM/SAM.Core/Classes/Base/Range.cs index aa6228902..a5fd3ff38 100644 --- a/SAM/SAM.Core/Classes/Base/Range.cs +++ b/SAM/SAM.Core/Classes/Base/Range.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; using System.Linq; @@ -27,7 +30,7 @@ public Range(IEnumerable values) min = default; max = default; - if(values != null) + if (values != null) { List list = values.ToList(); max = list.Max(); @@ -65,8 +68,8 @@ public T Min public bool Add(T value) { bool result = false; - - if((value as dynamic) > (max as dynamic)) + + if ((value as dynamic) > (max as dynamic)) { max = value; result = true; @@ -84,7 +87,7 @@ public bool Add(T value) public bool Add(Range value) { bool result = false; - if(value == null) + if (value == null) { return false; } @@ -152,7 +155,7 @@ public bool Out(T value, T tolerance) public bool In(Range range) { - if(range == null) + if (range == null) { return false; } @@ -229,4 +232,4 @@ public override int GetHashCode() return !(range == @object); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Base/Result.cs b/SAM/SAM.Core/Classes/Base/Result.cs index 7bfcaf0ba..9bd92996d 100644 --- a/SAM/SAM.Core/Classes/Base/Result.cs +++ b/SAM/SAM.Core/Classes/Base/Result.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Core @@ -91,7 +94,7 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { - JObject jObject = base.ToJObject(); + JObject jObject = base.ToJObject(); if (jObject == null) return null; @@ -107,4 +110,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Base/SAMColor.cs b/SAM/SAM.Core/Classes/Base/SAMColor.cs index c3aa573ff..f48548086 100644 --- a/SAM/SAM.Core/Classes/Base/SAMColor.cs +++ b/SAM/SAM.Core/Classes/Base/SAMColor.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Drawing; namespace SAM.Core @@ -105,7 +108,7 @@ public bool FromJObject(JObject jObject) if (jObject.ContainsKey("Name")) color = Convert.ToColor(jObject.Value("Name")); - if(color.Equals(Color.Empty)) + if (color.Equals(Color.Empty)) { alpha = jObject.Value("Alpha"); red = jObject.Value("Red"); @@ -122,7 +125,7 @@ public JObject ToJObject() jObject.Add("_type", Query.FullTypeName(this)); string name = Name; - if(string.IsNullOrWhiteSpace(name)) + if (string.IsNullOrWhiteSpace(name)) { jObject.Add("Alpha", alpha); jObject.Add("Red", red); @@ -142,4 +145,4 @@ public override string ToString() return ToColor().Name; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Base/SAMInstance.cs b/SAM/SAM.Core/Classes/Base/SAMInstance.cs index cc580f9a5..5427ade8a 100644 --- a/SAM/SAM.Core/Classes/Base/SAMInstance.cs +++ b/SAM/SAM.Core/Classes/Base/SAMInstance.cs @@ -1,11 +1,14 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; namespace SAM.Core { - public abstract class SAMInstance : SAMObject, ISAMInstance where T: SAMType + public abstract class SAMInstance : SAMObject, ISAMInstance where T : SAMType { private T type; @@ -59,7 +62,7 @@ public T Type set { - if(value == null) + if (value == null) { return; } @@ -115,4 +118,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Base/SAMObject.cs b/SAM/SAM.Core/Classes/Base/SAMObject.cs index 8f4a738a3..494022689 100644 --- a/SAM/SAM.Core/Classes/Base/SAMObject.cs +++ b/SAM/SAM.Core/Classes/Base/SAMObject.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -12,7 +15,7 @@ public class SAMObject : ParameterizedSAMObject, ISAMObject public SAMObject(SAMObject sAMObject) : base(sAMObject) { - if(sAMObject != null) + if (sAMObject != null) { guid = sAMObject.Guid; name = sAMObject.Name; @@ -41,14 +44,14 @@ public SAMObject(Guid guid, SAMObject sAMObject) } public SAMObject(Guid guid, string name, IEnumerable parameterSets) - :base(parameterSets) + : base(parameterSets) { this.guid = guid; this.name = name; } public SAMObject(Guid guid, string name) - :base() + : base() { this.guid = guid; this.name = name; @@ -61,18 +64,18 @@ public SAMObject() } public SAMObject(JObject jObject) - :base(jObject) + : base(jObject) { } public SAMObject(Guid guid) - :base() + : base() { this.guid = guid; } public SAMObject(string name) - :base() + : base() { this.name = name; guid = Guid.NewGuid(); @@ -101,7 +104,7 @@ public override bool FromJObject(JObject jObject) return false; } - if(!base.FromJObject(jObject)) + if (!base.FromJObject(jObject)) { return false; } @@ -114,7 +117,7 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { JObject jObject = base.ToJObject(); - if(jObject == null) + if (jObject == null) { return null; } @@ -127,4 +130,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Base/SAMObjectWrapper.cs b/SAM/SAM.Core/Classes/Base/SAMObjectWrapper.cs index 18f356b5a..2475b717d 100644 --- a/SAM/SAM.Core/Classes/Base/SAMObjectWrapper.cs +++ b/SAM/SAM.Core/Classes/Base/SAMObjectWrapper.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Core @@ -11,7 +14,7 @@ public JSAMObjectWrapper(JSAMObjectWrapper jSAMObjectWrapper) { jObject = jSAMObjectWrapper.jObject.DeepClone() as JObject; } - + public JSAMObjectWrapper(JObject jObject) { this.jObject = jObject; @@ -95,4 +98,4 @@ public JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Base/SAMType.cs b/SAM/SAM.Core/Classes/Base/SAMType.cs index 5a3aabd36..9a1091c9b 100644 --- a/SAM/SAM.Core/Classes/Base/SAMType.cs +++ b/SAM/SAM.Core/Classes/Base/SAMType.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -58,4 +61,4 @@ public override JObject ToJObject() return base.ToJObject(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Base/StartupOptions.cs b/SAM/SAM.Core/Classes/Base/StartupOptions.cs index f22c0d75d..1d547d0ff 100644 --- a/SAM/SAM.Core/Classes/Base/StartupOptions.cs +++ b/SAM/SAM.Core/Classes/Base/StartupOptions.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { diff --git a/SAM/SAM.Core/Classes/Base/Tag.cs b/SAM/SAM.Core/Classes/Base/Tag.cs index 84f7543fb..63586090a 100644 --- a/SAM/SAM.Core/Classes/Base/Tag.cs +++ b/SAM/SAM.Core/Classes/Base/Tag.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Drawing; @@ -255,12 +258,12 @@ public override int GetHashCode() public T GetValue() { - if(value is T) + if (value is T) { return (T)value; } - if(!Query.TryConvert(value, out T result)) + if (!Query.TryConvert(value, out T result)) { return default(T); } @@ -310,26 +313,26 @@ public virtual JObject ToJObject() ValueType valueType = ValueType; jObject.Add("ValueType", valueType.ToString()); - - if(valueType != ValueType.Undefined) + + if (valueType != ValueType.Undefined) { object value = null; - switch(valueType) + switch (valueType) { case ValueType.Boolean: - if(Query.TryConvert(Value, out bool @bool)) + if (Query.TryConvert(Value, out bool @bool)) { value = @bool; } break; - + case ValueType.Color: if (Query.TryConvert(Value, out Color color)) { value = new SAMColor(color).ToJObject(); } break; - + case ValueType.DateTime: if (Query.TryConvert(Value, out DateTime dateTime)) { @@ -370,7 +373,7 @@ public virtual JObject ToJObject() break; } - if(value != null) + if (value != null) { jObject.Add("Value", value as dynamic); } diff --git a/SAM/SAM.Core/Classes/Base/Types.cs b/SAM/SAM.Core/Classes/Base/Types.cs index d74e5e166..2e1e35356 100644 --- a/SAM/SAM.Core/Classes/Base/Types.cs +++ b/SAM/SAM.Core/Classes/Base/Types.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -15,10 +18,10 @@ public Types() public Types(IEnumerable types) { - if(types != null) + if (types != null) { this.types = new List(); - foreach(Type type in types) + foreach (Type type in types) { this.types.Add(type); } @@ -47,24 +50,24 @@ public Types(Types types) public bool Contains(string fullTypeName) { - if(types == null || string.IsNullOrWhiteSpace(fullTypeName) || types.Count == 0) + if (types == null || string.IsNullOrWhiteSpace(fullTypeName) || types.Count == 0) { return false; } - foreach(object @object in types) + foreach (object @object in types) { - if(@object is string) + if (@object is string) { - if(fullTypeName.Equals((string)@object)) + if (fullTypeName.Equals((string)@object)) { return true; } } - else if(@object is Type) + else if (@object is Type) { string fullTypeName_Temp = Query.FullTypeName((Type)@object); - if(fullTypeName.Equals(fullTypeName_Temp)) + if (fullTypeName.Equals(fullTypeName_Temp)) { return true; } @@ -76,7 +79,7 @@ public bool Contains(string fullTypeName) public bool Contains(Type type) { - if(type == null || types == null || types.Count == 0) + if (type == null || types == null || types.Count == 0) { return false; } @@ -85,7 +88,7 @@ public bool Contains(Type type) foreach (object @object in types) { - if(@object == null) + if (@object == null) { continue; } @@ -173,4 +176,4 @@ public virtual JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Base/ZipArchiveInfo.cs b/SAM/SAM.Core/Classes/Base/ZipArchiveInfo.cs index 8a7ba5ac4..f5ce429ab 100644 --- a/SAM/SAM.Core/Classes/Base/ZipArchiveInfo.cs +++ b/SAM/SAM.Core/Classes/Base/ZipArchiveInfo.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.IO.Compression; @@ -92,4 +95,4 @@ public JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Collection/GuidCollection.cs b/SAM/SAM.Core/Classes/Collection/GuidCollection.cs index fcc45dabb..e365d6322 100644 --- a/SAM/SAM.Core/Classes/Collection/GuidCollection.cs +++ b/SAM/SAM.Core/Classes/Collection/GuidCollection.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections; using System.Collections.Generic; diff --git a/SAM/SAM.Core/Classes/Collection/IndexedDoubles.cs b/SAM/SAM.Core/Classes/Collection/IndexedDoubles.cs index 668e14846..d7bcaa153 100644 --- a/SAM/SAM.Core/Classes/Collection/IndexedDoubles.cs +++ b/SAM/SAM.Core/Classes/Collection/IndexedDoubles.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; namespace SAM.Core @@ -6,19 +9,19 @@ namespace SAM.Core public class IndexedDoubles : IndexedObjects { public IndexedDoubles() - :base() + : base() { } public IndexedDoubles(JObject jObject) - :base(jObject) + : base(jObject) { } public IndexedDoubles(IndexedDoubles indexedDoubles) - :base(indexedDoubles) + : base(indexedDoubles) { } @@ -44,15 +47,15 @@ public IndexedDoubles(int startIndex, int count, double value) public void Sum(IndexedDoubles indexedDoubles) { IEnumerable keys = indexedDoubles?.Keys; - if(keys == null) + if (keys == null) { return; } - foreach(int index in keys) + foreach (int index in keys) { double value = indexedDoubles[index]; - if(double.IsNaN(value) || value == 0) + if (double.IsNaN(value) || value == 0) { continue; } @@ -67,15 +70,15 @@ public int GetMaxValueIndex() int result = -1; double max = double.MinValue; - foreach(int key in keys) + foreach (int key in keys) { double value = this[key]; - if(double.IsNaN(value)) + if (double.IsNaN(value)) { continue; } - if(value > max) + if (value > max) { max = value; result = key; @@ -112,7 +115,7 @@ public int GetMinValueIndex() public double GetMaxValue() { int index = GetMaxValueIndex(); - if(index == -1) + if (index == -1) { return double.NaN; } @@ -134,17 +137,17 @@ public double GetMinValue() public double GetSum() { IEnumerable keys = Keys; - if(keys == null) + if (keys == null) { return double.NaN; } double result = 0; - foreach(int key in keys) + foreach (int key in keys) { double value = this[key]; - if(double.IsNaN(value)) + if (double.IsNaN(value)) { continue; } diff --git a/SAM/SAM.Core/Classes/Collection/IndexedObjects.cs b/SAM/SAM.Core/Classes/Collection/IndexedObjects.cs index c12eb68a8..156291462 100644 --- a/SAM/SAM.Core/Classes/Collection/IndexedObjects.cs +++ b/SAM/SAM.Core/Classes/Collection/IndexedObjects.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections; using System.Collections.Generic; using System.Linq; @@ -21,12 +24,12 @@ public IndexedObjects(JObject jObject) public IndexedObjects(IEnumerable values) { - if(values != null) + if (values != null) { sortedDictionary = new SortedDictionary(); int index = 0; - foreach(T value in values) + foreach (T value in values) { sortedDictionary[index] = value; index++; @@ -51,10 +54,10 @@ public IndexedObjects(IEnumerable values, int startIndex) public IndexedObjects(SortedDictionary dictionary) { - if(dictionary != null) + if (dictionary != null) { this.sortedDictionary = new SortedDictionary(); - foreach(KeyValuePair keyValuePair in dictionary) + foreach (KeyValuePair keyValuePair in dictionary) { this.sortedDictionary[keyValuePair.Key] = keyValuePair.Value; } @@ -63,7 +66,7 @@ public IndexedObjects(SortedDictionary dictionary) } public IndexedObjects(IndexedObjects indexedObjects) - :this(indexedObjects?.sortedDictionary) + : this(indexedObjects?.sortedDictionary) { } @@ -83,12 +86,12 @@ public T this[int index] { get { - if(sortedDictionary == null) + if (sortedDictionary == null) { return default(T); } - if(!sortedDictionary.TryGetValue(index, out T value)) + if (!sortedDictionary.TryGetValue(index, out T value)) { return default(T); } @@ -98,7 +101,7 @@ public T this[int index] set { - if(sortedDictionary == null) + if (sortedDictionary == null) { sortedDictionary = new SortedDictionary(); } @@ -109,7 +112,7 @@ public T this[int index] public bool TryGetValue(int index, out T result) { - if(sortedDictionary == null || !sortedDictionary.ContainsKey(index)) + if (sortedDictionary == null || !sortedDictionary.ContainsKey(index)) { result = default(T); return false; @@ -126,13 +129,13 @@ public T GetValue(int index) public List GetValues(Range range) { - if(range == null || sortedDictionary == null) + if (range == null || sortedDictionary == null) { return null; } List result = new List(); - for(int i = range.Min; i <= range.Max; i++) + for (int i = range.Min; i <= range.Max; i++) { if (!sortedDictionary.TryGetValue(i, out T value)) { @@ -177,7 +180,7 @@ public List GetValues(Range range, bool bounded) public bool Add(int index, T value) { - if(sortedDictionary == null) + if (sortedDictionary == null) { sortedDictionary = new SortedDictionary(); } @@ -188,12 +191,12 @@ public bool Add(int index, T value) public bool Add(Range range, T value) { - if(sortedDictionary == null) + if (sortedDictionary == null) { sortedDictionary = new SortedDictionary(); } - for(int i = range.Min; i <= range.Max; i++) + for (int i = range.Min; i <= range.Max; i++) { sortedDictionary[i] = value; } @@ -203,7 +206,7 @@ public bool Add(Range range, T value) public bool Remove(int index) { - if(sortedDictionary == null) + if (sortedDictionary == null) { return false; } @@ -213,14 +216,14 @@ public bool Remove(int index) public bool ContainsIndex(int index) { - if(sortedDictionary == null || index == -1) + if (sortedDictionary == null || index == -1) { return false; } - foreach(int index_Temp in sortedDictionary.Keys) + foreach (int index_Temp in sortedDictionary.Keys) { - if(index == index_Temp) + if (index == index_Temp) { return true; } @@ -255,31 +258,31 @@ public IEnumerable Keys public virtual bool FromJObject(JObject jObject) { - if(jObject == null) + if (jObject == null) { return false; } - if(jObject.ContainsKey("Values")) + if (jObject.ContainsKey("Values")) { JArray jArray = jObject.Value("Values"); - if(jArray != null) + if (jArray != null) { sortedDictionary = new SortedDictionary(); - foreach(JArray jArray_Temp in jArray) + foreach (JArray jArray_Temp in jArray) { - if(jArray_Temp == null || jArray_Temp.Count < 1) + if (jArray_Temp == null || jArray_Temp.Count < 1) { - continue; + continue; } - if(jArray_Temp.Count == 1) + if (jArray_Temp.Count == 1) { sortedDictionary[(int)jArray_Temp[0]] = default(T); } else { - if(Query.TryConvert(jArray_Temp[1], out T result)) + if (Query.TryConvert(jArray_Temp[1], out T result)) { sortedDictionary[(int)jArray_Temp[0]] = result; } @@ -302,17 +305,17 @@ public virtual JObject ToJObject() { JObject jObject = new JObject(); jObject.Add("_type", Query.FullTypeName(this)); - if(sortedDictionary != null) + if (sortedDictionary != null) { JArray jArray = new JArray(); - foreach(KeyValuePair keyValuePair in sortedDictionary) + foreach (KeyValuePair keyValuePair in sortedDictionary) { JArray jArray_Temp = new JArray(); jArray_Temp.Add(keyValuePair.Key); - if(keyValuePair.Value != null) + if (keyValuePair.Value != null) { - if(keyValuePair.Value is IJSAMObject) + if (keyValuePair.Value is IJSAMObject) { jArray_Temp.Add(((IJSAMObject)keyValuePair.Value).ToJObject()); } diff --git a/SAM/SAM.Core/Classes/Collection/SAMCollection.cs b/SAM/SAM.Core/Classes/Collection/SAMCollection.cs index e90c4c038..3e25908d0 100644 --- a/SAM/SAM.Core/Classes/Collection/SAMCollection.cs +++ b/SAM/SAM.Core/Classes/Collection/SAMCollection.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -18,7 +21,7 @@ public SAMCollection(JObject jObject) public SAMCollection(SAMCollection sAMCollection) { - if(sAMCollection != null) + if (sAMCollection != null) { name = sAMCollection.name; guid = sAMCollection.guid; @@ -30,12 +33,12 @@ public SAMCollection(SAMCollection sAMCollection) } } } - + public SAMCollection() { guid = Guid.NewGuid(); } - + public SAMCollection(T t) { guid = Guid.NewGuid(); @@ -78,7 +81,7 @@ public virtual bool FromJObject(JObject jObject) guid = Query.Guid(jObject); parameterSets = Create.ParameterSets(jObject.Value("ParameterSets")); - if(jObject.ContainsKey("Collection")) + if (jObject.ContainsKey("Collection")) { foreach (JObject jObject_Collection in jObject.Value("Collection")) Add(Create.IJSAMObject(jObject_Collection)); @@ -91,7 +94,7 @@ public virtual JObject ToJObject() { JObject jObject = new JObject(); jObject.Add("_type", Query.FullTypeName(this)); - + if (name != null) jObject.Add("Name", name); @@ -117,13 +120,13 @@ public virtual JObject ToJObject() get { IList items = base.Items; - if(items == null) + if (items == null) { return null; } List result = new List(); - foreach(T t in items) + foreach (T t in items) { T t_temp = t == null ? default : Query.Clone(t); result.Add(t_temp); @@ -133,4 +136,4 @@ public virtual JObject ToJObject() } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Collection/SAMJsonCollection.cs b/SAM/SAM.Core/Classes/Collection/SAMJsonCollection.cs index ee554c266..0eb9070f2 100644 --- a/SAM/SAM.Core/Classes/Collection/SAMJsonCollection.cs +++ b/SAM/SAM.Core/Classes/Collection/SAMJsonCollection.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -12,7 +15,7 @@ public SAMJsonCollection() { } - + public SAMJsonCollection(string path) { FromJson(path); @@ -79,4 +82,4 @@ public bool FromJArray(JArray jArray) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Connection/Connection.cs b/SAM/SAM.Core/Classes/Connection/Connection.cs index fe37c663c..a276c1d2e 100644 --- a/SAM/SAM.Core/Classes/Connection/Connection.cs +++ b/SAM/SAM.Core/Classes/Connection/Connection.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Core { diff --git a/SAM/SAM.Core/Classes/Connection/ConnectionModel.cs b/SAM/SAM.Core/Classes/Connection/ConnectionModel.cs index 1e664af47..1487400d2 100644 --- a/SAM/SAM.Core/Classes/Connection/ConnectionModel.cs +++ b/SAM/SAM.Core/Classes/Connection/ConnectionModel.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Core diff --git a/SAM/SAM.Core/Classes/DelimitedFile/DelimitedFileReader.cs b/SAM/SAM.Core/Classes/DelimitedFile/DelimitedFileReader.cs index ac31d7a46..59827724f 100644 --- a/SAM/SAM.Core/Classes/DelimitedFile/DelimitedFileReader.cs +++ b/SAM/SAM.Core/Classes/DelimitedFile/DelimitedFileReader.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.IO; namespace SAM.Core @@ -160,4 +163,4 @@ public bool Read(DelimitedFileRow delimitedFileRow) return delimitedFileRows; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/DelimitedFile/DelimitedFileRow.cs b/SAM/SAM.Core/Classes/DelimitedFile/DelimitedFileRow.cs index 4b9bed71e..783d05bb7 100644 --- a/SAM/SAM.Core/Classes/DelimitedFile/DelimitedFileRow.cs +++ b/SAM/SAM.Core/Classes/DelimitedFile/DelimitedFileRow.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { @@ -21,7 +24,7 @@ public DelimitedFileRow(IEnumerable values) public bool TryGetValue(int index, out T value) { value = default(T); - if( index < 0 || index >= Count) + if (index < 0 || index >= Count) { return false; } @@ -29,4 +32,4 @@ public bool TryGetValue(int index, out T value) return Query.TryConvert(this[index], out value); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/DelimitedFile/DelimitedFileTable.cs b/SAM/SAM.Core/Classes/DelimitedFile/DelimitedFileTable.cs index 366fcf7cc..9fb610f65 100644 --- a/SAM/SAM.Core/Classes/DelimitedFile/DelimitedFileTable.cs +++ b/SAM/SAM.Core/Classes/DelimitedFile/DelimitedFileTable.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections; using System.Collections.Generic; using System.Linq; @@ -235,19 +238,19 @@ public int GetColumnIndex(string columnName) { int rowCount = 0; int columnCount = 0; - if(names != null && names.Length != 0) + if (names != null && names.Length != 0) { rowCount++; columnCount = names.Length; } - if(header != null && header.Count != 0) + if (header != null && header.Count != 0) { rowCount += header.Count; columnCount = Math.Max(columnCount, header.ConvertAll(x => x == null ? 0 : x.Length).Max()); } - if(values != null && values.Count != 0) + if (values != null && values.Count != 0) { rowCount += values.Count; columnCount = Math.Max(columnCount, values.ConvertAll(x => x == null ? 0 : x.Length).Max()); @@ -256,9 +259,9 @@ public int GetColumnIndex(string columnName) object[,] result = new object[rowCount, columnCount]; int rowIndex = 0; - if(names != null && names.Length != 0) + if (names != null && names.Length != 0) { - for(int i=0; i < names.Length; i++) + for (int i = 0; i < names.Length; i++) { result[rowIndex, i] = names[i]; } @@ -267,9 +270,9 @@ public int GetColumnIndex(string columnName) if (header != null && header.Count != 0) { - foreach(object[] row in header) + foreach (object[] row in header) { - if(row != null) + if (row != null) { for (int i = 0; i < row.Length; i++) { @@ -310,11 +313,11 @@ public void Sort(int index) if (values == null || values.Count == 0) return; - + List values_Valid = new List(); List values_Invalid = new List(); - foreach(object[] value in values) + foreach (object[] value in values) { if (value == null || value.Length <= index || !(value[index] is IComparable)) values_Invalid.Add(value); @@ -357,7 +360,7 @@ public bool SetColumnName(string columnName_Old, string columnName_New) public bool TryGetColumnName(int index, out string name) { name = null; - + if (names == null) return false; @@ -373,7 +376,7 @@ public bool SetValue(object value, int row = -1, int column = -1) if (column == -1 && row == -1) return false; - if(row != -1 && column != -1) + if (row != -1 && column != -1) { if (row >= values.Count) return false; @@ -400,7 +403,7 @@ public bool SetValue(object value, int row = -1, int column = -1) return false; bool result = false; - foreach(object[] row_Values in values) + foreach (object[] row_Values in values) { if (column >= row_Values.Length) continue; @@ -430,7 +433,7 @@ public List GetRowIndexes(int columnIndex, string text, TextComparisonType return null; List result = new List(); - for(int i=0; i < RowCount; i++) + for (int i = 0; i < RowCount; i++) { string value = ToString(i, columnIndex); if (Query.Compare(value, text, textComparisonType, caseSensitive)) @@ -450,7 +453,7 @@ public int GetColumnIndex(object value, int headerIndex) for (int i = 0; i < values.Length; i++) { - if(values[i] == null) + if (values[i] == null) { if (value == null) return i; @@ -469,9 +472,9 @@ public object[] GetColumnValues(int index) { if (index >= names.Length || index < 0) return null; - + object[] result = new object[values.Count]; - for(int i = 0; i < values.Count; i++) + for (int i = 0; i < values.Count; i++) { result[i] = values[i][index]; } @@ -495,7 +498,7 @@ public object[] GetColumnValues(string columnName) object[,] result = new object[values.Count, indexes.Count()]; int count = 0; - foreach(int index in indexes) + foreach (int index in indexes) { object[] values = GetColumnValues(index); if (values == null || values.Length == 0) @@ -504,7 +507,7 @@ public object[] GetColumnValues(string columnName) continue; } - for(int i = 0; i < values.Length; i++) + for (int i = 0; i < values.Length; i++) result[i, count] = values[i]; count++; @@ -517,7 +520,7 @@ public object[] GetRowValues(int index) { if (index < 0 || index >= names.Length) return null; - + return values[index]; } @@ -801,22 +804,22 @@ IEnumerator IEnumerable.GetEnumerator() public bool ConvertValues(int columnIndex, T @default = default) { - if(names == null || values == null) + if (names == null || values == null) { return false; } - if(columnIndex < 0) + if (columnIndex < 0) { return false; } - if(columnIndex >= names.Length) + if (columnIndex >= names.Length) { return false; } - foreach(object[] row in values) + foreach (object[] row in values) { if (row == null || row.Length <= columnIndex) { @@ -852,4 +855,4 @@ private static string[] Extract(T[] values) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/DelimitedFile/DelimitedFileWriter.cs b/SAM/SAM.Core/Classes/DelimitedFile/DelimitedFileWriter.cs index 75aeac6ca..111ef3c44 100644 --- a/SAM/SAM.Core/Classes/DelimitedFile/DelimitedFileWriter.cs +++ b/SAM/SAM.Core/Classes/DelimitedFile/DelimitedFileWriter.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.IO; using System.Text; @@ -80,4 +83,4 @@ public void Write(DelimitedFileTable delimitedFileTable) delimitedFileTable.Write(this); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Expression/Command.cs b/SAM/SAM.Core/Classes/Expression/Command.cs index 763a02a94..4a41a9c34 100644 --- a/SAM/SAM.Core/Classes/Expression/Command.cs +++ b/SAM/SAM.Core/Classes/Expression/Command.cs @@ -1,4 +1,7 @@ -//'SAM' + SAM.Core.Revit.Query.ParameterNamePrefix($Object_1) + '_PeakDate' +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +//'SAM' + SAM.Core.Revit.Query.ParameterNamePrefix($Object_1) + '_PeakDate' //2 + 50 + SAM.Core.Revit.Query.Number($Object_1) + $Object_2 //(2 + 50) / $Object_2 //(2 + 10) < $Object_2 @@ -115,7 +118,7 @@ public bool IsValue(out object value) string @operator = Query.Operator(CommandOperator.Text); - if(text_Trim.Length >= 2 && text_Trim[0] == @operator[0] && text_Trim[text_Trim.Length - 1] == @operator[0]) + if (text_Trim.Length >= 2 && text_Trim[0] == @operator[0] && text_Trim[text_Trim.Length - 1] == @operator[0]) { value = text_Trim.Substring(1, text_Trim.Length - 2); return true; @@ -201,13 +204,13 @@ public bool IsCommand(out string name, out Command command, out List me text_Trim = text_Trim.Substring(index_Start); List commands = Create.Commands(text_Trim, new Enum[] { CommandOperator.MemberSeparator }); - if(commands != null && commands.Count != 0) + if (commands != null && commands.Count != 0) { commands.RemoveAt(0); if (commands.Count != 0) members = commands.FindAll(x => !x.IsOperator(out Enum @enum_Temp)); } - + return true; } @@ -225,7 +228,7 @@ public bool IsComment() { return IsComment(out string comment); } - + public bool IsEmpty() { return string.IsNullOrWhiteSpace(text); @@ -294,7 +297,7 @@ private bool IsCommandOperator(CommandOperator commandOperator, out string value public override bool Equals(object obj) { Command command = obj as Command; - if(command == null) + if (command == null) { return false; } @@ -304,7 +307,7 @@ public override bool Equals(object obj) public override int GetHashCode() { - if(text == null) + if (text == null) { return -1; } diff --git a/SAM/SAM.Core/Classes/Expression/Expression.cs b/SAM/SAM.Core/Classes/Expression/Expression.cs index f6b42157c..d8e610b92 100644 --- a/SAM/SAM.Core/Classes/Expression/Expression.cs +++ b/SAM/SAM.Core/Classes/Expression/Expression.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; namespace SAM.Core @@ -6,7 +9,7 @@ namespace SAM.Core public class Expression : IJSAMObject { private string text; - + public Expression(string text) { this.text = text; @@ -68,7 +71,7 @@ public JObject ToJObject() public override bool Equals(object obj) { Expression expression = obj as Expression; - if(expression == null) + if (expression == null) { return false; } @@ -78,7 +81,7 @@ public override bool Equals(object obj) public override int GetHashCode() { - if(text == null) + if (text == null) { return -1; } diff --git a/SAM/SAM.Core/Classes/Expression/ExpressionVariable.cs b/SAM/SAM.Core/Classes/Expression/ExpressionVariable.cs index b123bd214..5ab988114 100644 --- a/SAM/SAM.Core/Classes/Expression/ExpressionVariable.cs +++ b/SAM/SAM.Core/Classes/Expression/ExpressionVariable.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; namespace SAM.Core @@ -6,7 +9,7 @@ namespace SAM.Core public class ExpressionVariable : IJSAMObject { private string text; - + public ExpressionVariable(string text) { this.text = text; @@ -45,7 +48,7 @@ public bool TryGetProperties(out ExpressionVariable expressionVariable, out stri } List texts = Query.Texts(Text, openSymbol, closeSymbol); - if(texts == null || texts.Count == 0) + if (texts == null || texts.Count == 0) { name = text; return true; @@ -103,7 +106,7 @@ public JObject ToJObject() public override bool Equals(object obj) { ExpressionVariable expressionVariable = obj as ExpressionVariable; - if(expressionVariable == null) + if (expressionVariable == null) { return false; } @@ -113,7 +116,7 @@ public override bool Equals(object obj) public override int GetHashCode() { - if(text == null) + if (text == null) { return -1; } diff --git a/SAM/SAM.Core/Classes/Filter/ComplexReferenceFilter.cs b/SAM/SAM.Core/Classes/Filter/ComplexReferenceFilter.cs index 3dc64ffb8..c0d1ee17a 100644 --- a/SAM/SAM.Core/Classes/Filter/ComplexReferenceFilter.cs +++ b/SAM/SAM.Core/Classes/Filter/ComplexReferenceFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; namespace SAM.Core @@ -25,7 +28,7 @@ public ComplexReferenceFilter(ComplexReferenceFilter complexReferenceFilter) ComplexReference = complexReferenceFilter?.ComplexReference?.Clone(); SAMObjectRelationCluster = complexReferenceFilter?.SAMObjectRelationCluster; } - + public override bool FromJObject(JObject jObject) { if (!base.FromJObject(jObject)) @@ -50,7 +53,7 @@ public override bool IsValid(IJSAMObject jSAMObject) } bool result = IsValid(values); - if(Inverted) + if (Inverted) { result = !result; } @@ -68,7 +71,7 @@ public override JObject ToJObject() return result; } - if(ComplexReference != null) + if (ComplexReference != null) { result.Add("ComplexReference", ComplexReference.ToJObject()); } @@ -76,4 +79,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Filter/ComplexReferenceNumberFilter.cs b/SAM/SAM.Core/Classes/Filter/ComplexReferenceNumberFilter.cs index d6bedcd13..ef1c7fae4 100644 --- a/SAM/SAM.Core/Classes/Filter/ComplexReferenceNumberFilter.cs +++ b/SAM/SAM.Core/Classes/Filter/ComplexReferenceNumberFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; using System.Linq; @@ -25,14 +28,14 @@ public ComplexReferenceNumberFilter() public ComplexReferenceNumberFilter(ComplexReferenceNumberFilter complexReferenceNumberFilter) : base(complexReferenceNumberFilter) { - if(complexReferenceNumberFilter != null) + if (complexReferenceNumberFilter != null) { FilterLogicalOperator = complexReferenceNumberFilter.FilterLogicalOperator; NumberComparisonType = complexReferenceNumberFilter.NumberComparisonType; Value = complexReferenceNumberFilter.Value; } } - + public override bool FromJObject(JObject jObject) { if (!base.FromJObject(jObject)) @@ -60,16 +63,16 @@ public override bool FromJObject(JObject jObject) protected override bool IsValid(IEnumerable values) { - if(values == null || values.Count() == 0) + if (values == null || values.Count() == 0) { return false; } - foreach(object value in values) + foreach (object value in values) { - if(!Query.TryConvert(value, out double number)) + if (!Query.TryConvert(value, out double number)) { - if(FilterLogicalOperator == FilterLogicalOperator.And) + if (FilterLogicalOperator == FilterLogicalOperator.And) { return false; } @@ -77,7 +80,7 @@ protected override bool IsValid(IEnumerable values) continue; } - if(!Query.Compare(number, Value, NumberComparisonType)) + if (!Query.Compare(number, Value, NumberComparisonType)) { if (FilterLogicalOperator == FilterLogicalOperator.And) { @@ -116,4 +119,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Filter/ComplexReferenceTextFilter.cs b/SAM/SAM.Core/Classes/Filter/ComplexReferenceTextFilter.cs index adf7af4e1..e817bebb7 100644 --- a/SAM/SAM.Core/Classes/Filter/ComplexReferenceTextFilter.cs +++ b/SAM/SAM.Core/Classes/Filter/ComplexReferenceTextFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; using System.Linq; @@ -27,7 +30,7 @@ public ComplexReferenceTextFilter() public ComplexReferenceTextFilter(ComplexReferenceTextFilter complexReferenceTextFilter) : base(complexReferenceTextFilter) { - if(complexReferenceTextFilter != null) + if (complexReferenceTextFilter != null) { FilterLogicalOperator = complexReferenceTextFilter.FilterLogicalOperator; TextComparisonType = complexReferenceTextFilter.TextComparisonType; @@ -35,7 +38,7 @@ public ComplexReferenceTextFilter(ComplexReferenceTextFilter complexReferenceTex CaseSensitive = complexReferenceTextFilter.CaseSensitive; } } - + public override bool FromJObject(JObject jObject) { if (!base.FromJObject(jObject)) @@ -68,16 +71,16 @@ public override bool FromJObject(JObject jObject) protected override bool IsValid(IEnumerable values) { - if(values == null || values.Count() == 0) + if (values == null || values.Count() == 0) { return false; } - foreach(object value in values) + foreach (object value in values) { - if(!Query.TryConvert(value, out string text)) + if (!Query.TryConvert(value, out string text)) { - if(FilterLogicalOperator == FilterLogicalOperator.And) + if (FilterLogicalOperator == FilterLogicalOperator.And) { return false; } @@ -85,7 +88,7 @@ protected override bool IsValid(IEnumerable values) continue; } - if(!Query.Compare(text, Value, TextComparisonType, CaseSensitive)) + if (!Query.Compare(text, Value, TextComparisonType, CaseSensitive)) { if (FilterLogicalOperator == FilterLogicalOperator.And) { @@ -126,4 +129,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Filter/EnumFilter.cs b/SAM/SAM.Core/Classes/Filter/EnumFilter.cs index 071921534..3821b36ac 100644 --- a/SAM/SAM.Core/Classes/Filter/EnumFilter.cs +++ b/SAM/SAM.Core/Classes/Filter/EnumFilter.cs @@ -1,9 +1,12 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Core { - public abstract class EnumFilter : Filter, IEnumFilter where T: Enum + public abstract class EnumFilter : Filter, IEnumFilter where T : Enum { public EnumFilter(EnumFilter enumFilter) : base(enumFilter) @@ -65,27 +68,27 @@ public override bool FromJObject(JObject jObject) public override bool IsValid(IJSAMObject jSAMObject) { - if(jSAMObject == null) + if (jSAMObject == null) { return false; } - if(!TryGetEnum(jSAMObject, out T @enum)) + if (!TryGetEnum(jSAMObject, out T @enum)) { return false; } - if(@enum == null) + if (@enum == null) { return false; } - if(Value == null && @enum == null) + if (Value == null && @enum == null) { return true; } - if(Value == null || @enum == null) + if (Value == null || @enum == null) { return false; } diff --git a/SAM/SAM.Core/Classes/Filter/Filter.cs b/SAM/SAM.Core/Classes/Filter/Filter.cs index aa83344b9..ec5c5773c 100644 --- a/SAM/SAM.Core/Classes/Filter/Filter.cs +++ b/SAM/SAM.Core/Classes/Filter/Filter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Core { diff --git a/SAM/SAM.Core/Classes/Filter/GuidFilter.cs b/SAM/SAM.Core/Classes/Filter/GuidFilter.cs index 4bf6467c5..88c716d68 100644 --- a/SAM/SAM.Core/Classes/Filter/GuidFilter.cs +++ b/SAM/SAM.Core/Classes/Filter/GuidFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Core { diff --git a/SAM/SAM.Core/Classes/Filter/LogicalFilter.cs b/SAM/SAM.Core/Classes/Filter/LogicalFilter.cs index 66a327e69..a809aca7d 100644 --- a/SAM/SAM.Core/Classes/Filter/LogicalFilter.cs +++ b/SAM/SAM.Core/Classes/Filter/LogicalFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; namespace SAM.Core diff --git a/SAM/SAM.Core/Classes/Filter/MultiRelationFilter.cs b/SAM/SAM.Core/Classes/Filter/MultiRelationFilter.cs index 2cb6e53b9..362bc2371 100644 --- a/SAM/SAM.Core/Classes/Filter/MultiRelationFilter.cs +++ b/SAM/SAM.Core/Classes/Filter/MultiRelationFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; namespace SAM.Core @@ -105,4 +108,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Filter/NameFilter.cs b/SAM/SAM.Core/Classes/Filter/NameFilter.cs index 454410940..3f6efa74e 100644 --- a/SAM/SAM.Core/Classes/Filter/NameFilter.cs +++ b/SAM/SAM.Core/Classes/Filter/NameFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Core { @@ -32,4 +35,4 @@ public override bool TryGetText(IJSAMObject jSAMObject, out string text) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Filter/NumberFilter.cs b/SAM/SAM.Core/Classes/Filter/NumberFilter.cs index 607e774a6..e2a38de0d 100644 --- a/SAM/SAM.Core/Classes/Filter/NumberFilter.cs +++ b/SAM/SAM.Core/Classes/Filter/NumberFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Core { @@ -85,4 +88,4 @@ public override JObject ToJObject() public abstract bool TryGetNumber(IJSAMObject jSAMObject, out double number); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Filter/ParameterFilter.cs b/SAM/SAM.Core/Classes/Filter/ParameterFilter.cs index dac2eea75..095d4a578 100644 --- a/SAM/SAM.Core/Classes/Filter/ParameterFilter.cs +++ b/SAM/SAM.Core/Classes/Filter/ParameterFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Core @@ -253,4 +256,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Filter/RelationFilter.cs b/SAM/SAM.Core/Classes/Filter/RelationFilter.cs index ab7748fd2..0d519cae2 100644 --- a/SAM/SAM.Core/Classes/Filter/RelationFilter.cs +++ b/SAM/SAM.Core/Classes/Filter/RelationFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Core { @@ -78,4 +81,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Filter/TextFilter.cs b/SAM/SAM.Core/Classes/Filter/TextFilter.cs index adaaf0eba..dd01addee 100644 --- a/SAM/SAM.Core/Classes/Filter/TextFilter.cs +++ b/SAM/SAM.Core/Classes/Filter/TextFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Core { @@ -27,11 +30,11 @@ public TextFilter(TextComparisonType textComparisonType, string value) } public bool CaseSensitive { get; set; } = true; - + public TextComparisonType TextComparisonType { get; set; } = TextComparisonType.Equals; public string Value { get; set; } - + public override bool FromJObject(JObject jObject) { if (!base.FromJObject(jObject)) @@ -95,4 +98,4 @@ public override JObject ToJObject() public abstract bool TryGetText(IJSAMObject jSAMObject, out string text); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Filter/TypeFilter.cs b/SAM/SAM.Core/Classes/Filter/TypeFilter.cs index f7dda1ba9..f80bba4e4 100644 --- a/SAM/SAM.Core/Classes/Filter/TypeFilter.cs +++ b/SAM/SAM.Core/Classes/Filter/TypeFilter.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Core { @@ -77,4 +80,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Graph/Graph.cs b/SAM/SAM.Core/Classes/Graph/Graph.cs index 990ea329d..9226476c5 100644 --- a/SAM/SAM.Core/Classes/Graph/Graph.cs +++ b/SAM/SAM.Core/Classes/Graph/Graph.cs @@ -1,4 +1,7 @@ -using System.Collections; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections; using System.Collections.Generic; using System.Linq; @@ -315,4 +318,4 @@ private void AppendGraphEdges(GraphEdge graphEdge, ref HashSet graphE } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Graph/GraphEdge.cs b/SAM/SAM.Core/Classes/Graph/GraphEdge.cs index fbd3c5aad..ae3b5ca28 100644 --- a/SAM/SAM.Core/Classes/Graph/GraphEdge.cs +++ b/SAM/SAM.Core/Classes/Graph/GraphEdge.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public class GraphEdge { @@ -41,4 +44,4 @@ public T GetObject() return default; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Graph/GraphNode.cs b/SAM/SAM.Core/Classes/Graph/GraphNode.cs index fd42f6353..dbec393c3 100644 --- a/SAM/SAM.Core/Classes/Graph/GraphNode.cs +++ b/SAM/SAM.Core/Classes/Graph/GraphNode.cs @@ -1,4 +1,7 @@ -using System.Collections; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections; using System.Collections.Generic; namespace SAM.Core @@ -72,4 +75,4 @@ IEnumerator IEnumerable.GetEnumerator() return graphEdges.GetEnumerator(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Graph/GraphPath.cs b/SAM/SAM.Core/Classes/Graph/GraphPath.cs index caecde5d4..6abb210f6 100644 --- a/SAM/SAM.Core/Classes/Graph/GraphPath.cs +++ b/SAM/SAM.Core/Classes/Graph/GraphPath.cs @@ -1,4 +1,7 @@ -using System.Collections; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections; using System.Collections.Generic; using System.Linq; @@ -97,4 +100,4 @@ public int IndexOf(GraphEdge graphEdge) return graphEdges.IndexOf(graphEdge); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Library/SAMLibrary.cs b/SAM/SAM.Core/Classes/Library/SAMLibrary.cs index 34c856a93..6a8e9c203 100644 --- a/SAM/SAM.Core/Classes/Library/SAMLibrary.cs +++ b/SAM/SAM.Core/Classes/Library/SAMLibrary.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.IO; @@ -6,7 +9,7 @@ namespace SAM.Core { - public abstract class SAMLibrary: SAMObject, ISAMLibrary where T: IJSAMObject + public abstract class SAMLibrary : SAMObject, ISAMLibrary where T : IJSAMObject { private Dictionary objects; @@ -148,7 +151,7 @@ public override bool FromJObject(JObject jObject) if (jSAMObjects != null && jSAMObjects.Count != 0) jSAMObjects.ForEach(x => Add(x)); } - + return true; } diff --git a/SAM/SAM.Core/Classes/Library/SystemTypeLibrary.cs b/SAM/SAM.Core/Classes/Library/SystemTypeLibrary.cs index f1f99385d..af250c1c4 100644 --- a/SAM/SAM.Core/Classes/Library/SystemTypeLibrary.cs +++ b/SAM/SAM.Core/Classes/Library/SystemTypeLibrary.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -63,7 +66,7 @@ public override bool IsValid(ISystemType systemType) return true; } - public List GetSystemTypes() where T: ISystemType + public List GetSystemTypes() where T : ISystemType { return GetObjects(); } @@ -72,7 +75,7 @@ public List GetSystemTypes(string text, TextComparisonType textComparisonT { if (string.IsNullOrWhiteSpace(text)) return null; - + List systemTypes = GetSystemTypes(); if (systemTypes == null || systemTypes.Count == 0) return null; @@ -80,4 +83,4 @@ public List GetSystemTypes(string text, TextComparisonType textComparisonT return systemTypes.FindAll(x => Query.Compare(x.Name, text, textComparisonType, caseSensitive)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Log/Log.cs b/SAM/SAM.Core/Classes/Log/Log.cs index 101fb95fe..e7f3947ab 100644 --- a/SAM/SAM.Core/Classes/Log/Log.cs +++ b/SAM/SAM.Core/Classes/Log/Log.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections; using System.Collections.Generic; @@ -49,11 +52,11 @@ public LogRecord Add(LogRecord logRecord) } LogRecord result = logRecord.Clone(); - if(result != null) + if (result != null) { logRecords.Add(result); } - + return result; } @@ -75,7 +78,7 @@ public List AddRange(IEnumerable logRecords) { if (logRecord == null) continue; - + LogRecord logRecord_New = logRecord.Clone(); if (logRecord_New == null) continue; @@ -99,7 +102,7 @@ public override bool FromJObject(JObject jObject) logRecords = new List(); JArray jArray = jObject.Value("LogRecords"); - if(jArray != null) + if (jArray != null) { foreach (JObject jObject_Temp in jArray) logRecords.Add(new LogRecord(jObject_Temp)); @@ -145,7 +148,7 @@ public bool Write(string path) { System.IO.File.AppendAllText(path, ToString() + Environment.NewLine); } - catch(Exception) + catch (Exception) { return false; } @@ -153,4 +156,4 @@ public bool Write(string path) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Log/LogRecord.cs b/SAM/SAM.Core/Classes/Log/LogRecord.cs index 8aa1c4f13..3b7040b04 100644 --- a/SAM/SAM.Core/Classes/Log/LogRecord.cs +++ b/SAM/SAM.Core/Classes/Log/LogRecord.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Core @@ -144,4 +147,4 @@ public bool Write(string path) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Manager/ActionManager.cs b/SAM/SAM.Core/Classes/Manager/ActionManager.cs index 697c2b26e..050128606 100644 --- a/SAM/SAM.Core/Classes/Manager/ActionManager.cs +++ b/SAM/SAM.Core/Classes/Manager/ActionManager.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Threading.Tasks; @@ -28,7 +31,7 @@ public void Add(Action action) return; } - if(actions == null) + if (actions == null) { actions = new List(); } @@ -43,7 +46,7 @@ public void AddRange(IEnumerable actions) return; } - if(this.actions == null) + if (this.actions == null) { this.actions = new List(); } diff --git a/SAM/SAM.Core/Classes/Material/FluidMaterial.cs b/SAM/SAM.Core/Classes/Material/FluidMaterial.cs index 032fb4b8c..48a5c30c7 100644 --- a/SAM/SAM.Core/Classes/Material/FluidMaterial.cs +++ b/SAM/SAM.Core/Classes/Material/FluidMaterial.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; @@ -7,7 +10,7 @@ namespace SAM.Core public abstract class FluidMaterial : Material { private double dynamicViscosity = double.NaN; - + public FluidMaterial(string name) : base(name) { @@ -83,4 +86,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Material/GasMaterial.cs b/SAM/SAM.Core/Classes/Material/GasMaterial.cs index 9aff621c6..bbb463f51 100644 --- a/SAM/SAM.Core/Classes/Material/GasMaterial.cs +++ b/SAM/SAM.Core/Classes/Material/GasMaterial.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; @@ -23,7 +26,7 @@ public GasMaterial(string name, string group, string displayName, string descrip { } - + public GasMaterial(Guid guid, string name) : base(guid, name) { @@ -42,7 +45,7 @@ public GasMaterial(GasMaterial gasMaterial) } public GasMaterial(string name, Guid guid, GasMaterial gasMaterial, string displayName, string description) - :base(name, guid, gasMaterial, displayName, description) + : base(name, guid, gasMaterial, displayName, description) { } @@ -64,4 +67,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Material/LiquidMaterial.cs b/SAM/SAM.Core/Classes/Material/LiquidMaterial.cs index 72a60d24d..ffdcbc311 100644 --- a/SAM/SAM.Core/Classes/Material/LiquidMaterial.cs +++ b/SAM/SAM.Core/Classes/Material/LiquidMaterial.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; @@ -23,7 +26,7 @@ public LiquidMaterial(string name, string group, string displayName, string desc { } - + public LiquidMaterial(Guid guid, string name) : base(guid, name) { @@ -42,7 +45,7 @@ public LiquidMaterial(LiquidMaterial liquidMaterial) } public LiquidMaterial(string name, Guid guid, LiquidMaterial liquidMaterial, string displayName, string description) - :base(name, guid, liquidMaterial, displayName, description) + : base(name, guid, liquidMaterial, displayName, description) { } @@ -64,4 +67,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Material/Material.cs b/SAM/SAM.Core/Classes/Material/Material.cs index 447a037b3..c5992e0e7 100644 --- a/SAM/SAM.Core/Classes/Material/Material.cs +++ b/SAM/SAM.Core/Classes/Material/Material.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; @@ -13,7 +16,7 @@ public abstract class Material : SAMObject, IMaterial private double thermalConductivity = double.NaN; private double specificHeatCapacity = double.NaN; private double density = double.NaN; - + public Material(string name) : base(name) { @@ -33,7 +36,7 @@ public Material(string name, string group, string displayName, string descriptio } public Material(Guid guid, string name, string displayName, string description, double thermalConductivity, double density, double specificHeatCapacity) - :base(guid, name) + : base(guid, name) { this.displayName = displayName; this.description = description; @@ -59,7 +62,7 @@ public Material(Guid guid, string name) public Material(JObject jObject) : base(jObject) { - + } public Material(Material material) @@ -174,7 +177,7 @@ public override bool FromJObject(JObject jObject) if (jObject.ContainsKey("Description")) description = jObject.Value("Description"); - if(jObject.ContainsKey("ThermalConductivity")) + if (jObject.ContainsKey("ThermalConductivity")) thermalConductivity = jObject.Value("ThermalConductivity"); if (jObject.ContainsKey("SpecificHeatCapacity")) @@ -213,4 +216,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Material/MaterialLibrary.cs b/SAM/SAM.Core/Classes/Material/MaterialLibrary.cs index bee113d7c..fdf4ad4f7 100644 --- a/SAM/SAM.Core/Classes/Material/MaterialLibrary.cs +++ b/SAM/SAM.Core/Classes/Material/MaterialLibrary.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -71,7 +74,7 @@ public IMaterial GetMaterial(string name) return GetMaterial(name); } - public T GetMaterial(string name) where T: IMaterial + public T GetMaterial(string name) where T : IMaterial { if (name == null) { @@ -87,4 +90,4 @@ public T GetMaterial(string name) where T: IMaterial return materials.Find(x => x.Name == name); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Material/OpaqueMaterial.cs b/SAM/SAM.Core/Classes/Material/OpaqueMaterial.cs index 7f838a7af..7f5b17dea 100644 --- a/SAM/SAM.Core/Classes/Material/OpaqueMaterial.cs +++ b/SAM/SAM.Core/Classes/Material/OpaqueMaterial.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; @@ -63,4 +66,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Material/SolidMaterial.cs b/SAM/SAM.Core/Classes/Material/SolidMaterial.cs index 3afe3d89b..f854f1b5e 100644 --- a/SAM/SAM.Core/Classes/Material/SolidMaterial.cs +++ b/SAM/SAM.Core/Classes/Material/SolidMaterial.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; @@ -65,4 +68,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Material/TransparentMaterial.cs b/SAM/SAM.Core/Classes/Material/TransparentMaterial.cs index 353397511..197257673 100644 --- a/SAM/SAM.Core/Classes/Material/TransparentMaterial.cs +++ b/SAM/SAM.Core/Classes/Material/TransparentMaterial.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; @@ -39,7 +42,7 @@ public TransparentMaterial(Guid guid, string name) public TransparentMaterial(JObject jObject) : base(jObject) { - + } public TransparentMaterial(TransparentMaterial transparentMaterial) @@ -64,4 +67,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Message/Message.cs b/SAM/SAM.Core/Classes/Message/Message.cs index 7d62e8c52..e0f68ece9 100644 --- a/SAM/SAM.Core/Classes/Message/Message.cs +++ b/SAM/SAM.Core/Classes/Message/Message.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Core { diff --git a/SAM/SAM.Core/Classes/Model/Address.cs b/SAM/SAM.Core/Classes/Model/Address.cs index e38fde06f..0a650f7ed 100644 --- a/SAM/SAM.Core/Classes/Model/Address.cs +++ b/SAM/SAM.Core/Classes/Model/Address.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Core @@ -18,7 +21,7 @@ public Address(Address address) postalCode = address.postalCode; countryCode = address.countryCode; } - + public Address(string street, string city, string postalCode, CountryCode countryCode) : base() { @@ -105,7 +108,7 @@ public override JObject ToJObject() if (city != null) jObject.Add("City", city); - + if (postalCode != null) jObject.Add("PostalCode", postalCode); diff --git a/SAM/SAM.Core/Classes/Model/Location.cs b/SAM/SAM.Core/Classes/Model/Location.cs index d14333da8..35b213713 100644 --- a/SAM/SAM.Core/Classes/Model/Location.cs +++ b/SAM/SAM.Core/Classes/Model/Location.cs @@ -1,10 +1,13 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Core { - public class Location: SAMObject + public class Location : SAMObject { private double longitude; private double latitude; @@ -13,7 +16,7 @@ public class Location: SAMObject public Location(Location location) : base(location) { - if(location != null) + if (location != null) { longitude = location.longitude; latitude = location.latitude; diff --git a/SAM/SAM.Core/Classes/Model/SAMModel.cs b/SAM/SAM.Core/Classes/Model/SAMModel.cs index 4633d7f11..787ee1e2f 100644 --- a/SAM/SAM.Core/Classes/Model/SAMModel.cs +++ b/SAM/SAM.Core/Classes/Model/SAMModel.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -11,7 +14,7 @@ public SAMModel() { } - + public SAMModel(Guid guid, string name) : base(guid, name) { @@ -57,4 +60,4 @@ public override JObject ToJObject() return base.ToJObject(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Modifier/ComplexModifier.cs b/SAM/SAM.Core/Classes/Modifier/ComplexModifier.cs index da51b4383..bfa97380b 100644 --- a/SAM/SAM.Core/Classes/Modifier/ComplexModifier.cs +++ b/SAM/SAM.Core/Classes/Modifier/ComplexModifier.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; using System.Linq; @@ -7,7 +10,7 @@ namespace SAM.Core public class ComplexModifier : Modifier, IComplexModifier { public ComplexModifier() - :base() + : base() { } @@ -21,7 +24,7 @@ public ComplexModifier(IEnumerable modifiers) public ComplexModifier(ComplexModifier complexModifier) : base(complexModifier) { - if(complexModifier != null) + if (complexModifier != null) { Modifiers = complexModifier.Modifiers.ConvertAll(x => x.Clone()); } @@ -36,18 +39,18 @@ public ComplexModifier(JObject jObject) public virtual bool FromJObject(JObject jObject) { bool result = base.FromJObject(jObject); - if(!result) + if (!result) { return result; } - if(jObject.ContainsKey("Modifiers")) + if (jObject.ContainsKey("Modifiers")) { JArray jArray = jObject.Value("Modifiers"); - if(jArray != null) + if (jArray != null) { Modifiers = new List(); - foreach(JObject jObject_Modifier in jArray) + foreach (JObject jObject_Modifier in jArray) { Modifiers.Add(Query.IJSAMObject(jObject_Modifier)); } @@ -62,7 +65,7 @@ public virtual bool FromJObject(JObject jObject) public virtual JObject ToJObject() { JObject result = base.ToJObject(); - if(result == null) + if (result == null) { return result; } @@ -81,4 +84,4 @@ public virtual JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Modifier/IndexedComplexModifier.cs b/SAM/SAM.Core/Classes/Modifier/IndexedComplexModifier.cs index 420d48ae7..673847a25 100644 --- a/SAM/SAM.Core/Classes/Modifier/IndexedComplexModifier.cs +++ b/SAM/SAM.Core/Classes/Modifier/IndexedComplexModifier.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; using System.Linq; @@ -7,7 +10,7 @@ namespace SAM.Core public class IndexedComplexModifier : IndexedModifier, IIndexedComplexModifier { public IndexedComplexModifier() - :base() + : base() { } @@ -21,7 +24,7 @@ public IndexedComplexModifier(IEnumerable indexedModifiers) public IndexedComplexModifier(IndexedComplexModifier complexModifier) : base(complexModifier) { - if(complexModifier != null) + if (complexModifier != null) { Modifiers = complexModifier.Modifiers.ConvertAll(x => x.Clone()); } @@ -36,18 +39,18 @@ public IndexedComplexModifier(JObject jObject) public virtual bool FromJObject(JObject jObject) { bool result = base.FromJObject(jObject); - if(!result) + if (!result) { return result; } - if(jObject.ContainsKey("Modifiers")) + if (jObject.ContainsKey("Modifiers")) { JArray jArray = jObject.Value("Modifiers"); - if(jArray != null) + if (jArray != null) { Modifiers = new List(); - foreach(JObject jObject_Modifier in jArray) + foreach (JObject jObject_Modifier in jArray) { Modifiers.Add(Query.IJSAMObject(jObject_Modifier)); } @@ -62,7 +65,7 @@ public virtual bool FromJObject(JObject jObject) public virtual JObject ToJObject() { JObject result = base.ToJObject(); - if(result == null) + if (result == null) { return result; } @@ -83,14 +86,14 @@ public virtual JObject ToJObject() public override bool ContainsIndex(int index) { - if(Modifiers == null) + if (Modifiers == null) { return false; } - foreach(IIndexedModifier indexedModifier in Modifiers) + foreach (IIndexedModifier indexedModifier in Modifiers) { - if(indexedModifier.ContainsIndex(index)) + if (indexedModifier.ContainsIndex(index)) { return true; } @@ -117,4 +120,4 @@ public override double GetCalculatedValue(int index, double value) return value; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Modifier/IndexedDoublesModifier.cs b/SAM/SAM.Core/Classes/Modifier/IndexedDoublesModifier.cs index 622259a18..608089caa 100644 --- a/SAM/SAM.Core/Classes/Modifier/IndexedDoublesModifier.cs +++ b/SAM/SAM.Core/Classes/Modifier/IndexedDoublesModifier.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Core { @@ -15,14 +18,14 @@ public IndexedDoublesModifier(ArithmeticOperator arithmeticOperator, IndexedDoub public IndexedDoublesModifier(IndexedDoublesModifier indexedModifier) : base(indexedModifier) { - if(indexedModifier != null) + if (indexedModifier != null) { IndexedDoubles = indexedModifier?.IndexedDoubles == null ? null : new IndexedDoubles(indexedModifier.IndexedDoubles); } } public IndexedDoublesModifier(JObject jObject) - :base(jObject) + : base(jObject) { } @@ -30,12 +33,12 @@ public IndexedDoublesModifier(JObject jObject) public override bool FromJObject(JObject jObject) { bool result = base.FromJObject(jObject); - if(!result) + if (!result) { return result; } - if(jObject.ContainsKey("IndexedDoubles")) + if (jObject.ContainsKey("IndexedDoubles")) { IndexedDoubles = Query.IJSAMObject(jObject.Value("IndexedDoubles")); } @@ -46,12 +49,12 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { JObject result = base.ToJObject(); - if(result == null) + if (result == null) { return null; } - if(IndexedDoubles != null) + if (IndexedDoubles != null) { result.Add("IndexedDoubles", IndexedDoubles.ToJObject()); } @@ -79,4 +82,4 @@ public override double GetCalculatedValue(int index, double value) return value; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Modifier/IndexedModifier.cs b/SAM/SAM.Core/Classes/Modifier/IndexedModifier.cs index 7181f58d3..01432cebe 100644 --- a/SAM/SAM.Core/Classes/Modifier/IndexedModifier.cs +++ b/SAM/SAM.Core/Classes/Modifier/IndexedModifier.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Core { @@ -10,7 +13,7 @@ public IndexedModifier() } public IndexedModifier(IndexedModifier indexedModifier) - :base(indexedModifier) + : base(indexedModifier) { } @@ -25,4 +28,4 @@ public IndexedModifier(JObject jObject) public abstract double GetCalculatedValue(int index, double value); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Modifier/IndexedSimpleModifier.cs b/SAM/SAM.Core/Classes/Modifier/IndexedSimpleModifier.cs index c226c3155..00195edca 100644 --- a/SAM/SAM.Core/Classes/Modifier/IndexedSimpleModifier.cs +++ b/SAM/SAM.Core/Classes/Modifier/IndexedSimpleModifier.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Core { @@ -7,7 +10,7 @@ public abstract class IndexedSimpleModifier : IndexedModifier, ISimpleModifier public ArithmeticOperator ArithmeticOperator { get; set; } public IndexedSimpleModifier() - :base() + : base() { } @@ -15,7 +18,7 @@ public IndexedSimpleModifier() public IndexedSimpleModifier(IndexedSimpleModifier indexedSimpleModifier) : base(indexedSimpleModifier) { - if(indexedSimpleModifier != null) + if (indexedSimpleModifier != null) { ArithmeticOperator = indexedSimpleModifier.ArithmeticOperator; } @@ -56,4 +59,4 @@ public virtual JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Modifier/ModifableValue.cs b/SAM/SAM.Core/Classes/Modifier/ModifableValue.cs index 7505dff2c..cb850ee37 100644 --- a/SAM/SAM.Core/Classes/Modifier/ModifableValue.cs +++ b/SAM/SAM.Core/Classes/Modifier/ModifableValue.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Core { @@ -30,9 +33,9 @@ public ModifiableValue(JObject jObject) } public IModifier Modifier { get; set; } - + public double Value { get; set; } - + public static implicit operator ModifiableValue(double value) { return new ModifiableValue(value); @@ -57,13 +60,13 @@ public bool FromJObject(JObject jObject) return true; } - + public JObject ToJObject() { JObject jObject = new JObject(); jObject.Add("_type", Query.FullTypeName(this)); - - if(!double.IsNaN(Value)) + + if (!double.IsNaN(Value)) { jObject.Add("Value", Value); } @@ -76,4 +79,4 @@ public JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Modifier/Modifier.cs b/SAM/SAM.Core/Classes/Modifier/Modifier.cs index 5d54e136d..5f516e022 100644 --- a/SAM/SAM.Core/Classes/Modifier/Modifier.cs +++ b/SAM/SAM.Core/Classes/Modifier/Modifier.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Core { @@ -37,4 +40,4 @@ public virtual JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Modifier/SimpleModifier.cs b/SAM/SAM.Core/Classes/Modifier/SimpleModifier.cs index 1990daf30..04e0686e5 100644 --- a/SAM/SAM.Core/Classes/Modifier/SimpleModifier.cs +++ b/SAM/SAM.Core/Classes/Modifier/SimpleModifier.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Core { @@ -7,7 +10,7 @@ public abstract class SimpleModifier : Modifier, ISimpleModifier public ArithmeticOperator ArithmeticOperator { get; set; } public SimpleModifier() - :base() + : base() { } @@ -15,7 +18,7 @@ public SimpleModifier() public SimpleModifier(SimpleModifier simpleModifier) : base(simpleModifier) { - if(simpleModifier != null) + if (simpleModifier != null) { ArithmeticOperator = simpleModifier.ArithmeticOperator; } @@ -30,7 +33,7 @@ public SimpleModifier(JObject jObject) public override bool FromJObject(JObject jObject) { bool result = base.FromJObject(jObject); - if(!result) + if (!result) { return result; } @@ -46,7 +49,7 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { JObject result = base.ToJObject(); - if(result == null) + if (result == null) { return result; } @@ -56,4 +59,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Modifier/TableModifier.cs b/SAM/SAM.Core/Classes/Modifier/TableModifier.cs index a8e6725aa..fe1ca9e18 100644 --- a/SAM/SAM.Core/Classes/Modifier/TableModifier.cs +++ b/SAM/SAM.Core/Classes/Modifier/TableModifier.cs @@ -1,7 +1,9 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; using System.Linq; -using System.Security.Cryptography; namespace SAM.Core { @@ -21,27 +23,27 @@ public TableModifier(ArithmeticOperator arithmeticOperator, IEnumerable public TableModifier(TableModifier tableModifier) : base(tableModifier) { - if(tableModifier != null) + if (tableModifier != null) { - if(tableModifier.headers != null) + if (tableModifier.headers != null) { - foreach(KeyValuePair keyValuePair in tableModifier.headers) + foreach (KeyValuePair keyValuePair in tableModifier.headers) { headers[keyValuePair.Key] = keyValuePair.Value; } } - if(tableModifier.values != null) + if (tableModifier.values != null) { - foreach(SortedDictionary sortedDictionary in tableModifier.values) + foreach (SortedDictionary sortedDictionary in tableModifier.values) { - if(sortedDictionary == null) + if (sortedDictionary == null) { continue; } SortedDictionary sortedDictionary_New = new SortedDictionary(); - foreach(KeyValuePair keyValuePair in sortedDictionary) + foreach (KeyValuePair keyValuePair in sortedDictionary) { sortedDictionary_New[keyValuePair.Key] = keyValuePair.Value; } @@ -55,7 +57,7 @@ public TableModifier(TableModifier tableModifier) } public TableModifier(JObject jObject) - :base(jObject) + : base(jObject) { } @@ -63,23 +65,23 @@ public TableModifier(JObject jObject) public override bool FromJObject(JObject jObject) { bool result = base.FromJObject(jObject); - if(!result) + if (!result) { return result; } - if(jObject.ContainsKey("Extrapolate")) + if (jObject.ContainsKey("Extrapolate")) { Extrapolate = jObject.Value("Extrapolate"); } - if(jObject.ContainsKey("Headers")) + if (jObject.ContainsKey("Headers")) { JArray jArray = jObject.Value("Headers"); - if(jArray != null) + if (jArray != null) { headers = new SortedDictionary(); - foreach(JArray jArray_Header in jArray) + foreach (JArray jArray_Header in jArray) { headers[((JValue)jArray_Header[0]).Value()] = ((JValue)jArray_Header[1]).Value(); } @@ -112,20 +114,20 @@ public IEnumerable Headers { get { - if(headers == null) + if (headers == null) { return null; } List result = new List(); - if(headers.Count == 0) + if (headers.Count == 0) { return result; } - for(int i = headers.Keys.First(); i <= headers.Keys.Max(); i++) + for (int i = headers.Keys.First(); i <= headers.Keys.Max(); i++) { - if(!headers.TryGetValue(i, out string header)) + if (!headers.TryGetValue(i, out string header)) { header = null; } @@ -139,7 +141,7 @@ public IEnumerable Headers set { headers.Clear(); - if(value == null) + if (value == null) { return; } @@ -153,14 +155,14 @@ public IEnumerable Headers public int GetHeaderIndex(string name) { - if(headers == null || headers.Count == 0) + if (headers == null || headers.Count == 0) { return -1; } - foreach(KeyValuePair keyValuePair in headers) + foreach (KeyValuePair keyValuePair in headers) { - if(name == keyValuePair.Value) + if (name == keyValuePair.Value) { return keyValuePair.Key; } @@ -171,15 +173,15 @@ public int GetHeaderIndex(string name) public bool AddValues(IDictionary values) { - if(values == null) + if (values == null) { return false; } SortedDictionary values_Temp = new SortedDictionary(); - foreach(KeyValuePair keyValuePair in headers) + foreach (KeyValuePair keyValuePair in headers) { - if(!values.TryGetValue(keyValuePair.Key, out double value)) + if (!values.TryGetValue(keyValuePair.Key, out double value)) { continue; } @@ -193,7 +195,7 @@ public bool AddValues(IDictionary values) public bool AddValues(IDictionary values, bool addMissingHeaders = false) { - if(values == null) + if (values == null) { return false; } @@ -202,9 +204,9 @@ public bool AddValues(IDictionary values, bool addMissingHeaders foreach (KeyValuePair keyValuePair in values) { int index = GetHeaderIndex(keyValuePair.Key); - if(index == -1) + if (index == -1) { - if(!addMissingHeaders) + if (!addMissingHeaders) { continue; } @@ -242,13 +244,13 @@ public List GetColumnValues(int columnIndex) public Dictionary GetDictionary(int rowIndex) { - if(rowIndex < 0 || values == null || values.Count == 0 || values.Count <= rowIndex) + if (rowIndex < 0 || values == null || values.Count == 0 || values.Count <= rowIndex) { return null; } Dictionary result = new Dictionary(); - foreach(KeyValuePair keyValuePair in values[rowIndex]) + foreach (KeyValuePair keyValuePair in values[rowIndex]) { result[keyValuePair.Key] = keyValuePair.Value; } @@ -258,7 +260,7 @@ public Dictionary GetDictionary(int rowIndex) public Dictionary GetDictionary(int rowIndex, IEnumerable columnIndexes) { - if(columnIndexes == null) + if (columnIndexes == null) { return null; } @@ -268,7 +270,7 @@ public Dictionary GetDictionary(int rowIndex, IEnumerable colu Dictionary result = new Dictionary(); foreach (int columnIndex in columnIndexes) { - if(!sortedDictionary.TryGetValue(columnIndex, out double value)) + if (!sortedDictionary.TryGetValue(columnIndex, out double value)) { continue; } @@ -281,14 +283,14 @@ public Dictionary GetDictionary(int rowIndex, IEnumerable colu public List FindIndexes(IDictionary values) { - if(values == null || this.values == null || headers == null) + if (values == null || this.values == null || headers == null) { return null; } List result = new List(); - for(int i=0; i < this.values.Count; i++) + for (int i = 0; i < this.values.Count; i++) { SortedDictionary sortedDictionary = this.values[i]; @@ -312,12 +314,12 @@ public List FindIndexes(IDictionary values) public bool RemoveColumn(int index) { - if(index < 0) + if (index < 0) { return false; } - if(!headers.Remove(index)) + if (!headers.Remove(index)) { return false; } @@ -332,7 +334,7 @@ public bool RemoveColumn(int index) public int RowCount { - get + get { if (values != null) { @@ -348,13 +350,13 @@ public int RowCount columnHeader = null; rowHeaders = null; - if(headers == null || headers.Count == 0) + if (headers == null || headers.Count == 0) { return null; } double[,] result = null; - if(headers.Count < 3) + if (headers.Count < 3) { columnHeader = Headers?.ToList(); rowHeaders = new List>() @@ -393,7 +395,7 @@ public int RowCount } IEnumerable uniqueValues = GetColumnValues(columnIndex_ToRemove).Distinct(); - foreach(double uniqueValue in uniqueValues) + foreach (double uniqueValue in uniqueValues) { headers_Temp[headers_Temp.Keys.Max() + 1] = uniqueValue.ToString(); } @@ -403,13 +405,13 @@ public int RowCount TableModifier tableModifier = new TableModifier(ArithmeticOperator, headers_Temp.Values); List> sortedDictionaries = new List>(values); - while(sortedDictionaries.Count > 0) + while (sortedDictionaries.Count > 0) { Dictionary dictionary_Full = new Dictionary(values[0]); Dictionary dictionary_Filtered = GetDictionary(sortedDictionaries, 0, headerIndexes); List indexes = FindIndexes(sortedDictionaries, dictionary_Filtered); - foreach(int index in indexes) + foreach (int index in indexes) { double uniqueValue = sortedDictionaries[index][columnIndex_ToRemove]; int columnIndex_UniqueValue = tableModifier.GetHeaderIndex(uniqueValue.ToString()); @@ -423,7 +425,7 @@ public int RowCount } rowHeaders = new List>(); - foreach(int index in headerIndexes) + foreach (int index in headerIndexes) { rowHeaders.Add(tableModifier.GetColumnValues(index).ConvertAll(x => x.ToString())); } @@ -509,17 +511,17 @@ public List FindIndexes(IEnumerable> sortedDi public override JObject ToJObject() { JObject result = base.ToJObject(); - if(result == null) + if (result == null) { return null; } result.Add("Extrapolate", Extrapolate); - if(headers != null) + if (headers != null) { JArray jArray = new JArray(); - foreach(KeyValuePair keyValuePair in headers) + foreach (KeyValuePair keyValuePair in headers) { jArray.Add(new JArray() { keyValuePair.Key, keyValuePair.Value }); } @@ -527,10 +529,10 @@ public override JObject ToJObject() result.Add("Headers", jArray); } - if(values != null) + if (values != null) { JArray jArray_Values = new JArray(); - foreach(SortedDictionary sortedDictionary in values) + foreach (SortedDictionary sortedDictionary in values) { JArray jArray_Row = new JArray(); foreach (KeyValuePair keyValuePair in sortedDictionary) @@ -546,4 +548,4 @@ public override JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Reference/ObjectReference.cs b/SAM/SAM.Core/Classes/Reference/ObjectReference.cs index 1e576eec1..b68b65917 100644 --- a/SAM/SAM.Core/Classes/Reference/ObjectReference.cs +++ b/SAM/SAM.Core/Classes/Reference/ObjectReference.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -26,7 +29,7 @@ public ObjectReference(string typeName, Reference? reference = null) public ObjectReference(Type type) { - typeName= Query.FullTypeName(type); + typeName = Query.FullTypeName(type); } public ObjectReference(Type type, Reference? reference = null) @@ -47,7 +50,7 @@ public ObjectReference(ObjectReference objectReference) reference = objectReference?.reference; } - public ObjectReference (JObject jObject) + public ObjectReference(JObject jObject) { FromJObject(jObject); } @@ -68,12 +71,12 @@ public virtual bool IsValid() public override string ToString() { List values = new List(); - if(!string.IsNullOrWhiteSpace(typeName)) + if (!string.IsNullOrWhiteSpace(typeName)) { values.Add(typeName); } - if(reference != null && reference.HasValue) + if (reference != null && reference.HasValue) { values.Add(string.Format("[{0}]", reference.Value.ToString())); } @@ -88,13 +91,13 @@ public override int GetHashCode() public override bool Equals(object obj) { - if(ReferenceEquals(obj, null)) + if (ReferenceEquals(obj, null)) { return false; } ObjectReference objectReference = obj as ObjectReference; - if(objectReference == null) + if (objectReference == null) { return false; } @@ -124,7 +127,7 @@ public virtual bool FromJObject(JObject jObject) typeName = jObject.Value("TypeName"); } - if(jObject.ContainsKey("Reference")) + if (jObject.ContainsKey("Reference")) { reference = new Reference(jObject.Value("Reference")); } @@ -142,7 +145,7 @@ public virtual JObject ToJObject() result.Add("TypeName", typeName); } - if(reference != null && reference.HasValue) + if (reference != null && reference.HasValue) { result.Add("Reference", reference.Value.ToJObject()); } @@ -162,16 +165,16 @@ public Type Type { get { - if(string.IsNullOrWhiteSpace(typeName)) + if (string.IsNullOrWhiteSpace(typeName)) { return null; } Type result = Query.Type(typeName); - if(result == null) + if (result == null) { result = Query.Type(string.Format(".{0}", typeName), TextComparisonType.EndsWith, false, (System.Reflection.Assembly x) => x.GetName().Name.StartsWith("SAM.")); - if(result == null) + if (result == null) { result = Query.Type(typeName, TextComparisonType.EndsWith); } @@ -188,7 +191,7 @@ public Type Type public static bool operator ==(ObjectReference objectReference_1, ObjectReference objectReference_2) { - if(ReferenceEquals( objectReference_1, null) && ReferenceEquals( objectReference_2, null)) + if (ReferenceEquals(objectReference_1, null) && ReferenceEquals(objectReference_2, null)) { return true; } diff --git a/SAM/SAM.Core/Classes/Reference/PathReference.cs b/SAM/SAM.Core/Classes/Reference/PathReference.cs index b74d58e12..d69f39954 100644 --- a/SAM/SAM.Core/Classes/Reference/PathReference.cs +++ b/SAM/SAM.Core/Classes/Reference/PathReference.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections; using System.Collections.Generic; @@ -12,13 +15,13 @@ namespace SAM.Core /// Space->"InternalCondition"->"Name" /// Space->Zone::"Name" /// - public class PathReference: IComplexReference, IEnumerable + public class PathReference : IComplexReference, IEnumerable { private List objectReferences; public PathReference(IEnumerable objectReferences) { - if(objectReferences != null) + if (objectReferences != null) { this.objectReferences = objectReferences == null ? null : new List(objectReferences); } @@ -31,9 +34,9 @@ public PathReference(IEnumerable objectReferences, ObjectRefere this.objectReferences = objectReferences == null ? null : new List(objectReferences); } - if(objectReference != null) + if (objectReference != null) { - if(this.objectReferences == null) + if (this.objectReferences == null) { this.objectReferences = new List(); } @@ -50,7 +53,7 @@ public PathReference(JObject jObject) public override string ToString() { List values = objectReferences?.ConvertAll(x => x?.ToString()).ConvertAll(x => x == null ? string.Empty : x); - if(values == null || values.Count == 0) + if (values == null || values.Count == 0) { return string.Empty; } @@ -83,13 +86,13 @@ public bool FromJObject(JObject jObject) if (jObject.ContainsKey("ObjectReferences")) { JArray jArray = jObject.Value("ObjectReferences"); - if(jArray != null) + if (jArray != null) { objectReferences = new List(); - foreach(JObject jObject_ObjectReference in jArray) + foreach (JObject jObject_ObjectReference in jArray) { ObjectReference objectReference = Query.IJSAMObject(jObject_ObjectReference); - if(objectReference != null) + if (objectReference != null) { objectReferences.Add(objectReference); } @@ -109,7 +112,7 @@ public JObject ToJObject() { JArray jArray = new JArray(); - foreach(ObjectReference objectReference in objectReferences) + foreach (ObjectReference objectReference in objectReferences) { jArray.Add(objectReference.ToJObject()); } @@ -122,7 +125,7 @@ public JObject ToJObject() public override bool Equals(object obj) { - if(ReferenceEquals(obj, null)) + if (ReferenceEquals(obj, null)) { return false; } @@ -134,7 +137,7 @@ public override bool Equals(object obj) } List objectReferences_Temp = pathReference.objectReferences; - if((objectReferences == null || objectReferences.Count == 0 ) && (objectReferences_Temp == null || objectReferences_Temp.Count == 0)) + if ((objectReferences == null || objectReferences.Count == 0) && (objectReferences_Temp == null || objectReferences_Temp.Count == 0)) { return true; } @@ -144,7 +147,7 @@ public override bool Equals(object obj) return false; } - if(objectReferences.Count != objectReferences_Temp.Count) + if (objectReferences.Count != objectReferences_Temp.Count) { return false; } diff --git a/SAM/SAM.Core/Classes/Reference/PropertyReference.cs b/SAM/SAM.Core/Classes/Reference/PropertyReference.cs index c08fdd003..6f709e4ea 100644 --- a/SAM/SAM.Core/Classes/Reference/PropertyReference.cs +++ b/SAM/SAM.Core/Classes/Reference/PropertyReference.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; namespace SAM.Core @@ -27,13 +30,13 @@ public PropertyReference(string typeName, string propertyName) } public PropertyReference(ObjectReference objectReference, string propertyName) - :base(objectReference) + : base(objectReference) { this.propertyName = propertyName; } public PropertyReference(string typeName, Reference? reference, string propertyName) - :base(typeName, reference) + : base(typeName, reference) { this.propertyName = propertyName; } @@ -57,7 +60,7 @@ public PropertyReference(JObject jObject) } public PropertyReference(PropertyReference propertyReference) - :base(propertyReference) + : base(propertyReference) { propertyName = propertyReference?.propertyName; } @@ -72,12 +75,12 @@ public string PropertyName public override bool FromJObject(JObject jObject) { - if(! base.FromJObject(jObject)) + if (!base.FromJObject(jObject)) { return false; } - if(jObject.ContainsKey("PropertyName")) + if (jObject.ContainsKey("PropertyName")) { propertyName = jObject.Value("PropertyName"); } @@ -87,13 +90,13 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { - JObject result = base.ToJObject(); - if(result == null) + JObject result = base.ToJObject(); + if (result == null) { return result; } - if(propertyName != null) + if (propertyName != null) { result.Add("PropertyName", propertyName); } @@ -126,19 +129,19 @@ public override string ToString() public override bool Equals(object obj) { - if(ReferenceEquals(obj, null)) + if (ReferenceEquals(obj, null)) { return false; } bool result = base.Equals(obj); - if(!result) + if (!result) { return result; } PropertyReference propertyReference = obj as PropertyReference; - if(propertyReference == null) + if (propertyReference == null) { result = false; return result; diff --git a/SAM/SAM.Core/Classes/Reference/Reference.cs b/SAM/SAM.Core/Classes/Reference/Reference.cs index ab29b7107..2dac645ad 100644 --- a/SAM/SAM.Core/Classes/Reference/Reference.cs +++ b/SAM/SAM.Core/Classes/Reference/Reference.cs @@ -1,9 +1,12 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Core { - public struct Reference: IReference + public struct Reference : IReference { private string value; @@ -56,7 +59,7 @@ public bool FromJObject(JObject jObject) } value = null; - if(jObject.ContainsKey("Value")) + if (jObject.ContainsKey("Value")) { value = jObject.Value("Value"); } @@ -69,7 +72,7 @@ public JObject ToJObject() JObject result = new JObject(); result.Add("_type", Query.FullTypeName(this)); - if(value != null) + if (value != null) { result.Add("Value", value); } @@ -90,7 +93,7 @@ public static implicit operator Reference(Guid value) public static implicit operator Reference(SAMObject value) { string reference = null; - if(value != null) + if (value != null) { reference = value.Guid.ToString("N"); } diff --git a/SAM/SAM.Core/Classes/Relation/Relation.cs b/SAM/SAM.Core/Classes/Relation/Relation.cs index 4c56737c5..b028eb083 100644 --- a/SAM/SAM.Core/Classes/Relation/Relation.cs +++ b/SAM/SAM.Core/Classes/Relation/Relation.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; namespace SAM.Core @@ -50,7 +53,7 @@ public Relation(JObject jObject) public Relation(Relation relation) { - if(relation != null) + if (relation != null) { id = relation.Id; references_1 = relation.references_1 == null ? null : new HashSet(relation.references_1); @@ -70,15 +73,15 @@ public HashSet References { get { - if(references_1 == null && references_2 == null) + if (references_1 == null && references_2 == null) { return null; } HashSet result = new HashSet(); - if(references_1 != null) + if (references_1 != null) { - foreach(Reference reference in references_1) + foreach (Reference reference in references_1) { result.Add(reference); } @@ -129,23 +132,23 @@ public bool Contains_2(Reference reference) public bool FromJObject(JObject jObject) { - if(jObject == null) + if (jObject == null) { return false; } - if(jObject.ContainsKey("Id")) + if (jObject.ContainsKey("Id")) { id = jObject.Value("Id"); } - if(jObject.ContainsKey("References_1")) + if (jObject.ContainsKey("References_1")) { JArray jArray = jObject.Value("References_1"); - if(jArray != null) + if (jArray != null) { references_1 = new HashSet(); - foreach(string value in jArray) + foreach (string value in jArray) { references_1.Add(value); } @@ -172,16 +175,16 @@ public JObject ToJObject() { JObject result = new JObject(); result.Add("_type", Query.FullTypeName(this)); - - if(id != null) + + if (id != null) { result.Add("Id", id); } - if(references_1 != null) + if (references_1 != null) { JArray jArray = new JArray(); - foreach(Reference reference in references_1) + foreach (Reference reference in references_1) { jArray.Add(reference.ToString()); } diff --git a/SAM/SAM.Core/Classes/Relation/RelationCluster.cs b/SAM/SAM.Core/Classes/Relation/RelationCluster.cs index f273a36cd..0b03785ba 100644 --- a/SAM/SAM.Core/Classes/Relation/RelationCluster.cs +++ b/SAM/SAM.Core/Classes/Relation/RelationCluster.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; @@ -661,7 +664,7 @@ public X GetObject(Type type, Guid guid) public X GetObject(ObjectReference objectReference) { - if(objectReference == null) + if (objectReference == null) { return default; } @@ -1284,13 +1287,13 @@ public bool RemoveObject(Guid guid) public bool RemoveObject(X @object) { - if(@object == null) + if (@object == null) { return false; } Guid guid = GetGuid(@object); - if(guid == Guid.Empty) + if (guid == Guid.Empty) { return false; } @@ -1655,7 +1658,7 @@ private X GetObject(Type type, Guid guid, out Dictionary dictionary, ou return default; } - public List GetObjects(ObjectReference objectReference) where T: X + public List GetObjects(ObjectReference objectReference) where T : X { if (objectReference == null) { @@ -1663,15 +1666,15 @@ public List GetObjects(ObjectReference objectReference) where T: X } List objects = GetObjects(objectReference, default); - if(objects == null) + if (objects == null) { return null; } List result = new List(); - foreach(X @object in objects) + foreach (X @object in objects) { - if(@object is T) + if (@object is T) { result.Add((T)@object); } @@ -1679,7 +1682,7 @@ public List GetObjects(ObjectReference objectReference) where T: X return result; } - + private List GetObjects(ObjectReference objectReference, X parent = default(X)) { if (objectReference == null) @@ -1874,23 +1877,23 @@ private bool RemoveRelation(string typeName, Guid guid_1, Guid guid_2) protected List? Merge(RelationCluster? relationCluster) { - if(relationCluster is null) + if (relationCluster is null) { return null; } List result = []; - if(relationCluster.dictionary_Objects is not null) + if (relationCluster.dictionary_Objects is not null) { foreach (KeyValuePair> keyValuePair_Type in relationCluster.dictionary_Objects) { - if(!dictionary_Objects.TryGetValue(keyValuePair_Type.Key, out Dictionary dictionary) || dictionary is null) + if (!dictionary_Objects.TryGetValue(keyValuePair_Type.Key, out Dictionary dictionary) || dictionary is null) { dictionary = []; dictionary_Objects[keyValuePair_Type.Key] = dictionary; } - foreach(KeyValuePair keyValuePair_Object in keyValuePair_Type.Value) + foreach (KeyValuePair keyValuePair_Object in keyValuePair_Type.Value) { dictionary[keyValuePair_Object.Key] = keyValuePair_Object.Value; result.Add(keyValuePair_Object.Value); @@ -1898,7 +1901,7 @@ private bool RemoveRelation(string typeName, Guid guid_1, Guid guid_2) } } - if(relationCluster.dictionary_Relations is not null) + if (relationCluster.dictionary_Relations is not null) { foreach (KeyValuePair>> keyValuePair_Type in relationCluster.dictionary_Relations) { @@ -1908,9 +1911,9 @@ private bool RemoveRelation(string typeName, Guid guid_1, Guid guid_2) dictionary_Relations[keyValuePair_Type.Key] = dictionary; } - foreach (KeyValuePair< Guid, HashSet < Guid >> keyValuePair_Relation in keyValuePair_Type.Value) - { - foreach(Guid guid in keyValuePair_Relation.Value) + foreach (KeyValuePair> keyValuePair_Relation in keyValuePair_Type.Value) + { + foreach (Guid guid in keyValuePair_Relation.Value) { dictionary[keyValuePair_Relation.Key].Add(guid); } @@ -1921,4 +1924,4 @@ private bool RemoveRelation(string typeName, Guid guid_1, Guid guid_2) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Relation/RelationCollection.cs b/SAM/SAM.Core/Classes/Relation/RelationCollection.cs index bc9d77fc7..ed0b6bf5e 100644 --- a/SAM/SAM.Core/Classes/Relation/RelationCollection.cs +++ b/SAM/SAM.Core/Classes/Relation/RelationCollection.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections; using System.Collections.Generic; @@ -17,7 +20,7 @@ public RelationCollection() public RelationCollection(IEnumerable relations) { - if(relations != null) + if (relations != null) { this.relations = relations.ToList().ConvertAll(x => x == null ? null : new Relation(x)); } @@ -50,7 +53,7 @@ public void Clear() public bool Add(Relation relation) { - if(relation == null) + if (relation == null) { return false; } @@ -66,7 +69,7 @@ public Relation Add(string id, Reference reference_1, Reference reference_2) relations.Add(result); return result; - + } public Relation Add(string id, IEnumerable references_1, IEnumerable references_2) @@ -80,19 +83,19 @@ public Relation Add(string id, IEnumerable references_1, IEnumerable< public RelationCollection FindAll(string id) { - if(relations == null || string.IsNullOrWhiteSpace(id)) + if (relations == null || string.IsNullOrWhiteSpace(id)) { return null; } RelationCollection result = new RelationCollection(); foreach (Relation relation in relations) { - if(relation == null) + if (relation == null) { continue; } - if(relation.Id == id) + if (relation.Id == id) { result.Add(relation); } @@ -134,7 +137,7 @@ public RelationCollection FindAll_1(Reference reference) RelationCollection result = new RelationCollection(); foreach (Relation relation in relations) { - if(relation.Contains_1(reference)) + if (relation.Contains_1(reference)) { result.Add(relation); } @@ -159,7 +162,7 @@ public RelationCollection FindAll_2(Reference reference) public RelationCollection FindAll(Func func) { - if(func == null) + if (func == null) { return new RelationCollection(relations); } @@ -215,7 +218,7 @@ public Relation Find(string id, Reference reference) public bool Remove(Relation relation) { - if(relation == null) + if (relation == null) { return false; } @@ -226,15 +229,15 @@ public bool Remove(Relation relation) public bool Remove(string id) { RelationCollection relationCollection = FindAll(id); - if(relationCollection == null || relationCollection.Count == 0) + if (relationCollection == null || relationCollection.Count == 0) { return false; } bool result = false; - foreach(Relation relation in relationCollection) + foreach (Relation relation in relationCollection) { - if(Remove(relation)) + if (Remove(relation)) { result = true; } @@ -291,44 +294,44 @@ public bool Remove(Reference reference) /// True if any references have been removed public bool Remove(Reference reference_1, Reference reference_2, string id = null) { - if(relations == null || relations.Count == 0) + if (relations == null || relations.Count == 0) { return false; } bool result = false; - for(int i = relations.Count -1; i >= 0; i--) + for (int i = relations.Count - 1; i >= 0; i--) { Relation relation = relations[i]; - - if(id != null && relation.Id != id) + + if (id != null && relation.Id != id) { continue; } - - if((relation.Contains_1(reference_1) && relation.Contains_2(reference_2)) || (relation.Contains_1(reference_2) && relation.Contains_2(reference_1))) + + if ((relation.Contains_1(reference_1) && relation.Contains_2(reference_2)) || (relation.Contains_1(reference_2) && relation.Contains_2(reference_1))) { HashSet references_1 = relation.References_1; HashSet references_2 = relation.References_2; bool removed = false; - + if (references_1.Contains(reference_1) && references_2.Contains(reference_2)) { references_1.Remove(reference_1); references_2.Remove(reference_2); removed = true; } - - if(references_1.Contains(reference_2) && references_2.Contains(reference_1)) + + if (references_1.Contains(reference_2) && references_2.Contains(reference_1)) { references_1.Remove(reference_2); references_2.Remove(reference_1); removed = true; } - if(!removed) + if (!removed) { continue; } @@ -351,7 +354,7 @@ public bool Remove(Reference reference_1, Reference reference_2, string id = nul public bool Replace(Reference reference_ToBeReplaced, Reference reference) { - if(!reference_ToBeReplaced.IsValid() || !reference.IsValid()) + if (!reference_ToBeReplaced.IsValid() || !reference.IsValid()) { return false; } @@ -370,13 +373,13 @@ public bool Replace(Reference reference_ToBeReplaced, Reference reference) if (relation.Contains(reference_ToBeReplaced)) { HashSet references_1 = relation.References_1; - if(references_1.Remove(reference_ToBeReplaced)) + if (references_1.Remove(reference_ToBeReplaced)) { references_1.Add(reference); } HashSet references_2 = relation.References_2; - if(references_2.Remove(reference_ToBeReplaced)) + if (references_2.Remove(reference_ToBeReplaced)) { references_2.Add(reference); } @@ -550,13 +553,13 @@ public bool FromJObject(JObject jObject) return false; } - if(jObject.ContainsKey("Relations")) + if (jObject.ContainsKey("Relations")) { JArray jArray = jObject.Value("Relations"); - if(jArray != null) + if (jArray != null) { relations = new List(); - foreach(JObject jObject_Relation in jArray) + foreach (JObject jObject_Relation in jArray) { Relation relation = Query.IJSAMObject(jObject); if (relation != null) @@ -575,7 +578,7 @@ public JObject ToJObject() JObject result = new JObject(); result.Add("_type", Query.FullTypeName(this)); - if(relations != null) + if (relations != null) { JArray jArray = new JArray(); foreach (Relation relation in relations) @@ -600,7 +603,7 @@ public int Count public static implicit operator RelationCollection(List relations) { - if(relations == null) + if (relations == null) { return null; } @@ -610,7 +613,7 @@ public static implicit operator RelationCollection(List relations) return result; } - + public static implicit operator RelationCollection(Relation[] relations) { if (relations == null) diff --git a/SAM/SAM.Core/Classes/Relation/RelationModel.cs b/SAM/SAM.Core/Classes/Relation/RelationModel.cs index b58fb98bb..96d362544 100644 --- a/SAM/SAM.Core/Classes/Relation/RelationModel.cs +++ b/SAM/SAM.Core/Classes/Relation/RelationModel.cs @@ -1,8 +1,11 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Core -{ +{ public abstract class RelationModel { private Dictionary dictionary; @@ -16,14 +19,14 @@ public RelationModel() public RelationModel(IEnumerable objects, IEnumerable relations) { - if(objects != null) + if (objects != null) { - foreach(T @object in objects) + foreach (T @object in objects) { AddObject(@object); } - if(relations != null) + if (relations != null) { relationCollection = new RelationCollection(relations); } @@ -32,9 +35,9 @@ public RelationModel(IEnumerable objects, IEnumerable relations) public RelationModel(RelationModel relationModel) { - if(relationModel != null && relationModel.dictionary != null) + if (relationModel != null && relationModel.dictionary != null) { - if(relationModel.dictionary != null) + if (relationModel.dictionary != null) { dictionary = new Dictionary(); foreach (KeyValuePair keyValuePair in relationModel.dictionary) @@ -44,19 +47,19 @@ public RelationModel(RelationModel relationModel) } } - if(relationModel.relationCollection != null) + if (relationModel.relationCollection != null) { relationCollection = new RelationCollection(relationModel.relationCollection); } } } - - + + protected Reference? AddObject(T @object) { Reference? reference = GetReference(@object); - if(reference == null || !reference.HasValue || !reference.Value.IsValid()) + if (reference == null || !reference.HasValue || !reference.Value.IsValid()) { return null; } @@ -85,7 +88,7 @@ protected Relation AddRelation(string id, T @object) protected Relation AddRelation(string id, T @object_1, T @object_2) { Reference? reference_1 = GetReference(@object_1); - if(reference_1 == null || !reference_1.HasValue || !reference_1.Value.IsValid()) + if (reference_1 == null || !reference_1.HasValue || !reference_1.Value.IsValid()) { return null; } @@ -96,7 +99,7 @@ protected Relation AddRelation(string id, T @object_1, T @object_2) return null; } - if(!dictionary.ContainsKey(reference_1.Value)) + if (!dictionary.ContainsKey(reference_1.Value)) { dictionary[reference_1.Value] = @object_1; } @@ -111,7 +114,7 @@ protected Relation AddRelation(string id, T @object_1, T @object_2) protected Relation AddRelation(string id, Reference reference_1, Reference reference_2) { - if(!dictionary.ContainsKey(reference_1) || !dictionary.ContainsKey(reference_2)) + if (!dictionary.ContainsKey(reference_1) || !dictionary.ContainsKey(reference_2)) { return null; } @@ -131,18 +134,18 @@ protected Relation AddRelation(string id, Reference reference) protected Relation AddRelation(Relation relation) { - if(relation == null) + if (relation == null) { return null; } HashSet references_1 = relation.References_1; - if(references_1 != null) + if (references_1 != null) { HashSet references_Temp = new HashSet(); - foreach(Reference reference in references_1) + foreach (Reference reference in references_1) { - if(dictionary.ContainsKey(reference)) + if (dictionary.ContainsKey(reference)) { references_Temp.Add(reference); } @@ -164,7 +167,7 @@ protected Relation AddRelation(Relation relation) references_2 = references_Temp; } - if(references_1 != null && references_1.Count != 0 && references_2 != null && references_2.Count != 0) + if (references_1 != null && references_1.Count != 0 && references_2 != null && references_2.Count != 0) { Relation result = new Relation(relation.Id, references_1, references_2); relationCollection.Add(result); @@ -177,12 +180,12 @@ protected Relation AddRelation(Relation relation) protected T GetObject(Reference reference) { - if(!reference.IsValid()) + if (!reference.IsValid()) { return default; } - if(!dictionary.ContainsKey(reference)) + if (!dictionary.ContainsKey(reference)) { return default; } @@ -192,15 +195,15 @@ protected T GetObject(Reference reference) protected List GetObjects(Func func = null) { - if(dictionary == null) + if (dictionary == null) { return null; } List result = new List(); - foreach(T @object in dictionary.Values) + foreach (T @object in dictionary.Values) { - if(func != null && !func.Invoke(@object)) + if (func != null && !func.Invoke(@object)) { continue; } @@ -215,7 +218,7 @@ protected List GetObjects(Func func = null) protected bool RemoveObject(T @object) { Reference? reference = GetReference(@object); - if(reference == null || !reference.HasValue || !reference.Value.IsValid()) + if (reference == null || !reference.HasValue || !reference.Value.IsValid()) { return false; } @@ -225,13 +228,13 @@ protected bool RemoveObject(T @object) protected bool RemoveObject(Reference reference) { - if(!reference.IsValid()) + if (!reference.IsValid()) { return false; } bool result = dictionary.Remove(reference); - if(result) + if (result) { relationCollection.Remove(reference); } @@ -245,7 +248,7 @@ protected bool RemoveRelations(string id) return relationCollection == null ? false : relationCollection.Remove(id); } - + protected RelationCollection GetRelations(Func func = null) { return relationCollection?.FindAll(func); @@ -253,7 +256,7 @@ protected RelationCollection GetRelations(Func func = null) protected RelationCollection GetRelations(Reference reference) { - if(!reference.IsValid()) + if (!reference.IsValid()) { return null; } @@ -318,12 +321,12 @@ protected RelationCollection GetRelations_2(T @object) protected HashSet GetRelatedReferences(Reference reference, string relationId = null) { - if(!reference.IsValid()) + if (!reference.IsValid()) { return null; } - if(!dictionary.ContainsKey(reference)) + if (!dictionary.ContainsKey(reference)) { return null; } @@ -366,15 +369,15 @@ protected HashSet GetRelatedReferences(string relationId) HashSet result = new HashSet(); foreach (Relation relation in relationCollection) { - if(relation == null || relation.Id != relationId) + if (relation == null || relation.Id != relationId) { continue; } HashSet references = relation.References; - if(references != null) + if (references != null) { - foreach(Reference reference in references) + foreach (Reference reference in references) { result.Add(reference); } @@ -384,19 +387,19 @@ protected HashSet GetRelatedReferences(string relationId) return result; } - + protected List GetRelatedObjects(string relationId) { HashSet references = GetRelatedReferences(relationId); - if(references == null) + if (references == null) { return null; } List result = new List(); - foreach(Reference reference in references) + foreach (Reference reference in references) { - if(dictionary.TryGetValue(reference, out T @object)) + if (dictionary.TryGetValue(reference, out T @object)) { result.Add(@object); } @@ -408,15 +411,15 @@ protected List GetRelatedObjects(string relationId) protected List GetRelatedObjects(Reference reference, string relationId = null) { HashSet references = GetRelatedReferences(reference, relationId); - if(references == null) + if (references == null) { return null; } List result = new List(); - foreach(Reference reference_Temp in references) + foreach (Reference reference_Temp in references) { - if(dictionary.TryGetValue(reference_Temp, out T @object)) + if (dictionary.TryGetValue(reference_Temp, out T @object)) { result.Add(@object); } @@ -501,13 +504,13 @@ protected List GetRelatedObjects_2(T @object, string relationId = null) protected bool Contains(T @object) { - if(dictionary == null || dictionary.Count == 0) + if (dictionary == null || dictionary.Count == 0) { return false; } Reference? reference = GetReference(@object); - if(reference == null || !reference.HasValue) + if (reference == null || !reference.HasValue) { return false; } @@ -529,7 +532,7 @@ protected bool Contains(Reference reference) protected bool Replace(T @object_ToBeReplaced, T @object) { Reference? reference = GetReference(@object); - if(reference == null || !reference.HasValue || !reference.Value.IsValid()) + if (reference == null || !reference.HasValue || !reference.Value.IsValid()) { return false; } @@ -540,7 +543,7 @@ protected bool Replace(T @object_ToBeReplaced, T @object) return false; } - if(!dictionary.ContainsKey(reference_ToBeReplaced.Value)) + if (!dictionary.ContainsKey(reference_ToBeReplaced.Value)) { return false; } diff --git a/SAM/SAM.Core/Classes/Relation/SAMObjectRelationCluster.cs b/SAM/SAM.Core/Classes/Relation/SAMObjectRelationCluster.cs index baab17767..c3de23b68 100644 --- a/SAM/SAM.Core/Classes/Relation/SAMObjectRelationCluster.cs +++ b/SAM/SAM.Core/Classes/Relation/SAMObjectRelationCluster.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; namespace SAM.Core @@ -43,16 +46,16 @@ public SAMObjectRelationCluster(SAMObjectRelationCluster sAMObjectRelationCluste } } - public class SAMObjectRelationCluster : RelationCluster, IJSAMObject, ISAMObjectRelationCluster where T: IJSAMObject + public class SAMObjectRelationCluster : RelationCluster, IJSAMObject, ISAMObjectRelationCluster where T : IJSAMObject { public SAMObjectRelationCluster() - :base() + : base() { } public SAMObjectRelationCluster(JObject jObject) - :base(jObject) + : base(jObject) { } @@ -65,7 +68,7 @@ public SAMObjectRelationCluster(SAMObjectRelationCluster sAMObjectRelationClu public SAMObjectRelationCluster(SAMObjectRelationCluster sAMObjectRelationCluster, bool deepClone) : base(sAMObjectRelationCluster) { - if(deepClone) + if (deepClone) { List objects = GetObjects(); if (objects != null) diff --git a/SAM/SAM.Core/Classes/Relation/TextMap.cs b/SAM/SAM.Core/Classes/Relation/TextMap.cs index 5320a9608..fb5197c06 100644 --- a/SAM/SAM.Core/Classes/Relation/TextMap.cs +++ b/SAM/SAM.Core/Classes/Relation/TextMap.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; @@ -19,7 +22,7 @@ internal TextMap(string name) internal TextMap(TextMap textMap) : base(textMap) { - if(textMap.dictionary != null) + if (textMap.dictionary != null) { dictionary = new Dictionary>(); foreach (KeyValuePair> keyValuePair in textMap.dictionary) @@ -71,7 +74,7 @@ public List Add(string key, params string[] values) } List result = new List(); - foreach(string value in values) + foreach (string value in values) { if (string.IsNullOrEmpty(value)) { @@ -89,7 +92,7 @@ public List Add(string key, params string[] values) public bool UpdateValue(string key, string value_Old, string value_New) { - if(string.IsNullOrEmpty(key) || string.IsNullOrEmpty(value_New)) + if (string.IsNullOrEmpty(key) || string.IsNullOrEmpty(value_New)) { return false; } @@ -146,11 +149,11 @@ public List GetKeys(string text, TextComparisonType textComparisonType = return null; List result = new List(); - foreach(KeyValuePair> keyValuePair in dictionary) + foreach (KeyValuePair> keyValuePair in dictionary) { - foreach(string value in keyValuePair.Value) + foreach (string value in keyValuePair.Value) { - if(value.Compare(text, textComparisonType, caseSensitive)) + if (value.Compare(text, textComparisonType, caseSensitive)) { result.Add(keyValuePair.Key); break; @@ -175,13 +178,13 @@ public HashSet GetSortedKeys(string text, bool caseSensitive = false) HashSet hashSet = new HashSet(); foreach (KeyValuePair> keyValuePair in dictionary) { - foreach(string value in keyValuePair.Value) + foreach (string value in keyValuePair.Value) { if (string.IsNullOrEmpty(value)) continue; string[] values = value.Split(' '); - for(int i = 0; i < values.Length; i++) + for (int i = 0; i < values.Length; i++) { string value_Temp = values[i]?.Trim().ToLower(); if (!string.IsNullOrWhiteSpace(value_Temp)) @@ -215,7 +218,7 @@ public HashSet GetSortedKeys(string text, bool caseSensitive = false) int count_Key = int.MaxValue; foreach (string value in keyValuePair.Value) { - if(value == null) + if (value == null) { continue; } @@ -245,14 +248,14 @@ public HashSet GetSortedKeys(string text, bool caseSensitive = false) string[] values_2 = value_Temp.Split(' '); int count_Value = 0; - for (int i=0; i < values_1.Length; i++) + for (int i = 0; i < values_1.Length; i++) { int count_1 = values_1[i].Length; if (count_1 == 0) continue; int count_Temp = 0; - for(int j= 0; j < values_2.Length; j++) + for (int j = 0; j < values_2.Length; j++) { int count_2 = values_2[j].Length; @@ -298,7 +301,7 @@ public HashSet GetSortedKeys(string text, bool caseSensitive = false) } HashSet result = new HashSet(); - foreach(HashSet hashSet_Temp in sortedDictionary.Values) + foreach (HashSet hashSet_Temp in sortedDictionary.Values) foreach (string value in hashSet_Temp) result.Add(value); @@ -346,7 +349,7 @@ public override bool FromJObject(JObject jObject) HashSet values = new HashSet(); - for(int i=1; i < jArray.Count; i++) + for (int i = 1; i < jArray.Count; i++) values.Add(jArray[i].ToString()); dictionary[jArray[0].ToString()] = values; @@ -366,7 +369,7 @@ public string Replace(string @string) if (dictionary == null || dictionary.Count == 0) return result; - foreach(KeyValuePair> keyValuePair in dictionary) + foreach (KeyValuePair> keyValuePair in dictionary) { if (keyValuePair.Key == null) continue; @@ -385,7 +388,7 @@ public string Replace(string @string) public bool RemoveKey(string key) { - if(dictionary == null || key == null) + if (dictionary == null || key == null) { return false; } @@ -395,7 +398,7 @@ public bool RemoveKey(string key) public bool AddKey(string key) { - if(key == null) + if (key == null) { return false; } @@ -405,12 +408,12 @@ public bool AddKey(string key) public bool RemoveValue(string key, string value) { - if(key == null || value == null || dictionary == null) + if (key == null || value == null || dictionary == null) { return false; } - if(!dictionary.TryGetValue(key, out HashSet values) || values == null) + if (!dictionary.TryGetValue(key, out HashSet values) || values == null) { return false; } diff --git a/SAM/SAM.Core/Classes/Relation/TypeMap.cs b/SAM/SAM.Core/Classes/Relation/TypeMap.cs index d039f3d4b..83ddb2fd4 100644 --- a/SAM/SAM.Core/Classes/Relation/TypeMap.cs +++ b/SAM/SAM.Core/Classes/Relation/TypeMap.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core.Attributes; using System; using System.Collections.Generic; @@ -16,11 +19,11 @@ public class TypeMap : SAMObject, IJSAMObject private List> tuples; internal TypeMap(TypeMap typeMap) - :base(typeMap) + : base(typeMap) { tuples = typeMap?.tuples?.ConvertAll(x => new Tuple(x.Item1, x.Item2, x.Item3, x.Item4, x.Item5, x.Item6)); } - + internal TypeMap() { tuples = new List>(); @@ -38,7 +41,7 @@ public bool Add(Type type_1, Type type_2, string name_1, string name_2, string f return false; bool result = Add(GetId(type_1), GetId(type_2), name_1, name_2, formula_1, formula_2); - if(result) + if (result) { AddType(type_1); AddType(type_2); @@ -61,7 +64,7 @@ public List Add(Enum @enum, Type type, string name, string formula_1 = nul string name_Temp = @enum.ToString(); ParameterProperties parameterProperties = ParameterProperties.Get(@enum); - if(parameterProperties != null) + if (parameterProperties != null) name_Temp = parameterProperties.Name; if (name_Temp == null) @@ -74,7 +77,7 @@ public List Add(Enum @enum, Type type, string name, string formula_1 = nul return result; } - + public bool Add(string id_1, string id_2, string name_1, string name_2, string formula_1 = null, string formula_2 = null) { if (string.IsNullOrEmpty(id_1) || string.IsNullOrEmpty(id_2) || string.IsNullOrEmpty(name_1) || string.IsNullOrEmpty(name_2)) @@ -208,10 +211,10 @@ public override bool FromJObject(JObject jObject) tuples = new List>(); JArray jArray_Map = jObject.Value("Map"); - if(jArray_Map != null) + if (jArray_Map != null) { - - foreach(JArray jArray in jArray_Map) + + foreach (JArray jArray in jArray_Map) { if (jArray.Count < 4) continue; @@ -231,7 +234,7 @@ public override bool FromJObject(JObject jObject) tuples.Add(tuple); } - + } return true; @@ -264,7 +267,7 @@ private List GetIndexes(string id_1, string id_2, string name, int index) if (!valid) valid = tuple.Item1.Equals(id_1); - if(!valid) + if (!valid) valid = tuple.Item1.Equals(string.Format("::{0}", id_1)); if (!valid) @@ -310,7 +313,7 @@ private List GetNames(string id_1, string id_2, string name, int index) return null; List result = new List(); - foreach(int i in indexes) + foreach (int i in indexes) result.Add(index == 1 ? tuples[i].Item3 : tuples[i].Item4); return result; @@ -360,7 +363,7 @@ private Type GetType(string id, bool includeInDictionary = true) result = Type.GetType(id.Substring(2), false); - if(includeInDictionary) + if (includeInDictionary) { if (dictionary == null) dictionary = new Dictionary(); diff --git a/SAM/SAM.Core/Classes/Search/SearchObjectWrapper.cs b/SAM/SAM.Core/Classes/Search/SearchObjectWrapper.cs index 35370a45f..1cba1c72b 100644 --- a/SAM/SAM.Core/Classes/Search/SearchObjectWrapper.cs +++ b/SAM/SAM.Core/Classes/Search/SearchObjectWrapper.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Core @@ -33,14 +36,14 @@ public SearchObjectWrapper(bool caseSensitive = false) public bool Add(T item) { - if(item == null) + if (item == null) { return false; } string text = func == null ? item.ToString() : func.Invoke(item); - if(!searchWrapper.Add(text)) + if (!searchWrapper.Add(text)) { return false; } @@ -56,12 +59,12 @@ public bool Add(T item) public void AddRange(IEnumerable items) { - if(items == null) + if (items == null) { return; } - foreach(T item in items) + foreach (T item in items) { Add(item); } @@ -81,7 +84,7 @@ public bool Remove(T item) return false; } - if(dictionary.ContainsKey(text)) + if (dictionary.ContainsKey(text)) { dictionary.Remove(text); } @@ -107,17 +110,17 @@ public IEnumerable Items public T GetItem(string text) { - if(dictionary == null) + if (dictionary == null) { return default; } - if(!dictionary.TryGetValue(text, out object value)) + if (!dictionary.TryGetValue(text, out object value)) { return default; } - if(!(value is T)) + if (!(value is T)) { return default; } @@ -138,13 +141,13 @@ public List SearchTexts(string text, bool sort = true) public List Search(string text, bool sort = true) { List texts = SearchTexts(text, sort); - if(texts == null) + if (texts == null) { return null; } List result = new List(); - foreach(string text_Result in texts) + foreach (string text_Result in texts) { result.Add(dictionary[text_Result]); } @@ -157,4 +160,4 @@ public List Search(string text, bool sort = true) return Search(text, sort)?.FindAll(x => x is T).ConvertAll(x => (T)x); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Classes/Search/SearchWrapper.cs b/SAM/SAM.Core/Classes/Search/SearchWrapper.cs index 846e4b4d3..b400c3112 100644 --- a/SAM/SAM.Core/Classes/Search/SearchWrapper.cs +++ b/SAM/SAM.Core/Classes/Search/SearchWrapper.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; @@ -10,16 +13,16 @@ public class SearchWrapper : IJSAMObject private bool caseSensitive; private char[] separators; private Dictionary> dictionary; - + public SearchWrapper(IEnumerable texts, IEnumerable separators, bool caseSensitive) { this.caseSensitive = caseSensitive; - if(separators != null) + if (separators != null) { this.separators = separators.ToArray(); } - if(texts != null) + if (texts != null) { foreach (string value in texts) { @@ -38,19 +41,19 @@ public SearchWrapper(bool caseSensitive) public SearchWrapper(SearchWrapper searchWrapper) { - if(searchWrapper != null) + if (searchWrapper != null) { caseSensitive = searchWrapper.caseSensitive; - + separators = searchWrapper.separators == null ? null : new List(searchWrapper.separators).ToArray(); - - if(searchWrapper.dictionary != null) + + if (searchWrapper.dictionary != null) { dictionary = new Dictionary>(); - foreach(string key in dictionary.Keys) + foreach (string key in dictionary.Keys) { List values = dictionary[key]; - if(values != null) + if (values != null) { values = new List(values); } @@ -81,12 +84,12 @@ public bool Add(string text) public bool Remove(string text) { - if(text == null || dictionary == null) + if (text == null || dictionary == null) { return false; } - if(!dictionary.ContainsKey(text)) + if (!dictionary.ContainsKey(text)) { return false; } @@ -154,7 +157,7 @@ public Dictionary GetScoreDictionary(string text) continue; } - if(!caseSensitive) + if (!caseSensitive) { if (keyValuePair.Key.ToLower() == text.ToLower()) { @@ -166,18 +169,18 @@ public Dictionary GetScoreDictionary(string text) List values_2 = keyValuePair.Value; List> tuples = new List>(); - foreach(string value_1 in values_1) + foreach (string value_1 in values_1) { - foreach(string value_2 in values_2) + foreach (string value_2 in values_2) { - if(value_2.Contains(value_1)) + if (value_2.Contains(value_1)) { tuples.Add(new Tuple(value_1, value_2)); } } } - if(tuples == null || tuples.Count == 0) + if (tuples == null || tuples.Count == 0) { continue; } @@ -185,7 +188,7 @@ public Dictionary GetScoreDictionary(string text) tuples.Sort((x, y) => y.Item1.CompareTo(x.Item1)); string value_Temp = string.Join(string.Empty, values_2); - foreach(Tuple tuple in tuples) + foreach (Tuple tuple in tuples) { value_Temp = value_Temp.Replace(tuple.Item1, string.Empty); } @@ -201,15 +204,15 @@ public Dictionary GetScoreDictionary(string text) public List Search(string text, bool sort = true) { Dictionary scoreDictionary = GetScoreDictionary(text); - if(scoreDictionary == null) + if (scoreDictionary == null) { return null; } List> tuples = new List>(); - foreach(string key in scoreDictionary.Keys) + foreach (string key in scoreDictionary.Keys) { - if(scoreDictionary[key] == 0) + if (scoreDictionary[key] == 0) { continue; } @@ -217,7 +220,7 @@ public List Search(string text, bool sort = true) tuples.Add(new Tuple(key, scoreDictionary[key])); } - if(sort) + if (sort) { tuples.Sort((x, y) => y.Item2.CompareTo(x.Item2)); } @@ -227,12 +230,12 @@ public List Search(string text, bool sort = true) public bool FromJObject(JObject jObject) { - if(jObject == null) + if (jObject == null) { return false; } - if(jObject.ContainsKey("CaseSensitive")) + if (jObject.ContainsKey("CaseSensitive")) { caseSensitive = jObject.Value("CaseSensitive"); } @@ -240,12 +243,12 @@ public bool FromJObject(JObject jObject) if (jObject.ContainsKey("Separators")) { JArray jArray = jObject.Value("Separators"); - if(jArray != null) + if (jArray != null) { List separators_temp = new List(); - foreach(string separator_String in jArray) + foreach (string separator_String in jArray) { - if(separator_String == null || separator_String.Length == 0) + if (separator_String == null || separator_String.Length == 0) { continue; } @@ -257,10 +260,10 @@ public bool FromJObject(JObject jObject) } } - if(jObject.ContainsKey("Texts")) + if (jObject.ContainsKey("Texts")) { JArray jArray = jObject.Value("Texts"); - foreach(string text in jArray) + foreach (string text in jArray) { Add(text); } @@ -272,25 +275,25 @@ public bool FromJObject(JObject jObject) public JObject ToJObject() { JObject result = new JObject(); - + result.Add("CaseSensitive", caseSensitive); - if(separators != null) + if (separators != null) { JArray jArray = new JArray(); - foreach(char separator in separators) + foreach (char separator in separators) { jArray.Add(separator.ToString()); } result.Add("Separators", jArray); } - if(dictionary != null) + if (dictionary != null) { JArray jArray = new JArray(); foreach (string text in dictionary.Keys) { - if(text == null) + if (text == null) { continue; } @@ -303,4 +306,4 @@ public JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Convert/ToBitmap/Bitmap.cs b/SAM/SAM.Core/Convert/ToBitmap/Bitmap.cs index af0455948..ff50ba549 100644 --- a/SAM/SAM.Core/Convert/ToBitmap/Bitmap.cs +++ b/SAM/SAM.Core/Convert/ToBitmap/Bitmap.cs @@ -1,4 +1,7 @@ -using System.Drawing; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Drawing; using System.IO; namespace SAM.Core @@ -17,4 +20,4 @@ public static Bitmap ToBitmap(this byte[] bytes) } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Convert/ToColor/Color.cs b/SAM/SAM.Core/Convert/ToColor/Color.cs index 77a9ef366..9981e4fd1 100644 --- a/SAM/SAM.Core/Convert/ToColor/Color.cs +++ b/SAM/SAM.Core/Convert/ToColor/Color.cs @@ -1,4 +1,7 @@ -using System.Drawing; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Drawing; namespace SAM.Core { @@ -22,7 +25,7 @@ public static Color ToColor(this int @int, byte alpha = 255) } public static Color ToColor(string @string) - { + { if (string.IsNullOrWhiteSpace(@string)) { return Color.Empty; @@ -30,7 +33,7 @@ public static Color ToColor(string @string) string @string_Temp = @string; - if(@string.IsHex()) + if (@string.IsHex()) { @string_Temp = "#" + @string; } @@ -50,11 +53,11 @@ public static Color ToColor(string @string) { return Color.Empty; } - + if (!(@object is Color)) return Color.Empty; return (Color)@object; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Convert/ToCsv/String.cs b/SAM/SAM.Core/Convert/ToCsv/String.cs index 8ad38c0a2..7d9eb248e 100644 --- a/SAM/SAM.Core/Convert/ToCsv/String.cs +++ b/SAM/SAM.Core/Convert/ToCsv/String.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Core @@ -48,7 +51,7 @@ public static string ToCsv(this IJSAMObject jSAMObject, IEnumerable prop value_Temp.Replace("\"", "\"\""); - if(value_Temp.Contains(separator)) + if (value_Temp.Contains(separator)) { value_Temp = string.Format("\"{0}\"", value_Temp); } @@ -88,4 +91,4 @@ public static string ToCsv(this IEnumerable jSAMObjects, IEnumerabl return string.Join("\n", lines); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Convert/ToFile/File.cs b/SAM/SAM.Core/Convert/ToFile/File.cs index 41c2edbec..bb7fe737e 100644 --- a/SAM/SAM.Core/Convert/ToFile/File.cs +++ b/SAM/SAM.Core/Convert/ToFile/File.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System.Collections.Generic; using System.IO; @@ -27,12 +30,12 @@ public static bool ToFile(this IEnumerable jSAMObjects, string path) where public static bool ToFile(IJSAMObject jSAMObject, string path) { - if(jSAMObject == null) + if (jSAMObject == null) { return false; } - return ToFile(new IJSAMObject[] { jSAMObject}, path); + return ToFile(new IJSAMObject[] { jSAMObject }, path); } public static bool ToFile(IJSAMObject jSAMObject, string path, SAMFileType sAMFileType) @@ -63,7 +66,7 @@ public static bool ToFile(this IEnumerable jSAMObjects, string path public static bool ToFile(this IEnumerable delimitedFileRows, DelimitedFileType delimitedFileType, string path) { - if(string.IsNullOrEmpty(path) || delimitedFileRows == null || delimitedFileType == DelimitedFileType.Undefined) + if (string.IsNullOrEmpty(path) || delimitedFileRows == null || delimitedFileType == DelimitedFileType.Undefined) { return false; } @@ -167,4 +170,4 @@ private static bool ToFile_Json(this IEnumerable jSAMObjects, strin return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Convert/ToHexadecimal/Hexadecimal.cs b/SAM/SAM.Core/Convert/ToHexadecimal/Hexadecimal.cs index e348017c7..c3afef845 100644 --- a/SAM/SAM.Core/Convert/ToHexadecimal/Hexadecimal.cs +++ b/SAM/SAM.Core/Convert/ToHexadecimal/Hexadecimal.cs @@ -1,4 +1,7 @@ -using System.Drawing; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Drawing; namespace SAM.Core { @@ -9,4 +12,4 @@ public static string ToHexadecimal(this Color color) return color.R.ToString("X2") + color.G.ToString("X2") + color.B.ToString("X2"); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Convert/ToList/List.cs b/SAM/SAM.Core/Convert/ToList/List.cs index 3d4e219b9..db68b08c2 100644 --- a/SAM/SAM.Core/Convert/ToList/List.cs +++ b/SAM/SAM.Core/Convert/ToList/List.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; namespace SAM.Core @@ -42,7 +45,7 @@ public static List ToList(this JArray jArray, bool skipInvalid = false, bo return null; List result = new List(); - foreach(object @object in jArray) + foreach (object @object in jArray) { object object_Temp = @object; @@ -64,11 +67,11 @@ public static List ToList(this JArray jArray, bool skipInvalid = false, bo if (!tryConvert) { - if(!skipInvalid) + if (!skipInvalid) result.Add(default); - + continue; - } + } T value = default; if (!Query.TryConvert(object_Temp, out value)) @@ -78,11 +81,11 @@ public static List ToList(this JArray jArray, bool skipInvalid = false, bo value = default; } - + result.Add(value); } return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Convert/ToSAM/ComplexReference.cs b/SAM/SAM.Core/Convert/ToSAM/ComplexReference.cs index e8c67e0cf..a2698a22a 100644 --- a/SAM/SAM.Core/Convert/ToSAM/ComplexReference.cs +++ b/SAM/SAM.Core/Convert/ToSAM/ComplexReference.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { @@ -34,11 +37,11 @@ public static IComplexReference ComplexReference(string @string) } List objectReferences = new List() { objectReference }; - while(!string.IsNullOrWhiteSpace(string_out) && @string != string_out) + while (!string.IsNullOrWhiteSpace(string_out) && @string != string_out) { @string = string_out; objectReference = ObjectReference(@string, out string_out); - if(objectReference == null) + if (objectReference == null) { break; } @@ -49,4 +52,4 @@ public static IComplexReference ComplexReference(string @string) return new PathReference(objectReferences); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Convert/ToSAM/IJSAMObjects.cs b/SAM/SAM.Core/Convert/ToSAM/IJSAMObjects.cs index 303352a41..fef9747bb 100644 --- a/SAM/SAM.Core/Convert/ToSAM/IJSAMObjects.cs +++ b/SAM/SAM.Core/Convert/ToSAM/IJSAMObjects.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; using System.IO; using System.IO.Compression; @@ -35,7 +38,7 @@ public static List ToSAM(string path, SAMFileType sAMFileType) if (string.IsNullOrEmpty(path) || !File.Exists(path)) return null; - switch(sAMFileType) + switch (sAMFileType) { case SAMFileType.Json: return ToSAM_FromJsonFile(path); @@ -82,4 +85,4 @@ private static List ToSAM_FromSAMFile(string path) } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Convert/ToSAM/ObjectReference.cs b/SAM/SAM.Core/Convert/ToSAM/ObjectReference.cs index f0f85bc37..0c83491ba 100644 --- a/SAM/SAM.Core/Convert/ToSAM/ObjectReference.cs +++ b/SAM/SAM.Core/Convert/ToSAM/ObjectReference.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Convert { @@ -14,7 +17,7 @@ public static ObjectReference ObjectReference(string @string, out string string_ int index = -1; string string_Temp = @string.TrimStart(); - if(string_Temp.StartsWith("->")) + if (string_Temp.StartsWith("->")) { string_Temp = string_Temp.Substring(2); string_Temp = string_Temp.TrimStart(); @@ -32,7 +35,7 @@ public static ObjectReference ObjectReference(string @string, out string string_ if (string_out.StartsWith(@"""")) { string propertyName_Temp = Query.QuotedText(string_out, out string_out); - if(!string.IsNullOrWhiteSpace(propertyName_Temp)) + if (!string.IsNullOrWhiteSpace(propertyName_Temp)) { return new PropertyReference(propertyName_Temp); } @@ -53,7 +56,7 @@ public static ObjectReference ObjectReference(string @string, out string string_ string_out = string_out.Substring(index + 2); } - if(!string.IsNullOrWhiteSpace(typeName_Temp)) + if (!string.IsNullOrWhiteSpace(typeName_Temp)) { return new ObjectReference(typeName_Temp); } @@ -67,15 +70,15 @@ public static ObjectReference ObjectReference(string @string, out string string_ value_1 = string_out.Substring(0, index); int index_Temp = value_1.IndexOf("->"); - if (index_Temp != -1) - { + if (index_Temp != -1) + { string typeName_Temp = value_1.Substring(0, index_Temp); string_out = string_out.Substring(index_Temp); return new ObjectReference(typeName_Temp); } string_out = string_out.Substring(index + 2); - if(string_out.StartsWith(@"""")) + if (string_out.StartsWith(@"""")) { value_3 = Query.QuotedText(string_out, out string_out); } @@ -114,24 +117,24 @@ public static ObjectReference ObjectReference(string @string, out string string_ Reference? reference = null; string propertyName = null; - if(!string.IsNullOrWhiteSpace(value_2)) + if (!string.IsNullOrWhiteSpace(value_2)) { - if(value_2.StartsWith("[")) + if (value_2.StartsWith("[")) { value_2 = value_2.Substring(1); } - if(value_2.EndsWith("]")) + if (value_2.EndsWith("]")) { value_2 = value_2.Substring(0, value_2.Length - 1); } - if(System.Guid.TryParse(value_2, out System.Guid guid)) + if (System.Guid.TryParse(value_2, out System.Guid guid)) { reference = new Reference(guid); } - else if(int.TryParse(value_2, out int @int)) - { + else if (int.TryParse(value_2, out int @int)) + { reference = new Reference(@int); } else @@ -140,7 +143,7 @@ public static ObjectReference ObjectReference(string @string, out string string_ } } - if(!string.IsNullOrWhiteSpace(value_3)) + if (!string.IsNullOrWhiteSpace(value_3)) { if (value_3.StartsWith(@"""")) { @@ -157,7 +160,7 @@ public static ObjectReference ObjectReference(string @string, out string string_ ObjectReference objectReference = new ObjectReference(typenName, reference); - if(!string.IsNullOrWhiteSpace(propertyName)) + if (!string.IsNullOrWhiteSpace(propertyName)) { return new PropertyReference(objectReference, propertyName); } @@ -165,4 +168,4 @@ public static ObjectReference ObjectReference(string @string, out string string_ return objectReference; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Convert/ToString/String.cs b/SAM/SAM.Core/Convert/ToString/String.cs index b2907d69b..f7b23ae92 100644 --- a/SAM/SAM.Core/Convert/ToString/String.cs +++ b/SAM/SAM.Core/Convert/ToString/String.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System.Collections.Generic; using System.Drawing; @@ -31,12 +34,12 @@ public static string ToString(this IJSAMObject jSAMObject, Formatting formatting return json; } - public static string ToString(this IEnumerable jSAMObjects) where T: IJSAMObject + public static string ToString(this IEnumerable jSAMObjects) where T : IJSAMObject { return ToString(jSAMObjects, Formatting.Indented); } - public static string ToString(this IEnumerable jSAMObjects, Formatting formatting) where T :IJSAMObject + public static string ToString(this IEnumerable jSAMObjects, Formatting formatting) where T : IJSAMObject { if (jSAMObjects == null) return null; @@ -44,7 +47,7 @@ public static string ToString(this IEnumerable jSAMObjects, Formatting for JArray jArray = new JArray(); foreach (T jSAMObject in jSAMObjects) { - if(jSAMObject == null) + if (jSAMObject == null) { continue; } @@ -86,4 +89,4 @@ public static string ToString(double value, string prefix) return "+" + prefix + value.ToString(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Convert/ToUint/Uint.cs b/SAM/SAM.Core/Convert/ToUint/Uint.cs index e0ba9b550..55ddb5d98 100644 --- a/SAM/SAM.Core/Convert/ToUint/Uint.cs +++ b/SAM/SAM.Core/Convert/ToUint/Uint.cs @@ -1,4 +1,7 @@ -using System.Drawing; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Drawing; namespace SAM.Core { @@ -27,4 +30,4 @@ public static uint ToUint(this byte r, byte g, byte b) return (uint)((b << 16) | (g << 8) | (r << 0)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Create/Array.cs b/SAM/SAM.Core/Create/Array.cs index a3170e060..858dd5027 100644 --- a/SAM/SAM.Core/Create/Array.cs +++ b/SAM/SAM.Core/Create/Array.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { @@ -55,7 +58,7 @@ public static partial class Create result[i, j] = values[i][j]; } - for(int j = values[i].Count; j < maxCount; j++) + for (int j = values[i].Count; j < maxCount; j++) { result[i, j] = @default; } @@ -64,4 +67,4 @@ public static partial class Create return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Create/Category.cs b/SAM/SAM.Core/Create/Category.cs index 78bd991ef..4b6777bfa 100644 --- a/SAM/SAM.Core/Create/Category.cs +++ b/SAM/SAM.Core/Create/Category.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Core @@ -7,7 +10,7 @@ public static partial class Create { public static Category Category(this IEnumerable values, bool trim = true) { - if(values == null || values.Count() == 0) + if (values == null || values.Count() == 0) { return null; } @@ -16,12 +19,12 @@ public static Category Category(this IEnumerable values, bool trim = tru for (int i = values.Count() - 1; i >= 0; i--) { string name = values.ElementAt(i); - if(trim) + if (trim) { name = name?.Trim(); } - if(result == null) + if (result == null) { result = new Category(name); } @@ -36,7 +39,7 @@ public static Category Category(this IEnumerable values, bool trim = tru public static Category Category(this string values, string separator, bool trim = true) { - if(values == null) + if (values == null) { return null; } @@ -47,14 +50,14 @@ public static Category Category(this string values, string separator, bool trim public static Category Category(string name, Category parent) { Category result = new Category(name); - + if (parent == null) { return result; } List categories = parent.SubCategories(); - if(categories != null || categories.Count != 0) + if (categories != null || categories.Count != 0) { foreach (Category category in categories) { @@ -67,4 +70,4 @@ public static Category Category(string name, Category parent) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Create/Color.cs b/SAM/SAM.Core/Create/Color.cs index cd614d545..14cd00387 100644 --- a/SAM/SAM.Core/Create/Color.cs +++ b/SAM/SAM.Core/Create/Color.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Drawing; using System.Linq; @@ -23,17 +26,17 @@ public static Color Color() public static Color Color(IEnumerable excludedColors, int count = 10000) { Color result = Color(); - - if(excludedColors == null || excludedColors.Count() == 0) + + if (excludedColors == null || excludedColors.Count() == 0) { return result; } List excludedColors_Temp = new List(excludedColors); - for(int i = 0; i < count; i++) + for (int i = 0; i < count; i++) { - if(excludedColors_Temp.Find(x => Query.Equals(x, result)) == null) + if (excludedColors_Temp.Find(x => Query.Equals(x, result)) == null) { return result; } @@ -44,4 +47,4 @@ public static Color Color(IEnumerable excludedColors, int count = 10000) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Create/Colors.cs b/SAM/SAM.Core/Create/Colors.cs index de6606a46..8f63362f6 100644 --- a/SAM/SAM.Core/Create/Colors.cs +++ b/SAM/SAM.Core/Create/Colors.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Drawing; namespace SAM.Core @@ -7,7 +10,7 @@ public static partial class Create { public static List Colors(this Color color, int count, double minBrightness = 0, double maxBrightness = 1) { - if(color == System.Drawing.Color.Empty || count < 1) + if (color == System.Drawing.Color.Empty || count < 1) { return null; } @@ -18,4 +21,4 @@ public static List Colors(this Color color, int count, double minBrightne return Query.Lerps(color_1, color_2, count); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Create/Commands.cs b/SAM/SAM.Core/Create/Commands.cs index d57e11895..8c338f397 100644 --- a/SAM/SAM.Core/Create/Commands.cs +++ b/SAM/SAM.Core/Create/Commands.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -8,7 +11,7 @@ public static partial class Create { public static List Commands(this string text) { - if(string.IsNullOrWhiteSpace(text)) + if (string.IsNullOrWhiteSpace(text)) { return null; } @@ -16,9 +19,9 @@ public static List Commands(this string text) string[] lines = text.Split('\n'); List result = new List(); - foreach(string line in lines) + foreach (string line in lines) { - if(string.IsNullOrWhiteSpace(line)) + if (string.IsNullOrWhiteSpace(line)) { continue; } @@ -43,7 +46,7 @@ public static List Commands(this string text, IEnumerable enums) List indexes = new List(); List operators = new List(); - if(enums != null) + if (enums != null) { foreach (Enum @enum in enums) { @@ -131,4 +134,4 @@ public static List Commands(this string text, IEnumerable enums) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Create/DelimitedFileRows.cs b/SAM/SAM.Core/Create/DelimitedFileRows.cs index 581ffc073..ae4fc4041 100644 --- a/SAM/SAM.Core/Create/DelimitedFileRows.cs +++ b/SAM/SAM.Core/Create/DelimitedFileRows.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { @@ -20,7 +23,7 @@ public static List DelimitedFileRows(DelimitedFileType delimit public static List DelimitedFileRows(object[,] values) { - if(values == null) + if (values == null) { return null; } @@ -55,4 +58,4 @@ public static List DelimitedFileRows(object[,] values) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Create/DelimitedFileTable.cs b/SAM/SAM.Core/Create/DelimitedFileTable.cs index f650fbb51..dfcf39b09 100644 --- a/SAM/SAM.Core/Create/DelimitedFileTable.cs +++ b/SAM/SAM.Core/Create/DelimitedFileTable.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Core @@ -9,7 +12,7 @@ public static DelimitedFileTable DelimitedFileTable(DelimitedFileType delimitedF { if (delimitedFileType == DelimitedFileType.Undefined || string.IsNullOrEmpty(path) || !System.IO.File.Exists(path)) return null; - + DelimitedFileTable result = null; using (DelimitedFileReader delimitedFileReader = new DelimitedFileReader(delimitedFileType, path)) result = new DelimitedFileTable(delimitedFileReader); @@ -76,4 +79,4 @@ public static DelimitedFileTable DelimitedFileTable(IEnumerable sAMOb return new DelimitedFileTable(data); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Create/Directory.cs b/SAM/SAM.Core/Create/Directory.cs index 2db0f9f39..87dfe3162 100644 --- a/SAM/SAM.Core/Create/Directory.cs +++ b/SAM/SAM.Core/Create/Directory.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.IO; namespace SAM.Core @@ -7,7 +10,7 @@ public static partial class Create { public static bool Directory(this string directory) { - if(string.IsNullOrWhiteSpace(directory)) + if (string.IsNullOrWhiteSpace(directory)) { return false; } @@ -22,22 +25,22 @@ public static bool Directory(this string directory) directories.Add(directory_Temp); directory_Temp = Path.GetDirectoryName(directory_Temp); - while(!string.IsNullOrWhiteSpace(directory_Temp)) + while (!string.IsNullOrWhiteSpace(directory_Temp)) { directories.Add(directory_Temp); directory_Temp = Path.GetDirectoryName(directory_Temp); } - if(directories.Count < 2) + if (directories.Count < 2) { return false; } - for(int i = directories.Count - 2; i >= 0; i--) + for (int i = directories.Count - 2; i >= 0; i--) { directory_Temp = directories[i]; - if(System.IO.Directory.Exists(directory_Temp)) + if (System.IO.Directory.Exists(directory_Temp)) { continue; } @@ -45,7 +48,7 @@ public static bool Directory(this string directory) try { DirectoryInfo directoryInfo = System.IO.Directory.CreateDirectory(directory_Temp); - if(directoryInfo == null) + if (directoryInfo == null) { return false; } @@ -59,4 +62,4 @@ public static bool Directory(this string directory) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Create/EnumParameterDatas.cs b/SAM/SAM.Core/Create/EnumParameterDatas.cs index 10f344f55..0a18b23a5 100644 --- a/SAM/SAM.Core/Create/EnumParameterDatas.cs +++ b/SAM/SAM.Core/Create/EnumParameterDatas.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -8,26 +11,26 @@ public static partial class Create { public static List EnumParameterDatas(params Type[] enumTypes) { - if(enumTypes == null) + if (enumTypes == null) { return null; } HashSet enums = new HashSet(); - foreach(Type type in enumTypes) + foreach (Type type in enumTypes) { - if(type == null || !type.IsEnum) + if (type == null || !type.IsEnum) { continue; } Array array = Enum.GetValues(type); - if(array == null) + if (array == null) { continue; } - foreach(Enum @enum in array) + foreach (Enum @enum in array) { enums.Add(@enum); } @@ -40,16 +43,16 @@ public static List EnumParameterDatas(params Type[] enumTypes public static List EnumParameterDatas(params Enum[] enums) { - if(enums == null) + if (enums == null) { return null; } List result = new List(); - foreach(Enum @enum in enums) + foreach (Enum @enum in enums) { EnumParameterData enumParameterData = new EnumParameterData(@enum); - if(enumParameterData == null || enumParameterData.ParameterProperties == null) + if (enumParameterData == null || enumParameterData.ParameterProperties == null) { continue; } @@ -60,4 +63,4 @@ public static List EnumParameterDatas(params Enum[] enums) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Create/GuidCollection.cs b/SAM/SAM.Core/Create/GuidCollection.cs index 8384afaf8..687edf626 100644 --- a/SAM/SAM.Core/Create/GuidCollection.cs +++ b/SAM/SAM.Core/Create/GuidCollection.cs @@ -1,15 +1,18 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Core { public static partial class Create { - public static GuidCollection GuidCollection(this IEnumerable ts, string name = null, ParameterSet parameterSet = null, bool allowDuplicates = false) where T: IParameterizedSAMObject, ISAMObject + public static GuidCollection GuidCollection(this IEnumerable ts, string name = null, ParameterSet parameterSet = null, bool allowDuplicates = false) where T : IParameterizedSAMObject, ISAMObject { HashSet guids = new HashSet(); GuidCollection result = new GuidCollection(name, parameterSet); - if(ts != null) + if (ts != null) { foreach (T t in ts) { @@ -33,4 +36,4 @@ public static GuidCollection GuidCollection(this IEnumerable ts, string na return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Create/IJSAMObject.cs b/SAM/SAM.Core/Create/IJSAMObject.cs index eb044bbac..fd8d8fb47 100644 --- a/SAM/SAM.Core/Create/IJSAMObject.cs +++ b/SAM/SAM.Core/Create/IJSAMObject.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.IO; using System.IO.Compression; diff --git a/SAM/SAM.Core/Create/IJSAMObjects.cs b/SAM/SAM.Core/Create/IJSAMObjects.cs index 39172f3e5..9d3d50282 100644 --- a/SAM/SAM.Core/Create/IJSAMObjects.cs +++ b/SAM/SAM.Core/Create/IJSAMObjects.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; // Required for working with JSON +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; // Required for working with JSON using System.Collections.Generic; // Required for using List<> using System.Linq; // Required for using Enumerable.Repeat() and Enumerable.ToList() using System.Threading.Tasks; // Required for using Parallel.For() diff --git a/SAM/SAM.Core/Create/IndexedDoubles.cs b/SAM/SAM.Core/Create/IndexedDoubles.cs index ef9062d22..6ff7fff93 100644 --- a/SAM/SAM.Core/Create/IndexedDoubles.cs +++ b/SAM/SAM.Core/Create/IndexedDoubles.cs @@ -1,11 +1,14 @@ - +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + + namespace SAM.Core { public static partial class Create { public static IndexedDoubles IndexedDoubles(this IndexedDoubles indexedDoubles, int start, int end) { - if(indexedDoubles == null) + if (indexedDoubles == null) { return null; } @@ -13,7 +16,7 @@ public static IndexedDoubles IndexedDoubles(this IndexedDoubles indexedDoubles, IndexedDoubles result = new IndexedDoubles(); for (int i = start; i < end; i++) { - if(!indexedDoubles.ContainsIndex(i)) + if (!indexedDoubles.ContainsIndex(i)) { continue; } @@ -45,4 +48,4 @@ public static IndexedDoubles IndexedDoubles(this IndexedDoubles indexedDoubles, return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Create/JArray.cs b/SAM/SAM.Core/Create/JArray.cs index 31d68a9cc..3d986be3f 100644 --- a/SAM/SAM.Core/Create/JArray.cs +++ b/SAM/SAM.Core/Create/JArray.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; namespace SAM.Core @@ -29,4 +32,4 @@ public static JArray JArray(this IEnumerable jSAMObjects) where T : IJSAMO return jArray; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Create/Material.cs b/SAM/SAM.Core/Create/Material.cs index 3525885f9..a4a735df0 100644 --- a/SAM/SAM.Core/Create/Material.cs +++ b/SAM/SAM.Core/Create/Material.cs @@ -1,16 +1,19 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Create { public static Material Material(this Material material, string name, string displayName = null, string description = null) { - if(name == null || material == null) + if (name == null || material == null) { return null; } string displayName_Temp = displayName; - if(displayName_Temp == null) + if (displayName_Temp == null) { displayName_Temp = material.DisplayName; } @@ -25,9 +28,9 @@ public static Material Material(this Material material, string name, string disp { return new GasMaterial(name, System.Guid.NewGuid(), (GasMaterial)material, displayName_Temp, description_Temp); } - - if(material is LiquidMaterial) + + if (material is LiquidMaterial) { return new LiquidMaterial(name, System.Guid.NewGuid(), (LiquidMaterial)material, displayName_Temp, description_Temp); } @@ -37,7 +40,7 @@ public static Material Material(this Material material, string name, string disp return new OpaqueMaterial(name, System.Guid.NewGuid(), (OpaqueMaterial)material, displayName_Temp, description_Temp); } - if(material is TransparentMaterial) + if (material is TransparentMaterial) { return new TransparentMaterial(name, System.Guid.NewGuid(), (TransparentMaterial)material, displayName_Temp, description_Temp); } @@ -46,4 +49,4 @@ public static Material Material(this Material material, string name, string disp } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Create/MaterialLibrary.cs b/SAM/SAM.Core/Create/MaterialLibrary.cs index dbf4914a9..0478e8a7c 100644 --- a/SAM/SAM.Core/Create/MaterialLibrary.cs +++ b/SAM/SAM.Core/Create/MaterialLibrary.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; using System.IO; @@ -33,4 +36,4 @@ public static MaterialLibrary MaterialLibrary(string name, IEnumerable(params object[] objects) object result = null; ConstructorInfo constructorInfo = type.GetConstructor(objects.ToList().ConvertAll(x => x?.GetType()).ToArray()); - if(constructorInfo != null) + if (constructorInfo != null) { result = constructorInfo.Invoke(objects); if (result is T) @@ -34,7 +37,7 @@ public static T Object(params object[] objects) foreach (ConstructorInfo constructorInfo_Temp in constructorInfos) { ParameterInfo[] parameterInfos = constructorInfo_Temp.GetParameters(); - if((parameterInfos == null || parameterInfos.Length == 0) && count == 0) + if ((parameterInfos == null || parameterInfos.Length == 0) && count == 0) { result = constructorInfo_Temp.Invoke(new object[0]); if (result is T) @@ -44,7 +47,7 @@ public static T Object(params object[] objects) if (parameterInfos.Length != count) continue; - List objects_Temp = new List(objects); + List objects_Temp = new List(objects); List parameteres = new List(); foreach (ParameterInfo parameterInfo in parameterInfos) { @@ -67,4 +70,4 @@ public static T Object(params object[] objects) return default; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Create/ObjectReference.cs b/SAM/SAM.Core/Create/ObjectReference.cs index c74f6bac0..52dc6fd40 100644 --- a/SAM/SAM.Core/Create/ObjectReference.cs +++ b/SAM/SAM.Core/Create/ObjectReference.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Core { @@ -6,7 +9,7 @@ public static partial class Create { public static ObjectReference ObjectReference(this T @object, Func func = null) { - if(@object == null) + if (@object == null) { return null; } @@ -14,4 +17,4 @@ public static ObjectReference ObjectReference(this T @object, Func ParameterSets(this JArray jArray) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Create/SearchObjectWrapper.cs b/SAM/SAM.Core/Create/SearchObjectWrapper.cs index 3dd4f80dc..6a9039571 100644 --- a/SAM/SAM.Core/Create/SearchObjectWrapper.cs +++ b/SAM/SAM.Core/Create/SearchObjectWrapper.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Core @@ -8,11 +11,11 @@ public static partial class Create public static SearchObjectWrapper SearchObjectWrapper(IEnumerable items, Func func, bool caseSensitive = false) { Func func_Object = null; - if(func != null) + if (func != null) { func_Object = new Func((object @object) => { - if(!(@object is T)) + if (!(@object is T)) { return null; } @@ -27,4 +30,4 @@ public static SearchObjectWrapper SearchObjectWrapper(IEnumerable items, F return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Create/StartupOptions.cs b/SAM/SAM.Core/Create/StartupOptions.cs index cbed5d4df..855f39a6d 100644 --- a/SAM/SAM.Core/Create/StartupOptions.cs +++ b/SAM/SAM.Core/Create/StartupOptions.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Core diff --git a/SAM/SAM.Core/Create/TextMap.cs b/SAM/SAM.Core/Create/TextMap.cs index 44819a208..714b0cd40 100644 --- a/SAM/SAM.Core/Create/TextMap.cs +++ b/SAM/SAM.Core/Create/TextMap.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Core { @@ -11,7 +14,7 @@ public static TextMap TextMap(string name) public static TextMap TextMap(TextMap textMap) { - if(textMap == null) + if (textMap == null) { return null; } @@ -39,4 +42,4 @@ public static TextMap TextMap(JObject jObject) return new TextMap(jObject); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Create/TypeMap.cs b/SAM/SAM.Core/Create/TypeMap.cs index 28bb45adc..9da310f4f 100644 --- a/SAM/SAM.Core/Create/TypeMap.cs +++ b/SAM/SAM.Core/Create/TypeMap.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Create { @@ -7,4 +10,4 @@ public static TypeMap TypeMap() return new TypeMap(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Create/ZipArchiveInfo.cs b/SAM/SAM.Core/Create/ZipArchiveInfo.cs index 1a808a671..845eb2dfd 100644 --- a/SAM/SAM.Core/Create/ZipArchiveInfo.cs +++ b/SAM/SAM.Core/Create/ZipArchiveInfo.cs @@ -1,4 +1,7 @@ -using System.IO.Compression; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.IO.Compression; namespace SAM.Core { @@ -16,4 +19,4 @@ public static ZipArchiveInfo ZipArchiveInfo(this ZipArchive zipArchive) return IJSAMObject(zipArchiveEntry); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/AboutInfoType.cs b/SAM/SAM.Core/Enums/AboutInfoType.cs index af9b220ed..c376e2eab 100644 --- a/SAM/SAM.Core/Enums/AboutInfoType.cs +++ b/SAM/SAM.Core/Enums/AboutInfoType.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Core { @@ -9,4 +12,4 @@ public enum AboutInfoType [Description("SAM Info")] SAM, [Description("Other Info")] Other, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/AccessType.cs b/SAM/SAM.Core/Enums/AccessType.cs index 641e8a31f..7a3233d87 100644 --- a/SAM/SAM.Core/Enums/AccessType.cs +++ b/SAM/SAM.Core/Enums/AccessType.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public enum AccessType { @@ -6,4 +9,4 @@ public enum AccessType Write, ReadWrite } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/CombineType.cs b/SAM/SAM.Core/Enums/CombineType.cs index 725ee8929..bda7a612d 100644 --- a/SAM/SAM.Core/Enums/CombineType.cs +++ b/SAM/SAM.Core/Enums/CombineType.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Core { @@ -11,4 +14,4 @@ public enum CombineType [Description("Min")] Min, [Description("Max")] Max, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/CountryCode.cs b/SAM/SAM.Core/Enums/CountryCode.cs index 5985a9da6..e47c4a5d2 100644 --- a/SAM/SAM.Core/Enums/CountryCode.cs +++ b/SAM/SAM.Core/Enums/CountryCode.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Core { diff --git a/SAM/SAM.Core/Enums/DelimitedFileType.cs b/SAM/SAM.Core/Enums/DelimitedFileType.cs index 96b901fab..ff4c7b5c2 100644 --- a/SAM/SAM.Core/Enums/DelimitedFileType.cs +++ b/SAM/SAM.Core/Enums/DelimitedFileType.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Core { @@ -9,4 +12,4 @@ public enum DelimitedFileType [Description("Csv")] Csv, [Description("Tab Delimited")] TabDelimited } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/Direction.cs b/SAM/SAM.Core/Enums/Direction.cs index 039204737..e7dc4bbee 100644 --- a/SAM/SAM.Core/Enums/Direction.cs +++ b/SAM/SAM.Core/Enums/Direction.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Core { @@ -9,4 +12,4 @@ public enum Direction [Description("In")] In, [Description("Out")] Out } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/FilterLogicalOperator.cs b/SAM/SAM.Core/Enums/FilterLogicalOperator.cs index 8551715e3..a15e344fd 100644 --- a/SAM/SAM.Core/Enums/FilterLogicalOperator.cs +++ b/SAM/SAM.Core/Enums/FilterLogicalOperator.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Core { @@ -9,4 +12,4 @@ public enum FilterLogicalOperator [Description("And")] And, [Description("Or")] Or, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/LogRecordType.cs b/SAM/SAM.Core/Enums/LogRecordType.cs index 8e5b3873b..8010b2b04 100644 --- a/SAM/SAM.Core/Enums/LogRecordType.cs +++ b/SAM/SAM.Core/Enums/LogRecordType.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Core { @@ -10,4 +13,4 @@ public enum LogRecordType [Description("Warning")] Warning, [Description("Error")] Error } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/MaterialType.cs b/SAM/SAM.Core/Enums/MaterialType.cs index d279cbafa..51296c69c 100644 --- a/SAM/SAM.Core/Enums/MaterialType.cs +++ b/SAM/SAM.Core/Enums/MaterialType.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Core { @@ -10,4 +13,4 @@ public enum MaterialType [Description("Opaque Material")] Opaque, [Description("Transparent Material")] Transparent, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/MessageType.cs b/SAM/SAM.Core/Enums/MessageType.cs index e6d66c5a1..c25ccce8d 100644 --- a/SAM/SAM.Core/Enums/MessageType.cs +++ b/SAM/SAM.Core/Enums/MessageType.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Core { @@ -10,4 +13,4 @@ public enum MessageType [Description("Warning")] Warning, [Description("Error")] Error } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/NumberComparisonType.cs b/SAM/SAM.Core/Enums/NumberComparisonType.cs index e2a314e46..ab3024027 100644 --- a/SAM/SAM.Core/Enums/NumberComparisonType.cs +++ b/SAM/SAM.Core/Enums/NumberComparisonType.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Core { @@ -12,4 +15,4 @@ public enum NumberComparisonType [Description("Number Less Than Or Equals")] LessOrEquals, [Description("Number Greater Than Or Equals")] GreaterOrEquals } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/Operator/ArithmeticOperator.cs b/SAM/SAM.Core/Enums/Operator/ArithmeticOperator.cs index 70fb50a4a..f3e2ab2f7 100644 --- a/SAM/SAM.Core/Enums/Operator/ArithmeticOperator.cs +++ b/SAM/SAM.Core/Enums/Operator/ArithmeticOperator.cs @@ -1,4 +1,7 @@ -using SAM.Core.Attributes; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core.Attributes; using System.ComponentModel; namespace SAM.Core @@ -12,4 +15,4 @@ public enum ArithmeticOperator [Operator("/"), Description("Division")] Division, [Operator("%"), Description("Modulus")] Modulus } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/Operator/AssignmentOperator.cs b/SAM/SAM.Core/Enums/Operator/AssignmentOperator.cs index 03fa604c4..e20d447da 100644 --- a/SAM/SAM.Core/Enums/Operator/AssignmentOperator.cs +++ b/SAM/SAM.Core/Enums/Operator/AssignmentOperator.cs @@ -1,4 +1,7 @@ -using SAM.Core.Attributes; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core.Attributes; using System.ComponentModel; namespace SAM.Core @@ -18,4 +21,4 @@ public enum AssignmentOperator [Operator("|="), Description("Bitwise Or And Assign")] BitwiseOrAndAssign, [Operator("^="), Description("Bitwise Xor And Assign")] BitwiseXorAndAssign, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/Operator/BitwiseOperator.cs b/SAM/SAM.Core/Enums/Operator/BitwiseOperator.cs index 94cb3f53f..a28c6d33d 100644 --- a/SAM/SAM.Core/Enums/Operator/BitwiseOperator.cs +++ b/SAM/SAM.Core/Enums/Operator/BitwiseOperator.cs @@ -1,4 +1,7 @@ -using SAM.Core.Attributes; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core.Attributes; using System.ComponentModel; namespace SAM.Core @@ -14,4 +17,4 @@ public enum BitwiseOperator [Operator("<<"), Description("LeftShift")] LeftShift, [Operator(">>"), Description("RightShift")] RightShift } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/Operator/CommandOperator.cs b/SAM/SAM.Core/Enums/Operator/CommandOperator.cs index d369e40d5..277176a2f 100644 --- a/SAM/SAM.Core/Enums/Operator/CommandOperator.cs +++ b/SAM/SAM.Core/Enums/Operator/CommandOperator.cs @@ -1,4 +1,7 @@ -using SAM.Core.Attributes; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core.Attributes; using System.ComponentModel; namespace SAM.Core @@ -15,4 +18,4 @@ public enum CommandOperator [Operator("using"), Description("Directive")] Directive, [Operator("."), Description("Member Separator")] MemberSeparator, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/Operator/IncrementAndDecrementOperator.cs b/SAM/SAM.Core/Enums/Operator/IncrementAndDecrementOperator.cs index f13a61260..94b0fe437 100644 --- a/SAM/SAM.Core/Enums/Operator/IncrementAndDecrementOperator.cs +++ b/SAM/SAM.Core/Enums/Operator/IncrementAndDecrementOperator.cs @@ -1,4 +1,7 @@ -using SAM.Core.Attributes; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core.Attributes; using System.ComponentModel; namespace SAM.Core @@ -9,4 +12,4 @@ public enum IncrementAndDecrementOperator [Operator("++"), Description("Increment")] Increment, [Operator("--"), Description("Decrement")] Decrement, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/Operator/LogicalOperator.cs b/SAM/SAM.Core/Enums/Operator/LogicalOperator.cs index d5b7d4eac..0a5316200 100644 --- a/SAM/SAM.Core/Enums/Operator/LogicalOperator.cs +++ b/SAM/SAM.Core/Enums/Operator/LogicalOperator.cs @@ -1,4 +1,7 @@ -using SAM.Core.Attributes; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core.Attributes; using System.ComponentModel; namespace SAM.Core @@ -10,4 +13,4 @@ public enum LogicalOperator [Operator("||"), Description("Or")] Or, [Operator("!"), Description("Not")] Not, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/Operator/RelationalOperator.cs b/SAM/SAM.Core/Enums/Operator/RelationalOperator.cs index fbae26f4b..85c351c0b 100644 --- a/SAM/SAM.Core/Enums/Operator/RelationalOperator.cs +++ b/SAM/SAM.Core/Enums/Operator/RelationalOperator.cs @@ -1,4 +1,7 @@ -using SAM.Core.Attributes; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core.Attributes; using System.ComponentModel; namespace SAM.Core @@ -13,4 +16,4 @@ public enum RelationalOperator [Operator("<="), Description("Less Than Or Equal")] LessThanOrEqual, [Operator(">="), Description("Greater Than Or Equal")] GreaterThanOrEqual, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/PageOrientation.cs b/SAM/SAM.Core/Enums/PageOrientation.cs index 3433a52c3..70680c699 100644 --- a/SAM/SAM.Core/Enums/PageOrientation.cs +++ b/SAM/SAM.Core/Enums/PageOrientation.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Core { @@ -9,4 +12,4 @@ public enum PageOrientation [Description("Portrait")] Portrait, [Description("Landscape")] Landscape, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/PageSize.cs b/SAM/SAM.Core/Enums/PageSize.cs index 3f4ce8300..8c832e55d 100644 --- a/SAM/SAM.Core/Enums/PageSize.cs +++ b/SAM/SAM.Core/Enums/PageSize.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Core { @@ -9,4 +12,4 @@ public enum PageSize [Description("A4")] A4, [Description("A3")] A3, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/Parameter/CoreSettingParameter.cs b/SAM/SAM.Core/Enums/Parameter/CoreSettingParameter.cs index a27e3c76a..d8195387d 100644 --- a/SAM/SAM.Core/Enums/Parameter/CoreSettingParameter.cs +++ b/SAM/SAM.Core/Enums/Parameter/CoreSettingParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Core { @@ -10,4 +13,4 @@ public enum CoreSettingParameter [ParameterProperties("Templates Directory Name", "Templates Directory Name"), ParameterValue(ParameterType.String)] TemplatesDirectoryName, [ParameterProperties("Special Character Maps Directory Name", "Special Character Maps Directory Name"), ParameterValue(ParameterType.String)] SpecialCharacterMapsDirectoryName, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/Parameter/LocationParameter.cs b/SAM/SAM.Core/Enums/Parameter/LocationParameter.cs index c8db67fbf..ddcfeb0c3 100644 --- a/SAM/SAM.Core/Enums/Parameter/LocationParameter.cs +++ b/SAM/SAM.Core/Enums/Parameter/LocationParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Core { @@ -8,4 +11,4 @@ public enum LocationParameter { [ParameterProperties("Time Zone", "UTC TimeZone"), ParameterValue(ParameterType.String)] TimeZone, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/Parameter/MaterialParameter.cs b/SAM/SAM.Core/Enums/Parameter/MaterialParameter.cs index 1d0a6ad00..46538cae1 100644 --- a/SAM/SAM.Core/Enums/Parameter/MaterialParameter.cs +++ b/SAM/SAM.Core/Enums/Parameter/MaterialParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Core { @@ -8,4 +11,4 @@ public enum MaterialParameter { [ParameterProperties("Default Thickness", "Default Material Thickness"), DoubleParameterValue(0)] DefaultThickness, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/Parameter/ParameterizedSAMObjectParameter.cs b/SAM/SAM.Core/Enums/Parameter/ParameterizedSAMObjectParameter.cs index b2472063b..ed267ba86 100644 --- a/SAM/SAM.Core/Enums/Parameter/ParameterizedSAMObjectParameter.cs +++ b/SAM/SAM.Core/Enums/Parameter/ParameterizedSAMObjectParameter.cs @@ -1,5 +1,8 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Core.Attributes; +using System.ComponentModel; namespace SAM.Core { @@ -8,4 +11,4 @@ public enum ParameterizedSAMObjectParameter { [ParameterProperties("Category", "Category"), SAMObjectParameterValue(typeof(Category))] Category, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/ParameterType.cs b/SAM/SAM.Core/Enums/ParameterType.cs index ce33b60b7..0697ef4b1 100644 --- a/SAM/SAM.Core/Enums/ParameterType.cs +++ b/SAM/SAM.Core/Enums/ParameterType.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public enum ParameterType { @@ -6,10 +9,10 @@ public enum ParameterType Double, String, Guid, - IJSAMObject, + IJSAMObject, Integer, Boolean, DateTime, Color } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/Period.cs b/SAM/SAM.Core/Enums/Period.cs index 47b1cdf9e..162bc9f9c 100644 --- a/SAM/SAM.Core/Enums/Period.cs +++ b/SAM/SAM.Core/Enums/Period.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Core { @@ -11,4 +14,4 @@ public enum Period [Description("Weekly")] Weekly, [Description("Monthly")] Monthly, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/RelationType.cs b/SAM/SAM.Core/Enums/RelationType.cs index e660572ec..d35f5172c 100644 --- a/SAM/SAM.Core/Enums/RelationType.cs +++ b/SAM/SAM.Core/Enums/RelationType.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Core { @@ -11,4 +14,4 @@ public enum RelationType [Description("Many to one")] ManyToOne, [Description("Many to many")] ManyToMany } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/SAMFileType.cs b/SAM/SAM.Core/Enums/SAMFileType.cs index f21ea1587..9827ad77f 100644 --- a/SAM/SAM.Core/Enums/SAMFileType.cs +++ b/SAM/SAM.Core/Enums/SAMFileType.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Core { @@ -9,4 +12,4 @@ public enum SAMFileType [Description("Json")] Json, [Description("SAM")] SAM, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/StartupArgument.cs b/SAM/SAM.Core/Enums/StartupArgument.cs index 017337069..ae1b93d76 100644 --- a/SAM/SAM.Core/Enums/StartupArgument.cs +++ b/SAM/SAM.Core/Enums/StartupArgument.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public enum StartupArgument { diff --git a/SAM/SAM.Core/Enums/TextComparisonType.cs b/SAM/SAM.Core/Enums/TextComparisonType.cs index a68ffa3a3..1b16d19f0 100644 --- a/SAM/SAM.Core/Enums/TextComparisonType.cs +++ b/SAM/SAM.Core/Enums/TextComparisonType.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Core { @@ -12,4 +15,4 @@ public enum TextComparisonType [Description("Text Starts With")] StartsWith, [Description("Text Ends With")] EndsWith, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/UTC.cs b/SAM/SAM.Core/Enums/UTC.cs index 497581ed8..78daec408 100644 --- a/SAM/SAM.Core/Enums/UTC.cs +++ b/SAM/SAM.Core/Enums/UTC.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Core { diff --git a/SAM/SAM.Core/Enums/ValueType.cs b/SAM/SAM.Core/Enums/ValueType.cs index 1444bcf2b..bc112ca88 100644 --- a/SAM/SAM.Core/Enums/ValueType.cs +++ b/SAM/SAM.Core/Enums/ValueType.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public enum ValueType { @@ -6,10 +9,10 @@ public enum ValueType Double, String, Guid, - IJSAMObject, + IJSAMObject, Integer, Boolean, DateTime, Color } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/Week.cs b/SAM/SAM.Core/Enums/Week.cs index 1e134196c..3330b43c5 100644 --- a/SAM/SAM.Core/Enums/Week.cs +++ b/SAM/SAM.Core/Enums/Week.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Core { @@ -14,4 +17,4 @@ public enum Week [Description("Saturday")] Saturday, [Description("Sunday")] Sunday, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Enums/YesNo.cs b/SAM/SAM.Core/Enums/YesNo.cs index 3ad65aeab..d7b88d67a 100644 --- a/SAM/SAM.Core/Enums/YesNo.cs +++ b/SAM/SAM.Core/Enums/YesNo.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Core { @@ -9,4 +12,4 @@ public enum YesNo [Description("Yes")] Yes, [Description("No")] No } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Base/IDispatch.cs b/SAM/SAM.Core/Interfaces/Base/IDispatch.cs index e16efd83e..a3ef91c63 100644 --- a/SAM/SAM.Core/Interfaces/Base/IDispatch.cs +++ b/SAM/SAM.Core/Interfaces/Base/IDispatch.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Runtime.InteropServices; namespace SAM.Core diff --git a/SAM/SAM.Core/Interfaces/Base/IId.cs b/SAM/SAM.Core/Interfaces/Base/IId.cs index 1d82b1280..03d27c2ee 100644 --- a/SAM/SAM.Core/Interfaces/Base/IId.cs +++ b/SAM/SAM.Core/Interfaces/Base/IId.cs @@ -1,4 +1,5 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors namespace SAM.Core { @@ -6,4 +7,4 @@ public interface IId : IParameterizedSAMObject { } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Base/IJSAMObject.cs b/SAM/SAM.Core/Interfaces/Base/IJSAMObject.cs index 8a8088231..4bf0cf5dc 100644 --- a/SAM/SAM.Core/Interfaces/Base/IJSAMObject.cs +++ b/SAM/SAM.Core/Interfaces/Base/IJSAMObject.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Core { @@ -8,4 +11,4 @@ public interface IJSAMObject JObject ToJObject(); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Base/IParameterData.cs b/SAM/SAM.Core/Interfaces/Base/IParameterData.cs index 408b3c3bc..dbc55149f 100644 --- a/SAM/SAM.Core/Interfaces/Base/IParameterData.cs +++ b/SAM/SAM.Core/Interfaces/Base/IParameterData.cs @@ -1,4 +1,7 @@ -using SAM.Core.Attributes; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core.Attributes; namespace SAM.Core { diff --git a/SAM/SAM.Core/Interfaces/Base/IParameterizedSAMObject.cs b/SAM/SAM.Core/Interfaces/Base/IParameterizedSAMObject.cs index c61a76ffd..dc72d1839 100644 --- a/SAM/SAM.Core/Interfaces/Base/IParameterizedSAMObject.cs +++ b/SAM/SAM.Core/Interfaces/Base/IParameterizedSAMObject.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Core { @@ -12,4 +15,4 @@ public interface IParameterizedSAMObject : IJSAMObject bool TryGetValue(Enum @enum, out T value, bool tryConvert = true); bool TryGetValue(Enum @enum, out object value); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Base/IResult.cs b/SAM/SAM.Core/Interfaces/Base/IResult.cs index 6bc206cae..4e17a150e 100644 --- a/SAM/SAM.Core/Interfaces/Base/IResult.cs +++ b/SAM/SAM.Core/Interfaces/Base/IResult.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Core { @@ -8,4 +11,4 @@ public interface IResult : IParameterizedSAMObject string Reference { get; } DateTime DateTime { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Base/ISAMInstance.cs b/SAM/SAM.Core/Interfaces/Base/ISAMInstance.cs index 4a5fe1b12..19aac09e2 100644 --- a/SAM/SAM.Core/Interfaces/Base/ISAMInstance.cs +++ b/SAM/SAM.Core/Interfaces/Base/ISAMInstance.cs @@ -1,6 +1,9 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public interface ISAMInstance : IParameterizedSAMObject, ISAMObject { } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Base/ISAMObject.cs b/SAM/SAM.Core/Interfaces/Base/ISAMObject.cs index b82eb1a30..3451c8dbf 100644 --- a/SAM/SAM.Core/Interfaces/Base/ISAMObject.cs +++ b/SAM/SAM.Core/Interfaces/Base/ISAMObject.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Core { @@ -7,4 +10,4 @@ public interface ISAMObject : IJSAMObject Guid Guid { get; } string Name { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Base/ISAMType.cs b/SAM/SAM.Core/Interfaces/Base/ISAMType.cs index fe806c16d..ecdfef274 100644 --- a/SAM/SAM.Core/Interfaces/Base/ISAMType.cs +++ b/SAM/SAM.Core/Interfaces/Base/ISAMType.cs @@ -1,6 +1,9 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public interface ISAMType : IParameterizedSAMObject, ISAMObject { } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Base/ISystem.cs b/SAM/SAM.Core/Interfaces/Base/ISystem.cs index 7960fa093..ab5bb929a 100644 --- a/SAM/SAM.Core/Interfaces/Base/ISystem.cs +++ b/SAM/SAM.Core/Interfaces/Base/ISystem.cs @@ -1,7 +1,10 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public interface ISystem : IParameterizedSAMObject { } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Base/ISystemType.cs b/SAM/SAM.Core/Interfaces/Base/ISystemType.cs index 53f85e581..62a0b1c69 100644 --- a/SAM/SAM.Core/Interfaces/Base/ISystemType.cs +++ b/SAM/SAM.Core/Interfaces/Base/ISystemType.cs @@ -1,7 +1,10 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public interface ISystemType : IParameterizedSAMObject, ISAMObject { string Description { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Base/ITaggable.cs b/SAM/SAM.Core/Interfaces/Base/ITaggable.cs index 0e9c7e9c0..c71ad0ac1 100644 --- a/SAM/SAM.Core/Interfaces/Base/ITaggable.cs +++ b/SAM/SAM.Core/Interfaces/Base/ITaggable.cs @@ -1,7 +1,10 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public interface ITaggable { Tag Tag { get; set; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Collection/IIndexedObjects.cs b/SAM/SAM.Core/Interfaces/Collection/IIndexedObjects.cs index b38e58445..b08e81a80 100644 --- a/SAM/SAM.Core/Interfaces/Collection/IIndexedObjects.cs +++ b/SAM/SAM.Core/Interfaces/Collection/IIndexedObjects.cs @@ -1,4 +1,7 @@ -using System.Collections; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections; using System.Collections.Generic; namespace SAM.Core @@ -10,4 +13,4 @@ public interface IIndexedObjects : IJSAMObject, IEnumerable public interface IIndexedObjects : IIndexedObjects, IEnumerable { } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/DelimitedFile/IDelimitedFileReader.cs b/SAM/SAM.Core/Interfaces/DelimitedFile/IDelimitedFileReader.cs index d8873f55d..db821ed8b 100644 --- a/SAM/SAM.Core/Interfaces/DelimitedFile/IDelimitedFileReader.cs +++ b/SAM/SAM.Core/Interfaces/DelimitedFile/IDelimitedFileReader.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { @@ -10,4 +13,4 @@ public interface IDelimitedFileReader List Read(); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/DelimitedFile/IDelimitedFileWriter.cs b/SAM/SAM.Core/Interfaces/DelimitedFile/IDelimitedFileWriter.cs index 6d735ff6d..175655e1e 100644 --- a/SAM/SAM.Core/Interfaces/DelimitedFile/IDelimitedFileWriter.cs +++ b/SAM/SAM.Core/Interfaces/DelimitedFile/IDelimitedFileWriter.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { @@ -10,4 +13,4 @@ public interface IDelimitedFileWriter void Write(IEnumerable DelimitedFileRows); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Filter/IEnumFilter.cs b/SAM/SAM.Core/Interfaces/Filter/IEnumFilter.cs index 4fc4f3b85..312f6b165 100644 --- a/SAM/SAM.Core/Interfaces/Filter/IEnumFilter.cs +++ b/SAM/SAM.Core/Interfaces/Filter/IEnumFilter.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Core { @@ -6,4 +9,4 @@ public interface IEnumFilter : IFilter { public Enum Enum { get; set; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Filter/IFilter.cs b/SAM/SAM.Core/Interfaces/Filter/IFilter.cs index 0df5f4c5b..3a2ba1dca 100644 --- a/SAM/SAM.Core/Interfaces/Filter/IFilter.cs +++ b/SAM/SAM.Core/Interfaces/Filter/IFilter.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public interface IFilter : IJSAMObject { @@ -7,4 +10,4 @@ public interface IFilter : IJSAMObject bool IsValid(IJSAMObject jSAMObject); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Filter/IMultiRelationFilter.cs b/SAM/SAM.Core/Interfaces/Filter/IMultiRelationFilter.cs index 4a8064548..6d775c9f2 100644 --- a/SAM/SAM.Core/Interfaces/Filter/IMultiRelationFilter.cs +++ b/SAM/SAM.Core/Interfaces/Filter/IMultiRelationFilter.cs @@ -1,7 +1,10 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public interface IMultiRelationFilter : IRelationFilter { FilterLogicalOperator FilterLogicalOperator { get; set; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Filter/INumberFilter.cs b/SAM/SAM.Core/Interfaces/Filter/INumberFilter.cs index a8d41ef2f..93d1ff442 100644 --- a/SAM/SAM.Core/Interfaces/Filter/INumberFilter.cs +++ b/SAM/SAM.Core/Interfaces/Filter/INumberFilter.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public interface INumberFilter : IFilter { @@ -6,4 +9,4 @@ public interface INumberFilter : IFilter public double Value { get; set; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Filter/IRelationFilter.cs b/SAM/SAM.Core/Interfaces/Filter/IRelationFilter.cs index d33d441a6..0dc3fe2e3 100644 --- a/SAM/SAM.Core/Interfaces/Filter/IRelationFilter.cs +++ b/SAM/SAM.Core/Interfaces/Filter/IRelationFilter.cs @@ -1,7 +1,10 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public interface IRelationFilter : IFilter { IFilter Filter { get; set; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Filter/ISAMObjectRelationClusterFilter.cs b/SAM/SAM.Core/Interfaces/Filter/ISAMObjectRelationClusterFilter.cs index 2c2f73eb0..af34be479 100644 --- a/SAM/SAM.Core/Interfaces/Filter/ISAMObjectRelationClusterFilter.cs +++ b/SAM/SAM.Core/Interfaces/Filter/ISAMObjectRelationClusterFilter.cs @@ -1,4 +1,7 @@ - +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + + namespace SAM.Core { public interface ISAMObjectRelationClusterFilter : IFilter diff --git a/SAM/SAM.Core/Interfaces/Filter/ITextFilter.cs b/SAM/SAM.Core/Interfaces/Filter/ITextFilter.cs index a6285fbce..5b54b3145 100644 --- a/SAM/SAM.Core/Interfaces/Filter/ITextFilter.cs +++ b/SAM/SAM.Core/Interfaces/Filter/ITextFilter.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public interface ITextFilter : IFilter { @@ -9,4 +12,4 @@ public interface ITextFilter : IFilter public string Value { get; set; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Library/ISAMLibrary.cs b/SAM/SAM.Core/Interfaces/Library/ISAMLibrary.cs index e4a8cae6e..7ef91a23e 100644 --- a/SAM/SAM.Core/Interfaces/Library/ISAMLibrary.cs +++ b/SAM/SAM.Core/Interfaces/Library/ISAMLibrary.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public interface ISAMLibrary : IParameterizedSAMObject { @@ -6,4 +9,4 @@ public interface ISAMLibrary : IParameterizedSAMObject bool Write(string path); bool Append(string path); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Material/IMaterial.cs b/SAM/SAM.Core/Interfaces/Material/IMaterial.cs index 87ce9fc5f..3e481fd63 100644 --- a/SAM/SAM.Core/Interfaces/Material/IMaterial.cs +++ b/SAM/SAM.Core/Interfaces/Material/IMaterial.cs @@ -1,8 +1,11 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { - public interface IMaterial: IParameterizedSAMObject, ISAMObject + public interface IMaterial : IParameterizedSAMObject, ISAMObject { //string Name { get; } //System.Guid Guid { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Modifier/IComplexModifier.cs b/SAM/SAM.Core/Interfaces/Modifier/IComplexModifier.cs index 2dc80b924..493b0818e 100644 --- a/SAM/SAM.Core/Interfaces/Modifier/IComplexModifier.cs +++ b/SAM/SAM.Core/Interfaces/Modifier/IComplexModifier.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { @@ -11,4 +14,4 @@ public interface IComplexModifier : IComplexModifier where T : IModifier { List Modifiers { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Modifier/IIndexedComplexModifier.cs b/SAM/SAM.Core/Interfaces/Modifier/IIndexedComplexModifier.cs index dbc3699cb..a4d1f1f45 100644 --- a/SAM/SAM.Core/Interfaces/Modifier/IIndexedComplexModifier.cs +++ b/SAM/SAM.Core/Interfaces/Modifier/IIndexedComplexModifier.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors namespace SAM.Core { @@ -6,4 +7,4 @@ public interface IIndexedComplexModifier : IComplexModifier { } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Modifier/IIndexedModifier.cs b/SAM/SAM.Core/Interfaces/Modifier/IIndexedModifier.cs index 1e3210764..893590ad4 100644 --- a/SAM/SAM.Core/Interfaces/Modifier/IIndexedModifier.cs +++ b/SAM/SAM.Core/Interfaces/Modifier/IIndexedModifier.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public interface IIndexedModifier : IModifier { @@ -6,4 +9,4 @@ public interface IIndexedModifier : IModifier double GetCalculatedValue(int index, double value); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Modifier/IModifableValue.cs b/SAM/SAM.Core/Interfaces/Modifier/IModifableValue.cs index f284d74b5..1dd2ec9e9 100644 --- a/SAM/SAM.Core/Interfaces/Modifier/IModifableValue.cs +++ b/SAM/SAM.Core/Interfaces/Modifier/IModifableValue.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public interface IModifiableValue : IJSAMObject { @@ -6,4 +9,4 @@ public interface IModifiableValue : IJSAMObject IModifier Modifier { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Modifier/IModifier.cs b/SAM/SAM.Core/Interfaces/Modifier/IModifier.cs index 2280a7c7f..a63062e83 100644 --- a/SAM/SAM.Core/Interfaces/Modifier/IModifier.cs +++ b/SAM/SAM.Core/Interfaces/Modifier/IModifier.cs @@ -1,7 +1,10 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public interface IModifier : IJSAMObject { } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Modifier/ISimpleModifier.cs b/SAM/SAM.Core/Interfaces/Modifier/ISimpleModifier.cs index a1ca68af1..a5df0b05c 100644 --- a/SAM/SAM.Core/Interfaces/Modifier/ISimpleModifier.cs +++ b/SAM/SAM.Core/Interfaces/Modifier/ISimpleModifier.cs @@ -1,7 +1,10 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public interface ISimpleModifier : IModifier { ArithmeticOperator ArithmeticOperator { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Reference/IComplexReference.cs b/SAM/SAM.Core/Interfaces/Reference/IComplexReference.cs index 2fc87875c..918d64d0c 100644 --- a/SAM/SAM.Core/Interfaces/Reference/IComplexReference.cs +++ b/SAM/SAM.Core/Interfaces/Reference/IComplexReference.cs @@ -1,7 +1,10 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public interface IComplexReference : IReference { } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Reference/IReference.cs b/SAM/SAM.Core/Interfaces/Reference/IReference.cs index e56047516..184f75bc3 100644 --- a/SAM/SAM.Core/Interfaces/Reference/IReference.cs +++ b/SAM/SAM.Core/Interfaces/Reference/IReference.cs @@ -1,7 +1,10 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public interface IReference : IJSAMObject { bool IsValid(); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Interfaces/Relation/IRelationCluster.cs b/SAM/SAM.Core/Interfaces/Relation/IRelationCluster.cs index 1f0ba8230..ff13c80d6 100644 --- a/SAM/SAM.Core/Interfaces/Relation/IRelationCluster.cs +++ b/SAM/SAM.Core/Interfaces/Relation/IRelationCluster.cs @@ -1,9 +1,12 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Core { - public interface IRelationCluster: IJSAMObject + public interface IRelationCluster : IJSAMObject { public List GetTypes(); diff --git a/SAM/SAM.Core/Interfaces/Relation/ISAMObjectRelationCluster.cs b/SAM/SAM.Core/Interfaces/Relation/ISAMObjectRelationCluster.cs index ce0d630b6..1e60bfee6 100644 --- a/SAM/SAM.Core/Interfaces/Relation/ISAMObjectRelationCluster.cs +++ b/SAM/SAM.Core/Interfaces/Relation/ISAMObjectRelationCluster.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { diff --git a/SAM/SAM.Core/Manager/ActiveManager.cs b/SAM/SAM.Core/Manager/ActiveManager.cs index 527a647da..1d8f0ebe9 100644 --- a/SAM/SAM.Core/Manager/ActiveManager.cs +++ b/SAM/SAM.Core/Manager/ActiveManager.cs @@ -1,4 +1,7 @@ -using SAM.Core.Attributes; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core.Attributes; using System; using System.Collections.Generic; using System.Linq; @@ -186,7 +189,7 @@ public static TextMap GetSpecialCharacterMap(string name) if (paths == null || paths.Length == 0) return null; - foreach(string path in paths) + foreach (string path in paths) { if (path == null) continue; @@ -228,7 +231,7 @@ public static List GetSpecialCharacterMapNames() return null; List result = new List(); - foreach(string path in paths) + foreach (string path in paths) { if (path == null) continue; @@ -259,7 +262,7 @@ public static List GetParameterTypes(Type type) return null; List result = new List(); - foreach(KeyValuePair keyValuePair in associatedTypesDictionary) + foreach (KeyValuePair keyValuePair in associatedTypesDictionary) { if (keyValuePair.Key == null || keyValuePair.Value == null) continue; @@ -285,7 +288,7 @@ public static List GetParameterEnums(Type type, string name = null) { foreach (Enum @enum in Enum.GetValues(type_Temp)) { - if(name == null) + if (name == null) { result.Add(@enum); continue; @@ -317,4 +320,4 @@ public static List GetParameterEnums(ParameterizedSAMObject parameterizedS return GetParameterEnums(parameterizedSAMObject?.GetType(), name); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Manager/ActiveSetting.cs b/SAM/SAM.Core/Manager/ActiveSetting.cs index 7cb525f97..f0922b3df 100644 --- a/SAM/SAM.Core/Manager/ActiveSetting.cs +++ b/SAM/SAM.Core/Manager/ActiveSetting.cs @@ -1,4 +1,7 @@ -using System.Reflection; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Reflection; namespace SAM.Core { @@ -33,4 +36,4 @@ public static Setting GetDefault() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Manager/Manager.cs b/SAM/SAM.Core/Manager/Manager.cs index afce5a00a..e12da1764 100644 --- a/SAM/SAM.Core/Manager/Manager.cs +++ b/SAM/SAM.Core/Manager/Manager.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; @@ -330,4 +333,4 @@ private bool SetValue(Assembly assembly, string name, object value) Write(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Manager/Setting.cs b/SAM/SAM.Core/Manager/Setting.cs index b313e40d8..e964e532f 100644 --- a/SAM/SAM.Core/Manager/Setting.cs +++ b/SAM/SAM.Core/Manager/Setting.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Reflection; @@ -149,4 +152,4 @@ private bool Add(string name, object @object) return parameterSet.Add(name, @object as dynamic); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Modify/Add.cs b/SAM/SAM.Core/Modify/Add.cs index 69dcde7a7..8325612f7 100644 --- a/SAM/SAM.Core/Modify/Add.cs +++ b/SAM/SAM.Core/Modify/Add.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; namespace SAM.Core @@ -39,13 +42,13 @@ public static LogRecord Add(this Log log, string format, LogRecordType logRecord public static bool Add(this JObject jObject, Tag tag) { - if(jObject == null || tag == null) + if (jObject == null || tag == null) { return false; } JObject jObject_Tag = tag.ToJObject(); - if(jObject_Tag == null) + if (jObject_Tag == null) { return false; } @@ -55,4 +58,4 @@ public static bool Add(this JObject jObject, Tag tag) } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Modify/AddRange.cs b/SAM/SAM.Core/Modify/AddRange.cs index 81871781f..0035aaa46 100644 --- a/SAM/SAM.Core/Modify/AddRange.cs +++ b/SAM/SAM.Core/Modify/AddRange.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { @@ -12,4 +15,4 @@ public static List AddRange(this Log log, IEnumerable logR return log.AddRange(logRecords); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Modify/Copy.cs b/SAM/SAM.Core/Modify/Copy.cs index 72f1401d3..3e51ead77 100644 --- a/SAM/SAM.Core/Modify/Copy.cs +++ b/SAM/SAM.Core/Modify/Copy.cs @@ -1,17 +1,20 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Core { public static partial class Modify { - public static List Copy(this T object_Source, T object_Destination, params Enum[] enums) where T: SAMObject + public static List Copy(this T object_Source, T object_Destination, params Enum[] enums) where T : SAMObject { if (object_Source == null || object_Destination == null || enums == null) return null; List result = new List(); - foreach(Enum @enum in enums) + foreach (Enum @enum in enums) { if (!object_Source.TryGetValue(@enum, out object value)) continue; @@ -25,4 +28,4 @@ public static List Copy(this T object_Source, T object_Destination, par return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Modify/CopyParameterSets.cs b/SAM/SAM.Core/Modify/CopyParameterSets.cs index 950d8c29d..ef54a80c9 100644 --- a/SAM/SAM.Core/Modify/CopyParameterSets.cs +++ b/SAM/SAM.Core/Modify/CopyParameterSets.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { @@ -12,12 +15,12 @@ public static List CopyParameterSets(this SAMObject object_Source, } List result = object_Source.GetParameterSets(); - if(result == null || result.Count == 0) + if (result == null || result.Count == 0) { return result; } - for(int i=0; i < result.Count; i++) + for (int i = 0; i < result.Count; i++) { result[i] = result[i]?.Clone(); @@ -26,4 +29,4 @@ public static List CopyParameterSets(this SAMObject object_Source, return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Modify/CopyValues.cs b/SAM/SAM.Core/Modify/CopyValues.cs index 0addfa675..3dd091a4e 100644 --- a/SAM/SAM.Core/Modify/CopyValues.cs +++ b/SAM/SAM.Core/Modify/CopyValues.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Data; @@ -21,16 +24,16 @@ public static List CopyValues(this SAMObject sAMObject, DataRow dataRow return CopyValues(sAMObject, dataRow, dictionary); } - + public static List CopyValues(this SAMObject sAMObject, DataRow dataRow, Dictionary names) { - if(sAMObject == null || dataRow == null || names == null) + if (sAMObject == null || dataRow == null || names == null) { return null; } DataColumnCollection dataColumnCollection = dataRow.Table?.Columns; - if(dataColumnCollection == null || dataColumnCollection.Count == 0) + if (dataColumnCollection == null || dataColumnCollection.Count == 0) { return null; } @@ -38,20 +41,20 @@ public static List CopyValues(this SAMObject sAMObject, DataRow dataRow, D object[] values = dataRow.ItemArray; List result = new List(); - foreach(KeyValuePair keyValuePair in names) + foreach (KeyValuePair keyValuePair in names) { - if(string.IsNullOrEmpty(keyValuePair.Value)) + if (string.IsNullOrEmpty(keyValuePair.Value)) { continue; } - + int index = dataColumnCollection.IndexOf(keyValuePair.Value); - if(index == -1) + if (index == -1) { continue; } - if(!sAMObject.SetValue(keyValuePair.Key, values[index])) + if (!sAMObject.SetValue(keyValuePair.Key, values[index])) { continue; } @@ -62,4 +65,4 @@ public static List CopyValues(this SAMObject sAMObject, DataRow dataRow, D return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Modify/Delete.cs b/SAM/SAM.Core/Modify/Delete.cs index 7f368275f..e6bcb9443 100644 --- a/SAM/SAM.Core/Modify/Delete.cs +++ b/SAM/SAM.Core/Modify/Delete.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Core { @@ -27,4 +30,4 @@ public static bool Delete(string path, int maxDays_CreationTime) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Modify/DeleteObject.cs b/SAM/SAM.Core/Modify/DeleteObject.cs index 4ae0c391c..b6696365f 100644 --- a/SAM/SAM.Core/Modify/DeleteObject.cs +++ b/SAM/SAM.Core/Modify/DeleteObject.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Core { @@ -7,4 +10,4 @@ public static partial class Modify [System.Runtime.InteropServices.DllImport("gdi32.dll")] public static extern bool DeleteObject(IntPtr intPtr); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Modify/District.cs b/SAM/SAM.Core/Modify/District.cs index 39af38ab1..8ac378754 100644 --- a/SAM/SAM.Core/Modify/District.cs +++ b/SAM/SAM.Core/Modify/District.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { @@ -6,16 +9,16 @@ public static partial class Modify { public static void District(this List values, double tolerance = Tolerance.Distance) { - if(values == null) + if (values == null) { return; } List result = new List(); - foreach(double value in values) + foreach (double value in values) { int index = result.FindIndex(x => System.Math.Abs(x - value) < tolerance); - if(index != -1) + if (index != -1) { continue; } @@ -27,4 +30,4 @@ public static void District(this List values, double tolerance = Toleran values.AddRange(result); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Modify/Extend.cs b/SAM/SAM.Core/Modify/Extend.cs index b1e689947..1b1c6397d 100644 --- a/SAM/SAM.Core/Modify/Extend.cs +++ b/SAM/SAM.Core/Modify/Extend.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { @@ -34,4 +37,4 @@ public static bool Extend(this List list, int count) } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Modify/Log.cs b/SAM/SAM.Core/Modify/Log.cs index cfa6a4fd0..a99eef5fe 100644 --- a/SAM/SAM.Core/Modify/Log.cs +++ b/SAM/SAM.Core/Modify/Log.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Core { @@ -6,18 +9,18 @@ public static partial class Modify { public static bool Log(this string path, string format, params object[] values) { - if(format == null || string.IsNullOrWhiteSpace(path)) + if (format == null || string.IsNullOrWhiteSpace(path)) { return false; } string directory = System.IO.Path.GetDirectoryName(path); - if(string.IsNullOrWhiteSpace(directory)) + if (string.IsNullOrWhiteSpace(directory)) { return false; } - if(!Create.Directory(directory)) + if (!Create.Directory(directory)) { return false; } @@ -28,7 +31,7 @@ public static bool Log(this string path, string format, params object[] values) { logRecord.Write(path); } - catch(Exception ) + catch (Exception) { return false; } @@ -36,4 +39,4 @@ public static bool Log(this string path, string format, params object[] values) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Modify/MatchLength.cs b/SAM/SAM.Core/Modify/MatchLength.cs index e8b7569c4..7a8d61866 100644 --- a/SAM/SAM.Core/Modify/MatchLength.cs +++ b/SAM/SAM.Core/Modify/MatchLength.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { @@ -58,4 +61,4 @@ public static bool MatchLength(List list_1, List list_2) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Modify/ReleaseCOMObject.cs b/SAM/SAM.Core/Modify/ReleaseCOMObject.cs index 4955e460a..94c1860bf 100644 --- a/SAM/SAM.Core/Modify/ReleaseCOMObject.cs +++ b/SAM/SAM.Core/Modify/ReleaseCOMObject.cs @@ -1,4 +1,7 @@ -using System.Runtime.InteropServices; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Runtime.InteropServices; namespace SAM.Core { @@ -19,4 +22,4 @@ public static void ReleaseCOMObject(this object cOMObject) cOMObject = null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Modify/RemoveValue.cs b/SAM/SAM.Core/Modify/RemoveValue.cs index 73216591d..07932bf93 100644 --- a/SAM/SAM.Core/Modify/RemoveValue.cs +++ b/SAM/SAM.Core/Modify/RemoveValue.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Reflection; namespace SAM.Core @@ -21,7 +24,7 @@ public static bool RemoveValue(this ParameterizedSAMObject parameterizedSAMObjec return false; List parameterSets = parameterizedSAMObject.GetParameterSets(); - if(parameterSets != null) + if (parameterSets != null) { foreach (ParameterSet parameterSet_Temp in parameterSets) { @@ -35,4 +38,4 @@ public static bool RemoveValue(this ParameterizedSAMObject parameterizedSAMObjec return false; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Modify/Reorder.cs b/SAM/SAM.Core/Modify/Reorder.cs index 6e8883016..2eb3fb0d9 100644 --- a/SAM/SAM.Core/Modify/Reorder.cs +++ b/SAM/SAM.Core/Modify/Reorder.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Core @@ -40,4 +43,4 @@ public static bool Reorder(this List objects, int startIndex) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Modify/Replace.cs b/SAM/SAM.Core/Modify/Replace.cs index 9738224b0..0a978a68d 100644 --- a/SAM/SAM.Core/Modify/Replace.cs +++ b/SAM/SAM.Core/Modify/Replace.cs @@ -1,16 +1,19 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Modify { public static bool Replace(this T[] values, T value_Old, T value_New) { - if(values == null) + if (values == null) { return false; } bool result = false; - for(int i = 0; i < values.Length; i++) + for (int i = 0; i < values.Length; i++) { if ((values[i] != null && values[i].Equals(value_Old)) || (values[i] == null && value_Old == null)) { @@ -22,4 +25,4 @@ public static bool Replace(this T[] values, T value_Old, T value_New) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Modify/SetValue.cs b/SAM/SAM.Core/Modify/SetValue.cs index d31e14579..472c672a3 100644 --- a/SAM/SAM.Core/Modify/SetValue.cs +++ b/SAM/SAM.Core/Modify/SetValue.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Reflection; @@ -10,13 +13,13 @@ public static partial class Modify { public static bool SetValue(XAttribute xAttribute, T value) { - if(xAttribute == null) + if (xAttribute == null) { return false; } string @string = string.Empty; - if(value == null) + if (value == null) { xAttribute.SetValue(@string); } @@ -27,7 +30,7 @@ public static bool SetValue(XAttribute xAttribute, T value) public static bool SetValue(XElement xElement, string attributeName, T value) { - if(xElement == null || string.IsNullOrWhiteSpace(attributeName)) + if (xElement == null || string.IsNullOrWhiteSpace(attributeName)) { return false; } @@ -150,11 +153,11 @@ private static bool SetValue(this ParameterizedSAMObject parameterizedSAMObject, if (assembly == null) { List parameterSets = parameterizedSAMObject.GetParameterSets(); - if(parameterSets != null) + if (parameterSets != null) { - foreach(ParameterSet parameterSet_Temp in parameterSets) + foreach (ParameterSet parameterSet_Temp in parameterSets) { - if(parameterSet_Temp.Contains(name)) + if (parameterSet_Temp.Contains(name)) { parameterSet = parameterSet_Temp; break; @@ -165,7 +168,7 @@ private static bool SetValue(this ParameterizedSAMObject parameterizedSAMObject, if (parameterSet == null) { parameterSet = parameterizedSAMObject.GetParameterSet(parameterizedSAMObject.GetType().Assembly); - if(parameterSet == null) + if (parameterSet == null) { parameterSet = new ParameterSet(parameterizedSAMObject.GetType().Assembly); parameterizedSAMObject.Add(parameterSet); @@ -191,4 +194,4 @@ private static bool SetValue(this ParameterizedSAMObject parameterizedSAMObject, return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Modify/UpdateByType.cs b/SAM/SAM.Core/Modify/UpdateByType.cs index 35fe40c6e..5bb20319a 100644 --- a/SAM/SAM.Core/Modify/UpdateByType.cs +++ b/SAM/SAM.Core/Modify/UpdateByType.cs @@ -1,22 +1,25 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Modify { public static bool UpdateByType(this IRelationFilter relationFilter, System.Type type, IFilter filter) { - if(relationFilter == null || type == null) + if (relationFilter == null || type == null) { return false; } - if(type.IsAssignableFrom(relationFilter.GetType())) + if (type.IsAssignableFrom(relationFilter.GetType())) { relationFilter.Filter = filter; return true; } IFilter result = relationFilter.Filter; - if(result == null) + if (result == null) { return false; } @@ -24,4 +27,4 @@ public static bool UpdateByType(this IRelationFilter relationFilter, System.Type return UpdateByType(result as IRelationFilter, type, filter); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/AboutInfoTypeText.cs b/SAM/SAM.Core/Query/AboutInfoTypeText.cs index ed21e7e77..c9a490d50 100644 --- a/SAM/SAM.Core/Query/AboutInfoTypeText.cs +++ b/SAM/SAM.Core/Query/AboutInfoTypeText.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -19,4 +22,4 @@ public static string AboutInfoTypeText(this AboutInfoType aboutInfoType) return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/ActiveObject.cs b/SAM/SAM.Core/Query/ActiveObject.cs index 64eb7afc3..66b171da4 100644 --- a/SAM/SAM.Core/Query/ActiveObject.cs +++ b/SAM/SAM.Core/Query/ActiveObject.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; @@ -59,4 +62,4 @@ public static object ActiveObject(string progID) private static extern void GetActiveObject(ref Guid rclsid, IntPtr reserved, [MarshalAs(UnmanagedType.Interface)] out object ppunk); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/AlmostEqual.cs b/SAM/SAM.Core/Query/AlmostEqual.cs index 3474bb628..b4c794e8f 100644 --- a/SAM/SAM.Core/Query/AlmostEqual.cs +++ b/SAM/SAM.Core/Query/AlmostEqual.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Core { @@ -22,4 +25,4 @@ public static bool AlmostEqual(this double value_1, double value_2, double toler return Math.Abs(value_1 - value_2) <= tolerance; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Array.cs b/SAM/SAM.Core/Query/Array.cs index 886dde806..9de78fcfa 100644 --- a/SAM/SAM.Core/Query/Array.cs +++ b/SAM/SAM.Core/Query/Array.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; namespace SAM.Core @@ -31,13 +34,13 @@ public static partial class Query for (int j = 0; j < jArray_Temp.Count; j++) { object @object = jArray_Temp[j].Value(); - if(@object == null) + if (@object == null) { values_Temp_Temp[j] = default; continue; } - - if(!TryConvert(@object, out T t)) + + if (!TryConvert(@object, out T t)) { values_Temp_Temp[j] = default; continue; @@ -62,4 +65,4 @@ public static partial class Query } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/AssociatedTypesDictionary.cs b/SAM/SAM.Core/Query/AssociatedTypesDictionary.cs index 6989d077e..fbb98cb43 100644 --- a/SAM/SAM.Core/Query/AssociatedTypesDictionary.cs +++ b/SAM/SAM.Core/Query/AssociatedTypesDictionary.cs @@ -1,4 +1,7 @@ -using SAM.Core.Attributes; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core.Attributes; using System; using System.Collections.Generic; using System.Reflection; @@ -9,7 +12,7 @@ public static partial class Query { public static Dictionary AssociatedTypesDictionary(IEnumerable types = null, bool enumsOnly = true, bool notPublic = false) { - Dictionary result = new (); + Dictionary result = new(); foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) { if (assembly == null) @@ -55,7 +58,7 @@ public static Dictionary AssociatedTypesDictionary(IEnume continue; } - if(types != null) + if (types != null) { List types_Valid = associatedTypes.ValidTypes(types); if (types_Valid == null || types_Valid.Count == 0) @@ -71,4 +74,4 @@ public static Dictionary AssociatedTypesDictionary(IEnume return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/BaseFilter.cs b/SAM/SAM.Core/Query/BaseFilter.cs index bac510bbc..850ec5e47 100644 --- a/SAM/SAM.Core/Query/BaseFilter.cs +++ b/SAM/SAM.Core/Query/BaseFilter.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -13,4 +16,4 @@ public static IFilter BaseFilter(this IRelationFilter relationFilter) return BaseFilter(relationFilter_Temp); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/BoundedIndex.cs b/SAM/SAM.Core/Query/BoundedIndex.cs index daf97ac93..779aaec9f 100644 --- a/SAM/SAM.Core/Query/BoundedIndex.cs +++ b/SAM/SAM.Core/Query/BoundedIndex.cs @@ -1,29 +1,32 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { public static int BoundedIndex(this Range range, int index) { - if(range == null) + if (range == null) { return int.MinValue; } - if(range.In(index)) + if (range.In(index)) { return index; } int count = range.Count(); - if(index < range.Min) + if (index < range.Min) { int difference = range.Min - index - 1; int reminder = difference % count; return range.Max - reminder; } - if(index > range.Max) + if (index > range.Max) { int difference = index - range.Max - 1; int reminder = difference % count; @@ -43,7 +46,7 @@ public static int BoundedIndex(this int count, int index) { int max = count - 1; - if(max < 0) + if (max < 0) { return int.MinValue; } @@ -51,4 +54,4 @@ public static int BoundedIndex(this int count, int index) return BoundedIndex(new Range(0, max), index); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Brightness.cs b/SAM/SAM.Core/Query/Brightness.cs index 90760b418..e7a6601ad 100644 --- a/SAM/SAM.Core/Query/Brightness.cs +++ b/SAM/SAM.Core/Query/Brightness.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -32,4 +35,4 @@ public static System.Drawing.Color Brightness(this System.Drawing.Color color, d return System.Drawing.Color.FromArgb(color.A, (int)red, (int)green, (int)blue); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/COMObjectTypeName.cs b/SAM/SAM.Core/Query/COMObjectTypeName.cs index 1c908ebb0..97c95867e 100644 --- a/SAM/SAM.Core/Query/COMObjectTypeName.cs +++ b/SAM/SAM.Core/Query/COMObjectTypeName.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Runtime.InteropServices; namespace SAM.Core @@ -57,9 +60,9 @@ public static string COMObjectTypeName(this object cOMObject) } finally { - if (typeInfo != null) + if (typeInfo != null) Marshal.ReleaseComObject(typeInfo); } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Calculate.cs b/SAM/SAM.Core/Query/Calculate.cs index e5a217fcc..5cb8ca5e9 100644 --- a/SAM/SAM.Core/Query/Calculate.cs +++ b/SAM/SAM.Core/Query/Calculate.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -23,7 +26,7 @@ public static double Calculate(this ArithmeticOperator arithmeticOperator, doubl case ArithmeticOperator.Division: return value_1 / value_2; - + case ArithmeticOperator.Multiplication: return value_1 * value_2; @@ -55,7 +58,7 @@ public static double Calculate(this Func func, double value, dou double value_Min = Math.Min(value_Min_Temp, value_Max_Temp); double value_Max = Math.Max(value_Min_Temp, value_Max_Temp); - if(value < value_Min || value > value_Max) + if (value < value_Min || value > value_Max) { return double.NaN; } @@ -233,7 +236,7 @@ public static double Calculate_ByMaxStep(this Func func, double for (int i = 1; i <= maxCount; i++) { count = i; - + calculationValue = func.Invoke(result); if (double.IsNaN(calculationValue)) { @@ -278,7 +281,7 @@ public static double Calculate_ByMaxStep(this Func func, double public static double Calculate_ByDivision(this Func func, double value, double min, double max, int maxDivisions = 100, int maxCount = 100, double tolerance = Core.Tolerance.MacroDistance) { - if(func == null || double.IsNaN(min) || double.IsNaN(max)) + if (func == null || double.IsNaN(min) || double.IsNaN(max)) { return double.NaN; } @@ -286,7 +289,7 @@ public static double Calculate_ByDivision(this Func func, double if (AlmostEqual(min, max, tolerance)) { double value_Temp = func.Invoke((min + max) / 2); - if(AlmostEqual(value_Temp, value, tolerance)) + if (AlmostEqual(value_Temp, value, tolerance)) { return (min + max) / 2; } @@ -299,9 +302,9 @@ public static double Calculate_ByDivision(this Func func, double return null; } - if(count == 0) + if (count == 0) { - return new List {min_Temp, max_Temp }; + return new List { min_Temp, max_Temp }; } double value = (max_Temp - min_Temp) / count; @@ -316,16 +319,16 @@ public static double Calculate_ByDivision(this Func func, double }); - Func, double, Tuple> getMinAndMax = new((values, value) => - { - if(values == null || values.Count == 0) + Func, double, Tuple> getMinAndMax = new((values, value) => + { + if (values == null || values.Count == 0) { return null; } - if(values.Count == 1) + if (values.Count == 1) { - if(!AlmostEqual(values.First(), value, tolerance)) + if (!AlmostEqual(values.First(), value, tolerance)) { return null; } @@ -333,9 +336,9 @@ public static double Calculate_ByDivision(this Func func, double return new Tuple(values.First(), values.First()); } - if(values.First() > value) + if (values.First() > value) { - return new Tuple (double.NaN, values.First()); + return new Tuple(double.NaN, values.First()); } if (values.Last() < value) @@ -343,15 +346,15 @@ public static double Calculate_ByDivision(this Func func, double return new Tuple(values.Last(), double.NaN); } - for (int i =0; i < values.Count; i++) + for (int i = 0; i < values.Count; i++) { - if(values.ElementAt(i) > value) + if (values.ElementAt(i) > value) { return new Tuple(values.ElementAt(i - 1), values.ElementAt(i)); } } - return null; + return null; }); Dictionary dictionary = new Dictionary(); @@ -360,21 +363,21 @@ public static double Calculate_ByDivision(this Func func, double for (int i = 2; i <= maxDivisions; i++) { List values = divide.Invoke(min, max, i); - if(values == null || values.Count == 0) + if (values == null || values.Count == 0) { continue; } List> tuples = new List>(); - foreach(double value_Temp in values) + foreach (double value_Temp in values) { - if(!dictionary.TryGetValue(value_Temp, out double calculatedValue)) + if (!dictionary.TryGetValue(value_Temp, out double calculatedValue)) { calculatedValue = func.Invoke(value_Temp); dictionary[value_Temp] = calculatedValue; } - if(double.IsNaN(calculatedValue)) + if (double.IsNaN(calculatedValue)) { continue; } @@ -382,14 +385,14 @@ public static double Calculate_ByDivision(this Func func, double tuples.Add(new Tuple(value_Temp, calculatedValue)); } - if(tuples == null || tuples.Count == 0) + if (tuples == null || tuples.Count == 0) { continue; } SortedSet sortedSet = new SortedSet(tuples.ConvertAll(x => x.Item2)); Tuple tuple_Temp = getMinAndMax(sortedSet, value); - if(tuple_Temp == null) + if (tuple_Temp == null) { continue; } @@ -438,7 +441,7 @@ public static double Calculate_ByDivision(this Func func, double } } - if(tuple == null || maxCount == 0) + if (tuple == null || maxCount == 0) { return double.NaN; } @@ -446,4 +449,4 @@ public static double Calculate_ByDivision(this Func func, double return Calculate_ByDivision(func, value, tuple.Item1, tuple.Item2, maxDivisions, maxCount - 1, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/CamelCase.cs b/SAM/SAM.Core/Query/CamelCase.cs index b3c714395..e244d5b80 100644 --- a/SAM/SAM.Core/Query/CamelCase.cs +++ b/SAM/SAM.Core/Query/CamelCase.cs @@ -1,4 +1,7 @@ -using System.Globalization; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Globalization; namespace SAM.Core { @@ -12,4 +15,4 @@ public static string CamelCase(this string text) return new CultureInfo("en-US", false).TextInfo.ToTitleCase(text.ToLower()); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Categories.cs b/SAM/SAM.Core/Query/Categories.cs index 2e59bfa1f..b3a7a6cd4 100644 --- a/SAM/SAM.Core/Query/Categories.cs +++ b/SAM/SAM.Core/Query/Categories.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { @@ -6,7 +9,7 @@ public static partial class Query { public static List SubCategories(this Category category) { - if(category == null) + if (category == null) { return null; } @@ -14,13 +17,13 @@ public static List SubCategories(this Category category) List result = new List(); Category subCategory = category.SubCategory; - if(subCategory == null) + if (subCategory == null) { return result; } List subCategories = SubCategories(subCategory); - if(subCategories != null) + if (subCategories != null) { result.AddRange(subCategories); } @@ -31,4 +34,4 @@ public static List SubCategories(this Category category) } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Category.cs b/SAM/SAM.Core/Query/Category.cs index 8fb86d087..69c2ca7f1 100644 --- a/SAM/SAM.Core/Query/Category.cs +++ b/SAM/SAM.Core/Query/Category.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.ComponentModel; using System.Linq; using System.Reflection; @@ -19,4 +22,4 @@ public static string Category(this Enum @enum) return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Clamp.cs b/SAM/SAM.Core/Query/Clamp.cs index 2e4b71dfa..aae545373 100644 --- a/SAM/SAM.Core/Query/Clamp.cs +++ b/SAM/SAM.Core/Query/Clamp.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -26,7 +29,7 @@ public static T Clamp(this T value, T min, T max) public static Range Clamp(this Range range, T min, T max) { - if(range == null) + if (range == null) { return null; } @@ -34,4 +37,4 @@ public static Range Clamp(this Range range, T min, T max) return new Range(Clamp(range.Min, min, max), Clamp(range.Max, min, max)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Clone.cs b/SAM/SAM.Core/Query/Clone.cs index 8e810c50e..62b24f7e5 100644 --- a/SAM/SAM.Core/Query/Clone.cs +++ b/SAM/SAM.Core/Query/Clone.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; @@ -23,7 +26,7 @@ public static List Clone(this List parameterSets) return result; } - public static T Clone(this T jSAMObject) where T: IJSAMObject + public static T Clone(this T jSAMObject) where T : IJSAMObject { Type type = jSAMObject?.GetType(); if (type == null) @@ -32,20 +35,20 @@ public static T Clone(this T jSAMObject) where T: IJSAMObject } MethodInfo[] methodInfos = type.GetMethods(); - if(methodInfos != null && methodInfos.Length != 0) + if (methodInfos != null && methodInfos.Length != 0) { - foreach(MethodInfo methodInfo in methodInfos) + foreach (MethodInfo methodInfo in methodInfos) { if (!methodInfo.Name.Equals("Clone")) { continue; } - + if (!methodInfo.ReturnType.IsAssignableFrom(type)) { continue; } - + ParameterInfo[] parameterInfos = methodInfo.GetParameters(); if (parameterInfos == null || parameterInfos.Length == 0) { @@ -68,7 +71,7 @@ public static T Clone(this T jSAMObject) where T: IJSAMObject foreach (ConstructorInfo constructorInfo in constructorInfos) { ParameterInfo[] parameterInfos = constructorInfo.GetParameters(); - if(parameterInfos == null || parameterInfos.Length == 0) + if (parameterInfos == null || parameterInfos.Length == 0) { constructorInfo_Empty = constructorInfo; continue; @@ -90,7 +93,7 @@ public static T Clone(this T jSAMObject) where T: IJSAMObject continue; } - + constructorInfo_Type = constructorInfo; break; @@ -135,7 +138,7 @@ public static T[] Clone(this T[] array) } T[] result = new T[array.Length]; - + for (int i = 0; i < array.Length; i++) { result[i] = array[i]; @@ -144,4 +147,4 @@ public static T[] Clone(this T[] array) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Combine.cs b/SAM/SAM.Core/Query/Combine.cs index c9f3ea8a9..7f51e3181 100644 --- a/SAM/SAM.Core/Query/Combine.cs +++ b/SAM/SAM.Core/Query/Combine.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -32,7 +35,7 @@ public static double Combine(this IEnumerable values, CombineType combin return double.NaN; } - + public static List Combine(this IEnumerable values, int count, CombineType combineType, bool includeIncomplete = true) { if (values == null || combineType == CombineType.Undefined) @@ -65,23 +68,23 @@ public static List Combine(this IEnumerable values, int count, C public static List Combine(this IEnumerable values, Period period_Destination, CombineType combineType, Period period_Source = Core.Period.Hourly, bool includeIncomplete = true, int year = 2007) { - if(values == null || period_Destination == Core.Period.Undefined || combineType == CombineType.Undefined) + if (values == null || period_Destination == Core.Period.Undefined || combineType == CombineType.Undefined) { return null; } - if(period_Source == Core.Period.Undefined) + if (period_Source == Core.Period.Undefined) { period_Source = Period(values.Count()); } - if(period_Source == period_Destination) + if (period_Source == period_Destination) { return new List(values); } - if(period_Destination != Core.Period.Monthly) + if (period_Destination != Core.Period.Monthly) { int count = Count(period_Destination, period_Source); if (count == -1) @@ -92,14 +95,14 @@ public static List Combine(this IEnumerable values, Period perio return Combine(values, count, combineType, includeIncomplete); } - if(period_Source == Core.Period.Weekly) + if (period_Source == Core.Period.Weekly) { return null; } List result = new List(); - switch(period_Source) + switch (period_Source) { case Core.Period.Daily: for (int i = 1; i <= 12; i++) @@ -143,10 +146,10 @@ public static List Combine(this IEnumerable values, Period perio return null; } - + public static IndexedDoubles Combine(this IndexedDoubles indexedDoubles, Period period_Destination, CombineType combineType, Period period_Source = Core.Period.Hourly, bool includeIncomplete = true, int year = 2007) { - if(indexedDoubles == null) + if (indexedDoubles == null) { return null; } @@ -156,12 +159,12 @@ public static IndexedDoubles Combine(this IndexedDoubles indexedDoubles, Period period_Source = Period(indexedDoubles); } - if(period_Source == Core.Period.Undefined) + if (period_Source == Core.Period.Undefined) { return null; } - if(period_Destination == period_Source) + if (period_Destination == period_Source) { return new IndexedDoubles(indexedDoubles); } @@ -274,4 +277,4 @@ public static IndexedDoubles Combine(this IndexedDoubles indexedDoubles, Period } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/CommandMask.cs b/SAM/SAM.Core/Query/CommandMask.cs index f9c659702..91872e3a8 100644 --- a/SAM/SAM.Core/Query/CommandMask.cs +++ b/SAM/SAM.Core/Query/CommandMask.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Core @@ -56,7 +59,7 @@ public static bool[] CommandMask(this string text, bool includeComment = false) result[i] = !apostrophe && braketCount == 0; } - if(includeComment) + if (includeComment) { string @operator = Operator(CommandOperator.Comment); List indexes = text.IndexesOf(@operator); @@ -72,4 +75,4 @@ public static bool[] CommandMask(this string text, bool includeComment = false) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Compare.cs b/SAM/SAM.Core/Query/Compare.cs index 799c79fa3..ef1632363 100644 --- a/SAM/SAM.Core/Query/Compare.cs +++ b/SAM/SAM.Core/Query/Compare.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Core @@ -14,7 +17,7 @@ public static partial class Query /// Comparison Type Result public static bool Compare(this double value_1, double value_2, NumberComparisonType numberComparisonType) { - switch(numberComparisonType) + switch (numberComparisonType) { case NumberComparisonType.Equals: if (double.IsNaN(value_1) && double.IsNaN(value_2)) @@ -97,7 +100,7 @@ public static bool Compare(this string value_1, string value_2, TextComparisonTy { string value_1_Temp = value_1; string value_2_Temp = value_2; - if(!caseSensitive) + if (!caseSensitive) { if (!string.IsNullOrEmpty(value_1_Temp)) value_1_Temp = value_1_Temp.ToLower(); @@ -169,7 +172,7 @@ public static List Compare(this IEnumerable values, double value, return result; } - + public static bool Compare(this object @object, string name, double value, NumberComparisonType numberComparisonType) { if (string.IsNullOrEmpty(name) || @object == null) @@ -182,17 +185,17 @@ public static bool Compare(this object @object, string name, double value, Numbe if (value_Existing is double) return Compare((double)value_Existing, value, numberComparisonType); - if(IsNumeric(value_Existing)) + if (IsNumeric(value_Existing)) return Compare(System.Convert.ToDouble(value_Existing), value, numberComparisonType); - if(value_Existing is string) + if (value_Existing is string) { double value_Existing_Temp; - if(double.TryParse((string)value_Existing, out value_Existing_Temp)) + if (double.TryParse((string)value_Existing, out value_Existing_Temp)) return Compare(value_Existing_Temp, value, numberComparisonType); } - if(value_Existing is bool) + if (value_Existing is bool) { double value_Existing_Temp = 1; if (!(bool)value_Existing) @@ -213,16 +216,16 @@ public static bool Compare(this object @object, string name, string value, TextC if (!TryGetValue(@object, name, out value_Existing)) return false; - if(value == null) + if (value == null) { string value_Temp = null; return Compare(value_Temp, value, textComparisonType, caseSensitive); } - + if (value_Existing is string) return Compare((string)value_Existing, value, textComparisonType, caseSensitive); return Compare(value_Existing?.ToString(), value, textComparisonType, caseSensitive); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Compress.cs b/SAM/SAM.Core/Query/Compress.cs index 939939d51..bb0865484 100644 --- a/SAM/SAM.Core/Query/Compress.cs +++ b/SAM/SAM.Core/Query/Compress.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.IO; using System.IO.Compression; @@ -15,7 +18,7 @@ public static partial class Query /// Compressed string public static string Compress(this string @string) { - if(@string == null) + if (@string == null) { return null; } @@ -41,7 +44,7 @@ public static string Compress(this string @string) public static string Compress(this IJSAMObject jSAMObject) { string @string = jSAMObject?.ToJObject()?.ToString(); - if(string.IsNullOrEmpty(@string)) + if (string.IsNullOrEmpty(@string)) { return @string; } @@ -49,10 +52,10 @@ public static string Compress(this IJSAMObject jSAMObject) return Compress(@string); } - public static string Compress(this IEnumerable jSAMObjects) where T : IJSAMObject + public static string Compress(this IEnumerable jSAMObjects) where T : IJSAMObject { string json = Convert.ToString(jSAMObjects); - if(string.IsNullOrEmpty(json)) + if (string.IsNullOrEmpty(json)) { return json; } @@ -60,4 +63,4 @@ public static string Compress(this IEnumerable jSAMObjects) where T : IJSA return Compress(json); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/ComputeHash.cs b/SAM/SAM.Core/Query/ComputeHash.cs index 726321a9a..8ff8b3cf5 100644 --- a/SAM/SAM.Core/Query/ComputeHash.cs +++ b/SAM/SAM.Core/Query/ComputeHash.cs @@ -1,4 +1,7 @@ -using System.Text; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Text; namespace SAM.Core { @@ -25,4 +28,4 @@ public static string ComputeHash(string value) return stringBuilder.ToString(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Copy.cs b/SAM/SAM.Core/Query/Copy.cs index 5461ff16f..24a232957 100644 --- a/SAM/SAM.Core/Query/Copy.cs +++ b/SAM/SAM.Core/Query/Copy.cs @@ -1,6 +1,9 @@ -using System.IO; -using System.Diagnostics; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using System; +using System.Diagnostics; +using System.IO; namespace SAM.Core { @@ -15,7 +18,7 @@ public static partial class Query /// true if succeeded public static bool Copy(string pathSource, string pathDestination, bool overwrite = true) { - if(string.IsNullOrWhiteSpace(pathSource) || !File.Exists(pathSource) || string.IsNullOrWhiteSpace(pathDestination)) + if (string.IsNullOrWhiteSpace(pathSource) || !File.Exists(pathSource) || string.IsNullOrWhiteSpace(pathDestination)) return false; if (!overwrite && File.Exists(pathDestination)) @@ -40,7 +43,7 @@ public static bool Copy(string pathSource, string pathDestination, bool overwrit return true; } - catch(Exception ) + catch (Exception) { try { @@ -65,4 +68,4 @@ public static bool Copy(string pathSource, string pathDestination, bool overwrit } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Count.cs b/SAM/SAM.Core/Query/Count.cs index 67b39c321..cd29c031a 100644 --- a/SAM/SAM.Core/Query/Count.cs +++ b/SAM/SAM.Core/Query/Count.cs @@ -1,10 +1,13 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { public static int Count(this Range range) { - if(range == null) + if (range == null) { return -1; } @@ -54,4 +57,4 @@ public static int Count(Period period_Destination, Period period_Source = Core.P return -1; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/CountryCode.cs b/SAM/SAM.Core/Query/CountryCode.cs index e60913e2c..78fbad770 100644 --- a/SAM/SAM.Core/Query/CountryCode.cs +++ b/SAM/SAM.Core/Query/CountryCode.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -26,4 +29,4 @@ public static CountryCode CountryCode(this string text) return Core.CountryCode.Undefined; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/CurrentVersion.cs b/SAM/SAM.Core/Query/CurrentVersion.cs index 0859fd3d7..3b84b3858 100644 --- a/SAM/SAM.Core/Query/CurrentVersion.cs +++ b/SAM/SAM.Core/Query/CurrentVersion.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -25,4 +28,4 @@ public static string CurrentVersion() return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/CustomAttribute.cs b/SAM/SAM.Core/Query/CustomAttribute.cs index 291088bfc..f98061e4a 100644 --- a/SAM/SAM.Core/Query/CustomAttribute.cs +++ b/SAM/SAM.Core/Query/CustomAttribute.cs @@ -1,11 +1,14 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Reflection; namespace SAM.Core { public static partial class Query { - public static T CustomAttribute(Enum @enum) where T: Attribute + public static T CustomAttribute(Enum @enum) where T : Attribute { if (@enum == null) return default; @@ -33,7 +36,7 @@ public static T CustomAttribute(this MemberInfo memberInfo) where T : Attribu { if (memberInfo == null) return default; - + Attribute[] attributes = Attribute.GetCustomAttributes(memberInfo); if (attributes == null || attributes.Length == 0) return default; @@ -47,4 +50,4 @@ public static T CustomAttribute(this MemberInfo memberInfo) where T : Attribu return default; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/DayOfYear.cs b/SAM/SAM.Core/Query/DayOfYear.cs index 7b01865f8..7eb79c0ee 100644 --- a/SAM/SAM.Core/Query/DayOfYear.cs +++ b/SAM/SAM.Core/Query/DayOfYear.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Core { @@ -9,4 +12,4 @@ public static int DayOfYear(int hourOfYear) return System.Convert.ToInt32(Math.Truncate(System.Convert.ToDouble(hourOfYear) / 24.0)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Decompress.cs b/SAM/SAM.Core/Query/Decompress.cs index 72332023e..c948f50fb 100644 --- a/SAM/SAM.Core/Query/Decompress.cs +++ b/SAM/SAM.Core/Query/Decompress.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.IO; using System.IO.Compression; @@ -15,7 +18,7 @@ public static partial class Query /// Decompressed string public static string Decompress(this string @string) { - if(@string == null) + if (@string == null) { return null; } @@ -40,7 +43,7 @@ public static string Decompress(this string @string) public static List Decompress(this string @string) where T : IJSAMObject { - if(string.IsNullOrWhiteSpace(@string)) + if (string.IsNullOrWhiteSpace(@string)) { return null; } @@ -54,4 +57,4 @@ public static List Decompress(this string @string) where T : IJSAMObject return Convert.ToSAM(string_Decompress); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/DefaultAddress.cs b/SAM/SAM.Core/Query/DefaultAddress.cs index 81a160c84..5b29f9f8e 100644 --- a/SAM/SAM.Core/Query/DefaultAddress.cs +++ b/SAM/SAM.Core/Query/DefaultAddress.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -7,4 +10,4 @@ public static Address DefaultAddress() return new Address(string.Empty, "London", string.Empty, Core.CountryCode.GB); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/DefaultLocation.cs b/SAM/SAM.Core/Query/DefaultLocation.cs index 174bc2b86..58ff8d32c 100644 --- a/SAM/SAM.Core/Query/DefaultLocation.cs +++ b/SAM/SAM.Core/Query/DefaultLocation.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -7,4 +10,4 @@ public static Location DefaultLocation() return new Location("United Kingdom, London", -0.45, 51.48, 25); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Description.cs b/SAM/SAM.Core/Query/Description.cs index 4d321c69a..13cb69e5f 100644 --- a/SAM/SAM.Core/Query/Description.cs +++ b/SAM/SAM.Core/Query/Description.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.ComponentModel; using System.Linq; using System.Reflection; @@ -19,4 +22,4 @@ public static string Description(this Enum @enum) return @enum.ToString(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Descriptions.cs b/SAM/SAM.Core/Query/Descriptions.cs index d5cdb8111..eaceb5833 100644 --- a/SAM/SAM.Core/Query/Descriptions.cs +++ b/SAM/SAM.Core/Query/Descriptions.cs @@ -1,14 +1,17 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Core { public static partial class Query { - public static List Descriptions(params T[] excluded) where T: Enum + public static List Descriptions(params T[] excluded) where T : Enum { List enums = Enums(excluded); - if(enums == null) + if (enums == null) { return null; } @@ -22,4 +25,4 @@ public static List Descriptions(params T[] excluded) where T: Enum return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Dictionary.cs b/SAM/SAM.Core/Query/Dictionary.cs index 21e3b0531..bddad0289 100644 --- a/SAM/SAM.Core/Query/Dictionary.cs +++ b/SAM/SAM.Core/Query/Dictionary.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { @@ -32,4 +35,4 @@ public static Dictionary> Dictionary(this IEnumerable object return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Double.cs b/SAM/SAM.Core/Query/Double.cs index b402e0912..9a9a336ee 100644 --- a/SAM/SAM.Core/Query/Double.cs +++ b/SAM/SAM.Core/Query/Double.cs @@ -1,18 +1,21 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { public static double Double(this UTC uTC) { - if(uTC == Core.UTC.Undefined) + if (uTC == Core.UTC.Undefined) { return double.NaN; } - switch(uTC) + switch (uTC) { case Core.UTC.Minus1200: - return - 12.0; + return -12.0; case Core.UTC.Minus1100: return -11.0; @@ -126,4 +129,4 @@ public static double Double(this UTC uTC) return double.NaN; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Enum.cs b/SAM/SAM.Core/Query/Enum.cs index 9883b3473..dbb1f0a57 100644 --- a/SAM/SAM.Core/Query/Enum.cs +++ b/SAM/SAM.Core/Query/Enum.cs @@ -1,17 +1,20 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Core { public static partial class Query { - public static T Enum(this string text) where T: Enum + public static T Enum(this string text) where T : Enum { if (string.IsNullOrWhiteSpace(text)) return Enum("Undefined"); Array array = System.Enum.GetValues(typeof(T)); - if(array == null || array.Length == 0) + if (array == null || array.Length == 0) return Enum("Undefined"); foreach (T @enum in array) @@ -30,7 +33,7 @@ public static T Enum(this string text) where T: Enum } text_Temp = text.ToUpper().Replace(" ", string.Empty); - for (int i =0; i < array.Length; i++) + for (int i = 0; i < array.Length; i++) { if (texts[i].ToUpper().Replace(" ", string.Empty).Equals(text_Temp)) return (T)array.GetValue(i); @@ -62,4 +65,4 @@ public static T Enum(this string text) where T: Enum return (T)System.Enum.ToObject(typeof(T), index); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Enums.cs b/SAM/SAM.Core/Query/Enums.cs index ebab59175..eaba5f0dd 100644 --- a/SAM/SAM.Core/Query/Enums.cs +++ b/SAM/SAM.Core/Query/Enums.cs @@ -1,4 +1,7 @@ -using SAM.Core.Attributes; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core.Attributes; using System; using System.Collections.Generic; using System.Linq; @@ -10,21 +13,21 @@ public static partial class Query public static List Enums(SAMObject sAMObject, bool notPublic = false) { Type type = sAMObject?.GetType(); - if(type == null) + if (type == null) { return null; } List enums = Enums(type, notPublic); - if(enums == null || enums.Count == 0) + if (enums == null || enums.Count == 0) { return null; } - List result = new (); + List result = new(); foreach (Enum @enum in enums) { - if(sAMObject.HasParameter(@enum)) + if (sAMObject.HasParameter(@enum)) { result.Add(@enum); } @@ -42,7 +45,7 @@ public static List Enums(Type type, string value, bool notPublic = false) if (dictionary == null) return null; - List result = new (); + List result = new(); foreach (KeyValuePair keyValuePair in dictionary) { if (!keyValuePair.Value.IsValid(type)) @@ -81,7 +84,7 @@ public static List Enums(Type type, bool notPublic = false) if (dictionary == null) return null; - List result = new (); + List result = new(); foreach (KeyValuePair keyValuePair in dictionary) { if (!keyValuePair.Value.IsValid(type)) @@ -105,13 +108,13 @@ public static List Enums(params Type[] types) if (types == null) return null; - List result = new (); - foreach(Type type in types) + List result = new(); + foreach (Type type in types) { - if (type == null ) + if (type == null) continue; - if(type.IsEnum) + if (type.IsEnum) { foreach (Enum @enum in System.Enum.GetValues(type)) { @@ -121,7 +124,7 @@ public static List Enums(params Type[] types) else { List enums = Enums(type, false); - if(enums != null) + if (enums != null) { result.AddRange(enums); } @@ -142,7 +145,7 @@ public static List Enums(params T[] excluded) where T : Enum { T value = (T)array.GetValue(i); - if(excluded != null && excluded.Contains(value)) + if (excluded != null && excluded.Contains(value)) { continue; } @@ -153,4 +156,4 @@ public static List Enums(params T[] excluded) where T : Enum return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Equals.cs b/SAM/SAM.Core/Query/Equals.cs index 2754093aa..464dbe181 100644 --- a/SAM/SAM.Core/Query/Equals.cs +++ b/SAM/SAM.Core/Query/Equals.cs @@ -1,4 +1,7 @@ -using System.Drawing; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Drawing; namespace SAM.Core { @@ -9,4 +12,4 @@ public static bool Equals(this Color value_1, Color value_2) return value_1.R == value_2.R && value_1.G == value_2.G && value_1.B == value_2.B && value_1.A == value_2.A; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Error/MeanAbsoluteError.cs b/SAM/SAM.Core/Query/Error/MeanAbsoluteError.cs index e41c664b2..d05bf4a2a 100644 --- a/SAM/SAM.Core/Query/Error/MeanAbsoluteError.cs +++ b/SAM/SAM.Core/Query/Error/MeanAbsoluteError.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { @@ -22,4 +25,4 @@ public static double MeanAbsoluteError(this List m, List r) return sum / count; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Error/MeanAbsolutePercentageError.cs b/SAM/SAM.Core/Query/Error/MeanAbsolutePercentageError.cs index 300eda7a1..60e244f8b 100644 --- a/SAM/SAM.Core/Query/Error/MeanAbsolutePercentageError.cs +++ b/SAM/SAM.Core/Query/Error/MeanAbsolutePercentageError.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Core @@ -32,4 +35,4 @@ public static double MeanAbsolutePercentageError(this List m, List 0 ? (100.0 * sum / count_Temp) : double.NaN; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Error/MeanDifferenceError.cs b/SAM/SAM.Core/Query/Error/MeanDifferenceError.cs index 8e0223bd2..60cdc761a 100644 --- a/SAM/SAM.Core/Query/Error/MeanDifferenceError.cs +++ b/SAM/SAM.Core/Query/Error/MeanDifferenceError.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -26,7 +29,7 @@ public static double MeanDifferenceError(this List m, List r, ou double mean = differences.Average(); double sum = 0; - foreach(double difference in differences) + foreach (double difference in differences) { sum += Math.Pow(difference - mean, 2); } @@ -39,4 +42,4 @@ public static double MeanDifferenceError(this List m, List r, ou return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Error/MeanError.cs b/SAM/SAM.Core/Query/Error/MeanError.cs index 7866b6316..ea43cece4 100644 --- a/SAM/SAM.Core/Query/Error/MeanError.cs +++ b/SAM/SAM.Core/Query/Error/MeanError.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { @@ -6,7 +9,7 @@ public static partial class Query { public static double MeanError(this List m, List r) { - if(m == null || r is null || m.Count != r.Count) + if (m == null || r is null || m.Count != r.Count) { return double.NaN; } @@ -22,4 +25,4 @@ public static double MeanError(this List m, List r) return sum / count; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Error/NormalizedRootMeanSquaredError.cs b/SAM/SAM.Core/Query/Error/NormalizedRootMeanSquaredError.cs index 7f838ea06..5f7bf20a9 100644 --- a/SAM/SAM.Core/Query/Error/NormalizedRootMeanSquaredError.cs +++ b/SAM/SAM.Core/Query/Error/NormalizedRootMeanSquaredError.cs @@ -1,4 +1,6 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using System.Collections.Generic; using System.Linq; @@ -9,14 +11,14 @@ public static partial class Query public static double NormalizedRootMeanSquaredError(this List m, List r, double tolerance = SAM.Core.Tolerance.Distance) { double rootMeanSquaredError = RootMeanSquaredError(m, r); - if(double.IsNaN(rootMeanSquaredError)) + if (double.IsNaN(rootMeanSquaredError)) { return rootMeanSquaredError; } double range = r.Max() - r.Min(); - if(range < tolerance) + if (range < tolerance) { return double.NaN; } @@ -25,4 +27,4 @@ public static double NormalizedRootMeanSquaredError(this List m, List m, List r) return Math.Sqrt(sum / count); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Error/SymmetricMeanAbsolutePercentageError.cs b/SAM/SAM.Core/Query/Error/SymmetricMeanAbsolutePercentageError.cs index e977e52ef..968f2720a 100644 --- a/SAM/SAM.Core/Query/Error/SymmetricMeanAbsolutePercentageError.cs +++ b/SAM/SAM.Core/Query/Error/SymmetricMeanAbsolutePercentageError.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Core @@ -32,4 +35,4 @@ public static double SymmetricMeanAbsolutePercentageError(this List m, L return count_Temp > 0 ? (100.0 * sum / count_Temp) : double.NaN; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/ExecutingAssemblyDirectory.cs b/SAM/SAM.Core/Query/ExecutingAssemblyDirectory.cs index 836a39ee9..349e4a7e1 100644 --- a/SAM/SAM.Core/Query/ExecutingAssemblyDirectory.cs +++ b/SAM/SAM.Core/Query/ExecutingAssemblyDirectory.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Reflection; namespace SAM.Core @@ -12,7 +15,7 @@ public static string ExecutingAssemblyDirectory() return null; UriBuilder uriBuilder = new UriBuilder(codeBase); - + string path = uriBuilder.Path; if (string.IsNullOrEmpty(path)) return null; @@ -22,4 +25,4 @@ public static string ExecutingAssemblyDirectory() return System.IO.Path.GetDirectoryName(path); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/FileExists.cs b/SAM/SAM.Core/Query/FileExists.cs index b53387d8d..afd2becd0 100644 --- a/SAM/SAM.Core/Query/FileExists.cs +++ b/SAM/SAM.Core/Query/FileExists.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.IO; namespace SAM.Core @@ -21,4 +24,4 @@ public static bool FileExists(this string filePath) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Filter.cs b/SAM/SAM.Core/Query/Filter.cs index 036f09b73..1fd2e7df1 100644 --- a/SAM/SAM.Core/Query/Filter.cs +++ b/SAM/SAM.Core/Query/Filter.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -11,9 +14,9 @@ public static Log Filter(this Log log, IEnumerable logRecordTypes if (log == null || logRecordTypes == null) return null; - Log result = new (log.Name); + Log result = new(log.Name); - if(sort) + if (sort) { foreach (LogRecordType logRecordType in logRecordTypes) { @@ -60,7 +63,7 @@ public static void Filter(this IEnumerable ts, out List @in, out List Filter(this RelationCluster relationCluster_In, Rela if (relationCluster_Out == null) relationCluster_Out = new RelationCluster(); - HashSet objects_Out = new (); + HashSet objects_Out = new(); Filter(relationCluster_In, relationCluster_Out, objects, objects_Out); @@ -112,7 +115,7 @@ public static List Filter(this IEnumerable jSAMObjects, IFilt return null; } - List result = new (); + List result = new(); foreach (IJSAMObject jSAMObject in jSAMObjects) { if (!(jSAMObject is T)) @@ -136,7 +139,7 @@ public static void Filter(this IEnumerable jSAMObjects, IFilter fil @in = null; @out = null; - if(jSAMObjects == null || filter == null) + if (jSAMObjects == null || filter == null) { return; } @@ -157,19 +160,19 @@ private static void Filter(this RelationCluster relationCluster_In, Relati if (objects_In == null || relationCluster_In == null || relationCluster_Out == null || objects_Out == null) return; - HashSet objects_In_New = new (); + HashSet objects_In_New = new(); foreach (T object_In in objects_In) { if (objects_Out.Contains(object_In)) continue; relationCluster_Out.AddObject(object_In); - + List relatedObjects = relationCluster_In.GetRelatedObjects(object_In); if (relatedObjects == null || relatedObjects.Count == 0) continue; - foreach(T relatedObject in relatedObjects) + foreach (T relatedObject in relatedObjects) { if (objects_Out.Contains(relatedObject)) continue; @@ -189,4 +192,4 @@ private static void Filter(this RelationCluster relationCluster_In, Relati } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/FindByType.cs b/SAM/SAM.Core/Query/FindByType.cs index c6e87738b..ca53b6a73 100644 --- a/SAM/SAM.Core/Query/FindByType.cs +++ b/SAM/SAM.Core/Query/FindByType.cs @@ -1,26 +1,29 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { public static IFilter FindByType(this IRelationFilter relationFilter, System.Type type) { - if(relationFilter == null || type == null) + if (relationFilter == null || type == null) { return null; } - if(type.IsAssignableFrom(relationFilter.GetType())) + if (type.IsAssignableFrom(relationFilter.GetType())) { return relationFilter; } IFilter result = relationFilter.Filter; - if(result == null) + if (result == null) { return null; } - if(type.IsAssignableFrom(result.GetType())) + if (type.IsAssignableFrom(result.GetType())) { return result; } @@ -28,4 +31,4 @@ public static IFilter FindByType(this IRelationFilter relationFilter, System.Typ return FindByType(result as IRelationFilter, type); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/FindIndexs.cs b/SAM/SAM.Core/Query/FindIndexs.cs index 05b5c2090..f8cccbe11 100644 --- a/SAM/SAM.Core/Query/FindIndexs.cs +++ b/SAM/SAM.Core/Query/FindIndexs.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Data; using System.Linq; @@ -8,25 +11,25 @@ public static partial class Query { public static List FindIndexes(this DataTable dataTable, string columnName, IEnumerable values) { - if(dataTable == null || columnName == null) + if (dataTable == null || columnName == null) { return null; } DataColumnCollection dataColumnCollection = dataTable.Columns; - if(dataColumnCollection == null || dataColumnCollection.Count == 0) + if (dataColumnCollection == null || dataColumnCollection.Count == 0) { return null; } int index = dataTable.Columns.IndexOf(columnName); - if(index == -1) + if (index == -1) { return null; } DataRowCollection dataRowCollection = dataTable.Rows; - if(dataRowCollection == null || dataRowCollection.Count == 0) + if (dataRowCollection == null || dataRowCollection.Count == 0) { return null; } @@ -34,14 +37,14 @@ public static List FindIndexes(this DataTable dataTable, string columnNa int count = values.Count(); List result = Enumerable.Repeat(-1, count).ToList(); - for(int i =0; i < dataColumnCollection.Count; i++) + for (int i = 0; i < dataColumnCollection.Count; i++) { if (!TryConvert(dataRowCollection[i][index], out T value)) { continue; } - for(int j = 0; j < count; j++) + for (int j = 0; j < count; j++) { T value_Temp = values.ElementAt(j); @@ -54,7 +57,7 @@ public static List FindIndexes(this DataTable dataTable, string columnNa } else { - if(value.Equals(value_Temp)) + if (value.Equals(value_Temp)) { result[j] = i; } @@ -117,4 +120,4 @@ public static List FindIndexes(this DataTable dataTable, string columnNa return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/FullName.cs b/SAM/SAM.Core/Query/FullName.cs index 6f757ddd1..e5cb35bce 100644 --- a/SAM/SAM.Core/Query/FullName.cs +++ b/SAM/SAM.Core/Query/FullName.cs @@ -1,4 +1,7 @@ -using System.Runtime.InteropServices; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Runtime.InteropServices; namespace SAM.Core { @@ -15,4 +18,4 @@ public static string FullName(object @object) return @object.GetType().FullName; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/FullTypeName.cs b/SAM/SAM.Core/Query/FullTypeName.cs index 9eb53ca85..92c2835c8 100644 --- a/SAM/SAM.Core/Query/FullTypeName.cs +++ b/SAM/SAM.Core/Query/FullTypeName.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -19,13 +22,13 @@ public static string FullTypeName(Type type) if (type == null) return null; - if(type.IsPrimitive) + if (type.IsPrimitive) return type.FullName; - if(type.IsGenericType) + if (type.IsGenericType) { Type[] types_Generic = type.GetGenericArguments(); - if(types_Generic != null && types_Generic.Length != 0) + if (types_Generic != null && types_Generic.Length != 0) { List typeNames = new List(); foreach (Type type_Generic in types_Generic) @@ -46,4 +49,4 @@ public static string FullTypeName(IJSAMObject jSAMObject) return FullTypeName(jSAMObject.GetType()); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/GetMethodInfo.cs b/SAM/SAM.Core/Query/GetMethodInfo.cs index aa06df11d..86d643fc1 100644 --- a/SAM/SAM.Core/Query/GetMethodInfo.cs +++ b/SAM/SAM.Core/Query/GetMethodInfo.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Reflection; namespace SAM.Core @@ -12,29 +15,29 @@ public static MethodInfo GetMethodInfo(this PropertyInfo propertyInfo) return null; } - if(propertyInfo.GetMethod != null) + if (propertyInfo.GetMethod != null) { return propertyInfo.GetMethod; } Type type = propertyInfo.ReflectedType?.BaseType; - if(type == null) + if (type == null) { return null; } PropertyInfo[] propertyInfos = type.GetProperties(); - if(propertyInfos == null || propertyInfos.Length == 0) + if (propertyInfos == null || propertyInfos.Length == 0) { return null; } - + foreach (PropertyInfo propertyInfo_Temp in propertyInfos) { - if(propertyInfo_Temp?.Name == propertyInfo.Name) + if (propertyInfo_Temp?.Name == propertyInfo.Name) { MethodInfo result = GetMethodInfo(propertyInfo_Temp); - if(result != null) + if (result != null) { return result; } @@ -44,4 +47,4 @@ public static MethodInfo GetMethodInfo(this PropertyInfo propertyInfo) return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Graft.cs b/SAM/SAM.Core/Query/Graft.cs index 1a1d3f59e..b3d479294 100644 --- a/SAM/SAM.Core/Query/Graft.cs +++ b/SAM/SAM.Core/Query/Graft.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { @@ -6,13 +9,13 @@ public static partial class Query { public static List> Graft(this IEnumerable values, int count) { - if(values == null || count <= 0) + if (values == null || count <= 0) { return null; } List> result = new List>(); - foreach(T value in values) + foreach (T value in values) { List list = new List(); for (int i = 0; i < count; i++) @@ -25,4 +28,4 @@ public static List> Graft(this IEnumerable values, int count) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Guid.cs b/SAM/SAM.Core/Query/Guid.cs index 3d9678cd8..9eb31f56c 100644 --- a/SAM/SAM.Core/Query/Guid.cs +++ b/SAM/SAM.Core/Query/Guid.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Linq; using System.Reflection; @@ -32,7 +35,7 @@ public static Guid Guid(this JToken jToken) { if (jToken == null) return System.Guid.Empty; - + switch (jToken.Type) { case JTokenType.String: @@ -66,4 +69,4 @@ public static Guid Guid(this Assembly assembly) return guid; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/HashCode.cs b/SAM/SAM.Core/Query/HashCode.cs index e837b8451..0d04483f1 100644 --- a/SAM/SAM.Core/Query/HashCode.cs +++ b/SAM/SAM.Core/Query/HashCode.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -18,4 +21,4 @@ public static int HashCode(params int[] values) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/HourOfDay.cs b/SAM/SAM.Core/Query/HourOfDay.cs index 69a79e3c6..6e026e4d9 100644 --- a/SAM/SAM.Core/Query/HourOfDay.cs +++ b/SAM/SAM.Core/Query/HourOfDay.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -7,4 +10,4 @@ public static int HourOfDay(int hourOfYear) return hourOfYear % 24; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/HourOfYear.cs b/SAM/SAM.Core/Query/HourOfYear.cs index 241b17ee4..19a6a5e38 100644 --- a/SAM/SAM.Core/Query/HourOfYear.cs +++ b/SAM/SAM.Core/Query/HourOfYear.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Core { @@ -14,4 +17,4 @@ public static int HourOfYear(int dayOfYear, int hourOfDay = 0) return (dayOfYear * 24) + hourOfDay; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/HoursOfYear.cs b/SAM/SAM.Core/Query/HoursOfYear.cs index bdc31b5f2..0f5563a67 100644 --- a/SAM/SAM.Core/Query/HoursOfYear.cs +++ b/SAM/SAM.Core/Query/HoursOfYear.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { @@ -8,7 +11,7 @@ public static HashSet HoursOfYear(int dayOfYear) { HashSet result = new HashSet(); - for(int i=0; i < 24; i++) + for (int i = 0; i < 24; i++) { result.Add(HourOfYear(dayOfYear, i)); } @@ -18,21 +21,21 @@ public static HashSet HoursOfYear(int dayOfYear) public static HashSet HoursOfYear(IEnumerable daysOfYear) { - if(daysOfYear == null) + if (daysOfYear == null) { return null; } HashSet result = new HashSet(); - foreach(int dayOfYear in daysOfYear) + foreach (int dayOfYear in daysOfYear) { HashSet hoursOfYear = HoursOfYear(dayOfYear); - if(hoursOfYear == null) + if (hoursOfYear == null) { continue; } - foreach(int hourOfYear in hoursOfYear) + foreach (int hourOfYear in hoursOfYear) { result.Add(hourOfYear); } @@ -41,4 +44,4 @@ public static HashSet HoursOfYear(IEnumerable daysOfYear) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/IndexOf.cs b/SAM/SAM.Core/Query/IndexOf.cs index 87eb3b0be..c8d4a94f7 100644 --- a/SAM/SAM.Core/Query/IndexOf.cs +++ b/SAM/SAM.Core/Query/IndexOf.cs @@ -1,4 +1,7 @@ -using System.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Linq; namespace SAM.Core { @@ -32,4 +35,4 @@ public static int IndexOf(this string value, string text, int startIndex = 0, bo return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Indexes.cs b/SAM/SAM.Core/Query/Indexes.cs index f9afb35f2..becc883bc 100644 --- a/SAM/SAM.Core/Query/Indexes.cs +++ b/SAM/SAM.Core/Query/Indexes.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { @@ -6,7 +9,7 @@ public static partial class Query { public static List Indexes(this DelimitedFileTable delimitedFileTable, IEnumerable sAMObjects, int columnIndex, string parameterName) { - if (delimitedFileTable == null || sAMObjects == null || columnIndex == -1 || parameterName == null) + if (delimitedFileTable == null || sAMObjects == null || columnIndex == -1 || parameterName == null) return null; object[] columnValues = delimitedFileTable.GetColumnValues(columnIndex); @@ -14,9 +17,9 @@ public static List Indexes(this DelimitedFileTable delimitedFileTable, IEnu return null; List result = new List(); - foreach(SAMObject sAMObject in sAMObjects) + foreach (SAMObject sAMObject in sAMObjects) { - if(!sAMObject.TryGetValue(parameterName, out object value_1)) + if (!sAMObject.TryGetValue(parameterName, out object value_1)) { result.Add(-1); continue; @@ -24,11 +27,11 @@ public static List Indexes(this DelimitedFileTable delimitedFileTable, IEnu System.Type type = value_1?.GetType(); - for (int i =0; i < columnValues.Length; i++) + for (int i = 0; i < columnValues.Length; i++) { object value_Temp = columnValues[i]; - if(value_1 == null && value_Temp == null) + if (value_1 == null && value_Temp == null) { result.Add(i); break; @@ -48,4 +51,4 @@ public static List Indexes(this DelimitedFileTable delimitedFileTable, IEnu return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/IndexesOf.cs b/SAM/SAM.Core/Query/IndexesOf.cs index 37b109791..e03779c5a 100644 --- a/SAM/SAM.Core/Query/IndexesOf.cs +++ b/SAM/SAM.Core/Query/IndexesOf.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { @@ -10,7 +13,7 @@ public static List IndexesOf(this List values, T value) return null; List result = new List(); - for(int i=0; i < values.Count; i++) + for (int i = 0; i < values.Count; i++) if ((value == null && values[i] == null) || values[i].Equals(value)) result.Add(i); @@ -36,15 +39,15 @@ public static List IndexesOf(this string text, string value) { result.Add(index); index++; - + if (index == count) index = -1; } - + } while (index != -1); return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/IsHex.cs b/SAM/SAM.Core/Query/IsHex.cs index c72d9bda9..19b82b82b 100644 --- a/SAM/SAM.Core/Query/IsHex.cs +++ b/SAM/SAM.Core/Query/IsHex.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -10,4 +13,4 @@ public static bool IsHex(this string @string) return System.Text.RegularExpressions.Regex.IsMatch(@string, @"\A\b[0-9a-fA-F]+\b\Z"); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/IsNullable.cs b/SAM/SAM.Core/Query/IsNullable.cs index b41292c9c..9a71e5392 100644 --- a/SAM/SAM.Core/Query/IsNullable.cs +++ b/SAM/SAM.Core/Query/IsNullable.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Core { @@ -12,4 +15,4 @@ public static bool IsNullable(this Type type) return Nullable.GetUnderlyingType(type) != null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/IsNumeric.cs b/SAM/SAM.Core/Query/IsNumeric.cs index f1d5c4342..7b8b4146e 100644 --- a/SAM/SAM.Core/Query/IsNumeric.cs +++ b/SAM/SAM.Core/Query/IsNumeric.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Core { @@ -42,4 +45,4 @@ public static bool IsNumeric(this Type type) } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/IsValid.cs b/SAM/SAM.Core/Query/IsValid.cs index d318cb3f5..18be5d0c7 100644 --- a/SAM/SAM.Core/Query/IsValid.cs +++ b/SAM/SAM.Core/Query/IsValid.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Net; namespace SAM.Core @@ -14,7 +17,7 @@ public static bool IsValid(this Type type, Enum @enum) if (types == null || types.Length == 0) return false; - foreach(Type type_Temp in types) + foreach (Type type_Temp in types) { if (type_Temp == null) continue; @@ -30,7 +33,7 @@ public static bool IsValid(this Uri uri) { if (uri == null) return false; - + HttpWebRequest httpWebRequest = WebRequest.Create(uri) as HttpWebRequest; if (httpWebRequest == null) return false; @@ -44,4 +47,4 @@ public static bool IsValid(this Uri uri) return httpWebResponse.StatusCode == HttpStatusCode.OK; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/IsValidEmail.cs b/SAM/SAM.Core/Query/IsValidEmail.cs index ef4a8d21a..32597f447 100644 --- a/SAM/SAM.Core/Query/IsValidEmail.cs +++ b/SAM/SAM.Core/Query/IsValidEmail.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -21,4 +24,4 @@ public static bool IsValidEmail(string email) } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/IsValidHash.cs b/SAM/SAM.Core/Query/IsValidHash.cs index e5ed572a5..6469609ca 100644 --- a/SAM/SAM.Core/Query/IsValidHash.cs +++ b/SAM/SAM.Core/Query/IsValidHash.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -10,17 +13,17 @@ public static partial class Query /// Is Valid Hash public static bool IsValidHash(string value, string hash) { - if(value == null && hash == null) + if (value == null && hash == null) { return true; } - if(value == string.Empty && hash == string.Empty) + if (value == string.Empty && hash == string.Empty) { return true; } - if(string.IsNullOrEmpty(value) || string.IsNullOrEmpty(hash)) + if (string.IsNullOrEmpty(value) || string.IsNullOrEmpty(hash)) { return false; } @@ -28,4 +31,4 @@ public static bool IsValidHash(string value, string hash) return hash.Equals(ComputeHash(value)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/JArray.cs b/SAM/SAM.Core/Query/JArray.cs index 6a2fdc471..f25a7fdb2 100644 --- a/SAM/SAM.Core/Query/JArray.cs +++ b/SAM/SAM.Core/Query/JArray.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Core { @@ -22,11 +25,11 @@ public static JArray JArray(this string json) public static JArray JArray(this T[,] values) { - if(values == null) + if (values == null) { return null; } - + JArray result = new JArray(); for (int i = 0; i < values.GetLength(0); i++) { @@ -41,4 +44,4 @@ public static JArray JArray(this T[,] values) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/JSAMObject.cs b/SAM/SAM.Core/Query/JSAMObject.cs index 6c2ff1676..9785cdb16 100644 --- a/SAM/SAM.Core/Query/JSAMObject.cs +++ b/SAM/SAM.Core/Query/JSAMObject.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Reflection; @@ -31,7 +34,7 @@ public static IJSAMObject IJSAMObject(this JObject jObject) constructorInfo = type.GetConstructor(BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { typeof(JObject) }, null); } - if(constructorInfo == null) + if (constructorInfo == null) { return new JSAMObjectWrapper(jObject); } @@ -42,12 +45,12 @@ public static IJSAMObject IJSAMObject(this JObject jObject) public static T IJSAMObject(this JObject jObject) where T : IJSAMObject { IJSAMObject jSAMObject = IJSAMObject(jObject); - if(jSAMObject == null) + if (jSAMObject == null) { return default; } - if(!(jSAMObject is T)) + if (!(jSAMObject is T)) { return default; } @@ -55,4 +58,4 @@ public static T IJSAMObject(this JObject jObject) where T : IJSAMObject return (T)jSAMObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Label.cs b/SAM/SAM.Core/Query/Label.cs index e21ecc8d7..35e19bda0 100644 --- a/SAM/SAM.Core/Query/Label.cs +++ b/SAM/SAM.Core/Query/Label.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { @@ -47,4 +50,4 @@ public static string Label(this IJSAMObject sAMObject, string format, double tol return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/LatestVersion.cs b/SAM/SAM.Core/Query/LatestVersion.cs index 026933f52..0b03acebe 100644 --- a/SAM/SAM.Core/Query/LatestVersion.cs +++ b/SAM/SAM.Core/Query/LatestVersion.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.IO; using System.Net; @@ -26,17 +29,17 @@ public static string LatestVersion() httpWebRequest.UserAgent = userAgent; string json = null; - + using (WebResponse webResponse = httpWebRequest.GetResponse()) { Stream stream = webResponse.GetResponseStream(); - if(stream != null) + if (stream != null) { using (StreamReader streamReader = new StreamReader(stream)) { json = streamReader.ReadToEnd(); } - } + } } if (string.IsNullOrWhiteSpace(json)) @@ -49,4 +52,4 @@ public static string LatestVersion() return jObject.Value("tag_name"); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Lerp.cs b/SAM/SAM.Core/Query/Lerp.cs index dd587d5fa..e3dd0bda3 100644 --- a/SAM/SAM.Core/Query/Lerp.cs +++ b/SAM/SAM.Core/Query/Lerp.cs @@ -1,4 +1,7 @@ -using System.Drawing; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Drawing; namespace SAM.Core { @@ -23,4 +26,4 @@ public static Color Lerp(this Color color_1, Color color_2, double value) return Color.FromArgb(a, r, g, b); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Lerps.cs b/SAM/SAM.Core/Query/Lerps.cs index e44bc5d78..85e6c4ecb 100644 --- a/SAM/SAM.Core/Query/Lerps.cs +++ b/SAM/SAM.Core/Query/Lerps.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Drawing; namespace SAM.Core @@ -14,7 +17,7 @@ public static partial class Query /// Lerped Colors public static List Lerps(this Color color_1, Color color_2, int count) { - if(count < 1) + if (count < 1) { return null; } @@ -31,4 +34,4 @@ public static List Lerps(this Color color_1, Color color_2, int count) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Locked.cs b/SAM/SAM.Core/Query/Locked.cs index 756143729..06477eaa5 100644 --- a/SAM/SAM.Core/Query/Locked.cs +++ b/SAM/SAM.Core/Query/Locked.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.IO; namespace SAM.Core @@ -27,4 +30,4 @@ public static bool Locked(this FileInfo fileInfo) return false; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/LogarithmicMeanTemperatureDifference.cs b/SAM/SAM.Core/Query/LogarithmicMeanTemperatureDifference.cs index b58468279..f40c1d2e3 100644 --- a/SAM/SAM.Core/Query/LogarithmicMeanTemperatureDifference.cs +++ b/SAM/SAM.Core/Query/LogarithmicMeanTemperatureDifference.cs @@ -1,17 +1,20 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { public static double LogarithmicMeanTemperatureDifference(double enteringTemperature_1, double leavingTemperature_1, double enteringTemperature_2, double leavingTemperature_2) { - if(double.IsNaN(enteringTemperature_1) || double.IsNaN(leavingTemperature_1) || double.IsNaN(enteringTemperature_2) || double.IsNaN(leavingTemperature_2)) + if (double.IsNaN(enteringTemperature_1) || double.IsNaN(leavingTemperature_1) || double.IsNaN(enteringTemperature_2) || double.IsNaN(leavingTemperature_2)) { return double.NaN; } double temperatureDifference_1 = leavingTemperature_1 - enteringTemperature_2; - if(temperatureDifference_1 == 0) + if (temperatureDifference_1 == 0) { return double.NaN; } @@ -22,4 +25,4 @@ public static double LogarithmicMeanTemperatureDifference(double enteringTempera } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Mask.cs b/SAM/SAM.Core/Query/Mask.cs index 0c4dae580..86536f7dd 100644 --- a/SAM/SAM.Core/Query/Mask.cs +++ b/SAM/SAM.Core/Query/Mask.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { @@ -28,4 +31,4 @@ public static List Mask(this IEnumerable values, string value, Tex return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/MaterialType.cs b/SAM/SAM.Core/Query/MaterialType.cs index b72991697..4803f61df 100644 --- a/SAM/SAM.Core/Query/MaterialType.cs +++ b/SAM/SAM.Core/Query/MaterialType.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -19,4 +22,4 @@ public static MaterialType MaterialType(this IMaterial material) return Core.MaterialType.Undefined; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Max.cs b/SAM/SAM.Core/Query/Max.cs index 6d0c92061..d3ab48126 100644 --- a/SAM/SAM.Core/Query/Max.cs +++ b/SAM/SAM.Core/Query/Max.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Core @@ -7,18 +10,18 @@ public static partial class Query { public static T Max(this IEnumerable> ranges) { - if(ranges == null) + if (ranges == null) { return default; } List values = new List(); - foreach(Range range in ranges) + foreach (Range range in ranges) { values.Add(range.Max); } - if(values.Count == 0) + if (values.Count == 0) { return default; } @@ -26,4 +29,4 @@ public static T Max(this IEnumerable> ranges) return values.Max(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/MemoryStream.cs b/SAM/SAM.Core/Query/MemoryStream.cs index 9a678d92d..7484ff88d 100644 --- a/SAM/SAM.Core/Query/MemoryStream.cs +++ b/SAM/SAM.Core/Query/MemoryStream.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.IO; using System.Text; @@ -24,4 +27,4 @@ public static MemoryStream MemoryStream(this IEnumerable text) return new MemoryStream(bytes); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/MethodInfo.cs b/SAM/SAM.Core/Query/MethodInfo.cs index 21b3c25f8..998271a97 100644 --- a/SAM/SAM.Core/Query/MethodInfo.cs +++ b/SAM/SAM.Core/Query/MethodInfo.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Reflection; @@ -10,7 +13,7 @@ public static MethodInfo MethodInfo(this IEnumerable methodInfos, st { if (methodInfos == null || string.IsNullOrWhiteSpace(name)) return null; - + foreach (MethodInfo methodInfo in methodInfos) { if (!methodInfo.Name.ToUpper().Equals(name)) @@ -25,7 +28,7 @@ public static MethodInfo MethodInfo(this IEnumerable methodInfos, st if (inputTypes != null) { ParameterInfo[] parameterInfos = methodInfo.GetParameters(); - if(parameterInfos != null) + if (parameterInfos != null) { if (parameterInfos.Length != inputTypes.Length) continue; @@ -38,4 +41,4 @@ public static MethodInfo MethodInfo(this IEnumerable methodInfos, st return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/MethodInfos.cs b/SAM/SAM.Core/Query/MethodInfos.cs index 4ef97ab52..17940d794 100644 --- a/SAM/SAM.Core/Query/MethodInfos.cs +++ b/SAM/SAM.Core/Query/MethodInfos.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Reflection; @@ -8,7 +11,7 @@ public static partial class Query { public static List MethodInfos(string assemblyName, string typeName, string methodName) { - List result = new (); + List result = new(); Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); @@ -36,14 +39,14 @@ public static List MethodInfos(string assemblyName, string typeName, return null; } } - + if (assembly == null) return null; assemblies = new Assembly[] { assembly }; } - + foreach (Assembly assembly in assemblies) { @@ -109,24 +112,24 @@ public static List MethodInfos(string name = null) string typeName = null; string methodName = null; - if(!string.IsNullOrWhiteSpace(name)) + if (!string.IsNullOrWhiteSpace(name)) { string[] values = name.Split('.'); - if(values != null) + if (values != null) { int count = values.Length; - if(count != 0) + if (count != 0) { methodName = values[count - 1]; - if(count > 1) + if (count > 1) { typeName = values[count - 2]; if (count > 2) { - List values_Temp = new (values); + List values_Temp = new(values); assemblyName = string.Join(".", values_Temp.GetRange(0, count - 2)); - + } } } @@ -136,4 +139,4 @@ public static List MethodInfos(string name = null) return MethodInfos(assemblyName, typeName, methodName); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Min.cs b/SAM/SAM.Core/Query/Min.cs index fc2cf4d84..91e1a3dd6 100644 --- a/SAM/SAM.Core/Query/Min.cs +++ b/SAM/SAM.Core/Query/Min.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Core @@ -7,18 +10,18 @@ public static partial class Query { public static T Min(this IEnumerable> ranges) { - if(ranges == null) + if (ranges == null) { return default; } List values = new List(); - foreach(Range range in ranges) + foreach (Range range in ranges) { values.Add(range.Min); } - if(values.Count == 0) + if (values.Count == 0) { return default; } @@ -26,4 +29,4 @@ public static T Min(this IEnumerable> ranges) return values.Min(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Name.cs b/SAM/SAM.Core/Query/Name.cs index 4dea78c62..ea3882248 100644 --- a/SAM/SAM.Core/Query/Name.cs +++ b/SAM/SAM.Core/Query/Name.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core.Attributes; using System; using System.Linq; @@ -35,7 +38,7 @@ public static string Name(this Enum @enum) string result = null; ParameterProperties parameterProperties = ParameterProperties.Get(@enum); - if(parameterProperties != null) + if (parameterProperties != null) { result = parameterProperties.Name; } @@ -46,4 +49,4 @@ public static string Name(this Enum @enum) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Names.cs b/SAM/SAM.Core/Query/Names.cs index 3d44ab825..4d6cfdb47 100644 --- a/SAM/SAM.Core/Query/Names.cs +++ b/SAM/SAM.Core/Query/Names.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Core @@ -14,21 +17,21 @@ public static List Names(this object @object, bool property = true, bool List names = null; - if(property) + if (property) { names = Names_Property(@object, includeStatic); if (names != null && names.Count > 0) result.AddRange(names); } - if(method) + if (method) { names = Names_Method(@object, includeStatic); if (names != null && names.Count > 0) result.AddRange(names); } - if(propertySets) + if (propertySets) { names = Names_PropertySets(@object); if (names != null && names.Count > 0) @@ -55,7 +58,7 @@ public static List Names(this string userFriendlyName) return result; } - + private static List Names_Property(this object @object, bool includeStatic = false) { if (@object == null) @@ -105,7 +108,7 @@ private static List Names_Method(this object @object, bool includeStatic continue; } - if(methodInfo.ContainsGenericParameters) + if (methodInfo.ContainsGenericParameters) { continue; } @@ -128,7 +131,7 @@ private static List Names_Method(this object @object, bool includeStatic } } - if(methodInfo.Name == "Duplicate") + if (methodInfo.Name == "Duplicate") { continue; } @@ -163,4 +166,4 @@ private static List Names_PropertySets(this object @object) return names.ToList(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Next.cs b/SAM/SAM.Core/Query/Next.cs index d02371e88..89a23c8f8 100644 --- a/SAM/SAM.Core/Query/Next.cs +++ b/SAM/SAM.Core/Query/Next.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Core @@ -17,7 +20,7 @@ public static double Next(this IEnumerable values, double value) { continue; } - + if (double.IsNaN(result) || result > value_Temp) { result = value_Temp; @@ -33,9 +36,9 @@ public static T Next(this IEnumerable values, int index) { return default(T); } - + int index_Temp = Next(values.Count(), index); - if(index_Temp == -1) + if (index_Temp == -1) { return default(T); } @@ -64,4 +67,4 @@ public static int Next(this int count, int index) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/NextDouble.cs b/SAM/SAM.Core/Query/NextDouble.cs index 2ac711f3b..c4ea4906e 100644 --- a/SAM/SAM.Core/Query/NextDouble.cs +++ b/SAM/SAM.Core/Query/NextDouble.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Core { @@ -12,4 +15,4 @@ public static double NextDouble(this Random random, double min, double max) return random.NextDouble() * (max - min) + min; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Operator.cs b/SAM/SAM.Core/Query/Operator.cs index 0ff8e2490..7cdf8ed65 100644 --- a/SAM/SAM.Core/Query/Operator.cs +++ b/SAM/SAM.Core/Query/Operator.cs @@ -1,4 +1,7 @@ -using SAM.Core.Attributes; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core.Attributes; using System; using System.Linq; using System.Reflection; @@ -19,4 +22,4 @@ public static string Operator(this Enum @enum) return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Opposite.cs b/SAM/SAM.Core/Query/Opposite.cs index 9b7095bb2..37c95b0a4 100644 --- a/SAM/SAM.Core/Query/Opposite.cs +++ b/SAM/SAM.Core/Query/Opposite.cs @@ -1,10 +1,13 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { public static Direction Opposite(this Direction direction) { - if(direction == Direction.Undefined) + if (direction == Direction.Undefined) { return Direction.Undefined; } @@ -40,4 +43,4 @@ public static YesNo Opposite(this YesNo yesNo) return YesNo.Undefined; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/ParameterSet.cs b/SAM/SAM.Core/Query/ParameterSet.cs index 519e72033..959b8ec87 100644 --- a/SAM/SAM.Core/Query/ParameterSet.cs +++ b/SAM/SAM.Core/Query/ParameterSet.cs @@ -1,11 +1,14 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Reflection; namespace SAM.Core { public static partial class Query - { + { public static ParameterSet ParameterSet(this IEnumerable parameterSets, string name) { if (name == null || parameterSets == null) @@ -43,4 +46,4 @@ public static ParameterSet ParameterSet(this IEnumerable parameter return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/ParseDouble.cs b/SAM/SAM.Core/Query/ParseDouble.cs index eaeb395d5..c9bf1ea03 100644 --- a/SAM/SAM.Core/Query/ParseDouble.cs +++ b/SAM/SAM.Core/Query/ParseDouble.cs @@ -1,10 +1,13 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { public static double ParseDouble(this string value, double @default = default) { - if(!TryParseDouble(value, out double result)) + if (!TryParseDouble(value, out double result)) { result = @default; } @@ -12,4 +15,4 @@ public static double ParseDouble(this string value, double @default = default) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/ParseInt.cs b/SAM/SAM.Core/Query/ParseInt.cs index c0cfdbe21..04bde1d42 100644 --- a/SAM/SAM.Core/Query/ParseInt.cs +++ b/SAM/SAM.Core/Query/ParseInt.cs @@ -1,10 +1,13 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { public static int ParseInt(this string value, int @default = default) { - if(!TryParseInt(value, out int result)) + if (!TryParseInt(value, out int result)) { result = @default; } @@ -12,4 +15,4 @@ public static int ParseInt(this string value, int @default = default) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Paths.cs b/SAM/SAM.Core/Query/Paths.cs index 24a7dd703..1af6775c7 100644 --- a/SAM/SAM.Core/Query/Paths.cs +++ b/SAM/SAM.Core/Query/Paths.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { @@ -6,13 +9,13 @@ public static partial class Query { public static List Paths(this string directory, string fileName, params string[] extensions) { - if(string.IsNullOrWhiteSpace(directory) || string.IsNullOrWhiteSpace(fileName) || extensions == null || extensions.Length == 0) + if (string.IsNullOrWhiteSpace(directory) || string.IsNullOrWhiteSpace(fileName) || extensions == null || extensions.Length == 0) { return null; } List result = new List(); - foreach(string extension in extensions) + foreach (string extension in extensions) { string path = System.IO.Path.Combine(directory, string.Format("{0}.{1}", fileName, extension)); result.Add(path); @@ -21,4 +24,4 @@ public static List Paths(this string directory, string fileName, params return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Period.cs b/SAM/SAM.Core/Query/Period.cs index 2e9d920a4..3fa7ed294 100644 --- a/SAM/SAM.Core/Query/Period.cs +++ b/SAM/SAM.Core/Query/Period.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Core @@ -7,7 +10,7 @@ public static partial class Query { public static Period Period(int count) { - if(count < 2) + if (count < 2) { return Core.Period.Undefined; } @@ -20,7 +23,7 @@ public static Period Period(int count) { return Core.Period.Daily; } - else if(count > 12) + else if (count > 12) { return Core.Period.Weekly; } @@ -42,13 +45,13 @@ public static Period Period(this IEnumerable values) public static Period Period(this IndexedDoubles indexedDoubles) { - if(indexedDoubles == null) + if (indexedDoubles == null) { return Core.Period.Undefined; } IEnumerable keys = indexedDoubles.Keys; - if(keys == null) + if (keys == null) { return Core.Period.Undefined; } @@ -57,4 +60,4 @@ public static Period Period(this IndexedDoubles indexedDoubles) } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Permutations.cs b/SAM/SAM.Core/Query/Permutations.cs index 081ce59bf..610ebf38f 100644 --- a/SAM/SAM.Core/Query/Permutations.cs +++ b/SAM/SAM.Core/Query/Permutations.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -8,7 +11,7 @@ public static partial class Query { public static List> Permutations(this IEnumerable @in) where T : IComparable { - if(@in == null) + if (@in == null) { return null; } @@ -27,13 +30,13 @@ public static List> Permutations(this IEnumerable @in, bool unique return result; } - if(result == null || result.Count < 2) + if (result == null || result.Count < 2) { return result; } List> result_New = new List>(); - while(result.Count > 0) + while (result.Count > 0) { List values = result[0]; @@ -52,7 +55,7 @@ public static List> Permutations(this IEnumerable @in, bool unique private static void Permutations(this List @in, int start, List> @out) where T : IComparable { - if(start == @in.Count - 1) + if (start == @in.Count - 1) { @out.Add(new List(@in)); return; @@ -74,4 +77,4 @@ private static void Permutations(this List @in, int start, List> @ } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Ping.cs b/SAM/SAM.Core/Query/Ping.cs index 21ec3c0cb..d19033964 100644 --- a/SAM/SAM.Core/Query/Ping.cs +++ b/SAM/SAM.Core/Query/Ping.cs @@ -1,4 +1,7 @@ -using System.Net.NetworkInformation; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Net.NetworkInformation; namespace SAM.Core { @@ -21,7 +24,7 @@ public static bool Ping(string hostNameOrAddress = "https://www.google.com/", in } finally { - if(ping != null) + if (ping != null) { ping.Dispose(); } @@ -30,4 +33,4 @@ public static bool Ping(string hostNameOrAddress = "https://www.google.com/", in return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Previous.cs b/SAM/SAM.Core/Query/Previous.cs index 07d2a0e46..7dfdeeb2a 100644 --- a/SAM/SAM.Core/Query/Previous.cs +++ b/SAM/SAM.Core/Query/Previous.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Core @@ -17,7 +20,7 @@ public static double Previous(this IEnumerable values, double value) { continue; } - + if (double.IsNaN(result) || result < value_Temp) { result = value_Temp; @@ -35,7 +38,7 @@ public static T Previous(this IEnumerable values, int index) } int index_Temp = Previous(values.Count(), index); - if(index_Temp == -1) + if (index_Temp == -1) { return default(T); } @@ -66,4 +69,4 @@ public static int Previous(this int count, int index) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/QuotedText.cs b/SAM/SAM.Core/Query/QuotedText.cs index 2590a8ef8..77bd97214 100644 --- a/SAM/SAM.Core/Query/QuotedText.cs +++ b/SAM/SAM.Core/Query/QuotedText.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -6,12 +9,12 @@ public static string QuotedText(this string @string, out string sufix) { sufix = null; - if(string.IsNullOrWhiteSpace(@string)) + if (string.IsNullOrWhiteSpace(@string)) { return null; } - if(!@string.StartsWith("\"")) + if (!@string.StartsWith("\"")) { sufix = @string; return null; @@ -40,4 +43,4 @@ public static string QuotedText(this string @string, out string sufix) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/RangeDictionary.cs b/SAM/SAM.Core/Query/RangeDictionary.cs index 2d49ae540..f2a57e099 100644 --- a/SAM/SAM.Core/Query/RangeDictionary.cs +++ b/SAM/SAM.Core/Query/RangeDictionary.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { @@ -9,9 +12,9 @@ public static Dictionary, T> RangeDictionary(this IEnumerable v if (values == null) return null; - List values_Temp = new (values); + List values_Temp = new(values); - Dictionary, T> result = new (); + Dictionary, T> result = new(); Range range = null; T value = default; @@ -48,4 +51,4 @@ public static Dictionary, T> RangeDictionary(this IEnumerable v } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/ReadAccess.cs b/SAM/SAM.Core/Query/ReadAccess.cs index 9fd9e30ec..cfd7b4aa2 100644 --- a/SAM/SAM.Core/Query/ReadAccess.cs +++ b/SAM/SAM.Core/Query/ReadAccess.cs @@ -1,10 +1,13 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { public static bool ReadAccess(this AccessType accessType) { - switch(accessType) + switch (accessType) { case AccessType.Read: case AccessType.ReadWrite: @@ -14,4 +17,4 @@ public static bool ReadAccess(this AccessType accessType) } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/RelationType.cs b/SAM/SAM.Core/Query/RelationType.cs index 7be06853e..7917bcd1c 100644 --- a/SAM/SAM.Core/Query/RelationType.cs +++ b/SAM/SAM.Core/Query/RelationType.cs @@ -1,25 +1,28 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { public static RelationType RelationType(int count_1, int count_2) { - if(count_1 <= 0 || count_2 <= 0) + if (count_1 <= 0 || count_2 <= 0) { return Core.RelationType.Undefined; } - if(count_1 == 1 && count_2 == 1) + if (count_1 == 1 && count_2 == 1) { return Core.RelationType.OneToOne; } - if(count_1 == 1) + if (count_1 == 1) { return Core.RelationType.OneToMany; } - if(count_2 == 1) + if (count_2 == 1) { return Core.RelationType.ManyToOne; } @@ -27,4 +30,4 @@ public static RelationType RelationType(int count_1, int count_2) return Core.RelationType.ManyToMany; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Repeat.cs b/SAM/SAM.Core/Query/Repeat.cs index 2dd0699ee..05acbea6b 100644 --- a/SAM/SAM.Core/Query/Repeat.cs +++ b/SAM/SAM.Core/Query/Repeat.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Core @@ -7,12 +10,12 @@ public static partial class Query { public static List Repeat(this IEnumerable values, Period period_Destination, Period period_Source = Core.Period.Undefined) { - if(values == null || period_Destination == Core.Period.Undefined) + if (values == null || period_Destination == Core.Period.Undefined) { return null; } - if(period_Source == Core.Period.Undefined) + if (period_Source == Core.Period.Undefined) { period_Source = Query.Period(values.Count()); } @@ -74,24 +77,24 @@ public static IndexedDoubles Repeat(this IndexedDoubles indexedDoubles, Period p } IEnumerable keys = indexedDoubles.Keys; - if(keys == null) + if (keys == null) { return null; } IndexedDoubles result = new IndexedDoubles(); - foreach(int key in keys) + foreach (int key in keys) { double value = indexedDoubles[key]; for (int i = 0; i < count; i++) { - result.Add((key * count) + i ,value); + result.Add((key * count) + i, value); } } return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/ReplaceSpecialCharacters.cs b/SAM/SAM.Core/Query/ReplaceSpecialCharacters.cs index 0ff6f078f..b1db98941 100644 --- a/SAM/SAM.Core/Query/ReplaceSpecialCharacters.cs +++ b/SAM/SAM.Core/Query/ReplaceSpecialCharacters.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Core @@ -19,7 +22,7 @@ public static string ReplaceSpecialCharacters(this string text, string language) return text; string result = text; - foreach(string key in textMap.Keys) + foreach (string key in textMap.Keys) { List values = textMap.GetValues(key); if (values == null || values.Count == 0) @@ -31,4 +34,4 @@ public static string ReplaceSpecialCharacters(this string text, string language) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/ResourcesDirectory.cs b/SAM/SAM.Core/Query/ResourcesDirectory.cs index ad3986097..a632f183a 100644 --- a/SAM/SAM.Core/Query/ResourcesDirectory.cs +++ b/SAM/SAM.Core/Query/ResourcesDirectory.cs @@ -1,4 +1,7 @@ -using System.Reflection; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Reflection; namespace SAM.Core { @@ -12,7 +15,7 @@ public static string ResourcesDirectory(this Setting setting) string resourcesDirectoryName = setting?.GetValue(CoreSettingParameter.ResourcesDirectoryName); string result = System.IO.Path.Combine(UserSAMDirectory(), resourcesDirectoryName); - if(!System.IO.Directory.Exists(result)) + if (!System.IO.Directory.Exists(result)) { result = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(ExecutingAssemblyDirectory()), resourcesDirectoryName); } @@ -46,7 +49,7 @@ public static string ResourcesDirectory(this Setting setting, Assembly assembly) name = name.Replace(".", @"\"); string result = System.IO.Path.Combine(UserSAMDirectory(), resourcesDirectoryName, name); - if(!System.IO.Directory.Exists(result)) + if (!System.IO.Directory.Exists(result)) { result = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(ExecutingAssemblyDirectory()), resourcesDirectoryName, name); } @@ -64,4 +67,4 @@ public static string ResourcesDirectory(Assembly assembly) return ResourcesDirectory(ActiveSetting.Setting, assembly); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Round.cs b/SAM/SAM.Core/Query/Round.cs index 734a75df9..9def8e9e7 100644 --- a/SAM/SAM.Core/Query/Round.cs +++ b/SAM/SAM.Core/Query/Round.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Core { @@ -46,4 +49,4 @@ public static float Round(this float value, float tolerance = (float)Core.Tolera return (float)(Math.Round((decimal)value / (decimal)tolerance) * (decimal)tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/SAMFileType.cs b/SAM/SAM.Core/Query/SAMFileType.cs index f53266216..df5aee8cc 100644 --- a/SAM/SAM.Core/Query/SAMFileType.cs +++ b/SAM/SAM.Core/Query/SAMFileType.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -8,7 +11,7 @@ public static SAMFileType SAMFileType(this string path) return Core.SAMFileType.Undefined; string extension = System.IO.Path.GetExtension(path); - if(extension == null) + if (extension == null) return Core.SAMFileType.Undefined; if (extension.StartsWith(".")) @@ -16,7 +19,7 @@ public static SAMFileType SAMFileType(this string path) extension = extension.ToLower(); - switch(extension) + switch (extension) { case "sam": return Core.SAMFileType.SAM; @@ -27,4 +30,4 @@ public static SAMFileType SAMFileType(this string path) return Core.SAMFileType.Undefined; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Search.cs b/SAM/SAM.Core/Query/Search.cs index 369012adf..2535d936d 100644 --- a/SAM/SAM.Core/Query/Search.cs +++ b/SAM/SAM.Core/Query/Search.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Core @@ -7,18 +10,18 @@ public static partial class Query { public static List Search(this IEnumerable items, string text, Func func, bool caseSensitive = false) { - if(items == null || func == null || string.IsNullOrWhiteSpace(text)) + if (items == null || func == null || string.IsNullOrWhiteSpace(text)) { return null; } SearchWrapper searchWrapper = new SearchWrapper(caseSensitive); - Dictionary dictionary = new Dictionary(); - + Dictionary dictionary = new Dictionary(); + foreach (T item in items) { - if(item == null) + if (item == null) { continue; } @@ -32,15 +35,15 @@ public static List Search(this IEnumerable items, string text, Func values = searchWrapper.Search(text, true); - if(values == null) + if (values == null) { return null; } List result = new List(); - foreach(string value in values) + foreach (string value in values) { - if(!dictionary.TryGetValue(value, out T item)) + if (!dictionary.TryGetValue(value, out T item)) { continue; } @@ -51,4 +54,4 @@ public static List Search(this IEnumerable items, string text, Func(this IEnumerable items_1, IEnumerable items_2) where T :IComparable + public static bool Similar(this IEnumerable items_1, IEnumerable items_2) where T : IComparable { return Similar(items_1, items_2, null); } @@ -55,7 +58,7 @@ public static bool Similar(this IEnumerable items_1, IEnumerable items_ for (int i = 0; i < count; i++) { - if(!equatableFunc.Invoke(items_1.ElementAt(i), items_2.ElementAt(i))) + if (!equatableFunc.Invoke(items_1.ElementAt(i), items_2.ElementAt(i))) { return false; } @@ -69,4 +72,4 @@ public static bool Similar(System.Drawing.Color color_1, System.Drawing.Color co return color_1.A == color_2.A && color_1.R == color_2.R && color_1.G == color_2.G && color_1.B == color_2.B; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/StartProcess.cs b/SAM/SAM.Core/Query/StartProcess.cs index 84515d1b0..806e55e45 100644 --- a/SAM/SAM.Core/Query/StartProcess.cs +++ b/SAM/SAM.Core/Query/StartProcess.cs @@ -1,4 +1,7 @@ -using System.Diagnostics; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Diagnostics; namespace SAM.Core { @@ -6,7 +9,7 @@ public static partial class Query { public static Process StartProcess(this string path, string arguments = null) { - if(string.IsNullOrWhiteSpace(path)) + if (string.IsNullOrWhiteSpace(path)) { return null; } @@ -21,4 +24,4 @@ public static Process StartProcess(this string path, string arguments = null) return Process.Start(processStartInfo); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Tag.cs b/SAM/SAM.Core/Query/Tag.cs index 4b2e6e5a4..1637b4209 100644 --- a/SAM/SAM.Core/Query/Tag.cs +++ b/SAM/SAM.Core/Query/Tag.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Core { @@ -6,7 +9,7 @@ public static partial class Query { public static Tag Tag(this JObject jObject) { - if(jObject == null) + if (jObject == null) { return null; } @@ -17,7 +20,7 @@ public static Tag Tag(this JObject jObject) } JObject jObject_Tag = jObject.Value("Tag"); - if(jObject_Tag == null) + if (jObject_Tag == null) { return null; } @@ -25,4 +28,4 @@ public static Tag Tag(this JObject jObject) return new Tag(jObject_Tag); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/TemplatesDirectory.cs b/SAM/SAM.Core/Query/TemplatesDirectory.cs index 666cdd3ce..66e1bc28b 100644 --- a/SAM/SAM.Core/Query/TemplatesDirectory.cs +++ b/SAM/SAM.Core/Query/TemplatesDirectory.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Reflection; namespace SAM.Core @@ -7,14 +10,14 @@ public static partial class Query { public static string TemplatesDirectory(Assembly assembly) { - string resourcesDirectory = ResourcesDirectory(ActiveSetting.Setting, assembly); - if(string.IsNullOrWhiteSpace(resourcesDirectory)) + string resourcesDirectory = ResourcesDirectory(ActiveSetting.Setting, assembly); + if (string.IsNullOrWhiteSpace(resourcesDirectory)) { return null; } string templatesDirectoryName = ActiveSetting.Setting.GetValue(CoreSettingParameter.TemplatesDirectoryName); - if(string.IsNullOrWhiteSpace(templatesDirectoryName)) + if (string.IsNullOrWhiteSpace(templatesDirectoryName)) { return null; } @@ -43,4 +46,4 @@ public static string TemplatesDirectory(bool includeTypeDirectory = true) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Text.cs b/SAM/SAM.Core/Query/Text.cs index 155c97d25..140dd339a 100644 --- a/SAM/SAM.Core/Query/Text.cs +++ b/SAM/SAM.Core/Query/Text.cs @@ -1,4 +1,7 @@ -using System.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Linq; namespace SAM.Core { @@ -11,7 +14,7 @@ public static string Text(this CountryCode countryCode) public static string Text(this IComplexReference complexReference) { - if(complexReference == null) + if (complexReference == null) { return null; } @@ -56,4 +59,4 @@ public static string Text(this IComplexReference complexReference) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Texts.cs b/SAM/SAM.Core/Query/Texts.cs index 4159a4f63..fc4a6a42b 100644 --- a/SAM/SAM.Core/Query/Texts.cs +++ b/SAM/SAM.Core/Query/Texts.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Core @@ -16,7 +19,7 @@ public static List Texts(string text, char openSymbol = '[', char closeS int startIndex = 0; int index = text.IndexOf(openSymbol, startIndex); - while(index != -1) + while (index != -1) { startIndex = text.IndexOf(closeSymbol, index); @@ -82,4 +85,4 @@ public static List Texts(string text, bool unique, char openSymbol = '[' return texts.Distinct().ToList(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Tolerance.cs b/SAM/SAM.Core/Query/Tolerance.cs index ab2e7e515..506e45b6b 100644 --- a/SAM/SAM.Core/Query/Tolerance.cs +++ b/SAM/SAM.Core/Query/Tolerance.cs @@ -1,4 +1,7 @@ -using System.Threading; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Threading; namespace SAM.Core { @@ -21,4 +24,4 @@ public static double Tolerance(int decimals) return double.Parse(value); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Transpose.cs b/SAM/SAM.Core/Query/Transpose.cs index 3658551d7..a0496345c 100644 --- a/SAM/SAM.Core/Query/Transpose.cs +++ b/SAM/SAM.Core/Query/Transpose.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -33,4 +36,4 @@ public static partial class Query return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/TryCompute.cs b/SAM/SAM.Core/Query/TryCompute.cs index cf473c663..11b321979 100644 --- a/SAM/SAM.Core/Query/TryCompute.cs +++ b/SAM/SAM.Core/Query/TryCompute.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Data; using System.Reflection; @@ -162,4 +165,4 @@ public static bool TryCompute(Expression expression, out T result, Dictionary return TryCompute(expressionText, out result, variables); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/TryConvert.cs b/SAM/SAM.Core/Query/TryConvert.cs index e2b308fc2..ea51f4238 100644 --- a/SAM/SAM.Core/Query/TryConvert.cs +++ b/SAM/SAM.Core/Query/TryConvert.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections; using System.Collections.Generic; @@ -11,7 +14,7 @@ public static bool TryConvert(this object @object, out object result, Type type) { result = default; - if(type == typeof(object)) + if (type == typeof(object)) { result = @object; return true; @@ -25,7 +28,7 @@ public static bool TryConvert(this object @object, out object result, Type type) } Type type_Temp = Nullable.GetUnderlyingType(type); - if(type_Temp == null) + if (type_Temp == null) { type_Temp = type; } @@ -41,8 +44,8 @@ public static bool TryConvert(this object @object, out object result, Type type) if (@object is IEnumerable) { - JArray jArray = new (); - foreach(object @object_Temp in (IEnumerable)@object) + JArray jArray = new(); + foreach (object @object_Temp in (IEnumerable)@object) { if (TryConvert(@object_Temp, out string value) && value != null) jArray.Add(value); @@ -60,7 +63,7 @@ public static bool TryConvert(this object @object, out object result, Type type) if (result == default) result = @object.ToString(); } - + return true; } else if (type_Temp == typeof(bool)) @@ -143,7 +146,7 @@ public static bool TryConvert(this object @object, out object result, Type type) return false; } - if(@object is Type) + if (@object is Type) { return false; } @@ -498,9 +501,9 @@ public static bool TryConvert(this object @object, out object result, Type type) return true; } } - else if(typeof(SAMColor).IsAssignableFrom(type_Temp)) + else if (typeof(SAMColor).IsAssignableFrom(type_Temp)) { - if(int.TryParse((string)@object, out int int_color)) + if (int.TryParse((string)@object, out int int_color)) { result = new SAMColor(Convert.ToColor(int_color)); return true; @@ -508,18 +511,18 @@ public static bool TryConvert(this object @object, out object result, Type type) else { string value = (string)@object; - if(!string.IsNullOrWhiteSpace(value) && value.Contains(",")) + if (!string.IsNullOrWhiteSpace(value) && value.Contains(",")) { string[] values = value.Split(','); - if(values.Length ==3) + if (values.Length == 3) { - if(int.TryParse(values[0], out int r) && int.TryParse(values[1], out int g) && int.TryParse(values[2], out int b)) + if (int.TryParse(values[0], out int r) && int.TryParse(values[1], out int g) && int.TryParse(values[2], out int b)) { result = new SAMColor(System.Drawing.Color.FromArgb(r, g, b)); return true; } } - else if(values.Length == 4) + else if (values.Length == 4) { if (int.TryParse(values[0], out int a) && int.TryParse(values[1], out int r) && int.TryParse(values[2], out int g) && int.TryParse(values[3], out int b)) { @@ -547,8 +550,8 @@ public static bool TryConvert(this object @object, out object result, Type type) return true; } } - - if(type_Object == typeof(System.Drawing.Color)) + + if (type_Object == typeof(System.Drawing.Color)) { result = new SAMColor((System.Drawing.Color)@object); return true; @@ -629,17 +632,17 @@ public static bool TryConvert(this object @object, out object result, Type type) } } } - else if(type_Temp.IsEnum) + else if (type_Temp.IsEnum) { - if(@object == null) + if (@object == null) { return false; } - if(@object is string) + if (@object is string) { string @string = ((string)@object).Replace(" ", string.Empty).ToUpper(); - if(string.IsNullOrEmpty(@string)) + if (string.IsNullOrEmpty(@string)) { return false; } @@ -654,7 +657,7 @@ public static bool TryConvert(this object @object, out object result, Type type) } string description = Description(@enum)?.Replace(" ", string.Empty)?.ToUpper(); - if(@string.Equals(description)) + if (@string.Equals(description)) { result = @enum; return true; @@ -679,4 +682,4 @@ public static bool TryConvert(this object @object, out T result) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/TryGetEnum.cs b/SAM/SAM.Core/Query/TryGetEnum.cs index e907d2eda..23728cd21 100644 --- a/SAM/SAM.Core/Query/TryGetEnum.cs +++ b/SAM/SAM.Core/Query/TryGetEnum.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Core @@ -29,7 +32,7 @@ public static bool TryGetEnum(this string text, Type type, out Enum @enum) } } - List texts = new (); + List texts = new(); string text_Temp = null; foreach (Enum @enum_Temp in array) @@ -66,15 +69,15 @@ public static bool TryGetEnum(this string text, Type type, out Enum @enum) return false; } - public static bool TryGetEnum(this string text, out T @enum) where T: Enum + public static bool TryGetEnum(this string text, out T @enum) where T : Enum { @enum = default; - if(!TryGetEnum(text, typeof(T), out Enum @enum_Temp)) + if (!TryGetEnum(text, typeof(T), out Enum @enum_Temp)) { return false; } - if(enum_Temp is T) + if (enum_Temp is T) { @enum = (T)enum_Temp; return true; @@ -83,4 +86,4 @@ public static bool TryGetEnum(this string text, out T @enum) where T: Enum return false; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/TryGetFieldValue.cs b/SAM/SAM.Core/Query/TryGetFieldValue.cs index 238c37933..17cfd38df 100644 --- a/SAM/SAM.Core/Query/TryGetFieldValue.cs +++ b/SAM/SAM.Core/Query/TryGetFieldValue.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Reflection; @@ -56,4 +59,4 @@ public static bool TryGetFieldValue(this object @object, string fieldName, ou return false; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/TryGetJToken.cs b/SAM/SAM.Core/Query/TryGetJToken.cs index 4c39ec57c..b4fba5fcc 100644 --- a/SAM/SAM.Core/Query/TryGetJToken.cs +++ b/SAM/SAM.Core/Query/TryGetJToken.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Core { @@ -7,7 +10,7 @@ public static partial class Query public static bool TryGetJToken(this string @string, out JToken jToken) { jToken = null; - + if (string.IsNullOrWhiteSpace(@string)) return false; @@ -24,4 +27,4 @@ public static bool TryGetJToken(this string @string, out JToken jToken) return false; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/TryGetObjects.cs b/SAM/SAM.Core/Query/TryGetObjects.cs index 5b54f6960..b830fbe20 100644 --- a/SAM/SAM.Core/Query/TryGetObjects.cs +++ b/SAM/SAM.Core/Query/TryGetObjects.cs @@ -1,11 +1,14 @@ -using System.Collections; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections; using System.Collections.Generic; namespace SAM.Core { public static partial class Query { - public static bool TryGetObjects(this ISAMLibrary sAMLibrary, out List objects) where T: IJSAMObject + public static bool TryGetObjects(this ISAMLibrary sAMLibrary, out List objects) where T : IJSAMObject { objects = new List(); if (sAMLibrary == null) @@ -15,21 +18,21 @@ public static bool TryGetObjects(this ISAMLibrary sAMLibrary, out List obj System.Type type = sAMLibrary?.GenericType; - if(!typeof(IJSAMObject).IsAssignableFrom(type)) + if (!typeof(IJSAMObject).IsAssignableFrom(type)) { return false; } IEnumerable enumerable = (sAMLibrary as dynamic).GetObjects() as IEnumerable; - if(enumerable == null) + if (enumerable == null) { return false; } objects = new List(); - foreach(object object_Temp in enumerable) + foreach (object object_Temp in enumerable) { - if(object_Temp is T) + if (object_Temp is T) { objects.Add((T)object_Temp); } @@ -38,4 +41,4 @@ public static bool TryGetObjects(this ISAMLibrary sAMLibrary, out List obj return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/TryGetTypeNameAndAssemblyName.cs b/SAM/SAM.Core/Query/TryGetTypeNameAndAssemblyName.cs index ed40ebba9..bb89bae60 100644 --- a/SAM/SAM.Core/Query/TryGetTypeNameAndAssemblyName.cs +++ b/SAM/SAM.Core/Query/TryGetTypeNameAndAssemblyName.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -28,4 +31,4 @@ public static bool TryGetTypeNameAndAssemblyName(this string fullTypeName, out s } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/TryGetValue.cs b/SAM/SAM.Core/Query/TryGetValue.cs index ee32d22ee..5d8caf3b2 100644 --- a/SAM/SAM.Core/Query/TryGetValue.cs +++ b/SAM/SAM.Core/Query/TryGetValue.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; @@ -95,7 +98,7 @@ public static bool TryGetValue(this ParameterizedSAMObject parameterizedSAMObjec if (parameterSet == null) return false; - if(parameterSet.Contains(name)) + if (parameterSet.Contains(name)) { value = parameterSet.ToObject(name); return true; @@ -113,7 +116,7 @@ public static bool TryGetValue(this object @object, string name, out object valu if (@object == null || string.IsNullOrEmpty(name)) return false; - List names = new () { name }; + List names = new() { name }; if (UserFriendlyName) names = Names((string)name); else @@ -122,7 +125,7 @@ public static bool TryGetValue(this object @object, string name, out object valu if (names == null || names.Count == 0) return false; - foreach(string name_Temp in names) + foreach (string name_Temp in names) { if (TryGetValue(@object, name_Temp, out value)) return true; @@ -142,7 +145,7 @@ public static bool TryGetValue(this object @object, string name, out T value) if (object_value == null) return Nullable.GetUnderlyingType(typeof(T)) != null; - if(typeof(T).IsAssignableFrom(object_value.GetType())) + if (typeof(T).IsAssignableFrom(object_value.GetType())) { value = (T)object_value; return true; @@ -155,7 +158,7 @@ public static bool TryGetValue(XAttribute xAttribute, out T value) { value = default; - if(xAttribute == null) + if (xAttribute == null) { return false; } @@ -230,7 +233,7 @@ public static bool TryGetValue(XAttribute xAttribute, out T value) return false; } - + private static bool TryGetValue_Property(this object @object, string name, out object value) { value = null; @@ -243,7 +246,7 @@ private static bool TryGetValue_Property(this object @object, string name, out o PropertyInfo[] propertyInfos = @object.GetType().GetProperties(); foreach (PropertyInfo propertyInfo in propertyInfos) { - if (!propertyInfo.Name.Equals(name) ) + if (!propertyInfo.Name.Equals(name)) { continue; } @@ -302,7 +305,7 @@ private static bool TryGetValue_Method(this object @object, string name, out obj { if (methodInfo.ReturnType == typeof(void)) continue; - + if (methodInfo.Name.Equals(name) || (!name.StartsWith("Get") && methodInfo.Name.Equals(string.Format("Get{0}", name)))) { if (TryGetValue_Method(@object, methodInfo, out value)) @@ -336,4 +339,4 @@ private static bool TryGetValue_ParameterSets(this object @object, string name, return false; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/TryInvokeDeclaredMethod.cs b/SAM/SAM.Core/Query/TryInvokeDeclaredMethod.cs index 22e195f79..a0e65d43d 100644 --- a/SAM/SAM.Core/Query/TryInvokeDeclaredMethod.cs +++ b/SAM/SAM.Core/Query/TryInvokeDeclaredMethod.cs @@ -1,4 +1,7 @@ - +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + + namespace SAM.Core { public static partial class Query @@ -8,4 +11,4 @@ public static bool TryInvokeDeclaredMethod(dynamic @object, string methodName return TryInvokeMethod(@object, @object?.GetType().DeclaredMethods, methodName, out result, parameters); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/TryInvokeMethod.cs b/SAM/SAM.Core/Query/TryInvokeMethod.cs index ed5a35bbe..50a4b7705 100644 --- a/SAM/SAM.Core/Query/TryInvokeMethod.cs +++ b/SAM/SAM.Core/Query/TryInvokeMethod.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Reflection; @@ -45,4 +48,4 @@ public static bool TryInvokeMethod(this object @object, IEnumerable(object @object, string methodName, return TryInvokeMethod(@object, @object?.GetType().GetRuntimeMethods(), methodName, out result, parameters); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/TryParseDouble.cs b/SAM/SAM.Core/Query/TryParseDouble.cs index 9adc313c2..377502d18 100644 --- a/SAM/SAM.Core/Query/TryParseDouble.cs +++ b/SAM/SAM.Core/Query/TryParseDouble.cs @@ -1,11 +1,14 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { public static bool TryParseDouble(this string value, out double result) { result = double.NaN; - + if (string.IsNullOrWhiteSpace(value)) return false; @@ -69,4 +72,4 @@ public static bool TryParseDouble(this string value, out double result) return false; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/TryParseGuids.cs b/SAM/SAM.Core/Query/TryParseGuids.cs index 459afb941..eda3b66d2 100644 --- a/SAM/SAM.Core/Query/TryParseGuids.cs +++ b/SAM/SAM.Core/Query/TryParseGuids.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Core @@ -9,17 +12,17 @@ public static bool TryParseGuids(string text, out List guids) { guids = null; - if(string.IsNullOrWhiteSpace(text)) + if (string.IsNullOrWhiteSpace(text)) { return false; } string[] separators = new string[] { "\n", "\t", "," }; - List strings = new () { text }; + List strings = new() { text }; foreach (string separator in separators) { - List strings_Split = new (); + List strings_Split = new(); foreach (string @string in strings) { string[] strings_Temp_Split = @string.Split(separators, StringSplitOptions.RemoveEmptyEntries); @@ -41,7 +44,7 @@ public static bool TryParseGuids(string text, out List guids) { string value = null; - if(string.IsNullOrWhiteSpace(@string)) + if (string.IsNullOrWhiteSpace(@string)) { continue; } @@ -55,7 +58,7 @@ public static bool TryParseGuids(string text, out List guids) value = value.Replace("]", string.Empty); value = value.Replace(" ", string.Empty); - if(System.Guid.TryParse(value, out Guid guid)) + if (System.Guid.TryParse(value, out Guid guid)) { guids.Add(guid); } @@ -64,4 +67,4 @@ public static bool TryParseGuids(string text, out List guids) return guids.Count != 0; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/TryParseInt.cs b/SAM/SAM.Core/Query/TryParseInt.cs index 6da63186e..decebe531 100644 --- a/SAM/SAM.Core/Query/TryParseInt.cs +++ b/SAM/SAM.Core/Query/TryParseInt.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -6,7 +9,7 @@ public static bool TryParseInt(this string value, out int result) { result = default; - if(TryParseDouble(value, out double @double)) + if (TryParseDouble(value, out double @double)) { result = System.Convert.ToInt32(@double); return true; @@ -15,4 +18,4 @@ public static bool TryParseInt(this string value, out int result) return false; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Type.cs b/SAM/SAM.Core/Query/Type.cs index 230f22ae1..5689b5d73 100644 --- a/SAM/SAM.Core/Query/Type.cs +++ b/SAM/SAM.Core/Query/Type.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; @@ -110,7 +113,7 @@ public static Type Type(this string typeName, bool ignoreCase = false) public static Type Type(this string typeName, TextComparisonType textComparisonType, bool ignoreCase = false, Func func = null) { - if(string.IsNullOrWhiteSpace(typeName)) + if (string.IsNullOrWhiteSpace(typeName)) { return null; } @@ -123,9 +126,9 @@ public static Type Type(this string typeName, TextComparisonType textComparisonT string typeName_Temp = ignoreCase ? typeName.ToLower() : typeName; - foreach(Assembly assembly in assemblies) + foreach (Assembly assembly in assemblies) { - if(func != null && !func.Invoke(assembly)) + if (func != null && !func.Invoke(assembly)) { continue; } @@ -140,12 +143,12 @@ public static Type Type(this string typeName, TextComparisonType textComparisonT continue; } - if(types == null || types.Length == 0) + if (types == null || types.Length == 0) { continue; } - - foreach(Type type in types) + + foreach (Type type in types) { string name; @@ -168,4 +171,4 @@ public static Type Type(this string typeName, TextComparisonType textComparisonT } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/TypeDictionary.cs b/SAM/SAM.Core/Query/TypeDictionary.cs index 49d5302d7..b9190bf08 100644 --- a/SAM/SAM.Core/Query/TypeDictionary.cs +++ b/SAM/SAM.Core/Query/TypeDictionary.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Core { @@ -16,7 +19,7 @@ public static partial class Query continue; System.Type type = @object.GetType(); - + List objects_Temp = null; if (!result.TryGetValue(type, out objects_Temp)) { @@ -29,4 +32,4 @@ public static partial class Query return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/TypeName.cs b/SAM/SAM.Core/Query/TypeName.cs index bee2e7c25..40f98fd43 100644 --- a/SAM/SAM.Core/Query/TypeName.cs +++ b/SAM/SAM.Core/Query/TypeName.cs @@ -1,4 +1,7 @@ -using System.Runtime.InteropServices; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Runtime.InteropServices; namespace SAM.Core { @@ -6,7 +9,7 @@ public static partial class Query { public static string TypeName(this object @object) { - if(@object == null) + if (@object == null) { return null; } @@ -14,4 +17,4 @@ public static string TypeName(this object @object) return Marshal.IsComObject(@object) ? COMObjectTypeName(@object) : @object.GetType().Name; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Types.cs b/SAM/SAM.Core/Query/Types.cs index 25f7fcf98..b035d9285 100644 --- a/SAM/SAM.Core/Query/Types.cs +++ b/SAM/SAM.Core/Query/Types.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Reflection; @@ -34,7 +37,7 @@ public static void Types(this IRelationFilter relationFilter, List types) public static List Types(object @object, string path) { - if(@object == null || string.IsNullOrWhiteSpace(path) || !System.IO.File.Exists(path)) + if (@object == null || string.IsNullOrWhiteSpace(path) || !System.IO.File.Exists(path)) { return null; } @@ -50,7 +53,7 @@ public static List Types(object @object, string path) return null; } - if(assembly == null) + if (assembly == null) { return null; } @@ -58,14 +61,14 @@ public static List Types(object @object, string path) List result = new List(); Type[] types = assembly.GetTypes(); - if(types == null || types.Length == 0) + if (types == null || types.Length == 0) { return result; } foreach (Type type in types) { - if(type.IsInstanceOfType(@object)) + if (type.IsInstanceOfType(@object)) { result.Add(type); } @@ -74,4 +77,4 @@ public static List Types(object @object, string path) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/UTC.cs b/SAM/SAM.Core/Query/UTC.cs index 5dfb190ff..528ceb79b 100644 --- a/SAM/SAM.Core/Query/UTC.cs +++ b/SAM/SAM.Core/Query/UTC.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -6,15 +9,15 @@ public static UTC UTC(float value) { return UTC(System.Convert.ToDouble(value)); } - + public static UTC UTC(double value) { - if(double.IsNaN(value)) + if (double.IsNaN(value)) { return Core.UTC.Undefined; } - switch(value) + switch (value) { case -12.0: return Core.UTC.Minus1200; @@ -133,26 +136,26 @@ public static UTC UTC(double value) public static UTC UTC(string value) { - if(string.IsNullOrWhiteSpace(value)) + if (string.IsNullOrWhiteSpace(value)) { return Core.UTC.Undefined; } - if(Core.UTC.Undefined.ToString().ToUpper().Equals(value.ToUpper().Trim())) + if (Core.UTC.Undefined.ToString().ToUpper().Equals(value.ToUpper().Trim())) { return Core.UTC.Undefined; } - + UTC result = Enum(value); - if(result != Core.UTC.Undefined) + if (result != Core.UTC.Undefined) { return result; } - if(TryConvert(value, out double @double)) + if (TryConvert(value, out double @double)) { result = UTC(@double); - if(result != Core.UTC.Undefined) + if (result != Core.UTC.Undefined) { return result; } @@ -161,4 +164,4 @@ public static UTC UTC(string value) return Core.UTC.Undefined; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/UniqueTypes.cs b/SAM/SAM.Core/Query/UniqueTypes.cs index e4077cb45..e5ae0ba1a 100644 --- a/SAM/SAM.Core/Query/UniqueTypes.cs +++ b/SAM/SAM.Core/Query/UniqueTypes.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Core @@ -11,7 +14,7 @@ public static HashSet UniqueTypes(this IEnumerable result = new HashSet(); - foreach(Attributes.AssociatedTypes parameterTypes_Temp in parameterTypes) + foreach (Attributes.AssociatedTypes parameterTypes_Temp in parameterTypes) { if (parameterTypes_Temp == null) continue; @@ -27,4 +30,4 @@ public static HashSet UniqueTypes(this IEnumerable UserFriendlyNames(this object @object) return result.ToList(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/UserSAMDirectory.cs b/SAM/SAM.Core/Query/UserSAMDirectory.cs index dca600182..da3fcd4b8 100644 --- a/SAM/SAM.Core/Query/UserSAMDirectory.cs +++ b/SAM/SAM.Core/Query/UserSAMDirectory.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -7,4 +10,4 @@ public static string UserSAMDirectory() return System.IO.Path.Combine(UserDocumentsDirectory(), "SAM"); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/UserSAMTemporaryDirectory.cs b/SAM/SAM.Core/Query/UserSAMTemporaryDirectory.cs index ee2a074cf..0adcde2c9 100644 --- a/SAM/SAM.Core/Query/UserSAMTemporaryDirectory.cs +++ b/SAM/SAM.Core/Query/UserSAMTemporaryDirectory.cs @@ -1,4 +1,7 @@ -using System.IO; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.IO; namespace SAM.Core { @@ -9,4 +12,4 @@ public static string UserSAMTemporaryDirectory() return Path.Combine(Path.GetTempPath(), "SAM"); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/ValidFileName.cs b/SAM/SAM.Core/Query/ValidFileName.cs index 515b8b8b8..594ae0c5d 100644 --- a/SAM/SAM.Core/Query/ValidFileName.cs +++ b/SAM/SAM.Core/Query/ValidFileName.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -10,4 +13,4 @@ public static bool ValidFileName(this string fileName) return fileName.IndexOfAny(System.IO.Path.GetInvalidFileNameChars()) < 0; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/ValidTypes.cs b/SAM/SAM.Core/Query/ValidTypes.cs index 0c2a78195..2a17d47b5 100644 --- a/SAM/SAM.Core/Query/ValidTypes.cs +++ b/SAM/SAM.Core/Query/ValidTypes.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -19,4 +22,4 @@ public static List ValidTypes(this Attributes.AssociatedTypes parameterTyp return result.ToList(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Value.cs b/SAM/SAM.Core/Query/Value.cs index 1dc942a4e..c87f7b898 100644 --- a/SAM/SAM.Core/Query/Value.cs +++ b/SAM/SAM.Core/Query/Value.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Xml.Linq; @@ -21,7 +24,7 @@ public static T Value(this Dictionary dictionary, string key) Type type = value.GetType(); if (type != typeof(T)) { - if(!typeof(T).IsAssignableFrom(type)) + if (!typeof(T).IsAssignableFrom(type)) { return default; } @@ -42,7 +45,7 @@ public static T Value(this XAttribute xAttribute) public static T Value(this XAttribute xAttribute, T defaultValue) { - if(!TryGetValue(xAttribute, out T result)) + if (!TryGetValue(xAttribute, out T result)) { return defaultValue; } @@ -50,4 +53,4 @@ public static T Value(this XAttribute xAttribute, T defaultValue) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/ValueType.cs b/SAM/SAM.Core/Query/ValueType.cs index 6df77a8ee..8de8d49a7 100644 --- a/SAM/SAM.Core/Query/ValueType.cs +++ b/SAM/SAM.Core/Query/ValueType.cs @@ -1,4 +1,7 @@ -using System.Drawing; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Drawing; namespace SAM.Core { @@ -6,22 +9,22 @@ public static partial class Query { public static ValueType ValueType(this object @object) { - if(@object == null) + if (@object == null) { return Core.ValueType.Undefined; } - if(@object is IJSAMObject) + if (@object is IJSAMObject) { return Core.ValueType.IJSAMObject; } - if(@object is int) + if (@object is int) { return Core.ValueType.Integer; } - if(@object is string) + if (@object is string) { return Core.ValueType.String; } @@ -31,17 +34,17 @@ public static ValueType ValueType(this object @object) return Core.ValueType.Double; } - if(@object is System.Guid) + if (@object is System.Guid) { return Core.ValueType.Guid; } - if(@object is bool) + if (@object is bool) { return Core.ValueType.Boolean; } - if(@object is Color) + if (@object is Color) { return Core.ValueType.Color; } @@ -54,4 +57,4 @@ public static ValueType ValueType(this object @object) return Core.ValueType.Undefined; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/VapourizationLatentHeat.cs b/SAM/SAM.Core/Query/VapourizationLatentHeat.cs index 2ddafde48..a9f274aa5 100644 --- a/SAM/SAM.Core/Query/VapourizationLatentHeat.cs +++ b/SAM/SAM.Core/Query/VapourizationLatentHeat.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -9,7 +12,7 @@ public static partial class Query /// Latent Heat of Vapourization [J/kg] public static double VapourizationLatentHeat(this double dryBulbTemperature) { - if(double.IsNaN(dryBulbTemperature) || dryBulbTemperature < -25 || dryBulbTemperature > 100) + if (double.IsNaN(dryBulbTemperature) || dryBulbTemperature < -25 || dryBulbTemperature > 100) { return double.NaN; } @@ -28,4 +31,4 @@ public static double VapourizationLatentHeat(this double dryBulbTemperature) return result * 1000; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/WaitToUnlock.cs b/SAM/SAM.Core/Query/WaitToUnlock.cs index 0e23451ed..7ab7e3c64 100644 --- a/SAM/SAM.Core/Query/WaitToUnlock.cs +++ b/SAM/SAM.Core/Query/WaitToUnlock.cs @@ -1,10 +1,13 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { public static bool WaitToUnlock(string path, int waitTime = 1000, int count = 10) { - if(string.IsNullOrWhiteSpace(path) || !System.IO.File.Exists(path)) + if (string.IsNullOrWhiteSpace(path) || !System.IO.File.Exists(path)) { return false; } @@ -14,9 +17,9 @@ public static bool WaitToUnlock(string path, int waitTime = 1000, int count = 10 bool result = false; int i = 0; - while(i <= count) + while (i <= count) { - if(!fileInfo.Locked()) + if (!fileInfo.Locked()) { result = true; break; @@ -27,4 +30,4 @@ public static bool WaitToUnlock(string path, int waitTime = 1000, int count = 10 return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Weekday.cs b/SAM/SAM.Core/Query/Weekday.cs index 7a8d83039..32acb4903 100644 --- a/SAM/SAM.Core/Query/Weekday.cs +++ b/SAM/SAM.Core/Query/Weekday.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -6,8 +9,8 @@ public static bool Weekday(this Week week) { if (week == Week.Undefined) return false; - + return !Weekend(week); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Weekend.cs b/SAM/SAM.Core/Query/Weekend.cs index c926882f7..2216e814d 100644 --- a/SAM/SAM.Core/Query/Weekend.cs +++ b/SAM/SAM.Core/Query/Weekend.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -7,4 +10,4 @@ public static bool Weekend(this Week week) return week == Week.Saturday || week == Week.Sunday; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/Write.cs b/SAM/SAM.Core/Query/Write.cs index b1159677b..f5825504c 100644 --- a/SAM/SAM.Core/Query/Write.cs +++ b/SAM/SAM.Core/Query/Write.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { @@ -12,4 +15,4 @@ public static bool Write(this IJSAMObject jSAMObject, string path) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Query/WriteAccess.cs b/SAM/SAM.Core/Query/WriteAccess.cs index b0e5184c5..1e8cf11f8 100644 --- a/SAM/SAM.Core/Query/WriteAccess.cs +++ b/SAM/SAM.Core/Query/WriteAccess.cs @@ -1,10 +1,13 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static partial class Query { public static bool WriteAccess(this AccessType accessType) { - switch(accessType) + switch (accessType) { case AccessType.Write: case AccessType.ReadWrite: @@ -14,4 +17,4 @@ public static bool WriteAccess(this AccessType accessType) } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Core/Variables/Link.cs b/SAM/SAM.Core/Variables/Link.cs index 589f58069..b7f04eab4 100644 --- a/SAM/SAM.Core/Variables/Link.cs +++ b/SAM/SAM.Core/Variables/Link.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { public static class Link { diff --git a/SAM/SAM.Core/Variables/Rounding.cs b/SAM/SAM.Core/Variables/Rounding.cs index c5c39ba86..829873eec 100644 --- a/SAM/SAM.Core/Variables/Rounding.cs +++ b/SAM/SAM.Core/Variables/Rounding.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { /// /// Represents a static class that defines various levels of rounding precision for distances and angles. diff --git a/SAM/SAM.Core/Variables/Tolerance.cs b/SAM/SAM.Core/Variables/Tolerance.cs index a3c198768..1d4865b7f 100644 --- a/SAM/SAM.Core/Variables/Tolerance.cs +++ b/SAM/SAM.Core/Variables/Tolerance.cs @@ -1,4 +1,7 @@ -namespace SAM.Core +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Core { /// /// This class provides methods for calculating tolerance values. @@ -25,4 +28,4 @@ public static class Tolerance /// public const double Angle = 0.0349066; } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Documentation/Samples/Query/Sample.cs b/SAM/SAM.Geometry/Documentation/Samples/Query/Sample.cs index dd8f0bb22..ca09240e6 100644 --- a/SAM/SAM.Geometry/Documentation/Samples/Query/Sample.cs +++ b/SAM/SAM.Geometry/Documentation/Samples/Query/Sample.cs @@ -1,8 +1,11 @@ -using System.Collections.Generic; -using System.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System; +using System.Collections.Generic; +using System.Linq; namespace SAM.Geometry.Object.Spatial { diff --git a/SAM/SAM.Geometry/Geometry/Base/Classes/Face.cs b/SAM/SAM.Geometry/Geometry/Base/Classes/Face.cs index 091fb70c0..edca21268 100644 --- a/SAM/SAM.Geometry/Geometry/Base/Classes/Face.cs +++ b/SAM/SAM.Geometry/Geometry/Base/Classes/Face.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Geometry.Planar; using System.Collections.Generic; @@ -97,24 +100,24 @@ public List Edge2Ds if (internalEdge2Ds != null) { - if(result == null) + if (result == null) { result = new List(); } - foreach(IClosed2D internalEdge2D in internalEdge2Ds) + foreach (IClosed2D internalEdge2D in internalEdge2Ds) { result.Add((IClosed2D)internalEdge2D.Clone()); } } - + return result; } } public double GetArea() { - if(externalEdge2D == null) + if (externalEdge2D == null) { return double.NaN; } @@ -226,7 +229,7 @@ public bool Inside(Point2D point2D, double tolerance = Core.Tolerance.Distance) { if (point2D == null || !point2D.IsValid()) return false; - + if (internalEdge2Ds == null || internalEdge2Ds.Count == 0) return externalEdge2D.Inside(point2D, tolerance) && !externalEdge2D.On(point2D, tolerance); @@ -267,14 +270,14 @@ public void Reverse() public override int GetHashCode() { int hash = 13; - + hash = (hash * 7) + externalEdge2D.GetHashCode(); - + if (internalEdge2Ds != null) foreach (IClosed2D internalEdge2D in internalEdge2Ds) hash = (hash * 7) + internalEdge2D.GetHashCode(); - + return hash; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Base/Classes/PointGraph.cs b/SAM/SAM.Geometry/Geometry/Base/Classes/PointGraph.cs index 8977b2a28..8a152cd2c 100644 --- a/SAM/SAM.Geometry/Geometry/Base/Classes/PointGraph.cs +++ b/SAM/SAM.Geometry/Geometry/Base/Classes/PointGraph.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using QuickGraph.Algorithms.Observers; using SAM.Core; using System; @@ -24,11 +27,11 @@ public PointGraph(double tolerance) public PointGraph(PointGraph pointGraph) { - if(pointGraph != null) + if (pointGraph != null) { tolerance = pointGraph.tolerance; - if(pointGraph.bidirectionalGraph != null) + if (pointGraph.bidirectionalGraph != null) { bidirectionalGraph = new QuickGraph.BidirectionalGraph>(); pointGraph.bidirectionalGraph.Vertices?.ToList().ForEach(x => bidirectionalGraph.AddVertex(Core.Query.Clone(x))); @@ -97,13 +100,13 @@ public bool Add(T jSAMObject, X source, X target) public bool Add(T jSAMObject, Func sourceFunc, Func targetFunc) { - if(sourceFunc == null || targetFunc == null) + if (sourceFunc == null || targetFunc == null) { return false; } X source = sourceFunc.Invoke(jSAMObject); - if(source == null) + if (source == null) { return false; } @@ -119,13 +122,13 @@ public bool Add(T jSAMObject, Func sourceFunc, Func targetFunc) public List AddRange(IEnumerable jSAMObjects, Func sourceFunc, Func targetFunc) { - if(jSAMObjects == null) + if (jSAMObjects == null) { return null; } List result = new List(); - foreach(T jSAMObject in jSAMObjects) + foreach (T jSAMObject in jSAMObjects) { result.Add(Add(jSAMObject, sourceFunc, targetFunc)); } @@ -180,7 +183,7 @@ public List GetPoints(int connectionsCount) List result = new List(); foreach (X point in bidirectionalGraph.Vertices) { - if(!TryGetPointGraphEdges(point, out List> pointGraphEdges) || pointGraphEdges == null) + if (!TryGetPointGraphEdges(point, out List> pointGraphEdges) || pointGraphEdges == null) { continue; } @@ -197,7 +200,7 @@ public List GetPoints(int connectionsCount) private bool TryGetPointGraphEdges(X point, out List> pointGraphEdges) { pointGraphEdges = null; - if(point == null || bidirectionalGraph == null || bidirectionalGraph.Edges == null) + if (point == null || bidirectionalGraph == null || bidirectionalGraph.Edges == null) { return false; } @@ -221,19 +224,19 @@ private bool TryGetPointGraphEdges(X point, out List> point public List GetConnectedJSAMObjects(X point) { X point_Temp = Find(point); - if(point_Temp == null) + if (point_Temp == null) { return null; } List> pointGraphs = Split>(); - if(pointGraphs == null || pointGraphs.Count == 0) + if (pointGraphs == null || pointGraphs.Count == 0) { return null; } PointGraph pointGraph = pointGraphs.Find(x => x.Find(point_Temp) != null); - if(pointGraph == null) + if (pointGraph == null) { return null; } @@ -243,32 +246,32 @@ public List GetConnectedJSAMObjects(X point) public List GetConnectedJSAMObjects(X start, X end) { - if(bidirectionalGraph == null || bidirectionalGraph.Edges == null || bidirectionalGraph.Vertices == null || bidirectionalGraph.Vertices.Count() == 0 || bidirectionalGraph.Edges.Count() == 0) + if (bidirectionalGraph == null || bidirectionalGraph.Edges == null || bidirectionalGraph.Vertices == null || bidirectionalGraph.Vertices.Count() == 0 || bidirectionalGraph.Edges.Count() == 0) { return null; } X start_Temp = Find(start); - if(start_Temp == null) + if (start_Temp == null) { return null; } X end_Temp = Find(end); - if(end_Temp == null) + if (end_Temp == null) { return null; } QuickGraph.AdjacencyGraph> adjacencyGraph = GetAdjacencyGraph(true); - if(adjacencyGraph == null) + if (adjacencyGraph == null) { return null; } QuickGraph.Algorithms.ShortestPath.FloydWarshallAllShortestPathAlgorithm> floydWarshallAllShortestPathAlgorithm = new QuickGraph.Algorithms.ShortestPath.FloydWarshallAllShortestPathAlgorithm>(adjacencyGraph, x => Weight(x)); floydWarshallAllShortestPathAlgorithm.Compute(); - if(!floydWarshallAllShortestPathAlgorithm.TryGetPath(start, end, out IEnumerable> pointGraphEdges) || pointGraphEdges == null) + if (!floydWarshallAllShortestPathAlgorithm.TryGetPath(start, end, out IEnumerable> pointGraphEdges) || pointGraphEdges == null) { return null; } @@ -308,7 +311,7 @@ public List GetConnectedJSAMObjectsShortestPath(X point) dijkstraShortestPathAlgorithm.Compute(point_Temp); - if(vertexPredecessorPathRecorderObserver.VertexPredecessors == null || vertexPredecessorPathRecorderObserver.VertexPredecessors.Count == 0) + if (vertexPredecessorPathRecorderObserver.VertexPredecessors == null || vertexPredecessorPathRecorderObserver.VertexPredecessors.Count == 0) { return null; } @@ -318,13 +321,13 @@ public List GetConnectedJSAMObjectsShortestPath(X point) public QuickGraph.UndirectedGraph> GetUndirectedGraph() { - if(bidirectionalGraph == null) + if (bidirectionalGraph == null) { return null; } QuickGraph.UndirectedGraph> result = new QuickGraph.UndirectedGraph>(); - if(bidirectionalGraph.Edges != null && bidirectionalGraph.Edges.Count() != 0) + if (bidirectionalGraph.Edges != null && bidirectionalGraph.Edges.Count() != 0) { result.AddVerticesAndEdgeRange(bidirectionalGraph.Edges); } @@ -334,7 +337,7 @@ public QuickGraph.UndirectedGraph> GetUndirectedGraph() public QuickGraph.AdjacencyGraph> GetAdjacencyGraph(bool parallelEdges = true) { - if(bidirectionalGraph == null || bidirectionalGraph.Edges == null) + if (bidirectionalGraph == null || bidirectionalGraph.Edges == null) { return null; } @@ -343,7 +346,7 @@ public QuickGraph.AdjacencyGraph> GetAdjacencyGraph(bool foreach (PointGraphEdge point3DGraphEdge in bidirectionalGraph.Edges) { result.AddVerticesAndEdge(point3DGraphEdge); - if(parallelEdges) + if (parallelEdges) { result.AddVerticesAndEdge(new PointGraphEdge(point3DGraphEdge.JSAMObject, point3DGraphEdge.Target, point3DGraphEdge.Source)); } @@ -354,13 +357,13 @@ public QuickGraph.AdjacencyGraph> GetAdjacencyGraph(bool public List Split() where Z : PointGraph { - if(bidirectionalGraph == null || bidirectionalGraph.Edges == null ||bidirectionalGraph.Edges.Count() <= 1 || bidirectionalGraph.Vertices == null || bidirectionalGraph.Vertices.Count() <= 2) + if (bidirectionalGraph == null || bidirectionalGraph.Edges == null || bidirectionalGraph.Edges.Count() <= 1 || bidirectionalGraph.Vertices == null || bidirectionalGraph.Vertices.Count() <= 2) { return new List { Core.Query.Clone(this) as Z }; } QuickGraph.UndirectedGraph> undirectedGraph = GetUndirectedGraph(); - if(undirectedGraph == null) + if (undirectedGraph == null) { return new List { Core.Query.Clone(this) as Z }; } @@ -369,32 +372,32 @@ public List Split() where Z : PointGraph connectedComponentsAlgorithm.Compute(); int count = connectedComponentsAlgorithm.ComponentCount; - if(count <= 1) + if (count <= 1) { return new List { Core.Query.Clone(this) as Z }; } IDictionary dictionary_Temp = connectedComponentsAlgorithm.Components; - if(dictionary_Temp == null || dictionary_Temp.Count == 0) + if (dictionary_Temp == null || dictionary_Temp.Count == 0) { return new List { Core.Query.Clone(this) as Z }; } Dictionary>> dictionary = new Dictionary>>(); - foreach(KeyValuePair keyValuePair in dictionary_Temp) + foreach (KeyValuePair keyValuePair in dictionary_Temp) { - if(!dictionary.TryGetValue(keyValuePair.Value, out List> pointGraphEdges) || pointGraphEdges == null) + if (!dictionary.TryGetValue(keyValuePair.Value, out List> pointGraphEdges) || pointGraphEdges == null) { pointGraphEdges = new List>(); dictionary[keyValuePair.Value] = pointGraphEdges; } - if(TryGetPointGraphEdges(keyValuePair.Key, out List> pointGraphEdges_Point) && pointGraphEdges != null) + if (TryGetPointGraphEdges(keyValuePair.Key, out List> pointGraphEdges_Point) && pointGraphEdges != null) { - foreach(PointGraphEdge pointGraphEdge in pointGraphEdges_Point) + foreach (PointGraphEdge pointGraphEdge in pointGraphEdges_Point) { - if(!pointGraphEdges.Contains(pointGraphEdge)) + if (!pointGraphEdges.Contains(pointGraphEdge)) { pointGraphEdges.Add(pointGraphEdge); } @@ -408,7 +411,7 @@ public List Split() where Z : PointGraph Z pointGraph = Core.Query.Clone(this) as Z; pointGraph.bidirectionalGraph = new QuickGraph.BidirectionalGraph>(); pointGraph.bidirectionalGraph.AddVerticesAndEdgeRange(point3DGraphEdges_Temp); - + result.Add(pointGraph); } @@ -508,4 +511,4 @@ public virtual JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Base/Classes/PointGraphEdge.cs b/SAM/SAM.Geometry/Geometry/Base/Classes/PointGraphEdge.cs index fdedcaa75..d975912cc 100644 --- a/SAM/SAM.Geometry/Geometry/Base/Classes/PointGraphEdge.cs +++ b/SAM/SAM.Geometry/Geometry/Base/Classes/PointGraphEdge.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Geometry @@ -23,7 +26,7 @@ public PointGraphEdge(JObject jObject) public PointGraphEdge(PointGraphEdge pointGraphEdge) { - if(pointGraphEdge != null) + if (pointGraphEdge != null) { jSAMObject = pointGraphEdge.jSAMObject; source = pointGraphEdge.source == null ? default : Core.Query.Clone(pointGraphEdge.source); @@ -57,17 +60,17 @@ public T JSAMObject public bool FromJObject(JObject jObject) { - if(jObject == null) + if (jObject == null) { return false; } - if(jObject.ContainsKey("JSAMObject")) + if (jObject.ContainsKey("JSAMObject")) { jSAMObject = Core.Query.IJSAMObject(jObject.Value("JSAMObject")); } - if(jObject.ContainsKey("Source")) + if (jObject.ContainsKey("Source")) { source = Core.Query.IJSAMObject(jObject.Value("Source")); } @@ -103,4 +106,4 @@ public JObject ToJObject() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Base/Classes/SAMGeometry.cs b/SAM/SAM.Geometry/Geometry/Base/Classes/SAMGeometry.cs index 2f7424026..6b7b5d4a2 100644 --- a/SAM/SAM.Geometry/Geometry/Base/Classes/SAMGeometry.cs +++ b/SAM/SAM.Geometry/Geometry/Base/Classes/SAMGeometry.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Geometry { @@ -24,4 +27,4 @@ public virtual JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Base/Create/ISAMGeometries.cs b/SAM/SAM.Geometry/Geometry/Base/Create/ISAMGeometries.cs index edecf8d5a..659134b0c 100644 --- a/SAM/SAM.Geometry/Geometry/Base/Create/ISAMGeometries.cs +++ b/SAM/SAM.Geometry/Geometry/Base/Create/ISAMGeometries.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; namespace SAM.Geometry @@ -10,4 +13,4 @@ public static List ISAMGeometries(this JArray jArray) where T : ISAMGeomet return Core.Create.IJSAMObjects(jArray); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Base/Create/ISAMGeometry.cs b/SAM/SAM.Geometry/Geometry/Base/Create/ISAMGeometry.cs index 3f95a61db..beb34960f 100644 --- a/SAM/SAM.Geometry/Geometry/Base/Create/ISAMGeometry.cs +++ b/SAM/SAM.Geometry/Geometry/Base/Create/ISAMGeometry.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Geometry { @@ -14,4 +17,4 @@ public static T ISAMGeometry(this JObject jObject) where T : ISAMGeometry return Core.Create.IJSAMObject(jObject); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Base/Create/JArray.cs b/SAM/SAM.Geometry/Geometry/Base/Create/JArray.cs index 580d89bf0..415754458 100644 --- a/SAM/SAM.Geometry/Geometry/Base/Create/JArray.cs +++ b/SAM/SAM.Geometry/Geometry/Base/Create/JArray.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; namespace SAM.Geometry @@ -29,4 +32,4 @@ public static JArray JArray(this IEnumerable sAMGeometries) where T : ISAM return jArray; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Base/Enums/Alignment.cs b/SAM/SAM.Geometry/Geometry/Base/Enums/Alignment.cs index a6bdbcf45..b103a7317 100644 --- a/SAM/SAM.Geometry/Geometry/Base/Enums/Alignment.cs +++ b/SAM/SAM.Geometry/Geometry/Base/Enums/Alignment.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry { public enum Alignment { @@ -6,4 +9,4 @@ public enum Alignment Horizontal, Vertical } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Base/Enums/AlignmentPoint.cs b/SAM/SAM.Geometry/Geometry/Base/Enums/AlignmentPoint.cs index e459ca062..0e6b6e29a 100644 --- a/SAM/SAM.Geometry/Geometry/Base/Enums/AlignmentPoint.cs +++ b/SAM/SAM.Geometry/Geometry/Base/Enums/AlignmentPoint.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Geometry { @@ -10,4 +13,4 @@ public enum AlignmentPoint [Description("Mid")] Mid, [Description("End")] End, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Base/Enums/Corner.cs b/SAM/SAM.Geometry/Geometry/Base/Enums/Corner.cs index 30cf4de64..dfcf16cef 100644 --- a/SAM/SAM.Geometry/Geometry/Base/Enums/Corner.cs +++ b/SAM/SAM.Geometry/Geometry/Base/Enums/Corner.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry { public enum Corner { @@ -8,4 +11,4 @@ public enum Corner TopRight, TopLeft } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Base/Enums/Dimension.cs b/SAM/SAM.Geometry/Geometry/Base/Enums/Dimension.cs index 3c087dfd5..93723eee9 100644 --- a/SAM/SAM.Geometry/Geometry/Base/Enums/Dimension.cs +++ b/SAM/SAM.Geometry/Geometry/Base/Enums/Dimension.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Geometry { @@ -10,4 +13,4 @@ public enum Dimension [Description("Y")] Y, [Description("Z")] Z, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Base/Enums/EdgeOrientationMethod.cs b/SAM/SAM.Geometry/Geometry/Base/Enums/EdgeOrientationMethod.cs index 151a57bbd..4d6d05276 100644 --- a/SAM/SAM.Geometry/Geometry/Base/Enums/EdgeOrientationMethod.cs +++ b/SAM/SAM.Geometry/Geometry/Base/Enums/EdgeOrientationMethod.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Geometry { @@ -9,4 +12,4 @@ public enum EdgeOrientationMethod [Description("Similar")] Similar, [Description("Opposite")] Opposite, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Base/Enums/LineFormulaForm.cs b/SAM/SAM.Geometry/Geometry/Base/Enums/LineFormulaForm.cs index 2b9675ab3..2dae02f41 100644 --- a/SAM/SAM.Geometry/Geometry/Base/Enums/LineFormulaForm.cs +++ b/SAM/SAM.Geometry/Geometry/Base/Enums/LineFormulaForm.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry { public enum LineFormulaForm { @@ -7,4 +10,4 @@ public enum LineFormulaForm Parameteric, Symmetric } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Base/Enums/Orientation.cs b/SAM/SAM.Geometry/Geometry/Base/Enums/Orientation.cs index c2177aec8..a940e0ebe 100644 --- a/SAM/SAM.Geometry/Geometry/Base/Enums/Orientation.cs +++ b/SAM/SAM.Geometry/Geometry/Base/Enums/Orientation.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry { public enum Orientation { @@ -7,4 +10,4 @@ public enum Orientation Clockwise, CounterClockwise } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Base/Enums/Padding.cs b/SAM/SAM.Geometry/Geometry/Base/Enums/Padding.cs index 543dd705c..32ae49621 100644 --- a/SAM/SAM.Geometry/Geometry/Base/Enums/Padding.cs +++ b/SAM/SAM.Geometry/Geometry/Base/Enums/Padding.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Geometry { @@ -10,4 +13,4 @@ public enum Padding [Description("Top")] Top, [Description("Bottom")] Bottom } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Base/Enums/PointConnectMethod.cs b/SAM/SAM.Geometry/Geometry/Base/Enums/PointConnectMethod.cs index c6e53a3f8..c8111f2c7 100644 --- a/SAM/SAM.Geometry/Geometry/Base/Enums/PointConnectMethod.cs +++ b/SAM/SAM.Geometry/Geometry/Base/Enums/PointConnectMethod.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry { public enum PointConnectMethod { @@ -6,4 +9,4 @@ public enum PointConnectMethod Ends, Projection } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Base/Enums/VerticalPosition.cs b/SAM/SAM.Geometry/Geometry/Base/Enums/VerticalPosition.cs index 347940bb4..9f81db834 100644 --- a/SAM/SAM.Geometry/Geometry/Base/Enums/VerticalPosition.cs +++ b/SAM/SAM.Geometry/Geometry/Base/Enums/VerticalPosition.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry { public enum VerticalPosition { @@ -7,4 +10,4 @@ public enum VerticalPosition Below, On } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Base/Interfaces/IMesh.cs b/SAM/SAM.Geometry/Geometry/Base/Interfaces/IMesh.cs index eaadac16b..e0f36f558 100644 --- a/SAM/SAM.Geometry/Geometry/Base/Interfaces/IMesh.cs +++ b/SAM/SAM.Geometry/Geometry/Base/Interfaces/IMesh.cs @@ -1,8 +1,11 @@ -namespace SAM.Geometry +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry { public interface IMesh { int TrianglesCount { get; } int PointsCount { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Base/Interfaces/IPoint.cs b/SAM/SAM.Geometry/Geometry/Base/Interfaces/IPoint.cs index 02faec163..69581b754 100644 --- a/SAM/SAM.Geometry/Geometry/Base/Interfaces/IPoint.cs +++ b/SAM/SAM.Geometry/Geometry/Base/Interfaces/IPoint.cs @@ -1,7 +1,10 @@ -namespace SAM.Geometry +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry { public interface IPoint : ISAMGeometry { } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Base/Interfaces/IReversible.cs b/SAM/SAM.Geometry/Geometry/Base/Interfaces/IReversible.cs index 225d0cb54..e2dc10e4d 100644 --- a/SAM/SAM.Geometry/Geometry/Base/Interfaces/IReversible.cs +++ b/SAM/SAM.Geometry/Geometry/Base/Interfaces/IReversible.cs @@ -1,7 +1,10 @@ -namespace SAM.Geometry +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry { public interface IReversible { void Reverse(); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Base/Interfaces/ISAMGeometry.cs b/SAM/SAM.Geometry/Geometry/Base/Interfaces/ISAMGeometry.cs index 6ea1357b6..3b248b8e3 100644 --- a/SAM/SAM.Geometry/Geometry/Base/Interfaces/ISAMGeometry.cs +++ b/SAM/SAM.Geometry/Geometry/Base/Interfaces/ISAMGeometry.cs @@ -1,7 +1,10 @@ -namespace SAM.Geometry +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry { public interface ISAMGeometry : Core.IJSAMObject { ISAMGeometry Clone(); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Base/Query/Opposite.cs b/SAM/SAM.Geometry/Geometry/Base/Query/Opposite.cs index 2b8c8fa2b..78fb214d6 100644 --- a/SAM/SAM.Geometry/Geometry/Base/Query/Opposite.cs +++ b/SAM/SAM.Geometry/Geometry/Base/Query/Opposite.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry { public static partial class Query { @@ -91,4 +94,4 @@ public static Corner Opposite(this Corner corner, Alignment alignment = Alignmen return Corner.Undefined; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Classes/BoundingBox2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Classes/BoundingBox2D.cs index 89469365e..663e03027 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Classes/BoundingBox2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Classes/BoundingBox2D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; @@ -469,4 +472,4 @@ public bool Transform(ITransform2D transform2D) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Classes/Circle2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Classes/Circle2D.cs index e45766358..0692089e6 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Classes/Circle2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Classes/Circle2D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Geometry.Planar @@ -171,13 +174,13 @@ public ISAMGeometry2D GetTransformed(ITransform2D transform2D) public bool Transform(ITransform2D transform2D) { - if(transform2D == null) + if (transform2D == null) { return false; } Circle2D circle2D = Query.Transform(this, transform2D); - if(circle2D == null) + if (circle2D == null) { return false; } @@ -187,4 +190,4 @@ public bool Transform(ITransform2D transform2D) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Classes/ConvexHullComparer.cs b/SAM/SAM.Geometry/Geometry/Planar/Classes/ConvexHullComparer.cs index 059d07e1c..ebd10ea12 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Classes/ConvexHullComparer.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Classes/ConvexHullComparer.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -18,4 +21,4 @@ public int Compare(Point2D point2D_1, Point2D point2D_2) return 0; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Classes/CoordinateSystem2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Classes/CoordinateSystem2D.cs index 36d038e74..2f9dbe6b9 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Classes/CoordinateSystem2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Classes/CoordinateSystem2D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Geometry.Planar @@ -37,7 +40,7 @@ public CoordinateSystem2D(JObject jObject) public CoordinateSystem2D(CoordinateSystem2D coordinateSystem2D) { - if(coordinateSystem2D != null) + if (coordinateSystem2D != null) { origin = coordinateSystem2D.origin; axisX = coordinateSystem2D.axisX; @@ -76,7 +79,7 @@ public CoordinateSystem2D GetMoved(Vector2D vector2D) public bool Move(Vector2D vector2D) { - if(origin == null || vector2D == null) + if (origin == null || vector2D == null) { return false; } @@ -93,12 +96,12 @@ public bool IsValid() public bool FromJObject(JObject jObject) { - if(jObject == null) + if (jObject == null) { return false; } - if(jObject.ContainsKey("AxisX")) + if (jObject.ContainsKey("AxisX")) { axisX = new Vector2D(jObject.Value("AxisX")); } @@ -141,7 +144,7 @@ public JObject ToJObject() public CoordinateSystem2D GetTransformed(ITransform2D transform2D) { - if(transform2D == null) + if (transform2D == null) { return null; } @@ -167,4 +170,4 @@ public static CoordinateSystem2D World } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Classes/Ellipse2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Classes/Ellipse2D.cs index 8b4ec4915..d1b8c6224 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Classes/Ellipse2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Classes/Ellipse2D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Geometry.Planar @@ -188,13 +191,13 @@ public ISAMGeometry2D GetTransformed(ITransform2D transform2D) public bool Transform(ITransform2D transform2D) { - if(transform2D == null) + if (transform2D == null) { return false; } Ellipse2D ellipse2D = GetTransformed(transform2D) as Ellipse2D; - if(ellipse2D == null) + if (ellipse2D == null) { return false; } @@ -206,4 +209,4 @@ public bool Transform(ITransform2D transform2D) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Classes/Face2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Classes/Face2D.cs index 08dbe9aa6..507c1abff 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Classes/Face2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Classes/Face2D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; using System.Linq; @@ -256,13 +259,13 @@ public ISAMGeometry2D GetTransformed(ITransform2D transform2D) public bool Transform(ITransform2D transform2D) { - if(transform2D == null) + if (transform2D == null) { return false; } Face2D face2D = Query.Transform(this, transform2D); - if(face2D == null) + if (face2D == null) { return false; } @@ -272,4 +275,4 @@ public bool Transform(ITransform2D transform2D) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Classes/Line2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Classes/Line2D.cs index fcdc17362..0db71397a 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Classes/Line2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Classes/Line2D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Math; using System; @@ -137,7 +140,7 @@ public string ToString(LineFormulaForm lineFormulaForm) public Point2D Intersection(Line2D line2D, double tolerance = Core.Tolerance.Distance) { - if(line2D == null) + if (line2D == null) { return null; } @@ -152,8 +155,8 @@ public Point2D Intersection(Segment2D segment2D, double tolerance = Core.Toleran return null; } - Point2D point2D = Query.Intersection(origin, origin.GetMoved(vector), segment2D.Start, segment2D.End, false, tolerance); - if(point2D == null) + Point2D point2D = Query.Intersection(origin, origin.GetMoved(vector), segment2D.Start, segment2D.End, false, tolerance); + if (point2D == null) { return null; } @@ -172,7 +175,7 @@ public ISAMGeometry2D GetTransformed(ITransform2D transform2D) public bool Transform(ITransform2D transform2D) { - if(transform2D == null) + if (transform2D == null) { return false; } @@ -183,4 +186,4 @@ public bool Transform(ITransform2D transform2D) } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Classes/Mesh2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Classes/Mesh2D.cs index ca4bcfcc9..016bbb53c 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Classes/Mesh2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Classes/Mesh2D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; @@ -289,7 +292,7 @@ public int IndexOf(Point2D point2D, double tolerance) public List> GetIndexes() { - if(indexes == null) + if (indexes == null) { return null; } @@ -394,7 +397,7 @@ public ISAMGeometry2D GetTransformed(ITransform2D transform2D) public bool Transform(ITransform2D transform2D) { - if(transform2D == null) + if (transform2D == null) { return false; } @@ -403,4 +406,4 @@ public bool Transform(ITransform2D transform2D) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Classes/Point2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Classes/Point2D.cs index 6380b37b1..f90496e60 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Classes/Point2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Classes/Point2D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -234,7 +237,7 @@ public Point2D GetScaled(Point2D point2D, double factor) if (factor == 1) { - return new Point2D( point2D.coordinates[0], point2D.coordinates[1]); + return new Point2D(point2D.coordinates[0], point2D.coordinates[1]); } Vector2D vector2D = Vector(point2D); @@ -259,7 +262,7 @@ public Point2D GetScaledX(double factor) point2D.ScaleX(factor); return point2D; } - + public Point2D GetScaledY(double factor) { Point2D point2D = new Point2D(this); @@ -267,7 +270,7 @@ public Point2D GetScaledY(double factor) point2D.ScaleY(factor); return point2D; } - + public bool IsNaN() { return double.IsNaN(coordinates[0]) || double.IsNaN(coordinates[1]); @@ -338,15 +341,15 @@ public void Scale(double factor) coordinates[0] = coordinates[0] * factor; coordinates[1] = coordinates[1] * factor; } - + public void ScaleX(double factor) { if (factor == 1) return; - coordinates[0] *= factor; + coordinates[0] *= factor; } - + public void ScaleY(double factor) { if (factor == 1) @@ -401,13 +404,13 @@ public ISAMGeometry2D GetTransformed(ITransform2D transform2D) public bool Transform(ITransform2D transform2D) { - if(transform2D == null) + if (transform2D == null) { return false; } Point2D point2D = Query.Transform(this, transform2D); - if(point2D == null) + if (point2D == null) { return false; } @@ -417,4 +420,4 @@ public bool Transform(ITransform2D transform2D) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Classes/Point2DGraph.cs b/SAM/SAM.Geometry/Geometry/Planar/Classes/Point2DGraph.cs index 35d1e4e9d..98c8d4c6c 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Classes/Point2DGraph.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Classes/Point2DGraph.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections.Generic; @@ -59,4 +62,4 @@ protected override double Weight(PointGraphEdge pointGraphEdge) return pointGraphEdge.Source.Distance(pointGraphEdge.Target); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Classes/Polycurve2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Classes/Polycurve2D.cs index 6eb343be8..caa485807 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Classes/Polycurve2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Classes/Polycurve2D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; using System.Linq; @@ -141,4 +144,4 @@ public bool Transform(ITransform2D transform2D) throw new System.NotImplementedException(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Classes/PolycurveLoop2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Classes/PolycurveLoop2D.cs index 37e09ae0f..a11a0f4b4 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Classes/PolycurveLoop2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Classes/PolycurveLoop2D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; @@ -115,4 +118,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Classes/Polygon2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Classes/Polygon2D.cs index 3bdd17262..cee52c089 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Classes/Polygon2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Classes/Polygon2D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections; using System.Collections.Generic; @@ -14,7 +17,7 @@ public Polygon2D(IEnumerable points) { this.points = Query.Clone(points); - if(this.points != null && this.points.Count > 2) + if (this.points != null && this.points.Count > 2) { if (this.points.Last().Equals(this.points.First())) this.points.RemoveAt(this.points.Count - 1); @@ -338,7 +341,7 @@ public ISAMGeometry2D GetTransformed(ITransform2D transform2D) public Polygon2D GetMoved(Vector2D vector2D) { - if(vector2D == null || points == null) + if (vector2D == null || points == null) { return null; } @@ -363,4 +366,4 @@ public bool Transform(ITransform2D transform2D) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Classes/Polyline2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Classes/Polyline2D.cs index f14747dde..b7ffc59aa 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Classes/Polyline2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Classes/Polyline2D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections; using System.Collections.Generic; using System.Linq; @@ -11,7 +14,7 @@ public class Polyline2D : SAMGeometry, IBoundable2D, ISegmentable2D, IEnumerable public Polyline2D(IEnumerable point2Ds, bool close = false) { - if(point2Ds != null) + if (point2Ds != null) { points = Query.Clone(point2Ds); if (close && !IsClosed()) @@ -23,7 +26,7 @@ public Polyline2D(IEnumerable point2Ds, bool close = false) public Polyline2D(IEnumerable segment2Ds) { - if(segment2Ds != null && segment2Ds.Count() != 0) + if (segment2Ds != null && segment2Ds.Count() != 0) { points = new List() { segment2Ds.ElementAt(0).GetStart() }; foreach (Segment2D segment2D in segment2Ds) @@ -387,7 +390,7 @@ public ISAMGeometry2D GetTransformed(ITransform2D transform2D) public Polyline2D GetMoved(Vector2D vector2D) { - if(vector2D == null || points == null) + if (vector2D == null || points == null) { return null; } @@ -397,13 +400,13 @@ public Polyline2D GetMoved(Vector2D vector2D) public bool Transform(ITransform2D transform2D) { - if(transform2D == null) + if (transform2D == null) { return false; } Polyline2D polyline2D = Query.Transform(this, transform2D); - if(polyline2D == null) + if (polyline2D == null) { return false; } @@ -412,4 +415,4 @@ public bool Transform(ITransform2D transform2D) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Classes/Rectangle2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Classes/Rectangle2D.cs index cabaea131..3ea08e85e 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Classes/Rectangle2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Classes/Rectangle2D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; @@ -326,13 +329,13 @@ public ISAMGeometry2D GetTransformed(ITransform2D transform2D) public bool Transform(ITransform2D transform2D) { - if(transform2D == null) + if (transform2D == null) { return false; } Rectangle2D rectangle2D = Query.Transform(this, transform2D); - if(rectangle2D == null) + if (rectangle2D == null) { return false; } @@ -344,4 +347,4 @@ public bool Transform(ITransform2D transform2D) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Classes/SAMGeometry2DGroup.cs b/SAM/SAM.Geometry/Geometry/Planar/Classes/SAMGeometry2DGroup.cs index 8dc89088f..2a62464c3 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Classes/SAMGeometry2DGroup.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Classes/SAMGeometry2DGroup.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections; using System.Collections.Generic; using System.Linq; @@ -17,7 +20,7 @@ public SAMGeometry2DGroup() public SAMGeometry2DGroup(SAMGeometry2DGroup sAMGeometry2DGroup) { - if(sAMGeometry2DGroup != null) + if (sAMGeometry2DGroup != null) { coordinateSystem2D = sAMGeometry2DGroup.coordinateSystem2D == null ? null : new CoordinateSystem2D(sAMGeometry2DGroup.coordinateSystem2D); sAMGeometry2Ds = sAMGeometry2DGroup.sAMGeometry2Ds?.ConvertAll(x => x?.Clone() as ISAMGeometry2D); @@ -26,7 +29,7 @@ public SAMGeometry2DGroup(SAMGeometry2DGroup sAMGeometry2DGroup) public SAMGeometry2DGroup(CoordinateSystem2D coordinateSystem2D) { - this.coordinateSystem2D = coordinateSystem2D == null ? null : new CoordinateSystem2D(coordinateSystem2D); + this.coordinateSystem2D = coordinateSystem2D == null ? null : new CoordinateSystem2D(coordinateSystem2D); } private SAMGeometry2DGroup(CoordinateSystem2D coordinateSystem2D, IEnumerable sAMGeometry2Ds) @@ -38,7 +41,7 @@ private SAMGeometry2DGroup(CoordinateSystem2D coordinateSystem2D, IEnumerable sAMGeometry2Ds) { coordinateSystem2D = CoordinateSystem2D.World; - this.sAMGeometry2Ds = sAMGeometry2Ds == null ? null : sAMGeometry2Ds.ToList().ConvertAll(x => x.Clone() as ISAMGeometry2D); + this.sAMGeometry2Ds = sAMGeometry2Ds == null ? null : sAMGeometry2Ds.ToList().ConvertAll(x => x.Clone() as ISAMGeometry2D); } public SAMGeometry2DGroup(JObject jObject) @@ -48,18 +51,18 @@ public SAMGeometry2DGroup(JObject jObject) public bool Add(ISAMGeometry2D sAMGeometry2D) { - if(sAMGeometry2D == null || coordinateSystem2D == null) + if (sAMGeometry2D == null || coordinateSystem2D == null) { return false; } Transform2D transform2D = Transform2D.GetCoordinateSystem2DToCoordinateSystem2D(CoordinateSystem2D.World, coordinateSystem2D); - if(transform2D == null) + if (transform2D == null) { return false; } - if(sAMGeometry2Ds == null) + if (sAMGeometry2Ds == null) { sAMGeometry2Ds = new List(); } @@ -72,7 +75,7 @@ public int Count { get { - if(sAMGeometry2Ds == null) + if (sAMGeometry2Ds == null) { return -1; } @@ -92,7 +95,7 @@ public ISAMGeometry2D this[int index] set { - if(value == null) + if (value == null) { sAMGeometry2Ds[index] = null; return; @@ -110,23 +113,23 @@ public ISAMGeometry Clone() public virtual bool FromJObject(JObject jObject) { - if(jObject == null) + if (jObject == null) { return false; } - if(jObject.ContainsKey("CoordinateSystem2D")) + if (jObject.ContainsKey("CoordinateSystem2D")) { coordinateSystem2D = new CoordinateSystem2D(jObject.Value("CoordinateSystem2D")); } - if(jObject.ContainsKey("SAMGeometry2Ds")) + if (jObject.ContainsKey("SAMGeometry2Ds")) { JArray jArray = jObject.Value("SAMGeometry2Ds"); - if(jArray != null) + if (jArray != null) { sAMGeometry2Ds = new List(); - foreach(JObject jObject_Temp in jArray) + foreach (JObject jObject_Temp in jArray) { sAMGeometry2Ds.Add(Core.Query.IJSAMObject(jObject_Temp)); } @@ -139,7 +142,7 @@ public virtual bool FromJObject(JObject jObject) public IEnumerator GetEnumerator() { List sAMGeometry2Ds_Temp = new List(); - if(sAMGeometry2Ds != null) + if (sAMGeometry2Ds != null) { Transform2D transform2D = Transform2D.GetCoordinateSystem2DToCoordinateSystem2D(coordinateSystem2D, CoordinateSystem2D.World); foreach (ISAMGeometry2D sAMGeometry2D in sAMGeometry2Ds) @@ -153,7 +156,7 @@ public IEnumerator GetEnumerator() public ISAMGeometry2D GetMoved(Vector2D vector2D) { - if(vector2D == null) + if (vector2D == null) { return null; } @@ -165,7 +168,7 @@ public ISAMGeometry2D GetMoved(Vector2D vector2D) public ISAMGeometry2D GetTransformed(ITransform2D transform2D) { - if(transform2D == null) + if (transform2D == null) { return null; } @@ -183,7 +186,7 @@ public bool Transform(ITransform2D transform2D) } coordinateSystem2D = coordinateSystem2D.Transform(transform2D); - return true; + return true; } public virtual JObject ToJObject() @@ -191,17 +194,17 @@ public virtual JObject ToJObject() JObject result = new JObject(); result.Add("_type", Core.Query.FullTypeName(this)); - if(coordinateSystem2D != null) + if (coordinateSystem2D != null) { result.Add("CoordinateSystem2D", coordinateSystem2D.ToJObject()); } - if(sAMGeometry2Ds != null) + if (sAMGeometry2Ds != null) { JArray jArray = new JArray(); - foreach(ISAMGeometry2D sAMGeometry3D in sAMGeometry2Ds) + foreach (ISAMGeometry2D sAMGeometry3D in sAMGeometry2Ds) { - if(sAMGeometry3D == null) + if (sAMGeometry3D == null) { continue; } @@ -220,4 +223,4 @@ IEnumerator IEnumerable.GetEnumerator() return GetEnumerator(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Classes/Segment2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Classes/Segment2D.cs index 9be3167fe..6b92270a2 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Classes/Segment2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Classes/Segment2D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; @@ -476,7 +479,7 @@ public Point2D Intersection(Segment2D segment2D, out Point2D point2D_Closest1, o /// Intersection Point2D public Point2D Intersection(Segment2D segment2D, bool bounded = true, double tolerance = Core.Tolerance.Distance) { - if(segment2D == null) + if (segment2D == null) { return null; } @@ -648,7 +651,7 @@ public ISAMGeometry2D GetTransformed(ITransform2D transform2D) public bool Move(Vector2D vector2D) { - if(vector2D == null || origin == null) + if (vector2D == null || origin == null) { return false; } @@ -659,13 +662,13 @@ public bool Move(Vector2D vector2D) public bool Transform(ITransform2D transform2D) { - if(transform2D == null) + if (transform2D == null) { return false; } Segment2D segment2D = Query.Transform(this, transform2D); - if(segment2D == null) + if (segment2D == null) { return false; } @@ -676,4 +679,4 @@ public bool Transform(ITransform2D transform2D) } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Classes/Solver2D/Solver2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Classes/Solver2D/Solver2D.cs index 00c1fe109..afc31bc8c 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Classes/Solver2D/Solver2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Classes/Solver2D/Solver2D.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -13,15 +16,15 @@ public Solver2D(IClosed2D area, List obstacles2D) this.area = area; this.obstacles2D = obstacles2D; } - + public bool Add(Solver2DData solver2DData) { - if(solver2DData == null || solver2DData.Geometry2D() == null || solver2DData.Closed2D() == null) + if (solver2DData == null || solver2DData.Geometry2D() == null || solver2DData.Closed2D() == null) { return false; } - if(solver2DDatas == null) + if (solver2DDatas == null) { solver2DDatas = new List(); } @@ -31,7 +34,7 @@ public bool Add(Solver2DData solver2DData) } public bool AddRange(List solver2DDatas) { - if(solver2DDatas == null) + if (solver2DDatas == null) { return false; } @@ -80,7 +83,7 @@ public List Solve() if (area.Inside(rectangleTemp) && !intersect(rectangleTemp, result)) { - if(solver2DSettings.LimitArea != null && !solver2DSettings.LimitArea.Inside(rectangleTemp.GetCentroid())) + if (solver2DSettings.LimitArea != null && !solver2DSettings.LimitArea.Inside(rectangleTemp.GetCentroid())) { continue; } @@ -212,7 +215,7 @@ private Rectangle2D fix(Rectangle2D calculatedRectangle, Rectangle2D defaultRect Rectangle2D result = new Rectangle2D(calculatedRectangle.Origin, -calculatedRectangle.Height, calculatedRectangle.Width, calculatedRectangle.WidthDirection); return result; - } + } private bool intersect(Rectangle2D rectangle2D, List solver2DResults) { return (obstacles2D.Find(x => x.InRange(rectangle2D) == true) != null) || diff --git a/SAM/SAM.Geometry/Geometry/Planar/Classes/Solver2D/Solver2DData.cs b/SAM/SAM.Geometry/Geometry/Planar/Classes/Solver2D/Solver2DData.cs index 189302ab0..3ceab2cf9 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Classes/Solver2D/Solver2DData.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Classes/Solver2D/Solver2DData.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Planar { public class Solver2DData { @@ -59,7 +62,7 @@ public Solver2DData(IClosed2D closed2D, ISAMGeometry2D geometry2D) // geometry2D = point2D; //} - public T Geometry2D() where T: ISAMGeometry2D + public T Geometry2D() where T : ISAMGeometry2D { return geometry2D is T ? (T)geometry2D : default; } diff --git a/SAM/SAM.Geometry/Geometry/Planar/Classes/Solver2D/Solver2DResult.cs b/SAM/SAM.Geometry/Geometry/Planar/Classes/Solver2D/Solver2DResult.cs index 4492d5682..890aa6b8f 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Classes/Solver2D/Solver2DResult.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Classes/Solver2D/Solver2DResult.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Planar { public class Solver2DResult { @@ -13,9 +16,9 @@ public Solver2DResult(Solver2DData solver2DData, IClosed2D closed2D) public Solver2DData Solver2DData { - get - { - return solver2DData; + get + { + return solver2DData; } } diff --git a/SAM/SAM.Geometry/Geometry/Planar/Classes/Solver2D/Solver2DSettings.cs b/SAM/SAM.Geometry/Geometry/Planar/Classes/Solver2D/Solver2DSettings.cs index ec198c39a..b9afcd95a 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Classes/Solver2D/Solver2DSettings.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Classes/Solver2D/Solver2DSettings.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Planar { public class Solver2DSettings { diff --git a/SAM/SAM.Geometry/Geometry/Planar/Classes/Transform2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Classes/Transform2D.cs index 450164bd4..d544914b1 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Classes/Transform2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Classes/Transform2D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Math; namespace SAM.Geometry.Planar @@ -142,7 +145,7 @@ public static Transform2D GetMirrorX() public static ITransform2D GetMirrorX(Point2D point2D) { - if(point2D == null) + if (point2D == null) { return null; } @@ -205,4 +208,4 @@ public void Transpose() return new Transform2D(transform2D_1.matrix3D * transform2D_2.matrix3D); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Classes/TransformGroup2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Classes/TransformGroup2D.cs index 8509c42f1..419abe793 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Classes/TransformGroup2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Classes/TransformGroup2D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections; using System.Collections.Generic; @@ -16,12 +19,12 @@ public TransformGroup2D(JObject jObject) public TransformGroup2D(IEnumerable transform2Ds) { - if(transform2Ds != null) + if (transform2Ds != null) { this.transform2Ds = new List(); - foreach(ITransform2D transform2D in transform2Ds) + foreach (ITransform2D transform2D in transform2Ds) { - if(transform2D == null) + if (transform2D == null) { continue; } @@ -38,10 +41,10 @@ public bool FromJObject(JObject jObject) return false; } - if(jObject.ContainsKey("Transform2Ds")) + if (jObject.ContainsKey("Transform2Ds")) { transform2Ds = new List(); - foreach(JObject jObject_Transform2D in jObject.Value("Transform2Ds")) + foreach (JObject jObject_Transform2D in jObject.Value("Transform2Ds")) { transform2Ds.Add(Core.Query.IJSAMObject(jObject_Transform2D)); } @@ -57,14 +60,14 @@ public IEnumerator GetEnumerator() public void Inverse() { - if(transform2Ds == null) + if (transform2Ds == null) { return; } transform2Ds.Reverse(); - foreach(ITransform2D transform2D in transform2Ds) + foreach (ITransform2D transform2D in transform2Ds) { transform2D.Inverse(); } @@ -75,12 +78,12 @@ public virtual JObject ToJObject() JObject jObject = new JObject(); jObject.Add("_type", Core.Query.FullTypeName(this)); - if(transform2Ds != null) + if (transform2Ds != null) { JArray jArray = new JArray(); - foreach(Transform2D transform2D in transform2Ds) + foreach (Transform2D transform2D in transform2Ds) { - if(transform2D == null) + if (transform2D == null) { continue; } @@ -99,4 +102,4 @@ IEnumerator IEnumerable.GetEnumerator() return GetEnumerator(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Classes/Triangle2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Classes/Triangle2D.cs index 6da4795df..7d807ccd4 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Classes/Triangle2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Classes/Triangle2D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; @@ -217,12 +220,12 @@ public ISAMGeometry2D GetTransformed(ITransform2D transform2D) public bool Transform(ITransform2D transform2D) { - if(transform2D == null || points == null) + if (transform2D == null || points == null) { return false; } - for(int i= 0; i < points.Count(); i++) + for (int i = 0; i < points.Count(); i++) { points[i].Transform(transform2D); } @@ -230,4 +233,4 @@ public bool Transform(ITransform2D transform2D) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Classes/Vector2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Classes/Vector2D.cs index 6a65b7ace..9571e352b 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Classes/Vector2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Classes/Vector2D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Geometry.Planar @@ -14,7 +17,7 @@ public Vector2D(double x, double y) public Vector2D(Point2D start, Point2D end) { - if(start != null && end != null) + if (start != null && end != null) { coordinates = new double[2] { end[0] - start[0], end[1] - start[1] }; } @@ -27,7 +30,7 @@ public Vector2D() public Vector2D(Vector2D vector) { - if(vector != null) + if (vector != null) { coordinates[0] = vector.coordinates[0]; coordinates[1] = vector.coordinates[1]; @@ -36,7 +39,7 @@ public Vector2D(Vector2D vector) public Vector2D(double[] coordinates) { - if(coordinates != null && coordinates.Length > 1) + if (coordinates != null && coordinates.Length > 1) { this.coordinates[0] = coordinates[0]; this.coordinates[1] = coordinates[1]; @@ -433,13 +436,13 @@ public ISAMGeometry2D GetTransformed(ITransform2D transform2D) public bool Transform(ITransform2D transform2D) { - if(transform2D == null) + if (transform2D == null) { return false; } Vector2D vector2D = Query.Transform(this, transform2D); - if(vector2D == null) + if (vector2D == null) { return false; } @@ -449,4 +452,4 @@ public bool Transform(ITransform2D transform2D) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/Coordinate.cs b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/Coordinate.cs index 1be7af678..fa4b40e41 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/Coordinate.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/Coordinate.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; namespace SAM.Geometry.Planar { @@ -12,4 +15,4 @@ public static Coordinate ToNTS(this Point2D point2D, double tolerance = Core.Tol return new Coordinate(Core.Query.Round(point2D.X, tolerance), Core.Query.Round(point2D.Y, tolerance)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/Coordinates.cs b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/Coordinates.cs index 48c2dc3df..7abd0af31 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/Coordinates.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/Coordinates.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; using System.Collections.Generic; using System.Linq; @@ -14,4 +17,4 @@ public static List ToNTS(this IEnumerable point2Ds, double return point2Ds.ToList().ConvertAll(x => x.ToNTS(tolerance)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/Geometry.cs b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/Geometry.cs index 90015b29f..ba4ec340b 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/Geometry.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/Geometry.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; namespace SAM.Geometry.Planar { @@ -11,15 +14,15 @@ public static NetTopologySuite.Geometries.Geometry ToNTS(this ISAMGeometry2D sAM return null; } - if(sAMGeometry2D is Polygon2D) + if (sAMGeometry2D is Polygon2D) { return ToNTS((IClosed2D)sAMGeometry2D, tolerance); } - if(sAMGeometry2D is Point2D) + if (sAMGeometry2D is Point2D) { Coordinate coordinate = ToNTS((Point2D)sAMGeometry2D); - if(coordinate == null) + if (coordinate == null) { return null; } @@ -30,4 +33,4 @@ public static NetTopologySuite.Geometries.Geometry ToNTS(this ISAMGeometry2D sAM return ToNTS(sAMGeometry2D as dynamic, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/LineString.cs b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/LineString.cs index 52e3e1a43..7f00bd611 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/LineString.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/LineString.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; using System.Collections.Generic; namespace SAM.Geometry.Planar @@ -11,7 +14,7 @@ public static LineString ToNTS(this ISegmentable2D segmentable2D, double toleran if (point2Ds == null || point2Ds.Count == 0) return null; - if(segmentable2D is IClosed2D) + if (segmentable2D is IClosed2D) { return ToNTS((IClosed2D)segmentable2D, tolerance); } @@ -19,4 +22,4 @@ public static LineString ToNTS(this ISegmentable2D segmentable2D, double toleran return new LineString(point2Ds.ToNTS(tolerance).ToArray()); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/LinearRing.cs b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/LinearRing.cs index 584b3e1e6..ad87dc933 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/LinearRing.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/LinearRing.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; using System.Collections.Generic; using System.Linq; @@ -31,4 +34,4 @@ public static LinearRing ToNTS_LinearRing(this IEnumerable point2Ds, do return new LinearRing(coordinates.ToArray()); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/MultiPolygon.cs b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/MultiPolygon.cs index 6d04ae4a5..3e3130e9c 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/MultiPolygon.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/MultiPolygon.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; using System.Collections.Generic; using System.Linq; @@ -12,7 +15,7 @@ public static MultiPolygon ToNTS(this IEnumerable face2Ds, double tolera return null; List polygons = new List(); - foreach(Face2D face2D in face2Ds) + foreach (Face2D face2D in face2Ds) { if (face2D == null) continue; @@ -28,4 +31,4 @@ public static MultiPolygon ToNTS(this IEnumerable face2Ds, double tolera } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/Point.cs b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/Point.cs index 14f993687..1c34a5e22 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/Point.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/Point.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; namespace SAM.Geometry.Planar { @@ -12,4 +15,4 @@ public static Point ToNTS_Point(this Point2D point2D, double tolerance = Core.To return new Point(Core.Query.Round(point2D.X, tolerance), Core.Query.Round(point2D.Y, tolerance)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/Polygon.cs b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/Polygon.cs index 9e99a6874..46eaa8d5f 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/Polygon.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/Polygon.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; using System.Collections.Generic; namespace SAM.Geometry.Planar @@ -33,4 +36,4 @@ public static Polygon ToNTS_Polygon(this Polygon2D polygon2D, double tolerance = return new Polygon((polygon2D as IClosed2D)?.ToNTS(tolerance)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/Polygons.cs b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/Polygons.cs index fddbcb05c..d11ef6af1 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/Polygons.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToNTS/Polygons.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; using NetTopologySuite.Noding.Snapround; using NetTopologySuite.Operation.Polygonize; using System.Collections.Generic; @@ -31,9 +34,9 @@ public static List ToNTS_Polygons(this IEnumerable geometries_Temp = new List(); - foreach(NetTopologySuite.Geometries.Geometry geometry_Temp in geometries) + foreach (NetTopologySuite.Geometries.Geometry geometry_Temp in geometries) { - if(geometry_Temp == null || !geometry_Temp.IsValid) + if (geometry_Temp == null || !geometry_Temp.IsValid) { continue; } @@ -88,4 +91,4 @@ public static List ToNTS_Polygons(this IEnumerable ToSAM(this MultiPolygon multiPolygon, double toleranc List result = new List(); foreach (NetTopologySuite.Geometries.Geometry geometry in multiPolygon.Geometries) { - if(geometry is Polygon) + if (geometry is Polygon) { Face2D face2D = ((Polygon)geometry).ToSAM(tolerance); if (face2D == null) @@ -25,7 +28,7 @@ public static List ToSAM(this MultiPolygon multiPolygon, double toleranc result.Add(face2D); } - else if(geometry is MultiPolygon) + else if (geometry is MultiPolygon) { List face2Ds = ((MultiPolygon)geometry).ToSAM(tolerance); if (face2Ds == null) @@ -42,4 +45,4 @@ public static List ToSAM(this MultiPolygon multiPolygon, double toleranc return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/ISAMGeometry2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/ISAMGeometry2D.cs index 10b78e3d1..fe361af2b 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/ISAMGeometry2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/ISAMGeometry2D.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; namespace SAM.Geometry.Planar { @@ -6,7 +9,7 @@ public static partial class Convert { public static ISAMGeometry2D ToSAM(this NetTopologySuite.Geometries.Geometry geometry, double tolerance = Core.Tolerance.Distance) { - if(geometry == null || geometry is MultiPoint) + if (geometry == null || geometry is MultiPoint) { return null; } @@ -14,4 +17,4 @@ public static ISAMGeometry2D ToSAM(this NetTopologySuite.Geometries.Geometry geo return Convert.ToSAM(geometry as dynamic, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/ISAMGeometry2Ds.cs b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/ISAMGeometry2Ds.cs index e8e93f812..662ce6ddf 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/ISAMGeometry2Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/ISAMGeometry2Ds.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; using NetTopologySuite.IO; using System.Collections.Generic; using System.Linq; @@ -9,7 +12,7 @@ public static partial class Convert { public static List ToSAM(this NetTopologySuite.Geometries.Geometry geometry, double tolerance = Core.Tolerance.Distance) where T : ISAMGeometry2D { - if(geometry == null) + if (geometry == null) { return null; } @@ -35,9 +38,9 @@ public static List ToSAM(this NetTopologySuite.Geometries.Geometry geometr List point2Ds = ToSAM((MultiPoint)geometry, tolerance); if (point2Ds != null) { - foreach(Point2D point2D in point2Ds) + foreach (Point2D point2D in point2Ds) { - if(point2D is T) + if (point2D is T) { result.Add((T)(object)point2D); } @@ -52,11 +55,11 @@ public static List ToSAM(this NetTopologySuite.Geometries.Geometry geometr result.Add((T)sAMGeometry2D); } } - + return result; } - public static List ToSAM(this IEnumerable lines_NTS, double tolerance = Core.Tolerance.MicroDistance) where T: ISAMGeometry2D + public static List ToSAM(this IEnumerable lines_NTS, double tolerance = Core.Tolerance.MicroDistance) where T : ISAMGeometry2D { if (lines_NTS == null || lines_NTS.Count() == 0) return null; @@ -89,4 +92,4 @@ public static List ToSAM(this IEnumerable lines_NTS, double tolera return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/Point2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/Point2D.cs index 68368ba36..57f609a3e 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/Point2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/Point2D.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; namespace SAM.Geometry.Planar { @@ -22,7 +25,7 @@ public static Point2D ToSAM(this Point point, double tolerance = Core.Tolerance. public static Point2D ToSAM(this System.Numerics.Complex complex) { - if(complex == null) + if (complex == null) { return null; } @@ -30,4 +33,4 @@ public static Point2D ToSAM(this System.Numerics.Complex complex) return new Point2D(complex.Real, complex.Imaginary); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/Point2Ds.cs b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/Point2Ds.cs index 5591582e4..56f03e887 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/Point2Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/Point2Ds.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; using System.Collections.Generic; namespace SAM.Geometry.Planar @@ -19,16 +22,16 @@ public static List ToSAM(this IEnumerable coordinates, doub public static List ToSAM(MultiPoint multiPoint, double tolerance = Core.Tolerance.MicroDistance) { - if(multiPoint == null) + if (multiPoint == null) { return null; } List result = new List(); - foreach(Coordinate coordinate in multiPoint.Coordinates) + foreach (Coordinate coordinate in multiPoint.Coordinates) { Point2D point2D = coordinate?.ToSAM(); - if(point2D == null) + if (point2D == null) { continue; } @@ -39,4 +42,4 @@ public static List ToSAM(MultiPoint multiPoint, double tolerance = Core return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/Polygon2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/Polygon2D.cs index 3965a894a..b55851776 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/Polygon2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/Polygon2D.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; using System.Collections.Generic; using System.Linq; @@ -14,8 +17,8 @@ public static Polygon2D ToSAM(this LinearRing linearRing, double tolerance = Cor List point2Ds = linearRing.Coordinates.ToSAM(tolerance); if (point2Ds == null || point2Ds.Count < 3) return null; - - if(tolerance != 0) + + if (tolerance != 0) { List point2Ds_Temp = new List(); point2Ds_Temp.Add(point2Ds[0]); @@ -38,4 +41,4 @@ public static Polygon2D ToSAM(this LinearRing linearRing, double tolerance = Cor return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/Polygon2Ds.cs b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/Polygon2Ds.cs index 2b68a6578..880b08f05 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/Polygon2Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/Polygon2Ds.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; using System.Collections.Generic; namespace SAM.Geometry.Planar @@ -35,4 +38,4 @@ public static List ToSAM_Polygon2Ds(this Polygon polygon, double tole return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/Polyline2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/Polyline2D.cs index 221dfebfd..836ef0ad9 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/Polyline2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/Polyline2D.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; namespace SAM.Geometry.Planar { @@ -12,4 +15,4 @@ public static Polyline2D ToSAM(this LineString lineString, double tolerance = Co return new Polyline2D(lineString.Coordinates.ToSAM(tolerance), lineString.IsClosed); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/Polyline2Ds.cs b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/Polyline2Ds.cs index 0a03a1a11..b357a996e 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/Polyline2Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Convert/ToSAM/Polyline2Ds.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; using System.Collections.Generic; namespace SAM.Geometry.Planar @@ -23,4 +26,4 @@ public static List ToSAM(this MultiLineString multiLineString, doubl return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Create/AdjacencyGraph.cs b/SAM/SAM.Geometry/Geometry/Planar/Create/AdjacencyGraph.cs index 93416751f..2ab60c2fe 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Create/AdjacencyGraph.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Create/AdjacencyGraph.cs @@ -1,4 +1,7 @@ -using QuickGraph; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using QuickGraph; using System.Collections.Generic; namespace SAM.Geometry.Planar @@ -13,17 +16,17 @@ public static AdjacencyGraph> AdjacencyGraph(this IEnumer AdjacencyGraph> result = new AdjacencyGraph>(); HashSet point2Ds = new HashSet(); - foreach(ISegmentable2D segmentable2D in segmentable2Ds) + foreach (ISegmentable2D segmentable2D in segmentable2Ds) { List segment2Ds = segmentable2D?.GetSegments(); if (segment2Ds == null) continue; - foreach(Segment2D segment2D in segment2Ds) + foreach (Segment2D segment2D in segment2Ds) { Point2D point2D_1 = segment2D[0]; point2D_1.Round(tolerance); - if(!point2Ds.Contains(point2D_1)) + if (!point2Ds.Contains(point2D_1)) { point2Ds.Add(point2D_1); result.AddVertex(point2D_1); @@ -45,4 +48,4 @@ public static AdjacencyGraph> AdjacencyGraph(this IEnumer return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Create/BoundingBox2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Create/BoundingBox2D.cs index 7abac3ff3..6a5de5638 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Create/BoundingBox2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Create/BoundingBox2D.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -20,10 +23,10 @@ public static BoundingBox2D BoundingBox2D(this IEnumerable segme if (count == 1) return result; - for(int i =1; i < count; i++) + for (int i = 1; i < count; i++) result.Include(segmentable2Ds.ElementAt(i).GetBoundingBox(offset)); return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Create/Face2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Create/Face2D.cs index 9c2d06e10..fd439308b 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Create/Face2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Create/Face2D.cs @@ -1,10 +1,13 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { public static partial class Create { - public static Face2D Face2D(this IClosed2D externalEdge, IEnumerable internalEdges, EdgeOrientationMethod edgeOrientationMethod= EdgeOrientationMethod.Opposite) + public static Face2D Face2D(this IClosed2D externalEdge, IEnumerable internalEdges, EdgeOrientationMethod edgeOrientationMethod = EdgeOrientationMethod.Opposite) { return Planar.Face2D.Create(externalEdge, internalEdges, edgeOrientationMethod); } @@ -19,4 +22,4 @@ public static Face2D Face2D(IEnumerable edges, EdgeOrientationMethod return Planar.Face2D.Create(edges, edgeOrientationMethod); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Create/Face2Ds.cs b/SAM/SAM.Geometry/Geometry/Planar/Create/Face2Ds.cs index 532610fb8..a825bcb76 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Create/Face2Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Create/Face2Ds.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; using System; using System.Collections.Generic; using System.Linq; @@ -34,16 +37,16 @@ public static List Face2Ds(this IEnumerable closed2Ds, double tole return Face2Ds(segmentable2Ds, EdgeOrientationMethod.Undefined, tolerance); } - public static List Face2Ds(this IClosed2D externalEdge2D, IEnumerable internalEdge2Ds, EdgeOrientationMethod edgeOrientationMethod = EdgeOrientationMethod.Undefined, double tolerance = Core.Tolerance.MicroDistance) where T: IClosed2D + public static List Face2Ds(this IClosed2D externalEdge2D, IEnumerable internalEdge2Ds, EdgeOrientationMethod edgeOrientationMethod = EdgeOrientationMethod.Undefined, double tolerance = Core.Tolerance.MicroDistance) where T : IClosed2D { - if(externalEdge2D == null) + if (externalEdge2D == null) { return null; } List result = new List(); - if(internalEdge2Ds == null || internalEdge2Ds.Count() == 0) + if (internalEdge2Ds == null || internalEdge2Ds.Count() == 0) { result.Add(new Face2D(externalEdge2D)); return result; @@ -93,23 +96,23 @@ public static List Face2Ds(this IClosed2D externalEdge2D, IEnumerable continue; } - if(closed2D is ISegmentable2D) + if (closed2D is ISegmentable2D) { segmentable2Ds.Add((ISegmentable2D)closed2D); } - else if(closed2D is Face2D) + else if (closed2D is Face2D) { Face2D face2D = closed2D as Face2D; ISegmentable2D segmentable2D_Temp = face2D.ExternalEdge2D as ISegmentable2D; - if(segmentable2D_Temp == null) + if (segmentable2D_Temp == null) { throw new NotImplementedException(); } segmentable2Ds.Add(segmentable2D_Temp); - if(face2D.InternalEdge2Ds != null) + if (face2D.InternalEdge2Ds != null) { - foreach(IClosed2D internalEdge2D in face2D.InternalEdge2Ds) + foreach (IClosed2D internalEdge2D in face2D.InternalEdge2Ds) { segmentable2D_Temp = internalEdge2D as ISegmentable2D; if (segmentable2D_Temp == null) @@ -164,23 +167,23 @@ public static List Face2Ds(this IClosed2D externalEdge2D, IEnumerable } Point2D point2D = face2D.GetInternalPoint2D(tolerance); - if(point2D == null) + if (point2D == null) { continue; } - if(!boundingBox2D.Inside(point2D, tolerance)) + if (!boundingBox2D.Inside(point2D, tolerance)) { continue; } - if(!externalEdge2D.Inside(point2D, tolerance)) + if (!externalEdge2D.Inside(point2D, tolerance)) { continue; } - Tuple tuple = tuples?.FindAll(x => x.Item1.Inside(point2D, tolerance))?.Find(x => x.Item2.Inside(point2D, tolerance)); - if(tuple != null) + Tuple tuple = tuples?.FindAll(x => x.Item1.Inside(point2D, tolerance))?.Find(x => x.Item2.Inside(point2D, tolerance)); + if (tuple != null) { continue; } @@ -196,7 +199,7 @@ public static List Face2Ds(this IClosed2D externalEdge2D, IEnumerable return result; } - public static List Face2Ds(this IEnumerable segmentable2Ds, EdgeOrientationMethod edgeOrientationMethod = EdgeOrientationMethod.Undefined, double tolerance = Core.Tolerance.MicroDistance) where T: ISegmentable2D + public static List Face2Ds(this IEnumerable segmentable2Ds, EdgeOrientationMethod edgeOrientationMethod = EdgeOrientationMethod.Undefined, double tolerance = Core.Tolerance.MicroDistance) where T : ISegmentable2D { if (segmentable2Ds == null) return null; @@ -225,7 +228,7 @@ public static List Face2Ds(this IEnumerable segmentable2Ds, EdgeOr continue; } - if(edgeOrientationMethod != EdgeOrientationMethod.Undefined) + if (edgeOrientationMethod != EdgeOrientationMethod.Undefined) { face2D = Face2D(face2D.ExternalEdge2D, face2D.InternalEdge2Ds, edgeOrientationMethod); } @@ -236,4 +239,4 @@ public static List Face2Ds(this IEnumerable segmentable2Ds, EdgeOr return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Create/IClosed2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Create/IClosed2D.cs index fc164c7db..6a891e41a 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Create/IClosed2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Create/IClosed2D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; namespace SAM.Geometry.Planar @@ -53,7 +56,7 @@ public static IClosed2D IClosed2D(this Polygon2D polygon2D, double tolerance = C /// A closed 2D geometry. public static IClosed2D IClosed2D(this Polycurve2D polycurve2D, double tolerance = Core.Tolerance.Distance) { - if(polycurve2D == null) + if (polycurve2D == null) { return null; } @@ -76,12 +79,12 @@ public static IClosed2D IClosed2D(this Polycurve2D polycurve2D, double tolerance /// A closed 2D geometry. public static IClosed2D IClosed2D(this IClosed2D closed2D, double tolerance = Core.Tolerance.Distance) { - if(closed2D == null) + if (closed2D == null) { return null; } - if(closed2D is Polygon2D) + if (closed2D is Polygon2D) { return IClosed2D((Polygon2D)closed2D, tolerance); } @@ -102,4 +105,4 @@ public static IClosed2D IClosed2D(this IClosed2D closed2D, double tolerance = Co throw new System.NotImplementedException(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Create/ICurve2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Create/ICurve2D.cs index 9ec56a29b..22e488b6b 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Create/ICurve2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Create/ICurve2D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Geometry.Planar { @@ -9,4 +12,4 @@ public static ICurve2D ICurve2D(this JObject jObject) return Geometry.Create.ISAMGeometry(jObject) as ICurve2D; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Create/Line2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Create/Line2D.cs index 5efbf5a54..d6c71c3e2 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Create/Line2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Create/Line2D.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Planar { public static partial class Create { @@ -13,4 +16,4 @@ public static Line2D Line2D(Point2D origin, double angle) } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Create/LinearEquation.cs b/SAM/SAM.Geometry/Geometry/Planar/Create/LinearEquation.cs index ec3d3b69f..d0a06aabc 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Create/LinearEquation.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Create/LinearEquation.cs @@ -1,4 +1,7 @@ -using SAM.Math; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Math; namespace SAM.Geometry.Planar { @@ -6,7 +9,7 @@ public static partial class Create { public static LinearEquation LinearEquation(this Point2D point2D_1, Point2D point2D_2) { - if(point2D_1 == point2D_2 || point2D_1 == null) + if (point2D_1 == point2D_2 || point2D_1 == null) { return null; } @@ -15,4 +18,4 @@ public static LinearEquation LinearEquation(this Point2D point2D_1, Point2D poin } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Create/Mesh2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Create/Mesh2D.cs index 78076f4cb..be6922569 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Create/Mesh2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Create/Mesh2D.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -6,7 +9,7 @@ namespace SAM.Geometry.Planar { public static partial class Create { - public static Mesh2D Mesh2D(this IEnumerable< Triangle2D> triangle2Ds, double tolerance = Core.Tolerance.Distance) + public static Mesh2D Mesh2D(this IEnumerable triangle2Ds, double tolerance = Core.Tolerance.Distance) { if (triangle2Ds == null || triangle2Ds.Count() == 0) { @@ -60,4 +63,4 @@ public static Mesh2D Mesh2D(this IEnumerable< Triangle2D> triangle2Ds, double to return new Mesh2D(point2Ds, tuples); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Create/Point2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Create/Point2D.cs index 718a272b8..ecd1fee2d 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Create/Point2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Create/Point2D.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Planar { public static partial class Create { @@ -17,4 +20,4 @@ public static Point2D Point2D(this Math.Matrix matrix) return new Point2D(matrix[0, 0], matrix[1, 0]); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Create/Point2Ds.cs b/SAM/SAM.Geometry/Geometry/Planar/Create/Point2Ds.cs index ca61709ae..c0ee39752 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Create/Point2Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Create/Point2Ds.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -48,19 +51,19 @@ public static List Point2Ds(double x_min, double y_min, double x_max, d public static List Point2Ds(params double[] values) { - if(values == null) + if (values == null) { return null; } int length = values.Length; - if(length == 0 || length % 2 != 0) + if (length == 0 || length % 2 != 0) { return null; } List result = new List(); - for (int i=0; i < length; i = i + 2) + for (int i = 0; i < length; i = i + 2) { result.Add(new Point2D(values[i], values[i + 1])); } @@ -68,4 +71,4 @@ public static List Point2Ds(params double[] values) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Create/Polygon2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Create/Polygon2D.cs index bd9c1dbec..855bc027d 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Create/Polygon2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Create/Polygon2D.cs @@ -1,15 +1,18 @@ -namespace SAM.Geometry.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Planar { public static partial class Create { public static Polygon2D Polygon2D(this IClosed2D closed2D) { - if(closed2D == null) + if (closed2D == null) { return null; } - if(closed2D is ISegmentable2D) + if (closed2D is ISegmentable2D) { return new Polygon2D(((ISegmentable2D)closed2D).GetPoints()); } @@ -17,4 +20,4 @@ public static Polygon2D Polygon2D(this IClosed2D closed2D) return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Create/Polygon2Ds.cs b/SAM/SAM.Geometry/Geometry/Planar/Create/Polygon2Ds.cs index bfce3e342..9579d0411 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Create/Polygon2Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Create/Polygon2Ds.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -9,7 +12,7 @@ public static partial class Create public static List Polygon2Ds(this IEnumerable segmentable2Ds, double tolerance = Core.Tolerance.MicroDistance) { List face2Ds = Face2Ds(segmentable2Ds, EdgeOrientationMethod.Undefined, tolerance); - if(face2Ds == null) + if (face2Ds == null) { return null; } @@ -18,7 +21,7 @@ public static List Polygon2Ds(this IEnumerable segmen foreach (Face2D face2D in face2Ds) { Polygon2D polygon2D = face2D?.ExternalEdge2D as Polygon2D; - if(polygon2D == null) + if (polygon2D == null) { continue; } @@ -36,7 +39,7 @@ public static List Polygon2Ds(this IEnumerable segmen } List> tuples_Similar = tuples.FindAll(x => System.Math.Abs(x.Item3 - area) <= tolerance); - if(tuples_Similar != null && tuples_Similar.Count != 0) + if (tuples_Similar != null && tuples_Similar.Count != 0) { tuples_Similar = tuples_Similar.FindAll(x => boundingBox2D.InRange(x.Item2, tolerance)); if (tuples_Similar != null && tuples_Similar.Count != 0) @@ -48,19 +51,19 @@ public static List Polygon2Ds(this IEnumerable segmen } } } - + tuples.Add(new Tuple(polygon2D, boundingBox2D, area)); } - foreach(Face2D face2D in face2Ds) + foreach (Face2D face2D in face2Ds) { IEnumerable polygon2Ds = face2D?.InternalEdge2Ds?.Cast(); - if(polygon2Ds == null || polygon2Ds.Count() == 0) + if (polygon2Ds == null || polygon2Ds.Count() == 0) { continue; } - foreach(Polygon2D polygon2D in polygon2Ds) + foreach (Polygon2D polygon2D in polygon2Ds) { BoundingBox2D boundingBox2D = polygon2D?.GetBoundingBox(); if (boundingBox2D == null) @@ -77,7 +80,7 @@ public static List Polygon2Ds(this IEnumerable segmen List polygon2Ds_Temp = new List() { polygon2D }; List> tuples_Internal = tuples.FindAll(x => area + tolerance > x.Item3); - if(tuples_Internal != null && tuples_Internal.Count != 0) + if (tuples_Internal != null && tuples_Internal.Count != 0) { tuples_Internal = tuples_Internal.FindAll(x => boundingBox2D.Inside(x.Item2.GetCentroid(), tolerance)); if (tuples_Internal != null && tuples_Internal.Count != 0) @@ -86,14 +89,14 @@ public static List Polygon2Ds(this IEnumerable segmen } } - if(polygon2Ds_Temp == null || polygon2Ds_Temp.Count == 0) + if (polygon2Ds_Temp == null || polygon2Ds_Temp.Count == 0) { continue; } - foreach(Polygon2D polygon2D_Temp in polygon2Ds_Temp) + foreach (Polygon2D polygon2D_Temp in polygon2Ds_Temp) { - if(polygon2D_Temp != polygon2D) + if (polygon2D_Temp != polygon2D) { boundingBox2D = polygon2D_Temp?.GetBoundingBox(); if (boundingBox2D == null) @@ -131,7 +134,7 @@ public static List Polygon2Ds(this IEnumerable segmen public static List Polygon2Ds(this IEnumerable segmentable2Ds, double maxDistance, bool unconnectedOnly = false, double tolerance = Core.Tolerance.MicroDistance) { List segment2Ds = Segment2Ds(segmentable2Ds, maxDistance, unconnectedOnly, tolerance); - if(segment2Ds == null || segment2Ds.Count == 0) + if (segment2Ds == null || segment2Ds.Count == 0) { return null; } @@ -141,4 +144,4 @@ public static List Polygon2Ds(this IEnumerable segmen return Polygon2Ds(segment2Ds, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Create/Polyline2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Create/Polyline2D.cs index 1f472144a..a7a874055 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Create/Polyline2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Create/Polyline2D.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -17,15 +20,15 @@ public static Polyline2D Polyline2D(this IEnumerable segmentable } List segment2Ds = null; - if(split) + if (split) { segment2Ds = segmentable2Ds.Split(tolerance); } else { segment2Ds = new List(); - - foreach(ISegmentable2D segmentable2D in segmentable2Ds) + + foreach (ISegmentable2D segmentable2D in segmentable2Ds) { List segment2Ds_Temp = segmentable2D?.GetSegments(); if (segment2Ds_Temp == null) @@ -38,7 +41,7 @@ public static Polyline2D Polyline2D(this IEnumerable segmentable List point2Ds = Query.UniquePoint2Ds(segment2Ds, tolerance); Point2D point2D = null; - foreach(Point2D point2D_Temp in point2Ds) + foreach (Point2D point2D_Temp in point2Ds) { List segment2Ds_Closest = segment2Ds.FindAll(x => x[0].Distance(point2D_Temp) <= tolerance || x[1].Distance(point2D_Temp) <= tolerance); if (segment2Ds_Closest != null && segment2Ds_Closest.Count == 1) @@ -49,7 +52,7 @@ public static Polyline2D Polyline2D(this IEnumerable segmentable point2D = segment2Ds[0][0]; List point2Ds_Result = new List() { point2D }; - while(point2D != null) + while (point2D != null) { List segment2Ds_Closest = segment2Ds.FindAll(x => x[0].Distance(point2D) <= tolerance || x[1].Distance(point2D) <= tolerance); if (segment2Ds_Closest == null || segment2Ds_Closest.Count == 0) @@ -64,9 +67,9 @@ public static Polyline2D Polyline2D(this IEnumerable segmentable { break; } - - foreach(Point2D point2D_Result in point2Ds_Result) + + foreach (Point2D point2D_Result in point2Ds_Result) { point2Ds_Temp.RemoveAll(x => x.Distance(point2D_Result) <= tolerance); } @@ -88,4 +91,4 @@ public static Polyline2D Polyline2D(this IEnumerable segmentable return new Polyline2D(point2Ds_Result); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Create/Polyline2Ds.cs b/SAM/SAM.Geometry/Geometry/Planar/Create/Polyline2Ds.cs index a45000690..bdbbb25bc 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Create/Polyline2Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Create/Polyline2Ds.cs @@ -1,4 +1,7 @@ -using QuickGraph; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using QuickGraph; using QuickGraph.Algorithms.Observers; using QuickGraph.Algorithms.ShortestPath; using System.Collections.Generic; @@ -22,14 +25,14 @@ public static List Polyline2Ds(this IEnumerable segm } List segment2Ds = null; - if(split) + if (split) { segment2Ds = segmentable2Ds.Split(tolerance); } else { segment2Ds = new List(); - foreach(ISegmentable2D segmentable2D in segmentable2Ds) + foreach (ISegmentable2D segmentable2D in segmentable2Ds) { List segment2Ds_Temp = segmentable2D.GetSegments(); if (segment2Ds_Temp == null) @@ -72,7 +75,7 @@ public static List Polyline2Ds(this IEnumerable segm { double distance = double.MaxValue; Point2D point2D = null; - foreach(Point2D point_Temp in adjacencyGraph.Vertices) + foreach (Point2D point_Temp in adjacencyGraph.Vertices) { double distance_Temp = point_Temp.Distance(point2D_Start); if (distance_Temp < distance) @@ -97,7 +100,7 @@ public static List Polyline2Ds(this IEnumerable segm point2D_Start = adjacencyGraph.Vertices.First(); } - if(point2D_Start == null) + if (point2D_Start == null) { return null; } @@ -149,7 +152,7 @@ public static List Polyline2Ds(this IEnumerable segm if (segment2Ds.Count > 0) { List polyline2Ds = Polyline2Ds(segment2Ds, null, false, tolerance); - if(polyline2Ds != null && polyline2Ds.Count != 0) + if (polyline2Ds != null && polyline2Ds.Count != 0) { result.AddRange(polyline2Ds); } @@ -158,4 +161,4 @@ public static List Polyline2Ds(this IEnumerable segm return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Create/PolynomialEquation.cs b/SAM/SAM.Geometry/Geometry/Planar/Create/PolynomialEquation.cs index 2549b765f..af859efb6 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Create/PolynomialEquation.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Create/PolynomialEquation.cs @@ -1,4 +1,7 @@ -using SAM.Math; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Math; using System.Collections.Generic; using System.Linq; @@ -6,14 +9,14 @@ namespace SAM.Geometry.Planar { public static partial class Create { - public static PolynomialEquation PolynomialEquation(this IEnumerable point2Ds, int order =-1) + public static PolynomialEquation PolynomialEquation(this IEnumerable point2Ds, int order = -1) { if (point2Ds == null || point2Ds.Count() < 2) return null; List x = new List(); List y = new List(); - foreach(Point2D point2D in point2Ds) + foreach (Point2D point2D in point2Ds) { x.Add(point2D.X); y.Add(point2D.Y); @@ -22,4 +25,4 @@ public static PolynomialEquation PolynomialEquation(this IEnumerable po return Math.Create.PolynomialEquation(x, y, order); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Create/Rectangle2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Create/Rectangle2D.cs index c69eaabf1..12191d13c 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Create/Rectangle2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Create/Rectangle2D.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -175,4 +178,4 @@ public static Rectangle2D Rectangle2D(this Segment2D segment2D, double width, do return Rectangle2D(rectanglePoints); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Create/Segment2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Create/Segment2D.cs index 09bce6f18..ebdb41910 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Create/Segment2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Create/Segment2D.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -41,4 +44,4 @@ public static Segment2D Segment2D(this Line2D line2D, Rectangle2D rectangle2D) } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Create/Segment2Ds.cs b/SAM/SAM.Geometry/Geometry/Planar/Create/Segment2Ds.cs index aa2022c8f..9ea9578f9 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Create/Segment2Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Create/Segment2Ds.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -210,7 +213,7 @@ public static List Segment2Ds(this IEnumerable segmen Point2D point2D_Start = segment2D.GetStart(); List segment2Ds_Start = segment2Ds.FindAll(x => point2D_Start.AlmostEquals(x.GetStart(), tolerance) || point2D_Start.AlmostEquals(x.GetEnd(), tolerance)); - if(segment2Ds_Start.Count == 1 || !unconnectedOnly) + if (segment2Ds_Start.Count == 1 || !unconnectedOnly) { segment2D_Temp = new Segment2D(point2D_Start, point2D_Start.GetMoved(vector2D.GetNegated())); boundingBox_Temp = segment2D_Temp.GetBoundingBox(tolerance); @@ -233,18 +236,18 @@ public static List Segment2Ds(this IEnumerable segmen { for (int j = i + 1; j < tuples_Extensions.Count; j++) { - if(tuples_Extensions[i].Item1.InRange(tuples_Extensions[j].Item1, tolerance)) + if (tuples_Extensions[i].Item1.InRange(tuples_Extensions[j].Item1, tolerance)) { Segment2D segment2D_1 = tuples_Extensions[i].Item2; Segment2D segment2D_2 = tuples_Extensions[j].Item2; - if(!segment2D_1.Direction.SameHalf(segment2D_2.Direction)) + if (!segment2D_1.Direction.SameHalf(segment2D_2.Direction)) { if (segment2D_1.Collinear(segment2D_2, tolerance) && (segment2D_1.On(segment2D_2[0], tolerance) || segment2D_1.On(segment2D_2[1], tolerance))) { List point2Ds = new List() { segment2D_1[0], segment2D_1[1], segment2D_2[0], segment2D_2[1] }; point2Ds.RemoveAll(x => !segment2D_1.On(x, tolerance) || !segment2D_2.On(x, tolerance)); - if(point2Ds.Count >= 2) + if (point2Ds.Count >= 2) { Query.ExtremePoints(point2Ds, out Point2D point2D_1, out Point2D point2D_2); if (point2D_1 != null && point2D_2 != null && point2D_1.Distance(point2D_2) >= tolerance) @@ -297,9 +300,9 @@ public static List Segment2Ds(this IEnumerable segmen segment2Ds_Extension[i] = new Segment2D(tuple_Extension.Item2[0], point2D); }); - foreach(Segment2D segment2D_Extension in segment2Ds_Extension) + foreach (Segment2D segment2D_Extension in segment2Ds_Extension) { - if(segment2D_Extension != null) + if (segment2D_Extension != null) { segment2Ds.Add(segment2D_Extension); } @@ -312,4 +315,4 @@ public static List Segment2Ds(this IEnumerable segmen return segment2Ds; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Create/UndirectedGraph.cs b/SAM/SAM.Geometry/Geometry/Planar/Create/UndirectedGraph.cs index 4a70e85d7..4a1675e91 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Create/UndirectedGraph.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Create/UndirectedGraph.cs @@ -1,4 +1,7 @@ -using QuickGraph; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using QuickGraph; using System.Collections.Generic; namespace SAM.Geometry.Planar @@ -35,4 +38,4 @@ public static UndirectedGraph> UndirectedGraph(this IEnum return edges.ToUndirectedGraph>(); ; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Create/Vector2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Create/Vector2D.cs index e9a9fad95..29599b0f1 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Create/Vector2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Create/Vector2D.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Planar { public static partial class Create { @@ -9,12 +12,12 @@ public static partial class Create /// Unit Vector2D public static Vector2D Vector2D(double angle) { - if(double.IsNaN(angle) || double.IsInfinity(angle)) + if (double.IsNaN(angle) || double.IsInfinity(angle)) { return null; } - if(angle == 0) + if (angle == 0) { return Planar.Vector2D.WorldX; } @@ -39,7 +42,7 @@ public static Vector2D Vector2D(double angle, double length) } Vector2D vector2D = Vector2D(angle); - if(vector2D == null) + if (vector2D == null) { return null; } @@ -58,4 +61,4 @@ public static Vector2D Vector2D(this Math.Matrix matrix) return new Vector2D(matrix[0, 0], matrix[1, 0]); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Interfaces/IBoundable2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Interfaces/IBoundable2D.cs index 51c2c0422..fca6f4aad 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Interfaces/IBoundable2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Interfaces/IBoundable2D.cs @@ -1,7 +1,10 @@ -namespace SAM.Geometry.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Planar { public interface IBoundable2D : ISAMGeometry2D { BoundingBox2D GetBoundingBox(double offset = 0); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Interfaces/IClosed2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Interfaces/IClosed2D.cs index be28bfdcf..dd3dc8ffe 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Interfaces/IClosed2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Interfaces/IClosed2D.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Planar { public interface IClosed2D : ISAMGeometry2D, IBoundable2D { @@ -20,4 +23,4 @@ public interface IClosed2D : ISAMGeometry2D, IBoundable2D double GetArea(); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Interfaces/ICurvable2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Interfaces/ICurvable2D.cs index 921cb0ad6..ed75d54a4 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Interfaces/ICurvable2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Interfaces/ICurvable2D.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -6,4 +9,4 @@ public interface ICurvable2D : IBoundable2D { List GetCurves(); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Interfaces/ICurve2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Interfaces/ICurve2D.cs index 9a86c0fc0..bcad0ce12 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Interfaces/ICurve2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Interfaces/ICurve2D.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Planar { public interface ICurve2D : ISAMGeometry2D, IBoundable2D { @@ -10,4 +13,4 @@ public interface ICurve2D : ISAMGeometry2D, IBoundable2D void Reverse(); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Interfaces/IMovable2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Interfaces/IMovable2D.cs index f7ed96c2e..80640ae4e 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Interfaces/IMovable2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Interfaces/IMovable2D.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Planar { public interface IMovable2D : ISAMGeometry2D { @@ -11,4 +14,4 @@ public interface IMovable2D : IMovable2D where T : ISAMGeometry2D bool Move(Vector2D vector2D); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Interfaces/ISAMGeometry2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Interfaces/ISAMGeometry2D.cs index bf247a21c..2f433c720 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Interfaces/ISAMGeometry2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Interfaces/ISAMGeometry2D.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Planar { public interface ISAMGeometry2D : ISAMGeometry { @@ -6,4 +9,4 @@ public interface ISAMGeometry2D : ISAMGeometry bool Transform(ITransform2D transform2D); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Interfaces/ISegmentable2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Interfaces/ISegmentable2D.cs index 54dd09c0f..bb59ad41b 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Interfaces/ISegmentable2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Interfaces/ISegmentable2D.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -22,4 +25,4 @@ public interface ISegmentable2D : ICurvable2D double GetLength(); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Interfaces/ITransform2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Interfaces/ITransform2D.cs index 878a08240..2086fa380 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Interfaces/ITransform2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Interfaces/ITransform2D.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Geometry.Planar { @@ -6,4 +9,4 @@ public interface ITransform2D : IJSAMObject { void Inverse(); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Modify/Add.cs b/SAM/SAM.Geometry/Geometry/Planar/Modify/Add.cs index 529a6fc5f..f837c5fba 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Modify/Add.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Modify/Add.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -11,14 +14,14 @@ public static bool Add(this List point2Ds, Point2D point2D, double tole return false; } - foreach(Point2D point2D_Temp in point2Ds) + foreach (Point2D point2D_Temp in point2Ds) { - if(point2D_Temp == null) + if (point2D_Temp == null) { continue; } - if(System.Math.Abs(point2D_Temp.X - point2D.X) > tolerance) + if (System.Math.Abs(point2D_Temp.X - point2D.X) > tolerance) { continue; } @@ -28,7 +31,7 @@ public static bool Add(this List point2Ds, Point2D point2D, double tole continue; } - if(point2D_Temp.Distance(point2D) <= tolerance) + if (point2D_Temp.Distance(point2D) <= tolerance) { return false; } @@ -47,4 +50,4 @@ public static bool Add(this List point2Ds, double x, double y) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Modify/Connect.cs b/SAM/SAM.Geometry/Geometry/Planar/Modify/Connect.cs index 6008c28f3..3441ff12a 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Modify/Connect.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Modify/Connect.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -18,7 +21,7 @@ public static List Connect(this List segment2Ds, Point2D p return null; List result = segment2Ds.FindAll(x => x != null && (x[0].AlmostEquals(point2D, tolerance) || x[1].AlmostEquals(point2D, tolerance))); - if(result != null && result.Count > 0) + if (result != null && result.Count > 0) { return result; } @@ -28,20 +31,20 @@ public static List Connect(this List segment2Ds, Point2D p Segment2D segment2D = null; Point2D point2D_Project = null; - + double distance = double.MaxValue; List indexes = new List(); - for (int i=0; i < segment2Ds.Count; i++) + for (int i = 0; i < segment2Ds.Count; i++) { segment2D = segment2Ds[i]; - if(segment2D == null) + if (segment2D == null) { continue; } double distance_Temp = segment2D.Distance(point2D); - if(distance_Temp < tolerance) + if (distance_Temp < tolerance) { point2D_Project = segment2D.Project(point2D); @@ -66,7 +69,7 @@ public static List Connect(this List segment2Ds, Point2D p return result; } - if(distance_Temp < distance) + if (distance_Temp < distance) { distance = distance_Temp; indexes.Clear(); @@ -83,7 +86,7 @@ public static List Connect(this List segment2Ds, Point2D p indexes.Reverse(); - foreach(int index in indexes) + foreach (int index in indexes) { segment2D = segment2Ds[index]; @@ -99,7 +102,7 @@ public static List Connect(this List segment2Ds, Point2D p Segment2D segment2D_Temp = null; point2D_Project = segment2D.Project(point2D); - if(!segment2D.On(point2D_Project, tolerance)) + if (!segment2D.On(point2D_Project, tolerance)) { segment2D_Temp = segment2D[0].Distance(point2D_Project) > segment2D[1].Distance(point2D_Project) ? new Segment2D(point2D_Project, segment2D[1]) : new Segment2D(segment2D[0], point2D_Project); } @@ -131,4 +134,4 @@ public static List Connect(this List segment2Ds, Point2D p } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Modify/District.cs b/SAM/SAM.Geometry/Geometry/Planar/Modify/District.cs index 4f5d8520c..9214986a6 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Modify/District.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Modify/District.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -12,7 +15,7 @@ public static void District(this List point2Ds, double tolerance = Core List point2Ds_Temp = new List(point2Ds); List point2Ds_Result = new List(); - while(point2Ds_Temp.Count != 0) + while (point2Ds_Temp.Count != 0) { Point2D point2D = point2Ds_Temp.First(); point2Ds_Result.Add(point2D); @@ -26,4 +29,4 @@ public static void District(this List point2Ds, double tolerance = Core point2Ds.AddRange(point2Ds_Result); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Modify/Draw.cs b/SAM/SAM.Geometry/Geometry/Planar/Modify/Draw.cs index 023505692..666fb4260 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Modify/Draw.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Modify/Draw.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Drawing; using System.Linq; @@ -85,4 +88,4 @@ public static bool Draw(this Graphics graphics, Pen pen, Polygon2D polygon2D) return Draw(graphics, pen, polygon2D as ISegmentable2D); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Modify/InsertClosest.cs b/SAM/SAM.Geometry/Geometry/Planar/Modify/InsertClosest.cs index 91681f6f4..823a200fa 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Modify/InsertClosest.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Modify/InsertClosest.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -44,7 +47,7 @@ public static Point2D InsertClosest(this List point2Ds, Point2D point2D if (point2D_Closest.AlmostEquals(segment2D_Temp[0], tolerance)) return segment2D_Temp[0]; - if(point2D_Closest.AlmostEquals(segment2D_Temp[1], tolerance)) + if (point2D_Closest.AlmostEquals(segment2D_Temp[1], tolerance)) return segment2D_Temp[1]; segment2Ds[index] = new Segment2D(segment2D_Temp[0], point2D_Closest); @@ -58,4 +61,4 @@ public static Point2D InsertClosest(this List point2Ds, Point2D point2D return point2D_Closest; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Modify/JoinByIntersections.cs b/SAM/SAM.Geometry/Geometry/Planar/Modify/JoinByIntersections.cs index f07314937..34eba34ba 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Modify/JoinByIntersections.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Modify/JoinByIntersections.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -35,14 +38,14 @@ public static bool JoinByIntersections(this List segment2Ds, bool clo Segment2D segment_Previous = result[result.Count - 1]; Segment2D segment = result[0]; - Point2D point2D_Intersection = segment.Intersection(segment_Previous, false, tolerance); + Point2D point2D_Intersection = segment.Intersection(segment_Previous, false, tolerance); if (point2D_Intersection == null) { result.Add(new Segment2D(segment_Previous[1], segment[0])); } else { - result[result.Count - 1] = new Segment2D(segment_Previous[0], point2D_Intersection); + result[result.Count - 1] = new Segment2D(segment_Previous[0], point2D_Intersection); result[0] = new Segment2D(point2D_Intersection, segment[1]); } } @@ -73,15 +76,15 @@ public static bool JoinByIntersections(this List segment2Ds, bool all } else { - if(!segment_Previous.On(point2D_Intersection, tolerance) && !segment.On(point2D_Intersection, tolerance) && !allowSelfIntersection) + if (!segment_Previous.On(point2D_Intersection, tolerance) && !segment.On(point2D_Intersection, tolerance) && !allowSelfIntersection) { Segment2D segment2D; List point2Ds; segment2D = new Segment2D(segment_Previous[1], point2D_Intersection); - point2Ds = Query.Intersections(segment2D, segment2Ds); + point2Ds = Query.Intersections(segment2D, segment2Ds); point2Ds?.RemoveAll(x => x.AlmostEquals(segment2D[1], tolerance)); - if(point2Ds != null && point2Ds.Count != 0) + if (point2Ds != null && point2Ds.Count != 0) { result.Add(new Segment2D(segment[0], segment[1])); continue; @@ -137,7 +140,7 @@ public static bool JoinByIntersections(this List segment2Ds, bool all } } - if(join) + if (join) { result[result.Count - 1] = new Segment2D(segment_Previous[0], point2D_Intersection); result[0] = new Segment2D(point2D_Intersection, segment[1]); @@ -151,4 +154,4 @@ public static bool JoinByIntersections(this List segment2Ds, bool all return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Modify/JoinInRange.cs b/SAM/SAM.Geometry/Geometry/Planar/Modify/JoinInRange.cs index c54986eef..21e53ee73 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Modify/JoinInRange.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Modify/JoinInRange.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -20,7 +23,7 @@ public static bool JoinInRange(this List segment2Ds, bool close = fal Point2D point2D_Previous = segment2D_Previous[1]; Point2D point2D = segment2D[0]; - if(point2D_Previous.Distance(point2D) <= tolerance) + if (point2D_Previous.Distance(point2D) <= tolerance) { Point2D point2D_Mid = point2D_Previous.Mid(point2D); result[result.Count - 1] = new Segment2D(segment2D_Previous[0], point2D_Mid); @@ -55,4 +58,4 @@ public static bool JoinInRange(this List segment2Ds, bool close = fal return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Modify/MergeOverlaps.cs b/SAM/SAM.Geometry/Geometry/Planar/Modify/MergeOverlaps.cs index 3630887a3..b6e960ff5 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Modify/MergeOverlaps.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Modify/MergeOverlaps.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -8,16 +11,16 @@ public static partial class Modify { public static void MergeOverlaps(this List face2Ds, double tolerance = Core.Tolerance.Distance) { - if(face2Ds == null || face2Ds.Count < 2) + if (face2Ds == null || face2Ds.Count < 2) { return; } List> tuples = new List>(); - foreach(Face2D face2D in face2Ds) + foreach (Face2D face2D in face2Ds) { BoundingBox2D boundingBox2D = face2D?.GetBoundingBox(); - if(boundingBox2D == null) + if (boundingBox2D == null) { continue; } @@ -31,7 +34,7 @@ public static void MergeOverlaps(this List face2Ds, double tolerance = C Tuple tuple = tuples[0]; List> tuples_Temp = tuples.FindAll(x => tuple.Item2.InRange(x.Item2, tolerance)); - if(tuples_Temp.Count < 2) + if (tuples_Temp.Count < 2) { face2Ds_Temp.Add(tuple.Item1); tuples.RemoveAt(0); @@ -40,14 +43,14 @@ public static void MergeOverlaps(this List face2Ds, double tolerance = C List face2Ds_Split = tuples_Temp.ConvertAll(x => x.Item1).Split(tolerance); List>> tuples_Split = new List>>(); - foreach(Face2D face2D_Split in face2Ds_Split) + foreach (Face2D face2D_Split in face2Ds_Split) { - if(face2D_Split == null) + if (face2D_Split == null) { continue; } - if(face2D_Split.GetArea() < tolerance) + if (face2D_Split.GetArea() < tolerance) { continue; } @@ -70,11 +73,11 @@ public static void MergeOverlaps(this List face2Ds, double tolerance = C } List, List>> tuples_InvertedThinnessRatio = new List, List>>(); - foreach(Tuple> tuple_Split in tuples_Split) + foreach (Tuple> tuple_Split in tuples_Split) { Face2D face2D_Split = tuple_Split.Item1; - foreach(Face2D face2D in tuple_Split.Item2) + foreach (Face2D face2D in tuple_Split.Item2) { List face2Ds_Split_Before = new List(tuple_Split.Item2); face2Ds_Split_Before.Remove(face2D); @@ -83,7 +86,7 @@ public static void MergeOverlaps(this List face2Ds, double tolerance = C foreach (Face2D face2D_Split_Before in face2Ds_Split_Before) { List face2D_Split_After_Temp = face2D_Split_Before.Difference(face2D_Split, tolerance); - if(face2D_Split_After_Temp != null && face2D_Split_After_Temp.Count != 0) + if (face2D_Split_After_Temp != null && face2D_Split_After_Temp.Count != 0) { face2D_Split_After.AddRange(face2D_Split_After_Temp); } @@ -107,9 +110,9 @@ public static void MergeOverlaps(this List face2Ds, double tolerance = C face2Ds.Clear(); face2Ds.AddRange(face2Ds_Temp); - foreach(Tuple tuple_Temp in tuples) + foreach (Tuple tuple_Temp in tuples) { - if(tuple_InvertedThinnessRatio.Item2.Contains(tuple_Temp.Item1)) + if (tuple_InvertedThinnessRatio.Item2.Contains(tuple_Temp.Item1)) { continue; } @@ -124,4 +127,4 @@ public static void MergeOverlaps(this List face2Ds, double tolerance = C } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Modify/Mirror.cs b/SAM/SAM.Geometry/Geometry/Planar/Modify/Mirror.cs index 8390a8b1f..89064ba23 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Modify/Mirror.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Modify/Mirror.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -29,4 +32,4 @@ public static void Mirror(this List point2Ds, Point2D point2D) point2Ds[i].Mirror(point2D); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Modify/Move.cs b/SAM/SAM.Geometry/Geometry/Planar/Modify/Move.cs index 47d75736c..0e1364f33 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Modify/Move.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Modify/Move.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -16,4 +19,4 @@ public static void Move(this List point2Ds, Vector2D vector2D) point2Ds[i].Move(vector2D); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Modify/OrientByEnds.cs b/SAM/SAM.Geometry/Geometry/Planar/Modify/OrientByEnds.cs index a974b1e10..6aca484da 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Modify/OrientByEnds.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Modify/OrientByEnds.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -104,4 +107,4 @@ public static bool OrientByEnds(List curves2D) return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Modify/RemoveAlmostSimilar.cs b/SAM/SAM.Geometry/Geometry/Planar/Modify/RemoveAlmostSimilar.cs index 46eca6b72..33d7b3db1 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Modify/RemoveAlmostSimilar.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Modify/RemoveAlmostSimilar.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -86,4 +89,4 @@ public static void RemoveAlmostSimilar(List segmentable2Ds, double toleran segmentable2Ds.AddRange(result); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Modify/RemoveSimilar.cs b/SAM/SAM.Geometry/Geometry/Planar/Modify/RemoveSimilar.cs index bfc82b714..457144431 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Modify/RemoveSimilar.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Modify/RemoveSimilar.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Geometry.Planar @@ -7,7 +10,7 @@ public static partial class Modify { public static void RemoveSimilar(this List face2Ds, double tolerance = Core.Tolerance.Distance) { - if(face2Ds == null || face2Ds.Count < 2) + if (face2Ds == null || face2Ds.Count < 2) { return; } @@ -23,13 +26,13 @@ public static void RemoveSimilar(this List face2Ds, double tolerance = C face2Ds.Add(tuple.Item2); List> tuples_Similar = tuples.FindAll(x => tuple.Item1.InRange(x.Item1, tolerance)); - if(tuples_Similar.Count == 0) + if (tuples_Similar.Count == 0) { continue; } tuples_Similar.RemoveAll(x => !x.Item2.Similar(tuple.Item2, tolerance)); - if(tuples_Similar.Count == 0) + if (tuples_Similar.Count == 0) { continue; } @@ -38,4 +41,4 @@ public static void RemoveSimilar(this List face2Ds, double tolerance = C } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Modify/Reverse.cs b/SAM/SAM.Geometry/Geometry/Planar/Modify/Reverse.cs index 31a00f3a2..2163a5a0b 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Modify/Reverse.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Modify/Reverse.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -22,4 +25,4 @@ public static void Reverse(this List point2Ds, bool close) } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Modify/Scale.cs b/SAM/SAM.Geometry/Geometry/Planar/Modify/Scale.cs index a34608014..bb0d7f59c 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Modify/Scale.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Modify/Scale.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -24,4 +27,4 @@ public static void Scale(this List point2Ds, Point2D point2D, double fa point2Ds[i].Scale(point2D, factor); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Modify/SortByDistance.cs b/SAM/SAM.Geometry/Geometry/Planar/Modify/SortByDistance.cs index d60172301..3c83a83a0 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Modify/SortByDistance.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Modify/SortByDistance.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Geometry.Planar @@ -30,4 +33,4 @@ public static void SortByDistance(this List segment2Ds, Point2D point segment2Ds.AddRange(tuples.ConvertAll(x => x.Item2)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Modify/Tighten.cs b/SAM/SAM.Geometry/Geometry/Planar/Modify/Tighten.cs index a67b2dc1b..f690a1ce5 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Modify/Tighten.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Modify/Tighten.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; using System.Collections.Generic; namespace SAM.Geometry.Planar @@ -14,7 +17,7 @@ public static void Tighten(this List lineStrings, double tolerance = { if (lineStrings == null || lineStrings.Count == 0) return; - + List lineStrings_Short = lineStrings.FindAll(x => x.Length < tolerance && x.Coordinates.Length > 1); if (lineStrings_Short == null || lineStrings_Short.Count == 0) return; @@ -48,4 +51,4 @@ public static void Tighten(this List lineStrings, double tolerance = } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Above.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Above.cs index e784bcd4b..fa8ef6b47 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Above.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Above.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Planar { public static partial class Query { @@ -12,4 +15,4 @@ public static bool Above(this Math.PolynomialEquation polynomialEquation, Point2 return point2D.Y > y - tolerance; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/AdjacentSegment2Ds.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/AdjacentSegment2Ds.cs index 896b0a040..fbf90148d 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/AdjacentSegment2Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/AdjacentSegment2Ds.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -14,7 +17,7 @@ public static List AdjacentSegment2Ds(this IEnumerable result = new List(); - + if (segment2Ds.Count < 2) return result; @@ -22,7 +25,7 @@ public static List AdjacentSegment2Ds(this IEnumerable AdjacentSegment2Ds(this IEnumerable point2Ds) { return double.NaN; } - + List point2Ds_Temp = new List(point2Ds); if (point2Ds_Temp.FindIndex(x => x == null) != -1) { @@ -30,9 +33,9 @@ public static double Area(this IEnumerable point2Ds) point2Ds_Temp.Add(point2Ds_Temp[0]); count++; } - + return System.Math.Abs(point2Ds_Temp.Take(count - 1).Select((p, i) => (point2Ds_Temp[i + 1].X - p.X) * (point2Ds_Temp[i + 1].Y + p.Y)).Sum() / 2); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Average.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Average.cs index 3571272ce..563993039 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Average.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Average.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -14,7 +17,7 @@ public static Point2D Average(this IEnumerable point2Ds) double x = 0; double y = 0; - foreach(Point2D point2D in point2Ds) + foreach (Point2D point2D in point2Ds) { count++; x += point2D.X; @@ -24,4 +27,4 @@ public static Point2D Average(this IEnumerable point2Ds) return new Point2D(x / count, y / count); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/BottomLeft.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/BottomLeft.cs index b8870f60c..daa2519c6 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/BottomLeft.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/BottomLeft.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -48,4 +51,4 @@ public static Point2D BottomLeft(this IEnumerable segment2Ds) return new Point2D(x_Min, y_Min); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Bounce.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Bounce.cs index 889accb49..8d95dfbed 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Bounce.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Bounce.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Planar { public static partial class Query { @@ -26,4 +29,4 @@ public static Vector2D Bounce(this Vector2D vector2D_ToBeBounced, Vector2D vecto return result * vector2D_ToBeBounced.Length; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Centroid.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Centroid.cs index 7e860c152..66c59e0d8 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Centroid.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Centroid.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -43,4 +46,4 @@ public static Point2D Centroid(this IEnumerable point2Ds) return new Point2D(aX / aArea, aY / aArea); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Clone.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Clone.cs index b1c04e535..edeee997b 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Clone.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Clone.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -6,7 +9,7 @@ public static partial class Query { public static List Clone(this IEnumerable point2Ds) { - if(point2Ds == null) + if (point2Ds == null) { return null; } @@ -38,4 +41,4 @@ public static List Clone(this IEnumerable polygon2Ds) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Closest.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Closest.cs index c1c5453af..18ea9a6e8 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Closest.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Closest.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -134,7 +137,7 @@ public static T Closest(this ISegmentable2D segmentable2D, IEnumerable seg return default; } - + public static bool Closest(this Segment2D segment2D_1, Segment2D segment2D_2, out Point2D point2D_1, out Point2D point2D_2, double tolerance = Core.Tolerance.Distance) { point2D_1 = null; @@ -160,4 +163,4 @@ public static bool Closest(this Segment2D segment2D_1, Segment2D segment2D_2, ou return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/ClosestDictionary.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/ClosestDictionary.cs index af849b96a..77e30916a 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/ClosestDictionary.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/ClosestDictionary.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Geometry.Planar @@ -72,4 +75,4 @@ public static Dictionary ClosestDictionary(this Point2D point return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/ClosestSegment2Ds.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/ClosestSegment2Ds.cs index e2178bceb..b3c300c22 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/ClosestSegment2Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/ClosestSegment2Ds.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -32,4 +35,4 @@ public static List ClosestSegment2Ds(this ISegmentable2D segmentable2 return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Collinear.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Collinear.cs index 594d948ad..371fbe465 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Collinear.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Collinear.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Planar { public static partial class Query { @@ -29,4 +32,4 @@ public static bool Collinear(this Segment2D segment2D_1, Segment2D segment2D_2, return Collinear(segment2D_1, segment2D_2[0], tolerance) && Collinear(segment2D_1, segment2D_2[1], tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Concave.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Concave.cs index 88aa95962..f22a218c9 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Concave.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Concave.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -23,7 +26,7 @@ public static bool Concave(this IEnumerable point2Ds) for (int i = 2; i < point2Ds_Temp.Count - 1; i++) { int sign_Temp = System.Math.Sign(Determinant(point2Ds_Temp[i - 1], point2Ds_Temp[i], point2Ds_Temp[i + 1])); - if(sign != sign_Temp) + if (sign != sign_Temp) { return true; } @@ -32,9 +35,9 @@ public static bool Concave(this IEnumerable point2Ds) return false; } - public static bool Concave(this T segmentable2D) where T: ISegmentable2D, IClosed2D + public static bool Concave(this T segmentable2D) where T : ISegmentable2D, IClosed2D { - if(segmentable2D == null) + if (segmentable2D == null) { return false; } @@ -44,7 +47,7 @@ public static bool Concave(this T segmentable2D) where T: ISegmentable2D, ICl public static bool Concave(this Face2D face2D, bool externalEdge = true, bool internalEdges = true) { - if(face2D == null) + if (face2D == null) { return false; } @@ -52,4 +55,4 @@ public static bool Concave(this Face2D face2D, bool externalEdge = true, bool in return !Convex(face2D, externalEdge, internalEdges); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Connected.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Connected.cs index 9c31b62b3..7045538dc 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Connected.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Connected.cs @@ -1,4 +1,7 @@ -using QuickGraph; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using QuickGraph; using System; using System.Collections.Generic; using System.Linq; @@ -28,7 +31,7 @@ public static List> Connected(this IEnumerable segmentable2Ds, boo foreach (T segmentable2D in segmentable2Ds) { List segment2Ds_Temp = segmentable2D?.GetSegments(); - if(segment2Ds_Temp == null) + if (segment2Ds_Temp == null) { continue; } @@ -36,7 +39,7 @@ public static List> Connected(this IEnumerable segmentable2Ds, boo //segment2Ds_Temp.ForEach(x => x.Round(tolerance)); segment2Ds.AddRange(segment2Ds_Temp); - + tuples.Add(new Tuple, T>(segmentable2D.GetBoundingBox(), segmentable2D.GetPoints(), segmentable2D)); } @@ -56,19 +59,19 @@ public static List> Connected(this IEnumerable segmentable2Ds, boo connectedComponentsAlgorithm.Compute(); IDictionary components = connectedComponentsAlgorithm.Components; - if(components == null || components.Count == 0) + if (components == null || components.Count == 0) { return null; } List> result = Enumerable.Repeat>(null, connectedComponentsAlgorithm.ComponentCount).ToList(); - Parallel.For(0, connectedComponentsAlgorithm.ComponentCount, (int i) => + Parallel.For(0, connectedComponentsAlgorithm.ComponentCount, (int i) => { List segmentable2Ds_Temp = new List(); foreach (KeyValuePair keyValuePair in components) { - if(keyValuePair.Value != i) + if (keyValuePair.Value != i) { continue; } @@ -90,4 +93,4 @@ public static List> Connected(this IEnumerable segmentable2Ds, boo return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Contains.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Contains.cs index db15c447f..9118102b4 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Contains.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Contains.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -18,4 +21,4 @@ public static bool Contains(this IEnumerable point2Ds, Point2D point2D, return false; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Convex.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Convex.cs index 3adeab8a1..334366535 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Convex.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Convex.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -27,26 +30,26 @@ public static bool Convex(this T segmentable2D) where T : ISegmentable2D, ICl public static bool Convex(this Face2D face2D, bool externalEdge = true, bool internalEdges = true) { - if(face2D == null) + if (face2D == null) { return false; } - if(externalEdge) + if (externalEdge) { IClosed2D closed2D = face2D.ExternalEdge2D; - if(closed2D == null) + if (closed2D == null) { return false; } ISegmentable2D segmentable2D = closed2D as ISegmentable2D; - if(segmentable2D == null) + if (segmentable2D == null) { throw new System.NotImplementedException(); } - if(!Convex(segmentable2D.GetPoints())) + if (!Convex(segmentable2D.GetPoints())) { return false; } @@ -60,7 +63,7 @@ public static bool Convex(this Face2D face2D, bool externalEdge = true, bool int return true; } - foreach(IClosed2D closed2D in closed2Ds) + foreach (IClosed2D closed2D in closed2Ds) { ISegmentable2D segmentable2D = closed2D as ISegmentable2D; if (segmentable2D == null) @@ -78,4 +81,4 @@ public static bool Convex(this Face2D face2D, bool externalEdge = true, bool int return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/ConvexHull.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/ConvexHull.cs index a1239c345..c97e1d675 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/ConvexHull.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/ConvexHull.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -71,4 +74,4 @@ public static List ConvexHull(this ISegmentable2D segmentable2D) return ConvexHull(segmentable2D.GetSegments()); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Cut.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Cut.cs index ed83509f2..14b583cfd 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Cut.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Cut.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System; using System.Collections.Generic; @@ -75,7 +78,7 @@ public static List Cut(this Face2D face2D, IEnumerable s } IClosed2D externalEdge2D = face2D.ExternalEdge2D; - if(externalEdge2D == null) + if (externalEdge2D == null) { return null; } @@ -83,7 +86,7 @@ public static List Cut(this Face2D face2D, IEnumerable s List internalEdge2Ds = face2D.InternalEdge2Ds; List edge2Ds = new List() { externalEdge2D }; - if(internalEdge2Ds != null) + if (internalEdge2Ds != null) { edge2Ds.AddRange(internalEdge2Ds); } @@ -140,7 +143,7 @@ public static List Cut(this Face2D face2D, IEnumerable s } double area = polygon2D.GetArea(); - if(double.IsNaN(area)) + if (double.IsNaN(area)) { continue; } @@ -167,7 +170,7 @@ public static List Cut(this Face2D face2D, IEnumerable s } tuples_Temp.Sort((x, y) => y.Item3.CompareTo(x.Item3)); - if(tuples_Temp[0] == tuple) + if (tuples_Temp[0] == tuple) { externalEdges_New.Add(tuple.Item1); continue; @@ -188,7 +191,7 @@ public static List Cut(this Face2D face2D, IEnumerable s List face2Ds_Fixed = new List(); List face2Ds_Fixed_Temp = face2D_New.FixEdges(tolerance); - if(face2Ds_Fixed_Temp == null || face2Ds_Fixed_Temp.Count == 0) + if (face2Ds_Fixed_Temp == null || face2Ds_Fixed_Temp.Count == 0) { face2Ds_Fixed.Add(face2D_New); } @@ -197,15 +200,15 @@ public static List Cut(this Face2D face2D, IEnumerable s face2Ds_Fixed.AddRange(face2Ds_Fixed_Temp); } - foreach(Face2D face2D_Fixed in face2Ds_Fixed) + foreach (Face2D face2D_Fixed in face2Ds_Fixed) { Point2D point2D = face2D_Fixed?.InternalPoint2D(tolerance); - if(point2D == null) + if (point2D == null) { continue; } - if(!face2D.Inside(point2D, tolerance)) + if (!face2D.Inside(point2D, tolerance)) { continue; } @@ -224,16 +227,16 @@ public static Polygon2D Cut(this Polygon2D polygon2D, IEnumerable point2Ds = polygon2D.Intersections(segmentable2Ds, tolerance); + List point2Ds = polygon2D.Intersections(segmentable2Ds, tolerance); if (point2Ds == null || point2Ds.Count == 0) return result; - - foreach(Point2D point2D in point2Ds) + + foreach (Point2D point2D in point2Ds) result.InsertClosest(point2D, tolerance); return result; } - + public static Polyline2D Cut(this Polyline2D polyline2D, IEnumerable segmentable2Ds, double tolerance = Tolerance.Distance) { if (polyline2D == null || segmentable2Ds == null) @@ -251,4 +254,4 @@ public static Polyline2D Cut(this Polyline2D polyline2D, IEnumerable Determinants(this T segmentable2D) where T: IClosed2D, ISegmentable2D + public static List Determinants(this T segmentable2D) where T : IClosed2D, ISegmentable2D { return Determinants(segmentable2D?.GetPoints()); } public static List Determinants(this IEnumerable point2Ds) { - if(point2Ds == null || point2Ds.Count() < 3) + if (point2Ds == null || point2Ds.Count() < 3) { return null; } diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/DiagonalLength.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/DiagonalLength.cs index 91dfac4b6..3c74a75b5 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/DiagonalLength.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/DiagonalLength.cs @@ -1,16 +1,19 @@ -namespace SAM.Geometry.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Planar { public static partial class Query { public static double DiagonalLength(this BoundingBox2D boundingBox2D) { - if(boundingBox2D == null || !boundingBox2D.IsValid()) + if (boundingBox2D == null || !boundingBox2D.IsValid()) { return double.NaN; } Segment2D[] segment2Ds = boundingBox2D.GetDiagonals(); - if(segment2Ds == null || segment2Ds.Length == 0) + if (segment2Ds == null || segment2Ds.Length == 0) { return double.NaN; } @@ -18,4 +21,4 @@ public static double DiagonalLength(this BoundingBox2D boundingBox2D) return segment2Ds[0].GetLength(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Difference.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Difference.cs index f239e5797..ceef98c4c 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Difference.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Difference.cs @@ -1,4 +1,7 @@ -//using ClipperLib; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +//using ClipperLib; using NetTopologySuite.Geometries; using NetTopologySuite.Geometries.Utilities; using NetTopologySuite.Precision; @@ -77,12 +80,12 @@ public static List Difference(this Face2D face2D_1, Face2D face2D_2, dou result = Difference_NTS(face2D_1, face2D_2, tolerance); sAM = false; } - catch(System.Exception) + catch (System.Exception) { sAM = true; } - if(sAM) + if (sAM) { result = Difference_SAM(face2D_1, face2D_2, tolerance); } @@ -149,12 +152,12 @@ public static List Difference(this Polygon2D polygon2D, IEnumerable

    Difference(this IEnumerable polygon2Ds_1, IEnumerable polygon2Ds_2, double tolerance = Core.Tolerance.MicroDistance) { - if(polygon2Ds_1 == null || polygon2Ds_2 == null) + if (polygon2Ds_1 == null || polygon2Ds_2 == null) { return null; } - if(polygon2Ds_2.Count() == 0) + if (polygon2Ds_2.Count() == 0) { return polygon2Ds_1.ToList().ConvertAll(x => new Polygon2D(x)); } @@ -166,7 +169,7 @@ public static List Difference(this IEnumerable polygon2Ds_ return new List(); } - if(count == 1) + if (count == 1) { return Difference(polygon2Ds_1.ElementAt(0), polygon2Ds_2, tolerance); } @@ -175,10 +178,10 @@ public static List Difference(this IEnumerable polygon2Ds_ if (count < 10 && polygon2Ds_2.Count() < 10) { - foreach(Polygon2D polygon2D in polygon2Ds_1) + foreach (Polygon2D polygon2D in polygon2Ds_1) { List polygon2Ds = polygon2D?.Difference(polygon2Ds_2, tolerance); - if(polygon2Ds != null) + if (polygon2Ds != null) { result.AddRange(polygon2Ds); } @@ -188,14 +191,14 @@ public static List Difference(this IEnumerable polygon2Ds_ { List> polygon2DsList = Enumerable.Repeat>(null, count).ToList(); - Parallel.For(0, count, (int i) => + Parallel.For(0, count, (int i) => { polygon2DsList[i] = polygon2Ds_1.ElementAt(0)?.Difference(polygon2Ds_2, tolerance); }); - foreach(List polygon2Ds in polygon2DsList) + foreach (List polygon2Ds in polygon2DsList) { - if(polygon2Ds == null || polygon2Ds.Count == 0) + if (polygon2Ds == null || polygon2Ds.Count == 0) { continue; } @@ -223,12 +226,12 @@ public static List Difference(this Face2D face2D, IEnumerable fa { return result; } - - foreach(Face2D face2D_Temp in face2Ds) + + foreach (Face2D face2D_Temp in face2Ds) { if (face2D_Temp.GetArea() <= tolerance) continue; - + List face2Ds_Temp = new List(); foreach (Face2D face2D_Result in result) { @@ -252,7 +255,7 @@ public static List Difference(this Face2D face2D, IEnumerable fa return result; } - + private static List Difference_NTS(this Face2D face2D_1, Face2D face2D_2, double tolerance = Core.Tolerance.MicroDistance) { if (face2D_1 == null || face2D_2 == null) @@ -317,7 +320,7 @@ private static List Difference_NTS(this Face2D face2D_1, Face2D face2D_2 return result; NetTopologySuite.Geometries.Geometry geometry_1 = polygon_1; - if(!geometry_1.IsValid) + if (!geometry_1.IsValid) { geometry_1 = GeometryFixer.Fix(geometry_1); } @@ -399,7 +402,7 @@ private static List Difference_NTS(this Face2D face2D_1, Face2D face2D_2 private static List Difference_SAM(this Face2D face2D_1, Face2D face2D_2, double tolerance = Core.Tolerance.MicroDistance) { - if(face2D_1 == null || face2D_2 == null) + if (face2D_1 == null || face2D_2 == null) { return null; } @@ -409,12 +412,12 @@ private static List Difference_SAM(this Face2D face2D_1, Face2D face2D_2 List edge2Ds_Temp = null; edge2Ds_Temp = face2D_1.Edge2Ds; - if(edge2Ds_Temp == null) + if (edge2Ds_Temp == null) { return null; } - if(!edge2Ds_Temp.TrueForAll(x => x is ISegmentable2D)) + if (!edge2Ds_Temp.TrueForAll(x => x is ISegmentable2D)) { throw new System.NotImplementedException(); } @@ -433,7 +436,7 @@ private static List Difference_SAM(this Face2D face2D_1, Face2D face2D_2 } segmentable2Ds.AddRange(edge2Ds_Temp.ConvertAll(x => (ISegmentable2D)x)); - if(segmentable2Ds == null || segmentable2Ds.Count == 0) + if (segmentable2Ds == null || segmentable2Ds.Count == 0) { return null; } @@ -442,16 +445,16 @@ private static List Difference_SAM(this Face2D face2D_1, Face2D face2D_2 segment2Ds = Snap(segment2Ds, true, tolerance); List polygon2Ds_All = segment2Ds.Polygon2Ds(tolerance); - if(polygon2Ds_All == null || polygon2Ds_All.Count == 0) + if (polygon2Ds_All == null || polygon2Ds_All.Count == 0) { return null; } List polygon2Ds = new List(); - foreach(Polygon2D polygon2D in polygon2Ds_All) + foreach (Polygon2D polygon2D in polygon2Ds_All) { Point2D point2D = polygon2D?.GetInternalPoint2D(tolerance); - if(point2D == null) + if (point2D == null) { continue; } @@ -461,7 +464,7 @@ private static List Difference_SAM(this Face2D face2D_1, Face2D face2D_2 continue; } - if(face2D_2.Inside(point2D, tolerance)) + if (face2D_2.Inside(point2D, tolerance)) { continue; } @@ -474,7 +477,7 @@ private static List Difference_SAM(this Face2D face2D_1, Face2D face2D_2 polygon2Ds.Add(polygon2D); } - if(polygon2Ds == null || polygon2Ds.Count == 0) + if (polygon2Ds == null || polygon2Ds.Count == 0) { return new List(); } @@ -482,4 +485,4 @@ private static List Difference_SAM(this Face2D face2D_1, Face2D face2D_2 return Create.Face2Ds(polygon2Ds, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Direction.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Direction.cs index a51931290..9998272e4 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Direction.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Direction.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Planar { public static partial class Query { @@ -6,7 +9,7 @@ public static Vector2D Direction(this Alignment alignment) { if (alignment == Alignment.Undefined) return null; - + switch (alignment) { case Alignment.Vertical: @@ -19,4 +22,4 @@ public static Vector2D Direction(this Alignment alignment) return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Directions.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Directions.cs index 699948536..a3964bfe5 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Directions.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Directions.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -35,4 +38,4 @@ public static List Directions(this IEnumerable segment return dictionary.Values.ToList(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Distance.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Distance.cs index 584064208..c515584eb 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Distance.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Distance.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -57,4 +60,4 @@ public static double Distance(this ISegmentable2D segmentable2D_1, Point2D point return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Edges.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Edges.cs index 66f403ba8..1afdbf4e4 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Edges.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Edges.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -10,15 +13,15 @@ public static List Edges(this IEnumerable face2Ds) return null; List result = new List(); - foreach(Face2D face2D in face2Ds) + foreach (Face2D face2D in face2Ds) { - if(face2D == null) + if (face2D == null) { continue; } List edges_Temp = face2D.Edge2Ds; - if(edges_Temp == null && edges_Temp.Count == 0) + if (edges_Temp == null && edges_Temp.Count == 0) { continue; } @@ -28,5 +31,5 @@ public static List Edges(this IEnumerable face2Ds) return result; } - } -} \ No newline at end of file + } +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/EqualsTopologically.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/EqualsTopologically.cs index 198b82ecb..8855f5e5e 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/EqualsTopologically.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/EqualsTopologically.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Planar { public static partial class Query { @@ -19,4 +22,4 @@ public static bool EqualsTopologically(this ISegmentable2D segmentable2D_1, ISeg return geometry_1.EqualsTopologically(geometry_2); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Evaluate.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Evaluate.cs index f470e651f..3cd622c71 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Evaluate.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Evaluate.cs @@ -1,4 +1,7 @@ -using SAM.Math; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Math; namespace SAM.Geometry.Planar { @@ -15,5 +18,5 @@ public static Point2D Evaluate(this PolynomialEquation polynominalEquation, doub return new Point2D(x, y); } - } -} \ No newline at end of file + } +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Extend.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Extend.cs index df5be7cbd..3b7a2f504 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Extend.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Extend.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -136,4 +139,4 @@ public static Polyline2D Extend(this Polyline2D polyline2D, ISegmentable2D segme return new Polyline2D(segment2Ds); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/ExternalPolygon2Ds.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/ExternalPolygon2Ds.cs index 77bdb0378..4e4b481b0 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/ExternalPolygon2Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/ExternalPolygon2Ds.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -46,7 +49,7 @@ public static List ExternalPolygon2Ds(this IEnumerable polygon2Ds = Create.Polygon2Ds(segmentable2Ds, maxDistance, false, tolerance); - if(polygon2Ds == null || polygon2Ds.Count == 0) + if (polygon2Ds == null || polygon2Ds.Count == 0) { return null; } @@ -54,4 +57,4 @@ public static List ExternalPolygon2Ds(this IEnumerable point2Ds, out Point2D } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Fill.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Fill.cs index f9f29152a..17dce4eb0 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Fill.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Fill.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -13,16 +16,16 @@ public static List Fill(this Face2D face2D, IEnumerable face2Ds, } List face2Ds_Temp = new List(); - foreach(Face2D face2D_Temp in face2Ds) + foreach (Face2D face2D_Temp in face2Ds) { List face2Ds_Intersection = face2D.Intersection(face2D_Temp, tolerance_Distance); - if(face2Ds_Intersection != null && face2Ds_Intersection.Count != 0) + if (face2Ds_Intersection != null && face2Ds_Intersection.Count != 0) { face2Ds_Temp.AddRange(face2Ds_Intersection); } } - if(face2Ds_Temp == null || face2Ds_Temp.Count == 0) + if (face2Ds_Temp == null || face2Ds_Temp.Count == 0) { return null; } @@ -44,7 +47,7 @@ public static List Fill(this Face2D face2D, IEnumerable face2Ds, } List face2Ds_Offset = new List(); - foreach(Face2D face2D_Temp in face2Ds_Temp) + foreach (Face2D face2D_Temp in face2Ds_Temp) { List face2Ds_Offset_Temp = face2D_Temp.Offset(offset, true, false, tolerance_Distance); if (face2Ds_Offset_Temp != null && face2Ds_Offset_Temp.Count != 0) @@ -56,22 +59,22 @@ public static List Fill(this Face2D face2D, IEnumerable face2Ds, //Making sure Face2Ds do not reduce size face2Ds_Temp = new List(face2Ds_Offset); Modify.MergeOverlaps(face2Ds_Temp, tolerance_Distance); - foreach(Face2D face2D_Temp in face2Ds_Temp) + foreach (Face2D face2D_Temp in face2Ds_Temp) { Point2D point2D = face2D_Temp.InternalPoint2D(tolerance_Distance); int index = face2Ds_Offset.FindIndex(x => x.GetBoundingBox().Inside(point2D, tolerance_Distance) && x.Inside(point2D, tolerance_Distance)); - if(index == -1) + if (index == -1) { continue; } List face2Ds_Union = face2D_Temp.Union(face2Ds_Offset[index], tolerance_Distance); - if(face2Ds_Union == null || face2Ds_Union.Count == 0) + if (face2Ds_Union == null || face2Ds_Union.Count == 0) { continue; } - if(face2Ds_Union.Count > 1) + if (face2Ds_Union.Count > 1) { face2Ds_Union.Sort((x, y) => y.GetArea().CompareTo(x.GetArea())); } @@ -92,4 +95,4 @@ public static List Fill(this Face2D face2D, IEnumerable face2Ds, return Fill(face2D, face2Ds_Offset, offset, tolerance_Area, tolerance_Distance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/FilterRelevant.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/FilterRelevant.cs index 32f393e4b..b86a11ef4 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/FilterRelevant.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/FilterRelevant.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries.Prepared; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries.Prepared; using System.Collections.Generic; using System.Linq; @@ -8,20 +11,20 @@ public static partial class Query { public static NetTopologySuite.Geometries.Geometry FilterRelevant(NetTopologySuite.Geometries.Geometry geometry, IEnumerable geometries) { - if(geometry == null) + if (geometry == null) { return null; } - if(geometries == null || geometries.Count() == 0) + if (geometries == null || geometries.Count() == 0) { return geometry; } List geometries_Temp = new List(); - + IPreparedGeometry preparedGeometry = PreparedGeometryFactory.Prepare(geometry); - + foreach (NetTopologySuite.Geometries.Geometry geometry_Temp in geometries) { if (preparedGeometry.Contains(geometry_Temp)) @@ -29,8 +32,8 @@ public static NetTopologySuite.Geometries.Geometry FilterRelevant(NetTopologySui geometries_Temp.Add(geometry_Temp); } } - + return geometry.Factory.BuildGeometry(geometries_Temp); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/FixEdges.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/FixEdges.cs index 56d1996d4..0b460382f 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/FixEdges.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/FixEdges.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -173,4 +176,4 @@ public static List FixEdges(this Polygon2D polygon2D, double toleranc return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Grid.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Grid.cs index 0c44439b0..cf40c630c 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Grid.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Grid.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -10,9 +13,9 @@ public static List Grid(this Point2D origin, IEnumerable boundingBox2Ds = new List(); - foreach(IBoundable2D boundable2D in boundable2Ds) + foreach (IBoundable2D boundable2D in boundable2Ds) { - BoundingBox2D boundingBox2D_Temp= boundable2D?.GetBoundingBox(); + BoundingBox2D boundingBox2D_Temp = boundable2D?.GetBoundingBox(); if (boundingBox2D_Temp == null) continue; @@ -29,7 +32,7 @@ public static List Grid(this Point2D origin, IEnumerable segment2Ds_Temp = null; - List segment2Ds_KeepFull =null; + List segment2Ds_KeepFull = null; if (keepFull) segment2Ds_KeepFull = new List(); @@ -49,7 +52,7 @@ public static List Grid(this Point2D origin, IEnumerable Grid(this Point2D origin, IEnumerable= boundingBox2D.Min.X) + if (value >= boundingBox2D.Min.X) { segment2D = new Segment2D(new Point2D(value, boundingBox2D.Min.Y), new Point2D(value, boundingBox2D.Max.Y)); result.Add(segment2D); @@ -125,13 +128,13 @@ public static List Grid(this Point2D origin, IEnumerable segment2D_KeepFull.GetBoundingBox())); - if(boundingBox2D_KeepFull != null) + if (boundingBox2D_KeepFull != null) { result = Extend(result, boundingBox2D_KeepFull); - foreach(Segment2D segment2D_KeepFull in boundingBox2D_KeepFull.GetSegments()) + foreach (Segment2D segment2D_KeepFull in boundingBox2D_KeepFull.GetSegments()) { if (result.Find(segment2D_Temp => segment2D_Temp.AlmostSimilar(segment2D_KeepFull)) == null) result.Add(segment2D_KeepFull); @@ -142,4 +145,4 @@ public static List Grid(this Point2D origin, IEnumerable Holes(this IEnumerable face2Ds, double tol return null; List> tuples = new List>(); - foreach(Face2D face2D in face2Ds_Union) + foreach (Face2D face2D in face2Ds_Union) { BoundingBox2D boundingBox2D = face2D?.GetBoundingBox(); if (boundingBox2D == null) @@ -31,7 +34,7 @@ public static List Holes(this IEnumerable face2Ds, double tol if (internalEdge2Ds == null || internalEdge2Ds.Count == 0) continue; - foreach(IClosed2D closed2D in internalEdge2Ds) + foreach (IClosed2D closed2D in internalEdge2Ds) { BoundingBox2D boundingBox2D = closed2D?.GetBoundingBox(tolerance); if (boundingBox2D == null) @@ -48,4 +51,4 @@ public static List Holes(this IEnumerable face2Ds, double tol return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/InRange.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/InRange.cs index de676bbab..dd7e5cf70 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/InRange.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/InRange.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -36,7 +39,7 @@ public static bool InRange(this IClosed2D closed2D, ISegmentable2D segmentable2D if (point2Ds == null || point2Ds.Count == 0) return false; - foreach(Point2D point2D in point2Ds) + foreach (Point2D point2D in point2Ds) { if (closed2D_Temp.InRange(point2D, tolerance)) return true; @@ -44,7 +47,7 @@ public static bool InRange(this IClosed2D closed2D, ISegmentable2D segmentable2D if (!(closed2D_Temp is ISegmentable2D)) { - if(closed2D_Temp is Circle2D) + if (closed2D_Temp is Circle2D) { Circle2D circle2D = (Circle2D)closed2D_Temp; return point2Ds.Find(x => circle2D.Inside(x, tolerance)) != null; @@ -62,4 +65,4 @@ public static bool InRange(this IClosed2D closed2D, ISegmentable2D segmentable2D return false; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/IndexOfClosestPoint2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/IndexOfClosestPoint2D.cs index 4b3211648..46c057213 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/IndexOfClosestPoint2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/IndexOfClosestPoint2D.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -32,4 +35,4 @@ public static int IndexOfClosestPoint2D(this ISegmentable2D segmentable2D, Point return index; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/IndexOfClosestSegment2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/IndexOfClosestSegment2D.cs index e63d07128..4f36e488e 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/IndexOfClosestSegment2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/IndexOfClosestSegment2D.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -29,4 +32,4 @@ public static int IndexOfClosestSegment2D(this IEnumerable segment2Ds return index; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/IndexesOfClosestSegment2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/IndexesOfClosestSegment2D.cs index b1ae61794..b57087ae9 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/IndexesOfClosestSegment2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/IndexesOfClosestSegment2D.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -30,4 +33,4 @@ public static List IndexesOfClosestSegment2D(this ISegmentable2D segmentabl return IndexesOfClosestSegment2D(segmentable2D?.GetSegments(), point2D, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Inside.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Inside.cs index f1bb74831..9b4e35991 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Inside.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Inside.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; @@ -41,7 +44,7 @@ public static bool Inside(this Face2D face2D, Point2D point2D, double tolerance if (internalEdge2Ds == null || internalEdge2Ds.Count == 0) return true; - foreach(IClosed2D closed2D in internalEdge2Ds) + foreach (IClosed2D closed2D in internalEdge2Ds) if (closed2D.Inside(point2D, tolerance)) return false; @@ -71,4 +74,4 @@ public static bool Inside(this Rectangle2D rectangle2D, Rectangle2D rectangle2D2 return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/InternalPoint2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/InternalPoint2D.cs index 7f3802e8f..682e7c881 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/InternalPoint2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/InternalPoint2D.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -18,7 +21,7 @@ public static Point2D InternalPoint2D(this IClosed2D closed2D, double tolerance return ((Face)closed2D).GetInternalPoint2D(tolerance); } - if(closed2D is Triangle2D) + if (closed2D is Triangle2D) { return ((Triangle2D)closed2D).GetCentroid(); } @@ -94,4 +97,4 @@ public static Point2D InternalPoint2D(IEnumerable point2Ds, double tole return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/InternalVector2Ds.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/InternalVector2Ds.cs index b252d8198..20dab508e 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/InternalVector2Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/InternalVector2Ds.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -14,7 +17,7 @@ public static List InternalVector2Ds(this Polygon2D polygon2D) return null; List result = new List(); - foreach(Segment2D segment2D in polygon2D.GetSegments()) + foreach (Segment2D segment2D in polygon2D.GetSegments()) { Vector2D vector2D = segment2D.Vector.GetPerpendicular(orientation); result.Add(vector2D?.Unit); @@ -23,4 +26,4 @@ public static List InternalVector2Ds(this Polygon2D polygon2D) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Intersect.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Intersect.cs index 7aa303ea1..2063ca56b 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Intersect.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Intersect.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -57,4 +60,4 @@ public static bool Intersect(this ISegmentable2D segmentable2D, IEnumerableSecond Segment2D /// Tolerance /// Intersection Geometry - public static T Intersection(this Segment2D segment2D_1, Segment2D segment2D_2, double tolerance = Core.Tolerance.MicroDistance) where T: ISAMGeometry2D + public static T Intersection(this Segment2D segment2D_1, Segment2D segment2D_2, double tolerance = Core.Tolerance.MicroDistance) where T : ISAMGeometry2D { - if(segment2D_1 == null || segment2D_2 == null) + if (segment2D_1 == null || segment2D_2 == null) { return default; } LineString lineString_1 = segment2D_1.ToNTS(tolerance); LineString lineString_2 = segment2D_2.ToNTS(tolerance); - + NetTopologySuite.Geometries.Geometry geometry = lineString_1?.Intersection(lineString_2); if (geometry == null || geometry.IsEmpty) { @@ -142,7 +145,7 @@ public static T Intersection(this Segment2D segment2D_1, Segment2D segment2D_ if (polyline2D.Points.Count == 2 && typeof(T).IsAssignableFrom(typeof(Segment2D))) return (T)(object)(new Segment2D(polyline2D[0], polyline2D[1])); } - else if(geometry is Point) + else if (geometry is Point) { Point2D point2D = ((Point)geometry).ToSAM(tolerance); if (typeof(T) == typeof(Point2D)) @@ -201,30 +204,30 @@ public static List Intersection(this Face2D face2D_1, Face2D face2D_2, d public static List Intersection(this Polygon2D polygon2D_1, Polygon2D polygon2D_2, double tolerance = Core.Tolerance.MicroDistance) { - if(polygon2D_1 == null || polygon2D_2 == null) + if (polygon2D_1 == null || polygon2D_2 == null) { return null; } List face2Ds = Intersection(new Face2D(polygon2D_1), new Face2D(polygon2D_2), tolerance); - if(face2Ds == null) + if (face2Ds == null) { return null; } List result = new List(); - foreach(Face2D face2D in face2Ds) + foreach (Face2D face2D in face2Ds) { List edge2Ds = face2D.Edge2Ds; - if(edge2Ds == null || edge2Ds.Count == 0) + if (edge2Ds == null || edge2Ds.Count == 0) { continue; } - foreach(IClosed2D edge2D in edge2Ds) + foreach (IClosed2D edge2D in edge2Ds) { ISegmentable2D segmentable2D = edge2D as ISegmentable2D; - if(segmentable2D == null) + if (segmentable2D == null) { continue; } @@ -236,9 +239,9 @@ public static List Intersection(this Polygon2D polygon2D_1, Polygon2D return result; } - public static List Intersection(this Face2D face2D_1, Face2D face2D_2, double tolerance = Core.Tolerance.MicroDistance) where T: ISAMGeometry2D + public static List Intersection(this Face2D face2D_1, Face2D face2D_2, double tolerance = Core.Tolerance.MicroDistance) where T : ISAMGeometry2D { - if(face2D_1 == null || face2D_2 == null) + if (face2D_1 == null || face2D_2 == null) { return null; } @@ -249,9 +252,9 @@ public static List Intersection(this Face2D face2D_1, Face2D face2D_2, dou } List face2Ds_1 = face2D_1.FixEdges(tolerance); - if(face2Ds_1 == null || face2Ds_1.Count == 0) + if (face2Ds_1 == null || face2Ds_1.Count == 0) { - face2Ds_1 = new List() { face2D_1}; + face2Ds_1 = new List() { face2D_1 }; } List face2Ds_2 = face2D_2.FixEdges(tolerance); @@ -263,7 +266,7 @@ public static List Intersection(this Face2D face2D_1, Face2D face2D_2, dou List geometries = new List(); foreach (Face2D face2D_1_Temp in face2Ds_1) { - if(face2D_1_Temp == null || face2D_1_Temp.GetArea() < tolerance) + if (face2D_1_Temp == null || face2D_1_Temp.GetArea() < tolerance) { continue; } @@ -295,7 +298,7 @@ public static List Intersection(this Face2D face2D_1, Face2D face2D_2, dou } NetTopologySuite.Geometries.Geometry geometry_1 = polygon_1; - if(!geometry_1.IsValid) + if (!geometry_1.IsValid) { geometry_1 = GeometryFixer.Fix(geometry_1); } @@ -311,7 +314,7 @@ public static List Intersection(this Face2D face2D_1, Face2D face2D_2, dou { geometry = geometry_1.Intersection(geometry_2); } - catch(System.Exception) + catch (System.Exception) { try @@ -366,11 +369,11 @@ public static List Intersection(this Face2D face2D_1, Face2D face2D_2, dou result.Add(face2D); } } - else if(geometry_Temp is LineString) + else if (geometry_Temp is LineString) { result.Add(((LineString)geometry_Temp).ToSAM(tolerance)); } - else if(geometry_Temp is LinearRing) + else if (geometry_Temp is LinearRing) { result.Add(((LinearRing)geometry_Temp).ToSAM(tolerance)); } @@ -382,12 +385,12 @@ public static List Intersection(this Face2D face2D_1, Face2D face2D_2, dou public static List Intersection(this Face2D face2D, Segment2D segment2D, double tolerance = Core.Tolerance.MicroDistance) where T : ISAMGeometry2D { - if(face2D == null || segment2D == null) + if (face2D == null || segment2D == null) { return null; } - if(!segment2D.IsValid() || segment2D.GetLength() < tolerance) + if (!segment2D.IsValid() || segment2D.GetLength() < tolerance) { return null; } @@ -403,7 +406,7 @@ public static List Intersection(this Face2D face2D, Segment2D segment2D, d } List result = new List(); - foreach(Face2D face2D_Temp in face2Ds) + foreach (Face2D face2D_Temp in face2Ds) { Polygon polygon = face2D_Temp?.ToNTS(tolerance); if (polygon == null) @@ -422,9 +425,9 @@ public static List Intersection(this Face2D face2D, Segment2D segment2D, d List geometries = new List(); - if(geometry is GeometryCollection) + if (geometry is GeometryCollection) { - foreach(NetTopologySuite.Geometries.Geometry geometry_Temp in (GeometryCollection)geometry) + foreach (NetTopologySuite.Geometries.Geometry geometry_Temp in (GeometryCollection)geometry) { geometries.Add(geometry_Temp); } @@ -434,7 +437,7 @@ public static List Intersection(this Face2D face2D, Segment2D segment2D, d geometries.Add(geometry); } - foreach(NetTopologySuite.Geometries.Geometry geometry_Temp in geometries) + foreach (NetTopologySuite.Geometries.Geometry geometry_Temp in geometries) { if (geometry_Temp is LineString) { @@ -462,7 +465,7 @@ public static List Intersection(this Face2D face2D, Segment2D segment2D, d else if (geometry_Temp is Point) { Point2D point2D = ((Point)geometry_Temp).ToSAM(); - if(point2D is T) + if (point2D is T) { result.Add((T)(object)point2D); } @@ -474,7 +477,7 @@ public static List Intersection(this Face2D face2D, Segment2D segment2D, d //SAM Method List closed2Ds = face2D.Edge2Ds; - if(closed2Ds == null || closed2Ds.Count == 0) + if (closed2Ds == null || closed2Ds.Count == 0) { continue; } @@ -482,19 +485,19 @@ public static List Intersection(this Face2D face2D, Segment2D segment2D, d List point2Ds = new List(); foreach (IClosed2D closed2D in closed2Ds) { - if(closed2D == null) + if (closed2D == null) { continue; } ISegmentable2D segmentable2D = closed2D as ISegmentable2D; - if(segmentable2D == null) + if (segmentable2D == null) { throw new System.NotImplementedException(); } List point2Ds_Intersections = Intersections(segment2D, segmentable2D); - if(point2Ds_Intersections == null || point2Ds_Intersections.Count == 0) + if (point2Ds_Intersections == null || point2Ds_Intersections.Count == 0) { continue; } @@ -508,16 +511,16 @@ public static List Intersection(this Face2D face2D, Segment2D segment2D, d point2Ds.SortByDistance(segment2D[0]); List values = new List(); - for(int i =0; i < point2Ds.Count - 1; i++) + for (int i = 0; i < point2Ds.Count - 1; i++) { Segment2D segment2D_Temp = new Segment2D(point2Ds[i], point2Ds[i + 1]); Point2D point2D_Mid = segment2D_Temp.Mid(); bool value = false; - if(face2D.Inside(point2D_Mid, tolerance) || face2D.On(point2D_Mid, tolerance)) + if (face2D.Inside(point2D_Mid, tolerance) || face2D.On(point2D_Mid, tolerance)) { - if(segment2D_Temp is T) + if (segment2D_Temp is T) { result.Add((T)(object)segment2D_Temp); } @@ -527,7 +530,7 @@ public static List Intersection(this Face2D face2D, Segment2D segment2D, d values.Add(value); } - if(face2D.On(point2Ds[0], tolerance) && !values[0]) + if (face2D.On(point2Ds[0], tolerance) && !values[0]) { if (point2Ds[0] is T) { @@ -545,9 +548,9 @@ public static List Intersection(this Face2D face2D, Segment2D segment2D, d } } - for(int i = 1; i < point2Ds.Count - 1; i++) + for (int i = 1; i < point2Ds.Count - 1; i++) { - if(!values[i - 1] && !values[i]) + if (!values[i - 1] && !values[i]) { if (point2Ds[count] is T) { @@ -563,13 +566,13 @@ public static List Intersection(this Face2D face2D, Segment2D segment2D, d public static List Intersection(this IClosed2D closed2D_1, IClosed2D closed2D_2, double tolerance = Core.Tolerance.MicroDistance) where T : ISAMGeometry2D { - if(closed2D_1 == null || closed2D_2 == null) + if (closed2D_1 == null || closed2D_2 == null) { return null; } Face2D face2D_1 = null; - if(closed2D_1 is Face2D) + if (closed2D_1 is Face2D) { face2D_1 = (Face2D)closed2D_1; } @@ -591,4 +594,4 @@ public static List Intersection(this IClosed2D closed2D_1, IClosed2D close return Intersection(face2D_1, face2D_2, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/IntersectionDictionary.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/IntersectionDictionary.cs index 32448db49..73a6fe399 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/IntersectionDictionary.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/IntersectionDictionary.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -74,4 +77,4 @@ public static Dictionary IntersectionDictionary(this Point2D return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/IntersectionSegment2Ds.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/IntersectionSegment2Ds.cs index 702d1cbe4..f0a4edbc7 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/IntersectionSegment2Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/IntersectionSegment2Ds.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -101,4 +104,4 @@ public static List IntersectionSegment2Ds(this Polygon2D polygon2D, I return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Intersections.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Intersections.cs index 1301ad8c5..2830eed51 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Intersections.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Intersections.cs @@ -1,4 +1,7 @@ -using SAM.Math; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Math; using System.Collections.Generic; using System.Linq; @@ -57,7 +60,7 @@ public static List Intersections(this ISegmentable2D segmentable2D, IEn if (point2Ds_Temp == null || point2Ds_Temp.Count == 0) continue; - foreach(Point2D point2D_Temp in point2Ds_Temp) + foreach (Point2D point2D_Temp in point2Ds_Temp) { Point2D point2D = point2Ds.Find(x => x.AlmostEquals(point2D_Temp, tolerance)); if (point2D == null) @@ -70,22 +73,22 @@ public static List Intersections(this ISegmentable2D segmentable2D, IEn public static List Intersections(this ISegmentable2D segmentable2D, Line2D line2D, double tolerance = Core.Tolerance.Distance) { - if(line2D == null) + if (line2D == null) { return null; } List segment2Ds = segmentable2D?.GetSegments(); - if(segment2Ds == null) + if (segment2Ds == null) { return null; } List result = new List(); - foreach(Segment2D segment2D in segment2Ds) + foreach (Segment2D segment2D in segment2Ds) { Point2D point2D = line2D.Intersection(segment2D, tolerance); - if(point2D == null) + if (point2D == null) { continue; } @@ -158,4 +161,4 @@ public static List Intersections(this PolynomialEquation polynomialEqua return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/IsValid.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/IsValid.cs index f41cbca93..c29d265bb 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/IsValid.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/IsValid.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -42,7 +45,7 @@ public static bool IsValid(this Vector2D vector2D) public static bool IsValid(this IClosed2D closed2D) { - if(closed2D == null) + if (closed2D == null) { return false; } @@ -52,20 +55,20 @@ public static bool IsValid(this IClosed2D closed2D) public static bool IsValid(this Polygon2D polygon2D) { - if(polygon2D == null) + if (polygon2D == null) { return false; } List point2Ds = polygon2D.GetPoints(); - if(point2Ds == null || point2Ds.Count < 3) + if (point2Ds == null || point2Ds.Count < 3) { return false; } - foreach(Point2D point2D in point2Ds) + foreach (Point2D point2D in point2Ds) { - if(!IsValid( point2D)) + if (!IsValid(point2D)) { return false; } @@ -76,17 +79,17 @@ public static bool IsValid(this Polygon2D polygon2D) public static bool IsValid(this Rectangle2D rectangle2D) { - if(rectangle2D == null) + if (rectangle2D == null) { return false; } - if(!IsValid(rectangle2D.Origin)) + if (!IsValid(rectangle2D.Origin)) { return false; } - if(double.IsNaN(rectangle2D.Width)) + if (double.IsNaN(rectangle2D.Width)) { return false; } @@ -176,22 +179,22 @@ public static bool IsValid(this Ellipse2D ellipse2D) public static bool IsValid(this Face2D face2D) { - if(face2D == null) + if (face2D == null) { return false; } - if(!IsValid(face2D.ExternalEdge2D)) + if (!IsValid(face2D.ExternalEdge2D)) { return false; } List closed2Ds = face2D.InternalEdge2Ds; - if(closed2Ds != null && closed2Ds.Count != 0) + if (closed2Ds != null && closed2Ds.Count != 0) { - foreach(IClosed2D closed2D in closed2Ds) + foreach (IClosed2D closed2D in closed2Ds) { - if(!IsValid(closed2D)) + if (!IsValid(closed2D)) { return false; } @@ -203,17 +206,17 @@ public static bool IsValid(this Face2D face2D) public static bool IsValid(this Line2D line2D) { - if(line2D == null) + if (line2D == null) { return false; } - if(!IsValid( line2D.Origin)) + if (!IsValid(line2D.Origin)) { return false; } - if(!IsValid(line2D.Direction)) + if (!IsValid(line2D.Direction)) { return false; } @@ -223,7 +226,7 @@ public static bool IsValid(this Line2D line2D) public static bool IsValid(this ICurve2D curve2D) { - if(curve2D == null) + if (curve2D == null) { return false; } @@ -233,20 +236,20 @@ public static bool IsValid(this ICurve2D curve2D) public static bool IsValid(this Polycurve2D polycurve2D) { - if(polycurve2D == null) + if (polycurve2D == null) { return false; } List curve2Ds = polycurve2D.GetCurves(); - if(curve2Ds == null || curve2Ds.Count == 0) + if (curve2Ds == null || curve2Ds.Count == 0) { return false; } - foreach(ICurve2D curve2D in curve2Ds) + foreach (ICurve2D curve2D in curve2Ds) { - if(!IsValid(curve2D)) + if (!IsValid(curve2D)) { return false; } @@ -257,13 +260,13 @@ public static bool IsValid(this Polycurve2D polycurve2D) public static bool IsValid(this PolycurveLoop2D polycurveLoop2D) { - if(polycurveLoop2D == null) + if (polycurveLoop2D == null) { return false; } List curve2Ds = polycurveLoop2D.GetCurves(); - if(curve2Ds == null || curve2Ds.Count == 0) + if (curve2Ds == null || curve2Ds.Count == 0) { return false; } @@ -290,7 +293,7 @@ public static bool IsValid(this Polyline2D polyline2D) public static bool IsValid(this Triangle2D triangle2D) { List point2Ds = triangle2D?.GetPoints(); - if(point2Ds == null || point2Ds.Count != 3) + if (point2Ds == null || point2Ds.Count != 3) { return false; } @@ -298,4 +301,4 @@ public static bool IsValid(this Triangle2D triangle2D) return point2Ds.TrueForAll(x => IsValid(x)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Join.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Join.cs index 1b15d41d1..5695320fd 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Join.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Join.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -179,4 +182,4 @@ public static Segment2D Join(this Segment2D segment2D, Polygon2D polygon2D, doub return new Segment2D(point2Ds.First(), point2Ds.Last()); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/LongestPath.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/LongestPath.cs index ff9fd558c..17e5878ad 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/LongestPath.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/LongestPath.cs @@ -1,4 +1,7 @@ -using QuickGraph; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using QuickGraph; using QuickGraph.Algorithms.Observers; using QuickGraph.Algorithms.ShortestPath; using System.Collections.Generic; @@ -18,7 +21,7 @@ public static partial class Query /// List of Point2Ds representing the longest path public static List LongestPath(this IEnumerable segmentable2Ds, Point2D point2D_Start = null, double tolerance = Core.Tolerance.Distance) { - if(segmentable2Ds == null) + if (segmentable2Ds == null) { return null; } @@ -28,12 +31,12 @@ public static List LongestPath(this IEnumerable segment foreach (ISegmentable2D segmentable2D in segmentable2Ds) { List segment2Ds_Temp = segmentable2D?.GetSegments(); - if(segment2Ds_Temp == null || segment2Ds_Temp.Count == 0) + if (segment2Ds_Temp == null || segment2Ds_Temp.Count == 0) { continue; } - for(int i =0; i < segment2Ds_Temp.Count; i++) + for (int i = 0; i < segment2Ds_Temp.Count; i++) { //segment2Ds_Temp[i].Round(tolerance); segment2Ds.Add(segment2Ds_Temp[i]); @@ -132,7 +135,7 @@ public static List LongestPath(this IEnumerable segment if (point2D_Start == null) point2D_Start = tuples[0].Item2; - + Point2D point2D_End = tuples[0].Item3; if (point2D_Start == null || point2D_End == null) @@ -153,18 +156,18 @@ public static List LongestPath(this IEnumerable segment } List result = new List(); - if(edges.Count() == 0) + if (edges.Count() == 0) { return result; } - foreach(Edge edge_Temp in edges) + foreach (Edge edge_Temp in edges) { Point2D point2D = edge_Temp.Source; - foreach(Point2D point2D_Unique in point2Ds_Unique) + foreach (Point2D point2D_Unique in point2Ds_Unique) { - if(point2D_Unique.AlmostEquals(point2D)) + if (point2D_Unique.AlmostEquals(point2D)) { point2D = point2D_Unique; break; @@ -188,4 +191,4 @@ public static List LongestPath(this IEnumerable segment return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Max.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Max.cs index ae8e0b5dd..6322bd124 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Max.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Max.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -28,4 +31,4 @@ public static Point2D Max(this Point2D point2D_1, Point2D point2D_2) return new Point2D(System.Math.Max(point2D_1.X, point2D_2.X), System.Math.Max(point2D_1.Y, point2D_2.Y)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/MaxDistance.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/MaxDistance.cs index 27e20a07b..5cb68a5c4 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/MaxDistance.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/MaxDistance.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -32,4 +35,4 @@ public static double MaxDistance(this IEnumerable point2Ds, out Point2D return aDistance; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Mid.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Mid.cs index 4e7eb5742..388adf2f4 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Mid.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Mid.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Planar { public static partial class Query { @@ -10,4 +13,4 @@ public static Point2D Mid(this Point2D point2D_1, Point2D point2D_2) return new Point2D((point2D_1.X + point2D_2.X) / 2, (point2D_1.Y + point2D_2.Y) / 2); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/MidVector2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/MidVector2D.cs index 15ff1c7fb..fd2e82844 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/MidVector2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/MidVector2D.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Planar { public static partial class Query { @@ -32,4 +35,4 @@ public static Vector2D MidVector(this Vector2D vector2D_1, Vector2D vector2D_2) return (vector2D_1.Unit + vector2D_2.Unit).Unit; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Min.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Min.cs index 00ebf75ee..2e158b619 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Min.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Min.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -28,4 +31,4 @@ public static Point2D Min(this IEnumerable point2Ds) return new Point2D(aX, aY); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/MinDistance.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/MinDistance.cs index 55c7d4944..2f00d8e7e 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/MinDistance.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/MinDistance.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -30,4 +33,4 @@ public static double MinDistance(this IEnumerable point2Ds) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Move.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Move.cs index 45f2ca3fe..7e2b34dea 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Move.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Move.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -6,11 +9,11 @@ public static partial class Query { public static Point2D Move(this Point2D point2D, Vector2D vector2D) { - if(point2D == null || vector2D == null) + if (point2D == null || vector2D == null) { return null; } - + Point2D result = new Point2D(point2D); result.Move(vector2D); return result; @@ -18,7 +21,7 @@ public static Point2D Move(this Point2D point2D, Vector2D vector2D) public static Vector2D Move(this Vector2D baseVector2D, Vector2D vector2D) { - if(baseVector2D == null || vector2D == null) + if (baseVector2D == null || vector2D == null) { return null; } @@ -28,7 +31,7 @@ public static Vector2D Move(this Vector2D baseVector2D, Vector2D vector2D) public static Polygon2D Move(this Polygon2D polygon2D, Vector2D vector2D) { - if(vector2D == null || polygon2D == null) + if (vector2D == null || polygon2D == null) { return null; } @@ -163,7 +166,7 @@ public static Triangle2D Move(this Triangle2D triangle2D, Vector2D vector2D) return new Triangle2D(point2Ds[0].GetMoved(vector2D), point2Ds[1].GetMoved(vector2D), point2Ds[2].GetMoved(vector2D)); } - public static T Move(this T sAMGeometry2D, Vector2D vector2D) where T: ISAMGeometry2D + public static T Move(this T sAMGeometry2D, Vector2D vector2D) where T : ISAMGeometry2D { if (vector2D == null || sAMGeometry2D == null) { @@ -173,4 +176,4 @@ public static T Move(this T sAMGeometry2D, Vector2D vector2D) where T: ISAMGe return Query.Move(sAMGeometry2D as dynamic, vector2D); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/MovePoint2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/MovePoint2D.cs index 06e1406c6..61a385777 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/MovePoint2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/MovePoint2D.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -6,18 +9,18 @@ public static partial class Query { public static Polygon2D MovePoint2D(this Polygon2D polygon2D, int index, Point2D point2D) { - if(index < 0 || point2D == null) + if (index < 0 || point2D == null) { return null; } List point2Ds = polygon2D?.Points; - if(point2Ds == null || point2Ds.Count == 0) + if (point2Ds == null || point2Ds.Count == 0) { return null; } - if(index >= point2Ds.Count) + if (index >= point2Ds.Count) { return null; } @@ -29,7 +32,7 @@ public static Polygon2D MovePoint2D(this Polygon2D polygon2D, int index, Point2D public static Polygon2D MovePoint2D(this Polygon2D polygon2D, int index, Vector2D vector2D) { - if(index < 0 || vector2D == null) + if (index < 0 || vector2D == null) { return null; } @@ -68,14 +71,14 @@ public static Polygon2D MovePoint2D(this Polygon2D polygon2D, Point2D point2D_Ol for (int i = 0; i < point2Ds.Count; i++) { double distance_Temp = point2D_Old.Distance(point2Ds[i]); - if(distance_Temp < distance) + if (distance_Temp < distance) { distance = distance_Temp; index = i; } } - if(index == -1) + if (index == -1) { return null; } @@ -85,4 +88,4 @@ public static Polygon2D MovePoint2D(this Polygon2D polygon2D, Point2D point2D_Ol return new Polygon2D(point2Ds); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/MoveSegment2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/MoveSegment2D.cs index 0ab59ba16..715819b0e 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/MoveSegment2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/MoveSegment2D.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -7,7 +10,7 @@ public static partial class Query { public static Polygon2D MoveSegment2D(this Polygon2D polygon2D, int index, Vector2D vector2D, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { - if(index < 0 || vector2D == null) + if (index < 0 || vector2D == null) { return null; } @@ -41,7 +44,7 @@ public static Polygon2D MoveSegment2D(this Polygon2D polygon2D, int index, Vecto Segment2D segment2D_Previous = segment2Ds[index_Previous]; Segment2D segment2D_Next = segment2Ds[index_Next]; - if(segment2D_Next.Direction.SmallestAngle(segment2D_Previous.Direction) <= tolerance_Angle && segment2D.Direction.SmallestAngle(segment2D_Next.Direction) < tolerance_Angle) + if (segment2D_Next.Direction.SmallestAngle(segment2D_Previous.Direction) <= tolerance_Angle && segment2D.Direction.SmallestAngle(segment2D_Next.Direction) < tolerance_Angle) { segment2Ds[index] = segment2D; @@ -53,7 +56,7 @@ public static Polygon2D MoveSegment2D(this Polygon2D polygon2D, int index, Vecto Point2D point2D_Intersection = null; point2D_Intersection = segment2D.Intersection(segment2D_Previous, false, tolerance_Distance); - if(point2D_Intersection != null) + if (point2D_Intersection != null) { segment2D_Previous = new Segment2D(segment2D_Previous[0], point2D_Intersection); segment2Ds[index_Previous] = segment2D_Previous; @@ -65,7 +68,7 @@ public static Polygon2D MoveSegment2D(this Polygon2D polygon2D, int index, Vecto point2D_Intersection = segment2D.Intersection(segment2D_Next, false, tolerance_Distance); if (point2D_Intersection != null) { - segment2D_Next= new Segment2D(point2D_Intersection, segment2D_Next[1]); + segment2D_Next = new Segment2D(point2D_Intersection, segment2D_Next[1]); segment2Ds[index_Next] = segment2D_Next; segment2D = new Segment2D(segment2D[0], point2D_Intersection); @@ -73,26 +76,26 @@ public static Polygon2D MoveSegment2D(this Polygon2D polygon2D, int index, Vecto } } - List indexes = new List() { index_Previous, index, index_Next}; + List indexes = new List() { index_Previous, index, index_Next }; indexes.RemoveAll(x => x == -1); indexes.Sort((x, y) => y.CompareTo(x)); - foreach(int index_Temp in indexes) + foreach (int index_Temp in indexes) { - if(segment2Ds[index_Temp][0].Distance(segment2Ds[index_Temp][1]) < tolerance_Distance) + if (segment2Ds[index_Temp][0].Distance(segment2Ds[index_Temp][1]) < tolerance_Distance) { segment2Ds.RemoveAt(index_Temp); } } List point2Ds = new List(); - foreach(Segment2D segment2D_Temp in segment2Ds) + foreach (Segment2D segment2D_Temp in segment2Ds) { point2Ds.Add(segment2D_Temp[0]); } point2Ds.Add(segment2Ds.Last()[1]); - + return new Polygon2D(point2Ds); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/MoveToSegment2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/MoveToSegment2D.cs index cde766cf6..0c79b7717 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/MoveToSegment2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/MoveToSegment2D.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -46,4 +49,4 @@ public static Rectangle2D MoveToSegment2D(this Rectangle2D rectangle2D, Segment2 return Create.Rectangle2D(rectangleCornerPoints); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/ObtuseAngles.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/ObtuseAngles.cs index c86779f74..8dc86d90f 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/ObtuseAngles.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/ObtuseAngles.cs @@ -1,10 +1,13 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { public static partial class Query { - public static List ObtuseAngles(this T segmentable2D) where T: IClosed2D, ISegmentable2D + public static List ObtuseAngles(this T segmentable2D) where T : IClosed2D, ISegmentable2D { List determinats = Determinants(segmentable2D); if (determinats == null) @@ -24,7 +27,7 @@ public static List ObtuseAngles(this T segmentable2D) where T: IClosed2 Orientation orientation = Orientation(point2Ds, true); - switch(orientation) + switch (orientation) { case Geometry.Orientation.Clockwise: return determinats.ConvertAll(x => x < 0); diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Offset.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Offset.cs index c10620ae5..74ce47068 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Offset.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Offset.cs @@ -1,9 +1,11 @@ -//using ClipperLib; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +//using ClipperLib; using NetTopologySuite.Geometries; using NetTopologySuite.Noding.Snapround; using NetTopologySuite.Operation.Buffer; using NetTopologySuite.Operation.Polygonize; -using NetTopologySuite.Operation.Valid; using SAM.Core; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -29,7 +31,7 @@ public static List Offset(this Face2D face2D, double offset, bool includ if (includeExternalEdge) { - if(externalEdge is Polygon2D) + if (externalEdge is Polygon2D) { List polygon2Ds = Offset(Create.Polygon2D(externalEdge), offset, tolerance); if (polygon2Ds != null) @@ -42,12 +44,12 @@ public static List Offset(this Face2D face2D, double offset, bool includ if (includeInternalEdges) { - if(internalEdges != null) + if (internalEdges != null) { internalEdges_Offset = new List(); foreach (IClosed2D closed2D in internalEdges) { - if(closed2D is Polygon2D) + if (closed2D is Polygon2D) { List polygon2Ds = Offset(Create.Polygon2D(externalEdge), offset, tolerance); if (polygon2Ds != null) @@ -63,7 +65,7 @@ public static List Offset(this Face2D face2D, double offset, bool includ return Create.Face2Ds(edges); } - + public static List Offset(this Polygon2D polygon2D, double offset, double tolerance = Tolerance.MicroDistance) { if (polygon2D == null) @@ -96,13 +98,13 @@ public static Triangle2D Offset(Triangle2D triangle2D, double offset, double tol } List polygon2Ds = Offset(triangle2D, offset, JoinStyle.Mitre, EndCapStyle.Square, tolerance); - if(polygon2Ds == null || polygon2Ds.Count == 0) + if (polygon2Ds == null || polygon2Ds.Count == 0) { return null; } List point2Ds = polygon2Ds[0].GetPoints(); - if(point2Ds == null || point2Ds.Count < 3) + if (point2Ds == null || point2Ds.Count < 3) { return null; } @@ -124,7 +126,7 @@ public static Triangle2D Offset(Triangle2D triangle2D, double offset, double tol //if (point2DsList.Count > 1) //{ // point2DsList.Sort((x, y) => Area(y).CompareTo(Area(x))); - + //} //return new Triangle2D(point2DsList[0][0], point2DsList[0][1], point2DsList[0][2]); @@ -272,7 +274,7 @@ public static List Offset(this Polygon2D polygon2D, double offset, bo public static List Offset(this ISegmentable2D segmentable2D, double offset, JoinStyle joinStyle, EndCapStyle endCapStyle, double tolerance = Tolerance.MicroDistance) { LineString lineString = segmentable2D.ToNTS(tolerance); - if(lineString == null) + if (lineString == null) { return null; } @@ -288,12 +290,12 @@ public static List Offset(this ISegmentable2D segmentable2D, double o }; NetTopologySuite.Geometries.Geometry geometry = lineString; - if(lineString is LinearRing) + if (lineString is LinearRing) { geometry = new Polygon((LinearRing)lineString); } - if(geometry == null || !geometry.IsValid) + if (geometry == null || !geometry.IsValid) { return null; } @@ -312,7 +314,7 @@ public static List Offset(this ISegmentable2D segmentable2D, double o { try { - BufferCurveSetBuilder bufferCurveSetBuilder = new BufferCurveSetBuilder(geometry, offset, precisionModel, geometry.Factory.ElevationModel,bufferParameters); + BufferCurveSetBuilder bufferCurveSetBuilder = new BufferCurveSetBuilder(geometry, offset, precisionModel, geometry.Factory.ElevationModel, bufferParameters); IEnumerable segmentStrings = segmentStrings = bufferCurveSetBuilder.GetCurves(); lineStrings = new List(); @@ -339,12 +341,12 @@ public static List Offset(this ISegmentable2D segmentable2D, double o } } - if(lineStrings == null || lineStrings.Count == 0) + if (lineStrings == null || lineStrings.Count == 0) { return null; } - - if(lineString.IsClosed) + + if (lineString.IsClosed) { double offset_Abs = System.Math.Abs(offset) - (tolerance * 10); // given tolerance has to be greater than input tolerance so multiply by 10 @@ -361,15 +363,15 @@ public static List Offset(this ISegmentable2D segmentable2D, double o List result = new List(); List segment2Ds = lineStrings.ConvertAll(x => x.ToSAM())?.Segment2Ds(); - List polygons = segment2Ds.ToNTS_Polygons(tolerance); - if(polygons != null && polygons.Count > 0) + List polygons = segment2Ds.ToNTS_Polygons(tolerance); + if (polygons != null && polygons.Count > 0) { //Polygon2Ds by SAM -> Added 2022.09.07 foreach (Polygon polygon in polygons) { - List polygon2Ds_Temp = polygon?.ToSAM_Polygon2Ds(tolerance); - if(polygon2Ds_Temp == null || polygon2Ds_Temp.Count == 0) + List polygon2Ds_Temp = polygon?.ToSAM_Polygon2Ds(tolerance); + if (polygon2Ds_Temp == null || polygon2Ds_Temp.Count == 0) { continue; } @@ -380,7 +382,7 @@ public static List Offset(this ISegmentable2D segmentable2D, double o else { //Polygon2Ds by Polygonizer - + Polygonizer polygonizer = new Polygonizer(true); polygonizer.Add(lineStrings.ToArray()); @@ -563,13 +565,13 @@ private static List Offset_Inside(this Polygon2D polygon2D, List indexes = new List(); for (int k = 0; k < point2Ds_Closest.Count; k++) { - if(point2Ds_Closest[k].AlmostEquals(point2D_Project, tolerance)) + if (point2Ds_Closest[k].AlmostEquals(point2D_Project, tolerance)) { indexes.Add(k); } } - if(indexes.Count > 1) + if (indexes.Count > 1) { offset = indexes.ConvertAll(x => offsets[x]).Min(); if (distance >= offset - tolerance) @@ -651,4 +653,4 @@ private static List Offset_Outside(this Polygon2D polygon2D, List segmentable2Ds, Point2D p return false; } - + public static bool On(this Math.PolynomialEquation polynomialEquation, Point2D point2D, double tolerance = Core.Tolerance.Distance) { if (polynomialEquation == null || point2D == null) @@ -51,4 +54,4 @@ public static bool On(this Math.PolynomialEquation polynomialEquation, Point2D p return System.Math.Abs(y - point2D.Y) <= tolerance; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Orient.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Orient.cs index e58bbf11f..b329b9723 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Orient.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Orient.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -24,4 +27,4 @@ public static List Orient(IEnumerable point2Ds, Orientation or return aResult; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Orientation.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Orientation.cs index 36c41d266..161ae74f3 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Orientation.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Orientation.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -68,18 +71,18 @@ public static Orientation Orientation(this IEnumerable point2Ds, bool c public static Orientation Orientation(this IClosed2D closed2D) { - if(closed2D == null) + if (closed2D == null) { return Geometry.Orientation.Undefined; } - if(closed2D is Face2D) + if (closed2D is Face2D) { return Orientation(((Face2D)closed2D).ExternalEdge2D); } - + ISegmentable2D segmentable2D = closed2D as ISegmentable2D; - if(segmentable2D == null) + if (segmentable2D == null) { throw new System.NotImplementedException(); } @@ -87,4 +90,4 @@ public static Orientation Orientation(this IClosed2D closed2D) return Orientation(segmentable2D.GetPoints(), !(segmentable2D is Triangle2D || segmentable2D is Rectangle2D)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Orientations.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Orientations.cs index c74050c71..f4655d104 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Orientations.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Orientations.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -27,4 +30,4 @@ public static List Orientations(this IEnumerable point2Ds) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Parameter.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Parameter.cs index e4ce3304e..b5542365a 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Parameter.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Parameter.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -71,4 +74,4 @@ public static double Parameter(this ISegmentable2D segmentable2D, Point2D point2 return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Perimeter.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Perimeter.cs index da863c30b..9c634a547 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Perimeter.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Perimeter.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Planar { public static partial class Query { @@ -7,10 +10,10 @@ public static double Perimeter(this IClosed2D closed2D) if (closed2D == null) return double.NaN; - if(closed2D is ISegmentable2D) - return((ISegmentable2D)closed2D).GetLength(); + if (closed2D is ISegmentable2D) + return ((ISegmentable2D)closed2D).GetLength(); throw new System.NotImplementedException(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Point2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Point2D.cs index ec4255198..eacf8b427 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Point2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Point2D.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -20,4 +23,4 @@ public static Point2D Point2D(this ISegmentable2D segmentable2D, double paramete return segment2Ds.Last().End; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Polygons.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Polygons.cs index 0e7a64f4e..980745b87 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Polygons.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Polygons.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; using System.Collections.Generic; namespace SAM.Geometry.Planar @@ -15,19 +18,19 @@ public static List Polygons(this MultiPolygon multiPolygon) return null; List result = new List(); - foreach(NetTopologySuite.Geometries.Geometry geometry in geometries) + foreach (NetTopologySuite.Geometries.Geometry geometry in geometries) { - if(geometry is Polygon) + if (geometry is Polygon) { result.Add((Polygon)geometry); } - else if(geometry is MultiPolygon) + else if (geometry is MultiPolygon) { List polygons = Polygons((MultiPolygon)geometry); if (polygons != null && polygons.Count > 0) result.AddRange(polygons); } - else if(geometry is LinearRing) + else if (geometry is LinearRing) { result.Add(new Polygon((LinearRing)geometry)); } @@ -37,4 +40,4 @@ public static List Polygons(this MultiPolygon multiPolygon) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Rectangular.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Rectangular.cs index 4385c6039..8575b93c7 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Rectangular.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Rectangular.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Planar { public static partial class Query { @@ -35,7 +38,7 @@ public static bool Rectangular(this IClosed2D closed2D, out Rectangle2D rectangl if (closed2D is ISegmentable2D) { rectangle2D = Create.Rectangle2D(((ISegmentable2D)closed2D).GetPoints()); - if(rectangle2D == null || !rectangle2D.IsValid()) + if (rectangle2D == null || !rectangle2D.IsValid()) { rectangle2D = null; return false; @@ -51,4 +54,4 @@ public static bool Rectangular(this IClosed2D closed2D, out Rectangle2D rectangl throw new System.NotImplementedException(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Reduce.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Reduce.cs index 763729b7b..cc65649c3 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Reduce.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Reduce.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -11,7 +14,7 @@ public static Polyline2D Reduce(this Polyline2D polyline2D, double minDistance) return null; List point2Ds = Reduce(polyline2D.GetPoints(), minDistance); - if(point2Ds == null || point2Ds.Count == 0) + if (point2Ds == null || point2Ds.Count == 0) { return new Polyline2D(polyline2D); } @@ -25,7 +28,7 @@ public static Polygon2D Reduce(this Polygon2D polygon2D, double minDistance) return null; List point2Ds = polygon2D.GetPoints(); - if(point2Ds.Count <= 3) + if (point2Ds.Count <= 3) { return new Polygon2D(polygon2D); } @@ -41,7 +44,7 @@ public static Polygon2D Reduce(this Polygon2D polygon2D, double minDistance) public static Face2D Reduce(this Face2D face2D, double minDistance) { - if(face2D == null) + if (face2D == null) { return null; } @@ -49,7 +52,7 @@ public static Face2D Reduce(this Face2D face2D, double minDistance) IClosed2D externalEdge2D = Reduce(face2D.ExternalEdge2D, minDistance); List internalEdge2Ds = face2D.InternalEdge2Ds; - if(internalEdge2Ds != null && internalEdge2Ds.Count != 0) + if (internalEdge2Ds != null && internalEdge2Ds.Count != 0) { internalEdge2Ds = internalEdge2Ds.ConvertAll(x => Reduce(x, minDistance)); } @@ -59,17 +62,17 @@ public static Face2D Reduce(this Face2D face2D, double minDistance) public static IClosed2D Reduce(IClosed2D closed2D, double minDistance) { - if(closed2D == null) + if (closed2D == null) { return null; } - if(closed2D is Polygon2D) + if (closed2D is Polygon2D) { return Reduce((Polygon2D)closed2D, minDistance); } - - if(closed2D is Face2D) + + if (closed2D is Face2D) { return Reduce((Face2D)closed2D, minDistance); } @@ -113,4 +116,4 @@ private static List Reduce(this IEnumerable point2Ds, double m return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/RemoveAngle.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/RemoveAngle.cs index ebd349495..3b4b89efa 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/RemoveAngle.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/RemoveAngle.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -112,4 +115,4 @@ public static List RemoveAngle(Point2D point2D_Previous, Point2D point2 return new List() { point2D_Previous, point2D.GetMoved(vector2D_b), point2D.GetMoved(vector2D_c), point2D_Next }; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Rotate.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Rotate.cs index 5de97686e..2c0df36e5 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Rotate.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Rotate.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -13,7 +16,7 @@ public static partial class Query /// Point2D public static Point2D Rotate(this Point2D point2D, Point2D point2D_Center, double angle) { - if(point2D == null || point2D_Center == null || double.IsNaN(angle)) + if (point2D == null || point2D_Center == null || double.IsNaN(angle)) { return null; } @@ -32,7 +35,7 @@ public static Vector2D Rotate(this Vector2D vector2D, double angle) public static Rectangle2D Rotate(this Rectangle2D rectangle2D, Point2D point2D, double angle) { - if(rectangle2D == null || point2D == null || double.IsNaN(angle)) + if (rectangle2D == null || point2D == null || double.IsNaN(angle)) { return null; } @@ -53,7 +56,7 @@ public static Polygon2D Rotate(this Polygon2D polygon2D, Point2D point2D, double } List point2Ds = Rotate(polygon2D.Points, point2D, angle); - if(point2Ds == null || point2Ds.Count == 0) + if (point2Ds == null || point2Ds.Count == 0) { return null; } @@ -69,7 +72,7 @@ public static List Rotate(this IEnumerable point2Ds, Point2D p return null; } - List result = new List (point2Ds); + List result = new List(point2Ds); for (int i = 0; i < result.Count; i++) { result[i] = result[i].Rotate(point2D, angle); @@ -115,4 +118,4 @@ public static Segment2D Rotate(this Segment2D segment2D, Point2D point2D, double return new Segment2D(segment2D.Start.Rotate(point2D, angle), segment2D.End.Rotate(point2D, angle)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Scale.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Scale.cs index 8c3440150..e8c15ac83 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Scale.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Scale.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -8,7 +11,7 @@ public static ISAMGeometry2D Scale(this ISAMGeometry2D sAMGeometry2D, double fac { return Scale(sAMGeometry2D as dynamic, factor); } - + public static BoundingBox2D Scale(this BoundingBox2D boudingBox2D, double factor) { if (boudingBox2D == null) @@ -103,4 +106,4 @@ public static Polyline2D Scale(this Polyline2D polyline2D, Point2D point2D, doub } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Segment2Ds.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Segment2Ds.cs index 15aa1c787..04f0cd387 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Segment2Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Segment2Ds.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -53,4 +56,4 @@ public static List Segment2Ds(this IEnumerable segmen return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/SelfIntersect.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/SelfIntersect.cs index c12ee3953..439c93e35 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/SelfIntersect.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/SelfIntersect.cs @@ -1,4 +1,7 @@ -using System.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Linq; namespace SAM.Geometry.Planar { @@ -9,4 +12,4 @@ public static bool SelfIntersect(this ISegmentable2D segmentable2D, double toler return segmentable2D.SelfIntersectionPoint2Ds(1, tolerance)?.FirstOrDefault() != null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/SelfIntersectionFace2Ds.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/SelfIntersectionFace2Ds.cs index d9d8318e4..a66c881ad 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/SelfIntersectionFace2Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/SelfIntersectionFace2Ds.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Geometry.Planar @@ -8,27 +11,27 @@ public static partial class Query public static List SelfIntersectionFace2Ds(this Face2D face2D, double maxLength, double tolerance = Core.Tolerance.MicroDistance) { List edge2Ds = face2D?.Edge2Ds; - if(edge2Ds == null || edge2Ds.Count == 0) + if (edge2Ds == null || edge2Ds.Count == 0) { return null; } List segment2Ds = new List(); - foreach(IClosed2D edge2D in edge2Ds) + foreach (IClosed2D edge2D in edge2Ds) { - if(edge2D == null) + if (edge2D == null) { continue; } ISegmentable2D segmentable2D = edge2D as ISegmentable2D; - if(segmentable2D == null) + if (segmentable2D == null) { throw new NotImplementedException(); } List segment2Ds_Temp = segmentable2D.GetSegments(); - if(segment2Ds_Temp == null) + if (segment2Ds_Temp == null) { continue; } @@ -46,21 +49,21 @@ public static List SelfIntersectionFace2Ds(this Face2D face2D, double ma segment2Ds = segment2Ds.Split(tolerance); segment2Ds = segment2Ds.Snap(true, tolerance); - for(int i = segment2Ds.Count - 1; i >= 0; i--) + for (int i = segment2Ds.Count - 1; i >= 0; i--) { Point2D point2D = segment2Ds[i]?.Mid(); - if(point2D == null) + if (point2D == null) { segment2Ds.RemoveAt(i); continue; } - if(face2D.On(point2D, tolerance)) + if (face2D.On(point2D, tolerance)) { continue; } - if(face2D.Inside(point2D, tolerance)) + if (face2D.Inside(point2D, tolerance)) { continue; } @@ -69,13 +72,13 @@ public static List SelfIntersectionFace2Ds(this Face2D face2D, double ma } List polygon2Ds = Create.Polygon2Ds(segment2Ds, tolerance); - if(polygon2Ds == null) + if (polygon2Ds == null) { return null; } List internalEdge2Ds = face2D.InternalEdge2Ds; - if(internalEdge2Ds == null || internalEdge2Ds.Count == 0 || polygon2Ds.Count < 2) + if (internalEdge2Ds == null || internalEdge2Ds.Count == 0 || polygon2Ds.Count < 2) { return polygon2Ds.ConvertAll(x => new Face2D(x)); } @@ -87,13 +90,13 @@ public static List SelfIntersectionFace2Ds(this Face2D face2D, double ma List> tuples_External = polygon2Ds.ConvertAll(x => new Tuple(x, x.InternalPoint2D(tolerance))); List> tuples_Internal = tuples_External.FindAll(x => !face2D.Inside(x.Item2, tolerance)); tuples_External.RemoveAll(x => tuples_Internal.Contains(x)); - while(tuples_External.Count > 0) + while (tuples_External.Count > 0) { Tuple tuple_External = tuples_External[0]; tuples_External.RemoveAt(0); Face2D face2D_Temp = Face2D.Create(tuple_External.Item1, tuples_Internal.FindAll(x => tuple_External.Item1.Inside(x.Item2, tolerance)).ConvertAll(x => x.Item1), EdgeOrientationMethod.Opposite, tolerance); - if(face2D_Temp == null) + if (face2D_Temp == null) { continue; } @@ -104,4 +107,4 @@ public static List SelfIntersectionFace2Ds(this Face2D face2D, double ma return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/SelfIntersectionPoint3D.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/SelfIntersectionPoint3D.cs index 7d6f8fe9b..1567a4c27 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/SelfIntersectionPoint3D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/SelfIntersectionPoint3D.cs @@ -1,4 +1,7 @@ -using System.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Linq; namespace SAM.Geometry.Planar { @@ -12,4 +15,4 @@ public static Point2D SelfIntersectionPoint2D(this ISegmentable2D segmentable2D, return SelfIntersectionPoint2Ds(segmentable2D, 1, tolerance)?.FirstOrDefault(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/SelfIntersectionPoint3Ds.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/SelfIntersectionPoint3Ds.cs index dd29abb79..ac017e404 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/SelfIntersectionPoint3Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/SelfIntersectionPoint3Ds.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -48,4 +51,4 @@ public static List SelfIntersectionPoint2Ds(this ISegmentable2D segment return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/SelfIntersectionPolygon2Ds.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/SelfIntersectionPolygon2Ds.cs index 4810970bc..7eb7cfa6c 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/SelfIntersectionPolygon2Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/SelfIntersectionPolygon2Ds.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -15,7 +18,7 @@ public static List SelfIntersectionPolygon2Ds(this Polygon2D polygon2 segment2Ds = segment2Ds.Split(tolerance); List result = Create.Polygon2Ds(segment2Ds, tolerance); - if(result == null || result.Count == 0) + if (result == null || result.Count == 0) { return result; } @@ -25,4 +28,4 @@ public static List SelfIntersectionPolygon2Ds(this Polygon2D polygon2 return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/SelfIntersectionSegment2Ds.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/SelfIntersectionSegment2Ds.cs index 46ac8e1a1..6e0719900 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/SelfIntersectionSegment2Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/SelfIntersectionSegment2Ds.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -112,4 +115,4 @@ public static List SelfIntersectionSegment2Ds(this IEnumerable ShortestPath(this IEnumerable segmen } Point2D point2D_Start_Temp = point2D_Start; - if(point2D_Start_Temp != null) + if (point2D_Start_Temp != null) { List segment2Ds_Connected = segment2Ds.Connect(point2D_Start_Temp, PointConnectMethod.Ends, tolerance); - if(segment2Ds_Connected != null) + if (segment2Ds_Connected != null) { Point2D point2D = segment2Ds_Connected.Find(x => x[0].AlmostEquals(point2D_Start_Temp, tolerance))?[0]; - if(point2D == null) + if (point2D == null) point2D = segment2Ds_Connected.Find(x => x[1].AlmostEquals(point2D_Start_Temp, tolerance))?[1]; if (point2D == null) @@ -126,4 +129,4 @@ public static List ShortestPath(this IEnumerable segmen return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Similar.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Similar.cs index 0b968da42..59cacaffc 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Similar.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Similar.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -56,7 +59,7 @@ public static bool Similar(Face2D face2D_1, Face2D face2D_2, double tolerance = List internalEdge2Ds_1 = face2D_1.InternalEdge2Ds; List internalEdge2Ds_2 = face2D_1.InternalEdge2Ds; - if(internalEdge2Ds_1 == internalEdge2Ds_2) + if (internalEdge2Ds_1 == internalEdge2Ds_2) { return true; } @@ -66,15 +69,15 @@ public static bool Similar(Face2D face2D_1, Face2D face2D_2, double tolerance = return false; } - if(internalEdge2Ds_1.Count != internalEdge2Ds_2.Count) + if (internalEdge2Ds_1.Count != internalEdge2Ds_2.Count) { return false; } - foreach(IClosed2D internalEdge2D_1 in internalEdge2Ds_1) + foreach (IClosed2D internalEdge2D_1 in internalEdge2Ds_1) { int index = internalEdge2Ds_2.FindIndex(x => Similar(internalEdge2D_1, x, tolerance)); - if(index == -1) + if (index == -1) { return false; } @@ -93,9 +96,9 @@ public static bool Similar(this IClosed2D closed2D_1, IClosed2D closed2D_2, doub if (closed2D_1 == null || closed2D_2 == null) return false; - if(closed2D_1 is Face2D || closed2D_2 is Face2D) + if (closed2D_1 is Face2D || closed2D_2 is Face2D) { - if(closed2D_1 is Face2D && closed2D_2 is Face2D) + if (closed2D_1 is Face2D && closed2D_2 is Face2D) { return Similar((Face2D)closed2D_1, (Face2D)closed2D_2, tolerance); } @@ -104,7 +107,7 @@ public static bool Similar(this IClosed2D closed2D_1, IClosed2D closed2D_2, doub } ISegmentable2D segmentable2D_1 = closed2D_1 as ISegmentable2D; - if(segmentable2D_1 == null) + if (segmentable2D_1 == null) { throw new System.NotImplementedException(); } @@ -129,4 +132,4 @@ public static bool Similar(this IClosed2D closed2D_1, IClosed2D closed2D_2, doub return System.Math.Abs(closed2D_1.GetArea() - closed2D_2.GetArea()) <= tolerance; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Simplify.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Simplify.cs index b5cf2918b..4c5d9ddb3 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Simplify.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Simplify.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -35,4 +38,4 @@ public static Polygon2D Simplify(this Circle2D circle2D, int density) return new Polygon2D(point2Ds); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/SimplifyByAngle.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/SimplifyByAngle.cs index 6ca3692d7..cfbf53857 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/SimplifyByAngle.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/SimplifyByAngle.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -73,17 +76,17 @@ public static Face2D SimplifyByAngle(this Face2D face2D, double tolerane_Angle = } IClosed2D externalEdge = face2D.ExternalEdge2D; - if(externalEdge is Polygon2D) + if (externalEdge is Polygon2D) { externalEdge = SimplifyByAngle((Polygon2D)externalEdge, tolerane_Angle); } List internalEdge2Ds = face2D.InternalEdge2Ds; - if (internalEdge2Ds != null && internalEdge2Ds.Count!= 0) + if (internalEdge2Ds != null && internalEdge2Ds.Count != 0) { - for(int i=0; i < internalEdge2Ds.Count; i++) + for (int i = 0; i < internalEdge2Ds.Count; i++) { - if(internalEdge2Ds[i] is Polygon2D) + if (internalEdge2Ds[i] is Polygon2D) { internalEdge2Ds[i] = SimplifyByAngle((Polygon2D)internalEdge2Ds[i], tolerane_Angle); } @@ -93,4 +96,4 @@ public static Face2D SimplifyByAngle(this Face2D face2D, double tolerane_Angle = return Face2D.Create(externalEdge, internalEdge2Ds, EdgeOrientationMethod.Undefined, tolerance_Distance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/SimplifyByDouglasPeucker.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/SimplifyByDouglasPeucker.cs index 0e781a97d..5b6a98a06 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/SimplifyByDouglasPeucker.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/SimplifyByDouglasPeucker.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; using NetTopologySuite.Simplify; using SAM.Core; @@ -18,4 +21,4 @@ public static Polygon SimplifyByDouglasPeucker(this Polygon polygon, double tole return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/SimplifyByLength.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/SimplifyByLength.cs index a94250d18..29765f142 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/SimplifyByLength.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/SimplifyByLength.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -200,4 +203,4 @@ private static void GetNext(List> point2Ds, int index, out int ind } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/SimplifyBySnapper.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/SimplifyBySnapper.cs index 35a76ee35..43ff52f07 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/SimplifyBySnapper.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/SimplifyBySnapper.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; using SAM.Core; @@ -41,4 +44,4 @@ public static Face2D SimplifyBySnapper(this Face2D face2D, double tolerance = To return polygon?.ToSAM(tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/SimplifyByTopologyPreservingSimplifier.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/SimplifyByTopologyPreservingSimplifier.cs index 1241f97a5..c207df4f7 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/SimplifyByTopologyPreservingSimplifier.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/SimplifyByTopologyPreservingSimplifier.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; using NetTopologySuite.Simplify; using SAM.Core; @@ -46,4 +49,4 @@ public static Face2D SimplifyByTopologyPreservingSimplifier(this Face2D face2D, return polygon.ToSAM(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/SmallestAngle.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/SmallestAngle.cs index 895d59ec6..3be6a36dc 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/SmallestAngle.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/SmallestAngle.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Planar { public static partial class Query { @@ -10,4 +13,4 @@ public static double SmallestAngle(this Point2D point2D_Previous, Point2D point2 return (new Vector2D(point2D, point2D_Previous).SmallestAngle(new Vector2D(point2D, point2D_Next))); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/SmallestAngleVector.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/SmallestAngleVector.cs index 2abd7dc64..69e97afea 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/SmallestAngleVector.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/SmallestAngleVector.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -24,4 +27,4 @@ public static Vector2D SmallestAngleVector(this IEnumerable vector2Ds, return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Snap.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Snap.cs index b6836487e..03e86d08f 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Snap.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Snap.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; using NetTopologySuite.Operation.Overlay.Snap; using System.Collections.Generic; using System.Linq; @@ -9,7 +12,7 @@ public static partial class Query { public static Point2D Snap(this IEnumerable segmentable2Ds, Point2D point2D, double snapDistance = double.MaxValue) { - if(segmentable2Ds == null || point2D == null) + if (segmentable2Ds == null || point2D == null) { return null; } @@ -20,7 +23,7 @@ public static Point2D Snap(this IEnumerable segmentable2Ds, Poin { Point2D point2D_Closets_Temp = segmentable2D.Closest(point2D); double distance_Temp = point2D.Distance(point2D_Closets_Temp); - if(distance_Temp < snapDistance && distance > distance_Temp) + if (distance_Temp < snapDistance && distance > distance_Temp) { point2D_Closets = point2D_Closets_Temp; } @@ -41,7 +44,7 @@ public static Point2D Snap(this ISegmentable2D segmentable2D, Point2D point2D, d return point2D.Distance(result) < snapDistance ? result : new Point2D(point2D); } - + public static List Snap(this Polygon2D polygon2D_1, Polygon2D polygon2D_2, double snapDistance, double tolerance = Core.Tolerance.Distance) { LinearRing linearRing_1 = (polygon2D_1 as IClosed2D)?.ToNTS(tolerance); @@ -67,7 +70,7 @@ public static List Snap(this Polygon polygon_1, Polygon polygon_2, doub return geometries.ToList().ConvertAll(x => (x as Polygon)); } - + public static List Snap(this Face2D face2D_1, Face2D face2D_2, double snapDistance, double tolerance = Core.Tolerance.Distance) { Polygon polygon_1 = Convert.ToNTS(face2D_1 as Face, tolerance); @@ -101,7 +104,7 @@ public static List Snap(this Face2D face2D_1, Segment2D segment2 return geometries.ToList().ConvertAll(x => x.ToSAM(tolerance)); } - + public static Polygon2D Snap(this Polygon2D polygon2D, IEnumerable segmentable2Ds, double tolerance = Core.Tolerance.Distance) { if (polygon2D == null || segmentable2Ds == null) @@ -191,10 +194,10 @@ public static Face2D Snap(this Face2D face2D, IEnumerable point2Ds, dou externalEdge = new Polygon2D(point2Ds_Edge); List internalEdges = face2D.InternalEdge2Ds; - if(internalEdges != null) + if (internalEdges != null) { - - for(int i =0; i < internalEdges.Count; i++) + + for (int i = 0; i < internalEdges.Count; i++) { if (externalEdge == null || !(externalEdge is ISegmentable2D)) continue; @@ -252,9 +255,9 @@ public static List Snap(this IEnumerable segment2Ds, bool return null; List result = new List(); - foreach(Segment2D segment2D in segment2Ds) + foreach (Segment2D segment2D in segment2Ds) { - if(segment2D == null) + if (segment2D == null) { result.Add(null); continue; @@ -328,7 +331,7 @@ public static List Snap(this IEnumerable segment2Ds, bool result.RemoveAll(x => x.GetLength() <= tolerance); return result; } - + ///

    /// Snaps face2D to given face2Ds /// @@ -339,7 +342,7 @@ public static List Snap(this IEnumerable segment2Ds, bool /// Snapped Face2D public static Face2D Snap(this Face2D face2D, IEnumerable face2Ds, double snapDistance = Core.Tolerance.MacroDistance, double tolerance = Core.Tolerance.Distance) { - if(face2D == null || face2Ds == null) + if (face2D == null || face2Ds == null) { return null; } @@ -357,7 +360,7 @@ public static Face2D Snap(this Face2D face2D, IEnumerable face2Ds, doubl List> point2Ds_InternalEdge2Ds = internalEdge2Ds?.ConvertAll(x => x.GetPoints()); bool snapped = false; - foreach(Face2D face2D_Temp in face2Ds) + foreach (Face2D face2D_Temp in face2Ds) { BoundingBox2D boundingBox2D_Temp = face2D_Temp?.GetBoundingBox(); if (boundingBox2D_Temp == null || !boundingBox2D.InRange(boundingBox2D_Temp, snapDistance)) @@ -446,4 +449,4 @@ public static Face2D Snap(this Face2D face2D, IEnumerable face2Ds, doubl return Face2D.Create(polygon2D_ExternalEdge2D, polygon2Ds_InternalEdge2Ds); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Split.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Split.cs index db86735fa..582f5806b 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Split.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Split.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; using System; using System.Collections.Generic; using System.Linq; @@ -22,7 +25,7 @@ public static List Split(this IEnumerable segment2Ds, doub List point2Ds = new List(); foreach (Segment2D segment2D in segment2Ds) { - if(segment2D == null || segment2D.GetLength() < tolerance) + if (segment2D == null || segment2D.GetLength() < tolerance) { continue; } @@ -39,7 +42,7 @@ public static List Split(this IEnumerable segment2Ds, doub { BoundingBox2D boundingBox2D_1 = tuples[i].Item1; Segment2D segment2D_1 = tuples[i].Item2; - + for (int j = i + 1; j < count; j++) { BoundingBox2D boundingBox2D_2 = tuples[j].Item1; @@ -84,7 +87,7 @@ public static List Split(this IEnumerable segment2Ds, doub point2Ds_Intersection.Add(point2D_Intersection); } - if(point2Ds_Intersection == null || point2Ds_Intersection.Count == 0) + if (point2Ds_Intersection == null || point2Ds_Intersection.Count == 0) { continue; } @@ -92,7 +95,7 @@ public static List Split(this IEnumerable segment2Ds, doub foreach (Point2D point2D_Intersection in point2Ds_Intersection) { Point2D point2D_Intersection_Temp = point2Ds.Find(x => point2D_Intersection.AlmostEquals(x, tolerance)); - if(point2D_Intersection_Temp == null) + if (point2D_Intersection_Temp == null) { point2D_Intersection_Temp = point2D_Intersection; Modify.Add(point2Ds, point2D_Intersection_Temp, tolerance); @@ -210,7 +213,7 @@ public static List Split(this ISegmentable2D segmentable2D, IEnumerab return result; } - + /// /// Method splits face2Ds by intersection. Does not fully work if any of face2Ds are similar or overlaping /// @@ -241,27 +244,27 @@ public static List Split(this IEnumerable face2Ds, double tolera public static List Split(this Face2D face2D, IEnumerable segmentable2Ds, double tolerance_Snap = Core.Tolerance.MacroDistance, double tolerance = Core.Tolerance.Distance) { - if(face2D == null || segmentable2Ds == null) + if (face2D == null || segmentable2Ds == null) { return null; } BoundingBox2D boundingBox2D = face2D.GetBoundingBox(); - if(boundingBox2D == null) + if (boundingBox2D == null) { return null; } List segmentable2Ds_All = new List(); - foreach(ISegmentable2D segmentable2D in segmentable2Ds) + foreach (ISegmentable2D segmentable2D in segmentable2Ds) { BoundingBox2D boundingBox2D_Segmentable2D = segmentable2D?.GetBoundingBox(); - if(boundingBox2D_Segmentable2D == null) + if (boundingBox2D_Segmentable2D == null) { continue; } - if(!boundingBox2D.InRange(boundingBox2D_Segmentable2D, tolerance)) + if (!boundingBox2D.InRange(boundingBox2D_Segmentable2D, tolerance)) { continue; } @@ -269,7 +272,7 @@ public static List Split(this Face2D face2D, IEnumerable segmentable2Ds_All.Add(segmentable2D); } - if(segmentable2Ds_All == null || segmentable2Ds_All.Count == 0) + if (segmentable2Ds_All == null || segmentable2Ds_All.Count == 0) { return null; } @@ -277,7 +280,7 @@ public static List Split(this Face2D face2D, IEnumerable IClosed2D externalEdge = face2D.ExternalEdge2D; ISegmentable2D segmentable2D_ExternalEdge = externalEdge as ISegmentable2D; - if(segmentable2D_ExternalEdge == null) + if (segmentable2D_ExternalEdge == null) { return null; } @@ -285,12 +288,12 @@ public static List Split(this Face2D face2D, IEnumerable segmentable2Ds_All.Add(segmentable2D_ExternalEdge); List internalEdges = face2D.InternalEdge2Ds; - if(internalEdges != null && internalEdges.Count != 0) + if (internalEdges != null && internalEdges.Count != 0) { - foreach(IClosed2D internalEdge in internalEdges) + foreach (IClosed2D internalEdge in internalEdges) { ISegmentable2D segmentable2D_InternalEdge = internalEdge as ISegmentable2D; - if(segmentable2D_InternalEdge == null) + if (segmentable2D_InternalEdge == null) { continue; } @@ -303,7 +306,7 @@ public static List Split(this Face2D face2D, IEnumerable segment2Ds = segment2Ds.Snap(true, tolerance_Snap); List polygon2Ds = Create.Polygon2Ds(segment2Ds, tolerance); - if(polygon2Ds == null || polygon2Ds.Count == 0) + if (polygon2Ds == null || polygon2Ds.Count == 0) { return null; } @@ -314,13 +317,13 @@ public static List Split(this Face2D face2D, IEnumerable List result = new List(); tuples.Sort((x, y) => y.Item1.GetArea().CompareTo(x.Item1.GetArea())); - while(tuples.Count > 0) + while (tuples.Count > 0) { Polygon2D polygon2D_External = tuples[0].Item1; tuples.RemoveAt(0); List polygon2Ds_Internal = tuples.FindAll(x => polygon2D_External.Inside(x.Item2, tolerance)).ConvertAll(x => x.Item1); - if(polygon2Ds_Internal.Count != 0) + if (polygon2Ds_Internal.Count != 0) { tuples.RemoveAll(x => polygon2Ds_Internal.Contains(x.Item1)); } @@ -434,7 +437,7 @@ public static List Split(this Polygon2D polygon2D, int count, Alignme return null; Vector2D direction = Direction(alignment); - if(direction == null) + if (direction == null) return null; double angle_Height = System.Math.Min(rectangle2D.HeightDirection.Angle(direction), rectangle2D.HeightDirection.Angle(direction.GetNegated())); @@ -506,7 +509,7 @@ public static List Split(this Polygon2D polygon2D, int count, Alignme return Create.Polygon2Ds(segment2Ds_Inside, tolerance); } - + public static List> Split(this Face2D face2D, IEnumerable> tuples, double tolerance = Core.Tolerance.Distance) { if (face2D == null || tuples == null || tuples.Count() == 0) @@ -520,7 +523,7 @@ public static List> Split(this Face2D face2D, IEnumerable tuple in tuples) { List face2Ds_Intersection = new List(); - foreach(Face2D face2D_Temp in face2Ds_Temp) + foreach (Face2D face2D_Temp in face2Ds_Temp) { List face2Ds_Intersection_Temp = face2D_Temp.Intersection(tuple.Item1); face2Ds_Intersection_Temp?.RemoveAll(x => x == null || x.GetArea() <= tolerance); @@ -555,7 +558,7 @@ public static List> Split(this Face2D face2D, IEnumerable SplitByInternalEdges(this Face2D face2D, double tolerance = Core.Tolerance.Distance) { - if(face2D == null) + if (face2D == null) { return null; } @@ -40,17 +43,17 @@ public static List SplitByInternalEdges(this Face2D face2D, double toler } List point2Ds_InternalEdge = internalEdge.GetPoints(); - if(point2Ds_InternalEdge == null || point2Ds_InternalEdge.Count == 0) + if (point2Ds_InternalEdge == null || point2Ds_InternalEdge.Count == 0) { continue; } segmentable2Ds.Add(internalEdge); - foreach(Point2D point2D_InternalEdge in point2Ds_InternalEdge) + foreach (Point2D point2D_InternalEdge in point2Ds_InternalEdge) { Point2D point2D_Closest = Closest(externalEdge, point2Ds_InternalEdge); - if(point2D_Closest == null) + if (point2D_Closest == null) { continue; } @@ -71,11 +74,11 @@ public static List SplitByInternalEdges(this Face2D face2D, double toler { continue; } - + tuples.Sort((x, y) => x.Item1.Distance(x.Item2).CompareTo(y.Item1.Distance(y.Item2))); List segment2Ds_Tuples = new List(); - foreach(Tuple tuple in tuples) + foreach (Tuple tuple in tuples) { if (tuple.Item1.Distance(tuple.Item2) <= tolerance) { @@ -88,7 +91,7 @@ public static List SplitByInternalEdges(this Face2D face2D, double toler Segment2D segment2D_1 = segment2Ds_Tuples[0]; Segment2D segment2D_2 = segment2Ds_Tuples.Find(x => x.Distance(segment2D_1) > segment2D_1.GetLength()); - if(segment2D_2 == null) + if (segment2D_2 == null) { segment2D_2 = segment2Ds_Tuples.Find(x => x.Distance(segment2D_1) >= tolerance); } @@ -114,4 +117,4 @@ public static List SplitByInternalEdges(this Face2D face2D, double toler return polygon2Ds.ConvertAll(x => new Face2D(x)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Straight.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Straight.cs index f3abaac17..aff7af86c 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Straight.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Straight.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -13,7 +16,7 @@ public static partial class Query public static Polygon2D Straight(this Polygon2D polygon2D, double tolerance = Core.Tolerance.Distance) { List segment2Ds = polygon2D?.GetSegments(); - if(segment2Ds == null || segment2Ds.Count == 0) + if (segment2Ds == null || segment2Ds.Count == 0) { return null; } @@ -36,7 +39,7 @@ public static Polygon2D Straight(this Polygon2D polygon2D, double tolerance = Co continue; BoundingBox2D boundingBox2D = segment2D.GetBoundingBox(); - if (boundingBox2D == null|| boundingBox2D.Width <= tolerance || boundingBox2D.Height <= tolerance) + if (boundingBox2D == null || boundingBox2D.Width <= tolerance || boundingBox2D.Height <= tolerance) continue; polygon2Ds.Add(boundingBox2D); @@ -55,4 +58,4 @@ public static Polygon2D Straight(this Polygon2D polygon2D, double tolerance = Co return polygon2Ds[0]; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/ThinnessRatio.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/ThinnessRatio.cs index 1e295ac98..8b6f1427f 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/ThinnessRatio.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/ThinnessRatio.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Planar { public static partial class Query { @@ -43,4 +46,4 @@ public static double ThinnessRatio(this IClosed2D closed2D) throw new System.NotImplementedException(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Trace.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Trace.cs index 6d5cbacf6..5669200e2 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Trace.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Trace.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -20,4 +23,4 @@ public static List Trace(this Point2D point2D, Vector2D vector2D, ISeg return TraceData(point2D, vector2D, new ISegmentable2D[] { segmentable2D }, bounces)?.ConvertAll(x => x.Item3); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/TraceData.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/TraceData.cs index 014cedc59..f30297716 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/TraceData.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/TraceData.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -80,4 +83,4 @@ public static List> TraceData(this Point2D p return TraceData(point2D, vector2D, new ISegmentable2D[] { segmentable2D }, bounces); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/TraceDataFirst.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/TraceDataFirst.cs index 68ac9f5fc..e913695fc 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/TraceDataFirst.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/TraceDataFirst.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -30,4 +33,4 @@ public static Tuple TraceDataFirst(this Point2D po return tuples.First(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/TraceFirst.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/TraceFirst.cs index 9f8359bd4..0bd7e63a0 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/TraceFirst.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/TraceFirst.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -20,4 +23,4 @@ public static Vector2D TraceFirst(this Point2D point2D, Vector2D vector2D, ISegm return TraceFirst(point2D, vector2D, new ISegmentable2D[] { segmentable2D }); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Transform.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Transform.cs index 65a22026e..41b5d4058 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Transform.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Transform.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using SAM.Math; using System.Collections.Generic; @@ -8,20 +11,20 @@ public static partial class Query { public static Point2D Transform(this Point2D point2D, ITransform2D transform2D) { - if(point2D == null || transform2D == null) + if (point2D == null || transform2D == null) { return null; } - - if(transform2D is Transform2D) + + if (transform2D is Transform2D) { return Transform(point2D, (Transform2D)transform2D); } - if(transform2D is TransformGroup2D) + if (transform2D is TransformGroup2D) { Point2D result = point2D; - foreach(ITransform2D transform2D_Temp in (TransformGroup2D)transform2D) + foreach (ITransform2D transform2D_Temp in (TransformGroup2D)transform2D) { result = Transform(result, transform2D_Temp); } @@ -55,13 +58,13 @@ public static Vector2D Transform(this Vector2D vector2D, ITransform2D transform2 public static List Transform(this IEnumerable point2Ds, ITransform2D transform2D) { - if(point2Ds == null || transform2D == null) + if (point2Ds == null || transform2D == null) { return null; } List result = new List(); - foreach(Point2D point2D in point2Ds) + foreach (Point2D point2D in point2Ds) { result.Add(Transform(point2D, transform2D)); } @@ -71,13 +74,13 @@ public static List Transform(this IEnumerable point2Ds, ITrans public static Triangle2D Transform(this Triangle2D triangle2D, ITransform2D transform2D) { - if(triangle2D == null || transform2D == null) + if (triangle2D == null || transform2D == null) { return null; } - + List point2Ds = Transform(triangle2D.GetPoints(), transform2D); - if(point2Ds == null || point2Ds.Count < 3) + if (point2Ds == null || point2Ds.Count < 3) { return null; } @@ -127,7 +130,7 @@ public static Polyline2D Transform(this Polyline2D polyline2D, ITransform2D tran } List point2Ds = Transform(polyline2D.GetPoints(), transform2D); - if (point2Ds == null || point2Ds.Count < 2) + if (point2Ds == null || point2Ds.Count < 2) { return null; } @@ -137,7 +140,7 @@ public static Polyline2D Transform(this Polyline2D polyline2D, ITransform2D tran public static BoundingBox2D Transform(this BoundingBox2D boundingBox2D, ITransform2D transform2D) { - if(boundingBox2D == null || transform2D == null) + if (boundingBox2D == null || transform2D == null) { return null; } @@ -445,4 +448,4 @@ public static CoordinateSystem2D Transform(this CoordinateSystem2D coordinateSys return new CoordinateSystem2D(origin, axisX, axisY); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Triangulate.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Triangulate.cs index b00458846..4b6424ed7 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Triangulate.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Triangulate.cs @@ -1,9 +1,12 @@ -using System.Collections.Generic; -using NetTopologySuite.Triangulate; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using NetTopologySuite.Geometries; -using System.Linq; -using System; +using NetTopologySuite.Triangulate; using SAM.Core; +using System; +using System.Collections.Generic; +using System.Linq; namespace SAM.Geometry.Planar { @@ -66,7 +69,7 @@ public static List Triangulate(this IEnumerable point2Ds, d public static List Triangulate(this Polygon2D polygon2D, double tolerance = Tolerance.MicroDistance) { List point2Ds = polygon2D?.GetPoints(); - if(point2Ds == null || point2Ds.Count < 3) + if (point2Ds == null || point2Ds.Count < 3) { return null; } @@ -79,7 +82,7 @@ public static List Triangulate(this Polygon2D polygon2D, double tole return result; } - if(point2Ds.Count == 4) + if (point2Ds.Count == 4) { result.Add(new Triangle2D(point2Ds[0], point2Ds[1], point2Ds[2])); result.Add(new Triangle2D(point2Ds[2], point2Ds[3], point2Ds[0])); @@ -100,7 +103,7 @@ public static List Triangulate(this Polygon2D polygon2D, double tole Segment2D segment2D = new Segment2D(point2D_Previous, point2D_Next); double length_Temp = segment2D.GetLength(); - if(length_Temp > length) + if (length_Temp > length) { continue; } @@ -129,7 +132,7 @@ public static List Triangulate(this Polygon2D polygon2D, double tole length = length_Temp; } - if(index != -1) + if (index != -1) { point2Ds.RemoveAt(index); result.Add(triangle2D); @@ -181,11 +184,11 @@ public static List Triangulate(this Face2D face2D, double tolerance foreach (Face2D face2D_Temp in face2Ds) { - if(face2D_Temp == null) + if (face2D_Temp == null) { continue; } - + Polygon polygon = face2D_Temp.ToNTS(tolerance); if (polygon == null || polygon.IsEmpty) { @@ -219,10 +222,10 @@ public static List Triangulate(this Face2D face2D, double tolerance if (!face2D_Temp.HasInternalEdge2Ds) { Polygon2D polygon2D = new Polygon2D((face2D_Temp.ExternalEdge2D as ISegmentable2D)?.GetPoints()); - if(polygon2D.IsValid()) + if (polygon2D.IsValid()) { List polygon2Ds = polygon2D.SelfIntersectionPolygon2Ds(polygon2D.GetBoundingBox().DiagonalLength(), tolerance); - if(polygon2Ds != null) + if (polygon2Ds != null) { triangle2Ds = new List(); @@ -261,7 +264,7 @@ public static List Triangulate(this Face2D face2D, double tolerance } } - if(triangle2Ds != null) + if (triangle2Ds != null) { result.AddRange(triangle2Ds); } @@ -329,7 +332,7 @@ public static List Triangulate(this Triangle2D triangle2D) public static List Triangulate(this Circle2D circle2D, int density) { - if(circle2D == null) + if (circle2D == null) { return null; } @@ -342,7 +345,7 @@ public static List Triangulate(this Circle2D circle2D, int density) double value = i * factor; Point2D point2D = circle2D.GetPoint2D(value); - if(point2D == null) + if (point2D == null) { continue; } @@ -350,13 +353,13 @@ public static List Triangulate(this Circle2D circle2D, int density) point2Ds.Add(point2D); } - if(point2Ds == null || point2Ds.Count < 2) + if (point2Ds == null || point2Ds.Count < 2) { return null; } List result = new List(); - for (int i=0; i < point2Ds.Count - 1; i++) + for (int i = 0; i < point2Ds.Count - 1; i++) { result.Add(new Triangle2D(circle2D.Center, point2Ds[i], point2Ds[i + 1])); } @@ -580,7 +583,7 @@ public static List Triangulate(this Face2D face2D, IEnumerable Triangulate(this Polygon polygon, double tolerance = Tolerance.MicroDistance) { - if(polygon == null) + if (polygon == null) { return null; } @@ -620,12 +623,12 @@ private static List Triangulate(this Polygon polygon, double tolerance else { Coordinate[] coordinates = polygon.Coordinates; - if(coordinates == null || coordinates.Length < 3) + if (coordinates == null || coordinates.Length < 3) { return null; } - if(coordinates.Length == 3) + if (coordinates.Length == 3) { return new List() { polygon }; } @@ -636,7 +639,7 @@ private static List Triangulate(this Polygon polygon, double tolerance geometryCollection = delaunayTriangulationBuilder.GetTriangles(geometryFactory); } - if(geometryCollection == null) + if (geometryCollection == null) { return null; } @@ -659,22 +662,22 @@ private static List Triangulate(this Polygon polygon, double tolerance NetTopologySuite.Geometries.Geometry geometry_Intersection = polygon.Intersection(polygon_Temp); List polygons_Intersection = new List(); - if(geometry_Intersection is Polygon) + if (geometry_Intersection is Polygon) { polygons_Intersection.Add((Polygon)geometry_Intersection); } - else if(geometry_Intersection is GeometryCollection) + else if (geometry_Intersection is GeometryCollection) { - foreach(NetTopologySuite.Geometries.Geometry geometry_Temp in (GeometryCollection)geometry_Intersection) + foreach (NetTopologySuite.Geometries.Geometry geometry_Temp in (GeometryCollection)geometry_Intersection) { - if(geometry_Temp is Polygon) + if (geometry_Temp is Polygon) { polygons_Intersection.Add((Polygon)geometry_Temp); } } } - foreach(Polygon polygon_Intersection in polygons_Intersection) + foreach (Polygon polygon_Intersection in polygons_Intersection) { if (Core.Query.AlmostEqual(polygon_Temp.Area, polygon_Intersection.Area, tolerance)) { @@ -696,4 +699,4 @@ private static List Triangulate(this Polygon polygon, double tolerance } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/TriangulateByNTS.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/TriangulateByNTS.cs index 354ba452e..af14aa2e7 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/TriangulateByNTS.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/TriangulateByNTS.cs @@ -1,6 +1,9 @@ -using System.Collections.Generic; -using NetTopologySuite.Triangulate; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + using NetTopologySuite.Geometries; +using NetTopologySuite.Triangulate; +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -39,4 +42,4 @@ public static List TriangulateByNTS(this Polygon2D polygon2D, double return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Trim.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Trim.cs index a9563f6a1..c5160bb29 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Trim.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Trim.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Planar @@ -233,4 +236,4 @@ public static ISegmentable2D Trim(ISegmentable2D segmentable2D, double parameter return new Polyline2D(result); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/TrimUnconnected.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/TrimUnconnected.cs index 3e541a13c..f0e39e10c 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/TrimUnconnected.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/TrimUnconnected.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -6,7 +9,7 @@ public static partial class Query { public static List TrimUnconnected(this IEnumerable segment2Ds, double minLength, double tolerance = Core.Tolerance.Distance) { - if(segment2Ds == null) + if (segment2Ds == null) { return null; } @@ -30,7 +33,7 @@ public static List TrimUnconnected(this IEnumerable segmen if (segment2Ds_Temp.Count == 1) { Segment2D segment2D = segment2Ds_Temp[0]; - if(segment2D.GetLength() < minLength) + if (segment2D.GetLength() < minLength) { result.Remove(segment2D); removed = true; @@ -42,4 +45,4 @@ public static List TrimUnconnected(this IEnumerable segmen return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Truncate.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Truncate.cs index 769f8d320..0e34650ff 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Truncate.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Truncate.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -6,7 +9,7 @@ public static partial class Query { public static Point2D Truncate(this Point2D point2D, double tolerance = Core.Tolerance.Distance) { - if(point2D == null) + if (point2D == null) { return null; } @@ -16,13 +19,13 @@ public static Point2D Truncate(this Point2D point2D, double tolerance = Core.Tol public static List Truncate(this IEnumerable point2Ds, double tolerance = Core.Tolerance.Distance) { - if(point2Ds == null) + if (point2Ds == null) { return null; } List result = new List(); - foreach(Point2D point2D in point2Ds) + foreach (Point2D point2D in point2Ds) { result.Add(Truncate(point2D, tolerance)); } @@ -33,7 +36,7 @@ public static List Truncate(this IEnumerable point2Ds, double public static Polygon2D Truncate(this Polygon2D polygon2D, double tolerance = Core.Tolerance.Distance) { List point2Ds = polygon2D?.Points; - if(point2Ds == null) + if (point2Ds == null) { return null; } @@ -43,7 +46,7 @@ public static Polygon2D Truncate(this Polygon2D polygon2D, double tolerance = Co public static Segment2D Truncate(this Segment2D segment2D, double tolerance = Core.Tolerance.Distance) { - if(segment2D == null) + if (segment2D == null) { return null; } @@ -51,4 +54,4 @@ public static Segment2D Truncate(this Segment2D segment2D, double tolerance = Co return new Segment2D(Truncate(segment2D[0], tolerance), Truncate(segment2D[1], tolerance)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Union.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Union.cs index 796d699ac..bb4bb2b15 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Union.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Union.cs @@ -1,4 +1,7 @@ -//using ClipperLib; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +//using ClipperLib; using NetTopologySuite.Geometries; using NetTopologySuite.Geometries.Utilities; using NetTopologySuite.Precision; @@ -44,7 +47,7 @@ public static partial class Query public static List Union(this Polygon2D polygon2D_1, Polygon2D polygon2D_2, double tolerance = Tolerance.MicroDistance) { - if(polygon2D_1 == null || polygon2D_2 == null) + if (polygon2D_1 == null || polygon2D_2 == null) { return null; } @@ -61,7 +64,7 @@ public static List Union(this IEnumerable polygon2Ds, doub foreach (Polygon2D polygon2D in polygon2Ds) { Polygon polygon = polygon2D?.ToNTS_Polygon(tolerance); - if(polygon == null) + if (polygon == null) { continue; } @@ -74,7 +77,7 @@ public static List Union(this IEnumerable polygon2Ds, doub return null; List result = new List(); - foreach(Polygon polygon in polygons) + foreach (Polygon polygon in polygons) { result.AddRange(polygon.ToSAM_Polygon2Ds(tolerance)); } @@ -121,14 +124,14 @@ public static List Union(this IEnumerable polygons) return result; } - if(polygons.Count() == 1) + if (polygons.Count() == 1) { result.Add(polygons.ElementAt(0)); return result; } NetTopologySuite.Geometries.Geometry geometry = new MultiPolygon(polygons.ToArray()); - if(!geometry.IsValid) + if (!geometry.IsValid) { geometry = GeometryFixer.Fix(geometry); //2023-09-12 https://github.com/NetTopologySuite/NetTopologySuite/issues/708 } @@ -142,7 +145,7 @@ public static List Union(this IEnumerable polygons) double tolerance = Tolerance.Distance; Polygon[] polygons_Temp = new Polygon[polygons.Count()]; - for(int i =0; i < polygons_Temp.Length; i++) + for (int i = 0; i < polygons_Temp.Length; i++) { polygons_Temp[i] = SimplifyByTopologyPreservingSimplifier(polygons.ElementAt(i), tolerance); } @@ -178,7 +181,7 @@ public static List Union(this Segment2D segment2D_1, Segment2D segmen bool on_4 = segment2D_2.On(segment2D_1[1], tolerance); if (!on_1 && !on_2 && !on_3 && !on_4) - return new List() { segment2D_1, segment2D_2}; + return new List() { segment2D_1, segment2D_2 }; Point2D point2D_1; Point2D point2D_2; @@ -206,7 +209,7 @@ public static List Union(this IEnumerable segment2Ds, doub List segment2Ds_Temp = new List(segment2Ds); - while(segment2Ds_Temp.Count > 0) + while (segment2Ds_Temp.Count > 0) { Segment2D segment2D = segment2Ds_Temp[0]; segment2Ds_Temp.RemoveAt(0); @@ -222,8 +225,8 @@ public static List Union(this IEnumerable face2Ds, double tolera if (face2Ds == null) return null; - List polygons = new List(); - foreach(Face2D face2D in face2Ds) + List polygons = new List(); + foreach (Face2D face2D in face2Ds) { Polygon polygon = face2D?.ToNTS(tolerance); if (polygon == null) @@ -236,7 +239,7 @@ public static List Union(this IEnumerable face2Ds, double tolera { polygons = Union(polygons); } - catch(Exception) + catch (Exception) { polygons = polygons.ConvertAll(x => SimplifyByDouglasPeucker(x, tolerance)); polygons = Union(polygons); @@ -296,6 +299,6 @@ public static List Union(this Face2D face2D_1, Face2D face2D_2, double t } return null; - } + } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/UniquePoint2Ds.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/UniquePoint2Ds.cs index 17515e07f..63b5646a4 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/UniquePoint2Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/UniquePoint2Ds.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -10,7 +13,7 @@ public static HashSet UniquePoint2Ds(this IEnumerable s return null; HashSet result = new HashSet(); - foreach(ISegmentable2D segmentable2D in segmentable2Ds) + foreach (ISegmentable2D segmentable2D in segmentable2Ds) { List point2Ds = segmentable2D?.GetPoints(); if (point2Ds == null || point2Ds.Count == 0) @@ -18,7 +21,7 @@ public static HashSet UniquePoint2Ds(this IEnumerable s continue; } - foreach(Point2D point2D in point2Ds) + foreach (Point2D point2D in point2Ds) { result.Add(point2D); } @@ -50,4 +53,4 @@ public static List UniquePoint2Ds(this IEnumerable segmentable2Ds return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/Vector2D.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/Vector2D.cs index c8a1c22e1..b16e9e100 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/Vector2D.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/Vector2D.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Planar { public static partial class Query { @@ -9,7 +12,7 @@ public static partial class Query /// public static Vector2D Vector2D(double angle) { - if(double.IsNaN(angle)) + if (double.IsNaN(angle)) { return null; } @@ -17,4 +20,4 @@ public static Vector2D Vector2D(double angle) return new Vector2D(System.Math.Cos(angle), System.Math.Sin(angle)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/VerticalPosition.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/VerticalPosition.cs index 2a86256e2..24c95d319 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/VerticalPosition.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/VerticalPosition.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Planar { @@ -7,24 +10,24 @@ public static partial class Query public static VerticalPosition VerticalPosition(this ISegmentable2D segmentable2D, Point2D point2D, double tolerance = SAM.Core.Tolerance.Distance) { - if(segmentable2D == null || point2D == null) + if (segmentable2D == null || point2D == null) { return Geometry.VerticalPosition.Undefined; } List segment2Ds = segmentable2D.GetSegments(); - if(segment2Ds == null || segment2Ds.Count == 0) + if (segment2Ds == null || segment2Ds.Count == 0) { return Geometry.VerticalPosition.Undefined; } List verticalPositions = new List(); - foreach(Segment2D segment2D in segmentable2D.GetSegments()) + foreach (Segment2D segment2D in segmentable2D.GetSegments()) { verticalPositions.Add(VerticalPosition(segment2D, point2D, tolerance)); } - if(verticalPositions.TrueForAll(x => x == Geometry.VerticalPosition.Undefined)) + if (verticalPositions.TrueForAll(x => x == Geometry.VerticalPosition.Undefined)) { return Geometry.VerticalPosition.Undefined; } @@ -46,20 +49,20 @@ public static VerticalPosition VerticalPosition(this ISegmentable2D segmentable2 public static VerticalPosition VerticalPosition(this Segment2D segment2D, Point2D point2D, double tolerance = Core.Tolerance.Distance) { - if(segment2D == null || point2D == null) + if (segment2D == null || point2D == null) { return Geometry.VerticalPosition.Undefined; } BoundingBox2D boundingBox = segment2D.GetBoundingBox(); - if(point2D.X < boundingBox.Min.X - tolerance || point2D.X > boundingBox.Max.X + tolerance) + if (point2D.X < boundingBox.Min.X - tolerance || point2D.X > boundingBox.Max.X + tolerance) { return Geometry.VerticalPosition.Undefined; } Vector2D vector2D = TraceFirst(point2D, new Vector2D(0, -1), segment2D); - if(vector2D == null) + if (vector2D == null) { return Geometry.VerticalPosition.Below; } @@ -72,4 +75,4 @@ public static VerticalPosition VerticalPosition(this Segment2D segment2D, Point2 return Geometry.VerticalPosition.Above; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Planar/Query/WorkGeometry.cs b/SAM/SAM.Geometry/Geometry/Planar/Query/WorkGeometry.cs index e43460634..99ced34de 100644 --- a/SAM/SAM.Geometry/Geometry/Planar/Query/WorkGeometry.cs +++ b/SAM/SAM.Geometry/Geometry/Planar/Query/WorkGeometry.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; namespace SAM.Geometry.Planar { @@ -6,7 +9,7 @@ public static partial class Query { public static NetTopologySuite.Geometries.Geometry WorkGeometry(NetTopologySuite.Geometries.Geometry geometry, double tolerance = Core.Tolerance.MacroDistance) { - if(geometry == null) + if (geometry == null) { return null; } @@ -21,4 +24,4 @@ public static NetTopologySuite.Geometries.Geometry WorkGeometry(NetTopologySuite return geometry.Factory.CreateGeometryCollection(new[] { geometry, bounds }); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/BoundingBox3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/BoundingBox3D.cs index c0cdd22a6..60c3c28fc 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/BoundingBox3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/BoundingBox3D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; @@ -135,7 +138,7 @@ public bool Intersect(Segment3D segment3D, double tolerance = Core.Tolerance.Dis Point3D point3D_1 = segment3D[0]; Point3D point3D_2 = segment3D[1]; - if(!InRange(new BoundingBox3D(point3D_1, point3D_2))) + if (!InRange(new BoundingBox3D(point3D_1, point3D_2))) { return false; } @@ -299,7 +302,7 @@ public bool InRange(BoundingBox3D boundingBox3D, double tolerance = Core.Toleran { return Query.InRange(this, boundingBox3D, tolerance); } - + public override ISAMGeometry Clone() { return new BoundingBox3D(this); @@ -422,7 +425,7 @@ public bool Include(BoundingBox3D boundingBox3D) public bool Include(Point3D point3D) { - if(point3D == null) + if (point3D == null) { return false; } @@ -434,7 +437,7 @@ public bool Include(Point3D point3D) public bool Include(IEnumerable point3Ds) { - if(point3Ds == null || point3Ds.Count() == 0) + if (point3Ds == null || point3Ds.Count() == 0) { return false; } @@ -446,10 +449,10 @@ public bool Include(IEnumerable point3Ds) public ISAMGeometry3D GetTransformed(Transform3D transform3D) { - if(transform3D == null) + if (transform3D == null) { return null; - } + } return Query.Transform(this, transform3D); } @@ -462,7 +465,7 @@ public double GetLength() public override bool Equals(object obj) { BoundingBox3D boundingBox3D = obj as BoundingBox3D; - if(boundingBox3D == null) + if (boundingBox3D == null) { return false; } @@ -503,4 +506,4 @@ public override int GetHashCode() return boundingBox3D_1.min != boundingBox3D_2.min || boundingBox3D_1.max != boundingBox3D_2.max; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Circle3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Circle3D.cs index 8935e9268..6d5dac3fd 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Circle3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Circle3D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; namespace SAM.Geometry.Spatial @@ -88,11 +91,11 @@ public double GetPerimeter() public Plane GetPlane() { - if(plane == null) + if (plane == null) { return null; } - + return new Plane(plane); } @@ -103,14 +106,14 @@ public Plane GetPlane() /// Point on Circle public Point3D GetPoint3D(double angle) { - if(plane == null || double.IsNaN(radius)) + if (plane == null || double.IsNaN(radius)) { return null; } Planar.Circle2D circle2D = new Planar.Circle2D(plane.Convert(plane.Origin), radius); Planar.Point2D point2D = circle2D.GetPoint2D(angle); - if(point2D == null) + if (point2D == null) { return null; } @@ -171,7 +174,7 @@ public ISAMGeometry3D GetTransformed(Transform3D transform3D) public override bool Equals(object obj) { Circle3D circle3D = obj as Circle3D; - if(circle3D == null) + if (circle3D == null) { return false; } @@ -212,4 +215,4 @@ public override int GetHashCode() return circle3D_1.plane != circle3D_2.plane || circle3D_1.radius != circle3D_2.radius; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/CoordinateSystem3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/CoordinateSystem3D.cs index 318791471..4adc90f65 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/CoordinateSystem3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/CoordinateSystem3D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Geometry.Spatial @@ -20,7 +23,7 @@ public CoordinateSystem3D(Point3D origin, Vector3D axisX, Vector3D axisY, Vector public CoordinateSystem3D(Plane plane) { - if(plane != null) + if (plane != null) { origin = plane.Origin; axisX = plane.AxisX; @@ -31,7 +34,7 @@ public CoordinateSystem3D(Plane plane) public CoordinateSystem3D(CoordinateSystem3D coordinateSystem3D) { - if(coordinateSystem3D != null) + if (coordinateSystem3D != null) { origin = coordinateSystem3D.Origin; axisX = coordinateSystem3D.AxisX; @@ -92,12 +95,12 @@ public bool IsValid() public bool FromJObject(JObject jObject) { - if(jObject == null) + if (jObject == null) { return false; } - if(jObject.ContainsKey("AxisX")) + if (jObject.ContainsKey("AxisX")) { axisX = new Vector3D(jObject.Value("AxisX")); } @@ -157,4 +160,4 @@ public static CoordinateSystem3D World } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Ellipse3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Ellipse3D.cs index 81eb4f2f7..97869d936 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Ellipse3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Ellipse3D.cs @@ -1,9 +1,12 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Geometry.Planar; namespace SAM.Geometry.Spatial { - public class Ellipse3D: SAMGeometry, IClosedPlanar3D + public class Ellipse3D : SAMGeometry, IClosedPlanar3D { private Ellipse2D ellipse2D; private Plane plane; diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Extrusion.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Extrusion.cs index 3f68fe354..9bf4303a5 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Extrusion.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Extrusion.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Geometry.Spatial { @@ -33,18 +36,18 @@ public Extrusion(JObject jObject) public BoundingBox3D GetBoundingBox(double offset = 0) { BoundingBox3D boundingBox3D_1 = face3D?.GetBoundingBox(offset); - if(boundingBox3D_1 == null) + if (boundingBox3D_1 == null) { return null; } BoundingBox3D boundingBox3D_2 = boundingBox3D_1.GetMoved(vector) as BoundingBox3D; - if(boundingBox3D_2 == null) + if (boundingBox3D_2 == null) { return boundingBox3D_1; } - return new BoundingBox3D(new BoundingBox3D[] { boundingBox3D_1, boundingBox3D_2}); + return new BoundingBox3D(new BoundingBox3D[] { boundingBox3D_1, boundingBox3D_2 }); } public ISAMGeometry3D GetMoved(Vector3D vector3D) @@ -107,4 +110,4 @@ public ISAMGeometry3D GetTransformed(Transform3D transform3D) return Query.Transform(this, transform3D); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Face3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Face3D.cs index d17dc0426..e889259db 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Face3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Face3D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Geometry.Planar; using System.Collections.Generic; using System.Linq; @@ -40,11 +43,11 @@ public Face3D(JObject jObject) public Plane GetPlane() { - if(plane == null) + if (plane == null) { return null; } - + return new Plane(plane); } @@ -86,11 +89,11 @@ public List GetEdge3Ds() public ISAMGeometry3D GetMoved(Vector3D vector3D) { - if(vector3D == null || plane == null || externalEdge2D == null) + if (vector3D == null || plane == null || externalEdge2D == null) { return null; } - + Face3D face3D = new Face3D((Plane)plane.GetMoved(vector3D), (IClosed2D)externalEdge2D.Clone()); face3D.internalEdge2Ds = internalEdge2Ds?.ConvertAll(x => (IClosed2D)x.Clone()); return face3D; @@ -190,13 +193,13 @@ public bool InRange(Face3D face3D, double tolerance = Core.Tolerance.Distance) } IClosed2D closed2D_2 = plane.Convert(closed3D_2); - if(closed2D_2 == null) + if (closed2D_2 == null) { return false; } ISegmentable2D segmentable2D = closed2D_2 as ISegmentable2D; - if(segmentable2D == null) + if (segmentable2D == null) { throw new System.NotImplementedException(); } @@ -241,7 +244,7 @@ public bool InRange(Point3D point3D, double tolerance = Core.Tolerance.Distance) public bool On(Point3D point3D, double tolerance = Core.Tolerance.Distance) { - if(plane == null || point3D == null || !plane.On(point3D, tolerance)) + if (plane == null || point3D == null || !plane.On(point3D, tolerance)) { return false; } @@ -330,7 +333,7 @@ public double DistanceToEdges(Point3D point3D) public void Normalize(Orientation orientation = Orientation.CounterClockwise, EdgeOrientationMethod edgeOrientationMethod = EdgeOrientationMethod.Opposite, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { Face3D face3D = Query.Normalize(this, orientation, edgeOrientationMethod, tolerance_Angle, tolerance_Distance); - if(face3D != null) + if (face3D != null) { externalEdge2D = face3D.externalEdge2D; internalEdge2Ds = face3D.internalEdge2Ds; @@ -470,4 +473,4 @@ public static Face3D Create(Plane plane, IEnumerable edges, EdgeOrien return new Face3D(plane, Face2D.Create(edges, edgeOrientationMethod)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Line3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Line3D.cs index 83d8ac7f6..adf6d2f27 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Line3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Line3D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Geometry.Spatial { @@ -127,4 +130,4 @@ public string ToString(LineFormulaForm lineFormulaForm) return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Mesh3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Mesh3D.cs index 973ece447..87a0e757e 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Mesh3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Mesh3D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; @@ -9,7 +12,7 @@ public class Mesh3D : SAMGeometry, IMesh, ISAMGeometry3D, IBoundable3D { private List points; private List> indexes; - + public Mesh3D(JObject jObject) { FromJObject(jObject); @@ -23,24 +26,24 @@ public Mesh3D(Mesh3D mesh3D) public Mesh3D(IEnumerable triangle3Ds) { - if(triangle3Ds != null) + if (triangle3Ds != null) { points = new List(); indexes = new List>(); foreach (Triangle3D triangle3D in triangle3Ds) { - if(triangle3D == null) + if (triangle3D == null) { continue; } int[] array = new int[3]; - for (int i=0; i < 3; i++) + for (int i = 0; i < 3; i++) { Point3D point3D = triangle3D[i]; int index = points.FindIndex(x => x.Equals(point3D)); - if(index == -1) + if (index == -1) { index = points.Count; points.Add(point3D); @@ -115,11 +118,11 @@ public override bool FromJObject(JObject jObject) indexes = new List>(); JArray jArray = jObject.Value("Indexes"); - if(jArray != null) + if (jArray != null) { foreach (JArray jArray_Temp in jArray) { - if(jArray_Temp == null || jArray_Temp.Count < 3) + if (jArray_Temp == null || jArray_Temp.Count < 3) { continue; } @@ -141,11 +144,11 @@ public override JObject ToJObject() if (points != null) jObject.Add("Points", Geometry.Create.JArray(points)); - if(indexes != null) + if (indexes != null) { JArray jArray = new JArray(); - foreach(Tuple tuple in indexes) + foreach (Tuple tuple in indexes) { JArray jArray_Temp = new JArray(); jArray_Temp.Add(tuple.Item1); @@ -194,25 +197,25 @@ public int PointsCount public HashSet ConnectedIndexes(int index) { - if(indexes == null || indexes.Count == 0) + if (indexes == null || indexes.Count == 0) { return null; } - if(index < 0 || index >= points.Count) + if (index < 0 || index >= points.Count) { return null; } HashSet result = new HashSet(); - foreach(Tuple tuple in indexes) + foreach (Tuple tuple in indexes) { - if(index == tuple.Item1) + if (index == tuple.Item1) { result.Add(tuple.Item2); result.Add(tuple.Item3); } - else if(index == tuple.Item2) + else if (index == tuple.Item2) { result.Add(tuple.Item1); result.Add(tuple.Item3); @@ -230,7 +233,7 @@ public HashSet ConnectedIndexes(int index) public HashSet ConnectedIndexes(Point3D point3D) { int index = IndexOf(point3D); - if(index == -1) + if (index == -1) { return null; } @@ -252,13 +255,13 @@ public HashSet ConnectedIndexes(Point3D point3D, double tolerance) public HashSet ConnectedPoint3Ds(int index) { HashSet indexes = ConnectedIndexes(index); - if(indexes == null) + if (indexes == null) { return null; } HashSet result = new HashSet(); - foreach(int index_Connected in indexes) + foreach (int index_Connected in indexes) { result.Add(points[index_Connected]); } @@ -291,7 +294,7 @@ public HashSet ConnectedPoint3Ds(Point3D point3D, double tolerance) public Triangle3D GetTriangle(int index) { Tuple tuple = GetTriangleIndexes(index); - if(tuple == null) + if (tuple == null) { return null; } @@ -335,7 +338,7 @@ public Tuple GetTriangleIndexes(int index) public Vector3D GetNormal(int index) { Tuple triangleIndexes = GetTriangleIndexes(index); - if(triangleIndexes == null) + if (triangleIndexes == null) { return null; } @@ -345,7 +348,7 @@ public Vector3D GetNormal(int index) public List GetTriangleIndexes(int index_1, int index_2, int maxCount = int.MaxValue) { - if(points == null || points.Count < 3 || indexes == null || indexes.Count == 0) + if (points == null || points.Count < 3 || indexes == null || indexes.Count == 0) { return null; } @@ -361,15 +364,15 @@ public List GetTriangleIndexes(int index_1, int index_2, int maxCount = int } List result = new List(); - for(int i=0; i < indexes.Count; i++) + for (int i = 0; i < indexes.Count; i++) { Tuple tuple = indexes[i]; - if(tuple == null) + if (tuple == null) { continue; } - if(tuple.Item1 != index_1 && tuple.Item2 != index_1 && tuple.Item3 != index_1) + if (tuple.Item1 != index_1 && tuple.Item2 != index_1 && tuple.Item3 != index_1) { continue; } @@ -381,7 +384,7 @@ public List GetTriangleIndexes(int index_1, int index_2, int maxCount = int result.Add(i); - if(result.Count >= maxCount) + if (result.Count >= maxCount) { break; } @@ -392,7 +395,7 @@ public List GetTriangleIndexes(int index_1, int index_2, int maxCount = int public List GetTriangles() { - if(points == null || indexes == null) + if (points == null || indexes == null) { return null; } @@ -404,12 +407,12 @@ public List GetTriangles() } List result = new List(); - if(count == 0) + if (count == 0) { return result; } - - for (int i=0; i < TrianglesCount; i++) + + for (int i = 0; i < TrianglesCount; i++) { result.Add(GetTriangle(i)); } @@ -424,7 +427,7 @@ public List GetSegments() public List GetSegments(bool includeSimiliar) { - if(points == null || indexes == null) + if (points == null || indexes == null) { return null; } @@ -434,15 +437,15 @@ public List GetSegments(bool includeSimiliar) if (includeSimiliar) { List triangle3Ds = GetTriangles(); - if(triangle3Ds == null) + if (triangle3Ds == null) { return null; } - foreach(Triangle3D triangle3D in triangle3Ds) + foreach (Triangle3D triangle3D in triangle3Ds) { List segment3Ds_Triangle3D = triangle3D?.GetSegments(); - if(segment3Ds_Triangle3D != null && segment3Ds_Triangle3D.Count != 0) + if (segment3Ds_Triangle3D != null && segment3Ds_Triangle3D.Count != 0) { result.AddRange(segment3Ds_Triangle3D); } @@ -506,31 +509,31 @@ public List GetPoints() public bool On(Point3D point3D, double tolerance = Core.Tolerance.Distance) { - if(points == null || indexes == null) + if (points == null || indexes == null) { return false; } - - if(!GetBoundingBox().InRange(point3D, tolerance)) + + if (!GetBoundingBox().InRange(point3D, tolerance)) { return false; } - for(int i=0; i < indexes.Count; i++) + for (int i = 0; i < indexes.Count; i++) { Triangle3D triangle3D = GetTriangle(i); - if(triangle3D == null) + if (triangle3D == null) { continue; } - if(!triangle3D.GetBoundingBox().InRange(point3D, tolerance)) + if (!triangle3D.GetBoundingBox().InRange(point3D, tolerance)) { continue; } double distance = new Face3D(triangle3D).Distance(point3D, tolerance); - if(distance < tolerance) + if (distance < tolerance) { return true; } diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/PlanarIntersectionResult.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/PlanarIntersectionResult.cs index ea01dc158..0c3f87c30 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/PlanarIntersectionResult.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/PlanarIntersectionResult.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using System.Collections.Generic; using System.Linq; @@ -124,7 +127,7 @@ public Plane Plane { get { - if(plane == null) + if (plane == null) { return null; } @@ -133,4 +136,4 @@ public Plane Plane } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Plane.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Plane.cs index 63c6e25fc..fd09ac8bd 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Plane.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Plane.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; using System.Collections.Generic; @@ -208,7 +211,7 @@ public double Distance(Plane plane, double tolerance = Tolerance.Distance) public bool On(Point3D point3D, double tolerance = Tolerance.Distance) { - if(point3D == null) + if (point3D == null) { return false; } @@ -218,11 +221,11 @@ public bool On(Point3D point3D, double tolerance = Tolerance.Distance) public Point3D Closest(Point3D point3D) { - if(point3D == null) + if (point3D == null) { return null; } - + double factor = point3D.ToVector3D().DotProduct(normal) - K; return new Point3D(point3D.X - (normal.X * factor), point3D.Y - (normal.Y * factor), point3D.Z - (normal.Z * factor)); } @@ -357,7 +360,7 @@ public static Plane WorldXZ public override bool Equals(object obj) { Plane plane = obj as Plane; - if(plane == null) + if (plane == null) { return false; } @@ -398,4 +401,4 @@ public override int GetHashCode() return plane_1.origin != plane_2.origin || plane_1.normal != plane_2.normal || plane_1.axisY != plane_2.axisY; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Point3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Point3D.cs index 622c7f127..dc18528de 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Point3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Point3D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Geometry.Spatial { @@ -124,7 +127,7 @@ public double Angle(Point3D point3D_1, Point3D point3D_2) double value = vector3D_1.DotProduct(vector3D_2) / (vector3D_1.Length * vector3D_2.Length); - double result = System.Math.Acos(value); + double result = System.Math.Acos(value); if (!double.IsNaN(result)) return result; @@ -234,7 +237,7 @@ public bool AlmostEquals(Point3D point3D, double tolerance = Core.Tolerance.Dist return ((System.Math.Abs(coordinates[0] - point3D.coordinates[0]) < tolerance) && (System.Math.Abs(coordinates[1] - point3D.coordinates[1]) < tolerance) && (System.Math.Abs(coordinates[2] - point3D.coordinates[2]) < tolerance)); } - public static Point3D Zero + public static Point3D Zero { get { @@ -300,4 +303,4 @@ public static implicit operator Vector3D(Point3D point3D) return new Point3D(point3D.coordinates[0] - vector3D[0], point3D.coordinates[1] - vector3D[1], point3D.coordinates[2] - vector3D[2]); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Point3DCluster.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Point3DCluster.cs index f651dd288..d5f51f34d 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Point3DCluster.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Point3DCluster.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Point3DGraph.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Point3DGraph.cs index ae7d5ed1b..b2b036726 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Point3DGraph.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Point3DGraph.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections.Generic; @@ -13,21 +16,21 @@ public Point3DGraph() } public Point3DGraph(double tolerance) - :base(tolerance) + : base(tolerance) { } public Point3DGraph(JObject jObject) - :base(jObject) + : base(jObject) { } public Point3DGraph(Point3DGraph point3DGraph) - :base(point3DGraph) + : base(point3DGraph) { - + } public List> Split() @@ -64,4 +67,4 @@ protected override double Weight(PointGraphEdge pointGraphEdge) return pointGraphEdge.Source.Distance(pointGraphEdge.Target); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Polycurve3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Polycurve3D.cs index f18f3a8cc..133d63f63 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Polycurve3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Polycurve3D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; using System.Linq; @@ -128,4 +131,4 @@ public static bool TryGetPolyline3D(Polycurve3D polycurve3D, out Polyline3D poly return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Polycurveloop3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Polycurveloop3D.cs index 751328fa6..5b9117a77 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Polycurveloop3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Polycurveloop3D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; namespace SAM.Geometry.Spatial @@ -58,4 +61,4 @@ public static bool TryGetPolygon3D(PolycurveLoop3D polycurveLoop3D, out Polygon3 return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Polygon3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Polygon3D.cs index 9856f0576..b6c44b68b 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Polygon3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Polygon3D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; using System.Linq; @@ -45,7 +48,7 @@ public Polygon3D(JObject jObject) public List GetPoints() { - if(plane == null) + if (plane == null) { return null; } @@ -55,11 +58,11 @@ public List GetPoints() public Plane GetPlane() { - if(plane == null) + if (plane == null) { return null; } - + return new Plane(plane); } @@ -211,7 +214,7 @@ public static implicit operator Polygon3D(Rectangle3D rectangle3D) { Plane plane = rectangle3D?.GetPlane(); - if(plane == null) + if (plane == null) { return null; } @@ -230,4 +233,4 @@ public static implicit operator Polygon3D(Triangle3D triangle3D) return new Polygon3D(plane, triangle3D.GetPoints().ConvertAll(x => plane.Convert(x))); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Polyline3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Polyline3D.cs index da2b537d9..0d126bd3b 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Polyline3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Polyline3D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; using System.Linq; @@ -159,4 +162,4 @@ public bool On(Point3D point3D, double tolerance = Core.Tolerance.Distance) return Query.On(this, point3D, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Rectangle3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Rectangle3D.cs index e5dca573e..04de461b4 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Rectangle3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Rectangle3D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Geometry.Planar; using System.Collections.Generic; @@ -66,7 +69,7 @@ public BoundingBox3D GetBoundingBox(double offset = 0) public List GetCurves() { - return GetSegments().ConvertAll(x => (ICurve3D)x ); + return GetSegments().ConvertAll(x => (ICurve3D)x); } public ISAMGeometry3D GetMoved(Vector3D vector3D) @@ -142,11 +145,11 @@ public double GetArea() public Plane GetPlane() { - if(plane == null) + if (plane == null) { return null; } - + return new Plane(plane); } @@ -154,7 +157,7 @@ public Rectangle2D Rectangle2D { get { - if(rectangle2D == null) + if (rectangle2D == null) { return null; } @@ -180,7 +183,7 @@ public Point3D GetCentroid() public double GetLength() { - if(rectangle2D == null) + if (rectangle2D == null) { return double.NaN; } @@ -188,4 +191,4 @@ public double GetLength() return rectangle2D.GetLength(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/SAMGeometry3DGroup.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/SAMGeometry3DGroup.cs index 0157d5a1d..c01b0a2f8 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/SAMGeometry3DGroup.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/SAMGeometry3DGroup.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections; using System.Collections.Generic; using System.Linq; @@ -17,7 +20,7 @@ public SAMGeometry3DGroup() public SAMGeometry3DGroup(SAMGeometry3DGroup sAMGeometry3DGroup) { - if(sAMGeometry3DGroup != null) + if (sAMGeometry3DGroup != null) { coordinateSystem3D = sAMGeometry3DGroup.coordinateSystem3D == null ? null : new CoordinateSystem3D(sAMGeometry3DGroup.coordinateSystem3D); sAMGeometry3Ds = sAMGeometry3DGroup.sAMGeometry3Ds?.ConvertAll(x => x?.Clone() as ISAMGeometry3D); @@ -26,7 +29,7 @@ public SAMGeometry3DGroup(SAMGeometry3DGroup sAMGeometry3DGroup) public SAMGeometry3DGroup(CoordinateSystem3D coordinateSystem3D) { - this.coordinateSystem3D = coordinateSystem3D == null ? null : new CoordinateSystem3D(coordinateSystem3D); + this.coordinateSystem3D = coordinateSystem3D == null ? null : new CoordinateSystem3D(coordinateSystem3D); } private SAMGeometry3DGroup(CoordinateSystem3D coordinateSystem3D, IEnumerable sAMGeometry3Ds) @@ -38,7 +41,7 @@ private SAMGeometry3DGroup(CoordinateSystem3D coordinateSystem3D, IEnumerable sAMGeometry3Ds) { coordinateSystem3D = CoordinateSystem3D.World; - this.sAMGeometry3Ds = sAMGeometry3Ds == null ? null : sAMGeometry3Ds.ToList().ConvertAll(x => x.Clone() as ISAMGeometry3D); + this.sAMGeometry3Ds = sAMGeometry3Ds == null ? null : sAMGeometry3Ds.ToList().ConvertAll(x => x.Clone() as ISAMGeometry3D); } public SAMGeometry3DGroup(JObject jObject) @@ -48,18 +51,18 @@ public SAMGeometry3DGroup(JObject jObject) public bool Add(ISAMGeometry3D sAMGeometry3D) { - if(sAMGeometry3D == null || coordinateSystem3D == null) + if (sAMGeometry3D == null || coordinateSystem3D == null) { return false; } Transform3D transform3D = Transform3D.GetCoordinateSystem3DToCoordinateSystem3D(CoordinateSystem3D.World, coordinateSystem3D); - if(transform3D == null) + if (transform3D == null) { return false; } - if(sAMGeometry3Ds == null) + if (sAMGeometry3Ds == null) { sAMGeometry3Ds = new List(); } @@ -72,7 +75,7 @@ public int Count { get { - if(sAMGeometry3Ds == null) + if (sAMGeometry3Ds == null) { return -1; } @@ -92,7 +95,7 @@ public ISAMGeometry3D this[int index] set { - if(value == null) + if (value == null) { sAMGeometry3Ds[index] = null; return; @@ -110,23 +113,23 @@ public ISAMGeometry Clone() public virtual bool FromJObject(JObject jObject) { - if(jObject == null) + if (jObject == null) { return false; } - if(jObject.ContainsKey("CoordinateSystem3D")) + if (jObject.ContainsKey("CoordinateSystem3D")) { coordinateSystem3D = new CoordinateSystem3D(jObject.Value("CoordinateSystem3D")); } - if(jObject.ContainsKey("SAMGeometry3Ds")) + if (jObject.ContainsKey("SAMGeometry3Ds")) { JArray jArray = jObject.Value("SAMGeometry3Ds"); - if(jArray != null) + if (jArray != null) { sAMGeometry3Ds = new List(); - foreach(JObject jObject_Temp in jArray) + foreach (JObject jObject_Temp in jArray) { sAMGeometry3Ds.Add(Core.Query.IJSAMObject(jObject_Temp)); } @@ -139,7 +142,7 @@ public virtual bool FromJObject(JObject jObject) public IEnumerator GetEnumerator() { List sAMGeometry3Ds_Temp = new List(); - if(sAMGeometry3Ds != null) + if (sAMGeometry3Ds != null) { Transform3D transform3D = Transform3D.GetCoordinateSystem3DToCoordinateSystem3D(coordinateSystem3D, CoordinateSystem3D.World); foreach (ISAMGeometry3D sAMGeometry3D in sAMGeometry3Ds) @@ -153,7 +156,7 @@ public IEnumerator GetEnumerator() public ISAMGeometry3D GetMoved(Vector3D vector3D) { - if(vector3D == null) + if (vector3D == null) { return null; } @@ -165,7 +168,7 @@ public ISAMGeometry3D GetMoved(Vector3D vector3D) public ISAMGeometry3D GetTransformed(Transform3D transform3D) { - if(transform3D == null) + if (transform3D == null) { return null; } @@ -180,17 +183,17 @@ public virtual JObject ToJObject() JObject result = new JObject(); result.Add("_type", Core.Query.FullTypeName(this)); - if(coordinateSystem3D != null) + if (coordinateSystem3D != null) { result.Add("CoordinateSystem3D", coordinateSystem3D.ToJObject()); } - if(sAMGeometry3Ds != null) + if (sAMGeometry3Ds != null) { JArray jArray = new JArray(); - foreach(ISAMGeometry3D sAMGeometry3D in sAMGeometry3Ds) + foreach (ISAMGeometry3D sAMGeometry3D in sAMGeometry3Ds) { - if(sAMGeometry3D == null) + if (sAMGeometry3D == null) { continue; } @@ -209,4 +212,4 @@ IEnumerator IEnumerable.GetEnumerator() return GetEnumerator(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Segment3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Segment3D.cs index 13281dee4..30fcfc21d 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Segment3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Segment3D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; @@ -268,7 +271,7 @@ public Point3D Intersection(Segment3D segment3D, out Point3D point3D_Closest1, o Point3D origin_1 = origin; Vector3D direction_1 = Direction; - + Point3D origin_2 = segment3D.origin; Vector3D direction_2 = segment3D.Direction; @@ -285,7 +288,7 @@ public Point3D Intersection(Segment3D segment3D, out Point3D point3D_Closest1, o point3D_Closest1 = origin_1.GetMoved(sc * direction_1) as Point3D; point3D_Closest2 = origin_2.GetMoved(tc * direction_2) as Point3D; - if(!On(point3D_Closest1, tolerance)) + if (!On(point3D_Closest1, tolerance)) { point3D_Closest1 = Closest(point3D_Closest1); } @@ -327,7 +330,7 @@ public Line3D GetLine3D() public override bool Equals(object obj) { Segment3D segment3D = obj as Segment3D; - if(segment3D == null) + if (segment3D == null) { return false; } @@ -376,4 +379,4 @@ public static explicit operator Segment3D(Line3D line3D) return segment3D_1.origin != segment3D_2.origin || segment3D_1.vector != segment3D_2.vector; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Shell.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Shell.cs index 6bb44efc8..392e0fa21 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Shell.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Shell.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Geometry.Planar; using System; using System.Collections.Generic; @@ -17,14 +20,14 @@ public Shell(IEnumerable face3Ds) { foreach (Face3D face3D in face3Ds) { - if(face3D == null) + if (face3D == null) { continue; } - + Add(face3D); } - + } } @@ -89,7 +92,7 @@ public bool IsClosed(double tolerance = Core.Tolerance.Distance) return false; List segment3Ds = Query.NakedSegment3Ds(this, 1, tolerance); - if(segment3Ds == null || segment3Ds.Count == 0) + if (segment3Ds == null || segment3Ds.Count == 0) { return true; } @@ -153,7 +156,7 @@ public List IntersectionPoint3Ds(Segment3D segment3D, bool includeInter return IntersectionGeometry3Ds(segment3D, includeInternalEdges, tolerance); } - public List IntersectionGeometry3Ds(Segment3D segment3D, bool includeInternalEdges = true, double tolerance = Core.Tolerance.Distance) where T: ISAMGeometry3D + public List IntersectionGeometry3Ds(Segment3D segment3D, bool includeInternalEdges = true, double tolerance = Core.Tolerance.Distance) where T : ISAMGeometry3D { if (segment3D == null || boundaries == null) return null; @@ -167,7 +170,7 @@ public List IntersectionGeometry3Ds(Segment3D segment3D, bool includeInter { if (!boundary.Item1.InRange(boundingBox3D_Segment3D)) continue; - + PlanarIntersectionResult planarIntersectionResult = null; if (includeInternalEdges) @@ -378,7 +381,7 @@ public List> Boundaries { get { - return boundaries?.ConvertAll(x => new Tuple(new BoundingBox3D( x.Item1), new Face3D(x.Item2))); + return boundaries?.ConvertAll(x => new Tuple(new BoundingBox3D(x.Item1), new Face3D(x.Item2))); } } @@ -523,7 +526,7 @@ public Point3D InternalPoint3D(double silverSpacing = Core.Tolerance.MacroDistan return result; } - for(int i=0; i < point3Ds.Count - 1; i++) + for (int i = 0; i < point3Ds.Count - 1; i++) { for (int j = i + 1; j < point3Ds.Count; j++) { @@ -568,7 +571,7 @@ public void OrientNormals(bool flipX = false, double silverSpacing = Core.Tolera return; boundaries = new List>(); - foreach(KeyValuePair keyValuePair in dictionary) + foreach (KeyValuePair keyValuePair in dictionary) { Face3D face3D = keyValuePair.Key; @@ -576,7 +579,7 @@ public void OrientNormals(bool flipX = false, double silverSpacing = Core.Tolera if (normal_External != null) { Vector3D normal_Face3D = face3D.GetPlane()?.Normal; - if(normal_Face3D != null && !normal_External.SameHalf(normal_Face3D)) + if (normal_Face3D != null && !normal_External.SameHalf(normal_Face3D)) face3D.FlipNormal(flipX); } @@ -599,7 +602,7 @@ public bool SplitCoplanarFace3Ds(Face3D face3D, double tolerance_Angle = Core.To Plane plane = face3D.GetPlane(); Dictionary> dictionary = new Dictionary>(); - for(int i= boundaries.Count - 1; i >= 0; i--) + for (int i = boundaries.Count - 1; i >= 0; i--) { if (!boundaries[i].Item1.InRange(boundingBox3D)) continue; @@ -633,7 +636,7 @@ public bool SplitCoplanarFace3Ds(Face3D face3D, double tolerance_Angle = Core.To face2Ds_Difference?.RemoveAll(x => x == null || x.GetArea() <= tolerance_Distance); if (face2Ds_Difference != null && face2Ds_Difference.Count != 0) { - foreach(Face2D face2D_Difference in face2Ds_Difference) + foreach (Face2D face2D_Difference in face2Ds_Difference) { List face2Ds_Difference_Temp = face2D_Difference.FixEdges(tolerance_Distance); if (face2Ds_Difference_Temp == null || face2Ds_Difference_Temp.Count == 0) @@ -651,12 +654,12 @@ public bool SplitCoplanarFace3Ds(Face3D face3D, double tolerance_Angle = Core.To dictionary[i] = face2Ds.ConvertAll(x => plane_Boundary.Convert(x)); } - if(dictionary == null || dictionary.Count == 0) + if (dictionary == null || dictionary.Count == 0) { return false; } - foreach(KeyValuePair> keyValuePair in dictionary) + foreach (KeyValuePair> keyValuePair in dictionary) { //Tuple tuple = boundaries[keyValuePair.Key]; boundaries.RemoveAt(keyValuePair.Key); @@ -696,7 +699,7 @@ public bool SplitCoplanarFace3Ds(Shell shell, double tolerance_Angle = Core.Tole bool result = false; foreach (Tuple boundary_Temp in boundaries_Temp) { - if(!boundingBox3D.InRange(boundary_Temp.Item1, tolerance_Distance)) + if (!boundingBox3D.InRange(boundary_Temp.Item1, tolerance_Distance)) { continue; } @@ -712,20 +715,20 @@ public bool SplitCoplanarFace3Ds(Shell shell, double tolerance_Angle = Core.Tole public bool SplitCoplanarFace3Ds(IEnumerable face3Ds, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { - if(face3Ds == null) + if (face3Ds == null) { return false; } - if(boundingBox3D == null) + if (boundingBox3D == null) { return false; } bool result = true; - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { - if(SplitCoplanarFace3Ds(face3D, tolerance_Angle, tolerance_Distance)) + if (SplitCoplanarFace3Ds(face3D, tolerance_Angle, tolerance_Distance)) { result = true; } @@ -758,7 +761,7 @@ public bool FillFace3Ds(IEnumerable face3Ds, double offset = 0.1, double tuples.Add(new Tuple(boundingBox3D, face3D)); } - if(tuples == null || tuples.Count == 0) + if (tuples == null || tuples.Count == 0) { return false; } @@ -770,15 +773,15 @@ public bool FillFace3Ds(IEnumerable face3Ds, double offset = 0.1, double Plane plane = boundaries[i].Item2?.GetPlane(); Vector3D vector3D = plane?.Normal; - if(vector3D == null || !vector3D.IsValid()) + if (vector3D == null || !vector3D.IsValid()) { continue; } List face3Ds_Fill = new List(); - foreach(Tuple tuple in tuples) + foreach (Tuple tuple in tuples) { - if(!tuple.Item1.InRange(boundingBox3D, maxDistance)) + if (!tuple.Item1.InRange(boundingBox3D, maxDistance)) { continue; } @@ -795,12 +798,12 @@ public bool FillFace3Ds(IEnumerable face3Ds, double offset = 0.1, double } Face3D face3D_Project = plane.Project(tuple.Item2); - if(face3D_Project == null || !face3D_Project.IsValid()) + if (face3D_Project == null || !face3D_Project.IsValid()) { continue; } - if(face3D_Project.GetArea() < tolerance_Distance) + if (face3D_Project.GetArea() < tolerance_Distance) { continue; } @@ -808,7 +811,7 @@ public bool FillFace3Ds(IEnumerable face3Ds, double offset = 0.1, double face3Ds_Fill.Add(face3D_Project); } - if(face3Ds_Fill == null || face3Ds_Fill.Count < 2) + if (face3Ds_Fill == null || face3Ds_Fill.Count < 2) { continue; } @@ -820,9 +823,9 @@ public bool FillFace3Ds(IEnumerable face3Ds, double offset = 0.1, double } boundaries.RemoveAt(i); - foreach(Face3D face3D_Fill in face3Ds_Fill) + foreach (Face3D face3D_Fill in face3Ds_Fill) { - if(Add(face3D_Fill)) + if (Add(face3D_Fill)) { result = true; } @@ -831,18 +834,18 @@ public bool FillFace3Ds(IEnumerable face3Ds, double offset = 0.1, double return result; } - + public bool SplitFace3Ds(Shell shell, double tolerance_Snap = Core.Tolerance.MacroDistance, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { - if(shell == null || !boundingBox3D.InRange(shell.boundingBox3D, tolerance_Distance)) + if (shell == null || !boundingBox3D.InRange(shell.boundingBox3D, tolerance_Distance)) { return false; } List>> tuples = new List>>(); - foreach(Tuple boundary in boundaries) + foreach (Tuple boundary in boundaries) { - if(!shell.boundingBox3D.InRange(boundary.Item1, tolerance_Distance)) + if (!shell.boundingBox3D.InRange(boundary.Item1, tolerance_Distance)) { continue; } @@ -856,21 +859,21 @@ public bool SplitFace3Ds(Shell shell, double tolerance_Snap = Core.Tolerance.Mac tuples.Add(new Tuple>(boundary.Item2, face3Ds)); } - if(tuples == null || tuples.Count == 0) + if (tuples == null || tuples.Count == 0) { return false; } - foreach(Tuple> tuple in tuples) + foreach (Tuple> tuple in tuples) { int index = boundaries.FindIndex(x => x.Item2 == tuple.Item1); - if(index == -1) + if (index == -1) { continue; } boundaries.RemoveAt(index); - foreach(Face3D face3D in tuple.Item2) + foreach (Face3D face3D in tuple.Item2) { boundaries.Insert(index, new Tuple(face3D.GetBoundingBox(), face3D)); } @@ -881,11 +884,11 @@ public bool SplitFace3Ds(Shell shell, double tolerance_Snap = Core.Tolerance.Mac public bool SplitEdges(double tolerance = Core.Tolerance.Distance) { - if(boundaries == null || boundaries.Count <= 2) + if (boundaries == null || boundaries.Count <= 2) { return false; } - + for (int i = 0; i < boundaries.Count - 1; i++) { for (int j = i + 1; j < boundaries.Count; j++) @@ -897,7 +900,7 @@ public bool SplitEdges(double tolerance = Core.Tolerance.Distance) Face3D face3D = null; - if(boundaries[i].Item2.TrySplitEdges(boundaries[j].Item2, out face3D, tolerance) && face3D != null) + if (boundaries[i].Item2.TrySplitEdges(boundaries[j].Item2, out face3D, tolerance) && face3D != null) { boundaries[i] = new Tuple(face3D.GetBoundingBox(), face3D); } @@ -914,16 +917,16 @@ public bool SplitEdges(double tolerance = Core.Tolerance.Distance) public List GetEdge3Ds() { - if(boundaries == null) + if (boundaries == null) { return null; } List result = new List(); - foreach(Tuple boundary in boundaries) + foreach (Tuple boundary in boundaries) { List edge3Ds = boundary?.Item2?.GetEdge3Ds(); - if(edge3Ds != null) + if (edge3Ds != null) { result.AddRange(edge3Ds); } @@ -932,4 +935,4 @@ public List GetEdge3Ds() return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/ShellSplitter.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/ShellSplitter.cs index 68f8bdbb9..67cb79dcc 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/ShellSplitter.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/ShellSplitter.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -37,7 +40,7 @@ public static implicit operator ShellData(Shell shell) return new ShellData(shell); } } - + private class Face3DData { private Face3D face3D; @@ -51,14 +54,14 @@ public Face3DData(Face3D face3D) public bool HasOverlay(Segment3DData segment3DData, double tolerance = Core.Tolerance.Distance) { - if(segment3DData == null) + if (segment3DData == null) { return false; } return segment3DDatas?.FindAll(x => x != null && Core.Query.Round(x.Segment3D.GetLength(), tolerance) > tolerance).Find(x => segment3DData.Overlay(x, tolerance)) != null; } - + public List Segment3DDatas { get @@ -190,7 +193,7 @@ public List GetFace3DDatas(IEnumerable face3DDatas, doub public static implicit operator Segment3DData(Segment3D segment3D) { - if(segment3D == null) + if (segment3D == null) { return null; } @@ -203,14 +206,14 @@ public static implicit operator Segment3DData(Segment3D segment3D) public double Tolerance_Distance { get; set; } = Core.Tolerance.Distance; public double Tolerance_Angle { get; set; } = Core.Tolerance.Angle; public double Tolerance_Snap { get; set; } = Core.Tolerance.MacroDistance; - + private List shells; private List face3Ds; public ShellSplitter() { } - + public ShellSplitter(IEnumerable shells, IEnumerable face3Ds) { this.shells = shells?.ToList().FindAll(x => x != null).ConvertAll(x => new Shell(x)); @@ -219,12 +222,12 @@ public ShellSplitter(IEnumerable shells, IEnumerable face3Ds) public bool Add(Shell shell) { - if(shell == null) + if (shell == null) { return false; } - if(shells == null) + if (shells == null) { shells = new List(); } @@ -251,7 +254,7 @@ public bool Add(Face3D face3D) public List Split() { - if(shells == null || face3Ds == null) + if (shells == null || face3Ds == null) { return null; } @@ -259,7 +262,7 @@ public List Split() //List face3D_Temp = Query.Union(face3Ds, Tolerance_Snap); List face3Ds_Cut = Query.Cut(face3Ds); - if(face3Ds_Cut == null) + if (face3Ds_Cut == null) { return null; } @@ -267,14 +270,14 @@ public List Split() face3Ds_Cut.Sort((x, y) => y.GetArea().CompareTo(x.GetArea())); List face3Ds_Temp = new List(); - while(face3Ds_Cut.Count != 0) + while (face3Ds_Cut.Count != 0) { Face3D face3D = face3Ds_Cut[0]; face3Ds_Cut.Remove(face3D); face3Ds_Temp.Add(face3D); Point3D point3D = face3D.GetInternalPoint3D(Tolerance_Distance); - if(point3D == null) + if (point3D == null) { continue; } @@ -284,7 +287,7 @@ public List Split() face3Ds_Temp.Reverse(); - for(int i=0; i < face3Ds_Temp.Count; i++) + for (int i = 0; i < face3Ds_Temp.Count; i++) { Face3D face3D = face3Ds_Temp[i]; @@ -303,7 +306,7 @@ public List Split() List> shells_Result = Enumerable.Repeat>(null, shells.Count).ToList(); - Parallel.For(0, shells.Count, (int i) => + Parallel.For(0, shells.Count, (int i) => { Shell shell = shells[i]; @@ -311,9 +314,9 @@ public List Split() }); List result = new List(); - foreach(List shells_Temp in shells_Result) + foreach (List shells_Temp in shells_Result) { - if(shells_Temp == null) + if (shells_Temp == null) { continue; } @@ -326,14 +329,14 @@ public List Split() private List Split(Shell shell, IEnumerable face3DDatas) { - if(shell == null || face3DDatas == null) + if (shell == null || face3DDatas == null) { return null; } - if(!shell.IsValid()) + if (!shell.IsValid()) { - return new List() { new Shell(shell)}; + return new List() { new Shell(shell) }; } double snapFactor = 10; @@ -344,21 +347,21 @@ private List Split(Shell shell, IEnumerable face3DDatas) List face3DDatas_Before = new List(face3DDatas); List face3Ds_Shell_Before = shell_Temp.Face3Ds; - if(face3Ds_Shell_Before == null || face3Ds_Shell_Before.Count == 0) + if (face3Ds_Shell_Before == null || face3Ds_Shell_Before.Count == 0) { return null; } List face3Ds = face3DDatas_Before.ConvertAll(x => x.Face3D); - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return new List() { new Shell(shell_Temp) }; } - for(int i=0; i < face3Ds.Count; i++) + for (int i = 0; i < face3Ds.Count; i++) { Face3D face3D = face3Ds[i].Snap(new Shell[] { shell }, Tolerance_Snap * snapFactor, Tolerance_Distance); - if(face3D != null) + if (face3D != null) { face3Ds[i] = face3D; } @@ -409,7 +412,7 @@ private List Split(Shell shell, IEnumerable face3DDatas) } } - for(int i = face3Ds_After.Count - 1; i >= 0; i--) + for (int i = face3Ds_After.Count - 1; i >= 0; i--) { Point3D centroid = face3Ds_After[i].GetInternalPoint3D(); @@ -427,13 +430,13 @@ private List Split(Shell shell, IEnumerable face3DDatas) List face3DDatas_Shell_After = shellData_After.Face3DDatas; List result = new List(); - while(face3DDatas_Shell_After.Count > 0) + while (face3DDatas_Shell_After.Count > 0) { Face3DData face3DData = face3DDatas_Shell_After[0]; face3DDatas_Shell_After.RemoveAt(0); List face3DDatas_Temp = GetFace3DDatas(face3DData, face3DDatas_Shell_After, segment3DDatas_After, Tolerance_Snap); - if(face3DDatas_Temp == null || face3DDatas_Temp.Count == 0) + if (face3DDatas_Temp == null || face3DDatas_Temp.Count == 0) { continue; } @@ -441,7 +444,7 @@ private List Split(Shell shell, IEnumerable face3DDatas) face3DDatas_Temp.Add(face3DData); List face3Ds_Temp = face3DDatas_Temp.ConvertAll(x => x.Face3D); - if(face3Ds_After != null) + if (face3Ds_After != null) { face3Ds_Temp.AddRange(face3Ds_After); } @@ -470,12 +473,12 @@ private List Split(Shell shell, IEnumerable face3DDatas) Shell shell_New = new Shell(face3Ds_Temp); shell_New = shell_New.RemoveInvalidFace3Ds(Tolerance_Snap); - if(shell_New == null || !shell_New.IsValid()) + if (shell_New == null || !shell_New.IsValid()) { continue; } - if(!shell_New.IsClosed(Tolerance_Snap)) + if (!shell_New.IsClosed(Tolerance_Snap)) { continue; } @@ -483,13 +486,13 @@ private List Split(Shell shell, IEnumerable face3DDatas) result.Add(shell_New); } - if(result == null || result.Count == 0) + if (result == null || result.Count == 0) { return new List() { shell }; } double volume_Before = Core.Query.Round(shell_Temp.Volume(Tolerance_Snap, Tolerance_Distance)); - if(volume_Before < Tolerance_Snap) + if (volume_Before < Tolerance_Snap) { return result; } @@ -507,14 +510,14 @@ private List Split(Shell shell, IEnumerable face3DDatas) } List shells_Difference = shell_Temp.Difference(result); - if(shells_Difference == null || shells_Difference.Count == 0) + if (shells_Difference == null || shells_Difference.Count == 0) { return result; } - foreach(Shell shell_Difference in shells_Difference) + foreach (Shell shell_Difference in shells_Difference) { - if(shell_Difference == null || !shell_Difference.IsValid()) + if (shell_Difference == null || !shell_Difference.IsValid()) { continue; } @@ -526,7 +529,7 @@ private List Split(Shell shell, IEnumerable face3DDatas) } List shells_Split = Split(shell_Difference, face3DDatas); - if(shells_Split == null || shells_Split.Count == 0) + if (shells_Split == null || shells_Split.Count == 0) { continue; } @@ -539,12 +542,12 @@ private List Split(Shell shell, IEnumerable face3DDatas) private static List GetFace3DDatas(Face3DData face3DData, List face3DDatas, List segment3DDatas_ToBeExcluded, double tolerance = Core.Tolerance.Distance) { - if(face3DData == null || face3DDatas == null) + if (face3DData == null || face3DDatas == null) { return null; } - if(face3DDatas.Contains(face3DData)) + if (face3DDatas.Contains(face3DData)) { face3DDatas.Remove(face3DData); } @@ -552,25 +555,25 @@ private static List GetFace3DDatas(Face3DData face3DData, List result = new List(); List segment3DDatas = face3DData.Segment3DDatas; - if(segment3DDatas == null) + if (segment3DDatas == null) { return result; } - foreach(Segment3DData segment3DData in segment3DDatas) + foreach (Segment3DData segment3DData in segment3DDatas) { - if(segment3DDatas_ToBeExcluded != null && segment3DDatas_ToBeExcluded.Find(x => segment3DData.Overlay(x, tolerance)) != null) + if (segment3DDatas_ToBeExcluded != null && segment3DDatas_ToBeExcluded.Find(x => segment3DData.Overlay(x, tolerance)) != null) { continue; } List face3DDatas_Adjacent = segment3DData.GetFace3DDatas(face3DDatas, tolerance); - if(face3DDatas_Adjacent == null || face3DDatas_Adjacent.Count == 0) + if (face3DDatas_Adjacent == null || face3DDatas_Adjacent.Count == 0) { continue; } - foreach(Face3DData face3DData_Adjacent in face3DDatas_Adjacent) + foreach (Face3DData face3DData_Adjacent in face3DDatas_Adjacent) { if (!result.Contains(face3DData_Adjacent)) { @@ -583,7 +586,7 @@ private static List GetFace3DDatas(Face3DData face3DData, List face3DDatas_Temp = GetFace3DDatas(face3DData_Adjacent, face3DDatas, segment3DDatas_ToBeExcluded, tolerance); if (face3DDatas_Temp == null || face3DDatas_Temp.Count == 0) @@ -611,7 +614,7 @@ private static List GetFace3DDatas(Face3DData face3DData, List GetSegment3DDatas(IEnumerable face3DDatas, double tolerance = Core.Tolerance.Distance) { - if(face3DDatas == null) + if (face3DDatas == null) { return null; } diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Sphere.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Sphere.cs index 9dd0b2249..ffef44360 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Sphere.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Sphere.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; @@ -115,4 +118,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Surface.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Surface.cs index 4bc0e564a..f15bcad57 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Surface.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Surface.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; @@ -91,4 +94,4 @@ public ISAMGeometry3D GetTransformed(Transform3D transform3D) throw new NotImplementedException(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Transform3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Transform3D.cs index 9f8181258..1cfbf0425 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Transform3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Transform3D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Math; using System.Collections.Generic; @@ -208,7 +211,7 @@ public static Transform3D GetOriginToPlane(Plane plane) public static Transform3D GetCoordinateSystem3DToOrigin(CoordinateSystem3D coordinateSystem3D) { - if(coordinateSystem3D == null) + if (coordinateSystem3D == null) { return null; } @@ -225,7 +228,7 @@ public static Transform3D GetOriginToCoordinateSystem3D(CoordinateSystem3D coord public static Transform3D GetPlaneToOrigin(Point3D origin, Vector3D axisX, Vector3D axisY, Vector3D axisZ) { - if(origin == null || axisX == null || axisY == null || axisZ == null) + if (origin == null || axisX == null || axisY == null || axisZ == null) { return null; } @@ -395,4 +398,4 @@ public static Transform3D GetRotation(Point3D origin, Vector3D axis, double angl return new Transform3D(transform3D_1.matrix4D * transform3D_2.matrix4D); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Triangle3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Triangle3D.cs index 84929d447..4a155a22b 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Triangle3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Triangle3D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; @@ -110,7 +113,7 @@ public ISAMGeometry3D GetMoved(Vector3D vector3D) public double GetArea() { - if(points == null) + if (points == null) { return double.NaN; } @@ -147,13 +150,13 @@ public Point3D this[int index] public override bool FromJObject(JObject jObject) { - if(jObject == null) + if (jObject == null) { return false; } points = Geometry.Create.ISAMGeometries(jObject.Value("Points"))?.ToArray(); - + return true; } @@ -163,7 +166,7 @@ public override JObject ToJObject() if (jObject == null) return null; - if(points != null && points.Length == 3) + if (points != null && points.Length == 3) { jObject.Add("Points", Geometry.Create.JArray(points)); } @@ -189,7 +192,7 @@ public ISAMGeometry3D GetTransformed(Transform3D transform3D) public double GetLength() { List segment3Ds = GetSegments(); - if(segment3Ds == null) + if (segment3Ds == null) { return double.NaN; } @@ -201,7 +204,7 @@ public double GetLength() public override bool Equals(object obj) { Triangle3D triangle3D = obj as Triangle3D; - if(triangle3D == null) + if (triangle3D == null) { return false; } @@ -211,7 +214,7 @@ public override bool Equals(object obj) public override int GetHashCode() { - if(points == null || points.Length != 3) + if (points == null || points.Length != 3) { return -1; } @@ -273,4 +276,4 @@ public override int GetHashCode() return false; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Vector3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Vector3D.cs index 5236780be..5a024dcfc 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Classes/Vector3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Classes/Vector3D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; using System.Linq; @@ -91,7 +94,7 @@ public Vector3D GetNormalized() public bool Collinear(Vector3D vector3D, double tolerance = Core.Tolerance.Distance) { - if(vector3D == null) + if (vector3D == null) return false; return System.Math.Abs(System.Math.Abs(this * vector3D) - (Length * vector3D.Length)) <= tolerance; @@ -399,7 +402,7 @@ public static implicit operator Point3D(Vector3D vector3D) } public static Vector3D WorldX - { + { get { return new Vector3D(1, 0, 0); @@ -415,7 +418,7 @@ public static Vector3D WorldY } public static Vector3D WorldZ - { + { get { return new Vector3D(0, 0, 1); @@ -487,4 +490,4 @@ public static Vector3D WorldZ return vector3D_1?.coordinates[0] != vector3D_2?.coordinates[0] || vector3D_1?.coordinates[1] != vector3D_2?.coordinates[1] || vector3D_1?.coordinates[2] != vector3D_2?.coordinates[2]; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Convert/ToSAM/Face3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Convert/ToSAM/Face3D.cs index 45433e83d..29bf9aea2 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Convert/ToSAM/Face3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Convert/ToSAM/Face3D.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; using SAM.Geometry.Planar; namespace SAM.Geometry.Spatial @@ -13,4 +16,4 @@ public static Face3D ToSAM(this Polygon polygon, Plane plane, double tolerance = return new Face3D(plane, polygon.ToSAM(tolerance)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Convert/ToSAM/Shell.cs b/SAM/SAM.Geometry/Geometry/Spatial/Convert/ToSAM/Shell.cs index 3c0bbd6dc..7cfd6f77c 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Convert/ToSAM/Shell.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Convert/ToSAM/Shell.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -6,8 +9,8 @@ public static partial class Convert { public static Shell ToSAM_Shell(this Mesh3D mesh3D) { - List triangles = mesh3D?.GetTriangles(); - if(triangles == null || triangles.Count == 0) + List triangles = mesh3D?.GetTriangles(); + if (triangles == null || triangles.Count == 0) { return null; } @@ -15,4 +18,4 @@ public static Shell ToSAM_Shell(this Mesh3D mesh3D) return new Shell(triangles.ConvertAll(x => new Face3D(x))); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Create/Face3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Create/Face3D.cs index aa2ac73d8..2d2706a8d 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Create/Face3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Create/Face3D.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Create { @@ -41,7 +44,7 @@ public static Face3D Face3D(this IClosedPlanar3D closedPlanar3D) return null; } - if(closedPlanar3D is Face3D) + if (closedPlanar3D is Face3D) { return new Face3D((Face3D)closedPlanar3D); } @@ -59,4 +62,4 @@ public static Face3D Face3D(this Plane plane, Planar.IClosed2D closed2D) return new Face3D(plane, closed2D); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Create/Face3Ds.cs b/SAM/SAM.Geometry/Geometry/Spatial/Create/Face3Ds.cs index 859cf0bdb..aa1328460 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Create/Face3Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Create/Face3Ds.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Spatial @@ -14,7 +17,7 @@ public static List Face3Ds(this IEnumerable edges, Pla if (face2Ds == null) return null; - if(edgeOrientationMethod != EdgeOrientationMethod.Undefined) + if (edgeOrientationMethod != EdgeOrientationMethod.Undefined) { face2Ds = face2Ds.ConvertAll(x => Planar.Create.Face2D(x.ExternalEdge2D, x.InternalEdge2Ds, edgeOrientationMethod)); } @@ -85,4 +88,4 @@ public static List Face3Ds(this IEnumerable polygon3Ds, EdgeO return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Create/IClosedPlanar3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Create/IClosedPlanar3D.cs index 62f7edf36..29987b87d 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Create/IClosedPlanar3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Create/IClosedPlanar3D.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Create { @@ -23,4 +26,4 @@ public static IClosedPlanar3D IClosedPlanar3D(this IClosedPlanar3D closedPlanar3 } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Create/ICurve3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Create/ICurve3D.cs index 253442723..cbc94e97d 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Create/ICurve3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Create/ICurve3D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Geometry.Spatial { @@ -9,4 +12,4 @@ public static ICurve3D ICurve3D(this JObject jObject) return Geometry.Create.ISAMGeometry(jObject) as ICurve3D; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Create/ICurve3Ds.cs b/SAM/SAM.Geometry/Geometry/Spatial/Create/ICurve3Ds.cs index 7c8bfc69b..ff8303f30 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Create/ICurve3Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Create/ICurve3Ds.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; namespace SAM.Geometry.Spatial @@ -18,4 +21,4 @@ public static List ICurve3Ds(this JArray jArray) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Create/Matrix.cs b/SAM/SAM.Geometry/Geometry/Spatial/Create/Matrix.cs index 6ac05b127..0827432ed 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Create/Matrix.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Create/Matrix.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Spatial @@ -43,4 +46,4 @@ public static Math.Matrix Matrix(this IEnumerable point3Ds) return matrix; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Create/Matrix3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Create/Matrix3D.cs index 790ab5a28..da9dca0dd 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Create/Matrix3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Create/Matrix3D.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Create { @@ -32,4 +35,4 @@ public static Math.Matrix3D Matrix3D(this Vector3D vector3D) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Create/Mesh3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Create/Mesh3D.cs index 141c376c1..bd4fe3a6e 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Create/Mesh3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Create/Mesh3D.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using System; using System.Collections.Generic; using System.Linq; @@ -9,13 +12,13 @@ public static partial class Create { public static Mesh3D Mesh3D(this IEnumerable point3Ds, IEnumerable indexes) { - if(point3Ds == null || indexes == null) + if (point3Ds == null || indexes == null) { return null; } int count = point3Ds.Count(); - if(count < 3) + if (count < 3) { return null; } @@ -23,10 +26,10 @@ public static Mesh3D Mesh3D(this IEnumerable point3Ds, IEnumerable List> tuples = new List>(); List indexes_Temp = indexes.ToList(); - for(int i =0; i < indexes_Temp.Count; i = i + 3) + for (int i = 0; i < indexes_Temp.Count; i = i + 3) { int index_1 = indexes_Temp[i]; - if(index_1 < 0 || index_1 >= count) + if (index_1 < 0 || index_1 >= count) { return null; } @@ -51,7 +54,7 @@ public static Mesh3D Mesh3D(this IEnumerable point3Ds, IEnumerable public static Mesh3D Mesh3D(this IEnumerable triangle3Ds, double tolerance = Core.Tolerance.Distance) { - if(triangle3Ds == null || triangle3Ds.Count() == 0) + if (triangle3Ds == null || triangle3Ds.Count() == 0) { return null; } @@ -62,7 +65,7 @@ public static Mesh3D Mesh3D(this IEnumerable triangle3Ds, double tol foreach (Triangle3D triangle3D in triangle3Ds) { - if(triangle3D == null || !triangle3D.IsValid() ||triangle3D.GetArea() < tolerance) + if (triangle3D == null || !triangle3D.IsValid() || triangle3D.GetArea() < tolerance) { continue; } @@ -75,7 +78,7 @@ public static Mesh3D Mesh3D(this IEnumerable triangle3Ds, double tol int index_1 = -1; index_1 = point3Ds.FindIndex(x => x.AlmostEquals(point3Ds_Triangle[0], tolerance)); - if(index_1 == -1) + if (index_1 == -1) { index_1 = point3Ds.Count; point3Ds.Add(point3Ds_Triangle[0]); @@ -105,27 +108,27 @@ public static Mesh3D Mesh3D(this IEnumerable triangle3Ds, double tol public static Mesh3D Mesh3D(this Mesh2D mesh2D, Plane plane) { - if(mesh2D == null || plane == null) + if (mesh2D == null || plane == null) { return null; } List point2Ds = mesh2D.GetPoints(); - if(point2Ds == null) + if (point2Ds == null) { return null; } List> tuples = new List>(); List triangle2Ds = mesh2D.GetTriangles(); - foreach(Triangle2D triangle2D in triangle2Ds) + foreach (Triangle2D triangle2D in triangle2Ds) { List point2Ds_Triangle = triangle2D.GetPoints(); tuples.Add(new Tuple(mesh2D.IndexOf(point2Ds_Triangle[0]), mesh2D.IndexOf(point2Ds_Triangle[1]), mesh2D.IndexOf(point2Ds_Triangle[2]))); } List point3Ds = new List(); - foreach(Point2D point2D in point2Ds) + foreach (Point2D point2D in point2Ds) { point3Ds.Add(plane.Convert(point2D)); } @@ -136,7 +139,7 @@ public static Mesh3D Mesh3D(this Mesh2D mesh2D, Plane plane) public static Mesh3D Mesh3D(this Extrusion extrusion, double tolerance = Core.Tolerance.Distance) { Shell shell = Shell(extrusion, tolerance); - if(shell == null) + if (shell == null) { return null; } @@ -147,25 +150,25 @@ public static Mesh3D Mesh3D(this Extrusion extrusion, double tolerance = Core.To public static Mesh3D Mesh3D(this Shell shell, double tolerance = Core.Tolerance.Distance) { List face3Ds = shell?.Face3Ds; - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return null; } List triangle3Ds = new List(); - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { List triangle3Ds_Face3D = Query.Triangulate(face3D, tolerance); - if(triangle3Ds_Face3D == null || triangle3Ds_Face3D.Count == 0) + if (triangle3Ds_Face3D == null || triangle3Ds_Face3D.Count == 0) { continue; } Vector3D normal = face3D.GetPlane().Normal; - foreach(Triangle3D triangle3D in triangle3Ds_Face3D) + foreach (Triangle3D triangle3D in triangle3Ds_Face3D) { - if(!triangle3D.GetNormal().SameHalf(normal)) + if (!triangle3D.GetNormal().SameHalf(normal)) { triangle3D.Reverse(); } @@ -202,17 +205,17 @@ public static Mesh3D Mesh3D(this Polygon3D polygon3D, double tolerance = Core.To public static Mesh3D Mesh3D(this Sphere sphere, double factor, int minDensity = 2, int maxDensity = 10) { int denisty = System.Convert.ToInt32(System.Math.Ceiling(sphere.Radius / factor)); - if(denisty < minDensity) + if (denisty < minDensity) { denisty = minDensity; } - else if(denisty > maxDensity) + else if (denisty > maxDensity) { denisty = maxDensity; } List trinagle3Ds = sphere.Triangulate(denisty); - if(trinagle3Ds == null) + if (trinagle3Ds == null) { return null; } @@ -241,4 +244,4 @@ public static Mesh3D Mesh3D(this Circle3D circle3D, double factor, int minDensit return new Mesh3D(trinagle3Ds); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Create/PlanarIntersectionResult.cs b/SAM/SAM.Geometry/Geometry/Spatial/Create/PlanarIntersectionResult.cs index 0397f7d22..577703428 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Create/PlanarIntersectionResult.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Create/PlanarIntersectionResult.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using System; using System.Collections.Generic; using System.Linq; @@ -115,13 +118,13 @@ public static PlanarIntersectionResult PlanarIntersectionResult(Face3D face3D, I } Plane plane = face3D.GetPlane(); - if(plane == null) + if (plane == null) { return null; } List segment3Ds = segmentable3D.GetSegments(); - if(segment3Ds == null) + if (segment3Ds == null) { return null; } @@ -135,13 +138,13 @@ public static PlanarIntersectionResult PlanarIntersectionResult(Face3D face3D, I foreach (Segment3D segment3D in segment3Ds) { PlanarIntersectionResult planarIntersectionResult_Segment3D = PlanarIntersectionResult(face3D, segment3D, tolerance); - if(planarIntersectionResult_Segment3D == null || !planarIntersectionResult_Segment3D.Intersecting) + if (planarIntersectionResult_Segment3D == null || !planarIntersectionResult_Segment3D.Intersecting) { continue; } List geometry3Ds_Segment3D = planarIntersectionResult_Segment3D.Geometry3Ds; - if(geometry3Ds_Segment3D != null && geometry3Ds_Segment3D.Count != 0) + if (geometry3Ds_Segment3D != null && geometry3Ds_Segment3D.Count != 0) { geometry3Ds.AddRange(geometry3Ds_Segment3D); } @@ -259,10 +262,10 @@ public static PlanarIntersectionResult PlanarIntersectionResult(Plane plane, ICl List segment3Ds_Segmentable3D = segmentable3D.GetSegments(); List> tuples = new List>(); - foreach(Segment3D segment3D_Temp in segment3Ds_Segmentable3D) + foreach (Segment3D segment3D_Temp in segment3Ds_Segmentable3D) { PlanarIntersectionResult planarIntersectionResult_Temp = PlanarIntersectionResult(plane, segment3D_Temp, tolerance_Distance); - if(planarIntersectionResult_Temp == null || !planarIntersectionResult_Temp.Intersecting) + if (planarIntersectionResult_Temp == null || !planarIntersectionResult_Temp.Intersecting) { continue; } @@ -304,7 +307,7 @@ public static PlanarIntersectionResult PlanarIntersectionResult(Plane plane, ICl List point2Ds = point3Ds.ConvertAll(x => plane_ClosedPlanar3D.Convert(x)); Planar.Query.ExtremePoints(point2Ds, out Point2D point2D_1, out Point2D point2D_2); point2Ds.SortByDistance(point2D_1); - + IClosed2D closed2D = plane_ClosedPlanar3D.Convert(closedPlanar3D); ISegmentable2D segmentable2D = closed2D as ISegmentable2D; @@ -465,7 +468,7 @@ public static PlanarIntersectionResult PlanarIntersectionResult(Face3D face3D_1, return null; BoundingBox3D boundingBox3D_1 = face3D_1.GetBoundingBox(tolerance_Distance); - if(boundingBox3D_1 == null) + if (boundingBox3D_1 == null) { return null; } @@ -530,16 +533,16 @@ public static PlanarIntersectionResult PlanarIntersectionResult(Face3D face3D_1, return new PlanarIntersectionResult(plane_1, geometry3Ds); } - + public static PlanarIntersectionResult PlanarIntersectionResult(IClosedPlanar3D closedPlanar3D_1, IClosedPlanar3D closedPlanar3D_2, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { - if(closedPlanar3D_1 == null || closedPlanar3D_2 == null) + if (closedPlanar3D_1 == null || closedPlanar3D_2 == null) { return null; } - + Face3D face3D_1 = null; - if(closedPlanar3D_1 is Face3D) + if (closedPlanar3D_1 is Face3D) { face3D_1 = (Face3D)closedPlanar3D_1; } @@ -563,30 +566,30 @@ public static PlanarIntersectionResult PlanarIntersectionResult(IClosedPlanar3D public static PlanarIntersectionResult PlanarIntersectionResult(Plane plane, Mesh3D mesh3D, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { - if(plane == null || mesh3D == null) + if (plane == null || mesh3D == null) { return null; } BoundingBox3D boundingBox3D = mesh3D.GetBoundingBox(); - if(!plane.Intersect(boundingBox3D, tolerance_Distance)) + if (!plane.Intersect(boundingBox3D, tolerance_Distance)) { return new PlanarIntersectionResult(plane); } List sAMGeometry3Ds = new List(); List triangle3Ds = mesh3D.GetTriangles(); - if(triangle3Ds != null && triangle3Ds.Count != 0) + if (triangle3Ds != null && triangle3Ds.Count != 0) { - foreach(Triangle3D triangle3D in triangle3Ds) + foreach (Triangle3D triangle3D in triangle3Ds) { - if(triangle3D == null) + if (triangle3D == null) { continue; } PlanarIntersectionResult planarIntersectionResult = PlanarIntersectionResult(plane, new Face3D(triangle3D), tolerance_Angle, tolerance_Distance); - if(planarIntersectionResult != null && planarIntersectionResult.Intersecting) + if (planarIntersectionResult != null && planarIntersectionResult.Intersecting) { sAMGeometry3Ds.AddRange(planarIntersectionResult.GetGeometry3Ds()); } @@ -598,36 +601,36 @@ public static PlanarIntersectionResult PlanarIntersectionResult(Plane plane, Mes public static PlanarIntersectionResult PlanarIntersectionResult(Face3D face3D, Shell shell, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { - if(face3D == null || shell == null) + if (face3D == null || shell == null) { return null; } BoundingBox3D boundingBox3D = face3D.GetBoundingBox(); - if(boundingBox3D == null) + if (boundingBox3D == null) { return null; } BoundingBox3D boundingBox3D_Shell = shell.GetBoundingBox(); - if(boundingBox3D_Shell == null) + if (boundingBox3D_Shell == null) { return null; } Plane plane = face3D.GetPlane(); - if(plane == null) + if (plane == null) { return null; } - if(!boundingBox3D.InRange(boundingBox3D_Shell, tolerance_Distance)) + if (!boundingBox3D.InRange(boundingBox3D_Shell, tolerance_Distance)) { return new PlanarIntersectionResult(plane); } List face3Ds = shell.Face3Ds; - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return new PlanarIntersectionResult(plane); } @@ -635,8 +638,8 @@ public static PlanarIntersectionResult PlanarIntersectionResult(Face3D face3D, S List geometry3Ds = new List(); foreach (Face3D face3D_Shell in face3Ds) { - PlanarIntersectionResult planarIntersectionResult = PlanarIntersectionResult(face3D, face3D_Shell,tolerance_Angle, tolerance_Distance); - if(planarIntersectionResult == null || !planarIntersectionResult.Intersecting) + PlanarIntersectionResult planarIntersectionResult = PlanarIntersectionResult(face3D, face3D_Shell, tolerance_Angle, tolerance_Distance); + if (planarIntersectionResult == null || !planarIntersectionResult.Intersecting) { continue; } @@ -677,13 +680,13 @@ public static PlanarIntersectionResult PlanarIntersectionResult(Plane plane, She public static PlanarIntersectionResult PlanarIntersectionResult(Face3D face3D, IEnumerable face3Ds, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { - if(face3Ds == null) + if (face3Ds == null) { return null; } Plane plane = face3D.GetPlane(); - if(plane == null) + if (plane == null) { return null; } @@ -706,7 +709,7 @@ public static PlanarIntersectionResult PlanarIntersectionResult(Face3D face3D, I public static PlanarIntersectionResult PlanarIntersectionResult(Face3D face3D, Plane plane, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { PlanarIntersectionResult planarIntersectionResult = PlanarIntersectionResult(plane, face3D, tolerance_Angle, tolerance_Distance); - if(planarIntersectionResult == null || !planarIntersectionResult.Intersecting) + if (planarIntersectionResult == null || !planarIntersectionResult.Intersecting) { return planarIntersectionResult; } @@ -714,4 +717,4 @@ public static PlanarIntersectionResult PlanarIntersectionResult(Face3D face3D, P return new PlanarIntersectionResult(face3D.GetPlane(), planarIntersectionResult.GetGeometry3Ds()); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Create/Plane.cs b/SAM/SAM.Geometry/Geometry/Spatial/Create/Plane.cs index 8a96dd0dc..a17282a3a 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Create/Plane.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Create/Plane.cs @@ -1,18 +1,21 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { public static partial class Create { - + public static Plane Plane(this Point3D point3D_1, Point3D point3D_2, Point3D point3D_3) { if (point3D_1 == null || point3D_2 == null || point3D_3 == null) { return null; } - - + + Vector3D normal = Query.Normal(point3D_1, point3D_2, point3D_3); if (normal == null || !normal.IsValid()) { @@ -21,7 +24,7 @@ public static Plane Plane(this Point3D point3D_1, Point3D point3D_2, Point3D poi return new Plane((new Point3D[] { point3D_1, point3D_2, point3D_3 }).Average(), normal); } - + public static Plane Plane(this IEnumerable point3Ds, double tolerance = Core.Tolerance.Distance) { Vector3D normal = Query.Normal(point3Ds, tolerance); @@ -46,7 +49,7 @@ public static Plane Plane(double elevation) public static Plane Plane(double value, int dimensionIndex) { - switch(dimensionIndex) + switch (dimensionIndex) { case 0: return Spatial.Plane.WorldYZ.GetMoved(new Vector3D(value, 0, 0)) as Plane; @@ -59,4 +62,4 @@ public static Plane Plane(double value, int dimensionIndex) return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Create/Point3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Create/Point3D.cs index 8fa4c71e4..339af8904 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Create/Point3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Create/Point3D.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Create { @@ -18,4 +21,4 @@ public static Point3D Point3D(double x, double y, double z) return new Point3D(x, y, z); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Create/Point3Ds.cs b/SAM/SAM.Geometry/Geometry/Spatial/Create/Point3Ds.cs index d89a888c6..eeb0670f5 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Create/Point3Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Create/Point3Ds.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; using System.Linq; @@ -62,4 +65,4 @@ public static List Point3Ds(this IEnumerable segment3Ds, boo return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Create/Polygon3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Create/Polygon3D.cs index 55ac1d936..19a08576a 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Create/Polygon3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Create/Polygon3D.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using System.Collections.Generic; using System.Linq; @@ -58,18 +61,18 @@ public static Polygon3D Polygon3D(this Segment3D segment3D, double height, doubl public static Polygon3D Polygon3D(this Segment3D segment3D, Vector3D vector3D, double tolerance = Core.Tolerance.Distance) { - if(segment3D == null || !segment3D.IsValid() || vector3D == null || !vector3D.IsValid()) + if (segment3D == null || !segment3D.IsValid() || vector3D == null || !vector3D.IsValid()) { return null; } double length = vector3D.Length; - if(double.IsNaN(length) || length < tolerance) + if (double.IsNaN(length) || length < tolerance) { return null; } - if(segment3D.Direction.AlmostSimilar(vector3D.Unit, tolerance)) + if (segment3D.Direction.AlmostSimilar(vector3D.Unit, tolerance)) { return null; } @@ -79,7 +82,7 @@ public static Polygon3D Polygon3D(this Segment3D segment3D, Vector3D vector3D, d Point3D point3D_3 = segment3D[1].GetMoved(vector3D) as Point3D; Plane plane = Plane(point3D_1, point3D_2, point3D_3); - if(plane == null || !plane.IsValid()) + if (plane == null || !plane.IsValid()) { return null; } @@ -92,13 +95,13 @@ public static Polygon3D Polygon3D(this Segment3D segment3D, Vector3D vector3D, d public static Polygon3D Polygon3D(this Triangle3D triangle3D) { List point3Ds = triangle3D?.GetPoints(); - if(point3Ds == null || point3Ds.Count < 3) + if (point3Ds == null || point3Ds.Count < 3) { return null; } Plane plane = new Plane(point3Ds[0], point3Ds[1], point3Ds[2]); - if(plane == null || !plane.IsValid()) + if (plane == null || !plane.IsValid()) { return null; } @@ -106,4 +109,4 @@ public static Polygon3D Polygon3D(this Triangle3D triangle3D) return new Polygon3D(plane, point3Ds.ConvertAll(x => plane.Convert(x))); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Create/Polygon3Ds.cs b/SAM/SAM.Geometry/Geometry/Spatial/Create/Polygon3Ds.cs index 43c425cdc..fd365da11 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Create/Polygon3Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Create/Polygon3Ds.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using System.Collections.Generic; using System.Linq; @@ -34,7 +37,7 @@ public static List Polygon3Ds(this IEnumerable close continue; PlanarIntersectionResult planarIntersectionResult = null; - if(checkIntersection) + if (checkIntersection) { planarIntersectionResult = PlanarIntersectionResult(plane, closedPlanar3D); if (planarIntersectionResult == null || !planarIntersectionResult.Intersecting) @@ -77,7 +80,7 @@ public static List Polygon3Ds(this IEnumerable close if (polygon2Ds == null || polygon2Ds.Count == 0) return null; - if(union) + if (union) { polygon2Ds = polygon2Ds.Union(tolerance); } @@ -105,4 +108,4 @@ public static List Polygon3Ds(this IEnumerable triangle3D return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Create/Rectangle3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Create/Rectangle3D.cs index 934b75729..3bb45b6b1 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Create/Rectangle3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Create/Rectangle3D.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -10,31 +13,31 @@ public static Rectangle3D Rectangle3D(this IClosedPlanar3D closedPlanar3D, doubl return null; IClosedPlanar3D closedPlanar3D_Temp = closedPlanar3D; - if(closedPlanar3D_Temp is Face3D) + if (closedPlanar3D_Temp is Face3D) { closedPlanar3D_Temp = ((Face3D)closedPlanar3D_Temp).GetExternalEdge3D(); } Plane plane = closedPlanar3D_Temp?.GetPlane(); - if(plane == null) + if (plane == null) { return null; } Planar.ISegmentable2D segmentable2D = plane.Convert(closedPlanar3D_Temp) as Planar.ISegmentable2D; - if(segmentable2D == null) + if (segmentable2D == null) { return null; } List point2Ds = segmentable2D.GetPoints(); - if(point2Ds == null || point2Ds.Count ==0) + if (point2Ds == null || point2Ds.Count == 0) { return null; } Planar.Rectangle2D rectangle2D = Planar.Create.Rectangle2D(segmentable2D.GetPoints()); - if(rectangle2D == null) + if (rectangle2D == null) { return null; } @@ -51,19 +54,19 @@ public static Rectangle3D Rectangle3D(Segment3D segment3D, Vector3D vector3D, do } double length_Segment3D = segment3D.GetLength(); - if(length_Segment3D < tolerance) + if (length_Segment3D < tolerance) { return null; } double length_Vector3D = vector3D.Length; - if(length_Vector3D < tolerance) + if (length_Vector3D < tolerance) { return null; } Plane plane = Plane(segment3D[0], segment3D[1], (Point3D)segment3D[1].GetMoved(vector3D)); - if(plane == null && !plane.IsValid()) + if (plane == null && !plane.IsValid()) { return null; } @@ -75,4 +78,4 @@ public static Rectangle3D Rectangle3D(Segment3D segment3D, Vector3D vector3D, do return new Rectangle3D(plane, rectangle2D); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Create/Segment3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Create/Segment3D.cs index 4f01d7d71..f317cba4e 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Create/Segment3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Create/Segment3D.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Create { @@ -7,4 +10,4 @@ public static Segment3D Segment3D(double x_1, double y_1, double z_1, double x_2 return new Segment3D(new Point3D(x_1, y_1, z_1), new Point3D(x_2, y_2, z_2)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Create/Segment3Ds.cs b/SAM/SAM.Geometry/Geometry/Spatial/Create/Segment3Ds.cs index 6c9e7e6d5..9c8bff89e 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Create/Segment3Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Create/Segment3Ds.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Spatial @@ -25,4 +28,4 @@ public static List Segment3Ds(this IEnumerable point3Ds, boo return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Create/Shell.cs b/SAM/SAM.Geometry/Geometry/Spatial/Create/Shell.cs index 8fb23571e..752174824 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Create/Shell.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Create/Shell.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using System; using System.Collections.Generic; using System.Linq; @@ -13,9 +16,9 @@ public static Shell Shell(this IEnumerable face3Ds, double silverSpacing return null; List face3Ds_Temp = new List(face3Ds); - + List>> tuples = new List>>(); - while(face3Ds_Temp.Count != 0) + while (face3Ds_Temp.Count != 0) { Face3D face3D = face3Ds_Temp[0]; face3Ds_Temp.RemoveAt(0); @@ -26,7 +29,7 @@ public static Shell Shell(this IEnumerable face3Ds, double silverSpacing List face3Ds_Plane = face3Ds_Temp.FindAll(x => x.GetPlane().Coplanar(plane, tolerance)); face3Ds_Plane.RemoveAll(x => plane.Origin.Distance(x.GetPlane().Project(plane.Origin)) > tolerance); - if(face3Ds_Plane.Count > 0) + if (face3Ds_Plane.Count > 0) face3Ds_Temp.RemoveAll(x => face3Ds_Plane.Contains(x)); face3Ds_Plane.Add(face3D); @@ -34,20 +37,20 @@ public static Shell Shell(this IEnumerable face3Ds, double silverSpacing } List face3Ds_Shell = new List(); - foreach(Tuple> tuple in tuples) + foreach (Tuple> tuple in tuples) { List face3Ds_Plane = tuple.Item2; if (face3Ds_Plane == null || face3Ds_Plane.Count == 0) continue; - if(face3Ds_Plane.Count == 1) + if (face3Ds_Plane.Count == 1) { face3Ds_Shell.Add(face3Ds_Plane[0]); continue; } List> tuples_Face2Ds = new List>(); - foreach(Face3D face3D in face3Ds_Plane) + foreach (Face3D face3D in face3Ds_Plane) { Face2D face2D = tuple.Item1.Convert(tuple.Item1.Project(face3D)); if (face2D == null) @@ -60,7 +63,7 @@ public static Shell Shell(this IEnumerable face3Ds, double silverSpacing if (tuples_Face2Ds == null || tuples_Face2Ds.Count == 0) continue; - foreach(Face2D face2D_Temp in face2Ds) + foreach (Face2D face2D_Temp in face2Ds) { Point2D point2D = face2D_Temp.GetInternalPoint2D(); if (point2D == null) @@ -77,18 +80,18 @@ public static Shell Shell(this IEnumerable face3Ds, double silverSpacing } int count = face3Ds_Shell.Count; - if(count < 3) + if (count < 3) { return null; } Shell result = new Shell(face3Ds_Shell); - for(int i = face3Ds_Shell.Count - 1; i >= 0; i--) + for (int i = face3Ds_Shell.Count - 1; i >= 0; i--) { Face3D face3D_Shell = face3Ds_Shell[i]; Point3D point3D = face3D_Shell?.InternalPoint3D(tolerance); - if(point3D == null) + if (point3D == null) { face3Ds_Shell.RemoveAt(i); continue; @@ -106,36 +109,36 @@ public static Shell Shell(this IEnumerable face3Ds, double silverSpacing bool inside_1 = result.Inside((Point3D)point3D.GetMoved(vector3D), silverSpacing, tolerance); bool inside_2 = result.Inside((Point3D)point3D.GetMoved(vector3D.GetNegated()), silverSpacing, tolerance); - if(inside_1 == inside_2) + if (inside_1 == inside_2) { face3Ds_Shell.RemoveAt(i); continue; } } - if(face3Ds_Shell.Count == count) + if (face3Ds_Shell.Count == count) { return result; } - if(face3Ds_Shell.Count < 3) + if (face3Ds_Shell.Count < 3) { return null; } result = new Shell(face3Ds_Shell); - return result; + return result; } public static Shell Shell(this Face3D face3D, Vector3D vector3D, double tolerance = Core.Tolerance.Distance) { - if(face3D == null || !face3D.IsValid() || vector3D == null || !vector3D.IsValid()) + if (face3D == null || !face3D.IsValid() || vector3D == null || !vector3D.IsValid()) { return null; } Plane plane = face3D.GetPlane(); - if(plane.Normal.Perpendicular(vector3D, tolerance)) + if (plane.Normal.Perpendicular(vector3D, tolerance)) { return null; } @@ -173,7 +176,7 @@ public static Shell Shell(this Face3D face3D, Vector3D vector3D, double toleranc public static Shell Shell(this Extrusion extrusion, double tolerance = Core.Tolerance.Distance) { - if(extrusion == null) + if (extrusion == null) { return null; } @@ -181,4 +184,4 @@ public static Shell Shell(this Extrusion extrusion, double tolerance = Core.Tole return Shell(extrusion.Face3D, extrusion.Vector, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Create/Shells.cs b/SAM/SAM.Geometry/Geometry/Spatial/Create/Shells.cs index b153a5462..d4523b29f 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Create/Shells.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Create/Shells.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using System; using System.Collections.Generic; using System.Linq; @@ -771,7 +774,7 @@ public static List Shells_ByTopAndBottom(this IEnumerable face3Ds { continue; } - + double elevation_Min = boundingBox3D.Min.Z; Tuple>> tuple = tuples.Find(x => System.Math.Abs(x.Item1 - elevation_Min) < tolerance); if (tuple == null) @@ -860,7 +863,7 @@ public static List Shells_ByTopAndBottom(this IEnumerable face3Ds List face2Ds_Bottom_Temp = face2Ds_Top_Temp.Union(); List face3Ds_Shell = new List(); - foreach(Face2D face2D_Bottom_Temp in face2Ds_Bottom_Temp) + foreach (Face2D face2D_Bottom_Temp in face2Ds_Bottom_Temp) { Point2D point2D = face2D_Bottom_Temp.GetInternalPoint2D(); if (point2D == null) @@ -872,7 +875,7 @@ public static List Shells_ByTopAndBottom(this IEnumerable face3Ds elevation_Top = face2Ds_Top[index].Item1; double elevation_Bottom = tuple_Bottom.Item1; - + Plane plane_Top = Spatial.Plane.WorldXY.GetMoved(new Vector3D(0, 0, elevation_Top)) as Plane; Plane plane_Bottom = Spatial.Plane.WorldXY.GetMoved(new Vector3D(0, 0, elevation_Bottom)) as Plane; Plane plane_Bottom_Flipped = new Plane(plane_Bottom); @@ -929,7 +932,7 @@ public static List Shells_ByTopAndBottom(this IEnumerable face3Ds face3Ds_Shell.Add(face3D_Bottom); } - if(face3Ds_Shell != null && face3Ds_Shell.Count > 0) + if (face3Ds_Shell != null && face3Ds_Shell.Count > 0) { Shell shell = new Shell(face3Ds_Shell); Shell shell_Merge = shell.Merge(tolerance); @@ -1158,7 +1161,7 @@ public static List Shells_ByOffset(this IEnumerable face3Ds, doub List face3Ds_Bottom = face2Ds.ConvertAll(x => new Face3D(plane_Bottom, x)); - Vector3D vector3D = new Vector3D(0, 0, tuple.Item2.ConvertAll(x => x.GetBoundingBox().Max.Z - tuple.Item1 ).Max()); + Vector3D vector3D = new Vector3D(0, 0, tuple.Item2.ConvertAll(x => x.GetBoundingBox().Max.Z - tuple.Item1).Max()); List shells = face3Ds_Bottom.ConvertAll(x => Shell(x, vector3D, tolerance_Distance)); if (shells == null || shells.Count == 0) @@ -1170,7 +1173,7 @@ public static List Shells_ByOffset(this IEnumerable face3Ds, doub }); List> shellsList_Split = Enumerable.Repeat>(null, shellsList.Count).ToList(); - Parallel.For(0, shellsList.Count, (int i) => + Parallel.For(0, shellsList.Count, (int i) => { List shells = shellsList[i]; if (shells == null || shells.Count == 0) @@ -1210,9 +1213,9 @@ public static List Shells_ByOffset(this IEnumerable face3Ds, doub } }); - foreach(List shells in shellsList_Split) + foreach (List shells in shellsList_Split) { - if(shells == null || shells.Count == 0) + if (shells == null || shells.Count == 0) { continue; } @@ -1223,4 +1226,4 @@ public static List Shells_ByOffset(this IEnumerable face3Ds, doub return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Create/Vector3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Create/Vector3D.cs index 061cbee97..8b01cc259 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Create/Vector3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Create/Vector3D.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Create { @@ -13,4 +16,4 @@ public static Vector3D Vector3D(this Math.Matrix matrix) return new Vector3D(matrix[0, 0], matrix[1, 0], matrix[2, 0]); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/IBoundable3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/IBoundable3D.cs index 4f4baa9ef..9416591d2 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/IBoundable3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/IBoundable3D.cs @@ -1,7 +1,10 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public interface IBoundable3D : ISAMGeometry3D { BoundingBox3D GetBoundingBox(double offset = 0); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/IClosed3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/IClosed3D.cs index 70bdf8705..797f505cb 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/IClosed3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/IClosed3D.cs @@ -1,7 +1,10 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public interface IClosed3D : IBoundable3D { } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/IClosedPlanar3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/IClosedPlanar3D.cs index e5da2176d..dd241e393 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/IClosedPlanar3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/IClosedPlanar3D.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public interface IClosedPlanar3D : IClosed3D, IPlanar3D, IBoundable3D, IReversible { @@ -6,4 +9,4 @@ public interface IClosedPlanar3D : IClosed3D, IPlanar3D, IBoundable3D, IReversib Point3D GetCentroid(); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/ICurvable3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/ICurvable3D.cs index e05f5dc8a..9c69ff791 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/ICurvable3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/ICurvable3D.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -6,4 +9,4 @@ public interface ICurvable3D : IBoundable3D { List GetCurves(); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/ICurve3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/ICurve3D.cs index 59884ddf3..c95022641 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/ICurve3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/ICurve3D.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public interface ICurve3D : IBoundable3D { @@ -10,4 +13,4 @@ public interface ICurve3D : IBoundable3D void Reverse(); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/IIntersectionResult3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/IIntersectionResult3D.cs index 4ec7234ae..6617388be 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/IIntersectionResult3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/IIntersectionResult3D.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -8,4 +11,4 @@ public interface IIntersectionResult3D List Geometry3Ds { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/IPlanar3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/IPlanar3D.cs index a6dcbf625..4ecbb7f77 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/IPlanar3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/IPlanar3D.cs @@ -1,7 +1,10 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public interface IPlanar3D : ISAMGeometry3D { Plane GetPlane(); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/ISAMGeometry3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/ISAMGeometry3D.cs index 338eddd13..4b94f15a5 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/ISAMGeometry3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/ISAMGeometry3D.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public interface ISAMGeometry3D : ISAMGeometry { @@ -6,4 +9,4 @@ public interface ISAMGeometry3D : ISAMGeometry ISAMGeometry3D GetTransformed(Transform3D transform3D); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/ISegmentable3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/ISegmentable3D.cs index 1124a92c8..46d6df839 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/ISegmentable3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Interfaces/ISegmentable3D.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -12,4 +15,4 @@ public interface ISegmentable3D : ICurvable3D double GetLength(); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Modify/Add.cs b/SAM/SAM.Geometry/Geometry/Spatial/Modify/Add.cs index 705269f77..2d00e32e8 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Modify/Add.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Modify/Add.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -10,7 +13,7 @@ public static bool Add(this List point3Ds, Point3D point3D, double tole return false; Point3D point3D_Temp = point3Ds.Find(x => x.Distance(point3D) <= tolerance); - if(point3D_Temp == null) + if (point3D_Temp == null) { point3Ds.Add(point3D); return true; @@ -21,7 +24,7 @@ public static bool Add(this List point3Ds, Point3D point3D, double tole public static bool Add(this List point3Ds, double x, double y, double z) { - if(point3Ds == null) + if (point3Ds == null) { return false; } @@ -30,4 +33,4 @@ public static bool Add(this List point3Ds, double x, double y, double z return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Modify/FillFace3Ds.cs b/SAM/SAM.Geometry/Geometry/Spatial/Modify/FillFace3Ds.cs index 9369b07b7..261c6ce61 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Modify/FillFace3Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Modify/FillFace3Ds.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Threading.Tasks; @@ -36,4 +39,4 @@ public static bool FillFace3Ds(this List shells, IEnumerable face return tuples.Find(x => x.Item2) != null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Modify/InsertClosest.cs b/SAM/SAM.Geometry/Geometry/Spatial/Modify/InsertClosest.cs index e79b1dea2..078d31e6a 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Modify/InsertClosest.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Modify/InsertClosest.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Spatial @@ -44,7 +47,7 @@ public static Point3D InsertClosest(this List point3Ds, Point3D point3D if (point3D_Closest.AlmostEquals(segment3D_Temp[0], tolerance)) return segment3D_Temp[0]; - if(point3D_Closest.AlmostEquals(segment3D_Temp[1], tolerance)) + if (point3D_Closest.AlmostEquals(segment3D_Temp[1], tolerance)) return segment3D_Temp[1]; segment3Ds[index] = new Segment3D(segment3D_Temp[0], point3D_Closest); @@ -58,4 +61,4 @@ public static Point3D InsertClosest(this List point3Ds, Point3D point3D return point3D_Closest; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Modify/RemoveAlmostSimilar.cs b/SAM/SAM.Geometry/Geometry/Spatial/Modify/RemoveAlmostSimilar.cs index 40c17050f..e1d9c57bd 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Modify/RemoveAlmostSimilar.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Modify/RemoveAlmostSimilar.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Spatial @@ -65,4 +68,4 @@ public static void RemoveAlmostSimilar(List point3Ds, double tolerance point3Ds.AddRange(result); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Modify/Round.cs b/SAM/SAM.Geometry/Geometry/Spatial/Modify/Round.cs index e5b26e72b..4ba530227 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Modify/Round.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Modify/Round.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -12,4 +15,4 @@ public static void Round(this List point3Ds, double tolerance = Core.To point3Ds.ForEach(x => x.Round(tolerance)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Modify/SimplifyByAngle.cs b/SAM/SAM.Geometry/Geometry/Spatial/Modify/SimplifyByAngle.cs index 242b24f8d..83b80e947 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Modify/SimplifyByAngle.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Modify/SimplifyByAngle.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -75,4 +78,4 @@ public static bool SimplifyByAngle(this List point3Ds, bool closed, dou return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Modify/SortByDistance.cs b/SAM/SAM.Geometry/Geometry/Spatial/Modify/SortByDistance.cs index 1a05308e7..a25becd88 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Modify/SortByDistance.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Modify/SortByDistance.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Geometry.Spatial @@ -30,4 +33,4 @@ public static void SortByDistance(this List segment3Ds, Point3D point segment3Ds.AddRange(tuples.ConvertAll(x => x.Item2)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Modify/SplitCoplanarFace3Ds.cs b/SAM/SAM.Geometry/Geometry/Spatial/Modify/SplitCoplanarFace3Ds.cs index d8536f603..acebeef40 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Modify/SplitCoplanarFace3Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Modify/SplitCoplanarFace3Ds.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Threading.Tasks; @@ -13,11 +16,11 @@ public static bool SplitCoplanarFace3Ds(this List shells, double toleranc List> tuples = shells.ConvertAll(x => new Tuple(x, false)); - Parallel.For(0, shells.Count, (int i) => + Parallel.For(0, shells.Count, (int i) => //for(int i=0; i < shells.Count; i++) { Shell shell = tuples[i].Item1; - if(shell != null) + if (shell != null) { Shell shell_New = new Shell(tuples[i].Item1); @@ -35,7 +38,7 @@ public static bool SplitCoplanarFace3Ds(this List shells, double toleranc } } - if(updated) + if (updated) { tuples[i] = new Tuple(shell_New, true); } @@ -44,7 +47,7 @@ public static bool SplitCoplanarFace3Ds(this List shells, double toleranc }); shells.Clear(); - shells.AddRange(tuples.ConvertAll(x =>x.Item1)); + shells.AddRange(tuples.ConvertAll(x => x.Item1)); return tuples.Find(x => x.Item2) != null; } @@ -179,4 +182,4 @@ public static bool SplitCoplanarFace3Ds(this Shell shell, IEnumerable fa return split; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Modify/SplitEdges.cs b/SAM/SAM.Geometry/Geometry/Spatial/Modify/SplitEdges.cs index 1e341a5e2..1bf5dc111 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Modify/SplitEdges.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Modify/SplitEdges.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -6,7 +9,7 @@ public static partial class Modify { public static bool SplitEdges(this List face3Ds, double tolerance = Core.Tolerance.Distance) { - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return false; } @@ -17,7 +20,7 @@ public static bool SplitEdges(this List face3Ds, double tolerance = Core List face3Ds_Temp = new List(face3Ds); face3Ds_Temp.Remove(face3Ds[i]); - if(Query.TrySplitEdges(face3Ds[i], face3Ds_Temp, out Face3D face3D, tolerance) && face3D != null) + if (Query.TrySplitEdges(face3Ds[i], face3Ds_Temp, out Face3D face3D, tolerance) && face3D != null) { face3Ds[i] = face3D; result = true; @@ -27,4 +30,4 @@ public static bool SplitEdges(this List face3Ds, double tolerance = Core return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Modify/SplitFace3Ds.cs b/SAM/SAM.Geometry/Geometry/Spatial/Modify/SplitFace3Ds.cs index 22092943b..21d2fe239 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Modify/SplitFace3Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Modify/SplitFace3Ds.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -17,7 +20,7 @@ public static void SplitFace3Ds(this List shells, double tolerance_Snap = //for(int i=0; i < shells.Count; i++) { Shell shell = shells[i]; - if(shell == null) + if (shell == null) { return; } @@ -25,7 +28,7 @@ public static void SplitFace3Ds(this List shells, double tolerance_Snap = BoundingBox3D boundingBox3D = shell.GetBoundingBox(); List shells_InRange = shells.FindAll(x => x != shell && boundingBox3D.InRange(x.GetBoundingBox(), tolerance_Distance)); - if(shells_InRange == null || shells_InRange.Count == 0) + if (shells_InRange == null || shells_InRange.Count == 0) { shells_Result[i] = shell; return; @@ -42,7 +45,7 @@ public static void SplitFace3Ds(this List shells, double tolerance_Snap = split = true; } - if(split) + if (split) shells_Result[i] = shell; }); @@ -51,4 +54,4 @@ public static void SplitFace3Ds(this List shells, double tolerance_Snap = shells.AddRange(shells_Result); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Above.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Above.cs index 027f89f5a..842881ff2 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Above.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Above.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -64,7 +67,7 @@ public static bool Above(this Plane plane, Shell shell, double tolerance) return false; } - if(Above(plane, boundingBox3D, tolerance)) + if (Above(plane, boundingBox3D, tolerance)) { return true; } @@ -74,7 +77,7 @@ public static bool Above(this Plane plane, Shell shell, double tolerance) public static bool Above(this Plane plane, BoundingBox3D boundingBox3D, double tolerance) { - if(plane == null || boundingBox3D == null) + if (plane == null || boundingBox3D == null) { return false; } @@ -82,4 +85,4 @@ public static bool Above(this Plane plane, BoundingBox3D boundingBox3D, double t return boundingBox3D.GetPoints().TrueForAll(x => plane.Above(x, tolerance)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/AlmostSimilar.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/AlmostSimilar.cs index b4abc46c0..f76716b64 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/AlmostSimilar.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/AlmostSimilar.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -41,4 +44,4 @@ public static bool AlmostSimilar(this ISegmentable3D segmentable3D_1, ISegmentab return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Angle.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Angle.cs index 2d7a804f1..879292d5d 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Angle.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Angle.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Query { @@ -19,4 +22,4 @@ public static double Angle(this Vector3D vector3D_1, Vector3D vector3D_2, Plane return angle >= 0 ? angle : System.Math.PI * 2 + angle; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Area.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Area.cs index b288f510f..9d51c3006 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Area.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Area.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -8,13 +11,13 @@ public static partial class Query { public static double Area(this Shell shell, Plane plane, double tolerance_Angle = Tolerance.Angle, double tolerance_Distance = Tolerance.Distance, double tolerance_Snap = Tolerance.MacroDistance) { - if(shell == null || plane == null) + if (shell == null || plane == null) { return double.NaN; } List face3Ds = shell.Section(plane, true, tolerance_Angle, tolerance_Distance, tolerance_Snap); - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return 0; } @@ -41,26 +44,26 @@ public static double Area(this Shell shell, double offset, double tolerance_Angl public static double Area(this Face3D face3D, Range range, int dimensionIndex = 2, double tolerance = Tolerance.Distance) { List face3Ds = face3D.Cut(range, dimensionIndex, tolerance); - if(face3Ds == null) + if (face3Ds == null) { return double.NaN; } - if(face3Ds.Count == 0) + if (face3Ds.Count == 0) { return 0; } double result = 0; - foreach(Face3D face3D_Temp in face3Ds) + foreach (Face3D face3D_Temp in face3Ds) { - if(face3D_Temp == null) + if (face3D_Temp == null) { continue; } double area = face3D_Temp.GetArea(); - if(double.IsNaN(area)) + if (double.IsNaN(area)) { continue; } @@ -71,4 +74,4 @@ public static double Area(this Face3D face3D, Range range, int dimension return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Average.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Average.cs index 15dd29517..e0fd0400d 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Average.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Average.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Spatial @@ -51,4 +54,4 @@ public static Vector3D Average(this IEnumerable vector3Ds) return new Vector3D(x / count, y / count, z / count); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/AxisX.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/AxisX.cs index fe53eb5a3..5c29b871e 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/AxisX.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/AxisX.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Query { @@ -21,4 +24,4 @@ public static Vector3D AxisX(this Vector3D normal, Vector3D axisY) return axisY.CrossProduct(normal).Unit; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/AxisY.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/AxisY.cs index 50d24d9fa..e10bbbc76 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/AxisY.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/AxisY.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Query { @@ -23,4 +26,4 @@ public static Vector3D AxisY(this Vector3D normal, Vector3D axisX) return normal.CrossProduct(axisX).Unit; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Azimuth.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Azimuth.cs index f15e1214e..95fd99e14 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Azimuth.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Azimuth.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Query { @@ -39,4 +42,4 @@ public static double Azimuth(this Plane plane, Vector3D referenceDirection) return azimuth; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Below.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Below.cs index 5699cf5d8..b2295702c 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Below.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Below.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -35,4 +38,4 @@ public static bool Below(this Face3D face3D, Plane plane, double tolerance = 0) return point3Ds.TrueForAll(x => plane.On(x, tolerance) || !plane.Above(x, tolerance)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Between.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Between.cs index 935d37328..7260d7bef 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Between.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Between.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -30,10 +33,10 @@ public static List Between(this IEnumerable face3Ds, double elev continue; } - foreach(Face3D face3D_Cut in face3Ds_Cut) + foreach (Face3D face3D_Cut in face3Ds_Cut) { BoundingBox3D boundingBox3D = face3D_Cut?.GetBoundingBox(); - if(boundingBox3D == null) + if (boundingBox3D == null) { continue; } @@ -41,7 +44,7 @@ public static List Between(this IEnumerable face3Ds, double elev double value; value = boundingBox3D.Min.Z; - if(Core.Query.AlmostEqual(value, min) || value >= min) + if (Core.Query.AlmostEqual(value, min) || value >= min) { value = boundingBox3D.Max.Z; if (Core.Query.AlmostEqual(value, max) || value <= max) @@ -55,4 +58,4 @@ public static List Between(this IEnumerable face3Ds, double elev return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/CalculatedInternalPoint3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/CalculatedInternalPoint3D.cs index 6ad524408..a42ec4bd9 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/CalculatedInternalPoint3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/CalculatedInternalPoint3D.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Geometry.Spatial @@ -21,15 +24,15 @@ public static Point3D CalculatedInternalPoint3D(this Shell shell, double silverS double distance = boundingBox3D.Min.Distance(boundingBox3D.Max); List> tuples = new List>(); - foreach(KeyValuePair keyValuePair in dictionary) + foreach (KeyValuePair keyValuePair in dictionary) { - if(keyValuePair.Key == null || keyValuePair.Value == null) + if (keyValuePair.Key == null || keyValuePair.Value == null) { continue; } Vector3D vector3D = keyValuePair.Value.GetNegated() * distance; - + Point3D point3D = keyValuePair.Key.InternalPoint3D(); Segment3D segment3D = new Segment3D(point3D, vector3D); @@ -49,7 +52,7 @@ public static Point3D CalculatedInternalPoint3D(this Shell shell, double silverS continue; double distance_Min = double.MaxValue; - foreach(Face3D face3D in dictionary.Keys) + foreach (Face3D face3D in dictionary.Keys) { double distance_Min_Temp = face3D.Distance(point3D_Mid, tolerance); if (distance_Min_Temp < distance_Min) @@ -61,7 +64,7 @@ public static Point3D CalculatedInternalPoint3D(this Shell shell, double silverS } Point3D point3D_Internal = shell.InternalPoint3D(silverSpacing, tolerance); - if(point3D_Internal != null) + if (point3D_Internal != null) { double distance_Min = double.MaxValue; foreach (Face3D face3D in dictionary.Keys) @@ -76,10 +79,10 @@ public static Point3D CalculatedInternalPoint3D(this Shell shell, double silverS if (tuples.Count == 0) return null; - + tuples.Sort((x, y) => y.Item2.CompareTo(x.Item2)); return tuples[0].Item1; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Centroid.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Centroid.cs index 995a8be32..5417186cf 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Centroid.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Centroid.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Spatial @@ -44,4 +47,4 @@ public static Point3D Centroid(this IEnumerable point3Ds) }; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Clockwise.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Clockwise.cs index ad89f94ba..feabf749c 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Clockwise.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Clockwise.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Spatial @@ -72,4 +75,4 @@ public static partial class Query return angle_Total > 0; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Clone.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Clone.cs index a3e99b28b..4b0025ba8 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Clone.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Clone.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -13,4 +16,4 @@ public static List Clone(this IEnumerable point3Ds) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/ClosedPlanar3Ds.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/ClosedPlanar3Ds.cs index cdde61e44..0fe529d97 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/ClosedPlanar3Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/ClosedPlanar3Ds.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Spatial @@ -38,7 +41,7 @@ public static List ClosedPlanar3Ds(this IEnumerable point3Ds = ((ICurvable3D)geometry3D).GetCurves().ConvertAll(x => x.GetStart()); result.Add(new Polygon3D(point3Ds)); } @@ -47,4 +50,4 @@ public static List ClosedPlanar3Ds(this IEnumerable face3Ds, Point3D point3D) return result; } - public static T Closest(this IEnumerable segmentable3Ds, Point3D point3D, out double distance, out Point3D point3D_Closest) where T: ISegmentable3D + public static T Closest(this IEnumerable segmentable3Ds, Point3D point3D, out double distance, out Point3D point3D_Closest) where T : ISegmentable3D { distance = double.NaN; T result = default; @@ -54,10 +57,10 @@ public static T Closest(this IEnumerable segmentable3Ds, Point3D point3D, } double distance_min = double.MaxValue; - foreach(T segmentable3D in segmentable3Ds) + foreach (T segmentable3D in segmentable3Ds) { Point3D point3D_Closest_Temp = segmentable3D.ClosestPoint3D(point3D, out double distance_Temp); - if(distance_Temp < distance_min) + if (distance_Temp < distance_min) { distance = distance_Temp; distance_min = distance_Temp; @@ -92,4 +95,4 @@ public static Point3D Closest(this IEnumerable point3Ds, Point3D point3 return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/ClosestEnd.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/ClosestEnd.cs index 442614b95..9caa78b62 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/ClosestEnd.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/ClosestEnd.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Query { @@ -9,23 +12,23 @@ public static Point3D ClosestEnd(this ICurve3D curve3D, Point3D point3D) Point3D point3D_1 = curve3D.GetStart(); Point3D point3D_2 = curve3D.GetEnd(); - - if(point3D_1 == null && point3D_2 == null) + + if (point3D_1 == null && point3D_2 == null) { return null; } - if(point3D_1 == null) + if (point3D_1 == null) { return point3D_2; } - if(point3D_2 == null) + if (point3D_2 == null) { return point3D_1; } - if(point3D_1.Distance(point3D) < point3D_2.Distance(point3D)) + if (point3D_1.Distance(point3D) < point3D_2.Distance(point3D)) { return point3D_1; } @@ -33,4 +36,4 @@ public static Point3D ClosestEnd(this ICurve3D curve3D, Point3D point3D) return point3D_2; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/ClosestPoint3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/ClosestPoint3D.cs index 88e36b77a..c350e2967 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/ClosestPoint3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/ClosestPoint3D.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -32,28 +35,28 @@ public static Point3D ClosestPoint3D(this ISegmentable3D segmentable3D, Point3D { distance = double.NaN; - if(segmentable3D == null || point3D == null) + if (segmentable3D == null || point3D == null) { return null; } List segment3Ds = segmentable3D.GetSegments(); - if(segment3Ds == null || segment3Ds.Count == 0) + if (segment3Ds == null || segment3Ds.Count == 0) { return null; } double distance_Min = double.MaxValue; Point3D result = null; - foreach(Segment3D segment3D in segment3Ds) + foreach (Segment3D segment3D in segment3Ds) { - if(segment3D == null) + if (segment3D == null) { continue; } Point3D point3D_Temp = segment3D.Closest(point3D, true); - if(point3D_Temp == null) + if (point3D_Temp == null) { continue; } @@ -132,4 +135,4 @@ public static Point3D ClosestPoint3D(this ISegmentable3D segmentable3D, Point3D return ClosestPoint3D(segmentable3D, point3D, out double distance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Collinear.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Collinear.cs index fca9f20c8..a2a16bfff 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Collinear.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Collinear.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Spatial @@ -38,4 +41,4 @@ public static bool Collinear(this IEnumerable point3Ds, double toleranc return nonZeroRows < 2; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Concave.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Concave.cs index e1464f2de..9b6dabb87 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Concave.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Concave.cs @@ -1,23 +1,26 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Query { - public static bool Concave(this T closedPlanar3D) where T: IClosedPlanar3D, ISegmentable3D + public static bool Concave(this T closedPlanar3D) where T : IClosedPlanar3D, ISegmentable3D { - if(closedPlanar3D == null) + if (closedPlanar3D == null) { return false; } Plane plane = closedPlanar3D.GetPlane(); - if(plane == null) + if (plane == null) { return false; } Planar.ISegmentable2D segmentable2D = plane.Convert(closedPlanar3D) as Planar.ISegmentable2D; - if(segmentable2D == null) + if (segmentable2D == null) { throw new System.NotImplementedException(); } @@ -28,7 +31,7 @@ public static bool Concave(this T closedPlanar3D) where T: IClosedPlanar3D, I public static bool Concave(this Face3D face3D, bool externalEdge = true, bool internalEdges = true) { Plane plane = face3D?.GetPlane(); - if(plane == null) + if (plane == null) { return false; } @@ -37,4 +40,4 @@ public static bool Concave(this Face3D face3D, bool externalEdge = true, bool in } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/ConnectedFace3Ds.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/ConnectedFace3Ds.cs index af7d830a4..54482c904 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/ConnectedFace3Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/ConnectedFace3Ds.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -8,7 +11,7 @@ public static partial class Query { public static List ConnectedFace3Ds(this Face3D face3D, IEnumerable face3Ds, double tolerance_Angle = Core.Tolerance.Distance, double tolerance_Distance = Core.Tolerance.Distance) { - if(face3D == null || face3Ds == null) + if (face3D == null || face3Ds == null) { return null; } @@ -21,17 +24,17 @@ public static List ConnectedFace3Ds(this Face3D face3D, IEnumerable face3Ds_Temp = new List(face3Ds); - for(int i = face3Ds_Temp.Count - 1; i >= 0; i--) + for (int i = face3Ds_Temp.Count - 1; i >= 0; i--) { Face3D face3D_Temp = face3Ds_Temp[i]; - + if (face3D_Temp == null) { face3Ds_Temp.RemoveAt(i); continue; } - if(face3D.Distance(face3D_Temp, tolerance_Angle, tolerance_Distance) > tolerance_Distance) + if (face3D.Distance(face3D_Temp, tolerance_Angle, tolerance_Distance) > tolerance_Distance) { continue; } @@ -41,7 +44,7 @@ public static List ConnectedFace3Ds(this Face3D face3D, IEnumerable face3Ds_Connected = result[i].ConnectedFace3Ds(face3Ds_Temp, tolerance_Angle, tolerance_Distance); if (face3Ds_Connected == null || face3Ds_Connected.Count == 0) @@ -70,7 +73,7 @@ public static List ConnectedFace3Ds(this Face3D face3D, IEnumerable point3Ds = new List(); - foreach(IClosedPlanar3D edge3D in edge3Ds) + foreach (IClosedPlanar3D edge3D in edge3Ds) { ISegmentable3D segmentable3D = edge3D as ISegmentable3D; if (segmentable3D == null) @@ -84,18 +87,18 @@ public static List ConnectedFace3Ds(this Face3D face3D, IEnumerable x.On(point3D, tolerance)); - if(segment3D_Excluded != null) + if (segment3D_Excluded != null) { continue; } @@ -120,7 +123,7 @@ public static List ConnectedFace3Ds(this Face3D face3D, IEnumerable ConnectedFace3Ds(this Face3D face3D, IEnumerable x == null || x.GetLength() < tolerance); bool connected = false; - foreach(Point3D point3D in point3Ds) + foreach (Point3D point3D in point3Ds) { Segment3D segment3D_Temp = segment3Ds_Temp.Find(x => x.On(point3D, tolerance)); - if(segment3Ds_Temp != null) + if (segment3Ds_Temp != null) { connected = true; break; } } - if(connected) + if (connected) { result.Add(face3D_Temp); break; @@ -171,7 +174,7 @@ public static List ConnectedFace3Ds(this Face3D face3D, IEnumerable ConnectedFace3Ds(this Face3D face3D, IEnumerable sAMGeometry3D = new List(); - foreach(ISAMGeometry2D sAMGeometry2D in sAMGeometry2Ds) + foreach (ISAMGeometry2D sAMGeometry2D in sAMGeometry2Ds) { ISAMGeometry3D sAMGeometry3D_Temp = Convert(plane, sAMGeometry2D); sAMGeometry3D.Add(sAMGeometry3D_Temp); @@ -273,7 +276,7 @@ public static Face2D Convert(this Plane plane, Face3D face3D) } IClosed2D closed2D_external = Convert(plane, closedPlanar3D_External); - if(closed2D_external == null) + if (closed2D_external == null) { return null; } @@ -359,13 +362,13 @@ public static Point3D Convert(this Sphere sphere, Point2D point2D) public static Point3D Convert(this CoordinateSystem3D coordinateSystem3D_From, CoordinateSystem3D coordinateSystem3D_To, Point3D point3D) { - if(coordinateSystem3D_From == null || coordinateSystem3D_To == null || point3D == null) + if (coordinateSystem3D_From == null || coordinateSystem3D_To == null || point3D == null) { return null; } Transform3D transform3D = Transform3D.GetCoordinateSystem3DToCoordinateSystem3D(coordinateSystem3D_From, coordinateSystem3D_To); - if(transform3D == null) + if (transform3D == null) { return null; } @@ -381,7 +384,7 @@ public static List Convert(this CoordinateSystem3D coordinateSystem3D_F } List result = new List(); - foreach(Point3D point3D in point3Ds) + foreach (Point3D point3D in point3Ds) { result.Add(Convert(coordinateSystem3D_From, coordinateSystem3D_To, point3D)); } @@ -407,11 +410,11 @@ public static Point3D Convert(this CoordinateSystem3D coordinateSystem3D_From, C public static Plane Convert(this CoordinateSystem3D coordinateSystem3D_From, CoordinateSystem3D coordinateSystem3D_To, Plane plane) { - if(coordinateSystem3D_From == null || coordinateSystem3D_To == null || plane == null) + if (coordinateSystem3D_From == null || coordinateSystem3D_To == null || plane == null) { return null; } - + Point3D origin = Convert(coordinateSystem3D_From, coordinateSystem3D_To, plane.Origin); Vector3D axisX = Convert(coordinateSystem3D_From, coordinateSystem3D_To, plane.AxisX); Vector3D axisY = Convert(coordinateSystem3D_From, coordinateSystem3D_To, plane.AxisY); @@ -421,19 +424,19 @@ public static Plane Convert(this CoordinateSystem3D coordinateSystem3D_From, Coo public static Polygon3D Convert(this CoordinateSystem3D coordinateSystem3D_From, CoordinateSystem3D coordinateSystem3D_To, Polygon3D polygon3D) { - if(coordinateSystem3D_From == null || coordinateSystem3D_To == null || polygon3D == null) + if (coordinateSystem3D_From == null || coordinateSystem3D_To == null || polygon3D == null) { return null; } Plane plane = Convert(coordinateSystem3D_From, coordinateSystem3D_To, polygon3D.GetPlane()); - if(plane == null) + if (plane == null) { return null; } List point3Ds = Convert(coordinateSystem3D_From, coordinateSystem3D_To, polygon3D.GetPoints()); - if(point3Ds == null) + if (point3Ds == null) { return null; } @@ -473,4 +476,4 @@ public static Point3D Convert(CoordinateSystem3D coordinateSystem3D, Point3D poi } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Convex.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Convex.cs index 4aed37321..4a426c996 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Convex.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Convex.cs @@ -1,23 +1,26 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Query { - public static bool Convex(this T closedPlanar3D) where T: IClosedPlanar3D, ISegmentable3D + public static bool Convex(this T closedPlanar3D) where T : IClosedPlanar3D, ISegmentable3D { - if(closedPlanar3D == null) + if (closedPlanar3D == null) { return false; } Plane plane = closedPlanar3D.GetPlane(); - if(plane == null) + if (plane == null) { return false; } Planar.ISegmentable2D segmentable2D = plane.Convert(closedPlanar3D) as Planar.ISegmentable2D; - if(segmentable2D == null) + if (segmentable2D == null) { throw new System.NotImplementedException(); } @@ -28,7 +31,7 @@ public static bool Convex(this T closedPlanar3D) where T: IClosedPlanar3D, IS public static bool Convex(this Face3D face3D, bool externalEdge = true, bool internalEdges = true) { Plane plane = face3D?.GetPlane(); - if(plane == null) + if (plane == null) { return false; } @@ -36,4 +39,4 @@ public static bool Convex(this Face3D face3D, bool externalEdge = true, bool int return Planar.Query.Convex(plane.Convert(face3D), externalEdge, internalEdges); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Coplanar.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Coplanar.cs index 5c2ac188a..f5d2466d5 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Coplanar.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Coplanar.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Spatial @@ -62,4 +65,4 @@ public static bool Coplanar(this IPlanar3D planar3D_1, IPlanar3D planar3D_2, dou return plane_1.Coplanar(plane_2, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Cut.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Cut.cs index 23c6553fb..4ac7e3894 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Cut.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Cut.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -53,7 +56,7 @@ public static List Cut(this Face3D face3D, Plane plane, out List if (result.Count == 0) return result; - foreach(Face3D face3D_New in result) + foreach (Face3D face3D_New in result) { Point3D point3D = face3D_New?.InternalPoint3D(); if (point3D == null) @@ -99,7 +102,7 @@ public static List Cut(this Face3D face3D, IEnumerable face3Ds, return null; List segmentable2Ds = new List(); - foreach(Face3D face3D_Temp in face3Ds) + foreach (Face3D face3D_Temp in face3Ds) { PlanarIntersectionResult planarIntersectionResult = Create.PlanarIntersectionResult(face3D, face3D_Temp, tolerance_Angle, tolerance_Distance); if (planarIntersectionResult == null || !planarIntersectionResult.Intersecting) @@ -119,16 +122,16 @@ public static List Cut(this Face3D face3D, IEnumerable face3Ds, public static List Cut(this IEnumerable face3Ds, double tolerance_Angle = Tolerance.Angle, double tolerance_Distance = Tolerance.Distance) { - if(face3Ds == null) + if (face3Ds == null) { return null; } List> face3DsList = Enumerable.Repeat>(null, face3Ds.Count()).ToList(); - System.Threading.Tasks.Parallel.For(0, face3DsList.Count, (int i) => + System.Threading.Tasks.Parallel.For(0, face3DsList.Count, (int i) => { Face3D face3D = face3Ds.ElementAt(i); - if(face3D == null) + if (face3D == null) { return; } @@ -148,9 +151,9 @@ public static List Cut(this IEnumerable face3Ds, double toleranc List result = new List(); - foreach(List face3Ds_Temp in face3DsList) + foreach (List face3Ds_Temp in face3DsList) { - if(face3Ds_Temp == null || face3Ds_Temp.Count == 0) + if (face3Ds_Temp == null || face3Ds_Temp.Count == 0) { continue; } @@ -163,13 +166,13 @@ public static List Cut(this IEnumerable face3Ds, double toleranc public static List Cut(this Shell shell, Plane plane, double silverSpacing = Tolerance.MacroDistance, double tolerance_Angle = Tolerance.Angle, double tolerance_Distance = Tolerance.Distance, double tolerance_Snap = Tolerance.MacroDistance) { - if(shell == null || plane == null) + if (shell == null || plane == null) { return null; } BoundingBox3D boundingBox3D = shell.GetBoundingBox(); - if(boundingBox3D == null) + if (boundingBox3D == null) { return null; } @@ -181,16 +184,16 @@ public static List Cut(this Shell shell, Plane plane, double silverSpacin } List face3Ds_Section = shell.Section(plane, true, tolerance_Angle, tolerance_Distance, tolerance_Snap); - if(face3Ds_Section == null || face3Ds_Section.Count == 0) + if (face3Ds_Section == null || face3Ds_Section.Count == 0) { return new List() { new Shell(shell) }; } List face3Ds_Cut = new List(); - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { List face3Ds_Cut_Temp = Cut(face3D, plane, tolerance_Distance); - if(face3Ds_Cut_Temp == null || face3Ds_Cut_Temp.Count == 0) + if (face3Ds_Cut_Temp == null || face3Ds_Cut_Temp.Count == 0) { face3Ds_Cut.Add(face3D); } @@ -240,7 +243,7 @@ public static List Cut(this Shell shell, Plane plane, double silverSpacin Vector3D vector3D = plane.Normal * silverSpacing; - if(shell.Inside((Point3D)point3D.GetMoved(vector3D), silverSpacing, tolerance_Distance)) + if (shell.Inside((Point3D)point3D.GetMoved(vector3D), silverSpacing, tolerance_Distance)) { face3Ds_Above.Add(face3D_Cut); } @@ -257,17 +260,17 @@ public static List Cut(this Shell shell, Plane plane, double silverSpacin } List result = new List(); - while(face3Ds_Section.Count > 0) + while (face3Ds_Section.Count > 0) { Face3D face3D_Section = face3Ds_Section[0]; face3Ds_Section.RemoveAt(0); - if(face3D_Section == null) + if (face3D_Section == null) { continue; } - foreach(List face3Ds_Temp in new List>() { face3Ds_Above, face3Ds_Below }) + foreach (List face3Ds_Temp in new List>() { face3Ds_Above, face3Ds_Below }) { List face3Ds_Temp_Temp = new List(face3Ds_Temp); face3Ds_Temp_Temp.AddRange(face3Ds_Section); @@ -295,19 +298,19 @@ public static List Cut(this Shell shell, Plane plane, double silverSpacin public static List Cut(this Shell shell, IEnumerable planes, double silverSpacing = Tolerance.MacroDistance, double tolerance_Angle = Tolerance.Angle, double tolerance_Distance = Tolerance.Distance, double tolerance_Snap = Tolerance.MacroDistance) { - if(shell == null || planes == null) + if (shell == null || planes == null) { return null; } List result = new List() { shell }; - foreach(Plane plane in planes) + foreach (Plane plane in planes) { List shells_Temp = new List(); foreach (Shell shell_Temp in result) { List shells_Cut = shell_Temp.Cut(plane, silverSpacing, tolerance_Angle, tolerance_Distance, tolerance_Snap); - if(shells_Cut == null || shells_Cut.Count == 0) + if (shells_Cut == null || shells_Cut.Count == 0) { shells_Temp.Add(shell_Temp); } @@ -324,7 +327,7 @@ public static List Cut(this Shell shell, IEnumerable planes, doubl public static List Cut(this Face3D face3D, IEnumerable planes, double tolerance = Tolerance.Distance) { - if(face3D == null || planes == null) + if (face3D == null || planes == null) { return null; } @@ -335,7 +338,7 @@ public static List Cut(this Face3D face3D, IEnumerable planes, do for (int i = result.Count - 1; i >= 0; i--) { List face3Ds = result[i].Cut(plane, tolerance); - if(face3Ds == null || face3Ds.Count < 2) + if (face3Ds == null || face3Ds.Count < 2) { continue; } @@ -350,15 +353,15 @@ public static List Cut(this Face3D face3D, IEnumerable planes, do public static List Cut(this IEnumerable face3Ds, IEnumerable planes, double tolerance = Tolerance.Distance) { - if(face3Ds == null || planes == null) + if (face3Ds == null || planes == null) { return null; } List result = new List(); - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { - if(face3D == null) + if (face3D == null) { continue; } @@ -377,7 +380,7 @@ public static List Cut(this IEnumerable face3Ds, IEnumerable Cut(this Face3D face3D, Range range, int dimensionIndex, double tolerance = Tolerance.Distance) { if (face3D == null || range == null) @@ -404,7 +407,7 @@ public static List Cut(this Face3D face3D, Range range, int dime } List face3Ds = face3D.Cut(new Plane[] { Create.Plane(range.Min, dimensionIndex), Create.Plane(range.Max, dimensionIndex) }, tolerance); - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return result; } @@ -428,4 +431,4 @@ public static List Cut(this Face3D face3D, Range range, int dime return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/CutFace3Ds.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/CutFace3Ds.cs index ed947a28c..f800b8631 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/CutFace3Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/CutFace3Ds.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -6,7 +9,7 @@ public static partial class Query { public static Shell CutFace3Ds(this Shell shell, Plane plane, double tolerance_Distance = Core.Tolerance.Distance, double tolerance_Snap = Core.Tolerance.MacroDistance) { - if(shell == null || plane == null) + if (shell == null || plane == null) { return null; } @@ -25,13 +28,13 @@ public static Shell CutFace3Ds(this Shell shell, Plane plane, double tolerance_D for (int i = face3Ds.Count - 1; i >= 0; i--) { List face3Ds_Cut = face3Ds[i].Cut(plane, tolerance_Distance); - if(face3Ds_Cut == null || face3Ds_Cut.Count < 2) + if (face3Ds_Cut == null || face3Ds_Cut.Count < 2) { continue; } face3Ds.RemoveAt(i); - foreach(Face3D face3D_Cut in face3Ds_Cut) + foreach (Face3D face3D_Cut in face3Ds_Cut) { face3Ds.Add(face3D_Cut.Snap(shell.Face3Ds, tolerance_Snap, tolerance_Distance)); } @@ -40,4 +43,4 @@ public static Shell CutFace3Ds(this Shell shell, Plane plane, double tolerance_D return new Shell(face3Ds); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Difference.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Difference.cs index d4356bbb6..cbc93bb96 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Difference.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Difference.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Threading.Tasks; @@ -85,28 +88,28 @@ public static List Difference(this Shell shell_1, Shell shell_2, double s face3Ds.AddRange(boundaries_2.ConvertAll(x => x.Item2)); } - if(face3Ds.Count < 3) + if (face3Ds.Count < 3) { return null; } List face3Ds_Shell_1 = shell_1.Face3Ds; - System.Threading.Tasks.Parallel.For(0, face3Ds.Count, (int i) => + System.Threading.Tasks.Parallel.For(0, face3Ds.Count, (int i) => { face3Ds[i] = face3Ds[i].Snap(face3Ds_Shell_1, tolerance_Distance, tolerance_Distance); }); List result = new List(); - while(face3Ds.Count >= 3) + while (face3Ds.Count >= 3) { Face3D face3D = face3Ds[0]; List face3Ds_Shell = face3D?.ConnectedFace3Ds(face3Ds, tolerance_Angle, silverSpacing); face3Ds.RemoveAt(0); - - if(face3Ds_Shell != null && face3Ds_Shell.Count > 2) + + if (face3Ds_Shell != null && face3Ds_Shell.Count > 2) { Shell shell = Create.Shell(face3Ds_Shell, silverSpacing, tolerance_Distance); - if(shell != null) + if (shell != null) { result.Add(shell); face3Ds.RemoveAll(x => face3Ds_Shell.Contains(x)); @@ -128,26 +131,26 @@ public static List Difference(this Shell shell_1, Shell shell_2, double s /// Shells public static List Difference(this Shell shell, IEnumerable shells, double silverSpacing = Core.Tolerance.MacroDistance, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { - if(shell == null || shells == null) + if (shell == null || shells == null) { return null; } List result = new List() { shell }; - foreach(Shell shell_Temp in shells) + foreach (Shell shell_Temp in shells) { List result_New = new List(); - foreach(Shell shell_Result in result) + foreach (Shell shell_Result in result) { List shells_Difference = Difference(shell_Result, shell_Temp, silverSpacing, tolerance_Angle, tolerance_Distance); - if(shells_Difference != null && shells_Difference.Count != 0) + if (shells_Difference != null && shells_Difference.Count != 0) { result_New.AddRange(shells_Difference); } } result = result_New; - if(result == null || result.Count == 0) + if (result == null || result.Count == 0) { break; } @@ -158,13 +161,13 @@ public static List Difference(this Shell shell, IEnumerable shells public static List Difference(this Face3D face3D, IEnumerable face3Ds, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { - if(face3D == null || face3Ds == null) + if (face3D == null || face3Ds == null) { return null; } PlanarIntersectionResult planarIntersectionResult = Create.PlanarIntersectionResult(face3D, face3Ds, tolerance_Angle, tolerance_Distance); - if(planarIntersectionResult == null || !planarIntersectionResult.Intersecting) + if (planarIntersectionResult == null || !planarIntersectionResult.Intersecting) { return new List() { new Face3D(face3D) }; } @@ -190,4 +193,4 @@ public static List Difference(this Face3D face3D, IEnumerable fa return face2Ds.ConvertAll(x => plane.Convert(x)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Distance.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Distance.cs index 25795f5ba..85ac0e2ca 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Distance.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Distance.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Spatial @@ -13,7 +16,7 @@ public static double Distance(this IClosedPlanar3D closedPlanar3D_1, IClosedPlan } IClosedPlanar3D closedPlanar3D_1_Temp = closedPlanar3D_1; - if(closedPlanar3D_1_Temp is Face3D) + if (closedPlanar3D_1_Temp is Face3D) { closedPlanar3D_1_Temp = ((Face3D)closedPlanar3D_1_Temp).GetExternalEdge3D(); } @@ -25,13 +28,13 @@ public static double Distance(this IClosedPlanar3D closedPlanar3D_1, IClosedPlan } PlanarIntersectionResult planarIntersectionResult = Create.PlanarIntersectionResult(new Face3D(closedPlanar3D_1_Temp), new Face3D(closedPlanar3D_2_Temp), tolerance_Angle, tolerance_Distance); - if(planarIntersectionResult != null && planarIntersectionResult.Intersecting) + if (planarIntersectionResult != null && planarIntersectionResult.Intersecting) { return 0; } ISegmentable3D segmentable3D_1 = closedPlanar3D_1_Temp as ISegmentable3D; - if(segmentable3D_1 == null) + if (segmentable3D_1 == null) { throw new System.NotImplementedException(); } @@ -60,7 +63,7 @@ public static double Distance(this ISegmentable3D segmentable3D_1, ISegmentable3 } double result = double.MaxValue; - foreach(Segment3D segment3D_1 in segment3Ds_1) + foreach (Segment3D segment3D_1 in segment3Ds_1) { foreach (Segment3D segment3D_2 in segment3Ds_2) { @@ -77,22 +80,22 @@ public static double Distance(this ISegmentable3D segmentable3D_1, ISegmentable3 public static double Distance(this ISegmentable3D segmentable3D, Point3D point3D) { - if(segmentable3D == null || point3D == null) + if (segmentable3D == null || point3D == null) { return double.NaN; } List segment3Ds = segmentable3D.GetSegments(); - if(segment3Ds == null || segment3Ds.Count == 0) + if (segment3Ds == null || segment3Ds.Count == 0) { return double.NaN; } double result = double.MaxValue; - foreach(Segment3D segment3D in segment3Ds) + foreach (Segment3D segment3D in segment3Ds) { double distance = segment3D.Distance(point3D); - if(distance < result) + if (distance < result) { result = distance; } @@ -190,4 +193,4 @@ public static double Distance(this Plane plane, IEnumerable shells, doubl return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Eigenvectors.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Eigenvectors.cs index d101a5d7d..053e7931e 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Eigenvectors.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Eigenvectors.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Query { @@ -34,4 +37,4 @@ private static Vector3D[] Eigenvectors(this Math.Matrix matrix, double tolerance return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/ElevationDictionary.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/ElevationDictionary.cs index aa89b6d91..081520c39 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/ElevationDictionary.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/ElevationDictionary.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Geometry.Spatial @@ -49,4 +52,4 @@ public static Dictionary> ElevationDictionary(this IEnumera return ElevationDictionary(face3Ds, out double maxElevation, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Explode.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Explode.cs index 024f0bb18..a821278e3 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Explode.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Explode.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -51,4 +54,4 @@ public static List Explode(this IEnumerable curve3Ds) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Extend.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Extend.cs index 426973eca..75f1e0dd9 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Extend.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Extend.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using System.Collections.Generic; namespace SAM.Geometry.Spatial @@ -66,4 +69,4 @@ public static Face3D Extend(this Face3D face3D, Plane plane, double tolerance_An return Face3D.Create(plane_Face3D, polygon2D, face3D.InternalEdge2Ds); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/External.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/External.cs index 131764364..3b6663ee9 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/External.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/External.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Spatial @@ -55,4 +58,4 @@ public static List External(IEnumerable boundingBo return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/ExtremePoints.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/ExtremePoints.cs index 03f30d3fb..a9bbef94d 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/ExtremePoints.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/ExtremePoints.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Spatial @@ -42,10 +45,10 @@ public static void ExtremePoints(this IEnumerable point3Ds, out Point3D } } - if(distance_Max != double.MinValue) + if (distance_Max != double.MinValue) { distance = distance_Max; } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Face3Ds.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Face3Ds.cs index 0945f16e0..59156beee 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Face3Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Face3Ds.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -15,24 +18,24 @@ public static List Face3Ds(this IEnumerable geometry3Ds, if (geometry3D is Segment3D) continue; - if(geometry3D is Shell) + if (geometry3D is Shell) { List face3Ds = ((Shell)geometry3D).Face3Ds; - if(face3Ds != null && face3Ds.Count > 0) + if (face3Ds != null && face3Ds.Count > 0) { result.AddRange(face3Ds); continue; } } - if(geometry3D is Mesh3D) + if (geometry3D is Mesh3D) { List triangle3Ds = ((Mesh3D)geometry3D).GetTriangles(); - if(triangle3Ds != null && triangle3Ds.Count != 0) + if (triangle3Ds != null && triangle3Ds.Count != 0) { - foreach(Triangle3D triangle3D in triangle3Ds) + foreach (Triangle3D triangle3D in triangle3Ds) { - if(triangle3D == null || !triangle3D.IsValid() || triangle3D.GetArea() < tolerance) + if (triangle3D == null || !triangle3D.IsValid() || triangle3D.GetArea() < tolerance) { continue; } @@ -53,7 +56,7 @@ public static List Face3Ds(this IEnumerable geometry3Ds, if (geometry3D is IClosedPlanar3D) { IClosedPlanar3D closedPlanar3D = (IClosedPlanar3D)geometry3D; - if(closedPlanar3D.GetArea() < tolerance) + if (closedPlanar3D.GetArea() < tolerance) { continue; } @@ -85,13 +88,13 @@ public static List Face3Ds(this Extrusion extrusion, double tolerance = public static List Face3Ds(this PlanarIntersectionResult planarIntersectionResult, double snapTolerance = Core.Tolerance.MacroDistance, double tolerance = Core.Tolerance.Distance) { - if(planarIntersectionResult == null || !planarIntersectionResult.Intersecting) + if (planarIntersectionResult == null || !planarIntersectionResult.Intersecting) { return null; } Plane plane = planarIntersectionResult.Plane; - if(plane == null) + if (plane == null) { return null; } @@ -99,7 +102,7 @@ public static List Face3Ds(this PlanarIntersectionResult planarIntersect List result = new List(); List segmentable2Ds = planarIntersectionResult.GetGeometry2Ds(); - if(segmentable2Ds == null || segmentable2Ds.Count < 3) + if (segmentable2Ds == null || segmentable2Ds.Count < 3) { return result; } @@ -108,7 +111,7 @@ public static List Face3Ds(this PlanarIntersectionResult planarIntersect segment2Ds = Planar.Query.Snap(segment2Ds, true, snapTolerance); List face2Ds = Planar.Create.Face2Ds(segmentable2Ds, EdgeOrientationMethod.Undefined, tolerance); - if(face2Ds == null || face2Ds.Count == 0) + if (face2Ds == null || face2Ds.Count == 0) { return result; } @@ -117,4 +120,4 @@ public static List Face3Ds(this PlanarIntersectionResult planarIntersect return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Fill.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Fill.cs index cc0f7b375..e0ede3f8d 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Fill.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Fill.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using System.Collections.Generic; namespace SAM.Geometry.Spatial @@ -7,13 +10,13 @@ public static partial class Query { public static List Fill(this Face3D face3D, IEnumerable face3Ds, double offset = 0.1, double tolerance_Area = Core.Tolerance.MacroDistance, double tolerance_Distance = Core.Tolerance.Distance) { - if(face3D == null || face3Ds == null) + if (face3D == null || face3Ds == null) { return null; } Plane plane = face3D.GetPlane(); - if(plane == null) + if (plane == null) { return null; } @@ -21,21 +24,21 @@ public static List Fill(this Face3D face3D, IEnumerable face3Ds, Face2D face2D = plane.Convert(face3D); List face2Ds = new List(); - - foreach(Face3D face3D_Temp in face3Ds) + + foreach (Face3D face3D_Temp in face3Ds) { - if(face3D_Temp == null) + if (face3D_Temp == null) { continue; } Face2D face2D_Temp = plane.Convert(plane.Project(face3D_Temp)); - if(face2D_Temp == null || !face2D_Temp.IsValid()) + if (face2D_Temp == null || !face2D_Temp.IsValid()) { continue; } - if(face2D_Temp.GetArea() < tolerance_Area) + if (face2D_Temp.GetArea() < tolerance_Area) { continue; } @@ -47,4 +50,4 @@ public static List Fill(this Face3D face3D, IEnumerable face3Ds, return Planar.Query.Fill(face2D, face2Ds, offset, tolerance_Area, tolerance_Distance)?.ConvertAll(x => plane.Convert(x)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/FixEdges.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/FixEdges.cs index c3e6a60b0..8cec66f7e 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/FixEdges.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/FixEdges.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -19,21 +22,21 @@ public static List FixEdges(this Face3D face3D, double tolerance = Core. public static Shell FixEdges(this Shell shell, double tolerance = Core.Tolerance.Distance) { List face3Ds = shell?.Face3Ds; - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return null; } List face3Ds_Result = new List(); - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { - if(face3D == null) + if (face3D == null) { continue; } List face3D_FixEdges = face3D.FixEdges(tolerance); - if(face3D_FixEdges == null || face3D_FixEdges.Count == 0) + if (face3D_FixEdges == null || face3D_FixEdges.Count == 0) { face3Ds_Result.Add(face3D); continue; @@ -46,4 +49,4 @@ public static Shell FixEdges(this Shell shell, double tolerance = Core.Tolerance } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Grid.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Grid.cs index 199955df1..65eb4be63 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Grid.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Grid.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Planar; using System.Collections.Generic; @@ -11,7 +14,7 @@ public static List Grid(this IEnumerable closedPlana if (closedPlanar3Ds == null || double.IsNaN(x) || double.IsNaN(y)) return null; - if(plane == null) + if (plane == null) { plane = Plane.WorldXY; double z = double.MaxValue; @@ -32,13 +35,13 @@ public static List Grid(this IEnumerable closedPlana } List boundable2Ds = new List(); - foreach(IClosedPlanar3D closedPlanar3D in closedPlanar3Ds) + foreach (IClosedPlanar3D closedPlanar3D in closedPlanar3Ds) { PlanarIntersectionResult planarIntersectionResult = Create.PlanarIntersectionResult(plane, closedPlanar3D, tolerance_Angle, tolerance_Distance); if (planarIntersectionResult == null || !planarIntersectionResult.Intersecting) continue; - foreach(ISAMGeometry3D sAMGeometry3D in planarIntersectionResult.Geometry3Ds) + foreach (ISAMGeometry3D sAMGeometry3D in planarIntersectionResult.Geometry3Ds) { IBoundable3D boundable3D = sAMGeometry3D as IBoundable3D; if (boundable3D == null) @@ -70,4 +73,4 @@ public static List Grid(this IEnumerable closedPlana return segment2Ds.ConvertAll(segment2D => plane.Convert(segment2D)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Horizontal.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Horizontal.cs index c119844c0..70b1b8432 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Horizontal.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Horizontal.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Query { @@ -13,7 +16,7 @@ public static bool Horizontal(this Plane plane, double tolerance = Core.Toleranc public static bool Horizontal(this IClosedPlanar3D closedPlanar3D, double tolerance = Core.Tolerance.Distance) { Plane plane = closedPlanar3D?.GetPlane(); - if(plane == null) + if (plane == null) { return false; } @@ -21,4 +24,4 @@ public static bool Horizontal(this IClosedPlanar3D closedPlanar3D, double tolera return Horizontal(plane, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/InRange.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/InRange.cs index f2fd474c7..5d8015ffd 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/InRange.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/InRange.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System; using System.Collections.Generic; @@ -285,4 +288,4 @@ public static List InRange(this Shell shell, IEnumerable face3Ds return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Inside.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Inside.cs index a53b85142..9868609a1 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Inside.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Inside.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -38,7 +41,7 @@ public static List Inside(this Shell shell, IEnumerable face3Ds, return null; Dictionary dictionary = new Dictionary(); - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { ISegmentable3D segmentable3D = face3D.GetExternalEdge3D() as ISegmentable3D; if (segmentable3D == null) @@ -60,13 +63,13 @@ public static List Inside(this Shell shell, IEnumerable face3Ds, public static bool Inside(this BoundingBox3D boundingBox3D, ISegmentable3D segmentable3D, bool acceptOnEdge = true, double tolerance = Core.Tolerance.Distance) { - if(boundingBox3D == null || segmentable3D == null) + if (boundingBox3D == null || segmentable3D == null) { return false; } List segment3Ds = segmentable3D.GetSegments(); - if(segment3Ds == null || segment3Ds.Count == 0) + if (segment3Ds == null || segment3Ds.Count == 0) { return false; } @@ -76,19 +79,19 @@ public static bool Inside(this BoundingBox3D boundingBox3D, ISegmentable3D segme public static bool Inside(this BoundingBox3D boundingBox3D, Face3D face3D, bool acceptOnEdge = true, double tolerance = Core.Tolerance.Distance) { - if(boundingBox3D == null || face3D == null) + if (boundingBox3D == null || face3D == null) { return false; } IClosedPlanar3D closedPlanar3D = face3D.GetExternalEdge3D(); - if(closedPlanar3D == null) + if (closedPlanar3D == null) { return false; } ISegmentable3D segmentable3D = closedPlanar3D as ISegmentable3D; - if(segmentable3D == null) + if (segmentable3D == null) { throw new System.NotImplementedException(); } @@ -98,25 +101,25 @@ public static bool Inside(this BoundingBox3D boundingBox3D, Face3D face3D, bool public static bool Inside(this BoundingBox3D boundingBox3D, Shell shell, bool acceptOnEdge = true, double tolerance = Core.Tolerance.Distance) { - if(boundingBox3D == null || shell == null) + if (boundingBox3D == null || shell == null) { return false; } List face3Ds = shell.Face3Ds; - if(face3Ds == null) + if (face3Ds == null) { return false; } - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { - if(face3D == null) + if (face3D == null) { continue; } - if(!Inside(boundingBox3D, face3D, acceptOnEdge, tolerance)) + if (!Inside(boundingBox3D, face3D, acceptOnEdge, tolerance)) { return false; } @@ -125,4 +128,4 @@ public static bool Inside(this BoundingBox3D boundingBox3D, Shell shell, bool ac return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/InternalFace3Ds.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/InternalFace3Ds.cs index 366cb9ae5..64231226c 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/InternalFace3Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/InternalFace3Ds.cs @@ -1,43 +1,46 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Spatial { public static partial class Query { - public static List InternalFace3Ds(this Face3D face3D, Shell shell, double silverSpacing = Core.Tolerance.MacroDistance, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance= Core.Tolerance.Distance) + public static List InternalFace3Ds(this Face3D face3D, Shell shell, double silverSpacing = Core.Tolerance.MacroDistance, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { - if(face3D == null || shell == null) + if (face3D == null || shell == null) { return null; } List face3Ds_Temp = face3D.Split(shell, tolerance_Angle, tolerance_Distance); - if(face3Ds_Temp == null) + if (face3Ds_Temp == null) { face3Ds_Temp = new List(); } - if(face3Ds_Temp.Count == 0) + if (face3Ds_Temp.Count == 0) { face3Ds_Temp.Add(new Face3D(face3D)); } List result = new List(); - foreach(Face3D face3D_Temp in face3Ds_Temp) + foreach (Face3D face3D_Temp in face3Ds_Temp) { - if(face3D_Temp == null || !face3D_Temp.IsValid()) + if (face3D_Temp == null || !face3D_Temp.IsValid()) { continue; } Point3D point3D = face3D_Temp.InternalPoint3D(tolerance_Distance); - if(point3D == null || !point3D.IsValid()) + if (point3D == null || !point3D.IsValid()) { continue; } - if(!shell.Inside(point3D, silverSpacing, tolerance_Distance)) + if (!shell.Inside(point3D, silverSpacing, tolerance_Distance)) { continue; } @@ -50,16 +53,16 @@ public static List InternalFace3Ds(this Face3D face3D, Shell shell, doub public static List InternalFace3Ds(this Face3D face3D, IEnumerable shells, double silverSpacing = Core.Tolerance.MacroDistance, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { - if(face3D == null || shells == null || shells.Count() == 0) + if (face3D == null || shells == null || shells.Count() == 0) { return null; } List face3Ds = new List(); - foreach(Shell shell in shells) + foreach (Shell shell in shells) { List face3Ds_Shell = face3D.InternalFace3Ds(shell, silverSpacing, tolerance_Angle, tolerance_Distance); - if(face3Ds_Shell != null && face3Ds_Shell.Count != 0) + if (face3Ds_Shell != null && face3Ds_Shell.Count != 0) { face3Ds.AddRange(face3Ds_Shell); } @@ -68,4 +71,4 @@ public static List InternalFace3Ds(this Face3D face3D, IEnumerable point3Ds = boundingBox3D?.GetPoints(); - if(point3Ds == null || point3Ds.Count == 0) + if (point3Ds == null || point3Ds.Count == 0) { return false; } bool above = plane.Above(point3Ds[0], tolerance); - for(int i = 1; i < point3Ds.Count; i++) + for (int i = 1; i < point3Ds.Count; i++) { bool above_Temp = plane.Above(point3Ds[i], tolerance); - if(above != above_Temp) + if (above != above_Temp) { return true; } @@ -33,7 +36,7 @@ public static bool Intersect(this Plane plane, BoundingBox3D boundingBox3D, doub public static bool Intersect(this Face3D face3D, Point3D point3D, Vector3D vector3D, double tolerance = Core.Tolerance.Distance) { - if(face3D == null || point3D == null || vector3D == null) + if (face3D == null || point3D == null || vector3D == null) { return false; } @@ -49,4 +52,4 @@ public static bool Intersect(this Face3D face3D, Point3D point3D, Vector3D vecto return point3D_Intersection != null && point3D_Intersection.IsValid(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Intersection.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Intersection.cs index 2c2b81749..de07e8676 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Intersection.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Intersection.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System; using System.Collections.Generic; @@ -82,7 +85,7 @@ public static List Intersection(this Shell shell_1, Shell shell_2, double bool inside = false; for (int i = boundaries_1.Count - 1; i >= 0; i--) { - if(!boundingBox3D_2.InRange(boundaries_1[i].Item1, tolerance_Distance)) + if (!boundingBox3D_2.InRange(boundaries_1[i].Item1, tolerance_Distance)) { boundaries_1.RemoveAt(i); continue; @@ -98,9 +101,9 @@ public static List Intersection(this Shell shell_1, Shell shell_2, double } List> boundaries_On = boundaries_2.FindAll(x => x.Item1.InRange(point3D, tolerance_Distance) && x.Item2.On(point3D, tolerance_Distance)); - if(boundaries_On == null || boundaries_On.Count == 0) + if (boundaries_On == null || boundaries_On.Count == 0) { - if(shell_2.Inside(point3D, silverSpacing, tolerance_Distance)) + if (shell_2.Inside(point3D, silverSpacing, tolerance_Distance)) { inside = true; } @@ -149,16 +152,16 @@ public static List Intersection(this Shell shell_1, Shell shell_2, double boundaries_On.ForEach(x => boundaries_1.Remove(x)); } - if(!inside) + if (!inside) { boundaries_1 = shell_1_Temp.Boundaries; boundaries_2 = shell_2_Temp.Boundaries; - foreach(Tuple boundary in boundaries_1) + foreach (Tuple boundary in boundaries_1) { Point3D point3D = boundary.Item2.InternalPoint3D(tolerance_Distance); List> boundaries_2_Temp = boundaries_2.FindAll(x => x.Item1.InRange(point3D, tolerance_Distance) && x.Item2.On(point3D, tolerance_Distance)); - if(boundaries_2_Temp == null || boundaries_2_Temp.Count == 0) + if (boundaries_2_Temp == null || boundaries_2_Temp.Count == 0) { return new List(); } @@ -218,4 +221,4 @@ public static List Intersection(this Shell shell_1, Shell shell_2, double } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/IntersectionDictionary.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/IntersectionDictionary.cs index c97893b80..d119ff2f2 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/IntersectionDictionary.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/IntersectionDictionary.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -11,7 +14,7 @@ public static Dictionary IntersectionDictionary(this Point3D po if (face3Ds == null || point3D == null || vector3D == null) return null; - List> tuples= new List>(); + List> tuples = new List>(); List point3Ds = new List(); foreach (Face3D face3D in face3Ds) { @@ -40,7 +43,7 @@ public static Dictionary IntersectionDictionary(this Point3D po Dictionary result = new Dictionary(); - foreach(Point3D point3D_Temp in point3Ds) + foreach (Point3D point3D_Temp in point3Ds) { foreach (Tuple tuple in tuples.FindAll(x => x.Item1 == point3D_Temp)) result[tuple.Item2] = tuple.Item1; @@ -49,4 +52,4 @@ public static Dictionary IntersectionDictionary(this Point3D po return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Intersections.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Intersections.cs index ff3c2050f..9e09995d9 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Intersections.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Intersections.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Spatial @@ -16,7 +19,7 @@ public static List Intersections(this IEnumerable face3Ds, double if (count < 2) return result; - for(int i =0; i < count - 1; i++) + for (int i = 0; i < count - 1; i++) { Face3D face3D_1 = face3Ds.ElementAt(i); if (face3D_1 == null) @@ -40,11 +43,11 @@ public static List Intersections(this IEnumerable face3Ds, double return result; } - + public static List Intersections(this ISegmentable3D segmentable3D_1, ISegmentable3D segmentable3D_2, double tolerance = Core.Tolerance.Distance) { List segment3Ds_1 = segmentable3D_1?.GetSegments(); - if(segment3Ds_1 == null) + if (segment3Ds_1 == null) { return null; } @@ -56,12 +59,12 @@ public static List Intersections(this ISegmentable3D segmentable3D_1, I } List result = new List(); - foreach(Segment3D segment3D_1 in segment3Ds_1) + foreach (Segment3D segment3D_1 in segment3Ds_1) { - foreach(Segment3D segment3D_2 in segment3Ds_2) + foreach (Segment3D segment3D_2 in segment3Ds_2) { Point3D point3D = segment3D_1.Intersection(segment3D_2, true, tolerance); - if(point3D == null) + if (point3D == null) { continue; } @@ -72,19 +75,19 @@ public static List Intersections(this ISegmentable3D segmentable3D_1, I return result; } - + public static List Intersections(this ISegmentable3D segmentable3D, IEnumerable segmentable3Ds, double tolerance = Core.Tolerance.Distance) { - if(segmentable3D == null || segmentable3Ds == null) + if (segmentable3D == null || segmentable3Ds == null) { return null; } List result = new List(); - foreach(ISegmentable3D segmentable3D_Temp in segmentable3Ds) + foreach (ISegmentable3D segmentable3D_Temp in segmentable3Ds) { List point3Ds_Temp = segmentable3D.Intersections(segmentable3D_Temp); - if(point3Ds_Temp == null || point3Ds_Temp.Count == 0) + if (point3Ds_Temp == null || point3Ds_Temp.Count == 0) { continue; } @@ -97,7 +100,7 @@ public static List Intersections(this ISegmentable3D segmentable3D, IEn public static List Intersections(this Point3D point3D, Vector3D vector3D, IEnumerable face3Ds, bool keepDirection, bool sort = true, double tolerance = Core.Tolerance.Distance) { - if(point3D == null || vector3D == null || face3Ds == null) + if (point3D == null || vector3D == null || face3Ds == null) { return null; } @@ -107,33 +110,33 @@ public static List Intersections(this Point3D point3D, Vector3D vector3 public static List Intersections(this Shell shell, ISegmentable3D segmentable3D, double tolerance = Core.Tolerance.Distance) { - if(shell == null || segmentable3D == null) + if (shell == null || segmentable3D == null) { return null; } List face3Ds = shell.Face3Ds; - if(face3Ds == null) + if (face3Ds == null) { return null; } List result = new List(); - if(!shell.GetBoundingBox().InRange(segmentable3D.GetBoundingBox(), tolerance)) + if (!shell.GetBoundingBox().InRange(segmentable3D.GetBoundingBox(), tolerance)) { return result; } - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { PlanarIntersectionResult planarIntersectionResult = Create.PlanarIntersectionResult(face3D, segmentable3D, tolerance); - if(planarIntersectionResult == null || !planarIntersectionResult.Intersecting) + if (planarIntersectionResult == null || !planarIntersectionResult.Intersecting) { continue; } List point3Ds_Face3D = planarIntersectionResult.GetGeometry3Ds(); - if(point3Ds_Face3D == null || point3Ds_Face3D.Count == 0) + if (point3Ds_Face3D == null || point3Ds_Face3D.Count == 0) { continue; } @@ -144,4 +147,4 @@ public static List Intersections(this Shell shell, ISegmentable3D segme return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/IsNormalized.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/IsNormalized.cs index 7c7838ffc..f699b3b09 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/IsNormalized.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/IsNormalized.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -34,7 +37,7 @@ public static bool IsNormalized(this IClosedPlanar3D closedPlanar3D, Orientation } Vector3D normal = plane.Normal; - if(normal == null) + if (normal == null) { return false; } @@ -75,4 +78,4 @@ public static bool IsNormalized(this IClosedPlanar3D closedPlanar3D, Orientation } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/IsValid.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/IsValid.cs index d8991b262..9bf919407 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/IsValid.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/IsValid.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -10,7 +13,7 @@ public static bool IsValid(this Vector3D vector3D) { return false; } - + double x = vector3D.X; double y = vector3D.Y; double z = vector3D.Z; @@ -45,17 +48,17 @@ public static bool IsValid(Point3D point3D) public static bool IsValid(this Plane plane) { - if(plane == null) + if (plane == null) { return false; } - if(!IsValid(plane.Origin)) + if (!IsValid(plane.Origin)) { return false; } - if(!IsValid(plane.Normal)) + if (!IsValid(plane.Normal)) { return false; } @@ -76,20 +79,20 @@ public static bool IsValid(this Polygon3D polygon3D) } Plane plane = polygon3D.GetPlane(); - if(!IsValid(plane)) + if (!IsValid(plane)) { return false; } List point3Ds = polygon3D.GetPoints(); - if(point3Ds == null || point3Ds.Count < 3) + if (point3Ds == null || point3Ds.Count < 3) { return false; } - foreach(Point3D point3D in point3Ds) + foreach (Point3D point3D in point3Ds) { - if(!IsValid(point3D)) + if (!IsValid(point3D)) { return false; } @@ -100,22 +103,22 @@ public static bool IsValid(this Polygon3D polygon3D) public static bool IsValid(this BoundingBox3D boundingBox3D) { - if(boundingBox3D == null) + if (boundingBox3D == null) { return false; } - if(!IsValid(boundingBox3D.Min)) + if (!IsValid(boundingBox3D.Min)) { return false; } - if(!IsValid(boundingBox3D.Max)) + if (!IsValid(boundingBox3D.Max)) { return false; } - if(boundingBox3D.Min.Equals(boundingBox3D.Max)) + if (boundingBox3D.Min.Equals(boundingBox3D.Max)) { return false; } @@ -125,17 +128,17 @@ public static bool IsValid(this BoundingBox3D boundingBox3D) public static bool IsValid(this Circle3D circle3D) { - if(circle3D == null) + if (circle3D == null) { return false; } - if(!IsValid(circle3D.GetPlane())) + if (!IsValid(circle3D.GetPlane())) { return false; } - if(double.IsNaN(circle3D.Radius)) + if (double.IsNaN(circle3D.Radius)) { return false; } @@ -145,25 +148,25 @@ public static bool IsValid(this Circle3D circle3D) public static bool IsValid(this Face3D face3D) { - if(face3D == null) + if (face3D == null) { return false; } - - if(!IsValid(face3D.GetPlane())) + + if (!IsValid(face3D.GetPlane())) { return false; } - if(!Planar.Query.IsValid(face3D.ExternalEdge2D)) + if (!Planar.Query.IsValid(face3D.ExternalEdge2D)) { return false; } List closed2Ds = face3D.InternalEdge2Ds; - if(closed2Ds != null && closed2Ds.Count != 0) + if (closed2Ds != null && closed2Ds.Count != 0) { - foreach(Planar.IClosed2D closed2D in closed2Ds) + foreach (Planar.IClosed2D closed2D in closed2Ds) { if (!Planar.Query.IsValid(closed2D)) { @@ -177,17 +180,17 @@ public static bool IsValid(this Face3D face3D) public static bool IsValid(this Extrusion extrusion) { - if(extrusion == null) + if (extrusion == null) { return false; } - if(!IsValid(extrusion.Vector)) + if (!IsValid(extrusion.Vector)) { return false; } - if(!IsValid(extrusion.Face3D)) + if (!IsValid(extrusion.Face3D)) { return false; } @@ -197,17 +200,17 @@ public static bool IsValid(this Extrusion extrusion) public static bool IsValid(this Line3D line3D) { - if(line3D == null) + if (line3D == null) { return false; } - if(!IsValid(line3D.Origin)) + if (!IsValid(line3D.Origin)) { return false; } - if(!IsValid(line3D.Direction)) + if (!IsValid(line3D.Direction)) { return false; } @@ -217,7 +220,7 @@ public static bool IsValid(this Line3D line3D) public static bool IsValid(this ICurve3D curve3D) { - if(curve3D == null) + if (curve3D == null) { return false; } @@ -288,7 +291,7 @@ public static bool IsValid(this Rectangle3D rectangle3D) return false; } - if(!IsValid(rectangle3D.GetPlane())) + if (!IsValid(rectangle3D.GetPlane())) { return false; } @@ -303,17 +306,17 @@ public static bool IsValid(this Rectangle3D rectangle3D) public static bool IsValid(this Segment3D segment3D) { - if(segment3D == null) + if (segment3D == null) { return false; } - if(!IsValid(segment3D.GetStart())) + if (!IsValid(segment3D.GetStart())) { return false; } - if(!IsValid(segment3D.Direction)) + if (!IsValid(segment3D.Direction)) { return false; } @@ -323,13 +326,13 @@ public static bool IsValid(this Segment3D segment3D) public static bool IsValid(this Shell shell) { - if(shell == null) + if (shell == null) { return false; } List face3Ds = shell?.Face3Ds; - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return false; } @@ -339,17 +342,17 @@ public static bool IsValid(this Shell shell) public static bool IsValid(this Sphere sphere) { - if(sphere == null) + if (sphere == null) { return false; } - if(!IsValid(sphere.Origin)) + if (!IsValid(sphere.Origin)) { return false; } - if(double.IsNaN(sphere.Radius)) + if (double.IsNaN(sphere.Radius)) { return false; } @@ -359,7 +362,7 @@ public static bool IsValid(this Sphere sphere) public static bool IsValid(this IClosed3D closed3D) { - if(closed3D == null) + if (closed3D == null) { return false; } @@ -369,12 +372,12 @@ public static bool IsValid(this IClosed3D closed3D) public static bool IsValid(this Surface surface) { - if(surface == null) + if (surface == null) { return false; } - if(!IsValid(surface.ExternalEdge3D)) + if (!IsValid(surface.ExternalEdge3D)) { return false; } @@ -385,7 +388,7 @@ public static bool IsValid(this Surface surface) public static bool IsValid(this Triangle3D triangle3D) { List point3Ds = triangle3D?.GetPoints(); - if(point3Ds == null || point3Ds.Count !=3) + if (point3Ds == null || point3Ds.Count != 3) { return false; } @@ -393,4 +396,4 @@ public static bool IsValid(this Triangle3D triangle3D) return point3Ds.TrueForAll(x => IsValid(x)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Location.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Location.cs index 19904c7da..592d10568 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Location.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Location.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Query { @@ -14,4 +17,4 @@ public static Point3D Location(this IClosedPlanar3D closedPlanar3D) return plane.Origin; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Max.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Max.cs index 0c27b2d61..bd4719b99 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Max.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Max.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Spatial @@ -31,4 +34,4 @@ public static Point3D Max(this Point3D point3D_1, Point3D point3D_2) return new Point3D(System.Math.Max(point3D_1.X, point3D_2.X), System.Math.Max(point3D_1.Y, point3D_2.Y), System.Math.Max(point3D_1.Z, point3D_2.Z)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/MaxElevation.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/MaxElevation.cs index 66de1a68f..84627068f 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/MaxElevation.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/MaxElevation.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Spatial @@ -31,11 +34,11 @@ public static double MaxElevation(this IEnumerable face3Ds) public static double MaxElevation(this Face3D face3D) { - if(face3D == null) + if (face3D == null) { return double.NaN; } - + BoundingBox3D boundingBox3D = face3D.GetBoundingBox(); if (boundingBox3D == null) return double.NaN; @@ -43,4 +46,4 @@ public static double MaxElevation(this Face3D face3D) return boundingBox3D.Max.Z; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/MaxIntersectionSegment3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/MaxIntersectionSegment3D.cs index 9faaa94a2..b918480f9 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/MaxIntersectionSegment3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/MaxIntersectionSegment3D.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -6,38 +9,38 @@ public static partial class Query { public static Segment3D MaxIntersectionSegment3D(this Plane plane, IClosedPlanar3D closedPlanar3D) { - if(plane == null || closedPlanar3D == null) + if (plane == null || closedPlanar3D == null) { return null; } - if(closedPlanar3D is Face3D) + if (closedPlanar3D is Face3D) { return MaxIntersectionSegment3D(plane, ((Face3D)closedPlanar3D).GetExternalEdge3D()); } - if(!(closedPlanar3D is ISegmentable3D)) + if (!(closedPlanar3D is ISegmentable3D)) { throw new System.NotImplementedException(); } PlanarIntersectionResult planarIntersectionResult = Create.PlanarIntersectionResult(plane, closedPlanar3D); - if(planarIntersectionResult == null || !planarIntersectionResult.Intersecting) + if (planarIntersectionResult == null || !planarIntersectionResult.Intersecting) { return null; } List segmentable3Ds = planarIntersectionResult.GetGeometry3Ds(); - if(segmentable3Ds == null || segmentable3Ds.Count == 0) + if (segmentable3Ds == null || segmentable3Ds.Count == 0) { return null; } List point3Ds = new List(); - foreach(ISegmentable3D segmentable3D in segmentable3Ds) + foreach (ISegmentable3D segmentable3D in segmentable3Ds) { List point3Ds_Temp = segmentable3D?.GetPoints(); - if(point3Ds_Temp == null) + if (point3Ds_Temp == null) { continue; } @@ -45,13 +48,13 @@ public static Segment3D MaxIntersectionSegment3D(this Plane plane, IClosedPlanar point3Ds.AddRange(point3Ds_Temp); } - if(point3Ds == null || point3Ds.Count < 2) + if (point3Ds == null || point3Ds.Count < 2) { return null; } point3Ds.ExtremePoints(out Point3D point3D_1, out Point3D point3D_2); - if(point3D_1 == null || point3D_2 == null || point3D_1 == point3D_2) + if (point3D_1 == null || point3D_2 == null || point3D_1 == point3D_2) { return null; } @@ -60,4 +63,4 @@ public static Segment3D MaxIntersectionSegment3D(this Plane plane, IClosedPlanar return new Segment3D(point3D_1, point3D_2); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/MaxRectangle3D.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/MaxRectangle3D.cs index 51050c49a..9ab0262e8 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/MaxRectangle3D.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/MaxRectangle3D.cs @@ -1,32 +1,35 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Query { public static Rectangle3D MaxRectangle3D(this IClosedPlanar3D closedPlanar3D) { - if(closedPlanar3D == null) + if (closedPlanar3D == null) { return null; } IClosedPlanar3D closedPlanar3D_Temp = closedPlanar3D; - if(closedPlanar3D_Temp is Face3D) + if (closedPlanar3D_Temp is Face3D) { closedPlanar3D_Temp = ((Face3D)closedPlanar3D_Temp).GetExternalEdge3D(); - if(closedPlanar3D_Temp == null) + if (closedPlanar3D_Temp == null) { return null; } } Plane plane = closedPlanar3D_Temp.GetPlane(); - if(plane == null) + if (plane == null) { return null; } Planar.ISegmentable2D segmentable2D = plane.Convert(closedPlanar3D_Temp) as Planar.ISegmentable2D; - if(segmentable2D == null) + if (segmentable2D == null) { throw new System.NotImplementedException(); } @@ -36,4 +39,4 @@ public static Rectangle3D MaxRectangle3D(this IClosedPlanar3D closedPlanar3D) return plane.Convert(rectangle2D); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Merge.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Merge.cs index 008c6f617..63e9f2d90 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Merge.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Merge.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -7,7 +10,7 @@ public static partial class Query public static Shell Merge(this Shell shell, double tolerance = Core.Tolerance.Distance) { List face3Ds = shell?.Face3Ds; - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return null; } @@ -15,4 +18,4 @@ public static Shell Merge(this Shell shell, double tolerance = Core.Tolerance.Di return new Shell(Union(face3Ds, tolerance)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Mid.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Mid.cs index cea46a1d6..fbddaa754 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Mid.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Mid.cs @@ -1,10 +1,13 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Query { public static Point3D Mid(this Point3D point3D_1, Point3D point3D_2) { - if (point3D_1 == null || point3D_2 == null ) + if (point3D_1 == null || point3D_2 == null) return null; return new Point3D((point3D_1.X + point3D_2.X) / 2, (point3D_1.Y + point3D_2.Y) / 2, (point3D_1.Z + point3D_2.Z) / 2); @@ -18,4 +21,4 @@ public static Point3D Mid(this Segment3D segment3D) return Mid(segment3D.GetStart(), segment3D.GetEnd()); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Min.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Min.cs index 86f4ea348..259807d1f 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Min.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Min.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Spatial @@ -31,4 +34,4 @@ public static Point3D Min(this IEnumerable point3Ds) return new Point3D(x, y, z); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/MinDimension.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/MinDimension.cs index f0acb7c7d..a8f19b4bf 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/MinDimension.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/MinDimension.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -6,7 +9,7 @@ public static partial class Query { public static double MinDimension(this BoundingBox3D boundingBox3D) { - if(boundingBox3D == null) + if (boundingBox3D == null) { return double.NaN; } @@ -16,16 +19,16 @@ public static double MinDimension(this BoundingBox3D boundingBox3D) public static double MinDimension(this IEnumerable boundingBox3Ds) { - if(boundingBox3Ds == null) + if (boundingBox3Ds == null) { return double.NaN; } double result = double.MaxValue; - foreach(BoundingBox3D boundingBox3D in boundingBox3Ds) + foreach (BoundingBox3D boundingBox3D in boundingBox3Ds) { double min = boundingBox3D.MinDimension(); - if(min < result) + if (min < result) { result = min; } @@ -34,4 +37,4 @@ public static double MinDimension(this IEnumerable boundingBox3Ds return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/NakedSegment3Ds.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/NakedSegment3Ds.cs index 675aa871c..495ca4a4a 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/NakedSegment3Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/NakedSegment3Ds.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Geometry.Spatial @@ -65,7 +68,7 @@ public static List NakedSegment3Ds(this Shell shell, int maxCount = i Point3DCluster point3DCluster = new Point3DCluster(point3Ds, tolerance); List> point3DsList = point3DCluster.Combine(); - if(point3DsList != null && point3DsList.Count != 0) + if (point3DsList != null && point3DsList.Count != 0) { point3Ds = new List(); @@ -74,7 +77,7 @@ public static List NakedSegment3Ds(this Shell shell, int maxCount = i point3Ds.Add(point3Ds_Temp.Average()); } } - + foreach (Point3D point3D in point3Ds) { List> tuples_Temp = tuples.FindAll(x => x.Item1.Inside(point3D, true, tolerance)); @@ -212,4 +215,4 @@ public static List NakedSegment3Ds(this Shell shell, int maxCount = i // return result; //} } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Normal.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Normal.cs index ea1e88eef..497753609 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Normal.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Normal.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Spatial @@ -7,14 +10,14 @@ public static partial class Query { public static Vector3D Normal(this Plane plane, IEnumerable point2Ds) { - if(plane == null || point2Ds == null) + if (plane == null || point2Ds == null) { return null; } int count = point2Ds.Count(); - if(count < 3) + if (count < 3) { return null; } @@ -30,7 +33,7 @@ public static Vector3D Normal(this Plane plane, IEnumerable poin Point3D point3D_3 = plane.Convert(point2Ds.ElementAt(index_3)); Vector3D normal = Normal(point3D_1, point3D_2, point3D_3); - if(normal == null || !normal.IsValid()) + if (normal == null || !normal.IsValid()) { continue; } @@ -53,7 +56,7 @@ public static Vector3D Normal(this IEnumerable point3Ds, double toleran return null; } - if(count == 3) + if (count == 3) { return Normal(point3Ds.ElementAt(0), point3Ds.ElementAt(1), point3Ds.ElementAt(2)); } @@ -114,7 +117,7 @@ public static Vector3D Normal(this IEnumerable point3Ds, double toleran } } - if(result == null) + if (result == null) { return null; } @@ -124,16 +127,16 @@ public static Vector3D Normal(this IEnumerable point3Ds, double toleran Plane plane = new Plane(origin, result); bool invalid = false; - foreach(Point3D point3D in point3Ds) + foreach (Point3D point3D in point3Ds) { - if(plane.Distance(point3D) > tolerance) + if (plane.Distance(point3D) > tolerance) { invalid = true; break; } } - if(invalid) + if (invalid) { normal = new Vector3D(); for (int i = 0; i < count - 1; i++) @@ -147,12 +150,12 @@ public static Vector3D Normal(this IEnumerable point3Ds, double toleran double max = double.MinValue; double max_Temp = double.MinValue; - foreach(Point3D point3D in point3Ds) + foreach (Point3D point3D in point3Ds) { double distance = double.NaN; distance = plane.Distance(point3D); - if(distance > max) + if (distance > max) { max = distance; } @@ -164,7 +167,7 @@ public static Vector3D Normal(this IEnumerable point3Ds, double toleran } } - if(max_Temp < max) + if (max_Temp < max) { result = normal; } @@ -186,4 +189,4 @@ public static Vector3D Normal(this Vector3D axisX, Vector3D axisY) return axisX.CrossProduct(axisY); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/NormalDictionary.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/NormalDictionary.cs index d0b3347c2..e9b67d412 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/NormalDictionary.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/NormalDictionary.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -13,12 +16,12 @@ public static Dictionary NormalDictionary(this Shell shell, bo Dictionary result = new Dictionary(); if (external && face3Ds.Count > 30) { - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { result[face3D] = null; } - System.Threading.Tasks.Parallel.For(0, face3Ds.Count, (int i) => + System.Threading.Tasks.Parallel.For(0, face3Ds.Count, (int i) => { result[face3Ds[i]] = shell.Normal(i, external, silverSpacing, tolerance); }); @@ -37,7 +40,7 @@ public static Dictionary NormalDictionary(this Shell shell, bo public static Dictionary NormalDictionary(this Extrusion extrusion, bool external = true, double silverSpacing = Core.Tolerance.MacroDistance, double tolerance = Core.Tolerance.Distance) { Shell shell = Create.Shell(extrusion); - if(shell == null) + if (shell == null) { return null; } @@ -45,4 +48,4 @@ public static Dictionary NormalDictionary(this Extrusion extru return NormalDictionary(shell, external, silverSpacing, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Normalize.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Normalize.cs index ab727091e..629292390 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Normalize.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Normalize.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -29,9 +32,9 @@ public static T Normalize(this T closedPlanar3D, Orientation orientation = Ge return result is T ? (T)result : default(T); } - public static T Normalize(this Plane plane, T closed2D, Orientation orientation = Geometry.Orientation.CounterClockwise, EdgeOrientationMethod edgeOrientationMethod = EdgeOrientationMethod.Opposite, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) where T: Planar.IClosed2D + public static T Normalize(this Plane plane, T closed2D, Orientation orientation = Geometry.Orientation.CounterClockwise, EdgeOrientationMethod edgeOrientationMethod = EdgeOrientationMethod.Opposite, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) where T : Planar.IClosed2D { - if(plane == null || closed2D == null) + if (plane == null || closed2D == null) { return default(T); } @@ -58,13 +61,13 @@ public static T Normalize(this Plane plane, T closed2D, Orientation orientati } Orientation orientation_Point3Ds = Orientation(plane.Convert(point2Ds), plane.Normal, tolerance_Angle, tolerance_Distance); - if(orientation_Point3Ds == Geometry.Orientation.Undefined || orientation_Point3Ds == Geometry.Orientation.Collinear) + if (orientation_Point3Ds == Geometry.Orientation.Undefined || orientation_Point3Ds == Geometry.Orientation.Collinear) { return null; } List result = new List(point2Ds); - if (orientation_Point3Ds != orientation ) + if (orientation_Point3Ds != orientation) { result.Reverse(); } @@ -74,19 +77,19 @@ public static T Normalize(this Plane plane, T closed2D, Orientation orientati public static Planar.Face2D Normalize(this Plane plane, Planar.Face2D face2D, Orientation orientation = Geometry.Orientation.CounterClockwise, EdgeOrientationMethod edgeOrientationMethod = EdgeOrientationMethod.Opposite, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { - if(plane == null || face2D is null) + if (plane == null || face2D is null) { return null; } Planar.IClosed2D externalEdge2D = face2D.ExternalEdge2D; - if(externalEdge2D == null) + if (externalEdge2D == null) { return null; } externalEdge2D = Normalize(plane, externalEdge2D as dynamic, orientation, tolerance_Angle, tolerance_Distance); - if(externalEdge2D == null) + if (externalEdge2D == null) { return null; } @@ -96,13 +99,13 @@ public static Planar.Face2D Normalize(this Plane plane, Planar.Face2D face2D, Or public static Planar.Polygon2D Normalize(this Plane plane, Planar.Polygon2D polygon2D, Orientation orientation = Geometry.Orientation.CounterClockwise, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { - if(plane == null || polygon2D == null) + if (plane == null || polygon2D == null) { return null; } List point2Ds = Normalize(plane, polygon2D.Points, orientation, tolerance_Angle, tolerance_Distance); - if(point2Ds == null) + if (point2Ds == null) { return null; } @@ -133,7 +136,7 @@ public static Planar.Rectangle2D Normalize(this Plane plane, Planar.Rectangle2D return null; } - if(IsNormalized(plane, rectangle2D, orientation, tolerance_Angle: tolerance_Angle, tolerance_Distance: tolerance_Distance)) + if (IsNormalized(plane, rectangle2D, orientation, tolerance_Angle: tolerance_Angle, tolerance_Distance: tolerance_Distance)) { return new Planar.Rectangle2D(rectangle2D); } @@ -157,4 +160,4 @@ public static Planar.Polyline2D Normalize(this Plane plane, Planar.Polyline2D po return new Planar.Polyline2D(point2Ds); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Normals.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Normals.cs index 050106be8..2f4722a00 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Normals.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Normals.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Spatial @@ -43,4 +46,4 @@ public static List Normals(this IEnumerable point3Ds, double return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Offset.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Offset.cs index 8565c5a2a..e7e5dcec1 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Offset.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Offset.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using System.Collections.Generic; namespace SAM.Geometry.Spatial @@ -52,4 +55,4 @@ public static List Offset(this Polygon3D polygon3D, double offset, do return polygon2Ds.ConvertAll(x => plane.Convert(x)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/On.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/On.cs index 5fe564b95..9ab841b20 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/On.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/On.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -50,7 +53,7 @@ public static bool On(this Plane plane, ISegmentable3D segmentable3D, double tol if (point3Ds == null || point3Ds.Count == 0) return false; - foreach(Point3D point3D in point3Ds) + foreach (Point3D point3D in point3Ds) { if (point3D == null) continue; @@ -64,13 +67,13 @@ public static bool On(this Plane plane, ISegmentable3D segmentable3D, double tol public static bool On(this Plane plane, IPlanar3D planar3D, double tolerance = Core.Tolerance.Distance) { - if(plane == null || planar3D == null) + if (plane == null || planar3D == null) { return false; } Plane plane_Planar3D = planar3D.GetPlane(); - if(plane_Planar3D == null) + if (plane_Planar3D == null) { return false; } @@ -78,4 +81,4 @@ public static bool On(this Plane plane, IPlanar3D planar3D, double tolerance = C return Coplanar(plane, plane_Planar3D, tolerance) && plane.On(plane_Planar3D.Origin, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Orientation.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Orientation.cs index b2fb2f606..61e4517f7 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Orientation.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Orientation.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -6,13 +9,13 @@ public static partial class Query { public static Orientation Orientation(this IClosedPlanar3D closedPlanar3D, Vector3D normal = null, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { - if(closedPlanar3D == null) + if (closedPlanar3D == null) { return Geometry.Orientation.Undefined; } bool? clockwise = Clockwise(closedPlanar3D, normal, tolerance_Angle, tolerance_Distance); - if(clockwise == null || !clockwise.HasValue) + if (clockwise == null || !clockwise.HasValue) { return Geometry.Orientation.Undefined; } @@ -36,4 +39,4 @@ public static Orientation Orientation(this IEnumerable point3Ds, Vector return clockwise.Value ? Geometry.Orientation.Clockwise : Geometry.Orientation.CounterClockwise; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Overlap.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Overlap.cs index 7ad67cbe3..fadfd4829 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Overlap.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Overlap.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using System.Collections.Generic; namespace SAM.Geometry.Spatial @@ -21,7 +24,7 @@ public static bool Overlap(this Face3D face3D_1, Face3D face3D_2, double toleran Plane plane_1 = face3D_1?.GetPlane(); if (plane_1 == null) return false; - + Plane plane_2 = face3D_2.GetPlane(); if (plane_2 == null) return false; @@ -40,4 +43,4 @@ public static bool Overlap(this Face3D face3D_1, Face3D face3D_2, double toleran return geometry2Ds.Find(x => x is IClosed2D) != null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Parallel.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Parallel.cs index 09344ac58..0be175321 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Parallel.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Parallel.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Query { @@ -24,4 +27,4 @@ public static bool Parallel(this Segment3D segment3D_1, Segment3D segment3D_2, d return Parallel(segment3D_1?.Direction, segment3D_2?.Direction, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Permieter.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Permieter.cs index f2b2d6724..d5477b534 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Permieter.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Permieter.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -9,7 +12,7 @@ public static double Permieter(this IClosedPlanar3D closedPlanar3D) if (closedPlanar3D == null) return double.NaN; - if(closedPlanar3D is ISegmentable3D) + if (closedPlanar3D is ISegmentable3D) { List segment3Ds = ((ISegmentable3D)closedPlanar3D).GetSegments(); if (segment3Ds == null || segment3Ds.Count == 0) @@ -24,4 +27,4 @@ public static double Permieter(this IClosedPlanar3D closedPlanar3D) throw new System.NotImplementedException(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Perpendicular.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Perpendicular.cs index 56010777c..4c5ec3289 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Perpendicular.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Perpendicular.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Query { @@ -18,4 +21,4 @@ public static bool Perpendicular(this Plane plane_1, Plane plane_2, double toler return Perpendicular(plane_1?.Normal, plane_2?.Normal, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/PlanarIntersectionResult.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/PlanarIntersectionResult.cs index d28c14205..4c28b5adc 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/PlanarIntersectionResult.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/PlanarIntersectionResult.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Geometry.Spatial { @@ -27,4 +30,4 @@ public static PlanarIntersectionResult PlanarIntersectionResult(this Plane plane return Create.PlanarIntersectionResult(plane_1, plane_2, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Point3Ds.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Point3Ds.cs index 5c8bd708a..50c7329ae 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Point3Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Point3Ds.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -6,13 +9,13 @@ public static partial class Query { public static List Point3Ds(this IClosed3D closed3D) { - if(closed3D is Face3D) + if (closed3D is Face3D) { return Point3Ds((Face3D)closed3D, true, true); } - - - if(!(closed3D is ICurvable3D)) + + + if (!(closed3D is ICurvable3D)) { throw new System.NotImplementedException(); } @@ -20,7 +23,7 @@ public static List Point3Ds(this IClosed3D closed3D) return ((ICurvable3D)closed3D).GetCurves()?.ConvertAll(x => x.GetStart()); } - + public static List Point3Ds(this Face3D face3D, bool externalEdge = true, bool internalEdges = true) { if (face3D == null) @@ -28,7 +31,7 @@ public static List Point3Ds(this Face3D face3D, bool externalEdge = tru List result = new List(); - if(externalEdge) + if (externalEdge) { ICurvable3D curvable3D = face3D.GetExternalEdge3D() as ICurvable3D; if (curvable3D != null) @@ -42,9 +45,9 @@ public static List Point3Ds(this Face3D face3D, bool externalEdge = tru if (internalEdges) { List closedPlanar3Ds = face3D.GetInternalEdge3Ds(); - if(closedPlanar3Ds != null) + if (closedPlanar3Ds != null) { - foreach(IClosedPlanar3D closedPlanar3D in closedPlanar3Ds) + foreach (IClosedPlanar3D closedPlanar3D in closedPlanar3Ds) { ICurvable3D curvable3D = closedPlanar3D as ICurvable3D; if (curvable3D != null) @@ -61,4 +64,4 @@ public static List Point3Ds(this Face3D face3D, bool externalEdge = tru } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Project.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Project.cs index 0561f4bf4..72ce70bdc 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Project.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Project.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -10,7 +13,7 @@ public static Vector3D Project(this Plane plane, Vector3D vector3D) return null; Vector3D normal = plane.Normal; - + return vector3D - vector3D.DotProduct(normal) * normal; //double factor = vector3D.DotProduct(normal) - K; @@ -27,25 +30,25 @@ public static Point3D Project(this Plane plane, Point3D point3D) public static Point3D Project(this Face3D face3D, Point3D point3D, double tolerance = Core.Tolerance.Distance) { - if(point3D == null || face3D == null) + if (point3D == null || face3D == null) { return null; } Plane plane = face3D.GetPlane(); - if(plane == null) + if (plane == null) { return null; } Point3D point3D_Project = plane.Project(point3D); - if(point3D_Project == null) + if (point3D_Project == null) { return null; } - return face3D.InRange(point3D, tolerance) ? point3D_Project: null; + return face3D.InRange(point3D, tolerance) ? point3D_Project : null; } public static Point3D Project(this Plane plane, Point3D point3D, Vector3D vector3D, double tolerance = Core.Tolerance.Distance) @@ -237,7 +240,7 @@ public static Line3D Project(this Plane plane, Line3D line3D) public static IClosedPlanar3D Project(this Plane plane, IClosedPlanar3D closedPlanar3D) { - if (plane == null || closedPlanar3D == null) + if (plane == null || closedPlanar3D == null) return null; return Project(plane, closedPlanar3D as dynamic); @@ -253,20 +256,20 @@ public static IClosedPlanar3D Project(this Plane plane, IClosedPlanar3D closedPl public static Face3D Project(this Plane plane, Shell shell, Vector3D vector3D, double tolerance = Core.Tolerance.Distance) { - if(plane == null || shell == null || vector3D == null) + if (plane == null || shell == null || vector3D == null) { return null; } List face3Ds = shell.Face3Ds; - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return null; } face3Ds = face3Ds.ConvertAll(x => plane.Project(x, vector3D, tolerance)); face3Ds.RemoveAll(x => x == null || !x.IsValid() || x.GetArea() < tolerance); - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return null; } @@ -321,19 +324,19 @@ public static Face3D Project(this Plane plane, Shell shell, double tolerance = C public static Point3D Project(this Sphere sphere, Point3D point3D) { - if(sphere == null || point3D == null) + if (sphere == null || point3D == null) { return null; } Point3D origin = sphere.Origin; - if(origin == null || !origin.IsValid()) + if (origin == null || !origin.IsValid()) { return null; } Vector3D vector3D = new Vector3D(origin, point3D); - if(!vector3D.IsValid()) + if (!vector3D.IsValid()) { return null; } @@ -344,4 +347,4 @@ public static Point3D Project(this Sphere sphere, Point3D point3D) return origin.GetMoved(vector3D) as Point3D; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Range.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Range.cs index 95366a740..7313f7042 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Range.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Range.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Geometry.Spatial { @@ -6,7 +9,7 @@ public static partial class Query { public static Range Range(this BoundingBox3D boundingBox3D, int dimensionIndex) { - if(boundingBox3D == null) + if (boundingBox3D == null) { return null; } @@ -14,4 +17,4 @@ public static Range Range(this BoundingBox3D boundingBox3D, int dimensio return new Range(boundingBox3D.Min[dimensionIndex], boundingBox3D.Max[dimensionIndex]); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Ranges.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Ranges.cs index 3db95bf7a..5e91a8beb 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Ranges.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Ranges.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -8,13 +11,13 @@ public static partial class Query { public static List> Ranges(this Face3D face3D, IEnumerable> ranges, int dimensionIndex = 2) { - if(face3D == null || ranges == null || ranges.Count() == 0) + if (face3D == null || ranges == null || ranges.Count() == 0) { return null; } BoundingBox3D boundingBox3D = face3D.GetBoundingBox(); - if(boundingBox3D == null) + if (boundingBox3D == null) { return null; } @@ -22,14 +25,14 @@ public static List> Ranges(this Face3D face3D, IEnumerable range_BoundingBox3D = boundingBox3D.Range(dimensionIndex); List> result = new List>(); - foreach(Range range in ranges) + foreach (Range range in ranges) { - if(range == null) + if (range == null) { continue; } - if(!range_BoundingBox3D.Intersect(range)) + if (!range_BoundingBox3D.Intersect(range)) { continue; } @@ -40,4 +43,4 @@ public static List> Ranges(this Face3D face3D, IEnumerable segment3Ds = shell.NakedSegment3Ds(int.MaxValue, tolerance); - if(segment3Ds == null || segment3Ds.Count == 0) + if (segment3Ds == null || segment3Ds.Count == 0) { return result; } @@ -22,16 +25,16 @@ public static Shell RemoveInvalidFace3Ds(this Shell shell, double tolerance = Co while (segment3Ds != null && segment3Ds.Count > 0) { List face3Ds = result.Face3Ds; - if(face3Ds == null || face3Ds.Count < 3) + if (face3Ds == null || face3Ds.Count < 3) { return null; } - foreach(Segment3D segment3D in segment3Ds) + foreach (Segment3D segment3D in segment3Ds) { Point3D point3D = segment3D.Mid(); face3Ds.RemoveAll(x => x.OnEdge(point3D, tolerance)); - if(face3Ds.Count < 3) + if (face3Ds.Count < 3) { return null; } @@ -44,4 +47,4 @@ public static Shell RemoveInvalidFace3Ds(this Shell shell, double tolerance = Co return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Rotate.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Rotate.cs index bc3a35448..1247cd864 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Rotate.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Rotate.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Query { @@ -11,7 +14,7 @@ public static partial class Query /// public static Vector3D Rotate(this Vector3D vector3D, Plane plane, double angle) { - if(vector3D is null || plane?.Normal is not Vector3D axis || double.IsNaN(angle)) + if (vector3D is null || plane?.Normal is not Vector3D axis || double.IsNaN(angle)) { return null; } @@ -23,4 +26,4 @@ public static Vector3D Rotate(this Vector3D vector3D, Plane plane, double angle) return vector3D * cos + axis.CrossProduct(vector3D) * sin + axis * axis.DotProduct(vector3D) * (1 - cos); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Rotate90.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Rotate90.cs index 10e5c278b..0dd2bac5c 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Rotate90.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Rotate90.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Query { @@ -13,4 +16,4 @@ public static Vector3D Rotate90(this Vector3D vector3D, bool clockwise = true) return new Vector3D(-vector3D.Z, 0, vector3D.X); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Round.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Round.cs index 209c80d34..f3899fb63 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Round.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Round.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Query { @@ -18,4 +21,4 @@ public static Segment3D Round(this Segment3D segment3D, double tolerance = Core. return new Segment3D(point3D_1, point3D_2); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Section.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Section.cs index af6a8a943..fc9692363 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Section.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Section.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -11,7 +14,7 @@ public static List Section(this Shell shell, Plane plane, bool includeIn return null; } - if(!plane.Intersect(shell.GetBoundingBox(), tolerance_Snap)) + if (!plane.Intersect(shell.GetBoundingBox(), tolerance_Snap)) { return null; } @@ -23,7 +26,7 @@ public static List Section(this Shell shell, Plane plane, bool includeIn } List segment2Ds = new List(); - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { if (face3D.GetArea() <= tolerance_Distance) { @@ -31,7 +34,7 @@ public static List Section(this Shell shell, Plane plane, bool includeIn } PlanarIntersectionResult planarIntersectionResult = null; - if(includeInternalEdges) + if (includeInternalEdges) { planarIntersectionResult = Create.PlanarIntersectionResult(plane, face3D, tolerance_Angle, tolerance_Distance); } @@ -47,7 +50,7 @@ public static List Section(this Shell shell, Plane plane, bool includeIn if (segmentable2Ds == null) continue; - foreach(Planar.ISegmentable2D segmentable2D in segmentable2Ds) + foreach (Planar.ISegmentable2D segmentable2D in segmentable2Ds) { if (segmentable2D == null) continue; @@ -95,10 +98,10 @@ public static List Section(this Shell shell, double offset = 0.1, bool i return Section(shell, plane, includeInternalEdges, tolerance_Angle, tolerance_Distance, tolerance_Snap); } - + public static List Section(this Extrusion extrusion, Plane plane, bool includeInternalEdges = true, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance, double tolerance_Snap = Core.Tolerance.MacroDistance) { - if(extrusion == null || plane == null) + if (extrusion == null || plane == null) { return null; } @@ -109,48 +112,48 @@ public static List Section(this Extrusion extrusion, Plane plane, bool i } Shell shell = extrusion?.Shell(); - if(shell == null) + if (shell == null) { return null; } - return Section(shell, plane, includeInternalEdges,tolerance_Angle, tolerance_Distance, tolerance_Snap); + return Section(shell, plane, includeInternalEdges, tolerance_Angle, tolerance_Distance, tolerance_Snap); } public static List Section(this Shell shell, Face3D face3D, bool includeInternalEdges = true, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance, double tolerance_Snap = Core.Tolerance.MacroDistance) { - if(shell == null || face3D == null) + if (shell == null || face3D == null) { return null; } Plane plane = face3D.GetPlane(); - if(plane == null) + if (plane == null) { return null; } BoundingBox3D boundingBox3D = shell.GetBoundingBox(); - if(boundingBox3D == null) + if (boundingBox3D == null) { return null; } BoundingBox3D boundingBox3D_Face3D = face3D.GetBoundingBox(); - if(boundingBox3D_Face3D == null) + if (boundingBox3D_Face3D == null) { return null; } List result = new List(); - if(!boundingBox3D.InRange(boundingBox3D_Face3D, tolerance_Snap)) + if (!boundingBox3D.InRange(boundingBox3D_Face3D, tolerance_Snap)) { return result; } List face3Ds = Section(shell, plane, includeInternalEdges, tolerance_Angle, tolerance_Distance, tolerance_Snap); - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return result; } @@ -160,15 +163,15 @@ public static List Section(this Shell shell, Face3D face3D, bool include List face2Ds = face3Ds.ConvertAll(x => plane.Convert(x)); List face2Ds_Intersection = new List(); - foreach(Planar.Face2D face2D_Temp in face2Ds_Intersection) + foreach (Planar.Face2D face2D_Temp in face2Ds_Intersection) { - if(face2D_Temp == null) + if (face2D_Temp == null) { continue; } List face2Ds_Intersection_Temp = Planar.Query.Intersection(face2D, face2D_Temp, tolerance_Distance); - if(face2Ds_Intersection_Temp == null || face2Ds_Intersection_Temp.Count == 0) + if (face2Ds_Intersection_Temp == null || face2Ds_Intersection_Temp.Count == 0) { continue; } @@ -176,7 +179,7 @@ public static List Section(this Shell shell, Face3D face3D, bool include face2Ds_Intersection.AddRange(face2Ds_Intersection_Temp); } - if(face2Ds_Intersection == null || face2Ds_Intersection.Count == 0) + if (face2Ds_Intersection == null || face2Ds_Intersection.Count == 0) { return result; } @@ -187,4 +190,4 @@ public static List Section(this Shell shell, Face3D face3D, bool include return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/SectionDictionary.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/SectionDictionary.cs index 9fb3bc5ad..15cec3baf 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/SectionDictionary.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/SectionDictionary.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Geometry.Spatial @@ -96,4 +99,4 @@ public static Dictionary> SectionDictionary(this IEnumerable< return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Segment3Ds.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Segment3Ds.cs index 74b411bb2..43daeaaa6 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Segment3Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Segment3Ds.cs @@ -1,28 +1,31 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { public static partial class Query { - public static List Segment3Ds(this IEnumerable segmentable3Ds) where T :ISegmentable3D + public static List Segment3Ds(this IEnumerable segmentable3Ds) where T : ISegmentable3D { - if(segmentable3Ds == null) + if (segmentable3Ds == null) { return null; } List result = new List(); - foreach(ISegmentable3D segmentable3D in segmentable3Ds) + foreach (ISegmentable3D segmentable3D in segmentable3Ds) { List segment3Ds = segmentable3D?.GetSegments(); - if(segment3Ds == null) + if (segment3Ds == null) { continue; } - foreach(Segment3D segment3D in segment3Ds) + foreach (Segment3D segment3D in segment3Ds) { - if(segment3D == null) + if (segment3D == null) { continue; } @@ -34,4 +37,4 @@ public static List Segment3Ds(this IEnumerable segmentable3Ds) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/SelfIntersect.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/SelfIntersect.cs index 577843b12..ab06963ce 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/SelfIntersect.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/SelfIntersect.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Query { @@ -14,4 +17,4 @@ public static bool SelfIntersect(this Polygon3D polygon3D, double tolerance = Co return Planar.Query.SelfIntersect(plane.Convert(polygon3D), tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/SelfIntersectionFace3Ds.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/SelfIntersectionFace3Ds.cs index 5fdd5d2f8..e2e66a4c8 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/SelfIntersectionFace3Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/SelfIntersectionFace3Ds.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -22,4 +25,4 @@ public static List SelfIntersectionFace3Ds(this Face3D face3D, double ma return face2Ds.ConvertAll(x => plane.Convert(x)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/SelfIntersectionPolygon3Ds.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/SelfIntersectionPolygon3Ds.cs index cee1e5063..b8397c620 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/SelfIntersectionPolygon3Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/SelfIntersectionPolygon3Ds.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -22,4 +25,4 @@ public static List SelfIntersectionPolygon3Ds(this Polygon3D polygon3 return polygon2Ds.ConvertAll(x => plane.Convert(x)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/SignedAngle.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/SignedAngle.cs index e45128153..337444b6c 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/SignedAngle.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/SignedAngle.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Query { @@ -16,4 +19,4 @@ public static double SignedAngle(this Vector3D vector3D_1, Vector3D vector3D_2, return angle; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/SignedVolume.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/SignedVolume.cs index 9b2aba5b8..0c21e573d 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/SignedVolume.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/SignedVolume.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -6,11 +9,11 @@ public static partial class Query { public static double SignedVolume(this Vector3D vector3D_1, Vector3D vector3D_2, Vector3D vector3D_3) { - if(vector3D_1 == null || vector3D_2 == null || vector3D_3 == null) + if (vector3D_1 == null || vector3D_2 == null || vector3D_3 == null) { return double.NaN; } - + double v321 = vector3D_3.X * vector3D_2.Y * vector3D_1.Z; double v231 = vector3D_2.X * vector3D_3.Y * vector3D_1.Z; double v312 = vector3D_3.X * vector3D_1.Y * vector3D_2.Z; @@ -41,7 +44,7 @@ public static double SignedVolume(this Point3D point3D_1, Point3D point3D_2, Poi public static double SignedVolume(this Triangle3D triangle3D) { List point3Ds = triangle3D?.GetPoints(); - if(point3Ds == null || point3Ds.Count != 3) + if (point3Ds == null || point3Ds.Count != 3) { return double.NaN; } @@ -49,4 +52,4 @@ public static double SignedVolume(this Triangle3D triangle3D) return SignedVolume(point3Ds[0], point3Ds[1], point3Ds[2]); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Simplify.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Simplify.cs index 1640da8ee..fdf144cf1 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Simplify.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Simplify.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; namespace SAM.Geometry.Spatial { @@ -7,7 +10,7 @@ public static partial class Query public static Polygon3D Simplify(this Circle3D circle3D, int density) { Plane plane = circle3D?.GetPlane(); - if(plane == null) + if (plane == null) { return null; } @@ -19,4 +22,4 @@ public static Polygon3D Simplify(this Circle3D circle3D, int density) return plane.Convert(polygon2Ds); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/SimplifyByAngle.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/SimplifyByAngle.cs index c8e741caf..c8bef788a 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/SimplifyByAngle.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/SimplifyByAngle.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -36,7 +39,7 @@ public static List SimplifyByAngle(IEnumerable point3Ds, bool public static Face3D SimplifyByAngle(this Face3D face3D, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { Plane plane = face3D?.GetPlane(); - if(plane == null) + if (plane == null) { return null; } @@ -47,4 +50,4 @@ public static Face3D SimplifyByAngle(this Face3D face3D, double tolerance_Angle return plane.Convert(face2D); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/SimplifyByDistance.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/SimplifyByDistance.cs index 8d550d170..61de8e84c 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/SimplifyByDistance.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/SimplifyByDistance.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Spatial @@ -47,4 +50,4 @@ public static List SimplifyByDistance(this IEnumerable point3D return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/SimplifyByNTS_TopologyPreservingSimplifier.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/SimplifyByNTS_TopologyPreservingSimplifier.cs index 48d8548f5..79b422260 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/SimplifyByNTS_TopologyPreservingSimplifier.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/SimplifyByNTS_TopologyPreservingSimplifier.cs @@ -1,4 +1,7 @@ -using NetTopologySuite.Geometries; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using NetTopologySuite.Geometries; using NetTopologySuite.Simplify; using SAM.Core; using SAM.Geometry.Planar; @@ -25,4 +28,4 @@ public static Face3D SimplifyByNTS_TopologyPreservingSimplifier(this Face3D face return polygon?.ToSAM(plane, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/SmallestAngle.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/SmallestAngle.cs index f0015777f..d1f74a752 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/SmallestAngle.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/SmallestAngle.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Query { @@ -10,4 +13,4 @@ public static double SmallestAngle(this Point3D point3D_Previous, Point3D point3 return (new Vector3D(point3D, point3D_Previous).SmallestAngle(new Vector3D(point3D, point3D_Next))); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Snap.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Snap.cs index 7748d4288..b34a00f8f 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Snap.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Snap.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using System; using System.Collections.Generic; using System.Linq; @@ -53,13 +56,13 @@ public static Face3D Snap(this Face3D face3D_Snapped, Face3D face3D_Snapping, do public static Shell Snap(this Shell shell_Snapped, Shell shell_Snapping, double snapDistance = Core.Tolerance.MacroDistance, double tolerance = Core.Tolerance.Distance) { - if(shell_Snapped == null || shell_Snapping == null) + if (shell_Snapped == null || shell_Snapping == null) { return null; } BoundingBox3D boundingBox3D_Snapped = shell_Snapped.GetBoundingBox(); - if(boundingBox3D_Snapped == null) + if (boundingBox3D_Snapped == null) { return null; } @@ -70,7 +73,7 @@ public static Shell Snap(this Shell shell_Snapped, Shell shell_Snapping, double return null; } - if(!boundingBox3D_Snapped.InRange(boundingBox3D_Snapping, snapDistance)) + if (!boundingBox3D_Snapped.InRange(boundingBox3D_Snapping, snapDistance)) { return new Shell(shell_Snapped); } @@ -87,7 +90,7 @@ public static Shell Snap(this Shell shell_Snapped, Shell shell_Snapping, double return null; } - for(int i= boundaries_Snapping.Count - 1; i <=0; i--) + for (int i = boundaries_Snapping.Count - 1; i <= 0; i--) { BoundingBox3D boundingBox3D_Boundary_Snapping = boundaries_Snapping[i].Item1; if (boundingBox3D_Boundary_Snapping == null || !boundingBox3D_Snapped.InRange(boundingBox3D_Boundary_Snapping, snapDistance)) @@ -97,10 +100,10 @@ public static Shell Snap(this Shell shell_Snapped, Shell shell_Snapping, double } List face3Ds_Shell = new List(); - for(int i=0; i < boundaries_Snapped.Count; i++) + for (int i = 0; i < boundaries_Snapped.Count; i++) { BoundingBox3D boundingBox3D_Boundary_Snapped = boundaries_Snapped[i].Item1; - if(boundingBox3D_Boundary_Snapped == null) + if (boundingBox3D_Boundary_Snapped == null) { continue; } @@ -112,9 +115,9 @@ public static Shell Snap(this Shell shell_Snapped, Shell shell_Snapping, double } List face3Ds = new List(); - foreach(Tuple boudnary_Snapping in boundaries_Snapping) + foreach (Tuple boudnary_Snapping in boundaries_Snapping) { - if(!boundingBox3D_Boundary_Snapped.InRange(boudnary_Snapping.Item1, snapDistance)) + if (!boundingBox3D_Boundary_Snapped.InRange(boudnary_Snapping.Item1, snapDistance)) { continue; } @@ -135,16 +138,16 @@ public static Shell Snap(this Shell shell_Snapped, Shell shell_Snapping, double return new Shell(face3Ds_Shell); } - + public static Shell Snap(this Shell shell, IEnumerable shells_Snapping, double snapDistance = Core.Tolerance.MacroDistance, double tolerance = Core.Tolerance.Distance) { - if(shell == null || shells_Snapping == null) + if (shell == null || shells_Snapping == null) { return null; } BoundingBox3D boundingBox3D = shell.GetBoundingBox(); - if(boundingBox3D == null) + if (boundingBox3D == null) { return null; } @@ -196,13 +199,13 @@ public static List Snap(this IEnumerable shells_Snapped, IEnumerab System.Threading.Tasks.Parallel.For(0, result.Count, (int i) => { Shell shell = result[i]; - if(shell == null) + if (shell == null) { return; } Shell shell_Snap = shell.Snap(shells_Snapping, snapDistance, tolerance); - if(shell_Snap == null) + if (shell_Snap == null) { return; } @@ -219,13 +222,13 @@ public static Face3D Snap(this Face3D face3D, IEnumerable face3Ds_Snappi return null; BoundingBox3D boundingBox3D = face3D.GetBoundingBox(); - if(boundingBox3D == null) + if (boundingBox3D == null) { return null; } Plane plane = face3D.GetPlane(); - if(plane == null) + if (plane == null) { return null; } @@ -240,18 +243,18 @@ public static Face3D Snap(this Face3D face3D, IEnumerable face3Ds_Snappi foreach (Face3D face3D_Temp in face3Ds_Snapping) { BoundingBox3D boundingBox3D_Temp = face3D_Temp?.GetBoundingBox(); - if(boundingBox3D_Temp == null || !boundingBox3D.InRange(boundingBox3D_Temp, snapDistance)) + if (boundingBox3D_Temp == null || !boundingBox3D.InRange(boundingBox3D_Temp, snapDistance)) { continue; } List segmentable3Ds = face3D_Temp.GetEdge3Ds()?.ConvertAll(x => x as ISegmentable3D); - if(segmentable3Ds == null) + if (segmentable3Ds == null) { continue; } - - + + foreach (ISegmentable3D segmentable3D in segmentable3Ds) { List segment3Ds = segmentable3D?.GetSegments(); @@ -263,22 +266,22 @@ public static Face3D Snap(this Face3D face3D, IEnumerable face3Ds_Snappi foreach (Segment3D segment3D in segment3Ds) { BoundingBox3D boundingBox3D_Segment3D = segment3D.GetBoundingBox(); - if(boundingBox3D_Segment3D == null) + if (boundingBox3D_Segment3D == null) { continue; } - - for(int i=0; i < point3Ds_ExternalEdge3D.Count; i++) + + for (int i = 0; i < point3Ds_ExternalEdge3D.Count; i++) { Point3D point3D = point3Ds_ExternalEdge3D[i]; - if(!boundingBox3D_Segment3D.InRange(point3D, snapDistance)) + if (!boundingBox3D_Segment3D.InRange(point3D, snapDistance)) { continue; } Point3D point3D_Closest = segment3D.Closest(point3D, true); double distance = point3D_Closest.Distance(point3D); - if(distance > snapDistance) + if (distance > snapDistance) { continue; } @@ -287,8 +290,8 @@ public static Face3D Snap(this Face3D face3D, IEnumerable face3Ds_Snappi snapped = true; //break; } - - if(point3Ds_InternalEdge3Ds != null) + + if (point3Ds_InternalEdge3Ds != null) { foreach (List point3Ds in point3Ds_InternalEdge3Ds) { @@ -329,13 +332,13 @@ public static Face3D Snap(this Face3D face3D, IEnumerable face3Ds_Snappi public static Face3D Snap(this Face3D face3D, IEnumerable shells_Snapping, double snapDistance = Core.Tolerance.MacroDistance, double tolerance = Core.Tolerance.Distance) { - if(face3D == null || shells_Snapping == null) + if (face3D == null || shells_Snapping == null) { return null; } BoundingBox3D boundingBox3D = face3D.GetBoundingBox(); - if(boundingBox3D == null) + if (boundingBox3D == null) { return null; } @@ -346,26 +349,26 @@ public static Face3D Snap(this Face3D face3D, IEnumerable shells_Snapping } List face3Ds = new List(); - foreach(Shell shell in shells_Snapping) + foreach (Shell shell in shells_Snapping) { BoundingBox3D boundingBox3D_Shell = shell?.GetBoundingBox(); - if(boundingBox3D_Shell == null) + if (boundingBox3D_Shell == null) { continue; } - if(!boundingBox3D.InRange(boundingBox3D_Shell, snapDistance)) + if (!boundingBox3D.InRange(boundingBox3D_Shell, snapDistance)) { continue; } List> boundaries = shell.Boundaries; - if(boundaries == null || boundaries.Count == 0) + if (boundaries == null || boundaries.Count == 0) { continue; } - foreach(Tuple boundary in boundaries) + foreach (Tuple boundary in boundaries) { if (boundary.Item1 == null || !boundingBox3D.InRange(boundary.Item1, snapDistance)) { @@ -376,7 +379,7 @@ public static Face3D Snap(this Face3D face3D, IEnumerable shells_Snapping } } - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return new Face3D(face3D); ; } @@ -394,12 +397,12 @@ public static Segment3D Snap(this IEnumerable point3Ds, Segment3D segme public static Shell Snap(this Shell shell, IEnumerable point3Ds, double tolerance = Core.Tolerance.Distance) { - if(shell == null) + if (shell == null) { return null; } - if(point3Ds == null ) + if (point3Ds == null) { return new Shell(shell); } @@ -411,33 +414,33 @@ public static Shell Snap(this Shell shell, IEnumerable point3Ds, double } BoundingBox3D boundingBox3D_Shell = shell.GetBoundingBox(); - if(boundingBox3D_Shell == null) + if (boundingBox3D_Shell == null) { return new Shell(shell); } List point3Ds_Shell = point3Ds?.ToList().FindAll(x => boundingBox3D_Shell.InRange(x, tolerance)); - if(point3Ds_Shell == null || point3Ds_Shell.Count == 0) + if (point3Ds_Shell == null || point3Ds_Shell.Count == 0) { return new Shell(shell); } List face3Ds = shell.Face3Ds; - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return new Shell(face3Ds); } - for(int i = 0; i < face3Ds.Count; i++) + for (int i = 0; i < face3Ds.Count; i++) { BoundingBox3D boundingBox3D_Face3D = face3Ds[i]?.GetBoundingBox(); - if(boundingBox3D_Face3D == null) + if (boundingBox3D_Face3D == null) { continue; } List point3Ds_Face3D = point3Ds_Shell.FindAll(x => boundingBox3D_Face3D.InRange(x, tolerance)); - if(point3Ds_Face3D == null || point3Ds_Face3D.Count == 0) + if (point3Ds_Face3D == null || point3Ds_Face3D.Count == 0) { continue; } @@ -452,24 +455,24 @@ public static Shell Snap(this Shell shell, IEnumerable point3Ds, double public static Face3D Snap(this Face3D face3D, IEnumerable point3Ds, double tolerance = SAM.Core.Tolerance.Distance) { - if(face3D == null) + if (face3D == null) { return null; } - if(point3Ds == null) + if (point3Ds == null) { return new Face3D(face3D); } List point3Ds_Temp = point3Ds.ToList().FindAll(x => face3D.InRange(x, tolerance + tolerance)); - if(point3Ds_Temp == null || point3Ds_Temp.Count == 0) + if (point3Ds_Temp == null || point3Ds_Temp.Count == 0) { return new Face3D(face3D); } Plane plane = face3D.GetPlane(); - if(plane == null) + if (plane == null) { return new Face3D(face3D); } @@ -479,7 +482,7 @@ public static Face3D Snap(this Face3D face3D, IEnumerable point3Ds, dou IClosed2D externalEdge2D = face3D.ExternalEdge2D; List point2Ds_Edge = (externalEdge2D as ISegmentable2D)?.GetPoints(); - if(point2Ds_Edge != null) + if (point2Ds_Edge != null) { for (int i = 0; i < point2Ds_Edge.Count; i++) @@ -487,11 +490,11 @@ public static Face3D Snap(this Face3D face3D, IEnumerable point3Ds, dou Point3D point3D = plane.Convert(point2Ds_Edge[i]); int index = point3Ds_Temp.FindIndex(x => x.Distance(point3D) < tolerance); - if(index != -1) + if (index != -1) { point3D = point3Ds_Temp[index]; Point3D point3D_Project = plane.Project(point3D); - if(point3D.Distance(point3D_Project) > tolerance) + if (point3D.Distance(point3D_Project) > tolerance) { point3D = point3D_Project.Mid(point3D); } @@ -501,19 +504,19 @@ public static Face3D Snap(this Face3D face3D, IEnumerable point3Ds, dou } } - if(updated) + if (updated) { externalEdge2D = new Polygon2D(point2Ds_Edge); } } List internalEdge2Ds = face3D.InternalEdge2Ds; - if(internalEdge2Ds != null) + if (internalEdge2Ds != null) { - for(int i = 0; i < internalEdge2Ds.Count; i++) + for (int i = 0; i < internalEdge2Ds.Count; i++) { bool updated_Internal = false; - + point2Ds_Edge = (internalEdge2Ds[i] as ISegmentable2D)?.GetPoints(); if (point2Ds_Edge != null) { @@ -546,7 +549,7 @@ public static Face3D Snap(this Face3D face3D, IEnumerable point3Ds, dou } } - if(!updated) + if (!updated) { return new Face3D(face3D); } @@ -554,4 +557,4 @@ public static Face3D Snap(this Face3D face3D, IEnumerable point3Ds, dou return new Face3D(plane, Face2D.Create(externalEdge2D, internalEdge2Ds)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/SpacingDictionary.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/SpacingDictionary.cs index 4fa28ff90..dea0df717 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/SpacingDictionary.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/SpacingDictionary.cs @@ -1,16 +1,19 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Geometry.Spatial { public static partial class Query - { + { public static Dictionary> SpacingDictionary(this IEnumerable face3Ds, double maxTolerance = Core.Tolerance.MacroDistance, double minTolerance = Core.Tolerance.MicroDistance) { List>> tuples = new List>>(); foreach (Face3D face3D in face3Ds) { - if(face3D == null || !face3D.IsValid()) + if (face3D == null || !face3D.IsValid()) { continue; } @@ -37,7 +40,7 @@ public static Dictionary> SpacingDictionary(this IEnumerab continue; Point3D point3D = point3D_Temp; - foreach(Point3D point3D_Result in result.Keys) + foreach (Point3D point3D_Result in result.Keys) { if (point3D_Result.Distance(point3D_Temp) <= minTolerance) { @@ -71,7 +74,7 @@ public static Dictionary> SpacingDictionary(this IEnumerab public static Dictionary> SpacingDictionary(this Shell shell, double maxTolerance = Core.Tolerance.MacroDistance, double minTolerance = Core.Tolerance.MicroDistance) { List face3Ds = shell?.Face3Ds; - if(face3Ds == null) + if (face3Ds == null) { return null; } @@ -79,4 +82,4 @@ public static Dictionary> SpacingDictionary(this Shell she return SpacingDictionary(face3Ds, maxTolerance, minTolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Split.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Split.cs index b6cdd23d4..1d7ef87f8 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Split.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Split.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using System; using System.Collections.Generic; using System.Linq; @@ -9,13 +12,13 @@ public static partial class Query { public static List Split(this Face3D face3D, Shell shell, double tolerance_Snap = Core.Tolerance.MacroDistance, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { - if(face3D == null || shell == null) + if (face3D == null || shell == null) { return null; } BoundingBox3D boundingBox3D_Face3D = face3D.GetBoundingBox(); - if(boundingBox3D_Face3D == null) + if (boundingBox3D_Face3D == null) { return null; } @@ -26,13 +29,13 @@ public static List Split(this Face3D face3D, Shell shell, double toleran return null; } - if(!boundingBox3D_Face3D.InRange(boundingBox3D_Shell)) + if (!boundingBox3D_Face3D.InRange(boundingBox3D_Shell)) { return null; } List face3Ds = shell.Face3Ds; - if(face3Ds == null) + if (face3Ds == null) { return null; } @@ -41,29 +44,29 @@ public static List Split(this Face3D face3D, Shell shell, double toleran return face3D.Split(face3Ds, tolerance_Snap, tolerance_Angle, tolerance_Distance); } - + public static List Split(this Face3D face3D, IEnumerable shells, double tolerance_Snap = Core.Tolerance.MacroDistance, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { - if(face3D == null) + if (face3D == null) { return null; } - List result = new List() { new Face3D(face3D)}; + List result = new List() { new Face3D(face3D) }; - if(shells == null || shells.Count() == 0) + if (shells == null || shells.Count() == 0) { return result; } - foreach(Shell shell in shells) + foreach (Shell shell in shells) { List face3Ds_Shell = new List(); foreach (Face3D face3D_Temp in result) { List face3Ds_Temp = Split(face3D_Temp, shell, tolerance_Snap, tolerance_Angle, tolerance_Distance); - if(face3Ds_Temp != null && face3Ds_Temp.Count != 0) + if (face3Ds_Temp != null && face3Ds_Temp.Count != 0) { face3Ds_Shell.AddRange(face3Ds_Temp); } @@ -81,7 +84,7 @@ public static List Split(this Face3D face3D, IEnumerable shells, public static List Split(this Shell shell, IEnumerable face3Ds, double tolerance_Snap = Core.Tolerance.MacroDistance, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { - if(shell == null || face3Ds == null) + if (shell == null || face3Ds == null) { return null; } @@ -92,7 +95,7 @@ public static List Split(this Shell shell, IEnumerable face3Ds, d shellSplitter.Tolerance_Distance = tolerance_Distance; shellSplitter.Add(shell); - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { shellSplitter.Add(face3D); } @@ -128,20 +131,20 @@ public static List Split(this IEnumerable shells, IEnumerable Split(this IEnumerable face3Ds, double tolerance_Snap = Core.Tolerance.MacroDistance, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) { - if(face3Ds == null) + if (face3Ds == null) { return null; } List result = new List(); - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { List face3Ds_Temp = new List(face3Ds); face3Ds_Temp.Remove(face3D); List face3Ds_Split = Split(face3D, face3Ds_Temp, tolerance_Snap, tolerance_Angle, tolerance_Distance); - if(face3Ds_Split == null || face3Ds_Split.Count == 0) + if (face3Ds_Split == null || face3Ds_Split.Count == 0) { result.Add(face3D); } @@ -179,23 +182,23 @@ public static List Split(this Face3D face3D, IEnumerable face3Ds List face2Ds_Temp = planarIntersectionResult.GetGeometry2Ds(); if (face2Ds_Temp != null && face2Ds_Temp.Count != 0) { - foreach(Face2D face2D_Temp in face2Ds_Temp) + foreach (Face2D face2D_Temp in face2Ds_Temp) { List edge2Ds = face2D_Temp?.Edge2Ds; - if(edge2Ds == null) + if (edge2Ds == null) { continue; } foreach (IClosed2D edge2D in edge2Ds) { - if(edge2D == null) + if (edge2D == null) { continue; } ISegmentable2D segmentable2D = edge2D as ISegmentable2D; - if(segmentable2D == null) + if (segmentable2D == null) { throw new NotImplementedException(); } @@ -217,21 +220,21 @@ public static List Split(this Face3D face3D, IEnumerable face3Ds List face2Ds = Planar.Query.Split(face2D, segmentable2Ds, tolerance_Snap, tolerance_Distance); face2Ds?.RemoveAll(x => x == null || !x.IsValid() || x.GetArea() < tolerance_Snap); - if(face2Ds != null && face2Ds.Count > 0) + if (face2Ds != null && face2Ds.Count > 0) { List face2Ds_Difference = Planar.Query.Difference(face2D, face2Ds, tolerance_Distance); - if(face2Ds_Difference != null) + if (face2Ds_Difference != null) { - foreach(Face2D face2D_Difference in face2Ds_Difference) + foreach (Face2D face2D_Difference in face2Ds_Difference) { - if(face2D_Difference != null && Planar.Query.IsValid(face2D_Difference) && face2D_Difference.GetArea() > tolerance_Snap) + if (face2D_Difference != null && Planar.Query.IsValid(face2D_Difference) && face2D_Difference.GetArea() > tolerance_Snap) { face2Ds.Add(face2D_Difference); } } } } - + return face2Ds?.ConvertAll(x => plane.Convert(x)); } @@ -261,9 +264,9 @@ public static List Split(this IEnumerable shells, double silverSpa return result; } - foreach(Shell shell in shells) + foreach (Shell shell in shells) { - if(shell != null) + if (shell != null) { result.Add(shell); } @@ -272,7 +275,7 @@ public static List Split(this IEnumerable shells, double silverSpa for (int i = 0; i < count - 1; i++) { BoundingBox3D boundingBox3D_1 = result[i].GetBoundingBox(); - if(boundingBox3D_1 == null) + if (boundingBox3D_1 == null) { continue; } @@ -285,31 +288,31 @@ public static List Split(this IEnumerable shells, double silverSpa continue; } - if(!boundingBox3D_1.InRange(boundingBox3D_2, tolerance_Distance)) + if (!boundingBox3D_1.InRange(boundingBox3D_2, tolerance_Distance)) { continue; } List shells_Intersection = result[i].Intersection(result[j], silverSpacing, tolerance_Angle, tolerance_Distance); - if(shells_Intersection == null || shells_Intersection.Count == 0) + if (shells_Intersection == null || shells_Intersection.Count == 0) { continue; } shells_Intersection.RemoveAll(x => x == null || x.Volume(silverSpacing, tolerance_Distance) < silverSpacing || !x.IsClosed(silverSpacing)); - if(shells_Intersection.Count == 0) + if (shells_Intersection.Count == 0) { continue; } List shells_Difference = new List() { result[i], result[j] }; - foreach(Shell shell_Intersection in shells_Intersection) + foreach (Shell shell_Intersection in shells_Intersection) { List shells_Difference_Temp = new List(); foreach (Shell shell_Difference in shells_Difference) { List shells_Difference_Temp_Temp = shell_Difference.Difference(shell_Intersection, silverSpacing, tolerance_Angle, tolerance_Distance); - if(shells_Difference_Temp_Temp == null || shells_Difference_Temp_Temp.Count == 0) + if (shells_Difference_Temp_Temp == null || shells_Difference_Temp_Temp.Count == 0) { continue; } @@ -478,13 +481,13 @@ public static List Split(this IEnumerable segment3Ds, doub public static Polyline3D Split(this Segment3D segment3D, double distance, AlignmentPoint alignmentPoint = AlignmentPoint.Start, double tolerance = Core.Tolerance.Distance) { - if(segment3D == null || double.IsNaN(distance) || alignmentPoint == AlignmentPoint.Undefined || distance <= tolerance) + if (segment3D == null || double.IsNaN(distance) || alignmentPoint == AlignmentPoint.Undefined || distance <= tolerance) { return null; } double length = segment3D.GetLength(); - if(length < distance) + if (length < distance) { return new Polyline3D(segment3D.GetPoints(), false); } @@ -494,16 +497,16 @@ public static Polyline3D Split(this Segment3D segment3D, double distance, Alignm Vector3D vector3D = segment3D.Direction; Vector3D vector3D_Temp = null; - List point3Ds = new List(); + List point3Ds = new List(); if (alignmentPoint == AlignmentPoint.End) { vector3D.Negate(); } - else if(alignmentPoint == AlignmentPoint.Mid) + else if (alignmentPoint == AlignmentPoint.Mid) { double distance_Temp = length % distance; - if(!Core.Query.AlmostEqual(distance_Temp, 0, tolerance) && !Core.Query.AlmostEqual(distance_Temp, distance, tolerance)) + if (!Core.Query.AlmostEqual(distance_Temp, 0, tolerance) && !Core.Query.AlmostEqual(distance_Temp, distance, tolerance)) { vector3D_Temp = vector3D * (distance_Temp / 2); if (vector3D_Temp.Length > tolerance) @@ -525,7 +528,7 @@ public static Polyline3D Split(this Segment3D segment3D, double distance, Alignm vector3D_Temp += vector3D; } - if(point3Ds.Count == 0) + if (point3Ds.Count == 0) { return null; } @@ -535,7 +538,7 @@ public static Polyline3D Split(this Segment3D segment3D, double distance, Alignm point3Ds.Reverse(); } - if (!AlmostSimilar( point3Ds.First(), segment3D.GetStart(), tolerance)) + if (!AlmostSimilar(point3Ds.First(), segment3D.GetStart(), tolerance)) { point3Ds.Insert(0, segment3D.GetStart()); } @@ -550,9 +553,9 @@ public static Polyline3D Split(this Segment3D segment3D, double distance, Alignm } - public static List Split(this Face3D face3D, IEnumerable geometry3Ds, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) where T: ISAMGeometry3D + public static List Split(this Face3D face3D, IEnumerable geometry3Ds, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) where T : ISAMGeometry3D { - if(face3D == null || geometry3Ds == null) + if (face3D == null || geometry3Ds == null) { return null; } @@ -570,11 +573,11 @@ public static List Split(this Face3D face3D, IEnumerable geometry3 { planarIntersectionResult = Create.PlanarIntersectionResult(face3D, geometry3D as Face3D, tolerance_Angle, tolerance_Distance); } - else if(geometry3D is ISegmentable3D) + else if (geometry3D is ISegmentable3D) { planarIntersectionResult = Create.PlanarIntersectionResult(plane, geometry3D as ISegmentable3D, tolerance_Angle, tolerance_Distance); } - else if(geometry3D is Plane) + else if (geometry3D is Plane) { planarIntersectionResult = Create.PlanarIntersectionResult(face3D, geometry3D as Plane, tolerance_Angle, tolerance_Distance); } @@ -583,17 +586,17 @@ public static List Split(this Face3D face3D, IEnumerable geometry3 continue; List face2Ds_Temp = planarIntersectionResult.GetGeometry2Ds(); - if(face2Ds_Temp != null && face2Ds_Temp.Count != 0) + if (face2Ds_Temp != null && face2Ds_Temp.Count != 0) { - foreach(Face2D face2D_Temp in face2Ds_Temp) + foreach (Face2D face2D_Temp in face2Ds_Temp) { List closed2Ds = face2D_Temp.Edge2Ds; - if(closed2Ds != null && closed2Ds.Count != 0) + if (closed2Ds != null && closed2Ds.Count != 0) { - foreach(IClosed2D closed2D in closed2Ds) + foreach (IClosed2D closed2D in closed2Ds) { ISegmentable2D segmentable2D = closed2D as ISegmentable2D; - if(segmentable2D == null) + if (segmentable2D == null) { throw new NotImplementedException(); } @@ -611,7 +614,7 @@ public static List Split(this Face3D face3D, IEnumerable geometry3 } } - if(segmentable2Ds == null || segmentable2Ds.Count == 0) + if (segmentable2Ds == null || segmentable2Ds.Count == 0) { return new List { new Face3D(face3D) }; } @@ -636,4 +639,4 @@ public static List Split(this Face3D face3D, IEnumerable geometry3 return face2Ds?.ConvertAll(x => plane.Convert(x)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/SplitByConcaveEdges.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/SplitByConcaveEdges.cs index 52740f350..e5dd845ad 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/SplitByConcaveEdges.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/SplitByConcaveEdges.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Geometry.Spatial @@ -13,4 +16,4 @@ public static List SplitByConcaveEdges(this Face3D face3D, double tolera throw new NotImplementedException(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/SplitByInternalEdges.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/SplitByInternalEdges.cs index 05d64b5b0..f86e81d0a 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/SplitByInternalEdges.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/SplitByInternalEdges.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using System.Collections.Generic; namespace SAM.Geometry.Spatial @@ -8,19 +11,19 @@ public static partial class Query public static List SplitByInternalEdges(this Face3D face3D, double tolerance = Core.Tolerance.Distance) { Plane plane = face3D?.GetPlane(); - if(plane == null) + if (plane == null) { return null; } Face2D face2D = plane.Convert(face3D); - if(face2D == null) + if (face2D == null) { return null; } List face2Ds = face2D.SplitByInternalEdges(tolerance); - if(face2Ds == null) + if (face2Ds == null) { return null; } @@ -28,4 +31,4 @@ public static List SplitByInternalEdges(this Face3D face3D, double toler return face2Ds.ConvertAll(x => plane.Convert(x)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/SplitEdges.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/SplitEdges.cs index 60d9c9136..bb598f472 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/SplitEdges.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/SplitEdges.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Query { @@ -9,4 +12,4 @@ public static Face3D SplitEdges(this Face3D face3D_Split, Face3D face3D_Splittin return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/ThinnessRatio.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/ThinnessRatio.cs index 66386c1d5..35841a323 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/ThinnessRatio.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/ThinnessRatio.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Query { @@ -29,4 +32,4 @@ public static double ThinnessRatio(this IClosedPlanar3D closedPlanar3D) return Planar.Query.ThinnessRatio(plane.Convert(closedPlanar3D)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Tilt.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Tilt.cs index 00dbca9a0..11ba57df9 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Tilt.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Tilt.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Query { @@ -37,8 +40,8 @@ public static double Tilt(this Vector3D normal) { if (normal == null) return double.NaN; - + return normal.Angle(Plane.WorldXY.Normal) * (180 / System.Math.PI); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/TopFace3Ds.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/TopFace3Ds.cs index 95078d417..018929689 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/TopFace3Ds.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/TopFace3Ds.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Geometry.Spatial @@ -18,18 +21,18 @@ public static List TopFace3Ds(this IEnumerable face3Ds, double t BoundingBox3D boundingBox3D = new BoundingBox3D(face3Ds_Temp.ConvertAll(x => x.GetBoundingBox())); if (System.Math.Abs(boundingBox3D.Max.Z - boundingBox3D.Min.Z) < tolerance) - return new List (face3Ds); + return new List(face3Ds); Plane plane = Plane.WorldXY; List segmentable2Ds = new List(); Dictionary dictionary = new Dictionary(); - foreach(Face3D face3D in face3Ds_Temp) + foreach (Face3D face3D in face3Ds_Temp) { //if (plane.Coplanar(face3D)) // continue; - + Face3D face3D_Project = plane.Project(face3D); if (face3D_Project == null) continue; @@ -47,7 +50,7 @@ public static List TopFace3Ds(this IEnumerable face3Ds, double t foreach (Planar.IClosed2D closed2D in closed2Ds) { Planar.ISegmentable2D segmentable2D = closed2D as Planar.ISegmentable2D; - if(segmentable2D != null) + if (segmentable2D != null) segmentable2Ds.Add(segmentable2D); } } @@ -60,12 +63,12 @@ public static List TopFace3Ds(this IEnumerable face3Ds, double t Vector3D vector3D = new Vector3D(0, 0, boundingBox3D.Height); - foreach(KeyValuePair keyValuePair in dictionary) + foreach (KeyValuePair keyValuePair in dictionary) { Plane plane_Temp = keyValuePair.Key?.GetPlane(); if (plane_Temp == null) continue; - + Planar.Face2D face2D = keyValuePair.Value; if (face2D == null) continue; @@ -91,7 +94,7 @@ public static List TopFace3Ds(this IEnumerable face3Ds, double t Segment3D segment3D = new Segment3D(point3D, point3D.GetMoved(vector3D) as Point3D); - foreach(Face3D face3D in face3Ds_Temp) + foreach (Face3D face3D in face3Ds_Temp) { if (keyValuePair.Key == face3D) continue; @@ -120,4 +123,4 @@ public static List TopFace3Ds(this IEnumerable face3Ds, double t return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Transform.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Transform.cs index 39e2a88e3..41579abb3 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Transform.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Transform.cs @@ -1,4 +1,7 @@ -using SAM.Math; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Math; using System.Collections.Generic; namespace SAM.Geometry.Spatial @@ -140,13 +143,13 @@ public static Extrusion Transform(this Extrusion extrusion, Matrix4D matrix4D) } Face3D face3D = extrusion?.Face3D; - if(face3D == null) + if (face3D == null) { return null; } Vector3D vector3D = extrusion.Vector; - if(vector3D == null) + if (vector3D == null) { return null; } @@ -197,11 +200,11 @@ public static Rectangle3D Transform(this Rectangle3D rectangle3D, Matrix4D matri return null; Plane plane = rectangle3D.GetPlane(); - + plane = plane.Transform(matrix4D); Vector3D vector3D_Width = rectangle3D.WidthDirection * rectangle3D.Width; - Vector3D vector3D_Height = rectangle3D.HeightDirection * rectangle3D.Height; + Vector3D vector3D_Height = rectangle3D.HeightDirection * rectangle3D.Height; Planar.Vector2D vector2D_Width = plane.Convert(vector3D_Width.Transform(matrix4D)); Planar.Vector2D vector2D_Height = plane.Convert(vector3D_Height.Transform(matrix4D)); @@ -309,7 +312,7 @@ public static Point3D Transform(this Point3D point3D, Matrix4D matrix4D) public static CoordinateSystem3D Transform(this CoordinateSystem3D coordinateSystem3D, Matrix4D matrix4D) { - if(coordinateSystem3D == null || matrix4D == null) + if (coordinateSystem3D == null || matrix4D == null) { return null; } @@ -322,4 +325,4 @@ public static CoordinateSystem3D Transform(this CoordinateSystem3D coordinateSys return new CoordinateSystem3D(origin, axisX, axisY, axisZ); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Triangulate.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Triangulate.cs index 0329489e9..abaf57a70 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Triangulate.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Triangulate.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -96,7 +99,7 @@ public static List Triangulate(this Face3D face3D, IEnumerable plane.Convert(x)); } @@ -217,7 +220,7 @@ public static List Triangulate(this Sphere sphere, int density) triangle3D = new Triangle3D(point3DList[i][j - 1], point3DList[i + 1][j - 1], point3DList[i + 1][j]); result.Add(triangle3D); - if(point3DList[i][j - 1] != point3DList[i][j]) + if (point3DList[i][j - 1] != point3DList[i][j]) { triangle3D = new Triangle3D(point3DList[i][j - 1], point3DList[i + 1][j], point3DList[i][j]); result.Add(triangle3D); @@ -230,7 +233,7 @@ public static List Triangulate(this Sphere sphere, int density) public static List Triangulate(this Circle3D circle3D, int density) { - if(circle3D == null || density < 1) + if (circle3D == null || density < 1) { return null; } @@ -243,7 +246,7 @@ public static List Triangulate(this Circle3D circle3D, int density) Planar.Circle2D circle2D = new Planar.Circle2D(plane.Convert(circle3D.Center), circle3D.Radius); List triangle2Ds = Planar.Query.Triangulate(circle2D, density); - if(triangle2Ds == null || triangle2Ds.Count == 0) + if (triangle2Ds == null || triangle2Ds.Count == 0) { return null; } @@ -251,4 +254,4 @@ public static List Triangulate(this Circle3D circle3D, int density) return triangle2Ds.ConvertAll(x => plane.Convert(x)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/TryClose.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/TryClose.cs index 7fd4a344b..af32bcf28 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/TryClose.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/TryClose.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -10,25 +13,25 @@ public static bool TryClose(this Shell shell, out Shell shell_Closed, double tol { shell_Closed = null; - if(shell == null) + if (shell == null) { return false; } - if(shell.IsClosed(tolerance)) + if (shell.IsClosed(tolerance)) { shell_Closed = (Shell)shell.Clone(); return true; } List face3Ds = shell.Face3Ds; - if(face3Ds == null || face3Ds.Count < 3) + if (face3Ds == null || face3Ds.Count < 3) { return false; } shell_Closed = AveragedPoints(shell, true, tolerance_SilverSpacing, tolerance); - if(!shell_Closed.IsClosed(tolerance)) + if (!shell_Closed.IsClosed(tolerance)) { shell_Closed = AveragedPoints(shell_Closed, false, tolerance_SilverSpacing, tolerance); @@ -73,7 +76,7 @@ public static Shell AveragedPoints(this Shell shell, bool distanceCheck = true, return shell.Clone() as Shell; } - if(distanceCheck) + if (distanceCheck) { for (int i = point3DsList.Count - 1; i >= 0; i--) { @@ -123,4 +126,4 @@ public static Shell AveragedPoints(this Shell shell, bool distanceCheck = true, return new Shell(face3Ds); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/TrySplitEdges.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/TrySplitEdges.cs index dc1941b29..8fb39341e 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/TrySplitEdges.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/TrySplitEdges.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -47,14 +50,14 @@ public static bool TrySplitEdges(this Face3D face3D_Split, Face3D face3D_Splitti } List segment3Ds = ((ISegmentable3D)edge_Splitting)?.GetSegments(); - if(segment3Ds == null || segment3Ds.Count == 0) + if (segment3Ds == null || segment3Ds.Count == 0) { continue; } - foreach(Segment3D segment3D in segment3Ds) + foreach (Segment3D segment3D in segment3Ds) { - if(!boundingBox3D_Split.InRange(segment3D, tolerance)) + if (!boundingBox3D_Split.InRange(segment3D, tolerance)) { continue; } @@ -95,18 +98,18 @@ public static bool TrySplitEdges(this Face3D face3D_Split, Face3D face3D_Splitti foreach (Segment3D segment3D_Temp in segment3Ds_Temp) { List point3Ds_Temp = segment3D_Temp?.GetPoints(); - if(point3Ds_Temp == null || point3Ds_Temp.Count == 0) + if (point3Ds_Temp == null || point3Ds_Temp.Count == 0) { continue; } - foreach(Point3D point3D in point3Ds_Temp) + foreach (Point3D point3D in point3Ds_Temp) { if (point3D == null || !polygon3D.On(point3D, tolerance)) { continue; } - + if (point3Ds_Polygon3D.Find(x => x.Distance(point3D) < tolerance) != null) { continue; @@ -200,7 +203,7 @@ public static bool TrySplitEdges(this Face3D face3D_Split, Face3D face3D_Splitti } } - if(updated) + if (updated) { result = plane.Convert(Planar.Create.Face2D(plane.Convert(externalEdge), internalEdges?.ConvertAll(x => plane.Convert(x)))); return true; @@ -214,7 +217,7 @@ public static bool TrySplitEdges(this Face3D face3D_Split, IEnumerable f { result = null; - if(face3D_Split == null || face3Ds_Splitting == null) + if (face3D_Split == null || face3Ds_Splitting == null) { return false; } @@ -222,16 +225,16 @@ public static bool TrySplitEdges(this Face3D face3D_Split, IEnumerable f result = new Face3D(face3D_Split); bool @bool = false; - foreach(Face3D face3D_Splitting in face3Ds_Splitting) + foreach (Face3D face3D_Splitting in face3Ds_Splitting) { - if(TrySplitEdges(result, face3D_Splitting, out Face3D face3D, tolerance) && face3D != null) + if (TrySplitEdges(result, face3D_Splitting, out Face3D face3D, tolerance) && face3D != null) { result = face3D; @bool = true; } } - if(!@bool) + if (!@bool) { result = null; } @@ -248,16 +251,16 @@ public static bool TrySplitEdges(this Shell shell_Split, IEnumerable fac { result = null; - if(shell_Split == null || face3Ds_Splitting == null) + if (shell_Split == null || face3Ds_Splitting == null) { return false; } List face3Ds = shell_Split.Face3Ds; bool @bool = false; - for(int i=0; i < face3Ds.Count; i++) + for (int i = 0; i < face3Ds.Count; i++) { - if(TrySplitEdges(face3Ds[i], face3Ds_Splitting, out Face3D face3D, tolerance)) + if (TrySplitEdges(face3Ds[i], face3Ds_Splitting, out Face3D face3D, tolerance)) { face3Ds[i] = face3D; @bool = true; @@ -273,4 +276,4 @@ public static bool TrySplitEdges(this Shell shell_Split, IEnumerable fac } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Union.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Union.cs index d84cca0d2..a5e2a73fe 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Union.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Union.cs @@ -1,7 +1,10 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; +using System; using System.Collections.Generic; using System.Linq; -using SAM.Geometry.Planar; namespace SAM.Geometry.Spatial { @@ -33,7 +36,7 @@ public static List Union(this Shell shell_1, Shell shell_2, double silver for (int i = boundaries_1.Count - 1; i >= 0; i--) { Face3D face3D = boundaries_1[i]?.Item2; - if(face3D == null) + if (face3D == null) { continue; } @@ -45,7 +48,7 @@ public static List Union(this Shell shell_1, Shell shell_2, double silver if (boundaries_On != null && boundaries_On.Count != 0) { boundaries_On.ForEach(x => boundaries_2.Remove(x)); - if(normal == null) + if (normal == null) { normal = shell_1_Temp.Normal(i, true, silverSpacing, tolerance_Distance); } @@ -53,7 +56,7 @@ public static List Union(this Shell shell_1, Shell shell_2, double silver for (int j = boundaries_On.Count - 1; j >= 0; j--) { Vector3D normal_Temp = shell_2_Temp.Normal(boundaries_On[j].Item2.InternalPoint3D(tolerance_Distance), true, silverSpacing, tolerance_Distance); - if(!normal.SameHalf(normal_Temp)) + if (!normal.SameHalf(normal_Temp)) { boundaries_1.Remove(boundaries_1[i]); break; @@ -162,23 +165,23 @@ public static List Union(this IEnumerable shells, double silverSpa } } - if(result.Count != shells.Count()) + if (result.Count != shells.Count()) { result = Union(result, silverSpacing, tolerance_Angle, tolerance_Distance); } return result; } - + public static List Union(this IEnumerable face3Ds, double tolerance = Core.Tolerance.Distance) { - if(face3Ds == null) + if (face3Ds == null) { return null; } List result = new List(); - if(face3Ds.Count() == 0) + if (face3Ds.Count() == 0) { return result; } @@ -186,32 +189,32 @@ public static List Union(this IEnumerable face3Ds, double tolera List face3Ds_Temp = new List(face3Ds); face3Ds_Temp.RemoveAll(x => x == null || !x.IsValid()); - while(face3Ds_Temp.Count > 0) + while (face3Ds_Temp.Count > 0) { Face3D face3D_Temp = face3Ds_Temp[0]; Plane plane = face3D_Temp.GetPlane(); - if(plane == null) + if (plane == null) { face3Ds_Temp.RemoveAt(0); continue; } List face3Ds_Coplanar = new List(); - foreach(Face3D face3D_Temp_Temp in face3Ds_Temp) + foreach (Face3D face3D_Temp_Temp in face3Ds_Temp) { - if(!plane.Coplanar(face3D_Temp_Temp?.GetPlane(), tolerance)) + if (!plane.Coplanar(face3D_Temp_Temp?.GetPlane(), tolerance)) { continue; } Point3D point3D = face3D_Temp_Temp.InternalPoint3D(tolerance); - if(point3D == null || !point3D.IsValid()) + if (point3D == null || !point3D.IsValid()) { continue; } - if(plane.Distance(point3D) > tolerance) + if (plane.Distance(point3D) > tolerance) { continue; } @@ -221,7 +224,7 @@ public static List Union(this IEnumerable face3Ds, double tolera face3Ds_Coplanar.ForEach(x => face3Ds_Temp.Remove(x)); - switch(face3Ds_Coplanar.Count) + switch (face3Ds_Coplanar.Count) { case 0: return null; @@ -233,15 +236,15 @@ public static List Union(this IEnumerable face3Ds, double tolera default: List face2Ds = face3Ds_Coplanar.ConvertAll(x => plane.Convert(x)).Union(tolerance); - if(face2Ds == null || face2Ds.Count == 0) + if (face2Ds == null || face2Ds.Count == 0) { result.AddRange(face3Ds_Coplanar); } else { - foreach(Face2D face2D in face2Ds) + foreach (Face2D face2D in face2Ds) { - if(face2D == null || !face2D.IsValid()) + if (face2D == null || !face2D.IsValid()) { continue; } @@ -258,4 +261,4 @@ public static List Union(this IEnumerable face3Ds, double tolera return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Vertical.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Vertical.cs index 6c26064ef..6ebc5e790 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Vertical.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Vertical.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Spatial { public static partial class Query { @@ -18,4 +21,4 @@ public static bool Vertical(this Face3D face3D, double tolerance = Core.Toleranc return Vertical(face3D.GetPlane(), tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Geometry/Spatial/Query/Volume.cs b/SAM/SAM.Geometry/Geometry/Spatial/Query/Volume.cs index a9892b163..cefe1df93 100644 --- a/SAM/SAM.Geometry/Geometry/Spatial/Query/Volume.cs +++ b/SAM/SAM.Geometry/Geometry/Spatial/Query/Volume.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Geometry.Spatial { @@ -6,12 +9,12 @@ public static partial class Query { public static double Volume(this Shell shell, double silverSpacing = Core.Tolerance.MacroDistance, double tolerance = Core.Tolerance.Distance) { - if(shell == null) + if (shell == null) { return double.NaN; } - if(!shell.IsClosed(silverSpacing)) + if (!shell.IsClosed(silverSpacing)) { return double.NaN; } @@ -20,30 +23,30 @@ public static double Volume(this Shell shell, double silverSpacing = Core.Tolera shell_Temp.OrientNormals(false, silverSpacing, tolerance); List face3Ds = shell_Temp.Face3Ds; - if(face3Ds == null || face3Ds.Count == 0) + if (face3Ds == null || face3Ds.Count == 0) { return double.NaN; } double result = 0; - foreach(Face3D face3D in face3Ds) + foreach (Face3D face3D in face3Ds) { - if(face3D == null || face3D.GetArea() < silverSpacing) + if (face3D == null || face3D.GetArea() < silverSpacing) { continue; } - List triangle3Ds = face3D.Triangulate(tolerance); - if(triangle3Ds == null || triangle3Ds.Count == 0) + List triangle3Ds = face3D.Triangulate(tolerance); + if (triangle3Ds == null || triangle3Ds.Count == 0) { continue; } Vector3D normal = face3D.GetPlane().Normal; - foreach(Triangle3D triangle3D in triangle3Ds) + foreach (Triangle3D triangle3D in triangle3Ds) { - if(triangle3D == null) + if (triangle3D == null) { continue; } @@ -63,19 +66,19 @@ public static double Volume(this Shell shell, double silverSpacing = Core.Tolera public static double Volume(this Extrusion extrusion) { - if(extrusion == null) + if (extrusion == null) { return double.NaN; } Face3D face3D = extrusion.Face3D; - if(face3D == null) + if (face3D == null) { return double.NaN; } Vector3D vector3D = extrusion.Vector; - if(vector3D == null) + if (vector3D == null) { return double.NaN; } @@ -83,4 +86,4 @@ public static double Volume(this Extrusion extrusion) return face3D.GetArea() * vector3D.Length; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Base/Classes/Appearance/Appearance.cs b/SAM/SAM.Geometry/Object/Base/Classes/Appearance/Appearance.cs index e443c6fbd..76dc70dd0 100644 --- a/SAM/SAM.Geometry/Object/Base/Classes/Appearance/Appearance.cs +++ b/SAM/SAM.Geometry/Object/Base/Classes/Appearance/Appearance.cs @@ -1,9 +1,12 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Drawing; namespace SAM.Geometry.Object { - public abstract class Appearance :IAppearance + public abstract class Appearance : IAppearance { public Color Color { get; set; } @@ -23,7 +26,7 @@ public Appearance(JObject jObject) public Appearance(Appearance appearance) { - if(appearance != null) + if (appearance != null) { Color = appearance.Color; Opacity = appearance.Opacity; @@ -66,8 +69,8 @@ public virtual JObject ToJObject() jObject.Add("_type", Core.Query.FullTypeName(this)); jObject.Add("Color", new Core.SAMColor(Color.A, Color.R, Color.G, Color.B).ToJObject()); - - if(!double.IsNaN(Opacity)) + + if (!double.IsNaN(Opacity)) { jObject.Add("Opacity", Opacity); } diff --git a/SAM/SAM.Geometry/Object/Base/Classes/Appearance/CurveAppearance.cs b/SAM/SAM.Geometry/Object/Base/Classes/Appearance/CurveAppearance.cs index 6e91e6f64..8caff9123 100644 --- a/SAM/SAM.Geometry/Object/Base/Classes/Appearance/CurveAppearance.cs +++ b/SAM/SAM.Geometry/Object/Base/Classes/Appearance/CurveAppearance.cs @@ -1,11 +1,14 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Drawing; namespace SAM.Geometry.Object { public class CurveAppearance : PointAppearance { - public CurveAppearance(Color color, double thickness) + public CurveAppearance(Color color, double thickness) : base(color, thickness) { } diff --git a/SAM/SAM.Geometry/Object/Base/Classes/Appearance/PointAppearance.cs b/SAM/SAM.Geometry/Object/Base/Classes/Appearance/PointAppearance.cs index 76c747f48..90b1b6113 100644 --- a/SAM/SAM.Geometry/Object/Base/Classes/Appearance/PointAppearance.cs +++ b/SAM/SAM.Geometry/Object/Base/Classes/Appearance/PointAppearance.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Drawing; namespace SAM.Geometry.Object @@ -7,22 +10,22 @@ public class PointAppearance : Appearance { public double Thickness { get; set; } - public PointAppearance(Color color, double thickness) + public PointAppearance(Color color, double thickness) : base(color) { Thickness = thickness; } public PointAppearance(JObject jObject) - :base(jObject) + : base(jObject) { } public PointAppearance(PointAppearance pointAppearance) - :base(pointAppearance) + : base(pointAppearance) { - if(pointAppearance != null) + if (pointAppearance != null) { Thickness = pointAppearance.Thickness; } @@ -31,7 +34,7 @@ public PointAppearance(PointAppearance pointAppearance) public override JObject ToJObject() { JObject jObject = base.ToJObject(); - if(jObject == null) + if (jObject == null) { return null; } @@ -46,7 +49,7 @@ public override JObject ToJObject() public override bool FromJObject(JObject jObject) { - if(!base.FromJObject(jObject)) + if (!base.FromJObject(jObject)) { return false; } diff --git a/SAM/SAM.Geometry/Object/Base/Classes/Appearance/SurfaceAppearance.cs b/SAM/SAM.Geometry/Object/Base/Classes/Appearance/SurfaceAppearance.cs index bbe3246d8..608dda95d 100644 --- a/SAM/SAM.Geometry/Object/Base/Classes/Appearance/SurfaceAppearance.cs +++ b/SAM/SAM.Geometry/Object/Base/Classes/Appearance/SurfaceAppearance.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Drawing; namespace SAM.Geometry.Object @@ -6,8 +9,8 @@ namespace SAM.Geometry.Object public class SurfaceAppearance : Appearance { public CurveAppearance CurveAppearance { get; set; } - - public SurfaceAppearance(Color surfaceColor, Color curveColor, double curveThickness) + + public SurfaceAppearance(Color surfaceColor, Color curveColor, double curveThickness) : base(surfaceColor) { CurveAppearance = new CurveAppearance(curveColor, curveThickness); diff --git a/SAM/SAM.Geometry/Object/Base/Classes/Appearance/TextAppearance.cs b/SAM/SAM.Geometry/Object/Base/Classes/Appearance/TextAppearance.cs index 31ec0861e..00d8ba209 100644 --- a/SAM/SAM.Geometry/Object/Base/Classes/Appearance/TextAppearance.cs +++ b/SAM/SAM.Geometry/Object/Base/Classes/Appearance/TextAppearance.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Drawing; namespace SAM.Geometry.Object @@ -6,10 +9,10 @@ namespace SAM.Geometry.Object public class TextAppearance : Appearance { public double Height { get; set; } - + public string FontFamilyName { get; set; } - public TextAppearance(Color color, double height, string fontFamilyName) + public TextAppearance(Color color, double height, string fontFamilyName) : base(color) { Height = height; @@ -17,15 +20,15 @@ public TextAppearance(Color color, double height, string fontFamilyName) } public TextAppearance(JObject jObject) - :base(jObject) + : base(jObject) { } public TextAppearance(TextAppearance textAppearance) - :base(textAppearance) + : base(textAppearance) { - if(textAppearance != null) + if (textAppearance != null) { Height = textAppearance.Height; FontFamilyName = textAppearance.FontFamilyName; @@ -35,7 +38,7 @@ public TextAppearance(TextAppearance textAppearance) public override JObject ToJObject() { JObject jObject = base.ToJObject(); - if(jObject == null) + if (jObject == null) { return null; } @@ -45,7 +48,7 @@ public override JObject ToJObject() jObject.Add("Height", Height); } - if(!string.IsNullOrEmpty(FontFamilyName)) + if (!string.IsNullOrEmpty(FontFamilyName)) { jObject.Add("FontFamilyName", FontFamilyName); } @@ -55,7 +58,7 @@ public override JObject ToJObject() public override bool FromJObject(JObject jObject) { - if(!base.FromJObject(jObject)) + if (!base.FromJObject(jObject)) { return false; } diff --git a/SAM/SAM.Geometry/Object/Base/Classes/GeometryObjectModel.cs b/SAM/SAM.Geometry/Object/Base/Classes/GeometryObjectModel.cs index 3b8e7826c..97507ef32 100644 --- a/SAM/SAM.Geometry/Object/Base/Classes/GeometryObjectModel.cs +++ b/SAM/SAM.Geometry/Object/Base/Classes/GeometryObjectModel.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -9,12 +12,12 @@ public class GeometryObjectModel : Core.SAMModel private SAMGeometryObjectCollection sAMGeometryObjectCollection; public GeometryObjectModel(GeometryObjectModel geometryObjectModel) - :base(geometryObjectModel) + : base(geometryObjectModel) { - if(geometryObjectModel?.sAMGeometryObjectCollection != null) + if (geometryObjectModel?.sAMGeometryObjectCollection != null) { sAMGeometryObjectCollection = new SAMGeometryObjectCollection(); - foreach(ISAMGeometryObject sAMGeometryObject in geometryObjectModel.sAMGeometryObjectCollection) + foreach (ISAMGeometryObject sAMGeometryObject in geometryObjectModel.sAMGeometryObjectCollection) { sAMGeometryObjectCollection.Add(sAMGeometryObject); } @@ -22,25 +25,25 @@ public GeometryObjectModel(GeometryObjectModel geometryObjectModel) } public GeometryObjectModel(JObject jObject) - :base(jObject) + : base(jObject) { } public GeometryObjectModel() - :base() + : base() { } public bool Add(ISAMGeometryObject sAMGeometryObject) { - if(sAMGeometryObject == null) + if (sAMGeometryObject == null) { return false; } - if(sAMGeometryObjectCollection == null) + if (sAMGeometryObjectCollection == null) { sAMGeometryObjectCollection = new SAMGeometryObjectCollection(); } @@ -51,7 +54,7 @@ public bool Add(ISAMGeometryObject sAMGeometryObject) public List GetSAMGeometryObjects(Func func = null) where T : ISAMGeometryObject { - if(sAMGeometryObjectCollection == null) + if (sAMGeometryObjectCollection == null) { return null; } @@ -59,7 +62,7 @@ public List GetSAMGeometryObjects(Func func = null) where T : ISA List result = new List(); foreach (ISAMGeometryObject sAMGeometryObject in sAMGeometryObjectCollection) { - if(!(sAMGeometryObject is T)) + if (!(sAMGeometryObject is T)) { continue; } @@ -68,7 +71,7 @@ public List GetSAMGeometryObjects(Func func = null) where T : ISA if (func != null) { - if(!func.Invoke(t)) + if (!func.Invoke(t)) { continue; } @@ -90,7 +93,7 @@ public T GetSAMGeometryObject(Func func, bool recursive = true) wher foreach (ISAMGeometryObject sAMGeometryObject in sAMGeometryObjectCollection) { T t = Query.ISAMGeometryObject(sAMGeometryObject, func, recursive); - if(t != null) + if (t != null) { return t; } @@ -102,18 +105,18 @@ public T GetSAMGeometryObject(Func func, bool recursive = true) wher public override JObject ToJObject() { JObject result = base.ToJObject(); - if(result == null) + if (result == null) { result = new JObject(); } - if(sAMGeometryObjectCollection != null) + if (sAMGeometryObjectCollection != null) { JArray jArray = new JArray(); foreach (ISAMGeometryObject sAMGeometryObject in sAMGeometryObjectCollection) { - if(sAMGeometryObject == null) + if (sAMGeometryObject == null) { continue; } @@ -128,12 +131,12 @@ public override JObject ToJObject() public override bool FromJObject(JObject jObject) { - if(!base.FromJObject(jObject)) + if (!base.FromJObject(jObject)) { return false; } - if(jObject.ContainsKey("GeometryObjects")) + if (jObject.ContainsKey("GeometryObjects")) { JArray jArray = jObject.Value("GeometryObjects"); @@ -141,7 +144,7 @@ public override bool FromJObject(JObject jObject) foreach (JObject jObject_GeometryObject in jArray) { ISAMGeometryObject sAMGeometryObject = Core.Create.IJSAMObject(jObject_GeometryObject); - if(sAMGeometryObject != null) + if (sAMGeometryObject != null) { sAMGeometryObjectCollection.Add(sAMGeometryObject); } diff --git a/SAM/SAM.Geometry/Object/Base/Classes/SAMGeometryObjectCollection.cs b/SAM/SAM.Geometry/Object/Base/Classes/SAMGeometryObjectCollection.cs index 7dbcec777..825eae41f 100644 --- a/SAM/SAM.Geometry/Object/Base/Classes/SAMGeometryObjectCollection.cs +++ b/SAM/SAM.Geometry/Object/Base/Classes/SAMGeometryObjectCollection.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections; using System.Collections.Generic; @@ -23,13 +26,13 @@ public SAMGeometryObjectCollection(SAMGeometryObjectCollection sAMGeometryObject if (sAMGeometryObjectCollection != null) { List sAMGeometryObjects_Temp = sAMGeometryObjectCollection.sAMGeometryObjects; - if(sAMGeometryObjects_Temp != null) + if (sAMGeometryObjects_Temp != null) { sAMGeometryObjects = new List(); foreach (ISAMGeometryObject sAMGeometryObject in sAMGeometryObjects_Temp) { ISAMGeometryObject sAMGeometryObject_Temp = Core.Query.Clone(sAMGeometryObject); - if(sAMGeometryObject_Temp != null) + if (sAMGeometryObject_Temp != null) { sAMGeometryObjects.Add(sAMGeometryObject_Temp); } @@ -43,10 +46,10 @@ public SAMGeometryObjectCollection(IEnumerable sAMGeometryOb if (sAMGeometryObjects != null) { this.sAMGeometryObjects = new List(); - foreach(ISAMGeometryObject sAMGeometryObject in sAMGeometryObjects) + foreach (ISAMGeometryObject sAMGeometryObject in sAMGeometryObjects) { ISAMGeometryObject sAMGeometryObject_Temp = Core.Query.Clone(sAMGeometryObject); - if(sAMGeometryObject_Temp != null) + if (sAMGeometryObject_Temp != null) { this.sAMGeometryObjects.Add(sAMGeometryObject_Temp); } @@ -57,7 +60,7 @@ public SAMGeometryObjectCollection(IEnumerable sAMGeometryOb public SAMGeometryObjectCollection(ISAMGeometryObject sAMGeometryObject) { ISAMGeometryObject sAMGeometryObject_Temp = Core.Query.Clone(sAMGeometryObject); - if(sAMGeometryObject_Temp != null) + if (sAMGeometryObject_Temp != null) { sAMGeometryObjects = new List() { sAMGeometryObject_Temp }; } @@ -71,7 +74,7 @@ public void Add(ISAMGeometryObject sAMGeometryObject) return; } - if(sAMGeometryObjects == null) + if (sAMGeometryObjects == null) { sAMGeometryObjects = new List(); } @@ -81,20 +84,20 @@ public void Add(ISAMGeometryObject sAMGeometryObject) public bool FromJObject(JObject jObject) { - if(jObject == null) + if (jObject == null) { return false; } - if(jObject.ContainsKey("GeometryObjects")) + if (jObject.ContainsKey("GeometryObjects")) { sAMGeometryObjects = new List(); JArray jArray = jObject.Value("GeometryObjects"); - foreach(JObject jObject_GeometryObject in jArray) + foreach (JObject jObject_GeometryObject in jArray) { ISAMGeometryObject sAMGeometryObject = Core.Query.IJSAMObject(jObject_GeometryObject) as ISAMGeometryObject; - if(sAMGeometryObject != null) + if (sAMGeometryObject != null) { sAMGeometryObjects.Add(sAMGeometryObject); } @@ -114,12 +117,12 @@ public JObject ToJObject() JObject jObject = new JObject(); jObject.Add("_type", Core.Query.FullTypeName(this)); - if(sAMGeometryObjects != null) + if (sAMGeometryObjects != null) { JArray jArray = new JArray(); - foreach(ISAMGeometryObject sAMGeometryObject in sAMGeometryObjects) + foreach (ISAMGeometryObject sAMGeometryObject in sAMGeometryObjects) { - if(sAMGeometryObject == null) + if (sAMGeometryObject == null) { continue; } diff --git a/SAM/SAM.Geometry/Object/Base/Convert/ToSAM/ISAMGeometries.cs b/SAM/SAM.Geometry/Object/Base/Convert/ToSAM/ISAMGeometries.cs index 7297894cb..60edbacb6 100644 --- a/SAM/SAM.Geometry/Object/Base/Convert/ToSAM/ISAMGeometries.cs +++ b/SAM/SAM.Geometry/Object/Base/Convert/ToSAM/ISAMGeometries.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Object.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Object.Planar; using System.Collections.Generic; namespace SAM.Geometry.Object @@ -34,7 +37,7 @@ public static List ToSAM_ISAMGeometry(this ISAMGeometryObject sAMG foreach (ISAMGeometry2DObject sAMGeometry2DObject in (IEnumerable)sAMGeometryObject) { List geometries = ToSAM_ISAMGeometry(sAMGeometry2DObject); - if(geometries != null) + if (geometries != null) { result.AddRange(geometries); } diff --git a/SAM/SAM.Geometry/Object/Base/Convert/ToSAM/ISAMGeometryObject.cs b/SAM/SAM.Geometry/Object/Base/Convert/ToSAM/ISAMGeometryObject.cs index 8f57b6953..2c1435450 100644 --- a/SAM/SAM.Geometry/Object/Base/Convert/ToSAM/ISAMGeometryObject.cs +++ b/SAM/SAM.Geometry/Object/Base/Convert/ToSAM/ISAMGeometryObject.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Object.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Object.Spatial; using SAM.Geometry.Spatial; namespace SAM.Geometry.Object diff --git a/SAM/SAM.Geometry/Object/Base/Interfaces/IAppearance.cs b/SAM/SAM.Geometry/Object/Base/Interfaces/IAppearance.cs index 7d42579b8..a8010e108 100644 --- a/SAM/SAM.Geometry/Object/Base/Interfaces/IAppearance.cs +++ b/SAM/SAM.Geometry/Object/Base/Interfaces/IAppearance.cs @@ -1,6 +1,9 @@ -namespace SAM.Geometry.Object +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Object { public interface IAppearance : Core.IJSAMObject { } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Base/Interfaces/ISAMGeometryObject.cs b/SAM/SAM.Geometry/Object/Base/Interfaces/ISAMGeometryObject.cs index edc7d0fd8..3836af4e0 100644 --- a/SAM/SAM.Geometry/Object/Base/Interfaces/ISAMGeometryObject.cs +++ b/SAM/SAM.Geometry/Object/Base/Interfaces/ISAMGeometryObject.cs @@ -1,6 +1,9 @@ -namespace SAM.Geometry.Object +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Object { public interface ISAMGeometryObject : Core.IJSAMObject { } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Base/Query/DefaultCurveAppearance.cs b/SAM/SAM.Geometry/Object/Base/Query/DefaultCurveAppearance.cs index c0a5d2816..441f276cf 100644 --- a/SAM/SAM.Geometry/Object/Base/Query/DefaultCurveAppearance.cs +++ b/SAM/SAM.Geometry/Object/Base/Query/DefaultCurveAppearance.cs @@ -1,4 +1,7 @@ - +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + + namespace SAM.Geometry.Object { public static partial class Query diff --git a/SAM/SAM.Geometry/Object/Base/Query/DefaultPointAppearance.cs b/SAM/SAM.Geometry/Object/Base/Query/DefaultPointAppearance.cs index a46823c53..ac3bf3776 100644 --- a/SAM/SAM.Geometry/Object/Base/Query/DefaultPointAppearance.cs +++ b/SAM/SAM.Geometry/Object/Base/Query/DefaultPointAppearance.cs @@ -1,4 +1,7 @@ - +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + + namespace SAM.Geometry.Object { public static partial class Query diff --git a/SAM/SAM.Geometry/Object/Base/Query/DefaultSurfaceAppearance.cs b/SAM/SAM.Geometry/Object/Base/Query/DefaultSurfaceAppearance.cs index 33ae85ded..36f1fae77 100644 --- a/SAM/SAM.Geometry/Object/Base/Query/DefaultSurfaceAppearance.cs +++ b/SAM/SAM.Geometry/Object/Base/Query/DefaultSurfaceAppearance.cs @@ -1,4 +1,7 @@ - +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + + namespace SAM.Geometry.Object { public static partial class Query diff --git a/SAM/SAM.Geometry/Object/Base/Query/DefaultTextAppearance.cs b/SAM/SAM.Geometry/Object/Base/Query/DefaultTextAppearance.cs index 248244c16..bb2b31c24 100644 --- a/SAM/SAM.Geometry/Object/Base/Query/DefaultTextAppearance.cs +++ b/SAM/SAM.Geometry/Object/Base/Query/DefaultTextAppearance.cs @@ -1,4 +1,7 @@ - +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + + namespace SAM.Geometry.Object { public static partial class Query diff --git a/SAM/SAM.Geometry/Object/Base/Query/ISAMGeometryObject.cs b/SAM/SAM.Geometry/Object/Base/Query/ISAMGeometryObject.cs index fb0170232..6a6f1842f 100644 --- a/SAM/SAM.Geometry/Object/Base/Query/ISAMGeometryObject.cs +++ b/SAM/SAM.Geometry/Object/Base/Query/ISAMGeometryObject.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections; namespace SAM.Geometry.Object @@ -17,23 +20,23 @@ public static T ISAMGeometryObject(ISAMGeometryObject sAMGeometryObject, Func return (T)sAMGeometryObject; } - if(!recursive) + if (!recursive) { return default(T); } if (sAMGeometryObject is IEnumerable) { - foreach(object @object in (IEnumerable)sAMGeometryObject) + foreach (object @object in (IEnumerable)sAMGeometryObject) { ISAMGeometryObject sAMGeometryObject_Temp = @object as ISAMGeometryObject; - if(sAMGeometryObject_Temp == null) + if (sAMGeometryObject_Temp == null) { continue; } T t = ISAMGeometryObject(sAMGeometryObject_Temp, func); - if(t != null) + if (t != null) { return t; } @@ -44,4 +47,4 @@ public static T ISAMGeometryObject(ISAMGeometryObject sAMGeometryObject, Func } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Planar/Classes/BoundingBox2DObject.cs b/SAM/SAM.Geometry/Object/Planar/Classes/BoundingBox2DObject.cs index a16843dea..3a812f527 100644 --- a/SAM/SAM.Geometry/Object/Planar/Classes/BoundingBox2DObject.cs +++ b/SAM/SAM.Geometry/Object/Planar/Classes/BoundingBox2DObject.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Planar; diff --git a/SAM/SAM.Geometry/Object/Planar/Classes/Polygon2DObject.cs b/SAM/SAM.Geometry/Object/Planar/Classes/Polygon2DObject.cs index 8026648ae..356bc6183 100644 --- a/SAM/SAM.Geometry/Object/Planar/Classes/Polygon2DObject.cs +++ b/SAM/SAM.Geometry/Object/Planar/Classes/Polygon2DObject.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Planar; diff --git a/SAM/SAM.Geometry/Object/Planar/Classes/Polyline2DObject.cs b/SAM/SAM.Geometry/Object/Planar/Classes/Polyline2DObject.cs index 4ffe92d63..88b1680ab 100644 --- a/SAM/SAM.Geometry/Object/Planar/Classes/Polyline2DObject.cs +++ b/SAM/SAM.Geometry/Object/Planar/Classes/Polyline2DObject.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Planar; diff --git a/SAM/SAM.Geometry/Object/Planar/Classes/SAMGeometry2DObjectCollection.cs b/SAM/SAM.Geometry/Object/Planar/Classes/SAMGeometry2DObjectCollection.cs index 41981ecbb..2624aa82a 100644 --- a/SAM/SAM.Geometry/Object/Planar/Classes/SAMGeometry2DObjectCollection.cs +++ b/SAM/SAM.Geometry/Object/Planar/Classes/SAMGeometry2DObjectCollection.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections; using System.Collections.Generic; diff --git a/SAM/SAM.Geometry/Object/Planar/Classes/Segment2DObject.cs b/SAM/SAM.Geometry/Object/Planar/Classes/Segment2DObject.cs index 0ef8d154f..2caa9e91e 100644 --- a/SAM/SAM.Geometry/Object/Planar/Classes/Segment2DObject.cs +++ b/SAM/SAM.Geometry/Object/Planar/Classes/Segment2DObject.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Planar; @@ -34,7 +37,7 @@ public Segment2DObject(Segment2D segment2D, CurveAppearance curveAppearance) } public Segment2DObject(JObject jObject) - :base(jObject) + : base(jObject) { } diff --git a/SAM/SAM.Geometry/Object/Planar/Create/SAMGeometry2DObjectCollection.cs b/SAM/SAM.Geometry/Object/Planar/Create/SAMGeometry2DObjectCollection.cs index 80f34f32d..4586ff162 100644 --- a/SAM/SAM.Geometry/Object/Planar/Create/SAMGeometry2DObjectCollection.cs +++ b/SAM/SAM.Geometry/Object/Planar/Create/SAMGeometry2DObjectCollection.cs @@ -1,25 +1,28 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using System.Collections.Generic; namespace SAM.Geometry.Object.Planar { public static partial class Create { - public static SAMGeometry2DObjectCollection SAMGeometry2DObjectCollection(this IEnumerable sAMGeometry2Ds, SurfaceAppearance surfaceAppearance, CurveAppearance curveAppearance) where T: ISAMGeometry2D + public static SAMGeometry2DObjectCollection SAMGeometry2DObjectCollection(this IEnumerable sAMGeometry2Ds, SurfaceAppearance surfaceAppearance, CurveAppearance curveAppearance) where T : ISAMGeometry2D { - if(sAMGeometry2Ds == null) + if (sAMGeometry2Ds == null) { return null; } SAMGeometry2DObjectCollection result = new SAMGeometry2DObjectCollection(); - foreach(T sAMGeometry2D in sAMGeometry2Ds) + foreach (T sAMGeometry2D in sAMGeometry2Ds) { - if(sAMGeometry2D is ISAMGeometry2DObject) + if (sAMGeometry2D is ISAMGeometry2DObject) { result.Add((ISAMGeometry2DObject)sAMGeometry2D); } - else if(sAMGeometry2D is Segment2D) + else if (sAMGeometry2D is Segment2D) { result.Add(new Segment2DObject((Segment2D)(object)sAMGeometry2D, curveAppearance)); } @@ -38,4 +41,4 @@ public static SAMGeometry2DObjectCollection SAMGeometry2DObjectCollection(thi return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Planar/Interfaces/IBoundable2DObject.cs b/SAM/SAM.Geometry/Object/Planar/Interfaces/IBoundable2DObject.cs index 623b8b454..4ea23b9b5 100644 --- a/SAM/SAM.Geometry/Object/Planar/Interfaces/IBoundable2DObject.cs +++ b/SAM/SAM.Geometry/Object/Planar/Interfaces/IBoundable2DObject.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; namespace SAM.Geometry.Object.Planar { @@ -6,4 +9,4 @@ public interface IBoundable2DObject : ISAMGeometry2DObject { BoundingBox2D GetBoundingBox(double offset = 0); } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Planar/Interfaces/IBoundingBox2DObject.cs b/SAM/SAM.Geometry/Object/Planar/Interfaces/IBoundingBox2DObject.cs index 6ac1ef781..4a2bbab94 100644 --- a/SAM/SAM.Geometry/Object/Planar/Interfaces/IBoundingBox2DObject.cs +++ b/SAM/SAM.Geometry/Object/Planar/Interfaces/IBoundingBox2DObject.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; namespace SAM.Geometry.Object.Planar { @@ -6,4 +9,4 @@ public interface IBoundingBox2DObject : ISAMGeometry2DObject, IBoundable2DObject { BoundingBox2D BoundingBox2D { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Planar/Interfaces/IFace2DObject.cs b/SAM/SAM.Geometry/Object/Planar/Interfaces/IFace2DObject.cs index 3e523425f..c7be4b6c2 100644 --- a/SAM/SAM.Geometry/Object/Planar/Interfaces/IFace2DObject.cs +++ b/SAM/SAM.Geometry/Object/Planar/Interfaces/IFace2DObject.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; namespace SAM.Geometry.Object.Planar { @@ -6,4 +9,4 @@ public interface IFace2DObject : IBoundable2DObject { Face2D Face2D { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Planar/Interfaces/IPolygon2DObject.cs b/SAM/SAM.Geometry/Object/Planar/Interfaces/IPolygon2DObject.cs index f49b31bf2..bde6be31f 100644 --- a/SAM/SAM.Geometry/Object/Planar/Interfaces/IPolygon2DObject.cs +++ b/SAM/SAM.Geometry/Object/Planar/Interfaces/IPolygon2DObject.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; namespace SAM.Geometry.Object.Planar { @@ -6,4 +9,4 @@ public interface IPolygon2DObject : ISAMGeometry2DObject, IBoundable2DObject { Polygon2D Polygon2D { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Planar/Interfaces/IPolyline2DObject.cs b/SAM/SAM.Geometry/Object/Planar/Interfaces/IPolyline2DObject.cs index b9dd17eb8..cfd4d42b9 100644 --- a/SAM/SAM.Geometry/Object/Planar/Interfaces/IPolyline2DObject.cs +++ b/SAM/SAM.Geometry/Object/Planar/Interfaces/IPolyline2DObject.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; namespace SAM.Geometry.Object.Planar { @@ -6,4 +9,4 @@ public interface IPolyline2DObject : ISAMGeometry2DObject { Polyline2D Polyline2D { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Planar/Interfaces/ISAMGeometry2DObject.cs b/SAM/SAM.Geometry/Object/Planar/Interfaces/ISAMGeometry2DObject.cs index 013cd5e00..c81eb9930 100644 --- a/SAM/SAM.Geometry/Object/Planar/Interfaces/ISAMGeometry2DObject.cs +++ b/SAM/SAM.Geometry/Object/Planar/Interfaces/ISAMGeometry2DObject.cs @@ -1,6 +1,9 @@ -namespace SAM.Geometry.Object.Planar +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Object.Planar { public interface ISAMGeometry2DObject : ISAMGeometryObject { } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Planar/Interfaces/ISegment2DObject.cs b/SAM/SAM.Geometry/Object/Planar/Interfaces/ISegment2DObject.cs index bc60d103b..9e7ce9532 100644 --- a/SAM/SAM.Geometry/Object/Planar/Interfaces/ISegment2DObject.cs +++ b/SAM/SAM.Geometry/Object/Planar/Interfaces/ISegment2DObject.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; namespace SAM.Geometry.Object.Planar { @@ -6,4 +9,4 @@ public interface ISegment2DObject : IBoundable2DObject { Segment2D Segment2D { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Classes/BoundingBox3DObject.cs b/SAM/SAM.Geometry/Object/Spatial/Classes/BoundingBox3DObject.cs index 3e7f21224..b20604797 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Classes/BoundingBox3DObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Classes/BoundingBox3DObject.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Spatial; diff --git a/SAM/SAM.Geometry/Object/Spatial/Classes/ExtrusionObject.cs b/SAM/SAM.Geometry/Object/Spatial/Classes/ExtrusionObject.cs index 2c8a98913..edb79cc87 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Classes/ExtrusionObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Classes/ExtrusionObject.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Spatial; diff --git a/SAM/SAM.Geometry/Object/Spatial/Classes/Face3DObject.cs b/SAM/SAM.Geometry/Object/Spatial/Classes/Face3DObject.cs index 1f751ac59..6f6a85827 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Classes/Face3DObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Classes/Face3DObject.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Spatial; @@ -44,7 +47,7 @@ public Face3DObject(Face3DObject face3DObject) public Face3DObject(Face3D face3D, SurfaceAppearance surfaceAppearance) : base(face3D) { - if(surfaceAppearance != null) + if (surfaceAppearance != null) { SurfaceAppearance = new SurfaceAppearance(surfaceAppearance); } @@ -58,12 +61,12 @@ public Face3DObject(Face3D face3D, System.Drawing.Color surfaceColor, System.Dra public override bool FromJObject(JObject jObject) { - if(!base.FromJObject(jObject)) + if (!base.FromJObject(jObject)) { return false; } - if(jObject.ContainsKey("SurfaceAppearance")) + if (jObject.ContainsKey("SurfaceAppearance")) { SurfaceAppearance = new SurfaceAppearance(jObject.Value("SurfaceAppearance")); } @@ -75,12 +78,12 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { JObject jObject = base.ToJObject(); - if(jObject == null) + if (jObject == null) { return null; } - if(SurfaceAppearance != null) + if (SurfaceAppearance != null) { jObject.Add("SurfaceAppearance", SurfaceAppearance.ToJObject()); } diff --git a/SAM/SAM.Geometry/Object/Spatial/Classes/Geometry3DObjectCollection.cs b/SAM/SAM.Geometry/Object/Spatial/Classes/Geometry3DObjectCollection.cs index c883f7251..bde032149 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Classes/Geometry3DObjectCollection.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Classes/Geometry3DObjectCollection.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Geometry.Object.Spatial @@ -8,26 +11,26 @@ public class Geometry3DObjectCollection : SAMGeometry3DObjectCollection, ITaggab public Tag Tag { get; set; } public Geometry3DObjectCollection() - :base() + : base() { } public Geometry3DObjectCollection(JObject jObject) - :base(jObject) + : base(jObject) { FromJObject(jObject); } public Geometry3DObjectCollection(Geometry3DObjectCollection geometryObjectCollection) - :base(geometryObjectCollection) + : base(geometryObjectCollection) { Tag = geometryObjectCollection?.Tag; } public override bool FromJObject(JObject jObject) { - if(!base.FromJObject(jObject)) + if (!base.FromJObject(jObject)) { return false; } @@ -40,7 +43,7 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { JObject result = base.ToJObject(); - if(result == null) + if (result == null) { return null; } diff --git a/SAM/SAM.Geometry/Object/Spatial/Classes/LinkedFace3D.cs b/SAM/SAM.Geometry/Object/Spatial/Classes/LinkedFace3D.cs index 2cc300fdb..b7f91b58b 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Classes/LinkedFace3D.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Classes/LinkedFace3D.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Geometry.Spatial; using System; diff --git a/SAM/SAM.Geometry/Object/Spatial/Classes/Mesh3DObject.cs b/SAM/SAM.Geometry/Object/Spatial/Classes/Mesh3DObject.cs index db206dbfa..46e20bbc3 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Classes/Mesh3DObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Classes/Mesh3DObject.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Spatial; @@ -44,7 +47,7 @@ public Mesh3DObject(Mesh3DObject mesh3DObject) public Mesh3DObject(Mesh3D mesh3D, SurfaceAppearance surfaceAppearance) : base(mesh3D) { - if(surfaceAppearance != null) + if (surfaceAppearance != null) { SurfaceAppearance = new SurfaceAppearance(surfaceAppearance); } @@ -58,12 +61,12 @@ public Mesh3DObject(Mesh3D mesh3D, System.Drawing.Color surfaceColor, System.Dra public override bool FromJObject(JObject jObject) { - if(!base.FromJObject(jObject)) + if (!base.FromJObject(jObject)) { return false; } - if(jObject.ContainsKey("SurfaceAppearance")) + if (jObject.ContainsKey("SurfaceAppearance")) { SurfaceAppearance = new SurfaceAppearance(jObject.Value("SurfaceAppearance")); } @@ -76,12 +79,12 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { JObject jObject = base.ToJObject(); - if(jObject == null) + if (jObject == null) { return null; } - if(SurfaceAppearance != null) + if (SurfaceAppearance != null) { jObject.Add("SurfaceAppearance", SurfaceAppearance.ToJObject()); } diff --git a/SAM/SAM.Geometry/Object/Spatial/Classes/Point3DObject.cs b/SAM/SAM.Geometry/Object/Spatial/Classes/Point3DObject.cs index cdfc6dc59..e63c1f3b9 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Classes/Point3DObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Classes/Point3DObject.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Spatial; @@ -44,7 +47,7 @@ public Point3DObject(Point3D point3D) public Point3DObject(Point3D point3D, PointAppearance pointAppearance) : base(point3D) { - if(pointAppearance != null) + if (pointAppearance != null) { PointAppearance = new PointAppearance(pointAppearance); } @@ -52,12 +55,12 @@ public Point3DObject(Point3D point3D, PointAppearance pointAppearance) public override bool FromJObject(JObject jObject) { - if(!base.FromJObject(jObject)) + if (!base.FromJObject(jObject)) { return false; } - if(jObject.ContainsKey("PointAppearance")) + if (jObject.ContainsKey("PointAppearance")) { PointAppearance = new PointAppearance(jObject.Value("PointAppearance")); } @@ -70,12 +73,12 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { JObject jObject = base.ToJObject(); - if(jObject == null) + if (jObject == null) { return null; } - if(PointAppearance != null) + if (PointAppearance != null) { jObject.Add("PointAppearance", PointAppearance.ToJObject()); } diff --git a/SAM/SAM.Geometry/Object/Spatial/Classes/Polygon3DObject.cs b/SAM/SAM.Geometry/Object/Spatial/Classes/Polygon3DObject.cs index dbe52d53d..3a642f0a6 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Classes/Polygon3DObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Classes/Polygon3DObject.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Spatial; diff --git a/SAM/SAM.Geometry/Object/Spatial/Classes/Polyline3DObject.cs b/SAM/SAM.Geometry/Object/Spatial/Classes/Polyline3DObject.cs index a93416524..deb89a1aa 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Classes/Polyline3DObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Classes/Polyline3DObject.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Spatial; diff --git a/SAM/SAM.Geometry/Object/Spatial/Classes/Rectangle3DObject.cs b/SAM/SAM.Geometry/Object/Spatial/Classes/Rectangle3DObject.cs index 277a0cca5..25b9ea1d5 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Classes/Rectangle3DObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Classes/Rectangle3DObject.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Spatial; diff --git a/SAM/SAM.Geometry/Object/Spatial/Classes/SAMGeometry3DGroupObject.cs b/SAM/SAM.Geometry/Object/Spatial/Classes/SAMGeometry3DGroupObject.cs index 29d00b929..5d47c2408 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Classes/SAMGeometry3DGroupObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Classes/SAMGeometry3DGroupObject.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Spatial; diff --git a/SAM/SAM.Geometry/Object/Spatial/Classes/SAMGeometry3DObjectCollection.cs b/SAM/SAM.Geometry/Object/Spatial/Classes/SAMGeometry3DObjectCollection.cs index 144c5b1ea..a8ecc8841 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Classes/SAMGeometry3DObjectCollection.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Classes/SAMGeometry3DObjectCollection.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections; using System.Collections.Generic; diff --git a/SAM/SAM.Geometry/Object/Spatial/Classes/Segment3DObject.cs b/SAM/SAM.Geometry/Object/Spatial/Classes/Segment3DObject.cs index f178e618c..4c99b1608 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Classes/Segment3DObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Classes/Segment3DObject.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Spatial; @@ -34,7 +37,7 @@ public Segment3DObject(Segment3D segment3D, CurveAppearance curveAppearance) } public Segment3DObject(JObject jObject) - :base(jObject) + : base(jObject) { } diff --git a/SAM/SAM.Geometry/Object/Spatial/Classes/ShellObject.cs b/SAM/SAM.Geometry/Object/Spatial/Classes/ShellObject.cs index eb6a24f4d..f4aa84b80 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Classes/ShellObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Classes/ShellObject.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Spatial; @@ -44,7 +47,7 @@ public ShellObject(ShellObject shellObject) public ShellObject(Shell shell, SurfaceAppearance surfaceAppearance) : base(shell) { - if(surfaceAppearance != null) + if (surfaceAppearance != null) { SurfaceAppearance = new SurfaceAppearance(surfaceAppearance); } @@ -58,12 +61,12 @@ public ShellObject(Shell shell, System.Drawing.Color surfaceColor, System.Drawin public override bool FromJObject(JObject jObject) { - if(!base.FromJObject(jObject)) + if (!base.FromJObject(jObject)) { return false; } - if(jObject.ContainsKey("SurfaceAppearance")) + if (jObject.ContainsKey("SurfaceAppearance")) { SurfaceAppearance = new SurfaceAppearance(jObject.Value("SurfaceAppearance")); } @@ -75,12 +78,12 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { JObject jObject = base.ToJObject(); - if(jObject == null) + if (jObject == null) { return null; } - if(SurfaceAppearance != null) + if (SurfaceAppearance != null) { jObject.Add("SurfaceAppearance", SurfaceAppearance.ToJObject()); } diff --git a/SAM/SAM.Geometry/Object/Spatial/Classes/SphereObject.cs b/SAM/SAM.Geometry/Object/Spatial/Classes/SphereObject.cs index 58c09054b..f63783da9 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Classes/SphereObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Classes/SphereObject.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Spatial; @@ -44,7 +47,7 @@ public SphereObject(SphereObject sphereObject) public SphereObject(Sphere sphere, SurfaceAppearance surfaceAppearance) : base(sphere) { - if(surfaceAppearance != null) + if (surfaceAppearance != null) { SurfaceAppearance = new SurfaceAppearance(surfaceAppearance); } @@ -58,12 +61,12 @@ public SphereObject(Sphere sphere, System.Drawing.Color surfaceColor, System.Dra public override bool FromJObject(JObject jObject) { - if(!base.FromJObject(jObject)) + if (!base.FromJObject(jObject)) { return false; } - if(jObject.ContainsKey("SurfaceAppearance")) + if (jObject.ContainsKey("SurfaceAppearance")) { SurfaceAppearance = new SurfaceAppearance(jObject.Value("SurfaceAppearance")); } @@ -75,12 +78,12 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { JObject jObject = base.ToJObject(); - if(jObject == null) + if (jObject == null) { return null; } - if(SurfaceAppearance != null) + if (SurfaceAppearance != null) { jObject.Add("SurfaceAppearance", SurfaceAppearance.ToJObject()); } diff --git a/SAM/SAM.Geometry/Object/Spatial/Classes/Text3DObject.cs b/SAM/SAM.Geometry/Object/Spatial/Classes/Text3DObject.cs index cd74ef25e..83a0bf9c0 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Classes/Text3DObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Classes/Text3DObject.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Spatial; @@ -20,7 +23,7 @@ public Text3DObject(JObject jObject) public Text3DObject(Text3DObject text3DObject) { - if(text3DObject != null) + if (text3DObject != null) { if (text3DObject.TextAppearance != null) { @@ -45,12 +48,12 @@ public Text3DObject(string text, Plane plane, TextAppearance textAppearance) { Text = text; - if(textAppearance != null) + if (textAppearance != null) { TextAppearance = new TextAppearance(textAppearance); } - if(plane != null) + if (plane != null) { Plane = new Plane(plane); } @@ -63,7 +66,7 @@ public bool FromJObject(JObject jObject) return false; } - if(jObject.ContainsKey("Text")) + if (jObject.ContainsKey("Text")) { Text = jObject.Value("Text"); } @@ -93,12 +96,12 @@ public JObject ToJObject() jObject.Add("TextAppearance", TextAppearance.ToJObject()); } - if(Plane != null) + if (Plane != null) { jObject.Add("Plane", Plane.ToJObject()); } - if(Text != null) + if (Text != null) { jObject.Add("Text", Text); } diff --git a/SAM/SAM.Geometry/Object/Spatial/Classes/Triangle3DObject.cs b/SAM/SAM.Geometry/Object/Spatial/Classes/Triangle3DObject.cs index 0572a0084..6420f8810 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Classes/Triangle3DObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Classes/Triangle3DObject.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using SAM.Geometry.Spatial; diff --git a/SAM/SAM.Geometry/Object/Spatial/Create/BoundingBox3D.cs b/SAM/SAM.Geometry/Object/Spatial/Create/BoundingBox3D.cs index 2e4684377..d4c9fcbb9 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Create/BoundingBox3D.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Create/BoundingBox3D.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -8,16 +11,16 @@ public static partial class Create { public static BoundingBox3D BoundingBox3D(this IEnumerable face3DObjects, double offset = 0) where T : IFace3DObject { - if(face3DObjects == null || face3DObjects.Count() == 0) + if (face3DObjects == null || face3DObjects.Count() == 0) { return null; } List boundingBox3Ds = new List(); - foreach(T face3DObject in face3DObjects) + foreach (T face3DObject in face3DObjects) { BoundingBox3D boundingBox3D = face3DObject?.Face3D?.GetBoundingBox(offset); - if(boundingBox3D == null) + if (boundingBox3D == null) { continue; } @@ -25,7 +28,7 @@ public static BoundingBox3D BoundingBox3D(this IEnumerable face3DObjects, boundingBox3Ds.Add(boundingBox3D); } - if(boundingBox3Ds.Count == 0) + if (boundingBox3Ds.Count == 0) { return null; } @@ -33,4 +36,4 @@ public static BoundingBox3D BoundingBox3D(this IEnumerable face3DObjects, return new BoundingBox3D(boundingBox3Ds); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Create/LinkedFace3D.cs b/SAM/SAM.Geometry/Object/Spatial/Create/LinkedFace3D.cs index 92236ad33..9f72a6a63 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Create/LinkedFace3D.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Create/LinkedFace3D.cs @@ -1,21 +1,24 @@ -namespace SAM.Geometry.Object.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Object.Spatial { public static partial class Create { public static LinkedFace3D LinkedFace3D(this IFace3DObject face3DObject) { - if(face3DObject == null) + if (face3DObject == null) { return null; } - if(face3DObject is LinkedFace3D) + if (face3DObject is LinkedFace3D) { return new LinkedFace3D((LinkedFace3D)face3DObject); } System.Guid guid = System.Guid.Empty; - if(face3DObject is Core.SAMObject) + if (face3DObject is Core.SAMObject) { guid = ((Core.SAMObject)face3DObject).Guid; } @@ -23,4 +26,4 @@ public static LinkedFace3D LinkedFace3D(this IFace3DObject face3DObject) return new LinkedFace3D(guid, face3DObject.Face3D); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Create/LinkedFace3Ds.cs b/SAM/SAM.Geometry/Object/Spatial/Create/LinkedFace3Ds.cs index 572bbc9bc..0bc77f401 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Create/LinkedFace3Ds.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Create/LinkedFace3Ds.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Planar; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Planar; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -50,4 +53,4 @@ public static List LinkedFace3Ds(this LinkedFace3D solarFace, Vect return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Interfaces/IBoundingBox3DObject.cs b/SAM/SAM.Geometry/Object/Spatial/Interfaces/IBoundingBox3DObject.cs index 43eb5c43d..5cd13377e 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Interfaces/IBoundingBox3DObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Interfaces/IBoundingBox3DObject.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Geometry.Object.Spatial { @@ -6,4 +9,4 @@ public interface IBoundingBox3DObject : ISAMGeometry3DObject { BoundingBox3D BoundingBox3D { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Interfaces/IExtrusionObject.cs b/SAM/SAM.Geometry/Object/Spatial/Interfaces/IExtrusionObject.cs index cdeb7bf09..8b3d00aa8 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Interfaces/IExtrusionObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Interfaces/IExtrusionObject.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Geometry.Object.Spatial { @@ -6,4 +9,4 @@ public interface IExtrusionObject : ISAMGeometry3DObject { Extrusion Extrusion { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Interfaces/IFace3DObject.cs b/SAM/SAM.Geometry/Object/Spatial/Interfaces/IFace3DObject.cs index 736394409..8a060b75d 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Interfaces/IFace3DObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Interfaces/IFace3DObject.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Geometry.Object.Spatial { @@ -6,4 +9,4 @@ public interface IFace3DObject : ISAMGeometry3DObject { Face3D Face3D { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Interfaces/IMesh3DObject.cs b/SAM/SAM.Geometry/Object/Spatial/Interfaces/IMesh3DObject.cs index 0d3511189..edca5df60 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Interfaces/IMesh3DObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Interfaces/IMesh3DObject.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Geometry.Object.Spatial { @@ -6,4 +9,4 @@ public interface IMesh3DObject : ISAMGeometry3DObject { Mesh3D Mesh3D { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Interfaces/IPoint3DObject.cs b/SAM/SAM.Geometry/Object/Spatial/Interfaces/IPoint3DObject.cs index 542dfb851..48df299ab 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Interfaces/IPoint3DObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Interfaces/IPoint3DObject.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Geometry.Object.Spatial { @@ -6,4 +9,4 @@ public interface IPoint3DObject : ISAMGeometry3DObject { Point3D Point3D { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Interfaces/IPolygon3DObject.cs b/SAM/SAM.Geometry/Object/Spatial/Interfaces/IPolygon3DObject.cs index 85ca4f1a8..72637da00 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Interfaces/IPolygon3DObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Interfaces/IPolygon3DObject.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Geometry.Object.Spatial { @@ -6,4 +9,4 @@ public interface IPolygon3DObject : ISAMGeometry3DObject { Polygon3D Polygon3D { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Interfaces/IPolyline3DObject.cs b/SAM/SAM.Geometry/Object/Spatial/Interfaces/IPolyline3DObject.cs index b363aafca..5a6394ca7 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Interfaces/IPolyline3DObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Interfaces/IPolyline3DObject.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Geometry.Object.Spatial { @@ -6,4 +9,4 @@ public interface IPolyline3DObject : ISAMGeometry3DObject { Polyline3D Polyline3D { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Interfaces/IRectangle3DObject.cs b/SAM/SAM.Geometry/Object/Spatial/Interfaces/IRectangle3DObject.cs index a066d1ac3..ca01c435d 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Interfaces/IRectangle3DObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Interfaces/IRectangle3DObject.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Geometry.Object.Spatial { @@ -6,4 +9,4 @@ public interface IRectangle3DObject : ISAMGeometry3DObject { Rectangle3D Rectangle3D { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Interfaces/ISAMGeometry3DGroupObject.cs b/SAM/SAM.Geometry/Object/Spatial/Interfaces/ISAMGeometry3DGroupObject.cs index 0fd09e6a4..89a63310e 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Interfaces/ISAMGeometry3DGroupObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Interfaces/ISAMGeometry3DGroupObject.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Geometry.Object.Spatial { @@ -6,4 +9,4 @@ public interface ISAMGeometry3DGroupObject : ISAMGeometry3DObject { SAMGeometry3DGroup SAMGeometry3DGroup { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Interfaces/ISAMGeometry3DObject.cs b/SAM/SAM.Geometry/Object/Spatial/Interfaces/ISAMGeometry3DObject.cs index 3a13b2223..5c80a5636 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Interfaces/ISAMGeometry3DObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Interfaces/ISAMGeometry3DObject.cs @@ -1,7 +1,10 @@ -namespace SAM.Geometry.Object.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Object.Spatial { public interface ISAMGeometry3DObject : ISAMGeometryObject { } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Interfaces/ISegment3DObject.cs b/SAM/SAM.Geometry/Object/Spatial/Interfaces/ISegment3DObject.cs index 775e79046..9aed0fa94 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Interfaces/ISegment3DObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Interfaces/ISegment3DObject.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Geometry.Object.Spatial { @@ -6,4 +9,4 @@ public interface ISegment3DObject : ISAMGeometry3DObject { Segment3D Segment3D { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Interfaces/IShellObject.cs b/SAM/SAM.Geometry/Object/Spatial/Interfaces/IShellObject.cs index 05c794440..d6473f3cc 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Interfaces/IShellObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Interfaces/IShellObject.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Geometry.Object.Spatial { @@ -6,4 +9,4 @@ public interface IShellObject : ISAMGeometry3DObject { Shell Shell { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Interfaces/ISphereObject.cs b/SAM/SAM.Geometry/Object/Spatial/Interfaces/ISphereObject.cs index ee2f2d552..f790d08f8 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Interfaces/ISphereObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Interfaces/ISphereObject.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Geometry.Object.Spatial { @@ -6,4 +9,4 @@ public interface ISphereObject : ISAMGeometry3DObject { Sphere Sphere { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Interfaces/IText3DObject.cs b/SAM/SAM.Geometry/Object/Spatial/Interfaces/IText3DObject.cs index 077e05a16..8073d5003 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Interfaces/IText3DObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Interfaces/IText3DObject.cs @@ -1,4 +1,7 @@ - +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + + namespace SAM.Geometry.Object.Spatial { public interface IText3DObject : ISAMGeometry3DObject diff --git a/SAM/SAM.Geometry/Object/Spatial/Interfaces/ITriangle3DObject.cs b/SAM/SAM.Geometry/Object/Spatial/Interfaces/ITriangle3DObject.cs index a7ad158d6..c14898f03 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Interfaces/ITriangle3DObject.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Interfaces/ITriangle3DObject.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Geometry.Object.Spatial { @@ -6,4 +9,4 @@ public interface ITriangle3DObject : ISAMGeometry3DObject { Triangle3D Triangle3D { get; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/Above.cs b/SAM/SAM.Geometry/Object/Spatial/Query/Above.cs index 308c559d7..f942b3ccf 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/Above.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/Above.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Geometry.Object.Spatial { @@ -14,4 +17,4 @@ public static bool Above(this Plane plane, IFace3DObject face3DObject, double to return Geometry.Spatial.Query.Above(plane, face3DObject.Face3D, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/Area.cs b/SAM/SAM.Geometry/Object/Spatial/Query/Area.cs index 8dbc6d4ae..c39788580 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/Area.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/Area.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Geometry.Object.Spatial { @@ -15,4 +18,4 @@ public static double Area(this IFace3DObject face3DObject) return face3D.GetArea(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/Azimuth.cs b/SAM/SAM.Geometry/Object/Spatial/Query/Azimuth.cs index 0d98b23a8..98cc39cc1 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/Azimuth.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/Azimuth.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Geometry.Object.Spatial { @@ -9,4 +12,4 @@ public static double Azimuth(this IFace3DObject face3DObject, Vector3D reference return Geometry.Spatial.Query.Azimuth(face3DObject?.Face3D, referenceDirection); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/Below.cs b/SAM/SAM.Geometry/Object/Spatial/Query/Below.cs index af045ffbd..ec987c9ab 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/Below.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/Below.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Geometry.Object.Spatial { @@ -9,4 +12,4 @@ public static bool Below(this IFace3DObject face3DObject, Plane plane, double to return Geometry.Spatial.Query.Below(face3DObject?.Face3D, plane, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/Closest.cs b/SAM/SAM.Geometry/Object/Spatial/Query/Closest.cs index 3154ae552..fbddbb4f8 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/Closest.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/Closest.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; namespace SAM.Geometry.Object.Spatial @@ -33,4 +36,4 @@ public static T Closest(this IEnumerable face3DObjects, Point3D point3D) w return dictionary[face3D_Closest]; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/Concave.cs b/SAM/SAM.Geometry/Object/Spatial/Query/Concave.cs index 8fdc7db96..3bfb71a60 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/Concave.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/Concave.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Object.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Object.Spatial { public static partial class Query { @@ -8,4 +11,4 @@ public static bool Concave(this IFace3DObject face3Dobject, bool externalEdge = return Geometry.Spatial.Query.Concave(face3Dobject?.Face3D, externalEdge, internalEdges); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/Convex.cs b/SAM/SAM.Geometry/Object/Spatial/Query/Convex.cs index c58c530b8..e4e96fe7b 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/Convex.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/Convex.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Object.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Object.Spatial { public static partial class Query { @@ -8,4 +11,4 @@ public static bool Convex(this IFace3DObject face3Dobject, bool externalEdge = t return Geometry.Spatial.Query.Convex(face3Dobject?.Face3D, externalEdge, internalEdges); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/ElevationDictionary.cs b/SAM/SAM.Geometry/Object/Spatial/Query/ElevationDictionary.cs index 9925ef945..d66d07e56 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/ElevationDictionary.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/ElevationDictionary.cs @@ -1,6 +1,9 @@ -using SAM.Geometry.Spatial; -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System; +using System.Collections.Generic; namespace SAM.Geometry.Object.Spatial { @@ -59,4 +62,4 @@ public static Dictionary> ElevationDictionary(this IEnumerabl return ElevationDictionary(face3DObjects, out double maxElevation, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/ElevationRanges.cs b/SAM/SAM.Geometry/Object/Spatial/Query/ElevationRanges.cs index 9f03debcf..f28cee828 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/ElevationRanges.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/ElevationRanges.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Geometry.Object.Spatial @@ -27,4 +30,4 @@ public static List> ElevationRanges(this IEnumerable face3DO return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/Face3DObjectsByFace3D.cs b/SAM/SAM.Geometry/Object/Spatial/Query/Face3DObjectsByFace3D.cs index d71a02767..61f8f5ae6 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/Face3DObjectsByFace3D.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/Face3DObjectsByFace3D.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System; using System.Collections.Generic; using System.Linq; @@ -15,20 +18,20 @@ public static List Face3DObjectsByFace3D(this IEnumerable face3DObjects public static List Face3DObjectsByFace3D(this IEnumerable face3DObjects, Face3D face3D, double areaFactor, double maxDistance, out List intersectionAreas, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) where T : IFace3DObject { intersectionAreas = null; - + if (face3DObjects == null || face3D == null) { return null; } Plane plane = face3D.GetPlane(); - if(plane == null) + if (plane == null) { return null; } BoundingBox3D boundingBox3D = face3D.GetBoundingBox(); - if(boundingBox3D == null) + if (boundingBox3D == null) { return null; } @@ -36,13 +39,13 @@ public static List Face3DObjectsByFace3D(this IEnumerable face3DObjects Geometry.Planar.Face2D face2D = plane.Convert(face3D); double area = face2D.GetArea(); - if(area < tolerance_Distance) + if (area < tolerance_Distance) { return null; } - List> tuples = new List>(); - foreach(T face3DObject in face3DObjects) + List> tuples = new List>(); + foreach (T face3DObject in face3DObjects) { Face3D face3D_Face3DObject = face3DObject?.Face3D; if (face3D_Face3DObject == null) @@ -51,47 +54,47 @@ public static List Face3DObjectsByFace3D(this IEnumerable face3DObjects } Plane plane_Face3DObject = face3D_Face3DObject.GetPlane(); - if(plane_Face3DObject == null) + if (plane_Face3DObject == null) { continue; } - if(plane.Normal.SmallestAngle(plane_Face3DObject.Normal) > tolerance_Angle) + if (plane.Normal.SmallestAngle(plane_Face3DObject.Normal) > tolerance_Angle) { continue; } BoundingBox3D boundingBox3D_Panel = face3D_Face3DObject.GetBoundingBox(); - if(boundingBox3D_Panel == null) + if (boundingBox3D_Panel == null) { continue; } - if(!boundingBox3D.InRange(boundingBox3D_Panel, maxDistance)) + if (!boundingBox3D.InRange(boundingBox3D_Panel, maxDistance)) { continue; } double distance = face3D.Distance(face3D_Face3DObject, tolerance_Angle, tolerance_Distance); - if(distance > maxDistance) + if (distance > maxDistance) { continue; } Geometry.Planar.Face2D face2D_Panel = plane.Convert(plane.Project(face3D_Face3DObject)); - if(face3D_Face3DObject == null) + if (face3D_Face3DObject == null) { continue; } List face2Ds = Geometry.Planar.Query.Intersection(face2D, face2D_Panel, tolerance_Distance); - if(face2Ds == null || face2Ds.Count == 0) + if (face2Ds == null || face2Ds.Count == 0) { continue; } double area_Intersection = face2Ds.ConvertAll(x => x.GetArea()).Sum(); - if(area_Intersection / area < areaFactor) + if (area_Intersection / area < areaFactor) { continue; } @@ -100,7 +103,7 @@ public static List Face3DObjectsByFace3D(this IEnumerable face3DObjects } - if(tuples == null || tuples.Count == 0) + if (tuples == null || tuples.Count == 0) { return null; } @@ -114,4 +117,4 @@ public static List Face3DObjectsByFace3D(this IEnumerable face3DObjects return tuples.ConvertAll(x => x.Item1); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/FilterByElevation.cs b/SAM/SAM.Geometry/Object/Spatial/Query/FilterByElevation.cs index 3032ff567..9ef1e26a4 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/FilterByElevation.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/FilterByElevation.cs @@ -1,11 +1,14 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; namespace SAM.Geometry.Object.Spatial { public static partial class Query { - public static List FilterByElevation(this IEnumerable face3DObjects, double elevation, out List lower, out List upper, double tolerance = Core.Tolerance.Distance) where T: IFace3DObject + public static List FilterByElevation(this IEnumerable face3DObjects, double elevation, out List lower, out List upper, double tolerance = Core.Tolerance.Distance) where T : IFace3DObject { lower = null; upper = null; @@ -17,14 +20,14 @@ public static List FilterByElevation(this IEnumerable face3DObjects, do upper = new List(); List result = new List(); - foreach(T face3DObject in face3DObjects) + foreach (T face3DObject in face3DObjects) { BoundingBox3D boundingBox3D = face3DObject?.Face3D.GetBoundingBox(); - if(boundingBox3D == null) + if (boundingBox3D == null) { continue; } - + double min = boundingBox3D.Min.Z; double max = boundingBox3D.Max.Z; @@ -51,4 +54,4 @@ public static List FilterByElevation(this IEnumerable face3DObjects, do return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/Grid.cs b/SAM/SAM.Geometry/Object/Spatial/Query/Grid.cs index df3fbef57..1b869fa04 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/Grid.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/Grid.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -24,4 +27,4 @@ public static List Grid(this IEnumerable face3DObjects, double return Geometry.Spatial.Query.Grid(closedPlanar3Ds, x, y, plane, point3D, tolerance_Angle, tolerance_Distance, keepFull); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/HiddenLinkedFace3Ds.cs b/SAM/SAM.Geometry/Object/Spatial/Query/HiddenLinkedFace3Ds.cs index 706506a79..cf4dc7aff 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/HiddenLinkedFace3Ds.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/HiddenLinkedFace3Ds.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -13,4 +16,4 @@ public static List HiddenLinkedFace3Ds(this IEnumerable face return linkedFace3D_Hidden; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/Horizontal.cs b/SAM/SAM.Geometry/Object/Spatial/Query/Horizontal.cs index 7445ff96c..ec8800d1a 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/Horizontal.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/Horizontal.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Geometry.Object.Spatial { @@ -15,4 +18,4 @@ public static bool Horizontal(this IFace3DObject face3DObject, double tolerance return Geometry.Spatial.Query.Horizontal(plane, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/ISAMGeometry3D.cs b/SAM/SAM.Geometry/Object/Spatial/Query/ISAMGeometry3D.cs index f477d9844..74e7f61cf 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/ISAMGeometry3D.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/ISAMGeometry3D.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Geometry.Object.Spatial { @@ -6,12 +9,12 @@ public static partial class Query { public static ISAMGeometry3D ISAMGeometry3D(this ISAMGeometry3DObject sAMGeometry3DObject) { - if(sAMGeometry3DObject == null) + if (sAMGeometry3DObject == null) { return null; } - if(sAMGeometry3DObject is IBoundingBox3DObject) + if (sAMGeometry3DObject is IBoundingBox3DObject) { return ((IBoundingBox3DObject)sAMGeometry3DObject).BoundingBox3D; } @@ -79,4 +82,4 @@ public static ISAMGeometry3D ISAMGeometry3D(this ISAMGeometry3DObject sAMGeometr return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/InRange.cs b/SAM/SAM.Geometry/Object/Spatial/Query/InRange.cs index 75e53bfc0..43feffa14 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/InRange.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/InRange.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Object.Spatial; using SAM.Geometry.Spatial; using System; @@ -130,4 +133,4 @@ public static List InRange(this IEnumerable face3DObjects, Point3D poin return tuple.ConvertAll(x => x.Item2); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/Inside.cs b/SAM/SAM.Geometry/Object/Spatial/Query/Inside.cs index a36bf6d41..f7db9fdcb 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/Inside.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/Inside.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Object.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Object.Spatial; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -93,4 +96,4 @@ public static List Inside(this Shell shell, IEnumerable face3DObjects, } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/Intersect.cs b/SAM/SAM.Geometry/Object/Spatial/Query/Intersect.cs index 13adb2003..44655e24b 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/Intersect.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/Intersect.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Geometry.Object.Spatial { @@ -25,4 +28,4 @@ public static bool Intersect(this IFace3DObject face3DObject, Point3D point3D, V return Geometry.Spatial.Query.Intersect(face3DObject?.Face3D, point3D, vector3D, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/IntersectionDictionary.cs b/SAM/SAM.Geometry/Object/Spatial/Query/IntersectionDictionary.cs index 3bb8ac5c3..7f7aa43bc 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/IntersectionDictionary.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/IntersectionDictionary.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System; using System.Collections.Generic; using System.Linq; @@ -7,7 +10,7 @@ namespace SAM.Geometry.Object.Spatial { public static partial class Query { - public static Dictionary IntersectionDictionary(this Segment3D segment3D, IEnumerable face3DObjects, bool sort = true, double tolerance = Core.Tolerance.Distance) where T: IFace3DObject + public static Dictionary IntersectionDictionary(this Segment3D segment3D, IEnumerable face3DObjects, bool sort = true, double tolerance = Core.Tolerance.Distance) where T : IFace3DObject { if (segment3D == null || face3DObjects == null) { @@ -15,19 +18,19 @@ public static Dictionary IntersectionDictionary(this Segment3D se } BoundingBox3D boundingBox3D = segment3D.GetBoundingBox(); - if(boundingBox3D == null) + if (boundingBox3D == null) { return null; } Point3D point3D = segment3D[0]; - if(point3D == null) + if (point3D == null) { return null; } Vector3D vector3D = segment3D.Direction; - if(vector3D == null) + if (vector3D == null) { return null; } @@ -37,17 +40,17 @@ public static Dictionary IntersectionDictionary(this Segment3D se foreach (T face3DObject in face3DObjects) { BoundingBox3D boundingBox3D_Face3DObject = face3DObject?.Face3D.GetBoundingBox(); - if(!boundingBox3D.InRange(boundingBox3D_Face3DObject, tolerance)) + if (!boundingBox3D.InRange(boundingBox3D_Face3DObject, tolerance)) { continue; } - + Face3D face3D = face3DObject?.Face3D; - if(face3D == null) + if (face3D == null) { continue; } - + PlanarIntersectionResult planarIntersectionResult = Geometry.Spatial.Create.PlanarIntersectionResult(face3D, point3D, vector3D, tolerance); if (planarIntersectionResult == null || !planarIntersectionResult.Intersecting) { @@ -60,7 +63,7 @@ public static Dictionary IntersectionDictionary(this Segment3D se continue; } - if(!segment3D.On(point3D_Intersection, tolerance)) + if (!segment3D.On(point3D_Intersection, tolerance)) { continue; } @@ -124,4 +127,4 @@ public static Dictionary> IntersectionDictionary(this } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/MaxElevation.cs b/SAM/SAM.Geometry/Object/Spatial/Query/MaxElevation.cs index b7b8de953..cf289d22f 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/MaxElevation.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/MaxElevation.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -39,4 +42,4 @@ public static double MaxElevation(this IEnumerable face3DObjects) where T return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/MaxIntersectionSegment3D.cs b/SAM/SAM.Geometry/Object/Spatial/Query/MaxIntersectionSegment3D.cs index 2398e71b8..60669e3b6 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/MaxIntersectionSegment3D.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/MaxIntersectionSegment3D.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Geometry.Object.Spatial { @@ -9,4 +12,4 @@ public static Segment3D MaxIntersectionSegment3D(this Plane plane, IFace3DObject return Geometry.Spatial.Query.MaxIntersectionSegment3D(plane, face3DObject?.Face3D); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/MaxProjectedDistance.cs b/SAM/SAM.Geometry/Object/Spatial/Query/MaxProjectedDistance.cs index 5a1921235..4d0cd1945 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/MaxProjectedDistance.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/MaxProjectedDistance.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System; using System.Collections.Generic; diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/MaxRectangle3D.cs b/SAM/SAM.Geometry/Object/Spatial/Query/MaxRectangle3D.cs index 538393e8b..8110005fb 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/MaxRectangle3D.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/MaxRectangle3D.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Geometry.Object.Spatial { @@ -15,4 +18,4 @@ public static Rectangle3D MaxRectangle3D(this IFace3DObject face3DObject) return Geometry.Spatial.Query.MaxRectangle3D(face3D); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/MinElevation.cs b/SAM/SAM.Geometry/Object/Spatial/Query/MinElevation.cs index b7fb4f6d7..cf5daae77 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/MinElevation.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/MinElevation.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -15,13 +18,13 @@ public static double MinElevation(this IFace3DObject face3DObject) return boundingBox3D.Min.Z; } - public static double MinElevation(this IEnumerable face3DObjects) where T: IFace3DObject + public static double MinElevation(this IEnumerable face3DObjects) where T : IFace3DObject { if (face3DObjects == null || face3DObjects.Count() == 0) return double.NaN; - + double result = double.MaxValue; - foreach(T face3DObject in face3DObjects) + foreach (T face3DObject in face3DObjects) { if (face3DObject == null) continue; @@ -31,7 +34,7 @@ public static double MinElevation(this IEnumerable face3DObjects) where T: result = minElevation; } - if(result == double.MaxValue) + if (result == double.MaxValue) { return double.NaN; } @@ -39,4 +42,4 @@ public static double MinElevation(this IEnumerable face3DObjects) where T: return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/PlanarIntersectionResult.cs b/SAM/SAM.Geometry/Object/Spatial/Query/PlanarIntersectionResult.cs index 9e76e1087..1d7e32f07 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/PlanarIntersectionResult.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/PlanarIntersectionResult.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -11,9 +14,9 @@ public static PlanarIntersectionResult PlanarIntersectionResult(Plane plane, IFa return Geometry.Spatial.Create.PlanarIntersectionResult(plane, face3DObject?.Face3D, tolerance_Angle, tolerance_Distance); } - public static PlanarIntersectionResult PlanarIntersectionResult(Face3D face3D, IEnumerable face3DObjects, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) where T: IFace3DObject + public static PlanarIntersectionResult PlanarIntersectionResult(Face3D face3D, IEnumerable face3DObjects, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) where T : IFace3DObject { return Geometry.Spatial.Create.PlanarIntersectionResult(face3D, face3DObjects?.ToList().ConvertAll(x => x.Face3D), tolerance_Angle, tolerance_Distance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/SAMGeometry3D.cs b/SAM/SAM.Geometry/Object/Spatial/Query/SAMGeometry3D.cs index dae74738e..896f7c940 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/SAMGeometry3D.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/SAMGeometry3D.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; namespace SAM.Geometry.Object.Spatial { @@ -6,7 +9,7 @@ public static partial class Query { public static T SAMGeometry3D(this ISAMGeometry3DObject sAMGeometry3DObject) where T : ISAMGeometry3D { - if(sAMGeometry3DObject is IFace3DObject) + if (sAMGeometry3DObject is IFace3DObject) { Face3D result = ((IFace3DObject)sAMGeometry3DObject).Face3D; return result is T ? (T)(object)result : default(T); @@ -27,4 +30,4 @@ public static T SAMGeometry3D(this ISAMGeometry3DObject sAMGeometry3DObject) return default(T); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/SectionDictionary.cs b/SAM/SAM.Geometry/Object/Spatial/Query/SectionDictionary.cs index d36b16727..08dce3bc6 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/SectionDictionary.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/SectionDictionary.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -6,7 +9,7 @@ namespace SAM.Geometry.Object.Spatial { public static partial class Query { - public static Dictionary> SectionDictionary(this IEnumerable face3DObjects, Plane plane, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) where T: ISAMGeometry where N: IFace3DObject + public static Dictionary> SectionDictionary(this IEnumerable face3DObjects, Plane plane, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) where T : ISAMGeometry where N : IFace3DObject { if (plane == null || face3DObjects == null) { @@ -17,7 +20,7 @@ public static Dictionary> SectionDictionary(this IEnumerable foreach (N face3DObject in face3DObjects) { Face3D face3D = face3DObject?.Face3D; - if(face3D == null) + if (face3D == null) { continue; } @@ -26,21 +29,21 @@ public static Dictionary> SectionDictionary(this IEnumerable } Dictionary> dictionary = Geometry.Spatial.Query.SectionDictionary(tuples.ConvertAll(x => x.Item2), plane, tolerance_Angle, tolerance_Distance); - if(dictionary ==null) + if (dictionary == null) { return null; } Dictionary> result = new Dictionary>(); - foreach(KeyValuePair> keyValuePair in dictionary) + foreach (KeyValuePair> keyValuePair in dictionary) { - if(keyValuePair.Key == null) + if (keyValuePair.Key == null) { continue; } int index = tuples.FindIndex(x => x.Item2 == keyValuePair.Key); - if(index == -1) + if (index == -1) { continue; } @@ -51,4 +54,4 @@ public static Dictionary> SectionDictionary(this IEnumerable return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/Shells.cs b/SAM/SAM.Geometry/Object/Spatial/Query/Shells.cs index 3e64c06d8..47ec5913b 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/Shells.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/Shells.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -6,14 +9,14 @@ namespace SAM.Geometry.Object.Spatial { public static partial class Create { - public static List Shells(this IEnumerable face3DObjects, IEnumerable elevations, double offset = 0.1, double thinnessRatio = 0.01, double minArea = Core.Tolerance.MacroDistance, double snapTolerance = Core.Tolerance.MacroDistance, double silverSpacing = Core.Tolerance.MacroDistance, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) where N: IFace3DObject + public static List Shells(this IEnumerable face3DObjects, IEnumerable elevations, double offset = 0.1, double thinnessRatio = 0.01, double minArea = Core.Tolerance.MacroDistance, double snapTolerance = Core.Tolerance.MacroDistance, double silverSpacing = Core.Tolerance.MacroDistance, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) where N : IFace3DObject { return Geometry.Spatial.Create.Shells(face3DObjects?.ToList().ConvertAll(x => x?.Face3D), elevations, offset, thinnessRatio, minArea, snapTolerance, silverSpacing, tolerance_Angle, tolerance_Distance); } - public static List Shells(this IEnumerable face3DObjects, IEnumerable elevations, IEnumerable offsets, IEnumerable auxiliaryElevations = null, double snapTolerance = Core.Tolerance.MacroDistance, double silverSpacing = Core.Tolerance.MacroDistance, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) where N: IFace3DObject + public static List Shells(this IEnumerable face3DObjects, IEnumerable elevations, IEnumerable offsets, IEnumerable auxiliaryElevations = null, double snapTolerance = Core.Tolerance.MacroDistance, double silverSpacing = Core.Tolerance.MacroDistance, double tolerance_Angle = Core.Tolerance.Angle, double tolerance_Distance = Core.Tolerance.Distance) where N : IFace3DObject { return Geometry.Spatial.Create.Shells(face3DObjects?.ToList().ConvertAll(x => x?.Face3D), elevations, offsets, auxiliaryElevations, snapTolerance, silverSpacing, tolerance_Angle, tolerance_Distance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/SpacingDictionary.cs b/SAM/SAM.Geometry/Object/Spatial/Query/SpacingDictionary.cs index 231d73e2d..7de3819d2 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/SpacingDictionary.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/SpacingDictionary.cs @@ -1,6 +1,9 @@ -using SAM.Geometry.Spatial; -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System; +using System.Collections.Generic; namespace SAM.Geometry.Object.Spatial { @@ -52,4 +55,4 @@ public static Dictionary> SpacingDictionary(this IEnumerable return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/Tilt.cs b/SAM/SAM.Geometry/Object/Spatial/Query/Tilt.cs index 90e6717b2..22bc68475 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/Tilt.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/Tilt.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Object.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Object.Spatial { public static partial class Query { @@ -15,4 +18,4 @@ public static double Tilt(this IFace3DObject face3DObject) return Geometry.Spatial.Query.Tilt(face3DObject.Face3D); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/TryConvert.cs b/SAM/SAM.Geometry/Object/Spatial/Query/TryConvert.cs index ecefd795b..73af5e5f1 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/TryConvert.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/TryConvert.cs @@ -1,4 +1,7 @@ -using SAM.Geometry.Spatial; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Geometry.Spatial; using System.Collections.Generic; using System.Linq; @@ -9,51 +12,51 @@ public static partial class Query public static bool TryConvert(this ISAMGeometry3D sAMGeometry3D, out List sAMGeometry3Ds) where T : ISAMGeometry3D { sAMGeometry3Ds = null; - if(sAMGeometry3D == null) + if (sAMGeometry3D == null) { return false; } - if(typeof(T) == typeof(Face3D)) + if (typeof(T) == typeof(Face3D)) { - if(sAMGeometry3D is Shell) + if (sAMGeometry3D is Shell) { List face3Ds = ((Shell)sAMGeometry3D).Face3Ds; - - if(face3Ds != null) + + if (face3Ds != null) { sAMGeometry3Ds = new List(); foreach (Face3D face3D in face3Ds) { - if(face3D is T) + if (face3D is T) { sAMGeometry3Ds.Add((T)(object)face3D); } } - + } return true; } - if(sAMGeometry3D is Face3D) + if (sAMGeometry3D is Face3D) { sAMGeometry3Ds = new List() { (T)sAMGeometry3D }; return true; } - if(sAMGeometry3D is IClosedPlanar3D) + if (sAMGeometry3D is IClosedPlanar3D) { - sAMGeometry3Ds = new List() { (T)(object)(new Face3D((IClosedPlanar3D)sAMGeometry3D))}; + sAMGeometry3Ds = new List() { (T)(object)(new Face3D((IClosedPlanar3D)sAMGeometry3D)) }; } - if(sAMGeometry3D is IFace3DObject) + if (sAMGeometry3D is IFace3DObject) { sAMGeometry3Ds = new List() { (T)(object)((IFace3DObject)sAMGeometry3D).Face3D }; } } - if(typeof(T) == typeof(Segment3D)) + if (typeof(T) == typeof(Segment3D)) { if (sAMGeometry3D is Face3D) { @@ -68,13 +71,13 @@ public static bool TryConvert(this ISAMGeometry3D sAMGeometry3D, out List foreach (IClosedPlanar3D closedPlanar3D in closedPlanar3Ds) { - if(closedPlanar3D == null) + if (closedPlanar3D == null) { continue; } ISegmentable3D segmentable3D = closedPlanar3D as ISegmentable3D; - if(segmentable3D == null) + if (segmentable3D == null) { return false; } @@ -85,7 +88,7 @@ public static bool TryConvert(this ISAMGeometry3D sAMGeometry3D, out List return true; } - if(typeof(ISegmentable3D).IsAssignableFrom(sAMGeometry3D.GetType())) + if (typeof(ISegmentable3D).IsAssignableFrom(sAMGeometry3D.GetType())) { ISegmentable3D segmentable3D = sAMGeometry3D as ISegmentable3D; sAMGeometry3Ds.AddRange(segmentable3D.GetSegments().Cast()); @@ -95,4 +98,4 @@ public static bool TryConvert(this ISAMGeometry3D sAMGeometry3D, out List return false; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/Vertical.cs b/SAM/SAM.Geometry/Object/Spatial/Query/Vertical.cs index dd56cd53e..1c5a09739 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/Vertical.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/Vertical.cs @@ -1,4 +1,7 @@ -namespace SAM.Geometry.Object.Spatial +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Geometry.Object.Spatial { public static partial class Query { @@ -10,4 +13,4 @@ public static bool Vertical(this IFace3DObject face3DObject, double tolerance = return Geometry.Spatial.Query.Vertical(face3DObject.Face3D, tolerance); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/ViewField.cs b/SAM/SAM.Geometry/Object/Spatial/Query/ViewField.cs index 9db8dcbae..f4d4ae67d 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/ViewField.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/ViewField.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Spatial; using System; using System.Collections.Generic; @@ -38,7 +41,7 @@ public static void ViewField(this IEnumerable face3DObjects, Vector3D view } LinkedFace3D linkedFace3D = face3DObject is LinkedFace3D ? (LinkedFace3D)(object)face3DObject : Create.LinkedFace3D(face3DObject); - if(linkedFace3D == null) + if (linkedFace3D == null) { continue; } @@ -935,4 +938,4 @@ public static void ViewField(this IEnumerable face3DObjects, Vector3D view // } //} } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Object/Spatial/Query/VisibleLinkedFace3Ds.cs b/SAM/SAM.Geometry/Object/Spatial/Query/VisibleLinkedFace3Ds.cs index ca5cd7501..2b2ae3659 100644 --- a/SAM/SAM.Geometry/Object/Spatial/Query/VisibleLinkedFace3Ds.cs +++ b/SAM/SAM.Geometry/Object/Spatial/Query/VisibleLinkedFace3Ds.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using SAM.Geometry.Spatial; using System.Collections.Generic; @@ -13,4 +16,4 @@ public static List VisibleLinkedFace3Ds(this IEnumerable fac return linkedFace3Ds_Visible; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Geometry/Properties/AssemblyInfo.cs b/SAM/SAM.Geometry/Properties/AssemblyInfo.cs index 1890dc260..7cf65720b 100644 --- a/SAM/SAM.Geometry/Properties/AssemblyInfo.cs +++ b/SAM/SAM.Geometry/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -/* +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +/* * This file is part of the Sustaiable Analytical Model (SAM) * Copyright (c) 2020, the respective contributors. All rights reserved. * diff --git a/SAM/SAM.Math/Classes/Constant.cs b/SAM/SAM.Math/Classes/Constant.cs index 220f8e007..d8377e1ea 100644 --- a/SAM/SAM.Math/Classes/Constant.cs +++ b/SAM/SAM.Math/Classes/Constant.cs @@ -1,8 +1,11 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static class Constant { public const double HalfPI = System.Math.PI / 2; } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Classes/Equation/LinearEquation.cs b/SAM/SAM.Math/Classes/Equation/LinearEquation.cs index 19c7d9d65..eaa1a1a0e 100644 --- a/SAM/SAM.Math/Classes/Equation/LinearEquation.cs +++ b/SAM/SAM.Math/Classes/Equation/LinearEquation.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; namespace SAM.Math diff --git a/SAM/SAM.Math/Classes/Equation/PolynomialEquation.cs b/SAM/SAM.Math/Classes/Equation/PolynomialEquation.cs index 8121e63d1..8e7faa9aa 100644 --- a/SAM/SAM.Math/Classes/Equation/PolynomialEquation.cs +++ b/SAM/SAM.Math/Classes/Equation/PolynomialEquation.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -88,10 +91,10 @@ public List Evaluate(IEnumerable values) int count = coefficients.Length; - if(count < 5 || values.Count() < 1000) + if (count < 5 || values.Count() < 1000) { result = new List(); - foreach(double value in values) + foreach (double value in values) { result.Add(Evaluate(value)); } @@ -101,7 +104,7 @@ public List Evaluate(IEnumerable values) count = values.Count(); result = Enumerable.Repeat(double.NaN, count).ToList(); - Parallel.For(0, count, (int i) => + Parallel.For(0, count, (int i) => { result[i] = Evaluate(values.ElementAt(i)); }); @@ -138,18 +141,18 @@ public virtual bool FromJObject(JObject jObject) if (jObject == null) return false; - if(jObject.ContainsKey("Variables")) + if (jObject.ContainsKey("Variables")) { JArray jArray = jObject.Value("Variables"); coefficients = new double[jArray.Count]; - for(int i=0; i < jArray.Count; i++) + for (int i = 0; i < jArray.Count; i++) { object @object = jArray[i]; - if(@object is double) + if (@object is double) { coefficients[i] = (double)@object; continue; - } + } if (!Core.Query.IsNumeric(@object)) return false; diff --git a/SAM/SAM.Math/Classes/Interpolation/BilinearInterpolation.cs b/SAM/SAM.Math/Classes/Interpolation/BilinearInterpolation.cs index 46ae39f4e..6c96f557d 100644 --- a/SAM/SAM.Math/Classes/Interpolation/BilinearInterpolation.cs +++ b/SAM/SAM.Math/Classes/Interpolation/BilinearInterpolation.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; namespace SAM.Math @@ -52,7 +55,7 @@ public BilinearInterpolation(BilinearInterpolation bilinearInterpolation) { xArray = bilinearInterpolation.xArray?.Clone(); yArray = bilinearInterpolation.yArray?.Clone(); - if(bilinearInterpolation.values != null) + if (bilinearInterpolation.values != null) { values = new double[bilinearInterpolation.values.GetLength(0), bilinearInterpolation.values.GetLength(1)]; for (int i = 0; i < bilinearInterpolation.values.GetLength(0); i++) @@ -63,7 +66,7 @@ public BilinearInterpolation(BilinearInterpolation bilinearInterpolation) } } } - + } } @@ -114,7 +117,7 @@ public bool Load(double[,] data) public bool Load(string path, string separator = "\t") { double[,] data = Core.Create.Array(path, separator, true, double.NaN); - if(data == null) + if (data == null) { return false; } @@ -230,7 +233,7 @@ public virtual JObject ToJObject() JObject jObject = new JObject(); jObject.Add("_type", Core.Query.FullTypeName(this)); - if(xArray != null) + if (xArray != null) { jObject.Add("XArray", new JArray(xArray)); } @@ -240,7 +243,7 @@ public virtual JObject ToJObject() jObject.Add("YArray", new JArray(yArray)); } - if(values != null) + if (values != null) { JArray jArray = Core.Query.JArray(values); jObject.Add("Values", jArray); diff --git a/SAM/SAM.Math/Classes/Interpolation/LinearInterpolation.cs b/SAM/SAM.Math/Classes/Interpolation/LinearInterpolation.cs index c1b1d422f..07ec0b374 100644 --- a/SAM/SAM.Math/Classes/Interpolation/LinearInterpolation.cs +++ b/SAM/SAM.Math/Classes/Interpolation/LinearInterpolation.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -12,12 +15,12 @@ namespace SAM.Math public class LinearInterpolation : IJSAMObject { private List> values; - + public LinearInterpolation(JObject jObject) { FromJObject(jObject); } - + public LinearInterpolation(double x_1, double y_1, double x_2, double y_2) { Add(x_1, y_1); @@ -30,7 +33,7 @@ public LinearInterpolation() public LinearInterpolation(LinearInterpolation linearInterpolation) { - if(linearInterpolation.values != null) + if (linearInterpolation.values != null) { foreach (KeyValuePair keyValuePair in linearInterpolation.values) Add(keyValuePair); @@ -171,17 +174,17 @@ public virtual bool FromJObject(JObject jObject) if (jObject == null) return false; - if(jObject.ContainsKey("Values")) + if (jObject.ContainsKey("Values")) { JArray jArray_Values = jObject.Value("Values"); values = new List>(); - for(int i=0; i < jArray_Values.Count; i++) + for (int i = 0; i < jArray_Values.Count; i++) { object @object = jArray_Values[i]; - if(@object is JArray) + if (@object is JArray) { JArray jArray = (JArray)@object; - if(jArray.Count >= 2) + if (jArray.Count >= 2) { object object_Temp; diff --git a/SAM/SAM.Math/Classes/Matrix/Matrix.cs b/SAM/SAM.Math/Classes/Matrix/Matrix.cs index d3f076243..20b3fd526 100644 --- a/SAM/SAM.Math/Classes/Matrix/Matrix.cs +++ b/SAM/SAM.Math/Classes/Matrix/Matrix.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; @@ -269,7 +272,7 @@ public bool FromJObject(JObject jObject) foreach (JArray jArray_Row in jArray_Column) { List values = new List(); - foreach(double value in jArray_Row) + foreach (double value in jArray_Row) values.Add(value); valuesList.Add(values); @@ -290,7 +293,7 @@ public JObject ToJObject() JArray jArray_Column = new JArray(); - for (int i=0; i < values.GetLength(0); i++) + for (int i = 0; i < values.GetLength(0); i++) { JArray jArray_Row = new JArray(); for (int j = 0; j < values.GetLength(1); j++) @@ -307,11 +310,11 @@ public JObject ToJObject() public override int GetHashCode() { int result = int.MinValue; - for(int i=0; i < values.GetLength(0); i++) + for (int i = 0; i < values.GetLength(0); i++) { for (int j = 0; j < values.GetLength(1); j++) { - if(result == int.MinValue) + if (result == int.MinValue) result = values[i, j].GetHashCode(); else result = result ^ values[i, j].GetHashCode(); @@ -412,7 +415,7 @@ public Matrix GetMinorMatrix(int row, int column) values_Temp[index_column, index_row] = values[i, j]; } - + } return new Matrix(values_Temp); @@ -450,16 +453,16 @@ public double Determinant() return double.NaN; int count = values.GetLength(0); - + if (count == 1) return values[0, 0]; - if(count == 2) + if (count == 2) return (values[0, 0] * values[1, 1]) - (values[1, 0] * values[0, 1]); if (count == 3) - return - + (values[0, 0] * ((values[1, 1] * values[2, 2]) - (values[1, 2] * values[2, 1]))) + return + +(values[0, 0] * ((values[1, 1] * values[2, 2]) - (values[1, 2] * values[2, 1]))) - (values[0, 1] * ((values[1, 0] * values[2, 2]) - (values[1, 2] * values[2, 0]))) + (values[0, 2] * ((values[1, 0] * values[2, 1]) - (values[1, 1] * values[2, 0]))); @@ -670,4 +673,4 @@ public static explicit operator Matrix(double[,] values) return new Matrix(values); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Classes/Matrix/Matrix2D.cs b/SAM/SAM.Math/Classes/Matrix/Matrix2D.cs index 0e6b731aa..90e3e27b4 100644 --- a/SAM/SAM.Math/Classes/Matrix/Matrix2D.cs +++ b/SAM/SAM.Math/Classes/Matrix/Matrix2D.cs @@ -1,10 +1,13 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Math { public class Matrix2D : Matrix, ISquareMatrix { - public Matrix2D(JObject jObject) + public Matrix2D(JObject jObject) : base(jObject) { } diff --git a/SAM/SAM.Math/Classes/Matrix/Matrix3D.cs b/SAM/SAM.Math/Classes/Matrix/Matrix3D.cs index ef40d4178..81d241078 100644 --- a/SAM/SAM.Math/Classes/Matrix/Matrix3D.cs +++ b/SAM/SAM.Math/Classes/Matrix/Matrix3D.cs @@ -1,10 +1,13 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Math { public class Matrix3D : Matrix, ISquareMatrix { - public Matrix3D(JObject jObject) + public Matrix3D(JObject jObject) : base(jObject) { } diff --git a/SAM/SAM.Math/Classes/Matrix/Matrix4D.cs b/SAM/SAM.Math/Classes/Matrix/Matrix4D.cs index e2d5bfe64..fb8162c6b 100644 --- a/SAM/SAM.Math/Classes/Matrix/Matrix4D.cs +++ b/SAM/SAM.Math/Classes/Matrix/Matrix4D.cs @@ -1,10 +1,13 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Math { public class Matrix4D : Matrix, ISquareMatrix { - public Matrix4D(JObject jObject) + public Matrix4D(JObject jObject) : base(jObject) { } diff --git a/SAM/SAM.Math/Classes/PolynomialModifier.cs b/SAM/SAM.Math/Classes/PolynomialModifier.cs index 4d9cf7e3b..8be0796b1 100644 --- a/SAM/SAM.Math/Classes/PolynomialModifier.cs +++ b/SAM/SAM.Math/Classes/PolynomialModifier.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Math; namespace SAM.Core @@ -16,14 +19,14 @@ public PolynomialModifier(ArithmeticOperator arithmeticOperator, PolynomialEquat public PolynomialModifier(PolynomialModifier polynomialModifier) : base(polynomialModifier) { - if(polynomialModifier != null) + if (polynomialModifier != null) { PolynomialEquation = polynomialModifier?.PolynomialEquation == null ? null : new PolynomialEquation(polynomialModifier.PolynomialEquation); } } public PolynomialModifier(JObject jObject) - :base(jObject) + : base(jObject) { } @@ -31,12 +34,12 @@ public PolynomialModifier(JObject jObject) public override bool FromJObject(JObject jObject) { bool result = base.FromJObject(jObject); - if(!result) + if (!result) { return result; } - if(jObject.ContainsKey("PolynomialEquation")) + if (jObject.ContainsKey("PolynomialEquation")) { PolynomialEquation = Query.IJSAMObject(jObject.Value("PolynomialEquation")); } @@ -47,12 +50,12 @@ public override bool FromJObject(JObject jObject) public override JObject ToJObject() { JObject result = base.ToJObject(); - if(result == null) + if (result == null) { return null; } - if(PolynomialEquation != null) + if (PolynomialEquation != null) { result.Add("PolynomialEquation", PolynomialEquation.ToJObject()); } @@ -75,4 +78,4 @@ public override double GetCalculatedValue(int index, double value) return Query.Calculate(ArithmeticOperator, value, PolynomialEquation.Evaluate(index)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Convert/ToMathNet/Matrix.cs b/SAM/SAM.Math/Convert/ToMathNet/Matrix.cs index 6d29f647c..0c813b9fd 100644 --- a/SAM/SAM.Math/Convert/ToMathNet/Matrix.cs +++ b/SAM/SAM.Math/Convert/ToMathNet/Matrix.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Convert { @@ -10,4 +13,4 @@ public static MathNet.Numerics.LinearAlgebra.Matrix ToMathNet(this Matri return MathNet.Numerics.LinearAlgebra.CreateMatrix.DenseOfArray(matrix.ToArray()); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Convert/ToMathNet/Polynominal.cs b/SAM/SAM.Math/Convert/ToMathNet/Polynominal.cs index 0a5ccf957..5cc23a08a 100644 --- a/SAM/SAM.Math/Convert/ToMathNet/Polynominal.cs +++ b/SAM/SAM.Math/Convert/ToMathNet/Polynominal.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Convert { @@ -10,4 +13,4 @@ public static MathNet.Numerics.Polynomial ToMathNet(this PolynomialEquation poly return new MathNet.Numerics.Polynomial(polynomialEquation.Coefficients); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Convert/ToSAM/Matrix.cs b/SAM/SAM.Math/Convert/ToSAM/Matrix.cs index 117f3819a..e751d957d 100644 --- a/SAM/SAM.Math/Convert/ToSAM/Matrix.cs +++ b/SAM/SAM.Math/Convert/ToSAM/Matrix.cs @@ -1,8 +1,11 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Convert { - public static Matrix ToSAM(this MathNet.Numerics.LinearAlgebra.Matrix matrix) + public static Matrix ToSAM(this MathNet.Numerics.LinearAlgebra.Matrix matrix) { if (matrix == null) return null; @@ -10,4 +13,4 @@ public static Matrix ToSAM(this MathNet.Numerics.LinearAlgebra.Matrix m return new Matrix(matrix.ToArray()); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Convert/ToSAM/PolynomialEquation.cs b/SAM/SAM.Math/Convert/ToSAM/PolynomialEquation.cs index 1d6e027d9..d04854ab4 100644 --- a/SAM/SAM.Math/Convert/ToSAM/PolynomialEquation.cs +++ b/SAM/SAM.Math/Convert/ToSAM/PolynomialEquation.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Convert { @@ -10,4 +13,4 @@ public static PolynomialEquation ToSAM(this MathNet.Numerics.Polynomial polynomi return new PolynomialEquation(polynomial.Coefficients); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Create/LinearEquation.cs b/SAM/SAM.Math/Create/LinearEquation.cs index f105c5429..2bffc3767 100644 --- a/SAM/SAM.Math/Create/LinearEquation.cs +++ b/SAM/SAM.Math/Create/LinearEquation.cs @@ -1,10 +1,13 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Create { public static LinearEquation LinearEquation(double x_1, double y_1, double x_2, double y_2) { - if(double.IsNaN(x_1) || double.IsNaN(x_2) || double.IsNaN(y_1) || double.IsNaN(y_2)) + if (double.IsNaN(x_1) || double.IsNaN(x_2) || double.IsNaN(y_1) || double.IsNaN(y_2)) { return null; } @@ -13,7 +16,7 @@ public static LinearEquation LinearEquation(double x_1, double y_1, double x_2, double b = double.NaN; double x = x_2 - x_1; - if(x == 0) + if (x == 0) { return null; } diff --git a/SAM/SAM.Math/Create/Matrix.cs b/SAM/SAM.Math/Create/Matrix.cs index a7f3818a4..c855c56ef 100644 --- a/SAM/SAM.Math/Create/Matrix.cs +++ b/SAM/SAM.Math/Create/Matrix.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Math { @@ -9,7 +12,7 @@ public static Matrix Matrix(Matrix matrix) if (matrix == null) return null; - if(matrix.IsSquare()) + if (matrix.IsSquare()) { int count = matrix.RowCount(); diff --git a/SAM/SAM.Math/Create/Matrix2D.cs b/SAM/SAM.Math/Create/Matrix2D.cs index 13352fccf..f842890e6 100644 --- a/SAM/SAM.Math/Create/Matrix2D.cs +++ b/SAM/SAM.Math/Create/Matrix2D.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Create { diff --git a/SAM/SAM.Math/Create/Matrix3D.cs b/SAM/SAM.Math/Create/Matrix3D.cs index fb45a348f..ba9e46994 100644 --- a/SAM/SAM.Math/Create/Matrix3D.cs +++ b/SAM/SAM.Math/Create/Matrix3D.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Create { diff --git a/SAM/SAM.Math/Create/Matrix4D.cs b/SAM/SAM.Math/Create/Matrix4D.cs index b990f2ec1..b659fc2e3 100644 --- a/SAM/SAM.Math/Create/Matrix4D.cs +++ b/SAM/SAM.Math/Create/Matrix4D.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Create { diff --git a/SAM/SAM.Math/Create/PolynomialEquation.cs b/SAM/SAM.Math/Create/PolynomialEquation.cs index fbfd2c428..ac663f601 100644 --- a/SAM/SAM.Math/Create/PolynomialEquation.cs +++ b/SAM/SAM.Math/Create/PolynomialEquation.cs @@ -1,4 +1,7 @@ -using MathNet.Numerics; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using MathNet.Numerics; using System.Collections.Generic; using System.Linq; @@ -19,13 +22,13 @@ public static PolynomialEquation PolynomialEquation(IEnumerable x, IEnum return null; } - if(x.Count() == 1) + if (x.Count() == 1) { return null; } int order_Temp = order; - if(order_Temp == -1) + if (order_Temp == -1) { order_Temp = count - 1; } diff --git a/SAM/SAM.Math/Interfaces/IEquation.cs b/SAM/SAM.Math/Interfaces/IEquation.cs index ea77c6764..043e15171 100644 --- a/SAM/SAM.Math/Interfaces/IEquation.cs +++ b/SAM/SAM.Math/Interfaces/IEquation.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Math diff --git a/SAM/SAM.Math/Interfaces/ISquareMatrix.cs b/SAM/SAM.Math/Interfaces/ISquareMatrix.cs index 68f988b62..ac75753fa 100644 --- a/SAM/SAM.Math/Interfaces/ISquareMatrix.cs +++ b/SAM/SAM.Math/Interfaces/ISquareMatrix.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public interface ISquareMatrix { diff --git a/SAM/SAM.Math/Query/Arccos.cs b/SAM/SAM.Math/Query/Arccos.cs index 9c8837438..64c0a6319 100644 --- a/SAM/SAM.Math/Query/Arccos.cs +++ b/SAM/SAM.Math/Query/Arccos.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Query { @@ -9,4 +12,4 @@ public static double Arccos(double angle) return System.Math.Atan(-angle / System.Math.Sqrt(-angle * angle + 1)) + 2 * System.Math.Atan(1); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/Arccosec.cs b/SAM/SAM.Math/Query/Arccosec.cs index a1852187d..81a992ace 100644 --- a/SAM/SAM.Math/Query/Arccosec.cs +++ b/SAM/SAM.Math/Query/Arccosec.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Query { @@ -9,4 +12,4 @@ public static double Arccosec(double angle) return System.Math.Atan(System.Math.Sign(angle) / System.Math.Sqrt(angle * angle - 1)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/Arccotan.cs b/SAM/SAM.Math/Query/Arccotan.cs index 5cbae88ae..06405bed4 100644 --- a/SAM/SAM.Math/Query/Arccotan.cs +++ b/SAM/SAM.Math/Query/Arccotan.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Query { @@ -9,4 +12,4 @@ public static double Arccotan(double angle) return 2 * System.Math.Atan(1) - System.Math.Atan(angle); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/Arcosh.cs b/SAM/SAM.Math/Query/Arcosh.cs index e171e9e98..bbb7c8828 100644 --- a/SAM/SAM.Math/Query/Arcosh.cs +++ b/SAM/SAM.Math/Query/Arcosh.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Query { @@ -10,4 +13,4 @@ public static double Arcosh(double x) return System.Math.Log(x + System.Math.Sqrt(x * x - 1)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/Arcoth.cs b/SAM/SAM.Math/Query/Arcoth.cs index 4e2398d2c..e3bac8003 100644 --- a/SAM/SAM.Math/Query/Arcoth.cs +++ b/SAM/SAM.Math/Query/Arcoth.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Query { @@ -10,4 +13,4 @@ public static double Arcoth(double x) return System.Math.Log((x + 1) / (x - 1)) / 2; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/Arcsch.cs b/SAM/SAM.Math/Query/Arcsch.cs index 546a92d33..8b38b426f 100644 --- a/SAM/SAM.Math/Query/Arcsch.cs +++ b/SAM/SAM.Math/Query/Arcsch.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Query { @@ -10,4 +13,4 @@ public static double Arcsch(double x) return System.Math.Log((System.Math.Sign(x) * System.Math.Sqrt(x * x + 1) + 1) / x); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/Arcsec.cs b/SAM/SAM.Math/Query/Arcsec.cs index 2f777e676..39effe500 100644 --- a/SAM/SAM.Math/Query/Arcsec.cs +++ b/SAM/SAM.Math/Query/Arcsec.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Query { @@ -9,4 +12,4 @@ public static double Arcsec(double x) return 2 * System.Math.Atan(1) - System.Math.Atan(System.Math.Sign(x) / System.Math.Sqrt(x * x - 1)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/Arcsin.cs b/SAM/SAM.Math/Query/Arcsin.cs index c1f10d0cd..8699089b2 100644 --- a/SAM/SAM.Math/Query/Arcsin.cs +++ b/SAM/SAM.Math/Query/Arcsin.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Query { @@ -8,4 +11,4 @@ public static double Arcsin(double angle) return System.Math.Atan(angle / System.Math.Sqrt(-angle * angle + 1)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/Arsech.cs b/SAM/SAM.Math/Query/Arsech.cs index 9e4a06bdc..6e0e8bf6c 100644 --- a/SAM/SAM.Math/Query/Arsech.cs +++ b/SAM/SAM.Math/Query/Arsech.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Query { @@ -10,4 +13,4 @@ public static double Arsech(double x) return System.Math.Log((System.Math.Sqrt(-x * x + 1) + 1) / x); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/Arsinh.cs b/SAM/SAM.Math/Query/Arsinh.cs index 93a37b594..881556fe7 100644 --- a/SAM/SAM.Math/Query/Arsinh.cs +++ b/SAM/SAM.Math/Query/Arsinh.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Query { @@ -10,4 +13,4 @@ public static double Arsinh(double x) return System.Math.Log(x + System.Math.Sqrt(x * x + 1)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/Artanh.cs b/SAM/SAM.Math/Query/Artanh.cs index 3142b02ce..080313ab3 100644 --- a/SAM/SAM.Math/Query/Artanh.cs +++ b/SAM/SAM.Math/Query/Artanh.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Query { @@ -10,4 +13,4 @@ public static double Artanh(double x) return System.Math.Log((1 + x) / (1 - x)) / 2; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/Cosec.cs b/SAM/SAM.Math/Query/Cosec.cs index 6e1cf0ff0..7626a37a8 100644 --- a/SAM/SAM.Math/Query/Cosec.cs +++ b/SAM/SAM.Math/Query/Cosec.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Query { @@ -9,4 +12,4 @@ public static double Cosec(double angle) return 1 / System.Math.Sin(angle); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/Cosech.cs b/SAM/SAM.Math/Query/Cosech.cs index 93f13f840..cc8158cd9 100644 --- a/SAM/SAM.Math/Query/Cosech.cs +++ b/SAM/SAM.Math/Query/Cosech.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Query { @@ -9,4 +12,4 @@ public static double Cosech(double angle) return 2 / (System.Math.Exp(angle) - System.Math.Exp(-angle)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/Cosh.cs b/SAM/SAM.Math/Query/Cosh.cs index c2e7c7b0d..f0c86563b 100644 --- a/SAM/SAM.Math/Query/Cosh.cs +++ b/SAM/SAM.Math/Query/Cosh.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Query { @@ -8,4 +11,4 @@ public static double Cosh(double angle) return (System.Math.Exp(angle) + System.Math.Exp(-angle)) / 2; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/Cotan.cs b/SAM/SAM.Math/Query/Cotan.cs index 707cf629d..00176c15d 100644 --- a/SAM/SAM.Math/Query/Cotan.cs +++ b/SAM/SAM.Math/Query/Cotan.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Query { @@ -9,4 +12,4 @@ public static double Cotan(double angle) return 1 / System.Math.Tan(angle); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/Coth.cs b/SAM/SAM.Math/Query/Coth.cs index afdc77026..806702c7f 100644 --- a/SAM/SAM.Math/Query/Coth.cs +++ b/SAM/SAM.Math/Query/Coth.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Query { @@ -9,4 +12,4 @@ public static double Coth(double angle) return (System.Math.Exp(angle) + System.Math.Exp(-angle)) / (System.Math.Exp(angle) - System.Math.Exp(-angle)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/CubeRoot.cs b/SAM/SAM.Math/Query/CubeRoot.cs index 434fb356e..2c3c77497 100644 --- a/SAM/SAM.Math/Query/CubeRoot.cs +++ b/SAM/SAM.Math/Query/CubeRoot.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Query { @@ -14,4 +17,4 @@ public static double CubeRoot(double value) return System.Math.Pow(value, oneThird); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/LogN.cs b/SAM/SAM.Math/Query/LogN.cs index f6759272f..1e6a8348a 100644 --- a/SAM/SAM.Math/Query/LogN.cs +++ b/SAM/SAM.Math/Query/LogN.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Query { @@ -9,4 +12,4 @@ public static double LogN(double x, double n) return System.Math.Log(x) / System.Math.Log(n); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/Max.cs b/SAM/SAM.Math/Query/Max.cs index 74a97397b..906455d70 100644 --- a/SAM/SAM.Math/Query/Max.cs +++ b/SAM/SAM.Math/Query/Max.cs @@ -1,4 +1,7 @@ -using System.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Linq; namespace SAM.Math { @@ -12,4 +15,4 @@ public static T Max(params T[] values) return values.ToList().Max(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/Median.cs b/SAM/SAM.Math/Query/Median.cs index 270575909..18c7db867 100644 --- a/SAM/SAM.Math/Query/Median.cs +++ b/SAM/SAM.Math/Query/Median.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Math @@ -24,4 +27,4 @@ public static double Median(this IEnumerable values) return values.ElementAt(half); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/Min.cs b/SAM/SAM.Math/Query/Min.cs index a56da1c22..8eac7af38 100644 --- a/SAM/SAM.Math/Query/Min.cs +++ b/SAM/SAM.Math/Query/Min.cs @@ -1,4 +1,7 @@ -using System.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Linq; namespace SAM.Math { @@ -12,4 +15,4 @@ public static T Min(params T[] values) return values.ToList().Min(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/Modal.cs b/SAM/SAM.Math/Query/Modal.cs index 98ff8a8cb..d9ebd140a 100644 --- a/SAM/SAM.Math/Query/Modal.cs +++ b/SAM/SAM.Math/Query/Modal.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Math @@ -16,4 +19,4 @@ public static T Modal(this IEnumerable values) .FirstOrDefault(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/NeigbourIndices.cs b/SAM/SAM.Math/Query/NeigbourIndices.cs index f401d535a..d8d8fd2b5 100644 --- a/SAM/SAM.Math/Query/NeigbourIndices.cs +++ b/SAM/SAM.Math/Query/NeigbourIndices.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Query { @@ -14,19 +17,19 @@ public static void NeigbourIndices(double[] values, double value, out int lowerI lowerIndex = -1; upperIndex = -1; - if(values == null || values.Length == 0 || double.IsNaN(value)) + if (values == null || values.Length == 0 || double.IsNaN(value)) { return; } - if(value <= values[0] ) + if (value <= values[0]) { lowerIndex = 0; upperIndex = 0; return; } - if(value >= values[values.Length - 1]) + if (value >= values[values.Length - 1]) { lowerIndex = values.Length - 1; upperIndex = values.Length - 1; @@ -35,13 +38,13 @@ public static void NeigbourIndices(double[] values, double value, out int lowerI for (int i = 1; i < values.Length; i++) { - if(value < values[i]) + if (value < values[i]) { lowerIndex = i - 1; upperIndex = i; return; } - else if(value == values[i]) + else if (value == values[i]) { lowerIndex = i; upperIndex = i; @@ -49,4 +52,4 @@ public static void NeigbourIndices(double[] values, double value, out int lowerI } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/RealCubicRoots.cs b/SAM/SAM.Math/Query/RealCubicRoots.cs index 873871ea7..66491d1bf 100644 --- a/SAM/SAM.Math/Query/RealCubicRoots.cs +++ b/SAM/SAM.Math/Query/RealCubicRoots.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Query { @@ -79,4 +82,4 @@ public static double[] RealCubicRoots_ThreeRootsOnly(double a, double b, double return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/Remap.cs b/SAM/SAM.Math/Query/Remap.cs index 3ef943dcd..7b1ba3b98 100644 --- a/SAM/SAM.Math/Query/Remap.cs +++ b/SAM/SAM.Math/Query/Remap.cs @@ -1,15 +1,19 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Query { public static double Remap(this double value, double from_1, double to_1, double from_2, double to_2) { - if ((to_1 - from_1) * (to_2 - from_2) == 0) + if ((to_1 - from_1) * (to_2 - from_2) == 0) { return from_2; } - else { + else + { return ((value - from_1) / (to_1 - from_1) * (to_2 - from_2) + from_2); - } - + } + } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/Sec.cs b/SAM/SAM.Math/Query/Sec.cs index b1e7751d4..b18a07772 100644 --- a/SAM/SAM.Math/Query/Sec.cs +++ b/SAM/SAM.Math/Query/Sec.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Query { @@ -9,4 +12,4 @@ public static double Sec(double angle) return 1 / System.Math.Cos(angle); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/Sech.cs b/SAM/SAM.Math/Query/Sech.cs index ed6787fac..bba2d29fa 100644 --- a/SAM/SAM.Math/Query/Sech.cs +++ b/SAM/SAM.Math/Query/Sech.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Query { @@ -9,4 +12,4 @@ public static double Sech(double angle) return 2 / (System.Math.Exp(angle) + System.Math.Exp(-angle)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/Sinh.cs b/SAM/SAM.Math/Query/Sinh.cs index 2ff8d94e8..96e5485c1 100644 --- a/SAM/SAM.Math/Query/Sinh.cs +++ b/SAM/SAM.Math/Query/Sinh.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Query { @@ -9,4 +12,4 @@ public static double Sinh(double angle) return (System.Math.Exp(angle) - System.Math.Exp(-angle)) / 2; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Math/Query/Tanh.cs b/SAM/SAM.Math/Query/Tanh.cs index b2d3aaddd..889fd7596 100644 --- a/SAM/SAM.Math/Query/Tanh.cs +++ b/SAM/SAM.Math/Query/Tanh.cs @@ -1,4 +1,7 @@ -namespace SAM.Math +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Math { public static partial class Query { @@ -9,4 +12,4 @@ public static double Tanh(double angle) return (System.Math.Exp(angle) - System.Math.Exp(-angle)) / (System.Math.Exp(angle) + System.Math.Exp(-angle)); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Units/Attributes/Abbreviation.cs b/SAM/SAM.Units/Attributes/Abbreviation.cs index 9c15b287d..90dd108b8 100644 --- a/SAM/SAM.Units/Attributes/Abbreviation.cs +++ b/SAM/SAM.Units/Attributes/Abbreviation.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Units { diff --git a/SAM/SAM.Units/Convert/ByUnitType.cs b/SAM/SAM.Units/Convert/ByUnitType.cs index 663944d25..0ca1f6d8c 100644 --- a/SAM/SAM.Units/Convert/ByUnitType.cs +++ b/SAM/SAM.Units/Convert/ByUnitType.cs @@ -1,15 +1,18 @@ -namespace SAM.Units +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Units { public static partial class Convert { public static double ByUnitType(double value, UnitType from, UnitType to) { - if(from == to) + if (from == to) { return value; } - - + + switch (from) { case UnitType.Meter: @@ -29,7 +32,7 @@ public static double ByUnitType(double value, UnitType from, UnitType to) break; case UnitType.Kelvin: - switch(to) + switch (to) { case UnitType.Celsius: return value + Factor.KelvinToCelsius; @@ -51,7 +54,7 @@ public static double ByUnitType(double value, UnitType from, UnitType to) break; case UnitType.Fahrenheit: - switch(to) + switch (to) { case UnitType.Kelvin: return ByUnitType(ByUnitType(value, from, UnitType.Celsius), UnitType.Celsius, to); @@ -62,7 +65,7 @@ public static double ByUnitType(double value, UnitType from, UnitType to) break; case UnitType.KilogramPerKilogram: - switch(to) + switch (to) { case UnitType.GramPerKilogram: return value * 1000; @@ -81,7 +84,7 @@ public static double ByUnitType(double value, UnitType from, UnitType to) break; case UnitType.GramPerKilogram: - switch(to) + switch (to) { case UnitType.KilogramPerKilogram: return value / 1000; @@ -92,7 +95,7 @@ public static double ByUnitType(double value, UnitType from, UnitType to) break; case UnitType.Percent: - switch(to) + switch (to) { case UnitType.Unitless: return value / 100; @@ -100,7 +103,7 @@ public static double ByUnitType(double value, UnitType from, UnitType to) break; case UnitType.Unitless: - switch(to) + switch (to) { case UnitType.Percent: return value * 100; @@ -201,17 +204,17 @@ public static double ByUnitType(double value, UnitType from, UnitType to) public static double ByUnitType(double value, UnitType from, UnitStyle unitStyle) { - if(double.IsNaN(value)) + if (double.IsNaN(value)) { return double.NaN; } - if(from == UnitType.Undefined || unitStyle == UnitStyle.Undefined) + if (from == UnitType.Undefined || unitStyle == UnitStyle.Undefined) { return value; } - switch(unitStyle) + switch (unitStyle) { case UnitStyle.Imperial: return ToImperial(value, from); @@ -223,4 +226,4 @@ public static double ByUnitType(double value, UnitType from, UnitStyle unitStyle return double.NaN; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Units/Convert/ToDegrees.cs b/SAM/SAM.Units/Convert/ToDegrees.cs index 141df060d..b15fbfbcd 100644 --- a/SAM/SAM.Units/Convert/ToDegrees.cs +++ b/SAM/SAM.Units/Convert/ToDegrees.cs @@ -1,4 +1,7 @@ -namespace SAM.Units +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Units { public static partial class Convert { @@ -7,4 +10,4 @@ public static double ToDegrees(double value) return value * Factor.RadiansToDegrees; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Units/Convert/ToImperial.cs b/SAM/SAM.Units/Convert/ToImperial.cs index afd451bce..360c4d215 100644 --- a/SAM/SAM.Units/Convert/ToImperial.cs +++ b/SAM/SAM.Units/Convert/ToImperial.cs @@ -1,4 +1,7 @@ -namespace SAM.Units +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Units { public static partial class Convert { @@ -43,4 +46,4 @@ public static double ToImperial(double value, UnitType from) return double.NaN; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Units/Convert/ToRadians.cs b/SAM/SAM.Units/Convert/ToRadians.cs index 810400f9b..59d003cf0 100644 --- a/SAM/SAM.Units/Convert/ToRadians.cs +++ b/SAM/SAM.Units/Convert/ToRadians.cs @@ -1,4 +1,7 @@ -namespace SAM.Units +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Units { public static partial class Convert { @@ -7,4 +10,4 @@ public static double ToRadians(double value) return value * Factor.DegreesToRadians; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Units/Convert/ToSI.cs b/SAM/SAM.Units/Convert/ToSI.cs index 42a2bba2a..09b510bca 100644 --- a/SAM/SAM.Units/Convert/ToSI.cs +++ b/SAM/SAM.Units/Convert/ToSI.cs @@ -1,4 +1,7 @@ -namespace SAM.Units +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Units { public static partial class Convert { @@ -67,4 +70,4 @@ public static double ToSI(double value, UnitType from) return double.NaN; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Units/Enums/UnitCategory.cs b/SAM/SAM.Units/Enums/UnitCategory.cs index b614f9e4e..f324df77f 100644 --- a/SAM/SAM.Units/Enums/UnitCategory.cs +++ b/SAM/SAM.Units/Enums/UnitCategory.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Units { @@ -17,4 +20,4 @@ public enum UnitCategory [Description("Specific Enthalpy")] SpecificEnthaply, [Description("Power")] Power, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Units/Enums/UnitStyle.cs b/SAM/SAM.Units/Enums/UnitStyle.cs index d460b1158..551170e65 100644 --- a/SAM/SAM.Units/Enums/UnitStyle.cs +++ b/SAM/SAM.Units/Enums/UnitStyle.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Units { @@ -8,4 +11,4 @@ public enum UnitStyle [Description("Imperial")] Imperial, [Description("SI")] SI } -} \ No newline at end of file +} diff --git a/SAM/SAM.Units/Enums/UnitType.cs b/SAM/SAM.Units/Enums/UnitType.cs index a774374db..d8a6ff488 100644 --- a/SAM/SAM.Units/Enums/UnitType.cs +++ b/SAM/SAM.Units/Enums/UnitType.cs @@ -1,37 +1,40 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Units { [Description("UnitType")] public enum UnitType { - [Abbreviation("")] [Description("Undefined")] Undefined, - [Abbreviation("m")] [Description("Meter")] Meter, - [Abbreviation("ft")] [Description("Feet")] Feet, - [Abbreviation("°C")] [Description("Celsius")] Celsius, - [Abbreviation("K")] [Description("Kelvin")] Kelvin, - [Abbreviation("F")] [Description("Fahrenheit")] Fahrenheit, - [Abbreviation("kg/kg")] [Description("Kilogram Per Kilogram")] KilogramPerKilogram, - [Abbreviation("g/kg")] [Description("Gram Per Kilogram")] GramPerKilogram, - [Abbreviation("%")] [Description("Percent")] Percent, - [Abbreviation("-")] [Description("Unitless")] Unitless, - [Abbreviation("kg/m3")] [Description("Kilogram Per Cubic Meter")] KilogramPerCubicMeter, - [Abbreviation("m3/kg")] [Description("Cubic Meter Per Kilogram")] CubicMeterPerKilogram, - [Abbreviation("m3/g")] [Description("Cubic Meter Per gram")] CubicMeterPerGram, - [Abbreviation("m3/h")] [Description("Cubic Meter Per Hour")] CubicMeterPerHour, - [Abbreviation("m3/s")] [Description("Cubic Meter Per Second")] CubicMeterPerSecond, - [Abbreviation("Pa")] [Description("Pascal")] Pascal, - [Abbreviation("kPa")] [Description("Kilopascal")] Kilopascal, - [Abbreviation("Ba")] [Description("Bar")] Bar, - [Abbreviation("psi")] [Description("Pound Per Square Inch")] PoundPerSquareInch, - [Abbreviation("kJ")] [Description("Kilojule")] Kilojule, - [Abbreviation("kJ/kg")] [Description("Kilojule Per Kilogram")] KilojulePerKilogram, - [Abbreviation("J/kg")] [Description("Jule Per Kilogram")] JulePerKilogram, - [Abbreviation("J")] [Description("Jule")] Jule, - [Abbreviation("W")] [Description("Watt")] Watt, - [Abbreviation("kW")] [Description("Kliowatt")] Kilowatt, + [Abbreviation("")][Description("Undefined")] Undefined, + [Abbreviation("m")][Description("Meter")] Meter, + [Abbreviation("ft")][Description("Feet")] Feet, + [Abbreviation("°C")][Description("Celsius")] Celsius, + [Abbreviation("K")][Description("Kelvin")] Kelvin, + [Abbreviation("F")][Description("Fahrenheit")] Fahrenheit, + [Abbreviation("kg/kg")][Description("Kilogram Per Kilogram")] KilogramPerKilogram, + [Abbreviation("g/kg")][Description("Gram Per Kilogram")] GramPerKilogram, + [Abbreviation("%")][Description("Percent")] Percent, + [Abbreviation("-")][Description("Unitless")] Unitless, + [Abbreviation("kg/m3")][Description("Kilogram Per Cubic Meter")] KilogramPerCubicMeter, + [Abbreviation("m3/kg")][Description("Cubic Meter Per Kilogram")] CubicMeterPerKilogram, + [Abbreviation("m3/g")][Description("Cubic Meter Per gram")] CubicMeterPerGram, + [Abbreviation("m3/h")][Description("Cubic Meter Per Hour")] CubicMeterPerHour, + [Abbreviation("m3/s")][Description("Cubic Meter Per Second")] CubicMeterPerSecond, + [Abbreviation("Pa")][Description("Pascal")] Pascal, + [Abbreviation("kPa")][Description("Kilopascal")] Kilopascal, + [Abbreviation("Ba")][Description("Bar")] Bar, + [Abbreviation("psi")][Description("Pound Per Square Inch")] PoundPerSquareInch, + [Abbreviation("kJ")][Description("Kilojule")] Kilojule, + [Abbreviation("kJ/kg")][Description("Kilojule Per Kilogram")] KilojulePerKilogram, + [Abbreviation("J/kg")][Description("Jule Per Kilogram")] JulePerKilogram, + [Abbreviation("J")][Description("Jule")] Jule, + [Abbreviation("W")][Description("Watt")] Watt, + [Abbreviation("kW")][Description("Kliowatt")] Kilowatt, [Abbreviation("l/s")][Description("Liters Per Second")] LitersPerSecond, [Abbreviation("N/m2")][Description("Newton Per Squere Meter")] NewtonPerSquereMeter, [Abbreviation("g/g")][Description("Gram Per Gram")] GramPerGram, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Units/Properties/AssemblyInfo.cs b/SAM/SAM.Units/Properties/AssemblyInfo.cs index f271259df..c2b634854 100644 --- a/SAM/SAM.Units/Properties/AssemblyInfo.cs +++ b/SAM/SAM.Units/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -/* +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +/* * This file is part of the Sustaiable Analytical Model (SAM) * Copyright (c) 2020, the respective contributors. All rights reserved. * diff --git a/SAM/SAM.Units/Query/Abbreviation.cs b/SAM/SAM.Units/Query/Abbreviation.cs index 1117d48b4..786bce65d 100644 --- a/SAM/SAM.Units/Query/Abbreviation.cs +++ b/SAM/SAM.Units/Query/Abbreviation.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Reflection; namespace SAM.Units @@ -27,4 +30,4 @@ public static string Abbreviation(this UnitType unitType) return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Units/Query/DefaultTolerance.cs b/SAM/SAM.Units/Query/DefaultTolerance.cs index ee60b4334..718035c63 100644 --- a/SAM/SAM.Units/Query/DefaultTolerance.cs +++ b/SAM/SAM.Units/Query/DefaultTolerance.cs @@ -1,10 +1,13 @@ -namespace SAM.Units +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Units { public static partial class Query { public static double DefaultTolerance(this UnitType unitType) { - switch(unitType) + switch (unitType) { case Units.UnitType.Celsius: return 0.01; @@ -37,4 +40,4 @@ public static double DefaultTolerance(this UnitType unitType) return double.NaN; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Units/Query/Description.cs b/SAM/SAM.Units/Query/Description.cs index 0bd3626bc..8326caab5 100644 --- a/SAM/SAM.Units/Query/Description.cs +++ b/SAM/SAM.Units/Query/Description.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Reflection; namespace SAM.Units @@ -27,4 +30,4 @@ public static string Description(this UnitType unitType) return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Units/Query/UnitType.cs b/SAM/SAM.Units/Query/UnitType.cs index db44c134f..824a4d99d 100644 --- a/SAM/SAM.Units/Query/UnitType.cs +++ b/SAM/SAM.Units/Query/UnitType.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Units @@ -7,15 +10,15 @@ public static partial class Query { public static UnitType UnitType(this UnitStyle unitStyle, UnitCategory unitCategory) { - if(unitStyle == UnitStyle.Undefined || unitCategory == UnitCategory.Undefined) + if (unitStyle == UnitStyle.Undefined || unitCategory == UnitCategory.Undefined) { return Units.UnitType.Undefined; } - switch(unitStyle) + switch (unitStyle) { case UnitStyle.SI: - switch(unitCategory) + switch (unitCategory) { case UnitCategory.AirFlow: return Units.UnitType.CubicMeterPerSecond; @@ -109,4 +112,4 @@ public static UnitType UnitType(this string text) return Units.UnitType.Undefined; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Units/Query/UnitTypes.cs b/SAM/SAM.Units/Query/UnitTypes.cs index 3c2a705b0..5469fb586 100644 --- a/SAM/SAM.Units/Query/UnitTypes.cs +++ b/SAM/SAM.Units/Query/UnitTypes.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Units @@ -12,16 +15,16 @@ public static List UnitTypes(this UnitCategory unitCategory, params Un { case UnitCategory.Temperature: - if(unitStyles == null || unitStyles.Length == 0) + if (unitStyles == null || unitStyles.Length == 0) { result.Add(Units.UnitType.Celsius); result.Add(Units.UnitType.Fahrenheit); } - else if(unitStyles.Contains(UnitStyle.SI)) + else if (unitStyles.Contains(UnitStyle.SI)) { result.Add(Units.UnitType.Celsius); } - else if(unitStyles.Contains(UnitStyle.Imperial)) + else if (unitStyles.Contains(UnitStyle.Imperial)) { result.Add(Units.UnitType.Fahrenheit); } @@ -207,4 +210,4 @@ public static List UnitTypes(this UnitCategory unitCategory, params Un return null; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Units/Variables/Factor.cs b/SAM/SAM.Units/Variables/Factor.cs index 8f4f3bebe..1dc71ec6b 100644 --- a/SAM/SAM.Units/Variables/Factor.cs +++ b/SAM/SAM.Units/Variables/Factor.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Units { diff --git a/SAM/SAM.Weather/Classes/GroundTemperature.cs b/SAM/SAM.Weather/Classes/GroundTemperature.cs index f4be21d18..65b880dc6 100644 --- a/SAM/SAM.Weather/Classes/GroundTemperature.cs +++ b/SAM/SAM.Weather/Classes/GroundTemperature.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Linq; diff --git a/SAM/SAM.Weather/Classes/PrevailingMeanOutdoorAirTemperature/PrevailingMeanOutdoorAirTemperatureCalculator.cs b/SAM/SAM.Weather/Classes/PrevailingMeanOutdoorAirTemperature/PrevailingMeanOutdoorAirTemperatureCalculator.cs index 196137727..47c775f5f 100644 --- a/SAM/SAM.Weather/Classes/PrevailingMeanOutdoorAirTemperature/PrevailingMeanOutdoorAirTemperatureCalculator.cs +++ b/SAM/SAM.Weather/Classes/PrevailingMeanOutdoorAirTemperature/PrevailingMeanOutdoorAirTemperatureCalculator.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -28,13 +31,13 @@ public PrevailingMeanOutdoorAirTemperatureCalculator(int sequentialDays, double public List Calculate(WeatherData weatherData) { - if(PrevailingMeanOutdoorAirTemperatureCalculationMethod == null) + if (PrevailingMeanOutdoorAirTemperatureCalculationMethod == null) { return null; } List weatherDays = weatherData?.WeatherDays(); - if(weatherDays == null) + if (weatherDays == null) { return null; } @@ -70,7 +73,7 @@ public List Calculate(IEnumerable weatherDays) for (int i = 0; i < weatherDays.Count(); i++) { double? dryBulbTemperature = weatherDays?.ElementAt(i)?.Average(WeatherDataType.DryBulbTemperature); - if(dryBulbTemperature == null || !dryBulbTemperature.HasValue || double.IsNaN(dryBulbTemperature.Value)) + if (dryBulbTemperature == null || !dryBulbTemperature.HasValue || double.IsNaN(dryBulbTemperature.Value)) { continue; } @@ -85,7 +88,7 @@ public List Calculate(IEnumerable weatherDays) public List Calculate(IEnumerable dryBulbTemperatures) { List dryBulbTemperatures_Temp = dryBulbTemperatures?.ToList(); - if(dryBulbTemperatures_Temp == null) + if (dryBulbTemperatures_Temp == null) { return null; } @@ -224,7 +227,7 @@ private List Calculate(List dryBulbTempartures, WeightingCalcula private List Calculate(List dryBulbTempartures, SimpleArithmeticMeanCalculationMethod simpleArithmeticMeanCalculationMethod) { - if(dryBulbTempartures == null || simpleArithmeticMeanCalculationMethod == null || simpleArithmeticMeanCalculationMethod.SequentialDays <= 0) + if (dryBulbTempartures == null || simpleArithmeticMeanCalculationMethod == null || simpleArithmeticMeanCalculationMethod.SequentialDays <= 0) { return null; } @@ -239,7 +242,7 @@ private List Calculate(List dryBulbTempartures, SimpleArithmetic int sequentialDays = simpleArithmeticMeanCalculationMethod.SequentialDays; List dryBulbTemperatures_Temp = new List(dryBulbTempartures); - for(int i = 0; i < sequentialDays; i++) + for (int i = 0; i < sequentialDays; i++) { double dryBulbTemperature = dryBulbTemperatures_Temp[dryBulbTemperatures_Temp.Count - i - 1]; dryBulbTemperatures_Temp.Insert(0, dryBulbTemperature); @@ -289,4 +292,4 @@ private List Calculate(List dryBulbTempartures, SimpleArithmetic // return result; //} } -} \ No newline at end of file +} diff --git a/SAM/SAM.Weather/Classes/PrevailingMeanOutdoorAirTemperature/SimpleArithmeticMeanCalculationMethod.cs b/SAM/SAM.Weather/Classes/PrevailingMeanOutdoorAirTemperature/SimpleArithmeticMeanCalculationMethod.cs index dca1045ed..cef7f1ee3 100644 --- a/SAM/SAM.Weather/Classes/PrevailingMeanOutdoorAirTemperature/SimpleArithmeticMeanCalculationMethod.cs +++ b/SAM/SAM.Weather/Classes/PrevailingMeanOutdoorAirTemperature/SimpleArithmeticMeanCalculationMethod.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Weather { @@ -18,7 +21,7 @@ public SimpleArithmeticMeanCalculationMethod(int sequentialDays) public SimpleArithmeticMeanCalculationMethod(SimpleArithmeticMeanCalculationMethod simpleArithmeticMeanCalculationMethod) { - if(simpleArithmeticMeanCalculationMethod != null) + if (simpleArithmeticMeanCalculationMethod != null) { SequentialDays = simpleArithmeticMeanCalculationMethod.SequentialDays; } @@ -31,12 +34,12 @@ public SimpleArithmeticMeanCalculationMethod(JObject jObject) public virtual bool FromJObject(JObject jObject) { - if(jObject == null) + if (jObject == null) { return false; } - if(jObject.ContainsKey("SequentialDays")) + if (jObject.ContainsKey("SequentialDays")) { SequentialDays = jObject.Value("SequentialDays"); } @@ -52,4 +55,4 @@ public virtual JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Weather/Classes/PrevailingMeanOutdoorAirTemperature/WeightingCalculationMethod.cs b/SAM/SAM.Weather/Classes/PrevailingMeanOutdoorAirTemperature/WeightingCalculationMethod.cs index 2683b7396..36b25c7cc 100644 --- a/SAM/SAM.Weather/Classes/PrevailingMeanOutdoorAirTemperature/WeightingCalculationMethod.cs +++ b/SAM/SAM.Weather/Classes/PrevailingMeanOutdoorAirTemperature/WeightingCalculationMethod.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; namespace SAM.Weather { @@ -7,21 +10,21 @@ public class WeightingCalculationMethod : SimpleArithmeticMeanCalculationMethod public double Alpha { get; set; } = 0.8; public WeightingCalculationMethod() - :base() + : base() { } public WeightingCalculationMethod(int sequentialDays, double alpha) - :base(sequentialDays) + : base(sequentialDays) { Alpha = alpha; } public WeightingCalculationMethod(WeightingCalculationMethod weightingCalculationMethod) - :base(weightingCalculationMethod) + : base(weightingCalculationMethod) { - if(weightingCalculationMethod != null) + if (weightingCalculationMethod != null) { Alpha = weightingCalculationMethod.Alpha; } @@ -34,12 +37,12 @@ public WeightingCalculationMethod(JObject jObject) public bool FromJObject(JObject jObject) { - if(!base.FromJObject(jObject)) + if (!base.FromJObject(jObject)) { return false; } - if(jObject.ContainsKey("Alpha")) + if (jObject.ContainsKey("Alpha")) { Alpha = jObject.Value("Alpha"); } @@ -50,14 +53,14 @@ public bool FromJObject(JObject jObject) public JObject ToJObject() { JObject result = base.ToJObject(); - if(result == null) + if (result == null) { return null; } result.Add("Alpha", Alpha); - + return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Weather/Classes/WeatherData.cs b/SAM/SAM.Weather/Classes/WeatherData.cs index 717ca2168..2b32fab41 100644 --- a/SAM/SAM.Weather/Classes/WeatherData.cs +++ b/SAM/SAM.Weather/Classes/WeatherData.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System; using System.Collections.Generic; @@ -58,7 +61,7 @@ public WeatherData(WeatherData weatherData, string name, string description, dou this.elevation = elevation; weatherYears = new List(); - if(weatherYear != null) + if (weatherYear != null) { weatherYears.Add(weatherYear.Clone()); } @@ -163,7 +166,7 @@ public WeatherHour this[DateTime dateTime] public WeatherHour GetWeatherHour(DateTime dateTime) { WeatherYear weatherYear = this[dateTime.Year]; - if(weatherYear == null) + if (weatherYear == null) { return null; } @@ -334,7 +337,7 @@ public IEnumerable Years public IndexedDoubles GetIndexedDoubles(string name) { - if(this.weatherYears == null) + if (this.weatherYears == null) { return null; } @@ -345,7 +348,7 @@ public IndexedDoubles GetIndexedDoubles(string name) weatherYears.RemoveAll(x => x == null); weatherYears.Sort((x, y) => x.Year.CompareTo(y.Year)); - if(weatherYears == null || weatherYears.Count == 0) + if (weatherYears == null || weatherYears.Count == 0) { return result; } @@ -359,7 +362,7 @@ public IndexedDoubles GetIndexedDoubles(string name) int index = (int)(dateTime_Temp - dateTime).TotalHours; IndexedDoubles indexedDoubles = weatherYear.GetIndexedDoubles(name); - foreach(int key in indexedDoubles.Keys) + foreach (int key in indexedDoubles.Keys) { result[index + key] = indexedDoubles[key]; } @@ -465,4 +468,4 @@ public override JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Weather/Classes/WeatherDay.cs b/SAM/SAM.Weather/Classes/WeatherDay.cs index 2c10c53a9..337c44f50 100644 --- a/SAM/SAM.Weather/Classes/WeatherDay.cs +++ b/SAM/SAM.Weather/Classes/WeatherDay.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -231,13 +234,13 @@ public double Average(string name) return double.NaN; } - if(!dictionary.ContainsKey(name)) + if (!dictionary.ContainsKey(name)) { return double.NaN; } double[] values = dictionary[name]; - if(values == null) + if (values == null) { return double.NaN; } @@ -424,7 +427,7 @@ public WeatherHour GetWeatherHour(int index) } WeatherHour result = new WeatherHour(); - foreach(KeyValuePair keyValuePair in dictionary) + foreach (KeyValuePair keyValuePair in dictionary) { result[keyValuePair.Key] = keyValuePair.Value[index]; } @@ -435,7 +438,7 @@ public WeatherHour GetWeatherHour(int index) public List GetWeatherHours() { List result = new List(); - for(int i=0; i < 24; i++) + for (int i = 0; i < 24; i++) { result.Add(GetWeatherHour(i)); } @@ -445,13 +448,13 @@ public List GetWeatherHours() public List GetWeatherHours(IEnumerable hours) { - if(hours == null) + if (hours == null) { return null; } List result = new List(); - foreach(int hour in hours) + foreach (int hour in hours) { result.Add(GetWeatherHour(hour)); } @@ -459,4 +462,4 @@ public List GetWeatherHours(IEnumerable hours) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Weather/Classes/WeatherHour.cs b/SAM/SAM.Weather/Classes/WeatherHour.cs index 7045f4f24..e60f1c0ef 100644 --- a/SAM/SAM.Weather/Classes/WeatherHour.cs +++ b/SAM/SAM.Weather/Classes/WeatherHour.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using System.Collections.Generic; namespace SAM.Weather @@ -452,4 +455,4 @@ public double AtmosphericPressure } } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Weather/Classes/WeatherYear.cs b/SAM/SAM.Weather/Classes/WeatherYear.cs index 396abaf81..0dfa438c7 100644 --- a/SAM/SAM.Weather/Classes/WeatherYear.cs +++ b/SAM/SAM.Weather/Classes/WeatherYear.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using Newtonsoft.Json.Linq; using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -115,14 +118,14 @@ public bool Add(int day, int hour, Dictionary values) public bool Add(int day, int hour, WeatherHour weatherHour) { IEnumerable keys = weatherHour?.Keys; - if(keys == null || keys.Count() == 0) + if (keys == null || keys.Count() == 0) { return false; } Dictionary dictionary = new Dictionary(); - foreach(string key in keys) + foreach (string key in keys) { dictionary[key] = weatherHour[key]; } @@ -132,7 +135,7 @@ public bool Add(int day, int hour, WeatherHour weatherHour) public bool Add(int hour, WeatherHour weatherHour) { - if(weatherHour == null) + if (weatherHour == null) { return false; } @@ -183,10 +186,10 @@ public List GetWeatherHours() } List result = new List(); - foreach(WeatherDay weatherDay in weatherDays) + foreach (WeatherDay weatherDay in weatherDays) { List weatherHours = weatherDay?.GetWeatherHours(); - if(weatherHours == null) + if (weatherHours == null) { continue; } @@ -205,7 +208,7 @@ public List GetWeatherHours(IEnumerable hours) } List result = new List(); - foreach(int hour in hours) + foreach (int hour in hours) { result.Add(GetWeatherHour(hour)); } @@ -247,7 +250,7 @@ public List GetValues(string name) public IndexedDoubles GetIndexedDoubles(string name) { List values = GetValues(name); - if(values == null) + if (values == null) { return null; } @@ -344,4 +347,4 @@ public JObject ToJObject() return jObject; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Weather/Convert/ToEPW/EPW.cs b/SAM/SAM.Weather/Convert/ToEPW/EPW.cs index 50c7fa695..c21b71568 100644 --- a/SAM/SAM.Weather/Convert/ToEPW/EPW.cs +++ b/SAM/SAM.Weather/Convert/ToEPW/EPW.cs @@ -1,4 +1,7 @@ -namespace SAM.Weather +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Weather { /// /// Provides additional methods for converting weather data between different formats. @@ -40,4 +43,4 @@ public static string ToEPW(this WeatherData weatherData) return string.Join("\n", values); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Weather/Convert/ToSAM/WeatherData.cs b/SAM/SAM.Weather/Convert/ToSAM/WeatherData.cs index 88dfa7c51..1e20466f5 100644 --- a/SAM/SAM.Weather/Convert/ToSAM/WeatherData.cs +++ b/SAM/SAM.Weather/Convert/ToSAM/WeatherData.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -111,4 +114,4 @@ public static WeatherData ToSAM(IEnumerable lines) return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Weather/Create/WeatherYear.cs b/SAM/SAM.Weather/Create/WeatherYear.cs index 2ccf45a1a..4fcc6e292 100644 --- a/SAM/SAM.Weather/Create/WeatherYear.cs +++ b/SAM/SAM.Weather/Create/WeatherYear.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Weather diff --git a/SAM/SAM.Weather/Enums/Parameter/WeatherDataParameter.cs b/SAM/SAM.Weather/Enums/Parameter/WeatherDataParameter.cs index 335196fe6..86025810f 100644 --- a/SAM/SAM.Weather/Enums/Parameter/WeatherDataParameter.cs +++ b/SAM/SAM.Weather/Enums/Parameter/WeatherDataParameter.cs @@ -1,4 +1,7 @@ -using SAM.Core.Attributes; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core.Attributes; using System.ComponentModel; namespace SAM.Weather diff --git a/SAM/SAM.Weather/Enums/WeatherDataType.cs b/SAM/SAM.Weather/Enums/WeatherDataType.cs index b311cf232..05dfc73ab 100644 --- a/SAM/SAM.Weather/Enums/WeatherDataType.cs +++ b/SAM/SAM.Weather/Enums/WeatherDataType.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.ComponentModel; namespace SAM.Weather { @@ -11,12 +14,12 @@ public enum WeatherDataType /// Undefined /// [Description("Undefined")] Undefined, - + /// /// Global Solar Radiation [W/m2] /// [Description("Global Solar Radiation [W/m2]")] GlobalSolarRadiation, - + /// /// Diffuse Solar Radiation [W/m2] /// @@ -62,4 +65,4 @@ public enum WeatherDataType ///
    [Description("Atmospheric Pressure [Pa]")] AtmosphericPressure, } -} \ No newline at end of file +} diff --git a/SAM/SAM.Weather/Interfaces/IWeatherObject.cs b/SAM/SAM.Weather/Interfaces/IWeatherObject.cs index d3aa0a113..721d4b412 100644 --- a/SAM/SAM.Weather/Interfaces/IWeatherObject.cs +++ b/SAM/SAM.Weather/Interfaces/IWeatherObject.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Weather { diff --git a/SAM/SAM.Weather/Interfaces/PrevailingMeanOutdoorAirTemperature/IPrevailingMeanOutdoorAirTemperatureCalculationMethod.cs b/SAM/SAM.Weather/Interfaces/PrevailingMeanOutdoorAirTemperature/IPrevailingMeanOutdoorAirTemperatureCalculationMethod.cs index b149c52d9..76df6bd66 100644 --- a/SAM/SAM.Weather/Interfaces/PrevailingMeanOutdoorAirTemperature/IPrevailingMeanOutdoorAirTemperatureCalculationMethod.cs +++ b/SAM/SAM.Weather/Interfaces/PrevailingMeanOutdoorAirTemperature/IPrevailingMeanOutdoorAirTemperatureCalculationMethod.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Weather { diff --git a/SAM/SAM.Weather/Query/ApproximateRunningMeanDryBulbTemperature.cs b/SAM/SAM.Weather/Query/ApproximateRunningMeanDryBulbTemperature.cs index 96b40d406..3957176dc 100644 --- a/SAM/SAM.Weather/Query/ApproximateRunningMeanDryBulbTemperature.cs +++ b/SAM/SAM.Weather/Query/ApproximateRunningMeanDryBulbTemperature.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -15,7 +18,7 @@ public static double ApproximateRunningMeanDryBulbTemperature(IEnumerable values = new List(); for (int i = 1; i <= 7; i++) @@ -31,4 +34,4 @@ public static double ApproximateRunningMeanDryBulbTemperature(IEnumerable /// This class provides methods for creating and executing queries against a database. @@ -34,4 +37,4 @@ public static string CommentsString(this WeatherData weatherData) return string.Join("\n", new string[] { string.Join(",", values_1), string.Join(",", values_2) }); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Weather/Query/Compare.cs b/SAM/SAM.Weather/Query/Compare.cs index e68eb56f7..16d65f13b 100644 --- a/SAM/SAM.Weather/Query/Compare.cs +++ b/SAM/SAM.Weather/Query/Compare.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Weather { @@ -6,13 +9,13 @@ public static partial class Query { public static bool Compare(this WeatherHour weatherHour, WeatherDataType weatherDataType, double value, NumberComparisonType numberComparisonType) { - if(weatherHour == null || weatherDataType == WeatherDataType.Undefined) + if (weatherHour == null || weatherDataType == WeatherDataType.Undefined) { return false; } double value_WeatherHour = weatherHour[weatherDataType]; - if(double.IsNaN(value_WeatherHour)) + if (double.IsNaN(value_WeatherHour)) { return false; } diff --git a/SAM/SAM.Weather/Query/CoolingDesignWeatherDay.cs b/SAM/SAM.Weather/Query/CoolingDesignWeatherDay.cs index cc5fb3dd1..b32d7a860 100644 --- a/SAM/SAM.Weather/Query/CoolingDesignWeatherDay.cs +++ b/SAM/SAM.Weather/Query/CoolingDesignWeatherDay.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; @@ -144,4 +147,4 @@ public static WeatherDay CoolingDesignWeatherDay(this IEnumerable we } -} \ No newline at end of file +} diff --git a/SAM/SAM.Weather/Query/DataPeriodsString.cs b/SAM/SAM.Weather/Query/DataPeriodsString.cs index 2a3993673..624c48861 100644 --- a/SAM/SAM.Weather/Query/DataPeriodsString.cs +++ b/SAM/SAM.Weather/Query/DataPeriodsString.cs @@ -1,4 +1,7 @@ -namespace SAM.Weather +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Weather { /// /// Contains the partial class Query for the WeatherData type. diff --git a/SAM/SAM.Weather/Query/DataString.cs b/SAM/SAM.Weather/Query/DataString.cs index edb1475c6..e4b048620 100644 --- a/SAM/SAM.Weather/Query/DataString.cs +++ b/SAM/SAM.Weather/Query/DataString.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; using System.Linq; @@ -141,4 +144,4 @@ public static string DataString(int year, int month, int day, int hour, WeatherD return string.Join(",", values); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Weather/Query/DayIndex.cs b/SAM/SAM.Weather/Query/DayIndex.cs index 9d982f189..6e61b3174 100644 --- a/SAM/SAM.Weather/Query/DayIndex.cs +++ b/SAM/SAM.Weather/Query/DayIndex.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; namespace SAM.Weather { @@ -25,4 +28,4 @@ public static int DayIndex(this int hourIndex) return DayIndex(hourIndex, out int dayHourIndex); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Weather/Query/DaylightSavingsString.cs b/SAM/SAM.Weather/Query/DaylightSavingsString.cs index b69de03bf..c735bf157 100644 --- a/SAM/SAM.Weather/Query/DaylightSavingsString.cs +++ b/SAM/SAM.Weather/Query/DaylightSavingsString.cs @@ -1,4 +1,7 @@ -namespace SAM.Weather +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Weather { /// /// Contains the partial class Query for the WeatherData type. diff --git a/SAM/SAM.Weather/Query/DesignConditionsString.cs b/SAM/SAM.Weather/Query/DesignConditionsString.cs index f7698b42b..18c50cef5 100644 --- a/SAM/SAM.Weather/Query/DesignConditionsString.cs +++ b/SAM/SAM.Weather/Query/DesignConditionsString.cs @@ -1,4 +1,7 @@ -namespace SAM.Weather +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Weather { public static partial class Query { @@ -26,4 +29,4 @@ public static string DesignConditionsString(this WeatherData weatherData) return string.Join(",", values); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Weather/Query/DryBulbTemperatureRange.cs b/SAM/SAM.Weather/Query/DryBulbTemperatureRange.cs index 17b7c2e02..e2e5bd4fe 100644 --- a/SAM/SAM.Weather/Query/DryBulbTemperatureRange.cs +++ b/SAM/SAM.Weather/Query/DryBulbTemperatureRange.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; namespace SAM.Weather { @@ -6,7 +9,7 @@ public static partial class Query { public static Range DryBulbTemperatureRange(double dryBulbTemperature) { - if(double.IsNaN(dryBulbTemperature)) + if (double.IsNaN(dryBulbTemperature)) { return null; } @@ -19,18 +22,18 @@ public static Range DryBulbTemperatureRange(double dryBulbTemperature) upperLimit = (dryBulbTemperature * 0.31) + 17.8 + 3.5; lowerLimit = (dryBulbTemperature * 0.31) + 17.8 - 3.5; } - else if( dryBulbTemperature < 10 ) + else if (dryBulbTemperature < 10) { lowerLimit = (10 * 0.31) + 17.8 - 3.5; upperLimit = (10 * 0.31) + 17.8 + 3.5; } - else if( dryBulbTemperature > 33.5) + else if (dryBulbTemperature > 33.5) { upperLimit = (33.5 * 0.31) + 17.8 + 3.5; lowerLimit = (33.5 * 0.31) + 17.8 - 3.5; } - if(double.IsNaN(lowerLimit) || double.IsNaN(upperLimit)) + if (double.IsNaN(lowerLimit) || double.IsNaN(upperLimit)) { return null; } @@ -40,13 +43,13 @@ public static Range DryBulbTemperatureRange(double dryBulbTemperature) public static Range DryBulbTemperatureRange(this WeatherHour weatherHour) { - if(weatherHour == null) + if (weatherHour == null) { return null; } double dryBulbTemperature = weatherHour[WeatherDataType.DryBulbTemperature]; - if(double.IsNaN(dryBulbTemperature)) + if (double.IsNaN(dryBulbTemperature)) { return null; } @@ -54,4 +57,4 @@ public static Range DryBulbTemperatureRange(this WeatherHour weatherHour return DryBulbTemperatureRange(dryBulbTemperature); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Weather/Query/DryBulbTemperatureRanges.cs b/SAM/SAM.Weather/Query/DryBulbTemperatureRanges.cs index 67ed56ca1..2688175f4 100644 --- a/SAM/SAM.Weather/Query/DryBulbTemperatureRanges.cs +++ b/SAM/SAM.Weather/Query/DryBulbTemperatureRanges.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; namespace SAM.Weather @@ -41,7 +44,7 @@ public static List> DryBulbTemperatureRanges(this WeatherYear weat foreach (WeatherDay weatherDay in weatherDays) { List> ranges = DryBulbTemperatureRanges(weatherDay); - if(ranges != null) + if (ranges != null) { result.AddRange(ranges); } @@ -71,4 +74,4 @@ public static List> DryBulbTemperatureRanges(this WeatherData weat return result; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Weather/Query/GroundTemperaturesString.cs b/SAM/SAM.Weather/Query/GroundTemperaturesString.cs index 005c3e3e4..2e893a8a0 100644 --- a/SAM/SAM.Weather/Query/GroundTemperaturesString.cs +++ b/SAM/SAM.Weather/Query/GroundTemperaturesString.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Weather { @@ -52,4 +55,4 @@ public static string GroundTemperaturesString(this WeatherData weatherData) return string.Join(",", values); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Weather/Query/HeatingDesignWeatherDay.cs b/SAM/SAM.Weather/Query/HeatingDesignWeatherDay.cs index d111829f7..a93bf54c6 100644 --- a/SAM/SAM.Weather/Query/HeatingDesignWeatherDay.cs +++ b/SAM/SAM.Weather/Query/HeatingDesignWeatherDay.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Weather @@ -101,4 +104,4 @@ public static WeatherDay HeatingDesignWeatherDay(this IEnumerable we return HeatingDesignWeatherDay(weatherDays, out int dayIndex); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Weather/Query/LocationString.cs b/SAM/SAM.Weather/Query/LocationString.cs index 3e2288f64..e73f75465 100644 --- a/SAM/SAM.Weather/Query/LocationString.cs +++ b/SAM/SAM.Weather/Query/LocationString.cs @@ -1,4 +1,7 @@ -namespace SAM.Weather +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Weather { /// /// This class provides methods for creating and executing queries against a database. @@ -55,4 +58,4 @@ public static string LocationString(this WeatherData weatherData) return string.Join(",", values); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Weather/Query/MaxValue.cs b/SAM/SAM.Weather/Query/MaxValue.cs index 1063ac92d..628300318 100644 --- a/SAM/SAM.Weather/Query/MaxValue.cs +++ b/SAM/SAM.Weather/Query/MaxValue.cs @@ -1,4 +1,7 @@ -using System.Linq; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Linq; namespace SAM.Weather { @@ -28,4 +31,4 @@ public static double MaxValue(this WeatherDay weatherDay, WeatherDataType weathe return weatherDay.GetValues(weatherDataType).Max(); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Weather/Query/RunningMeanDryBulbTemperatures.cs b/SAM/SAM.Weather/Query/RunningMeanDryBulbTemperatures.cs index efe1f0ee0..5f11db47d 100644 --- a/SAM/SAM.Weather/Query/RunningMeanDryBulbTemperatures.cs +++ b/SAM/SAM.Weather/Query/RunningMeanDryBulbTemperatures.cs @@ -1,4 +1,7 @@ -using SAM.Core; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using SAM.Core; using System.Collections.Generic; using System.Linq; @@ -13,7 +16,7 @@ public static List RunningMeanDryBulbTemperatures(this WeatherYear weath public static List RunningMeanDryBulbTemperatures(this WeatherYear weatherYear, int startDayIndex, int endDayIndex) { - if(weatherYear == null) + if (weatherYear == null) { return null; } @@ -28,7 +31,7 @@ public static List RunningMeanDryBulbTemperatures(this IEnumerable(); } @@ -144,16 +147,16 @@ public static List RunningMeanDryBulbTemperatures(this IEnumerable endDayBoundedIndex) + if (startDayBoundedIndex > endDayBoundedIndex) { List runningMeanDryBulbTemperatures = new List(); - for(int i = startDayBoundedIndex; i < result.Count; i++) + for (int i = startDayBoundedIndex; i < result.Count; i++) { runningMeanDryBulbTemperatures.Add(result[i]); } - for(int i = 0; i < max; i++) + for (int i = 0; i < max; i++) { runningMeanDryBulbTemperatures.Add(result[i]); } @@ -166,4 +169,4 @@ public static List RunningMeanDryBulbTemperatures(this IEnumerable lines, int index return true; } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Weather/Query/TryGetLocationData.cs b/SAM/SAM.Weather/Query/TryGetLocationData.cs index ecd968657..0b8ed9a19 100644 --- a/SAM/SAM.Weather/Query/TryGetLocationData.cs +++ b/SAM/SAM.Weather/Query/TryGetLocationData.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; using System.Linq; namespace SAM.Weather diff --git a/SAM/SAM.Weather/Query/TryGetValue.cs b/SAM/SAM.Weather/Query/TryGetValue.cs index 730908efa..0206e61e4 100644 --- a/SAM/SAM.Weather/Query/TryGetValue.cs +++ b/SAM/SAM.Weather/Query/TryGetValue.cs @@ -1,4 +1,7 @@ -namespace SAM.Weather +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Weather { /// /// A static partial class that contains methods for querying weather data. @@ -54,7 +57,7 @@ public static bool TryGetValue(string text, string name, out string value) /// True if the value is retrieved successfully, false otherwise. public static bool TryGetValue(this WeatherDay weatherDay, WeatherDataType weatherDataType, int index, out double value) { - + value = default; if (weatherDay == null || weatherDataType == WeatherDataType.Undefined) { @@ -142,4 +145,4 @@ public static bool TryGetValue(this WeatherYear weatherYear, WeatherDataType wea return TryGetValue(weatherYear, weatherDataType.ToString(), index, out value); } } -} \ No newline at end of file +} diff --git a/SAM/SAM.Weather/Query/TypicalPeriodsString.cs b/SAM/SAM.Weather/Query/TypicalPeriodsString.cs index f88755172..88617fc4d 100644 --- a/SAM/SAM.Weather/Query/TypicalPeriodsString.cs +++ b/SAM/SAM.Weather/Query/TypicalPeriodsString.cs @@ -1,4 +1,7 @@ -namespace SAM.Weather +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +namespace SAM.Weather { /// /// The Query class provides static methods to query and manipulate WeatherData objects. diff --git a/SAM/SAM.Weather/Query/Values.cs b/SAM/SAM.Weather/Query/Values.cs index f75da9555..b4eda138b 100644 --- a/SAM/SAM.Weather/Query/Values.cs +++ b/SAM/SAM.Weather/Query/Values.cs @@ -1,4 +1,7 @@ -using System; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System; using System.Collections.Generic; namespace SAM.Weather diff --git a/SAM/SAM.Weather/Query/WeatherDays.cs b/SAM/SAM.Weather/Query/WeatherDays.cs index 812247330..54da0f4ef 100644 --- a/SAM/SAM.Weather/Query/WeatherDays.cs +++ b/SAM/SAM.Weather/Query/WeatherDays.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors + +using System.Collections.Generic; namespace SAM.Weather { From f2b60f584da6a1feca3432cb449a8bf9c4e81d14 Mon Sep 17 00:00:00 2001 From: Michal Dengusiak Date: Tue, 6 Jan 2026 12:52:38 +0100 Subject: [PATCH 08/15] Update spdx-check.yml --- .github/workflows/spdx-check.yml | 125 ++++++++++++++++++++----------- 1 file changed, 83 insertions(+), 42 deletions(-) diff --git a/.github/workflows/spdx-check.yml b/.github/workflows/spdx-check.yml index cf6429e89..a3925fae8 100644 --- a/.github/workflows/spdx-check.yml +++ b/.github/workflows/spdx-check.yml @@ -1,55 +1,96 @@ -- uses: actions/checkout@v4 - with: - fetch-depth: 0 +name: SPDX + Copyright header check -- name: Check SPDX + copyright header in changed .cs files - shell: bash - run: | - set -euo pipefail +on: + pull_request: - BASE="${{ github.event.pull_request.base.sha }}" - HEAD="${{ github.event.pull_request.head.sha }}" +jobs: + spdx: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: read + steps: + - name: Check SPDX + copyright header in changed .cs files + env: + GH_TOKEN: ${{ github.token }} + PR: ${{ github.event.pull_request.number }} + REPO: ${{ github.repository }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + shell: bash + run: | + set -euo pipefail - FILES=$(git diff --name-only "$BASE" "$HEAD" -- '*.cs' || true) + echo "Repo: $REPO" + echo "PR: $PR" + echo "Head SHA: $HEAD_SHA" + echo "" - if [ -z "$FILES" ]; then - echo "No C# files changed." - exit 0 - fi + mapfile -t files < <( + gh api "repos/$REPO/pulls/$PR/files" --paginate \ + --jq '.[] | .filename | select(endswith(".cs"))' + ) - missing=() + if [ "${#files[@]}" -eq 0 ]; then + echo "No C# files changed." + exit 0 + fi - # Regexes: - # - SPDX: exact identifier, but allow spaces - spdx_re='SPDX-License-Identifier:[[:space:]]*LGPL-3\.0-or-later' - # - Copyright: tolerate dash types and spaces, (c) case-insensitive - cr_re='Copyright[[:space:]]*\(c\)[[:space:]]*2020[[:space:]]*[-–—][[:space:]]*2026[[:space:]]*Michal[[:space:]]+Dengusiak[[:space:]]*&[[:space:]]*Jakub[[:space:]]+Ziolkowski[[:space:]]+and[[:space:]]+contributors' + echo "C# files changed in PR:" + printf ' - %s\n' "${files[@]}" + echo "" - while IFS= read -r f; do - echo "Checking: $f" + spdx_re='SPDX-License-Identifier:[[:space:]]*LGPL-3\.0-or-later' + cr_re='Copyright[[:space:]]*\(c\)[[:space:]]*2020[[:space:]]*[-–—][[:space:]]*2026[[:space:]]*Michal[[:space:]]+Dengusiak[[:space:]]*&[[:space:]]*Jakub[[:space:]]+Ziolkowski[[:space:]]+and[[:space:]]+contributors' - # Read from PR HEAD commit, normalize CRLF, and look at first 80 lines - headblock=$(git show "$HEAD:$f" 2>/dev/null | head -n 80 | tr -d '\r' || true) + missing=() - if [ -z "$headblock" ]; then - echo " Could not read file content from PR head." - missing+=("$f") - continue - fi + for f in "${files[@]}"; do + echo "Checking: $f" - echo "$headblock" | grep -Eiq "$spdx_re" || { echo " Missing SPDX line."; missing+=("$f"); continue; } - echo "$headblock" | grep -Eiq "$cr_re" || { echo " Missing copyright line."; missing+=("$f"); continue; } + # Skip entire Properties folders (typically generated / designer-managed code) + case "$f" in + */Properties/*) + echo " ⏭️ Skipping Properties/*" + continue + ;; + esac - done <<< "$FILES" + content_b64=$(gh api "repos/$REPO/contents/$f?ref=$HEAD_SHA" --jq '.content' 2>/dev/null || true) + if [ -z "$content_b64" ]; then + echo " ❌ Could not fetch file content (deleted? submodule? path issue)" + missing+=("$f (unreadable)") + continue + fi - if [ ${#missing[@]} -ne 0 ]; then - echo "❌ Missing required header in:" - for f in "${missing[@]}"; do echo " - $f"; done - echo "" - echo "Expected somewhere in first 80 lines:" - echo "// SPDX-License-Identifier: LGPL-3.0-or-later" - echo "// Copyright (c) 2020-2026 Michal Dengusiak & Jakub Ziolkowski and contributors" - exit 1 - fi + # Decode fully first (avoids SIGPIPE/broken pipe with pipefail), + # normalize CRLF, then take first 80 lines. + decoded=$(printf '%s' "$content_b64" | base64 -d) + headblock=$(printf '%s' "$decoded" | tr -d '\r' | sed -n '1,80p') - echo "✅ Headers OK." + if ! printf '%s' "$headblock" | grep -Eiq "$spdx_re"; then + echo " ❌ Missing SPDX line in first 80 lines" + missing+=("$f (SPDX)") + continue + fi + + if ! printf '%s' "$headblock" | grep -Eiq "$cr_re"; then + echo " ❌ Missing copyright line in first 80 lines" + missing+=("$f (Copyright)") + continue + fi + + echo " ✅ OK" + done + + echo "" + if [ "${#missing[@]}" -ne 0 ]; then + echo "❌ Missing required header in:" + printf ' - %s\n' "${missing[@]}" + echo "" + echo "Expected somewhere in first 80 lines:" + echo "// SPDX-License-Identifier: LGPL-3.0-or-later" + echo "// Copyright (c) 2020-2026 Michal Dengusiak & Jakub Ziolkowski and contributors" + exit 1 + fi + + echo "✅ SPDX + copyright headers OK." From 651218198b85a1aba630485247cd2abc4ceae050 Mon Sep 17 00:00:00 2001 From: Michal Dengusiak Date: Wed, 7 Jan 2026 16:03:38 +0100 Subject: [PATCH 09/15] CI implementation --- .github/workflows/build.yml | 89 +++++++++++++++++++++++++++++++++++++ README.md | 3 +- 2 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..f8b1c9ead --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,89 @@ +name: Build (Windows) + +on: + push: + branches: [ "master", "main" ] + pull_request: + branches: [ "master", "main" ] + workflow_dispatch: + +jobs: + build: + runs-on: windows-2022 + + strategy: + fail-fast: false + matrix: + configuration: [ "Release" ] + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: recursive + + - name: Setup .NET 8 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "8.x" + + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v2 + + - name: Pick build target + id: pick + shell: pwsh + run: | + $ErrorActionPreference = 'Stop' + + if (Test-Path ".\BuildAll_Release_net.csproj") { + "target=BuildAll_Release_net.csproj" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 + "kind=csproj" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 + Write-Host "Selected: BuildAll_Release_net.csproj" + exit 0 + } + + $sln = Get-ChildItem -Path . -Filter *.sln -File | Select-Object -First 1 + if ($sln) { + "target=$($sln.Name)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 + "kind=sln" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 + Write-Host "Selected: $($sln.Name)" + exit 0 + } + + $csproj = Get-ChildItem -Path . -Filter *.csproj -File | Select-Object -First 1 + if ($csproj) { + "target=$($csproj.Name)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 + "kind=csproj" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 + Write-Host "Selected: $($csproj.Name)" + exit 0 + } + + throw "No BuildAll_Release_net.csproj, .sln, or root .csproj found to build." + + - name: Restore + shell: pwsh + env: + MSBUILDDISABLENODEREUSE: "1" + run: | + $ErrorActionPreference = 'Stop' + $t = '${{ steps.pick.outputs.target }}' + msbuild $t ` + /t:Restore ` + /m:1 /nr:false /v:m ` + /p:Configuration=${{ matrix.configuration }} ` + /p:UseSharedCompilation=false + + - name: Build + shell: pwsh + env: + MSBUILDDISABLENODEREUSE: "1" + run: | + $ErrorActionPreference = 'Stop' + $t = '${{ steps.pick.outputs.target }}' + msbuild $t ` + /t:Rebuild ` + /m:1 /nr:false /v:m ` + /p:Configuration=${{ matrix.configuration }} ` + /p:UseSharedCompilation=false diff --git a/README.md b/README.md index acc75cfc1..a1a489e93 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # SAM -[![Build Status](https://hldigitalinnovation.visualstudio.com/HLApps/_apis/build/status/SAM-Deploy-SAM?branchName=master)](https://hldigitalinnovation.visualstudio.com/HLApps/_build/latest?definitionId=18&branchName=master) +[![Build (Windows)](https://github.com/SAM-BIM//actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/SAM-BIM//actions/workflows/build.yml) +

    SAM Logo From bf1cf7ff46c6fab5ab49e51330c1d652ea7929c0 Mon Sep 17 00:00:00 2001 From: Michal Dengusiak Date: Wed, 7 Jan 2026 16:06:37 +0100 Subject: [PATCH 10/15] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a1a489e93..39dafee98 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # SAM -[![Build (Windows)](https://github.com/SAM-BIM//actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/SAM-BIM//actions/workflows/build.yml) +[![Build (Windows)](https://github.com/SAM-BIM/SAM/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/SAM-BIM/SAM/actions/workflows/build.yml)

    From 8f25e2401e6aa0a7b31625c17c0468408cfc36a4 Mon Sep 17 00:00:00 2001 From: Michal Dengusiak Date: Wed, 7 Jan 2026 16:23:31 +0100 Subject: [PATCH 11/15] add if protection --- .github/workflows/build.yml | 58 ++++++++++--------------------------- README.md | 2 +- 2 files changed, 16 insertions(+), 44 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f8b1c9ead..3a4a7c308 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,6 +9,9 @@ on: jobs: build: + # Guard: run CI only in SAM-BIM org (prevents breaking upstream ) + if: github.repository_owner == 'SAM-BIM' + runs-on: windows-2022 strategy: @@ -31,49 +34,18 @@ jobs: - name: Setup MSBuild uses: microsoft/setup-msbuild@v2 - - name: Pick build target - id: pick - shell: pwsh - run: | - $ErrorActionPreference = 'Stop' - - if (Test-Path ".\BuildAll_Release_net.csproj") { - "target=BuildAll_Release_net.csproj" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 - "kind=csproj" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 - Write-Host "Selected: BuildAll_Release_net.csproj" - exit 0 - } - - $sln = Get-ChildItem -Path . -Filter *.sln -File | Select-Object -First 1 - if ($sln) { - "target=$($sln.Name)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 - "kind=sln" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 - Write-Host "Selected: $($sln.Name)" - exit 0 - } - - $csproj = Get-ChildItem -Path . -Filter *.csproj -File | Select-Object -First 1 - if ($csproj) { - "target=$($csproj.Name)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 - "kind=csproj" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 - Write-Host "Selected: $($csproj.Name)" - exit 0 - } - - throw "No BuildAll_Release_net.csproj, .sln, or root .csproj found to build." - - name: Restore shell: pwsh env: MSBUILDDISABLENODEREUSE: "1" run: | $ErrorActionPreference = 'Stop' - $t = '${{ steps.pick.outputs.target }}' - msbuild $t ` - /t:Restore ` - /m:1 /nr:false /v:m ` - /p:Configuration=${{ matrix.configuration }} ` - /p:UseSharedCompilation=false + msbuild ` + '.\BuildAll_Release_net.csproj' ` + '/t:Restore' ` + '/m:1' '/nr:false' '/v:m' ` + "/p:Configuration=${{ matrix.configuration }}" ` + '/p:UseSharedCompilation=false' - name: Build shell: pwsh @@ -81,9 +53,9 @@ jobs: MSBUILDDISABLENODEREUSE: "1" run: | $ErrorActionPreference = 'Stop' - $t = '${{ steps.pick.outputs.target }}' - msbuild $t ` - /t:Rebuild ` - /m:1 /nr:false /v:m ` - /p:Configuration=${{ matrix.configuration }} ` - /p:UseSharedCompilation=false + msbuild ` + '.\BuildAll_Release_net.csproj' ` + '/t:Rebuild' ` + '/m:1' '/nr:false' '/v:m' ` + "/p:Configuration=${{ matrix.configuration }}" ` + '/p:UseSharedCompilation=false' diff --git a/README.md b/README.md index 39dafee98..26f155bcd 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # SAM [![Build (Windows)](https://github.com/SAM-BIM/SAM/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/SAM-BIM/SAM/actions/workflows/build.yml) - +[![Latest Release](https://img.shields.io/github/v/release/SAM-BIM/SAM?label=latest%20release)](https://github.com/SAM-BIM/SAM/releases/latest)

    SAM Logo From d2cd9fb26de28532187dab172e24df1800922f2b Mon Sep 17 00:00:00 2001 From: Michal Dengusiak Date: Wed, 7 Jan 2026 16:52:37 +0100 Subject: [PATCH 12/15] Revert "add if protection" This reverts commit 8f25e2401e6aa0a7b31625c17c0468408cfc36a4. --- .github/workflows/build.yml | 58 +++++++++++++++++++++++++++---------- README.md | 2 +- 2 files changed, 44 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3a4a7c308..f8b1c9ead 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,9 +9,6 @@ on: jobs: build: - # Guard: run CI only in SAM-BIM org (prevents breaking upstream ) - if: github.repository_owner == 'SAM-BIM' - runs-on: windows-2022 strategy: @@ -34,18 +31,49 @@ jobs: - name: Setup MSBuild uses: microsoft/setup-msbuild@v2 + - name: Pick build target + id: pick + shell: pwsh + run: | + $ErrorActionPreference = 'Stop' + + if (Test-Path ".\BuildAll_Release_net.csproj") { + "target=BuildAll_Release_net.csproj" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 + "kind=csproj" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 + Write-Host "Selected: BuildAll_Release_net.csproj" + exit 0 + } + + $sln = Get-ChildItem -Path . -Filter *.sln -File | Select-Object -First 1 + if ($sln) { + "target=$($sln.Name)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 + "kind=sln" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 + Write-Host "Selected: $($sln.Name)" + exit 0 + } + + $csproj = Get-ChildItem -Path . -Filter *.csproj -File | Select-Object -First 1 + if ($csproj) { + "target=$($csproj.Name)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 + "kind=csproj" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 + Write-Host "Selected: $($csproj.Name)" + exit 0 + } + + throw "No BuildAll_Release_net.csproj, .sln, or root .csproj found to build." + - name: Restore shell: pwsh env: MSBUILDDISABLENODEREUSE: "1" run: | $ErrorActionPreference = 'Stop' - msbuild ` - '.\BuildAll_Release_net.csproj' ` - '/t:Restore' ` - '/m:1' '/nr:false' '/v:m' ` - "/p:Configuration=${{ matrix.configuration }}" ` - '/p:UseSharedCompilation=false' + $t = '${{ steps.pick.outputs.target }}' + msbuild $t ` + /t:Restore ` + /m:1 /nr:false /v:m ` + /p:Configuration=${{ matrix.configuration }} ` + /p:UseSharedCompilation=false - name: Build shell: pwsh @@ -53,9 +81,9 @@ jobs: MSBUILDDISABLENODEREUSE: "1" run: | $ErrorActionPreference = 'Stop' - msbuild ` - '.\BuildAll_Release_net.csproj' ` - '/t:Rebuild' ` - '/m:1' '/nr:false' '/v:m' ` - "/p:Configuration=${{ matrix.configuration }}" ` - '/p:UseSharedCompilation=false' + $t = '${{ steps.pick.outputs.target }}' + msbuild $t ` + /t:Rebuild ` + /m:1 /nr:false /v:m ` + /p:Configuration=${{ matrix.configuration }} ` + /p:UseSharedCompilation=false diff --git a/README.md b/README.md index 26f155bcd..39dafee98 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # SAM [![Build (Windows)](https://github.com/SAM-BIM/SAM/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/SAM-BIM/SAM/actions/workflows/build.yml) -[![Latest Release](https://img.shields.io/github/v/release/SAM-BIM/SAM?label=latest%20release)](https://github.com/SAM-BIM/SAM/releases/latest) +

    SAM Logo From 93161b46e5ef2ca8288c0e7a22018ec1728557c6 Mon Sep 17 00:00:00 2001 From: Michal Dengusiak Date: Wed, 7 Jan 2026 17:08:02 +0100 Subject: [PATCH 13/15] adjust workflow --- .github/workflows/build.yml | 28 ++++++++++------------------ README.md | 1 + 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f8b1c9ead..52d7c6b45 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,6 +9,8 @@ on: jobs: build: + # Runs only on SAM-BIM repos (won't break upstream if merged elsewhere) + if: github.repository_owner == 'SAM-BIM' runs-on: windows-2022 strategy: @@ -21,7 +23,8 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - submodules: recursive + # Set to "recursive" only if THIS repo actually uses submodules + submodules: false - name: Setup .NET 8 uses: actions/setup-dotnet@v4 @@ -31,36 +34,27 @@ jobs: - name: Setup MSBuild uses: microsoft/setup-msbuild@v2 - - name: Pick build target + - name: Pick build target (.sln or .csproj) id: pick shell: pwsh run: | $ErrorActionPreference = 'Stop' - if (Test-Path ".\BuildAll_Release_net.csproj") { - "target=BuildAll_Release_net.csproj" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 - "kind=csproj" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 - Write-Host "Selected: BuildAll_Release_net.csproj" - exit 0 - } - $sln = Get-ChildItem -Path . -Filter *.sln -File | Select-Object -First 1 if ($sln) { "target=$($sln.Name)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 - "kind=sln" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 - Write-Host "Selected: $($sln.Name)" + Write-Host "Selected solution: $($sln.Name)" exit 0 } $csproj = Get-ChildItem -Path . -Filter *.csproj -File | Select-Object -First 1 if ($csproj) { "target=$($csproj.Name)" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 - "kind=csproj" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 - Write-Host "Selected: $($csproj.Name)" + Write-Host "Selected project: $($csproj.Name)" exit 0 } - throw "No BuildAll_Release_net.csproj, .sln, or root .csproj found to build." + throw "No root .sln or root .csproj found to build." - name: Restore shell: pwsh @@ -68,8 +62,7 @@ jobs: MSBUILDDISABLENODEREUSE: "1" run: | $ErrorActionPreference = 'Stop' - $t = '${{ steps.pick.outputs.target }}' - msbuild $t ` + msbuild '${{ steps.pick.outputs.target }}' ` /t:Restore ` /m:1 /nr:false /v:m ` /p:Configuration=${{ matrix.configuration }} ` @@ -81,8 +74,7 @@ jobs: MSBUILDDISABLENODEREUSE: "1" run: | $ErrorActionPreference = 'Stop' - $t = '${{ steps.pick.outputs.target }}' - msbuild $t ` + msbuild '${{ steps.pick.outputs.target }}' ` /t:Rebuild ` /m:1 /nr:false /v:m ` /p:Configuration=${{ matrix.configuration }} ` diff --git a/README.md b/README.md index 39dafee98..5813c4559 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # SAM [![Build (Windows)](https://github.com/SAM-BIM/SAM/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/SAM-BIM/SAM/actions/workflows/build.yml) +[![Installer (latest)](https://img.shields.io/github/v/release/SAM-BIM/SAM_Deploy?label=installer)](https://github.com/SAM-BIM/SAM_Deploy/releases/latest)

    From 9dcbb124fe627db6a33ad2ea3b6a6205a67db3c9 Mon Sep 17 00:00:00 2001 From: Michal Dengusiak Date: Thu, 8 Jan 2026 17:31:22 +0100 Subject: [PATCH 14/15] standard SAM-BIM legal files --- .github/workflows/build.yml | 2 +- COPYRIGHT_HEADER.txt | 23 ++--------------------- NOTICE | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 22 deletions(-) create mode 100644 NOTICE diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 52d7c6b45..4319aab51 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - # Set to "recursive" only if THIS repo actually uses submodules + # Set to "recursive" only if THIS repo actually uses submodules otherwise "false" submodules: false - name: Setup .NET 8 diff --git a/COPYRIGHT_HEADER.txt b/COPYRIGHT_HEADER.txt index 342f025ab..e645f121f 100644 --- a/COPYRIGHT_HEADER.txt +++ b/COPYRIGHT_HEADER.txt @@ -1,21 +1,2 @@ -/* - * This file is part of the Sustainable Analytical Model (SAM) - * Copyright (c) 2020 - 2021, the respective contributors. All rights reserved. - * - * Each contributor holds copyright over their respective contributions. - * The project versioning (Git) records all such contribution source information. - * - * - * The SAM is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3.0 of the License, or - * (at your option) any later version. - * - * The SAM is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this code. If not, see . - */ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (c) 2020-2026 Michal Dengusiak & Jakub Ziolkowski and contributors \ No newline at end of file diff --git a/NOTICE b/NOTICE new file mode 100644 index 000000000..22b0be5d9 --- /dev/null +++ b/NOTICE @@ -0,0 +1,19 @@ +SAM-BIM — Sustainable Analytical Model (SAM) + +Copyright © 2020–2026 +Michal Dengusiak & Jakub Ziolkowski and contributors + +This repository is part of the SAM (Sustainable Analytical Model) toolkit. + +License +This project is licensed under the GNU Lesser General Public License +v3.0 or later (LGPL-3.0-or-later). See the LICENSE file for details. + +Attribution and third-party software +Each contributor retains copyright to their respective contributions. +The project history (Git) records authorship and provenance of all changes. + +This repository may include or depend on third-party open-source components. +Where applicable, third-party notices and license information are provided in: +- THIRD_PARTY.md (if present) +- LICENSE (and any license files within third-party source folders) From 0ff4b3b7658c2572ac59d61b0122738cc0faa2d8 Mon Sep 17 00:00:00 2001 From: Michal Dengusiak Date: Sat, 10 Jan 2026 22:13:34 +0100 Subject: [PATCH 15/15] update readme and repo hygiene updates --- .github/CODEOWNERS | 30 ++---- .github/PULL_REQUEST_TEMPLATE.md | 22 +--- .github/workflows/spdx-check.yml | 89 ++++------------ README.md | 176 +++++++++++++++---------------- 4 files changed, 116 insertions(+), 201 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 764072316..27c85b094 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,28 +1,10 @@ -# Lines starting with '#' are comments. -# Each line is a file pattern followed by one or more owners. +# CODEOWNERS +# SAM-BIM – repository ownership definition # https://github.blog/2017-07-06-introducing-code-owners/ -# SAM REPO CODEOWNERS - -# default global -# These owners will be the default owners for everything in the repo - +# Default owners for the entire repository * @michaldengusiak @ZiolkowskiJakub - -# project owners -# Order is important. The last matching pattern has the most precedence. -# So if a pull request only touches javascript files, only these owners -# will be requested to review. - -/SAM @michaldengusiak @ZiolkowskiJakub -/SAM_BHoM @michaldengusiak @ZiolkowskiJakub -/SAM_Excel @michaldengusiak @ZiolkowskiJakub -/SAM_LadybugTools @michaldengusiak @ZiolkowskiJakub -/SAM_Revit @michaldengusiak @ZiolkowskiJakub -/SAM_Tas @michaldengusiak @ZiolkowskiJakub -/SAM_Topologic @michaldengusiak @ZiolkowskiJakub -/SAM_UI @michaldengusiak @ZiolkowskiJakub - - -# You can also use email addresses if you prefer. \ No newline at end of file +# Governance & workflow files (always require both owners) + /CODEOWNERS @michaldengusiak @ZiolkowskiJakub + /.github/ @michaldengusiak @ZiolkowskiJakub \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 597e85300..d4a4c353f 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,19 +1,5 @@ -### NOTE: Depends on - - +### Summary +What is delivered and why (1–3 sentences). - -### Issues addressed by this PR - - -Fixes # - - - - -### Test files - - - -### Additional comments - \ No newline at end of file +### Validation +How to verify or test the change. diff --git a/.github/workflows/spdx-check.yml b/.github/workflows/spdx-check.yml index a3925fae8..269d562ee 100644 --- a/.github/workflows/spdx-check.yml +++ b/.github/workflows/spdx-check.yml @@ -6,90 +6,39 @@ on: jobs: spdx: runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: read steps: - - name: Check SPDX + copyright header in changed .cs files - env: - GH_TOKEN: ${{ github.token }} - PR: ${{ github.event.pull_request.number }} - REPO: ${{ github.repository }} - HEAD_SHA: ${{ github.event.pull_request.head.sha }} - shell: bash - run: | - set -euo pipefail + - uses: actions/checkout@v4 + with: + fetch-depth: 0 - echo "Repo: $REPO" - echo "PR: $PR" - echo "Head SHA: $HEAD_SHA" - echo "" + - name: Check header in changed .cs files + run: | + set -e + BASE="${{ github.event.pull_request.base.sha }}" + HEAD="${{ github.event.pull_request.head.sha }}" - mapfile -t files < <( - gh api "repos/$REPO/pulls/$PR/files" --paginate \ - --jq '.[] | .filename | select(endswith(".cs"))' - ) + FILES=$(git diff --name-only "$BASE" "$HEAD" -- '*.cs' || true) - if [ "${#files[@]}" -eq 0 ]; then + if [ -z "$FILES" ]; then echo "No C# files changed." exit 0 fi - echo "C# files changed in PR:" - printf ' - %s\n' "${files[@]}" - echo "" - - spdx_re='SPDX-License-Identifier:[[:space:]]*LGPL-3\.0-or-later' - cr_re='Copyright[[:space:]]*\(c\)[[:space:]]*2020[[:space:]]*[-–—][[:space:]]*2026[[:space:]]*Michal[[:space:]]+Dengusiak[[:space:]]*&[[:space:]]*Jakub[[:space:]]+Ziolkowski[[:space:]]+and[[:space:]]+contributors' - - missing=() - - for f in "${files[@]}"; do - echo "Checking: $f" - - # Skip entire Properties folders (typically generated / designer-managed code) - case "$f" in - */Properties/*) - echo " ⏭️ Skipping Properties/*" - continue - ;; - esac - - content_b64=$(gh api "repos/$REPO/contents/$f?ref=$HEAD_SHA" --jq '.content' 2>/dev/null || true) - if [ -z "$content_b64" ]; then - echo " ❌ Could not fetch file content (deleted? submodule? path issue)" - missing+=("$f (unreadable)") - continue - fi - - # Decode fully first (avoids SIGPIPE/broken pipe with pipefail), - # normalize CRLF, then take first 80 lines. - decoded=$(printf '%s' "$content_b64" | base64 -d) - headblock=$(printf '%s' "$decoded" | tr -d '\r' | sed -n '1,80p') - - if ! printf '%s' "$headblock" | grep -Eiq "$spdx_re"; then - echo " ❌ Missing SPDX line in first 80 lines" - missing+=("$f (SPDX)") - continue - fi - - if ! printf '%s' "$headblock" | grep -Eiq "$cr_re"; then - echo " ❌ Missing copyright line in first 80 lines" - missing+=("$f (Copyright)") - continue - fi + MISSING="" + for f in $FILES; do + HEADBLOCK=$(head -n 6 "$f") - echo " ✅ OK" + echo "$HEADBLOCK" | grep -q "// SPDX-License-Identifier: LGPL-3.0-or-later" || MISSING="$MISSING $f" + echo "$HEADBLOCK" | grep -q "// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors" || MISSING="$MISSING $f" done - echo "" - if [ "${#missing[@]}" -ne 0 ]; then + if [ -n "$MISSING" ]; then echo "❌ Missing required header in:" - printf ' - %s\n' "${missing[@]}" + for f in $MISSING; do echo " - $f"; done echo "" - echo "Expected somewhere in first 80 lines:" + echo "Each changed .cs file must start with:" echo "// SPDX-License-Identifier: LGPL-3.0-or-later" - echo "// Copyright (c) 2020-2026 Michal Dengusiak & Jakub Ziolkowski and contributors" + echo "// Copyright (c) 2020–2026 Michal Dengusiak & Jakub Ziolkowski and contributors" exit 1 fi diff --git a/README.md b/README.md index 5813c4559..5e4981a31 100644 --- a/README.md +++ b/README.md @@ -1,93 +1,91 @@ -# SAM - [![Build (Windows)](https://github.com/SAM-BIM/SAM/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/SAM-BIM/SAM/actions/workflows/build.yml) [![Installer (latest)](https://img.shields.io/github/v/release/SAM-BIM/SAM_Deploy?label=installer)](https://github.com/SAM-BIM/SAM_Deploy/releases/latest) +# SAM + + + + + +**SAM (Sustainable Analytical Model)** is the core of the **SAM Toolkit** — +an open-source platform designed to help engineers create, manage, +and analyse analytical building models for energy and environmental performance. + +SAM provides a structured analytical representation of buildings, +supporting workflows for energy modelling, systems analysis, +environmental simulation, and performance-driven design. + +It is designed as a **modular and extensible platform**: +core analytical concepts are implemented in this repository, +with additional functionality provided through specialised SAM modules +and integrations. + +--- + +## What SAM provides + +At its core, SAM enables: + +- creation and management of analytical building models +- assignment of constructions, loads, and system definitions +- preparation of models for simulation and analysis +- orchestration of analytical workflows and scenarios +- integration with external tools and simulation engines + +SAM supports both **programmatic** and **visual** workflows, +including integration with environments such as **Grasshopper**, **Rhino**, and **Revit**. + +--- + +## Extensibility + +The SAM platform is intentionally modular. +Additional repositories provide functionality such as: + +- simulation engine integrations (e.g. Tas, OpenStudio) +- data exchange formats (IFC, gbXML, GEM) +- environmental and physical calculations (psychrometrics, solar, acoustics) +- UI layers and scripting interfaces (Windows UI, Rhino, Python) +- experimental and research workflows + +The full ecosystem, module descriptions, and relationships +are documented in the **SAM Wiki**. + +--- + +## Getting started + +To install **SAM**, download and run the +[latest Windows installer](https://github.com/SAM-BIM/SAM_Deploy/releases/latest). + +Alternatively, the toolkit can be built from source using Visual Studio. +See the documentation in the **SAM Wiki** for setup guidance and build details. + +--- + +## Documentation + +📘 **SAM Wiki:** +https://github.com/SAM-BIM/SAM/wiki + +The Wiki contains: +- module overviews and relationships +- build and dependency information +- workflow examples +- developer and contributor guidance + +--- + +## Licence + +This repository is free software licensed under the +**GNU Lesser General Public License v3.0 or later (LGPL-3.0-or-later)**. + +Each contributor retains copyright to their respective contributions. +The project history (Git) records authorship and provenance of all changes. -

    - SAM Logo -

    - -**Sustainable Analytical Model (SAM)** is an open-source software designed to help engineers create analytical models of energy-efficient buildings. It enables the creation and analysis of energy models of buildings, including heating, cooling, ventilation, and lighting. - -SAM allows users to create energy models in a variety of ways, including importing building geometry from common architectural software such as Revit or gbXML, manually inputting building geometry, or generating geometry using SAM's built-in tools. Once the geometry is defined, users can assign construction properties, internal loads, and system configurations to the model. - -SAM uses an energy simulation engine to predict the energy performance of the building. The simulation results can be used to compare different design scenarios, assess compliance with building codes and standards, and evaluate the effectiveness of energy-saving strategies. - -SAM also includes several tools for post-processing and visualizing the simulation results. Users can view the results in various formats, including graphs, tables, and 3D models, and export the data for further analysis. - -SAM is designed to be extensible, and users can add new features and functionalities by developing custom plugins. It is integrated with several third-party tools and frameworks, including Ladybug Tools, BHoM, and Topologic, which enhance its capabilities and enable more advanced workflows. - -## Getting Started - -To install **SAM**, download and run the latest installer from the [releases](https://github.com/HoareLea/SAM_Deploy/releases) page or rebuild using Visual Studio from the [SAM repository](https://github.com/HoareLea/SAM). - -## Contributing - -We welcome contributions from anyone who would like to help improve SAM. For more information on how to contribute, please see the [contributing guidelines](CONTRIBUTING.md). - -## Resources - -For more information about SAM, please visit our [wiki](https://github.com/HoareLea/SAM/wiki). - -## License - -SAM is free software licensed under the GNU Lesser General Public License. Each contributor holds a copyright over their respective contributions. The project versioning (Git) records all such contribution source information. See [LICENSE](https://github.com/HoareLea/SAM_gbXML/blob/master/LICENSE) and [COPYRIGHT_HEADER](https://github.com/HoareLea/SAM/blob/master/COPYRIGHT_HEADER.txt) for more details. - -## Included Repositories that link with SAM - -1. https://github.com/HoareLea/SAM -2. https://github.com/HoareLea/SAM_BHoM -3. https://github.com/HoareLea/SAM_Excel -4. https://github.com/HoareLea/SAM_gbXML -5. https://github.com/HoareLea/SAM_GEM -6. https://github.com/HoareLea/SAM_IFC -7. https://github.com/HoareLea/SAM_LadybugTools -8. https://github.com/HoareLea/SAM_Mollier -9. https://github.com/HoareLea/SAM_OpenStudio -10. https://github.com/HoareLea/SAM_Psychrometrics -11. https://github.com/HoareLea/SAM_Revit -12. https://github.com/HoareLea/SAM_Revit_UI -12. https://github.com/HoareLea/SAM_Rhino_UI -14. https://github.com/HoareLea/SAM_SQLite -15. https://github.com/HoareLea/SAM_SolarCalculator -16. https://github.com/HoareLea/SAM_Systems -17. https://github.com/HoareLea/SAM_Tas -18. https://github.com/HoareLea/SAM_Topologic -19. https://github.com/HoareLea/SAM_UI -20. https://github.com/HoareLea/SAM_Windows - - -## Build order - -1. SAM.sln -2. SAM_Systems -3. SAM_Psychrometrics.sln -4. SAM_Mollier.sln -5. SAM_Windows.sln -6. SAM_IFC -7. SAM_Topologic.sln -8. SAM_Acoustic.sln -9. SAM_BHom.sln -10. SAM_gbXML.sln -11. SAM_GEM.sln -12. SAM_LadybugTools.sln -13. SAM_Solver.sln -14. SAM_SolarCalculator.sln -15. SAM_Tas.sln -16. SAM_Excel.sln -17. SAM_SQLite.sln -18. SAM_OpenStudio.sln -19. SAM_Origin.sln -20. SAM_Revit.sln (Release2020) -21. SAM_Revit.sln (Release2021) -22. SAM_Revit.sln (Release2022) -23. SAM_Revit.sln (Release2023) -24. SAM_Revit.sln (Release2024) -25. SAM_UI.sln -26. SAM_Rhino_UI.sln -27. SAM_Revit_UI.sln (Release2020) -28. SAM_Revit_UI.sln (Release2021) -29. SAM_Revit_UI.sln (Release2022) -30. SAM_Revit_UI.sln (Release2023) -31. SAM_Revit_UI.sln (Release2024) +See: +- `LICENSE` +- `NOTICE` +- `COPYRIGHT_HEADER.txt`