1
/***************************************************************************
2
* Copyright (c) Jürgen Riegel (juergen.riegel@web.de) 2002 *
4
* This file is part of the FreeCAD CAx development system. *
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. *
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. *
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 *
21
***************************************************************************/
23
#include "PreCompiled.h"
25
#include <Standard_Failure.hxx>
29
#include <Base/Exception.h>
31
#include "FeatureView.h"
34
using namespace Drawing;
36
//===========================================================================
38
//===========================================================================
40
PROPERTY_SOURCE(Drawing::FeatureView, App::DocumentObject)
43
FeatureView::FeatureView(void)
45
static const char* group = "Drawing view";
50
"X position of the view on the drawing in modelling units (mm)");
55
"Y position of the view on the drawing in modelling units (mm)");
56
ADD_PROPERTY_TYPE(Scale, (1.0), group, App::Prop_None, "Scale factor of the view");
57
ADD_PROPERTY_TYPE(Rotation,
61
"Rotation of the view in degrees counterclockwise");
62
// The 'Visible' property is handled by the view provider exclusively. It has the 'Output' flag
63
// set to avoid to call the execute() method. The view provider touches the page object,
65
App::PropertyType propType =
66
static_cast<App::PropertyType>(App::Prop_Hidden | App::Prop_Output);
67
ADD_PROPERTY_TYPE(Visible,
71
"Control whether view is visible in page object");
73
App::PropertyType type = (App::PropertyType)(App::Prop_Hidden);
74
ADD_PROPERTY_TYPE(ViewResult, (nullptr), group, type, "Resulting SVG fragment of that view");
77
FeatureView::~FeatureView()
80
App::DocumentObjectExecReturn* FeatureView::recompute(void)
83
return App::DocumentObject::recompute();
85
catch (Standard_Failure& e) {
86
App::DocumentObjectExecReturn* ret =
87
new App::DocumentObjectExecReturn(e.GetMessageString());
88
if (ret->Why.empty()) {
89
ret->Why = "Unknown OCC exception";
95
App::DocumentObjectExecReturn* FeatureView::execute(void)
97
return App::DocumentObject::StdReturn;
101
// Python Drawing feature ---------------------------------------------------------
106
PROPERTY_SOURCE_TEMPLATE(Drawing::FeatureViewPython, Drawing::FeatureView)
108
const char* Drawing::FeatureViewPython::getViewProviderName(void) const
110
return "DrawingGui::ViewProviderDrawingViewPython";
114
// explicit template instantiation
115
template class DrawingExport FeaturePythonT<Drawing::FeatureView>;