Beispiel #1
0
 void SetSizeGeoPoint(GeneralGeoPointAction sender, GeoPoint NewValue)
 {
     if (polyline.IsRectangle)
     {
         double w = Geometry.DistPL(NewValue, polyline.RectangleLocation, polyline.ParallelogramSecondaryDirection);
         double h = Geometry.DistPL(NewValue, polyline.RectangleLocation, polyline.ParallelogramMainDirection);
         if (Math.Abs(w) > Precision.eps && Math.Abs(h) > Precision.eps)
         {
             polyline.RectangleWidth  = w;
             polyline.RectangleHeight = h;
         }
     }
     else if (polyline.IsParallelogram)
     {
         Plane       pln = polyline.GetPlane();
         GeoPoint2D  fix = pln.Project(polyline.ParallelogramLocation);
         GeoVector2D dirx = pln.Project(polyline.ParallelogramMainDirection);
         GeoVector2D diry = pln.Project(polyline.ParallelogramSecondaryDirection);
         GeoPoint2D  np = pln.Project(NewValue);
         GeoPoint2D  xp, yp;
         if (Geometry.IntersectLL(fix, dirx, np, diry, out xp) && Geometry.IntersectLL(fix, diry, np, dirx, out yp))
         {
             polyline.ParallelogramWidth  = fix | xp;
             polyline.ParallelogramHeight = fix | yp;
         }
     }
 }
Beispiel #2
0
 private void OnActionSetGeoPoint(GeneralGeoPointAction sender, GeoPoint NewValue)
 {
     if (PositionChangedEvent != null)
     {
         PositionChangedEvent(NewValue);
     }
 }
Beispiel #3
0
        void OnSizeHotSpotStartDragHotspot(GeoPointHotSpot sender)
        {
            GeneralGeoPointAction gpa = new GeneralGeoPointAction(polyline.ParallelogramLocation + polyline.ParallelogramSecondaryDirection + polyline.ParallelogramMainDirection, polyline);

            gpa.SetGeoPointEvent += new GeneralGeoPointAction.SetGeoPointDelegate(SetSizeGeoPoint);
            Frame.SetAction(gpa);
        }
        private void ModifyMinorAxisWithMouse(IPropertyEntry sender, bool StartModifying)
        {
            GeneralGeoPointAction gpa = new GeneralGeoPointAction(ellipse.Center, ellipse);

            gpa.SetGeoPointEvent += new CADability.Actions.GeneralGeoPointAction.SetGeoPointDelegate(OnSetMinorAxis);
            Frame.SetAction(gpa);
        }
Beispiel #5
0
 private void OnSetPointDone(GeneralGeoPointAction sender)
 {
     dimension.SortPoints();
     subProperties = null;
     propertyPage.Refresh(this);
     propertyPage.OpenSubEntries(points, true);
 }
Beispiel #6
0
        private void ModifyDimLineRef(IPropertyEntry sender, bool StartModifying)
        {
            GeneralGeoPointAction gpa = new GeneralGeoPointAction(dimension.DimLineRef, dimension);

            gpa.GeoPointProperty = sender as GeoPointProperty;
            Frame.SetAction(gpa);
        }
Beispiel #7
0
        private void ModifyEndAngleWithMouse(IPropertyEntry sender, bool StartModifying)
        {
            GeneralGeoPointAction gpa = new GeneralGeoPointAction(dimension.GetPoint(2), dimension);

            gpa.GeoPointProperty  = sender as GeoPointProperty;
            gpa.SetGeoPointEvent += new CADability.Actions.GeneralGeoPointAction.SetGeoPointDelegate(OnSetEndAnglePoint);
            Frame.SetAction(gpa);
        }
Beispiel #8
0
 /// <summary>
 /// Implements <see cref="CADability.IHotSpot.StartDrag ()"/>
 /// </summary>
 public void StartDrag(IFrame frame)
 {
     if (PositionChangedEvent != null)
     {
         GeneralGeoPointAction gga = new GeneralGeoPointAction(position);
         gga.SetGeoPointEvent += new CADability.Actions.GeneralGeoPointAction.SetGeoPointDelegate(OnActionSetGeoPoint);
         frame.SetAction(gga);
     }
 }
        private void OnSetPole(GeneralGeoPointAction sender, GeoPoint NewValue)
        {
            if (throughPointsProperty != null && propertyPage != null)
            {
                propertyPage.OpenSubEntries(throughPointsProperty, false);
            }
            int Index = (int)sender.UserData.GetData("Index");

            bSpline.SetPole(Index, NewValue);
        }
Beispiel #10
0
        private void ModifyTextPosWithMouse(IPropertyEntry sender, bool StartModifying)
        {
            int      ind = (int)(sender as DoubleProperty).UserData.GetData("Index");
            GeoPoint p   = dimension.GetTextPosCoordinate(ind, Frame.ActiveView.Projection);
            GeneralGeoPointAction gpa = new GeneralGeoPointAction(p, dimension);

            gpa.UserData.Add("Index", ind);
            gpa.SetGeoPointEvent += new GeneralGeoPointAction.SetGeoPointDelegate(OnSetTextPos);
            Frame.SetAction(gpa);
        }
        private bool OnModifyThroughPointsWithMouse(IPropertyEntry sender, int index)
        {
            GeneralGeoPointAction gpa = new GeneralGeoPointAction(bSpline.GetThroughPoint(index), bSpline);

            gpa.UserData.Add("Mode", "ThroughPoint");
            gpa.UserData.Add("Index", index);
            gpa.GeoPointProperty  = sender as GeoPointProperty;
            gpa.SetGeoPointEvent += new CADability.Actions.GeneralGeoPointAction.SetGeoPointDelegate(OnSetThroughPoint);
            Frame.SetAction(gpa);
            return(false);
        }
Beispiel #12
0
        private bool OnModifyPointWithMouse(IPropertyEntry sender, int index)
        {
            GeneralGeoPointAction gpa = new GeneralGeoPointAction(dimension.GetPoint(index), dimension);

            gpa.UserData.Add("Mode", "Point");
            gpa.UserData.Add("Index", index);
            gpa.GeoPointProperty  = sender as GeoPointProperty;
            gpa.SetGeoPointEvent += new CADability.Actions.GeneralGeoPointAction.SetGeoPointDelegate(OnSetPoint);
            gpa.ActionDoneEvent  += new CADability.Actions.GeneralGeoPointAction.ActionDoneDelegate(OnSetPointDone);
            Frame.SetAction(gpa);
            return(false);
        }
        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);
        }
Beispiel #14
0
        private void OnPositionModifyWithMouse(IPropertyEntry sender, bool StartModifying)
        {
            GeneralGeoPointAction gpa = new GeneralGeoPointAction(positionProp, blockRef);

            frame.SetAction(gpa);
        }
        private void ModifyCenterWithMouse(IPropertyEntry sender, bool StartModifying)
        {
            GeneralGeoPointAction gpa = new GeneralGeoPointAction(centerProperty, ellipse);

            Frame.SetAction(gpa);
        }
Beispiel #16
0
        void OnModifyLocationWithMouse(IPropertyEntry sender, bool StartModifying)
        {
            GeneralGeoPointAction gpa = new GeneralGeoPointAction(location, picture);

            Frame.SetAction(gpa);
        }
Beispiel #17
0
 private void OnSetEndAnglePoint(GeneralGeoPointAction sender, GeoPoint NewValue)
 {
     dimension.SetPoint(2, NewValue);
 }
Beispiel #18
0
        private void ModifyEndPointWithMouse(IPropertyEntry sender, bool StartModifying)
        {
            GeneralGeoPointAction gpa = new GeneralGeoPointAction(endPointProperty, line);

            Frame.SetAction(gpa);
        }
Beispiel #19
0
 private void OnSetRadiusPoint(GeneralGeoPointAction sender, GeoPoint NewValue)
 {
     dimension.Radius = Geometry.Dist(dimension.GetPoint(0), NewValue);
 }
Beispiel #20
0
        private void OnSetTextPos(GeneralGeoPointAction sender, GeoPoint p)
        {
            int ind = (int)sender.UserData.GetData("Index");

            dimension.SetTextPosCoordinate(ind, Frame.ActiveView.Projection, p);
        }
        private void OnSetThroughPoint(GeneralGeoPointAction sender, GeoPoint NewValue)
        {
            int Index = (int)sender.UserData.GetData("Index");

            bSpline.SetThroughPoint(Index, NewValue);
        }
Beispiel #22
0
        private void OnSetPoint(GeneralGeoPointAction sender, GeoPoint NewValue)
        {
            int Index = (int)sender.UserData.GetData("Index");

            dimension.SetPoint(Index, NewValue);
        }
Beispiel #23
0
        bool ICommandHandler.OnCommand(string MenuId)
        {
            if (FilterCommandEvent != null)
            {
                bool handled = false;
                FilterCommandEvent(this, MenuId, null, ref handled);
                if (handled)
                {
                    return(true);
                }
            }
            // maybe this property is a subproperty (e.g. Multipoint) then use the parent commandhandler first
            ICommandHandler ch = propertyPage.GetParent(this) as ICommandHandler;

            if (ch != null)
            {
                if (ch.OnCommand(MenuId))
                {
                    return(true);
                }
            }
            switch (MenuId)
            {
            case "MenuId.Point.ModifyWithMouse":
                if (ModifyWithMouse != null)
                {
                    ModifyWithMouse(this, false);
                }
                else if (autoModifyWithMouse)
                {
                    generalGeoPointAction = new GeneralGeoPointAction(this);
                    Frame.SetAction(generalGeoPointAction);
                }
                return(true);

            case "MenuId.Point.IntermediatePoint":
                Frame.SetAction(new ConstructMidPoint(this));
                return(true);

            case "MenuId.Point.ObjectPoint":
                Frame.SetAction(new ConstructObjectPoint(this));
                return(true);

            case "MenuId.Point.IntersectionTwoCurves":
                Frame.SetAction(new ConstructIntersectPoint(this));
                return(true);

            case "MenuId.Point.OffsetByVector":
                Frame.SetAction(new ConstructVectorPoint(this));
                return(true);

            case "MenuId.Point.Polar":
                Frame.SetAction(new ConstructPolarPoint(this));
                return(true);

            case "MenuId.Point.NameVariable":
                Frame.Project.SetNamedValue(null, GetGeoPoint());
                return(true);

            case "MenuId.Point.FormatSettings":
            {
                Frame.ShowPropertyDisplay("Global");
                IPropertyPage  pd = Frame.GetPropertyDisplay("Global");
                IPropertyEntry sp = pd.FindFromHelpLink("Setting.Formatting");
                if (sp != null)
                {
                    pd.OpenSubEntries(sp, true);
                    sp = pd.FindFromHelpLink("Setting.Formatting.Coordinate");
                    if (sp != null)
                    {
                        pd.OpenSubEntries(sp, true);
                        pd.SelectEntry(sp);
                    }
                }
            }
                return(true);

            default:
                return(false);
            }
        }
Beispiel #24
0
 private void OnSetCenterPoint(GeneralGeoPointAction sender, GeoPoint NewValue)
 {
     dimension.SetPoint(0, NewValue);
 }
Beispiel #25
0
        private void ModifyVertexWithMouse(IPropertyEntry sender, bool StartModifying)
        {
            GeneralGeoPointAction gpa = new GeneralGeoPointAction(sender as GeoPointProperty, path);

            Frame.SetAction(gpa);
        }
Beispiel #26
0
        private void ModifyLocationWithMouse(IPropertyEntry sender, bool StartModifying)
        {
            GeneralGeoPointAction gpa = new GeneralGeoPointAction(locationProperty, point);

            Frame.SetAction(gpa);
        }