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); } }
public void UnselectCalipersExcept(Caliper c) { foreach (var caliper in calipers) { if (caliper != c) { UnselectCaliper(caliper); } } }
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; }
// 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); }
public Caliper getGrabbedCaliper(Point point) { Caliper caliper = null; foreach (var c in calipers) { if (c.PointNearCaliper(point) && caliper == null) { caliper = c; } } return(caliper); }
private void ToggleCaliperState(Caliper c) { if (c == null) { return; } if (c.IsSelected) { UnselectCaliper(c); } else { SelectCaliper(c); } UnselectCalipersExcept(c); }
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); }
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); } }
// 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; }
public void deleteCaliper(Caliper c) { calipers.Remove(c); }
public void addCaliper(Caliper c) { calipers.Add(c); }
public void CancelTweaking() { chosenComponent = CaliperComponent.NoComponent; chosenCaliper = null; tweakingComponent = false; }
public string GetChosenComponentName() { return(Caliper.ComponentName(chosenComponent)); }
public void SetChosenCaliper(Point point) { chosenCaliper = getGrabbedCaliper(point); }
public void UnselectCaliper(Caliper c) { c.CaliperColor = AdjustColor(c.UnselectedColor); c.IsSelected = false; }
public void SelectCaliper(Caliper c) { c.CaliperColor = AdjustColor(c.SelectedColor); c.IsSelected = true; }