Toogle Cesium requestRenderMode after Cesium.viewer has been created - cesiumjs

i am trying to toggle Cesiums viewer.requestRenderMode setting, to explore some performance differences.
I created a toggle Button for the requestRenderMode property and call the following function:
function toggleRenderMode() {
console.info("toggleRenderMode");
requestRenderMode = !requestRenderMode;
viewer.requestRenderMode = requestRenderMode
if(requestRenderMode){
viewer.maximumRenderTimeChange = Infinity;
console.info("enabling requestRenderMode");
}else{
viewer.maximumRenderTimeChange = 0;
console.info("disabling requestRenderMode");
}
console.info("viewer.requestRenderMode:",viewer.requestRenderMode);
}
the console output shows me that the viewers requestRenderMode is set according to the code, however it seems that this has no effect on the rendering.
So can this property only be set at the time of Cesium viewers creation?
Thanks a lot!

viewer.requestRenderMode does not exist in the API, what you want is viewer.scene.requestRenderMode.

Related

Why updated forge viewer's model browser isolate the items instead of select?

In the older version(7.1.*) of forge viewer the Model browser select the item and focus the selected item.
But in the latest version(7.*.*) it isolate the item(s).
Is there any way or settings to get back to the older functionality in the latest version?
You can change the behavior by specifying options.docStructureConfig on ModelStructurePanel.
Pls. check below blog post and query on stack overflow which answering for this topics.
https://forge.autodesk.com/blog/customizing-modelstructurepanel-behavior-forge-viewer
Prevent zoom in Forge viewer when clicking in Model Browser
As described in the blog post, you can change the behavior by creating custom ModelStructure Panel on Autodesk.Viewing.OBJECT_TREE_CREATED_EVENT handler or you can specify the option in its constructor.
You also can specify the option in GuiViewer3D constrictor like below.
var options = {
docStructureConfig: {
click: {
onObject: ["selectOnly"] //instead of toggleOverlayedSelection
},
clickShift: {
onObject: ["isolate"] //instead of toggleMultipleOverlayedSelection
},
clickCtrl: {
onObject: ["selectToggle"] //instead of toggleMultipleOverlayedSelection
}
}
}
viewer3d = new Autodesk.Viewing.GuiViewer3D(document.getElementById('forgeViewer3d'), options);

Limit the orbit movement in Forge Viewer

I'm having trouble to set rotational limits to the viewer.
I want my viewer to work like this example in Three.js
https://threejs.org/examples/#misc_controls_orbit
Is there anyone that has succeeded with this? And can give me some hints to lead me in the right direction..
I've tried using the code in the example above.
I've tried to set viewer.autocam.constrainOrbitVertical = true when reaching my limit that is about 90 degrees, but it wont give me the result I want..
Unfortunately such a functionality is not available in Forge Viewer. You should however be able to work around it by controlling the camera properties on each CAMERA_CHANGE_EVENT, for example like so:
viewer.addEventListener(Autodesk.Viewing.CAMERA_CHANGE_EVENT, function() {
const camera = viewer.getCamera();
if (camera.position.x > 0) {
const dist = camera.position.length();
camera.position.x = 0;
camera.position.setLength(dist);
viewer.navigation.updateCamera();
}
});

Highlight an array of nodes in Autodesk Viewer

Problem:
I have an array of nodes that I would like to highlight when an action happens.
My Attempted Solution
I have tried using code from the model browser, but it seems to only accept one dbId at a time. I have tried to iterate over my array and call it, but the highlighting doesn't work when that is done.
for (var i = 0; i < dbIdsArray.length; i++) {
viewerApp.getCurrentViewer().impl.rolloverObjectNode(dbIdsArray[i]);
}
Any advice on how to implement this correctly would be a great help.
Thanks
If you want to highlight a couple of dbids, there are some different ways depending on your requirement.
Maybe you can use the API Viewer3D.isolate() to highlight the
selected objects by isolating them, you can just input dbId array as
follow, also, you can zoom the selected items to the viewer window
use the API Viewer3D.fitToView() to focus on them:
viewer.isolate(dbIdArray);
viewer.fitToView(dbIdArray);
If you want to highlight the selected objects with different color,
maybe you can try the new API Viewer3D.setThemingColor(), here is the
simple code sample. Remember you need to clear the color using
Viewer3D.clearThemingColors(). The simple code sample should be like:
I'm able to highlight components using following code:
viewer.addEventListener(
Autodesk.Viewing.SELECTION_CHANGED_EVENT,
function (e) {
if(e.dbIdArray.length) {
var dbId = e.dbIdArray[0];
viewer.impl.highlightObjectNode(
viewer.model, dbId, true, false)
viewer.select([])
viewer.impl.sceneUpdated(true)
}
})
This is using function:
viewer.impl.highlightObjectNode = function(model, dbId, value, simpleHighlight)

p:lineChart - continuous line, without dots

how to remove the dots from p:lineChart and draw the chart as just the continuous line?
Thanks
For others with similar problem, I did:
<p:chart type="line" model="#{myController.model}"/>
and:
LineChartSeries serie = new LineChartSeries();
serie.setShowMarker(false);
and worked fine. I'm using PrimeFaces 5.1.
There is a showMarkers attribute that isn't working for me (I'm using PrimeFaces 3.4.2) but I found a way to hide them.
It's a bit hacky, I made it working on the showcase, you just need to replace widget_category by the widget of your chart. You can even test it online from the showcase using a javascript console if your web browser allows it (tested under chromium) :
// loop through the series
for (var i = 0; i < widget_category.cfg.series.length; ++i) {
// Hide markers
widget_category.cfg.series[i].showMarker = false;
// I'm not sure you want this when talking about 'continuous line'
// but you can make your chart smooth this way :
widget_category.cfg.series[i].rendererOptions = { smooth: true };
}
// Ask a refresh using the modified configuration object
widget_category.refresh(widget_category.cfg);

MediaWiki variant tabs

Anyone knows how to get the variant tabs to work as actual tabs and not as a drop down?
This is how sr.wikipedia.org has it:
and this is how I have it on my zablude.com/wiki/ page:
and I've tried everything I found and searched everywhere I could think of but I wasn't able to find a solution... anyone has any ideas how this works?
They hack it in JavaScript — see this piece of code at the bottom of Медијавики:Vector.js:
//to be able to switch the language variant (overrides the default buttons with more visible ones)
function tabWorkaround() {
if(mw.config.get('wgUserVariant') == 'sr') {
var tab_urls = {};
tab_urls[0] = document.getElementById('ca-varlang-0').getElementsByTagName('a')[0].href; //Ћирилица
tab_urls[1] = document.getElementById('ca-varlang-1').getElementsByTagName('a')[0].href; //Latinica
$('#p-variants').remove();
mw.util.addPortletLink('p-namespaces', tab_urls[0], 'Ћирилица');
mw.util.addPortletLink('p-namespaces', tab_urls[1], 'Latinica');
}
}
$(document).ready(tabWorkaround);
It would probably be cleaner to do it with a MediaWiki hook, though. The following code is untested, but should work if I haven't made any silly mistakes:
// show language variants as tabs in Vector skin
function tabWorkaround( &$skintemplate, &$links ) {
$links['namespaces'] += $links['variants'];
$links['variants'] = array();
return true;
}
$wgHooks['SkinTemplateNavigation::Universal'][] = 'tabWorkaround';
(In MW 1.17, this hook is only called from the Vector skin. In MW 1.18, it will affect all skins. If you don't want that, you could test whether $skintemplate->skinname == 'vector'.)
Try $wgVectorFeatures['collapsibletabs']['global'] = false;. That is intended for the dropdown on the other side, but might work for other dropdowns as well.