summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--blocks/BIGSOM_f.svg4
-rw-r--r--blocks/CEVENTSCOPE.svg39
-rw-r--r--blocks/CMSCOPE.svg31
-rw-r--r--blocks/INTEGRAL_m.svg14
-rw-r--r--blocks/LOOKUP_f.svg39
-rw-r--r--blocks/SELF_SWITCH.svg11
-rw-r--r--blocks/SUMMATION.svg4
-rw-r--r--blocks/SWITCH2_m.svg11
-rw-r--r--index.html162
9 files changed, 118 insertions, 197 deletions
diff --git a/blocks/BIGSOM_f.svg b/blocks/BIGSOM_f.svg
deleted file mode 100644
index f76cc1c..0000000
--- a/blocks/BIGSOM_f.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg width="40" xmlns="http://www.w3.org/2000/svg" version="1.1" height="40">
- <text y="30" x="14" font-size="30" font-family="serif" fill="black">Σ</text>
-</svg>
diff --git a/blocks/CEVENTSCOPE.svg b/blocks/CEVENTSCOPE.svg
deleted file mode 100644
index a489ba7..0000000
--- a/blocks/CEVENTSCOPE.svg
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg id="svg11300" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="44.822" width="41.062" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/">
- <metadata id="metadata39">
- <rdf:RDF>
- <cc:Work rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <title id="title3289">base scilan</title>
- <defs id="defs3">
- <radialGradient id="radialGradient20899" gradientUnits="userSpaceOnUse" cy="32.267" cx="23.994" gradientTransform="matrix(2.2986117,0,0,1.8027614,-75.446386,-24.554065)" r="19.089">
- <stop id="stop2224" stop-color="#5187d6" offset="0"/>
- <stop id="stop2227" stop-color="#1e4580" offset="1"/>
- </radialGradient>
- <linearGradient id="linearGradient2854" y2="24.238" gradientUnits="userSpaceOnUse" x2="12.499" gradientTransform="matrix(0,-5.2061514,2.5688251,0,-79.265723,164.6207)" y1="12.538" x1="8.8208">
- <stop id="stop2182" stop-color="#FFF" offset="0"/>
- <stop id="stop2184" stop-color="#FFF" stop-opacity="0" offset="1"/>
- </linearGradient>
- </defs>
- <g id="layer1" transform="translate(-2.8842799e-7,-3.1783548)">
- <g id="layer1-0" transform="matrix(0,0.68137179,-0.68137179,0,39.302853,7.826163)">
- <g id="g9544" transform="translate(-2.0023665,2.2530854)">
- <g id="g9570" transform="translate(0.34662852,-1.7289484)">
- <g id="g28489" transform="translate(2.3098495,0.12996954)">
- <g id="g20882" transform="translate(51.47752,-82.884097)">
- <rect id="rect1314" stroke-linejoin="round" style="stroke-dasharray:none;" transform="matrix(0,-0.99999997,0.99999997,0,-49.042742,89.574337)" fill-rule="evenodd" stroke-dashoffset="0" rx="2.2025" ry="2.2025" height="37.631" width="48.319" stroke="#173562" stroke-linecap="round" stroke-miterlimit="4" y="2.4454" x="-44.453" stroke-width="1.4676" fill="url(#radialGradient20899)"/>
- <path id="path28138" stroke-linejoin="round" d="M8.6382,35.758c27.557-0.173,27.904-0.173,27.904-0.173l0.17331-33.97" transform="translate(-49.042742,89.574337)" stroke="#000" stroke-linecap="round" stroke-width="1.46762753px" fill="none"/>
- <path id="rect2178" opacity="0.43181817" d="m-45.868,133.4,12.954,0c1.0099-5.0153,1.5849-10.576,1.5849-16.442,0-12.211-2.4433-23.147-6.2788-30.45h-8.2599v46.892z" fill-rule="evenodd" fill="url(#linearGradient2854)"/>
- </g>
- </g>
- </g>
- </g>
- </g>
- </g>
- <path id="path2188" stroke-linejoin="round" style="stroke-dasharray:none;" d="m13.665,29.974,4.7566-10.919,5.7799,10.589,6.8184-5.8677,0.06242-4.1123-6.3304,5.6237-6.5406-11.928-6.0101,14.643,1.4637,1.9713z" fill-rule="evenodd" stroke="#8ae234" stroke-linecap="round" stroke-miterlimit="10" stroke-width="0.91817689" fill="#73d216"/>
-</svg>
diff --git a/blocks/CMSCOPE.svg b/blocks/CMSCOPE.svg
deleted file mode 100644
index bd06723..0000000
--- a/blocks/CMSCOPE.svg
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg id="svg11300" xmlns="http://www.w3.org/2000/svg" height="44.822" width="41.062" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink">
- <title id="title3289">base scilan</title>
- <defs id="defs3">
- <radialGradient id="radialGradient20899" gradientUnits="userSpaceOnUse" cy="32.267" cx="23.994" gradientTransform="matrix(2.2986117,0,0,1.8027614,-75.446386,-24.554065)" r="19.089">
- <stop id="stop2224" stop-color="#5187d6" offset="0"/>
- <stop id="stop2227" stop-color="#1e4580" offset="1"/>
- </radialGradient>
- <linearGradient id="linearGradient2854" y2="24.238" gradientUnits="userSpaceOnUse" x2="12.499" gradientTransform="matrix(0,-5.2061514,2.5688251,0,-79.265723,164.6207)" y1="12.538" x1="8.8208">
- <stop id="stop2182" stop-color="#FFF" offset="0"/>
- <stop id="stop2184" stop-color="#FFF" stop-opacity="0" offset="1"/>
- </linearGradient>
- </defs>
- <g id="layer1" transform="translate(-2.8842799e-7,-3.1783548)">
- <g id="layer1-0" transform="matrix(0,0.68137179,-0.68137179,0,39.302853,7.826163)">
- <g id="g9544" transform="translate(-2.0023665,2.2530854)">
- <g id="g9570" transform="translate(0.34662852,-1.7289484)">
- <g id="g28489" transform="translate(2.3098495,0.12996954)">
- <g id="g20882" transform="translate(51.47752,-82.884097)">
- <rect id="rect1314" stroke-linejoin="round" style="stroke-dasharray:none;" transform="matrix(0,-0.99999997,0.99999997,0,-49.042742,89.574337)" fill-rule="evenodd" stroke-dashoffset="0" rx="2.2025" ry="2.2025" height="37.631" width="48.319" stroke="#173562" stroke-linecap="round" stroke-miterlimit="4" y="2.4454" x="-44.453" stroke-width="1.4676" fill="url(#radialGradient20899)"/>
- <path id="path28138" stroke-linejoin="round" d="M8.6382,35.758c27.557-0.173,27.904-0.173,27.904-0.173l0.17331-33.97" transform="translate(-49.042742,89.574337)" stroke="#000" stroke-linecap="round" stroke-width="1.46762753px" fill="none"/>
- <path id="rect2178" opacity="0.43181817" d="m-45.868,133.4,12.954,0c1.0099-5.0153,1.5849-10.576,1.5849-16.442,0-12.211-2.4433-23.147-6.2788-30.45h-8.2599v46.892z" fill-rule="evenodd" fill="url(#linearGradient2854)"/>
- <path id="path18808" stroke-linejoin="round" style="stroke-dasharray:none;" d="m-27.782,121.73-0.57149-0.2893-0.56662-0.28848-0.55952-0.28909-0.55222-0.2893-1.0738-0.57777-0.51996-0.2893-0.50637-0.28828-0.49217-0.28929-0.47533-0.28849-0.4597-0.28929-0.44064-0.2893-0.42156-0.28909-0.40027-0.28848-0.37957-0.2893-0.35726-0.28929-0.33372-0.28848-0.30979-0.2893-0.28524-0.28828-0.25927-0.28929-0.2329-0.2893-0.20612-0.28848-0.17913-0.2893-0.15053-0.28909-0.12274-0.28848-0.09433-0.28929-0.06513-0.2893-0.03713-0.28848-0.0071-0.2893,0.0213-0.28909,0.05072-0.28848,0.07932-0.2893,0.10772-0.28929,0.13633-0.28848,0.16473-0.2891,0.19192-0.28929,0.2195-0.28849,0.24568-0.28929,0.27185-0.28929,0.29619-0.28849,0.32175-0.28909,0.34569-0.28929,0.36761-0.28849,0.39073-0.28929,0.41041-0.28909,0.4311-0.28849,0.44936-0.2893,0.46762-0.28929,0.48344-0.28848,0.49927-0.2893,0.51267-0.28828,0.52623-0.28929,0.5372-0.2893,0.54674-0.28929,0.55566-0.28849,0.56338-0.28909,0.56905-0.28848,0.57291-0.28929,0.57616-0.2893,0.57758-0.28848,0.57778-0.2893,0.57696-0.28909,0.57291-0.28848,0.56905-0.2893,0.56337-0.28929,0.55628-0.28849,0.54775-0.2891,0.53721-0.28929,0.52625-0.28848,0.51347-0.2893,0.49927-0.28929,0.48486-0.28849,0.46762-0.28909,0.45017-0.28929,0.43191-0.28849,0.41122-0.28929,0.39073-0.2893,0.36923-0.28827,0.34549-0.2893,0.32257-0.28848,0.29802-0.2893,0.27266-0.28929,0.24649-0.28909,0.22032-0.28849,0.19334-0.28929,0.16473-0.2893,0.13795-0.28848,0.10854-0.28909,0.08075-0.28849,0.05152-0.28929,0.02229-0.28929-0.0065-0.2893-0.03551-0.28849-0.06431-0.28908-0.09352-0.28849-0.12111-0.2893-0.15073-0.28929" stroke="#ef2929" stroke-linecap="round" stroke-miterlimit="4" stroke-width="2.93525505" fill="none"/>
- </g>
- </g>
- </g>
- </g>
- </g>
- </g>
-</svg>
diff --git a/blocks/INTEGRAL_m.svg b/blocks/INTEGRAL_m.svg
deleted file mode 100644
index 6d5a898..0000000
--- a/blocks/INTEGRAL_m.svg
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg id="svg2" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="385" width="240" version="1.0" xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/">
- <metadata id="metadata7">
- <rdf:RDF>
- <cc:Work rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <defs id="defs5"></defs>
- <path id="path1873" d="M137,156.68c2-28,9.75-78.68,10.25-82.43s3.5-19.75,13.25-31.75,25.75-16.25,25.75-16.25c0.25,0-4,0.75-4,11.5s12.75,18.25,20.75,18.25,22-7,22-19-16.5-19-23-19-17,0-26,3.5-29.38,16.5-37.88,33.5-13.12,37-17.62,67-9.5,77.37-11.5,105.37-11.25,80.5-11.75,84.25-3.5,19.75-13.25,31.75-25.75,16.25-25.75,16.25c-0.25,0,4-0.75,4-11.5s-12.75-18.25-20.75-18.25-22,7-22,19,16.5,19,23,19,17,0,26-3.5,29.375-16.5,37.88-33.5c8.5-17,13.12-37,17.62-67,2.02-13.5,11-85.19,13-107.19z" fill-rule="evenodd" fill="#000"/>
-</svg>
diff --git a/blocks/LOOKUP_f.svg b/blocks/LOOKUP_f.svg
deleted file mode 100644
index a489ba7..0000000
--- a/blocks/LOOKUP_f.svg
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg id="svg11300" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="44.822" width="41.062" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/">
- <metadata id="metadata39">
- <rdf:RDF>
- <cc:Work rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <title id="title3289">base scilan</title>
- <defs id="defs3">
- <radialGradient id="radialGradient20899" gradientUnits="userSpaceOnUse" cy="32.267" cx="23.994" gradientTransform="matrix(2.2986117,0,0,1.8027614,-75.446386,-24.554065)" r="19.089">
- <stop id="stop2224" stop-color="#5187d6" offset="0"/>
- <stop id="stop2227" stop-color="#1e4580" offset="1"/>
- </radialGradient>
- <linearGradient id="linearGradient2854" y2="24.238" gradientUnits="userSpaceOnUse" x2="12.499" gradientTransform="matrix(0,-5.2061514,2.5688251,0,-79.265723,164.6207)" y1="12.538" x1="8.8208">
- <stop id="stop2182" stop-color="#FFF" offset="0"/>
- <stop id="stop2184" stop-color="#FFF" stop-opacity="0" offset="1"/>
- </linearGradient>
- </defs>
- <g id="layer1" transform="translate(-2.8842799e-7,-3.1783548)">
- <g id="layer1-0" transform="matrix(0,0.68137179,-0.68137179,0,39.302853,7.826163)">
- <g id="g9544" transform="translate(-2.0023665,2.2530854)">
- <g id="g9570" transform="translate(0.34662852,-1.7289484)">
- <g id="g28489" transform="translate(2.3098495,0.12996954)">
- <g id="g20882" transform="translate(51.47752,-82.884097)">
- <rect id="rect1314" stroke-linejoin="round" style="stroke-dasharray:none;" transform="matrix(0,-0.99999997,0.99999997,0,-49.042742,89.574337)" fill-rule="evenodd" stroke-dashoffset="0" rx="2.2025" ry="2.2025" height="37.631" width="48.319" stroke="#173562" stroke-linecap="round" stroke-miterlimit="4" y="2.4454" x="-44.453" stroke-width="1.4676" fill="url(#radialGradient20899)"/>
- <path id="path28138" stroke-linejoin="round" d="M8.6382,35.758c27.557-0.173,27.904-0.173,27.904-0.173l0.17331-33.97" transform="translate(-49.042742,89.574337)" stroke="#000" stroke-linecap="round" stroke-width="1.46762753px" fill="none"/>
- <path id="rect2178" opacity="0.43181817" d="m-45.868,133.4,12.954,0c1.0099-5.0153,1.5849-10.576,1.5849-16.442,0-12.211-2.4433-23.147-6.2788-30.45h-8.2599v46.892z" fill-rule="evenodd" fill="url(#linearGradient2854)"/>
- </g>
- </g>
- </g>
- </g>
- </g>
- </g>
- <path id="path2188" stroke-linejoin="round" style="stroke-dasharray:none;" d="m13.665,29.974,4.7566-10.919,5.7799,10.589,6.8184-5.8677,0.06242-4.1123-6.3304,5.6237-6.5406-11.928-6.0101,14.643,1.4637,1.9713z" fill-rule="evenodd" stroke="#8ae234" stroke-linecap="round" stroke-miterlimit="10" stroke-width="0.91817689" fill="#73d216"/>
-</svg>
diff --git a/blocks/SELF_SWITCH.svg b/blocks/SELF_SWITCH.svg
deleted file mode 100644
index 0344da7..0000000
--- a/blocks/SELF_SWITCH.svg
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg width="40" stroke="#000" xmlns="http://www.w3.org/2000/svg" version="1.1" height="40">
- <g id="base" stroke-linejoin="round" stroke-linecap="round" stroke-width="2px" fill="none">
- <path d="M2,30h9l16-10"/>
- <path d="M30,30h8"/>
- </g>
- <g id="command">
- <polygon fill-opacity="0.1" width="1px" points="18,5,22,5,20,10" fill="#000"/>
- <path stroke-width="1px" stroke-dasharray="1,1" d="M20,10v28"/>
- </g>
-</svg>
diff --git a/blocks/SUMMATION.svg b/blocks/SUMMATION.svg
deleted file mode 100644
index f76cc1c..0000000
--- a/blocks/SUMMATION.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg width="40" xmlns="http://www.w3.org/2000/svg" version="1.1" height="40">
- <text y="30" x="14" font-size="30" font-family="serif" fill="black">Σ</text>
-</svg>
diff --git a/blocks/SWITCH2_m.svg b/blocks/SWITCH2_m.svg
deleted file mode 100644
index 0344da7..0000000
--- a/blocks/SWITCH2_m.svg
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg width="40" stroke="#000" xmlns="http://www.w3.org/2000/svg" version="1.1" height="40">
- <g id="base" stroke-linejoin="round" stroke-linecap="round" stroke-width="2px" fill="none">
- <path d="M2,30h9l16-10"/>
- <path d="M30,30h8"/>
- </g>
- <g id="command">
- <polygon fill-opacity="0.1" width="1px" points="18,5,22,5,20,10" fill="#000"/>
- <path stroke-width="1px" stroke-dasharray="1,1" d="M20,10v28"/>
- </g>
-</svg>
diff --git a/index.html b/index.html
index d0fe017..08be9d7 100644
--- a/index.html
+++ b/index.html
@@ -365,9 +365,6 @@
// Source edge is replaced with first edge and futureSource edges
cell.name = 'SPLIT_f';
- var firstEdge = graph.insertEdge(parent, null, '', cell.getChildAt(1), sourceTarget);
- var thirdEdge = graph.insertEdge(parent, null, '', cell.getChildAt(2), target);
- var futureSource = graph.insertEdge(parent, null, '', source.source, cell.getChildAt(0));
// Hide all the ports of a split-block
cell.getChildAt(0).setVisible(false);
@@ -377,9 +374,6 @@
// Remove the current source
graph.removeCells([source], true);
- // Set the newly made futureSource as the source
- source = futureSource;
-
/*
* If there are any waypoints, divide them for the two newly created edges.
* The two newly created edges are inherited from the source edge
@@ -394,9 +388,6 @@
for(var i = seg; i < waypoints.length; i++) {
waypoints2.push(waypoints[i]);
}
-
- source.geometry.points = waypoints1;
- firstEdge.geometry.points = waypoints2;
}
// Find the waypoints of the current edge, and set the waypoints for the new thirdEdge
@@ -406,7 +397,13 @@
waypoints3.pop();
}
- thirdEdge.geometry.points = waypoints3;
+ // Create three edges associated with the split-block
+ var firstEdge = createEdgeObject(graph, cell.getChildAt(1), sourceTarget, waypoints2);
+ var thirdEdge = createEdgeObject(graph, cell.getChildAt(2), target, waypoints3);
+ var futureSource = createEdgeObject(graph, source.source, cell.getChildAt(0), waypoints1);
+
+ // Set the newly made futureSource as the source
+ source = futureSource;
// Connectable for the ports and the split-block should be false
cell.getChildAt(0).setConnectable(false);
@@ -515,9 +512,6 @@
// Source edge is replaced with first edge and futureSource edges
cell.name = 'SPLIT_f';
- var firstEdge = graph.insertEdge(parent, null, '', cell.getChildAt(1), sourceTarget);
- var thirdEdge = graph.insertEdge(parent, null, '', cell.getChildAt(2), source);
- var futureSource = graph.insertEdge(parent, null, '', target.source, cell.getChildAt(0));
// Hide all the ports of a split-block
cell.getChildAt(0).setVisible(false);
@@ -526,7 +520,6 @@
// Remove the current source
graph.removeCells([target], true);
- target = futureSource;
/*
* If there are any waypoints, divide them for the two newly created edges.
@@ -542,9 +535,6 @@
for(var i = seg; i < waypoints.length; i++) {
waypoints2.push(waypoints[i]);
}
-
- target.geometry.points = waypoints1;
- firstEdge.geometry.points = waypoints2;
}
// Find the waypoints of the current edge, and set the waypoints for the new thirdEdge
@@ -552,8 +542,15 @@
if(waypoints3 != null && waypoints3.length > 1) {
waypoints3.pop();
}
- waypoints3.reverse();
- thirdEdge.geometry.points = waypoints3;
+ waypoints3.reverse();
+
+ // Create three edges associated with the split-block
+ var firstEdge = createEdgeObject(graph, cell.getChildAt(1), sourceTarget, waypoints2);
+ var thirdEdge = createEdgeObject(graph, cell.getChildAt(2), source, waypoints3);
+ var futureSource = createEdgeObject(graph, target.source, cell.getChildAt(0), waypoints1);
+
+ // Set the newly made futureSource as the source
+ target = futureSource;
// Connectable for the ports and the split-block should be false
cell.getChildAt(0).setConnectable(false);
@@ -640,26 +637,14 @@
if((source.value.indexOf('Input') != -1 && target.value.indexOf('Output') != -1)
|| (target.value == 'CommandPort' && source.value == 'ControlPort')) {
- // Begin graph DOM update
- graph.getModel().beginUpdate();
-
- try {
+ // Get points for the current edge from the global edgeState object
+ var waypoints = edgeState.absolutePoints;
- // Insert new edge in place of current edge
- var newEdge = graph.insertEdge(parent, null, '', target, source);
+ // Reverse waypoint array
+ waypoints.reverse();
- // Get points for the current edge from the global edgeState object
- var waypoints = edgeState.absolutePoints;
-
- // Reverse waypoint array
- waypoints.reverse();
-
- // Set the points for the new edge
- newEdge.geometry.points = waypoints;
- }
- finally {
- graph.getModel().endUpdate();
- }
+ // Create a new edge
+ var newEdge = createEdgeObject(graph, target, source, waypoints);
// Return null for the current edge,
@@ -1571,6 +1556,53 @@
};
/*
+ * @jiteshjha
+ * createEdgeObject(@parameters) creates an edge on the graph DOM
+ * @Parameters :
+ * source -> source object for the edge
+ * target -> destination object for the edge
+ * points -> waypoints to be inserted in the geometry
+ */
+ function createEdgeObject(graph, source, target, points) {
+
+ // Start the update on the graph
+ graph.getModel().beginUpdate();
+
+ try {
+
+ // Create an edge from the given source object and target object
+ var edge = graph.insertEdge(graph.getDefaultParent(), null, '', source, target);
+
+ // Get geometry of the edge
+ var geometry = graph.getModel().getGeometry(edge);
+
+ /*
+ * Clone the geometry object
+ * NOTE: Direct manipulation of the geometry object may not be
+ * registered as an action for some cases, hence we clone the
+ * geometry, manipulate it and set the geometry.
+ */
+ var cloneGeometry = geometry.clone();
+
+ // Add points in the cloned geometry
+ cloneGeometry.points = points;
+
+ // Set the changed geometry for the edge
+ graph.getModel().setGeometry(edge, cloneGeometry);
+
+ // Refresh to reflect changes made
+ graph.refresh();
+ }
+ finally {
+
+ // End the update
+ graph.getModel().endUpdate();
+ }
+
+ return edge;
+ }
+
+ /*
@jiteshjha
Creates a dialog box related to the edge label properties.
The properties implemented are : edge label, label fontStyle,
@@ -2151,6 +2183,55 @@
var enc = new mxCodec(mxUtils.createXmlDocument());
var node = enc.encode(details);
var temp = enc.encode(parent);
+
+ /*
+ * @jiteshjha
+ */
+
+ // Get the stylesheet for the graph
+ var stylesheet = graph.getStylesheet();
+
+ // From the stylesheet, get the style of the particular block
+ var style = stylesheet.styles[name];
+
+ /*
+ * When a particular block is loaded for the first time,
+ * the image in the style of the block will be a path to the image.
+ * Set the label in the style property of the block has a html image,
+ * and set the image in the style property as null
+ *
+ * NOTE: Since the image of any block need not be changed for
+ * for every movement of that block, the image must be
+ * set only once.
+ */
+ if(style != null && style['image'] != null) {
+
+ // Make label as a image html element
+ var label = '<img src="' + style['image'] + '" height="80" width="80">';
+
+ // Set label
+ style['label'] = label;
+
+ // Set image as null
+ style['image'] = null;
+
+ // Add the label as a part of node
+ node.setAttribute('label', label);
+ }
+
+ /*
+ * If a particular block with image tag in it's style property
+ * has been invoked already, the image tag would be null for any
+ * successive instances of the same block. Hence, set the label
+ * from the label tag in style which was set when that blockModel
+ * was invoked on the first time.
+ */
+ if(style!= null && style['label'] != null) {
+
+ // Set label from the label field in the style property
+ node.setAttribute('label', style['label']);
+ }
+
node.setAttribute('parent', temp.getAttribute('id'));
var i, arr = [];
var blockModel = details_instance.x.model;
@@ -2321,13 +2402,6 @@
var root = req.getDocumentElement();
var dec = new mxCodec(root.ownerDocument);
dec.decode(root, graph.stylesheet);
-
- // Set the width and height of image for all blocks to 80 (height) x 80 (width)
- var style = new Object();
- style[mxConstants.STYLE_IMAGE_WIDTH] = '80';
- style[mxConstants.STYLE_IMAGE_HEIGHT] = '80';
- style['imageAlign'] = 'center';
- graph.getStylesheet().putDefaultVertexStyle(style);
};
</script>
<!--