mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-22 14:47:56 +01:00
Add type infomation to deserializer
This commit is contained in:
parent
8e263e4047
commit
7701d00159
@ -25,6 +25,7 @@ import NodeModel from '../model/NodeModel';
|
|||||||
import RelationshipModel from '../model/RelationshipModel';
|
import RelationshipModel from '../model/RelationshipModel';
|
||||||
import XMLMindmapSerializer from './XMLMindmapSerializer';
|
import XMLMindmapSerializer from './XMLMindmapSerializer';
|
||||||
import FeatureType from '../model/FeatureType';
|
import FeatureType from '../model/FeatureType';
|
||||||
|
import Relationship from '../Relationship';
|
||||||
|
|
||||||
class XMLSerializerTango implements XMLMindmapSerializer {
|
class XMLSerializerTango implements XMLMindmapSerializer {
|
||||||
private static MAP_ROOT_NODE = 'map';
|
private static MAP_ROOT_NODE = 'map';
|
||||||
@ -457,7 +458,7 @@ class XMLSerializerTango implements XMLMindmapSerializer {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static _deserializeRelationship(domElement, mindmap) {
|
static _deserializeRelationship(domElement: Element, mindmap: Mindmap): RelationshipModel {
|
||||||
const srcId = Number.parseInt(domElement.getAttribute('srcTopicId'), 10);
|
const srcId = Number.parseInt(domElement.getAttribute('srcTopicId'), 10);
|
||||||
const destId = Number.parseInt(domElement.getAttribute('destTopicId'), 10);
|
const destId = Number.parseInt(domElement.getAttribute('destTopicId'), 10);
|
||||||
const lineType = Number.parseInt(domElement.getAttribute('lineType'), 10);
|
const lineType = Number.parseInt(domElement.getAttribute('lineType'), 10);
|
||||||
@ -468,6 +469,7 @@ class XMLSerializerTango implements XMLMindmapSerializer {
|
|||||||
if (srcId === destId) {
|
if (srcId === destId) {
|
||||||
throw new Error('Invalid relationship, dest and source are equals');
|
throw new Error('Invalid relationship, dest and source are equals');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is the connections points valid ?. If it's not, do not load the relationship ...
|
// Is the connections points valid ?. If it's not, do not load the relationship ...
|
||||||
if (mindmap.findNodeById(srcId) == null || mindmap.findNodeById(destId) == null) {
|
if (mindmap.findNodeById(srcId) == null || mindmap.findNodeById(destId) == null) {
|
||||||
throw new Error('Transition could not created, missing node for relationship');
|
throw new Error('Transition could not created, missing node for relationship');
|
||||||
@ -481,8 +483,9 @@ class XMLSerializerTango implements XMLMindmapSerializer {
|
|||||||
if ($defined(destCtrlPoint) && destCtrlPoint !== '') {
|
if ($defined(destCtrlPoint) && destCtrlPoint !== '') {
|
||||||
model.setDestCtrlPoint(Point.fromString(destCtrlPoint));
|
model.setDestCtrlPoint(Point.fromString(destCtrlPoint));
|
||||||
}
|
}
|
||||||
model.setEndArrow('false');
|
|
||||||
model.setStartArrow('true');
|
model.setEndArrow(false);
|
||||||
|
model.setStartArrow(true);
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user