Changeset 17816 for trunk/FACT++
- Timestamp:
- 05/09/14 18:40:02 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/www/viewer/index.js
r17812 r17816 187 187 188 188 editor = CodeMirror.fromTextArea(document.getElementById(textarea), config); 189 editor.setOption("theme", " blackboard");189 editor.setOption("theme", "fact"); 190 190 191 191 return editor; … … 1275 1275 } 1276 1276 1277 function drawHex(ctx, x, y, col, min, max)1278 { 1279 if (col===undefined/* || col===null*/ || max<min)1280 return ;1277 function fillHex(ctx, i, col, min, max) 1278 { 1279 if (col===undefined/* || col===null*/) 1280 return false; 1281 1281 1282 1282 var lvl = max==min ? 0.5 : (col-min)/(max-min); … … 1285 1285 1286 1286 ctx.save(); 1287 ctx.translate( x, y);1287 ctx.translate(coord[i][0], coord[i][1]); 1288 1288 outlineHex(ctx); 1289 1289 ctx.fill(); 1290 1290 ctx.restore(); 1291 } 1291 1292 return true; 1293 } 1294 1295 function drawHex(ctx, i) 1296 { 1297 ctx.save(); 1298 ctx.translate(coord[i][0], coord[i][1]); 1299 outlineHex(ctx); 1300 ctx.stroke(); 1301 ctx.restore(); 1302 } 1303 1292 1304 1293 1305 function Position(s, ring, i) … … 1338 1350 ctx.translate(-0.5, 0); 1339 1351 1340 for (var i=0; i<1440; i++) 1341 drawHex(ctx, coord[i][0], coord[i][1], data[i], min, max); 1352 if (document.getElementById('grid').checked) 1353 { 1354 ctx.lineWidth = 0.02; 1355 ctx.strokeStyle = "#000"; 1356 for (var i=0; i<1440; i++) 1357 drawHex(ctx, i); 1358 } 1359 1360 var hasData = false; 1361 if (max>=min) 1362 for (var i=0; i<1440; i++) 1363 hasData |= fillHex(ctx, i, data[i], min, max); 1342 1364 1343 1365 // =================== Draw Pixel marker ==================== … … 1346 1368 { 1347 1369 // Draw marker 1348 ctx.save();1349 1350 1370 ctx.lineWidth = 0.25; 1351 ctx.fillStyle = "#000"; 1352 1353 ctx.translate(coord[pixel][0], coord[pixel][1]); 1354 outlineHex(ctx); 1355 ctx.stroke(); 1356 1357 ctx.restore(); 1371 ctx.strokeStyle = "#000"; 1372 drawHex(ctx, pixel); 1358 1373 } 1359 1374 … … 1392 1407 ctx.restore(); 1393 1408 1409 if (!hasData) 1410 return; 1411 1394 1412 // ======================= Draw Legend ====================== 1413 1414 var v0 = parseFloat(canv.zmin); 1415 var v1 = parseFloat(canv.zmax); 1416 1417 var diff = v1-v0; 1418 1419 var cw = canv.width; 1420 //var ch = canv.height; 1421 1422 ctx.font = "8pt Arial"; 1423 ctx.textAlign = "right"; 1424 ctx.textBaseline = "top"; 1425 1426 for (var i=0; i<11; i++) 1427 { 1428 ctx.strokeStyle = "#"+HLStoRGB(i/10); 1429 ctx.strokeText((v0+diff*i/10).toPrecision(3), cw-5, 125-i*12); 1430 } 1395 1431 1396 1432 var pval = parseFloat(canv.dataAbs[pixel]).toFixed(1); … … 1398 1434 var lmax = parseFloat(canv.max).toFixed(1); 1399 1435 1400 var v0 = parseFloat(canv.zmin); 1401 var v1 = parseFloat(canv.zmax); 1402 1403 var diff = v1-v0; 1404 1405 var cw = canv.width; 1406 //var ch = canv.height; 1407 1408 ctx.font = "8pt Arial"; 1409 ctx.textAlign = "right"; 1410 ctx.textBaseline = "top"; 1411 1412 for (var i=0; i<11; i++) 1413 { 1414 ctx.strokeStyle = "#"+HLStoRGB(i/10); 1415 ctx.strokeText((v0+diff*i/10).toPrecision(3), cw-5, 125-i*12); 1416 } 1436 if (isNaN(pval)) 1437 pval = ""; 1417 1438 1418 1439 var mw = Math.max(ctx.measureText(lmin).width,
Note:
See TracChangeset
for help on using the changeset viewer.