Committed by
Gerrit Code Review
Topo2 Fixed device positions
Change-Id: I2a285710fb7bce23734ac4afb1a3ac66f6179f11
Showing
2 changed files
with
23 additions
and
9 deletions
... | @@ -383,12 +383,15 @@ class Topo2Jsonifier { | ... | @@ -383,12 +383,15 @@ class Topo2Jsonifier { |
383 | 383 | ||
384 | 384 | ||
385 | private ObjectNode jsonClosedRegion(UiRegion region) { | 385 | private ObjectNode jsonClosedRegion(UiRegion region) { |
386 | - return objectNode() | 386 | + ObjectNode node = objectNode() |
387 | .put("id", region.idAsString()) | 387 | .put("id", region.idAsString()) |
388 | .put("name", region.name()) | 388 | .put("name", region.name()) |
389 | .put("nodeType", REGION) | 389 | .put("nodeType", REGION) |
390 | .put("nDevs", region.deviceCount()); | 390 | .put("nDevs", region.deviceCount()); |
391 | // TODO: complete closed-region details | 391 | // TODO: complete closed-region details |
392 | + | ||
393 | + addMetaUi(node, region.idAsString()); | ||
394 | + return node; | ||
392 | } | 395 | } |
393 | 396 | ||
394 | /** | 397 | /** | ... | ... |
... | @@ -63,6 +63,7 @@ | ... | @@ -63,6 +63,7 @@ |
63 | 63 | ||
64 | // If the device contains explicit LONG/LAT data, use that to position | 64 | // If the device contains explicit LONG/LAT data, use that to position |
65 | if (setLongLat(node)) { | 65 | if (setLongLat(node)) { |
66 | + // Indicate we want to update cached meta data... | ||
66 | return true; | 67 | return true; |
67 | } | 68 | } |
68 | 69 | ||
... | @@ -114,29 +115,37 @@ | ... | @@ -114,29 +115,37 @@ |
114 | angular.extend(node, xy); | 115 | angular.extend(node, xy); |
115 | } | 116 | } |
116 | 117 | ||
117 | - function setLongLat(node) { | 118 | + function setLongLat(el) { |
118 | - var loc = node.location, | 119 | + var loc = el.get('location'), |
119 | coord; | 120 | coord; |
120 | 121 | ||
121 | if (loc && loc.type === 'lnglat') { | 122 | if (loc && loc.type === 'lnglat') { |
123 | + | ||
124 | + if (loc.lat === 0 && loc.lng === 0) { | ||
125 | + return false; | ||
126 | + } | ||
127 | + | ||
122 | coord = coordFromLngLat(loc); | 128 | coord = coordFromLngLat(loc); |
123 | - node.fixed = true; | 129 | + el.fixed = true; |
124 | - node.px = node.x = coord[0]; | 130 | + el.x = el.px = coord[0]; |
125 | - node.py = node.y = coord[1]; | 131 | + el.y = el.py = coord[1]; |
132 | + | ||
126 | return true; | 133 | return true; |
127 | } | 134 | } |
128 | } | 135 | } |
129 | 136 | ||
130 | function coordFromLngLat(loc) { | 137 | function coordFromLngLat(loc) { |
131 | var p = t2mcs.projection(); | 138 | var p = t2mcs.projection(); |
132 | - return p ? p.invert([loc.lng, loc.lat]) : [0, 0]; | 139 | + return p ? p([loc.lng, loc.lat]) : [0, 0]; |
133 | } | 140 | } |
134 | 141 | ||
135 | angular.module('ovTopo2') | 142 | angular.module('ovTopo2') |
136 | .factory('Topo2NodeModel', | 143 | .factory('Topo2NodeModel', |
137 | ['Topo2Model', 'FnService', 'RandomService', 'Topo2PrefsService', | 144 | ['Topo2Model', 'FnService', 'RandomService', 'Topo2PrefsService', |
138 | - 'SvgUtilService', 'IconService', 'ThemeService', 'Topo2MapConfigService', | 145 | + 'SvgUtilService', 'IconService', 'ThemeService', |
139 | - function (Model, _fn_, _RandomService_, _ps_, _sus_, _is_, _ts_, _t2mcs_) { | 146 | + 'Topo2MapConfigService', |
147 | + function (Model, _fn_, _RandomService_, _ps_, _sus_, _is_, _ts_, | ||
148 | + _t2mcs_) { | ||
140 | 149 | ||
141 | randomService = _RandomService_; | 150 | randomService = _RandomService_; |
142 | ts = _ts_; | 151 | ts = _ts_; |
... | @@ -148,6 +157,8 @@ | ... | @@ -148,6 +157,8 @@ |
148 | 157 | ||
149 | return Model.extend({ | 158 | return Model.extend({ |
150 | initialize: function () { | 159 | initialize: function () { |
160 | + this.set('class', this.nodeType); | ||
161 | + this.set('svgClass', this.svgClassName()); | ||
151 | this.node = this.createNode(); | 162 | this.node = this.createNode(); |
152 | }, | 163 | }, |
153 | createNode: function () { | 164 | createNode: function () { | ... | ... |
-
Please register or login to post a comment