/** * Parses the next element in the specified <cite>Well Know Text</cite> (WKT) tree. * * @param element the element to be parsed. * @return the parsed object, or {@code null} if the element is not recognized. * @throws ParseException if the element can not be parsed. */ @Override Object parseObject(final Element element) throws ParseException { return parseMathTransform(element, true); }
/** * Parses the next element in the specified <cite>Well Know Text</cite> (WKT) tree. * * @param element the element to be parsed. * @return the parsed object, or {@code null} if the element is not recognized. * @throws ParseException if the element can not be parsed. */ @Override Object parseObject(final Element element) throws ParseException { return parseMathTransform(element, true); }
/** * Parses a {@code "CONCAT_MT"} element. This element has the following pattern: * * {@preformat text * CONCAT_MT[<math transform> {,<math transform>}*] * } * * @param parent the parent element. * @return the {@code "CONCAT_MT"} element as an {@link MathTransform} object. * @throws ParseException if the {@code "CONCAT_MT"} element can not be parsed. */ private MathTransform parseConcatMT(final Element parent) throws ParseException { final Element element = parent.pullElement(FIRST, WKTKeywords.Concat_MT); if (element == null) { return null; } MathTransform transform = parseMathTransform(element, true); MathTransform optionalTransform; while ((optionalTransform = parseMathTransform(element, false)) != null) { try { transform = mtFactory.createConcatenatedTransform(transform, optionalTransform); } catch (FactoryException exception) { throw element.parseFailed(exception); } } element.close(ignoredElements); return transform; }
/** * Parses a {@code "CONCAT_MT"} element. This element has the following pattern: * * {@preformat text * CONCAT_MT[<math transform> {,<math transform>}*] * } * * @param parent the parent element. * @return the {@code "CONCAT_MT"} element as an {@link MathTransform} object. * @throws ParseException if the {@code "CONCAT_MT"} element can not be parsed. */ private MathTransform parseConcatMT(final Element parent) throws ParseException { final Element element = parent.pullElement(FIRST, WKTKeywords.Concat_MT); if (element == null) { return null; } MathTransform transform = parseMathTransform(element, true); MathTransform optionalTransform; while ((optionalTransform = parseMathTransform(element, false)) != null) { try { transform = mtFactory.createConcatenatedTransform(transform, optionalTransform); } catch (FactoryException exception) { throw element.parseFailed(exception); } } element.close(ignoredElements); return transform; }
/** * Parses an {@code "INVERSE_MT"} element. This element has the following pattern: * * {@preformat text * INVERSE_MT[<math transform>] * } * * @param parent the parent element. * @return the {@code "INVERSE_MT"} element as an {@link MathTransform} object. * @throws ParseException if the {@code "INVERSE_MT"} element can not be parsed. */ private MathTransform parseInverseMT(final Element parent) throws ParseException { final Element element = parent.pullElement(FIRST, WKTKeywords.Inverse_MT); if (element == null) { return null; } MathTransform transform = parseMathTransform(element, true); try { transform = transform.inverse(); } catch (NoninvertibleTransformException exception) { throw element.parseFailed(exception); } element.close(ignoredElements); return transform; }
/** * Parses an {@code "INVERSE_MT"} element. This element has the following pattern: * * {@preformat text * INVERSE_MT[<math transform>] * } * * @param parent the parent element. * @return the {@code "INVERSE_MT"} element as an {@link MathTransform} object. * @throws ParseException if the {@code "INVERSE_MT"} element can not be parsed. */ private MathTransform parseInverseMT(final Element parent) throws ParseException { final Element element = parent.pullElement(FIRST, WKTKeywords.Inverse_MT); if (element == null) { return null; } MathTransform transform = parseMathTransform(element, true); try { transform = transform.inverse(); } catch (NoninvertibleTransformException exception) { throw element.parseFailed(exception); } element.close(ignoredElements); return transform; }
/** * Parses a {@code "PASSTHROUGH_MT"} element. This element has the following pattern: * * {@preformat text * PASSTHROUGH_MT[<integer>, <math transform>] * } * * @param parent the parent element. * @return the {@code "PASSTHROUGH_MT"} element as an {@link MathTransform} object. * @throws ParseException if the {@code "PASSTHROUGH_MT"} element can not be parsed. */ private MathTransform parsePassThroughMT(final Element parent) throws ParseException { final Element element = parent.pullElement(FIRST, WKTKeywords.PassThrough_MT); if (element == null) { return null; } final int firstAffectedOrdinate = parent.pullInteger("firstAffectedOrdinate"); final MathTransform transform = parseMathTransform(element, true); element.close(ignoredElements); try { return mtFactory.createPassThroughTransform(firstAffectedOrdinate, transform, 0); } catch (FactoryException exception) { throw element.parseFailed(exception); } }
/** * Parses a {@code "PASSTHROUGH_MT"} element. This element has the following pattern: * * {@preformat text * PASSTHROUGH_MT[<integer>, <math transform>] * } * * @param parent the parent element. * @return the {@code "PASSTHROUGH_MT"} element as an {@link MathTransform} object. * @throws ParseException if the {@code "PASSTHROUGH_MT"} element can not be parsed. */ private MathTransform parsePassThroughMT(final Element parent) throws ParseException { final Element element = parent.pullElement(FIRST, WKTKeywords.PassThrough_MT); if (element == null) { return null; } final int firstAffectedOrdinate = parent.pullInteger("firstAffectedOrdinate"); final MathTransform transform = parseMathTransform(element, true); element.close(ignoredElements); try { return mtFactory.createPassThroughTransform(firstAffectedOrdinate, transform, 0); } catch (FactoryException exception) { throw element.parseFailed(exception); } }