mirror of
https://expo.survex.com/repositories/expoweb/.git/
synced 2025-01-30 15:12:31 +00:00
[svn r7397] Add circle for 1987-02
Add submap outlines to the overview map (click on the square at the top-left to jump to the submap). Tweak the drawing order - the "vague location" caves get plotted first, so that we don't end up drawing their circles over something interesting, and the blob for a cave is now drawn after the label for that cave which means the blobs are now whole.
This commit is contained in:
parent
5c8ec93672
commit
1eb5190788
@ -7,3 +7,4 @@
|
||||
(36200.00, 82925.00, 50) 178 # Calculated from bearings
|
||||
(35232.64, 82910.37, 25) 181 # Calculated from bearings
|
||||
(35800.00, 83418.00, 100) 98 # "up from 176"
|
||||
(36086.00, 82723.00, 50) 1987-02 # "100m up from 157 and 0/5"
|
||||
|
@ -24,7 +24,7 @@ areanames = {
|
||||
'8d': '8d – Loser-Hochganger ridge',
|
||||
'9': '9 – Gschwandt Alm',
|
||||
'10': '10 – Altaussee',
|
||||
'11': '11 – Augstbach',
|
||||
'11': '11 – Augstbach'
|
||||
}
|
||||
|
||||
areacolours = {
|
||||
@ -36,7 +36,7 @@ areacolours = {
|
||||
'2b' : '#00ff00',
|
||||
'2c' : '#008800',
|
||||
'2d' : '#ff9900',
|
||||
'3' : '#880000',
|
||||
'3' : '#880000',
|
||||
'4' : '#0000ff',
|
||||
'6' : '#000000', # doubles for surface fixed pts
|
||||
'7' : '#808080'
|
||||
@ -48,21 +48,21 @@ for a in areas: cavelists[a]=[]
|
||||
|
||||
|
||||
def chomp(s):
|
||||
if(s[-1]=="\n"): return s[:-1]
|
||||
else: return s
|
||||
if(s[-1]=="\n"): return s[:-1]
|
||||
else: return s
|
||||
|
||||
def find_effective_number(c):
|
||||
"""Determine an appropriate number to use."""
|
||||
if c["Kataster Number"]:
|
||||
return c["Kataster Number"]
|
||||
else:
|
||||
return c["Unofficial number"]
|
||||
"""Determine an appropriate number to use."""
|
||||
if c["Kataster Number"]:
|
||||
return c["Kataster Number"]
|
||||
else:
|
||||
return c["Unofficial number"]
|
||||
|
||||
def longnumber(c, number):
|
||||
"""Both numbers"""
|
||||
if (c["Unofficial number"] and c["Unofficial number"] != number):
|
||||
return number + " (" + c["Unofficial number"] + ")"
|
||||
else:
|
||||
"""Both numbers"""
|
||||
if (c["Unofficial number"] and c["Unofficial number"] != number):
|
||||
return number + " (" + c["Unofficial number"] + ")"
|
||||
else:
|
||||
return number
|
||||
|
||||
def find_location(cave):
|
||||
@ -91,16 +91,52 @@ def find_label(cave, number):
|
||||
return t
|
||||
|
||||
|
||||
import Image, ImageDraw, ImageFont, string
|
||||
# Parameters for big map
|
||||
|
||||
MAP_LEFT_GK = 34394.9
|
||||
MAP_TOP_GK = 84508.6
|
||||
MAP_RIGHT_GK = 37399.4
|
||||
MAP_BOTTOM_GK = 80895.6
|
||||
MAP_WIDTH = 1417
|
||||
MAP_HEIGHT = 1704
|
||||
|
||||
# Parameters for zoomed smaller maps
|
||||
|
||||
MAP40_LEFT_GK = 36275.6
|
||||
MAP40_TOP_GK = 82392.5
|
||||
MAP40_RIGHT_GK = 36780.3
|
||||
MAP40_BOTTOM_GK = 81601.7
|
||||
MAP40_WIDTH = 714
|
||||
MAP40_HEIGHT = 1119
|
||||
|
||||
MAP204_LEFT_GK = 36354.1
|
||||
MAP204_TOP_GK = 84154.5
|
||||
MAP204_RIGHT_GK = 37047.4
|
||||
MAP204_BOTTOM_GK = 83399.7
|
||||
MAP204_WIDTH = 972
|
||||
MAP204_HEIGHT = 1068
|
||||
|
||||
import Image, ImageDraw, ImageFont, string, os
|
||||
myImage = Image.open("pguidemap.jpg")
|
||||
myDraw = ImageDraw.Draw(myImage)
|
||||
my40Image = Image.open("pguidemap_40area.jpg")
|
||||
my40Image = myImage.crop(map(int, (
|
||||
(MAP40_LEFT_GK - MAP_LEFT_GK)/(MAP_RIGHT_GK - MAP_LEFT_GK) * MAP_WIDTH,
|
||||
(MAP40_TOP_GK - MAP_TOP_GK)/-(MAP_TOP_GK - MAP_BOTTOM_GK) * MAP_HEIGHT,
|
||||
(MAP40_RIGHT_GK - MAP_LEFT_GK)/(MAP_RIGHT_GK - MAP_LEFT_GK) * MAP_WIDTH,
|
||||
(MAP40_BOTTOM_GK - MAP_TOP_GK)/-(MAP_TOP_GK - MAP_BOTTOM_GK) * MAP_HEIGHT)))
|
||||
my40Image = my40Image.resize((MAP40_WIDTH, MAP40_HEIGHT), Image.BICUBIC)
|
||||
my40Draw = ImageDraw.Draw(my40Image)
|
||||
my204Image = Image.open("pguidemap_204area.jpg")
|
||||
my204Image = myImage.crop(map(int, (
|
||||
(MAP204_LEFT_GK - MAP_LEFT_GK)/(MAP_RIGHT_GK - MAP_LEFT_GK) * MAP_WIDTH,
|
||||
(MAP204_TOP_GK - MAP_TOP_GK)/-(MAP_TOP_GK - MAP_BOTTOM_GK) * MAP_HEIGHT,
|
||||
(MAP204_RIGHT_GK - MAP_LEFT_GK)/(MAP_RIGHT_GK - MAP_LEFT_GK) * MAP_WIDTH,
|
||||
(MAP204_BOTTOM_GK - MAP_TOP_GK)/-(MAP_TOP_GK - MAP_BOTTOM_GK) * MAP_HEIGHT)))
|
||||
my204Image = my204Image.resize((MAP204_WIDTH, MAP204_HEIGHT), Image.BICUBIC)
|
||||
my204Draw = ImageDraw.Draw(my204Image)
|
||||
|
||||
#FONT = "/usr/X11R6/lib/X11/fonts/truetype/arial.ttf"
|
||||
FONT = "C:\WINNT\Fonts\ARIAL.TTF"
|
||||
#FONT = "C:\WINNT\Fonts\ARIAL.TTF"
|
||||
FONT = "/usr/share/fonts/truetype/freefont/FreeSans.ttf"
|
||||
SIZE = 8
|
||||
myFont = ImageFont.truetype(FONT, SIZE)
|
||||
myDraw.setfont(myFont)
|
||||
@ -121,30 +157,6 @@ def mungecoord(x, y, mapcode = ""):
|
||||
# yoffset = (y - 83317)*FACTOR
|
||||
# return (1073 + xoffset, 562 - yoffset)
|
||||
|
||||
# Parameters for big map
|
||||
|
||||
MAP_LEFT_GK = 34394.9
|
||||
MAP_TOP_GK = 84508.6
|
||||
MAP_RIGHT_GK = 37399.4
|
||||
MAP_BOTTOM_GK = 80895.6
|
||||
MAP_WIDTH = 1417
|
||||
MAP_HEIGHT = 1704
|
||||
|
||||
# Parameters for zoomed smaller maps
|
||||
|
||||
MAP40_LEFT_GK = 36275.6
|
||||
MAP40_TOP_GK = 82392.5
|
||||
MAP40_RIGHT_GK = 36780.3
|
||||
MAP40_BOTTOM_GK = 81601.7
|
||||
MAP40_WIDTH = 714
|
||||
MAP40_HEIGHT = 1119
|
||||
|
||||
MAP204_LEFT_GK = 36354.1
|
||||
MAP204_TOP_GK = 84154.5
|
||||
MAP204_RIGHT_GK = 37047.4
|
||||
MAP204_BOTTOM_GK = 83399.7
|
||||
MAP204_WIDTH = 972
|
||||
MAP204_HEIGHT = 1068
|
||||
if(mapcode == "40"):
|
||||
return (x - MAP40_LEFT_GK)/(MAP40_RIGHT_GK - MAP40_LEFT_GK) * MAP40_WIDTH, MAP40_HEIGHT - (y - MAP40_BOTTOM_GK)/(MAP40_TOP_GK - MAP40_BOTTOM_GK) * MAP40_HEIGHT
|
||||
elif(mapcode == "204"):
|
||||
@ -156,28 +168,29 @@ def mungecoord(x, y, mapcode = ""):
|
||||
|
||||
def plot(loctuple, number, area, label):
|
||||
shortnumber = number.replace("—","")
|
||||
(x,y) = mungecoord(loctuple[0], loctuple[1])
|
||||
(x,y) = map(int, mungecoord(loctuple[0], loctuple[1]))
|
||||
x = int(x)
|
||||
y = int(y)
|
||||
imagemap_areas.append( [x-4, y-SIZE/2, x+4+myDraw.textsize(shortnumber)[0], y+SIZE/2, shortnumber, label] )
|
||||
myDraw.ellipse([(x-4,y-4),(x+4,y+4)], fill=areacolours[area], outline="#000000")
|
||||
myDraw.rectangle([(x+4, y-SIZE/2), (x+4+myDraw.textsize(shortnumber)[0], y+SIZE/2)], fill="#ffffff")
|
||||
myDraw.text((x+6,y-SIZE/2), shortnumber, fill="#000000")
|
||||
myDraw.ellipse([(x-4,y-4),(x+4,y+4)], fill=areacolours[area], outline="#000000")
|
||||
|
||||
(x,y) = mungecoord(loctuple[0], loctuple[1], "40")
|
||||
x = int(x)
|
||||
y = int(y)
|
||||
imagemap40_areas.append( [x-4, y-SIZE/2, x+4+myDraw.textsize(shortnumber)[0], y+SIZE/2, shortnumber, label] )
|
||||
my40Draw.ellipse([(x-4,y-4),(x+4,y+4)], fill=areacolours[area], outline="#000000")
|
||||
my40Draw.rectangle([(x+4, y-SIZE/2), (x+4+myDraw.textsize(shortnumber)[0], y+SIZE/2)], fill="#ffffff")
|
||||
my40Draw.text((x+6,y-SIZE/2), shortnumber, fill="#000000")
|
||||
my40Draw.ellipse([(x-4,y-4),(x+4,y+4)], fill=areacolours[area], outline="#000000")
|
||||
|
||||
(x,y) = mungecoord(loctuple[0], loctuple[1], "204")
|
||||
x = int(x)
|
||||
y = int(y)
|
||||
imagemap204_areas.append( [x-4, y-SIZE/2, x+4+myDraw.textsize(shortnumber)[0], y+SIZE/2, shortnumber, label] )
|
||||
my204Draw.ellipse([(x-4,y-4),(x+4,y+4)], fill=areacolours[area], outline="#000000")
|
||||
my204Draw.rectangle([(x+4, y-SIZE/2), (x+4+myDraw.textsize(shortnumber)[0], y+SIZE/2)], fill="#ffffff")
|
||||
my204Draw.text((x+6,y-SIZE/2), shortnumber, fill="#000000")
|
||||
my204Draw.ellipse([(x-4,y-4),(x+4,y+4)], fill=areacolours[area], outline="#000000")
|
||||
|
||||
def writeout_imagemap(data, mapname):
|
||||
# Munge the list of coordinates into a proper image map.
|
||||
@ -199,6 +212,7 @@ import csv, re, time
|
||||
cavetabfile = file("../CAVETAB2.CSV")
|
||||
fieldnames=chomp(cavetabfile.next()).replace('"','').split(",")
|
||||
cavetab = csv.DictReader(cavetabfile, fieldnames)
|
||||
|
||||
positionfile = file("../all.pos")
|
||||
positionfile.next()
|
||||
positions = {}
|
||||
@ -215,20 +229,30 @@ for l in lengthsfile:
|
||||
lengths[t[0]] = (t[1], t[2])
|
||||
print "Done"
|
||||
|
||||
htmlfile = file("../prospecting_guide.html", "w")
|
||||
# Draw cave passage
|
||||
for mapcode in ["", "40", "204"]:
|
||||
file3d = os.popen("/home/olly/cvs/survex-1.1/src/dump3d ../all.3d")
|
||||
if mapcode == "40":
|
||||
thisDraw = my40Draw
|
||||
elif mapcode == "204":
|
||||
thisDraw = my204Draw
|
||||
else:
|
||||
thisDraw = myDraw
|
||||
lastx, lasty = 0, 0
|
||||
for l in file3d:
|
||||
try:
|
||||
act,E,N,flags = re.match(r'^(MOVE|LINE)\s+(-?[0-9.]+)\s+(-?[0-9.]+)\s+(?:.*\] ([^]]*)$)?', l).groups()
|
||||
except:
|
||||
continue
|
||||
if not flags: flags = ""
|
||||
E,N = map(float, (E,N))
|
||||
x,y = map(int, mungecoord(E, N, mapcode))
|
||||
|
||||
htmlfile.write("<html><head><title>Prospecting Guide</title>\n")
|
||||
htmlfile.write("<style type=\"text/css\">.locn { font-size: x-small }</style></head>\n")
|
||||
htmlfile.write("<body><h1>Prospecting Guide</h1>")
|
||||
htmlfile.write("<p>Generated " + time.strftime("%x %X") + "</p>\n")
|
||||
htmlfile.write("<p><b>Notes:</b></p><ul><li>A marking status of \"Retag\" means a tag is in place but it carries a provisional number, or in some cases an incorrect number, and needs replacing with a new tag.</li>\n<li>Kataster status codes indicate the size of a cave, its character and its exploration status, as described <a href=\"../katast.htm\">here</a>.</li><li>For more info on each cave, see the links to detailed description pages.</li></ul><p><img src=\"prospecting_guide.jpg\" usemap=\"#map1\" ismap=\"ismap\" /></p><h3>Eishöhle area detail</h3><p><img src=\"prospecting_guide_40area.jpg\" usemap=\"#map40\" ismap=\"ismap\" /></p><h3>Steinbrückenhöhle area detail</h3><p><img src=\"prospecting_guide_204area.jpg\" usemap=\"#map204\" ismap=\"ismap\" /></p>\n")
|
||||
|
||||
cachednumber = ""
|
||||
cachedarea = ""
|
||||
cachedname = ""
|
||||
imagemap_areas=[]
|
||||
imagemap40_areas=[]
|
||||
imagemap204_areas=[]
|
||||
if act == "LINE" and not re.match(r'\bSURFACE\b', flags):
|
||||
thisDraw.line([lastx, lasty, x, y], fill="#800080")
|
||||
lastx,lasty = x,y
|
||||
|
||||
cavestoplot = []
|
||||
for cave in cavetab:
|
||||
if cave["Link file"]: continue
|
||||
number = find_effective_number(cave)
|
||||
@ -244,26 +268,92 @@ for cave in cavetab:
|
||||
cachedarea = cave["Area"]
|
||||
|
||||
area = cave["Area"]
|
||||
if area == '1626': continue
|
||||
|
||||
|
||||
# We have some areas like '2b or 4 (unclear)' - just chop the space
|
||||
# and everything after it for these.
|
||||
area = re.sub(r' .*', "", area)
|
||||
if area == '1626' or area == 'nonexistent': continue
|
||||
|
||||
loctuple = find_location(cave)
|
||||
label = find_label(cave, shortnumber)
|
||||
print label
|
||||
#print label
|
||||
if(cave["Multiple entrances"] == "yes"):
|
||||
locn = "<td colspan=\"3\"> </td>"
|
||||
elif(loctuple):
|
||||
locn = "<td>%d</td><td>%d</td><td>%d</td>" % loctuple
|
||||
try:
|
||||
plot(loctuple, number, area, label)
|
||||
except:
|
||||
plot(loctuple, number, "6", label)
|
||||
cavestoplot.append((loctuple, number, area, label))
|
||||
else:
|
||||
locn = "<td colspan=\"3\">"+ cave["Findability"] + "</td>"
|
||||
try:#if(not cavelists.has_key(area)): cavelists[area]=[]
|
||||
findability = cave["Findability"]
|
||||
if not findability:
|
||||
findability = '?'
|
||||
locn = "<td colspan=\"3\">" + findability + "</td>"
|
||||
try:
|
||||
cavelists[area].append((number, cave, locn))
|
||||
except:
|
||||
print number, area
|
||||
print "Bad area '%s' for cave %s" % (area, number)
|
||||
|
||||
htmlfile = file("../prospecting_guide.html", "w")
|
||||
|
||||
htmlfile.write("<html><head><title>Prospecting Guide</title>\n")
|
||||
htmlfile.write("<style type=\"text/css\">.locn { font-size: x-small }</style></head>\n")
|
||||
htmlfile.write("<body><h1>Prospecting Guide</h1>")
|
||||
htmlfile.write("<p>Generated " + time.strftime("%x %X") + "</p>\n")
|
||||
htmlfile.write("<p><b>Notes:</b></p><ul><li>A marking status of \"Retag\" means a tag is in place but it carries a provisional number, or in some cases an incorrect number, and needs replacing with a new tag.</li>\n<li>Kataster status codes indicate the size of a cave, its character and its exploration status, as described <a href=\"../katast.htm\">here</a>.</li><li>For more info on each cave, see the links to detailed description pages.</li></ul><p><img src=\"prospecting_guide.jpg\" usemap=\"#map1\" ismap=\"ismap\" /></p><h3 id=\"idsubmap40\">Eishöhle area detail</h3><p><img src=\"prospecting_guide_40area.jpg\" usemap=\"#map40\" ismap=\"ismap\" /></p><h3 id=\"idsubmap204\">Steinbrückenhöhle area detail</h3><p><img src=\"prospecting_guide_204area.jpg\" usemap=\"#map204\" ismap=\"ismap\" /></p>\n")
|
||||
|
||||
cachednumber = ""
|
||||
cachedarea = ""
|
||||
cachedname = ""
|
||||
imagemap_areas=[]
|
||||
imagemap40_areas=[]
|
||||
imagemap204_areas=[]
|
||||
|
||||
# Plot the subareas on the full map
|
||||
(t,l) = mungecoord(MAP40_LEFT_GK, MAP40_TOP_GK)
|
||||
(b,r) = mungecoord(MAP40_RIGHT_GK, MAP40_BOTTOM_GK)
|
||||
myDraw.rectangle([t, l, b, r], outline='#777777')
|
||||
myDraw.rectangle([t, l, t+8, l+8], fill='#777777')
|
||||
imagemap_areas.append( [t, l, t+8, l+8, "submap40", "1623/40 subarea map"] )
|
||||
|
||||
(t,l) = mungecoord(MAP204_LEFT_GK, MAP204_TOP_GK)
|
||||
(b,r) = mungecoord(MAP204_RIGHT_GK, MAP204_BOTTOM_GK)
|
||||
myDraw.rectangle([t, l, b, r], outline='#777777')
|
||||
myDraw.rectangle([t, l, t+8, l+8], fill='#777777')
|
||||
imagemap_areas.append( [t, l, t+8, l+8, "submap204", "1623/204 subarea map"] )
|
||||
|
||||
|
||||
# Plot faked positions first so that real caves go on top of the large circles
|
||||
fakedpositions = file("fakedpositions.dat")
|
||||
for p in fakedpositions:
|
||||
try:
|
||||
(x,y,d,name) = re.match(r'\(([0-9.]*?),\t([0-9.]*?),\t([0-9.]*?)\)\t(.*?)[\t ]*#', chomp(p)).groups()
|
||||
except:
|
||||
print "Couldn't understand" + repr(chomp(p))
|
||||
continue
|
||||
|
||||
# Find the area with this cave in
|
||||
area = ''
|
||||
for tryarea in areas:
|
||||
for (number, cave, locn) in cavelists[tryarea]:
|
||||
if name == number:
|
||||
area = tryarea
|
||||
break
|
||||
# FIXME really want to break from both loops at once
|
||||
# but I don't know how to in Python
|
||||
if area != '':
|
||||
break
|
||||
|
||||
(x,y,d) = map(float, (x,y,d))
|
||||
(x,y,d) = map(round, (x,y,d))
|
||||
lo = mungecoord(x-d,y+d)
|
||||
hi = mungecoord(x+d,y-d)
|
||||
foo = mungecoord(x-d, y)
|
||||
myDraw.ellipse([lo,hi], outline="#000000")
|
||||
myDraw.ellipse([lo[0]+1, lo[1]+1,hi[0]-1, hi[1]-1], outline=areacolours[area])
|
||||
myDraw.ellipse([lo[0]+2, lo[1]+2,hi[0]-2, hi[1]-2], outline=areacolours[area])
|
||||
myDraw.rectangle([foo[0],foo[1]-SIZE/2, foo[0] + myDraw.textsize(name)[0], foo[1]+SIZE/2], fill="#ffffff")
|
||||
imagemap_areas.append( [foo[0],foo[1]-SIZE/2, foo[0] + myDraw.textsize(name)[0], foo[1]+SIZE/2, name, "Approx position of %s" % name] )
|
||||
|
||||
myDraw.text((foo[0], foo[1]-SIZE/2), name, fill="#000000")
|
||||
|
||||
|
||||
plot(positions["laser.0_7"], "BNase", "6", "Bräuning Näse laser point")
|
||||
plot(positions["226-96"], "BZkn", "6", "Bräuning Zinken trig point")
|
||||
@ -275,6 +365,11 @@ plot(positions["topcamp"], "TC", "6", "Top Camp")
|
||||
plot(positions["laser.0_1"], "LSR1", "6", "Laser Point 0/1")
|
||||
plot(positions["laser.0_5"], "LSR5", "6", "Laser Point 0/5")
|
||||
|
||||
for (loctuple, number, area, label) in cavestoplot:
|
||||
try:
|
||||
plot(loctuple, number, area, label)
|
||||
except:
|
||||
plot(loctuple, number, "6", label)
|
||||
|
||||
for area in areas:
|
||||
if area:
|
||||
@ -296,37 +391,6 @@ for area in areas:
|
||||
htmlfile.write("</table>\n")
|
||||
|
||||
|
||||
fakedpositions = file("fakedpositions.dat")
|
||||
for p in fakedpositions:
|
||||
try:
|
||||
(x,y,d,name) = re.match(r'\(([0-9.]*?),\t([0-9.]*?),\t([0-9.]*?)\)\t(.*?)[\t ]*#', chomp(p)).groups()
|
||||
except:
|
||||
print "Couldn't understand" + repr(chomp(p))
|
||||
continue
|
||||
# Find the area with this cave in
|
||||
area = ''
|
||||
for tryarea in areas:
|
||||
for (number, cave, locn) in cavelists[tryarea]:
|
||||
if name == number:
|
||||
area = tryarea
|
||||
break
|
||||
# FIXME really want to break from both loops at once
|
||||
# but I don't know how to in Python
|
||||
if area != '':
|
||||
break
|
||||
x,y,d = map(float, (x,y,d))
|
||||
x,y,d = map(round, (x,y,d))
|
||||
lo = mungecoord(x-d,y+d)
|
||||
hi = mungecoord(x+d,y-d)
|
||||
foo = mungecoord(x-d, y)
|
||||
myDraw.ellipse([lo,hi], outline="#000000")
|
||||
myDraw.ellipse([lo[0]+1, lo[1]+1,hi[0]-1, hi[1]-1], outline=areacolours[area])
|
||||
myDraw.ellipse([lo[0]+2, lo[1]+2,hi[0]-2, hi[1]-2], outline=areacolours[area])
|
||||
myDraw.rectangle([foo[0],foo[1]-SIZE/2, foo[0] + myDraw.textsize(name)[0], foo[1]+SIZE/2], fill="#ffffff")
|
||||
imagemap_areas.append( [foo[0],foo[1]-SIZE/2, foo[0] + myDraw.textsize(name)[0], foo[1]+SIZE/2, name, "Approx position of %s" % name] )
|
||||
|
||||
myDraw.text((foo[0], foo[1]-SIZE/2), name, fill="#000000")
|
||||
|
||||
writeout_imagemap(imagemap_areas, "map1")
|
||||
writeout_imagemap(imagemap40_areas, "map40")
|
||||
writeout_imagemap(imagemap204_areas, "map204")
|
||||
|
Loading…
Reference in New Issue
Block a user