Update map template variables specific to heatmap visual
493310
def add_unique_template_variables(self, options):
        """"""

        # set line stroke dash interval based on line_stroke property
        if self.line_stroke in ["dashed", "--"]:
            self.line_dash_array = [6, 4]
        elif self.line_stroke in ["dotted", ":"]:
            self.line_dash_array = [0.5, 4]
        elif self.line_stroke in ["dash dot", "-."]:
            self.line_dash_array = [6, 4, 0.5, 4]
        elif self.line_stroke in ["solid", "-"]:
            self.line_dash_array = [1, 0]
        else:
            # default to solid line
            self.line_dash_array = [1, 0]

        # check if choropleth map should include 3-D extrusion
        self.extrude = all([bool(self.height_property), bool(self.height_stops)])

        # common variables for vector and geojson-based choropleths
        options.update(dict(
            colorStops=self.color_stops,
            colorProperty=self.color_property,
            colorType=self.color_function_type,
            defaultColor=self.color_default,
            lineColor=self.line_color,
            lineDashArray=self.line_dash_array,
            lineStroke=self.line_stroke,
            lineWidth=self.line_width,
            extrudeChoropleth=self.extrude,
            highlightColor=self.highlight_color
        ))
        if self.extrude:
            options.update(dict(
                heightType=self.height_function_type,
                heightProperty=self.height_property,
                heightStops=self.height_stops,
                defaultHeight=self.height_default,
            ))

        # vector-based choropleth map variables
        if self.vector_source:
            options.update(vectorColorStops=self.generate_vector_color_map())
            
            if self.extrude:
                options.update(vectorHeightStops=self.generate_vector_numeric_map('height'))

        # geojson-based choropleth map variables
        else:
            options.update(geojson_data=json.dumps(self.data, ensure_ascii=False))
1128908
def update_template(template,**kwargs):
    
    tmpl = db.DBSession.query(Template).filter(Template.id==template.id).one()
    tmpl.name = template.name
    if template.description:
        tmpl.description = template.description

    #Lazy load the rest of the template
    for tt in tmpl.templatetypes:
        for ta in tt.typeattrs:
            ta.attr

    if template.layout:
        tmpl.layout = get_layout_as_string(template.layout)

    type_dict = dict([(t.id, t) for t in tmpl.templatetypes])
    existing_templatetypes = []

    if template.types is not None or template.templatetypes is not None:
        types = template.types if template.types is not None else template.templatetypes
        for templatetype in types:
            if templatetype.id is not None:
                type_i = type_dict[templatetype.id]
                _update_templatetype(templatetype, type_i)
                existing_templatetypes.append(type_i.id)
            else:
                #Give it a template ID if it doesn't have one
                templatetype.template_id = template.id
                new_templatetype_i = _update_templatetype(templatetype)
                existing_templatetypes.append(new_templatetype_i.id)

    for tt in tmpl.templatetypes:
        if tt.id not in existing_templatetypes:
            delete_templatetype(tt.id)

    db.DBSession.flush()

    return tmpl
736402
function heatmap(config){
            // private variables
            var _ = {
                radius : 40,
                element : {},
                canvas : {},
                acanvas: {},
                ctx : {},
                actx : {},
                legend: null,
                visible : true,
                width : 0,
                height : 0,
                max : false,
                gradient : false,
                opacity: 180,
                premultiplyAlpha: false,
                bounds: {
                    l: 1000,
                    r: 0,
                    t: 1000,
                    b: 0
                },
                debug: false
            };
            // heatmap store containing the datapoints and information about the maximum
            // accessible via instance.store
            this.store = new store(this);

            this.get = function(key){
                return _[key];
            };
            this.set = function(key, value){
                _[key] = value;
            };
            // configure the heatmap when an instance gets created
            this.configure(config);
            // and initialize it
            this.init();
        }
341218
public String replace(Map<String, String> varMap)
   {
      StringBuilder newString = new StringBuilder();

      int p = 0;
      int p0 = 0;
      while (true)
      {
         p = templateText.indexOf("${", p);
         if (p == -1)
         {
            newString.append(templateText.substring(p0, templateText.length()));
            break;
         }
         else
         {
            newString.append(templateText.substring(p0, p));
         }
         p0 = p;
         p = templateText.indexOf("}", p);
         if (p != -1)
         {
            String varName = templateText.substring(p0 + 2, p).trim();
            if (varMap.containsKey(varName))
            {
               newString.append(varMap.get(varName));
               p0 = p + 1;
            }
         }
      }
      return newString.toString();
   }
492733
private void updateRender() {
		if (inherit.isSelected())
		{
			emitter.usePoints = Particle.INHERIT_POINTS;
			oriented.setEnabled( true );
		}
		if (quads.isSelected())
		{
			emitter.usePoints = Particle.USE_QUADS;
			oriented.setEnabled( true );
		}
		if (points.isSelected())
		{
			emitter.usePoints = Particle.USE_POINTS;
			oriented.setEnabled( false );
			oriented.setSelected( false );
		}
		
		// oriented
		if( oriented.isSelected())
			emitter.useOriented= true;
		else
			emitter.useOriented= false;
		
		// additive blending
		if( additive.isSelected())
			emitter.useAdditive= true;
		else
			emitter.useAdditive= false;
	}
150922
function mapTargets(target,mappedAttrs,vm)
      {
        /* attaches viewmodel to wrapper */
        target.kb_viewmodel = vm;
        
        /* map nodes with their bindings */
        var maps = mappedAttrs.maps = mappedAttrs.map(mappedAttrs.wrapper);

        mappedAttrs.wrapper.kb_maps = maps;
        
        /* loops through maps: {key:[map,map],key2:[map,map]} */
        Object.keys(maps).forEach(function(key){
          maps[key].forEach(function(map){
            switch(map.type)
            {
              case 'for':
                /* connects viewmodel and then loop creates components for converting and deletes original map*/
                map.connect(vm).createloop();
              break;
              case 'component':
                /* connects viewmodel updates value and then deletes map as it won't be used again */
                map.connect(vm).unsync();
              break;
              case 'node':
                map.connect(vm).replaceNode();
              break;
              default:
                /* standard data connection and value set */
                map.connect(vm);
              break;
            }
          })
        });
        
        mappedAttrs.wrapper.kb_viewmodel.onFinish.call(mappedAttrs.wrapper.kb_viewmodel,mappedAttrs.wrapper);
        if(mappedAttrs.wrapper.kb_viewmodel.onGlobalFinish)
        {
          mappedAttrs.wrapper.kb_viewmodel.onGlobalFinish.call(mappedAttrs.wrapper.kb_viewmodel,mappedAttrs.wrapper);
        }
        if(mappedAttrs.wrapper.kb_viewmodel.onNodeFinish)
        {
          mappedAttrs.wrapper.kb_viewmodel.onNodeFinish.call(mappedAttrs.wrapper.kb_viewmodel,mappedAttrs.wrapper);
        }
      }
246583
public static void extendData(SheetTemplate template, Map<String, String> data) {
        if (data == null)
            return;
        for (Row row : template.sheet) {
            for (Cell c : row) {
                if (c.getCellTypeEnum() != CellType.STRING)
                    continue;
                String str = c.getStringCellValue().trim();
                if (str.startsWith("#") && data.containsKey(str.substring(1))) {
                    c.setCellValue(data.get(str.substring(1)));
                }
            }
        }
    }
2125
function Heatmap() {
    var canvas = zrUtil.createCanvas();
    this.canvas = canvas;

    this.blurSize = 30;
    this.pointSize = 20;

    this.maxOpacity = 1;
    this.minOpacity = 0;

    this._gradientPixels = {};
}
416555
def _update_map(self, map, name=None, filepath=None):
        
        if name:
            map.name = name
        if filepath:
            map.filepath = filepath
        Session.commit()
228364
def _map_in_out(self, inside_var_name):
        """"""
        for out_name, in_name in self.outside_name_map.items():
            if inside_var_name == in_name:
                return out_name
        return None
311754
function _updateLayerName($canvas, data, layer, props) {
	var nameMap = data.layer.names;

	// If layer name is being added, not changed
	if (!props) {

		props = layer;

	} else {

		// Remove old layer name entry because layer name has changed
		if (props.name !== undefined && isString(layer.name) && layer.name !== props.name) {
			delete nameMap[layer.name];
		}

	}

	// Add new entry to layer name map with new name
	if (isString(props.name)) {
		nameMap[props.name] = layer;
	}
}
944570
public void setMap(Constituent v) {
    if (PTBConstituent_Type.featOkTst && ((PTBConstituent_Type)jcasType).casFeat_map == null)
      jcasType.jcas.throwFeatMissing("map", "de.julielab.jules.types.PTBConstituent");
    jcasType.ll_cas.ll_setRefValue(addr, ((PTBConstituent_Type)jcasType).casFeatCode_map, jcasType.ll_cas.ll_getFSRef(v));}
356944
def change_attributes(self, **kwargs):
        '''
        
        '''
        new_track = Track(self.viewconf['type'])
        new_track.position = self.position
        new_track.tileset = self.tileset
        new_track.viewconf = json.loads(json.dumps(self.viewconf))
        new_track.viewconf = {**new_track.viewconf, **kwargs}

        return new_track
863813
def update_frame(self, key, ranges=None, element=None):
        
        reused = isinstance(self.hmap, DynamicMap) and self.overlaid
        if not reused and element is None:
            element = self._get_frame(key)
        elif element is not None:
            self.current_frame = element
            self.current_key = key
        items = [] if element is None else list(element.data.items())

        if isinstance(self.hmap, DynamicMap):
            range_obj = element
        else:
            range_obj = self.hmap

        if element is not None:
            ranges = self.compute_ranges(range_obj, key, ranges)

        # Update plot options
        plot_opts = self.lookup_options(element, 'plot').options
        inherited = self._traverse_options(element, 'plot',
                                           self._propagate_options,
                                           defaults=False)
        plot_opts.update(**{k: v[0] for k, v in inherited.items() if k not in plot_opts})
        self.param.set_param(**plot_opts)

        if element and not self.overlaid and not self.tabs and not self.batched:
            self._update_ranges(element, ranges)

        # Determine which stream (if any) triggered the update
        triggering = [stream for stream in self.streams if stream._triggering]

        for k, subplot in self.subplots.items():
            el = None

            # If in Dynamic mode propagate elements to subplots
            if isinstance(self.hmap, DynamicMap) and element:
                # In batched mode NdOverlay is passed to subplot directly
                if self.batched:
                    el = element
                # If not batched get the Element matching the subplot
                elif element is not None:
                    idx, spec, exact = dynamic_update(self, subplot, k, element, items)
                    if idx is not None:
                        _, el = items.pop(idx)
                        if not exact:
                            self._update_subplot(subplot, spec)

                # Skip updates to subplots when its streams is not one of
                # the streams that initiated the update
                if (triggering and all(s not in triggering for s in subplot.streams) and
                    not subplot in self.dynamic_subplots):
                    continue
            subplot.update_frame(key, ranges, element=el)

        if not self.batched and isinstance(self.hmap, DynamicMap) and items:
            init_kwargs = {'plots': self.handles['plots']}
            if not self.tabs:
                init_kwargs['plot'] = self.handles['plot']
            self._create_dynamic_subplots(key, items, ranges, **init_kwargs)
            if not self.overlaid and not self.tabs:
                self._process_legend()

        if element and not self.overlaid and not self.tabs and not self.batched:
            plot = self.handles['plot']
            self._update_plot(key, plot, element)
            self._set_active_tools(plot)

        self._process_legend()

        self._execute_hooks(element)
1264290
def extend(self, **kwargs):
    """"""

    props = self.copy()
    props.update(kwargs)
    return TemplateData(**props)
1335604
def apply(self, mapping):
        """"""
        self.output.seek(0)
        self.output.truncate(0)
        self.interpreter.string(self.template, locals=mapping)
        return self.output.getvalue()
1167952
def init_heatmap(x_vec, y_vec, hist_matrix, fig, colormap='Blues',
                 alpha=1, grid=False, colorbar=True,
                 vmax='auto', vmin='auto', crop=True):
    
    plt.figure(fig.number)
    ax = fig.gca()

    # set vmax and vmin
    vma = np.amax(hist_matrix) if vmax == 'auto' else vmax
    vmi = np.amin(hist_matrix) if vmin == 'auto' else vmin

    # an error check
    if vma <= vmi:
        vma = vmi + 1

    # grid the space for pcolormesh
    x_grid, y_grid = np.meshgrid(x_vec, y_vec)

    hmap = ax.pcolormesh(x_grid, y_grid, np.array(hist_matrix),
               cmap=colormap, alpha=alpha, shading='gouraud',
               vmax=vma, vmin=vmi)

    if colorbar:
        plt.colorbar(hmap)

    if not grid:
        ax.grid(False)

    if crop:
        ax.set_xlim([x_vec[0], x_vec[-1]])
        ax.set_ylim([y_vec[0], y_vec[-1]])