Correct delayed update when adding views to ProjectionGroup
This commit is contained in:
committed by
Yorik van Havre
parent
6abce56595
commit
a912ccd9bb
@@ -292,6 +292,7 @@ App::DocumentObject * DrawProjGroup::addProjection(const char *viewProjType)
|
||||
|
||||
addView(view); //from DrawViewCollection - add to ProjGroup Views
|
||||
moveToCentre();
|
||||
view->recompute();
|
||||
}
|
||||
|
||||
return view;
|
||||
|
||||
@@ -114,25 +114,11 @@ public:
|
||||
/// Allowed projection types - either Document, First Angle or Third Angle
|
||||
static const char* ProjectionTypeEnums[];
|
||||
|
||||
protected:
|
||||
void onChanged(const App::Property* prop);
|
||||
|
||||
//! Moves anchor view to keep our bounding box centre on the origin
|
||||
void moveToCentre();
|
||||
|
||||
/// Annoying helper - keep in sync with DrawProjGroupItem::TypeEnums
|
||||
/*!
|
||||
* \TODO See note regarding App::PropertyEnumeration on my wiki page http://freecadweb.org/wiki/index.php?title=User:Ian.rees
|
||||
* \return true iff 'in' is a valid name for an orthographic/isometric view
|
||||
*/
|
||||
bool checkViewProjType(const char *in);
|
||||
|
||||
/// Sets Direction and XAxisDirection in v
|
||||
/// Sets Direction in v
|
||||
/*!
|
||||
* Applies viewOrientationMatrix to appropriate unit vectors depending on projType
|
||||
*/
|
||||
void setViewOrientation(DrawProjGroupItem *v, const char *projType) const;
|
||||
|
||||
/// Populates an array of DrawProjGroupItem*s arranged for drawing
|
||||
/*!
|
||||
* Setup array of pointers to the views that we're displaying,
|
||||
@@ -151,6 +137,20 @@ protected:
|
||||
* FTRight T FTL
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
protected:
|
||||
void onChanged(const App::Property* prop);
|
||||
|
||||
//! Moves anchor view to keep our bounding box centre on the origin
|
||||
void moveToCentre();
|
||||
|
||||
/// Annoying helper - keep in sync with DrawProjGroupItem::TypeEnums
|
||||
/*!
|
||||
* \TODO See note regarding App::PropertyEnumeration on my wiki page http://freecadweb.org/wiki/index.php?title=User:Ian.rees
|
||||
* \return true iff 'in' is a valid name for an orthographic/isometric view
|
||||
*/
|
||||
bool checkViewProjType(const char *in);
|
||||
|
||||
void arrangeViewPointers(DrawProjGroupItem *viewPtrs[10]) const;
|
||||
|
||||
/// Populates array of 10 BoundBox3d's given DrawProjGroupItem *s
|
||||
|
||||
@@ -33,6 +33,11 @@
|
||||
<UserDocu>getItemByLabel(string projectionType) - return specified Projection Item</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="setViewOrientation">
|
||||
<Documentation>
|
||||
<UserDocu>setViewOrientation(DrawProjGroupItem item, string projectionType) - sets item's view Direction according to projectionType</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<CustomAttributes />
|
||||
</PythonExport>
|
||||
</GenerateModel>
|
||||
|
||||
@@ -24,8 +24,7 @@ PyObject* DrawProjGroupPy::addProjection(PyObject* args)
|
||||
const char* projType;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s", &projType)) {
|
||||
Base::Console().Error("Error: DrawProjGroupPy::addProjection - Bad Arg - not string\n");
|
||||
return NULL;
|
||||
throw Py::Exception();
|
||||
}
|
||||
|
||||
DrawProjGroup* projGroup = getDrawProjGroupPtr();
|
||||
@@ -40,8 +39,7 @@ PyObject* DrawProjGroupPy::removeProjection(PyObject* args)
|
||||
const char* projType;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s", &projType)) {
|
||||
Base::Console().Error("Error: DrawProjGroupPy::removeProjection - Bad Arg - not string\n");
|
||||
return NULL;
|
||||
throw Py::Exception();
|
||||
}
|
||||
|
||||
DrawProjGroup* projGroup = getDrawProjGroupPtr();
|
||||
@@ -63,8 +61,7 @@ PyObject* DrawProjGroupPy::getItemByLabel(PyObject* args)
|
||||
const char* projType;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s", &projType)) {
|
||||
Base::Console().Error("Error: DrawProjGroupPy::getItemByLabel - Bad Arg - not string\n");
|
||||
return NULL;
|
||||
throw Py::Exception();
|
||||
}
|
||||
|
||||
DrawProjGroup* projGroup = getDrawProjGroupPtr();
|
||||
@@ -74,6 +71,27 @@ PyObject* DrawProjGroupPy::getItemByLabel(PyObject* args)
|
||||
return new DrawProjGroupItemPy(newProj);
|
||||
}
|
||||
|
||||
PyObject* DrawProjGroupPy::setViewOrientation(PyObject* args)
|
||||
{
|
||||
const char* projType;
|
||||
PyObject* pcObj;
|
||||
if (!PyArg_ParseTuple(args, "Os", &pcObj,&projType))
|
||||
throw Py::Exception();
|
||||
|
||||
App::DocumentObject* obj = static_cast<App::DocumentObjectPy*>(pcObj)->getDocumentObjectPtr();
|
||||
if (obj->getTypeId().isDerivedFrom(TechDraw::DrawProjGroupItem::getClassTypeId())) {
|
||||
TechDraw::DrawProjGroupItem* view = static_cast<TechDraw::DrawProjGroupItem*>(obj);
|
||||
TechDraw::DrawProjGroup* projGroup = getDrawProjGroupPtr();
|
||||
projGroup->setViewOrientation( view, projType );
|
||||
|
||||
} else {
|
||||
Base::Console().Message("'%s' is not a DrawProjGroup Item, it will be ignored.\n", obj->Label.getValue());
|
||||
}
|
||||
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
|
||||
PyObject *DrawProjGroupPy::getCustomAttributes(const char* /*attr*/) const
|
||||
{
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user