diff --git a/script/entities/edge/model/BaseEdge.js b/script/entities/edge/model/BaseEdge.js
index 7cad0e1..ed261c3 100644
--- a/script/entities/edge/model/BaseEdge.js
+++ b/script/entities/edge/model/BaseEdge.js
@@ -54,7 +54,7 @@ BaseEdge.prototype.SaveToXML = function ()
return "";
}
-BaseEdge.prototype.LoadFromXML = function (xml, graph)
+BaseEdge.prototype.LoadFromXML = function (xml, graph, defaultLoadEdges)
{
var attr = xml.attr('vertex1');
if (typeof attr === 'undefined')
@@ -81,7 +81,30 @@ BaseEdge.prototype.LoadFromXML = function (xml, graph)
attr = xml.attr('target');
}
this.vertex2 = graph.FindVertex(typeof attr !== 'undefined' ? attr : xml.attr('graph2'));
- this.isDirect = xml.attr('isDirect') == "true";
+
+ /*
+ if (directed)
+ else if (isDirect)
+ else edgedefault
+ */
+ var directedAttribute = xml.attr('directed');
+ if (typeof directedAttribute !== 'undefined')
+ {
+ this.isDirect = directedAttribute == "true";
+ }
+ else
+ {
+ var isDirectedAttribute = xml.attr('isDirect');
+ if (typeof isDirectedAttribute !== 'undefined')
+ {
+ this.isDirect = isDirectedAttribute == "true";
+ }
+ else
+ {
+ this.isDirect = defaultLoadEdges == "directed";
+ }
+ }
+
this.weight = parseFloat(xml.attr('weight'));
if (isNaN(this.weight))
{
diff --git a/script/entities/graph/model/Graph.js b/script/entities/graph/model/Graph.js
index 7a1e5d4..8890cd2 100644
--- a/script/entities/graph/model/Graph.js
+++ b/script/entities/graph/model/Graph.js
@@ -1074,10 +1074,12 @@ Graph.prototype.LoadFromXML = function (xmlText, additionalData)
var loadedGraphId = 0;
var loadedEdgeId = 0;
+ var defaultLoadEdges = "";
$graphs.each(function(){
loadedGraphId = parseInt($(this).attr('uidGraph'));
loadedEdgeId = parseInt($(this).attr('uidEdge'));
+ defaultLoadEdges = $(this).attr('edgedefault');
});
// Backward compatibility
@@ -1089,6 +1091,11 @@ Graph.prototype.LoadFromXML = function (xmlText, additionalData)
loadedEdgeId = this.edgesOffset;
}
+ if (defaultLoadEdges != "directed" && defaultLoadEdges != "undirected")
+ {
+ defaultLoadEdges = "undirected";
+ }
+
this.uidGraph = loadedGraphId;
this.uidEdge = loadedEdgeId;
@@ -1109,7 +1116,7 @@ Graph.prototype.LoadFromXML = function (xmlText, additionalData)
var graph = this;
$edges.each(function(){
var edge = new BaseEdge();
- edge.LoadFromXML($(this), graph);
+ edge.LoadFromXML($(this), graph, defaultLoadEdges);
// Fix case with wrong id.
if (edge.id < graph.uidEdge) {
edge.id = graph.uidEdge;
diff --git a/script/pages/editor/api/index.js.cache b/script/pages/editor/api/index.js.cache
index dc356e5..66ea4f2 100644
--- a/script/pages/editor/api/index.js.cache
+++ b/script/pages/editor/api/index.js.cache
@@ -45,15 +45,22 @@ this.SetWeight(weight);this.ownStyles={};}
BaseEdge.prototype.copyFrom=function(other)
{this.vertex1=other.vertex1;this.vertex2=other.vertex2;this.arrayStyleStart=other.arrayStyleStart;this.arrayStyleFinish=other.arrayStyleFinish;this.isDirect=other.isDirect;this.weight=other.weight;this.text=other.text;this.useWeight=other.useWeight;this.id=other.id;this.model=new EdgeModel();this.model.copyFrom(other.model);this.upText=other.upText;this.ownStyles=FullObjectCopy(other.ownStyles);}
BaseEdge.prototype.SaveToXML=function()
-{return"0)?"ownStyles = \""+gEncodeToHTML(JSON.stringify(this.ownStyles))+"\" ":"")+
this.model.SaveToXML()+">";}
-BaseEdge.prototype.LoadFromXML=function(xml,graph)
+BaseEdge.prototype.LoadFromXML=function(xml,graph,defaultLoadEdges)
{var attr=xml.attr('vertex1');if(typeof attr==='undefined')
{attr=xml.attr('source');}
this.vertex1=graph.FindVertex(typeof attr!=='undefined'?attr:xml.attr('graph1'));var attr=xml.attr('vertex2');if(typeof attr==='undefined')
{attr=xml.attr('target');}
-this.vertex2=graph.FindVertex(typeof attr!=='undefined'?attr:xml.attr('graph2'));this.isDirect=xml.attr('isDirect')=="true";this.weight=parseFloat(xml.attr('weight'));if(isNaN(this.weight))
+this.vertex2=graph.FindVertex(typeof attr!=='undefined'?attr:xml.attr('graph2'));var directedAttribute=xml.attr('directed');if(typeof directedAttribute!=='undefined')
+{this.isDirect=directedAttribute=="true";}
+else
+{var isDirectedAttribute=xml.attr('isDirect');if(typeof isDirectedAttribute!=='undefined')
+{this.isDirect=isDirectedAttribute=="true";}
+else
+{this.isDirect=defaultLoadEdges=="directed";}}
+this.weight=parseFloat(xml.attr('weight'));if(isNaN(this.weight))
{this.weight=1;}
this.hasPair=xml.attr('hasPair')=="true";this.useWeight=xml.attr('useWeight')=="true";this.id=xml.attr('id');this.text=xml.attr("text")==null?"":gDecodeFromHTML(xml.attr("text"));this.arrayStyleStart=xml.attr("arrayStyleStart")==null?"":xml.attr("arrayStyleStart");this.arrayStyleFinish=xml.attr("arrayStyleFinish")==null?"":xml.attr("arrayStyleFinish");this.upText=xml.attr('upText');if(typeof this.upText==='undefined')
{this.upText="";}
@@ -518,10 +525,12 @@ xmlBody=xmlBody+"";additionalField="";if(additionalData.length>0)
{additionalField=""}
return mainHeader+header+xmlBody+""+additionalField+"";}
Graph.prototype.LoadFromXML=function(xmlText,additionalData)
-{xmlDoc=$.parseXML(xmlText);var $xml=$(xmlDoc);$graphs=$xml.find("graph");var loadedGraphId=0;var loadedEdgeId=0;$graphs.each(function(){loadedGraphId=parseInt($(this).attr('uidGraph'));loadedEdgeId=parseInt($(this).attr('uidEdge'));});if(isNaN(loadedEdgeId))
+{xmlDoc=$.parseXML(xmlText);var $xml=$(xmlDoc);$graphs=$xml.find("graph");var loadedGraphId=0;var loadedEdgeId=0;var defaultLoadEdges="";$graphs.each(function(){loadedGraphId=parseInt($(this).attr('uidGraph'));loadedEdgeId=parseInt($(this).attr('uidEdge'));defaultLoadEdges=$(this).attr('edgedefault');});if(isNaN(loadedEdgeId))
{loadedEdgeId=this.edgesOffset;}else if(loadedEdgeId