blob: 2534bf1ff20a1b77517b31b83264c937ab0e08d6 [file] [log] [blame]
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (19) -->
<title>MathTransformProvider (Apache SIS 1.3 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="declaration: package: org.apache.sis.referencing.operation.transform, interface: MathTransformProvider">
<meta name="generator" content="javadoc/ClassWriterImpl">
<meta name="keywords" content="org.apache.sis.referencing.operation.transform.MathTransformProvider interface">
<meta name="keywords" content="createMathTransform()">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../../sis.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../../script-dir/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../../jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="../../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../../script-dir/jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="../../../../../../script-dir/jquery-ui.min.js"></script>
</head>
<body class="class-declaration-page">
<script type="text/javascript">var pathtoroot = "../../../../../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="flex-box">
<header role="banner" class="flex-header">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar-top"><button id="navbar-toggle-button" aria-controls="navbar-top" aria-expanded="false" aria-label="Toggle navigation links"><span class="nav-bar-toggle-icon">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</span></button>
<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
<li><a href="../../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="nav-bar-cell1-rev">Class</li>
<li><a href="class-use/MathTransformProvider.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html#class">Help</a></li>
</ul>
<ul class="sub-nav-list-small">
<li>
<p>Summary:</p>
<ul>
<li>Nested</li>
<li>Field</li>
<li>Constr</li>
<li><a href="#method-summary">Method</a></li>
</ul>
</li>
<li>
<p>Detail:</p>
<ul>
<li>Field</li>
<li>Constr</li>
<li><a href="#method-detail">Method</a></li>
</ul>
</li>
</ul>
</div>
<div class="sub-nav">
<div id="navbar-sub-list">
<ul class="sub-nav-list">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method-summary">Method</a></li>
</ul>
<ul class="sub-nav-list">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method-detail">Method</a></li>
</ul>
</div>
<div class="nav-list-search"><a href="../../../../../../search.html">SEARCH</a>
<input type="text" id="search-input" disabled placeholder="Search">
<input type="reset" id="reset-button" disabled value="reset">
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip-navbar-top"></span></nav>
</header>
<div class="flex-content">
<main role="main">
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="sub-title"><span class="package-label-in-type">Package</span>&nbsp;<a href="package-summary.html">org.apache.sis.referencing.operation.transform</a></div>
<h1 title="Interface MathTransformProvider" class="title">Interface MathTransformProvider</h1>
</div>
<section class="class-description" id="class-description">
<dl class="notes">
<dt>Functional Interface:</dt>
<dd>This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.</dd>
</dl>
<hr>
<div class="type-signature"><span class="annotations"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/FunctionalInterface.html" title="class or interface in java.lang" class="external-link">@FunctionalInterface</a>
</span><span class="modifiers">public interface </span><span class="element-name type-name-label">MathTransformProvider</span></div>
<div class="block">An object capable to create <a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/referencing/operation/MathTransform.html" title="class or interface in org.opengis.referencing.operation" class="external-link"><code>Math­Transform</code></a> instances from given parameter values.
This interface is the Apache SIS mechanism by which
<a href="../DefaultFormula.html" title="class in org.apache.sis.referencing.operation">formula</a> are concretized as Java code.
<p>Implementations of this interface usually extend <a href="../DefaultOperationMethod.html" title="class in org.apache.sis.referencing.operation"><code>Default­Operation­Method</code></a>,
but this is not mandatory. This interface can also be used alone since <a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/referencing/operation/MathTransform.html" title="class or interface in org.opengis.referencing.operation" class="external-link"><code>Math­Transform</code></a> instances can be created
for other purpose than coordinate operations.</p>
<p>This interface is generally not used directly. The recommended way to get a <code>Math­Transform</code>
is to <a href="../../CRS.html#findOperation(org.opengis.referencing.crs.CoordinateReferenceSystem,org.opengis.referencing.crs.CoordinateReferenceSystem,org.opengis.metadata.extent.GeographicBoundingBox)">find the coordinate operation</a>
(generally from a pair of <var>source</var> and <var>target</var> CRS), then to invoke
<a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/referencing/operation/CoordinateOperation.html#getMathTransform()" title="class or interface in org.opengis.referencing.operation" class="external-link"><code>Coordinate­Operation​.get­Math­Transform()</code></a>.
Alternative, one can also use a <a href="DefaultMathTransformFactory.html" title="class in org.apache.sis.referencing.operation.transform">math transform factory</a></p>
<h2>How to add custom coordinate operations to Apache SIS</h2>
<a href="DefaultMathTransformFactory.html" title="class in org.apache.sis.referencing.operation.transform"><code>Default­Math­Transform­Factory</code></a> can discover automatically new coordinate operations
(including map projections) by scanning the classpath. To define a custom coordinate operation,
one needs to define a <strong>thread-safe</strong> class implementing <strong>both</strong> this
<code>Math­Transform­Provider</code> interface and the <a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/referencing/operation/OperationMethod.html" title="class or interface in org.opengis.referencing.operation" class="external-link"><code>Operation­Method</code></a> one.
While not mandatory, we suggest to extend <a href="../DefaultOperationMethod.html" title="class in org.apache.sis.referencing.operation"><code>Default­Operation­Method</code></a>.
Example:
<div class="note"><blockquote><pre><font color="green">public</font> <font color="green">class</font> MyProjectionProvider <font color="green">extends</font> DefaultOperationMethod <font color="green">implements</font> MathTransformProvider {
<font color="green">public</font> <b>MyProjectionProvider</b>() {
<b><font color="green">super</font></b>(Collections.<b>singletonMap</b>(NAME_KEY, <font color="orangered">"My projection"</font>),
2, <i><font color="gray">// Number of source dimensions</font></i>
2, <i><font color="gray">// Number of target dimensions</font></i>
parameters);
}
@Override
<font color="green">public</font> MathTransform <b>createMathTransform</b>(MathTransformFactory factory, ParameterValueGroup parameters) {
<font color="green">double</font> semiMajor = values.<b>parameter</b>(<font color="orangered">"semi_major"</font>).<b>doubleValue</b>(Units.METRE);
<font color="green">double</font> semiMinor = values.<b>parameter</b>(<font color="orangered">"semi_minor"</font>).<b>doubleValue</b>(Units.METRE);
<i><font color="gray">// etc...</font></i>
<font color="green">return</font> <font color="green">new</font> <b>MyProjection</b>(semiMajor, semiMinor, ...);
}
}</pre></blockquote></div>
Then the fully-qualified class name of that implementation should be listed in a file reachable on the classpath
with this exact name:
<blockquote><pre>META-INF/services/org.opengis.referencing.operation.OperationMethod</pre></blockquote></div>
<dl class="notes">
<dt>Since:</dt>
<dd>0.6</dd>
<dt>See Also:</dt>
<dd>
<ul class="see-list">
<li><a href="../DefaultOperationMethod.html" title="class in org.apache.sis.referencing.operation"><code>Default­Operation­Method</code></a></li>
<li><a href="DefaultMathTransformFactory.html" title="class in org.apache.sis.referencing.operation.transform"><code>Default­Math­Transform­Factory</code></a></li>
<li><a href="AbstractMathTransform.html" title="class in org.apache.sis.referencing.operation.transform"><code>Abstract­Math­Transform</code></a></li>
</ul>
</dd>
<p><font size="-1">Defined in the <code>sis-referencing</code> module</font></p>
</dl>
</section>
<section class="summary">
<ul class="summary-list">
<!-- ========== METHOD SUMMARY =========== -->
<li>
<section class="method-summary" id="method-summary">
<h2>Method Summary</h2>
<div id="method-summary-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab3" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab3', 3)" class="table-tab">Abstract Methods</button></div>
<div id="method-summary-table.tabpanel" role="tabpanel">
<div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Method</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/referencing/operation/MathTransform.html" title="class or interface in org.opengis.referencing.operation" class="external-link">Math­Transform</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#createMathTransform(org.opengis.referencing.operation.MathTransformFactory,org.opengis.parameter.ParameterValueGroup)" class="member-name-link">create­Math­Transform</a><wbr>(<a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/referencing/operation/MathTransformFactory.html" title="class or interface in org.opengis.referencing.operation" class="external-link">Math­Transform­Factory</a>&nbsp;factory,
<a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/parameter/ParameterValueGroup.html" title="class or interface in org.opengis.parameter" class="external-link">Parameter­Value­Group</a>&nbsp;parameters)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3">
<div class="block">Creates a math transform from the specified group of parameter values.</div>
</div>
</div>
</div>
</div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="details-list">
<!-- ============ METHOD DETAIL ========== -->
<li>
<section class="method-details" id="method-detail">
<h2>Method Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="createMathTransform(org.opengis.referencing.operation.MathTransformFactory,org.opengis.parameter.ParameterValueGroup)">
<h3>createMathTransform</h3>
<div class="member-signature"><span class="return-type"><a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/referencing/operation/MathTransform.html" title="class or interface in org.opengis.referencing.operation" class="external-link">MathTransform</a></span>&nbsp;<span class="element-name">createMathTransform</span><wbr><span class="parameters">(<a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/referencing/operation/MathTransformFactory.html" title="class or interface in org.opengis.referencing.operation" class="external-link">MathTransformFactory</a>&nbsp;factory,
<a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/parameter/ParameterValueGroup.html" title="class or interface in org.opengis.parameter" class="external-link">ParameterValueGroup</a>&nbsp;parameters)</span>
throws <span class="exceptions"><a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/parameter/InvalidParameterNameException.html" title="class or interface in org.opengis.parameter" class="external-link">InvalidParameterNameException</a>,
<a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/parameter/ParameterNotFoundException.html" title="class or interface in org.opengis.parameter" class="external-link">ParameterNotFoundException</a>,
<a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/parameter/InvalidParameterValueException.html" title="class or interface in org.opengis.parameter" class="external-link">InvalidParameterValueException</a>,
<a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/util/FactoryException.html" title="class or interface in org.opengis.util" class="external-link">FactoryException</a></span></div>
<div class="block">Creates a math transform from the specified group of parameter values.
<div class="note"><b>Implementation example:</b>
The following example shows how parameter values can be extracted
before to instantiate the transform:
<blockquote><pre><font color="green">public</font> MathTransform <b>createMathTransform</b>(MathTransformFactory factory, ParameterValueGroup parameters) {
<font color="green">double</font> semiMajor = values.<b>parameter</b>(<font color="orangered">"semi_major"</font>).<b>doubleValue</b>(Units.METRE);
<font color="green">double</font> semiMinor = values.<b>parameter</b>(<font color="orangered">"semi_minor"</font>).<b>doubleValue</b>(Units.METRE);
<i><font color="gray">// etc...</font></i>
<font color="green">return</font> <font color="green">new</font> <b>MyProjection</b>(semiMajor, semiMinor, ...);
}</pre></blockquote>
</div>
<h4>Purpose of the factory argument</h4>
Some math transforms may actually be implemented as a chain of operation steps, for example a
<a href="DefaultMathTransformFactory.html#createConcatenatedTransform(org.opengis.referencing.operation.MathTransform,org.opengis.referencing.operation.MathTransform)">concatenation</a> of <a href="DefaultMathTransformFactory.html#createAffineTransform(org.opengis.referencing.operation.Matrix)">affine transforms</a>
with other kind of transforms. In such cases, implementations should use the given factory for creating
the steps.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>factory</code> - the factory to use if this constructor needs to create other math transforms.</dd>
<dd><code>parameters</code> - the parameter values that define the transform to create.</dd>
<dt>Returns:</dt>
<dd>the math transform created from the given parameters.</dd>
<dt>Throws:</dt>
<dd><code><a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/parameter/InvalidParameterNameException.html" title="class or interface in org.opengis.parameter" class="external-link">Invalid­Parameter­Name­Exception</a></code> - if the given parameter group contains an unknown parameter.</dd>
<dd><code><a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/parameter/ParameterNotFoundException.html" title="class or interface in org.opengis.parameter" class="external-link">Parameter­Not­Found­Exception</a></code> - if a required parameter was not found.</dd>
<dd><code><a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/parameter/InvalidParameterValueException.html" title="class or interface in org.opengis.parameter" class="external-link">Invalid­Parameter­Value­Exception</a></code> - if a parameter has an invalid value.</dd>
<dd><code><a href="http://www.geoapi.org/3.0/javadoc/org.opengis.geoapi/org/opengis/util/FactoryException.html" title="class or interface in org.opengis.util" class="external-link">Factory­Exception</a></code> - if the math transform cannot be created for some other reason
(for example a required file was not found).</dd>
</dl>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
<!-- ========= END OF CLASS DATA ========= -->
</main>
<footer role="contentinfo">
<hr>
<p class="legal-copy"><small>Copyright &#169; 2010&#x2013;2022 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</footer>
</div>
</div>
</body>
</html>