Example #1
0
 public bool FoundPressedElecComp(IntPoint point)
 {
     for (int i = 0; i < elecSet.Count; i++)
     {
         if (elecSet[i].IfInRegion(point))
         {
             pressedElecComp = elecSet[i];
             pressedIndex    = i;
             return(true);
         }
     }
     return(false);
 }
Example #2
0
 public bool FoundPressedElecComp(IInputElement targetElement)
 {
     if (targetElement is Shape)
     {
         Shape shape = (Shape)targetElement;
         for (int i = 0; i < elecSet.Count; i++)
         {
             if (elecSet[i].HasShape(shape))
             {
                 pressedElecComp = elecSet[i];
                 pressedIndex    = i;
                 return(true);
             }
         }
     }
     return(false);
 }
Example #3
0
        //@m 这里是存档的调取
        public ElecComp AddFromRecord(int Comp, Canvas Mycanvas)
        {
            ElecComp elecComp = null;

            switch (Comp)
            {
            case ElecComp.Comp_Wire:
                Wire w = new Wire();
                AddCompAndShow(w, Mycanvas);
                elecComp = w;
                break;

            case ElecComp.Comp_Resistance:
                Resistance r = new Resistance();
                AddCompAndShow(r, Mycanvas);
                elecComp = r;
                break;

            case ElecComp.Comp_Capacity:
                Capacity c = new Capacity();
                AddCompAndShow(c, Mycanvas);
                elecComp = c;
                break;

            case ElecComp.Comp_Inductance:
                Inductance i = new Inductance();
                AddCompAndShow(i, Mycanvas);
                elecComp = i;
                break;

            case ElecComp.Comp_Power:
                Power p = new Power();
                AddCompAndShow(p, Mycanvas);
                elecComp = p;
                break;

            case ElecComp.Comp_ACPower:
                ACPower acp = new ACPower();
                AddCompAndShow(acp, Mycanvas);
                elecComp = acp;
                break;
                //@m这里需要补充其他元件的存档调取
                //@m在补充完所有元件的attribute和 handleattri 之后 记得调取的时候要一并对应调取
            }
            return(elecComp);
        }
Example #4
0
 public void AddCompAndShow(ElecComp elecComp, Canvas canvas)
 {
     elecSet.Add(elecComp);
     elecComp.ShowIn(canvas);
 }
Example #5
0
 public void ReleaseElecComp()
 {
     pressedElecComp = null;
 }
Example #6
0
 public ElecCompSet()
 {
     elecSet         = new List <ElecComp>();
     pressedElecComp = null;
 }