// Interface für MultiGeoPointInput mi public void SetGeoPoint(int Index, GeoPoint ThePoint) { if (dimDir == DimDirection.Sloping) //Schrägbemassung { if (Index == 0) { base.BasePoint = ThePoint; // Referenzpunkt für die Richtungsbestimmung } if ((Index == 1) & (!dimDirInput.Fixed)) // nur, falls nicht explizit die Richtung bestimmt wurde { // Schrägbemassung: der zweite Punkt definiert mit dem 1. die Lage dim.DimLineDirection = new GeoVector(dim.GetPoint(0), ThePoint); } } // das folgende dient nur dazu, den Cursor umzuschalten, falls Bemassung getroffen ist if (dim.PointCount == 2) { GeoObjectList li = base.GetObjectsUnderCursor(base.CurrentMousePoint); for (int i = 0; i < li.Count; ++i) { if (li[i] is Dimension) { Dimension dimTemp = (li[i] as Dimension); int ind; Dimension.HitPosition hi = dimTemp.GetHitPosition(base.Frame.ActiveView.Projection, base.ProjectedPoint(CurrentMousePoint), out ind); if ((hi & Dimension.HitPosition.DimLine) != 0) { base.Frame.ActiveView.SetCursor(CursorTable.GetCursor("Trim.cur")); } //TODO: Bemassungscursor! } } } dim.SetPoint(Index, ThePoint); }
// private double RoundRadiusCalc(GeoPoint MousePosition) // { // radiusPoint = MousePosition; // if (roundObject.Fixed) { if (showRound()) return roundRadCalc; } // return roundRad; // } /// <summary> /// Overrides <see cref="CADability.Actions.ConstructAction.OnSetAction ()"/> /// </summary> public override void OnSetAction() { base.ActiveObject = null; arc = Ellipse.Construct(); base.TitleId = "ToolsRoundIn"; roundRad = ConstrDefaults.DefaultRoundRadius; // roundRadCalc = roundRad; roundObject = new CurveInput("ToolsRoundIn.Object"); roundObject.MouseOverCurvesEvent += new CurveInput.MouseOverCurvesDelegate(RoundObject); roundObject.CurveSelectionChangedEvent += new CurveInput.CurveSelectionChangedDelegate(RoundObjectChanged); roundObject.HitCursor = CursorTable.GetCursor("RoundIn.cur"); roundObject.ModifiableOnly = true; roundObject2 = new CurveInput("ToolsRoundIn.Object2"); roundObject2.ReadOnly = true; roundObject2.Optional = true; roundObject2.MouseOverCurvesEvent += new CurveInput.MouseOverCurvesDelegate(RoundObject2); roundObject2.CurveSelectionChangedEvent += new CurveInput.CurveSelectionChangedDelegate(RoundObjectChanged2); roundObject2.HitCursor = CursorTable.GetCursor("RoundIn.cur"); roundObject2.ModifiableOnly = true; roundRadius = new LengthInput("ToolsRoundIn.Radius"); // roundRadius.Optional = true; roundRadius.ForwardMouseInputTo = roundObject; roundRadius.DefaultLength = ConstrDefaults.DefaultRoundRadius; // roundRadius.OnCalculateLength +=new Condor.Actions.ConstructAction.LengthInput.CalculateLength(RoundRadiusCalc); roundRadius.SetLengthEvent += new CADability.Actions.ConstructAction.LengthInput.SetLengthDelegate(RoundRadius); base.SetInput(roundObject, roundObject2, roundRadius); base.ShowActiveObject = false; base.OnSetAction(); }
public override void OnSetAction() { base.ActiveObject = null; // line = new Line(); base.TitleId = "ToolsCutOffMultiple"; iCurve1 = null; iCurve2 = null; cutOffLen = ConstrDefaults.DefaultCutOffLength; cutOffAng = ConstrDefaults.DefaultCutOffAngle; methodSelect = ConstrDefaults.DefaultCutOffMethod; cutOffObject = new CurveInput("ToolsCutOff.Object"); cutOffObject.MouseOverCurvesEvent += new CurveInput.MouseOverCurvesDelegate(CutOffObject); cutOffObject.CurveSelectionChangedEvent += new CurveInput.CurveSelectionChangedDelegate(CutOffObjectChanged); cutOffObject.HitCursor = CursorTable.GetCursor("CutOff.cur"); cutOffObject.ModifiableOnly = true; cutOffLength = new LengthInput("ToolsCutOff.Length"); // cutOffLength.Optional = true; cutOffLength.ForwardMouseInputTo = cutOffObject; cutOffLength.DefaultLength = ConstrDefaults.DefaultCutOffLength; cutOffLength.SetLengthEvent += new CADability.Actions.ConstructAction.LengthInput.SetLengthDelegate(CutOffLength); cutOffAngle = new AngleInput("ToolsCutOff.Angle"); cutOffAngle.DefaultAngle = ConstrDefaults.DefaultCutOffAngle; // cutOffAngle.Optional = true; cutOffAngle.ForwardMouseInputTo = cutOffObject; cutOffAngle.SetAngleEvent += new CADability.Actions.ConstructAction.AngleInput.SetAngleDelegate(cutOffSetAngle); cutOffMethod = new MultipleChoiceInput("ToolsCutOff.Method", "ToolsCutOff.Method.Values"); cutOffMethod.DefaultChoice = ConstrDefaults.DefaultCutOffMethod; cutOffMethod.ForwardMouseInputTo = cutOffObject; cutOffMethod.SetChoiceEvent += new CADability.Actions.ConstructAction.MultipleChoiceInput.SetChoiceDelegate(SetMethod); base.SetInput(cutOffObject, cutOffLength, cutOffAngle, cutOffMethod); base.ShowActiveObject = false; base.OnSetAction(); }
public override void OnSetAction() { base.ActiveObject = null; base.TitleId = "ToolsExpand"; CurveInput curveInput = new CurveInput("ToolsExpand.Object"); curveInput.HitCursor = CursorTable.GetCursor("Expand.cur"); curveInput.MouseOverCurvesEvent += new CurveInput.MouseOverCurvesDelegate(ExpandObject); curveInput.CurveSelectionChangedEvent += new CurveInput.CurveSelectionChangedDelegate(ExpandObjectChanged); curveInput.ModifiableOnly = true; expandSourceObject = new CurveInput("ToolsExpand.SourceObject"); expandSourceObject.Optional = true; expandSourceObject.Decomposed = true; expandSourceObject.MouseOverCurvesEvent += new CurveInput.MouseOverCurvesDelegate(ExpandSourceObject); expandSourceObject.CurveSelectionChangedEvent += new CurveInput.CurveSelectionChangedDelegate(ExpandSourceObjectChanged); distToCurve = new LengthInput("ToolsExpand.Distance"); distToCurve.Optional = true; distToCurve.SetLengthEvent += new LengthInput.SetLengthDelegate(setDistToCurve); distToCurve.DefaultLength = ConstrDefaults.DefaultExpandDist; base.SetInput(curveInput, expandSourceObject, distToCurve); base.OnSetAction(); if (sourceCurve != null) { expandSourceObject.SetCurves(new ICurve[] { sourceCurveSave }, sourceCurveSave); } base.ShowActiveObject = false; }
public override void OnSetAction() { base.ActiveObject = null; base.TitleId = "ToolsTrimSplit"; CurveInput curveInput = new CurveInput("ToolsTrimSplit.Object"); curveInput.HitCursor = CursorTable.GetCursor("TrimSplit.cur"); curveInput.MouseOverCurvesEvent += new CurveInput.MouseOverCurvesDelegate(TrimObject); curveInput.CurveSelectionChangedEvent += new CurveInput.CurveSelectionChangedDelegate(TrimObjectChanged); curveInput.ModifiableOnly = true; base.SetInput(curveInput); base.ShowActiveObject = false; base.OnSetAction(); }
public override void OnSetAction() { base.ActiveObject = null; base.TitleId = "ToolsConnect"; curve1Input = new CurveInput("ToolsConnect.Object1"); curve1Input.HitCursor = CursorTable.GetCursor("Connect.cur"); curve1Input.MouseOverCurvesEvent += new CurveInput.MouseOverCurvesDelegate(ExpandObject1); curve1Input.CurveSelectionChangedEvent += new CurveInput.CurveSelectionChangedDelegate(ExpandObject1Changed); curve1Input.ModifiableOnly = true; curve2Input = new CurveInput("ToolsConnect.Object2"); curve2Input.HitCursor = CursorTable.GetCursor("Connect.cur"); curve2Input.MouseOverCurvesEvent += new CurveInput.MouseOverCurvesDelegate(ExpandObject2); curve2Input.CurveSelectionChangedEvent += new CurveInput.CurveSelectionChangedDelegate(ExpandObject2Changed); curve2Input.ModifiableOnly = true; base.SetInput(curve1Input, curve2Input); base.OnSetAction(); }
public override void OnSetAction() { base.TitleId = "ConstructAequidist"; if (theBaseCurve == null) { baseCurve = new CurveInput("ConstructAequidist.BaseCurve"); baseCurve.MouseOverCurvesEvent += new CADability.Actions.ConstructAction.CurveInput.MouseOverCurvesDelegate(OnMouseOverCurves); baseCurve.CurveSelectionChangedEvent += new CADability.Actions.ConstructAction.CurveInput.CurveSelectionChangedDelegate(OnCurveSelectionChanged); baseCurve.HitCursor = CursorTable.GetCursor("RoundIn.cur"); baseCurve.ModifiableOnly = false; baseCurve.PreferPath = true; } distance = new LengthInput("ConstructAequidist.Distance"); distance.GetLengthEvent += new CADability.Actions.ConstructAction.LengthInput.GetLengthDelegate(OnGetDistance); distance.SetLengthEvent += new CADability.Actions.ConstructAction.LengthInput.SetLengthDelegate(OnSetDistance); distance.DefaultLength = defaultDistance; distance.CalculateLengthEvent += new CADability.Actions.ConstructAction.LengthInput.CalculateLengthDelegate(OnCalculateDist); distance.ForwardMouseInputTo = baseCurve; // kann ja auch null sein theDistance = defaultDistance; minAngle = new AngleInput("ConstructAequidist.SharpCornerMinAngle"); minAngle.GetAngleEvent += new AngleInput.GetAngleDelegate(OnGetMinAngle); minAngle.SetAngleEvent += new AngleInput.SetAngleDelegate(OnSetMinAngle); minAngle.DefaultAngle = defaultMinAngle; minAngle.Optional = true; minAngle.ForwardMouseInputTo = baseCurve; if (baseCurve != null) { SetInput(baseCurve, distance, minAngle); } else { SetInput(distance, minAngle); } base.OnSetAction(); }
public override void OnSetAction() { base.ActiveObject = null; base.TitleId = "ToolsTrim"; trimObject = new CurveInput("ToolsTrim.SourceObject"); trimObject.Optional = true; trimObject.MouseOverCurvesEvent += new CurveInput.MouseOverCurvesDelegate(TrimSourceObject); trimObject.CurveSelectionChangedEvent += new CurveInput.CurveSelectionChangedDelegate(TrimSourceObjectChanged); CurveInput curveInput = new CurveInput("ToolsTrim.Object"); curveInput.HitCursor = CursorTable.GetCursor("Trim.cur"); curveInput.MouseOverCurvesEvent += new CurveInput.MouseOverCurvesDelegate(TrimObject); curveInput.CurveSelectionChangedEvent += new CurveInput.CurveSelectionChangedDelegate(TrimObjectChanged); curveInput.PreferPath = true; // Pfade werden bevorzugt, d.h. keine Teilobjekte von Pfaden liefern curveInput.ModifiableOnly = true; base.SetInput(curveInput, trimObject); base.ShowActiveObject = false; base.OnSetAction(); if (sourceCurve != null) { trimObject.SetCurves(new ICurve[] { sourceCurveSave }, sourceCurveSave); } }
// private double RoundRadiusCalc(GeoPoint MousePosition) // { // radiusPoint = MousePosition; // if (roundObject.Fixed) { if (showRound()) return roundRadCalc; } // return roundRad; // } /// <summary> /// Overrides <see cref="CADability.Actions.ConstructAction.OnSetAction ()"/> /// </summary> public override void OnSetAction() { base.ActiveObject = null; blk = Block.Construct(); iCurveOrg = null; // zum nicht Weglöschen des Originals in onDone base.TitleId = "ToolsRoundMultiple"; roundRad = ConstrDefaults.DefaultRoundRadius; // roundRadCalc = roundRad; roundObject = new CurveInput("ToolsRound.Object"); roundObject.MouseOverCurvesEvent += new CurveInput.MouseOverCurvesDelegate(RoundObject); roundObject.CurveSelectionChangedEvent += new CurveInput.CurveSelectionChangedDelegate(RoundObjectChanged); roundObject.HitCursor = CursorTable.GetCursor("RoundOff.cur"); roundObject.ModifiableOnly = true; roundRadius = new LengthInput("ToolsRound.Radius"); // roundRadius.Optional = true; roundRadius.ForwardMouseInputTo = roundObject; roundRadius.DefaultLength = ConstrDefaults.DefaultRoundRadius; // roundRadius.OnCalculateLength +=new Condor.Actions.ConstructAction.LengthInput.CalculateLength(RoundRadiusCalc); roundRadius.SetLengthEvent += new CADability.Actions.ConstructAction.LengthInput.SetLengthDelegate(RoundRadius); base.SetInput(roundObject, roundRadius); base.ShowActiveObject = false; base.OnSetAction(); }
private bool RoundObject2(CurveInput sender, ICurve[] Curves, bool up) { // Mittelpunkt der beiden Pickpunkte objectPoint = new GeoPoint(base.CurrentMousePosition, objectPoint1); if (up) { if (Curves.Length == 0) { sender.SetCurves(Curves, null); // ...die werden jetzt im ControlCenter dargestellt (nur bei up) } else { sender.SetCurves(Curves, Curves[0]); } } if (Curves.Length > 0) { if (composedSingle2Objects) { iCurve1 = iCurve1Sav; } composedSingle2Objects = false; iCurve2 = Curves[0]; if ((iCurve1 is Path) & (iCurve1 == iCurve2) & (iCurve1.SubCurves.Length > 1)) { iCurveComposedSplit = iCurve1; composedSplit = true; iCurve1 = (Curves[0] as Path).Curve(0).Clone(); // das erste iCurve2 = (Curves[0] as Path).Curve((Curves[0] as Path).Count - 1).Clone(); // das letzte if (showRound()) { composedSingle2Objects = true; // kompiziertes Konstrukt, um den Bogen selber zu entfernen, temporäres Array, eins kürzer ICurve[] iCurveShort = new ICurve[(iCurveComposedSplit as Path).Count - 2]; for (int i = 0; i < iCurveShort.Length; ++i) { // wir brauchen Clones um den Originalpfad nicht zu zerstören iCurveShort[i] = iCurveComposedSplit.SubCurves[i + 1].Clone(); } // Kopie auf das kürzere Array // Array.Copy(iCurveComposedSplit.SubCurves,1,iCurveShort,0,(iCurveComposedSplit as Path).Count - 2); // neu mit dem kleinen Array iCurveComposedSingle2Objects = Path.Construct(); (iCurveComposedSingle2Objects as Path).Set(iCurveShort); (iCurveComposedSingle2Objects as IGeoObject).CopyAttributes(iCurveComposedSplit as IGeoObject); // gemerkte Attribute setzen roundObject2.HitCursor = CursorTable.GetCursor("RoundOffReady.cur"); return(true); } iCurve1 = iCurveComposedSplit; } if (showRound()) { roundObject2.HitCursor = CursorTable.GetCursor("RoundOffReady.cur"); return(true); } else { // roundObject2.HitCursor = CursorTable.GetCursor("RoundOff.cur"); return(false); } } base.ActiveObject = null; base.FeedBack.ClearSelected(); return(false); }
private bool RoundObject(CurveInput sender, ICurve[] Curves, bool up) { // ... nur die sinnvolen Kurven verwenden objectPoint1 = base.CurrentMousePosition; objectPoint = objectPoint1; if (up) { if (Curves.Length == 0) { sender.SetCurves(Curves, null); // ...die werden jetzt im ControlCenter dargestellt (nur bei up) } else { sender.SetCurves(Curves, Curves[0]); } } // composedSingle = false; composedSplit = false; iCurveComposedSplit = null; pathCreatedFromModel = null; if (Curves.Length == 1) { // er hat nur eine Kurve gewählt, also roundObject2 freischalten iCurve1 = Curves[0]; iCurve1Sav = iCurve1; roundObject2.Optional = false; roundObject2.ReadOnly = false; roundObject.HitCursor = CursorTable.GetCursor("RoundIn.cur"); base.ActiveObject = null; base.FeedBack.ClearSelected(); // composedSplit = false; ICurve pathHit = null; if (Curves[0].IsComposed) // also: Pfad oder Polyline { pathHit = Curves[0].Clone(); iCurveComposedSplit = Curves[0]; // merken für OnDone zum löschen und Attributsetzen ToolsRoundOff.pathTestIntersection(pathHit, objectPoint); // showRoundPathTestIntersection(pathHit); } else { Path p = CADability.GeoObject.Path.CreateFromModel(Curves[0] as ICurve, Frame.ActiveView.Model, Frame.ActiveView.Projection, true); if (p != null) { pathHit = p as ICurve; } pathCreatedFromModel = p; ownerCreated = (Curves[0] as IGeoObject).Owner; } if (pathHit != null) { // jetzt an der Mausposition aufknacken in 2 Pathes ICurve[] tmpCurves = roundObject.SplitAtMousePosition(pathHit); if (tmpCurves.Length == 2) { iCurve1 = tmpCurves[0]; iCurve2 = tmpCurves[1]; composedSplit = true; if (showRound()) { roundObject2.Optional = true; roundObject2.ReadOnly = true; roundObject.HitCursor = CursorTable.GetCursor("RoundInReady.cur"); } else { iCurve1 = Curves[0]; composedSplit = false; roundObject2.Optional = false; roundObject2.ReadOnly = false; roundObject.HitCursor = CursorTable.GetCursor("RoundIn.cur"); } } } return(true); // base.SetFocus(roundObject2,true); } if (Curves.Length >= 2) { // nachsehen, ob ein realer Schnittpunkt da ist double[] cutPlace = CADability.GeoObject.Curves.Intersect(Curves[0], Curves[1], true); if (cutPlace.Length > 0) // nur reale Schnittpunkte sollen gelten { // er hat zwei Kurven gewählt, also roundObject2 ausschalten iCurve1 = Curves[0]; iCurve2 = Curves[1]; if (showRound()) { roundObject2.Optional = true; roundObject2.ReadOnly = true; roundObject.HitCursor = CursorTable.GetCursor("RoundInReady.cur"); return(true); } else { roundObject.HitCursor = CursorTable.GetCursor("RoundIn.cur"); roundObject2.Optional = false; roundObject2.ReadOnly = false; base.ActiveObject = null; base.FeedBack.ClearSelected(); return(false); } // return(showRound()); } } roundObject.HitCursor = CursorTable.GetCursor("RoundIn.cur"); roundObject2.Optional = false; roundObject2.ReadOnly = false; base.ActiveObject = null; base.FeedBack.ClearSelected(); return(false); }