150 double ratio = result.getWidth() / result.getHeight();
151 if (ratio < canvasRatio) {
152 result.growWidth(result.getWidth() * (canvasRatio / ratio - 1) / 2);
154 result.growHeight(result.getHeight() * (ratio / canvasRatio - 1) / 2);
A class that stores a 2D geometrical boundary.
GUISUMOAbstractView & myCallback
The parent window (canvas to scale).
virtual long onKeyPress(void *data)
called when user press a key
virtual void onRightBtnPress(void *data)
called when user press right button
virtual ~GUIPerspectiveChanger()
Destructor.
virtual bool onLeftBtnRelease(void *data)
called when user releases left button
Boundary myViewPort
the intended viewport
GUIPerspectiveChanger(GUISUMOAbstractView &callBack, const Boundary &viewPort)
Constructor.
virtual void onLeftBtnPress(void *data)
mouse functions
FXint getMouseXPosition() const
Returns the last mouse x-position an event occurred at.
virtual bool onMiddleBtnRelease(void *data)
called when user releases middle button
virtual void onDoubleClicked(void *data)
called when user click two times
virtual void onMiddleBtnPress(void *data)
called when user press middle button
FXint getMouseYPosition() const
Returns the last mouse y-position an event occurred at.
virtual long onKeyRelease(void *data)
called when user releases a key
Boundary patchedViewPort()
patched viewPort with the same aspect ratio as the canvas
FXint myMouseXPosition
the current mouse position
virtual void onMouseMove(void *data)
called when user moves mouse
virtual void onMouseWheel(void *data)
called when user changes mouse wheel
virtual bool onRightBtnRelease(void *data)
called when user releases right button
Boundary getViewport(bool fixRatio=true)
get viewport
virtual void setViewport(double zoom, double xPos, double yPos)=0
Sets the viewport Used for: Adapting a new viewport.