svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.geometry / org.gvsig.fmap.geometry.jts / src / main / java / org / gvsig / fmap / geom / jts / spatialindex / SpatialIndexFactoryJTSQuadtree.java @ 43513
History | View | Annotate | Download (2.89 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 3
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
|
25 |
|
26 |
package org.gvsig.fmap.geom.jts.spatialindex; |
27 |
|
28 |
import java.io.File; |
29 |
import org.gvsig.fmap.geom.GeometryManager; |
30 |
import org.gvsig.fmap.geom.SpatialIndexFactory; |
31 |
import org.gvsig.tools.dataTypes.DataTypes; |
32 |
import org.gvsig.tools.dynobject.DynObject; |
33 |
import org.gvsig.tools.dynobject.DynStruct; |
34 |
import org.gvsig.tools.dynobject.impl.DefaultDynObject; |
35 |
import org.gvsig.tools.service.Service; |
36 |
import org.gvsig.tools.service.ServiceException; |
37 |
import org.gvsig.tools.service.spi.ServiceManager; |
38 |
import org.gvsig.tools.util.HasAFile; |
39 |
|
40 |
|
41 |
public class SpatialIndexFactoryJTSQuadtree extends AbstractSpatialIndexFactory implements SpatialIndexFactory { |
42 |
|
43 |
public static final String NAME = GeometryManager.SPATIALINDEX_DEFAULT_QUADTREE; |
44 |
|
45 |
public static class SpatialIndexJTSParameters extends DefaultDynObject implements HasAFile { |
46 |
|
47 |
public SpatialIndexJTSParameters(DynStruct dynClass) {
|
48 |
super(dynClass);
|
49 |
} |
50 |
|
51 |
@Override
|
52 |
public File getFile() { |
53 |
return (File) this.getDynValue("file"); |
54 |
} |
55 |
|
56 |
@Override
|
57 |
public void setFile(File file) { |
58 |
this.setDynValue("file", file); |
59 |
} |
60 |
} |
61 |
|
62 |
@Override
|
63 |
public String getName() { |
64 |
return NAME;
|
65 |
} |
66 |
|
67 |
@Override
|
68 |
public int getDataTypeSupported() { |
69 |
return DataTypes.OBJECT;
|
70 |
} |
71 |
|
72 |
@Override
|
73 |
public Service create(DynObject parameters, ServiceManager serviceManager) throws ServiceException { |
74 |
return new SpatialIndexJTSQuadtree((GeometryManager) serviceManager, this, parameters); |
75 |
} |
76 |
|
77 |
@Override
|
78 |
public DynObject createParameters() {
|
79 |
return new SpatialIndexJTSParameters(parametersDefinition); |
80 |
} |
81 |
|
82 |
@Override
|
83 |
public void initialize() { |
84 |
super.initialize();
|
85 |
if( this.parametersDefinition == null ) { |
86 |
this.parametersDefinition = this.getBaseParametersDefinition(); |
87 |
this.parametersDefinition.addDynFieldFile("file").setMandatory(false); |
88 |
} |
89 |
} |
90 |
|
91 |
|
92 |
} |