199 lines
7.3 KiB
C#
199 lines
7.3 KiB
C#
using KlassenBIB;
|
|
using SanShared;
|
|
using SchnittstelleImporter.XML2006;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Xml;
|
|
using System.Xml.Schema;
|
|
|
|
namespace SchnittstelleImporter
|
|
{
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public class I2006XML : SanShared.IImportedObjekte
|
|
{
|
|
string xmlFile;
|
|
string projektnummer;
|
|
Dictionary<string, string> materialReferenz = new Dictionary<string, string>();
|
|
/// <summary>
|
|
/// Angabe zur XML datei
|
|
/// </summary>
|
|
public string XMLFile
|
|
{
|
|
get
|
|
{
|
|
return xmlFile;
|
|
}
|
|
set
|
|
{
|
|
xmlFile = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Angabe zur Projektnummer
|
|
/// </summary>
|
|
public string Projektnummer
|
|
{
|
|
get
|
|
{
|
|
return projektnummer;
|
|
}
|
|
set
|
|
{
|
|
projektnummer = value;
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public I2006XML()
|
|
{
|
|
LoadMaterialien();
|
|
}
|
|
private void LoadMaterialien()
|
|
{
|
|
materialReferenz.Add("AZ", "AsbestZement");
|
|
materialReferenz.Add("B", "Beton");
|
|
materialReferenz.Add("BS", "BetonSegmente");
|
|
|
|
/*materialReferenz.Add("CNS
|
|
materialReferenz.Add("EIS
|
|
materialReferenz.Add("FZ
|
|
*/
|
|
materialReferenz.Add("GFK", "GFK");
|
|
materialReferenz.Add("GG", "Grauguss");
|
|
/*
|
|
materialReferenz.Add("GGG
|
|
materialReferenz.Add("KST
|
|
materialReferenz.Add("MA
|
|
materialReferenz.Add("OB
|
|
materialReferenz.Add("P
|
|
materialReferenz.Add("PC
|
|
materialReferenz.Add("PCC
|
|
*/
|
|
materialReferenz.Add("PE", "PE");
|
|
materialReferenz.Add("PEHD", "PEHD");
|
|
/*
|
|
materialReferenz.Add("PH
|
|
materialReferenz.Add("PHB
|
|
*/
|
|
materialReferenz.Add("PP", "Polypropolen");
|
|
materialReferenz.Add("PVC", "Polyvinylchlorid");
|
|
materialReferenz.Add("PVCU", "Polyvinylchlorid hart");
|
|
/*materialReferenz.Add("SFB
|
|
materialReferenz.Add("SPB
|
|
*/
|
|
materialReferenz.Add("SB", "Stahlbeton");
|
|
//materialReferenz.Add("ST
|
|
materialReferenz.Add("STZ", "Steinzeug");
|
|
/*materialReferenz.Add("SZB
|
|
materialReferenz.Add("W
|
|
materialReferenz.Add("ZG
|
|
materialReferenz.Add("MIX
|
|
materialReferenz.Add("BOD
|
|
materialReferenz.Add("RAS
|
|
materialReferenz.Add("PFL
|
|
*/
|
|
}
|
|
|
|
private string getRohrmaterial(string kennung)
|
|
{
|
|
string result;
|
|
if (!materialReferenz.TryGetValue(kennung, out result))
|
|
result = kennung;
|
|
|
|
return result;
|
|
}
|
|
|
|
private static void LoadRefListe()
|
|
{
|
|
//XmlSchema s = XmlSchema.Read(XmlReader.Create(@"XML2006\SchemaDateien\0610-referenzlisten.xsd"), null);
|
|
XmlDocument xmlDocument = new XmlDocument();
|
|
xmlDocument.Load(@"XML2006\SchemaDateien\0610-referenzlisten.xsd");
|
|
|
|
XmlNodeReader nodeReader = new XmlNodeReader(xmlDocument);
|
|
while(nodeReader.Read())
|
|
{
|
|
Trace.WriteLine(nodeReader.Name);
|
|
Trace.WriteLine(nodeReader.GetAttribute("name"));
|
|
}
|
|
/*
|
|
int x = xmlDocument.ChildNodes.Count;
|
|
var y = xmlDocument.ChildNodes[7];
|
|
|
|
for(int i = 0; i < y.ChildNodes.Count; i++)
|
|
{
|
|
var d = y.ChildNodes[i];
|
|
var e = d["MaterialType"];
|
|
Trace.WriteLine(e);
|
|
}*/
|
|
|
|
}
|
|
|
|
private static void ValidationCallback(object sender, ValidationEventArgs e)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<Inspektionsobjekt> GetInspektionsobjekte()
|
|
{
|
|
|
|
List<Inspektionsobjekt> result = new List<Inspektionsobjekt>();
|
|
List<InspizierteAbwassertechnischeAnlage> anlagen = XMLParser.GetList(XMLFile);
|
|
foreach(InspizierteAbwassertechnischeAnlage src in anlagen)
|
|
{
|
|
Inspektionsobjekt inspektionsobjekt = new Inspektionsobjekt();
|
|
KlassenBIB.Collections.Inspektionskuerzeln inspektionskuerzelns = new KlassenBIB.Collections.Inspektionskuerzeln();
|
|
|
|
inspektionsobjekt.Projektnummer = projektnummer;
|
|
inspektionsobjekt.Objektbezeichnung = src.Objektbezeichnung;
|
|
inspektionsobjekt.OrtName = src.Lage.Ortname!= null? src.Lage.Ortname : "";
|
|
inspektionsobjekt.StrasseName = src.Lage.Strassename != null ? src.Lage.Strassename : "noname";
|
|
inspektionsobjekt.RohrMaterial = src.OptischeInspektion.Rohrleitung.Grunddaten.Material != null ? getRohrmaterial(src.OptischeInspektion.Rohrleitung.Grunddaten.Material) : "Unbekannt";
|
|
inspektionsobjekt.Kanalrohrweite = src.OptischeInspektion.Rohrleitung.Grunddaten.Profilhoehe != 0 ? (uint)src.OptischeInspektion.Rohrleitung.Grunddaten.Profilhoehe : (uint)src.OptischeInspektion.Rohrleitung.Grunddaten.Profilbreite;
|
|
inspektionsobjekt.Haltungslaenge = Convert.ToDouble(src.OptischeInspektion.Rohrleitung.Inspektionslaenge);
|
|
inspektionsobjekt.VonPunkt = src.OptischeInspektion.Rohrleitung.Grunddaten.KnotenZulauf;
|
|
inspektionsobjekt.BisPunkt = src.OptischeInspektion.Rohrleitung.Grunddaten.KnotenAblauf;
|
|
inspektionsobjekt.Inspektionsrichtung = src.OptischeInspektion.Rohrleitung.Inspektionsrichtung;
|
|
|
|
|
|
foreach(RZustand zustand in src.OptischeInspektion.Rohrleitung.Zustaende)
|
|
{
|
|
Inspektionskuerzeln inspektionskuerzeln = new Inspektionskuerzeln();
|
|
inspektionskuerzeln.Station = zustand.Station;
|
|
inspektionskuerzeln.Hauptkode = zustand.Inspektionskode;
|
|
inspektionskuerzeln.Charakterisierung1 = zustand.Charakterisierung1;
|
|
inspektionskuerzeln.Charakterisierung2 = zustand.Charakterisierung2;
|
|
inspektionskuerzeln.ImVerbindung = zustand.Verbindung;
|
|
inspektionskuerzeln.LageAmUmfangStart = Convert.ToUInt32(zustand.PositionVon);
|
|
inspektionskuerzeln.LageAmUmfangEnde = Convert.ToUInt32(zustand.PositionBis);
|
|
|
|
Quantifizierung quant1 = zustand.Quantifizierung1;
|
|
Quantifizierung quant2 = zustand.Quantifizierung2;
|
|
|
|
inspektionskuerzeln.Quantifizierung1 = Convert.ToUInt32(quant1.Numerisch);
|
|
inspektionskuerzeln.Quantifizierung2 = Convert.ToUInt32(quant2.Numerisch);
|
|
|
|
inspektionskuerzelns.Add(inspektionskuerzeln);
|
|
}
|
|
|
|
inspektionsobjekt.Schadenskuerzeln = inspektionskuerzelns;
|
|
result.Add(inspektionsobjekt);
|
|
}
|
|
|
|
return result;
|
|
}
|
|
}
|
|
}
|