Skip to content

Commit

Permalink
v1.3.3 build
Browse files Browse the repository at this point in the history
  • Loading branch information
raphywink committed Oct 2, 2020
1 parent 1b438ce commit bdca365
Show file tree
Hide file tree
Showing 7 changed files with 16,067 additions and 6,617 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,9 @@ function generateUUID() {
HierarchyWorker.prototype.reduceAnnotationToViewableTimeAndPath = function (annotation, path, viewPortStartSample, viewPortEndSample) {
var _this = this;
this.idHashMap = undefined; // reset 4
this.linkHashMap = undefined;
this.createIdHashMap(path, annotation);
this.createLinkHashMap(annotation); // from child to parents
this.linkSubToSuperHashMap = undefined;
this.createIdHashMapForPath(path, annotation);
this.createLinkSubToSuperHashMap(annotation); // from child to parents
var childLevel = this.reduceToItemsWithTimeInView(annotation, path, viewPortStartSample, viewPortEndSample);
// clone and empty annotation
var annotationClone = JSON.parse(JSON.stringify(annotation));
Expand Down Expand Up @@ -433,6 +433,38 @@ function generateUUID() {
return ret;
};
;
/**
*
* @param annotation annotation to guess LinkDefinitions from
*/
HierarchyWorker.prototype.guessLinkDefinitions = function (annotation) {
// console.log(annotation)
this.idHashMap = undefined; // reset 4
this.linkSubToSuperHashMap = undefined;
this.createIdHashMapForEveryLevel(annotation);
this.createLinkSubToSuperHashMap(annotation); // from child to parents
this.createLinkSuperToSubHashMap(annotation); // from parent to children
// console.log(this.idHashMap);
// console.log(this.linkSubToSuperHashMap);
// console.log(this.linkSuperToSubHashMap);
var linkDefsSuperToSub = this.findAllLinkDefs(this.linkSuperToSubHashMap, false);
var linkDefsSubToSuper = this.findAllLinkDefs(this.linkSubToSuperHashMap, true);
// console.log(linkDefsSuperToSub);
// console.log(linkDefsSubToSuper);
linkDefsSuperToSub.forEach(function (linkDefSuperToSub) {
linkDefsSubToSuper.forEach(function (linkDefSubToSuper) {
if (linkDefSuperToSub.superlevelName === linkDefSubToSuper.superlevelName && linkDefSuperToSub.sublevelName === linkDefSubToSuper.sublevelName) {
if (linkDefSuperToSub.type === "ONE_TO_ONE") {
linkDefSuperToSub.type = linkDefSubToSuper.type;
}
else if (linkDefSuperToSub.type === "ONE_TO_MANY" && linkDefSubToSuper.type === "MANY_TO_MANY") {
linkDefSuperToSub.type = linkDefSubToSuper.type;
}
}
});
});
return (linkDefsSuperToSub);
};
///////////////////////////
// private api
HierarchyWorker.prototype.reduceToItemsWithTimeInView = function (annotation, path, viewPortStartSample, viewPortEndSample) {
Expand All @@ -450,7 +482,7 @@ function generateUUID() {
HierarchyWorker.prototype.giveTimeToParentsAndAppendItemsAndLinks = function (annotation, parentLevel, childLevel) {
var _this = this;
childLevel.items.forEach(function (item) {
var parentIds = _this.linkHashMap.get(item.id);
var parentIds = _this.linkSubToSuperHashMap.get(item.id);
if (typeof parentIds !== 'undefined') {
parentIds.forEach(function (parentId) {
var parentItem = _this.idHashMap.get(parentId);
Expand Down Expand Up @@ -493,7 +525,7 @@ function generateUUID() {
level = this.getLevelDetails(levelName, annotation);
}
level.items.forEach(function (item) {
var parentId = _this.linkHashMap.get(item.id);
var parentId = _this.linkSubToSuperHashMap.get(item.id);
var parents = _this.idHashMap.get(parentId);
if (parents) {
parents.forEach(function (parent) {
Expand All @@ -511,7 +543,7 @@ function generateUUID() {
}
});
};
HierarchyWorker.prototype.createIdHashMap = function (path, annotation) {
HierarchyWorker.prototype.createIdHashMapForPath = function (path, annotation) {
var _this = this;
this.idHashMap = new Map();
path.forEach(function (levelName) {
Expand All @@ -521,20 +553,138 @@ function generateUUID() {
});
});
};
HierarchyWorker.prototype.createLinkHashMap = function (annotation) {
HierarchyWorker.prototype.createIdHashMapForEveryLevel = function (annotation) {
var _this = this;
this.linkHashMap = new Map();
this.idHashMap = new Map();
annotation.levels.forEach(function (level) {
level.items.forEach(function (item) {
_this.idHashMap.set(item.id, item);
});
});
};
HierarchyWorker.prototype.createLinkSubToSuperHashMap = function (annotation) {
var _this = this;
this.linkSubToSuperHashMap = new Map();
annotation.links.forEach(function (link) {
if (!_this.linkHashMap.has(link.toID)) {
_this.linkHashMap.set(link.toID, [link.fromID]);
if (!_this.linkSubToSuperHashMap.has(link.toID)) {
_this.linkSubToSuperHashMap.set(link.toID, [link.fromID]);
}
else {
var prevParents = _this.linkHashMap.get(link.toID);
var prevParents = _this.linkSubToSuperHashMap.get(link.toID);
prevParents.push(link.fromID);
_this.linkHashMap.set(link.toID, prevParents);
_this.linkSubToSuperHashMap.set(link.toID, prevParents);
}
});
};
HierarchyWorker.prototype.createLinkSuperToSubHashMap = function (annotation) {
var _this = this;
this.linkSuperToSubHashMap = new Map();
annotation.links.forEach(function (link) {
if (!_this.linkSuperToSubHashMap.has(link.fromID)) {
_this.linkSuperToSubHashMap.set(link.fromID, [link.toID]);
}
else {
var prevChildren = _this.linkSuperToSubHashMap.get(link.fromID);
prevChildren.push(link.toID);
_this.linkSuperToSubHashMap.set(link.fromID, prevChildren);
}
});
};
// private walkAndAppendToLinkDefinitions(key, path, foundPaths, linkHashMap){
// // add to path only if we havn't visited it yet
// let item = this.idHashMap.get(key);
// let curLevelName = item.labels[0].name;
// if(!path.includes(curLevelName)){
// path.push(curLevelName);
// }
// // get values
// let values = linkHashMap.get(key);
// if(typeof values !== "undefined"){
// values.forEach((connectedItemId) => {
// // let item = this.idHashMap.get(connectedItemId);
// // path.push(item.labels[0].name);
// this.walkAndAppendToLinkDefinitions(connectedItemId, path, foundPaths, linkHashMap);
// })
// } else {
// // reached end of path
// // -> append to foundPaths + reset path
// // foundPaths.push(path.join(' → '));
// // path = [];
// }
// }
// probably should move this to service
// private onlyUnique(value, index, self) {
// return self.indexOf(value) === index;
// }
HierarchyWorker.prototype.findAllLinkDefs = function (linkHashMap, reverse) {
// console.log("in findAllLinkDefs");
var _this = this;
var foundLinkDefs = [];
var foundLinkDefStrings = [];
// loop through map
linkHashMap.forEach(function (values, key, map) {
var connectedLevels = [];
// if([173].indexOf(key) !== -1) { // only start at 8 for now
var startItem = _this.idHashMap.get(key);
var startLevelName = startItem.labels[0].name;
// console.log("startLevelName:", startLevelName);
// console.log("key:", key);
// console.log("values:", values);
// console.log("map:", map);
values.forEach(function (connectedItemId) {
var connectedItem = _this.idHashMap.get(connectedItemId);
var connectedItemLevelName = connectedItem.labels[0].name;
var linkDefType;
// console.log("connectedItemLevelName:", connectedItemLevelName);
if (connectedLevels.indexOf(connectedItemLevelName) === -1) {
connectedLevels.push(connectedItemLevelName);
linkDefType = "ONE_TO_ONE";
}
else {
if (!reverse) {
linkDefType = "ONE_TO_MANY";
}
else {
linkDefType = "MANY_TO_MANY";
}
}
// this also depends on reverse
var linkDefString = startLevelName + ' → ' + connectedItemLevelName;
// console.log(linkDefString);
if (foundLinkDefStrings.indexOf(linkDefString) === -1) {
foundLinkDefStrings.push(linkDefString);
if (!reverse) {
foundLinkDefs.push({
type: linkDefType,
superlevelName: startLevelName,
sublevelName: connectedItemLevelName
});
}
else {
foundLinkDefs.push({
type: linkDefType,
superlevelName: connectedItemLevelName,
sublevelName: startLevelName
});
}
}
else {
// update type (only in upgradable direction)
if (foundLinkDefs[foundLinkDefStrings.indexOf(linkDefString)].type === "ONE_TO_ONE") {
foundLinkDefs[foundLinkDefStrings.indexOf(linkDefString)].type = linkDefType;
}
else if (foundLinkDefs[foundLinkDefStrings.indexOf(linkDefString)].type === "ONE_TO_MANY" && linkDefType === "MANY_TO_MANY") {
foundLinkDefs[foundLinkDefStrings.indexOf(linkDefString)].type = linkDefType;
}
}
});
// }
});
// console.log("------------");
// console.log(foundLinkDefStrings);
// console.log(foundLinkDefs); // foundLinkDefs.filter(this.onlyUnique)
return (foundLinkDefs);
};
return HierarchyWorker;
}());

Expand Down
14 changes: 14 additions & 0 deletions dist/NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# What's New

## Version 1.3.3

### new features / performance tweaks / improvements

- hierarchy guesser completed for when no DBconfig is available
- higher y resolution on level canvases
- switched to arial font

### bug fixes

- double showing of progress-bar component
- fixed scrollbar in level canvases pane issues (now always hidden)
- fixed bundle list side bar animation

## Version 1.3.2

### new features / performance tweaks / improvements
Expand Down
Binary file added dist/demoDBs/ae/msajc003.wav
Binary file not shown.
Loading

0 comments on commit bdca365

Please sign in to comment.