<commit_before>
function asOpenLayers(crs) {
  var crs = crs || 'EPSG:3857';
  var features = (new ol.format.GeoJSON()).readFeatures(this.data,{featureProjection:ol.proj.get(crs)});
  //var ua = window.navigator.userAgent;
	//var isIE = ( ua.indexOf('MSIE ') > 0 || ua.indexOf('Trident/') > 0 || ua.indexOf('Edge/')  > 0) ? true : false;
  for (var i = 0; i< features.length; i++) {
    var feature = features[i];

    if (feature.getGeometry().getType() == 'Point') {
      var props = feature.getProperties();
      props.size = 30;
      
      if (props.sidc.charAt(0) != 'X') { //Skip SitaWare custom graphics for now
        var mysymbol = new ms.Symbol(props);
        //var image = isIE ? mysymbol.asCanvas() : mysymbol.toDataURL();
        var image = mysymbol.asCanvas();
        
        feature.setStyle(new ol.style.Style({
          image: new ol.style.Icon( ({
            //scale: 1/ratio,
            anchor: [mysymbol.getAnchor().x, mysymbol.getAnchor().y],
            anchorXUnits: 'pixels',
            anchorYUnits: 'pixels',
            imgSize: [Math.floor(mysymbol.getSize().width), Math.floor(mysymbol.getSize().height)],
            img: (image)
          }))
        }));
      }
    }
    if (feature.getGeometry().getType() == 'LineString') {
      	var style = new ol.style.Style({
          stroke: new ol.style.Stroke({lineCap:'butt', color:'#000000', width: 2})
        });
        feature.setStyle(style);
    }
    if (feature.getGeometry().getType() == 'MultiLineString') {
      	var style = new ol.style.Style({
          stroke: new ol.style.Stroke({lineCap:'butt', color:'#000000', width: 2})
        });
        feature.setStyle(style);
    }
    if (feature.getGeometry().getType() == 'Polygon') {
      	var style = new ol.style.Style({
          stroke: new ol.style.Stroke({lineCap:'butt', color:'#000000', width: 2}),
          fill: new ol.style.Fill({color: 'rgba(0,0,0,0)'})
        });
        feature.setStyle(style);
    }
  }
  return features;
}

module.exports = asOpenLayers;
<commit_msg>Make Open Layers use high dpi icons<commit_after>
function asOpenLayers(crs) {
  var crs = crs || 'EPSG:3857';
  //var ua = window.navigator.userAgent;
  //var isIE = ( ua.indexOf('MSIE ') > 0 || ua.indexOf('Trident/') > 0 || ua.indexOf('Edge/')  > 0) ? true : false;
  var ratio = window.devicePixelRatio;
  
  var features = (new ol.format.GeoJSON()).readFeatures(this.data,{featureProjection:ol.proj.get(crs)});
  for (var i = 0; i< features.length; i++) {
    var feature = features[i];

    if (feature.getGeometry().getType() == 'Point') {
      var props = feature.getProperties();
      props.size = 30;
      
      if (props.sidc.charAt(0) != 'X') { //Skip SitaWare custom graphics for now
        var mysymbol = new ms.Symbol(props);
        //var image = isIE ? mysymbol.asCanvas() : mysymbol.toDataURL();
        var image = mysymbol.asCanvas(ratio);
        
        feature.setStyle(new ol.style.Style({
          image: new ol.style.Icon( ({
            scale: 1/ratio,
            anchor: [mysymbol.getAnchor().x*ratio, mysymbol.getAnchor().y*ratio],
            anchorXUnits: 'pixels',
            anchorYUnits: 'pixels',
            imgSize: [Math.floor(mysymbol.getSize().width*ratio), Math.floor(mysymbol.getSize().height*ratio)],
            img: (image)
          }))
        }));
      }
    }
    if (feature.getGeometry().getType() == 'LineString' || feature.getGeometry().getType() == 'MultiLineString') {
      	var style = new ol.style.Style({
          stroke: new ol.style.Stroke({lineCap:'butt', color:'#000000', width: 2})
        });
        feature.setStyle(style);
    }
    if (feature.getGeometry().getType() == 'Polygon') {
      	var style = new ol.style.Style({
          stroke: new ol.style.Stroke({lineCap:'butt', color:'#000000', width: 2}),
          fill: new ol.style.Fill({color: 'rgba(0,0,0,0)'})
        });
        feature.setStyle(style);
    }
  }
  return features;
}

module.exports = asOpenLayers;

{'fraction_non_alphanumeric': 0.174, 'fraction_numerical': 0.01675, 'mean_word_length': 2.518909410729991, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3725926', 'n_tokens_mistral': 1369, 'n_tokens_neox': 1317, 'n_words': 261}