Examples of Convention


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

     */
    @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

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

     * @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

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

     * @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

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

     * @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

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

        /*
         * 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

Examples of org.gradle.api.plugins.Convention

    }

    @Test
    public void hasPropertyDefinedByConventionObject() {
        Bean bean = new Bean();
        Convention convention = new DefaultConvention();

        assertFalse(bean.hasProperty("conventionProperty"));

        bean.setConvention(convention);
        assertFalse(bean.hasProperty("conventionProperty"));

        convention.getPlugins().put("test", new ConventionBean());
        assertTrue(bean.hasProperty("conventionProperty"));
    }
View Full Code Here

Examples of org.gradle.api.plugins.Convention

    }

    @Test
    public void canGetAndSetPropertyDefinedByConventionObject() {
        Bean bean = new Bean();
        Convention convention = new DefaultConvention();
        bean.setConvention(convention);
        ConventionBean conventionBean = new ConventionBean();
        convention.getPlugins().put("test", conventionBean);

        conventionBean.setConventionProperty("value");

        assertThat(bean.getProperty("conventionProperty"), equalTo((Object) "value"));
View Full Code Here

Examples of org.gradle.api.plugins.Convention

    @Test
    public void additionalPropertyTakesPrecedenceOverConventionProperty() {
        Bean bean = new Bean();
        bean.setProperty("conventionProperty", "value");

        Convention convention = new DefaultConvention();
        bean.setConvention(convention);
        ConventionBean conventionBean = new ConventionBean();
        convention.getPlugins().put("test", conventionBean);

        assertThat(bean.getProperty("conventionProperty"), equalTo((Object) "value"));

        bean.setProperty("conventionProperty", "new value");
View Full Code Here

Examples of org.gradle.api.plugins.Convention

        parent.setProperty("conventionProperty", "parent");

        Bean bean = new Bean();
        bean.setParent(parent);

        Convention convention = new DefaultConvention();
        bean.setConvention(convention);
        ConventionBean conventionBean = new ConventionBean();
        conventionBean.setConventionProperty("value");
        convention.getPlugins().put("test", conventionBean);

        assertThat(bean.getProperty("conventionProperty"), equalTo((Object) "value"));
    }
View Full Code Here

Examples of org.gradle.api.plugins.Convention

    public void canGetAllProperties() {
        Bean parent = new Bean();
        parent.setProperty("parentProperty", "parentProperty");
        parent.setReadWriteProperty("ignore me");
        parent.doSetReadOnlyProperty("ignore me");
        Convention parentConvention = new DefaultConvention();
        parentConvention.getPlugins().put("parent", new ConventionBean());
        parent.setConvention(parentConvention);

        GroovyBean bean = new GroovyBean();
        bean.setProperty("additional", "additional");
        bean.setReadWriteProperty("readWriteProperty");
        bean.doSetReadOnlyProperty("readOnlyProperty");
        bean.setGroovyProperty("groovyProperty");
        Convention convention = new DefaultConvention();
        ConventionBean conventionBean = new ConventionBean();
        conventionBean.setConventionProperty("conventionProperty");
        convention.getPlugins().put("bean", conventionBean);
        bean.setConvention(convention);
        bean.setParent(parent);

        Map<String, Object> properties = bean.getProperties();
        assertThat(properties.get("properties"), sameInstance((Object) properties));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.