Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Psrotator feature #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions code/azimuth.fcgi
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ class AzimuthWriter
end


def frame
def frame(minimumFrame)
@pdfwriter.save_graphics_state do
@pdfwriter.line_width = 2*thickline
@pdfwriter.cap_style = :butt
Expand All @@ -921,7 +921,7 @@ class AzimuthWriter
r = i*DEGTORAD
s = Math::sin(r)
c = Math::cos(r)
if ((i % 10) == 0)
if (((i % 10) == 0) and not minimumFrame)
numstr = ((90 - i) % 360).to_s
label = numstr + "°"
w = 0.5*@pdfwriter.width_of(numstr, :size => labelsize)
Expand Down Expand Up @@ -958,10 +958,10 @@ class AzimuthWriter
if (i % 6) == 0
@pdfwriter.stroke_line([0, 0],
[@printRadius*c,@printRadius*s])
elsif (i % 2) == 0
elsif (i % 2) == 0 and not minimumFrame
@pdfwriter.stroke_line([0.25*@printRadius*c, 0.25*@printRadius*s],
[@printRadius*c,@printRadius*s])
else
elsif not minimumFrame
@pdfwriter.stroke_line([0.5*@printRadius*c, 0.5*@printRadius*s],
[@printRadius*c,@printRadius*s])
end
Expand Down Expand Up @@ -1554,8 +1554,8 @@ def handleRequest(cgi)
if db
begin
db.busy_timeout(150)
db.execute("CREATE TABLE if not exists log (id integer primary key autoincrement, title text, paper text, bluefill tinyint, view tinyint, countries tinyint, cities tinyint, distance text, location text, datetime bigint, iploc tinyint, referrer text, success tinyint, blackwhite tinyint, latlonglines tinyint, gridsquarelabels tinyint)")
db.execute("insert into log (title, paper, bluefill, view, countries, cities, distance, location, iploc, referrer, datetime, blackwhite, latlonglines, gridsquarelabels) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
db.execute("CREATE TABLE if not exists log (id integer primary key autoincrement, title text, paper text, bluefill tinyint, view tinyint, countries tinyint, cities tinyint, distance text, location text, datetime bigint, iploc tinyint, referrer text, success tinyint, blackwhite tinyint, latlonglines tinyint, gridsquarelabels tinyint, pstrotator tinyint)")
db.execute("insert into log (title, paper, bluefill, view, countries, cities, distance, location, iploc, referrer, datetime, blackwhite, latlonglines, gridsquarelabels, pstrotator) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
cgv['title'],
cgv['paper'],
bool(cgv['bluefill']),
Expand All @@ -1568,7 +1568,8 @@ def handleRequest(cgi)
cgi.referer, Time.now.to_i,
bool(cgv['bw']),
bool(cgv['latlong']),
bool(cgv['gridsquares']))
bool(cgv['gridsquares']),
bool(cgv['pstrotator']))
id = db.get_first_value("select last_insert_rowid()")

lettersize = "LETTER"
Expand Down Expand Up @@ -1679,12 +1680,14 @@ def handleRequest(cgi)
File.open("corrected.azb") { |inf|
foo.traceFile(inf)
}
File.open("nations.azb") { |inf|
foo.traceLines(inf)
}
File.open("states.azb") { |inf|
foo.traceLines(inf)
}
if ("on" != cgv["pstrotator"])
File.open("nations.azb") { |inf|
foo.traceLines(inf)
}
File.open("states.azb") { |inf|
foo.traceLines(inf)
}
end
if cgv.has_key?("kmlfile")
foo.markLandmarks(cgv["kmlfile"])
end
Expand Down Expand Up @@ -1713,9 +1716,11 @@ def handleRequest(cgi)
else
headers["content-disposition"] = "attachment; filename=AzimuthalMap.pdf"
end
foo.frame
foo.heading
foo.footer
foo.frame("on" == cgv["psrotator"])
if ("on" != cgv["pstrotator"])
foo.heading
foo.footer
end
# foo.dump(File.open("test.pdf", "wb"))
contents = foo.render
cgi.out(headers) {
Expand Down
9 changes: 7 additions & 2 deletions html/azimuth.html
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ <h1>Request an Azimuthal Map</h1>
<option value="RA2">RA2 (43cm x 61cm)</option>
<option value="RA3">RA3 (30.5cm x 43cm)</option>
<option value="RA4">RA4 (21.5m x 30.5cm)</option>
<option value="SQUARE">SQUARE (10.16cm x 10.16cm)</option>
<option value="SRA0">SRA0 (90cm x 128cm)</option>
<option value="SRA1">SRA1 (64cm x 90cm)</option>
<option value="SRA2">SRA2 (45cm x 64cm)</option>
Expand All @@ -249,8 +250,8 @@ <h1>Request an Azimuthal Map</h1>
<tr>
<td align="right">Label grids:</td>
<td><input type="checkbox" name="gridsquares" ></td>
<td align="right">&nbsp;</td>
<td>&nbsp;</td>
<td align="right">PSTRotator Map:</td>
<td><input type="checkbox" checked="checked" name="pstrotator" ></td>
</tr>
<tr>
<td colspan="4" align="center"><button name="submit" type="submit">Create Map</button>
Expand All @@ -264,6 +265,10 @@ <h1>Request an Azimuthal Map</h1>
You can customize the map in a variety of ways by changing the
options in the web form. <strong>Report problems or successes as
comments on <a href="/word/?page_id=10">this page.</a></strong></p>
<p> For PSTRotator recommend 17500 Distance and 8.5" x 11" paper size -- you should be able
to zoom the PDF file to shrink down the image close to the PSTRotator size. Then use SnipIt
to clip the image into a square, paste into Paint and save as Azimuthal.jpg in
PSTRotator/Maps and/or PSTRotatorAZ/Maps.
<p> The location can be a latitude, longitude, a Maidenhead grid
square, or a city name (e.g., "51.504572,-0.268225", "IO91um", or
"Chicago, IL"). You can indicate North and East coordinates by using
Expand Down