X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Frs_information.cpp;h=e9ec4d8d51d4fd77af30912c1adf0a6876bc34b2;hb=27d4a138d23453e93a833e9347444b828a971cb4;hp=bcb6082136b3d1eb5d9c60183cf4cd80ee738330;hpb=16ce54abf01ca3032e42a5bb11a4afcf9014dcca;p=architektonas diff --git a/src/base/rs_information.cpp b/src/base/rs_information.cpp index bcb6082..e9ec4d8 100644 --- a/src/base/rs_information.cpp +++ b/src/base/rs_information.cpp @@ -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 +// +// 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); } - +