App/Origin: big refactoring
- Rebase App::Origin on App::DocumentObject - Keep all control over the Origin structure inside the Origin and it's ViewProvider - Add OriginFeature class as common base for App::Plane and App::Line - Rebase App::Plane and App::Line on top of newly created class and move to the file. - Change Origin's ViewProvider API associated with temporary display - Lots of associated changes to files - Several minor fixes - Lots of new bugs
This commit is contained in:
committed by
Stefan Tröger
parent
ecbb576330
commit
797d6d3a11
@@ -95,8 +95,7 @@
|
||||
#include "Annotation.h"
|
||||
#include "MeasureDistance.h"
|
||||
#include "Placement.h"
|
||||
#include "Plane.h"
|
||||
#include "Line.h"
|
||||
#include "OriginFeature.h"
|
||||
#include "Part.h"
|
||||
#include "Origin.h"
|
||||
#include "MaterialObject.h"
|
||||
@@ -1134,6 +1133,7 @@ void Application::initTypes(void)
|
||||
App ::MaterialObject ::init();
|
||||
App ::MaterialObjectPython ::init();
|
||||
App ::Placement ::init();
|
||||
App ::OriginFeature ::init();
|
||||
App ::Plane ::init();
|
||||
App ::Line ::init();
|
||||
App ::Part ::init();
|
||||
|
||||
@@ -83,9 +83,8 @@ SET(Document_CPP_SRCS
|
||||
InventorObject.cpp
|
||||
MeasureDistance.cpp
|
||||
Placement.cpp
|
||||
Plane.cpp
|
||||
OriginFeature.cpp
|
||||
Range.cpp
|
||||
Line.cpp
|
||||
Transactions.cpp
|
||||
VRMLObject.cpp
|
||||
MaterialObject.cpp
|
||||
@@ -115,9 +114,8 @@ SET(Document_HPP_SRCS
|
||||
InventorObject.h
|
||||
MeasureDistance.h
|
||||
Placement.h
|
||||
Plane.h
|
||||
OriginFeature.h
|
||||
Range.h
|
||||
Line.h
|
||||
Transactions.h
|
||||
VRMLObject.h
|
||||
MaterialObject.h
|
||||
|
||||
@@ -78,16 +78,18 @@ SET(Document_CPP_SRCS
|
||||
GeoFeatureGroupPyImp.cpp
|
||||
GeoFeatureGroup.cpp
|
||||
Part.cpp
|
||||
Origin.cpp
|
||||
Path.cpp
|
||||
InventorObject.cpp
|
||||
MeasureDistance.cpp
|
||||
Placement.cpp
|
||||
<<<<<<< ae7effa304095ee3d286ea7bb545636960e262d5
|
||||
Plane.cpp
|
||||
<<<<<<< 328aeaab9aed22c3b94c79bd7e49404342a44cea
|
||||
Range.cpp
|
||||
=======
|
||||
Line.cpp
|
||||
>>>>>>> add base lines
|
||||
=======
|
||||
OriginFeature.cpp
|
||||
>>>>>>> App/Origin: big refactoring
|
||||
Transactions.cpp
|
||||
VRMLObject.cpp
|
||||
MaterialObject.cpp
|
||||
@@ -112,16 +114,18 @@ SET(Document_HPP_SRCS
|
||||
GeoFeature.h
|
||||
GeoFeatureGroup.h
|
||||
Part.h
|
||||
Origin.h
|
||||
Path.h
|
||||
InventorObject.h
|
||||
MeasureDistance.h
|
||||
Placement.h
|
||||
<<<<<<< ae7effa304095ee3d286ea7bb545636960e262d5
|
||||
Plane.h
|
||||
<<<<<<< 328aeaab9aed22c3b94c79bd7e49404342a44cea
|
||||
Range.h
|
||||
=======
|
||||
Line.h
|
||||
>>>>>>> add base lines
|
||||
=======
|
||||
OriginFeature.h
|
||||
>>>>>>> App/Origin: big refactoring
|
||||
Transactions.h
|
||||
VRMLObject.h
|
||||
MaterialObject.h
|
||||
|
||||
@@ -2084,7 +2084,6 @@ void Document::remObject(const char* sName)
|
||||
pos->second->unsetupObject();
|
||||
}
|
||||
signalDeletedObject(*(pos->second));
|
||||
// TODO Check me if it's needed (2015-09-01, Fat-Zer)
|
||||
pos->second->StatusBits.reset (ObjectStatus::Delete); // Unset the bit to be on the safe side
|
||||
|
||||
if (!d->vertexMap.empty()) {
|
||||
@@ -2140,6 +2139,7 @@ void Document::remObject(const char* sName)
|
||||
/// Remove an object out of the document (internal)
|
||||
void Document::_remObject(DocumentObject* pcObject)
|
||||
{
|
||||
// TODO Refactoring: share code with Document::remObject() (2015-09-01, Fat-Zer)
|
||||
_checkTransaction(pcObject);
|
||||
|
||||
std::map<std::string,DocumentObject*>::iterator pos = d->objectMap.find(pcObject->getNameInDocument());
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) Stefan Tröger (stefantroeger@gmx.net) 2015 *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _AppLine_h_
|
||||
#define _AppLine_h_
|
||||
|
||||
|
||||
#include "GeoFeature.h"
|
||||
#include "PropertyGeo.h"
|
||||
|
||||
|
||||
|
||||
namespace App
|
||||
{
|
||||
|
||||
|
||||
/** Line Object
|
||||
* Used to define planar support for all kind of operations in the document space
|
||||
*/
|
||||
class AppExport Line: public App::GeoFeature
|
||||
{
|
||||
PROPERTY_HEADER(App::Line);
|
||||
|
||||
public:
|
||||
|
||||
/// Constructor
|
||||
Line(void);
|
||||
virtual ~Line();
|
||||
/// additional information about the plane usage (e.g. "BaseLine-xy" in a Part)
|
||||
PropertyString LineType;
|
||||
|
||||
|
||||
/// returns the type name of the ViewProvider
|
||||
virtual const char* getViewProviderName(void) const {
|
||||
return "Gui::ViewProviderLine";
|
||||
}
|
||||
|
||||
/// Return the bounding box of the plane (this is always a fixed size)
|
||||
static Base::BoundBox3d getBoundBox();
|
||||
};
|
||||
|
||||
|
||||
} //namespace App
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,6 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) Stefan Tröger (stefantroeger@gmx.net) 2015 *
|
||||
* Copyright (c) Stefan Tr<EFBFBD>ger (stefantroeger@gmx.net) 2015 *
|
||||
* Copyright (c) Alexander Golubev (Fat-Zer) <fatzer2@gmail.com> 2015 *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
@@ -24,10 +25,14 @@
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
#include <string>
|
||||
#endif
|
||||
|
||||
#include <Base/Exception.h>
|
||||
#include <Base/Placement.h>
|
||||
|
||||
#include <App/Document.h>
|
||||
#include <App/Plane.h>
|
||||
#include <App/OriginFeature.h>
|
||||
|
||||
#include "Origin.h"
|
||||
|
||||
@@ -35,20 +40,138 @@
|
||||
using namespace App;
|
||||
|
||||
|
||||
PROPERTY_SOURCE(App::Origin, App::GeoFeatureGroup)
|
||||
PROPERTY_SOURCE(App::Origin, App::DocumentObject)
|
||||
|
||||
const char* Origin::AxisRoles[3] = {"X_Axis", "Y_Axis", "Z_Axis"};
|
||||
const char* Origin::PlaneRoles[3] = {"XY_Plane", "XZ_Plane", "YZ_Plane"};
|
||||
|
||||
|
||||
//===========================================================================
|
||||
// Feature
|
||||
//===========================================================================
|
||||
|
||||
Origin::Origin(void)
|
||||
{
|
||||
Placement.StatusBits.set(3, true);
|
||||
Origin::Origin(void) {
|
||||
ADD_PROPERTY_TYPE ( OriginFeatures, (0), 0, App::Prop_Hidden,
|
||||
"Axis and baseplanes controlled by the origin" );
|
||||
}
|
||||
|
||||
|
||||
Origin::~Origin(void)
|
||||
{
|
||||
{ }
|
||||
|
||||
App::OriginFeature *Origin::getOriginFeature( const char *role) const {
|
||||
const auto & features = OriginFeatures.getValues ();
|
||||
auto featIt = std::find_if (features.begin(), features.end(),
|
||||
[role] (App::DocumentObject *obj) {
|
||||
return obj->isDerivedFrom ( App::OriginFeature::getClassTypeId () ) &&
|
||||
strcmp (static_cast<App::OriginFeature *>(obj)->Role.getValue(), role) == 0;
|
||||
} );
|
||||
if (featIt != features.end()) {
|
||||
return static_cast<App::OriginFeature *>(*featIt);
|
||||
} else {
|
||||
|
||||
std::stringstream err;
|
||||
err << "Origin \"" << getNameInDocument () << "\" doesn't contain feature with role \""
|
||||
<< role << '"';
|
||||
throw Base::Exception ( err.str().c_str () );
|
||||
}
|
||||
}
|
||||
|
||||
App::Line *Origin::getAxis( const char *role ) const {
|
||||
App::OriginFeature *feat = getOriginFeature (role);
|
||||
if ( feat->isDerivedFrom(App::Line::getClassTypeId () ) ) {
|
||||
return static_cast<App::Line *> (feat);
|
||||
} else {
|
||||
std::stringstream err;
|
||||
err << "Origin \"" << getNameInDocument () << "\" contains bad Axis object for role \""
|
||||
<< role << '"';
|
||||
throw Base::Exception ( err.str().c_str () );
|
||||
}
|
||||
}
|
||||
|
||||
App::Plane *Origin::getPlane( const char *role ) const {
|
||||
App::OriginFeature *feat = getOriginFeature (role);
|
||||
if ( feat->isDerivedFrom(App::Plane::getClassTypeId () ) ) {
|
||||
return static_cast<App::Plane *> (feat);
|
||||
} else {
|
||||
std::stringstream err;
|
||||
err << "Origin \"" << getNameInDocument () << "\" comtains bad Plane object for role \""
|
||||
<< role << '"';
|
||||
throw Base::Exception ( err.str().c_str () );
|
||||
}
|
||||
}
|
||||
|
||||
bool Origin::hasObject (DocumentObject *obj) const {
|
||||
const auto & features = OriginFeatures.getValues ();
|
||||
return std::find (features.begin(), features.end(), obj) != features.end ();
|
||||
}
|
||||
|
||||
short Origin::mustExecute(void) const {
|
||||
if (OriginFeatures.isTouched ()) {
|
||||
return 1;
|
||||
} else {
|
||||
return DocumentObject::mustExecute();
|
||||
}
|
||||
}
|
||||
|
||||
App::DocumentObjectExecReturn *Origin::execute(void) {
|
||||
try { // try to find all base axis and planes in the origin
|
||||
for (const char* role: AxisRoles) {
|
||||
App::Line *axis = getAxis (role);
|
||||
assert(axis);
|
||||
}
|
||||
for (const char* role: PlaneRoles) {
|
||||
App::Plane *plane = getPlane (role);
|
||||
assert(plane);
|
||||
}
|
||||
} catch (const Base::Exception &ex) {
|
||||
setError ();
|
||||
return new App::DocumentObjectExecReturn ( ex.what () );
|
||||
}
|
||||
// purgeError ();
|
||||
return DocumentObject::execute ();
|
||||
}
|
||||
|
||||
void Origin::setupObject () {
|
||||
const static struct {
|
||||
const Base::Type type;
|
||||
const char *role;
|
||||
Base::Rotation rot;
|
||||
} setupData [] = {
|
||||
{App::Line::getClassTypeId(), "X_Axis", Base::Rotation () },
|
||||
{App::Line::getClassTypeId(), "Y_Axis", Base::Rotation ( Base::Vector3d (1,1,1), M_PI*2/3 ) },
|
||||
{App::Line::getClassTypeId(), "Z_Axis", Base::Rotation ( Base::Vector3d (1,1,1), M_PI*4/3 ) },
|
||||
{App::Plane::getClassTypeId (), "XY_Plane", Base::Rotation () },
|
||||
{App::Plane::getClassTypeId (), "XZ_Plane", Base::Rotation ( Base::Vector3d (0,1,1), M_PI ), },
|
||||
{App::Plane::getClassTypeId (), "YZ_Plane", Base::Rotation ( Base::Vector3d (1,1,1), M_PI*2/3 ) },
|
||||
};
|
||||
|
||||
App::Document *doc = getDocument ();
|
||||
|
||||
std::vector<App::DocumentObject *> links;
|
||||
for (auto data: setupData) {
|
||||
std::string objName = doc->getUniqueObjectName ( data.role );
|
||||
App::DocumentObject *featureObj = doc->addObject ( data.type.getName(), objName.c_str () );
|
||||
|
||||
assert ( featureObj && featureObj->isDerivedFrom ( App::OriginFeature::getClassTypeId () ) );
|
||||
|
||||
App::OriginFeature *feature = static_cast <App::OriginFeature *> ( featureObj );
|
||||
feature->Placement.setValue ( Base::Placement ( Base::Vector3d (), data.rot ) );
|
||||
feature->Role.setValue ( data.role );
|
||||
|
||||
links.push_back (feature);
|
||||
}
|
||||
|
||||
OriginFeatures.setValues (links);
|
||||
}
|
||||
|
||||
void Origin::unsetupObject () {
|
||||
const auto &objsLnk = OriginFeatures.getValues ();
|
||||
// Copy to set to assert we won't call methode more then one time for each object
|
||||
std::set<App::DocumentObject *> objs (objsLnk.begin(), objsLnk.end());
|
||||
// Remove all controlled objects
|
||||
for (auto obj: objs ) {
|
||||
// Check that previous deletes wasn't inderectly removed one of our objects
|
||||
const auto &objsLnk = OriginFeatures.getValues ();
|
||||
if ( std::find(objsLnk.begin(), objsLnk.end(), obj) != objsLnk.end()) {
|
||||
if ( ! obj->isDeleting () ) {
|
||||
obj->getDocument ()->remObject (obj->getNameInDocument());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
101
src/App/Origin.h
101
src/App/Origin.h
@@ -1,5 +1,6 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) Stefan Tröger (stefantroeger@gmx.net) 2015 *
|
||||
* Copyright (c) Alexander Golubev (Fat-Zer) <fatzer2@gmail.com> 2015 *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
@@ -24,23 +25,21 @@
|
||||
#ifndef APP_Origin_H
|
||||
#define APP_Origin_H
|
||||
|
||||
#include "GeoFeatureGroup.h"
|
||||
#include "GeoFeature.h"
|
||||
|
||||
#include "OriginFeature.h"
|
||||
#include "PropertyLinks.h"
|
||||
|
||||
|
||||
|
||||
namespace App
|
||||
{
|
||||
|
||||
|
||||
/** Base class of all geometric document objects.
|
||||
*/
|
||||
class AppExport Origin : public App::GeoFeatureGroup
|
||||
class AppExport Origin : public App::DocumentObject
|
||||
{
|
||||
PROPERTY_HEADER(App::Origin);
|
||||
|
||||
public:
|
||||
|
||||
/// Constructor
|
||||
Origin(void);
|
||||
virtual ~Origin();
|
||||
@@ -49,11 +48,95 @@ public:
|
||||
virtual const char* getViewProviderName(void) const {
|
||||
return "Gui::ViewProviderOrigin";
|
||||
}
|
||||
};
|
||||
|
||||
//typedef App::FeaturePythonT<Origin> OriginPython;
|
||||
/** @name Axis and plane access
|
||||
* This functions returns casted axis and planes objects and asserts they are setted correctly
|
||||
* otherwice Base::Exception is thrown.
|
||||
*/
|
||||
///@{
|
||||
// returns X axis
|
||||
App::Line *getX () const {
|
||||
return getAxis ("X_Axis");
|
||||
}
|
||||
// returns Y axis
|
||||
App::Line *getY () const {
|
||||
return getAxis ("Y_Axis");
|
||||
}
|
||||
// returns Z axis
|
||||
App::Line *getZ () const {
|
||||
return getAxis ("Z_Axis");
|
||||
}
|
||||
|
||||
// returns XY plane
|
||||
App::Plane *getXY () const {
|
||||
return getPlane ("XY_Plane");
|
||||
}
|
||||
// returns XZ plane
|
||||
App::Plane *getXZ () const {
|
||||
return getPlane ("XZ_Plane");
|
||||
}
|
||||
// returns YZ plane
|
||||
App::Plane *getYZ () const {
|
||||
return getPlane ("YZ_Plane");
|
||||
}
|
||||
|
||||
/// Returns all axis objects to iterate on them
|
||||
std::vector<App::Line *> axes() const {
|
||||
return { getX(), getY(), getZ() };
|
||||
}
|
||||
|
||||
/// Returns all base planes objects to iterate on them
|
||||
std::vector<App::Plane *> planes() const {
|
||||
return { getXY(), getXZ(), getYZ() };
|
||||
}
|
||||
|
||||
/// Returns all controled objects (both planes and axis) to iterate on them
|
||||
std::vector<App::OriginFeature *> baseObjects() const {
|
||||
return { getX(), getY(), getZ(), getXY(), getXZ(), getYZ() };
|
||||
}
|
||||
|
||||
/// Returns an axis by it's name
|
||||
App::OriginFeature *getOriginFeature( const char* role ) const;
|
||||
|
||||
/// Returns an axis by it's name
|
||||
App::Line *getAxis( const char* role ) const;
|
||||
|
||||
/// Returns an axis by it's name
|
||||
App::Plane *getPlane( const char* role ) const;
|
||||
///@}
|
||||
|
||||
/// Returns true if the given object is part of the origin
|
||||
bool hasObject (DocumentObject *obj) const;
|
||||
|
||||
/// Returns the default bounding box of the origin (use this if you confused what should be s )
|
||||
// TODO Delete me if not really needed (2015-09-01, Fat-Zer)
|
||||
static Base::BoundBox3d defaultBoundBox();
|
||||
|
||||
/// Returns true on changing OriginFeature set
|
||||
virtual short mustExecute(void) const;
|
||||
|
||||
/// Axis types
|
||||
static const char* AxisRoles[3];
|
||||
/// Baseplane types
|
||||
static const char* PlaneRoles[3];
|
||||
|
||||
// Axis links
|
||||
PropertyLinkList OriginFeatures;
|
||||
|
||||
protected:
|
||||
/// Checks integrity of the Origin
|
||||
virtual App::DocumentObjectExecReturn *execute(void);
|
||||
/// Creates all corresponding Axises and Planes objects for the origin if they not linked yet
|
||||
virtual void setupObject ();
|
||||
/// Removes all planes and axis if they are still linked to the document
|
||||
virtual void unsetupObject ();
|
||||
|
||||
private:
|
||||
struct SetupData;
|
||||
void setupOriginFeature (App::PropertyLink &featProp, const SetupData &data);
|
||||
|
||||
};
|
||||
|
||||
} //namespace App
|
||||
|
||||
|
||||
#endif // APP_Origin_H
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) Stefan Tröger (stefantroeger@gmx.net) 2015 *
|
||||
* Copyright (c) 2015 Alexander Golubev (Fat-Zer) <fatzer2@gmail.com> *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
@@ -20,43 +20,50 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
#endif
|
||||
|
||||
#include "Document.h"
|
||||
#include "Origin.h"
|
||||
|
||||
#include "Line.h"
|
||||
#include "OriginFeature.h"
|
||||
|
||||
using namespace App;
|
||||
|
||||
PROPERTY_SOURCE(App::OriginFeature, App::GeoFeature)
|
||||
PROPERTY_SOURCE(App::Plane, App::OriginFeature)
|
||||
PROPERTY_SOURCE(App::Line, App::OriginFeature)
|
||||
|
||||
PROPERTY_SOURCE(App::Line, App::GeoFeature)
|
||||
|
||||
|
||||
//===========================================================================
|
||||
// Feature
|
||||
//===========================================================================
|
||||
|
||||
Line::Line(void)
|
||||
OriginFeature::OriginFeature()
|
||||
{
|
||||
ADD_PROPERTY(LineType,(""));
|
||||
ADD_PROPERTY_TYPE ( Role, (""), 0, App::Prop_ReadOnly, "Role of the feature in the Origin" ) ;
|
||||
|
||||
// Set placement to read-only
|
||||
Placement.StatusBits.set(3, true);
|
||||
|
||||
}
|
||||
|
||||
Line::~Line(void)
|
||||
{
|
||||
OriginFeature::~OriginFeature()
|
||||
{ }
|
||||
|
||||
// Base::BoundBox3d OriginFeature::getBoundBox()
|
||||
// {
|
||||
// return Base::BoundBox3d(-10, -10, -10, 10, 10, 10);
|
||||
// }
|
||||
|
||||
Origin * OriginFeature::getOrigin () {
|
||||
App::Document *doc = getDocument();
|
||||
auto origins = doc->getObjectsOfType ( App::Origin::getClassTypeId() );
|
||||
|
||||
auto originIt= std::find_if (origins.begin(), origins.end(), [this] (DocumentObject *origin) {
|
||||
assert ( origin->isDerivedFrom ( App::Origin::getClassTypeId() ) );
|
||||
return static_cast<App::Origin *> (origin)->hasObject (this);
|
||||
} );
|
||||
if (originIt == origins.end()) {
|
||||
return 0;
|
||||
} else {
|
||||
assert ( (*originIt)->isDerivedFrom ( App::Origin::getClassTypeId() ) );
|
||||
return static_cast<App::Origin *> (*originIt);
|
||||
}
|
||||
}
|
||||
|
||||
Base::BoundBox3d Line::getBoundBox()
|
||||
{
|
||||
return Base::BoundBox3d(-10, -10, -10, 10, 10, 10);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -20,50 +20,50 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef _AppPlane_h_
|
||||
#define _AppPlane_h_
|
||||
|
||||
#ifndef ORIGINFEATURE_H_6ZWJPB5V
|
||||
#define ORIGINFEATURE_H_6ZWJPB5V
|
||||
|
||||
#include "GeoFeature.h"
|
||||
#include "PropertyGeo.h"
|
||||
|
||||
|
||||
|
||||
namespace App
|
||||
{
|
||||
|
||||
class Origin;
|
||||
|
||||
/** Plane Object
|
||||
* Used to define planar support for all kind of operations in the document space
|
||||
*/
|
||||
class AppExport Plane: public App::GeoFeature
|
||||
class AppExport OriginFeature: public App::GeoFeature
|
||||
{
|
||||
PROPERTY_HEADER(App::Plane);
|
||||
|
||||
PROPERTY_HEADER(App::OriginFeature);
|
||||
public:
|
||||
/// additional information about the feature usage (e.g. "BasePlane-XY" or "Axis-X" in a Origin)
|
||||
PropertyString Role;
|
||||
|
||||
/// Constructor
|
||||
Plane(void);
|
||||
virtual ~Plane();
|
||||
/// additional information about the plane usage (e.g. "BasePlane-xy" in a Part)
|
||||
PropertyString PlaneType;
|
||||
/// Constructor
|
||||
OriginFeature(void);
|
||||
virtual ~OriginFeature();
|
||||
|
||||
|
||||
/// returns the type name of the ViewProvider
|
||||
virtual const char* getViewProviderName(void) const {
|
||||
return "Gui::ViewProviderPlane";
|
||||
}
|
||||
|
||||
/// Return the bounding box of the plane (this is always a fixed size)
|
||||
static Base::BoundBox3d getBoundBox();
|
||||
/// Finds the origin object this plane belongs to
|
||||
App::Origin *getOrigin ();
|
||||
};
|
||||
|
||||
class AppExport Plane: public App::OriginFeature {
|
||||
PROPERTY_HEADER(App::OriginFeature);
|
||||
public:
|
||||
virtual const char* getViewProviderName(void) const {
|
||||
return "Gui::ViewProviderPlane";
|
||||
}
|
||||
};
|
||||
|
||||
class AppExport Line: public App::OriginFeature {
|
||||
PROPERTY_HEADER(App::OriginFeature);
|
||||
public:
|
||||
virtual const char* getViewProviderName(void) const {
|
||||
return "Gui::ViewProviderLine";
|
||||
}
|
||||
};
|
||||
|
||||
} //namespace App
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* end of include guard: ORIGINFEATURE_H_6ZWJPB5V */
|
||||
@@ -27,7 +27,6 @@
|
||||
#endif
|
||||
|
||||
#include <App/Document.h>
|
||||
#include <App/Plane.h>
|
||||
|
||||
#include "Part.h"
|
||||
#include "PartPy.h"
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (c) Jürgen Riegel (juergen.riegel@web.de) 2012 *
|
||||
* *
|
||||
* This file is part of the FreeCAD CAx development system. *
|
||||
* *
|
||||
* This library is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU Library General Public *
|
||||
* License as published by the Free Software Foundation; either *
|
||||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Library General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Library General Public *
|
||||
* License along with this library; see the file COPYING.LIB. If not, *
|
||||
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
||||
* Suite 330, Boston, MA 02111-1307, USA *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
#endif
|
||||
|
||||
|
||||
#include "Plane.h"
|
||||
|
||||
using namespace App;
|
||||
|
||||
|
||||
PROPERTY_SOURCE(App::Plane, App::GeoFeature)
|
||||
|
||||
|
||||
//===========================================================================
|
||||
// Feature
|
||||
//===========================================================================
|
||||
|
||||
Plane::Plane(void)
|
||||
{
|
||||
ADD_PROPERTY(PlaneType,(""));
|
||||
Placement.StatusBits.set(3, true);
|
||||
|
||||
}
|
||||
|
||||
Plane::~Plane(void)
|
||||
{
|
||||
}
|
||||
|
||||
Base::BoundBox3d Plane::getBoundBox()
|
||||
{
|
||||
return Base::BoundBox3d(-10, -10, -10, 10, 10, 10);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user