Package org.apache.sis.io.wkt

Examples of org.apache.sis.io.wkt.Convention


     *
     * @return {@code "Axis"}.
     */
    @Override
    protected String formatTo(final Formatter formatter) {
        final Convention convention = formatter.getConvention();
        final boolean isWKT1 = convention.majorVersion() == 1;
        final boolean isInternal = (convention == Convention.INTERNAL);
        String name = null;
        if (isWKT1 || isInternal || !omitName(formatter)) {
            name = IdentifiedObjects.getName(this, formatter.getNameAuthority());
            if (name == null) {
View Full Code Here


     * @return {@code "TimeDatum"}.
     */
    @Override
    protected String formatTo(final Formatter formatter) {
        super.formatTo(formatter);
        final Convention convention = formatter.getConvention();
        if (convention == Convention.INTERNAL) {
            formatter.append(MetadataUtilities.toDate(origin)); // This is an extension compared to ISO 19162.
        } else if (convention.majorVersion() == 1) {
            formatter.setInvalidWKT(this, null);
        }
        return "TimeDatum";
    }
View Full Code Here

     * @return {@code "ImageDatum"}.
     */
    @Override
    protected String formatTo(final Formatter formatter) {
        super.formatTo(formatter);
        final Convention convention = formatter.getConvention();
        if (convention == Convention.INTERNAL) {
            formatter.append(pixelInCell); // This is an extension compared to ISO 19162.
        } else if (convention.majorVersion() == 1) {
            formatter.setInvalidWKT(this, null);
        }
        return "ImageDatum";
    }
View Full Code Here

            if (cs == null) {
                cs = citation;
                citation  = null;
            }
            if (cs != null) {
                final Convention convention = formatter.getConvention();
                if (convention.majorVersion() == 1) {
                    keyword = "Authority";
                    formatter.append(cs, ElementKind.IDENTIFIER);
                    formatter.append(code, ElementKind.IDENTIFIER);
                } else {
                    keyword = "Id";
View Full Code Here

     */
    @Override
    protected String formatTo(final Formatter formatter) {
        WKTUtilities.appendName(descriptor, formatter, ElementKind.PARAMETER);
        final Unit<?> targetUnit = formatter.toContextualUnit(descriptor.getUnit());
        final Convention convention = formatter.getConvention();
        final boolean isWKT1 = convention.majorVersion() == 1;
        if (isWKT1 && targetUnit != null) {
            double convertedValue;
            try {
                convertedValue = doubleValue(targetUnit);
            } catch (IllegalStateException exception) {
                // May happen if a parameter is mandatory (e.g. "semi-major")
                // but no value has been set for this parameter.
                formatter.setInvalidWKT(descriptor, exception);
                convertedValue = Double.NaN;
            }
            formatter.append(convertedValue);
        } else {
            formatter.appendAny(value);
        }
        if (unit != null && !isWKT1 && (!convention.isSimplified() || !unit.equals(targetUnit))) {
            formatter.append(unit);
        }
        return "Parameter";
    }
View Full Code Here

     * @return {@code "PrimeMeridian"} (WKT 2) or {@code "PrimeM"} (WKT 1).
     */
    @Override
    protected String formatTo(final Formatter formatter) {
        super.formatTo(formatter);
        final Convention convention = formatter.getConvention();
        final boolean isWKT1 = convention.majorVersion() == 1;
        Unit<Angle> targetUnit = formatter.toContextualUnit(NonSI.DEGREE_ANGLE);
        if (targetUnit == null) {
            targetUnit = NonSI.DEGREE_ANGLE;
        }
        formatter.append(isWKT1 ? getGreenwichLongitude(targetUnit) : greenwichLongitude);
        if (isWKT1) {
            return "PrimeM";
        }
        if (!convention.isSimplified() || !targetUnit.equals(angularUnit)) {
            formatter.append(angularUnit);
        }
        return "PrimeMeridian";
    }
View Full Code Here

     * @return {@code "CompoundCRS"} (WKT 2) or {@code "Compd_CS"} (WKT 1).
     */
    @Override
    protected String formatTo(final Formatter formatter) {
        WKTUtilities.appendName(this, formatter, null);
        final Convention convention = formatter.getConvention();
        final boolean isWKT1 = convention.majorVersion() == 1;
        for (final CoordinateReferenceSystem element :
                (isWKT1 || convention == Convention.INTERNAL) ? components : singles)
        {
            formatter.newLine();
            formatter.append(toFormattable(element));
View Full Code Here

     * @return {@code "Ellipsoid"} (WKT 2) or {@code "Spheroid"} (WKT 1).
     */
    @Override
    protected String formatTo(final Formatter formatter) {
        super.formatTo(formatter);
        final Convention convention = formatter.getConvention();
        final boolean isWKT1 = convention.majorVersion() == 1;
        double length = semiMajorAxis;
        if (isWKT1) {
            length = unit.getConverterTo(SI.METRE).convert(length);
        }
        formatter.append(length);
        formatter.append(isInfinite(inverseFlattening) ? 0 : inverseFlattening);
        if (isWKT1) {
            return "Spheroid";
        }
        if (!convention.isSimplified() || !SI.METRE.equals(unit)) {
            formatter.append(unit);
        }
        return "Ellipsoid";
    }
View Full Code Here

        /*
         * Output format can be either "text" (the default) or "xml".
         * In the case of "crs" sub-command, we accept also WKT variants.
         */
        boolean toXML = false;
        Convention wkt = null;
        final String format = options.get(Option.FORMAT);
        if (format != null && !format.equalsIgnoreCase("text")) {
            toXML = format.equalsIgnoreCase("xml");
            if (!toXML) {
                if (isCRS) {
View Full Code Here

TOP

Related Classes of org.apache.sis.io.wkt.Convention

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.