Path: Several fixes suggested by wmayer

This commit is contained in:
Yorik van Havre 2015-07-14 12:23:40 -03:00
parent 44ae0d7ae7
commit 9b476e140d
6 changed files with 12 additions and 11 deletions

View File

@ -109,7 +109,7 @@ Vector3d Command::getCenter (void)
return vec;
}
const double Command::getValue(const std::string attr)
const double Command::getValue(const std::string& attr)
{
std::string a(attr);
boost::to_upper(a);
@ -119,11 +119,11 @@ const double Command::getValue(const std::string attr)
return val;
}
const bool Command::has(const std::string attr)
const bool Command::has(const std::string& attr)
{
std::string a(attr);
boost::to_upper(a);
return (bool)Parameters.count(a);
return Parameters.count(a) > 0;
}
std::string Command::toGCode (void) const
@ -139,7 +139,7 @@ std::string Command::toGCode (void) const
return str.str();
}
void Command::setFromGCode (std::string str)
void Command::setFromGCode (const std::string& str)
{
Parameters.clear();
std::string mode = "none";

View File

@ -53,11 +53,11 @@ namespace Path
Base::Vector3d getCenter (void); // returns a 3d vector from the i,j,k parameters
void setCenter(const Base::Vector3d&, bool clockwise=true); // sets the center coordinates and the command name
std::string toGCode (void) const; // returns a GCode string representation of the command
void setFromGCode (std::string); // sets the parameters from the contents of the given GCode string
void setFromGCode (const std::string&); // sets the parameters from the contents of the given GCode string
void setFromPlacement (const Base::Placement&); // sets the parameters from the contents of the given placement
const bool has(const std::string); // returns true if the given string exists in the parameters
const bool has(const std::string&); // returns true if the given string exists in the parameters
Command transform(const Base::Placement); // returns a transformed copy of this command
const double getValue(const std::string); // returns the value of a given parameter
const double getValue(const std::string&); // returns the value of a given parameter
// attributes
std::string Name;

View File

@ -58,7 +58,6 @@ PyObject *ToolPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Pytho
// constructor method
int ToolPy::PyInit(PyObject* args, PyObject* kwd)
{
PyObject *pos;
char *name="Default tool";
char *type = "Undefined";
char *mat = "Undefined";

View File

@ -40,6 +40,8 @@
using namespace PathGui;
/* TRANSLATOR PathGui::DlgProcessorChooser */
DlgProcessorChooser::DlgProcessorChooser(std::vector<std::string> &scriptnames)
: QDialog(Gui::getMainWindow()), ui(new Ui_DlgProcessorChooser)
{
@ -64,7 +66,7 @@ void DlgProcessorChooser::accept()
if (ui->comboBox->currentText() == tr("None"))
entry = "";
else
entry = ui->comboBox->currentText().toStdString();
entry = ui->comboBox->currentText().toUtf8().data();
QDialog::accept();
}
#include "moc_DlgProcessorChooser.cpp"

View File

@ -30,7 +30,7 @@
using namespace PathGui;
/* TRANSLATOR PartGui::DlgSettingsPathColor */
/* TRANSLATOR PathGui::DlgSettingsPathColor */
/**
* Constructs a DlgSettingsObjectColor which is a child of 'parent', with the

View File

@ -231,7 +231,7 @@ void ViewProviderPath::updateData(const App::Property* prop)
bool absolute = true;
bool first = true;
for (int i = 0; i < tp.getSize(); i++) {
for (unsigned int i = 0; i < tp.getSize(); i++) {
Path::Command cmd = tp.getCommand(i);
std::string name = cmd.Name;
Base::Vector3d next = cmd.getPlacement().getPosition();