Changeset 176:4e7ecb7437a4
- Timestamp:
- 08/30/08 12:33:19 (2 years ago)
- Author:
- rgrp
- Branch:
- default
- convert_revision:
- svn:10edda23-d834-0410-9182-b00384516d49/trunk@188
- Message:
-
[js/views][s]: (bugfix) fix mapview to work with factlets which do not have a location attribute and (concomitantly) draw these kind of factlets on other views (such as timeline).
- Details: Currently moovc.BaseView? was written so that only factlets with a location attribute were sent to drawFactlets. This meant factlets without location were not showing up on timeline. Removing this restriction directly broke mapview as it required location attribute.
- Fixed these issues by adding check in mapview, modifying moovc to send all factlet data to drawFactlets.
- Tests: added new factlet data (no location) to domain_data.js to test this.
- Location:
- microfacts/public
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r169
|
r176
|
|
| 73 | 73 | }; |
| 74 | 74 | this.factletsData.each( function(factletData, index) { |
| 75 | | var featureGeoJson = { |
| 76 | | "type": "Feature", |
| 77 | | "geometry": factletData.location, |
| 78 | | "properties": {"factlet": factletData} |
| 79 | | }; |
| 80 | | featureCollection.features.push(featureGeoJson); |
| | 75 | if (factletData.location) { |
| | 76 | var featureGeoJson = { |
| | 77 | "type": "Feature", |
| | 78 | "geometry": factletData.location, |
| | 79 | "properties": {"factlet": factletData} |
| | 80 | }; |
| | 81 | featureCollection.features.push(featureGeoJson); |
| | 82 | } |
| 81 | 83 | }, this); |
| 82 | 84 | return featureCollection; |
-
|
r174
|
r176
|
|
| 3 | 3 | |
| 4 | 4 | log: function(message) { |
| 5 | | console.log(message); |
| | 5 | // console.log(message); |
| 6 | 6 | }, |
| 7 | 7 | |
| … |
… |
|
| 38 | 38 | }, this); |
| 39 | 39 | var factletsData = []; |
| 40 | | // what is this doing in here? |
| 41 | | // why test for existence of location? May have date but not location |
| 42 | | this.factlets.each(function (factletObject) { |
| 43 | | if (factletObject.data.location) { |
| 44 | | factletsData.push(factletObject.data); |
| 45 | | } |
| | 40 | var factletsData = this.factlets.map(function(item) { |
| | 41 | return item.data; |
| 46 | 42 | }); |
| 47 | | // this.log("Factlet data:"); |
| 48 | | // this.log(factletsData); |
| 49 | 43 | this.drawFactlets(factletsData); |
| 50 | 44 | }, |
-
|
r169
|
r176
|
|
| 17 | 17 | }, |
| 18 | 18 | 'start': "1870-01-01 00:00:00" |
| | 19 | }, |
| | 20 | // factlet without location |
| | 21 | { |
| | 22 | 'id': 103, |
| | 23 | 'title': 'Third Factlet', |
| | 24 | 'start': "1879-01-01 00:00:00" |
| 19 | 25 | } |
| 20 | 26 | ]; |
| … |
… |
|
| 22 | 28 | var factletObjects = [ |
| 23 | 29 | { |
| | 30 | 'id' : factletsData[0]['id'], |
| 24 | 31 | 'data': factletsData[0] |
| 25 | 32 | }, |
| 26 | 33 | { |
| | 34 | 'id' : factletsData[1]['id'], |
| 27 | 35 | 'data': factletsData[1] |
| | 36 | }, |
| | 37 | { |
| | 38 | 'id' : factletsData[2]['id'], |
| | 39 | 'data': factletsData[2] |
| 28 | 40 | } |
| 29 | 41 | ]; |