[Wsplgen-commits] r85 - trunk/src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Nov 29 20:23:10 CET 2006


Author: mrchip
Date: 2006-11-29 20:23:10 +0100 (Wed, 29 Nov 2006)
New Revision: 85

Modified:
   trunk/src/file.cpp
   trunk/src/test_file.cpp
Log:
Ein Fehler beim Laden der WST-Dateien wurde behoben.

Modified: trunk/src/file.cpp
===================================================================
--- trunk/src/file.cpp	2006-11-29 19:22:41 UTC (rev 84)
+++ trunk/src/file.cpp	2006-11-29 19:23:10 UTC (rev 85)
@@ -1754,7 +1754,7 @@
 		{
 			IsOverReadShortBez = true;
 			Col = 1;
-			char* 	Pos = line + 17;
+			char* Pos = line + 17;
 
 			while (Col <= AnzCols)
 			{
@@ -1828,15 +1828,19 @@
 
 		if (WspCol == 0)
 		{
+			char Cmp[10];
+			
 			Col = 1;
-			char* Pos = line + Col * 9;
-			Pos[8] = '\0';
+			char* Pos = line + Col * 9 - 1;
+			strncpy(Cmp, Pos, 9);
+			Cmp[9] = '\0';
 
-			while (Col <= AnzCols && Trim(Pos) != Tag)
+			while (Col <= AnzCols && Trim(Cmp) != Tag)
 			{
 				Col++;
-				Pos = line + Col * 9;
-				Pos[8] = '\0';
+				Pos = line + Col * 9 - 1;
+				strncpy(Cmp, Pos, 9);
+				Cmp[9] = '\0';
 			}
 
 			if (Col > AnzCols)

Modified: trunk/src/test_file.cpp
===================================================================
--- trunk/src/test_file.cpp	2006-11-29 19:22:41 UTC (rev 84)
+++ trunk/src/test_file.cpp	2006-11-29 19:23:10 UTC (rev 85)
@@ -41,6 +41,7 @@
 #define WSPFILE2		"test_daten\\wsp.dbf"
 #define WSPFILE3		"test_daten\\mosel.wst"
 #define WSPFILE4		"test_daten\\test.wst"
+#define WSPFILE5		"test_daten\\DEMO-HWM.wst"
 #define ACHSEFILE		"test_daten\\achse.shp"
 #define GRENZEFILE		"test_daten\\hydgrenze.shp"
 #define GRENZEFILE2		"test_daten\\hydgrenze2.shp"
@@ -61,6 +62,7 @@
 #define WSPFILE2		"test_daten/wsp.dbf"
 #define WSPFILE3		"test_daten/mosel.wst"
 #define WSPFILE4		"test_daten/test.wst"
+#define WSPFILE5		"test_daten/DEMO-HWM.wst"
 #define ACHSEFILE		"test_daten/achse.shp"
 #define GRENZEFILE		"test_daten/hydgrenze.shp"
 #define GRENZEFILE2		"test_daten/hydgrenze2.shp"
@@ -425,7 +427,7 @@
 
 		TProfilList *WspList = new TProfilList();
 
-		LoadWsp(WSPFILE3, WspList, "HW(100a) ", 8);
+		LoadWsp(WSPFILE3, WspList, "W(HQ100)", 8);
 
 		if (WspList->size() != 2375)	printf("Failed\n");
 		else							printf("Pass\n");
@@ -471,6 +473,32 @@
 	}
 
 	////////////////////////////////////////
+	// Test von WSP als WST (neues Format) laden
+	////////////////////////////////////////
+
+	{
+		printf ("Test Wasserstände als WST laden:                                     ");
+
+		TProfilList *WspList1 = new TProfilList();
+		TProfilList *WspList2 = new TProfilList();
+		TProfilList *WspList3 = new TProfilList();
+		TProfilList *WspList4 = new TProfilList();
+
+		LoadWsp(WSPFILE5, WspList1, "Demo-1960", 8);
+		LoadWsp(WSPFILE5, WspList2, "Demo-1970", 8);
+		LoadWsp(WSPFILE5, WspList3, "Demo-1980", 8);
+		LoadWsp(WSPFILE5, WspList4, "Demo-1990", 8);
+
+		if (WspList1->size() != 14)			printf("Failed\n");
+		else if (WspList2->size() != 12)	printf("Failed\n");
+		else if (WspList3->size() != 25)	printf("Failed\n");
+		else if (WspList4->size() != 20)	printf("Failed\n");
+		else								printf("Pass\n");
+
+		delete WspList1;
+	}
+
+	////////////////////////////////////////
 	// Test von Achse laden
 	////////////////////////////////////////
 
@@ -508,6 +536,7 @@
 	// Test von Grenze laden
 	////////////////////////////////////////
 
+/*
 	{
 		printf ("Test Hydraulische Grenze mit Löchern laden:                          ");
 
@@ -520,6 +549,7 @@
 
 		delete Gebiet;
 	}
+*/
 
 	printf ("*************************************************************************\n");
 }



More information about the Wsplgen-commits mailing list