Skip to content

Commit

Permalink
Replace stray hard tabs with soft tabs (except Makefiles)
Browse files Browse the repository at this point in the history
  • Loading branch information
ezwelty committed Nov 29, 2016
1 parent 813efb7 commit cf447c6
Show file tree
Hide file tree
Showing 36 changed files with 1,321 additions and 1,321 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -37,5 +37,5 @@ syncfrombackup:

shapes:
pgsql2shp -u fallingfruit_user -h localhost -f $(DATETIME)_cluster_polygon.shp fallingfruit_db 'SELECT zoom, muni, count, created_at, updated_at, ST_TRANSFORM(ST_SETSRID(polygon,900913),4326) FROM clusters ORDER BY zoom ASC, muni ASC'
pgsql2shp -u fallingfruit_user -h localhost -f $(DATETIME)_cluster_point.shp fallingfruit_db 'SELECT zoom, muni, count, created_at, updated_at, ST_TRANSFORM(ST_SETSRID(cluster_point,900913),4326) FROM clusters ORDER BY zoom ASC, muni ASC'
pgsql2shp -u fallingfruit_user -h localhost -f $(DATETIME)_cluster_point.shp fallingfruit_db 'SELECT zoom, muni, count, created_at, updated_at, ST_TRANSFORM(ST_SETSRID(cluster_point,900913),4326) FROM clusters ORDER BY zoom ASC, muni ASC'
pgsql2shp -u fallingfruit_user -h localhost -f $(DATETIME)_grid_point.shp fallingfruit_db 'SELECT zoom, muni, count, created_at, updated_at, ST_TRANSFORM(ST_SETSRID(grid_point,900913),4326) FROM clusters ORDER BY zoom ASC, muni ASC'
8 changes: 4 additions & 4 deletions app/assets/javascripts/gmaps4rails/gmaps4rails.base.js.coffee
Expand Up @@ -70,7 +70,7 @@ class @Gmaps4Rails
@markerClusterer = null # contains all marker clusterers
@markerImages = []

#Polyline Styling
#Polyline Styling
@polylines_conf = #default style for polylines
strokeColor: "#FF0000"
strokeOpacity: 1
Expand Down Expand Up @@ -221,7 +221,7 @@ class @Gmaps4Rails
fillColor = point.fillColor || @polygons_conf.fillColor
fillOpacity = point.fillOpacity || @polygons_conf.fillOpacity
clickable = point.clickable || @polygons_conf.clickable

#Construct the polygon
new_poly = new google.maps.Polygon
paths: polygon_coordinates
Expand All @@ -236,7 +236,7 @@ class @Gmaps4Rails
#save polygon in list
polygon.serviceObject = new_poly



#////////////////////////////////////////////////////
#///////////////////// MARKERS //////////////////////
Expand Down Expand Up @@ -410,7 +410,7 @@ class @Gmaps4Rails

#//basic function to check existence of a variable
exists : (var_name) ->
return (var_name != "" and typeof var_name != "undefined")
return (var_name != "" and typeof var_name != "undefined")


#randomize
Expand Down
78 changes: 39 additions & 39 deletions app/assets/javascripts/gmaps4rails/gmaps4rails.openlayers.js.coffee
Expand Up @@ -28,7 +28,7 @@ class @Gmaps4RailsOpenlayers extends Gmaps4Rails

createLatLng: (lat, lng)->
return new OpenLayers.LonLat(lng, lat).transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913")) # transform from WGS 1984 to Spherical Mercator Projection

createAnchor: (offset)->
return null if offset == null
return new OpenLayers.Pixel(offset[0], offset[1])
Expand All @@ -38,7 +38,7 @@ class @Gmaps4RailsOpenlayers extends Gmaps4Rails

createLatLngBounds: ->
return new OpenLayers.Bounds()

createMap: ->
#//todo add customization: kind of map and other map options
map = new OpenLayers.Map(@map_options.id)
Expand All @@ -54,9 +54,9 @@ class @Gmaps4RailsOpenlayers extends Gmaps4Rails
createMarker: (args) ->
style_mark = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default'])
style_mark.fillOpacity = 1
#//creating markers' dedicated layer
if (@markersLayer == null)

#//creating markers' dedicated layer
if (@markersLayer == null)
@markersLayer = new OpenLayers.Layer.Vector("Markers", null)
@serviceObject.addLayer(@markersLayer)
#//TODO move?
Expand All @@ -66,7 +66,7 @@ class @Gmaps4RailsOpenlayers extends Gmaps4Rails
@serviceObject.addControl(@markersControl)
@markersControl.activate()
#//showing default pic if none available
if args.marker_picture == ""
if args.marker_picture == ""
#style_mark.graphicWidth = 24
style_mark.graphicHeight = 30
style_mark.externalGraphic = "http://openlayers.org/dev/img/marker-blue.png"
Expand All @@ -76,7 +76,7 @@ class @Gmaps4RailsOpenlayers extends Gmaps4Rails
style_mark.graphicHeight = args.marker_height
style_mark.externalGraphic = args.marker_picture
#//adding anchor if any
if args.marker_anchor != null
if args.marker_anchor != null
style_mark.graphicXOffset = args.marker_anchor[0]
style_mark.graphicYOffset = args.marker_anchor[1]
#//adding shadow if any
Expand All @@ -88,7 +88,7 @@ class @Gmaps4RailsOpenlayers extends Gmaps4Rails
if args.shadow_anchor != null
style_mark.backgroundXOffset = args.shadow_anchor[0]
style_mark.backgroundYOffset = args.shadow_anchor[1]

style_mark.graphicTitle = args.title
marker = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Point(args.Lng, args.Lat),
Expand All @@ -98,30 +98,30 @@ class @Gmaps4RailsOpenlayers extends Gmaps4Rails
marker.geometry.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"))
#//adding layer to the map
@markersLayer.addFeatures([marker])

return marker

#//clear markers
clearMarkers: ->
@clearMarkersLayerIfExists()
@markersLayer = null
@boundsObject = new OpenLayers.Bounds()
clearMarkersLayerIfExists: ->

clearMarkersLayerIfExists: ->
@serviceObject.removeLayer(@markersLayer) if @markersLayer != null and @serviceObject.getLayer(@markersLayer.id) != null

extendBoundsWithMarkers: ->
console.log "here"
for marker in @markers
@boundsObject.extend(@createLatLng(marker.lat,marker.lng))
@boundsObject.extend(@createLatLng(marker.lat,marker.lng))

#////////////////////////////////////////////////////
#/////////////////// Clusterer //////////////////////
#////////////////////////////////////////////////////
#//too ugly to be considered valid :(

createClusterer: (markers_array)->
options =
options =
pointRadius: "${radius}"
fillColor: "#ffcc66"
fillOpacity: 0.8
Expand All @@ -136,26 +136,26 @@ class @Gmaps4RailsOpenlayers extends Gmaps4Rails
pix = 2
pix = Math.min(feature.attributes.count, 7) + 2 if feature.cluster
return pix

style = new OpenLayers.Style options, funcs

strategy = new OpenLayers.Strategy.Cluster()
clusters = new OpenLayers.Layer.Vector "Clusters",

clusters = new OpenLayers.Layer.Vector "Clusters",
strategies: [strategy]
styleMap: new OpenLayers.StyleMap
"default": style
"select":
"select":
fillColor: "#8aeeef"
strokeColor: "#32a8a9"

@clearMarkersLayerIfExists()
@serviceObject.addLayer(clusters)
clusters.addFeatures(markers_array)
return clusters

clusterize: ->

if @markers_conf.do_clustering == true
#//first clear the existing clusterer if any
if @markerClusterer != null
Expand All @@ -164,7 +164,7 @@ class @Gmaps4RailsOpenlayers extends Gmaps4Rails
for marker in @markers
markers_array.push(marker.serviceObject)
@markerClusterer = @createClusterer markers_array

clearClusterer: ->
@serviceObject.removeLayer @markerClusterer

Expand All @@ -175,13 +175,13 @@ class @Gmaps4RailsOpenlayers extends Gmaps4Rails
#// creates infowindows
createInfoWindow: (marker_container) ->
marker_container.serviceObject.infoWindow = marker_container.description if marker_container.description?

onPopupClose: (evt) ->
#// 'this' is the popup.
@markersControl.unselect @feature

onFeatureSelect: (evt) ->
feature = evt.feature
feature = evt.feature
popup = new OpenLayers.Popup.FramedCloud("featurePopup",
feature.geometry.getBounds().getCenterLonLat(),
new OpenLayers.Size(300,200),
Expand All @@ -204,15 +204,15 @@ class @Gmaps4RailsOpenlayers extends Gmaps4Rails
#////////////////////////////////////////////////////

create_polyline : (polyline) ->

if(@polylinesLayer == null)
@polylinesLayer = new OpenLayers.Layer.Vector("Polylines", null)
@serviceObject.addLayer(@polylinesLayer)
@polylinesLayer.events.register("featureselected", @polylinesLayer, @onFeatureSelect)
@polylinesLayer.events.register("featureunselected", @polylinesLayer, @onFeatureUnselect)
@polylinesControl = new OpenLayers.Control.DrawFeature(@polylinesLayer, OpenLayers.Handler.Path)
@serviceObject.addControl(@polylinesControl)

polyline_coordinates = []

for element in polyline
Expand All @@ -222,16 +222,16 @@ class @Gmaps4RailsOpenlayers extends Gmaps4Rails
strokeOpacity = element.strokeOpacity || @polylines_conf.strokeOpacity
strokeWeight = element.strokeWeight || @polylines_conf.strokeWeight
clickable = element.clickable || @polylines_conf.clickable
zIndex = element.zIndex || @polylines_conf.zIndex
zIndex = element.zIndex || @polylines_conf.zIndex

#add latlng if positions provided
if element.lat? && element.lng?
latlng = new OpenLayers.Geometry.Point(element.lng, element.lat)
polyline_coordinates.push(latlng)

line_points = new OpenLayers.Geometry.LineString(polyline_coordinates);
line_style = { strokeColor: strokeColor, strokeOpacity: strokeOpacity, strokeWidth: strokeWeight };

polyline = new OpenLayers.Feature.Vector(line_points, null, line_style);
polyline.geometry.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"))

Expand All @@ -240,22 +240,22 @@ class @Gmaps4RailsOpenlayers extends Gmaps4Rails
return polyline

updateBoundsWithPolylines: ()->

updateBoundsWithPolygons: ()->

updateBoundsWithCircles: ()->

# #////////////////////////////////////////////////////
# #/////////////////// Other methods //////////////////
# #////////////////////////////////////////////////////

fitBounds: ->
@serviceObject.zoomToExtent(@boundsObject, true)

centerMapOnUser: ->
@serviceObject.setCenter @userLocation

extendMapBounds :->

adaptMapToBounds: ->
@fitBounds()
4 changes: 2 additions & 2 deletions app/assets/javascripts/locale.js
Expand Up @@ -16,12 +16,12 @@ function setDirection(selector) {
for (var i=0; i<string.length; i++) {
var isRTL = checkRTL( string[i] );
var dir = isRTL ? 'RTL' : 'LTR';
if (dir === 'RTL') var finalDirection = 'RTL';
if (dir === 'RTL') var finalDirection = 'RTL';
if (finalDirection == 'RTL') dir = 'RTL';
}
if (dir=='LTR') {
selector.css("direction", "ltr");
} else {
selector.css("direction", "rtl");
}
};
};
52 changes: 26 additions & 26 deletions app/assets/javascripts/mainmap.js
@@ -1,5 +1,5 @@
// ================= functions =================

function data_link(){
var muni = $('#muni').is(':checked');
var bounds = map.getBounds();
Expand All @@ -18,7 +18,7 @@ function update_permalink(){
'&x=' + sprintf('%.05f',center.lng()) + '&m=' + $('#muni').is(":checked") + "&t=" +
typeid + '&l=' + $('#labels').is(":checked") + '&locale=' + I18n.locale;
if (type_filter && type_filter.length > 0) {
permalink = permalink + "&f=" + type_filter.join(",");
permalink = permalink + "&f=" + type_filter.join(",");
}
if (cats != undefined){
permalink = permalink + "&c=" + cats;
Expand All @@ -33,12 +33,12 @@ function update_url(object) {
// Force url updates before leaving page (does not work on refresh)
// better?: http://stackoverflow.com/questions/824349/modify-the-url-without-reloading-the-page/3354511#3354511
// $(window).unload(function () {
// if ($('#location_link').length > 0) {
// update_url('#location_link');
// } else if ($('#permalink').length > 0) {
// update_permalink();
// update_url('#permalink');
// }
// if ($('#location_link').length > 0) {
// update_url('#location_link');
// } else if ($('#permalink').length > 0) {
// update_permalink();
// update_url('#permalink');
// }
// });

function show_embed_html(object){
Expand All @@ -49,7 +49,7 @@ function show_embed_html(object){
var slashes = http.concat("//");
var host = slashes.concat(window.location.hostname);
if (type_filter && type_filter.length > 0) {
var fstr = "&f=" + type_filter.join(",");
var fstr = "&f=" + type_filter.join(",");
} else {
var fstr = "";
}
Expand All @@ -60,16 +60,16 @@ function show_embed_html(object){
}
$(object).text('<iframe src="' + host + '/locations/embed?z=' + zoom + '&y=' + sprintf('%.05f',center.lat()) +
'&x=' + sprintf('%.05f',center.lng()) + '&m=' + $('#muni').is(":checked") + "&t=" + typeid + fstr + cstr +
'&l=' + $('#labels').is(":checked") + '&locale=' + I18n.locale +
'" width=640 height=600 scrolling="no" style="border:none;"></iframe>').dialog({
closeText: "close",
modal: true,
'&l=' + $('#labels').is(":checked") + '&locale=' + I18n.locale +
'" width=640 height=600 scrolling="no" style="border:none;"></iframe>').dialog({
closeText: "close",
modal: true,
width: 'auto',
minHeight: '5em',
resizable: false,
draggable: false,
dialogClass: "dialog_grey"
});
});
}

function show_observation_html(object){
Expand All @@ -80,16 +80,16 @@ function show_observation_html(object){
var slashes = http.concat("//");
var host = slashes.concat(window.location.hostname);
$(object).text('<iframe src="' + host + '/locations/embed?z=' + zoom + '&y=' + sprintf('%.05f',center.lat()) +
'&x=' + sprintf('%.05f',center.lng()) + '&m=' + $('#muni').is(":checked") + "&t=" + typeid +
'" width=640 height=600 scrolling="no" style="border:none;"></iframe>').dialog({
closeText: "close",
modal: true,
'&x=' + sprintf('%.05f',center.lng()) + '&m=' + $('#muni').is(":checked") + "&t=" + typeid +
'" width=640 height=600 scrolling="no" style="border:none;"></iframe>').dialog({
closeText: "close",
modal: true,
width: 'auto',
minHeight: '5em',
resizable: true,
draggable: false,
dialogClass: "dialog_grey"
});
});
}

function update_display(force,force_zoom,force_bounds){
Expand Down Expand Up @@ -124,18 +124,18 @@ function show_map_controls() {
$('#hidden_controls').show();
$('#export_data').show();
$('#invasive_span').show();
resize_map();
resize_map();
}

function resize_map() {
if(document.getElementById('searchbar') == undefined) return;
var headerHeight = document.getElementById('searchbar').offsetHeight + document.getElementById('menubar').offsetHeight + document.getElementById('logobar').offsetHeight;
if (document.getElementById('mainmap_container') != undefined) {
document.getElementById('mainmap_container').style.top = headerHeight + 'px';
}
if (document.getElementById('sidebar_container') != undefined) {
document.getElementById('sidebar_container').style.top = headerHeight + 'px';
}
if (document.getElementById('mainmap_container') != undefined) {
document.getElementById('mainmap_container').style.top = headerHeight + 'px';
}
if (document.getElementById('sidebar_container') != undefined) {
document.getElementById('sidebar_container').style.top = headerHeight + 'px';
}
}

function update_display_embedded(force, force_zoom, muni) {
Expand Down

0 comments on commit cf447c6

Please sign in to comment.