1
/***************************************************************************
2
* Copyright (c) 2011 Jürgen Riegel <juergen.riegel@web.de> *
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"
29
#include "PointsFeature.h"
32
using namespace Points;
34
//===========================================================================
36
//===========================================================================
38
PROPERTY_SOURCE(Points::Feature, App::GeoFeature)
42
ADD_PROPERTY(Points, (PointKernel()));
45
short Feature::mustExecute() const
50
App::DocumentObjectExecReturn* Feature::execute()
53
return App::DocumentObject::StdReturn;
56
void Feature::Restore(Base::XMLReader& reader)
58
GeoFeature::Restore(reader);
61
void Feature::RestoreDocFile(Base::Reader& reader)
63
// This gets only invoked if a points file has been added from Restore()
64
Points.RestoreDocFile(reader);
67
void Feature::onChanged(const App::Property* prop)
69
// if the placement has changed apply the change to the point data as well
70
if (prop == &this->Placement) {
71
this->Points.setTransform(this->Placement.getValue().toMatrix());
73
// if the point data has changed check and adjust the transformation as well
74
else if (prop == &this->Points) {
77
p.fromMatrix(this->Points.getTransform());
78
if (p != this->Placement.getValue()) {
79
this->Placement.setValue(p);
82
catch (const Base::ValueError&) {
86
GeoFeature::onChanged(prop);
89
// ---------------------------------------------------------
94
PROPERTY_SOURCE_TEMPLATE(Points::FeatureCustom, Points::Feature)
97
// explicit template instantiation
98
template class PointsExport FeatureCustomT<Points::Feature>;
101
// ---------------------------------------------------------
106
PROPERTY_SOURCE_TEMPLATE(Points::FeaturePython, Points::Feature)
108
const char* Points::FeaturePython::getViewProviderName() const
110
return "PointsGui::ViewProviderPython";
114
// explicit template instantiation
115
template class PointsExport FeaturePythonT<Points::Feature>;