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 @ 42464

History | View | Annotate | Download (5.68 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
    }
68

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

    
75
    }
76

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

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

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

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

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

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

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

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

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

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

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