Fix warnings introduced in new PartDesign
Mostly unused wariables and compare of signed & unsigned
This commit is contained in:
parent
81015b3f44
commit
0cfc0cd424
|
@ -391,8 +391,6 @@ App::DocumentObjectExecReturn *Body::execute(void)
|
|||
return new App::DocumentObjectExecReturn ( "Linked object is not a PartDesign feature" );
|
||||
}
|
||||
|
||||
App::DocumentObject* link = Tip.getValue();
|
||||
|
||||
// get the shape of the tip
|
||||
tipShape = static_cast<Part::Feature *>(tip)->Shape.getShape();
|
||||
|
||||
|
|
|
@ -74,10 +74,8 @@ short Loft::mustExecute() const
|
|||
App::DocumentObjectExecReturn *Loft::execute(void)
|
||||
{
|
||||
|
||||
Part::Part2DObject* sketch = 0;
|
||||
std::vector<TopoDS_Wire> wires;
|
||||
try {
|
||||
sketch = getVerifiedSketch();
|
||||
wires = getSketchWires();
|
||||
} catch (const Base::Exception& e) {
|
||||
return new App::DocumentObjectExecReturn(e.what());
|
||||
|
@ -116,7 +114,7 @@ App::DocumentObjectExecReturn *Loft::execute(void)
|
|||
return new App::DocumentObjectExecReturn("Loft: All sections need to be part features");
|
||||
|
||||
TopExp_Explorer ex;
|
||||
int i=0;
|
||||
size_t i=0;
|
||||
for (ex.Init(static_cast<Part::Feature*>(obj)->Shape.getValue(), TopAbs_WIRE); ex.More(); ex.Next(), ++i) {
|
||||
if(i>=wiresections.size())
|
||||
return new App::DocumentObjectExecReturn("Loft: Sections need to have the same amount of inner wires as the base section");
|
||||
|
|
|
@ -212,8 +212,6 @@ App::DocumentObjectExecReturn *Pad::execute(void)
|
|||
|
||||
// set the additive shape property for later usage in e.g. pattern
|
||||
prism = refineShapeIfActive(prism);
|
||||
const char* name = AddSubShape.getName();
|
||||
const char* name1 = this->getPropertyName(&AddSubShape);
|
||||
this->AddSubShape.setValue(prism);
|
||||
|
||||
if (!base.IsNull()) {
|
||||
|
|
|
@ -112,10 +112,8 @@ short Pipe::mustExecute() const
|
|||
App::DocumentObjectExecReturn *Pipe::execute(void)
|
||||
{
|
||||
|
||||
Part::Part2DObject* sketch = 0;
|
||||
std::vector<TopoDS_Wire> wires;
|
||||
try {
|
||||
sketch = getVerifiedSketch();
|
||||
wires = getSketchWires();
|
||||
} catch (const Base::Exception& e) {
|
||||
return new App::DocumentObjectExecReturn(e.what());
|
||||
|
@ -182,7 +180,7 @@ App::DocumentObjectExecReturn *Pipe::execute(void)
|
|||
return new App::DocumentObjectExecReturn("All sections need to be part features");
|
||||
|
||||
TopExp_Explorer ex;
|
||||
int i=0;
|
||||
size_t i=0;
|
||||
for (ex.Init(static_cast<Part::Feature*>(obj)->Shape.getValue(), TopAbs_WIRE); ex.More(); ex.Next()) {
|
||||
wiresections[i].push_back(TopoDS::Wire(ex.Current()));
|
||||
if(i>=wiresections.size())
|
||||
|
|
|
@ -83,7 +83,7 @@ void ShapeBinder::getFilterdReferences(App::PropertyLinkSubList* prop, Part::Fea
|
|||
}
|
||||
|
||||
//we only allow one part feature, so get the first one we find
|
||||
int index = 0;
|
||||
size_t index = 0;
|
||||
while(!objs[index]->isDerivedFrom(Part::Feature::getClassTypeId()) && index < objs.size())
|
||||
index++;
|
||||
|
||||
|
|
|
@ -101,10 +101,7 @@ void UnifiedDatumCommand(Gui::Command &cmd, Base::Type type, std::string name)
|
|||
cmd.doCommand(Gui::Command::Gui,"Gui.activeDocument().setEdit('%s')",support.getValue()->getNameInDocument());
|
||||
} else if (pcActiveBody) {
|
||||
|
||||
auto pcActivePart = PartDesignGui::getPartFor(pcActiveBody, false);
|
||||
|
||||
// TODO Check how this will work outside of a body (2015-10-20, Fat-Zer)
|
||||
// TODO rewrite this to be shared with CmdPartDesignNewSketch::activated() (2015-10-20, Fat-Zer)
|
||||
std::string FeatName = cmd.getUniqueObjectName(name.c_str());
|
||||
|
||||
std::string tmp = std::string("Create ")+name;
|
||||
|
@ -281,10 +278,8 @@ void CmdPartDesignShapeBinder::activated(int iMsg)
|
|||
|
||||
//test if current selection fits a mode.
|
||||
if (support.getSize() > 0) {
|
||||
AttachableObject* pcDatum = static_cast<AttachableObject*>(
|
||||
getDocument()->getObject(FeatName.c_str()));
|
||||
doCommand(Gui::Command::Doc,"App.activeDocument().%s.Support = %s",
|
||||
FeatName.c_str(),support.getPyReprString().c_str());
|
||||
FeatName.c_str(), support.getPyReprString().c_str());
|
||||
}
|
||||
doCommand(Gui::Command::Doc,"App.activeDocument().%s.addFeature(App.activeDocument().%s)",
|
||||
pcActiveBody->getNameInDocument(), FeatName.c_str());
|
||||
|
@ -532,7 +527,6 @@ void CmdPartDesignNewSketch::activated(int iMsg)
|
|||
};
|
||||
|
||||
// If there is more than one possibility, show dialog and let user pick plane
|
||||
bool reversed = false;
|
||||
if (validPlanes > 1) {
|
||||
|
||||
Gui::TaskView::TaskDialog *dlg = Gui::Control().activeDialog();
|
||||
|
@ -1813,11 +1807,9 @@ void CmdPartDesignBoolean::activated(int iMsg)
|
|||
if (!pcActiveBody) return;
|
||||
|
||||
Gui::SelectionFilter BodyFilter("SELECT PartDesign::Body COUNT 1..");
|
||||
PartDesign::Body* body = nullptr;
|
||||
std::string bodyString("");
|
||||
|
||||
if (BodyFilter.match()) {
|
||||
body = static_cast<PartDesign::Body*>(BodyFilter.Result[0][0].getObject());
|
||||
std::vector<App::DocumentObject*> bodies;
|
||||
std::vector<std::vector<Gui::SelectionObject> >::iterator i = BodyFilter.Result.begin();
|
||||
for (; i != BodyFilter.Result.end(); i++) {
|
||||
|
|
|
@ -236,7 +236,7 @@ void TaskBooleanParameters::onBodyDeleted(void)
|
|||
PartDesign::Boolean* pcBoolean = static_cast<PartDesign::Boolean*>(BooleanView->getObject());
|
||||
std::vector<App::DocumentObject*> bodies = pcBoolean->Bodies.getValues();
|
||||
int index = ui->listWidgetBodies->currentRow();
|
||||
if (index > bodies.size())
|
||||
if (index < 0 && (size_t) index > bodies.size())
|
||||
return;
|
||||
App::DocumentObject* body = bodies[index];
|
||||
bodies.erase(bodies.begin() + ui->listWidgetBodies->currentRow());
|
||||
|
|
|
@ -96,7 +96,7 @@ void TaskDatumParameters::makeRefStrings(std::vector<QString>& refstrings, std::
|
|||
std::vector<App::DocumentObject*> refs = pcDatum->Support.getValues();
|
||||
refnames = pcDatum->Support.getSubValues();
|
||||
|
||||
for (int r = 0; r < 4; r++) {
|
||||
for (size_t r = 0; r < 4; r++) {
|
||||
if ((r < refs.size()) && (refs[r] != NULL)) {
|
||||
refstrings.push_back(makeRefString(refs[r], refnames[r]));
|
||||
} else {
|
||||
|
@ -312,7 +312,8 @@ void TaskDatumParameters::updateUI(std::string message, bool error)
|
|||
// Get hints for further required references
|
||||
eSuggestResult msg;
|
||||
std::set<eRefType> hint;
|
||||
eMapMode suggMode = pcDatum->attacher().listMapModes(msg,0,&hint);
|
||||
|
||||
pcDatum->attacher().listMapModes(msg,0,&hint);
|
||||
|
||||
if (msg != srOK) {
|
||||
if(hint.size() > 0)
|
||||
|
@ -374,18 +375,15 @@ void TaskDatumParameters::updateUI(std::string message, bool error)
|
|||
}
|
||||
}
|
||||
|
||||
QLineEdit* TaskDatumParameters::getLine(const int idx)
|
||||
QLineEdit* TaskDatumParameters::getLine(unsigned idx)
|
||||
{
|
||||
if (idx == 0)
|
||||
return ui->lineRef1;
|
||||
else if (idx == 1)
|
||||
return ui->lineRef2;
|
||||
else if (idx == 2)
|
||||
return ui->lineRef3;
|
||||
else if (idx == 3)
|
||||
return ui->lineRef4;
|
||||
else
|
||||
return NULL;
|
||||
switch(idx) {
|
||||
case 0: return ui->lineRef1;
|
||||
case 1: return ui->lineRef2;
|
||||
case 2: return ui->lineRef3;
|
||||
case 3: return ui->lineRef4;
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void TaskDatumParameters::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
|
@ -408,11 +406,11 @@ void TaskDatumParameters::onSelectionChanged(const Gui::SelectionChanges& msg)
|
|||
subname = "";
|
||||
|
||||
// eliminate duplicate selections
|
||||
for (int r = 0; r < refs.size(); r++)
|
||||
for (size_t r = 0; r < refs.size(); r++)
|
||||
if ((refs[r] == selObj) && (refnames[r] == subname))
|
||||
return;
|
||||
|
||||
if (autoNext && iActiveRef > 0 && iActiveRef == refnames.size()){
|
||||
if (autoNext && iActiveRef > 0 && iActiveRef == (ssize_t) refnames.size()){
|
||||
if (refs[iActiveRef-1] == selObj
|
||||
&& refnames[iActiveRef-1].length() != 0 && subname.length() == 0){
|
||||
//A whole object was selected by clicking it twice. Fill it
|
||||
|
@ -422,7 +420,7 @@ void TaskDatumParameters::onSelectionChanged(const Gui::SelectionChanges& msg)
|
|||
iActiveRef--;
|
||||
}
|
||||
}
|
||||
if (iActiveRef < refs.size()) {
|
||||
if (iActiveRef < (ssize_t) refs.size()) {
|
||||
refs[iActiveRef] = selObj;
|
||||
refnames[iActiveRef] = subname;
|
||||
} else {
|
||||
|
@ -521,7 +519,7 @@ void TaskDatumParameters::onCheckFlip(bool on)
|
|||
pcDatum->getDocument()->recomputeFeature(pcDatum);
|
||||
}
|
||||
|
||||
void TaskDatumParameters::onButtonRef(const bool checked, const int idx)
|
||||
void TaskDatumParameters::onButtonRef(const bool checked, unsigned idx)
|
||||
{
|
||||
autoNext = false;
|
||||
if (checked) {
|
||||
|
@ -555,7 +553,7 @@ void TaskDatumParameters::onModeSelect()
|
|||
pcDatum->MapMode.setValue(getActiveMapMode());
|
||||
}
|
||||
|
||||
void TaskDatumParameters::onRefName(const QString& text, const int idx)
|
||||
void TaskDatumParameters::onRefName(const QString& text, unsigned idx)
|
||||
{
|
||||
QLineEdit* line = getLine(idx);
|
||||
if (line == NULL) return;
|
||||
|
@ -568,7 +566,7 @@ void TaskDatumParameters::onRefName(const QString& text, const int idx)
|
|||
std::vector<std::string> refnames = pcDatum->Support.getSubValues();
|
||||
std::vector<App::DocumentObject*> newrefs;
|
||||
std::vector<std::string> newrefnames;
|
||||
for (int r = 0; r < refs.size(); r++) {
|
||||
for (size_t r = 0; r < refs.size(); r++) {
|
||||
if (r != idx) {
|
||||
newrefs.push_back(refs[r]);
|
||||
newrefnames.push_back(refnames[r]);
|
||||
|
@ -601,7 +599,6 @@ void TaskDatumParameters::onRefName(const QString& text, const int idx)
|
|||
if (obj == NULL) return;
|
||||
|
||||
std::string subElement;
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
|
||||
|
||||
if (obj->getTypeId().isDerivedFrom(App::Plane::getClassTypeId())) {
|
||||
// everything is OK (we assume a Part can only have exactly 3 App::Plane objects located at the base of the feature tree)
|
||||
|
@ -690,7 +687,7 @@ void TaskDatumParameters::updateListOfModes(eMapMode curMode)
|
|||
ui->listOfModes->clear();
|
||||
QListWidgetItem* iSelect = 0;
|
||||
if (modesInList.size()>0) {
|
||||
for( int i = 0 ; i < modesInList.size() ; i++){
|
||||
for (size_t i = 0 ; i < modesInList.size() ; ++i){
|
||||
eMapMode mmode = modesInList[i];
|
||||
ui->listOfModes->addItem(QString::fromLatin1(AttachEngine::eMapModeStrings[mmode]));
|
||||
if (mmode == curMode)
|
||||
|
@ -874,7 +871,6 @@ bool TaskDlgDatumParameters::accept()
|
|||
std::vector<App::DocumentObject*> copies;
|
||||
|
||||
//see if we are able to assign a mode
|
||||
bool bIgnoreError = false;
|
||||
if (parameter->getActiveMapMode() == mmDeactivated) {
|
||||
QMessageBox msg;
|
||||
msg.setWindowTitle(tr("Incompatible reference set"));
|
||||
|
@ -882,7 +878,7 @@ bool TaskDlgDatumParameters::accept()
|
|||
" of references. If you choose to continue, the feature will remain where"
|
||||
" it is now, and will not be moved as the references change."
|
||||
" Continue?"));
|
||||
auto btYes = msg.addButton(QMessageBox::Yes);
|
||||
msg.addButton(QMessageBox::Yes);
|
||||
auto btNo = msg.addButton(QMessageBox::No);
|
||||
msg.setDefaultButton(btNo);
|
||||
msg.setIcon(QMessageBox::Warning);
|
||||
|
@ -971,8 +967,6 @@ bool TaskDlgDatumParameters::reject()
|
|||
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.recompute()");
|
||||
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -93,9 +93,9 @@ private:
|
|||
void updateUI(std::string message = std::string(), bool isWarning = false);
|
||||
|
||||
void makeRefStrings(std::vector<QString>& refstrings, std::vector<std::string>& refnames);
|
||||
QLineEdit* getLine(const int idx);
|
||||
void onButtonRef(const bool checked, const int idx);
|
||||
void onRefName(const QString& text, const int idx);
|
||||
QLineEdit* getLine(unsigned idx);
|
||||
void onButtonRef(const bool checked, unsigned idx);
|
||||
void onRefName(const QString& text, unsigned idx);
|
||||
|
||||
/**
|
||||
* @brief updateListOfModes Fills the mode list with modes that apply to
|
||||
|
@ -111,6 +111,7 @@ private:
|
|||
Ui_TaskDatumParameters* ui;
|
||||
ViewProviderDatum *DatumView;
|
||||
|
||||
// TODO fix documentation here (2015-11-10, Fat-Zer)
|
||||
int iActiveRef; //what reference is being picked in 3d view now? -1 means no one, 0-2 means a reference is being picked.
|
||||
bool autoNext;//if we should automatically switch to next reference (true after dialog launch, false afterwards)
|
||||
std::vector<Attacher::eMapMode> modesInList; //this list is synchronous to what is populated into listOfModes widget.
|
||||
|
|
|
@ -48,12 +48,11 @@ using namespace Gui;
|
|||
/* TRANSLATOR PartDesignGui::TaskDressUpParameters */
|
||||
|
||||
TaskDressUpParameters::TaskDressUpParameters(ViewProviderDressUp *DressUpView, bool selectEdges, bool selectFaces, QWidget *parent)
|
||||
: allowFaces(selectFaces), allowEdges(selectEdges),
|
||||
TaskBox(Gui::BitmapFactory().pixmap((std::string("PartDesign_") + DressUpView->featureName()).c_str()),
|
||||
: TaskBox(Gui::BitmapFactory().pixmap((std::string("PartDesign_") + DressUpView->featureName()).c_str()),
|
||||
QString::fromAscii((DressUpView->featureName() + " parameters").c_str()),
|
||||
true,
|
||||
parent),
|
||||
DressUpView(DressUpView)
|
||||
DressUpView(DressUpView), allowFaces(selectFaces), allowEdges(selectEdges)
|
||||
{
|
||||
selectionMode = none;
|
||||
}
|
||||
|
|
|
@ -119,7 +119,6 @@ TaskFeaturePick::TaskFeaturePick(std::vector<App::DocumentObject*>& objects,
|
|||
// Setup the origin's temporary visability
|
||||
for ( const auto & originPair: originVisStatus ) {
|
||||
const auto &origin = originPair.first;
|
||||
const auto &status = originPair.second;
|
||||
|
||||
Gui::ViewProviderOrigin* vpo = static_cast<Gui::ViewProviderOrigin*> (
|
||||
Gui::Application::Instance->getViewProvider ( origin ) );
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
using namespace PartDesignGui;
|
||||
|
||||
TaskBoxPrimitives::TaskBoxPrimitives(ViewProviderPrimitive* vp, QWidget* parent)
|
||||
: vp(vp), TaskBox(QPixmap(),tr("Primitive parameters"), true, parent)
|
||||
: TaskBox(QPixmap(),tr("Primitive parameters"), true, parent), vp(vp)
|
||||
{
|
||||
proxy = new QWidget(this);
|
||||
ui.setupUi(proxy);
|
||||
|
@ -697,4 +697,4 @@ QDialogButtonBox::StandardButtons TaskPrimitiveParameters::getStandardButtons(vo
|
|||
}
|
||||
|
||||
|
||||
#include "moc_TaskPrimitiveParameters.cpp"
|
||||
#include "moc_TaskPrimitiveParameters.cpp"
|
||||
|
|
|
@ -155,7 +155,7 @@ void TaskRevolutionParameters::fillAxisCombo(bool forceRefill)
|
|||
if (forceRefill){
|
||||
ui->axis->clear();
|
||||
|
||||
for(int i = 0 ; i < axesInList.size() ; i++ ){
|
||||
for(size_t i = 0 ; i < axesInList.size() ; i++ ){
|
||||
delete axesInList[i];
|
||||
}
|
||||
this->axesInList.clear();
|
||||
|
@ -198,7 +198,7 @@ void TaskRevolutionParameters::fillAxisCombo(bool forceRefill)
|
|||
int indexOfCurrent = -1;
|
||||
App::DocumentObject* ax = propReferenceAxis->getValue();
|
||||
const std::vector<std::string> &subList = propReferenceAxis->getSubValues();
|
||||
for(int i = 0 ; i < axesInList.size() ; i++) {
|
||||
for(size_t i = 0 ; i < axesInList.size() ; i++) {
|
||||
if(ax == axesInList[i]->getValue() && subList == axesInList[i]->getSubValues())
|
||||
indexOfCurrent = i;
|
||||
}
|
||||
|
@ -373,7 +373,7 @@ TaskRevolutionParameters::~TaskRevolutionParameters()
|
|||
|
||||
delete ui;
|
||||
|
||||
for(int i = 0 ; i < axesInList.size() ; i++ ){
|
||||
for(size_t i = 0 ; i < axesInList.size() ; i++ ){
|
||||
delete axesInList[i];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,6 @@ void TaskSketchBasedParameters::onSelectReference(const bool pressed, const bool
|
|||
// Note: Even if there is no solid, App::Plane and Part::Datum can still be selected
|
||||
|
||||
PartDesign::SketchBased* pcSketchBased = static_cast<PartDesign::SketchBased*>(vp->getObject());
|
||||
PartDesign::Body* activeBody = Gui::Application::Instance->activeView()->getActiveObject<PartDesign::Body*>(PDBODYKEY);
|
||||
|
||||
// The solid this feature will be fused to
|
||||
App::DocumentObject* prevSolid = pcSketchBased->getBaseObject( /* silent =*/ true );
|
||||
|
|
|
@ -422,7 +422,7 @@ int ComboLinks::addLink(App::DocumentObject *linkObj, std::string linkSubname, Q
|
|||
|
||||
void ComboLinks::clear()
|
||||
{
|
||||
for(int i = 0 ; i < this->linksInList.size() ; i++){
|
||||
for(size_t i = 0 ; i < this->linksInList.size() ; i++){
|
||||
delete linksInList[i];
|
||||
}
|
||||
if(this->_combo)
|
||||
|
@ -431,7 +431,7 @@ void ComboLinks::clear()
|
|||
|
||||
App::PropertyLinkSub &ComboLinks::getLink(int index) const
|
||||
{
|
||||
if (index < 0 || index > linksInList.size()-1)
|
||||
if (index < 0 || index > (ssize_t) linksInList.size()-1)
|
||||
throw Base::Exception("ComboLinks::getLink:Index out of range");
|
||||
if (linksInList[index]->getValue() && doc && !(doc->isIn(linksInList[index]->getValue())))
|
||||
throw Base::Exception("Linked object is not in the document; it may have been deleted");
|
||||
|
@ -446,7 +446,7 @@ App::PropertyLinkSub &ComboLinks::getCurrentLink() const
|
|||
|
||||
int ComboLinks::setCurrentLink(const App::PropertyLinkSub &lnk)
|
||||
{
|
||||
for(int i = 0 ; i < linksInList.size() ; i++) {
|
||||
for(size_t i = 0 ; i < linksInList.size() ; i++) {
|
||||
App::PropertyLinkSub &it = *(linksInList[i]);
|
||||
if(lnk.getValue() == it.getValue() && lnk.getSubValues() == it.getSubValues()){
|
||||
bool wasBlocked = _combo->signalsBlocked();
|
||||
|
|
|
@ -126,7 +126,6 @@ void ViewProviderAddSub::updateAddSubShapeIndicator() {
|
|||
bounds.Get(xMin, yMin, zMin, xMax, yMax, zMax);
|
||||
Standard_Real deflection = ((xMax-xMin)+(yMax-yMin)+(zMax-zMin))/300.0 *
|
||||
Deviation.getValue();
|
||||
Standard_Real AngDeflectionRads = AngularDeflection.getValue() / 180.0 * M_PI;
|
||||
|
||||
// create or use the mesh on the data structure
|
||||
#if OCC_VERSION_HEX >= 0x060600
|
||||
|
|
|
@ -186,8 +186,6 @@ std::vector<App::DocumentObject*> ViewProviderBody::claimChildren3D(void)const
|
|||
PartDesign::Body* body = static_cast<PartDesign::Body*>(getObject());
|
||||
|
||||
const std::vector<App::DocumentObject*> & features = body->Model.getValues();
|
||||
App::DocumentObject *originObj = body->Origin.getValue();
|
||||
App::DocumentObject *baseFeature = body->BaseFeature.getValue();
|
||||
|
||||
std::vector<App::DocumentObject*> rv;
|
||||
|
||||
|
|
|
@ -67,8 +67,6 @@ void ViewProviderDatumLine::attach ( App::DocumentObject *obj ) {
|
|||
void ViewProviderDatumLine::updateData(const App::Property* prop)
|
||||
{
|
||||
// Gets called whenever a property of the attached object changes
|
||||
PartDesign::Line* pcDatum = static_cast<PartDesign::Line*>(this->getObject());
|
||||
|
||||
if (strcmp(prop->getName(),"Placement") == 0) {
|
||||
updateExtents ();
|
||||
}
|
||||
|
|
|
@ -89,8 +89,6 @@ void ViewProviderDatumPlane::attach ( App::DocumentObject *obj ) {
|
|||
void ViewProviderDatumPlane::updateData(const App::Property* prop)
|
||||
{
|
||||
// Gets called whenever a property of the attached object changes
|
||||
PartDesign::Plane* pcDatum = static_cast<PartDesign::Plane*>(this->getObject());
|
||||
|
||||
if (strcmp(prop->getName(),"Placement") == 0) {
|
||||
updateExtents ();
|
||||
}
|
||||
|
|
|
@ -104,8 +104,10 @@ void ViewProviderDressUp::highlightReferences(const bool on)
|
|||
colors.resize(fMap.Extent(), ShapeColor.getValue());
|
||||
|
||||
for (std::vector<std::string>::const_iterator f = faces.begin(); f != faces.end(); ++f) {
|
||||
int idx = atoi(f->substr(4).c_str()) - 1;
|
||||
if (idx < colors.size())
|
||||
// Note: std::stoi may throw in case of bad or very long face name, but screw the try {} catch
|
||||
int idx = std::stoi(f->substr(4)) - 1;
|
||||
assert ( idx>=0 );
|
||||
if ( idx < (ssize_t) colors.size() )
|
||||
colors[idx] = App::Color(1.0,0.0,1.0); // magenta
|
||||
}
|
||||
vp->DiffuseColor.setValues(colors);
|
||||
|
@ -118,8 +120,9 @@ void ViewProviderDressUp::highlightReferences(const bool on)
|
|||
colors.resize(eMap.Extent(), LineColor.getValue());
|
||||
|
||||
for (std::vector<std::string>::const_iterator e = edges.begin(); e != edges.end(); ++e) {
|
||||
int idx = atoi(e->substr(4).c_str()) - 1;
|
||||
if (idx < colors.size())
|
||||
int idx = std::stoi(e->substr(4)) - 1;
|
||||
assert ( idx>=0 );
|
||||
if ( idx < (ssize_t) colors.size() )
|
||||
colors[idx] = App::Color(1.0,0.0,1.0); // magenta
|
||||
}
|
||||
vp->LineColorArray.setValues(colors);
|
||||
|
|
|
@ -174,8 +174,9 @@ void ViewProviderPipe::highlightReferences(const bool on, bool auxillery)
|
|||
colors.resize(eMap.Extent(), svp->LineColor.getValue());
|
||||
|
||||
for (std::string e : edges) {
|
||||
int idx = atoi(e.substr(4).c_str()) - 1;
|
||||
if (idx < colors.size())
|
||||
int idx = std::stoi(e.substr(4)) - 1;
|
||||
assert ( idx > 0 );
|
||||
if ( idx < (ssize_t) colors.size() )
|
||||
colors[idx] = App::Color(1.0,0.0,1.0); // magenta
|
||||
}
|
||||
svp->LineColorArray.setValues(colors);
|
||||
|
|
|
@ -140,23 +140,24 @@ void ViewProviderShapeBinder::highlightReferences(const bool on, bool auxillery)
|
|||
originalLineColors = svp->LineColorArray.getValues();
|
||||
std::vector<App::Color> lcolors = originalLineColors;
|
||||
lcolors.resize(eMap.Extent(), svp->LineColor.getValue());
|
||||
|
||||
|
||||
TopExp::MapShapes(obj->Shape.getValue(), TopAbs_FACE, eMap);
|
||||
originalFaceColors = svp->DiffuseColor.getValues();
|
||||
std::vector<App::Color> fcolors = originalFaceColors;
|
||||
fcolors.resize(eMap.Extent(), svp->ShapeColor.getValue());
|
||||
|
||||
for (std::string e : subs) {
|
||||
// Note: stoi may throw, but it strictly shouldn't happen
|
||||
if(e.substr(4) == "Edge") {
|
||||
|
||||
int idx = atoi(e.substr(4).c_str()) - 1;
|
||||
if (idx < lcolors.size())
|
||||
int idx = std::stoi(e.substr(4)) - 1;
|
||||
assert ( idx>=0 );
|
||||
if ( idx < (ssize_t) lcolors.size() )
|
||||
lcolors[idx] = App::Color(1.0,0.0,1.0); // magenta
|
||||
}
|
||||
else if(e.substr(4) == "Face") {
|
||||
|
||||
int idx = atoi(e.substr(4).c_str()) - 1;
|
||||
if (idx < fcolors.size())
|
||||
int idx = std::stoi(e.substr(4)) - 1;
|
||||
assert ( idx>=0 );
|
||||
if ( idx < (ssize_t) fcolors.size() )
|
||||
fcolors[idx] = App::Color(1.0,0.0,1.0); // magenta
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2779,7 +2779,7 @@ int SketchObject::addExternal(App::DocumentObject *Obj, const char* SubName)
|
|||
Base::Console().Error("Internal error: counts of objects and subelements in external geometry links do not match\n");
|
||||
return -1;
|
||||
}
|
||||
for (int i = 0 ; i < Objects.size() ; i++){
|
||||
for (size_t i = 0 ; i < Objects.size() ; ++i){
|
||||
if (Objects[i] == Obj && std::string(SubName) == SubElements[i]){
|
||||
Base::Console().Error("Link to %s already exists in this sketch.\n",SubName);
|
||||
return -1;
|
||||
|
|
|
@ -164,7 +164,7 @@ void CmdSketcherNewSketch::activated(int iMsg)
|
|||
QStringList items;
|
||||
items.push_back(QObject::tr("Don't attach"));
|
||||
int iSugg = 0;//index of the auto-suggested mode in the list of valid modes
|
||||
for (int i = 0 ; i < validModes.size() ; ++i){
|
||||
for (size_t i = 0 ; i < validModes.size() ; ++i){
|
||||
items.push_back(QString::fromLatin1(AttachEngine::eMapModeStrings[validModes[i]]));
|
||||
if (validModes[i] == mapmode)
|
||||
iSugg = items.size()-1;
|
||||
|
@ -473,7 +473,7 @@ void CmdSketcherMapSketch::activated(int iMsg)
|
|||
|
||||
// check circular dependency
|
||||
std::vector<Gui::SelectionObject> selobjs = Gui::Selection().getSelectionEx();
|
||||
for( int i = 0 ; i < selobjs.size() ; i++){
|
||||
for (size_t i = 0 ; i < selobjs.size() ; ++i){
|
||||
App::DocumentObject* part = static_cast<Part::Feature*>(selobjs[i].getObject());
|
||||
if (!part) {
|
||||
assert(0);
|
||||
|
@ -512,7 +512,7 @@ void CmdSketcherMapSketch::activated(int iMsg)
|
|||
items.push_back(QObject::tr("Don't attach"));
|
||||
int iSugg = 0;//index of the auto-suggested mode in the list of valid modes
|
||||
int iCurr = 0;//index of current mode in the list of valid modes
|
||||
for (int i = 0 ; i < validModes.size() ; ++i){
|
||||
for (size_t i = 0 ; i < validModes.size() ; ++i){
|
||||
items.push_back(QString::fromLatin1(AttachEngine::eMapModeStrings[validModes[i]]));
|
||||
if (validModes[i] == curMapMode) {
|
||||
iCurr = items.size() - 1;
|
||||
|
|
|
@ -236,7 +236,6 @@ int DrawSketchHandler::seekAutoConstraint(std::vector<AutoConstraint> &suggested
|
|||
|
||||
int tangId = Constraint::GeoUndef;
|
||||
|
||||
float smlTangDist = 1e15f;
|
||||
// Do not consider if distance is more than that.
|
||||
// Decrease this value when a candidate is found.
|
||||
double tangDeviation = 0.1 * sketchgui->getScaleFactor();
|
||||
|
|
Loading…
Reference in New Issue
Block a user