Esempio n. 1
0
        private void TestLabelSerialize()
        {
            // As mentioned here https://github.com/MapWindow/MapWinGIS/issues/1
            var sf = new ShapefileClass();

            if (!sf.Open(@"D:\dev\GIS-Data\Issues\0001\LOT_N.shp"))
            {
                Debug.WriteLine(DateTime.Now + " Could not open shapefile. Reason " + sf.ErrorMsg[sf.LastErrorCode]);
                return;
            }

            if (sf.Labels.Count == 0)
            {
                Debug.WriteLine("Create labels");
                sf.GenerateLabels(0, tkLabelPositioning.lpCenter, true);
            }

            Debug.WriteLine(sf.Labels.Serialize());

            // Add shapefile to map:
            var hndl = axMap1.AddLayer(sf, true);

            var sf2 = axMap1.get_Shapefile(hndl);

            txtResults.Text = sf2.Labels.Serialize();
        }
Esempio n. 2
0
        private void button4_Click(object sender, EventArgs e)
        {
            _settings.OgrStringEncoding = tkOgrEncoding.oseUtf8;

            var sf = new ShapefileClass();

            if (!sf.Open(@"D:\dev\GIS-Data\Issues\Persian\roads.shp"))
            {
                Debug.WriteLine(DateTime.Now + " Could not open shapefile. Reason " + sf.ErrorMsg[sf.LastErrorCode]);
                return;
            }

            if (sf.Labels.Count == 0)
            {
                Debug.WriteLine("Create labels");
                sf.GenerateLabels(1, tkLabelPositioning.lpLongestSegement, true);
            }

            // Add shapefile to map:
            var hndl = axMap1.AddLayer(sf, true);

            txtResults.Text += @"Added layer with handle " + hndl;
        }