summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/model/graph.js56
-rw-r--r--src/rz_core.js40
-rw-r--r--src/textanalysis.js4
3 files changed, 50 insertions, 50 deletions
diff --git a/src/model/graph.js b/src/model/graph.js
index f10722df..32306708 100644
--- a/src/model/graph.js
+++ b/src/model/graph.js
@@ -64,7 +64,7 @@ function Graph() {
var i = 0;
var n = findNode(id, state);
while (i < links.length) {
- if ((links[i]['source'] === n) || (links[i]['target'] == n)) links.splice(i, 1);
+ if ((links[i]['__src'] === n) || (links[i]['__dst'] == n)) links.splice(i, 1);
else i++;
}
var index = findNodeIndex(id, state);
@@ -81,7 +81,7 @@ function Graph() {
var n = ns[j];
var i = 0;
while (i < links.length) {
- if ((links[i]['source'] === n) || (links[i]['target'] == n)) links.splice(i, 1);
+ if ((links[i]['__src'] === n) || (links[i]['__dst'] == n)) links.splice(i, 1);
else i++;
}
var index = findNodeIndex(id, state);
@@ -137,20 +137,20 @@ function Graph() {
while (i < links.length) {
link = links[i];
// XXX: using name comparison because n might be stale
- if (compareNames(link.source.name, n.name)) {
- adjacentnode = findNode(link.target.id, null);
+ if (compareNames(link.__src.name, n.name)) {
+ adjacentnode = findNode(link.__dst.id, null);
if (adjacentnode.state !== "temp") {
ret.nodes.push({type: 'exit', node: adjacentnode});
}
ret.links.push({type: 'exit', link: link});
- if (link.target.type === "chainlink") {
+ if (link.__dst.type === "chainlink") {
while (j < links.length) {
link2 = links[j];
- if (link.target.id === link2.target.id &&
- link2.target.type === "chainlink" &&
- link2.target.state !== "temp") {
- adjacentnode = findNode(link2.source.id, null);
+ if (link.__dst.id === link2.__dst.id &&
+ link2.__dst.type === "chainlink" &&
+ link2.__dst.state !== "temp") {
+ adjacentnode = findNode(link2.__src.id, null);
if (adjacentnode.state !== "temp") {
ret.nodes.push({type: 'enter', node: adjacentnode});
}
@@ -161,8 +161,8 @@ function Graph() {
}
j=0;
}
- if (compareNames(links[i].target.name, n.name)) {
- adjacentnode = findNode(links[i].source.id, null);
+ if (compareNames(links[i].__dst.name, n.name)) {
+ adjacentnode = findNode(links[i].__src.id, null);
if (adjacentnode.state !== "temp") adjacentnode.state = "enter";
links[i].state = "enter";
}
@@ -185,7 +185,7 @@ function Graph() {
return nd.type !== 'bubble';
});
var state_links = findLinks(state).map(function(link) {
- return [link.source.name, link.target.name];
+ return [link.__src.name, link.__dst.name];
}).sort();
var k;
var state_source, state_target, new_source, new_target;
@@ -281,8 +281,8 @@ function Graph() {
}
}
- this.editLink = function(sourceId, targetId, newname, newstate) {
- var link = findLink(sourceId, targetId, newname);
+ this.editLink = function(src_id, dst_id, newname, newstate) {
+ var link = findLink(src_id, dst_id, newname);
if (link !== undefined) {
link.name = newname;
if (newstate !== undefined) {
@@ -291,10 +291,10 @@ function Graph() {
}
}
- this.editLinkTarget = function(sourceId, targetId, newTarget) {
- var link = findLink(sourceId, targetId, null);
+ this.editLinkTarget = function(src_id, dst_id, newTarget) {
+ var link = findLink(src_id, dst_id, null);
if (link !== undefined) {
- link.target = findNode(newTarget, null);
+ link.__dst = findNode(newTarget, null);
} else {
@@ -321,11 +321,11 @@ function Graph() {
acceptReplace = confirm('"' + index2.name + '" will replace "' + index.name + '", are you sure?');
if (acceptReplace){
for (var i = 0; i < links.length; i++) {
- if (links[i].source === index) {
- links[i].source = index2;
+ if (links[i].__src === index) {
+ links[i].__src = index2;
}
- if (links[i].target === index) {
- links[i].target = index2;
+ if (links[i].__dst === index) {
+ links[i].__dst = index2;
}
}
this.removeNode(index.id,null);
@@ -389,7 +389,7 @@ function Graph() {
return;
}
} else {
- if (link.sourceId === links[i].sourceId && link.targetId === links[i].targetId) {
+ if (link.__src.id === links[i].__src.id && link.__dst.id === links[i].__dst.id) {
links.splice(i, 1);
return;
}
@@ -411,9 +411,9 @@ function Graph() {
}
}
- var findLink = function(sourceId, targetId, name) {
+ var findLink = function(src_id, dst_id, name) {
for (var i = 0; i < links.length; i++) {
- if (links[i].source.id === sourceId && links[i].target.id === targetId) {
+ if (links[i].__src.id === src_id && links[i].__dst.id === dst_id) {
return links[i];
}
}
@@ -548,7 +548,7 @@ function Graph() {
len = l_set.length
for (var i = 0; i < len; i++) {
var l = l_set[i];
- graph.addLink_byIds(l.sourceId, l.targetId, l.name, "perm")
+ graph.addLink_byIds(l.__src.id, l.__dst.id, l.name, "perm")
}
}
@@ -579,7 +579,7 @@ function Graph() {
}
for(i = 0; i < data["links"].length; i++){
link = data.links[i];
- this.addLink(link.source, link.target, link.name, "perm");
+ this.addLink(link.__src, link.__dst, link.name, "perm");
}
this.clear_history();
}
@@ -604,8 +604,8 @@ function Graph() {
for(var j=0 ; j < links.length ; j++){
var link = links[j];
d['links'].push({
- "source":link.source.id,
- "target":link.target.id,
+ "__src":link.__src.id,
+ "__dst":link.__dst.id,
"name":link.name
});
}
diff --git a/src/rz_core.js b/src/rz_core.js
index edd33aab..3d225a3a 100644
--- a/src/rz_core.js
+++ b/src/rz_core.js
@@ -212,8 +212,8 @@ function update(no_relayout) {
.attr("class", "ghostlink")
.on("click", function(d, i) {
var that = this,
- source = this.link.source,
- target = this.link.target;
+ src = this.link.__src,
+ dst = this.link.__dst;
view.edge_info.on_delete(function () {
graph.removeLink(that.link);
@@ -222,10 +222,10 @@ function update(no_relayout) {
});
view.edge_info.show(d);
removeHighlight();
- highlight(source);
- highlight(target);
- source.state = 'chosen';
- target.state = 'chosen';
+ highlight(src);
+ highlight(dst);
+ src.state = 'chosen';
+ dst.state = 'chosen';
graph.update(true);
});
@@ -264,12 +264,12 @@ function update(no_relayout) {
linktext
.text(function(d) {
var name = d.name || "";
- if (!(d.target.state === "temp" ||
- d.source.state === "chosen" || d.target.state === "chosen")) {
+ if (!(d.__dst.state === "temp" ||
+ d.__src.state === "chosen" || d.__dst.state === "chosen")) {
return "";
}
- if (name.length < 25 || d.source.state === "chosen" ||
- d.target.state === "chosen" || d.state==="temp") {
+ if (name.length < 25 || d.__src.state === "chosen" ||
+ d.__dst.state === "chosen" || d.state==="temp") {
return name;
} else {
return name.substring(0, 14) + "...";
@@ -524,19 +524,19 @@ function tick(e) {
ghost;
if (graphstate === "GRAPH") {
- var dx = d.target.x - d.source.x,
- dy = d.target.y - d.source.y,
+ var dx = d.__dst.x - d.__src.x,
+ dy = d.__dst.y - d.__src.y,
dr = Math.sqrt(dx * dx + dy * dy);
- d_val = "M" + d.source.x + "," + d.source.y + "A" + dr + "," + dr + " 0 0,1 " + d.target.x + "," + d.target.y;
+ d_val = "M" + d.__src.x + "," + d.__src.y + "A" + dr + "," + dr + " 0 0,1 " + d.__dst.x + "," + d.__dst.y;
} else if (graphstate === "GANTT") {
if (d.state === "enter" || d.state === "exit") {
- var dx = d.target.x - d.source.x,
- dy = d.target.y - d.source.y,
+ var dx = d.__dst.x - d.__src.x,
+ dy = d.__dst.y - d.__src.y,
dr = Math.sqrt(dx * dx + dy * dy) * 5;
- d_val = "M" + d.source.x + "," + d.source.y + "A" + dr + "," + dr + " 0 0,1 " + d.target.x + "," + d.target.y;
+ d_val = "M" + d.__src.x + "," + d.__src.y + "A" + dr + "," + dr + " 0 0,1 " + d.__dst.x + "," + d.__dst.y;
} else {
- var dx = d.target.x - d.source.x,
- dy = d.target.y - d.source.y,
+ var dx = d.__dst.x - d.__src.x,
+ dy = d.__dst.y - d.__src.y,
dr = Math.sqrt(dx * dx + dy * dy) * 5;
d_val = "M" + 0 + "," + 0 + "A" + dr + "," + dr + " 0 0,1 " + 0 + "," + 0;
@@ -551,7 +551,7 @@ function tick(e) {
linktext.attr("transform", function(d) {
if (graphstate === "GRAPH") {
- return "translate(" + (d.source.x + d.target.x) / 2 + "," + (d.source.y + d.target.y) / 2 + ")";
+ return "translate(" + (d.__src.x + d.__dst.x) / 2 + "," + (d.__src.y + d.__dst.y) / 2 + ")";
} else {
return "translate(0,0)";
}
@@ -713,7 +713,7 @@ function editLink(link, d, i) {
// TODO: handle escape as well to quit without changes (enter does submit)
$('#editlinkform').submit(function() {
- graph.editLink(d.source.id, d.target.id, $('#editlinkname').val());
+ graph.editLink(d.__src.id, d.__dst.id, $('#editlinkname').val());
$('.editlinkinfo').css('top', -100);
$('.editlinkinfo').css('left', 0);
graph.update(true);
diff --git a/src/textanalysis.js b/src/textanalysis.js
index f212d07d..e5b95f22 100644
--- a/src/textanalysis.js
+++ b/src/textanalysis.js
@@ -402,8 +402,8 @@ var textAnalyser = function (newtext, finalize) {
}
ret.for_each_link_add(function (link) {
- graph.addLinkByName(link.sourceName,
- link.targetName,
+ graph.addLinkByName(link.__src.name,
+ link.__dst.name,
link.name,
link.state,
ret.drop_conjugator_links);