/**
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
*/
@Override
protected IFigure createFigure() {
final ScannedMap m = (ScannedMap) getModel();
final Display display = Display.getDefault();
final Image image = new Image(display, m.getFileName());
final ImageData imageData = image.getImageData();
final double north = m.getNorth().getVal();
final double south = m.getSouth().getVal();
final double west = m.getWest().getVal();
final double east = m.getEast().getVal();
final double dlat = north - south;
final double dlon = east - west;
final double latCenter = south + dlat / 2;
final double lonCenter = west + dlon / 2;
final Position center = new Position(latCenter, lonCenter);
final Position nCenter = new Position(north, lonCenter);
final Position eCenter = new Position(latCenter, east);
final double latDist = center.distance(nCenter);
final double lonDist = center.distance(eCenter);
final int width = m.getUpperleft().distance(m.getUpperright());
final int height = m.getUpperleft().distance(m.getLowerleft());
final int w = width;
final int h = (int) Math.min(2000, height * latDist / lonDist);
final Vector2d p0 = new Vector2d(m.getUpperleft().getX(), m.getUpperleft().getY());
final Vector2d vx = new Vector2d(m.getUpperright().getX(), m.getUpperright().getY()).minus(
p0).div(w);
final Vector2d vy = new Vector2d(m.getLowerleft().getX(), m.getLowerleft().getY())
.minus(p0).div(h);
_coordinateSystem = new CoordinateSystem();
_coordinateSystem.setOrigin(new Position(m.getNorth(), m.getWest()));
_coordinateSystem.setDx(new Vector2d(m.getEast().diff(m.getWest()) / w, 0));
_coordinateSystem.setDy(new Vector2d(0, m.getSouth().diff(m.getNorth()) / h));
ImageData id = (ImageData) imageData.clone();
id = id.scaledTo(w, h);
for (int y = 0; y < h; y++) {
final Vector2d p = (Vector2d) p0.clone();