Commit 084a2a32 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Adding support for chart representations.

Chart representations now seem to work in builtin mode. Still needs some work to
get them working in client-server mode.
parent d177dc90
......@@ -22,6 +22,7 @@ SET (Kit_SRCS
vtkInitializationHelper.cxx
# --- PM Objects ---
vtkPMArraySelectionProperty.cxx
vtkPMChartRepresentationProxy.cxx
vtkPMCompoundSourceProxy.cxx
vtkPMContextArraysProperty.cxx
vtkPMDataArrayProperty.cxx
......
/*=========================================================================
Program: ParaView
Module: $RCSfile$
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkPMChartRepresentationProxy.h"
#include "vtkChartRepresentation.h"
#include "vtkContextNamedOptions.h"
#include "vtkObjectFactory.h"
vtkStandardNewMacro(vtkPMChartRepresentationProxy);
//----------------------------------------------------------------------------
vtkPMChartRepresentationProxy::vtkPMChartRepresentationProxy()
{
}
//----------------------------------------------------------------------------
vtkPMChartRepresentationProxy::~vtkPMChartRepresentationProxy()
{
}
//----------------------------------------------------------------------------
void vtkPMChartRepresentationProxy::OnCreateVTKObjects()
{
vtkPMProxy* optionsProxy = this->GetSubProxyHelper("PlotOptions");
if (optionsProxy)
{
vtkContextNamedOptions* options = vtkContextNamedOptions::SafeDownCast(
optionsProxy->GetVTKObject());
vtkChartRepresentation* repr = vtkChartRepresentation::SafeDownCast(
this->GetVTKObject());
repr->SetOptions(options);
}
}
//----------------------------------------------------------------------------
void vtkPMChartRepresentationProxy::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
}
/*=========================================================================
Program: ParaView
Module: $RCSfile$
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkPMChartRepresentationProxy
// .SECTION Description
// vtkPMChartRepresentationProxy is the server-side helper for
// vtkSMChartRepresentationProxy. It initializes the vtkXYChartRepresentation
// instance with the vtkContextNamedOptions instance sub-proxy, if any during
// CreateVTKObjects().
#ifndef __vtkPMChartRepresentationProxy_h
#define __vtkPMChartRepresentationProxy_h
#include "vtkPMSourceProxy.h"
class VTK_EXPORT vtkPMChartRepresentationProxy : public vtkPMSourceProxy
{
public:
static vtkPMChartRepresentationProxy* New();
vtkTypeMacro(vtkPMChartRepresentationProxy, vtkPMSourceProxy);
void PrintSelf(ostream& os, vtkIndent indent);
//BTX
protected:
vtkPMChartRepresentationProxy();
~vtkPMChartRepresentationProxy();
// Description;
// Called in CreateVTKObjects() after the vtk-object has been created and
// subproxy-information has been processed, but before the XML is parsed to
// generate properties and initialize their values.
virtual void OnCreateVTKObjects();
private:
vtkPMChartRepresentationProxy(const vtkPMChartRepresentationProxy&); // Not implemented
void operator=(const vtkPMChartRepresentationProxy&); // Not implemented
//ETX
};
#endif
......@@ -320,6 +320,10 @@ bool vtkPMProxy::CreateVTKObjects(vtkSMMessage* message)
this->Internals->SubProxyHelpers[subproxyMsg.name()] = subproxy;
}
// Allow subclasses to do some initialization if needed. Note this is called
// before properties are created.
this->OnCreateVTKObjects();
// Process the XML and update properties etc.
if (!this->ReadXMLAttributes(element))
{
......@@ -359,6 +363,11 @@ void vtkPMProxy::DeleteVTKObjects()
this->VTKObjectID = vtkClientServerID();
}
//----------------------------------------------------------------------------
void vtkPMProxy::OnCreateVTKObjects()
{
}
//----------------------------------------------------------------------------
vtkObjectBase* vtkPMProxy::GetVTKObject()
{
......
......@@ -96,6 +96,12 @@ protected:
virtual bool CreateVTKObjects(vtkSMMessage* message);
void DeleteVTKObjects();
// Description;
// Called in CreateVTKObjects() after the vtk-object has been created and
// subproxy-information has been processed, but before the XML is parsed to
// generate properties and initialize their values.
virtual void OnCreateVTKObjects();
// Description:
// Parses the XML to create property/subproxy helpers.
virtual bool ReadXMLAttributes(vtkPVXMLElement* element);
......
......@@ -16,15 +16,14 @@
#include "vtkChartRepresentation.h"
#include "vtkClientServerStream.h"
#include "vtkContextNamedOptions.h"
#include "vtkObjectFactory.h"
#include "vtkProcessModule.h"
#include "vtkSMPropertyHelper.h"
vtkStandardNewMacro(vtkSMChartRepresentationProxy);
//----------------------------------------------------------------------------
vtkSMChartRepresentationProxy::vtkSMChartRepresentationProxy()
{
this->SetKernelClassName("vtkPMChartRepresentationProxy");
}
//----------------------------------------------------------------------------
......@@ -69,27 +68,3 @@ void vtkSMChartRepresentationProxy::AddInput(unsigned int inputPort,
}
}
#endif
//-----------------------------------------------------------------------------
void vtkSMChartRepresentationProxy::CreateVTKObjects()
{
if (this->ObjectsCreated)
{
return;
}
this->Superclass::CreateVTKObjects();
if (!this->ObjectsCreated)
{
return;
}
vtkSMProxy* optionsProxy = this->GetSubProxy("PlotOptions");
if (optionsProxy)
{
vtkContextNamedOptions* options = vtkContextNamedOptions::SafeDownCast(
optionsProxy->GetClientSideObject());
vtkChartRepresentation* repr = vtkChartRepresentation::SafeDownCast(
this->GetClientSideObject());
repr->SetOptions(options);
}
}
......@@ -51,8 +51,6 @@ protected:
vtkSMChartRepresentationProxy();
~vtkSMChartRepresentationProxy();
virtual void CreateVTKObjects();
private:
vtkSMChartRepresentationProxy(const vtkSMChartRepresentationProxy&); // Not implemented
void operator=(const vtkSMChartRepresentationProxy&); // Not implemented
......
......@@ -17,6 +17,7 @@
#include "vtkContextNamedOptions.h"
#include "vtkObjectFactory.h"
#include "vtkSmartPointer.h"
#include "vtkSMPropertyIterator.h"
#include "vtkSMStringVectorProperty.h"
#include "vtkStdString.h"
#include "vtkStringList.h"
......@@ -42,6 +43,20 @@ void vtkSMContextNamedOptionsProxy::UpdatePropertyInformationInternal(
vtkContextNamedOptions* options = vtkContextNamedOptions::SafeDownCast(
this->GetClientSideObject());
if (prop == NULL)
{
// update property information for all info properties.
vtkSMPropertyIterator* iter = this->NewPropertyIterator();
for (iter->Begin(); !iter->IsAtEnd(); iter->Next())
{
if (iter->GetProperty() && iter->GetProperty()->GetInformationOnly())
{
this->UpdatePropertyInformationInternal(iter->GetProperty());
}
}
iter->Delete();
}
vtkSMStringVectorProperty* svp = vtkSMStringVectorProperty::SafeDownCast(prop);
if (!svp || !svp->GetInformationOnly() || !options)
{
......
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