[Wsplgen-commits] r153 - in trunk: . src
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Fri May 7 18:54:42 CEST 2010
Author: mrchip
Date: 2010-05-07 18:54:36 +0200 (Fri, 07 May 2010)
New Revision: 153
Modified:
trunk/NEWS
trunk/src/file.cpp
trunk/src/file.h
trunk/src/parameter.cpp
trunk/src/parameter.h
trunk/src/test_file.cpp
trunk/src/test_nodes.cpp
trunk/src/test_quadtree.cpp
trunk/src/test_tools.cpp
trunk/src/test_tri.cpp
trunk/src/tools.cpp
trunk/src/tools.h
trunk/src/wsplgen.cpp
trunk/src/wsplgen.h
trunk/src/xy.cpp
trunk/src/xy.h
Log:
Diverse kleine Fehler
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2010-05-07 14:11:12 UTC (rev 152)
+++ trunk/NEWS 2010-05-07 16:54:36 UTC (rev 153)
@@ -10,6 +10,28 @@
// Read the file COPYING coming with WSPLGEN for details.
//
+Version 1.3.6
+
+ - Parameter NOCHECKNET eingeführt, der die Überprüfung des Netzes verhindert
+ (sollte nur bei bereits einmal geprüften Netzen verwendet werden, spart dann aber deutlich Zeit)
+
+ - Die Debug-Ausgabe der Begrenzungspolygone wurde etwas verbessert
+
+ - Die SOl-Ergebnisse werden nun auch mit der (eigentlich überflüssigen) Angabe der Elemente geschrieben,
+ da dies von einigen Programmen vorausgesetzt wird
+
+ - Die Knoten werden jetzt sortiert, bevor die Elemete geschrieben werden,
+ da es durch verschiedene Routinen davor zu einer Unsortierung gekommen sein kann und
+ die Speicherroutine für Elemete sortierte Knoten voraussetzt
+
+ - Das Speichern von 2DM-Netzen wurde korrigiert; die Elemente werden nun lückenlos durchnummeriert
+
+ - Fehler beim Übertragen von initialen Wasserständen auf das Netz wurde korrigiert
+ (bisher konnte ein Profil das ausserhalb des Begrenzungspolygons lag, seine Wasserstände auf
+ das evtl. sehr weit entfernte Bearbeitungsgebiet übertragen)
+
+
+
Version 1.3.5
- Wenn eine Stützstelle eines Profil genau auf der Gewässerachse lag,
Modified: trunk/src/file.cpp
===================================================================
--- trunk/src/file.cpp 2010-05-07 14:11:12 UTC (rev 152)
+++ trunk/src/file.cpp 2010-05-07 16:54:36 UTC (rev 153)
@@ -113,7 +113,7 @@
}
//---------------------------------------------------------------------
-bool LoadDGM(std::string FileName, TNodeList *NodeList, TElementList *ElementList, TXYZList *BegrenzungsPolygon, bool IsSetNoProjWarn, int DebugLevel)
+bool LoadDGM(std::string FileName, TNodeList *NodeList, TElementList *ElementList, TXYZList *BegrenzungsPolygon, bool IsSetNoProjWarn, bool IsSetNoNetCheck, int DebugLevel)
{
write_fortschritt (9, "->Laden des DGM in Datei '%s' gestartet\n", FileName.c_str());
@@ -129,37 +129,37 @@
if (ToUpperCase(Ext) == ".ADF")
{
LoadDGMTIN(FileName, NodeList, ElementList, BegrenzungsPolygon, DebugLevel);
- CheckForDuplicates(NodeList, ElementList, DebugLevel);
+ if (!IsSetNoNetCheck) CheckForDuplicates(NodeList, ElementList, DebugLevel);
}
else if (ToUpperCase(Ext) == ".2DM")
{
LoadDGM2DM(FileName, NodeList, ElementList, BegrenzungsPolygon, DebugLevel);
- CheckForDuplicates(NodeList, ElementList, DebugLevel);
+ if (!IsSetNoNetCheck) CheckForDuplicates(NodeList, ElementList, DebugLevel);
}
else if (ToUpperCase(Ext) == ".GRD" || ToUpperCase(Ext) == ".ASC")
{
LoadDGMGRD(FileName, NodeList, BegrenzungsPolygon, DebugLevel);
- CheckForDuplicates(NodeList, ElementList, DebugLevel);
+ if (!IsSetNoNetCheck) CheckForDuplicates(NodeList, ElementList, DebugLevel);
}
else if (ToUpperCase(Ext) == ".XYZ" || ToUpperCase(Ext) == ".TXT")
{
LoadDGMXYZ(FileName, NodeList, BegrenzungsPolygon, DebugLevel);
- CheckForDuplicates(NodeList, ElementList, DebugLevel);
+ if (!IsSetNoNetCheck) CheckForDuplicates(NodeList, ElementList, DebugLevel);
}
else if (ToUpperCase(Ext) == ".XML")
{
LoadDGMXML(FileName, NodeList, BegrenzungsPolygon, DebugLevel);
- CheckForDuplicates(NodeList, ElementList, DebugLevel);
+ if (!IsSetNoNetCheck) CheckForDuplicates(NodeList, ElementList, DebugLevel);
}
else if (ToUpperCase(Ext) == ".SHP")
{
LoadDGMSHP(FileName, NodeList, BegrenzungsPolygon, IsSetNoProjWarn, DebugLevel);
- CheckForDuplicates(NodeList, ElementList, DebugLevel);
+ if (!IsSetNoNetCheck) CheckForDuplicates(NodeList, ElementList, DebugLevel);
}
else if (ToUpperCase(Ext) == ".TIN")
{
LoadDGMASCIITIN(FileName, NodeList, ElementList, BegrenzungsPolygon, DebugLevel);
- CheckForDuplicates(NodeList, ElementList, DebugLevel);
+ if (!IsSetNoNetCheck) CheckForDuplicates(NodeList, ElementList, DebugLevel);
}
else
{
@@ -3177,6 +3177,7 @@
{
write_fortschritt (9, "->Speichern der Elemente gestartet\n");
+ int ElementNr = 0;
for (unsigned int i=0; i<ElementList->size(); i++)
{
write_fortschritt(DebugLevel, "%d von %d Elementen gespeichert\n", i, ElementList->size());
@@ -3193,11 +3194,13 @@
dump_error(__FILE__, __LINE__, "Ein Element hat nicht genau 3 Knoten\n");
}
+ ElementNr++;
+
TNode *N1 = Element->Node1;
TNode *N2 = Element->Node2;
TNode *N3 = Element->Node3;
- fprintf(fh, "E3T %6d %6d %6d %6d %6d\n", i+1, N1->Nr, N2->Nr, N3->Nr, 1);
+ fprintf(fh, "E3T %6d %6d %6d %6d %6d\n", ElementNr, N1->Nr, N2->Nr, N3->Nr, 1);
}
write_fortschritt (9, "%d von %d Elementen gespeichert\n", ElementList->size(), ElementList->size());
@@ -3271,7 +3274,7 @@
}
//---------------------------------------------------------------------------
-bool SaveSol(std::string FileName, TNodeList *NodeList, int DebugLevel)
+bool SaveSol(std::string FileName, TNodeList *NodeList, TElementList* ElementList, int DebugLevel)
{
write_fortschritt (9, "->Speichern der SOL-Wasserstände gestartet\n");
@@ -3283,10 +3286,37 @@
write_error(4201, "Kann Datei '%s' nicht zum Schreiben öffnen\n", FileName.c_str());
}
- fprintf(fh, "SCALAR\n");
+ int ElementAnz = 0;
+ if (ElementList && ElementList->size() > 0)
+ {
+ write_fortschritt (9, "->Zählen der Elemente gestartet\n");
+
+ for (unsigned int i=0; i<ElementList->size(); i++)
+ {
+ write_fortschritt(DebugLevel, "%d von %d Elementen gezählt\n", ElementAnz, ElementList->size());
+
+ TElement *Element = (*ElementList)[i];
+
+ if (Element->Typ == NO_ELEMENT)
+ {
+ continue;
+ }
+
+ ElementAnz++;
+ }
+
+ write_fortschritt(DebugLevel, "%d Elementen gezählt\n", ElementAnz);
+
+ write_fortschritt (9, "<-Zählen der Elemente beendet\n");
+ }
+
+ fprintf(fh, "DATASET\n");
+ fprintf(fh, "OBJTYPE \"mesh2d\"\n");
+ fprintf(fh, "BEGSCL\n");
fprintf(fh, "ND %d\n", NodeList->size());
- fprintf(fh, "ST 0\n");
- fprintf(fh, "TS 0\n");
+ fprintf(fh, "NC %d\n", ElementAnz);
+ fprintf(fh, "NAME \"WSPL\"\n");
+ fprintf(fh, "TS 0 0\n");
for (unsigned int i=0; i<NodeList->size(); i++)
{
@@ -3297,6 +3327,8 @@
fprintf(fh, "%15.9f\n", Node->Wsp / 100.0);
}
+ fprintf(fh, "ENDDS\n");
+
write_fortschritt (9, "%d von %d Wasserstände gespeichert\n", NodeList->size(), NodeList->size());
fclose (fh);
Modified: trunk/src/file.h
===================================================================
--- trunk/src/file.h 2010-05-07 14:11:12 UTC (rev 152)
+++ trunk/src/file.h 2010-05-07 16:54:36 UTC (rev 153)
@@ -26,7 +26,7 @@
bool LoadPRJ(std::string FileName, bool NoProjWarn, int DebugLevel);
-bool LoadDGM(std::string FileName, TNodeList *NodeList, TElementList *ElementList, TXYZList *XyList, bool NoProjWarn, int DebugLevel);
+bool LoadDGM(std::string FileName, TNodeList *NodeList, TElementList *ElementList, TXYZList *XyList, bool NoProjWarn, bool NoCheckNet, 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);
@@ -49,7 +49,7 @@
bool SavePRJ(std::string FileName, int DebugLevel);
bool SaveNet(std::string FileName, TNodeList *NodeList, TElementList *ElementList, int DebugLevel);
-bool SaveSol(std::string FileName, TNodeList *NodeList, int DebugLevel);
+bool SaveSol(std::string FileName, TNodeList *NodeList, TElementList* ElementList, int DebugLevel);
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);
Modified: trunk/src/parameter.cpp
===================================================================
--- trunk/src/parameter.cpp 2010-05-07 14:11:12 UTC (rev 152)
+++ trunk/src/parameter.cpp 2010-05-07 16:54:36 UTC (rev 153)
@@ -76,6 +76,7 @@
FileNameAusgabe = "WSPLGEN.SHP";
IsSetNoProjWarn = false;
+ IsSetNoCheckNet = false;
if (argc == 0 || argv == 0)
{
@@ -623,6 +624,23 @@
write_fortschritt (9, "Es werden keine Warnungen zu verschiedenen Projektionen ausgegeben\n");
}
+ else if (Parameter.substr(0, 11) == "-NOCHECKNET" || Parameter.substr(0, 11) == "-nochecknet")
+ {
+ ///////////////////////////////////////////////
+ // NONETCHECKING
+ ///////////////////////////////////////////////
+ if (IsSetDebug) write_fortschritt (9, "Parameter -NOCHECKNET erkannt.\n");
+
+ if (IsSetNoCheckNet)
+ {
+ write_warning(1106, "Der Parameter -NOCHECKNET wurde mehrfach angegeben.\n");
+ continue;
+ }
+
+ IsSetNoCheckNet = true;
+
+ write_fortschritt (9, "Es werden keine Warnungen zu Fehlern in den DGM-Daten ausgegeben\n");
+ }
else if (Parameter.substr(0, 1) == "$")
{
// Geheimer Parameter zum Umleiten der Ausgaben
Modified: trunk/src/parameter.h
===================================================================
--- trunk/src/parameter.h 2010-05-07 14:11:12 UTC (rev 152)
+++ trunk/src/parameter.h 2010-05-07 16:54:36 UTC (rev 153)
@@ -82,6 +82,7 @@
std::string FileNameAusgabe;
bool IsSetNoProjWarn;
+ bool IsSetNoCheckNet;
};
//---------------------------------------------------------------------------
Modified: trunk/src/test_file.cpp
===================================================================
--- trunk/src/test_file.cpp 2010-05-07 14:11:12 UTC (rev 152)
+++ trunk/src/test_file.cpp 2010-05-07 16:54:36 UTC (rev 153)
@@ -478,7 +478,7 @@
TNodeList *NodeList = new TNodeList();
TElementList *ElementList = new TElementList();
- LoadDGM(DGMTINFILE, NodeList, ElementList, 0, false, 8);
+ LoadDGM(DGMTINFILE, NodeList, ElementList, 0, false, false, 8);
if (NodeList->size() != 114) printf("Failed\n");
else if (ElementList->size() != 218) printf("Failed\n");
@@ -504,7 +504,7 @@
XyList->Add(new TXYZ(826648700, 262559500));
XyList->Add(new TXYZ(826648700, 246716800));
- LoadDGM(DGMTINFILE, NodeList, ElementList, XyList, false, 8);
+ LoadDGM(DGMTINFILE, NodeList, ElementList, XyList, false, false, 8);
if (NodeList->size() != 51) printf("Failed\n");
else if (ElementList->size() != 72) printf("Failed\n");
@@ -525,7 +525,7 @@
TNodeList *NodeList = new TNodeList();
TElementList *ElementList = new TElementList();
- LoadDGM(DGMTINFILE2, NodeList, ElementList, 0, false, 8);
+ LoadDGM(DGMTINFILE2, NodeList, ElementList, 0, false, false, 8);
if (NodeList->size() != 19) printf("Failed\n");
else if (ElementList->size() != 28) printf("Failed\n");
@@ -546,7 +546,7 @@
TNodeList *NodeList = new TNodeList();
TElementList *ElementList = new TElementList();
- LoadDGM(DGMTINFILE3, NodeList, ElementList, 0, 8);
+ LoadDGM(DGMTINFILE3, NodeList, ElementList, 0, false, false, 8);
if (NodeList->size() != 52) printf("Failed\n");
else if (ElementList->size() != 72) printf("Failed\n");
@@ -574,7 +574,7 @@
XyList->Add(new TXYZ(826648700, 262559500));
XyList->Add(new TXYZ(826648700, 246716800));
- LoadDGM(DGMGRDFILE, NodeList, ElementList, XyList, false, 8);
+ LoadDGM(DGMGRDFILE, NodeList, ElementList, XyList, false, false, 8);
if (NodeList->size() != 24624) printf("Failed\n");
else printf("Pass\n");
@@ -594,7 +594,7 @@
TNodeList *NodeList = new TNodeList();
TElementList *ElementList = new TElementList();
- LoadDGM(DGMXYZFILE, NodeList, ElementList, 0, false, 8);
+ LoadDGM(DGMXYZFILE, NodeList, ElementList, 0, false, false, 8);
if (NodeList->size() != 10) printf("Failed\n");
else printf("Pass\n");
@@ -613,7 +613,7 @@
TNodeList *NodeList = new TNodeList();
TElementList *ElementList = new TElementList();
- LoadDGM(DGMXYZFILE2, NodeList, ElementList, 0, false, 8);
+ LoadDGM(DGMXYZFILE2, NodeList, ElementList, 0, false, false, 8);
if (NodeList->size() != 1126) printf("Failed\n");
else printf("Pass\n");
@@ -632,7 +632,7 @@
TNodeList *NodeList = new TNodeList();
TElementList *ElementList = new TElementList();
- LoadDGM(DGMXYZFILE3, NodeList, ElementList, 0, false, 8);
+ LoadDGM(DGMXYZFILE3, NodeList, ElementList, 0, false, false, 8);
if (NodeList->size() != 43332) printf("Failed\n");
else printf("Pass\n");
@@ -651,7 +651,7 @@
TNodeList *NodeList = new TNodeList();
TElementList *ElementList = new TElementList();
- LoadDGM(DGMXYZFILE4, NodeList, ElementList, 0, false, 8);
+ LoadDGM(DGMXYZFILE4, NodeList, ElementList, 0, false, false, 8);
if (NodeList->size() != 98636) printf("Failed\n");
else printf("Pass\n");
@@ -670,7 +670,7 @@
TNodeList *NodeList = new TNodeList();
TElementList *ElementList = new TElementList();
- LoadDGM(DGMXMLFILE, NodeList, ElementList, 0, false, 8);
+ LoadDGM(DGMXMLFILE, NodeList, ElementList, 0, false, false, 8);
if (NodeList->size() != 3) printf("Failed\n");
else printf("Pass\n");
@@ -689,7 +689,7 @@
TNodeList *NodeList = new TNodeList();
TElementList *ElementList = new TElementList();
- LoadDGM(DGMSHPFILE, NodeList, ElementList, 0, false, 8);
+ LoadDGM(DGMSHPFILE, NodeList, ElementList, 0, false, false, 8);
if (NodeList->size() != 114) printf("Failed\n");
else printf("Pass\n");
@@ -733,7 +733,7 @@
XyList->Add(new TXYZ(349516400, 587493600));
XyList->Add(new TXYZ(349516400, 587483400));
- LoadDGM(DGMSHPFILE2, NodeList, ElementList, XyList, false, 8);
+ LoadDGM(DGMSHPFILE2, NodeList, ElementList, XyList, false, false, 8);
if (NodeList->size() != 28287) printf("Failed\n");
else printf("Pass\n");
@@ -753,7 +753,7 @@
TNodeList *NodeList = new TNodeList();
TElementList *ElementList = new TElementList();
- LoadDGM(DGM2DMFILE, NodeList, ElementList, 0, false, 8);
+ LoadDGM(DGM2DMFILE, NodeList, ElementList, 0, false, false, 8);
if (NodeList->size() != 1126) printf("Failed\n");
else if (ElementList->size() != 2225) printf("Failed\n");
Modified: trunk/src/test_nodes.cpp
===================================================================
--- trunk/src/test_nodes.cpp 2010-05-07 14:11:12 UTC (rev 152)
+++ trunk/src/test_nodes.cpp 2010-05-07 16:54:36 UTC (rev 153)
@@ -174,7 +174,7 @@
TNodeList *NodeList = new TNodeList();
TElementList *ElementList = new TElementList();
- LoadDGM(DGMSHPFILE, NodeList, ElementList, 0, false, 8);
+ LoadDGM(DGMSHPFILE, NodeList, ElementList, 0, false, false, 8);
NodeList->SortByXY();
Modified: trunk/src/test_quadtree.cpp
===================================================================
--- trunk/src/test_quadtree.cpp 2010-05-07 14:11:12 UTC (rev 152)
+++ trunk/src/test_quadtree.cpp 2010-05-07 16:54:36 UTC (rev 153)
@@ -264,7 +264,7 @@
TNodeList *NodeList = new TNodeList();
TElementList *ElementList = new TElementList();
- LoadDGM(DGMFILE, NodeList, ElementList, 0, false, 1);
+ LoadDGM(DGMFILE, NodeList, ElementList, 0, false, false, 1);
TQuadTree<TNodeList, TNode> *QuadTree = new TQuadTree<TNodeList, TNode>();
Modified: trunk/src/test_tools.cpp
===================================================================
--- trunk/src/test_tools.cpp 2010-05-07 14:11:12 UTC (rev 152)
+++ trunk/src/test_tools.cpp 2010-05-07 16:54:36 UTC (rev 153)
@@ -58,7 +58,7 @@
TNodeList *NodeList = new TNodeList();
TNodeList *NassNodeList = new TNodeList();
TElementList *ElementList = new TElementList();
- LoadDGM(DGM2DMFILE, NodeList, ElementList, 0, false, 8);
+ LoadDGM(DGM2DMFILE, NodeList, ElementList, 0, false, false, 8);
TProfilList *ProfilList = new TProfilList();
LoadProfile(PROFILFILE, ProfilList, 0, -9999.9, 9999.9, false, 8);
@@ -87,7 +87,7 @@
EdgeList->BuildEdgeIndex();
// Jetzt die Wasserstände der Profile übertragen
- TransferWsp(ProfilList, NodeList, AchsenList, SperrenList, NassNodeList, true, 8);
+ TransferWsp(ProfilList, NodeList, AchsenList, SperrenList, NassNodeList, 0, true, 8);
int Count = 0;
@@ -98,7 +98,8 @@
if (Node->Wsp != NoWsp) Count++;
}
- if (Count != 20) printf("Failed\n");
+
+ if (Count != 16) printf("Failed\n");
else printf("Pass\n");
delete GradientenList;
@@ -378,7 +379,7 @@
TElementList *ElementList = new TElementList();
TEdgeList* EdgeList = new TEdgeList;
- LoadDGM(DGMXYZFILE, NodeList, ElementList, 0, false, 8);
+ LoadDGM(DGMXYZFILE, NodeList, ElementList, 0, false, false, 8);
Triangulate(NodeList, ElementList, 0, 8);
Modified: trunk/src/test_tri.cpp
===================================================================
--- trunk/src/test_tri.cpp 2010-05-07 14:11:12 UTC (rev 152)
+++ trunk/src/test_tri.cpp 2010-05-07 16:54:36 UTC (rev 153)
@@ -82,7 +82,7 @@
TNodeList *NodeList = new TNodeList();
TElementList *ElementList = new TElementList();
- LoadDGM(DGMFILE3, NodeList, ElementList, 0, false, 1);
+ LoadDGM(DGMFILE3, NodeList, ElementList, 0, false, false, 1);
Triangulate(NodeList, ElementList, 0, 8);
@@ -143,7 +143,7 @@
TNodeList *NodeList = new TNodeList();
TElementList *ElementList = new TElementList();
- LoadDGM(DGMFILE1, NodeList, ElementList, 0, false, 1);
+ LoadDGM(DGMFILE1, NodeList, ElementList, 0, false, false, 1);
Triangulate(NodeList, ElementList, 0, 8);
@@ -161,7 +161,7 @@
TNodeList *NodeList = new TNodeList();
TElementList *ElementList = new TElementList();
- LoadDGM(DGMFILE4, NodeList, ElementList, 0, false, 1);
+ LoadDGM(DGMFILE4, NodeList, ElementList, 0, false, false, 1);
Triangulate(NodeList, ElementList, 0, 8);
@@ -179,7 +179,7 @@
TNodeList *NodeList = new TNodeList();
TElementList *ElementList = new TElementList();
- LoadDGM(DGMFILE5, NodeList, ElementList, 0, false, 1);
+ LoadDGM(DGMFILE5, NodeList, ElementList, 0, false, false, 1);
Triangulate(NodeList, ElementList, 0, 8);
@@ -197,7 +197,7 @@
TNodeList *NodeList = new TNodeList();
TElementList *ElementList = new TElementList();
- LoadDGM(DGMFILE2, NodeList, ElementList, 0, false, 1);
+ LoadDGM(DGMFILE2, NodeList, ElementList, 0, false, false, 1);
Triangulate(NodeList, ElementList, 0, 8);
@@ -215,7 +215,7 @@
TNodeList *NodeList = new TNodeList();
TElementList *ElementList = new TElementList();
- LoadDGM(DGMFILE6, NodeList, ElementList, 0, false, 1);
+ LoadDGM(DGMFILE6, NodeList, ElementList, 0, false, false, 1);
Triangulate(NodeList, ElementList, 0, 8);
Modified: trunk/src/tools.cpp
===================================================================
--- trunk/src/tools.cpp 2010-05-07 14:11:12 UTC (rev 152)
+++ trunk/src/tools.cpp 2010-05-07 16:54:36 UTC (rev 153)
@@ -1553,12 +1553,14 @@
}
//---------------------------------------------------------------------------
-void TransferWsp(TProfilList *ProfilList, TNodeList *NodeList, TGewaesserAchseList *GewaesserAchseList, TProfilList* SperrenList, TNodeList *NassNodeList, bool Sperre, int DebugLevel)
+void TransferWsp(TProfilList *ProfilList, TNodeList *NodeList, TGewaesserAchseList *GewaesserAchseList, TProfilList* SperrenList, TNodeList *NassNodeList, TXYZList* BegrenzungsPolygon, bool Sperre, int DebugLevel)
{
write_fortschritt (9, "->Übertragen der Wasserstände gestartet\n");
NodeList->ClearWsp();
+ NodeList->SortByXY();
+
TNodeList* Temp1NodeList = new TNodeList;
TNodeList* Temp2NodeList = new TNodeList;
@@ -1586,8 +1588,10 @@
write_error(3206, "Die Gewässerachse schneidet die Profilspur bei km %.4f nicht\n", Station / 10000.0);
}
+ if (BegrenzungsPolygon && BegrenzungsPolygon->size() >= 3 && BegrenzungsPolygon->IsInsideXYList((long)X, (long)Y) == NOT_INSIDE) continue;
+
// Es ist nicht wichtig, wie gross der Startsuchradius ist,
- // solange er nicht zu gross ist und gleich sehr viele Knozen gefunden werden
+ // solange er nicht zu gross ist und gleich sehr viele Knoten gefunden werden
// 100.0 entspricht 100 cm = 1 m
double Radius = 100.0;
TNodeList* StartNodeList = 0;
@@ -1595,7 +1599,7 @@
{
StartNodeList = NodeList->FindAllByXY(X, Y, Radius);
Radius = Radius * 2.0;
- write_fortschritt(DebugLevel, "Suchradius ist %.0f\n", Radius);
+ if (DebugLevel > 4) write_fortschritt(DebugLevel, "Suchradius ist %.0f m\n", Radius / 100.0);
} while (StartNodeList->size() == 0);
///////////////////////////////////////////////////////////
@@ -1603,32 +1607,33 @@
///////////////////////////////////////////////////////////
TNode* NearestNode = 0;
- long 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
long double Distance = sqrt((X - Node->X) * (X - Node->X) + (Y - Node->Y) * (Y - Node->Y));
if (NearestNode == 0 || Distance < NearestDistance)
- {
- NearestDistance = Distance;
- NearestNode = Node;
- }
- }
+ {
+ NearestDistance = Distance;
+ NearestNode = Node;
+ }
+ }
write_fortschritt(DebugLevel, "dichtester Knoten zu Profil %.4f: (%ld,%ld)\n", Station / 10000.0, NearestNode->X, NearestNode->Y);
if (NearestNode->Z < Wsp)
- {
- NearestNode->Wsp = Wsp;
+ {
+ NearestNode->Wsp = Wsp;
+ NearestNode->StartNode = true;
WspCount++;
- }
+ }
- Temp1NodeList->Add(NearestNode);
+ Temp1NodeList->Add(NearestNode);
while (Temp1NodeList->size() > 0)
- {
+ {
if (DebugLevel >= 9)
{
SaveNodes("temp1.shp", Temp1NodeList, 8);
@@ -1637,13 +1642,13 @@
if (DebugLevel >= 9) write_fortschritt(9, "%d Knoten in Temp1 bei Profil %.4f\n", Temp1NodeList->size(), Station / 10000.0);
// In Temp1 sind nun alle Nassen Knoten
- // In Temp2 kommen alle potentiellen nassen Knoten
+ // In Temp2 kommen alle potentiellen nassen Knoten
- // Jetzt werden alle Knoten hinzugefügt, die nass werden können und deren Kante
- // zu den bestehenden Knoten nicht gesperrt ist
+ // Jetzt werden alle Knoten hinzugefügt, die nass werden können und deren Kante
+ // zu den bestehenden Knoten nicht gesperrt ist
for(TNodeList::iterator i = Temp1NodeList->begin(); i != Temp1NodeList->end(); i++)
- {
+ {
TNode* Node = *i;
TEdgeIndex *AktEdgeIndex = Node->EdgeIndex;
@@ -1652,41 +1657,50 @@
TEdgeIndex *NextEdgeIndex = AktEdgeIndex->NextEdgeIndex;
TEdge *Edge = AktEdgeIndex->Edge;
- bool FoundSperre = false;
- for (TProfilList::iterator j = SperrenList->begin(); j != SperrenList->end(); j++)
- {
- TProfil* Sperre = *j;
- if (Sperre->CalcSchnitt(Edge))
- {
- FoundSperre = true;
- break;
- }
- }
- if (false == FoundSperre)
+ TNode* Node2 = Edge->Node2;
+ if (Edge->Node2 == Node) Node2 = Edge->Node1;
+
+ if (Node2->Wsp == NoWsp)
{
- if (Edge->Node1 == Node && Edge->Node2->Wsp == NoWsp && (false == Sperre || Edge->Node2->Z < Wsp))
+ // Nur die Knoten die auf der andren Seite des Profils liegen kommen in Frage
+ // Dies verhindert ein zu schnelles ausbreiten in der Fläche
+ if (Profil->CalcSchnitt(Edge))
{
- Temp2NodeList->AddUnique(Edge->Node2);
- if (DebugLevel >= 9) write_fortschritt(9, "möglicher nasser Knoten bei Profil %.4f: (%ld,%ld,%.3f)\n", Station / 10000.0, Edge->Node2->X, Edge->Node2->Y, Wsp / 100.0);
+ bool FoundSperre = false;
+ for (TProfilList::iterator j = SperrenList->begin(); j != SperrenList->end(); j++)
+ {
+ TProfil* Sperre = *j;
+ if (Sperre->CalcSchnitt(Edge))
+ {
+ FoundSperre = true;
+ break;
+ }
+ }
+ if (false == FoundSperre)
+ {
+ if (Node2->Wsp == NoWsp && (false == Sperre || Node2->Z < Wsp))
+ {
+ Node2->Wsp = Wsp;
+ WspCount++;
+ Node2->StartNode = true;
+ NassNodeList->Add(Edge->Node2);
+ Temp2NodeList->AddUnique(Node2);
+ if (DebugLevel >= 9) write_fortschritt(9, "möglicher nasser Knoten bei Profil %.4f: (%ld,%ld,%.3f)\n", Station / 10000.0, Node2->X, Node2->Y, Wsp / 100.0);
+ }
+ }
}
- if (Edge->Node2 == Node && Edge->Node1->Wsp == NoWsp && (false == Sperre || Edge->Node1->Z < Wsp))
- {
- Temp2NodeList->AddUnique(Edge->Node1);
- if (DebugLevel >= 9) write_fortschritt(9, "möglicher nasser Knoten bei Profil %.4f: (%ld,%ld,%.3f)\n", Station / 10000.0, Edge->Node1->X, Edge->Node1->Y, Wsp / 100.0);
- }
}
- AktEdgeIndex = NextEdgeIndex;
+ AktEdgeIndex = NextEdgeIndex;
}
- }
+ }
if (DebugLevel >= 9)
{
write_fortschritt (9, "%d Knoten in Temp2 bei Profil %.4f\n", Temp2NodeList->size(), Station / 10000.0);
}
- // In Temp2 sind nun alle potentiellen nassen Knoten
- // In Temp1 kommen jetzt die Knoten die eine Kante haben die das Profil schneidet
- // damit ist sicher gestellt, dass die Knoten sich noch nicht in der fläche ausbreiten
+ // In Temp2 sind nun alle potentiellen nassen Knoten
+ // In Temp1 kommen jetzt die neunen Knoten
if (DebugLevel >= 9)
{
@@ -1694,42 +1708,15 @@
}
Temp1NodeList->clear();
+ TNodeList* SaveNodeList = Temp1NodeList;
+ Temp1NodeList = Temp2NodeList;
+ Temp2NodeList = SaveNodeList;
+ }
- for(TNodeList::iterator i = Temp2NodeList->begin(); i != Temp2NodeList->end(); i++)
- {
- TNode* Node = *i;
+ Temp1NodeList->clear();
+ Temp2NodeList->clear();
- TEdgeIndex *AktEdgeIndex = Node->EdgeIndex;
- while (AktEdgeIndex)
- {
- TEdgeIndex *NextEdgeIndex = AktEdgeIndex->NextEdgeIndex;
- TEdge *Edge = AktEdgeIndex->Edge;
-
- if (Profil->CalcSchnitt(Edge))
- {
- if (false == Sperre || Node->Z < Wsp)
- {
- Node->Wsp = Wsp;
- WspCount++;
-
- NassNodeList->Add(Node);
-
- if (DebugLevel >= 9) write_fortschritt(9, "nasser Knoten bei Profil %.4f: (%ld,%ld,%.2f)\n", Station / 10000.0, Node->X, Node->Y, Wsp / 100.0);
- }
-
- Temp1NodeList->Add(Node);
- break;
- }
- AktEdgeIndex = NextEdgeIndex;
- }
-
- if (DebugLevel >= 9) write_fortschritt(9, "nasser Knoten bei Profil %.4f: (%ld,%ld)\n", Station / 10000.0, Node->X, Node->Y);
- }
-
- Temp2NodeList->clear();
- }
-
- Count++;
+ Count++;
}
write_fortschritt (9, "%d von %d Knoten getestet, %d Wasserstände übertragen\n", Count, NodeList->size(), WspCount);
Modified: trunk/src/tools.h
===================================================================
--- trunk/src/tools.h 2010-05-07 14:11:12 UTC (rev 152)
+++ trunk/src/tools.h 2010-05-07 16:54:36 UTC (rev 153)
@@ -86,7 +86,7 @@
void EqualizeProfil(TProfil *ProfilOne, TProfil *ProfilTwo);
void CheckForDuplicates(TNodeList *NodeList, TElementList *ElementList, int DebugLevel);
void BuildEdgeList(TNodeList* NodeList, TElementList* ElementList, TEdgeList* EdgeList, int DebugLevel);
-void TransferWsp(TProfilList *ProfilList, TNodeList *NodeList, TGewaesserAchseList *GewaesserAchseList, TProfilList* SperrenList, TNodeList *StartNodeList, bool Sperre, int DebugLevel);
+void TransferWsp(TProfilList *ProfilList, TNodeList *NodeList, TGewaesserAchseList *GewaesserAchseList, TProfilList* SperrenList, TNodeList *NassNodeList, TXYZList* BegrenzungsPolygon, bool Sperre, int DebugLevel);
void TransferWspFromGradient(TProfilList *GradientenList, TNodeList *NodeList, TEdgeList *Temp2EdgeList, double AvgDistance, int DebugLevel);
void TransferWspFromRohr(TProfilList *RohreList, TNodeList *NodeList, TEdgeList *Temp2EdgeList, double AvgDistance, int DebugLevel);
void GetWspFromNodeListToGradient(TNodeList* NodeList, TProfilList* GradientenList, double AvgDistance, int DebugLevel);
Modified: trunk/src/wsplgen.cpp
===================================================================
--- trunk/src/wsplgen.cpp 2010-05-07 14:11:12 UTC (rev 152)
+++ trunk/src/wsplgen.cpp 2010-05-07 16:54:36 UTC (rev 153)
@@ -165,17 +165,20 @@
TXYZList* Tmp1BegrenzungsPolygon = new TXYZList();
LoadGebiet(Parameter.FileNameGebiet, Tmp1BegrenzungsPolygon, Parameter.IsSetNoProjWarn, Parameter.DebugLevel);
+ std::string PolygonFileName1 = ExchangeFileExt(Parameter.FileNameAusgabe, "_begrenzungspolygon1.shp");
+ if (Parameter.DebugLevel > 7) SavePolygon(PolygonFileName1, Tmp1BegrenzungsPolygon, Parameter.DebugLevel);
+
TProfil* FirstProfil = *ProfilList->begin();
TXYZList* Tmp2BegrenzungsPolygon = Tmp1BegrenzungsPolygon->Cut(ProfilList, FirstProfil);
- std::string PolygonFileName1 = ExchangeFileExt(Parameter.FileNameAusgabe, "_begrenzungspolygon1.shp");
- if (Parameter.DebugLevel > 7) SavePolygon(PolygonFileName1, Tmp2BegrenzungsPolygon, Parameter.DebugLevel);
+ std::string PolygonFileName2 = ExchangeFileExt(Parameter.FileNameAusgabe, "_begrenzungspolygon2.shp");
+ if (Parameter.DebugLevel > 7) SavePolygon(PolygonFileName2, Tmp2BegrenzungsPolygon, Parameter.DebugLevel);
TProfil* LastProfil = *ProfilList->rbegin();
BegrenzungsPolygon = Tmp2BegrenzungsPolygon->Cut(ProfilList, LastProfil);
- std::string PolygonFileName2 = ExchangeFileExt(Parameter.FileNameAusgabe, "_begrenzungspolygon2.shp");
- if (Parameter.DebugLevel > 7) SavePolygon(PolygonFileName2, Tmp2BegrenzungsPolygon, Parameter.DebugLevel);
+ std::string PolygonFileName3 = ExchangeFileExt(Parameter.FileNameAusgabe, "_begrenzungspolygon3.shp");
+ if (Parameter.DebugLevel > 7) SavePolygon(PolygonFileName3, BegrenzungsPolygon, Parameter.DebugLevel);
delete Tmp2BegrenzungsPolygon;
delete Tmp1BegrenzungsPolygon;
@@ -195,7 +198,7 @@
if (Parameter.DebugLevel > 2) SavePolygon(PolygonFileName, BegrenzungsPolygon, Parameter.DebugLevel);
}
- LoadDGM(Parameter.FileNameDgm, NodeList, ElementList, BegrenzungsPolygon, Parameter.IsSetNoProjWarn, Parameter.DebugLevel);
+ LoadDGM(Parameter.FileNameDgm, NodeList, ElementList, BegrenzungsPolygon, Parameter.IsSetNoProjWarn, Parameter.IsSetNoCheckNet, Parameter.DebugLevel);
// Wenn die Elementliste noch leer ist, müssen die Knoten noch trianguliert werden.
if (ElementList->size() == 0)
@@ -215,8 +218,6 @@
SaveNet(TriNetzFileName, NodeList, ElementList, Parameter.DebugLevel);
}
- delete BegrenzungsPolygon;
-
NodeList->SortByNr();
if (SperrenList->size() > 0 || GrabenList->size() > 0)
@@ -267,8 +268,11 @@
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);
+ TransferWsp(ProfilList, NodeList, GewaesserAchseList, SperrenList, NassNodeList, BegrenzungsPolygon, Parameter.Sperre, Parameter.DebugLevel);
+ delete BegrenzungsPolygon;
+ BegrenzungsPolygon = 0;
+
// Mal wieder Zwischenergebnisse produzieren
std::string StartKnotenFileName = ExchangeFileExt(Parameter.FileNameAusgabe, "_startknoten.shp");
if (Parameter.DebugLevel > 2) SaveNodes(StartKnotenFileName, NassNodeList, Parameter.DebugLevel);
@@ -349,8 +353,10 @@
EdgeList = 0;
write_fortschritt (9, "<- Freigeben des Speichers der Kanten beendet\n");
+ NodeList->SortByNr();
+
std::string ElementeFileName = ExchangeFileExt(Parameter.FileNameAusgabe, "_elemente.shp");
- if (Parameter.DebugLevel > 2) SaveElements(ElementeFileName, ElementList, Parameter.Von, Parameter.DebugLevel);
+ if (Parameter.DebugLevel > 4) SaveElements(ElementeFileName, ElementList, Parameter.Von, Parameter.DebugLevel);
if (Parameter.IsSetSaveSol)
{
@@ -358,7 +364,7 @@
SaveNet(FileName, NodeList, ElementList, Parameter.DebugLevel);
std::string SolFileName = ExchangeFileExt(Parameter.FileNameAusgabe, ".sol");
- SaveSol(SolFileName, NodeList, Parameter.DebugLevel);
+ SaveSol(SolFileName, NodeList, ElementList, Parameter.DebugLevel);
}
write_fortschritt (9, "-> Freigeben des Speichers der Elemente gestartet\n");
@@ -366,8 +372,6 @@
ElementList = 0;
write_fortschritt (9, "<- Freigeben des Speichers der Elemente beendet\n");
- NodeList->SortByNr();
-
std::string KnotenFileName = ExchangeFileExt(Parameter.FileNameAusgabe, "_knoten.shp");
if (Parameter.DebugLevel > 2) SaveNodes(KnotenFileName, NodeList, Parameter.DebugLevel);
Modified: trunk/src/wsplgen.h
===================================================================
--- trunk/src/wsplgen.h 2010-05-07 14:11:12 UTC (rev 152)
+++ trunk/src/wsplgen.h 2010-05-07 16:54:36 UTC (rev 153)
@@ -10,7 +10,7 @@
// Read the file COPYING coming with WSPLGEN for details.
//
-const char Version[] = "1.3.5";
+const char Version[] = "1.3.6";
// 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 2010-05-07 14:11:12 UTC (rev 152)
+++ trunk/src/xy.cpp 2010-05-07 16:54:36 UTC (rev 153)
@@ -56,6 +56,7 @@
Z = z;
Wsp = wsp;
EdgeIndex = 0;
+ StartNode = false;
}
//---------------------------------------------------------------------
@@ -64,6 +65,7 @@
Nr = node->Nr;
Wsp = node->Wsp;
EdgeIndex = 0;
+ StartNode = node->StartNode;
}
//---------------------------------------------------------------------
@@ -140,7 +142,7 @@
if (false == Found)
{
- dump_error(__FILE__, __LINE__, "Konnte zu löschende Kante nicht finden\n");
+ dump_error(__FILE__, __LINE__, "Konnte zu löschende Kante nicht finden\n");
}
}
@@ -321,7 +323,7 @@
}
//---------------------------------------------------------------------
-TInsideTyp TXYZList::IsInsideXYList(long X, long Y)
+TInsideTyp TXYZList::IsInsideXYList(long X, long Y)
{
if (X < MinX || X > MaxX || Y < MinY || Y > MaxY) return (NOT_INSIDE);
@@ -342,7 +344,7 @@
if (alpha % 4 == 0) return (INSIDE); // some inside
- dump_error(__FILE__, __LINE__, "Alpha (%d) ungültig\n", alpha);
+ dump_error(__FILE__, __LINE__, "Alpha (%d) ungültig\n", alpha);
return (UNDEFINED);
}
@@ -1039,6 +1041,8 @@
if (size() <= 0) return(SearchNodeList);
+ if (0 == QuadTree) dump_error(__FILE__, __LINE__, "QurdTree existiert nicht\n");
+
QuadTree->SearchAll(X, Y, R, SearchNodeList, MinX, MaxX, MinY, MaxY);
return (SearchNodeList);
@@ -1346,10 +1350,7 @@
int Wsp = Node->Wsp;
- if (Wsp < 0.0)
- {
- dump_error(__FILE__, __LINE__, "Der Wasserstand ist negativ\n");
- }
+ if (Wsp < 0.0) dump_error(__FILE__, __LINE__, "Der Wasserstand ist negativ\n");
if (Count == 0 || Wsp > MaxWsp) MaxWsp = Wsp;
Modified: trunk/src/xy.h
===================================================================
--- trunk/src/xy.h 2010-05-07 14:11:12 UTC (rev 152)
+++ trunk/src/xy.h 2010-05-07 16:54:36 UTC (rev 153)
@@ -91,6 +91,7 @@
int Nr;
int Wsp;
TEdgeIndex *EdgeIndex;
+ bool StartNode;
TNode(int Nr, long X, long Y, int Z, int Wsp = NoWsp);
TNode(TNode *Node);
More information about the Wsplgen-commits
mailing list