Search in sources :

Example 1 with TextLinePoint

use of com.revolsys.record.io.format.saif.geometry.TextLinePoint in project com.revolsys.open by revolsys.

the class TextLineConverter method read.

@Override
public Object read(final OsnIterator iterator) {
    final Map<String, Object> values = new TreeMap<>();
    values.put(TYPE, SaifConstants.TEXT_LINE);
    TextLinePoint geometry = null;
    String fieldName = iterator.nextFieldName();
    while (fieldName != null) {
        if (fieldName.equals("position")) {
            final String objectName = iterator.nextObjectName();
            final OsnConverter osnConverter = this.converters.getConverter(objectName);
            if (osnConverter == null) {
                iterator.throwParseError("No Geometry Converter for " + objectName);
            }
            geometry = new TextLinePoint((Point) osnConverter.read(iterator));
        } else {
            readAttribute(iterator, fieldName, values);
        }
        fieldName = iterator.nextFieldName();
    }
    Property.set(geometry, values);
    return geometry;
}
Also used : TextLinePoint(com.revolsys.record.io.format.saif.geometry.TextLinePoint) TextLinePoint(com.revolsys.record.io.format.saif.geometry.TextLinePoint) Point(com.revolsys.geometry.model.Point) TreeMap(java.util.TreeMap)

Example 2 with TextLinePoint

use of com.revolsys.record.io.format.saif.geometry.TextLinePoint in project com.revolsys.open by revolsys.

the class TextOnCurveConverter method read.

@Override
public Object read(final OsnIterator iterator) {
    final List<Point> points = new ArrayList<>();
    String fieldName = iterator.nextFieldName();
    while (fieldName != null) {
        if (fieldName.equals("characters")) {
            while (iterator.next() != OsnIterator.END_LIST) {
                final String objectName = iterator.nextObjectName();
                final OsnConverter osnConverter = this.converters.getConverter(objectName);
                if (osnConverter == null) {
                    iterator.throwParseError("No Geometry Converter for " + objectName);
                }
                points.add((TextLinePoint) osnConverter.read(iterator));
            }
        }
        fieldName = iterator.nextFieldName();
    }
    final Geometry geometry = new TextOnCurve(this.geometryFactory, points);
    return geometry;
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) ArrayList(java.util.ArrayList) TextOnCurve(com.revolsys.record.io.format.saif.geometry.TextOnCurve) TextLinePoint(com.revolsys.record.io.format.saif.geometry.TextLinePoint) Point(com.revolsys.geometry.model.Point)

Aggregations

Point (com.revolsys.geometry.model.Point)2 TextLinePoint (com.revolsys.record.io.format.saif.geometry.TextLinePoint)2 Geometry (com.revolsys.geometry.model.Geometry)1 TextOnCurve (com.revolsys.record.io.format.saif.geometry.TextOnCurve)1 ArrayList (java.util.ArrayList)1 TreeMap (java.util.TreeMap)1