Esempio n. 1
0
        public void reset()
        {
            LayerManager layerManager = mainControler.LayerManager;

            if (layerManager.LayerCount > 0)
            {
                PointD newD = new PointD();
                DRect worldBox =layerManager.getWorldBBox();
                double zoomFactor = calculateZoomFactor(worldBox.Width * layerManager.Scale, worldBox.Height * layerManager.Scale);
                double newAbsoluteZoom = absoluteZoom * zoomFactor;

                newD.x = worldBox.Left * layerManager.FirstScale * newAbsoluteZoom;
                newD.y= worldBox.Bottom * layerManager.FirstScale * newAbsoluteZoom;

                ZoomAction reset =
                    new ZoomAction(absoluteZoom, d, newD, newAbsoluteZoom,
                        new PointD(drawingArea.Width * 0.5, drawingArea.Height * 0.5),
                        layerManager.getMaxAbsoluteZoom(),
                        mainControler);

                if (mainControler.PerformAction(reset))
                {
                    mainControler.LayerManager.resetLayers();
                    mainForm.setStatusBarText("");
                    screenChanged = true;
                    this.Invalidate();

                }
                else
                {
                    mainForm.setStatus_Timed("Konnte keinen Reset durchführen!", 1000);
                }
            }
        }
Esempio n. 2
0
        public void onLayerZoom(int shownLayer)
        {
            this.shownLayer = shownLayer;
            Layer layer = mainControler.LayerManager.getLayerFromMapping(shownLayer);
            double scale = mainControler.LayerManager.Scale;
            double zoomFactor = calculateZoomFactor(layer.Width * scale, layer.Height * scale);
            PointD newD = new PointD();
            newD.x = layer.BoundingBox.Left * mainControler.LayerManager.FirstScale * absoluteZoom * zoomFactor;
            newD.y = layer.BoundingBox.Top * mainControler.LayerManager.FirstScale * absoluteZoom * zoomFactor;

            ZoomAction layerZoomAction = new ZoomAction(
                absoluteZoom, d, newD,
                absoluteZoom * zoomFactor,
                new PointD(drawingArea.Width / 2, drawingArea.Height / 2),
                mainControler.LayerManager.getMaxAbsoluteZoom(),
                mainControler);
            if (mainControler.PerformAction(layerZoomAction))
            {
                mainControler.LayerManager.resetLayers(); // -> prepareBitmap = true
                mainForm.setStatusBarText("");
                screenChanged = true;
                this.Invalidate();
            }
            else
            {
                mainForm.setStatus_Timed("Konnte keinen Reset durchführen!", 1000);
            }
        }