Skip to content

Commit e198ddc

Browse files
authored
Merge pull request #13 from nasa-jpl/bugfixes-2026-03
Bugfixes 2026 03
2 parents 203b4c8 + 090bde9 commit e198ddc

16 files changed

+6298
-1228
lines changed

RockCollect/Form1.Designer.cs

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RockCollect/Form1.resx

Lines changed: 3037 additions & 0 deletions
Large diffs are not rendered by default.

RockCollect/RockCollect.csproj

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<NuGetPackageImportStamp>
1616
</NuGetPackageImportStamp>
1717
<IsWebBootstrapper>false</IsWebBootstrapper>
18+
<ApplicationIcon>rosco.ico</ApplicationIcon>
1819
<PublishUrl>publish\</PublishUrl>
1920
<Install>true</Install>
2021
<InstallFrom>Disk</InstallFrom>
@@ -271,7 +272,9 @@
271272
</ItemGroup>
272273
<ItemGroup>
273274
<Content Include="GdalConfiguration.vb" />
274-
<Content Include="rosco.png" />
275+
</ItemGroup>
276+
<ItemGroup>
277+
<None Include="rosco.ico" />
275278
</ItemGroup>
276279
<ItemGroup>
277280
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">
@@ -293,4 +296,4 @@
293296
</PropertyGroup>
294297
<Error Condition="!Exists('packages\GDAL.Native.2.4.4\build\net40\GDAL.Native.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\GDAL.Native.2.4.4\build\net40\GDAL.Native.targets'))" />
295298
</Target>
296-
</Project>
299+
</Project>

RockCollect/RockDetector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class RockDetector
1616
static public readonly float SHADOW_SPLIT_RATIO = 0.5f;
1717
public const int TILESIZE = 550;
1818

19-
static public readonly float MIN_VALID_GSD = 0;
19+
static public readonly float MIN_VALID_GSD = 0.001f;
2020
static public readonly float MAX_VALID_GSD = 100;
2121

2222
static public readonly float MIN_VALID_AZIMUTH = 0;

RockCollect/Stages/ChooseImage.cs

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,32 @@ public void SetGroundSamplingDistance(float metersPerPixel)
6767
{
6868
GroundSamplingDistance = metersPerPixel;
6969
}
70+
71+
public float GetGroundSamplingDistance()
72+
{
73+
return GroundSamplingDistance;
74+
}
75+
7076
public void SetSubSolarAzimuth(float subsolarAzimuthDegrees)
7177
{
7278
SubSolarAzimuthDegrees = subsolarAzimuthDegrees;
7379
}
7480

81+
public float GetSubSolarAzimuth()
82+
{
83+
return SubSolarAzimuthDegrees;
84+
}
85+
7586
public void SetSolarIncidence(float solarIncidenceDegrees)
7687
{
7788
SolarIncidenceDegrees = solarIncidenceDegrees;
7889
}
7990

91+
public float GetSolarIncidence()
92+
{
93+
return SolarIncidenceDegrees;
94+
}
95+
8096
public void SetComparisonRocklist(string rocklistPath)
8197
{
8298
ComparisonRocklistPath = rocklistPath;
@@ -91,5 +107,52 @@ public void SetShapeFile(string path)
91107
{
92108
ShapeFilePath = path;
93109
}
110+
111+
public override bool Deactivate(bool forward)
112+
{
113+
string msg = null;
114+
if (string.IsNullOrEmpty(ImagePath))
115+
{
116+
msg = "No image file selected.";
117+
}
118+
else if (!File.Exists(ImagePath))
119+
{
120+
msg = string.Format("Image \"{0}\" not found.", ImagePath);
121+
}
122+
else if (!string.IsNullOrEmpty(ShapeFilePath) && !File.Exists(ShapeFilePath))
123+
{
124+
msg = string.Format("Shape file \"{0}\" not found.", ShapeFilePath);
125+
}
126+
else if (!string.IsNullOrEmpty(ComparisonRocklistPath) && !File.Exists(ComparisonRocklistPath))
127+
{
128+
msg = string.Format("Comparison rock list \"{0}\" not found.", ComparisonRocklistPath);
129+
}
130+
else if (GroundSamplingDistance < RockDetector.MIN_VALID_GSD ||
131+
GroundSamplingDistance > RockDetector.MAX_VALID_GSD)
132+
{
133+
msg = string.Format("Ground sampling distance {0} not in range {1} to {2}.", GroundSamplingDistance,
134+
RockDetector.MIN_VALID_GSD, RockDetector.MAX_VALID_GSD);
135+
}
136+
else if (SubSolarAzimuthDegrees < RockDetector.MIN_VALID_AZIMUTH ||
137+
SubSolarAzimuthDegrees > RockDetector.MAX_VALID_AZIMUTH)
138+
{
139+
msg = string.Format("Sub-solar azimuth angle {0} not in range {1} to {2}.", SubSolarAzimuthDegrees,
140+
RockDetector.MIN_VALID_AZIMUTH, RockDetector.MAX_VALID_AZIMUTH);
141+
}
142+
else if (SolarIncidenceDegrees < RockDetector.MIN_VALID_INCIDENCE ||
143+
SolarIncidenceDegrees > RockDetector.MAX_VALID_INCIDENCE)
144+
{
145+
msg = string.Format("Solar incidence angle {0} not in range {1} to {2}.", SolarIncidenceDegrees,
146+
RockDetector.MIN_VALID_INCIDENCE, RockDetector.MAX_VALID_INCIDENCE);
147+
}
148+
149+
if (msg != null)
150+
{
151+
MessageBox.Show(msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
152+
return false;
153+
}
154+
155+
return base.Deactivate(forward);
156+
}
94157
}
95158
}

RockCollect/Stages/ChooseImageUI.Designer.cs

Lines changed: 3 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RockCollect/Stages/ChooseImageUI.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ private void buttonAutoFillFromComparisonRocklist_Click(object sender, EventArgs
144144
numericGSD.Value = (decimal)rocklist.paramList.GSD_resolution;
145145
numericIncidence.Value = (decimal)rocklist.paramList.sun_incidence_angle;
146146
numericAzimuth.Value = (decimal)rocklist.paramList.sun_azimuth_angle;
147+
Stage.SetGroundSamplingDistance(rocklist.paramList.GSD_resolution);
148+
Stage.SetSolarIncidence(rocklist.paramList.sun_incidence_angle);
149+
Stage.SetSubSolarAzimuth(rocklist.paramList.sun_azimuth_angle);
147150
}
148151
catch
149152
{
@@ -288,6 +291,10 @@ private void buttonAutoFillFromEDRIndex_Click(object sender, EventArgs e)
288291
numericGSD.Value = (decimal)gsd;
289292
numericIncidence.Value = (decimal)incidence;
290293
numericAzimuth.Value = (decimal)azimuth;
294+
295+
Stage.SetGroundSamplingDistance(gsd);
296+
Stage.SetSolarIncidence(incidence);
297+
Stage.SetSubSolarAzimuth(azimuth);
291298
}
292299

293300
private void buttonShapeFile_Click(object sender, EventArgs e)

0 commit comments

Comments
 (0)