[Paraview-developers] Camera Parallel Projection enable by default

Sebastien Jourdain sebastien.jourdain at kitware.com
Wed Oct 3 09:53:48 EDT 2012


Hi Pandu,

I don't know much about your application, but you might be able to
create a ParaView plugin that define a ParallelCamera and a view that
use it and instead of creating a default 3D view, you create your own
in your application. By plugin, I mean another XML file that you load
as a plugin.

Seb

On Wed, Oct 3, 2012 at 9:47 AM, Pandu tech <pandu4tech at gmail.com> wrote:
> Hi Sebastien,
>
> Thanks for your reply. I tried this and it is working.
>
> Would like to know if there is any way to get this done in Custom
> applications (like in my case), without changing ParaView code or paraview
> related files.
>
> Thanks,
> Pandu.
>
>
> On Mon, Oct 1, 2012 at 12:49 PM, Sebastien Jourdain
> <sebastien.jourdain at kitware.com> wrote:
>>
>> Hi Pandu,
>>
>> another way to see that is to change the default definition of the
>> camera proxy in the file:
>>
>> src/ParaViewCore/ServerManager/SMApplication/Resources/rendering.xml
>>
>> And replace
>>
>> <IntVectorProperty command="SetParallelProjection"
>>                          default_values="0"
>>                          ignore_synchronization="1"
>>                          name="CameraParallelProjection"
>>                          number_of_elements="1">
>>         <BooleanDomain name="bool" />
>>       </IntVectorProperty>
>>
>> By that
>>
>> <IntVectorProperty command="SetParallelProjection"
>>                          default_values="1"
>>                          ignore_synchronization="1"
>>                          name="CameraParallelProjection"
>>                          number_of_elements="1">
>>         <BooleanDomain name="bool" />
>>       </IntVectorProperty>
>>
>> Seb
>>
>> On Mon, Oct 1, 2012 at 7:23 AM, Pandu tech <pandu4tech at gmail.com> wrote:
>> > Hi,
>> >
>> > Please let me know if you have any suggestions in this regard.
>> >
>> > Thanks,
>> > Pandu
>> >
>> >
>> > On Thu, Sep 27, 2012 at 9:41 AM, Pandu tech <pandu4tech at gmail.com>
>> > wrote:
>> >>
>> >> Hi,
>> >>
>> >> In my application, I would like to set 3D render view "Use Parallel
>> >> Projection" option to checked by default. I understood that
>> >> "CameraParallelProjection" is the property associated with this.
>> >>
>> >> I tried to modify the settings.ini file created by pqSettings class. I
>> >> tried the following in myMainWindow.cxx file:
>> >>
>> >> code:--
>> >> //creating a new settings file if not exists
>> >>   QString settingsRoot;
>> >> #if defined(Q_OS_WIN)
>> >>   settingsRoot = QString::fromLocal8Bit(getenv("APPDATA"));
>> >> #else
>> >>   settingsRoot = QString::fromLocal8Bit(getenv("HOME")) +
>> >>                  QDir::separator() + QString::fromLocal8Bit(".config");
>> >> #endif
>> >>   QString settingsPath = QString("%2%1%3");
>> >>   settingsPath = settingsPath.arg(QDir::separator());
>> >>   settingsPath = settingsPath.arg(settingsRoot);
>> >>   settingsPath = settingsPath.arg(QApplication::organizationName());
>> >>
>> >>   QString filename = settingsPath.append("/"
>> >> +QApplication::applicationName() +
>> >> QApplication::applicationVersion()+".ini");
>> >>
>> >>   QSettings *settings = 0;
>> >>   QFile file;
>> >>   if(!file.exists(filename))
>> >>   {
>> >>       settings = new
>> >> QSettings(QSettings::IniFormat,QSettings::UserScope,
>> >>
>> >> QApplication::organizationName(),
>> >>
>> >> QApplication::applicationName()
>> >> + QApplication::applicationVersion(), this);
>> >>
>> >>       settings->beginGroup("renderModule");
>> >>       settings->setValue("CameraParallelProjection", 1); // setting
>> >> value
>> >> to 1
>> >>       settings->endGroup();
>> >>       settings->sync();
>> >>   }
>> >>
>> >> Using this code, I am able to create .ini file with
>> >> CameraParallelProjection value set to 1. But for the first time, when I
>> >> run
>> >> my application, UseParallelProjection is not checked.
>> >>
>> >> Whenever I switch b/w views or restart the application once again,
>> >> because
>> >> .ini file already present, then I can see UseParallelProjection option
>> >> checked.
>> >>
>> >> How can I set UseParallelProjection option to be checked even in the
>> >> first
>> >> time? Please let me know if there is any better approach regarding
>> >> this.
>> >>
>> >> Truly appreciate your help reg. this.
>> >>
>> >> Thanks,
>> >> Pandu.
>> >
>> >
>> >
>> > _______________________________________________
>> > Paraview-developers mailing list
>> > Paraview-developers at paraview.org
>> > http://public.kitware.com/mailman/listinfo/paraview-developers
>> >
>
>


More information about the Paraview-developers mailing list