001 //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/tags/2.1/src/org/deegree/model/csct/ct/ConcatenedTransformDirect2D.java $ 002 /*---------------- FILE HEADER ------------------------------------------ 003 004 This file is part of deegree. 005 Copyright (C) 2001 by: 006 EXSE, Department of Geography, University of Bonn 007 http://www.giub.uni-bonn.de/exse/ 008 lat/lon GmbH 009 http://www.lat-lon.de 010 011 It has been implemented within SEAGIS - An OpenSource implementation of OpenGIS specification 012 (C) 2001, Institut de Recherche pour le D�veloppement (http://sourceforge.net/projects/seagis/) 013 SEAGIS Contacts: Surveillance de l'Environnement Assist�e par Satellite 014 Institut de Recherche pour le D�veloppement / US-Espace 015 mailto:seasnet@teledetection.fr 016 017 018 This library is free software; you can redistribute it and/or 019 modify it under the terms of the GNU Lesser General Public 020 License as published by the Free Software Foundation; either 021 version 2.1 of the License, or (at your option) any later version. 022 023 This library is distributed in the hope that it will be useful, 024 but WITHOUT ANY WARRANTY; without even the implied warranty of 025 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 026 Lesser General Public License for more details. 027 028 You should have received a copy of the GNU Lesser General Public 029 License along with this library; if not, write to the Free Software 030 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 031 032 Contact: 033 034 Andreas Poth 035 lat/lon GmbH 036 Aennchenstr. 19 037 53115 Bonn 038 Germany 039 E-Mail: poth@lat-lon.de 040 041 Klaus Greve 042 Department of Geography 043 University of Bonn 044 Meckenheimer Allee 166 045 53115 Bonn 046 Germany 047 E-Mail: klaus.greve@uni-bonn.de 048 049 050 ---------------------------------------------------------------------------*/ 051 package org.deegree.model.csct.ct; 052 053 // Geometry 054 import java.awt.Shape; 055 import java.awt.geom.Point2D; 056 057 import org.deegree.model.csct.pt.Matrix; 058 059 060 /** 061 * Concatened transform where both transforms are two-dimensional. 062 * 063 * @version 1.0 064 * @author Martin Desruisseaux 065 */ 066 final class ConcatenedTransformDirect2D extends ConcatenedTransformDirect implements MathTransform2D 067 { 068 /** 069 * Serial number for interoperability with different versions. 070 */ 071 private static final long serialVersionUID = 6009454091075588885L; 072 073 /** 074 * The first math transform. This field is identical 075 * to {@link ConcatenedTransform#transform1}. Only 076 * the type is different. 077 */ 078 private final MathTransform2D transform1; 079 080 /** 081 * The second math transform. This field is identical 082 * to {@link ConcatenedTransform#transform1}. Only 083 * the type is different. 084 */ 085 private final MathTransform2D transform2; 086 087 /** 088 * Construct a concatenated transform. 089 */ 090 public ConcatenedTransformDirect2D(final MathTransformFactory provider, final MathTransform2D transform1, final MathTransform2D transform2) 091 { 092 super(provider, transform1, transform2); 093 this.transform1 = transform1; 094 this.transform2 = transform2; 095 } 096 097 /** 098 * Check if transforms are compatibles 099 * with this implementation. 100 */ 101 protected boolean isValid() 102 {return super.isValid() && getDimSource()==2 && getDimTarget()==2;} 103 104 /** 105 * Transforms the specified <code>ptSrc</code> 106 * and stores the result in <code>ptDst</code>. 107 */ 108 public Point2D transform(final Point2D ptSrc, Point2D ptDst) throws TransformException 109 { 110 ptDst = transform1.transform(ptSrc, ptDst); 111 return transform2.transform(ptDst, ptDst); 112 } 113 114 /** 115 * Transform the specified shape. 116 */ 117 public Shape createTransformedShape(final Shape shape) throws TransformException 118 { 119 return transform2.createTransformedShape(transform1.createTransformedShape(shape)); 120 } 121 122 /** 123 * Gets the derivative of this transform at a point. 124 * 125 * @param point The coordinate point where to evaluate the derivative. 126 * @return The derivative at the specified point (never <code>null</code>). 127 * @throws TransformException if the derivative can't be evaluated at the specified point. 128 */ 129 public Matrix derivative(final Point2D point) throws TransformException 130 { 131 final Matrix matrix1 = transform1.derivative(point); 132 final Matrix matrix2 = transform2.derivative(transform1.transform(point, null)); 133 matrix2.mul(matrix1); 134 return matrix2; 135 } 136 }