public TFlag AddFlag(TFlagShape AFlag, TBaseShape AShape, TRectLine ALine, int APosition, ref bool AFlagExits) { TFlag Member; TBaseLine MLine; int APos; AFlagExits = true; for (int i = List.Count - 1; i >= 0; i--) { Member = (TFlag)(List.ElementAt(i)); if (Member.Flag == AFlag) { return(Member); } } Member = new TFlag(); Member.Position = APosition; Member.Shape = AShape; Member.Line = ALine; Member.Flag = AFlag; List.Add(Member); AFlagExits = false; return(Member); }
void FlagDestroy(TRectLine ASender, TFlagShape AFlag, int APosFlag) { TFlag Flag = ListFlag.DeleteFlagByShape(AFlag); if (Flag != null && FOnWSFlagDestroy != null) { OnWSFlagDestroy(Flag, this); } }
TFlag GetItem(int AIndex) { TFlag res = null; if ((AIndex >= 0) && (AIndex <= List.Count - 1)) { res = (TFlag)List.ElementAt(AIndex); } return(res); }
/* void DoSetFlag(); * void DoSetFlagS(); * void DoSetFlagE();*/ void FlagCreate(TRectLine ASender, TFlagShape AFlag, int APosFlag) { bool res = false; TBaseShape Shape = GetShapeByLine(ASender, APosFlag); TFlag Flag = ListFlag.AddFlag(AFlag, Shape, ASender, APosFlag, ref res); if (!res && FOnWSFlagCreate != null) { OnWSFlagCreate(Flag, this); } }
public TFlag DeleteFlagByShape(TFlagShape AFlag) { TFlag Member, Res = null; for (int i = List.Count - 1; i >= 0; i--) { Member = (TFlag)(List.ElementAt(i)); if (Member.Flag == AFlag) { List.RemoveAt(i); } } return(Res); }