It also returns the zoomFactor and numLevels
504687
public function dpEncode() {
        if(count($this->points) > 2) {
            
            $stack[] = array(0, count($this->points)-1);
            
            while(count($stack) > 0) {
                $current = array_pop($stack);
                $maxDist = 0;
                $absMaxDist = 0;
                
                for($i = $current[0]+1; $i < $current[1]; $i++) {
                    $temp = self::distance($this->points[$i], $this->points[$current[0]], $this->points[$current[1]]);
                    if($temp > $maxDist) {
                        $maxDist = $temp;
                        $maxLoc = $i;
                        if($maxDist > $absMaxDist) {
                            $absMaxDist = $maxDist;
                        }
                    }
                }
                
                if($maxDist > $this->verySmall) {
                    $dists[$maxLoc] = $maxDist;
                    array_push($stack, array($current[0], $maxLoc));
                    array_push($stack, array($maxLoc, $current[1]));
                }
            }
        }
    
        $encodedPoints = self::createEncodings($this->points, $dists);
        $encodedLevels = self::encodeLevels($this->points, $dists, $absMaxDist);
        $encodedPointsLiteral = str_replace('\\',"\\\\",$encodedPoints);
        
        $polyline["Points"] = $encodedPoints;
        $polyline["Levels"] = $encodedLevels;
        $polyline["PointsLiteral"] = $encodedPointsLiteral;
        $polyline["ZoomFactor"] = $this->zoomFactor;
        $polyline["NumLevels"] = $this->numLevels;
        
        return $polyline;
    }
43371
function(evt) {
        OpenLayers.Control.PanZoom.prototype.onButtonClick.apply(this, arguments);
        if (evt.buttonElement === this.zoombarDiv) {
            var levels = evt.buttonXY.y / this.zoomStopHeight;
            if(this.forceFixedZoomLevel || !this.map.fractionalZoom) {
                levels = Math.floor(levels);
            }    
            var zoom = (this.map.getNumZoomLevels() - 1) - levels; 
            zoom = Math.min(Math.max(zoom, 0), this.map.getNumZoomLevels() - 1);
            this.map.zoomTo(zoom);
        }
    }
425828
public function getZoomSettings(): int
    {
	    return (int)$this->_scopeConfig->getValue(self::ZOOM_CONFIG_PATH, ScopeInterface::SCOPE_STORE);
    }
1340608
function zoomCondition(zoom) {
    var zooms = [];
    for (var i = 0; i <= _carto2['default'].tree.Zoom.maxZoom; i++) {
        if (zoom & 1 << i) {
            zooms.push(i);
        }
    }

    var zoomRanges = detectZoomRanges(zooms),
        value,
        operator;
    if (zoomRanges.length > 1) {
        operator = 'IN';
        value = zooms;
    } else {
        var range = zoomRanges[0];
        if (range[0] === 0) {
            operator = '<=';
            value = range[1];
        } else if (range[1] === _carto2['default'].tree.Zoom.maxZoom) {
            operator = '>=';
            value = range[0];
        } else {
            // We're only handling >=, <= and IN right now
            operator = 'IN';
            value = zooms;
        }
    }

    if (value.length === 0) {
        return null;
    }
    return [{
        operator: operator,
        type: 'zoom',
        value: value
    }];
}
846831
def _getOccurs(self, e):
        ''' 
        '''
        minOccurs = maxOccurs = '1'
        nillable = True
        return minOccurs,maxOccurs,nillable
159193
def zoom_in(self):
        """"""
        if self._scalefactor <= self._sfmax:
            self._scalefactor += 1
            self.scale_image()
            self._adjust_scrollbar(self._scalestep)
            self.sig_zoom_changed.emit(self.get_scaling())
728864
public int getZoomLevel() {
		Projection projection = getProjection();
		if (projection == null) {
			throw new GeoPackageException(
					"No projection was set which is required to determine the zoom level");
		}
		int zoomLevel = 0;
		BoundingBox boundingBox = getBoundingBox();
		if (boundingBox != null) {
			if (projection.isUnit(Units.DEGREES)) {
				boundingBox = TileBoundingBoxUtils
						.boundDegreesBoundingBoxWithWebMercatorLimits(boundingBox);
			}
			ProjectionTransform webMercatorTransform = projection
					.getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR);
			BoundingBox webMercatorBoundingBox = boundingBox
					.transform(webMercatorTransform);
			zoomLevel = TileBoundingBoxUtils
					.getZoomLevel(webMercatorBoundingBox);
		}
		return zoomLevel;
	}
664972
def zoom_fit(self, no_reset=False):
        
        # calculate actual width of the limits/image, considering rotation
        try:
            xy_mn, xy_mx = self.get_limits()

        except ImageViewNoDataError:
            return

        try:
            wwidth, wheight = self.get_window_size()
            self.logger.debug("Window size is %dx%d" % (wwidth, wheight))
            if self.t_['swap_xy']:
                wwidth, wheight = wheight, wwidth
        except Exception:
            return

        # zoom_fit also centers image
        with self.suppress_redraw:

            self.center_image(no_reset=no_reset)

            ctr_x, ctr_y, rot_deg = self.get_rotation_info()

            # Find min/max extents of limits as shown by viewer
            xs = np.array((xy_mn[0], xy_mx[0], xy_mx[0], xy_mn[0]))
            ys = np.array((xy_mn[1], xy_mn[1], xy_mx[1], xy_mx[1]))
            x0, y0 = trcalc.rotate_pt(xs, ys, rot_deg, xoff=ctr_x, yoff=ctr_y)

            min_x, min_y = np.min(x0), np.min(y0)
            max_x, max_y = np.max(x0), np.max(y0)

            width, height = max_x - min_x, max_y - min_y
            if min(width, height) <= 0:
                return

            # Calculate optimum zoom level to still fit the window size
            scale_x = (float(wwidth) /
                       (float(width) * self.t_['scale_x_base']))
            scale_y = (float(wheight) /
                       (float(height) * self.t_['scale_y_base']))

            scalefactor = min(scale_x, scale_y)
            # account for t_[scale_x/y_base]
            scale_x = scalefactor * self.t_['scale_x_base']
            scale_y = scalefactor * self.t_['scale_y_base']

            self._scale_to(scale_x, scale_y, no_reset=no_reset)

        if self.t_['autozoom'] == 'once':
            self.t_.set(autozoom='off')
1142172
def _get_axis_dims(self, element):
        
        dims = element.dimensions()[:2]
        if len(dims) == 1:
            return dims + [None, None]
        else:
            return dims + [None]
797836
function () {
            var state = this.state,
                fitWidth = this.calculateZoomValue(ZOOM_FIT_WIDTH),
                fitHeight = this.calculateZoomValue(ZOOM_FIT_HEIGHT);

            // landscape
            if (state.widestPage.actualWidth > state.tallestPage.actualHeight) {
                return Math.min(fitWidth, fitHeight);
            }
            // portrait
            else {
                if (browser.mobile) {
                    return fitHeight;
                }
                // limit max zoom to 1.0
                return Math.min(1, fitHeight);
            }
        }
460341
function (mode) {
            var state = this.state,
                val = parseFloat(mode);
            if (val) {
                return val;
            }
            if (mode === Crocodoc.ZOOM_FIT_WIDTH) {
                return state.viewportDimensions.clientWidth / state.widestPage.totalActualWidth;
            }
            else if (mode === Crocodoc.ZOOM_FIT_HEIGHT) {
                return state.viewportDimensions.clientHeight / state.tallestPage.totalActualHeight;
            }
            else if (mode === Crocodoc.ZOOM_AUTO) {
                return this.calculateZoomAutoValue();
            } else {
                return state.zoomState.zoom;
            }
        }
852546
function() {
        if (this.defaultZoomLevel) {
            return this.defaultZoomLevel;
        }

        var aspectFactor = this._contentAspectRatio / this.getAspectRatio();
        var output;
        if (this.homeFillsViewer) { // fill the viewer and clip the image
            output = aspectFactor >= 1 ? aspectFactor : 1;
        } else {
            output = aspectFactor >= 1 ? 1 : aspectFactor;
        }

        return output / this._contentBounds.width;
    }
605852
def zoom(self, factor):
        """"""
        editor = self.get_current_editorstack().get_current_editor()
        if factor == 0:
            font = self.get_plugin_font()
            editor.set_font(font)
        else:
            font = editor.font()
            size = font.pointSize() + factor
            if size > 0:
                font.setPointSize(size)
                editor.set_font(font)
        editor.update_tab_stop_width_spaces()
17961
private static int getScaleFactor(ImageMetadata metadata, int maxPixels) {
        int scale = 1;
        int scaledW = metadata.getW();
        int scaledH = metadata.getH();
        while (scaledW * scaledH > maxPixels) {
            scale *= 2;
            scaledH /= 2;
            scaledW /= 2;
        }
        return scale;
    }
313052
function scaleLog () {

            var zoomFactor = $.pinchZoomFactor(),
                logProps = {

                    top:           ( initialLogProps.top / zoomFactor ) + "px",
                    left:          ( initialLogProps.left / zoomFactor ) + "px",
                    paddingTop:    ( initialLogProps.paddingTop / zoomFactor ) + "px",
                    paddingLeft:   ( initialLogProps.paddingLeft / zoomFactor ) + "px",
                    paddingBottom: ( initialLogProps.paddingBottom / zoomFactor ) + "px",
                    paddingRight:  ( initialLogProps.paddingRight / zoomFactor ) + "px",
                    minWidth:      ( initialLogProps.minWidth / zoomFactor ) + "px",
                    maxWidth:      ( initialLogProps.maxWidth / zoomFactor ) + "px"

                },
                dtProps = {
                    fontSize:   ( initialLogProps.dtFontSize / zoomFactor ) + "px",
                    lineHeight: ( initialLogProps.dtLineHeight / zoomFactor ) + "px",
                    minWidth:   ( initialLogProps.dtMinWidth / zoomFactor ) + "px"
                },
                ddProps = {
                    fontSize:   ( initialLogProps.ddFontSize / zoomFactor ) + "px",
                    lineHeight: ( initialLogProps.ddLineHeight / zoomFactor ) + "px"
                },
                dlProps = {
                    fontSize:     ( initialLogProps.dlFontSize / zoomFactor ) + "px",
                    lineHeight:   ( initialLogProps.dlLineHeight / zoomFactor ) + "px",
                    marginBottom: ( initialLogProps.dlMarginBottom / zoomFactor ) + "px"
                },
                hrProps = {
                    marginTop:    ( initialLogProps.hrMarginTop / zoomFactor ) + "px",
                    marginBottom: ( initialLogProps.hrMarginBottom / zoomFactor ) + "px"
                };

            $logPane.css( logProps );
            $( "dt", $logPane ).css( dtProps );
            $( "dd", $logPane ).css( ddProps );
            $( "dl", $logPane ).css( dlProps );
            $( "hr", $logPane ).css( hrProps );
        }
661922
def get_extents(self, element, ranges, range_type='combined'):
        
        if range_type == 'extents':
            return element.nodes.extents
        xdim, ydim = element.nodes.kdims[:2]
        xpad = .05 if self.label_index is None else 0.25
        x0, x1 = ranges[xdim.name][range_type]
        y0, y1 = ranges[ydim.name][range_type]
        xdiff = (x1-x0)
        ydiff = (y1-y0)
        if self.label_position == 'right':
            x0, x1 = x0-(0.05*xdiff), x1+xpad*xdiff
        else:
            x0, x1 = x0-xpad*xdiff, x1+(0.05*xdiff)
        x0, x1 = max_range([xdim.range, (x0, x1)])
        y0, y1 = max_range([ydim.range, (y0-(0.05*ydiff), y1+(0.05*ydiff))])
        return (x0, y0, x1, y1)
940110
def apply_zoom_factor(self):
        """"""
        if hasattr(self, 'setZoomFactor'):
            # Assuming Qt >=v4.5
            self.setZoomFactor(self.zoom_factor)
        else:
            # Qt v4.4
            self.setTextSizeMultiplier(self.zoom_factor)