Search in sources :

Example 41 with ObjectFactory

use of com.helger.xsds.peppol.smp1.ObjectFactory in project RouteConverter by cpesch.

the class Kml22Format method createKmlType.

private KmlType createKmlType(List<KmlRoute> routes) {
    ObjectFactory objectFactory = new ObjectFactory();
    KmlType kmlType = objectFactory.createKmlType();
    DocumentType documentType = objectFactory.createDocumentType();
    kmlType.setAbstractFeatureGroup(objectFactory.createDocument(documentType));
    documentType.setOpen(TRUE);
    if (hasCharacteristics(routes, Route))
        documentType.getAbstractStyleSelectorGroup().add(objectFactory.createStyle(createLineStyle(ROUTE_LINE_STYLE, getLineWidth(), getRouteLineColor())));
    if (hasCharacteristics(routes, Track)) {
        documentType.getAbstractStyleSelectorGroup().add(objectFactory.createStyle(createLineStyle(TRACK_LINE_STYLE, getLineWidth(), getTrackLineColor())));
        if (isWriteSpeed())
            for (StyleType style : createSpeedTrackColors(getSpeedLineWidth())) documentType.getAbstractStyleSelectorGroup().add(objectFactory.createStyle(style));
    }
    for (KmlRoute route : routes) {
        switch(route.getCharacteristics()) {
            case Waypoints:
                FolderType wayPointsFolder = objectFactory.createFolderType();
                wayPointsFolder.setName(createPlacemarkName(WAYPOINTS, route));
                wayPointsFolder.setDescription(asDescription(route.getDescription()));
                documentType.getAbstractFeatureGroup().add(objectFactory.createFolder(wayPointsFolder));
                List<PlacemarkType> wayPoints = createWayPoints(route, 0, route.getPositionCount());
                for (PlacemarkType wayPoint : wayPoints) wayPointsFolder.getAbstractFeatureGroup().add(objectFactory.createPlacemark(wayPoint));
                break;
            case Route:
                FolderType routeFolder = objectFactory.createFolderType();
                routeFolder.setName(createPlacemarkName(ROUTE, route));
                documentType.getAbstractFeatureGroup().add(objectFactory.createFolder(routeFolder));
                PlacemarkType routePlacemarks = createRoute(route);
                routeFolder.getAbstractFeatureGroup().add(objectFactory.createPlacemark(routePlacemarks));
                if (isWriteMarks())
                    routeFolder.getAbstractFeatureGroup().add(objectFactory.createFolder(createMarks(route, 0, route.getPositionCount())));
                break;
            case Track:
                FolderType trackFolder = objectFactory.createFolderType();
                trackFolder.setName(createPlacemarkName(TRACK, route));
                documentType.getAbstractFeatureGroup().add(objectFactory.createFolder(trackFolder));
                PlacemarkType track = createTrack(route, 0, route.getPositionCount());
                trackFolder.getAbstractFeatureGroup().add(objectFactory.createPlacemark(track));
                if (isWriteSpeed()) {
                    FolderType speed = createSpeed(route, 0, route.getPositionCount());
                    if (speed != null)
                        trackFolder.getAbstractFeatureGroup().add(objectFactory.createFolder(speed));
                }
                if (isWriteMarks())
                    trackFolder.getAbstractFeatureGroup().add(objectFactory.createFolder(createMarks(route, 0, route.getPositionCount())));
                break;
            default:
                throw new IllegalArgumentException("Unknown RouteCharacteristics " + route.getCharacteristics());
        }
    }
    return kmlType;
}
Also used : ObjectFactory(slash.navigation.kml.binding22.ObjectFactory)

Example 42 with ObjectFactory

use of com.helger.xsds.peppol.smp1.ObjectFactory in project RouteConverter by cpesch.

the class Kml22Format method createLineStyle.

private StyleType createLineStyle(String styleName, double width, byte[] color) {
    ObjectFactory objectFactory = new ObjectFactory();
    StyleType styleType = objectFactory.createStyleType();
    styleType.setId(styleName);
    LineStyleType lineStyleType = objectFactory.createLineStyleType();
    styleType.setLineStyle(lineStyleType);
    lineStyleType.setColor(color);
    lineStyleType.setWidth(width);
    return styleType;
}
Also used : ObjectFactory(slash.navigation.kml.binding22.ObjectFactory)

Example 43 with ObjectFactory

use of com.helger.xsds.peppol.smp1.ObjectFactory in project RouteConverter by cpesch.

the class Kml22Format method createSpeedSegment.

private PlacemarkType createSpeedSegment(int currentSegment, int speedClass, List<String> coordinates) {
    ObjectFactory objectFactory = new ObjectFactory();
    PlacemarkType placemarkType = objectFactory.createPlacemarkType();
    placemarkType.setName("Segment " + currentSegment);
    placemarkType.setDescription(getSpeedDescription(speedClass));
    placemarkType.setStyleUrl('#' + getSpeedColor(speedClass));
    placemarkType.setVisibility(FALSE);
    LineStringType lineStringType = objectFactory.createLineStringType();
    lineStringType.getCoordinates().addAll(coordinates);
    placemarkType.setAbstractGeometryGroup(objectFactory.createLineString(lineStringType));
    return placemarkType;
}
Also used : ObjectFactory(slash.navigation.kml.binding22.ObjectFactory)

Example 44 with ObjectFactory

use of com.helger.xsds.peppol.smp1.ObjectFactory in project RouteConverter by cpesch.

the class Kml22Format method createVec2Type.

private Vec2Type createVec2Type(double x, double y, UnitsEnumType unitX, UnitsEnumType unitY) {
    ObjectFactory objectFactory = new ObjectFactory();
    Vec2Type vec2Type = objectFactory.createVec2Type();
    vec2Type.setX(x);
    vec2Type.setY(y);
    vec2Type.setXunits(unitX);
    vec2Type.setYunits(unitY);
    return vec2Type;
}
Also used : ObjectFactory(slash.navigation.kml.binding22.ObjectFactory)

Example 45 with ObjectFactory

use of com.helger.xsds.peppol.smp1.ObjectFactory in project RouteConverter by cpesch.

the class Kml22Format method createScreenOverlayImage.

private ScreenOverlayType createScreenOverlayImage(String name, String url, Vec2Type overlayXY, Vec2Type screenXY, Vec2Type size) {
    ObjectFactory objectFactory = new ObjectFactory();
    ScreenOverlayType screenOverlayType = objectFactory.createScreenOverlayType();
    screenOverlayType.setName(name);
    screenOverlayType.setOverlayXY(overlayXY);
    screenOverlayType.setScreenXY(screenXY);
    screenOverlayType.setSize(size);
    LinkType icon = objectFactory.createLinkType();
    icon.setHref(url);
    screenOverlayType.setIcon(icon);
    return screenOverlayType;
}
Also used : ObjectFactory(slash.navigation.kml.binding22.ObjectFactory)

Aggregations

JAXBElement (javax.xml.bind.JAXBElement)35 Test (org.junit.Test)29 ArrayList (java.util.ArrayList)26 Marshaller (javax.xml.bind.Marshaller)24 ObjectFactory (net.opengis.cat.csw.v_2_0_2.ObjectFactory)20 StringWriter (java.io.StringWriter)19 JAXBContext (javax.xml.bind.JAXBContext)19 QueryType (net.opengis.cat.csw.v_2_0_2.QueryType)18 GetRecordsType (net.opengis.cat.csw.v_2_0_2.GetRecordsType)17 ObjectFactory (no.seres.xsd.nav.inntektsmelding_m._20181211.ObjectFactory)16 QName (javax.xml.namespace.QName)15 BigInteger (java.math.BigInteger)13 CswRecordCollection (org.codice.ddf.spatial.ogc.csw.catalog.common.CswRecordCollection)13 XStream (com.thoughtworks.xstream.XStream)12 ByteArrayInputStream (java.io.ByteArrayInputStream)12 GetRecordsResponseType (net.opengis.cat.csw.v_2_0_2.GetRecordsResponseType)12 SearchResultsType (net.opengis.cat.csw.v_2_0_2.SearchResultsType)12 ObjectFactory (slash.navigation.kml.binding22.ObjectFactory)12 ObjectFactory (com.opensymphony.xwork2.ObjectFactory)11 ElementSetNameType (net.opengis.cat.csw.v_2_0_2.ElementSetNameType)11