Statistics
| Revision:

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 / primitive / surface / filledspline / FilledSpline2DM.java @ 42464

History | View | Annotate | Download (5.62 KB)

1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.fmap.geom.jts.primitive.surface.filledspline;
24

    
25
import com.vividsolutions.jts.geom.Coordinate;
26

    
27
import org.cresques.cts.ICoordTrans;
28

    
29
import org.gvsig.fmap.geom.Geometry;
30
import org.gvsig.fmap.geom.jts.primitive.curve.spline.BaseSpline2DM;
31
import org.gvsig.fmap.geom.jts.util.JTSUtils;
32
import org.gvsig.fmap.geom.operation.GeometryOperationException;
33
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
34
import org.gvsig.fmap.geom.primitive.FilledSpline;
35
import org.gvsig.fmap.geom.primitive.Line;
36
import org.gvsig.fmap.geom.primitive.Polygon;
37
import org.gvsig.fmap.geom.primitive.Ring;
38
import org.gvsig.fmap.geom.primitive.SurfaceAppearance;
39

    
40

    
41
/**
42
 * @author fdiaz
43
 *
44
 */
45
public class FilledSpline2DM extends BaseSpline2DM implements FilledSpline {
46

    
47
    /**
48
     *
49
     */
50
    private static final long serialVersionUID = 5991348858703093647L;
51

    
52
    /**
53
     *
54
     */
55
    public FilledSpline2DM() {
56
        super(Geometry.TYPES.FILLEDSPLINE);
57
    }
58

    
59
    /**
60
     * @param coordinates
61
     */
62
    public FilledSpline2DM(Coordinate[] coordinates) {
63
        super(Geometry.TYPES.FILLEDSPLINE, coordinates);
64
    }
65

    
66
    /* (non-Javadoc)
67
     * @see org.gvsig.fmap.geom.primitive.Surface#setSurfaceAppearance(org.gvsig.fmap.geom.primitive.SurfaceAppearance)
68
     */
69
    public void setSurfaceAppearance(SurfaceAppearance app) {
70
        // TODO Auto-generated method stub
71

    
72
    }
73

    
74
    /* (non-Javadoc)
75
     * @see org.gvsig.fmap.geom.primitive.Surface#getSurfaceAppearance()
76
     */
77
    public SurfaceAppearance getSurfaceAppearance() {
78
        // TODO Auto-generated method stub
79
        return null;
80
    }
81

    
82
    /* (non-Javadoc)
83
     * @see org.gvsig.fmap.geom.primitive.Surface#getNumInteriorRings()
84
     */
85
    public int getNumInteriorRings() {
86
        String message = "Calling deprecated method getNumInteriorRings of a filled spline";
87
        notifyDeprecated(message);
88
        throw new UnsupportedOperationException(message);
89
    }
90

    
91
    /* (non-Javadoc)
92
     * @see org.gvsig.fmap.geom.primitive.Surface#getInteriorRing(int)
93
     */
94
    public Ring getInteriorRing(int index) {
95
        String message = "Calling deprecated method getInteriorRing of a filled spline";
96
        notifyDeprecated(message);
97
        throw new UnsupportedOperationException(message);
98
    }
99

    
100
    /* (non-Javadoc)
101
     * @see org.gvsig.fmap.geom.primitive.Surface#addInteriorRing(org.gvsig.fmap.geom.primitive.Ring)
102
     */
103
    public void addInteriorRing(Ring ring) {
104
        String message = "Calling deprecated method addInteriorRing of a filled spline";
105
        notifyDeprecated(message);
106
        throw new UnsupportedOperationException(message);
107
    }
108

    
109
    /* (non-Javadoc)
110
     * @see org.gvsig.fmap.geom.primitive.Surface#addInteriorRing(org.gvsig.fmap.geom.primitive.Line)
111
     */
112
    public void addInteriorRing(Line line) {
113
        String message = "Calling deprecated method addInteriorRing of a filled spline";
114
        notifyDeprecated(message);
115
        throw new UnsupportedOperationException(message);
116
    }
117

    
118
    /* (non-Javadoc)
119
     * @see org.gvsig.fmap.geom.primitive.Surface#addInteriorRing(org.gvsig.fmap.geom.primitive.Polygon)
120
     */
121
    public void addInteriorRing(Polygon polygon) {
122
        String message = "Calling deprecated method addInteriorRing of a filled spline";
123
        notifyDeprecated(message);
124
        throw new UnsupportedOperationException(message);
125
    }
126

    
127
    /* (non-Javadoc)
128
     * @see org.gvsig.fmap.geom.primitive.Surface#removeInteriorRing(int)
129
     */
130
    public void removeInteriorRing(int index) {
131
        String message = "Calling deprecated method removeInteriorRing of a circle";
132
        notifyDeprecated(message);
133
        throw new UnsupportedOperationException(message);
134
    }
135

    
136
    /* (non-Javadoc)
137
     * @see org.gvsig.fmap.geom.Geometry#cloneGeometry()
138
     */
139
    public Geometry cloneGeometry() {
140
        return new FilledSpline2DM(cloneCoordinates().toCoordinateArray());
141
        }
142

    
143
    /*
144
     * (non-Javadoc)
145
     *
146
     * @see org.gvsig.fmap.geom.jts.GeometryJTS#getJTS()
147
     */
148
    public com.vividsolutions.jts.geom.Geometry getJTS() {
149
        return JTSUtils.createJTSPolygon(getSplineCoordinates());
150
    }
151

    
152

    
153
    /* (non-Javadoc)
154
     * @see org.gvsig.fmap.geom.Geometry#offset(double)
155
     */
156
    public Geometry offset(double distance) throws GeometryOperationNotSupportedException, GeometryOperationException {
157
        return JTSUtils.createGeometry(getJTS().buffer(distance));
158
    }
159

    
160
    /* (non-Javadoc)
161
     * @see org.gvsig.fmap.geom.jts.primitive.curve.spline.AbstractSpline#reProject(org.cresques.cts.ICoordTrans)
162
     */
163
    @Override
164
    public void reProject(ICoordTrans ct) {
165
        super.reProject(ct);
166
        if (coordinates.size()>=2 && !isClosed()) {
167
            closePrimitive();
168
        }
169
    }
170
}