Package slash.navigation.base

Examples of slash.navigation.base.ParserResult


        assertEquals(Gpx11Format.class, result.getFormat().getClass());
    }

    @Test
    public void readGoogleMapsUrl() throws IOException {
        ParserResult result = parser.read("http://maps.google.de/maps?f=d&saddr=Hamburg%2FUhlenhorst&daddr=Hauptstra%C3%9Fe%2FL160+to:53.588429,10.419159+to:Breitenfelde%2FNeuenlande&hl=de&geocode=%3BFVy1MQMdDoudAA%3B%3B&mra=dpe&mrcr=0&mrsp=2&sz=11&via=1,2&sll=53.582575,10.30528&sspn=0.234798,0.715485&ie=UTF8&z=11");
        assertNotNull(result);
        assertEquals(1, result.getAllRoutes().size());
        assertEquals(4, result.getTheRoute().getPositionCount());
        assertEquals(GoogleMapsUrlFormat.class, result.getFormat().getClass());
    }
View Full Code Here


        assertEquals(GoogleMapsUrlFormat.class, result.getFormat().getClass());
    }

    @Test
    public void readURLReference() throws IOException {
        ParserResult result = parser.read(new File(TEST_PATH + "from-gpx.url"));
        assertNotNull(result);
        assertEquals(4, result.getAllRoutes().size());
        assertEquals(3, result.getTheRoute().getPositionCount());
        assertEquals(Gpx11Format.class, result.getFormat().getClass());
    }
View Full Code Here

public class GoPalTrackFormatIT extends NavigationTestCase {
    private NavigationFormatParser parser = new NavigationFormatParser();

    public void testIsNotNmn6FavoritesWithValidPositions() throws IOException {
        File source = new File(SAMPLE_PATH + "dieter2-GoPal3Track.trk");
        ParserResult result = parser.read(source);
        assertNotNull(result);
        assertEquals(GoPalTrackFormat.class, result.getFormat().getClass());
    }
View Full Code Here

public class GoogleMapsUrlFormatIT {

    private void checkBookmark(String name) throws IOException {
        File source = new File(SAMPLE_PATH + name);
        NavigationFormatParser parser = new NavigationFormatParser();
        ParserResult result = parser.read(source);
        assertNotNull(result);
        assertEquals(GoogleMapsUrlFormat.class, result.getFormat().getClass());
        assertEquals(1, result.getAllRoutes().size());
        BaseRoute<BaseNavigationPosition, BaseNavigationFormat> route = result.getTheRoute();
        assertEquals(9, route.getPositionCount());
        NavigationPosition position = route.getPositions().get(route.getPositionCount() - 1);
        assertEquals("W Irlo Bronson Mem Hwy/US-192 W", position.getDescription());
        assertNotNull(position.getLongitude());
        assertNotNull(position.getLatitude());
View Full Code Here

                            formatAndRoutesModel.setRoutes(new FormatAndRoutes(gpxFormat, new GpxRoute(gpxFormat)));
                            urlModel.clear();
                        }
                    });

                    final ParserResult result = parser.read(url, formats);
                    if (result.isSuccessful()) {
                        log.info("Opened: " + path);
                        final NavigationFormat format = result.getFormat();
                        countRead(format);
                        if (!checkReadFormat(format))
                            return;
                        invokeLater(new Runnable() {
                            public void run() {
                                formatAndRoutesModel.setRoutes(new FormatAndRoutes(format, result.getAllRoutes()));
                                comboBoxChoosePositionList.setModel(formatAndRoutesModel);
                                urlModel.setString(path);
                                recentUrlsModel.addUrl(url);

                                if (urls.size() > 1) {
View Full Code Here

                try {
                    for (URL url : urls) {
                        String path = createReadablePath(url);

                        NavigationFormatParser parser = new NavigationFormatParser();
                        final ParserResult result = parser.read(url, getReadFormats());
                        if (result.isSuccessful()) {
                            log.info("Appended: " + path);
                            countRead(result.getFormat());

                            final String finalPath = path;
                            // avoid parallelism to ensure the URLs are processed in order
                            invokeAndWait(new Runnable() {
                                public void run() {
                                    if (getFormatAndRoutesModel().getFormat().isSupportsMultipleRoutes()) {
                                        for (BaseRoute route : result.getAllRoutes()) {
                                            int appendIndex = getFormatAndRoutesModel().getSize();
                                            getFormatAndRoutesModel().addPositionList(appendIndex, route);
                                        }
                                    } else {
                                        try {
                                            int appendRow = row > 0 ? row : getPositionsModel().getRowCount();
                                            getPositionsModel().add(appendRow, result.getTheRoute());
                                        } catch (FileNotFoundException e) {
                                            r.handleFileNotFound(finalPath);
                                        } catch (IOException e) {
                                            r.handleOpenError(e, finalPath);
                                        }
View Full Code Here

    @SuppressWarnings("unchecked")
    private void paste(String string) {
        NavigationFormatParser parser = new NavigationFormatParser();
        try {
            ParserResult result = parser.read(string);
            if (result.isSuccessful()) {
                BaseRoute route = result.getTheRoute();
                paste(route.getPositions());
            }
        } catch (IOException e) {
            // intentionally left empty
        }
View Full Code Here

        String path = Files.createReadablePath(file);
        String description = null;
        Double length = null;
        try {
            NavigationFormatParser parser = new NavigationFormatParser();
            ParserResult result = parser.read(file);
            if (result.isSuccessful()) {
                BaseRoute<BaseNavigationPosition, BaseNavigationFormat> route = result.getTheRoute();
                if (route != null) {
                    description = createRouteDescription(route);
                    length = route.getDistance();
                }
                showAddFileToCatalog(categoryTreeNode, description, length, file);
View Full Code Here

    private NavigationFormatParser parser = new NavigationFormatParser();

    @Test
    public void testIsPlainRouteRouteCharacteristics() throws IOException {
        File source = new File(SAMPLE_PATH + "bcr_with_itnconv.itn");
        ParserResult result = parser.read(source);
        assertNotNull(result);
        assertEquals(Route, result.getTheRoute().getCharacteristics());
    }
View Full Code Here

    }

    @Test
    public void testIsTripmasterTrackRouteCharacteristics() throws IOException {
        File source = new File(SAMPLE_PATH + "tripmaster2.itn");
        ParserResult result = parser.read(source);
        assertNotNull(result);
        assertEquals(Track, result.getTheRoute().getCharacteristics());
    }
View Full Code Here

TOP

Related Classes of slash.navigation.base.ParserResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.