svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.geometry / org.gvsig.fmap.geometry.impl / src / main / java / org / gvsig / fmap / geom / primitive / impl / Point2DGeometryType.java @ 40559
History | View | Annotate | Download (2.24 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 |
package org.gvsig.fmap.geom.primitive.impl; |
25 |
|
26 |
import org.gvsig.fmap.geom.Geometry; |
27 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
28 |
import org.gvsig.fmap.geom.primitive.Point; |
29 |
import org.gvsig.fmap.geom.primitive.PointGeometryType; |
30 |
import org.gvsig.fmap.geom.type.AbstractGeometryType; |
31 |
|
32 |
/**
|
33 |
* Geometry type implementation for the creation of {@link Point2D} objects.
|
34 |
*
|
35 |
* @author gvSIG Team
|
36 |
*/
|
37 |
public class Point2DGeometryType extends AbstractGeometryType implements |
38 |
PointGeometryType { |
39 |
|
40 |
public String getName() { |
41 |
return "Point2D"; |
42 |
} |
43 |
|
44 |
public int getType() { |
45 |
return Geometry.TYPES.POINT;
|
46 |
} |
47 |
|
48 |
public int getSubType() { |
49 |
return Geometry.SUBTYPES.GEOM2D;
|
50 |
} |
51 |
|
52 |
public boolean isTypeOf(int geometryType) { |
53 |
return Geometry.TYPES.POINT == geometryType
|
54 |
|| Geometry.TYPES.GEOMETRY == geometryType; |
55 |
} |
56 |
|
57 |
public boolean isSubTypeOf(int geometrySubType) { |
58 |
return Geometry.SUBTYPES.GEOM2D == geometrySubType;
|
59 |
} |
60 |
|
61 |
public Geometry create() throws CreateGeometryException { |
62 |
return new Point2D(this); |
63 |
} |
64 |
|
65 |
public Point createPoint(double x, double y) { |
66 |
return new Point2D(this, x, y); |
67 |
} |
68 |
|
69 |
public Point createPoint(double[] coordinates) { |
70 |
return new Point2D(this, coordinates[0], coordinates[1]); |
71 |
} |
72 |
|
73 |
} |