/* * Copyright 2013 Serdar. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.fub.maps.project.openstreetmap.map.provider; import de.fub.maps.project.openstreetmap.service.MapProvider; import de.fub.maps.project.openstreetmap.service.OpenstreetMapService; import de.fub.maps.project.openstreetmap.xml.osm.Osm; import java.util.Locale; import org.openide.util.NbBundle; import org.openide.util.lookup.ServiceProvider; /** * * @author Serdar */ @NbBundle.Messages({ "CLT_OSMBusMapProvider_Name=Bus Map", "CLT_OSMBusMapProvider_Description=Provides a map which displayes the bus network." }) @ServiceProvider(service = MapProvider.class) public class OSMBusMapProvider implements MapProvider { private final OpenstreetMapService SERVICE = new OpenstreetMapService(); @Override public String getName() { return Bundle.CLT_OSMBusMapProvider_Name(); } @Override public String getDescription() { return Bundle.CLT_OSMBusMapProvider_Description(); } @Override public Osm getMap(double leftLon, double bottomLat, double rightLon, double topLat) { Osm result = SERVICE.getOSMBusMap(Osm.class, String.format(Locale.ENGLISH, "%f", leftLon), String.format(Locale.ENGLISH, "%f", bottomLat), String.format(Locale.ENGLISH, "%f", rightLon), String.format(Locale.ENGLISH, "%f", topLat)); SERVICE.close(); return result; } }