public Layer(GLib lib) { this.lib = lib; id = 0; attr[(int)CommonAttr.Virtual] = true; InitFromLib(); }
// public bool IsUpdated(ColorField f) { return updateAttr[(int)f]; } #endregion #region Construction public NamedColor(GLib lib, string name, Color color) { this.lib = lib; id = lib.GenerateId(this, ref updateAttr); this.name = name; this.color = color; }
public bool Visit(IShapedObject obj) { int batchLevel = (int)stat.batchLevel; switch (obj.ClassId) { case ClassId.Lib: GLib lib = (GLib)obj; stat.nBgImages += lib.BgImages.Count; stat.nLayers += lib.Layers.Count; stat.nViews += lib.Views.Count; return(batchLevel >= (int)BatchLevel.Type); case ClassId.Type: stat.nTypes++; return(true); case ClassId.Range: if (batchLevel < (int)BatchLevel.Range) { return(false); } stat.nRanges++; return((int)stat.batchLevel >= (int)BatchLevel.Object); case ClassId.Object: stat.nObjects++; break; } return(false); }
public static void CreateTestObjects(GLib lib, int count) { createTestObjectsCount++; // Type GType type = new GType(lib, GeomType.Polygon); type.Name = "Polygon test" + createTestObjectsCount.ToString(); type.StyleStr = "pc=blue;bc=lightgreen;"; Rect bounds = lib.Bounds; int libSize = (int)lib.Bounds.MinSize; // Objects Random r = new Random(); for (int n = 0; n < count; n++) { int maxSize = libSize / 10; int x = bounds.left + r.Next((int)bounds.Width - maxSize); int y = bounds.bottom + r.Next((int)bounds.Height - maxSize); Point[] points = new Point[3]; for (int i = 0; i < points.Length; i++) { points[i].X = x + r.Next(maxSize); points[i].Y = y + r.Next(maxSize); } GPolygon polygon = new GPolygon(type, points); polygon.Caption = n.ToString(); } }
internal View(Context context, IDataReader dr) { lib = context.Lib; id = dr.GetInt32((int)ViewField.Id); attr = dr.GetInt32((int)ViewField.Attr); name = dr.GetString((int)ViewField.Name); Init(context.Buf.GetIntArray(dr, (int)ViewField.Code)); }
View(GLib lib, string name) { id = 0; this.name = name; SetAttr(ViewAttr.Overall); InitFromLib(); // name=Constants.DefaultViewName; }
public BgImage(Map map) { this.lib = map.Lib; id = lib.GenerateId(this, ref updateAttr); X = map.Pos.X; Y = map.Pos.Y; Scale = (float)map.PixelScale; }
public Layer(string name, Layer layer) { lib = layer.lib; id = lib.GenerateId(this, ref updateAttr); this.name = name; Clear(); Merge(layer); updateAttr = 0; }
internal View(Context context, BinaryReader br) { lib = context.Lib; id = br.ReadInt32(); // context.Lib.UpdateGen(this); attr = br.ReadInt32(); name = br.ReadString(); Init(context.Buf.ReadIntArray(br)); }
public GType(GLib lib, GeomType geomType) { this.lib = lib; id = lib.GenerateId(this, ref updateAttr); priority = lib.LastPriority; this.geomType = geomType; lib.Add(this); lib.Register(this); }
public Layer(Context context, BinaryReader br) { lib = context.Lib; id = br.ReadInt32(); attr = br.ReadInt32(); name = br.ReadString(); int[] typeIds = context.Buf.ReadIntArray(br); Add(typeIds); updateAttr = 0; }
public Layer(GLib lib, string name, bool isAllInclusive) { this.lib = lib; id = lib.GenerateId(this, ref updateAttr); this.name = name; if (isAllInclusive) { SetAttr(LayerAttr.AllInclusive); } }
public Layer(Context context, IDataReader dr) { lib = context.Lib; id = dr.GetInt32((int)LayerField.Id); attr = dr.GetInt32((int)LayerField.Attr); name = dr.GetString((int)LayerField.Name); int[] typeIds = context.Buf.GetIntArray(dr, (int)LayerField.Code); Add(typeIds); updateAttr = 0; }
public GType(GType parent) { lib = parent.Lib; id = lib.GenerateId(this, ref updateAttr); parentId = parent.Id; priority = parent.LastPriority; this.geomType = parent.geomType; this.parent = parent; parent.Add(this); lib.Register(this); }
public Map(GLib lib, Size size, Graphics graphics, Point pos, float angle, int scale) { this.lib = lib; this.scale = scale; InitGraphics(graphics); rect = new Rect(size); pixelPos = rect.Center; double pixelScale = scale / PixelPerUnitMeasure; base.Init(pos, pixelPos, pixelScale, angle, lib.Mirror); UpdateBounds(); }
public void Search(GLib lib, Point point, int scale, IFilter filter) { objects.Clear(); this.point = point; this.scale = scale; double d = Constants.cmInMeter * lib.UnitMeasure * scale * lib.Config.geometry.searchRadiusCm; dist = (int)d; distSq = (long)(d * d); objects.Clear(); lib.Visit(this); }
internal BgImage(Context context, IDataReader dr) { lib = context.Lib; id = dr.GetInt32((int)BgImageField.Id); attr = dr.GetInt32((int)BgImageField.Attr); context.SetStyle(dr.GetString((int)BgImageField.Style), ref styleStr, ref style); textAttr = dr.GetString((int)BgImageField.TextAttr); filePath = dr.GetString((int)BgImageField.FilePath); smin = dr.GetInt32((int)BgImageField.SMin); smax = dr.GetInt32((int)BgImageField.SMax); Init(context.Buf.GetIntArray(dr, (int)BgImageField.Code)); }
internal BgImage(Context context, BinaryReader br) { lib = context.Lib; id = br.ReadInt32(); // lib.UpdateGen(this); attr = br.ReadInt32(); context.SetStyle(br.ReadString(), ref styleStr, ref style); textAttr = br.ReadString(); filePath = br.ReadString(); smin = br.ReadInt32(); smax = br.ReadInt32(); Init(context.Buf.ReadIntArray(br)); }
internal GType(Context context, IDataReader dr) { this.lib = context.Lib; id = dr.GetInt32((int)TypeField.Id); parentId = dr.GetInt32((int)TypeField.ParentId); priority = dr.GetInt32((int)TypeField.Priority); attr = dr.GetInt32((int)TypeField.Attr); name = dr.GetString((int)TypeField.Name); // DZ 16.01.09 // context.SetStyle(dr.GetString(((int)TypeField.Style)),ref styleStr,ref style); context.SetStyle( dr.IsDBNull((int)TypeField.Style) ? "" : dr.GetString((int)TypeField.Style), ref styleStr, ref style); geomType = (GeomType)dr.GetInt32((int)TypeField.GeomType); smin = dr.GetInt32((int)TypeField.SMin); smax = dr.GetInt32((int)TypeField.SMax); lib.Register(this); }
public static void SqlSearch(GLib lib, string text, int typeId, DataTable dataTable) { text = text.ToLower(); string query = string.Format("select top {0} o.Name, t.Name as Type, o.Caption, o.RangeId, o.Id from Objects o left join Types t on TypeId=t.Id where o.Name like '%{1}%' or Caption like '%{1}%' ", Constants.maxSearchCount, text); if (typeId != 0) { query += " and t.Id=" + typeId.ToString(); } using (Context context = lib.GetContext()) { using (DbDataAdapter dataAdapter = context.Conn.CreateDataAdapter(query)) { dataAdapter.Fill(dataTable); } } }
public static void Search(GLib lib, string text, int typeId, ArrayList ar) { text = text.ToLower(); if (typeId == 0) { foreach (GType type in lib.Types) { Search(type, text, ar); } } else { GType type = lib.GetType(typeId); if (type != null) { Search(type, text, ar); } } }
internal GType(Context context, BinaryReader br) { this.lib = context.Lib; id = br.ReadInt32(); // lib.UpdateGen(this); parentId = br.ReadInt32(); priority = br.ReadInt32(); attr = br.ReadInt32(); name = br.ReadString(); context.SetStyle(br.ReadString(), ref styleStr, ref style); geomType = (GeomType)br.ReadInt32(); smin = br.ReadInt32(); smax = br.ReadInt32(); if (parentId != 0) { parent = lib.GetType(parentId); } this.ParentComposite.Add(this); lib.Register(this); }
public static void Search(GLib lib, string text, int typeId, DataTable dataTable) { dataTable.BeginInit(); dataTable.Rows.Clear(); dataTable.Columns.Clear(); dataTable.Clear(); dataTable.Columns.Add("Type", typeof(string)); dataTable.Columns.Add(ObjectField.Name.ToString(), typeof(string)); dataTable.Columns.Add(ObjectField.Caption.ToString(), typeof(string)); dataTable.Columns.Add(ObjectField.RangeId.ToString(), typeof(int)).ColumnMapping = MappingType.Hidden; dataTable.Columns.Add(ObjectField.Id.ToString(), typeof(int)).ColumnMapping = MappingType.Hidden; ArrayList ar = new ArrayList(Constants.maxSearchCount); Search(lib, text, typeId, ar); foreach (GObject obj in ar) { dataTable.Rows.Add(new object[5] { obj.Type.Name, obj.Name, obj.Caption, obj.RangeId, obj.Id }); } dataTable.EndInit(); }
public Views(GLib lib) { this.lib = lib; Clear(); }
public Images(GLib lib) { this.lib = lib; }
public static View CreateOverall(GLib lib, string name) { return(new View(lib, name)); }
public BufferedMap(GLib lib, Image image) : base(lib, image.Size, Graphics.FromImage(image)) { this.image = image; }
public BufferedMap(GLib lib, Size size) : this(lib, new Bitmap(size.Width, size.Height)) { }
public Scales(GLib lib) { this.lib = lib; }
public BgImages(GLib lib) { this.lib = lib; Clear(); }