コード例 #1
0
ファイル: TestGridForm1.cs プロジェクト: nakijun/mapwindow
        /// <summary>
        /// Creates a new instance of the test grid form
        /// </summary>
        public TestGridForm1()
        {
            InitializeComponent();

            axMap1.Measuring.MeasuringType = tkMeasuringType.MeasureArea;

            GeoProjection pr = new GeoProjection();

            pr.SetGoogleMercator();
            Debug.Print(pr.ExportToWKT());
            axMap1.ShowVersionNumber = true;

            GridHelper.Initialize(axMap1, this);
            MapHelper.Initialize(axMap1, this);

            axMap1.TileProvider    = tkTileProvider.OpenStreetMap;
            axMap1.ShowRedrawTime  = true;
            axMap1.ScalebarVisible = true;

            cboScalebarUnits.SetEnum(typeof(tkScalebarUnits));
            cboColoring.SetEnum(typeof(ColoringType));
            cboColoringScheme.SetEnum(typeof(PredefinedColorScheme));
            cboProxyFormat.SetEnum(typeof(tkGridProxyFormat));
            cboProxyMode.SetEnum(typeof(tkGridProxyMode));
            cboCountry.SetEnum(typeof(tkKnownExtents));
            cboCoordinates.SetEnum(typeof(tkCoordinatesDisplay));
            cboZoomBehavior.SetEnum(typeof(tkZoomBehavior));

            cboActiveProxyMode.Items.Add("Proxy");
            cboActiveProxyMode.Items.Add("Direct rendering");

            InitGlobalSettings();

            cboProxyFormat.SelectedIndexChanged += (s, e) => UpdateGlobalSettings();
            cboProxyMode.SelectedIndexChanged   += (s, e) => UpdateGlobalSettings();
            udMaxSizeWoProxy.ValueChanged       += (s, e) => UpdateGlobalSettings();

            InitListbox();

            this.axMap1.PreviewKeyDown += delegate(object sender, PreviewKeyDownEventArgs e)
            {
                switch (e.KeyCode)
                {
                case Keys.Left:
                case Keys.Right:
                case Keys.Up:
                case Keys.Down:
                    e.IsInputKey = true;
                    return;
                }
            };

            axMap1.LayerRemoved += (s, e) => AxMap1LayersChanged(s, new EventArgs());
            axMap1.LayerAdded   += (s, e) => AxMap1LayersChanged(s, new EventArgs());

            axMap1.ScalebarVisible   = false;
            axMap1.ShowVersionNumber = false;
            axMap1.ShowRedrawTime    = false;
        }