Esempio n. 1
0
        public Caliper getLoneTimeCaliper()
        {
            Caliper c = null;
            int     n = 0;

            if (calipers.Count > 0)
            {
                foreach (Caliper caliper in calipers)
                {
                    if (caliper.Direction == CaliperDirection.Horizontal &&
                        !caliper.isAngleCaliper)
                    {
                        c = caliper;
                        n++;
                    }
                }
            }
            if (n == 1)
            {
                return(c);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 2
0
 public void UnselectCalipersExcept(Caliper c)
 {
     foreach (var caliper in calipers)
     {
         if (caliper != c)
         {
             UnselectCaliper(caliper);
         }
     }
 }
Esempio n. 3
0
 public Calipers()
 {
     Locked                = false;
     ActiveCaliper         = null;
     grabbedCaliper        = null;
     HorizontalCalibration = new Calibration(CaliperDirection.Horizontal);
     VerticalCalibration   = new Calibration(CaliperDirection.Vertical);
     chosenCaliper         = null;
     chosenComponent       = CaliperComponent.NoComponent;
     tweakingComponent     = false;
     isFullyTransparent    = false;
 }
Esempio n. 4
0
        // this is the highlighted/selected caliper used for calibration or measurements
        public Caliper GetActiveCaliper()
        {
            Caliper c = null;

            for (int i = calipers.Count - 1; i >= 0 && c == null; i--)
            {
                if (calipers[i].IsSelected)
                {
                    c = calipers[i];
                }
            }
            return(c);
        }
Esempio n. 5
0
        public Caliper getGrabbedCaliper(Point point)
        {
            Caliper caliper = null;

            foreach (var c in calipers)
            {
                if (c.PointNearCaliper(point) && caliper == null)
                {
                    caliper = c;
                }
            }
            return(caliper);
        }
Esempio n. 6
0
 private void ToggleCaliperState(Caliper c)
 {
     if (c == null)
     {
         return;
     }
     if (c.IsSelected)
     {
         UnselectCaliper(c);
     }
     else
     {
         SelectCaliper(c);
     }
     UnselectCalipersExcept(c);
 }
Esempio n. 7
0
        public bool ReleaseGrabbedCaliper(int clickCount)
        {
            bool needsRefresh = false;

            if (grabbedCaliper != null)
            {
                if (!caliperWasDragged && !Locked)
                {
                    if (clickCount == 1)
                    {
                        ToggleCaliperState(grabbedCaliper);
                        needsRefresh = true;
                    }
                }
                grabbedCaliper    = null;
                bar1Grabbed       = false;
                bar2Grabbed       = false;
                crossbarGrabbed   = false;
                caliperWasDragged = false;
            }
            return(needsRefresh);
        }
Esempio n. 8
0
 private CaliperComponent GetCaliperComponent(Caliper caliper, Point point)
 {
     if (caliper == null)
     {
         return(CaliperComponent.NoComponent);
     }
     if (caliper.PointNearBar1(point))
     {
         return(caliper.Direction == CaliperDirection.Horizontal ? CaliperComponent.LeftBar : CaliperComponent.UpperBar);
     }
     else if (caliper.PointNearBar2(point))
     {
         return(caliper.Direction == CaliperDirection.Horizontal ? CaliperComponent.RightBar : CaliperComponent.LowerBar);
     }
     else if (caliper.PointNearCrossbar(point))
     {
         return(caliper.isAngleCaliper ? CaliperComponent.Apex : CaliperComponent.CrossBar);
     }
     else
     {
         return(CaliperComponent.NoComponent);
     }
 }
Esempio n. 9
0
        // This shortens the caliper grabbing process c/w the other versions of EP Calipers
        public void GrabCaliperIfClicked(Point point)
        {
            Caliper caliper = null;

            foreach (var c in calipers)
            {
                if (c.PointNearCrossbar(point) && caliper == null)
                {
                    crossbarGrabbed = true;
                    caliper         = c;
                }
                else if (c.PointNearBar1(point) && caliper == null)
                {
                    bar1Grabbed = true;
                    caliper     = c;
                }
                else if (c.PointNearBar2(point) && caliper == null)
                {
                    bar2Grabbed = true;
                    caliper     = c;
                }
            }
            grabbedCaliper = caliper;
        }
Esempio n. 10
0
 public void deleteCaliper(Caliper c)
 {
     calipers.Remove(c);
 }
Esempio n. 11
0
 public void addCaliper(Caliper c)
 {
     calipers.Add(c);
 }
Esempio n. 12
0
 public void CancelTweaking()
 {
     chosenComponent   = CaliperComponent.NoComponent;
     chosenCaliper     = null;
     tweakingComponent = false;
 }
Esempio n. 13
0
 public string GetChosenComponentName()
 {
     return(Caliper.ComponentName(chosenComponent));
 }
Esempio n. 14
0
 public void SetChosenCaliper(Point point)
 {
     chosenCaliper = getGrabbedCaliper(point);
 }
Esempio n. 15
0
 public void UnselectCaliper(Caliper c)
 {
     c.CaliperColor = AdjustColor(c.UnselectedColor);
     c.IsSelected   = false;
 }
Esempio n. 16
0
 public void SelectCaliper(Caliper c)
 {
     c.CaliperColor = AdjustColor(c.SelectedColor);
     c.IsSelected   = true;
 }