+ fix typos, strip trailing spaces, homogenize coding style

+ remove redundant header


git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5063 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
logari81 2011-10-25 17:07:23 +00:00
parent bdcb36c0f8
commit 61de5e037e
4 changed files with 118 additions and 128 deletions

View File

@ -175,7 +175,7 @@ protected:
void resetError(void){StatusBits.reset(1);}
void setDocument(App::Document* doc);
/// get called befor the value is changed
/// get called before the value is changed
virtual void onBeforeChange(const Property* prop);
/// get called by the container when a property was changed
virtual void onChanged(const Property* prop);

View File

@ -32,7 +32,6 @@
#include <Base/Exception.h>
#include <Base/Reader.h>
#include <Base/Writer.h>
#include <Base/Console.h>
#include "Geometry.h"
#include "GeometryPy.h"

View File

@ -566,16 +566,16 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
PointPos secondPos1 = Sketcher::none, secondPos2 = Sketcher::none;
ConstraintType constrType1 = Sketcher::PointOnObject, constrType2 = Sketcher::PointOnObject;
for (std::vector<Constraint *>::const_iterator it=constraints.begin(); it != constraints.end(); ++it)
{
Constraint *constr = *(it);
if(secondPos1 == Sketcher::none && (constr->First == GeoId1 && constr->Second == GeoId)) {
constrType1= Sketcher::Coincident;
secondPos1 = constr->FirstPos;
} else if(secondPos2 == Sketcher::none && (constr->First == GeoId2 && constr->Second == GeoId)) {
constrType2 = Sketcher::Coincident;
secondPos2 = constr->FirstPos;
}
for (std::vector<Constraint *>::const_iterator it=constraints.begin();
it != constraints.end(); ++it) {
Constraint *constr = *(it);
if (secondPos1 == Sketcher::none && (constr->First == GeoId1 && constr->Second == GeoId)) {
constrType1= Sketcher::Coincident;
secondPos1 = constr->FirstPos;
} else if (secondPos2 == Sketcher::none && (constr->First == GeoId2 && constr->Second == GeoId)) {
constrType2 = Sketcher::Coincident;
secondPos2 = constr->FirstPos;
}
}
// constrain the trimming points on the corresponding geometries
@ -585,9 +585,9 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
newConstr->FirstPos = end;
newConstr->Second = GeoId1;
if(constrType1 == Sketcher::Coincident) {
newConstr->SecondPos = secondPos1;
delConstraintOnPoint(GeoId1, secondPos1, false);
if (constrType1 == Sketcher::Coincident) {
newConstr->SecondPos = secondPos1;
delConstraintOnPoint(GeoId1, secondPos1, false);
}
addConstraint(newConstr);
@ -600,7 +600,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
newConstr->FirstPos = start;
newConstr->Second = GeoId2;
if(constrType2 == Sketcher::Coincident) {
if (constrType2 == Sketcher::Coincident) {
newConstr->SecondPos = secondPos2;
delConstraintOnPoint(GeoId2, secondPos2, false);
}
@ -633,18 +633,18 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
double x1 = (point1 - startPnt)*dir;
if (x1 >= 0.001*length && x1 <= 0.999*length) {
ConstraintType constrType = Sketcher::PointOnObject;
PointPos secondPos = Sketcher::none;
for (std::vector<Constraint *>::const_iterator it=constraints.begin(); it != constraints.end(); ++it)
{
ConstraintType constrType = Sketcher::PointOnObject;
PointPos secondPos = Sketcher::none;
for (std::vector<Constraint *>::const_iterator it=constraints.begin();
it != constraints.end(); ++it) {
Constraint *constr = *(it);
if((constr->First == GeoId1 && constr->Second == GeoId)) {
if ((constr->First == GeoId1 && constr->Second == GeoId)) {
constrType = Sketcher::Coincident;
secondPos = constr->FirstPos;
delConstraintOnPoint(GeoId1, constr->FirstPos, false);
break;
}
}
}
}
if (x1 > x0) { // trim line start
delConstraintOnPoint(GeoId, start, false);
@ -657,10 +657,8 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
newConstr->FirstPos = start;
newConstr->Second = GeoId1;
if(constrType == Sketcher::Coincident)
{
newConstr->SecondPos = secondPos;
}
if (constrType == Sketcher::Coincident)
newConstr->SecondPos = secondPos;
addConstraint(newConstr);
delete newConstr;
@ -675,10 +673,8 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
newConstr->FirstPos = end;
newConstr->Second = GeoId1;
if(constrType == Sketcher::Coincident)
{
newConstr->SecondPos = secondPos;
}
if (constrType == Sketcher::Coincident)
newConstr->SecondPos = secondPos;
addConstraint(newConstr);
delete newConstr;
@ -719,19 +715,18 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
PointPos secondPos1 = Sketcher::none, secondPos2 = Sketcher::none;
ConstraintType constrType1 = Sketcher::PointOnObject, constrType2 = Sketcher::PointOnObject;
for (std::vector<Constraint *>::const_iterator it=constraints.begin(); it != constraints.end(); ++it)
{
Constraint *constr = *(it);
if(secondPos1 == Sketcher::none && (constr->First == GeoId1 && constr->Second == GeoId)) {
constrType1= Sketcher::Coincident;
secondPos1 = constr->FirstPos;
} else if(secondPos2 == Sketcher::none && (constr->First == GeoId2 && constr->Second == GeoId)) {
constrType2 = Sketcher::Coincident;
secondPos2 = constr->FirstPos;
}
for (std::vector<Constraint *>::const_iterator it=constraints.begin();
it != constraints.end(); ++it) {
Constraint *constr = *(it);
if (secondPos1 == Sketcher::none && (constr->First == GeoId1 && constr->Second == GeoId)) {
constrType1= Sketcher::Coincident;
secondPos1 = constr->FirstPos;
} else if(secondPos2 == Sketcher::none && (constr->First == GeoId2 && constr->Second == GeoId)) {
constrType2 = Sketcher::Coincident;
secondPos2 = constr->FirstPos;
}
}
// constrain the trimming points on the corresponding geometries
Sketcher::Constraint *newConstr = new Sketcher::Constraint();
newConstr->Type = constrType1;
@ -739,9 +734,9 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
newConstr->FirstPos = start;
newConstr->Second = GeoId1;
if(constrType1 == Sketcher::Coincident) {
newConstr->SecondPos = secondPos1;
delConstraintOnPoint(GeoId1, secondPos1, false);
if (constrType1 == Sketcher::Coincident) {
newConstr->SecondPos = secondPos1;
delConstraintOnPoint(GeoId1, secondPos1, false);
}
addConstraint(newConstr);
@ -754,9 +749,9 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
newConstr->FirstPos = end;
newConstr->Second = GeoId2;
if(constrType2 == Sketcher::Coincident) {
newConstr->SecondPos = secondPos2;
delConstraintOnPoint(GeoId2, secondPos2, false);
if (constrType2 == Sketcher::Coincident) {
newConstr->SecondPos = secondPos2;
delConstraintOnPoint(GeoId2, secondPos2, false);
}
addConstraint(newConstr);
@ -806,18 +801,18 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
PointPos secondPos1 = Sketcher::none, secondPos2 = Sketcher::none;
ConstraintType constrType1 = Sketcher::PointOnObject, constrType2 = Sketcher::PointOnObject;
for (std::vector<Constraint *>::const_iterator it=constraints.begin(); it != constraints.end(); ++it)
{
Constraint *constr = *(it);
if(secondPos1 == Sketcher::none &&
(constr->First == GeoId1 && constr->Second == GeoId)) {
constrType1= Sketcher::Coincident;
secondPos1 = constr->FirstPos;
} else if(secondPos2 == Sketcher::none &&
(constr->First == GeoId2 && constr->Second == GeoId)) {
constrType2 = Sketcher::Coincident;
secondPos2 = constr->FirstPos;
}
for (std::vector<Constraint *>::const_iterator it=constraints.begin();
it != constraints.end(); ++it) {
Constraint *constr = *(it);
if (secondPos1 == Sketcher::none &&
(constr->First == GeoId1 && constr->Second == GeoId)) {
constrType1= Sketcher::Coincident;
secondPos1 = constr->FirstPos;
} else if (secondPos2 == Sketcher::none &&
(constr->First == GeoId2 && constr->Second == GeoId)) {
constrType2 = Sketcher::Coincident;
secondPos2 = constr->FirstPos;
}
}
newConstr->Type = constrType1;
@ -825,7 +820,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
newConstr->FirstPos = end;
newConstr->Second = GeoId1;
if(constrType1 == Sketcher::Coincident) {
if (constrType1 == Sketcher::Coincident) {
newConstr->SecondPos = secondPos1;
delConstraintOnPoint(GeoId1, secondPos1, false);
}
@ -840,7 +835,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
newConstr->FirstPos = start;
newConstr->Second = GeoId2;
if(constrType2 == Sketcher::Coincident) {
if (constrType2 == Sketcher::Coincident) {
newConstr->SecondPos = secondPos2;
delConstraintOnPoint(GeoId2, secondPos2, false);
}
@ -872,14 +867,14 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
ConstraintType constrType = Sketcher::PointOnObject;
PointPos secondPos = Sketcher::none;
for (std::vector<Constraint *>::const_iterator it=constraints.begin(); it != constraints.end(); ++it)
{
Constraint *constr = *(it);
if((constr->First == GeoId1 && constr->Second == GeoId)) {
constrType = Sketcher::Coincident;
secondPos = constr->FirstPos;
delConstraintOnPoint(GeoId1, constr->FirstPos, false);
break;
for (std::vector<Constraint *>::const_iterator it=constraints.begin();
it != constraints.end(); ++it) {
Constraint *constr = *(it);
if ((constr->First == GeoId1 && constr->Second == GeoId)) {
constrType = Sketcher::Coincident;
secondPos = constr->FirstPos;
delConstraintOnPoint(GeoId1, constr->FirstPos, false);
break;
}
}
@ -896,10 +891,8 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
newConstr->FirstPos = start;
newConstr->Second = GeoId1;
if(constrType == Sketcher::Coincident)
{
newConstr->SecondPos = secondPos;
}
if (constrType == Sketcher::Coincident)
newConstr->SecondPos = secondPos;
addConstraint(newConstr);
delete newConstr;
@ -915,10 +908,8 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
newConstr->FirstPos = end;
newConstr->Second = GeoId1;
if(constrType == Sketcher::Coincident)
{
newConstr->SecondPos = secondPos;
}
if (constrType == Sketcher::Coincident)
newConstr->SecondPos = secondPos;
addConstraint(newConstr);
delete newConstr;
@ -1044,7 +1035,7 @@ void SketchObject::appendConflictMsg(const std::vector<int> &conflicting, std::s
ss << msg;
if (conflicting.size() > 0) {
ss << "Please remove at least one of the constraints (" << conflicting[0];
for (int i=1; i < conflicting.size(); i++)
for (unsigned int i=1; i < conflicting.size(); i++)
ss << ", " << conflicting[i];
ss << ")\n";
}