Boundary GUIPointOfInterest::getCenteringBoundary() const { Boundary b; b.add(x(), y()); b.growWidth(myHalfImgWidth); b.growHeight(myHalfImgHeight); return b; }
Boundary GUIPerspectiveChanger::patchedViewPort() { // avoid division by zero if (myCallback.getHeight() == 0 || myCallback.getWidth() == 0 || myViewPort.getHeight() == 0 || myViewPort.getWidth() == 0) { return myViewPort; } Boundary result = myViewPort; SUMOReal canvasRatio = (SUMOReal)myCallback.getWidth() / myCallback.getHeight(); SUMOReal ratio = result.getWidth() / result.getHeight(); if (ratio < canvasRatio) { result.growWidth(result.getWidth() * (canvasRatio / ratio - 1) / 2); } else { result.growHeight(result.getHeight() * (ratio / canvasRatio - 1) / 2); } return result; }