[Wsplgen-commits] r26 - trunk/src

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Tue Jan 10 22:53:03 CET 2006


Author: mrchip
Date: 2006-01-10 22:53:01 +0100 (Tue, 10 Jan 2006)
New Revision: 26

Added:
   trunk/src/parameter.cpp
   trunk/src/parameter.h
   trunk/src/wsplgen.cpp
   trunk/src/wsplgen.h
Modified:
   trunk/src/Makefile
   trunk/src/test.cpp
   trunk/src/test_profil.cpp
   trunk/src/test_tools.cpp
   trunk/src/test_tri.cpp
   trunk/src/test_xy.cpp
   trunk/src/tools.cpp
   trunk/src/tools.h
   trunk/src/xy.cpp
   trunk/src/xy.h
Log:
Es wurde das Programm WSPLGEN richtig begonnen. Die Parameterauswertung ist schon fast ferti ;-)

Modified: trunk/src/Makefile
===================================================================
--- trunk/src/Makefile	2006-01-09 20:37:25 UTC (rev 25)
+++ trunk/src/Makefile	2006-01-10 21:53:01 UTC (rev 26)
@@ -12,12 +12,17 @@
 
 PROJECT=wsplgen.exe
 TEST=test.exe
-OBJFILES=profil.o tools.o xy.o
-TESTOBJFILES=test.o test_profil.o test_tools.o test_xy.o test_tri.o
+OBJFILES=profil.o tools.o xy.o tri.o parameter.o
+TESTOBJFILES=test_profil.o test_tools.o test_xy.o test_tri.o
 
-../bin/test.exe: $(TESTOBJFILES) $(OBJFILES)
-	$(CC) $(LDFLAGS) -o ../bin/test.exe $(TESTOBJFILES) $(OBJFILES) $(LIBS)
+all: ../bin/test.exe ../bin/wsplgen.exe
 
+../bin/test.exe: test.o $(TESTOBJFILES) $(OBJFILES)
+	$(CC) $(LDFLAGS) -o ../bin/test.exe test.o $(TESTOBJFILES) $(OBJFILES) $(LIBS)
+
+../bin/wsplgen.exe: wsplgen.o $(OBJFILES)
+	$(CC) $(LDFLAGS) -o ../bin/wsplgen.exe wsplgen.o $(OBJFILES) $(LIBS)
+
 .cpp.o:
 	$(CC) -Wall -c $(CPPFLAGS) $*.cpp $(OUTPUT_OPTIONS)
 

Added: trunk/src/parameter.cpp
===================================================================
--- trunk/src/parameter.cpp	2006-01-09 20:37:25 UTC (rev 25)
+++ trunk/src/parameter.cpp	2006-01-10 21:53:01 UTC (rev 26)
@@ -0,0 +1,304 @@
+//
+// $Id: parameter.h 11 2005-12-07 10:15:07Z jan $
+//
+// Copyright (C) 2005 STADT-LAND-FLUSS INGENIEURDIENSTE GmbH
+//
+// Authors:
+// Ulrich Kiel <u.kiel at S-L-F.de>
+//
+// This program is free software under the GPL (>=v2)
+// Read the file COPYING coming with WSPLGEN for details.
+//
+
+//---------------------------------------------------------------------------
+#include <string.h>
+#include "tools.h"
+#include "parameter.h"
+
+#define PARAMETERDEBUG	1
+
+//---------------------------------------------------------------------------
+TParameter::TParameter(int argc, char **argv)
+{
+	write_fortschritt("Die Kommandozeilen-Parameter werden ausgewertet.\n");
+
+	IsSetPar = false;
+	std::string	FileNamePar = "";
+
+	IsSetDelta = false;
+	IsSetVon = false;
+	Von = 0.0;
+	IsSetBis = false;
+	Bis = 0.0;
+	IsSetDiff = false;
+	Diff = 0.0;
+
+	IsSetGel = false;
+	Sperre = true;
+
+	IsSetDgm = false;
+	std::string	FileNameDgm = "";
+
+	IsSetPro = false;
+	std::string	FileNamePro = "";
+
+	IsSetWsp = false;
+	std::string	FileNameWsp = "";
+
+	IsSetLin = false;
+	std::string	FileNameLin = "";
+
+	IsSetAusgabe = false;
+	std::string	FileNameAusgabe = "WSPLGEN.SHP";
+
+
+
+
+	if (argc == 0 || argv == 0)
+	{
+		write_error(1201, "Es wurden keine Parameter übergeben.\nWenigstens die Parameter -DGM=<DGM-Datei>, -PRO=<Profil-Datei> und -WSP=<Wasserstands-Datei>\nmüssen angegeben werden.");
+	}
+
+	for (int i=0; i<argc; i++)
+	{
+		std::string Parameter = argv[i];
+
+		if (Parameter.substr(0, 4) == "-PAR")
+		{
+#if (PARAMETERDEBUG)
+			write_fortschritt("Parameter -PAR erkannt.\n");
+#endif
+			if (IsSetPar)
+			{
+				write_warning(1106, "Der Parameter -PAR wurde mehrfach angegeben.\n");
+				continue;
+			}
+
+			if (Parameter.substr(0, 5) != "-PAR=") write_error(1207, "Es wurden kein Dateiname für -PAR übergeben.\nDas Format lautet korrekt -PAR=<Dateiname>.");
+
+			FileNamePar = Parameter.substr(5);
+
+#if (PARAMETERDEBUG)
+			write_fortschritt("Parameterdatei: '%s'\n", FileNamePar.c_str());
+#endif
+			IsSetPar = true;
+		}
+
+		if (Parameter.substr(0, 6) == "-DELTA")
+		{
+#if (PARAMETERDEBUG)
+			write_fortschritt("Parameter -DELTA erkannt.\n");
+#endif
+
+			if (IsSetDelta)
+			{
+				write_warning(1106, "Der Parameter -DELTA wurde mehrfach angegeben.\n");
+				continue;
+			}
+
+			if (Parameter.substr(0, 7) != "-DELTA=") write_warning(1108, "Es wurden keine Argumente für -DELTA übergeben.\nDas Format lautet korrekt -DELTA=<Von>,<Bis>,<Diff>.");
+
+			unsigned int FirstKommaPos = Parameter.find(",");
+
+			if (FirstKommaPos >= Parameter.size())
+			{
+				write_error(1108, "Es wurden nicht genug Argumente für den Parameter -DELTA übergeben.\nDas Format lautet korrekt -DELTA=<Von>,<Bis>,<Diff>.");
+			}
+
+			unsigned int SecondKommaPos = Parameter.find(",", FirstKommaPos + 1);
+
+			if (SecondKommaPos >= Parameter.size())
+			{
+				write_error(1209, "Es wurden nicht genau 2 kommata beim Parameter -DELTA verwendet.\nDas Format lautet korrekt -DELTA=<Von>,<Bis>,<Diff>.");
+			}
+
+			double D = 0.0;
+			if (1 == sscanf(Parameter.substr(7).c_str(), "%lf", &D))
+			{
+				IsSetVon = true;
+				Von = D;
+			}
+
+			if (1 == sscanf(Parameter.substr(FirstKommaPos + 1).c_str(), "%lf", &D))
+			{
+				IsSetBis = true;
+				Bis = D;
+			}
+
+			if (1 == sscanf(Parameter.substr(SecondKommaPos + 1).c_str(), "%lf", &D))
+			{
+				IsSetDiff = true;
+				Diff = D;
+			}
+
+#if (PARAMETERDEBUG)
+			write_fortschritt("Delta:");
+			if (IsSetVon)	write_fortschritt(" Von = %.2f", Von);
+			else			write_fortschritt(" Von = <default>");
+
+			if (IsSetBis)	write_fortschritt(" Bis = %.2f", Bis);
+			else			write_fortschritt(" Bis = <default>");
+
+			if (IsSetDiff)	write_fortschritt(" Diff = %.2f\n", Diff);
+			else			write_fortschritt(" Diff = <default>\n");
+#endif
+
+			IsSetDelta = true;
+		}
+
+		if (Parameter.substr(0, 4) == "-GEL")
+		{
+#if (PARAMETERDEBUG)
+			write_fortschritt("Parameter -GEL erkannt.\n");
+#endif
+			if (IsSetGel)
+			{
+				write_warning(1106, "Der Parameter -GEL wurde mehrfach angegeben.\n");
+				continue;
+			}
+
+			if (Parameter.substr(0, 5) != "-GEL=") write_warning(1108, "Es wurden keine Argumente für -GEL übergeben.\nDas Format lautet korrekt -GEL=<SPERRE|NOSPERRE>.");
+
+			if (Parameter.substr(0, 11) == "-GEL=SPERRE")
+			{
+				Sperre = true;
+			}
+			else if (Parameter.substr(0, 13) == "-GEL=NOSPERRE")
+			{
+				Sperre = false;
+			}
+			else
+			{
+				write_error(1214, "Es wurden weder SPERRE noch NOSPERRE mit -GEL verwendet.\nDas Format lautet korrekt -GEL=<SPERRE|NOSPERRE>.");
+			}
+
+#if (PARAMETERDEBUG)
+			if (Sperre)		write_fortschritt("Gelände wirkt als Sperre\n");
+			else			write_fortschritt("Gelände wirkt nicht als Sperre\n");
+#endif
+
+			IsSetGel = true;
+		}
+
+		if (Parameter.substr(0, 4) == "-DGM")
+		{
+#if (PARAMETERDEBUG)
+			write_fortschritt("Parameter -DGM erkannt.\n");
+#endif
+			if (IsSetDgm)
+			{
+				write_warning(1106, "Der Parameter -DGM wurde mehrfach angegeben.\n");
+				continue;
+			}
+
+			if (Parameter.substr(0, 5) != "-DGM=") write_error(1207, "Es wurden kein Dateiname für -DGM übergeben.\nDas Format lautet korrekt -DGM=<Dateiname>.");
+
+			FileNameDgm = Parameter.substr(5);
+
+#if (PARAMETERDEBUG)
+			write_fortschritt("DGM-Datei: '%s'\n", FileNameDgm.c_str());
+#endif
+			IsSetDgm = true;
+		}
+
+		if (Parameter.substr(0, 4) == "-PRO")
+		{
+#if (PARAMETERDEBUG)
+			write_fortschritt("Parameter -PRO erkannt.\n");
+#endif
+			if (IsSetPro)
+			{
+				write_warning(1106, "Der Parameter -PRO wurde mehrfach angegeben.\n");
+				continue;
+			}
+
+			if (Parameter.substr(0, 5) != "-PRO=") write_error(1207, "Es wurden kein Dateiname für -PRO übergeben.\nDas Format lautet korrekt -PRO=<Dateiname>.");
+
+			FileNamePro = Parameter.substr(5);
+
+#if (PARAMETERDEBUG)
+			write_fortschritt("Profillagen-Datei: '%s'\n", FileNamePro.c_str());
+#endif
+			IsSetPro = true;
+		}
+
+		if (Parameter.substr(0, 4) == "-WSP")
+		{
+#if (PARAMETERDEBUG)
+			write_fortschritt("Parameter -WSP erkannt.\n");
+#endif
+			if (IsSetWsp)
+			{
+				write_warning(1106, "Der Parameter -WSP wurde mehrfach angegeben.\n");
+				continue;
+			}
+
+			if (Parameter.substr(0, 5) != "-WSP=") write_error(1207, "Es wurden kein Dateiname für -WSP übergeben.\nDas Format lautet korrekt -WSP=<Dateiname>.");
+
+			FileNameWsp = Parameter.substr(5);
+
+#if (PARAMETERDEBUG)
+			write_fortschritt("WSP-Datei: '%s'\n", FileNameWsp.c_str());
+#endif
+			IsSetWsp = true;
+		}
+
+		if (Parameter.substr(0, 4) == "-LIN")
+		{
+#if (PARAMETERDEBUG)
+			write_fortschritt("Parameter -LIN erkannt.\n");
+#endif
+			if (IsSetLin)
+			{
+				write_warning(1106, "Der Parameter -LIN wurde mehrfach angegeben.\n");
+				continue;
+			}
+
+			if (Parameter.substr(0, 5) != "-LIN=") write_error(1207, "Es wurden kein Dateiname für -LIN übergeben.\nDas Format lautet korrekt -LIN=<Dateiname>.");
+
+			FileNameLin = Parameter.substr(5);
+
+#if (PARAMETERDEBUG)
+			write_fortschritt("Bruch- und Sperr-Datei: '%s'\n", FileNameLin.c_str());
+#endif
+			IsSetLin = true;
+		}
+
+		if (Parameter.substr(0, 8) == "-AUSGABE")
+		{
+#if (PARAMETERDEBUG)
+			write_fortschritt("Parameter -AUSGABE erkannt.\n");
+#endif
+			if (IsSetAusgabe)
+			{
+				write_warning(1106, "Der Parameter -AUSGABE wurde mehrfach angegeben.\n");
+				continue;
+			}
+
+			if (Parameter.substr(0, 9) != "-AUSGABE=") write_error(1207, "Es wurden kein Dateiname für -AUSGABE übergeben.\nDas Format lautet korrekt -AUSGABE=<Dateiname>.");
+
+			FileNameAusgabe = Parameter.substr(9);
+
+#if (PARAMETERDEBUG)
+			write_fortschritt("Ausage-Datei: '%s'\n", FileNameAusgabe.c_str());
+#endif
+			IsSetAusgabe = true;
+		}
+	}
+
+	if (false == IsSetDgm)
+	{
+		write_error(1202, "Der Parameter -DGM wurde nicht angegeben.\nWenigstens die Parameter\n-DGM=<DGM-Datei>, -PRO=<Profil-Datei> und -WSP=<Wasserstands-Datei>\nmüssen angegeben werden.\n");
+	}
+
+	if (false == IsSetPro)
+	{
+		write_error(1203, "Der Parameter -PRO wurde nicht angegeben.\nWenigstens die Parameter\n-DGM=<DGM-Datei>, -PRO=<Profil-Datei> und -WSP=<Wasserstands-Datei>\nmüssen angegeben werden.\n");
+	}
+
+	if (false == IsSetWsp)
+	{
+		write_error(1204, "Der Parameter -WSP wurde nicht angegeben.\nWenigstens die Parameter\n-DGM=<DGM-Datei>, -PRO=<Profil-Datei> und -WSP=<Wasserstands-Datei>\nmüssen angegeben werden.\n");
+	}
+}
+

Added: trunk/src/parameter.h
===================================================================
--- trunk/src/parameter.h	2006-01-09 20:37:25 UTC (rev 25)
+++ trunk/src/parameter.h	2006-01-10 21:53:01 UTC (rev 26)
@@ -0,0 +1,58 @@
+//
+// $Id: wsplgen.h 11 2005-12-07 10:15:07Z jan $
+//
+// Copyright (C) 2005 STADT-LAND-FLUSS INGENIEURDIENSTE GmbH
+//
+// Authors:
+// Ulrich Kiel <u.kiel at S-L-F.de>
+//
+// This program is free software under the GPL (>=v2)
+// Read the file COPYING coming with WSPLGEN for details.
+//
+
+//----------------------------------------------------------------------------
+#ifndef WSPLGENH
+#define WSPLGENH
+
+//---------------------------------------------------------------------------
+#include <string>
+#include <stdio.h>
+
+//---------------------------------------------------------------------------
+class TParameter
+{
+	public:
+		TParameter(int argc, char **argv);
+
+		bool		IsSetPar;
+		std::string	FileNamePar;
+
+		bool		IsSetDelta;
+		bool		IsSetVon;
+		double		Von;
+		bool		IsSetBis;
+		double		Bis;
+		bool		IsSetDiff;
+		double		Diff;
+
+		bool		IsSetGel;
+		bool		Sperre;
+
+		bool		IsSetDgm;
+		std::string	FileNameDgm;
+
+		bool		IsSetPro;
+		std::string	FileNamePro;
+
+		bool		IsSetWsp;
+		std::string	FileNameWsp;
+
+		bool		IsSetLin;
+		std::string	FileNameLin;
+
+		bool		IsSetAusgabe;
+		std::string	FileNameAusgabe;
+};
+
+//---------------------------------------------------------------------------
+#endif

Modified: trunk/src/test.cpp
===================================================================
--- trunk/src/test.cpp	2006-01-09 20:37:25 UTC (rev 25)
+++ trunk/src/test.cpp	2006-01-10 21:53:01 UTC (rev 26)
@@ -13,8 +13,11 @@
 //---------------------------------------------------------------------------
 #include <stdio.h>
 #include <iostream>
+#include "tools.h"
 #include "test.h"
 
+int ReturnCode = 0;
+
 //---------------------------------------------------------------------
 int main(unsigned int argc, char **argv)
 {
@@ -25,7 +28,7 @@
 		Test = 0;
 		for (unsigned int i = 1; i < argc; i++)
 		{
-			Test = Test + 1<<(atoi(argv[i]));
+			Test = Test + (1<<(atoi(argv[i])));
 		}
 	}
 
@@ -66,10 +69,16 @@
 			if (FailCode != 0)	printf ("Fehler bei Test %d\n", TestNr);
 		}
 	}
+	catch (TFehler)
+	{
+		return (9298);
+	}
 	catch (...)
 	{
+		printf ("Fehler nicht korrekt gefangen\n");
 		printf ("Programmabbruch\n");
+		return (9299);
 	}
 
-	return (FailCode);
+	return (ReturnCode);
 }

Modified: trunk/src/test_profil.cpp
===================================================================
--- trunk/src/test_profil.cpp	2006-01-09 20:37:25 UTC (rev 25)
+++ trunk/src/test_profil.cpp	2006-01-10 21:53:01 UTC (rev 26)
@@ -80,6 +80,7 @@
 	else
 	{
 		printf("Fehler der Operatoren < , > oder ==\n");
+		return(TestNr);
 	}
 
 	if (PaPe4 < PaPe3)
@@ -97,6 +98,7 @@
 	else
 	{
 		printf("Fehler der Operatoren < , > oder ==\n");
+		return(TestNr);
 	}
 
 

Modified: trunk/src/test_tools.cpp
===================================================================
--- trunk/src/test_tools.cpp	2006-01-09 20:37:25 UTC (rev 25)
+++ trunk/src/test_tools.cpp	2006-01-10 21:53:01 UTC (rev 26)
@@ -15,7 +15,7 @@
 #include "tools.h"
 
 //---------------------------------------------------------------------
-int	test_tools(int TestNr)
+int	test_tools(int)
 {
 	////////////////////////////////////////
 	// Test der Fehlerausgabe
@@ -27,7 +27,7 @@
 	{
 		dump_error(__FILE__, __LINE__, "Dies ist keine Fehler.\nEs werden nur 3 Argumente der Typen char *, double und int ausgegeben\nArg 1: '%s'\nArg 2: %f\nArg 3: %d\n", "Test String", 3.1415926, 1029233);
 	}
-	catch(fehler)
+	catch(TFehler)
 	{
 		printf ("Fehler korrekt gefangen\n");
 	}
@@ -242,7 +242,7 @@
 		printf (" %s\n", UnsignedInt32ToBin((long)Y, " ").c_str());
 		printf ("%s\n\n", UnsignedInt64ToBin(TestXYKombi).c_str());
 	}
-	catch(fehler)
+	catch(TFehler)
 	{
 		printf ("Fehler korrekt gefangen\n");
 	}
@@ -257,7 +257,7 @@
 		printf (" %s\n", UnsignedInt32ToBin((long)Y, " ").c_str());
 		printf ("%s\n\n", UnsignedInt64ToBin(TestXYKombi).c_str());
 	}
-	catch(fehler)
+	catch(TFehler)
 	{
 		printf ("Fehler korrekt gefangen\n");
 	}
@@ -272,7 +272,7 @@
 		printf (" %s\n", UnsignedInt32ToBin((long)Y, " ").c_str());
 		printf ("%s\n\n", UnsignedInt64ToBin(TestXYKombi).c_str());
 	}
-	catch(fehler)
+	catch(TFehler)
 	{
 		printf ("Fehler korrekt gefangen\n");
 	}
@@ -287,10 +287,70 @@
 		printf (" %s\n", UnsignedInt32ToBin((long)Y, " ").c_str());
 		printf ("%s\n\n", UnsignedInt64ToBin(TestXYKombi).c_str());
 	}
-	catch(fehler)
+	catch(TFehler)
 	{
 		printf ("Fehler korrekt gefangen\n");
 	}
 
+	////////////////////////////////////////
+	// Test der Funktion IsInside
+	////////////////////////////////////////
+
+	printf ("\nTest IsInside\n");
+
+	TXYList *XyList = 0;
+	int Ret = -999;
+
+	Ret = IsInside(XyList, 1.0, 1.0);
+	if (Ret == -3)	printf ("Polygon nicht definiert. OK.\n");
+	else 			printf ("Fehler.\n");
+
+	XyList = new TXYList();
+
+	Ret = IsInside(XyList, 1.0, 1.0);
+	if (Ret == -2)	printf ("Polygon hat keine Punkte. OK.\n");
+	else 			printf ("Fehler.\n");
+
+	TXY *Xy = 0;
+
+	Xy = new TXY(2, 2);
+	XyList->push_back(Xy);
+
+	Xy = new TXY(2, 0);
+	XyList->push_back(Xy);
+
+	Xy = new TXY(0, 0);
+	XyList->push_back(Xy);
+
+	Xy = new TXY(0, 2);
+	XyList->push_back(Xy);
+
+	X = 1.0;
+	Y = 1.0;
+
+	Ret = IsInside(XyList, X,Y);
+	if (Ret == 1)		printf ("1,1 ist im Polygon (Polygon ist gegen den Uhrzeigersinn)\n");
+	else if (Ret == -4)	printf ("1,1 ist im Polygon (Polygon ist mit dem Uhrzeigersinn)\n");
+	else if (Ret == 4)	printf ("1,1 ist im Polygon (Polygon ist gegen den Uhrzeigersinn)\n");
+	else 				printf ("1,1 ist (ich habe keine Ahnung\n");
+
+	X = 3.0;
+	Y = 3.0;
+	Ret = IsInside(XyList, X, Y);
+	if (Ret == 1)		printf ("1,1 ist im Polygon (Polygon ist gegen den Uhrzeigersinn)\n");
+	else if (Ret == -4)	printf ("1,1 ist im Polygon (Polygon ist mit dem Uhrzeigersinn)\n");
+	else if (Ret == 4)	printf ("1,1 ist im Polygon (Polygon ist gegen den Uhrzeigersinn)\n");
+	else 				printf ("1,1 ist (ich habe keine Ahnung\n");
+
+	X = 2.0;
+	Y = 2.0;
+	Ret = IsInside(XyList, X, Y);
+	if (Ret == 1)		printf ("1,1 ist im Polygon (Polygon ist gegen den Uhrzeigersinn)\n");
+	else if (Ret == -4)	printf ("1,1 ist im Polygon (Polygon ist mit dem Uhrzeigersinn)\n");
+	else if (Ret == 4)	printf ("1,1 ist im Polygon (Polygon ist gegen den Uhrzeigersinn)\n");
+	else 				printf ("1,1 ist (ich habe keine Ahnung\n");
+
+    delete XyList;
+
 	return (0);
 }

Modified: trunk/src/test_tri.cpp
===================================================================
--- trunk/src/test_tri.cpp	2006-01-09 20:37:25 UTC (rev 25)
+++ trunk/src/test_tri.cpp	2006-01-10 21:53:01 UTC (rev 26)
@@ -14,7 +14,7 @@
 #include "tri.h"
 
 //---------------------------------------------------------------------
-int	test_tri(int TestNr)
+int	test_tri(int)
 {
 	return (0);
 }

Modified: trunk/src/test_xy.cpp
===================================================================
--- trunk/src/test_xy.cpp	2006-01-09 20:37:25 UTC (rev 25)
+++ trunk/src/test_xy.cpp	2006-01-10 21:53:01 UTC (rev 26)
@@ -12,6 +12,8 @@
 
 //---------------------------------------------------------------------------
 #include <stdio.h>
+#include "tools.h"
+
 #include "xy.h"
 
 //---------------------------------------------------------------------
@@ -22,6 +24,9 @@
 	TXY *P12 = new TXY(9.0, 1.0);
 	TXY *P13 = new TXY(9.0, 9.0);
 	TXY *P14 = new TXY(1.0, 9.0);
+	TXY *P15 = new TXY(4.0, 9.0);
+	TXY *P16 = new TXY(7.0, 9.0);
+	TXY *P17 = new TXY(7.0, 7.0);
 
 	TXY *P21 = new TXY(3.0, 4.0);
 	TXY *P22 = new TXY(7.0, 4.0);
@@ -33,6 +38,9 @@
 	if (P12 == 0)	return (TestNr);
 	if (P13 == 0)	return (TestNr);
 	if (P14 == 0)	return (TestNr);
+	if (P15 == 0)	return (TestNr);
+	if (P16 == 0)	return (TestNr);
+	if (P17 == 0)	return (TestNr);
 	if (P21 == 0)	return (TestNr);
 	if (P22 == 0)	return (TestNr);
 	if (P23 == 0)	return (TestNr);
@@ -51,14 +59,17 @@
 	PL1->push_back(P12);
 	PL1->push_back(P13);
 	PL1->push_back(P14);
-	
+	PL1->push_back(P15);
+	PL1->push_back(P16);
+	PL1->push_back(P17);
+
 	// Ein paar Punkte zur zweiten Polylinie zuweisen
 	PL2->push_back(P21);
 	PL2->push_back(P22);
 	PL2->push_back(P23);
 	PL2->push_back(P24);
 	PL2->push_back(P25);
-	
+
 	// die zweite Polylinie verdoppeln
 	// Dabei werden alle Punkte mit verdoppelt
 	TXYList *PL3 = PL2->Copy();
@@ -126,9 +137,48 @@
 	{
 		TXY *XY = (*PL)[j];
 
-		printf("Koordinaten von Punkt %d: %.3f,%.3f\n", j, XY->X, XY->Y);
+		printf("Koordinaten von Punkt %d: %.3f,%.3f\n%s\n", j, XY->X, XY->Y, UnsignedInt64ToDez(XY->XYKombi).c_str());
 	}
 
+	PL->SortByXY();
+
+	printf("\nDie erste Polylinien der 2. PolygonListe wurde sortiert\n\n");
+
+	// Von dieser Polylinie alle Punkte ausgeben
+	printf("Anzahl Punktepaare im ersten Polygon von PolygonList 2: %d\n", PL->size());
+	for (unsigned int j=0; j<PL->size(); j++)
+	{
+		TXY *XY = (*PL)[j];
+
+		printf("Koordinaten von Punkt %d: %.3f,%.3f\n%s\n", j, XY->X, XY->Y, UnsignedInt64ToDez(XY->XYKombi).c_str());
+	}
+
+
+	printf("\nSuchen wird getestet\n\n");
+
+	TXY *XYS = (*PL)[2];
+	TXY *XYF = PL->FindByXY(XYS->X, XYS->Y);
+	if (XYF == 0)	printf("Punkt %d: %.3f,%.3f nicht gefunden\n", 2, XYS->X, XYS->Y);
+	else            printf("Punkt %d: %.3f,%.3f gefunden\n", 2, XYF->X, XYF->Y);
+
+	XYS = (*PL)[0];
+	XYF = PL->FindByXY(XYS->X, XYS->Y);
+	if (XYF == 0)	printf("Punkt %d: %.3f,%.3f nicht gefunden\n", 0, XYS->X, XYS->Y);
+	else         	printf("Punkt %d: %.3f,%.3f gefunden\n", 0, XYF->X, XYF->Y);
+
+	XYS = new TXY(9.0, 9.0);
+	XYF = PL->FindByXY(XYS->X, XYS->Y);
+	if (XYF == 0)	printf("Punkt mit den Koordenaten %.3f,%.3f nicht gefunden\n", XYS->X, XYS->Y);
+	else         	printf("Punkt mit den Koordenaten %.3f,%.3f gefunden\n", XYF->X, XYF->Y);
+	delete XYS;
+
+	XYS = new TXY(4.0, 7.0);
+	XYF = PL->FindByXY(XYS->X, XYS->Y);
+	if (XYF == 0)	printf("Punkt mit den Koordenaten %.3f,%.3f nicht gefunden\n", XYS->X, XYS->Y);
+	else         	printf("Punkt mit den Koordenaten %.3f,%.3f gefunden\n", XYF->X, XYF->Y);
+	delete XYS;
+
+
 	// Die erste Liste von Polylinien komplett löschen
 	delete PGL1;
 	PGL1 = 0;
@@ -183,11 +233,18 @@
 	// Jetzt der 3D Teil
 	/////////////////////////////////////////////
 
+	printf("\nXYZ wird getestet\n\n");
+
 	// Zuerst ein paar Punkte generieren
 	TXYZ *Pz11 = new TXYZ(1.0, 1.0, 1.0);
 	TXYZ *Pz12 = new TXYZ(9.0, 1.0, 2.0);
 	TXYZ *Pz13 = new TXYZ(9.0, 9.0, 3.0);
 	TXYZ *Pz14 = new TXYZ(1.0, 9.0, 4.0);
+	TXYZ *Pz15 = new TXYZ(1.0, 1.0, 5.0);
+	TXYZ *Pz16 = new TXYZ(9.0, 1.0, 6.0);
+	TXYZ *Pz17 = new TXYZ(9.0, 9.0, 7.0);
+	TXYZ *Pz18 = new TXYZ(1.0, 9.0, 8.0);
+	TXYZ *Pz19 = new TXYZ(1.0, 1.0, 9.0);
 
 	TXYZ *Pz21 = new TXYZ(3.0, 4.0, 5.0);
 	TXYZ *Pz22 = new TXYZ(7.0, 4.0, 6.0);
@@ -199,6 +256,11 @@
 	if (Pz12 == 0)	return (TestNr);
 	if (Pz13 == 0)	return (TestNr);
 	if (Pz14 == 0)	return (TestNr);
+	if (Pz15 == 0)	return (TestNr);
+	if (Pz16 == 0)	return (TestNr);
+	if (Pz17 == 0)	return (TestNr);
+	if (Pz18 == 0)	return (TestNr);
+	if (Pz19 == 0)	return (TestNr);
 	if (Pz21 == 0)	return (TestNr);
 	if (Pz22 == 0)	return (TestNr);
 	if (Pz23 == 0)	return (TestNr);
@@ -217,6 +279,11 @@
 	PLz1->push_back(Pz12);
 	PLz1->push_back(Pz13);
 	PLz1->push_back(Pz14);
+	PLz1->push_back(Pz15);
+	PLz1->push_back(Pz16);
+	PLz1->push_back(Pz17);
+	PLz1->push_back(Pz18);
+	PLz1->push_back(Pz19);
 
 	// Ein paar Punkte zur zweiten Polylinie zuweisen
 	PLz2->push_back(Pz21);
@@ -234,26 +301,392 @@
 	// Alles ausgeben
 
 	printf("Anzahl Punktepaare in 3D-PunkteListe: %d\n", PLz1->size());
-
 	for (unsigned int j=0; j<PLz1->size(); j++)
 	{
 		TXYZ *XYZ = (*PLz1)[j];
-
-		printf("Koordinaten von Punkt %d: %.3f,%.3f,%.3f\n", j, XYZ->X, XYZ->Y, XYZ->Z);
+		printf("Koordinaten von Punkt %d: %.3f,%.3f,%.3f\n%s\n", j, XYZ->X, XYZ->Y, XYZ->Z, UnsignedInt64ToDez(XYZ->XYKombi).c_str());
 	}
 
 	printf("Anzahl Punktepaare in 3D-PunkteListe: %d\n", PLz2->size());
-
 	for (unsigned int j=0; j<PLz2->size(); j++)
 	{
 		TXYZ *XYZ = (*PLz2)[j];
+		printf("Koordinaten von Punkt %d: %.3f,%.3f,%.3f\n%s\n", j, XYZ->X, XYZ->Y, XYZ->Z, UnsignedInt64ToDez(XYZ->XYKombi).c_str());
+	}
 
-		printf("Koordinaten von Punkt %d: %.3f,%.3f,%.3f\n", j, XYZ->X, XYZ->Y, XYZ->Z);
+	printf("Anzahl Punktepaare in 3D-PunkteListe: %d\n", PLz3->size());
+	for (unsigned int j=0; j<PLz3->size(); j++)
+	{
+		TXYZ *XYZ = (*PLz3)[j];
+		printf("Koordinaten von Punkt %d: %.3f,%.3f,%.3f\n%s\n", j, XYZ->X, XYZ->Y, XYZ->Z, UnsignedInt64ToDez(XYZ->XYKombi).c_str());
 	}
 
+	printf("\nXYZ sortieren wird getestet\n\n");
+
+	PLz1->SortByXY();
+
+	printf("Anzahl Punktepaare in 3D-PunkteListe: %d\n", PLz1->size());
+
+	for (unsigned int j=0; j<PLz1->size(); j++)
+	{
+		TXYZ *XYZ = (*PLz1)[j];
+
+		printf("Koordinaten von Punkt %d: %.3f,%.3f,%.3f\n%s\n", j, XYZ->X, XYZ->Y, XYZ->Z, UnsignedInt64ToDez(XYZ->XYKombi).c_str());
+	}
+
+	printf("\nXYZ Suchen wird getestet\n\n");
+
+	TXYZ *XYZS = (*PLz1)[3];
+	TXYZ *XYZF = PLz1->FindByXY(XYZS->X, XYZS->Y);
+	if (XYZF == 0)	printf("Punkt %d: %.3f,%.3f,%.3f nicht gefunden\n", 3, XYZS->X, XYZS->Y, XYZS->Z);
+	else            printf("Punkt %d: %.3f,%.3f,%.3f gefunden\n", 3, XYZF->X, XYZF->Y, XYZF->Z);
+
+	XYS = (*PLz1)[0];
+	XYZF = PLz1->FindByXY(XYZS->X, XYZS->Y);
+	if (XYZF == 0)	printf("Punkt %d: %.3f,%.3f,%.3f nicht gefunden\n", 0, XYZS->X, XYZS->Y, XYZS->Z);
+	else            printf("Punkt %d: %.3f,%.3f,%.3f gefunden\n", 0, XYZF->X, XYZF->Y, XYZF->Z);
+
+	XYZS = new TXYZ(9.0, 9.0, 1.0);
+	XYZF = PLz1->FindByXY(XYZS->X, XYZS->Y);
+	if (XYZF == 0)	printf("Punkt mit den Koordinaten %.3f,%.3f,%.3f nicht gefunden\n", XYZS->X, XYZS->Y, XYZS->Z);
+	else            printf("Punkt mit den Koordinaten %.3f,%.3f,%.3f gefunden\n", XYZF->X, XYZF->Y, XYZF->Z);
+	delete XYZS;
+
+	XYZS = new TXYZ(4.0, 7.0);
+	XYZF = PLz1->FindByXY(XYZS->X, XYZS->Y);
+	if (XYZF == 0)	printf("Punkt mit den Koordinaten %.3f,%.3f,%.3f nicht gefunden\n", XYZS->X, XYZS->Y, XYZS->Z);
+	else            printf("Punkt mit den Koordinaten %.3f,%.3f,%.3f gefunden\n", XYZF->X, XYZF->Y, XYZF->Z);
+	delete XYZS;
+
+
 	delete PLz1;
 	delete PLz2;
 	delete PLz3;
 
+
+
+	/////////////////////////////////////////////
+	// Jetzt der Node Teil
+	/////////////////////////////////////////////
+
+	printf("\nKnoten werden getestet\n\n");
+
+	// Zuerst ein paar Punkte generieren
+	TNode *N11 = new TNode(1, 1.0, 1.0, 1.0);
+	TNode *N12 = new TNode(2, 9.0, 1.0, 2.0);
+	TNode *N13 = new TNode(3, 9.0, 9.0, 3.0);
+	TNode *N14 = new TNode(4, 1.0, 9.0, 4.0);
+	TNode *N15 = new TNode(5, 1.0, 1.0, 5.0);
+	TNode *N16 = new TNode(6, 9.0, 1.0, 6.0);
+	TNode *N17 = new TNode(7, 9.0, 9.0, 7.0);
+	TNode *N18 = new TNode(8, 1.0, 9.0, 8.0);
+	TNode *N19 = new TNode(9, 1.0, 1.0, 9.0);
+
+	TNode *N21 = new TNode(1, 3.0, 4.0, 5.0);
+	TNode *N22 = new TNode(2, 7.0, 4.0, 6.0);
+	TNode *N23 = new TNode(3, 7.0, 6.0, 7.0);
+	TNode *N24 = new TNode(4, 3.0, 6.0, 8.0);
+	TNode *N25 = new TNode(N15);
+
+	if (N11 == 0)	return (TestNr);
+	if (N12 == 0)	return (TestNr);
+	if (N13 == 0)	return (TestNr);
+	if (N14 == 0)	return (TestNr);
+	if (N15 == 0)	return (TestNr);
+	if (N16 == 0)	return (TestNr);
+	if (N17 == 0)	return (TestNr);
+	if (N18 == 0)	return (TestNr);
+	if (N19 == 0)	return (TestNr);
+	if (N21 == 0)	return (TestNr);
+	if (N22 == 0)	return (TestNr);
+	if (N23 == 0)	return (TestNr);
+	if (N24 == 0)	return (TestNr);
+	if (N25 == 0)	return (TestNr);
+
+	// Jetzt zwei leer PolyliniePolygone generieren
+	TNodeList *NL1 = new TNodeList();
+	TNodeList *NL2 = new TNodeList();
+
+	if (NL1 == 0)	return (TestNr);
+	if (NL2 == 0)	return (TestNr);
+
+	// Ein paar Punkte zur ersten Polylinie zuweisen
+	NL1->push_back(N11);
+	NL1->push_back(N12);
+	NL1->push_back(N13);
+	NL1->push_back(N14);
+	NL1->push_back(N15);
+	NL1->push_back(N16);
+	NL1->push_back(N17);
+	NL1->push_back(N18);
+	NL1->push_back(N19);
+		// Ein paar Punkte zur zweiten Polylinie zuweisen
+	NL2->push_back(N21);
+	NL2->push_back(N22);
+	NL2->push_back(N23);
+	NL2->push_back(N24);
+	NL2->push_back(N25);
+
+	// die zweite Polylinie verdoppeln
+	// Dabei werden alle Punkte mit verdoppelt
+	TNodeList *NL3 = NL2->Copy();
+
+	if (NL3 == 0)	return (TestNr);
+
+	// Alles ausgeben
+
+	printf("Anzahl Punktepaare in 3D-PunkteListe: %d\n", NL1->size());
+	for (unsigned int j=0; j<NL1->size(); j++)
+	{
+		TNode *Node = (*NL1)[j];
+		printf("Koordinaten von Knoten %d: %d, %.3f,%.3f,%.3f\n%s\n", j, Node->Nr, Node->X, Node->Y, Node->Z, UnsignedInt64ToDez(Node->XYKombi).c_str());
+	}
+
+	printf("Anzahl Punktepaare in 3D-PunkteListe: %d\n", NL2->size());
+	for (unsigned int j=0; j<NL2->size(); j++)
+	{
+		TNode *Node = (*NL2)[j];
+		printf("Koordinaten von Knoten %d: %d, %.3f,%.3f,%.3f\n%s\n", j, Node->Nr, Node->X, Node->Y, Node->Z, UnsignedInt64ToDez(Node->XYKombi).c_str());
+	}
+
+	printf("Anzahl Punktepaare in 3D-PunkteListe: %d\n", NL3->size());
+	for (unsigned int j=0; j<NL3->size(); j++)
+	{
+		TNode *Node = (*NL3)[j];
+		printf("Koordinaten von Knoten %d: %d, %.3f,%.3f,%.3f\n%s\n", j, Node->Nr, Node->X, Node->Y, Node->Z, UnsignedInt64ToDez(Node->XYKombi).c_str());
+	}
+
+	printf("\nNode nach XY sortieren wird getestet\n\n");
+
+	NL1->SortByXY();
+
+	printf("Anzahl Punktepaare in 3D-PunkteListe: %d\n", NL1->size());
+	for (unsigned int j=0; j<NL1->size(); j++)
+	{
+		TNode *Node = (*NL1)[j];
+		printf("Koordinaten von Knoten %d: %d, %.3f,%.3f,%.3f\n%s\n", j, Node->Nr, Node->X, Node->Y, Node->Z, UnsignedInt64ToDez(Node->XYKombi).c_str());
+	}
+
+	printf("\nNode Suchen XY wird getestet\n\n");
+
+	TNode *NodeS = (*NL1)[3];
+	TNode *NodeF = NL1->FindByXY(NodeS->X, NodeS->Y);
+	if (NodeF == 0)	printf("Knoten %d: %d, %.3f,%.3f,%.3f nicht gefunden\n", 3, NodeS->Nr, NodeS->X, NodeS->Y, NodeS->Z);
+	else            printf("Knoten %d: %d, %.3f,%.3f,%.3f gefunden\n", 3, NodeF->Nr, NodeF->X, NodeF->Y, NodeF->Z);
+
+	NodeS = (*NL1)[0];
+	NodeF = NL1->FindByXY(NodeS->X, NodeS->Y);
+	if (NodeF == 0)	printf("Knoten %d: %d, %.3f,%.3f,%.3f nicht gefunden\n", 0, NodeS->Nr, NodeS->X, NodeS->Y, NodeS->Z);
+	else            printf("Knoten %d: %d, %.3f,%.3f,%.3f gefunden\n", 0, NodeF->Nr, NodeF->X, NodeF->Y, NodeF->Z);
+
+	NodeS = new TNode(1.0, 9.0, 9.0, 1.0);
+	NodeF = NL1->FindByXY(NodeS->X, NodeS->Y);
+	if (NodeF == 0)	printf("Knoten mit den Werten %d, %.3f,%.3f,%.3f nicht gefunden\n", NodeS->Nr, NodeS->X, NodeS->Y, NodeS->Z);
+	else            printf("Knoten mit den Werten %d, %.3f,%.3f,%.3f gefunden\n", NodeF->Nr, NodeF->X, NodeF->Y, NodeF->Z);
+	delete NodeS;
+
+	NodeS = new TNode(1, 4.0, 7.0, 2.0);
+	NodeF = NL1->FindByXY(NodeS->X, NodeS->Y);
+	if (NodeF == 0)	printf("Knoten mit den Werten %d, %.3f,%.3f,%.3f nicht gefunden\n", NodeS->Nr, NodeS->X, NodeS->Y, NodeS->Z);
+	else            printf("Knoten mit den Werten %d, %.3f,%.3f,%.3f gefunden\n", 3, NodeF->Nr, NodeF->X, NodeF->Y, NodeF->Z);
+	delete NodeS;
+
+
+	printf("\nNode nach Nr sortieren wird getestet\n\n");
+
+	NL1->SortByNr();
+
+	printf("Anzahl Punktepaare in 3D-PunkteListe: %d\n", NL1->size());
+	for (unsigned int j=0; j<NL1->size(); j++)
+	{
+		TNode *Node = (*NL1)[j];
+		printf("Koordinaten von Knoten %d: %d, %.3f,%.3f,%.3f\n%s\n", j, Node->Nr, Node->X, Node->Y, Node->Z, UnsignedInt64ToDez(Node->XYKombi).c_str());
+	}
+
+	printf("\nNode Suchen Nr wird getestet\n\n");
+
+	NodeS = (*NL1)[3];
+	NodeF = NL1->FindByNr(NodeS->Nr);
+	if (NodeF == 0)	printf("Knoten %d: %d, %.3f,%.3f,%.3f nicht gefunden\n", 3, NodeS->Nr, NodeS->X, NodeS->Y, NodeS->Z);
+	else            printf("Knoten %d: %d, %.3f,%.3f,%.3f gefunden\n", 3, NodeF->Nr, NodeF->X, NodeF->Y, NodeF->Z);
+
+	NodeS = (*NL1)[0];
+	NodeF = NL1->FindByNr(NodeS->Nr);
+	if (NodeF == 0)	printf("Knoten %d: %d, %.3f,%.3f,%.3f nicht gefunden\n", 0, NodeS->Nr, NodeS->X, NodeS->Y, NodeS->Z);
+	else            printf("Knoten %d: %d, %.3f,%.3f,%.3f gefunden\n", 0, NodeF->Nr, NodeF->X, NodeF->Y, NodeF->Z);
+
+	NodeS = new TNode(7, 9.0, 9.0, 1.0);
+	NodeF = NL1->FindByNr(NodeS->Nr);
+	if (NodeF == 0)	printf("Knoten mit den Werten %d, %.3f,%.3f,%.3f nicht gefunden\n", NodeS->Nr, NodeS->X, NodeS->Y, NodeS->Z);
+	else            printf("Knoten mit den Werten %d, %.3f,%.3f,%.3f gefunden\n", NodeF->Nr, NodeF->X, NodeF->Y, NodeF->Z);
+	delete NodeS;
+
+	NodeS = new TNode(10, 4.0, 7.0, 2.0);
+	NodeF = NL1->FindByNr(NodeS->Nr);
+	if (NodeF == 0)	printf("Knoten mit den Werten %d, %.3f,%.3f,%.3f nicht gefunden\n", NodeS->Nr, NodeS->X, NodeS->Y, NodeS->Z);
+	else            printf("Knoten mit den Werten %d, %.3f,%.3f,%.3f gefunden\n", NodeF->Nr, NodeF->X, NodeF->Y, NodeF->Z);
+	delete NodeS;
+
+
+	/////////////////////////////////////////////
+	// Jetzt der Edge Teil
+	/////////////////////////////////////////////
+
+	printf("\nKanten werden getestet\n\n");
+
+	TEdge *Edge1 = new TEdge((*NL1)[0], (*NL1)[1]);
+	TEdge *Edge2 = new TEdge((*NL1)[1], (*NL1)[2]);
+	TEdge *Edge3 = new TEdge((*NL1)[2], (*NL1)[0]);
+	TEdge *Edge4 = new TEdge((*NL1)[0], (*NL1)[3]);
+	TEdge *Edge5 = new TEdge((*NL1)[3], (*NL1)[4]);
+	TEdge *Edge6 = 0;
+	try
+	{
+		Edge6 = new TEdge((*NL1)[4], (*NL1)[0]);
+	}
+	catch(TFehler)
+	{
+		printf ("Fehler korrekt gefangen\n");
+		Edge6 = new TEdge((*NL1)[5], (*NL1)[0]);
+	}
+	TEdge *Edge7 = new TEdge(Edge3);
+
+	TEdgeList *EL = new TEdgeList();
+
+	EL->push_back(Edge1);
+	EL->push_back(Edge2);
+	EL->push_back(Edge3);
+	EL->push_back(Edge4);
+	EL->push_back(Edge5);
+	EL->push_back(Edge6);
+	EL->push_back(Edge7);
+
+	printf("Anzahl Kanten in Kantenliste: %d\n", EL->size());
+	for (unsigned int j=0; j<EL->size(); j++)
+	{
+		TEdge *Edge = (*EL)[j];
+		printf("Koordinaten der Kante %d: Knoten 1 %d,%.3f,%.3f,%.3f Knoten 2 %d,%.3f,%.3f,%.3f\n", j, Edge->Node1->Nr, Edge->Node1->X, Edge->Node1->Y, Edge->Node1->Z, Edge->Node2->Nr, Edge->Node2->X, Edge->Node2->Y, Edge->Node2->Z);
+	}
+
+	printf("\nKanten nach Nr sortieren wird getestet\n\n");
+
+	EL->SortByNr();
+
+	printf("Anzahl Kanten in Kantenliste: %d\n", EL->size());
+	for (unsigned int j=0; j<EL->size(); j++)
+	{
+		TEdge *Edge = (*EL)[j];
+		printf("Koordinaten der Kante %d: Distance %8.3f Knoten 1 %d,%.3f,%.3f,%.3f Knoten 2 %d,%.3f,%.3f,%.3f\n", j, Edge->Distance, Edge->Node1->Nr, Edge->Node1->X, Edge->Node1->Y, Edge->Node1->Z, Edge->Node2->Nr, Edge->Node2->X, Edge->Node2->Y, Edge->Node2->Z);
+	}
+
+	printf("\nKanten nach Distance sortieren wird getestet\n\n");
+
+	EL->SortByDistance();
+
+	printf("Anzahl Kanten in Kantenliste: %d\n", EL->size());
+	for (unsigned int j=0; j<EL->size(); j++)
+	{
+		TEdge *Edge = (*EL)[j];
+		printf("Koordinaten der Kante %d: Distance %8.3f Knoten 1 %d,%.3f,%.3f,%.3f Knoten 2 %d,%.3f,%.3f,%.3f\n", j, Edge->Distance, Edge->Node1->Nr, Edge->Node1->X, Edge->Node1->Y, Edge->Node1->Z, Edge->Node2->Nr, Edge->Node2->X, Edge->Node2->Y, Edge->Node2->Z);
+	}
+
+
+	printf("\nKantenindex wird getestet\n\n");
+
+	EL->BuildEdgeIndex();
+
+	printf("Anzahl Kanten in Kantenliste: %d\n", EL->size());
+
+	for (unsigned int j=0; j<NL1->size(); j++)
+	{
+		TNode *Node = (*NL1)[j];
+
+		TEdgeIndex *AktEdgeIndex = Node->EdgeIndex;
+		while (AktEdgeIndex)
+		{
+			TEdge *Edge = AktEdgeIndex->Edge;
+
+			TNode *Node1 = Edge->Node1;
+			TNode *Node2 = Edge->Node2;
+
+			printf("Kante die den Knoten %d als Enden haben: (%d,%d)\n", Node->Nr, Node1->Nr, Node2->Nr);
+
+			AktEdgeIndex = AktEdgeIndex->NextEdgeIndex;
+		}
+	}
+
+	delete EL;
+
+
+	/////////////////////////////////////////////
+	// Jetzt der Element Teil
+	/////////////////////////////////////////////
+
+	printf("\nElemente werden getestet\n\n");
+
+	TElement* Element1 = new TElement((*NL1)[0], (*NL1)[1], (*NL1)[2]);
+	TElement* Element2 = new TElement((*NL1)[0], (*NL1)[1], (*NL1)[3]);
+	TElement* Element3 = new TElement((*NL1)[1], (*NL1)[3], (*NL1)[4], (*NL1)[5]);
+	TElement* Element4 = new TElement((*NL1)[4], (*NL1)[5], (*NL1)[6], (*NL1)[7]);
+
+	TElementList* ElL = new TElementList();
+
+	ElL->push_back(Element1);
+	ElL->push_back(Element2);
+	ElL->push_back(Element3);
+	ElL->push_back(Element4);
+
+	printf("Anzahl Elemente in Elementliste: %d\n", ElL->size());
+	for (unsigned int j=0; j<ElL->size(); j++)
+	{
+		TElement *Element = (*ElL)[j];
+		TNodeList *NL = Element->NodeList;
+
+		printf("Knoten die das Element %d bilden:", j);
+		for (unsigned int i = 0; i < NL->size(); i++)
+		{
+			TNode *Node = (*NL)[i];
+			printf(" %d", Node->Nr);
+		}
+		printf("\n");
+	}
+
+	printf("\nÜberprüfen, ob ein Punkt innerhalb oder ausserhalb eines Elements liegt\n\n");
+
+	TElement *Element = (*ElL)[0];
+	TNodeList *NL = Element->NodeList;
+
+	printf("Knoten die das Element %d bilden:\n", 0);
+	for (unsigned int i = 0; i < NL->size(); i++)
+	{
+		TNode *Node = (*NL)[i];
+		printf(" %d (%.3f,%.3f,%.3f)\n", Node->Nr, Node->X, Node->Y, Node->Z);
+	}
+	printf("\n");
+
+	double X = 6.0;
+	double Y = 3.0;
+	if (Element->IsInElement(X, Y))	printf("(%.3f, %.3f) ist im Element\n", X, Y);
+	else							printf("(%.3f, %.3f) ist nicht im Element\n", X, Y);
+
+	X = 3.0;
+	Y = 6.0;
+	if (Element->IsInElement(X, Y))	printf("(%.3f, %.3f) ist im Element\n", X, Y);
+	else							printf("(%.3f, %.3f) ist nicht im Element\n", X, Y);
+
+
+	delete ElL;
+
+	delete NL1;
+	delete NL2;
+	delete NL3;
+
 	return (0);
 }
+
+
+
+
+
+
+

Modified: trunk/src/tools.cpp
===================================================================
--- trunk/src/tools.cpp	2006-01-09 20:37:25 UTC (rev 25)
+++ trunk/src/tools.cpp	2006-01-10 21:53:01 UTC (rev 26)
@@ -11,13 +11,20 @@
 //
 
 //---------------------------------------------------------------------------
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdarg.h>
 #include "tools.h"
 
 //---------------------------------------------------------------------------
+extern int ReturnCode;
+
+//---------------------------------------------------------------------------
+//
+// Diese Routine ist für das Abfangen von Zuständen zuständig, die
+// eigentlich nie eintreten sollen.
+//
+//---------------------------------------------------------------------------
 void	dump_error(char *file, int line, char *format, ...)
 {
 	char *p = file;
@@ -29,19 +36,75 @@
 		if (*p == '\\' || *p == '/') p++;
 	}
 
-	printf("Datei: %s\n", p);
-	printf("Zeile: %d\n", line);
+	fprintf(stderr, "Datei: %s\n", p);
+	fprintf(stderr, "Zeile: %d\n", line);
 
 	va_list argptr;
 
 	va_start(argptr, format);
-	vprintf(format, argptr);
+	vfprintf(stderr, format, argptr);
 	va_end(argptr);
 
-	throw fehler("Fehler");
+	// Hier sollte das Programm eigentlich nie hinkommen,
+	// deshalb wird hier auch kein 'sinnvoller' Rückgabewert definiert
+	ReturnCode = 9298;
+
+	throw TFehler("Fehler");
 }
 
 //---------------------------------------------------------------------------
+//
+// Diese Routine beendet das Programm
+//
+//---------------------------------------------------------------------------
+void	write_error(int ErrorNr, char *format, ...)
+{
+	fprintf(stderr, "->Fehler (%d)\n", ErrorNr);
+
+	va_list argptr;
+
+	va_start(argptr, format);
+	vfprintf(stderr, format, argptr);
+	va_end(argptr);
+
+	// Fehler sind wichtiger als Warningen,
+	// deshalb wird der Wert hier immer überschrieben
+	ReturnCode = ErrorNr;
+
+	throw TFehler("Fehler");
+}
+
+//---------------------------------------------------------------------------
+//
+// Nach einer Warnung geht es weiter,
+// wie lange wird man sehen ;-)
+//
+//---------------------------------------------------------------------------
+void	write_warning(int WarningNr, char *format, ...)
+{
+	fprintf(stderr, "->Warnung (%d)\n", WarningNr);
+
+	va_list argptr;
+
+	va_start(argptr, format);
+	vfprintf(stderr, format, argptr);
+	va_end(argptr);
+
+	// Es wird immer die Nummer der ersten Warnung zurückgegeben
+	if (ReturnCode == 0) ReturnCode = WarningNr;
+}
+
+//---------------------------------------------------------------------------
+void	write_fortschritt(char *format, ...)
+{
+	va_list argptr;
+
+	va_start(argptr, format);
+	vfprintf(stdout, format, argptr);
+	va_end(argptr);
+}
+
+//---------------------------------------------------------------------------
 std::string UnsignedInt32ToBin (unsigned long Value, char *Spaces)
 {
 	std::string Line = "";
@@ -79,7 +142,7 @@
 	std::string Line = "";
 	for (unsigned int i=0; i<21; i++)
 	{
-		int Ziffer = Value % 10;
+		int Ziffer = (int)(Value % 10);
 
 		switch (Ziffer)
 		{
@@ -131,4 +194,250 @@
 
 	return (Kombi);
 }
+//---------------------------------------------------------------------------
+int IsInside(TXYList *p, double x, double y)
+{
+	if (p == 0) return (-2);
 
+	unsigned int AnzPoints = p->size();
+
+	if (AnzPoints <= 0) return (-1);
+
+	// Der letzte Punkt wird so zum ersten Punkt
+	TXY *Xy = (*p)[AnzPoints-1-1];
+	int ax = Xy->X;
+	int ay = Xy->Y;
+
+	int aQ = -1;
+	if (ay <= y)
+	{
+		if (ax <= x)	aQ = 0;
+		else            aQ = 1;
+	}
+	else if (ax <= x)   aQ = 3;
+	else                aQ = 2;
+
+	int alpha = 0;
+	for (unsigned int i = 0; i < AnzPoints; i++)
+	{
+		TXY *Xy = (*p)[i];
+		int bx = Xy->X;
+		int by = Xy->Y;
+
+		int bQ = -1;
+		if (by <= y)
+		{
+			if (bx <= x)	bQ = 0;
+			else            bQ = 1;
+		}
+		else if (bx <= x)	bQ = 3;
+		else             	bQ = 2;
+
+		switch ((bQ - aQ) & 3)
+		{
+			case 0 :
+				break;
+			case 1 :
+				alpha++;
+				break;
+			case 3 :
+				alpha--;
+				break;
+			default :
+			{
+				int zx = (bx - ax) * (y - ay) / (by - ay) + ax;
+
+				if (x == zx)	return (0);
+
+				if ((x > zx) == (by > ay)) 	alpha = alpha - 2;
+				else                       	alpha = alpha + 2;
+			}
+		}
+
+		ax = bx;
+		ay = by;
+		aQ = bQ;
+	}
+
+	switch (alpha)
+	{
+		case 0 :
+		{
+			return (-1);
+		}
+		case 4 :
+		case -4 :
+		{
+			return (1);
+		}
+		default :
+		{
+			if ((alpha & 3) == 0)
+			{
+				// Das waere ein "geringeltes" Polygon..
+				return (alpha);
+			}
+		}
+	}
+	// ... und das ein Programmierfehler.
+	dump_error(__FILE__, __LINE__, "Dies ist eine Logischer Fehler im Programm.\n");
+
+	// ... Hier kommt man nicht mehr hin
+	return (0);
+}
+
+//---------------------------------------------------------------------------
+int IsInside(TXYZList *p, double x, double y)
+{
+	if (p == 0) return (-3);
+
+	unsigned int AnzPoints = p->size();
+
+	if (AnzPoints <= 0) return (-2);
+
+	// Der letzte Punkt wird so zum ersten Punkt
+	TXYZ *Xy = (*p)[AnzPoints-1-1];
+	int ax = Xy->X;
+	int ay = Xy->Y;
+
+	int aQ = -1;
+	if (ay <= y)
+	{
+		if (ax <= x)	aQ = 0;
+		else            aQ = 1;
+	}
+	else if (ax <= x)   aQ = 3;
+	else                aQ = 2;
+
+	int alpha = 0;
+	for (unsigned int i = 0; i < AnzPoints; i++)
+	{
+		TXYZ *Xy = (*p)[i];
+		int bx = Xy->X;
+		int by = Xy->Y;
+
+		int bQ = -1;
+		if (by <= y)
+		{
+			if (bx <= x)	bQ = 0;
+			else            bQ = 1;
+		}
+		else if (bx <= x)	bQ = 3;
+		else             	bQ = 2;
+
+		switch ((bQ - aQ) & 3)
+		{
+			case 0 :
+				break;
+			case 1 :
+				alpha++;
+				break;
+			case 3 :
+				alpha--;
+				break;
+			default :
+			{
+				int zx = (bx - ax) * (y - ay) / (by - ay) + ax;
+
+				if (x == zx)	return (0);
+
+				if ((x > zx) == (by > ay)) 	alpha = alpha - 2;
+				else                       	alpha = alpha + 2;
+			}
+		}
+
+		ax = bx;
+		ay = by;
+		aQ = bQ;
+	}
+
+	switch (alpha)
+	{
+		case 0 :
+		{
+			return (0);
+		}
+		case 4 :
+		{
+			return (4);
+		}
+		case -4 :
+		{
+			return (-4);
+		}
+		default :
+		{
+			if ((alpha & 3) == 0)
+			{
+				// Das waere ein "geringeltes" Polygon..
+				return (alpha);
+			}
+		}
+	}
+	// ... und das ein Programmierfehler.
+	dump_error(__FILE__, __LINE__, "Dies ist eine Logischer Fehler im Programm.\n");
+
+	// ... Hier kommt man nicht mehr hin
+	return (-3);
+}
+
+//---------------------------------------------------------------------------
+int IsInside(TNodeList *p, double x, double y)
+{
+	unsigned int AnzPoints = p->size();
+
+	if (AnzPoints <= 0) return (-1);
+
+	// Der letzte Punkt wird so zum ersten Punkt
+	TNode *Xy = (*p)[AnzPoints-1];
+	int ax = Xy->X;
+	int ay = Xy->Y;
+
+	int aQ = -1;
+	if (ay <= y)
+	{
+		if (ax <= x)	aQ = 0;
+		else            aQ = 1;
+	}
+	else if (ax <= x)   aQ = 3;
+	else                aQ = 2;
+
+	int alpha = 0;
+	for (unsigned int i = 0; i < AnzPoints; i++)
+	{
+		TNode *Xy = (*p)[i];
+		int bx = Xy->X;
+		int by = Xy->Y;
+
+		int bQ = -1;
+		if (by <= y)
+		{
+			if (bx <= x)	bQ = 0;
+			else            bQ = 1;
+		}
+		else if (bx <= x)	bQ = 3;
+		else             	bQ = 2;
+
+		if (bQ == aQ)	continue;
+
+		if (bQ == (aQ + 1) % 4)	alpha++;
+		if (bQ == (aQ + 3) % 4)	alpha--;
+
+		if (bQ == (aQ + 2) % 4)
+		{
+			int zx = (bx - ax) * (y - ay) / (by - ay) + ax;
+
+			if (x == zx)	return (0);
+
+			if ((x > zx) == (by > ay)) 	alpha = alpha - 2;
+			else                       	alpha = alpha + 2;
+		}
+
+		ax = bx;
+		ay = by;
+		aQ = bQ;
+	}
+
+	return (alpha);
+}
+

Modified: trunk/src/tools.h
===================================================================
--- trunk/src/tools.h	2006-01-09 20:37:25 UTC (rev 25)
+++ trunk/src/tools.h	2006-01-10 21:53:01 UTC (rev 26)
@@ -14,35 +14,35 @@
 #ifndef TOOLSH
 #define TOOLSH
 
-#ifdef __BORLANDC__
-#define INT64			__int64
-#define INT64SUFF(x)	x##L
-int i = tt;
-#else
-#define INT64			long long int
-#define INT64SUFF(x)	x##ULL
-#endif
-
 //----------------------------------------------------------------------------
 #include <string>
+#include <stdio.h>
+#include "xy.h"
 
 //---------------------------------------------------------------------------
-struct fehler
+struct TFehler
 {
 	std::string Fehlermeldung;
 
-	fehler(std::string fehlermeldung)
+	TFehler(std::string fehlermeldung)
 	{
 		Fehlermeldung = fehlermeldung;
 	}
 };
 
 //---------------------------------------------------------------------------
-void			dump_error(char *file, int line, char *format, ...);
-std::string		UnsignedInt32ToBin (unsigned long Value, char *Spaces);
-std::string		UnsignedInt64ToBin (unsigned INT64 Value);
-std::string 	UnsignedInt64ToDez (unsigned INT64 Value);
+void		  	dump_error(char *file, int line, char *format, ...);
+void			write_error(int ErrorNr,char *format, ...);
+void			write_warning(int WarningNr, char *format, ...);
+void			write_fortschritt(char *format, ...);
+std::string	  	UnsignedInt32ToBin (unsigned long Value, char *Spaces);
+std::string	  	UnsignedInt64ToBin (unsigned INT64 Value);
+std::string   	UnsignedInt64ToDez (unsigned INT64 Value);
 unsigned INT64 	CalcXYKombi (double X, double Y);
+int 			IsInside(TXYList *p, double x, double y);
+int 			IsInside(TXYZList *p, double x, double y);
+int 			IsInside(TNodeList *p, double x, double y);
 
 //---------------------------------------------------------------------------
 #endif
+

Added: trunk/src/wsplgen.cpp
===================================================================
--- trunk/src/wsplgen.cpp	2006-01-09 20:37:25 UTC (rev 25)
+++ trunk/src/wsplgen.cpp	2006-01-10 21:53:01 UTC (rev 26)
@@ -0,0 +1,27 @@
+//---------------------------------------------------------------------------
+#include "parameter.h"
+#include "tools.h"
+
+int ReturnCode = 0;
+
+//---------------------------------------------------------------------------
+int main(int argc, char **argv)
+{
+	try
+	{
+		TParameter Parameter(argc, argv);
+	}
+	catch (TFehler fehler)
+	{
+		return (ReturnCode);
+	}
+	catch (...)
+	{
+		printf ("Unbekannter Fehler nicht korrekt abgefangen\n");
+		printf ("Programmabbruch\n");
+		return (9299);
+	}
+
+	return (ReturnCode);
+}
+//---------------------------------------------------------------------------

Added: trunk/src/wsplgen.h
===================================================================

Modified: trunk/src/xy.cpp
===================================================================
--- trunk/src/xy.cpp	2006-01-09 20:37:25 UTC (rev 25)
+++ trunk/src/xy.cpp	2006-01-10 21:53:01 UTC (rev 26)
@@ -11,26 +11,56 @@
 //
 
 //---------------------------------------------------------------------------
+#include <algorithm>
+#include <math.h>
+
 #include "xy.h"
 
+#include "tools.h"
+
+//----------------------------------------------------------------------------
+static const unsigned int 	MaxXYKombiIndexAnzahlKonst = 10;
+static const double 		MinNodeDistanceKonst = 0.01;
+
 //---------------------------------------------------------------------
+// TXY
+//---------------------------------------------------------------------
+
+//---------------------------------------------------------------------
 TXY::TXY(double x, double y)
 {
 	X = x;
 	Y = y;
+	XYKombi = CalcXYKombi(X, Y);
 }
 
 //---------------------------------------------------------------------
-TXY::TXY(TXY *Xy)
+TXY::TXY(TXY *xy)
 {
-	X = Xy->X;
-	Y = Xy->Y;
+	X = xy->X;
+	Y = xy->Y;
+	XYKombi = xy->XYKombi;
 }
 
+//---------------------------------------------------------------------
+struct TXYSort
+{
+	 bool operator()(TXY* const &XY1, TXY* const &XY2)
+	 {
+		  return(XY1->XYKombi < XY2->XYKombi);
+	 }
+};
 
+//---------------------------------------------------------------------
+// TXYZ
+//---------------------------------------------------------------------
 
+//---------------------------------------------------------------------
+TXYZ::TXYZ(double x, double y) : TXY (x, y)
+{
+	Z = -999999.0;
+}
 
-
 //---------------------------------------------------------------------
 TXYZ::TXYZ(double x, double y, double z) : TXY (x, y)
 {
@@ -38,18 +68,443 @@
 }
 
 //---------------------------------------------------------------------
-TXYZ::TXYZ(TXYZ *Xyz) : TXY (Xyz->X, Xyz->Y)
+TXYZ::TXYZ(TXYZ *xyz) : TXY (xyz->X, xyz->Y)
 {
-	Z = Xyz->Z;
+	Z = xyz->Z;
 }
 
+//---------------------------------------------------------------------
+struct TXYZSort
+{
+	 bool operator()(TXYZ* const &XYZ1, TXYZ* const &XYZ2)
+	 {
+		  return(XYZ1->XYKombi < XYZ2->XYKombi);
+	 }
+};
 
+//---------------------------------------------------------------------
+// TNode
+//---------------------------------------------------------------------
 
+//---------------------------------------------------------------------
+TNode::TNode(int nr, double x, double y, double z) : TXYZ (x, y, z)
+{
+	Nr = nr;
+	Wsp = 0.0;
+	EdgeIndex = 0;
+}
 
+//---------------------------------------------------------------------
+TNode::TNode(TNode *node) : TXYZ (node->X, node->Y, node->Z)
+{
+	Nr = node->Nr;
+	Wsp = node->Wsp;
+	EdgeIndex = 0;
+}
 
+//---------------------------------------------------------------------
+TNode::~TNode(void)
+{
+	ClearEdgeIndex();
+}
+
+//---------------------------------------------------------------------
+void TNode::ClearEdgeIndex(void)
+{
+	TEdgeIndex *AktEdgeIndex = EdgeIndex;
+	while (AktEdgeIndex)
+	{
+		TEdgeIndex *NextEdgeIndex = AktEdgeIndex->NextEdgeIndex;
+		delete AktEdgeIndex;
+		AktEdgeIndex = NextEdgeIndex;
+	}
+	EdgeIndex = 0;
+}
+
+//---------------------------------------------------------------------
+struct TNodeSortByXY
+{
+	 bool operator()(TNode* const &Node1, TNode* const &Node2)
+	 {
+		  return(Node1->XYKombi < Node2->XYKombi);
+	 }
+};
+
+//---------------------------------------------------------------------
+struct TNodeSortByNr
+{
+	 bool operator()(TNode* const &Node1, TNode* const &Node2)
+	 {
+		  return(Node1->Nr < Node2->Nr);
+	 }
+};
+
+//---------------------------------------------------------------------
+// TElement
+//---------------------------------------------------------------------
+
+//---------------------------------------------------------------------
+TElement::TElement(TNode *Node1, TNode *Node2, TNode *Node3)
+{
+	Typ = TRI;
+
+	NodeList = new TNodeList();
+
+	NodeList->push_back(new TNode(Node1));
+	NodeList->push_back(new TNode(Node2));
+	NodeList->push_back(new TNode(Node3));
+}
+
+//---------------------------------------------------------------------
+TElement::TElement(TNode *Node1, TNode *Node2, TNode *Node3, TNode *Node4)
+{
+	Typ = QUAD;
+
+	NodeList = new TNodeList();
+
+	NodeList->push_back(new TNode(Node1));
+	NodeList->push_back(new TNode(Node2));
+	NodeList->push_back(new TNode(Node3));
+	NodeList->push_back(new TNode(Node4));
+}
+
+//---------------------------------------------------------------------
+TElement::TElement(TElement *element)
+{
+	Typ = element->Typ;
+
+	for (unsigned int i = 0; i < NodeList->size(); i++)
+	{
+		TNodeList *NL = element->NodeList;
+		TNode *Node = new TNode((*NL)[i]);
+
+		NodeList->push_back(Node);
+	}
+}
+
+//---------------------------------------------------------------------
+TElement::~TElement(void)
+{
+	delete NodeList;
+}
+
+//---------------------------------------------------------------------
+bool TElement::IsInElement(double X, double Y)
+{
+	IsInside(NodeList, X, Y);
+	return (true);
+}
+
+//---------------------------------------------------------------------
+// TXYKombiIndex
+//---------------------------------------------------------------------
+
+//---------------------------------------------------------------------
+TXYKombiIndex::TXYKombiIndex(void)
+{
+	Start = -1;
+	Anzahl = 0;
+	Zero = 0;
+	One = 0;
+}
+//---------------------------------------------------------------------
+TXYKombiIndex::~TXYKombiIndex(void)
+{
+	if (Zero)   delete Zero;
+	Zero = 0;
+
+	if (One)    delete One;
+	One = 0;
+}
+//---------------------------------------------------------------------
+void TXYKombiIndex::BuildFromXYList(TXYList *xylist, int start, int anzahl, unsigned INT64 Mask)
+{
+	Start = start;
+	Anzahl = anzahl;
+
+	if (Mask && Anzahl > MaxXYKombiIndexAnzahlKonst)
+	{
+		unsigned int i = 0;
+		while (i < Anzahl)
+		{
+			TXY *Xy = (*xylist)[Start+i];
+
+			if (Xy->XYKombi & Mask) break;
+			i++;
+		}
+
+		if (i > 0)
+		{
+			Zero = new TXYKombiIndex();
+			Zero->BuildFromXYList(xylist, Start, i, Mask / 2);
+		}
+
+		if (Anzahl - i > 0)
+		{
+			One = new TXYKombiIndex();
+			One->BuildFromXYList(xylist, Start + i, Anzahl-i, Mask / 2);
+		}
+	}
+}
+
+//---------------------------------------------------------------------
+void TXYKombiIndex::BuildFromXYZList(TXYZList *xyzlist, int start, int anzahl, unsigned INT64 Mask)
+{
+	Start = start;
+	Anzahl = anzahl;
+
+	if (Mask && Anzahl > MaxXYKombiIndexAnzahlKonst)
+	{
+		unsigned int i = 0;
+		while (i < Anzahl)
+		{
+			TXYZ *Xyz = (*xyzlist)[Start+i];
+
+			if (Xyz->XYKombi & Mask) break;
+			i++;
+		}
+
+		if (i > 0)
+		{
+			Zero = new TXYKombiIndex();
+			Zero->BuildFromXYZList(xyzlist, Start, i, Mask / 2);
+		}
+
+		if (Anzahl - i > 0)
+		{
+			One = new TXYKombiIndex();
+			One->BuildFromXYZList(xyzlist, Start + i, Anzahl-i, Mask / 2);
+		}
+	}
+}
+
+//---------------------------------------------------------------------
+void TXYKombiIndex::BuildFromNodeList(TNodeList *nodelist, int start, int anzahl, unsigned INT64 Mask)
+{
+	Start = start;
+	Anzahl = anzahl;
+
+	if (Mask && Anzahl > MaxXYKombiIndexAnzahlKonst)
+	{
+		unsigned int i = 0;
+		while (i < Anzahl)
+		{
+			TNode *Node = (*nodelist)[Start+i];
+
+			if (Node->XYKombi & Mask) break;
+			i++;
+		}
+
+		if (i > 0)
+		{
+			Zero = new TXYKombiIndex();
+			Zero->BuildFromNodeList(nodelist, Start, i, Mask / 2);
+		}
+
+		if (Anzahl - i > 0)
+		{
+			One = new TXYKombiIndex();
+			One->BuildFromNodeList(nodelist, Start + i, Anzahl-i, Mask / 2);
+		}
+	}
+}
+
+//---------------------------------------------------------------------
+int TXYKombiIndex::SearchInXYList(TXYList *xylist, double xmin, double ymin, double xmax, double ymax, bool leftright, unsigned INT64 XUnLi, unsigned INT64 YUnLi, unsigned INT64 XObRe, unsigned INT64 YObRe)
+{
+	if (Anzahl <= 0)
+	{
+		return (-1);
+	}
+
+	if (Zero == 0 && One == 0)
+	{
+		for (unsigned int i=0; i<Anzahl; i++)
+		{
+			TXY *Xy = (*xylist)[Start + i];
+
+			if (Xy->X >= xmin && Xy->X <= xmax && Xy->Y >= ymin && Xy->Y <= ymax)
+			{
+				return (Start + i);
+			}
+		}
+		return (-1);
+	}
+
+	if (xmin <= XUnLi && xmax >= XObRe && ymin <= YUnLi && ymax >= YObRe)
+	{
+		return (Start);
+	}
+
+	if (leftright)
+	{
+		unsigned INT64 X = XUnLi / 2 + XObRe / 2;
+		if ((unsigned INT64)xmin <= X && Zero)
+		{
+			int Index = Zero->SearchInXYList(xylist, xmin, ymin, xmax, ymax, !leftright, XUnLi, YUnLi, X, YObRe);
+			if (Index >= 0) return (Index);
+		}
+		X = X + 1;
+		if ((unsigned INT64)xmax >= X && One)
+		{
+			int Index = One->SearchInXYList(xylist, xmin, ymin, xmax, ymax, !leftright, X, YUnLi, XObRe, YObRe);
+			if (Index >= 0) return (Index);
+		}
+	}
+	else
+	{
+		unsigned INT64 Y = YUnLi / 2 + YObRe / 2;
+		if ((unsigned INT64)ymin <= Y && Zero)
+		{
+			int Index = Zero->SearchInXYList(xylist, xmin, ymin, xmax, ymax, !leftright, XUnLi, YUnLi, XObRe, Y);
+			if (Index >= 0) return (Index);
+		}
+		Y = Y + 1;
+		if ((unsigned INT64)ymax >= Y && One)
+		{
+			int Index = One->SearchInXYList(xylist, xmin, ymin, xmax, ymax, !leftright, XUnLi, Y, XObRe, YObRe);
+			if (Index >= 0) return (Index);
+		}
+	}
+	return (-1);
+}
+
+//---------------------------------------------------------------------
+int TXYKombiIndex::SearchInNodeList(TNodeList *nodelist, double xmin, double ymin, double xmax, double ymax, bool leftright, unsigned INT64 XUnLi, unsigned INT64 YUnLi, unsigned INT64 XObRe, unsigned INT64 YObRe)
+{
+	if (Anzahl <= 0)
+	{
+		return (-1);
+	}
+
+	if (Zero == 0 && One == 0)
+	{
+		for (unsigned int i=0; i<Anzahl; i++)
+		{
+			TNode *Node = (*nodelist)[Start + i];
+
+			if (Node->X >= xmin && Node->X <= xmax && Node->Y >= ymin && Node->Y <= ymax)
+			{
+				return (Start + i);
+			}
+		}
+		return (-1);
+	}
+
+	if (xmin <= XUnLi && xmax >= XObRe && ymin <= YUnLi && ymax >= YObRe)
+	{
+		return (Start);
+	}
+
+	if (leftright)
+	{
+		unsigned INT64 X = XUnLi / 2 + XObRe / 2;
+		if ((unsigned INT64)xmin <= X && Zero)
+		{
+			int Index = Zero->SearchInNodeList(nodelist, xmin, ymin, xmax, ymax, !leftright, XUnLi, YUnLi, X, YObRe);
+			if (Index >= 0) return (Index);
+		}
+		X = X + 1;
+		if ((unsigned INT64)xmax >= X && One)
+		{
+			int Index = One->SearchInNodeList(nodelist, xmin, ymin, xmax, ymax, !leftright, X, YUnLi, XObRe, YObRe);
+			if (Index >= 0) return (Index);
+		}
+	}
+	else
+	{
+		unsigned INT64 Y = YUnLi / 2 + YObRe / 2;
+		if ((unsigned INT64)ymin <= Y && Zero)
+		{
+			int Index = Zero->SearchInNodeList(nodelist, xmin, ymin, xmax, ymax, !leftright, XUnLi, YUnLi, XObRe, Y);
+			if (Index >= 0) return (Index);
+		}
+		Y = Y + 1;
+		if ((unsigned INT64)ymax >= Y && One)
+		{
+			int Index = One->SearchInNodeList(nodelist, xmin, ymin, xmax, ymax, !leftright, XUnLi, Y, XObRe, YObRe);
+			if (Index >= 0) return (Index);
+		}
+	}
+	return (-1);
+}
+
+//---------------------------------------------------------------------
+int TXYKombiIndex::SearchInXYZList(TXYZList *xyzlist, double xmin, double ymin, double xmax, double ymax, bool leftright, unsigned INT64 XUnLi, unsigned INT64 YUnLi, unsigned INT64 XObRe, unsigned INT64 YObRe)
+{
+	if (Anzahl <= 0)
+	{
+		return (-1);
+	}
+
+	if (Zero == 0 && One == 0)
+	{
+		for (unsigned int i=0; i<Anzahl; i++)
+		{
+			TXYZ *Xyz = (*xyzlist)[Start + i];
+
+			if (Xyz->X >= xmin && Xyz->X <= xmax && Xyz->Y >= ymin && Xyz->Y <= ymax)
+			{
+				return (Start + i);
+			}
+		}
+		return (-1);
+	}
+
+	if (xmin <= XUnLi && xmax >= XObRe && ymin <= YUnLi && ymax >= YObRe)
+	{
+		return (Start);
+	}
+
+	if (leftright)
+	{
+		unsigned INT64 X = XUnLi / 2 + XObRe / 2;
+		if ((unsigned INT64)xmin <= X && Zero)
+		{
+			int Index = Zero->SearchInXYZList(xyzlist, xmin, ymin, xmax, ymax, !leftright, XUnLi, YUnLi, X, YObRe);
+			if (Index >= 0) return (Index);
+		}
+		X = X + 1;
+		if ((unsigned INT64)xmax >= X && One)
+		{
+			int Index = One->SearchInXYZList(xyzlist, xmin, ymin, xmax, ymax, !leftright, X, YUnLi, XObRe, YObRe);
+			if (Index >= 0) return (Index);
+		}
+	}
+	else
+	{
+		unsigned INT64 Y = YUnLi / 2 + YObRe / 2;
+		if ((unsigned INT64)ymin <= Y && Zero)
+		{
+			int Index = Zero->SearchInXYZList(xyzlist, xmin, ymin, xmax, ymax, !leftright, XUnLi, YUnLi, XObRe, Y);
+			if (Index >= 0) return (Index);
+		}
+		Y = Y + 1;
+		if ((unsigned INT64)ymax >= Y && One)
+		{
+			int Index = One->SearchInXYZList(xyzlist, xmin, ymin, xmax, ymax, !leftright, XUnLi, Y, XObRe, YObRe);
+			if (Index >= 0) return (Index);
+		}
+	}
+	return (-1);
+}
+
+//---------------------------------------------------------------------
+// TXYList
+//---------------------------------------------------------------------
+
 //---------------------------------------------------------------------------
+TXYList::TXYList(void)
+{
+	XYKombiIndex = 0;
+}
+
+//---------------------------------------------------------------------------
 TXYList::~TXYList(void)
 {
+	if (XYKombiIndex)   delete XYKombiIndex;
+	XYKombiIndex = 0;
+
 	Clear();
 }
 
@@ -77,17 +532,82 @@
 	}
 	return(NewXyList);
 }
-//---------------------------------------------------------------------------
 
+//---------------------------------------------------------------------
+void TXYList::SortByXY(void)
+{
+	std::sort(this->begin(), this->end(), TXYSort());
 
 
+	if (XYKombiIndex)   delete XYKombiIndex;
+	XYKombiIndex = new TXYKombiIndex();
+	XYKombiIndex->BuildFromXYList(this, 0, size());
+}
 
+//---------------------------------------------------------------------
+TXY* TXYList::FindByXY(double X, double Y, double Eps)
+{
+	if (size() <= 0) return (0);
 
+	double XMin = X - Eps;
+	double XMax = X + Eps;
+	double YMin = Y - Eps;
+	double YMax = Y + Eps;
 
+	int Index = XYKombiIndex->SearchInXYList(this, XMin, YMin, XMax, YMax);
 
+
+
+/*
+	if (Index >= 0)
+	{
+		TNode *Node = (TNode *)Items[Index];
+		if (Node->X >= X - Eps - 0.000001 && Node->X <= X + Eps + 0.000001 && Node->Y >= Y - Eps - 0.000001 && Node->Y <= Y + Eps + 0.000001)
+		{
+			return (Node);
+		}
+		else
+		{
+			throw Exception("Falschen Knoten gefunden");
+		}
+	}
+	else
+	{
+		for (int i=0; i<Count; i++)
+		{
+			TNode *Node = (TNode *)Items[i];
+			if (Node->X >= X - Eps && Node->X <= X + Eps && Node->Y >= Y - Eps && Node->Y <= Y + Eps)
+			{
+				throw Exception("Existierenden Knoten nicht gefunden");
+			}
+		}
+		return (0);
+	}
+*/
+
+	if (Index < 0)  return (0);
+
+	TXY *Xy = (* this)[Index];
+
+	return(Xy);
+}
+
+//---------------------------------------------------------------------
+// TXYZList
+//---------------------------------------------------------------------
+
 //---------------------------------------------------------------------------
+TXYZList::TXYZList(void)
+{
+	XYKombiIndex = 0;
+}
+
+//---------------------------------------------------------------------------
 TXYZList::~TXYZList(void)
 {
+	if (XYKombiIndex)   delete XYKombiIndex;
+	XYKombiIndex = 0;
+
 	Clear();
 }
 
@@ -115,15 +635,228 @@
 	}
 	return(NewXyzList);
 }
+
+//---------------------------------------------------------------------
+void TXYZList::SortByXY(void)
+{
+	std::sort(this->begin(), this->end(), TXYZSort());
+
+	if (XYKombiIndex)   delete XYKombiIndex;
+	XYKombiIndex = new TXYKombiIndex();
+	XYKombiIndex->BuildFromXYZList(this, 0, size());
+}
+
+//---------------------------------------------------------------------
+TXYZ* TXYZList::FindByXY(double X, double Y, double Eps)
+{
+	if (size() <= 0) return (0);
+
+	double XMin = X - Eps;
+	double XMax = X + Eps;
+	double YMin = Y - Eps;
+	double YMax = Y + Eps;
+
+	int Index = XYKombiIndex->SearchInXYZList(this, XMin, YMin, XMax, YMax);
+
+
+
+/*
+	if (Index >= 0)
+	{
+		TNode *Node = (TNode *)Items[Index];
+		if (Node->X >= X - Eps - 0.000001 && Node->X <= X + Eps + 0.000001 && Node->Y >= Y - Eps - 0.000001 && Node->Y <= Y + Eps + 0.000001)
+		{
+			return (Node);
+		}
+		else
+		{
+			throw Exception("Falschen Knoten gefunden");
+		}
+	}
+	else
+	{
+		for (int i=0; i<Count; i++)
+		{
+			TNode *Node = (TNode *)Items[i];
+			if (Node->X >= X - Eps && Node->X <= X + Eps && Node->Y >= Y - Eps && Node->Y <= Y + Eps)
+			{
+				throw Exception("Existierenden Knoten nicht gefunden");
+			}
+		}
+		return (0);
+	}
+*/
+
+	if (Index < 0)  return (0);
+
+	TXYZ *Xyz = (* this)[Index];
+
+	return(Xyz);
+}
+
+//---------------------------------------------------------------------
+// TNodeList
+//---------------------------------------------------------------------
+
 //---------------------------------------------------------------------------
+TNodeList::TNodeList(void)
+{
+	XYKombiIndex = 0;
+}
 
+//---------------------------------------------------------------------------
+TNodeList::~TNodeList(void)
+{
+	Clear();
+}
 
+//---------------------------------------------------------------------
+void TNodeList::Clear(void)
+{
+	if (XYKombiIndex)   delete XYKombiIndex;
+	XYKombiIndex = 0;
 
+	for (unsigned int i=0; i<size(); i++)
+	{
+		TNode *Node = (*this)[i];
+		delete Node;
+	}
+	clear();
+}
 
+//---------------------------------------------------------------------
+TNodeList* TNodeList::Copy(void)
+{
+	TNodeList *NewNodeList = new TNodeList;
 
+	for (unsigned int i=0; i<size(); i++)
+	{
+		TNode *OldNode = (*this)[i];
+		TNode *NewNode = new TNode(OldNode);
+		NewNodeList->push_back(NewNode);
+	}
+	return(NewNodeList);
+}
 
+//---------------------------------------------------------------------
+void TNodeList::SortByXY(void)
+{
+	std::sort(this->begin(), this->end(), TNodeSortByXY());
 
+	if (XYKombiIndex)   delete XYKombiIndex;
+	XYKombiIndex = new TXYKombiIndex();
+	XYKombiIndex->BuildFromNodeList(this, 0, size());
+}
+
+//---------------------------------------------------------------------
+void TNodeList::SortByNr(void)
+{
+	std::sort(this->begin(), this->end(), TNodeSortByNr());
+}
+
+//---------------------------------------------------------------------
+TNode* TNodeList::FindByNr(int nr)
+{
+	if (size() <= 0) return (0);
+
+	int Under = 0;
+	int Over = size()-1;
+	while (Under <= Over)
+	{
+		int Index = (Over + Under) / 2;
+
+		TNode *Node = (*this)[Index];
+
+		if (nr < Node->Nr)
+		{
+			Over = Index - 1;
+		}
+		else if (nr > Node->Nr)
+		{
+			Under = Index + 1;
+		}
+		else
+		{
+			return(Node);
+		}
+	}
+
+	return (0);
+}
+//---------------------------------------------------------------------
+TNode* TNodeList::FindByXY(double X, double Y, double Eps)
+{
+	if (size() <= 0) return (0);
+
+	double XMin = X - Eps;
+	double XMax = X + Eps;
+	double YMin = Y - Eps;
+	double YMax = Y + Eps;
+
+	int Index = XYKombiIndex->SearchInNodeList(this, XMin, YMin, XMax, YMax);
+
+
+
+/*
+	if (Index >= 0)
+	{
+		TNode *Node = (TNode *)Items[Index];
+		if (Node->X >= X - Eps - 0.000001 && Node->X <= X + Eps + 0.000001 && Node->Y >= Y - Eps - 0.000001 && Node->Y <= Y + Eps + 0.000001)
+		{
+			return (Node);
+		}
+		else
+		{
+			throw Exception("Falschen Knoten gefunden");
+		}
+	}
+	else
+	{
+		for (int i=0; i<Count; i++)
+		{
+			TNode *Node = (TNode *)Items[i];
+			if (Node->X >= X - Eps && Node->X <= X + Eps && Node->Y >= Y - Eps && Node->Y <= Y + Eps)
+			{
+				throw Exception("Existierenden Knoten nicht gefunden");
+			}
+		}
+		return (0);
+	}
+*/
+
+	if (Index < 0)  return (0);
+
+	TNode *Node = (* this)[Index];
+
+	return(Node);
+}
+
+//---------------------------------------------------------------------
+// TElementList
+//---------------------------------------------------------------------
+
 //---------------------------------------------------------------------------
+TElementList::~TElementList(void)
+{
+	Clear();
+}
+
+//---------------------------------------------------------------------
+void TElementList::Clear(void)
+{
+	for (unsigned int i=0; i<size(); i++)
+	{
+		TElement *Element = (*this)[i];
+		delete Element;
+	}
+	clear();
+}
+
+//---------------------------------------------------------------------
+// TPolygonList
+//---------------------------------------------------------------------
+
+//---------------------------------------------------------------------------
 TPolygonList::~TPolygonList(void)
 {
 	Clear();
@@ -176,3 +909,148 @@
 	return (XYList);
 }
 
+//---------------------------------------------------------------------
+// TEdge
+//---------------------------------------------------------------------
+
+//---------------------------------------------------------------------
+TEdge::TEdge(TNode *node1, TNode *node2)
+{
+	if (node1->Nr < 0)
+	{
+		dump_error (__FILE__, __LINE__, "Beim Erzeugen einer Kante ist die Knotennummer 1 negativ (%d)", node1->Nr);
+	}
+
+	if (node2->Nr < 0)
+	{
+		dump_error (__FILE__, __LINE__, "Beim Erzeugen einer Kante ist die Knotennummer 2 negativ (%d)", node2->Nr);
+	}
+
+	if (node1->Nr < node2->Nr)
+	{
+		Node1 = node1;
+		Node2 = node2;
+	}
+	else
+	{
+		Node1 = node2;
+		Node2 = node1;
+	}
+
+	double Dx = Node2->X - Node1->X;
+	double Dy = Node2->Y - Node1->Y;
+	Distance = sqrt (Dx*Dx +Dy*Dy);
+
+	if (Distance < MinNodeDistanceKonst)
+	{
+		dump_error (__FILE__, __LINE__, "Beim Erzeugen einer Kante ist der Abstand der Knoten zu dicht\nAbstand: %f\nKnoten 1: (%d,%f,%f)\nKnoten 2: (%d,%f,%f)\n", Distance, Node1->Nr, Node1->X, Node1->Y, Node2->Nr, Node2->X, Node2->Y);
+	}
+
+	Arc = acos (Dx / Distance) * 180.0 / M_PI;
+	if (Dy < 0) Arc = 360.0 - Arc;
+
+	X = 0.0;
+	Y = 0.0;
+	Ready = false;
+	IsBoundary = false;
+}
+
+//---------------------------------------------------------------------
+TEdge::TEdge(TEdge *Edge)
+{
+	Node1 = Edge->Node1;
+	Node2 = Edge->Node2;
+	Distance = Edge->Distance;
+	Arc = Edge->Arc;
+	X = Edge->X;
+	Y = Edge->Y;
+	Ready = Edge->Ready;
+	IsBoundary = Edge->IsBoundary;
+}
+
+//---------------------------------------------------------------------
+struct TEdgeSortByNr
+{
+	 bool operator()(TEdge* const &Edge1, TEdge* const &Edge2)
+	 {
+		if      (Edge1->Node1->Nr < Edge2->Node1->Nr)   return(true);
+		else if (Edge1->Node1->Nr > Edge2->Node1->Nr)   return(false);
+		else if (Edge1->Node2->Nr < Edge2->Node2->Nr)   return(true);
+		else if (Edge1->Node2->Nr > Edge2->Node2->Nr)   return(false);
+
+		return (0);
+	 }
+};
+
+//---------------------------------------------------------------------
+struct TEdgeSortByDistance
+{
+	 bool operator()(TEdge* const &Edge1, TEdge* const &Edge2)
+	 {
+		return (Edge1->Distance < Edge2->Distance);
+	 }
+};
+
+//---------------------------------------------------------------------
+
+//---------------------------------------------------------------------
+// TEdgeList
+//---------------------------------------------------------------------
+
+//---------------------------------------------------------------------
+TEdgeList::~TEdgeList(void)
+{
+	Clear();
+}
+
+//---------------------------------------------------------------------
+void TEdgeList::Clear(void)
+{
+	for (unsigned int i=0; i<size(); i++)
+	{
+		TEdge *Edge = (*this)[i];
+		delete Edge;
+	}
+
+	clear();
+}
+
+//---------------------------------------------------------------------
+void TEdgeList::SortByNr(void)
+{
+	std::sort(this->begin(), this->end(), TEdgeSortByNr());
+}
+
+//---------------------------------------------------------------------
+void TEdgeList::SortByDistance(void)
+{
+	std::sort(this->begin(), this->end(), TEdgeSortByDistance());
+}
+
+//---------------------------------------------------------------------
+void TEdgeList::BuildEdgeIndex(void)
+{
+	for (unsigned int i=0; i < size(); i++)
+	{
+		TEdge *Edge = (*this)[i];
+
+		TNode *Node1 = Edge->Node1;
+		Node1->EdgeIndex = new TEdgeIndex (Node1->EdgeIndex, Edge);
+
+		TNode *Node2 = Edge->Node2;
+		Node2->EdgeIndex = new TEdgeIndex (Node2->EdgeIndex, Edge);
+	}
+}
+
+//---------------------------------------------------------------------
+// TEdgeIndex
+//---------------------------------------------------------------------
+
+//---------------------------------------------------------------------
+TEdgeIndex::TEdgeIndex(TEdgeIndex *nextedgeindex, TEdge *edge)
+{
+	NextEdgeIndex = nextedgeindex;
+	Edge = edge;
+}
+
+

Modified: trunk/src/xy.h
===================================================================
--- trunk/src/xy.h	2006-01-09 20:37:25 UTC (rev 25)
+++ trunk/src/xy.h	2006-01-10 21:53:01 UTC (rev 26)
@@ -15,57 +15,168 @@
 #define XYH
 
 //----------------------------------------------------------------------------
+#ifdef __BORLANDC__
+#define INT64			__int64
+#define INT64SUFF(x)	x##L
+#else
+#define INT64			long long int
+#define INT64SUFF(x)	x##ULL
+#endif
+
+//----------------------------------------------------------------------------
 #include <vector>
-#include "tools.h"
+#include <list>
 
 //----------------------------------------------------------------------------
+typedef enum { TRI, QUAD } TElementTyp;
+
+//----------------------------------------------------------------------------
+class TEdgeIndex;
+class TXYList;
+class TXYZList;
+class TNodeList;
+
+//----------------------------------------------------------------------------
 class TXY
 {
-	private:
+	public:
+		double  		X;
+		double  		Y;
+
 		// Dieser Wert ist eine abwechselt Bitweise Kombination des (long)(X * 100) und (long)(Y * 100) Wertes.
 		// X = 1.2345 -> (long)(X*100) = 123 = 001111011
 		// Y = 2.654  -> (long)(Y*100) = 265 = 100001001
 		// XYKombi = 0...0 01 00 10 10 10 11 00 10 11 = 0000000000000000000000000000000000000000000000010010101011001011
 		unsigned INT64	XYKombi;
 
-	public:
-		double  		X;
-		double  		Y;
-
 		TXY(double X, double Y);
 		TXY(TXY *Xy);
 };
 
-//----------------------------------------------------------------------------
+ //----------------------------------------------------------------------------
 class TXYZ : public TXY
 {
 	public:
 
 		double  	Z;
 
+		TXYZ(double X, double Y);
 		TXYZ(double X, double Y, double Z);
 		TXYZ(TXYZ *Xyz);
 };
 
 //----------------------------------------------------------------------------
+class TNode : public TXYZ
+{
+	private:
+		void 		ClearEdgeIndex(void);
+
+	public:
+		int			Nr;
+		double  	Wsp;
+		TEdgeIndex 	*EdgeIndex;
+
+		TNode(int Nr, double X, double Y, double Z);
+		TNode(int Nr, double X, double Y, double Z, int Wsp);
+		TNode(TNode *Node);
+		~TNode(void);
+};
+
+//----------------------------------------------------------------------------
+class TElement
+{
+	public:
+		TElementTyp		Typ;
+		TNodeList		*NodeList;
+
+						TElement(TNode *Node1, TNode *Node2, TNode *Node3);
+						TElement(TNode *Node1, TNode *Node2, TNode *Node3, TNode *Node4);
+						TElement(TElement *Element);
+						~TElement(void);
+
+		bool 			IsInElement(double X, double Y);
+};
+
+//----------------------------------------------------------------------------
+class TXYKombiIndex
+{
+	public:
+		int				Start;
+		unsigned int	Anzahl;
+		TXYKombiIndex	*Zero;
+		TXYKombiIndex	*One;
+
+		TXYKombiIndex(void);
+		~TXYKombiIndex(void);
+
+		void BuildFromXYList(TXYList *XYList, int Start, int Anzahl, unsigned INT64 Mask = INT64SUFF(0x8000000000000000));
+		void BuildFromXYZList(TXYZList *XYZList, int Start, int Anzahl, unsigned INT64 Mask = INT64SUFF(0x8000000000000000));
+		void BuildFromNodeList(TNodeList *XYList, int Start, int Anzahl, unsigned INT64 Mask = INT64SUFF(0x8000000000000000));
+
+		int SearchInXYList(TXYList *XYList, double XMin, double YMin, double XMax, double YMax, bool LeftRight = true, unsigned INT64 XUL = INT64SUFF(0x00000000), unsigned INT64 YUL = INT64SUFF(0x00000000), unsigned INT64 XOR = INT64SUFF(0xFFFFFFFF), unsigned INT64 YOR = INT64SUFF(0xFFFFFFFF));
+		int SearchInXYZList(TXYZList *XYZList, double XMin, double YMin, double XMax, double YMax, bool LeftRight = true, unsigned INT64 XUL = INT64SUFF(0x00000000), unsigned INT64 YUL = INT64SUFF(0x00000000), unsigned INT64 XOR = INT64SUFF(0xFFFFFFFF), unsigned INT64 YOR = INT64SUFF(0xFFFFFFFF));
+		int SearchInNodeList(TNodeList *NodeList, double XMin, double YMin, double XMax, double YMax, bool LeftRight = true, unsigned INT64 XUL = INT64SUFF(0x00000000), unsigned INT64 YUL = INT64SUFF(0x00000000), unsigned INT64 XOR = INT64SUFF(0xFFFFFFFF), unsigned INT64 YOR = INT64SUFF(0xFFFFFFFF));
+};
+
+//----------------------------------------------------------------------------
 class TXYList : public std::vector<TXY *>
 {
+	private:
+		TXYKombiIndex	*XYKombiIndex;
+
 	public:
-		~TXYList(void);
-		void Clear(void);
-		TXYList* Copy(void);
+						TXYList(void);
+						~TXYList(void);
+		void 			Clear(void);
+		TXYList* 		Copy(void);
+
+		void 			SortByXY(void);
+		TXY* 			FindByXY(double X, double Y, double Eps = 0.01);
 };
 
 //----------------------------------------------------------------------------
 class TXYZList : public std::vector<TXYZ *>
 {
+	private:
+		TXYKombiIndex	*XYKombiIndex;
+
 	public:
-		~TXYZList(void);
-		void Clear(void);
-		TXYZList* Copy(void);
+						TXYZList(void);
+						~TXYZList(void);
+		void 			Clear(void);
+		TXYZList* 		Copy(void);
+
+		void 			SortByXY(void);
+		TXYZ*			FindByXY(double X, double Y, double Eps = 0.01);
 };
 
 //----------------------------------------------------------------------------
+class TNodeList : public std::vector<TNode *>
+{
+	private:
+		TXYKombiIndex	*XYKombiIndex;
+
+	public:
+						TNodeList(void);
+						~TNodeList(void);
+		void 			Clear(void);
+		TNodeList* 		Copy(void);
+
+		void			SortByXY(void);
+		void			SortByNr(void);
+		TNode*			FindByXY(double X, double Y, double Eps = 0.01);
+		TNode*			FindByNr(int Nr);
+};
+
+//----------------------------------------------------------------------------
+class TElementList : public std::vector<TElement *>
+{
+	public:
+						~TElementList(void);
+		void			Clear(void);
+};
+
+//----------------------------------------------------------------------------
 class TPolygonList : public std::vector<TXYList *>
 {
 	public:
@@ -76,4 +187,48 @@
 };
 
 //----------------------------------------------------------------------------
+class TEdge
+{
+	public:
+		TNode 	*Node1;
+		TNode 	*Node2;
+		double  Distance;
+		double	Arc;
+		double	X;
+		double	Y;
+		bool	Ready;
+		bool	IsBoundary;
+
+		TEdge(TNode *Node1, TNode *Node2);
+		TEdge(TEdge *Edge);
+};
+
+//----------------------------------------------------------------------------
+class TEdgeList : public std::vector<TEdge *>
+{
+	private:
+		bool	SortedByNr;
+		bool	SortedByDistance;
+
+	public:
+				~TEdgeList(void);
+
+		void 	Clear(void);
+
+		void 	SortByNr(void);
+		void 	SortByDistance(void);
+
+		void 	BuildEdgeIndex(void);
+};
+
+//----------------------------------------------------------------------------
+class TEdgeIndex
+{
+	public:
+		TEdge 		*Edge;
+		TEdgeIndex 	*NextEdgeIndex;
+
+		TEdgeIndex(TEdgeIndex *EdgeIndex, TEdge *Edge);
+};
+
 #endif



More information about the Wsplgen-commits mailing list