如果网格从位置 (0,0,0) 移动到 (10,0,0)。网格在 x 方向的新位置是“10”。那么,头寸的计量单位是多少。是以米、毫米还是厘米为单位。
即 10 m 或 10 mm 或 10 cm 或 10 px ?
我有一个嵌套数组,一旦条件满足,它应该给所有的父ID,例如我有一个数据数组,我应该匹配
var data = [{
"id": 96,
"name": "test1",
"items": [{
"id": 181,
"name": "Yes",
"items": []
}, {
"id": 182,
"name": "No",
"items": []
}]
}, {
"id": 109,
"name": "Test5",
"items": [{
"id": 219,
"name": "opt2",
"items": [{
"id": 76,
"name": "test3",
"items": [{
"id": 173,
"name": "Yes",
"items": []
}, {
"id": 174,
"name": "No",
"items": [{
"id": 100,
"name": "test2",
"items": [{
"id": 189,
"name": "Yes",
"items": []
}]
}]
}]
}] …Run Code Online (Sandbox Code Playgroud)我有一个可注入服务(EntityApi),它扩展了一个类(BaseApi)。在我的规范中,我喜欢用 BaseApiStub 模拟 BaseApi。但这是徒劳的。总是调用 EntityApi。
// class
export class BaseApi { // want to mock BaseApi
constructor(injector: Injector) {
console.log("Should not be here...");
}
}
// service
@Injectable()
export class EntityApi extends BaseApi {
constructor(injector: Injector) {
super(injector, "entity");
}
}
// component
@Component({
selector: 'rt-entity-list',
templateUrl: './entity-list.component.html',
})
export class EntityListComponent {
api: any;
constructor(public entityApi: EntityApi) {
this.api = entityApi;
}
}
// mock api
export class BaseApiStub { //mocked api
constructor() {
console.log("You are on track!!")
} …Run Code Online (Sandbox Code Playgroud)使用three.js库我已经组装了一个设计(植物)。该设计包含许多较小的模型,这些模型具有从原点 (0,0,0) 在 (x, y, z) 中的位置参考。在以下链接中附上了示例屏幕截图

现在我想将具有自己位置的单个模型加载到 Cesium 中。当我尝试加载直接将位置 (x, y, z) 转换为 (north, Eastern, up) 时,结果并不如预期。所有的模型都是分散的。
我试图实现的功能是,基于一些原点(lon,lat,alt)点,我应该将模型定位到铯中,参考(x,y,z)相对于铯坐标(lon,lat,alt) )
例如
原点地理坐标 (ori_lon, ori_lat, ori_alt) => (-106.690647, 36.806761, 0)
模型坐标 (m_x, m_y, m_z) => (-150.9, 126.26, 217.7)
铯的期望坐标:(ori_lon + m_x、ori_lat + m_y、ori_alt + m_z)
或一些算法来实现这一点。
我已尝试使用以下文章将 (x, y, z) 转换为具有某些来源 (long, lat, alt) 的 (long, lat, alt),但没有成功:(
解决问题的建议/帮助。
我需要将对象数组转换为对象.我已经完成了以下逻辑.有没有最好的方法来处理这个?
var before = [{
"x": ["2015-10-14T01:59:59.999+05:30", "2015-10-14T03:59:59.998+05:30", "2015-10-14T05:59:59.997+05:30", "2015-10-14T07:59:59.996+05:30", "2015-10-14T09:59:59.995+05:30", "2015-10-14T11:59:59.994+05:30", "2015-10-14T13:59:59.993+05:30", "2015-10-14T15:59:59.992+05:30", "2015-10-14T17:59:59.991+05:30", "2015-10-14T19:59:59.990+05:30", "2015-10-14T21:59:59.989+05:30", "2015-10-14T23:59:59.988+05:30"]
}, {
"CleanCoal": ["0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00"]
}, {
"Middelings": ["0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00"]
}, {
"Prime": ["0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00"]
}, {
"SpiralProd": ["0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00", "0.00"]
}]; …Run Code Online (Sandbox Code Playgroud)我在 Three.js 框架中渲染了一些 3D 对象(JSON 和 OBJ 模型)。现在我需要根据地理坐标将场景渲染到Cesium框架中。
以前有人尝试过这个吗?如果有人可以分享一些关于此的文章或示例应用程序(即集成 Cesium 和 Three.js),那将会很有帮助。
javascript ×5
arrays ×2
three.js ×2
angular ×1
cesium ×1
cesiumjs ×1
jasmine ×1
math ×1
unit-testing ×1