Commit 667f7e9e authored by Amina Taoui's avatar Amina Taoui

select/unselect compartment + abstractionMode modification

parent 3901291e
......@@ -128,96 +128,131 @@ Ext.define('metExploreViz.view.form.abstractionForm.AbstractionForm', {
else if (e.getTarget().id === 'reveal'){
if (metExploreD3.GraphAbstraction.abstractionMode===true) {
metExploreD3.GraphAbstraction.abstractionMode=false;
var store = Ext.getStore("abstractionFormStore");
var grid = Ext.getCmp('abstractionGrid');
var txt = grid.query('tbtext')[0];
view.features[0].collapsible=true;
var e= store.getData().items;
var session = _metExploreViz.getSessionById("viz");
var networkData = session.getD3Data();
e.forEach(function (elt) {
if(elt.data.labelAbstraction===group){
var session = _metExploreViz.getSessionById("viz");
var networkData = session.getD3Data();
if (metExploreD3.GraphAbstraction.abstractionMode===true) {
var nodes= networkData.getNodes()
.filter(function (n) {
return n.id===elt.data.id;
});
metExploreD3.GraphAbstraction.abstractionMode = false;
var nodes= networkData.getNodes()
.filter(function (n) {
return n.id===elt.data.id;
});
metExploreD3.GraphAbstraction.revealAbstraction('viz',nodes,elt.data.links);
metExploreD3.GraphAbstraction.revealAbstraction('viz',nodes,elt.data.links);
store.reload();
var nb = store.count();
txt.setText('<b>Nb abstracted elements : ' + nb + '</b>');
}else{
metExploreD3.GraphAbstraction.abstractionMode=true;
var nodes= networkData.getNodes()
.filter(function (n) {
return n.id===elt.data.id;
});
store.reload();
var nb = store.count();
txt.setText('<b>Nb abstracted elements : ' + nb + '</b>');
}
});
nodes.forEach(function(node){
_MyThisGraphNode.selection(node, "viz");
});
var nodeToAbstract=metExploreD3.GraphAbstraction.getGroupNode();
} else {
nodeToAbstract.forEach(function(list){
list.forEach(function(node) {
node.hide();
});
});
metExploreD3.GraphAbstraction.abstractionMode=true;
metExploreD3.GraphAbstraction.abstractNodesSelected("viz",nodeToAbstract, function(links) {
var store = Ext.getStore("abstractionFormStore");
var grid = Ext.getCmp('abstractionGrid');
var txt = grid.query('tbtext')[0];
links.forEach(function (link) {
e.forEach(function (elt) {
if(elt.data.labelAbstraction===group){
link.setLabel(elt.data.labelAbstraction);
}
var e= store.getData().items;
var session = _metExploreViz.getSessionById("viz");
var networkData = session.getD3Data();
});
});
e.forEach(function (elt) {
metExploreD3.GraphNetwork.updateNetwork('viz', session);
});
if(elt.data.labelAbstraction===group){
store.reload();
var nb = store.count();
txt.setText('<b>Nb abstracted elements : ' + nb + '</b>');
var nodes= networkData.getNodes()
.filter(function (n) {
return n.id===elt.data.id;
});
}
nodes.forEach(function(node){
_MyThisGraphNode.selection(node, "viz");
});
}
});
var nodeToAbstract=metExploreD3.GraphAbstraction.getGroupNode();
nodeToAbstract.forEach(function(list){
list.forEach(function(node) {
node.hide();
});
});
metExploreD3.GraphAbstraction.abstractNodesSelected("viz",nodeToAbstract, function(links) {
links.forEach(function (link) {
e.forEach(function (elt) {
if(elt.data.labelAbstraction===group){
console.log(elt);
link.setLabel(elt.data.labelAbstraction);
}
});
});
metExploreD3.GraphNetwork.updateNetwork('viz', session);
});
// metExploreD3.GraphAbstraction.abstractionMode=true;
//
// var store = Ext.getStore("abstractionFormStore");
// var grid = Ext.getCmp('abstractionGrid');
// var txt = grid.query('tbtext')[0];
//
// var e= store.getData().items;
// var session = _metExploreViz.getSessionById("viz");
// var networkData = session.getD3Data();
//
// e.forEach(function (elt) {
//
// if(elt.data.labelAbstraction===group){
//
// var nodes= networkData.getNodes()
// .filter(function (n) {
// return n.id===elt.data.id;
// });
//
// nodes.forEach(function(node){
// _MyThisGraphNode.selection(node, "viz");
// });
//
// }
// });
//
//
// var nodeToAbstract=metExploreD3.GraphAbstraction.getGroupNode();
//
// nodeToAbstract.forEach(function(list){
// list.forEach(function(node) {
// node.hide();
// });
// });
//
// metExploreD3.GraphAbstraction.abstractNodesSelected("viz",nodeToAbstract, function(links) {
//
// links.forEach(function (link) {
// e.forEach(function (elt) {
// if(elt.data.labelAbstraction===group){
// link.setLabel(elt.data.labelAbstraction);
// }
//
// });
// });
//
// metExploreD3.GraphNetwork.updateNetwork('viz', session);
// });
//
// store.reload();
// var nb = store.count();
// txt.setText('<b>Nb abstracted elements : ' + nb + '</b>');
store.reload();
var nb = store.count();
txt.setText('<b>Nb abstracted elements : ' + nb + '</b>');
}
metExploreD3.GraphNode.unselectAll("#viz");
......
......@@ -58,8 +58,7 @@ Ext.define('metExploreViz.view.form.abstractionForm.AbstractionFormController',
},
listAbstraction:function(nodeToAbstract){
if(metExploreD3.GraphAbstraction.abstractionMode===true){
metExploreD3.GraphAbstraction.abstractionMode===false;
var me = this,
viewModel = me.getViewModel(),
view = me.getView();
......@@ -172,7 +171,7 @@ Ext.define('metExploreViz.view.form.abstractionForm.AbstractionFormController',
metExploreD3.fireEvent('abstractionDetection','removeSideCompounds');
metExploreD3.GraphAbstraction.abstractionMode===true;
} else if (idAbs.includes(text)){
Ext.Msg.confirm('Title already used','This title is already used, continue?', callbackFunction);
......@@ -256,9 +255,6 @@ Ext.define('metExploreViz.view.form.abstractionForm.AbstractionFormController',
});
metExploreD3.GraphAbstraction.abstractionMode===true;
} else {
}
......@@ -339,8 +335,6 @@ Ext.define('metExploreViz.view.form.abstractionForm.AbstractionFormController',
metExploreD3.GraphAbstraction.abstractionMode===true;
}
......@@ -360,9 +354,7 @@ Ext.define('metExploreViz.view.form.abstractionForm.AbstractionFormController',
myPrompt(this);
}else{
metExploreD3.GraphAbstraction.abstractionMode===true;
}
},
......
......@@ -559,7 +559,13 @@ Ext.define('metExploreViz.view.form.captionForm.CaptionFormController', {
selectAllButton.on({
click : function (that, newV, oldVV, e) {
var arrayCheckBox = Ext.getCmp("captionFormPathways").query('checkbox[forId=componentCheckbox]');
if(view.id==="captionFormCompartments"){
var arrayCheckBox = Ext.getCmp("captionFormCompartments").query('checkbox[forId=componentCheckbox]');
}else if(view.id==="captionFormPathways"){
var arrayCheckBox = Ext.getCmp("captionFormPathways").query('checkbox[forId=componentCheckbox]');
}
var allIsSelected = arrayCheckBox.every(function(checkbox){return checkbox.checked});
if(allIsSelected){
arrayCheckBox.forEach(function (checkBox) {
......
......@@ -313,7 +313,9 @@ metExploreD3.GraphAbstraction = {
* */
abstractNodesSelected: function (panel, nodes,func) {
//metExploreD3.GraphAbstraction.abstractionMode===true;
metExploreD3.GraphAbstraction.abstractionMode===true;
var myMask = metExploreD3.createLoadMask("Abstraction in process...", panel);
var session = _metExploreViz.getSessionById('viz');
var groupTarget = metExploreD3.GraphAbstraction.getGroupTarget(panel,nodes);
......@@ -643,8 +645,6 @@ metExploreD3.GraphAbstraction = {
if (targetList[i] == undefined && sourceList[i]!= undefined){
} else if (targetList[i] != undefined && sourceList[i]== undefined){
......@@ -1498,6 +1498,7 @@ metExploreD3.GraphAbstraction = {
}, 1);
}
},
/***
......
......@@ -125,7 +125,6 @@ metExploreD3.GraphLink = {
return l.id === link.id;
});
var textSelected =a.select("text");
if(textSelected.size() ===0){
......@@ -854,14 +853,18 @@ metExploreD3.GraphLink = {
majConvexhullsVisibility : function(panelLinked, type){
d3.select("#" + panelLinked).select("#D3viz").selectAll("path.convexhull")
.classed("hide", function (conv) {
if (type == "Pathways"){
var com = metExploreD3.getPathwayByName(conv.key, panelLinked);
if(com.isCollapsed()) return true;
}
else
var com = metExploreD3.getCompartmentByName(conv.key);
if(com)
return com.hidden();
if(com)
return com.hidden();
return false;
});
},
......@@ -1157,7 +1160,7 @@ metExploreD3.GraphLink = {
//.attr("font-size", size + "px")
.attr("text-anchor", "middle")
.attr('x', ((link.target.x+link.source.x)/2))
.attr('y', ((link.target.x+link.source.x)/2)+5)
.attr('y', ((link.target.x+link.source.x)/2)+10)
.text(link.label);
......@@ -1199,7 +1202,7 @@ metExploreD3.GraphLink = {
//.attr("font-size", size + "px")
.attr("text-anchor", "middle")
.attr('x', ((link.target.x+link.source.x)/2))
.attr('y', ((link.target.x+link.source.x)/2)+5)
.attr('y', ((link.target.x+link.source.x)/2)+10)
.text(link.label);
}
......@@ -1335,7 +1338,7 @@ metExploreD3.GraphLink = {
//.attr("font-size", size + "px")
.attr("text-anchor", "middle")
.attr('x', ((link.target.x+link.source.x)/2))
.attr('y', ((link.target.x+link.source.x)/2)+5)
.attr('y', ((link.target.x+link.source.x)/2)+10)
.text(link.label);
......@@ -1377,7 +1380,7 @@ metExploreD3.GraphLink = {
//.attr("font-size", size + "px")
.attr("text-anchor", "middle")
.attr('x', ((link.target.x+link.source.x)/2))
.attr('y', ((link.target.x+link.source.x)/2)+5)
.attr('y', ((link.target.x+link.source.x)/2)+10)
.text(link.label);
}
......
......@@ -996,6 +996,7 @@ metExploreD3.GraphNode = {
metaboliteStyle.getOpacity()
);
// Duplicated metabolites
updatedNodesMetabolite
.filter(function (d) {
......@@ -1184,6 +1185,7 @@ metExploreD3.GraphNode = {
.attr("opacity", "0.20")
.attr("fill", "#000000");
box.append("image")
.attr("class", "iconlocker")
.attr("y", function (node) {
......@@ -1288,6 +1290,8 @@ metExploreD3.GraphNode = {
+ ")")
.style("opacity", '0.5')
.style("fill", 'red');
if (session.getMappingDataType() === "Continuous") {
if (parseFloat(aStyleFormParent.getController().getValueMappingsSet(session.getMappingDataType())[0].getName()) < parseFloat(aStyleFormParent.getController().getValueMappingsSet(session.getMappingDataType())[1].getName())) {
maxValue = parseFloat(aStyleFormParent.getController().getValueMappingsSet(session.getMappingDataType())[1].getName());
......@@ -1315,14 +1319,15 @@ metExploreD3.GraphNode = {
metExploreD3.GraphNode.colorStoreByCompartment(metExploreD3.GraphNode.node);
/// label opacity abstraction
// d3.select("viz").select("g.node")
// var a = d3.select("#viz").select("#D3viz")
// .selectAll("g.node")
// .filter(function(node){
// return node.biologicalType === "abstracted";
// return node.biologicalType === "metabolite";
//
// })
// .select("text")
// .style("opacity","0");
// .style("stroke", metaboliteStyle.getStrokeColor());
},
/*******************************************
......
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