Skip to content

Commit

Permalink
Add survey to preview and filenames.
Browse files Browse the repository at this point in the history
  • Loading branch information
pchote committed Nov 26, 2018
1 parent b19f98b commit 9b65ead
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions findingchart.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ def generate_finding_chart(out_year, in_ra, in_dec, in_format, in_year, ra_pm, d
data_pos=[old_x * scale_x, 512 - old_y * scale_y],
observing_pos=[new_x * scale_x, 512 - new_y * scale_y],
indicator_size=indicator_size,
survey=survey,
data='data:image/png;base64,' + base64.b64encode(output.read()).decode())
finally:
os.remove(filename)
Expand Down
13 changes: 10 additions & 3 deletions static/findingchart.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ function generateChart(t) {

chartContext.drawImage(thumbImage[0], chartImageX, chartImageY);

// Survey source
chartContext.fillStyle = '#0000FF';
chartContext.font = '12px sans-serif';
chartContext.textAlign = 'start';
chartContext.textBaseline = 'top';
chartContext.fillText(json.survey, chartImageX + 10, chartImageY + 10);

// Direction indicator
chartContext.lineWidth = 2;
chartContext.strokeStyle = '#0000FF';
Expand All @@ -85,8 +92,8 @@ function generateChart(t) {
chartContext.lineTo(chartImageX + 462, chartImageY + 502);
chartContext.stroke();

chartContext.fillStyle = '#0000FF';
chartContext.font = '12px sans-serif';
chartContext.textBaseline = 'bottom';
chartContext.textAlign = 'center';
chartContext.fillText('E', chartImageX + 455, chartImageY + 506);
chartContext.fillText('N', chartImageX + 502, chartImageY + 457);

Expand Down Expand Up @@ -168,7 +175,7 @@ function setup() {
for (var i in targetData) {
var data = new Image();
data.src = targetData[i][1].toDataURL();
zip.file(targetData[i][0].name + '.png', data.src.substr(data.src.indexOf(',')+1), {base64: true});
zip.file(targetData[i][0].name + '_' + targetData[i][0].survey + '.png', data.src.substr(data.src.indexOf(',')+1), {base64: true});
}

zip.generateAsync({type:'blob'}).then(function (blob) {
Expand Down

0 comments on commit 9b65ead

Please sign in to comment.