]> Shamusworld >> Repos - architektonas/blobdiff - src/base/rs_information.cpp
Changed RS_Graphic to Drawing; this is less confusing as a drawing is
[architektonas] / src / base / rs_information.cpp
index bcb6082136b3d1eb5d9c60183cf4cd80ee738330..e9ec4d8d51d4fd77af30912c1adf0a6876bc34b2 100644 (file)
@@ -1,52 +1,39 @@
-/****************************************************************************
-** $Id: rs_information.cpp 2378 2005-05-16 17:05:15Z andrew $
-**
-** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
-**
-** This file is part of the qcadlib Library project.
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** Licensees holding valid qcadlib Professional Edition licenses may use 
-** this file in accordance with the qcadlib Commercial License
-** Agreement provided with the Software.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-** See http://www.ribbonsoft.com for further details.
-**
-** Contact info@ribbonsoft.com if any conditions of this licensing are
-** not clear to you.
-**
-**********************************************************************/
+// rs_information.cpp
+//
+// Part of the Architektonas Project
+// Originally part of QCad Community Edition by Andrew Mustun
+// Extensively rewritten and refactored by James L. Hammons
+// (C) 2010 Underground Software
+//
+// JLH = James L. Hammons <jlhamm@acm.org>
+//
+// Who  When        What
+// ---  ----------  -----------------------------------------------------------
+// JLH  06/01/2010  Added this text. :-)
+//
 
 #include "rs_information.h"
 
 #include "rs_constructionline.h"
 
-
 /**
  * Default constructor.
  *
  * @param container The container to which we will add
- *        entities. Usually that's an RS_Graphic entity but
+ *        entities. Usually that's an Drawing entity but
  *        it can also be a polyline, text, ...
  */
-RS_Information::RS_Information(RS_EntityContainer& container) {
-    this->container = &container;
+RS_Information::RS_Information(RS_EntityContainer& container)
+{
+       this->container = &container;
 }
 
-
-
 /**
  * @return true: if the entity is a dimensioning enity.
  *         false: otherwise
  */
-bool RS_Information::isDimension(RS2::EntityType type) {
+bool RS_Information::isDimension(RS2::EntityType type)
+{
     if (type==RS2::EntityDimAligned ||
             type==RS2::EntityDimLinear ||
             type==RS2::EntityDimRadial ||
@@ -137,7 +124,7 @@ bool RS_Information::isTrimmable(RS_Entity* e1, RS_Entity* e2) {
  * @param coord Coordinate (typically a mouse coordinate)
  *
  * @return the coordinate found or an invalid vector
- * if there are no elements at all in this graphics 
+ * if there are no elements at all in this graphics
  * container.
  */
 Vector RS_Information::getNearestEndpoint(const Vector& coord,
@@ -147,16 +134,16 @@ Vector RS_Information::getNearestEndpoint(const Vector& coord,
 
 
 /**
- * Gets the nearest point to the given coordinate which is on an entity. 
+ * Gets the nearest point to the given coordinate which is on an entity.
  *
  * @param coord Coordinate (typically a mouse coordinate)
- * @param dist Pointer to a double which will contain the 
+ * @param dist Pointer to a double which will contain the
  *        measured distance after return or NULL
  * @param entity Pointer to a pointer which will point to the
  *        entity on which the point is or NULL
  *
  * @return the coordinate found or an invalid vector
- * if there are no elements at all in this graphics 
+ * if there are no elements at all in this graphics
  * container.
  */
 Vector RS_Information::getNearestPointOnEntity(const Vector& coord,
@@ -172,11 +159,11 @@ Vector RS_Information::getNearestPointOnEntity(const Vector& coord,
  * Gets the nearest entity to the given coordinate.
  *
  * @param coord Coordinate (typically a mouse coordinate)
- * @param dist Pointer to a double which will contain the 
+ * @param dist Pointer to a double which will contain the
  *             masured distance after return
  * @param level Level of resolving entities.
  *
- * @return the entity found or NULL if there are no elements 
+ * @return the entity found or NULL if there are no elements
  * at all in this graphics container.
  */
 RS_Entity* RS_Information::getNearestEntity(const Vector& coord,
@@ -229,8 +216,8 @@ VectorSolutions RS_Information::getIntersection(RS_Entity* e1,
             RS_Ellipse* ellipse = (RS_Ellipse*)e1;
             ret = getIntersectionLineEllipse((RS_Line*)e2, ellipse);
                        tol = 1.0e-1;
-        } 
-               
+        }
+
                // ellipse / arc, ellipse / ellipse: not supported:
                else {
             return ret;
@@ -606,7 +593,7 @@ VectorSolutions RS_Information::getIntersectionLineEllipse(RS_Line* line,
             RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: intersection 1");
             Vector ret1(false);
             Vector ret2(false);
-            //if ( 0 <= t_a && t_a <= 1 ) { 
+            //if ( 0 <= t_a && t_a <= 1 ) {
                 //RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: 0<=t_a<=1");
                 ret1 = a1.lerp(a2, t_a);
                 RS_DEBUG->print("RS_Information::getIntersectionLineEllipse: ret1: %f/%f", ret1.x, ret1.y);
@@ -830,4 +817,4 @@ bool RS_Information::isPointInsideContour(const Vector& point,
 
     return ((counter%2)==1);
 }
-       
+