-
static bd09ToGcj02(lat, lng) → {JSON}
-
百度 bd09 转化为 gcj02 火星坐标
Parameters:
Name |
Type |
Description |
lat |
float
|
百度坐标的纬库 |
lng |
float
|
百度坐标的经度 |
Returns:
JSON
- 返回转换后的火星坐标{lat, lng}
-
static bd09ToWgs84(lat, lng) → {JSON}
-
百度坐标转谷歌坐标
Parameters:
Name |
Type |
Description |
lat |
float
|
bd09坐标的纬度 |
lng |
float
|
bd09坐标的经度 |
Returns:
JSON
- 转换后的Wgs84坐标 {lat, lng}
-
static checkSpriteInView(marker) → {boolean}
-
判断SpriteMarker是否出现在视图中
Returns:
boolean
-
static cloneJSON(json) → {JSON}
-
克隆JSON对象log
Parameters:
Name |
Type |
Description |
json |
JSON
|
json对象 |
Returns:
JSON
- 克隆的json对象
-
static collect(nodeName) → {Array.<OMNode>}
-
收集一OMScene中的某个node结点,如modelNode, markerNode,...
Parameters:
Name |
Type |
Description |
nodeName |
string
|
结点名称 |
Returns:
Array.<OMNode>
- 返回找到的结点集合
-
static collectMaterials(nodes, filter) → {Array.<Material>}
-
收集node及所有子结点的mateirls, 用于制作材质透明度等动画
Parameters:
Name |
Type |
Description |
nodes |
OMNode
|
Array.<OMNode>
|
结点对象, 一般为 OMFloor or OMBuilding or modelNode, markerNode 等 |
filter |
function
|
过滤函数, 如果返回 true 则会跳过收集此结点的材质 |
Returns:
Array.<Material>
- 所收集到的所有的材质对象数组
-
static colorToStr(val) → {string}
-
颜色值转换: 0x to '#'
Parameters:
Name |
Type |
Description |
val |
color
|
16进制颜色值: 0xff00ff |
Returns:
string
- css颜色值: '#ff00ff'
-
static findFromArray(arr, key, value, cb)
-
从Array中查找数据
Parameters:
Name |
Type |
Description |
arr |
Array
|
数组对象 |
key |
string
|
要查找的键值 |
value |
*
|
值 |
cb |
function
|
callback |
-
static findMarkerData(rootData, query) → {Array.<object>}
-
查找 marker 数据
Parameters:
Name |
Type |
Description |
rootData |
object
|
数据源, scene.data, building.data, floor.data |
query |
function
|
return true or false |
Returns:
Array.<object>
- 找到的 marker数据数组
-
static findModelData(rootData, query) → {Array.<object>}
-
查找 model 数据
Parameters:
Name |
Type |
Description |
rootData |
object
|
数据源, scene.data, building.data, floor.data |
query |
function
|
return true or false |
Returns:
Array.<object>
- 找到的 model数据数组doc
-
static focusObject(map, object, callbackopt, durationopt, expandopt)
-
视图聚焦到指定物体上
Parameters:
Name |
Type |
Attributes |
Default |
Description |
map |
Map
|
|
|
ooomap地图对象 |
object |
Object3D
|
Array.<Object3D>
|
|
|
指定的聚焦物体, 或一组物体 |
callback |
function
|
<optional>
|
|
动画完成后的回调 |
duration |
float
|
<optional>
|
300
|
动画时间,默认为全局的动画时间300毫秒 |
expand |
float
|
<optional>
|
1.3
|
物体的“扩大”半径 |
-
static gcj02ToBd09(lng, lat) → {Object}
-
火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换
即谷歌、高德 转 百度
Parameters:
Name |
Type |
Description |
lng |
|
|
lat |
|
|
Returns:
Object
- {lat:, lng:}
-
static gcj02ToWgs84(lat, lng) → {JSON}
-
火星坐标转谷歌坐标
Parameters:
Name |
Type |
Description |
lat |
float
|
火星坐标纬度 |
lng |
float
|
火星坐标经度 |
Returns:
JSON
- 转换后的谷歌坐标{lat, lng}
-
static generateID(lenopt, prefixopt) → {string}
-
使用时间戳与随机数生成一个字符串
Parameters:
Name |
Type |
Attributes |
Default |
Description |
len |
int
|
<optional>
|
16
|
字符串的长度 |
prefix |
string
|
<optional>
|
|
生成的字符串前缀
s: scene
b: building
m: model |
Returns:
string
-
static getBBoxOfObjects(objects) → {Box3}
-
得到单个或多个结点的整体包围盒
Parameters:
Name |
Type |
Description |
objects |
Object3d
|
Array.<Object3d>
|
单个或多个结点 |
Returns:
Box3
- 包围盒
-
static getBoundingSphere(objects) → {Sphere}
-
得到物体的包围球
Parameters:
Name |
Type |
Description |
objects |
object3D
|
Array.<object3D>
|
单个或多个对象 |
Returns:
Sphere
- boundingSphere
-
static getCamera2DSize(map, distance) → {JSON}
-
get camera2D size by camera3D and distance
Parameters:
Name |
Type |
Description |
map |
Map
|
地图对象 |
distance |
float
|
物体对于3D相机的距离 |
Returns:
JSON
- {top:, right:}
-
static getCameraDataByZoom(map, zoom) → {JSON}
-
根据指定的zoom(比例尺)
Parameters:
Name |
Type |
Description |
map |
Map
|
om 地图实例 |
zoom |
flat
|
比例尺:屏幕1cm代码地图上的多少cm |
Returns:
JSON
- {distance, top}
-
static getMouse(e, map) → {Vector2}
-
得到鼠标或触摸在地图的container上的拾取的screen点
Parameters:
Name |
Type |
Description |
e |
MouseEvent
|
TouchEvent
|
鼠标或触摸事件 |
map |
ooomap
|
ooomap 地图实例 |
Returns:
Vector2
- 得到的屏幕点 x: 0 ~ 1, y: 0 ~ 1,用于拾取等操作
-
static getNearestAngle(from, to, isDegree) → {float}
-
在角度的运算中,得到给定的两个角度值之间最少的角度值
Parameters:
Name |
Type |
Default |
Description |
from |
float
|
|
角度值, 如: 45 |
to |
float
|
|
角度值, 如: 180 |
isDegree |
bool
|
false
|
是否为角度值。默认为弧度 |
Returns:
float
- 最小角度值
-
-
得到给定节点所属于的 OMBuilding 或 OMScene 对象
Parameters:
Name |
Type |
Description |
node |
OMNode
|
OMNode节点 |
-
static getp(obj, …prop, val)
-
得到Object上任意的属性值, 如果传入的所有属性都没有值(undefined), 将返回
最后一个参数做为默认值
Parameters:
Name |
Type |
Attributes |
Description |
obj |
Object
|
|
Object对象 |
prop |
string
|
<repeatable>
|
一个或多个参数名 |
val |
*
|
|
default value |
Example
// 得到 obj 对象上,color 或 _color 或 defaultColor 的值
// 如果这些值都不存在,那么就使用最后一个参数传入的默认值
util.getp(obj, 'color', '_color', 'defaultColor', 0xff00ff);
-
static getPointByDistance()
-
线上(点集合),给个距离. 得到对应的点, 以及此点的向量
-
static getRootNode(omScene, nodeName, callback) → {Array.<node>}
-
得到omScene中所有的特殊结点,如 blockNode, markerNode 等
Parameters:
Name |
Type |
Description |
omScene |
OMScene
|
OMScene对象 |
nodeName |
string
|
结点的名称 |
callback |
function
|
在找到某个结点时运行的回调方法 |
Returns:
Array.<node>
-
static getSuper()
-
在class外得到super
-
static getZoomByRadius(map, radius, expand) → {float}
-
通过半径得到视图范围的zoom值
Parameters:
Name |
Type |
Description |
map |
Map
|
Map对象 |
radius |
float
|
半径大小 |
expand |
float
|
视图的四周留白比例 |
Returns:
float
- zoom值的大小
-
static getZoomFactor()
-
zoomFactor, use to make markers have constant size
-
static iscw(ps)
-
判断 闭合的 ELine 是否为顺时针方向
Parameters:
Name |
Type |
Description |
ps |
Vector3
|
point or vector3 array |
-
static isJson(obj) → {Boolean}
-
判断是否为json对象
Parameters:
Name |
Type |
Description |
obj |
*
|
对象 |
Returns:
Boolean
-
static latLongToVector3(lat, lon, radius, heigth) → {Vector3}
-
将经纬度坐标转换为球面上的Vector3点
Parameters:
Name |
Type |
Description |
lat |
flot
|
经度 |
lon |
float
|
纬度 |
radius |
float
|
半径 |
heigth |
float
|
高度 |
Returns:
Vector3
- Vector3坐标
-
static lngLatToMercator(lonLat) → {JSON}
-
经纬度转墨卡托
Parameters:
Name |
Type |
Description |
lonLat |
JSON
|
经纬度{lat, lng}, or (lng, lat) |
Returns:
JSON
- 墨卡托坐标 {x, y}
-
static loadTexture(url, onLoad)
-
载入图片为Texture
Parameters:
Name |
Type |
Description |
url |
string
|
图片的url地址 |
onLoad |
function
|
图片载入完成后的回调,参数为texture |
-
static mercatorToLngLat(mercator) → {JSON}
-
墨卡托转经纬度
Parameters:
Name |
Type |
Description |
mercator |
JSON
|
墨卡托坐标 {x, y}, , or (x, y) |
Returns:
JSON
- 经纬度坐标 {lat, lng}
-
static removeFromArray(arr, itms) → {null}
-
从给定的数组中移除多个元素
Parameters:
Name |
Type |
Description |
arr |
Array
|
数组元素 |
itms |
*
|
数组中的元素 |
Returns:
null
-
static setMaterialColor(material, color)
-
同时设置,color 及 emissive ,并将color值 / 2,这样即保持与指定的颜色大至相同,又存在“自发光”的效果
Parameters:
Name |
Type |
Description |
material |
Material
|
材质 material对象 |
color |
stringColor
|
hexColor
|
'#ff00ff' or 0xff00ff |
-
static traverse(arr, cb) → {null}
-
递归处理一个数组及元素的children里面的所有元素
Parameters:
Name |
Type |
Description |
arr |
Array
|
集合物体, 里面的元素的子元素为children |
cb |
function
|
处理方法, 如果方法有返回值并且不为 null | false | 0,则不再处理它的children |
Returns:
null
-
static traverseJSON()
-
递归遍历json对象
handlers 可以为 function(key, val, host), 或 为一个Object 对象
handlers: {
key1: function(val, host),
key2: function(val, host),
}
-
static vector3ToScreen(map, vector3) → {Vector3}
-
得到场景中的vector3点对应的屏幕坐标
Parameters:
Name |
Type |
Description |
map |
Map
|
地图对象 |
vector3 |
Vector3
|
场景中的Vector3点 |
Returns:
Vector3
- 返回对应的屏幕点
-
static wgs84ToGcj02(lng, lat) → {Object}
-
WGS84转GCj02
Parameters:
Name |
Type |
Description |
lng |
|
|
lat |
|
|
Returns:
Object
- {lat:, lng:}