コード例 #1
0
 /// <summary>
 /// Function to compute the denominator of the viewport's scale when using a given <paramref name="dpi"/> resolution.
 /// </summary>
 /// <param name="dpi">The resolution</param>
 /// <returns>The scale's denominator</returns>
 public double GetMapScale(int dpi)
 {
     // Why lock?
     lock (_lockMapScale)
     {
         if (_lastDpi != dpi)
         {
             _mapScale = ScaleCalculations.CalculateScaleNonLatLong(Envelope.Width, Size.Width, 1, dpi);
             _lastDpi  = dpi;
         }
         return(_mapScale);
     }
 }
コード例 #2
0
        /// <summary>
        /// Function to compute the denominator of the viewport's scale when using a given <paramref name="dpi"/> resolution.
        /// </summary>
        /// <param name="dpi">The resolution</param>
        /// <returns>The scale's denominator</returns>
        public double GetMapScale(int dpi)
        {
            if (_lastDpi != dpi)
            {
                lock (_lockMapScale)
                    if (_lastDpi != dpi)
                    {
                        _mapScale = ScaleCalculations.CalculateScaleNonLatLong(Zoom, Size.Width, 1, dpi);
                        _lastDpi  = dpi;
                    }
            }

            return(_mapScale);
        }
コード例 #3
0
        /// <summary>
        /// Calculate the scale and store it in <see cref="_scale"/>.
        /// <para>
        /// It should be called to calculate the real map scale everytime the user change mapunit or set the scale
        /// </para>
        /// </summary>
        private void CalcScale(int dpi)
        {
            double fScale;

            if (_mapUnit == (int)Unit.Degree) //LatLong
            {
                fScale = ScaleCalculations.CalculateScaleLatLong(_lon1, _lon2, _lat, _pageWidth, dpi);
            }
            else
            {
                fScale = ScaleCalculations.CalculateScaleNonLatLong(_mapWidth, _pageWidth, _mapUnitFactor, dpi);
            }
            _scale = fScale;
        }
コード例 #4
0
 public double GetMapScale(int dpi)
 {
     return(ScaleCalculations.CalculateScaleNonLatLong(Envelope.Width, Size.Width, 1, dpi));
 }