internal void Remove(GRange range) { if (ranges != null) { ranges.Remove(range); Lib.Unregister(range); } }
public void Load(Context context) { if (ranges != null) { throw new Exception("Ranges already loaded."); } GmCommand cmd = context.Conn.CreateCommandById("selectCountFromGisRangesWhereTypeId"); cmd.AddInt("TypeId", id); int count = (int)cmd.ExecuteScalar(); ranges = new List <GRange>(count); if (count > 0) { cmd = context.Conn.CreateCommandById("selectAllFromGisRangesWhereTypeId"); cmd.AddInt("TypeId", id); using (IDataReader dr = cmd.ExecuteReader()) { while (dr.Read()) { GRange range = new GRange(context, this, dr); } } } }
internal void Register(GRange range) { if (allRanges == null) { allRanges = new Dictionary <int, GRange>(1 << 16); } allRanges.Add(range.Id, range); }
internal static GObject Create(Context context, BinaryReader br) { GRange range = context.Lib.GetRange(br.ReadInt32()); GObject gobj = Create(range); gobj.Read(context, br); return(gobj); }
internal void Add(GRange range) { if (ranges == null) { ranges = new List <GRange>(); } ranges.Add(range); UpdateBounds(range.Bounds); }
/* void AssignId() * { * id=Lib.GenerateId(this,ref updateAttr); * }*/ void CheckRange() { GRange range = Type.GetRangeStrong(this); if (this.range != range) { this.range.Remove(this); this.range = range; range.Add(this); } }
internal static GObject Create(Context context, GRange range, IDataReader dr, bool updateRange) { if (range == null) { int rangeId = dr.GetInt32((int)ObjectField.RangeId); range = context.Lib.GetRange(rangeId); } GObject gobj = Create(range); gobj.Init(context, dr); if (updateRange) { range.Add(gobj); } return(gobj); }
static GObject Create(GRange range) { GObject gobj; switch (range.Type.GeomType) { case GeomType.Point: gobj = new GPoint(); break; case GeomType.Polyline: gobj = new GPolyline(); break; case GeomType.Polygon: gobj = new GPolygon(); break; case GeomType.Caption: gobj = new GCaption(); break; default: throw new Exception("Unknown GeomType: " + range.Type.GeomType); } gobj.range = range; // gobj.AssignId(); return(gobj); }
void LoadRanges(Context context) { if (allTypes == null) { throw new Exception("Types not loaded."); } // DZ 16.01.09 // int count=(int)context.Conn.ExecuteScalarById("selectCountFromGisRanges"); int count = Convert.ToInt32(context.Conn.ExecuteScalarById("selectCountFromGisRanges")); if (allRanges == null) { allRanges = new Dictionary <int, GRange>(count); } using (IDataReader dr = context.Conn.ExecuteReaderById("selectAllFromGisRanges")) { while (dr.Read()) { GRange range = new GRange(context, dr); } } }
internal GRange GetRangeStrong(GObject obj) { lock (getRangeStrongLock) { Rect rangeBounds = lib.Indexer.GetIndex(obj.Bounds); if (ranges == null) { ranges = new List <GRange>(); } else { foreach (GRange range in ranges) { if (range.Equals(rangeBounds)) { return(range); } } } GRange rng = new GRange(this, rangeBounds); return(rng); } }
public GObject GetObject(int objectId, int rangeId) { GRange range = GetRange(rangeId); return(range == null ? null : range.GetObject(objectId)); }
internal void Unregister(GRange range) { allRanges.Remove(range.Id); SetChanged(); SetStateAttr(LibStateAttr.AllObjectsLoaded, false); }