FreeCAD

Форк
0
/
ViewProviderImage.cpp 
84 строки · 3.0 Кб
1
/***************************************************************************
2
 *   Copyright (c) 2016 WandererFan <wandererfan@gmail.com>                *
3
 *                                                                         *
4
 *   This file is part of the FreeCAD CAx development system.              *
5
 *                                                                         *
6
 *   This library is free software; you can redistribute it and/or         *
7
 *   modify it under the terms of the GNU Library General Public           *
8
 *   License as published by the Free Software Foundation; either          *
9
 *   version 2 of the License, or (at your option) any later version.      *
10
 *                                                                         *
11
 *   This library  is distributed in the hope that it will be useful,      *
12
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
14
 *   GNU Library General Public License for more details.                  *
15
 *                                                                         *
16
 *   You should have received a copy of the GNU Library General Public     *
17
 *   License along with this library; see the file COPYING.LIB. If not,    *
18
 *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
19
 *   Suite 330, Boston, MA  02111-1307, USA                                *
20
 *                                                                         *
21
 ***************************************************************************/
22

23
#include "PreCompiled.h"
24

25
#include <App/DocumentObject.h>
26

27
#include "ViewProviderImage.h"
28
#include "QGIView.h"
29

30
using namespace TechDrawGui;
31

32
PROPERTY_SOURCE(TechDrawGui::ViewProviderImage, TechDrawGui::ViewProviderDrawingView)
33

34
//**************************************************************************
35
// Construction/Destruction
36

37
ViewProviderImage::ViewProviderImage()
38
{
39
    sPixmap = "actions/TechDraw_Image";
40

41
    ADD_PROPERTY_TYPE(Crop ,(false), "Image", App::Prop_None, "Crop image to Width x Height");
42
}
43

44
ViewProviderImage::~ViewProviderImage()
45
{
46
}
47

48
void ViewProviderImage::updateData(const App::Property* prop)
49
{
50
    if (prop == &(getViewObject()->Width)  ||
51
        prop == &(getViewObject()->Height)  ||
52
        prop == &(getViewObject()->Scale) ) {
53
        QGIView* qgiv = getQView();
54
        if (qgiv) {
55
            qgiv->QGIView::updateView(true);
56
        }
57
    }
58

59
    ViewProviderDrawingView::updateData(prop);
60
}
61

62
void ViewProviderImage::onChanged(const App::Property *prop)
63
{
64
    App::DocumentObject* obj = getObject();
65
    if (!obj || obj->isRestoring()) {
66
            Gui::ViewProviderDocumentObject::onChanged(prop);
67
            return;
68
    }
69

70
    if (prop == &Crop) {
71
        QGIView* qgiv = getQView();
72
        if (qgiv) {
73
            qgiv->updateView(true);
74
        }
75
    }
76

77
    Gui::ViewProviderDocumentObject::onChanged(prop);
78
}
79

80

81
TechDraw::DrawViewImage* ViewProviderImage::getViewObject() const
82
{
83
    return dynamic_cast<TechDraw::DrawViewImage*>(pcObject);
84
}
85

86

87

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

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

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

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