Skip to content

Commit dbfb219

Browse files
authored
Merge pull request dtarb#108 from dtarb/EditRaster
Edit raster
2 parents ef13e98 + 88179f9 commit dbfb219

8 files changed

+533
-27
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Debug|x64">
9+
<Configuration>Debug</Configuration>
10+
<Platform>x64</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Release|Win32">
13+
<Configuration>Release</Configuration>
14+
<Platform>Win32</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|x64">
17+
<Configuration>Release</Configuration>
18+
<Platform>x64</Platform>
19+
</ProjectConfiguration>
20+
</ItemGroup>
21+
<PropertyGroup Label="Globals">
22+
<ProjectGuid>{7104B58F-2E1B-4339-92C1-90B63382296A}</ProjectGuid>
23+
<RootNamespace>EditRaster</RootNamespace>
24+
<Keyword>Win32Proj</Keyword>
25+
</PropertyGroup>
26+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
27+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
28+
<ConfigurationType>Application</ConfigurationType>
29+
<CharacterSet>Unicode</CharacterSet>
30+
<WholeProgramOptimization>true</WholeProgramOptimization>
31+
<PlatformToolset>v140</PlatformToolset>
32+
</PropertyGroup>
33+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
34+
<ConfigurationType>Application</ConfigurationType>
35+
<CharacterSet>Unicode</CharacterSet>
36+
<PlatformToolset>v140</PlatformToolset>
37+
</PropertyGroup>
38+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
39+
<ConfigurationType>Application</ConfigurationType>
40+
<CharacterSet>Unicode</CharacterSet>
41+
<WholeProgramOptimization>true</WholeProgramOptimization>
42+
<PlatformToolset>v140</PlatformToolset>
43+
</PropertyGroup>
44+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
45+
<ConfigurationType>Application</ConfigurationType>
46+
<CharacterSet>Unicode</CharacterSet>
47+
<PlatformToolset>v140</PlatformToolset>
48+
</PropertyGroup>
49+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
50+
<ImportGroup Label="ExtensionSettings">
51+
</ImportGroup>
52+
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
53+
<Import Project="..\TauDEM_Build_Configurations\common_release_32.props" />
54+
<Import Project="..\TauDEM_Build_Configurations\win32_library.props" />
55+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
56+
</ImportGroup>
57+
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
58+
<Import Project="..\TauDEM_Build_Configurations\common_debug_32.props" />
59+
<Import Project="..\TauDEM_Build_Configurations\win32_library.props" />
60+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
61+
</ImportGroup>
62+
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
63+
<Import Project="..\TauDEM_Build_Configurations\common_release_64.props" />
64+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
65+
</ImportGroup>
66+
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
67+
<Import Project="..\TauDEM_Build_Configurations\common_debug_64.props" />
68+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
69+
</ImportGroup>
70+
<PropertyGroup Label="UserMacros" />
71+
<PropertyGroup>
72+
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
73+
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
74+
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
75+
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
76+
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
77+
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
78+
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
79+
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
80+
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
81+
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
82+
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
83+
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
84+
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
85+
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
86+
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
87+
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
88+
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
89+
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
90+
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
91+
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
92+
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
93+
</PropertyGroup>
94+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
95+
<ClCompile>
96+
<Optimization>Disabled</Optimization>
97+
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
98+
<MinimalRebuild>true</MinimalRebuild>
99+
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
100+
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
101+
<PrecompiledHeader>
102+
</PrecompiledHeader>
103+
</ClCompile>
104+
<Link>
105+
<AdditionalDependencies>msmpi.lib;%(AdditionalDependencies)</AdditionalDependencies>
106+
<GenerateDebugInformation>true</GenerateDebugInformation>
107+
<SubSystem>Console</SubSystem>
108+
<TargetMachine>MachineX86</TargetMachine>
109+
</Link>
110+
</ItemDefinitionGroup>
111+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
112+
<Midl>
113+
<TargetEnvironment>X64</TargetEnvironment>
114+
</Midl>
115+
<ClCompile>
116+
<Optimization>Disabled</Optimization>
117+
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
118+
<MinimalRebuild>true</MinimalRebuild>
119+
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
120+
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
121+
<PrecompiledHeader>
122+
</PrecompiledHeader>
123+
</ClCompile>
124+
<Link>
125+
<AdditionalDependencies>gdal_i.lib;msmpi.lib;%(AdditionalDependencies)</AdditionalDependencies>
126+
<GenerateDebugInformation>true</GenerateDebugInformation>
127+
<SubSystem>Console</SubSystem>
128+
<TargetMachine>MachineX64</TargetMachine>
129+
</Link>
130+
</ItemDefinitionGroup>
131+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
132+
<ClCompile>
133+
<Optimization>MaxSpeed</Optimization>
134+
<IntrinsicFunctions>true</IntrinsicFunctions>
135+
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
136+
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
137+
<FunctionLevelLinking>true</FunctionLevelLinking>
138+
<PrecompiledHeader>
139+
</PrecompiledHeader>
140+
</ClCompile>
141+
<Link>
142+
<AdditionalDependencies>msmpi.lib;%(AdditionalDependencies)</AdditionalDependencies>
143+
<GenerateDebugInformation>true</GenerateDebugInformation>
144+
<SubSystem>Console</SubSystem>
145+
<OptimizeReferences>true</OptimizeReferences>
146+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
147+
<TargetMachine>MachineX86</TargetMachine>
148+
</Link>
149+
</ItemDefinitionGroup>
150+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
151+
<Midl>
152+
<TargetEnvironment>X64</TargetEnvironment>
153+
</Midl>
154+
<ClCompile>
155+
<Optimization>MaxSpeed</Optimization>
156+
<IntrinsicFunctions>true</IntrinsicFunctions>
157+
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
158+
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
159+
<FunctionLevelLinking>true</FunctionLevelLinking>
160+
<PrecompiledHeader>
161+
</PrecompiledHeader>
162+
</ClCompile>
163+
<Link>
164+
<AdditionalDependencies>gdal_i.lib;msmpi.lib;%(AdditionalDependencies)</AdditionalDependencies>
165+
<GenerateDebugInformation>true</GenerateDebugInformation>
166+
<SubSystem>Console</SubSystem>
167+
<OptimizeReferences>true</OptimizeReferences>
168+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
169+
<TargetMachine>MachineX64</TargetMachine>
170+
</Link>
171+
</ItemDefinitionGroup>
172+
<ItemGroup>
173+
<ClCompile Include="..\..\src\commonLib.cpp" />
174+
<ClCompile Include="..\..\src\EditRaster.cpp" />
175+
<ClCompile Include="..\..\src\EditRastermn.cpp" />
176+
<ClCompile Include="..\..\src\tiffIO.cpp" />
177+
</ItemGroup>
178+
<ItemGroup>
179+
<ResourceCompile Include="..\TauDEM.rc" />
180+
</ItemGroup>
181+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
182+
<ImportGroup Label="ExtensionTargets">
183+
</ImportGroup>
184+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="Common">
5+
<UniqueIdentifier>{7950a40e-a4de-416b-a3e8-ff247183dcb9}</UniqueIdentifier>
6+
</Filter>
7+
</ItemGroup>
8+
<ItemGroup>
9+
<ClCompile Include="..\..\src\commonLib.cpp">
10+
<Filter>Common</Filter>
11+
</ClCompile>
12+
<ClCompile Include="..\..\src\tiffIO.cpp">
13+
<Filter>Common</Filter>
14+
</ClCompile>
15+
<ClCompile Include="..\..\src\EditRaster.cpp" />
16+
<ClCompile Include="..\..\src\EditRastermn.cpp" />
17+
</ItemGroup>
18+
<ItemGroup>
19+
<ResourceCompile Include="..\TauDEM.rc" />
20+
</ItemGroup>
21+
</Project>

Taudem5PCVS2015/Taudem5PC.sln

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 14
4-
VisualStudioVersion = 14.0.24720.0
4+
VisualStudioVersion = 14.0.25420.1
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AreaDinf", "AreaDinf\AreaDinf.vcxproj", "{D7080581-4679-44A8-80BC-78AC2CB34F27}"
77
EndProject
@@ -69,6 +69,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
6969
EndProject
7070
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CatchOutlets", "CatchOutlets\CatchOutlets.vcxproj", "{B5AE0370-CE03-4A89-9063-B65491EF7C67}"
7171
EndProject
72+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EditRaster", "EditRaster\EditRaster.vcxproj", "{7104B58F-2E1B-4339-92C1-90B63382296A}"
73+
EndProject
7274
Global
7375
GlobalSection(SolutionConfigurationPlatforms) = preSolution
7476
Debug|Itanium = Debug|Itanium
@@ -398,6 +400,16 @@ Global
398400
{B5AE0370-CE03-4A89-9063-B65491EF7C67}.Release|Win32.Build.0 = Release|Win32
399401
{B5AE0370-CE03-4A89-9063-B65491EF7C67}.Release|x64.ActiveCfg = Release|x64
400402
{B5AE0370-CE03-4A89-9063-B65491EF7C67}.Release|x64.Build.0 = Release|x64
403+
{7104B58F-2E1B-4339-92C1-90B63382296A}.Debug|Itanium.ActiveCfg = Debug|Win32
404+
{7104B58F-2E1B-4339-92C1-90B63382296A}.Debug|Win32.ActiveCfg = Debug|Win32
405+
{7104B58F-2E1B-4339-92C1-90B63382296A}.Debug|Win32.Build.0 = Debug|Win32
406+
{7104B58F-2E1B-4339-92C1-90B63382296A}.Debug|x64.ActiveCfg = Debug|x64
407+
{7104B58F-2E1B-4339-92C1-90B63382296A}.Debug|x64.Build.0 = Debug|x64
408+
{7104B58F-2E1B-4339-92C1-90B63382296A}.Release|Itanium.ActiveCfg = Release|Win32
409+
{7104B58F-2E1B-4339-92C1-90B63382296A}.Release|Win32.ActiveCfg = Release|Win32
410+
{7104B58F-2E1B-4339-92C1-90B63382296A}.Release|Win32.Build.0 = Release|Win32
411+
{7104B58F-2E1B-4339-92C1-90B63382296A}.Release|x64.ActiveCfg = Release|x64
412+
{7104B58F-2E1B-4339-92C1-90B63382296A}.Release|x64.Build.0 = Release|x64
401413
EndGlobalSection
402414
GlobalSection(SolutionProperties) = preSolution
403415
HideSolutionNode = FALSE

src/CatchOutlets.cpp

+31-24
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ struct netlink {
7575
int32_t uslinkno1;
7676
int32_t uslinkno2;
7777
double doutend;
78+
double uscontarea;
7879
double x, y;
7980
};
8081
OGRLayerH hLayer, hLayerpt;
@@ -83,7 +84,7 @@ OGRGeometryH hGeometry, hGeometrypt;
8384

8485
netlink* allinks;
8586

86-
void CheckPoint(int thelink, double downout, double mindist)
87+
void CheckPoint(int thelink, double downout, double mindist, double minarea)
8788
{
8889
int istream=0;
8990
while (linknos[istream] != thelink && istream < nstreams) {
@@ -92,33 +93,37 @@ void CheckPoint(int thelink, double downout, double mindist)
9293
if (istream < nstreams) // Here a stream was found. This traps the passing over streams with none upstream
9394
{
9495
if (allinks[istream].doutend - downout > mindist) {
95-
//printf("%d, %g, %g\n", linknos[istream], allinks[istream].x, allinks[istream].y);
96-
hGeometrypt = OGR_G_CreateGeometry(wkbPoint);// create geometry
97-
OGRFeatureH hFeaturept = OGR_F_Create(OGR_L_GetLayerDefn(hLayerpt)); // create new feature with null fields and no geometry
98-
OGR_F_SetFieldInteger(hFeaturept, 0, linknos[istream]);
99-
OGR_F_SetFieldInteger(hFeaturept, 1, allinks[istream].dslinkno);
100-
OGR_F_SetFieldInteger(hFeaturept, 2, allinks[istream].uslinkno1);
101-
OGR_F_SetFieldInteger(hFeaturept, 3, allinks[istream].uslinkno2);
102-
OGR_F_SetFieldDouble(hFeaturept, 4, allinks[istream].doutend);
103-
OGR_F_SetFieldInteger(hFeaturept, 5, gwcount);
104-
gwcount = gwcount + 1;
105-
OGR_G_SetPoint_2D(hGeometrypt, 0, allinks[istream].x, allinks[istream].y);
106-
OGR_F_SetGeometry(hFeaturept, hGeometrypt);
107-
OGR_G_DestroyGeometry(hGeometrypt);
108-
OGR_L_CreateFeature(hLayerpt, hFeaturept);
109-
OGR_F_Destroy(hFeaturept);
110-
111-
downout = allinks[istream].doutend;
96+
if (allinks[istream].uscontarea > minarea) { // Only write if min area is exceeded
97+
//printf("%d, %g, %g\n", linknos[istream], allinks[istream].x, allinks[istream].y);
98+
hGeometrypt = OGR_G_CreateGeometry(wkbPoint);// create geometry
99+
OGRFeatureH hFeaturept = OGR_F_Create(OGR_L_GetLayerDefn(hLayerpt)); // create new feature with null fields and no geometry
100+
OGR_F_SetFieldInteger(hFeaturept, 0, linknos[istream]);
101+
OGR_F_SetFieldInteger(hFeaturept, 1, allinks[istream].dslinkno);
102+
OGR_F_SetFieldInteger(hFeaturept, 2, allinks[istream].uslinkno1);
103+
OGR_F_SetFieldInteger(hFeaturept, 3, allinks[istream].uslinkno2);
104+
OGR_F_SetFieldDouble(hFeaturept, 4, allinks[istream].doutend);
105+
OGR_F_SetFieldInteger(hFeaturept, 5, gwcount);
106+
gwcount = gwcount + 1;
107+
OGR_G_SetPoint_2D(hGeometrypt, 0, allinks[istream].x, allinks[istream].y);
108+
OGR_F_SetGeometry(hFeaturept, hGeometrypt);
109+
OGR_G_DestroyGeometry(hGeometrypt);
110+
OGR_L_CreateFeature(hLayerpt, hFeaturept);
111+
OGR_F_Destroy(hFeaturept);
112+
113+
downout = allinks[istream].doutend;
114+
}
115+
}
116+
if (allinks[istream].uscontarea > minarea) { // Only recurse up if minarea is satisified
117+
if (allinks[istream].uslinkno1 >= 0) CheckPoint(allinks[istream].uslinkno1, downout, mindist, minarea);
118+
if (allinks[istream].uslinkno2 >= 0) CheckPoint(allinks[istream].uslinkno2, downout, mindist, minarea);
112119
}
113-
if (allinks[istream].uslinkno1 >= 0) CheckPoint(allinks[istream].uslinkno1, downout, mindist);
114-
if (allinks[istream].uslinkno2 >= 0) CheckPoint(allinks[istream].uslinkno2, downout, mindist);
115120
}
116121
}
117122

118123

119124
// int catchoutlets(char *pfile, char *streamnetsrc, char *streamnetlyr, char *outletsdatasrc, char *outletslayer, int lyrno, float maxdist)
120125

121-
int catchoutlets(char *pfile, char *streamnetsrc, char *outletsdatasrc, double mindist, int gwstartno)
126+
int catchoutlets(char *pfile, char *streamnetsrc, char *outletsdatasrc, double mindist, int gwstartno, double minarea)
122127
{
123128

124129
MPI_Init(NULL,NULL);{
@@ -257,8 +262,9 @@ int catchoutlets(char *pfile, char *streamnetsrc, char *outletsdatasrc, double m
257262
OGR_Fld_SetWidth(hFieldDefn, 10); // set field width
258263
OGR_L_CreateField(hLayerpt, hFieldDefn, 0);
259264

265+
// Fields we use but do not add to new feature class
260266
int32_t doutstartfield = OGR_FD_GetFieldIndex(hFDefn, "DOUTSTART");
261-
// Dont need to create new field for this
267+
int32_t uscontareafield = OGR_FD_GetFieldIndex(hFDefn, "USContArea");
262268

263269
int32_t istream = 0;
264270
gwcount = gwstartno; // Initialize count
@@ -293,6 +299,7 @@ int catchoutlets(char *pfile, char *streamnetsrc, char *outletsdatasrc, double m
293299
OGR_G_GetPoint(hGeometry, num_points-1, &X1, &Y1, &Z1);
294300
allinks[istream].doutend = OGR_F_GetFieldAsDouble(hFeature, doutstartfield); // Note here start field
295301
}
302+
allinks[istream].uscontarea = OGR_F_GetFieldAsDouble(hFeature, uscontareafield);
296303
allinks[istream].x = X1;
297304
allinks[istream].y = Y1;
298305
//printf("%d, %lf, %lf,%lf\n", istream, X1, Y1, Z1);
@@ -342,8 +349,8 @@ int catchoutlets(char *pfile, char *streamnetsrc, char *outletsdatasrc, double m
342349
OGR_F_Destroy(hFeaturept);
343350
double downout = 0.0;
344351
// Recursive calls to traverse up
345-
if (allinks[istream].uslinkno1 >= 0) CheckPoint(allinks[istream].uslinkno1, downout,mindist);
346-
if (allinks[istream].uslinkno2 >= 0) CheckPoint(allinks[istream].uslinkno2, downout,mindist);
352+
if (allinks[istream].uslinkno1 >= 0) CheckPoint(allinks[istream].uslinkno1, downout,mindist,minarea);
353+
if (allinks[istream].uslinkno2 >= 0) CheckPoint(allinks[istream].uslinkno2, downout,mindist,minarea);
347354
}
348355
}
349356
}

src/CatchOutlets.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33

44
//int catchoutlets(char *pfile, char *streamnetsrc, char *streamnetlyr, char *outletsdatasrc, char *outletslayer, int lyrno, float maxdist);
5-
int catchoutlets(char *pfile, char *streamnetsrc,char *outletsdatasrc, double mindist, int gwstartno);
5+
int catchoutlets(char *pfile, char *streamnetsrc,char *outletsdatasrc, double mindist, int gwstartno, double minarea);
66
// Incomplete implementation no capability for layers within data sources yet

src/CatchOutletsmn.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ int main(int argc,char **argv)
5858
{
5959
char pfile[MAXLN],streamnetsrc[MAXLN], streamnetlyr[MAXLN]="",outletsdatasrc[MAXLN],outletslayer[MAXLN]="";
6060
double mindist = 0.0;
61+
double minarea = 0.0;
6162
int err,i,uselyrname=0,lyrno=0,gwstartno=1;
6263

6364
if(argc < 7)
@@ -151,12 +152,22 @@ int main(int argc,char **argv)
151152
}
152153
else goto errexit;
153154
}
155+
else if (strcmp(argv[i], "-minarea") == 0)
156+
{
157+
i++;
158+
if (argc > i)
159+
{
160+
sscanf(argv[i], "%lf", &minarea);
161+
i++;
162+
}
163+
else goto errexit;
164+
}
154165
else
155166
{
156167
goto errexit;
157168
}
158169
}
159-
if(err=catchoutlets(pfile,streamnetsrc,outletsdatasrc,mindist,gwstartno) != 0)
170+
if(err=catchoutlets(pfile,streamnetsrc,outletsdatasrc,mindist,gwstartno,minarea) != 0)
160171
printf("Catchment Outlets error %d\n",err);
161172

162173
return 0;

0 commit comments

Comments
 (0)