/// <summary> /// Adds the specified path. /// </summary> /// <param name="__path">The path.</param> /// <param name="item">The item.</param> /// <param name="doClose">if set to <c>true</c> [do close].</param> /// <returns></returns> public selectRangeAreaNamed Add(String __path, selectRangeArea item, Boolean doClose = false) { selectRangeAreaNamed tmp = new selectRangeAreaNamed(__path, item.x, item.y); if (doClose) { tmp.setEnd(item.BottomRight.x, item.BottomRight.y); } //tmp.resize(item.width, item.height); items.Add(tmp.path, tmp); history.Add(tmp.path); return(tmp); }
/// <summary> /// Adds the specified path. /// </summary> /// <param name="__path">The path.</param> /// <param name="x_st">The x st.</param> /// <param name="y_st">The y st.</param> /// <returns></returns> public selectRangeAreaNamed Add(String __path, Int32 x_st, Int32 y_st) { selectRangeAreaNamed tmp = new selectRangeAreaNamed(__path, x_st, y_st); if (items.ContainsKey(tmp.path)) { items[tmp.path] = tmp; history.Add(tmp.path); } else { items.Add(tmp.path, tmp); history.Add(tmp.path); } return(tmp); }
/// <summary> /// Gets the last. /// </summary> /// <param name="mustBeUnclosed">if set to <c>true</c> [must be unclosed].</param> /// <param name="allowUnclosed">if set to <c>true</c> [allow unclosed].</param> /// <param name="ago">The ago.</param> /// <returns></returns> /// <exception cref="System.ArgumentOutOfRangeException">ago - Must be between 0 and infinity. If it is above Count() - the first is returned</exception> public selectRangeAreaNamed getLast(Boolean mustBeUnclosed = false, Boolean allowUnclosed = true, Int32 ago = 1) { if (ago < 1) { throw new ArgumentOutOfRangeException("ago", "Must be between 0 and infinity. If it is above Count() - the first is returned"); } Int32 i = Count() - ago; if (i < 0) { i = 0; } selectRangeAreaNamed found = null; for (int a = Count(); a > 0; a--) { String pt = history[a - 1]; if (mustBeUnclosed) { if (!this[pt].isClosed || allowUnclosed) { found = this[pt]; } } else { if (this[pt].isClosed || allowUnclosed) { found = this[pt]; } } if ((a > ago) && (found != null)) { return(found); } } return(found); }
/// <summary> /// Adds the specified item. /// </summary> /// <param name="item">The item.</param> /// <returns></returns> public selectRangeAreaNamed Add(selectRangeAreaNamed item) { items.Add(item.path, item); history.Add(item.path); return(item); }