Merge branch 'master' into bugfix/thread-milling-task-panel
This commit is contained in:
@@ -25,38 +25,37 @@
|
||||
// No CMake version info for libarea, Zipios, or KDL
|
||||
|
||||
// Coin3D
|
||||
constexpr char * FC_COIN3D_VERSION = "${COIN3D_VERSION}";
|
||||
constexpr char * fcCoin3dVersion = "${COIN3D_VERSION}";
|
||||
|
||||
// Eigen3
|
||||
constexpr char * FC_EIGEN3_VERSION = "${EIGEN3_VERSION}";
|
||||
constexpr char * fcEigen3Version = "${EIGEN3_VERSION}";
|
||||
|
||||
// FreeType
|
||||
constexpr char * FC_FREETYPE_VERSION = "${FREETYPE_VERSION_STRING}";
|
||||
constexpr char * fcFreetypeVersion = "${FREETYPE_VERSION_STRING}";
|
||||
|
||||
// pcl
|
||||
constexpr char * FC_PCL_VERSION = "${PCL_VERSION}";
|
||||
constexpr char * fcPclVersion = "${PCL_VERSION}";
|
||||
|
||||
// PyCXX
|
||||
constexpr char * FC_PYCXX_VERSION = "${PYCXX_VERSION}";
|
||||
constexpr char * fcPycxxVersion = "${PYCXX_VERSION}";
|
||||
|
||||
// PySide
|
||||
constexpr char * FC_PYSIDE_VERSION = "${PySide2_VERSION}";
|
||||
constexpr char * fcPysideVersion = "${PySide2_VERSION}";
|
||||
|
||||
// PyBind
|
||||
constexpr char * FC_PYBIND11_VERSION = "${pybind11_VERSION}";
|
||||
constexpr char * fcPybind11Version = "${pybind11_VERSION}";
|
||||
|
||||
// Shiboken
|
||||
constexpr char * FC_SHIBOKEN_VERSION = "${Shiboken2_VERSION}";
|
||||
constexpr char * fcShibokenVersion = "${Shiboken2_VERSION}";
|
||||
|
||||
// vtk
|
||||
constexpr char * FC_VTK_VERSION = "${VTK_VERSION}";
|
||||
constexpr char * fcVtkVersion = "${VTK_VERSION}";
|
||||
|
||||
// Xerces-C
|
||||
constexpr char * FC_XERCESC_VERSION = "${XercesC_VERSION}";
|
||||
constexpr char * fcXercescVersion = "${XercesC_VERSION}";
|
||||
|
||||
// Pivy
|
||||
constexpr char * FC_PIVY_VERSION = "${PIVY_VERSION}";
|
||||
constexpr char * fcPivyVersion = "${PIVY_VERSION}";
|
||||
|
||||
|
||||
#endif // LIBRARY_VERSIONS_H
|
||||
|
||||
|
||||
@@ -3,11 +3,6 @@
|
||||
# PYSIDE_RCC_EXECUTABLE - Location of PYSIDE2RCC executable
|
||||
# PYSIDE_TOOLS_FOUND - PySide2 utilities found.
|
||||
|
||||
IF(PYSIDE2_UIC_EXECUTABLE AND PYSIDE2_RCC_EXECUTABLE)
|
||||
# Already in cache, be silent
|
||||
set(PYSIDE2_TOOLS_FOUND_QUIETLY TRUE)
|
||||
ENDIF()
|
||||
|
||||
if(WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
#pyside2 tools are often in same location as python interpreter
|
||||
get_filename_component(PYTHON_BIN_DIR ${PYTHON_EXECUTABLE} PATH)
|
||||
|
||||
@@ -3,11 +3,6 @@
|
||||
# PYSIDE_RCC_EXECUTABLE - Location of PYSIDE6RCC executable
|
||||
# PYSIDE_TOOLS_FOUND - PYSIDE6 utilities found.
|
||||
|
||||
IF(PYSIDE6_UIC_EXECUTABLE AND PYSIDE6_RCC_EXECUTABLE)
|
||||
# Already in cache, be silent
|
||||
set(PYSIDE_TOOLS_FOUND_QUIETLY TRUE)
|
||||
ENDIF()
|
||||
|
||||
if (TARGET Qt6::uic)
|
||||
get_target_property(PYSIDE6_UIC_EXECUTABLE Qt6::uic LOCATION)
|
||||
set(UICOPTIONS "--generator=python")
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
macro(PrintFinalReport)
|
||||
# -------------------------------- The final report ----------------------------------
|
||||
|
||||
message(STATUS "\n==============\n"
|
||||
"Summary report\n"
|
||||
"==============\n")
|
||||
@@ -15,17 +13,17 @@ macro(PrintFinalReport)
|
||||
# Qt5 needs/sets PYTHON_CONFIG_SUFFIX regarding Shiboken
|
||||
message(STATUS "Python: ${PYTHON_VERSION_STRING} [${PYTHON_EXECUTABLE}] [${PYTHON_CONFIG_SUFFIX}]")
|
||||
|
||||
if(DEFINED PCL_FOUND)
|
||||
if(PCL_FOUND)
|
||||
message(STATUS "PCL: ${PCL_VERSION}")
|
||||
else(DEFINED PCL_FOUND)
|
||||
else()
|
||||
message(STATUS "PCL: not enabled")
|
||||
endif(DEFINED PCL_FOUND)
|
||||
endif()
|
||||
|
||||
if(DEFINED pybind11_FOUND)
|
||||
if(pybind11_FOUND)
|
||||
message(STATUS "pybind11: ${pybind11_VERSION}")
|
||||
else(DEFINED pybind11_FOUND)
|
||||
else()
|
||||
message(STATUS "pybind11: not enabled")
|
||||
endif(DEFINED pybind11_FOUND)
|
||||
endif()
|
||||
|
||||
message(STATUS "Boost: ${Boost_VERSION}")
|
||||
|
||||
@@ -40,35 +38,35 @@ macro(PrintFinalReport)
|
||||
if(BUILD_SMESH)
|
||||
if(FREECAD_USE_EXTERNAL_SMESH)
|
||||
message(STATUS "SMESH: ${SMESH_VERSION_MAJOR}.${SMESH_VERSION_MINOR}.${SMESH_VERSION_PATCH}.${SMESH_VERSION_TWEAK}")
|
||||
else(FREECAD_USE_EXTERNAL_SMESH)
|
||||
else()
|
||||
message(STATUS "SMESH: ${SMESH_VERSION_MAJOR}.${SMESH_VERSION_MINOR}.${SMESH_VERSION_PATCH}.${SMESH_VERSION_TWEAK} build internal")
|
||||
message(STATUS "MEDFile: ${MEDFILE_VERSION} [${MEDFILE_LIBRARIES}] [${MEDFILE_INCLUDE_DIRS}]")
|
||||
message(STATUS "HDF5: ${HDF5_VERSION}")
|
||||
message(STATUS "VTK: ${VTK_VERSION}")
|
||||
endif(FREECAD_USE_EXTERNAL_SMESH)
|
||||
else(BUILD_SMESH)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "SMESH: do not build")
|
||||
endif(BUILD_SMESH)
|
||||
endif()
|
||||
|
||||
if(DEFINED NETGEN_FOUND)
|
||||
if(NETGEN_FOUND)
|
||||
message(STATUS "NETGEN: ${NETGEN_VERSION_MAJOR}.${NETGEN_VERSION_MINOR}.${NETGEN_VERSION_PATCH} (${NETGEN_VERSION}) [${NETGEN_DEFINITIONS}] [${NETGEN_CXX_FLAGS}] [${NGLIB_INCLUDE_DIR}] [${NGLIB_LIBRARIES}] [${NETGEN_INCLUDE_DIRS}]")
|
||||
else(DEFINED NETGEN_FOUND)
|
||||
else()
|
||||
message(STATUS "NETGEN: not enabled")
|
||||
endif(DEFINED NETGEN_FOUND)
|
||||
endif()
|
||||
|
||||
#message(STATUS "OpenCV: ${OpenCV_VERSION}")
|
||||
|
||||
if(DEFINED SWIG_FOUND)
|
||||
if(SWIG_FOUND)
|
||||
message(STATUS "SWIG: ${SWIG_VERSION}")
|
||||
else(DEFINED SWIG_FOUND)
|
||||
else()
|
||||
message(STATUS "SWIG: not found")
|
||||
endif(DEFINED SWIG_FOUND)
|
||||
endif()
|
||||
|
||||
if(DEFINED EIGEN3_FOUND)
|
||||
if(EIGEN3_FOUND)
|
||||
message(STATUS "Eigen3 ${EIGEN3_VERSION}")
|
||||
else(DEFINED EIGEN3_FOUND)
|
||||
else()
|
||||
message(STATUS "Eigen3: not found")
|
||||
endif(DEFINED EIGEN3_FOUND)
|
||||
endif()
|
||||
|
||||
message(STATUS "QtCore: ${QtCore_VERSION}")
|
||||
message(STATUS "QtNetwork: ${QtNetwork_VERSION}")
|
||||
@@ -102,27 +100,27 @@ macro(PrintFinalReport)
|
||||
endif()
|
||||
|
||||
if(DEFINED MACPORTS_PREFIX)
|
||||
if(DEFINED Shiboken_FOUND)
|
||||
if(Shiboken_FOUND)
|
||||
message(STATUS "Shiboken: ${Shiboken_VERSION} [${SHIBOKEN_INCLUDE_DIR}]")
|
||||
else(DEFINED Shiboken_FOUND)
|
||||
else()
|
||||
message(STATUS "Shiboken: not found (only searched if MACPORTS_PREFIX is defined)")
|
||||
endif(DEFINED Shiboken_FOUND)
|
||||
if(DEFINED PySide_FOUND)
|
||||
endif()
|
||||
if(PySide_FOUND)
|
||||
message(STATUS "PySide: ${PySide_VERSION} [${PYSIDE_INCLUDE_DIR}]")
|
||||
if(NOT PYSIDE_INCLUDE_DIR)
|
||||
message(STATUS " IncludeDir: Unable to find, python version mismatch?")
|
||||
endif(NOT PYSIDE_INCLUDE_DIR)
|
||||
else(DEFINED PySide_FOUND)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "PySide: not found (only searched if MACPORTS_PREFIX is defined)")
|
||||
endif(DEFINED PySide_FOUND)
|
||||
endif(DEFINED MACPORTS_PREFIX)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(DEFINED Shiboken${SHIBOKEN_MAJOR_VERSION}_FOUND)
|
||||
if(Shiboken${SHIBOKEN_MAJOR_VERSION}_FOUND)
|
||||
message(STATUS "Shiboken: ${Shiboken_VERSION} [${Shiboken${SHIBOKEN_MAJOR_VERSION}_DIR}] [${SHIBOKEN_INCLUDE_DIR}]")
|
||||
else()
|
||||
message(STATUS "Shiboken: not found")
|
||||
endif()
|
||||
if(DEFINED PySide${SHIBOKEN_MAJOR_VERSION}_FOUND)
|
||||
if(PySide${SHIBOKEN_MAJOR_VERSION}_FOUND)
|
||||
message(STATUS "PySide: ${PySide_VERSION} [${PYSIDE_INCLUDE_DIR}]")
|
||||
if(NOT PYSIDE_INCLUDE_DIR)
|
||||
message(STATUS " IncludeDir: Unable to find, python version mismatch?")
|
||||
@@ -130,21 +128,21 @@ macro(PrintFinalReport)
|
||||
else()
|
||||
message(STATUS "PySide: not found")
|
||||
endif()
|
||||
if(DEFINED PYSIDE_TOOLS_FOUND)
|
||||
if(PYSIDE_TOOLS_FOUND)
|
||||
message(STATUS "PySideTools: [${PYSIDE_UIC_EXECUTABLE}] [${PYSIDE_RCC_EXECUTABLE}]")
|
||||
else()
|
||||
message(STATUS "PySideTools: not found")
|
||||
endif()
|
||||
|
||||
if(FREECAD_USE_FREETYPE)
|
||||
if(DEFINED FREETYPE_FOUND)
|
||||
if(FREETYPE_FOUND)
|
||||
message(STATUS "Freetype: ${FREETYPE_VERSION_STRING}")
|
||||
else(DEFINED FREETYPE_FOUND)
|
||||
else()
|
||||
message(STATUS "Freetype: not found")
|
||||
endif(DEFINED FREETYPE_FOUND)
|
||||
else(FREECAD_USE_FREETYPE)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Freetype: disabled")
|
||||
endif(FREECAD_USE_FREETYPE)
|
||||
endif()
|
||||
|
||||
message(STATUS "OpenGL: ${OPENGL_gl_LIBRARY}")
|
||||
message(STATUS "OpenGLU: [${OPENGL_glu_LIBRARY}][${OPENGL_INCLUDE_DIR}]")
|
||||
@@ -155,41 +153,41 @@ macro(PrintFinalReport)
|
||||
|
||||
if (WIN32)
|
||||
#message(STATUS "SPNAV: not available yet for your OS") # FREECAD_USE_3DCONNEXION instead...
|
||||
else(WIN32)
|
||||
if(DEFINED SPNAV_FOUND)
|
||||
else()
|
||||
if(SPNAV_FOUND)
|
||||
message(STATUS "SPNAV: [${SPNAV_LIBRARY}] [${SPNAV_INCLUDE_DIR}]")
|
||||
else(DEFINED SPNAV_FOUND)
|
||||
else()
|
||||
message(STATUS "SPNAV: not found")
|
||||
endif(DEFINED SPNAV_FOUND)
|
||||
endif(WIN32)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MATPLOTLIB_FOUND)
|
||||
message(STATUS "Matplotlib: ${MATPLOTLIB_VERSION}")
|
||||
else(MATPLOTLIB_FOUND)
|
||||
else()
|
||||
message(STATUS "Matplotlib: not found")
|
||||
endif(MATPLOTLIB_FOUND)
|
||||
endif()
|
||||
|
||||
if(BUILD_VR)
|
||||
if(DEFINED RIFT_FOUND)
|
||||
if(RIFT_FOUND)
|
||||
message(STATUS "Rift: ${Rift_VERSION}")
|
||||
else(DEFINED RIFT_FOUND)
|
||||
else()
|
||||
message(STATUS "Rift: not found")
|
||||
endif(DEFINED RIFT_FOUND)
|
||||
else(BUILD_VR)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Rift: not enabled (BUILD_VR)")
|
||||
endif(BUILD_VR)
|
||||
endif()
|
||||
|
||||
if(DOXYGEN_FOUND)
|
||||
message(STATUS "Doxygen: ${DOXYGEN_VERSION}")
|
||||
message(STATUS "Language: ${DOXYGEN_LANGUAGE}")
|
||||
if(COIN3D_DOC_FOUND)
|
||||
message(STATUS "Coin3D_DOC: found [${COIN3D_DOC_PATH}]")
|
||||
else(COIN3D_DOC_FOUND)
|
||||
else()
|
||||
message(STATUS "Coin3D_DOC: not found")
|
||||
endif(COIN3D_DOC_FOUND)
|
||||
else(DOXYGEN_FOUND)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "Doxygen: not found")
|
||||
endif(DOXYGEN_FOUND)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
# Copy libpack dependency directories to build folder for user as part of overall build process
|
||||
@@ -210,7 +208,7 @@ macro(PrintFinalReport)
|
||||
file(COPY ${FREECAD_LIBPACK_DIR}/resources DESTINATION ${CMAKE_BINARY_DIR})
|
||||
file(COPY ${FREECAD_LIBPACK_DIR}/translations/qtwebengine_locales DESTINATION ${CMAKE_BINARY_DIR}/translations)
|
||||
message(STATUS "... end copying.\n=======================================\n")
|
||||
endif(FREECAD_COPY_DEPEND_DIRS_TO_BUILD)
|
||||
endif()
|
||||
|
||||
if(COPY_LIBPACK_BIN_TO_BUILD)
|
||||
if(FREECAD_COPY_LIBPACK_BIN_TO_BUILD)
|
||||
@@ -246,12 +244,12 @@ macro(PrintFinalReport)
|
||||
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/resources DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
install(DIRECTORY ${FREECAD_LIBPACK_DIR}/bin DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
message(STATUS "Created install commands for INSTALL target.\n")
|
||||
endif(FREECAD_INSTALL_DEPEND_DIRS)
|
||||
endif(FREECAD_LIBPACK_USE AND LIBPACK_FOUND)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Print message to start build process
|
||||
message("=================================================\n"
|
||||
"Now run 'cmake --build ${CMAKE_BINARY_DIR}' to build ${PROJECT_NAME}\n"
|
||||
"=================================================\n")
|
||||
endmacro(PrintFinalReport)
|
||||
endmacro()
|
||||
|
||||
@@ -2313,20 +2313,20 @@ void processProgramOptions(const variables_map& vm, std::map<std::string,std::st
|
||||
if (vm.count("verbose")) {
|
||||
str << "\nLibrary versions:\n";
|
||||
str << "boost " << BOOST_LIB_VERSION << '\n';
|
||||
str << "Coin3D " << FC_COIN3D_VERSION << '\n';
|
||||
str << "Eigen3 " << FC_EIGEN3_VERSION << '\n';
|
||||
str << "Coin3D " << fcCoin3dVersion << '\n';
|
||||
str << "Eigen3 " << fcEigen3Version << '\n';
|
||||
#ifdef OCC_VERSION_STRING_EXT
|
||||
str << "OCC " << OCC_VERSION_STRING_EXT << '\n';
|
||||
#endif
|
||||
str << "Qt " << QT_VERSION_STR << '\n';
|
||||
str << "Python " << PY_VERSION << '\n';
|
||||
str << "PySide " << FC_PYSIDE_VERSION << '\n';
|
||||
str << "shiboken " << FC_SHIBOKEN_VERSION << '\n';
|
||||
str << "PySide " << fcPysideVersion << '\n';
|
||||
str << "shiboken " << fcShibokenVersion << '\n';
|
||||
#ifdef SMESH_VERSION_STR
|
||||
str << "SMESH " << SMESH_VERSION_STR << '\n';
|
||||
#endif
|
||||
str << "VTK " << FC_VTK_VERSION << '\n';
|
||||
str << "xerces-c " << FC_XERCESC_VERSION << '\n';
|
||||
str << "VTK " << fcVtkVersion << '\n';
|
||||
str << "xerces-c " << fcXercescVersion << '\n';
|
||||
}
|
||||
throw Base::ProgramInformation(str.str());
|
||||
}
|
||||
@@ -2627,12 +2627,12 @@ void Application::initConfig(int argc, char ** argv)
|
||||
mConfig["BOOST_VERSION"] = BOOST_LIB_VERSION;
|
||||
mConfig["PYTHON_VERSION"] = PY_VERSION;
|
||||
mConfig["QT_VERSION"] = QT_VERSION_STR;
|
||||
mConfig["EIGEN_VERSION"] = FC_EIGEN3_VERSION;
|
||||
mConfig["PYSIDE_VERSION"] = FC_PYSIDE_VERSION;
|
||||
mConfig["EIGEN_VERSION"] = fcEigen3Version;
|
||||
mConfig["PYSIDE_VERSION"] = fcPysideVersion;
|
||||
#ifdef SMESH_VERSION_STR
|
||||
mConfig["SMESH_VERSION"] = SMESH_VERSION_STR;
|
||||
#endif
|
||||
mConfig["XERCESC_VERSION"] = FC_XERCESC_VERSION;
|
||||
mConfig["XERCESC_VERSION"] = fcXercescVersion;
|
||||
|
||||
|
||||
logStatus();
|
||||
|
||||
@@ -87,9 +87,9 @@ const char* UnitsApi::getDescription(UnitSystem system)
|
||||
}
|
||||
}
|
||||
|
||||
UnitsSchemaPtr UnitsApi::createSchema(UnitSystem s)
|
||||
UnitsSchemaPtr UnitsApi::createSchema(UnitSystem system)
|
||||
{
|
||||
switch (s) {
|
||||
switch (system) {
|
||||
case UnitSystem::SI1:
|
||||
return std::make_unique<UnitsSchemaInternal>();
|
||||
case UnitSystem::SI2:
|
||||
@@ -115,14 +115,14 @@ UnitsSchemaPtr UnitsApi::createSchema(UnitSystem s)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void UnitsApi::setSchema(UnitSystem s)
|
||||
void UnitsApi::setSchema(UnitSystem system)
|
||||
{
|
||||
if (UserPrefSystem) {
|
||||
UserPrefSystem->resetSchemaUnits(); // for schemas changed the Quantity constants
|
||||
}
|
||||
|
||||
UserPrefSystem = createSchema(s);
|
||||
currentSystem = s;
|
||||
UserPrefSystem = createSchema(system);
|
||||
currentSystem = system;
|
||||
|
||||
// for wrong value fall back to standard schema
|
||||
if (!UserPrefSystem) {
|
||||
@@ -133,21 +133,21 @@ void UnitsApi::setSchema(UnitSystem s)
|
||||
UserPrefSystem->setSchemaUnits(); // if necessary a unit schema can change the constants in Quantity (e.g. mi=1.8km rather then 1.6km).
|
||||
}
|
||||
|
||||
QString UnitsApi::toString(const Base::Quantity& q, const QuantityFormat& f)
|
||||
QString UnitsApi::toString(const Base::Quantity& quantity, const QuantityFormat& format)
|
||||
{
|
||||
QString value = QString::fromLatin1("'%1 %2'").arg(q.getValue(), 0, f.toFormat(), f.precision)
|
||||
.arg(q.getUnit().getString());
|
||||
QString value = QString::fromLatin1("'%1 %2'").arg(quantity.getValue(), 0, format.toFormat(), format.precision)
|
||||
.arg(quantity.getUnit().getString());
|
||||
return value;
|
||||
}
|
||||
|
||||
QString UnitsApi::toNumber(const Base::Quantity& q, const QuantityFormat& f)
|
||||
QString UnitsApi::toNumber(const Base::Quantity& quantity, const QuantityFormat& format)
|
||||
{
|
||||
return toNumber(q.getValue(), f);
|
||||
return toNumber(quantity.getValue(), format);
|
||||
}
|
||||
|
||||
QString UnitsApi::toNumber(double d, const QuantityFormat& f)
|
||||
QString UnitsApi::toNumber(double value, const QuantityFormat& format)
|
||||
{
|
||||
QString number = QString::fromLatin1("%1").arg(d, 0, f.toFormat(), f.precision);
|
||||
QString number = QString::fromLatin1("%1").arg(value, 0, format.toFormat(), format.precision);
|
||||
return number;
|
||||
}
|
||||
|
||||
@@ -163,6 +163,11 @@ bool UnitsApi::isMultiUnitAngle()
|
||||
return UserPrefSystem->isMultiUnitAngle();
|
||||
}
|
||||
|
||||
std::string UnitsApi::getBasicLengthUnit()
|
||||
{
|
||||
return UserPrefSystem->getBasicLengthUnit();
|
||||
}
|
||||
|
||||
// === static translation methods ==========================================
|
||||
|
||||
QString UnitsApi::schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString)
|
||||
|
||||
@@ -98,6 +98,9 @@ public:
|
||||
//return true if the current user schema uses multiple units for angles (ex. DMS)
|
||||
static bool isMultiUnitAngle();
|
||||
|
||||
//return the basic unit of measure for length in the current user schema.
|
||||
static std::string getBasicLengthUnit();
|
||||
|
||||
// Python interface
|
||||
static PyMethodDef Methods[];
|
||||
|
||||
|
||||
@@ -71,6 +71,9 @@ public:
|
||||
|
||||
//return true if this schema uses multiple units for angles (ex. DMS)
|
||||
virtual bool isMultiUnitAngle() const {return false;}
|
||||
|
||||
//return the basic length unit for this schema
|
||||
virtual std::string getBasicLengthUnit() const { return std::string("mm"); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -37,6 +37,8 @@ class UnitsSchemaCentimeters: public UnitsSchema
|
||||
{
|
||||
public:
|
||||
QString schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString) override;
|
||||
|
||||
std::string getBasicLengthUnit() const override { return std::string("cm"); }
|
||||
};
|
||||
|
||||
} // namespace Base
|
||||
|
||||
@@ -41,6 +41,7 @@ public:
|
||||
//virtual void setSchemaUnits(void);
|
||||
//virtual void resetSchemaUnits(void);
|
||||
QString schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString) override;
|
||||
std::string getBasicLengthUnit() const override { return std::string("in"); }
|
||||
};
|
||||
|
||||
/** The schema class for the imperial unit system
|
||||
@@ -53,6 +54,7 @@ public:
|
||||
//virtual void setSchemaUnits(void);
|
||||
//virtual void resetSchemaUnits(void);
|
||||
QString schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString) override;
|
||||
std::string getBasicLengthUnit() const override { return std::string("in"); }
|
||||
};
|
||||
|
||||
/** The schema class for the imperial unit system
|
||||
@@ -65,6 +67,7 @@ public:
|
||||
//virtual void setSchemaUnits(void);
|
||||
//virtual void resetSchemaUnits(void);
|
||||
QString schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString) override;
|
||||
std::string getBasicLengthUnit() const override { return std::string("ft"); }
|
||||
|
||||
//return true if this schema uses multiple units for length (ex. Ft/In)
|
||||
bool isMultiUnitLength() const override {return true;}
|
||||
@@ -81,6 +84,7 @@ public:
|
||||
//virtual void setSchemaUnits(void);
|
||||
//virtual void resetSchemaUnits(void);
|
||||
QString schemaTranslate(const Base::Quantity& quant, double &factor, QString &unitString) override;
|
||||
std::string getBasicLengthUnit() const override { return std::string("ft"); }
|
||||
|
||||
//return true if this schema uses multiple units for angles (ex. DMS)
|
||||
bool isMultiUnitAngle() const override {return true;}
|
||||
|
||||
@@ -535,7 +535,7 @@ void AboutDialog::showLibraryInformation()
|
||||
QLatin1String("Eigen"),
|
||||
baseurl + QLatin1String("#_TocEigen"),
|
||||
QLatin1String("https://eigen.tuxfamily.org"),
|
||||
QString::fromLatin1(FC_EIGEN3_VERSION)
|
||||
QString::fromLatin1(fcEigen3Version)
|
||||
};
|
||||
|
||||
// FreeType
|
||||
@@ -543,7 +543,7 @@ void AboutDialog::showLibraryInformation()
|
||||
QLatin1String("FreeType"),
|
||||
baseurl + QLatin1String("#_TocFreeType"),
|
||||
QLatin1String("https://freetype.org"),
|
||||
QString::fromLatin1(FC_FREETYPE_VERSION)
|
||||
QString::fromLatin1(fcFreetypeVersion)
|
||||
};
|
||||
|
||||
// KDL
|
||||
@@ -577,7 +577,7 @@ void AboutDialog::showLibraryInformation()
|
||||
QLatin1String("Point Cloud Library"),
|
||||
baseurl + QLatin1String("#_TocPcl"),
|
||||
QLatin1String("https://www.pointclouds.org"),
|
||||
QString::fromLatin1(FC_PCL_VERSION)
|
||||
QString::fromLatin1(fcPclVersion)
|
||||
};
|
||||
|
||||
// PyCXX
|
||||
@@ -585,7 +585,7 @@ void AboutDialog::showLibraryInformation()
|
||||
QLatin1String("PyCXX"),
|
||||
baseurl + QLatin1String("#_TocPyCXX"),
|
||||
QLatin1String("http://cxx.sourceforge.net"),
|
||||
QString::fromLatin1(FC_PYCXX_VERSION)
|
||||
QString::fromLatin1(fcPycxxVersion)
|
||||
};
|
||||
|
||||
// Python
|
||||
@@ -601,7 +601,7 @@ void AboutDialog::showLibraryInformation()
|
||||
QLatin1String("Qt for Python (PySide)"),
|
||||
baseurl + QLatin1String("#_TocPySide"),
|
||||
QLatin1String("https://wiki.qt.io/Qt_for_Python"),
|
||||
QString::fromLatin1(FC_PYSIDE_VERSION)
|
||||
QString::fromLatin1(fcPysideVersion)
|
||||
};
|
||||
|
||||
// Qt
|
||||
@@ -629,7 +629,7 @@ void AboutDialog::showLibraryInformation()
|
||||
QLatin1String("Qt for Python (Shiboken)"),
|
||||
baseurl + QLatin1String("#_TocPySide"),
|
||||
QLatin1String("https://wiki.qt.io/Qt_for_Python"),
|
||||
QString::fromLatin1(FC_SHIBOKEN_VERSION)
|
||||
QString::fromLatin1(fcShibokenVersion)
|
||||
};
|
||||
|
||||
// vtk
|
||||
@@ -637,7 +637,7 @@ void AboutDialog::showLibraryInformation()
|
||||
QLatin1String("vtk"),
|
||||
baseurl + QLatin1String("#_TocVtk"),
|
||||
QLatin1String("https://www.vtk.org"),
|
||||
QString::fromLatin1(FC_VTK_VERSION)
|
||||
QString::fromLatin1(fcVtkVersion)
|
||||
};
|
||||
|
||||
// Xerces-C
|
||||
@@ -645,7 +645,7 @@ void AboutDialog::showLibraryInformation()
|
||||
QLatin1String("Xerces-C"),
|
||||
baseurl + QLatin1String("#_TocXercesC"),
|
||||
QLatin1String("https://xerces.apache.org/xerces-c"),
|
||||
QString::fromLatin1(FC_XERCESC_VERSION)
|
||||
QString::fromLatin1(fcXercescVersion)
|
||||
};
|
||||
|
||||
// Zipios++
|
||||
@@ -769,7 +769,7 @@ void AboutDialog::on_copyButton_clicked()
|
||||
str << "Python " << PY_VERSION << ", ";
|
||||
str << "Qt " << QT_VERSION_STR << ", ";
|
||||
str << "Coin " << COIN_VERSION << ", ";
|
||||
str << "Vtk " << FC_VTK_VERSION << ", ";
|
||||
str << "Vtk " << fcVtkVersion << ", ";
|
||||
#if defined(HAVE_OCC_VERSION)
|
||||
str << "OCC "
|
||||
<< OCC_VERSION_MAJOR << "."
|
||||
|
||||
@@ -1143,7 +1143,7 @@ PyObject* TopoShapePy::generalFuse(PyObject *args)
|
||||
TopoDS_Shape gfaResultShape = this->getTopoShapePtr()->generalFuse(shapeVec,tolerance,&map);
|
||||
Py::Object shapePy = shape2pyshape(gfaResultShape);
|
||||
Py::List mapPy;
|
||||
for(TopTools_ListOfShape &shapes: map){
|
||||
for(TopTools_ListOfShape &shapes : map) {
|
||||
Py::List shapesPy;
|
||||
for(TopTools_ListIteratorOfListOfShape it(shapes); it.More(); it.Next()){
|
||||
shapesPy.append(shape2pyshape(it.Value()));
|
||||
@@ -1247,7 +1247,7 @@ PyObject* TopoShapePy::childShapes(PyObject *args)
|
||||
|
||||
namespace Part {
|
||||
// Containers to associate TopAbs_ShapeEnum values to each TopoShape*Py class
|
||||
const std::vector<std::pair<PyTypeObject*, TopAbs_ShapeEnum>> vecTypeShape = {
|
||||
static const std::vector<std::pair<PyTypeObject*, TopAbs_ShapeEnum>> vecTypeShape = {
|
||||
{&TopoShapeCompoundPy::Type, TopAbs_COMPOUND},
|
||||
{&TopoShapeCompSolidPy::Type, TopAbs_COMPSOLID},
|
||||
{&TopoShapeSolidPy::Type, TopAbs_SOLID},
|
||||
@@ -1259,7 +1259,7 @@ const std::vector<std::pair<PyTypeObject*, TopAbs_ShapeEnum>> vecTypeShape = {
|
||||
{&TopoShapePy::Type, TopAbs_SHAPE}
|
||||
};
|
||||
|
||||
const std::map<PyTypeObject*, TopAbs_ShapeEnum> mapTypeShape(
|
||||
static const std::map<PyTypeObject*, TopAbs_ShapeEnum> mapTypeShape(
|
||||
vecTypeShape.begin(), vecTypeShape.end());
|
||||
|
||||
// Returns shape type of a Python type. Similar to TopAbs::ShapeTypeFromString.
|
||||
@@ -1271,7 +1271,7 @@ static TopAbs_ShapeEnum ShapeTypeFromPyType(PyTypeObject* pyType)
|
||||
return it->second;
|
||||
}
|
||||
return TopAbs_SHAPE;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
PyObject* TopoShapePy::ancestorsOfType(PyObject *args)
|
||||
@@ -2494,55 +2494,13 @@ PyObject* TopoShapePy::proximity(PyObject *args)
|
||||
BRepExtrema_ShapeProximity proximity;
|
||||
proximity.LoadShape1 (s1);
|
||||
proximity.LoadShape2 (s2);
|
||||
if (tol > 0.0)
|
||||
if (tol > 0.0) {
|
||||
proximity.SetTolerance (tol);
|
||||
}
|
||||
|
||||
proximity.Perform();
|
||||
if (!proximity.IsDone()) {
|
||||
// the proximity failed, maybe it's because the shapes are not yet mesh
|
||||
TopLoc_Location aLoc;
|
||||
TopExp_Explorer xp(s1, TopAbs_FACE);
|
||||
while (xp.More()) {
|
||||
const Handle(Poly_Triangulation)& aTriangulation =
|
||||
BRep_Tool::Triangulation(TopoDS::Face(xp.Current()), aLoc);
|
||||
if (aTriangulation.IsNull()) {
|
||||
PyErr_SetString(PartExceptionOCCError, "BRepExtrema_ShapeProximity not done, call 'tessellate' beforehand");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
xp.Init(s2, TopAbs_FACE);
|
||||
while (xp.More()) {
|
||||
const Handle(Poly_Triangulation)& aTriangulation =
|
||||
BRep_Tool::Triangulation(TopoDS::Face(xp.Current()), aLoc);
|
||||
if (aTriangulation.IsNull()) {
|
||||
PyErr_SetString(PartExceptionOCCError, "BRepExtrema_ShapeProximity not done, call 'tessellate' beforehand");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// check also for free edges
|
||||
xp.Init(s1, TopAbs_EDGE, TopAbs_FACE);
|
||||
while (xp.More()) {
|
||||
const Handle(Poly_Polygon3D)& aPoly3D =
|
||||
BRep_Tool::Polygon3D(TopoDS::Edge(xp.Current()), aLoc);
|
||||
if (aPoly3D.IsNull()) {
|
||||
PyErr_SetString(PartExceptionOCCError, "BRepExtrema_ShapeProximity not done, call 'tessellate' beforehand");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
xp.Init(s2, TopAbs_EDGE, TopAbs_FACE);
|
||||
while (xp.More()) {
|
||||
const Handle(Poly_Polygon3D)& aPoly3D =
|
||||
BRep_Tool::Polygon3D(TopoDS::Edge(xp.Current()), aLoc);
|
||||
if (aPoly3D.IsNull()) {
|
||||
PyErr_SetString(PartExceptionOCCError, "BRepExtrema_ShapeProximity not done, call 'tessellate' beforehand");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// another problem must have occurred
|
||||
PyErr_SetString(PartExceptionOCCError, "BRepExtrema_ShapeProximity not done");
|
||||
PyErr_SetString(PartExceptionOCCError, "BRepExtrema_ShapeProximity failed, make sure the shapes are tessellated");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -729,7 +729,7 @@ double BSpline::getLinCombFactor(double x, size_t k, size_t i)
|
||||
|
||||
std::vector d(degree + 1, 0.0);
|
||||
// Ensure this is within range
|
||||
int idxOfPole = i + degree - k;
|
||||
int idxOfPole = static_cast<int>(i) + degree - static_cast<int>(k);
|
||||
if (idxOfPole < 0 || idxOfPole > degree)
|
||||
return 0.0;
|
||||
d[idxOfPole] = 1.0;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2022 Abdullah Tahiri <abdullah.tahiri.yo@gmail.com> *
|
||||
* *
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2011 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2011 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (c) 2014 Abdullah Tahiri <abdullah.tahiri.yo@gmail.com> *
|
||||
* *
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright (c) 2011 Werner Mayer <wmayer[at]users.sourceforge.net> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
|
||||
@@ -57,6 +57,8 @@
|
||||
|
||||
#include <Gui/Command.h>
|
||||
|
||||
#include <QWidgetAction> //to be put in _PreComp_ once grid PR merge.
|
||||
|
||||
using namespace SketcherGui;
|
||||
using namespace Gui::TaskView;
|
||||
|
||||
@@ -371,7 +373,7 @@ ElementItem* ElementView::itemFromIndex(const QModelIndex& index) {
|
||||
return static_cast<ElementItem*>(QListWidget::itemFromIndex(index));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/* ElementItem delegate ---------------------------------------------------- */
|
||||
|
||||
ElementItemDelegate::ElementItemDelegate(ElementView* parent) : QStyledItemDelegate(parent)
|
||||
{ // This class relies on the parent being an ElementView, see getElementtItem
|
||||
@@ -486,7 +488,44 @@ ElementItem* ElementItemDelegate::getElementtItem(const QModelIndex& index) cons
|
||||
ElementView* elementView = static_cast<ElementView*>(parent());
|
||||
return elementView->itemFromIndex(index);
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
/* Filter element list widget ------------------------------------------------------ */
|
||||
ElementFilterList::ElementFilterList(QWidget* parent) : QListWidget(parent)
|
||||
{
|
||||
for (auto const &filterItem:filterItems) {
|
||||
Q_UNUSED(filterItem);
|
||||
auto it = new QListWidgetItem();
|
||||
it->setFlags(it->flags() | Qt::ItemIsUserCheckable);
|
||||
it->setCheckState(Qt::Checked);
|
||||
addItem(it);
|
||||
}
|
||||
languageChange();
|
||||
}
|
||||
|
||||
ElementFilterList::~ElementFilterList()
|
||||
{
|
||||
}
|
||||
|
||||
void ElementFilterList::changeEvent(QEvent* e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
languageChange();
|
||||
}
|
||||
QWidget::changeEvent(e);
|
||||
}
|
||||
|
||||
void ElementFilterList::languageChange()
|
||||
{
|
||||
assert(static_cast<int>(filterItems.size()) == count());
|
||||
int i=0;
|
||||
for (auto const &filterItem:filterItems) {
|
||||
auto text = QStringLiteral(" ").repeated(filterItem.second-1) +
|
||||
(filterItem.second > 0 ? QStringLiteral("- ") : QStringLiteral()) +
|
||||
tr(filterItem.first);
|
||||
item(i++)->setText(text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* TRANSLATOR SketcherGui::TaskSketcherElements */
|
||||
|
||||
@@ -499,7 +538,6 @@ TaskSketcherElements::TaskSketcherElements(ViewProviderSketch *sketchView)
|
||||
, previouslyHoveredItemIndex(-1)
|
||||
, previouslyHoveredType(SubElementType::none)
|
||||
, isNamingBoxChecked(false)
|
||||
, collapseFilter(true)
|
||||
{
|
||||
// we need a separate container widget to add all controls to
|
||||
proxy = new QWidget(this);
|
||||
@@ -518,6 +556,7 @@ TaskSketcherElements::TaskSketcherElements(ViewProviderSketch *sketchView)
|
||||
ui->listWidgetElements->setEditTriggers(QListWidget::NoEditTriggers);
|
||||
ui->listWidgetElements->setMouseTracking(true);
|
||||
|
||||
createFilterButtonActions();
|
||||
createSettingsButtonActions();
|
||||
|
||||
connectSignals();
|
||||
@@ -526,23 +565,6 @@ TaskSketcherElements::TaskSketcherElements(ViewProviderSketch *sketchView)
|
||||
|
||||
|
||||
slotElementsChanged();
|
||||
|
||||
// make filter items checkable
|
||||
{
|
||||
QSignalBlocker sigblk(ui->listMultiFilter);
|
||||
for (int i = 0; i < ui->listMultiFilter->count(); i++) {
|
||||
QListWidgetItem* item = ui->listMultiFilter->item(i);
|
||||
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
|
||||
item->setCheckState(Qt::Checked);
|
||||
}
|
||||
ui->listMultiFilter->setVisible(false);
|
||||
}
|
||||
|
||||
this->installEventFilter(this);
|
||||
ui->filterBox->installEventFilter(this);
|
||||
ui->listMultiFilter->installEventFilter(this);
|
||||
}
|
||||
|
||||
TaskSketcherElements::~TaskSketcherElements()
|
||||
@@ -566,7 +588,7 @@ void TaskSketcherElements::connectSignals()
|
||||
this, &TaskSketcherElements::onListWidgetElementsMouseMoveOnItem
|
||||
);
|
||||
QObject::connect(
|
||||
ui->listMultiFilter, &QListWidget::itemChanged,
|
||||
filterList, &QListWidget::itemChanged,
|
||||
this, &TaskSketcherElements::onListMultiFilterItemChanged
|
||||
);
|
||||
QObject::connect(
|
||||
@@ -575,15 +597,15 @@ void TaskSketcherElements::connectSignals()
|
||||
);
|
||||
QObject::connect(
|
||||
ui->settingsButton, &QToolButton::clicked,
|
||||
this, &TaskSketcherElements::onSettingsButtonClicked
|
||||
ui->settingsButton, &QToolButton::showMenu
|
||||
);
|
||||
QObject::connect(
|
||||
qAsConst(ui->settingsButton)->actions()[0], &QAction::changed,
|
||||
this, &TaskSketcherElements::onSettingsExtendedInformationChanged
|
||||
);
|
||||
QObject::connect(
|
||||
qAsConst(ui->settingsButton)->actions()[1], &QAction::changed,
|
||||
this, &TaskSketcherElements::onSettingsAutoCollapseFilterChanged
|
||||
ui->filterButton, &QToolButton::clicked,
|
||||
ui->filterButton, &QToolButton::showMenu
|
||||
);
|
||||
|
||||
connectionElementsChanged = sketchView->signalElementsChanged.connect(
|
||||
@@ -592,29 +614,19 @@ void TaskSketcherElements::connectSignals()
|
||||
|
||||
/* filter functions --------------------------------------------------- */
|
||||
|
||||
void TaskSketcherElements::onFilterBoxStateChanged(int val)
|
||||
void TaskSketcherElements::createFilterButtonActions()
|
||||
{
|
||||
Q_UNUSED(val)
|
||||
|
||||
ui->listMultiFilter->setVisible(ui->filterBox->checkState() == Qt::Checked);
|
||||
|
||||
slotElementsChanged();
|
||||
auto* action = new QWidgetAction(this);
|
||||
filterList = new ElementFilterList(this);
|
||||
action->setDefaultWidget(filterList);
|
||||
qAsConst(ui->filterButton)->addAction(action);
|
||||
}
|
||||
|
||||
bool TaskSketcherElements::eventFilter(QObject* obj, QEvent* event)
|
||||
void TaskSketcherElements::onFilterBoxStateChanged(int val)
|
||||
{
|
||||
if (collapseFilter) {
|
||||
if (obj == qobject_cast<QObject*>(ui->filterBox) && event->type() == QEvent::Enter && ui->filterBox->checkState() == Qt::Checked) {
|
||||
ui->listMultiFilter->show();
|
||||
}
|
||||
else if (obj == qobject_cast<QObject*>(ui->listMultiFilter) && event->type() == QEvent::Leave) {
|
||||
ui->listMultiFilter->hide();
|
||||
}
|
||||
else if (obj == this && event->type() == QEvent::Leave) {
|
||||
ui->listMultiFilter->hide();
|
||||
}
|
||||
}
|
||||
return TaskBox::eventFilter(obj, event);
|
||||
Q_UNUSED(val);
|
||||
ui->filterButton->setEnabled(ui->filterBox->checkState() == Qt::Checked);
|
||||
slotElementsChanged();
|
||||
}
|
||||
|
||||
enum class GeoFilterType { NormalGeos,
|
||||
@@ -636,13 +648,33 @@ enum class GeoFilterType { NormalGeos,
|
||||
void TaskSketcherElements::onListMultiFilterItemChanged(QListWidgetItem* item)
|
||||
{
|
||||
{
|
||||
int start = 4; //From 4 to the end, it's the geometry types (line, circle, arc...)
|
||||
QSignalBlocker sigblk(ui->listMultiFilter);
|
||||
if (item == ui->listMultiFilter->item(static_cast<int>(GeoFilterType::AllGeosTypes))) {
|
||||
for (int i = start; i < ui->listMultiFilter->count(); i++) {
|
||||
ui->listMultiFilter->item(i)->setCheckState(item->checkState());
|
||||
QSignalBlocker sigblk(filterList);
|
||||
|
||||
int index = filterList->row(item);
|
||||
int indexOfAllTypes = static_cast<int>(GeoFilterType::AllGeosTypes);
|
||||
|
||||
if (index == indexOfAllTypes) {
|
||||
for (int i = indexOfAllTypes + 1; i < filterList->count(); i++) {
|
||||
filterList->item(i)->setCheckState(item->checkState());
|
||||
}
|
||||
}
|
||||
else if (index > indexOfAllTypes) {
|
||||
bool atLeastOneUnchecked = false;
|
||||
bool atLeastOneChecked = false;
|
||||
|
||||
for (int i = indexOfAllTypes + 1; i < filterList->count(); i++) {
|
||||
if (filterList->item(i)->checkState() == Qt::Checked)
|
||||
atLeastOneChecked = true;
|
||||
if (filterList->item(i)->checkState() == Qt::Unchecked)
|
||||
atLeastOneUnchecked = true;
|
||||
}
|
||||
if (atLeastOneChecked && atLeastOneUnchecked)
|
||||
filterList->item(indexOfAllTypes)->setCheckState(Qt::PartiallyChecked);
|
||||
else if(atLeastOneUnchecked)
|
||||
filterList->item(indexOfAllTypes)->setCheckState(Qt::Unchecked);
|
||||
else if(atLeastOneChecked)
|
||||
filterList->item(indexOfAllTypes)->setCheckState(Qt::Checked);
|
||||
}
|
||||
}
|
||||
|
||||
updateVisibility();
|
||||
@@ -656,19 +688,19 @@ void TaskSketcherElements::setItemVisibility(QListWidgetItem* it)
|
||||
|
||||
using GeometryState = ElementItem::GeometryState;
|
||||
|
||||
if ((ui->listMultiFilter->item(static_cast<int>(GeoFilterType::NormalGeos))->checkState() == Qt::Unchecked && item->State == GeometryState::Normal) ||
|
||||
(ui->listMultiFilter->item(static_cast<int>(GeoFilterType::ConstructionGeos))->checkState() == Qt::Unchecked && item->State == GeometryState::Construction) ||
|
||||
(ui->listMultiFilter->item(static_cast<int>(GeoFilterType::InternalGeos))->checkState() == Qt::Unchecked && item->State == GeometryState::InternalAlignment) ||
|
||||
(ui->listMultiFilter->item(static_cast<int>(GeoFilterType::ExternalGeos))->checkState() == Qt::Unchecked && item->State == GeometryState::External) ||
|
||||
(ui->listMultiFilter->item(static_cast<int>(GeoFilterType::PointGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomPoint::getClassTypeId()) ||
|
||||
(ui->listMultiFilter->item(static_cast<int>(GeoFilterType::LineGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomLineSegment::getClassTypeId()) ||
|
||||
(ui->listMultiFilter->item(static_cast<int>(GeoFilterType::CircleGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomCircle::getClassTypeId()) ||
|
||||
(ui->listMultiFilter->item(static_cast<int>(GeoFilterType::EllipseGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomEllipse::getClassTypeId()) ||
|
||||
(ui->listMultiFilter->item(static_cast<int>(GeoFilterType::ArcGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomArcOfCircle::getClassTypeId()) ||
|
||||
(ui->listMultiFilter->item(static_cast<int>(GeoFilterType::ArcOfEllipseGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomArcOfEllipse::getClassTypeId()) ||
|
||||
(ui->listMultiFilter->item(static_cast<int>(GeoFilterType::HyperbolaGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomArcOfHyperbola::getClassTypeId()) ||
|
||||
(ui->listMultiFilter->item(static_cast<int>(GeoFilterType::ParabolaGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomArcOfParabola::getClassTypeId()) ||
|
||||
(ui->listMultiFilter->item(static_cast<int>(GeoFilterType::BSplineGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomBSplineCurve::getClassTypeId()) )
|
||||
if ((filterList->item(static_cast<int>(GeoFilterType::NormalGeos))->checkState() == Qt::Unchecked && item->State == GeometryState::Normal) ||
|
||||
(filterList->item(static_cast<int>(GeoFilterType::ConstructionGeos))->checkState() == Qt::Unchecked && item->State == GeometryState::Construction) ||
|
||||
(filterList->item(static_cast<int>(GeoFilterType::InternalGeos))->checkState() == Qt::Unchecked && item->State == GeometryState::InternalAlignment) ||
|
||||
(filterList->item(static_cast<int>(GeoFilterType::ExternalGeos))->checkState() == Qt::Unchecked && item->State == GeometryState::External) ||
|
||||
(filterList->item(static_cast<int>(GeoFilterType::PointGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomPoint::getClassTypeId()) ||
|
||||
(filterList->item(static_cast<int>(GeoFilterType::LineGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomLineSegment::getClassTypeId()) ||
|
||||
(filterList->item(static_cast<int>(GeoFilterType::CircleGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomCircle::getClassTypeId()) ||
|
||||
(filterList->item(static_cast<int>(GeoFilterType::EllipseGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomEllipse::getClassTypeId()) ||
|
||||
(filterList->item(static_cast<int>(GeoFilterType::ArcGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomArcOfCircle::getClassTypeId()) ||
|
||||
(filterList->item(static_cast<int>(GeoFilterType::ArcOfEllipseGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomArcOfEllipse::getClassTypeId()) ||
|
||||
(filterList->item(static_cast<int>(GeoFilterType::HyperbolaGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomArcOfHyperbola::getClassTypeId()) ||
|
||||
(filterList->item(static_cast<int>(GeoFilterType::ParabolaGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomArcOfParabola::getClassTypeId()) ||
|
||||
(filterList->item(static_cast<int>(GeoFilterType::BSplineGeos))->checkState() == Qt::Unchecked && item->GeometryType == Part::GeomBSplineCurve::getClassTypeId()) )
|
||||
{
|
||||
item->setHidden(true);
|
||||
return;
|
||||
@@ -1180,23 +1212,18 @@ void TaskSketcherElements::changeEvent(QEvent *e)
|
||||
void TaskSketcherElements::createSettingsButtonActions()
|
||||
{
|
||||
QAction* action = new QAction(tr("Extended information"), this);
|
||||
QAction* action2 = new QAction(tr("Auto collapse filter"), this);
|
||||
|
||||
action->setCheckable(true);
|
||||
action2->setCheckable(true);
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher/Elements");
|
||||
{
|
||||
QSignalBlocker block(this);
|
||||
action->setChecked(hGrp->GetBool("ExtendedNaming", false));
|
||||
action2->setChecked(hGrp->GetBool("AutoCollapseFilter", false));
|
||||
}
|
||||
|
||||
ui->settingsButton->addAction(action);
|
||||
ui->settingsButton->addAction(action2);
|
||||
|
||||
isNamingBoxChecked = hGrp->GetBool("ExtendedNaming", false);
|
||||
collapseFilter = hGrp->GetBool("AutoCollapseFilter", true);
|
||||
}
|
||||
|
||||
void TaskSketcherElements::onSettingsExtendedInformationChanged()
|
||||
@@ -1210,25 +1237,4 @@ void TaskSketcherElements::onSettingsExtendedInformationChanged()
|
||||
slotElementsChanged();
|
||||
}
|
||||
|
||||
void TaskSketcherElements::onSettingsAutoCollapseFilterChanged()
|
||||
{
|
||||
QList<QAction*> acts = ui->settingsButton->actions();
|
||||
collapseFilter = acts[1]->isChecked();
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher/Elements");
|
||||
hGrp->SetBool("AutoCollapseFilter", collapseFilter);
|
||||
|
||||
if (collapseFilter) {
|
||||
ui->listMultiFilter->setVisible(false);
|
||||
}
|
||||
else {
|
||||
ui->listMultiFilter->setVisible(ui->filterBox->checkState() == Qt::Checked);
|
||||
}
|
||||
}
|
||||
|
||||
void TaskSketcherElements::onSettingsButtonClicked(bool)
|
||||
{
|
||||
ui->settingsButton->showMenu();
|
||||
}
|
||||
|
||||
#include "moc_TaskSketcherElements.cpp"
|
||||
|
||||
@@ -69,7 +69,7 @@ class ElementItem : public QListWidgetItem
|
||||
, StartingVertex(startingVertex)
|
||||
, MidVertex(midVertex)
|
||||
, EndVertex(endVertex)
|
||||
, GeometryType(geometryType)
|
||||
, GeometryType(std::move(geometryType))
|
||||
, State(state)
|
||||
, isLineSelected(false)
|
||||
, isStartingPointSelected(false)
|
||||
@@ -177,6 +177,39 @@ Q_SIGNALS:
|
||||
void onItemHovered(QListWidgetItem *);
|
||||
};
|
||||
|
||||
class ElementFilterList : public QListWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ElementFilterList(QWidget* parent = nullptr);
|
||||
~ElementFilterList() override;
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent* e) override;
|
||||
virtual void languageChange();
|
||||
|
||||
private:
|
||||
using filterItemRepr = std::pair<const char *, const int>; // {filter item text, filter item level}
|
||||
inline static const std::vector<filterItemRepr> filterItems = {
|
||||
{QT_TR_NOOP("Normal"),0},
|
||||
{QT_TR_NOOP("Construction"),0},
|
||||
{QT_TR_NOOP("Internal"),0},
|
||||
{QT_TR_NOOP("External"),0},
|
||||
{QT_TR_NOOP("All types"),0},
|
||||
{QT_TR_NOOP("Point"),1},
|
||||
{QT_TR_NOOP("Line"),1},
|
||||
{QT_TR_NOOP("Circle"),1},
|
||||
{QT_TR_NOOP("Ellipse"),1},
|
||||
{QT_TR_NOOP("Arc of circle"),1},
|
||||
{QT_TR_NOOP("Arc of ellipse"),1},
|
||||
{QT_TR_NOOP("Arc of hyperbola"),1},
|
||||
{QT_TR_NOOP("Arc of parabola"),1},
|
||||
{QT_TR_NOOP("B-Spline"),1}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
class TaskSketcherElements : public Gui::TaskView::TaskBox, public Gui::SelectionObserver
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -188,13 +221,12 @@ public:
|
||||
/// Observer message from the Selection
|
||||
void onSelectionChanged(const Gui::SelectionChanges& msg) override;
|
||||
|
||||
bool eventFilter(QObject* obj, QEvent* event) override;
|
||||
|
||||
private:
|
||||
void slotElementsChanged();
|
||||
void updateVisibility();
|
||||
void setItemVisibility(QListWidgetItem* item);
|
||||
void clearWidget();
|
||||
void createFilterButtonActions();
|
||||
void createSettingsButtonActions();
|
||||
void connectSignals();
|
||||
|
||||
@@ -203,8 +235,6 @@ public Q_SLOTS:
|
||||
void onListWidgetElementsItemEntered(QListWidgetItem *item);
|
||||
void onListWidgetElementsMouseMoveOnItem(QListWidgetItem* item);
|
||||
void onSettingsExtendedInformationChanged();
|
||||
void onSettingsAutoCollapseFilterChanged();
|
||||
void onSettingsButtonClicked(bool);
|
||||
void onFilterBoxStateChanged(int val);
|
||||
void onListMultiFilterItemChanged(QListWidgetItem* item);
|
||||
|
||||
@@ -224,8 +254,9 @@ private:
|
||||
int previouslyHoveredItemIndex;
|
||||
SubElementType previouslyHoveredType;
|
||||
|
||||
ElementFilterList* filterList;
|
||||
|
||||
bool isNamingBoxChecked;
|
||||
bool collapseFilter;
|
||||
};
|
||||
|
||||
} //namespace SketcherGui
|
||||
|
||||
@@ -30,17 +30,48 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout1">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="filterBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Check to activate filters</string>
|
||||
<string>Check to toggle filters</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">padding-bottom: 0px; margin-bottom: 0px</string>
|
||||
<string notr="true">padding-right: 0px; margin-right: 0px</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="filterButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Click to show filters</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">padding-left: 0px; margin-left: 0px</string>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Filters</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
<property name="popupMode">
|
||||
<enum>QToolButton::MenuButtonPopup</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -69,98 +100,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listMultiFilter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">padding-top: 0px; margin-top: 0px</string>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::NoSelection</enum>
|
||||
</property>
|
||||
<property name="modelColumn">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Normal</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Construction</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Internal</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>External</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>All types</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string> - Point</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string> - Line</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string> - Circle</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string> - Ellipse </string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string> - Arc</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string> - Arc of ellipse</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string> - Arc of hyperbola</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string> - Arc of parabola</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string> - B-Spline</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ElementView" name="listWidgetElements">
|
||||
<property name="sizePolicy">
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
# FreeCAD init script of the Sketcher module
|
||||
# (c) 2001 Juergen Riegel
|
||||
|
||||
#***************************************************************************
|
||||
#* (c) Juergen Riegel (juergen.riegel@web.de) 2002 *
|
||||
#* Copyright (c) 2001,2002 Juergen Riegel <juergen.riegel@web.de> *
|
||||
#* *
|
||||
#* This file is part of the FreeCAD CAx development system. *
|
||||
#* *
|
||||
@@ -13,17 +10,17 @@
|
||||
#* for detail see the LICENCE text file. *
|
||||
#* *
|
||||
#* FreeCAD is distributed in the hope that it will be useful, *
|
||||
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
#* GNU Lesser General Public License for more details. *
|
||||
#* *
|
||||
#* You should have received a copy of the GNU Library General Public *
|
||||
#* License along with FreeCAD; if not, write to the Free Software *
|
||||
#* License along with FreeCAD; if not, write to the Free Software *
|
||||
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
#* USA *
|
||||
#* *
|
||||
#* Juergen Riegel 2002 *
|
||||
#***************************************************************************/
|
||||
|
||||
# FreeCAD init script of the Sketcher module
|
||||
|
||||
FreeCAD.__unit_test__ += [ "TestSketcherApp" ]
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
# Sketcher gui init module
|
||||
# (c) 2003 Juergen Riegel
|
||||
#
|
||||
# Gathering all the information to start FreeCAD
|
||||
# This is the second one of three init scripts, the third one
|
||||
# runs when the gui is up
|
||||
|
||||
#***************************************************************************
|
||||
#* (c) Juergen Riegel (juergen.riegel@web.de) 2002 *
|
||||
#* Copyright (c) 2002,2003 Juergen Riegel <juergen.riegel@web.de> *
|
||||
#* *
|
||||
#* This file is part of the FreeCAD CAx development system. *
|
||||
#* *
|
||||
@@ -26,10 +19,13 @@
|
||||
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
#* USA *
|
||||
#* *
|
||||
#* Juergen Riegel 2002 *
|
||||
#***************************************************************************/
|
||||
|
||||
|
||||
# Sketcher gui init module
|
||||
#
|
||||
# Gathering all the information to start FreeCAD
|
||||
# This is the second one of three init scripts, the third one
|
||||
# runs when the gui is up
|
||||
|
||||
class SketcherWorkbench ( Workbench ):
|
||||
"Sketcher workbench object"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# (c) Emmanuel O'Brien 2021 LGPL *
|
||||
#**************************************************************************
|
||||
# Copyright (c) 2021 Emmanuel O'Brien *
|
||||
# *
|
||||
# This file is part of the FreeCAD CAx development system. *
|
||||
# *
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# (c) Juergen Riegel (FreeCAD@juergen-riegel.net) 2011 LGPL *
|
||||
# (c) Emmanuel O'Brien 2021 LGPL *
|
||||
#**************************************************************************
|
||||
# Copyright (c) 2011 Juergen Riegel <FreeCAD@juergen-riegel.net> *
|
||||
# Copyright (c) 2021 Emmanuel O'Brien *
|
||||
# *
|
||||
# This file is part of the FreeCAD CAx development system. *
|
||||
# *
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# (c) Juergen Riegel (FreeCAD@juergen-riegel.net) 2011 LGPL *
|
||||
#**************************************************************************
|
||||
# Copyright (c) 2011 Juergen Riegel <FreeCAD@juergen-riegel.net> *
|
||||
# *
|
||||
# This file is part of the FreeCAD CAx development system. *
|
||||
# *
|
||||
|
||||
@@ -438,6 +438,14 @@ void DrawViewPart::postHlrTasks(void)
|
||||
for (auto& b : bals) {
|
||||
b->recomputeFeature();
|
||||
}
|
||||
// Dimensions need to be recomputed now, unless their recomputation must be postponed
|
||||
// until face creation, in which case they are recomputed after that
|
||||
if (!handleFaces() || CoarseView.getValue()) {
|
||||
std::vector<TechDraw::DrawViewDimension*> dims = getDimensions();
|
||||
for (auto& d : dims) {
|
||||
d->recomputeFeature();
|
||||
}
|
||||
}
|
||||
|
||||
//second pass if required
|
||||
if (ScaleType.isValue("Automatic") &&
|
||||
@@ -453,7 +461,7 @@ void DrawViewPart::postHlrTasks(void)
|
||||
requestPaint();
|
||||
}
|
||||
|
||||
//run any tasks that need to been done after faces are available
|
||||
// Run any tasks that need to be done after faces are available
|
||||
void DrawViewPart::postFaceExtractionTasks(void)
|
||||
{
|
||||
// Some centerlines depend on faces so we could not add CL geometry before now
|
||||
|
||||
Reference in New Issue
Block a user