You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(49) |
Sep
(25) |
Oct
(2) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(24) |
Nov
(50) |
Dec
(4) |
2004 |
Jan
(2) |
Feb
(2) |
Mar
(5) |
Apr
|
May
(10) |
Jun
|
Jul
(10) |
Aug
(22) |
Sep
(10) |
Oct
|
Nov
(57) |
Dec
(5) |
2005 |
Jan
(24) |
Feb
(12) |
Mar
|
Apr
|
May
(3) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
(9) |
May
(5) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
From: <il...@us...> - 2003-10-22 06:07:38
|
Update of /cvsroot/meshdb/src/geo/rf In directory sc8-pr-cvs1:/tmp/cvs-serv3629/geo/rf Added Files: .cvsignore Log Message: Ignore generated executables. --- NEW FILE: .cvsignore --- rf |
From: <il...@us...> - 2003-10-22 06:07:37
|
Update of /cvsroot/meshdb/src/vpf/psplot In directory sc8-pr-cvs1:/tmp/cvs-serv3629/vpf/psplot Added Files: .cvsignore Log Message: Ignore generated executables. --- NEW FILE: .cvsignore --- psplot |
From: <il...@us...> - 2003-10-22 05:27:01
|
Update of /cvsroot/meshdb/www/db2 In directory sc8-pr-cvs1:/tmp/cvs-serv2089 Modified Files: view.php Log Message: Outstanding commit from David: * Use false rather than an empty string to indicate no peerid. * Better calculations for zoom level/map size. * Honour user's index limit preference in the peer list. Index: view.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/view.php,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- view.php 7 Oct 2002 11:06:02 -0000 1.5 +++ view.php 22 Oct 2003 05:16:26 -0000 1.6 @@ -108,16 +108,16 @@ $peerid = intval($_GET["peerid"]); else if ($nodeid != $PREF["myid"]) $peerid = $PREF["myid"]; - - if ($peerid) { + if (isset($peerid)) { /* Ensure peerid is integer, and not ourselves */ if ($peerid == $nodeid) { - $peerid = ""; + $peerid = false; $peermsg = "Can't plot elevation to self"; } - } + } else + $peerid = false; - if ($hasloc && $peerid != "") { + if ($hasloc && $peerid) { $result = mysql_query("SELECT n,e,h from physloc where nodeid=$peerid", $db) or die(mysql_error($db)); $row = mysql_fetch_row($result); @@ -127,7 +127,7 @@ $h2 = doubleval($row[2]); } else { $peermsg = "Nodeid $peerid doesn't exist"; - $peerid = ""; + $peerid = false; } } @@ -201,17 +201,25 @@ if ($hasloc && count($maps)) { $w = $IMGWIDTH; $h = $IMGHEIGHT; - if (isset($_GET["zoom"])) + $mdist = $peerid ? + sqrt(($e-$e2)*($e-$e2) + ($n-$n2)*($n-$n2)) + : 0; + if (isset($_GET["zoom"])) { $zoom = doubleval($_GET["zoom"]); + $mdist = 0; + } else if ($mdist > 0) + $zoom = 1; else $zoom = $PREF["viewzoom"]; - $mdist = ($peerid == "") ? 0 : max(abs($e-$e2),abs($n-$n2)); - if ($mdist > 0) { - $s = $zoom * $w / max(abs($e-$e2),abs($n-$n2)) / 4; - } else { - $s = $zoom * $w / 20000; /* 20km default span */ - } + echo "<!-- mdist=$mdist e=$e e2=$e2 n=$n n2=$n2 -->\n"; + if ($mdist < 1 || $peerid == "") + $mdist = 20000; /* use a base distance of 20km */ + + $s = $zoom * sqrt($w*$h) / $mdist / 4; + echo "<!-- peerid=$peerid mdist=$mdist s=$s -->\n"; + $param = "s=${s}&w=${w}&h=${h}&n=${n}&e=${e}"; + $paramb = $param; /* paranoia */ $e=doubleval($e); @@ -240,7 +248,7 @@ $param .= "&pe[$i]=$row[e]"; $param .= "&pn[$i]=$row[n]"; $param .= "&pl[$i]=".urlencode($row["nodename"]); - if (intval($peerid) == $row["nodeid"]) { + if ($peerid && $peerid == $row["nodeid"]) { $param .= "&pt[$i]=o"; $param .= "&pi[$i]=5"; } else @@ -258,8 +266,8 @@ $param .= "&pi[$i]=5"; $param .= "&pl[$i]=".urlencode(val("admin[nodename]")); - $paramb = "e=$e&n=$n&w=$w&h=$h&s=$s&t[$nodeid]=X"; - if (isset($peerid)) $paramb .= "&t[$peerid]=o"; + $paramb .= "&t[$nodeid]=X"; + if ($peerid) $paramb .= "&t[$peerid]=o"; $param = htmlspecialchars($param); $paramb = htmlspecialchars($paramb); @@ -320,15 +328,17 @@ Peer node: <select name="peerid"> <? - $peername = "?"; + $peername = "#$peerid"; $limit = ""; /* $limit = "LIMIT 255"; */ $nodename = htmlspecialchars($admin["nodename"]); - if ($peerid == "") + if (!$peerid) echo "<option value=\"\" selected>(none)</option>\n"; - if ($PREF["viewpeersortdist"]) + if ($PREF["viewpeersortdist"]) { $sort = "dist"; - else + if (intval($PREF["indexlimit"]) > 0) + $limit = "LIMIT ".intval($PREF["indexlimit"]); + } else $sort = "admin.nodeid"; $result = mysql_query("SELECT admin.nodeid, nodename, sqrt(pow($n - n, 2) + pow($e - e, 2)) AS dist FROM admin,physloc WHERE admin.nodeid = physloc.nodeid AND n IS NOT NULL AND e IS NOT NULL ORDER BY $sort $limit", $db) or die(mysql_error($db)); @@ -336,7 +346,7 @@ if (intval($row["nodeid"]) == $nodeid) continue; echo "<option value=\"".$row["nodeid"]."\""; - if ($row["nodeid"] == $peerid) { + if ($peerid && $row["nodeid"] == $peerid) { echo " selected"; $peername = htmlspecialchars($row["nodename"]); } @@ -344,6 +354,8 @@ printf(", %.1fkm", $row["dist"] / 1000); echo "</option>\n"; } + if ($limit != "") + echo "<option value=\"-\">... (truncated)</option>\n"; ?> </select> <!-- input name="peerid" value="<?=$peerid?>" size=6 --> @@ -353,7 +365,7 @@ <?=$peermsg?> </td></tr> <? - if ($peerid != "") { + if ($peerid) { $n1 = doubleval($physloc["n"]); $e1 = doubleval($physloc["e"]); $h1 = doubleval($physloc["h"]); @@ -474,7 +486,7 @@ </ul> -<? if ($peerid != "") { ?> +<? if ($peerid) { ?> <h2>Notes</h2> <p> Azimuths are measured clockwise from True North. |
From: <il...@us...> - 2003-10-22 05:00:06
|
Update of /cvsroot/meshdb/www/db2 In directory sc8-pr-cvs1:/tmp/cvs-serv32230 Modified Files: touchgraph.php Log Message: Outstanding commit from David: added a note that the applet can take a while to load. Index: touchgraph.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/touchgraph.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- touchgraph.php 7 Oct 2002 11:10:43 -0000 1.1 +++ touchgraph.php 22 Oct 2003 04:59:43 -0000 1.2 @@ -75,8 +75,16 @@ This is an experimental view of the live linked database using <a href="http://touchgraph.sf.net/">TouchGraph</a>. To see all the nodes, choose minimum zoom and maximum locality. -(Would be nice to make squares pop up an info box, and to be able to -double click to go to the view page.) +</p> + +<p> +<strong>Note:</strong> +It takes a few seconds on most computers for the TouchGraph applet to +initialise. +(It would be a nice extension to make each node pop up an info box, +and also to be able to go to a node's view page by clicking on it. +Ideally, I would like to see a miniature touchgraph associated with the +view pages.) </p> <hr> |
From: <il...@us...> - 2003-10-22 04:59:28
|
Update of /cvsroot/meshdb/www/db2 In directory sc8-pr-cvs1:/tmp/cvs-serv32105 Modified Files: search.php Log Message: Outstanding commit from David: unescape any special characters in the search string before HTML-encoding it. Index: search.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/search.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- search.php 7 Oct 2002 11:06:02 -0000 1.1 +++ search.php 22 Oct 2003 04:58:56 -0000 1.2 @@ -98,7 +98,7 @@ <body> <form method="get" action="search.php"> -Node search: <input name="q" value="<?=htmlspecialchars($q)?>"> +Node search: <input name="q" value="<?=htmlspecialchars(stripslashes($q))?>"> </form> <? if ($q != "") { ?>Found <?=count($found)?> matches.<? } ?> |
From: <il...@us...> - 2003-10-22 02:30:52
|
Update of /cvsroot/meshdb/src/geo/elev In directory sc8-pr-cvs1:/tmp/cvs-serv10327/src/geo/elev Modified Files: elev.c Log Message: Added an extra output datum indicating whether the sight line passes through any part of the earth i.e. whether there is clear line of sight. Enhancement #822086. Index: elev.c =================================================================== RCS file: /cvsroot/meshdb/src/geo/elev/elev.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- elev.c 10 Aug 2002 03:51:32 -0000 1.1.1.1 +++ elev.c 22 Oct 2003 02:27:01 -0000 1.2 @@ -67,6 +67,7 @@ double xd, yd, zd; double yscale, yoff; int i, j, k, l, ia, ib, x, y, surfy, alty; + int clearpath = 1; int imgopt = 0; int error = 0; int ch; @@ -192,6 +193,9 @@ xd = xb - xa; yd = yb - ya; zd = zb - za; dist = sqrt(xd*xd + yd*yd + zd*zd); + ia = 0.1/1.2 * w; + ib = 1.1/1.2 * w; + #if 0 fprintf(stderr, "a @ %f %f %f\n", xa, ya, za); fprintf(stderr, "b @ %f %f %f\n", xb, yb, zb); @@ -215,6 +219,8 @@ altmin = alth[i]; if (altmax < alth[i]) altmax = alth[i]; + if (i > ia && i < ib) + clearpath = clearpath && surfh[i] >= alth[i]; } if (isnanf(alta)) alta = 0; @@ -226,11 +232,12 @@ double incab, incba; geo_inclin(xa,ya,za, xb,yb,zb, &incab, &incba); - printf("%f %.9f %.9f %f %f %f %f %f %f\n", + printf("%f %.9f %.9f %f %f %f %f %f %f %d\n", dist, ba, bb, alta, altb, altmin, altmax, - incab, incba); + incab, incba, + clearpath); #if 0 fprintf(stderr, "distance from a to b: %f\n", dist); fprintf(stderr, "a: grid north at %f\n", gca * 180/M_PI); @@ -254,8 +261,6 @@ /* Find boundary of image */ yscale = 0.8 / (altmax - altmin); yoff = 0.1; - ia = 0.1/1.2 * w; - ib = 1.1/1.2 * w; img = (char *)malloc(w * h * sizeof *img); /* background 0 */ |
From: <il...@us...> - 2003-10-22 02:24:53
|
Update of /cvsroot/meshdb/www/db2 In directory sc8-pr-cvs1:/tmp/cvs-serv9890/www/db2 Modified Files: policies.html Log Message: Fixed some inconsistent whitespace (bug #810996). Index: policies.html =================================================================== RCS file: /cvsroot/meshdb/www/db2/policies.html,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- policies.html 10 Aug 2002 03:33:24 -0000 1.1.1.1 +++ policies.html 22 Oct 2003 02:22:44 -0000 1.2 @@ -29,6 +29,6 @@ </p> <hr> -<a href="..">Brisbane Mesh</a>|<a href=".">Node database</a> +<a href="..">Brisbane Mesh</a> | <a href=".">Node database</a> </body></html> |
From: <il...@us...> - 2003-10-22 02:22:45
|
Update of /cvsroot/meshdb/www/db2 In directory sc8-pr-cvs1:/tmp/cvs-serv9814/www/db2 Modified Files: about.html Log Message: Fixed a typo (bug #810996). Index: about.html =================================================================== RCS file: /cvsroot/meshdb/www/db2/about.html,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- about.html 7 Oct 2002 11:06:01 -0000 1.4 +++ about.html 22 Oct 2003 02:22:13 -0000 1.5 @@ -56,7 +56,7 @@ and the ANS-GRS80 shift table data from <a href="http://www.nrm.qld.gov.au/">NRM</a>. Here are the -<a href="grid-instructions.html">instrcutions on finding your home's +<a href="grid-instructions.html">instructions on finding your home's grid coordinates</a>. </p> |
From: <le...@us...> - 2002-10-07 11:10:47
|
Update of /cvsroot/meshdb/www/db2 In directory usw-pr-cvs1:/tmp/cvs-serv17237 Added Files: touchgraph.php Log Message: touchgraph. I had to hack the graphlayout applet a bit from touchgraph.sf.net. Here are the diffs: Index: com/touchgraph/graphlayout/GLPanel.java =================================================================== RCS file: /cvsroot/touchgraph/src/com/touchgraph/graphlayout/GLPanel.java,v retrieving revision 1.31 diff -u -u -r1.31 GLPanel.java --- com/touchgraph/graphlayout/GLPanel.java 4 Apr 2002 06:19:49 -0000 1.31 +++ com/touchgraph/graphlayout/GLPanel.java 7 Oct 2002 11:07:54 -0000 @@ -55,6 +55,7 @@ import java.awt.event.*; import javax.swing.*; import java.util.Hashtable; +import java.util.StringTokenizer; /** GLPanel contains code for adding scrollbars and interfaces to the TGPanel * The "GL" prefix indicates that this class is GraphLayout specific, and @@ -100,6 +101,18 @@ initialize(); } + /* Constructor with edge, node and center strings */ + public GLPanel(String nodes, String edges, String center) { + scrollBarHash = new Hashtable(); + tgLensSet = new TGLensSet(); + tgPanel = new TGPanel(); + hvScroll = new HVScroll(tgPanel, tgLensSet); + zoomScroll = new ZoomScroll(tgPanel); + //hyperScroll = new HyperScroll(tgPanel); + rotateScroll = new RotateScroll(tgPanel); + localityScroll = new LocalityScroll(tgPanel); + initialize(nodes, edges, center); + } /** Constructor with a Color to be used for UI background. */ @@ -142,6 +155,22 @@ setVisible(true); } + /** Initialize using nodes/edges/center parameters */ + public void initialize(String nodes, String edges, String center) { + buildPanel(); + buildLens(); + tgPanel.setLensSet(tgLensSet); + addUIs(); + try { + loadGraph(nodes, edges, center); + } catch ( TGException tge ) { + System.err.println(tge.getMessage()); + tge.printStackTrace(System.err); + } + tgPanel.setSelect(tgPanel.findNode(center)); //Select first node, so hiding works + setVisible(true); + } + /** Return the TGPanel used with this GLPanel. */ public TGPanel getTGPanel() { return tgPanel; @@ -404,6 +433,39 @@ } tgPanel.setLocale(n1,2); } + + public void loadGraph(String nodes, String edges, String center) + throws TGException { + + /* Add all the nodes in the "nodes" parameter */ + for (StringTokenizer t = new StringTokenizer(nodes, ","); + t.hasMoreTokens() ; ) { + String str = t.nextToken(); + int eqpos = str.indexOf('='); + if (eqpos < 0) { + tgPanel.addNode(str); + } else { + tgPanel.addNode(str.substring(0, eqpos), + str.substring(eqpos+1)); + } + } + + /* Add all the edges in the "edges" parameter */ + for (StringTokenizer t = new StringTokenizer(edges, ","); + t.hasMoreTokens() ; ) { + String str = t.nextToken(); + int hyphenpos = str.indexOf('-'); + if (hyphenpos > 0) { + Node r = tgPanel.findNode(str.substring(0, hyphenpos)); + Node n = tgPanel.findNode(str.substring(hyphenpos + 1)); + tgPanel.addEdge(r, n, Edge.DEFAULT_LENGTH); + } + } + + /* Set the locale to the 'center' node, with a radius of 2 */ + Node c = tgPanel.findNode(center); + tgPanel.setLocale(c,2); + } public static void main(String[] args) { Index: com/touchgraph/graphlayout/GraphLayoutApplet.java =================================================================== RCS file: /cvsroot/touchgraph/src/com/touchgraph/graphlayout/GraphLayoutApplet.java,v retrieving revision 1.15 diff -u -u -r1.15 GraphLayoutApplet.java --- com/touchgraph/graphlayout/GraphLayoutApplet.java 1 Apr 2002 05:52:15 -0000 1.15 +++ com/touchgraph/graphlayout/GraphLayoutApplet.java 7 Oct 2002 11:07:54 -0000 @@ -75,7 +75,12 @@ System.out.println(getAppletInfo()); getContentPane().setLayout(new BorderLayout()); setSize(500,500); - getContentPane().add(new GLPanel(), BorderLayout.CENTER); + //getContentPane().add(new GLPanel(), BorderLayout.CENTER); + getContentPane().add(new GLPanel( + getParameter("nodes"), + getParameter("edges"), + getParameter("center") + ), BorderLayout.CENTER); } } // end com.touchgraph.graphlayout.GraphLayoutApplet --- NEW FILE: touchgraph.php --- <? include("config.php"); $db = mysql_connect($MYSQLHOST, $MYSQLUSER, $MYSQLPASS); mysql_select_db($MYSQLDB, $db) or die(mysql_error($db)); /* Generated the Last-modified header */ $result = mysql_query("SELECT max(unix_timestamp(updated)) from admin", $db) or die(mysql_error($db)); $row = mysql_fetch_row($result); $modified = intval($row[0]); header("Content-type: text/html"); header("Last-Modified: " .gmdate("D, d M Y H:i:s", intval($modified)) ." GMT"); if (!isset($nodeid)) { if ($PREF["myid"] != 0) $nodeid = $PREF["myid"]; else $nodeid = "3"; } ?> <html> <head> <link rel="stylesheet" href="<?=$PREF["stylesheet"]?>" type="text/css"> <!-- link rel="SHORTCUT ICON" href="favicon.ico" --> <title>Brisbane Mesh TouchGraph view</title> </head> <body> <APPLET CODE="com.touchgraph.graphlayout.GraphLayoutApplet.class" ARCHIVE="jar/GraphLayout.jar" WIDTH=100% HEIGHT=100%> <PARAM NAME="nodes" VALUE="<? $q = "SELECT admin.nodeid AS nodeid, admin.nodename AS name" ." FROM admin, netloc" ." WHERE admin.nodeid = netloc.nodeid" ." GROUP BY admin.nodeid"; $comma = ""; $result = mysql_query($q, $db) or die(mysql_error($db)); while ($row = mysql_fetch_assoc($result)) { /* remove comma from the name? */ $name = htmlspecialchars($row["name"]); echo $comma.$row["nodeid"]."=$name"; $comma = ","; } ?>"> <PARAM NAME="edges" VALUE="<? $q = "SELECT admin.nodeid" .", netloc.nodeid AS nn1" .", netloc.peerid AS nn2" ." FROM admin, netloc" ." WHERE admin.nodeid = netloc.peerid"; $comma = ""; $result = mysql_query($q, $db) or die(mysql_error($db)); while ($row = mysql_fetch_assoc($result)) { /* remove comma from the name? */ echo $comma.$row["nn1"]."-".$row["nn2"]; $comma = ","; } ?>"> <PARAM NAME="center" VALUE="<?=$nodeid?>"> A Java applet that displays nodes in an interactive fashion. </APPLET> <p> This is an experimental view of the live linked database using <a href="http://touchgraph.sf.net/">TouchGraph</a>. To see all the nodes, choose minimum zoom and maximum locality. (Would be nice to make squares pop up an info box, and to be able to double click to go to the view page.) </p> <hr> <? include("footer.inc"); ?> </body> </html> |
Update of /cvsroot/meshdb/www/db2 In directory usw-pr-cvs1:/tmp/cvs-serv16243 Modified Files: about.html create.php footer.inc index.php map2b.php map2d.php view.php Added Files: map2d.inc search.php Log Message: touchgraph, searching, copyright and new local maps --- NEW FILE: map2d.inc --- <? include("util.php"); /* Return a string containing the PNG data of a map */ function getmappng($n,$e,$w,$h,$s, $src="local", $nocache=0) { global $MYSQLHOST, $MYSQLUSER, $MYSQLPASS, $MYSQLDB, $OURPROXY; global $PREFS; /* XXX XXX mapblast is not using shifted coords! XXX ie we do a direct redfearns on the east/northing and XXX use teh lat/long without shifting it. mapblast is XXX simply wrong (I have checked this with a handheld GPS) XXX So, by not correcting the redfearn equiv of the e/n, XXX mapblast will show the right visual. XXX */ /* compute the URL */ $key="$e:$n:$s:$w:$h:$src"; $db = mysql_connect($MYSQLHOST, $MYSQLUSER, $MYSQLPASS); mysql_select_db($MYSQLDB, $db) or die(mysql_error($db)); /* If the image is in the cache, use it */ $keystr = '"'.mysql_escape_string($key).'"'; if (!$_GET["nocache"]) { $result = mysql_query("SELECT img,cached FROM imgcache WHERE url = ".$keystr, $db) or die(mysql_error($db)); if ($row = mysql_fetch_row($result)) { $result2 = mysql_query("UPDATE imgcache SET retreived=NOW() WHERE url = ".$keystr, $db) or die(mysql_error($db)); return $row[0]; } } $tmpfile = tempnam("/tmp", "map2d"); $errfile = tempnam("/tmp", "map2d.err"); if ($src == "mapblast") { /* MapBlast */ list($lat,$lon) = cvtlatlon($e,$n,$noshift=1); $sc = intval(2820/doubleval($s)); $url = "http://www.mapblast.com/myblastd/MakeMap.d?CT=${lat}:${lon}:${sc}&IC=&W=${w}&H=${h}&FAM=myblast&DU=KM&LB="; $postproc = "| bin/giftopnm | bin/pnmtopng"; } else if ($src == "terra") { /* Terraserver */ $tle = intval($e-$s*$w/2); $tln = intval($n+$s*$h/2); $bre = intval($tle+$s*$w); $brn = intval($tln-$s*$h); $url = "http://64.132.109.116/ecwimage/ecw_img.dll?image?ecw=/image_data/orbimage/Orbimage_Brisbane_Australia.ecw&sizex=${w}&sizey=${h}&worldtlx=${tle}&worldtly=${tln}&worldbrx=${bre}&worldbry=${brn}"; $postproc = "| djpeg | bin/pnmscale -xysize ${w} ${h} | bin/pnmtopng"; } else if ($src == "local") { /* Local map stuff */ list($lat,$lon) = cvtlatlon($e,$n,$noshift=1); $sc = intval(1.0/doubleval($s)); $cmd = "(cd ../mapdata && ./bin/psplot -g${w}x${h} -- $lat $lon $sc < templ.ps" ."| ./bin/gdps -g${w}x${h} > $tmpfile ) 2>$errfile"; /* $cmd = "(echo 'lat=$lat'; echo 'lon=$lon'; echo 'sc=$sc') >$errfile"; */ exec("ulimit -c 0; ulimit -t 120; ".$cmd); $url = false; } else exit("unknown map source $src"); /* Do a the URL fetch if needed */ if ($url) { exec("(http_proxy=http://$OURPROXY/ wget -O /dev/stdout ".escapeshellarg($url)." ${postproc} > $tmpfile) 2>$errfile"); } /* Check for error */ $fsize = filesize($tmpfile); if ($fsize <= 0) { unlink($tmpfile); $fp = fopen($errfile, "r"); $errmsg = fread($fp, 8192); fclose($fp); $e = "** MAP IMAGE NOT AVAILABLE **\n\n"; if ($url) $e .= "$url (via $http_proxy)\n". "wget or png conversion failed\n"; $e .= $errmsg; $im = ImageCreate($w,$h); $black = ImageColorAllocate($im, 0, 0, 0); $orange = ImageColorAllocate($im, 220, 210, 60); ImageFilledRectangle($im, 0,0,$w,$h, $orange); $elines = explode("\n",$e); $y = $h/2; foreach ($elines as $e1) { ImageString($im, 1, 10, $y, $e1, $black); $y += 10; } ImagePNG($im, $tmpfile); ImageDestroy($im); $nostore = 1; $fsize = filesize($tmpfile); } else $nostore = 0; unlink($errfile); $fp = fopen($tmpfile, "r"); $imgdata = fread($fp, $fsize); fclose($fp); unlink($tmpfile); if (!$nostore) { $imgdatas = "0x".bin2hex($imgdata); /* $imgdatas = '"'.mysql_escape_string($imgdata).'"'; */ if ($fsize) { $result = mysql_query("INSERT INTO imgcache SET url=$keystr, cached=NOW(), retreived=NOW(), img=$imgdatas") or die(mysql_error($db)); } } return $imgdata; } /* Alternative map source? http://www.agso.gov.au/bin/mapserv?map=/public/data/gis_data/national/national.map&mode=map&mapext=1741461.302895+-3341453.017610+1955273.802895+-3175205.662376&layer=politicalpl&layer=roads&mapsize=450+350 */ ?> --- NEW FILE: search.php --- <? /* * Search for a node by name first, then contact name and then * in the comments. If exactly one match, redirect to viewing that * node. (only q argument needed) */ include("config.php"); $db = mysql_connect($MYSQLHOST, $MYSQLUSER, $MYSQLPASS); mysql_select_db($MYSQLDB, $db) or die(mysql_error($db)); $found = array(); # list of integers $type = array(); # match type number if (!isset($q) || trim($q) == "") { /* No argument */ $q = ""; } else { /* Convert query to lowercase and insert % signs */ $like = "%".implode("%",split("[ \t*?]+", trim(stripslashes($q))))."%"; $like = "'" . mysql_escape_string($like) . "'"; /* Search in the nodename field first */ $result = mysql_query( "SELECT nodeid" ." FROM admin" ." WHERE nodename LIKE $like", $db) or die(mysql_error($db)." (nodename like=$like)"); if (mysql_num_rows($result) > 0) { $type["nodename"] = mysql_num_rows($result); while (list($id) = mysql_fetch_array($result)) $found[] = $id; } /* next, search in the contact name */ $result = mysql_query( "SELECT admin.nodeid" ." FROM admin, contact" ." WHERE contactname LIKE $like" ." AND admin.nodeid = contact.nodeid", $db) or die(mysql_error($db)." (contactname like=$like)"); if (mysql_num_rows($result) > 0) { $type["contactname"] = mysql_num_rows($result); while (list($id) = mysql_fetch_array($result)) $found[] = $id; } /* next, search in the admin comment */ $result = mysql_query( "SELECT nodeid" ." FROM admin" ." WHERE comment LIKE $like", $db) or die(mysql_error($db)." (comment like=$like)"); if (mysql_num_rows($result) > 0) { $type["comment"] = mysql_num_rows($result); while (list($id) = mysql_fetch_array($result)) $found[] = $id; } /* next, search in the street address */ $result = mysql_query( "SELECT admin.nodeid" ." FROM admin, physaddr" ." WHERE (streetno LIKE $like OR suburb LIKE $like)" ." AND admin.nodeid = physaddr.nodeid", $db) or die(mysql_error($db)." (streetno like=$like)"); if (mysql_num_rows($result) > 0) { $type["address"] = mysql_num_rows($result); while (list($id) = mysql_fetch_array($result)) $found[] = $id; } if (count($found) > 1) $found = array_unique($found); if (count($found) == 1) { /* echo ("Redirect to: " */ header("Location: " ."http://".$HTTP_HOST.dirname($PHP_SELF) ."/view.php?nodeid=".$found[0]); exit; } } ?> <html><head> <link rel="stylesheet" href="<?=$PREF["stylesheet"]?>" type="text/css"> <title>Mesh search: <?=htmlspecialchars($q)?></title> </head> <body> <form method="get" action="search.php"> Node search: <input name="q" value="<?=htmlspecialchars($q)?>"> </form> <? if ($q != "") { ?>Found <?=count($found)?> matches.<? } ?> <? if (count($found) > 1) { ?> <ul> <? foreach ($found as $id) { $result = mysql_query("SELECT nodename FROM admin" ." WHERE nodeid = $id", $db) or die(mysql_error($db)." id=$id"); list($name) = mysql_fetch_array($result); echo "<li>#$id <a href=\"view.php?nodeid=$id\">" .htmlspecialchars($name)."</a>\n"; } ?> </ul> <!-- Breakdown: <ul> <? foreach($type as $k=>$v) printf("<li>%.0f%% by %s\n", doubleval($v)/count($found), $k); ?> </ul> --> <? } ?> <hr> <a href="about.html#search">How search works</a> <br> <? include("footer.inc"); ?> </body> </html> Index: about.html =================================================================== RCS file: /cvsroot/meshdb/www/db2/about.html,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- about.html 26 Aug 2002 13:16:53 -0000 1.3 +++ about.html 7 Oct 2002 11:06:01 -0000 1.4 @@ -27,46 +27,60 @@ <h2>Technical details on database</h2> <p> -The altitude data used by the database was bought by David Leonard from +The node data is stored in a +<a href="http://www.mysql.com/">MySQL</a> database, and +the web pages implemented with +<a href="http://www.php.net/">PHP</a>. +</p> + +<p> +The altitude data used by the database was jointly bought by David Leonard, +Kevin Fleming, Greg Canning and <q>Norbie</q> +from <a href="http://www.geomap.com.au/">Geo Mapping</a> in mid-2001. It consists of elevation samples accurate to 0.01m vertical, spaced horizontally on a 9 second (approx 270m) grid. -The data set is known as -<a href="http://www.auslig.gov.au/products/digidat/dem.htm#GEODATA 9 SECOND DEM">AUSLIG 9 second DEM</a> SG56 if you're really interested. +The data sets are known as +<a href="http://www.auslig.gov.au/products/digidat/dem.htm#GEODATA 9 SECOND DEM">AUSLIG 9 second DEM</a> SG56 and SH56 if you're really interested. +(And we should be able to get more when they all become +<a href="http://www.auslig.gov.au/products/fwdprogram/status_access_pricing_policy.htm">free in 5-10 years</a>.) +The altitude data is stored in huge unix files as a quadtree raster, +and manipulated and plotted with custom programs written in C, using +<a href="http://www.libpng.org/">libpng</a>. </p> <p> -Coordinate systems are converted using equations from the -<a href="http://www.anzlic.org.au/icsm/gdatm/">AUSLIG GDA technical manual</a>. -Here are -<a href="grid-instructions.html">some notes on finding your +UTM-to-curvilinear (easting/northing to lat/long) conversion +uses equations from the +<a href="http://www.anzlic.org.au/icsm/gdatm/">AUSLIG GDA technical manual</a>, +and the +ANS-GRS80 shift table data from <a href="http://www.nrm.qld.gov.au/">NRM</a>. +Here are the +<a href="grid-instructions.html">instrcutions on finding your home's grid coordinates</a>. </p> <p> -The topographic map display is from -<a href="http://www.mapblast.com/">MapBlast!</a>. -Previously, mapblast URLs were used to generate the images, but because of -the large number of nodes, and limits of -<a href="http://support.microsoft.com/support/kb/articles/Q208/4/27.ASP"> -some web browsers</a>, Apache and the MapBlast server itself, -this was replaced with a local program that demand-fetches the -(unannotated) MapBlast! map and then -annotates it locally based on direct database queries. +The topographic map data (coastline, roads etc.) comes from the +<a href="http://www.iscgm.org/">ISCGM</a> +(via <a href="http://www.ga.gov.au/">GA</a>) +and is rendered using some +<a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/meshdb/src/vpf/libvpf/">home-grown VPF plotting software</a> +and <a href="http://www.boutell.com/gd/">gd</a>. </p> <p> -The node database is stored using -<a href="http://www.mysql.com/">MySQL</a>, and -the web pages implemented with -<a href="http://www.php.net/">PHP</a>. -All of the map data is stored in unix files as a quadtree raster, -and manipulated with custom programs written in C. -The hardware and operating system of the server are made by -<a href="http://www.sun.com/">Sun</a>, -and the web server software is <a href="http://httpd.apache.org/">Apache</a>. +The hardware and operating system of the server are supplied by +<a href="http://www.itee.uq.edu.au/">UQ ITEE</a>, and manufactured +by <a href="http://www.sun.com/">Sun Microsystems</a>. +The web server software is <a href="http://httpd.apache.org/">Apache</a>. + +<p> All of the <a href="http://meshdb.sf.net/">source code</a> to the database scripts and mapping tools is available, if you are interested. +Also, a <a href="select.php">generic database select</a> form is available +that you can use with XSL to construct your own web pages. +Please see the <a href="../copyright.html">copyright</a> info. </p> <h2>"Powered by" credits</h2> @@ -86,9 +100,10 @@ <p align=center> <table> <tr align=center> -<td rowspan=2><a href="http://www.auslig.gov.au/"><img src="http://www.auslig.gov.au/build/images/galogo_banner.gif" alt="(AUSLIG)" width=195 height=40></a></td> +<td rowspan=2><a href="http://www.ga.gov.au/"><img src="http://www.auslig.gov.au/build/images/galogo_banner.gif" alt="Geoscience Australia (née AUSLIG)" width=195 height=40></a></td> <td rowspan=2><a href="http://www.geomap.com.au/"><img src="http://www.geomap.com.au/Effects/Logo/gmt_logo_points.gif" height=125 width=125 alt="(Geo Mapping Technologies)"></a></td> -<td><a href="http://www.mabplast.com/"><img src="http://lygo.com/ly/wg/t/mapblastlogo.gif" alt="(MapBlast!)" width=80 height=15></a></td></tr> +<td><a href="http://www.iscgm.org/"><img src="../img/GMBanner185x60.png" width=185 height=60 alt="International Steering Committee for Global Mapping"></a></td> +</tr> <tr align=center><td><a href="http://www.sun.com/logos/poweredbysun/products.html"><img src="../img/pbsun.gif" alt="(Powered by Sun)" width=122 height=76></a></td></tr> <tr align=center> <td colspan=3><a href="http://www.uq.edu.au/"><img src="http://www.uq.edu.au/images/uq-logo-new.gif" alt="(The University of Queensland)" width=184 height=60></a></td></tr> @@ -96,6 +111,30 @@ </p> </ul> +<h2 id="search">How search works</h2> +<p>The +<a href="search.php">search utility</a> +is not a comprehensive search. It is intended +as a convenience for jumping to a node if you know just a little info about +it. However, it can help you to know how search works so you can understand +its limitations. +</p> +<p> +First, the given search string has its whitespace replaced with SQL wildcard +characters ('%'), and then LIKE-matches are done on the following fields in +the database, +in the given order: +node name, contact name, comment text, street address/suburb. +Only if the whole pattern is found in one of these fields is it displayed. +At the head of the list are results that matches the node name; next +those that matched contact name, and so on. +</p> +<p> +If only one match is found, you are redirected to the node's page +immediately. +</p> + + <h2>Disclaimers</h2> <p> @@ -116,8 +155,9 @@ </p> <hr> -<a href="..">Brisbane Mesh</a> +<a href="..">Brisbane Mesh</a> | +<a href="../copyright.html">© 2002</a> +<!-- $Id$ --> </body> </html> -<!-- $Id$ --> Index: create.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/create.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- create.php 10 Aug 2002 03:33:24 -0000 1.1.1.1 +++ create.php 7 Oct 2002 11:06:02 -0000 1.2 @@ -26,6 +26,8 @@ information (like a public noticeboard). Please do <strong>not</strong> enter information that you wish to be kept private. +Note that you retain the <a href="../copyright.html">copyright</a> +in the information you provide. Thankyou. <p> Index: footer.inc =================================================================== RCS file: /cvsroot/meshdb/www/db2/footer.inc,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- footer.inc 10 Aug 2002 03:34:07 -0000 1.1.1.1 +++ footer.inc 7 Oct 2002 11:06:02 -0000 1.2 @@ -15,3 +15,5 @@ echo "<a href=\".\">Database index</a> | "; ?> <a href="../">Brisbane Mesh home</a> +<br> +<a href="../copyright.html">© 2002</a> Index: index.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/index.php,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- index.php 26 Aug 2002 14:21:02 -0000 1.5 +++ index.php 7 Oct 2002 11:06:02 -0000 1.6 @@ -69,6 +69,10 @@ printf("$nentries active interfaces"); ?>. +<form method=get action="search.php"> +Node search: <input name="q"> +</form> + <ul><li><strong><? if (!$READONLY) { ?><a href="create.php">Create a new node entry</a><? } else { Index: map2b.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/map2b.php,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- map2b.php 10 Aug 2002 11:42:39 -0000 1.3 +++ map2b.php 7 Oct 2002 11:06:02 -0000 1.4 @@ -6,6 +6,7 @@ */ include("config.php"); +include("map2d.inc"); $w = intval($_GET["w"]); $h = intval($_GET["h"]); @@ -22,7 +23,9 @@ } /* Load the mapblast map */ -$im = ImageCreateFromPNG("http://box:80/~mesh/db2/map2d.php?w=$w&h=$h&s=$s&e=$e&n=$n"); +$pngdata = getmappng($n,$e,$w,$h,$s); +$im = ImageCreateFromString($pngdata); +/* "http://box:80/~mesh/db2/map2d.php?w=$w&h=$h&s=$s&e=$e&n=$n" */ if (!$im) die("image load failed"); $db = mysql_connect($MYSQLHOST, $MYSQLUSER, $MYSQLPASS); Index: map2d.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/map2d.php,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- map2d.php 28 Aug 2002 22:42:29 -0000 1.4 +++ map2d.php 7 Oct 2002 11:06:02 -0000 1.5 @@ -7,7 +7,7 @@ */ include("config.php"); -include("util.php"); +include("map2d.inc"); /* convert e/n to lat/lon using redfearn's formula */ $w = intval($_GET["w"]); @@ -16,102 +16,17 @@ $n = doubleval($_GET["n"]); $e = doubleval($_GET["e"]); -/* - XXX - XXX mapblast is not using shifted coords! - XXX ie we do a direct redfearns on the east/northing and - XXX use teh lat/long without shifting it. mapblast is - XXX simply wrong (I have checked this with a handheld GPS) - XXX So, by not correcting the redfearn equiv of the e/n, - XXX mapblast will show the right visual. - XXX -*/ -list($lat,$lon) = cvtlatlon($e,$n,$noshift=1); - -/* compute scale according to my guestimate */ -$sc = intval(2820/doubleval($s)); - -$mburl = "http://www.mapblast.com/gif?CT=${lat}:${lon}:${sc}&IC=&W=${w}&H=${h}&FAM=myblast&DU=KM&LB="; +if (!isset($_GET["src"])) + $src = "local" /* "mapblast" */; +else + $src = $_GET["src"]; header("X-MGA66-coord: $e $n"); -header("X-GPS-coord: $lat $lon"); header("X-scale: $s m/pixel"); -header("X-source: $mburl"); - -$db = mysql_connect($MYSQLHOST, $MYSQLUSER, $MYSQLPASS); -mysql_select_db($MYSQLDB, $db) - or die(mysql_error($db)); - -/* If the image is in the cache, use it */ -$mburls = '"'.mysql_escape_string($mburl).'"'; -if (!$_GET["nocache"]) { - $result = mysql_query("SELECT img,cached FROM imgcache WHERE url = ".$mburls, $db) - or die(mysql_error($db)); - if ($row = mysql_fetch_row($result)) { - $result2 = mysql_query("UPDATE imgcache SET retreived=NOW() WHERE url = ".$mburls, $db) - or die(mysql_error($db)); - header("X-cached: ".$row[1]); /* XXX should be modified date */ - header("Content-type: image/png"); - echo $row[0]; - exit; - } -} - -$tmpfile = tempnam("/tmp", "mapblast"); -$errfile = tempnam("/tmp", "mapblasterr"); -exec("(http_proxy=http://$OURPROXY/ wget -O /dev/stdout ".escapeshellarg($mburl)." | bin/giftopnm | bin/pnmtopng > $tmpfile) 2>$errfile"); -/* XXX bin/giftopng */ -$fsize = filesize($tmpfile); -if ($fsize <= 0) { - unlink($tmpfile); - $fp = fopen($errfile, "r"); - $errmsg = fread($fp, 8192); - fclose($fp); - unlink($errfile); - $e = "$mburl (via $http_proxy)\n". - "wget or png conversion failed\n". - $errmsg; - - $im = ImageCreate($w,$h); - $black = ImageColorAllocate($im, 0, 0, 0); - $orange = ImageColorAllocate($im, 220, 210, 60); - ImageFilledRectangle($im, 0,0,$w,$h, $orange); - - $elines = explode("\n",$e); - $y = $h/2; - foreach ($elines as $e1) { - ImageString($im, 1, 10, $y, $e1, $black); - $y += 10; - } - - header("Content-type: image/png"); - ImagePNG($im); - - ImageDestroy($im); - exit; -} -unlink($errfile); -$fp = fopen($tmpfile, "r"); -$imgdata = fread($fp, $fsize); -fclose($fp); -unlink($tmpfile); - -$imgdatas = "0x".bin2hex($imgdata); -/* $imgdatas = '"'.mysql_escape_string($imgdata).'"'; */ - -if ($fsize) { - $result = mysql_query("INSERT INTO imgcache SET url=$mburls, cached=NOW(), retreived=NOW(), img=$imgdatas") - or die(mysql_error($db)); -} +$imgdata = getmappng($n,$e,$w,$h,$s,$src); header("Content-type: image/png"); print $imgdata; - exit; - -/* -Alternative map source? -http://www.agso.gov.au/bin/mapserv?map=/public/data/gis_data/national/national.map&mode=map&mapext=1741461.302895+-3341453.017610+1955273.802895+-3175205.662376&layer=politicalpl&layer=roads&mapsize=450+350 -*/ ?> Index: view.php =================================================================== RCS file: /cvsroot/meshdb/www/db2/view.php,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- view.php 26 Aug 2002 14:21:02 -0000 1.4 +++ view.php 7 Oct 2002 11:06:02 -0000 1.5 @@ -143,10 +143,18 @@ <body> <h1>View node #<?=$nodeid?>: <?=val("admin[nodename]")?></h1> +<form action="search.php" method=get> +<table width="100%"> +<tr><td> <ul> <li><a href="edit.php?nodeid=<?=$nodeid?>">Edit this node entry</a> <li><a href="index.php">Return to index</a> </ul> +<td><div align=right> +Search: <input name="q"> +</div> +</table> +</form> <table> <tr valign=top> @@ -161,6 +169,7 @@ <tr><th colspan=3 class="major">Network interfaces (cards + antennas)</th></tr> <? include("view-netloc.inc.php"); ?> </table> + <a href="touchgraph.php?nodeid=<?=$nodeid?>">Show touchgraph</a> <? } ?> <? $q = "SELECT address,nodename,admin.nodeid AS nodeid,ifname FROM admin,netloc". @@ -287,7 +296,6 @@ <a href="<?=selfurl(array("zoom"=>$zoom*2))?>">in</a> | <a href="<?=selfurl(array("zoom"=>$zoom/2))?>">out</a> <br> - Map data from <a href="http://www.mapblast.com/">MapBlast!</a> </td></tr> <? } else if ($maptype == "ter") { ?> <tr><th class="minor">Terrain</th></tr> |
From: <le...@us...> - 2002-09-19 03:56:52
|
Update of /cvsroot/meshdb/src/vpf/psplot In directory usw-pr-cvs1:/tmp/cvs-serv19947 Modified Files: psplot.c Log Message: omit non-essential verticies to speed up some complex plots Index: psplot.c =================================================================== RCS file: /cvsroot/meshdb/src/vpf/psplot/psplot.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- psplot.c 15 Sep 2002 12:58:30 -0000 1.3 +++ psplot.c 19 Sep 2002 03:56:48 -0000 1.4 @@ -380,6 +380,17 @@ die("%s: unknown feature", arg); } +/* Return visibility sector of a point. 0 means visible */ +unsigned char +sector(x, y) + float x, y; +{ + return (x < ux1 ? 1 : 0) + | (x > ux2 ? 2 : 0) + | (y < uy1 ? 4 : 0) + | (y > uy2 ? 8 : 0); +} + /* * fetch an edge and plot it with moveto/lineto. * If the edge is totally invisible, ignore it, @@ -400,6 +411,8 @@ int lineto, mandatory; { int i, invisible, len, fwd; + double lastx, lasty; + char lastsector, lastdone; vpftab_seek(ebr, id); if (vpftab_fetch(ebr)) @@ -432,16 +445,35 @@ puts(ps_lineto); return; } - if (fwd) - for (i = 0; i < len; i++) { - printcoord(zarray[i][0], zarray[i][1]); - puts((i||lineto) ? ps_lineto : ps_moveto); - } - else - for (i = len - 1; i >= 0; i--) { - printcoord(zarray[i][0], zarray[i][1]); - puts((i < len-1 || lineto) ? ps_lineto : ps_moveto); + + /* Always do the first point */ + lastx = zarray[fwd ? 0 : len - 1][0]; + lasty = zarray[fwd ? 0 : len - 1][1]; + printcoord(lastx, lasty); + puts(lineto ? ps_lineto : ps_moveto); + lastdone = 1; + lastsector = sector(lastx, lasty); + + for (i = 1; i < len; i++) { + float x = zarray[fwd ? i : len - 1 - i][0]; + float y = zarray[fwd ? i : len - 1 - i][1]; + char s = sector(x, y); + + if (s != lastsector && !lastdone) { + printcoord(lastx, lasty); + puts(ps_lineto); } + if (s == 0 || s != lastsector || i == len - 1) { + printcoord(x, y); + puts(ps_lineto); + lastdone = 1; + } else + lastdone = 0; + lastx = x; + lasty = y; + lastsector = s; + } + } /* Plot the parts of a feature that match the given predicates */ @@ -904,7 +936,8 @@ { "closepath", ps_closepath }, { "newpath", ps_newpath }, }; - char *p, *name, *buf, *b, i; + char *p, *name, *buf, *b; + int i; p = arg; for (;;) { @@ -936,7 +969,6 @@ double maxwidth = 100; char *p; double span; /* in meters */ - double width; int count, segments, l; char *pfx = ""; char diststr[20]; @@ -983,9 +1015,9 @@ else if (l == 15) pfx = "T"; else pfx = "?"; - snprintf(diststr, sizeof diststr, "%d%sm", segments, pfx); + snprintf(diststr, sizeof diststr, "%d%sm", count, pfx); - printf("(%s) %d %g\n", diststr, count, span * scale); + printf("(%s) %d %g\n", diststr, segments, span * scale); } /* Process a "%.COMMAND" line including .IF/.ENDIF expressions */ |
From: <le...@us...> - 2002-09-18 06:41:08
|
Update of /cvsroot/meshdb/src/vpf/gdps In directory usw-pr-cvs1:/tmp/cvs-serv15360 Modified Files: draw.c Log Message: fix broken polygon fill. (i had forgotten to exclude scan-converted vertex maxima) Index: draw.c =================================================================== RCS file: /cvsroot/meshdb/src/vpf/gdps/draw.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- draw.c 18 Sep 2002 04:30:35 -0000 1.3 +++ draw.c 18 Sep 2002 06:41:02 -0000 1.4 @@ -262,18 +262,12 @@ continue; if (a->y == b->y) { - /* ignore zero-length edges */ - if (a->x == b->x) - continue; - isect[nisect].twist = (a->x < b->x) ? +1 : -1; - isect[nisect].cross = 1; - isect[nisect].x = a->x; - nisect++; - isect[nisect].twist = !(a->x < b->x) ? +1 : -1; - isect[nisect].cross = 1; - isect[nisect].x = b->x; - nisect++; + /* ignore horizontals */ } else { + /* Ignore vertex maxima */ + if (a->y == y && b->y < y) continue; + if (b->y == y && a->y < y) continue; + isect[nisect].twist = (a->y < b->y) ? +1 : -1; isect[nisect].cross = 1; isect[nisect].x = a->x + |
From: <le...@us...> - 2002-09-18 04:30:41
|
Update of /cvsroot/meshdb/src/vpf/gdps In directory usw-pr-cvs1:/tmp/cvs-serv14707 Modified Files: draw.c error.c main.c object.h operator.c run.c Log Message: fix some broken operators up (sub, repeat). fix runproc so that it pushes subprocs instead of run them. fix up 'show' so that text is displayed closer to the effective baseline Index: draw.c =================================================================== RCS file: /cvsroot/meshdb/src/vpf/gdps/draw.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- draw.c 18 Sep 2002 03:22:46 -0000 1.2 +++ draw.c 18 Sep 2002 04:30:35 -0000 1.3 @@ -97,15 +97,16 @@ if (!gs->font) die("no font has been set"); - if (!noshow) - path_current(gs->path, &x, &y); - else - x = y = 0; font_getinfo(gs->font, &fontname, &scale); vmag = GSTATE_VMAG(gs); angle = GSTATE_ANGLE(gs); + if (!noshow) + path_current(gs->path, &x, &y); + else + x = y = 0; + if (slen == 0 || scale == 0 || vmag == 0) { /* Special case of the empty string or zero scale */ *wxp = *wyp = 0; @@ -115,6 +116,7 @@ } col = getcolor(gs); + y -= vmag * scale * 0.2; /* hack for descenders */ physx = GSTATE_X(gs, x, y); physy = GSTATE_Y(gs, x, y); Index: error.c =================================================================== RCS file: /cvsroot/meshdb/src/vpf/gdps/error.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- error.c 17 Sep 2002 13:48:09 -0000 1.1 +++ error.c 18 Sep 2002 04:30:36 -0000 1.2 @@ -4,6 +4,7 @@ #include <stdarg.h> #include <stdio.h> #include "error.h" +#include "object.h" const char *error_loc = NULL; int error_lineno = 0; @@ -13,13 +14,34 @@ die(const char *fmt, ...) { va_list ap; + object_t *o = NULL; + int showobj; if (error_lineno) fprintf(stderr, "line %d: ", error_lineno); if (error_loc) fprintf(stderr, "error in '%s': ", error_loc); + va_start(ap, fmt); + + if (fmt[0] == '!') { + showobj = 1; + o = va_arg(ap, object_t *); + fmt++; + } else + showobj = 0; + vfprintf(stderr, fmt, ap); + + if (showobj) { + fprintf(stderr, " [object is "); + if (!o) + fprintf(stderr, "(null)"); + else + (*o->type->print)(o, stderr); + fprintf(stderr, "]"); + } + fprintf(stderr, "\n"); exit(1); } Index: main.c =================================================================== RCS file: /cvsroot/meshdb/src/vpf/gdps/main.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- main.c 18 Sep 2002 03:22:46 -0000 1.2 +++ main.c 18 Sep 2002 04:30:36 -0000 1.3 @@ -53,7 +53,7 @@ } /* Set up initial global state and erase the page */ - gstate_init(&gs, gdImageCreate(width, height)); + gstate_init(&gs, gdImageCreateTrueColor(width, height)); run_name(&gs, "erasepage"); /* Run standard input */ Index: object.h =================================================================== RCS file: /cvsroot/meshdb/src/vpf/gdps/object.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- object.h 17 Sep 2002 13:48:09 -0000 1.1 +++ object.h 18 Sep 2002 04:30:36 -0000 1.2 @@ -44,7 +44,7 @@ #define ASSERT_TYPE(o,t) do { \ if ((o)->type != (t)) \ - die("object type not " #t); \ + die("!object type not " #t, o); \ } while (0) extern object_t *True, *False, *Mark, *Null; Index: operator.c =================================================================== RCS file: /cvsroot/meshdb/src/vpf/gdps/operator.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- operator.c 18 Sep 2002 03:22:46 -0000 1.2 +++ operator.c 18 Sep 2002 04:30:36 -0000 1.3 @@ -282,12 +282,12 @@ signed int a, b; a = integer(gs); b = integer(gs); - PUSH(integer_new(a-b)); + PUSH(integer_new(b-a)); } else { double a, b; a = real(gs); b = real(gs); - PUSH(real_new(a-b)); + PUSH(real_new(b-a)); } } @@ -692,20 +692,20 @@ AT(3)->type == &type_integer) { signed long int ini, inc, lim; + proc = POP(); lim = integer(gs); inc = integer(gs); ini = integer(gs); - proc = POP(); for (; ini <= lim; ini += inc) { PUSH(integer_new(ini)); run_object(gs, proc); } } else { double ini, inc, lim; + proc = POP(); lim = real(gs); inc = real(gs); ini = real(gs); - proc = POP(); for (; ini <= lim; ini += inc) { PUSH(real_new(ini)); run_object(gs, proc); @@ -718,12 +718,16 @@ o_repeat(gs) struct gstate *gs; { - int count = integer(gs); - object_t *p = POP(); + int count; + object_t *proc; + + proc = POP(); + count = integer(gs); while (count-- > 0) - run_object(gs, p); - DECREF(p); + run_object(gs, proc); + + DECREF(proc); } static void Index: run.c =================================================================== RCS file: /cvsroot/meshdb/src/vpf/gdps/run.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- run.c 17 Sep 2002 13:48:09 -0000 1.1 +++ run.c 18 Sep 2002 04:30:36 -0000 1.2 @@ -99,8 +99,15 @@ if (!array_isexecutable(proc)) die("runproc: array not executable"); len = array_len(proc); - for (i = 0; i < len; i++) - run_object(gs, array_at(proc, i)); + for (i = 0; i < len; i++) { + object_t *o = array_at(proc, i); + + /* XXX inner proces are never run */ + if (o->type == &type_array && array_isexecutable(o)) + stack_push(gs->stack, o); + else + run_object(gs, o); + } } /* Convenience function for running a name */ |
Update of /cvsroot/meshdb/src/vpf/gdps In directory usw-pr-cvs1:/tmp/cvs-serv985 Modified Files: Makefile.common NOTES draw.c draw.h gstate.c gstate.h main.c operator.c path.c Added Files: font.c font.h Log Message: add font support --- NEW FILE: font.c --- /* $Id: font.c,v 1.1 2002/09/18 03:22:46 leonard Exp $ */ /* David Leonard, 2002. Public domain. */ /* * Font operations */ #include <stdio.h> #include <math.h> #include <stdlib.h> #include "vector.h" #include "object.h" #include "stack.h" #include "gstate.h" #include "font.h" #include "error.h" struct obj_font { object_t obj; const char *name; double scale; }; static void font_print(o, file) object_t *o; FILE *file; { struct obj_font *f = (struct obj_font *)o; ASSERT_TYPE(o, &type_font); fprintf(file, "<font '%s' scale %g>", f->name, f->scale); } struct type type_font = { "font", sizeof (struct obj_font), object_free, font_print }; object_t * font_new(name) const char *name; { struct obj_font *f; NEW_OBJECT(f, &type_font); f->name = name; f->scale = 1; return (object_t *)f; } object_t * font_new_scaled(o, scale) object_t *o; double scale; { struct obj_font *f; struct obj_font *fbase = (struct obj_font *)o; ASSERT_TYPE(o, &type_font); NEW_OBJECT(f, &type_font); f->name = fbase->name; f->scale = fbase->scale * scale; return (object_t *)f; } void font_getinfo(o, namep, scalep) object_t *o; const char **namep; double *scalep; { struct obj_font *f = (struct obj_font *)o; ASSERT_TYPE(o, &type_font); *namep = f->name; *scalep = f->scale; } static struct { const char *name, *path; } fonts[] = { { "Courier", "cour" }, { "Helvetica", "arial" }, { "Times-Roman", "times" }, }; void font_addfonts(gs) struct gstate *gs; { object_t *fontrsrc, *f; int i; fontrsrc = dictionary_gets(gs->rsrc, "Font", 4); for (i = 0; i < sizeof fonts / sizeof fonts[0]; i++) { f = font_new(fonts[i].path); dictionary_puts(fontrsrc, fonts[i].name, strlen(fonts[i].name), f); } } --- NEW FILE: font.h --- extern struct type type_font; object_t * font_new(const char *); object_t * font_new_scaled(object_t *, double); void font_getinfo(object_t *, const char **, double *); void font_addfonts(struct gstate *); Index: Makefile.common =================================================================== RCS file: /cvsroot/meshdb/src/vpf/gdps/Makefile.common,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile.common 17 Sep 2002 13:48:09 -0000 1.1 +++ Makefile.common 18 Sep 2002 03:22:46 -0000 1.2 @@ -2,11 +2,11 @@ PROG= gdps SRCS = error.c main.c object.c stack.c tokenizer.c hash.c file.c path.c -SRCS+= gstate.c operator.c run.c draw.c +SRCS+= gstate.c operator.c run.c draw.c font.c LDADD= -lm NOMAN= DEBUG= -O2 -ggdb -Wall -CPPFLAGS= -I../gd-2.0.1 -LDFLAGS= -L../gd-2.0.1 -L/usr/local/lib -LDADD+= -lpng -lgd +CPPFLAGS= -I$$HOME/src/gd/gd-2.0.1 +LDFLAGS= -L$$HOME/src/gd/gd-2.0.1 -L/usr/local/lib -L/usr/X11R6/lib +LDADD+= -lpng -lz -lfreetype -lgd Index: NOTES =================================================================== RCS file: /cvsroot/meshdb/src/vpf/gdps/NOTES,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- NOTES 17 Sep 2002 13:48:09 -0000 1.1 +++ NOTES 18 Sep 2002 03:22:46 -0000 1.2 @@ -9,4 +9,10 @@ The last showpage (or copypage) encountered writes the image to the given file (usually stdout) and exits. +To use fonts, make sure that the environment variable GDFONTPATH +is set. (Font files called <font>.ttf might stay there). +Free font info at http://home.bsu.edu/prn/fonts.html. Also, plenty +of ttf files are found in C:\WINDOWS\FONTS\ that you might +copy out. + $Id$ Index: draw.c =================================================================== RCS file: /cvsroot/meshdb/src/vpf/gdps/draw.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- draw.c 17 Sep 2002 13:48:09 -0000 1.1 +++ draw.c 18 Sep 2002 03:22:46 -0000 1.2 @@ -9,15 +9,19 @@ #include <math.h> #include <gd.h> #include <stdlib.h> +#include "error.h" #include "vector.h" #include "object.h" #include "stack.h" #include "gstate.h" #include "path.h" #include "draw.h" +#include "font.h" static int getcolor(struct gstate *); static void pos(struct gstate *, path_t *, int, int *, int *); +static void draw_string(struct gstate *, const char *, int, + double *, double *, double *, double *, int); static void pos(gs, p, i, xp, yp) @@ -69,14 +73,100 @@ } } -void -draw_show(gs, x, y, s, slen) +/* + * Draw/compute a string and its dimensions + */ +static void +draw_string(gs, s, slen, wxp, wyp, exp, eyp, noshow) struct gstate *gs; + const char *s; + int slen; + double *wxp, *wyp; + double *exp, *eyp; + int noshow; +{ double x, y; + const char *fontname; + double scale; + double vmag, angle; + int col, physx, physy; + int brect[8]; + const char *err; + char *string; + + if (!gs->font) + die("no font has been set"); + + if (!noshow) + path_current(gs->path, &x, &y); + else + x = y = 0; + font_getinfo(gs->font, &fontname, &scale); + + vmag = GSTATE_VMAG(gs); + angle = GSTATE_ANGLE(gs); + + if (slen == 0 || scale == 0 || vmag == 0) { + /* Special case of the empty string or zero scale */ + *wxp = *wyp = 0; + *exp = x; + *eyp = y; + return; + } + + col = getcolor(gs); + physx = GSTATE_X(gs, x, y); + physy = GSTATE_Y(gs, x, y); + + string = alloca(slen + 1); + memcpy(string, s, slen); + string[slen] = '\0'; + + if (!noshow) { + err = gdImageStringFT(gs->im, brect, col, + (char *)fontname, scale*vmag, -angle, + physx, physy, + string); + if (err) die("draw_string: %s (font '%s' angle %g scale %g)", + err, fontname, angle, scale * vmag); + } + + /* Figure out the dimensions if drawn normally XXX */ + err = gdImageStringFT(NULL, brect, col, (char *)fontname, + scale*vmag, 0, 0, 0, string); + + if (err) die("draw_string: %s (font '%s' scale %g)", + err, fontname, scale * vmag); + + *wxp = brect[4] / vmag; + *wyp = -brect[5] / vmag; + *exp = x + brect[4] / vmag; + *eyp = y; +} + +void +draw_show(gs, s, slen) + struct gstate *gs; const char *s; int slen; { - /* fonts and stuff */ + double wx, wy; + double ex, ey; + + draw_string(gs, s, slen, &wx, &wy, &ex, &ey, 0); + path_reset(gs->path); + path_moveto(gs->path, ex, ey); +} + +void +draw_stringwidth(gs, s, slen, wxp, wyp) + struct gstate *gs; + const char *s; + int slen; + double *wxp, *wyp; +{ + double ex, ey; + draw_string(gs, s, slen, wxp, wyp, &ex, &ey, 1); } void Index: draw.h =================================================================== RCS file: /cvsroot/meshdb/src/vpf/gdps/draw.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- draw.h 17 Sep 2002 13:48:09 -0000 1.1 +++ draw.h 18 Sep 2002 03:22:46 -0000 1.2 @@ -1,6 +1,9 @@ /* $Id$ */ /* David Leonard, 2002. Public domain. */ + void draw_stroke(struct gstate *, path_t *); void draw_fill(struct gstate *, path_t *, int); -void draw_show(struct gstate *, double, double, const char *, int); void draw_erase(struct gstate *); +void draw_show(struct gstate *, const char *, int); +void draw_stringwidth(struct gstate *, const char *, int, + double *, double *); Index: gstate.c =================================================================== RCS file: /cvsroot/meshdb/src/vpf/gdps/gstate.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- gstate.c 17 Sep 2002 13:48:09 -0000 1.1 +++ gstate.c 18 Sep 2002 03:22:46 -0000 1.2 @@ -7,12 +7,14 @@ #include <stdio.h> #include <math.h> +#include "error.h" #include "vector.h" #include "object.h" #include "stack.h" #include "gstate.h" #include "operator.h" #include "path.h" +#include "font.h" void gstate_init(gs, im) @@ -27,10 +29,11 @@ gs->ctm.d = -1; gs->ctm.tx = 0; gs->ctm.ty = gs->im->sy; - gs->color.r = 1; - gs->color.g = 1; - gs->color.b = 1; + gs->color.r = 0; + gs->color.g = 0; + gs->color.b = 0; gs->linewidth = 1; + gs->font = NULL; gs->stack = stack_new(); gs->global = dictionary_new(); @@ -40,6 +43,13 @@ array_append(gs->dicts, gs->user); operator_store(gs->global); gs->path = path_new(); + + /* Resource directory */ + gs->rsrc = dictionary_new(); + dictionary_puts(gs->rsrc, "Font", 4, dictionary_new()); + + /* Add fonts to the Font resource */ + font_addfonts(gs); } /* Multiply new matrix with oldCTM to get newCTM */ @@ -91,4 +101,32 @@ dict = array_at(gs->dicts, array_len(gs->dicts) - 1); dictionary_put(dict, name, value); +} + +object_t * +gstate_rsrc_get(gs, key, cat, catlen) + struct gstate *gs; + object_t *key; + const char *cat; + int catlen; +{ + object_t *rsrcdict = dictionary_gets(gs->rsrc, cat, catlen); + + if (!rsrcdict) + die("unknown resource category '%.*s'", catlen, cat); + return dictionary_get(rsrcdict, key); +} + +void +gstate_rsrc_put(gs, key, inst, cat, catlen) + struct gstate *gs; + object_t *key, *inst; + const char *cat; + int catlen; +{ + object_t *rsrcdict = dictionary_gets(gs->rsrc, cat, catlen); + + if (!rsrcdict) + die("unknown resource category '%.*s'", catlen, cat); + dictionary_put(rsrcdict, key, inst); } Index: gstate.h =================================================================== RCS file: /cvsroot/meshdb/src/vpf/gdps/gstate.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- gstate.h 17 Sep 2002 13:48:09 -0000 1.1 +++ gstate.h 18 Sep 2002 03:22:46 -0000 1.2 @@ -11,11 +11,13 @@ double r,g,b; } color; double linewidth; + object_t *font; stack_t *stack; object_t *global; /* global dict */ object_t *user; /* user dict */ object_t *dicts; /* array */ + object_t *rsrc; /* dictionary */ struct gdImageStruct *im; struct path *path; @@ -27,6 +29,13 @@ #define GSTATE_Y(gs, x, y) \ ((gs)->ctm.b*(x) + (gs)->ctm.d*(y) + (gs)->ctm.ty) +/* Absolute scaling of the unit vertical vector */ +#define GSTATE_VMAG(gs) \ + sqrt((gs)->ctm.c * (gs)->ctm.c + (gs)->ctm.d * (gs)->ctm.d) +/* Horizontal angle in radias */ +#define GSTATE_ANGLE(gs) \ + (gs->ctm.b ? atan2((gs)->ctm.b, (gs)->ctm.a) : 0) + /* Apply a transformation matrix to the CTM */ #define GSTATE_SCALE(gs, sx, sy) \ gstate_ctm(gs, sx,0, 0,sy, 0,0) @@ -40,3 +49,5 @@ void gstate_init(struct gstate *, struct gdImageStruct *); object_t *gstate_load(struct gstate *, object_t *); void gstate_store(struct gstate *, object_t *, object_t *); +object_t *gstate_rsrc_get(struct gstate *, object_t *, const char *, int); +void gstate_rsrc_put(struct gstate *, object_t *, object_t *, const char *, int); Index: main.c =================================================================== RCS file: /cvsroot/meshdb/src/vpf/gdps/main.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- main.c 17 Sep 2002 13:48:09 -0000 1.1 +++ main.c 18 Sep 2002 03:22:46 -0000 1.2 @@ -53,7 +53,7 @@ } /* Set up initial global state and erase the page */ - gstate_init(&gs, gdImageCreateTrueColor(width, height)); + gstate_init(&gs, gdImageCreate(width, height)); run_name(&gs, "erasepage"); /* Run standard input */ Index: operator.c =================================================================== RCS file: /cvsroot/meshdb/src/vpf/gdps/operator.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- operator.c 17 Sep 2002 13:48:09 -0000 1.1 +++ operator.c 18 Sep 2002 03:22:46 -0000 1.2 @@ -20,6 +20,7 @@ #include "run.h" #include "path.h" #include "draw.h" +#include "font.h" /* Quick stack macros. Assumes gs local var. */ #define AT(i) stack_at(gs->stack, (i)) /* 0 = top */ @@ -492,6 +493,39 @@ DECREF(p); } +/* Matrix */ +static void +translate(gs) + struct gstate *gs; +{ + double tx, ty; + + ty = real(gs); + tx = real(gs); + GSTATE_TRANSLATE(gs, tx, ty); +} + +static void +rotate(gs) + struct gstate *gs; +{ + double a; + + a = real(gs) * M_PI / 180; + GSTATE_ROTATE(gs, a); +} + +static void +scale(gs) + struct gstate *gs; +{ + double sx, sy; + + sy = real(gs); + sx = real(gs); + GSTATE_SCALE(gs, sx, sy); +} + /* String */ static void string(gs) @@ -872,6 +906,73 @@ } static void +findfont(gs) + struct gstate *gs; +{ + object_t *key = POP(); + object_t *o; + + o = gstate_rsrc_get(gs, key, "Font", 4); + if (!o) + die("Unknown font"); + INCREF(o); + PUSH(o); +} + +static void +setfont(gs) + struct gstate *gs; +{ + object_t *font = POP(); + if (font->type != &type_font) + die("not a font"); + if (gs->font) + DECREF(gs->font); + gs->font = font; +} + +static void +scalefont(gs) + struct gstate *gs; +{ + object_t *font; + object_t *o; + double scale; + + scale = real(gs); + font = POP(); + + o = font_new_scaled(font, scale); + PUSH(o); + DECREF(font); +} + +static void +stringwidth(gs) + struct gstate *gs; +{ + object_t *str = POP(); + double wx,wy; + + draw_stringwidth(gs, + string_str(str), string_len(str), + &wx, &wy); + PUSH(real_new(wx)); + PUSH(real_new(wy)); + DECREF(str); +} + +static void +show(gs) + struct gstate *gs; +{ + object_t *str = POP(); + + draw_show(gs, string_str(str), string_len(str)); + DECREF(str); +} + +static void notimpl(gs) struct gstate *gs; { @@ -930,6 +1031,10 @@ { "le", le }, { "lt", lt }, + { "translate", translate }, + { "scale", scale }, + { "rotate", rotate }, + { "exec", o_exec }, { "if", o_if }, { "ifelse", o_ifelse }, @@ -954,11 +1059,11 @@ { "clip", notimpl }, - { "findfont", notimpl }, - { "setfont", notimpl }, - { "scalefont", notimpl }, - { "stringwidth",notimpl }, - { "show", notimpl }, + { "findfont", findfont }, + { "setfont", setfont }, + { "scalefont", scalefont }, + { "stringwidth",stringwidth }, + { "show", show }, { "erasepage", erasepage }, { "showpage", showpage }, Index: path.c =================================================================== RCS file: /cvsroot/meshdb/src/vpf/gdps/path.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- path.c 17 Sep 2002 13:48:09 -0000 1.1 +++ path.c 18 Sep 2002 03:22:46 -0000 1.2 @@ -107,7 +107,7 @@ struct coord *c; if (VECTOR_LEN(&p->pathseg) == 0) - die("path_current: no path"); + die("no current point"); s = &VECTOR_AT(&p->pathseg, VECTOR_LEN(&p->pathseg)-1); if (s->closed) c = &VECTOR_AT(&p->coord, s->start); |
From: <le...@us...> - 2002-09-17 13:41:21
|
Update of /cvsroot/meshdb/src/vpf/gdps In directory usw-pr-cvs1:/tmp/cvs-serv14883/gdps Log Message: Directory /cvsroot/meshdb/src/vpf/gdps added to the repository |
From: <le...@us...> - 2002-09-15 13:56:25
|
Update of /cvsroot/meshdb/src/geo/compat In directory usw-pr-cvs1:/tmp/cvs-serv19455 Modified Files: compat.h Log Message: add lots of stuff for solaris needed by vpf Index: compat.h =================================================================== RCS file: /cvsroot/meshdb/src/geo/compat/compat.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- compat.h 15 Sep 2002 12:58:29 -0000 1.2 +++ compat.h 15 Sep 2002 13:56:22 -0000 1.3 @@ -9,14 +9,55 @@ #include <sys/types.h> #if defined(__svr4__) || defined(__sun__) +#include <ieeefp.h> #define floorf(x) floor(x) #define ceilf(x) ceil(x) -#endif - -#if defined(__linux__) +#define rintf(x) rint(x) #include <sys/int_types.h> -#define u_int32_t uint32_t +#define u_int8_t uint8_t #define u_int16_t uint16_t +#define u_int32_t uint32_t +#define u_int64_t uint64_t + +#include <unistd.h> + +static inline u_int16_t +swap16(u_int16_t i) +{ + u_int16_t o; + u_int8_t *ip = (u_int8_t *)&i, *op = (u_int8_t *)&o; + op[0] = ip[1]; + op[1] = ip[0]; + return o; +} + +static inline u_int32_t +swap32(u_int32_t i) +{ + u_int32_t o; + u_int16_t *ip = (u_int16_t *)&i, *op = (u_int16_t *)&o; + op[0] = swap16(ip[1]); + op[1] = swap16(ip[0]); + return o; +} + +static inline u_int64_t +swap64(u_int64_t i) +{ + u_int64_t o; + u_int32_t *ip = (u_int32_t *)&i, *op = (u_int32_t *)&o; + op[0] = swap32(ip[1]); + op[1] = swap32(ip[0]); + return o; +} + +#define letoh16(x) swap16(x) +#define letoh32(x) swap32(x) +#define letoh64(x) swap64(x) +#define betoh16(x) (x) +#define betoh32(x) (x) +#define betoh64(x) (x) + #endif #endif _h_compat_ |
From: <le...@us...> - 2002-09-15 13:55:45
|
Update of /cvsroot/meshdb/src/vpf/libvpf In directory usw-pr-cvs1:/tmp/cvs-serv19270/libvpf Modified Files: vpf.c vpf.h vpfint.h Added Files: BSDmakefile GNUmakefile Makefile.common Removed Files: Makefile Log Message: make it all compile on the itee web server --- NEW FILE: BSDmakefile --- .include "Makefile.common" .include <bsd.lib.mk> --- NEW FILE: GNUmakefile --- default: all include Makefile.common include ../../geo/mk/GNUmakefile.lib --- NEW FILE: Makefile.common --- # $Id: Makefile.common,v 1.1 2002/09/15 13:55:42 leonard Exp $ SRCS= vpf.c vpf_join.c vpf_select.c vpf_si.c vpf_theme.c LIB= vpf NOMAN= LDADD= -lm NOPIC= Index: vpf.c =================================================================== RCS file: /cvsroot/meshdb/src/vpf/libvpf/vpf.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- vpf.c 14 Sep 2002 14:43:55 -0000 1.1 +++ vpf.c 15 Sep 2002 13:55:42 -0000 1.2 @@ -98,7 +98,8 @@ } /* Map the whole file into memory, read-only */ - addr = mmap(NULL, sb.st_size, PROT_READ, 0, fd, 0); + addr = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fd, 0); + close(fd); if (addr == MAP_FAILED) { vpf_seterror(v, "%s: %s", path, strerror(errno)); @@ -379,36 +380,6 @@ *b += sizeof (t); \ } #define identity(x) (x) - -#ifndef swap64 - -/* This is my home grown swap-64 */ -typedef struct { u_int32_t a[2]; } u_int64_t; -static u_int64_t swap64(u_int64_t arg); - -static u_int64_t -swap64(src) - u_int64_t arg; -{ - u_int64_t result; - result.a[0] = swap32(arg.a[1]); - result.a[1] = swap32(arg.a[0]); - return result; -} - -#if BYTE_ORDER == BIG_ENDIAN -# define letoh64(x) swap64(x) -# define htole64(x) swap64(x) -# define betoh64(x) identity(x) -# define htobe64(x) identity(x) -#else -# define letoh64(x) identity(x) -# define htole64(x) identity(x) -# define betoh64(x) swap64(x) -# define htobe64(x) swap64(x) -#endif - -#endif C(SSle, vpf_short_t, vpf_short_t, letoh16) C(ISle, vpf_long_t, vpf_short_t, letoh16) Index: vpf.h =================================================================== RCS file: /cvsroot/meshdb/src/vpf/libvpf/vpf.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- vpf.h 14 Sep 2002 14:43:55 -0000 1.1 +++ vpf.h 15 Sep 2002 13:55:42 -0000 1.2 @@ -4,6 +4,8 @@ #ifndef _h_vpf_ #define _h_vpf_ +#include "compat.h" + /*------------------------------------------------------------ * types */ Index: vpfint.h =================================================================== RCS file: /cvsroot/meshdb/src/vpf/libvpf/vpfint.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- vpfint.h 14 Sep 2002 14:43:55 -0000 1.1 +++ vpfint.h 15 Sep 2002 13:55:42 -0000 1.2 @@ -1,6 +1,8 @@ /* $Id$ */ /* David Leonard, 2002. Public domain. */ +#include "compat.h" + /* integer endian conversion macros */ #define H(e,lsb,msb,i) ((e) == ENDIAN_MSB ? msb(i) : lsb(i)) #define H32(e,i) H(e, letoh32, betoh32, i) --- Makefile DELETED --- |
From: <le...@us...> - 2002-09-15 13:55:45
|
Update of /cvsroot/meshdb/src/vpf/psplot In directory usw-pr-cvs1:/tmp/cvs-serv19270/psplot Modified Files: test.ps Added Files: BSDmakefile GNUmakefile Makefile.common Removed Files: Makefile Log Message: make it all compile on the itee web server --- NEW FILE: BSDmakefile --- .include "Makefile.common" .include <bsd.prog.mk> --- NEW FILE: GNUmakefile --- include Makefile.common include ../../geo/mk/GNUmakefile.prog --- NEW FILE: Makefile.common --- # $Id: Makefile.common,v 1.1 2002/09/15 13:55:42 leonard Exp $ PROG= psplot LDADD= -lvpf -lm DPADD= ${LIBVPF} NOMAN= LDADD+= -lgeo LIBGEO= ${.CURDIR}/../../geo/libgeo LDFLAGS= -L${LIBGEO} -L/usr/local/lib CFLAGS= -I${LIBGEO} Index: test.ps =================================================================== RCS file: /cvsroot/meshdb/src/vpf/psplot/test.ps,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- test.ps 15 Sep 2002 12:58:30 -0000 1.1 +++ test.ps 15 Sep 2002 13:55:42 -0000 1.2 @@ -16,7 +16,7 @@ %.ABBREV lineto=l moveto=m stroke=s fill=f closepath=c newpath=n -%.DATABASE /openbsd/tmp/map/gm_v1/AUS/globalm +%.DATABASE /www/public/users/mesh/mapdata/gm_v1/AUS/globalm %.LIBRARY area %150 150 translate 0.5 0.5 scale % debug --- Makefile DELETED --- |
From: <le...@us...> - 2002-09-15 13:55:45
|
Update of /cvsroot/meshdb/src/vpf/dump In directory usw-pr-cvs1:/tmp/cvs-serv19270/dump Added Files: BSDmakefile GNUmakefile Makefile.common Removed Files: Makefile Log Message: make it all compile on the itee web server --- NEW FILE: BSDmakefile --- .include "Makefile.common" .include <bsd.prog.mk> --- NEW FILE: GNUmakefile --- include Makefile.common include ../../geo/mk/GNUmakefile.prog --- NEW FILE: Makefile.common --- # $Id: Makefile.common,v 1.1 2002/09/15 13:55:42 leonard Exp $ PROG= vpfdump LDADD= -lvpf -lm DPADD= ${LIBVPF} NOMAN= --- Makefile DELETED --- |
From: <le...@us...> - 2002-09-15 13:55:45
|
Update of /cvsroot/meshdb/src/vpf In directory usw-pr-cvs1:/tmp/cvs-serv19270 Modified Files: Makefile.inc Added Files: BSDmakefile GNUmakefile Makefile.common Log Message: make it all compile on the itee web server --- NEW FILE: BSDmakefile --- .include "Makefile.common" .include <bsd.subdir.mk> --- NEW FILE: GNUmakefile --- include Makefile.common include ../geo/mk/GNUmakefile.subdir --- NEW FILE: Makefile.common --- SUBDIR= libvpf dump psplot Index: Makefile.inc =================================================================== RCS file: /cvsroot/meshdb/src/vpf/Makefile.inc,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile.inc 15 Sep 2002 12:58:30 -0000 1.2 +++ Makefile.inc 15 Sep 2002 13:55:42 -0000 1.3 @@ -1,9 +1,16 @@ # $Id$ +CC= gcc +_CURDIR= . + +CFLAGS?= CPPFLAGS?= LDFLAGS?= -CPPFLAGS += -I${.CURDIR}/../libvpf -LDFLAGS += -L${.CURDIR}/../libvpf -LIBVPF = ${.CURDIR}/../libvpf/libvpf.a -DEBUG= -ggdb -Wall +CPPFLAGS += -I${_CURDIR}/../libvpf +CPPFLAGS += -I${_CURDIR}/../../geo/compat +CPPFLAGS += -I${_CURDIR}/../../geo/libgeo +LDFLAGS += -L${_CURDIR}/../libvpf -L${_CURDIR}/../../geo/libgeo +LIBVPF = ${_CURDIR}/../libvpf/libvpf.a +LIBGEO = ${_CURDIR}/../../geo/libgeo/libgeo.a +CFLAGS += -ggdb -Wall -O2 |
From: <le...@us...> - 2002-09-15 12:58:34
|
Update of /cvsroot/meshdb/src/vpf/psplot In directory usw-pr-cvs1:/tmp/cvs-serv3102/vpf/psplot Modified Files: NOTES psplot.c Added Files: test.ps Log Message: fix some bugs in psplot add some macros to geodesy.h make compat with openbsd --- NEW FILE: test.ps --- %!PS % $Id: test.ps,v 1.1 2002/09/15 12:58:30 leonard Exp $ % David Leonard, 2002. Public domain. %-- copy the builtin operations as function objects rather than % wrap in a separate proc /l /lineto load def /m /moveto load def /s /stroke load def /f /fill load def /c /closepath load def /n /newpath load def /x /exch load def /r /rlineto load def %.ABBREV lineto=l moveto=m stroke=s fill=f closepath=c newpath=n %.DATABASE /openbsd/tmp/map/gm_v1/AUS/globalm %.LIBRARY area %150 150 translate 0.5 0.5 scale % debug %-- clip to the viewing rectangle %.SIZE n 0 0 m dup 0 x r x 0 r 0 x neg r c clip %-- plot the sea area %.COVERAGE bnd %.FEATURE oceansea 0.678 0.847 0.902 setrgbcolor % light-blue %.PLOT %-- plot the land masses %.FEATURE polbnda 1 1 .7 setrgbcolor % yellow %.PLOT %-- plot the state boundaries (use=(23:intl, 26:state, 30:local)) %.IF scale < 12M %.COVERAGE bnd %.FEATURE polbndl 0.9 0.9 0.9 setrgbcolor % light-grey 3.0 setlinewidth %.PLOT use = 26 % (26=state) 1.0 0.9 0.9 setrgbcolor % light-pink %.PLOT use = 23 % (23=intl) %.ENDIF %.IF scale < 1M %-- plot some built-up areas %. COVERAGE pop %. FEATURE builtupa 0.83 0.83 0.83 setrgbcolor % light-grey %. PLOT %.ENDIF %.IF scale < 1.5M %-- plot some inland water %.COVERAGE hydro %.FEATURE inwatera 0.678 0.847 1 setrgbcolor % more-blue-than-light-blue %.PLOT hyc=8 %.FEATURE watrcrsl 0.3 setlinewidth 0.5 0.7 1 setrgbcolor %.PLOT hyc=8 %.ENDIF %.IF scale < 600k %-- plot the roads (rtt=(14:primary, 15:secondary, 16:fway) %. COVERAGE trans %. FEATURE roadl 1 0.647 0 setrgbcolor % orange 1 0.947 0.8 setrgbcolor % orange 2.0 setlinewidth %. PLOT rtt=16 % 'freeway' 1 0.8 0.8 setrgbcolor % red 1.0 setlinewidth %. PLOT rtt=15 % 'secondary route' %. IF scale < 300k .930 .871 .796 setrgbcolor % brown 1.0 setlinewidth %. PLOT rtt=14 % 'primary route' 0.2 setlinewidth 0.7 0.7 0.7 setrgbcolor % black %. PLOT rtt > 16 % 'other roads' %. ENDIF %.ENDIF %-- plot the coastlines %.IF scale < 15M %. COVERAGE bnd %. FEATURE coastl 0.5 setlinewidth 0.6 0.6 0.9 setrgbcolor % dark-blue %. PLOT %.ENDIF % %- show outline of database clip % 0.5 setlinewidth 0 0 0 setrgbcolor % %.WHOLEPATH % stroke %-- draw the legend %.SIZE /h exch def /w exch def %.LEGEND 60 /legwidth exch def /segcount exch def /legstr exch def /segwidth legwidth segcount div def /legheight 8 def % height of legend /leginset 1 def % black inset around legend %-- draw legend outline (dark grey box) 0.6 setgray newpath w 0 moveto legwidth leginset 2 mul add neg 0 rlineto 0 legheight leginset 2 mul add rlineto legwidth leginset 2 mul add 0 rlineto closepath fill %-- draw grey/white segments 1 1 segcount { dup 2 mod 0 eq { 1 } { 0.9 } ifelse setgray newpath segwidth mul w exch sub leginset sub leginset moveto segwidth 0 rlineto 0 legheight rlineto segwidth neg 0 rlineto closepath fill } for %-- darw the legend dimension centred 0 setgray /Helvetica findfont legheight scalefont setfont legstr stringwidth pop 2 div legwidth 2 div add leginset add w exch sub leginset legheight 0.15 mul add moveto legstr show showpage Index: NOTES =================================================================== RCS file: /cvsroot/meshdb/src/vpf/psplot/NOTES,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- NOTES 15 Sep 2002 07:24:06 -0000 1.1 +++ NOTES 15 Sep 2002 12:58:30 -0000 1.2 @@ -55,7 +55,24 @@ %.WHOLEPATH - WHOLEPATH: generates a rectangular path that represents the - bounds of the plotted area. Usually this is followed by - a 'clip' command on a separate line. + WHOLEPATH: generates a non-rectangular path that represents the + bounds of the plotted area. This can be used for debugging to see + what part of the database was plotted + + %.SIZE + + SIZE: push the user image width and height onto the stack. + + %.LEGEND [maximum-width] + + LEGEND: pushes the following values onto the stack + distance-string + segments + legend_width + The purpose of this is to assist in the generation of a legend. + desired-width is a maximum width of the legend.. an integer number (x) + of integer powers of ten is found that would be a good distance + represented in the legend. The distance string is something like (300km) + and the segments number is a number like 3. legend width is the total + length of the legend. If maximum-width is omitted, it defaults to 100. Index: psplot.c =================================================================== RCS file: /cvsroot/meshdb/src/vpf/psplot/psplot.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- psplot.c 15 Sep 2002 07:24:06 -0000 1.2 +++ psplot.c 15 Sep 2002 12:58:30 -0000 1.3 @@ -67,6 +67,7 @@ /* Centre of image in UTM */ double uce, ucn; +double upointscale; /* parameters */ double PARAM_scale; @@ -95,6 +96,15 @@ buf[i] = '\0'; } +/* Return true if there's no way we can see the rectangle of given bounds */ +static int +cantsee(xmin, ymin, xmax, ymax) + double xmin, ymin, xmax, ymax; +{ + return ux1 > xmax || ux2 < xmin || + uy1 > ymax || uy2 < ymin; +} + /* Fatal error */ static void die(const char *fmt, ...) /* __dead */ @@ -211,15 +221,9 @@ * Emit postscript to clip output to the user's desired rectangle */ void -clip() +size() { - printf("%s 0 0 %s %.2g 0 %s %.2g %.2g %s 0 %.2g %s %s clip", - ps_newpath, - ps_moveto, pwidth, - ps_lineto, pwidth, pheight, - ps_lineto, pheight, - ps_lineto, - ps_closepath); + printf("%.2g %.2g\n", pwidth, pheight); } /* Load the definitions of the tiles we can see from the library */ @@ -228,16 +232,23 @@ { struct vpf *vtile; struct vpfsi *si; - struct vpftab *fsi, *tileref, *t; - int i; - vpf_long_t id = 0; + struct vpftab *fsi, *fbr, *tileref, *t; + int i, maxtiles; + vpf_long_t id = 0, faceid; + vpf_float_t xmin,ymin,xmax,ymax; char buf[10], *p; vtile = vpf_new_subdir(vlib, "tileref"); if (!vtile) die("tile_init"); tileref = vpf_table(vtile, "tileref.aft"); - if (!tileref) die("tileref/tileref.aft"); + if (!tileref) die("tileref/tileref.aft: %s", vpf_error(vtile)); + + fbr = vpf_table(vtile, "fbr"); + if (!fbr) die("fbr: %s", vpf_error(vtile)); + if (!vpftab_bind(fbr, "F:xmin,F:ymin,F:xmax,F:ymax", + &xmin, &ymin, &xmax, &ymax)) + die("%s", vpf_error(vtile)); si = vpf_si(vtile, "fsi"); if (!si) die("problem opening tileref/fsi"); @@ -247,36 +258,58 @@ fsi = vpf_si_search_in(si, "id", ux1, uy1, ux2, uy2); /* count the number of tiles */ - ntiles = 0; + maxtiles = 0; while (vpftab_fetch(fsi)) - ntiles++; + maxtiles++; vpftab_rewind(fsi); + if (verbose) printf("%% tiles: %d candidates\n", maxtiles); /* join fsi with tileref.aft */ t = vpf_join(fsi, "id", tileref, "fac_id"); /* pull out the face numbers */ - if (!vpftab_bind(t, "I:2.id,9T:2.tile_name", &id, buf)) + if (!vpftab_bind(t, "I:2.id,I:1.id,9T:2.tile_name", + &id, &faceid, buf)) die("bind: %s", vpf_error(vtile)); - tiles = (int *)malloc((1+ntiles) * sizeof (int)); - tilename = (char **)malloc((1+ntiles) * sizeof (char *)); - for (i = 0; i < ntiles; i++) { + tiles = (int *)malloc((1+maxtiles) * sizeof (int)); + tilename = (char **)malloc((1+maxtiles) * sizeof (char *)); + ntiles = 0; + for (i = 0; i < maxtiles; i++) { vpftab_fetch(t); + + /* Check the tile's bounding rectangle */ + vpftab_seek(fbr, faceid); + if (!vpftab_fetch(fbr)) + die("no such face %d in fbr", faceid); + + if (verbose) + printf("%% tile %d @ face %d = (%g,%g)-(%g,%g)\n", id, + faceid, xmin,ymin, xmax, ymax); + + if (cantsee(xmin, ymin, xmax, ymax)) + continue; + + /* Extract the subdirectory name for the tile */ strip(buf, sizeof buf); for (p = buf; *p; p++) if (*p == '\\') *p = '/'; else *p = tolower(*p); - tiles[i] = id; - tilename[i] = strdup(buf); + + /* Add the tile to our list */ + tiles[ntiles] = id; + tilename[ntiles] = strdup(buf); if (verbose) - printf("%% tile %d = %s\n", tiles[i], tilename[i]); + printf("%% * added tile %d = %s\n", + tiles[ntiles], tilename[ntiles]); + ntiles++; } vpftab_free(t); vpftab_free(fsi); + vpftab_free(fbr); vpftab_free(tileref); vpf_free(vtile); /* implicitly frees si */ } @@ -370,8 +403,7 @@ vpftab_seek(ebr, id); if (vpftab_fetch(ebr)) - invisible = (ux2 < bound[0] || bound[2] < ux1 || - uy2 < bound[1] || bound[3] < uy1); + invisible = cantsee(bound[0], bound[1], bound[2], bound[3]); else invisible = 0; @@ -823,6 +855,10 @@ rhs = strtod(s, &s); if (s == t) die("expected floating point number at %s", t); + if (*s == 'k') { rhs *= 1e3; s++; } + else if (*s == 'M') { rhs *= 1e9; s++; } + else if (*s == 'G') { rhs *= 1e12; s++; } + while (*s == ' ' || *s == '\t') s++; if (*s) @@ -893,6 +929,65 @@ } } +void +legend(buf) + char *buf; +{ + double maxwidth = 100; + char *p; + double span; /* in meters */ + double width; + int count, segments, l; + char *pfx = ""; + char diststr[20]; + double scale = pscale / upointscale; + + if (*buf) { + p = buf; + maxwidth = strtod(buf, &p); + if (p == buf) die("expected number after .LEGEND"); + while (*p == ' ' || *p == '\t') + p++; + if (*p) die("extra data after .LEGEND: '%s'", p); + } + + /* How many meters is maxwidth points at the center? */ + span = maxwidth / scale; + + if (span <= 0) + die("zero/negative legend width"); + + l = floor(log10(span)); + count = floor(span / pow(10, l)); + span = count * pow(10, l); + + if (count > 5) + segments = count / 2; + else + segments = count; + + /* Now, figure out the length in m/km etc */ + while (l % 3 != 0) { + l--; + count *= 10; + } + + if (l == 0) pfx = ""; + else if (l < -12) pfx = "?"; + else if (l == -12) pfx = "n"; + else if (l == -6) pfx = "u"; + else if (l == -3) pfx = "m"; + else if (l == 3) pfx = "k"; + else if (l == 6) pfx = "M"; + else if (l == 12) pfx = "G"; + else if (l == 15) pfx = "T"; + else pfx = "?"; + + snprintf(diststr, sizeof diststr, "%d%sm", segments, pfx); + + printf("(%s) %d %g\n", diststr, count, span * scale); +} + /* Process a "%.COMMAND" line including .IF/.ENDIF expressions */ void command(buf) @@ -913,8 +1008,9 @@ { "FEATURE", feature }, { "PLOT", plot }, { "WHOLEPATH", wholepath }, - { "CLIP", clip }, + { "SIZE", size }, { "ABBREV", abbrev }, + { "LEGEND", legend }, }; /* Skip whitespace: 1st word is the command */ @@ -1033,7 +1129,7 @@ uy1 = uy2 = RADIANS(lat); ux1 = ux2 = RADIANS(lon); geodesy_geo2grid(&geo, RADIANS(lat), RADIANS(lon), &uce, &ucn, - NULL, NULL); + NULL, &upointscale); if (verbose) { fprintf(stderr, "central meridian at longitude %g\n", DEGREES(geo.lambda0)); @@ -1046,9 +1142,6 @@ e = uce + dx*zoom*pwidth/2; n = ucn + dy*zoom*pheight/2; geodesy_grid2geo(&geo, e, n, &ty, &tx, NULL, NULL); - if (verbose) - fprintf(stderr, "can see lat %g lon %g at e %g n %g\n", - DEGREES(ty), DEGREES(tx), e, n); if (ty < uy1) uy1 = ty; if (ty > uy2) uy2 = ty; if (tx < ux1) ux1 = tx; @@ -1075,7 +1168,7 @@ { FILE *in = NULL; int ch; - char buf[1024], *p; + char buf[1024], *p, *q; int i; int sol = 1; int error = 0; @@ -1093,8 +1186,11 @@ pwidth = strtod(optarg, &p); if (p == optarg || *p != 'x') error = 1; - else - pheight = strtod(p, NULL); + else { + pheight = strtod(p+1, &q); + if (q == p+1 || *q) + error=1; + } break; case 'v': verbose = 1; @@ -1119,7 +1215,9 @@ } initarea(lat, lon, zoom); - if (verbose) fprintf(stderr, "SCALE is 1:%f\n", PARAM_scale); + if (verbose) + fprintf(stderr, "area=%gx%g\nSCALE is 1:%f\n", + pwidth, pheight, PARAM_scale); /* Use standard input if a file was not given */ if (in == NULL) |
From: <le...@us...> - 2002-09-15 12:58:34
|
Update of /cvsroot/meshdb/src/vpf In directory usw-pr-cvs1:/tmp/cvs-serv3102/vpf Modified Files: Makefile.inc Log Message: fix some bugs in psplot add some macros to geodesy.h make compat with openbsd Index: Makefile.inc =================================================================== RCS file: /cvsroot/meshdb/src/vpf/Makefile.inc,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile.inc 14 Sep 2002 14:43:53 -0000 1.1 +++ Makefile.inc 15 Sep 2002 12:58:30 -0000 1.2 @@ -1,6 +1,9 @@ # $Id$ -CPPFLAGS = -I${.CURDIR}/../libvpf -LDFLAGS = -L${.CURDIR}/../libvpf +CPPFLAGS?= +LDFLAGS?= + +CPPFLAGS += -I${.CURDIR}/../libvpf +LDFLAGS += -L${.CURDIR}/../libvpf LIBVPF = ${.CURDIR}/../libvpf/libvpf.a DEBUG= -ggdb -Wall |
From: <le...@us...> - 2002-09-15 12:58:34
|
Update of /cvsroot/meshdb/src/geo/compat In directory usw-pr-cvs1:/tmp/cvs-serv3102/geo/compat Modified Files: compat.h err.h Log Message: fix some bugs in psplot add some macros to geodesy.h make compat with openbsd Index: compat.h =================================================================== RCS file: /cvsroot/meshdb/src/geo/compat/compat.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- compat.h 10 Aug 2002 03:51:32 -0000 1.1.1.1 +++ compat.h 15 Sep 2002 12:58:29 -0000 1.2 @@ -6,13 +6,17 @@ #ifndef _h_compat_ #define _h_compat_ -#ifdef sun +#include <sys/types.h> + +#if defined(__svr4__) || defined(__sun__) #define floorf(x) floor(x) #define ceilf(x) ceil(x) #endif +#if defined(__linux__) #include <sys/int_types.h> #define u_int32_t uint32_t #define u_int16_t uint16_t +#endif #endif _h_compat_ Index: err.h =================================================================== RCS file: /cvsroot/meshdb/src/geo/compat/err.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- err.h 10 Aug 2002 03:51:32 -0000 1.1.1.1 +++ err.h 15 Sep 2002 12:58:29 -0000 1.2 @@ -15,7 +15,7 @@ #define _progname basename((char *)getexecname()) #endif -#ifdef linux +#if defined(linux) || defined(__OpenBSD__) extern char *__progname; #define _progname __progname #endif |
From: <le...@us...> - 2002-09-15 12:58:34
|
Update of /cvsroot/meshdb/src/geo In directory usw-pr-cvs1:/tmp/cvs-serv3102/geo Modified Files: Makefile.inc README Log Message: fix some bugs in psplot add some macros to geodesy.h make compat with openbsd Index: Makefile.inc =================================================================== RCS file: /cvsroot/meshdb/src/geo/Makefile.inc,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Makefile.inc 10 Aug 2002 03:51:32 -0000 1.1.1.1 +++ Makefile.inc 15 Sep 2002 12:58:29 -0000 1.2 @@ -24,6 +24,6 @@ #-- include the PNG library for image.c PNGSRC= $$HOME/src/netpbm/libpng-1.0.12 -CFLAGS+= -I${PNGSRC} +CFLAGS+= -I${PNGSRC} -I/usr/local/include LDFLAGS+= -L${PNGSRC} -L/usr/local/lib LDADD_GEO+= -lpng -lz Index: README =================================================================== RCS file: /cvsroot/meshdb/src/geo/README,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- README 10 Aug 2002 03:51:32 -0000 1.1.1.1 +++ README 15 Sep 2002 12:58:29 -0000 1.2 @@ -1,6 +1,8 @@ The source code to these mapping tools and database are placed in the Public Domain. +Edit Makefile.inc to set up some paths + * Sorry, not much doco - look in the libgeo/*.h files. * If you're not using a BSD operating system, you may need to find and install 'bmake' to make sense of the BSD-style makefiles. @@ -17,3 +19,4 @@ On makefiles: - i used both BSD make and GNU make... the BSDmakefile and GNUmakefile files are automatically read by the right ones. + |
From: <le...@us...> - 2002-09-15 12:58:34
|
Update of /cvsroot/meshdb/src/geo/libgeo In directory usw-pr-cvs1:/tmp/cvs-serv3102/geo/libgeo Modified Files: geodesy.c geodesy.h Log Message: fix some bugs in psplot add some macros to geodesy.h make compat with openbsd Index: geodesy.c =================================================================== RCS file: /cvsroot/meshdb/src/geo/libgeo/geodesy.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- geodesy.c 10 Aug 2002 03:51:32 -0000 1.1.1.1 +++ geodesy.c 15 Sep 2002 12:58:29 -0000 1.2 @@ -12,6 +12,8 @@ #include <math.h> #include "geodesy.h" +/* Define sub-expressions as macros so the C compiler can optimise better */ + #define POW2(x) ((x)*(x)) #define POW3(x) ((x)*(x)*(x)) #define POW4(x) POW2(POW2(x)) @@ -214,11 +216,12 @@ if (b1) *b1 = theta1 - delta1; - if (b2) + if (b2) { if (theta1 - delta2 < M_PI) *b2 = (theta1 - delta2) + M_PI; else *b2 = (theta1 - delta2) - M_PI; + } } Index: geodesy.h =================================================================== RCS file: /cvsroot/meshdb/src/geo/libgeo/geodesy.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- geodesy.h 10 Aug 2002 03:51:32 -0000 1.1.1.1 +++ geodesy.h 15 Sep 2002 12:58:29 -0000 1.2 @@ -9,7 +9,13 @@ double e2, aA0, aA2, aA4, aA6, Gr, n; }; -/* longitude of central meridian */ +/* compute the zone that a given longitude is in */ +#define ZONE(longitude) /* longitude in radians */ \ + (31 + (int)(((longitude) * 180 / M_PI) / 6)) +#define ZONEDEG(longitude) /* longitude in degrees */ \ + (31 + (int)((longitude) / 6)) + +/* longitude of central meridian of a zone */ #define CENTRAL_MERIDIAN(zone) \ ((6*((zone)-31)+3)*M_PI/180) |