001    /*----------------------------------------------------------------------------
002     This file is part of deegree, http://deegree.org/
003     Copyright (C) 2001-2009 by:
004       Department of Geography, University of Bonn
005     and
006       lat/lon GmbH
007    
008     This library is free software; you can redistribute it and/or modify it under
009     the terms of the GNU Lesser General Public License as published by the Free
010     Software Foundation; either version 2.1 of the License, or (at your option)
011     any later version.
012     This library is distributed in the hope that it will be useful, but WITHOUT
013     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
014     FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
015     details.
016     You should have received a copy of the GNU Lesser General Public License
017     along with this library; if not, write to the Free Software Foundation, Inc.,
018     59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019    
020     Contact information:
021    
022     lat/lon GmbH
023     Aennchenstr. 19, 53177 Bonn
024     Germany
025     http://lat-lon.de/
026    
027     Department of Geography, University of Bonn
028     Prof. Dr. Klaus Greve
029     Postfach 1147, 53001 Bonn
030     Germany
031     http://www.geographie.uni-bonn.de/deegree/
032    
033     e-mail: info@deegree.org
034    ----------------------------------------------------------------------------*/
035    
036    package org.deegree.ogcwebservices.wpvs.operation;
037    
038    import javax.media.j3d.PickSegment;
039    import javax.vecmath.Point3d;
040    
041    import org.deegree.model.spatialschema.GeometryException;
042    import org.deegree.model.spatialschema.GeometryFactory;
043    import org.deegree.model.spatialschema.Position;
044    import org.deegree.ogcwebservices.wpvs.j3d.ViewPoint;
045    
046    /**
047     * This class represents the geometry needed for a request with a ray of view.
048     *
049     * @version $Revision: $
050     * @author <a href="mailto:cordes@lat-lon.de">Lyn Buesching</a>
051     * @author last edited by: $Author: $
052     *
053     * @version 1.0. $Revision: $, $Date: $
054     *
055     */
056    public class LineRequest extends RequestGeometry {
057    
058        // end point of the view ray
059        private Point3d endPointLine;
060    
061        /**
062         * Initializes the two Geometrys for the request with a ray.
063         *
064         * @param request the Get3DFeatureInfo-request
065         */
066            public LineRequest(Get3DFeatureInfo request)  {
067                    super( request );
068            endPointLine = new Point3d ( calcEndPoint( new ViewPoint( request.getGetViewRequestCopy() ),
069                                                       (int)request.getDepth(),
070                                                       (int)request.getGetViewRequestCopy().getImageDimension().getWidth(),
071                                                       (int)request.getGetViewRequestCopy().getImageDimension().getHeight(),
072                                                       request.getClickPoint().x, request.getClickPoint().y ) );
073            }
074    
075            @Override
076            public void setPickshape() {
077                    pickshape =  new PickSegment( getBeginPointLine(), endPointLine );
078            }
079    
080            @Override
081            public void setWfsReqGeom() throws GeometryException {
082                    Position p1 = GeometryFactory.createPosition( getBeginPointLine().x, getBeginPointLine().y, getBeginPointLine().z );
083                Position p2 = GeometryFactory.createPosition( endPointLine.x, endPointLine.y, endPointLine.z );
084                    wfsReqGeom = GeometryFactory.createCurve( new Position[]{ p1, p2}, getCrs() );
085            }
086    
087    
088        /**
089         * @return the end point of the line
090         */
091        public Point3d getEndPointLine() {
092            return endPointLine;
093        }
094    
095    
096    }