public GLib Load( ) { lib = new GLib(null, Rect.Max, new Indexer( )); lib.Name = Locale.Get("_glibdefaultname"); lib.StyleStr = "pc=green"; GType type; GeomType[] geomTypes = { GeomType.Polygon, GeomType.Polyline, GeomType.Point, GeomType.Caption }; foreach (GeomType gt in geomTypes) { type = new GType(lib, gt); type.Name = Locale.Get(gt.ToString( )); } foreach (string filePath in fileNames) { Load(filePath); } lib.SMin = 10; // if(lib.Bounds.IsNull) // lib.SetBounds( rect ); lib.SetBounds(new Rect(left, bottom, right, top)); lib.SMax = Geomethod.GeoLib.GeoLibUtils.RoundScale(lib.Bounds.MaxSize / 50); lib.Scales.InitScales( ); return(lib); }
private void btnOk_Click(object sender, System.EventArgs e) { if (!IsChanged()) { return; } try { Rect bounds; bounds.left = int.Parse(leftTextBox.Text); bounds.top = int.Parse(topTextBox.Text); bounds.right = int.Parse(rightTextBox.Text); bounds.bottom = int.Parse(bottomTextBox.Text); int smin = int.Parse(tbSmin.Text); int smax = int.Parse(tbSmax.Text); lib.StyleStr = tbStyle.Text; lib.SetBounds(bounds); lib.SMin = smin; lib.SMax = smax; lib.Name = tbName.Text; if (lib.HasDb) { lib.Save(BatchLevel.Current); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public GLib Load() { lib = new GLib(null, Rect.Max, new Indexer( )); lib.Name = Locale.Get("_glibdefaultname"); lib.StyleStr = "pc=blue"; GType type; GeomType[] geomTypes = { GeomType.Polygon, GeomType.Polyline, GeomType.Point, GeomType.Caption }; foreach (GeomType gt in geomTypes) { type = new GType(lib, gt); type.Name = Locale.Get(gt.ToString( )); } NumberFormatInfo nfi = new NumberFormatInfo( ); nfi.NumberDecimalSeparator = "."; foreach (string filePath in fileNames) { Load(filePath, nfi); } lib.SMin = 10; // if(lib.Bounds.IsNull) // lib.SetBounds( rect ); lib.SetBounds(new Rect(left, bottom, right, top)); lib.SMax = Geomethod.GeoLib.GeoLibUtils.RoundScale(lib.Bounds.MaxSize / 50); lib.Scales.InitScales( ); /* int gcnt = 0; * foreach( GType gtype in lib.AllTypes ) * if( gtype.Ranges != null ) * foreach( GRange range in gtype.Ranges ) * foreach( GObject gobj in range.Objects ) * gcnt++; * * gcnt++; // ¬роде количество созданных объектов совпадает с количеством в файлах */ return(lib); }
public GLib Load() { foreach (string filePath in fileNames) { using (ShapeFileReader sr = new ShapeFileReader(filePath)) { UpdateBounds(sr.bound); } } if (!boundsUpdated) { return(null); } SetTransform(); CreateLib(); foreach (string filePath in fileNames) { using (ShapeFileReader sr = new ShapeFileReader(filePath)) { // object[] attrs; if (!CreateType(sr.GetUnitType())) { continue; } curType.Name = Path.GetFileNameWithoutExtension(filePath); while (sr.Read()) { switch (sr.GetUnitType()) { case ShapeUnit.Arc: // Read((ShapeArc)sr.Get()); break; case ShapeUnit.Point: Read((ShapePoint)sr.Get()); break; case ShapeUnit.Polygon: Read((ShapePolygon)sr.Get()); break; // case ShapeUnit.PointGroup: // Read((ShapePointGroup)sr.Get()); // break; case ShapeUnit.PolyLine: Read((ShapePolyline)sr.Get()); break; } } } } lib.SMin = 10; if (lib.Bounds.IsNull) { lib.SetBounds(new Rect(0, 0, 1000000, 1000000)); } lib.SMax = Geomethod.GeoLib.GeoLibUtils.RoundScale(lib.Bounds.MaxSize / 10); lib.Scales.InitScales(); return(lib); }