Exemple #1
0
 private void OnSetWidthParallel(LengthProperty sender, double l)
 {
     if (!Precision.IsNull(l))
     {
         polyline.ParallelogramWidth = l;
     }
 }
 private void OnSetLength(LengthProperty sender, double l)
 {
     if (l != 0.0)
     {
         line.Length = l;
     }
 }
Exemple #3
0
 private void OnSetHeight(LengthProperty sender, double l)
 {
     if (!Precision.IsNull(l))
     {
         polyline.RectangleHeight = l;
     }
 }
Exemple #4
0
 private void OnSetWidth(LengthProperty sender, double l)
 {
     if (!Precision.IsNull(l))
     {
         polyline.RectangleWidth = l;
     }
 }
        public ShowPropertyLine(Line line, IFrame frame) : base(frame)
        {
            this.line = line;

            startPointProperty = new GeoPointProperty("Line.StartPoint", Frame, true);
            startPointProperty.GetGeoPointEvent               += new CADability.UserInterface.GeoPointProperty.GetGeoPointDelegate(OnGetStartPoint);
            startPointProperty.SetGeoPointEvent               += new CADability.UserInterface.GeoPointProperty.SetGeoPointDelegate(OnSetStartPoint);
            startPointProperty.ModifyWithMouseEvent           += new ModifyWithMouseDelegate(ModifyStartPointWithMouse);
            startPointProperty.PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnStateChanged);

            endPointProperty = new GeoPointProperty("Line.EndPoint", Frame, true);
            endPointProperty.GetGeoPointEvent               += new CADability.UserInterface.GeoPointProperty.GetGeoPointDelegate(OnGetEndPoint);
            endPointProperty.SetGeoPointEvent               += new CADability.UserInterface.GeoPointProperty.SetGeoPointDelegate(OnSetEndPoint);
            endPointProperty.ModifyWithMouseEvent           += new ModifyWithMouseDelegate(ModifyEndPointWithMouse);
            endPointProperty.PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnStateChanged);
            lengthProperty = new LengthProperty("Line.Length", Frame, true);
            lengthProperty.GetLengthEvent                 += new CADability.UserInterface.LengthProperty.GetLengthDelegate(OnGetLength);
            lengthProperty.SetLengthEvent                 += new CADability.UserInterface.LengthProperty.SetLengthDelegate(OnSetLength);
            lengthProperty.ModifyWithMouseEvent           += new ModifyWithMouseDelegate(ModifyLengthWithMouse);
            lengthProperty.PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnStateChanged);
            lengthHotSpot          = new LengthHotSpot(lengthProperty);
            lengthHotSpot.Position = line.PointAt(2.0 / 3.0);

            directionProperty = new GeoVectorProperty("Line.Direction", Frame, false);
            directionProperty.IsNormedVector                  = true;
            directionProperty.GetGeoVectorEvent              += new CADability.UserInterface.GeoVectorProperty.GetGeoVectorDelegate(OnGetDirection);
            directionProperty.SetGeoVectorEvent              += new CADability.UserInterface.GeoVectorProperty.SetGeoVectorDelegate(OnSetDirection);
            directionProperty.ModifyWithMouseEvent           += new ModifyWithMouseDelegate(ModifyDirectionWithMouse);
            directionProperty.PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnStateChanged);
            directionHotSpot          = new GeoVectorHotSpot(directionProperty);
            directionHotSpot.Position = line.PointAt(1.0 / 3.0);

            IPropertyEntry[] sp = line.GetAttributeProperties(Frame); // change signature of GetAttributeProperties
            attributeProperties = new IPropertyEntry[sp.Length];
            for (int i = 0; i < sp.Length; i++)
            {
                attributeProperties[i] = sp[i] as IPropertyEntry;
            }

            base.resourceId = "Line.Object";
        }
 private double OnGetLength(LengthProperty sender)
 {
     return(line.Length);
 }
Exemple #7
0
 private double OnGetHeight(LengthProperty sender)
 {
     return(polyline.RectangleHeight);
 }
 private double OnGetRadius(LengthProperty sender)
 {
     return(circle.Radius);
 }
 private void OnSetMinorRadius(LengthProperty sender, double l)
 {
     ellipse.MinorRadius = l;
 }
Exemple #10
0
 private double OnGetWidth(LengthProperty sender)
 {
     return(polyline.RectangleWidth);
 }
Exemple #11
0
        private void InitSubEntries()
        {
            vertexProperty = new MultiGeoPointProperty(new VertexIndexedGeoPoint(this), "Polyline.Vertex", this.Frame);
            vertexProperty.ModifyWithMouseEvent          += new CADability.UserInterface.MultiGeoPointProperty.ModifyWithMouseIndexDelegate(OnModifyVertexWithMouse);
            vertexProperty.GeoPointSelectionChangedEvent += new CADability.UserInterface.GeoPointProperty.SelectionChangedDelegate(OnPointsSelectionChanged);
            (vertexProperty as IPropertyEntry).PropertyEntryChangedStateEvent += OnVertexPropertyStateChanged;
            vertexProperty.PrependContextMenue = MenuResource.LoadMenuDefinition("MenuId.Path.Vertex", false, this);

            if (polyline.IsRectangle)
            {
                subEntries       = new IPropertyEntry[2];
                locationProperty = new GeoPointProperty("Rectangle.Location", Frame, true);
                locationProperty.GetGeoPointEvent     += new CADability.UserInterface.GeoPointProperty.GetGeoPointDelegate(OnGetLocation);
                locationProperty.SetGeoPointEvent     += new CADability.UserInterface.GeoPointProperty.SetGeoPointDelegate(OnSetLocation);
                locationProperty.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyLocationWithMouse);

                LengthProperty width = new LengthProperty("Rectangle.Width", Frame, true);
                width.GetLengthEvent       += new CADability.UserInterface.LengthProperty.GetLengthDelegate(OnGetWidth);
                width.SetLengthEvent       += new CADability.UserInterface.LengthProperty.SetLengthDelegate(OnSetWidth);
                width.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyWidthWithMouse);
                widthHotSpot                       = new ShowPropertyHotSpot(width, Frame);
                widthHotSpot.Position              = polyline.RectangleLocation + 0.5 * polyline.ParallelogramSecondaryDirection + polyline.ParallelogramMainDirection;
                widthHotSpot.PositionChangedEvent += new CADability.UserInterface.ShowPropertyHotSpot.PositionChangedDelegate(OnWidthPositionChanged);

                LengthProperty height = new LengthProperty("Rectangle.Height", Frame, true);
                height.GetLengthEvent       += new CADability.UserInterface.LengthProperty.GetLengthDelegate(OnGetHeight);
                height.SetLengthEvent       += new CADability.UserInterface.LengthProperty.SetLengthDelegate(OnSetHeight);
                height.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyHeightWithMouse);
                heightHotSpot                       = new ShowPropertyHotSpot(height, Frame);
                heightHotSpot.Position              = polyline.RectangleLocation + polyline.ParallelogramSecondaryDirection + 0.5 * polyline.ParallelogramMainDirection;
                heightHotSpot.PositionChangedEvent += new CADability.UserInterface.ShowPropertyHotSpot.PositionChangedDelegate(OnHeightPositionChanged);

                GeoVectorProperty direction = new GeoVectorProperty("Rectangle.Direction", Frame, true);
                direction.GetGeoVectorEvent    += new CADability.UserInterface.GeoVectorProperty.GetGeoVectorDelegate(OnGetDirectionX);
                direction.SetGeoVectorEvent    += new CADability.UserInterface.GeoVectorProperty.SetGeoVectorDelegate(OnSetDirectionX);
                direction.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyDirectionXWithMouse);
                directionHotSpot          = new GeoVectorHotSpot(direction);
                directionHotSpot.Position = polyline.RectangleLocation + polyline.ParallelogramMainDirection;

                sizeHotSpot = new GeoPointHotSpot(polyline.RectangleLocation + polyline.ParallelogramSecondaryDirection + polyline.ParallelogramMainDirection);
                sizeHotSpot.StartDragHotspotEvent += new GeoPointHotSpot.StartDragHotspotDelegate(OnSizeHotSpotStartDragHotspot);

                rectangleProperty = new GroupProperty("Polyline.Rectangle", new IPropertyEntry[] { locationProperty, width, height, direction });
                subEntries[0]     = rectangleProperty;
                (rectangleProperty as IPropertyEntry).PropertyEntryChangedStateEvent += OnRectanglePropertyStateChanged;

                subEntries[1] = vertexProperty;
            }
            else

            if (polyline.IsParallelogram)
            {
                subEntries = new IPropertyEntry[2];
                locationParallelProperty = new GeoPointProperty("Rectangle.Location", Frame, true);
                locationParallelProperty.GetGeoPointEvent     += new CADability.UserInterface.GeoPointProperty.GetGeoPointDelegate(OnGetParallelLocation);
                locationParallelProperty.SetGeoPointEvent     += new CADability.UserInterface.GeoPointProperty.SetGeoPointDelegate(OnSetParallelLocation);
                locationParallelProperty.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyLocationWithMouse);

                /*
                 *              LengthProperty widthParallel = new LengthProperty("Rectangle.Width",Frame,true);
                 *              widthParallel.OnGetLength += new Condor.LengthProperty.GetLengthDelegate(OnGetWidthParallel);
                 *              widthParallel.OnSetLength += new Condor.LengthProperty.SetLengthDelegate(OnSetWidthParallel);
                 *              widthParallel.ModifyWithMouse += new ModifyWithMouseDelegate(ModifyWidthWithMouse);
                 *              widthParallelHotSpot = new ShowPropertyHotSpot(widthParallel,Frame);
                 *              widthParallelHotSpot.Position = polyline.ParallelogramLocation+0.5*polyline.ParallelogramSecondaryDirection+polyline.ParallelogramMainDirection;
                 *              widthParallelHotSpot.PositionChanged += new Condor.ShowPropertyHotSpot.PositionChangedDelegate(OnWidthParallelPositionChanged);
                 *
                 *              LengthProperty heightParallel = new LengthProperty("Rectangle.Height",Frame,true);
                 *              heightParallel.OnGetLength += new Condor.LengthProperty.GetLengthDelegate(OnGetHeightParallel);
                 *              heightParallel.OnSetLength += new Condor.LengthProperty.SetLengthDelegate(OnSetHeightParallel);
                 *              heightParallel.ModifyWithMouse += new ModifyWithMouseDelegate(ModifyHeightParallelWithMouse);
                 *              heightParallelHotSpot = new ShowPropertyHotSpot(height,Frame);
                 *              heightParallelHotSpot.Position = polyline.ParallelogramLocation+polyline.ParallelogramSecondaryDirection+0.5*polyline.ParallelogramMainDirection;
                 *              heightParallelHotSpot.PositionChanged += new Condor.ShowPropertyHotSpot.PositionChangedDelegate(OnHeightPositionChanged);
                 *
                 */
                GeoVectorProperty directionXParallel = new GeoVectorProperty("Parallelogram.DirectionX", Frame, true);
                directionXParallel.GetGeoVectorEvent    += new CADability.UserInterface.GeoVectorProperty.GetGeoVectorDelegate(OnGetDirectionXParallel);
                directionXParallel.SetGeoVectorEvent    += new CADability.UserInterface.GeoVectorProperty.SetGeoVectorDelegate(OnSetDirectionXParallel);
                directionXParallel.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyDirectionXParallelWithMouse);
                directionXParallelHotSpot          = new GeoVectorHotSpot(directionXParallel);
                directionXParallelHotSpot.Position = polyline.ParallelogramLocation + polyline.ParallelogramMainDirection;

                GeoVectorProperty directionYParallel = new GeoVectorProperty("Parallelogram.DirectionY", Frame, true);
                directionYParallel.GetGeoVectorEvent    += new CADability.UserInterface.GeoVectorProperty.GetGeoVectorDelegate(OnGetDirectionYParallel);
                directionYParallel.SetGeoVectorEvent    += new CADability.UserInterface.GeoVectorProperty.SetGeoVectorDelegate(OnSetDirectionYParallel);
                directionYParallel.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyDirectionXParallelWithMouse);
                directionYParallelHotSpot          = new GeoVectorHotSpot(directionYParallel);
                directionYParallelHotSpot.Position = polyline.ParallelogramLocation + polyline.ParallelogramSecondaryDirection;

                //				parallelProperty = new GroupProperty("Polyline.Parallel", new IPropertyEntry [] {locationParallelProperty,widthParallel,heightParallel,directionParallel});

                sizeHotSpot = new GeoPointHotSpot(polyline.ParallelogramLocation + polyline.ParallelogramSecondaryDirection + polyline.ParallelogramMainDirection);
                sizeHotSpot.StartDragHotspotEvent += new GeoPointHotSpot.StartDragHotspotDelegate(OnSizeHotSpotStartDragHotspot);

                parallelProperty = new GroupProperty("Polyline.Parallel", new IPropertyEntry[] { locationParallelProperty, directionXParallel, directionYParallel });
                subEntries[0]    = parallelProperty;
                (parallelProperty as IPropertyEntry).PropertyEntryChangedStateEvent += OnParallelPropertyStateChanged;

                subEntries[1] = vertexProperty;
            }


            else
            {
                subEntries    = new IPropertyEntry[1];
                subEntries[0] = vertexProperty;
            }
            attributeProperties = polyline.GetAttributeProperties(Frame);
        }
 private void OnSetDiameter(LengthProperty sender, double l)
 {
     circle.Radius = l / 2.0;
 }
 private void OnSetRadius(LengthProperty sender, double l)
 {
     circle.Radius = l;
 }
 private double OnGetArcLength(LengthProperty sender)
 {
     return(circle.Length);
 }
 private double OnGetDiameter(LengthProperty sender)
 {
     return(circle.Radius * 2.0);
 }
Exemple #16
0
 /// <summary>
 /// Constructs a hotspot to manipulate a length property
 /// </summary>
 /// <param name="lengthProperty">the property to be manipulated</param>
 public LengthHotSpot(LengthProperty lengthProperty)
 {
     this.lengthProperty = lengthProperty;
 }
        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);
        }
Exemple #18
0
 private double OnGetWidthParallel(LengthProperty sender)
 {
     return(polyline.ParallelogramWidth);
 }
 private double OnGetMinorRadius(LengthProperty sender)
 {
     return(ellipse.MinorRadius);
 }
        public ShowPropertyCircle(Ellipse circle, IFrame frame) : base(frame)
        {
            this.circle    = circle;
            centerProperty = new GeoPointProperty("Circle.Center", Frame, true);
            centerProperty.GetGeoPointEvent               += new CADability.UserInterface.GeoPointProperty.GetGeoPointDelegate(OnGetCenter);
            centerProperty.SetGeoPointEvent               += new CADability.UserInterface.GeoPointProperty.SetGeoPointDelegate(OnSetCenter);
            centerProperty.ModifyWithMouseEvent           += new ModifyWithMouseDelegate(ModifyCenterWithMouse);
            centerProperty.PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnStateChanged);

            radiusProperty = new LengthProperty("Circle.Radius", Frame, true);
            radiusProperty.GetLengthEvent                 += new CADability.UserInterface.LengthProperty.GetLengthDelegate(OnGetRadius);
            radiusProperty.SetLengthEvent                 += new CADability.UserInterface.LengthProperty.SetLengthDelegate(OnSetRadius);
            radiusProperty.ModifyWithMouseEvent           += new ModifyWithMouseDelegate(ModifyRadiusWithMouse);
            radiusProperty.PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnStateChanged);
            radiusHotSpots = new LengthHotSpot[4];
            for (int i = 0; i < 4; ++i)
            {
                radiusHotSpots[i] = new LengthHotSpot(radiusProperty);
                switch (i)
                {
                case 0:
                    radiusHotSpots[i].Position = circle.Center + circle.MajorAxis;
                    break;

                case 1:
                    radiusHotSpots[i].Position = circle.Center - circle.MajorAxis;
                    break;

                case 2:
                    radiusHotSpots[i].Position = circle.Center + circle.MinorAxis;
                    break;

                case 3:
                    radiusHotSpots[i].Position = circle.Center - circle.MinorAxis;
                    break;
                }
            }

            diameterProperty = new LengthProperty("Circle.Diameter", Frame, true);
            diameterProperty.GetLengthEvent                 += new CADability.UserInterface.LengthProperty.GetLengthDelegate(OnGetDiameter);
            diameterProperty.SetLengthEvent                 += new CADability.UserInterface.LengthProperty.SetLengthDelegate(OnSetDiameter);
            diameterProperty.ModifyWithMouseEvent           += new ModifyWithMouseDelegate(ModifyRadiusWithMouse);
            diameterProperty.PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnStateChanged);

            if (circle.IsArc)
            {
                startAngleProperty = new AngleProperty("Arc.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 = circle.StartPoint;

                endAngleProperty = new AngleProperty("Arc.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 = circle.EndPoint;
                base.resourceId          = "CircleArc.Object";

                directionProperty = new BooleanProperty("Arc.Direction", "Arc.Direction.Values");
                directionProperty.BooleanValue     = circle.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("Arc.StartPoint", Frame, false);
                startPointProperty.GetGeoPointEvent += new CADability.UserInterface.GeoPointProperty.GetGeoPointDelegate(OnGetStartPoint);
                startPointProperty.ReadOnly          = true;
                startPointProperty.PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnStateChanged);
                endPointProperty = new GeoPointProperty("Arc.EndPoint", Frame, false);
                endPointProperty.GetGeoPointEvent += new CADability.UserInterface.GeoPointProperty.GetGeoPointDelegate(OnGetEndPoint);
                endPointProperty.ReadOnly          = true;
                endPointProperty.PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnStateChanged);
            }
            else
            {
                if (Settings.GlobalSettings.GetBoolValue("CircleShowStartPointProperty", false))
                {
                    startAngleProperty = new AngleProperty("Arc.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 = circle.StartPoint;

                    directionProperty = new BooleanProperty("Arc.Direction", "Arc.Direction.Values");
                    directionProperty.BooleanValue     = circle.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("Arc.StartPoint", Frame, false);
                    startPointProperty.GetGeoPointEvent += new CADability.UserInterface.GeoPointProperty.GetGeoPointDelegate(OnGetStartPoint);
                    startPointProperty.ReadOnly          = true;
                    startPointProperty.PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnStateChanged);
                }
                base.resourceId = "Circle.Object";
            }
            arcLengthProperty = new LengthProperty("Circle.ArcLength", Frame, true);
            arcLengthProperty.GetLengthEvent += new CADability.UserInterface.LengthProperty.GetLengthDelegate(OnGetArcLength);
            arcLengthProperty.ReadOnly        = true;
            attributeProperties = circle.GetAttributeProperties(Frame);
        }