Hello ,
I develop two zoom buttons for zoomIn and zoomOut , they are disabled in zoom level 18 and zoomlevel 0 respectively and on starting the application zoomOut button disabled . However at present i am trying to develop someting about mouse Wheel zooming that reach zoom level 18 and disable ZoomIn Button and samething happen when mouse wheel zooming reached zoom level 0 , zoomOut button will be disable at that certain level and activated zoomIn button while mouse wheel zoom will be going down (ZoomOut action happening). i attach the code what i have done till now . it would be great have a idea or procedure from you.
@Override
public void initialize(URL location, ResourceBundle resources) {
this.mapView = new MapView();
this.map = new IJMSMap(this.mapView);
zoomOut.setDisable(true);
Scalebar scaleBar = new Scalebar(mapView);
scaleBar.setSkinStyle(Scalebar.SkinStyle.GRADUATED_LINE);
scaleBar.setUnitSystem(UnitSystem.METRIC);
Color transparentWhite = new Color(1, 1, 1, 0.7);
scaleBar.setBackground(new Background(new BackgroundFill(transparentWhite, new CornerRadii(5), Insets.EMPTY)));
}
this.PanButtonContainerPane.getChildren().addAll(mapView,scaleBar);
this.PanButtonContainerPane.setAlignment(scaleBar, Pos.TOP_LEFT);
this.movePanNorth.toFront();
this.movePanEast.toFront();
this.MovePanSouth.toFront();
this.movePanWest.toFront();
this.zoomBtnVbox.toFront();
}
#ActionEvent for ZoomIn function
public void zoomInAction(ActionEvent event) {
zoomOut.setDisable(false);
map.zoomInFunction();
if (mapView.getMapScale() <= 2256.994353) {
zoomIn.setDisable(true);
}
}
#ActionEvent for ZoomOut function
public void zoomOutAction(ActionEvent event) {
zoomIn.setDisable(false);
map.zoomOutFunction();
if (mapView.getMapScale() >= 7.3957190948944E7) {
zoomOut.setDisable(true);
}
}
#Method for zoomIn function
public void zoomInFunction() {
Viewpoint current = mapView.getCurrentViewpoint(Viewpoint.Type.CENTER_AND_SCALE);
Viewpoint zoomedIn = new Viewpoint((Point) current.getTargetGeometry(), current.getTargetScale() / 2.0);
mapView.setViewpointAsync(zoomedIn);
}
#Method for zoomOut function
public void zoomOutFunction()
{
Viewpoint current = mapView.getCurrentViewpoint(Viewpoint.Type.CENTER_AND_SCALE);
Viewpoint zoomedIn = new Viewpoint((Point) current.getTargetGeometry(), current.getTargetScale() * 2.0);
mapView.setViewpointAsync(zoomedIn);
}