Helmerttransformation fürs erste fertig, bis GNSS-Daten vorliegen
This commit is contained in:
40
Datenbank.py
40
Datenbank.py
@@ -32,11 +32,13 @@ class Datenbankzugriff:
|
||||
def __init__(self, pfad_datenbank):
|
||||
self.pfad_datenbank = pfad_datenbank
|
||||
|
||||
def get_koordinaten(self, koordinatenart, ausgabeart = "Vektoren"):
|
||||
def get_koordinaten(self, koordinatenart, ausgabeart = "Dict"):
|
||||
con = sqlite3.connect(self.pfad_datenbank)
|
||||
cursor = con.cursor()
|
||||
if koordinatenart == "naeherung_lh":
|
||||
values = "punktnummer, naeherungx_lh, naeherungy_lh, naeherungz_lh"
|
||||
elif koordinatenart == "naeherung_us":
|
||||
values = "punktnummer, naeherungx_us, naeherungy_us, naeherungz_us"
|
||||
|
||||
liste_koordinaten = cursor.execute(f"""
|
||||
SELECT {values} FROM Netzpunkte;
|
||||
@@ -44,9 +46,33 @@ class Datenbankzugriff:
|
||||
cursor.close()
|
||||
con.close()
|
||||
|
||||
if ausgabeart == "Vektoren":
|
||||
liste_koordinaten_vektoren = []
|
||||
for koordinate in liste_koordinaten:
|
||||
liste_koordinaten_vektoren.append({koordinate[0]: sp.Matrix([float(koordinate[1]), float(koordinate[2]), float(koordinate[3])])})
|
||||
liste_koordinaten = liste_koordinaten_vektoren
|
||||
return liste_koordinaten
|
||||
liste_koordinaten = [
|
||||
koordinate for koordinate in liste_koordinaten
|
||||
if koordinate[1] is not None and koordinate[2] is not None and koordinate[3] is not None
|
||||
]
|
||||
if ausgabeart == "Dict":
|
||||
return {koordinate[0]: sp.Matrix([float(koordinate[1]), float(koordinate[2]), float(koordinate[3])]) for koordinate in liste_koordinaten}
|
||||
|
||||
def set_koordinaten(self, dict_koordinaten, koordinatenart):
|
||||
con = sqlite3.connect(self.pfad_datenbank)
|
||||
cursor = con.cursor()
|
||||
|
||||
daten = []
|
||||
|
||||
for punktnummer, wert in dict_koordinaten.items():
|
||||
daten.append((
|
||||
float(wert[0]),
|
||||
float(wert[1]),
|
||||
float(wert[2]),
|
||||
str(punktnummer)
|
||||
))
|
||||
|
||||
if koordinatenart == "naeherung_lh":
|
||||
pass
|
||||
elif koordinatenart == "naeherung_us":
|
||||
cursor.executemany(f"""UPDATE Netzpunkte SET naeherungx_us = ?, naeherungy_us = ?, naeherungz_us = ? WHERE punktnummer = ? AND naeherungx_us IS NULL AND naeherungy_us IS NULL AND naeherungz_us IS NULL""", daten)
|
||||
|
||||
|
||||
con.commit()
|
||||
cursor.close()
|
||||
con.close()
|
||||
Reference in New Issue
Block a user