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

History | View | Annotate | Download (5.65 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.BaseSpline3DM;
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 FilledSpline3DM extends BaseSpline3DM implements FilledSpline {
46

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

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

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

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

    
73
    }
74

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

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

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

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

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

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

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

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

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

    
153

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

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