Commit ebc9a440 authored by Berk Geveci's avatar Berk Geveci
Browse files

ENH: Adding proper events to domains

parent da5ec64a
......@@ -29,7 +29,7 @@
#include "vtkStdString.h"
vtkStandardNewMacro(vtkSMArrayListDomain);
vtkCxxRevisionMacro(vtkSMArrayListDomain, "1.6");
vtkCxxRevisionMacro(vtkSMArrayListDomain, "1.7");
struct vtkSMArrayListDomainInternals
{
......@@ -115,6 +115,8 @@ void vtkSMArrayListDomain::Update(vtkSMSourceProxy* sp,
{
this->AddArrays(sp, info->GetCellDataInformation(), iad);
}
this->InvokeModified();
}
//---------------------------------------------------------------------------
......@@ -181,7 +183,7 @@ void vtkSMArrayListDomain::Update(vtkSMProxyProperty* pp)
}
//---------------------------------------------------------------------------
void vtkSMArrayListDomain::Update(vtkSMProperty*)
void vtkSMArrayListDomain::Update(vtkSMProperty* prop)
{
this->RemoveAllStrings();
......
......@@ -27,7 +27,7 @@
#include "vtkSMStringVectorProperty.h"
vtkStandardNewMacro(vtkSMArrayRangeDomain);
vtkCxxRevisionMacro(vtkSMArrayRangeDomain, "1.7");
vtkCxxRevisionMacro(vtkSMArrayRangeDomain, "1.8");
//---------------------------------------------------------------------------
vtkSMArrayRangeDomain::vtkSMArrayRangeDomain()
......@@ -40,7 +40,7 @@ vtkSMArrayRangeDomain::~vtkSMArrayRangeDomain()
}
//---------------------------------------------------------------------------
void vtkSMArrayRangeDomain::Update(vtkSMProperty*)
void vtkSMArrayRangeDomain::Update(vtkSMProperty* prop)
{
this->RemoveAllMinima();
this->RemoveAllMaxima();
......@@ -68,9 +68,17 @@ void vtkSMArrayRangeDomain::Update(vtkSMProperty*)
return;
}
if (array->GetNumberOfUncheckedElements() < 5)
{
return;
}
const char* arrayName = array->GetUncheckedElement(4);
if (!arrayName || arrayName[0] == '\0')
{
if (array->GetNumberOfElements() < 5)
{
return;
}
arrayName = array->GetElement(4);
}
......@@ -89,6 +97,7 @@ void vtkSMArrayRangeDomain::Update(vtkSMProperty*)
if (source)
{
this->Update(arrayName, ip, source);
this->InvokeModified();
return;
}
}
......@@ -103,6 +112,7 @@ void vtkSMArrayRangeDomain::Update(vtkSMProperty*)
if (source)
{
this->Update(arrayName, ip, source);
this->InvokeModified();
return;
}
}
......
......@@ -18,7 +18,7 @@
#include "vtkSMStringVectorProperty.h"
vtkStandardNewMacro(vtkSMArraySelectionDomain);
vtkCxxRevisionMacro(vtkSMArraySelectionDomain, "1.1");
vtkCxxRevisionMacro(vtkSMArraySelectionDomain, "1.2");
//---------------------------------------------------------------------------
vtkSMArraySelectionDomain::vtkSMArraySelectionDomain()
......@@ -50,6 +50,7 @@ void vtkSMArraySelectionDomain::Update(vtkSMProperty* prop)
{
this->AddString(svp->GetElement(i*2));
}
this->InvokeModified();
}
}
......
......@@ -22,7 +22,7 @@
#include "vtkSMSourceProxy.h"
vtkStandardNewMacro(vtkSMBoundsDomain);
vtkCxxRevisionMacro(vtkSMBoundsDomain, "1.6");
vtkCxxRevisionMacro(vtkSMBoundsDomain, "1.7");
vtkCxxSetObjectMacro(vtkSMBoundsDomain,InputInformation,vtkPVDataInformation)
......@@ -49,6 +49,7 @@ void vtkSMBoundsDomain::Update(vtkSMProperty*)
if (this->Mode == vtkSMBoundsDomain::ORIENTED_MAGNITUDE)
{
this->UpdateOriented();
this->InvokeModified();
return;
}
......@@ -57,6 +58,7 @@ void vtkSMBoundsDomain::Update(vtkSMProperty*)
if (pp)
{
this->Update(pp);
this->InvokeModified();
}
}
......@@ -98,10 +100,27 @@ void vtkSMBoundsDomain::UpdateOriented()
double normalv[3], originv[3];
unsigned int i;
for (i=0; i<3; i++)
if (normal->GetNumberOfUncheckedElements() > 2 &&
origin->GetNumberOfUncheckedElements() > 2)
{
normalv[i] = normal->GetUncheckedElement(i);
originv[i] = origin->GetUncheckedElement(i);
for (i=0; i<3; i++)
{
normalv[i] = normal->GetUncheckedElement(i);
originv[i] = origin->GetUncheckedElement(i);
}
}
else if (normal->GetNumberOfElements() > 2 &&
origin->GetNumberOfElements() > 2)
{
for (i=0; i<3; i++)
{
normalv[i] = normal->GetElement(i);
originv[i] = origin->GetElement(i);
}
}
else
{
return;
}
unsigned int j;
......
......@@ -14,6 +14,7 @@
=========================================================================*/
#include "vtkSMDomain.h"
#include "vtkCommand.h"
#include "vtkPVXMLElement.h"
#include "vtkSMProperty.h"
#include "vtkSmartPointer.h"
......@@ -21,7 +22,7 @@
#include <vtkstd/map>
#include "vtkStdString.h"
vtkCxxRevisionMacro(vtkSMDomain, "1.9");
vtkCxxRevisionMacro(vtkSMDomain, "1.10");
struct vtkSMDomainInternals
{
......@@ -140,6 +141,12 @@ void vtkSMDomain::AddRequiredProperty(vtkSMProperty *prop,
this->Internals->RequiredProperties[function] = prop;
}
//---------------------------------------------------------------------------
void vtkSMDomain::InvokeModified()
{
this->InvokeEvent(vtkCommand::DomainModifiedEvent, 0);
}
//---------------------------------------------------------------------------
void vtkSMDomain::PrintSelf(ostream& os, vtkIndent indent)
{
......
......@@ -49,7 +49,7 @@ public:
// Description:
// Update self based on the "unchecked" values of all required
// properties. Overwritten by sub-classes.
virtual void Update(vtkSMProperty*) {};
virtual void Update(vtkSMProperty*) {this->InvokeModified();};
// Description:
// Set the value of an element of a property from the animation editor.
......@@ -107,6 +107,9 @@ protected:
vtkSMDomainInternals* Internals;
// Description:
// Invoked DomainModifiedEvent.
void InvokeModified();
private:
vtkSMDomain(const vtkSMDomain&); // Not implemented
......
......@@ -21,7 +21,7 @@
#include <vtkstd/vector>
vtkStandardNewMacro(vtkSMDoubleRangeDomain);
vtkCxxRevisionMacro(vtkSMDoubleRangeDomain, "1.15");
vtkCxxRevisionMacro(vtkSMDoubleRangeDomain, "1.16");
struct vtkSMDoubleRangeDomainInternals
{
......@@ -404,6 +404,7 @@ void vtkSMDoubleRangeDomain::Update(vtkSMProperty* prop)
this->AddMaximum(i/2, dvp->GetElement(i));
}
}
this->InvokeModified();
}
}
......
......@@ -21,7 +21,7 @@
#include "vtkSMSourceProxy.h"
vtkStandardNewMacro(vtkSMExtentDomain);
vtkCxxRevisionMacro(vtkSMExtentDomain, "1.4");
vtkCxxRevisionMacro(vtkSMExtentDomain, "1.5");
//---------------------------------------------------------------------------
vtkSMExtentDomain::vtkSMExtentDomain()
......@@ -44,6 +44,7 @@ void vtkSMExtentDomain::Update(vtkSMProperty*)
if (pp)
{
this->Update(pp);
this->InvokeModified();
}
}
......@@ -61,7 +62,7 @@ void vtkSMExtentDomain::Update(vtkSMProxyProperty *pp)
vtkPVDataInformation *info = sp->GetDataInformation();
if (!info)
{
return;
continue;
}
int extent[6];
info->GetExtent(extent);
......@@ -70,6 +71,33 @@ void vtkSMExtentDomain::Update(vtkSMProxyProperty *pp)
this->AddMinimum(j, extent[2*j]);
this->AddMaximum(j, extent[2*j+1]);
}
this->InvokeModified();
return;
}
}
// In case there is no valid unchecked proxy, use the actual
// proxy values
numProxs = pp->GetNumberOfProxies();
for (i=0; i<numProxs; i++)
{
vtkSMSourceProxy* sp =
vtkSMSourceProxy::SafeDownCast(pp->GetProxy(i));
if (sp)
{
vtkPVDataInformation *info = sp->GetDataInformation();
if (!info)
{
continue;
}
int extent[6];
info->GetExtent(extent);
for (j = 0; j < 3; j++)
{
this->AddMinimum(j, extent[2*j]);
this->AddMaximum(j, extent[2*j+1]);
}
this->InvokeModified();
return;
}
}
......
......@@ -25,7 +25,7 @@
#include "vtkSMSourceProxy.h"
vtkStandardNewMacro(vtkSMFieldDataDomain);
vtkCxxRevisionMacro(vtkSMFieldDataDomain, "1.4");
vtkCxxRevisionMacro(vtkSMFieldDataDomain, "1.5");
//---------------------------------------------------------------------------
vtkSMFieldDataDomain::vtkSMFieldDataDomain()
......@@ -77,6 +77,7 @@ void vtkSMFieldDataDomain::Update(vtkSMSourceProxy* sp,
this->AddEntry("Cell Data", vtkDataObject::FIELD_ASSOCIATION_CELLS);
}
this->InvokeModified();
}
//---------------------------------------------------------------------------
......
......@@ -21,7 +21,7 @@
#include <vtkstd/vector>
vtkStandardNewMacro(vtkSMIntRangeDomain);
vtkCxxRevisionMacro(vtkSMIntRangeDomain, "1.14");
vtkCxxRevisionMacro(vtkSMIntRangeDomain, "1.15");
struct vtkSMIntRangeDomainInternals
{
......@@ -396,6 +396,7 @@ void vtkSMIntRangeDomain::Update(vtkSMProperty* prop)
this->AddMaximum(i/2, ivp->GetElement(i));
}
}
this->InvokeModified();
}
}
......
......@@ -23,7 +23,7 @@
#include "vtkStdString.h"
vtkStandardNewMacro(vtkSMStringListDomain);
vtkCxxRevisionMacro(vtkSMStringListDomain, "1.13");
vtkCxxRevisionMacro(vtkSMStringListDomain, "1.14");
struct vtkSMStringListDomainInternals
{
......@@ -153,6 +153,7 @@ void vtkSMStringListDomain::Update(vtkSMProperty* prop)
{
this->AddString(svp->GetElement(i));
}
this->InvokeModified();
}
}
......
......@@ -18,7 +18,7 @@
#include "vtkSMStringVectorProperty.h"
vtkStandardNewMacro(vtkSMXDMFPropertyDomain);
vtkCxxRevisionMacro(vtkSMXDMFPropertyDomain, "1.1");
vtkCxxRevisionMacro(vtkSMXDMFPropertyDomain, "1.2");
//---------------------------------------------------------------------------
vtkSMXDMFPropertyDomain::vtkSMXDMFPropertyDomain()
......@@ -55,6 +55,7 @@ void vtkSMXDMFPropertyDomain::Update(vtkSMProperty* prop)
int max = min + atoi(svp->GetElement(i*5+4)) - 1;
this->AddMaximum(i, max);
}
this->InvokeModified();
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment