git_sitools_idoc / sitools-idoc / hesiod / javaExt / src / fr / ias / sitools / vo / ssa / SqlGeometryFactory.java @ 779bac69
1 | 779bac69 | Marc NICOLAS | /*******************************************************************************
|
---|---|---|---|
2 | * Copyright 2010-2013 CNES - CENTRE NATIONAL d'ETUDES SPATIALES
|
||
3 | *
|
||
4 | * This file is part of SITools2.
|
||
5 | *
|
||
6 | * SITools2 is free software: you can redistribute it and/or modify
|
||
7 | * it under the terms of the GNU General Public License as published by
|
||
8 | * the Free Software Foundation, either version 3 of the License, or
|
||
9 | * (at your option) any later version.
|
||
10 | *
|
||
11 | * SITools2 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 SITools2. If not, see <http://www.gnu.org/licenses/>.
|
||
18 | ******************************************************************************/
|
||
19 | package fr.ias.sitools.vo.ssa; |
||
20 | |||
21 | /**
|
||
22 | * Chooses the implementation of the SQL request
|
||
23 | * based on the geometry intersection algorithm.
|
||
24 | * @author Jean-Christophe Malapert <jean-christophe.malapert@cnes.fr>
|
||
25 | */
|
||
26 | public final class SqlGeometryFactory { |
||
27 | /**
|
||
28 | * Empty constructor.
|
||
29 | */
|
||
30 | private SqlGeometryFactory() {
|
||
31 | } |
||
32 | /**
|
||
33 | * Returns the Object responsible of creating the SQL request to send to the server.
|
||
34 | *
|
||
35 | * <p>
|
||
36 | * The supported geometryIntersection is either CENTER or OVERLAPS otherwise
|
||
37 | * an IllegalArgumentException is raised.
|
||
38 | * </p>
|
||
39 | * @param geometryIntersection Geometry Intersection algorithm
|
||
40 | * @return the Object responsible of creating the SQL request to send to the server
|
||
41 | */
|
||
42 | public static AbstractSqlGeometryConstraint create(final String geometryIntersection) { |
||
43 | AbstractSqlGeometryConstraint result; |
||
44 | if ("OVERLAPS".equals(geometryIntersection)) { |
||
45 | result = new OverlapsModeIntersection();
|
||
46 | } else if ("CENTER".equals(geometryIntersection)) { |
||
47 | result = new CenterModeIntersection();
|
||
48 | } else {
|
||
49 | throw new IllegalArgumentException("geometryMode " + geometryIntersection + " is unknown or not supported"); |
||
50 | } |
||
51 | return result;
|
||
52 | } |
||
53 | } |