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 / FilledSpline2D.java @ 42477

History | View | Annotate | Download (5.71 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 java.util.Iterator;
26

    
27
import com.vividsolutions.jts.geom.Coordinate;
28

    
29
import org.cresques.cts.ICoordTrans;
30

    
31
import org.gvsig.fmap.geom.Geometry;
32
import org.gvsig.fmap.geom.jts.GeometryJTS;
33
import org.gvsig.fmap.geom.jts.primitive.curve.spline.BaseSpline2D;
34
import org.gvsig.fmap.geom.jts.util.JTSUtils;
35
import org.gvsig.fmap.geom.operation.GeometryOperationException;
36
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException;
37
import org.gvsig.fmap.geom.primitive.FilledSpline;
38
import org.gvsig.fmap.geom.primitive.Line;
39
import org.gvsig.fmap.geom.primitive.Polygon;
40
import org.gvsig.fmap.geom.primitive.Ring;
41
import org.gvsig.fmap.geom.primitive.SurfaceAppearance;
42

    
43

    
44
/**
45
 * @author fdiaz
46
 *
47
 */
48
public class FilledSpline2D extends BaseSpline2D implements FilledSpline {
49

    
50
    /**
51
     *
52
     */
53
    private static final long serialVersionUID = 8857987884304738266L;
54

    
55
    /**
56
     *
57
     */
58
    public FilledSpline2D() {
59
        super(Geometry.TYPES.FILLEDSPLINE);
60
    }
61

    
62
    /**
63
     * @param coordinates
64
     */
65
    public FilledSpline2D(Coordinate[] coordinates) {
66
        super(Geometry.TYPES.FILLEDSPLINE, coordinates);
67
        closePrimitive();
68
    }
69

    
70
    /* (non-Javadoc)
71
     * @see org.gvsig.fmap.geom.primitive.Surface#setSurfaceAppearance(org.gvsig.fmap.geom.primitive.SurfaceAppearance)
72
     */
73
    public void setSurfaceAppearance(SurfaceAppearance app) {
74
        // TODO Auto-generated method stub
75

    
76
    }
77

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

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

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

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

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

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

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

    
140
    /* (non-Javadoc)
141
     * @see org.gvsig.fmap.geom.Geometry#cloneGeometry()
142
     */
143
    public Geometry cloneGeometry() {
144
        return new FilledSpline2D(cloneCoordinates().toCoordinateArray());
145
        }
146

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

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

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