/* This program is free software; you can redistribute it and/or modify it under the terms of the GNU AFFERO General Public License as published by the Free Software Foundation; either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA or see http://www.gnu.org/licenses/agpl.txt. */ // OSRM printer // [printing support] OSRM.Printing = { init: function() { var icon = document.createElement('div'); icon.id = "gui-printer"; icon.className = "iconic-button top-right-button"; var spacer = document.createElement('div'); spacer.className = "quad top-right-button"; var input_mask_header = document.getElementById('input-mask-header'); input_mask_header.appendChild(spacer,input_mask_header.lastChild); input_mask_header.appendChild(icon,input_mask_header.lastChild); document.getElementById("gui-printer").onclick = OSRM.Printing.print; }, windowLoaded: function(){ OSRM.Printing.show( OSRM.G.response ); OSRM.printwindow.focus(); }, show: function(response) { // create header header = '
'+header+' | ||
';
route_desc += ' | ";
route_desc += '';
route_desc += ' ';
// build route description
if( i == 0 )
route_desc += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, OSRM.loc(response.route_instructions[i][6]) );
else if( response.route_instructions[i][1] != "" )
route_desc += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, response.route_instructions[i][1]);
else
route_desc += OSRM.loc(OSRM.RoutingDescription.getDrivingInstruction(response.route_instructions[i][0])).replace(/\[(.*)\]/,"");
route_desc += ' ';
route_desc += " | ";
route_desc += ''; if( i != response.route_instructions.length-1 ) route_desc += ''+OSRM.Utils.metersToDistance(response.route_instructions[i][2])+''; route_desc += " | "; route_desc += "