From c9437fc2e96f415e38c1e72fa10337769381f289 Mon Sep 17 00:00:00 2001 From: Marc Florisson Date: Wed, 22 Jan 2014 17:41:04 +0100 Subject: merge branch validation --- app/maps/access_link_map.rb | 6 +-- app/maps/access_point_map.rb | 4 +- app/maps/connection_link_map.rb | 4 +- app/maps/design/access_link_style_map.rb | 43 +++++++++++++++++ app/maps/design/access_points_style_map.rb | 58 ++++++++++++++++++++++ app/maps/design/connection_link_style_map.rb | 43 +++++++++++++++++ app/maps/design/edit_access_point_style_map.rb | 46 ++++++++++++++++++ app/maps/design/edit_stop_area_style_map.rb | 46 ++++++++++++++++++ app/maps/design/generic_style_map.rb | 5 ++ app/maps/design/journey_pattern_style_map.rb | 48 ++++++++++++++++++ app/maps/design/line_style_map.rb | 28 +++++++++++ app/maps/design/route_style_map.rb | 48 ++++++++++++++++++ app/maps/design/stop_areas_style_map.rb | 59 +++++++++++++++++++++++ app/maps/group_of_line_map.rb | 2 +- app/maps/journey_pattern_map.rb | 2 +- app/maps/line_map.rb | 4 +- app/maps/network_map.rb | 2 +- app/maps/route_map.rb | 2 +- app/maps/stop_area_map.rb | 8 +-- app/maps/style_map/access_link_style_map.rb | 43 ----------------- app/maps/style_map/access_points_style_map.rb | 58 ---------------------- app/maps/style_map/connection_link_style_map.rb | 43 ----------------- app/maps/style_map/edit_access_point_style_map.rb | 46 ------------------ app/maps/style_map/edit_stop_area_style_map.rb | 46 ------------------ app/maps/style_map/generic_style_map.rb | 5 -- app/maps/style_map/journey_pattern_style_map.rb | 48 ------------------ app/maps/style_map/line_style_map.rb | 28 ----------- app/maps/style_map/route_style_map.rb | 48 ------------------ app/maps/style_map/stop_areas_style_map.rb | 59 ----------------------- 29 files changed, 441 insertions(+), 441 deletions(-) create mode 100644 app/maps/design/access_link_style_map.rb create mode 100644 app/maps/design/access_points_style_map.rb create mode 100644 app/maps/design/connection_link_style_map.rb create mode 100644 app/maps/design/edit_access_point_style_map.rb create mode 100644 app/maps/design/edit_stop_area_style_map.rb create mode 100644 app/maps/design/generic_style_map.rb create mode 100644 app/maps/design/journey_pattern_style_map.rb create mode 100644 app/maps/design/line_style_map.rb create mode 100644 app/maps/design/route_style_map.rb create mode 100644 app/maps/design/stop_areas_style_map.rb delete mode 100644 app/maps/style_map/access_link_style_map.rb delete mode 100644 app/maps/style_map/access_points_style_map.rb delete mode 100644 app/maps/style_map/connection_link_style_map.rb delete mode 100644 app/maps/style_map/edit_access_point_style_map.rb delete mode 100644 app/maps/style_map/edit_stop_area_style_map.rb delete mode 100644 app/maps/style_map/generic_style_map.rb delete mode 100644 app/maps/style_map/journey_pattern_style_map.rb delete mode 100644 app/maps/style_map/line_style_map.rb delete mode 100644 app/maps/style_map/route_style_map.rb delete mode 100644 app/maps/style_map/stop_areas_style_map.rb (limited to 'app/maps') diff --git a/app/maps/access_link_map.rb b/app/maps/access_link_map.rb index fcca1250f..35873a9b1 100644 --- a/app/maps/access_link_map.rb +++ b/app/maps/access_link_map.rb @@ -9,11 +9,11 @@ class AccessLinkMap < ApplicationMap end def customize_map(map, page) - page.assign "access_points_layer", kml_layer([access_link.referential, access_link.access_point], :styleMap => StyleMap::AccessPointsStyleMap.new(helpers).style_map) + page.assign "access_points_layer", kml_layer([access_link.referential, access_link.access_point], :styleMap => Design::AccessPointsStyleMap.new(helpers).style_map) page << map.add_layer(:access_points_layer) - page.assign "stop_areas_layer", kml_layer([access_link.referential, access_link.stop_area], :styleMap => StyleMap::StopAreasStyleMap.new(helpers).style_map) + page.assign "stop_areas_layer", kml_layer([access_link.referential, access_link.stop_area], :styleMap => Design::StopAreasStyleMap.new(helpers).style_map) page << map.add_layer(:stop_areas_layer) - page << map.add_layer( kml_layer([access_link.referential, access_link.access_point, access_link], :styleMap => StyleMap::AccessLinkStyleMap.new(helpers).style_map)) + page << map.add_layer( kml_layer([access_link.referential, access_link.access_point, access_link], :styleMap => Design::AccessLinkStyleMap.new(helpers).style_map)) page << map.add_control( hover_control_display_name([:access_points_layer,:stop_areas_layer]) ) page << map.zoom_to_extent(bounds.to_google.to_openlayers) if bounds end diff --git a/app/maps/access_point_map.rb b/app/maps/access_point_map.rb index c1fbd2a16..f31dcf5a3 100644 --- a/app/maps/access_point_map.rb +++ b/app/maps/access_point_map.rb @@ -10,9 +10,9 @@ class AccessPointMap < ApplicationMap end def customize_map(map, page) - page.assign "parent_layer", kml_layer(access_point.stop_area, :style_map => StyleMap::StopAreasStyleMap.new(helpers).style_map) + page.assign "parent_layer", kml_layer(access_point.stop_area, :style_map => Design::StopAreasStyleMap.new(helpers).style_map) page << map.add_layer(:parent_layer) - page.assign "edit_access_point_layer", kml_layer(access_point, { :default => editable? }, :style_map => StyleMap::EditAccessPointStyleMap.new(helpers).style_map) + page.assign "edit_access_point_layer", kml_layer(access_point, { :default => editable? }, :style_map => Design::EditAccessPointStyleMap.new(helpers).style_map) page << map.add_layer(:edit_access_point_layer) diff --git a/app/maps/connection_link_map.rb b/app/maps/connection_link_map.rb index 9318ec90f..82050c4da 100644 --- a/app/maps/connection_link_map.rb +++ b/app/maps/connection_link_map.rb @@ -9,9 +9,9 @@ class ConnectionLinkMap < ApplicationMap end def customize_map(map, page) - page.assign "stop_areas_layer", kml_layer([connection_link.referential, connection_link, :stop_areas], :styleMap => StyleMap::StopAreasStyleMap.new(helpers).style_map) + page.assign "stop_areas_layer", kml_layer([connection_link.referential, connection_link, :stop_areas], :styleMap => Design::StopAreasStyleMap.new(helpers).style_map) page << map.add_layer(:stop_areas_layer) - page << map.add_layer( kml_layer([connection_link.referential, connection_link], :styleMap => StyleMap::ConnectionLinkStyleMap.new(helpers).style_map)) + page << map.add_layer( kml_layer([connection_link.referential, connection_link], :styleMap => Design::ConnectionLinkStyleMap.new(helpers).style_map)) page << map.add_control( hover_control_display_name(:stop_areas_layer) ) page << map.zoom_to_extent(bounds.to_google.to_openlayers) if bounds end diff --git a/app/maps/design/access_link_style_map.rb b/app/maps/design/access_link_style_map.rb new file mode 100644 index 000000000..742f7ed0e --- /dev/null +++ b/app/maps/design/access_link_style_map.rb @@ -0,0 +1,43 @@ +class Design::AccessLinkStyleMap < Design::GenericStyleMap + attr_accessor :style + + def initialize(helpers,options = {}) + @helpers= helpers + @style = options[:style].present? ? default_style.merge(options[:style]) : default_style + end + + def default_style + { + :fontColor => "black", + :fontSize => "11px", + :fontWeight => "bold", + :labelAlign => "ct", + :labelXOffset => 0, + :labelYOffset => -10, + :strokeColor => "#000000", + :strokeOpacity => 1, + :strokeWidth => 3, + :strokeLineCap => "round", + :strokeDashstyle => "solid", + :externalGraphic => @helpers.assets_path_patch( "map/${positionType}.png"), + :graphicWidth => 36, + :graphicHeight => 36, + :graphicOpacity => 1, + :graphicXOffset => -18, + :graphicYOffset => -18, + :display => true + } + end + + def context + context = { + :positionType => :" function(feature) { if (feature.attributes.departure != undefined) { return 'departure'; } else { return 'arrival'; }} " + } + end + + def style_map + OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context})) + end + +end + diff --git a/app/maps/design/access_points_style_map.rb b/app/maps/design/access_points_style_map.rb new file mode 100644 index 000000000..f7740006d --- /dev/null +++ b/app/maps/design/access_points_style_map.rb @@ -0,0 +1,58 @@ +class Design::AccessPointsStyleMap < Design::GenericStyleMap + attr_accessor :style, :context, :temporary + + def default_style + raise "Helpers nil" if @helpers.nil? + {:label => "${label}", + :fontColor => "black", + :fontSize => "11px", + :fontWeight => "bold", + :labelAlign => "ct", + :labelXOffset => 0, + :labelYOffset => -20, + :pointRadius => 1, + :externalGraphic => @helpers.assets_path_patch( "map/access_${accessType}.png"), + :graphicWidth => 25, + :graphicHeight => 25, + :graphicOpacity => 1, + :graphicXOffset => -12.5, + :graphicYOffset => -12.5 } + end + def temporary_style + raise "Helpers nil" if @helpers.nil? + {:label => "${label}", + :fontColor => "darkblue", + :fontSize => "12px", + :fontWeight => "bold", + :labelAlign => "ct", + :labelXOffset => 0, + :labelYOffset => -20, + :pointRadius => 1, + :externalGraphic => @helpers.assets_path_patch( "map/access_${accessType}.png"), + :graphicWidth => 25, + :graphicHeight => 25, + :graphicOpacity => 1, + :graphicXOffset => -12.5, + :graphicYOffset => -12.5 } + end + + def initialize(helpers,options = {}) + @helpers= helpers + @style = options[:style].present? ? default_style.merge(options[:style]) : default_style + @temporary = options[:style].present? ? temporary_style.merge(options[:style]) : temporary_style + end + + + def context + { + :label => :" function(feature) {if(feature.layer.map.getZoom() > 13) { return feature.attributes.name;} else {return '';}} ", + :accessType => :" function(feature) { return feature.attributes.access_point_type.toLowerCase();} " + } + end + + def style_map + OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context}), + :temporary => OpenLayers::Style.new(temporary, { :context => context}) ) + end + +end diff --git a/app/maps/design/connection_link_style_map.rb b/app/maps/design/connection_link_style_map.rb new file mode 100644 index 000000000..88eeb9457 --- /dev/null +++ b/app/maps/design/connection_link_style_map.rb @@ -0,0 +1,43 @@ +class Design::ConnectionLinkStyleMap < Design::GenericStyleMap + attr_accessor :style + + def initialize(helpers,options = {}) + @helpers= helpers + @style = options[:style].present? ? default_style.merge(options[:style]) : default_style + end + + def default_style + { + :fontColor => "black", + :fontSize => "11px", + :fontWeight => "bold", + :labelAlign => "ct", + :labelXOffset => 0, + :labelYOffset => -15, + :strokeColor => "#000000", + :strokeOpacity => 1, + :strokeWidth => 3, + :strokeLineCap => "round", + :strokeDashstyle => "solid", + :externalGraphic => @helpers.assets_path_patch( "map/${positionType}.png"), + :graphicWidth => 36, + :graphicHeight => 36, + :graphicOpacity => 1, + :graphicXOffset => -18, + :graphicYOffset => -18, + :display => true + } + end + + def context + context = { + :positionType => :" function(feature) { if (feature.attributes.departure != undefined) { return 'departure'; } else { return 'arrival'; }} " + } + end + + def style_map + OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context})) + end + +end + diff --git a/app/maps/design/edit_access_point_style_map.rb b/app/maps/design/edit_access_point_style_map.rb new file mode 100644 index 000000000..48c293470 --- /dev/null +++ b/app/maps/design/edit_access_point_style_map.rb @@ -0,0 +1,46 @@ +class Design::EditAccessPointStyleMap < Design::GenericStyleMap + attr_accessor :style + + def default_style + { :fontColor => "black", + :fontSize => "11px", + :fontWeight => "bold", + :labelAlign => "ct", + :labelXOffset => 0, + :labelYOffset => -15, + :pointRadius => 4, + :fillColor => "white", + :fillOpacity => 1, + :strokeColor => "black", + :strokeOpacity => 1, + :strokeWidth => 2 } + end + + def select_style + { :fontColor => "black", + :fontSize => "11px", + :fontWeight => "bold", + :pointRadius => 4, + :fillColor => "#86b41d", + :fillOpacity => 1, + :strokeColor => "black", + :strokeOpacity => 1, + :strokeWidth => 2 } + end + + def initialize(helpers, options = {}) + @helpers= helpers + @style = options[:style].present? ? default_style.merge(options[:style]) : default_style + end + + def context + { + :label => :" function(feature) {if(feature.layer.map.getZoom() > 13) { return feature.attributes.name;} else {return '';}} " + } + end + + def style_map + OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context}), :select => OpenLayers::Style.new(style.merge( select_style), { :context => context})) + end + +end diff --git a/app/maps/design/edit_stop_area_style_map.rb b/app/maps/design/edit_stop_area_style_map.rb new file mode 100644 index 000000000..2431f8a0f --- /dev/null +++ b/app/maps/design/edit_stop_area_style_map.rb @@ -0,0 +1,46 @@ +class Design::EditStopAreaStyleMap < Design::GenericStyleMap + attr_accessor :style + + def default_style + { :fontColor => "black", + :fontSize => "11px", + :fontWeight => "bold", + :labelAlign => "ct", + :labelXOffset => 0, + :labelYOffset => -15, + :pointRadius => 4, + :fillColor => "white", + :fillOpacity => 1, + :strokeColor => "black", + :strokeOpacity => 1, + :strokeWidth => 2 } + end + + def select_style + { :fontColor => "black", + :fontSize => "11px", + :fontWeight => "bold", + :pointRadius => 4, + :fillColor => "#86b41d", + :fillOpacity => 1, + :strokeColor => "black", + :strokeOpacity => 1, + :strokeWidth => 2 } + end + + def initialize(helpers, options = {}) + @helpers= helpers + @style = options[:style].present? ? default_style.merge(options[:style]) : default_style + end + + def context + { + :label => :" function(feature) {if(feature.layer.map.getZoom() > 13) { return feature.attributes.name;} else {return '';}} " + } + end + + def style_map + OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context}), :select => OpenLayers::Style.new(style.merge( select_style), { :context => context})) + end + +end diff --git a/app/maps/design/generic_style_map.rb b/app/maps/design/generic_style_map.rb new file mode 100644 index 000000000..0056cc964 --- /dev/null +++ b/app/maps/design/generic_style_map.rb @@ -0,0 +1,5 @@ +class Design::GenericStyleMap + include MapLayers + include MapLayers::ViewHelpers + +end diff --git a/app/maps/design/journey_pattern_style_map.rb b/app/maps/design/journey_pattern_style_map.rb new file mode 100644 index 000000000..1b5766f81 --- /dev/null +++ b/app/maps/design/journey_pattern_style_map.rb @@ -0,0 +1,48 @@ +class Design::JourneyPatternStyleMap < Design::GenericStyleMap + attr_accessor :style + + def initialize(helpers, options = {}) + @helpers= helpers + @style = options[:style].present? ? default_style.merge(options[:style]) : default_style + end + + def select_style + default_style.merge :externalGraphic => @helpers.assets_path_patch( "icons/stop_area_hover.png") + end + def default_style + { + :label => "${label}", + :fontColor => "black", + :fontSize => "11px", + :fontWeight => "bold", + :labelAlign => "ct", + :labelXOffset => 0, + :labelYOffset => -15, + :strokeColor => "#000000", + :strokeOpacity => 1, + :strokeWidth => 3, + :strokeLineCap => "round", + :strokeDashstyle => "solid", + :externalGraphic => @helpers.assets_path_patch( "icons/${positionType}.png"), + :graphicWidth => 12, + :graphicHeight => 12, + :graphicOpacity => 1, + :graphicXOffset => -6, + :graphicYOffset => -6, + :display => true + } + end + + def context + context = { + :label => :" function(feature) {if(feature.layer.map.getZoom() > 13) { return feature.attributes.name;} else {return '';}} ", + :positionType => :" function(feature) { if (feature.attributes.iconCode != undefined) {return feature.attributes.iconCode;} else { return '';} } " + } + end + + def style_map + OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context}), :select => OpenLayers::Style.new(style.merge( select_style), { :context => context})) + end + +end + diff --git a/app/maps/design/line_style_map.rb b/app/maps/design/line_style_map.rb new file mode 100644 index 000000000..e1d76078c --- /dev/null +++ b/app/maps/design/line_style_map.rb @@ -0,0 +1,28 @@ +class Design::LineStyleMap < Design::GenericStyleMap + attr_accessor :style, :line_priority, :line_color + + def initialize(helpers,options = {}) + @helpers= helpers + @line_color = options[:line_color] + @style = options[:style].present? ? default_style.merge(options[:style]) : default_style + end + + def stroke_width + stroke_width = 3 + end + + def default_style + style = { + :strokeColor => line_color || "#000000", + :strokeOpacity => 1, + :strokeWidth => stroke_width, + :strokeLineCap => "round", + :strokeDashstyle => "solid", + } + end + + def style_map + OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style)) + end + +end diff --git a/app/maps/design/route_style_map.rb b/app/maps/design/route_style_map.rb new file mode 100644 index 000000000..a8042c527 --- /dev/null +++ b/app/maps/design/route_style_map.rb @@ -0,0 +1,48 @@ +class Design::RouteStyleMap < Design::GenericStyleMap + attr_accessor :style + + def initialize(helpers,options = {}) + @helpers= helpers + @style = options[:style].present? ? default_style.merge(options[:style]) : default_style + end + + def select_style + default_style.merge :externalGraphic => @helpers.assets_path_patch( "icons/stop_area_hover.png") + end + def default_style + { + :label => "${label}", + :fontColor => "black", + :fontSize => "11px", + :fontWeight => "bold", + :labelAlign => "ct", + :labelXOffset => 0, + :labelYOffset => -15, + :strokeColor => "#000000", + :strokeOpacity => 1, + :strokeWidth => 3, + :strokeLineCap => "round", + :strokeDashstyle => "solid", + :externalGraphic => @helpers.assets_path_patch( "icons/${positionType}.png"), + :graphicWidth => 12, + :graphicHeight => 12, + :graphicOpacity => 1, + :graphicXOffset => -6, + :graphicYOffset => -6, + :display => true + } + end + + def context + context = { + :label => :" function(feature) {if(feature.layer.map.getZoom() > 13) { return feature.attributes.name;} else {return '';}} ", + :positionType => :" function(feature) { if (feature.attributes.departure != undefined) { return 'stop_area_green'; } else if (feature.attributes.arrival != undefined) { return 'stop_area_red'; } else { return 'stop_area_black'; }} " + } + end + + def style_map + OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context}), :select => OpenLayers::Style.new(style.merge( select_style), { :context => context})) + end + +end + diff --git a/app/maps/design/stop_areas_style_map.rb b/app/maps/design/stop_areas_style_map.rb new file mode 100644 index 000000000..f45c423e2 --- /dev/null +++ b/app/maps/design/stop_areas_style_map.rb @@ -0,0 +1,59 @@ +class Design::StopAreasStyleMap < Design::GenericStyleMap + attr_accessor :style, :context, :temporary + + def default_style + raise "Helpers nil" if @helpers.nil? + {:label => "${label}", + :fontColor => "black", + :fontSize => "11px", + :fontWeight => "bold", + :labelAlign => "ct", + :labelXOffset => 0, + :labelYOffset => -20, + :pointRadius => 1, + :externalGraphic => @helpers.assets_path_patch( "map/${areaType}.png"), + :graphicWidth => 25, + :graphicHeight => 25, + :graphicOpacity => 1, + :graphicXOffset => -12.5, + :graphicYOffset => -12.5 } + end + def temporary_style + raise "Helpers nil" if @helpers.nil? + {:label => "${label}", + :fontColor => "darkblue", + :fontSize => "12px", + :fontWeight => "bold", + :labelAlign => "ct", + :labelXOffset => 0, + :labelYOffset => -20, + :pointRadius => 1, + :externalGraphic => @helpers.assets_path_patch( "map/${areaType}.png"), + :graphicWidth => 25, + :graphicHeight => 25, + :graphicOpacity => 1, + :graphicXOffset => -12.5, + :graphicYOffset => -12.5 } + end + + + def initialize(helpers,options = {}) + @helpers= helpers + @style = options[:style].present? ? default_style.merge(options[:style]) : default_style + @temporary = options[:style].present? ? temporary_style.merge(options[:style]) : temporary_style + end + + + def context + { + :label => :" function(feature) {if(feature.layer.map.getZoom() > 13) { return feature.attributes.name;} else {return '';}} ", + :areaType => :" function(feature) { return feature.attributes.stop_area_type.toLowerCase();} " + } + end + + def style_map + OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context}), + :temporary => OpenLayers::Style.new(temporary, { :context => context}) ) + end + +end diff --git a/app/maps/group_of_line_map.rb b/app/maps/group_of_line_map.rb index df1708597..b9c174cb9 100644 --- a/app/maps/group_of_line_map.rb +++ b/app/maps/group_of_line_map.rb @@ -8,7 +8,7 @@ class GroupOfLineMap < ApplicationMap end def customize_map(map, page) - page.assign "stop_areas_layer", kml_layer([group_of_line.referential, group_of_line], :styleMap => StyleMap::StopAreasStyleMap.new(helpers).style_map) + page.assign "stop_areas_layer", kml_layer([group_of_line.referential, group_of_line], :styleMap => Design::StopAreasStyleMap.new(helpers).style_map) page << map.add_layer(:stop_areas_layer) page << map.add_control( hover_control_display_name(:stop_areas_layer) ) diff --git a/app/maps/journey_pattern_map.rb b/app/maps/journey_pattern_map.rb index 075019c79..e1cf54a6a 100644 --- a/app/maps/journey_pattern_map.rb +++ b/app/maps/journey_pattern_map.rb @@ -8,7 +8,7 @@ class JourneyPatternMap < ApplicationMap end def customize_map(map, page) - layer = kml_layer([journey_pattern.referential, journey_pattern.route.line, journey_pattern.route, journey_pattern], :styleMap => StyleMap::JourneyPatternStyleMap.new(helpers).style_map) + layer = kml_layer([journey_pattern.referential, journey_pattern.route.line, journey_pattern.route, journey_pattern], :styleMap => Design::JourneyPatternStyleMap.new(helpers).style_map) page.assign "journeyPatternLayer", layer selectFeature = OpenLayers::Control::SelectFeature.new( :journeyPatternLayer) diff --git a/app/maps/line_map.rb b/app/maps/line_map.rb index 3bc229555..8d79bfe0b 100644 --- a/app/maps/line_map.rb +++ b/app/maps/line_map.rb @@ -9,8 +9,8 @@ class LineMap < ApplicationMap end def customize_map(map, page) - page << map.add_layer(kml_layer(line, :styleMap => StyleMap::LineStyleMap.new( :style => line_style).style_map)) - page.assign "stop_areas_layer", kml_layer([line.referential, line], :styleMap => StyleMap::StopAreasStyleMap.new(helpers).style_map) + page << map.add_layer(kml_layer(line, :styleMap => Design::LineStyleMap.new( :style => line_style).style_map)) + page.assign "stop_areas_layer", kml_layer([line.referential, line], :styleMap => Design::StopAreasStyleMap.new(helpers).style_map) page << map.add_layer(:stop_areas_layer) diff --git a/app/maps/network_map.rb b/app/maps/network_map.rb index ec23f62c9..109e390d0 100644 --- a/app/maps/network_map.rb +++ b/app/maps/network_map.rb @@ -8,7 +8,7 @@ class NetworkMap < ApplicationMap end def customize_map(map, page) - page.assign "stop_areas_layer", kml_layer([network.referential, network], :styleMap => StyleMap::StopAreasStyleMap.new(helpers).style_map) + page.assign "stop_areas_layer", kml_layer([network.referential, network], :styleMap => Design::StopAreasStyleMap.new(helpers).style_map) page << map.add_layer(:stop_areas_layer) page << map.add_control( hover_control_display_name(:stop_areas_layer) ) diff --git a/app/maps/route_map.rb b/app/maps/route_map.rb index fc1a7d93e..5acb1ad76 100644 --- a/app/maps/route_map.rb +++ b/app/maps/route_map.rb @@ -8,7 +8,7 @@ class RouteMap < ApplicationMap end def customize_map(map, page) - layer = kml_layer([route.referential, route.line, route], :styleMap => StyleMap::RouteStyleMap.new(helpers).style_map) + layer = kml_layer([route.referential, route.line, route], :styleMap => Design::RouteStyleMap.new(helpers).style_map) page.assign "routeLayer", layer selectFeature = OpenLayers::Control::SelectFeature.new( :routeLayer) diff --git a/app/maps/stop_area_map.rb b/app/maps/stop_area_map.rb index b2e04779a..6c3dd5feb 100644 --- a/app/maps/stop_area_map.rb +++ b/app/maps/stop_area_map.rb @@ -10,21 +10,21 @@ class StopAreaMap < ApplicationMap end def customize_map(map, page) - page.assign "edit_stop_area_layer", kml_layer(stop_area, { :default => editable? }, :style_map => StyleMap::EditStopAreaStyleMap.new(helpers).style_map) + page.assign "edit_stop_area_layer", kml_layer(stop_area, { :default => editable? }, :style_map => Design::EditStopAreaStyleMap.new(helpers).style_map) page << map.add_layer(:edit_stop_area_layer) if stop_area.children.present? - page.assign "children_layer", kml_layer(stop_area, { :children => true }, :style_map => StyleMap::StopAreasStyleMap.new(helpers).style_map) + page.assign "children_layer", kml_layer(stop_area, { :children => true }, :style_map => Design::StopAreasStyleMap.new(helpers).style_map) page << map.add_layer(:children_layer) end if stop_area.routing_stops.present? - page.assign "routing_layer", kml_layer(stop_area, { :routing => true }, :style_map => StyleMap::StopAreasStyleMap.new(helpers).style_map) + page.assign "routing_layer", kml_layer(stop_area, { :routing => true }, :style_map => Design::StopAreasStyleMap.new(helpers).style_map) page << map.add_layer(:routing_layer) page << map.add_control( hover_control_display_name(:routing_layer) ) page << map.zoom_to_extent(bounds.to_google.to_openlayers) if bounds else - page.assign "edit_stop_area_layer", kml_layer(stop_area, { :default => editable? }, :style_map => StyleMap::EditStopAreaStyleMap.new(helpers).style_map) + page.assign "edit_stop_area_layer", kml_layer(stop_area, { :default => editable? }, :style_map => Design::EditStopAreaStyleMap.new(helpers).style_map) page << map.add_layer(:edit_stop_area_layer) if editable? diff --git a/app/maps/style_map/access_link_style_map.rb b/app/maps/style_map/access_link_style_map.rb deleted file mode 100644 index 07ef5952b..000000000 --- a/app/maps/style_map/access_link_style_map.rb +++ /dev/null @@ -1,43 +0,0 @@ -class StyleMap::AccessLinkStyleMap < StyleMap::GenericStyleMap - attr_accessor :style - - def initialize(helpers,options = {}) - @helpers= helpers - @style = options[:style].present? ? default_style.merge(options[:style]) : default_style - end - - def default_style - { - :fontColor => "black", - :fontSize => "11px", - :fontWeight => "bold", - :labelAlign => "ct", - :labelXOffset => 0, - :labelYOffset => -10, - :strokeColor => "#000000", - :strokeOpacity => 1, - :strokeWidth => 3, - :strokeLineCap => "round", - :strokeDashstyle => "solid", - :externalGraphic => @helpers.assets_path_patch( "map/${positionType}.png"), - :graphicWidth => 36, - :graphicHeight => 36, - :graphicOpacity => 1, - :graphicXOffset => -18, - :graphicYOffset => -18, - :display => true - } - end - - def context - context = { - :positionType => :" function(feature) { if (feature.attributes.departure != undefined) { return 'departure'; } else { return 'arrival'; }} " - } - end - - def style_map - OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context})) - end - -end - diff --git a/app/maps/style_map/access_points_style_map.rb b/app/maps/style_map/access_points_style_map.rb deleted file mode 100644 index 57cf8dfb3..000000000 --- a/app/maps/style_map/access_points_style_map.rb +++ /dev/null @@ -1,58 +0,0 @@ -class StyleMap::AccessPointsStyleMap < StyleMap::GenericStyleMap - attr_accessor :style, :context, :temporary - - def default_style - raise "Helpers nil" if @helpers.nil? - {:label => "${label}", - :fontColor => "black", - :fontSize => "11px", - :fontWeight => "bold", - :labelAlign => "ct", - :labelXOffset => 0, - :labelYOffset => -20, - :pointRadius => 1, - :externalGraphic => @helpers.assets_path_patch( "map/access_${accessType}.png"), - :graphicWidth => 25, - :graphicHeight => 25, - :graphicOpacity => 1, - :graphicXOffset => -12.5, - :graphicYOffset => -12.5 } - end - def temporary_style - raise "Helpers nil" if @helpers.nil? - {:label => "${label}", - :fontColor => "darkblue", - :fontSize => "12px", - :fontWeight => "bold", - :labelAlign => "ct", - :labelXOffset => 0, - :labelYOffset => -20, - :pointRadius => 1, - :externalGraphic => @helpers.assets_path_patch( "map/access_${accessType}.png"), - :graphicWidth => 25, - :graphicHeight => 25, - :graphicOpacity => 1, - :graphicXOffset => -12.5, - :graphicYOffset => -12.5 } - end - - def initialize(helpers,options = {}) - @helpers= helpers - @style = options[:style].present? ? default_style.merge(options[:style]) : default_style - @temporary = options[:style].present? ? temporary_style.merge(options[:style]) : temporary_style - end - - - def context - { - :label => :" function(feature) {if(feature.layer.map.getZoom() > 13) { return feature.attributes.name;} else {return '';}} ", - :accessType => :" function(feature) { return feature.attributes.access_point_type.toLowerCase();} " - } - end - - def style_map - OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context}), - :temporary => OpenLayers::Style.new(temporary, { :context => context}) ) - end - -end diff --git a/app/maps/style_map/connection_link_style_map.rb b/app/maps/style_map/connection_link_style_map.rb deleted file mode 100644 index 99393fc08..000000000 --- a/app/maps/style_map/connection_link_style_map.rb +++ /dev/null @@ -1,43 +0,0 @@ -class StyleMap::ConnectionLinkStyleMap < StyleMap::GenericStyleMap - attr_accessor :style - - def initialize(helpers,options = {}) - @helpers= helpers - @style = options[:style].present? ? default_style.merge(options[:style]) : default_style - end - - def default_style - { - :fontColor => "black", - :fontSize => "11px", - :fontWeight => "bold", - :labelAlign => "ct", - :labelXOffset => 0, - :labelYOffset => -15, - :strokeColor => "#000000", - :strokeOpacity => 1, - :strokeWidth => 3, - :strokeLineCap => "round", - :strokeDashstyle => "solid", - :externalGraphic => @helpers.assets_path_patch( "map/${positionType}.png"), - :graphicWidth => 36, - :graphicHeight => 36, - :graphicOpacity => 1, - :graphicXOffset => -18, - :graphicYOffset => -18, - :display => true - } - end - - def context - context = { - :positionType => :" function(feature) { if (feature.attributes.departure != undefined) { return 'departure'; } else { return 'arrival'; }} " - } - end - - def style_map - OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context})) - end - -end - diff --git a/app/maps/style_map/edit_access_point_style_map.rb b/app/maps/style_map/edit_access_point_style_map.rb deleted file mode 100644 index 83f9298e8..000000000 --- a/app/maps/style_map/edit_access_point_style_map.rb +++ /dev/null @@ -1,46 +0,0 @@ -class StyleMap::EditAccessPointStyleMap < StyleMap::GenericStyleMap - attr_accessor :style - - def default_style - { :fontColor => "black", - :fontSize => "11px", - :fontWeight => "bold", - :labelAlign => "ct", - :labelXOffset => 0, - :labelYOffset => -15, - :pointRadius => 4, - :fillColor => "white", - :fillOpacity => 1, - :strokeColor => "black", - :strokeOpacity => 1, - :strokeWidth => 2 } - end - - def select_style - { :fontColor => "black", - :fontSize => "11px", - :fontWeight => "bold", - :pointRadius => 4, - :fillColor => "#86b41d", - :fillOpacity => 1, - :strokeColor => "black", - :strokeOpacity => 1, - :strokeWidth => 2 } - end - - def initialize(helpers, options = {}) - @helpers= helpers - @style = options[:style].present? ? default_style.merge(options[:style]) : default_style - end - - def context - { - :label => :" function(feature) {if(feature.layer.map.getZoom() > 13) { return feature.attributes.name;} else {return '';}} " - } - end - - def style_map - OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context}), :select => OpenLayers::Style.new(style.merge( select_style), { :context => context})) - end - -end diff --git a/app/maps/style_map/edit_stop_area_style_map.rb b/app/maps/style_map/edit_stop_area_style_map.rb deleted file mode 100644 index 38f18f04a..000000000 --- a/app/maps/style_map/edit_stop_area_style_map.rb +++ /dev/null @@ -1,46 +0,0 @@ -class StyleMap::EditStopAreaStyleMap < StyleMap::GenericStyleMap - attr_accessor :style - - def default_style - { :fontColor => "black", - :fontSize => "11px", - :fontWeight => "bold", - :labelAlign => "ct", - :labelXOffset => 0, - :labelYOffset => -15, - :pointRadius => 4, - :fillColor => "white", - :fillOpacity => 1, - :strokeColor => "black", - :strokeOpacity => 1, - :strokeWidth => 2 } - end - - def select_style - { :fontColor => "black", - :fontSize => "11px", - :fontWeight => "bold", - :pointRadius => 4, - :fillColor => "#86b41d", - :fillOpacity => 1, - :strokeColor => "black", - :strokeOpacity => 1, - :strokeWidth => 2 } - end - - def initialize(helpers, options = {}) - @helpers= helpers - @style = options[:style].present? ? default_style.merge(options[:style]) : default_style - end - - def context - { - :label => :" function(feature) {if(feature.layer.map.getZoom() > 13) { return feature.attributes.name;} else {return '';}} " - } - end - - def style_map - OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context}), :select => OpenLayers::Style.new(style.merge( select_style), { :context => context})) - end - -end diff --git a/app/maps/style_map/generic_style_map.rb b/app/maps/style_map/generic_style_map.rb deleted file mode 100644 index c905cd00d..000000000 --- a/app/maps/style_map/generic_style_map.rb +++ /dev/null @@ -1,5 +0,0 @@ -class StyleMap::GenericStyleMap - include MapLayers - include MapLayers::ViewHelpers - -end diff --git a/app/maps/style_map/journey_pattern_style_map.rb b/app/maps/style_map/journey_pattern_style_map.rb deleted file mode 100644 index 5a06b5c18..000000000 --- a/app/maps/style_map/journey_pattern_style_map.rb +++ /dev/null @@ -1,48 +0,0 @@ -class StyleMap::JourneyPatternStyleMap < StyleMap::GenericStyleMap - attr_accessor :style - - def initialize(helpers, options = {}) - @helpers= helpers - @style = options[:style].present? ? default_style.merge(options[:style]) : default_style - end - - def select_style - default_style.merge :externalGraphic => @helpers.assets_path_patch( "icons/stop_area_hover.png") - end - def default_style - { - :label => "${label}", - :fontColor => "black", - :fontSize => "11px", - :fontWeight => "bold", - :labelAlign => "ct", - :labelXOffset => 0, - :labelYOffset => -15, - :strokeColor => "#000000", - :strokeOpacity => 1, - :strokeWidth => 3, - :strokeLineCap => "round", - :strokeDashstyle => "solid", - :externalGraphic => @helpers.assets_path_patch( "icons/${positionType}.png"), - :graphicWidth => 12, - :graphicHeight => 12, - :graphicOpacity => 1, - :graphicXOffset => -6, - :graphicYOffset => -6, - :display => true - } - end - - def context - context = { - :label => :" function(feature) {if(feature.layer.map.getZoom() > 13) { return feature.attributes.name;} else {return '';}} ", - :positionType => :" function(feature) { if (feature.attributes.iconCode != undefined) {return feature.attributes.iconCode;} else { return '';} } " - } - end - - def style_map - OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context}), :select => OpenLayers::Style.new(style.merge( select_style), { :context => context})) - end - -end - diff --git a/app/maps/style_map/line_style_map.rb b/app/maps/style_map/line_style_map.rb deleted file mode 100644 index acc307df4..000000000 --- a/app/maps/style_map/line_style_map.rb +++ /dev/null @@ -1,28 +0,0 @@ -class StyleMap::LineStyleMap < StyleMap::GenericStyleMap - attr_accessor :style, :line_priority, :line_color - - def initialize(helpers,options = {}) - @helpers= helpers - @line_color = options[:line_color] - @style = options[:style].present? ? default_style.merge(options[:style]) : default_style - end - - def stroke_width - stroke_width = 3 - end - - def default_style - style = { - :strokeColor => line_color || "#000000", - :strokeOpacity => 1, - :strokeWidth => stroke_width, - :strokeLineCap => "round", - :strokeDashstyle => "solid", - } - end - - def style_map - OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style)) - end - -end diff --git a/app/maps/style_map/route_style_map.rb b/app/maps/style_map/route_style_map.rb deleted file mode 100644 index 1d9ab12f0..000000000 --- a/app/maps/style_map/route_style_map.rb +++ /dev/null @@ -1,48 +0,0 @@ -class StyleMap::RouteStyleMap < StyleMap::GenericStyleMap - attr_accessor :style - - def initialize(helpers,options = {}) - @helpers= helpers - @style = options[:style].present? ? default_style.merge(options[:style]) : default_style - end - - def select_style - default_style.merge :externalGraphic => @helpers.assets_path_patch( "icons/stop_area_hover.png") - end - def default_style - { - :label => "${label}", - :fontColor => "black", - :fontSize => "11px", - :fontWeight => "bold", - :labelAlign => "ct", - :labelXOffset => 0, - :labelYOffset => -15, - :strokeColor => "#000000", - :strokeOpacity => 1, - :strokeWidth => 3, - :strokeLineCap => "round", - :strokeDashstyle => "solid", - :externalGraphic => @helpers.assets_path_patch( "icons/${positionType}.png"), - :graphicWidth => 12, - :graphicHeight => 12, - :graphicOpacity => 1, - :graphicXOffset => -6, - :graphicYOffset => -6, - :display => true - } - end - - def context - context = { - :label => :" function(feature) {if(feature.layer.map.getZoom() > 13) { return feature.attributes.name;} else {return '';}} ", - :positionType => :" function(feature) { if (feature.attributes.departure != undefined) { return 'stop_area_green'; } else if (feature.attributes.arrival != undefined) { return 'stop_area_red'; } else { return 'stop_area_black'; }} " - } - end - - def style_map - OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context}), :select => OpenLayers::Style.new(style.merge( select_style), { :context => context})) - end - -end - diff --git a/app/maps/style_map/stop_areas_style_map.rb b/app/maps/style_map/stop_areas_style_map.rb deleted file mode 100644 index f23b58136..000000000 --- a/app/maps/style_map/stop_areas_style_map.rb +++ /dev/null @@ -1,59 +0,0 @@ -class StyleMap::StopAreasStyleMap < StyleMap::GenericStyleMap - attr_accessor :style, :context, :temporary - - def default_style - raise "Helpers nil" if @helpers.nil? - {:label => "${label}", - :fontColor => "black", - :fontSize => "11px", - :fontWeight => "bold", - :labelAlign => "ct", - :labelXOffset => 0, - :labelYOffset => -20, - :pointRadius => 1, - :externalGraphic => @helpers.assets_path_patch( "map/${areaType}.png"), - :graphicWidth => 25, - :graphicHeight => 25, - :graphicOpacity => 1, - :graphicXOffset => -12.5, - :graphicYOffset => -12.5 } - end - def temporary_style - raise "Helpers nil" if @helpers.nil? - {:label => "${label}", - :fontColor => "darkblue", - :fontSize => "12px", - :fontWeight => "bold", - :labelAlign => "ct", - :labelXOffset => 0, - :labelYOffset => -20, - :pointRadius => 1, - :externalGraphic => @helpers.assets_path_patch( "map/${areaType}.png"), - :graphicWidth => 25, - :graphicHeight => 25, - :graphicOpacity => 1, - :graphicXOffset => -12.5, - :graphicYOffset => -12.5 } - end - - - def initialize(helpers,options = {}) - @helpers= helpers - @style = options[:style].present? ? default_style.merge(options[:style]) : default_style - @temporary = options[:style].present? ? temporary_style.merge(options[:style]) : temporary_style - end - - - def context - { - :label => :" function(feature) {if(feature.layer.map.getZoom() > 13) { return feature.attributes.name;} else {return '';}} ", - :areaType => :" function(feature) { return feature.attributes.stop_area_type.toLowerCase();} " - } - end - - def style_map - OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context}), - :temporary => OpenLayers::Style.new(temporary, { :context => context}) ) - end - -end -- cgit v1.2.3