2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-14 23:07:09 +00:00

Start to change dataformat for caves, along with there editing. Start to change survex reader to cope better with equates/tags.

This commit is contained in:
Martin Green
2012-06-10 14:59:21 +01:00
parent fd12e70f78
commit 711fefb0da
16 changed files with 388 additions and 136 deletions

View File

@@ -59,7 +59,11 @@ def LoadSurvexLineLeg(survexblock, stardata, sline, comment):
survexblock.save()
def LoadSurvexEquate(survexblock, sline):
pass
#print sline #
stations = sline.split()
assert len(stations) > 1
for station in stations:
survexblock.MakeSurvexStation(station)
def LoadSurvexLinePassage(survexblock, stardata, sline, comment):
pass
@@ -109,6 +113,7 @@ def RecursiveLoad(survexblock, survexfile, fin, textlines):
# detect the star command
cmd, line = mstar.groups()
cmd = cmd.lower()
if re.match("include$(?i)", cmd):
includepath = os.path.join(os.path.split(survexfile.path)[0], re.sub("\.svx$", "", line))
includesurvexfile = models.SurvexFile(path=includepath, cave=survexfile.cave)
@@ -177,10 +182,12 @@ def RecursiveLoad(survexblock, survexfile, fin, textlines):
assert ls[0] == "passage", line
elif cmd == "equate":
LoadSurvexEquate(survexblock, sline)
LoadSurvexEquate(survexblock, line)
elif cmd == "fix":
survexblock.MakeSurvexStation(line.split()[0])
else:
assert cmd.lower() in [ "sd", "equate", "include", "units", "entrance", "fix", "data", "flags", "title", "export", "instrument", "calibrate", "set", "infer"], (cmd, line, survexblock)
assert cmd in [ "sd", "include", "units", "entrance", "data", "flags", "title", "export", "instrument", "calibrate", "set", "infer"], (cmd, line, survexblock)
@@ -211,6 +218,7 @@ def LoadAllSurvexBlocks():
models.SurvexLeg.objects.all().delete()
models.SurvexTitle.objects.all().delete()
models.SurvexPersonRole.objects.all().delete()
models.SurvexStation.objects.all().delete()
survexfile = models.SurvexFile(path="all", cave=None)
survexfile.save()
@@ -248,7 +256,8 @@ def LoadPos():
try:
ss = models.SurvexStation.objects.lookup(name)
except:
pass
print name
ss.x = float(x)
ss.y = float(y)
ss.z = float(z)
ss.save()