[Wsplgen-commits] r66 - trunk/src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Oct 11 01:19:36 CEST 2006


Author: mrchip
Date: 2006-10-11 01:19:35 +0200 (Wed, 11 Oct 2006)
New Revision: 66

Modified:
   trunk/src/file.cpp
   trunk/src/shape.cpp
   trunk/src/shape.h
   trunk/src/test.cpp
   trunk/src/test_xy.cpp
   trunk/src/tools.cpp
   trunk/src/wsplgen.cpp
   trunk/src/wsplgen.h
   trunk/src/xy.cpp
   trunk/src/xy.h
Log:


Modified: trunk/src/file.cpp
===================================================================
--- trunk/src/file.cpp	2006-10-05 19:21:36 UTC (rev 65)
+++ trunk/src/file.cpp	2006-10-10 23:19:35 UTC (rev 66)
@@ -2747,110 +2747,62 @@
 }
 
 //---------------------------------------------------------------------------
-int OutElement(int AnzPolygone, TElement *Element, int TopoDiff, DBFHandle PolygonDBFHandle, SHPHandle PolygonSHPHandle)
+int OutElement(int AnzPolygone, TNode* Node1, TNode* Node2, TNode* Node3, int TopoDiff, DBFHandle PolygonDBFHandle, SHPHandle PolygonSHPHandle)
 {
-	if (Element->Typ == TRI)
-	{
-		TNode *Node1 = Element->Node1;
-		TNode *Node2 = Element->Node2;
-		TNode *Node3 = Element->Node3;
+	double Wsp = 0.0;
+	double Depth = 0.0;
+	double Topo = 0.0;
 
-		double Wsp = 0.0;
-		double Depth = 0.0;
-		double Topo = 0.0;
+	long Z1 = Node1->Z;
+	long Z2 = Node2->Z;
+	long Z3 = Node3->Z;
 
-		long Z1 = Node1->Z;
-		long Z2 = Node2->Z;
-		long Z3 = Node3->Z;
+	long W1 = Node1->Wsp;
+	long W2 = Node2->Wsp;
+	long W3 = Node3->Wsp;
 
-		long W1 = Node1->Wsp;
-		long W2 = Node2->Wsp;
-		long W3 = Node3->Wsp;
+	if (W1 < Z1 + TopoDiff)	W1 = NoWsp;
+	if (W2 < Z2 + TopoDiff)	W2 = NoWsp;
+	if (W3 < Z3 + TopoDiff)	W3 = NoWsp;
 
-		if (W1 < Z1 + TopoDiff)	W1 = NoWsp;
-		if (W2 < Z2 + TopoDiff)	W2 = NoWsp;
-		if (W3 < Z3 + TopoDiff)	W3 = NoWsp;
+	if (W1 == NoWsp && W2 == NoWsp && W3 == NoWsp)	Wsp = NoWsp;
+	else if (W1 == NoWsp && W2 == NoWsp)			Wsp = W3 / 100.0;
+	else if (W1 == NoWsp && W3 == NoWsp)			Wsp = W2 / 100.0;
+	else if (W2 == NoWsp && W3 == NoWsp)			Wsp = W1 / 100.0;
+	else if (W1 == NoWsp)							Wsp = (W2 + W3) / 200.0;
+	else if (W2 == NoWsp)							Wsp = (W1 + W3) / 200.0;
+	else if (W3 == NoWsp)							Wsp = (W1 + W2) / 200.0;
+	else											Wsp = (W1 + W2 + W3) / 300.0;
 
-		if (W1 == NoWsp && W2 == NoWsp && W3 == NoWsp)	Wsp = NoWsp;
-		else if (W1 == NoWsp && W2 == NoWsp)			Wsp = W3 / 100.0;
-		else if (W1 == NoWsp && W3 == NoWsp)			Wsp = W2 / 100.0;
-		else if (W2 == NoWsp && W3 == NoWsp)			Wsp = W1 / 100.0;
-		else if (W1 == NoWsp)							Wsp = (W2 + W3) / 200.0;
-		else if (W2 == NoWsp)							Wsp = (W1 + W3) / 200.0;
-		else if (W3 == NoWsp)							Wsp = (W1 + W2) / 200.0;
-		else											Wsp = (W1 + W2 + W3) / 300.0;
+	Topo = (Z1 + Z2 + Z3) / 300.0;
 
-		Topo = (Z1 + Z2 + Z3) / 300.0;
+	if (Wsp == NoWsp)	Depth = 0.0;
+	else				Depth = Wsp - Topo;
 
-		if (Wsp == NoWsp)	Depth = 0.0;
-		else				Depth = Wsp - Topo;
+	if (Depth < TopoDiff)	Depth = TopoDiff;
 
-		if (Depth < TopoDiff)	Depth = TopoDiff;
+	long X1 = Node1->X;
+	long Y1 = Node1->Y;
+	long X2 = Node2->X;
+	long Y2 = Node2->Y;
+	long X3 = Node3->X;
+	long Y3 = Node3->Y;
 
-		double  x[4];
-		double  y[4];
-		double  z[4];
+	long DoubleArea = X1 * Y2 - X2 * Y1 + X2 * Y3 - X3 * Y2 + X3 * Y1 - X1 * Y3;
 
-		double win = ThreeToWin (Node2->X, Node2->Y, Node1->X, Node1->Y, Node3->X, Node3->Y, 0);
-
-		if (win > 180)
-		{
-			x[0] = Node1->X / 100.0;
-			x[1] = Node2->X / 100.0;
-			x[2] = Node3->X / 100.0;
-			x[3] = Node1->X / 100.0;
-
-			y[0] = Node1->Y / 100.0;
-			y[1] = Node2->Y / 100.0;
-			y[2] = Node3->Y / 100.0;
-			y[3] = Node1->Y / 100.0;
-		}
-		else
-		{
-			x[0] = Node1->X / 100.0;
-			x[1] = Node3->X / 100.0;
-			x[2] = Node2->X / 100.0;
-			x[3] = Node1->X / 100.0;
-
-			y[0] = Node1->Y / 100.0;
-			y[1] = Node3->Y / 100.0;
-			y[2] = Node2->Y / 100.0;
-			y[3] = Node1->Y / 100.0;
-		}
-
-		z[0] = 0.0;
-		z[1] = 0.0;
-		z[2] = 0.0;
-		z[3] = 0.0;
-
-
-		SHPObject *psShape = SHPCreateSimpleObject(SHPT_POLYGON, 4, x, y, z);
-		SHPWriteObject(PolygonSHPHandle, -1, psShape);
-		SHPDestroyObject(psShape);
-
-		DBFWriteDoubleAttribute(PolygonDBFHandle, AnzPolygone, 0, Topo);
-		DBFWriteDoubleAttribute(PolygonDBFHandle, AnzPolygone, 1, Wsp);
-		DBFWriteDoubleAttribute(PolygonDBFHandle, AnzPolygone, 2, Depth);
-
-		AnzPolygone++;
-	}
-	else if (Element->Typ == QUAD)
+	if (DoubleArea < 0)
 	{
-		TNode *Node1 = Element->Node1;
-		TNode *Node2 = Element->Node2;
-		TNode *Node3 = Element->Node3;
-		TNode *Node4 = Element->Node4;
+		dump_error(__FILE__, __LINE__, "Negative Element Fläche");
+	}
 
-		TElement *TempElement = 0;
+	// Die merkwürdige Reihenfolge ist notwendig, damit die Orientierung für ArcVIEW stimmt.
+	SHPWriteElement(PolygonSHPHandle, X1, Y1, X3, Y3, X2, Y2);
 
-		TempElement = new TElement(Node1, Node2, Node3);
-		AnzPolygone = OutElement(AnzPolygone, TempElement, TopoDiff, PolygonDBFHandle, PolygonSHPHandle);
-		delete TempElement;
+	DBFWriteDoubleAttribute(PolygonDBFHandle, AnzPolygone, 0, Topo);
+	DBFWriteDoubleAttribute(PolygonDBFHandle, AnzPolygone, 1, Wsp);
+	DBFWriteDoubleAttribute(PolygonDBFHandle, AnzPolygone, 2, Depth);
 
-		TempElement = new TElement(Node1, Node3, Node4);
-		AnzPolygone = OutElement(AnzPolygone, TempElement, TopoDiff, PolygonDBFHandle, PolygonSHPHandle);
-		delete TempElement;
-	}
+	AnzPolygone++;
 
 	return (AnzPolygone);
 }
@@ -2887,7 +2839,7 @@
 	}
 
 	SHPHandle SHPHandle = SHPCreate(FileName.c_str(), SHPT_POLYGON);
-	SHPSetMaxRecords(SHPHandle, ElementList->size());
+	SHPSetMaxRecords(SHPHandle, ElementList->size()+1);
 
 	int AnzPolygone = 0;
 	for (TElementList::iterator i=ElementList->begin(); i != ElementList->end(); i++)
@@ -2899,7 +2851,24 @@
 
 		TElement *Element = *i;
 
-		AnzPolygone = OutElement(AnzPolygone, Element, TopoDiff, DBFHandle, SHPHandle);
+		if (Element->Typ == TRI)
+		{
+			TNode *Node1 = Element->Node1;
+			TNode *Node2 = Element->Node2;
+			TNode *Node3 = Element->Node3;
+
+			AnzPolygone = OutElement(AnzPolygone, Node1, Node2, Node3, TopoDiff, DBFHandle, SHPHandle);
+		}
+        else if (Element->Typ == QUAD)
+		{
+			TNode *Node1 = Element->Node1;
+			TNode *Node2 = Element->Node2;
+			TNode *Node3 = Element->Node3;
+			TNode *Node4 = Element->Node4;
+
+			AnzPolygone = OutElement(AnzPolygone, Node1, Node2, Node3, TopoDiff, DBFHandle, SHPHandle);
+			AnzPolygone = OutElement(AnzPolygone, Node1, Node3, Node4, TopoDiff, DBFHandle, SHPHandle);
+        }
 	}
 
 	SHPClose(SHPHandle);

Modified: trunk/src/shape.cpp
===================================================================
--- trunk/src/shape.cpp	2006-10-05 19:21:36 UTC (rev 65)
+++ trunk/src/shape.cpp	2006-10-10 23:19:35 UTC (rev 66)
@@ -42,7 +42,7 @@
 	/*      Prepare header block for .shp file.                             */
 	/* -------------------------------------------------------------------- */
 
-	for(int i = 0; i < 100; i++ )	abyHeader[i] = 0;
+	for (int i = 0; i < 100; i++)	abyHeader[i] = 0;
 
 	/* magic cookie */
 	abyHeader[2] = 0x27;
@@ -54,72 +54,72 @@
 	if(!bBigEndian) Swap4Bytes(abyHeader+24);
 
 	i32 = 1000;								/* version */
-	ByteCopy( &i32, abyHeader+28, 4 );
-	if( bBigEndian ) Swap4Bytes(abyHeader+28 );
+	ByteCopy( &i32, abyHeader+28, 4);
+	if( bBigEndian ) Swap4Bytes(abyHeader+28);
 
 	i32 = psSHP->nShapeType;				/* shape type */
-	ByteCopy( &i32, abyHeader+32, 4 );
-	if( bBigEndian ) Swap4Bytes(abyHeader+32 );
+	ByteCopy( &i32, abyHeader+32, 4);
+	if( bBigEndian ) Swap4Bytes(abyHeader+32);
 
 	dValue = psSHP->adBoundsMin[0];			/* set bounds */
-	ByteCopy( &dValue, abyHeader+36, 8 );
-	if( bBigEndian ) Swap8Bytes(abyHeader+36 );
+	ByteCopy( &dValue, abyHeader+36, 8);
+	if( bBigEndian ) Swap8Bytes(abyHeader+36);
 
 	dValue = psSHP->adBoundsMin[1];
-    ByteCopy( &dValue, abyHeader+44, 8 );
-    if( bBigEndian ) Swap8Bytes(abyHeader+44 );
+    ByteCopy( &dValue, abyHeader+44, 8);
+    if( bBigEndian ) Swap8Bytes(abyHeader+44);
 
     dValue = psSHP->adBoundsMax[0];
-    ByteCopy( &dValue, abyHeader+52, 8 );
-    if( bBigEndian ) Swap8Bytes(abyHeader+52 );
+    ByteCopy( &dValue, abyHeader+52, 8);
+    if( bBigEndian ) Swap8Bytes(abyHeader+52);
 
     dValue = psSHP->adBoundsMax[1];
-    ByteCopy( &dValue, abyHeader+60, 8 );
-    if( bBigEndian ) Swap8Bytes(abyHeader+60 );
+    ByteCopy( &dValue, abyHeader+60, 8);
+    if( bBigEndian ) Swap8Bytes(abyHeader+60);
 
     dValue = psSHP->adBoundsMin[2];			/* z */
-    ByteCopy( &dValue, abyHeader+68, 8 );
-    if( bBigEndian ) Swap8Bytes(abyHeader+68 );
+    ByteCopy( &dValue, abyHeader+68, 8);
+    if( bBigEndian ) Swap8Bytes(abyHeader+68);
 
 	dValue = psSHP->adBoundsMax[2];
-    ByteCopy( &dValue, abyHeader+76, 8 );
-    if( bBigEndian ) Swap8Bytes(abyHeader+76 );
+    ByteCopy( &dValue, abyHeader+76, 8);
+    if( bBigEndian ) Swap8Bytes(abyHeader+76);
 
     dValue = psSHP->adBoundsMin[3];			/* m */
-    ByteCopy( &dValue, abyHeader+84, 8 );
-    if( bBigEndian ) Swap8Bytes(abyHeader+84 );
+    ByteCopy( &dValue, abyHeader+84, 8);
+    if( bBigEndian ) Swap8Bytes(abyHeader+84);
 
     dValue = psSHP->adBoundsMax[3];
-    ByteCopy( &dValue, abyHeader+92, 8 );
-    if( bBigEndian ) Swap8Bytes(abyHeader+92 );
+    ByteCopy( &dValue, abyHeader+92, 8);
+    if( bBigEndian ) Swap8Bytes(abyHeader+92);
 
 	/* -------------------------------------------------------------------- */
 	/*      Write .shp file header.                                         */
 	/* -------------------------------------------------------------------- */
-	fseek( fpSHP, 0, 0 );
-	fwrite( abyHeader, 100, 1, fpSHP );
+	fseek (fpSHP, 0, 0);
+	fwrite (abyHeader, 100, 1, fpSHP);
 
 	/* -------------------------------------------------------------------- */
 	/*      Prepare, and write .shx file header.                            */
 	/* -------------------------------------------------------------------- */
     i32 = (psSHP->nRecords * 2 * sizeof(int32) + 100) / 2;   /* file size */
-    ByteCopy( &i32, abyHeader+24, 4 );
-    if( !bBigEndian ) Swap4Bytes(abyHeader+24 );
+    ByteCopy (&i32, abyHeader+24, 4);
+    if (!bBigEndian) Swap4Bytes(abyHeader+24);
     
-    fseek( fpSHX, 0, 0 );
-    fwrite( abyHeader, 100, 1, fpSHX );
+    fseek (fpSHX, 0, 0);
+    fwrite (abyHeader, 100, 1, fpSHX);
 
 	/* -------------------------------------------------------------------- */
 	/*      Write out the .shx contents.                                    */
 	/* -------------------------------------------------------------------- */
-	panSHX = (int32 *) SfMalloc(sizeof(int32) * 2 * psSHP->nRecords);
+	panSHX = (int32 *)SfMalloc(sizeof(int32) * 2 * psSHP->nRecords);
 
 	for (int i = 0; i < psSHP->nRecords; i++)
     {
 		panSHX[i*2  ] = psSHP->panRecOffset[i] / 2;
 		panSHX[i*2+1] = psSHP->panRecSize[i] / 2;
-		if( !bBigEndian ) Swap4Bytes(panSHX + i * 2);
-		if( !bBigEndian ) Swap4Bytes(panSHX + i * 2 + 1);
+		if (!bBigEndian) Swap4Bytes(panSHX + i * 2);
+		if (!bBigEndian) Swap4Bytes(panSHX + i * 2 + 1);
     }
 
 	fwrite(panSHX, sizeof(int32) * 2, psSHP->nRecords, fpSHX);
@@ -303,35 +303,30 @@
 	/* -------------------------------------------------------------------- */
 	psSHP->nMaxRecords = psSHP->nRecords;
 
-	if (psSHP->nMaxRecords > 1)
+	if (psSHP->nMaxRecords > 0)
 	{
 		psSHP->panRecOffset = (int *) SfMalloc(sizeof(int) * psSHP->nMaxRecords);
 		psSHP->panRecSize =   (int *) SfMalloc(sizeof(int) * psSHP->nMaxRecords);
 		pabyBuf = (uchar *) SfMalloc(8 * psSHP->nMaxRecords);
-	}
-	else
-	{
-		psSHP->panRecOffset = (int *) SfMalloc(sizeof(int) * 1);
-		psSHP->panRecSize =   (int *) SfMalloc(sizeof(int) * 1);
-		pabyBuf = (uchar *) SfMalloc(8 * 1);
-	}
 
-	fread( pabyBuf, 8, psSHP->nRecords, fpSHX );
+		fread( pabyBuf, 8, psSHP->nRecords, fpSHX );
 
-    for(int i = 0; i < psSHP->nRecords; i++ )
-    {
-		int32		nOffset, nLength;
+    	for(int i = 0; i < psSHP->nRecords; i++ )
+    	{
+			int32		nOffset, nLength;
 
-		memcpy( &nOffset, pabyBuf + i * 8, 4 );
-		if( !bBigEndian ) Swap4Bytes(&nOffset );
+			memcpy( &nOffset, pabyBuf + i * 8, 4 );
+			if( !bBigEndian ) Swap4Bytes(&nOffset );
 
-		memcpy( &nLength, pabyBuf + i * 8 + 4, 4 );
-		if( !bBigEndian ) Swap4Bytes(&nLength );
+			memcpy( &nLength, pabyBuf + i * 8 + 4, 4 );
+			if( !bBigEndian ) Swap4Bytes(&nLength );
 
-		psSHP->panRecOffset[i] = nOffset*2;
-		psSHP->panRecSize[i] = nLength*2;
+			psSHP->panRecOffset[i] = nOffset*2;
+			psSHP->panRecSize[i] = nLength*2;
+	    }
+
+	    free( pabyBuf );
     }
-    free( pabyBuf );
 
     return( psSHP );
 }
@@ -344,31 +339,32 @@
 
 void SHPAPI_CALL SHPClose(SHPHandle psSHP)
 {
-/* -------------------------------------------------------------------- */
-/*	Update the header if we have modified anything.			*/
-/* -------------------------------------------------------------------- */
-	if( psSHP->bUpdated )
+	/* -------------------------------------------------------------------- */
+	/*	Update the header if we have modified anything.						*/
+	/* -------------------------------------------------------------------- */
+	if (psSHP->bUpdated)
     {
-		SHPWriteHeader( psSHP );
+		SHPWriteHeader (psSHP);
     }
 
-/* -------------------------------------------------------------------- */
-/*      Free all resources, and close files.                            */
-/* -------------------------------------------------------------------- */
-	free( psSHP->panRecOffset );
-    free( psSHP->panRecSize );
+	/* -------------------------------------------------------------------- */
+	/*      Free all resources, and close files.                            */
+	/* -------------------------------------------------------------------- */
 
-	fclose( fpSHX );
+	fclose (fpSHX);
 	fpSHX = 0;
-	fclose( fpSHP );
+	fclose (fpSHP);
 	fpSHP = 0;
 
-    if( psSHP->pabyRec != NULL )
+	free (psSHP->panRecOffset);
+    free (psSHP->panRecSize);
+
+    if (psSHP->pabyRec != NULL)
     {
-        free( psSHP->pabyRec );
+        free (psSHP->pabyRec);
     }
 
-    free( psSHP );
+    free (psSHP);
 }
 
 /************************************************************************/
@@ -433,12 +429,12 @@
 	else                        		bBigEndian = TRUE;
 
 /* -------------------------------------------------------------------- */
-/*	Compute the base (layer) name.  If there is any extension	*/
-/*	on the passed in filename we will strip it off.			*/
+/*	Compute the base (layer) name.  If there is any extension			*/
+/*	on the passed in filename we will strip it off.						*/
 /* -------------------------------------------------------------------- */
 	pszBasename = (char *) SfMalloc(strlen(pszLayer)+5);
-	strcpy( pszBasename, pszLayer );
-	int i = strlen(pszBasename)-1;
+	strcpy (pszBasename, pszLayer);
+	int i = strlen(pszBasename) - 1;
 	while(i > 0 && pszBasename[i] != '.' && pszBasename[i] != '/' && pszBasename[i] != '\\')
 	{
 		i--;
@@ -520,7 +516,6 @@
 /************************************************************************/
 
 static void	_SHPSetBounds( uchar * pabyRec, SHPObject * psShape )
-
 {
     ByteCopy( &(psShape->dfXMin), pabyRec +  0, 8 );
     ByteCopy( &(psShape->dfYMin), pabyRec +  8, 8 );
@@ -775,6 +770,155 @@
 }
 
 /************************************************************************/
+/*                           SHPWriteElement()                          */
+/*                                                                      */
+/*      Write out the 3 vertices of a new element.  Note that it is     */
+/*      only possible to write vertices at the end of the file.         */
+/************************************************************************/
+int SHPAPI_CALL SHPWriteElement(SHPHandle psSHP, double X1, double Y1, double X2, double Y2, double X3, double Y3)
+{
+	int		nRecordOffset, nRecordSize;
+	uchar	pabyRec[100];
+    int32	i32;
+
+	psSHP->bUpdated = TRUE;
+
+	/* -------------------------------------------------------------------- */
+	/*      Ensure that shape object matches the type of the file it is     */
+	/*      being written to.                                               */
+	/* -------------------------------------------------------------------- */
+	assert(SHPT_POLYGON == psSHP->nShapeType);
+
+	/* -------------------------------------------------------------------- */
+	/*      Add the new entity to the in memory index.                      */
+	/* -------------------------------------------------------------------- */
+	if (psSHP->nRecords + 1 > psSHP->nMaxRecords)
+	{
+		psSHP->nMaxRecords =(int)(psSHP->nMaxRecords * 1.3 + 100);
+		psSHP->panRecOffset = (int *)SfRealloc(psSHP->panRecOffset, sizeof(int) * psSHP->nMaxRecords);
+		psSHP->panRecSize = (int *)SfRealloc(psSHP->panRecSize, sizeof(int) * psSHP->nMaxRecords);
+	}
+
+	/* -------------------------------------------------------------------- */
+	/*  Extract vertices for a Polygon or Arc.								*/
+	/* -------------------------------------------------------------------- */
+
+	double XMin = X1;
+	double YMin = Y1;
+	double XMax = X1;
+	double YMax = Y1;
+
+	if (XMin > X2)	XMin = X2;
+	if (XMin > X3)	XMin = X3;
+	if (YMin > Y2)	YMin = Y2;
+	if (YMin > Y3)	YMin = Y3;
+
+	if (XMax < X2)	XMax = X2;
+	if (XMax < X3)	XMax = X3;
+	if (YMax < Y2)	YMax = Y2;
+	if (YMax < Y3)	YMax = Y3;
+
+    ByteCopy (&XMin, pabyRec +  0, 8);
+    ByteCopy (&YMin, pabyRec +  8, 8);
+    ByteCopy (&XMax, pabyRec + 16, 8);
+    ByteCopy (&YMax, pabyRec + 24, 8);
+
+    if (bBigEndian)
+    {
+        Swap8Bytes (pabyRec + 12);				// 12 - 19
+        Swap8Bytes (pabyRec + 20);				// 20 - 27
+        Swap8Bytes (pabyRec + 28);				// 28 - 35
+        Swap8Bytes (pabyRec + 36);				// 36 - 43
+    }
+
+	int32 nPoints = 3;
+	int32 nParts = 0;
+
+	if (bBigEndian) Swap4Bytes(&nPoints);
+	if (bBigEndian) Swap4Bytes(&nParts);
+
+	ByteCopy (&nParts, pabyRec + 44, 4);		// 44 - 47
+    ByteCopy (&nPoints, pabyRec + 48, 4);		// 48 - 51
+
+	ByteCopy (&X1, pabyRec + 52, 8 );			// 52 - 59
+	ByteCopy (&Y1, pabyRec + 60, 8 );			// 60 - 67
+
+   	if (bBigEndian)	Swap8Bytes(pabyRec + 52);
+	if (bBigEndian)	Swap8Bytes(pabyRec + 60);
+
+	ByteCopy(&X2, pabyRec + 68, 8 );			// 68 - 75
+	ByteCopy(&Y2, pabyRec + 76, 8 );			// 76 - 83
+
+   	if (bBigEndian)	Swap8Bytes(pabyRec + 68);
+	if (bBigEndian)	Swap8Bytes(pabyRec + 76);
+
+	ByteCopy (&X3, pabyRec + 84, 8 );			// 84 - 91
+	ByteCopy (&Y3, pabyRec + 92, 8 );			// 92 - 99
+
+   	if (bBigEndian)	Swap8Bytes(pabyRec + 84);
+	if (bBigEndian)	Swap8Bytes(pabyRec + 92);
+
+	nRecordSize = 100;
+
+
+	/* -------------------------------------------------------------------- */
+	/*      Establish where we are going to put this record. If we are      */
+	/*      rewriting and existing record, and it will fit, then put it     */
+	/*      back where the original came from.  Otherwise write at the end. */
+	/* -------------------------------------------------------------------- */
+
+	int nShapeId = psSHP->nRecords++;
+
+    psSHP->panRecOffset[nShapeId] = nRecordOffset = psSHP->nFileSize;
+    psSHP->panRecSize[nShapeId] = nRecordSize-8;
+    psSHP->nFileSize += nRecordSize;
+
+	/* -------------------------------------------------------------------- */
+	/*      Set the shape type, record number, and record size.             */
+	/* -------------------------------------------------------------------- */
+	i32 = nShapeId+1;						/* record # */
+    if (!bBigEndian) Swap4Bytes (&i32);
+    ByteCopy (&i32, pabyRec, 4);
+
+    i32 = (nRecordSize-8)/2;				/* record size */
+    if (!bBigEndian) Swap4Bytes (&i32);
+    ByteCopy (&i32, pabyRec + 4, 4);
+
+    i32 = SHPT_POLYGON;				/* shape type */
+    if (bBigEndian) Swap4Bytes(&i32);
+    ByteCopy (&i32, pabyRec + 8, 4);
+
+	/* -------------------------------------------------------------------- */
+	/*      Write out record.                                               */
+	/* -------------------------------------------------------------------- */
+	if (fseek(fpSHP, nRecordOffset, 0) != 0 || fwrite(pabyRec, nRecordSize, 1, fpSHP) < 1)
+    {
+		dump_error(__FILE__, __LINE__, "Error in fseek() or fwrite().\n");
+		return (-1);
+    }
+
+	/* -------------------------------------------------------------------- */
+	/*	Expand file wide bounds based on this shape.			*/
+	/* -------------------------------------------------------------------- */
+    if (psSHP->adBoundsMin[0] == 0.0 && psSHP->adBoundsMax[0] == 0.0 && psSHP->adBoundsMin[1] == 0.0 && psSHP->adBoundsMax[1] == 0.0)
+    {
+        psSHP->adBoundsMin[0] = psSHP->adBoundsMax[0] = X1;
+        psSHP->adBoundsMin[1] = psSHP->adBoundsMax[1] = Y1;
+        psSHP->adBoundsMin[2] = psSHP->adBoundsMax[2] = 0.0;
+        psSHP->adBoundsMin[3] = psSHP->adBoundsMax[3] = 0.0;
+    }
+
+	if (psSHP->adBoundsMin[0] > XMin)	psSHP->adBoundsMin[0] = XMin;
+	if (psSHP->adBoundsMin[1] > YMin)	psSHP->adBoundsMin[1] = YMin;
+
+	if (psSHP->adBoundsMax[0] < XMax)	psSHP->adBoundsMax[0] = XMax;
+	if (psSHP->adBoundsMax[1] < YMax)	psSHP->adBoundsMax[1] = YMax;
+
+	return(nShapeId);
+}
+
+
+/************************************************************************/
 /*                           SHPWriteObject()                           */
 /*                                                                      */
 /*      Write out the vertices of a new structure.  Note that it is     */

Modified: trunk/src/shape.h
===================================================================
--- trunk/src/shape.h	2006-10-05 19:21:36 UTC (rev 65)
+++ trunk/src/shape.h	2006-10-10 23:19:35 UTC (rev 66)
@@ -179,6 +179,7 @@
 void SHPAPI_CALL 			SHPSetMaxRecords(SHPHandle psSHP, int nNewMaxRecords);
 int SHPAPI_CALL             SHPWriteObject( SHPHandle hSHP, int iShape, SHPObject * psObject );
 int SHPAPI_CALL 			SHPWritePoint(SHPHandle psSHP, double X, double Y);
+int SHPAPI_CALL 			SHPWriteElement(SHPHandle psSHP, double X1, double Y1, double X2, double Y2, double X3, double Y3);
 
 void SHPAPI_CALL            SHPDestroyObject( SHPObject * psObject );
 void SHPAPI_CALL            SHPComputeExtents( SHPObject * psObject );

Modified: trunk/src/test.cpp
===================================================================
--- trunk/src/test.cpp	2006-10-05 19:21:36 UTC (rev 65)
+++ trunk/src/test.cpp	2006-10-10 23:19:35 UTC (rev 66)
@@ -15,6 +15,8 @@
 #include "tools.h"
 #include "test.h"
 
+#include <stdexcept>
+
 int ReturnCode = 0;
 
 FILE *fhlog = 0;
@@ -38,19 +40,31 @@
 		if (argc <= 1 || strncmp(argv[1], "file", 4) == 0)		test_file();
 		if (argc <= 1 || strncmp(argv[1], "tri", 3) == 0)		test_tri();
 	}
-	catch (TFehler Fehler)
+	catch (const std::runtime_error& e)
 	{
-		printf ("Fehler '%s' korrekt gefangen\n", Fehler.Fehlermeldung.c_str());
-		printf ("Programmabbruch\n");
-
-		return (3);
+		write_fortschritt ("Fehler wurde korrekt abgefangen\n");
+		write_fortschritt ("Programmabbruch\n");
 	}
+	catch (const std::length_error& e)
+	{
+		write_fortschritt ("Es steht leider nicht genug Speicher zur Verfügung\n", e.what());
+		write_fortschritt ("Fehler wurde korrekt abgefangen\n");
+		write_fortschritt ("Programmabbruch\n");
+	}
+	catch (const std::exception& e)
+	{
+		write_fortschritt ("%s\n", e.what());
+		write_fortschritt ("Fehler wurde korrekt abgefangen\n");
+		write_fortschritt ("Bitte informieren sie den Programmierer\n");
+		write_fortschritt ("Programmabbruch\n");
+	}
 	catch (...)
 	{
-		printf ("Fehler nicht korrekt gefangen\n");
-		printf ("Programmabbruch\n");
+		write_fortschritt ("Unbekannter Fehler wurde korrekt abgefangen\n");
+		write_fortschritt ("Bitte informieren sie den Programmierer\n");
+		write_fortschritt ("Programmabbruch\n");
 
-		return (3);
+		ReturnCode = 2;
 	}
 
 	return (ReturnCode);

Modified: trunk/src/test_xy.cpp
===================================================================
--- trunk/src/test_xy.cpp	2006-10-05 19:21:36 UTC (rev 65)
+++ trunk/src/test_xy.cpp	2006-10-10 23:19:35 UTC (rev 66)
@@ -21,6 +21,15 @@
 
 #include "xy.h"
 
+//----------------------------------------------------------------------------
+#ifdef __BORLANDC__
+#define POLYGONFILE		"test_daten\\test1.shp"
+#define PROFILFILE		"test_daten\\test1p.shp"
+#else
+#define POLYGONFILE		"test_daten/test1.shp"
+#define PROFILFILE		"test_daten/test1p.shp"
+#endif
+
 //---------------------------------------------------------------------
 void test_xy(void)
 {
@@ -42,6 +51,8 @@
 
 		if (Xy->X != 999999999 || Xy->Y != 999999999)		printf("Failed\n");
 		else												printf("Pass\n");
+
+        delete Xy;
 	}
 
 	////////////////////////////////////////
@@ -311,6 +322,121 @@
 		delete EP;
 	}
 
+	{
+		////////////////////////////////////////
+		// XYList-Polygone Cut
+		////////////////////////////////////////
+
+		printf ("Test Cut1:                                                           ");
+
+		TXYList *ProfilPolygon = new TXYList();
+
+        ProfilPolygon->Add(2816, 5499);
+        ProfilPolygon->Add(4518, 6061);
+        ProfilPolygon->Add(6729, 6536);
+        ProfilPolygon->Add(6595, 5192);
+        ProfilPolygon->Add(6600, 3306);
+        ProfilPolygon->Add(6639, 1925);
+        ProfilPolygon->Add(4605, 1508);
+        ProfilPolygon->Add(2687, 2269);
+        ProfilPolygon->Add(2682, 4155);
+
+    	TProfil *CutProfil1 = new TProfil(0);
+
+    	CutProfil1->AddPoint(6729, 6536);
+	    CutProfil1->AddPoint(6595, 5192);
+    	CutProfil1->AddPoint(6600, 3306);
+	    CutProfil1->AddPoint(6639, 1925);
+
+    	TProfil *CutProfil2 = new TProfil(1);
+
+    	CutProfil2->AddPoint(2816, 5499);
+	    CutProfil2->AddPoint(2682, 4155);
+    	CutProfil2->AddPoint(2687, 2269);
+
+		TXYList *BegrenzungsPolygon = new TXYList();
+
+        BegrenzungsPolygon->Add(2144, 6240);
+        BegrenzungsPolygon->Add(4147, 5503);
+        BegrenzungsPolygon->Add(5044, 5540);
+        BegrenzungsPolygon->Add(5720, 5552);
+        BegrenzungsPolygon->Add(7108, 6154);
+        BegrenzungsPolygon->Add(7711, 5945);
+        BegrenzungsPolygon->Add(8288, 5761);
+        BegrenzungsPolygon->Add(8939, 5736);
+        BegrenzungsPolygon->Add(9480, 5638);
+        BegrenzungsPolygon->Add(9849, 5110);
+        BegrenzungsPolygon->Add(9849, 2580);
+        BegrenzungsPolygon->Add(9308, 2052);
+        BegrenzungsPolygon->Add(8534, 2174);
+        BegrenzungsPolygon->Add(7883, 2125);
+        BegrenzungsPolygon->Add(6543, 2383);
+        BegrenzungsPolygon->Add(5327, 2371);
+        BegrenzungsPolygon->Add(3705, 2518);
+        BegrenzungsPolygon->Add(2537, 3157);
+        BegrenzungsPolygon->Add(1616, 3734);
+        BegrenzungsPolygon->Add(1911, 5122);
+
+        TXYList* NewPolygon1 = BegrenzungsPolygon->Cut(ProfilPolygon, CutProfil1);
+
+		TXY* Xy1 = *NewPolygon1->begin();
+
+        TXYList* NewPolygon2 = NewPolygon1->Cut(ProfilPolygon, CutProfil2);
+
+		TXY* Xy2 = *NewPolygon2->begin();
+
+		if (NewPolygon1->size() != 13)		printf("Failed\n");
+		else if (Xy1->X != 4147)			printf("Failed\n");
+		else if (Xy1->Y != 5503)			printf("Failed\n");
+		else if (NewPolygon2->size() != 11)	printf("Failed\n");
+		else if (Xy2->X != 5044)			printf("Failed\n");
+		else if (Xy2->Y != 5540)			printf("Failed\n");
+		else								printf("Pass\n");
+
+        delete NewPolygon1;
+        delete NewPolygon2;
+
+        delete CutProfil1;
+        delete CutProfil2;
+
+        delete ProfilPolygon;
+
+        delete BegrenzungsPolygon;
+    }
+
+	{
+		////////////////////////////////////////
+		// XYList-Polygone Cut2
+		////////////////////////////////////////
+
+		printf ("Test Cut2:                                                           ");
+
+		TProfilList* Profile = new TProfilList();
+		TXYList *Gebiet = new TXYList();
+
+		LoadGebiet(POLYGONFILE, Gebiet, 8);
+		LoadProfile(PROFILFILE, Profile, -9999.9, 9999.9, 8);
+
+		TProfil* CutProfil = *Profile->begin();
+
+		TXYList* ProfilPolygon = new TXYList();
+		BuildPolygon(Profile, ProfilPolygon, 8);
+
+        TXYList* NewPolygon = Gebiet->Cut(ProfilPolygon, CutProfil);
+
+		TXY* Xy = *NewPolygon->begin();
+
+		if (NewPolygon->size() != 20)	printf("Failed\n");
+		else if (Xy->X != 32484)		printf("Failed\n");
+		else if (Xy->Y != 61982)		printf("Failed\n");
+		else							printf("Pass\n");
+
+		delete NewPolygon;
+		delete ProfilPolygon;
+        delete Profile;
+		delete Gebiet;
+	}
+
 /*
 	/////////////////////////////////////////////
 	// Jetzt der Edge Teil

Modified: trunk/src/tools.cpp
===================================================================
--- trunk/src/tools.cpp	2006-10-05 19:21:36 UTC (rev 65)
+++ trunk/src/tools.cpp	2006-10-10 23:19:35 UTC (rev 66)
@@ -1855,11 +1855,11 @@
 
 	if (PDx == 0 && PDy == 0)
 	{
-		dump_error(__FILE__, __LINE__, "Punktabstand (%.3f %.3f) - (%.3f %.3f) ist zu klein\n", P0x, P0y, P1x, P1y);
+		dump_error(__FILE__, __LINE__, "Punktabstand (%d %d) - (%d %d) ist zu klein\n", P0x, P0y, P1x, P1y);
 	}
 	else if (SDx == 0 && SDy == 0)
 	{
-		dump_error(__FILE__, __LINE__, "Punktabstand (%.3f %.3f) - (%.3f %.3f) ist zu klein\n", P0x, P0y, P1x, P1y);
+		dump_error(__FILE__, __LINE__, "Punktabstand (%d %d) - (%d %d) ist zu klein\n", P0x, P0y, P1x, P1y);
 	}
 	else if (PDx == 0 && SDx == 0)
 	{
@@ -1973,7 +1973,7 @@
 		write_fortschritt("%d,%d %d,%d\n", P0x, P0y, P1x, P1y);
 		write_fortschritt("%d,%d %d,%d\n", S0x, S0y, S1x, S1y);
 		write_fortschritt("%.2f,%.2f\n", Px, Py);
-		dump_error(__FILE__, __LINE__, "TPX nicht koorekt");
+		dump_error(__FILE__, __LINE__, "TPX nicht korrekt");
 	}
 
 	if (fabs(TPY - Py) > 0.1)
@@ -1981,7 +1981,7 @@
 		write_fortschritt("%d,%d %d,%d\n", P0x, P0y, P1x, P1y);
 		write_fortschritt("%d,%d %d,%d\n", S0x, S0y, S1x, S1y);
 		write_fortschritt("%.2f,%.2f\n", Px, Py);
-		dump_error(__FILE__, __LINE__, "TPY nicht koorekt");
+		dump_error(__FILE__, __LINE__, "TPY nicht korrekt");
 	}
 
 	if (fabs(TSX - Px) > 0.1)
@@ -1989,7 +1989,7 @@
 		write_fortschritt("%d,%d %d,%d\n", P0x, P0y, P1x, P1y);
 		write_fortschritt("%d,%d %d,%d\n", S0x, S0y, S1x, S1y);
 		write_fortschritt("%.2f,%.2f\n", Px, Py);
-		dump_error(__FILE__, __LINE__, "TSX nicht koorekt");
+		dump_error(__FILE__, __LINE__, "TSX nicht korrekt");
 	}
 
 	if (fabs(TSY - Py) > 0.1)
@@ -1997,7 +1997,7 @@
 		write_fortschritt("%d,%d %d,%d\n", P0x, P0y, P1x, P1y);
 		write_fortschritt("%d,%d %d,%d\n", S0x, S0y, S1x, S1y);
 		write_fortschritt("%.2f,%.2f\n", Px, Py);
-		dump_error(__FILE__, __LINE__, "TSY nicht koorekt");
+		dump_error(__FILE__, __LINE__, "TSY nicht korrekt");
 	}
 
 

Modified: trunk/src/wsplgen.cpp
===================================================================
--- trunk/src/wsplgen.cpp	2006-10-05 19:21:36 UTC (rev 65)
+++ trunk/src/wsplgen.cpp	2006-10-10 23:19:35 UTC (rev 66)
@@ -86,11 +86,11 @@
 	TProfilList *Rohre2List = new TProfilList();
 
 	// Hier wird das aktuelle Begrenzungspolygon drin verwaltet
-	TXYList BegrenzungsPolygon;
+	TXYList* BegrenzungsPolygon = new TXYList();
 
 	// Hier werden dir Knoten des DGM drin verwaltet
 	// (und an andere Klassen in Form von Pointern ausgeliehen)
-	TNodeList *NodeList = new TNodeList();
+	TNodeList* NodeList = new TNodeList();
 
 	// Hier werden die Gewaesserachsen drin verwaltet
 	TGewaesserAchseList GewaesserAchseList;
@@ -142,18 +142,32 @@
 			LoadLinien(Parameter.FileNameLin, SperrenList, GrabenList, Rohre1List, Rohre2List, Parameter.DebugLevel);
 		}
 
-		// Jetzt ein Polygon einlesen oder aus dn Profilen bilden
+		// Jetzt ein Polygon einlesen oder aus den Profilen bilden
 		if (Parameter.IsSetGebiet)
 		{
-			LoadGebiet(Parameter.FileNameGebiet, &BegrenzungsPolygon, Parameter.DebugLevel);
+			TXYList* Tmp1BegrenzungsPolygon = new TXYList();
+			LoadGebiet(Parameter.FileNameGebiet, Tmp1BegrenzungsPolygon, Parameter.DebugLevel);
+
+			TXYList* ProfilPolygon = new TXYList();
+			BuildPolygon(ProfilList, ProfilPolygon, Parameter.DebugLevel);
+
+			TProfil* FirstProfil = *ProfilList->begin();
+            TXYList* Tmp2BegrenzungsPolygon = Tmp1BegrenzungsPolygon->Cut(ProfilPolygon, FirstProfil);
+
+			TProfil* LastProfil = *ProfilList->rbegin();
+            BegrenzungsPolygon = Tmp2BegrenzungsPolygon->Cut(ProfilPolygon, LastProfil);
+
+            delete Tmp2BegrenzungsPolygon;
+            delete Tmp1BegrenzungsPolygon;
+            delete ProfilPolygon;
 		}
 		else
 		{
-			BuildPolygon(ProfilList, &BegrenzungsPolygon, Parameter.DebugLevel);
+			BuildPolygon(ProfilList, BegrenzungsPolygon, Parameter.DebugLevel);
 		}
 
 		std::string PolygonFileName = ExchangeFileExt(Parameter.FileNameAusgabe, "_begrenzungspolygon.shp");
-		SavePolygon(PolygonFileName, &BegrenzungsPolygon, Parameter.DebugLevel);
+		SavePolygon(PolygonFileName, BegrenzungsPolygon, Parameter.DebugLevel);
 
 		// Hier werden die Elemente drin verwaltet
 		// Die Elemente werden aus ausgeliehenen Knoten gebildet
@@ -161,12 +175,12 @@
 		// Eigentlich braucht man die Elemente nicht
 		TElementList *ElementList = new TElementList;
 
-		LoadDGM(Parameter.FileNameDgm, NodeList, ElementList, &BegrenzungsPolygon, Parameter.DebugLevel);
+		LoadDGM(Parameter.FileNameDgm, NodeList, ElementList, BegrenzungsPolygon, Parameter.DebugLevel);
 
 		// Wenn die Elementliste noch leer ist, müssen die Knoten noch trianguliert werden.
 		if (ElementList->size() == 0)
 		{
-			if (false == Triangulate (NodeList, ElementList, &BegrenzungsPolygon, Parameter.DebugLevel)) return (false);
+			if (false == Triangulate (NodeList, ElementList, BegrenzungsPolygon, Parameter.DebugLevel)) return (false);
 
 			std::string TriNetzFileName = ExchangeFileExt(Parameter.FileNameAusgabe, "_tri.2dm");
 			if (Parameter.IsSetSaveTri) SaveNet(TriNetzFileName, NodeList, ElementList, Parameter.DebugLevel);
@@ -174,6 +188,8 @@
 			if (Parameter.IsSetSaveTri) SaveElements(TriElementFileName, ElementList, 0, Parameter.DebugLevel);
 		}
 
+		delete BegrenzungsPolygon;
+
 		NodeList->SortByNr();
 
 		if (SperrenList->size() > 0 || GrabenList->size() > 0)

Modified: trunk/src/wsplgen.h
===================================================================
--- trunk/src/wsplgen.h	2006-10-05 19:21:36 UTC (rev 65)
+++ trunk/src/wsplgen.h	2006-10-10 23:19:35 UTC (rev 66)
@@ -10,8 +10,12 @@
 // Read the file COPYING coming with WSPLGEN for details.
 //
 
-const char Version[] = "0.9.17 r3";
+const char Version[] = "0.9.18 r1";
 
+// Das Begrenzungspolygon wird jetzt korrekt vom ersten und letzten Profil beschnitten
+
+// const char Version[] = "0.9.17 r3";
+
 // Es wird nun auch die Endung ASC für GRD-Files akzeptiert.
 // Zwei Speicherfehler wurden behoben
 

Modified: trunk/src/xy.cpp
===================================================================
--- trunk/src/xy.cpp	2006-10-05 19:21:36 UTC (rev 65)
+++ trunk/src/xy.cpp	2006-10-10 23:19:35 UTC (rev 66)
@@ -1,17 +1,17 @@
 //
-// $Id$
+// $Id:	xy.cpp 64 2006-09-25 20:54:55Z mrchip $
 //
-// Copyright (C) 2005 STADT-LAND-FLUSS INGENIEURDIENSTE GmbH
+// 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.
+// This	program	is free	software under the GPL (>=v2)
+// Read	the file COPYING coming	with WSPLGEN for details.
 //
 
 #ifdef __BORLANDC__
-#pragma hdrstop
+#pragma	hdrstop
 #endif
 
 //---------------------------------------------------------------------------
@@ -23,7 +23,7 @@
 #include "xy.h"
 
 //---------------------------------------------------------------------------
-static const double 		MinNodeDistanceKonst = 1;
+static const double		MinNodeDistanceKonst = 1;
 
 //---------------------------------------------------------------------
 // TXY
@@ -57,7 +57,7 @@
 }
 
 //---------------------------------------------------------------------
-TNode::TNode(int nr, long x, long y, int z, int wsp) : TXY (x, y)
+TNode::TNode(int nr, long x, long y, int z, int	wsp) : TXY (x, y)
 {
 	Nr = nr;
 	Z = z;
@@ -66,7 +66,7 @@
 }
 
 //---------------------------------------------------------------------
-TNode::TNode(TNode *node) : TXY (node->X, node->Y)
+TNode::TNode(TNode *node) : TXY	(node->X, node->Y)
 {
 	Nr = node->Nr;
 	Z = node->Z;
@@ -102,11 +102,11 @@
 	{
 		TEdgeIndex *NextEdgeIndex = AktEdgeIndex1->NextEdgeIndex;
 		TEdge* E = AktEdgeIndex1->Edge;
-		write_fortschritt("Knoten %d: Kante %d - %d\n", Nr, E->Node1->Nr, E->Node2->Nr);
-		AktEdgeIndex1 = NextEdgeIndex;
+		write_fortschritt("Knoten %d: Kante %d - %d\n",	Nr, E->Node1->Nr, E->Node2->Nr);
+		AktEdgeIndex1 =	NextEdgeIndex;
 	}
 
-	write_fortschritt("\nKante %d - %d soll gelöscht werden\n", Edge->Node1->Nr, Edge->Node2->Nr);
+	write_fortschritt("\nKante %d -	%d soll	gelöscht werden\n", Edge->Node1->Nr, Edge->Node2->Nr);
 */
 
 
@@ -119,10 +119,10 @@
 
 		if (AktEdgeIndex->Edge == Edge)
 		{
-			Found = true;
+			Found =	true;
 
 			if (AktEdgeIndex == EdgeIndex)	EdgeIndex = NextEdgeIndex;
-			else 							PrevEdgeIndex->NextEdgeIndex = NextEdgeIndex;
+			else							PrevEdgeIndex->NextEdgeIndex = NextEdgeIndex;
 
 			delete AktEdgeIndex;
 			AktEdgeIndex = 0;
@@ -130,7 +130,7 @@
 			break;
 		}
 
-		PrevEdgeIndex = AktEdgeIndex;
+		PrevEdgeIndex =	AktEdgeIndex;
 		AktEdgeIndex = NextEdgeIndex;
 	}
 
@@ -140,22 +140,22 @@
 	{
 		TEdgeIndex *NextEdgeIndex = AktEdgeIndex2->NextEdgeIndex;
 		TEdge* E = AktEdgeIndex2->Edge;
-		write_fortschritt("Knoten %d: Kante %d - %d\n", Nr, E->Node1->Nr, E->Node2->Nr);
-		AktEdgeIndex2 = NextEdgeIndex;
+		write_fortschritt("Knoten %d: Kante %d - %d\n",	Nr, E->Node1->Nr, E->Node2->Nr);
+		AktEdgeIndex2 =	NextEdgeIndex;
 	}
 	write_fortschritt("\n");
 */
 
 	if (false == Found)
 	{
-		dump_error(__FILE__, __LINE__, "Konnte zu löschende Kante nicht finden\n");
+		dump_error(__FILE__, __LINE__, "Konnte zu löschende Kante nicht	finden\n");
 	}
 }
 
 //---------------------------------------------------------------------
 struct TNodeSortByNr
 {
-	 bool operator()(TNode* const &Node1, TNode* const &Node2)
+	 bool operator()(TNode*	const &Node1, TNode* const &Node2)
 	 {
 		  return(Node1->Nr < Node2->Nr);
 	 }
@@ -169,14 +169,14 @@
 TPoint::TPoint(long x, long y, int z, int meter) : TXY (x, y)
 {
 	Z = z;
-	Meter = meter;
+	Meter =	meter;
 }
 
 //---------------------------------------------------------------------
-TPoint::TPoint(TPoint *point) : TXY (point->X, point->Y)
+TPoint::TPoint(TPoint *point) :	TXY (point->X, point->Y)
 {
 	Z = point->Z;
-	Meter = point->Meter;
+	Meter =	point->Meter;
 }
 
 
@@ -185,24 +185,24 @@
 //---------------------------------------------------------------------
 
 //---------------------------------------------------------------------
-TElement::TElement(TNode* node1, TNode* node2, TNode* node3)
+TElement::TElement(TNode* node1, TNode*	node2, TNode* node3)
 {
 	Typ = TRI;
 
-	Node1 = node1;
-	Node2 = node2;
-	Node3 = node3;
+	Node1 =	node1;
+	Node2 =	node2;
+	Node3 =	node3;
 }
 
 //---------------------------------------------------------------------
-TElement::TElement(TNode* node1, TNode* node2, TNode* node3, TNode* node4)
+TElement::TElement(TNode* node1, TNode*	node2, TNode* node3, TNode* node4)
 {
 	Typ = QUAD;
 
-	Node1 = node1;
-	Node2 = node2;
-	Node3 = node3;
-	Node4 = node4;
+	Node1 =	node1;
+	Node2 =	node2;
+	Node3 =	node3;
+	Node4 =	node4;
 }
 
 //---------------------------------------------------------------------
@@ -210,10 +210,10 @@
 {
 	Typ = element->Typ;
 
-	Node1 = element->Node1;
-	Node2 = element->Node2;
-	Node3 = element->Node3;
-	Node4 = element->Node4;
+	Node1 =	element->Node1;
+	Node2 =	element->Node2;
+	Node3 =	element->Node3;
+	Node4 =	element->Node4;
 }
 
 //---------------------------------------------------------------------
@@ -233,7 +233,7 @@
 //---------------------------------------------------------------------------
 TXYList::~TXYList(void)
 {
-	if (QuadTree)   delete QuadTree;
+	if (QuadTree)	delete QuadTree;
 	QuadTree = 0;
 
 	Clear();
@@ -244,7 +244,7 @@
 {
 	for (unsigned int i=0; i<size(); i++)
 	{
-		TXY *Xy = (*this)[i];
+		TXY *Xy	= (*this)[i];
 		delete Xy;
 		Xy = 0;
 	}
@@ -259,7 +259,7 @@
 //---------------------------------------------------------------------
 TXYList* TXYList::Copy(void)
 {
-	TXYList *NewXyList = new TXYList;
+	TXYList	*NewXyList = new TXYList;
 
 	for (unsigned int i=0; i<size(); i++)
 	{
@@ -267,10 +267,10 @@
 		TXY *NewXy = new TXY(OldXy);
 		NewXyList->push_back(NewXy);
 	}
-	NewXyList->MinX = MinX;
-	NewXyList->MaxX = MaxX;
-	NewXyList->MinY = MinY;
-	NewXyList->MaxY = MaxY;
+	NewXyList->MinX	= MinX;
+	NewXyList->MaxX	= MaxX;
+	NewXyList->MinY	= MinY;
+	NewXyList->MaxY	= MaxY;
 
 	return(NewXyList);
 }
@@ -280,12 +280,12 @@
 {
 	write_fortschritt("->Sortieren der Punkte gestartet\n");
 
-	if (QuadTree)   delete QuadTree;
+	if (QuadTree)	delete QuadTree;
 	QuadTree = new TQuadTree<TXYList, TXY>();
 
-	for (iterator i = begin(); i != end(); i++)
+	for (iterator i	= begin(); i !=	end(); i++)
 	{
-		TXY* Xy = *i;
+		TXY* Xy	= *i;
 		QuadTree->Insert(MinX, MaxX, MinY, MaxY, Xy);
 	}
 
@@ -295,20 +295,20 @@
 //---------------------------------------------------------------------
 TXY* TXYList::FindByXY(long X, long Y)
 {
-	if (size() <= 0) return (0);
+	if (size() <= 0) return	(0);
 
-	TXY* Xy = QuadTree->Search(X, Y, MinX, MaxX, MinY, MaxY);
+	TXY* Xy	= QuadTree->Search(X, Y, MinX, MaxX, MinY, MaxY);
 
 	if (Xy)
 	{
 /*
-		if (Xy->X == X && Xy->Y == Y)
+		if (Xy->X == X && Xy->Y	== Y)
 		{
 			return (Xy);
 		}
 		else
 		{
-			dump_error(__FILE__, __LINE__, "Falschen Knoten gefunden\n");
+			dump_error(__FILE__, __LINE__, "Falschen Knoten	gefunden\n");
 		}
 */
 
@@ -318,9 +318,9 @@
 /*
 	for (unsigned int i=0; i<size(); i++)
 	{
-		TXY *Xy = (* this)[i];
+		TXY *Xy	= (* this)[i];
 
-		if (Xy->X >= X - Eps && Xy->X <= X + Eps && Xy->Y >= Y - Eps && Xy->Y <= Y + Eps)
+		if (Xy->X >= X - Eps &&	Xy->X <= X + Eps && Xy->Y >= Y - Eps &&	Xy->Y <= Y + Eps)
 		{
 			dump_error(__FILE__, __LINE__, "Existierenden Knoten nicht gefunden\n");
 		}
@@ -331,28 +331,28 @@
 }
 
 //---------------------------------------------------------------------
-TInsideTyp TXYList::IsInsideXYList(long X, long Y)
+TInsideTyp TXYList::IsInsideXYList(long	X, long	Y)
 {
-	if (X < MinX || X > MaxX || Y < MinY || Y > MaxY)	return (NOT_INSIDE);
+	if (X <	MinX ||	X > MaxX || Y <	MinY ||	Y > MaxY)	return (NOT_INSIDE);
 
 	int alpha = IsInside(this, X, Y);
 
 	if (alpha == 0)		return (NOT_INSIDE);	// not inside
-	if (alpha == 4)		return (INSIDE);   		// inside
-	if (alpha == -4)	return (INSIDE);   		// inside
-	if (alpha == -1)	return (ON_LINE);   	// on line
-	if (alpha == 2)	    return (ON_LINE);   	// on line twisted
-	if (alpha == -2)    return (ON_LINE);   	// on line twisted
+	if (alpha == 4)		return (INSIDE);		// inside
+	if (alpha == -4)	return (INSIDE);		// inside
+	if (alpha == -1)	return (ON_LINE);	// on line
+	if (alpha == 2)	    return (ON_LINE);		// on line twisted
+	if (alpha == -2)    return (ON_LINE);		// on line twisted
 
-	if (alpha == 8)		return (INSIDE);   		// double inside
-	if (alpha == -8)	return (INSIDE);   		// double inside
+	if (alpha == 8)		return (INSIDE);		// double inside
+	if (alpha == -8)	return (INSIDE);		// double inside
 
-	if (alpha == 16)	return (INSIDE);   		// triple inside
-	if (alpha == -16)	return (INSIDE);   		// triple inside
+	if (alpha == 16)	return (INSIDE);		// triple inside
+	if (alpha == -16)	return (INSIDE);		// triple inside
 
-	if (alpha % 4 == 0)	return (INSIDE);   		// some inside
+	if (alpha % 4 == 0)	return (INSIDE);		// some	inside
 
-	dump_error(__FILE__, __LINE__, "Alpha (%d) ungültig\n", alpha);
+	dump_error(__FILE__, __LINE__, "Alpha (%d) ungültig\n",	alpha);
 
 	return (UNDEFINED);
 }
@@ -381,11 +381,162 @@
 //---------------------------------------------------------------------
 void TXYList::Add(long X, long Y)
 {
-	TXY *Xy = new TXY(X, Y);
+	TXY *Xy	= new TXY(X, Y);
 	Add(Xy);
 }
 
 //---------------------------------------------------------------------
+TXYList* TXYList::Cut(TXYList* ProfilPolygon, TProfil* CutProfil)
+{
+	TXYList* CutXyList = new TXYList();
+
+	// Zuerst den ersten Punkt am Ende hinzufügen
+	TXY* Xy	= *begin();
+	Add(Xy->X, Xy->Y);
+
+
+    // Jetzt das CutProfil verlängern, dammit es wirklich zwei Schnittpunkte gibt
+	long X = 0;
+	long Y = 0;
+
+	CutProfil->GetXY(-999999, &X, &Y);
+	CutXyList->Add(X, Y);
+    for	(TPointList::iterator i=CutProfil->PointList->begin(); i != CutProfil->PointList->end(); i++)
+    {
+		TPoint*	Point =	*i;
+
+		CutXyList->Add(Point->X, Point->Y);
+    }
+	CutProfil->GetXY(999999, &X, &Y);
+	CutXyList->Add(X, Y);
+
+
+
+	TXYList* SideZero = new	TXYList();
+	TXYList* SideOne = new TXYList();
+
+	int Side = 0;
+
+	TXY* Xy0 = 0;
+	TXY* Xy1 = 0;
+	for (TXYList::iterator i=begin(); i	!= end(); i++)
+	{
+		Xy0 = Xy1;
+		Xy1 = *i;
+
+	if (Xy0	== 0)
+	{
+		continue;
+	}
+
+	TXY* CutXy0 = 0;
+	TXY* CutXy1 = 0;
+	bool Schnitt = false;
+	double SX = 0;
+	double SY = 0;
+	for	(TXYList::iterator j=CutXyList->begin(); j != CutXyList->end();	j++)
+	{
+		CutXy0 = CutXy1;
+		CutXy1 = *j;
+
+		if (CutXy0 == 0)	continue;
+
+		Schnitt	= Calc2Schnitt(Xy0->X, Xy0->Y, Xy1->X, Xy1->Y, CutXy0->X, CutXy0->Y, CutXy1->X,	CutXy1->Y, &SX,	&SY);
+
+		if (Schnitt)	break;
+	}
+
+	if (Schnitt)
+	{
+		long LSX = (long)(SX + 0.5);
+		long LSY = (long)(SY + 0.5);
+		SideZero->Add(LSX, LSY);
+		SideOne->Add(LSX, LSY);
+		Side = 1 - Side;    // Wechsel von 0 zu	1 oder von 1 zu	0
+	}
+
+	if (Side == 0)
+	{
+		SideZero->Add(Xy1->X, Xy1->Y);
+	}
+	else
+	{
+		SideOne->Add(Xy1->X, Xy1->Y);
+	}
+    }
+
+
+/*
+    write_fortschritt("\n");
+
+	int Count = 0;
+    for	(TXYList::iterator i=SideZero->begin();	i != SideZero->end(); i++)
+	{
+		TXY* Xy	= *i;
+
+		write_fortschritt("%d %d %d\n",	++Count, Xy->X,	Xy->Y);
+    }
+
+    write_fortschritt("\n");
+
+    Count = 0;
+    for	(TXYList::iterator i=SideOne->begin(); i != SideOne->end(); i++)
+    {
+		TXY* Xy	= *i;
+
+	write_fortschritt("%d %d %d\n",	++Count, Xy->X,	Xy->Y);
+    }
+
+    write_fortschritt("\n");
+*/
+
+	// Nun haben wir 2 Polygone
+	// Als nächstes	wird getestet, welches das richtige ist.
+
+
+	// Falls das ProfilPolygon größer als das Begrenzungspolygon ist,
+    // werden hier die Punkte innerhalb	gezählt
+	int IsInsideZeroCount =	0;
+    for	(TXYList::iterator i=SideZero->begin();	i != SideZero->end(); i++)
+    {
+		TXY* Xy	= *i;
+
+		if (ProfilPolygon->IsInsideXYList(Xy->X, Xy->Y))	IsInsideZeroCount++;
+    }
+
+	int IsInsideOneCount = 0;
+    for	(TXYList::iterator i=SideOne->begin(); i != SideOne->end(); i++)
+    {
+		TXY* Xy	= *i;
+
+		if (ProfilPolygon->IsInsideXYList(Xy->X, Xy->Y))	IsInsideOneCount++;
+    }
+
+	// Falls das ProfilPolygon kleiner als das Begrenzungspolygon ist,
+    // werden hier die Punkte innerhalb	gezählt
+    for	(TXYList::iterator i=ProfilPolygon->begin(); i != ProfilPolygon->end();	i++)
+    {
+		TXY* Xy	= *i;
+
+		if (SideZero->IsInsideXYList(Xy->X, Xy->Y))	IsInsideZeroCount++;
+		if (SideOne->IsInsideXYList(Xy->X, Xy->Y))	IsInsideOneCount++;
+    }
+
+	delete CutXyList;
+
+    if (IsInsideZeroCount > IsInsideOneCount)
+    {
+	delete SideOne;
+	    return (SideZero);
+    }
+    else
+    {
+		delete SideZero;
+	return (SideOne);
+    }
+}
+
+//---------------------------------------------------------------------
 // TNodeList
 //---------------------------------------------------------------------
 
@@ -394,13 +545,13 @@
 {
 	QuadTree = 0;
 	SearchNodeList = 0;
-	MaxNr = -1;
+	MaxNr =	-1;
 	MinX = 0;
 	MaxX = 0;
 	MinY = 0;
 	MaxY = 0;
-	DiffX = 0;
-	DiffY = 0;
+	DiffX =	0;
+	DiffY =	0;
 }
 
 //---------------------------------------------------------------------------
@@ -412,10 +563,10 @@
 //---------------------------------------------------------------------
 void TNodeList::Clear(void)
 {
-	write_fortschritt("->Löschen des Suchbaumes der Knoten gestartet\n");
+	write_fortschritt("->Löschen des Suchbaumes der	Knoten gestartet\n");
 	if (QuadTree)	delete QuadTree;
 	QuadTree = 0;
-	write_fortschritt("<-Löschen des Suchbaumes der Knoten beendet\n");
+	write_fortschritt("<-Löschen des Suchbaumes der	Knoten beendet\n");
 
 	if (SearchNodeList)
 	{
@@ -427,7 +578,7 @@
 	if (size() > 0)
 	{
 		int Count = 0;
-		for (TNodeList::iterator i = begin(); i != end(); i++)
+		for (TNodeList::iterator i = begin(); i	!= end(); i++)
 		{
 			TNode *Node = *i;
 			delete Node;
@@ -442,13 +593,13 @@
 
 	clear();
 
-	MaxNr = -1;
+	MaxNr =	-1;
 	MinX = 0;
 	MaxX = 0;
 	MinY = 0;
 	MaxY = 0;
-	DiffX = 0;
-	DiffY = 0;
+	DiffX =	0;
+	DiffY =	0;
 }
 
 //---------------------------------------------------------------------
@@ -477,7 +628,7 @@
 //---------------------------------------------------------------------
 void TNodeList::Add(TNode *Node)
 {
-	if (capacity() < size() + 1)
+	if (capacity() < size()	+ 1)
 	{
 		reserve((size_t)(capacity() * 1.1 + 100000));
 		write_fortschritt("Kapazität der Knotenliste wurde auf %d erhöht\n", capacity());
@@ -487,7 +638,7 @@
 
 	if (size() == 1)
 	{
-		MaxNr = Node->Nr;
+		MaxNr =	Node->Nr;
 		MinX = Node->X;
 		MaxX = Node->X;
 		MinY = Node->Y;
@@ -506,9 +657,9 @@
 //---------------------------------------------------------------------
 bool TNodeList::AddWithQuadTree(TNode *Node)
 {
-	if (Node->X < MinX || Node->X > MaxX || Node->Y < MinY || Node->Y > MaxY)
+	if (Node->X < MinX || Node->X >	MaxX ||	Node->Y	< MinY || Node->Y > MaxY)
 	{
-		dump_error(__FILE__, __LINE__, "AddWithQuadTree funktioniert nicht mit Knoten die ausserhalb legen\nKnoten %d %d %d\nBounding Box %d %d %d %d\n", Node->Nr, Node->X, Node->Y, MinX, MaxX, MinY, MaxY);
+		dump_error(__FILE__, __LINE__, "AddWithQuadTree	funktioniert nicht mit Knoten die ausserhalb legen\nKnoten %d %d %d\nBounding Box %d %d	%d %d\n", Node->Nr, Node->X, Node->Y, MinX, MaxX, MinY,	MaxY);
 	}
 
 	// Es werden nur neue Knoten aufgenommen
@@ -529,12 +680,12 @@
 {
 	write_fortschritt("->Sortieren der Knoten gestartet\n");
 
-	write_fortschritt("->Löschen und Neuaufbauen des Suchbaumes der Knoten gestartet\n");
-	if (QuadTree)   delete QuadTree;
+	write_fortschritt("->Löschen und Neuaufbauen des Suchbaumes der	Knoten gestartet\n");
+	if (QuadTree)	delete QuadTree;
 	QuadTree = new TQuadTree<TNodeList, TNode>();
-	write_fortschritt("<-Löschen und Neuaufbauen des Suchbaumes der Knoten beendet\n");
+	write_fortschritt("<-Löschen und Neuaufbauen des Suchbaumes der	Knoten beendet\n");
 
-	for (iterator i = begin(); i != end(); i++)
+	for (iterator i	= begin(); i !=	end(); i++)
 	{
 		TNode* Node = *i;
 
@@ -557,11 +708,11 @@
 //---------------------------------------------------------------------
 TNode* TNodeList::FindByNr(int nr)
 {
-	if (size() <= 0) return (0);
+	if (size() <= 0) return	(0);
 
 	int Under = 0;
 	int Over = size()-1;
-	while (Under <= Over)
+	while (Under <=	Over)
 	{
 		int Index = (Over + Under) / 2;
 
@@ -571,9 +722,9 @@
 		{
 			Over = Index - 1;
 		}
-		else if (nr > Node->Nr)
+		else if	(nr > Node->Nr)
 		{
-			Under = Index + 1;
+			Under =	Index +	1;
 		}
 		else
 		{
@@ -585,9 +736,9 @@
 }
 
 //---------------------------------------------------------------------
-TNode* TNodeList::FindByXY(long X, long Y)
+TNode* TNodeList::FindByXY(long	X, long	Y)
 {
-	if (size() <= 0) return (0);
+	if (size() <= 0) return	(0);
 
 	TNode* Node = QuadTree->Search(X, Y, MinX, MaxX, MinY, MaxY);
 
@@ -600,7 +751,7 @@
 		}
 		else
 		{
-			dump_error(__FILE__, __LINE__, "Falschen Knoten gefunden\n");
+			dump_error(__FILE__, __LINE__, "Falschen Knoten	gefunden\n");
 		}
 */
 
@@ -612,9 +763,9 @@
 	{
 		TNode *Node = (* this)[i];
 
-		if (Node->X >= X - Eps && Node->X <= X + Eps && Node->Y >= Y - Eps && Node->Y <= Y + Eps)
+		if (Node->X >= X - Eps && Node->X <= X + Eps &&	Node->Y	>= Y - Eps && Node->Y <= Y + Eps)
 		{
-			dump_error(__FILE__, __LINE__, "Existierenden Knoten (%.4f,%.4f -> %.4f,%.4f) nicht gefunden\n", X, Y, Node->X, Node->Y);
+			dump_error(__FILE__, __LINE__, "Existierenden Knoten (%.4f,%.4f	-> %.4f,%.4f) nicht gefunden\n", X, Y, Node->X,	Node->Y);
 		}
 	}
 */
@@ -626,7 +777,7 @@
 TNodeList* TNodeList::FindAllByXY(double X, double Y, double R)
 {
 	// Wichtig ist das kleingeschriebene clear
-	// In dieser SearchNodelist sind Knoten drin, die nur geliehen sind.
+	// In dieser SearchNodelist sind Knoten	drin, die nur geliehen sind.
 	// Die Knoten selbst sollen nicht gelöscht werden
 
 	if (SearchNodeList)	SearchNodeList->clear();
@@ -640,29 +791,29 @@
 }
 
 //---------------------------------------------------------------------
-bool TNodeList::Interpolate(TProfilList *SperrenList, long X, long Y, double R, int *ZWert, int *WspWert)
+bool TNodeList::Interpolate(TProfilList	*SperrenList, long X, long Y, double R,	int *ZWert, int	*WspWert)
 {
 	TNodeList *SearchNodeList = FindAllByXY(X, Y, R);
 
-	TNode* TLNode = 0;
+	TNode* TLNode =	0;
 	double TLD = 0.0;
 
-	TNode* BLNode = 0;
+	TNode* BLNode =	0;
 	double BLD = 0.0;
 
-	TNode* TRNode = 0;
+	TNode* TRNode =	0;
 	double TRD = 0.0;
 
-	TNode* BRNode = 0;
+	TNode* BRNode =	0;
 	double BRD = 0.0;
 
-	for (TNodeList::iterator i = SearchNodeList->begin(); i != SearchNodeList->end(); i++)
+	for (TNodeList::iterator i = SearchNodeList->begin(); i	!= SearchNodeList->end(); i++)
 	{
 		TNode* Node = *i;
 
 		long NDx = X - Node->X;
 		long NDy = Y - Node->Y;
-		if (NDx == 0 && NDy == 0)
+		if (NDx	== 0 &&	NDy == 0)
 		{
 			*ZWert = Node->Z;
 			*WspWert = Node->Wsp;
@@ -670,31 +821,31 @@
 			return (true);
 		}
 
-		double DummyX = 0.0;
-		double DummyY = 0.0;
+		double DummyX =	0.0;
+		double DummyY =	0.0;
 		double DummyMeter = 0.0;
 
-		if (SperrenList && SperrenList->size() > 0 && CalcProfilSchnitt(Node->X, Node->Y, X, Y, SperrenList, &DummyX, &DummyY, &DummyMeter)) continue;
+		if (SperrenList	&& SperrenList->size() > 0 && CalcProfilSchnitt(Node->X, Node->Y, X, Y,	SperrenList, &DummyX, &DummyY, &DummyMeter)) continue;
 
 		if (Node->X >= X && Node->Y > Y)
 		{
 			if (0 == TRNode)
 			{
 				TRNode = Node;
-				long Dx = TRNode->X - X;
-				long Dy = TRNode->Y - Y;
+				long Dx	= TRNode->X - X;
+				long Dy	= TRNode->Y - Y;
 
 				TRD = Dx*Dx + Dy*Dy;
 				continue;
 			}
 			else
 			{
-				long Dx = Node->X - X;
-				long Dy = Node->Y - Y;
+				long Dx	= Node->X - X;
+				long Dy	= Node->Y - Y;
 
 				double D = Dx*Dx + Dy*Dy;
 
-				if (D < TRD)
+				if (D <	TRD)
 				{
 					TRNode = Node;
 					TRD = D;
@@ -703,25 +854,25 @@
 			continue;
 		}
 
-		if (Node->X < X && Node->Y >= Y)
+		if (Node->X < X	&& Node->Y >= Y)
 		{
 			if (0 == TLNode)
 			{
 				TLNode = Node;
-				long Dx = TLNode->X - X;
-				long Dy = TLNode->Y - Y;
+				long Dx	= TLNode->X - X;
+				long Dy	= TLNode->Y - Y;
 
 				TLD = Dx*Dx + Dy*Dy;
 				continue;
 			}
 			else
 			{
-				long Dx = Node->X - X;
-				long Dy = Node->Y - Y;
+				long Dx	= Node->X - X;
+				long Dy	= Node->Y - Y;
 
 				double D = Dx*Dx + Dy*Dy;
 
-				if (D < TLD)
+				if (D <	TLD)
 				{
 					TLNode = Node;
 					TLD = D;
@@ -735,20 +886,20 @@
 			if (0 == BLNode)
 			{
 				BLNode = Node;
-				long Dx = BLNode->X - X;
-				long Dy = BLNode->Y - Y;
+				long Dx	= BLNode->X - X;
+				long Dy	= BLNode->Y - Y;
 
 				BLD = Dx*Dx + Dy*Dy;
 				continue;
 			}
 			else
 			{
-				long Dx = Node->X - X;
-				long Dy = Node->Y - Y;
+				long Dx	= Node->X - X;
+				long Dy	= Node->Y - Y;
 
 				double D = Dx*Dx + Dy*Dy;
 
-				if (D < BLD)
+				if (D <	BLD)
 				{
 					BLNode = Node;
 					BLD = D;
@@ -757,25 +908,25 @@
 			continue;
 		}
 
-		if (Node->X > X && Node->Y <= Y)
+		if (Node->X > X	&& Node->Y <= Y)
 		{
 			if (0 == BRNode)
 			{
 				BRNode = Node;
-				long Dx = BRNode->X - X;
-				long Dy = BRNode->Y - Y;
+				long Dx	= BRNode->X - X;
+				long Dy	= BRNode->Y - Y;
 
 				BRD = Dx*Dx + Dy*Dy;
 				continue;
 			}
 			else
 			{
-				long Dx = Node->X - X;
-				long Dy = Node->Y - Y;
+				long Dx	= Node->X - X;
+				long Dy	= Node->Y - Y;
 
 				double D = Dx*Dx + Dy*Dy;
 
-				if (D < BRD)
+				if (D <	BRD)
 				{
 					BRNode = Node;
 					BRD = D;
@@ -786,66 +937,66 @@
 	}
 
 	int ZAnzahl = 0;
-	double ZSumme = 0.0;
-	int WspAnzahl = 0;
-	double WspSumme = 0.0;
+	double ZSumme =	0.0;
+	int WspAnzahl =	0;
+	double WspSumme	= 0.0;
 	if (TLNode != 0)
 	{
 		TLD = TLD * TLD;
-		ZSumme = ZSumme + 1 / TLD;
+		ZSumme = ZSumme	+ 1 / TLD;
 		ZAnzahl++;
 
-		if (TLNode->Wsp != NoWsp)
+		if (TLNode->Wsp	!= NoWsp)
 		{
-			WspSumme = WspSumme + 1 / TLD;
+			WspSumme = WspSumme + 1	/ TLD;
 			WspAnzahl++;
 		}
 	}
 	if (TRNode != 0)
 	{
 		TRD = TRD * TRD;
-		ZSumme = ZSumme + 1 / TRD;
+		ZSumme = ZSumme	+ 1 / TRD;
 		ZAnzahl++;
 
-		if (TRNode->Wsp != NoWsp)
+		if (TRNode->Wsp	!= NoWsp)
 		{
-			WspSumme = WspSumme + 1 / TRD;
+			WspSumme = WspSumme + 1	/ TRD;
 			WspAnzahl++;
 		}
 	}
 	if (BLNode != 0)
 	{
 		BLD = BLD * BLD;
-		ZSumme = ZSumme + 1 / BLD;
+		ZSumme = ZSumme	+ 1 / BLD;
 		ZAnzahl++;
 
-		if (BLNode->Wsp != NoWsp)
+		if (BLNode->Wsp	!= NoWsp)
 		{
-			WspSumme = WspSumme + 1 / BLD;
+			WspSumme = WspSumme + 1	/ BLD;
 			WspAnzahl++;
 		}
 	}
 	if (BRNode != 0)
 	{
 		BRD = BRD * BRD;
-		ZSumme = ZSumme + 1 / BRD;
+		ZSumme = ZSumme	+ 1 / BRD;
 		ZAnzahl++;
 
-		if (BRNode->Wsp != NoWsp)
+		if (BRNode->Wsp	!= NoWsp)
 		{
-			WspSumme = WspSumme + 1 / BRD;
+			WspSumme = WspSumme + 1	/ BRD;
 			WspAnzahl++;
 		}
 	}
 
-	if (WspAnzahl > 0)
+	if (WspAnzahl >	0)
 	{
-		int Wsp = 0;
+		int Wsp	= 0;
 
-		if (TLNode != 0 && TLNode->Wsp != NoWsp) Wsp = Wsp + (int)(1 / TLD / WspSumme * TLNode->Wsp + 0.5);
-		if (TRNode != 0 && TRNode->Wsp != NoWsp) Wsp = Wsp + (int)(1 / TRD / WspSumme * TRNode->Wsp + 0.5);
-		if (BLNode != 0 && BLNode->Wsp != NoWsp) Wsp = Wsp + (int)(1 / BLD / WspSumme * BLNode->Wsp + 0.5);
-		if (BRNode != 0 && BRNode->Wsp != NoWsp) Wsp = Wsp + (int)(1 / BRD / WspSumme * BRNode->Wsp + 0.5);
+		if (TLNode != 0	&& TLNode->Wsp != NoWsp) Wsp = Wsp + (int)(1 / TLD / WspSumme *	TLNode->Wsp + 0.5);
+		if (TRNode != 0	&& TRNode->Wsp != NoWsp) Wsp = Wsp + (int)(1 / TRD / WspSumme *	TRNode->Wsp + 0.5);
+		if (BLNode != 0	&& BLNode->Wsp != NoWsp) Wsp = Wsp + (int)(1 / BLD / WspSumme *	BLNode->Wsp + 0.5);
+		if (BRNode != 0	&& BRNode->Wsp != NoWsp) Wsp = Wsp + (int)(1 / BRD / WspSumme *	BRNode->Wsp + 0.5);
 
 		*WspWert = Wsp;
 	}
@@ -856,12 +1007,12 @@
 
 	if (ZAnzahl > 0)
 	{
-		int Z = 0;
+		int Z =	0;
 
-		if (TLNode != 0) Z = Z + (int)(1 / TLD / ZSumme * TLNode->Z + 0.5);
-		if (TRNode != 0) Z = Z + (int)(1 / TRD / ZSumme * TRNode->Z + 0.5);
-		if (BLNode != 0) Z = Z + (int)(1 / BLD / ZSumme * BLNode->Z + 0.5);
-		if (BRNode != 0) Z = Z + (int)(1 / BRD / ZSumme * BRNode->Z + 0.5);
+		if (TLNode != 0) Z = Z + (int)(1 / TLD / ZSumme	* TLNode->Z + 0.5);
+		if (TRNode != 0) Z = Z + (int)(1 / TRD / ZSumme	* TRNode->Z + 0.5);
+		if (BLNode != 0) Z = Z + (int)(1 / BLD / ZSumme	* BLNode->Z + 0.5);
+		if (BRNode != 0) Z = Z + (int)(1 / BRD / ZSumme	* BRNode->Z + 0.5);
 
 		*ZWert = Z;
 
@@ -879,7 +1030,7 @@
 		write_fortschritt("->Löschen des Knoten/Kanten-Index gestartet\n");
 
 		int Count = 0;
-		for (iterator i = begin(); i != end(); i++)
+		for (iterator i	= begin(); i !=	end(); i++)
 		{
 			TNode *Node = *i;
 			Node->ClearEdgeIndex();
@@ -896,28 +1047,28 @@
 //---------------------------------------------------------------------
 int TNodeList::GetMaxDepth(int DebugLevel)
 {
-	write_fortschritt("->Ermittlung der maximalen Wassertiefe gestartet\n");
+	write_fortschritt("->Ermittlung	der maximalen Wassertiefe gestartet\n");
 
 	int MaxDepth = 0;
 	int Count = 0;
-	for (iterator i = begin(); i != end(); i++)
+	for (iterator i	= begin(); i !=	end(); i++)
 	{
 		TNode* Node = *i;
 
 		if (Node->Wsp == NoWsp)	continue;
 
-		int Depth = Node->Wsp - Node->Z;
+		int Depth = Node->Wsp -	Node->Z;
 
 		if (Depth < 0)
 		{
-			dump_error(__FILE__, __LINE__, "Der Wasserstand ist negativ\n");
+			dump_error(__FILE__, __LINE__, "Der Wasserstand	ist negativ\n");
 		}
 
-		if (Count == 0 || Depth > MaxDepth)	MaxDepth = Depth;
+		if (Count == 0 || Depth	> MaxDepth)	MaxDepth = Depth;
 
 		Count++;
 
-		if (DebugLevel >= 9 || (DebugLevel >= 1 && Count % 10000 == 0) || (Count > 0 && Count % 100000 == 0))
+		if (DebugLevel >= 9 || (DebugLevel >= 1	&& Count % 10000 == 0) || (Count > 0 &&	Count %	100000 == 0))
 		{
 			write_fortschritt("Knoten %d von %d untersucht.\n", Count, size());
 		}
@@ -926,7 +1077,7 @@
 
 	write_fortschritt("Maximale Wassertiefe: %.3f.\n", MaxDepth / 100.0);
 
-	write_fortschritt("<-Ermittlung der maximalen Wassertiefe beendet\n");
+	write_fortschritt("<-Ermittlung	der maximalen Wassertiefe beendet\n");
 
 	return (MaxDepth);
 }
@@ -934,28 +1085,28 @@
 //---------------------------------------------------------------------
 int TNodeList::GetMaxWsp(int DebugLevel)
 {
-	write_fortschritt("->Ermittlung des maximalen Wasserstandes gestartet\n");
+	write_fortschritt("->Ermittlung	des maximalen Wasserstandes gestartet\n");
 
 	int MaxWsp = 0;
 	int Count = 0;
-	for (iterator i = begin(); i != end(); i++)
+	for (iterator i	= begin(); i !=	end(); i++)
 	{
 		TNode* Node = *i;
 
-		if (Node->Wsp == NoWsp) continue;
+		if (Node->Wsp == NoWsp)	continue;
 
-		int Wsp = Node->Wsp;
+		int Wsp	= Node->Wsp;
 
-		if (Wsp < 0.0)
+		if (Wsp	< 0.0)
 		{
-			dump_error(__FILE__, __LINE__, "Der Wasserstand ist negativ\n");
+			dump_error(__FILE__, __LINE__, "Der Wasserstand	ist negativ\n");
 		}
 
-		if (Count == 0 || Wsp > MaxWsp)	MaxWsp = Wsp;
+		if (Count == 0 || Wsp >	MaxWsp)	MaxWsp = Wsp;
 
 		Count++;
 
-		if (DebugLevel >= 9 || (DebugLevel >= 1 && Count % 10000 == 0) || (Count > 0 && Count % 100000 == 0))
+		if (DebugLevel >= 9 || (DebugLevel >= 1	&& Count % 10000 == 0) || (Count > 0 &&	Count %	100000 == 0))
 		{
 			write_fortschritt("Knoten %d von %d untersucht.\n", Count, size());
 		}
@@ -964,7 +1115,7 @@
 
 	write_fortschritt("Maximaler Wasserstand: %.3f.\n", MaxWsp / 100.0);
 
-	write_fortschritt("<-Ermittlung des maximalen Wasserstandes beendet\n");
+	write_fortschritt("<-Ermittlung	des maximalen Wasserstandes beendet\n");
 
 	return (MaxWsp);
 }
@@ -972,30 +1123,30 @@
 //---------------------------------------------------------------------
 int TNodeList::GetMaxZ(int DebugLevel)
 {
-	write_fortschritt("->Ermittlung der maximale Geländehöhe gestartet\n");
+	write_fortschritt("->Ermittlung	der maximale Geländehöhe gestartet\n");
 
 	int MaxZ = 0;
 	int Count = 0;
-	for (iterator i = begin(); i != end(); i++)
+	for (iterator i	= begin(); i !=	end(); i++)
 	{
 		TNode* Node = *i;
 
-		int Z = Node->Z;
+		int Z =	Node->Z;
 
 		if (Count == 0 || Z > MaxZ)	MaxZ = Z;
 
 		Count++;
 
-		if (DebugLevel >= 9 || (DebugLevel >= 1 && Count % 10000 == 0) || (Count > 0 && Count % 100000 == 0))
+		if (DebugLevel >= 9 || (DebugLevel >= 1	&& Count % 10000 == 0) || (Count > 0 &&	Count %	100000 == 0))
 		{
 			write_fortschritt("Knoten %d von %d untersucht.\n", Count, size());
 		}
 	}
 	write_fortschritt("Knoten %d von %d untersucht.\n", Count, size());
 
-	write_fortschritt("Maximale Geländehöhe: %.3f.\n", MaxZ / 100.0);
+	write_fortschritt("Maximale Geländehöhe: %.3f.\n", MaxZ	/ 100.0);
 
-	write_fortschritt("<-Ermittlung der maximale Geländehöhe beendet\n");
+	write_fortschritt("<-Ermittlung	der maximale Geländehöhe beendet\n");
 
 	return (MaxZ);
 }
@@ -1005,20 +1156,20 @@
 {
 	write_fortschritt("->Verschiebung des Koordinatensystems gestartet\n");
 
-	DiffX = MinX;
-	DiffY = MinY;
+	DiffX =	MinX;
+	DiffY =	MinY;
 
 	MinX = MinX - DiffX;
 	MaxX = MaxX - DiffX;
 	MinY = MinY - DiffY;
 	MaxY = MaxY - DiffY;
 
-	for (iterator i = begin(); i != end(); i++)
+	for (iterator i	= begin(); i !=	end(); i++)
 	{
 		TNode* Node = *i;
 
-		Node->X = Node->X - DiffX;
-		Node->Y = Node->Y - DiffY;
+		Node->X	= Node->X - DiffX;
+		Node->Y	= Node->Y - DiffY;
 	}
 
 	write_fortschritt("<-Verschiebung des Koordinatensystems beendet\n");
@@ -1027,14 +1178,14 @@
 //---------------------------------------------------------------------
 void TNodeList::ReScale(void)
 {
-	write_fortschritt("->Zurückverschiebung des Koordinatensystems gestartet\n");
+	write_fortschritt("->Zurückverschiebung	des Koordinatensystems gestartet\n");
 
-	for (iterator i = begin(); i != end(); i++)
+	for (iterator i	= begin(); i !=	end(); i++)
 	{
 		TNode* Node = *i;
 
-		Node->X = Node->X + DiffX;
-		Node->Y = Node->Y + DiffY;
+		Node->X	= Node->X + DiffX;
+		Node->Y	= Node->Y + DiffY;
 	}
 
 	MinX = MinX + DiffX;
@@ -1042,10 +1193,10 @@
 	MinY = MinY + DiffY;
 	MaxY = MaxY + DiffY;
 
-	DiffX = 0;
-	DiffY = 0;
+	DiffX =	0;
+	DiffY =	0;
 
-	write_fortschritt("<-Zurückverschiebung des Koordinatensystems beendet\n");
+	write_fortschritt("<-Zurückverschiebung	des Koordinatensystems beendet\n");
 }
 
 //---------------------------------------------------------------------
@@ -1068,7 +1219,7 @@
 		{
 			TElement *Element = *i;
 			delete Element;
-			Element = 0;
+			Element	= 0;
 
 			Count++;
 
@@ -1082,21 +1233,21 @@
 //---------------------------------------------------------------------
 void TElementList::Add(TElement* Element)
 {
-	if (capacity() < size() + 1)
+	if (capacity() < size()	+ 1)
 	{
 		reserve((size_t)(capacity() * 1.1 + 200000));
-		write_fortschritt("Kapazität der Elementliste wurde auf %d erhöht\n", capacity());
+		write_fortschritt("Kapazität der Elementliste wurde auf	%d erhöht\n", capacity());
 	}
 
 	push_back(Element);
 }
 
 //---------------------------------------------------------------------------
-void TElementList::HelpChangeElements(TNodeList *NodeList, TProfilList *LinienList, int ZWert, int DebugLevel)
+void TElementList::HelpChangeElements(TNodeList	*NodeList, TProfilList *LinienList, int	ZWert, int DebugLevel)
 {
-	int MaxNodeNr = NodeList->MaxNr;
+	int MaxNodeNr =	NodeList->MaxNr;
 
-	int ChangeCount = 0;
+	int ChangeCount	= 0;
 	int Count = 0;
 	for (unsigned int i = 0; i < size(); i++)
 	{
@@ -1104,16 +1255,16 @@
 
 		Count++;
 
-		if (DebugLevel >= 9 || (DebugLevel >= 1 && Count % 5000 == 0) || (Count % 50000 == 0))
+		if (DebugLevel >= 9 || (DebugLevel >= 1	&& Count % 5000	== 0) || (Count	% 50000	== 0))
 		{
-			write_fortschritt("%d von %d Elementen, %d Elemente angepasst\n", Count, size(), ChangeCount);
+			write_fortschritt("%d von %d Elementen,	%d Elemente angepasst\n", Count, size(), ChangeCount);
 		}
 
-		// Hier werden die zum Löschen markierten Elemente ignoriert.
+		// Hier	werden die zum Löschen markierten Elemente ignoriert.
 		if (Element->Typ == NO_ELEMENT)	continue;
 
 
-		// Hier werden die neuen  Elemente wieder auf einen korrekten Typ gesetzt und dann ignoriert.
+		// Hier	werden die neuen  Elemente wieder auf einen korrekten Typ gesetzt und dann ignoriert.
 		if (Element->Typ == NEWTRI)
 		{
 			Element->Typ = TRI;
@@ -1122,7 +1273,7 @@
 
 		if (Element->Typ == QUAD)
 		{
-			dump_error(__FILE__, __LINE__, "Viereckselemente werden im Moment noch nicht unterstützt");
+			dump_error(__FILE__, __LINE__, "Viereckselemente werden	im Moment noch nicht unterstützt");
 		}
 
 		TNode* Node1 = Element->Node1;
@@ -1133,19 +1284,19 @@
 
 		double dummyMeter = 0.0;
 
-		if (Node1->X == Node2->X && Node1->Y == Node2->Y)
+		if (Node1->X ==	Node2->X && Node1->Y ==	Node2->Y)
 		{
 			Element->Typ = NO_ELEMENT;
 			continue;
 		}
 
-		if (Node2->X == Node3->X && Node2->Y == Node3->Y)
+		if (Node2->X ==	Node3->X && Node2->Y ==	Node3->Y)
 		{
 			Element->Typ = NO_ELEMENT;
 			continue;
 		}
 
-		if (Node3->X == Node1->X && Node3->Y == Node1->Y)
+		if (Node3->X ==	Node1->X && Node3->Y ==	Node1->Y)
 		{
 			Element->Typ = NO_ELEMENT;
 			continue;
@@ -1163,9 +1314,9 @@
 		long Y23 = 0;
 		long X31 = 0;
 		long Y31 = 0;
-		TNode* Node12 = 0;
-		TNode* Node23 = 0;
-		TNode* Node31 = 0;
+		TNode* Node12 =	0;
+		TNode* Node23 =	0;
+		TNode* Node31 =	0;
 
 		bool Schnitt12 = CalcProfilSchnitt(Node1->X, Node1->Y, Node2->X, Node2->Y, LinienList, &XD12, &YD12, &dummyMeter);
 		bool Schnitt23 = CalcProfilSchnitt(Node2->X, Node2->Y, Node3->X, Node3->Y, LinienList, &XD23, &YD23, &dummyMeter);
@@ -1181,29 +1332,29 @@
 
 			if (FoundNodeList->size() > 0)
 			{
-				for (TNodeList::iterator j=FoundNodeList->begin(); j != FoundNodeList->end(); j++)
+				for (TNodeList::iterator j=FoundNodeList->begin(); j !=	FoundNodeList->end(); j++)
 				{
 					TNode* Node = *j;
 
-					if (Node1->X == Node->X && Node1->Y == Node->Y)
+					if (Node1->X ==	Node->X	&& Node1->Y == Node->Y)
 					{
-						Node->Z = ZWert;
+						Node->Z	= ZWert;
 						 Schnitt12 = false;
 					}
-					else if (Node2->X == Node->X && Node2->Y == Node->Y)
+					else if	(Node2->X == Node->X &&	Node2->Y == Node->Y)
 					{
-						Node->Z = ZWert;
+						Node->Z	= ZWert;
 						Schnitt12 = false;
 					}
-					else if (Node3->X == Node->X && Node3->Y == Node->Y)
+					else if	(Node3->X == Node->X &&	Node3->Y == Node->Y)
 					{
-						Node->Z = ZWert;
+						Node->Z	= ZWert;
 						Schnitt12 = false;
 					}
 
-					double D = (Node->X - X12) * (Node->X - X12) + (Node->Y - Y12) * (Node->Y - Y12);
+					double D = (Node->X - X12) * (Node->X -	X12) + (Node->Y	- Y12) * (Node->Y - Y12);
 
-					if (Node12 == 0 || D < (Node12->X - X12) * (Node12->X - X12) + (Node12->Y - Y12) * (Node12->Y - Y12))
+					if (Node12 == 0	|| D < (Node12->X - X12) * (Node12->X -	X12) + (Node12->Y - Y12) * (Node12->Y -	Y12))
 					{
 						Node12 = Node;
 					}
@@ -1212,10 +1363,10 @@
 
 			if (0 == Node12)
 			{
-				Node12 = new TNode(++MaxNodeNr, X12, Y12, ZWert);
+				Node12 = new TNode(++MaxNodeNr,	X12, Y12, ZWert);
 				if(false == NodeList->AddWithQuadTree(Node12))
 				{
-					dump_error(__FILE__, __LINE__, "Der Knoten (%.2f, %.2f) wurde nicht gefunden und konnte nicht eingefügt werden\n", X12 / 100.0, Y12 / 100.0);
+					dump_error(__FILE__, __LINE__, "Der Knoten (%.2f, %.2f)	wurde nicht gefunden und konnte	nicht eingefügt	werden\n", X12 / 100.0,	Y12 / 100.0);
 				}
 			}
 		}
@@ -1229,29 +1380,29 @@
 
 			if (FoundNodeList->size() > 0)
 			{
-				for (TNodeList::iterator j=FoundNodeList->begin(); j != FoundNodeList->end(); j++)
+				for (TNodeList::iterator j=FoundNodeList->begin(); j !=	FoundNodeList->end(); j++)
 				{
 					TNode* Node = *j;
 
-					if (Node1->X == Node->X && Node1->Y == Node->Y)
+					if (Node1->X ==	Node->X	&& Node1->Y == Node->Y)
 					{
-						Node->Z = ZWert;
+						Node->Z	= ZWert;
 						Schnitt23 = false;
 					}
-					else if (Node2->X == Node->X && Node2->Y == Node->Y)
+					else if	(Node2->X == Node->X &&	Node2->Y == Node->Y)
 					{
-						Node->Z = ZWert;
+						Node->Z	= ZWert;
 						Schnitt23 = false;
 					}
-					else if (Node3->X == Node->X && Node3->Y == Node->Y)
+					else if	(Node3->X == Node->X &&	Node3->Y == Node->Y)
 					{
-						Node->Z = ZWert;
+						Node->Z	= ZWert;
 						Schnitt23 = false;
 					}
 
-					double D = (Node->X - X23) * (Node->X - X23) + (Node->Y - Y23) * (Node->Y - Y23);
+					double D = (Node->X - X23) * (Node->X -	X23) + (Node->Y	- Y23) * (Node->Y - Y23);
 
-					if (Node23 == 0 || D < (Node23->X - X23) * (Node23->X - X23) + (Node23->Y - Y23) * (Node23->Y - Y23))
+					if (Node23 == 0	|| D < (Node23->X - X23) * (Node23->X -	X23) + (Node23->Y - Y23) * (Node23->Y -	Y23))
 					{
 						Node23 = Node;
 					}
@@ -1260,10 +1411,10 @@
 
 			if (0 == Node23)
 			{
-				Node23 = new TNode(++MaxNodeNr, X23, Y23, ZWert);
+				Node23 = new TNode(++MaxNodeNr,	X23, Y23, ZWert);
 				if(false == NodeList->AddWithQuadTree(Node23))
 				{
-					dump_error(__FILE__, __LINE__, "Der Knoten (%.2f, %.2f) wurde nicht gefunden und konnte nicht eingefügt werden\n", X23 / 100.0, Y23 / 100.0);
+					dump_error(__FILE__, __LINE__, "Der Knoten (%.2f, %.2f)	wurde nicht gefunden und konnte	nicht eingefügt	werden\n", X23 / 100.0,	Y23 / 100.0);
 				}
 			}
 		}
@@ -1277,29 +1428,29 @@
 
 			if (FoundNodeList->size() > 0)
 			{
-				for (TNodeList::iterator j=FoundNodeList->begin(); j != FoundNodeList->end(); j++)
+				for (TNodeList::iterator j=FoundNodeList->begin(); j !=	FoundNodeList->end(); j++)
 				{
 					TNode* Node = *j;
 
-					if (Node1->X == Node->X && Node1->Y == Node->Y)
+					if (Node1->X ==	Node->X	&& Node1->Y == Node->Y)
 					{
-						Node->Z = ZWert;
+						Node->Z	= ZWert;
 						Schnitt31 = false;
 					}
-					else if (Node2->X == Node->X && Node2->Y == Node->Y)
+					else if	(Node2->X == Node->X &&	Node2->Y == Node->Y)
 					{
-						Node->Z = ZWert;
+						Node->Z	= ZWert;
 						Schnitt31 = false;
 					}
-					else if (Node3->X == Node->X && Node3->Y == Node->Y)
+					else if	(Node3->X == Node->X &&	Node3->Y == Node->Y)
 					{
-						Node->Z = ZWert;
+						Node->Z	= ZWert;
 						Schnitt31 = false;
 					}
 
-					double D = (Node->X - X31) * (Node->X - X31) + (Node->Y - Y31) * (Node->Y - Y31);
+					double D = (Node->X - X31) * (Node->X -	X31) + (Node->Y	- Y31) * (Node->Y - Y31);
 
-					if (Node31 == 0 || D < (Node31->X - X31) * (Node31->X - X31) + (Node31->Y - Y31) * (Node31->Y - Y31))
+					if (Node31 == 0	|| D < (Node31->X - X31) * (Node31->X -	X31) + (Node31->Y - Y31) * (Node31->Y -	Y31))
 					{
 						Node31 = Node;
 					}
@@ -1308,10 +1459,10 @@
 
 			if (0 == Node31)
 			{
-				Node31 = new TNode(++MaxNodeNr, X31, Y31, ZWert);
+				Node31 = new TNode(++MaxNodeNr,	X31, Y31, ZWert);
 				if(false == NodeList->AddWithQuadTree(Node31))
 				{
-					dump_error(__FILE__, __LINE__, "Der Knoten (%.2f, %.2f) wurde nicht gefunden und konnte nicht eingefügt werden\n", X31 / 100.0, Y31 / 100.0);
+					dump_error(__FILE__, __LINE__, "Der Knoten (%.2f, %.2f)	wurde nicht gefunden und konnte	nicht eingefügt	werden\n", X31 / 100.0,	Y31 / 100.0);
 				}
 			}
 		}
@@ -1319,136 +1470,136 @@
 		if (Schnitt12 && Schnitt23 && Schnitt31)
 		{
 			NewElement = new TElement(Node1, Node12, Node31);
-			NewElement->Typ = NEWTRI;
+			NewElement->Typ	= NEWTRI;
 			push_back(NewElement);
 
 			NewElement = new TElement(Node12, Node2, Node23);
-			NewElement->Typ = NEWTRI;
+			NewElement->Typ	= NEWTRI;
 			push_back(NewElement);
 
 			NewElement = new TElement(Node12, Node23, Node31);
-			NewElement->Typ = NEWTRI;
+			NewElement->Typ	= NEWTRI;
 			push_back(NewElement);
 
 			NewElement = new TElement(Node23, Node3, Node31);
-			NewElement->Typ = NEWTRI;
+			NewElement->Typ	= NEWTRI;
 			push_back(NewElement);
 
-			if (DebugLevel >= 9) write_fortschritt("Element %d : %d - %d - %d wird geändert\n", Count, Node1->Nr, Node2->Nr, Node3->Nr);
+			if (DebugLevel >= 9) write_fortschritt("Element	%d : %d	- %d - %d wird geändert\n", Count, Node1->Nr, Node2->Nr, Node3->Nr);
 
 			Element->Typ = NO_ELEMENT;
 			ChangeCount++;
 		}
-		else if (Schnitt12 && Schnitt23)
+		else if	(Schnitt12 && Schnitt23)
 		{
 			NewElement = new TElement(Node1, Node12, Node3);
-			NewElement->Typ = NEWTRI;
+			NewElement->Typ	= NEWTRI;
 			push_back(NewElement);
 
 			NewElement = new TElement(Node12, Node2, Node23);
-			NewElement->Typ = NEWTRI;
+			NewElement->Typ	= NEWTRI;
 			push_back(NewElement);
 
 			NewElement = new TElement(Node12, Node23, Node3);
-			NewElement->Typ = NEWTRI;
+			NewElement->Typ	= NEWTRI;
 			push_back(NewElement);
 
-			if (DebugLevel >= 9) write_fortschritt("Element %d : %d - %d - %d wird geändert\n", Count, Node1->Nr, Node2->Nr, Node3->Nr);
+			if (DebugLevel >= 9) write_fortschritt("Element	%d : %d	- %d - %d wird geändert\n", Count, Node1->Nr, Node2->Nr, Node3->Nr);
 
 			Element->Typ = NO_ELEMENT;
 			ChangeCount++;
 		}
-		else if (Schnitt12 && Schnitt31)
+		else if	(Schnitt12 && Schnitt31)
 		{
 			NewElement = new TElement(Node1, Node12, Node31);
-			NewElement->Typ = NEWTRI;
+			NewElement->Typ	= NEWTRI;
 			push_back(NewElement);
 
 			NewElement = new TElement(Node12, Node2, Node31);
-			NewElement->Typ = NEWTRI;
+			NewElement->Typ	= NEWTRI;
 			push_back(NewElement);
 
-			NewElement = new TElement(Node2, Node3, Node31);
-			NewElement->Typ = NEWTRI;
+			NewElement = new TElement(Node2, Node3,	Node31);
+			NewElement->Typ	= NEWTRI;
 			push_back(NewElement);
 
-			if (DebugLevel >= 9) write_fortschritt("Element %d : %d - %d - %d wird geändert\n", Count, Node1->Nr, Node2->Nr, Node3->Nr);
+			if (DebugLevel >= 9) write_fortschritt("Element	%d : %d	- %d - %d wird geändert\n", Count, Node1->Nr, Node2->Nr, Node3->Nr);
 
 			Element->Typ = NO_ELEMENT;
 			ChangeCount++;
 		}
-		else if (Schnitt23 && Schnitt31)
+		else if	(Schnitt23 && Schnitt31)
 		{
-			NewElement = new TElement(Node1, Node2, Node31);
-			NewElement->Typ = NEWTRI;
+			NewElement = new TElement(Node1, Node2,	Node31);
+			NewElement->Typ	= NEWTRI;
 			push_back(NewElement);
 
 			NewElement = new TElement(Node2, Node23, Node31);
-			NewElement->Typ = NEWTRI;
+			NewElement->Typ	= NEWTRI;
 			push_back(NewElement);
 
 			NewElement = new TElement(Node23, Node3, Node31);
-			NewElement->Typ = NEWTRI;
+			NewElement->Typ	= NEWTRI;
 			push_back(NewElement);
 
-			if (DebugLevel >= 9) write_fortschritt("Element %d : %d - %d - %d wird geändert\n", Count, Node1->Nr, Node2->Nr, Node3->Nr);
+			if (DebugLevel >= 9) write_fortschritt("Element	%d : %d	- %d - %d wird geändert\n", Count, Node1->Nr, Node2->Nr, Node3->Nr);
 
 			Element->Typ = NO_ELEMENT;
 			ChangeCount++;
 		}
-		else if (Schnitt12)
+		else if	(Schnitt12)
 		{
 			NewElement = new TElement(Node1, Node12, Node3);
-			NewElement->Typ = NEWTRI;
+			NewElement->Typ	= NEWTRI;
 			push_back(NewElement);
 
 			NewElement = new TElement(Node12, Node2, Node3);
-			NewElement->Typ = NEWTRI;
+			NewElement->Typ	= NEWTRI;
 			push_back(NewElement);
 
-			if (DebugLevel >= 9) write_fortschritt("Element %d : %d - %d - %d wird geändert\n", Count, Node1->Nr, Node2->Nr, Node3->Nr);
+			if (DebugLevel >= 9) write_fortschritt("Element	%d : %d	- %d - %d wird geändert\n", Count, Node1->Nr, Node2->Nr, Node3->Nr);
 
 			Element->Typ = NO_ELEMENT;
 			ChangeCount++;
 		}
-		else if (Schnitt23)
+		else if	(Schnitt23)
 		{
-			NewElement = new TElement(Node1, Node2, Node23);
-			NewElement->Typ = NEWTRI;
+			NewElement = new TElement(Node1, Node2,	Node23);
+			NewElement->Typ	= NEWTRI;
 			push_back(NewElement);
 
 			NewElement = new TElement(Node2, Node23, Node3);
-			NewElement->Typ = NEWTRI;
+			NewElement->Typ	= NEWTRI;
 			push_back(NewElement);
 
-			if (DebugLevel >= 9) write_fortschritt("Element %d : %d - %d - %d wird geändert\n", Count, Node1->Nr, Node2->Nr, Node3->Nr);
+			if (DebugLevel >= 9) write_fortschritt("Element	%d : %d	- %d - %d wird geändert\n", Count, Node1->Nr, Node2->Nr, Node3->Nr);
 
 			Element->Typ = NO_ELEMENT;
 			ChangeCount++;
 		}
-		else if (Schnitt31)
+		else if	(Schnitt31)
 		{
-			NewElement = new TElement(Node1, Node2, Node31);
-			NewElement->Typ = NEWTRI;
+			NewElement = new TElement(Node1, Node2,	Node31);
+			NewElement->Typ	= NEWTRI;
 			push_back(NewElement);
 
-			NewElement = new TElement(Node2, Node3, Node31);
-			NewElement->Typ = NEWTRI;
+			NewElement = new TElement(Node2, Node3,	Node31);
+			NewElement->Typ	= NEWTRI;
 			push_back(NewElement);
 
-			if (DebugLevel >= 9) write_fortschritt("Element %d : %d - %d - %d wird geändert\n", Count, Node1->Nr, Node2->Nr, Node3->Nr);
+			if (DebugLevel >= 9) write_fortschritt("Element	%d : %d	- %d - %d wird geändert\n", Count, Node1->Nr, Node2->Nr, Node3->Nr);
 
 			Element->Typ = NO_ELEMENT;
 			ChangeCount++;
 		}
 	}
-	write_fortschritt("%d von %d Elemente, %d Elemente angepasst\n", Count, size(), ChangeCount);
+	write_fortschritt("%d von %d Elemente, %d Elemente angepasst\n", Count,	size(),	ChangeCount);
 }
 
 //---------------------------------------------------------------------------
 void TElementList::CleanChangedElements(int DebugLevel)
 {
-	write_fortschritt("->Suche nach entarteten Elementen gestartet\n");
+	write_fortschritt("->Suche nach	entarteten Elementen gestartet\n");
 
 	int Count = 0;
 	for (unsigned int i = 0; i < size(); i++)
@@ -1457,15 +1608,15 @@
 
 		Count++;
 
-		if (DebugLevel >= 9 || (DebugLevel >= 1 && Count % 5000 == 0) || (Count % 50000 == 0))
+		if (DebugLevel >= 9 || (DebugLevel >= 1	&& Count % 5000	== 0) || (Count	% 50000	== 0))
 		{
 			write_fortschritt("%d von %d Elementen überprüft\n", Count, size());
 		}
 
-		// Hier werden die zum Löschen markierten Elemente ignoriert.
+		// Hier	werden die zum Löschen markierten Elemente ignoriert.
 		if (Element->Typ == NO_ELEMENT)	continue;
 
-		// Hier werden die neuen  Elemente wieder auf einen korrekten Typ gesetzt und dann ignoriert.
+		// Hier	werden die neuen  Elemente wieder auf einen korrekten Typ gesetzt und dann ignoriert.
 		if (Element->Typ == NEWTRI)
 		{
 			Element->Typ = TRI;
@@ -1473,26 +1624,26 @@
 
 		if (Element->Typ == QUAD)
 		{
-			dump_error(__FILE__, __LINE__, "Viereckselemente werden im Moment noch nicht unterstützt");
+			dump_error(__FILE__, __LINE__, "Viereckselemente werden	im Moment noch nicht unterstützt");
 		}
 
 		TNode* Node1 = Element->Node1;
 		TNode* Node2 = Element->Node2;
 		TNode* Node3 = Element->Node3;
 
-		if (Node1->X == Node2->X && Node1->Y == Node2->Y)
+		if (Node1->X ==	Node2->X && Node1->Y ==	Node2->Y)
 		{
 			Element->Typ = NO_ELEMENT;
 			continue;
 		}
 
-		if (Node2->X == Node3->X && Node2->Y == Node3->Y)
+		if (Node2->X ==	Node3->X && Node2->Y ==	Node3->Y)
 		{
 			Element->Typ = NO_ELEMENT;
 			continue;
 		}
 
-		if (Node3->X == Node1->X && Node3->Y == Node1->Y)
+		if (Node3->X ==	Node1->X && Node3->Y ==	Node1->Y)
 		{
 			Element->Typ = NO_ELEMENT;
 			continue;
@@ -1501,17 +1652,17 @@
 	}
 	write_fortschritt("%d von %d Elementen überprüft\n", Count, size());
 
-	write_fortschritt("<-Suche nach entarteten Elementen beendet\n");
+	write_fortschritt("<-Suche nach	entarteten Elementen beendet\n");
 }
 
 //---------------------------------------------------------------------------
 void TElementList::ChangeElements(TNodeList *NodeList, TProfilList *SperrenList, TProfilList *GrabenList, int DebugLevel)
 {
-	write_fortschritt("->Anpassung der Elemente an Dämme und Gräben gestartet\n");
+	write_fortschritt("->Anpassung der Elemente an Dämme und Gräben	gestartet\n");
 
 	NodeList->SortByXY();
 
-	if (SperrenList && SperrenList->size() > 0)
+	if (SperrenList	&& SperrenList->size() > 0)
 	{
 		write_fortschritt("->Anpassung der Elemente an Dämme gestartet\n");
 		HelpChangeElements(NodeList, SperrenList, DammZ, DebugLevel);
@@ -1527,7 +1678,7 @@
 
 	CleanChangedElements(DebugLevel);
 
-	write_fortschritt("<-Anpassung der Elemente an Dämme und Gräben beendet\n");
+	write_fortschritt("<-Anpassung der Elemente an Dämme und Gräben	beendet\n");
 }
 
 //---------------------------------------------------------------------
@@ -1545,8 +1696,8 @@
 {
 	if (size() < 3)
 	{
-		// Wenn weniger als 3 Punkte da sind, um das Polygon zu bilden
-		// ist die Fläche immer 0
+		// Wenn	weniger	als 3 Punkte da	sind, um das Polygon zu	bilden
+		// ist die Fläche immer	0
 		return (0.0);
 	}
 
@@ -1561,7 +1712,7 @@
 		double X2 = Xy2->X;
 		double Y2 = Xy2->Y;
 
-		Area = Area + X1 * Y2 - X2 * Y1;
+		Area = Area + X1 * Y2 -	X2 * Y1;
 	}
 
 	TXY *LastXy = (*this)[size()-1];
@@ -1572,7 +1723,7 @@
 	double Fx = FirstXy->X;
 	double Fy = FirstXy->Y;
 
-	Area = Area + Lx * Fy - Fx * Ly;
+	Area = Area + Lx * Fy -	Fx * Ly;
 
 	Area = Area / 2.0;
 
@@ -1596,7 +1747,7 @@
 	{
 		TErgebnisPolygon *ErgebnisPolygon = *i;
 		delete ErgebnisPolygon;
-		ErgebnisPolygon = 0;
+		ErgebnisPolygon	= 0;
 	}
 	clear();
 }
@@ -1634,7 +1785,7 @@
 //---------------------------------------------------------------------
 void TErgebnisPolygonList::Append(TErgebnisPolygonList *AddErgebnisPolygonList)
 {
-	for (TErgebnisPolygonList::iterator i = AddErgebnisPolygonList->begin(); i != AddErgebnisPolygonList->end(); i++)
+	for (TErgebnisPolygonList::iterator i =	AddErgebnisPolygonList->begin(); i != AddErgebnisPolygonList->end(); i++)
 	{
 		TErgebnisPolygon *AddErgebnisPolygon = *i;
 		push_back(AddErgebnisPolygon);
@@ -1644,7 +1795,7 @@
 //---------------------------------------------------------------------
 TErgebnisPolygon* TErgebnisPolygonList::First(void)
 {
-	if (size() <= 0) return (0);
+	if (size() <= 0) return	(0);
 
 	TErgebnisPolygon *ErgebnisPolygon = this->front();
 
@@ -1655,20 +1806,20 @@
 TInsideTyp TErgebnisPolygonList::IsInsidePolygonList(long X, long Y)
 {
 
-	for (TErgebnisPolygonList::iterator i = begin(); i != end(); i++)
+	for (TErgebnisPolygonList::iterator i =	begin(); i != end(); i++)
 	{
 		TErgebnisPolygon* Polygon = *i;
 
 		int alpha = IsInside(Polygon, X, Y);
 
-		if (alpha == 0)		continue;  			// not inside -> versuche das nächste Polygon
+		if (alpha == 0)		continue;			// not inside -> versuche das nächste Polygon
 		if (alpha == 4)		return (INSIDE);    // inside
 		if (alpha == -4)	return (INSIDE);    // inside
 		if (alpha == -1)	return (ON_LINE);   // on line
-		if (alpha == 2)	    return (ON_LINE);   // on line twisted
-		if (alpha == -2)    return (ON_LINE);   // on line twisted
+		if (alpha == 2)	    return (ON_LINE);	// on line twisted
+		if (alpha == -2)    return (ON_LINE);	// on line twisted
 
-		dump_error(__FILE__, __LINE__, "Alpha (%d) ungültig\n", alpha);
+		dump_error(__FILE__, __LINE__, "Alpha (%d) ungültig\n",	alpha);
 	}
 
 	return (NOT_INSIDE);
@@ -1681,47 +1832,47 @@
 //---------------------------------------------------------------------
 TEdge::TEdge(TNode *node1, TNode *node2)
 {
-	if (node1->Nr < 0)
+	if (node1->Nr <	0)
 	{
-		dump_error (__FILE__, __LINE__, "Beim Erzeugen einer Kante ist die Knotennummer 1 negativ (%d)\n", node1->Nr);
+		dump_error (__FILE__, __LINE__,	"Beim Erzeugen einer Kante ist die Knotennummer	1 negativ (%d)\n", node1->Nr);
 	}
 
-	if (node2->Nr < 0)
+	if (node2->Nr <	0)
 	{
-		dump_error (__FILE__, __LINE__, "Beim Erzeugen einer Kante ist die Knotennummer 2 negativ (%d)\n", node2->Nr);
+		dump_error (__FILE__, __LINE__,	"Beim Erzeugen einer Kante ist die Knotennummer	2 negativ (%d)\n", node2->Nr);
 	}
 
-	Node1 = node1;
-	Node2 = node2;
+	Node1 =	node1;
+	Node2 =	node2;
 
 	double Dx = Node2->X - Node1->X;
 	double Dy = Node2->Y - Node1->Y;
-	Distance = sqrt (Dx*Dx +Dy*Dy);
+	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,%d,%d)\nKnoten 2: (%d,%d,%d)\n", Distance, Node1->Nr, Node1->X, Node1->Y, Node2->Nr, Node2->X, Node2->Y);
+		dump_error (__FILE__, __LINE__,	"Beim Erzeugen einer Kante ist der Abstand der Knoten zu dicht\nAbstand: %f\nKnoten 1: (%d,%d,%d)\nKnoten 2: (%d,%d,%d)\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;
+	if (Dy < 0) Arc	= 360.0	- Arc;
 
 	X = 0;
 	Y = 0;
-	Ready = false;
+	Ready =	false;
 	IsBoundary = false;
 }
 
 //---------------------------------------------------------------------
 TEdge::TEdge(TEdge *Edge)
 {
-	Node1 = Edge->Node1;
-	Node2 = Edge->Node2;
+	Node1 =	Edge->Node1;
+	Node2 =	Edge->Node2;
 	Distance = Edge->Distance;
 	Arc = Edge->Arc;
 	X = Edge->X;
 	Y = Edge->Y;
-	Ready = Edge->Ready;
+	Ready =	Edge->Ready;
 	IsBoundary = Edge->IsBoundary;
 }
 
@@ -1761,10 +1912,10 @@
 //---------------------------------------------------------------------
 void TEdgeList::Clear(void)
 {
-	if (EdgeVector.size() > 0)
+	if (EdgeVector.size() >	0)
 	{
 		int Count = 0;
-		for (TEdgeVector::const_iterator i = EdgeVector.begin(); i != EdgeVector.end(); i++)
+		for (TEdgeVector::const_iterator i = EdgeVector.begin(); i != EdgeVector.end();	i++)
 		{
 			TEdge *Edge = *i;
 			delete Edge;
@@ -1778,9 +1929,9 @@
 		write_fortschritt("%d Objekte freigegeben\n", Count);
 	}
 
-	if (Anz != 0)
+	if (Anz	!= 0)
 	{
-		dump_error(__FILE__, __LINE__, "Anz der Kanten ist nicht 0\n");
+		dump_error(__FILE__, __LINE__, "Anz der	Kanten ist nicht 0\n");
 	}
 
 	AvgDistance = 0;
@@ -1791,14 +1942,14 @@
 //---------------------------------------------------------------------
 void TEdgeList::Empty(void)
 {
-	for (TEdgeVector::const_iterator i = EdgeVector.begin(); i != EdgeVector.end(); i++)
+	for (TEdgeVector::const_iterator i = EdgeVector.begin(); i != EdgeVector.end();	i++)
 	{
 		Anz--;
 	}
 
-	if (Anz != 0)
+	if (Anz	!= 0)
 	{
-		dump_error(__FILE__, __LINE__, "Anz der Kanten ist nicht 0\n");
+		dump_error(__FILE__, __LINE__, "Anz der	Kanten ist nicht 0\n");
 	}
 
 	AvgDistance = 0;
@@ -1809,16 +1960,16 @@
 //---------------------------------------------------------------------
 void TEdgeList::Add(TEdge *edge)
 {
-	if (EdgeVector.capacity() < EdgeVector.size() + 1)
+	if (EdgeVector.capacity() < EdgeVector.size() +	1)
 	{
-		EdgeVector.reserve((size_t)(EdgeVector.capacity() * 1.1 + 200000));
+		EdgeVector.reserve((size_t)(EdgeVector.capacity() * 1.1	+ 200000));
 		write_fortschritt("Kapazität der Kantenliste wurde auf %d erhöht\n", EdgeVector.capacity());
 	}
 
 	EdgeVector.push_back(edge);
 	AvgDistance = AvgDistance * Anz;
 	Anz++;
-	AvgDistance = (unsigned int)((AvgDistance + edge->Distance) / Anz + 0.5);
+	AvgDistance = (unsigned	int)((AvgDistance + edge->Distance) / Anz + 0.5);
 }
 
 //---------------------------------------------------------------------
@@ -1838,7 +1989,7 @@
 //---------------------------------------------------------------------
 TEdge* TEdgeList::FindWithIndex(TNode *Node1, TNode *Node2)
 {
-	if (Anz == 0)	return(0);
+	if (Anz	== 0)	return(0);
 
 	TEdgeIndex *AktEdgeIndex = Node1->EdgeIndex;
 
@@ -1848,7 +1999,7 @@
 
 		TEdge *Edge = AktEdgeIndex->Edge;
 
-		if (Edge->Node1 == Node1 && Edge->Node2 == Node2)
+		if (Edge->Node1	== Node1 && Edge->Node2	== Node2)
 		{
 			return (Edge);
 		}
@@ -1879,9 +2030,9 @@
 //---------------------------------------------------------------------
 
 //---------------------------------------------------------------------
-TEdgeIndex::TEdgeIndex(TEdgeIndex *nextedgeindex, TEdge *edge)
+TEdgeIndex::TEdgeIndex(TEdgeIndex *nextedgeindex, TEdge	*edge)
 {
-	NextEdgeIndex = nextedgeindex;
+	NextEdgeIndex =	nextedgeindex;
 	Edge = edge;
 }
 
@@ -1892,7 +2043,7 @@
 //---------------------------------------------------------------------
 TProfil::TProfil(int station, int wsp)
 {
-	Station = station;
+	Station	= station;
 	Wsp = wsp;
 
 	PointList = 0;
@@ -1906,11 +2057,11 @@
 //---------------------------------------------------------------------
 TProfil::TProfil(TProfil *profil)
 {
-	Station = profil->Station;
+	Station	= profil->Station;
 	Wsp = profil->Wsp;
 
-	PointList = new TPointList;
-	for (TPointList::iterator i=profil->PointList->begin(); i != profil->PointList->end(); i++)
+	PointList = new	TPointList;
+	for (TPointList::iterator i=profil->PointList->begin();	i != profil->PointList->end(); i++)
 	{
 		TPoint *OldPoint = *i;
 
@@ -1931,11 +2082,11 @@
 {
 	if (PointList)
 	{
-		for (TPointList::iterator i=PointList->begin(); i != PointList->end(); i++)
+		for (TPointList::iterator i=PointList->begin();	i != PointList->end(); i++)
 		{
-			TPoint *Point = *i;
+			TPoint *Point =	*i;
 			delete Point;
-			Point = 0;
+			Point =	0;
 		}
 		delete PointList;
 	}
@@ -1949,23 +2100,23 @@
 //---------------------------------------------------------------------
 void TProfil::AddPoint(int meter)
 {
-	if (0 == PointList || PointList->size() < 2)
+	if (0 == PointList || PointList->size()	< 2)
 	{
-		dump_error(__FILE__, __LINE__, "Weniger als 2 Punkte im Profil vorhanden\n");
+		dump_error(__FILE__, __LINE__, "Weniger	als 2 Punkte im	Profil vorhanden\n");
 	}
 
 	long X = 0;
 	long Y = 0;
 	GetXY(meter, &X, &Y);
 
-	TPoint* NewPoint = new TPoint(X, Y, 0, meter);
+	TPoint*	NewPoint = new TPoint(X, Y, 0, meter);
 
 	unsigned int Anz = PointList->size();
 
 	PointList->insert(NewPoint);
 
-	// Wenn sich die Anzahl nicht erhöht hat,
-	// so wurde der Punkt auch nicht hinzugefügt
+	// Wenn	sich die Anzahl	nicht erhöht hat,
+	// so wurde der	Punkt auch nicht hinzugefügt
 	// -> er muss wieder gelöscht werden
 
 	if (PointList->size() == Anz)
@@ -1984,10 +2135,10 @@
 		}
 		else
 		{
-			if (MinX > NewPoint->X) MinX = NewPoint->X;
-			if (MaxX < NewPoint->X) MaxX = NewPoint->X;
-			if (MinY > NewPoint->Y) MinY = NewPoint->Y;
-			if (MaxY < NewPoint->Y) MaxY = NewPoint->Y;
+			if (MinX > NewPoint->X)	MinX = NewPoint->X;
+			if (MaxX < NewPoint->X)	MaxX = NewPoint->X;
+			if (MinY > NewPoint->Y)	MinY = NewPoint->Y;
+			if (MaxY < NewPoint->Y)	MaxY = NewPoint->Y;
 		}
 	}
 }
@@ -1995,7 +2146,7 @@
 //---------------------------------------------------------------------
 void TProfil::AddPoint(long x, long y, int z)
 {
-	if (0 == PointList)	PointList = new TPointList;
+	if (0 == PointList)	PointList = new	TPointList;
 
 	TPointList::iterator i = PointList->begin();
 
@@ -2006,25 +2157,25 @@
 		i++;
 	}
 
-	double MeterD = 0.0;
+	double MeterD =	0.0;
 
 	if (LastPoint)
 	{
 		long X = LastPoint->X;
 		long Y = LastPoint->Y;
-		int M = LastPoint->Meter;
+		int M =	LastPoint->Meter;
 
-		double Dx = X - x;
-		double Dy = Y - y;
+		double Dx = X -	x;
+		double Dy = Y -	y;
 
-		double D = sqrt(Dx * Dx + Dy * Dy);
+		double D = sqrt(Dx * Dx	+ Dy * Dy);
 
 		MeterD = M + D;
 	}
 
 	int Meter = (int)(MeterD + 0.5);
 	
-	TPoint* NewPoint = new TPoint(x, y, z, Meter);
+	TPoint*	NewPoint = new TPoint(x, y, z, Meter);
 
 	PointList->insert(NewPoint);
 
@@ -2037,28 +2188,28 @@
 	}
 	else
 	{
-		if (MinX > NewPoint->X) MinX = NewPoint->X;
-		if (MaxX < NewPoint->X) MaxX = NewPoint->X;
-		if (MinY > NewPoint->Y) MinY = NewPoint->Y;
-		if (MaxY < NewPoint->Y) MaxY = NewPoint->Y;
+		if (MinX > NewPoint->X)	MinX = NewPoint->X;
+		if (MaxX < NewPoint->X)	MaxX = NewPoint->X;
+		if (MinY > NewPoint->Y)	MinY = NewPoint->Y;
+		if (MaxY < NewPoint->Y)	MaxY = NewPoint->Y;
 	}
 }
 
 //---------------------------------------------------------------------
-bool TProfil::GetXY(int meter, long *x, long *y)
+bool TProfil::GetXY(int	meter, long *x,	long *y)
 {
-	if (0 == PointList || PointList->size() < 2)
+	if (0 == PointList || PointList->size()	< 2)
 	{
-		dump_error(__FILE__, __LINE__, "Weniger als 2 Punkte im Profil vorhanden\n");
+		dump_error(__FILE__, __LINE__, "Weniger	als 2 Punkte im	Profil vorhanden\n");
 	}
 
 	TPointList::iterator i = PointList->begin();
 
 	TPoint *LastPoint = 0;
-	TPoint *Point = 0;
+	TPoint *Point =	0;
 	while (i != PointList->end())
 	{
-		Point = *i++;
+		Point =	*i++;
 
 		if (Point->Meter == meter)
 		{
@@ -2071,57 +2222,57 @@
 		{
 			if (meter < LastPoint->Meter)
 			{
-				// Der gesuchte Punkt liegt vor dem ersten Punkt des Profils
+				// Der gesuchte	Punkt liegt vor	dem ersten Punkt des Profils
 				double Dx = Point->X - LastPoint->X;
 				double Dy = Point->Y - LastPoint->Y;
 				double Dm = Point->Meter - LastPoint->Meter;
 
-				double Faktor = (meter - LastPoint->Meter) / Dm;
+				double Faktor =	(meter - LastPoint->Meter) / Dm;
 
-				*x = (long)(LastPoint->X + Dx * Faktor + 0.5);
-				*y = (long)(LastPoint->Y + Dy * Faktor + 0.5);
+				*x = (long)(LastPoint->X + Dx *	Faktor + 0.5);
+				*y = (long)(LastPoint->Y + Dy *	Faktor + 0.5);
 
 				if (Faktor >= 0.0)
 				{
-					dump_error(__FILE__, __LINE__,  "Faktor ist nicht negativ, aber der gesuchte Punkt liegt vor dem Profil\n");
+					dump_error(__FILE__, __LINE__,	"Faktor	ist nicht negativ, aber	der gesuchte Punkt liegt vor dem Profil\n");
 				}
 
 				return (false);
 			}
-			else if (meter >= LastPoint->Meter && meter <= Point->Meter)
+			else if	(meter >= LastPoint->Meter && meter <= Point->Meter)
 			{
-				// Der gesuchte Punkt liegt zwischen Punkten des Profils
+				// Der gesuchte	Punkt liegt zwischen Punkten des Profils
 				double Dx = Point->X - LastPoint->X;
 				double Dy = Point->Y - LastPoint->Y;
 				double Dm = Point->Meter - LastPoint->Meter;
 
-				double Faktor = (meter - LastPoint->Meter) / Dm;
+				double Faktor =	(meter - LastPoint->Meter) / Dm;
 
-				*x = (long)(LastPoint->X + Dx * Faktor + 0.5);
-				*y = (long)(LastPoint->Y + Dy * Faktor + 0.5);
+				*x = (long)(LastPoint->X + Dx *	Faktor + 0.5);
+				*y = (long)(LastPoint->Y + Dy *	Faktor + 0.5);
 
 				if (Faktor <= 0.0 || Faktor >= 1.0)
 				{
-					dump_error(__FILE__, __LINE__,  "Faktor ist nicht zwischen 0 und 1, aber der gesuchte Punkt liegt im Profil\n");
+					dump_error(__FILE__, __LINE__,	"Faktor	ist nicht zwischen 0 und 1, aber der gesuchte Punkt liegt im Profil\n");
 				}
 
 				return (true);
 			}
-			else if (i == PointList->end())
+			else if	(i == PointList->end())
 			{
-				// Der gesuchte Punkt liegt hinter dem letzten Punkt des Profils
+				// Der gesuchte	Punkt liegt hinter dem letzten Punkt des Profils
 				double Dx = Point->X - LastPoint->X;
 				double Dy = Point->Y - LastPoint->Y;
 				double Dm = Point->Meter - LastPoint->Meter;
 
-				double Faktor = (meter - LastPoint->Meter) / Dm;
+				double Faktor =	(meter - LastPoint->Meter) / Dm;
 
-				*x = (long)(LastPoint->X + Dx * Faktor + 0.5);
-				*y = (long)(LastPoint->Y + Dy * Faktor + 0.5);
+				*x = (long)(LastPoint->X + Dx *	Faktor + 0.5);
+				*y = (long)(LastPoint->Y + Dy *	Faktor + 0.5);
 
 				if (Faktor <= 1.0)
 				{
-					dump_error(__FILE__, __LINE__,  "Faktor ist nicht größer als 1, aber der gesuchte Punkt liegt hinter dem Profil\n");
+					dump_error(__FILE__, __LINE__,	"Faktor	ist nicht größer als 1,	aber der gesuchte Punkt	liegt hinter dem Profil\n");
 				}
 
 				return (false);
@@ -2131,7 +2282,7 @@
 		LastPoint = Point;
 	}
 
-	dump_error(__FILE__, __LINE__,  "So kann der Punkt nicht ermittelt werden\n");
+	dump_error(__FILE__, __LINE__,	"So kann der Punkt nicht ermittelt werden\n");
 
 	return (false);
 }
@@ -2154,18 +2305,18 @@
 	double MeterTwoVon = PointTwoVon->Meter;
 	double MeterTwoBis = PointTwoBis->Meter;
 
-	double LaengeOne  = MeterOneBis - MeterOneVon;
-	double LaengeTwo  = MeterTwoBis - MeterTwoVon;
+	double LaengeOne  = MeterOneBis	- MeterOneVon;
+	double LaengeTwo  = MeterTwoBis	- MeterTwoVon;
 
 
 	TPointList::iterator i = ++TwoVon;
-	for (unsigned int Anz = 0; Anz < Profil->PointList->size()-2; Anz++)
+	for (unsigned int Anz =	0; Anz < Profil->PointList->size()-2; Anz++)
 	{
 		TPoint *PointTwoI = *i++;
 		double MeterTwoI = PointTwoI->Meter;
 
 		double Prozent = (MeterTwoI - MeterTwoVon) / LaengeTwo;
-		int Meter = (int)(MeterOneVon + LaengeOne * Prozent + 0.5);
+		int Meter = (int)(MeterOneVon +	LaengeOne * Prozent + 0.5);
 
 		int OldAnz = PointList->size();
 		int NewAnz = PointList->size();
@@ -2173,17 +2324,17 @@
 		{
 			AddPoint(Meter);
 			NewAnz = PointList->size();
-			Meter = Meter + 1;
+			Meter =	Meter +	1;
 		}
 	}
 }
 
 //---------------------------------------------------------------------------
-void TProfil::InterpolateProfil(TProfil *vorprofil, TProfil *nachprofil, double Prozent)
+void TProfil::InterpolateProfil(TProfil	*vorprofil, TProfil *nachprofil, double	Prozent)
 {
 	if (vorprofil->PointList->size() != nachprofil->PointList->size())
 	{
-		dump_error(__FILE__, __LINE__, "Angeglichene Profile ('%.2f' und '%.2f') haben verschieden viele Stützstellen\n", vorprofil->Station / 10000.0, nachprofil->Station / 10000.0);
+		dump_error(__FILE__, __LINE__, "Angeglichene Profile ('%.2f' und '%.2f') haben verschieden viele Stützstellen\n", vorprofil->Station / 10000.0,	nachprofil->Station / 10000.0);
 	}
 
 	TPointList::iterator V = vorprofil->PointList->begin();
@@ -2211,15 +2362,15 @@
 {
 	for (TGewaesserAchseList::iterator g=GewaesserAchseList->begin(); g != GewaesserAchseList->end(); g++)
 	{
-		TGewaesserAchse* GewaesserAchse = *g;
+		TGewaesserAchse* GewaesserAchse	= *g;
 
 		if (MaxX < GewaesserAchse->MinX)	continue;
 		if (MinX > GewaesserAchse->MaxX)	continue;
 		if (MaxY < GewaesserAchse->MinY)	continue;
 		if (MinY > GewaesserAchse->MaxY)	continue;
 
-		TPoint* P0 = 0;
-		TPoint* P1 = 0;
+		TPoint*	P0 = 0;
+		TPoint*	P1 = 0;
 		for (TPointList::iterator p = PointList->begin(); p != PointList->end(); p++)
 		{
 			if (P1 == 0)
@@ -2238,19 +2389,19 @@
 			long P1x = P1->X;
 			long P1y = P1->Y;
 
-			if (P0x < GewaesserAchse->MinX && P1x < GewaesserAchse->MinX)	continue;
-			if (P0x > GewaesserAchse->MaxX && P1x > GewaesserAchse->MaxX)	continue;
-			if (P0y < GewaesserAchse->MinY && P1y < GewaesserAchse->MinY)	continue;
-			if (P0y > GewaesserAchse->MaxY && P1y > GewaesserAchse->MaxY)	continue;
+			if (P0x	< GewaesserAchse->MinX && P1x <	GewaesserAchse->MinX)	continue;
+			if (P0x	> GewaesserAchse->MaxX && P1x >	GewaesserAchse->MaxX)	continue;
+			if (P0y	< GewaesserAchse->MinY && P1y <	GewaesserAchse->MinY)	continue;
+			if (P0y	> GewaesserAchse->MaxY && P1y >	GewaesserAchse->MaxY)	continue;
 
 			long PDx = P1x - P0x;
 			long PDy = P1y - P0y;
-			if (PDx == 0 && PDy == 0)
+			if (PDx	== 0 &&	PDy == 0)
 			{
-				write_error(3207, "Profil-Punktabstand (%.3f %.3f) - (%.3f %.3f) ist zu klein\n", P0x / 100.0, P0y / 100.0, P1x / 100.0, P1y / 100.0);
+				write_error(3207, "Profil-Punktabstand (%.3f %.3f) - (%.3f %.3f) ist zu	klein\n", P0x /	100.0, P0y / 100.0, P1x	/ 100.0, P1y / 100.0);
 			}
 
-			// Es heisst hier s für spur und nicht g für gewässerachse
+			// Es heisst hier s für	spur und nicht g für gewässerachse
 
 			TPoint*S0 = 0;
 			TPoint*S1 = 0;
@@ -2274,13 +2425,13 @@
 
 				long SDx = S1x - S0x;
 				long SDy = S1y - S0y;
-				if (SDx == 0 && SDy == 0)
+				if (SDx	== 0 &&	SDy == 0)
 				{
-					write_error(3208, "Gewässerachsen-Stützpunkteabstand (%.3f %.3f) - (%.3f %.3f) ist zu klein\n", S0x / 100.0, S0y / 100.0, S1x / 100.0, S1y / 100.0);
+					write_error(3208, "Gewässerachsen-Stützpunkteabstand (%.3f %.3f) - (%.3f %.3f) ist zu klein\n",	S0x / 100.0, S0y / 100.0, S1x /	100.0, S1y / 100.0);
 				}
 
 				double X, Y;
-				bool Found = Calc2Schnitt(P0x, P0y, P1x, P1y, S0x, S0y, S1x, S1y, &X, &Y);
+				bool Found = Calc2Schnitt(P0x, P0y, P1x, P1y, S0x, S0y,	S1x, S1y, &X, &Y);
 
 				if (Found)
 				{
@@ -2293,7 +2444,7 @@
 	}
 
 	// Das ist ein wenig gefährlich
-	// Eigentlich sollte es keine negativen Meter geben
+	// Eigentlich sollte es	keine negativen	Meter geben
 	// Daher bedeutet -1.0 nicht gefunden
 	return (-1);
 }
@@ -2314,9 +2465,9 @@
 	if (size() > 0)
 	{
 		int Count = 0;
-		for (TProfilList::iterator i=begin(); i != end(); i++)
+		for (TProfilList::iterator i=begin(); i	!= end(); i++)
 		{
-			TProfil *Profil = *i;
+			TProfil	*Profil	= *i;
 
 			delete Profil;
 			Profil = 0;
@@ -2334,9 +2485,9 @@
 //---------------------------------------------------------------------
 TProfil* TProfilList::Find(int Station)
 {
-	for (iterator i = begin(); i != end(); i++)
+	for (iterator i	= begin(); i !=	end(); i++)
 	{
-		TProfil *Profil = *i;
+		TProfil	*Profil	= *i;
 
 		if (Station == Profil->Station)
 		{
@@ -2355,12 +2506,12 @@
 
 	write_fortschritt("Gewünschter Abstand der Profile: %.4f\n", SollAbstand);
 
-	TProfil *FirstProfil = 0;
-	TProfil *NextProfil = 0;
+	TProfil	*FirstProfil = 0;
+	TProfil	*NextProfil = 0;
 
 	TProfilList* NewProfilList = new TProfilList();
 
-	for (iterator i = begin(); i != end(); i++)
+	for (iterator i	= begin(); i !=	end(); i++)
 	{
 		if (NextProfil == 0)
 		{
@@ -2374,13 +2525,13 @@
 		}
 
 		double Diff = (NextProfil->Station - FirstProfil->Station) / 10.0;
-		int Anz = (int)(Diff / SollAbstand + 0.5) - 1;
-		if (Anz <= 0) continue;
+		int Anz	= (int)(Diff / SollAbstand + 0.5) - 1;
+		if (Anz	<= 0) continue;
 
-		double Abstand = Diff / (Anz + 1);
+		double Abstand = Diff /	(Anz + 1);
 
-		TProfil *FirstProfilNeu = new TProfil(FirstProfil);
-		TProfil *NextProfilNeu = new TProfil(NextProfil);
+		TProfil	*FirstProfilNeu	= new TProfil(FirstProfil);
+		TProfil	*NextProfilNeu = new TProfil(NextProfil);
 
 		FirstProfilNeu->EqualizeProfil(NextProfil);
 		NextProfilNeu->EqualizeProfil(FirstProfil);
@@ -2390,14 +2541,14 @@
 
 		if (Anz1 != Anz2)
 		{
-			dump_error(__FILE__, __LINE__, "Angeglichene Profile sind nicht identisch\n");
+			dump_error(__FILE__, __LINE__, "Angeglichene Profile sind nicht	identisch\n");
 		}
 
 		for (int j=1; j<=Anz; j++)
 		{
 			double Prozent = j * Abstand / Diff;
-			int NewStation = (int)(FirstProfil->Station + j * Abstand * 10 + 0.5);
-			int NewWsp = (int)(FirstProfil->Wsp + Prozent * (NextProfil->Wsp - FirstProfil->Wsp) + 0.5);
+			int NewStation = (int)(FirstProfil->Station + j	* Abstand * 10 + 0.5);
+			int NewWsp = (int)(FirstProfil->Wsp + Prozent *	(NextProfil->Wsp - FirstProfil->Wsp) + 0.5);
 
 			TProfil* NewProfil = new TProfil(NewStation, NewWsp);
 			NewProfil->InterpolateProfil(FirstProfilNeu, NextProfilNeu, Prozent);
@@ -2410,7 +2561,7 @@
 		delete NextProfilNeu;
 
 		FirstProfilNeu = 0;
-		NextProfilNeu = 0;
+		NextProfilNeu =	0;
 	}
 
 	for (TProfilList::iterator i = NewProfilList->begin(); i != NewProfilList->end(); i++)
@@ -2420,7 +2571,7 @@
 
 	NewProfilList->clear();
 	delete NewProfilList;
-	NewProfilList = 0;
+	NewProfilList =	0;
 
 	write_fortschritt("<-Interpolation der Profile beendet\n");
 }
@@ -2432,27 +2583,27 @@
 
 	int PointCount = 0;
 	int Count = 0;
-	for (iterator i = begin(); i != end(); i++)
+	for (iterator i	= begin(); i !=	end(); i++)
 	{
-		TProfil* Profil = *i;
+		TProfil* Profil	= *i;
 
-		TPoint* LastPoint = *Profil->PointList->rbegin();
-		double Laenge = LastPoint->Meter;
+		TPoint*	LastPoint = *Profil->PointList->rbegin();
+		double Laenge =	LastPoint->Meter;
 
 		double Abstand = 0.0;
 
 		if (SollAnz > 0)
 		{
-			Abstand = Laenge / SollAnz;
+			Abstand	= Laenge / SollAnz;
 		}
 		else
 		{
-			Abstand = SollAbstand;
+			Abstand	= SollAbstand;
 		}
 
 
-		TPoint* FirstPoint = 0;
-		TPoint* NextPoint = 0;
+		TPoint*	FirstPoint = 0;
+		TPoint*	NextPoint = 0;
 		for (TPointList::iterator j = Profil->PointList->begin(); j != Profil->PointList->end(); j++)
 		{
 			if (NextPoint == 0)
@@ -2469,27 +2620,27 @@
 			double Diff = NextPoint->Meter - FirstPoint->Meter;
 
 
-			int Anz = (int)(Diff / Abstand + 0.5) - 1;
-			if (Anz < 0) Anz = 0;
-			double Abstand = Diff / (Anz + 1);
+			int Anz	= (int)(Diff / Abstand + 0.5) -	1;
+			if (Anz	< 0) Anz = 0;
+			double Abstand = Diff /	(Anz + 1);
 
 			for (int k=1; k<=Anz; k++)
 			{
-				int Meter = (int)(FirstPoint->Meter + k * Abstand + 0.5);
+				int Meter = (int)(FirstPoint->Meter + k	* Abstand + 0.5);
 
 				Profil->AddPoint(Meter);
 
 				PointCount++;
 
-				if (DebugLevel >= 9 || (DebugLevel >= 1 && PointCount % 100 == 0) || (PointCount > 0 && PointCount % 1000 == 0))
+				if (DebugLevel >= 9 || (DebugLevel >= 1	&& PointCount %	100 == 0) || (PointCount > 0 &&	PointCount % 1000 == 0))
 				{
-					write_fortschritt("Profil %d von %d aufgefüllt, %d Punkte hinzugefügt\n", Count, size(), PointCount);
+					write_fortschritt("Profil %d von %d aufgefüllt,	%d Punkte hinzugefügt\n", Count, size(), PointCount);
 				}
 			}
 
-			if (Anz >= 1)
+			if (Anz	>= 1)
 			{
-				// Jetzt wieder von vorne
+				// Jetzt wieder	von vorne
 				j = Profil->PointList->begin();
 				FirstPoint = 0;
 				NextPoint = 0;
@@ -2527,8 +2678,8 @@
 	MinY = 999999999;
 	MaxY = -999999999;
 
-	PointList = new TPointList;
-	for (TPointList::iterator i=gewaesserAchse->PointList->begin(); i != gewaesserAchse->PointList->end(); i++)
+	PointList = new	TPointList;
+	for (TPointList::iterator i=gewaesserAchse->PointList->begin();	i != gewaesserAchse->PointList->end(); i++)
 	{
 		TPoint *OldPoint = *i;
 
@@ -2558,12 +2709,12 @@
 {
 	if (PointList)
 	{
-		for (TPointList::iterator i=PointList->begin(); i != PointList->end(); i++)
+		for (TPointList::iterator i=PointList->begin();	i != PointList->end(); i++)
 		{
-			TPoint *Point = *i;
+			TPoint *Point =	*i;
 
 			delete Point;
-			Point = 0;
+			Point =	0;
 		}
 
 		delete PointList;
@@ -2578,16 +2729,16 @@
 //---------------------------------------------------------------------
 void TGewaesserAchse::AddPoint(int meter)
 {
-	if (0 == PointList || PointList->size() < 2)
+	if (0 == PointList || PointList->size()	< 2)
 	{
-		dump_error(__FILE__, __LINE__, "Weniger als 2 Punkte im Gewässerachse vorhanden\n");
+		dump_error(__FILE__, __LINE__, "Weniger	als 2 Punkte im	Gewässerachse vorhanden\n");
 	}
 
 	long X = 0;
 	long Y = 0;
 	GetXY(meter, &X, &Y);
 
-	TPoint* NewPoint = new TPoint(X, Y, 0, meter);
+	TPoint*	NewPoint = new TPoint(X, Y, 0, meter);
 
 	PointList->insert(NewPoint);
 
@@ -2600,7 +2751,7 @@
 //---------------------------------------------------------------------
 void TGewaesserAchse::AddPoint(long x, long y, int z)
 {
-	if (0 == PointList)	PointList = new TPointList;
+	if (0 == PointList)	PointList = new	TPointList;
 
 	TPointList::iterator i = PointList->begin();
 
@@ -2611,7 +2762,7 @@
 		i++;
 	}
 
-	double MeterD = 0.0;
+	double MeterD =	0.0;
 
 	if (LastPoint)
 	{
@@ -2619,17 +2770,17 @@
 		double Y = LastPoint->Y;
 		double M = LastPoint->Meter;
 
-		double Dx = X - x;
-		double Dy = Y - y;
+		double Dx = X -	x;
+		double Dy = Y -	y;
 
-		double D = sqrt(Dx * Dx + Dy * Dy);
+		double D = sqrt(Dx * Dx	+ Dy * Dy);
 
 		MeterD = M + D;
 	}
 
 	int Meter = (int)(MeterD + 0.5);
 	
-	TPoint* NewPoint = new TPoint(x, y, z, Meter);
+	TPoint*	NewPoint = new TPoint(x, y, z, Meter);
 
 	PointList->insert(NewPoint);
 
@@ -2640,20 +2791,20 @@
 }
 
 //---------------------------------------------------------------------
-bool TGewaesserAchse::GetXY(int meter, long *x, long *y)
+bool TGewaesserAchse::GetXY(int	meter, long *x,	long *y)
 {
-	if (0 == PointList || PointList->size() < 2)
+	if (0 == PointList || PointList->size()	< 2)
 	{
-		dump_error(__FILE__, __LINE__, "Weniger als 2 Punkte im Gewässerachse vorhanden\n");
+		dump_error(__FILE__, __LINE__, "Weniger	als 2 Punkte im	Gewässerachse vorhanden\n");
 	}
 
 	TPointList::iterator i = PointList->begin();
 
 	TPoint *LastPoint = 0;
-	TPoint *Point = 0;
+	TPoint *Point =	0;
 	while (i != PointList->end())
 	{
-		Point = *i;
+		Point =	*i;
 
 		if (Point->Meter == meter)
 		{
@@ -2666,38 +2817,38 @@
 		{
 			if (meter < LastPoint->Meter)
 			{
-				// Der gesuchte Punkt liegt vor dem ersten Punkt des Profils
-				long Dx = Point->X - LastPoint->X;
-				long Dy = Point->Y - LastPoint->Y;
-				int Dm = Point->Meter - LastPoint->Meter;
+				// Der gesuchte	Punkt liegt vor	dem ersten Punkt des Profils
+				long Dx	= Point->X - LastPoint->X;
+				long Dy	= Point->Y - LastPoint->Y;
+				int Dm = Point->Meter -	LastPoint->Meter;
 
-				double Faktor = (meter - LastPoint->Meter) / Dm;
+				double Faktor =	(meter - LastPoint->Meter) / Dm;
 
-				*x = (long)(LastPoint->X + Dx * Faktor + 0.5);
-				*y = (long)(LastPoint->Y + Dy * Faktor + 0.5);
+				*x = (long)(LastPoint->X + Dx *	Faktor + 0.5);
+				*y = (long)(LastPoint->Y + Dy *	Faktor + 0.5);
 
 				if (Faktor >= 0.0)
 				{
-					dump_error(__FILE__, __LINE__,  "Faktor ist nicht negativ, aber der gesuchte Punkt liegt vor dem Profil\n");
+					dump_error(__FILE__, __LINE__,	"Faktor	ist nicht negativ, aber	der gesuchte Punkt liegt vor dem Profil\n");
 				}
 
 				return (false);
 			}
-			else if (meter > LastPoint->Meter && meter < Point->Meter)
+			else if	(meter > LastPoint->Meter && meter < Point->Meter)
 			{
-				// Der gesuchte Punkt liegt zwischen Punkten des Profils
-				long Dx = Point->X - LastPoint->X;
-				long Dy = Point->Y - LastPoint->Y;
-				int Dm = Point->Meter - LastPoint->Meter;
+				// Der gesuchte	Punkt liegt zwischen Punkten des Profils
+				long Dx	= Point->X - LastPoint->X;
+				long Dy	= Point->Y - LastPoint->Y;
+				int Dm = Point->Meter -	LastPoint->Meter;
 
-				double Faktor = (meter - LastPoint->Meter) / Dm;
+				double Faktor =	(meter - LastPoint->Meter) / Dm;
 
-				*x = (long)(LastPoint->X + Dx * Faktor + 0.5);
-				*y = (long)(LastPoint->Y + Dy * Faktor + 0.5);
+				*x = (long)(LastPoint->X + Dx *	Faktor + 0.5);
+				*y = (long)(LastPoint->Y + Dy *	Faktor + 0.5);
 
 				if (Faktor <= 0.0 || Faktor >= 1.0)
 				{
-					dump_error(__FILE__, __LINE__,  "Faktor ist nicht zwischen 0 und 1, aber der gesuchte Punkt liegt im Profil\n");
+					dump_error(__FILE__, __LINE__,	"Faktor	ist nicht zwischen 0 und 1, aber der gesuchte Punkt liegt im Profil\n");
 				}
 
 				return (true);
@@ -2710,19 +2861,19 @@
 		i++;
 	}
 
-	// Der gesuchte Punkt liegt hinter dem letzten Punkt des Profils
-	long Dx = Point->X - LastPoint->X;
-	long Dy = Point->Y - LastPoint->Y;
-	int Dm = Point->Meter - LastPoint->Meter;
+	// Der gesuchte	Punkt liegt hinter dem letzten Punkt des Profils
+	long Dx	= Point->X - LastPoint->X;
+	long Dy	= Point->Y - LastPoint->Y;
+	int Dm = Point->Meter -	LastPoint->Meter;
 
-	double Faktor = (meter - LastPoint->Meter) / Dm;
+	double Faktor =	(meter - LastPoint->Meter) / Dm;
 
-	*x = (long)(LastPoint->X + Dx * Faktor + 0.5);
-	*y = (long)(LastPoint->Y + Dy * Faktor + 0.5);
+	*x = (long)(LastPoint->X + Dx *	Faktor + 0.5);
+	*y = (long)(LastPoint->Y + Dy *	Faktor + 0.5);
 
 	if (Faktor <= 1.0)
 	{
-		dump_error(__FILE__, __LINE__,  "Faktor ist nicht größer als 1, aber der gesuchte Punkt liegt hinter dem Profil\n");
+		dump_error(__FILE__, __LINE__,	"Faktor	ist nicht größer als 1,	aber der gesuchte Punkt	liegt hinter dem Profil\n");
 	}
 
 	return (false);
@@ -2741,9 +2892,9 @@
 //---------------------------------------------------------------------
 void TGewaesserAchseList::Clear(void)
 {
-	for (TGewaesserAchseList::iterator i=begin(); i != end(); i++)
+	for (TGewaesserAchseList::iterator i=begin(); i	!= end(); i++)
 	{
-		TGewaesserAchse *GewaesserAchse = *i;
+		TGewaesserAchse	*GewaesserAchse	= *i;
 
 		delete GewaesserAchse;
 		GewaesserAchse = 0;

Modified: trunk/src/xy.h
===================================================================
--- trunk/src/xy.h	2006-10-05 19:21:36 UTC (rev 65)
+++ trunk/src/xy.h	2006-10-10 23:19:35 UTC (rev 66)
@@ -195,8 +195,8 @@
 		long		 	MinY;
 		long		 	MaxY;
 
-						TXYList(void);
-						~TXYList(void);
+					    TXYList(void);
+                        ~TXYList(void);
 		void 			Clear(void);
 		TXYList* 		Copy(void);
 
@@ -205,6 +205,7 @@
 		void 			SortByXY(void);
 		TXY* 			FindByXY(long X, long Y);
 		TInsideTyp		IsInsideXYList(long X, long Y);
+		TXYList* 		Cut(TXYList* ProfilPolygon, TProfil* CutProfil);
 };
 
 //----------------------------------------------------------------------------



More information about the Wsplgen-commits mailing list