private void OnSetMajorAxis(GeneralGeoPointAction sender, GeoPoint NewValue) { GeoVector majax = NewValue - ellipse.Center; // ändert auch den Radius GeoVector minax = ellipse.Plane.Normal ^ majax; // oder umgekehrt if (Precision.IsNullVector(minax) || Precision.IsNullVector(majax)) { return; // nix zu tun } minax.Norm(); minax = ellipse.MinorRadius * minax; majax.Norm(); majax = ellipse.MajorRadius * majax; ellipse.SetEllipseCenterAxis(ellipse.Center, majax, minax); majorAxisProperty.SetHotspotPosition(ellipse.Center + ellipse.MajorAxis); minorAxisProperty.SetHotspotPosition(ellipse.Center + ellipse.MinorAxis); }
private void DimensionDidChange(IGeoObject Sender, GeoObjectChange Change) { if (ignoreChange) { return; // es wird. z.B. gerade ein Punkt entfernt } // und die Properties müssen erst wieder neu Refresht werden if (HotspotChangedEvent != null) { // mitführen der TextHotSpots. Die Hotspots der Punkte werden automatisch // mitgeführt, ebenso der für die DimLineRef for (int i = 0; i < textPosHotSpot.Length; ++i) { textPos[i].DoubleChanged(); textPosHotSpot[i].Position = dimension.GetTextPosCoordinate(i, Frame.ActiveView.Projection); HotspotChangedEvent(textPosHotSpot[i], HotspotChangeMode.Moved); } if (startAngle != null) { startAngle.GeoVectorChanged(); endAngle.GeoVectorChanged(); startAngle.SetHotspotPosition(dimension.GetPoint(1)); endAngle.SetHotspotPosition(dimension.GetPoint(2)); HotspotChangedEvent(startAngleHotSpot, HotspotChangeMode.Moved); HotspotChangedEvent(endAngleHotSpot, HotspotChangeMode.Moved); } if (centerProperty != null) { centerProperty.GeoPointChanged(); // Refresh HotspotChangedEvent(centerProperty, HotspotChangeMode.Moved); } if (radiusProperty != null) { radiusProperty.DoubleChanged(); } } int numprop = 1; if (dimension.DimType == Dimension.EDimType.DimPoints || dimension.DimType == Dimension.EDimType.DimCoord) { numprop = dimension.PointCount - 1; } if (numprop != dimText.Length) { Opened(false); // alle hotspots abmelden Init(); if (propertyPage != null) { propertyPage.Refresh(this); propertyPage.OpenSubEntries(points, true); } } }
private IPropertyEntry[] attributeProperties; // Anzeigen für die Attribute (Ebene, Farbe u.s.w) public ShowPropertyEllipse(Ellipse Ellipse, IFrame frame) : base(frame) { this.ellipse = Ellipse; centerProperty = new GeoPointProperty("Ellipse.Center", Frame, true); centerProperty.SetGeoPointEvent += new CADability.UserInterface.GeoPointProperty.SetGeoPointDelegate(OnSetCenter); centerProperty.GetGeoPointEvent += new CADability.UserInterface.GeoPointProperty.GetGeoPointDelegate(OnGetCenter); centerProperty.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyCenterWithMouse); centerProperty.PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnStateChanged); majorRadiusProperty = new LengthProperty("Ellipse.MajorRadius", Frame, true); majorRadiusProperty.SetLengthEvent += new CADability.UserInterface.LengthProperty.SetLengthDelegate(OnSetMajorRadius); majorRadiusProperty.GetLengthEvent += new CADability.UserInterface.LengthProperty.GetLengthDelegate(OnGetMajorRadius); majorRadiusProperty.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyMajorRadiusWithMouse); majorRadiusProperty.PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnStateChanged); majorRadiusHotSpot = new LengthHotSpot[2]; majorRadiusHotSpot[0] = new LengthHotSpot(majorRadiusProperty); majorRadiusHotSpot[0].Position = ellipse.Center + 2.0 / 3.0 * ellipse.MajorAxis; majorRadiusHotSpot[1] = new LengthHotSpot(majorRadiusProperty); majorRadiusHotSpot[1].Position = ellipse.Center - 2.0 / 3.0 * ellipse.MajorAxis; minorRadiusProperty = new LengthProperty("Ellipse.MinorRadius", Frame, true); minorRadiusProperty.SetLengthEvent += new CADability.UserInterface.LengthProperty.SetLengthDelegate(OnSetMinorRadius); minorRadiusProperty.GetLengthEvent += new CADability.UserInterface.LengthProperty.GetLengthDelegate(OnGetMinorRadius); minorRadiusProperty.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyMinorRadiusWithMouse); minorRadiusProperty.PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnStateChanged); minorRadiusHotSpot = new LengthHotSpot[2]; minorRadiusHotSpot[0] = new LengthHotSpot(minorRadiusProperty); minorRadiusHotSpot[0].Position = ellipse.Center + 2.0 / 3.0 * ellipse.MinorAxis; minorRadiusHotSpot[1] = new LengthHotSpot(minorRadiusProperty); minorRadiusHotSpot[1].Position = ellipse.Center - 2.0 / 3.0 * ellipse.MinorAxis; majorAxisProperty = new GeoVectorProperty("Ellipse.MajorAxis", Frame, true); majorAxisProperty.SetHotspotPosition(ellipse.Center + ellipse.MajorAxis); majorAxisProperty.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyMajorAxisWithMouse); majorAxisProperty.SetGeoVectorEvent += new CADability.UserInterface.GeoVectorProperty.SetGeoVectorDelegate(OnSetMajorAxis); majorAxisProperty.GetGeoVectorEvent += new CADability.UserInterface.GeoVectorProperty.GetGeoVectorDelegate(OnGetMajorAxis); majorAxisProperty.PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnStateChanged); majorAxisHotSpot = new GeoVectorHotSpot[2]; majorAxisHotSpot[0] = new GeoVectorHotSpot(majorAxisProperty); majorAxisHotSpot[0].Position = ellipse.Center + ellipse.MajorAxis; majorAxisHotSpot[1] = new GeoVectorHotSpot(majorAxisProperty); majorAxisHotSpot[1].Position = ellipse.Center - ellipse.MajorAxis; minorAxisProperty = new GeoVectorProperty("Ellipse.MinorAxis", Frame, true); minorAxisProperty.SetHotspotPosition(ellipse.Center + ellipse.MinorAxis); minorAxisProperty.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyMinorAxisWithMouse); minorAxisProperty.SetGeoVectorEvent += new CADability.UserInterface.GeoVectorProperty.SetGeoVectorDelegate(OnSetMinorAxis); minorAxisProperty.GetGeoVectorEvent += new CADability.UserInterface.GeoVectorProperty.GetGeoVectorDelegate(OnGetMinorAxis); minorAxisProperty.PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnStateChanged); minorAxisHotSpot = new GeoVectorHotSpot[2]; minorAxisHotSpot[0] = new GeoVectorHotSpot(minorAxisProperty); minorAxisHotSpot[0].Position = ellipse.Center + ellipse.MinorAxis; minorAxisHotSpot[1] = new GeoVectorHotSpot(minorAxisProperty); minorAxisHotSpot[1].Position = ellipse.Center - ellipse.MinorAxis; if (Ellipse.IsArc) { startAngleProperty = new AngleProperty("Ellipse.StartAngle", Frame, true); startAngleProperty.GetAngleEvent += new AngleProperty.GetAngleDelegate(OnGetStartAngle); startAngleProperty.SetAngleEvent += new AngleProperty.SetAngleDelegate(OnSetStartAngle); startAngleProperty.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyStartAngleWithMouse); startAngleProperty.PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnStateChanged); startAngleHotSpot = new AngleHotSpot(startAngleProperty); startAngleHotSpot.Position = ellipse.StartPoint; endAngleProperty = new AngleProperty("Ellipse.EndAngle", Frame, true); endAngleProperty.GetAngleEvent += new AngleProperty.GetAngleDelegate(OnGetEndAngle); endAngleProperty.SetAngleEvent += new AngleProperty.SetAngleDelegate(OnSetEndAngle); endAngleProperty.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyEndAngleWithMouse); endAngleProperty.PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnStateChanged); endAngleHotSpot = new AngleHotSpot(endAngleProperty); endAngleHotSpot.Position = ellipse.EndPoint; directionProperty = new BooleanProperty("Ellipse.Direction", "Arc.Direction.Values"); directionProperty.BooleanValue = ellipse.SweepParameter > 0.0; directionProperty.GetBooleanEvent += new CADability.UserInterface.BooleanProperty.GetBooleanDelegate(OnGetDirection); directionProperty.SetBooleanEvent += new CADability.UserInterface.BooleanProperty.SetBooleanDelegate(OnSetDirection); // hat keinen Hotspot startPointProperty = new GeoPointProperty("Ellipse.StartPoint", Frame, false); startPointProperty.GetGeoPointEvent += new CADability.UserInterface.GeoPointProperty.GetGeoPointDelegate(OnGetStartPoint); startPointProperty.ReadOnly = true; startPointProperty.PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnStateChanged); endPointProperty = new GeoPointProperty("Ellipse.EndPoint", Frame, false); endPointProperty.GetGeoPointEvent += new CADability.UserInterface.GeoPointProperty.GetGeoPointDelegate(OnGetEndPoint); endPointProperty.ReadOnly = true; endPointProperty.PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnStateChanged); base.resourceId = "EllipseArc.Object"; } else { if (Settings.GlobalSettings.GetBoolValue("CircleShowStartPointProperty", false)) { startAngleProperty = new AngleProperty("Ellipse.StartAngle", Frame, true); startAngleProperty.GetAngleEvent += new AngleProperty.GetAngleDelegate(OnGetStartAngle); startAngleProperty.SetAngleEvent += new AngleProperty.SetAngleDelegate(OnSetStartAngle); startAngleProperty.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyStartAngleWithMouse); startAngleProperty.PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnStateChanged); startAngleHotSpot = new AngleHotSpot(startAngleProperty); startAngleHotSpot.Position = ellipse.StartPoint; directionProperty = new BooleanProperty("Ellipse.Direction", "Arc.Direction.Values"); directionProperty.BooleanValue = ellipse.SweepParameter > 0.0; directionProperty.GetBooleanEvent += new CADability.UserInterface.BooleanProperty.GetBooleanDelegate(OnGetDirection); directionProperty.SetBooleanEvent += new CADability.UserInterface.BooleanProperty.SetBooleanDelegate(OnSetDirection); // hat keinen Hotspot startPointProperty = new GeoPointProperty("Ellipse.StartPoint", Frame, false); startPointProperty.GetGeoPointEvent += new CADability.UserInterface.GeoPointProperty.GetGeoPointDelegate(OnGetStartPoint); startPointProperty.ReadOnly = true; startPointProperty.PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnStateChanged); } base.resourceId = "Ellipse.Object"; } attributeProperties = ellipse.GetAttributeProperties(Frame); }
private void Init() { // Initialisiert den gesammten Inhalt des TreeViews // danach sollte meist propertyPage.Refresh(this); aufgerufen werden subProperties = null; if (dimension.DimType == Dimension.EDimType.DimPoints || dimension.DimType == Dimension.EDimType.DimCoord) { points = new MultiGeoPointProperty(this, "Dimension.Points", this.Frame); points.ModifyWithMouseEvent += new CADability.UserInterface.MultiGeoPointProperty.ModifyWithMouseIndexDelegate(OnModifyPointWithMouse); points.PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnPointsStateChanged); points.GeoPointSelectionChangedEvent += new CADability.UserInterface.GeoPointProperty.SelectionChangedDelegate(OnPointsSelectionChanged); direction = new GeoVectorProperty("Dimension.Direction", Frame, true); direction.GetGeoVectorEvent += new CADability.UserInterface.GeoVectorProperty.GetGeoVectorDelegate(OnGetDirection); direction.SetGeoVectorEvent += new CADability.UserInterface.GeoVectorProperty.SetGeoVectorDelegate(OnSetDirection); } if (dimension.DimType == Dimension.EDimType.DimRadius) { radiusProperty = new DoubleProperty("Dimension.Radius", Frame); radiusProperty.SetDoubleEvent += new CADability.UserInterface.DoubleProperty.SetDoubleDelegate(OnSetRadius); radiusProperty.GetDoubleEvent += new CADability.UserInterface.DoubleProperty.GetDoubleDelegate(OnGetRadius); radiusProperty.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyRadiusWithMouse); radiusProperty.DoubleChanged(); } if (dimension.DimType == Dimension.EDimType.DimDiameter) { radiusProperty = new DoubleProperty("Dimension.Diameter", Frame); radiusProperty.SetDoubleEvent += new CADability.UserInterface.DoubleProperty.SetDoubleDelegate(OnSetRadius); radiusProperty.GetDoubleEvent += new CADability.UserInterface.DoubleProperty.GetDoubleDelegate(OnGetRadius); radiusProperty.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyRadiusWithMouse); radiusProperty.DoubleChanged(); } if (dimension.DimType == Dimension.EDimType.DimDiameter || dimension.DimType == Dimension.EDimType.DimRadius || dimension.DimType == Dimension.EDimType.DimLocation || dimension.DimType == Dimension.EDimType.DimAngle) { // haben alle einen Mittelpunkt als Punkt 0 centerProperty = new GeoPointProperty("Dimension.Center", Frame, true); centerProperty.GetGeoPointEvent += new CADability.UserInterface.GeoPointProperty.GetGeoPointDelegate(OnGetCenter); centerProperty.SetGeoPointEvent += new CADability.UserInterface.GeoPointProperty.SetGeoPointDelegate(OnSetCenter); centerProperty.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyCenterWithMouse); } if (dimension.DimType == Dimension.EDimType.DimAngle) { // start- und Endwinkel startAngle = new GeoVectorProperty("Dimension.Startangle", Frame, true); startAngle.GetGeoVectorEvent += new CADability.UserInterface.GeoVectorProperty.GetGeoVectorDelegate(OnGetStartAngle); startAngle.SetGeoVectorEvent += new CADability.UserInterface.GeoVectorProperty.SetGeoVectorDelegate(OnSetStartAngle); startAngle.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyStartAngleWithMouse); startAngle.SetHotspotPosition(dimension.GetPoint(1)); endAngle = new GeoVectorProperty("Dimension.Endangle", Frame, true); endAngle.GetGeoVectorEvent += new CADability.UserInterface.GeoVectorProperty.GetGeoVectorDelegate(OnGetEndAngle); endAngle.SetGeoVectorEvent += new CADability.UserInterface.GeoVectorProperty.SetGeoVectorDelegate(OnSetEndAngle); endAngle.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyEndAngleWithMouse); endAngle.SetHotspotPosition(dimension.GetPoint(2)); startAngleHotSpot = new GeoVectorHotSpot(startAngle); endAngleHotSpot = new GeoVectorHotSpot(endAngle); } dimLineRef = new GeoPointProperty("Dimension.DimLineRef", Frame, true); dimLineRef.GetGeoPointEvent += new CADability.UserInterface.GeoPointProperty.GetGeoPointDelegate(OnGetDimLineRef); dimLineRef.SetGeoPointEvent += new CADability.UserInterface.GeoPointProperty.SetGeoPointDelegate(OnSetDimLineRef); dimLineRef.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyDimLineRef); dimLineRef.PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnStateChanged); // die String Eingabefelder: int numprop = 1; if (dimension.DimType == Dimension.EDimType.DimPoints || dimension.DimType == Dimension.EDimType.DimCoord) { numprop = dimension.PointCount - 1; } textPosHotSpot = new DoubleHotSpot[numprop]; textPos = new DoubleProperty[numprop]; dimText = new StringProperty[numprop]; tolPlusText = new StringProperty[numprop]; tolMinusText = new StringProperty[numprop]; prefix = new StringProperty[numprop]; postfix = new StringProperty[numprop]; postfixAlt = new StringProperty[numprop]; for (int i = 0; i < numprop; ++i) { textPos[i] = new DoubleProperty("Dimension.TextPos", Frame); textPos[i].UserData.Add("Index", i); textPos[i].GetDoubleEvent += new CADability.UserInterface.DoubleProperty.GetDoubleDelegate(OnGetTextPos); textPos[i].SetDoubleEvent += new CADability.UserInterface.DoubleProperty.SetDoubleDelegate(OnSetTextPos); textPos[i].DoubleChanged(); textPos[i].ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyTextPosWithMouse); textPos[i].PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnStateChanged); textPosHotSpot[i] = new DoubleHotSpot(textPos[i]); textPosHotSpot[i].Position = dimension.GetTextPosCoordinate(i, Frame.ActiveView.Projection); dimText[i] = new StringProperty(dimension.GetDimText(i), "Dimension.DimText"); dimText[i].UserData.Add("Index", i); dimText[i].SetStringEvent += new CADability.UserInterface.StringProperty.SetStringDelegate(OnSetDimText); dimText[i].GetStringEvent += new CADability.UserInterface.StringProperty.GetStringDelegate(OnGetDimText); tolPlusText[i] = new StringProperty(dimension.GetTolPlusText(i), "Dimension.TolPlusText"); tolPlusText[i].UserData.Add("Index", i); tolPlusText[i].SetStringEvent += new CADability.UserInterface.StringProperty.SetStringDelegate(OnSetTolPlusText); tolPlusText[i].GetStringEvent += new CADability.UserInterface.StringProperty.GetStringDelegate(OnGetTolPlusText); tolMinusText[i] = new StringProperty(dimension.GetTolMinusText(i), "Dimension.TolMinusText"); tolMinusText[i].UserData.Add("Index", i); tolMinusText[i].SetStringEvent += new CADability.UserInterface.StringProperty.SetStringDelegate(OnSetTolMinusText); tolMinusText[i].GetStringEvent += new CADability.UserInterface.StringProperty.GetStringDelegate(OnGetTolMinusText); prefix[i] = new StringProperty(dimension.GetPrefix(i), "Dimension.Prefix"); prefix[i].UserData.Add("Index", i); prefix[i].SetStringEvent += new CADability.UserInterface.StringProperty.SetStringDelegate(OnSetPrefix); prefix[i].GetStringEvent += new CADability.UserInterface.StringProperty.GetStringDelegate(OnGetPrefix); postfix[i] = new StringProperty(dimension.GetPostfix(i), "Dimension.Postfix"); postfix[i].UserData.Add("Index", i); postfix[i].SetStringEvent += new CADability.UserInterface.StringProperty.SetStringDelegate(OnSetPostfix); postfix[i].GetStringEvent += new CADability.UserInterface.StringProperty.GetStringDelegate(OnGetPostfix); postfixAlt[i] = new StringProperty(dimension.GetPostfixAlt(i), "Dimension.PostfixAlt"); postfixAlt[i].UserData.Add("Index", i); postfixAlt[i].SetStringEvent += new CADability.UserInterface.StringProperty.SetStringDelegate(OnSetPostfixAlt); postfixAlt[i].GetStringEvent += new CADability.UserInterface.StringProperty.GetStringDelegate(OnGetPostfixAlt); } }