Page 1 of 1

Marker labels added to Celestia 1.5

Posted: 03.01.2008, 13:05
by Vincent
Celestia 1.5 now includes support for marker labels. This feature is already available for users who compile from CVS. Others should wait for the next (pre) release.

Adding label to markers allows users to display text information below the marker symbol:
Image

This is particularly useful when information about objects, such as name, Hubble type, ..., need to be displayed whatever the distance to the observer or the magnitude. Also, invisible objects now can be labelled using a marker.

- In Celx scripting, marker labels are added as the fifth argument of the object:mark method:

Code: Select all

venus = celestia:find("Sol/Venus")
venus:mark("red", "circle", 10, 0.7, "Planet type: Telluric")
or

Code: Select all

mw = celestia:find("Milky Way")
mw:mark("red", "circle", 10, 0.7, mw:getinfo().hubbleType)


Here's a complete example for celx scripting:

Code: Select all

-- Title: Mark and label nearby galaxies with their Hubble Type

mw = celestia:find("Milky Way")

function label_galaxy_types()
   for dso in celestia:dsos() do
      if dso:getinfo().type == "galaxy" then
         dsoPos = dso:getposition()
         mwPos = mw:getposition()
         if dsoPos:distanceto(mwPos) < 1e20 then
            hubbleType = dso:getinfo().hubbleType
            text = dso:name()..": "..hubbleType
            if string.find(hubbleType, "E") then
               dso:mark( "red", "disk", 7, 0.7, text )
            elseif string.find(hubbleType, "Irr") then
               dso:mark( "yellow", "disk", 7, 0.7, text )
            elseif string.find(hubbleType, "SB") then
               dso:mark( "green", "disk", 7, 0.7, text )
            elseif string.find(hubbleType, "S") then
               dso:mark( "blue", "disk", 7, 0.7, text )
            end
         end
      end
   end
end

celestia:unmarkall()
celestia:setrenderflags { markers = true }
label_galaxy_types()

celestia:select(mw)
celestia:getobserver():gotodistance(mw, 1e20, 10)
wait(10)


- In Cel scripting, marker labels are added using the label "xxx" field:

Code: Select all

mark { object "Sol/Mars" size 55 color [ 0 0 1 ] symbol "disk" alpha 0.7 label "Planet type: Telluric"}

Posted: 03.01.2008, 13:43
by ElChristou
How long the string can be? If too long there is some auto breaks?

Posted: 03.01.2008, 13:57
by ajtribick
Looks like I'll have to regenerate my CHARM2 marker script when the next release comes out.

Is it possible to include manual line breaks in the label?

Posted: 03.01.2008, 13:58
by Vincent
ElChristou wrote:How long the string can be? If too long there is some auto breaks?
chaos syndrome wrote:Is it possible to include manual line breaks in the label?

The string can be as long as your screen width allows... :wink:
I initially added no text layout support for marker labels, so as to keep things simple. That means that neither manual ("\n"), nor auto line breaks can be used. Of course, this can be added later, along with a new argument to specify the font to use...

Posted: 03.01.2008, 14:21
by ElChristou
Vincent wrote:Of course, this can be added later, along with a new argument to specify the font to use...


I think the manual break would be welcome; now text should stay normalized to keep the coherence of Celestia display...

Posted: 03.01.2008, 22:14
by Vincent
The field for cel scripting has been changed from 'name' to 'label':

Code: Select all

mark { object "Sol/Mars" size 55 color [ 0 0 1 ] symbol "disk" alpha 0.7 label "Planet type: Telluric"}


ElChristou wrote:I think the manual break would be welcome

Handling line breaks might be trickier than I first thought...

Posted: 03.01.2008, 22:19
by ElChristou
ElChristou wrote:I think the manual break would be welcome
Handling line breaks might be trickier than I first thought...[/quote]

It's was my fear! :x