Post #11by HankR » 27.06.2003, 00:01
Just for the sake of discussion, I'd like to suggest a somewhat more general approach to the problem of selective display of orbits (and more). It is based on introducing the concept of "groups".
A group would be an arbitrary collection of objects. Certain groups would be pre-defined based on object types (e.g. "planets", "moons", asteroids"), but other groups could be defined in .ssc files using a "Groups" attribute which would list the names of groups to which an object belongs. Also, there would be a "Group" construct which would list the names of objects belonging to the group. It would also be possible for the user to create ad hoc groups at run-time by adding selected objects to a user-defined group interactively. It might also be possible to define groups as set combinations (union, intersection, etc.) of existing groups, or based on attribute values (e.g. objects larger than a specified radius), or based on arbitrary scripted conditions (using Lua). I may be getting carried away here, but you get the idea: lots of flexibility in defining groups.
Then, you allow all the display option flags (visibility, labels, markers, orbits, etc.) to be set on a per group basis. In the UI, the edit panel simply includes another control to select the group for which the flags are to be turned on or off. For any given object, if a particular flag is set for at least one group to which the object belongs, then the flag applies to the object.
Thus one could have groups for "Centaurs", "Galilean Moons", "Ten Largest Asteroids", "My Favorite Moons of Saturn", "Retrograde Moons of Jupiter", "NEOs", "KBOs", "Moon Landers", "Failed Mars Probes", or whatever you (or anybody) wants. And you could control the display option flags separately for each group.
Maybe this seems like a lot to ask.
In terms of implementation, one approach might be to use bit strings. Each group would be allocated to an index in the bit string. For each object, there would be a bit string indicating which groups the object belongs to, and for each display option flag, there would be a bit string indicating which groups have the flag enabled. So to determine if a flag applies to an object, you just do a bit-wise AND of the bit string for the flag and the bit string for the object. If the result is non-zero, the flag applies. If there aren't too many active groups (up to 64, say?), this might not be too expensive.
Just a thought.
- Hank