Quick Search:

View

Revision:

Diff

Diff from 160 to:

Annotations

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

Annotated File View

maesenka
160
1 /*
2  * $Id:$
3  *
4  * This file is part of Hibernate Spatial, an extension to the
5  * hibernate ORM solution for geographic data.
6  *
7  * Copyright © 2007-2010 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.Geometry;
29 import com.vividsolutions.jts.geom.GeometryCollection;
30
31 import java.util.ArrayList;
32 import java.util.List;
33
34 /**
35  * Created by IntelliJ IDEA.
36  * User: maesenka
37  * Date: Mar 3, 2010
38  * Time: 10:05:33 PM
39  * To change this template use File | Settings | File Templates.
40  */
41 public abstract class AbstractGeometryCollectionDecoder<T extends GeometryCollectionextends AbstractDecoder<T> {
42
43     @Override
44     protected OpenGisType getOpenGisType() {
45         return OpenGisType.GEOMETRYCOLLECTION;
46     }
47
48     @Override
49     protected T createNullGeometry() {
50         return createGeometry(null, (List<Geometry>) null);
51     }
52
53     @Override
54     protected T createGeometry(SqlGeometryV1 nativeGeom) {
55         return createGeometry(nativeGeom0);
56     }
57
58     @Override
59     protected T createGeometry(SqlGeometryV1 nativeGeomint shapeIndex) {
60         int startChildIdx = shapeIndex + 1;
61         List<Geometrygeometries = new ArrayList<Geometry>(nativeGeom.getNumShapes());
62         for (int childIdx = startChildIdxchildIdx < nativeGeom.getNumShapes(); childIdx++) {
63             if (!nativeGeom.isParentShapeOf(shapeIndexchildIdx)) continue;
64             AbstractDecoder<?> decoder = (AbstractDecoder<?>) Decoders.decoderFor(nativeGeom.getOpenGisTypeOfShape(childIdx));
65             Geometry geometry = decoder.createGeometry(nativeGeomchildIdx);
66             geometries.add(geometry);
67         }
68         return createGeometry(nativeGeomgeometries);
69     }
70
71     abstract protected T createGeometry(SqlGeometryV1 nativeGeomList<Geometrygeometries);
72
73
74 }
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-09 22:56 +0200