Commit 9a3dc578 authored by Fintan Mc Gee's avatar Fintan Mc Gee

fied issue where layer cahrts were not looking u valeus in the master layer

parent 1e74d714
......@@ -1100,7 +1100,7 @@ var MultiLayerGraph = function (nodes, links, layerName) {
if(attributeName) {
if (n.hasOwnProperty(attributeName)) {
newEntry[attributeName] = n[attributeName];
newEntry[attributeName] = g.getNodeProperty(n.uid,attributeName);
attributeFound = true;
}
}
......
......@@ -1126,7 +1126,7 @@ var MultiLayerGraph = function (nodes, links, layerName) {
if(attributeName) {
if (n.hasOwnProperty(attributeName)) {
newEntry[attributeName] = n[attributeName];
newEntry[attributeName] = g.getNodeProperty(n.uid,attributeName);
attributeFound = true;
}
}
......@@ -2217,8 +2217,48 @@ var MultiLayerGraph = function (nodes, links, layerName) {
});
};
/**************************************
* orderNodesGlobally
*
* Functionality: reorder the nodes array in the amster layer
* and apply that ordering to the nodes in all layers
*
* Created By : Fintan McGee (LIST)
* Date: 21/07/2017
*******************************/
g.orderNodesGlobally = function (orderByField, descending) {
if(g.name != "MasterLayer") {
console.log("Error:copyNodeLayout was called on layer other than master");
return;
}
// ascending sort by default
var nodeSort = function(a,b) {
// never return 0 as sort in chrome is not stable,
// therefore fall back onto unique NodeID
return a[orderByField] > b[orderByField] ? 1 : ( a[orderByField] < b[orderByField] ? -1 : a.uid > b.uid);
};
if(descending) {
nodeSort = function(a,b) {
// never return 0 as sort in chrome is not stable,
// therefore fall back onto unique NodeID
return a[orderByField] < b[orderByField] ? 1 : ( a[orderByField] > b[orderByField] ? -1 : a.uid > b.uid);
};
}
g.nodes.sort(nodeSort);
g.nodes.forEach(function(n,index) {
n.BLZ_order = index;
});
g.layers.forEach(function(layer) {
layer.nodes.forEach(function(layerNode) {
layerNode.BLZ_order = g.node[layerNode.uid].BLZ_order;
})
});
};
/**************************************
* orderNodesBFS
*
......@@ -2948,11 +2988,13 @@ var MultiLayerGraph = function (nodes, links, layerName) {
if(l){
//if(g.aspects["Master"].length) {
// if (typeof(g.aspects["Master"][0]) === "object") {
g.aspects[aspectName].push(l)
//}else {
// g.aspects[aspectName].push(l.name)
// }
//}
// check to make sure the layer is not alread in the aspect
if (!g.aspects[aspectName].find( function (layer) {
return layerName === layer.name;
}) ){
g.aspects[aspectName].push(l);
console.log("Added layer " + layerName + " to aspect " + aspectName)
}
}
});
......@@ -3234,6 +3276,58 @@ var MultiLayerGraph = function (nodes, links, layerName) {
g.mapAspectsToLayerNames(); // default as used by the server, overwrritter when rtpepare graph is caleld at froit end
}
/**************************************
* initAspects()
* Functionality: Initaliseres the aspece with the refercens to the input aspectaspect objects
*
* @param a JSON object containing the asapects names of keys, and and array of layer names for each aspect
* Created By : Fintan McGee (LIST)
* Date: 21/02/2019
********************************/
g.initAspects=function(aspectObj) {
// assume aspets are referecnes
for(var aspectName in aspectObj){
if(!g.aspects.hasOwnProperty(aspectName)) {
g.aspects[aspectName] = [];
}
aspectObj[aspectName].forEach(function(layerName) {
if(g.getLayerByName()) {
g.addLayersToAspect(aspectName,layerName);
}
});
}
}
g.getAspectLayerNames = function(aspectName) {
var namesArray = [],
layers= g.GetAspectLayers(aspectName);
layers.forEach(function(layer) {
namesArray.push(layer.name);
});
return namesArray;
}
g.getAspectLayers = function(aspectName) {
var layerArray= [];
if(!g.aspects.hasOwnProperty(aspectName)) {
console.log("Warning in GetAspectLayers: unrecognised layer name" + aspectName);
} else {
g.aspects[aspectName].forEach(function(aspectLayer) {
if(typeof(aspectLayer) === "string") {
layerArray.push(g.getLayerByName(aspectLayer))
} else {
layerArray.push(aspectLayer);
}
})
}
return layerArray;
}
/**************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment