File: germany.html

package info (click to toggle)
jsxgraph 1.12.2%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,008 kB
  • sloc: javascript: 82,426; xml: 5,869; java: 1,072; php: 281; makefile: 189; python: 174; cpp: 76; sh: 12
file content (88 lines) | stat: -rw-r--r-- 2,755 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<html>
<head>
   <title>JSXGraph example</title>
   <link rel="stylesheet" type="text/css" href="../distrib/jsxgraph.css" />
   <script type="text/javascript" src="jquery-3.5.1.min.js"></script>
   <script type="text/javascript" src="../distrib/jsxgraphcore.js"></script>
   <script type="text/javascript" src="germany_json.js"></script>
</head>
<body>
<h2>Curve Test</h2>
<div id="jxgbox" class="jxgbox" style="width:500px; height:700px;"></div>
<div id="debug" style="display:block;"></div>
   <script type="text/javascript">
    /* <![CDATA[ */


minX =-289319.4;
maxY = 6827620;
maxX = 351315.7;
minY = 5960587;
var brd = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[minX-1000,maxY+1000,maxX+1000,minY-1000],
                                    keepaspectratio:true});

var xArr = germany[0];
var yArr = germany[1];
var list = [];
for (i=0;i<xArr.length;i++) { list[i] = i; };
var col = 0;

function createCurve(number)  {
    var x = [];
    var y = [];
    var c = [];
    len = xArr[number].length;
    for(var i=0;i<len;i++) {
        c.push(new JXG.Coords(JXG.COORDS_BY_USER, [xArr[number][i], yArr[number][i]], brd));
    }
    //c = brd.renderer.RamenDouglasPeuker(c,1.5);
    len = c.length;
    for (i=0;i<len;i++) {
        x.push(c[i].usrCoords[1]);
        y.push(c[i].usrCoords[2]);
    }
    var graph = brd.createElement('curve', [x,y],
                    {fillColor:JXG.hsv2rgb(col++,0.6,0.9),
                     highlightFillColor:'yellow',
                     strokeWidth:1,
                     strokeColor:'black',
                     highlightStrokeColor:'black'});

    JXG.addEvent(graph.rendNode, 'mouseover', function(){graph.nohcol = graph.visProp.fillcolor; graph.setAttribute({fillColor: 'yellow'});}, graph);
    JXG.addEvent(graph.rendNode, 'mouseout', function(){graph.setAttribute({fillColor: graph.nohcol});}, graph);
    graph.hasPoint = function(){return false; };
}

function final() {
    brd.unsuspendUpdate();
    //document.getElementById('debug').innerHTML += '. ';
}

//Copyright 2009 Nicholas C. Zakas. All rights reserved.
//MIT Licensed
function timedChunk(items, process, context, callback){
    var todo = items.concat();   //create a clone of the original

    setTimeout(function(){

        var start = +new Date();

        do {
             process.call(context, todo.shift());
        } while (todo.length > 0 && (+new Date() - start < 300));

        if (todo.length > 0){
            setTimeout(arguments.callee, 1);
        } else {
            callback(items);
        }
    }, 1);
}

brd.suspendUpdate();
timedChunk(list, createCurve, null, final);

          /* ]]> */
  </script>
</body>
</html>