Beispiel #1
0
        /// <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;
        }
Beispiel #2
0
        /// <summary>
        /// Shows information about selected projection
        /// </summary>
        /// <param name="projection"></param>
        public void ShowProjection(CoordinateSystem projection)
        {
            if (projection == null)
            {
                throw new NullReferenceException("Geoprojection wasn't passed");
            }

            txtName.Text = projection.Name;
            txtCode.Text = projection.Code.ToString();

            m_proj = new MapWinGIS.GeoProjection();
            if (!m_proj.ImportFromEPSG(projection.Code))
            {
                // usupported projection
            }
            else
            {
                projectionTextBox1.ShowProjection(m_proj.ExportToWKT());

                projectionMap1.DrawCoordinateSystem(projection);
                projectionMap1.ZoomToCoordinateSystem(projection);

                txtProj4.Text = m_proj.ExportToProj4();

                txtAreaName.Text = projection.AreaName;
                txtRemarks.Text  = projection.Remarks;
                txtScope.Text    = projection.Scope;
            }

            // showing dialects
            if (m_coordinateSystem != null)
            {
                m_database.ReadDialects(m_coordinateSystem);

                for (int i = 0; i < m_coordinateSystem.Dialects.Count; i++)
                {
                    string       s    = m_coordinateSystem.Dialects[i];
                    ListViewItem item = this.listView1.Items.Add(i.ToString());
                    this.UpdateDialectString(item, s);
                }
                m_index = m_coordinateSystem.Dialects.Count;

                if (listView1.Items.Count > 0)
                {
                    listView1.Items[0].Selected = true;
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// Shows information about unrecognized projection
        /// </summary>
        public void ShowProjection(MapWinGIS.GeoProjection projection)
        {
            if (projection == null)
            {
                throw new NullReferenceException("Geoprojection wasn't passed");
            }

            m_proj = projection;

            txtName.Text = projection.Name == "" ? "None" : projection.Name;
            txtCode.Text = "None";

            if (!projection.IsEmpty)
            {
                projectionTextBox1.ShowProjection(m_proj.ExportToWKT());
                txtProj4.Text = m_proj.ExportToProj4();

                txtAreaName.Text = "Not defined";
                txtScope.Text    = "Not defined";
                txtRemarks.Text  = "Unrecognized projection";
            }
        }
Beispiel #4
0
 public string ExportToWkt()
 {
     return(_projection.ExportToWKT());
 }