Esempio n. 1
0
        private void InitSubEntries()
        {
            ArrayList gp = new ArrayList();

            // wenn der Pfad zu viele Eckpunkte hat, gibts Probleme mit der WindowHandles
            for (int i = 0; i <= path.CurveCount; ++i) // mit Endpunkt
            {
                GeoPointProperty vertex = new GeoPointProperty("Path.Vertex", Frame, true);
                vertex.UserData.Add("Index", i);
                vertex.GetGeoPointEvent               += new CADability.UserInterface.GeoPointProperty.GetGeoPointDelegate(OnGetVertexPoint);
                vertex.SetGeoPointEvent               += new CADability.UserInterface.GeoPointProperty.SetGeoPointDelegate(OnSetVertexPoint);
                vertex.ModifyWithMouseEvent           += new ModifyWithMouseDelegate(ModifyVertexWithMouse);
                vertex.PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnVertexStateChanged);
                vertex.GeoPointChanged();
                if (path.IsClosed)
                {
                    vertex.PrependContextMenu = MenuResource.LoadMenuDefinition("MenuId.Path.Vertex", false, new VertexCommandHandler(this, i));
                }

                gp.Add(vertex);
            }
            area                 = new DoubleProperty("Path.Area", Frame);
            area.ReadOnly        = true;
            area.GetDoubleEvent += new CADability.UserInterface.DoubleProperty.GetDoubleDelegate(OnGetArea);
            area.Refresh();
            gp.Add(area);
            length                 = new DoubleProperty("Path.Length", Frame);
            length.ReadOnly        = true;
            length.GetDoubleEvent += new CADability.UserInterface.DoubleProperty.GetDoubleDelegate(OnGetLength);
            length.Refresh();
            gp.Add(length);
            subEntries          = (IPropertyEntry[])gp.ToArray(typeof(IPropertyEntry));
            attributeProperties = path.GetAttributeProperties(Frame);
        }
Esempio n. 2
0
 private void OnPointSelectionChanged(GeoPointProperty sender, bool isSelected)
 {
     if (GeoPointSelectionChangedEvent != null)
     {
         GeoPointSelectionChangedEvent(sender, isSelected);
     }
 }
Esempio n. 3
0
        virtual public bool OnCommand(string MenuId)
        {
            switch (MenuId)
            {
            case "MenuId.Reverse":
                polyline.Reverse();
                return(true);

            case "MenuId.CurveSplit":
                Frame.SetAction(new ConstrSplitCurve(polyline));
                return(true);

            case "MenuId.Explode":
                if (Frame.ActiveAction is SelectObjectsAction)
                {
                    using (Frame.Project.Undo.UndoFrame)
                    {
                        IGeoObjectOwner addTo = polyline.Owner;
                        if (addTo == null)
                        {
                            addTo = Frame.ActiveView.Model;
                        }
                        GeoObjectList toSelect = polyline.Decompose();
                        addTo.Remove(polyline);
                        for (int i = 0; i < toSelect.Count; ++i)
                        {
                            addTo.Add(toSelect[i]);
                        }
                        SelectObjectsAction soa = Frame.ActiveAction as SelectObjectsAction;
                        soa.SetSelectedObjects(toSelect);     // alle Teilobjekte markieren
                    }
                }
                return(true);

            case "MenuId.Aequidist":
                Frame.SetAction(new ConstructAequidist(polyline));
                return(true);

            case "MenuId.Path.Vertex.StartWithMe":
            {
                if (polyline.IsClosed)
                {
                    GeoPointProperty gpp = Frame.ContextMenuSource as GeoPointProperty;
                    if (gpp != null)
                    {
                        if (gpp.UserData.ContainsData("Index"))
                        {
                            int index = (int)gpp.UserData.GetData("Index");
                            polyline.CyclicalPermutation(index);
                        }
                    }
                }
            }
                return(true);
            }
            return(false);
        }
Esempio n. 4
0
        private GeoPoint OnGetVertexPoint(GeoPointProperty sender)
        {
            int index = (int)sender.UserData.GetData("Index");

            if (index < path.CurveCount)
            {
                return(path.Curve(index).StartPoint);
            }
            return(path.Curve(index - 1).EndPoint);
        }
Esempio n. 5
0
 /// <summary>
 /// Refreshes the display of the point with the given index.
 /// </summary>
 /// <param name="Index">index of point to refresh</param>
 public void Refresh(int Index)
 {
     if (subEntries != null && Index < subEntries.Length)
     {
         GeoPointProperty gpp = subEntries[Index] as GeoPointProperty;
         if (gpp != null)
         {
             gpp.Refresh();
         }
     }
 }
Esempio n. 6
0
 private void ModifyWithMouse(IPropertyEntry sender, bool StartModifying)
 {
     if (ModifyWithMouseEvent != null)
     {
         GeoPointProperty gpp = sender as GeoPointProperty;
         int index            = (int)gpp.UserData["Index"];
         if (!ModifyWithMouseEvent(sender, index))
         {       // der Anwender will es nicht
             //gpp.SetMouseButton(MouseButtonMode.MouseInactive);
         }
     }
 }
Esempio n. 7
0
 //public void EnableMouse(int Index)
 //{
 //    if (propertyPage!=null)
 //    {
 //        GeoPointProperty gpp = subEntries[Index] as GeoPointProperty;
 //        gpp.SetMouseButton(MouseButtonMode.MouseActive);
 //    }
 //}
 #region IShowPropertyImpl Overrides
 public override void Added(IPropertyPage propertyPage)
 {
     base.Added(propertyPage);
     IShowProperty[] sub = SubEntries;
     for (int i = 0; i < sub.Length; ++i)
     {
         GeoPointProperty gpp = sub[i] as GeoPointProperty;
         if (gpp != null)
         {
             gpp.Refresh();
         }
     }
 }
Esempio n. 8
0
        private IPropertyEntry[] attributeProperties; // Anzeigen für die Attribute (Ebene, Farbe u.s.w)

        public ShowPropertyPoint(Point point, IFrame frame) : base(frame)
        {
            this.point       = point;
            locationProperty = new GeoPointProperty("Point.Location", Frame, true);
            locationProperty.GetGeoPointEvent += new CADability.UserInterface.GeoPointProperty.GetGeoPointDelegate(OnGetLocation);
            locationProperty.SetGeoPointEvent += new CADability.UserInterface.GeoPointProperty.SetGeoPointDelegate(OnSetLocation);
            locationProperty.GeoPointChanged(); // Initialisierung
            locationProperty.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyLocationWithMouse);
            locationProperty.StateChangedEvent    += new StateChangedDelegate(OnStateChanged);

            attributeProperties = point.GetAttributeProperties(Frame);

            resourceId = "Point.Object";
        }
Esempio n. 9
0
 private void OnPointsSelectionChanged(GeoPointProperty sender, bool isSelected)
 {
     if (HotspotChangedEvent != null)
     {
         if (isSelected)
         {
             HotspotChangedEvent(sender, HotspotChangeMode.Selected);
         }
         else
         {
             HotspotChangedEvent(sender, HotspotChangeMode.Deselected);
         }
     }
 }
Esempio n. 10
0
 public DrawingPlaneProperty(Projection projection, IFrame frame)
 {
     this.projection                    = projection;
     this.frame                         = frame;
     subEntries                         = new IShowProperty[3];
     planeOrigin                        = new GeoPointProperty(this, "PlanePoint", "DrawingPlane.Location", frame, true);
     planeOrigin.ForceAbsolute          = true; // Immer absolut darstellen, egal was der Anwender in den Formatierungen gewählt hat
     planeOrigin.ModifiedByActionEvent += new CADability.UserInterface.GeoPointProperty.ModifiedByActionDelegate(OnOriginModifiedByAction);
     planeDirectionX                    = new GeoVectorProperty(this, "PlaneDirectionX", "DrawingPlane.DirectionX", frame, false);
     planeDirectionY                    = new GeoVectorProperty(this, "PlaneDirectionY", "DrawingPlane.DirectionY", frame, false);
     planeDirectionX.IsAngle            = false;
     planeDirectionY.IsAngle            = false;
     dirX = projection.DrawingPlane.DirectionX; // lokale Kopien, erst setzen beim Verlassen
     dirY = projection.DrawingPlane.DirectionY;
     planeDirectionX.ModifiedByActionEvent += new CADability.UserInterface.GeoVectorProperty.ModifiedByActionDelegate(OnDirectionModifiedByAction);
     subEntries[0] = planeOrigin;
     subEntries[1] = planeDirectionX;
     subEntries[2] = planeDirectionY;
     resourceId    = "DrawingPlane";
 }
Esempio n. 11
0
        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";
        }
Esempio n. 12
0
        private GeoPoint OnGetGeoPoint(GeoPointProperty sender)
        {
            int index = (int)sender.UserData["Index"];

            if (index < controlledObject.GetGeoPointCount())
            {
                return(controlledObject.GetGeoPoint(index));
            }
            else
            {   // hier sollte man ja nicht hinkommen. Allerdings gibt es Situationen,
                // bei denen der letzte Punkt entfernt wurde aber die Anzeige immer noch
                // einen Punkt mehr enthält. Deshalb liefern wir hier den letzten Punkt.
                if (controlledObject.GetGeoPointCount() > 0)
                {
                    return(controlledObject.GetGeoPoint(controlledObject.GetGeoPointCount() - 1));
                }
                else
                {   // und das ist der Notausgang, kommt dran, wenn eine Aktion aktiviert wird
                    // und noch garkein Punkt in der Liste ist
                    return(new GeoPoint());
                }
            }
        }
Esempio n. 13
0
 void OnVertexStateChanged(IPropertyEntry sender, StateChangedArgs args)
 {
     if (HotspotChangedEvent != null)
     {
         GeoPointProperty vertexProperty = null;
         if (sender is GeoPointProperty)
         {
             vertexProperty = (sender as GeoPointProperty);
         }
         if (vertexProperty == null)
         {
             return;
         }
         if (args.EventState == StateChangedArgs.State.Selected || args.EventState == StateChangedArgs.State.SubEntrySelected)
         {
             HotspotChangedEvent(vertexProperty, HotspotChangeMode.Selected);
         }
         else if (args.EventState == StateChangedArgs.State.UnSelected)
         {
             HotspotChangedEvent(vertexProperty, HotspotChangeMode.Deselected);
         }
     }
 }
Esempio n. 14
0
 private GeoPoint OnGetRefPoint(GeoPointProperty sender)
 {
     return(block.RefPoint);
 }
Esempio n. 15
0
        private void OnSetVertexPoint(GeoPointProperty sender, GeoPoint p)
        {
            int indexStartPoint = (int)sender.UserData.GetData("Index");

            GeoPoint[] vtx = path.Vertices;
            if (indexStartPoint == 0)
            {
                if (path.IsClosed)
                {
                    if (Precision.IsEqual(p, vtx[vtx.Length - 1]))
                    {
                        return;                                            // das letzte Segment wird 0
                    }
                    if (Precision.IsEqual(p, vtx[1]))
                    {
                        return;                               // das letzte Segment wird 0
                    }
                }
            }
            else
            {
                if (Precision.IsEqual(vtx[indexStartPoint - 1], p))
                {
                    return;                                                 // das Vorgänger-Segment wird 0
                }
            }
            if (indexStartPoint == vtx.Length - 1)
            {
                if (path.IsClosed)
                {
                    if (Precision.IsEqual(p, vtx[1]))
                    {
                        return;                               // das erste Segment wird 0
                    }
                }
            }
            else if (indexStartPoint < vtx.Length)
            {
                if (Precision.IsEqual(vtx[indexStartPoint + 1], p))
                {
                    return;                                                 // das Nachfolger-Segment wird 0
                }
            }
            int indexEndPoint = -1;

            if (indexStartPoint == 0 && path.IsClosed)
            {                                        // der 1. Punkt und geschlossen
                indexEndPoint = path.CurveCount - 1; // Endpunkt vom letzten Segment
            }
            else if (indexStartPoint == path.CurveCount)
            {   // der letzte Punkt
                if (path.IsClosed)
                {
                    indexEndPoint   = indexStartPoint - 1;
                    indexStartPoint = 0;
                }
                else
                {
                    indexEndPoint   = indexStartPoint - 1;
                    indexStartPoint = -1;
                }
            }
            if (indexStartPoint > 0)
            {
                indexEndPoint = indexStartPoint - 1;
            }
            bool dbg1    = path.IsClosed;
            Path dbgpath = path.Clone() as Path;

            path.SetPoint(indexStartPoint, p, Path.ModificationMode.keepArcRatio); // versuchsweise
            bool dbg2 = path.IsClosed;

            if (dbg1 != dbg2)
            {
                dbgpath.SetPoint(indexStartPoint, p, Path.ModificationMode.keepArcRatio); // versuchsweise
            }
            // path.SetPoint(indexEndPoint, indexStartPoint, p);
        }
Esempio n. 16
0
 private void OnSetRefPoint(GeoPointProperty sender, GeoPoint p)
 {
     block.RefPoint = p;
 }
Esempio n. 17
0
 private GeoPoint OnGetCenter(GeoPointProperty sender)
 {
     return(ellipse.Center);
 }
Esempio n. 18
0
 private GeoPoint OnGetCenter(GeoPointProperty sender)
 {
     return(dimension.GetPoint(0));
 }
Esempio n. 19
0
 private void OnSetCenter(GeoPointProperty sender, GeoPoint p)
 {
     ellipse.Center = p;
 }
Esempio n. 20
0
        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);
        }
Esempio n. 21
0
 private GeoPoint OnGetEndPoint(GeoPointProperty sender)
 {
     return(ellipse.EndPoint);
 }
Esempio n. 22
0
 private GeoPoint OnGetDimLineRef(GeoPointProperty sender)
 {
     return(dimension.DimLineRef);
 }
Esempio n. 23
0
        private void OnFilterSinglePointCommand(GeoPointProperty sender, string menuId, CommandState commandState, ref bool handled)
        {
            int index = (int)sender.UserData["Index"];

            if (commandState != null)
            {   // es wird nur nach der Menuedarstellung gefragt
                switch (menuId)
                {
                case "MenuId.IndexedPoint.InsertAfter":
                    if (index == controlledObject.GetGeoPointCount() - 1)
                    {
                        index = -1;
                    }
                    else
                    {
                        index += 1;
                    }
                    commandState.Enabled = controlledObject.MayInsert(index);
                    handled = true;
                    break;

                case "MenuId.IndexedPoint.InsertBefore":
                    commandState.Enabled = controlledObject.MayInsert(index);
                    handled = true;
                    break;

                case "MenuId.IndexedPoint.Delete":
                    commandState.Enabled = controlledObject.MayDelete(index);
                    handled = true;
                    break;
                }
            }
            else
            {
                try
                {
                    GeoPoint p = controlledObject.GetGeoPoint(index);
                    switch (menuId)
                    {
                    case "MenuId.IndexedPoint.InsertAfter":
                        if (index == controlledObject.GetGeoPointCount() - 1)
                        {
                            index = -1;
                        }
                        else
                        {
                            index += 1;
                        }
                        if (GetInsertionPointEvent != null)
                        {
                            p = GetInsertionPointEvent(this, index, true);
                        }
                        else if (index > 0)
                        {
                            p = new GeoPoint(controlledObject.GetGeoPoint(index - 1), controlledObject.GetGeoPoint(index));
                        }
                        controlledObject.InsertGeoPoint(index, p);
                        handled = true;
                        break;

                    case "MenuId.IndexedPoint.InsertBefore":
                        if (GetInsertionPointEvent != null)
                        {
                            p = GetInsertionPointEvent(this, index, false);
                        }
                        else if (index > 0)
                        {
                            p = new GeoPoint(controlledObject.GetGeoPoint(index - 1), controlledObject.GetGeoPoint(index));
                        }
                        controlledObject.InsertGeoPoint(index, p);
                        handled = true;
                        break;

                    case "MenuId.IndexedPoint.Delete":
                        controlledObject.RemoveGeoPoint(index);
                        handled = true;
                        break;

                    case "MenuId.Point.NameVariable":
                        if (Frame != null)
                        {
                            Frame.Project.SetNamedValue(null, p);
                            handled = true;
                        }
                        break;
                    }
                }
                catch (IndexOutOfRangeException e)
                {
                }
            }
        }
Esempio n. 24
0
 private void OnSetDimLineRef(GeoPointProperty sender, GeoPoint p)
 {
     dimension.DimLineRef = p;
 }
Esempio n. 25
0
        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);
            }
        }
Esempio n. 26
0
        private void OnSetGeoPoint(GeoPointProperty sender, GeoPoint p)
        {
            int index = (int)sender.UserData["Index"];

            controlledObject.SetGeoPoint(index, p);
        }
Esempio n. 27
0
 private void OnSetEndPoint(GeoPointProperty sender, GeoPoint p)
 {
     line.EndPoint = p;
 }
Esempio n. 28
0
 private GeoPoint OnGetStartPoint(GeoPointProperty sender)
 {
     return(ellipse.StartPoint);
 }
Esempio n. 29
0
 private void OnOriginModifiedByAction(GeoPointProperty sender)
 {
     planeOrigin.Refresh();
     frame.ActiveView.InvalidateAll();
     frame.SetControlCenterFocus("View", null, false, false);
 }
Esempio n. 30
0
 private void OnSetCenter(GeoPointProperty sender, GeoPoint p)
 {
     dimension.SetPoint(0, p);
 }