Celestia/Celx 指令碼/CELX Lua 方法/CEL 命令標記
外觀
mark { object <objectstring> size <sizenumber> color <colorvector> symbol <symbolstring> label <labelstring> occludable <boolean_occludable> }
此命令使用指定的 <symbolstring>、<sizenumber> 和 <colorvector> 對 <objectstring> 進行標記。還可以向標記新增標籤 <labelstring>,並定義標記是否會被前面的物件隱藏。
引數
- object <objectstring>
- 要標記的物件名稱。無預設值。
- size <sizenumber>
- 符號的直徑(以畫素為單位)。預設值為 10.0。
- color <colorvector>
- 定義符號的顏色。預設值為 [1 0 0],即紅色。
三個數字分別定義紅色、綠色和藍色的強度(RGB)。允許的值為 0 到 1,小數用前導 0 指定,例如 0.5。任何大於 1 的值都與指定為 1 相同。 - symbol <symbolstring>
- 定義用於標記物件的符號形狀。預設值為 "diamond"。
必須是以下字串值之一- diamond
- plus
- square
- triangle
- x
- 1.6.0 filledsquare
- 1.6.0 leftarrow
- 1.6.0 rightarrow
- 1.6.0 uparrow
- 1.6.0 downarrow
- 1.6.0 circle
- 1.6.0 disk
- 1.6.0 label <labelstring>
- 標記的文字標籤。預設值為空字串,表示沒有標籤。
- 1.6.0 occludable <boolean_occludable>
- 一個布林標誌(true|false),指示標記是否會被前面的物件隱藏。預設值為 true,標記會被前面的物件隱藏。
CELX 等效-1
基於 celestia:mark() 方法。
注意: 使用此方法無法定義標記的 size、color、symbol、label 和 occludability。
應改為使用 object:mark() 方法(參見 CELX 等效-2)。
- 找到名稱為 <objectstring> 的要標記的物件,並存儲在 "objectname" 中。
objectname = celestia:find( <objectstring> )
- 標記指定的物件。
celestia:mark( objectname )
總結
objectname = celestia:find( <objectstring> ) celestia:mark( objectname )
CELX 等效-2
基於 object:mark() 方法。
- 找到名稱為 <objectstring> 的要標記的物件,並存儲在 "objectname" 中。
objectname = celestia:find( <objectstring> )
- 根據指定的引數,在 "objectname" 上放置一個標記
- <colorstring>: 用於標記的顏色。預設值為 lime。
- 可以使用 HTML 風格的十六進位制顏色字串,例如 " #00ff00"(lime),
或者使用一些預定義的顏色名稱,例如:"red"、"green"、"yellow"、"blue"、"white"、"black" 等。
可以在 HTML 顏色名稱 頁面找到支援的顏色名稱列表。
- 可以使用 HTML 風格的十六進位制顏色字串,例如 " #00ff00"(lime),
- <symbolstring>: 用於標記的符號名稱。預設值為 "diamond"。
可用的標記符號是- "diamond"、"triangle"、"square"、"plus"、"x"、"filledsquare",
"leftarrow"、"rightarrow"、"uparrow"、"downarrow"、"circle"、"disk"。
- "diamond"、"triangle"、"square"、"plus"、"x"、"filledsquare",
- <sizenumber>: 標記的大小(以畫素為單位)。預設值為 10。
- <opacitynumber>: 一個從 0 到 1 的值,表示標記的不透明度。預設值為 1.0,完全不透明。
- <labelstring>: 可以新增到標記的文字標籤。預設值為空字串,表示沒有標記標籤。
- <boolean_occludable>: 一個布林標誌,指示標記是否會被前面的物件隱藏。預設值為 true !!!
注意: 在之前的 Celestia 版本(1.5.1 及更早版本)中,標記不會被前面的物件隱藏,而在 Celestia 1.6.0 及更高版本中,預設值不是這樣 !!!
注意: 在 Celestia 1.5.1 及更早版本中使用 <boolean_occludable> 將導致 Celestia 錯誤 !!!
- <colorstring>: 用於標記的顏色。預設值為 lime。
objectname:mark( <colorstring>, <symbolstring>, <sizenumber>, <opacitynumber>, <labelstring>, <boolean_occludable> )
總結
objectname = celestia:find( <string> ) objectname:mark( <colorstring>, <symbolstring>, <sizenumber>, <opacitynumber>, <labelstring>, <boolean_occludable> )
例子
以下示例使用綠色的 "x" 標記地球,並且(1.6.0)新增一個標籤 "This is our Earth",這個標籤即使有物件經過也會一直顯示。
CEL
# In previous Celestia releases (version 1.5.1 and older).
mark { object "Sol/Earth" size 15 color [0 1 0] symbol "x" }
# In newer Celestia releases (version 1.6.0 and later).
mark { object "Sol/Earth" size 15 color [0 1 0] symbol "x" label "This is our Earth" occludable false }
CELX with the celestia:mark() method not completely compatible
-- This example will NOT meet the required size, color and symbol !!!
objectname = celestia:find("Sol/Earth")
celestia:mark(objectname)
CELX with the object:mark() method
-- In previous Celestia releases (version 1.4.1 and older).
objectname = celestia:find("Sol/Earth")
objectname:mark("green", "x", 15.0, 1)
-- In previous Celestia releases (version 1.5.0 and 1.5.1).
objectname = celestia:find("Sol/Earth")
objectname:mark("green", "x", 15.0, 1, "This is our Earth" )
-- In newer Celestia releases (version 1.6.0 and later).
objectname = celestia:find("Sol/Earth")
objectname:mark("green", "x", 15.0, 1, "This is our Earth", false)