123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8" />
- <meta name="viewport" content="width=device-width,initial-scale=1.0" />
- <title></title>
- <style>
- pre {
- outline: 1px solid #ccc;
- padding: 5px;
- margin: 5px;
- }
- .string {
- color: green;
- }
- .number {
- color: darkorange;
- }
- .boolean {
- color: blue;
- }
- .null {
- color: magenta;
- }
- .key {
- color: red;
- }
- </style>
- </head>
- <body>
- <label>表名:<input type="text" id="tablename" value="map_xzqh_cun_polyline" /></label></br>
- <label>查询条件语句:<input type="text" id="sqlWhere" value="" /></label></br>
- <label>排序语句 :<input type="text" id="orderByField" value="" /></label></br>
- <button onclick="a()">基础查询</button>
- <button onclick="b()">新增</button>
- <button onclick="c()">缓冲区查询</button>
- <button onclick="d()">空间查询</button>
- <button onclick="e()">3dtile查询</button>
- <button onclick="f()">分段</button>
- <pre id="result"></pre>
- </body>
- <script src="../public/js/jquery-2.0.3.min.js"></script>
- <script>
- var key = "0l23456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- function syntaxHighlight(json) {
- if (typeof json != 'string') {
- json = JSON.stringify(json, undefined, 2);
- }
- json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
- return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) {
- var cls = 'number';
- if (/^"/.test(match)) {
- if (/:$/.test(match)) {
- cls = 'key';
- } else {
- cls = 'string';
- }
- } else if (/true|false/.test(match)) {
- cls = 'boolean';
- } else if (/null/.test(match)) {
- cls = 'null';
- }
- return '<span class="' + cls + '">' + match + '</span>';
- });
- }
- function f() {
- var value = document.getElementById("tablename").value;
- let fd = {
- XZQDM: '370612090001',
- }
- // let dataParameters = {
- // tableName: toCode(value, key),
- // name: fd,
- // type: '段', //lb能分段和米
- // number: 3, // 排序条件
- // };
- let dataParameters = {
- tableName: toCode(value, key),
- name: fd,
- point_one: '121.6480450140001 37.4888497860001', //随便一点
- point_two: '121.6480450140001 37.4888497860001', // 随便一点或者起点或者终点
- };
- $('#result').empty();
- $.ajax({
- async: true,
- dataType: 'json',
- type: 'post',
- // url: 'http://218.59.194.82:13181/getSpatialQuery',
- // url: 'http://10.88.77.130:8092/',
- // url: 'http://127.0.0.1:8082/getLineInterpolatePoints',
- url: 'http://127.0.0.1:8082/getLineDistance',
- data: dataParameters,
- success: function (temp) {
- try {
- $('#result').html(syntaxHighlight(temp));
- console.log(temp)
- } catch (e) {
- console.log(e);
- // return false;
- }
- },
- error: function (jqXHR, textStatus, errorThrown) {
- console.log("错误:" + jqXHR.status);
- }
- });
- }
- function a() {
- var value = document.getElementById("tablename").value;
- var sqlWhere = document.getElementById("sqlWhere").value;
- var orderByField = document.getElementById("orderByField").value;
- let dataParameters = {
- tableName: toCode(value, key),
- sqlWhere: toCode(sqlWhere, key), // 查询过滤条件
- orderByField: toCode(orderByField, key), // 排序条件
- };
- $('#result').empty();
- $.ajax({
- async: true,
- dataType: 'json',
- type: 'get',
- // url: 'http://218.59.194.82:13189/getTableList',
- // url: 'http://10.88.77.134:8085/getTableList',
- url: 'http://127.0.0.1:8093/getTableList',
- data: dataParameters,
- success: function (temp) {
- try {
- $('#result').html(syntaxHighlight(temp));
- console.log(temp)
- } catch (e) {
- console.log(e);
- // return false;
- }
- },
- error: function (jqXHR, textStatus, errorThrown) {
- console.log("错误:" + jqXHR.status);
- }
- });
- }
- function toCode(str, key) { //加密字符串
- //定义密钥,36个字母和数字
- var l = key.length; //获取密钥的长度
- var a = key.split(""); //把密钥字符串转换为字符数组
- var s = "", b, bl, b2, b3; //定义临时变量
- for (var i = 0; i < str.length; i++) { //遍历字符串
- b = str.charCodeAt(i); //逐个提取每个字符,并获取Unicode编码值
- bl = b % l; //求Unicode编码值得余数
- b = (b - bl) / l; //求最大倍数
- b2 = b % l; //求最大倍数的于是
- b = (b - b2) / l; //求最大倍数
- b3 = b % l; //求最大倍数的余数
- s += a[b3] + a[b2] + a[bl]; //根据余数值映射到密钥中对应下标位置的字符
- }
- return s; //返回这些映射的字符
- }
- function e() {
- $('#result').empty();
- $.ajax({
- async: true,
- // dataType: 'json',
- type: 'get',
- // url: 'http://218.59.194.82:13092/11294/tileset.json',
- // url: 'http://10.88.77.134:8085/get3dTiles/hedata/tileset.json',
- url: 'http://127.0.0.1:8092/11294/tileset.json',
- // url: 'http://127.0.0.1:8092/getMbTiles/dz/18/215787/160352.png',
- success: function (temp) {
- try {
- $('#result').html(syntaxHighlight(temp));
- console.log(temp)
- } catch (e) {
- console.log(e);
- // return false;
- }
- },
- error: function (jqXHR, textStatus, errorThrown) {
- console.log("错误:" + jqXHR.status);
- }
- });
- }
- function d() {
- var value = document.getElementById("tablename").value;
- var sqlWhere = document.getElementById("sqlWhere").value;
- var orderByField = document.getElementById("orderByField").value;
- let dataParameters = {
- tableName: value,
- sqlWhere: sqlWhere, // 查询过滤条件
- orderByField: orderByField, // 排序条件
- };
- $('#result').empty();
- $.ajax({
- async: true,
- dataType: 'json',
- type: 'get',
- // url: 'http://218.59.194.82:13092/getGeoJson',
- url: 'http://10.88.77.131:8081/getGeoJson',
- // url: 'http://127.0.0.1:8092/getGeoJson',
- data: dataParameters,
- success: function (temp) {
- try {
- $('#result').html(syntaxHighlight(temp));
- console.log(temp)
- } catch (e) {
- console.log(e);
- // return false;
- }
- },
- error: function (jqXHR, textStatus, errorThrown) {
- console.log("错误:" + jqXHR.status);
- }
- });
- }
- function b() {
- var value = document.getElementById("tablename").value;
- let fd = {
- heading: 1,
- name: '愉快Indian',
- x: 1,
- y: 1,
- z: 1,
- userId: 1,
- screenshot: '',
- pitch: 1,
- roll: 2
- }
- let dataParameters = {
- tableName: value,
- keyValue: "",
- formData: fd
- };
- $('#result').empty();
- $.ajax({
- async: true,
- dataType: 'json',
- type: 'post',
- // url: 'http://218.59.194.82:13092/',
- url: 'http://127.0.0.1:8082/postSubmit',
- data: dataParameters,
- success: function (temp) {
- try {
- $('#result').html(syntaxHighlight(temp));
- console.log(temp)
- } catch (e) {
- console.log(e);
- // return false;
- }
- },
- error: function (jqXHR, textStatus, errorThrown) {
- console.log("错误:" + jqXHR.status);
- }
- });
- }
- function c() {
- var value = document.getElementById("tablename").value;
- let dataParameters = {
- tableName: toCode(value, key),
- spatialType: '点',
- // coordinate: "121.639245162136 37.4792291346178", // 查询过滤条件
- coordinate: "", // 查询过滤条件
- buffer: "", // 排序条件
- sqlWhere: toCode("1=1", key),
- };
- $('#result').empty();
- $.ajax({
- async: true,
- dataType: 'json',
- type: 'get',
- // url: 'http://218.59.194.82:13181/getSpatialQuery',
- // url: 'http://10.88.77.130:8092/',
- url: 'http://127.0.0.1:8082/getSpatialQuery',
- data: dataParameters,
- success: function (temp) {
- try {
- $('#result').html(syntaxHighlight(temp));
- console.log(temp)
- } catch (e) {
- console.log(e);
- // return false;
- }
- },
- error: function (jqXHR, textStatus, errorThrown) {
- console.log("错误:" + jqXHR.status);
- }
- });
- }
- </script>
- </html>
|