visual-tools / tm-globe

GNU Lesser General Public License v3.0
0 stars 0 forks source link

Impliment cluster arrangement for labels #32

Open johnkellas opened 7 years ago

johnkellas commented 7 years ago

Labels not overlapping

christopherreay commented 7 years ago

yes. Umm. this is to do with eumm... cluster analysis. christopher will do further analysis to the clustering sutff in cesium to determine how to take thedata and ceat a "datasource". etc

TapdancingRodent commented 7 years ago

How badly are the labels overlapping? Detecting colliding labels and adjusting them in code will be non-trivial so I'd advocate moving the cities a little bit or giving each city a manual label offset as part of the data input which we can definitely pull off in the short term.

TapdancingRodent commented 7 years ago

Given the varying scale I guess the quick fixes I suggested wouldn't work after all. Would it be enough to make sure that the labels are properly transparent so they aren't occluding each other? Looking at the source I can't work out why this isn't already the case.

TapdancingRodent commented 7 years ago

I've assigned this to myself - I'm going to try to work out if I can get the labels displaying through each other which is (as far as I can see) the best we can get in the timescale

christopherreay commented 7 years ago

Daniel, its already implemented, with pixelk offset collision https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Clustering.html&label=Showcases

the issue is how to create a "data source", which is likely a behaviour of an "entitycollectiion"

TapdancingRodent commented 7 years ago

Nifty, OK, I'll leave it for now then and check if anything else is more urgent

christopherreay commented 7 years ago

are you going to study that>

e.g what we could do is set up an ftp server, where the node server reads the file system and implements whatever content is there.... KML loading is a thing.

what is the time frame you are working on>

TapdancingRodent commented 7 years ago

If you want me to look into it I can do that. I think I'll make a separate issue to look at how data is loaded, though, if we're going to make such large changes.

I have to clock off some time between 5 and 7pm tonight and I should have a couple of hours tomorrow morning, too.

christopherreay commented 7 years ago

aha: https://cesiumjs.org/Cesium/Build/Documentation/CustomDataSource.html

christopherreay commented 7 years ago

So hooray. Clustering turns on Boohoo, only the "point" part of the Entity shows after "un"clustering

christopherreay commented 7 years ago

Im going to try adding the point and label entities to different dataSource objects

christopherreay commented 7 years ago

I tried manually setting the "show" property of the text label, and it crashed Cesium :)

johnkellas commented 7 years ago

Currently running for me and seems to display a number for the amount of labels that are not shown. Interesting.

screen shot 2017-09-16 at 11 15 42
christopherreay commented 7 years ago

OK. so created two datasources, and turned on clustering Only for the Label dataSource

christopherreay commented 7 years ago

Ok, so change clustering behaviour to:

  1. show the list of cities as the label for the cluster billboard
  2. make a click on the cluster billboard zoom in
TapdancingRodent commented 7 years ago

Oh nuts, sorry I didn't see this earlier, you can turn on clustering separately for points and labels, let me find the docs

TapdancingRodent commented 7 years ago

According to the docs below it should be something along the lines of dataSource.clustering.clusterPoints = false;

https://cesiumjs.org/Cesium/Build/Documentation/DataSource.html#clustering https://cesiumjs.org/Cesium/Build/Documentation/EntityCluster.html#clusterPoints

christopherreay commented 7 years ago

yueah. I literally just read that same thing and came here to document it. Thanks

christopherreay commented 7 years ago

also its a bug in the unclustering code upstream. The clustering stuff is pretty edge case for them. They have been building it since 2013, and they have a roadmap to create generic force based and other strategies for "de-cluttering"

https://github.com/AnalyticalGraphicsInc/cesium/issues/1097

christopherreay commented 7 years ago

yes, that solves our use case

christopherreay commented 7 years ago