1. Fix for http://issues.library.cornell.edu/browse/NIHVIVO-2851 Improved function calling & added reasonable circle-smoothness defaults for map of science vis. Code reviewed by Chin Hua
This commit is contained in:
parent
43089cf3f1
commit
06de1cb8e4
3 changed files with 333 additions and 309 deletions
|
@ -168,9 +168,8 @@ var DisciplineMarkerManager = ScimapMarkerManager.extend({
|
|||
this._super(map, colorStrategy, sizeCoder);
|
||||
this.layer = DISCIPLINES;
|
||||
},
|
||||
createMarker: function(subdisciplineKey, density) {
|
||||
createMarker: function(key, density) {
|
||||
var me = this;
|
||||
var key = SUBDISCIPLINES[subdisciplineKey].discipline;
|
||||
var marker = this._super(key, density);
|
||||
var poly = marker.polygon;
|
||||
|
||||
|
|
|
@ -111,8 +111,10 @@ var CirclePolygon = Polygon.extend({
|
|||
var centerPoint = projection.fromLatLngToPoint(me.options.center);
|
||||
var radius = me.options.radius;
|
||||
|
||||
var incrementDegreeBy = (radius > 2) ? 1 : 10;
|
||||
|
||||
// Create polygon points (extra point to close polygon)
|
||||
for (var degree = 0; degree < 360; degree++) {
|
||||
for (var degree = 0; degree < 360; degree+=incrementDegreeBy) {
|
||||
var radian = degreeToRadians(degree);
|
||||
var x = centerPoint.x + (radius * Math.sin(radian));
|
||||
var y = centerPoint.y + (radius * Math.cos(radian));
|
||||
|
@ -147,4 +149,3 @@ var CirclePolygon = Polygon.extend({
|
|||
}));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ var ScimapWidget = Class.extend({
|
|||
me.activeManager = null;
|
||||
me.isUnloaded = true;
|
||||
me.map = map;
|
||||
|
||||
me.sliderControl = sliderControl;
|
||||
me.labelsMarkerManager = new DisciplineLabelsMarkerManager(map);
|
||||
me.disciplineLabelsControl = new CheckBoxPanel({
|
||||
|
@ -65,24 +66,47 @@ var ScimapWidget = Class.extend({
|
|||
me.pubsWithInvalidJournals = data.pubsWithInvalidJournals;
|
||||
me.pubsMapped = data.pubsMapped;
|
||||
|
||||
var scienceActivities = {};
|
||||
scienceActivities[SCIMAP_TYPE.DISCIPLINE] = me._collateDisciplineActivity(data.subdisciplineActivity);
|
||||
scienceActivities[SCIMAP_TYPE.SUBDISCIPLINE] = data.subdisciplineActivity;
|
||||
|
||||
this.isUnloaded = false;
|
||||
|
||||
$.each(this.keyToMarkerManagers, function(key, manager) {
|
||||
|
||||
// Need to create the AreaSizeCoding function
|
||||
manager.setSizeCoder(new CircleSizeCoder({
|
||||
scaler: new Scaler({ maxValue: me.pubsMapped })
|
||||
}));
|
||||
//markerManager.setSiseCodingFunction(new AreaSizeCoding(0, data.pubsMapped));
|
||||
$.each(data.subdisciplineActivity, function(subdiscipline, density) {
|
||||
|
||||
$.each(scienceActivities[key], function(science, density) {
|
||||
|
||||
// Create marker and add it to manager
|
||||
var marker = manager.createMarker(subdiscipline, density);
|
||||
var marker = manager.createMarker(science, density);
|
||||
|
||||
}); // end each subdisciplineActivity
|
||||
}); // end each scienceActivity
|
||||
|
||||
manager.sort();
|
||||
}); // end each markerManagers
|
||||
me.updateMap();
|
||||
},
|
||||
|
||||
_collateDisciplineActivity: function(subdiscipline) {
|
||||
|
||||
var disciplineToActivity = {};
|
||||
|
||||
$.each(DISCIPLINES, function(id, discipline) {
|
||||
disciplineToActivity[id] = 0.0;
|
||||
});
|
||||
|
||||
$.each(subdiscipline, function(key, activity) {
|
||||
var currentSubdisciplinesDiscipline = SUBDISCIPLINES[key].discipline;
|
||||
disciplineToActivity[currentSubdisciplinesDiscipline] += activity;
|
||||
});
|
||||
|
||||
return disciplineToActivity;
|
||||
},
|
||||
|
||||
mouseIn: function(key, childKey) {
|
||||
var manager = this.getMarkerManager(key);
|
||||
// Focus if only it is an active manager
|
||||
|
|
Loading…
Add table
Reference in a new issue