Quick Search:

View

Revision:

Diff

Diff from 146 to:

Annotations

Annotate by Age | Author | Mixed | None
/fisheye/browse/HibernateSpatial/trunk/hibernate-spatial-sqlserver/src/main/java/org/hibernatespatial/sqlserver/convertors/LineStringDecoder.java

Annotated File View

maesenka
145
1 /*
maesenka
146
2  * $Id:$
maesenka
145
3  *
4  * This file is part of Hibernate Spatial, an extension to the
5  * hibernate ORM solution for geographic data.
6  *
7  * Copyright © 2009 Geovise BVBA
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  *
23  * For more information, visit: http://www.hibernatespatial.org/
24  */
25
26 package org.hibernatespatial.sqlserver.convertors;
27
28 import com.vividsolutions.jts.geom.CoordinateSequence;
29 import com.vividsolutions.jts.geom.LineString;
30 import org.hibernatespatial.mgeom.MCoordinate;
31
32 class LineStringDecoder extends AbstractDecoder<LineString> {
33
34     public boolean accepts(SqlGeometryV1 nativeGeom) {
35         return nativeGeom.openGisType() == OpenGisType.LINESTRING;
36     }
37
38     protected LineString createNullGeometry() {
39         return getGeometryFactory().createLineString((CoordinateSequencenull);
40     }
41
42     protected LineString createGeometry(SqlGeometryV1 nativeGeom) {
43         MCoordinate[] coords = new MCoordinate[nativeGeom.getNumPoints()];
44         for (int idx = 0idx < nativeGeom.getNumPoints(); idx++) {
45             coords[idx] = nativeGeom.getCoordinate(idx);
46         }
47         if (!nativeGeom.hasMValues())
48             return getGeometryFactory().createLineString(coords);
49         else
50             return getGeometryFactory().createMLineString(coords);
51     }
52
53 }
FishEye: Open Source License registered to Hibernate Spatial.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, Subversion, CVS & Perforce analysis. (Version:1.5.2 Build:build-298 2008-05-26 ) - Administration - Page generated 2010-09-08 06:03 +0200