Skip to content

Commit 81f67da

Browse files
utkarshayachitkwrobot
authored andcommitted
Merge topic 'pvweb-add-color-editor'
3112bf7 Update VTK to include requirements for pvweb colormap editor. aa271e7 Add a new ParaViewWeb widget to allow editing of colormap.
2 parents 07d2491 + 3112bf7 commit 81f67da

File tree

12 files changed

+1218
-48
lines changed

12 files changed

+1218
-48
lines changed

VTK

Submodule VTK updated from 8bb1cd3 to 9a9181a

Web/Applications/Visualizer/www/main.js

Lines changed: 94 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,8 @@
513513
proxyEditor.bind('initialize-scalar-opacity-widget', onInitializeScalarOpacityWidget);
514514
proxyEditor.bind('request-scalar-range', onRequestScalarRange);
515515
proxyEditor.bind('push-new-surface-opacity', onSurfaceOpacityChanged);
516+
proxyEditor.bind('initialize-color-editor-widget', onInitializeColorEditorWidget);
517+
proxyEditor.bind('update-rgb-points', onUpdateRgbPoints);
516518
}
517519

518520
// ------------------------------------------------------------------------
@@ -562,7 +564,7 @@
562564
session.call('pv.color.manager.opacity.points.set', args).then(function(successResult) {
563565
viewport.invalidateScene();
564566
workDone();
565-
}, workDone);
567+
}, error);
566568
}
567569
}
568570

@@ -576,7 +578,7 @@
576578
session.call('pv.color.manager.surface.opacity.set', args).then(function(successResult) {
577579
viewport.invalidateScene();
578580
workDone();
579-
}, workDone);
581+
}, error);
580582
}
581583
}
582584

@@ -588,7 +590,7 @@
588590
var storeKey = colorArray[1] + ":opacityParameters";
589591
var args = [storeKey, event.parameters];
590592
startWorking();
591-
session.call('pv.keyvaluepair.store', args).then(workDone, workDone);
593+
session.call('pv.keyvaluepair.store', args).then(workDone, error);
592594
}
593595
}
594596

@@ -604,7 +606,7 @@
604606
'max': curScalarRange.max
605607
});
606608
workDone();
607-
}, workDone);
609+
}, error);
608610
}
609611

610612
// ------------------------------------------------------------------------
@@ -619,14 +621,24 @@
619621
session.call('pv.color.manager.rescale.transfer.function', [options]).then(function(successResult) {
620622
if (successResult['success'] === true) {
621623
viewport.invalidateScene();
624+
622625
proxyEditor.trigger({
623626
'type': 'update-scalar-range-values',
624627
'min': successResult.range.min,
625628
'max': successResult.range.max
626629
});
630+
631+
session.call('pv.color.manager.rgb.points.get', [event.colorBy.array[1]]).then(function(result) {
632+
proxyEditor.trigger({
633+
'type': 'notify-new-rgb-points-received',
634+
'rgbpoints': result
635+
});
636+
workDone();
637+
}, error);
638+
} else {
639+
workDone();
627640
}
628-
workDone();
629-
}, workDone);
641+
}, error);
630642
}
631643

632644
// ------------------------------------------------------------------------
@@ -646,24 +658,31 @@
646658
function onNewProxyLoaded() {
647659
if(pipelineDataModel.metadata && pipelineDataModel.source && pipelineDataModel.representation && pipelineDataModel.view) {
648660
var colorBy = pipelineDataModel.representation.colorBy,
661+
widgetKey = 'pv.proxy.editor.settings',
662+
widgetSettings = retrieveWidgetSettings(widgetKey),
663+
options = { 'widgetKey': widgetKey, 'widgetData': widgetSettings },
664+
srcVal = widgetSettings['Source'] || "+Source",
665+
repVal = widgetSettings['Representation'] || "-Representation",
666+
viewVal = widgetSettings['View'] || "-View",
667+
colMgmtVal = widgetSettings['Color Management'] || "+Color Management",
649668
props = [].concat(
650-
"+Source", pipelineDataModel.source.properties, '_Source',
651-
"-Representation", pipelineDataModel.representation.properties, '_Representation',
652-
"-View", pipelineDataModel.view.properties, "_View"
669+
srcVal, pipelineDataModel.source.properties, '_Source',
670+
repVal, pipelineDataModel.representation.properties, '_Representation',
671+
viewVal, pipelineDataModel.view.properties, "_View"
653672
),
654673
ui = [].concat(
655-
"+Source", pipelineDataModel.source.ui, '_Source',
656-
"-Representation", pipelineDataModel.representation.ui, '_Representation',
657-
"-View", pipelineDataModel.view.ui, "_View"
674+
srcVal, pipelineDataModel.source.ui, '_Source',
675+
repVal, pipelineDataModel.representation.ui, '_Representation',
676+
viewVal, pipelineDataModel.view.ui, "_View"
658677
);
659678

660679
if (!$.isEmptyObject(colorBy) && colorBy.hasOwnProperty('array')) {
661-
props = [].concat("+Color Management",
680+
props = [].concat(colMgmtVal,
662681
extractRepresentation(pipelineDataModel.representation.properties),
663682
"ColorByPanel",
664683
"_Color Management",
665684
props);
666-
ui = [].concat("+Color Management",
685+
ui = [].concat(colMgmtVal,
667686
extractRepresentation(pipelineDataModel.representation.ui),
668687
"ColorByPanel",
669688
"_Color Management",
@@ -678,7 +697,9 @@
678697
ui,
679698
pipelineDataModel.source.data.arrays,
680699
paletteNameList,
681-
colorBy);
700+
colorBy,
701+
options);
702+
proxyEditor.bind('store-widget-settings', onStoreWidgetSettings);
682703
$('.inspector-container').scrollTop(0);
683704
} catch(err) {
684705
console.log(err);
@@ -701,6 +722,57 @@
701722
}
702723
}
703724

725+
// ------------------------------------------------------------------------
726+
727+
function onStoreWidgetSettings(event) {
728+
vtkWeb.storeApplicationDataObject(event.widgetKey, event.widgetData);
729+
}
730+
731+
function retrieveWidgetSettings(widgetKey) {
732+
return vtkWeb.retrieveApplicationDataObject(widgetKey);
733+
}
734+
735+
// ========================================================================
736+
// Color editor widget creation
737+
// ========================================================================
738+
739+
function onInitializeColorEditorWidget(event) {
740+
var container = event.container,
741+
colorArray = event.colorBy.array,
742+
initOptions = {
743+
'topMargin': 10,
744+
'rightMargin': 15,
745+
'bottomMargin': 10,
746+
'leftMargin': 15,
747+
'widgetKey': 'pv.color.editor.settings'
748+
};
749+
750+
if (colorArray.length >= 2 && colorArray[1] !== '') {
751+
startWorking();
752+
session.call('pv.color.manager.rgb.points.get', [colorArray[1]]).then(function(result) {
753+
initOptions['rgbInfo'] = result;
754+
initOptions['widgetData'] = retrieveWidgetSettings(initOptions['widgetKey']);
755+
container.colorEditor(initOptions);
756+
container.bind('store-widget-settings', onStoreWidgetSettings);
757+
workDone();
758+
}, error);
759+
} else {
760+
console.log("WARNING: Initializing the color editor while not coloring by an array.");
761+
container.colorEditor(initOptions);
762+
}
763+
}
764+
765+
function onUpdateRgbPoints(event) {
766+
var arrayName = event.colorBy.array[1];
767+
var rgbInfo = event.rgbInfo;
768+
769+
startWorking();
770+
session.call('pv.color.manager.rgb.points.set', [arrayName, rgbInfo]).then(function(result) {
771+
workDone();
772+
viewport.invalidateScene();
773+
}, error);
774+
}
775+
704776
// ========================================================================
705777
// Opacity editor widget creation
706778
// ========================================================================
@@ -713,13 +785,16 @@
713785
'topMargin': 10,
714786
'rightMargin': 15,
715787
'bottomMargin': 10,
716-
'leftMargin': 15
788+
'leftMargin': 15,
789+
'widgetKey': 'pv.opacity.editor.settings'
717790
};
718791

719792
function gotInitParam(paramName) {
720793
needParams.splice(needParams.indexOf(paramName), 1);
721794
if (needParams.length === 0) {
795+
initOptions['widgetData'] = retrieveWidgetSettings(initOptions['widgetKey']);
722796
container.opacityEditor(initOptions);
797+
container.bind('store-widget-settings', onStoreWidgetSettings);
723798
}
724799
}
725800

@@ -731,11 +806,10 @@
731806
initOptions.gaussiansList = result.gaussianPoints;
732807
initOptions.linearPoints = result.linearPoints;
733808
initOptions.gaussianMode = result.gaussianMode;
734-
initOptions.interactiveMode = result.interactiveMode;
735809
}
736810
gotInitParam('currentPointSet');
737811
workDone();
738-
}, workDone);
812+
}, error);
739813

740814
var representation = event.colorBy.representation;
741815
session.call('pv.color.manager.surface.opacity.get', [representation]).then(function(result) {
@@ -744,7 +818,7 @@
744818
}
745819
gotInitParam('surfaceOpacityEnabled');
746820
workDone();
747-
}, workDone);
821+
}, error);
748822

749823
} else {
750824
console.log("WARNING: Initializing the opacity editor while not coloring by an array.");
@@ -806,7 +880,7 @@
806880
alert(saveResult.message);
807881
}
808882
workDone();
809-
}, workDone);
883+
}, error);
810884
}
811885

812886
function updateSaveDataFilename(activeType) {

Web/Documentation/guides/apache_front_end/README.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,31 +45,45 @@ In this case, you will probably find a file named `httpd-vhosts.conf` located in
4545

4646
In this case you should create a file in `/etc/apache2/sites-available/` and make a symbolic link to it from `/etc/apache2/sites-enabled/`. We'll assume you named this file `001-pvw.conf`.
4747

48-
In either case, make sure to replace the `ServerName` value (shown below as `<MY-SERVER-NAME>`) with the correct host name. Also make sure the `DocumentRoot` value (shown below as `<MY-DOCUMENT-ROOT>`) makes sense for your particular deployment, we typically point it at the `www` directory of the ParaView build or install tree.
48+
In either case, make sure to replace the `ServerName` value (shown below as `${MY-SERVER-NAME}`) with the correct host name. Also make sure the `DocumentRoot` value (shown below as `${MY-DOCUMENT-ROOT}`) makes sense for your particular deployment, we typically point it at the `www` directory of the ParaView build or install tree. Additionally, be sure to change `${MAPPING-FILE-DIR}` to the real location where you have put the map file.
4949

5050
<VirtualHost *:80>
51-
ServerName <MY-SERVER-NAME>
51+
ServerName ${MY-SERVER-NAME}
5252
ServerAdmin [email protected]
53-
DocumentRoot "<MY-DOCUMENT-ROOT>"
53+
DocumentRoot ${MY-DOCUMENT-ROOT}
5454
ErrorLog "logs/pv-error_log"
5555
CustomLog "logs/pv-access_log" common
5656

57+
### The following commented lines could be useful when running
58+
### over https and wss:
59+
# SSLEngine On
60+
# SSLCertificateFile /etc/apache2/ssl/your_certificate.crt
61+
# SSLCertificateKeyFile /etc/apache2/ssl/your_domain_key.key
62+
# SSLCertificateChainFile /etc/apache2/ssl/DigiCertCA.crt
63+
#
64+
# <Location ${MY-DOCUMENT-ROOT} >
65+
# SSLRequireSSL On
66+
# SSLVerifyClient optional
67+
# SSLVerifyDepth 1
68+
# SSLOptions +StdEnvVars +StrictRequire
69+
# </Location>
70+
5771
# Have Apache pass these requests to the launcher
5872
ProxyPass /paraview http://localhost:9000/paraview
5973

6074
# Turn on the rewrite engine
6175
RewriteEngine On
6276

6377
# This is the path the mapping file Jetty creates
64-
RewriteMap session-to-port txt:<MAPPING-FILE-DIR/proxy.txt
78+
RewriteMap session-to-port txt:${MAPPING-FILE-DIR}/proxy.txt
6579

6680
# This is the rewrite condition. Look for anything with a sessionId= in the query part of the URL and capture the value to use below.
6781
RewriteCond %{QUERY_STRING} ^sessionId=(.*)$ [NC]
6882

6983
# This does the rewrite using the mapping file and the sessionId
7084
RewriteRule ^/proxy.*$ ws://${session-to-port:%1}/ws [P]
7185

72-
<Directory "<MY-DOCUMENT-ROOT">
86+
<Directory "${MY-DOCUMENT-ROOT}">
7387
Options Indexes FollowSymLinks
7488
Order allow,deny
7589
Allow from all

Web/Documentation/guides/web_visualizer/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ render view. The currently selected component is active, and it is associated
7979
with a circle which is outlined in black and either filled or unfilled
8080
depending on its visibility. In the imae below, "Contour1" is the active
8181
pipeline component, and it is also currently visible. The properties
82-
displayed in the proxy property editor alwasy correspond to the currently
82+
displayed in the proxy property editor always correspond to the currently
8383
selected (active) pipeline component.
8484

8585
{@img images/pvweb-pipeline.png Pipeline editor }

0 commit comments

Comments
 (0)