Revision 41417 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.impl/src/main/java/org/gvsig/fmap/geom/primitive/impl/Envelope2D.java

View differences:

Envelope2D.java
188 188
    public Object clone() throws CloneNotSupportedException {
189 189
        return super.clone();
190 190
    }
191

  
192
    private void createPoints() {
193
        this.min = new Point2D(0, 0);
194
        this.max = new Point2D(0, 0);
195
    }
196
    
197
    public void add(Envelope envelope) {
198
        int i;
199
        if( envelope==null && envelope.isEmpty() ) {
200
            return;
201
        }
202
        if (isEmpty){
203
            createPoints();
204
            for (i=0;i<getDimension();i++){
205
                this.min.setCoordinateAt(i, envelope.getMinimum(i));
206
                this.max.setCoordinateAt(i, envelope.getMaximum(i));
207
            }
208
            isEmpty = false;
209
        } else {
210
            for (i=0;i<getDimension();i++){
211
                this.min.setCoordinateAt(i,
212
                    Math.min(this.min.getCoordinateAt(i), envelope.getMinimum(i)));
213
                this.max.setCoordinateAt(i,
214
                    Math.max(this.max.getCoordinateAt(i), envelope.getMaximum(i)));
215
            }
216
        }
217
    }
191 218
}
192 219

  

Also available in: Unified diff