Package slash.navigation.kml.binding22

Examples of slash.navigation.kml.binding22.KmlType


    }

    public void read(InputStream source, CompactCalendar startDate, ParserContext<KmlRoute> context) throws Exception {
        InputStreamReader reader = new InputStreamReader(source);
        try {
            KmlType kmlType = unmarshal21(reader);
            process(kmlType, startDate, context);
        }
        finally {
            reader.close();
        }
View Full Code Here


    }

    public void read(InputStream source, CompactCalendar startDate, ParserContext<KmlRoute> context) throws Exception {
        InputStreamReader reader = new InputStreamReader(source, UTF16LE_ENCODING);
        try {
            KmlType kmlType = unmarshal21(reader);
            process(kmlType, startDate, context);
        }
        finally {
            reader.close();
        }
View Full Code Here

    }

    protected KmlType createKmlType(KmlRoute route, int startIndex, int endIndex) {
        ObjectFactory objectFactory = new ObjectFactory();
        KmlType kmlType = objectFactory.createKmlType();
        DocumentType documentType = objectFactory.createDocumentType();
        kmlType.setAbstractFeatureGroup(objectFactory.createDocument(documentType));
        documentType.setName(IGO_ROUTE);
        documentType.setDescription(trimLineFeedsAndCommas(asDescription(route.getDescription())));
        documentType.setOpen(TRUE);

        FolderType folderType = createWayPoints(route, startIndex, endIndex);
        documentType.getAbstractFeatureGroup().add(objectFactory.createFolder(folderType));
        return kmlType;
    }
View Full Code Here

        return line;
    }

    private FolderType createWayPoints(KmlRoute route, int startIndex, int endIndex) {
        ObjectFactory objectFactory = new ObjectFactory();
        FolderType folderType = objectFactory.createFolderType();
        folderType.setName(WAYPOINTS);
        List<KmlPosition> positions = route.getPositions();
        for (int i = startIndex; i < endIndex; i++) {
            KmlPosition position = positions.get(i);
            PlacemarkType placemarkType = objectFactory.createPlacemarkType();
            folderType.getAbstractFeatureGroup().add(objectFactory.createPlacemark(placemarkType));
            placemarkType.setName(trimLineFeedsAndCommas(asName(isWriteName() ? position.getDescription() : null)));
            placemarkType.setDescription(trimLineFeedsAndCommas(asDesc(isWriteDesc() ? position.getDescription() : null)));
            PointType pointType = objectFactory.createPointType();
            placemarkType.setAbstractGeometryGroup(objectFactory.createPoint(pointType));
            pointType.getCoordinates().add(createCoordinates(position, false));
View Full Code Here

        kmlType.setAbstractFeatureGroup(objectFactory.createDocument(documentType));
        documentType.setName(IGO_ROUTE);
        documentType.setDescription(trimLineFeedsAndCommas(asDescription(route.getDescription())));
        documentType.setOpen(TRUE);

        FolderType folderType = createWayPoints(route, startIndex, endIndex);
        documentType.getAbstractFeatureGroup().add(objectFactory.createFolder(folderType));
        return kmlType;
    }
View Full Code Here

    }

    public void read(InputStream source, CompactCalendar startDate, ParserContext<KmlRoute> context) throws Exception {
        InputStreamReader reader = new InputStreamReader(source);
        try {
            KmlType kmlType = unmarshal22(reader);
            process(kmlType, startDate, context);
        }
        finally {
            reader.close();
        }
View Full Code Here

        return folderType;
    }

    protected KmlType createKmlType(KmlRoute route, int startIndex, int endIndex) {
        ObjectFactory objectFactory = new ObjectFactory();
        KmlType kmlType = objectFactory.createKmlType();
        DocumentType documentType = objectFactory.createDocumentType();
        kmlType.setAbstractFeatureGroup(objectFactory.createDocument(documentType));
        documentType.setName(IGO_ROUTE);
        documentType.setDescription(trimLineFeedsAndCommas(asDescription(route.getDescription())));
        documentType.setOpen(TRUE);

        FolderType folderType = createWayPoints(route, startIndex, endIndex);
View Full Code Here

        }
        return positions;
    }

    private FolderType createWayPoints(KmlRoute route, int startIndex, int endIndex) {
        ObjectFactory objectFactory = new ObjectFactory();
        FolderType folderType = objectFactory.createFolderType();
        folderType.setName(WAYPOINTS);
        folderType.setDescription(asDescription(route.getDescription()));
        List<KmlPosition> positions = route.getPositions();
        for (int i = startIndex; i < endIndex; i++) {
            KmlPosition position = positions.get(i);
            PlacemarkType placemarkType = objectFactory.createPlacemarkType();
            folderType.getAbstractFeatureGroup().add(objectFactory.createPlacemark(placemarkType));
            placemarkType.setName(asName(isWriteName() ? position.getDescription() : null));
            placemarkType.setDescription(asDesc(isWriteDesc() ? position.getDescription() : null));
            if (position.hasTime()) {
                TimeStampType timeStampType = objectFactory.createTimeStampType();
                timeStampType.setWhen(formatDate(position.getTime()));
                placemarkType.setAbstractTimePrimitiveGroup(objectFactory.createTimeStamp(timeStampType));
            }
            PointType pointType = objectFactory.createPointType();
            placemarkType.setAbstractGeometryGroup(objectFactory.createPoint(pointType));
            pointType.getCoordinates().add(createCoordinates(position, false));
        }
        return folderType;
    }
View Full Code Here

        }
        return folderType;
    }

    private PlacemarkType createRoute(KmlRoute route) {
        ObjectFactory objectFactory = new ObjectFactory();
        PlacemarkType placemarkType = objectFactory.createPlacemarkType();
        placemarkType.setName(ROUTE);
        placemarkType.setDescription(asDescription(route.getDescription()));
        placemarkType.setStyleUrl("#" + ROUTE_LINE_STYLE);
        MultiGeometryType multiGeometryType = objectFactory.createMultiGeometryType();
        placemarkType.setAbstractGeometryGroup(objectFactory.createMultiGeometry(multiGeometryType));
        LineStringType lineStringType = objectFactory.createLineStringType();
        multiGeometryType.getAbstractGeometryGroup().add(objectFactory.createLineString(lineStringType));
        List<String> coordinates = lineStringType.getCoordinates();
        for (KmlPosition position : route.getPositions()) {
            coordinates.add(createCoordinates(position, false));
        }
        return placemarkType;
View Full Code Here

        }
        return placemarkType;
    }

    private PlacemarkType createTrack(KmlRoute route, int startIndex, int endIndex) {
        ObjectFactory objectFactory = new ObjectFactory();
        PlacemarkType placemarkType = objectFactory.createPlacemarkType();
        placemarkType.setName(TRACK);
        placemarkType.setDescription(asDescription(route.getDescription()));
        placemarkType.setStyleUrl("#" + TRACK_LINE_STYLE);
        // create gx:Track if there are at least two positions with a time stamp
        if (containTime(route)) {
            slash.navigation.kml.binding22gx.ObjectFactory gxObjectFactory = new slash.navigation.kml.binding22gx.ObjectFactory();
            TrackType trackType = gxObjectFactory.createTrackType();
            List<KmlPosition> positions = route.getPositions();
            for (int i = startIndex; i < endIndex; i++) {
                KmlPosition position = positions.get(i);
                String time = position.hasTime() ? formatDate(position.getTime()) : "";
                trackType.getWhen().add(time);
            }
            for (int i = startIndex; i < endIndex; i++) {
                KmlPosition position = positions.get(i);
                trackType.getCoord().add(createCoordinates(position, true));
            }
            placemarkType.setAbstractGeometryGroup(gxObjectFactory.createTrack(trackType));
        } else {
            LineStringType lineStringType = objectFactory.createLineStringType();
            placemarkType.setAbstractGeometryGroup(objectFactory.createLineString(lineStringType));
            List<String> coordinates = lineStringType.getCoordinates();
            List<KmlPosition> positions = route.getPositions();
            for (int i = startIndex; i < endIndex; i++) {
                KmlPosition position = positions.get(i);
                coordinates.add(createCoordinates(position, false));
View Full Code Here

TOP

Related Classes of slash.navigation.kml.binding22.KmlType

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.