You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "James H. Cloos Jr." <cl...@io.com> on 1995/08/23 13:55:18 UTC

Point type for imap module

I know, a new feature, but it was needed here to allow all of our imap
users to migrate away from the imagemap CGI.

The performance improvement is significant, as I'm sure you are all
aware. :)

The diff was generated against version 0.8.10.

A copy of mod_imap.c is also uploaded to:

<URL:ftp://ftp.hyperreal.com/httpd/incoming/mod_imap_point.c>

----------
--- mod_imap.c-dist	Mon Jul 31 19:46:59 1995
+++ mod_imap.c	Wed Aug 23 06:49:19 1995
@@ -72,6 +72,11 @@
  *
  * Randy Terbush, randy@zyzzyva.com
  * port to Apache module format, "base_uri" and support for relative URLs
+ * 
+ * James H. Cloos, Jr., cloos@jhcloos.com
+ * Added point datatype, using code in NCSA's version 1.8 imagemap.c
+ * program, as distributed with version 1.4.1 of their server.
+ * The point code is originally added by Craig Milo Rogers, Rogers@ISI.Edu
  *
  */
 
@@ -267,6 +272,8 @@
     FILE *imap;
     char *ycoord;
     char *referer;
+    double dist, mindist;
+    int sawpoint = 0;
 
 
     if (r->args == NULL)
@@ -399,6 +406,19 @@
     		fclose (imap);
 		return REDIRECT;
 	    }
+	}
+	if (!strcmp (maptype,"point")) {
+	    /* Don't need to take sqaure root */
+	    dist = ((testpoint[X] - pointarray[0][X])
+		 *  (testpoint[X] - pointarray[0][X]))
+	         + ((testpoint[Y] - pointarray[0][Y])
+		 *  (testpoint[Y] - pointarray[0][Y]));
+	    /* If this is the first point, or the nearest, set the default. */
+	    if ((! sawpoint) || (dist < mindist)) {
+	         mindist = dist;
+	         strcpy(mapdflt,mapurl);
+	    }
+	    sawpoint++;
 	}
     }
 

----------

-JimC
-- 
James H. Cloos, Jr.	Snail:	POBox 18122 Austin, TX 78760-8122
cloos@io.com		URL:	http://www.jhcloos.com/~cloos/