예제 #1
0
        private bool Recalc()
        {
            double     mindist = double.MaxValue;
            ICurve2D   c1_2D;
            ICurve2D   c2_2D;
            GeoPoint   objectPoint  = new GeoPoint(objectPoint1, objectPoint2); // die Mitte der Pickpunkte der zwei Objekte
            GeoPoint2D startPoint2D = new GeoPoint2D(0.0, 0.0);
            Plane      pl;

            if (Curves.GetCommonPlane(intersectCurve1, intersectCurve2, out pl)) // die Kurven liegen in einer Ebene
            {
                c1_2D = intersectCurve1.GetProjectedCurve(pl);
                if (c1_2D is Path2D)
                {
                    (c1_2D as Path2D).Flatten();
                }
                c2_2D = intersectCurve2.GetProjectedCurve(pl);
                if (c2_2D is Path2D)
                {
                    (c2_2D as Path2D).Flatten();
                }
                GeoPoint2DWithParameter[] intersectPoints = c1_2D.Intersect(c2_2D); // die Schnittpunkte
                if (intersectPoints.Length > 0)
                {                                                                   // nun den nächsten auswählen
                    for (int j = 0; j < intersectPoints.Length; ++j)
                    {
                        double dist = Geometry.Dist(intersectPoints[j].p, pl.Project(objectPoint));
                        if (dist < mindist)
                        {
                            mindist      = dist;
                            startPoint2D = intersectPoints[j].p;
                        }
                    }
                }
                if (mindist < double.MaxValue)
                {
                    actualPoint = pl.ToGlobal(startPoint2D);
                    using (Frame.Project.Undo.ContextFrame(this))
                    {
                        if (geoPointProperty != null)
                        {
                            geoPointProperty.SetGeoPoint(actualPoint);
                        }
                    }
                    gPoint.Location = actualPoint;
                    return(true);
                }
            }
            using (Frame.Project.Undo.ContextFrame(this))
            {
                if (geoPointProperty != null)
                {
                    geoPointProperty.SetGeoPoint(cancelPoint);
                }
            }
            actualPoint = cancelPoint;
            return(false);
        }
예제 #2
0
 private void Recalc()
 {
     if (firstPointIsValid && secondPointIsValid)
     {
         feedBackLine.SetTwoPoints(firstPoint, secondPoint);
         actualPoint = firstPoint + ratio * (secondPoint - firstPoint);
         using (Frame.Project.Undo.ContextFrame(this))
         {
             if (geoPointProperty != null)
             {
                 geoPointProperty.SetGeoPoint(actualPoint);
             }
         }
         gPoint.Location = actualPoint;
     }
 }
예제 #3
0
 private void SetStartPoint(GeoPoint p)
 {
     startPoint = p;
     showFeedBackLine();
     if (ang.Fixed & len.Fixed)
     {
         //				actualPoint = startPoint + lengthPolar*new GeoVector(angPolar,0.0);
         actualPoint = base.ActiveDrawingPlane.ToGlobal(base.ActiveDrawingPlane.Project(startPoint) + lengthPolar * new GeoVector2D(angPolar));
         using (Frame.Project.Undo.ContextFrame(this))
         {
             if (geoPointProperty != null)
             {
                 geoPointProperty.SetGeoPoint(actualPoint);
             }
         }
     }
 }
예제 #4
0
 private bool Vec_OnSetGeoVector(GeoVector vector)
 {
     if (!vector.IsNullVector())
     {
         actualPoint = currentPoint + vector;
         using (Frame.Project.Undo.ContextFrame(this))
         {
             if (geoPointProperty != null)
             {
                 geoPointProperty.SetGeoPoint(actualPoint);
             }
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
예제 #5
0
        private void Recalc()
        {
            if (ratioAsLength)
            {
                ratio = ratioDist / ratioCurveSel.Length;
            }
            else
            {
                ratioDist = Geometry.Dist(ratioCurveSel.StartPoint, ratioCurveSel.PointAt(ratio));
            }

            using (Frame.Project.Undo.ContextFrame(this))
            {
                if (geoPointProperty != null)
                {
                    if (Geometry.Dist(objectPoint1, ratioCurveSel.StartPoint) < Geometry.Dist(objectPoint1, ratioCurveSel.EndPoint))
                    {
                        geoPointProperty.SetGeoPoint(ratioCurveSel.PointAt(ratio));
                    }
                    else
                    {
                        geoPointProperty.SetGeoPoint(ratioCurveSel.PointAt(1.0 - ratio));
                    }
                    gPoint.Location = geoPointProperty.GetGeoPoint();
                }
                else
                {
                    if (Geometry.Dist(objectPoint1, ratioCurveSel.StartPoint) < Geometry.Dist(objectPoint1, ratioCurveSel.EndPoint))
                    {
                        actualPoint = ratioCurveSel.PointAt(ratio);
                    }
                    else
                    {
                        actualPoint = ratioCurveSel.PointAt(1.0 - ratio);
                    }
                    gPoint.Location = actualPoint;
                }
            }
        }
예제 #6
0
 private void SetGeoPoint(GeoPoint p)
 {
     if (SetGeoPointEvent != null)
     {
         SetGeoPointEvent(this, p);
     }
     else if (GeoPointProperty != null)
     {
         GeoPointProperty.SetGeoPoint(p);
     }
     else
     {
         throw new GeneralGeoPointActionException("Event OnSetGeoPoint not set");
     }
     if (GeoPointProperty != null)
     {
         GeoPointProperty.GeoPointChanged();
     }
 }