예제 #1
0
		/// <summary>
		///   取得文字繪圖物件列表
		/// </summary>
		/// <param name="drawingSource">繪製描述來源列舉</param>
		/// <returns>返回值: 文字繪圖物件列表(需要使用 foreach 列舉所有文字繪圖物件)</returns>
		public IEnumerable<ITextObject> GetTextObjects(EDrawingSource drawingSource) {
			int iFlag = 0;
			switch (drawingSource) {
				case EDrawingSource.AnyTech:
				case EDrawingSource.CurrentTech:
					iFlag = 1;
					break;
				case EDrawingSource.AnyTechOrManual:
				case EDrawingSource.CurrentTechOrManual:
					iFlag = 3;
					break;
				case EDrawingSource.Manual:
					iFlag = 2;
					break;
				case EDrawingSource.NotCurrentTech:
					iFlag = 6;
					break;
				case EDrawingSource.NotCurrentTechOrManual:
					iFlag = 4;
					break;
			}

			List<ITextObject> cTextObjects = new List<ITextObject>(128);
			int iCount = __cTextObjects.Count;
			if (iCount > 0) {
				for (int i = 0; i < iCount; i++) {
					TextObject cTextObject = __cTextObjects[i];
					int iDrawingFlag = cTextObject.DrawingSourceFlag;
					if (cTextObject.Exist && (iFlag & iDrawingFlag) == iDrawingFlag) {
						cTextObjects.Add(cTextObject);
					}
				}
			}
			return cTextObjects;
		}
예제 #2
0
        /// <summary>
        ///   取得文字繪圖物件列表
        /// </summary>
        /// <param name="drawingSource">繪製描述來源列舉</param>
        /// <param name="barNumber">起始 Bar Number(預設: 1)</param>
        /// <param name="count">取得文字繪圖物件個數(0=全部)</param>
        /// <returns>返回值: 文字繪圖物件列表(需要使用 foreach 列舉所有文字繪圖物件)</returns>
        public IEnumerable <ITextObject> GetTextObjects(EDrawingSource drawingSource, int barNumber = 1, int count = 0)
        {
            int iFlag = 0;

            switch (drawingSource)
            {
            case EDrawingSource.AnyTech:
            case EDrawingSource.CurrentTech:
                iFlag = 1;
                break;

            case EDrawingSource.AnyTechOrManual:
            case EDrawingSource.CurrentTechOrManual:
                iFlag = 3;
                break;

            case EDrawingSource.Manual:
                iFlag = 2;
                break;

            case EDrawingSource.NotCurrentTech:
                iFlag = 6;
                break;

            case EDrawingSource.NotCurrentTechOrManual:
                iFlag = 4;
                break;
            }

            List <ITextObject> cTextObjects = new List <ITextObject>(128);
            int iCount = (count == 0) ? __cTextObjects.Count : count;

            if (iCount > 0)
            {
                int iBarsAgo = __cTextObjects.Current - barNumber;
                for (int i = 0; i < iCount; i++)
                {
                    List <TextObject> cObjects = __cTextObjects[iBarsAgo - i];
                    if (cObjects != null)
                    {
                        int iObjectCount = cObjects.Count;
                        for (int j = 0; j < iObjectCount; j++)
                        {
                            TextObject cObject = cObjects[j];
                            if (cObject.Exist && cObject.DrawingSourceFlag == iFlag)
                            {
                                cTextObjects.Add(cObject);
                            }
                        }
                    }
                }
            }

            //是否有使用絕對位置的文字繪圖物件(絕對位置的物件不受 barNumber 影響, 每次都需要加入到繪製清單)
            if (__cAbsoluteObjects.Count > 0)
            {
                iCount = __cAbsoluteObjects.Count;
                for (int i = 0; i < iCount; i++)
                {
                    TextObject cObject = __cAbsoluteObjects[i];
                    if (cObject.Exist && cObject.DrawingSourceFlag == iFlag)
                    {
                        cTextObjects.Add(cObject);
                    }
                }
            }
            return(cTextObjects);
        }