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