Search in sources :

Example 51 with ObjectFactory

use of net.opengis.gml._3.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 52 with ObjectFactory

use of net.opengis.gml._3.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 53 with ObjectFactory

use of net.opengis.gml._3.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)

Example 54 with ObjectFactory

use of net.opengis.gml._3.ObjectFactory in project RouteConverter by cpesch.

the class Kml22Format method createRoute.

private PlacemarkType createRoute(KmlRoute route) {
    ObjectFactory objectFactory = new ObjectFactory();
    PlacemarkType placemarkType = objectFactory.createPlacemarkType();
    // deactivated to preserve route name in folder name
    // 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;
}
Also used : ObjectFactory(slash.navigation.kml.binding22.ObjectFactory) NavigationConversion.formatPositionAsString(slash.navigation.common.NavigationConversion.formatPositionAsString)

Example 55 with ObjectFactory

use of net.opengis.gml._3.ObjectFactory in project RouteConverter by cpesch.

the class Gpx10Format method createTrack.

private List<Gpx.Trk> createTrack(GpxRoute route, int startIndex, int endIndex) {
    ObjectFactory objectFactory = new ObjectFactory();
    List<Gpx.Trk> trks = new ArrayList<>();
    Gpx.Trk trk = route.getOrigin(Gpx.Trk.class);
    if (trk != null && reuseReadObjectsForWriting)
        trk.getTrkseg().clear();
    else
        trk = objectFactory.createGpxTrk();
    if (isWriteMetaData()) {
        trk.setName(asRouteName(route.getName()));
        trk.setDesc(asDescription(route.getDescription()));
    }
    trks.add(trk);
    Gpx.Trk.Trkseg trkseg = objectFactory.createGpxTrkTrkseg();
    List<GpxPosition> positions = route.getPositions();
    for (int i = startIndex; i < endIndex; i++) {
        GpxPosition position = positions.get(i);
        BigDecimal latitude = formatPosition(position.getLatitude());
        BigDecimal longitude = formatPosition(position.getLongitude());
        if (latitude == null || longitude == null)
            continue;
        Gpx.Trk.Trkseg.Trkpt trkpt = position.getOrigin(Gpx.Trk.Trkseg.Trkpt.class);
        if (trkpt == null || !reuseReadObjectsForWriting)
            trkpt = objectFactory.createGpxTrkTrksegTrkpt();
        trkpt.setLat(latitude);
        trkpt.setLon(longitude);
        trkpt.setTime(isWriteTime() ? formatXMLTime(position.getTime()) : null);
        trkpt.setEle(isWriteElevation() ? formatElevation(position.getElevation()) : null);
        trkpt.setCourse(isWriteHeading() ? formatHeading(position.getHeading()) : null);
        trkpt.setSpeed(isWriteSpeed() && position.getSpeed() != null ? formatSpeed(kmhToMs(position.getSpeed())) : null);
        trkpt.setName(isWriteName() ? splitNameAndDesc ? asName(position.getDescription()) : trim(position.getDescription()) : null);
        trkpt.setDesc(isWriteName() && splitNameAndDesc ? asDesc(position.getDescription(), trkpt.getDesc()) : null);
        trkpt.setHdop(isWriteAccuracy() && position.getHdop() != null ? formatAccuracy(position.getHdop()) : null);
        trkpt.setPdop(isWriteAccuracy() && position.getPdop() != null ? formatAccuracy(position.getPdop()) : null);
        trkpt.setVdop(isWriteAccuracy() && position.getVdop() != null ? formatAccuracy(position.getVdop()) : null);
        trkpt.setSat(isWriteAccuracy() && position.getSatellites() != null ? formatInt(position.getSatellites()) : null);
        trkseg.getTrkpt().add(trkpt);
    }
    trk.getTrkseg().add(trkseg);
    return trks;
}
Also used : ArrayList(java.util.ArrayList) Gpx(slash.navigation.gpx.binding10.Gpx) BigDecimal(java.math.BigDecimal) ObjectFactory(slash.navigation.gpx.binding10.ObjectFactory)

Aggregations

JAXBElement (javax.xml.bind.JAXBElement)32 ArrayList (java.util.ArrayList)26 Test (org.junit.Test)26 Marshaller (javax.xml.bind.Marshaller)23 ObjectFactory (net.opengis.cat.csw.v_2_0_2.ObjectFactory)20 StringWriter (java.io.StringWriter)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 JAXBContext (javax.xml.bind.JAXBContext)15 QName (javax.xml.namespace.QName)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 BigInteger (java.math.BigInteger)11 ElementSetNameType (net.opengis.cat.csw.v_2_0_2.ElementSetNameType)11