[Wsplgen-commits] r101 - trunk/src
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Jul 10 11:20:13 CEST 2008
Author: mrchip
Date: 2008-07-10 11:20:12 +0200 (Thu, 10 Jul 2008)
New Revision: 101
Modified:
trunk/src/file.cpp
trunk/src/file.h
trunk/src/parameter.cpp
trunk/src/parameter.h
trunk/src/qhull.cpp
trunk/src/qhull.h
trunk/src/quadtree.cpp
trunk/src/quadtree.h
trunk/src/test_file.cpp
trunk/src/test_qhull.cpp
trunk/src/test_tools.cpp
trunk/src/test_xy.cpp
trunk/src/tools.cpp
trunk/src/tools.h
trunk/src/tri.cpp
trunk/src/tri.h
trunk/src/wsplgen.cpp
trunk/src/wsplgen.h
trunk/src/xy.cpp
trunk/src/xy.h
Log:
Nur eine Zwischenversion
Modified: trunk/src/file.cpp
===================================================================
--- trunk/src/file.cpp 2008-07-03 15:17:24 UTC (rev 100)
+++ trunk/src/file.cpp 2008-07-10 09:20:12 UTC (rev 101)
@@ -61,7 +61,7 @@
//---------------------------------------------------------------------
bool LoadPRJ(std::string FileName, int DebugLevel)
{
- write_fortschritt("->Laden der Projektionsdatei zu '%s' gestartet\n", FileName.c_str());
+ write_fortschritt("->Laden der Projektionsdatei gestartet\n", FileName.c_str());
std::string PRJFileName = ExchangeFileExt(FileName, ".prj");
FILE *ph = fopen(PRJFileName.c_str(), "r");
@@ -110,13 +110,13 @@
{
write_fortschritt("Projektionsdatei '%s' konnte nicht geöffnet werden\n", PRJFileName.c_str());
}
- write_fortschritt("<-Laden der Projektionsdatei zu '%s' beendet\n", FileName.c_str());
+ write_fortschritt("<-Laden der Projektionsdatei beendet\n", FileName.c_str());
return (true);
}
//---------------------------------------------------------------------
-bool LoadDGM(std::string FileName, TNodeList *NodeList, TElementList *ElementList, TXYList *BegrenzungsPolygon, int DebugLevel)
+bool LoadDGM(std::string FileName, TNodeList *NodeList, TElementList *ElementList, TXYZList *BegrenzungsPolygon, int DebugLevel)
{
write_fortschritt("->Laden des DGM in Datei '%s' gestartet\n", FileName.c_str());
@@ -199,7 +199,7 @@
}
//---------------------------------------------------------------------------
-bool LoadDGMTIN(std::string FileName, TNodeList *NodeList, TElementList *ElementList, TXYList *Begrenzung, int DebugLevel)
+bool LoadDGMTIN(std::string FileName, TNodeList *NodeList, TElementList *ElementList, TXYZList *Begrenzung, int DebugLevel)
{
write_fortschritt("->Laden des DGM in Datei '%s' als TIN gestartet\n", FileName.c_str());
@@ -225,7 +225,7 @@
if (fhtnz == 0) write_error(2201, "Konnte '%s' nicht zum Lesen öffnen\n", TnzFileName.c_str());
- TXYList Huelle;
+ TXYZList Huelle;
bool IsSetBegrenzung = false;
if (Begrenzung && Begrenzung->size() >= 3) IsSetBegrenzung = true;
@@ -445,7 +445,7 @@
}
//---------------------------------------------------------------------------
-bool LoadDGMGRD(std::string FileName, TNodeList *NodeList, TXYList *XyList, int DebugLevel)
+bool LoadDGMGRD(std::string FileName, TNodeList *NodeList, TXYZList *XyList, int DebugLevel)
{
write_fortschritt("->Laden des DGM in Datei '%s' als GRD gestartet\n", FileName.c_str());
@@ -661,7 +661,7 @@
}
//---------------------------------------------------------------------------
-bool LoadDGMXYZ(std::string FileName, TNodeList *NodeList, TXYList *XyList, int DebugLevel)
+bool LoadDGMXYZ(std::string FileName, TNodeList *NodeList, TXYZList *XyList, int DebugLevel)
{
write_fortschritt("->Laden des DGM in Datei '%s' als XYZ gestartet\n", FileName.c_str());
@@ -735,7 +735,7 @@
}
//---------------------------------------------------------------------------
-bool LoadDGMSHP(std::string FileName, TNodeList *NodeList, TXYList *XyList, int DebugLevel)
+bool LoadDGMSHP(std::string FileName, TNodeList *NodeList, TXYZList *XyList, int DebugLevel)
{
write_fortschritt("->Laden des DGM in Datei '%s' als SHP gestartet\n", FileName.c_str());
@@ -928,7 +928,7 @@
}
//---------------------------------------------------------------------------
-bool LoadDGM2DM(std::string FileName, TNodeList *NodeList, TElementList *ElementList, TXYList *XyList, int DebugLevel)
+bool LoadDGM2DM(std::string FileName, TNodeList *NodeList, TElementList *ElementList, TXYZList *XyList, int DebugLevel)
{
write_fortschritt("->Laden des DGM in Datei '%s' als 2DM gestartet\n", FileName.c_str());
@@ -1654,9 +1654,9 @@
write_error(2204, "Es sind keine Objekte in der Shape-Datei '%s'\n", SHPFileName.c_str());
}
- if (ShapeType != SHPT_ARC && ShapeType != SHPT_ARCZ && ShapeType != SHPT_ARCM)
+ if (ShapeType != SHPT_ARC && ShapeType != SHPT_ARCZ && ShapeType != SHPT_ARCM && ShapeType != SHPT_POLYGON && ShapeType != SHPT_POLYGONZ && ShapeType != SHPT_POLYGONM)
{
- write_error(2213, "Der Typ ('%s') der Shape-Datei '%s' ist nicht ARC, ARCZ oder ARCM.\nNur die genannten Typen sind für Profilspuren zulässig.\n", ShapeTypeName(ShapeType), SHPFileName.c_str());
+ write_error(2213, "Der Typ ('%s') der Shape-Datei '%s' ist weder ARC, ARCZ, ARCM\nnoch POLYGON, POLYGONZ, POLYHONM.\nNur die genannten Typen sind für Profilspuren zulässig.\n", ShapeTypeName(ShapeType), SHPFileName.c_str());
}
int DBFRecordCount = DBFGetRecordCount(hDBF);
@@ -1782,7 +1782,7 @@
}
// Der Wasserstand muss so hoch sein, damit später auch alle Knoten der Bruckkante erzeugt werden können
- TProfil* Linie = new TProfil(i, NoWsp);
+ TProfil* Linie = new TProfil(SperrenList->size()+1, NoWsp);
if (Typ == "DAMM") SperrenList->insert(Linie);
else if (Typ == "GRABEN") GrabenList->insert(Linie);
@@ -1794,10 +1794,18 @@
{
double X = psCShape->padfX[j];
double Y = psCShape->padfY[j];
+ double Z = psCShape->padfZ[j];
+ if (ShapeType != SHPT_ARCZ && ShapeType != SHPT_POLYGONZ)
+ {
+ if (Typ == "DAMM") Z = DammZ;
+ else if (Typ == "GRABEN") Z = GrabenZ;
+ else Z = 0.0;
+ }
long XL = (long)(X * 100.0 + 0.5);
long YL = (long)(Y * 100.0 + 0.5);
- Linie->AddPoint(XL, YL);
+ int ZL = (int)(Z * 100.0 + 0.5);
+ Linie->AddPoint(XL, YL, ZL);
}
SHPDestroyObject(psCShape);
@@ -1806,10 +1814,10 @@
if (DebugLevel >= 9 || (DebugLevel >= 1 && Count % 10 == 0) || (Count > 0 && Count % 100 == 0))
{
- write_fortschritt("%d von %d Liniensstrukturen geladen, %d Sperren, %d Gräben, %d Rohre Tpy 1, %d Rohre Tpy 2\n", Count, RecordCount, SperrenList->size(), GrabenList->size(), Rohre1List->size(), Rohre2List->size());
+ write_fortschritt("%d von %d Liniensstrukturen geladen.\n%d Sperren, %d Gräben, %d Rohre Tpy 1, %d Rohre Tpy 2\n", Count, RecordCount, SperrenList->size(), GrabenList->size(), Rohre1List->size(), Rohre2List->size());
}
}
- write_fortschritt("%d von %d Liniensstrukturen geladen, %d Sperren, %d Gräben, %d Rohre Typ 1, %d Rohre Typ 2\n", Count, RecordCount, SperrenList->size(), GrabenList->size(), Rohre1List->size(), Rohre2List->size());
+ write_fortschritt("%d von %d Liniensstrukturen geladen.\n%d Sperren, %d Gräben, %d Rohre Typ 1, %d Rohre Typ 2\n", Count, RecordCount, SperrenList->size(), GrabenList->size(), Rohre1List->size(), Rohre2List->size());
DBFClose(hDBF);
SHPClose(hSHP);
@@ -2512,7 +2520,7 @@
TPoint*PfTest = *(TestAchse->PointList->begin());
TPoint*PlTest = *(TestAchse->PointList->rbegin());
- TXYList* NewXyList = 0;
+ TXYZList* NewXyList = 0;
double ffDx = PfFirst->X - PfTest->X;
double ffDy = PfFirst->Y - PfTest->Y;
@@ -2525,7 +2533,7 @@
if (ffDx * ffDx + ffDy * ffDy < 4)
{
- NewXyList = new TXYList();
+ NewXyList = new TXYZList();
for (TPointList::reverse_iterator i = TestAchse->PointList->rbegin(); i != TestAchse->PointList->rend(); i++)
{
@@ -2540,7 +2548,7 @@
}
else if (flDx * flDx + flDy * flDy < 4)
{
- NewXyList = new TXYList();
+ NewXyList = new TXYZList();
for (TPointList::iterator i = TestAchse->PointList->begin(); i != TestAchse->PointList->end(); i++)
{
@@ -2555,7 +2563,7 @@
}
else if (llDx * llDx + llDy * llDy < 4)
{
- NewXyList = new TXYList();
+ NewXyList = new TXYZList();
for (TPointList::iterator i = TestAchse->PointList->begin(); i != TestAchse->PointList->end(); i++)
{
@@ -2570,7 +2578,7 @@
}
else if (lfDx * lfDx + lfDy * lfDy < 4)
{
- NewXyList = new TXYList();
+ NewXyList = new TXYZList();
for (TPointList::reverse_iterator i = TestAchse->PointList->rbegin(); i != TestAchse->PointList->rend(); i++)
{
@@ -2602,9 +2610,9 @@
if (DebugLevel >= 9) write_fortschritt("Neue XYList (%d)\n", NewXyList->size());
// Neue Punkte hinzufügen
- for (TXYList::iterator i = NewXyList->begin(); i != NewXyList->end(); i++)
+ for (TXYZList::iterator i = NewXyList->begin(); i != NewXyList->end(); i++)
{
- TXY* Xy = *i;
+ TXYZ* Xy = *i;
FirstAchse->AddPoint(Xy->X, Xy->Y);
}
@@ -2628,7 +2636,7 @@
}
//---------------------------------------------------------------------
-bool LoadGebiet(std::string FileName, TXYList *XyList, int DebugLevel)
+bool LoadGebiet(std::string FileName, TXYZList *XyList, int DebugLevel)
{
write_fortschritt("->Laden der hydraulischen Grenze gestartet\n");
@@ -3008,7 +3016,7 @@
}
//---------------------------------------------------------------------------
-bool SavePolygon(std::string FileName, TXYList *XyList, int DebugLevel)
+bool SavePolygon(std::string FileName, TXYZList *XyList, int DebugLevel)
{
write_fortschritt("->Speichern des Begrenzungspolygons gestartet\n");
@@ -3033,7 +3041,7 @@
double *z = (double *)malloc(sizeof(double) * (XyList->size()+1));
int AnzPoint = 0;
- for (TXYList::iterator i = XyList->begin(); i != XyList->end(); i++)
+ for (TXYZList::iterator i = XyList->begin(); i != XyList->end(); i++)
{
x[AnzPoint] = (*i)->X / 100.0;
y[AnzPoint] = (*i)->Y / 100.0;
@@ -3047,7 +3055,7 @@
}
}
- TXYList::iterator i = XyList->begin();
+ TXYZList::iterator i = XyList->begin();
x[AnzPoint] = (*i)->X / 100.0;
y[AnzPoint] = (*i)->Y / 100.0;
z[AnzPoint] = 0.0;
@@ -3137,7 +3145,7 @@
int Count = 0;
int DelCount = 0;
- double MinArea = -1;
+ long double MinArea = -1;
for (TErgebnisPolygonList::iterator j = PolygonList->begin(); j != PolygonList->end(); j++)
{
@@ -3150,7 +3158,7 @@
TErgebnisPolygon* EP1 = *j;
- double Area = fabs(EP1->Area());
+ long double Area = fabs(EP1->Area());
if (MinArea < 0 || MinArea > Area) MinArea = Area;
// 10000 entspricht 100 cm * 100 cm
@@ -3162,7 +3170,7 @@
}
}
write_fortschritt("%d Ringe gelöscht\n", DelCount);
- write_fortschritt("kleinste Ringfläche: %.3f\n", MinArea / 10000.0);
+ write_fortschritt("kleinste Ringfläche: %.3f\n", (double)MinArea / 10000.0);
write_fortschritt("<-Löschen der zu kleinen Ringe beendet\n");
@@ -3210,8 +3218,8 @@
continue;
}
- TXYList::iterator First = EP1->begin();
- TXY *Xy = *First;
+ TXYZList::iterator First = EP1->begin();
+ TXYZ *Xy = *First;
long X = Xy->X;
long Y = Xy->Y;
@@ -3285,7 +3293,7 @@
AnzPolyPoints++;
}
- TXYList::iterator m = EP1->begin();
+ TXYZList::iterator m = EP1->begin();
x[AnzPolyPoints] = (*m)->X / 100.0;
y[AnzPolyPoints] = (*m)->Y / 100.0;
@@ -3660,54 +3668,15 @@
write_error(4201, "Kann Datei '%s' nicht zum Schreiben öffnen\n", FileName.c_str());
}
- char line1[1000];
- if (Parameter->IsSetPar) sprintf(line1, "Parameterdatei(\"%s\")", Parameter->FileNamePar.c_str());
- else line1[0] = '\0';
- strcpy(line1, ToUTF8(line1));
- char line2[1000];
- if (Parameter->IsSetVonKm && Parameter->IsSetBisKm) sprintf(line2, "GewässerStrecke(Von(%.2f) Bis(%.2f))", Parameter->VonKm, Parameter->BisKm);
- else if (Parameter->IsSetVonKm) sprintf(line2, "GewässerStrecke(Von(%.2f) Bis(-))", Parameter->VonKm);
- else if (Parameter->IsSetBisKm) sprintf(line2, "GewässerStrecke(Von(-) Bis(%.2f))", Parameter->BisKm);
- else line2[0] = '\0';
- strcpy(line2, ToUTF8(line2));
- char line3[1000];
- sprintf(line3, "Delta(Von(%.2f) Bis(%.2f) Diff(%.2f))", Parameter->Von / 100.0, Parameter->Bis / 100.0, Parameter->Diff / 100.0);
- strcpy(line3, ToUTF8(line3));
- char line4[1000];
- if (Parameter->IsSetLin) sprintf(line4, "Szenario");
- else if (Parameter->Sperre) sprintf(line4, "Aktuelles-Überschwemmungsgebiet");
- else sprintf(line4, "Potentielles-Überschwemmungsgebiet");
- strcpy(line4, ToUTF8(line4));
- char line5[1000];
- sprintf(line5, "DigitalesGeländeModell(\"%s\")", Parameter->FileNameDgm.c_str());
- strcpy(line5, ToUTF8(line5));
- char line6[1000];
- sprintf(line6, "Gewässerquerprofilspuren(\"%s\")", Parameter->FileNamePro.c_str());
- strcpy(line6, ToUTF8(line6));
- char line7[1000];
- if (Parameter->IsSetWspTag) sprintf(line7, "WspTag(\"%s\")", Parameter->WspTag.c_str());
- else line7[0] = '\0';
- strcpy(line7, ToUTF8(line7));
- char line8[1000];
- sprintf(line8, "Wasserstände(\"%s\")", Parameter->FileNameWsp.c_str());
- strcpy(line8, ToUTF8(line8));
- char line9[1000];
- if (Parameter->IsSetLin) sprintf(line9, "Linienobjekte(\"%s\")", Parameter->FileNameLin.c_str());
- else line9[0] = '\0';
- strcpy(line9, ToUTF8(line9));
- char line10[1000];
- if (Parameter->IsSetAchse) sprintf(line10, "Gewässerachse(\"%s\")", Parameter->FileNameAchse.c_str());
- else line10[0] = '\0';
- strcpy(line10, ToUTF8(line10));
long Secs, Mins, Hours, Days, Months, Years;
GetTimeAndDate(&Secs, &Mins, &Hours, &Days, &Months, &Years);
@@ -3754,7 +3723,66 @@
fprintf(fh, " <smXML:DQ_DataQuality>\n");
fprintf(fh, " <smXML:LI_Lineage>\n");
fprintf(fh, " <smXML:statement>\n");
- fprintf(fh, " <smXML:CharacterString>%s %s %s %s %s %s %s %s %s %s</smXML:CharacterString>\n", line1, line2, line3, line4, line5, line6, line7, line8, line9, line10);
+ fprintf(fh, " <smXML:CharacterString>\n");
+
+ char line[1000];
+
+ if (Parameter->IsSetPar) sprintf(line, "Parameterdatei(\"%s\")", Parameter->FileNamePar.c_str());
+ else line[0] = '\0';
+ strcpy(line, ToUTF8(line));
+ fprintf(fh, " %s\n", line);
+
+ if (Parameter->IsSetVonKm && Parameter->IsSetBisKm) sprintf(line, "GewässerStrecke(Von(%.2f) Bis(%.2f))", Parameter->VonKm, Parameter->BisKm);
+ else if (Parameter->IsSetVonKm) sprintf(line, "GewässerStrecke(Von(%.2f) Bis(-))", Parameter->VonKm);
+ else if (Parameter->IsSetBisKm) sprintf(line, "GewässerStrecke(Von(-) Bis(%.2f))", Parameter->BisKm);
+ else line[0] = '\0';
+ strcpy(line, ToUTF8(line));
+ fprintf(fh, " %s\n", line);
+
+ sprintf(line, "Delta(Von(%.2f) Bis(%.2f) Diff(%.2f))", Parameter->Von / 100.0, Parameter->Bis / 100.0, Parameter->Diff / 100.0);
+ strcpy(line, ToUTF8(line));
+ fprintf(fh, " %s\n", line);
+
+ if (Parameter->IsSetLin) sprintf(line, "Szenario");
+ else if (Parameter->Sperre) sprintf(line, "Aktuelles-Überschwemmungsgebiet");
+ else sprintf(line, "Potentielles-Überschwemmungsgebiet");
+ strcpy(line, ToUTF8(line));
+ fprintf(fh, " %s\n", line);
+
+ sprintf(line, "DigitalesGeländeModell(\"%s\")", Parameter->FileNameDgm.c_str());
+ strcpy(line, ToUTF8(line));
+ fprintf(fh, " %s\n", line);
+
+ sprintf(line, "Gewässerquerprofilspuren(\"%s\")", Parameter->FileNamePro.c_str());
+ strcpy(line, ToUTF8(line));
+ fprintf(fh, " %s\n", line);
+
+ if (Parameter->IsSetWspTag) sprintf(line, "WspTag(\"%s\")", Parameter->WspTag.c_str());
+ else line[0] = '\0';
+ strcpy(line, ToUTF8(line));
+ fprintf(fh, " %s\n", line);
+
+ sprintf(line, "Wasserstände(\"%s\")", Parameter->FileNameWsp.c_str());
+ strcpy(line, ToUTF8(line));
+ fprintf(fh, " %s\n", line);
+
+ for (TStringList::iterator i = Parameter->FileNamesLin.begin(); i != Parameter->FileNamesLin.end(); i++)
+ {
+ std::string FileNameLin = *i;
+
+ if (Parameter->IsSetLin) sprintf(line, "Linienobjekte(\"%s\")", FileNameLin.c_str());
+ else line[0] = '\0';
+ strcpy(line, ToUTF8(line));
+ fprintf(fh, " %s\n", line);
+ }
+
+ if (Parameter->IsSetAchse) sprintf(line, "Gewässerachse(\"%s\")", Parameter->FileNameAchse.c_str());
+ else line[0] = '\0';
+ strcpy(line, ToUTF8(line));
+ fprintf(fh, " %s\n", line);
+
+
+ fprintf(fh, " </smXML:CharacterString>\n");
fprintf(fh, " </smXML:statement>\n");
fprintf(fh, " </smXML:LI_Lineage>\n");
fprintf(fh, " </smXML:DQ_DataQuality>\n");
Modified: trunk/src/file.h
===================================================================
--- trunk/src/file.h 2008-07-03 15:17:24 UTC (rev 100)
+++ trunk/src/file.h 2008-07-10 09:20:12 UTC (rev 101)
@@ -26,12 +26,12 @@
bool LoadPRJ(std::string FileName, int DebugLevel);
-bool LoadDGM(std::string FileName, TNodeList *NodeList, TElementList *ElementList, TXYList *XyList, int DebugLevel);
-bool LoadDGMTIN(std::string FileName, TNodeList *NodeList, TElementList *ElementList, TXYList *XyList, int DebugLevel);
-bool LoadDGMGRD(std::string FileName, TNodeList *NodeList, TXYList *XyList, int DebugLevel);
-bool LoadDGMXYZ(std::string FileName, TNodeList *NodeList, TXYList *XyList, int DebugLevel);
-bool LoadDGMSHP(std::string FileName, TNodeList *NodeList, TXYList *XyList, int DebugLevel);
-bool LoadDGM2DM(std::string FileName, TNodeList *NodeList, TElementList *ElementList, TXYList *XyList, int DebugLevel);
+bool LoadDGM(std::string FileName, TNodeList *NodeList, TElementList *ElementList, TXYZList *XyList, int DebugLevel);
+bool LoadDGMTIN(std::string FileName, TNodeList *NodeList, TElementList *ElementList, TXYZList *XyList, int DebugLevel);
+bool LoadDGMGRD(std::string FileName, TNodeList *NodeList, TXYZList *XyList, int DebugLevel);
+bool LoadDGMXYZ(std::string FileName, TNodeList *NodeList, TXYZList *XyList, int DebugLevel);
+bool LoadDGMSHP(std::string FileName, TNodeList *NodeList, TXYZList *XyList, int DebugLevel);
+bool LoadDGM2DM(std::string FileName, TNodeList *NodeList, TElementList *ElementList, TXYZList *XyList, int DebugLevel);
bool LoadProfile(std::string FileName, TProfilList* ProfilList, TGewaesserAchseList* GewaesserAchseList, double VonKmD, double BisKmD, int DebugLevel);
bool LoadLinien(std::string FileName, TProfilList* SperrenList, TProfilList* GrabenList, TProfilList* Rohre1List, TProfilList* Rohre2List, int DebugLevel);
@@ -43,7 +43,7 @@
bool LoadAchse(std::string FileName, TGewaesserAchseList* GewaesserAchseList, int DebugLevel);
-bool LoadGebiet(std::string FileName, TXYList *XyList, int DebugLevel);
+bool LoadGebiet(std::string FileName, TXYZList *XyList, int DebugLevel);
bool SavePRJ(std::string FileName, int DebugLevel);
bool SaveNet(std::string FileName, TNodeList *NodeList, TElementList *ElementList, int DebugLevel);
@@ -51,7 +51,7 @@
bool SaveNodes(std::string FileName, TNodeList *NodeList, int DebugLevel);
bool SaveElements(std::string FileName, TElementList *ElementList, int TopoDiff, int DebugLevel);
bool SaveProfile(std::string FileName, TProfilList *ProfilList, int DebugLevel);
-bool SavePolygon(std::string FileName, TXYList *XyList, int DebugLevel);
+bool SavePolygon(std::string FileName, TXYZList *XyList, int DebugLevel);
bool SavePolygone(std::string FileName, TErgebnisPolygonList *ErgebnisPolygonList, int DebugLevel);
bool SaveEdges(std::string FileName, TEdgeList *EdgeList, int DebugLevel);
bool SaveXml(std::string FileName, TParameter* Parameter);
Modified: trunk/src/parameter.cpp
===================================================================
--- trunk/src/parameter.cpp 2008-07-03 15:17:24 UTC (rev 100)
+++ trunk/src/parameter.cpp 2008-07-10 09:20:12 UTC (rev 101)
@@ -51,8 +51,8 @@
WspTag = "";
IsSetLin = false;
- FileNameLin = "";
+
IsSetAchse = false;
FileNameAchse = "";
@@ -97,13 +97,19 @@
j++;
}
- if (Parameter.substr(0, 1) == "'")
+ Parameter = Trim(Parameter);
+
+ if (Parameter.size() == 0)
{
- write_fortschritt("%s\n", Parameter.c_str()+1);
- }
+ // Leerzeilen werden überlesen
+ }
+ else if (Parameter.substr(0, 1) == "'")
+ {
+ write_fortschritt("%s\n", Parameter.c_str()+1);
+ }
else if (Parameter.substr(0, 1) == "#" || Parameter.substr(0, 1) == "/" || Parameter.substr(0, 1) == ";")
{
- // Echter Kommentar
+ // Echter Kommentar
}
else if (Parameter.substr(0, 7) == "-OUTPUT" || Parameter.substr(0, 7) == "-output")
{
@@ -506,22 +512,18 @@
{
if (IsSetDebug) write_fortschritt("Parameter -LIN erkannt.\n");
- if (IsSetLin)
- {
- write_warning(1106, "Der Parameter -LIN wurde mehrfach angegeben.\n");
- continue;
- }
-
if (Parameter.substr(4, 1) != "=")
{
write_error(1207, "Es wurden kein Dateiname für -LIN übergeben.\nDas Format lautet korrekt -LIN=<Dateiname>.\n");
}
- FileNameLin = Parameter.substr(5);
+ std::string FileNameLin = Parameter.substr(5);
if (FileNameLin[0] == '"') FileNameLin = FileNameLin.substr(1);
if (FileNameLin[FileNameLin.length()-1] == '"') FileNameLin = FileNameLin.substr(0, FileNameLin.length()-1);
+ FileNamesLin.push_back(FileNameLin);
+
IsSetLin = true;
write_fortschritt("Bruch- und Sperr-Datei: '%s'\n", FileNameLin.c_str());
@@ -609,7 +611,7 @@
}
else
{
- write_warning(1124, "Eine unbekannte Zeichenkette %s' wurde als Parameter übergeben.\nDie Zeichenkette wird ignoriert.\n", Parameter.c_str());
+ write_warning(1124, "Eine unbekannte Zeichenkette '%s' wurde als Parameter übergeben.\nDie Zeichenkette wird ignoriert.\n", Parameter.c_str());
}
}
Modified: trunk/src/parameter.h
===================================================================
--- trunk/src/parameter.h 2008-07-03 15:17:24 UTC (rev 100)
+++ trunk/src/parameter.h 2008-07-10 09:20:12 UTC (rev 101)
@@ -16,8 +16,11 @@
//---------------------------------------------------------------------------
#include <string>
+#include <vector>
#include <stdio.h>
+typedef std::vector<std::string> TStringList;
+
//---------------------------------------------------------------------------
class TParameter
{
@@ -57,7 +60,7 @@
std::string WspTag;
bool IsSetLin;
- std::string FileNameLin;
+ TStringList FileNamesLin;
bool IsSetAchse;
std::string FileNameAchse;
Modified: trunk/src/qhull.cpp
===================================================================
--- trunk/src/qhull.cpp 2008-07-03 15:17:24 UTC (rev 100)
+++ trunk/src/qhull.cpp 2008-07-10 09:20:12 UTC (rev 101)
@@ -19,7 +19,7 @@
#include "qhull.h"
//---------------------------------------------------------------------
-double DistanceBetween(TXY* SXy, TXY* EXy, TXY* Xy)
+double DistanceBetween(TXYZ* SXy, TXYZ* EXy, TXYZ* Xy)
{
double X1 = SXy->X;
double Y1 = SXy->Y;
@@ -81,14 +81,14 @@
}
//---------------------------------------------------------------------
-TXY* FindPointBetween(TXYList *XYList, TXY* SXy, TXY* EXy)
+TXYZ* FindPointBetween(TXYZList *XYList, TXYZ* SXy, TXYZ* EXy)
{
double MaxD = 0.0001;
- TXY* MaxXy = 0;
+ TXYZ* MaxXy = 0;
- for (TXYList::iterator i = XYList->begin(); i != XYList->end(); i++)
+ for (TXYZList::iterator i = XYList->begin(); i != XYList->end(); i++)
{
- TXY* Xy = *i;
+ TXYZ* Xy = *i;
double D = DistanceBetween(SXy, EXy, Xy);
@@ -103,9 +103,9 @@
}
//---------------------------------------------------------------------
-void ExpandQHull(TXYList *XYList, TXYList *QHull, TXY* SXy, TXY* EXy)
+void ExpandQHull(TXYZList *XYList, TXYZList *QHull, TXYZ* SXy, TXYZ* EXy)
{
- TXY* Xy = FindPointBetween(XYList, SXy, EXy);
+ TXYZ* Xy = FindPointBetween(XYList, SXy, EXy);
if (Xy == 0) return;
@@ -115,7 +115,7 @@
}
//---------------------------------------------------------------------
-void QHull(TXYList *XYList, TXYList* QHull, int DebugLevel)
+void QHull(TXYZList *XYList, TXYZList* QHull, int DebugLevel)
{
write_fortschritt("->Erzeugen des Begrenzungspolygons gestartet\n");
@@ -127,11 +127,11 @@
// Den linkesten und rechtesten Punkt suchen
// Die gehören beide zur konvexen Hülle
- TXY* LXy = 0;
- TXY* RXy = 0;
- for (TXYList::iterator i = XYList->begin(); i != XYList->end(); i++)
+ TXYZ* LXy = 0;
+ TXYZ* RXy = 0;
+ for (TXYZList::iterator i = XYList->begin(); i != XYList->end(); i++)
{
- TXY* Xy = *i;
+ TXYZ* Xy = *i;
if (LXy == 0 || Xy->X < LXy->X) LXy = Xy;
if (RXy == 0 || Xy->X > RXy->X) RXy = Xy;
Modified: trunk/src/qhull.h
===================================================================
--- trunk/src/qhull.h 2008-07-03 15:17:24 UTC (rev 100)
+++ trunk/src/qhull.h 2008-07-10 09:20:12 UTC (rev 101)
@@ -19,7 +19,7 @@
#include "xy.h"
//---------------------------------------------------------------------------
-void QHull(TXYList *XYList, TXYList* QHull, int DebugLevel);
+void QHull(TXYZList *XYList, TXYZList* QHull, int DebugLevel);
//---------------------------------------------------------------------------
#endif
Modified: trunk/src/quadtree.cpp
===================================================================
--- trunk/src/quadtree.cpp 2008-07-03 15:17:24 UTC (rev 100)
+++ trunk/src/quadtree.cpp 2008-07-10 09:20:12 UTC (rev 101)
@@ -205,5 +205,5 @@
//---------------------------------------------------------------------
template class TQuadTree<TNodeList, TNode>;
-template class TQuadTree<TXYList, TXY>;
+template class TQuadTree<TXYZList, TXYZ>;
Modified: trunk/src/quadtree.h
===================================================================
--- trunk/src/quadtree.h 2008-07-03 15:17:24 UTC (rev 100)
+++ trunk/src/quadtree.h 2008-07-10 09:20:12 UTC (rev 101)
@@ -1,5 +1,5 @@
//
-// $Id: quadtree.h 48 2006-05-11 21:32:40Z mrchip $
+// $Id$
//
// Copyright (C) 2005 STADT-LAND-FLUSS INGENIEURDIENSTE GmbH
//
Modified: trunk/src/test_file.cpp
===================================================================
--- trunk/src/test_file.cpp 2008-07-03 15:17:24 UTC (rev 100)
+++ trunk/src/test_file.cpp 2008-07-10 09:20:12 UTC (rev 101)
@@ -41,6 +41,7 @@
#define PROFILZFILE "test_daten\\profilez.shp"
#define PROFILFILE2 "test_daten\\profile_dreh.shp"
#define LINIENFILE "test_daten\\linien.shp"
+#define LINIENFILE3 "test_daten\\linien3.shp"
#define WSPFILE "test_daten\\wsp.txt"
#define WSPFILE2 "test_daten\\wsp.dbf"
#define WSPFILE3 "test_daten\\mosel.wst"
@@ -66,6 +67,7 @@
#define PROFILZFILE "test_daten/profilez.shp"
#define PROFILFILE2 "test_daten/profile_dreh.shp"
#define LINIENFILE "test_daten/linien.shp"
+#define LINIENFILE3 "test_daten/linien3.shp"
#define WSPFILE "test_daten/wsp.txt"
#define WSPFILE2 "test_daten/wsp.dbf"
#define WSPFILE3 "test_daten/mosel.wst"
@@ -96,35 +98,35 @@
TErgebnisPolygonList *PolygonList = new TErgebnisPolygonList;
TErgebnisPolygon* EP1 = new TErgebnisPolygon(0);
- TXY *XY1 = new TXY(10000, 10000);
+ TXYZ *XY1 = new TXYZ(10000, 10000);
EP1->Add(XY1);
- TXY *XY2 = new TXY(30000, 10000);
+ TXYZ *XY2 = new TXYZ(30000, 10000);
EP1->Add(XY2);
- TXY *XY3 = new TXY(30000, 30000);
+ TXYZ *XY3 = new TXYZ(30000, 30000);
EP1->Add(XY3);
- TXY *XY4 = new TXY(10000, 30000);
+ TXYZ *XY4 = new TXYZ(10000, 30000);
EP1->Add(XY4);
PolygonList->push_back(EP1);
TErgebnisPolygon* EP2 = new TErgebnisPolygon(0);
- TXY *XY5 = new TXY(15000, 15000);
+ TXYZ *XY5 = new TXYZ(15000, 15000);
EP2->Add(XY5);
- TXY *XY6 = new TXY(25000, 15000);
+ TXYZ *XY6 = new TXYZ(25000, 15000);
EP2->Add(XY6);
- TXY *XY7 = new TXY(25000, 25000);
+ TXYZ *XY7 = new TXYZ(25000, 25000);
EP2->Add(XY7);
- TXY *XY8 = new TXY(15000, 25000);
+ TXYZ *XY8 = new TXYZ(15000, 25000);
EP2->Add(XY8);
- TXY *XY9 = new TXY(20000, 20000);
+ TXYZ *XY9 = new TXYZ(20000, 20000);
EP2->Add(XY9);
PolygonList->push_back(EP2);
TErgebnisPolygon* EP3 = new TErgebnisPolygon(0);
- TXY *XY10 = new TXY(45000, 25000);
+ TXYZ *XY10 = new TXYZ(45000, 25000);
EP3->Add(XY10);
- TXY *XY11 = new TXY(55000, 25000);
+ TXYZ *XY11 = new TXYZ(55000, 25000);
EP3->Add(XY11);
- TXY *XY12 = new TXY(55000, 15000);
+ TXYZ *XY12 = new TXYZ(55000, 15000);
EP3->Add(XY12);
PolygonList->push_back(EP3);
@@ -165,7 +167,6 @@
else if (!Parameter->IsSetWsp || Parameter->FileNameWsp != "egal.shp") printf("Failed\n");
else if (!Parameter->IsSetAchse || Parameter->FileNameAchse != "egal.shp") printf("Failed\n");
else if (!Parameter->IsSetGebiet || Parameter->FileNameGebiet != "total egal.shp") printf("Failed\n");
- else if (!Parameter->IsSetLin || Parameter->FileNameLin != "egal.shp") printf("Failed\n");
else if (!Parameter->IsSetGel || Parameter->Sperre != true) printf("Failed\n");
else if (!Parameter->IsSetDelta) printf("Failed\n");
else if (Parameter->Von != 0 || Parameter->Bis != 100 || Parameter->Diff != 23) printf("Failed\n");
@@ -178,263 +179,6 @@
delete Parameter;
}
- /////////////////////////////////////////////////
- // Test von DGM-TIN ohne Begrenzungspolygon laden
- /////////////////////////////////////////////////
-
- {
- printf ("Test DGM-TIN ohne Begrenzungspolygon laden: ");
-
- TNodeList *NodeList = new TNodeList();
- TElementList *ElementList = new TElementList();
-
- LoadDGM(DGMTINFILE, NodeList, ElementList, 0, 8);
-
- if (NodeList->size() != 114) printf("Failed\n");
- else if (ElementList->size() != 218) printf("Failed\n");
- else printf("Pass\n");
-
- delete NodeList;
- delete ElementList;
- }
-
- /////////////////////////////////////////////////
- // Test von DGM-TIN mit Begrenzungspolygon laden
- /////////////////////////////////////////////////
-
- {
- printf ("Test DGM-TIN mit Begrenzungspolygon laden: ");
-
- TNodeList *NodeList = new TNodeList();
- TElementList *ElementList = new TElementList();
- TXYList *XyList = new TXYList();
-
- XyList->Add(new TXY(807711500, 246716800));
- XyList->Add(new TXY(807711500, 262559500));
- XyList->Add(new TXY(826648700, 262559500));
- XyList->Add(new TXY(826648700, 246716800));
-
- LoadDGM(DGMTINFILE, NodeList, ElementList, XyList, 8);
-
- if (NodeList->size() != 71) printf("Failed\n");
- else if (ElementList->size() != 110) printf("Failed\n");
- else printf("Pass\n");
-
- delete XyList;
- delete ElementList;
- delete NodeList;
- }
-
- /////////////////////////////////////////////////
- // Test von DGM-TIN2 ohne Begrenzungspolygon laden
- /////////////////////////////////////////////////
-
- {
- printf ("Test DGM-TIN2 ohne Begrenzungspolygon laden: ");
-
- TNodeList *NodeList = new TNodeList();
- TElementList *ElementList = new TElementList();
-
- LoadDGM(DGMTINFILE2, NodeList, ElementList, 0, 8);
-
- if (NodeList->size() != 19) printf("Failed\n");
- else if (ElementList->size() != 28) printf("Failed\n");
- else printf("Pass\n");
-
- delete NodeList;
- delete ElementList;
- }
-
- /////////////////////////////////////////////////
- // Test von DGM-TIN3 ohne Begrenzungspolygon laden
- /////////////////////////////////////////////////
-
- {
- printf ("Test DGM-TIN3 ohne Begrenzungspolygon laden: ");
-
- TNodeList *NodeList = new TNodeList();
- TElementList *ElementList = new TElementList();
-
- LoadDGM(DGMTINFILE3, NodeList, ElementList, 0, 8);
-
-// SaveNet("test.2dm", NodeList, ElementList, 8);
-
- if (NodeList->size() != 52) printf("Failed\n");
- else if (ElementList->size() != 72) printf("Failed\n");
- else printf("Pass\n");
-
- delete NodeList;
- delete ElementList;
- }
-
-
- /////////////////////////////////////////////////
- // Test von DGM-GRD mit Begrenzungspolygon laden
- /////////////////////////////////////////////////
-
- {
- printf ("Test DGM-GRD mit Begrenzungspolygon laden: ");
-
- TNodeList *NodeList = new TNodeList();
- TElementList *ElementList = new TElementList();
- TXYList *XyList = new TXYList();
-
- XyList->Add(new TXY(807811000, 246716800));
- XyList->Add(new TXY(807811000, 262559500));
- XyList->Add(new TXY(826648700, 262559500));
- XyList->Add(new TXY(826648700, 246716800));
-
- LoadDGM(DGMGRDFILE, NodeList, ElementList, XyList, 8);
-
- if (NodeList->size() != 24624) printf("Failed\n");
- else printf("Pass\n");
-
- delete XyList;
- delete NodeList;
- delete ElementList;
- }
-
- /////////////////////////////////////////////////
- // Test von DGM-XYZ ohne Begrenzungspolygon laden
- /////////////////////////////////////////////////
-
- {
- printf ("Test DGM-XYZ ohne Begrenzungspolygon laden: ");
-
- TNodeList *NodeList = new TNodeList();
- TElementList *ElementList = new TElementList();
-
- LoadDGM(DGMXYZFILE, NodeList, ElementList, 0, 8);
-
- if (NodeList->size() != 10) printf("Failed\n");
- else printf("Pass\n");
-
- delete NodeList;
- delete ElementList;
- }
-
- /////////////////////////////////////////////////
- // Test von DGM-XYZ ohne Begrenzungspolygon laden
- /////////////////////////////////////////////////
-
- {
- printf ("Test DGM-XYZ ohne Begrenzungspolygon laden: ");
-
- TNodeList *NodeList = new TNodeList();
- TElementList *ElementList = new TElementList();
-
- LoadDGM(DGMXYZFILE2, NodeList, ElementList, 0, 8);
-
- if (NodeList->size() != 1126) printf("Failed\n");
- else printf("Pass\n");
-
- delete NodeList;
- delete ElementList;
- }
-
- /////////////////////////////////////////////////
- // Test von DGM-XYZ ohne Begrenzungspolygon laden
- /////////////////////////////////////////////////
-
- {
- printf ("Test DGM-XYZ ohne Begrenzungspolygon laden: ");
-
- TNodeList *NodeList = new TNodeList();
- TElementList *ElementList = new TElementList();
-
- LoadDGM(DGMXYZFILE3, NodeList, ElementList, 0, 8);
-
- if (NodeList->size() != 43332) printf("Failed\n");
- else printf("Pass\n");
-
- delete NodeList;
- delete ElementList;
- }
-
- /////////////////////////////////////////////////
- // Test von DGM-XYZ ohne Begrenzungspolygon laden
- /////////////////////////////////////////////////
-
- {
- printf ("Test DGM-XYZ ohne Begrenzungspolygon laden: ");
-
- TNodeList *NodeList = new TNodeList();
- TElementList *ElementList = new TElementList();
-
- LoadDGM(DGMXYZFILE4, NodeList, ElementList, 0, 8);
-
- if (NodeList->size() != 98636) printf("Failed\n");
- else printf("Pass\n");
-
- delete NodeList;
- delete ElementList;
- }
-
- /////////////////////////////////////////////////
- // Test von DGM-SHP ohne Begrenzungspolygon laden
- /////////////////////////////////////////////////
-
- {
- printf ("Test DGM-SHP ohne Begrenzungspolygon laden: ");
-
- TNodeList *NodeList = new TNodeList();
- TElementList *ElementList = new TElementList();
-
- LoadDGM(DGMSHPFILE, NodeList, ElementList, 0, 8);
-
- if (NodeList->size() != 114) printf("Failed\n");
- else printf("Pass\n");
-
- delete NodeList;
- delete ElementList;
- }
-
- /////////////////////////////////////////////////
- // Test von DGM-SHP mit Begrenzungspolygon laden
- /////////////////////////////////////////////////
-
- {
- printf ("Test DGM-SHP mit Begrenzungspolygon laden: ");
-
- TNodeList *NodeList = new TNodeList();
- TElementList *ElementList = new TElementList();
- TXYList *XyList = new TXYList();
-
- XyList->Add(new TXY(349478100, 587483400));
- XyList->Add(new TXY(349478100, 587493600));
- XyList->Add(new TXY(349516400, 587493600));
- XyList->Add(new TXY(349516400, 587483400));
-
- LoadDGM(DGMSHPFILE2, NodeList, ElementList, XyList, 8);
-
- if (NodeList->size() != 28287) printf("Failed\n");
- else printf("Pass\n");
-
- delete XyList;
- delete NodeList;
- delete ElementList;
- }
-
- /////////////////////////////////////////////////
- // Test von DGM-2DM ohne Begrenzungspolygon laden
- /////////////////////////////////////////////////
-
- {
- printf ("Test DGM-2DM ohne Begrenzungspolygon laden: ");
-
- TNodeList *NodeList = new TNodeList();
- TElementList *ElementList = new TElementList();
-
- LoadDGM(DGM2DMFILE, NodeList, ElementList, 0, 8);
-
- if (NodeList->size() != 1126) printf("Failed\n");
- else if (ElementList->size() != 2225) printf("Failed\n");
- else printf("Pass\n");
-
- delete NodeList;
- delete ElementList;
- }
-
////////////////////////////////////////
// Test von Profilspuren laden
////////////////////////////////////////
@@ -473,6 +217,7 @@
// Test von Profilspuren laden
////////////////////////////////////////
+/*
{
printf ("Test Profilspuren laden mit ausrichten: ");
@@ -490,13 +235,14 @@
delete ProfilList;
delete AchsenList;
}
+*/
////////////////////////////////////////
// Test von Strukturen laden
////////////////////////////////////////
{
- printf ("Test Strukturen laden: ");
+ printf ("Test Strukturen als Linien laden: ");
TProfilList *SperrenList = new TProfilList();
TProfilList *GrabenList = new TProfilList();
@@ -517,6 +263,56 @@
delete SperrenList;
}
+ {
+ printf ("Test Strukturen als Polygone laden: ");
+
+ TProfilList *SperrenList = new TProfilList();
+ TProfilList *GrabenList = new TProfilList();
+ TProfilList *RohreList = new TProfilList();
+ TProfilList *GradientenList = new TProfilList();
+
+ LoadLinien(LINIENFILE3, SperrenList, GrabenList, RohreList, GradientenList, 8);
+
+ int SperrenSumme = 0;
+ for (TProfilList::iterator i=SperrenList->begin(); i != SperrenList->end(); i++)
+ {
+ TProfil *Profil = *i;
+
+ for (TPointList::iterator j = Profil->PointList->begin(); j != Profil->PointList->end(); j++)
+ {
+ TPoint* Point = *j;
+
+ SperrenSumme = SperrenSumme + Point->Z;
+ }
+ }
+
+ int GrabenSumme = 0;
+ for (TProfilList::iterator i=GrabenList->begin(); i != GrabenList->end(); i++)
+ {
+ TProfil *Profil = *i;
+
+ for (TPointList::iterator j = Profil->PointList->begin(); j != Profil->PointList->end(); j++)
+ {
+ TPoint* Point = *j;
+
+ GrabenSumme = GrabenSumme + Point->Z;
+ }
+ }
+
+ if (SperrenList->size() != 1) printf("Failed\n");
+ else if (GrabenList->size() != 1) printf("Failed\n");
+ else if (RohreList->size() != 0) printf("Failed\n");
+ else if (GradientenList->size() != 0) printf("Failed\n");
+ else if (SperrenSumme != 22000) printf("Failed\n");
+ else if (GrabenSumme != 29000) printf("Failed\n");
+ else printf("Pass\n");
+
+ delete GradientenList;
+ delete RohreList;
+ delete GrabenList;
+ delete SperrenList;
+ }
+
////////////////////////////////////////
// Test von WSP als ASCII laden
////////////////////////////////////////
@@ -658,7 +454,7 @@
{
printf ("Test Hydraulische Grenze laden: ");
- TXYList *Gebiet = new TXYList();
+ TXYZList *Gebiet = new TXYZList();
LoadGebiet(GRENZEFILE, Gebiet, 8);
@@ -668,6 +464,217 @@
delete Gebiet;
}
+ /////////////////////////////////////////////////
+ // Test von DGM-TIN ohne Begrenzungspolygon laden
+ /////////////////////////////////////////////////
+
+ {
+ printf ("Test DGM-TIN ohne Begrenzungspolygon laden: ");
+
+ TNodeList *NodeList = new TNodeList();
+ TElementList *ElementList = new TElementList();
+
+ LoadDGM(DGMTINFILE, NodeList, ElementList, 0, 8);
+
+ if (NodeList->size() != 114) printf("Failed\n");
+ else if (ElementList->size() != 218) printf("Failed\n");
+ else printf("Pass\n");
+
+ delete NodeList;
+ delete ElementList;
+ }
+
+ /////////////////////////////////////////////////
+ // Test von DGM-TIN mit Begrenzungspolygon laden
+ /////////////////////////////////////////////////
+
+ {
+ printf ("Test DGM-TIN mit Begrenzungspolygon laden: ");
+
+ TNodeList *NodeList = new TNodeList();
+ TElementList *ElementList = new TElementList();
+ TXYZList *XyList = new TXYZList();
+
+ XyList->Add(new TXYZ(807711500, 246716800));
+ XyList->Add(new TXYZ(807711500, 262559500));
+ XyList->Add(new TXYZ(826648700, 262559500));
+ XyList->Add(new TXYZ(826648700, 246716800));
+
+ LoadDGM(DGMTINFILE, NodeList, ElementList, XyList, 8);
+
+ if (NodeList->size() != 71) printf("Failed\n");
+ else if (ElementList->size() != 110) printf("Failed\n");
+ else printf("Pass\n");
+
+ delete XyList;
+ delete ElementList;
+ delete NodeList;
+ }
+
+ /////////////////////////////////////////////////
+ // Test von DGM-TIN2 ohne Begrenzungspolygon laden
+ /////////////////////////////////////////////////
+
+ {
+ printf ("Test DGM-TIN2 ohne Begrenzungspolygon laden: ");
+
+ TNodeList *NodeList = new TNodeList();
+ TElementList *ElementList = new TElementList();
+
+ LoadDGM(DGMTINFILE2, NodeList, ElementList, 0, 8);
+
+ if (NodeList->size() != 19) printf("Failed\n");
+ else if (ElementList->size() != 28) printf("Failed\n");
+ else printf("Pass\n");
+
+ delete NodeList;
+ delete ElementList;
+ }
+
+ /////////////////////////////////////////////////
+ // Test von DGM-TIN3 ohne Begrenzungspolygon laden
+ /////////////////////////////////////////////////
+
+ {
+ printf ("Test DGM-TIN3 ohne Begrenzungspolygon laden: ");
+
+ TNodeList *NodeList = new TNodeList();
+ TElementList *ElementList = new TElementList();
+
+ LoadDGM(DGMTINFILE3, NodeList, ElementList, 0, 8);
+
+// SaveNet("test.2dm", NodeList, ElementList, 8);
+
+ if (NodeList->size() != 52) printf("Failed\n");
+ else if (ElementList->size() != 72) printf("Failed\n");
+ else printf("Pass\n");
+
+ delete NodeList;
+ delete ElementList;
+ }
+
+
+ /////////////////////////////////////////////////
+ // Test von DGM-GRD mit Begrenzungspolygon laden
+ /////////////////////////////////////////////////
+
+ {
+ printf ("Test DGM-GRD mit Begrenzungspolygon laden: ");
+
+ TNodeList *NodeList = new TNodeList();
+ TElementList *ElementList = new TElementList();
+ TXYZList *XyList = new TXYZList();
+
+ XyList->Add(new TXYZ(807811000, 246716800));
+ XyList->Add(new TXYZ(807811000, 262559500));
+ XyList->Add(new TXYZ(826648700, 262559500));
+ XyList->Add(new TXYZ(826648700, 246716800));
+
+ LoadDGM(DGMGRDFILE, NodeList, ElementList, XyList, 8);
+
+ if (NodeList->size() != 24624) printf("Failed\n");
+ else printf("Pass\n");
+
+ delete XyList;
+ delete NodeList;
+ delete ElementList;
+ }
+
+ /////////////////////////////////////////////////
+ // Test von DGM-XYZ ohne Begrenzungspolygon laden
+ /////////////////////////////////////////////////
+
+ {
+ printf ("Test DGM-XYZ ohne Begrenzungspolygon laden: ");
+
+ TNodeList *NodeList = new TNodeList();
+ TElementList *ElementList = new TElementList();
+
+ LoadDGM(DGMXYZFILE, NodeList, ElementList, 0, 8);
+
+ if (NodeList->size() != 10) printf("Failed\n");
+ else printf("Pass\n");
+
+ delete NodeList;
+ delete ElementList;
+ }
+
+ /////////////////////////////////////////////////
+ // Test von DGM-XYZ ohne Begrenzungspolygon laden
+ /////////////////////////////////////////////////
+
+ {
+ printf ("Test DGM-XYZ ohne Begrenzungspolygon laden: ");
+
+ TNodeList *NodeList = new TNodeList();
+ TElementList *ElementList = new TElementList();
+
+ LoadDGM(DGMXYZFILE2, NodeList, ElementList, 0, 8);
+
+ if (NodeList->size() != 1126) printf("Failed\n");
+ else printf("Pass\n");
+
+ delete NodeList;
+ delete ElementList;
+ }
+
+ /////////////////////////////////////////////////
+ // Test von DGM-XYZ ohne Begrenzungspolygon laden
+ /////////////////////////////////////////////////
+
+ {
+ printf ("Test DGM-XYZ ohne Begrenzungspolygon laden: ");
+
+ TNodeList *NodeList = new TNodeList();
+ TElementList *ElementList = new TElementList();
+
+ LoadDGM(DGMXYZFILE3, NodeList, ElementList, 0, 8);
+
+ if (NodeList->size() != 43332) printf("Failed\n");
+ else printf("Pass\n");
+
+ delete NodeList;
+ delete ElementList;
+ }
+
+ /////////////////////////////////////////////////
+ // Test von DGM-XYZ ohne Begrenzungspolygon laden
+ /////////////////////////////////////////////////
+
+ {
+ printf ("Test DGM-XYZ ohne Begrenzungspolygon laden: ");
+
+ TNodeList *NodeList = new TNodeList();
+ TElementList *ElementList = new TElementList();
+
+ LoadDGM(DGMXYZFILE4, NodeList, ElementList, 0, 8);
+
+ if (NodeList->size() != 98636) printf("Failed\n");
+ else printf("Pass\n");
+
+ delete NodeList;
+ delete ElementList;
+ }
+
+ /////////////////////////////////////////////////
+ // Test von DGM-SHP ohne Begrenzungspolygon laden
+ /////////////////////////////////////////////////
+
+ {
+ printf ("Test DGM-SHP ohne Begrenzungspolygon laden: ");
+
+ TNodeList *NodeList = new TNodeList();
+ TElementList *ElementList = new TElementList();
+
+ LoadDGM(DGMSHPFILE, NodeList, ElementList, 0, 8);
+
+ if (NodeList->size() != 114) printf("Failed\n");
+ else printf("Pass\n");
+
+ delete NodeList;
+ delete ElementList;
+ }
+
////////////////////////////////////////
// Test von Grenze laden
////////////////////////////////////////
@@ -676,7 +683,7 @@
{
printf ("Test Hydraulische Grenze mit Löchern laden: ");
- TXYList *Gebiet = new TXYList();
+ TXYZList *Gebiet = new TXYZList();
LoadGebiet(GRENZEFILE2, Gebiet, 8);
@@ -687,5 +694,51 @@
}
*/
+ /////////////////////////////////////////////////
+ // Test von DGM-SHP mit Begrenzungspolygon laden
+ /////////////////////////////////////////////////
+
+ {
+ printf ("Test DGM-SHP mit Begrenzungspolygon laden: ");
+
+ TNodeList *NodeList = new TNodeList();
+ TElementList *ElementList = new TElementList();
+ TXYZList *XyList = new TXYZList();
+
+ XyList->Add(new TXYZ(349478100, 587483400));
+ XyList->Add(new TXYZ(349478100, 587493600));
+ XyList->Add(new TXYZ(349516400, 587493600));
+ XyList->Add(new TXYZ(349516400, 587483400));
+
+ LoadDGM(DGMSHPFILE2, NodeList, ElementList, XyList, 8);
+
+ if (NodeList->size() != 28287) printf("Failed\n");
+ else printf("Pass\n");
+
+ delete XyList;
+ delete NodeList;
+ delete ElementList;
+ }
+
+ /////////////////////////////////////////////////
+ // Test von DGM-2DM ohne Begrenzungspolygon laden
+ /////////////////////////////////////////////////
+
+ {
+ printf ("Test DGM-2DM ohne Begrenzungspolygon laden: ");
+
+ TNodeList *NodeList = new TNodeList();
+ TElementList *ElementList = new TElementList();
+
+ LoadDGM(DGM2DMFILE, NodeList, ElementList, 0, 8);
+
+ if (NodeList->size() != 1126) printf("Failed\n");
+ else if (ElementList->size() != 2225) printf("Failed\n");
+ else printf("Pass\n");
+
+ delete NodeList;
+ delete ElementList;
+ }
+
printf ("*************************************************************************\n");
}
Modified: trunk/src/test_qhull.cpp
===================================================================
--- trunk/src/test_qhull.cpp 2008-07-03 15:17:24 UTC (rev 100)
+++ trunk/src/test_qhull.cpp 2008-07-10 09:20:12 UTC (rev 101)
@@ -35,17 +35,17 @@
printf ("Test QHull 3 Knoten: ");
// Zuerst ein paar Punkte generieren
- TXY *Xy1 = new TXY(1, 1);
- TXY *Xy2 = new TXY(2, 9);
- TXY *Xy3 = new TXY(3, 5);
+ TXYZ *Xy1 = new TXYZ(1, 1);
+ TXYZ *Xy2 = new TXYZ(2, 9);
+ TXYZ *Xy3 = new TXYZ(3, 5);
- TXYList *XyList = new TXYList();
+ TXYZList *XyList = new TXYZList();
XyList->push_back(Xy1);
XyList->push_back(Xy2);
XyList->push_back(Xy3);
- TXYList* Polygon = new TXYList();
+ TXYZList* Polygon = new TXYZList();
QHull(XyList, Polygon, 8);
if (Polygon->size() != 3) printf("Failed\n");
@@ -62,13 +62,13 @@
printf ("Test QHull 5 Knoten: ");
// Zuerst ein paar Punkte generieren
- TXY *Xy1 = new TXY(1, 1);
- TXY *Xy2 = new TXY(2, 9);
- TXY *Xy3 = new TXY(3, 5);
- TXY *Xy4 = new TXY(2, 4);
- TXY *Xy5 = new TXY(5, 3);
+ TXYZ *Xy1 = new TXYZ(1, 1);
+ TXYZ *Xy2 = new TXYZ(2, 9);
+ TXYZ *Xy3 = new TXYZ(3, 5);
+ TXYZ *Xy4 = new TXYZ(2, 4);
+ TXYZ *Xy5 = new TXYZ(5, 3);
- TXYList *XyList = new TXYList();
+ TXYZList *XyList = new TXYZList();
XyList->push_back(Xy1);
XyList->push_back(Xy2);
@@ -76,7 +76,7 @@
XyList->push_back(Xy4);
XyList->push_back(Xy5);
- TXYList* Polygon = new TXYList();
+ TXYZList* Polygon = new TXYZList();
QHull(XyList, Polygon, 8);
if (Polygon->size() != 3) printf("Failed\n");
@@ -93,13 +93,13 @@
printf ("Test QHull 5 Knoten (Quadrat): ");
// Zuerst ein paar Punkte generieren
- TXY *Xy1 = new TXY(1, 1);
- TXY *Xy2 = new TXY(3, 1);
- TXY *Xy3 = new TXY(3, 3);
- TXY *Xy4 = new TXY(1, 3);
- TXY *Xy5 = new TXY(2, 2);
+ TXYZ *Xy1 = new TXYZ(1, 1);
+ TXYZ *Xy2 = new TXYZ(3, 1);
+ TXYZ *Xy3 = new TXYZ(3, 3);
+ TXYZ *Xy4 = new TXYZ(1, 3);
+ TXYZ *Xy5 = new TXYZ(2, 2);
- TXYList *XyList = new TXYList();
+ TXYZList *XyList = new TXYZList();
XyList->push_back(Xy1);
XyList->push_back(Xy2);
@@ -107,7 +107,7 @@
XyList->push_back(Xy4);
XyList->push_back(Xy5);
- TXYList* Polygon = new TXYList();
+ TXYZList* Polygon = new TXYZList();
QHull(XyList, Polygon, 8);
if (Polygon->size() != 4) printf("Failed\n");
@@ -124,13 +124,13 @@
printf ("Test QHull 5 Knoten (Raute): ");
// Zuerst ein paar Punkte generieren
- TXY *Xy1 = new TXY(1, 1);
- TXY *Xy2 = new TXY(3, 1);
- TXY *Xy3 = new TXY(2, 3);
- TXY *Xy4 = new TXY(0, 3);
- TXY *Xy5 = new TXY(2, 2);
+ TXYZ *Xy1 = new TXYZ(1, 1);
+ TXYZ *Xy2 = new TXYZ(3, 1);
+ TXYZ *Xy3 = new TXYZ(2, 3);
+ TXYZ *Xy4 = new TXYZ(0, 3);
+ TXYZ *Xy5 = new TXYZ(2, 2);
- TXYList *XyList = new TXYList();
+ TXYZList *XyList = new TXYZList();
XyList->push_back(Xy1);
XyList->push_back(Xy2);
@@ -138,7 +138,7 @@
XyList->push_back(Xy4);
XyList->push_back(Xy5);
- TXYList* Polygon = new TXYList();
+ TXYZList* Polygon = new TXYZList();
QHull(XyList, Polygon, 8);
if (Polygon->size() != 4) printf("Failed\n");
Modified: trunk/src/test_tools.cpp
===================================================================
--- trunk/src/test_tools.cpp 2008-07-03 15:17:24 UTC (rev 100)
+++ trunk/src/test_tools.cpp 2008-07-10 09:20:12 UTC (rev 101)
@@ -335,21 +335,21 @@
{
printf ("Test IsInside: ");
- TXYList *XyList = new TXYList();
+ TXYZList *XyList = new TXYZList();
int Alpha1 = IsInside(XyList, 1.0, 1.0);
- XyList->push_back(new TXY(2, 3));
+ XyList->push_back(new TXYZ(2, 3));
int Alpha2 = IsInside(XyList, 2.0, 3.0);
int Alpha3 = IsInside(XyList, 1.0, 1.0);
- XyList->push_back(new TXY(2, 0));
+ XyList->push_back(new TXYZ(2, 0));
int Alpha4 = IsInside(XyList, 2.0, 1.0);
- XyList->push_back(new TXY(0, 0));
- XyList->push_back(new TXY(0, 2));
+ XyList->push_back(new TXYZ(0, 0));
+ XyList->push_back(new TXYZ(0, 2));
int Alpha5 = IsInside(XyList, 1.0, 1.0);
int Alpha6 = IsInside(XyList, 3.0, 3.0);
Modified: trunk/src/test_xy.cpp
===================================================================
--- trunk/src/test_xy.cpp 2008-07-03 15:17:24 UTC (rev 100)
+++ trunk/src/test_xy.cpp 2008-07-10 09:20:12 UTC (rev 101)
@@ -47,7 +47,7 @@
{
printf ("Test XY-Punkte Speicherung: ");
- TXY *Xy = new TXY(999999999, 999999999);
+ TXYZ *Xy = new TXYZ(999999999, 999999999);
if (Xy->X != 999999999 || Xy->Y != 999999999) printf("Failed\n");
else printf("Pass\n");
@@ -62,29 +62,29 @@
{
printf ("Test XY-Punkte: ");
- TXY *P11 = new TXY(1, 1);
- TXY *P12 = new TXY(9, 1);
- TXY *P13 = new TXY(9, 9);
- TXY *P14 = new TXY(1, 9);
- TXY *P15 = new TXY(4, 9);
- TXY *P16 = new TXY(7, 9);
- TXY *P17 = new TXY(7, 7);
+ TXYZ *P11 = new TXYZ(1, 1);
+ TXYZ *P12 = new TXYZ(9, 1);
+ TXYZ *P13 = new TXYZ(9, 9);
+ TXYZ *P14 = new TXYZ(1, 9);
+ TXYZ *P15 = new TXYZ(4, 9);
+ TXYZ *P16 = new TXYZ(7, 9);
+ TXYZ *P17 = new TXYZ(7, 7);
// XSumme = 38, YSumme = 45
// XSumme = 24, YSumme = 25
- TXY *P21 = new TXY(3, 4);
- TXY *P22 = new TXY(7, 4);
- TXY *P23 = new TXY(7, 6);
- TXY *P24 = new TXY(3, 6);
- TXY *P25 = new TXY(4, 5);
+ TXYZ *P21 = new TXYZ(3, 4);
+ TXYZ *P22 = new TXYZ(7, 4);
+ TXYZ *P23 = new TXYZ(7, 6);
+ TXYZ *P24 = new TXYZ(3, 6);
+ TXYZ *P25 = new TXYZ(4, 5);
// XSumme = 62, YSumme = 70
// XSumme = 3, YSumme = 4
- TXY *P31 = new TXY(P21);
+ TXYZ *P31 = new TXYZ(P21);
// Jetzt zwei leere Polylinie/Polygone generieren
- TXYList *PL1 = new TXYList();
- TXYList *PL2 = new TXYList();
+ TXYZList *PL1 = new TXYZList();
+ TXYZList *PL2 = new TXYZList();
// Ein paar Punkte zur ersten Polylinie zuweisen
PL1->push_back(P11);
@@ -105,7 +105,7 @@
// Die zweite Polylinie verdoppeln
// Dabei werden alle Punkte mit verdoppelt
// XSumme = 24, YSumme = 25
- TXYList *PL3 = PL2->Copy();
+ TXYZList *PL3 = PL2->Copy();
// XSumme = 86, YSumme = 95
// Und noch ein Punkt dazu
@@ -116,25 +116,25 @@
int XSumme = 0;
int YSumme = 0;
- for (TXYList::iterator i = PL1->begin(); i != PL1->end(); i++)
+ for (TXYZList::iterator i = PL1->begin(); i != PL1->end(); i++)
{
- TXY* Xy = *i;
+ TXYZ* Xy = *i;
XSumme = XSumme + (int)Xy->X;
YSumme = YSumme + (int)Xy->Y;
}
- for (TXYList::iterator i = PL2->begin(); i != PL2->end(); i++)
+ for (TXYZList::iterator i = PL2->begin(); i != PL2->end(); i++)
{
- TXY* Xy = *i;
+ TXYZ* Xy = *i;
XSumme = XSumme + (int)Xy->X;
YSumme = YSumme + (int)Xy->Y;
}
- for (TXYList::iterator i = PL3->begin(); i != PL3->end(); i++)
+ for (TXYZList::iterator i = PL3->begin(); i != PL3->end(); i++)
{
- TXY* Xy = *i;
+ TXYZ* Xy = *i;
XSumme = XSumme + (int)Xy->X;
YSumme = YSumme + (int)Xy->Y;
@@ -156,21 +156,21 @@
printf ("Test XY-Punkt-Liste: ");
- TXY *P11 = new TXY(1, 1);
- TXY *P12 = new TXY(9, 1);
- TXY *P13 = new TXY(9, 9);
- TXY *P14 = new TXY(1, 9);
- TXY *P15 = new TXY(4, 9);
- TXY *P16 = new TXY(7, 9);
- TXY *P17 = new TXY(7, 7);
+ TXYZ *P11 = new TXYZ(1, 1);
+ TXYZ *P12 = new TXYZ(9, 1);
+ TXYZ *P13 = new TXYZ(9, 9);
+ TXYZ *P14 = new TXYZ(1, 9);
+ TXYZ *P15 = new TXYZ(4, 9);
+ TXYZ *P16 = new TXYZ(7, 9);
+ TXYZ *P17 = new TXYZ(7, 7);
// XSumme = 38, YSumme = 45
// XSumme = 24, YSumme = 25
- TXY *P21 = new TXY(3, 4);
- TXY *P22 = new TXY(7, 4);
- TXY *P23 = new TXY(7, 6);
- TXY *P24 = new TXY(3, 6);
- TXY *P25 = new TXY(4, 5);
+ TXYZ *P21 = new TXYZ(3, 4);
+ TXYZ *P22 = new TXYZ(7, 4);
+ TXYZ *P23 = new TXYZ(7, 6);
+ TXYZ *P24 = new TXYZ(3, 6);
+ TXYZ *P25 = new TXYZ(4, 5);
// XSumme = 62, YSumme = 70
// Jetzt zwei leere PolyliniePolygone generieren
@@ -203,7 +203,7 @@
int Anz1 = 0;
for (unsigned int i=0; i<EPL1->size(); i++)
{
- TXYList *PL = (*EPL1)[i];
+ TXYZList *PL = (*EPL1)[i];
Anz1 = Anz1 + PL->size();
}
@@ -225,7 +225,7 @@
int Anz2 = 0;
for (unsigned int i=0; i<EPL2->size(); i++)
{
- TXYList *PL = (*EPL2)[i];
+ TXYZList *PL = (*EPL2)[i];
Anz2 = Anz2 + PL->size();
}
@@ -243,7 +243,7 @@
// Die erste Polylinie der zweiten Liste ermitteln
TErgebnisPolygon *PL = EPL2->First();
- TXY *XY = (*PL)[0];
+ TXYZ *XY = (*PL)[0];
if (PL->size() != 7) printf("Failed\n");
else if (XY->X != 1) printf("Failed\n");
@@ -258,17 +258,17 @@
PL->SortByXY();
- TXY *XYS1 = (*PL)[2];
- TXY *XYF1 = PL->FindByXY(XYS1->X, XYS1->Y);
+ TXYZ *XYS1 = (*PL)[2];
+ TXYZ *XYF1 = PL->FindByXY(XYS1->X, XYS1->Y);
- TXY *XYS2 = (*PL)[0];
- TXY *XYF2 = PL->FindByXY(XYS2->X, XYS2->Y);
+ TXYZ *XYS2 = (*PL)[0];
+ TXYZ *XYF2 = PL->FindByXY(XYS2->X, XYS2->Y);
- TXY *XYS3 = new TXY(9, 9);
- TXY *XYF3 = PL->FindByXY(XYS3->X, XYS3->Y);
+ TXYZ *XYS3 = new TXYZ(9, 9);
+ TXYZ *XYF3 = PL->FindByXY(XYS3->X, XYS3->Y);
- TXY *XYS4 = new TXY(4, 7);
- TXY *XYF4 = PL->FindByXY(XYS4->X, XYS4->Y);
+ TXYZ *XYS4 = new TXYZ(4, 7);
+ TXYZ *XYF4 = PL->FindByXY(XYS4->X, XYS4->Y);
if (XYF1 == 0) printf("Failed\n");
else if (XYF1->X != XYS1->X) printf("Failed\n");
@@ -296,10 +296,10 @@
printf ("Test Fläche: ");
- TXY *P1 = new TXY(1, 1);
- TXY *P2 = new TXY(9, 1);
- TXY *P3 = new TXY(9, 9);
- TXY *P4 = new TXY(1, 9);
+ TXYZ *P1 = new TXYZ(1, 1);
+ TXYZ *P2 = new TXYZ(9, 1);
+ TXYZ *P3 = new TXYZ(9, 9);
+ TXYZ *P4 = new TXYZ(1, 9);
// Jetzt zwei leere PolyliniePolygone generieren
TErgebnisPolygon *EP = new TErgebnisPolygon(0.0);
@@ -309,11 +309,11 @@
EP->push_back(P2);
EP->push_back(P3);
- double Area1 = EP->Area();
+ long double Area1 = EP->Area();
EP->push_back(P4);
- double Area2 = EP->Area();
+ long double Area2 = EP->Area();
if (fabs(Area1 - 32.0) > 0.001) printf("Failed\n");
else if (fabs(Area2 - 64.0) > 0.001) printf("Failed\n");
@@ -329,7 +329,7 @@
printf ("Test Cut1: ");
- TXYList *ProfilPolygon = new TXYList();
+ TXYZList *ProfilPolygon = new TXYZList();
ProfilPolygon->Add(2816, 5499);
ProfilPolygon->Add(4518, 6061);
@@ -354,7 +354,7 @@
CutProfil2->AddPoint(2682, 4155);
CutProfil2->AddPoint(2687, 2269);
- TXYList *BegrenzungsPolygon = new TXYList();
+ TXYZList *BegrenzungsPolygon = new TXYZList();
BegrenzungsPolygon->Add(2144, 6240);
BegrenzungsPolygon->Add(4147, 5503);
@@ -377,13 +377,13 @@
BegrenzungsPolygon->Add(1616, 3734);
BegrenzungsPolygon->Add(1911, 5122);
- TXYList* NewPolygon1 = BegrenzungsPolygon->Cut(ProfilPolygon, CutProfil1);
+ TXYZList* NewPolygon1 = BegrenzungsPolygon->Cut(ProfilPolygon, CutProfil1);
- TXY* Xy1 = *NewPolygon1->begin();
+ TXYZ* Xy1 = *NewPolygon1->begin();
- TXYList* NewPolygon2 = NewPolygon1->Cut(ProfilPolygon, CutProfil2);
+ TXYZList* NewPolygon2 = NewPolygon1->Cut(ProfilPolygon, CutProfil2);
- TXY* Xy2 = *NewPolygon2->begin();
+ TXYZ* Xy2 = *NewPolygon2->begin();
if (NewPolygon1->size() != 13) printf("Failed\n");
else if (Xy1->X != 2144) printf("Failed\n");
@@ -412,19 +412,19 @@
printf ("Test Cut2: ");
TProfilList* Profile = new TProfilList();
- TXYList *Gebiet = new TXYList();
+ TXYZList *Gebiet = new TXYZList();
LoadGebiet(POLYGONFILE, Gebiet, 8);
LoadProfile(PROFILFILE, Profile, 0, -9999.9, 9999.9, 8);
TProfil* CutProfil = *Profile->begin();
- TXYList* ProfilPolygon = new TXYList();
+ TXYZList* ProfilPolygon = new TXYZList();
BuildPolygon(Profile, ProfilPolygon, 8);
- TXYList* NewPolygon = Gebiet->Cut(ProfilPolygon, CutProfil);
+ TXYZList* NewPolygon = Gebiet->Cut(ProfilPolygon, CutProfil);
- TXY* Xy = *NewPolygon->begin();
+ TXYZ* Xy = *NewPolygon->begin();
if (NewPolygon->size() != 20) printf("Failed\n");
else if (Xy->X != 32485) printf("Failed\n");
Modified: trunk/src/tools.cpp
===================================================================
--- trunk/src/tools.cpp 2008-07-03 15:17:24 UTC (rev 100)
+++ trunk/src/tools.cpp 2008-07-10 09:20:12 UTC (rev 101)
@@ -20,7 +20,11 @@
#include <stdio.h>
#include <stdlib.h>
-//#include <mem.h>
+#ifdef __BORLANDC__
+#include <mem.h>
+#else
+#include <string.h>
+#endif
#include <stdarg.h>
#include <sys/timeb.h>
@@ -786,6 +790,8 @@
{
long double cp = CrossProduct(X1, Y1, X2, Y2, X3, Y3);
+// write_fortschritt("CP = %lf\n", cp);
+
if (cp != 0.0)
{
long double n1Sq = X1 * X1 + Y1 * Y1;
@@ -811,16 +817,19 @@
if (CR1 - CR2 < -0.2 || CR1 - CR2 > 0.2)
{
+ write_fortschritt("CR1 = %lf CR2 = %lf CR3=%lf\n", CR1, CR2, CR3);
dump_error(__FILE__, __LINE__, "Die Genauigkeit der Radien ist nicht gegeben.\n");
}
if (CR1 - CR3 < -0.2 || CR1 - CR3 > 0.2)
{
+ write_fortschritt("CR1 = %lf CR2 = %lf CR3=%lf\n", CR1, CR2, CR3);
dump_error(__FILE__, __LINE__, "Die Genauigkeit der Radien ist nicht gegeben.\n");
}
if (CR2 - CR3 < -0.2 || CR2 - CR3 > 0.2)
{
+ write_fortschritt("CR1 = %lf CR2 = %lf CR3=%lf\n", CR1, CR2, CR3);
dump_error(__FILE__, __LINE__, "Die Genauigkeit der Radien ist nicht gegeben.\n");
}
@@ -1027,7 +1036,7 @@
}
//---------------------------------------------------------------------------
-void BuildPolygon(TProfilList *ProfilList, TXYList *Polygon, int DebugLevel)
+void BuildPolygon(TProfilList *ProfilList, TXYZList *Polygon, int DebugLevel)
{
write_fortschritt ("->Erzeugung des Begrenzungspolygons gestartet\n");
@@ -1038,7 +1047,7 @@
Polygon->Clear();
- TXYList* XyList = new TXYList();
+ TXYZList* XyList = new TXYZList();
for (TProfilList::iterator i = ProfilList->begin(); i != ProfilList->end(); i++)
{
@@ -1119,9 +1128,9 @@
if (DebugLevel >= 9)
{
write_fortschritt("Polygon:\n");
- for (TXYList::iterator j = Polygon->begin(); j != Polygon->end(); j++)
+ for (TXYZList::iterator j = Polygon->begin(); j != Polygon->end(); j++)
{
- TXY* Xy = *j;
+ TXYZ* Xy = *j;
write_fortschritt("%.3f %.3f\n", Xy->X, Xy->Y);
}
}
@@ -1591,15 +1600,15 @@
}
// Es ist nicht wichtig, wie gross der Startsuchradius ist,
- // solange er nicht zu gross ist und gleich sehr viele Knozen gefunden werden
- // 100.0 entspricht 1 m
+ // solange er nicht zu gross ist und gleich sehr viele Knozen gefunden werden
+ // 100.0 entspricht 100 cm = 1 m
double Radius = 100.0;
TNodeList* StartNodeList = 0;
do
{
StartNodeList = NodeList->FindAllByXY(X, Y, Radius);
- Radius = Radius * 2.0;
- if (DebugLevel >= 9) write_fortschritt("Suchradius ist %.1f\n", Radius);
+ Radius = Radius * 2.0;
+ if (DebugLevel >= 9) write_fortschritt("Suchradius ist %.0f\n", Radius);
} while (StartNodeList->size() == 0);
///////////////////////////////////////////////////////////
@@ -1607,13 +1616,13 @@
///////////////////////////////////////////////////////////
TNode* NearestNode = 0;
- double NearestDistance = 0.0;
+ long double NearestDistance = 0.0;
for (TNodeList::iterator i = StartNodeList->begin(); i != StartNodeList->end(); i++)
{
TNode* Node = *i;
// Das sqrt könnte man sich schenken, da es nur darum geht den dichtesten zu finden
- double Distance = sqrt((X - Node->X) * (X - Node->X) + (Y - Node->Y) * (Y - Node->Y));
+ long double Distance = sqrt((X - Node->X) * (X - Node->X) + (Y - Node->Y) * (Y - Node->Y));
if (NearestNode == 0 || Distance < NearestDistance)
{
NearestDistance = Distance;
@@ -2066,8 +2075,8 @@
long double SDy = S1y - S0y;
long double Lambda = 0.0;
- double Px = 0.0;
- double Py = 0.0;
+ long double Px = 0.0;
+ long double Py = 0.0;
if (PDx == 0 && PDy == 0)
{
@@ -2170,19 +2179,19 @@
Py = P0y + Lambda * PDy;
}
- double LambdaP = 0.0;
+ long double LambdaP = 0.0;
if (PDx != 0) LambdaP = (Px - P0x) / PDx;
else LambdaP = (Py - P0y) / PDy;
- double LambdaS = 0.0;
+ long double LambdaS = 0.0;
if (SDx != 0) LambdaS = (Px - S0x) / SDx;
else LambdaS = (Py - S0y) / SDy;
- double TPX = P0x + LambdaP * PDx;
- double TPY = P0y + LambdaP * PDy;
+ long double TPX = P0x + LambdaP * PDx;
+ long double TPY = P0y + LambdaP * PDy;
- double TSX = S0x + LambdaS * SDx;
- double TSY = S0y + LambdaS * SDy;
+ long double TSX = S0x + LambdaS * SDx;
+ long double TSY = S0y + LambdaS * SDy;
if (fabs(TPX - Px) > 0.1)
{
@@ -2217,8 +2226,8 @@
}
- *x = Px;
- *y = Py;
+ *x = (double)Px;
+ *y = (double)Py;
if (LambdaP < 0.0 || LambdaP > 1.0) return (false);
if (LambdaS < 0.0 || LambdaS > 1.0) return (false);
@@ -2227,7 +2236,7 @@
}
//---------------------------------------------------------------------
-bool CalcProfilSchnitt (long P0x, long P0y, long P1x, long P1y, TProfilList *ProfilList, double *x, double *y, double *meter)
+bool CalcProfilSchnitt (long P0x, long P0y, long P1x, long P1y, TProfilList *ProfilList, double *x, double *y, double *z, double *meter)
{
long PDx = P1x - P0x;
long PDy = P1y - P0y;
@@ -2277,12 +2286,13 @@
if (Found)
{
- double Lambda = 0.0;
+ long double Lambda = 0.0;
if (PDx != 0) Lambda = (*x - P0x) / PDx;
else if (PDy != 0) Lambda = (*y - P0y) / PDy;
else dump_error(__FILE__, __LINE__, "Profil-Punktabstand (%.3f %.3f) - (%.3f %.3f) ist zu klein\n", P0x / 100.0, P0y / 100.0, P1x / 100.0, P1y / 100.0);
- *meter = S0->Meter + Lambda * (S1->Meter - S0->Meter);
+ *meter = (double)(S0->Meter + Lambda * (S1->Meter - S0->Meter));
+ *z = (double)(S0->Z + Lambda * (S1->Z - S0->Z));
return (true);
}
@@ -2377,7 +2387,7 @@
return (false);
}
//---------------------------------------------------------------------------
-bool FindNextChangeEdge(TEdge **edge, TNode **node, TXYList *PunktList)
+bool FindNextChangeEdge(TEdge **edge, TNode **node, TXYZList *PunktList)
{
do
{
@@ -2390,7 +2400,7 @@
long X = (*node)->X;
long Y = (*node)->Y;
- TXY *XY = new TXY(X, Y);
+ TXYZ *XY = new TXYZ(X, Y);
PunktList->Add(XY);
if (false == OnBoundary)
@@ -2772,7 +2782,7 @@
long X = Edge->X;
long Y = Edge->Y;
- TXY *XY = new TXY(X, Y);
+ TXYZ *XY = new TXYZ(X, Y);
ErgebnisPolygon->Add(XY);
long Ox = X;
@@ -2785,13 +2795,13 @@
X = Edge->X;
Y = Edge->Y;
- TXY *XY = new TXY(X, Y);
+ TXYZ *XY = new TXYZ(X, Y);
ErgebnisPolygon->Add(XY);
FoundChangeEdge = FindNextChangeEdge (&Edge, &Node, ErgebnisPolygon);
}
- XY = new TXY(Ox, Oy);
+ XY = new TXYZ(Ox, Oy);
ErgebnisPolygon->Add(XY);
ErgebnisPolygone->push_back(ErgebnisPolygon);
Modified: trunk/src/tools.h
===================================================================
--- trunk/src/tools.h 2008-07-03 15:17:24 UTC (rev 100)
+++ trunk/src/tools.h 2008-07-10 09:20:12 UTC (rev 101)
@@ -80,9 +80,9 @@
double TwoToWin (double x0, double y0, double x1, double y1);
double ThreeToWin (double x0, double y0, double x1, double y1, double x2, double y2, int turn);
bool Calc2Schnitt (long P0x, long P0y, long P1x, long P1y, long S0x, long S0y, long S1x, long S1y, double *x, double *y);
-bool CalcProfilSchnitt (long P0x, long P0y, long P1x, long P1y, TProfilList *ProfilList, double *x, double *y, double *meter);
+bool CalcProfilSchnitt (long P0x, long P0y, long P1x, long P1y, TProfilList *ProfilList, double *x, double *y, double *z, double *meter);
void InterpolateWsp(TProfilList *ProfilList, TProfilList *WspProfilList, int DebugLevel);
-void BuildPolygon(TProfilList *ProfilList, TXYList *XyList, int DebugLevel);
+void BuildPolygon(TProfilList *ProfilList, TXYZList *XyList, int DebugLevel);
void EqualizeProfil(TProfil *ProfilOne, TProfil *ProfilTwo);
void CheckForDuplicates(TNodeList *NodeList, TElementList *ElementList, int DebugLevel);
void BuildEdgeList(TNodeList* NodeList, TElementList* ElementList, TEdgeList* EdgeList, int DebugLevel);
@@ -109,7 +109,7 @@
}
// Der letzte Punkt wird so zum ersten Punkt
- TXY *Xy = (*p)[AnzPoints-1];
+ TXYZ *Xy = (*p)[AnzPoints-1];
double ax = Xy->X;
double ay = Xy->Y;
@@ -123,7 +123,7 @@
int alpha = 0;
for (unsigned int i = 0; i < AnzPoints; i++)
{
- TXY *Xy = (*p)[i];
+ TXYZ *Xy = (*p)[i];
double bx = Xy->X;
double by = Xy->Y;
Modified: trunk/src/tri.cpp
===================================================================
--- trunk/src/tri.cpp 2008-07-03 15:17:24 UTC (rev 100)
+++ trunk/src/tri.cpp 2008-07-10 09:20:12 UTC (rev 101)
@@ -114,7 +114,7 @@
CircumCircle(Node1->X, Node1->Y, Node2->X, Node2->Y, SX, SY, &cx, &cy, &cr);
- FoundNodeList = NodeList->FindAllByXY(cx, cy, sqrt(cr) + 0.001);
+ FoundNodeList = NodeList->FindAllByXY((double)cx, (double)cy, (double)(sqrt(cr) + 0.001));
FoundAnz = 0;
TNodeList::iterator i = FoundNodeList->begin();
@@ -180,8 +180,8 @@
long X = Node->X;
long Y = Node->Y;
- double Dx = cx - X;
- double Dy = cy - Y;
+ double Dx = (double)cx - X;
+ double Dy = (double)cy - Y;
// Liegt er im Umkreis ?
if (Dx * Dx + Dy * Dy < cr - 0.01)
@@ -201,7 +201,7 @@
// Die beiden Knoten sind gleich oder wenigstens fast gleich gut
// Dann hilft nur eine andere Art der Unterscheidung
- double CP = CrossProduct(Node1->X, Node1->Y, NewNode->X, NewNode->Y, Node->X, Node->Y);
+ long double CP = CrossProduct(Node1->X, Node1->Y, NewNode->X, NewNode->Y, Node->X, Node->Y);
if (CP < 0.0000001)
{
@@ -297,7 +297,7 @@
}
//---------------------------------------------------------------------
-bool Triangulate(TNodeList *NodeList, TElementList *ElementList, TXYList* BegrenzungsPolygon, int DebugLevel)
+bool Triangulate(TNodeList *NodeList, TElementList *ElementList, TXYZList* BegrenzungsPolygon, int DebugLevel)
{
write_fortschritt("->Triangulierung der Knoten gestartet\n");
Modified: trunk/src/tri.h
===================================================================
--- trunk/src/tri.h 2008-07-03 15:17:24 UTC (rev 100)
+++ trunk/src/tri.h 2008-07-10 09:20:12 UTC (rev 101)
@@ -22,7 +22,7 @@
typedef enum { SUNDEFINED, SLEFT, SRIGHT, SUNIVERSE } TSide;
//---------------------------------------------------------------------------
-bool Triangulate(TNodeList *NodeList, TElementList *ElementList, TXYList* Begrenzungspolygon, int DebugLevel);
+bool Triangulate(TNodeList *NodeList, TElementList *ElementList, TXYZList* Begrenzungspolygon, int DebugLevel);
//---------------------------------------------------------------------------
#endif
Modified: trunk/src/wsplgen.cpp
===================================================================
--- trunk/src/wsplgen.cpp 2008-07-03 15:17:24 UTC (rev 100)
+++ trunk/src/wsplgen.cpp 2008-07-10 09:20:12 UTC (rev 101)
@@ -14,8 +14,8 @@
//
// 0 Keine Debug Informationen
// 1 Kurze Zwischeninformationen und mehr Fortschrittanzeigen
-// 2 Mehr Zwischeninformationen und mehr Fortschrittanzeigen
-// 3 Noch mehr Zwischeninformationen
+// 2 Mehr Zwischeninformationen und mehr Fortschrittanzeigen und erste Zwischenergebnis-Dateien
+// 3 Noch mehr Zwischeninformationen und mehr Zwischenergebnis-Dateien
// 4 Nur die wichtigsten Testausgabedateien
// 5 Alle wichtigen Testausgabedateien
// 6 Auch ein paar unwichtige Testausgaben
@@ -91,7 +91,7 @@
TProfilList *Rohre2List = new TProfilList();
// Hier wird das aktuelle Begrenzungspolygon drin verwaltet
- TXYList* BegrenzungsPolygon = new TXYList();
+ TXYZList* BegrenzungsPolygon = new TXYZList();
// Hier werden dir Knoten des DGM drin verwaltet
// (und an andere Klassen in Form von Pointern ausgeliehen)
@@ -150,20 +150,25 @@
// Jetzt die Gräben und Dämme und Rohre und Gradienten einlesen, wenn es notwendig ist
if (Parameter.IsSetLin)
{
- LoadLinien(Parameter.FileNameLin, SperrenList, GrabenList, Rohre1List, Rohre2List, Parameter.DebugLevel);
+ for (TStringList::iterator i = Parameter.FileNamesLin.begin(); i != Parameter.FileNamesLin.end(); i++)
+ {
+ std::string FileNameLin = *i;
+
+ LoadLinien(FileNameLin, SperrenList, GrabenList, Rohre1List, Rohre2List, Parameter.DebugLevel);
+ }
}
// Jetzt ein Polygon einlesen oder aus den Profilen bilden
if (Parameter.IsSetGebiet)
{
- TXYList* Tmp1BegrenzungsPolygon = new TXYList();
+ TXYZList* Tmp1BegrenzungsPolygon = new TXYZList();
LoadGebiet(Parameter.FileNameGebiet, Tmp1BegrenzungsPolygon, Parameter.DebugLevel);
- TXYList* ProfilPolygon = new TXYList();
+ TXYZList* ProfilPolygon = new TXYZList();
BuildPolygon(ProfilList, ProfilPolygon, Parameter.DebugLevel);
TProfil* FirstProfil = *ProfilList->begin();
- TXYList* Tmp2BegrenzungsPolygon = Tmp1BegrenzungsPolygon->Cut(ProfilPolygon, FirstProfil);
+ TXYZList* Tmp2BegrenzungsPolygon = Tmp1BegrenzungsPolygon->Cut(ProfilPolygon, FirstProfil);
TProfil* LastProfil = *ProfilList->rbegin();
BegrenzungsPolygon = Tmp2BegrenzungsPolygon->Cut(ProfilPolygon, LastProfil);
@@ -184,7 +189,7 @@
if (BegrenzungsPolygon->size() > 2)
{
std::string PolygonFileName = ExchangeFileExt(Parameter.FileNameAusgabe, "_begrenzungspolygon.shp");
- SavePolygon(PolygonFileName, BegrenzungsPolygon, Parameter.DebugLevel);
+ if (Parameter.DebugLevel > 2) SavePolygon(PolygonFileName, BegrenzungsPolygon, Parameter.DebugLevel);
}
LoadDGM(Parameter.FileNameDgm, NodeList, ElementList, BegrenzungsPolygon, Parameter.DebugLevel);
@@ -258,14 +263,14 @@
// Mal wieder Zwischenergebnisse produzieren
std::string ProfilFileName = ExchangeFileExt(Parameter.FileNameAusgabe, "_interpolierte_profile.shp");
- SaveProfile(ProfilFileName, ProfilList, Parameter.DebugLevel);
+ if (Parameter.DebugLevel > 1) SaveProfile(ProfilFileName, ProfilList, Parameter.DebugLevel);
// Jetzt die Wasserstände der Profile übertragen
TransferWsp(ProfilList, NodeList, GewaesserAchseList, SperrenList, NassNodeList, Parameter.Sperre, Parameter.DebugLevel);
// Mal wieder Zwischenergebnisse produzieren
std::string StartKnotenFileName = ExchangeFileExt(Parameter.FileNameAusgabe, "_startknoten.shp");
- SaveNodes(StartKnotenFileName, NassNodeList, Parameter.DebugLevel);
+ if (Parameter.DebugLevel > 2) SaveNodes(StartKnotenFileName, NassNodeList, Parameter.DebugLevel);
NassNodeList->clear(); // Es waren nur geliehene Knoten
delete NassNodeList;
NassNodeList = 0;
@@ -344,7 +349,7 @@
write_fortschritt("<-Freigeben des Speichers der Kanten beendet\n");
std::string ElementeFileName = ExchangeFileExt(Parameter.FileNameAusgabe, "_elemente.shp");
- SaveElements(ElementeFileName, ElementList, Parameter.Von, Parameter.DebugLevel);
+ if (Parameter.DebugLevel > 2) SaveElements(ElementeFileName, ElementList, Parameter.Von, Parameter.DebugLevel);
if (Parameter.IsSetSaveSol)
{
@@ -363,7 +368,7 @@
NodeList->SortByNr();
std::string KnotenFileName = ExchangeFileExt(Parameter.FileNameAusgabe, "_knoten.shp");
- SaveNodes(KnotenFileName, NodeList, Parameter.DebugLevel);
+ if (Parameter.DebugLevel > 2) SaveNodes(KnotenFileName, NodeList, Parameter.DebugLevel);
// Speichern der Ergebnispolygone
SavePolygone(Parameter.FileNameAusgabe, ErgebnisPolygone, Parameter.DebugLevel);
Modified: trunk/src/wsplgen.h
===================================================================
--- trunk/src/wsplgen.h 2008-07-03 15:17:24 UTC (rev 100)
+++ trunk/src/wsplgen.h 2008-07-10 09:20:12 UTC (rev 101)
@@ -10,4 +10,8 @@
// Read the file COPYING coming with WSPLGEN for details.
//
-const char Version[] = "1.2.0";
+const char Version[] = "1.2.1";
+
+// In der Datei wsplgen.h wird jetzt keine Historie mehr gespeichert.
+// Diese ist nun in der Datei NEWS zu finden
+
Modified: trunk/src/xy.cpp
===================================================================
--- trunk/src/xy.cpp 2008-07-03 15:17:24 UTC (rev 100)
+++ trunk/src/xy.cpp 2008-07-10 09:20:12 UTC (rev 101)
@@ -30,17 +30,19 @@
//---------------------------------------------------------------------
//---------------------------------------------------------------------
-TXY::TXY(long x, long y)
+TXYZ::TXYZ(long x, long y, int z)
{
X = x;
Y = y;
+ Z = z;
}
//---------------------------------------------------------------------
-TXY::TXY(TXY *xy)
+TXYZ::TXYZ(TXYZ *xy)
{
X = xy->X;
Y = xy->Y;
+ Z = xy->Z;
}
//---------------------------------------------------------------------
@@ -48,28 +50,18 @@
//---------------------------------------------------------------------
//---------------------------------------------------------------------
-TNode::TNode(int nr, long x, long y, int z) : TXY (x, y)
+TNode::TNode(int nr, long x, long y, int z, int wsp) : TXYZ (x, y, z)
{
Nr = nr;
Z = z;
- Wsp = NoWsp;
- EdgeIndex = 0;
-}
-
-//---------------------------------------------------------------------
-TNode::TNode(int nr, long x, long y, int z, int wsp) : TXY (x, y)
-{
- Nr = nr;
- Z = z;
Wsp = wsp;
EdgeIndex = 0;
}
//---------------------------------------------------------------------
-TNode::TNode(TNode *node) : TXY (node->X, node->Y)
+TNode::TNode(TNode *node) : TXYZ (node->X, node->Y, node->Z)
{
Nr = node->Nr;
- Z = node->Z;
Wsp = node->Wsp;
EdgeIndex = 0;
}
@@ -166,16 +158,14 @@
//---------------------------------------------------------------------
//---------------------------------------------------------------------
-TPoint::TPoint(long x, long y, int z, int meter) : TXY (x, y)
+TPoint::TPoint(long x, long y, int z, int meter) : TXYZ (x, y, z)
{
- Z = z;
Meter = meter;
}
//---------------------------------------------------------------------
-TPoint::TPoint(TPoint *point) : TXY (point->X, point->Y)
+TPoint::TPoint(TPoint *point) : TXYZ (point->X, point->Y, point->Z)
{
- Z = point->Z;
Meter = point->Meter;
}
@@ -217,11 +207,11 @@
}
//---------------------------------------------------------------------
-// TXYList
+// TXYZList
//---------------------------------------------------------------------
//---------------------------------------------------------------------------
-TXYList::TXYList(void)
+TXYZList::TXYZList(void)
{
QuadTree = 0;
MinX = 0;
@@ -231,7 +221,7 @@
}
//---------------------------------------------------------------------------
-TXYList::~TXYList(void)
+TXYZList::~TXYZList(void)
{
if (QuadTree) delete QuadTree;
QuadTree = 0;
@@ -240,11 +230,11 @@
}
//---------------------------------------------------------------------
-void TXYList::Clear(void)
+void TXYZList::Clear(void)
{
for (unsigned int i=0; i<size(); i++)
{
- TXY *Xy = (*this)[i];
+ TXYZ *Xy = (*this)[i];
delete Xy;
Xy = 0;
}
@@ -257,14 +247,14 @@
}
//---------------------------------------------------------------------
-TXYList* TXYList::Copy(void)
+TXYZList* TXYZList::Copy(void)
{
- TXYList *NewXyList = new TXYList;
+ TXYZList *NewXyList = new TXYZList;
for (unsigned int i=0; i<size(); i++)
{
- TXY *OldXy = (*this)[i];
- TXY *NewXy = new TXY(OldXy);
+ TXYZ *OldXy = (*this)[i];
+ TXYZ *NewXy = new TXYZ(OldXy);
NewXyList->push_back(NewXy);
}
NewXyList->MinX = MinX;
@@ -276,16 +266,16 @@
}
//---------------------------------------------------------------------
-void TXYList::SortByXY(void)
+void TXYZList::SortByXY(void)
{
write_fortschritt("->Sortieren der Punkte gestartet\n");
if (QuadTree) delete QuadTree;
- QuadTree = new TQuadTree<TXYList, TXY>();
+ QuadTree = new TQuadTree<TXYZList, TXYZ>();
for (iterator i = begin(); i != end(); i++)
{
- TXY* Xy = *i;
+ TXYZ* Xy = *i;
QuadTree->Insert(MinX, MaxX, MinY, MaxY, Xy);
}
@@ -293,11 +283,11 @@
}
//---------------------------------------------------------------------
-TXY* TXYList::FindByXY(long X, long Y)
+TXYZ* TXYZList::FindByXY(long X, long Y)
{
if (size() <= 0) return (0);
- TXY* Xy = QuadTree->Search(X, Y, MinX, MaxX, MinY, MaxY);
+ TXYZ* Xy = QuadTree->Search(X, Y, MinX, MaxX, MinY, MaxY);
if (Xy)
{
@@ -331,7 +321,7 @@
}
//---------------------------------------------------------------------
-TInsideTyp TXYList::IsInsideXYList(long X, long Y)
+TInsideTyp TXYZList::IsInsideXYList(long X, long Y)
{
if (X < MinX || X > MaxX || Y < MinY || Y > MaxY) return (NOT_INSIDE);
@@ -358,43 +348,43 @@
}
//---------------------------------------------------------------------
-void TXYList::Add(TXY *Xy)
+void TXYZList::Add(TXYZ *Xyz)
{
- push_back(Xy);
+ push_back(Xyz);
if (size() == 1)
{
- MinX = Xy->X;
- MaxX = Xy->X;
- MinY = Xy->Y;
- MaxY = Xy->Y;
+ MinX = Xyz->X;
+ MaxX = Xyz->X;
+ MinY = Xyz->Y;
+ MaxY = Xyz->Y;
}
else
{
- if (MinX > Xy->X) MinX = Xy->X;
- if (MaxX < Xy->X) MaxX = Xy->X;
- if (MinY > Xy->Y) MinY = Xy->Y;
- if (MaxY < Xy->Y) MaxY = Xy->Y;
+ if (MinX > Xyz->X) MinX = Xyz->X;
+ if (MaxX < Xyz->X) MaxX = Xyz->X;
+ if (MinY > Xyz->Y) MinY = Xyz->Y;
+ if (MaxY < Xyz->Y) MaxY = Xyz->Y;
}
}
//---------------------------------------------------------------------
-void TXYList::Add(long X, long Y)
+void TXYZList::Add(long X, long Y, int Z)
{
- TXY *Xy = new TXY(X, Y);
- Add(Xy);
+ TXYZ *Xyz = new TXYZ(X, Y, Z);
+ Add(Xyz);
}
//---------------------------------------------------------------------
-TXYList* TXYList::Cut(TXYList* ProfilPolygon, TProfil* CutProfil)
+TXYZList* TXYZList::Cut(TXYZList* ProfilPolygon, TProfil* CutProfil)
{
write_fortschritt("->Beschneiden des Begrenzungspolygon gestartet\n");
write_fortschritt("Beschneidung mit Profil %.4f\n", CutProfil->Station / 10000.0);
// Zuerst (wenn notwendig )den ersten Punkt am Ende hinzufügen
- TXY* XyFirst = *begin();
- TXY* XyLast = *rbegin();
+ TXYZ* XyFirst = *begin();
+ TXYZ* XyLast = *rbegin();
if (XyFirst->X != XyLast->X || XyFirst->Y != XyLast->Y)
{
@@ -402,7 +392,7 @@
}
// Jetzt das CutProfil verlängern, damit es wirklich zwei Schnittpunkte gibt
- TXYList* CutXyList = new TXYList();
+ TXYZList* CutXyList = new TXYZList();
long X = 0;
long Y = 0;
@@ -424,23 +414,23 @@
int After0 = -1;
long X0 = FPoint->X;
long Y0 = FPoint->Y;
- double SX0 = 0;
- double SY0 = 0;
- double D00 = 0.0;
- double D01 = 0.0;
+ long double SX0 = 0;
+ long double SY0 = 0;
+ long double D00 = 0.0;
+ long double D01 = 0.0;
int After1 = -1;
long X1 = LPoint->X;
long Y1 = LPoint->Y;
- double SX1 = 0;
- double SY1 = 0;
- double D10 = 0.0;
- double D11 = 0.0;
+ long double SX1 = 0;
+ long double SY1 = 0;
+ long double D10 = 0.0;
+ long double D11 = 0.0;
- TXY* Xy0 = 0;
- TXY* Xy1 = 0;
+ TXYZ* Xy0 = 0;
+ TXYZ* Xy1 = 0;
int Index = 0;
- for (TXYList::iterator i=begin(); i != end(); i++, Index++)
+ for (TXYZList::iterator i=begin(); i != end(); i++, Index++)
{
Xy0 = Xy1;
Xy1 = *i;
@@ -455,12 +445,12 @@
continue;
}
- TXY* CutXy0 = 0;
- TXY* CutXy1 = 0;
+ TXYZ* CutXy0 = 0;
+ TXYZ* CutXy1 = 0;
bool Schnitt = false;
double SX = 0;
double SY = 0;
- for (TXYList::iterator j=CutXyList->begin(); j != CutXyList->end(); j++)
+ for (TXYZList::iterator j=CutXyList->begin(); j != CutXyList->end(); j++)
{
CutXy0 = CutXy1;
CutXy1 = *j;
@@ -471,8 +461,8 @@
if (Schnitt)
{
- double D0 = (SX - X0) * (SX - X0) + (SY - Y0) * (SY - Y0);
- double D1 = (SX - X1) * (SX - X1) + (SY - Y1) * (SY - Y1);
+ long double D0 = (SX - X0) * (SX - X0) + (SY - Y0) * (SY - Y0);
+ long double D1 = (SX - X1) * (SX - X1) + (SY - Y1) * (SY - Y1);
if (After0 == -1 && After1 == -1)
{
@@ -607,13 +597,13 @@
if (After0 == -1 && After1 == -1)
{
- TXYList* SideZero = new TXYList();
+ TXYZList* SideZero = new TXYZList();
- TXYList::iterator iter=begin();
+ TXYZList::iterator iter=begin();
unsigned int i = 0;
while (i < size())
{
- TXY *Xy = *iter++;
+ TXYZ *Xy = *iter++;
SideZero->Add(Xy->X, Xy->Y);
@@ -635,8 +625,8 @@
if (After0 > After1)
{
int TempAfter = After0;
- double TempSX = SX0;
- double TempSY = SY0;
+ long double TempSX = SX0;
+ long double TempSY = SY0;
After0 = After1;
SX0 = SX1;
@@ -647,14 +637,14 @@
SY1 = TempSY;
}
- TXYList* SideZero = new TXYList();
- TXYList* SideOne = new TXYList();
+ TXYZList* SideZero = new TXYZList();
+ TXYZList* SideOne = new TXYZList();
- TXYList::iterator iter=begin();
+ TXYZList::iterator iter=begin();
unsigned int i = 0;
while (i < (unsigned int)After0)
{
- TXY *Xy = *iter++;
+ TXYZ *Xy = *iter++;
SideZero->Add(Xy->X, Xy->Y);
@@ -669,7 +659,7 @@
while (i < (unsigned int)After1)
{
- TXY *Xy = *iter++;
+ TXYZ *Xy = *iter++;
SideOne->Add(Xy->X, Xy->Y);
@@ -684,7 +674,7 @@
while (i < size())
{
- TXY *Xy = *iter++;
+ TXYZ *Xy = *iter++;
SideZero->Add(Xy->X, Xy->Y);
@@ -695,7 +685,7 @@
write_fortschritt("\n");
int Count = 0;
- for (TXYList::iterator i=SideZero->begin(); i != SideZero->end(); i++)
+ for (TXYZList::iterator i=SideZero->begin(); i != SideZero->end(); i++)
{
TXY* Xy = *i;
@@ -704,7 +694,7 @@
write_fortschritt("\n");
Count = 0;
- for (TXYList::iterator i=SideOne->begin(); i != SideOne->end(); i++)
+ for (TXYZList::iterator i=SideOne->begin(); i != SideOne->end(); i++)
{
TXY* Xy = *i;
@@ -720,26 +710,26 @@
// 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++)
+ for (TXYZList::iterator i=SideZero->begin(); i != SideZero->end(); i++)
{
- TXY* Xy = *i;
+ TXYZ* Xy = *i;
if (ProfilPolygon->IsInsideXYList(Xy->X, Xy->Y)) IsInsideZeroCount++;
}
int IsInsideOneCount = 0;
- for (TXYList::iterator i=SideOne->begin(); i != SideOne->end(); i++)
+ for (TXYZList::iterator i=SideOne->begin(); i != SideOne->end(); i++)
{
- TXY* Xy = *i;
+ TXYZ* 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++)
+ for (TXYZList::iterator i=ProfilPolygon->begin(); i != ProfilPolygon->end(); i++)
{
- TXY* Xy = *i;
+ TXYZ* Xy = *i;
if (SideZero->IsInsideXYList(Xy->X, Xy->Y)) IsInsideZeroCount++;
if (SideOne->IsInsideXYList(Xy->X, Xy->Y)) IsInsideOneCount++;
@@ -1090,9 +1080,10 @@
double DummyX = 0.0;
double DummyY = 0.0;
+ double DummyZ = 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, &DummyZ, &DummyMeter)) continue;
if (Node->X >= X && Node->Y > Y)
{
@@ -1510,7 +1501,7 @@
}
//---------------------------------------------------------------------------
-void TElementList::HelpChangeElements(TNodeList *NodeList, TProfilList *LinienList, int ZWert, int DebugLevel)
+int TElementList::HelpChangeElements(TNodeList *NodeList, TProfilList *LinienList, int DebugLevel)
{
int MaxNodeNr = NodeList->MaxNr;
@@ -1571,29 +1562,39 @@
double XD12 = 0.0;
double YD12 = 0.0;
+ double ZD12 = 0.0;
double XD23 = 0.0;
double YD23 = 0.0;
+ double ZD23 = 0.0;
double XD31 = 0.0;
double YD31 = 0.0;
+ double ZD31 = 0.0;
+
long X12 = 0;
long Y12 = 0;
+ int Z12 = 0;
long X23 = 0;
long Y23 = 0;
+ int Z23 = 0;
long X31 = 0;
long Y31 = 0;
+ int Z31 = 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);
- bool Schnitt31 = CalcProfilSchnitt(Node3->X, Node3->Y, Node1->X, Node1->Y, LinienList, &XD31, &YD31, &dummyMeter);
+ bool Schnitt12 = CalcProfilSchnitt(Node1->X, Node1->Y, Node2->X, Node2->Y, LinienList, &XD12, &YD12, &ZD12, &dummyMeter);
+ bool Schnitt23 = CalcProfilSchnitt(Node2->X, Node2->Y, Node3->X, Node3->Y, LinienList, &XD23, &YD23, &ZD23, &dummyMeter);
+ bool Schnitt31 = CalcProfilSchnitt(Node3->X, Node3->Y, Node1->X, Node1->Y, LinienList, &XD31, &YD31, &ZD31, &dummyMeter);
+
if (Schnitt12)
{
X12 = (long)(XD12 + 0.5);
Y12 = (long)(YD12 + 0.5);
+ Z12 = (int)(ZD12 + 0.5);
TNodeList* FoundNodeList = NodeList->FindAllByXY(X12, Y12, 4);
@@ -1605,17 +1606,17 @@
if (Node1->X == Node->X && Node1->Y == Node->Y)
{
- Node->Z = ZWert;
- Schnitt12 = false;
+ Node->Z = Z12;
+ Schnitt12 = false;
}
else if (Node2->X == Node->X && Node2->Y == Node->Y)
{
- Node->Z = ZWert;
+ Node->Z = Z12;
Schnitt12 = false;
}
else if (Node3->X == Node->X && Node3->Y == Node->Y)
{
- Node->Z = ZWert;
+ Node->Z = Z12;
Schnitt12 = false;
}
@@ -1630,10 +1631,10 @@
if (0 == Node12)
{
- Node12 = new TNode(++MaxNodeNr, X12, Y12, ZWert);
- if(false == NodeList->AddWithQuadTree(Node12))
+ Node12 = new TNode(++MaxNodeNr, X12, Y12, Z12);
+ 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);
}
}
}
@@ -1642,6 +1643,7 @@
{
X23 = (long)(XD23 + 0.5);
Y23 = (long)(YD23 + 0.5);
+ Z23 = (int)(ZD23 + 0.5);
TNodeList* FoundNodeList = NodeList->FindAllByXY(X23, Y23, 4);
@@ -1653,17 +1655,17 @@
if (Node1->X == Node->X && Node1->Y == Node->Y)
{
- Node->Z = ZWert;
+ Node->Z = Z23;
Schnitt23 = false;
}
else if (Node2->X == Node->X && Node2->Y == Node->Y)
{
- Node->Z = ZWert;
+ Node->Z = Z23;
Schnitt23 = false;
}
else if (Node3->X == Node->X && Node3->Y == Node->Y)
{
- Node->Z = ZWert;
+ Node->Z = Z23;
Schnitt23 = false;
}
@@ -1678,7 +1680,7 @@
if (0 == Node23)
{
- Node23 = new TNode(++MaxNodeNr, X23, Y23, ZWert);
+ Node23 = new TNode(++MaxNodeNr, X23, Y23, Z23);
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);
@@ -1690,6 +1692,7 @@
{
X31 = (long)(XD31 + 0.5);
Y31 = (long)(YD31 + 0.5);
+ Z31 = (int)(ZD31 + 0.5);
TNodeList* FoundNodeList = NodeList->FindAllByXY(X31, Y31, 4);
@@ -1701,17 +1704,17 @@
if (Node1->X == Node->X && Node1->Y == Node->Y)
{
- Node->Z = ZWert;
+ Node->Z = Z31;
Schnitt31 = false;
}
else if (Node2->X == Node->X && Node2->Y == Node->Y)
{
- Node->Z = ZWert;
+ Node->Z = Z31;
Schnitt31 = false;
}
else if (Node3->X == Node->X && Node3->Y == Node->Y)
{
- Node->Z = ZWert;
+ Node->Z = Z31;
Schnitt31 = false;
}
@@ -1726,7 +1729,7 @@
if (0 == Node31)
{
- Node31 = new TNode(++MaxNodeNr, X31, Y31, ZWert);
+ Node31 = new TNode(++MaxNodeNr, X31, Y31, Z31);
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);
@@ -1861,6 +1864,8 @@
}
}
write_fortschritt("%d von %d Elemente, %d Elemente angepasst\n", Count, size(), ChangeCount);
+
+ return (ChangeCount);
}
//---------------------------------------------------------------------------
@@ -1925,27 +1930,27 @@
//---------------------------------------------------------------------------
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 (GrabenList && GrabenList->size() > 0)
+ {
+ write_fortschritt("->Anpassung der Elemente an Gräben gestartet\n");
+ HelpChangeElements(NodeList, GrabenList, DebugLevel);
+ write_fortschritt("<-Anpassung der Elemente an Gräben beendet\n");
+ }
+
if (SperrenList && SperrenList->size() > 0)
{
write_fortschritt("->Anpassung der Elemente an Dämme gestartet\n");
- HelpChangeElements(NodeList, SperrenList, DammZ, DebugLevel);
+ HelpChangeElements(NodeList, SperrenList, DebugLevel);
write_fortschritt("<-Anpassung der Elemente an Dämme beendet\n");
}
- if (GrabenList && GrabenList->size() > 0)
- {
- write_fortschritt("->Anpassung der Elemente an Gräben gestartet\n");
- HelpChangeElements(NodeList, GrabenList, GrabenZ, DebugLevel);
- write_fortschritt("<-Anpassung der Elemente an Gräben beendet\n");
- }
-
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");
}
//---------------------------------------------------------------------
@@ -1959,7 +1964,7 @@
}
//---------------------------------------------------------------------
-double TErgebnisPolygon::Area(void)
+long double TErgebnisPolygon::Area(void)
{
if (size() < 3)
{
@@ -1971,22 +1976,22 @@
long double Area = 0.0;
for (unsigned int i = 1; i < size(); i++)
{
- TXY *Xy1 = (*this)[i-1];
+ TXYZ *Xy1 = (*this)[i-1];
double X1 = Xy1->X;
double Y1 = Xy1->Y;
- TXY *Xy2 = (*this)[i];
+ TXYZ *Xy2 = (*this)[i];
double X2 = Xy2->X;
double Y2 = Xy2->Y;
Area = Area + X1 * Y2 - X2 * Y1;
}
- TXY *LastXy = (*this)[size()-1];
+ TXYZ *LastXy = (*this)[size()-1];
double Lx = LastXy->X;
double Ly = LastXy->Y;
- TXY *FirstXy = (*this)[0];
+ TXYZ *FirstXy = (*this)[0];
double Fx = FirstXy->X;
double Fy = FirstXy->Y;
@@ -2032,8 +2037,8 @@
for (unsigned int j=0; j<OldErgebnisPolygon->size(); j++)
{
- TXY *OldXy = (*OldErgebnisPolygon)[j];
- TXY *NewXy = new TXY(OldXy);
+ TXYZ *OldXy = (*OldErgebnisPolygon)[j];
+ TXYZ *NewXy = new TXYZ(OldXy);
NewErgebnisPolygon->push_back(NewXy);
}
@@ -2759,8 +2764,8 @@
write_error(3220, "Kanten-Knotenabstand (%.3f %.3f) - (%.3f %.3f) ist zu klein\n", N0x / 100.0, N0y / 100.0, N1x / 100.0, N1y / 100.0);
}
- double X, Y;
- bool Found = Calc2Schnitt(P0x, P0y, P1x, P1y, N0x, N0y, N1x, N1y, &X, &Y);
+ double DummyX, DummyY;
+ bool Found = Calc2Schnitt(P0x, P0y, P1x, P1y, N0x, N0y, N1x, N1y, &DummyX, &DummyY);
if (Found) return (true);
}
Modified: trunk/src/xy.h
===================================================================
--- trunk/src/xy.h 2008-07-03 15:17:24 UTC (rev 100)
+++ trunk/src/xy.h 2008-07-10 09:20:12 UTC (rev 101)
@@ -36,7 +36,7 @@
const int NotValid = -999999;
//----------------------------------------------------------------------------
-class TXY;
+class TXYZ;
class TNode;
class TPoint;
class TPointCompMeter;
@@ -44,7 +44,7 @@
class TElement;
class TEdge;
class TEdgeIndex;
-class TXYList;
+class TXYZList;
class TErgebnisPolygon;
class TNodeList;
class TElementList;
@@ -70,30 +70,29 @@
// TXY wird für Stützstellen von Polygonen, Knoten und Profilspuren benötigt.
// Hier werden reine X,Y-Koordinaten gespeichert.
//----------------------------------------------------------------------------
-class TXY
+class TXYZ
{
public:
long X;
long Y;
+ int Z;
- TXY(long X, long Y);
- TXY(TXY *Xy);
+ TXYZ(long X, long Y, int Z=0);
+ TXYZ(TXYZ *Xyz);
};
//----------------------------------------------------------------------------
// TNode wird für die Knoten in vermaschten Netzen genutzt
// Die Speicherung erfolgt im Allgemeinen in einer TNodeList
//----------------------------------------------------------------------------
-class TNode : public TXY
+class TNode : public TXYZ
{
public:
int Nr;
- int Z;
int Wsp;
TEdgeIndex *EdgeIndex;
- TNode(int Nr, long X, long Y, int Z);
- TNode(int Nr, long X, long Y, int Z, int Wsp);
+ TNode(int Nr, long X, long Y, int Z, int Wsp = NoWsp);
TNode(TNode *Node);
~TNode(void);
@@ -106,10 +105,9 @@
// TPoint wird für die Stützstellen von Profilspuren und anderen Spuren genutzt,
// die interpoliert oder verdichtet werden sollen.
//----------------------------------------------------------------------------
-class TPoint : public TXY
+class TPoint : public TXYZ
{
public:
- int Z;
int Meter;
TPoint(long X, long Y, int Z, int Meter);
@@ -183,12 +181,12 @@
};
//----------------------------------------------------------------------------
-// TXYList verwaltet die TXY
+// TXYList verwaltet die TXYZ
//----------------------------------------------------------------------------
-class TXYList : public std::vector<TXY *>
+class TXYZList : public std::vector<TXYZ *>
{
private:
- TQuadTree<TXYList, TXY> *QuadTree;
+ TQuadTree<TXYZList, TXYZ> *QuadTree;
public:
long MinX;
@@ -196,17 +194,17 @@
long MinY;
long MaxY;
- TXYList(void);
- ~TXYList(void);
+ TXYZList(void);
+ ~TXYZList(void);
void Clear(void);
- TXYList* Copy(void);
+ TXYZList* Copy(void);
- void Add(TXY *Xy);
- void Add(long X, long Y);
+ void Add(TXYZ *Xyz);
+ void Add(long X, long Y, int Z = 0);
void SortByXY(void);
- TXY* FindByXY(long X, long Y);
+ TXYZ* FindByXY(long X, long Y);
TInsideTyp IsInsideXYList(long X, long Y);
- TXYList* Cut(TXYList* ProfilPolygon, TProfil* CutProfil);
+ TXYZList* Cut(TXYZList* ProfilPolygon, TProfil* CutProfil);
};
//----------------------------------------------------------------------------
@@ -258,14 +256,14 @@
class TElementList : public std::vector<TElement *>
{
private:
- void HelpChangeElements(TNodeList *NodeList, TProfilList *LinienList, int ZWert, int DebugLevel);
+ int HelpChangeElements(TNodeList *NodeList, TProfilList *LinienList, int DebugLevel);
public:
- ~TElementList(void);
- void Clear(void);
- void Add(TElement* Element);
- void ChangeElements(TNodeList* NodeList, TProfilList *SperrenList, TProfilList *BruchList, int DebugLevel);
- void CleanChangedElements(int DebugLevel);
+ ~TElementList(void);
+ void Clear(void);
+ void Add(TElement* Element);
+ void ChangeElements(TNodeList* NodeList, TProfilList *SperrenList, TProfilList *BruchList, int DebugLevel);
+ void CleanChangedElements(int DebugLevel);
};
@@ -310,13 +308,14 @@
//----------------------------------------------------------------------------
// Ein spezielles Polygon zum Speichern der Ergebnispolygone der Nass/Trockenberechnung
//----------------------------------------------------------------------------
-class TErgebnisPolygon : public TXYList
+class TErgebnisPolygon : public TXYZList
{
public:
- double Diff;
+ double Diff;
- TErgebnisPolygon(double Diff);
- double Area(void);
+ TErgebnisPolygon(double Diff);
+
+ long double Area(void);
};
//----------------------------------------------------------------------------
More information about the Wsplgen-commits
mailing list