132 |
132 |
* @see org.gvsig.fmap.dal.coverage.datastruct.Extent#encloseBoundinBoxes(org.gvsig.fmap.dal.coverage.datastruct.Extent)
|
133 |
133 |
*/
|
134 |
134 |
public Extent encloseBoundinBoxes(Extent ext) {
|
135 |
|
Point2D pUl = new Point2D.Double(Math.min(getULX(), ext.getULX()), Math.max(getULY(), ext.getULY()));
|
136 |
|
Point2D pLr = new Point2D.Double(Math.max(getLRX(), ext.getLRX()), Math.min(getLRY(), ext.getLRY()));
|
|
135 |
Point2D pUl = new Point2D.Double(
|
|
136 |
Math.min(getULX(), ext.getULX()),
|
|
137 |
Math.max(getULY(), ext.getULY()));
|
|
138 |
Point2D pLr = new Point2D.Double(
|
|
139 |
Math.max(getLRX(), ext.getLRX()),
|
|
140 |
Math.min(getLRY(), ext.getLRY()));
|
137 |
141 |
return new ExtentImpl(pUl, pLr);
|
138 |
142 |
}
|
139 |
143 |
|
|
144 |
/*
|
|
145 |
* (non-Javadoc)
|
|
146 |
* @see org.gvsig.fmap.dal.coverage.datastruct.Extent#intersection(org.gvsig.fmap.dal.coverage.datastruct.Extent)
|
|
147 |
*/
|
|
148 |
public Extent intersection(Extent ext) {
|
|
149 |
if(intersects(ext)) {
|
|
150 |
Point2D pUl = new Point2D.Double(
|
|
151 |
Math.max(getULX(), ext.getULX()),
|
|
152 |
Math.min(getULY(), ext.getULY()));
|
|
153 |
Point2D pLr = new Point2D.Double(
|
|
154 |
Math.min(getLRX(), ext.getLRX()),
|
|
155 |
Math.max(getLRY(), ext.getLRY()));
|
|
156 |
return new ExtentImpl(pUl, pLr);
|
|
157 |
}
|
|
158 |
return null;
|
|
159 |
}
|
|
160 |
|
|
161 |
/*
|
|
162 |
* (non-Javadoc)
|
|
163 |
* @see org.gvsig.fmap.dal.coverage.datastruct.Extent#intersects(org.gvsig.fmap.dal.coverage.datastruct.Extent)
|
|
164 |
*/
|
|
165 |
public boolean intersects(Extent ext) {
|
|
166 |
if (getMin().getX() > ext.getMax().getX())
|
|
167 |
return false;
|
|
168 |
else if (getMax().getX() < ext.getMin().getX())
|
|
169 |
return false;
|
|
170 |
if (getMin().getY() > ext.getMax().getY())
|
|
171 |
return false;
|
|
172 |
else if (getMax().getY() < ext.getMin().getY())
|
|
173 |
return false;
|
|
174 |
return true;
|
|
175 |
}
|
|
176 |
|
140 |
177 |
/*ax
|
141 |
178 |
* (non-Javadoc)
|
142 |
179 |
* @see org.gvsig.fmap.dal.coverage.datastruct.Extent#getGridExtent(double)
|