void ApplyAttributeForWorkShape(TBaseWorkShape WS) // применяет аттрибуты для ТФС { WS.PenWidth = f_WSPenWidth; WS.LineWidth = f_WSPenWidth; WS.PenColor = f_LineColor; WS.BaseLineColor = f_LineColor; /* if (f_BrushTFE) * WS.BrushStyle = bsSolid; * else * WS.BrushStyle = bsClear;*/ WS.BrushColor = f_BrushColor; // WS.Font = f_FontTFE; WS.FlagSType = f_FlagType; WS.FlagEType = f_FlagType; WS.FrameColorTFE = f_FrameColorTFE; WS.FrameColor = f_FrameColorTFS; if (WS.CompositeWorkShape != null) { WS.CompositeWorkShape.SetColorAll(f_LineColor); WS.CompositeWorkShape.SetBrushColorAll(f_BrushColor); // WS.CompositeWorkShape.SetBrushStyleAll(WS.BrushStyle); } if (f_AltWSList.Find(WS)) { WS.PenColor = f_AltLineColor; if (WS.CompositeWorkShape != null) { WS.CompositeWorkShape.SetColorAll(f_AltLineColor); } } ApplyAttributeForCompositeWorkShape(WS); }
public void AddShapeToList(int AltId, int ANumAlt, TBaseWorkShape WShape, int IdParentShape) { TNodeMain Nd; TNodeMain NPrior; TNodeAncestor NAc; int ParentBlock; int pos = 0; if (!CheckAlternateNode(AltId, ANumAlt)) { return; } NPrior = FindLastNodeToAlternate(AltId, ANumAlt, IdParentShape); Nd = new TNodeMain(); Nd.IdBlock = WShape.BlockId; //s Nd.IdParentShape = IdParentShape; Nd.WorkShape = WShape; Nd.IdAlternate = AltId; Nd.NumAlt = ANumAlt; if (NPrior != null) //не первый узел { NPrior.Next = Nd; Nd.Prior = NPrior; } MainList.Add(Nd); if ((FOnListChange != null) && (!f_Update)) { OnListChange(); } f_Changes = true; TNodeAlt NAlt = CheckFirstNodeAlt(); if ((NAlt != null) && (AltId == 0)) { NAlt.NodeStart = Nd; } if (IdParentShape != 0) { DoAddNodeAncestor(Nd.IdBlock, Nd.IdParentShape); while (true) { if (Nd.IdParentShape == 0) { return; } ParentBlock = FindBlockOutShape(Nd.IdParentShape); Nd = FindNode(ParentBlock, ref pos); if (Nd.IdParentShape != 0) { DoAddNodeAncestor(Nd.IdBlock, Nd.IdParentShape); } } } }
void SetWorkShape(TBaseWorkShape AValue) { f_WorkShape = AValue; FreePointList(); FreeBaseLineList(); if (f_WorkShape != null) { f_PenColorWS = f_WorkShape.PenColor; f_PenWidthWS = f_WorkShape.PenWidth; /* f_PenStyleWS = f_WorkShape.PenStyle; * f_PenModeWS = f_WorkShape.PenMode; * f_FrameColorWS = f_WorkShape.FrameColor; * f_BrushStyleWS = f_WorkShape.BrushStyle; * f_DrawCaption = f_WorkShape.DrawCaption; * f_FirstLine.PointStart = f_WorkShape.FirstLine.PointStart; * f_FirstLine.PointEnd = f_WorkShape.FirstLine.PointEnd; * if (f_WorkShape.CompositeWorkShape!=null) * { * f_DShapes.Clear(); * f_WorkShape.CompositeWorkShape.GetAllShapes(f_DShapes); * } * CreateImage();*/ } }
void ApplyAttributeForCompositeWorkShape(TBaseWorkShape WS) { if (WS.CompositeWorkShape != null) { WS.CompositeWorkShape.FirstLine.FlagSType = WS.FlagSType; WS.CompositeWorkShape.FirstLine.FlagEType = WS.FlagEType; } }
public TPredicateTreeItem() { f_ParentID = 0; f_TypeWorkShape = 0; f_NumAlt = 0; f_BaseWorkShape = null; f_ParentShape = null; f_TReated = false; f_List = new TDynamicArray(); }
TBaseWorkShape GetItem(int AIndex) { TBaseWorkShape res = null; if ((AIndex >= 0) && (AIndex <= Items.Count - 1)) { res = (TBaseWorkShape)(Items.ElementAt(AIndex)); } return(res); }
public TBaseWorkShape CreateTempWorkShape(int AType, Point AStart, int ANumberShapeId = 0) { TBaseWorkShape m_CurrWorkShape = null; if (AType > 0) { switch (AType) { case 1: m_CurrWorkShape = new TWork(AStart.X, AStart.Y, f_StepPixels, ANumberShapeId, 0, 0); break; case 2: m_CurrWorkShape = new TZWork(AStart.X, AStart.Y, f_StepPixels, ANumberShapeId, 0, 0); break; case 3: m_CurrWorkShape = new TZWorkOR(AStart.X, AStart.Y, f_StepPixels, ANumberShapeId, 0, 0); break; case 4: m_CurrWorkShape = new TControlWork(AStart.X, AStart.Y, f_StepPixels, ANumberShapeId, 0, 0); break; case 5: m_CurrWorkShape = new TControlFunc(AStart.X, AStart.Y, f_StepPixels, ANumberShapeId, 0, 0); break; case 6: m_CurrWorkShape = new TBifurcation(AStart.X, AStart.Y, f_StepPixels, ANumberShapeId, 0, 0); break; case 7: m_CurrWorkShape = new TCheckConditionCW(AStart.X, AStart.Y, f_StepPixels, ANumberShapeId, 0, 0); break; case 8: m_CurrWorkShape = new TCycleWhileDo(AStart.X, AStart.Y, f_StepPixels, ANumberShapeId, 0, 0); break; case 9: m_CurrWorkShape = new TCycleDoWhileDo(AStart.X, AStart.Y, f_StepPixels, ANumberShapeId, 0, 0); break; case 10: m_CurrWorkShape = new TCycleDoWhileDoFC(AStart.X, AStart.Y, f_StepPixels, ANumberShapeId, 0, 0); break; case 11: m_CurrWorkShape = new TCheckCondition(AStart.X, AStart.Y, f_StepPixels, ANumberShapeId, 0, 0); break; } } return(m_CurrWorkShape); }
public bool IsExists(TBaseWorkShape AWS) { for (int i = 0; i <= List.Count - 1; i++) { if ((TBaseWorkShape)List.ElementAt(i) == AWS) { return(true); } } return(false); }
public TBaseWorkShape Prior() { TBaseWorkShape Res = null; f_pos--; if ((List.Count > f_pos) && (f_pos >= 0)) { Res = (TBaseWorkShape)List.ElementAt(f_pos); } return(Res); }
public TBaseWorkShape First() { TBaseWorkShape Res = null; f_pos = 0; if (List.Count > 0) { Res = (TBaseWorkShape)List.ElementAt(f_pos); } return(Res); }
public TNodeMain() { IdBlock = 0; IdParentShape = 0; IdAlternate = 0; NumAlt = 0; TypeCreate = 0; WorkShape = null; Prior = null; Next = null; }
public TBaseWorkShape Last() { TBaseWorkShape Res = null; if (List.Count > 0) { f_pos = List.Count - 1; Res = (TBaseWorkShape)List.ElementAt(f_pos); } return(Res); }
public TPaintGrid(FrmMain AOwnerForm /*TCanvas* ACanvas, HWND AOwnerForm*/) { f_Width = f_Height = 0; f_StepPixels = 6; f_StepPixelsGrid = 8; f_FonColor = Color.White; f_PixelColor = Color.Black; f_PaintPixels = true; f_OwnerForm = AOwnerForm; f_LEControl = false; f_WndHandler = new IntPtr(); f_UnderControl = null; f_RefreshFon = true; f_CurrEndPoint = new Point(80, 100); f_X_offs = 0; //смещение по Х f_Y_offs = 0; //смещение по Y f_WSPenWidth = 1; f_X_offsSum = f_Y_offsSum = 0; f_LineColor = Color.Black; f_BrushTFE = false; f_BrushColor = Color.White; f_LeaveFlagColor = Color.Red; f_EnterFlagColor = Color.Lime; f_CurrentCommand = 0; f_FlagType = 0; f_TypMouseOperation = 0; f_SelectedTFE = null; f_SelectedTFS = null; // f_FrameColorTFE = null; // f_FrameColorTFS = null; f_WSMoving = false; // f_SelectedFlag = null; f_Regim = 0; f_SelectedAlternateFirst = null; //первая выбранная ТФС для альтернативы f_SelectedAlternateLast = null; //первая выбранная ТФС для альтернативы f_SelectedDeleteTFSFirst = null; //первая выбранная ТФС для альтернативы f_SelectedDeleteTFSLast = null; //первая выбранная ТФС для альтернативы /* f_FontTFE = new Font(); * ScrBitmap = new Graphics::TBitmap; * ScrBitmapCopy = new Graphics::TBitmap;*/ f_ClipPath = new TClipPath(); g_PainterList = new TPainterList(); f_ListForPaint = new TListForPaint(); /* f_FlagController = new TFlagController();*/ f_InvalidateList = new TInvalidateList(); f_LineCutting = new TLineCutting(f_Canvas); g_AlternateList = new TAlternateList(); f_AltWSList = new TAltWSList(); f_localVisiblearrowall = false; }
void NilTFS() { if (f_SelectedTFS != null) { if (f_SelectedTFS.DrawFrame) { f_SelectedTFS.DrawFrame = false; f_ClipPath.Clear(); f_ClipPath.Add(f_SelectedTFS.GetFrameRectWithLines(), 4); //SendMessage(f_OwnerForm, WM_GD_PAINT, 1, LPARAM(f_ClipPath.GetCliptRgn())); } f_SelectedTFS = null; } }
public TNodeMain FindNode(TBaseWorkShape WShape) { TNodeMain TempN; for (int i = 0; i <= MainList.Count - 1; i++) { TempN = (TNodeMain)MainList.ElementAt(i); if (TempN.WorkShape == WShape) { return(TempN); } } return(null); }
/* TTreeListItem* FindTFE(TBaseShape* ABaseShape);*/ public void FindAlternate(TBaseWorkShape ABaseWorkShape, TDynamicArray D) { TBaseWorkShape Tfs; D.Clear(); for (int i = 0; i <= ItemCount - 1; i++) { Tfs = GetAlternateItem(i).NodeStart.WorkShape; if (Tfs == ABaseWorkShape) { D.Append(GetAlternateItem(i)); } } }
public TTreeListTFS(TBaseWorkShape ABaseWorkShape) { TBaseShape mBS; TTreeListItem TL; f_BaseWorkShape = ABaseWorkShape; f_List = new List <object>(); for (int i = 0; i <= f_BaseWorkShape.WorkShapesCount - 1; i++) { mBS = f_BaseWorkShape.GetWorkShape(i); TL = new TTreeListItem(mBS); f_List.Add(TL); } }
void BuildGlp(TBaseWorkShape AWN, DrawObject Glp, TBaseShape ASel) { TBaseShape BS; FmParamAlternative fmParamAlternative = new FmParamAlternative(); Glp.SetBitMap(fmParamAlternative.pbTfs.Width, fmParamAlternative.pbTfs.Height); // Glp.Canvas.Brush.Color = f_FonColor; // Glp.Canvas.FillRect(TRect(0, 0, Glp.Width, Glp.Height)); AWN.StartPoint = new Point(0, 0); AWN.Init(); AWN.Prepare(); /* if (f_BrushTFE) * AWN.BrushStyle = bsSolid; * else * AWN.BrushStyle = bsClear;*/ AWN.BrushColor = f_BrushColor; AWN.LineWidth = f_WSPenWidth; AWN.PenWidth = f_WSPenWidth; // AWN.Font.Assign(f_FontTFE); AWN.FrameColorTFE = f_FrameColorTFE; AWN.PenColor = f_LineColor; Rectangle R = AWN.GetFrameRectWithLines(); int rx = (Glp.bmp.Width - R.Width) / 2 - R.Left; int ry = (Glp.bmp.Height - R.Height) / 2 - R.Top; AWN.SetOffsetPosition(rx, ry); AWN.StartPoint = new Point(rx, ry); if (ASel.Clon != null) { BS = ASel.Clon; } else { BS = ASel; } BS = AWN.ShapeSupportID(BS.ID); if (BS != null) { BS.DrawFrame = true; } AWN.Prepare(); AWN.Paint(Glp.gr); }
/* TBaseWorkShape* FindTFS(int Ax, int Ay);*/ /* TAlternateItem FindAlternateItem(int Ax, int Ay) * { * TAlternateItem Item; * Item = g_AlternateList.First(); * while (Item!=null) * { * if (PtInRect(&Item.ArrowWorkShape.GetSmallRegionRect(), new Point(Ax, Ay))) * return Item; * Item = g_AlternateList.Next(); * } * return null; * }*/ public void ClearAll() { f_SelectedTFE = null; f_SelectedTFS = null; f_ClipPath.Clear(); g_PainterList.ClearAll(); f_ListForPaint.Clear(); // f_FlagController.ClearAll(); f_InvalidateList.Clear(); f_LineCutting.ClearAll(); g_AlternateList.ClearAll(); f_AltWSList.Clear(); f_localVisiblearrowall = false; f_CurrEndPoint = new Point(80, 100); }
/* void SetNextWorkShape(TBaseWorkShape AValue); * void CreateImage(); * void CreateBaseLine(); * TLineCuttingItem FindLine(Point APointStart, Point APointEnd); * bool AddToPointList(Point APointStart, Point APointEnd); * bool ComparePoint(TLineCuttingItem A, TLineCuttingItem B, ref Point AStart, ref Point AEnd); * void ApplyOffset(int Ax, int Ay); * void Paint(TCanvas ACanvas);*/ public TLineCutting(Graphics ACanvas) { f_PointList = new List <object>(); f_BaseLineList = new List <object>(); f_WorkShape = null; f_NextWorkShape = null; f_BaseX = f_BaseY = 0; f_StartBaseX = f_StartBaseY = 0; f_Canvas = ACanvas; f_FirstLine = new TRectLine(0, 0); f_LastLine = new TRectLine(0, 0); f_IsFirstWS = f_IsLastWS = false; f_DLines = new TDynamicArray(); f_DShapes = new TDynamicArray(); }
public TCompositeBaseWork() { f_ListItem = new List <object>(); f_ListBL = new List <object>(); f_ListRectLine = new List <object>(); f_TopBorder = 0; f_OffsetTop = 0; f_LastLineBend = 0; f_FirstLineBend = 0; f_ColorSetup = null; f_Selected = false; f_Ref = 1; // f_History = new TCompositeStack2; f_ConvertedBWS = null; }
TNodeMain FindPriorNodeToAlternate(int AltId, TBaseWorkShape WBefore) { TNodeMain TempN; for (int i = 0; i <= MainList.Count - 1; i++) { TempN = (TNodeMain)(MainList.ElementAt(i)); if (TempN.IdAlternate == AltId) { if (TempN.WorkShape == WBefore) { return(TempN); } } } return(null); }
private void Button3_Click(object sender, EventArgs e) { TBaseWorkShape Sel = Grid.FindShapeFromCompositeWork(Grid.SelectedTFE.ID); if (Sel != null) { if (Sel.CompositeWorkShape != null) { TCompositeBaseWork F = new TCompositeBaseWork(); Grid.FindComositeBaseWork2(Grid.SelectedTFE.ID, ref F); Sel = F.ConvertedBWS; } TBaseWorkShape WN = Grid.CreateTempWorkShape(Sel.TypeShape, new Point(0, 0), Sel.FirstShapeId - 1); DrawObject imageTfe = new DrawObject(); // fmParamAlternative.pbTfs.BackgroundImage = Glbmp; BuildGlp(WN, imageTfe, Grid.SelectedTFE); ShowParamAlternative(Grid.SelectedTFE, LevelController.ParentShapeID, f_TypeParam, imageTfe, false); } }
void FindAlternate2(TBaseWorkShape AFirstWorkShape, TBaseWorkShape AEndWorkShape, TDynamicArray D) { TBaseWorkShape Tfs1, Tfs2; D.Clear(); for (int i = 0; i <= ItemCount - 1; i++) { Tfs1 = null; Tfs2 = null; if (GetAlternateItem(i).NodeStart != null) { Tfs1 = GetAlternateItem(i).NodeStart.WorkShape; } if (GetAlternateItem(i).NodeEnd != null) { Tfs2 = GetAlternateItem(i).NodeEnd.WorkShape; } if ((Tfs1 == AFirstWorkShape) && (Tfs2 == AEndWorkShape)) { D.Append(GetAlternateItem(i)); } } }
/* public int DecayWorkShape(TBaseWorkShape WDecay, TBaseWorkShape WN1, TBaseWorkShape WN2); * public void FusionWorkShape(TBaseWorkShape WFusion, TBaseWorkShape WN1, TBaseWorkShape WN2); * public TBaseWorkShape FindWorkShapeOutBaseShape(TBaseShape Shape, int &ShapeId); * public TBaseWorkShape FindWorkShapeOutBaseShapeID(int ShapeID, TBaseShape Shape);*/ public bool CreateAlternate(TBaseWorkShape WS, TBaseWorkShape WE, int AID, int ANumAlt) { TNodeAlt Alt; TNodeMain NS, NE; if (WS == null && WE == null) { Alt = new TNodeAlt(); Alt.ID = AID; Alt.NodeStart = null; Alt.NodeEnd = null; Alt.Num = ANumAlt; AlternateList.Add(Alt); return(true); } NS = FindNode(WS); NE = FindNode(WE); if ((NS == null) || (NE == null)) { return(false); } for (int i = 0; i <= AlternateList.Count - 1; i++) { Alt = (TNodeAlt)AlternateList.ElementAt(i); if (Alt.ID == AID) { return(false); } } Alt = new TNodeAlt(); Alt.ID = AID; Alt.NodeStart = NS; Alt.NodeEnd = NE; Alt.Num = ANumAlt; AlternateList.Add(Alt); return(true); }
void MakeElementTFS(TPredicateItemTFS ATFS) { int n, m_who; TBaseShape B; string S; TDynamicArray D = new TDynamicArray(); TBaseWorkShape WS = ATFS.TFS.BaseWorkShape; ATFS.ListIDFill(D); for (int i = 0; i <= D.Count - 1; i++) { n = D.GetPosition(i).Int_Value; B = WS.ShapeSupportID(n); m_who = B.TypeShape; S = B.Make_One_Simple(); if (S.Length > 0) { if (m_who == 5) { f_PrRab = f_PrRab + S + "\r\n"; } if (m_who == 6) { f_PrControlRab = f_PrControlRab + S + "\r\n"; } if (m_who == 7) { f_PrControlFunc = f_PrControlFunc + S + "\r\n"; } if (m_who == 8) { f_PrCheckCondition = f_PrCheckCondition + S + "\r\n"; } } } D = null; }
public TAlternateItem(TBaseWorkShape AWorkShape, int AIdAlt, int ANumAlt, int AParentIdAlt, int AParentNumAlt, bool AFirst) { int m_step; f_IdAlt = AIdAlt; f_NumAlt = ANumAlt; f_ParentIdAlt = AParentIdAlt; f_ParentNumAlt = AParentNumAlt; f_WorkShape = AWorkShape; // m_step = f_WorkShape.Step; f_First = AFirst; /* if (AFirst) * f_ArrowWorkShape = new TArrowWorkShape(f_WorkShape.StartPoint.x, f_WorkShape.StartPoint.y, m_step, 0, 0, 0); * else * f_ArrowWorkShape = new TArrowWorkShape(f_WorkShape.EndPoint.x, f_WorkShape.EndPoint.y, m_step, 0, 0, 0);*/ /* f_ArrowWorkShape.BrushStyle = new SolidBrush(Color.Black); * f_ArrowWorkShape.Init(); * f_ArrowWorkShape.AddNodeHint(f_IdAlt);*/ f_Entered = false; f_Visible = true; f_OtherWorkShape = null; }
public void AddWorkShape(TBaseWorkShape AShape) { Rectangle R; Rectangle Bounds = new Rectangle(0, 0, f_Width, f_Heigth); Point P1, P2; TBaseWorkShape Tmp; for (int i = 0; i <= Items.Count - 1; i++) { Tmp = (TBaseWorkShape)Items.ElementAt(i); if (Tmp == AShape) { return; } } R = AShape.GetFrameRectWithLines(); P1 = new Point(R.Left, R.Top); P2 = new Point(R.Right, R.Bottom); // if (PtInRect(&Bounds, P1) || PtInRect(&Bounds, P2) ) if ((R.Top <= f_Heigth) || (R.Bottom <= f_Heigth) || (R.Left != 0)) { Items.Add(AShape); } }
public bool Find(TBaseWorkShape AWs) { return(Items.IndexOf(AWs) > -1); }
public void Add(TBaseWorkShape AWs) { Items.Add(AWs); }