Skip to content

Commit

Permalink
comments can be added directly after dots select
Browse files Browse the repository at this point in the history
  • Loading branch information
I194 committed Oct 21, 2021
1 parent c4b84b7 commit 12bed5c
Show file tree
Hide file tree
Showing 13 changed files with 392 additions and 207 deletions.
11 changes: 10 additions & 1 deletion extra_modules/importing.js
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,13 @@ function importPaleoMac(file) {
var beddingStrike = (header[3].includes('=')) ? Number(header[3].split('=')[1]) : Number(header[3]);//Number(header.slice(32, 37));
var beddingDip = (header[4].includes('=')) ? Number(header[4].split('=')[1]) : Number(header[4]);//Number(header.slice(42, 47));

var sampleVolume = (header[5].includes('E')) ? Number(header[5].split('E')[0]) : Number(header[5]); //Number(header.slice(52, 59));
var sampleVolume = (header[5].includes('m')) ? Number(header[5].split('m')[0]) : Number(header[5]); //Number(header.slice(52, 59));
console.log(header[5], Number(header[5]));
// var coreAzimuth = Number(header.slice(12, 17));
// var coreDip = 90 - Number(header.slice(22, 27));
// var beddingStrike = Number(header.slice(32, 37));
// var beddingDip = Number(header.slice(42, 47));
// var sampleVolume = Number(header.slice(52, 59));

var demagnetizationType;

Expand Down Expand Up @@ -1039,13 +1045,16 @@ function importPaleoMac(file) {
// var x = Number(line.slice(5, 14));
// var y = Number(line.slice(15, 25));
// var z = Number(line.slice(25, 34));

console.log(x, y, z, sampleVolume)
var a95 = Number(line.slice(69, 73));
var comment = line.slice(73, (line.length + 1)).trim();
var coordinates = new Coordinates(x, y, z);
return new Measurement(step, coordinates, a95, comment);

});
// Add the data to the application

specimens.push({
"demagnetizationType": demagnetizationType,
"coordinates": "specimen",
Expand Down
1 change: 1 addition & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const {app, BrowserWindow, Menu, screen, globalShortcut, ipcMain, dialog} = requ
const fs = require("fs");
const WIDTH_RATIO = 0.8;
const ASPECT_RATIO = 10 / 16;
app.allowRendererProcessReuse = false

// Paths for child windows
const settingsPath = path.join('file://', __dirname, 'windows/settings.html');
Expand Down
7 changes: 5 additions & 2 deletions main_window/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
// });
// const { svg2png } = require("svg-png-converter")
const sharp = require("sharp");
// const smalltalk = require('smalltalk');
// var Dialogs = require('dialogs')
const prompt = require('electron-prompt');
// var svg2png = require("save-svg-as-png");
require("svg2pdf.js");
var edge = require('electron-edge-js');
Expand Down Expand Up @@ -193,9 +196,9 @@
<button class="btn btn-light text-primary" id="export-charts-pdf" title="export all charts from page as one PDF file">
Export all PDF
</button>
<button class="btn btn-light text-primary" id="export-charts-jpeg" title="export all charts from page as one JPEG file" disabled>
<!-- <button class="btn btn-light text-primary" id="export-charts-jpeg" title="export all charts from page as one JPEG file" disabled>
Export all JPEG
</button>
</button> -->
</div>
</div>
<!-- Modules -->
Expand Down
2 changes: 1 addition & 1 deletion main_window/js/PCA/graphs.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function plotZijderveldDiagram(hover) {
var addTextOutline = settings.pca.pcaAddTextOutline;

var steps = specimen.steps;

console.log(steps)
// if (hover) {
// var hoverIndex;
//
Expand Down
3 changes: 3 additions & 0 deletions main_window/js/fileDialogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ function saveFile(windowTitle, fileName, data, extension, andOpen, path) {
var filterName = '';

switch (extension) {
case 'txt':
filterName = 'Text documents (*.txt)';
break;
case 'csv':
filterName = 'CSV UTF-8 (comma delimiter)';
break;
Expand Down
129 changes: 64 additions & 65 deletions main_window/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,17 @@ function registerEventHandlers() {
'save'
);
})
document.getElementById('export-charts-jpeg').addEventListener('click', (e) => {
redrawCharts();
Highcharts.exportCharts(
chartsToExport,
{
filename: "charts_" + pageType,
extnsn: 'jpg',
},
'save'
);
})
// document.getElementById('export-charts-jpeg').addEventListener('click', (e) => {
// redrawCharts();
// Highcharts.exportCharts(
// chartsToExport,
// {
// filename: "charts_" + pageType,
// extnsn: 'jpg',
// },
// 'save'
// );
// })

// pages navigation
document.getElementById("nav-pca-tab").addEventListener("click", (e) => {
Expand Down Expand Up @@ -747,7 +747,7 @@ function formatSpecimenTable() {
var volume = (specimen.volume) ? specimen.volume : 1;

var direction = inReferenceCoordinates(COORDINATES.pca, specimen, new Coordinates(step.x, step.y, step.z)).toVector(Direction);
var intensity = (direction.length / volume).toFixed(0);
var intensity = (direction.length / volume).toExponential(2);
var dec = direction.dec.toFixed(ROUND_NUM);
var inc = direction.inc.toFixed(ROUND_NUM);
if (inc < 0) inc = "<span class='text-danger'>" + inc + "</span>";
Expand Down Expand Up @@ -1448,58 +1448,57 @@ function redrawCharts(hover, context) {

var currentPage = getSelectedPage();

if (INITIALIZE) {
// Charts creating
// pca
zijdPCA = plotZijderveldDiagram(hover);
stereoPCA = plotStereoDiagram(hover);
intensPCA = plotIntensityDiagram(hover);
// stat
stereoStat = statPlotStereoDiagram();
// poles
stereoPoles = polesPlotStereoDiagrams();
// Tables creating
// pca
formatSpecimenTable();
updateInterpretationTable('pca');
ipcRenderer.send('redraw-specDataWin');
ipcRenderer.send('redraw-interpretDataWin');
// stat
formatCollectionTable();
updateInterpretationTable('stat');
ipcRenderer.send('redraw-collDataWin');
ipcRenderer.send('redraw-meansDataWin');
// poles
formatSitesTable();
updateInterpretationTable('poles');
ipcRenderer.send('redraw-vgpDataWin');
// save data
switch (currentPage) {
case 'nav-pca-tab':
chartsToExport = [zijdPCA.chartObj, stereoPCA.chartObj, intensPCA.chartObj];
break;
case 'nav-stat-tab':
chartsToExport = [stereoStat];
break;
case 'nav-poles-tab':
chartsToExport = [stereoPoles.sites, stereoPoles.vgps];
break;
}

saveLocalStorage();

// additional highcharts charts data processing - deleting of unwanted points
document.querySelectorAll('.highcharts-a11y-dummy-point').forEach(function(a) {
a.remove();
})

INITIALIZE = false;

return;
}


// actual redraw
// if (INITIALIZE) {
// // Charts creating
// // pca
// zijdPCA = plotZijderveldDiagram(hover);
// stereoPCA = plotStereoDiagram(hover);
// intensPCA = plotIntensityDiagram(hover);
// // stat
// stereoStat = statPlotStereoDiagram();
// // poles
// stereoPoles = polesPlotStereoDiagrams();
// // Tables creating
// // pca
// formatSpecimenTable();
// updateInterpretationTable('pca');
// ipcRenderer.send('redraw-specDataWin');
// ipcRenderer.send('redraw-interpretDataWin');
// // stat
// formatCollectionTable();
// updateInterpretationTable('stat');
// ipcRenderer.send('redraw-collDataWin');
// ipcRenderer.send('redraw-meansDataWin');
// // poles
// formatSitesTable();
// updateInterpretationTable('poles');
// ipcRenderer.send('redraw-vgpDataWin');
// // save data
// switch (currentPage) {
// case 'nav-pca-tab':
// chartsToExport = [zijdPCA.chartObj, stereoPCA.chartObj, intensPCA.chartObj];
// break;
// case 'nav-stat-tab':
// chartsToExport = [stereoStat];
// break;
// case 'nav-poles-tab':
// chartsToExport = [stereoPoles.sites, stereoPoles.vgps];
// break;
// }
//
// saveLocalStorage();
//
// // additional highcharts charts data processing - deleting of unwanted points
// document.querySelectorAll('.highcharts-a11y-dummy-point').forEach(function(a) {
// a.remove();
// })
//
// INITIALIZE = false;
//
// return;
// }
//
// // actual redraw
if (context) {

var chartContainers = [
Expand Down Expand Up @@ -1781,7 +1780,7 @@ function __init__() {
* Function __init__
* Initializes the PMTools
*/

console.log('ПРивет...')
// load current page from localStorage
var selectedPageID = (localStorage.getItem("currPage")) ? localStorage.getItem("currPage") : 'nav-pca-tab';
document.getElementById(selectedPageID).click();
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@
"bootstrap": "^4.5.2",
"convert-svg-to-jpeg": "^0.5.0",
"custom-electron-titlebar": "^3.2.4",
"dialogs": "^2.0.1",
"edge": "^7.10.1",
"edge-js": "^15.5.2",
"electron-edge-js": "^14.16.0",
"electron-localshortcut": "^3.2.1",
"electron-prompt": "^1.6.0",
"electron-prompt": "^1.7.0",
"frameless-titlebar": "^2.1.3",
"highcharts": "^8.2.0",
"highcharts-export-server": "^2.1.0",
Expand All @@ -62,7 +63,6 @@
"panzoom": "^9.2.5",
"postinstall-js": "^0.7.1",
"sharp": "^0.28.3",
"smalltalk": "^4.0.6",
"svg-pan-zoom": "github:ariutta/svg-pan-zoom",
"svg2pdf.js": "^2.1.0",
"uaup-js": "0.0.22",
Expand All @@ -77,7 +77,8 @@
"electron-packager": "^15.0.0",
"electron-rebuild": "^2.3.5",
"electron-squirrel-startup": "^1.0.0",
"electron-winstaller": "^5.0.0"
"electron-winstaller": "^5.0.0",
"smalltalk": "^4.0.7"
},
"build": {
"appId": "com.i194.pmtools",
Expand Down
13 changes: 5 additions & 8 deletions renderers/interpretationDataRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const path = require('path');
const customTitlebar = require('custom-electron-titlebar');
const dns = require("dns");
const fs = require("fs");
const dialog = require('electron').remote.dialog
const dialog = require('electron').remote.dialog;

// Describe custom title bar functionality

Expand Down Expand Up @@ -143,11 +143,8 @@ function updateInterpretationTable() {
var directionTect = literalToCoordinates(componentTect.coordinates).toVector(Direction);

// Handle comments on interpretations
if(interpretation.comment === null) {
comment = ChRM_COMMENT;
} else {
comment = interpretation.comment;
}
if ((interpretation.comment === null) || !interpretation.comment) comment = ChRM_COMMENT;
else comment = interpretation.comment;

// Full code of interpretation

Expand Down Expand Up @@ -255,8 +252,8 @@ function interpretationTableClickHandler(event) {
break;
}
}

if (columnIndex === 12) {
console.log(columnIndex, event.target)
if (columnIndex === 10) {
selectedSpecimen.interpretations[currSpecRowIndex].comment = event.target.innerHTML;
}

Expand Down
7 changes: 4 additions & 3 deletions renderers/main_render.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ cancelPCA0.addEventListener('click', (event) => {
confirmPCA0.addEventListener('click', (event) => {
if (settings.pca.pcaToolsText) {
dotSelector.readDots('pca-pca0-text-input', 'specimen');
if (document.getElementById('pca-pca0-text-input', 'specimen').classList.contains('error-input')) return;
if (document.getElementById('pca-pca0-text-input', 'specimen').classList.contains('error-input')) return;
}
else dotSelector.selectSteps('pca-pca0-first-step', 'pca-pca0-last-step');
makeInterpretation("TAU1", true, undefined, "PCA0");
Expand All @@ -281,7 +281,7 @@ cancelPCAGC.addEventListener('click', (event) => {
confirmPCAGC.addEventListener('click', (event) => {
if (settings.pca.pcaToolsText) {
dotSelector.readDots('pca-gc-text-input', 'specimen');
if (document.getElementById('pca-gc-text-input').classList.contains('error-input')) return;
if (document.getElementById('pca-gc-text-input').classList.contains('error-input')) return;
}
else dotSelector.selectSteps('pca-gc-first-step', 'pca-gc-last-step');
makeInterpretation("TAU3", true, false, "GC PCA");
Expand All @@ -296,7 +296,7 @@ cancelPCAGCn.addEventListener('click', (event) => {
confirmPCAGCn.addEventListener('click', (event) => {
if (settings.pca.pcaToolsText) {
dotSelector.readDots('pca-gcn-text-input', 'specimen');
if (document.getElementById('pca-gcn-text-input').classList.contains('error-input')) return;
if (document.getElementById('pca-gcn-text-input').classList.contains('error-input')) return;
}
else dotSelector.selectSteps('pca-gcn-first-step', 'pca-gcn-last-step');
makeInterpretation("TAU3", true, true, "GCn PCA");
Expand Down Expand Up @@ -354,6 +354,7 @@ confirmStatGC.addEventListener('click', (event) => {
if (document.getElementById('stat-gc-text-input').classList.contains('error-input')) return;
}
else dotSelector.selectSteps('stat-gc-first-step', 'stat-gc-last-step');
console.log('chto blin')
makeStatGC(false, 'collection');
document.getElementById('stat-gc-btn').click();
})
Expand Down
4 changes: 2 additions & 2 deletions renderers/polesMeanRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ function meanTableClickHandler(event) {
break;
}
}

if(columnIndex === 11) {
console.log(columnIndex)
if(columnIndex === 13) {
selectedSitesSet.means[currSpecRowIndex].comment = event.target.innerHTML;
}

Expand Down
Loading

0 comments on commit 12bed5c

Please sign in to comment.