public class ViewportPolicy extends AbstractPolicy
adaptable
adaptable
IAdaptable.Bound.Impl<T extends IAdaptable>
Constructor and Description |
---|
ViewportPolicy() |
Modifier and Type | Method and Description |
---|---|
protected ITransactionalOperation |
createOperation()
Creates an
ITransactionalOperation that is used to encapsulate
the changes that are applied by this AbstractPolicy through its
"work" methods. |
void |
fitToSize()
Centers the contents within the viewport and zooms the viewport so that
the contents are fully visible.
|
void |
fitToSize(double zoomMin)
Centers the contents within the viewport and zooms the viewport so that
the contents are fully visible (if possible given the specified zoom
factor range).
|
void |
fitToSize(double zoomMin,
double zoomMax)
Centers the contents within the viewport and zooms the viewport so that
the contents are fully visible (if possible given the specified zoom
factor range).
|
protected ChangeViewportOperation |
getChangeViewportOperation()
Returns an
ChangeViewportOperation that is extracted from the
operation created by createOperation() . |
void |
scroll(boolean concatenate,
double deltaTranslateX,
double deltaTranslateY)
Advances the viewport transformation by the given translation values.
|
void |
setScroll(double tx,
double ty)
Sets the x and y translation of the viewport to the given values.
|
void |
setZoom(double zoom)
Sets the x and y scaling of the viewport to the given zoom factor.
|
void |
zoom(boolean concatenate,
boolean discretize,
double relativeZoom,
double sceneX,
double sceneY)
Concatenates a scaling transformation to the current viewport
transformation.
|
checkInitialized, commit, getOperation, init, isInitialized, locallyExecuteOperation, rollback
adaptableProperty, getAdaptable, setAdaptable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
adaptableProperty, getAdaptable, setAdaptable
protected ITransactionalOperation createOperation()
AbstractPolicy
ITransactionalOperation
that is used to encapsulate
the changes that are applied by this AbstractPolicy
through its
"work" methods. The created operation should allow for
local execution
at each time.createOperation
in class AbstractPolicy
ITransactionalOperation
to encapsulate all applied
changes.public void fitToSize()
public void fitToSize(double zoomMin)
zoomMin
- The minimum zoom factor.public void fitToSize(double zoomMin, double zoomMax)
zoomMin
- The minimum zoom factor.zoomMax
- The maximum zoom factor.protected ChangeViewportOperation getChangeViewportOperation()
ChangeViewportOperation
that is extracted from the
operation created by createOperation()
.ChangeViewportOperation
that is extracted from the
operation created by createOperation()
.public void scroll(boolean concatenate, double deltaTranslateX, double deltaTranslateY)
concatenate
- true
to concatenate the specified zoom to the
current transformation, false
to not concatenate
the specified scroll to the current but to the initial
transformation.deltaTranslateX
- The horizontal translation delta.deltaTranslateY
- The vertical translation delta.public void setScroll(double tx, double ty)
tx
- The new x translation.ty
- The new y translation.public void setZoom(double zoom)
zoom
- The new x and y scaling for the viewport.public void zoom(boolean concatenate, boolean discretize, double relativeZoom, double sceneX, double sceneY)
concatenate
- true
to concatenate the specified zoom to the
current transformation, false
to not concatenate
the specified zoom to the current but to the initial
transformation.discretize
- true
to discretize the resulting zoom level, i.e.
round it to 6 decimal places and do not skip integer zoom
levels, false
to not change the resulting zoom
level.relativeZoom
- The scale factor.sceneX
- The pivot x-coordinate.sceneY
- The pivot y-coordinate.Copyright (c) 2014, 2016 itemis AG and others. All rights reserved.