1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
|
/*=========================================================================
Program: ParaView
Module: vtkPVGeneralSettings.cxx
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 "vtkPVGeneralSettings.h"
#include "vtkCacheSizeKeeper.h"
#include "vtkObjectFactory.h"
#include "vtkProcessModuleAutoMPI.h"
#include "vtkSISourceProxy.h"
#include "vtkSMInputArrayDomain.h"
#include "vtkSMParaViewPipelineControllerWithRendering.h"
#include "vtkSMTrace.h"
#include "vtkSMViewProxy.h"
#include "vtkSMViewLayoutProxy.h"
#include <cassert>
vtkSmartPointer<vtkPVGeneralSettings> vtkPVGeneralSettings::Instance;
vtkInstantiatorNewMacro(vtkPVGeneralSettings);
//----------------------------------------------------------------------------
vtkPVGeneralSettings* vtkPVGeneralSettings::New()
{
vtkPVGeneralSettings* instance = vtkPVGeneralSettings::GetInstance();
assert(instance);
instance->Register(NULL);
return instance;
}
//----------------------------------------------------------------------------
vtkPVGeneralSettings::vtkPVGeneralSettings()
: BlockColorsDistinctValues(7),
AutoApply(false),
AutoApplyActiveOnly(false),
DefaultViewType(NULL),
TransferFunctionResetMode(vtkPVGeneralSettings::GROW_ON_APPLY),
ScalarBarMode(vtkPVGeneralSettings::AUTOMATICALLY_HIDE_SCALAR_BARS),
CacheGeometryForAnimation(false),
AnimationGeometryCacheLimit(0),
PropertiesPanelMode(vtkPVGeneralSettings::ALL_IN_ONE)
{
this->SetDefaultViewType("RenderView");
}
//----------------------------------------------------------------------------
vtkPVGeneralSettings::~vtkPVGeneralSettings()
{
this->SetDefaultViewType(NULL);
}
//----------------------------------------------------------------------------
vtkPVGeneralSettings* vtkPVGeneralSettings::GetInstance()
{
if (!vtkPVGeneralSettings::Instance)
{
vtkPVGeneralSettings* instance = new vtkPVGeneralSettings();
vtkObjectFactory::ConstructInstance(instance->GetClassName());
vtkPVGeneralSettings::Instance.TakeReference(instance);
}
return vtkPVGeneralSettings::Instance;
}
//----------------------------------------------------------------------------
void vtkPVGeneralSettings::SetAutoConvertProperties(bool val)
{
if (this->GetAutoConvertProperties() != val)
{
vtkSMInputArrayDomain::SetAutomaticPropertyConversion(val);
this->Modified();
}
}
//----------------------------------------------------------------------------
bool vtkPVGeneralSettings::GetAutoConvertProperties()
{
return vtkSMInputArrayDomain::GetAutomaticPropertyConversion();
}
//----------------------------------------------------------------------------
void vtkPVGeneralSettings::SetEnableAutoMPI(bool val)
{
if (this->GetEnableAutoMPI() != val)
{
vtkProcessModuleAutoMPI::SetEnableAutoMPI(val);
this->Modified();
}
}
//----------------------------------------------------------------------------
bool vtkPVGeneralSettings::GetEnableAutoMPI()
{
return vtkProcessModuleAutoMPI::EnableAutoMPI;
}
//----------------------------------------------------------------------------
void vtkPVGeneralSettings::SetAutoMPILimit(int val)
{
if (this->GetAutoMPILimit() != val && val >= 1)
{
vtkProcessModuleAutoMPI::SetNumberOfCores(val);
}
}
//----------------------------------------------------------------------------
int vtkPVGeneralSettings::GetAutoMPILimit()
{
return vtkProcessModuleAutoMPI::NumberOfCores;
}
//----------------------------------------------------------------------------
void vtkPVGeneralSettings::SetCacheGeometryForAnimation(bool val)
{
vtkCacheSizeKeeper::GetInstance()->SetCacheLimit(
val? this->AnimationGeometryCacheLimit : 0);
if (this->CacheGeometryForAnimation != val)
{
this->CacheGeometryForAnimation = val;
this->Modified();
}
}
//----------------------------------------------------------------------------
void vtkPVGeneralSettings::SetAnimationGeometryCacheLimit(unsigned long val)
{
vtkCacheSizeKeeper::GetInstance()->SetCacheLimit(
this->CacheGeometryForAnimation? val : 0);
if (this->AnimationGeometryCacheLimit != val)
{
this->AnimationGeometryCacheLimit = val;
this->Modified();
}
}
//----------------------------------------------------------------------------
void vtkPVGeneralSettings::SetScalarBarMode(int val)
{
switch (val)
{
case AUTOMATICALLY_HIDE_SCALAR_BARS:
vtkSMParaViewPipelineControllerWithRendering::SetHideScalarBarOnHide(true);
break;
case AUTOMATICALLY_SHOW_AND_HIDE_SCALAR_BARS:
vtkSMParaViewPipelineControllerWithRendering::SetHideScalarBarOnHide(true);
break;
default:
vtkSMParaViewPipelineControllerWithRendering::SetHideScalarBarOnHide(false);
}
if (val != this->ScalarBarMode)
{
this->ScalarBarMode = val;
this->Modified();
}
}
//----------------------------------------------------------------------------
void vtkPVGeneralSettings::SetInheritRepresentationProperties(bool val)
{
vtkSMParaViewPipelineControllerWithRendering::SetInheritRepresentationProperties(val);
this->Modified();
}
//----------------------------------------------------------------------------
void vtkPVGeneralSettings::SetMultiViewImageBorderColor(double r, double g, double b)
{
vtkSMViewLayoutProxy::SetMultiViewImageBorderColor(r, g, b);
this->Modified();
}
//----------------------------------------------------------------------------
void vtkPVGeneralSettings::SetMultiViewImageBorderWidth(int width)
{
vtkSMViewLayoutProxy::SetMultiViewImageBorderWidth(width);
this->Modified();
}
//----------------------------------------------------------------------------
void vtkPVGeneralSettings::SetTransparentBackground(bool val)
{
vtkSMViewProxy::SetTransparentBackground(val);
this->Modified();
}
//----------------------------------------------------------------------------
void vtkPVGeneralSettings::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
os << indent << "AutoApply: " << this->AutoApply << "\n";
os << indent << "AutoApplyActiveOnly: " << this->AutoApplyActiveOnly << "\n";
os << indent << "DefaultViewType: " << this->DefaultViewType << "\n";
os << indent << "TransferFunctionResetMode: " << this->TransferFunctionResetMode << "\n";
os << indent << "ScalarBarMode: " << this->ScalarBarMode << "\n";
os << indent << "CacheGeometryForAnimation: " << this->CacheGeometryForAnimation << "\n";
os << indent << "AnimationGeometryCacheLimit: " << this->AnimationGeometryCacheLimit << "\n";
os << indent << "PropertiesPanelMode: " << this->PropertiesPanelMode << "\n";
}
|