loyaltyRanges seem to be working; ready for data

This commit is contained in:
Ryan Carpenter
2016-09-05 00:12:30 +08:00
parent 02e161e5c4
commit cfb541a0a2
5 changed files with 146 additions and 49 deletions
+58 -35
View File
@@ -1,36 +1,59 @@
key,latitude,longitude,
Jeor_Mormont-1,76.17449795,-99.53613281,
Jeor_Mormont-1,74.36667479,-96.87011719,
Jeor_Mormont-1,74.62510096,-125.0830078,
Jeor_Mormont-1,76.36226182,-117.6855469,
Jeor_Mormont-1,76.59854507,-112.3828125,
Robert_Baratheon-1,74.36667479,-96.87011719,
Robert_Baratheon-1,74.62510096,-125.0830078,
Robert_Baratheon-1,74.05579888,-140.2880859,
Robert_Baratheon-1,71.20191973,-153.8232422,
Robert_Baratheon-1,64.86760782,-151.7138672,
Robert_Baratheon-1,65.92855384,-158.1298828,
Robert_Baratheon-1,59.73425345,-162.3486328,
Robert_Baratheon-1,53.8784404,-153.4716797,
Robert_Baratheon-1,46.34692761,-161.0302734,
Robert_Baratheon-1,43.61221677,-158.1298828,
Robert_Baratheon-1,45.61403741,-144.5947266,
Robert_Baratheon-1,40.68063803,-136.3330078,
Robert_Baratheon-1,43.73935208,-119.8974609,
Robert_Baratheon-1,53.8784404,-113.3056641,
Robert_Baratheon-1,50.81981826,-111.1962891,
Robert_Baratheon-1,52.24125615,-100.1220703,
Robert_Baratheon-1,58.28639548,-96.60644531,
Robert_Baratheon-1,57.35023748,-84.47753906,
Robert_Baratheon-1,59.62332522,-90.234375,
Robert_Baratheon-1,65.71255746,-93.88183594,
Robert_Baratheon-1,67.50856836,-82.98339844,
Robert_Baratheon-1,71.34301347,-80.30273438,
Robert_Baratheon-1,72.90672343,-82.58789063,
Robert_Baratheon-1,76.47577254,-78.046875,
Robert_Baratheon-1,77.76758238,-80.94726563,
Robert_Baratheon-1,78.59529919,-88.06640625,
Robert_Baratheon-1,77.7861905,-91.66992188,
Robert_Baratheon-1,75.58493741,-90.43945313,
Robert_Baratheon-1,74.18805166,-87.01171875,
key,latitude,longitude
Jeor_Mormont-1,76.17449795,-99.53613281
Jeor_Mormont-1,74.36667479,-96.87011719
Jeor_Mormont-1,74.62510096,-125.0830078
Jeor_Mormont-1,76.36226182,-117.6855469
Jeor_Mormont-1,76.59854507,-112.3828125
Robert_Baratheon-1,74.36667479,-96.87011719
Robert_Baratheon-1,74.62510096,-125.0830078
Robert_Baratheon-1,74.05579888,-140.2880859
Robert_Baratheon-1,71.20191973,-153.8232422
Robert_Baratheon-1,64.86760782,-151.7138672
Robert_Baratheon-1,65.92855384,-158.1298828
Robert_Baratheon-1,59.73425345,-162.3486328
Robert_Baratheon-1,53.8784404,-153.4716797
Robert_Baratheon-1,46.34692761,-161.0302734
Robert_Baratheon-1,43.61221677,-158.1298828
Robert_Baratheon-1,45.61403741,-144.5947266
Robert_Baratheon-1,40.68063803,-136.3330078
Robert_Baratheon-1,38.3072,-133.96
Robert_Baratheon-1,35.9958,-139.058
Robert_Baratheon-1,32.6579,-137.563
Robert_Baratheon-1,35.066,-130.62
Robert_Baratheon-1,31.4662,-129.038
Robert_Baratheon-1,27.5667,-134.136
Robert_Baratheon-1,16.9307,-136.421
Robert_Baratheon-1,11.1353,-135.718
Robert_Baratheon-1,6.27162,-125.435
Robert_Baratheon-1,2.24064,-112.119
Robert_Baratheon-1,13.6246,-108.955
Robert_Baratheon-1,17.7696,-100.693
Robert_Baratheon-1,19.0206,-101.748
Robert_Baratheon-1,20.3858,-92.5635
Robert_Baratheon-1,30.1071,-78.5889
Robert_Baratheon-1,32.5468,-77.8418
Robert_Baratheon-1,32.6949,-87.2021
Robert_Baratheon-1,36.3859,-80.5225
Robert_Baratheon-1,43.3571,-80.7422
Robert_Baratheon-1,48.9225,-83.335
Robert_Baratheon-1,49.6392,-106.7139
Robert_Baratheon-1,48.3416,-110.5371
Robert_Baratheon-1,43.0368,-117.7
Robert_Baratheon-1,43.73935208,-119.8974609
Robert_Baratheon-1,53.8784404,-113.3056641
Robert_Baratheon-1,50.81981826,-111.1962891
Robert_Baratheon-1,52.24125615,-100.1220703
Robert_Baratheon-1,58.28639548,-96.60644531
Robert_Baratheon-1,57.35023748,-84.47753906
Robert_Baratheon-1,59.62332522,-90.234375
Robert_Baratheon-1,65.71255746,-93.88183594
Robert_Baratheon-1,67.50856836,-82.98339844
Robert_Baratheon-1,71.34301347,-80.30273438
Robert_Baratheon-1,72.90672343,-82.58789063
Robert_Baratheon-1,76.47577254,-78.046875
Robert_Baratheon-1,77.76758238,-80.94726563
Robert_Baratheon-1,78.59529919,-88.06640625
Robert_Baratheon-1,77.7861905,-91.66992188
Robert_Baratheon-1,75.58493741,-90.43945313
Robert_Baratheon-1,74.18805166,-87.01171875
Robert_Baratheon-1,73.35305494,-95.94726563
1 key latitude longitude
2 Jeor_Mormont-1 76.17449795 -99.53613281
3 Jeor_Mormont-1 74.36667479 -96.87011719
4 Jeor_Mormont-1 74.62510096 -125.0830078
5 Jeor_Mormont-1 76.36226182 -117.6855469
6 Jeor_Mormont-1 76.59854507 -112.3828125
7 Robert_Baratheon-1 74.36667479 -96.87011719
8 Robert_Baratheon-1 74.62510096 -125.0830078
9 Robert_Baratheon-1 74.05579888 -140.2880859
10 Robert_Baratheon-1 71.20191973 -153.8232422
11 Robert_Baratheon-1 64.86760782 -151.7138672
12 Robert_Baratheon-1 65.92855384 -158.1298828
13 Robert_Baratheon-1 59.73425345 -162.3486328
14 Robert_Baratheon-1 53.8784404 -153.4716797
15 Robert_Baratheon-1 46.34692761 -161.0302734
16 Robert_Baratheon-1 43.61221677 -158.1298828
17 Robert_Baratheon-1 45.61403741 -144.5947266
18 Robert_Baratheon-1 40.68063803 -136.3330078
19 Robert_Baratheon-1 43.73935208 38.3072 -119.8974609 -133.96
20 Robert_Baratheon-1 53.8784404 35.9958 -113.3056641 -139.058
21 Robert_Baratheon-1 50.81981826 32.6579 -111.1962891 -137.563
22 Robert_Baratheon-1 52.24125615 35.066 -100.1220703 -130.62
23 Robert_Baratheon-1 58.28639548 31.4662 -96.60644531 -129.038
24 Robert_Baratheon-1 57.35023748 27.5667 -84.47753906 -134.136
25 Robert_Baratheon-1 59.62332522 16.9307 -90.234375 -136.421
26 Robert_Baratheon-1 65.71255746 11.1353 -93.88183594 -135.718
27 Robert_Baratheon-1 67.50856836 6.27162 -82.98339844 -125.435
28 Robert_Baratheon-1 71.34301347 2.24064 -80.30273438 -112.119
29 Robert_Baratheon-1 72.90672343 13.6246 -82.58789063 -108.955
30 Robert_Baratheon-1 76.47577254 17.7696 -78.046875 -100.693
31 Robert_Baratheon-1 77.76758238 19.0206 -80.94726563 -101.748
32 Robert_Baratheon-1 78.59529919 20.3858 -88.06640625 -92.5635
33 Robert_Baratheon-1 77.7861905 30.1071 -91.66992188 -78.5889
34 Robert_Baratheon-1 75.58493741 32.5468 -90.43945313 -77.8418
35 Robert_Baratheon-1 74.18805166 32.6949 -87.01171875 -87.2021
36 Robert_Baratheon-1 36.3859 -80.5225
37 Robert_Baratheon-1 43.3571 -80.7422
38 Robert_Baratheon-1 48.9225 -83.335
39 Robert_Baratheon-1 49.6392 -106.7139
40 Robert_Baratheon-1 48.3416 -110.5371
41 Robert_Baratheon-1 43.0368 -117.7
42 Robert_Baratheon-1 43.73935208 -119.8974609
43 Robert_Baratheon-1 53.8784404 -113.3056641
44 Robert_Baratheon-1 50.81981826 -111.1962891
45 Robert_Baratheon-1 52.24125615 -100.1220703
46 Robert_Baratheon-1 58.28639548 -96.60644531
47 Robert_Baratheon-1 57.35023748 -84.47753906
48 Robert_Baratheon-1 59.62332522 -90.234375
49 Robert_Baratheon-1 65.71255746 -93.88183594
50 Robert_Baratheon-1 67.50856836 -82.98339844
51 Robert_Baratheon-1 71.34301347 -80.30273438
52 Robert_Baratheon-1 72.90672343 -82.58789063
53 Robert_Baratheon-1 76.47577254 -78.046875
54 Robert_Baratheon-1 77.76758238 -80.94726563
55 Robert_Baratheon-1 78.59529919 -88.06640625
56 Robert_Baratheon-1 77.7861905 -91.66992188
57 Robert_Baratheon-1 75.58493741 -90.43945313
58 Robert_Baratheon-1 74.18805166 -87.01171875
59 Robert_Baratheon-1 73.35305494 -95.94726563
+8 -7
View File
@@ -1,7 +1,8 @@
key,firstChapter,firstEpisode,
Robert_Baratheon-1,AGOT-1,S1E01,
Robert_Baratheon-2,AGOT-10,S1E10,
Jeor_Mormont-1,AGOT-1,S1E01,
Jeor_Mormont-2,AGOT-10,S1E10,
Mance_Rayder-1,AGOT-1,S1E01,
Mance_Rayder-3,,AGOT-10,S1E10
key,firstChapter,lastChapter,firstEpisode,lastEpisode
Robert_Baratheon-1,AGOT-1,AGOT-46,S1E01,S1E06
Jeor_Mormont-1,AGOT-1,ASOS-33,S1E01,S3E03
Mance_Rayder-1,AGOT-1,ASOS-72,S1E01,S4E08
Undeclared-1,AGOT-47,,S1E07,
Stannis_Baratheon-1,AGOT-47,,S1E07,
Joffrey_Baratheon-1,AGOT-47,,S1E07,
Renly_Baratheon-1,AGOT-47,,S1E07,
1 key firstChapter lastChapter firstEpisode lastEpisode
2 Robert_Baratheon-1 AGOT-1 AGOT-46 S1E01 S1E06
3 Robert_Baratheon-2 Jeor_Mormont-1 AGOT-10 AGOT-1 ASOS-33 S1E10 S1E01 S3E03
4 Jeor_Mormont-1 Mance_Rayder-1 AGOT-1 ASOS-72 S1E01 S4E08
5 Jeor_Mormont-2 Undeclared-1 AGOT-10 AGOT-47 S1E10 S1E07
6 Mance_Rayder-1 Stannis_Baratheon-1 AGOT-1 AGOT-47 S1E01 S1E07
7 Mance_Rayder-3 Joffrey_Baratheon-1 AGOT-47 S1E10 AGOT-10 S1E07
8 Renly_Baratheon-1 AGOT-47 S1E07
+25 -2
View File
@@ -60,6 +60,16 @@
idKey="'key'">
</ui-gmap-polygons>
<!-- Loyalty Range Polygons -->
<ui-gmap-polygons
models="mapModels.loyaltyRanges"
path="'path'"
fill="'fill'"
stroke="'stroke'"
visible="options.politicalAllegiances"
idKey="'key'">
</ui-gmap-polygons>
<!-- Character Markers -->
<ui-gmap-markers
models='mapModels.characters'
@@ -112,9 +122,9 @@
<button class="list-group-item btn-clear" ng-click="toState('about')" ng-class="{highlight:(state=='about')}">
<i class="glyphicon glyphicon-question-sign"></i>
</button>
<!-- <button class="list-group-item btn-clear" ng-click="toState('edit')" ng-class="{highlight:(state=='edit')}">
<button class="list-group-item btn-clear" ng-click="toState('edit')" ng-class="{highlight:(state=='edit')}">
<i class="glyphicon glyphicon-pencil"></i>
</button> -->
</button>
</div>
</div>
@@ -357,6 +367,19 @@
</tbody>
</table>
<hr>
<table>
<tbody>
<tr ng-repeat="point in clickHistory">
<!-- <td></td>
<td></td> -->
<td>{{point.latitude | number:4}}</td>
<td>{{point.longitude | number:4}}</td>
</tr>
</tbody>
</table>
</div>
</div>
+18 -4
View File
@@ -14,7 +14,7 @@ angular.module('quartermaester')
characterPaths: true,
houseHeraldry: false,
geographicRegions: false,
politicalAllegiances: false,
politicalAllegiances: true,
characters: {}
};
$scope.map = {
@@ -49,6 +49,7 @@ angular.module('quartermaester')
$scope.episodes = [];
$scope.chapters = [];
$scope.searchResults = [];
$scope.clickHistory = [];
$scope.toState = toState;
$scope.slideTo = slideTo;
$scope.panTo = panTo;
@@ -97,7 +98,10 @@ angular.module('quartermaester')
path.editable = true;
return path;
});
// console.log("mapModels.paths", foo, $scope.mapModels.paths);
$scope.mapModels.loyaltyRanges = $filter('qmSlider')(qmData.loyaltyRanges, $scope.slider);
console.log("mapModels.loyaltyRanges", $scope.mapModels.loyaltyRanges);
//console.log("mapModels.regions", $scope.mapModels.regions);
}
function panToCharacter(newValue, oldValue) {
@@ -280,9 +284,19 @@ angular.module('quartermaester')
function mapClick(a, b, c, d) {
$scope.state = "slider";
//console.log(a, b, c, d);
// console.log(c[0].latLng.lat());
//console.log("lng", c[0].latLng.lng());
//$scope.lastClick = JSON;
console.log($scope.mapModels.paths);
//console.log($scope.mapModels.paths);
addClickToEditor(c[0].latLng.lat(), c[0].latLng.lng())
}
function addClickToEditor(latitude, longitude) {
$scope.clickHistory.push({
latitude: latitude,
longitude: longitude
});
//console.log("history", $scope.clickHistory);
//$scope.$apply();
}
function onMapLoad(maps) {
+37 -1
View File
@@ -69,17 +69,20 @@ angular.module('quartermaester')
getFile('houses.csv'),
getFile('characters.csv'),
getFile('regions.csv'),
getFile('loyaltyRanges.csv'),
getFile('towns.csv'),
getFile('borders.csv'),
getFile('loyaltyRangeEdges.csv'),
getFile('stops.csv'),
getFile('waypoints.csv'),
getFile('paths.csv')
]).spread(parseData);
}
function parseData(books, chapters, seasons, episodes, houses, characters, regions, towns, borders, stops, waypoints, paths) {
function parseData(books, chapters, seasons, episodes, houses, characters, regions, loyaltyRanges, towns, borders, loyaltyRangeEdges, stops, waypoints, paths) {
var qmData = {
borderArrays: {},
lrEdgeArrays: {},
waypointArrays: {},
bookLookup: {}
};
@@ -91,6 +94,17 @@ angular.module('quartermaester')
qmData.borderArrays[borders[i].name].push(borders[i]);
}
for (var i=0; i<loyaltyRangeEdges.length; i++) {
if (!(loyaltyRangeEdges[i].key in qmData.lrEdgeArrays))
qmData.lrEdgeArrays[loyaltyRangeEdges[i].key] = [];
qmData.lrEdgeArrays[loyaltyRangeEdges[i].key].push(loyaltyRangeEdges[i]);
// qmData.lrEdgeArrays[loyaltyRangeEdges[i].key].push({
// latitude: parseFloat(loyaltyRangeEdges[i].latitude),
// longitude: parseFloat(loyaltyRangeEdges[i].longitude)
// });
}
//console.log("qmData.lrEdgeArrays", qmData.lrEdgeArrays);
for (var i=0; i<waypoints.length; i++) {
if (!(waypoints[i].key in qmData.waypointArrays))
qmData.waypointArrays[waypoints[i].key] = [];
@@ -106,6 +120,7 @@ angular.module('quartermaester')
qmData.books = books;
qmData.regions = regions.map(regionModel);
qmData.characters = characters.map(characterModel);
qmData.loyaltyRanges = loyaltyRanges.map(loyaltyRangeModel);
qmData.towns = getTownMarkers(towns, houses);
qmData.heraldry = houses.map(heraldryMarkerModel);
qmData.characterMarkers = stops.map(characterMarkerModel);
@@ -321,6 +336,27 @@ angular.module('quartermaester')
};
}
function loyaltyRangeModel(loyaltyRange) {
var matchingCharacter = {color: "#eeeeee"};
console.log(loyaltyRange);
var keyMatch = /(.+)\-\d+$/.exec(loyaltyRange.key);
if (keyMatch[1]!="Undeclared") matchingCharacter = $filter('filter')(qmData.characters, {key: keyMatch[1]})[0];
return {
key: loyaltyRange.key,
fill: {
color: matchingCharacter.color,
opacity: 0.5
},
stroke: {weight: 0},
path: qmData.lrEdgeArrays[loyaltyRange.key],
timing: {
episodes: [getEpisodeId(loyaltyRange.firstEpisode), getEpisodeId(loyaltyRange.lastEpisode)],
chapters: [getChapterId(loyaltyRange.firstChapter), getChapterId(loyaltyRange.lastChapter)]
}
};
}
function characterMarkerModel(stop, index, fullArray) {
var matchingCharacter = $filter('filter')(qmData.characters, {key: stop.character})[0];
var coords = (stop.town=="") ? {latitude:parseFloat(stop.latitude), longitude:parseFloat(stop.longitude)} : $filter('filter')(qmData.towns, {key: stop.town})[0].coords;