Commit 1fa6db82 authored by Ken Martin's avatar Ken Martin
Browse files

ENH: added matheius corner anno fix

parent d9cdf031
......@@ -55,7 +55,7 @@
#include "vtkMath.h"
//----------------------------------------------------------------------------
vtkStandardNewMacro(vtkPVColorMap);
vtkCxxRevisionMacro(vtkPVColorMap, "1.104");
vtkCxxRevisionMacro(vtkPVColorMap, "1.104.2.1");
int vtkPVColorMapCommand(ClientData cd, Tcl_Interp *interp,
int argc, char *argv[]);
......@@ -1388,6 +1388,85 @@ void vtkPVColorMap::SaveInBatchScript(ofstream *file)
*file << " $pvTemp" << lookupTableID << " Build"
<< endl;
*file << endl;
if (this->ScalarBarVisibility)
{
*file << endl;
// First thing define the TextProperty (Title and Label )
ostrstream pvTitle, pvLabel;
pvTitle << "pvTitle" << this->RMScalarBarWidget->ScalarBarActorID << ends;
this->TitleTextPropertyWidget->SaveInBatchScript( pvTitle.str(), file );
pvLabel << "pvLabel" << this->RMScalarBarWidget->ScalarBarActorID << ends;
this->LabelTextPropertyWidget->SaveInBatchScript( pvLabel.str(), file );
*file << "set pvTemp" << this->RMScalarBarWidget->ScalarBarActorID
<< " [$proxyManager NewProxy rendering ScalarBarActor]"
<< endl;
*file << " $proxyManager RegisterProxy scalar_bar pvTemp"
<< this->RMScalarBarWidget->ScalarBarActorID << " $pvTemp" << this->RMScalarBarWidget->ScalarBarActorID
<< endl;
*file << " $pvTemp" << this->RMScalarBarWidget->ScalarBarActorID << " UnRegister {}" << endl;
*file << " [$pvTemp" << this->RMScalarBarWidget->ScalarBarActorID
<< " GetProperty LookupTable] AddProxy $pvTemp"
<< this->RMScalarBarWidget->LookupTableID << endl;
*file << " [$pvTemp" << this->RMScalarBarWidget->ScalarBarActorID
<< " GetProperty TitleTextProperty] AddProxy $" << pvTitle.str()
<< endl;
*file << " [$pvTemp" << this->RMScalarBarWidget->ScalarBarActorID
<< " GetProperty LabelTextProperty] AddProxy $" << pvLabel.str()
<< endl;
*file << " [$pvTemp" << this->RMScalarBarWidget->ScalarBarActorID
<< " GetProperty Orientation] SetElements1 "
<< this->RMScalarBarWidget->ScalarBar->GetScalarBarActor()->GetOrientation() << endl;
*file << " [$pvTemp" << this->RMScalarBarWidget->ScalarBarActorID
<< " GetProperty Width] SetElements1 "
<< this->RMScalarBarWidget->ScalarBar->GetScalarBarActor()->GetWidth() << endl;
*file << " [$pvTemp" << this->RMScalarBarWidget->ScalarBarActorID
<< " GetProperty Height] SetElements1 "
<< this->RMScalarBarWidget->ScalarBar->GetScalarBarActor()->GetHeight() << endl;
const double *pos =
this->RMScalarBarWidget->ScalarBar->GetScalarBarActor()->GetPositionCoordinate()->GetValue();
*file << " [$pvTemp" << this->RMScalarBarWidget->ScalarBarActorID
<< " GetProperty Position] SetElements2 "
<< pos[0] << " " << pos[1] << endl;
*file << " [$pvTemp" << this->RMScalarBarWidget->ScalarBarActorID
<< " GetProperty Title] SetElement 0 {"
<< this->RMScalarBarWidget->ScalarBar->GetScalarBarActor()->GetTitle() << "}" << endl;
*file << " [$pvTemp" << this->RMScalarBarWidget->ScalarBarActorID
<< " GetProperty LabelFormat] SetElement 0 {"
<< this->RMScalarBarWidget->ScalarBar->GetScalarBarActor()->GetLabelFormat() << "}"
<< endl;
pvTitle.rdbuf()->freeze(0);
pvLabel.rdbuf()->freeze(0);
/* ostrstream ttprop, tlprop;
ttprop << "[$pvTemp" << this->ScalarBarActorID << " GetTitleTextProperty]" << ends;
this->TitleTextPropertyWidget->SaveInBatchScript(file, ttprop.str());
ttprop.rdbuf()->freeze(0);
tlprop << "[$pvTemp" << this->ScalarBarActorID << " GetLabelTextProperty]" << ends;
this->LabelTextPropertyWidget->SaveInBatchScript(file, tlprop.str());
tlprop.rdbuf()->freeze(0);*/
*file << " [$Ren1 GetProperty Displayers] AddProxy $pvTemp" << this->RMScalarBarWidget->ScalarBarActorID << endl;
*file << " $pvTemp" << this->RMScalarBarWidget->ScalarBarActorID << " UpdateVTKObjects"
<< endl;
*file << endl;
}
}
......@@ -1892,4 +1971,3 @@ void vtkPVColorMap::PrintSelf(ostream& os, vtkIndent indent)
os << indent << "VisitedFlag: " << this->VisitedFlag << endl;
os << indent << "ScalarBarCheck: " << this->ScalarBarCheck << endl;
}
......@@ -147,6 +147,7 @@ public:
// Description:
// Save out the mapper and actor to a file.
void SaveInBatchScript(ofstream *file);
void SaveTextPropertyInBatchScript(const char* iden, ofstream *file);
// Description:
// The data needs to lookup table name to set the lookup table of the mapper.
......
......@@ -81,6 +81,8 @@
#include "vtkClientServerStream.h"
#include "vtkPVOptions.h"
#include "vtkCornerAnnotation.h"
#include "vtkKWTextProperty.h"
#ifdef _WIN32
#include "vtkWin32OpenGLRenderWindow.h"
......@@ -136,7 +138,7 @@ public:
//----------------------------------------------------------------------------
vtkStandardNewMacro(vtkPVRenderView);
vtkCxxRevisionMacro(vtkPVRenderView, "1.343");
vtkCxxRevisionMacro(vtkPVRenderView, "1.343.2.1");
int vtkPVRenderViewCommand(ClientData cd, Tcl_Interp *interp,
int argc, char *argv[]);
......@@ -1932,7 +1934,49 @@ void vtkPVRenderView::SaveInBatchScript(ofstream* file)
{
*file << clippingRange[i] << " ";
}
//Don't forget to save the corner annotation:
// As I don't have no ID for the corner annotation, let's use '000'
const char cornId[] = "000";
vtkCornerAnnotation *corn = this->CornerAnnotation->GetCornerAnnotation ();
*file << endl;
*file << endl;
*file << "set pvTemp" << cornId
<< " [$proxyManager NewProxy rendering CornerAnnotation]"
<< endl;
*file << " $proxyManager RegisterProxy corner_annotation pvTemp"
<< cornId << " $pvTemp" << cornId << endl;
*file << " $pvTemp" << cornId << " UnRegister {}" << endl;
*file << " [$pvTemp" << cornId
<< " GetProperty MaximumLineHeight] SetElements1 "
<< corn->GetMaximumLineHeight() << endl;
for(i=0; i<4; i++)
{
*file << " [$pvTemp" << cornId
<< " GetProperty Text] SetElement " << i
<< " {";
if( corn->GetText( i ) )
{
*file << corn->GetText( i );
}
*file << "}" << endl;
}
// [$pvTemp201 GetProperty TextProperty] AddProxy $pvTitle200
vtkKWTextProperty *text = this->CornerAnnotation->GetTextPropertyWidget ();
const char cornTextProp[] = "cornTextProp";
text->SaveInBatchScript( cornTextProp , file );
*file << " [$pvTemp" << cornId
<< " GetProperty TextProperty] AddProxy $" << cornTextProp
<< endl;
*file << " $pvTemp" << cornId << " UpdateVTKObjects " << endl;
*file << " [$Ren1 GetProperty Displayers] AddProxy $pvTemp" << cornId << endl;
// *file << endl;
}
......
......@@ -100,7 +100,7 @@ static unsigned char image_copy[] =
// ----------------------------------------------------------------------------
vtkStandardNewMacro(vtkKWTextProperty);
vtkCxxRevisionMacro(vtkKWTextProperty, "1.34");
vtkCxxRevisionMacro(vtkKWTextProperty, "1.34.6.1");
int vtkKWTextPropertyCommand(ClientData cd, Tcl_Interp *interp,
int argc, char *argv[]);
......@@ -1112,6 +1112,57 @@ void vtkKWTextProperty::SaveInTclScript(ofstream *file,
}
}
//----------------------------------------------------------------------------
// Special method to avoid duplicating code for TitleTextProperty and LabelTextProperty
//
void vtkKWTextProperty::SaveInBatchScript(const char* iden, ofstream *file)
{
// This method was copy / paste / modified from vtkKWTextProperty::SaveInTclScript
// This is really a temporary solution and shouldn't be used in any future
//iden can basically be either pvTitle or pvLabel
*file << "set " << iden
<< " [$proxyManager NewProxy text_properties TextProperty]"
<< endl;
*file << " $proxyManager RegisterProxy text_properties " << iden
<< " $" << iden << endl;
*file << " $" << iden << " UnRegister {}" << endl;
double *rgb = this->GetColor();
*file << " [$" << iden
<< " GetProperty Color] SetElements3 "
<< rgb[0] << " " << rgb[1] << " " << rgb[2]
<< endl;
vtkTextProperty *tprop = this->GetTextProperty();
*file << " [$" << iden
<< " GetProperty FontFamily] SetElements1 "
<< tprop->GetFontFamily() << endl;
*file << " [$" << iden
<< " GetProperty Bold] SetElements1 "
<< tprop->GetBold() << endl;
*file << " [$" << iden
<< " GetProperty Italic] SetElements1 "
<< tprop->GetItalic() << endl;
*file << " [$" << iden
<< " GetProperty Shadow] SetElements1 "
<< tprop->GetShadow() << endl;
*file << " [$" << iden
<< " GetProperty Opacity] SetElements1 "
<< this->GetOpacity() << endl;
*file << " $" << iden << " UpdateVTKObjects"
<< endl; //Extremly important do not forget this line.
*file << endl;
}
//----------------------------------------------------------------------------
void vtkKWTextProperty::UpdateEnableState()
{
......
......@@ -158,6 +158,10 @@ public:
void SaveInTclScript(ofstream *file, const char *tcl_name = 0,
int tabify = 1);
// Description:
// Temporary solution, don't use
void SaveInBatchScript(const char* iden, ofstream *file);
// Description:
// Update the "enable" state of the object and its internal parts.
// Depending on different Ivars (this->Enabled, the application's
......
......@@ -43,7 +43,8 @@ SET_SOURCE_FILES_PROPERTIES(
SET(_VTK_BINARY_DIR "${VTK_BINARY_DIR}")
SET(VTK_BINARY_DIR "${PVCommon_BINARY_DIR}")
INCLUDE(${VTK_SOURCE_DIR}/CMake/vtkExportKit.cmake)
VTK_EXPORT_KIT("PVCommon" "PVFILTERS" "${Common_SRCS}")
VTK_EXPORT_KIT("PVCommon" "PVFILTERS"
"${Common_SRCS};${ParaView_SOURCE_DIR}/Common/KWCommon/vtkCornerAnnotation.cxx")
SET(VTK_BINARY_DIR "${_VTK_BINARY_DIR}")
INCLUDE_DIRECTORIES(
......
......@@ -80,7 +80,8 @@
<StringVectorProperty
name="ColorArray"
command="SelectColorArray"
number_of_elements="1" />
number_of_elements="1">
</StringVectorProperty>
<ProxyProperty name="LookupTable" command="SetLookupTable">
<ProxyGroupDomain name="groups">
......@@ -286,6 +287,99 @@
</SubProxy>
</DisplayWindowProxy>
<DisplayerProxy name="ScalarBarActor" class="vtkObject">
<SubProxy>
<Proxy name="actor" class="vtkScalarBarActor">
<IntVectorProperty
name="Orientation"
command="SetOrientation"
number_of_elements="1"
default_values="1">
</IntVectorProperty>
<DoubleVectorProperty
name="Width"
command="SetWidth"
number_of_elements="1"
default_values="0.13">
</DoubleVectorProperty>
<DoubleVectorProperty
name="Height"
command="SetHeight"
number_of_elements="1"
default_values="0.5">
</DoubleVectorProperty>
<StringVectorProperty
name="Title"
command="SetTitle"
number_of_elements="1"
default_values="my_scalar_bar">
</StringVectorProperty>
<StringVectorProperty
name="LabelFormat"
command="SetLabelFormat"
number_of_elements="1">
</StringVectorProperty>
<DoubleVectorProperty
name="Position"
command="SetPosition"
number_of_elements="2"
default_values="0 0">
</DoubleVectorProperty>
<ProxyProperty name="LookupTable" command="SetLookupTable">
<ProxyGroupDomain name="groups">
<Group name="lookup_tables"/>
</ProxyGroupDomain>
</ProxyProperty>
<ProxyProperty name="TitleTextProperty" command="SetTitleTextProperty">
<ProxyGroupDomain name="groups">
<Group name="text_properties"/>
</ProxyGroupDomain>
</ProxyProperty>
<ProxyProperty name="LabelTextProperty" command="SetLabelTextProperty">
<ProxyGroupDomain name="groups">
<Group name="text_properties"/>
</ProxyGroupDomain>
</ProxyProperty>
</Proxy>
</SubProxy>
</DisplayerProxy>
<!-- <Proxy name="CornerAnnotation" class="vtkObject">-->
<DisplayerProxy name="CornerAnnotation" class="vtkObject">
<SubProxy>
<Proxy name="actor" class="vtkCornerAnnotation">
<DoubleVectorProperty
name="MaximumLineHeight"
command="SetMaximumLineHeight"
number_of_elements="1"
default_values="0">
</DoubleVectorProperty>
<StringVectorProperty
name="Text"
command="SetText"
number_of_elements="0"
repeat_command="1"
number_of_elements_per_command="1"
use_index="1"/>
<ProxyProperty name="TextProperty" command="SetTextProperty">
<ProxyGroupDomain name="groups">
<Group name="text_properties"/>
</ProxyGroupDomain>
</ProxyProperty>
</Proxy>
</SubProxy>
</DisplayerProxy>
</ProxyGroup>
</ServerManagerConfiguration>
......@@ -483,4 +483,51 @@
</SubProxy>
</BoxWidgetProxy>
</ProxyGroup>
<ProxyGroup name="text_properties">
<Proxy name="TextProperty" class="vtkTextProperty">
<DoubleVectorProperty
name="Color"
command="SetColor"
number_of_elements="3"
default_values="1 1 1">
</DoubleVectorProperty>
<IntVectorProperty
name="FontFamily"
command="SetFontFamily"
number_of_elements="1"
default_values="0">
</IntVectorProperty>
<IntVectorProperty
name="Bold"
command="SetBold"
number_of_elements="1"
default_values="1">
</IntVectorProperty>
<IntVectorProperty
name="Italic"
command="SetItalic"
number_of_elements="1"
default_values="1">
</IntVectorProperty>
<IntVectorProperty
name="Shadow"
command="SetShadow"
number_of_elements="1"
default_values="1">
</IntVectorProperty>
<IntVectorProperty
name="Opacity"
command="SetOpacity"
number_of_elements="1"
default_values="1">
</IntVectorProperty>
</Proxy>
</ProxyGroup>
</ServerManagerConfiguration>
......@@ -158,6 +158,7 @@ protected:
vtkLookupTable* LookupTable;
vtkClientServerID LookupTableID;
friend class vtkPVColorMap;
private:
vtkRMScalarBarWidget(const vtkRMScalarBarWidget&); // Not implemented
......
......@@ -28,7 +28,7 @@
#include "vtkProcessModule.h"
vtkStandardNewMacro(vtkSMDisplayerProxy);
vtkCxxRevisionMacro(vtkSMDisplayerProxy, "1.13");
vtkCxxRevisionMacro(vtkSMDisplayerProxy, "1.13.2.1");
//---------------------------------------------------------------------------
vtkSMDisplayerProxy::vtkSMDisplayerProxy()
......@@ -319,7 +319,7 @@ void vtkSMDisplayerProxy::CreateVTKObjects(int numObjects)
}
vtkSMProxy* actorProxy = this->GetSubProxy("actor");
if (!actorProxy)
if (!actorProxy || !mapperProxy)
{
//vtkErrorMacro("No actor sub-proxy was defined. Please make sure that "
// "the configuration file defines it.");
......
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