1
/***************************************************************************
2
* Copyright (c) 2004 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"
25
#include "ViewProviderPlaneParametric.h"
26
#include <Mod/Part/App/FeatureFace.h>
27
#include <Mod/Part/App/Part2DObject.h>
30
using namespace PartGui;
32
//**************************************************************************
33
// Construction/Destruction
35
PROPERTY_SOURCE(PartGui::ViewProviderPlaneParametric, PartGui::ViewProviderPrimitive)
38
ViewProviderPlaneParametric::ViewProviderPlaneParametric()
40
sPixmap = "Part_Plane_Parametric";
43
ViewProviderPlaneParametric::~ViewProviderPlaneParametric() = default;
45
std::vector<std::string> ViewProviderPlaneParametric::getDisplayModes() const
47
// get the modes of the father
48
std::vector<std::string> StrList;
51
StrList.emplace_back("Flat Lines");
52
StrList.emplace_back("Shaded");
53
StrList.emplace_back("Wireframe");
54
StrList.emplace_back("Points");
59
// ----------------------------------------------------------------------------
61
PROPERTY_SOURCE(PartGui::ViewProviderFace, PartGui::ViewProviderPlaneParametric)
64
ViewProviderFace::ViewProviderFace() = default;
66
ViewProviderFace::~ViewProviderFace() = default;
68
std::vector<App::DocumentObject*> ViewProviderFace::claimChildren() const
70
return static_cast<Part::Face*>(getObject())->Sources.getValues();
73
bool ViewProviderFace::canDragObjects() const
78
bool ViewProviderFace::canDragObject(App::DocumentObject* obj) const
81
// return Part::Feature::hasShapeOwner(obj);
85
void ViewProviderFace::dragObject(App::DocumentObject* obj)
87
Part::Face* face = static_cast<Part::Face*>(getObject());
88
std::vector<App::DocumentObject*> sources = face->Sources.getValues();
89
for (std::vector<App::DocumentObject*>::iterator it = sources.begin(); it != sources.end(); ++it) {
92
face->Sources.setValues(sources);
98
bool ViewProviderFace::canDropObjects() const
103
bool ViewProviderFace::canDropObject(App::DocumentObject* obj) const
105
return canDragObject(obj);
108
void ViewProviderFace::dropObject(App::DocumentObject* obj)
110
Part::Face* face = static_cast<Part::Face*>(getObject());
111
std::vector<App::DocumentObject*> sources = face->Sources.getValues();
112
sources.push_back(obj);
113
face->Sources.setValues(sources);