[SPIP Zone] r4572 - in /_plugins_/_contenu_editorial_/spipcarto/spipcarto/js: ./ carto.js graphTools.js helper_functions.js navTools.js navigation.js navigationTools.js tree.js x_core_nn4.js x_dom_nn4.js x_event_nn4.js

Author: bill@adequates.com
Date: Wed Aug 16 16:16:12 2006
New Revision: 4572

Log:
deplacement des .js

Added:
    _plugins_/_contenu_editorial_/spipcarto/spipcarto/js/
    _plugins_/_contenu_editorial_/spipcarto/spipcarto/js/carto.js
    _plugins_/_contenu_editorial_/spipcarto/spipcarto/js/graphTools.js
    _plugins_/_contenu_editorial_/spipcarto/spipcarto/js/helper_functions.js
    _plugins_/_contenu_editorial_/spipcarto/spipcarto/js/navTools.js
    _plugins_/_contenu_editorial_/spipcarto/spipcarto/js/navigation.js
    _plugins_/_contenu_editorial_/spipcarto/spipcarto/js/navigationTools.js
    _plugins_/_contenu_editorial_/spipcarto/spipcarto/js/tree.js
    _plugins_/_contenu_editorial_/spipcarto/spipcarto/js/x_core_nn4.js
    _plugins_/_contenu_editorial_/spipcarto/spipcarto/js/x_dom_nn4.js
    _plugins_/_contenu_editorial_/spipcarto/spipcarto/js/x_event_nn4.js

Added: _plugins_/_contenu_editorial_/spipcarto/spipcarto/js/carto.js

--- _plugins_/_contenu_editorial_/spipcarto/spipcarto/js/carto.js (added)
+++ _plugins_/_contenu_editorial_/spipcarto/spipcarto/js/carto.js Wed Aug 16 16:16:12 2006
@@ -0,0 +1,7 @@
+function FormItemSelected() {
+ document.carto_form.submit();
+}
+
+function CheckRadio(theIndex) {
+ document.carto_form.tool[theIndex].checked = true;
+}

Added: _plugins_/_contenu_editorial_/spipcarto/spipcarto/js/graphTools.js

--- _plugins_/_contenu_editorial_/spipcarto/spipcarto/js/graphTools.js (added)
+++ _plugins_/_contenu_editorial_/spipcarto/spipcarto/js/graphTools.js Wed Aug 16 16:16:12 2006
@@ -0,0 +1,151 @@
+/*
+graphTools.js
+
+javascript functions to create and draw lines and points
+for map navigation tool (zoom box, distance and surface measurement)
+
+Part of this code was previously found from wz_jsgraphics.js (http://www.walterzorn.com)
+and hardly adapted
+
+Copyright 2004 Pierre GIRAUD
+http://www.camptocamp.com
+*/
+
+var jg_ihtm, jg_ie, jg_fast, jg_dom, jg_moz,
+jg_n4 = (document.layers && typeof document.classes != "undefined");
+
+
+function chkDHTM(x, i)
+{
+ x = document.body || null;
+ jg_ie = x && typeof x.insertAdjacentHTML != "undefined";
+ jg_dom = (x && !jg_ie &&
+ typeof x.appendChild != "undefined" &&
+ typeof document.createRange != "undefined" &&
+ typeof (i = document.createRange()).setStartBefore != "undefined" &&
+ typeof i.createContextualFragment != "undefined");
+ jg_ihtm = !jg_ie && !jg_dom && x && typeof x.innerHTML != "undefined";
+ jg_fast = jg_ie && document.all && !window.opera;
+ jg_moz = jg_dom && typeof x.style.MozOpacity != "undefined";
+}
+
+function pntDoc()
+{
+ this.wnd.document.write(this.htm);
+ this.htm = '';
+}
+
+
+function pntCnvDom()
+{
+ var x = document.createRange();
+ x.setStartBefore(this.cnv);
+ x = x.createContextualFragment(this.htm);
+ this.cnv.appendChild(x);
+ this.htm = '';
+}
+
+
+function pntCnvIe()
+{
+ this.cnv.insertAdjacentHTML("beforeEnd",this.htm);
+ this.htm = '';
+}
+
+function pntCnv()
+{
+ this.htm = '';
+}
+
+
+function mkDivPt(x,y)
+{
+ this.htm += '<div class="point" style="left:'+x+'px;top:'+y+'px"></div>';
+ //this.htm += '<div style="position:absolute;left:'+x+';top:'+y+';width:4px;height:4px;background-color:red;overflow:hidden"></div>';
+}
+
+function mkLineH(x,y,h)
+{
+ this.htm += '<div class="lineH" style="left:'+x+'px;top:'+y+'px;height:'+h+'px"></div>';
+}
+
+function mkLineW(x,y,w)
+{
+ this.htm += '<div class="lineW" style="left:'+x+'px;top:'+y+'px;width:'+w+'px"></div>';
+}
+
+function mkLinePts(x1,y1,x2,y2,d2pts) { //function added to draw lines with few points
+ this.printing = true;
+ var dx = x2-x1;
+ var dy = y2-y1;
+ var darc = Math.sqrt(dx * dx + dy * dy); //arc length
+ var nb_pts = Math.round(darc / d2pts); // number of points on the arc
+ var dx2pts = dx / nb_pts;
+ var dy2pts = dy / nb_pts;
+ var i = 0;
+ this.mkDivPt(x1,y1);
+ while (i < nb_pts) {
+ ++i;
+ this.mkDivPt(Math.round(x1 + dx2pts * i), Math.round(y1 + dy2pts * i));
+ //this.mkDiv(Math.round(x1 + dx2pts * i), Math.round(y1 + dy2pts * i),this.ptSize,this.ptSize);
+ }
+}
+
+function mkRect(x, y, w, h, thickness)
+{
+ this.drawLineH(x, y, h);
+ this.drawLineH(x+w, y,h);
+ this.drawLineW(x, y+h,w+thickness);
+ this.drawLineW(x, y,w);
+}
+
+
+function jsGraphics(id, wnd)
+{
+ this.setColor = new Function('arg', 'this.color = arg.toLowerCase();');
+
+ this.setStroke = function(a,b)
+ {
+ this.stroke = a;
+ this.ptSize = b;
+ this.drawRect = mkRect;
+ this.drawLinePts = mkLinePts;
+ this.drawLineH = mkLineH;
+ this.drawLineW = mkLineW;
+ };
+
+ this.drawPolylinePts = function(x, y, d) {
+ for (var i=0; i<x.length - 1 ; i++) this.drawLinePts(x[i], y[i], x[i+1], y[i+1], d);
+ }
+
+
+ this.setPrintable = function()
+ {
+ this.mkDivPt = mkDivPt;
+ };
+
+ this.clear = function()
+ {
+ this.htm = "";
+ if (this.cnv) this.cnv.innerHTML = this.defhtm;
+ };
+
+
+ this.setStroke(1);
+ this.color = '#000000';
+ this.htm = '';
+ this.wnd = wnd || window;
+
+ if (!(jg_ie || jg_dom || jg_ihtm)) chkDHTM();
+ if (typeof id != 'string' || !id) {this.paint = pntDoc;}
+ else
+ {
+ this.cnv = document.all? (this.wnd.document.all[id] || null)
+ : document.getElementById? (this.wnd.document.getElementById(id) || null)
+ : null;
+ this.defhtm = (this.cnv && this.cnv.innerHTML)? this.cnv.innerHTML : '';
+ this.paint = jg_dom? pntCnvDom : jg_ie? pntCnvIe : jg_ihtm? pntCnvIhtm : pntCnv;
+ }
+
+ this.setPrintable();
+}
\ No newline at end of file

Added: _plugins_/_contenu_editorial_/spipcarto/spipcarto/js/helper_functions.js

--- _plugins_/_contenu_editorial_/spipcarto/spipcarto/js/helper_functions.js (added)
+++ _plugins_/_contenu_editorial_/spipcarto/spipcarto/js/helper_functions.js Wed Aug 16 16:16:12 2006
@@ -0,0 +1,387 @@
+/*
+ECMAScript helper functions
+Copyright (C) <2004> <Andreas Neumann>
+Version 1.1, 2004-11-18
+neumann@karto.baug.ethz.ch
+http://www.carto.net/
+http://www.carto.net/neumann/
+
+Credits: numerous people on svgdevelopers@yahoogroups.com
+
+This ECMA script library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library (http://www.carto.net/papers/svg/resources/lesser_gpl.txt); if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+----
+
+original document site: http://www.carto.net/papers/svg/resources/helper_functions.js
+Please contact the author in case you want to use code or ideas commercially.
+If you use this code, please include this copyright header, the included full
+LGPL 2.1 text and read the terms provided in the LGPL 2.1 license
+(http://www.gnu.org/copyleft/lesser.txt)
+
+-------------------------------
+
+Please report bugs and send improvements to neumann@karto.baug.ethz.ch
+If you use these scripts, please link to the original (http://www.carto.net/papers/svg/navigationTools/)
+somewhere in the source-code-comment or the "about" of your project and give credits, thanks!
+
+*/
+
+//global variables necessary to create elements in these namespaces, do not delete them!!!!
+var svgNS = "http://www.w3.org/2000/svg";
+var xlinkNS = "http://www.w3.org/1999/xlink";
+var cartoNS = "http://www.carto.net/attrib";
+
+/* ----------------------- helper functions to calculate stuff ---------------- */
+/* ---------------------------------------------------------------------------- */
+function toPolarDir(xdiff,ydiff) { // Subroutine for calculating polar Coordinates
+ direction = (Math.atan2(ydiff,xdiff));
+ //result is angle in radian
+ return(direction);
+}
+
+function toPolarDist(xdiff,ydiff) { // Subroutine for calculating polar Coordinates
+ distance = Math.sqrt(xdiff * xdiff + ydiff * ydiff);
+ return(distance);
+}
+
+function toRectX(direction,distance) { // Subroutine for calculating cartesic coordinates
+ x = distance * Math.cos(direction);
+ y = distance * Math.sin(direction);
+ return(x);
+}
+
+function toRectY(direction,distance) { // Subroutine for calculating cartesic coordinates
+ x = distance * Math.cos(direction);
+ y = distance * Math.sin(direction);
+ return(y);
+}
+
+//Converts degrees to radians.
+function DegToRad(deg) {
+ return (deg / 180.0 * Math.PI);
+}
+
+//Converts radians to degrees.
+function RadToDeg(rad) {
+ return (rad / Math.PI * 180.0);
+}
+
+//log functions that do not exist in Math object
+function log(x,b) {
+ if(b==null) b=Math.E;
+ return Math.log(x)/Math.log(b);
+}
+
+//gets 4 z-values (4 corners), a position, delta x and delty and a cellsize as input and returns interpolated z-value
+function intBilinear(za,zb,zc,zd,xpos,ypos,ax,ay,cellsize) { //bilinear interpolation function
+ e = (xpos - ax) / cellsize;
+ f = (ypos - ay) / cellsize;
+
+ //calculation of weights
+ wa = (1 - e) * (1 - f);
+ wb = e * (1 - f);
+ wc = e * f;
+ wd = f * (1 - e);
+
+ height_interpol = wa * zc + wb * zd + wc * za + wd * zb;
+
+ return (height_interpol);
+}
+
+//test if point is left of or right of, result is 1 (leftof) or 0 (rightof)
+function leftOfTest(pointx,pointy,linex1,liney1,linex2,liney2) {
+ result = (liney1 - pointy) * (linex2 - linex1) - (linex1 - pointx) * (liney2 - liney1);
+ if (result < 0) {

[... 2716 lines stripped ...]