Revision 42283 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/aggregate/MultiPolygon3DM.java

View differences:

MultiPolygon3DM.java
140 140
     * @see org.gvsig.fmap.geom.jts.aggregate.AbstractMultiPrimitive#fixPrimitive(org.gvsig.fmap.geom.primitive.Primitive)
141 141
     */
142 142
    @Override
143
    protected Primitive fixPrimitive(Primitive primitive) {
144
        if(!(primitive instanceof Polygon3DM)){
145
            String message = "Only Polygon3DM primitives can be added to a MultiPolygon3DM";
146
            notifyDeprecated(message);
147
            throw new UnsupportedOperationException(message);
143
    protected Geometry fixPrimitive(Primitive primitive) {
144
        if(primitive instanceof Polygon3DM){
145
            return primitive;
148 146
        }
149
        return primitive;
147

  
148
        if(primitive.getGeometryType().getSubType() == Geometry.SUBTYPES.GEOM3DM){
149
            MultiPolygon polygons;
150
            try {
151
                polygons = primitive.toPolygons();
152
            } catch (GeometryException e) {
153
                String message = "Can't convert primitive to polygons";
154
                logger.warn(message);
155
                throw new RuntimeException(message);
156
            }
157
            return polygons;
158
        }
159

  
160
        String message = "Only 3DM primitives can be fixed to MultiPolygon3DM";
161
        notifyDeprecated(message);
162
        throw new UnsupportedOperationException(message);
150 163
    }
151 164
}

Also available in: Unified diff