FreeCAD

Форк
0
/
ViewProviderProjectOnSurface.cpp 
86 строк · 3.2 Кб
1
// SPDX-License-Identifier: LGPL-2.1-or-later
2

3
/***************************************************************************
4
 *   Copyright (c) 2019 Manuel Apeltauer, direkt cnc-systeme GmbH          *
5
 *   Copyright (c) 2024 Werner Mayer <wmayer[at]users.sourceforge.net>     *
6
 *                                                                         *
7
 *   This file is part of FreeCAD.                                         *
8
 *                                                                         *
9
 *   FreeCAD is free software: you can redistribute it and/or modify it    *
10
 *   under the terms of the GNU Lesser General Public License as           *
11
 *   published by the Free Software Foundation, either version 2.1 of the  *
12
 *   License, or (at your option) any later version.                       *
13
 *                                                                         *
14
 *   FreeCAD is distributed in the hope that it will be useful, but        *
15
 *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
16
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      *
17
 *   Lesser General Public License for more details.                       *
18
 *                                                                         *
19
 *   You should have received a copy of the GNU Lesser General Public      *
20
 *   License along with FreeCAD. If not, see                               *
21
 *   <https://www.gnu.org/licenses/>.                                      *
22
 *                                                                         *
23
 **************************************************************************/
24

25
#include "PreCompiled.h"
26
#ifndef _PreComp_
27
#include <QAction>
28
#include <QMenu>
29
#endif
30

31
#include "ViewProviderProjectOnSurface.h"
32
#include "DlgProjectionOnSurface.h"
33
#include <Gui/Control.h>
34

35

36
using namespace PartGui;
37

38
PROPERTY_SOURCE(PartGui::ViewProviderProjectOnSurface, PartGui::ViewProviderPart)
39

40

41
ViewProviderProjectOnSurface::ViewProviderProjectOnSurface()
42
{
43
    const unsigned int color = 0x8ae23400;
44
    LineColor.setValue(color);
45
    ShapeAppearance.setDiffuseColor(color);
46
    PointColor.setValue(color);
47
    Transparency.setValue(0);
48
}
49

50
ViewProviderProjectOnSurface::~ViewProviderProjectOnSurface() = default;
51

52
void ViewProviderProjectOnSurface::setupContextMenu(QMenu* menu, QObject* receiver, const char* member)
53
{
54
    QAction* act = menu->addAction(QObject::tr("Edit projection"), receiver, member);
55
    act->setData(QVariant((int)ViewProvider::Default));
56

57
    ViewProviderPart::setupContextMenu(menu, receiver, member);
58
}
59

60
bool ViewProviderProjectOnSurface::setEdit(int ModNum)
61
{
62
    if (ModNum == ViewProvider::Default) {
63
        if (Gui::Control().activeDialog()) {
64
            return false;
65
        }
66

67
        if (auto feature = dynamic_cast<Part::ProjectOnSurface*>(getObject())) {
68
            Gui::Control().showDialog(new TaskProjectOnSurface(feature));
69
            return true;
70
        }
71

72
        return false;
73
    }
74

75
    return ViewProviderPart::setEdit(ModNum);
76
}
77

78
void ViewProviderProjectOnSurface::unsetEdit(int ModNum)
79
{
80
    if (ModNum == ViewProvider::Default) {
81
        Gui::Control().closeDialog();
82
    }
83
    else {
84
        ViewProviderPart::unsetEdit(ModNum);
85
    }
86
}
87

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.