compass3dir.class
来自「是一个经济学管理应用软件 很难找的 但是经济学学生又必须用到」· CLASS 代码 · 共 120 行
CLASS
120 行
// compass3dir
//
// Style for compass directions with 3 directions between N, E, S, and W.
//
// Also allows Top for north, Bottom for south, Left for west, and Right for
// for east.
*! version 1.0.0 29aug2002
version 8
class {
class:
_nms_for_pi = { "east", "eneast", "neast", "nneast", "north", ///
"nnwest", "nwest", "wnwest", "west", "wswest", ///
"swest", "sswest", "south", "sseast", "seast", ///
"eseast", "center" }
} , inherit(codestyle)
// ---------------------------------------------------------------------------
// Returns the angle associated with the direction.
//
// Note, does not matter what "center" returns, nothing would be useful.
program angle
class exit = (`._nms_for_pi.arrindexof `.stylename''-1) * c(pi) / 8
end
// ---------------------------------------------------------------------------
program _unabbrev
local 0 , `0'
syntax [ , East ENEast NEast NNEast North NNWest NWest WNWest ///
West WSWest SWest SSWest South SSEast SEast ESEast ///
Top Bottom Left Right Center * ]
if length(`"`options'"') <= 3 {
local c = substr(`"`options'"', 1, 1)
local wc 0`:word count `east' `eneast' `neast' `nneast' ///
`north' `nnwest' `nwest' `wnwest' `west' ///
`wswest' `swest' `sswest' `south' `sseast' ///
`seast' `eseast' `center''
if "`c'" > "A" & "`c'" < "X" & `wc' == 0 {
if `"`options'"' == "N" {
class exit "north"
}
if `"`options'"' == "S" {
class exit "south"
}
if `"`options'"' == "E" {
class exit "east"
}
if `"`options'"' == "W" {
class exit "west"
}
if `"`options'"' == "NE" {
class exit "neast"
}
if `"`options'"' == "NW" {
class exit "nwest"
}
if `"`options'"' == "SE" {
class exit "seast"
}
if `"`options'"' == "SW" {
class exit "swest"
}
if `"`options'"' == "NNE" {
class exit "nneast"
}
if `"`options'"' == "ENE" {
class exit "eneast"
}
if `"`options'"' == "NNW" {
class exit "nnwest"
}
if `"`options'"' == "WNW" {
class exit "wnwest"
}
if `"`options'"' == "SSE" {
class exit "sseast"
}
if `"`options'"' == "ESE" {
class exit "eseast"
}
if `"`options'"' == "SSW" {
class exit "sswest"
}
if `"`options'"' == "WSW" {
class exit "wswest"
}
if `"`options'"' == "T" {
class exit "north"
}
if `"`options'"' == "B" {
class exit "south"
}
if `"`options'"' == "R" {
class exit "east"
}
if `"`options'"' == "L" {
class exit "west"
}
}
}
local name `east' `eneast' `neast' `nneast' `north' `nnwest' ///
`nwest' `wnwest' `west' `wswest' `swest' `sswest' ///
`south' `sseast' `seast' `eseast' `center' `options'
class exit "`name'"
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?