|
|
|
@ -2,9 +2,9 @@ var _ = require('underscore');
|
|
|
|
|
var camshaftReference = require('../../data/camshaft-reference');
|
|
|
|
|
var Utils = require('../../helpers/utils');
|
|
|
|
|
var InputColorCategories = require('../../components/form-components/editors/fill/input-color/input-categories/input-color-categories.js');
|
|
|
|
|
var S3_ASSET_URL = '//s3.amazonaws.com/com.cartodb.assets.static/';
|
|
|
|
|
|
|
|
|
|
var CONFIG = {
|
|
|
|
|
HEATMAP_IMAGE: 'url(http://s3.amazonaws.com/com.cartodb.assets.static/alphamarker.png)',
|
|
|
|
|
GENERIC_STYLE: camshaftReference.getDefaultCartoCSSForType(),
|
|
|
|
|
DEFAULT_HEATMAP_COLORS: ['blue', 'cyan', 'lightgreen', 'yellow', 'orange', 'red']
|
|
|
|
|
};
|
|
|
|
@ -305,12 +305,19 @@ var cartocssFactory = {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var heatmapConversion = function (style, animated) {
|
|
|
|
|
var heatmapConversion = function (style, animated, configModel) {
|
|
|
|
|
// modify the size
|
|
|
|
|
style.fill = _.clone(style.fill);
|
|
|
|
|
var ramp = style.fill.color.range;
|
|
|
|
|
style.fill.size = style.fill.size || { fixed: 35 };
|
|
|
|
|
style.fill.image = CONFIG.HEATMAP_IMAGE;
|
|
|
|
|
|
|
|
|
|
var alphaMarkerBaseUrl = S3_ASSET_URL;
|
|
|
|
|
if (configModel.get('cartodb_com_hosted')) {
|
|
|
|
|
alphaMarkerBaseUrl = configModel.get('app_assets_base_url') + '/images/';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
style.fill.image = 'url(' + alphaMarkerBaseUrl + 'alphamarker.png)';
|
|
|
|
|
|
|
|
|
|
style.fill.color = {
|
|
|
|
|
fixed: style.fill.color.fixed || 'white',
|
|
|
|
|
opacity: style.fill.color.opacity
|
|
|
|
@ -333,8 +340,8 @@ var styleConversion = {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
heatmap: function (style) {
|
|
|
|
|
return heatmapConversion(style, false);
|
|
|
|
|
heatmap: function (style, configModel) {
|
|
|
|
|
return heatmapConversion(style, false, configModel);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -363,7 +370,7 @@ function isCategoryType (styleDef, geometryType) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function generateCartoCSS (style, geometryType) {
|
|
|
|
|
function generateCartoCSS (style, geometryType, configModel) {
|
|
|
|
|
var css = '';
|
|
|
|
|
var styleDef = style.properties;
|
|
|
|
|
var isAnimatable = isTypeTorque(style.type);
|
|
|
|
@ -567,7 +574,7 @@ var AggregatedFactory = {
|
|
|
|
|
/**
|
|
|
|
|
* given a styleDefinition object and the geometry type generates the query wrapper and the
|
|
|
|
|
*/
|
|
|
|
|
function generateStyle (style, geometryType, mapContext) {
|
|
|
|
|
function generateStyle (style, geometryType, mapContext, configModel) {
|
|
|
|
|
if (style.type === 'none') {
|
|
|
|
|
return {
|
|
|
|
|
cartoCSS: CONFIG.GENERIC_STYLE,
|
|
|
|
@ -586,7 +593,7 @@ function generateStyle (style, geometryType, mapContext) {
|
|
|
|
|
var conversion = styleConversion[style.type];
|
|
|
|
|
var properties;
|
|
|
|
|
if (conversion) {
|
|
|
|
|
properties = conversion(style.properties);
|
|
|
|
|
properties = conversion(style.properties, configModel);
|
|
|
|
|
if (properties) {
|
|
|
|
|
style.properties = properties;
|
|
|
|
|
}
|
|
|
|
@ -605,7 +612,7 @@ function generateStyle (style, geometryType, mapContext) {
|
|
|
|
|
var layerType = style.type === 'heatmap' || style.type === 'animation' ? 'torque' : 'CartoDB';
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
cartoCSS: generateCartoCSS(style, geometryType),
|
|
|
|
|
cartoCSS: generateCartoCSS(style, geometryType, configModel),
|
|
|
|
|
sql: generateSQL(style, geometryType, mapContext),
|
|
|
|
|
layerType: layerType
|
|
|
|
|
};
|
|
|
|
|