Commit 497b08c4 authored by Fintan Mc Gee's avatar Fintan Mc Gee

Added layout to aspect combinations

parent 96900b87
...@@ -622,6 +622,38 @@ var updateAspect_cb = function (req, res) { ...@@ -622,6 +622,38 @@ var updateAspect_cb = function (req, res) {
} }
res.json({msg:"Apsect operation completed"}); res.json({msg:"Apsect operation completed"});
}; };
createCombination_cb
/**************************************
* createCombination_cb
* Functionality: USed to combine aspect for enw layering
*
* Created By : Fintan McGee (LIST)
* Date: 19/07/2017
*******************************/
var createCombination_cb = function (req, res) {
sLog.debug_log("***********createCombination_cb" + JSON.stringify(req.body) + "\n\n");
sLog.debug_log("***********graphDB.userGraphs" + JSON.stringify(graphDB.userGraphs) + "\n\n");
//var updatedNodeCount = graphObj.userGraphs[req.user.username].updatePositions(req.body.positionMap);
graphObj.userGraphs[req.user.username].mapAspectsToLayerNames(); // ensure aspects (especially Master) are up to date with layers and are using strings
if(req.body.operationType === "createCombination") {
graphObj.userGraphs[req.user.username].createCombination(req.body.layerName,req.body.secondaryAspectName)
}
/*else if(req.body.operationType === "copyNodeToLayer") {
//(targetLayerName,masterProjectionNodeTypes, masterProjectionEdgeTypes, projectionEdgeType)
var node= graphObj.userGraphs[req.user.username].node[req.body.nodeId]
graphObj.userGraphs[req.user.username].getLayerByName(req.body.layerName).copyNodeToLayer(node);
}*/
else {
sLog.log("***********createCombination_cb: Unknow operation for server updateAspect" + "\n\n");
}
res.json({msg:"createCombination operation completed"});
};
var saveUserGraph_cb = function (req, res) { var saveUserGraph_cb = function (req, res) {
sLog.debug_log("***********saveUserGraph" + JSON.stringify(req.body) + "\n\n"); sLog.debug_log("***********saveUserGraph" + JSON.stringify(req.body) + "\n\n");
...@@ -822,6 +854,9 @@ simple_serve.post('/updateLayer', blizaarSystem.ensureAuthenticated, updateLayer ...@@ -822,6 +854,9 @@ simple_serve.post('/updateLayer', blizaarSystem.ensureAuthenticated, updateLayer
simple_serve.post('/updateAspect', blizaarSystem.ensureAuthenticated, updateAspect_cb); simple_serve.post('/updateAspect', blizaarSystem.ensureAuthenticated, updateAspect_cb);
simple_serve.post('/getEdgeSet', blizaarSystem.ensureAuthenticated, getEdgeSet_cb ); simple_serve.post('/getEdgeSet', blizaarSystem.ensureAuthenticated, getEdgeSet_cb );
simple_serve.post('/removeTempTagLabel', blizaarSystem.ensureAuthenticated, removeTempTagLabel_cb); simple_serve.post('/removeTempTagLabel', blizaarSystem.ensureAuthenticated, removeTempTagLabel_cb);
simple_serve.post('/createCombination', blizaarSystem.ensureAuthenticated, createCombination_cb );
// data and metadata storage and retrieval // data and metadata storage and retrieval
simple_serve.post('/saveUserGraph', blizaarSystem.ensureAuthenticated, saveUserGraph_cb); simple_serve.post('/saveUserGraph', blizaarSystem.ensureAuthenticated, saveUserGraph_cb);
......
...@@ -96,6 +96,18 @@ angular.module('blizaarModule.controllers') ...@@ -96,6 +96,18 @@ angular.module('blizaarModule.controllers')
$scope.init = function () { $scope.init = function () {
$scope.initializeAspects(); $scope.initializeAspects();
$scope.populateprimaryLayerList(); $scope.populateprimaryLayerList();
$scope.model.displayGraphs= [];
if( multiLayerGraphService.getGraph().aspectCombinations) {
multiLayerGraphService.getGraph().aspectCombinations.forEach(function (combinationLayer) {
$scope.model.displayGraphs.push({
graphDisplayName: combinationLayer.name,
graph: combinationLayer.name,
tagName: "graph_" + ($scope.model.displayGraphs.length + 1)
})
});
}
} }
$scope.changePrimaryAspect = function() { $scope.changePrimaryAspect = function() {
...@@ -145,10 +157,20 @@ angular.module('blizaarModule.controllers') ...@@ -145,10 +157,20 @@ angular.module('blizaarModule.controllers')
var masterGraph = multiLayerGraphService.getGraph(); var masterGraph = multiLayerGraphService.getGraph();
$scope.model.combinationName = masterGraph.createCombination($scope.model.selectedPrimaryLayerLocal, $scope.model.selectedSecondaryAspectName); $scope.model.combinationName = masterGraph.createCombination($scope.model.selectedPrimaryLayerLocal, $scope.model.selectedSecondaryAspectName);
dataService.createCombinationOnServer( $scope.model.selectedPrimaryAspectName, $scope.model.selectedPrimaryLayerLocal, $scope.model.selectedSecondaryAspectName);
var layoutCompleteCount= 0;
masterGraph.aspectCombinations.forEach(function(combinationLayer) { masterGraph.aspectCombinations.forEach(function(combinationLayer) {
$scope.model.displayGraphs.push({graphDisplayName: combinationLayer.name, graph: combinationLayer.name, tagName:"graph_" + ($scope.model.displayGraphs.length + 1) }) $scope.model.displayGraphs.push({graphDisplayName: combinationLayer.name, graph: combinationLayer.name, tagName:"graph_" + ($scope.model.displayGraphs.length + 1) })
}); dataService.doServerLayout("Fruchterman-Reingold", combinationLayer.name).then(function() {
layoutCompleteCount++;
console.log("layoutCompleteCount == " + layoutCompleteCount);
if( layoutCompleteCount === masterGraph.aspectCombinations.length ) {
$scope.refreshGraph();
}
});
});
} }
} }
$scope.$watch('model.selectedLayerLocal', function(newData, oldData){ $scope.$watch('model.selectedLayerLocal', function(newData, oldData){
......
...@@ -1144,6 +1144,39 @@ angular.module('blizaarModule.services') ...@@ -1144,6 +1144,39 @@ angular.module('blizaarModule.services')
return err.message; return err.message;
}); });
}, },
/**************************************
* updateLayerOnServer
* Functionality: Used to create and update graphs on server
* Front end interactions are replicate in the server graph instance
*
* Created By : Fintan McGee (LIST)
* Date: 20/09/2017
*******************************/
createCombinationOnServer : function(aspectName, layerName,secondaryAspectName) {
return $http({
method: 'post',
url: '/createCombination', // url where to get data.
headers: { 'Content-Type': 'application/json' }, // set the headers so angular passing info as form data (not request payload)
data: {
operationType:"createCombination",
aspectName:aspectName,
layerName:layerName,
secondaryAspectName:secondaryAspectName
}
})// Success case
.then(function () {
console.log("Updated combination successfully ");
return true;
},
// Error handling
function (err) {
alert(err.data);
console.log("createCombinationOnServer" + err);
return err.message;
});
},
/************************************** /**************************************
* buildNodeSetQueryGraph * buildNodeSetQueryGraph
* Functionality: Fetches the node set specified by name from the server, * Functionality: Fetches the node set specified by name from the server,
......
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