Fix edges direction field for xml export.

This commit is contained in:
Oleg Sh
2024-08-10 19:10:01 +02:00
parent 7b0c23cb6c
commit 451a964127
3 changed files with 48 additions and 9 deletions

View File

@@ -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;