Tabnine Logo
Formatter.newLine
Code IndexAdd Tabnine to your IDE (free)

How to use
newLine
method
in
org.apache.sis.io.wkt.Formatter

Best Java code snippets using org.apache.sis.io.wkt.Formatter.newLine (Showing top 20 results out of 315)

origin: apache/sis

/**
 * Formats the given area and its transform as a pseudo-WKT.
 * For {@link SpecializableTransform#formatTo(Formatter)} implementation only.
 */
static void format(SubArea area, final Formatter formatter) {
  while (area != null) {
    formatter.newLine(); formatter.append(area);
    formatter.newLine(); formatter.append(area.transform);
    area = area.specialization;
  }
}
origin: org.apache.sis.core/sis-referencing

/**
 * Appends the given CRS (if non-null) wrapped in an element of the given name.
 *
 * @param formatter  the formatter where to append the object name.
 * @param crs        the object to append, or {@code null} if none.
 * @param type       the keyword to write before the object.
 */
private static void append(final Formatter formatter, final CoordinateReferenceSystem crs, final String type) {
  if (crs != null) {
    formatter.append(new FormattableObject() {
      @Override protected String formatTo(final Formatter formatter) {
        formatter.indent(-1);
        formatter.append(WKTUtilities.toFormattable(crs));
        formatter.indent(+1);
        return type;
      }
    });
    formatter.newLine();
  }
}
origin: apache/sis

/**
 * Appends the given CRS (if non-null) wrapped in an element of the given name.
 *
 * @param formatter  the formatter where to append the object name.
 * @param crs        the object to append, or {@code null} if none.
 * @param type       the keyword to write before the object.
 */
private static void append(final Formatter formatter, final CoordinateReferenceSystem crs, final String type) {
  if (crs != null) {
    formatter.append(new FormattableObject() {
      @Override protected String formatTo(final Formatter formatter) {
        formatter.indent(-1);
        formatter.append(WKTUtilities.toFormattable(crs));
        formatter.indent(+1);
        return type;
      }
    });
    formatter.newLine();
  }
}
origin: org.apache.sis.core/sis-referencing

/** Formats this {@code Conversion} element. */
@Override protected String formatTo(final Formatter formatter) {
  WKTUtilities.appendName(conversion, formatter, null);
  formatter.newLine();
  append(formatter);
  return WKTKeywords.Conversion;
}
origin: org.apache.sis.core/sis-metadata

/**
 * Closes the element opened by {@link #openElement(boolean, String)}.
 *
 * @param  newLine  {@code true} for invoking {@link #newLine()} last.
 */
private void closeElement(final boolean newLine) {
  buffer.appendCodePoint(symbols.getClosingBracket(0));
  if (newLine) {
    newLine();
  }
}
origin: apache/sis

/** Formats this {@code Conversion} element. */
@Override protected String formatTo(final Formatter formatter) {
  WKTUtilities.appendName(conversion, formatter, null);
  formatter.newLine();
  append(formatter);
  return WKTKeywords.Conversion;
}
origin: apache/sis

/**
 * Closes the element opened by {@link #openElement(boolean, String)}.
 *
 * @param  newLine  {@code true} for invoking {@link #newLine()} last.
 */
private void closeElement(final boolean newLine) {
  buffer.appendCodePoint(symbols.getClosingBracket(0));
  if (newLine) {
    newLine();
  }
}
origin: apache/sis

/**
 * Appends a separator if needed, then opens a new element.
 *
 * @param  newLine  {@code true} for invoking {@link #newLine()} first.
 * @param  keyword  the element keyword (e.g. {@code "DATUM"}, {@code "AXIS"}, <i>etc</i>).
 */
private void openElement(final boolean newLine, String keyword) {
  if (newLine && buffer.length() != elementStart) {
    newLine();
  }
  appendSeparator();
  if (toUpperCase != 0) {
    final Locale locale = symbols.getLocale();
    keyword = (toUpperCase >= 0) ? keyword.toUpperCase(locale) : keyword.toLowerCase(locale);
  }
  elementStart = buffer.append(keyword).appendCodePoint(symbols.getOpeningBracket(0)).length();
}
origin: org.apache.sis.core/sis-metadata

/**
 * Appends a separator if needed, then opens a new element.
 *
 * @param  newLine  {@code true} for invoking {@link #newLine()} first.
 * @param  keyword  the element keyword (e.g. {@code "DATUM"}, {@code "AXIS"}, <i>etc</i>).
 */
private void openElement(final boolean newLine, String keyword) {
  if (newLine && buffer.length() != elementStart) {
    newLine();
  }
  appendSeparator();
  if (toUpperCase != 0) {
    final Locale locale = symbols.getLocale();
    keyword = (toUpperCase >= 0) ? keyword.toUpperCase(locale) : keyword.toLowerCase(locale);
  }
  elementStart = buffer.append(keyword).appendCodePoint(symbols.getOpeningBracket(0)).length();
}
origin: org.apache.sis.core/sis-referencing

/**
 * Appends a {@linkplain ParameterValue parameter} in a {@code PARAMETER[…]} element.
 * If the supplied parameter is actually a {@linkplain ParameterValueGroup parameter group},
 * all contained parameters will be flattened in a single list.
 *
 * @param  parameter  the parameter to append to the WKT, or {@code null} if none.
 * @param  formatter  the formatter where to append the parameter.
 */
public static void append(GeneralParameterValue parameter, final Formatter formatter) {
  if (parameter instanceof ParameterValueGroup) {
    boolean first = true;
    for (final GeneralParameterValue param : ((ParameterValueGroup) parameter).values()) {
      if (first) {
        formatter.newLine();
        first = false;
      }
      append(param, formatter);
    }
  }
  if (parameter instanceof ParameterValue<?>) {
    if (!(parameter instanceof FormattableObject)) {
      parameter = new DefaultParameterValue<>((ParameterValue<?>) parameter);
    }
    formatter.append((FormattableObject) parameter);
    formatter.newLine();
  }
}
origin: apache/sis

/**
 * Appends a {@linkplain ParameterValue parameter} in a {@code PARAMETER[…]} element.
 * If the supplied parameter is actually a {@linkplain ParameterValueGroup parameter group},
 * all contained parameters will be flattened in a single list.
 *
 * @param  parameter  the parameter to append to the WKT, or {@code null} if none.
 * @param  formatter  the formatter where to append the parameter.
 */
public static void append(GeneralParameterValue parameter, final Formatter formatter) {
  if (parameter instanceof ParameterValueGroup) {
    boolean first = true;
    for (final GeneralParameterValue param : ((ParameterValueGroup) parameter).values()) {
      if (first) {
        formatter.newLine();
        first = false;
      }
      append(param, formatter);
    }
  }
  if (parameter instanceof ParameterValue<?>) {
    if (!(parameter instanceof FormattableObject)) {
      parameter = new DefaultParameterValue<>((ParameterValue<?>) parameter);
    }
    formatter.append((FormattableObject) parameter);
    formatter.newLine();
  }
}
origin: org.apache.sis.core/sis-referencing

  @Override protected String formatTo(final Formatter formatter) {
    WKTUtilities.appendName(conversion, formatter, null);
    formatter.newLine();
    formatter.append(DefaultOperationMethod.castOrCopy(conversion.getMethod()));
    formatter.newLine();
    for (final GeneralParameterValue param : conversion.getParameterValues().values()) {
      WKTUtilities.append(param, formatter);
    }
    return WKTKeywords.DerivingConversion;
  }
});
origin: apache/sis

  @Override protected String formatTo(final Formatter formatter) {
    WKTUtilities.appendName(conversion, formatter, null);
    formatter.newLine();
    formatter.append(DefaultOperationMethod.castOrCopy(conversion.getMethod()));
    formatter.newLine();
    for (final GeneralParameterValue param : conversion.getParameterValues().values()) {
      WKTUtilities.append(param, formatter);
    }
    return WKTKeywords.DerivingConversion;
  }
});
origin: apache/sis

/**
 * Formats the inner part of a <cite>Well Known Text</cite> version 1 (WKT 1) element.
 *
 * <div class="note"><b>Compatibility note:</b>
 * The {@code SPECIALIZABLE_MT} element formatted here is an Apache SIS-specific extension.</div>
 *
 * @param  formatter  the formatter to use.
 * @return the WKT element name, which is {@code "Specializable_MT"}.
 */
@Override
protected final String formatTo(final Formatter formatter) {
  formatter.newLine();
  formatter.append(global);
  for (SubArea domain : domains) {
    SubArea.format(domain, formatter);
  }
  formatter.setInvalidWKT(SpecializableTransform.class, null);
  return "Specializable_MT";
}
origin: apache/sis

  /**
   * Formats a <cite>Well Known Text</cite> version 1 (WKT 1) element for a transform using this group of parameters.
   *
   * <div class="note"><b>Compatibility note:</b>
   * {@code Param_MT} is defined in the WKT 1 specification only.
   * If the {@linkplain Formatter#getConvention() formatter convention} is set to WKT 2,
   * then this method silently uses the WKT 1 convention without raising an error.</div>
   *
   * @return {@code "Param_MT"}.
   */
  @Override
  protected String formatTo(final Formatter formatter) {
    if (inverse) {
      formatter.newLine();
      formatter.append(new WKT(false));
      return WKTKeywords.Inverse_MT;
    } else {
      WKTUtilities.appendParamMT(ContextualParameters.this, formatter);
      return WKTKeywords.Param_MT;
    }
  }
}
origin: org.apache.sis.core/sis-referencing

  /**
   * Formats a <cite>Well Known Text</cite> version 1 (WKT 1) element for a transform using this group of parameters.
   *
   * <div class="note"><b>Compatibility note:</b>
   * {@code Param_MT} is defined in the WKT 1 specification only.
   * If the {@linkplain Formatter#getConvention() formatter convention} is set to WKT 2,
   * then this method silently uses the WKT 1 convention without raising an error.</div>
   *
   * @return {@code "Param_MT"}.
   */
  @Override
  protected String formatTo(final Formatter formatter) {
    if (inverse) {
      formatter.newLine();
      formatter.append(new WKT(false));
      return WKTKeywords.Inverse_MT;
    } else {
      WKTUtilities.appendParamMT(ContextualParameters.this, formatter);
      return WKTKeywords.Param_MT;
    }
  }
}
origin: org.apache.sis.core/sis-referencing

  /**
   * Formats the inner part of a <cite>Well Known Text</cite> version 1 (WKT 1) element.
   * If this inverse math transform has any parameter values, then this method formats
   * the WKT as in the {@linkplain AbstractMathTransform#formatWKT super-class method}.
   * Otherwise this method formats the math transform as an {@code "Inverse_MT"} entity.
   *
   * <div class="note"><b>Compatibility note:</b>
   * {@code Param_MT} and {@code Inverse_MT} are defined in the WKT 1 specification only.</div>
   *
   * @param  formatter  the formatter to use.
   * @return the WKT element name, which is {@code "Param_MT"} or
   *         {@code "Inverse_MT"} in the default implementation.
   */
  @Override
  protected String formatTo(final Formatter formatter) {
    final ParameterValueGroup parameters = getParameterValues();
    if (parameters != null) {
      WKTUtilities.appendParamMT(parameters, formatter);
      return WKTKeywords.Param_MT;
    } else {
      formatter.newLine();
      formatter.append((FormattableObject) AbstractMathTransform.this);
      return WKTKeywords.Inverse_MT;
    }
  }
}
origin: apache/sis

/**
 * Formats this coordinate operation in pseudo-WKT. This is specific to Apache SIS since
 * there is no concatenated operation in the Well Known Text (WKT) version 2 format.
 *
 * @param  formatter  the formatter to use.
 * @return {@code "ConcatenatedOperation"}.
 */
@Override
protected String formatTo(final Formatter formatter) {
  super.formatTo(formatter);
  for (final CoordinateOperation component : operations) {
    formatter.newLine();
    formatter.append(castOrCopy(component));
  }
  formatter.setInvalidWKT(this, null);
  return "ConcatenatedOperation";
}
origin: org.apache.sis.core/sis-referencing

/**
 * Formats this coordinate operation in pseudo-WKT. This is specific to Apache SIS since
 * there is no concatenated operation in the Well Known Text (WKT) version 2 format.
 *
 * @param  formatter  the formatter to use.
 * @return {@code "ConcatenatedOperation"}.
 */
@Override
protected String formatTo(final Formatter formatter) {
  super.formatTo(formatter);
  for (final CoordinateOperation component : operations) {
    formatter.newLine();
    formatter.append(castOrCopy(component));
  }
  formatter.setInvalidWKT(this, null);
  return "ConcatenatedOperation";
}
origin: apache/sis

  /**
   * Formats the inner part of a <cite>Well Known Text</cite> version 1 (WKT 1) element.
   * If this inverse math transform has any parameter values, then this method formats
   * the WKT as in the {@linkplain AbstractMathTransform#formatWKT super-class method}.
   * Otherwise this method formats the math transform as an {@code "Inverse_MT"} entity.
   *
   * <div class="note"><b>Compatibility note:</b>
   * {@code Param_MT} and {@code Inverse_MT} are defined in the WKT 1 specification only.</div>
   *
   * @param  formatter  the formatter to use.
   * @return the WKT element name, which is {@code "Param_MT"} or
   *         {@code "Inverse_MT"} in the default implementation.
   */
  @Override
  protected String formatTo(final Formatter formatter) {
    final ParameterValueGroup parameters = getParameterValues();
    if (parameters != null) {
      WKTUtilities.appendParamMT(parameters, formatter);
      return WKTKeywords.Param_MT;
    } else {
      formatter.newLine();
      formatter.append((FormattableObject) inverse());
      return WKTKeywords.Inverse_MT;
    }
  }
}
org.apache.sis.io.wktFormatternewLine

Javadoc

Request a line separator before the next element to format. Invoking this method before any append(…) method call will cause the next element to appear on the next line.

This method has no effect in any of the following cases:

  • This method has already been invoked before the next append(…).
  • The indentation is WKTFormat#SINGLE_LINE.

Popular methods of Formatter

  • append
    Appends a boolean value. The Symbols#getSeparator() will be written before the boolean if needed.
  • <init>
    Creates a new formatter instance with the specified convention, symbols and indentation.
  • appendAny
    Appends an object or an array of objects. This method performs the following choices: * If the given
  • getConvention
    Returns the convention to use for formatting the WKT. The default is Convention#WKT2.
  • getEnclosingElement
    Returns the enclosing WKT element, or null if element being formatted is the root. This method can b
  • getLocale
    Returns the locale to use for localizing InternationalString instances. This is not the locale for
  • indent
    Increases or decreases the indentation. A value of +1 increases the indentation by the amount of spa
  • setInvalidWKT
    Marks the current WKT representation of the given object as not strictly compliant with the WKT spec
  • toWKT
    Returns the WKT formatted by this object.
  • addContextualUnit
    Adds a unit to use for the next measurements of the quantity Q. The given unit will apply to all WKT
  • appendComplement
    Appends the optional complementary attributes common to many IdentifiedObject subtypes. Those attrib
  • appendElement
    Tries to append an object of the KEYWORD[something] form. The given value is typically, but not nece
  • appendComplement,
  • appendElement,
  • appendExact,
  • appendForSubtypes,
  • appendOnNewLine,
  • appendPreset,
  • appendSeparator,
  • appendTemporalExtent,
  • appendValue

Popular in Java

  • Finding current android device location
  • scheduleAtFixedRate (ScheduledExecutorService)
  • requestLocationUpdates (LocationManager)
  • getSharedPreferences (Context)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now