1 if (typeof dreamer
=== 'undefined') {
6 dreamer
.OsmController
= (function(global
) {
11 OsmController
.prototype.constructor = OsmController
;
16 function OsmController() {
22 OsmController
.prototype.addNode = function(graph_editor
, node
, success
, error
) {
25 'group_id': node
.info
.group
[0],
26 'element_id': node
.id
,
27 'element_type': node
.info
.type
,
28 'element_desc_id': node
.info
.desc_id
,
32 new dreamer
.GraphRequests().addNode(data_to_send
, null, function() {
38 OsmController
.prototype.addLink = function(graph_editor
, link
, success
, error
) {
41 'desc_id': link
.desc_id
,
42 'source': link
.source
.id
,
43 'source_type': link
.source
.info
.type
,
44 'target': link
.target
.id
,
45 'target_type': link
.target
.info
.type
,
49 new dreamer
.GraphRequests().addLink(link
, null, function() {
50 graph_editor
._deselectAllNodes();
52 if (typeof old_link
!== 'undefined' && old_link
.length
> 0 && old_link
[0].index
!== 'undefined') {
53 graph_editor
.parent
.removeLink
.call(graph_editor
, old_link
[0].index
);
61 OsmController
.prototype.removeNode = function(graph_editor
, node
, success
, error
) {
64 'group_id': node
.info
.group
[0],
65 'element_id': node
.id
,
66 'element_type': node
.info
.type
,
67 'element_desc_id': node
.info
.desc_id
,
69 new dreamer
.GraphRequests().removeNode(data_to_send
, null, function() {
76 OsmController
.prototype.removeLink = function(graph_editor
, link
, success
, error
) {
79 'desc_id': link
.desc_id
,
80 'source': link
.source
.id
,
81 'source_type': link
.source
.info
.type
,
82 'target': link
.target
.id
,
83 'target_type': link
.target
.info
.type
,
87 new dreamer
.GraphRequests().removeLink(data_to_send
, function() {
99 console
.log("::OsmController::", text
);
102 return OsmController
;
105 if (typeof module
=== 'object') {
106 module
.exports
= dreamer
.OsmController
;