-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added initial interfaces and implementations for processors after the…
- Loading branch information
1 parent
f8d8687
commit b8bcdd5
Showing
4 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
using USACE.HEC.Geography; | ||
|
||
namespace USACE.HEC.Consequences; | ||
public interface IBBoxStreamingProcessor | ||
{ | ||
public void Process(BoundingBox boundingBox, Action<IConsequencesReceptor> consequenceReceptorProcess); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using USACE.HEC.Geography; | ||
|
||
namespace USACE.HEC.Consequences; | ||
public class NSIStreamingProcessor : IBBoxStreamingProcessor | ||
{ | ||
public void Process(BoundingBox boundingBox, Action<IConsequencesReceptor> ConsequenceReceptorProcess) | ||
{ | ||
Structure s = new Structure(); | ||
ConsequenceReceptorProcess(s); | ||
} | ||
|
||
|
||
|
||
/* | ||
static async Task Test() | ||
{ | ||
// Define the API endpoint | ||
string apiEndpoint = "https://nsi.sec.usace.army.mil/nsiapi/structures?bbox=-81.58418,30.25165,-81.58161,30.26939,-81.55898,30.26939,-81.55281,30.24998,-81.58418,30.25165"; | ||
// Create an instance of HttpClient | ||
using (HttpClient client = new HttpClient()) | ||
{ | ||
try | ||
{ | ||
// Make the GET request | ||
HttpResponseMessage response = await client.GetAsync(apiEndpoint); | ||
// Check if the request was successful | ||
response.EnsureSuccessStatusCode(); | ||
// Read and process the response content | ||
string responseBody = await response.Content.ReadAsStringAsync(); | ||
// Output the response content (for demonstration purposes) | ||
Console.WriteLine("API Response:"); | ||
Console.WriteLine(responseBody); | ||
} | ||
catch (HttpRequestException e) | ||
{ | ||
// Handle any errors that occur during the request | ||
Console.WriteLine($"Request error: {e.Message}"); | ||
} | ||
} | ||
} | ||
*/ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Serialization; | ||
using USACE.HEC.Consequences; | ||
using USACE.HEC.Geography; | ||
using USACE.HEC.Hazards; | ||
using USACE.HEC.Results; | ||
|
||
namespace ConsequencesTest; | ||
public class NSIStreamingProcessorTest | ||
{ | ||
[Fact] | ||
public void Test() | ||
{ | ||
IBBoxStreamingProcessor sp = new NSIStreamingProcessor(); | ||
// int i = 0; | ||
Location upperLeft = new Location { X = -40, Y = 50 }; | ||
IHazardProvider depthHazardProvider = new RandomDepthHazardProvider(25); | ||
IResultsWriter consoleWriter = new ConsoleWriter(); | ||
|
||
sp.Process(depthHazardProvider.Extent(), (IConsequencesReceptor s) => { | ||
Result r = s.Compute(depthHazardProvider.Hazard(upperLeft)); | ||
consoleWriter.Write(r); | ||
}); | ||
} | ||
} |