+ fix warnings:

-Wsign-compare, -Wunused-variable, -Wunused-function, -Wswitch
+ fix Qt issues
This commit is contained in:
wmayer 2016-04-13 14:26:38 +02:00
parent e3b609b309
commit 5de9696365
13 changed files with 106 additions and 325 deletions

View File

@ -605,7 +605,7 @@ const string PropertyLinkSubList::getPyReprString()
std::stringstream strm;
strm << "[";
for ( int i = 0 ; i < this->_lSubList.size() ; i++) {
for (std::size_t i = 0; i < this->_lSubList.size(); i++) {
if (i>0)
strm << ",(";
else
@ -628,7 +628,7 @@ DocumentObject *PropertyLinkSubList::getValue() const
{
App::DocumentObject* ret = 0;
//FIXME: cache this to avoid iterating each time, to improve speed
for (int i = 0 ; i < this->_lValueList.size() ; i++){
for (std::size_t i = 0; i < this->_lValueList.size(); i++) {
if (ret == 0)
ret = this->_lValueList[i];
if (ret != this->_lValueList[i])

View File

@ -264,7 +264,6 @@ set(Gui_MOC_HDRS
TaskView/TaskView.h
DAGView/DAGView.h
DAGView/DAGModel.h
DAGView/DAGRectItem.h
)
#qt4_wrap_cpp(Gui_MOC_SRCS ${Gui_MOC_HDRS})
fc_wrap_cpp(Gui_MOC_SRCS ${Gui_MOC_HDRS})

View File

@ -796,7 +796,6 @@ bool QuarterWidget::viewportEvent(QEvent* event)
}
else if (event->type() == QEvent::MouseMove ||
event->type() == QEvent::MouseButtonRelease) {
QMouseEvent* mouse = static_cast<QMouseEvent*>(event);
QGraphicsScene* glScene = this->scene();
if (!(glScene && glScene->mouseGrabberItem())) {
QGraphicsView::viewportEvent(event);

View File

@ -399,7 +399,7 @@ int SelectionSingleton::getAsPropertyLinkSubList(App::PropertyLinkSubList &prop)
std::vector<Gui::SelectionObject> sel = this->getSelectionEx();
std::vector<App::DocumentObject*> objs; objs.reserve(sel.size()*2);
std::vector<std::string> subs; subs.reserve(sel.size()*2);
for( int iobj = 0 ; iobj < sel.size() ; iobj++ ){
for (std::size_t iobj = 0; iobj < sel.size(); iobj++) {
Gui::SelectionObject &selitem = sel[iobj];
App::DocumentObject* obj = selitem.getObject();
const std::vector<std::string> &subnames = selitem.getSubNames();
@ -407,7 +407,7 @@ int SelectionSingleton::getAsPropertyLinkSubList(App::PropertyLinkSubList &prop)
objs.push_back(obj);
subs.push_back(std::string());
} else {
for( int isub = 0 ; isub < subnames.size() ; isub++ ){
for (std::size_t isub = 0; isub < subnames.size(); isub++) {
objs.push_back(obj);
subs.push_back(subnames[isub]);
}

View File

@ -539,7 +539,6 @@ void TreeWidget::dropEvent(QDropEvent *event)
// add object to group
DocumentObjectItem* targetItemObj = static_cast<DocumentObjectItem*>(targetitem);
Gui::ViewProviderDocumentObject* vp = targetItemObj->object();
App::DocumentObject* grp = vp->getObject();
if (!vp->canDropObjects()) {
return; // no group like object
}
@ -548,9 +547,6 @@ void TreeWidget::dropEvent(QDropEvent *event)
dropObjects.reserve(idxs.size());
// Open command
App::Document* doc = grp->getDocument();
Gui::Document* gui = Gui::Application::Instance->getDocument(doc);
for (QList<QTreeWidgetItem*>::Iterator it = items.begin(); it != items.end(); ++it) {
Gui::ViewProviderDocumentObject* vpc = static_cast<DocumentObjectItem*>(*it)->object();
App::DocumentObject* obj = vpc->getObject();

View File

@ -29,16 +29,16 @@
#include <Base/PyObjectBase.h>
#include <Base/Console.h>
#include <App/PartPy.h>
//#include <App/PartPy.h>
#include <Gui/Application.h>
#include <Gui/Document.h>
#include <Gui/ViewProviderDocumentObject.h>
//#include <Gui/Application.h>
//#include <Gui/Document.h>
//#include <Gui/ViewProviderDocumentObject.h>
#include <Mod/PartDesign/App/BodyPy.h>
//#include <Mod/PartDesign/App/BodyPy.h>
#include "ViewProviderBody.h"
#include "Utils.h"
//#include "ViewProviderBody.h"
//#include "Utils.h"
//static PyObject * setActiveBody(PyObject *self, PyObject *args)

View File

@ -89,7 +89,6 @@ public:
private:
Py::Object importer(const Py::Tuple& args)
{
char* Name;
char* DocName=0;
@ -410,226 +409,6 @@ static PyObject * importAssembly(PyObject *self, PyObject *args)
Py_Return;
}*/
static PyObject * importer(PyObject *self, PyObject *args)
{
char* Name;
char* DocName=0;
if (!PyArg_ParseTuple(args, "et|s","utf-8",&Name,&DocName))
return NULL;
std::string Utf8Name = std::string(Name);
PyMem_Free(Name);
std::string name8bit = Part::encodeFilename(Utf8Name);
PY_TRY {
//Base::Console().Log("Insert in Part with %s",Name);
Base::FileInfo file(Utf8Name.c_str());
App::Document *pcDoc = 0;
if (DocName) {
pcDoc = App::GetApplication().getDocument(DocName);
}
if (!pcDoc) {
pcDoc = App::GetApplication().newDocument("Unnamed");
}
Handle(XCAFApp_Application) hApp = XCAFApp_Application::GetApplication();
Handle(TDocStd_Document) hDoc;
hApp->NewDocument(TCollection_ExtendedString("MDTV-CAF"), hDoc);
if (file.hasExtension("stp") || file.hasExtension("step")) {
try {
STEPCAFControl_Reader aReader;
aReader.SetColorMode(true);
aReader.SetNameMode(true);
aReader.SetLayerMode(true);
if (aReader.ReadFile((Standard_CString)(name8bit.c_str())) != IFSelect_RetDone) {
PyErr_SetString(Base::BaseExceptionFreeCADError, "cannot read STEP file");
return 0;
}
Handle_Message_ProgressIndicator pi = new Part::ProgressIndicator(100);
aReader.Reader().WS()->MapReader()->SetProgress(pi);
pi->NewScope(100, "Reading STEP file...");
pi->Show();
aReader.Transfer(hDoc);
pi->EndScope();
}
catch (OSD_Exception) {
Handle_Standard_Failure e = Standard_Failure::Caught();
Base::Console().Error("%s\n", e->GetMessageString());
Base::Console().Message("Try to load STEP file without colors...\n");
Part::ImportStepParts(pcDoc,Utf8Name.c_str());
pcDoc->recompute();
}
}
else if (file.hasExtension("igs") || file.hasExtension("iges")) {
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part")->GetGroup("IGES");
try {
IGESControl_Controller::Init();
IGESCAFControl_Reader aReader;
// http://www.opencascade.org/org/forum/thread_20603/?forum=3
aReader.SetReadVisible(hGrp->GetBool("SkipBlankEntities", true)
? Standard_True : Standard_False);
aReader.SetColorMode(true);
aReader.SetNameMode(true);
aReader.SetLayerMode(true);
if (aReader.ReadFile((Standard_CString)(name8bit.c_str())) != IFSelect_RetDone) {
PyErr_SetString(Base::BaseExceptionFreeCADError, "cannot read IGES file");
return 0;
}
Handle_Message_ProgressIndicator pi = new Part::ProgressIndicator(100);
aReader.WS()->MapReader()->SetProgress(pi);
pi->NewScope(100, "Reading IGES file...");
pi->Show();
aReader.Transfer(hDoc);
pi->EndScope();
}
catch (OSD_Exception) {
Handle_Standard_Failure e = Standard_Failure::Caught();
Base::Console().Error("%s\n", e->GetMessageString());
Base::Console().Message("Try to load IGES file without colors...\n");
Part::ImportIgesParts(pcDoc,Utf8Name.c_str());
pcDoc->recompute();
}
}
else {
PyErr_SetString(Base::BaseExceptionFreeCADError, "no supported file format");
return 0;
}
#if 1
Import::ImportOCAF ocaf(hDoc, pcDoc, file.fileNamePure());
ocaf.loadShapes();
#else
Import::ImportXCAF xcaf(hDoc, pcDoc, file.fileNamePure());
xcaf.loadShapes();
#endif
pcDoc->recompute();
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(Base::BaseExceptionFreeCADError, e->GetMessageString());
return 0;
}
PY_CATCH
Py_Return;
}
static PyObject * open(PyObject *self, PyObject *args)
{
return importer(self, args);
}
static PyObject * exporter(PyObject *self, PyObject *args)
{
PyObject* object;
char* Name;
if (!PyArg_ParseTuple(args, "Oet",&object,"utf-8",&Name))
return NULL;
std::string Utf8Name = std::string(Name);
PyMem_Free(Name);
std::string name8bit = Part::encodeFilename(Utf8Name);
PY_TRY {
Handle(XCAFApp_Application) hApp = XCAFApp_Application::GetApplication();
Handle(TDocStd_Document) hDoc;
hApp->NewDocument(TCollection_ExtendedString("MDTV-CAF"), hDoc);
Import::ExportOCAF ocaf(hDoc);
Py::Sequence list(object);
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
PyObject* item = (*it).ptr();
if (PyObject_TypeCheck(item, &(App::DocumentObjectPy::Type))) {
App::DocumentObject* obj = static_cast<App::DocumentObjectPy*>(item)->getDocumentObjectPtr();
if (obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
Part::Feature* part = static_cast<Part::Feature*>(obj);
std::vector<App::Color> colors;
ocaf.saveShape(part, colors);
}
else {
Base::Console().Message("'%s' is not a shape, export will be ignored.\n", obj->Label.getValue());
}
}
else if (PyTuple_Check(item) && PyTuple_Size(item) == 2) {
Py::Tuple tuple(*it);
Py::Object item0 = tuple.getItem(0);
Py::Object item1 = tuple.getItem(1);
if (PyObject_TypeCheck(item0.ptr(), &(App::DocumentObjectPy::Type))) {
App::DocumentObject* obj = static_cast<App::DocumentObjectPy*>(item0.ptr())->getDocumentObjectPtr();
if (obj->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) {
Part::Feature* part = static_cast<Part::Feature*>(obj);
App::PropertyColorList colors;
colors.setPyObject(item1.ptr());
ocaf.saveShape(part, colors.getValues());
}
else {
Base::Console().Message("'%s' is not a shape, export will be ignored.\n", obj->Label.getValue());
}
}
}
}
Base::FileInfo file(Utf8Name.c_str());
if (file.hasExtension("stp") || file.hasExtension("step")) {
//Interface_Static::SetCVal("write.step.schema", "AP214IS");
STEPCAFControl_Writer writer;
writer.Transfer(hDoc, STEPControl_AsIs);
// edit STEP header
#if OCC_VERSION_HEX >= 0x060500
APIHeaderSection_MakeHeader makeHeader(writer.ChangeWriter().Model());
#else
APIHeaderSection_MakeHeader makeHeader(writer.Writer().Model());
#endif
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Part")->GetGroup("STEP");
makeHeader.SetName(new TCollection_HAsciiString((const Standard_CString)Utf8Name.c_str()));
makeHeader.SetAuthorValue (1, new TCollection_HAsciiString(hGrp->GetASCII("Author", "Author").c_str()));
makeHeader.SetOrganizationValue (1, new TCollection_HAsciiString(hGrp->GetASCII("Company").c_str()));
makeHeader.SetOriginatingSystem(new TCollection_HAsciiString(App::GetApplication().getExecutableName()));
makeHeader.SetDescriptionValue(1, new TCollection_HAsciiString("FreeCAD Model"));
IFSelect_ReturnStatus ret = writer.Write(name8bit.c_str());
if (ret == IFSelect_RetError || ret == IFSelect_RetFail || ret == IFSelect_RetStop) {
PyErr_Format(PyExc_IOError, "Cannot open file '%s'", Utf8Name.c_str());
return 0;
}
}
else if (file.hasExtension("igs") || file.hasExtension("iges")) {
IGESControl_Controller::Init();
IGESCAFControl_Writer writer;
IGESData_GlobalSection header = writer.Model()->GlobalSection();
header.SetAuthorName(new TCollection_HAsciiString(Interface_Static::CVal("write.iges.header.author")));
header.SetCompanyName(new TCollection_HAsciiString(Interface_Static::CVal("write.iges.header.company")));
header.SetSendName(new TCollection_HAsciiString(Interface_Static::CVal("write.iges.header.product")));
writer.Model()->SetGlobalSection(header);
writer.Transfer(hDoc);
Standard_Boolean ret = writer.Write(name8bit.c_str());
if (!ret) {
PyErr_Format(PyExc_IOError, "Cannot open file '%s'", Utf8Name.c_str());
return 0;
}
}
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();
PyErr_SetString(Base::BaseExceptionFreeCADError, e->GetMessageString());
return 0;
}
PY_CATCH
Py_Return;
}
PyObject* initModule()
{
return (new Module)->module().ptr();

View File

@ -46,7 +46,7 @@ TestJtReader::~TestJtReader()
void TestJtReader::read(void)
{
const std::vector<TOC_Entry>& toc = readToc();
//const std::vector<TOC_Entry>& toc = readToc();
for (std::vector<TOC_Entry>::const_iterator i = TocEntries.begin(); i != TocEntries.end(); ++i){
int segType = i->getSegmentType();

View File

@ -278,14 +278,14 @@ eMapMode AttachEngine::listMapModes(eSuggestResult& msg,
eMapMode bestMatchType = mmDeactivated;
int bestMatchScore = -1;
msg = srNoModesFit;
for(int iMode = 0 ; iMode < this->modeRefTypes.size() ; ++iMode){
for (std::size_t iMode = 0; iMode < this->modeRefTypes.size(); ++iMode) {
if (! this->modeEnabled[iMode])
continue;
const refTypeStringList &listStrings = modeRefTypes[iMode];
for( int iStr = 0 ; iStr < listStrings.size() ; ++iStr ){
for (std::size_t iStr = 0; iStr < listStrings.size(); ++iStr) {
int score = 1; //-1 = topo incompatible, 0 = topo compatible, geom incompatible; 1+ = compatible (the higher - the more specific is the mode for the support)
const refTypeString &str = listStrings[iStr];
for (int iChr = 0 ; iChr < str.size() && iChr < typeStr.size() ; ++iChr ){
for (std::size_t iChr = 0; iChr < str.size() && iChr < typeStr.size(); ++iChr) {
int match = AttachEngine::isShapeOfType(typeStr[iChr], str[iChr]);
switch(match){
case -1:
@ -343,7 +343,7 @@ void AttachEngine::EnableAllSupportedModes()
{
this->modeEnabled.resize(mmDummy_NumberOfModes,false);
assert(modeRefTypes.size() > 0);
for( int i = 0 ; i < this->modeEnabled.size() ; i++ ){
for (std::size_t i = 0; i < this->modeEnabled.size(); i++) {
modeEnabled[i] = modeRefTypes[i].size() > 0;
}
}
@ -384,32 +384,26 @@ eRefType AttachEngine::getShapeType(const TopoDS_Shape& sh)
switch(surf.GetType()) {
case GeomAbs_Plane:
return rtFlatFace;
break;
case GeomAbs_Cylinder:
return rtCylindricalFace;
break;
case GeomAbs_Cone:
return rtConicalFace;
break;
case GeomAbs_Sphere:
return rtSphericalFace;
break;
case GeomAbs_Torus:
return rtToroidalFace;
break;
case GeomAbs_BezierSurface:
break;
break;
case GeomAbs_BSplineSurface:
break;
break;
case GeomAbs_SurfaceOfRevolution:
return rtSurfaceRev;
break;
case GeomAbs_SurfaceOfExtrusion:
break;
break;
case GeomAbs_OffsetSurface:
break;
break;
case GeomAbs_OtherSurface:
break;
break;
}
return rtFace;
}break;
@ -419,32 +413,24 @@ eRefType AttachEngine::getShapeType(const TopoDS_Shape& sh)
switch (crv.GetType()){
case GeomAbs_Line:
return rtLine;
break;
case GeomAbs_Circle:
return rtCircle;
break;
case GeomAbs_Ellipse:
return rtEllipse;
break;
case GeomAbs_Hyperbola:
return rtHyperbola;
break;
case GeomAbs_Parabola:
return rtParabola;
break;
case GeomAbs_BezierCurve:
case GeomAbs_BSplineCurve:
case GeomAbs_OtherCurve:
return rtCurve;
break;
}
}break;
case TopAbs_WIRE:
return rtWire;
break;
case TopAbs_VERTEX:
return rtVertex;
break;
default:
throw Base::Exception("AttachEngine::getShapeType: unexpected TopoDS_Shape::ShapeType");
}//switch shapetype
@ -478,40 +464,31 @@ eRefType AttachEngine::downgradeType(eRefType type)
case rtEdge:
case rtFace:
return rtAnything;
break;
case rtAnything:
return rtAnything;
break;
case rtLine:
case rtCurve:
return rtEdge;
break;
case rtConic:
case rtCircle:
return rtCurve;
break;
case rtEllipse:
case rtParabola:
case rtHyperbola:
return rtConic;
break;
case rtFlatFace:
case rtSphericalFace:
case rtSurfaceRev:
return rtFace;
break;
case rtCylindricalFace:
case rtToroidalFace:
case rtConicalFace:
return rtSurfaceRev;
break;
case rtSolid:
case rtWire:
return rtPart;
break;
case rtPart:
return rtAnything;
break;
default:
throw Base::Exception("AttachEngine::downgradeType: unknown type");
}
@ -534,9 +511,10 @@ int AttachEngine::getTypeRank(eRefType type)
int AttachEngine::isShapeOfType(eRefType shapeType, eRefType requirement)
{
//first up, check for hasplacement flag
if (requirement & rtFlagHasPlacement)
if (requirement & rtFlagHasPlacement) {
if(! (shapeType & rtFlagHasPlacement))
return -1;
}
//get rid of hasplacement flags, to simplify the rest
shapeType = eRefType(shapeType & (rtFlagHasPlacement - 1));
@ -574,7 +552,8 @@ int AttachEngine::isShapeOfType(eRefType shapeType, eRefType requirement)
* \brief AttachEngine3D::readLinks
* \param parts
* \param shapes
* \param storage is a buffer storing what some of the pointers in shapes point to. It is needed, since subshapes are copied in the process (but copying a whole shape of an object can potentially be slow).
* \param storage is a buffer storing what some of the pointers in shapes point to. It is needed, since
* subshapes are copied in the process (but copying a whole shape of an object can potentially be slow).
*/
void AttachEngine::readLinks(const App::PropertyLinkSubList &references,
std::vector<App::GeoFeature*> &geofs,
@ -588,8 +567,8 @@ void AttachEngine::readLinks(const App::PropertyLinkSubList &references,
storage.reserve(objs.size());
shapes.resize(objs.size());
types.resize(objs.size());
for( int i = 0 ; i < objs.size() ; i++){
if (!objs[i]->getTypeId().isDerivedFrom(App::GeoFeature::getClassTypeId())){
for (std::size_t i = 0; i < objs.size(); i++) {
if (!objs[i]->getTypeId().isDerivedFrom(App::GeoFeature::getClassTypeId())) {
throw Base::Exception("AttachEngine3D: link points to something that is not App::GeoFeature");
}
App::GeoFeature* geof = static_cast<App::GeoFeature*>(objs[i]);
@ -792,7 +771,7 @@ Base::Placement AttachEngine3D::calculateAttachedPlacement(Base::Placement origP
switch (mmode) {
case mmDeactivated:
//should have been filtered out already!
break;
break;
case mmTranslate:{
if (shapes.size() < 1)
throw Base::Exception("AttachEngine3D::calculateAttachedPlacement: no subobjects specified (need one vertex).");
@ -854,15 +833,17 @@ Base::Placement AttachEngine3D::calculateAttachedPlacement(Base::Placement origP
case mmObjectXY:
SketchNormal = dirZ;
SketchXAxis = gp_Vec(dirX);
break;
break;
case mmObjectXZ:
SketchNormal = dirY.Reversed();
SketchXAxis = gp_Vec(dirX);
break;
break;
case mmObjectYZ:
SketchNormal = dirX;
SketchXAxis = gp_Vec(dirY);
break;
break;
default:
break;
}
} break;
@ -1034,20 +1015,20 @@ Base::Placement AttachEngine3D::calculateAttachedPlacement(Base::Placement origP
case mmRevolutionSection:
SketchNormal = T.Reversed();//to avoid sketches upside-down for regular curves like circles
SketchXAxis = N.Reversed();
break;
break;
case mmFrenetTN:
case mmConcentric:
if (N.Magnitude() == 0.0)
throw Base::Exception("AttachEngine3D::calculateAttachedPlacement: Frenet-Serret normal is undefined. Can't align to TN plane.");
SketchNormal = B;
SketchXAxis = T;
break;
break;
case mmFrenetTB:
if (N.Magnitude() == 0.0)
throw Base::Exception("AttachEngine3D::calculateAttachedPlacement: Frenet-Serret normal is undefined. Can't align to TB plane.");
SketchNormal = N.Reversed();//it is more convenient to sketch on something looking it it so it is convex.
SketchXAxis = T;
break;
break;
default:
assert(0);//mode forgotten?
}
@ -1073,7 +1054,7 @@ Base::Placement AttachEngine3D::calculateAttachedPlacement(Base::Placement origP
std::vector<gp_Pnt> points;
for( int i = 0 ; i < shapes.size() ; i++){
for (std::size_t i = 0; i < shapes.size(); i++) {
const TopoDS_Shape &sh = *shapes[i];
if (sh.IsNull())
throw Base::Exception("Null shape in AttachEngine3D::calculateAttachedPlacement()!");
@ -1211,7 +1192,9 @@ Base::Placement AttachEngine3D::calculateAttachedPlacement(Base::Placement origP
);
gp_Vec norm = dirs[1].Crossed(dirs[2]);
norm.Rotate(gp_Ax1(gp_Pnt(),gp_Dir(dirs[1])),-ang);//rotation direction: when angle is positive, rotation is CCW when observing the vector so that the axis is pointing at you. Hence angle is negated here.
//rotation direction: when angle is positive, rotation is CCW when observing the vector so
//that the axis is pointing at you. Hence angle is negated here.
norm.Rotate(gp_Ax1(gp_Pnt(),gp_Dir(dirs[1])),-ang);
SketchNormal = norm.Reversed();
SketchXAxis = dirs[1];
@ -1255,7 +1238,6 @@ double AttachEngine3D::calculateFoldAngle(gp_Vec axA, gp_Vec axB, gp_Vec edA, gp
if (fabs(ra) < Precision::Confusion())
throw Base::Exception("calculateFoldAngle: axisA and edgeA are parallel, folding can't be computed.");
double b = edB.Dot(axB);
double rb = edB.Crossed(axB).Magnitude();
double costheta = axB.Dot(axA);
double sintheta = axA.Crossed(axB).Dot(norm);
double singama = -costheta;
@ -1383,7 +1365,7 @@ Base::Placement AttachEngineLine::calculateAttachedPlacement(Base::Placement ori
case mm1TwoPoints:{
std::vector<gp_Pnt> points;
for( int i = 0 ; i < shapes.size() ; i++){
for (std::size_t i = 0; i < shapes.size(); i++) {
const TopoDS_Shape &sh = *shapes[i];
if (sh.IsNull())
throw Base::Exception("Null shape in AttachEngineLine::calculateAttachedPlacement()!");
@ -1554,14 +1536,14 @@ Base::Placement AttachEnginePoint::calculateAttachedPlacement(Base::Placement or
switch(mmode){
case mm0Origin:
mmode = mmObjectXY;
break;
break;
case mm0CenterOfCurvature:
mmode = mmRevolutionSection;
break;
break;
case mm0OnEdge:
//todo: prevent thruPoint
mmode = mmNormalToPath;
break;
break;
default:
bReUsed = false;
}

View File

@ -111,32 +111,32 @@ enum eSuggestResult{
* also AttachEngine::getShapeType(), AttachEngine::downgradeType(), TaskDatumParameters.cpp/getShTypeText()
*/
enum eRefType {
//topo //ranks: (number of times the type is downgradable)
rtAnything, //0
rtVertex, //1
rtEdge, //1
rtFace, //1
//topo //ranks: (number of times the type is downgradable)
rtAnything, //0
rtVertex, //1
rtEdge, //1
rtFace, //1
//edges:
rtLine, //2
rtCurve, //2
rtCircle, //3
rtConic, //3
rtEllipse, //4
rtParabola, //4
rtHyperbola, //4
rtLine, //2
rtCurve, //2
rtCircle, //3
rtConic, //3
rtEllipse, //4
rtParabola, //4
rtHyperbola, //4
//faces:
rtFlatFace, //2
rtSphericalFace, //2//flatface, shericalface are also surfaces of revolution, but the axis isn't defined.
rtSurfaceRev, //2
rtCylindricalFace, //3
rtToroidalFace, //3
rtConicalFace, //3
//shapes:
rtPart, //1
rtSolid, //2
rtWire, //2
rtDummy_numberOfShapeTypes,//a value useful to check the validity of value
rtFlagHasPlacement = 0x0100 //indicates that the linked shape is a whole FreeCAD object that has placement available.
rtFlatFace, //2
rtSphericalFace, //2//flatface, shericalface are also surfaces of revolution, but the axis isn't defined.
rtSurfaceRev, //2
rtCylindricalFace, //3
rtToroidalFace, //3
rtConicalFace, //3
//shapes:
rtPart, //1
rtSolid, //2
rtWire, //2
rtDummy_numberOfShapeTypes,//a value useful to check the validity of value
rtFlagHasPlacement = 0x0100 //indicates that the linked shape is a whole FreeCAD object that has placement available.
};
@ -316,11 +316,35 @@ public: //members
std::vector<refTypeStringList> modeRefTypes; //a complete data structure, containing info on which modes support what selection
protected:
refTypeString cat(eRefType rt1){refTypeString ret; ret.push_back(rt1); return ret;}
refTypeString cat(eRefType rt1, eRefType rt2){refTypeString ret; ret.push_back(rt1); ret.push_back(rt2); return ret;}
refTypeString cat(eRefType rt1, eRefType rt2, eRefType rt3){refTypeString ret; ret.push_back(rt1); ret.push_back(rt2); ret.push_back(rt3); return ret;}
refTypeString cat(eRefType rt1, eRefType rt2, eRefType rt3, eRefType rt4){refTypeString ret; ret.push_back(rt1); ret.push_back(rt2); ret.push_back(rt3); ret.push_back(rt4); return ret;}
static void readLinks(const App::PropertyLinkSubList &references, std::vector<App::GeoFeature *> &geofs, std::vector<const TopoDS_Shape*>& shapes, std::vector<TopoDS_Shape> &storage, std::vector<eRefType> &types);
refTypeString cat(eRefType rt1){
refTypeString ret;
ret.push_back(rt1);
return ret;
}
refTypeString cat(eRefType rt1, eRefType rt2){
refTypeString ret;
ret.push_back(rt1);
ret.push_back(rt2);
return ret;
}
refTypeString cat(eRefType rt1, eRefType rt2, eRefType rt3){
refTypeString ret;
ret.push_back(rt1);
ret.push_back(rt2);
ret.push_back(rt3);
return ret;
}
refTypeString cat(eRefType rt1, eRefType rt2, eRefType rt3, eRefType rt4){
refTypeString ret;
ret.push_back(rt1);
ret.push_back(rt2);
ret.push_back(rt3);
ret.push_back(rt4);
return ret;
}
static void readLinks(const App::PropertyLinkSubList &references, std::vector<App::GeoFeature *> &geofs,
std::vector<const TopoDS_Shape*>& shapes, std::vector<TopoDS_Shape> &storage,
std::vector<eRefType> &types);
static void throwWrongMode(eMapMode mmode);

View File

@ -426,16 +426,16 @@ void ViewProviderPartExt::onChanged(const App::Property* prop)
// For testing
else if (prop == &DiffuseColor) {
const std::vector<App::Color>& c = DiffuseColor.getValues();
unsigned int size = (int)c.size();
int size = static_cast<int>(c.size());
if (size > 1 && size == this->faceset->partIndex.getNum()) {
pcShapeBind->value = SoMaterialBinding::PER_PART;
pcShapeMaterial->diffuseColor.setNum(size);
SbColor* ca = pcShapeMaterial->diffuseColor.startEditing();
for (unsigned int i=0; i < size; i++)
for (int i=0; i < size; i++)
ca[i].setValue(c[i].r,c[i].g,c[i].b);
pcShapeMaterial->diffuseColor.finishEditing();
}
else if ((int)c.size() == 1) {
else if (c.size() == 1) {
pcShapeBind->value = SoMaterialBinding::OVERALL;
pcShapeMaterial->diffuseColor.setValue(c[0].r,c[0].g,c[0].b);
}

View File

@ -137,7 +137,7 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QLabel" name="labelOffset2">
<property name="text">

View File

@ -4482,13 +4482,15 @@ namespace SketcherGui {
switch(msg){
case Sketcher::SketchObject::rlCircularReference:
this->notAllowedReason = QT_TR_NOOP("Linking this will cause circular dependency.");
break;
break;
case Sketcher::SketchObject::rlOtherDoc:
this->notAllowedReason = QT_TR_NOOP("This object is in another document.");
break;
break;
case Sketcher::SketchObject::rlOtherPart:
this->notAllowedReason = QT_TR_NOOP("This object belongs to another part or body, can't link. Hold Ctrl to allow crossreferences.");
break;
break;
default:
break;
}
return false;
}