Package slash.navigation.base

Examples of slash.navigation.base.ParserResult


        System.exit(0);
    }

    private void convert(File source, NavigationFormat format, File target) throws IOException {
        NavigationFormatParser parser = new NavigationFormatParser();
        ParserResult result = parser.read(source);
        if (!result.isSuccessful()) {
            log.severe("Could not read source '" + source.getAbsolutePath() + "'");
            logFormatNames(getReadFormatsSortedByName());
            System.exit(20);
        }

        if (format.isSupportsMultipleRoutes()) {
            parser.write(result.getAllRoutes(), (MultipleRoutesFormat) format, target);
        } else {
            int fileCount = getNumberOfFilesToWriteFor(result.getTheRoute(), format, false);
            File[] targets = createTargetFiles(target, fileCount, format.getExtension(), format.getMaximumFileNameLength());
            for (File t : targets) {
                if (t.exists()) {
                    log.severe("Target '" + t.getAbsolutePath() + "' already exists; stopping.");
                    System.exit(13);
                }
            }
            parser.write(result.getTheRoute(), format, false, false, null, targets);
        }
    }
View Full Code Here


public class ZipFormatIT {
    private NavigationFormatParser parser = new NavigationFormatParser();

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

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

    @Test
    public void readGPX11AndKML22Archive() throws IOException {
        ParserResult result = parser.read(new File(TEST_PATH + "from-gpx-kml.zip"), getReadFormatsPreferredByExtension(".zip"));
        assertNotNull(result);
        assertEquals(7, result.getAllRoutes().size());
        assertEquals(Kml22Format.class, result.getFormat().getClass());
    }
View Full Code Here

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

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

public class CompeGPSDataFormatIT {
    private NavigationFormatParser parser = new NavigationFormatParser();

    private void checkFile(String testFileName, RouteCharacteristics characteristics, int positionCount) throws IOException {
        File source = new File(TEST_PATH + testFileName);
        ParserResult result = parser.read(source, getReadFormatsPreferredByExtension(getExtension(testFileName)));
        assertNotNull(result);
        List<BaseRoute> routes = result.getAllRoutes();
        assertEquals(1, routes.size());
        BaseRoute<BaseNavigationPosition, BaseNavigationFormat> route = result.getTheRoute();
        assertEquals(characteristics, route.getCharacteristics());
        assertEquals(positionCount, route.getPositionCount());
    }
View Full Code Here

public class OziExplorerFormatIT {
    private NavigationFormatParser parser = new NavigationFormatParser();

    private void checkFile(String testFileName, RouteCharacteristics characteristics, int routeCount, int positionCount) throws IOException {
        File source = new File(TEST_PATH + testFileName);
        ParserResult result = parser.read(source, getReadFormatsPreferredByExtension(getExtension(testFileName)));
        assertNotNull(result);
        List<BaseRoute> routes = result.getAllRoutes();
        assertEquals(routeCount, routes.size());
        BaseRoute<BaseNavigationPosition, BaseNavigationFormat> route = result.getTheRoute();
        assertEquals(characteristics, route.getCharacteristics());
        assertEquals(positionCount, route.getPositionCount());
    }
View Full Code Here

    private NavigationFormatParser parser = new NavigationFormatParser();

    @Test
    public void testIsNmn6FavoritesWithValidPositionsOnly() throws IOException {
        File source = new File(SAMPLE_PATH + "Mue Goe A38-stripped.rte");
        ParserResult result = parser.read(source);
        assertNotNull(result);
        assertEquals(Nmn6Format.class, result.getFormat().getClass());
    }
View Full Code Here

    }

    @Test
    public void testIsNmn6WithFirstValidLineButNotPosition() throws IOException {
        File source = new File(SAMPLE_PATH + "Mue Goe A38.rte");
        ParserResult result = parser.read(source);
        assertNotNull(result);
        assertEquals(Nmn6Format.class, result.getFormat().getClass());
    }
View Full Code Here

    private NavigationFormatParser parser = new NavigationFormatParser();

    @Test
    public void testIsNmn6FavoritesWithValidPositions() throws IOException {
        File source = new File(SAMPLE_PATH + "Favorites.storage-1.rte");
        ParserResult result = parser.read(source);
        assertNotNull(result);
        assertEquals(Nmn6FavoritesFormat.class, result.getFormat().getClass());
    }
View Full Code Here

public class UrlFormatIT {
    private NavigationFormatParser parser = new NavigationFormatParser();

    @Test
    public void readRouteCatalogUrl() throws IOException {
        ParserResult result = parser.read("http://www.routeconverter.de/catalog/files/63/");
        assertNotNull(result);
        assertEquals(3, result.getAllRoutes().size());
        assertEquals(Gpx11Format.class, result.getFormat().getClass());
    }
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.