I am attempting to create markers with labels, that only appear at certain zoom levels within Cesium. When using the 3D view, everything works as expected. However, when switching to the 2D (equirectangular) projection, I am experiencing a number of issues related to the the anti-meridian (180 degree longitude):
The markers are cutoff when they span the anti-meridian.
When the anti-meridian is visible on screen, the distanceDisplayCondition is exhibiting strange behavior depending on whether a point falls on the "large" side (portion to one side of the anti-meridian that occupies over 50% of the width) or "small" side (portion to one side of the anti-meridian that occupies less than 50% of the width). In both cases, it appears the distance calculation being performed by CESIUM isn't being done correctly when the anti-meridian is visible.
Small: Markers on this side are visible well before they become visible on the "large" side.
Large: Markers on this side are visible slightly prior to when they ought to be displayed. Steps to reproduce: zoom into a portion of the map where the anti-meridian is NOT visible. Once you see the markers, zoom out a single step. Now pan the map until the anti-meridian is visible and about 10% into the screen space. The markers on the "large" side will suddenly appear.
The following images illustrate these bugs. The first shows a zoom level in Cesium with the anti-meridian barely visible within the frame. The second shows the exact same scene, at the same zoom level, moved about 4 pixels to the left. If the scene is moved far enough left where the anti-meridian is near the left edge of the screen, then the markers to the right of the anti-meridian disappear while the markers on the left stay on screen. Both images show how the markers are cut-off at the anti-meridian, and in both cases, none of the markers should be visible.
The JavaScript required to reproduce this in Sandcastle is:
var viewer = new Cesium.Viewer('cesiumContainer', {timeline : false, animation : false});
for (var i = 0; i < 1000; ++i) {
viewer.entities.add({
position: Cesium.Cartesian3.fromRadians(
Math.random() * 2 * Math.PI, Math.asin(2 * Math.random() - 1)),
point : {
color: Cesium.Color.RED,
pixelSize: 36,
distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 10000000)
},
label: {
text: '222',
font: '16px Monospace',
eyeOffset: new Cesium.Cartesian3(0, 0, -100),
style: Cesium.LabelStyle.FILL_AND_OUTLINE
}
});
}
Does anyone know of a way to work-around these Cesium bugs?
Related
Using the Highcharts example posted here how can you ensure that the Font Awesome icons will be positioned exactly in the middle of the data point like the native symbols/markers are? It gets called like this in the data series and uses the "plugin" that is found in that same Fiddle:
marker: {
symbol: 'text:\uf183' // fa-male
}
Using that example, if you toggle the series on/off a couple of times or zoom in/out the icons are no longer visually accurate, often displaying above the actual coordinate. In the image below you'd believe that data point had a value >50 based on where the icon is.
Their SVGRenderer example here doesn't seem to be effected.
It looks like problem with re-rendering icons later - height of the marker isn't considered. I suggest to change a bit logic for rendering icon:
var text = symbol.split(':')[1],
svgElem = this.text(text, x, y)
.attr({
translateY: h, // translate marker
translateX: -1
})
.css({
fontFamily: 'FontAwesome',
fontSize: h * 2
});
See demo: http://jsfiddle.net/2A7Zf/29/
If you want to use the markers XL-sized (i.e larger radius) for a custom chart (e.g. a Yes/No prevalence chart using the x and check icons, circle empty for the less prevalent one and circle filled for the more prevalent one and data labels showing counts/%s), then I'd recommend this tweak to center the symbols:
translateX: -w/2 + options.radius/4 - 3
When I zoom in on a series in highcharts, I've noticed that the first visible point of the series is where it starts to draw. This means that if the only point in the visible zoomed area is in the middle, then the line for that series only starts to draw in the middle of the window. Is there a way to make Highcharts render the previous value so that it does not "cut off" the previous values of the graph?
Before, zoomed out:
After, zoomed in (problem):
Desired:
I have tried setting cropThreshold and connectNulls (just in case) among other tweaks with no luck. Any suggestions?
I have a chart on which I am showing very small interval time data (close to 2 minutes), when I zoom In using drag at the centre of chart, the call to server gets the zoomed data but the at x-axis the navigator(horizontal scroll) moves the zoomed in data to extreme left it should have been in centre of time line.
Say for example timeline has interval in seconds as below
0---30---60---90---120
and I zoom in at 30 to 90
The navigator or scroll axis should have stayed at 0---120 and the focus part should be 30---90
but In my case it changing the navigator to 30 to 120 and focus area moves to extreme left.
Note: with bigger time intervals it works fine
The navigator call setExtremes function which set a range on any axis. Unfortunatley it is default behaviour and you cannot zoom chart partly.
How do I make a RTS camera so that when the mouse is at the edge of the window, it will move either left/right/up/down. I been trying to create an invisible box at the side of the screen so that when the mouse is at the box it will move the camera, but it still doesn't work. Please help!
Building upon what #Davor Mlinaric said, using the mouses x and y coordinates (which can be gotten from Mouse.GetState()), and testing whether those coordinates come in contact with the top, bottom and sides of the screen.
It would be a good start to set where those boxes will be something along the lines of:
GraphicsDevice.Viewport.Width/Height -/+ offset
Where offset is the amount of distance from the top,bottom or side.
Then test where the mouse position is, with a boolean.
boolean inTheZone = false;
//Bottom Box
if(Mouse.GetState().Y > GraphicsDevice.Viewport.Height - offset)
{
//Move camera in the y axis downwards (+).
inTheZone = true;
}
else
{
inTheZone = false;
}
and then the same for the 4 remaining sides.
Notice ive also used Y here, depending on how you set up the camera this may change to Z.
I hope this helps
I've noticed that the CSS3 scale attribute does really bad things to jquery ui, specifically to sortable. The problem is that the mouse still needs to move as much as if the elements were not scaled. Check out this jsfiddle example.
Does anybody have thoughts on how to fix this? Is it possible to change the speed that the mouse moves? I'm going to look into the html5 native drag and drop next, and try to write my own sortable function.
UPDATE:
Jquery ui draggable works ok with CSS3 scaled elements, here is a fiddle for it.
It turns out the real answer does not require writing special move functions. Jquery ui sortable can be used as long as the items being sorted have been wrapped in a div of the appropriate size with overflow hidden. Check this jsfiddle for an example.
The problem was that I had forced the scaled divs to be close to one another using a negative margin. Then when I started to drag an item it was taking up the wrong amount of space. With the scaled item wrapped in a non-scaled div everything works as expected.
I don't have a solution for working with jquery ui but I do have a solution for working with Raphael and by extension other svg objects.
First, using chrome or firefox, go drag the dots around in this jsfiddle. Be sure to drag both dots and to use the slider at the bottom to change the scale of the box. The slider has a default scale range of .4 to 1.2. In Chrome the slider is actually a slider but in Firefox it shows up as a textbox. If you are using firefox enter values that are 100 x the scale, i.e. 70 => 0.7.
What you should have just experienced is that the black dot tracks with the mouse regardless of the scale and the red dot only tracks when the scale is 1.0.
The reason for this is the two dots are using different 'onMove' functions. The black dot moves according to 1/scale while the red dot moves normally.
var moveCorrected = function (dx, dy) {
// move will be called with dx and dy
this.attr({
cx: this.ox + (1/scale)*dx,
cy: this.oy + (1/scale)*dy
});
}
var move = function (dx, dy) {
// move will be called with dx and dy
this.attr({
cx: this.ox + dx,
cy: this.oy + dy
});
}
So, in answer to my original question. You can't (and shouldn't) be able to change how the mouse moves, that is clearly user defined behavior, but you can change the move function of the object being moved to track with the mouse.