Java Code Examples for org.geotools.geometry.jts.ReferencedEnvelope#translate()

The following examples show how to use org.geotools.geometry.jts.ReferencedEnvelope#translate() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SwtMapPane.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Called after the base image has been dragged. Sets the new map area and transforms
 *
 * @param env
 *            the display area (world coordinates) prior to the image being moved
 * @param paintArea
 *            the current drawing area (screen units)
 */
private void afterImageMove() {
	final ReferencedEnvelope env = content.getViewport().getBounds();
	if (env == null) { return; }
	final int dx = imageOrigin.x;
	final int dy = imageOrigin.y;
	final DirectPosition2D newPos = new DirectPosition2D(dx, dy);
	screenToWorld.transform(newPos, newPos);

	env.translate(env.getMinimum(0) - newPos.x, env.getMaximum(1) - newPos.y);
	doSetDisplayArea(env);
	imageOrigin.setLocation(0, 0);
	redrawBaseImage = true;
}