From b9a3d9351b23b5d30a0eb37d45896eac832bb7e2 Mon Sep 17 00:00:00 2001 From: azv Date: Tue, 20 May 2014 09:17:22 +0400 Subject: [PATCH] SketchSolver: porting to Linux --- CMakeCommon/FindSolveSpace.cmake | 2 +- linux_env.sh | 4 +- src/Model/Model_Document.cpp | 6 ++- src/PartSet/PartSet_OperationSketchBase.cpp | 9 +++-- src/SketchPlugin/SketchPlugin_Feature.cpp | 44 ++++++++++----------- src/SketchPlugin/SketchPlugin_Feature.h | 3 +- src/SketchSolver/SketchSolver_Solver.h | 2 + 7 files changed, 39 insertions(+), 31 deletions(-) diff --git a/CMakeCommon/FindSolveSpace.cmake b/CMakeCommon/FindSolveSpace.cmake index b373d2c40..c8d269f52 100644 --- a/CMakeCommon/FindSolveSpace.cmake +++ b/CMakeCommon/FindSolveSpace.cmake @@ -3,4 +3,4 @@ SET(SLVS_ROOT_DIR $ENV{SOLVESPACE_ROOT_DIR}) INCLUDE_DIRECTORIES(${SLVS_ROOT_DIR}/include) LINK_DIRECTORIES(${SLVS_ROOT_DIR}/lib) -SET(SLVS_LIBRARIES ${SLVS_ROOT_DIR}/lib/slvs.lib) +#SET(SLVS_LIBRARIES ${SLVS_ROOT_DIR}/lib/slvs.lib) diff --git a/linux_env.sh b/linux_env.sh index 8fb9f33ff..4466e3355 100644 --- a/linux_env.sh +++ b/linux_env.sh @@ -27,8 +27,8 @@ export PATH=${QT4_ROOT_DIR}/bin:${PATH} export LD_LIBRARY_PATH=${QT4_ROOT_DIR}/lib:${LD_LIBRARY_PATH} ## #------ boost ------ -#export BOOST_ROOT_DIR=${PDIR}/boost-1.52.0 -#export LD_LIBRARY_PATH ${BOOST_ROOT_DIR}/lib +export BOOST_ROOT_DIR=${PDIR}/boost-1.52.0 +export LD_LIBRARY_PATH ${BOOST_ROOT_DIR}/lib ## #------ swig ------ export SWIG_ROOT_DIR=${PDIR}/swig-2.0.8 diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 619e05c01..266622522 100644 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -20,6 +20,9 @@ #include #include +#ifndef WIN32 +#include +#endif #ifdef WIN32 # define _separator_ '\\' @@ -325,7 +328,8 @@ void Model_Document::addFeature(const boost::shared_ptr theFea TDF_Label anObjLab = aGroupLab.NewChild(); TCollection_ExtendedString aName(theFeature->data()->getName().c_str()); TDataStd_Name::Set(anObjLab, aName); - AddToRefArray(aGroupLab.FindChild(1), anObjLab); // reference to names is on the first sub + TDF_Label aGrLabChild = aGroupLab.FindChild(1); + AddToRefArray(aGrLabChild, anObjLab); // reference to names is on the first sub // event: feature is added static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_CREATED); diff --git a/src/PartSet/PartSet_OperationSketchBase.cpp b/src/PartSet/PartSet_OperationSketchBase.cpp index 0dd6efc90..663c25d79 100644 --- a/src/PartSet/PartSet_OperationSketchBase.cpp +++ b/src/PartSet/PartSet_OperationSketchBase.cpp @@ -5,7 +5,7 @@ #include #include -#include +#include #include @@ -31,8 +31,8 @@ boost::shared_ptr PartSet_OperationSketchBase::preview( boost::shared_ptr aFeature = boost::dynamic_pointer_cast(theFeature); if (!aFeature) { // if it is reference to a object feature - boost::shared_ptr anObj = - boost::dynamic_pointer_cast(theFeature); + boost::shared_ptr anObj = + boost::dynamic_pointer_cast(theFeature); if (anObj) aFeature = boost::dynamic_pointer_cast(anObj->featureRef()); } @@ -48,7 +48,8 @@ std::map, boost::shared_ptr > boost::shared_ptr PartSet_OperationSketchBase::createFeature() { boost::shared_ptr aFeature = ModuleBase_Operation::createFeature(); - emit featureConstructed(aFeature, FM_Activation); + if (aFeature) + emit featureConstructed(aFeature, FM_Activation); return aFeature; } diff --git a/src/SketchPlugin/SketchPlugin_Feature.cpp b/src/SketchPlugin/SketchPlugin_Feature.cpp index e75bc01e6..5363c251a 100644 --- a/src/SketchPlugin/SketchPlugin_Feature.cpp +++ b/src/SketchPlugin/SketchPlugin_Feature.cpp @@ -9,28 +9,28 @@ SketchPlugin_Feature::SketchPlugin_Feature() mySketch = 0; } -void SketchPlugin_Feature::setData(boost::shared_ptr theData) -{ - ModelAPI_Feature::setData(theData); - - // find sketch that references to this feature - int aSketches = document()->size("Construction"); - for(int a = 0; a < aSketches && !mySketch; a++) { - boost::shared_ptr aSketch = - boost::dynamic_pointer_cast(document()->feature("Construction", a)); - if (aSketch) { - std::list > aList = - aSketch->data()->reflist(SKETCH_ATTR_FEATURES)->list(); - std::list >::iterator aSub = aList.begin(); - for(; aSub != aList.end(); aSub++) { - if ((*aSub)->data()->isEqual(theData)) { - mySketch = aSketch.get(); - break; - } - } - } - } -} +//void SketchPlugin_Feature::setData(boost::shared_ptr theData) +//{ +// ModelAPI_Feature::setData(theData); +// +// // find sketch that references to this feature +// int aSketches = document()->size("Construction"); +// for(int a = 0; a < aSketches && !mySketch; a++) { +// boost::shared_ptr aSketch = +// boost::dynamic_pointer_cast(document()->feature("Construction", a)); +// if (aSketch) { +// std::list > aList = +// aSketch->data()->reflist(SKETCH_ATTR_FEATURES)->list(); +// std::list >::iterator aSub = aList.begin(); +// for(; aSub != aList.end(); aSub++) { +// if ((*aSub)->data()->isEqual(theData)) { +// mySketch = aSketch.get(); +// break; +// } +// } +// } +// } +//} void SketchPlugin_Feature::setPreview(const boost::shared_ptr& theShape) { diff --git a/src/SketchPlugin/SketchPlugin_Feature.h b/src/SketchPlugin/SketchPlugin_Feature.h index d83e21cce..212157329 100644 --- a/src/SketchPlugin/SketchPlugin_Feature.h +++ b/src/SketchPlugin/SketchPlugin_Feature.h @@ -46,7 +46,8 @@ protected: /// initializes mySketch SketchPlugin_Feature(); /// Sets the data manager of an object and here initializes mySketch field - SKETCHPLUGIN_EXPORT virtual void setData(boost::shared_ptr theData); + SKETCHPLUGIN_EXPORT virtual void setData(boost::shared_ptr theData) + {} friend class SketchPlugin_Sketch; diff --git a/src/SketchSolver/SketchSolver_Solver.h b/src/SketchSolver/SketchSolver_Solver.h index aeb29ef5e..944a58e69 100644 --- a/src/SketchSolver/SketchSolver_Solver.h +++ b/src/SketchSolver/SketchSolver_Solver.h @@ -10,6 +10,8 @@ // Need to be defined before including SolveSpace to avoid additional dependances on Windows platform #if defined(WIN32) && !defined(HAVE_C99_INTEGER_TYPES) typedef unsigned int UINT32; +#else +#include #endif #include #include -- 2.39.2