Skip to main content

EqualAreaProjection Class

A class that defines methods specific to the Equal Area Projection.

Namespace: DevExpress.Xpf.Map

Assembly: DevExpress.Xpf.Map.v24.1.dll

NuGet Package: DevExpress.Wpf.Map

Declaration

public class EqualAreaProjection :
    PredefinedProjectionBase

Remarks

For more information, refer to Geographical Projections.

Example

This example illustrates how to get equal-area map projections (Lambert, Behrmann, Tristan Edwards, Peters, Gall orthographic and Balthasart) for the shapes loaded from the Shapefiles (Countries.shp, Countries.dbf).

To accomplish this task, create an EqualAreaProjection object and assign it to the VectorLayerBase.MapProjection property. Then, specify the Width/height aspect ratio for each equal area projection using the VectorLayerBase.InitialMapSize property.

To learn more about the equal-area projections, see Cylindrical_equal-area_projection.

using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;

namespace AvoidMapDistortion {
    public partial class MainWindow : Window {
        public struct WidthHeightRatio {
            public string Name { get; set; }
            public double Value { get; set; }
        }

        int defaultSideSize = 512;
        List<WidthHeightRatio> ratios = new List<WidthHeightRatio>() {
            new WidthHeightRatio() { Name = "(Default)", Value = 1 },
            new WidthHeightRatio() { Name = "Lambert", Value = 3.14 },
            new WidthHeightRatio() { Name = "Behrmann", Value = 2.36 },
            new WidthHeightRatio() { Name = "Trystan Edwards", Value = 2.0 },
            new WidthHeightRatio() { Name = "Gall-Peters", Value = 1.57 },
            new WidthHeightRatio() { Name = "Balthasart", Value = 1.3 }
        };
        public List<WidthHeightRatio> Ratios { get { return ratios; } }

        public MainWindow() {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e) {
            this.DataContext = Ratios;
        }

        private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) {
            mapControl.InitialMapSize = new Size() {
                Width = defaultSideSize,
                Height = (int)(defaultSideSize / ((WidthHeightRatio)lbRatio.SelectedValue).Value)
            };
        }
    }
}

Inheritance

Object
ProjectionBase
DevExpress.Xpf.Map.PredefinedProjectionBase
EqualAreaProjection
See Also