-Vector RS_EntityContainer::getNearestIntersection(const Vector& coord,
- double* dist) {
-
- double minDist = RS_MAXDOUBLE; // minimum measured distance
- double curDist; // currently measured distance
- Vector closestPoint(false); // closest found endpoint
- Vector point; // endpoint found
- VectorSolutions sol;
- RS_Entity* closestEntity;
-
- closestEntity = getNearestEntity(coord, NULL, RS2::ResolveAll);
-
- if (closestEntity!=NULL) {
- for (RS_Entity* en = firstEntity(RS2::ResolveAll);
- en != NULL;
- en = nextEntity(RS2::ResolveAll)) {
-
- if (en->isVisible() && en!=closestEntity) {
- sol = RS_Information::getIntersection(closestEntity,
- en,
- true);
-
- for (int i=0; i<4; i++) {
- point = sol.get(i);
- if (point.valid) {
- curDist = coord.distanceTo(point);
-
- if (curDist<minDist) {
- closestPoint = point;
- minDist = curDist;
- if (dist!=NULL) {
- *dist = curDist;
- }
- }
- }
- }
- }
- }
- //}
- }
-
- return closestPoint;
-}
+Vector RS_EntityContainer::getNearestIntersection(const Vector & coord,
+ double * dist)
+{
+ double minDist = RS_MAXDOUBLE; // minimum measured distance
+ double curDist; // currently measured distance
+ Vector closestPoint(false); // closest found endpoint
+ Vector point; // endpoint found
+ VectorSolutions sol;
+ RS_Entity * closestEntity;