void SetPathNode(TPredicateItemBig AHead, TDynamicArray ADyn) { int mpos = -1; TPredicatePathNode L; TPredicatePathNodeItem NI; TPredicatePathNodeItem FI; TDynamicArray D = new TDynamicArray(); TPredicatePathNode N = FillPathNode(AHead, ADyn); if (N != null) { L = f_UsedPath.FindLikePathNode(N); if (L != null) { NI = L.FindIndexFirst(ref mpos); while (NI != null) { FI = N.FindByBlockID(NI.BlockID); if (FI != null) { D.Append(FI.ItemBase); } NI = L.FindIndexNext(ref mpos); } } } if (D.Count == ADyn.Count) { ADyn.Clear(); SharedConst.CopyDynamicArray(D, ADyn, false); } D = null; }
/* void PrepareLevelOnOffset(); * void ClearAltWSList(); * void AddToAltWSList(TBaseWorkShape* AWS); * HRGN GetRGNAltWSList(); * bool IsAltWSListEmpty();*/ TBaseShape FindTFE(int Ax, int Ay) { TBaseShape CurrShape; TBaseWorkShape TempWork; TempWork = g_PainterList.First(); while (TempWork != null) { if (TempWork.CompositeWorkShape != null) { CurrShape = TempWork.CompositeWorkShape.FindTFE(Ax, Ay); if (CurrShape != null) { return(CurrShape); } } else { for (int i = 0; i <= TempWork.WorkShapesCount - 1; i++) { CurrShape = (TBaseShape)(TempWork.GetWorkShape(i)); if (SharedConst.PtInRect(CurrShape.GetRect(), new Point(Ax, Ay))) { return(CurrShape); } } } TempWork = g_PainterList.Next(); } return(null); }
void DoEnlarge() { int m, cnt, index, r_f, r_pos, m_id; TAlternativeParserEnlargerStep MStep; TAlternativeParserEnlargerItem A, B; TDynamicArray DM = new TDynamicArray(); MStep = new TAlternativeParserEnlargerStep(); int c_trash; bool go = true; while (go) { go = false; m = FindMax().Count; cnt = Count; c_trash = 0; for (int i = m; i >= 1; i--) { DM.Clear(); for (int j = 0; j <= cnt - 1; j++) { A = GetItems(j); MStep.Clear(); index = 0; r_f = A.FillStep(MStep, index, i); DM.Append(A); while (r_f > 0) { m_id = SharedConst.NextTrashItemID(); for (int k = 0; k <= cnt - 1; k++) { B = GetItems(k); if (DM.Find(B) == null) { r_pos = B.Pos(MStep); if (r_pos >= 0) { CreateTrashItem(A.GetItems(index), i, A, m_id); CreateTrashItem(B.GetItems(r_pos), i, B, m_id); c_trash++; } } } MStep.Clear(); r_f = A.FillStep(MStep, ++index, i); } } if (c_trash > 0) { Restruct(); go = true; break; } } } MStep = null; DM = null; }
override public void Paint(Graphics Canvas) { base.Paint(Canvas); if (CompositeWorkShape == null) { // F_OldPenParent.Assign(Canvas.Pen); // Canvas.Pen.Width = LineWidth; // Canvas.Pen.Style = LineStyle; // Canvas.Pen.Color = PenColor; SharedConst.PaintVShape(Canvas, VPoint, F_Step, F_Step, true); // Canvas.Pen.Assign(F_OldPenParent); } }
private void найтиРешениеToolStripMenuItem_Click(object sender, EventArgs e) { string OptZ = SharedConst.opt_sadacha.make_sadacha() + "\r\n" + SharedConst.opt_sadacha.make_ogrsovm(); f_PredicatePath.Init(); f_Zadacha.Clear(); SharedConst.InitTrashCounter(); SharedConst.InitTFEConvertor(); TTreeList m_TreeList = new TTreeList(); TAlternativeParser AP = new TAlternativeParser(); TPredicateTFSConvertor TC = new TPredicateTFSConvertor(); TGraphTFEConvertor GC = new TGraphTFEConvertor(); m_TreeList.FillTreeFromList(ref MainList); AP.Parse(ref m_TreeList.f_TreeList); TC.CopyTree(AP.Head); TC.PathStyle = 2; TC.Process(f_PredicatePath.BasePath, f_PredicatePath.UsedPath); GC.Init(ref TC.f_PredicateStart, ref f_Zadacha.f_Tree); f_Zadacha.Init(f_TypeParam, f_CheckNud, SharedConst.FullPredicateModel(this, GC.PrStruct, GC.PrRab, GC.PrControlRab, GC.PrControlFunc, GC.PrCheckCondition, OptZ, f_PredicateDopPrav)); string S; S = f_Zadacha.Check(); if (S.Length > 0) { MessageBox.Show(S, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { if (SharedConst.CreateStartDecision(f_Zadacha, f_TypeParam, SharedConst.opt_sadacha.get_type_metod())) { var startTime = System.Diagnostics.Stopwatch.StartNew(); f_Zadacha.Process(); startTime.Stop(); var resultTime = startTime.Elapsed; f_Zadacha.ShowDecision(f_VwColorAlt, f_VwColorBadAlt, f_VwColorFont, resultTime.Milliseconds + resultTime.Seconds * 1000); } // FreeStartDecision(); } GC = null; TC = null; AP = null; m_TreeList = null; /* FreeTFEConvertor();*/ }
/* TPredicatePathNodeItem* CreateItem();*/ public void AddItem(TPredicateItemBase AItem) { TPredicatePathNodeItem N = new TPredicatePathNodeItem(); if (AItem.Who() == 0) { N.TFS = ((TPredicateItemTFS)AItem).TFS.BaseWorkShape; N.BlockID = N.TFS.BlockId; } else { N.BlockID = SharedConst.PredicatePathNextNum(); } N.f_Index = f_Cnt; N.ItemBase = AItem; f_Cnt++; f_List.Add(N); }
public TBaseShape FindTFE(int Ax, int Ay) { TBaseShape Res = null; if (f_Shape != null) { if (SharedConst.PtInRect(f_Shape.GetRect(), new Point(Ax, Ay))) { return(f_Shape); } } TCompositeBaseWork Item; for (int i = CompositeWork.Count - 1; i >= 0; i--) { Item = (TCompositeBaseWork)(CompositeWork.ElementAt(i)); Res = Item.FindTFE(Ax, Ay); if (Res != null) { return(Res); } } return(null); }
public void Init() { SharedConst.PredicatePathInit(); }
int GetXDln() { return(Math.Abs(SharedConst.MyMax(f_PEnd.X, f_PStart.X) - SharedConst.MyMin(f_PEnd.X, f_PStart.X))); }