mirror of
https://github.com/UnickSoft/graphonline.git
synced 2025-07-01 23:36:00 +00:00
Fix wrong id for edges.
This commit is contained in:
parent
bc282b4a58
commit
469db873e4
@ -24,6 +24,8 @@ function Graph()
|
|||||||
Graph.prototype.infinity = 1E8;
|
Graph.prototype.infinity = 1E8;
|
||||||
// Max vertexes
|
// Max vertexes
|
||||||
Graph.prototype.maxVertexes = 1000;
|
Graph.prototype.maxVertexes = 1000;
|
||||||
|
// Offset for edges ids.
|
||||||
|
Graph.prototype.edgesOffset = 10000;
|
||||||
|
|
||||||
Graph.prototype.AddNewVertex = function(vertex)
|
Graph.prototype.AddNewVertex = function(vertex)
|
||||||
{
|
{
|
||||||
@ -901,8 +903,11 @@ Graph.prototype.LoadFromXML = function (xmlText, additionalData)
|
|||||||
// Back comportebility.
|
// Back comportebility.
|
||||||
if (isNaN(loadedEdgeId))
|
if (isNaN(loadedEdgeId))
|
||||||
{
|
{
|
||||||
loadedEdgeId = 10000;
|
loadedEdgeId = this.edgesOffset;
|
||||||
}
|
} else if (loadedEdgeId < this.edgesOffset)
|
||||||
|
{
|
||||||
|
loadedEdgeId = this.edgesOffset;
|
||||||
|
}
|
||||||
|
|
||||||
this.uidGraph = loadedGraphId;
|
this.uidGraph = loadedGraphId;
|
||||||
this.uidEdge = loadedEdgeId;
|
this.uidEdge = loadedEdgeId;
|
||||||
@ -925,6 +930,11 @@ Graph.prototype.LoadFromXML = function (xmlText, additionalData)
|
|||||||
$edges.each(function(){
|
$edges.each(function(){
|
||||||
var edge = new BaseEdge();
|
var edge = new BaseEdge();
|
||||||
edge.LoadFromXML($(this), graph);
|
edge.LoadFromXML($(this), graph);
|
||||||
|
// Fix case with wrong id.
|
||||||
|
if (edge.id < graph.uidEdge) {
|
||||||
|
edge.id = graph.uidEdge;
|
||||||
|
graph.uidEdge++;
|
||||||
|
}
|
||||||
edges.push(edge);
|
edges.push(edge);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user