Пример #1
0
 public override void FindSnapPoint(SnapPointFinder spf)
 {
     if (spf.SnapToFaceSurface)
     {
         Plane    pln = new Plane(location, directionWidth, directionHeight);
         GeoPoint ip;
         if (pln.Intersect(spf.SourceBeam.Location, spf.SourceBeam.Direction, out ip))
         {
             GeoPoint2D ip2d    = Geometry.GetPosition(pln.Project(ip), GeoPoint2D.Origin, pln.Project(directionWidth), pln.Project(directionHeight));
             double     linepos = Geometry.LinePar(spf.SourceBeam.Location, spf.SourceBeam.Direction, ip);
             if (linepos < spf.faceDist)
             {
                 spf.faceDist = linepos;
                 spf.Check(ip, this, SnapPointFinder.DidSnapModes.DidSnapToFaceSurface);
             }
         }
     }
     if (spf.SnapToObjectCenter)
     {
         GeoPoint Center = location + 0.5 * directionWidth + 0.5 * directionHeight;
         spf.Check(Center, this, SnapPointFinder.DidSnapModes.DidSnapToObjectCenter);
     }
     if (spf.SnapToObjectSnapPoint)
     {
         spf.Check(location, this, SnapPointFinder.DidSnapModes.DidSnapToObjectSnapPoint);
         spf.Check(location + directionWidth, this, SnapPointFinder.DidSnapModes.DidSnapToObjectSnapPoint);
         spf.Check(location + directionHeight, this, SnapPointFinder.DidSnapModes.DidSnapToObjectSnapPoint);
         spf.Check(location + directionWidth + directionHeight, this, SnapPointFinder.DidSnapModes.DidSnapToObjectSnapPoint);
     }
 }
Пример #2
0
 /// <summary>
 /// Overrides <see cref="CADability.GeoObject.IGeoObjectImpl.FindSnapPoint (SnapPointFinder)"/>
 /// </summary>
 /// <param name="spf"></param>
 public override void FindSnapPoint(SnapPointFinder spf)
 {
     if (!spf.Accept(this))
     {
         return;
     }
     if (spf.SnapToObjectCenter)
     {
         GeoPoint Center = new GeoPoint(StartPoint, EndPoint);
         spf.Check(Center, this, SnapPointFinder.DidSnapModes.DidSnapToObjectCenter);
     }
     if (spf.SnapToObjectSnapPoint)
     {
         spf.Check(StartPoint, this, SnapPointFinder.DidSnapModes.DidSnapToObjectSnapPoint);
         spf.Check(EndPoint, this, SnapPointFinder.DidSnapModes.DidSnapToObjectSnapPoint);
     }
     if (spf.SnapToDropPoint && spf.BasePointValid)
     {
         GeoPoint toTest = Geometry.DropPL(spf.BasePoint, startPoint, endPoint);
         spf.Check(toTest, this, SnapPointFinder.DidSnapModes.DidSnapToDropPoint);
     }
     if (spf.SnapToObjectPoint)
     {
         double par = PositionOf(spf.SourcePoint3D, spf.Projection.ProjectionPlane);
         // TODO: hier ist eigentlich gefragt der nächste punkt auf der Linie im Sinne des Projektionsstrahls
         if (par >= 0.0 && par <= 1.0)
         {
             spf.Check(PointAt(par), this, SnapPointFinder.DidSnapModes.DidSnapToObjectPoint);
         }
     }
 }
Пример #3
0
 /// <summary>
 /// Overrides <see cref="CADability.GeoObject.IGeoObjectImpl.FindSnapPoint (SnapPointFinder)"/>
 /// </summary>
 /// <param name="spf"></param>
 public override void FindSnapPoint(SnapPointFinder spf)
 {
     lock (this)
     {
         foreach (IGeoObject go in containedObjects)
         {
             go.FindSnapPoint(spf);
         }
     }
 }
Пример #4
0
 /// <summary>
 /// Overrides <see cref="CADability.GeoObject.IGeoObjectImpl.FindSnapPoint (SnapPointFinder)"/>
 /// </summary>
 /// <param name="spf"></param>
 public override void FindSnapPoint(SnapPointFinder spf)
 {
     if (!spf.Accept(this))
     {
         return;
     }
     if (spf.SnapToObjectSnapPoint)
     {
         spf.Check(location, this, SnapPointFinder.DidSnapModes.DidSnapToObjectSnapPoint);
     }
 }
Пример #5
0
 /// <summary>
 /// Overrides <see cref="CADability.GeoObject.IGeoObjectImpl.FindSnapPoint (SnapPointFinder)"/>
 /// </summary>
 /// <param name="spf"></param>
 public override void FindSnapPoint(SnapPointFinder spf)
 {   // besser wäre es den SnapPointFinder mit einer ModOp auszustatten, die überschrieben werden kann
     Flattened.FindSnapPoint(spf);
 }