|
@@ -70,6 +70,16 @@ function addRectangle1(id,x,y,w,h,pattern,idtext,assignmentsstation,assignments)
|
|
changeRectPosition(localID, "height", this.value );
|
|
changeRectPosition(localID, "height", this.value );
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ //allow to disable rectangle
|
|
|
|
+ $('[data-class=setinactive]',clone).change(function() {
|
|
|
|
+ $(this).parent().parent().parent().toggleClass("singleRect");
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ $('[data-class=removeRect]',clone).on('click', function(e) {
|
|
|
|
+ $(this).parent().parent().parent().remove();
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
|
|
//Alle Abkürzungen einfügen und prüfen ob im pattern angegeben
|
|
//Alle Abkürzungen einfügen und prüfen ob im pattern angegeben
|
|
abk.forEach(function(item){
|
|
abk.forEach(function(item){
|
|
@@ -79,6 +89,9 @@ function addRectangle1(id,x,y,w,h,pattern,idtext,assignmentsstation,assignments)
|
|
if(typeof pattern !== 'undefined' && pattern[item]){
|
|
if(typeof pattern !== 'undefined' && pattern[item]){
|
|
$('[data-class=input]',clonepattern).prop('checked', true);
|
|
$('[data-class=input]',clonepattern).prop('checked', true);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ $('[data-class=input]',clonepattern).change(refreshassignments);
|
|
$('[data-class=RectanglePattern',clone).append(clonepattern);
|
|
$('[data-class=RectanglePattern',clone).append(clonepattern);
|
|
|
|
|
|
});
|
|
});
|
|
@@ -131,7 +144,7 @@ function addRectangle1(id,x,y,w,h,pattern,idtext,assignmentsstation,assignments)
|
|
});
|
|
});
|
|
$('[data-class=AllAssignments]',clonepattern).append(clonepatternvalue)
|
|
$('[data-class=AllAssignments]',clonepattern).append(clonepatternvalue)
|
|
});
|
|
});
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
$('[data-class=RectangleAssignmentStation]',clone).append(clonepattern);
|
|
$('[data-class=RectangleAssignmentStation]',clone).append(clonepattern);
|
|
|
|
|
|
@@ -161,6 +174,11 @@ function addRectangle1(id,x,y,w,h,pattern,idtext,assignmentsstation,assignments)
|
|
e.target.nextElementSibling.append(clonepatternvalue)
|
|
e.target.nextElementSibling.append(clonepatternvalue)
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ //Default Assignment nur bei angekreuzten pattern ausfüllen
|
|
|
|
+ if(typeof pattern !== 'undefined' && pattern[item["abk"]]){
|
|
|
|
+ $('[data-class=AssignmentDefaultValue]',clonepattern).text($("#FormPattern2_Form_" + item["abk"]).find(":selected").text());
|
|
|
|
+ }
|
|
|
|
+
|
|
//Assignment Ausfüllen
|
|
//Assignment Ausfüllen
|
|
if(typeof assignments !== 'undefined' && assignments[item["abk"]]){
|
|
if(typeof assignments !== 'undefined' && assignments[item["abk"]]){
|
|
$.each(assignments[item["abk"]], function(i, item){
|
|
$.each(assignments[item["abk"]], function(i, item){
|
|
@@ -191,7 +209,22 @@ function addRectangle1(id,x,y,w,h,pattern,idtext,assignmentsstation,assignments)
|
|
var clone = document.importNode(document.querySelector('#RectanglesImage').content,true);
|
|
var clone = document.importNode(document.querySelector('#RectanglesImage').content,true);
|
|
$('[data-class=RectID]',clone).attr("id","Rect" + localID);
|
|
$('[data-class=RectID]',clone).attr("id","Rect" + localID);
|
|
$('[data-class=RectID]',clone).attr("y",y);
|
|
$('[data-class=RectID]',clone).attr("y",y);
|
|
- $('[data-class=RectID]',clone).text("Rect" + localID);
|
|
|
|
|
|
+
|
|
|
|
+ //Write text into img. such that this text shall equal the text on the slides
|
|
|
|
+ var recttext = "";
|
|
|
|
+ abk.forEach(function(item){
|
|
|
|
+ if(typeof pattern !== 'undefined' && pattern[item]){
|
|
|
|
+ recttext += item;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ if(typeof idtext !== 'undefined' && idtext != ""){
|
|
|
|
+ recttext += "ID:" + idtext;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ $('[data-class=RectID]',clone).text(recttext);
|
|
|
|
+
|
|
|
|
|
|
$('[data-class=RectID]',clone).css("top", y * scalefactor() + "px");
|
|
$('[data-class=RectID]',clone).css("top", y * scalefactor() + "px");
|
|
$('[data-class=RectID]',clone).css("left", x * scalefactor() + "px");
|
|
$('[data-class=RectID]',clone).css("left", x * scalefactor() + "px");
|
|
@@ -229,6 +262,7 @@ function addRectangle1(id,x,y,w,h,pattern,idtext,assignmentsstation,assignments)
|
|
function createPatternForm(){
|
|
function createPatternForm(){
|
|
/* Load pattern config */
|
|
/* Load pattern config */
|
|
//Create form for WAS/Stations/Pattern and WAS/Slicer
|
|
//Create form for WAS/Stations/Pattern and WAS/Slicer
|
|
|
|
+
|
|
var populate = ["FormPattern","FormPattern2","FormPatternAssignment"]
|
|
var populate = ["FormPattern","FormPattern2","FormPatternAssignment"]
|
|
|
|
|
|
var first = true;
|
|
var first = true;
|
|
@@ -241,6 +275,7 @@ function createPatternForm(){
|
|
$('[data-class=Abkürzung]',clone).text(item["abk"]);
|
|
$('[data-class=Abkürzung]',clone).text(item["abk"]);
|
|
if(first)
|
|
if(first)
|
|
abk.push(item["abk"])
|
|
abk.push(item["abk"])
|
|
|
|
+ $('[data-class=Optionen]',clone).attr("name",item["abk"])
|
|
$.each( item["types"], function(i, item){
|
|
$.each( item["types"], function(i, item){
|
|
$('[data-class=Optionen]',clone).append('<option value="' + item +'">' + item +'</option>');
|
|
$('[data-class=Optionen]',clone).append('<option value="' + item +'">' + item +'</option>');
|
|
});
|
|
});
|
|
@@ -250,6 +285,13 @@ function createPatternForm(){
|
|
});
|
|
});
|
|
//Add "Text" to abk to show it within rects
|
|
//Add "Text" to abk to show it within rects
|
|
first = false;
|
|
first = false;
|
|
|
|
+
|
|
|
|
+ //on Patternform2 change trigger assignment default reset
|
|
|
|
+ if(populate2 == "FormPattern2"){
|
|
|
|
+ abk.forEach(function(localabk){
|
|
|
|
+ $("#FormPattern2_Form_" + localabk).change(refreshassignments);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
});
|
|
});
|
|
});
|
|
});
|
|
abk.length = 0;
|
|
abk.length = 0;
|
|
@@ -260,7 +302,6 @@ function createPatternForm(){
|
|
$("#savelocation").append('<option value="' + item +'">' + item +'</option>');
|
|
$("#savelocation").append('<option value="' + item +'">' + item +'</option>');
|
|
});
|
|
});
|
|
});
|
|
});
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
function updateSlicerPatternForm(){
|
|
function updateSlicerPatternForm(){
|
|
@@ -384,11 +425,16 @@ function assignmentGetAllStatios(cur) {
|
|
}
|
|
}
|
|
|
|
|
|
//gets assignments for current rectangle
|
|
//gets assignments for current rectangle
|
|
-function assignmentGetAllAssignments(cur) {
|
|
|
|
|
|
+function assignmentGetAllAssignments(cur, addDefaultValues = false) {
|
|
var assignments = {};
|
|
var assignments = {};
|
|
cur.find(".RectangleAssignment div").each(function() {
|
|
cur.find(".RectangleAssignment div").each(function() {
|
|
- assname = cur.attr('name')
|
|
|
|
|
|
+ assname = $(this).attr('name')
|
|
var allass = new Set();
|
|
var allass = new Set();
|
|
|
|
+
|
|
|
|
+ if(addDefaultValues && $(this).find(".RectanglesAssignmentDefaultValue").first().text() != ""){
|
|
|
|
+ allass.add($(this).find(".RectanglesAssignmentDefaultValue").first().text());
|
|
|
|
+ }
|
|
|
|
+
|
|
$(this).find(".RectanglesAssignmentValue").each(function() {
|
|
$(this).find(".RectanglesAssignmentValue").each(function() {
|
|
allass.add($(this).text());
|
|
allass.add($(this).text());
|
|
});
|
|
});
|
|
@@ -399,6 +445,27 @@ function assignmentGetAllAssignments(cur) {
|
|
return assignments;
|
|
return assignments;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+function assignmentGetAllEmptyAssignments(cur){
|
|
|
|
+ var assignments = {};
|
|
|
|
+ cur.find(".RectangleAssignment div").each(function() {
|
|
|
|
+ assname = $(this).attr('name')
|
|
|
|
+ var allass = new Set();
|
|
|
|
+
|
|
|
|
+ if($(this).find(".RectanglesAssignmentDefaultValue").first().text() != ""){
|
|
|
|
+ allass.add($(this).find(".RectanglesAssignmentDefaultValue").first().text());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $(this).find(".RectanglesAssignmentValue").each(function() {
|
|
|
|
+ allass.add($(this).text());
|
|
|
|
+ });
|
|
|
|
+ if(!allass.size){
|
|
|
|
+ assignments[assname] = "";
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return assignments;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
|
|
function submitSlices(skip = false){
|
|
function submitSlices(skip = false){
|
|
//createJsonCutting();
|
|
//createJsonCutting();
|
|
@@ -409,7 +476,7 @@ function submitSlices(skip = false){
|
|
var skippall = false;
|
|
var skippall = false;
|
|
if(!skip){
|
|
if(!skip){
|
|
var checkedoptions = new Set();
|
|
var checkedoptions = new Set();
|
|
- $("#imgRectangles input[type=checkbox]:checked").each(function(index, data){
|
|
|
|
|
|
+ $("#imgRectangles wasRight input[type=checkbox]:checked").each(function(index, data){
|
|
checkedoptions.add($(data).attr("name"))
|
|
checkedoptions.add($(data).attr("name"))
|
|
});
|
|
});
|
|
var allskips = [];
|
|
var allskips = [];
|
|
@@ -435,8 +502,7 @@ function submitSlices(skip = false){
|
|
success: function(data){
|
|
success: function(data){
|
|
|
|
|
|
|
|
|
|
- console.log(Object.keys(data).length);
|
|
|
|
- if ( Object.keys(data).length == 1) {
|
|
|
|
|
|
+ if (!data.hasOwnProperty('override')) {
|
|
//clearFormFull();
|
|
//clearFormFull();
|
|
if(!skip){
|
|
if(!skip){
|
|
alert("Saved Images");
|
|
alert("Saved Images");
|
|
@@ -448,7 +514,7 @@ function submitSlices(skip = false){
|
|
}
|
|
}
|
|
else{
|
|
else{
|
|
if(!skip){
|
|
if(!skip){
|
|
- overlayOnDupliImages(data);
|
|
|
|
|
|
+ overlayOnDupliImages(data.override);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -466,24 +532,39 @@ function submitSlices(skip = false){
|
|
var assignmentstation = assignmentGetAllStatios($(this));
|
|
var assignmentstation = assignmentGetAllStatios($(this));
|
|
|
|
|
|
//get all assignments of current Rectangle
|
|
//get all assignments of current Rectangle
|
|
- var assignments = assignmentGetAllAssignments($(this));
|
|
|
|
|
|
+ var assignments = assignmentGetAllAssignments($(this), true);
|
|
|
|
+ //in case no assignments are found do next rect
|
|
|
|
+ console.log(assignments);
|
|
|
|
+ if(Object.keys(assignments).length === 0){
|
|
|
|
+ ++counter;
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //get all empty assignments of current Rectangle
|
|
|
|
+ var emptyassignments = assignmentGetAllEmptyAssignments($(this));
|
|
|
|
|
|
//get all combinations of assignments
|
|
//get all combinations of assignments
|
|
var result = recCombi(assignments, 0, [], {});
|
|
var result = recCombi(assignments, 0, [], {});
|
|
|
|
|
|
|
|
+
|
|
//Save assignments
|
|
//Save assignments
|
|
|
|
+
|
|
$.each(assignmentstation, function(i, station) {
|
|
$.each(assignmentstation, function(i, station) {
|
|
$.each(result, function(i, item) {
|
|
$.each(result, function(i, item) {
|
|
var obj = new Object();
|
|
var obj = new Object();
|
|
obj.img = data.url[counter];
|
|
obj.img = data.url[counter];
|
|
obj.station = station;
|
|
obj.station = station;
|
|
|
|
+
|
|
|
|
+ $.extend( item, emptyassignments );
|
|
|
|
+
|
|
obj.parts = item;
|
|
obj.parts = item;
|
|
obj.assignmentText = txt;
|
|
obj.assignmentText = txt;
|
|
-
|
|
|
|
|
|
+ console.log(obj);
|
|
//use storage function from assignment.js
|
|
//use storage function from assignment.js
|
|
submitAssignment(obj);
|
|
submitAssignment(obj);
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
+
|
|
++counter;
|
|
++counter;
|
|
});
|
|
});
|
|
}
|
|
}
|
|
@@ -498,6 +579,8 @@ function submitSlices(skip = false){
|
|
|
|
|
|
function overlayOnDupliImages(data) {
|
|
function overlayOnDupliImages(data) {
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
document.getElementById("overlayNotClickable").style.display = "block";
|
|
document.getElementById("overlayNotClickable").style.display = "block";
|
|
|
|
|
|
var clone = document.importNode(document.querySelector('#SlicerDupliOverlay').content,true);
|
|
var clone = document.importNode(document.querySelector('#SlicerDupliOverlay').content,true);
|
|
@@ -524,6 +607,24 @@ function showJson(){
|
|
copy2Clipboard(JSON.stringify(createJson()))
|
|
copy2Clipboard(JSON.stringify(createJson()))
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+function overrideRect(){
|
|
|
|
+
|
|
|
|
+ if (confirm('Please be carefull when overriding, are you sure?')) {
|
|
|
|
+ var curjson = createJson();
|
|
|
|
+ $.getJSON( "../server/json/Rectangle.json", function( data ) {
|
|
|
|
+ //Override Rects
|
|
|
|
+ $.each(data.Configs, function(i, item) {
|
|
|
|
+ if(curjson.name == item.name){
|
|
|
|
+ //data.Configs[i].rects = curjson.rects;
|
|
|
|
+ item.rects = curjson.rects;
|
|
|
|
+ console.log("Overriding")
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ submitJson("Rectangle.json", JSON.stringify(data));
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
|
|
function copy2Clipboard(datalink) {
|
|
function copy2Clipboard(datalink) {
|
|
const el = document.createElement('textarea');
|
|
const el = document.createElement('textarea');
|
|
@@ -615,6 +716,29 @@ function togglenext(currelement){
|
|
currelement.next().slideToggle();
|
|
currelement.next().slideToggle();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+function refreshassignments(){
|
|
|
|
+ $(".singleRect").each(function() {
|
|
|
|
+ var main = $(this);
|
|
|
|
+ $(this).find(".RectangleAssignment div").each(function() {
|
|
|
|
+ var curabk = $(this).attr('name');
|
|
|
|
+ var next = false;
|
|
|
|
+ main.find(".patternPart3 .patternPart3Input:checked ").each(function() {
|
|
|
|
+ if($(this).attr('name') == curabk){
|
|
|
|
+ next = true;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ if(next){
|
|
|
|
+ $(this).find(".RectanglesAssignmentDefaultValue").first().text($("#FormPattern2_Form_" + curabk).find(":selected").text())
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ $(this).find(".RectanglesAssignmentDefaultValue").first().text("")
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
$(document).ready(function() {
|
|
$(document).ready(function() {
|
|
createPatternForm();
|
|
createPatternForm();
|
|
updateSlicerPatternForm();
|
|
updateSlicerPatternForm();
|
|
@@ -624,6 +748,10 @@ $(document).ready(function() {
|
|
$("#slicerpatterninput").bind("keypress", {}, fillpatternForm);
|
|
$("#slicerpatterninput").bind("keypress", {}, fillpatternForm);
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
/*
|
|
/*
|
|
$("#sliceImg").bind('load', function() {
|
|
$("#sliceImg").bind('load', function() {
|
|
|
|
|
|
@@ -658,6 +786,10 @@ $('#sliceImg').on('load',function(){
|
|
showJson();
|
|
showJson();
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ $("#overrideRect").click(function() {
|
|
|
|
+ overrideRect();
|
|
|
|
+ });
|
|
|
|
+
|
|
$("#multiCut").click(function() {
|
|
$("#multiCut").click(function() {
|
|
getAllFiles($('#selectfolders').val());
|
|
getAllFiles($('#selectfolders').val());
|
|
});
|
|
});
|