From 6318586353afdfbbcb525992d7be4869f7d17482 Mon Sep 17 00:00:00 2001 From: hlorus Date: Sun, 14 Jan 2024 21:32:22 +0100 Subject: [PATCH] [PD] Add handlers for unified measurement facility --- src/Mod/PartDesign/App/AppPartDesign.cpp | 3 ++ src/Mod/PartDesign/App/CMakeLists.txt | 2 ++ src/Mod/PartDesign/App/Measure.cpp | 36 +++++++++++++++++++ src/Mod/PartDesign/App/Measure.h | 44 ++++++++++++++++++++++++ 4 files changed, 85 insertions(+) create mode 100644 src/Mod/PartDesign/App/Measure.cpp create mode 100644 src/Mod/PartDesign/App/Measure.h diff --git a/src/Mod/PartDesign/App/AppPartDesign.cpp b/src/Mod/PartDesign/App/AppPartDesign.cpp index 87ed33c03b..944764ce67 100644 --- a/src/Mod/PartDesign/App/AppPartDesign.cpp +++ b/src/Mod/PartDesign/App/AppPartDesign.cpp @@ -31,6 +31,7 @@ #include "DatumLine.h" #include "DatumPlane.h" #include "DatumPoint.h" +#include "Measure.h" #include "FeatureBase.h" #include "FeatureBoolean.h" #include "FeatureChamfer.h" @@ -153,5 +154,7 @@ PyMOD_INIT_FUNC(_PartDesign) PartDesign::SubtractiveWedge ::init(); PartDesign::FeatureBase ::init(); + PartDesign::Measure ::initialize(); + PyMOD_Return(mod); } diff --git a/src/Mod/PartDesign/App/CMakeLists.txt b/src/Mod/PartDesign/App/CMakeLists.txt index a2ecf82a5a..1a9774a3e1 100644 --- a/src/Mod/PartDesign/App/CMakeLists.txt +++ b/src/Mod/PartDesign/App/CMakeLists.txt @@ -117,6 +117,8 @@ SET(Module_SRCS AppPartDesignPy.cpp PreCompiled.cpp PreCompiled.h + Measure.cpp + Measure.h ) SOURCE_GROUP("Module" FILES ${Module_SRCS}) diff --git a/src/Mod/PartDesign/App/Measure.cpp b/src/Mod/PartDesign/App/Measure.cpp new file mode 100644 index 0000000000..5c4865b94d --- /dev/null +++ b/src/Mod/PartDesign/App/Measure.cpp @@ -0,0 +1,36 @@ +/*************************************************************************** + * Copyright (c) 2023 David Friedli * + * * + * This file is part of FreeCAD. * + * * + * FreeCAD is free software: you can redistribute it and/or modify it * + * under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 2.1 of the * + * License, or (at your option) any later version. * + * * + * FreeCAD is distributed in the hope that it will be useful, 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 Lesser General Public * + * License along with FreeCAD. If not, see * + * . * + * * + **************************************************************************/ + + +#include "PreCompiled.h" + +#include +#include +#include "Base/Console.h" +#include "Measure.h" + + +void PartDesign::Measure::initialize() { + const App::MeasureHandler& handler = App::MeasureManager::getMeasureHandler("Part"); + + App::MeasureManager::addMeasureHandler("PartDesign", handler.typeCb); +} + diff --git a/src/Mod/PartDesign/App/Measure.h b/src/Mod/PartDesign/App/Measure.h new file mode 100644 index 0000000000..23837cafcc --- /dev/null +++ b/src/Mod/PartDesign/App/Measure.h @@ -0,0 +1,44 @@ +/*************************************************************************** + * Copyright (c) 2023 David Friedli * + * * + * This file is part of FreeCAD. * + * * + * FreeCAD is free software: you can redistribute it and/or modify it * + * under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 2.1 of the * + * License, or (at your option) any later version. * + * * + * FreeCAD is distributed in the hope that it will be useful, 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 Lesser General Public * + * License along with FreeCAD. If not, see * + * . * + * * + **************************************************************************/ + +#ifndef PARTDESIGN_MEASURE_H +#define PARTDESIGN_MEASURE_H + +#include + + + +namespace PartDesign +{ + + +class PartDesignExport Measure +{ +public: + + static void initialize(); + +}; + + +} //namespace PartDesign + +#endif